agentlogs 0.0.15 → 0.1.1

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 (2) hide show
  1. package/dist/index.js +160 -149
  2. package/package.json +6 -1
package/dist/index.js CHANGED
@@ -1,208 +1,219 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as iV}from"node:module";var pV=Object.create;var{getPrototypeOf:dV,defineProperty:b8,getOwnPropertyNames:rV}=Object;var nV=Object.prototype.hasOwnProperty;var G8=(_,z,A)=>{A=_!=null?pV(dV(_)):{};let b=z||!_||!_.__esModule?b8(A,"default",{value:_,enumerable:!0}):A;for(let G of rV(_))if(!nV.call(b,G))b8(b,G,{get:()=>_[G],enumerable:!0});return b};var I=(_,z)=>()=>(z||_((z={exports:{}}).exports,z),z.exports);var J8=(_,z)=>{for(var A in z)b8(_,A,{get:z[A],enumerable:!0,configurable:!0,set:(b)=>z[A]=()=>b})};var q4=iV(import.meta.url);var o1=I((oV)=>{class Y8 extends Error{constructor(_,z,A){super(A);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=z,this.exitCode=_,this.nestedError=void 0}}class Pb extends Y8{constructor(_){super(1,"commander.invalidArgument",_);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}oV.CommanderError=Y8;oV.InvalidArgumentError=Pb});var S3=I((_U)=>{var{InvalidArgumentError:tV}=o1();class Sb{constructor(_,z){switch(this.description=z||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,_[0]){case"<":this.required=!0,this._name=_.slice(1,-1);break;case"[":this.required=!1,this._name=_.slice(1,-1);break;default:this.required=!0,this._name=_;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(_,z){if(z===this.defaultValue||!Array.isArray(z))return[_];return z.push(_),z}default(_,z){return this.defaultValue=_,this.defaultValueDescription=z,this}argParser(_){return this.parseArg=_,this}choices(_){return this.argChoices=_.slice(),this.parseArg=(z,A)=>{if(!this.argChoices.includes(z))throw new tV(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(z,A);return z},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function eV(_){let z=_.name()+(_.variadic===!0?"...":"");return _.required?"<"+z+">":"["+z+"]"}_U.Argument=Sb;_U.humanReadableArgName=eV});var X8=I((GU)=>{var{humanReadableArgName:bU}=S3();class kb{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(_){this.helpWidth=this.helpWidth??_.helpWidth??80}visibleCommands(_){let z=_.commands.filter((b)=>!b._hidden),A=_._getHelpCommand();if(A&&!A._hidden)z.push(A);if(this.sortSubcommands)z.sort((b,G)=>{return b.name().localeCompare(G.name())});return z}compareOptions(_,z){let A=(b)=>{return b.short?b.short.replace(/^-/,""):b.long.replace(/^--/,"")};return A(_).localeCompare(A(z))}visibleOptions(_){let z=_.options.filter((b)=>!b.hidden),A=_._getHelpOption();if(A&&!A.hidden){let b=A.short&&_._findOption(A.short),G=A.long&&_._findOption(A.long);if(!b&&!G)z.push(A);else if(A.long&&!G)z.push(_.createOption(A.long,A.description));else if(A.short&&!b)z.push(_.createOption(A.short,A.description))}if(this.sortOptions)z.sort(this.compareOptions);return z}visibleGlobalOptions(_){if(!this.showGlobalOptions)return[];let z=[];for(let A=_.parent;A;A=A.parent){let b=A.options.filter((G)=>!G.hidden);z.push(...b)}if(this.sortOptions)z.sort(this.compareOptions);return z}visibleArguments(_){if(_._argsDescription)_.registeredArguments.forEach((z)=>{z.description=z.description||_._argsDescription[z.name()]||""});if(_.registeredArguments.find((z)=>z.description))return _.registeredArguments;return[]}subcommandTerm(_){let z=_.registeredArguments.map((A)=>bU(A)).join(" ");return _._name+(_._aliases[0]?"|"+_._aliases[0]:"")+(_.options.length?" [options]":"")+(z?" "+z:"")}optionTerm(_){return _.flags}argumentTerm(_){return _.name()}longestSubcommandTermLength(_,z){return z.visibleCommands(_).reduce((A,b)=>{return Math.max(A,this.displayWidth(z.styleSubcommandTerm(z.subcommandTerm(b))))},0)}longestOptionTermLength(_,z){return z.visibleOptions(_).reduce((A,b)=>{return Math.max(A,this.displayWidth(z.styleOptionTerm(z.optionTerm(b))))},0)}longestGlobalOptionTermLength(_,z){return z.visibleGlobalOptions(_).reduce((A,b)=>{return Math.max(A,this.displayWidth(z.styleOptionTerm(z.optionTerm(b))))},0)}longestArgumentTermLength(_,z){return z.visibleArguments(_).reduce((A,b)=>{return Math.max(A,this.displayWidth(z.styleArgumentTerm(z.argumentTerm(b))))},0)}commandUsage(_){let z=_._name;if(_._aliases[0])z=z+"|"+_._aliases[0];let A="";for(let b=_.parent;b;b=b.parent)A=b.name()+" "+A;return A+z+" "+_.usage()}commandDescription(_){return _.description()}subcommandDescription(_){return _.summary()||_.description()}optionDescription(_){let z=[];if(_.argChoices)z.push(`choices: ${_.argChoices.map((A)=>JSON.stringify(A)).join(", ")}`);if(_.defaultValue!==void 0){if(_.required||_.optional||_.isBoolean()&&typeof _.defaultValue==="boolean")z.push(`default: ${_.defaultValueDescription||JSON.stringify(_.defaultValue)}`)}if(_.presetArg!==void 0&&_.optional)z.push(`preset: ${JSON.stringify(_.presetArg)}`);if(_.envVar!==void 0)z.push(`env: ${_.envVar}`);if(z.length>0){let A=`(${z.join(", ")})`;if(_.description)return`${_.description} ${A}`;return A}return _.description}argumentDescription(_){let z=[];if(_.argChoices)z.push(`choices: ${_.argChoices.map((A)=>JSON.stringify(A)).join(", ")}`);if(_.defaultValue!==void 0)z.push(`default: ${_.defaultValueDescription||JSON.stringify(_.defaultValue)}`);if(z.length>0){let A=`(${z.join(", ")})`;if(_.description)return`${_.description} ${A}`;return A}return _.description}formatItemList(_,z,A){if(z.length===0)return[];return[A.styleTitle(_),...z,""]}groupItems(_,z,A){let b=new Map;return _.forEach((G)=>{let J=A(G);if(!b.has(J))b.set(J,[])}),z.forEach((G)=>{let J=A(G);if(!b.has(J))b.set(J,[]);b.get(J).push(G)}),b}formatHelp(_,z){let A=z.padWidth(_,z),b=z.helpWidth??80;function G(H,B){return z.formatItem(H,A,B,z)}let J=[`${z.styleTitle("Usage:")} ${z.styleUsage(z.commandUsage(_))}`,""],Y=z.commandDescription(_);if(Y.length>0)J=J.concat([z.boxWrap(z.styleCommandDescription(Y),b),""]);let X=z.visibleArguments(_).map((H)=>{return G(z.styleArgumentTerm(z.argumentTerm(H)),z.styleArgumentDescription(z.argumentDescription(H)))});if(J=J.concat(this.formatItemList("Arguments:",X,z)),this.groupItems(_.options,z.visibleOptions(_),(H)=>H.helpGroupHeading??"Options:").forEach((H,B)=>{let Z=H.map((F)=>{return G(z.styleOptionTerm(z.optionTerm(F)),z.styleOptionDescription(z.optionDescription(F)))});J=J.concat(this.formatItemList(B,Z,z))}),z.showGlobalOptions){let H=z.visibleGlobalOptions(_).map((B)=>{return G(z.styleOptionTerm(z.optionTerm(B)),z.styleOptionDescription(z.optionDescription(B)))});J=J.concat(this.formatItemList("Global Options:",H,z))}return this.groupItems(_.commands,z.visibleCommands(_),(H)=>H.helpGroup()||"Commands:").forEach((H,B)=>{let Z=H.map((F)=>{return G(z.styleSubcommandTerm(z.subcommandTerm(F)),z.styleSubcommandDescription(z.subcommandDescription(F)))});J=J.concat(this.formatItemList(B,Z,z))}),J.join(`
3
- `)}displayWidth(_){return Ib(_).length}styleTitle(_){return _}styleUsage(_){return _.split(" ").map((z)=>{if(z==="[options]")return this.styleOptionText(z);if(z==="[command]")return this.styleSubcommandText(z);if(z[0]==="["||z[0]==="<")return this.styleArgumentText(z);return this.styleCommandText(z)}).join(" ")}styleCommandDescription(_){return this.styleDescriptionText(_)}styleOptionDescription(_){return this.styleDescriptionText(_)}styleSubcommandDescription(_){return this.styleDescriptionText(_)}styleArgumentDescription(_){return this.styleDescriptionText(_)}styleDescriptionText(_){return _}styleOptionTerm(_){return this.styleOptionText(_)}styleSubcommandTerm(_){return _.split(" ").map((z)=>{if(z==="[options]")return this.styleOptionText(z);if(z[0]==="["||z[0]==="<")return this.styleArgumentText(z);return this.styleSubcommandText(z)}).join(" ")}styleArgumentTerm(_){return this.styleArgumentText(_)}styleOptionText(_){return _}styleArgumentText(_){return _}styleSubcommandText(_){return _}styleCommandText(_){return _}padWidth(_,z){return Math.max(z.longestOptionTermLength(_,z),z.longestGlobalOptionTermLength(_,z),z.longestSubcommandTermLength(_,z),z.longestArgumentTermLength(_,z))}preformatted(_){return/\n[^\S\r\n]/.test(_)}formatItem(_,z,A,b){let J=" ".repeat(2);if(!A)return J+_;let Y=_.padEnd(z+_.length-b.displayWidth(_)),X=2,$=(this.helpWidth??80)-z-X-2,H;if($<this.minWidthToWrap||b.preformatted(A))H=A;else H=b.boxWrap(A,$).replace(/\n/g,`
4
- `+" ".repeat(z+X));return J+Y+" ".repeat(X)+H.replace(/\n/g,`
5
- ${J}`)}boxWrap(_,z){if(z<this.minWidthToWrap)return _;let A=_.split(/\r\n|\n/),b=/[\s]*[^\s]+/g,G=[];return A.forEach((J)=>{let Y=J.match(b);if(Y===null){G.push("");return}let X=[Y.shift()],Q=this.displayWidth(X[0]);Y.forEach(($)=>{let H=this.displayWidth($);if(Q+H<=z){X.push($),Q+=H;return}G.push(X.join(""));let B=$.trimStart();X=[B],Q=this.displayWidth(B)}),G.push(X.join(""))}),G.join(`
6
- `)}}function Ib(_){let z=/\x1b\[\d*(;\d*)*m/g;return _.replace(z,"")}GU.Help=kb;GU.stripColor=Ib});var Q8=I(($U)=>{var{InvalidArgumentError:XU}=o1();class Tb{constructor(_,z){this.flags=_,this.description=z||"",this.required=_.includes("<"),this.optional=_.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(_),this.mandatory=!1;let A=QU(_);if(this.short=A.shortFlag,this.long=A.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(_,z){return this.defaultValue=_,this.defaultValueDescription=z,this}preset(_){return this.presetArg=_,this}conflicts(_){return this.conflictsWith=this.conflictsWith.concat(_),this}implies(_){let z=_;if(typeof _==="string")z={[_]:!0};return this.implied=Object.assign(this.implied||{},z),this}env(_){return this.envVar=_,this}argParser(_){return this.parseArg=_,this}makeOptionMandatory(_=!0){return this.mandatory=!!_,this}hideHelp(_=!0){return this.hidden=!!_,this}_collectValue(_,z){if(z===this.defaultValue||!Array.isArray(z))return[_];return z.push(_),z}choices(_){return this.argChoices=_.slice(),this.parseArg=(z,A)=>{if(!this.argChoices.includes(z))throw new XU(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(z,A);return z},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return xb(this.name().replace(/^no-/,""));return xb(this.name())}helpGroup(_){return this.helpGroupHeading=_,this}is(_){return this.short===_||this.long===_}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class Cb{constructor(_){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,_.forEach((z)=>{if(z.negate)this.negativeOptions.set(z.attributeName(),z);else this.positiveOptions.set(z.attributeName(),z)}),this.negativeOptions.forEach((z,A)=>{if(this.positiveOptions.has(A))this.dualOptions.add(A)})}valueFromOption(_,z){let A=z.attributeName();if(!this.dualOptions.has(A))return!0;let b=this.negativeOptions.get(A).presetArg,G=b!==void 0?b:!1;return z.negate===(G===_)}}function xb(_){return _.split("-").reduce((z,A)=>{return z+A[0].toUpperCase()+A.slice(1)})}function QU(_){let z,A,b=/^-[^-]$/,G=/^--[^-]/,J=_.split(/[ |,]+/).concat("guard");if(b.test(J[0]))z=J.shift();if(G.test(J[0]))A=J.shift();if(!z&&b.test(J[0]))z=J.shift();if(!z&&G.test(J[0]))z=A,A=J.shift();if(J[0].startsWith("-")){let Y=J[0],X=`option creation failed due to '${Y}' in option flags '${_}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${X}
2
+ import{createRequire as EU}from"node:module";var UU=Object.create;var{getPrototypeOf:DU,defineProperty:BA,getOwnPropertyNames:MU}=Object;var NU=Object.prototype.hasOwnProperty;var ZA=(_,z,A)=>{A=_!=null?UU(DU(_)):{};let G=z||!_||!_.__esModule?BA(A,"default",{value:_,enumerable:!0}):A;for(let J of MU(_))if(!NU.call(G,J))BA(G,J,{get:()=>_[J],enumerable:!0});return G};var x=(_,z)=>()=>(z||_((z={exports:{}}).exports,z),z.exports);var qA=(_,z)=>{for(var A in z)BA(_,A,{get:z[A],enumerable:!0,configurable:!0,set:(G)=>z[A]=()=>G})};var W4=EU(import.meta.url);var Az=x((wU)=>{class FA extends Error{constructor(_,z,A){super(A);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=z,this.exitCode=_,this.nestedError=void 0}}class lG extends FA{constructor(_){super(1,"commander.invalidArgument",_);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}wU.CommanderError=FA;wU.InvalidArgumentError=lG});var v3=x((PU)=>{var{InvalidArgumentError:jU}=Az();class pG{constructor(_,z){switch(this.description=z||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,_[0]){case"<":this.required=!0,this._name=_.slice(1,-1);break;case"[":this.required=!1,this._name=_.slice(1,-1);break;default:this.required=!0,this._name=_;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(_,z){if(z===this.defaultValue||!Array.isArray(z))return[_];return z.push(_),z}default(_,z){return this.defaultValue=_,this.defaultValueDescription=z,this}argParser(_){return this.parseArg=_,this}choices(_){return this.argChoices=_.slice(),this.parseArg=(z,A)=>{if(!this.argChoices.includes(z))throw new jU(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(z,A);return z},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function RU(_){let z=_.name()+(_.variadic===!0?"...":"");return _.required?"<"+z+">":"["+z+"]"}PU.Argument=pG;PU.humanReadableArgName=RU});var KA=x((xU)=>{var{humanReadableArgName:IU}=v3();class dG{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(_){this.helpWidth=this.helpWidth??_.helpWidth??80}visibleCommands(_){let z=_.commands.filter((G)=>!G._hidden),A=_._getHelpCommand();if(A&&!A._hidden)z.push(A);if(this.sortSubcommands)z.sort((G,J)=>{return G.name().localeCompare(J.name())});return z}compareOptions(_,z){let A=(G)=>{return G.short?G.short.replace(/^-/,""):G.long.replace(/^--/,"")};return A(_).localeCompare(A(z))}visibleOptions(_){let z=_.options.filter((G)=>!G.hidden),A=_._getHelpOption();if(A&&!A.hidden){let G=A.short&&_._findOption(A.short),J=A.long&&_._findOption(A.long);if(!G&&!J)z.push(A);else if(A.long&&!J)z.push(_.createOption(A.long,A.description));else if(A.short&&!G)z.push(_.createOption(A.short,A.description))}if(this.sortOptions)z.sort(this.compareOptions);return z}visibleGlobalOptions(_){if(!this.showGlobalOptions)return[];let z=[];for(let A=_.parent;A;A=A.parent){let G=A.options.filter((J)=>!J.hidden);z.push(...G)}if(this.sortOptions)z.sort(this.compareOptions);return z}visibleArguments(_){if(_._argsDescription)_.registeredArguments.forEach((z)=>{z.description=z.description||_._argsDescription[z.name()]||""});if(_.registeredArguments.find((z)=>z.description))return _.registeredArguments;return[]}subcommandTerm(_){let z=_.registeredArguments.map((A)=>IU(A)).join(" ");return _._name+(_._aliases[0]?"|"+_._aliases[0]:"")+(_.options.length?" [options]":"")+(z?" "+z:"")}optionTerm(_){return _.flags}argumentTerm(_){return _.name()}longestSubcommandTermLength(_,z){return z.visibleCommands(_).reduce((A,G)=>{return Math.max(A,this.displayWidth(z.styleSubcommandTerm(z.subcommandTerm(G))))},0)}longestOptionTermLength(_,z){return z.visibleOptions(_).reduce((A,G)=>{return Math.max(A,this.displayWidth(z.styleOptionTerm(z.optionTerm(G))))},0)}longestGlobalOptionTermLength(_,z){return z.visibleGlobalOptions(_).reduce((A,G)=>{return Math.max(A,this.displayWidth(z.styleOptionTerm(z.optionTerm(G))))},0)}longestArgumentTermLength(_,z){return z.visibleArguments(_).reduce((A,G)=>{return Math.max(A,this.displayWidth(z.styleArgumentTerm(z.argumentTerm(G))))},0)}commandUsage(_){let z=_._name;if(_._aliases[0])z=z+"|"+_._aliases[0];let A="";for(let G=_.parent;G;G=G.parent)A=G.name()+" "+A;return A+z+" "+_.usage()}commandDescription(_){return _.description()}subcommandDescription(_){return _.summary()||_.description()}optionDescription(_){let z=[];if(_.argChoices)z.push(`choices: ${_.argChoices.map((A)=>JSON.stringify(A)).join(", ")}`);if(_.defaultValue!==void 0){if(_.required||_.optional||_.isBoolean()&&typeof _.defaultValue==="boolean")z.push(`default: ${_.defaultValueDescription||JSON.stringify(_.defaultValue)}`)}if(_.presetArg!==void 0&&_.optional)z.push(`preset: ${JSON.stringify(_.presetArg)}`);if(_.envVar!==void 0)z.push(`env: ${_.envVar}`);if(z.length>0){let A=`(${z.join(", ")})`;if(_.description)return`${_.description} ${A}`;return A}return _.description}argumentDescription(_){let z=[];if(_.argChoices)z.push(`choices: ${_.argChoices.map((A)=>JSON.stringify(A)).join(", ")}`);if(_.defaultValue!==void 0)z.push(`default: ${_.defaultValueDescription||JSON.stringify(_.defaultValue)}`);if(z.length>0){let A=`(${z.join(", ")})`;if(_.description)return`${_.description} ${A}`;return A}return _.description}formatItemList(_,z,A){if(z.length===0)return[];return[A.styleTitle(_),...z,""]}groupItems(_,z,A){let G=new Map;return _.forEach((J)=>{let Y=A(J);if(!G.has(Y))G.set(Y,[])}),z.forEach((J)=>{let Y=A(J);if(!G.has(Y))G.set(Y,[]);G.get(Y).push(J)}),G}formatHelp(_,z){let A=z.padWidth(_,z),G=z.helpWidth??80;function J(H,B){return z.formatItem(H,A,B,z)}let Y=[`${z.styleTitle("Usage:")} ${z.styleUsage(z.commandUsage(_))}`,""],X=z.commandDescription(_);if(X.length>0)Y=Y.concat([z.boxWrap(z.styleCommandDescription(X),G),""]);let b=z.visibleArguments(_).map((H)=>{return J(z.styleArgumentTerm(z.argumentTerm(H)),z.styleArgumentDescription(z.argumentDescription(H)))});if(Y=Y.concat(this.formatItemList("Arguments:",b,z)),this.groupItems(_.options,z.visibleOptions(_),(H)=>H.helpGroupHeading??"Options:").forEach((H,B)=>{let Z=H.map((q)=>{return J(z.styleOptionTerm(z.optionTerm(q)),z.styleOptionDescription(z.optionDescription(q)))});Y=Y.concat(this.formatItemList(B,Z,z))}),z.showGlobalOptions){let H=z.visibleGlobalOptions(_).map((B)=>{return J(z.styleOptionTerm(z.optionTerm(B)),z.styleOptionDescription(z.optionDescription(B)))});Y=Y.concat(this.formatItemList("Global Options:",H,z))}return this.groupItems(_.commands,z.visibleCommands(_),(H)=>H.helpGroup()||"Commands:").forEach((H,B)=>{let Z=H.map((q)=>{return J(z.styleSubcommandTerm(z.subcommandTerm(q)),z.styleSubcommandDescription(z.subcommandDescription(q)))});Y=Y.concat(this.formatItemList(B,Z,z))}),Y.join(`
3
+ `)}displayWidth(_){return rG(_).length}styleTitle(_){return _}styleUsage(_){return _.split(" ").map((z)=>{if(z==="[options]")return this.styleOptionText(z);if(z==="[command]")return this.styleSubcommandText(z);if(z[0]==="["||z[0]==="<")return this.styleArgumentText(z);return this.styleCommandText(z)}).join(" ")}styleCommandDescription(_){return this.styleDescriptionText(_)}styleOptionDescription(_){return this.styleDescriptionText(_)}styleSubcommandDescription(_){return this.styleDescriptionText(_)}styleArgumentDescription(_){return this.styleDescriptionText(_)}styleDescriptionText(_){return _}styleOptionTerm(_){return this.styleOptionText(_)}styleSubcommandTerm(_){return _.split(" ").map((z)=>{if(z==="[options]")return this.styleOptionText(z);if(z[0]==="["||z[0]==="<")return this.styleArgumentText(z);return this.styleSubcommandText(z)}).join(" ")}styleArgumentTerm(_){return this.styleArgumentText(_)}styleOptionText(_){return _}styleArgumentText(_){return _}styleSubcommandText(_){return _}styleCommandText(_){return _}padWidth(_,z){return Math.max(z.longestOptionTermLength(_,z),z.longestGlobalOptionTermLength(_,z),z.longestSubcommandTermLength(_,z),z.longestArgumentTermLength(_,z))}preformatted(_){return/\n[^\S\r\n]/.test(_)}formatItem(_,z,A,G){let Y=" ".repeat(2);if(!A)return Y+_;let X=_.padEnd(z+_.length-G.displayWidth(_)),b=2,$=(this.helpWidth??80)-z-b-2,H;if($<this.minWidthToWrap||G.preformatted(A))H=A;else H=G.boxWrap(A,$).replace(/\n/g,`
4
+ `+" ".repeat(z+b));return Y+X+" ".repeat(b)+H.replace(/\n/g,`
5
+ ${Y}`)}boxWrap(_,z){if(z<this.minWidthToWrap)return _;let A=_.split(/\r\n|\n/),G=/[\s]*[^\s]+/g,J=[];return A.forEach((Y)=>{let X=Y.match(G);if(X===null){J.push("");return}let b=[X.shift()],Q=this.displayWidth(b[0]);X.forEach(($)=>{let H=this.displayWidth($);if(Q+H<=z){b.push($),Q+=H;return}J.push(b.join(""));let B=$.trimStart();b=[B],Q=this.displayWidth(B)}),J.push(b.join(""))}),J.join(`
6
+ `)}}function rG(_){let z=/\x1b\[\d*(;\d*)*m/g;return _.replace(z,"")}xU.Help=dG;xU.stripColor=rG});var WA=x((gU)=>{var{InvalidArgumentError:vU}=Az();class iG{constructor(_,z){this.flags=_,this.description=z||"",this.required=_.includes("<"),this.optional=_.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(_),this.mandatory=!1;let A=yU(_);if(this.short=A.shortFlag,this.long=A.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(_,z){return this.defaultValue=_,this.defaultValueDescription=z,this}preset(_){return this.presetArg=_,this}conflicts(_){return this.conflictsWith=this.conflictsWith.concat(_),this}implies(_){let z=_;if(typeof _==="string")z={[_]:!0};return this.implied=Object.assign(this.implied||{},z),this}env(_){return this.envVar=_,this}argParser(_){return this.parseArg=_,this}makeOptionMandatory(_=!0){return this.mandatory=!!_,this}hideHelp(_=!0){return this.hidden=!!_,this}_collectValue(_,z){if(z===this.defaultValue||!Array.isArray(z))return[_];return z.push(_),z}choices(_){return this.argChoices=_.slice(),this.parseArg=(z,A)=>{if(!this.argChoices.includes(z))throw new vU(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(z,A);return z},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return nG(this.name().replace(/^no-/,""));return nG(this.name())}helpGroup(_){return this.helpGroupHeading=_,this}is(_){return this.short===_||this.long===_}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class oG{constructor(_){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,_.forEach((z)=>{if(z.negate)this.negativeOptions.set(z.attributeName(),z);else this.positiveOptions.set(z.attributeName(),z)}),this.negativeOptions.forEach((z,A)=>{if(this.positiveOptions.has(A))this.dualOptions.add(A)})}valueFromOption(_,z){let A=z.attributeName();if(!this.dualOptions.has(A))return!0;let G=this.negativeOptions.get(A).presetArg,J=G!==void 0?G:!1;return z.negate===(J===_)}}function nG(_){return _.split("-").reduce((z,A)=>{return z+A[0].toUpperCase()+A.slice(1)})}function yU(_){let z,A,G=/^-[^-]$/,J=/^--[^-]/,Y=_.split(/[ |,]+/).concat("guard");if(G.test(Y[0]))z=Y.shift();if(J.test(Y[0]))A=Y.shift();if(!z&&G.test(Y[0]))z=Y.shift();if(!z&&J.test(Y[0]))z=A,A=Y.shift();if(Y[0].startsWith("-")){let X=Y[0],b=`option creation failed due to '${X}' in option flags '${_}'`;if(/^-[^-][^-]/.test(X))throw Error(`${b}
7
7
  - a short flag is a single dash and a single character
8
8
  - either use a single dash and a single character (for a short flag)
9
- - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(b.test(Y))throw Error(`${X}
10
- - too many short flags`);if(G.test(Y))throw Error(`${X}
11
- - too many long flags`);throw Error(`${X}
12
- - unrecognised flag format`)}if(z===void 0&&A===void 0)throw Error(`option creation failed due to no flags found in '${_}'.`);return{shortFlag:z,longFlag:A}}$U.Option=Tb;$U.DualOptions=Cb});var vb=I((KU)=>{function ZU(_,z){if(Math.abs(_.length-z.length)>3)return Math.max(_.length,z.length);let A=[];for(let b=0;b<=_.length;b++)A[b]=[b];for(let b=0;b<=z.length;b++)A[0][b]=b;for(let b=1;b<=z.length;b++)for(let G=1;G<=_.length;G++){let J=1;if(_[G-1]===z[b-1])J=0;else J=1;if(A[G][b]=Math.min(A[G-1][b]+1,A[G][b-1]+1,A[G-1][b-1]+J),G>1&&b>1&&_[G-1]===z[b-2]&&_[G-2]===z[b-1])A[G][b]=Math.min(A[G][b],A[G-2][b-2]+1)}return A[_.length][z.length]}function FU(_,z){if(!z||z.length===0)return"";z=Array.from(new Set(z));let A=_.startsWith("--");if(A)_=_.slice(2),z=z.map((Y)=>Y.slice(2));let b=[],G=3,J=0.4;if(z.forEach((Y)=>{if(Y.length<=1)return;let X=ZU(_,Y),Q=Math.max(_.length,Y.length);if((Q-X)/Q>J){if(X<G)G=X,b=[Y];else if(X===G)b.push(Y)}}),b.sort((Y,X)=>Y.localeCompare(X)),A)b=b.map((Y)=>`--${Y}`);if(b.length>1)return`
13
- (Did you mean one of ${b.join(", ")}?)`;if(b.length===1)return`
14
- (Did you mean ${b[0]}?)`;return""}KU.suggestSimilar=FU});var hb=I((wU)=>{var WU=q4("node:events").EventEmitter,$8=q4("node:child_process"),W4=q4("node:path"),k3=q4("node:fs"),$0=q4("node:process"),{Argument:VU,humanReadableArgName:UU}=S3(),{CommanderError:H8}=o1(),{Help:DU,stripColor:MU}=X8(),{Option:yb,DualOptions:NU}=Q8(),{suggestSimilar:gb}=vb();class Z8 extends WU{constructor(_){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=_||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(z)=>$0.stdout.write(z),writeErr:(z)=>$0.stderr.write(z),outputError:(z,A)=>A(z),getOutHelpWidth:()=>$0.stdout.isTTY?$0.stdout.columns:void 0,getErrHelpWidth:()=>$0.stderr.isTTY?$0.stderr.columns:void 0,getOutHasColors:()=>B8()??($0.stdout.isTTY&&$0.stdout.hasColors?.()),getErrHasColors:()=>B8()??($0.stderr.isTTY&&$0.stderr.hasColors?.()),stripColor:(z)=>MU(z)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(_){return this._outputConfiguration=_._outputConfiguration,this._helpOption=_._helpOption,this._helpCommand=_._helpCommand,this._helpConfiguration=_._helpConfiguration,this._exitCallback=_._exitCallback,this._storeOptionsAsProperties=_._storeOptionsAsProperties,this._combineFlagAndOptionalValue=_._combineFlagAndOptionalValue,this._allowExcessArguments=_._allowExcessArguments,this._enablePositionalOptions=_._enablePositionalOptions,this._showHelpAfterError=_._showHelpAfterError,this._showSuggestionAfterError=_._showSuggestionAfterError,this}_getCommandAndAncestors(){let _=[];for(let z=this;z;z=z.parent)_.push(z);return _}command(_,z,A){let b=z,G=A;if(typeof b==="object"&&b!==null)G=b,b=null;G=G||{};let[,J,Y]=_.match(/([^ ]+) *(.*)/),X=this.createCommand(J);if(b)X.description(b),X._executableHandler=!0;if(G.isDefault)this._defaultCommandName=X._name;if(X._hidden=!!(G.noHelp||G.hidden),X._executableFile=G.executableFile||null,Y)X.arguments(Y);if(this._registerCommand(X),X.parent=this,X.copyInheritedSettings(this),b)return this;return X}createCommand(_){return new Z8(_)}createHelp(){return Object.assign(new DU,this.configureHelp())}configureHelp(_){if(_===void 0)return this._helpConfiguration;return this._helpConfiguration=_,this}configureOutput(_){if(_===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,..._},this}showHelpAfterError(_=!0){if(typeof _!=="string")_=!!_;return this._showHelpAfterError=_,this}showSuggestionAfterError(_=!0){return this._showSuggestionAfterError=!!_,this}addCommand(_,z){if(!_._name)throw Error(`Command passed to .addCommand() must have a name
15
- - specify the name in Command constructor or using .name()`);if(z=z||{},z.isDefault)this._defaultCommandName=_._name;if(z.noHelp||z.hidden)_._hidden=!0;return this._registerCommand(_),_.parent=this,_._checkForBrokenPassThrough(),this}createArgument(_,z){return new VU(_,z)}argument(_,z,A,b){let G=this.createArgument(_,z);if(typeof A==="function")G.default(b).argParser(A);else G.default(A);return this.addArgument(G),this}arguments(_){return _.trim().split(/ +/).forEach((z)=>{this.argument(z)}),this}addArgument(_){let z=this.registeredArguments.slice(-1)[0];if(z?.variadic)throw Error(`only the last argument can be variadic '${z.name()}'`);if(_.required&&_.defaultValue!==void 0&&_.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${_.name()}'`);return this.registeredArguments.push(_),this}helpCommand(_,z){if(typeof _==="boolean"){if(this._addImplicitHelpCommand=_,_&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let A=_??"help [command]",[,b,G]=A.match(/([^ ]+) *(.*)/),J=z??"display help for command",Y=this.createCommand(b);if(Y.helpOption(!1),G)Y.arguments(G);if(J)Y.description(J);if(this._addImplicitHelpCommand=!0,this._helpCommand=Y,_||z)this._initCommandGroup(Y);return this}addHelpCommand(_,z){if(typeof _!=="object")return this.helpCommand(_,z),this;return this._addImplicitHelpCommand=!0,this._helpCommand=_,this._initCommandGroup(_),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(_,z){let A=["preSubcommand","preAction","postAction"];if(!A.includes(_))throw Error(`Unexpected value for event passed to hook : '${_}'.
16
- Expecting one of '${A.join("', '")}'`);if(this._lifeCycleHooks[_])this._lifeCycleHooks[_].push(z);else this._lifeCycleHooks[_]=[z];return this}exitOverride(_){if(_)this._exitCallback=_;else this._exitCallback=(z)=>{if(z.code!=="commander.executeSubCommandAsync")throw z};return this}_exit(_,z,A){if(this._exitCallback)this._exitCallback(new H8(_,z,A));$0.exit(_)}action(_){let z=(A)=>{let b=this.registeredArguments.length,G=A.slice(0,b);if(this._storeOptionsAsProperties)G[b]=this;else G[b]=this.opts();return G.push(this),_.apply(this,G)};return this._actionHandler=z,this}createOption(_,z){return new yb(_,z)}_callParseArg(_,z,A,b){try{return _.parseArg(z,A)}catch(G){if(G.code==="commander.invalidArgument"){let J=`${b} ${G.message}`;this.error(J,{exitCode:G.exitCode,code:G.code})}throw G}}_registerOption(_){let z=_.short&&this._findOption(_.short)||_.long&&this._findOption(_.long);if(z){let A=_.long&&this._findOption(_.long)?_.long:_.short;throw Error(`Cannot add option '${_.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${A}'
17
- - already used by option '${z.flags}'`)}this._initOptionGroup(_),this.options.push(_)}_registerCommand(_){let z=(b)=>{return[b.name()].concat(b.aliases())},A=z(_).find((b)=>this._findCommand(b));if(A){let b=z(this._findCommand(A)).join("|"),G=z(_).join("|");throw Error(`cannot add command '${G}' as already have command '${b}'`)}this._initCommandGroup(_),this.commands.push(_)}addOption(_){this._registerOption(_);let z=_.name(),A=_.attributeName();if(_.negate){let G=_.long.replace(/^--no-/,"--");if(!this._findOption(G))this.setOptionValueWithSource(A,_.defaultValue===void 0?!0:_.defaultValue,"default")}else if(_.defaultValue!==void 0)this.setOptionValueWithSource(A,_.defaultValue,"default");let b=(G,J,Y)=>{if(G==null&&_.presetArg!==void 0)G=_.presetArg;let X=this.getOptionValue(A);if(G!==null&&_.parseArg)G=this._callParseArg(_,G,X,J);else if(G!==null&&_.variadic)G=_._collectValue(G,X);if(G==null)if(_.negate)G=!1;else if(_.isBoolean()||_.optional)G=!0;else G="";this.setOptionValueWithSource(A,G,Y)};if(this.on("option:"+z,(G)=>{let J=`error: option '${_.flags}' argument '${G}' is invalid.`;b(G,J,"cli")}),_.envVar)this.on("optionEnv:"+z,(G)=>{let J=`error: option '${_.flags}' value '${G}' from env '${_.envVar}' is invalid.`;b(G,J,"env")});return this}_optionEx(_,z,A,b,G){if(typeof z==="object"&&z instanceof yb)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let J=this.createOption(z,A);if(J.makeOptionMandatory(!!_.mandatory),typeof b==="function")J.default(G).argParser(b);else if(b instanceof RegExp){let Y=b;b=(X,Q)=>{let $=Y.exec(X);return $?$[0]:Q},J.default(G).argParser(b)}else J.default(b);return this.addOption(J)}option(_,z,A,b){return this._optionEx({},_,z,A,b)}requiredOption(_,z,A,b){return this._optionEx({mandatory:!0},_,z,A,b)}combineFlagAndOptionalValue(_=!0){return this._combineFlagAndOptionalValue=!!_,this}allowUnknownOption(_=!0){return this._allowUnknownOption=!!_,this}allowExcessArguments(_=!0){return this._allowExcessArguments=!!_,this}enablePositionalOptions(_=!0){return this._enablePositionalOptions=!!_,this}passThroughOptions(_=!0){return this._passThroughOptions=!!_,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(_=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!_,this}getOptionValue(_){if(this._storeOptionsAsProperties)return this[_];return this._optionValues[_]}setOptionValue(_,z){return this.setOptionValueWithSource(_,z,void 0)}setOptionValueWithSource(_,z,A){if(this._storeOptionsAsProperties)this[_]=z;else this._optionValues[_]=z;return this._optionValueSources[_]=A,this}getOptionValueSource(_){return this._optionValueSources[_]}getOptionValueSourceWithGlobals(_){let z;return this._getCommandAndAncestors().forEach((A)=>{if(A.getOptionValueSource(_)!==void 0)z=A.getOptionValueSource(_)}),z}_prepareUserArgs(_,z){if(_!==void 0&&!Array.isArray(_))throw Error("first parameter to parse must be array or undefined");if(z=z||{},_===void 0&&z.from===void 0){if($0.versions?.electron)z.from="electron";let b=$0.execArgv??[];if(b.includes("-e")||b.includes("--eval")||b.includes("-p")||b.includes("--print"))z.from="eval"}if(_===void 0)_=$0.argv;this.rawArgs=_.slice();let A;switch(z.from){case void 0:case"node":this._scriptPath=_[1],A=_.slice(2);break;case"electron":if($0.defaultApp)this._scriptPath=_[1],A=_.slice(2);else A=_.slice(1);break;case"user":A=_.slice(0);break;case"eval":A=_.slice(1);break;default:throw Error(`unexpected parse option { from: '${z.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",A}parse(_,z){this._prepareForParse();let A=this._prepareUserArgs(_,z);return this._parseCommand([],A),this}async parseAsync(_,z){this._prepareForParse();let A=this._prepareUserArgs(_,z);return await this._parseCommand([],A),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
18
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(_,z,A){if(k3.existsSync(_))return;let b=z?`searched for local subcommand relative to directory '${z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",G=`'${_}' does not exist
9
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(G.test(X))throw Error(`${b}
10
+ - too many short flags`);if(J.test(X))throw Error(`${b}
11
+ - too many long flags`);throw Error(`${b}
12
+ - unrecognised flag format`)}if(z===void 0&&A===void 0)throw Error(`option creation failed due to no flags found in '${_}'.`);return{shortFlag:z,longFlag:A}}gU.Option=iG;gU.DualOptions=oG});var aG=x((cU)=>{function mU(_,z){if(Math.abs(_.length-z.length)>3)return Math.max(_.length,z.length);let A=[];for(let G=0;G<=_.length;G++)A[G]=[G];for(let G=0;G<=z.length;G++)A[0][G]=G;for(let G=1;G<=z.length;G++)for(let J=1;J<=_.length;J++){let Y=1;if(_[J-1]===z[G-1])Y=0;else Y=1;if(A[J][G]=Math.min(A[J-1][G]+1,A[J][G-1]+1,A[J-1][G-1]+Y),J>1&&G>1&&_[J-1]===z[G-2]&&_[J-2]===z[G-1])A[J][G]=Math.min(A[J][G],A[J-2][G-2]+1)}return A[_.length][z.length]}function uU(_,z){if(!z||z.length===0)return"";z=Array.from(new Set(z));let A=_.startsWith("--");if(A)_=_.slice(2),z=z.map((X)=>X.slice(2));let G=[],J=3,Y=0.4;if(z.forEach((X)=>{if(X.length<=1)return;let b=mU(_,X),Q=Math.max(_.length,X.length);if((Q-b)/Q>Y){if(b<J)J=b,G=[X];else if(b===J)G.push(X)}}),G.sort((X,b)=>X.localeCompare(b)),A)G=G.map((X)=>`--${X}`);if(G.length>1)return`
13
+ (Did you mean one of ${G.join(", ")}?)`;if(G.length===1)return`
14
+ (Did you mean ${G[0]}?)`;return""}cU.suggestSimilar=uU});var _J=x((aU)=>{var pU=W4("node:events").EventEmitter,VA=W4("node:child_process"),V4=W4("node:path"),y3=W4("node:fs"),$0=W4("node:process"),{Argument:dU,humanReadableArgName:rU}=v3(),{CommanderError:UA}=Az(),{Help:nU,stripColor:iU}=KA(),{Option:sG,DualOptions:oU}=WA(),{suggestSimilar:tG}=aG();class MA extends pU{constructor(_){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=_||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(z)=>$0.stdout.write(z),writeErr:(z)=>$0.stderr.write(z),outputError:(z,A)=>A(z),getOutHelpWidth:()=>$0.stdout.isTTY?$0.stdout.columns:void 0,getErrHelpWidth:()=>$0.stderr.isTTY?$0.stderr.columns:void 0,getOutHasColors:()=>DA()??($0.stdout.isTTY&&$0.stdout.hasColors?.()),getErrHasColors:()=>DA()??($0.stderr.isTTY&&$0.stderr.hasColors?.()),stripColor:(z)=>iU(z)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(_){return this._outputConfiguration=_._outputConfiguration,this._helpOption=_._helpOption,this._helpCommand=_._helpCommand,this._helpConfiguration=_._helpConfiguration,this._exitCallback=_._exitCallback,this._storeOptionsAsProperties=_._storeOptionsAsProperties,this._combineFlagAndOptionalValue=_._combineFlagAndOptionalValue,this._allowExcessArguments=_._allowExcessArguments,this._enablePositionalOptions=_._enablePositionalOptions,this._showHelpAfterError=_._showHelpAfterError,this._showSuggestionAfterError=_._showSuggestionAfterError,this}_getCommandAndAncestors(){let _=[];for(let z=this;z;z=z.parent)_.push(z);return _}command(_,z,A){let G=z,J=A;if(typeof G==="object"&&G!==null)J=G,G=null;J=J||{};let[,Y,X]=_.match(/([^ ]+) *(.*)/),b=this.createCommand(Y);if(G)b.description(G),b._executableHandler=!0;if(J.isDefault)this._defaultCommandName=b._name;if(b._hidden=!!(J.noHelp||J.hidden),b._executableFile=J.executableFile||null,X)b.arguments(X);if(this._registerCommand(b),b.parent=this,b.copyInheritedSettings(this),G)return this;return b}createCommand(_){return new MA(_)}createHelp(){return Object.assign(new nU,this.configureHelp())}configureHelp(_){if(_===void 0)return this._helpConfiguration;return this._helpConfiguration=_,this}configureOutput(_){if(_===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,..._},this}showHelpAfterError(_=!0){if(typeof _!=="string")_=!!_;return this._showHelpAfterError=_,this}showSuggestionAfterError(_=!0){return this._showSuggestionAfterError=!!_,this}addCommand(_,z){if(!_._name)throw Error(`Command passed to .addCommand() must have a name
15
+ - specify the name in Command constructor or using .name()`);if(z=z||{},z.isDefault)this._defaultCommandName=_._name;if(z.noHelp||z.hidden)_._hidden=!0;return this._registerCommand(_),_.parent=this,_._checkForBrokenPassThrough(),this}createArgument(_,z){return new dU(_,z)}argument(_,z,A,G){let J=this.createArgument(_,z);if(typeof A==="function")J.default(G).argParser(A);else J.default(A);return this.addArgument(J),this}arguments(_){return _.trim().split(/ +/).forEach((z)=>{this.argument(z)}),this}addArgument(_){let z=this.registeredArguments.slice(-1)[0];if(z?.variadic)throw Error(`only the last argument can be variadic '${z.name()}'`);if(_.required&&_.defaultValue!==void 0&&_.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${_.name()}'`);return this.registeredArguments.push(_),this}helpCommand(_,z){if(typeof _==="boolean"){if(this._addImplicitHelpCommand=_,_&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let A=_??"help [command]",[,G,J]=A.match(/([^ ]+) *(.*)/),Y=z??"display help for command",X=this.createCommand(G);if(X.helpOption(!1),J)X.arguments(J);if(Y)X.description(Y);if(this._addImplicitHelpCommand=!0,this._helpCommand=X,_||z)this._initCommandGroup(X);return this}addHelpCommand(_,z){if(typeof _!=="object")return this.helpCommand(_,z),this;return this._addImplicitHelpCommand=!0,this._helpCommand=_,this._initCommandGroup(_),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(_,z){let A=["preSubcommand","preAction","postAction"];if(!A.includes(_))throw Error(`Unexpected value for event passed to hook : '${_}'.
16
+ Expecting one of '${A.join("', '")}'`);if(this._lifeCycleHooks[_])this._lifeCycleHooks[_].push(z);else this._lifeCycleHooks[_]=[z];return this}exitOverride(_){if(_)this._exitCallback=_;else this._exitCallback=(z)=>{if(z.code!=="commander.executeSubCommandAsync")throw z};return this}_exit(_,z,A){if(this._exitCallback)this._exitCallback(new UA(_,z,A));$0.exit(_)}action(_){let z=(A)=>{let G=this.registeredArguments.length,J=A.slice(0,G);if(this._storeOptionsAsProperties)J[G]=this;else J[G]=this.opts();return J.push(this),_.apply(this,J)};return this._actionHandler=z,this}createOption(_,z){return new sG(_,z)}_callParseArg(_,z,A,G){try{return _.parseArg(z,A)}catch(J){if(J.code==="commander.invalidArgument"){let Y=`${G} ${J.message}`;this.error(Y,{exitCode:J.exitCode,code:J.code})}throw J}}_registerOption(_){let z=_.short&&this._findOption(_.short)||_.long&&this._findOption(_.long);if(z){let A=_.long&&this._findOption(_.long)?_.long:_.short;throw Error(`Cannot add option '${_.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${A}'
17
+ - already used by option '${z.flags}'`)}this._initOptionGroup(_),this.options.push(_)}_registerCommand(_){let z=(G)=>{return[G.name()].concat(G.aliases())},A=z(_).find((G)=>this._findCommand(G));if(A){let G=z(this._findCommand(A)).join("|"),J=z(_).join("|");throw Error(`cannot add command '${J}' as already have command '${G}'`)}this._initCommandGroup(_),this.commands.push(_)}addOption(_){this._registerOption(_);let z=_.name(),A=_.attributeName();if(_.negate){let J=_.long.replace(/^--no-/,"--");if(!this._findOption(J))this.setOptionValueWithSource(A,_.defaultValue===void 0?!0:_.defaultValue,"default")}else if(_.defaultValue!==void 0)this.setOptionValueWithSource(A,_.defaultValue,"default");let G=(J,Y,X)=>{if(J==null&&_.presetArg!==void 0)J=_.presetArg;let b=this.getOptionValue(A);if(J!==null&&_.parseArg)J=this._callParseArg(_,J,b,Y);else if(J!==null&&_.variadic)J=_._collectValue(J,b);if(J==null)if(_.negate)J=!1;else if(_.isBoolean()||_.optional)J=!0;else J="";this.setOptionValueWithSource(A,J,X)};if(this.on("option:"+z,(J)=>{let Y=`error: option '${_.flags}' argument '${J}' is invalid.`;G(J,Y,"cli")}),_.envVar)this.on("optionEnv:"+z,(J)=>{let Y=`error: option '${_.flags}' value '${J}' from env '${_.envVar}' is invalid.`;G(J,Y,"env")});return this}_optionEx(_,z,A,G,J){if(typeof z==="object"&&z instanceof sG)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let Y=this.createOption(z,A);if(Y.makeOptionMandatory(!!_.mandatory),typeof G==="function")Y.default(J).argParser(G);else if(G instanceof RegExp){let X=G;G=(b,Q)=>{let $=X.exec(b);return $?$[0]:Q},Y.default(J).argParser(G)}else Y.default(G);return this.addOption(Y)}option(_,z,A,G){return this._optionEx({},_,z,A,G)}requiredOption(_,z,A,G){return this._optionEx({mandatory:!0},_,z,A,G)}combineFlagAndOptionalValue(_=!0){return this._combineFlagAndOptionalValue=!!_,this}allowUnknownOption(_=!0){return this._allowUnknownOption=!!_,this}allowExcessArguments(_=!0){return this._allowExcessArguments=!!_,this}enablePositionalOptions(_=!0){return this._enablePositionalOptions=!!_,this}passThroughOptions(_=!0){return this._passThroughOptions=!!_,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(_=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!_,this}getOptionValue(_){if(this._storeOptionsAsProperties)return this[_];return this._optionValues[_]}setOptionValue(_,z){return this.setOptionValueWithSource(_,z,void 0)}setOptionValueWithSource(_,z,A){if(this._storeOptionsAsProperties)this[_]=z;else this._optionValues[_]=z;return this._optionValueSources[_]=A,this}getOptionValueSource(_){return this._optionValueSources[_]}getOptionValueSourceWithGlobals(_){let z;return this._getCommandAndAncestors().forEach((A)=>{if(A.getOptionValueSource(_)!==void 0)z=A.getOptionValueSource(_)}),z}_prepareUserArgs(_,z){if(_!==void 0&&!Array.isArray(_))throw Error("first parameter to parse must be array or undefined");if(z=z||{},_===void 0&&z.from===void 0){if($0.versions?.electron)z.from="electron";let G=$0.execArgv??[];if(G.includes("-e")||G.includes("--eval")||G.includes("-p")||G.includes("--print"))z.from="eval"}if(_===void 0)_=$0.argv;this.rawArgs=_.slice();let A;switch(z.from){case void 0:case"node":this._scriptPath=_[1],A=_.slice(2);break;case"electron":if($0.defaultApp)this._scriptPath=_[1],A=_.slice(2);else A=_.slice(1);break;case"user":A=_.slice(0);break;case"eval":A=_.slice(1);break;default:throw Error(`unexpected parse option { from: '${z.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",A}parse(_,z){this._prepareForParse();let A=this._prepareUserArgs(_,z);return this._parseCommand([],A),this}async parseAsync(_,z){this._prepareForParse();let A=this._prepareUserArgs(_,z);return await this._parseCommand([],A),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
18
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(_,z,A){if(y3.existsSync(_))return;let G=z?`searched for local subcommand relative to directory '${z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",J=`'${_}' does not exist
19
19
  - if '${A}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
20
20
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
21
- - ${b}`;throw Error(G)}_executeSubCommand(_,z){z=z.slice();let A=!1,b=[".js",".ts",".tsx",".mjs",".cjs"];function G($,H){let B=W4.resolve($,H);if(k3.existsSync(B))return B;if(b.includes(W4.extname(H)))return;let Z=b.find((F)=>k3.existsSync(`${B}${F}`));if(Z)return`${B}${Z}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=_._executableFile||`${this._name}-${_._name}`,Y=this._executableDir||"";if(this._scriptPath){let $;try{$=k3.realpathSync(this._scriptPath)}catch{$=this._scriptPath}Y=W4.resolve(W4.dirname($),Y)}if(Y){let $=G(Y,J);if(!$&&!_._executableFile&&this._scriptPath){let H=W4.basename(this._scriptPath,W4.extname(this._scriptPath));if(H!==this._name)$=G(Y,`${H}-${_._name}`)}J=$||J}A=b.includes(W4.extname(J));let X;if($0.platform!=="win32")if(A)z.unshift(J),z=fb($0.execArgv).concat(z),X=$8.spawn($0.argv[0],z,{stdio:"inherit"});else X=$8.spawn(J,z,{stdio:"inherit"});else this._checkForMissingExecutable(J,Y,_._name),z.unshift(J),z=fb($0.execArgv).concat(z),X=$8.spawn($0.execPath,z,{stdio:"inherit"});if(!X.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((H)=>{$0.on(H,()=>{if(X.killed===!1&&X.exitCode===null)X.kill(H)})});let Q=this._exitCallback;X.on("close",($)=>{if($=$??1,!Q)$0.exit($);else Q(new H8($,"commander.executeSubCommandAsync","(close)"))}),X.on("error",($)=>{if($.code==="ENOENT")this._checkForMissingExecutable(J,Y,_._name);else if($.code==="EACCES")throw Error(`'${J}' not executable`);if(!Q)$0.exit(1);else{let H=new H8(1,"commander.executeSubCommandAsync","(error)");H.nestedError=$,Q(H)}}),this.runningCommand=X}_dispatchSubcommand(_,z,A){let b=this._findCommand(_);if(!b)this.help({error:!0});b._prepareForParse();let G;return G=this._chainOrCallSubCommandHook(G,b,"preSubcommand"),G=this._chainOrCall(G,()=>{if(b._executableHandler)this._executeSubCommand(b,z.concat(A));else return b._parseCommand(z,A)}),G}_dispatchHelpCommand(_){if(!_)this.help();let z=this._findCommand(_);if(z&&!z._executableHandler)z.help();return this._dispatchSubcommand(_,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((_,z)=>{if(_.required&&this.args[z]==null)this.missingArgument(_.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let _=(A,b,G)=>{let J=b;if(b!==null&&A.parseArg){let Y=`error: command-argument value '${b}' is invalid for argument '${A.name()}'.`;J=this._callParseArg(A,b,G,Y)}return J};this._checkNumberOfArguments();let z=[];this.registeredArguments.forEach((A,b)=>{let G=A.defaultValue;if(A.variadic){if(b<this.args.length){if(G=this.args.slice(b),A.parseArg)G=G.reduce((J,Y)=>{return _(A,Y,J)},A.defaultValue)}else if(G===void 0)G=[]}else if(b<this.args.length){if(G=this.args[b],A.parseArg)G=_(A,G,A.defaultValue)}z[b]=G}),this.processedArgs=z}_chainOrCall(_,z){if(_?.then&&typeof _.then==="function")return _.then(()=>z());return z()}_chainOrCallHooks(_,z){let A=_,b=[];if(this._getCommandAndAncestors().reverse().filter((G)=>G._lifeCycleHooks[z]!==void 0).forEach((G)=>{G._lifeCycleHooks[z].forEach((J)=>{b.push({hookedCommand:G,callback:J})})}),z==="postAction")b.reverse();return b.forEach((G)=>{A=this._chainOrCall(A,()=>{return G.callback(G.hookedCommand,this)})}),A}_chainOrCallSubCommandHook(_,z,A){let b=_;if(this._lifeCycleHooks[A]!==void 0)this._lifeCycleHooks[A].forEach((G)=>{b=this._chainOrCall(b,()=>{return G(this,z)})});return b}_parseCommand(_,z){let A=this.parseOptions(z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),_=_.concat(A.operands),z=A.unknown,this.args=_.concat(z),_&&this._findCommand(_[0]))return this._dispatchSubcommand(_[0],_.slice(1),z);if(this._getHelpCommand()&&_[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(_[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(z),this._dispatchSubcommand(this._defaultCommandName,_,z);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(A.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let b=()=>{if(A.unknown.length>0)this.unknownOption(A.unknown[0])},G=`command:${this.name()}`;if(this._actionHandler){b(),this._processArguments();let J;if(J=this._chainOrCallHooks(J,"preAction"),J=this._chainOrCall(J,()=>this._actionHandler(this.processedArgs)),this.parent)J=this._chainOrCall(J,()=>{this.parent.emit(G,_,z)});return J=this._chainOrCallHooks(J,"postAction"),J}if(this.parent?.listenerCount(G))b(),this._processArguments(),this.parent.emit(G,_,z);else if(_.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",_,z);if(this.listenerCount("command:*"))this.emit("command:*",_,z);else if(this.commands.length)this.unknownCommand();else b(),this._processArguments()}else if(this.commands.length)b(),this.help({error:!0});else b(),this._processArguments()}_findCommand(_){if(!_)return;return this.commands.find((z)=>z._name===_||z._aliases.includes(_))}_findOption(_){return this.options.find((z)=>z.is(_))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((_)=>{_.options.forEach((z)=>{if(z.mandatory&&_.getOptionValue(z.attributeName())===void 0)_.missingMandatoryOptionValue(z)})})}_checkForConflictingLocalOptions(){let _=this.options.filter((A)=>{let b=A.attributeName();if(this.getOptionValue(b)===void 0)return!1;return this.getOptionValueSource(b)!=="default"});_.filter((A)=>A.conflictsWith.length>0).forEach((A)=>{let b=_.find((G)=>A.conflictsWith.includes(G.attributeName()));if(b)this._conflictingOption(A,b)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((_)=>{_._checkForConflictingLocalOptions()})}parseOptions(_){let z=[],A=[],b=z;function G($){return $.length>1&&$[0]==="-"}let J=($)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test($))return!1;return!this._getCommandAndAncestors().some((H)=>H.options.map((B)=>B.short).some((B)=>/^-\d$/.test(B)))},Y=null,X=null,Q=0;while(Q<_.length||X){let $=X??_[Q++];if(X=null,$==="--"){if(b===A)b.push($);b.push(..._.slice(Q));break}if(Y&&(!G($)||J($))){this.emit(`option:${Y.name()}`,$);continue}if(Y=null,G($)){let H=this._findOption($);if(H){if(H.required){let B=_[Q++];if(B===void 0)this.optionMissingArgument(H);this.emit(`option:${H.name()}`,B)}else if(H.optional){let B=null;if(Q<_.length&&(!G(_[Q])||J(_[Q])))B=_[Q++];this.emit(`option:${H.name()}`,B)}else this.emit(`option:${H.name()}`);Y=H.variadic?H:null;continue}}if($.length>2&&$[0]==="-"&&$[1]!=="-"){let H=this._findOption(`-${$[1]}`);if(H){if(H.required||H.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${H.name()}`,$.slice(2));else this.emit(`option:${H.name()}`),X=`-${$.slice(2)}`;continue}}if(/^--[^=]+=/.test($)){let H=$.indexOf("="),B=this._findOption($.slice(0,H));if(B&&(B.required||B.optional)){this.emit(`option:${B.name()}`,$.slice(H+1));continue}}if(b===z&&G($)&&!(this.commands.length===0&&J($)))b=A;if((this._enablePositionalOptions||this._passThroughOptions)&&z.length===0&&A.length===0){if(this._findCommand($)){z.push($),A.push(..._.slice(Q));break}else if(this._getHelpCommand()&&$===this._getHelpCommand().name()){z.push($,..._.slice(Q));break}else if(this._defaultCommandName){A.push($,..._.slice(Q));break}}if(this._passThroughOptions){b.push($,..._.slice(Q));break}b.push($)}return{operands:z,unknown:A}}opts(){if(this._storeOptionsAsProperties){let _={},z=this.options.length;for(let A=0;A<z;A++){let b=this.options[A].attributeName();_[b]=b===this._versionOptionName?this._version:this[b]}return _}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((_,z)=>Object.assign(_,z.opts()),{})}error(_,z){if(this._outputConfiguration.outputError(`${_}
21
+ - ${G}`;throw Error(J)}_executeSubCommand(_,z){z=z.slice();let A=!1,G=[".js",".ts",".tsx",".mjs",".cjs"];function J($,H){let B=V4.resolve($,H);if(y3.existsSync(B))return B;if(G.includes(V4.extname(H)))return;let Z=G.find((q)=>y3.existsSync(`${B}${q}`));if(Z)return`${B}${Z}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Y=_._executableFile||`${this._name}-${_._name}`,X=this._executableDir||"";if(this._scriptPath){let $;try{$=y3.realpathSync(this._scriptPath)}catch{$=this._scriptPath}X=V4.resolve(V4.dirname($),X)}if(X){let $=J(X,Y);if(!$&&!_._executableFile&&this._scriptPath){let H=V4.basename(this._scriptPath,V4.extname(this._scriptPath));if(H!==this._name)$=J(X,`${H}-${_._name}`)}Y=$||Y}A=G.includes(V4.extname(Y));let b;if($0.platform!=="win32")if(A)z.unshift(Y),z=eG($0.execArgv).concat(z),b=VA.spawn($0.argv[0],z,{stdio:"inherit"});else b=VA.spawn(Y,z,{stdio:"inherit"});else this._checkForMissingExecutable(Y,X,_._name),z.unshift(Y),z=eG($0.execArgv).concat(z),b=VA.spawn($0.execPath,z,{stdio:"inherit"});if(!b.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((H)=>{$0.on(H,()=>{if(b.killed===!1&&b.exitCode===null)b.kill(H)})});let Q=this._exitCallback;b.on("close",($)=>{if($=$??1,!Q)$0.exit($);else Q(new UA($,"commander.executeSubCommandAsync","(close)"))}),b.on("error",($)=>{if($.code==="ENOENT")this._checkForMissingExecutable(Y,X,_._name);else if($.code==="EACCES")throw Error(`'${Y}' not executable`);if(!Q)$0.exit(1);else{let H=new UA(1,"commander.executeSubCommandAsync","(error)");H.nestedError=$,Q(H)}}),this.runningCommand=b}_dispatchSubcommand(_,z,A){let G=this._findCommand(_);if(!G)this.help({error:!0});G._prepareForParse();let J;return J=this._chainOrCallSubCommandHook(J,G,"preSubcommand"),J=this._chainOrCall(J,()=>{if(G._executableHandler)this._executeSubCommand(G,z.concat(A));else return G._parseCommand(z,A)}),J}_dispatchHelpCommand(_){if(!_)this.help();let z=this._findCommand(_);if(z&&!z._executableHandler)z.help();return this._dispatchSubcommand(_,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((_,z)=>{if(_.required&&this.args[z]==null)this.missingArgument(_.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let _=(A,G,J)=>{let Y=G;if(G!==null&&A.parseArg){let X=`error: command-argument value '${G}' is invalid for argument '${A.name()}'.`;Y=this._callParseArg(A,G,J,X)}return Y};this._checkNumberOfArguments();let z=[];this.registeredArguments.forEach((A,G)=>{let J=A.defaultValue;if(A.variadic){if(G<this.args.length){if(J=this.args.slice(G),A.parseArg)J=J.reduce((Y,X)=>{return _(A,X,Y)},A.defaultValue)}else if(J===void 0)J=[]}else if(G<this.args.length){if(J=this.args[G],A.parseArg)J=_(A,J,A.defaultValue)}z[G]=J}),this.processedArgs=z}_chainOrCall(_,z){if(_?.then&&typeof _.then==="function")return _.then(()=>z());return z()}_chainOrCallHooks(_,z){let A=_,G=[];if(this._getCommandAndAncestors().reverse().filter((J)=>J._lifeCycleHooks[z]!==void 0).forEach((J)=>{J._lifeCycleHooks[z].forEach((Y)=>{G.push({hookedCommand:J,callback:Y})})}),z==="postAction")G.reverse();return G.forEach((J)=>{A=this._chainOrCall(A,()=>{return J.callback(J.hookedCommand,this)})}),A}_chainOrCallSubCommandHook(_,z,A){let G=_;if(this._lifeCycleHooks[A]!==void 0)this._lifeCycleHooks[A].forEach((J)=>{G=this._chainOrCall(G,()=>{return J(this,z)})});return G}_parseCommand(_,z){let A=this.parseOptions(z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),_=_.concat(A.operands),z=A.unknown,this.args=_.concat(z),_&&this._findCommand(_[0]))return this._dispatchSubcommand(_[0],_.slice(1),z);if(this._getHelpCommand()&&_[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(_[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(z),this._dispatchSubcommand(this._defaultCommandName,_,z);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(A.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let G=()=>{if(A.unknown.length>0)this.unknownOption(A.unknown[0])},J=`command:${this.name()}`;if(this._actionHandler){G(),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(J,_,z)});return Y=this._chainOrCallHooks(Y,"postAction"),Y}if(this.parent?.listenerCount(J))G(),this._processArguments(),this.parent.emit(J,_,z);else if(_.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",_,z);if(this.listenerCount("command:*"))this.emit("command:*",_,z);else if(this.commands.length)this.unknownCommand();else G(),this._processArguments()}else if(this.commands.length)G(),this.help({error:!0});else G(),this._processArguments()}_findCommand(_){if(!_)return;return this.commands.find((z)=>z._name===_||z._aliases.includes(_))}_findOption(_){return this.options.find((z)=>z.is(_))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((_)=>{_.options.forEach((z)=>{if(z.mandatory&&_.getOptionValue(z.attributeName())===void 0)_.missingMandatoryOptionValue(z)})})}_checkForConflictingLocalOptions(){let _=this.options.filter((A)=>{let G=A.attributeName();if(this.getOptionValue(G)===void 0)return!1;return this.getOptionValueSource(G)!=="default"});_.filter((A)=>A.conflictsWith.length>0).forEach((A)=>{let G=_.find((J)=>A.conflictsWith.includes(J.attributeName()));if(G)this._conflictingOption(A,G)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((_)=>{_._checkForConflictingLocalOptions()})}parseOptions(_){let z=[],A=[],G=z;function J($){return $.length>1&&$[0]==="-"}let Y=($)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test($))return!1;return!this._getCommandAndAncestors().some((H)=>H.options.map((B)=>B.short).some((B)=>/^-\d$/.test(B)))},X=null,b=null,Q=0;while(Q<_.length||b){let $=b??_[Q++];if(b=null,$==="--"){if(G===A)G.push($);G.push(..._.slice(Q));break}if(X&&(!J($)||Y($))){this.emit(`option:${X.name()}`,$);continue}if(X=null,J($)){let H=this._findOption($);if(H){if(H.required){let B=_[Q++];if(B===void 0)this.optionMissingArgument(H);this.emit(`option:${H.name()}`,B)}else if(H.optional){let B=null;if(Q<_.length&&(!J(_[Q])||Y(_[Q])))B=_[Q++];this.emit(`option:${H.name()}`,B)}else this.emit(`option:${H.name()}`);X=H.variadic?H:null;continue}}if($.length>2&&$[0]==="-"&&$[1]!=="-"){let H=this._findOption(`-${$[1]}`);if(H){if(H.required||H.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${H.name()}`,$.slice(2));else this.emit(`option:${H.name()}`),b=`-${$.slice(2)}`;continue}}if(/^--[^=]+=/.test($)){let H=$.indexOf("="),B=this._findOption($.slice(0,H));if(B&&(B.required||B.optional)){this.emit(`option:${B.name()}`,$.slice(H+1));continue}}if(G===z&&J($)&&!(this.commands.length===0&&Y($)))G=A;if((this._enablePositionalOptions||this._passThroughOptions)&&z.length===0&&A.length===0){if(this._findCommand($)){z.push($),A.push(..._.slice(Q));break}else if(this._getHelpCommand()&&$===this._getHelpCommand().name()){z.push($,..._.slice(Q));break}else if(this._defaultCommandName){A.push($,..._.slice(Q));break}}if(this._passThroughOptions){G.push($,..._.slice(Q));break}G.push($)}return{operands:z,unknown:A}}opts(){if(this._storeOptionsAsProperties){let _={},z=this.options.length;for(let A=0;A<z;A++){let G=this.options[A].attributeName();_[G]=G===this._versionOptionName?this._version:this[G]}return _}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((_,z)=>Object.assign(_,z.opts()),{})}error(_,z){if(this._outputConfiguration.outputError(`${_}
22
22
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
23
23
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
24
- `),this.outputHelp({error:!0});let A=z||{},b=A.exitCode||1,G=A.code||"commander.error";this._exit(b,G,_)}_parseOptionsEnv(){this.options.forEach((_)=>{if(_.envVar&&_.envVar in $0.env){let z=_.attributeName();if(this.getOptionValue(z)===void 0||["default","config","env"].includes(this.getOptionValueSource(z)))if(_.required||_.optional)this.emit(`optionEnv:${_.name()}`,$0.env[_.envVar]);else this.emit(`optionEnv:${_.name()}`)}})}_parseOptionsImplied(){let _=new NU(this.options),z=(A)=>{return this.getOptionValue(A)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(A))};this.options.filter((A)=>A.implied!==void 0&&z(A.attributeName())&&_.valueFromOption(this.getOptionValue(A.attributeName()),A)).forEach((A)=>{Object.keys(A.implied).filter((b)=>!z(b)).forEach((b)=>{this.setOptionValueWithSource(b,A.implied[b],"implied")})})}missingArgument(_){let z=`error: missing required argument '${_}'`;this.error(z,{code:"commander.missingArgument"})}optionMissingArgument(_){let z=`error: option '${_.flags}' argument missing`;this.error(z,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(_){let z=`error: required option '${_.flags}' not specified`;this.error(z,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(_,z){let A=(J)=>{let Y=J.attributeName(),X=this.getOptionValue(Y),Q=this.options.find((H)=>H.negate&&Y===H.attributeName()),$=this.options.find((H)=>!H.negate&&Y===H.attributeName());if(Q&&(Q.presetArg===void 0&&X===!1||Q.presetArg!==void 0&&X===Q.presetArg))return Q;return $||J},b=(J)=>{let Y=A(J),X=Y.attributeName();if(this.getOptionValueSource(X)==="env")return`environment variable '${Y.envVar}'`;return`option '${Y.flags}'`},G=`error: ${b(_)} cannot be used with ${b(z)}`;this.error(G,{code:"commander.conflictingOption"})}unknownOption(_){if(this._allowUnknownOption)return;let z="";if(_.startsWith("--")&&this._showSuggestionAfterError){let b=[],G=this;do{let J=G.createHelp().visibleOptions(G).filter((Y)=>Y.long).map((Y)=>Y.long);b=b.concat(J),G=G.parent}while(G&&!G._enablePositionalOptions);z=gb(_,b)}let A=`error: unknown option '${_}'${z}`;this.error(A,{code:"commander.unknownOption"})}_excessArguments(_){if(this._allowExcessArguments)return;let z=this.registeredArguments.length,A=z===1?"":"s",G=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${z} argument${A} but got ${_.length}.`;this.error(G,{code:"commander.excessArguments"})}unknownCommand(){let _=this.args[0],z="";if(this._showSuggestionAfterError){let b=[];this.createHelp().visibleCommands(this).forEach((G)=>{if(b.push(G.name()),G.alias())b.push(G.alias())}),z=gb(_,b)}let A=`error: unknown command '${_}'${z}`;this.error(A,{code:"commander.unknownCommand"})}version(_,z,A){if(_===void 0)return this._version;this._version=_,z=z||"-V, --version",A=A||"output the version number";let b=this.createOption(z,A);return this._versionOptionName=b.attributeName(),this._registerOption(b),this.on("option:"+b.name(),()=>{this._outputConfiguration.writeOut(`${_}
25
- `),this._exit(0,"commander.version",_)}),this}description(_,z){if(_===void 0&&z===void 0)return this._description;if(this._description=_,z)this._argsDescription=z;return this}summary(_){if(_===void 0)return this._summary;return this._summary=_,this}alias(_){if(_===void 0)return this._aliases[0];let z=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)z=this.commands[this.commands.length-1];if(_===z._name)throw Error("Command alias can't be the same as its name");let A=this.parent?._findCommand(_);if(A){let b=[A.name()].concat(A.aliases()).join("|");throw Error(`cannot add alias '${_}' to command '${this.name()}' as already have command '${b}'`)}return z._aliases.push(_),this}aliases(_){if(_===void 0)return this._aliases;return _.forEach((z)=>this.alias(z)),this}usage(_){if(_===void 0){if(this._usage)return this._usage;let z=this.registeredArguments.map((A)=>{return UU(A)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?z:[]).join(" ")}return this._usage=_,this}name(_){if(_===void 0)return this._name;return this._name=_,this}helpGroup(_){if(_===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=_,this}commandsGroup(_){if(_===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=_,this}optionsGroup(_){if(_===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=_,this}_initOptionGroup(_){if(this._defaultOptionGroup&&!_.helpGroupHeading)_.helpGroup(this._defaultOptionGroup)}_initCommandGroup(_){if(this._defaultCommandGroup&&!_.helpGroup())_.helpGroup(this._defaultCommandGroup)}nameFromFilename(_){return this._name=W4.basename(_,W4.extname(_)),this}executableDir(_){if(_===void 0)return this._executableDir;return this._executableDir=_,this}helpInformation(_){let z=this.createHelp(),A=this._getOutputContext(_);z.prepareContext({error:A.error,helpWidth:A.helpWidth,outputHasColors:A.hasColors});let b=z.formatHelp(this,z);if(A.hasColors)return b;return this._outputConfiguration.stripColor(b)}_getOutputContext(_){_=_||{};let z=!!_.error,A,b,G;if(z)A=(Y)=>this._outputConfiguration.writeErr(Y),b=this._outputConfiguration.getErrHasColors(),G=this._outputConfiguration.getErrHelpWidth();else A=(Y)=>this._outputConfiguration.writeOut(Y),b=this._outputConfiguration.getOutHasColors(),G=this._outputConfiguration.getOutHelpWidth();return{error:z,write:(Y)=>{if(!b)Y=this._outputConfiguration.stripColor(Y);return A(Y)},hasColors:b,helpWidth:G}}outputHelp(_){let z;if(typeof _==="function")z=_,_=void 0;let A=this._getOutputContext(_),b={error:A.error,write:A.write,command:this};this._getCommandAndAncestors().reverse().forEach((J)=>J.emit("beforeAllHelp",b)),this.emit("beforeHelp",b);let G=this.helpInformation({error:A.error});if(z){if(G=z(G),typeof G!=="string"&&!Buffer.isBuffer(G))throw Error("outputHelp callback must return a string or a Buffer")}if(A.write(G),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",b),this._getCommandAndAncestors().forEach((J)=>J.emit("afterAllHelp",b))}helpOption(_,z){if(typeof _==="boolean"){if(_){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(_??"-h, --help",z??"display help for command"),_||z)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(_){return this._helpOption=_,this._initOptionGroup(_),this}help(_){this.outputHelp(_);let z=Number($0.exitCode??0);if(z===0&&_&&typeof _!=="function"&&_.error)z=1;this._exit(z,"commander.help","(outputHelp)")}addHelpText(_,z){let A=["beforeAll","before","after","afterAll"];if(!A.includes(_))throw Error(`Unexpected value for position to addHelpText.
26
- Expecting one of '${A.join("', '")}'`);let b=`${_}Help`;return this.on(b,(G)=>{let J;if(typeof z==="function")J=z({error:G.error,command:G.command});else J=z;if(J)G.write(`${J}
27
- `)}),this}_outputHelpIfRequested(_){let z=this._getHelpOption();if(z&&_.find((b)=>z.is(b)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function fb(_){return _.map((z)=>{if(!z.startsWith("--inspect"))return z;let A,b="127.0.0.1",G="9229",J;if((J=z.match(/^(--inspect(-brk)?)$/))!==null)A=J[1];else if((J=z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(A=J[1],/^\d+$/.test(J[3]))G=J[3];else b=J[3];else if((J=z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)A=J[1],b=J[3],G=J[4];if(A&&G!=="0")return`${A}=${b}:${parseInt(G)+1}`;return z})}function B8(){if($0.env.NO_COLOR||$0.env.FORCE_COLOR==="0"||$0.env.FORCE_COLOR==="false")return!1;if($0.env.FORCE_COLOR||$0.env.CLICOLOR_FORCE!==void 0)return!0;return}wU.Command=Z8;wU.useColor=B8});var lb=I((RU)=>{var{Argument:mb}=S3(),{Command:F8}=hb(),{CommanderError:LU,InvalidArgumentError:ub}=o1(),{Help:jU}=X8(),{Option:cb}=Q8();RU.program=new F8;RU.createCommand=(_)=>new F8(_);RU.createOption=(_,z)=>new cb(_,z);RU.createArgument=(_,z)=>new mb(_,z);RU.Command=F8;RU.Option=cb;RU.Argument=mb;RU.Help=jU;RU.CommanderError=LU;RU.InvalidArgumentError=ub;RU.InvalidOptionArgumentError=ub});var RJ=I((LJ)=>{Object.defineProperty(LJ,"__esModule",{value:!0});LJ.toBig=LJ.shrSL=LJ.shrSH=LJ.rotrSL=LJ.rotrSH=LJ.rotrBL=LJ.rotrBH=LJ.rotr32L=LJ.rotr32H=LJ.rotlSL=LJ.rotlSH=LJ.rotlBL=LJ.rotlBH=LJ.add5L=LJ.add5H=LJ.add4L=LJ.add4H=LJ.add3L=LJ.add3H=void 0;LJ.add=UJ;LJ.fromBig=o8;LJ.split=GJ;var o3=BigInt(4294967295),i8=BigInt(32);function o8(_,z=!1){if(z)return{h:Number(_&o3),l:Number(_>>i8&o3)};return{h:Number(_>>i8&o3)|0,l:Number(_&o3)|0}}function GJ(_,z=!1){let A=_.length,b=new Uint32Array(A),G=new Uint32Array(A);for(let J=0;J<A;J++){let{h:Y,l:X}=o8(_[J],z);[b[J],G[J]]=[Y,X]}return[b,G]}var JJ=(_,z)=>BigInt(_>>>0)<<i8|BigInt(z>>>0);LJ.toBig=JJ;var YJ=(_,z,A)=>_>>>A;LJ.shrSH=YJ;var XJ=(_,z,A)=>_<<32-A|z>>>A;LJ.shrSL=XJ;var QJ=(_,z,A)=>_>>>A|z<<32-A;LJ.rotrSH=QJ;var $J=(_,z,A)=>_<<32-A|z>>>A;LJ.rotrSL=$J;var HJ=(_,z,A)=>_<<64-A|z>>>A-32;LJ.rotrBH=HJ;var BJ=(_,z,A)=>_>>>A-32|z<<64-A;LJ.rotrBL=BJ;var ZJ=(_,z)=>z;LJ.rotr32H=ZJ;var FJ=(_,z)=>_;LJ.rotr32L=FJ;var KJ=(_,z,A)=>_<<A|z>>>32-A;LJ.rotlSH=KJ;var qJ=(_,z,A)=>z<<A|_>>>32-A;LJ.rotlSL=qJ;var WJ=(_,z,A)=>z<<A-32|_>>>64-A;LJ.rotlBH=WJ;var VJ=(_,z,A)=>_<<A-32|z>>>64-A;LJ.rotlBL=VJ;function UJ(_,z,A,b){let G=(z>>>0)+(b>>>0);return{h:_+A+(G/4294967296|0)|0,l:G|0}}var DJ=(_,z,A)=>(_>>>0)+(z>>>0)+(A>>>0);LJ.add3L=DJ;var MJ=(_,z,A,b)=>z+A+b+(_/4294967296|0)|0;LJ.add3H=MJ;var NJ=(_,z,A,b)=>(_>>>0)+(z>>>0)+(A>>>0)+(b>>>0);LJ.add4L=NJ;var wJ=(_,z,A,b,G)=>z+A+b+G+(_/4294967296|0)|0;LJ.add4H=wJ;var EJ=(_,z,A,b,G)=>(_>>>0)+(z>>>0)+(A>>>0)+(b>>>0)+(G>>>0);LJ.add5L=EJ;var OJ=(_,z,A,b,G,J)=>z+A+b+G+J+(_/4294967296|0)|0;LJ.add5H=OJ;var SM={fromBig:o8,split:GJ,toBig:JJ,shrSH:YJ,shrSL:XJ,rotrSH:QJ,rotrSL:$J,rotrBH:HJ,rotrBL:BJ,rotr32H:ZJ,rotr32L:FJ,rotlSH:KJ,rotlSL:qJ,rotlBH:WJ,rotlBL:VJ,add:UJ,add3L:DJ,add3H:MJ,add4L:NJ,add4H:wJ,add5H:OJ,add5L:EJ};LJ.default=SM});var kJ=I((PJ)=>{Object.defineProperty(PJ,"__esModule",{value:!0});PJ.crypto=void 0;var u4=q4("node:crypto");PJ.crypto=u4&&typeof u4==="object"&&"webcrypto"in u4?u4.webcrypto:u4&&typeof u4==="object"&&("randomBytes"in u4)?u4:void 0});var lJ=I((hJ)=>{/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(hJ,"__esModule",{value:!0});hJ.wrapXOFConstructorWithOpts=hJ.wrapConstructorWithOpts=hJ.wrapConstructor=hJ.Hash=hJ.nextTick=hJ.swap32IfBE=hJ.byteSwapIfBE=hJ.swap8IfBE=hJ.isLE=void 0;hJ.isBytes=xJ;hJ.anumber=a8;hJ.abytes=d_;hJ.ahash=tM;hJ.aexists=eM;hJ.aoutput=_N;hJ.u8=zN;hJ.u32=AN;hJ.clean=bN;hJ.createView=GN;hJ.rotr=JN;hJ.rotl=YN;hJ.byteSwap=s8;hJ.byteSwap32=TJ;hJ.bytesToHex=QN;hJ.hexToBytes=$N;hJ.asyncLoop=BN;hJ.utf8ToBytes=t8;hJ.bytesToUtf8=ZN;hJ.toBytes=a3;hJ.kdfInputToBytes=FN;hJ.concatBytes=KN;hJ.checkOpts=qN;hJ.createHasher=yJ;hJ.createOptHasher=gJ;hJ.createXOFer=fJ;hJ.randomBytes=WN;var p_=kJ();function xJ(_){return _ instanceof Uint8Array||ArrayBuffer.isView(_)&&_.constructor.name==="Uint8Array"}function a8(_){if(!Number.isSafeInteger(_)||_<0)throw Error("positive integer expected, got "+_)}function d_(_,...z){if(!xJ(_))throw Error("Uint8Array expected");if(z.length>0&&!z.includes(_.length))throw Error("Uint8Array expected of length "+z+", got length="+_.length)}function tM(_){if(typeof _!=="function"||typeof _.create!=="function")throw Error("Hash should be wrapped by utils.createHasher");a8(_.outputLen),a8(_.blockLen)}function eM(_,z=!0){if(_.destroyed)throw Error("Hash instance has been destroyed");if(z&&_.finished)throw Error("Hash#digest() has already been called")}function _N(_,z){d_(_);let A=z.outputLen;if(_.length<A)throw Error("digestInto() expects output buffer of length at least "+A)}function zN(_){return new Uint8Array(_.buffer,_.byteOffset,_.byteLength)}function AN(_){return new Uint32Array(_.buffer,_.byteOffset,Math.floor(_.byteLength/4))}function bN(..._){for(let z=0;z<_.length;z++)_[z].fill(0)}function GN(_){return new DataView(_.buffer,_.byteOffset,_.byteLength)}function JN(_,z){return _<<32-z|_>>>z}function YN(_,z){return _<<z|_>>>32-z>>>0}hJ.isLE=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function s8(_){return _<<24&4278190080|_<<8&16711680|_>>>8&65280|_>>>24&255}hJ.swap8IfBE=hJ.isLE?(_)=>_:(_)=>s8(_);hJ.byteSwapIfBE=hJ.swap8IfBE;function TJ(_){for(let z=0;z<_.length;z++)_[z]=s8(_[z]);return _}hJ.swap32IfBE=hJ.isLE?(_)=>_:TJ;var CJ=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),XN=Array.from({length:256},(_,z)=>z.toString(16).padStart(2,"0"));function QN(_){if(d_(_),CJ)return _.toHex();let z="";for(let A=0;A<_.length;A++)z+=XN[_[A]];return z}var U4={_0:48,_9:57,A:65,F:70,a:97,f:102};function IJ(_){if(_>=U4._0&&_<=U4._9)return _-U4._0;if(_>=U4.A&&_<=U4.F)return _-(U4.A-10);if(_>=U4.a&&_<=U4.f)return _-(U4.a-10);return}function $N(_){if(typeof _!=="string")throw Error("hex string expected, got "+typeof _);if(CJ)return Uint8Array.fromHex(_);let z=_.length,A=z/2;if(z%2)throw Error("hex string expected, got unpadded hex of length "+z);let b=new Uint8Array(A);for(let G=0,J=0;G<A;G++,J+=2){let Y=IJ(_.charCodeAt(J)),X=IJ(_.charCodeAt(J+1));if(Y===void 0||X===void 0){let Q=_[J]+_[J+1];throw Error('hex string expected, got non-hex character "'+Q+'" at index '+J)}b[G]=Y*16+X}return b}var HN=async()=>{};hJ.nextTick=HN;async function BN(_,z,A){let b=Date.now();for(let G=0;G<_;G++){A(G);let J=Date.now()-b;if(J>=0&&J<z)continue;await hJ.nextTick(),b+=J}}function t8(_){if(typeof _!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(_))}function ZN(_){return new TextDecoder().decode(_)}function a3(_){if(typeof _==="string")_=t8(_);return d_(_),_}function FN(_){if(typeof _==="string")_=t8(_);return d_(_),_}function KN(..._){let z=0;for(let b=0;b<_.length;b++){let G=_[b];d_(G),z+=G.length}let A=new Uint8Array(z);for(let b=0,G=0;b<_.length;b++){let J=_[b];A.set(J,G),G+=J.length}return A}function qN(_,z){if(z!==void 0&&{}.toString.call(z)!=="[object Object]")throw Error("options should be object or undefined");return Object.assign(_,z)}class vJ{}hJ.Hash=vJ;function yJ(_){let z=(b)=>_().update(a3(b)).digest(),A=_();return z.outputLen=A.outputLen,z.blockLen=A.blockLen,z.create=()=>_(),z}function gJ(_){let z=(b,G)=>_(G).update(a3(b)).digest(),A=_({});return z.outputLen=A.outputLen,z.blockLen=A.blockLen,z.create=(b)=>_(b),z}function fJ(_){let z=(b,G)=>_(G).update(a3(b)).digest(),A=_({});return z.outputLen=A.outputLen,z.blockLen=A.blockLen,z.create=(b)=>_(b),z}hJ.wrapConstructor=yJ;hJ.wrapConstructorWithOpts=gJ;hJ.wrapXOFConstructorWithOpts=fJ;function WN(_=32){if(p_.crypto&&typeof p_.crypto.getRandomValues==="function")return p_.crypto.getRandomValues(new Uint8Array(_));if(p_.crypto&&typeof p_.crypto.randomBytes==="function")return Uint8Array.from(p_.crypto.randomBytes(_));throw Error("crypto.getRandomValues must be defined")}});var _Y=I((tJ)=>{Object.defineProperty(tJ,"__esModule",{value:!0});tJ.shake256=tJ.shake128=tJ.keccak_512=tJ.keccak_384=tJ.keccak_256=tJ.keccak_224=tJ.sha3_512=tJ.sha3_384=tJ.sha3_256=tJ.sha3_224=tJ.Keccak=void 0;tJ.keccakP=aJ;var Yz=RJ(),p0=lJ(),oN=BigInt(0),Jz=BigInt(1),aN=BigInt(2),sN=BigInt(7),tN=BigInt(256),eN=BigInt(113),rJ=[],nJ=[],iJ=[];for(let _=0,z=Jz,A=1,b=0;_<24;_++){[A,b]=[b,(2*A+3*b)%5],rJ.push(2*(5*b+A)),nJ.push((_+1)*(_+2)/2%64);let G=oN;for(let J=0;J<7;J++)if(z=(z<<Jz^(z>>sN)*eN)%tN,z&aN)G^=Jz<<(Jz<<BigInt(J))-Jz;iJ.push(G)}var oJ=(0,Yz.split)(iJ,!0),_w=oJ[0],zw=oJ[1],pJ=(_,z,A)=>A>32?(0,Yz.rotlBH)(_,z,A):(0,Yz.rotlSH)(_,z,A),dJ=(_,z,A)=>A>32?(0,Yz.rotlBL)(_,z,A):(0,Yz.rotlSL)(_,z,A);function aJ(_,z=24){let A=new Uint32Array(10);for(let b=24-z;b<24;b++){for(let Y=0;Y<10;Y++)A[Y]=_[Y]^_[Y+10]^_[Y+20]^_[Y+30]^_[Y+40];for(let Y=0;Y<10;Y+=2){let X=(Y+8)%10,Q=(Y+2)%10,$=A[Q],H=A[Q+1],B=pJ($,H,1)^A[X],Z=dJ($,H,1)^A[X+1];for(let F=0;F<50;F+=10)_[Y+F]^=B,_[Y+F+1]^=Z}let G=_[2],J=_[3];for(let Y=0;Y<24;Y++){let X=nJ[Y],Q=pJ(G,J,X),$=dJ(G,J,X),H=rJ[Y];G=_[H],J=_[H+1],_[H]=Q,_[H+1]=$}for(let Y=0;Y<50;Y+=10){for(let X=0;X<10;X++)A[X]=_[Y+X];for(let X=0;X<10;X++)_[Y+X]^=~A[(X+2)%10]&A[(X+4)%10]}_[0]^=_w[b],_[1]^=zw[b]}(0,p0.clean)(A)}class Xz extends p0.Hash{constructor(_,z,A,b=!1,G=24){super();if(this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=_,this.suffix=z,this.outputLen=A,this.enableXOF=b,this.rounds=G,(0,p0.anumber)(A),!(0<_&&_<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,p0.u32)(this.state)}clone(){return this._cloneInto()}keccak(){(0,p0.swap32IfBE)(this.state32),aJ(this.state32,this.rounds),(0,p0.swap32IfBE)(this.state32),this.posOut=0,this.pos=0}update(_){(0,p0.aexists)(this),_=(0,p0.toBytes)(_),(0,p0.abytes)(_);let{blockLen:z,state:A}=this,b=_.length;for(let G=0;G<b;){let J=Math.min(z-this.pos,b-G);for(let Y=0;Y<J;Y++)A[this.pos++]^=_[G++];if(this.pos===z)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:_,suffix:z,pos:A,blockLen:b}=this;if(_[A]^=z,(z&128)!==0&&A===b-1)this.keccak();_[b-1]^=128,this.keccak()}writeInto(_){(0,p0.aexists)(this,!1),(0,p0.abytes)(_),this.finish();let z=this.state,{blockLen:A}=this;for(let b=0,G=_.length;b<G;){if(this.posOut>=A)this.keccak();let J=Math.min(A-this.posOut,G-b);_.set(z.subarray(this.posOut,this.posOut+J),b),this.posOut+=J,b+=J}return _}xofInto(_){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(_)}xof(_){return(0,p0.anumber)(_),this.xofInto(new Uint8Array(_))}digestInto(_){if((0,p0.aoutput)(_,this),this.finished)throw Error("digest() was already called");return this.writeInto(_),this.destroy(),_}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,p0.clean)(this.state)}_cloneInto(_){let{blockLen:z,suffix:A,outputLen:b,rounds:G,enableXOF:J}=this;return _||(_=new Xz(z,A,b,J,G)),_.state32.set(this.state32),_.pos=this.pos,_.posOut=this.posOut,_.finished=this.finished,_.rounds=G,_.suffix=A,_.outputLen=b,_.enableXOF=J,_.destroyed=this.destroyed,_}}tJ.Keccak=Xz;var c4=(_,z,A)=>(0,p0.createHasher)(()=>new Xz(z,_,A));tJ.sha3_224=(()=>c4(6,144,28))();tJ.sha3_256=(()=>c4(6,136,32))();tJ.sha3_384=(()=>c4(6,104,48))();tJ.sha3_512=(()=>c4(6,72,64))();tJ.keccak_224=(()=>c4(1,144,28))();tJ.keccak_256=(()=>c4(1,136,32))();tJ.keccak_384=(()=>c4(1,104,48))();tJ.keccak_512=(()=>c4(1,72,64))();var sJ=(_,z,A)=>(0,p0.createXOFer)((b={})=>new Xz(z,_,b.dkLen===void 0?A:b.dkLen,!0));tJ.shake128=(()=>sJ(31,168,16))();tJ.shake256=(()=>sJ(31,136,32))()});var XY=I((Uw,l4)=>{var{sha3_512:Fw}=_Y(),_5=(_=4,z=Math.random)=>{let A="";while(A.length<_)A=A+Math.floor(z()*36).toString(36);return A};function AY(_){let z=8n,A=0n;for(let b of _.values()){let G=BigInt(b);A=(A<<z)+G}return A}var bY=(_="")=>{return AY(Fw(_)).toString(36).slice(1)},zY=Array.from({length:26},(_,z)=>String.fromCharCode(z+97)),Kw=(_)=>zY[Math.floor(_()*zY.length)],GY=({globalObj:_=typeof global<"u"?global:typeof window<"u"?window:{},random:z=Math.random}={})=>{let A=Object.keys(_).toString(),b=A.length?A+_5(32,z):_5(32,z);return bY(b).substring(0,32)},JY=(_)=>()=>{return _++},qw=476782367,YY=({random:_=Math.random,counter:z=JY(Math.floor(_()*qw)),length:A=24,fingerprint:b=GY({random:_})}={})=>{return function(){let J=Kw(_),Y=Date.now().toString(36),X=z().toString(36),Q=_5(A,_),$=`${Y+Q+X+b}`;return`${J+bY($).substring(1,A)}`}},Ww=YY(),Vw=(_,{minLength:z=2,maxLength:A=32}={})=>{let b=_.length,G=/^[0-9a-z]+$/;try{if(typeof _==="string"&&b>=z&&b<=A&&G.test(_))return!0}finally{}return!1};Uw.getConstants=()=>({defaultLength:24,bigLength:32});Uw.init=YY;Uw.createId=Ww;Uw.bufToBigInt=AY;Uw.createCounter=JY;Uw.createFingerprint=GY;Uw.isCuid=Vw});var X3=I((JF)=>{Object.defineProperty(JF,"__esModule",{value:!0});JF.regexpCode=JF.getEsmExportName=JF.getProperty=JF.safeStringify=JF.stringify=JF.strConcat=JF.addCodeArg=JF.str=JF._=JF.nil=JF._Code=JF.Name=JF.IDENTIFIER=JF._CodeOrName=void 0;class UA{}JF._CodeOrName=UA;JF.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class f1 extends UA{constructor(_){super();if(!JF.IDENTIFIER.test(_))throw Error("CodeGen: name must be a valid identifier");this.str=_}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}JF.Name=f1;class d9 extends UA{constructor(_){super();this._items=typeof _==="string"?[_]:_}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let _=this._items[0];return _===""||_==='""'}get str(){var _;return(_=this._str)!==null&&_!==void 0?_:this._str=this._items.reduce((z,A)=>`${z}${A}`,"")}get names(){var _;return(_=this._names)!==null&&_!==void 0?_:this._names=this._items.reduce((z,A)=>{if(A instanceof f1)z[A.str]=(z[A.str]||0)+1;return z},{})}}JF._Code=d9;JF.nil=new d9("");function bF(_,...z){let A=[_[0]],b=0;while(b<z.length)U7(A,z[b]),A.push(_[++b]);return new d9(A)}JF._=bF;var V7=new d9("+");function GF(_,...z){let A=[Y3(_[0])],b=0;while(b<z.length)A.push(V7),U7(A,z[b]),A.push(V7,Y3(_[++b]));return LT(A),new d9(A)}JF.str=GF;function U7(_,z){if(z instanceof d9)_.push(...z._items);else if(z instanceof f1)_.push(z);else _.push(PT(z))}JF.addCodeArg=U7;function LT(_){let z=1;while(z<_.length-1){if(_[z]===V7){let A=jT(_[z-1],_[z+1]);if(A!==void 0){_.splice(z-1,3,A);continue}_[z++]="+"}z++}}function jT(_,z){if(z==='""')return _;if(_==='""')return z;if(typeof _=="string"){if(z instanceof f1||_[_.length-1]!=='"')return;if(typeof z!="string")return`${_.slice(0,-1)}${z}"`;if(z[0]==='"')return _.slice(0,-1)+z.slice(1);return}if(typeof z=="string"&&z[0]==='"'&&!(_ instanceof f1))return`"${_}${z.slice(1)}`;return}function RT(_,z){return z.emptyStr()?_:_.emptyStr()?z:GF`${_}${z}`}JF.strConcat=RT;function PT(_){return typeof _=="number"||typeof _=="boolean"||_===null?_:Y3(Array.isArray(_)?_.join(","):_)}function ST(_){return new d9(Y3(_))}JF.stringify=ST;function Y3(_){return JSON.stringify(_).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}JF.safeStringify=Y3;function kT(_){return typeof _=="string"&&JF.IDENTIFIER.test(_)?new d9(`.${_}`):bF`[${_}]`}JF.getProperty=kT;function IT(_){if(typeof _=="string"&&JF.IDENTIFIER.test(_))return new d9(`${_}`);throw Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`)}JF.getEsmExportName=IT;function xT(_){return new d9(_.toString())}JF.regexpCode=xT});var w7=I(($F)=>{Object.defineProperty($F,"__esModule",{value:!0});$F.ValueScope=$F.ValueScopeName=$F.Scope=$F.varKinds=$F.UsedValueState=void 0;var H9=X3();class XF extends Error{constructor(_){super(`CodeGen: "code" for ${_} not defined`);this.value=_.value}}var MA;(function(_){_[_.Started=0]="Started",_[_.Completed=1]="Completed"})(MA||($F.UsedValueState=MA={}));$F.varKinds={const:new H9.Name("const"),let:new H9.Name("let"),var:new H9.Name("var")};class M7{constructor({prefixes:_,parent:z}={}){this._names={},this._prefixes=_,this._parent=z}toName(_){return _ instanceof H9.Name?_:this.name(_)}name(_){return new H9.Name(this._newName(_))}_newName(_){let z=this._names[_]||this._nameGroup(_);return`${_}${z.index++}`}_nameGroup(_){var z,A;if(((A=(z=this._parent)===null||z===void 0?void 0:z._prefixes)===null||A===void 0?void 0:A.has(_))||this._prefixes&&!this._prefixes.has(_))throw Error(`CodeGen: prefix "${_}" is not allowed in this scope`);return this._names[_]={prefix:_,index:0}}}$F.Scope=M7;class N7 extends H9.Name{constructor(_,z){super(z);this.prefix=_}setValue(_,{property:z,itemIndex:A}){this.value=_,this.scopePath=H9._`.${new H9.Name(z)}[${A}]`}}$F.ValueScopeName=N7;var dT=H9._`\n`;class QF extends M7{constructor(_){super(_);this._values={},this._scope=_.scope,this.opts={..._,_n:_.lines?dT:H9.nil}}get(){return this._scope}name(_){return new N7(_,this._newName(_))}value(_,z){var A;if(z.ref===void 0)throw Error("CodeGen: ref must be passed in value");let b=this.toName(_),{prefix:G}=b,J=(A=z.key)!==null&&A!==void 0?A:z.ref,Y=this._values[G];if(Y){let $=Y.get(J);if($)return $}else Y=this._values[G]=new Map;Y.set(J,b);let X=this._scope[G]||(this._scope[G]=[]),Q=X.length;return X[Q]=z.ref,b.setValue(z,{property:G,itemIndex:Q}),b}getValue(_,z){let A=this._values[_];if(!A)return;return A.get(z)}scopeRefs(_,z=this._values){return this._reduceValues(z,(A)=>{if(A.scopePath===void 0)throw Error(`CodeGen: name "${A}" has no value`);return H9._`${_}${A.scopePath}`})}scopeCode(_=this._values,z,A){return this._reduceValues(_,(b)=>{if(b.value===void 0)throw Error(`CodeGen: name "${b}" has no value`);return b.value.code},z,A)}_reduceValues(_,z,A={},b){let G=H9.nil;for(let J in _){let Y=_[J];if(!Y)continue;let X=A[J]=A[J]||new Map;Y.forEach((Q)=>{if(X.has(Q))return;X.set(Q,MA.Started);let $=z(Q);if($){let H=this.opts.es5?$F.varKinds.var:$F.varKinds.const;G=H9._`${G}${H} ${Q} = ${$};${this.opts._n}`}else if($=b===null||b===void 0?void 0:b(Q))G=H9._`${G}${$}${this.opts._n}`;else throw new XF(Q);X.set(Q,MA.Completed)})}return G}}$F.ValueScope=QF});var t=I((B9)=>{Object.defineProperty(B9,"__esModule",{value:!0});B9.or=B9.and=B9.not=B9.CodeGen=B9.operators=B9.varKinds=B9.ValueScopeName=B9.ValueScope=B9.Scope=B9.Name=B9.regexpCode=B9.stringify=B9.getProperty=B9.nil=B9.strConcat=B9.str=B9._=void 0;var G0=X3(),r9=w7(),Y_=X3();Object.defineProperty(B9,"_",{enumerable:!0,get:function(){return Y_._}});Object.defineProperty(B9,"str",{enumerable:!0,get:function(){return Y_.str}});Object.defineProperty(B9,"strConcat",{enumerable:!0,get:function(){return Y_.strConcat}});Object.defineProperty(B9,"nil",{enumerable:!0,get:function(){return Y_.nil}});Object.defineProperty(B9,"getProperty",{enumerable:!0,get:function(){return Y_.getProperty}});Object.defineProperty(B9,"stringify",{enumerable:!0,get:function(){return Y_.stringify}});Object.defineProperty(B9,"regexpCode",{enumerable:!0,get:function(){return Y_.regexpCode}});Object.defineProperty(B9,"Name",{enumerable:!0,get:function(){return Y_.Name}});var jA=w7();Object.defineProperty(B9,"Scope",{enumerable:!0,get:function(){return jA.Scope}});Object.defineProperty(B9,"ValueScope",{enumerable:!0,get:function(){return jA.ValueScope}});Object.defineProperty(B9,"ValueScopeName",{enumerable:!0,get:function(){return jA.ValueScopeName}});Object.defineProperty(B9,"varKinds",{enumerable:!0,get:function(){return jA.varKinds}});B9.operators={GT:new G0._Code(">"),GTE:new G0._Code(">="),LT:new G0._Code("<"),LTE:new G0._Code("<="),EQ:new G0._Code("==="),NEQ:new G0._Code("!=="),NOT:new G0._Code("!"),OR:new G0._Code("||"),AND:new G0._Code("&&"),ADD:new G0._Code("+")};class X_{optimizeNodes(){return this}optimizeNames(_,z){return this}}class BF extends X_{constructor(_,z,A){super();this.varKind=_,this.name=z,this.rhs=A}render({es5:_,_n:z}){let A=_?r9.varKinds.var:this.varKind,b=this.rhs===void 0?"":` = ${this.rhs}`;return`${A} ${this.name}${b};`+z}optimizeNames(_,z){if(!_[this.name.str])return;if(this.rhs)this.rhs=m1(this.rhs,_,z);return this}get names(){return this.rhs instanceof G0._CodeOrName?this.rhs.names:{}}}class L7 extends X_{constructor(_,z,A){super();this.lhs=_,this.rhs=z,this.sideEffects=A}render({_n:_}){return`${this.lhs} = ${this.rhs};`+_}optimizeNames(_,z){if(this.lhs instanceof G0.Name&&!_[this.lhs.str]&&!this.sideEffects)return;return this.rhs=m1(this.rhs,_,z),this}get names(){let _=this.lhs instanceof G0.Name?{}:{...this.lhs.names};return LA(_,this.rhs)}}class ZF extends L7{constructor(_,z,A,b){super(_,A,b);this.op=z}render({_n:_}){return`${this.lhs} ${this.op}= ${this.rhs};`+_}}class FF extends X_{constructor(_){super();this.label=_,this.names={}}render({_n:_}){return`${this.label}:`+_}}class KF extends X_{constructor(_){super();this.label=_,this.names={}}render({_n:_}){return`break${this.label?` ${this.label}`:""};`+_}}class qF extends X_{constructor(_){super();this.error=_}render({_n:_}){return`throw ${this.error};`+_}get names(){return this.error.names}}class WF extends X_{constructor(_){super();this.code=_}render({_n:_}){return`${this.code};`+_}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(_,z){return this.code=m1(this.code,_,z),this}get names(){return this.code instanceof G0._CodeOrName?this.code.names:{}}}class RA extends X_{constructor(_=[]){super();this.nodes=_}render(_){return this.nodes.reduce((z,A)=>z+A.render(_),"")}optimizeNodes(){let{nodes:_}=this,z=_.length;while(z--){let A=_[z].optimizeNodes();if(Array.isArray(A))_.splice(z,1,...A);else if(A)_[z]=A;else _.splice(z,1)}return _.length>0?this:void 0}optimizeNames(_,z){let{nodes:A}=this,b=A.length;while(b--){let G=A[b];if(G.optimizeNames(_,z))continue;oT(_,G.names),A.splice(b,1)}return A.length>0?this:void 0}get names(){return this.nodes.reduce((_,z)=>C_(_,z.names),{})}}class Q_ extends RA{render(_){return"{"+_._n+super.render(_)+"}"+_._n}}class VF extends RA{}class Q3 extends Q_{}Q3.kind="else";class C4 extends Q_{constructor(_,z){super(z);this.condition=_}render(_){let z=`if(${this.condition})`+super.render(_);if(this.else)z+="else "+this.else.render(_);return z}optimizeNodes(){super.optimizeNodes();let _=this.condition;if(_===!0)return this.nodes;let z=this.else;if(z){let A=z.optimizeNodes();z=this.else=Array.isArray(A)?new Q3(A):A}if(z){if(_===!1)return z instanceof C4?z:z.nodes;if(this.nodes.length)return this;return new C4(wF(_),z instanceof C4?[z]:z.nodes)}if(_===!1||!this.nodes.length)return;return this}optimizeNames(_,z){var A;if(this.else=(A=this.else)===null||A===void 0?void 0:A.optimizeNames(_,z),!(super.optimizeNames(_,z)||this.else))return;return this.condition=m1(this.condition,_,z),this}get names(){let _=super.names;if(LA(_,this.condition),this.else)C_(_,this.else.names);return _}}C4.kind="if";class h1 extends Q_{}h1.kind="for";class UF extends h1{constructor(_){super();this.iteration=_}render(_){return`for(${this.iteration})`+super.render(_)}optimizeNames(_,z){if(!super.optimizeNames(_,z))return;return this.iteration=m1(this.iteration,_,z),this}get names(){return C_(super.names,this.iteration.names)}}class DF extends h1{constructor(_,z,A,b){super();this.varKind=_,this.name=z,this.from=A,this.to=b}render(_){let z=_.es5?r9.varKinds.var:this.varKind,{name:A,from:b,to:G}=this;return`for(${z} ${A}=${b}; ${A}<${G}; ${A}++)`+super.render(_)}get names(){let _=LA(super.names,this.from);return LA(_,this.to)}}class E7 extends h1{constructor(_,z,A,b){super();this.loop=_,this.varKind=z,this.name=A,this.iterable=b}render(_){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(_)}optimizeNames(_,z){if(!super.optimizeNames(_,z))return;return this.iterable=m1(this.iterable,_,z),this}get names(){return C_(super.names,this.iterable.names)}}class NA extends Q_{constructor(_,z,A){super();this.name=_,this.args=z,this.async=A}render(_){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(_)}}NA.kind="func";class wA extends RA{render(_){return"return "+super.render(_)}}wA.kind="return";class MF extends Q_{render(_){let z="try"+super.render(_);if(this.catch)z+=this.catch.render(_);if(this.finally)z+=this.finally.render(_);return z}optimizeNodes(){var _,z;return super.optimizeNodes(),(_=this.catch)===null||_===void 0||_.optimizeNodes(),(z=this.finally)===null||z===void 0||z.optimizeNodes(),this}optimizeNames(_,z){var A,b;return super.optimizeNames(_,z),(A=this.catch)===null||A===void 0||A.optimizeNames(_,z),(b=this.finally)===null||b===void 0||b.optimizeNames(_,z),this}get names(){let _=super.names;if(this.catch)C_(_,this.catch.names);if(this.finally)C_(_,this.finally.names);return _}}class EA extends Q_{constructor(_){super();this.error=_}render(_){return`catch(${this.error})`+super.render(_)}}EA.kind="catch";class OA extends Q_{render(_){return"finally"+super.render(_)}}OA.kind="finally";class NF{constructor(_,z={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...z,_n:z.lines?`
28
- `:""},this._extScope=_,this._scope=new r9.Scope({parent:_}),this._nodes=[new VF]}toString(){return this._root.render(this.opts)}name(_){return this._scope.name(_)}scopeName(_){return this._extScope.name(_)}scopeValue(_,z){let A=this._extScope.value(_,z);return(this._values[A.prefix]||(this._values[A.prefix]=new Set)).add(A),A}getScopeValue(_,z){return this._extScope.getValue(_,z)}scopeRefs(_){return this._extScope.scopeRefs(_,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(_,z,A,b){let G=this._scope.toName(z);if(A!==void 0&&b)this._constants[G.str]=A;return this._leafNode(new BF(_,G,A)),G}const(_,z,A){return this._def(r9.varKinds.const,_,z,A)}let(_,z,A){return this._def(r9.varKinds.let,_,z,A)}var(_,z,A){return this._def(r9.varKinds.var,_,z,A)}assign(_,z,A){return this._leafNode(new L7(_,z,A))}add(_,z){return this._leafNode(new ZF(_,B9.operators.ADD,z))}code(_){if(typeof _=="function")_();else if(_!==G0.nil)this._leafNode(new WF(_));return this}object(..._){let z=["{"];for(let[A,b]of _){if(z.length>1)z.push(",");if(z.push(A),A!==b||this.opts.es5)z.push(":"),(0,G0.addCodeArg)(z,b)}return z.push("}"),new G0._Code(z)}if(_,z,A){if(this._blockNode(new C4(_)),z&&A)this.code(z).else().code(A).endIf();else if(z)this.code(z).endIf();else if(A)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(_){return this._elseNode(new C4(_))}else(){return this._elseNode(new Q3)}endIf(){return this._endBlockNode(C4,Q3)}_for(_,z){if(this._blockNode(_),z)this.code(z).endFor();return this}for(_,z){return this._for(new UF(_),z)}forRange(_,z,A,b,G=this.opts.es5?r9.varKinds.var:r9.varKinds.let){let J=this._scope.toName(_);return this._for(new DF(G,J,z,A),()=>b(J))}forOf(_,z,A,b=r9.varKinds.const){let G=this._scope.toName(_);if(this.opts.es5){let J=z instanceof G0.Name?z:this.var("_arr",z);return this.forRange("_i",0,G0._`${J}.length`,(Y)=>{this.var(G,G0._`${J}[${Y}]`),A(G)})}return this._for(new E7("of",b,G,z),()=>A(G))}forIn(_,z,A,b=this.opts.es5?r9.varKinds.var:r9.varKinds.const){if(this.opts.ownProperties)return this.forOf(_,G0._`Object.keys(${z})`,A);let G=this._scope.toName(_);return this._for(new E7("in",b,G,z),()=>A(G))}endFor(){return this._endBlockNode(h1)}label(_){return this._leafNode(new FF(_))}break(_){return this._leafNode(new KF(_))}return(_){let z=new wA;if(this._blockNode(z),this.code(_),z.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(wA)}try(_,z,A){if(!z&&!A)throw Error('CodeGen: "try" without "catch" and "finally"');let b=new MF;if(this._blockNode(b),this.code(_),z){let G=this.name("e");this._currNode=b.catch=new EA(G),z(G)}if(A)this._currNode=b.finally=new OA,this.code(A);return this._endBlockNode(EA,OA)}throw(_){return this._leafNode(new qF(_))}block(_,z){if(this._blockStarts.push(this._nodes.length),_)this.code(_).endBlock(z);return this}endBlock(_){let z=this._blockStarts.pop();if(z===void 0)throw Error("CodeGen: not in self-balancing block");let A=this._nodes.length-z;if(A<0||_!==void 0&&A!==_)throw Error(`CodeGen: wrong number of nodes: ${A} vs ${_} expected`);return this._nodes.length=z,this}func(_,z=G0.nil,A,b){if(this._blockNode(new NA(_,z,A)),b)this.code(b).endFunc();return this}endFunc(){return this._endBlockNode(NA)}optimize(_=1){while(_-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(_){return this._currNode.nodes.push(_),this}_blockNode(_){this._currNode.nodes.push(_),this._nodes.push(_)}_endBlockNode(_,z){let A=this._currNode;if(A instanceof _||z&&A instanceof z)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${z?`${_.kind}/${z.kind}`:_.kind}"`)}_elseNode(_){let z=this._currNode;if(!(z instanceof C4))throw Error('CodeGen: "else" without "if"');return this._currNode=z.else=_,this}get _root(){return this._nodes[0]}get _currNode(){let _=this._nodes;return _[_.length-1]}set _currNode(_){let z=this._nodes;z[z.length-1]=_}}B9.CodeGen=NF;function C_(_,z){for(let A in z)_[A]=(_[A]||0)+(z[A]||0);return _}function LA(_,z){return z instanceof G0._CodeOrName?C_(_,z.names):_}function m1(_,z,A){if(_ instanceof G0.Name)return b(_);if(!G(_))return _;return new G0._Code(_._items.reduce((J,Y)=>{if(Y instanceof G0.Name)Y=b(Y);if(Y instanceof G0._Code)J.push(...Y._items);else J.push(Y);return J},[]));function b(J){let Y=A[J.str];if(Y===void 0||z[J.str]!==1)return J;return delete z[J.str],Y}function G(J){return J instanceof G0._Code&&J._items.some((Y)=>Y instanceof G0.Name&&z[Y.str]===1&&A[Y.str]!==void 0)}}function oT(_,z){for(let A in z)_[A]=(_[A]||0)-(z[A]||0)}function wF(_){return typeof _=="boolean"||typeof _=="number"||_===null?!_:G0._`!${O7(_)}`}B9.not=wF;var aT=EF(B9.operators.AND);function sT(..._){return _.reduce(aT)}B9.and=sT;var tT=EF(B9.operators.OR);function eT(..._){return _.reduce(tT)}B9.or=eT;function EF(_){return(z,A)=>z===G0.nil?A:A===G0.nil?z:G0._`${O7(z)} ${_} ${O7(A)}`}function O7(_){return _ instanceof G0.Name?_:G0._`(${_})`}});var Q0=I((xF)=>{Object.defineProperty(xF,"__esModule",{value:!0});xF.checkStrictMode=xF.getErrorPath=xF.Type=xF.useFunc=xF.setEvaluated=xF.evaluatedPropsToName=xF.mergeEvaluated=xF.eachItem=xF.unescapeJsonPointer=xF.escapeJsonPointer=xF.escapeFragment=xF.unescapeFragment=xF.schemaRefOrVal=xF.schemaHasRulesButRef=xF.schemaHasRules=xF.checkUnknownRules=xF.alwaysValidSchema=xF.toHash=void 0;var V0=t(),bC=X3();function GC(_){let z={};for(let A of _)z[A]=!0;return z}xF.toHash=GC;function JC(_,z){if(typeof z=="boolean")return z;if(Object.keys(z).length===0)return!0;return RF(_,z),!PF(z,_.self.RULES.all)}xF.alwaysValidSchema=JC;function RF(_,z=_.schema){let{opts:A,self:b}=_;if(!A.strictSchema)return;if(typeof z==="boolean")return;let G=b.RULES.keywords;for(let J in z)if(!G[J])IF(_,`unknown keyword: "${J}"`)}xF.checkUnknownRules=RF;function PF(_,z){if(typeof _=="boolean")return!_;for(let A in _)if(z[A])return!0;return!1}xF.schemaHasRules=PF;function YC(_,z){if(typeof _=="boolean")return!_;for(let A in _)if(A!=="$ref"&&z.all[A])return!0;return!1}xF.schemaHasRulesButRef=YC;function XC({topSchemaRef:_,schemaPath:z},A,b,G){if(!G){if(typeof A=="number"||typeof A=="boolean")return A;if(typeof A=="string")return V0._`${A}`}return V0._`${_}${z}${(0,V0.getProperty)(b)}`}xF.schemaRefOrVal=XC;function QC(_){return SF(decodeURIComponent(_))}xF.unescapeFragment=QC;function $C(_){return encodeURIComponent(R7(_))}xF.escapeFragment=$C;function R7(_){if(typeof _=="number")return`${_}`;return _.replace(/~/g,"~0").replace(/\//g,"~1")}xF.escapeJsonPointer=R7;function SF(_){return _.replace(/~1/g,"/").replace(/~0/g,"~")}xF.unescapeJsonPointer=SF;function HC(_,z){if(Array.isArray(_))for(let A of _)z(A);else z(_)}xF.eachItem=HC;function LF({mergeNames:_,mergeToName:z,mergeValues:A,resultToName:b}){return(G,J,Y,X)=>{let Q=Y===void 0?J:Y instanceof V0.Name?(J instanceof V0.Name?_(G,J,Y):z(G,J,Y),Y):J instanceof V0.Name?(z(G,Y,J),J):A(J,Y);return X===V0.Name&&!(Q instanceof V0.Name)?b(G,Q):Q}}xF.mergeEvaluated={props:LF({mergeNames:(_,z,A)=>_.if(V0._`${A} !== true && ${z} !== undefined`,()=>{_.if(V0._`${z} === true`,()=>_.assign(A,!0),()=>_.assign(A,V0._`${A} || {}`).code(V0._`Object.assign(${A}, ${z})`))}),mergeToName:(_,z,A)=>_.if(V0._`${A} !== true`,()=>{if(z===!0)_.assign(A,!0);else _.assign(A,V0._`${A} || {}`),P7(_,A,z)}),mergeValues:(_,z)=>_===!0?!0:{..._,...z},resultToName:kF}),items:LF({mergeNames:(_,z,A)=>_.if(V0._`${A} !== true && ${z} !== undefined`,()=>_.assign(A,V0._`${z} === true ? true : ${A} > ${z} ? ${A} : ${z}`)),mergeToName:(_,z,A)=>_.if(V0._`${A} !== true`,()=>_.assign(A,z===!0?!0:V0._`${A} > ${z} ? ${A} : ${z}`)),mergeValues:(_,z)=>_===!0?!0:Math.max(_,z),resultToName:(_,z)=>_.var("items",z)})};function kF(_,z){if(z===!0)return _.var("props",!0);let A=_.var("props",V0._`{}`);if(z!==void 0)P7(_,A,z);return A}xF.evaluatedPropsToName=kF;function P7(_,z,A){Object.keys(A).forEach((b)=>_.assign(V0._`${z}${(0,V0.getProperty)(b)}`,!0))}xF.setEvaluated=P7;var jF={};function BC(_,z){return _.scopeValue("func",{ref:z,code:jF[z.code]||(jF[z.code]=new bC._Code(z.code))})}xF.useFunc=BC;var j7;(function(_){_[_.Num=0]="Num",_[_.Str=1]="Str"})(j7||(xF.Type=j7={}));function ZC(_,z,A){if(_ instanceof V0.Name){let b=z===j7.Num;return A?b?V0._`"[" + ${_} + "]"`:V0._`"['" + ${_} + "']"`:b?V0._`"/" + ${_}`:V0._`"/" + ${_}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,V0.getProperty)(_).toString():"/"+R7(_)}xF.getErrorPath=ZC;function IF(_,z,A=_.opts.strictSchema){if(!A)return;if(z=`strict mode: ${z}`,A===!0)throw Error(z);_.self.logger.warn(z)}xF.checkStrictMode=IF});var v4=I((CF)=>{Object.defineProperty(CF,"__esModule",{value:!0});var i0=t(),kC={data:new i0.Name("data"),valCxt:new i0.Name("valCxt"),instancePath:new i0.Name("instancePath"),parentData:new i0.Name("parentData"),parentDataProperty:new i0.Name("parentDataProperty"),rootData:new i0.Name("rootData"),dynamicAnchors:new i0.Name("dynamicAnchors"),vErrors:new i0.Name("vErrors"),errors:new i0.Name("errors"),this:new i0.Name("this"),self:new i0.Name("self"),scope:new i0.Name("scope"),json:new i0.Name("json"),jsonPos:new i0.Name("jsonPos"),jsonLen:new i0.Name("jsonLen"),jsonPart:new i0.Name("jsonPart")};CF.default=kC});var $3=I((fF)=>{Object.defineProperty(fF,"__esModule",{value:!0});fF.extendErrors=fF.resetErrorsCount=fF.reportExtraError=fF.reportError=fF.keyword$DataError=fF.keywordError=void 0;var J0=t(),SA=Q0(),b9=v4();fF.keywordError={message:({keyword:_})=>J0.str`must pass "${_}" keyword validation`};fF.keyword$DataError={message:({keyword:_,schemaType:z})=>z?J0.str`"${_}" keyword must be ${z} ($data)`:J0.str`"${_}" keyword is invalid ($data)`};function xC(_,z=fF.keywordError,A,b){let{it:G}=_,{gen:J,compositeRule:Y,allErrors:X}=G,Q=gF(_,z,A);if(b!==null&&b!==void 0?b:Y||X)vF(J,Q);else yF(G,J0._`[${Q}]`)}fF.reportError=xC;function TC(_,z=fF.keywordError,A){let{it:b}=_,{gen:G,compositeRule:J,allErrors:Y}=b,X=gF(_,z,A);if(vF(G,X),!(J||Y))yF(b,b9.default.vErrors)}fF.reportExtraError=TC;function CC(_,z){_.assign(b9.default.errors,z),_.if(J0._`${b9.default.vErrors} !== null`,()=>_.if(z,()=>_.assign(J0._`${b9.default.vErrors}.length`,z),()=>_.assign(b9.default.vErrors,null)))}fF.resetErrorsCount=CC;function vC({gen:_,keyword:z,schemaValue:A,data:b,errsCount:G,it:J}){if(G===void 0)throw Error("ajv implementation error");let Y=_.name("err");_.forRange("i",G,b9.default.errors,(X)=>{if(_.const(Y,J0._`${b9.default.vErrors}[${X}]`),_.if(J0._`${Y}.instancePath === undefined`,()=>_.assign(J0._`${Y}.instancePath`,(0,J0.strConcat)(b9.default.instancePath,J.errorPath))),_.assign(J0._`${Y}.schemaPath`,J0.str`${J.errSchemaPath}/${z}`),J.opts.verbose)_.assign(J0._`${Y}.schema`,A),_.assign(J0._`${Y}.data`,b)})}fF.extendErrors=vC;function vF(_,z){let A=_.const("err",z);_.if(J0._`${b9.default.vErrors} === null`,()=>_.assign(b9.default.vErrors,J0._`[${A}]`),J0._`${b9.default.vErrors}.push(${A})`),_.code(J0._`${b9.default.errors}++`)}function yF(_,z){let{gen:A,validateName:b,schemaEnv:G}=_;if(G.$async)A.throw(J0._`new ${_.ValidationError}(${z})`);else A.assign(J0._`${b}.errors`,z),A.return(!1)}var v_={keyword:new J0.Name("keyword"),schemaPath:new J0.Name("schemaPath"),params:new J0.Name("params"),propertyName:new J0.Name("propertyName"),message:new J0.Name("message"),schema:new J0.Name("schema"),parentSchema:new J0.Name("parentSchema")};function gF(_,z,A){let{createErrors:b}=_.it;if(b===!1)return J0._`{}`;return yC(_,z,A)}function yC(_,z,A={}){let{gen:b,it:G}=_,J=[gC(G,A),fC(_,A)];return hC(_,z,J),b.object(...J)}function gC({errorPath:_},{instancePath:z}){let A=z?J0.str`${_}${(0,SA.getErrorPath)(z,SA.Type.Str)}`:_;return[b9.default.instancePath,(0,J0.strConcat)(b9.default.instancePath,A)]}function fC({keyword:_,it:{errSchemaPath:z}},{schemaPath:A,parentSchema:b}){let G=b?z:J0.str`${z}/${_}`;if(A)G=J0.str`${G}${(0,SA.getErrorPath)(A,SA.Type.Str)}`;return[v_.schemaPath,G]}function hC(_,{params:z,message:A},b){let{keyword:G,data:J,schemaValue:Y,it:X}=_,{opts:Q,propertyName:$,topSchemaRef:H,schemaPath:B}=X;if(b.push([v_.keyword,G],[v_.params,typeof z=="function"?z(_):z||J0._`{}`]),Q.messages)b.push([v_.message,typeof A=="function"?A(_):A]);if(Q.verbose)b.push([v_.schema,Y],[v_.parentSchema,J0._`${H}${B}`],[b9.default.data,J]);if($)b.push([v_.propertyName,$])}});var lF=I((uF)=>{Object.defineProperty(uF,"__esModule",{value:!0});uF.boolOrEmptySchema=uF.topBoolOrEmptySchema=void 0;var pC=$3(),dC=t(),rC=v4(),nC={message:"boolean schema is false"};function iC(_){let{gen:z,schema:A,validateName:b}=_;if(A===!1)mF(_,!1);else if(typeof A=="object"&&A.$async===!0)z.return(rC.default.data);else z.assign(dC._`${b}.errors`,null),z.return(!0)}uF.topBoolOrEmptySchema=iC;function oC(_,z){let{gen:A,schema:b}=_;if(b===!1)A.var(z,!1),mF(_);else A.var(z,!0)}uF.boolOrEmptySchema=oC;function mF(_,z){let{gen:A,data:b}=_,G={gen:A,keyword:"false schema",data:b,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:_};(0,pC.reportError)(G,nC,void 0,z)}});var k7=I((pF)=>{Object.defineProperty(pF,"__esModule",{value:!0});pF.getRules=pF.isJSONType=void 0;var sC=["string","number","integer","boolean","null","object","array"],tC=new Set(sC);function eC(_){return typeof _=="string"&&tC.has(_)}pF.isJSONType=eC;function _v(){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:{}}}pF.getRules=_v});var I7=I((iF)=>{Object.defineProperty(iF,"__esModule",{value:!0});iF.shouldUseRule=iF.shouldUseGroup=iF.schemaHasRulesForType=void 0;function Av({schema:_,self:z},A){let b=z.RULES.types[A];return b&&b!==!0&&rF(_,b)}iF.schemaHasRulesForType=Av;function rF(_,z){return z.rules.some((A)=>nF(_,A))}iF.shouldUseGroup=rF;function nF(_,z){var A;return _[z.keyword]!==void 0||((A=z.definition.implements)===null||A===void 0?void 0:A.some((b)=>_[b]!==void 0))}iF.shouldUseRule=nF});var H3=I((eF)=>{Object.defineProperty(eF,"__esModule",{value:!0});eF.reportTypeError=eF.checkDataTypes=eF.checkDataType=eF.coerceAndCheckDataType=eF.getJSONTypes=eF.getSchemaTypes=eF.DataType=void 0;var Jv=k7(),Yv=I7(),Xv=$3(),a=t(),aF=Q0(),u1;(function(_){_[_.Correct=0]="Correct",_[_.Wrong=1]="Wrong"})(u1||(eF.DataType=u1={}));function Qv(_){let z=sF(_.type);if(z.includes("null")){if(_.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!z.length&&_.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(_.nullable===!0)z.push("null")}return z}eF.getSchemaTypes=Qv;function sF(_){let z=Array.isArray(_)?_:_?[_]:[];if(z.every(Jv.isJSONType))return z;throw Error("type must be JSONType or JSONType[]: "+z.join(","))}eF.getJSONTypes=sF;function $v(_,z){let{gen:A,data:b,opts:G}=_,J=Hv(z,G.coerceTypes),Y=z.length>0&&!(J.length===0&&z.length===1&&(0,Yv.schemaHasRulesForType)(_,z[0]));if(Y){let X=T7(z,b,G.strictNumbers,u1.Wrong);A.if(X,()=>{if(J.length)Bv(_,z,J);else C7(_)})}return Y}eF.coerceAndCheckDataType=$v;var tF=new Set(["string","number","integer","boolean","null"]);function Hv(_,z){return z?_.filter((A)=>tF.has(A)||z==="array"&&A==="array"):[]}function Bv(_,z,A){let{gen:b,data:G,opts:J}=_,Y=b.let("dataType",a._`typeof ${G}`),X=b.let("coerced",a._`undefined`);if(J.coerceTypes==="array")b.if(a._`${Y} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>b.assign(G,a._`${G}[0]`).assign(Y,a._`typeof ${G}`).if(T7(z,G,J.strictNumbers),()=>b.assign(X,G)));b.if(a._`${X} !== undefined`);for(let $ of A)if(tF.has($)||$==="array"&&J.coerceTypes==="array")Q($);b.else(),C7(_),b.endIf(),b.if(a._`${X} !== undefined`,()=>{b.assign(G,X),Zv(_,X)});function Q($){switch($){case"string":b.elseIf(a._`${Y} == "number" || ${Y} == "boolean"`).assign(X,a._`"" + ${G}`).elseIf(a._`${G} === null`).assign(X,a._`""`);return;case"number":b.elseIf(a._`${Y} == "boolean" || ${G} === null
29
- || (${Y} == "string" && ${G} && ${G} == +${G})`).assign(X,a._`+${G}`);return;case"integer":b.elseIf(a._`${Y} === "boolean" || ${G} === null
30
- || (${Y} === "string" && ${G} && ${G} == +${G} && !(${G} % 1))`).assign(X,a._`+${G}`);return;case"boolean":b.elseIf(a._`${G} === "false" || ${G} === 0 || ${G} === null`).assign(X,!1).elseIf(a._`${G} === "true" || ${G} === 1`).assign(X,!0);return;case"null":b.elseIf(a._`${G} === "" || ${G} === 0 || ${G} === false`),b.assign(X,null);return;case"array":b.elseIf(a._`${Y} === "string" || ${Y} === "number"
31
- || ${Y} === "boolean" || ${G} === null`).assign(X,a._`[${G}]`)}}}function Zv({gen:_,parentData:z,parentDataProperty:A},b){_.if(a._`${z} !== undefined`,()=>_.assign(a._`${z}[${A}]`,b))}function x7(_,z,A,b=u1.Correct){let G=b===u1.Correct?a.operators.EQ:a.operators.NEQ,J;switch(_){case"null":return a._`${z} ${G} null`;case"array":J=a._`Array.isArray(${z})`;break;case"object":J=a._`${z} && typeof ${z} == "object" && !Array.isArray(${z})`;break;case"integer":J=Y(a._`!(${z} % 1) && !isNaN(${z})`);break;case"number":J=Y();break;default:return a._`typeof ${z} ${G} ${_}`}return b===u1.Correct?J:(0,a.not)(J);function Y(X=a.nil){return(0,a.and)(a._`typeof ${z} == "number"`,X,A?a._`isFinite(${z})`:a.nil)}}eF.checkDataType=x7;function T7(_,z,A,b){if(_.length===1)return x7(_[0],z,A,b);let G,J=(0,aF.toHash)(_);if(J.array&&J.object){let Y=a._`typeof ${z} != "object"`;G=J.null?Y:a._`!${z} || ${Y}`,delete J.null,delete J.array,delete J.object}else G=a.nil;if(J.number)delete J.integer;for(let Y in J)G=(0,a.and)(G,x7(Y,z,A,b));return G}eF.checkDataTypes=T7;var Fv={message:({schema:_})=>`must be ${_}`,params:({schema:_,schemaValue:z})=>typeof _=="string"?a._`{type: ${_}}`:a._`{type: ${z}}`};function C7(_){let z=Kv(_);(0,Xv.reportError)(z,Fv)}eF.reportTypeError=C7;function Kv(_){let{gen:z,data:A,schema:b}=_,G=(0,aF.schemaRefOrVal)(_,b,"type");return{gen:z,keyword:"type",data:A,schema:b.type,schemaCode:G,schemaValue:G,parentSchema:b,params:{},it:_}}});var GK=I((AK)=>{Object.defineProperty(AK,"__esModule",{value:!0});AK.assignDefaults=void 0;var c1=t(),Nv=Q0();function wv(_,z){let{properties:A,items:b}=_.schema;if(z==="object"&&A)for(let G in A)zK(_,G,A[G].default);else if(z==="array"&&Array.isArray(b))b.forEach((G,J)=>zK(_,J,G.default))}AK.assignDefaults=wv;function zK(_,z,A){let{gen:b,compositeRule:G,data:J,opts:Y}=_;if(A===void 0)return;let X=c1._`${J}${(0,c1.getProperty)(z)}`;if(G){(0,Nv.checkStrictMode)(_,`default is ignored for: ${X}`);return}let Q=c1._`${X} === undefined`;if(Y.useDefaults==="empty")Q=c1._`${Q} || ${X} === null || ${X} === ""`;b.if(Q,c1._`${X} = ${(0,c1.stringify)(A)}`)}});var R9=I((XK)=>{Object.defineProperty(XK,"__esModule",{value:!0});XK.validateUnion=XK.validateArray=XK.usePattern=XK.callValidateCode=XK.schemaProperties=XK.allSchemaProperties=XK.noPropertyInData=XK.propertyInData=XK.isOwnProperty=XK.hasPropFunc=XK.reportMissingProp=XK.checkMissingProp=XK.checkReportMissingProp=void 0;var w0=t(),v7=Q0(),$_=v4(),Ev=Q0();function Ov(_,z){let{gen:A,data:b,it:G}=_;A.if(g7(A,b,z,G.opts.ownProperties),()=>{_.setParams({missingProperty:w0._`${z}`},!0),_.error()})}XK.checkReportMissingProp=Ov;function Lv({gen:_,data:z,it:{opts:A}},b,G){return(0,w0.or)(...b.map((J)=>(0,w0.and)(g7(_,z,J,A.ownProperties),w0._`${G} = ${J}`)))}XK.checkMissingProp=Lv;function jv(_,z){_.setParams({missingProperty:z},!0),_.error()}XK.reportMissingProp=jv;function JK(_){return _.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:w0._`Object.prototype.hasOwnProperty`})}XK.hasPropFunc=JK;function y7(_,z,A){return w0._`${JK(_)}.call(${z}, ${A})`}XK.isOwnProperty=y7;function Rv(_,z,A,b){let G=w0._`${z}${(0,w0.getProperty)(A)} !== undefined`;return b?w0._`${G} && ${y7(_,z,A)}`:G}XK.propertyInData=Rv;function g7(_,z,A,b){let G=w0._`${z}${(0,w0.getProperty)(A)} === undefined`;return b?(0,w0.or)(G,(0,w0.not)(y7(_,z,A))):G}XK.noPropertyInData=g7;function YK(_){return _?Object.keys(_).filter((z)=>z!=="__proto__"):[]}XK.allSchemaProperties=YK;function Pv(_,z){return YK(z).filter((A)=>!(0,v7.alwaysValidSchema)(_,z[A]))}XK.schemaProperties=Pv;function Sv({schemaCode:_,data:z,it:{gen:A,topSchemaRef:b,schemaPath:G,errorPath:J},it:Y},X,Q,$){let H=$?w0._`${_}, ${z}, ${b}${G}`:z,B=[[$_.default.instancePath,(0,w0.strConcat)($_.default.instancePath,J)],[$_.default.parentData,Y.parentData],[$_.default.parentDataProperty,Y.parentDataProperty],[$_.default.rootData,$_.default.rootData]];if(Y.opts.dynamicRef)B.push([$_.default.dynamicAnchors,$_.default.dynamicAnchors]);let Z=w0._`${H}, ${A.object(...B)}`;return Q!==w0.nil?w0._`${X}.call(${Q}, ${Z})`:w0._`${X}(${Z})`}XK.callValidateCode=Sv;var kv=w0._`new RegExp`;function Iv({gen:_,it:{opts:z}},A){let b=z.unicodeRegExp?"u":"",{regExp:G}=z.code,J=G(A,b);return _.scopeValue("pattern",{key:J.toString(),ref:J,code:w0._`${G.code==="new RegExp"?kv:(0,Ev.useFunc)(_,G)}(${A}, ${b})`})}XK.usePattern=Iv;function xv(_){let{gen:z,data:A,keyword:b,it:G}=_,J=z.name("valid");if(G.allErrors){let X=z.let("valid",!0);return Y(()=>z.assign(X,!1)),X}return z.var(J,!0),Y(()=>z.break()),J;function Y(X){let Q=z.const("len",w0._`${A}.length`);z.forRange("i",0,Q,($)=>{_.subschema({keyword:b,dataProp:$,dataPropType:v7.Type.Num},J),z.if((0,w0.not)(J),X)})}}XK.validateArray=xv;function Tv(_){let{gen:z,schema:A,keyword:b,it:G}=_;if(!Array.isArray(A))throw Error("ajv implementation error");if(A.some((Q)=>(0,v7.alwaysValidSchema)(G,Q))&&!G.opts.unevaluated)return;let Y=z.let("valid",!1),X=z.name("_valid");z.block(()=>A.forEach((Q,$)=>{let H=_.subschema({keyword:b,schemaProp:$,compositeRule:!0},X);if(z.assign(Y,w0._`${Y} || ${X}`),!_.mergeValidEvaluated(H,X))z.if((0,w0.not)(Y))})),_.result(Y,()=>_.reset(),()=>_.error(!0))}XK.validateUnion=Tv});var FK=I((BK)=>{Object.defineProperty(BK,"__esModule",{value:!0});BK.validateKeywordUsage=BK.validSchemaType=BK.funcKeywordCode=BK.macroKeywordCode=void 0;var G9=t(),y_=v4(),rv=R9(),nv=$3();function iv(_,z){let{gen:A,keyword:b,schema:G,parentSchema:J,it:Y}=_,X=z.macro.call(Y.self,G,J,Y),Q=HK(A,b,X);if(Y.opts.validateSchema!==!1)Y.self.validateSchema(X,!0);let $=A.name("valid");_.subschema({schema:X,schemaPath:G9.nil,errSchemaPath:`${Y.errSchemaPath}/${b}`,topSchemaRef:Q,compositeRule:!0},$),_.pass($,()=>_.error(!0))}BK.macroKeywordCode=iv;function ov(_,z){var A;let{gen:b,keyword:G,schema:J,parentSchema:Y,$data:X,it:Q}=_;sv(Q,z);let $=!X&&z.compile?z.compile.call(Q.self,J,Y,Q):z.validate,H=HK(b,G,$),B=b.let("valid");_.block$data(B,Z),_.ok((A=z.valid)!==null&&A!==void 0?A:B);function Z(){if(z.errors===!1){if(q(),z.modifying)$K(_);W(()=>_.error())}else{let V=z.async?F():K();if(z.modifying)$K(_);W(()=>av(_,V))}}function F(){let V=b.let("ruleErrs",null);return b.try(()=>q(G9._`await `),(w)=>b.assign(B,!1).if(G9._`${w} instanceof ${Q.ValidationError}`,()=>b.assign(V,G9._`${w}.errors`),()=>b.throw(w))),V}function K(){let V=G9._`${H}.errors`;return b.assign(V,null),q(G9.nil),V}function q(V=z.async?G9._`await `:G9.nil){let w=Q.opts.passContext?y_.default.this:y_.default.self,O=!(("compile"in z)&&!X||z.schema===!1);b.assign(B,G9._`${V}${(0,rv.callValidateCode)(_,H,w,O)}`,z.modifying)}function W(V){var w;b.if((0,G9.not)((w=z.valid)!==null&&w!==void 0?w:B),V)}}BK.funcKeywordCode=ov;function $K(_){let{gen:z,data:A,it:b}=_;z.if(b.parentData,()=>z.assign(A,G9._`${b.parentData}[${b.parentDataProperty}]`))}function av(_,z){let{gen:A}=_;A.if(G9._`Array.isArray(${z})`,()=>{A.assign(y_.default.vErrors,G9._`${y_.default.vErrors} === null ? ${z} : ${y_.default.vErrors}.concat(${z})`).assign(y_.default.errors,G9._`${y_.default.vErrors}.length`),(0,nv.extendErrors)(_)},()=>_.error())}function sv({schemaEnv:_},z){if(z.async&&!_.$async)throw Error("async keyword in sync schema")}function HK(_,z,A){if(A===void 0)throw Error(`keyword "${z}" failed to compile`);return _.scopeValue("keyword",typeof A=="function"?{ref:A}:{ref:A,code:(0,G9.stringify)(A)})}function tv(_,z,A=!1){return!z.length||z.some((b)=>b==="array"?Array.isArray(_):b==="object"?_&&typeof _=="object"&&!Array.isArray(_):typeof _==b||A&&typeof _>"u")}BK.validSchemaType=tv;function ev({schema:_,opts:z,self:A,errSchemaPath:b},G,J){if(Array.isArray(G.keyword)?!G.keyword.includes(J):G.keyword!==J)throw Error("ajv implementation error");let Y=G.dependencies;if(Y===null||Y===void 0?void 0:Y.some((X)=>!Object.prototype.hasOwnProperty.call(_,X)))throw Error(`parent schema must have dependencies of ${J}: ${Y.join(",")}`);if(G.validateSchema){if(!G.validateSchema(_[J])){let Q=`keyword "${J}" value is invalid at path "${b}": `+A.errorsText(G.validateSchema.errors);if(z.validateSchema==="log")A.logger.error(Q);else throw Error(Q)}}}BK.validateKeywordUsage=ev});var VK=I((qK)=>{Object.defineProperty(qK,"__esModule",{value:!0});qK.extendSubschemaMode=qK.extendSubschemaData=qK.getSubschema=void 0;var Z4=t(),KK=Q0();function by(_,{keyword:z,schemaProp:A,schema:b,schemaPath:G,errSchemaPath:J,topSchemaRef:Y}){if(z!==void 0&&b!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(z!==void 0){let X=_.schema[z];return A===void 0?{schema:X,schemaPath:Z4._`${_.schemaPath}${(0,Z4.getProperty)(z)}`,errSchemaPath:`${_.errSchemaPath}/${z}`}:{schema:X[A],schemaPath:Z4._`${_.schemaPath}${(0,Z4.getProperty)(z)}${(0,Z4.getProperty)(A)}`,errSchemaPath:`${_.errSchemaPath}/${z}/${(0,KK.escapeFragment)(A)}`}}if(b!==void 0){if(G===void 0||J===void 0||Y===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:b,schemaPath:G,topSchemaRef:Y,errSchemaPath:J}}throw Error('either "keyword" or "schema" must be passed')}qK.getSubschema=by;function Gy(_,z,{dataProp:A,dataPropType:b,data:G,dataTypes:J,propertyName:Y}){if(G!==void 0&&A!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:X}=z;if(A!==void 0){let{errorPath:$,dataPathArr:H,opts:B}=z,Z=X.let("data",Z4._`${z.data}${(0,Z4.getProperty)(A)}`,!0);Q(Z),_.errorPath=Z4.str`${$}${(0,KK.getErrorPath)(A,b,B.jsPropertySyntax)}`,_.parentDataProperty=Z4._`${A}`,_.dataPathArr=[...H,_.parentDataProperty]}if(G!==void 0){let $=G instanceof Z4.Name?G:X.let("data",G,!0);if(Q($),Y!==void 0)_.propertyName=Y}if(J)_.dataTypes=J;function Q($){_.data=$,_.dataLevel=z.dataLevel+1,_.dataTypes=[],z.definedProperties=new Set,_.parentData=z.data,_.dataNames=[...z.dataNames,$]}}qK.extendSubschemaData=Gy;function Jy(_,{jtdDiscriminator:z,jtdMetadata:A,compositeRule:b,createErrors:G,allErrors:J}){if(b!==void 0)_.compositeRule=b;if(G!==void 0)_.createErrors=G;if(J!==void 0)_.allErrors=J;_.jtdDiscriminator=z,_.jtdMetadata=A}qK.extendSubschemaMode=Jy});var f7=I((C30,UK)=>{UK.exports=function _(z,A){if(z===A)return!0;if(z&&A&&typeof z=="object"&&typeof A=="object"){if(z.constructor!==A.constructor)return!1;var b,G,J;if(Array.isArray(z)){if(b=z.length,b!=A.length)return!1;for(G=b;G--!==0;)if(!_(z[G],A[G]))return!1;return!0}if(z.constructor===RegExp)return z.source===A.source&&z.flags===A.flags;if(z.valueOf!==Object.prototype.valueOf)return z.valueOf()===A.valueOf();if(z.toString!==Object.prototype.toString)return z.toString()===A.toString();if(J=Object.keys(z),b=J.length,b!==Object.keys(A).length)return!1;for(G=b;G--!==0;)if(!Object.prototype.hasOwnProperty.call(A,J[G]))return!1;for(G=b;G--!==0;){var Y=J[G];if(!_(z[Y],A[Y]))return!1}return!0}return z!==z&&A!==A}});var MK=I((v30,DK)=>{var H_=DK.exports=function(_,z,A){if(typeof z=="function")A=z,z={};A=z.cb||A;var b=typeof A=="function"?A:A.pre||function(){},G=A.post||function(){};kA(z,b,G,_,"",_)};H_.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};H_.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};H_.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};H_.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 kA(_,z,A,b,G,J,Y,X,Q,$){if(b&&typeof b=="object"&&!Array.isArray(b)){z(b,G,J,Y,X,Q,$);for(var H in b){var B=b[H];if(Array.isArray(B)){if(H in H_.arrayKeywords)for(var Z=0;Z<B.length;Z++)kA(_,z,A,B[Z],G+"/"+H+"/"+Z,J,G,H,b,Z)}else if(H in H_.propsKeywords){if(B&&typeof B=="object")for(var F in B)kA(_,z,A,B[F],G+"/"+H+"/"+Qy(F),J,G,H,b,F)}else if(H in H_.keywords||_.allKeys&&!(H in H_.skipKeywords))kA(_,z,A,B,G+"/"+H,J,G,H,b)}A(b,G,J,Y,X,Q,$)}}function Qy(_){return _.replace(/~/g,"~0").replace(/\//g,"~1")}});var B3=I((OK)=>{Object.defineProperty(OK,"__esModule",{value:!0});OK.getSchemaRefs=OK.resolveUrl=OK.normalizeId=OK._getFullPath=OK.getFullPath=OK.inlineRef=void 0;var $y=Q0(),Hy=f7(),By=MK(),Zy=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Fy(_,z=!0){if(typeof _=="boolean")return!0;if(z===!0)return!h7(_);if(!z)return!1;return NK(_)<=z}OK.inlineRef=Fy;var Ky=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function h7(_){for(let z in _){if(Ky.has(z))return!0;let A=_[z];if(Array.isArray(A)&&A.some(h7))return!0;if(typeof A=="object"&&h7(A))return!0}return!1}function NK(_){let z=0;for(let A in _){if(A==="$ref")return 1/0;if(z++,Zy.has(A))continue;if(typeof _[A]=="object")(0,$y.eachItem)(_[A],(b)=>z+=NK(b));if(z===1/0)return 1/0}return z}function wK(_,z="",A){if(A!==!1)z=l1(z);let b=_.parse(z);return EK(_,b)}OK.getFullPath=wK;function EK(_,z){return _.serialize(z).split("#")[0]+"#"}OK._getFullPath=EK;var qy=/#\/?$/;function l1(_){return _?_.replace(qy,""):""}OK.normalizeId=l1;function Wy(_,z,A){return A=l1(A),_.resolve(z,A)}OK.resolveUrl=Wy;var Vy=/^[a-z_][-a-z0-9._]*$/i;function Uy(_,z){if(typeof _=="boolean")return{};let{schemaId:A,uriResolver:b}=this.opts,G=l1(_[A]||z),J={"":G},Y=wK(b,G,!1),X={},Q=new Set;return By(_,{allKeys:!0},(B,Z,F,K)=>{if(K===void 0)return;let q=Y+Z,W=J[K];if(typeof B[A]=="string")W=V.call(this,B[A]);w.call(this,B.$anchor),w.call(this,B.$dynamicAnchor),J[Z]=W;function V(O){let M=this.opts.uriResolver.resolve;if(O=l1(W?M(W,O):O),Q.has(O))throw H(O);Q.add(O);let P=this.refs[O];if(typeof P=="string")P=this.refs[P];if(typeof P=="object")$(B,P.schema,O);else if(O!==l1(q))if(O[0]==="#")$(B,X[O],O),X[O]=B;else this.refs[O]=q;return O}function w(O){if(typeof O=="string"){if(!Vy.test(O))throw Error(`invalid anchor "${O}"`);V.call(this,`#${O}`)}}}),X;function $(B,Z,F){if(Z!==void 0&&!Hy(B,Z))throw H(F)}function H(B){return Error(`reference "${B}" resolves to more than one schema`)}}OK.getSchemaRefs=Uy});var K3=I((mK)=>{Object.defineProperty(mK,"__esModule",{value:!0});mK.getData=mK.KeywordCxt=mK.validateFunctionCode=void 0;var kK=lF(),jK=H3(),u7=I7(),IA=H3(),Oy=GK(),F3=FK(),m7=VK(),h=t(),n=v4(),Ly=B3(),y4=Q0(),Z3=$3();function jy(_){if(TK(_)){if(CK(_),xK(_)){Sy(_);return}}IK(_,()=>(0,kK.topBoolOrEmptySchema)(_))}mK.validateFunctionCode=jy;function IK({gen:_,validateName:z,schema:A,schemaEnv:b,opts:G},J){if(G.code.es5)_.func(z,h._`${n.default.data}, ${n.default.valCxt}`,b.$async,()=>{_.code(h._`"use strict"; ${RK(A,G)}`),Py(_,G),_.code(J)});else _.func(z,h._`${n.default.data}, ${Ry(G)}`,b.$async,()=>_.code(RK(A,G)).code(J))}function Ry(_){return h._`{${n.default.instancePath}="", ${n.default.parentData}, ${n.default.parentDataProperty}, ${n.default.rootData}=${n.default.data}${_.dynamicRef?h._`, ${n.default.dynamicAnchors}={}`:h.nil}}={}`}function Py(_,z){_.if(n.default.valCxt,()=>{if(_.var(n.default.instancePath,h._`${n.default.valCxt}.${n.default.instancePath}`),_.var(n.default.parentData,h._`${n.default.valCxt}.${n.default.parentData}`),_.var(n.default.parentDataProperty,h._`${n.default.valCxt}.${n.default.parentDataProperty}`),_.var(n.default.rootData,h._`${n.default.valCxt}.${n.default.rootData}`),z.dynamicRef)_.var(n.default.dynamicAnchors,h._`${n.default.valCxt}.${n.default.dynamicAnchors}`)},()=>{if(_.var(n.default.instancePath,h._`""`),_.var(n.default.parentData,h._`undefined`),_.var(n.default.parentDataProperty,h._`undefined`),_.var(n.default.rootData,n.default.data),z.dynamicRef)_.var(n.default.dynamicAnchors,h._`{}`)})}function Sy(_){let{schema:z,opts:A,gen:b}=_;IK(_,()=>{if(A.$comment&&z.$comment)yK(_);if(Cy(_),b.let(n.default.vErrors,null),b.let(n.default.errors,0),A.unevaluated)ky(_);vK(_),gy(_)});return}function ky(_){let{gen:z,validateName:A}=_;_.evaluated=z.const("evaluated",h._`${A}.evaluated`),z.if(h._`${_.evaluated}.dynamicProps`,()=>z.assign(h._`${_.evaluated}.props`,h._`undefined`)),z.if(h._`${_.evaluated}.dynamicItems`,()=>z.assign(h._`${_.evaluated}.items`,h._`undefined`))}function RK(_,z){let A=typeof _=="object"&&_[z.schemaId];return A&&(z.code.source||z.code.process)?h._`/*# sourceURL=${A} */`:h.nil}function Iy(_,z){if(TK(_)){if(CK(_),xK(_)){xy(_,z);return}}(0,kK.boolOrEmptySchema)(_,z)}function xK({schema:_,self:z}){if(typeof _=="boolean")return!_;for(let A in _)if(z.RULES.all[A])return!0;return!1}function TK(_){return typeof _.schema!="boolean"}function xy(_,z){let{schema:A,gen:b,opts:G}=_;if(G.$comment&&A.$comment)yK(_);vy(_),yy(_);let J=b.const("_errs",n.default.errors);vK(_,J),b.var(z,h._`${J} === ${n.default.errors}`)}function CK(_){(0,y4.checkUnknownRules)(_),Ty(_)}function vK(_,z){if(_.opts.jtd)return PK(_,[],!1,z);let A=(0,jK.getSchemaTypes)(_.schema),b=(0,jK.coerceAndCheckDataType)(_,A);PK(_,A,!b,z)}function Ty(_){let{schema:z,errSchemaPath:A,opts:b,self:G}=_;if(z.$ref&&b.ignoreKeywordsWithRef&&(0,y4.schemaHasRulesButRef)(z,G.RULES))G.logger.warn(`$ref: keywords ignored in schema at path "${A}"`)}function Cy(_){let{schema:z,opts:A}=_;if(z.default!==void 0&&A.useDefaults&&A.strictSchema)(0,y4.checkStrictMode)(_,"default is ignored in the schema root")}function vy(_){let z=_.schema[_.opts.schemaId];if(z)_.baseId=(0,Ly.resolveUrl)(_.opts.uriResolver,_.baseId,z)}function yy(_){if(_.schema.$async&&!_.schemaEnv.$async)throw Error("async schema in sync schema")}function yK({gen:_,schemaEnv:z,schema:A,errSchemaPath:b,opts:G}){let J=A.$comment;if(G.$comment===!0)_.code(h._`${n.default.self}.logger.log(${J})`);else if(typeof G.$comment=="function"){let Y=h.str`${b}/$comment`,X=_.scopeValue("root",{ref:z.root});_.code(h._`${n.default.self}.opts.$comment(${J}, ${Y}, ${X}.schema)`)}}function gy(_){let{gen:z,schemaEnv:A,validateName:b,ValidationError:G,opts:J}=_;if(A.$async)z.if(h._`${n.default.errors} === 0`,()=>z.return(n.default.data),()=>z.throw(h._`new ${G}(${n.default.vErrors})`));else{if(z.assign(h._`${b}.errors`,n.default.vErrors),J.unevaluated)fy(_);z.return(h._`${n.default.errors} === 0`)}}function fy({gen:_,evaluated:z,props:A,items:b}){if(A instanceof h.Name)_.assign(h._`${z}.props`,A);if(b instanceof h.Name)_.assign(h._`${z}.items`,b)}function PK(_,z,A,b){let{gen:G,schema:J,data:Y,allErrors:X,opts:Q,self:$}=_,{RULES:H}=$;if(J.$ref&&(Q.ignoreKeywordsWithRef||!(0,y4.schemaHasRulesButRef)(J,H))){G.block(()=>fK(_,"$ref",H.all.$ref.definition));return}if(!Q.jtd)hy(_,z);G.block(()=>{for(let Z of H.rules)B(Z);B(H.post)});function B(Z){if(!(0,u7.shouldUseGroup)(J,Z))return;if(Z.type){if(G.if((0,IA.checkDataType)(Z.type,Y,Q.strictNumbers)),SK(_,Z),z.length===1&&z[0]===Z.type&&A)G.else(),(0,IA.reportTypeError)(_);G.endIf()}else SK(_,Z);if(!X)G.if(h._`${n.default.errors} === ${b||0}`)}}function SK(_,z){let{gen:A,schema:b,opts:{useDefaults:G}}=_;if(G)(0,Oy.assignDefaults)(_,z.type);A.block(()=>{for(let J of z.rules)if((0,u7.shouldUseRule)(b,J))fK(_,J.keyword,J.definition,z.type)})}function hy(_,z){if(_.schemaEnv.meta||!_.opts.strictTypes)return;if(my(_,z),!_.opts.allowUnionTypes)uy(_,z);cy(_,_.dataTypes)}function my(_,z){if(!z.length)return;if(!_.dataTypes.length){_.dataTypes=z;return}z.forEach((A)=>{if(!gK(_.dataTypes,A))c7(_,`type "${A}" not allowed by context "${_.dataTypes.join(",")}"`)}),py(_,z)}function uy(_,z){if(z.length>1&&!(z.length===2&&z.includes("null")))c7(_,"use allowUnionTypes to allow union type keyword")}function cy(_,z){let A=_.self.RULES.all;for(let b in A){let G=A[b];if(typeof G=="object"&&(0,u7.shouldUseRule)(_.schema,G)){let{type:J}=G.definition;if(J.length&&!J.some((Y)=>ly(z,Y)))c7(_,`missing type "${J.join(",")}" for keyword "${b}"`)}}}function ly(_,z){return _.includes(z)||z==="number"&&_.includes("integer")}function gK(_,z){return _.includes(z)||z==="integer"&&_.includes("number")}function py(_,z){let A=[];for(let b of _.dataTypes)if(gK(z,b))A.push(b);else if(z.includes("integer")&&b==="number")A.push("integer");_.dataTypes=A}function c7(_,z){let A=_.schemaEnv.baseId+_.errSchemaPath;z+=` at "${A}" (strictTypes)`,(0,y4.checkStrictMode)(_,z,_.opts.strictTypes)}class l7{constructor(_,z,A){if((0,F3.validateKeywordUsage)(_,z,A),this.gen=_.gen,this.allErrors=_.allErrors,this.keyword=A,this.data=_.data,this.schema=_.schema[A],this.$data=z.$data&&_.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,y4.schemaRefOrVal)(_,this.schema,A,this.$data),this.schemaType=z.schemaType,this.parentSchema=_.schema,this.params={},this.it=_,this.def=z,this.$data)this.schemaCode=_.gen.const("vSchema",hK(this.$data,_));else if(this.schemaCode=this.schemaValue,!(0,F3.validSchemaType)(this.schema,z.schemaType,z.allowUndefined))throw Error(`${A} value must be ${JSON.stringify(z.schemaType)}`);if("code"in z?z.trackErrors:z.errors!==!1)this.errsCount=_.gen.const("_errs",n.default.errors)}result(_,z,A){this.failResult((0,h.not)(_),z,A)}failResult(_,z,A){if(this.gen.if(_),A)A();else this.error();if(z){if(this.gen.else(),z(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(_,z){this.failResult((0,h.not)(_),void 0,z)}fail(_){if(_===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(_),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(_){if(!this.$data)return this.fail(_);let{schemaCode:z}=this;this.fail(h._`${z} !== undefined && (${(0,h.or)(this.invalid$data(),_)})`)}error(_,z,A){if(z){this.setParams(z),this._error(_,A),this.setParams({});return}this._error(_,A)}_error(_,z){(_?Z3.reportExtraError:Z3.reportError)(this,this.def.error,z)}$dataError(){(0,Z3.reportError)(this,this.def.$dataError||Z3.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,Z3.resetErrorsCount)(this.gen,this.errsCount)}ok(_){if(!this.allErrors)this.gen.if(_)}setParams(_,z){if(z)Object.assign(this.params,_);else this.params=_}block$data(_,z,A=h.nil){this.gen.block(()=>{this.check$data(_,A),z()})}check$data(_=h.nil,z=h.nil){if(!this.$data)return;let{gen:A,schemaCode:b,schemaType:G,def:J}=this;if(A.if((0,h.or)(h._`${b} === undefined`,z)),_!==h.nil)A.assign(_,!0);if(G.length||J.validateSchema){if(A.elseIf(this.invalid$data()),this.$dataError(),_!==h.nil)A.assign(_,!1)}A.else()}invalid$data(){let{gen:_,schemaCode:z,schemaType:A,def:b,it:G}=this;return(0,h.or)(J(),Y());function J(){if(A.length){if(!(z instanceof h.Name))throw Error("ajv implementation error");let X=Array.isArray(A)?A:[A];return h._`${(0,IA.checkDataTypes)(X,z,G.opts.strictNumbers,IA.DataType.Wrong)}`}return h.nil}function Y(){if(b.validateSchema){let X=_.scopeValue("validate$data",{ref:b.validateSchema});return h._`!${X}(${z})`}return h.nil}}subschema(_,z){let A=(0,m7.getSubschema)(this.it,_);(0,m7.extendSubschemaData)(A,this.it,_),(0,m7.extendSubschemaMode)(A,_);let b={...this.it,...A,items:void 0,props:void 0};return Iy(b,z),b}mergeEvaluated(_,z){let{it:A,gen:b}=this;if(!A.opts.unevaluated)return;if(A.props!==!0&&_.props!==void 0)A.props=y4.mergeEvaluated.props(b,_.props,A.props,z);if(A.items!==!0&&_.items!==void 0)A.items=y4.mergeEvaluated.items(b,_.items,A.items,z)}mergeValidEvaluated(_,z){let{it:A,gen:b}=this;if(A.opts.unevaluated&&(A.props!==!0||A.items!==!0))return b.if(z,()=>this.mergeEvaluated(_,h.Name)),!0}}mK.KeywordCxt=l7;function fK(_,z,A,b){let G=new l7(_,A,z);if("code"in A)A.code(G,b);else if(G.$data&&A.validate)(0,F3.funcKeywordCode)(G,A);else if("macro"in A)(0,F3.macroKeywordCode)(G,A);else if(A.compile||A.validate)(0,F3.funcKeywordCode)(G,A)}var dy=/^\/(?:[^~]|~0|~1)*$/,ry=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function hK(_,{dataLevel:z,dataNames:A,dataPathArr:b}){let G,J;if(_==="")return n.default.rootData;if(_[0]==="/"){if(!dy.test(_))throw Error(`Invalid JSON-pointer: ${_}`);G=_,J=n.default.rootData}else{let $=ry.exec(_);if(!$)throw Error(`Invalid JSON-pointer: ${_}`);let H=+$[1];if(G=$[2],G==="#"){if(H>=z)throw Error(Q("property/index",H));return b[z-H]}if(H>z)throw Error(Q("data",H));if(J=A[z-H],!G)return J}let Y=J,X=G.split("/");for(let $ of X)if($)J=h._`${J}${(0,h.getProperty)((0,y4.unescapeJsonPointer)($))}`,Y=h._`${Y} && ${J}`;return Y;function Q($,H){return`Cannot access ${$} ${H} levels up, current level is ${z}`}}mK.getData=hK});var xA=I((lK)=>{Object.defineProperty(lK,"__esModule",{value:!0});class cK extends Error{constructor(_){super("validation failed");this.errors=_,this.ajv=this.validation=!0}}lK.default=cK});var q3=I((dK)=>{Object.defineProperty(dK,"__esModule",{value:!0});var p7=B3();class pK extends Error{constructor(_,z,A,b){super(b||`can't resolve reference ${A} from id ${z}`);this.missingRef=(0,p7.resolveUrl)(_,z,A),this.missingSchema=(0,p7.normalizeId)((0,p7.getFullPath)(_,this.missingRef))}}dK.default=pK});var CA=I((iK)=>{Object.defineProperty(iK,"__esModule",{value:!0});iK.resolveSchema=iK.getCompilingSchema=iK.resolveRef=iK.compileSchema=iK.SchemaEnv=void 0;var n9=t(),sy=xA(),g_=v4(),i9=B3(),rK=Q0(),ty=K3();class W3{constructor(_){var z;this.refs={},this.dynamicAnchors={};let A;if(typeof _.schema=="object")A=_.schema;this.schema=_.schema,this.schemaId=_.schemaId,this.root=_.root||this,this.baseId=(z=_.baseId)!==null&&z!==void 0?z:(0,i9.normalizeId)(A===null||A===void 0?void 0:A[_.schemaId||"$id"]),this.schemaPath=_.schemaPath,this.localRefs=_.localRefs,this.meta=_.meta,this.$async=A===null||A===void 0?void 0:A.$async,this.refs={}}}iK.SchemaEnv=W3;function r7(_){let z=nK.call(this,_);if(z)return z;let A=(0,i9.getFullPath)(this.opts.uriResolver,_.root.baseId),{es5:b,lines:G}=this.opts.code,{ownProperties:J}=this.opts,Y=new n9.CodeGen(this.scope,{es5:b,lines:G,ownProperties:J}),X;if(_.$async)X=Y.scopeValue("Error",{ref:sy.default,code:n9._`require("ajv/dist/runtime/validation_error").default`});let Q=Y.scopeName("validate");_.validateName=Q;let $={gen:Y,allErrors:this.opts.allErrors,data:g_.default.data,parentData:g_.default.parentData,parentDataProperty:g_.default.parentDataProperty,dataNames:[g_.default.data],dataPathArr:[n9.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:Y.scopeValue("schema",this.opts.code.source===!0?{ref:_.schema,code:(0,n9.stringify)(_.schema)}:{ref:_.schema}),validateName:Q,ValidationError:X,schema:_.schema,schemaEnv:_,rootId:A,baseId:_.baseId||A,schemaPath:n9.nil,errSchemaPath:_.schemaPath||(this.opts.jtd?"":"#"),errorPath:n9._`""`,opts:this.opts,self:this},H;try{this._compilations.add(_),(0,ty.validateFunctionCode)($),Y.optimize(this.opts.code.optimize);let B=Y.toString();if(H=`${Y.scopeRefs(g_.default.scope)}return ${B}`,this.opts.code.process)H=this.opts.code.process(H,_);let F=Function(`${g_.default.self}`,`${g_.default.scope}`,H)(this,this.scope.get());if(this.scope.value(Q,{ref:F}),F.errors=null,F.schema=_.schema,F.schemaEnv=_,_.$async)F.$async=!0;if(this.opts.code.source===!0)F.source={validateName:Q,validateCode:B,scopeValues:Y._values};if(this.opts.unevaluated){let{props:K,items:q}=$;if(F.evaluated={props:K instanceof n9.Name?void 0:K,items:q instanceof n9.Name?void 0:q,dynamicProps:K instanceof n9.Name,dynamicItems:q instanceof n9.Name},F.source)F.source.evaluated=(0,n9.stringify)(F.evaluated)}return _.validate=F,_}catch(B){if(delete _.validate,delete _.validateName,H)this.logger.error("Error compiling schema, function code:",H);throw B}finally{this._compilations.delete(_)}}iK.compileSchema=r7;function ey(_,z,A){var b;A=(0,i9.resolveUrl)(this.opts.uriResolver,z,A);let G=_.refs[A];if(G)return G;let J=Ag.call(this,_,A);if(J===void 0){let Y=(b=_.localRefs)===null||b===void 0?void 0:b[A],{schemaId:X}=this.opts;if(Y)J=new W3({schema:Y,schemaId:X,root:_,baseId:z})}if(J===void 0)return;return _.refs[A]=_g.call(this,J)}iK.resolveRef=ey;function _g(_){if((0,i9.inlineRef)(_.schema,this.opts.inlineRefs))return _.schema;return _.validate?_:r7.call(this,_)}function nK(_){for(let z of this._compilations)if(zg(z,_))return z}iK.getCompilingSchema=nK;function zg(_,z){return _.schema===z.schema&&_.root===z.root&&_.baseId===z.baseId}function Ag(_,z){let A;while(typeof(A=this.refs[z])=="string")z=A;return A||this.schemas[z]||TA.call(this,_,z)}function TA(_,z){let A=this.opts.uriResolver.parse(z),b=(0,i9._getFullPath)(this.opts.uriResolver,A),G=(0,i9.getFullPath)(this.opts.uriResolver,_.baseId,void 0);if(Object.keys(_.schema).length>0&&b===G)return d7.call(this,A,_);let J=(0,i9.normalizeId)(b),Y=this.refs[J]||this.schemas[J];if(typeof Y=="string"){let X=TA.call(this,_,Y);if(typeof(X===null||X===void 0?void 0:X.schema)!=="object")return;return d7.call(this,A,X)}if(typeof(Y===null||Y===void 0?void 0:Y.schema)!=="object")return;if(!Y.validate)r7.call(this,Y);if(J===(0,i9.normalizeId)(z)){let{schema:X}=Y,{schemaId:Q}=this.opts,$=X[Q];if($)G=(0,i9.resolveUrl)(this.opts.uriResolver,G,$);return new W3({schema:X,schemaId:Q,root:_,baseId:G})}return d7.call(this,A,Y)}iK.resolveSchema=TA;var bg=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function d7(_,{baseId:z,schema:A,root:b}){var G;if(((G=_.fragment)===null||G===void 0?void 0:G[0])!=="/")return;for(let X of _.fragment.slice(1).split("/")){if(typeof A==="boolean")return;let Q=A[(0,rK.unescapeFragment)(X)];if(Q===void 0)return;A=Q;let $=typeof A==="object"&&A[this.opts.schemaId];if(!bg.has(X)&&$)z=(0,i9.resolveUrl)(this.opts.uriResolver,z,$)}let J;if(typeof A!="boolean"&&A.$ref&&!(0,rK.schemaHasRulesButRef)(A,this.RULES)){let X=(0,i9.resolveUrl)(this.opts.uriResolver,z,A.$ref);J=TA.call(this,b,X)}let{schemaId:Y}=this.opts;if(J=J||new W3({schema:A,schemaId:Y,root:b,baseId:z}),J.schema!==J.root.schema)return J;return}});var aK=I((u30,Qg)=>{Qg.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}});var i7=I((c30,_q)=>{var $g=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),tK=RegExp.prototype.test.bind(/^(?:(?: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 n7(_){let z="",A=0,b=0;for(b=0;b<_.length;b++){if(A=_[b].charCodeAt(0),A===48)continue;if(!(A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102))return"";z+=_[b];break}for(b+=1;b<_.length;b++){if(A=_[b].charCodeAt(0),!(A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102))return"";z+=_[b]}return z}var Hg=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function sK(_){return _.length=0,!0}function Bg(_,z,A){if(_.length){let b=n7(_);if(b!=="")z.push(b);else return A.error=!0,!1;_.length=0}return!0}function Zg(_){let z=0,A={error:!1,address:"",zone:""},b=[],G=[],J=!1,Y=!1,X=Bg;for(let Q=0;Q<_.length;Q++){let $=_[Q];if($==="["||$==="]")continue;if($===":"){if(J===!0)Y=!0;if(!X(G,b,A))break;if(++z>7){A.error=!0;break}if(Q>0&&_[Q-1]===":")J=!0;b.push(":");continue}else if($==="%"){if(!X(G,b,A))break;X=sK}else{G.push($);continue}}if(G.length)if(X===sK)A.zone=G.join("");else if(Y)b.push(G.join(""));else b.push(n7(G));return A.address=b.join(""),A}function eK(_){if(Fg(_,":")<2)return{host:_,isIPV6:!1};let z=Zg(_);if(!z.error){let{address:A,address:b}=z;if(z.zone)A+="%"+z.zone,b+="%25"+z.zone;return{host:A,isIPV6:!0,escapedHost:b}}else return{host:_,isIPV6:!1}}function Fg(_,z){let A=0;for(let b=0;b<_.length;b++)if(_[b]===z)A++;return A}function Kg(_){let z=_,A=[],b=-1,G=0;while(G=z.length){if(G===1)if(z===".")break;else if(z==="/"){A.push("/");break}else{A.push(z);break}else if(G===2){if(z[0]==="."){if(z[1]===".")break;else if(z[1]==="/"){z=z.slice(2);continue}}else if(z[0]==="/"){if(z[1]==="."||z[1]==="/"){A.push("/");break}}}else if(G===3){if(z==="/.."){if(A.length!==0)A.pop();A.push("/");break}}if(z[0]==="."){if(z[1]==="."){if(z[2]==="/"){z=z.slice(3);continue}}else if(z[1]==="/"){z=z.slice(2);continue}}else if(z[0]==="/"){if(z[1]==="."){if(z[2]==="/"){z=z.slice(2);continue}else if(z[2]==="."){if(z[3]==="/"){if(z=z.slice(3),A.length!==0)A.pop();continue}}}}if((b=z.indexOf("/",1))===-1){A.push(z);break}else A.push(z.slice(0,b)),z=z.slice(b)}return A.join("")}function qg(_,z){let A=z!==!0?escape:unescape;if(_.scheme!==void 0)_.scheme=A(_.scheme);if(_.userinfo!==void 0)_.userinfo=A(_.userinfo);if(_.host!==void 0)_.host=A(_.host);if(_.path!==void 0)_.path=A(_.path);if(_.query!==void 0)_.query=A(_.query);if(_.fragment!==void 0)_.fragment=A(_.fragment);return _}function Wg(_){let z=[];if(_.userinfo!==void 0)z.push(_.userinfo),z.push("@");if(_.host!==void 0){let A=unescape(_.host);if(!tK(A)){let b=eK(A);if(b.isIPV6===!0)A=`[${b.escapedHost}]`;else A=_.host}z.push(A)}if(typeof _.port==="number"||typeof _.port==="string")z.push(":"),z.push(String(_.port));return z.length?z.join(""):void 0}_q.exports={nonSimpleDomain:Hg,recomposeAuthority:Wg,normalizeComponentEncoding:qg,removeDotSegments:Kg,isIPv4:tK,isUUID:$g,normalizeIPv6:eK,stringArrayToHexStripped:n7}});var Jq=I((l30,Gq)=>{var{isUUID:Vg}=i7(),Ug=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Dg=["http","https","ws","wss","urn","urn:uuid"];function Mg(_){return Dg.indexOf(_)!==-1}function o7(_){if(_.secure===!0)return!0;else if(_.secure===!1)return!1;else if(_.scheme)return _.scheme.length===3&&(_.scheme[0]==="w"||_.scheme[0]==="W")&&(_.scheme[1]==="s"||_.scheme[1]==="S")&&(_.scheme[2]==="s"||_.scheme[2]==="S");else return!1}function zq(_){if(!_.host)_.error=_.error||"HTTP URIs must have a host.";return _}function Aq(_){let z=String(_.scheme).toLowerCase()==="https";if(_.port===(z?443:80)||_.port==="")_.port=void 0;if(!_.path)_.path="/";return _}function Ng(_){return _.secure=o7(_),_.resourceName=(_.path||"/")+(_.query?"?"+_.query:""),_.path=void 0,_.query=void 0,_}function wg(_){if(_.port===(o7(_)?443:80)||_.port==="")_.port=void 0;if(typeof _.secure==="boolean")_.scheme=_.secure?"wss":"ws",_.secure=void 0;if(_.resourceName){let[z,A]=_.resourceName.split("?");_.path=z&&z!=="/"?z:void 0,_.query=A,_.resourceName=void 0}return _.fragment=void 0,_}function Eg(_,z){if(!_.path)return _.error="URN can not be parsed",_;let A=_.path.match(Ug);if(A){let b=z.scheme||_.scheme||"urn";_.nid=A[1].toLowerCase(),_.nss=A[2];let G=`${b}:${z.nid||_.nid}`,J=a7(G);if(_.path=void 0,J)_=J.parse(_,z)}else _.error=_.error||"URN can not be parsed.";return _}function Og(_,z){if(_.nid===void 0)throw Error("URN without nid cannot be serialized");let A=z.scheme||_.scheme||"urn",b=_.nid.toLowerCase(),G=`${A}:${z.nid||b}`,J=a7(G);if(J)_=J.serialize(_,z);let Y=_,X=_.nss;return Y.path=`${b||z.nid}:${X}`,z.skipEscape=!0,Y}function Lg(_,z){let A=_;if(A.uuid=A.nss,A.nss=void 0,!z.tolerant&&(!A.uuid||!Vg(A.uuid)))A.error=A.error||"UUID is not valid.";return A}function jg(_){let z=_;return z.nss=(_.uuid||"").toLowerCase(),z}var bq={scheme:"http",domainHost:!0,parse:zq,serialize:Aq},Rg={scheme:"https",domainHost:bq.domainHost,parse:zq,serialize:Aq},vA={scheme:"ws",domainHost:!0,parse:Ng,serialize:wg},Pg={scheme:"wss",domainHost:vA.domainHost,parse:vA.parse,serialize:vA.serialize},Sg={scheme:"urn",parse:Eg,serialize:Og,skipNormalize:!0},kg={scheme:"urn:uuid",parse:Lg,serialize:jg,skipNormalize:!0},yA={http:bq,https:Rg,ws:vA,wss:Pg,urn:Sg,"urn:uuid":kg};Object.setPrototypeOf(yA,null);function a7(_){return _&&(yA[_]||yA[_.toLowerCase()])||void 0}Gq.exports={wsIsSecure:o7,SCHEMES:yA,isValidSchemeName:Mg,getSchemeHandler:a7}});var Qq=I((p30,fA)=>{var{normalizeIPv6:Ig,removeDotSegments:V3,recomposeAuthority:xg,normalizeComponentEncoding:gA,isIPv4:Tg,nonSimpleDomain:Cg}=i7(),{SCHEMES:vg,getSchemeHandler:Yq}=Jq();function yg(_,z){if(typeof _==="string")_=F4(g4(_,z),z);else if(typeof _==="object")_=g4(F4(_,z),z);return _}function gg(_,z,A){let b=A?Object.assign({scheme:"null"},A):{scheme:"null"},G=Xq(g4(_,b),g4(z,b),b,!0);return b.skipEscape=!0,F4(G,b)}function Xq(_,z,A,b){let G={};if(!b)_=g4(F4(_,A),A),z=g4(F4(z,A),A);if(A=A||{},!A.tolerant&&z.scheme)G.scheme=z.scheme,G.userinfo=z.userinfo,G.host=z.host,G.port=z.port,G.path=V3(z.path||""),G.query=z.query;else{if(z.userinfo!==void 0||z.host!==void 0||z.port!==void 0)G.userinfo=z.userinfo,G.host=z.host,G.port=z.port,G.path=V3(z.path||""),G.query=z.query;else{if(!z.path)if(G.path=_.path,z.query!==void 0)G.query=z.query;else G.query=_.query;else{if(z.path[0]==="/")G.path=V3(z.path);else{if((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path)G.path="/"+z.path;else if(!_.path)G.path=z.path;else G.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+z.path;G.path=V3(G.path)}G.query=z.query}G.userinfo=_.userinfo,G.host=_.host,G.port=_.port}G.scheme=_.scheme}return G.fragment=z.fragment,G}function fg(_,z,A){if(typeof _==="string")_=unescape(_),_=F4(gA(g4(_,A),!0),{...A,skipEscape:!0});else if(typeof _==="object")_=F4(gA(_,!0),{...A,skipEscape:!0});if(typeof z==="string")z=unescape(z),z=F4(gA(g4(z,A),!0),{...A,skipEscape:!0});else if(typeof z==="object")z=F4(gA(z,!0),{...A,skipEscape:!0});return _.toLowerCase()===z.toLowerCase()}function F4(_,z){let A={host:_.host,scheme:_.scheme,userinfo:_.userinfo,port:_.port,path:_.path,query:_.query,nid:_.nid,nss:_.nss,uuid:_.uuid,fragment:_.fragment,reference:_.reference,resourceName:_.resourceName,secure:_.secure,error:""},b=Object.assign({},z),G=[],J=Yq(b.scheme||A.scheme);if(J&&J.serialize)J.serialize(A,b);if(A.path!==void 0)if(!b.skipEscape){if(A.path=escape(A.path),A.scheme!==void 0)A.path=A.path.split("%3A").join(":")}else A.path=unescape(A.path);if(b.reference!=="suffix"&&A.scheme)G.push(A.scheme,":");let Y=xg(A);if(Y!==void 0){if(b.reference!=="suffix")G.push("//");if(G.push(Y),A.path&&A.path[0]!=="/")G.push("/")}if(A.path!==void 0){let X=A.path;if(!b.absolutePath&&(!J||!J.absolutePath))X=V3(X);if(Y===void 0&&X[0]==="/"&&X[1]==="/")X="/%2F"+X.slice(2);G.push(X)}if(A.query!==void 0)G.push("?",A.query);if(A.fragment!==void 0)G.push("#",A.fragment);return G.join("")}var hg=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function g4(_,z){let A=Object.assign({},z),b={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},G=!1;if(A.reference==="suffix")if(A.scheme)_=A.scheme+":"+_;else _="//"+_;let J=_.match(hg);if(J){if(b.scheme=J[1],b.userinfo=J[3],b.host=J[4],b.port=parseInt(J[5],10),b.path=J[6]||"",b.query=J[7],b.fragment=J[8],isNaN(b.port))b.port=J[5];if(b.host)if(Tg(b.host)===!1){let Q=Ig(b.host);b.host=Q.host.toLowerCase(),G=Q.isIPV6}else G=!0;if(b.scheme===void 0&&b.userinfo===void 0&&b.host===void 0&&b.port===void 0&&b.query===void 0&&!b.path)b.reference="same-document";else if(b.scheme===void 0)b.reference="relative";else if(b.fragment===void 0)b.reference="absolute";else b.reference="uri";if(A.reference&&A.reference!=="suffix"&&A.reference!==b.reference)b.error=b.error||"URI is not a "+A.reference+" reference.";let Y=Yq(A.scheme||b.scheme);if(!A.unicodeSupport&&(!Y||!Y.unicodeSupport)){if(b.host&&(A.domainHost||Y&&Y.domainHost)&&G===!1&&Cg(b.host))try{b.host=URL.domainToASCII(b.host.toLowerCase())}catch(X){b.error=b.error||"Host's domain name can not be converted to ASCII: "+X}}if(!Y||Y&&!Y.skipNormalize){if(_.indexOf("%")!==-1){if(b.scheme!==void 0)b.scheme=unescape(b.scheme);if(b.host!==void 0)b.host=unescape(b.host)}if(b.path)b.path=escape(unescape(b.path));if(b.fragment)b.fragment=encodeURI(decodeURIComponent(b.fragment))}if(Y&&Y.parse)Y.parse(b,A)}else b.error=b.error||"URI can not be parsed.";return b}var s7={SCHEMES:vg,normalize:yg,resolve:gg,resolveComponent:Xq,equal:fg,serialize:F4,parse:g4};fA.exports=s7;fA.exports.default=s7;fA.exports.fastUri=s7});var Bq=I((Hq)=>{Object.defineProperty(Hq,"__esModule",{value:!0});var $q=Qq();$q.code='require("ajv/dist/runtime/uri").default';Hq.default=$q});var Dq=I((f4)=>{Object.defineProperty(f4,"__esModule",{value:!0});f4.CodeGen=f4.Name=f4.nil=f4.stringify=f4.str=f4._=f4.KeywordCxt=void 0;var ug=K3();Object.defineProperty(f4,"KeywordCxt",{enumerable:!0,get:function(){return ug.KeywordCxt}});var p1=t();Object.defineProperty(f4,"_",{enumerable:!0,get:function(){return p1._}});Object.defineProperty(f4,"str",{enumerable:!0,get:function(){return p1.str}});Object.defineProperty(f4,"stringify",{enumerable:!0,get:function(){return p1.stringify}});Object.defineProperty(f4,"nil",{enumerable:!0,get:function(){return p1.nil}});Object.defineProperty(f4,"Name",{enumerable:!0,get:function(){return p1.Name}});Object.defineProperty(f4,"CodeGen",{enumerable:!0,get:function(){return p1.CodeGen}});var cg=xA(),Wq=q3(),lg=k7(),U3=CA(),pg=t(),D3=B3(),hA=H3(),e7=Q0(),Zq=aK(),dg=Bq(),Vq=(_,z)=>new RegExp(_,z);Vq.code="new RegExp";var rg=["removeAdditional","useDefaults","coerceTypes"],ng=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),ig={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."},og={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Fq=200;function ag(_){var z,A,b,G,J,Y,X,Q,$,H,B,Z,F,K,q,W,V,w,O,M,P,D,L,R,S;let y=_.strict,e=(z=_.code)===null||z===void 0?void 0:z.optimize,u=e===!0||e===void 0?1:e||0,g=(b=(A=_.code)===null||A===void 0?void 0:A.regExp)!==null&&b!==void 0?b:Vq,m=(G=_.uriResolver)!==null&&G!==void 0?G:dg.default;return{strictSchema:(Y=(J=_.strictSchema)!==null&&J!==void 0?J:y)!==null&&Y!==void 0?Y:!0,strictNumbers:(Q=(X=_.strictNumbers)!==null&&X!==void 0?X:y)!==null&&Q!==void 0?Q:!0,strictTypes:(H=($=_.strictTypes)!==null&&$!==void 0?$:y)!==null&&H!==void 0?H:"log",strictTuples:(Z=(B=_.strictTuples)!==null&&B!==void 0?B:y)!==null&&Z!==void 0?Z:"log",strictRequired:(K=(F=_.strictRequired)!==null&&F!==void 0?F:y)!==null&&K!==void 0?K:!1,code:_.code?{..._.code,optimize:u,regExp:g}:{optimize:u,regExp:g},loopRequired:(q=_.loopRequired)!==null&&q!==void 0?q:Fq,loopEnum:(W=_.loopEnum)!==null&&W!==void 0?W:Fq,meta:(V=_.meta)!==null&&V!==void 0?V:!0,messages:(w=_.messages)!==null&&w!==void 0?w:!0,inlineRefs:(O=_.inlineRefs)!==null&&O!==void 0?O:!0,schemaId:(M=_.schemaId)!==null&&M!==void 0?M:"$id",addUsedSchema:(P=_.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(D=_.validateSchema)!==null&&D!==void 0?D:!0,validateFormats:(L=_.validateFormats)!==null&&L!==void 0?L:!0,unicodeRegExp:(R=_.unicodeRegExp)!==null&&R!==void 0?R:!0,int32range:(S=_.int32range)!==null&&S!==void 0?S:!0,uriResolver:m}}class mA{constructor(_={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,_=this.opts={..._,...ag(_)};let{es5:z,lines:A}=this.opts.code;this.scope=new pg.ValueScope({scope:{},prefixes:ng,es5:z,lines:A}),this.logger=Af(_.logger);let b=_.validateFormats;if(_.validateFormats=!1,this.RULES=(0,lg.getRules)(),Kq.call(this,ig,_,"NOT SUPPORTED"),Kq.call(this,og,_,"DEPRECATED","warn"),this._metaOpts=_f.call(this),_.formats)tg.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),_.keywords)eg.call(this,_.keywords);if(typeof _.meta=="object")this.addMetaSchema(_.meta);sg.call(this),_.validateFormats=b}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:_,meta:z,schemaId:A}=this.opts,b=Zq;if(A==="id")b={...Zq},b.id=b.$id,delete b.$id;if(z&&_)this.addMetaSchema(b,b[A],!1)}defaultMeta(){let{meta:_,schemaId:z}=this.opts;return this.opts.defaultMeta=typeof _=="object"?_[z]||_:void 0}validate(_,z){let A;if(typeof _=="string"){if(A=this.getSchema(_),!A)throw Error(`no schema with key or ref "${_}"`)}else A=this.compile(_);let b=A(z);if(!("$async"in A))this.errors=A.errors;return b}compile(_,z){let A=this._addSchema(_,z);return A.validate||this._compileSchemaEnv(A)}compileAsync(_,z){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:A}=this.opts;return b.call(this,_,z);async function b($,H){await G.call(this,$.$schema);let B=this._addSchema($,H);return B.validate||J.call(this,B)}async function G($){if($&&!this.getSchema($))await b.call(this,{$ref:$},!0)}async function J($){try{return this._compileSchemaEnv($)}catch(H){if(!(H instanceof Wq.default))throw H;return Y.call(this,H),await X.call(this,H.missingSchema),J.call(this,$)}}function Y({missingSchema:$,missingRef:H}){if(this.refs[$])throw Error(`AnySchema ${$} is loaded but ${H} cannot be resolved`)}async function X($){let H=await Q.call(this,$);if(!this.refs[$])await G.call(this,H.$schema);if(!this.refs[$])this.addSchema(H,$,z)}async function Q($){let H=this._loading[$];if(H)return H;try{return await(this._loading[$]=A($))}finally{delete this._loading[$]}}}addSchema(_,z,A,b=this.opts.validateSchema){if(Array.isArray(_)){for(let J of _)this.addSchema(J,void 0,A,b);return this}let G;if(typeof _==="object"){let{schemaId:J}=this.opts;if(G=_[J],G!==void 0&&typeof G!="string")throw Error(`schema ${J} must be string`)}return z=(0,D3.normalizeId)(z||G),this._checkUnique(z),this.schemas[z]=this._addSchema(_,A,z,b,!0),this}addMetaSchema(_,z,A=this.opts.validateSchema){return this.addSchema(_,z,!0,A),this}validateSchema(_,z){if(typeof _=="boolean")return!0;let A;if(A=_.$schema,A!==void 0&&typeof A!="string")throw Error("$schema must be a string");if(A=A||this.opts.defaultMeta||this.defaultMeta(),!A)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let b=this.validate(A,_);if(!b&&z){let G="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(G);else throw Error(G)}return b}getSchema(_){let z;while(typeof(z=qq.call(this,_))=="string")_=z;if(z===void 0){let{schemaId:A}=this.opts,b=new U3.SchemaEnv({schema:{},schemaId:A});if(z=U3.resolveSchema.call(this,b,_),!z)return;this.refs[_]=z}return z.validate||this._compileSchemaEnv(z)}removeSchema(_){if(_ instanceof RegExp)return this._removeAllSchemas(this.schemas,_),this._removeAllSchemas(this.refs,_),this;switch(typeof _){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let z=qq.call(this,_);if(typeof z=="object")this._cache.delete(z.schema);return delete this.schemas[_],delete this.refs[_],this}case"object":{let z=_;this._cache.delete(z);let A=_[this.opts.schemaId];if(A)A=(0,D3.normalizeId)(A),delete this.schemas[A],delete this.refs[A];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(_){for(let z of _)this.addKeyword(z);return this}addKeyword(_,z){let A;if(typeof _=="string"){if(A=_,typeof z=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),z.keyword=A}else if(typeof _=="object"&&z===void 0){if(z=_,A=z.keyword,Array.isArray(A)&&!A.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(Gf.call(this,A,z),!z)return(0,e7.eachItem)(A,(G)=>t7.call(this,G)),this;Yf.call(this,z);let b={...z,type:(0,hA.getJSONTypes)(z.type),schemaType:(0,hA.getJSONTypes)(z.schemaType)};return(0,e7.eachItem)(A,b.type.length===0?(G)=>t7.call(this,G,b):(G)=>b.type.forEach((J)=>t7.call(this,G,b,J))),this}getKeyword(_){let z=this.RULES.all[_];return typeof z=="object"?z.definition:!!z}removeKeyword(_){let{RULES:z}=this;delete z.keywords[_],delete z.all[_];for(let A of z.rules){let b=A.rules.findIndex((G)=>G.keyword===_);if(b>=0)A.rules.splice(b,1)}return this}addFormat(_,z){if(typeof z=="string")z=new RegExp(z);return this.formats[_]=z,this}errorsText(_=this.errors,{separator:z=", ",dataVar:A="data"}={}){if(!_||_.length===0)return"No errors";return _.map((b)=>`${A}${b.instancePath} ${b.message}`).reduce((b,G)=>b+z+G)}$dataMetaSchema(_,z){let A=this.RULES.all;_=JSON.parse(JSON.stringify(_));for(let b of z){let G=b.split("/").slice(1),J=_;for(let Y of G)J=J[Y];for(let Y in A){let X=A[Y];if(typeof X!="object")continue;let{$data:Q}=X.definition,$=J[Y];if(Q&&$)J[Y]=Uq($)}}return _}_removeAllSchemas(_,z){for(let A in _){let b=_[A];if(!z||z.test(A)){if(typeof b=="string")delete _[A];else if(b&&!b.meta)this._cache.delete(b.schema),delete _[A]}}}_addSchema(_,z,A,b=this.opts.validateSchema,G=this.opts.addUsedSchema){let J,{schemaId:Y}=this.opts;if(typeof _=="object")J=_[Y];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof _!="boolean")throw Error("schema must be object or boolean");let X=this._cache.get(_);if(X!==void 0)return X;A=(0,D3.normalizeId)(J||A);let Q=D3.getSchemaRefs.call(this,_,A);if(X=new U3.SchemaEnv({schema:_,schemaId:Y,meta:z,baseId:A,localRefs:Q}),this._cache.set(X.schema,X),G&&!A.startsWith("#")){if(A)this._checkUnique(A);this.refs[A]=X}if(b)this.validateSchema(_,!0);return X}_checkUnique(_){if(this.schemas[_]||this.refs[_])throw Error(`schema with key or id "${_}" already exists`)}_compileSchemaEnv(_){if(_.meta)this._compileMetaSchema(_);else U3.compileSchema.call(this,_);if(!_.validate)throw Error("ajv implementation error");return _.validate}_compileMetaSchema(_){let z=this.opts;this.opts=this._metaOpts;try{U3.compileSchema.call(this,_)}finally{this.opts=z}}}mA.ValidationError=cg.default;mA.MissingRefError=Wq.default;f4.default=mA;function Kq(_,z,A,b="error"){for(let G in _){let J=G;if(J in z)this.logger[b](`${A}: option ${G}. ${_[J]}`)}}function qq(_){return _=(0,D3.normalizeId)(_),this.schemas[_]||this.refs[_]}function sg(){let _=this.opts.schemas;if(!_)return;if(Array.isArray(_))this.addSchema(_);else for(let z in _)this.addSchema(_[z],z)}function tg(){for(let _ in this.opts.formats){let z=this.opts.formats[_];if(z)this.addFormat(_,z)}}function eg(_){if(Array.isArray(_)){this.addVocabulary(_);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let z in _){let A=_[z];if(!A.keyword)A.keyword=z;this.addKeyword(A)}}function _f(){let _={...this.opts};for(let z of rg)delete _[z];return _}var zf={log(){},warn(){},error(){}};function Af(_){if(_===!1)return zf;if(_===void 0)return console;if(_.log&&_.warn&&_.error)return _;throw Error("logger must implement log, warn and error methods")}var bf=/^[a-z_$][a-z0-9_$:-]*$/i;function Gf(_,z){let{RULES:A}=this;if((0,e7.eachItem)(_,(b)=>{if(A.keywords[b])throw Error(`Keyword ${b} is already defined`);if(!bf.test(b))throw Error(`Keyword ${b} has invalid name`)}),!z)return;if(z.$data&&!(("code"in z)||("validate"in z)))throw Error('$data keyword must have "code" or "validate" function')}function t7(_,z,A){var b;let G=z===null||z===void 0?void 0:z.post;if(A&&G)throw Error('keyword with "post" flag cannot have "type"');let{RULES:J}=this,Y=G?J.post:J.rules.find(({type:Q})=>Q===A);if(!Y)Y={type:A,rules:[]},J.rules.push(Y);if(J.keywords[_]=!0,!z)return;let X={keyword:_,definition:{...z,type:(0,hA.getJSONTypes)(z.type),schemaType:(0,hA.getJSONTypes)(z.schemaType)}};if(z.before)Jf.call(this,Y,X,z.before);else Y.rules.push(X);J.all[_]=X,(b=z.implements)===null||b===void 0||b.forEach((Q)=>this.addKeyword(Q))}function Jf(_,z,A){let b=_.rules.findIndex((G)=>G.keyword===A);if(b>=0)_.rules.splice(b,0,z);else _.rules.push(z),this.logger.warn(`rule ${A} is not defined`)}function Yf(_){let{metaSchema:z}=_;if(z===void 0)return;if(_.$data&&this.opts.$data)z=Uq(z);_.validateSchema=this.compile(z,!0)}var Xf={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Uq(_){return{anyOf:[_,Xf]}}});var Nq=I((Mq)=>{Object.defineProperty(Mq,"__esModule",{value:!0});var Hf={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Mq.default=Hf});var Rq=I((Lq)=>{Object.defineProperty(Lq,"__esModule",{value:!0});Lq.callRef=Lq.getValidate=void 0;var Zf=q3(),wq=R9(),Z9=t(),d1=v4(),Eq=CA(),uA=Q0(),Ff={keyword:"$ref",schemaType:"string",code(_){let{gen:z,schema:A,it:b}=_,{baseId:G,schemaEnv:J,validateName:Y,opts:X,self:Q}=b,{root:$}=J;if((A==="#"||A==="#/")&&G===$.baseId)return B();let H=Eq.resolveRef.call(Q,$,G,A);if(H===void 0)throw new Zf.default(b.opts.uriResolver,G,A);if(H instanceof Eq.SchemaEnv)return Z(H);return F(H);function B(){if(J===$)return cA(_,Y,J,J.$async);let K=z.scopeValue("root",{ref:$});return cA(_,Z9._`${K}.validate`,$,$.$async)}function Z(K){let q=Oq(_,K);cA(_,q,K,K.$async)}function F(K){let q=z.scopeValue("schema",X.code.source===!0?{ref:K,code:(0,Z9.stringify)(K)}:{ref:K}),W=z.name("valid"),V=_.subschema({schema:K,dataTypes:[],schemaPath:Z9.nil,topSchemaRef:q,errSchemaPath:A},W);_.mergeEvaluated(V),_.ok(W)}}};function Oq(_,z){let{gen:A}=_;return z.validate?A.scopeValue("validate",{ref:z.validate}):Z9._`${A.scopeValue("wrapper",{ref:z})}.validate`}Lq.getValidate=Oq;function cA(_,z,A,b){let{gen:G,it:J}=_,{allErrors:Y,schemaEnv:X,opts:Q}=J,$=Q.passContext?d1.default.this:Z9.nil;if(b)H();else B();function H(){if(!X.$async)throw Error("async schema referenced by sync schema");let K=G.let("valid");G.try(()=>{if(G.code(Z9._`await ${(0,wq.callValidateCode)(_,z,$)}`),F(z),!Y)G.assign(K,!0)},(q)=>{if(G.if(Z9._`!(${q} instanceof ${J.ValidationError})`,()=>G.throw(q)),Z(q),!Y)G.assign(K,!1)}),_.ok(K)}function B(){_.result((0,wq.callValidateCode)(_,z,$),()=>F(z),()=>Z(z))}function Z(K){let q=Z9._`${K}.errors`;G.assign(d1.default.vErrors,Z9._`${d1.default.vErrors} === null ? ${q} : ${d1.default.vErrors}.concat(${q})`),G.assign(d1.default.errors,Z9._`${d1.default.vErrors}.length`)}function F(K){var q;if(!J.opts.unevaluated)return;let W=(q=A===null||A===void 0?void 0:A.validate)===null||q===void 0?void 0:q.evaluated;if(J.props!==!0)if(W&&!W.dynamicProps){if(W.props!==void 0)J.props=uA.mergeEvaluated.props(G,W.props,J.props)}else{let V=G.var("props",Z9._`${K}.evaluated.props`);J.props=uA.mergeEvaluated.props(G,V,J.props,Z9.Name)}if(J.items!==!0)if(W&&!W.dynamicItems){if(W.items!==void 0)J.items=uA.mergeEvaluated.items(G,W.items,J.items)}else{let V=G.var("items",Z9._`${K}.evaluated.items`);J.items=uA.mergeEvaluated.items(G,V,J.items,Z9.Name)}}}Lq.callRef=cA;Lq.default=Ff});var Sq=I((Pq)=>{Object.defineProperty(Pq,"__esModule",{value:!0});var Wf=Nq(),Vf=Rq(),Uf=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Wf.default,Vf.default];Pq.default=Uf});var Iq=I((kq)=>{Object.defineProperty(kq,"__esModule",{value:!0});var lA=t(),B_=lA.operators,pA={maximum:{okStr:"<=",ok:B_.LTE,fail:B_.GT},minimum:{okStr:">=",ok:B_.GTE,fail:B_.LT},exclusiveMaximum:{okStr:"<",ok:B_.LT,fail:B_.GTE},exclusiveMinimum:{okStr:">",ok:B_.GT,fail:B_.LTE}},Mf={message:({keyword:_,schemaCode:z})=>lA.str`must be ${pA[_].okStr} ${z}`,params:({keyword:_,schemaCode:z})=>lA._`{comparison: ${pA[_].okStr}, limit: ${z}}`},Nf={keyword:Object.keys(pA),type:"number",schemaType:"number",$data:!0,error:Mf,code(_){let{keyword:z,data:A,schemaCode:b}=_;_.fail$data(lA._`${A} ${pA[z].fail} ${b} || isNaN(${A})`)}};kq.default=Nf});var Tq=I((xq)=>{Object.defineProperty(xq,"__esModule",{value:!0});var M3=t(),Ef={message:({schemaCode:_})=>M3.str`must be multiple of ${_}`,params:({schemaCode:_})=>M3._`{multipleOf: ${_}}`},Of={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Ef,code(_){let{gen:z,data:A,schemaCode:b,it:G}=_,J=G.opts.multipleOfPrecision,Y=z.let("res"),X=J?M3._`Math.abs(Math.round(${Y}) - ${Y}) > 1e-${J}`:M3._`${Y} !== parseInt(${Y})`;_.fail$data(M3._`(${b} === 0 || (${Y} = ${A}/${b}, ${X}))`)}};xq.default=Of});var yq=I((vq)=>{Object.defineProperty(vq,"__esModule",{value:!0});function Cq(_){let z=_.length,A=0,b=0,G;while(b<z)if(A++,G=_.charCodeAt(b++),G>=55296&&G<=56319&&b<z){if(G=_.charCodeAt(b),(G&64512)===56320)b++}return A}vq.default=Cq;Cq.code='require("ajv/dist/runtime/ucs2length").default'});var fq=I((gq)=>{Object.defineProperty(gq,"__esModule",{value:!0});var f_=t(),Rf=Q0(),Pf=yq(),Sf={message({keyword:_,schemaCode:z}){let A=_==="maxLength"?"more":"fewer";return f_.str`must NOT have ${A} than ${z} characters`},params:({schemaCode:_})=>f_._`{limit: ${_}}`},kf={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Sf,code(_){let{keyword:z,data:A,schemaCode:b,it:G}=_,J=z==="maxLength"?f_.operators.GT:f_.operators.LT,Y=G.opts.unicode===!1?f_._`${A}.length`:f_._`${(0,Rf.useFunc)(_.gen,Pf.default)}(${A})`;_.fail$data(f_._`${Y} ${J} ${b}`)}};gq.default=kf});var mq=I((hq)=>{Object.defineProperty(hq,"__esModule",{value:!0});var xf=R9(),dA=t(),Tf={message:({schemaCode:_})=>dA.str`must match pattern "${_}"`,params:({schemaCode:_})=>dA._`{pattern: ${_}}`},Cf={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Tf,code(_){let{data:z,$data:A,schema:b,schemaCode:G,it:J}=_,Y=J.opts.unicodeRegExp?"u":"",X=A?dA._`(new RegExp(${G}, ${Y}))`:(0,xf.usePattern)(_,b);_.fail$data(dA._`!${X}.test(${z})`)}};hq.default=Cf});var cq=I((uq)=>{Object.defineProperty(uq,"__esModule",{value:!0});var N3=t(),yf={message({keyword:_,schemaCode:z}){let A=_==="maxProperties"?"more":"fewer";return N3.str`must NOT have ${A} than ${z} properties`},params:({schemaCode:_})=>N3._`{limit: ${_}}`},gf={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:yf,code(_){let{keyword:z,data:A,schemaCode:b}=_,G=z==="maxProperties"?N3.operators.GT:N3.operators.LT;_.fail$data(N3._`Object.keys(${A}).length ${G} ${b}`)}};uq.default=gf});var pq=I((lq)=>{Object.defineProperty(lq,"__esModule",{value:!0});var w3=R9(),E3=t(),hf=Q0(),mf={message:({params:{missingProperty:_}})=>E3.str`must have required property '${_}'`,params:({params:{missingProperty:_}})=>E3._`{missingProperty: ${_}}`},uf={keyword:"required",type:"object",schemaType:"array",$data:!0,error:mf,code(_){let{gen:z,schema:A,schemaCode:b,data:G,$data:J,it:Y}=_,{opts:X}=Y;if(!J&&A.length===0)return;let Q=A.length>=X.loopRequired;if(Y.allErrors)$();else H();if(X.strictRequired){let F=_.parentSchema.properties,{definedProperties:K}=_.it;for(let q of A)if((F===null||F===void 0?void 0:F[q])===void 0&&!K.has(q)){let W=Y.schemaEnv.baseId+Y.errSchemaPath,V=`required property "${q}" is not defined at "${W}" (strictRequired)`;(0,hf.checkStrictMode)(Y,V,Y.opts.strictRequired)}}function $(){if(Q||J)_.block$data(E3.nil,B);else for(let F of A)(0,w3.checkReportMissingProp)(_,F)}function H(){let F=z.let("missing");if(Q||J){let K=z.let("valid",!0);_.block$data(K,()=>Z(F,K)),_.ok(K)}else z.if((0,w3.checkMissingProp)(_,A,F)),(0,w3.reportMissingProp)(_,F),z.else()}function B(){z.forOf("prop",b,(F)=>{_.setParams({missingProperty:F}),z.if((0,w3.noPropertyInData)(z,G,F,X.ownProperties),()=>_.error())})}function Z(F,K){_.setParams({missingProperty:F}),z.forOf(F,b,()=>{z.assign(K,(0,w3.propertyInData)(z,G,F,X.ownProperties)),z.if((0,E3.not)(K),()=>{_.error(),z.break()})},E3.nil)}}};lq.default=uf});var rq=I((dq)=>{Object.defineProperty(dq,"__esModule",{value:!0});var O3=t(),lf={message({keyword:_,schemaCode:z}){let A=_==="maxItems"?"more":"fewer";return O3.str`must NOT have ${A} than ${z} items`},params:({schemaCode:_})=>O3._`{limit: ${_}}`},pf={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:lf,code(_){let{keyword:z,data:A,schemaCode:b}=_,G=z==="maxItems"?O3.operators.GT:O3.operators.LT;_.fail$data(O3._`${A}.length ${G} ${b}`)}};dq.default=pf});var rA=I((iq)=>{Object.defineProperty(iq,"__esModule",{value:!0});var nq=f7();nq.code='require("ajv/dist/runtime/equal").default';iq.default=nq});var aq=I((oq)=>{Object.defineProperty(oq,"__esModule",{value:!0});var _b=H3(),l0=t(),nf=Q0(),of=rA(),af={message:({params:{i:_,j:z}})=>l0.str`must NOT have duplicate items (items ## ${z} and ${_} are identical)`,params:({params:{i:_,j:z}})=>l0._`{i: ${_}, j: ${z}}`},sf={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:af,code(_){let{gen:z,data:A,$data:b,schema:G,parentSchema:J,schemaCode:Y,it:X}=_;if(!b&&!G)return;let Q=z.let("valid"),$=J.items?(0,_b.getSchemaTypes)(J.items):[];_.block$data(Q,H,l0._`${Y} === false`),_.ok(Q);function H(){let K=z.let("i",l0._`${A}.length`),q=z.let("j");_.setParams({i:K,j:q}),z.assign(Q,!0),z.if(l0._`${K} > 1`,()=>(B()?Z:F)(K,q))}function B(){return $.length>0&&!$.some((K)=>K==="object"||K==="array")}function Z(K,q){let W=z.name("item"),V=(0,_b.checkDataTypes)($,W,X.opts.strictNumbers,_b.DataType.Wrong),w=z.const("indices",l0._`{}`);z.for(l0._`;${K}--;`,()=>{if(z.let(W,l0._`${A}[${K}]`),z.if(V,l0._`continue`),$.length>1)z.if(l0._`typeof ${W} == "string"`,l0._`${W} += "_"`);z.if(l0._`typeof ${w}[${W}] == "number"`,()=>{z.assign(q,l0._`${w}[${W}]`),_.error(),z.assign(Q,!1).break()}).code(l0._`${w}[${W}] = ${K}`)})}function F(K,q){let W=(0,nf.useFunc)(z,of.default),V=z.name("outer");z.label(V).for(l0._`;${K}--;`,()=>z.for(l0._`${q} = ${K}; ${q}--;`,()=>z.if(l0._`${W}(${A}[${K}], ${A}[${q}])`,()=>{_.error(),z.assign(Q,!1).break(V)})))}}};oq.default=sf});var tq=I((sq)=>{Object.defineProperty(sq,"__esModule",{value:!0});var zb=t(),ef=Q0(),_h=rA(),zh={message:"must be equal to constant",params:({schemaCode:_})=>zb._`{allowedValue: ${_}}`},Ah={keyword:"const",$data:!0,error:zh,code(_){let{gen:z,data:A,$data:b,schemaCode:G,schema:J}=_;if(b||J&&typeof J=="object")_.fail$data(zb._`!${(0,ef.useFunc)(z,_h.default)}(${A}, ${G})`);else _.fail(zb._`${J} !== ${A}`)}};sq.default=Ah});var _W=I((eq)=>{Object.defineProperty(eq,"__esModule",{value:!0});var L3=t(),Gh=Q0(),Jh=rA(),Yh={message:"must be equal to one of the allowed values",params:({schemaCode:_})=>L3._`{allowedValues: ${_}}`},Xh={keyword:"enum",schemaType:"array",$data:!0,error:Yh,code(_){let{gen:z,data:A,$data:b,schema:G,schemaCode:J,it:Y}=_;if(!b&&G.length===0)throw Error("enum must have non-empty array");let X=G.length>=Y.opts.loopEnum,Q,$=()=>Q!==null&&Q!==void 0?Q:Q=(0,Gh.useFunc)(z,Jh.default),H;if(X||b)H=z.let("valid"),_.block$data(H,B);else{if(!Array.isArray(G))throw Error("ajv implementation error");let F=z.const("vSchema",J);H=(0,L3.or)(...G.map((K,q)=>Z(F,q)))}_.pass(H);function B(){z.assign(H,!1),z.forOf("v",J,(F)=>z.if(L3._`${$()}(${A}, ${F})`,()=>z.assign(H,!0).break()))}function Z(F,K){let q=G[K];return typeof q==="object"&&q!==null?L3._`${$()}(${A}, ${F}[${K}])`:L3._`${A} === ${q}`}}};eq.default=Xh});var AW=I((zW)=>{Object.defineProperty(zW,"__esModule",{value:!0});var $h=Iq(),Hh=Tq(),Bh=fq(),Zh=mq(),Fh=cq(),Kh=pq(),qh=rq(),Wh=aq(),Vh=tq(),Uh=_W(),Dh=[$h.default,Hh.default,Bh.default,Zh.default,Fh.default,Kh.default,qh.default,Wh.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Vh.default,Uh.default];zW.default=Dh});var bb=I((GW)=>{Object.defineProperty(GW,"__esModule",{value:!0});GW.validateAdditionalItems=void 0;var h_=t(),Ab=Q0(),Nh={message:({params:{len:_}})=>h_.str`must NOT have more than ${_} items`,params:({params:{len:_}})=>h_._`{limit: ${_}}`},wh={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Nh,code(_){let{parentSchema:z,it:A}=_,{items:b}=z;if(!Array.isArray(b)){(0,Ab.checkStrictMode)(A,'"additionalItems" is ignored when "items" is not an array of schemas');return}bW(_,b)}};function bW(_,z){let{gen:A,schema:b,data:G,keyword:J,it:Y}=_;Y.items=!0;let X=A.const("len",h_._`${G}.length`);if(b===!1)_.setParams({len:z.length}),_.pass(h_._`${X} <= ${z.length}`);else if(typeof b=="object"&&!(0,Ab.alwaysValidSchema)(Y,b)){let $=A.var("valid",h_._`${X} <= ${z.length}`);A.if((0,h_.not)($),()=>Q($)),_.ok($)}function Q($){A.forRange("i",z.length,X,(H)=>{if(_.subschema({keyword:J,dataProp:H,dataPropType:Ab.Type.Num},$),!Y.allErrors)A.if((0,h_.not)($),()=>A.break())})}}GW.validateAdditionalItems=bW;GW.default=wh});var Gb=I((QW)=>{Object.defineProperty(QW,"__esModule",{value:!0});QW.validateTuple=void 0;var YW=t(),nA=Q0(),Oh=R9(),Lh={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(_){let{schema:z,it:A}=_;if(Array.isArray(z))return XW(_,"additionalItems",z);if(A.items=!0,(0,nA.alwaysValidSchema)(A,z))return;_.ok((0,Oh.validateArray)(_))}};function XW(_,z,A=_.schema){let{gen:b,parentSchema:G,data:J,keyword:Y,it:X}=_;if(H(G),X.opts.unevaluated&&A.length&&X.items!==!0)X.items=nA.mergeEvaluated.items(b,A.length,X.items);let Q=b.name("valid"),$=b.const("len",YW._`${J}.length`);A.forEach((B,Z)=>{if((0,nA.alwaysValidSchema)(X,B))return;b.if(YW._`${$} > ${Z}`,()=>_.subschema({keyword:Y,schemaProp:Z,dataProp:Z},Q)),_.ok(Q)});function H(B){let{opts:Z,errSchemaPath:F}=X,K=A.length,q=K===B.minItems&&(K===B.maxItems||B[z]===!1);if(Z.strictTuples&&!q){let W=`"${Y}" is ${K}-tuple, but minItems or maxItems/${z} are not specified or different at path "${F}"`;(0,nA.checkStrictMode)(X,W,Z.strictTuples)}}}QW.validateTuple=XW;QW.default=Lh});var BW=I((HW)=>{Object.defineProperty(HW,"__esModule",{value:!0});var Rh=Gb(),Ph={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(_)=>(0,Rh.validateTuple)(_,"items")};HW.default=Ph});var KW=I((FW)=>{Object.defineProperty(FW,"__esModule",{value:!0});var ZW=t(),kh=Q0(),Ih=R9(),xh=bb(),Th={message:({params:{len:_}})=>ZW.str`must NOT have more than ${_} items`,params:({params:{len:_}})=>ZW._`{limit: ${_}}`},Ch={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Th,code(_){let{schema:z,parentSchema:A,it:b}=_,{prefixItems:G}=A;if(b.items=!0,(0,kh.alwaysValidSchema)(b,z))return;if(G)(0,xh.validateAdditionalItems)(_,G);else _.ok((0,Ih.validateArray)(_))}};FW.default=Ch});var WW=I((qW)=>{Object.defineProperty(qW,"__esModule",{value:!0});var P9=t(),iA=Q0(),yh={message:({params:{min:_,max:z}})=>z===void 0?P9.str`must contain at least ${_} valid item(s)`:P9.str`must contain at least ${_} and no more than ${z} valid item(s)`,params:({params:{min:_,max:z}})=>z===void 0?P9._`{minContains: ${_}}`:P9._`{minContains: ${_}, maxContains: ${z}}`},gh={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:yh,code(_){let{gen:z,schema:A,parentSchema:b,data:G,it:J}=_,Y,X,{minContains:Q,maxContains:$}=b;if(J.opts.next)Y=Q===void 0?1:Q,X=$;else Y=1;let H=z.const("len",P9._`${G}.length`);if(_.setParams({min:Y,max:X}),X===void 0&&Y===0){(0,iA.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(X!==void 0&&Y>X){(0,iA.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),_.fail();return}if((0,iA.alwaysValidSchema)(J,A)){let q=P9._`${H} >= ${Y}`;if(X!==void 0)q=P9._`${q} && ${H} <= ${X}`;_.pass(q);return}J.items=!0;let B=z.name("valid");if(X===void 0&&Y===1)F(B,()=>z.if(B,()=>z.break()));else if(Y===0){if(z.let(B,!0),X!==void 0)z.if(P9._`${G}.length > 0`,Z)}else z.let(B,!1),Z();_.result(B,()=>_.reset());function Z(){let q=z.name("_valid"),W=z.let("count",0);F(q,()=>z.if(q,()=>K(W)))}function F(q,W){z.forRange("i",0,H,(V)=>{_.subschema({keyword:"contains",dataProp:V,dataPropType:iA.Type.Num,compositeRule:!0},q),W()})}function K(q){if(z.code(P9._`${q}++`),X===void 0)z.if(P9._`${q} >= ${Y}`,()=>z.assign(B,!0).break());else if(z.if(P9._`${q} > ${X}`,()=>z.assign(B,!1).break()),Y===1)z.assign(B,!0);else z.if(P9._`${q} >= ${Y}`,()=>z.assign(B,!0))}}};qW.default=gh});var wW=I((DW)=>{Object.defineProperty(DW,"__esModule",{value:!0});DW.validateSchemaDeps=DW.validatePropertyDeps=DW.error=void 0;var Jb=t(),hh=Q0(),j3=R9();DW.error={message:({params:{property:_,depsCount:z,deps:A}})=>{let b=z===1?"property":"properties";return Jb.str`must have ${b} ${A} when property ${_} is present`},params:({params:{property:_,depsCount:z,deps:A,missingProperty:b}})=>Jb._`{property: ${_},
32
- missingProperty: ${b},
24
+ `),this.outputHelp({error:!0});let A=z||{},G=A.exitCode||1,J=A.code||"commander.error";this._exit(G,J,_)}_parseOptionsEnv(){this.options.forEach((_)=>{if(_.envVar&&_.envVar in $0.env){let z=_.attributeName();if(this.getOptionValue(z)===void 0||["default","config","env"].includes(this.getOptionValueSource(z)))if(_.required||_.optional)this.emit(`optionEnv:${_.name()}`,$0.env[_.envVar]);else this.emit(`optionEnv:${_.name()}`)}})}_parseOptionsImplied(){let _=new oU(this.options),z=(A)=>{return this.getOptionValue(A)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(A))};this.options.filter((A)=>A.implied!==void 0&&z(A.attributeName())&&_.valueFromOption(this.getOptionValue(A.attributeName()),A)).forEach((A)=>{Object.keys(A.implied).filter((G)=>!z(G)).forEach((G)=>{this.setOptionValueWithSource(G,A.implied[G],"implied")})})}missingArgument(_){let z=`error: missing required argument '${_}'`;this.error(z,{code:"commander.missingArgument"})}optionMissingArgument(_){let z=`error: option '${_.flags}' argument missing`;this.error(z,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(_){let z=`error: required option '${_.flags}' not specified`;this.error(z,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(_,z){let A=(Y)=>{let X=Y.attributeName(),b=this.getOptionValue(X),Q=this.options.find((H)=>H.negate&&X===H.attributeName()),$=this.options.find((H)=>!H.negate&&X===H.attributeName());if(Q&&(Q.presetArg===void 0&&b===!1||Q.presetArg!==void 0&&b===Q.presetArg))return Q;return $||Y},G=(Y)=>{let X=A(Y),b=X.attributeName();if(this.getOptionValueSource(b)==="env")return`environment variable '${X.envVar}'`;return`option '${X.flags}'`},J=`error: ${G(_)} cannot be used with ${G(z)}`;this.error(J,{code:"commander.conflictingOption"})}unknownOption(_){if(this._allowUnknownOption)return;let z="";if(_.startsWith("--")&&this._showSuggestionAfterError){let G=[],J=this;do{let Y=J.createHelp().visibleOptions(J).filter((X)=>X.long).map((X)=>X.long);G=G.concat(Y),J=J.parent}while(J&&!J._enablePositionalOptions);z=tG(_,G)}let A=`error: unknown option '${_}'${z}`;this.error(A,{code:"commander.unknownOption"})}_excessArguments(_){if(this._allowExcessArguments)return;let z=this.registeredArguments.length,A=z===1?"":"s",J=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${z} argument${A} but got ${_.length}.`;this.error(J,{code:"commander.excessArguments"})}unknownCommand(){let _=this.args[0],z="";if(this._showSuggestionAfterError){let G=[];this.createHelp().visibleCommands(this).forEach((J)=>{if(G.push(J.name()),J.alias())G.push(J.alias())}),z=tG(_,G)}let A=`error: unknown command '${_}'${z}`;this.error(A,{code:"commander.unknownCommand"})}version(_,z,A){if(_===void 0)return this._version;this._version=_,z=z||"-V, --version",A=A||"output the version number";let G=this.createOption(z,A);return this._versionOptionName=G.attributeName(),this._registerOption(G),this.on("option:"+G.name(),()=>{this._outputConfiguration.writeOut(`${_}
25
+ `),this._exit(0,"commander.version",_)}),this}description(_,z){if(_===void 0&&z===void 0)return this._description;if(this._description=_,z)this._argsDescription=z;return this}summary(_){if(_===void 0)return this._summary;return this._summary=_,this}alias(_){if(_===void 0)return this._aliases[0];let z=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)z=this.commands[this.commands.length-1];if(_===z._name)throw Error("Command alias can't be the same as its name");let A=this.parent?._findCommand(_);if(A){let G=[A.name()].concat(A.aliases()).join("|");throw Error(`cannot add alias '${_}' to command '${this.name()}' as already have command '${G}'`)}return z._aliases.push(_),this}aliases(_){if(_===void 0)return this._aliases;return _.forEach((z)=>this.alias(z)),this}usage(_){if(_===void 0){if(this._usage)return this._usage;let z=this.registeredArguments.map((A)=>{return rU(A)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?z:[]).join(" ")}return this._usage=_,this}name(_){if(_===void 0)return this._name;return this._name=_,this}helpGroup(_){if(_===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=_,this}commandsGroup(_){if(_===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=_,this}optionsGroup(_){if(_===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=_,this}_initOptionGroup(_){if(this._defaultOptionGroup&&!_.helpGroupHeading)_.helpGroup(this._defaultOptionGroup)}_initCommandGroup(_){if(this._defaultCommandGroup&&!_.helpGroup())_.helpGroup(this._defaultCommandGroup)}nameFromFilename(_){return this._name=V4.basename(_,V4.extname(_)),this}executableDir(_){if(_===void 0)return this._executableDir;return this._executableDir=_,this}helpInformation(_){let z=this.createHelp(),A=this._getOutputContext(_);z.prepareContext({error:A.error,helpWidth:A.helpWidth,outputHasColors:A.hasColors});let G=z.formatHelp(this,z);if(A.hasColors)return G;return this._outputConfiguration.stripColor(G)}_getOutputContext(_){_=_||{};let z=!!_.error,A,G,J;if(z)A=(X)=>this._outputConfiguration.writeErr(X),G=this._outputConfiguration.getErrHasColors(),J=this._outputConfiguration.getErrHelpWidth();else A=(X)=>this._outputConfiguration.writeOut(X),G=this._outputConfiguration.getOutHasColors(),J=this._outputConfiguration.getOutHelpWidth();return{error:z,write:(X)=>{if(!G)X=this._outputConfiguration.stripColor(X);return A(X)},hasColors:G,helpWidth:J}}outputHelp(_){let z;if(typeof _==="function")z=_,_=void 0;let A=this._getOutputContext(_),G={error:A.error,write:A.write,command:this};this._getCommandAndAncestors().reverse().forEach((Y)=>Y.emit("beforeAllHelp",G)),this.emit("beforeHelp",G);let J=this.helpInformation({error:A.error});if(z){if(J=z(J),typeof J!=="string"&&!Buffer.isBuffer(J))throw Error("outputHelp callback must return a string or a Buffer")}if(A.write(J),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",G),this._getCommandAndAncestors().forEach((Y)=>Y.emit("afterAllHelp",G))}helpOption(_,z){if(typeof _==="boolean"){if(_){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(_??"-h, --help",z??"display help for command"),_||z)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(_){return this._helpOption=_,this._initOptionGroup(_),this}help(_){this.outputHelp(_);let z=Number($0.exitCode??0);if(z===0&&_&&typeof _!=="function"&&_.error)z=1;this._exit(z,"commander.help","(outputHelp)")}addHelpText(_,z){let A=["beforeAll","before","after","afterAll"];if(!A.includes(_))throw Error(`Unexpected value for position to addHelpText.
26
+ Expecting one of '${A.join("', '")}'`);let G=`${_}Help`;return this.on(G,(J)=>{let Y;if(typeof z==="function")Y=z({error:J.error,command:J.command});else Y=z;if(Y)J.write(`${Y}
27
+ `)}),this}_outputHelpIfRequested(_){let z=this._getHelpOption();if(z&&_.find((G)=>z.is(G)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function eG(_){return _.map((z)=>{if(!z.startsWith("--inspect"))return z;let A,G="127.0.0.1",J="9229",Y;if((Y=z.match(/^(--inspect(-brk)?)$/))!==null)A=Y[1];else if((Y=z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(A=Y[1],/^\d+$/.test(Y[3]))J=Y[3];else G=Y[3];else if((Y=z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)A=Y[1],G=Y[3],J=Y[4];if(A&&J!=="0")return`${A}=${G}:${parseInt(J)+1}`;return z})}function DA(){if($0.env.NO_COLOR||$0.env.FORCE_COLOR==="0"||$0.env.FORCE_COLOR==="false")return!1;if($0.env.FORCE_COLOR||$0.env.CLICOLOR_FORCE!==void 0)return!0;return}aU.Command=MA;aU.useColor=DA});var JJ=x((zD)=>{var{Argument:zJ}=v3(),{Command:NA}=_J(),{CommanderError:eU,InvalidArgumentError:AJ}=Az(),{Help:_D}=KA(),{Option:GJ}=WA();zD.program=new NA;zD.createCommand=(_)=>new NA(_);zD.createOption=(_,z)=>new GJ(_,z);zD.createArgument=(_,z)=>new zJ(_,z);zD.Command=NA;zD.Option=GJ;zD.Argument=zJ;zD.Help=_D;zD.CommanderError=eU;zD.InvalidArgumentError=AJ;zD.InvalidOptionArgumentError=AJ});var cY=x((mY)=>{Object.defineProperty(mY,"__esModule",{value:!0});mY.toBig=mY.shrSL=mY.shrSH=mY.rotrSL=mY.rotrSH=mY.rotrBL=mY.rotrBH=mY.rotr32L=mY.rotr32H=mY.rotlSL=mY.rotlSH=mY.rotlBL=mY.rotlBH=mY.add5L=mY.add5H=mY.add4L=mY.add4H=mY.add3L=mY.add3H=void 0;mY.add=TY;mY.fromBig=G5;mY.split=DY;var z6=BigInt(4294967295),A5=BigInt(32);function G5(_,z=!1){if(z)return{h:Number(_&z6),l:Number(_>>A5&z6)};return{h:Number(_>>A5&z6)|0,l:Number(_&z6)|0}}function DY(_,z=!1){let A=_.length,G=new Uint32Array(A),J=new Uint32Array(A);for(let Y=0;Y<A;Y++){let{h:X,l:b}=G5(_[Y],z);[G[Y],J[Y]]=[X,b]}return[G,J]}var MY=(_,z)=>BigInt(_>>>0)<<A5|BigInt(z>>>0);mY.toBig=MY;var NY=(_,z,A)=>_>>>A;mY.shrSH=NY;var EY=(_,z,A)=>_<<32-A|z>>>A;mY.shrSL=EY;var wY=(_,z,A)=>_>>>A|z<<32-A;mY.rotrSH=wY;var OY=(_,z,A)=>_<<32-A|z>>>A;mY.rotrSL=OY;var LY=(_,z,A)=>_<<64-A|z>>>A-32;mY.rotrBH=LY;var jY=(_,z,A)=>_>>>A-32|z<<64-A;mY.rotrBL=jY;var RY=(_,z)=>z;mY.rotr32H=RY;var PY=(_,z)=>_;mY.rotr32L=PY;var SY=(_,z,A)=>_<<A|z>>>32-A;mY.rotlSH=SY;var kY=(_,z,A)=>z<<A|_>>>32-A;mY.rotlSL=kY;var IY=(_,z,A)=>z<<A-32|_>>>64-A;mY.rotlBH=IY;var xY=(_,z,A)=>_<<A-32|z>>>64-A;mY.rotlBL=xY;function TY(_,z,A,G){let J=(z>>>0)+(G>>>0);return{h:_+A+(J/4294967296|0)|0,l:J|0}}var CY=(_,z,A)=>(_>>>0)+(z>>>0)+(A>>>0);mY.add3L=CY;var vY=(_,z,A,G)=>z+A+G+(_/4294967296|0)|0;mY.add3H=vY;var yY=(_,z,A,G)=>(_>>>0)+(z>>>0)+(A>>>0)+(G>>>0);mY.add4L=yY;var gY=(_,z,A,G,J)=>z+A+G+J+(_/4294967296|0)|0;mY.add4H=gY;var fY=(_,z,A,G,J)=>(_>>>0)+(z>>>0)+(A>>>0)+(G>>>0)+(J>>>0);mY.add5L=fY;var hY=(_,z,A,G,J,Y)=>z+A+G+J+Y+(_/4294967296|0)|0;mY.add5H=hY;var GN={fromBig:G5,split:DY,toBig:MY,shrSH:NY,shrSL:EY,rotrSH:wY,rotrSL:OY,rotrBH:LY,rotrBL:jY,rotr32H:RY,rotr32L:PY,rotlSH:SY,rotlSL:kY,rotlBH:IY,rotlBL:xY,add:TY,add3L:CY,add3H:vY,add4L:yY,add4H:gY,add5H:hY,add5L:fY};mY.default=GN});var dY=x((lY)=>{Object.defineProperty(lY,"__esModule",{value:!0});lY.crypto=void 0;var i4=W4("node:crypto");lY.crypto=i4&&typeof i4==="object"&&"webcrypto"in i4?i4.webcrypto:i4&&typeof i4==="object"&&("randomBytes"in i4)?i4:void 0});var JX=x((_X)=>{/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(_X,"__esModule",{value:!0});_X.wrapXOFConstructorWithOpts=_X.wrapConstructorWithOpts=_X.wrapConstructor=_X.Hash=_X.nextTick=_X.swap32IfBE=_X.byteSwapIfBE=_X.swap8IfBE=_X.isLE=void 0;_X.isBytes=nY;_X.anumber=J5;_X.abytes=z1;_X.ahash=jN;_X.aexists=RN;_X.aoutput=PN;_X.u8=SN;_X.u32=kN;_X.clean=IN;_X.createView=xN;_X.rotr=TN;_X.rotl=CN;_X.byteSwap=Y5;_X.byteSwap32=iY;_X.bytesToHex=yN;_X.hexToBytes=gN;_X.asyncLoop=hN;_X.utf8ToBytes=X5;_X.bytesToUtf8=mN;_X.toBytes=A6;_X.kdfInputToBytes=uN;_X.concatBytes=cN;_X.checkOpts=lN;_X.createHasher=sY;_X.createOptHasher=tY;_X.createXOFer=eY;_X.randomBytes=pN;var _1=dY();function nY(_){return _ instanceof Uint8Array||ArrayBuffer.isView(_)&&_.constructor.name==="Uint8Array"}function J5(_){if(!Number.isSafeInteger(_)||_<0)throw Error("positive integer expected, got "+_)}function z1(_,...z){if(!nY(_))throw Error("Uint8Array expected");if(z.length>0&&!z.includes(_.length))throw Error("Uint8Array expected of length "+z+", got length="+_.length)}function jN(_){if(typeof _!=="function"||typeof _.create!=="function")throw Error("Hash should be wrapped by utils.createHasher");J5(_.outputLen),J5(_.blockLen)}function RN(_,z=!0){if(_.destroyed)throw Error("Hash instance has been destroyed");if(z&&_.finished)throw Error("Hash#digest() has already been called")}function PN(_,z){z1(_);let A=z.outputLen;if(_.length<A)throw Error("digestInto() expects output buffer of length at least "+A)}function SN(_){return new Uint8Array(_.buffer,_.byteOffset,_.byteLength)}function kN(_){return new Uint32Array(_.buffer,_.byteOffset,Math.floor(_.byteLength/4))}function IN(..._){for(let z=0;z<_.length;z++)_[z].fill(0)}function xN(_){return new DataView(_.buffer,_.byteOffset,_.byteLength)}function TN(_,z){return _<<32-z|_>>>z}function CN(_,z){return _<<z|_>>>32-z>>>0}_X.isLE=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function Y5(_){return _<<24&4278190080|_<<8&16711680|_>>>8&65280|_>>>24&255}_X.swap8IfBE=_X.isLE?(_)=>_:(_)=>Y5(_);_X.byteSwapIfBE=_X.swap8IfBE;function iY(_){for(let z=0;z<_.length;z++)_[z]=Y5(_[z]);return _}_X.swap32IfBE=_X.isLE?(_)=>_:iY;var oY=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),vN=Array.from({length:256},(_,z)=>z.toString(16).padStart(2,"0"));function yN(_){if(z1(_),oY)return _.toHex();let z="";for(let A=0;A<_.length;A++)z+=vN[_[A]];return z}var D4={_0:48,_9:57,A:65,F:70,a:97,f:102};function rY(_){if(_>=D4._0&&_<=D4._9)return _-D4._0;if(_>=D4.A&&_<=D4.F)return _-(D4.A-10);if(_>=D4.a&&_<=D4.f)return _-(D4.a-10);return}function gN(_){if(typeof _!=="string")throw Error("hex string expected, got "+typeof _);if(oY)return Uint8Array.fromHex(_);let z=_.length,A=z/2;if(z%2)throw Error("hex string expected, got unpadded hex of length "+z);let G=new Uint8Array(A);for(let J=0,Y=0;J<A;J++,Y+=2){let X=rY(_.charCodeAt(Y)),b=rY(_.charCodeAt(Y+1));if(X===void 0||b===void 0){let Q=_[Y]+_[Y+1];throw Error('hex string expected, got non-hex character "'+Q+'" at index '+Y)}G[J]=X*16+b}return G}var fN=async()=>{};_X.nextTick=fN;async function hN(_,z,A){let G=Date.now();for(let J=0;J<_;J++){A(J);let Y=Date.now()-G;if(Y>=0&&Y<z)continue;await _X.nextTick(),G+=Y}}function X5(_){if(typeof _!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(_))}function mN(_){return new TextDecoder().decode(_)}function A6(_){if(typeof _==="string")_=X5(_);return z1(_),_}function uN(_){if(typeof _==="string")_=X5(_);return z1(_),_}function cN(..._){let z=0;for(let G=0;G<_.length;G++){let J=_[G];z1(J),z+=J.length}let A=new Uint8Array(z);for(let G=0,J=0;G<_.length;G++){let Y=_[G];A.set(Y,J),J+=Y.length}return A}function lN(_,z){if(z!==void 0&&{}.toString.call(z)!=="[object Object]")throw Error("options should be object or undefined");return Object.assign(_,z)}class aY{}_X.Hash=aY;function sY(_){let z=(G)=>_().update(A6(G)).digest(),A=_();return z.outputLen=A.outputLen,z.blockLen=A.blockLen,z.create=()=>_(),z}function tY(_){let z=(G,J)=>_(J).update(A6(G)).digest(),A=_({});return z.outputLen=A.outputLen,z.blockLen=A.blockLen,z.create=(G)=>_(G),z}function eY(_){let z=(G,J)=>_(J).update(A6(G)).digest(),A=_({});return z.outputLen=A.outputLen,z.blockLen=A.blockLen,z.create=(G)=>_(G),z}_X.wrapConstructor=sY;_X.wrapConstructorWithOpts=tY;_X.wrapXOFConstructorWithOpts=eY;function pN(_=32){if(_1.crypto&&typeof _1.crypto.getRandomValues==="function")return _1.crypto.getRandomValues(new Uint8Array(_));if(_1.crypto&&typeof _1.crypto.randomBytes==="function")return Uint8Array.from(_1.crypto.randomBytes(_));throw Error("crypto.getRandomValues must be defined")}});var KX=x((qX)=>{Object.defineProperty(qX,"__esModule",{value:!0});qX.shake256=qX.shake128=qX.keccak_512=qX.keccak_384=qX.keccak_256=qX.keccak_224=qX.sha3_512=qX.sha3_384=qX.sha3_256=qX.sha3_224=qX.Keccak=void 0;qX.keccakP=BX;var qz=cY(),o0=JX(),wE=BigInt(0),Zz=BigInt(1),OE=BigInt(2),LE=BigInt(7),jE=BigInt(256),RE=BigInt(113),bX=[],QX=[],$X=[];for(let _=0,z=Zz,A=1,G=0;_<24;_++){[A,G]=[G,(2*A+3*G)%5],bX.push(2*(5*G+A)),QX.push((_+1)*(_+2)/2%64);let J=wE;for(let Y=0;Y<7;Y++)if(z=(z<<Zz^(z>>LE)*RE)%jE,z&OE)J^=Zz<<(Zz<<BigInt(Y))-Zz;$X.push(J)}var HX=(0,qz.split)($X,!0),PE=HX[0],SE=HX[1],YX=(_,z,A)=>A>32?(0,qz.rotlBH)(_,z,A):(0,qz.rotlSH)(_,z,A),XX=(_,z,A)=>A>32?(0,qz.rotlBL)(_,z,A):(0,qz.rotlSL)(_,z,A);function BX(_,z=24){let A=new Uint32Array(10);for(let G=24-z;G<24;G++){for(let X=0;X<10;X++)A[X]=_[X]^_[X+10]^_[X+20]^_[X+30]^_[X+40];for(let X=0;X<10;X+=2){let b=(X+8)%10,Q=(X+2)%10,$=A[Q],H=A[Q+1],B=YX($,H,1)^A[b],Z=XX($,H,1)^A[b+1];for(let q=0;q<50;q+=10)_[X+q]^=B,_[X+q+1]^=Z}let J=_[2],Y=_[3];for(let X=0;X<24;X++){let b=QX[X],Q=YX(J,Y,b),$=XX(J,Y,b),H=bX[X];J=_[H],Y=_[H+1],_[H]=Q,_[H+1]=$}for(let X=0;X<50;X+=10){for(let b=0;b<10;b++)A[b]=_[X+b];for(let b=0;b<10;b++)_[X+b]^=~A[(b+2)%10]&A[(b+4)%10]}_[0]^=PE[G],_[1]^=SE[G]}(0,o0.clean)(A)}class Fz extends o0.Hash{constructor(_,z,A,G=!1,J=24){super();if(this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=_,this.suffix=z,this.outputLen=A,this.enableXOF=G,this.rounds=J,(0,o0.anumber)(A),!(0<_&&_<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,o0.u32)(this.state)}clone(){return this._cloneInto()}keccak(){(0,o0.swap32IfBE)(this.state32),BX(this.state32,this.rounds),(0,o0.swap32IfBE)(this.state32),this.posOut=0,this.pos=0}update(_){(0,o0.aexists)(this),_=(0,o0.toBytes)(_),(0,o0.abytes)(_);let{blockLen:z,state:A}=this,G=_.length;for(let J=0;J<G;){let Y=Math.min(z-this.pos,G-J);for(let X=0;X<Y;X++)A[this.pos++]^=_[J++];if(this.pos===z)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:_,suffix:z,pos:A,blockLen:G}=this;if(_[A]^=z,(z&128)!==0&&A===G-1)this.keccak();_[G-1]^=128,this.keccak()}writeInto(_){(0,o0.aexists)(this,!1),(0,o0.abytes)(_),this.finish();let z=this.state,{blockLen:A}=this;for(let G=0,J=_.length;G<J;){if(this.posOut>=A)this.keccak();let Y=Math.min(A-this.posOut,J-G);_.set(z.subarray(this.posOut,this.posOut+Y),G),this.posOut+=Y,G+=Y}return _}xofInto(_){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(_)}xof(_){return(0,o0.anumber)(_),this.xofInto(new Uint8Array(_))}digestInto(_){if((0,o0.aoutput)(_,this),this.finished)throw Error("digest() was already called");return this.writeInto(_),this.destroy(),_}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,o0.clean)(this.state)}_cloneInto(_){let{blockLen:z,suffix:A,outputLen:G,rounds:J,enableXOF:Y}=this;return _||(_=new Fz(z,A,G,Y,J)),_.state32.set(this.state32),_.pos=this.pos,_.posOut=this.posOut,_.finished=this.finished,_.rounds=J,_.suffix=A,_.outputLen=G,_.enableXOF=Y,_.destroyed=this.destroyed,_}}qX.Keccak=Fz;var o4=(_,z,A)=>(0,o0.createHasher)(()=>new Fz(z,_,A));qX.sha3_224=(()=>o4(6,144,28))();qX.sha3_256=(()=>o4(6,136,32))();qX.sha3_384=(()=>o4(6,104,48))();qX.sha3_512=(()=>o4(6,72,64))();qX.keccak_224=(()=>o4(1,144,28))();qX.keccak_256=(()=>o4(1,136,32))();qX.keccak_384=(()=>o4(1,104,48))();qX.keccak_512=(()=>o4(1,72,64))();var ZX=(_,z,A)=>(0,o0.createXOFer)((G={})=>new Fz(z,_,G.dkLen===void 0?A:G.dkLen,!0));qX.shake128=(()=>ZX(31,168,16))();qX.shake256=(()=>ZX(31,136,32))()});var EX=x((rE,a4)=>{var{sha3_512:uE}=KX(),Q5=(_=4,z=Math.random)=>{let A="";while(A.length<_)A=A+Math.floor(z()*36).toString(36);return A};function VX(_){let z=8n,A=0n;for(let G of _.values()){let J=BigInt(G);A=(A<<z)+J}return A}var UX=(_="")=>{return VX(uE(_)).toString(36).slice(1)},WX=Array.from({length:26},(_,z)=>String.fromCharCode(z+97)),cE=(_)=>WX[Math.floor(_()*WX.length)],DX=({globalObj:_=typeof global<"u"?global:typeof window<"u"?window:{},random:z=Math.random}={})=>{let A=Object.keys(_).toString(),G=A.length?A+Q5(32,z):Q5(32,z);return UX(G).substring(0,32)},MX=(_)=>()=>{return _++},lE=476782367,NX=({random:_=Math.random,counter:z=MX(Math.floor(_()*lE)),length:A=24,fingerprint:G=DX({random:_})}={})=>{return function(){let Y=cE(_),X=Date.now().toString(36),b=z().toString(36),Q=Q5(A,_),$=`${X+Q+b+G}`;return`${Y+UX($).substring(1,A)}`}},pE=NX(),dE=(_,{minLength:z=2,maxLength:A=32}={})=>{let G=_.length,J=/^[0-9a-z]+$/;try{if(typeof _==="string"&&G>=z&&G<=A&&J.test(_))return!0}finally{}return!1};rE.getConstants=()=>({defaultLength:24,bigLength:32});rE.init=NX;rE.createId=pE;rE.bufToBigInt=VX;rE.createCounter=MX;rE.createFingerprint=DX;rE.isCuid=dE});var q3=x((Tq)=>{Object.defineProperty(Tq,"__esModule",{value:!0});Tq.regexpCode=Tq.getEsmExportName=Tq.getProperty=Tq.safeStringify=Tq.stringify=Tq.strConcat=Tq.addCodeArg=Tq.str=Tq._=Tq.nil=Tq._Code=Tq.Name=Tq.IDENTIFIER=Tq._CodeOrName=void 0;class j8{}Tq._CodeOrName=j8;Tq.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class d1 extends j8{constructor(_){super();if(!Tq.IDENTIFIER.test(_))throw Error("CodeGen: name must be a valid identifier");this.str=_}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}Tq.Name=d1;class i9 extends j8{constructor(_){super();this._items=typeof _==="string"?[_]:_}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let _=this._items[0];return _===""||_==='""'}get str(){var _;return(_=this._str)!==null&&_!==void 0?_:this._str=this._items.reduce((z,A)=>`${z}${A}`,"")}get names(){var _;return(_=this._names)!==null&&_!==void 0?_:this._names=this._items.reduce((z,A)=>{if(A instanceof d1)z[A.str]=(z[A.str]||0)+1;return z},{})}}Tq._Code=i9;Tq.nil=new i9("");function Iq(_,...z){let A=[_[0]],G=0;while(G<z.length)x7(A,z[G]),A.push(_[++G]);return new i9(A)}Tq._=Iq;var I7=new i9("+");function xq(_,...z){let A=[Z3(_[0])],G=0;while(G<z.length)A.push(I7),x7(A,z[G]),A.push(I7,Z3(_[++G]));return mC(A),new i9(A)}Tq.str=xq;function x7(_,z){if(z instanceof i9)_.push(...z._items);else if(z instanceof d1)_.push(z);else _.push(lC(z))}Tq.addCodeArg=x7;function mC(_){let z=1;while(z<_.length-1){if(_[z]===I7){let A=uC(_[z-1],_[z+1]);if(A!==void 0){_.splice(z-1,3,A);continue}_[z++]="+"}z++}}function uC(_,z){if(z==='""')return _;if(_==='""')return z;if(typeof _=="string"){if(z instanceof d1||_[_.length-1]!=='"')return;if(typeof z!="string")return`${_.slice(0,-1)}${z}"`;if(z[0]==='"')return _.slice(0,-1)+z.slice(1);return}if(typeof z=="string"&&z[0]==='"'&&!(_ instanceof d1))return`"${_}${z.slice(1)}`;return}function cC(_,z){return z.emptyStr()?_:_.emptyStr()?z:xq`${_}${z}`}Tq.strConcat=cC;function lC(_){return typeof _=="number"||typeof _=="boolean"||_===null?_:Z3(Array.isArray(_)?_.join(","):_)}function pC(_){return new i9(Z3(_))}Tq.stringify=pC;function Z3(_){return JSON.stringify(_).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Tq.safeStringify=Z3;function dC(_){return typeof _=="string"&&Tq.IDENTIFIER.test(_)?new i9(`.${_}`):Iq`[${_}]`}Tq.getProperty=dC;function rC(_){if(typeof _=="string"&&Tq.IDENTIFIER.test(_))return new i9(`${_}`);throw Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`)}Tq.getEsmExportName=rC;function nC(_){return new i9(_.toString())}Tq.regexpCode=nC});var y7=x((gq)=>{Object.defineProperty(gq,"__esModule",{value:!0});gq.ValueScope=gq.ValueScopeName=gq.Scope=gq.varKinds=gq.UsedValueState=void 0;var q9=q3();class vq extends Error{constructor(_){super(`CodeGen: "code" for ${_} not defined`);this.value=_.value}}var P8;(function(_){_[_.Started=0]="Started",_[_.Completed=1]="Completed"})(P8||(gq.UsedValueState=P8={}));gq.varKinds={const:new q9.Name("const"),let:new q9.Name("let"),var:new q9.Name("var")};class C7{constructor({prefixes:_,parent:z}={}){this._names={},this._prefixes=_,this._parent=z}toName(_){return _ instanceof q9.Name?_:this.name(_)}name(_){return new q9.Name(this._newName(_))}_newName(_){let z=this._names[_]||this._nameGroup(_);return`${_}${z.index++}`}_nameGroup(_){var z,A;if(((A=(z=this._parent)===null||z===void 0?void 0:z._prefixes)===null||A===void 0?void 0:A.has(_))||this._prefixes&&!this._prefixes.has(_))throw Error(`CodeGen: prefix "${_}" is not allowed in this scope`);return this._names[_]={prefix:_,index:0}}}gq.Scope=C7;class v7 extends q9.Name{constructor(_,z){super(z);this.prefix=_}setValue(_,{property:z,itemIndex:A}){this.value=_,this.scopePath=q9._`.${new q9.Name(z)}[${A}]`}}gq.ValueScopeName=v7;var Xv=q9._`\n`;class yq extends C7{constructor(_){super(_);this._values={},this._scope=_.scope,this.opts={..._,_n:_.lines?Xv:q9.nil}}get(){return this._scope}name(_){return new v7(_,this._newName(_))}value(_,z){var A;if(z.ref===void 0)throw Error("CodeGen: ref must be passed in value");let G=this.toName(_),{prefix:J}=G,Y=(A=z.key)!==null&&A!==void 0?A:z.ref,X=this._values[J];if(X){let $=X.get(Y);if($)return $}else X=this._values[J]=new Map;X.set(Y,G);let b=this._scope[J]||(this._scope[J]=[]),Q=b.length;return b[Q]=z.ref,G.setValue(z,{property:J,itemIndex:Q}),G}getValue(_,z){let A=this._values[_];if(!A)return;return A.get(z)}scopeRefs(_,z=this._values){return this._reduceValues(z,(A)=>{if(A.scopePath===void 0)throw Error(`CodeGen: name "${A}" has no value`);return q9._`${_}${A.scopePath}`})}scopeCode(_=this._values,z,A){return this._reduceValues(_,(G)=>{if(G.value===void 0)throw Error(`CodeGen: name "${G}" has no value`);return G.value.code},z,A)}_reduceValues(_,z,A={},G){let J=q9.nil;for(let Y in _){let X=_[Y];if(!X)continue;let b=A[Y]=A[Y]||new Map;X.forEach((Q)=>{if(b.has(Q))return;b.set(Q,P8.Started);let $=z(Q);if($){let H=this.opts.es5?gq.varKinds.var:gq.varKinds.const;J=q9._`${J}${H} ${Q} = ${$};${this.opts._n}`}else if($=G===null||G===void 0?void 0:G(Q))J=q9._`${J}${$}${this.opts._n}`;else throw new vq(Q);b.set(Q,P8.Completed)})}return J}}gq.ValueScope=yq});var e=x((F9)=>{Object.defineProperty(F9,"__esModule",{value:!0});F9.or=F9.and=F9.not=F9.CodeGen=F9.operators=F9.varKinds=F9.ValueScopeName=F9.ValueScope=F9.Scope=F9.Name=F9.regexpCode=F9.stringify=F9.getProperty=F9.nil=F9.strConcat=F9.str=F9._=void 0;var Y0=q3(),o9=y7(),U_=q3();Object.defineProperty(F9,"_",{enumerable:!0,get:function(){return U_._}});Object.defineProperty(F9,"str",{enumerable:!0,get:function(){return U_.str}});Object.defineProperty(F9,"strConcat",{enumerable:!0,get:function(){return U_.strConcat}});Object.defineProperty(F9,"nil",{enumerable:!0,get:function(){return U_.nil}});Object.defineProperty(F9,"getProperty",{enumerable:!0,get:function(){return U_.getProperty}});Object.defineProperty(F9,"stringify",{enumerable:!0,get:function(){return U_.stringify}});Object.defineProperty(F9,"regexpCode",{enumerable:!0,get:function(){return U_.regexpCode}});Object.defineProperty(F9,"Name",{enumerable:!0,get:function(){return U_.Name}});var C8=y7();Object.defineProperty(F9,"Scope",{enumerable:!0,get:function(){return C8.Scope}});Object.defineProperty(F9,"ValueScope",{enumerable:!0,get:function(){return C8.ValueScope}});Object.defineProperty(F9,"ValueScopeName",{enumerable:!0,get:function(){return C8.ValueScopeName}});Object.defineProperty(F9,"varKinds",{enumerable:!0,get:function(){return C8.varKinds}});F9.operators={GT:new Y0._Code(">"),GTE:new Y0._Code(">="),LT:new Y0._Code("<"),LTE:new Y0._Code("<="),EQ:new Y0._Code("==="),NEQ:new Y0._Code("!=="),NOT:new Y0._Code("!"),OR:new Y0._Code("||"),AND:new Y0._Code("&&"),ADD:new Y0._Code("+")};class D_{optimizeNodes(){return this}optimizeNames(_,z){return this}}class hq extends D_{constructor(_,z,A){super();this.varKind=_,this.name=z,this.rhs=A}render({es5:_,_n:z}){let A=_?o9.varKinds.var:this.varKind,G=this.rhs===void 0?"":` = ${this.rhs}`;return`${A} ${this.name}${G};`+z}optimizeNames(_,z){if(!_[this.name.str])return;if(this.rhs)this.rhs=n1(this.rhs,_,z);return this}get names(){return this.rhs instanceof Y0._CodeOrName?this.rhs.names:{}}}class h7 extends D_{constructor(_,z,A){super();this.lhs=_,this.rhs=z,this.sideEffects=A}render({_n:_}){return`${this.lhs} = ${this.rhs};`+_}optimizeNames(_,z){if(this.lhs instanceof Y0.Name&&!_[this.lhs.str]&&!this.sideEffects)return;return this.rhs=n1(this.rhs,_,z),this}get names(){let _=this.lhs instanceof Y0.Name?{}:{...this.lhs.names};return T8(_,this.rhs)}}class mq extends h7{constructor(_,z,A,G){super(_,A,G);this.op=z}render({_n:_}){return`${this.lhs} ${this.op}= ${this.rhs};`+_}}class uq extends D_{constructor(_){super();this.label=_,this.names={}}render({_n:_}){return`${this.label}:`+_}}class cq extends D_{constructor(_){super();this.label=_,this.names={}}render({_n:_}){return`break${this.label?` ${this.label}`:""};`+_}}class lq extends D_{constructor(_){super();this.error=_}render({_n:_}){return`throw ${this.error};`+_}get names(){return this.error.names}}class pq extends D_{constructor(_){super();this.code=_}render({_n:_}){return`${this.code};`+_}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(_,z){return this.code=n1(this.code,_,z),this}get names(){return this.code instanceof Y0._CodeOrName?this.code.names:{}}}class v8 extends D_{constructor(_=[]){super();this.nodes=_}render(_){return this.nodes.reduce((z,A)=>z+A.render(_),"")}optimizeNodes(){let{nodes:_}=this,z=_.length;while(z--){let A=_[z].optimizeNodes();if(Array.isArray(A))_.splice(z,1,...A);else if(A)_[z]=A;else _.splice(z,1)}return _.length>0?this:void 0}optimizeNames(_,z){let{nodes:A}=this,G=A.length;while(G--){let J=A[G];if(J.optimizeNames(_,z))continue;Hv(_,J.names),A.splice(G,1)}return A.length>0?this:void 0}get names(){return this.nodes.reduce((_,z)=>p_(_,z.names),{})}}class M_ extends v8{render(_){return"{"+_._n+super.render(_)+"}"+_._n}}class dq extends v8{}class F3 extends M_{}F3.kind="else";class u4 extends M_{constructor(_,z){super(z);this.condition=_}render(_){let z=`if(${this.condition})`+super.render(_);if(this.else)z+="else "+this.else.render(_);return z}optimizeNodes(){super.optimizeNodes();let _=this.condition;if(_===!0)return this.nodes;let z=this.else;if(z){let A=z.optimizeNodes();z=this.else=Array.isArray(A)?new F3(A):A}if(z){if(_===!1)return z instanceof u4?z:z.nodes;if(this.nodes.length)return this;return new u4(aq(_),z instanceof u4?[z]:z.nodes)}if(_===!1||!this.nodes.length)return;return this}optimizeNames(_,z){var A;if(this.else=(A=this.else)===null||A===void 0?void 0:A.optimizeNames(_,z),!(super.optimizeNames(_,z)||this.else))return;return this.condition=n1(this.condition,_,z),this}get names(){let _=super.names;if(T8(_,this.condition),this.else)p_(_,this.else.names);return _}}u4.kind="if";class r1 extends M_{}r1.kind="for";class rq extends r1{constructor(_){super();this.iteration=_}render(_){return`for(${this.iteration})`+super.render(_)}optimizeNames(_,z){if(!super.optimizeNames(_,z))return;return this.iteration=n1(this.iteration,_,z),this}get names(){return p_(super.names,this.iteration.names)}}class nq extends r1{constructor(_,z,A,G){super();this.varKind=_,this.name=z,this.from=A,this.to=G}render(_){let z=_.es5?o9.varKinds.var:this.varKind,{name:A,from:G,to:J}=this;return`for(${z} ${A}=${G}; ${A}<${J}; ${A}++)`+super.render(_)}get names(){let _=T8(super.names,this.from);return T8(_,this.to)}}class g7 extends r1{constructor(_,z,A,G){super();this.loop=_,this.varKind=z,this.name=A,this.iterable=G}render(_){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(_)}optimizeNames(_,z){if(!super.optimizeNames(_,z))return;return this.iterable=n1(this.iterable,_,z),this}get names(){return p_(super.names,this.iterable.names)}}class S8 extends M_{constructor(_,z,A){super();this.name=_,this.args=z,this.async=A}render(_){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(_)}}S8.kind="func";class k8 extends v8{render(_){return"return "+super.render(_)}}k8.kind="return";class iq extends M_{render(_){let z="try"+super.render(_);if(this.catch)z+=this.catch.render(_);if(this.finally)z+=this.finally.render(_);return z}optimizeNodes(){var _,z;return super.optimizeNodes(),(_=this.catch)===null||_===void 0||_.optimizeNodes(),(z=this.finally)===null||z===void 0||z.optimizeNodes(),this}optimizeNames(_,z){var A,G;return super.optimizeNames(_,z),(A=this.catch)===null||A===void 0||A.optimizeNames(_,z),(G=this.finally)===null||G===void 0||G.optimizeNames(_,z),this}get names(){let _=super.names;if(this.catch)p_(_,this.catch.names);if(this.finally)p_(_,this.finally.names);return _}}class I8 extends M_{constructor(_){super();this.error=_}render(_){return`catch(${this.error})`+super.render(_)}}I8.kind="catch";class x8 extends M_{render(_){return"finally"+super.render(_)}}x8.kind="finally";class oq{constructor(_,z={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...z,_n:z.lines?`
28
+ `:""},this._extScope=_,this._scope=new o9.Scope({parent:_}),this._nodes=[new dq]}toString(){return this._root.render(this.opts)}name(_){return this._scope.name(_)}scopeName(_){return this._extScope.name(_)}scopeValue(_,z){let A=this._extScope.value(_,z);return(this._values[A.prefix]||(this._values[A.prefix]=new Set)).add(A),A}getScopeValue(_,z){return this._extScope.getValue(_,z)}scopeRefs(_){return this._extScope.scopeRefs(_,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(_,z,A,G){let J=this._scope.toName(z);if(A!==void 0&&G)this._constants[J.str]=A;return this._leafNode(new hq(_,J,A)),J}const(_,z,A){return this._def(o9.varKinds.const,_,z,A)}let(_,z,A){return this._def(o9.varKinds.let,_,z,A)}var(_,z,A){return this._def(o9.varKinds.var,_,z,A)}assign(_,z,A){return this._leafNode(new h7(_,z,A))}add(_,z){return this._leafNode(new mq(_,F9.operators.ADD,z))}code(_){if(typeof _=="function")_();else if(_!==Y0.nil)this._leafNode(new pq(_));return this}object(..._){let z=["{"];for(let[A,G]of _){if(z.length>1)z.push(",");if(z.push(A),A!==G||this.opts.es5)z.push(":"),(0,Y0.addCodeArg)(z,G)}return z.push("}"),new Y0._Code(z)}if(_,z,A){if(this._blockNode(new u4(_)),z&&A)this.code(z).else().code(A).endIf();else if(z)this.code(z).endIf();else if(A)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(_){return this._elseNode(new u4(_))}else(){return this._elseNode(new F3)}endIf(){return this._endBlockNode(u4,F3)}_for(_,z){if(this._blockNode(_),z)this.code(z).endFor();return this}for(_,z){return this._for(new rq(_),z)}forRange(_,z,A,G,J=this.opts.es5?o9.varKinds.var:o9.varKinds.let){let Y=this._scope.toName(_);return this._for(new nq(J,Y,z,A),()=>G(Y))}forOf(_,z,A,G=o9.varKinds.const){let J=this._scope.toName(_);if(this.opts.es5){let Y=z instanceof Y0.Name?z:this.var("_arr",z);return this.forRange("_i",0,Y0._`${Y}.length`,(X)=>{this.var(J,Y0._`${Y}[${X}]`),A(J)})}return this._for(new g7("of",G,J,z),()=>A(J))}forIn(_,z,A,G=this.opts.es5?o9.varKinds.var:o9.varKinds.const){if(this.opts.ownProperties)return this.forOf(_,Y0._`Object.keys(${z})`,A);let J=this._scope.toName(_);return this._for(new g7("in",G,J,z),()=>A(J))}endFor(){return this._endBlockNode(r1)}label(_){return this._leafNode(new uq(_))}break(_){return this._leafNode(new cq(_))}return(_){let z=new k8;if(this._blockNode(z),this.code(_),z.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(k8)}try(_,z,A){if(!z&&!A)throw Error('CodeGen: "try" without "catch" and "finally"');let G=new iq;if(this._blockNode(G),this.code(_),z){let J=this.name("e");this._currNode=G.catch=new I8(J),z(J)}if(A)this._currNode=G.finally=new x8,this.code(A);return this._endBlockNode(I8,x8)}throw(_){return this._leafNode(new lq(_))}block(_,z){if(this._blockStarts.push(this._nodes.length),_)this.code(_).endBlock(z);return this}endBlock(_){let z=this._blockStarts.pop();if(z===void 0)throw Error("CodeGen: not in self-balancing block");let A=this._nodes.length-z;if(A<0||_!==void 0&&A!==_)throw Error(`CodeGen: wrong number of nodes: ${A} vs ${_} expected`);return this._nodes.length=z,this}func(_,z=Y0.nil,A,G){if(this._blockNode(new S8(_,z,A)),G)this.code(G).endFunc();return this}endFunc(){return this._endBlockNode(S8)}optimize(_=1){while(_-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(_){return this._currNode.nodes.push(_),this}_blockNode(_){this._currNode.nodes.push(_),this._nodes.push(_)}_endBlockNode(_,z){let A=this._currNode;if(A instanceof _||z&&A instanceof z)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${z?`${_.kind}/${z.kind}`:_.kind}"`)}_elseNode(_){let z=this._currNode;if(!(z instanceof u4))throw Error('CodeGen: "else" without "if"');return this._currNode=z.else=_,this}get _root(){return this._nodes[0]}get _currNode(){let _=this._nodes;return _[_.length-1]}set _currNode(_){let z=this._nodes;z[z.length-1]=_}}F9.CodeGen=oq;function p_(_,z){for(let A in z)_[A]=(_[A]||0)+(z[A]||0);return _}function T8(_,z){return z instanceof Y0._CodeOrName?p_(_,z.names):_}function n1(_,z,A){if(_ instanceof Y0.Name)return G(_);if(!J(_))return _;return new Y0._Code(_._items.reduce((Y,X)=>{if(X instanceof Y0.Name)X=G(X);if(X instanceof Y0._Code)Y.push(...X._items);else Y.push(X);return Y},[]));function G(Y){let X=A[Y.str];if(X===void 0||z[Y.str]!==1)return Y;return delete z[Y.str],X}function J(Y){return Y instanceof Y0._Code&&Y._items.some((X)=>X instanceof Y0.Name&&z[X.str]===1&&A[X.str]!==void 0)}}function Hv(_,z){for(let A in z)_[A]=(_[A]||0)-(z[A]||0)}function aq(_){return typeof _=="boolean"||typeof _=="number"||_===null?!_:Y0._`!${f7(_)}`}F9.not=aq;var Bv=sq(F9.operators.AND);function Zv(..._){return _.reduce(Bv)}F9.and=Zv;var qv=sq(F9.operators.OR);function Fv(..._){return _.reduce(qv)}F9.or=Fv;function sq(_){return(z,A)=>z===Y0.nil?A:A===Y0.nil?z:Y0._`${f7(z)} ${_} ${f7(A)}`}function f7(_){return _ instanceof Y0.Name?_:Y0._`(${_})`}});var Q0=x((XF)=>{Object.defineProperty(XF,"__esModule",{value:!0});XF.checkStrictMode=XF.getErrorPath=XF.Type=XF.useFunc=XF.setEvaluated=XF.evaluatedPropsToName=XF.mergeEvaluated=XF.eachItem=XF.unescapeJsonPointer=XF.escapeJsonPointer=XF.escapeFragment=XF.unescapeFragment=XF.schemaRefOrVal=XF.schemaHasRulesButRef=XF.schemaHasRules=XF.checkUnknownRules=XF.alwaysValidSchema=XF.toHash=void 0;var V0=e(),Uv=q3();function Dv(_){let z={};for(let A of _)z[A]=!0;return z}XF.toHash=Dv;function Mv(_,z){if(typeof z=="boolean")return z;if(Object.keys(z).length===0)return!0;return zF(_,z),!AF(z,_.self.RULES.all)}XF.alwaysValidSchema=Mv;function zF(_,z=_.schema){let{opts:A,self:G}=_;if(!A.strictSchema)return;if(typeof z==="boolean")return;let J=G.RULES.keywords;for(let Y in z)if(!J[Y])YF(_,`unknown keyword: "${Y}"`)}XF.checkUnknownRules=zF;function AF(_,z){if(typeof _=="boolean")return!_;for(let A in _)if(z[A])return!0;return!1}XF.schemaHasRules=AF;function Nv(_,z){if(typeof _=="boolean")return!_;for(let A in _)if(A!=="$ref"&&z.all[A])return!0;return!1}XF.schemaHasRulesButRef=Nv;function Ev({topSchemaRef:_,schemaPath:z},A,G,J){if(!J){if(typeof A=="number"||typeof A=="boolean")return A;if(typeof A=="string")return V0._`${A}`}return V0._`${_}${z}${(0,V0.getProperty)(G)}`}XF.schemaRefOrVal=Ev;function wv(_){return GF(decodeURIComponent(_))}XF.unescapeFragment=wv;function Ov(_){return encodeURIComponent(u7(_))}XF.escapeFragment=Ov;function u7(_){if(typeof _=="number")return`${_}`;return _.replace(/~/g,"~0").replace(/\//g,"~1")}XF.escapeJsonPointer=u7;function GF(_){return _.replace(/~1/g,"/").replace(/~0/g,"~")}XF.unescapeJsonPointer=GF;function Lv(_,z){if(Array.isArray(_))for(let A of _)z(A);else z(_)}XF.eachItem=Lv;function eq({mergeNames:_,mergeToName:z,mergeValues:A,resultToName:G}){return(J,Y,X,b)=>{let Q=X===void 0?Y:X instanceof V0.Name?(Y instanceof V0.Name?_(J,Y,X):z(J,Y,X),X):Y instanceof V0.Name?(z(J,X,Y),Y):A(Y,X);return b===V0.Name&&!(Q instanceof V0.Name)?G(J,Q):Q}}XF.mergeEvaluated={props:eq({mergeNames:(_,z,A)=>_.if(V0._`${A} !== true && ${z} !== undefined`,()=>{_.if(V0._`${z} === true`,()=>_.assign(A,!0),()=>_.assign(A,V0._`${A} || {}`).code(V0._`Object.assign(${A}, ${z})`))}),mergeToName:(_,z,A)=>_.if(V0._`${A} !== true`,()=>{if(z===!0)_.assign(A,!0);else _.assign(A,V0._`${A} || {}`),c7(_,A,z)}),mergeValues:(_,z)=>_===!0?!0:{..._,...z},resultToName:JF}),items:eq({mergeNames:(_,z,A)=>_.if(V0._`${A} !== true && ${z} !== undefined`,()=>_.assign(A,V0._`${z} === true ? true : ${A} > ${z} ? ${A} : ${z}`)),mergeToName:(_,z,A)=>_.if(V0._`${A} !== true`,()=>_.assign(A,z===!0?!0:V0._`${A} > ${z} ? ${A} : ${z}`)),mergeValues:(_,z)=>_===!0?!0:Math.max(_,z),resultToName:(_,z)=>_.var("items",z)})};function JF(_,z){if(z===!0)return _.var("props",!0);let A=_.var("props",V0._`{}`);if(z!==void 0)c7(_,A,z);return A}XF.evaluatedPropsToName=JF;function c7(_,z,A){Object.keys(A).forEach((G)=>_.assign(V0._`${z}${(0,V0.getProperty)(G)}`,!0))}XF.setEvaluated=c7;var _F={};function jv(_,z){return _.scopeValue("func",{ref:z,code:_F[z.code]||(_F[z.code]=new Uv._Code(z.code))})}XF.useFunc=jv;var m7;(function(_){_[_.Num=0]="Num",_[_.Str=1]="Str"})(m7||(XF.Type=m7={}));function Rv(_,z,A){if(_ instanceof V0.Name){let G=z===m7.Num;return A?G?V0._`"[" + ${_} + "]"`:V0._`"['" + ${_} + "']"`:G?V0._`"/" + ${_}`:V0._`"/" + ${_}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return A?(0,V0.getProperty)(_).toString():"/"+u7(_)}XF.getErrorPath=Rv;function YF(_,z,A=_.opts.strictSchema){if(!A)return;if(z=`strict mode: ${z}`,A===!0)throw Error(z);_.self.logger.warn(z)}XF.checkStrictMode=YF});var c4=x((QF)=>{Object.defineProperty(QF,"__esModule",{value:!0});var e0=e(),dv={data:new e0.Name("data"),valCxt:new e0.Name("valCxt"),instancePath:new e0.Name("instancePath"),parentData:new e0.Name("parentData"),parentDataProperty:new e0.Name("parentDataProperty"),rootData:new e0.Name("rootData"),dynamicAnchors:new e0.Name("dynamicAnchors"),vErrors:new e0.Name("vErrors"),errors:new e0.Name("errors"),this:new e0.Name("this"),self:new e0.Name("self"),scope:new e0.Name("scope"),json:new e0.Name("json"),jsonPos:new e0.Name("jsonPos"),jsonLen:new e0.Name("jsonLen"),jsonPart:new e0.Name("jsonPart")};QF.default=dv});var K3=x((ZF)=>{Object.defineProperty(ZF,"__esModule",{value:!0});ZF.extendErrors=ZF.resetErrorsCount=ZF.reportExtraError=ZF.reportError=ZF.keyword$DataError=ZF.keywordError=void 0;var X0=e(),g8=Q0(),Y9=c4();ZF.keywordError={message:({keyword:_})=>X0.str`must pass "${_}" keyword validation`};ZF.keyword$DataError={message:({keyword:_,schemaType:z})=>z?X0.str`"${_}" keyword must be ${z} ($data)`:X0.str`"${_}" keyword is invalid ($data)`};function nv(_,z=ZF.keywordError,A,G){let{it:J}=_,{gen:Y,compositeRule:X,allErrors:b}=J,Q=BF(_,z,A);if(G!==null&&G!==void 0?G:X||b)$F(Y,Q);else HF(J,X0._`[${Q}]`)}ZF.reportError=nv;function iv(_,z=ZF.keywordError,A){let{it:G}=_,{gen:J,compositeRule:Y,allErrors:X}=G,b=BF(_,z,A);if($F(J,b),!(Y||X))HF(G,Y9.default.vErrors)}ZF.reportExtraError=iv;function ov(_,z){_.assign(Y9.default.errors,z),_.if(X0._`${Y9.default.vErrors} !== null`,()=>_.if(z,()=>_.assign(X0._`${Y9.default.vErrors}.length`,z),()=>_.assign(Y9.default.vErrors,null)))}ZF.resetErrorsCount=ov;function av({gen:_,keyword:z,schemaValue:A,data:G,errsCount:J,it:Y}){if(J===void 0)throw Error("ajv implementation error");let X=_.name("err");_.forRange("i",J,Y9.default.errors,(b)=>{if(_.const(X,X0._`${Y9.default.vErrors}[${b}]`),_.if(X0._`${X}.instancePath === undefined`,()=>_.assign(X0._`${X}.instancePath`,(0,X0.strConcat)(Y9.default.instancePath,Y.errorPath))),_.assign(X0._`${X}.schemaPath`,X0.str`${Y.errSchemaPath}/${z}`),Y.opts.verbose)_.assign(X0._`${X}.schema`,A),_.assign(X0._`${X}.data`,G)})}ZF.extendErrors=av;function $F(_,z){let A=_.const("err",z);_.if(X0._`${Y9.default.vErrors} === null`,()=>_.assign(Y9.default.vErrors,X0._`[${A}]`),X0._`${Y9.default.vErrors}.push(${A})`),_.code(X0._`${Y9.default.errors}++`)}function HF(_,z){let{gen:A,validateName:G,schemaEnv:J}=_;if(J.$async)A.throw(X0._`new ${_.ValidationError}(${z})`);else A.assign(X0._`${G}.errors`,z),A.return(!1)}var d_={keyword:new X0.Name("keyword"),schemaPath:new X0.Name("schemaPath"),params:new X0.Name("params"),propertyName:new X0.Name("propertyName"),message:new X0.Name("message"),schema:new X0.Name("schema"),parentSchema:new X0.Name("parentSchema")};function BF(_,z,A){let{createErrors:G}=_.it;if(G===!1)return X0._`{}`;return sv(_,z,A)}function sv(_,z,A={}){let{gen:G,it:J}=_,Y=[tv(J,A),ev(_,A)];return _y(_,z,Y),G.object(...Y)}function tv({errorPath:_},{instancePath:z}){let A=z?X0.str`${_}${(0,g8.getErrorPath)(z,g8.Type.Str)}`:_;return[Y9.default.instancePath,(0,X0.strConcat)(Y9.default.instancePath,A)]}function ev({keyword:_,it:{errSchemaPath:z}},{schemaPath:A,parentSchema:G}){let J=G?z:X0.str`${z}/${_}`;if(A)J=X0.str`${J}${(0,g8.getErrorPath)(A,g8.Type.Str)}`;return[d_.schemaPath,J]}function _y(_,{params:z,message:A},G){let{keyword:J,data:Y,schemaValue:X,it:b}=_,{opts:Q,propertyName:$,topSchemaRef:H,schemaPath:B}=b;if(G.push([d_.keyword,J],[d_.params,typeof z=="function"?z(_):z||X0._`{}`]),Q.messages)G.push([d_.message,typeof A=="function"?A(_):A]);if(Q.verbose)G.push([d_.schema,X],[d_.parentSchema,X0._`${H}${B}`],[Y9.default.data,Y]);if($)G.push([d_.propertyName,$])}});var VF=x((KF)=>{Object.defineProperty(KF,"__esModule",{value:!0});KF.boolOrEmptySchema=KF.topBoolOrEmptySchema=void 0;var Yy=K3(),Xy=e(),by=c4(),Qy={message:"boolean schema is false"};function $y(_){let{gen:z,schema:A,validateName:G}=_;if(A===!1)FF(_,!1);else if(typeof A=="object"&&A.$async===!0)z.return(by.default.data);else z.assign(Xy._`${G}.errors`,null),z.return(!0)}KF.topBoolOrEmptySchema=$y;function Hy(_,z){let{gen:A,schema:G}=_;if(G===!1)A.var(z,!1),FF(_);else A.var(z,!0)}KF.boolOrEmptySchema=Hy;function FF(_,z){let{gen:A,data:G}=_,J={gen:A,keyword:"false schema",data:G,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:_};(0,Yy.reportError)(J,Qy,void 0,z)}});var p7=x((UF)=>{Object.defineProperty(UF,"__esModule",{value:!0});UF.getRules=UF.isJSONType=void 0;var Zy=["string","number","integer","boolean","null","object","array"],qy=new Set(Zy);function Fy(_){return typeof _=="string"&&qy.has(_)}UF.isJSONType=Fy;function Ky(){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:{}}}UF.getRules=Ky});var d7=x((EF)=>{Object.defineProperty(EF,"__esModule",{value:!0});EF.shouldUseRule=EF.shouldUseGroup=EF.schemaHasRulesForType=void 0;function Vy({schema:_,self:z},A){let G=z.RULES.types[A];return G&&G!==!0&&MF(_,G)}EF.schemaHasRulesForType=Vy;function MF(_,z){return z.rules.some((A)=>NF(_,A))}EF.shouldUseGroup=MF;function NF(_,z){var A;return _[z.keyword]!==void 0||((A=z.definition.implements)===null||A===void 0?void 0:A.some((G)=>_[G]!==void 0))}EF.shouldUseRule=NF});var W3=x((RF)=>{Object.defineProperty(RF,"__esModule",{value:!0});RF.reportTypeError=RF.checkDataTypes=RF.checkDataType=RF.coerceAndCheckDataType=RF.getJSONTypes=RF.getSchemaTypes=RF.DataType=void 0;var My=p7(),Ny=d7(),Ey=K3(),s=e(),OF=Q0(),i1;(function(_){_[_.Correct=0]="Correct",_[_.Wrong=1]="Wrong"})(i1||(RF.DataType=i1={}));function wy(_){let z=LF(_.type);if(z.includes("null")){if(_.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!z.length&&_.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(_.nullable===!0)z.push("null")}return z}RF.getSchemaTypes=wy;function LF(_){let z=Array.isArray(_)?_:_?[_]:[];if(z.every(My.isJSONType))return z;throw Error("type must be JSONType or JSONType[]: "+z.join(","))}RF.getJSONTypes=LF;function Oy(_,z){let{gen:A,data:G,opts:J}=_,Y=Ly(z,J.coerceTypes),X=z.length>0&&!(Y.length===0&&z.length===1&&(0,Ny.schemaHasRulesForType)(_,z[0]));if(X){let b=n7(z,G,J.strictNumbers,i1.Wrong);A.if(b,()=>{if(Y.length)jy(_,z,Y);else i7(_)})}return X}RF.coerceAndCheckDataType=Oy;var jF=new Set(["string","number","integer","boolean","null"]);function Ly(_,z){return z?_.filter((A)=>jF.has(A)||z==="array"&&A==="array"):[]}function jy(_,z,A){let{gen:G,data:J,opts:Y}=_,X=G.let("dataType",s._`typeof ${J}`),b=G.let("coerced",s._`undefined`);if(Y.coerceTypes==="array")G.if(s._`${X} == 'object' && Array.isArray(${J}) && ${J}.length == 1`,()=>G.assign(J,s._`${J}[0]`).assign(X,s._`typeof ${J}`).if(n7(z,J,Y.strictNumbers),()=>G.assign(b,J)));G.if(s._`${b} !== undefined`);for(let $ of A)if(jF.has($)||$==="array"&&Y.coerceTypes==="array")Q($);G.else(),i7(_),G.endIf(),G.if(s._`${b} !== undefined`,()=>{G.assign(J,b),Ry(_,b)});function Q($){switch($){case"string":G.elseIf(s._`${X} == "number" || ${X} == "boolean"`).assign(b,s._`"" + ${J}`).elseIf(s._`${J} === null`).assign(b,s._`""`);return;case"number":G.elseIf(s._`${X} == "boolean" || ${J} === null
29
+ || (${X} == "string" && ${J} && ${J} == +${J})`).assign(b,s._`+${J}`);return;case"integer":G.elseIf(s._`${X} === "boolean" || ${J} === null
30
+ || (${X} === "string" && ${J} && ${J} == +${J} && !(${J} % 1))`).assign(b,s._`+${J}`);return;case"boolean":G.elseIf(s._`${J} === "false" || ${J} === 0 || ${J} === null`).assign(b,!1).elseIf(s._`${J} === "true" || ${J} === 1`).assign(b,!0);return;case"null":G.elseIf(s._`${J} === "" || ${J} === 0 || ${J} === false`),G.assign(b,null);return;case"array":G.elseIf(s._`${X} === "string" || ${X} === "number"
31
+ || ${X} === "boolean" || ${J} === null`).assign(b,s._`[${J}]`)}}}function Ry({gen:_,parentData:z,parentDataProperty:A},G){_.if(s._`${z} !== undefined`,()=>_.assign(s._`${z}[${A}]`,G))}function r7(_,z,A,G=i1.Correct){let J=G===i1.Correct?s.operators.EQ:s.operators.NEQ,Y;switch(_){case"null":return s._`${z} ${J} null`;case"array":Y=s._`Array.isArray(${z})`;break;case"object":Y=s._`${z} && typeof ${z} == "object" && !Array.isArray(${z})`;break;case"integer":Y=X(s._`!(${z} % 1) && !isNaN(${z})`);break;case"number":Y=X();break;default:return s._`typeof ${z} ${J} ${_}`}return G===i1.Correct?Y:(0,s.not)(Y);function X(b=s.nil){return(0,s.and)(s._`typeof ${z} == "number"`,b,A?s._`isFinite(${z})`:s.nil)}}RF.checkDataType=r7;function n7(_,z,A,G){if(_.length===1)return r7(_[0],z,A,G);let J,Y=(0,OF.toHash)(_);if(Y.array&&Y.object){let X=s._`typeof ${z} != "object"`;J=Y.null?X:s._`!${z} || ${X}`,delete Y.null,delete Y.array,delete Y.object}else J=s.nil;if(Y.number)delete Y.integer;for(let X in Y)J=(0,s.and)(J,r7(X,z,A,G));return J}RF.checkDataTypes=n7;var Py={message:({schema:_})=>`must be ${_}`,params:({schema:_,schemaValue:z})=>typeof _=="string"?s._`{type: ${_}}`:s._`{type: ${z}}`};function i7(_){let z=Sy(_);(0,Ey.reportError)(z,Py)}RF.reportTypeError=i7;function Sy(_){let{gen:z,data:A,schema:G}=_,J=(0,OF.schemaRefOrVal)(_,G,"type");return{gen:z,keyword:"type",data:A,schema:G.type,schemaCode:J,schemaValue:J,parentSchema:G,params:{},it:_}}});var xF=x((kF)=>{Object.defineProperty(kF,"__esModule",{value:!0});kF.assignDefaults=void 0;var o1=e(),yy=Q0();function gy(_,z){let{properties:A,items:G}=_.schema;if(z==="object"&&A)for(let J in A)SF(_,J,A[J].default);else if(z==="array"&&Array.isArray(G))G.forEach((J,Y)=>SF(_,Y,J.default))}kF.assignDefaults=gy;function SF(_,z,A){let{gen:G,compositeRule:J,data:Y,opts:X}=_;if(A===void 0)return;let b=o1._`${Y}${(0,o1.getProperty)(z)}`;if(J){(0,yy.checkStrictMode)(_,`default is ignored for: ${b}`);return}let Q=o1._`${b} === undefined`;if(X.useDefaults==="empty")Q=o1._`${Q} || ${b} === null || ${b} === ""`;G.if(Q,o1._`${b} = ${(0,o1.stringify)(A)}`)}});var x9=x((vF)=>{Object.defineProperty(vF,"__esModule",{value:!0});vF.validateUnion=vF.validateArray=vF.usePattern=vF.callValidateCode=vF.schemaProperties=vF.allSchemaProperties=vF.noPropertyInData=vF.propertyInData=vF.isOwnProperty=vF.hasPropFunc=vF.reportMissingProp=vF.checkMissingProp=vF.checkReportMissingProp=void 0;var E0=e(),o7=Q0(),N_=c4(),fy=Q0();function hy(_,z){let{gen:A,data:G,it:J}=_;A.if(s7(A,G,z,J.opts.ownProperties),()=>{_.setParams({missingProperty:E0._`${z}`},!0),_.error()})}vF.checkReportMissingProp=hy;function my({gen:_,data:z,it:{opts:A}},G,J){return(0,E0.or)(...G.map((Y)=>(0,E0.and)(s7(_,z,Y,A.ownProperties),E0._`${J} = ${Y}`)))}vF.checkMissingProp=my;function uy(_,z){_.setParams({missingProperty:z},!0),_.error()}vF.reportMissingProp=uy;function TF(_){return _.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:E0._`Object.prototype.hasOwnProperty`})}vF.hasPropFunc=TF;function a7(_,z,A){return E0._`${TF(_)}.call(${z}, ${A})`}vF.isOwnProperty=a7;function cy(_,z,A,G){let J=E0._`${z}${(0,E0.getProperty)(A)} !== undefined`;return G?E0._`${J} && ${a7(_,z,A)}`:J}vF.propertyInData=cy;function s7(_,z,A,G){let J=E0._`${z}${(0,E0.getProperty)(A)} === undefined`;return G?(0,E0.or)(J,(0,E0.not)(a7(_,z,A))):J}vF.noPropertyInData=s7;function CF(_){return _?Object.keys(_).filter((z)=>z!=="__proto__"):[]}vF.allSchemaProperties=CF;function ly(_,z){return CF(z).filter((A)=>!(0,o7.alwaysValidSchema)(_,z[A]))}vF.schemaProperties=ly;function py({schemaCode:_,data:z,it:{gen:A,topSchemaRef:G,schemaPath:J,errorPath:Y},it:X},b,Q,$){let H=$?E0._`${_}, ${z}, ${G}${J}`:z,B=[[N_.default.instancePath,(0,E0.strConcat)(N_.default.instancePath,Y)],[N_.default.parentData,X.parentData],[N_.default.parentDataProperty,X.parentDataProperty],[N_.default.rootData,N_.default.rootData]];if(X.opts.dynamicRef)B.push([N_.default.dynamicAnchors,N_.default.dynamicAnchors]);let Z=E0._`${H}, ${A.object(...B)}`;return Q!==E0.nil?E0._`${b}.call(${Q}, ${Z})`:E0._`${b}(${Z})`}vF.callValidateCode=py;var dy=E0._`new RegExp`;function ry({gen:_,it:{opts:z}},A){let G=z.unicodeRegExp?"u":"",{regExp:J}=z.code,Y=J(A,G);return _.scopeValue("pattern",{key:Y.toString(),ref:Y,code:E0._`${J.code==="new RegExp"?dy:(0,fy.useFunc)(_,J)}(${A}, ${G})`})}vF.usePattern=ry;function ny(_){let{gen:z,data:A,keyword:G,it:J}=_,Y=z.name("valid");if(J.allErrors){let b=z.let("valid",!0);return X(()=>z.assign(b,!1)),b}return z.var(Y,!0),X(()=>z.break()),Y;function X(b){let Q=z.const("len",E0._`${A}.length`);z.forRange("i",0,Q,($)=>{_.subschema({keyword:G,dataProp:$,dataPropType:o7.Type.Num},Y),z.if((0,E0.not)(Y),b)})}}vF.validateArray=ny;function iy(_){let{gen:z,schema:A,keyword:G,it:J}=_;if(!Array.isArray(A))throw Error("ajv implementation error");if(A.some((Q)=>(0,o7.alwaysValidSchema)(J,Q))&&!J.opts.unevaluated)return;let X=z.let("valid",!1),b=z.name("_valid");z.block(()=>A.forEach((Q,$)=>{let H=_.subschema({keyword:G,schemaProp:$,compositeRule:!0},b);if(z.assign(X,E0._`${X} || ${b}`),!_.mergeValidEvaluated(H,b))z.if((0,E0.not)(X))})),_.result(X,()=>_.reset(),()=>_.error(!0))}vF.validateUnion=iy});var uF=x((hF)=>{Object.defineProperty(hF,"__esModule",{value:!0});hF.validateKeywordUsage=hF.validSchemaType=hF.funcKeywordCode=hF.macroKeywordCode=void 0;var X9=e(),r_=c4(),bg=x9(),Qg=K3();function $g(_,z){let{gen:A,keyword:G,schema:J,parentSchema:Y,it:X}=_,b=z.macro.call(X.self,J,Y,X),Q=fF(A,G,b);if(X.opts.validateSchema!==!1)X.self.validateSchema(b,!0);let $=A.name("valid");_.subschema({schema:b,schemaPath:X9.nil,errSchemaPath:`${X.errSchemaPath}/${G}`,topSchemaRef:Q,compositeRule:!0},$),_.pass($,()=>_.error(!0))}hF.macroKeywordCode=$g;function Hg(_,z){var A;let{gen:G,keyword:J,schema:Y,parentSchema:X,$data:b,it:Q}=_;Zg(Q,z);let $=!b&&z.compile?z.compile.call(Q.self,Y,X,Q):z.validate,H=fF(G,J,$),B=G.let("valid");_.block$data(B,Z),_.ok((A=z.valid)!==null&&A!==void 0?A:B);function Z(){if(z.errors===!1){if(K(),z.modifying)gF(_);W(()=>_.error())}else{let V=z.async?q():F();if(z.modifying)gF(_);W(()=>Bg(_,V))}}function q(){let V=G.let("ruleErrs",null);return G.try(()=>K(X9._`await `),(N)=>G.assign(B,!1).if(X9._`${N} instanceof ${Q.ValidationError}`,()=>G.assign(V,X9._`${N}.errors`),()=>G.throw(N))),V}function F(){let V=X9._`${H}.errors`;return G.assign(V,null),K(X9.nil),V}function K(V=z.async?X9._`await `:X9.nil){let N=Q.opts.passContext?r_.default.this:r_.default.self,L=!(("compile"in z)&&!b||z.schema===!1);G.assign(B,X9._`${V}${(0,bg.callValidateCode)(_,H,N,L)}`,z.modifying)}function W(V){var N;G.if((0,X9.not)((N=z.valid)!==null&&N!==void 0?N:B),V)}}hF.funcKeywordCode=Hg;function gF(_){let{gen:z,data:A,it:G}=_;z.if(G.parentData,()=>z.assign(A,X9._`${G.parentData}[${G.parentDataProperty}]`))}function Bg(_,z){let{gen:A}=_;A.if(X9._`Array.isArray(${z})`,()=>{A.assign(r_.default.vErrors,X9._`${r_.default.vErrors} === null ? ${z} : ${r_.default.vErrors}.concat(${z})`).assign(r_.default.errors,X9._`${r_.default.vErrors}.length`),(0,Qg.extendErrors)(_)},()=>_.error())}function Zg({schemaEnv:_},z){if(z.async&&!_.$async)throw Error("async keyword in sync schema")}function fF(_,z,A){if(A===void 0)throw Error(`keyword "${z}" failed to compile`);return _.scopeValue("keyword",typeof A=="function"?{ref:A}:{ref:A,code:(0,X9.stringify)(A)})}function qg(_,z,A=!1){return!z.length||z.some((G)=>G==="array"?Array.isArray(_):G==="object"?_&&typeof _=="object"&&!Array.isArray(_):typeof _==G||A&&typeof _>"u")}hF.validSchemaType=qg;function Fg({schema:_,opts:z,self:A,errSchemaPath:G},J,Y){if(Array.isArray(J.keyword)?!J.keyword.includes(Y):J.keyword!==Y)throw Error("ajv implementation error");let X=J.dependencies;if(X===null||X===void 0?void 0:X.some((b)=>!Object.prototype.hasOwnProperty.call(_,b)))throw Error(`parent schema must have dependencies of ${Y}: ${X.join(",")}`);if(J.validateSchema){if(!J.validateSchema(_[Y])){let Q=`keyword "${Y}" value is invalid at path "${G}": `+A.errorsText(J.validateSchema.errors);if(z.validateSchema==="log")A.logger.error(Q);else throw Error(Q)}}}hF.validateKeywordUsage=Fg});var dF=x((lF)=>{Object.defineProperty(lF,"__esModule",{value:!0});lF.extendSubschemaMode=lF.extendSubschemaData=lF.getSubschema=void 0;var q4=e(),cF=Q0();function Ug(_,{keyword:z,schemaProp:A,schema:G,schemaPath:J,errSchemaPath:Y,topSchemaRef:X}){if(z!==void 0&&G!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(z!==void 0){let b=_.schema[z];return A===void 0?{schema:b,schemaPath:q4._`${_.schemaPath}${(0,q4.getProperty)(z)}`,errSchemaPath:`${_.errSchemaPath}/${z}`}:{schema:b[A],schemaPath:q4._`${_.schemaPath}${(0,q4.getProperty)(z)}${(0,q4.getProperty)(A)}`,errSchemaPath:`${_.errSchemaPath}/${z}/${(0,cF.escapeFragment)(A)}`}}if(G!==void 0){if(J===void 0||Y===void 0||X===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:G,schemaPath:J,topSchemaRef:X,errSchemaPath:Y}}throw Error('either "keyword" or "schema" must be passed')}lF.getSubschema=Ug;function Dg(_,z,{dataProp:A,dataPropType:G,data:J,dataTypes:Y,propertyName:X}){if(J!==void 0&&A!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:b}=z;if(A!==void 0){let{errorPath:$,dataPathArr:H,opts:B}=z,Z=b.let("data",q4._`${z.data}${(0,q4.getProperty)(A)}`,!0);Q(Z),_.errorPath=q4.str`${$}${(0,cF.getErrorPath)(A,G,B.jsPropertySyntax)}`,_.parentDataProperty=q4._`${A}`,_.dataPathArr=[...H,_.parentDataProperty]}if(J!==void 0){let $=J instanceof q4.Name?J:b.let("data",J,!0);if(Q($),X!==void 0)_.propertyName=X}if(Y)_.dataTypes=Y;function Q($){_.data=$,_.dataLevel=z.dataLevel+1,_.dataTypes=[],z.definedProperties=new Set,_.parentData=z.data,_.dataNames=[...z.dataNames,$]}}lF.extendSubschemaData=Dg;function Mg(_,{jtdDiscriminator:z,jtdMetadata:A,compositeRule:G,createErrors:J,allErrors:Y}){if(G!==void 0)_.compositeRule=G;if(J!==void 0)_.createErrors=J;if(Y!==void 0)_.allErrors=Y;_.jtdDiscriminator=z,_.jtdMetadata=A}lF.extendSubschemaMode=Mg});var t7=x((j80,rF)=>{rF.exports=function _(z,A){if(z===A)return!0;if(z&&A&&typeof z=="object"&&typeof A=="object"){if(z.constructor!==A.constructor)return!1;var G,J,Y;if(Array.isArray(z)){if(G=z.length,G!=A.length)return!1;for(J=G;J--!==0;)if(!_(z[J],A[J]))return!1;return!0}if(z.constructor===RegExp)return z.source===A.source&&z.flags===A.flags;if(z.valueOf!==Object.prototype.valueOf)return z.valueOf()===A.valueOf();if(z.toString!==Object.prototype.toString)return z.toString()===A.toString();if(Y=Object.keys(z),G=Y.length,G!==Object.keys(A).length)return!1;for(J=G;J--!==0;)if(!Object.prototype.hasOwnProperty.call(A,Y[J]))return!1;for(J=G;J--!==0;){var X=Y[J];if(!_(z[X],A[X]))return!1}return!0}return z!==z&&A!==A}});var iF=x((R80,nF)=>{var E_=nF.exports=function(_,z,A){if(typeof z=="function")A=z,z={};A=z.cb||A;var G=typeof A=="function"?A:A.pre||function(){},J=A.post||function(){};f8(z,G,J,_,"",_)};E_.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};E_.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};E_.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};E_.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 f8(_,z,A,G,J,Y,X,b,Q,$){if(G&&typeof G=="object"&&!Array.isArray(G)){z(G,J,Y,X,b,Q,$);for(var H in G){var B=G[H];if(Array.isArray(B)){if(H in E_.arrayKeywords)for(var Z=0;Z<B.length;Z++)f8(_,z,A,B[Z],J+"/"+H+"/"+Z,Y,J,H,G,Z)}else if(H in E_.propsKeywords){if(B&&typeof B=="object")for(var q in B)f8(_,z,A,B[q],J+"/"+H+"/"+wg(q),Y,J,H,G,q)}else if(H in E_.keywords||_.allKeys&&!(H in E_.skipKeywords))f8(_,z,A,B,J+"/"+H,Y,J,H,G)}A(G,J,Y,X,b,Q,$)}}function wg(_){return _.replace(/~/g,"~0").replace(/\//g,"~1")}});var V3=x((tF)=>{Object.defineProperty(tF,"__esModule",{value:!0});tF.getSchemaRefs=tF.resolveUrl=tF.normalizeId=tF._getFullPath=tF.getFullPath=tF.inlineRef=void 0;var Og=Q0(),Lg=t7(),jg=iF(),Rg=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Pg(_,z=!0){if(typeof _=="boolean")return!0;if(z===!0)return!e7(_);if(!z)return!1;return oF(_)<=z}tF.inlineRef=Pg;var Sg=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function e7(_){for(let z in _){if(Sg.has(z))return!0;let A=_[z];if(Array.isArray(A)&&A.some(e7))return!0;if(typeof A=="object"&&e7(A))return!0}return!1}function oF(_){let z=0;for(let A in _){if(A==="$ref")return 1/0;if(z++,Rg.has(A))continue;if(typeof _[A]=="object")(0,Og.eachItem)(_[A],(G)=>z+=oF(G));if(z===1/0)return 1/0}return z}function aF(_,z="",A){if(A!==!1)z=a1(z);let G=_.parse(z);return sF(_,G)}tF.getFullPath=aF;function sF(_,z){return _.serialize(z).split("#")[0]+"#"}tF._getFullPath=sF;var kg=/#\/?$/;function a1(_){return _?_.replace(kg,""):""}tF.normalizeId=a1;function Ig(_,z,A){return A=a1(A),_.resolve(z,A)}tF.resolveUrl=Ig;var xg=/^[a-z_][-a-z0-9._]*$/i;function Tg(_,z){if(typeof _=="boolean")return{};let{schemaId:A,uriResolver:G}=this.opts,J=a1(_[A]||z),Y={"":J},X=aF(G,J,!1),b={},Q=new Set;return jg(_,{allKeys:!0},(B,Z,q,F)=>{if(F===void 0)return;let K=X+Z,W=Y[F];if(typeof B[A]=="string")W=V.call(this,B[A]);N.call(this,B.$anchor),N.call(this,B.$dynamicAnchor),Y[Z]=W;function V(L){let M=this.opts.uriResolver.resolve;if(L=a1(W?M(W,L):L),Q.has(L))throw H(L);Q.add(L);let k=this.refs[L];if(typeof k=="string")k=this.refs[k];if(typeof k=="object")$(B,k.schema,L);else if(L!==a1(K))if(L[0]==="#")$(B,b[L],L),b[L]=B;else this.refs[L]=K;return L}function N(L){if(typeof L=="string"){if(!xg.test(L))throw Error(`invalid anchor "${L}"`);V.call(this,`#${L}`)}}}),b;function $(B,Z,q){if(Z!==void 0&&!Lg(B,Z))throw H(q)}function H(B){return Error(`reference "${B}" resolves to more than one schema`)}}tF.getSchemaRefs=Tg});var M3=x((FK)=>{Object.defineProperty(FK,"__esModule",{value:!0});FK.getData=FK.KeywordCxt=FK.validateFunctionCode=void 0;var JK=VF(),_K=W3(),zG=d7(),h8=W3(),hg=xF(),D3=uF(),_G=dF(),m=e(),n=c4(),mg=V3(),l4=Q0(),U3=K3();function ug(_){if(bK(_)){if(QK(_),XK(_)){pg(_);return}}YK(_,()=>(0,JK.topBoolOrEmptySchema)(_))}FK.validateFunctionCode=ug;function YK({gen:_,validateName:z,schema:A,schemaEnv:G,opts:J},Y){if(J.code.es5)_.func(z,m._`${n.default.data}, ${n.default.valCxt}`,G.$async,()=>{_.code(m._`"use strict"; ${zK(A,J)}`),lg(_,J),_.code(Y)});else _.func(z,m._`${n.default.data}, ${cg(J)}`,G.$async,()=>_.code(zK(A,J)).code(Y))}function cg(_){return m._`{${n.default.instancePath}="", ${n.default.parentData}, ${n.default.parentDataProperty}, ${n.default.rootData}=${n.default.data}${_.dynamicRef?m._`, ${n.default.dynamicAnchors}={}`:m.nil}}={}`}function lg(_,z){_.if(n.default.valCxt,()=>{if(_.var(n.default.instancePath,m._`${n.default.valCxt}.${n.default.instancePath}`),_.var(n.default.parentData,m._`${n.default.valCxt}.${n.default.parentData}`),_.var(n.default.parentDataProperty,m._`${n.default.valCxt}.${n.default.parentDataProperty}`),_.var(n.default.rootData,m._`${n.default.valCxt}.${n.default.rootData}`),z.dynamicRef)_.var(n.default.dynamicAnchors,m._`${n.default.valCxt}.${n.default.dynamicAnchors}`)},()=>{if(_.var(n.default.instancePath,m._`""`),_.var(n.default.parentData,m._`undefined`),_.var(n.default.parentDataProperty,m._`undefined`),_.var(n.default.rootData,n.default.data),z.dynamicRef)_.var(n.default.dynamicAnchors,m._`{}`)})}function pg(_){let{schema:z,opts:A,gen:G}=_;YK(_,()=>{if(A.$comment&&z.$comment)HK(_);if(og(_),G.let(n.default.vErrors,null),G.let(n.default.errors,0),A.unevaluated)dg(_);$K(_),tg(_)});return}function dg(_){let{gen:z,validateName:A}=_;_.evaluated=z.const("evaluated",m._`${A}.evaluated`),z.if(m._`${_.evaluated}.dynamicProps`,()=>z.assign(m._`${_.evaluated}.props`,m._`undefined`)),z.if(m._`${_.evaluated}.dynamicItems`,()=>z.assign(m._`${_.evaluated}.items`,m._`undefined`))}function zK(_,z){let A=typeof _=="object"&&_[z.schemaId];return A&&(z.code.source||z.code.process)?m._`/*# sourceURL=${A} */`:m.nil}function rg(_,z){if(bK(_)){if(QK(_),XK(_)){ng(_,z);return}}(0,JK.boolOrEmptySchema)(_,z)}function XK({schema:_,self:z}){if(typeof _=="boolean")return!_;for(let A in _)if(z.RULES.all[A])return!0;return!1}function bK(_){return typeof _.schema!="boolean"}function ng(_,z){let{schema:A,gen:G,opts:J}=_;if(J.$comment&&A.$comment)HK(_);ag(_),sg(_);let Y=G.const("_errs",n.default.errors);$K(_,Y),G.var(z,m._`${Y} === ${n.default.errors}`)}function QK(_){(0,l4.checkUnknownRules)(_),ig(_)}function $K(_,z){if(_.opts.jtd)return AK(_,[],!1,z);let A=(0,_K.getSchemaTypes)(_.schema),G=(0,_K.coerceAndCheckDataType)(_,A);AK(_,A,!G,z)}function ig(_){let{schema:z,errSchemaPath:A,opts:G,self:J}=_;if(z.$ref&&G.ignoreKeywordsWithRef&&(0,l4.schemaHasRulesButRef)(z,J.RULES))J.logger.warn(`$ref: keywords ignored in schema at path "${A}"`)}function og(_){let{schema:z,opts:A}=_;if(z.default!==void 0&&A.useDefaults&&A.strictSchema)(0,l4.checkStrictMode)(_,"default is ignored in the schema root")}function ag(_){let z=_.schema[_.opts.schemaId];if(z)_.baseId=(0,mg.resolveUrl)(_.opts.uriResolver,_.baseId,z)}function sg(_){if(_.schema.$async&&!_.schemaEnv.$async)throw Error("async schema in sync schema")}function HK({gen:_,schemaEnv:z,schema:A,errSchemaPath:G,opts:J}){let Y=A.$comment;if(J.$comment===!0)_.code(m._`${n.default.self}.logger.log(${Y})`);else if(typeof J.$comment=="function"){let X=m.str`${G}/$comment`,b=_.scopeValue("root",{ref:z.root});_.code(m._`${n.default.self}.opts.$comment(${Y}, ${X}, ${b}.schema)`)}}function tg(_){let{gen:z,schemaEnv:A,validateName:G,ValidationError:J,opts:Y}=_;if(A.$async)z.if(m._`${n.default.errors} === 0`,()=>z.return(n.default.data),()=>z.throw(m._`new ${J}(${n.default.vErrors})`));else{if(z.assign(m._`${G}.errors`,n.default.vErrors),Y.unevaluated)eg(_);z.return(m._`${n.default.errors} === 0`)}}function eg({gen:_,evaluated:z,props:A,items:G}){if(A instanceof m.Name)_.assign(m._`${z}.props`,A);if(G instanceof m.Name)_.assign(m._`${z}.items`,G)}function AK(_,z,A,G){let{gen:J,schema:Y,data:X,allErrors:b,opts:Q,self:$}=_,{RULES:H}=$;if(Y.$ref&&(Q.ignoreKeywordsWithRef||!(0,l4.schemaHasRulesButRef)(Y,H))){J.block(()=>ZK(_,"$ref",H.all.$ref.definition));return}if(!Q.jtd)_f(_,z);J.block(()=>{for(let Z of H.rules)B(Z);B(H.post)});function B(Z){if(!(0,zG.shouldUseGroup)(Y,Z))return;if(Z.type){if(J.if((0,h8.checkDataType)(Z.type,X,Q.strictNumbers)),GK(_,Z),z.length===1&&z[0]===Z.type&&A)J.else(),(0,h8.reportTypeError)(_);J.endIf()}else GK(_,Z);if(!b)J.if(m._`${n.default.errors} === ${G||0}`)}}function GK(_,z){let{gen:A,schema:G,opts:{useDefaults:J}}=_;if(J)(0,hg.assignDefaults)(_,z.type);A.block(()=>{for(let Y of z.rules)if((0,zG.shouldUseRule)(G,Y))ZK(_,Y.keyword,Y.definition,z.type)})}function _f(_,z){if(_.schemaEnv.meta||!_.opts.strictTypes)return;if(zf(_,z),!_.opts.allowUnionTypes)Af(_,z);Gf(_,_.dataTypes)}function zf(_,z){if(!z.length)return;if(!_.dataTypes.length){_.dataTypes=z;return}z.forEach((A)=>{if(!BK(_.dataTypes,A))AG(_,`type "${A}" not allowed by context "${_.dataTypes.join(",")}"`)}),Yf(_,z)}function Af(_,z){if(z.length>1&&!(z.length===2&&z.includes("null")))AG(_,"use allowUnionTypes to allow union type keyword")}function Gf(_,z){let A=_.self.RULES.all;for(let G in A){let J=A[G];if(typeof J=="object"&&(0,zG.shouldUseRule)(_.schema,J)){let{type:Y}=J.definition;if(Y.length&&!Y.some((X)=>Jf(z,X)))AG(_,`missing type "${Y.join(",")}" for keyword "${G}"`)}}}function Jf(_,z){return _.includes(z)||z==="number"&&_.includes("integer")}function BK(_,z){return _.includes(z)||z==="integer"&&_.includes("number")}function Yf(_,z){let A=[];for(let G of _.dataTypes)if(BK(z,G))A.push(G);else if(z.includes("integer")&&G==="number")A.push("integer");_.dataTypes=A}function AG(_,z){let A=_.schemaEnv.baseId+_.errSchemaPath;z+=` at "${A}" (strictTypes)`,(0,l4.checkStrictMode)(_,z,_.opts.strictTypes)}class GG{constructor(_,z,A){if((0,D3.validateKeywordUsage)(_,z,A),this.gen=_.gen,this.allErrors=_.allErrors,this.keyword=A,this.data=_.data,this.schema=_.schema[A],this.$data=z.$data&&_.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,l4.schemaRefOrVal)(_,this.schema,A,this.$data),this.schemaType=z.schemaType,this.parentSchema=_.schema,this.params={},this.it=_,this.def=z,this.$data)this.schemaCode=_.gen.const("vSchema",qK(this.$data,_));else if(this.schemaCode=this.schemaValue,!(0,D3.validSchemaType)(this.schema,z.schemaType,z.allowUndefined))throw Error(`${A} value must be ${JSON.stringify(z.schemaType)}`);if("code"in z?z.trackErrors:z.errors!==!1)this.errsCount=_.gen.const("_errs",n.default.errors)}result(_,z,A){this.failResult((0,m.not)(_),z,A)}failResult(_,z,A){if(this.gen.if(_),A)A();else this.error();if(z){if(this.gen.else(),z(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(_,z){this.failResult((0,m.not)(_),void 0,z)}fail(_){if(_===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(_),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(_){if(!this.$data)return this.fail(_);let{schemaCode:z}=this;this.fail(m._`${z} !== undefined && (${(0,m.or)(this.invalid$data(),_)})`)}error(_,z,A){if(z){this.setParams(z),this._error(_,A),this.setParams({});return}this._error(_,A)}_error(_,z){(_?U3.reportExtraError:U3.reportError)(this,this.def.error,z)}$dataError(){(0,U3.reportError)(this,this.def.$dataError||U3.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,U3.resetErrorsCount)(this.gen,this.errsCount)}ok(_){if(!this.allErrors)this.gen.if(_)}setParams(_,z){if(z)Object.assign(this.params,_);else this.params=_}block$data(_,z,A=m.nil){this.gen.block(()=>{this.check$data(_,A),z()})}check$data(_=m.nil,z=m.nil){if(!this.$data)return;let{gen:A,schemaCode:G,schemaType:J,def:Y}=this;if(A.if((0,m.or)(m._`${G} === undefined`,z)),_!==m.nil)A.assign(_,!0);if(J.length||Y.validateSchema){if(A.elseIf(this.invalid$data()),this.$dataError(),_!==m.nil)A.assign(_,!1)}A.else()}invalid$data(){let{gen:_,schemaCode:z,schemaType:A,def:G,it:J}=this;return(0,m.or)(Y(),X());function Y(){if(A.length){if(!(z instanceof m.Name))throw Error("ajv implementation error");let b=Array.isArray(A)?A:[A];return m._`${(0,h8.checkDataTypes)(b,z,J.opts.strictNumbers,h8.DataType.Wrong)}`}return m.nil}function X(){if(G.validateSchema){let b=_.scopeValue("validate$data",{ref:G.validateSchema});return m._`!${b}(${z})`}return m.nil}}subschema(_,z){let A=(0,_G.getSubschema)(this.it,_);(0,_G.extendSubschemaData)(A,this.it,_),(0,_G.extendSubschemaMode)(A,_);let G={...this.it,...A,items:void 0,props:void 0};return rg(G,z),G}mergeEvaluated(_,z){let{it:A,gen:G}=this;if(!A.opts.unevaluated)return;if(A.props!==!0&&_.props!==void 0)A.props=l4.mergeEvaluated.props(G,_.props,A.props,z);if(A.items!==!0&&_.items!==void 0)A.items=l4.mergeEvaluated.items(G,_.items,A.items,z)}mergeValidEvaluated(_,z){let{it:A,gen:G}=this;if(A.opts.unevaluated&&(A.props!==!0||A.items!==!0))return G.if(z,()=>this.mergeEvaluated(_,m.Name)),!0}}FK.KeywordCxt=GG;function ZK(_,z,A,G){let J=new GG(_,A,z);if("code"in A)A.code(J,G);else if(J.$data&&A.validate)(0,D3.funcKeywordCode)(J,A);else if("macro"in A)(0,D3.macroKeywordCode)(J,A);else if(A.compile||A.validate)(0,D3.funcKeywordCode)(J,A)}var Xf=/^\/(?:[^~]|~0|~1)*$/,bf=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function qK(_,{dataLevel:z,dataNames:A,dataPathArr:G}){let J,Y;if(_==="")return n.default.rootData;if(_[0]==="/"){if(!Xf.test(_))throw Error(`Invalid JSON-pointer: ${_}`);J=_,Y=n.default.rootData}else{let $=bf.exec(_);if(!$)throw Error(`Invalid JSON-pointer: ${_}`);let H=+$[1];if(J=$[2],J==="#"){if(H>=z)throw Error(Q("property/index",H));return G[z-H]}if(H>z)throw Error(Q("data",H));if(Y=A[z-H],!J)return Y}let X=Y,b=J.split("/");for(let $ of b)if($)Y=m._`${Y}${(0,m.getProperty)((0,l4.unescapeJsonPointer)($))}`,X=m._`${X} && ${Y}`;return X;function Q($,H){return`Cannot access ${$} ${H} levels up, current level is ${z}`}}FK.getData=qK});var m8=x((VK)=>{Object.defineProperty(VK,"__esModule",{value:!0});class WK extends Error{constructor(_){super("validation failed");this.errors=_,this.ajv=this.validation=!0}}VK.default=WK});var N3=x((DK)=>{Object.defineProperty(DK,"__esModule",{value:!0});var JG=V3();class UK extends Error{constructor(_,z,A,G){super(G||`can't resolve reference ${A} from id ${z}`);this.missingRef=(0,JG.resolveUrl)(_,z,A),this.missingSchema=(0,JG.normalizeId)((0,JG.getFullPath)(_,this.missingRef))}}DK.default=UK});var c8=x((EK)=>{Object.defineProperty(EK,"__esModule",{value:!0});EK.resolveSchema=EK.getCompilingSchema=EK.resolveRef=EK.compileSchema=EK.SchemaEnv=void 0;var a9=e(),Zf=m8(),n_=c4(),s9=V3(),MK=Q0(),qf=M3();class E3{constructor(_){var z;this.refs={},this.dynamicAnchors={};let A;if(typeof _.schema=="object")A=_.schema;this.schema=_.schema,this.schemaId=_.schemaId,this.root=_.root||this,this.baseId=(z=_.baseId)!==null&&z!==void 0?z:(0,s9.normalizeId)(A===null||A===void 0?void 0:A[_.schemaId||"$id"]),this.schemaPath=_.schemaPath,this.localRefs=_.localRefs,this.meta=_.meta,this.$async=A===null||A===void 0?void 0:A.$async,this.refs={}}}EK.SchemaEnv=E3;function XG(_){let z=NK.call(this,_);if(z)return z;let A=(0,s9.getFullPath)(this.opts.uriResolver,_.root.baseId),{es5:G,lines:J}=this.opts.code,{ownProperties:Y}=this.opts,X=new a9.CodeGen(this.scope,{es5:G,lines:J,ownProperties:Y}),b;if(_.$async)b=X.scopeValue("Error",{ref:Zf.default,code:a9._`require("ajv/dist/runtime/validation_error").default`});let Q=X.scopeName("validate");_.validateName=Q;let $={gen:X,allErrors:this.opts.allErrors,data:n_.default.data,parentData:n_.default.parentData,parentDataProperty:n_.default.parentDataProperty,dataNames:[n_.default.data],dataPathArr:[a9.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:X.scopeValue("schema",this.opts.code.source===!0?{ref:_.schema,code:(0,a9.stringify)(_.schema)}:{ref:_.schema}),validateName:Q,ValidationError:b,schema:_.schema,schemaEnv:_,rootId:A,baseId:_.baseId||A,schemaPath:a9.nil,errSchemaPath:_.schemaPath||(this.opts.jtd?"":"#"),errorPath:a9._`""`,opts:this.opts,self:this},H;try{this._compilations.add(_),(0,qf.validateFunctionCode)($),X.optimize(this.opts.code.optimize);let B=X.toString();if(H=`${X.scopeRefs(n_.default.scope)}return ${B}`,this.opts.code.process)H=this.opts.code.process(H,_);let q=Function(`${n_.default.self}`,`${n_.default.scope}`,H)(this,this.scope.get());if(this.scope.value(Q,{ref:q}),q.errors=null,q.schema=_.schema,q.schemaEnv=_,_.$async)q.$async=!0;if(this.opts.code.source===!0)q.source={validateName:Q,validateCode:B,scopeValues:X._values};if(this.opts.unevaluated){let{props:F,items:K}=$;if(q.evaluated={props:F instanceof a9.Name?void 0:F,items:K instanceof a9.Name?void 0:K,dynamicProps:F instanceof a9.Name,dynamicItems:K instanceof a9.Name},q.source)q.source.evaluated=(0,a9.stringify)(q.evaluated)}return _.validate=q,_}catch(B){if(delete _.validate,delete _.validateName,H)this.logger.error("Error compiling schema, function code:",H);throw B}finally{this._compilations.delete(_)}}EK.compileSchema=XG;function Ff(_,z,A){var G;A=(0,s9.resolveUrl)(this.opts.uriResolver,z,A);let J=_.refs[A];if(J)return J;let Y=Vf.call(this,_,A);if(Y===void 0){let X=(G=_.localRefs)===null||G===void 0?void 0:G[A],{schemaId:b}=this.opts;if(X)Y=new E3({schema:X,schemaId:b,root:_,baseId:z})}if(Y===void 0)return;return _.refs[A]=Kf.call(this,Y)}EK.resolveRef=Ff;function Kf(_){if((0,s9.inlineRef)(_.schema,this.opts.inlineRefs))return _.schema;return _.validate?_:XG.call(this,_)}function NK(_){for(let z of this._compilations)if(Wf(z,_))return z}EK.getCompilingSchema=NK;function Wf(_,z){return _.schema===z.schema&&_.root===z.root&&_.baseId===z.baseId}function Vf(_,z){let A;while(typeof(A=this.refs[z])=="string")z=A;return A||this.schemas[z]||u8.call(this,_,z)}function u8(_,z){let A=this.opts.uriResolver.parse(z),G=(0,s9._getFullPath)(this.opts.uriResolver,A),J=(0,s9.getFullPath)(this.opts.uriResolver,_.baseId,void 0);if(Object.keys(_.schema).length>0&&G===J)return YG.call(this,A,_);let Y=(0,s9.normalizeId)(G),X=this.refs[Y]||this.schemas[Y];if(typeof X=="string"){let b=u8.call(this,_,X);if(typeof(b===null||b===void 0?void 0:b.schema)!=="object")return;return YG.call(this,A,b)}if(typeof(X===null||X===void 0?void 0:X.schema)!=="object")return;if(!X.validate)XG.call(this,X);if(Y===(0,s9.normalizeId)(z)){let{schema:b}=X,{schemaId:Q}=this.opts,$=b[Q];if($)J=(0,s9.resolveUrl)(this.opts.uriResolver,J,$);return new E3({schema:b,schemaId:Q,root:_,baseId:J})}return YG.call(this,A,X)}EK.resolveSchema=u8;var Uf=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function YG(_,{baseId:z,schema:A,root:G}){var J;if(((J=_.fragment)===null||J===void 0?void 0:J[0])!=="/")return;for(let b of _.fragment.slice(1).split("/")){if(typeof A==="boolean")return;let Q=A[(0,MK.unescapeFragment)(b)];if(Q===void 0)return;A=Q;let $=typeof A==="object"&&A[this.opts.schemaId];if(!Uf.has(b)&&$)z=(0,s9.resolveUrl)(this.opts.uriResolver,z,$)}let Y;if(typeof A!="boolean"&&A.$ref&&!(0,MK.schemaHasRulesButRef)(A,this.RULES)){let b=(0,s9.resolveUrl)(this.opts.uriResolver,z,A.$ref);Y=u8.call(this,G,b)}let{schemaId:X}=this.opts;if(Y=Y||new E3({schema:A,schemaId:X,root:G,baseId:z}),Y.schema!==Y.root.schema)return Y;return}});var OK=x((T80,wf)=>{wf.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}});var QG=x((C80,PK)=>{var Of=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),jK=RegExp.prototype.test.bind(/^(?:(?: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 bG(_){let z="",A=0,G=0;for(G=0;G<_.length;G++){if(A=_[G].charCodeAt(0),A===48)continue;if(!(A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102))return"";z+=_[G];break}for(G+=1;G<_.length;G++){if(A=_[G].charCodeAt(0),!(A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102))return"";z+=_[G]}return z}var Lf=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function LK(_){return _.length=0,!0}function jf(_,z,A){if(_.length){let G=bG(_);if(G!=="")z.push(G);else return A.error=!0,!1;_.length=0}return!0}function Rf(_){let z=0,A={error:!1,address:"",zone:""},G=[],J=[],Y=!1,X=!1,b=jf;for(let Q=0;Q<_.length;Q++){let $=_[Q];if($==="["||$==="]")continue;if($===":"){if(Y===!0)X=!0;if(!b(J,G,A))break;if(++z>7){A.error=!0;break}if(Q>0&&_[Q-1]===":")Y=!0;G.push(":");continue}else if($==="%"){if(!b(J,G,A))break;b=LK}else{J.push($);continue}}if(J.length)if(b===LK)A.zone=J.join("");else if(X)G.push(J.join(""));else G.push(bG(J));return A.address=G.join(""),A}function RK(_){if(Pf(_,":")<2)return{host:_,isIPV6:!1};let z=Rf(_);if(!z.error){let{address:A,address:G}=z;if(z.zone)A+="%"+z.zone,G+="%25"+z.zone;return{host:A,isIPV6:!0,escapedHost:G}}else return{host:_,isIPV6:!1}}function Pf(_,z){let A=0;for(let G=0;G<_.length;G++)if(_[G]===z)A++;return A}function Sf(_){let z=_,A=[],G=-1,J=0;while(J=z.length){if(J===1)if(z===".")break;else if(z==="/"){A.push("/");break}else{A.push(z);break}else if(J===2){if(z[0]==="."){if(z[1]===".")break;else if(z[1]==="/"){z=z.slice(2);continue}}else if(z[0]==="/"){if(z[1]==="."||z[1]==="/"){A.push("/");break}}}else if(J===3){if(z==="/.."){if(A.length!==0)A.pop();A.push("/");break}}if(z[0]==="."){if(z[1]==="."){if(z[2]==="/"){z=z.slice(3);continue}}else if(z[1]==="/"){z=z.slice(2);continue}}else if(z[0]==="/"){if(z[1]==="."){if(z[2]==="/"){z=z.slice(2);continue}else if(z[2]==="."){if(z[3]==="/"){if(z=z.slice(3),A.length!==0)A.pop();continue}}}}if((G=z.indexOf("/",1))===-1){A.push(z);break}else A.push(z.slice(0,G)),z=z.slice(G)}return A.join("")}function kf(_,z){let A=z!==!0?escape:unescape;if(_.scheme!==void 0)_.scheme=A(_.scheme);if(_.userinfo!==void 0)_.userinfo=A(_.userinfo);if(_.host!==void 0)_.host=A(_.host);if(_.path!==void 0)_.path=A(_.path);if(_.query!==void 0)_.query=A(_.query);if(_.fragment!==void 0)_.fragment=A(_.fragment);return _}function If(_){let z=[];if(_.userinfo!==void 0)z.push(_.userinfo),z.push("@");if(_.host!==void 0){let A=unescape(_.host);if(!jK(A)){let G=RK(A);if(G.isIPV6===!0)A=`[${G.escapedHost}]`;else A=_.host}z.push(A)}if(typeof _.port==="number"||typeof _.port==="string")z.push(":"),z.push(String(_.port));return z.length?z.join(""):void 0}PK.exports={nonSimpleDomain:Lf,recomposeAuthority:If,normalizeComponentEncoding:kf,removeDotSegments:Sf,isIPv4:jK,isUUID:Of,normalizeIPv6:RK,stringArrayToHexStripped:bG}});var TK=x((v80,xK)=>{var{isUUID:xf}=QG(),Tf=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Cf=["http","https","ws","wss","urn","urn:uuid"];function vf(_){return Cf.indexOf(_)!==-1}function $G(_){if(_.secure===!0)return!0;else if(_.secure===!1)return!1;else if(_.scheme)return _.scheme.length===3&&(_.scheme[0]==="w"||_.scheme[0]==="W")&&(_.scheme[1]==="s"||_.scheme[1]==="S")&&(_.scheme[2]==="s"||_.scheme[2]==="S");else return!1}function SK(_){if(!_.host)_.error=_.error||"HTTP URIs must have a host.";return _}function kK(_){let z=String(_.scheme).toLowerCase()==="https";if(_.port===(z?443:80)||_.port==="")_.port=void 0;if(!_.path)_.path="/";return _}function yf(_){return _.secure=$G(_),_.resourceName=(_.path||"/")+(_.query?"?"+_.query:""),_.path=void 0,_.query=void 0,_}function gf(_){if(_.port===($G(_)?443:80)||_.port==="")_.port=void 0;if(typeof _.secure==="boolean")_.scheme=_.secure?"wss":"ws",_.secure=void 0;if(_.resourceName){let[z,A]=_.resourceName.split("?");_.path=z&&z!=="/"?z:void 0,_.query=A,_.resourceName=void 0}return _.fragment=void 0,_}function ff(_,z){if(!_.path)return _.error="URN can not be parsed",_;let A=_.path.match(Tf);if(A){let G=z.scheme||_.scheme||"urn";_.nid=A[1].toLowerCase(),_.nss=A[2];let J=`${G}:${z.nid||_.nid}`,Y=HG(J);if(_.path=void 0,Y)_=Y.parse(_,z)}else _.error=_.error||"URN can not be parsed.";return _}function hf(_,z){if(_.nid===void 0)throw Error("URN without nid cannot be serialized");let A=z.scheme||_.scheme||"urn",G=_.nid.toLowerCase(),J=`${A}:${z.nid||G}`,Y=HG(J);if(Y)_=Y.serialize(_,z);let X=_,b=_.nss;return X.path=`${G||z.nid}:${b}`,z.skipEscape=!0,X}function mf(_,z){let A=_;if(A.uuid=A.nss,A.nss=void 0,!z.tolerant&&(!A.uuid||!xf(A.uuid)))A.error=A.error||"UUID is not valid.";return A}function uf(_){let z=_;return z.nss=(_.uuid||"").toLowerCase(),z}var IK={scheme:"http",domainHost:!0,parse:SK,serialize:kK},cf={scheme:"https",domainHost:IK.domainHost,parse:SK,serialize:kK},l8={scheme:"ws",domainHost:!0,parse:yf,serialize:gf},lf={scheme:"wss",domainHost:l8.domainHost,parse:l8.parse,serialize:l8.serialize},pf={scheme:"urn",parse:ff,serialize:hf,skipNormalize:!0},df={scheme:"urn:uuid",parse:mf,serialize:uf,skipNormalize:!0},p8={http:IK,https:cf,ws:l8,wss:lf,urn:pf,"urn:uuid":df};Object.setPrototypeOf(p8,null);function HG(_){return _&&(p8[_]||p8[_.toLowerCase()])||void 0}xK.exports={wsIsSecure:$G,SCHEMES:p8,isValidSchemeName:vf,getSchemeHandler:HG}});var yK=x((y80,r8)=>{var{normalizeIPv6:rf,removeDotSegments:w3,recomposeAuthority:nf,normalizeComponentEncoding:d8,isIPv4:of,nonSimpleDomain:af}=QG(),{SCHEMES:sf,getSchemeHandler:CK}=TK();function tf(_,z){if(typeof _==="string")_=F4(p4(_,z),z);else if(typeof _==="object")_=p4(F4(_,z),z);return _}function ef(_,z,A){let G=A?Object.assign({scheme:"null"},A):{scheme:"null"},J=vK(p4(_,G),p4(z,G),G,!0);return G.skipEscape=!0,F4(J,G)}function vK(_,z,A,G){let J={};if(!G)_=p4(F4(_,A),A),z=p4(F4(z,A),A);if(A=A||{},!A.tolerant&&z.scheme)J.scheme=z.scheme,J.userinfo=z.userinfo,J.host=z.host,J.port=z.port,J.path=w3(z.path||""),J.query=z.query;else{if(z.userinfo!==void 0||z.host!==void 0||z.port!==void 0)J.userinfo=z.userinfo,J.host=z.host,J.port=z.port,J.path=w3(z.path||""),J.query=z.query;else{if(!z.path)if(J.path=_.path,z.query!==void 0)J.query=z.query;else J.query=_.query;else{if(z.path[0]==="/")J.path=w3(z.path);else{if((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path)J.path="/"+z.path;else if(!_.path)J.path=z.path;else J.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+z.path;J.path=w3(J.path)}J.query=z.query}J.userinfo=_.userinfo,J.host=_.host,J.port=_.port}J.scheme=_.scheme}return J.fragment=z.fragment,J}function _h(_,z,A){if(typeof _==="string")_=unescape(_),_=F4(d8(p4(_,A),!0),{...A,skipEscape:!0});else if(typeof _==="object")_=F4(d8(_,!0),{...A,skipEscape:!0});if(typeof z==="string")z=unescape(z),z=F4(d8(p4(z,A),!0),{...A,skipEscape:!0});else if(typeof z==="object")z=F4(d8(z,!0),{...A,skipEscape:!0});return _.toLowerCase()===z.toLowerCase()}function F4(_,z){let A={host:_.host,scheme:_.scheme,userinfo:_.userinfo,port:_.port,path:_.path,query:_.query,nid:_.nid,nss:_.nss,uuid:_.uuid,fragment:_.fragment,reference:_.reference,resourceName:_.resourceName,secure:_.secure,error:""},G=Object.assign({},z),J=[],Y=CK(G.scheme||A.scheme);if(Y&&Y.serialize)Y.serialize(A,G);if(A.path!==void 0)if(!G.skipEscape){if(A.path=escape(A.path),A.scheme!==void 0)A.path=A.path.split("%3A").join(":")}else A.path=unescape(A.path);if(G.reference!=="suffix"&&A.scheme)J.push(A.scheme,":");let X=nf(A);if(X!==void 0){if(G.reference!=="suffix")J.push("//");if(J.push(X),A.path&&A.path[0]!=="/")J.push("/")}if(A.path!==void 0){let b=A.path;if(!G.absolutePath&&(!Y||!Y.absolutePath))b=w3(b);if(X===void 0&&b[0]==="/"&&b[1]==="/")b="/%2F"+b.slice(2);J.push(b)}if(A.query!==void 0)J.push("?",A.query);if(A.fragment!==void 0)J.push("#",A.fragment);return J.join("")}var zh=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function p4(_,z){let A=Object.assign({},z),G={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},J=!1;if(A.reference==="suffix")if(A.scheme)_=A.scheme+":"+_;else _="//"+_;let Y=_.match(zh);if(Y){if(G.scheme=Y[1],G.userinfo=Y[3],G.host=Y[4],G.port=parseInt(Y[5],10),G.path=Y[6]||"",G.query=Y[7],G.fragment=Y[8],isNaN(G.port))G.port=Y[5];if(G.host)if(of(G.host)===!1){let Q=rf(G.host);G.host=Q.host.toLowerCase(),J=Q.isIPV6}else J=!0;if(G.scheme===void 0&&G.userinfo===void 0&&G.host===void 0&&G.port===void 0&&G.query===void 0&&!G.path)G.reference="same-document";else if(G.scheme===void 0)G.reference="relative";else if(G.fragment===void 0)G.reference="absolute";else G.reference="uri";if(A.reference&&A.reference!=="suffix"&&A.reference!==G.reference)G.error=G.error||"URI is not a "+A.reference+" reference.";let X=CK(A.scheme||G.scheme);if(!A.unicodeSupport&&(!X||!X.unicodeSupport)){if(G.host&&(A.domainHost||X&&X.domainHost)&&J===!1&&af(G.host))try{G.host=URL.domainToASCII(G.host.toLowerCase())}catch(b){G.error=G.error||"Host's domain name can not be converted to ASCII: "+b}}if(!X||X&&!X.skipNormalize){if(_.indexOf("%")!==-1){if(G.scheme!==void 0)G.scheme=unescape(G.scheme);if(G.host!==void 0)G.host=unescape(G.host)}if(G.path)G.path=escape(unescape(G.path));if(G.fragment)G.fragment=encodeURI(decodeURIComponent(G.fragment))}if(X&&X.parse)X.parse(G,A)}else G.error=G.error||"URI can not be parsed.";return G}var BG={SCHEMES:sf,normalize:tf,resolve:ef,resolveComponent:vK,equal:_h,serialize:F4,parse:p4};r8.exports=BG;r8.exports.default=BG;r8.exports.fastUri=BG});var hK=x((fK)=>{Object.defineProperty(fK,"__esModule",{value:!0});var gK=yK();gK.code='require("ajv/dist/runtime/uri").default';fK.default=gK});var nK=x((d4)=>{Object.defineProperty(d4,"__esModule",{value:!0});d4.CodeGen=d4.Name=d4.nil=d4.stringify=d4.str=d4._=d4.KeywordCxt=void 0;var Gh=M3();Object.defineProperty(d4,"KeywordCxt",{enumerable:!0,get:function(){return Gh.KeywordCxt}});var s1=e();Object.defineProperty(d4,"_",{enumerable:!0,get:function(){return s1._}});Object.defineProperty(d4,"str",{enumerable:!0,get:function(){return s1.str}});Object.defineProperty(d4,"stringify",{enumerable:!0,get:function(){return s1.stringify}});Object.defineProperty(d4,"nil",{enumerable:!0,get:function(){return s1.nil}});Object.defineProperty(d4,"Name",{enumerable:!0,get:function(){return s1.Name}});Object.defineProperty(d4,"CodeGen",{enumerable:!0,get:function(){return s1.CodeGen}});var Jh=m8(),pK=N3(),Yh=p7(),O3=c8(),Xh=e(),L3=V3(),n8=W3(),qG=Q0(),mK=OK(),bh=hK(),dK=(_,z)=>new RegExp(_,z);dK.code="new RegExp";var Qh=["removeAdditional","useDefaults","coerceTypes"],$h=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Hh={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."},Bh={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},uK=200;function Zh(_){var z,A,G,J,Y,X,b,Q,$,H,B,Z,q,F,K,W,V,N,L,M,k,U,O,P,S;let v=_.strict,i=(z=_.code)===null||z===void 0?void 0:z.optimize,g=i===!0||i===void 0?1:i||0,f=(G=(A=_.code)===null||A===void 0?void 0:A.regExp)!==null&&G!==void 0?G:dK,u=(J=_.uriResolver)!==null&&J!==void 0?J:bh.default;return{strictSchema:(X=(Y=_.strictSchema)!==null&&Y!==void 0?Y:v)!==null&&X!==void 0?X:!0,strictNumbers:(Q=(b=_.strictNumbers)!==null&&b!==void 0?b:v)!==null&&Q!==void 0?Q:!0,strictTypes:(H=($=_.strictTypes)!==null&&$!==void 0?$:v)!==null&&H!==void 0?H:"log",strictTuples:(Z=(B=_.strictTuples)!==null&&B!==void 0?B:v)!==null&&Z!==void 0?Z:"log",strictRequired:(F=(q=_.strictRequired)!==null&&q!==void 0?q:v)!==null&&F!==void 0?F:!1,code:_.code?{..._.code,optimize:g,regExp:f}:{optimize:g,regExp:f},loopRequired:(K=_.loopRequired)!==null&&K!==void 0?K:uK,loopEnum:(W=_.loopEnum)!==null&&W!==void 0?W:uK,meta:(V=_.meta)!==null&&V!==void 0?V:!0,messages:(N=_.messages)!==null&&N!==void 0?N:!0,inlineRefs:(L=_.inlineRefs)!==null&&L!==void 0?L:!0,schemaId:(M=_.schemaId)!==null&&M!==void 0?M:"$id",addUsedSchema:(k=_.addUsedSchema)!==null&&k!==void 0?k:!0,validateSchema:(U=_.validateSchema)!==null&&U!==void 0?U:!0,validateFormats:(O=_.validateFormats)!==null&&O!==void 0?O:!0,unicodeRegExp:(P=_.unicodeRegExp)!==null&&P!==void 0?P:!0,int32range:(S=_.int32range)!==null&&S!==void 0?S:!0,uriResolver:u}}class i8{constructor(_={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,_=this.opts={..._,...Zh(_)};let{es5:z,lines:A}=this.opts.code;this.scope=new Xh.ValueScope({scope:{},prefixes:$h,es5:z,lines:A}),this.logger=Uh(_.logger);let G=_.validateFormats;if(_.validateFormats=!1,this.RULES=(0,Yh.getRules)(),cK.call(this,Hh,_,"NOT SUPPORTED"),cK.call(this,Bh,_,"DEPRECATED","warn"),this._metaOpts=Wh.call(this),_.formats)Fh.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),_.keywords)Kh.call(this,_.keywords);if(typeof _.meta=="object")this.addMetaSchema(_.meta);qh.call(this),_.validateFormats=G}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:_,meta:z,schemaId:A}=this.opts,G=mK;if(A==="id")G={...mK},G.id=G.$id,delete G.$id;if(z&&_)this.addMetaSchema(G,G[A],!1)}defaultMeta(){let{meta:_,schemaId:z}=this.opts;return this.opts.defaultMeta=typeof _=="object"?_[z]||_:void 0}validate(_,z){let A;if(typeof _=="string"){if(A=this.getSchema(_),!A)throw Error(`no schema with key or ref "${_}"`)}else A=this.compile(_);let G=A(z);if(!("$async"in A))this.errors=A.errors;return G}compile(_,z){let A=this._addSchema(_,z);return A.validate||this._compileSchemaEnv(A)}compileAsync(_,z){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:A}=this.opts;return G.call(this,_,z);async function G($,H){await J.call(this,$.$schema);let B=this._addSchema($,H);return B.validate||Y.call(this,B)}async function J($){if($&&!this.getSchema($))await G.call(this,{$ref:$},!0)}async function Y($){try{return this._compileSchemaEnv($)}catch(H){if(!(H instanceof pK.default))throw H;return X.call(this,H),await b.call(this,H.missingSchema),Y.call(this,$)}}function X({missingSchema:$,missingRef:H}){if(this.refs[$])throw Error(`AnySchema ${$} is loaded but ${H} cannot be resolved`)}async function b($){let H=await Q.call(this,$);if(!this.refs[$])await J.call(this,H.$schema);if(!this.refs[$])this.addSchema(H,$,z)}async function Q($){let H=this._loading[$];if(H)return H;try{return await(this._loading[$]=A($))}finally{delete this._loading[$]}}}addSchema(_,z,A,G=this.opts.validateSchema){if(Array.isArray(_)){for(let Y of _)this.addSchema(Y,void 0,A,G);return this}let J;if(typeof _==="object"){let{schemaId:Y}=this.opts;if(J=_[Y],J!==void 0&&typeof J!="string")throw Error(`schema ${Y} must be string`)}return z=(0,L3.normalizeId)(z||J),this._checkUnique(z),this.schemas[z]=this._addSchema(_,A,z,G,!0),this}addMetaSchema(_,z,A=this.opts.validateSchema){return this.addSchema(_,z,!0,A),this}validateSchema(_,z){if(typeof _=="boolean")return!0;let A;if(A=_.$schema,A!==void 0&&typeof A!="string")throw Error("$schema must be a string");if(A=A||this.opts.defaultMeta||this.defaultMeta(),!A)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let G=this.validate(A,_);if(!G&&z){let J="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(J);else throw Error(J)}return G}getSchema(_){let z;while(typeof(z=lK.call(this,_))=="string")_=z;if(z===void 0){let{schemaId:A}=this.opts,G=new O3.SchemaEnv({schema:{},schemaId:A});if(z=O3.resolveSchema.call(this,G,_),!z)return;this.refs[_]=z}return z.validate||this._compileSchemaEnv(z)}removeSchema(_){if(_ instanceof RegExp)return this._removeAllSchemas(this.schemas,_),this._removeAllSchemas(this.refs,_),this;switch(typeof _){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let z=lK.call(this,_);if(typeof z=="object")this._cache.delete(z.schema);return delete this.schemas[_],delete this.refs[_],this}case"object":{let z=_;this._cache.delete(z);let A=_[this.opts.schemaId];if(A)A=(0,L3.normalizeId)(A),delete this.schemas[A],delete this.refs[A];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(_){for(let z of _)this.addKeyword(z);return this}addKeyword(_,z){let A;if(typeof _=="string"){if(A=_,typeof z=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),z.keyword=A}else if(typeof _=="object"&&z===void 0){if(z=_,A=z.keyword,Array.isArray(A)&&!A.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(Mh.call(this,A,z),!z)return(0,qG.eachItem)(A,(J)=>ZG.call(this,J)),this;Eh.call(this,z);let G={...z,type:(0,n8.getJSONTypes)(z.type),schemaType:(0,n8.getJSONTypes)(z.schemaType)};return(0,qG.eachItem)(A,G.type.length===0?(J)=>ZG.call(this,J,G):(J)=>G.type.forEach((Y)=>ZG.call(this,J,G,Y))),this}getKeyword(_){let z=this.RULES.all[_];return typeof z=="object"?z.definition:!!z}removeKeyword(_){let{RULES:z}=this;delete z.keywords[_],delete z.all[_];for(let A of z.rules){let G=A.rules.findIndex((J)=>J.keyword===_);if(G>=0)A.rules.splice(G,1)}return this}addFormat(_,z){if(typeof z=="string")z=new RegExp(z);return this.formats[_]=z,this}errorsText(_=this.errors,{separator:z=", ",dataVar:A="data"}={}){if(!_||_.length===0)return"No errors";return _.map((G)=>`${A}${G.instancePath} ${G.message}`).reduce((G,J)=>G+z+J)}$dataMetaSchema(_,z){let A=this.RULES.all;_=JSON.parse(JSON.stringify(_));for(let G of z){let J=G.split("/").slice(1),Y=_;for(let X of J)Y=Y[X];for(let X in A){let b=A[X];if(typeof b!="object")continue;let{$data:Q}=b.definition,$=Y[X];if(Q&&$)Y[X]=rK($)}}return _}_removeAllSchemas(_,z){for(let A in _){let G=_[A];if(!z||z.test(A)){if(typeof G=="string")delete _[A];else if(G&&!G.meta)this._cache.delete(G.schema),delete _[A]}}}_addSchema(_,z,A,G=this.opts.validateSchema,J=this.opts.addUsedSchema){let Y,{schemaId:X}=this.opts;if(typeof _=="object")Y=_[X];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof _!="boolean")throw Error("schema must be object or boolean");let b=this._cache.get(_);if(b!==void 0)return b;A=(0,L3.normalizeId)(Y||A);let Q=L3.getSchemaRefs.call(this,_,A);if(b=new O3.SchemaEnv({schema:_,schemaId:X,meta:z,baseId:A,localRefs:Q}),this._cache.set(b.schema,b),J&&!A.startsWith("#")){if(A)this._checkUnique(A);this.refs[A]=b}if(G)this.validateSchema(_,!0);return b}_checkUnique(_){if(this.schemas[_]||this.refs[_])throw Error(`schema with key or id "${_}" already exists`)}_compileSchemaEnv(_){if(_.meta)this._compileMetaSchema(_);else O3.compileSchema.call(this,_);if(!_.validate)throw Error("ajv implementation error");return _.validate}_compileMetaSchema(_){let z=this.opts;this.opts=this._metaOpts;try{O3.compileSchema.call(this,_)}finally{this.opts=z}}}i8.ValidationError=Jh.default;i8.MissingRefError=pK.default;d4.default=i8;function cK(_,z,A,G="error"){for(let J in _){let Y=J;if(Y in z)this.logger[G](`${A}: option ${J}. ${_[Y]}`)}}function lK(_){return _=(0,L3.normalizeId)(_),this.schemas[_]||this.refs[_]}function qh(){let _=this.opts.schemas;if(!_)return;if(Array.isArray(_))this.addSchema(_);else for(let z in _)this.addSchema(_[z],z)}function Fh(){for(let _ in this.opts.formats){let z=this.opts.formats[_];if(z)this.addFormat(_,z)}}function Kh(_){if(Array.isArray(_)){this.addVocabulary(_);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let z in _){let A=_[z];if(!A.keyword)A.keyword=z;this.addKeyword(A)}}function Wh(){let _={...this.opts};for(let z of Qh)delete _[z];return _}var Vh={log(){},warn(){},error(){}};function Uh(_){if(_===!1)return Vh;if(_===void 0)return console;if(_.log&&_.warn&&_.error)return _;throw Error("logger must implement log, warn and error methods")}var Dh=/^[a-z_$][a-z0-9_$:-]*$/i;function Mh(_,z){let{RULES:A}=this;if((0,qG.eachItem)(_,(G)=>{if(A.keywords[G])throw Error(`Keyword ${G} is already defined`);if(!Dh.test(G))throw Error(`Keyword ${G} has invalid name`)}),!z)return;if(z.$data&&!(("code"in z)||("validate"in z)))throw Error('$data keyword must have "code" or "validate" function')}function ZG(_,z,A){var G;let J=z===null||z===void 0?void 0:z.post;if(A&&J)throw Error('keyword with "post" flag cannot have "type"');let{RULES:Y}=this,X=J?Y.post:Y.rules.find(({type:Q})=>Q===A);if(!X)X={type:A,rules:[]},Y.rules.push(X);if(Y.keywords[_]=!0,!z)return;let b={keyword:_,definition:{...z,type:(0,n8.getJSONTypes)(z.type),schemaType:(0,n8.getJSONTypes)(z.schemaType)}};if(z.before)Nh.call(this,X,b,z.before);else X.rules.push(b);Y.all[_]=b,(G=z.implements)===null||G===void 0||G.forEach((Q)=>this.addKeyword(Q))}function Nh(_,z,A){let G=_.rules.findIndex((J)=>J.keyword===A);if(G>=0)_.rules.splice(G,0,z);else _.rules.push(z),this.logger.warn(`rule ${A} is not defined`)}function Eh(_){let{metaSchema:z}=_;if(z===void 0)return;if(_.$data&&this.opts.$data)z=rK(z);_.validateSchema=this.compile(z,!0)}var wh={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function rK(_){return{anyOf:[_,wh]}}});var oK=x((iK)=>{Object.defineProperty(iK,"__esModule",{value:!0});var jh={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};iK.default=jh});var zW=x((eK)=>{Object.defineProperty(eK,"__esModule",{value:!0});eK.callRef=eK.getValidate=void 0;var Ph=N3(),aK=x9(),K9=e(),t1=c4(),sK=c8(),o8=Q0(),Sh={keyword:"$ref",schemaType:"string",code(_){let{gen:z,schema:A,it:G}=_,{baseId:J,schemaEnv:Y,validateName:X,opts:b,self:Q}=G,{root:$}=Y;if((A==="#"||A==="#/")&&J===$.baseId)return B();let H=sK.resolveRef.call(Q,$,J,A);if(H===void 0)throw new Ph.default(G.opts.uriResolver,J,A);if(H instanceof sK.SchemaEnv)return Z(H);return q(H);function B(){if(Y===$)return a8(_,X,Y,Y.$async);let F=z.scopeValue("root",{ref:$});return a8(_,K9._`${F}.validate`,$,$.$async)}function Z(F){let K=tK(_,F);a8(_,K,F,F.$async)}function q(F){let K=z.scopeValue("schema",b.code.source===!0?{ref:F,code:(0,K9.stringify)(F)}:{ref:F}),W=z.name("valid"),V=_.subschema({schema:F,dataTypes:[],schemaPath:K9.nil,topSchemaRef:K,errSchemaPath:A},W);_.mergeEvaluated(V),_.ok(W)}}};function tK(_,z){let{gen:A}=_;return z.validate?A.scopeValue("validate",{ref:z.validate}):K9._`${A.scopeValue("wrapper",{ref:z})}.validate`}eK.getValidate=tK;function a8(_,z,A,G){let{gen:J,it:Y}=_,{allErrors:X,schemaEnv:b,opts:Q}=Y,$=Q.passContext?t1.default.this:K9.nil;if(G)H();else B();function H(){if(!b.$async)throw Error("async schema referenced by sync schema");let F=J.let("valid");J.try(()=>{if(J.code(K9._`await ${(0,aK.callValidateCode)(_,z,$)}`),q(z),!X)J.assign(F,!0)},(K)=>{if(J.if(K9._`!(${K} instanceof ${Y.ValidationError})`,()=>J.throw(K)),Z(K),!X)J.assign(F,!1)}),_.ok(F)}function B(){_.result((0,aK.callValidateCode)(_,z,$),()=>q(z),()=>Z(z))}function Z(F){let K=K9._`${F}.errors`;J.assign(t1.default.vErrors,K9._`${t1.default.vErrors} === null ? ${K} : ${t1.default.vErrors}.concat(${K})`),J.assign(t1.default.errors,K9._`${t1.default.vErrors}.length`)}function q(F){var K;if(!Y.opts.unevaluated)return;let W=(K=A===null||A===void 0?void 0:A.validate)===null||K===void 0?void 0:K.evaluated;if(Y.props!==!0)if(W&&!W.dynamicProps){if(W.props!==void 0)Y.props=o8.mergeEvaluated.props(J,W.props,Y.props)}else{let V=J.var("props",K9._`${F}.evaluated.props`);Y.props=o8.mergeEvaluated.props(J,V,Y.props,K9.Name)}if(Y.items!==!0)if(W&&!W.dynamicItems){if(W.items!==void 0)Y.items=o8.mergeEvaluated.items(J,W.items,Y.items)}else{let V=J.var("items",K9._`${F}.evaluated.items`);Y.items=o8.mergeEvaluated.items(J,V,Y.items,K9.Name)}}}eK.callRef=a8;eK.default=Sh});var GW=x((AW)=>{Object.defineProperty(AW,"__esModule",{value:!0});var xh=oK(),Th=zW(),Ch=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",xh.default,Th.default];AW.default=Ch});var YW=x((JW)=>{Object.defineProperty(JW,"__esModule",{value:!0});var s8=e(),w_=s8.operators,t8={maximum:{okStr:"<=",ok:w_.LTE,fail:w_.GT},minimum:{okStr:">=",ok:w_.GTE,fail:w_.LT},exclusiveMaximum:{okStr:"<",ok:w_.LT,fail:w_.GTE},exclusiveMinimum:{okStr:">",ok:w_.GT,fail:w_.LTE}},yh={message:({keyword:_,schemaCode:z})=>s8.str`must be ${t8[_].okStr} ${z}`,params:({keyword:_,schemaCode:z})=>s8._`{comparison: ${t8[_].okStr}, limit: ${z}}`},gh={keyword:Object.keys(t8),type:"number",schemaType:"number",$data:!0,error:yh,code(_){let{keyword:z,data:A,schemaCode:G}=_;_.fail$data(s8._`${A} ${t8[z].fail} ${G} || isNaN(${A})`)}};JW.default=gh});var bW=x((XW)=>{Object.defineProperty(XW,"__esModule",{value:!0});var j3=e(),hh={message:({schemaCode:_})=>j3.str`must be multiple of ${_}`,params:({schemaCode:_})=>j3._`{multipleOf: ${_}}`},mh={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:hh,code(_){let{gen:z,data:A,schemaCode:G,it:J}=_,Y=J.opts.multipleOfPrecision,X=z.let("res"),b=Y?j3._`Math.abs(Math.round(${X}) - ${X}) > 1e-${Y}`:j3._`${X} !== parseInt(${X})`;_.fail$data(j3._`(${G} === 0 || (${X} = ${A}/${G}, ${b}))`)}};XW.default=mh});var HW=x(($W)=>{Object.defineProperty($W,"__esModule",{value:!0});function QW(_){let z=_.length,A=0,G=0,J;while(G<z)if(A++,J=_.charCodeAt(G++),J>=55296&&J<=56319&&G<z){if(J=_.charCodeAt(G),(J&64512)===56320)G++}return A}$W.default=QW;QW.code='require("ajv/dist/runtime/ucs2length").default'});var ZW=x((BW)=>{Object.defineProperty(BW,"__esModule",{value:!0});var i_=e(),lh=Q0(),ph=HW(),dh={message({keyword:_,schemaCode:z}){let A=_==="maxLength"?"more":"fewer";return i_.str`must NOT have ${A} than ${z} characters`},params:({schemaCode:_})=>i_._`{limit: ${_}}`},rh={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:dh,code(_){let{keyword:z,data:A,schemaCode:G,it:J}=_,Y=z==="maxLength"?i_.operators.GT:i_.operators.LT,X=J.opts.unicode===!1?i_._`${A}.length`:i_._`${(0,lh.useFunc)(_.gen,ph.default)}(${A})`;_.fail$data(i_._`${X} ${Y} ${G}`)}};BW.default=rh});var FW=x((qW)=>{Object.defineProperty(qW,"__esModule",{value:!0});var ih=x9(),e8=e(),oh={message:({schemaCode:_})=>e8.str`must match pattern "${_}"`,params:({schemaCode:_})=>e8._`{pattern: ${_}}`},ah={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:oh,code(_){let{data:z,$data:A,schema:G,schemaCode:J,it:Y}=_,X=Y.opts.unicodeRegExp?"u":"",b=A?e8._`(new RegExp(${J}, ${X}))`:(0,ih.usePattern)(_,G);_.fail$data(e8._`!${b}.test(${z})`)}};qW.default=ah});var WW=x((KW)=>{Object.defineProperty(KW,"__esModule",{value:!0});var R3=e(),th={message({keyword:_,schemaCode:z}){let A=_==="maxProperties"?"more":"fewer";return R3.str`must NOT have ${A} than ${z} properties`},params:({schemaCode:_})=>R3._`{limit: ${_}}`},eh={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:th,code(_){let{keyword:z,data:A,schemaCode:G}=_,J=z==="maxProperties"?R3.operators.GT:R3.operators.LT;_.fail$data(R3._`Object.keys(${A}).length ${J} ${G}`)}};KW.default=eh});var UW=x((VW)=>{Object.defineProperty(VW,"__esModule",{value:!0});var P3=x9(),S3=e(),zm=Q0(),Am={message:({params:{missingProperty:_}})=>S3.str`must have required property '${_}'`,params:({params:{missingProperty:_}})=>S3._`{missingProperty: ${_}}`},Gm={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Am,code(_){let{gen:z,schema:A,schemaCode:G,data:J,$data:Y,it:X}=_,{opts:b}=X;if(!Y&&A.length===0)return;let Q=A.length>=b.loopRequired;if(X.allErrors)$();else H();if(b.strictRequired){let q=_.parentSchema.properties,{definedProperties:F}=_.it;for(let K of A)if((q===null||q===void 0?void 0:q[K])===void 0&&!F.has(K)){let W=X.schemaEnv.baseId+X.errSchemaPath,V=`required property "${K}" is not defined at "${W}" (strictRequired)`;(0,zm.checkStrictMode)(X,V,X.opts.strictRequired)}}function $(){if(Q||Y)_.block$data(S3.nil,B);else for(let q of A)(0,P3.checkReportMissingProp)(_,q)}function H(){let q=z.let("missing");if(Q||Y){let F=z.let("valid",!0);_.block$data(F,()=>Z(q,F)),_.ok(F)}else z.if((0,P3.checkMissingProp)(_,A,q)),(0,P3.reportMissingProp)(_,q),z.else()}function B(){z.forOf("prop",G,(q)=>{_.setParams({missingProperty:q}),z.if((0,P3.noPropertyInData)(z,J,q,b.ownProperties),()=>_.error())})}function Z(q,F){_.setParams({missingProperty:q}),z.forOf(q,G,()=>{z.assign(F,(0,P3.propertyInData)(z,J,q,b.ownProperties)),z.if((0,S3.not)(F),()=>{_.error(),z.break()})},S3.nil)}}};VW.default=Gm});var MW=x((DW)=>{Object.defineProperty(DW,"__esModule",{value:!0});var k3=e(),Ym={message({keyword:_,schemaCode:z}){let A=_==="maxItems"?"more":"fewer";return k3.str`must NOT have ${A} than ${z} items`},params:({schemaCode:_})=>k3._`{limit: ${_}}`},Xm={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Ym,code(_){let{keyword:z,data:A,schemaCode:G}=_,J=z==="maxItems"?k3.operators.GT:k3.operators.LT;_.fail$data(k3._`${A}.length ${J} ${G}`)}};DW.default=Xm});var _A=x((EW)=>{Object.defineProperty(EW,"__esModule",{value:!0});var NW=t7();NW.code='require("ajv/dist/runtime/equal").default';EW.default=NW});var OW=x((wW)=>{Object.defineProperty(wW,"__esModule",{value:!0});var FG=W3(),n0=e(),$m=Q0(),Hm=_A(),Bm={message:({params:{i:_,j:z}})=>n0.str`must NOT have duplicate items (items ## ${z} and ${_} are identical)`,params:({params:{i:_,j:z}})=>n0._`{i: ${_}, j: ${z}}`},Zm={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Bm,code(_){let{gen:z,data:A,$data:G,schema:J,parentSchema:Y,schemaCode:X,it:b}=_;if(!G&&!J)return;let Q=z.let("valid"),$=Y.items?(0,FG.getSchemaTypes)(Y.items):[];_.block$data(Q,H,n0._`${X} === false`),_.ok(Q);function H(){let F=z.let("i",n0._`${A}.length`),K=z.let("j");_.setParams({i:F,j:K}),z.assign(Q,!0),z.if(n0._`${F} > 1`,()=>(B()?Z:q)(F,K))}function B(){return $.length>0&&!$.some((F)=>F==="object"||F==="array")}function Z(F,K){let W=z.name("item"),V=(0,FG.checkDataTypes)($,W,b.opts.strictNumbers,FG.DataType.Wrong),N=z.const("indices",n0._`{}`);z.for(n0._`;${F}--;`,()=>{if(z.let(W,n0._`${A}[${F}]`),z.if(V,n0._`continue`),$.length>1)z.if(n0._`typeof ${W} == "string"`,n0._`${W} += "_"`);z.if(n0._`typeof ${N}[${W}] == "number"`,()=>{z.assign(K,n0._`${N}[${W}]`),_.error(),z.assign(Q,!1).break()}).code(n0._`${N}[${W}] = ${F}`)})}function q(F,K){let W=(0,$m.useFunc)(z,Hm.default),V=z.name("outer");z.label(V).for(n0._`;${F}--;`,()=>z.for(n0._`${K} = ${F}; ${K}--;`,()=>z.if(n0._`${W}(${A}[${F}], ${A}[${K}])`,()=>{_.error(),z.assign(Q,!1).break(V)})))}}};wW.default=Zm});var jW=x((LW)=>{Object.defineProperty(LW,"__esModule",{value:!0});var KG=e(),Fm=Q0(),Km=_A(),Wm={message:"must be equal to constant",params:({schemaCode:_})=>KG._`{allowedValue: ${_}}`},Vm={keyword:"const",$data:!0,error:Wm,code(_){let{gen:z,data:A,$data:G,schemaCode:J,schema:Y}=_;if(G||Y&&typeof Y=="object")_.fail$data(KG._`!${(0,Fm.useFunc)(z,Km.default)}(${A}, ${J})`);else _.fail(KG._`${Y} !== ${A}`)}};LW.default=Vm});var PW=x((RW)=>{Object.defineProperty(RW,"__esModule",{value:!0});var I3=e(),Dm=Q0(),Mm=_A(),Nm={message:"must be equal to one of the allowed values",params:({schemaCode:_})=>I3._`{allowedValues: ${_}}`},Em={keyword:"enum",schemaType:"array",$data:!0,error:Nm,code(_){let{gen:z,data:A,$data:G,schema:J,schemaCode:Y,it:X}=_;if(!G&&J.length===0)throw Error("enum must have non-empty array");let b=J.length>=X.opts.loopEnum,Q,$=()=>Q!==null&&Q!==void 0?Q:Q=(0,Dm.useFunc)(z,Mm.default),H;if(b||G)H=z.let("valid"),_.block$data(H,B);else{if(!Array.isArray(J))throw Error("ajv implementation error");let q=z.const("vSchema",Y);H=(0,I3.or)(...J.map((F,K)=>Z(q,K)))}_.pass(H);function B(){z.assign(H,!1),z.forOf("v",Y,(q)=>z.if(I3._`${$()}(${A}, ${q})`,()=>z.assign(H,!0).break()))}function Z(q,F){let K=J[F];return typeof K==="object"&&K!==null?I3._`${$()}(${A}, ${q}[${F}])`:I3._`${A} === ${K}`}}};RW.default=Em});var kW=x((SW)=>{Object.defineProperty(SW,"__esModule",{value:!0});var Om=YW(),Lm=bW(),jm=ZW(),Rm=FW(),Pm=WW(),Sm=UW(),km=MW(),Im=OW(),xm=jW(),Tm=PW(),Cm=[Om.default,Lm.default,jm.default,Rm.default,Pm.default,Sm.default,km.default,Im.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},xm.default,Tm.default];SW.default=Cm});var VG=x((xW)=>{Object.defineProperty(xW,"__esModule",{value:!0});xW.validateAdditionalItems=void 0;var o_=e(),WG=Q0(),ym={message:({params:{len:_}})=>o_.str`must NOT have more than ${_} items`,params:({params:{len:_}})=>o_._`{limit: ${_}}`},gm={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:ym,code(_){let{parentSchema:z,it:A}=_,{items:G}=z;if(!Array.isArray(G)){(0,WG.checkStrictMode)(A,'"additionalItems" is ignored when "items" is not an array of schemas');return}IW(_,G)}};function IW(_,z){let{gen:A,schema:G,data:J,keyword:Y,it:X}=_;X.items=!0;let b=A.const("len",o_._`${J}.length`);if(G===!1)_.setParams({len:z.length}),_.pass(o_._`${b} <= ${z.length}`);else if(typeof G=="object"&&!(0,WG.alwaysValidSchema)(X,G)){let $=A.var("valid",o_._`${b} <= ${z.length}`);A.if((0,o_.not)($),()=>Q($)),_.ok($)}function Q($){A.forRange("i",z.length,b,(H)=>{if(_.subschema({keyword:Y,dataProp:H,dataPropType:WG.Type.Num},$),!X.allErrors)A.if((0,o_.not)($),()=>A.break())})}}xW.validateAdditionalItems=IW;xW.default=gm});var UG=x((yW)=>{Object.defineProperty(yW,"__esModule",{value:!0});yW.validateTuple=void 0;var CW=e(),zA=Q0(),hm=x9(),mm={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(_){let{schema:z,it:A}=_;if(Array.isArray(z))return vW(_,"additionalItems",z);if(A.items=!0,(0,zA.alwaysValidSchema)(A,z))return;_.ok((0,hm.validateArray)(_))}};function vW(_,z,A=_.schema){let{gen:G,parentSchema:J,data:Y,keyword:X,it:b}=_;if(H(J),b.opts.unevaluated&&A.length&&b.items!==!0)b.items=zA.mergeEvaluated.items(G,A.length,b.items);let Q=G.name("valid"),$=G.const("len",CW._`${Y}.length`);A.forEach((B,Z)=>{if((0,zA.alwaysValidSchema)(b,B))return;G.if(CW._`${$} > ${Z}`,()=>_.subschema({keyword:X,schemaProp:Z,dataProp:Z},Q)),_.ok(Q)});function H(B){let{opts:Z,errSchemaPath:q}=b,F=A.length,K=F===B.minItems&&(F===B.maxItems||B[z]===!1);if(Z.strictTuples&&!K){let W=`"${X}" is ${F}-tuple, but minItems or maxItems/${z} are not specified or different at path "${q}"`;(0,zA.checkStrictMode)(b,W,Z.strictTuples)}}}yW.validateTuple=vW;yW.default=mm});var hW=x((fW)=>{Object.defineProperty(fW,"__esModule",{value:!0});var cm=UG(),lm={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(_)=>(0,cm.validateTuple)(_,"items")};fW.default=lm});var cW=x((uW)=>{Object.defineProperty(uW,"__esModule",{value:!0});var mW=e(),dm=Q0(),rm=x9(),nm=VG(),im={message:({params:{len:_}})=>mW.str`must NOT have more than ${_} items`,params:({params:{len:_}})=>mW._`{limit: ${_}}`},om={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:im,code(_){let{schema:z,parentSchema:A,it:G}=_,{prefixItems:J}=A;if(G.items=!0,(0,dm.alwaysValidSchema)(G,z))return;if(J)(0,nm.validateAdditionalItems)(_,J);else _.ok((0,rm.validateArray)(_))}};uW.default=om});var pW=x((lW)=>{Object.defineProperty(lW,"__esModule",{value:!0});var T9=e(),AA=Q0(),sm={message:({params:{min:_,max:z}})=>z===void 0?T9.str`must contain at least ${_} valid item(s)`:T9.str`must contain at least ${_} and no more than ${z} valid item(s)`,params:({params:{min:_,max:z}})=>z===void 0?T9._`{minContains: ${_}}`:T9._`{minContains: ${_}, maxContains: ${z}}`},tm={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:sm,code(_){let{gen:z,schema:A,parentSchema:G,data:J,it:Y}=_,X,b,{minContains:Q,maxContains:$}=G;if(Y.opts.next)X=Q===void 0?1:Q,b=$;else X=1;let H=z.const("len",T9._`${J}.length`);if(_.setParams({min:X,max:b}),b===void 0&&X===0){(0,AA.checkStrictMode)(Y,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(b!==void 0&&X>b){(0,AA.checkStrictMode)(Y,'"minContains" > "maxContains" is always invalid'),_.fail();return}if((0,AA.alwaysValidSchema)(Y,A)){let K=T9._`${H} >= ${X}`;if(b!==void 0)K=T9._`${K} && ${H} <= ${b}`;_.pass(K);return}Y.items=!0;let B=z.name("valid");if(b===void 0&&X===1)q(B,()=>z.if(B,()=>z.break()));else if(X===0){if(z.let(B,!0),b!==void 0)z.if(T9._`${J}.length > 0`,Z)}else z.let(B,!1),Z();_.result(B,()=>_.reset());function Z(){let K=z.name("_valid"),W=z.let("count",0);q(K,()=>z.if(K,()=>F(W)))}function q(K,W){z.forRange("i",0,H,(V)=>{_.subschema({keyword:"contains",dataProp:V,dataPropType:AA.Type.Num,compositeRule:!0},K),W()})}function F(K){if(z.code(T9._`${K}++`),b===void 0)z.if(T9._`${K} >= ${X}`,()=>z.assign(B,!0).break());else if(z.if(T9._`${K} > ${b}`,()=>z.assign(B,!1).break()),X===1)z.assign(B,!0);else z.if(T9._`${K} >= ${X}`,()=>z.assign(B,!0))}}};lW.default=tm});var aW=x((nW)=>{Object.defineProperty(nW,"__esModule",{value:!0});nW.validateSchemaDeps=nW.validatePropertyDeps=nW.error=void 0;var DG=e(),_u=Q0(),x3=x9();nW.error={message:({params:{property:_,depsCount:z,deps:A}})=>{let G=z===1?"property":"properties";return DG.str`must have ${G} ${A} when property ${_} is present`},params:({params:{property:_,depsCount:z,deps:A,missingProperty:G}})=>DG._`{property: ${_},
32
+ missingProperty: ${G},
33
33
  depsCount: ${z},
34
- deps: ${A}}`};var mh={keyword:"dependencies",type:"object",schemaType:"object",error:DW.error,code(_){let[z,A]=uh(_);VW(_,z),UW(_,A)}};function uh({schema:_}){let z={},A={};for(let b in _){if(b==="__proto__")continue;let G=Array.isArray(_[b])?z:A;G[b]=_[b]}return[z,A]}function VW(_,z=_.schema){let{gen:A,data:b,it:G}=_;if(Object.keys(z).length===0)return;let J=A.let("missing");for(let Y in z){let X=z[Y];if(X.length===0)continue;let Q=(0,j3.propertyInData)(A,b,Y,G.opts.ownProperties);if(_.setParams({property:Y,depsCount:X.length,deps:X.join(", ")}),G.allErrors)A.if(Q,()=>{for(let $ of X)(0,j3.checkReportMissingProp)(_,$)});else A.if(Jb._`${Q} && (${(0,j3.checkMissingProp)(_,X,J)})`),(0,j3.reportMissingProp)(_,J),A.else()}}DW.validatePropertyDeps=VW;function UW(_,z=_.schema){let{gen:A,data:b,keyword:G,it:J}=_,Y=A.name("valid");for(let X in z){if((0,hh.alwaysValidSchema)(J,z[X]))continue;A.if((0,j3.propertyInData)(A,b,X,J.opts.ownProperties),()=>{let Q=_.subschema({keyword:G,schemaProp:X},Y);_.mergeValidEvaluated(Q,Y)},()=>A.var(Y,!0)),_.ok(Y)}}DW.validateSchemaDeps=UW;DW.default=mh});var LW=I((OW)=>{Object.defineProperty(OW,"__esModule",{value:!0});var EW=t(),ph=Q0(),dh={message:"property name must be valid",params:({params:_})=>EW._`{propertyName: ${_.propertyName}}`},rh={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:dh,code(_){let{gen:z,schema:A,data:b,it:G}=_;if((0,ph.alwaysValidSchema)(G,A))return;let J=z.name("valid");z.forIn("key",b,(Y)=>{_.setParams({propertyName:Y}),_.subschema({keyword:"propertyNames",data:Y,dataTypes:["string"],propertyName:Y,compositeRule:!0},J),z.if((0,EW.not)(J),()=>{if(_.error(!0),!G.allErrors)z.break()})}),_.ok(J)}};OW.default=rh});var Yb=I((jW)=>{Object.defineProperty(jW,"__esModule",{value:!0});var oA=R9(),o9=t(),ih=v4(),aA=Q0(),oh={message:"must NOT have additional properties",params:({params:_})=>o9._`{additionalProperty: ${_.additionalProperty}}`},ah={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:oh,code(_){let{gen:z,schema:A,parentSchema:b,data:G,errsCount:J,it:Y}=_;if(!J)throw Error("ajv implementation error");let{allErrors:X,opts:Q}=Y;if(Y.props=!0,Q.removeAdditional!=="all"&&(0,aA.alwaysValidSchema)(Y,A))return;let $=(0,oA.allSchemaProperties)(b.properties),H=(0,oA.allSchemaProperties)(b.patternProperties);B(),_.ok(o9._`${J} === ${ih.default.errors}`);function B(){z.forIn("key",G,(W)=>{if(!$.length&&!H.length)K(W);else z.if(Z(W),()=>K(W))})}function Z(W){let V;if($.length>8){let w=(0,aA.schemaRefOrVal)(Y,b.properties,"properties");V=(0,oA.isOwnProperty)(z,w,W)}else if($.length)V=(0,o9.or)(...$.map((w)=>o9._`${W} === ${w}`));else V=o9.nil;if(H.length)V=(0,o9.or)(V,...H.map((w)=>o9._`${(0,oA.usePattern)(_,w)}.test(${W})`));return(0,o9.not)(V)}function F(W){z.code(o9._`delete ${G}[${W}]`)}function K(W){if(Q.removeAdditional==="all"||Q.removeAdditional&&A===!1){F(W);return}if(A===!1){if(_.setParams({additionalProperty:W}),_.error(),!X)z.break();return}if(typeof A=="object"&&!(0,aA.alwaysValidSchema)(Y,A)){let V=z.name("valid");if(Q.removeAdditional==="failing")q(W,V,!1),z.if((0,o9.not)(V),()=>{_.reset(),F(W)});else if(q(W,V),!X)z.if((0,o9.not)(V),()=>z.break())}}function q(W,V,w){let O={keyword:"additionalProperties",dataProp:W,dataPropType:aA.Type.Str};if(w===!1)Object.assign(O,{compositeRule:!0,createErrors:!1,allErrors:!1});_.subschema(O,V)}}};jW.default=ah});var kW=I((SW)=>{Object.defineProperty(SW,"__esModule",{value:!0});var th=K3(),RW=R9(),Xb=Q0(),PW=Yb(),eh={keyword:"properties",type:"object",schemaType:"object",code(_){let{gen:z,schema:A,parentSchema:b,data:G,it:J}=_;if(J.opts.removeAdditional==="all"&&b.additionalProperties===void 0)PW.default.code(new th.KeywordCxt(J,PW.default,"additionalProperties"));let Y=(0,RW.allSchemaProperties)(A);for(let B of Y)J.definedProperties.add(B);if(J.opts.unevaluated&&Y.length&&J.props!==!0)J.props=Xb.mergeEvaluated.props(z,(0,Xb.toHash)(Y),J.props);let X=Y.filter((B)=>!(0,Xb.alwaysValidSchema)(J,A[B]));if(X.length===0)return;let Q=z.name("valid");for(let B of X){if($(B))H(B);else{if(z.if((0,RW.propertyInData)(z,G,B,J.opts.ownProperties)),H(B),!J.allErrors)z.else().var(Q,!0);z.endIf()}_.it.definedProperties.add(B),_.ok(Q)}function $(B){return J.opts.useDefaults&&!J.compositeRule&&A[B].default!==void 0}function H(B){_.subschema({keyword:"properties",schemaProp:B,dataProp:B},Q)}}};SW.default=eh});var vW=I((CW)=>{Object.defineProperty(CW,"__esModule",{value:!0});var IW=R9(),sA=t(),xW=Q0(),TW=Q0(),zm={keyword:"patternProperties",type:"object",schemaType:"object",code(_){let{gen:z,schema:A,data:b,parentSchema:G,it:J}=_,{opts:Y}=J,X=(0,IW.allSchemaProperties)(A),Q=X.filter((q)=>(0,xW.alwaysValidSchema)(J,A[q]));if(X.length===0||Q.length===X.length&&(!J.opts.unevaluated||J.props===!0))return;let $=Y.strictSchema&&!Y.allowMatchingProperties&&G.properties,H=z.name("valid");if(J.props!==!0&&!(J.props instanceof sA.Name))J.props=(0,TW.evaluatedPropsToName)(z,J.props);let{props:B}=J;Z();function Z(){for(let q of X){if($)F(q);if(J.allErrors)K(q);else z.var(H,!0),K(q),z.if(H)}}function F(q){for(let W in $)if(new RegExp(q).test(W))(0,xW.checkStrictMode)(J,`property ${W} matches pattern ${q} (use allowMatchingProperties)`)}function K(q){z.forIn("key",b,(W)=>{z.if(sA._`${(0,IW.usePattern)(_,q)}.test(${W})`,()=>{let V=Q.includes(q);if(!V)_.subschema({keyword:"patternProperties",schemaProp:q,dataProp:W,dataPropType:TW.Type.Str},H);if(J.opts.unevaluated&&B!==!0)z.assign(sA._`${B}[${W}]`,!0);else if(!V&&!J.allErrors)z.if((0,sA.not)(H),()=>z.break())})})}}};CW.default=zm});var gW=I((yW)=>{Object.defineProperty(yW,"__esModule",{value:!0});var bm=Q0(),Gm={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(_){let{gen:z,schema:A,it:b}=_;if((0,bm.alwaysValidSchema)(b,A)){_.fail();return}let G=z.name("valid");_.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},G),_.failResult(G,()=>_.reset(),()=>_.error())},error:{message:"must NOT be valid"}};yW.default=Gm});var hW=I((fW)=>{Object.defineProperty(fW,"__esModule",{value:!0});var Ym=R9(),Xm={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Ym.validateUnion,error:{message:"must match a schema in anyOf"}};fW.default=Xm});var uW=I((mW)=>{Object.defineProperty(mW,"__esModule",{value:!0});var tA=t(),$m=Q0(),Hm={message:"must match exactly one schema in oneOf",params:({params:_})=>tA._`{passingSchemas: ${_.passing}}`},Bm={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Hm,code(_){let{gen:z,schema:A,parentSchema:b,it:G}=_;if(!Array.isArray(A))throw Error("ajv implementation error");if(G.opts.discriminator&&b.discriminator)return;let J=A,Y=z.let("valid",!1),X=z.let("passing",null),Q=z.name("_valid");_.setParams({passing:X}),z.block($),_.result(Y,()=>_.reset(),()=>_.error(!0));function $(){J.forEach((H,B)=>{let Z;if((0,$m.alwaysValidSchema)(G,H))z.var(Q,!0);else Z=_.subschema({keyword:"oneOf",schemaProp:B,compositeRule:!0},Q);if(B>0)z.if(tA._`${Q} && ${Y}`).assign(Y,!1).assign(X,tA._`[${X}, ${B}]`).else();z.if(Q,()=>{if(z.assign(Y,!0),z.assign(X,B),Z)_.mergeEvaluated(Z,tA.Name)})})}}};mW.default=Bm});var lW=I((cW)=>{Object.defineProperty(cW,"__esModule",{value:!0});var Fm=Q0(),Km={keyword:"allOf",schemaType:"array",code(_){let{gen:z,schema:A,it:b}=_;if(!Array.isArray(A))throw Error("ajv implementation error");let G=z.name("valid");A.forEach((J,Y)=>{if((0,Fm.alwaysValidSchema)(b,J))return;let X=_.subschema({keyword:"allOf",schemaProp:Y},G);_.ok(G),_.mergeEvaluated(X)})}};cW.default=Km});var nW=I((rW)=>{Object.defineProperty(rW,"__esModule",{value:!0});var eA=t(),dW=Q0(),Wm={message:({params:_})=>eA.str`must match "${_.ifClause}" schema`,params:({params:_})=>eA._`{failingKeyword: ${_.ifClause}}`},Vm={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Wm,code(_){let{gen:z,parentSchema:A,it:b}=_;if(A.then===void 0&&A.else===void 0)(0,dW.checkStrictMode)(b,'"if" without "then" and "else" is ignored');let G=pW(b,"then"),J=pW(b,"else");if(!G&&!J)return;let Y=z.let("valid",!0),X=z.name("_valid");if(Q(),_.reset(),G&&J){let H=z.let("ifClause");_.setParams({ifClause:H}),z.if(X,$("then",H),$("else",H))}else if(G)z.if(X,$("then"));else z.if((0,eA.not)(X),$("else"));_.pass(Y,()=>_.error(!0));function Q(){let H=_.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},X);_.mergeEvaluated(H)}function $(H,B){return()=>{let Z=_.subschema({keyword:H},X);if(z.assign(Y,X),_.mergeValidEvaluated(Z,Y),B)z.assign(B,eA._`${H}`);else _.setParams({ifClause:H})}}}};function pW(_,z){let A=_.schema[z];return A!==void 0&&!(0,dW.alwaysValidSchema)(_,A)}rW.default=Vm});var oW=I((iW)=>{Object.defineProperty(iW,"__esModule",{value:!0});var Dm=Q0(),Mm={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:_,parentSchema:z,it:A}){if(z.if===void 0)(0,Dm.checkStrictMode)(A,`"${_}" without "if" is ignored`)}};iW.default=Mm});var sW=I((aW)=>{Object.defineProperty(aW,"__esModule",{value:!0});var wm=bb(),Em=BW(),Om=Gb(),Lm=KW(),jm=WW(),Rm=wW(),Pm=LW(),Sm=Yb(),km=kW(),Im=vW(),xm=gW(),Tm=hW(),Cm=uW(),vm=lW(),ym=nW(),gm=oW();function fm(_=!1){let z=[xm.default,Tm.default,Cm.default,vm.default,ym.default,gm.default,Pm.default,Sm.default,Rm.default,km.default,Im.default];if(_)z.push(Em.default,Lm.default);else z.push(wm.default,Om.default);return z.push(jm.default),z}aW.default=fm});var eW=I((tW)=>{Object.defineProperty(tW,"__esModule",{value:!0});var x0=t(),mm={message:({schemaCode:_})=>x0.str`must match format "${_}"`,params:({schemaCode:_})=>x0._`{format: ${_}}`},um={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:mm,code(_,z){let{gen:A,data:b,$data:G,schema:J,schemaCode:Y,it:X}=_,{opts:Q,errSchemaPath:$,schemaEnv:H,self:B}=X;if(!Q.validateFormats)return;if(G)Z();else F();function Z(){let K=A.scopeValue("formats",{ref:B.formats,code:Q.code.formats}),q=A.const("fDef",x0._`${K}[${Y}]`),W=A.let("fType"),V=A.let("format");A.if(x0._`typeof ${q} == "object" && !(${q} instanceof RegExp)`,()=>A.assign(W,x0._`${q}.type || "string"`).assign(V,x0._`${q}.validate`),()=>A.assign(W,x0._`"string"`).assign(V,q)),_.fail$data((0,x0.or)(w(),O()));function w(){if(Q.strictSchema===!1)return x0.nil;return x0._`${Y} && !${V}`}function O(){let M=H.$async?x0._`(${q}.async ? await ${V}(${b}) : ${V}(${b}))`:x0._`${V}(${b})`,P=x0._`(typeof ${V} == "function" ? ${M} : ${V}.test(${b}))`;return x0._`${V} && ${V} !== true && ${W} === ${z} && !${P}`}}function F(){let K=B.formats[J];if(!K){w();return}if(K===!0)return;let[q,W,V]=O(K);if(q===z)_.pass(M());function w(){if(Q.strictSchema===!1){B.logger.warn(P());return}throw Error(P());function P(){return`unknown format "${J}" ignored in schema at path "${$}"`}}function O(P){let D=P instanceof RegExp?(0,x0.regexpCode)(P):Q.code.formats?x0._`${Q.code.formats}${(0,x0.getProperty)(J)}`:void 0,L=A.scopeValue("formats",{key:J,ref:P,code:D});if(typeof P=="object"&&!(P instanceof RegExp))return[P.type||"string",P.validate,x0._`${L}.validate`];return["string",P,L]}function M(){if(typeof K=="object"&&!(K instanceof RegExp)&&K.async){if(!H.$async)throw Error("async format in sync schema");return x0._`await ${V}(${b})`}return typeof W=="function"?x0._`${V}(${b})`:x0._`${V}.test(${b})`}}}};tW.default=um});var zV=I((_V)=>{Object.defineProperty(_V,"__esModule",{value:!0});var lm=eW(),pm=[lm.default];_V.default=pm});var GV=I((AV)=>{Object.defineProperty(AV,"__esModule",{value:!0});AV.contentVocabulary=AV.metadataVocabulary=void 0;AV.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];AV.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var XV=I((YV)=>{Object.defineProperty(YV,"__esModule",{value:!0});var nm=Sq(),im=AW(),om=sW(),am=zV(),JV=GV(),sm=[nm.default,im.default,(0,om.default)(),am.default,JV.metadataVocabulary,JV.contentVocabulary];YV.default=sm});var BV=I(($V)=>{Object.defineProperty($V,"__esModule",{value:!0});$V.DiscrError=void 0;var QV;(function(_){_.Tag="tag",_.Mapping="mapping"})(QV||($V.DiscrError=QV={}))});var KV=I((FV)=>{Object.defineProperty(FV,"__esModule",{value:!0});var r1=t(),Qb=BV(),ZV=CA(),em=q3(),_u=Q0(),zu={message:({params:{discrError:_,tagName:z}})=>_===Qb.DiscrError.Tag?`tag "${z}" must be string`:`value of tag "${z}" must be in oneOf`,params:({params:{discrError:_,tag:z,tagName:A}})=>r1._`{error: ${_}, tag: ${A}, tagValue: ${z}}`},Au={keyword:"discriminator",type:"object",schemaType:"object",error:zu,code(_){let{gen:z,data:A,schema:b,parentSchema:G,it:J}=_,{oneOf:Y}=G;if(!J.opts.discriminator)throw Error("discriminator: requires discriminator option");let X=b.propertyName;if(typeof X!="string")throw Error("discriminator: requires propertyName");if(b.mapping)throw Error("discriminator: mapping is not supported");if(!Y)throw Error("discriminator: requires oneOf keyword");let Q=z.let("valid",!1),$=z.const("tag",r1._`${A}${(0,r1.getProperty)(X)}`);z.if(r1._`typeof ${$} == "string"`,()=>H(),()=>_.error(!1,{discrError:Qb.DiscrError.Tag,tag:$,tagName:X})),_.ok(Q);function H(){let F=Z();z.if(!1);for(let K in F)z.elseIf(r1._`${$} === ${K}`),z.assign(Q,B(F[K]));z.else(),_.error(!1,{discrError:Qb.DiscrError.Mapping,tag:$,tagName:X}),z.endIf()}function B(F){let K=z.name("valid"),q=_.subschema({keyword:"oneOf",schemaProp:F},K);return _.mergeEvaluated(q,r1.Name),K}function Z(){var F;let K={},q=V(G),W=!0;for(let M=0;M<Y.length;M++){let P=Y[M];if((P===null||P===void 0?void 0:P.$ref)&&!(0,_u.schemaHasRulesButRef)(P,J.self.RULES)){let L=P.$ref;if(P=ZV.resolveRef.call(J.self,J.schemaEnv.root,J.baseId,L),P instanceof ZV.SchemaEnv)P=P.schema;if(P===void 0)throw new em.default(J.opts.uriResolver,J.baseId,L)}let D=(F=P===null||P===void 0?void 0:P.properties)===null||F===void 0?void 0:F[X];if(typeof D!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${X}"`);W=W&&(q||V(P)),w(D,M)}if(!W)throw Error(`discriminator: "${X}" must be required`);return K;function V({required:M}){return Array.isArray(M)&&M.includes(X)}function w(M,P){if(M.const)O(M.const,P);else if(M.enum)for(let D of M.enum)O(D,P);else throw Error(`discriminator: "properties/${X}" must have "const" or "enum"`)}function O(M,P){if(typeof M!="string"||M in K)throw Error(`discriminator: "${X}" values must be unique strings`);K[M]=P}}}};FV.default=Au});var qV=I((f60,Gu)=>{Gu.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}});var Hb=I((F9,$b)=>{Object.defineProperty(F9,"__esModule",{value:!0});F9.MissingRefError=F9.ValidationError=F9.CodeGen=F9.Name=F9.nil=F9.stringify=F9.str=F9._=F9.KeywordCxt=F9.Ajv=void 0;var Ju=Dq(),Yu=XV(),Xu=KV(),WV=qV(),Qu=["/properties"],_8="http://json-schema.org/draft-07/schema";class R3 extends Ju.default{_addVocabularies(){if(super._addVocabularies(),Yu.default.forEach((_)=>this.addVocabulary(_)),this.opts.discriminator)this.addKeyword(Xu.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let _=this.opts.$data?this.$dataMetaSchema(WV,Qu):WV;this.addMetaSchema(_,_8,!1),this.refs["http://json-schema.org/schema"]=_8}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(_8)?_8:void 0)}}F9.Ajv=R3;$b.exports=F9=R3;$b.exports.Ajv=R3;Object.defineProperty(F9,"__esModule",{value:!0});F9.default=R3;var $u=K3();Object.defineProperty(F9,"KeywordCxt",{enumerable:!0,get:function(){return $u.KeywordCxt}});var n1=t();Object.defineProperty(F9,"_",{enumerable:!0,get:function(){return n1._}});Object.defineProperty(F9,"str",{enumerable:!0,get:function(){return n1.str}});Object.defineProperty(F9,"stringify",{enumerable:!0,get:function(){return n1.stringify}});Object.defineProperty(F9,"nil",{enumerable:!0,get:function(){return n1.nil}});Object.defineProperty(F9,"Name",{enumerable:!0,get:function(){return n1.Name}});Object.defineProperty(F9,"CodeGen",{enumerable:!0,get:function(){return n1.CodeGen}});var Hu=xA();Object.defineProperty(F9,"ValidationError",{enumerable:!0,get:function(){return Hu.default}});var Bu=q3();Object.defineProperty(F9,"MissingRefError",{enumerable:!0,get:function(){return Bu.default}})});var jV=I((OV)=>{Object.defineProperty(OV,"__esModule",{value:!0});OV.formatNames=OV.fastFormats=OV.fullFormats=void 0;function K4(_,z){return{validate:_,compare:z}}OV.fullFormats={date:K4(MV,Kb),time:K4(Zb(!0),qb),"date-time":K4(VV(!0),wV),"iso-time":K4(Zb(),NV),"iso-date-time":K4(VV(),EV),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Du,"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:ju,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:Mu,int32:{type:"number",validate:Eu},int64:{type:"number",validate:Ou},float:{type:"number",validate:DV},double:{type:"number",validate:DV},password:!0,binary:!0};OV.fastFormats={...OV.fullFormats,date:K4(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Kb),time:K4(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,qb),"date-time":K4(/^\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,wV),"iso-time":K4(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,NV),"iso-date-time":K4(/^\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,EV),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};OV.formatNames=Object.keys(OV.fullFormats);function Ku(_){return _%4===0&&(_%100!==0||_%400===0)}var qu=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Wu=[0,31,28,31,30,31,30,31,31,30,31,30,31];function MV(_){let z=qu.exec(_);if(!z)return!1;let A=+z[1],b=+z[2],G=+z[3];return b>=1&&b<=12&&G>=1&&G<=(b===2&&Ku(A)?29:Wu[b])}function Kb(_,z){if(!(_&&z))return;if(_>z)return 1;if(_<z)return-1;return 0}var Bb=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Zb(_){return function(A){let b=Bb.exec(A);if(!b)return!1;let G=+b[1],J=+b[2],Y=+b[3],X=b[4],Q=b[5]==="-"?-1:1,$=+(b[6]||0),H=+(b[7]||0);if($>23||H>59||_&&!X)return!1;if(G<=23&&J<=59&&Y<60)return!0;let B=J-H*Q,Z=G-$*Q-(B<0?1:0);return(Z===23||Z===-1)&&(B===59||B===-1)&&Y<61}}function qb(_,z){if(!(_&&z))return;let A=new Date("2020-01-01T"+_).valueOf(),b=new Date("2020-01-01T"+z).valueOf();if(!(A&&b))return;return A-b}function NV(_,z){if(!(_&&z))return;let A=Bb.exec(_),b=Bb.exec(z);if(!(A&&b))return;if(_=A[1]+A[2]+A[3],z=b[1]+b[2]+b[3],_>z)return 1;if(_<z)return-1;return 0}var Fb=/t|\s/i;function VV(_){let z=Zb(_);return function(b){let G=b.split(Fb);return G.length===2&&MV(G[0])&&z(G[1])}}function wV(_,z){if(!(_&&z))return;let A=new Date(_).valueOf(),b=new Date(z).valueOf();if(!(A&&b))return;return A-b}function EV(_,z){if(!(_&&z))return;let[A,b]=_.split(Fb),[G,J]=z.split(Fb),Y=Kb(A,G);if(Y===void 0)return;return Y||qb(b,J)}var Vu=/\/|:/,Uu=/^(?:[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 Du(_){return Vu.test(_)&&Uu.test(_)}var UV=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Mu(_){return UV.lastIndex=0,UV.test(_)}var Nu=-2147483648,wu=2147483647;function Eu(_){return Number.isInteger(_)&&_<=wu&&_>=Nu}function Ou(_){return Number.isInteger(_)}function DV(){return!0}var Lu=/[^\\]\\Z/;function ju(_){if(Lu.test(_))return!1;try{return new RegExp(_),!0}catch(z){return!1}}});var PV=I((RV)=>{Object.defineProperty(RV,"__esModule",{value:!0});RV.formatLimitDefinition=void 0;var Pu=Hb(),a9=t(),Z_=a9.operators,z8={formatMaximum:{okStr:"<=",ok:Z_.LTE,fail:Z_.GT},formatMinimum:{okStr:">=",ok:Z_.GTE,fail:Z_.LT},formatExclusiveMaximum:{okStr:"<",ok:Z_.LT,fail:Z_.GTE},formatExclusiveMinimum:{okStr:">",ok:Z_.GT,fail:Z_.LTE}},Su={message:({keyword:_,schemaCode:z})=>a9.str`should be ${z8[_].okStr} ${z}`,params:({keyword:_,schemaCode:z})=>a9._`{comparison: ${z8[_].okStr}, limit: ${z}}`};RV.formatLimitDefinition={keyword:Object.keys(z8),type:"string",schemaType:"string",$data:!0,error:Su,code(_){let{gen:z,data:A,schemaCode:b,keyword:G,it:J}=_,{opts:Y,self:X}=J;if(!Y.validateFormats)return;let Q=new Pu.KeywordCxt(J,X.RULES.all.format.definition,"format");if(Q.$data)$();else H();function $(){let Z=z.scopeValue("formats",{ref:X.formats,code:Y.code.formats}),F=z.const("fmt",a9._`${Z}[${Q.schemaCode}]`);_.fail$data((0,a9.or)(a9._`typeof ${F} != "object"`,a9._`${F} instanceof RegExp`,a9._`typeof ${F}.compare != "function"`,B(F)))}function H(){let Z=Q.schema,F=X.formats[Z];if(!F||F===!0)return;if(typeof F!="object"||F instanceof RegExp||typeof F.compare!="function")throw Error(`"${G}": format "${Z}" does not define "compare" function`);let K=z.scopeValue("formats",{key:Z,ref:F,code:Y.code.formats?a9._`${Y.code.formats}${(0,a9.getProperty)(Z)}`:void 0});_.fail$data(B(K))}function B(Z){return a9._`${Z}.compare(${A}, ${b}) ${z8[G].fail} 0`}},dependencies:["format"]};var ku=(_)=>{return _.addKeyword(RV.formatLimitDefinition),_};RV.default=ku});var xV=I((P3,IV)=>{Object.defineProperty(P3,"__esModule",{value:!0});var i1=jV(),xu=PV(),Ub=t(),SV=new Ub.Name("fullFormats"),Tu=new Ub.Name("fastFormats"),Db=(_,z={keywords:!0})=>{if(Array.isArray(z))return kV(_,z,i1.fullFormats,SV),_;let[A,b]=z.mode==="fast"?[i1.fastFormats,Tu]:[i1.fullFormats,SV],G=z.formats||i1.formatNames;if(kV(_,G,A,b),z.keywords)(0,xu.default)(_);return _};Db.get=(_,z="full")=>{let b=(z==="fast"?i1.fastFormats:i1.fullFormats)[_];if(!b)throw Error(`Unknown format "${_}"`);return b};function kV(_,z,A,b){var G,J;(G=(J=_.opts.code).formats)!==null&&G!==void 0||(J.formats=Ub._`require("ajv-formats/dist/formats").${b}`);for(let Y of z)_.addFormat(Y,A[Y])}IV.exports=P3=Db;Object.defineProperty(P3,"__esModule",{value:!0});P3.default=Db});var pb=G8(lb(),1),{program:Ac,createCommand:bc,createArgument:Gc,createOption:Jc,CommanderError:Yc,InvalidArgumentError:Xc,InvalidOptionArgumentError:Qc,Command:db,Argument:$c,Option:Hc,Help:Bc}=pb.default;import{existsSync as U8,mkdirSync as nU,readFileSync as _G,writeFileSync as tb}from"fs";import{homedir as iU}from"os";import{join as zG}from"path";import{applyEdits as hU,findNodeAtLocation as rb,getNodeValue as mU,modify as uU,parseTree as nb}from"jsonc-parser";function cU(_,z){let A=nb(_);if(!A)return null;let b=rb(A,z);if(!b||!b.parent)return null;return{node:b,propertyNode:b.parent,tree:A}}function lU(_,z){let A=z.offset;while(A>0&&_[A-1]!==`
35
- `)A--;let b=_.slice(A,z.offset).includes("{");return{lineStart:A,isSingleLine:b}}function pU(_,z,A){let b=z-1;while(b>=0&&(_[b]===" "||_[b]==="\t"))b--;if(b>=0&&_[b]===`
36
- `){if(b--,b>=0&&_[b]==="\r")b--}else return null;while(b>=0&&(_[b]===" "||_[b]==="\t"))b--;if(b<0)return null;if(b>=1&&_[b]==="/"&&_[b-1]==="*"){let X=b-2;while(X>=1){if(_[X-1]==="/"&&_[X]==="*"){if(_.slice(X+1,b-1).trim().startsWith(`${A}:`)){let Q=X-1;while(Q>0&&_[Q-1]!==`
37
- `)Q--;return Q}return null}X--}return null}let G=b;while(b>=0&&_[b]!==`
38
- `)b--;let J=b+1,Y=_.slice(J,G+1).trim();if(Y.startsWith("//")){if(Y.slice(2).trim().startsWith(`${A}:`))return J}return null}function ib(_,z=[]){let A=[];for(let[b,G]of Object.entries(_)){let J=[...z,b];if(G===void 0)A.push({path:J,value:void 0});else if(G!==null&&typeof G==="object"&&!Array.isArray(G))A.push(...ib(G,J));else A.push({path:J,value:G})}return A}function ob(_,z){let A=nb(_);if(!A)return;let b=rb(A,z);if(!b)return;return mU(b)}function dU(_,z){let A=String(z[z.length-1]),b=cU(_,z);if(!b)return _;let{propertyNode:G}=b,{lineStart:J,isSingleLine:Y}=lU(_,G),X=!Y?pU(_,G.offset,A):null,Q;if(X!==null)Q=X;else if(Y)Q=G.offset;else Q=J;let $=G.offset+G.length;if($<_.length&&_[$]===",")$++;while($<_.length&&(_[$]===" "||_[$]==="\t"))$++;if(!Y){if($<_.length&&_[$]===`
34
+ deps: ${A}}`};var zu={keyword:"dependencies",type:"object",schemaType:"object",error:nW.error,code(_){let[z,A]=Au(_);dW(_,z),rW(_,A)}};function Au({schema:_}){let z={},A={};for(let G in _){if(G==="__proto__")continue;let J=Array.isArray(_[G])?z:A;J[G]=_[G]}return[z,A]}function dW(_,z=_.schema){let{gen:A,data:G,it:J}=_;if(Object.keys(z).length===0)return;let Y=A.let("missing");for(let X in z){let b=z[X];if(b.length===0)continue;let Q=(0,x3.propertyInData)(A,G,X,J.opts.ownProperties);if(_.setParams({property:X,depsCount:b.length,deps:b.join(", ")}),J.allErrors)A.if(Q,()=>{for(let $ of b)(0,x3.checkReportMissingProp)(_,$)});else A.if(DG._`${Q} && (${(0,x3.checkMissingProp)(_,b,Y)})`),(0,x3.reportMissingProp)(_,Y),A.else()}}nW.validatePropertyDeps=dW;function rW(_,z=_.schema){let{gen:A,data:G,keyword:J,it:Y}=_,X=A.name("valid");for(let b in z){if((0,_u.alwaysValidSchema)(Y,z[b]))continue;A.if((0,x3.propertyInData)(A,G,b,Y.opts.ownProperties),()=>{let Q=_.subschema({keyword:J,schemaProp:b},X);_.mergeValidEvaluated(Q,X)},()=>A.var(X,!0)),_.ok(X)}}nW.validateSchemaDeps=rW;nW.default=zu});var eW=x((tW)=>{Object.defineProperty(tW,"__esModule",{value:!0});var sW=e(),Yu=Q0(),Xu={message:"property name must be valid",params:({params:_})=>sW._`{propertyName: ${_.propertyName}}`},bu={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Xu,code(_){let{gen:z,schema:A,data:G,it:J}=_;if((0,Yu.alwaysValidSchema)(J,A))return;let Y=z.name("valid");z.forIn("key",G,(X)=>{_.setParams({propertyName:X}),_.subschema({keyword:"propertyNames",data:X,dataTypes:["string"],propertyName:X,compositeRule:!0},Y),z.if((0,sW.not)(Y),()=>{if(_.error(!0),!J.allErrors)z.break()})}),_.ok(Y)}};tW.default=bu});var MG=x((_V)=>{Object.defineProperty(_V,"__esModule",{value:!0});var GA=x9(),t9=e(),$u=c4(),JA=Q0(),Hu={message:"must NOT have additional properties",params:({params:_})=>t9._`{additionalProperty: ${_.additionalProperty}}`},Bu={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Hu,code(_){let{gen:z,schema:A,parentSchema:G,data:J,errsCount:Y,it:X}=_;if(!Y)throw Error("ajv implementation error");let{allErrors:b,opts:Q}=X;if(X.props=!0,Q.removeAdditional!=="all"&&(0,JA.alwaysValidSchema)(X,A))return;let $=(0,GA.allSchemaProperties)(G.properties),H=(0,GA.allSchemaProperties)(G.patternProperties);B(),_.ok(t9._`${Y} === ${$u.default.errors}`);function B(){z.forIn("key",J,(W)=>{if(!$.length&&!H.length)F(W);else z.if(Z(W),()=>F(W))})}function Z(W){let V;if($.length>8){let N=(0,JA.schemaRefOrVal)(X,G.properties,"properties");V=(0,GA.isOwnProperty)(z,N,W)}else if($.length)V=(0,t9.or)(...$.map((N)=>t9._`${W} === ${N}`));else V=t9.nil;if(H.length)V=(0,t9.or)(V,...H.map((N)=>t9._`${(0,GA.usePattern)(_,N)}.test(${W})`));return(0,t9.not)(V)}function q(W){z.code(t9._`delete ${J}[${W}]`)}function F(W){if(Q.removeAdditional==="all"||Q.removeAdditional&&A===!1){q(W);return}if(A===!1){if(_.setParams({additionalProperty:W}),_.error(),!b)z.break();return}if(typeof A=="object"&&!(0,JA.alwaysValidSchema)(X,A)){let V=z.name("valid");if(Q.removeAdditional==="failing")K(W,V,!1),z.if((0,t9.not)(V),()=>{_.reset(),q(W)});else if(K(W,V),!b)z.if((0,t9.not)(V),()=>z.break())}}function K(W,V,N){let L={keyword:"additionalProperties",dataProp:W,dataPropType:JA.Type.Str};if(N===!1)Object.assign(L,{compositeRule:!0,createErrors:!1,allErrors:!1});_.subschema(L,V)}}};_V.default=Bu});var JV=x((GV)=>{Object.defineProperty(GV,"__esModule",{value:!0});var qu=M3(),zV=x9(),NG=Q0(),AV=MG(),Fu={keyword:"properties",type:"object",schemaType:"object",code(_){let{gen:z,schema:A,parentSchema:G,data:J,it:Y}=_;if(Y.opts.removeAdditional==="all"&&G.additionalProperties===void 0)AV.default.code(new qu.KeywordCxt(Y,AV.default,"additionalProperties"));let X=(0,zV.allSchemaProperties)(A);for(let B of X)Y.definedProperties.add(B);if(Y.opts.unevaluated&&X.length&&Y.props!==!0)Y.props=NG.mergeEvaluated.props(z,(0,NG.toHash)(X),Y.props);let b=X.filter((B)=>!(0,NG.alwaysValidSchema)(Y,A[B]));if(b.length===0)return;let Q=z.name("valid");for(let B of b){if($(B))H(B);else{if(z.if((0,zV.propertyInData)(z,J,B,Y.opts.ownProperties)),H(B),!Y.allErrors)z.else().var(Q,!0);z.endIf()}_.it.definedProperties.add(B),_.ok(Q)}function $(B){return Y.opts.useDefaults&&!Y.compositeRule&&A[B].default!==void 0}function H(B){_.subschema({keyword:"properties",schemaProp:B,dataProp:B},Q)}}};GV.default=Fu});var $V=x((QV)=>{Object.defineProperty(QV,"__esModule",{value:!0});var YV=x9(),YA=e(),XV=Q0(),bV=Q0(),Wu={keyword:"patternProperties",type:"object",schemaType:"object",code(_){let{gen:z,schema:A,data:G,parentSchema:J,it:Y}=_,{opts:X}=Y,b=(0,YV.allSchemaProperties)(A),Q=b.filter((K)=>(0,XV.alwaysValidSchema)(Y,A[K]));if(b.length===0||Q.length===b.length&&(!Y.opts.unevaluated||Y.props===!0))return;let $=X.strictSchema&&!X.allowMatchingProperties&&J.properties,H=z.name("valid");if(Y.props!==!0&&!(Y.props instanceof YA.Name))Y.props=(0,bV.evaluatedPropsToName)(z,Y.props);let{props:B}=Y;Z();function Z(){for(let K of b){if($)q(K);if(Y.allErrors)F(K);else z.var(H,!0),F(K),z.if(H)}}function q(K){for(let W in $)if(new RegExp(K).test(W))(0,XV.checkStrictMode)(Y,`property ${W} matches pattern ${K} (use allowMatchingProperties)`)}function F(K){z.forIn("key",G,(W)=>{z.if(YA._`${(0,YV.usePattern)(_,K)}.test(${W})`,()=>{let V=Q.includes(K);if(!V)_.subschema({keyword:"patternProperties",schemaProp:K,dataProp:W,dataPropType:bV.Type.Str},H);if(Y.opts.unevaluated&&B!==!0)z.assign(YA._`${B}[${W}]`,!0);else if(!V&&!Y.allErrors)z.if((0,YA.not)(H),()=>z.break())})})}}};QV.default=Wu});var BV=x((HV)=>{Object.defineProperty(HV,"__esModule",{value:!0});var Uu=Q0(),Du={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(_){let{gen:z,schema:A,it:G}=_;if((0,Uu.alwaysValidSchema)(G,A)){_.fail();return}let J=z.name("valid");_.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},J),_.failResult(J,()=>_.reset(),()=>_.error())},error:{message:"must NOT be valid"}};HV.default=Du});var qV=x((ZV)=>{Object.defineProperty(ZV,"__esModule",{value:!0});var Nu=x9(),Eu={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Nu.validateUnion,error:{message:"must match a schema in anyOf"}};ZV.default=Eu});var KV=x((FV)=>{Object.defineProperty(FV,"__esModule",{value:!0});var XA=e(),Ou=Q0(),Lu={message:"must match exactly one schema in oneOf",params:({params:_})=>XA._`{passingSchemas: ${_.passing}}`},ju={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Lu,code(_){let{gen:z,schema:A,parentSchema:G,it:J}=_;if(!Array.isArray(A))throw Error("ajv implementation error");if(J.opts.discriminator&&G.discriminator)return;let Y=A,X=z.let("valid",!1),b=z.let("passing",null),Q=z.name("_valid");_.setParams({passing:b}),z.block($),_.result(X,()=>_.reset(),()=>_.error(!0));function $(){Y.forEach((H,B)=>{let Z;if((0,Ou.alwaysValidSchema)(J,H))z.var(Q,!0);else Z=_.subschema({keyword:"oneOf",schemaProp:B,compositeRule:!0},Q);if(B>0)z.if(XA._`${Q} && ${X}`).assign(X,!1).assign(b,XA._`[${b}, ${B}]`).else();z.if(Q,()=>{if(z.assign(X,!0),z.assign(b,B),Z)_.mergeEvaluated(Z,XA.Name)})})}}};FV.default=ju});var VV=x((WV)=>{Object.defineProperty(WV,"__esModule",{value:!0});var Pu=Q0(),Su={keyword:"allOf",schemaType:"array",code(_){let{gen:z,schema:A,it:G}=_;if(!Array.isArray(A))throw Error("ajv implementation error");let J=z.name("valid");A.forEach((Y,X)=>{if((0,Pu.alwaysValidSchema)(G,Y))return;let b=_.subschema({keyword:"allOf",schemaProp:X},J);_.ok(J),_.mergeEvaluated(b)})}};WV.default=Su});var NV=x((MV)=>{Object.defineProperty(MV,"__esModule",{value:!0});var bA=e(),DV=Q0(),Iu={message:({params:_})=>bA.str`must match "${_.ifClause}" schema`,params:({params:_})=>bA._`{failingKeyword: ${_.ifClause}}`},xu={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Iu,code(_){let{gen:z,parentSchema:A,it:G}=_;if(A.then===void 0&&A.else===void 0)(0,DV.checkStrictMode)(G,'"if" without "then" and "else" is ignored');let J=UV(G,"then"),Y=UV(G,"else");if(!J&&!Y)return;let X=z.let("valid",!0),b=z.name("_valid");if(Q(),_.reset(),J&&Y){let H=z.let("ifClause");_.setParams({ifClause:H}),z.if(b,$("then",H),$("else",H))}else if(J)z.if(b,$("then"));else z.if((0,bA.not)(b),$("else"));_.pass(X,()=>_.error(!0));function Q(){let H=_.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},b);_.mergeEvaluated(H)}function $(H,B){return()=>{let Z=_.subschema({keyword:H},b);if(z.assign(X,b),_.mergeValidEvaluated(Z,X),B)z.assign(B,bA._`${H}`);else _.setParams({ifClause:H})}}}};function UV(_,z){let A=_.schema[z];return A!==void 0&&!(0,DV.alwaysValidSchema)(_,A)}MV.default=xu});var wV=x((EV)=>{Object.defineProperty(EV,"__esModule",{value:!0});var Cu=Q0(),vu={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:_,parentSchema:z,it:A}){if(z.if===void 0)(0,Cu.checkStrictMode)(A,`"${_}" without "if" is ignored`)}};EV.default=vu});var LV=x((OV)=>{Object.defineProperty(OV,"__esModule",{value:!0});var gu=VG(),fu=hW(),hu=UG(),mu=cW(),uu=pW(),cu=aW(),lu=eW(),pu=MG(),du=JV(),ru=$V(),nu=BV(),iu=qV(),ou=KV(),au=VV(),su=NV(),tu=wV();function eu(_=!1){let z=[nu.default,iu.default,ou.default,au.default,su.default,tu.default,lu.default,pu.default,cu.default,du.default,ru.default];if(_)z.push(fu.default,mu.default);else z.push(gu.default,hu.default);return z.push(uu.default),z}OV.default=eu});var RV=x((jV)=>{Object.defineProperty(jV,"__esModule",{value:!0});var T0=e(),zc={message:({schemaCode:_})=>T0.str`must match format "${_}"`,params:({schemaCode:_})=>T0._`{format: ${_}}`},Ac={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:zc,code(_,z){let{gen:A,data:G,$data:J,schema:Y,schemaCode:X,it:b}=_,{opts:Q,errSchemaPath:$,schemaEnv:H,self:B}=b;if(!Q.validateFormats)return;if(J)Z();else q();function Z(){let F=A.scopeValue("formats",{ref:B.formats,code:Q.code.formats}),K=A.const("fDef",T0._`${F}[${X}]`),W=A.let("fType"),V=A.let("format");A.if(T0._`typeof ${K} == "object" && !(${K} instanceof RegExp)`,()=>A.assign(W,T0._`${K}.type || "string"`).assign(V,T0._`${K}.validate`),()=>A.assign(W,T0._`"string"`).assign(V,K)),_.fail$data((0,T0.or)(N(),L()));function N(){if(Q.strictSchema===!1)return T0.nil;return T0._`${X} && !${V}`}function L(){let M=H.$async?T0._`(${K}.async ? await ${V}(${G}) : ${V}(${G}))`:T0._`${V}(${G})`,k=T0._`(typeof ${V} == "function" ? ${M} : ${V}.test(${G}))`;return T0._`${V} && ${V} !== true && ${W} === ${z} && !${k}`}}function q(){let F=B.formats[Y];if(!F){N();return}if(F===!0)return;let[K,W,V]=L(F);if(K===z)_.pass(M());function N(){if(Q.strictSchema===!1){B.logger.warn(k());return}throw Error(k());function k(){return`unknown format "${Y}" ignored in schema at path "${$}"`}}function L(k){let U=k instanceof RegExp?(0,T0.regexpCode)(k):Q.code.formats?T0._`${Q.code.formats}${(0,T0.getProperty)(Y)}`:void 0,O=A.scopeValue("formats",{key:Y,ref:k,code:U});if(typeof k=="object"&&!(k instanceof RegExp))return[k.type||"string",k.validate,T0._`${O}.validate`];return["string",k,O]}function M(){if(typeof F=="object"&&!(F instanceof RegExp)&&F.async){if(!H.$async)throw Error("async format in sync schema");return T0._`await ${V}(${G})`}return typeof W=="function"?T0._`${V}(${G})`:T0._`${V}.test(${G})`}}}};jV.default=Ac});var SV=x((PV)=>{Object.defineProperty(PV,"__esModule",{value:!0});var Jc=RV(),Yc=[Jc.default];PV.default=Yc});var xV=x((kV)=>{Object.defineProperty(kV,"__esModule",{value:!0});kV.contentVocabulary=kV.metadataVocabulary=void 0;kV.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];kV.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var vV=x((CV)=>{Object.defineProperty(CV,"__esModule",{value:!0});var Qc=GW(),$c=kW(),Hc=LV(),Bc=SV(),TV=xV(),Zc=[Qc.default,$c.default,(0,Hc.default)(),Bc.default,TV.metadataVocabulary,TV.contentVocabulary];CV.default=Zc});var hV=x((gV)=>{Object.defineProperty(gV,"__esModule",{value:!0});gV.DiscrError=void 0;var yV;(function(_){_.Tag="tag",_.Mapping="mapping"})(yV||(gV.DiscrError=yV={}))});var cV=x((uV)=>{Object.defineProperty(uV,"__esModule",{value:!0});var e1=e(),EG=hV(),mV=c8(),Fc=N3(),Kc=Q0(),Wc={message:({params:{discrError:_,tagName:z}})=>_===EG.DiscrError.Tag?`tag "${z}" must be string`:`value of tag "${z}" must be in oneOf`,params:({params:{discrError:_,tag:z,tagName:A}})=>e1._`{error: ${_}, tag: ${A}, tagValue: ${z}}`},Vc={keyword:"discriminator",type:"object",schemaType:"object",error:Wc,code(_){let{gen:z,data:A,schema:G,parentSchema:J,it:Y}=_,{oneOf:X}=J;if(!Y.opts.discriminator)throw Error("discriminator: requires discriminator option");let b=G.propertyName;if(typeof b!="string")throw Error("discriminator: requires propertyName");if(G.mapping)throw Error("discriminator: mapping is not supported");if(!X)throw Error("discriminator: requires oneOf keyword");let Q=z.let("valid",!1),$=z.const("tag",e1._`${A}${(0,e1.getProperty)(b)}`);z.if(e1._`typeof ${$} == "string"`,()=>H(),()=>_.error(!1,{discrError:EG.DiscrError.Tag,tag:$,tagName:b})),_.ok(Q);function H(){let q=Z();z.if(!1);for(let F in q)z.elseIf(e1._`${$} === ${F}`),z.assign(Q,B(q[F]));z.else(),_.error(!1,{discrError:EG.DiscrError.Mapping,tag:$,tagName:b}),z.endIf()}function B(q){let F=z.name("valid"),K=_.subschema({keyword:"oneOf",schemaProp:q},F);return _.mergeEvaluated(K,e1.Name),F}function Z(){var q;let F={},K=V(J),W=!0;for(let M=0;M<X.length;M++){let k=X[M];if((k===null||k===void 0?void 0:k.$ref)&&!(0,Kc.schemaHasRulesButRef)(k,Y.self.RULES)){let O=k.$ref;if(k=mV.resolveRef.call(Y.self,Y.schemaEnv.root,Y.baseId,O),k instanceof mV.SchemaEnv)k=k.schema;if(k===void 0)throw new Fc.default(Y.opts.uriResolver,Y.baseId,O)}let U=(q=k===null||k===void 0?void 0:k.properties)===null||q===void 0?void 0:q[b];if(typeof U!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${b}"`);W=W&&(K||V(k)),N(U,M)}if(!W)throw Error(`discriminator: "${b}" must be required`);return F;function V({required:M}){return Array.isArray(M)&&M.includes(b)}function N(M,k){if(M.const)L(M.const,k);else if(M.enum)for(let U of M.enum)L(U,k);else throw Error(`discriminator: "properties/${b}" must have "const" or "enum"`)}function L(M,k){if(typeof M!="string"||M in F)throw Error(`discriminator: "${b}" values must be unique strings`);F[M]=k}}}};uV.default=Vc});var lV=x((kA0,Dc)=>{Dc.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}});var OG=x((W9,wG)=>{Object.defineProperty(W9,"__esModule",{value:!0});W9.MissingRefError=W9.ValidationError=W9.CodeGen=W9.Name=W9.nil=W9.stringify=W9.str=W9._=W9.KeywordCxt=W9.Ajv=void 0;var Mc=nK(),Nc=vV(),Ec=cV(),pV=lV(),wc=["/properties"],QA="http://json-schema.org/draft-07/schema";class T3 extends Mc.default{_addVocabularies(){if(super._addVocabularies(),Nc.default.forEach((_)=>this.addVocabulary(_)),this.opts.discriminator)this.addKeyword(Ec.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let _=this.opts.$data?this.$dataMetaSchema(pV,wc):pV;this.addMetaSchema(_,QA,!1),this.refs["http://json-schema.org/schema"]=QA}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(QA)?QA:void 0)}}W9.Ajv=T3;wG.exports=W9=T3;wG.exports.Ajv=T3;Object.defineProperty(W9,"__esModule",{value:!0});W9.default=T3;var Oc=M3();Object.defineProperty(W9,"KeywordCxt",{enumerable:!0,get:function(){return Oc.KeywordCxt}});var _z=e();Object.defineProperty(W9,"_",{enumerable:!0,get:function(){return _z._}});Object.defineProperty(W9,"str",{enumerable:!0,get:function(){return _z.str}});Object.defineProperty(W9,"stringify",{enumerable:!0,get:function(){return _z.stringify}});Object.defineProperty(W9,"nil",{enumerable:!0,get:function(){return _z.nil}});Object.defineProperty(W9,"Name",{enumerable:!0,get:function(){return _z.Name}});Object.defineProperty(W9,"CodeGen",{enumerable:!0,get:function(){return _z.CodeGen}});var Lc=m8();Object.defineProperty(W9,"ValidationError",{enumerable:!0,get:function(){return Lc.default}});var jc=N3();Object.defineProperty(W9,"MissingRefError",{enumerable:!0,get:function(){return jc.default}})});var _U=x((tV)=>{Object.defineProperty(tV,"__esModule",{value:!0});tV.formatNames=tV.fastFormats=tV.fullFormats=void 0;function K4(_,z){return{validate:_,compare:z}}tV.fullFormats={date:K4(iV,PG),time:K4(jG(!0),SG),"date-time":K4(dV(!0),aV),"iso-time":K4(jG(),oV),"iso-date-time":K4(dV(),sV),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Cc,"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:uc,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:vc,int32:{type:"number",validate:fc},int64:{type:"number",validate:hc},float:{type:"number",validate:nV},double:{type:"number",validate:nV},password:!0,binary:!0};tV.fastFormats={...tV.fullFormats,date:K4(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,PG),time:K4(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,SG),"date-time":K4(/^\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,aV),"iso-time":K4(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,oV),"iso-date-time":K4(/^\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,sV),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};tV.formatNames=Object.keys(tV.fullFormats);function Sc(_){return _%4===0&&(_%100!==0||_%400===0)}var kc=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Ic=[0,31,28,31,30,31,30,31,31,30,31,30,31];function iV(_){let z=kc.exec(_);if(!z)return!1;let A=+z[1],G=+z[2],J=+z[3];return G>=1&&G<=12&&J>=1&&J<=(G===2&&Sc(A)?29:Ic[G])}function PG(_,z){if(!(_&&z))return;if(_>z)return 1;if(_<z)return-1;return 0}var LG=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function jG(_){return function(A){let G=LG.exec(A);if(!G)return!1;let J=+G[1],Y=+G[2],X=+G[3],b=G[4],Q=G[5]==="-"?-1:1,$=+(G[6]||0),H=+(G[7]||0);if($>23||H>59||_&&!b)return!1;if(J<=23&&Y<=59&&X<60)return!0;let B=Y-H*Q,Z=J-$*Q-(B<0?1:0);return(Z===23||Z===-1)&&(B===59||B===-1)&&X<61}}function SG(_,z){if(!(_&&z))return;let A=new Date("2020-01-01T"+_).valueOf(),G=new Date("2020-01-01T"+z).valueOf();if(!(A&&G))return;return A-G}function oV(_,z){if(!(_&&z))return;let A=LG.exec(_),G=LG.exec(z);if(!(A&&G))return;if(_=A[1]+A[2]+A[3],z=G[1]+G[2]+G[3],_>z)return 1;if(_<z)return-1;return 0}var RG=/t|\s/i;function dV(_){let z=jG(_);return function(G){let J=G.split(RG);return J.length===2&&iV(J[0])&&z(J[1])}}function aV(_,z){if(!(_&&z))return;let A=new Date(_).valueOf(),G=new Date(z).valueOf();if(!(A&&G))return;return A-G}function sV(_,z){if(!(_&&z))return;let[A,G]=_.split(RG),[J,Y]=z.split(RG),X=PG(A,J);if(X===void 0)return;return X||SG(G,Y)}var xc=/\/|:/,Tc=/^(?:[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 Cc(_){return xc.test(_)&&Tc.test(_)}var rV=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function vc(_){return rV.lastIndex=0,rV.test(_)}var yc=-2147483648,gc=2147483647;function fc(_){return Number.isInteger(_)&&_<=gc&&_>=yc}function hc(_){return Number.isInteger(_)}function nV(){return!0}var mc=/[^\\]\\Z/;function uc(_){if(mc.test(_))return!1;try{return new RegExp(_),!0}catch(z){return!1}}});var AU=x((zU)=>{Object.defineProperty(zU,"__esModule",{value:!0});zU.formatLimitDefinition=void 0;var lc=OG(),e9=e(),O_=e9.operators,$A={formatMaximum:{okStr:"<=",ok:O_.LTE,fail:O_.GT},formatMinimum:{okStr:">=",ok:O_.GTE,fail:O_.LT},formatExclusiveMaximum:{okStr:"<",ok:O_.LT,fail:O_.GTE},formatExclusiveMinimum:{okStr:">",ok:O_.GT,fail:O_.LTE}},pc={message:({keyword:_,schemaCode:z})=>e9.str`should be ${$A[_].okStr} ${z}`,params:({keyword:_,schemaCode:z})=>e9._`{comparison: ${$A[_].okStr}, limit: ${z}}`};zU.formatLimitDefinition={keyword:Object.keys($A),type:"string",schemaType:"string",$data:!0,error:pc,code(_){let{gen:z,data:A,schemaCode:G,keyword:J,it:Y}=_,{opts:X,self:b}=Y;if(!X.validateFormats)return;let Q=new lc.KeywordCxt(Y,b.RULES.all.format.definition,"format");if(Q.$data)$();else H();function $(){let Z=z.scopeValue("formats",{ref:b.formats,code:X.code.formats}),q=z.const("fmt",e9._`${Z}[${Q.schemaCode}]`);_.fail$data((0,e9.or)(e9._`typeof ${q} != "object"`,e9._`${q} instanceof RegExp`,e9._`typeof ${q}.compare != "function"`,B(q)))}function H(){let Z=Q.schema,q=b.formats[Z];if(!q||q===!0)return;if(typeof q!="object"||q instanceof RegExp||typeof q.compare!="function")throw Error(`"${J}": format "${Z}" does not define "compare" function`);let F=z.scopeValue("formats",{key:Z,ref:q,code:X.code.formats?e9._`${X.code.formats}${(0,e9.getProperty)(Z)}`:void 0});_.fail$data(B(F))}function B(Z){return e9._`${Z}.compare(${A}, ${G}) ${$A[J].fail} 0`}},dependencies:["format"]};var dc=(_)=>{return _.addKeyword(zU.formatLimitDefinition),_};zU.default=dc});var XU=x((C3,YU)=>{Object.defineProperty(C3,"__esModule",{value:!0});var zz=_U(),nc=AU(),xG=e(),GU=new xG.Name("fullFormats"),ic=new xG.Name("fastFormats"),TG=(_,z={keywords:!0})=>{if(Array.isArray(z))return JU(_,z,zz.fullFormats,GU),_;let[A,G]=z.mode==="fast"?[zz.fastFormats,ic]:[zz.fullFormats,GU],J=z.formats||zz.formatNames;if(JU(_,J,A,G),z.keywords)(0,nc.default)(_);return _};TG.get=(_,z="full")=>{let G=(z==="fast"?zz.fastFormats:zz.fullFormats)[_];if(!G)throw Error(`Unknown format "${_}"`);return G};function JU(_,z,A,G){var J,Y;(J=(Y=_.opts.code).formats)!==null&&J!==void 0||(Y.formats=xG._`require("ajv-formats/dist/formats").${G}`);for(let X of z)_.addFormat(X,A[X])}YU.exports=C3=TG;Object.defineProperty(C3,"__esModule",{value:!0});C3.default=TG});var YJ=ZA(JJ(),1),{program:Vl,createCommand:Ul,createArgument:Dl,createOption:Ml,CommanderError:Nl,InvalidArgumentError:El,InvalidOptionArgumentError:wl,Command:XJ,Argument:Ol,Option:Ll,Help:jl}=YJ.default;import{existsSync as jA,mkdirSync as ND,readFileSync as KJ,writeFileSync as qJ}from"fs";import{homedir as ED}from"os";import{join as WJ}from"path";import{applyEdits as qD,findNodeAtLocation as bJ,getNodeValue as FD,modify as KD,parseTree as QJ}from"jsonc-parser";function WD(_,z){let A=QJ(_);if(!A)return null;let G=bJ(A,z);if(!G||!G.parent)return null;return{node:G,propertyNode:G.parent,tree:A}}function VD(_,z){let A=z.offset;while(A>0&&_[A-1]!==`
35
+ `)A--;let G=_.slice(A,z.offset).includes("{");return{lineStart:A,isSingleLine:G}}function UD(_,z,A){let G=z-1;while(G>=0&&(_[G]===" "||_[G]==="\t"))G--;if(G>=0&&_[G]===`
36
+ `){if(G--,G>=0&&_[G]==="\r")G--}else return null;while(G>=0&&(_[G]===" "||_[G]==="\t"))G--;if(G<0)return null;if(G>=1&&_[G]==="/"&&_[G-1]==="*"){let b=G-2;while(b>=1){if(_[b-1]==="/"&&_[b]==="*"){if(_.slice(b+1,G-1).trim().startsWith(`${A}:`)){let Q=b-1;while(Q>0&&_[Q-1]!==`
37
+ `)Q--;return Q}return null}b--}return null}let J=G;while(G>=0&&_[G]!==`
38
+ `)G--;let Y=G+1,X=_.slice(Y,J+1).trim();if(X.startsWith("//")){if(X.slice(2).trim().startsWith(`${A}:`))return Y}return null}function $J(_,z=[]){let A=[];for(let[G,J]of Object.entries(_)){let Y=[...z,G];if(J===void 0)A.push({path:Y,value:void 0});else if(J!==null&&typeof J==="object"&&!Array.isArray(J))A.push(...$J(J,Y));else A.push({path:Y,value:J})}return A}function HJ(_,z){let A=QJ(_);if(!A)return;let G=bJ(A,z);if(!G)return;return FD(G)}function DD(_,z){let A=String(z[z.length-1]),G=WD(_,z);if(!G)return _;let{propertyNode:J}=G,{lineStart:Y,isSingleLine:X}=VD(_,J),b=!X?UD(_,J.offset,A):null,Q;if(b!==null)Q=b;else if(X)Q=J.offset;else Q=Y;let $=J.offset+J.length;if($<_.length&&_[$]===",")$++;while($<_.length&&(_[$]===" "||_[$]==="\t"))$++;if(!X){if($<_.length&&_[$]===`
39
39
  `)$++;else if($<_.length&&_[$]==="\r"){if($++,$<_.length&&_[$]===`
40
- `)$++}}let H=_.slice(0,Q),B=_.slice($),Z=H+B,F=H.trimEnd(),K=B.trimStart();if(F.endsWith(",")&&K.startsWith("}")){let q=H.lastIndexOf(",");Z=H.slice(0,q)+H.slice(q+1)+B}return Z}function ab(_,z){let A=_,b=ib(z);for(let{path:G,value:J}of b)if(J===void 0)A=dU(A,G);else{let Y=uU(A,G,J,{});A=hU(A,Y)}return A}import*as a1 from"fs/promises";import*as s9 from"path";function K8(_){let z=_.match(/git@([^:]+):(.+?)(?:\.git)?$/);if(z)return`${z[1]}/${z[2]}`;let A=_.match(/https?:\/\/([^/]+)\/(.+?)(?:\.git)?$/);if(A)return`${A[1]}/${A[2]}`;return null}async function q8(_){let z=s9.resolve(_),{root:A}=s9.parse(z);while(!0){let b=s9.join(z,".git");try{let J=await a1.stat(b);if(J.isDirectory()||J.isFile())return z}catch{}if(z===A)return null;let G=s9.dirname(z);if(G===z)return null;z=G}}async function rU(_){try{let z=s9.join(_,".git","config"),b=(await a1.readFile(z,"utf8")).match(/\[remote "origin"\]\s+url\s*=\s*(.+)/i);if(!b||!b[1])return null;return b[1].trim()}catch{return null}}async function W8(_){let z=await rU(_);if(!z)return null;return K8(z)}async function a0(_){let z=_??process.cwd(),A=await q8(z);if(!A)return null;return W8(A)}async function sb(_,z){try{let A=s9.join(_,".git","HEAD"),G=(await a1.readFile(A,"utf8")).trim();if(G.startsWith("ref:")){let Y=G.slice(4).trim().split("/");return Y[Y.length-1]??z??null}return G||z||null}catch{return z??null}}var V8=zG(iU(),".config","agentlogs"),F_=zG(V8,"settings.json"),eb={allowMode:"denylist",repos:{}};function AG(){if(!U8(V8))nU(V8,{recursive:!0})}function t9(){if(AG(),!U8(F_))return{...eb};try{let _=_G(F_,"utf-8"),z=ob(_,[]);return{allowMode:z.allowMode==="allowlist"?"allowlist":"denylist",repos:typeof z.repos==="object"&&z.repos!==null?z.repos:{}}}catch{return{...eb}}}function D8(_){AG();try{if(U8(F_)){let z=_G(F_,"utf-8"),A=ab(z,_);tb(F_,A,"utf-8")}else tb(F_,JSON.stringify(_,null,2),"utf-8")}catch(z){throw console.error("Failed to write settings file:",z),z}}function e9(_){if(!_)return t9().allowMode==="denylist";let z=t9(),A=z.repos[_];if(z.allowMode==="denylist"){if(!A)return!0;return A.allow}else{if(!A)return!1;return A.allow}}function M8(_){if(!_)return;return t9().repos[_]?.visibility}function bG(_,z){let A=t9();A.repos[_]={allow:!0,...z&&{visibility:z}},D8(A)}function GG(_){let z=t9();z.repos[_]={allow:!1},D8(z)}function JG(_){let z=t9();z.allowMode=_,D8(z)}function YG(){return F_}async function XG(_={}){let z=await a0();if(!z)console.error("Could not detect repository."),console.error("Make sure you are in a git repository with a remote origin configured."),process.exit(1);let A;if(_.public)A="public";else if(_.team)A="team";else if(_.private)A="private";else if(_.visibility){let J=_.visibility.toLowerCase();if(J!=="public"&&J!=="team"&&J!=="private")console.error("Invalid visibility. Use 'public', 'team', or 'private'."),process.exit(1);A=J}bG(z,A);let G=t9().repos[z];if(console.log(`✓ Capture enabled for: ${z}`),G?.visibility)console.log(` Visibility: ${G.visibility}`);else console.log(" Visibility: (server default)");process.exit(0)}async function QG(){let _=await a0();if(!_)console.error("Could not detect repository."),console.error("Make sure you are in a git repository with a remote origin configured."),process.exit(1);GG(_),console.log(`✗ Capture disabled for: ${_}`),process.exit(0)}import T8 from"node:process";import jG from"node:path";import{fileURLToPath as jD}from"node:url";import RD from"node:child_process";import PD,{constants as SD}from"node:fs/promises";import{promisify as JD}from"node:util";import YD from"node:child_process";import L8,{constants as qG}from"node:fs/promises";import BG from"node:process";import eU from"node:os";import _D from"node:fs";import sU from"node:fs";import $G from"node:fs";var N8;function oU(){try{return $G.statSync("/.dockerenv"),!0}catch{return!1}}function aU(){try{return $G.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function w8(){if(N8===void 0)N8=oU()||aU();return N8}var E8,tU=()=>{try{return sU.statSync("/run/.containerenv"),!0}catch{return!1}};function m_(){if(E8===void 0)E8=tU()||w8();return E8}var HG=()=>{if(BG.platform!=="linux")return!1;if(eU.release().toLowerCase().includes("microsoft")){if(m_())return!1;return!0}try{return _D.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!m_():!1}catch{return!1}},V4=BG.env.__IS_WSL_TEST__?HG:HG();import ZG from"node:process";import{Buffer as zD}from"node:buffer";import{promisify as AD}from"node:util";import bD from"node:child_process";var GD=AD(bD.execFile),O8=()=>`${ZG.env.SYSTEMROOT||ZG.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;var K9=async(_,z={})=>{let{powerShellPath:A,...b}=z,G=K9.encodeCommand(_);return GD(A??O8(),[...K9.argumentsPrefix,G],{encoding:"utf8",...b})};K9.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];K9.encodeCommand=(_)=>zD.from(_,"utf16le").toString("base64");K9.escapeArgument=(_)=>`'${String(_).replaceAll("'","''")}'`;function FG(_){for(let z of _.split(`
41
- `)){if(/^\s*#/.test(z))continue;let A=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(z);if(!A)continue;return A.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}var XD=JD(YD.execFile),QD=(()=>{let z;return async function(){if(z)return z;let A="/etc/wsl.conf",b=!1;try{await L8.access(A,qG.F_OK),b=!0}catch{}if(!b)return"/mnt/";let G=await L8.readFile(A,{encoding:"utf8"}),J=FG(G);if(J===void 0)return"/mnt/";return z=J,z=z.endsWith("/")?z:`${z}/`,z}})(),$D=async()=>{return`${await QD()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`},I3=V4?$D:O8,KG,WG=async()=>{return KG??=(async()=>{try{let _=await I3();return await L8.access(_,qG.X_OK),!0}catch{return!1}})(),KG},VG=async()=>{let _=await I3(),z=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:A}=await K9(z,{powerShellPath:_});return A.trim()},UG=async(_)=>{if(/^[a-z]+:\/\//i.test(_))return _;try{let{stdout:z}=await XD("wslpath",["-aw",_],{encoding:"utf8"});return z.trim()}catch{return _}};function K_(_,z,A){let b=(G)=>Object.defineProperty(_,z,{value:G,enumerable:!0,writable:!0});return Object.defineProperty(_,z,{configurable:!0,enumerable:!0,get(){let G=A();return b(G),G},set(G){b(G)}}),_}import{promisify as ND}from"node:util";import k8 from"node:process";import{execFile as wD}from"node:child_process";import{promisify as HD}from"node:util";import BD from"node:process";import{execFile as ZD}from"node:child_process";var FD=HD(ZD);async function j8(){if(BD.platform!=="darwin")throw Error("macOS only");let{stdout:_}=await FD("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),A=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(_)?.groups.id??"com.apple.Safari";if(A==="com.apple.safari")return"com.apple.Safari";return A}import KD from"node:process";import{promisify as qD}from"node:util";import{execFile as WD,execFileSync as Gl}from"node:child_process";var VD=qD(WD);async function DG(_,{humanReadableOutput:z=!0,signal:A}={}){if(KD.platform!=="darwin")throw Error("macOS only");let b=z?[]:["-ss"],G={};if(A)G.signal=A;let{stdout:J}=await VD("osascript",["-e",_,b],G);return J.trim()}async function R8(_){return DG(`tell application "Finder" to set app_path to application file id "${_}" as string
42
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as UD}from"node:util";import{execFile as DD}from"node:child_process";var MD=UD(DD),MG={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},x3=new Map(Object.entries(MG));class P8 extends Error{}async function S8(_=MD){let{stdout:z}=await _("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),A=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(z);if(!A)throw new P8(`Cannot find Windows browser in stdout: ${JSON.stringify(z)}`);let{id:b}=A.groups,G=MG[b];if(!G)throw new P8(`Unknown browser ID: ${b}`);return G}var ED=ND(wD),OD=(_)=>_.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,(z)=>z.toUpperCase());async function I8(){if(k8.platform==="darwin"){let _=await j8();return{name:await R8(_),id:_}}if(k8.platform==="linux"){let{stdout:_}=await ED("xdg-mime",["query","default","x-scheme-handler/http"]),z=_.trim();return{name:OD(z.replace(/.desktop$/,"").replace("-"," ")),id:z}}if(k8.platform==="win32")return S8();throw Error("Only macOS, Linux, and Windows are supported")}import x8 from"node:process";var LD=Boolean(x8.env.SSH_CONNECTION||x8.env.SSH_CLIENT||x8.env.SSH_TTY),NG=LD;var T3=Symbol("fallbackAttempt"),C8=import.meta.url?jG.dirname(jD(import.meta.url)):"",wG=jG.join(C8,"xdg-open"),{platform:u_,arch:EG}=T8,OG=async(_,z)=>{if(_.length===0)return;let A=[];for(let b of _)try{return await z(b)}catch(G){A.push(G)}throw AggregateError(A,"Failed to open in all supported apps")},C3=async(_)=>{_={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,..._};let z=_[T3]===!0;if(delete _[T3],Array.isArray(_.app))return OG(_.app,($)=>C3({..._,app:$,[T3]:!0}));let{name:A,arguments:b=[]}=_.app??{};if(b=[...b],Array.isArray(A))return OG(A,($)=>C3({..._,app:{name:$,arguments:b},[T3]:!0}));if(A==="browser"||A==="browserPrivate"){let $={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},H={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},B;if(V4){let Z=await VG();B=x3.get(Z)??{}}else B=await I8();if(B.id in $){let Z=$[B.id.toLowerCase()];if(A==="browserPrivate"){if(Z==="safari")throw Error("Safari doesn't support opening in private mode via command line");b.push(H[Z])}return C3({..._,app:{name:c_[Z],arguments:b}})}throw Error(`${B.name} is not supported as a default browser`)}let G,J=[],Y={},X=!1;if(V4&&!m_()&&!NG&&!A)X=await WG();if(u_==="darwin"){if(G="open",_.wait)J.push("--wait-apps");if(_.background)J.push("--background");if(_.newInstance)J.push("--new");if(A)J.push("-a",A)}else if(u_==="win32"||X){if(G=await I3(),J.push(...K9.argumentsPrefix),!V4)Y.windowsVerbatimArguments=!0;if(V4&&_.target)_.target=await UG(_.target);let $=["$ProgressPreference = 'SilentlyContinue';","Start"];if(_.wait)$.push("-Wait");if(A){if($.push(K9.escapeArgument(A)),_.target)b.push(_.target)}else if(_.target)$.push(K9.escapeArgument(_.target));if(b.length>0)b=b.map((H)=>K9.escapeArgument(H)),$.push("-ArgumentList",b.join(","));if(_.target=K9.encodeCommand($.join(" ")),!_.wait)Y.stdio="ignore"}else{if(A)G=A;else{let $=!C8||C8==="/",H=!1;try{await PD.access(wG,SD.X_OK),H=!0}catch{}G=T8.versions.electron??(u_==="android"||$||!H)?"xdg-open":wG}if(b.length>0)J.push(...b);if(!_.wait)Y.stdio="ignore",Y.detached=!0}if(u_==="darwin"&&b.length>0)J.push("--args",...b);if(_.target)J.push(_.target);let Q=RD.spawn(G,J,Y);if(_.wait)return new Promise(($,H)=>{Q.once("error",H),Q.once("close",(B)=>{if(!_.allowNonzeroExitCode&&B!==0){H(Error(`Exited with code ${B}`));return}$(Q)})});if(z)return new Promise(($,H)=>{Q.once("error",H),Q.once("spawn",()=>{Q.once("close",(B)=>{if(Q.off("error",H),B!==0){H(Error(`Exited with code ${B}`));return}Q.unref(),$(Q)})})});return Q.unref(),new Promise(($,H)=>{Q.once("error",H),Q.once("spawn",()=>{Q.off("error",H),$(Q)})})},kD=(_,z)=>{if(typeof _!=="string")throw TypeError("Expected a `target`");return C3({...z,target:_})};function LG(_){if(typeof _==="string"||Array.isArray(_))return _;let{[EG]:z}=_;if(!z)throw Error(`${EG} is not supported`);return z}function s1({[u_]:_},{wsl:z}={}){if(z&&V4)return LG(z);if(!_)throw Error(`${u_} is not supported`);return LG(_)}var c_={browser:"browser",browserPrivate:"browserPrivate"};K_(c_,"chrome",()=>s1({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));K_(c_,"brave",()=>s1({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));K_(c_,"firefox",()=>s1({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));K_(c_,"edge",()=>s1({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));K_(c_,"safari",()=>s1({darwin:"Safari"}));var RG=kD;var v3=Symbol.for("better-auth:broadcast-channel"),ID=()=>Math.floor(Date.now()/1000),xD=class{listeners=new Set;name;constructor(_="better-auth.message"){this.name=_}subscribe(_){return this.listeners.add(_),()=>{this.listeners.delete(_)}}post(_){if(typeof window>"u")return;try{localStorage.setItem(this.name,JSON.stringify({..._,timestamp:ID()}))}catch{}}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};let _=(z)=>{if(z.key!==this.name)return;let A=JSON.parse(z.newValue??"{}");if(A?.event!=="session"||!A?.data)return;this.listeners.forEach((b)=>b(A))};return window.addEventListener("storage",_),()=>{window.removeEventListener("storage",_)}}};function t1(_="better-auth.message"){if(!globalThis[v3])globalThis[v3]=new xD(_);return globalThis[v3]}var y3=Symbol.for("better-auth:focus-manager"),TD=class{listeners=new Set;subscribe(_){return this.listeners.add(_),()=>{this.listeners.delete(_)}}setFocused(_){this.listeners.forEach((z)=>z(_))}setup(){if(typeof window>"u"||typeof document>"u"||typeof window.addEventListener>"u")return()=>{};let _=()=>{if(document.visibilityState==="visible")this.setFocused(!0)};return document.addEventListener("visibilitychange",_,!1),()=>{document.removeEventListener("visibilitychange",_,!1)}}};function v8(){if(!globalThis[y3])globalThis[y3]=new TD;return globalThis[y3]}var g3=Symbol.for("better-auth:online-manager"),CD=class{listeners=new Set;isOnline=typeof navigator<"u"?navigator.onLine:!0;subscribe(_){return this.listeners.add(_),()=>{this.listeners.delete(_)}}setOnline(_){this.isOnline=_,this.listeners.forEach((z)=>z(_))}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};let _=()=>this.setOnline(!0),z=()=>this.setOnline(!1);return window.addEventListener("online",_,!1),window.addEventListener("offline",z,!1),()=>{window.removeEventListener("online",_,!1),window.removeEventListener("offline",z,!1)}}};function f3(){if(!globalThis[g3])globalThis[g3]=new CD;return globalThis[g3]}var k9=[],h4=0,h3=4,vD=0,e1=(_)=>{let z=[],A={get(){if(!A.lc)A.listen(()=>{})();return A.value},lc:0,listen(b){return A.lc=z.push(b),()=>{for(let J=h4+h3;J<k9.length;)if(k9[J]===b)k9.splice(J,h3);else J+=h3;let G=z.indexOf(b);if(~G){if(z.splice(G,1),!--A.lc)A.off()}}},notify(b,G){vD++;let J=!k9.length;for(let Y of z)k9.push(Y,A.value,b,G);if(J){for(h4=0;h4<k9.length;h4+=h3)k9[h4](k9[h4+1],k9[h4+2],k9[h4+3]);k9.length=0}},off(){},set(b){let G=A.value;if(G!==b)A.value=b,A.notify(G)},subscribe(b){let G=A.listen(b);return b(A.value),G},value:_};return A};var yD=5,m3=6,u3=10,gD=(_,z,A,b)=>{if(_.events=_.events||{},!_.events[A+u3])_.events[A+u3]=b((G)=>{_.events[A].reduceRight((J,Y)=>(Y(J),J),{shared:{},...G})});return _.events[A]=_.events[A]||[],_.events[A].push(z),()=>{let G=_.events[A],J=G.indexOf(z);if(G.splice(J,1),!G.length)delete _.events[A],_.events[A+u3](),delete _.events[A+u3]}};var PG=1000,_z=(_,z)=>{return gD(_,(b)=>{let G=z(b);if(G)_.events[m3].push(G)},yD,(b)=>{let G=_.listen;_.listen=(...Y)=>{if(!_.lc&&!_.active)_.active=!0,b();return G(...Y)};let J=_.off;return _.events[m3]=[],_.off=()=>{J(),setTimeout(()=>{if(_.active&&!_.lc){_.active=!1;for(let Y of _.events[m3])Y();_.events[m3]=[]}},PG)},()=>{_.listen=G,_.off=J}})};var fD=()=>typeof window>"u",c3=(_,z,A,b)=>{let G=e1({data:null,error:null,isPending:!0,isRefetching:!1,refetch:(X)=>J(X)}),J=async(X)=>{return new Promise((Q)=>{let $=typeof b==="function"?b({data:G.get().data,error:G.get().error,isPending:G.get().isPending}):b;A(z,{...$,query:{...$?.query,...X?.query},async onSuccess(H){G.set({data:H.data,error:null,isPending:!1,isRefetching:!1,refetch:G.value.refetch}),await $?.onSuccess?.(H)},async onError(H){let{request:B}=H,Z=typeof B.retry==="number"?B.retry:B.retry?.attempts,F=B.retryAttempt||0;if(Z&&F<Z)return;G.set({error:H.error,data:null,isPending:!1,isRefetching:!1,refetch:G.value.refetch}),await $?.onError?.(H)},async onRequest(H){let B=G.get();G.set({isPending:B.data===null,data:B.data,error:null,isRefetching:!0,refetch:G.value.refetch}),await $?.onRequest?.(H)}}).catch((H)=>{G.set({error:H,data:null,isPending:!1,isRefetching:!1,refetch:G.value.refetch})}).finally(()=>{Q(void 0)})})};_=Array.isArray(_)?_:[_];let Y=!1;for(let X of _)X.subscribe(async()=>{if(fD())return;if(Y)await J();else _z(G,()=>{let Q=setTimeout(async()=>{if(!Y)await J(),Y=!0},0);return()=>{G.off(),X.off(),clearTimeout(Q)}})});return G};var l_=()=>Math.floor(Date.now()/1000),hD=5;function y8(_){let{sessionAtom:z,sessionSignal:A,$fetch:b,options:G={}}=_,J=G.sessionOptions?.refetchInterval??0,Y=G.sessionOptions?.refetchOnWindowFocus??!0,X=G.sessionOptions?.refetchWhenOffline??!1,Q={lastSync:0,lastSessionRequest:0,cachedSession:void 0},$=()=>{return X||f3().isOnline},H=(w)=>{if(!$())return;if(w?.event==="storage"){Q.lastSync=l_(),A.set(!A.get());return}let O=z.get();if(w?.event==="poll"){Q.lastSessionRequest=l_(),b("/get-session").then((M)=>{if(M.error)z.set({...O,data:null,error:M.error});else z.set({...O,data:M.data,error:null});Q.lastSync=l_(),A.set(!A.get())}).catch(()=>{});return}if(w?.event==="visibilitychange"){if(l_()-Q.lastSessionRequest<hD)return;Q.lastSessionRequest=l_()}if(O?.data===null||O?.data===void 0||w?.event==="visibilitychange")Q.lastSync=l_(),A.set(!A.get())},B=(w)=>{t1().post({event:"session",data:{trigger:w},clientId:Math.random().toString(36).substring(7)})},Z=()=>{if(J&&J>0)Q.pollInterval=setInterval(()=>{if(z.get()?.data)H({event:"poll"})},J*1000)},F=()=>{Q.unsubscribeBroadcast=t1().subscribe(()=>{H({event:"storage"})})},K=()=>{if(!Y)return;Q.unsubscribeFocus=v8().subscribe(()=>{H({event:"visibilitychange"})})},q=()=>{Q.unsubscribeOnline=f3().subscribe((w)=>{if(w)H({event:"visibilitychange"})})};return{init:()=>{Z(),F(),K(),q(),t1().setup(),v8().setup(),f3().setup()},cleanup:()=>{if(Q.pollInterval)clearInterval(Q.pollInterval),Q.pollInterval=void 0;if(Q.unsubscribeBroadcast)Q.unsubscribeBroadcast(),Q.unsubscribeBroadcast=void 0;if(Q.unsubscribeFocus)Q.unsubscribeFocus(),Q.unsubscribeFocus=void 0;if(Q.unsubscribeOnline)Q.unsubscribeOnline(),Q.unsubscribeOnline=void 0;Q.lastSync=0,Q.lastSessionRequest=0,Q.cachedSession=void 0},triggerRefetch:H,broadcastSessionUpdate:B}}var l3=Object.create(null),zz=(_)=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(_?l3:globalThis),s0=new Proxy(l3,{get(_,z){return zz()[z]??l3[z]},has(_,z){return z in zz()||z in l3},set(_,z,A){let b=zz(!0);return b[z]=A,!0},deleteProperty(_,z){if(!z)return!1;let A=zz(!0);return delete A[z],!0},ownKeys(){let _=zz(!0);return Object.keys(_)}});var mD=typeof process<"u"&&process.env&&"production"||"";function F0(_,z){if(typeof process<"u"&&process.env)return process.env[_]??z;if(typeof Deno<"u")return Deno.env.get(_)??z;if(typeof Bun<"u")return Bun.env[_]??z;return z}var uD=Object.freeze({get BETTER_AUTH_SECRET(){return F0("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return F0("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return F0("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return F0("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return F0("NODE_ENV","development")},get PACKAGE_VERSION(){return F0("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return F0("BETTER_AUTH_TELEMETRY_ENDPOINT","https://telemetry.better-auth.com/v1/track")}});var Az=1,v0=4,_4=8,q9=24,SG={eterm:v0,cons25:v0,console:v0,cygwin:v0,dtterm:v0,gnome:v0,hurd:v0,jfbterm:v0,konsole:v0,kterm:v0,mlterm:v0,mosh:q9,putty:v0,st:v0,"rxvt-unicode-24bit":q9,terminator:q9,"xterm-kitty":q9},cD=new Map(Object.entries({APPVEYOR:_4,BUILDKITE:_4,CIRCLECI:q9,DRONE:_4,GITEA_ACTIONS:q9,GITHUB_ACTIONS:q9,GITLAB_CI:_4,TRAVIS:_4})),lD=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function g8(){if(F0("FORCE_COLOR")!==void 0)switch(F0("FORCE_COLOR")){case"":case"1":case"true":return v0;case"2":return _4;case"3":return q9;default:return Az}if(F0("NODE_DISABLE_COLORS")!==void 0&&F0("NODE_DISABLE_COLORS")!==""||F0("NO_COLOR")!==void 0&&F0("NO_COLOR")!==""||F0("TERM")==="dumb")return Az;if(F0("TMUX"))return q9;if("TF_BUILD"in s0&&"AGENT_NAME"in s0)return v0;if("CI"in s0){for(let{0:_,1:z}of cD)if(_ in s0)return z;if(F0("CI_NAME")==="codeship")return _4;return Az}if("TEAMCITY_VERSION"in s0)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(F0("TEAMCITY_VERSION"))!==null?v0:Az;switch(F0("TERM_PROGRAM")){case"iTerm.app":if(!F0("TERM_PROGRAM_VERSION")||/^[0-2]\./.exec(F0("TERM_PROGRAM_VERSION"))!==null)return _4;return q9;case"HyperTerm":case"MacTerm":return q9;case"Apple_Terminal":return _4}if(F0("COLORTERM")==="truecolor"||F0("COLORTERM")==="24bit")return q9;if(F0("TERM")){if(/truecolor/.exec(F0("TERM"))!==null)return q9;if(/^xterm-256/.exec(F0("TERM"))!==null)return _4;let _=F0("TERM").toLowerCase();if(SG[_])return SG[_];if(lD.some((z)=>z.exec(_)!==null))return v0}if(F0("COLORTERM"))return v0;return Az}var I9={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",undim:"\x1B[22m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",fg:{black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},bg:{black:"\x1B[40m",red:"\x1B[41m",green:"\x1B[42m",yellow:"\x1B[43m",blue:"\x1B[44m",magenta:"\x1B[45m",cyan:"\x1B[46m",white:"\x1B[47m"}},p3=["debug","info","success","warn","error"];function kG(_,z){return p3.indexOf(z)>=p3.indexOf(_)}var pD={info:I9.fg.blue,success:I9.fg.green,warn:I9.fg.yellow,error:I9.fg.red,debug:I9.fg.magenta},dD=(_,z,A)=>{let b=new Date().toISOString();if(A)return`${I9.dim}${b}${I9.reset} ${pD[_]}${_.toUpperCase()}${I9.reset} ${I9.bright}[Better Auth]:${I9.reset} ${z}`;return`${b} ${_.toUpperCase()} [Better Auth]: ${z}`},IG=(_)=>{let z=_?.disabled!==!0,A=_?.level??"error",b=_?.disableColors!==void 0?!_.disableColors:g8()!==1,G=(J,Y,X=[])=>{if(!z||!kG(A,J))return;let Q=dD(J,Y,b);if(!_||typeof _.log!=="function"){if(J==="error")console.error(Q,...X);else if(J==="warn")console.warn(Q,...X);else console.log(Q,...X);return}_.log(J==="success"?"info":J,Y,...X)};return{...Object.fromEntries(p3.map((J)=>[J,(...[Y,...X])=>G(J,Y,X)])),get level(){return A}}},xG=IG();function f8(_){return _}function h8(_){return _.charAt(0).toUpperCase()+_.slice(1)}var rD=f8({USER_NOT_FOUND:"User not found",FAILED_TO_CREATE_USER:"Failed to create user",FAILED_TO_CREATE_SESSION:"Failed to create session",FAILED_TO_UPDATE_USER:"Failed to update user",FAILED_TO_GET_SESSION:"Failed to get session",INVALID_PASSWORD:"Invalid password",INVALID_EMAIL:"Invalid email",INVALID_EMAIL_OR_PASSWORD:"Invalid email or password",SOCIAL_ACCOUNT_ALREADY_LINKED:"Social account already linked",PROVIDER_NOT_FOUND:"Provider not found",INVALID_TOKEN:"Invalid token",ID_TOKEN_NOT_SUPPORTED:"id_token not supported",FAILED_TO_GET_USER_INFO:"Failed to get user info",USER_EMAIL_NOT_FOUND:"User email not found",EMAIL_NOT_VERIFIED:"Email not verified",PASSWORD_TOO_SHORT:"Password too short",PASSWORD_TOO_LONG:"Password too long",USER_ALREADY_EXISTS:"User already exists.",USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:"User already exists. Use another email.",EMAIL_CAN_NOT_BE_UPDATED:"Email can not be updated",CREDENTIAL_ACCOUNT_NOT_FOUND:"Credential account not found",SESSION_EXPIRED:"Session expired. Re-authenticate to perform this action.",FAILED_TO_UNLINK_LAST_ACCOUNT:"You can't unlink your last account",ACCOUNT_NOT_FOUND:"Account not found",USER_ALREADY_HAS_PASSWORD:"User already has a password. Provide that to delete the account.",CROSS_SITE_NAVIGATION_LOGIN_BLOCKED:"Cross-site navigation login blocked. This request appears to be a CSRF attack.",VERIFICATION_EMAIL_NOT_ENABLED:"Verification email isn't enabled",EMAIL_ALREADY_VERIFIED:"Email is already verified",EMAIL_MISMATCH:"Email mismatch",SESSION_NOT_FRESH:"Session is not fresh",LINKED_ACCOUNT_ALREADY_EXISTS:"Linked account already exists",INVALID_ORIGIN:"Invalid origin",INVALID_CALLBACK_URL:"Invalid callbackURL",INVALID_REDIRECT_URL:"Invalid redirectURL",INVALID_ERROR_CALLBACK_URL:"Invalid errorCallbackURL",INVALID_NEW_USER_CALLBACK_URL:"Invalid newUserCallbackURL",MISSING_OR_NULL_ORIGIN:"Missing or null Origin",CALLBACK_URL_REQUIRED:"callbackURL is required",FAILED_TO_CREATE_VERIFICATION:"Unable to create verification",FIELD_NOT_ALLOWED:"Field not allowed to be set",ASYNC_VALIDATION_NOT_SUPPORTED:"Async validation is not supported",VALIDATION_ERROR:"Validation Error",MISSING_FIELD:"Field is required"});var m4=class extends Error{constructor(_,z){super(_,z);this.name="BetterAuthError",this.message=_,this.stack=""}};function nD(_){try{return(new URL(_).pathname.replace(/\/+$/,"")||"/")!=="/"}catch{throw new m4(`Invalid base URL: ${_}. Please provide a valid base URL.`)}}function iD(_){try{let z=new URL(_);if(z.protocol!=="http:"&&z.protocol!=="https:")throw new m4(`Invalid base URL: ${_}. URL must include 'http://' or 'https://'`)}catch(z){if(z instanceof m4)throw z;throw new m4(`Invalid base URL: ${_}. Please provide a valid base URL.`,{cause:z})}}function bz(_,z="/api/auth"){if(iD(_),nD(_))return _;let A=_.replace(/\/+$/,"");if(!z||z==="/")return A;return z=z.startsWith("/")?z:`/${z}`,`${A}${z}`}function TG(_,z){if(!_||_.trim()==="")return!1;if(z==="proto")return _==="http"||_==="https";if(z==="host"){if([/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some((A)=>A.test(_)))return!1;return/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(_)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(_)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(_)||/^localhost(:[0-9]{1,5})?$/i.test(_)}return!1}function CG(_,z,A,b,G){if(_)return bz(_,z);if(b!==!1){let X=s0.BETTER_AUTH_URL||s0.NEXT_PUBLIC_BETTER_AUTH_URL||s0.PUBLIC_BETTER_AUTH_URL||s0.NUXT_PUBLIC_BETTER_AUTH_URL||s0.NUXT_PUBLIC_AUTH_URL||(s0.BASE_URL!=="/"?s0.BASE_URL:void 0);if(X)return bz(X,z)}let J=A?.headers.get("x-forwarded-host"),Y=A?.headers.get("x-forwarded-proto");if(J&&Y&&G){if(TG(Y,"proto")&&TG(J,"host"))try{return bz(`${Y}://${J}`,z)}catch(X){}}if(A){let X=oD(A.url);if(!X)throw new m4("Could not get origin from request. Please provide a valid base URL.");return bz(X,z)}if(typeof window<"u"&&window.location)return bz(window.location.origin,z)}function oD(_){try{let z=new URL(_);return z.origin==="null"?null:z.origin}catch{return null}}var vG={id:"redirect",name:"Redirect",hooks:{onSuccess(_){if(_.data?.url&&_.data?.redirect){if(typeof window<"u"&&window.location){if(window.location)try{window.location.href=_.data.url}catch{}}}}}};var aD={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},sD=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,yG={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},tD=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function eD(_){return _ instanceof Date&&!isNaN(_.getTime())}function _M(_){let z=tD.exec(_);if(!z)return null;let[,A,b,G,J,Y,X,Q,$,H,B]=z,Z=new Date(Date.UTC(parseInt(A,10),parseInt(b,10)-1,parseInt(G,10),parseInt(J,10),parseInt(Y,10),parseInt(X,10),Q?parseInt(Q.padEnd(3,"0"),10):0));if($){let F=(parseInt(H,10)*60+parseInt(B,10))*($==="+"?-1:1);Z.setUTCMinutes(Z.getUTCMinutes()+F)}return eD(Z)?Z:null}function zM(_,z={}){let{strict:A=!1,warnings:b=!1,reviver:G,parseDates:J=!0}=z;if(typeof _!=="string")return _;let Y=_.trim();if(Y.length>0&&Y[0]==='"'&&Y.endsWith('"')&&!Y.slice(1,-1).includes('"'))return Y.slice(1,-1);let X=Y.toLowerCase();if(X.length<=9&&X in yG)return yG[X];if(!sD.test(Y)){if(A)throw SyntaxError("[better-json] Invalid JSON");return _}if(Object.entries(aD).some(([Q,$])=>{let H=$.test(Y);if(H&&b)console.warn(`[better-json] Detected potential prototype pollution attempt using ${Q} pattern`);return H})&&A)throw Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(Y,($,H)=>{if($==="__proto__"||$==="constructor"&&H&&typeof H==="object"&&"prototype"in H){if(b)console.warn(`[better-json] Dropping "${$}" key to prevent prototype pollution`);return}if(J&&typeof H==="string"){let B=_M(H);if(B)return B}return G?G($,H):H})}catch(Q){if(A)throw Q;return _}}function gG(_,z={strict:!0}){return zM(_,z)}function fG(_,z){let A=e1(!1),b=c3(A,"/get-session",_,{method:"GET"});return _z(b,()=>{let G=y8({sessionAtom:b,sessionSignal:A,$fetch:_,options:z});return G.init(),()=>{G.cleanup()}}),{session:b,$sessionSignal:A}}function m8(_){if(_===null||typeof _!=="object")return!1;let z=Object.getPrototypeOf(_);if(z!==null&&z!==Object.prototype&&Object.getPrototypeOf(z)!==null)return!1;if(Symbol.iterator in _)return!1;if(Symbol.toStringTag in _)return Object.prototype.toString.call(_)==="[object Module]";return!0}function u8(_,z,A=".",b){if(!m8(z))return u8(_,{},A,b);let G=Object.assign({},z);for(let J in _){if(J==="__proto__"||J==="constructor")continue;let Y=_[J];if(Y===null||Y===void 0)continue;if(b&&b(G,J,Y,A))continue;if(Array.isArray(Y)&&Array.isArray(G[J]))G[J]=[...Y,...G[J]];else if(m8(Y)&&m8(G[J]))G[J]=u8(Y,G[J],(A?`${A}.`:"")+J.toString(),b);else G[J]=Y}return G}function c8(_){return(...z)=>z.reduce((A,b)=>u8(A,b,"",_),{})}var hG=c8(),ip=c8((_,z,A)=>{if(_[z]!==void 0&&typeof A==="function")return _[z]=A(_[z]),!0}),op=c8((_,z,A)=>{if(Array.isArray(_[z])&&typeof A==="function")return _[z]=A(_[z]),!0});var{defineProperty:AM,defineProperties:bM,getOwnPropertyDescriptors:GM,getOwnPropertySymbols:mG}=Object,JM=Object.prototype.hasOwnProperty,YM=Object.prototype.propertyIsEnumerable,uG=(_,z,A)=>(z in _)?AM(_,z,{enumerable:!0,configurable:!0,writable:!0,value:A}):_[z]=A,x9=(_,z)=>{for(var A in z||(z={}))if(JM.call(z,A))uG(_,A,z[A]);if(mG){for(var A of mG(z))if(YM.call(z,A))uG(_,A,z[A])}return _},z4=(_,z)=>bM(_,GM(z)),XM=class extends Error{constructor(_,z,A){super(z||_.toString(),{cause:A});this.status=_,this.statusText=z,this.error=A,Error.captureStackTrace(this,this.constructor)}},QM=async(_,z)=>{var A,b,G,J,Y,X;let Q=z||{},$={onRequest:[z==null?void 0:z.onRequest],onResponse:[z==null?void 0:z.onResponse],onSuccess:[z==null?void 0:z.onSuccess],onError:[z==null?void 0:z.onError],onRetry:[z==null?void 0:z.onRetry]};if(!z||!(z==null?void 0:z.plugins))return{url:_,options:Q,hooks:$};for(let H of(z==null?void 0:z.plugins)||[]){if(H.init){let B=await((A=H.init)==null?void 0:A.call(H,_.toString(),z));Q=B.options||Q,_=B.url}$.onRequest.push((b=H.hooks)==null?void 0:b.onRequest),$.onResponse.push((G=H.hooks)==null?void 0:G.onResponse),$.onSuccess.push((J=H.hooks)==null?void 0:J.onSuccess),$.onError.push((Y=H.hooks)==null?void 0:Y.onError),$.onRetry.push((X=H.hooks)==null?void 0:X.onRetry)}return{url:_,options:Q,hooks:$}},cG=class{constructor(_){this.options=_}shouldAttemptRetry(_,z){if(this.options.shouldRetry)return Promise.resolve(_<this.options.attempts&&this.options.shouldRetry(z));return Promise.resolve(_<this.options.attempts)}getDelay(){return this.options.delay}},$M=class{constructor(_){this.options=_}shouldAttemptRetry(_,z){if(this.options.shouldRetry)return Promise.resolve(_<this.options.attempts&&this.options.shouldRetry(z));return Promise.resolve(_<this.options.attempts)}getDelay(_){return Math.min(this.options.maxDelay,this.options.baseDelay*2**_)}};function HM(_){if(typeof _==="number")return new cG({type:"linear",attempts:_,delay:1000});switch(_.type){case"linear":return new cG(_);case"exponential":return new $M(_);default:throw Error("Invalid retry strategy")}}var BM=async(_)=>{let z={},A=async(b)=>typeof b==="function"?await b():b;if(_==null?void 0:_.auth){if(_.auth.type==="Bearer"){let b=await A(_.auth.token);if(!b)return z;z.authorization=`Bearer ${b}`}else if(_.auth.type==="Basic"){let[b,G]=await Promise.all([A(_.auth.username),A(_.auth.password)]);if(!b||!G)return z;z.authorization=`Basic ${btoa(`${b}:${G}`)}`}else if(_.auth.type==="Custom"){let[b,G]=await Promise.all([A(_.auth.prefix),A(_.auth.value)]);if(!G)return z;z.authorization=`${b!=null?b:""} ${G}`}}return z},ZM=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function FM(_){let z=_.headers.get("content-type"),A=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!z)return"json";let b=z.split(";").shift()||"";if(ZM.test(b))return"json";if(A.has(b)||b.startsWith("text/"))return"text";return"blob"}function KM(_){try{return JSON.parse(_),!0}catch(z){return!1}}function l8(_){if(_===void 0)return!1;let z=typeof _;if(z==="string"||z==="number"||z==="boolean"||z===null)return!0;if(z!=="object")return!1;if(Array.isArray(_))return!0;if(_.buffer)return!1;return _.constructor&&_.constructor.name==="Object"||typeof _.toJSON==="function"}function lG(_){try{return JSON.parse(_)}catch(z){return _}}function pG(_){return typeof _==="function"}function qM(_){if(_==null?void 0:_.customFetchImpl)return _.customFetchImpl;if(typeof globalThis<"u"&&pG(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&pG(window.fetch))return window.fetch;throw Error("No fetch implementation found")}async function WM(_){let z=new Headers(_==null?void 0:_.headers),A=await BM(_);for(let[b,G]of Object.entries(A||{}))z.set(b,G);if(!z.has("content-type")){let b=VM(_==null?void 0:_.body);if(b)z.set("content-type",b)}return z}function VM(_){if(l8(_))return"application/json";return null}function UM(_){if(!(_==null?void 0:_.body))return null;let z=new Headers(_==null?void 0:_.headers);if(l8(_.body)&&!z.has("content-type")){for(let[A,b]of Object.entries(_==null?void 0:_.body))if(b instanceof Date)_.body[A]=b.toISOString();return JSON.stringify(_.body)}if(z.has("content-type")&&z.get("content-type")==="application/x-www-form-urlencoded"){if(l8(_.body))return new URLSearchParams(_.body).toString();return _.body}return _.body}function DM(_,z){var A;if(z==null?void 0:z.method)return z.method.toUpperCase();if(_.startsWith("@")){let b=(A=_.split("@")[1])==null?void 0:A.split("/")[0];if(!dG.includes(b))return(z==null?void 0:z.body)?"POST":"GET";return b.toUpperCase()}return(z==null?void 0:z.body)?"POST":"GET"}function MM(_,z){let A;if(!(_==null?void 0:_.signal)&&(_==null?void 0:_.timeout))A=setTimeout(()=>z==null?void 0:z.abort(),_==null?void 0:_.timeout);return{abortTimeout:A,clearTimeout:()=>{if(A)clearTimeout(A)}}}var NM=class _ extends Error{constructor(z,A){super(A||JSON.stringify(z,null,2));this.issues=z,Object.setPrototypeOf(this,_.prototype)}};async function d3(_,z){let A=await _["~standard"].validate(z);if(A.issues)throw new NM(A.issues);return A.value}var dG=["get","post","put","patch","delete"];var wM=(_)=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(z,A){var b,G,J,Y;let X=((G=(b=_.plugins)==null?void 0:b.find((Q)=>{var $;return(($=Q.schema)==null?void 0:$.config)?z.startsWith(Q.schema.config.baseURL||"")||z.startsWith(Q.schema.config.prefix||""):!1}))==null?void 0:G.schema)||_.schema;if(X){let Q=z;if((J=X.config)==null?void 0:J.prefix){if(Q.startsWith(X.config.prefix)){if(Q=Q.replace(X.config.prefix,""),X.config.baseURL)z=z.replace(X.config.prefix,X.config.baseURL)}}if((Y=X.config)==null?void 0:Y.baseURL){if(Q.startsWith(X.config.baseURL))Q=Q.replace(X.config.baseURL,"")}let $=X.schema[Q];if($){let H=z4(x9({},A),{method:$.method,output:$.output});if(!(A==null?void 0:A.disableValidation))H=z4(x9({},H),{body:$.input?await d3($.input,A==null?void 0:A.body):A==null?void 0:A.body,params:$.params?await d3($.params,A==null?void 0:A.params):A==null?void 0:A.params,query:$.query?await d3($.query,A==null?void 0:A.query):A==null?void 0:A.query});return{url:z,options:H}}}return{url:z,options:A}}}),rG=(_)=>{async function z(A,b){let G=z4(x9(x9({},_),b),{plugins:[...(_==null?void 0:_.plugins)||[],wM(_||{}),...(b==null?void 0:b.plugins)||[]]});if(_==null?void 0:_.catchAllError)try{return await p8(A,G)}catch(J){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:J}}}return await p8(A,G)}return z};function EM(_,z){let{baseURL:A,params:b,query:G}=z||{query:{},params:{},baseURL:""},J=_.startsWith("http")?_.split("/").slice(0,3).join("/"):A||"";if(_.startsWith("@")){let B=_.toString().split("@")[1].split("/")[0];if(dG.includes(B))_=_.replace(`@${B}/`,"/")}if(!J.endsWith("/"))J+="/";let[Y,X]=_.replace(J,"").split("?"),Q=new URLSearchParams(X);for(let[B,Z]of Object.entries(G||{})){if(Z==null)continue;let F;if(typeof Z==="string")F=Z;else if(Array.isArray(Z)){for(let K of Z)Q.append(B,K);continue}else F=JSON.stringify(Z);Q.set(B,F)}if(b)if(Array.isArray(b)){let B=Y.split("/").filter((Z)=>Z.startsWith(":"));for(let[Z,F]of B.entries()){let K=b[Z];Y=Y.replace(F,K)}}else for(let[B,Z]of Object.entries(b))Y=Y.replace(`:${B}`,String(Z));if(Y=Y.split("/").map(encodeURIComponent).join("/"),Y.startsWith("/"))Y=Y.slice(1);let $=Q.toString();if($=$.length>0?`?${$}`.replace(/\+/g,"%20"):"",!J.startsWith("http"))return`${J}${Y}${$}`;return new URL(`${Y}${$}`,J)}var p8=async(_,z)=>{var A,b,G,J,Y,X,Q,$;let{hooks:H,url:B,options:Z}=await QM(_,z),F=qM(Z),K=new AbortController,q=(A=Z.signal)!=null?A:K.signal,W=EM(B,Z),V=UM(Z),w=await WM(Z),O=DM(B,Z),M=z4(x9({},Z),{url:W,headers:w,body:V,method:O,signal:q});for(let g of H.onRequest)if(g){let m=await g(M);if(typeof m==="object"&&m!==null)M=m}if("pipeTo"in M&&typeof M.pipeTo==="function"||typeof((b=z==null?void 0:z.body)==null?void 0:b.pipe)==="function"){if(!("duplex"in M))M.duplex="half"}let{clearTimeout:P}=MM(Z,K),D=await F(M.url,M);P();let L={response:D,request:M};for(let g of H.onResponse)if(g){let m=await g(z4(x9({},L),{response:((G=z==null?void 0:z.hookOptions)==null?void 0:G.cloneResponse)?D.clone():D}));if(m instanceof Response)D=m;else if(typeof m==="object"&&m!==null)D=m.response}if(D.ok){if(M.method==="HEAD")return{data:"",error:null};let m=FM(D),d={data:null,response:D,request:M};if(m==="json"||m==="text"){let Z0=await D.text(),S9=(J=M.jsonParser)!=null?J:lG;d.data=await S9(Z0)}else d.data=await D[m]();if(M==null?void 0:M.output){if(M.output&&!M.disableValidation)d.data=await d3(M.output,d.data)}for(let Z0 of H.onSuccess)if(Z0)await Z0(z4(x9({},d),{response:((Y=z==null?void 0:z.hookOptions)==null?void 0:Y.cloneResponse)?D.clone():D}));if(z==null?void 0:z.throw)return d.data;return{data:d.data,error:null}}let R=(X=z==null?void 0:z.jsonParser)!=null?X:lG,S=await D.text(),y=KM(S),e=y?await R(S):null,u={response:D,responseText:S,request:M,error:z4(x9({},e),{status:D.status,statusText:D.statusText})};for(let g of H.onError)if(g)await g(z4(x9({},u),{response:((Q=z==null?void 0:z.hookOptions)==null?void 0:Q.cloneResponse)?D.clone():D}));if(z==null?void 0:z.retry){let g=HM(z.retry),m=($=z.retryAttempt)!=null?$:0;if(await g.shouldAttemptRetry(m,D)){for(let Z0 of H.onRetry)if(Z0)await Z0(L);let d=g.getDelay(m);return await new Promise((Z0)=>setTimeout(Z0,d)),await p8(_,z4(x9({},z),{retryAttempt:m+1}))}}if(z==null?void 0:z.throw)throw new XM(D.status,D.statusText,y?e:S);return{data:null,error:z4(x9({},e),{status:D.status,statusText:D.statusText})}};var nG=(_,z)=>{let A="credentials"in Request.prototype,b=CG(_?.baseURL,_?.basePath,void 0,z)??"/api/auth",G=_?.plugins?.flatMap((M)=>M.fetchPlugins).filter((M)=>M!==void 0)||[],J={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:_?.fetchOptions?.onSuccess,onError:_?.fetchOptions?.onError,onRequest:_?.fetchOptions?.onRequest,onResponse:_?.fetchOptions?.onResponse}},{onSuccess:Y,onError:X,onRequest:Q,onResponse:$,...H}=_?.fetchOptions||{},B=rG({baseURL:b,...A?{credentials:"include"}:{},method:"GET",jsonParser(M){if(!M)return null;return gG(M,{strict:!1})},customFetchImpl:fetch,...H,plugins:[J,...H.plugins||[],..._?.disableDefaultFetchPlugins?[]:[vG],...G]}),{$sessionSignal:Z,session:F}=fG(B,_),K=_?.plugins||[],q={},W={$sessionSignal:Z,session:F},V={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},w=[{signal:"$sessionSignal",matcher(M){return M==="/sign-out"||M==="/update-user"||M==="/sign-up/email"||M==="/sign-in/email"||M==="/delete-user"||M==="/verify-email"||M==="/revoke-sessions"||M==="/revoke-session"||M==="/change-email"}}];for(let M of K){if(M.getAtoms)Object.assign(W,M.getAtoms?.(B));if(M.pathMethods)Object.assign(V,M.pathMethods);if(M.atomListeners)w.push(...M.atomListeners)}let O={notify:(M)=>{W[M].set(!W[M].get())},listen:(M,P)=>{W[M].subscribe(P)},atoms:W};for(let M of K)if(M.getActions)q=hG(M.getActions?.(B,O,_)??{},q);return{get baseURL(){return b},pluginsActions:q,pluginsAtoms:W,pluginPathMethods:V,atomListeners:w,$fetch:B,$store:O}};function iG(_){return typeof _==="object"&&_!==null&&"get"in _&&typeof _.get==="function"&&"lc"in _&&typeof _.lc==="number"}function OM(_,z,A){let b=z[_],{fetchOptions:G,query:J,...Y}=A||{};if(b)return b;if(G?.method)return G.method;if(Y&&Object.keys(Y).length>0)return"POST";return"GET"}function oG(_,z,A,b,G){function J(Y=[]){return new Proxy(function(){},{get(X,Q){if(typeof Q!=="string")return;if(Q==="then"||Q==="catch"||Q==="finally")return;let $=[...Y,Q],H=_;for(let B of $)if(H&&typeof H==="object"&&B in H)H=H[B];else{H=void 0;break}if(typeof H==="function")return H;if(iG(H))return H;return J($)},apply:async(X,Q,$)=>{let H="/"+Y.map((w)=>w.replace(/[A-Z]/g,(O)=>`-${O.toLowerCase()}`)).join("/"),B=$[0]||{},Z=$[1]||{},{query:F,fetchOptions:K,...q}=B,W={...Z,...K},V=OM(H,A,B);return await z(H,{...W,body:V==="GET"?void 0:{...q,...W?.body||{}},query:F||W?.query,method:V,async onSuccess(w){if(await W?.onSuccess?.(w),!G||W.disableSignal)return;let O=G.filter((P)=>P.matcher(H));if(!O.length)return;let M=new Set;for(let P of O){let D=b[P.signal];if(!D)return;if(M.has(P.signal))continue;M.add(P.signal);let L=D.get();setTimeout(()=>{D.set(!L)},10)}}})}})}return J()}function d8(_){let{pluginPathMethods:z,pluginsActions:A,pluginsAtoms:b,$fetch:G,atomListeners:J,$store:Y}=nG(_),X={};for(let[Q,$]of Object.entries(b))X[`use${h8(Q)}`]=$;return oG({...A,...X,$fetch:G,$store:Y},G,z,b,J)}function aG(_){return{authorize(z,A="AND"){let b=!1;for(let[G,J]of Object.entries(z)){let Y=_[G];if(!Y)return{success:!1,error:`You are not allowed to access resource: ${G}`};if(Array.isArray(J))b=J.every((X)=>Y.includes(X));else if(typeof J==="object"){let X=J;if(X.connector==="OR")b=X.actions.some((Q)=>Y.includes(Q));else b=X.actions.every((Q)=>Y.includes(Q))}else throw new m4("Invalid access control request");if(b&&A==="OR")return{success:b};if(!b&&A==="AND")return{success:!1,error:`unauthorized to access resource "${G}"`}}if(b)return{success:b};return{success:!1,error:"Not authorized"}},statements:_}}function Gz(_){return{newRole(z){return aG(z)},statements:_}}var sG={user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]},r8=Gz(sG),tG=r8.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),eG=r8.newRole({user:[],session:[]});var n8=()=>{return{id:"device-authorization",$InferServerPlugin:{},pathMethods:{"/device/code":"POST","/device/token":"POST","/device":"GET","/device/approve":"POST","/device/deny":"POST"}}};var _J={organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]},r3=Gz(_J),zJ=r3.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"],ac:["create","read","update","delete"]}),AJ=r3.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),bJ=r3.newRole({organization:[],member:[],invitation:[],team:[],ac:["read"]});function PM(_){let z=_.toLowerCase();return z==="localhost"||z.startsWith("localhost:")||z==="127.0.0.1"||z.startsWith("127.0.0.1:")||z==="[::1]"||z.startsWith("[::1]:")}function n3(_){let z=_.trim();if(!z)throw Error("Hostname is required.");let b=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//.test(z)?z:`${PM(z)?"http":"https"}://${z}`,G;try{G=new URL(b)}catch{throw Error(`Invalid hostname: ${_}`)}if(!G.hostname)throw Error(`Invalid hostname: ${_}`);if(G.pathname!=="/"||G.search||G.hash)throw Error("Hostname must not include a path, query, or fragment.");return{host:G.host.toLowerCase(),baseURL:`${G.protocol}//${G.host.toLowerCase()}`}}function i3(_){return d8({baseURL:_,plugins:[n8()]})}import{existsSync as HY,mkdirSync as Cw,readFileSync as vw,writeFileSync as yw}from"fs";import{homedir as gw}from"os";import{join as BY}from"path";import{existsSync as Pw,mkdirSync as Sw}from"fs";import{homedir as kw}from"os";import{join as $Y}from"path";var{createId:qn,init:jw,getConstants:Wn,isCuid:Vn}=XY();var z5=jw;var b5=$Y(kw(),".config","agentlogs"),QY=$Y(b5,"local.db"),Iw=typeof globalThis.Bun<"u",r_=null,A5=null;function xw(){if(!A5)A5=z5();return A5}function Tw(){if(!Pw(b5))Sw(b5,{recursive:!0})}async function s3(){if(r_)return r_;if(Tw(),Iw){let{Database:_}=await import("bun:sqlite"),z=new _(QY);r_={exec:(A)=>z.run(A),get:(A,...b)=>z.query(A).get(...b),run:(A,...b)=>z.run(A,b),all:(A,...b)=>z.query(A).all(...b)}}else{let{default:_}=await import("libsql"),z=new _(QY);r_={exec:(A)=>z.exec(A),get:(A,...b)=>z.prepare(A).get(...b),run:(A,...b)=>z.prepare(A).run(...b),all:(A,...b)=>z.prepare(A).all(...b)}}return r_.exec(`
40
+ `)$++}}let H=_.slice(0,Q),B=_.slice($),Z=H+B,q=H.trimEnd(),F=B.trimStart();if(q.endsWith(",")&&F.startsWith("}")){let K=H.lastIndexOf(",");Z=H.slice(0,K)+H.slice(K+1)+B}return Z}function BJ(_,z){let A=_,G=$J(z);for(let{path:J,value:Y}of G)if(Y===void 0)A=DD(A,J);else{let X=KD(A,J,Y,{});A=qD(A,X)}return A}import*as Gz from"fs/promises";import*as _4 from"path";function EA(_){let z=_.match(/git@([^:]+):(.+?)(?:\.git)?$/);if(z)return`${z[1]}/${z[2]}`;let A=_.match(/https?:\/\/([^/]+)\/(.+?)(?:\.git)?$/);if(A)return`${A[1]}/${A[2]}`;return null}async function wA(_){let z=_4.resolve(_),{root:A}=_4.parse(z);while(!0){let G=_4.join(z,".git");try{let Y=await Gz.stat(G);if(Y.isDirectory()||Y.isFile())return z}catch{}if(z===A)return null;let J=_4.dirname(z);if(J===z)return null;z=J}}async function MD(_){try{let z=_4.join(_,".git","config"),G=(await Gz.readFile(z,"utf8")).match(/\[remote "origin"\]\s+url\s*=\s*(.+)/i);if(!G||!G[1])return null;return G[1].trim()}catch{return null}}async function OA(_){let z=await MD(_);if(!z)return null;return EA(z)}async function h0(_){let z=_??process.cwd(),A=await wA(z);if(!A)return null;return OA(A)}async function ZJ(_,z){try{let A=_4.join(_,".git","HEAD"),J=(await Gz.readFile(A,"utf8")).trim();if(J.startsWith("ref:")){let X=J.slice(4).trim().split("/");return X[X.length-1]??z??null}return J||z||null}catch{return z??null}}var LA=WJ(ED(),".config","agentlogs"),L_=WJ(LA,"settings.json"),FJ={allowMode:"denylist",repos:{}};function VJ(){if(!jA(LA))ND(LA,{recursive:!0})}function z4(){if(VJ(),!jA(L_))return{...FJ};try{let _=KJ(L_,"utf-8"),z=HJ(_,[]);return{allowMode:z.allowMode==="allowlist"?"allowlist":"denylist",repos:typeof z.repos==="object"&&z.repos!==null?z.repos:{}}}catch{return{...FJ}}}function RA(_){VJ();try{if(jA(L_)){let z=KJ(L_,"utf-8"),A=BJ(z,_);qJ(L_,A,"utf-8")}else qJ(L_,JSON.stringify(_,null,2),"utf-8")}catch(z){throw console.error("Failed to write settings file:",z),z}}function L9(_){if(!_)return z4().allowMode==="denylist";let z=z4(),A=z.repos[_];if(z.allowMode==="denylist"){if(!A)return!0;return A.allow}else{if(!A)return!1;return A.allow}}function PA(_){if(!_)return;return z4().repos[_]?.visibility}function UJ(_,z){let A=z4();A.repos[_]={allow:!0,...z&&{visibility:z}},RA(A)}function DJ(_){let z=z4();z.repos[_]={allow:!1},RA(z)}function MJ(_){let z=z4();z.allowMode=_,RA(z)}function NJ(){return L_}async function EJ(_={}){let z=await h0();if(!z)console.error("Could not detect repository."),console.error("Make sure you are in a git repository with a remote origin configured."),process.exit(1);let A;if(_.public)A="public";else if(_.team)A="team";else if(_.private)A="private";else if(_.visibility){let Y=_.visibility.toLowerCase();if(Y!=="public"&&Y!=="team"&&Y!=="private")console.error("Invalid visibility. Use 'public', 'team', or 'private'."),process.exit(1);A=Y}UJ(z,A);let J=z4().repos[z];if(console.log(`✓ Capture enabled for: ${z}`),J?.visibility)console.log(` Visibility: ${J.visibility}`);else console.log(" Visibility: (server default)");process.exit(0)}async function wJ(){let _=await h0();if(!_)console.error("Could not detect repository."),console.error("Make sure you are in a git repository with a remote origin configured."),process.exit(1);DJ(_),console.log(`✗ Capture disabled for: ${_}`),process.exit(0)}import uA from"node:process";import uJ from"node:path";import{fileURLToPath as _M}from"node:url";import zM from"node:child_process";import AM,{constants as GM}from"node:fs/promises";import{promisify as TD}from"node:util";import CD from"node:child_process";import TA,{constants as kJ}from"node:fs/promises";import jJ from"node:process";import RD from"node:os";import PD from"node:fs";import LD from"node:fs";import OJ from"node:fs";var SA;function wD(){try{return OJ.statSync("/.dockerenv"),!0}catch{return!1}}function OD(){try{return OJ.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function kA(){if(SA===void 0)SA=wD()||OD();return SA}var IA,jD=()=>{try{return LD.statSync("/run/.containerenv"),!0}catch{return!1}};function a_(){if(IA===void 0)IA=jD()||kA();return IA}var LJ=()=>{if(jJ.platform!=="linux")return!1;if(RD.release().toLowerCase().includes("microsoft")){if(a_())return!1;return!0}try{return PD.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!a_():!1}catch{return!1}},U4=jJ.env.__IS_WSL_TEST__?LJ:LJ();import RJ from"node:process";import{Buffer as SD}from"node:buffer";import{promisify as kD}from"node:util";import ID from"node:child_process";var xD=kD(ID.execFile),xA=()=>`${RJ.env.SYSTEMROOT||RJ.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;var V9=async(_,z={})=>{let{powerShellPath:A,...G}=z,J=V9.encodeCommand(_);return xD(A??xA(),[...V9.argumentsPrefix,J],{encoding:"utf8",...G})};V9.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];V9.encodeCommand=(_)=>SD.from(_,"utf16le").toString("base64");V9.escapeArgument=(_)=>`'${String(_).replaceAll("'","''")}'`;function PJ(_){for(let z of _.split(`
41
+ `)){if(/^\s*#/.test(z))continue;let A=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(z);if(!A)continue;return A.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}var vD=TD(CD.execFile),yD=(()=>{let z;return async function(){if(z)return z;let A="/etc/wsl.conf",G=!1;try{await TA.access(A,kJ.F_OK),G=!0}catch{}if(!G)return"/mnt/";let J=await TA.readFile(A,{encoding:"utf8"}),Y=PJ(J);if(Y===void 0)return"/mnt/";return z=Y,z=z.endsWith("/")?z:`${z}/`,z}})(),gD=async()=>{return`${await yD()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`},g3=U4?gD:xA,SJ,IJ=async()=>{return SJ??=(async()=>{try{let _=await g3();return await TA.access(_,kJ.X_OK),!0}catch{return!1}})(),SJ},xJ=async()=>{let _=await g3(),z=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:A}=await V9(z,{powerShellPath:_});return A.trim()},TJ=async(_)=>{if(/^[a-z]+:\/\//i.test(_))return _;try{let{stdout:z}=await vD("wslpath",["-aw",_],{encoding:"utf8"});return z.trim()}catch{return _}};function j_(_,z,A){let G=(J)=>Object.defineProperty(_,z,{value:J,enumerable:!0,writable:!0});return Object.defineProperty(_,z,{configurable:!0,enumerable:!0,get(){let J=A();return G(J),J},set(J){G(J)}}),_}import{promisify as oD}from"node:util";import fA from"node:process";import{execFile as aD}from"node:child_process";import{promisify as fD}from"node:util";import hD from"node:process";import{execFile as mD}from"node:child_process";var uD=fD(mD);async function CA(){if(hD.platform!=="darwin")throw Error("macOS only");let{stdout:_}=await uD("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),A=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(_)?.groups.id??"com.apple.Safari";if(A==="com.apple.safari")return"com.apple.Safari";return A}import cD from"node:process";import{promisify as lD}from"node:util";import{execFile as pD,execFileSync as Dp}from"node:child_process";var dD=lD(pD);async function CJ(_,{humanReadableOutput:z=!0,signal:A}={}){if(cD.platform!=="darwin")throw Error("macOS only");let G=z?[]:["-ss"],J={};if(A)J.signal=A;let{stdout:Y}=await dD("osascript",["-e",_,G],J);return Y.trim()}async function vA(_){return CJ(`tell application "Finder" to set app_path to application file id "${_}" as string
42
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as rD}from"node:util";import{execFile as nD}from"node:child_process";var iD=rD(nD),vJ={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},f3=new Map(Object.entries(vJ));class yA extends Error{}async function gA(_=iD){let{stdout:z}=await _("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),A=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(z);if(!A)throw new yA(`Cannot find Windows browser in stdout: ${JSON.stringify(z)}`);let{id:G}=A.groups,J=vJ[G];if(!J)throw new yA(`Unknown browser ID: ${G}`);return J}var sD=oD(aD),tD=(_)=>_.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,(z)=>z.toUpperCase());async function hA(){if(fA.platform==="darwin"){let _=await CA();return{name:await vA(_),id:_}}if(fA.platform==="linux"){let{stdout:_}=await sD("xdg-mime",["query","default","x-scheme-handler/http"]),z=_.trim();return{name:tD(z.replace(/.desktop$/,"").replace("-"," ")),id:z}}if(fA.platform==="win32")return gA();throw Error("Only macOS, Linux, and Windows are supported")}import mA from"node:process";var eD=Boolean(mA.env.SSH_CONNECTION||mA.env.SSH_CLIENT||mA.env.SSH_TTY),yJ=eD;var h3=Symbol("fallbackAttempt"),cA=import.meta.url?uJ.dirname(_M(import.meta.url)):"",gJ=uJ.join(cA,"xdg-open"),{platform:s_,arch:fJ}=uA,hJ=async(_,z)=>{if(_.length===0)return;let A=[];for(let G of _)try{return await z(G)}catch(J){A.push(J)}throw AggregateError(A,"Failed to open in all supported apps")},m3=async(_)=>{_={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,..._};let z=_[h3]===!0;if(delete _[h3],Array.isArray(_.app))return hJ(_.app,($)=>m3({..._,app:$,[h3]:!0}));let{name:A,arguments:G=[]}=_.app??{};if(G=[...G],Array.isArray(A))return hJ(A,($)=>m3({..._,app:{name:$,arguments:G},[h3]:!0}));if(A==="browser"||A==="browserPrivate"){let $={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},H={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},B;if(U4){let Z=await xJ();B=f3.get(Z)??{}}else B=await hA();if(B.id in $){let Z=$[B.id.toLowerCase()];if(A==="browserPrivate"){if(Z==="safari")throw Error("Safari doesn't support opening in private mode via command line");G.push(H[Z])}return m3({..._,app:{name:t_[Z],arguments:G}})}throw Error(`${B.name} is not supported as a default browser`)}let J,Y=[],X={},b=!1;if(U4&&!a_()&&!yJ&&!A)b=await IJ();if(s_==="darwin"){if(J="open",_.wait)Y.push("--wait-apps");if(_.background)Y.push("--background");if(_.newInstance)Y.push("--new");if(A)Y.push("-a",A)}else if(s_==="win32"||b){if(J=await g3(),Y.push(...V9.argumentsPrefix),!U4)X.windowsVerbatimArguments=!0;if(U4&&_.target)_.target=await TJ(_.target);let $=["$ProgressPreference = 'SilentlyContinue';","Start"];if(_.wait)$.push("-Wait");if(A){if($.push(V9.escapeArgument(A)),_.target)G.push(_.target)}else if(_.target)$.push(V9.escapeArgument(_.target));if(G.length>0)G=G.map((H)=>V9.escapeArgument(H)),$.push("-ArgumentList",G.join(","));if(_.target=V9.encodeCommand($.join(" ")),!_.wait)X.stdio="ignore"}else{if(A)J=A;else{let $=!cA||cA==="/",H=!1;try{await AM.access(gJ,GM.X_OK),H=!0}catch{}J=uA.versions.electron??(s_==="android"||$||!H)?"xdg-open":gJ}if(G.length>0)Y.push(...G);if(!_.wait)X.stdio="ignore",X.detached=!0}if(s_==="darwin"&&G.length>0)Y.push("--args",...G);if(_.target)Y.push(_.target);let Q=zM.spawn(J,Y,X);if(_.wait)return new Promise(($,H)=>{Q.once("error",H),Q.once("close",(B)=>{if(!_.allowNonzeroExitCode&&B!==0){H(Error(`Exited with code ${B}`));return}$(Q)})});if(z)return new Promise(($,H)=>{Q.once("error",H),Q.once("spawn",()=>{Q.once("close",(B)=>{if(Q.off("error",H),B!==0){H(Error(`Exited with code ${B}`));return}Q.unref(),$(Q)})})});return Q.unref(),new Promise(($,H)=>{Q.once("error",H),Q.once("spawn",()=>{Q.off("error",H),$(Q)})})},JM=(_,z)=>{if(typeof _!=="string")throw TypeError("Expected a `target`");return m3({...z,target:_})};function mJ(_){if(typeof _==="string"||Array.isArray(_))return _;let{[fJ]:z}=_;if(!z)throw Error(`${fJ} is not supported`);return z}function Jz({[s_]:_},{wsl:z}={}){if(z&&U4)return mJ(z);if(!_)throw Error(`${s_} is not supported`);return mJ(_)}var t_={browser:"browser",browserPrivate:"browserPrivate"};j_(t_,"chrome",()=>Jz({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));j_(t_,"brave",()=>Jz({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));j_(t_,"firefox",()=>Jz({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));j_(t_,"edge",()=>Jz({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));j_(t_,"safari",()=>Jz({darwin:"Safari"}));var cJ=JM;var u3=Symbol.for("better-auth:broadcast-channel"),YM=()=>Math.floor(Date.now()/1000),XM=class{listeners=new Set;name;constructor(_="better-auth.message"){this.name=_}subscribe(_){return this.listeners.add(_),()=>{this.listeners.delete(_)}}post(_){if(typeof window>"u")return;try{localStorage.setItem(this.name,JSON.stringify({..._,timestamp:YM()}))}catch{}}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};let _=(z)=>{if(z.key!==this.name)return;let A=JSON.parse(z.newValue??"{}");if(A?.event!=="session"||!A?.data)return;this.listeners.forEach((G)=>G(A))};return window.addEventListener("storage",_),()=>{window.removeEventListener("storage",_)}}};function Yz(_="better-auth.message"){if(!globalThis[u3])globalThis[u3]=new XM(_);return globalThis[u3]}var c3=Symbol.for("better-auth:focus-manager"),bM=class{listeners=new Set;subscribe(_){return this.listeners.add(_),()=>{this.listeners.delete(_)}}setFocused(_){this.listeners.forEach((z)=>z(_))}setup(){if(typeof window>"u"||typeof document>"u"||typeof window.addEventListener>"u")return()=>{};let _=()=>{if(document.visibilityState==="visible")this.setFocused(!0)};return document.addEventListener("visibilitychange",_,!1),()=>{document.removeEventListener("visibilitychange",_,!1)}}};function lA(){if(!globalThis[c3])globalThis[c3]=new bM;return globalThis[c3]}var l3=Symbol.for("better-auth:online-manager"),QM=class{listeners=new Set;isOnline=typeof navigator<"u"?navigator.onLine:!0;subscribe(_){return this.listeners.add(_),()=>{this.listeners.delete(_)}}setOnline(_){this.isOnline=_,this.listeners.forEach((z)=>z(_))}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};let _=()=>this.setOnline(!0),z=()=>this.setOnline(!1);return window.addEventListener("online",_,!1),window.addEventListener("offline",z,!1),()=>{window.removeEventListener("online",_,!1),window.removeEventListener("offline",z,!1)}}};function p3(){if(!globalThis[l3])globalThis[l3]=new QM;return globalThis[l3]}var v9=[],r4=0,d3=4,$M=0,Xz=(_)=>{let z=[],A={get(){if(!A.lc)A.listen(()=>{})();return A.value},lc:0,listen(G){return A.lc=z.push(G),()=>{for(let Y=r4+d3;Y<v9.length;)if(v9[Y]===G)v9.splice(Y,d3);else Y+=d3;let J=z.indexOf(G);if(~J){if(z.splice(J,1),!--A.lc)A.off()}}},notify(G,J){$M++;let Y=!v9.length;for(let X of z)v9.push(X,A.value,G,J);if(Y){for(r4=0;r4<v9.length;r4+=d3)v9[r4](v9[r4+1],v9[r4+2],v9[r4+3]);v9.length=0}},off(){},set(G){let J=A.value;if(J!==G)A.value=G,A.notify(J)},subscribe(G){let J=A.listen(G);return G(A.value),J},value:_};return A};var HM=5,r3=6,n3=10,BM=(_,z,A,G)=>{if(_.events=_.events||{},!_.events[A+n3])_.events[A+n3]=G((J)=>{_.events[A].reduceRight((Y,X)=>(X(Y),Y),{shared:{},...J})});return _.events[A]=_.events[A]||[],_.events[A].push(z),()=>{let J=_.events[A],Y=J.indexOf(z);if(J.splice(Y,1),!J.length)delete _.events[A],_.events[A+n3](),delete _.events[A+n3]}};var lJ=1000,bz=(_,z)=>{return BM(_,(G)=>{let J=z(G);if(J)_.events[r3].push(J)},HM,(G)=>{let J=_.listen;_.listen=(...X)=>{if(!_.lc&&!_.active)_.active=!0,G();return J(...X)};let Y=_.off;return _.events[r3]=[],_.off=()=>{Y(),setTimeout(()=>{if(_.active&&!_.lc){_.active=!1;for(let X of _.events[r3])X();_.events[r3]=[]}},lJ)},()=>{_.listen=J,_.off=Y}})};var ZM=()=>typeof window>"u",i3=(_,z,A,G)=>{let J=Xz({data:null,error:null,isPending:!0,isRefetching:!1,refetch:(b)=>Y(b)}),Y=async(b)=>{return new Promise((Q)=>{let $=typeof G==="function"?G({data:J.get().data,error:J.get().error,isPending:J.get().isPending}):G;A(z,{...$,query:{...$?.query,...b?.query},async onSuccess(H){J.set({data:H.data,error:null,isPending:!1,isRefetching:!1,refetch:J.value.refetch}),await $?.onSuccess?.(H)},async onError(H){let{request:B}=H,Z=typeof B.retry==="number"?B.retry:B.retry?.attempts,q=B.retryAttempt||0;if(Z&&q<Z)return;J.set({error:H.error,data:null,isPending:!1,isRefetching:!1,refetch:J.value.refetch}),await $?.onError?.(H)},async onRequest(H){let B=J.get();J.set({isPending:B.data===null,data:B.data,error:null,isRefetching:!0,refetch:J.value.refetch}),await $?.onRequest?.(H)}}).catch((H)=>{J.set({error:H,data:null,isPending:!1,isRefetching:!1,refetch:J.value.refetch})}).finally(()=>{Q(void 0)})})};_=Array.isArray(_)?_:[_];let X=!1;for(let b of _)b.subscribe(async()=>{if(ZM())return;if(X)await Y();else bz(J,()=>{let Q=setTimeout(async()=>{if(!X)await Y(),X=!0},0);return()=>{J.off(),b.off(),clearTimeout(Q)}})});return J};var e_=()=>Math.floor(Date.now()/1000),qM=5;function pA(_){let{sessionAtom:z,sessionSignal:A,$fetch:G,options:J={}}=_,Y=J.sessionOptions?.refetchInterval??0,X=J.sessionOptions?.refetchOnWindowFocus??!0,b=J.sessionOptions?.refetchWhenOffline??!1,Q={lastSync:0,lastSessionRequest:0,cachedSession:void 0},$=()=>{return b||p3().isOnline},H=(N)=>{if(!$())return;if(N?.event==="storage"){Q.lastSync=e_(),A.set(!A.get());return}let L=z.get();if(N?.event==="poll"){Q.lastSessionRequest=e_(),G("/get-session").then((M)=>{if(M.error)z.set({...L,data:null,error:M.error});else z.set({...L,data:M.data,error:null});Q.lastSync=e_(),A.set(!A.get())}).catch(()=>{});return}if(N?.event==="visibilitychange"){if(e_()-Q.lastSessionRequest<qM)return;Q.lastSessionRequest=e_()}if(L?.data===null||L?.data===void 0||N?.event==="visibilitychange")Q.lastSync=e_(),A.set(!A.get())},B=(N)=>{Yz().post({event:"session",data:{trigger:N},clientId:Math.random().toString(36).substring(7)})},Z=()=>{if(Y&&Y>0)Q.pollInterval=setInterval(()=>{if(z.get()?.data)H({event:"poll"})},Y*1000)},q=()=>{Q.unsubscribeBroadcast=Yz().subscribe(()=>{H({event:"storage"})})},F=()=>{if(!X)return;Q.unsubscribeFocus=lA().subscribe(()=>{H({event:"visibilitychange"})})},K=()=>{Q.unsubscribeOnline=p3().subscribe((N)=>{if(N)H({event:"visibilitychange"})})};return{init:()=>{Z(),q(),F(),K(),Yz().setup(),lA().setup(),p3().setup()},cleanup:()=>{if(Q.pollInterval)clearInterval(Q.pollInterval),Q.pollInterval=void 0;if(Q.unsubscribeBroadcast)Q.unsubscribeBroadcast(),Q.unsubscribeBroadcast=void 0;if(Q.unsubscribeFocus)Q.unsubscribeFocus(),Q.unsubscribeFocus=void 0;if(Q.unsubscribeOnline)Q.unsubscribeOnline(),Q.unsubscribeOnline=void 0;Q.lastSync=0,Q.lastSessionRequest=0,Q.cachedSession=void 0},triggerRefetch:H,broadcastSessionUpdate:B}}var o3=Object.create(null),Qz=(_)=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(_?o3:globalThis),_9=new Proxy(o3,{get(_,z){return Qz()[z]??o3[z]},has(_,z){return z in Qz()||z in o3},set(_,z,A){let G=Qz(!0);return G[z]=A,!0},deleteProperty(_,z){if(!z)return!1;let A=Qz(!0);return delete A[z],!0},ownKeys(){let _=Qz(!0);return Object.keys(_)}});var FM=typeof process<"u"&&process.env&&"production"||"";function q0(_,z){if(typeof process<"u"&&process.env)return process.env[_]??z;if(typeof Deno<"u")return Deno.env.get(_)??z;if(typeof Bun<"u")return Bun.env[_]??z;return z}var KM=Object.freeze({get BETTER_AUTH_SECRET(){return q0("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return q0("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return q0("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return q0("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return q0("NODE_ENV","development")},get PACKAGE_VERSION(){return q0("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return q0("BETTER_AUTH_TELEMETRY_ENDPOINT","https://telemetry.better-auth.com/v1/track")}});var $z=1,g0=4,A4=8,U9=24,pJ={eterm:g0,cons25:g0,console:g0,cygwin:g0,dtterm:g0,gnome:g0,hurd:g0,jfbterm:g0,konsole:g0,kterm:g0,mlterm:g0,mosh:U9,putty:g0,st:g0,"rxvt-unicode-24bit":U9,terminator:U9,"xterm-kitty":U9},WM=new Map(Object.entries({APPVEYOR:A4,BUILDKITE:A4,CIRCLECI:U9,DRONE:A4,GITEA_ACTIONS:U9,GITHUB_ACTIONS:U9,GITLAB_CI:A4,TRAVIS:A4})),VM=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function dA(){if(q0("FORCE_COLOR")!==void 0)switch(q0("FORCE_COLOR")){case"":case"1":case"true":return g0;case"2":return A4;case"3":return U9;default:return $z}if(q0("NODE_DISABLE_COLORS")!==void 0&&q0("NODE_DISABLE_COLORS")!==""||q0("NO_COLOR")!==void 0&&q0("NO_COLOR")!==""||q0("TERM")==="dumb")return $z;if(q0("TMUX"))return U9;if("TF_BUILD"in _9&&"AGENT_NAME"in _9)return g0;if("CI"in _9){for(let{0:_,1:z}of WM)if(_ in _9)return z;if(q0("CI_NAME")==="codeship")return A4;return $z}if("TEAMCITY_VERSION"in _9)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(q0("TEAMCITY_VERSION"))!==null?g0:$z;switch(q0("TERM_PROGRAM")){case"iTerm.app":if(!q0("TERM_PROGRAM_VERSION")||/^[0-2]\./.exec(q0("TERM_PROGRAM_VERSION"))!==null)return A4;return U9;case"HyperTerm":case"MacTerm":return U9;case"Apple_Terminal":return A4}if(q0("COLORTERM")==="truecolor"||q0("COLORTERM")==="24bit")return U9;if(q0("TERM")){if(/truecolor/.exec(q0("TERM"))!==null)return U9;if(/^xterm-256/.exec(q0("TERM"))!==null)return A4;let _=q0("TERM").toLowerCase();if(pJ[_])return pJ[_];if(VM.some((z)=>z.exec(_)!==null))return g0}if(q0("COLORTERM"))return g0;return $z}var y9={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",undim:"\x1B[22m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",fg:{black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},bg:{black:"\x1B[40m",red:"\x1B[41m",green:"\x1B[42m",yellow:"\x1B[43m",blue:"\x1B[44m",magenta:"\x1B[45m",cyan:"\x1B[46m",white:"\x1B[47m"}},a3=["debug","info","success","warn","error"];function dJ(_,z){return a3.indexOf(z)>=a3.indexOf(_)}var UM={info:y9.fg.blue,success:y9.fg.green,warn:y9.fg.yellow,error:y9.fg.red,debug:y9.fg.magenta},DM=(_,z,A)=>{let G=new Date().toISOString();if(A)return`${y9.dim}${G}${y9.reset} ${UM[_]}${_.toUpperCase()}${y9.reset} ${y9.bright}[Better Auth]:${y9.reset} ${z}`;return`${G} ${_.toUpperCase()} [Better Auth]: ${z}`},rJ=(_)=>{let z=_?.disabled!==!0,A=_?.level??"error",G=_?.disableColors!==void 0?!_.disableColors:dA()!==1,J=(Y,X,b=[])=>{if(!z||!dJ(A,Y))return;let Q=DM(Y,X,G);if(!_||typeof _.log!=="function"){if(Y==="error")console.error(Q,...b);else if(Y==="warn")console.warn(Q,...b);else console.log(Q,...b);return}_.log(Y==="success"?"info":Y,X,...b)};return{...Object.fromEntries(a3.map((Y)=>[Y,(...[X,...b])=>J(Y,X,b)])),get level(){return A}}},nJ=rJ();function rA(_){return _}function nA(_){return _.charAt(0).toUpperCase()+_.slice(1)}var MM=rA({USER_NOT_FOUND:"User not found",FAILED_TO_CREATE_USER:"Failed to create user",FAILED_TO_CREATE_SESSION:"Failed to create session",FAILED_TO_UPDATE_USER:"Failed to update user",FAILED_TO_GET_SESSION:"Failed to get session",INVALID_PASSWORD:"Invalid password",INVALID_EMAIL:"Invalid email",INVALID_EMAIL_OR_PASSWORD:"Invalid email or password",SOCIAL_ACCOUNT_ALREADY_LINKED:"Social account already linked",PROVIDER_NOT_FOUND:"Provider not found",INVALID_TOKEN:"Invalid token",ID_TOKEN_NOT_SUPPORTED:"id_token not supported",FAILED_TO_GET_USER_INFO:"Failed to get user info",USER_EMAIL_NOT_FOUND:"User email not found",EMAIL_NOT_VERIFIED:"Email not verified",PASSWORD_TOO_SHORT:"Password too short",PASSWORD_TOO_LONG:"Password too long",USER_ALREADY_EXISTS:"User already exists.",USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:"User already exists. Use another email.",EMAIL_CAN_NOT_BE_UPDATED:"Email can not be updated",CREDENTIAL_ACCOUNT_NOT_FOUND:"Credential account not found",SESSION_EXPIRED:"Session expired. Re-authenticate to perform this action.",FAILED_TO_UNLINK_LAST_ACCOUNT:"You can't unlink your last account",ACCOUNT_NOT_FOUND:"Account not found",USER_ALREADY_HAS_PASSWORD:"User already has a password. Provide that to delete the account.",CROSS_SITE_NAVIGATION_LOGIN_BLOCKED:"Cross-site navigation login blocked. This request appears to be a CSRF attack.",VERIFICATION_EMAIL_NOT_ENABLED:"Verification email isn't enabled",EMAIL_ALREADY_VERIFIED:"Email is already verified",EMAIL_MISMATCH:"Email mismatch",SESSION_NOT_FRESH:"Session is not fresh",LINKED_ACCOUNT_ALREADY_EXISTS:"Linked account already exists",INVALID_ORIGIN:"Invalid origin",INVALID_CALLBACK_URL:"Invalid callbackURL",INVALID_REDIRECT_URL:"Invalid redirectURL",INVALID_ERROR_CALLBACK_URL:"Invalid errorCallbackURL",INVALID_NEW_USER_CALLBACK_URL:"Invalid newUserCallbackURL",MISSING_OR_NULL_ORIGIN:"Missing or null Origin",CALLBACK_URL_REQUIRED:"callbackURL is required",FAILED_TO_CREATE_VERIFICATION:"Unable to create verification",FIELD_NOT_ALLOWED:"Field not allowed to be set",ASYNC_VALIDATION_NOT_SUPPORTED:"Async validation is not supported",VALIDATION_ERROR:"Validation Error",MISSING_FIELD:"Field is required"});var n4=class extends Error{constructor(_,z){super(_,z);this.name="BetterAuthError",this.message=_,this.stack=""}};function NM(_){try{return(new URL(_).pathname.replace(/\/+$/,"")||"/")!=="/"}catch{throw new n4(`Invalid base URL: ${_}. Please provide a valid base URL.`)}}function EM(_){try{let z=new URL(_);if(z.protocol!=="http:"&&z.protocol!=="https:")throw new n4(`Invalid base URL: ${_}. URL must include 'http://' or 'https://'`)}catch(z){if(z instanceof n4)throw z;throw new n4(`Invalid base URL: ${_}. Please provide a valid base URL.`,{cause:z})}}function Hz(_,z="/api/auth"){if(EM(_),NM(_))return _;let A=_.replace(/\/+$/,"");if(!z||z==="/")return A;return z=z.startsWith("/")?z:`/${z}`,`${A}${z}`}function iJ(_,z){if(!_||_.trim()==="")return!1;if(z==="proto")return _==="http"||_==="https";if(z==="host"){if([/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some((A)=>A.test(_)))return!1;return/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(_)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(_)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(_)||/^localhost(:[0-9]{1,5})?$/i.test(_)}return!1}function oJ(_,z,A,G,J){if(_)return Hz(_,z);if(G!==!1){let b=_9.BETTER_AUTH_URL||_9.NEXT_PUBLIC_BETTER_AUTH_URL||_9.PUBLIC_BETTER_AUTH_URL||_9.NUXT_PUBLIC_BETTER_AUTH_URL||_9.NUXT_PUBLIC_AUTH_URL||(_9.BASE_URL!=="/"?_9.BASE_URL:void 0);if(b)return Hz(b,z)}let Y=A?.headers.get("x-forwarded-host"),X=A?.headers.get("x-forwarded-proto");if(Y&&X&&J){if(iJ(X,"proto")&&iJ(Y,"host"))try{return Hz(`${X}://${Y}`,z)}catch(b){}}if(A){let b=wM(A.url);if(!b)throw new n4("Could not get origin from request. Please provide a valid base URL.");return Hz(b,z)}if(typeof window<"u"&&window.location)return Hz(window.location.origin,z)}function wM(_){try{let z=new URL(_);return z.origin==="null"?null:z.origin}catch{return null}}var aJ={id:"redirect",name:"Redirect",hooks:{onSuccess(_){if(_.data?.url&&_.data?.redirect){if(typeof window<"u"&&window.location){if(window.location)try{window.location.href=_.data.url}catch{}}}}}};var OM={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},LM=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,sJ={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},jM=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function RM(_){return _ instanceof Date&&!isNaN(_.getTime())}function PM(_){let z=jM.exec(_);if(!z)return null;let[,A,G,J,Y,X,b,Q,$,H,B]=z,Z=new Date(Date.UTC(parseInt(A,10),parseInt(G,10)-1,parseInt(J,10),parseInt(Y,10),parseInt(X,10),parseInt(b,10),Q?parseInt(Q.padEnd(3,"0"),10):0));if($){let q=(parseInt(H,10)*60+parseInt(B,10))*($==="+"?-1:1);Z.setUTCMinutes(Z.getUTCMinutes()+q)}return RM(Z)?Z:null}function SM(_,z={}){let{strict:A=!1,warnings:G=!1,reviver:J,parseDates:Y=!0}=z;if(typeof _!=="string")return _;let X=_.trim();if(X.length>0&&X[0]==='"'&&X.endsWith('"')&&!X.slice(1,-1).includes('"'))return X.slice(1,-1);let b=X.toLowerCase();if(b.length<=9&&b in sJ)return sJ[b];if(!LM.test(X)){if(A)throw SyntaxError("[better-json] Invalid JSON");return _}if(Object.entries(OM).some(([Q,$])=>{let H=$.test(X);if(H&&G)console.warn(`[better-json] Detected potential prototype pollution attempt using ${Q} pattern`);return H})&&A)throw Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(X,($,H)=>{if($==="__proto__"||$==="constructor"&&H&&typeof H==="object"&&"prototype"in H){if(G)console.warn(`[better-json] Dropping "${$}" key to prevent prototype pollution`);return}if(Y&&typeof H==="string"){let B=PM(H);if(B)return B}return J?J($,H):H})}catch(Q){if(A)throw Q;return _}}function tJ(_,z={strict:!0}){return SM(_,z)}function eJ(_,z){let A=Xz(!1),G=i3(A,"/get-session",_,{method:"GET"});return bz(G,()=>{let J=pA({sessionAtom:G,sessionSignal:A,$fetch:_,options:z});return J.init(),()=>{J.cleanup()}}),{session:G,$sessionSignal:A}}function iA(_){if(_===null||typeof _!=="object")return!1;let z=Object.getPrototypeOf(_);if(z!==null&&z!==Object.prototype&&Object.getPrototypeOf(z)!==null)return!1;if(Symbol.iterator in _)return!1;if(Symbol.toStringTag in _)return Object.prototype.toString.call(_)==="[object Module]";return!0}function oA(_,z,A=".",G){if(!iA(z))return oA(_,{},A,G);let J=Object.assign({},z);for(let Y in _){if(Y==="__proto__"||Y==="constructor")continue;let X=_[Y];if(X===null||X===void 0)continue;if(G&&G(J,Y,X,A))continue;if(Array.isArray(X)&&Array.isArray(J[Y]))J[Y]=[...X,...J[Y]];else if(iA(X)&&iA(J[Y]))J[Y]=oA(X,J[Y],(A?`${A}.`:"")+Y.toString(),G);else J[Y]=X}return J}function aA(_){return(...z)=>z.reduce((A,G)=>oA(A,G,"",_),{})}var _Y=aA(),$r=aA((_,z,A)=>{if(_[z]!==void 0&&typeof A==="function")return _[z]=A(_[z]),!0}),Hr=aA((_,z,A)=>{if(Array.isArray(_[z])&&typeof A==="function")return _[z]=A(_[z]),!0});var{defineProperty:kM,defineProperties:IM,getOwnPropertyDescriptors:xM,getOwnPropertySymbols:zY}=Object,TM=Object.prototype.hasOwnProperty,CM=Object.prototype.propertyIsEnumerable,AY=(_,z,A)=>(z in _)?kM(_,z,{enumerable:!0,configurable:!0,writable:!0,value:A}):_[z]=A,g9=(_,z)=>{for(var A in z||(z={}))if(TM.call(z,A))AY(_,A,z[A]);if(zY){for(var A of zY(z))if(CM.call(z,A))AY(_,A,z[A])}return _},G4=(_,z)=>IM(_,xM(z)),vM=class extends Error{constructor(_,z,A){super(z||_.toString(),{cause:A});this.status=_,this.statusText=z,this.error=A,Error.captureStackTrace(this,this.constructor)}},yM=async(_,z)=>{var A,G,J,Y,X,b;let Q=z||{},$={onRequest:[z==null?void 0:z.onRequest],onResponse:[z==null?void 0:z.onResponse],onSuccess:[z==null?void 0:z.onSuccess],onError:[z==null?void 0:z.onError],onRetry:[z==null?void 0:z.onRetry]};if(!z||!(z==null?void 0:z.plugins))return{url:_,options:Q,hooks:$};for(let H of(z==null?void 0:z.plugins)||[]){if(H.init){let B=await((A=H.init)==null?void 0:A.call(H,_.toString(),z));Q=B.options||Q,_=B.url}$.onRequest.push((G=H.hooks)==null?void 0:G.onRequest),$.onResponse.push((J=H.hooks)==null?void 0:J.onResponse),$.onSuccess.push((Y=H.hooks)==null?void 0:Y.onSuccess),$.onError.push((X=H.hooks)==null?void 0:X.onError),$.onRetry.push((b=H.hooks)==null?void 0:b.onRetry)}return{url:_,options:Q,hooks:$}},GY=class{constructor(_){this.options=_}shouldAttemptRetry(_,z){if(this.options.shouldRetry)return Promise.resolve(_<this.options.attempts&&this.options.shouldRetry(z));return Promise.resolve(_<this.options.attempts)}getDelay(){return this.options.delay}},gM=class{constructor(_){this.options=_}shouldAttemptRetry(_,z){if(this.options.shouldRetry)return Promise.resolve(_<this.options.attempts&&this.options.shouldRetry(z));return Promise.resolve(_<this.options.attempts)}getDelay(_){return Math.min(this.options.maxDelay,this.options.baseDelay*2**_)}};function fM(_){if(typeof _==="number")return new GY({type:"linear",attempts:_,delay:1000});switch(_.type){case"linear":return new GY(_);case"exponential":return new gM(_);default:throw Error("Invalid retry strategy")}}var hM=async(_)=>{let z={},A=async(G)=>typeof G==="function"?await G():G;if(_==null?void 0:_.auth){if(_.auth.type==="Bearer"){let G=await A(_.auth.token);if(!G)return z;z.authorization=`Bearer ${G}`}else if(_.auth.type==="Basic"){let[G,J]=await Promise.all([A(_.auth.username),A(_.auth.password)]);if(!G||!J)return z;z.authorization=`Basic ${btoa(`${G}:${J}`)}`}else if(_.auth.type==="Custom"){let[G,J]=await Promise.all([A(_.auth.prefix),A(_.auth.value)]);if(!J)return z;z.authorization=`${G!=null?G:""} ${J}`}}return z},mM=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function uM(_){let z=_.headers.get("content-type"),A=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!z)return"json";let G=z.split(";").shift()||"";if(mM.test(G))return"json";if(A.has(G)||G.startsWith("text/"))return"text";return"blob"}function cM(_){try{return JSON.parse(_),!0}catch(z){return!1}}function sA(_){if(_===void 0)return!1;let z=typeof _;if(z==="string"||z==="number"||z==="boolean"||z===null)return!0;if(z!=="object")return!1;if(Array.isArray(_))return!0;if(_.buffer)return!1;return _.constructor&&_.constructor.name==="Object"||typeof _.toJSON==="function"}function JY(_){try{return JSON.parse(_)}catch(z){return _}}function YY(_){return typeof _==="function"}function lM(_){if(_==null?void 0:_.customFetchImpl)return _.customFetchImpl;if(typeof globalThis<"u"&&YY(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&YY(window.fetch))return window.fetch;throw Error("No fetch implementation found")}async function pM(_){let z=new Headers(_==null?void 0:_.headers),A=await hM(_);for(let[G,J]of Object.entries(A||{}))z.set(G,J);if(!z.has("content-type")){let G=dM(_==null?void 0:_.body);if(G)z.set("content-type",G)}return z}function dM(_){if(sA(_))return"application/json";return null}function rM(_){if(!(_==null?void 0:_.body))return null;let z=new Headers(_==null?void 0:_.headers);if(sA(_.body)&&!z.has("content-type")){for(let[A,G]of Object.entries(_==null?void 0:_.body))if(G instanceof Date)_.body[A]=G.toISOString();return JSON.stringify(_.body)}if(z.has("content-type")&&z.get("content-type")==="application/x-www-form-urlencoded"){if(sA(_.body))return new URLSearchParams(_.body).toString();return _.body}return _.body}function nM(_,z){var A;if(z==null?void 0:z.method)return z.method.toUpperCase();if(_.startsWith("@")){let G=(A=_.split("@")[1])==null?void 0:A.split("/")[0];if(!XY.includes(G))return(z==null?void 0:z.body)?"POST":"GET";return G.toUpperCase()}return(z==null?void 0:z.body)?"POST":"GET"}function iM(_,z){let A;if(!(_==null?void 0:_.signal)&&(_==null?void 0:_.timeout))A=setTimeout(()=>z==null?void 0:z.abort(),_==null?void 0:_.timeout);return{abortTimeout:A,clearTimeout:()=>{if(A)clearTimeout(A)}}}var oM=class _ extends Error{constructor(z,A){super(A||JSON.stringify(z,null,2));this.issues=z,Object.setPrototypeOf(this,_.prototype)}};async function s3(_,z){let A=await _["~standard"].validate(z);if(A.issues)throw new oM(A.issues);return A.value}var XY=["get","post","put","patch","delete"];var aM=(_)=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(z,A){var G,J,Y,X;let b=((J=(G=_.plugins)==null?void 0:G.find((Q)=>{var $;return(($=Q.schema)==null?void 0:$.config)?z.startsWith(Q.schema.config.baseURL||"")||z.startsWith(Q.schema.config.prefix||""):!1}))==null?void 0:J.schema)||_.schema;if(b){let Q=z;if((Y=b.config)==null?void 0:Y.prefix){if(Q.startsWith(b.config.prefix)){if(Q=Q.replace(b.config.prefix,""),b.config.baseURL)z=z.replace(b.config.prefix,b.config.baseURL)}}if((X=b.config)==null?void 0:X.baseURL){if(Q.startsWith(b.config.baseURL))Q=Q.replace(b.config.baseURL,"")}let $=b.schema[Q];if($){let H=G4(g9({},A),{method:$.method,output:$.output});if(!(A==null?void 0:A.disableValidation))H=G4(g9({},H),{body:$.input?await s3($.input,A==null?void 0:A.body):A==null?void 0:A.body,params:$.params?await s3($.params,A==null?void 0:A.params):A==null?void 0:A.params,query:$.query?await s3($.query,A==null?void 0:A.query):A==null?void 0:A.query});return{url:z,options:H}}}return{url:z,options:A}}}),bY=(_)=>{async function z(A,G){let J=G4(g9(g9({},_),G),{plugins:[...(_==null?void 0:_.plugins)||[],aM(_||{}),...(G==null?void 0:G.plugins)||[]]});if(_==null?void 0:_.catchAllError)try{return await tA(A,J)}catch(Y){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:Y}}}return await tA(A,J)}return z};function sM(_,z){let{baseURL:A,params:G,query:J}=z||{query:{},params:{},baseURL:""},Y=_.startsWith("http")?_.split("/").slice(0,3).join("/"):A||"";if(_.startsWith("@")){let B=_.toString().split("@")[1].split("/")[0];if(XY.includes(B))_=_.replace(`@${B}/`,"/")}if(!Y.endsWith("/"))Y+="/";let[X,b]=_.replace(Y,"").split("?"),Q=new URLSearchParams(b);for(let[B,Z]of Object.entries(J||{})){if(Z==null)continue;let q;if(typeof Z==="string")q=Z;else if(Array.isArray(Z)){for(let F of Z)Q.append(B,F);continue}else q=JSON.stringify(Z);Q.set(B,q)}if(G)if(Array.isArray(G)){let B=X.split("/").filter((Z)=>Z.startsWith(":"));for(let[Z,q]of B.entries()){let F=G[Z];X=X.replace(q,F)}}else for(let[B,Z]of Object.entries(G))X=X.replace(`:${B}`,String(Z));if(X=X.split("/").map(encodeURIComponent).join("/"),X.startsWith("/"))X=X.slice(1);let $=Q.toString();if($=$.length>0?`?${$}`.replace(/\+/g,"%20"):"",!Y.startsWith("http"))return`${Y}${X}${$}`;return new URL(`${X}${$}`,Y)}var tA=async(_,z)=>{var A,G,J,Y,X,b,Q,$;let{hooks:H,url:B,options:Z}=await yM(_,z),q=lM(Z),F=new AbortController,K=(A=Z.signal)!=null?A:F.signal,W=sM(B,Z),V=rM(Z),N=await pM(Z),L=nM(B,Z),M=G4(g9({},Z),{url:W,headers:N,body:V,method:L,signal:K});for(let f of H.onRequest)if(f){let u=await f(M);if(typeof u==="object"&&u!==null)M=u}if("pipeTo"in M&&typeof M.pipeTo==="function"||typeof((G=z==null?void 0:z.body)==null?void 0:G.pipe)==="function"){if(!("duplex"in M))M.duplex="half"}let{clearTimeout:k}=iM(Z,F),U=await q(M.url,M);k();let O={response:U,request:M};for(let f of H.onResponse)if(f){let u=await f(G4(g9({},O),{response:((J=z==null?void 0:z.hookOptions)==null?void 0:J.cloneResponse)?U.clone():U}));if(u instanceof Response)U=u;else if(typeof u==="object"&&u!==null)U=u.response}if(U.ok){if(M.method==="HEAD")return{data:"",error:null};let u=uM(U),d={data:null,response:U,request:M};if(u==="json"||u==="text"){let Z0=await U.text(),C9=(Y=M.jsonParser)!=null?Y:JY;d.data=await C9(Z0)}else d.data=await U[u]();if(M==null?void 0:M.output){if(M.output&&!M.disableValidation)d.data=await s3(M.output,d.data)}for(let Z0 of H.onSuccess)if(Z0)await Z0(G4(g9({},d),{response:((X=z==null?void 0:z.hookOptions)==null?void 0:X.cloneResponse)?U.clone():U}));if(z==null?void 0:z.throw)return d.data;return{data:d.data,error:null}}let P=(b=z==null?void 0:z.jsonParser)!=null?b:JY,S=await U.text(),v=cM(S),i=v?await P(S):null,g={response:U,responseText:S,request:M,error:G4(g9({},i),{status:U.status,statusText:U.statusText})};for(let f of H.onError)if(f)await f(G4(g9({},g),{response:((Q=z==null?void 0:z.hookOptions)==null?void 0:Q.cloneResponse)?U.clone():U}));if(z==null?void 0:z.retry){let f=fM(z.retry),u=($=z.retryAttempt)!=null?$:0;if(await f.shouldAttemptRetry(u,U)){for(let Z0 of H.onRetry)if(Z0)await Z0(O);let d=f.getDelay(u);return await new Promise((Z0)=>setTimeout(Z0,d)),await tA(_,G4(g9({},z),{retryAttempt:u+1}))}}if(z==null?void 0:z.throw)throw new vM(U.status,U.statusText,v?i:S);return{data:null,error:G4(g9({},i),{status:U.status,statusText:U.statusText})}};var QY=(_,z)=>{let A="credentials"in Request.prototype,G=oJ(_?.baseURL,_?.basePath,void 0,z)??"/api/auth",J=_?.plugins?.flatMap((M)=>M.fetchPlugins).filter((M)=>M!==void 0)||[],Y={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:_?.fetchOptions?.onSuccess,onError:_?.fetchOptions?.onError,onRequest:_?.fetchOptions?.onRequest,onResponse:_?.fetchOptions?.onResponse}},{onSuccess:X,onError:b,onRequest:Q,onResponse:$,...H}=_?.fetchOptions||{},B=bY({baseURL:G,...A?{credentials:"include"}:{},method:"GET",jsonParser(M){if(!M)return null;return tJ(M,{strict:!1})},customFetchImpl:fetch,...H,plugins:[Y,...H.plugins||[],..._?.disableDefaultFetchPlugins?[]:[aJ],...J]}),{$sessionSignal:Z,session:q}=eJ(B,_),F=_?.plugins||[],K={},W={$sessionSignal:Z,session:q},V={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},N=[{signal:"$sessionSignal",matcher(M){return M==="/sign-out"||M==="/update-user"||M==="/sign-up/email"||M==="/sign-in/email"||M==="/delete-user"||M==="/verify-email"||M==="/revoke-sessions"||M==="/revoke-session"||M==="/change-email"}}];for(let M of F){if(M.getAtoms)Object.assign(W,M.getAtoms?.(B));if(M.pathMethods)Object.assign(V,M.pathMethods);if(M.atomListeners)N.push(...M.atomListeners)}let L={notify:(M)=>{W[M].set(!W[M].get())},listen:(M,k)=>{W[M].subscribe(k)},atoms:W};for(let M of F)if(M.getActions)K=_Y(M.getActions?.(B,L,_)??{},K);return{get baseURL(){return G},pluginsActions:K,pluginsAtoms:W,pluginPathMethods:V,atomListeners:N,$fetch:B,$store:L}};function $Y(_){return typeof _==="object"&&_!==null&&"get"in _&&typeof _.get==="function"&&"lc"in _&&typeof _.lc==="number"}function tM(_,z,A){let G=z[_],{fetchOptions:J,query:Y,...X}=A||{};if(G)return G;if(J?.method)return J.method;if(X&&Object.keys(X).length>0)return"POST";return"GET"}function HY(_,z,A,G,J){function Y(X=[]){return new Proxy(function(){},{get(b,Q){if(typeof Q!=="string")return;if(Q==="then"||Q==="catch"||Q==="finally")return;let $=[...X,Q],H=_;for(let B of $)if(H&&typeof H==="object"&&B in H)H=H[B];else{H=void 0;break}if(typeof H==="function")return H;if($Y(H))return H;return Y($)},apply:async(b,Q,$)=>{let H="/"+X.map((N)=>N.replace(/[A-Z]/g,(L)=>`-${L.toLowerCase()}`)).join("/"),B=$[0]||{},Z=$[1]||{},{query:q,fetchOptions:F,...K}=B,W={...Z,...F},V=tM(H,A,B);return await z(H,{...W,body:V==="GET"?void 0:{...K,...W?.body||{}},query:q||W?.query,method:V,async onSuccess(N){if(await W?.onSuccess?.(N),!J||W.disableSignal)return;let L=J.filter((k)=>k.matcher(H));if(!L.length)return;let M=new Set;for(let k of L){let U=G[k.signal];if(!U)return;if(M.has(k.signal))continue;M.add(k.signal);let O=U.get();setTimeout(()=>{U.set(!O)},10)}}})}})}return Y()}function eA(_){let{pluginPathMethods:z,pluginsActions:A,pluginsAtoms:G,$fetch:J,atomListeners:Y,$store:X}=QY(_),b={};for(let[Q,$]of Object.entries(G))b[`use${nA(Q)}`]=$;return HY({...A,...b,$fetch:J,$store:X},J,z,G,Y)}function BY(_){return{authorize(z,A="AND"){let G=!1;for(let[J,Y]of Object.entries(z)){let X=_[J];if(!X)return{success:!1,error:`You are not allowed to access resource: ${J}`};if(Array.isArray(Y))G=Y.every((b)=>X.includes(b));else if(typeof Y==="object"){let b=Y;if(b.connector==="OR")G=b.actions.some((Q)=>X.includes(Q));else G=b.actions.every((Q)=>X.includes(Q))}else throw new n4("Invalid access control request");if(G&&A==="OR")return{success:G};if(!G&&A==="AND")return{success:!1,error:`unauthorized to access resource "${J}"`}}if(G)return{success:G};return{success:!1,error:"Not authorized"}},statements:_}}function Bz(_){return{newRole(z){return BY(z)},statements:_}}var ZY={user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]},_5=Bz(ZY),qY=_5.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),FY=_5.newRole({user:[],session:[]});var z5=()=>{return{id:"device-authorization",$InferServerPlugin:{},pathMethods:{"/device/code":"POST","/device/token":"POST","/device":"GET","/device/approve":"POST","/device/deny":"POST"}}};var KY={organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]},t3=Bz(KY),WY=t3.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"],ac:["create","read","update","delete"]}),VY=t3.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),UY=t3.newRole({organization:[],member:[],invitation:[],team:[],ac:["read"]});function AN(_){let z=_.toLowerCase();return z==="localhost"||z.startsWith("localhost:")||z==="127.0.0.1"||z.startsWith("127.0.0.1:")||z==="[::1]"||z.startsWith("[::1]:")}function e3(_){let z=_.trim();if(!z)throw Error("Hostname is required.");let G=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//.test(z)?z:`${AN(z)?"http":"https"}://${z}`,J;try{J=new URL(G)}catch{throw Error(`Invalid hostname: ${_}`)}if(!J.hostname)throw Error(`Invalid hostname: ${_}`);if(J.pathname!=="/"||J.search||J.hash)throw Error("Hostname must not include a path, query, or fragment.");return{host:J.host.toLowerCase(),baseURL:`${J.protocol}//${J.host.toLowerCase()}`}}function _6(_){return eA({baseURL:_,plugins:[z5()]})}import{existsSync as LX,mkdirSync as Qw,readFileSync as $w,writeFileSync as Hw}from"fs";import{homedir as Bw}from"os";import{join as jX}from"path";import{existsSync as Aw,mkdirSync as Gw}from"fs";import{homedir as Jw}from"os";import{join as OX}from"path";var{createId:Ii,init:_w,getConstants:xi,isCuid:Ti}=EX();var $5=_w;var B5=OX(Jw(),".config","agentlogs"),wX=OX(B5,"local.db"),Yw=typeof globalThis.Bun<"u",A1=null,H5=null;function Xw(){if(!H5)H5=$5();return H5}function bw(){if(!Aw(B5))Gw(B5,{recursive:!0})}async function G6(){if(A1)return A1;if(bw(),Yw){let{Database:_}=await import("bun:sqlite"),z=new _(wX);A1={exec:(A)=>z.run(A),get:(A,...G)=>z.query(A).get(...G),run:(A,...G)=>z.run(A,G),all:(A,...G)=>z.query(A).all(...G)}}else{let{default:_}=await import("libsql"),z=new _(wX);A1={exec:(A)=>z.exec(A),get:(A,...G)=>z.prepare(A).get(...G),run:(A,...G)=>z.prepare(A).run(...G),all:(A,...G)=>z.prepare(A).all(...G)}}return A1.exec(`
43
43
  CREATE TABLE IF NOT EXISTS kv (
44
44
  key TEXT PRIMARY KEY,
45
45
  value TEXT NOT NULL
46
46
  )
47
- `),r_}function D4(){return{async get(_,z){let b=(await s3()).get("SELECT value FROM kv WHERE key = ?",_);if(!b)return z;try{return JSON.parse(b.value)}catch{return z}},async set(_,z){let A=await s3(),b=JSON.stringify(z);A.run("INSERT OR REPLACE INTO kv (key, value) VALUES (?, ?)",_,b)},async delete(_){(await s3()).run("DELETE FROM kv WHERE key = ?",_)},async keys(_){let z=await s3();if(_)return z.all("SELECT key FROM kv WHERE key LIKE ?",`${_}%`).map((G)=>G.key);return z.all("SELECT key FROM kv").map((b)=>b.key)}}}async function A4(_){let z=D4(),A=`transcript.${_}.id`,b=await z.get(A);if(b)return b;let G=xw()();return await z.set(A,G),G}async function G5(_,z){let A=D4(),b=`transcript.${_}.id`;await A.set(b,z)}async function Qz(_,z){let A=D4(),b=`call.${_}.transcriptId`;await A.set(b,z)}async function $z(_){let z=D4(),A=`call.${_}.transcriptId`;return z.get(A)}async function Hz(_){let z=D4(),A=`call.${_}.transcriptId`;await z.delete(A)}var J5=BY(gw(),".config","agentlogs"),Y5=BY(J5,"config.json");function ZY(){if(!HY(J5))Cw(J5,{recursive:!0})}function X5(){if(ZY(),!HY(Y5))return{environments:[]};try{let _=vw(Y5,"utf-8"),z=JSON.parse(_);return{environments:Array.isArray(z.environments)?z.environments:[]}}catch{return{environments:[]}}}function FY(_){ZY();try{yw(Y5,JSON.stringify(_,null,2),"utf-8")}catch(z){throw console.error("Failed to write config file:",z),z}}function n_(){return X5().environments}function t3(_){return n_().find((z)=>z.name===_)}function Q5(_){return`auth.token.${_}`}async function $5(_){let z=process.env.AGENTLOGS_AUTH_TOKEN?.trim();if(z)return z;try{if(!t3(_)?.user?.email)return null;return await D4().get(Q5(_))??null}catch{return null}}async function KY(_,z,A){try{await D4().set(Q5(_),A)}catch(b){throw console.error("Failed to store token:",b),b}}async function qY(_){try{await D4().delete(Q5(_))}catch{}}function WY(_){let z=X5(),A=z.environments.findIndex((b)=>b.name===_.name);if(A>=0)z.environments[A]=_;else z.environments.push(_);FY(z)}function VY(_){let z=X5();z.environments=z.environments.filter((A)=>A.name!==_),FY(z)}function fw(_){try{return new URL(_).host.toLowerCase()}catch{return"custom"}}async function T9(){let _=n_(),z=[];for(let A of _){let b=await $5(A.name);if(b)z.push({...A,token:b})}if(z.length===0){let A=process.env.AGENTLOGS_AUTH_TOKEN?.trim();if(A){let b=process.env.AGENTLOGS_SERVER_URL?.trim()||"https://agentlogs.ai"?.trim()||"https://agentlogs.ai";z.push({name:fw(b),baseURL:b,user:{id:"ci",email:"ci@agentlogs.ai",name:"CI"},lastLoginTime:new Date().toISOString(),token:A})}}return z}async function UY(_){try{let{host:z,baseURL:A}=n3(_.hostname);console.log("\uD83D\uDD10 AgentLogs Device Authorization"),console.log(`\uD83C\uDF10 Server: ${A}`),console.log("⏳ Requesting device authorization...");let b=i3(A),{data:G,error:J}=await b.device.code({client_id:"agentlogs-cli",scope:"openid profile email"});if(J||!G)console.error("❌ Error:",J?.error_description||"Failed to request device code"),process.exit(1);let{device_code:Y,user_code:X,verification_uri:Q,verification_uri_complete:$,interval:H=5}=G;console.log(`
48
- \uD83D\uDCF1 Device Authorization in Progress`),console.log(`Please visit: ${Q}`),console.log(`Enter code: ${X}
49
- `);let B=$||Q;if(B)console.log("\uD83C\uDF10 Opening browser..."),await RG(B);console.log(`⏳ Waiting for authorization... (polling every ${H}s)`),await hw(b,Y,H,z,A)}catch(z){console.error("❌ Error:",z instanceof Error?z.message:"Unknown error"),process.exit(1)}}async function hw(_,z,A,b,G){let J=A;return new Promise((Y)=>{let X=async()=>{try{let{data:Q,error:$}=await _.device.token({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:z,client_id:"agentlogs-cli"});if(Q?.access_token){console.log(`
50
- ✅ Authorization Successful!`),console.log("\uD83D\uDD11 Access token received!");let{data:H}=await _.getSession({fetchOptions:{headers:{Authorization:`Bearer ${Q.access_token}`}}});if(H?.user)await KY(b,H.user.email,Q.access_token),WY({name:b,baseURL:G,user:{id:H.user.id,email:H.user.email,name:H.user.name},lastLoginTime:new Date().toISOString()}),console.log(`\uD83D\uDC4B Hello, ${H.user.name}!`),console.log(`\uD83D\uDCE7 Logged in as: ${H.user.email}`),console.log(`\uD83C\uDF10 Environment: ${b}`);else console.log("⚠️ Warning: Could not retrieve user session");Y(),process.exit(0)}else if($)switch($.error){case"authorization_pending":break;case"slow_down":J+=5,console.log(`⚠️ Slowing down polling to ${J}s`);break;case"access_denied":console.error("❌ Access was denied by the user"),process.exit(1);break;case"expired_token":console.error("❌ The device code has expired. Please try again."),process.exit(1);break;default:console.error("❌ Error:",$.error_description||$.error),process.exit(1)}}catch(Q){console.error("❌ Error:",Q instanceof Error?Q.message:"Unknown error"),process.exit(1)}setTimeout(X,J*1000)};setTimeout(X,J*1000)})}async function DY(_={}){let z;try{z=mw(_.hostname)}catch(b){console.error("❌ Error:",b instanceof Error?b.message:"Invalid hostname"),process.exit(1)}if(z.length===0){if(_.hostname)console.log(`ℹ️ Not currently logged in to ${_.hostname}`);else console.log("ℹ️ Not currently logged in to any environment");return}let A=[];for(let b of z){let G=t3(b);if(!G)continue;try{await qY(b),VY(b),A.push(G)}catch(J){console.error(`⚠️ Warning: Could not completely clear credentials for ${b}:`,J instanceof Error?J.message:"Unknown error")}}if(A.length===0){console.log("ℹ️ No environments were logged out");return}if(A.length===1){console.log(`✅ Logged out from ${A[0].name} successfully`),console.log(`\uD83D\uDCE7 Was logged in as: ${A[0].user.email}`);return}console.log(`✅ Logged out from ${A.length} environments:`);for(let b of A)console.log(`- ${b.name} (${b.user.email})`)}function mw(_){if(_){let{host:z}=n3(_);return t3(z)?[z]:[]}return n_().map((z)=>z.name)}async function MY(_={}){if(_.allowMode){let b=_.allowMode.toLowerCase();if(b!=="allowlist"&&b!=="denylist")console.error("Invalid allowMode. Use 'allowlist' or 'denylist'."),process.exit(1);JG(b),console.log(`Allow mode set to: ${b}`),console.log()}let z=t9();console.log("AgentLogs Settings"),console.log("──────────────────"),console.log(`Mode: ${z.allowMode}`),console.log(`Config: ${YG()}`),console.log();let A=Object.keys(z.repos);if(A.length===0)console.log("Repos: (none configured)");else{console.log("Repos:");for(let b of A){let G=z.repos[b];if(G.allow){let J=G.visibility??"(server default)";console.log(` ✓ ${b} ${J}`)}else console.log(` ✗ ${b} (denied)`)}}process.exit(0)}async function NY(){let _=n_();if(_.length===0)console.log("❌ Not logged in"),console.log("Run `agentlogs login agentlogs.ai` to authenticate"),process.exit(1);console.log(`\uD83D\uDD10 AgentLogs Authentication Status
51
- `);let z=!1;for(let A of _){let b=await $5(A.name);if(!b){console.log(`${A.name} (${A.baseURL})`),console.log(" ❌ Token not found"),console.log(` \uD83D\uDCE7 Was: ${A.user.email}`),console.log("");continue}try{let G=i3(A.baseURL),{data:J,error:Y}=await G.getSession({fetchOptions:{headers:{Authorization:`Bearer ${b}`}}});if(Y||!J?.user){console.log(`${A.name} (${A.baseURL})`),console.log(" ⚠️ Token invalid or expired"),console.log(` \uD83D\uDCE7 Was: ${A.user.email}`),console.log(` Run \`agentlogs login ${A.name}\` to re-authenticate`),console.log("");continue}if(z=!0,console.log(`${A.name} (${A.baseURL})`),console.log(" ✅ Logged in"),console.log(` \uD83D\uDC64 ${J.user.name}`),console.log(` \uD83D\uDCE7 ${J.user.email}`),A.lastLoginTime){let X=new Date(A.lastLoginTime);console.log(` \uD83D\uDD50 Last login: ${X.toLocaleString()}`)}console.log("")}catch(G){console.log(`${A.name} (${A.baseURL})`),console.log(` ❌ Error verifying session: ${G instanceof Error?G.message:"Unknown error"}`),console.log("")}}if(!z)process.exit(1)}import{resolve as sP}from"path";import{spawnSync as tP}from"child_process";import{existsSync as eP,readFileSync as _S}from"fs";var U={};J8(U,{void:()=>OE,util:()=>z0,unknown:()=>wE,union:()=>PE,undefined:()=>DE,tuple:()=>IE,transformer:()=>uE,symbol:()=>UE,string:()=>kY,strictObject:()=>RE,setErrorMap:()=>lw,set:()=>CE,record:()=>xE,quotelessJson:()=>uw,promise:()=>mE,preprocess:()=>pE,pipeline:()=>dE,ostring:()=>rE,optional:()=>cE,onumber:()=>nE,oboolean:()=>iE,objectUtil:()=>H5,object:()=>jE,number:()=>IY,nullable:()=>lE,null:()=>ME,never:()=>EE,nativeEnum:()=>hE,nan:()=>qE,map:()=>TE,makeIssue:()=>Bz,literal:()=>gE,lazy:()=>yE,late:()=>FE,isValid:()=>p4,isDirty:()=>_6,isAsync:()=>o_,isAborted:()=>e3,intersection:()=>kE,instanceof:()=>KE,getParsedType:()=>b4,getErrorMap:()=>i_,function:()=>vE,enum:()=>fE,effect:()=>uE,discriminatedUnion:()=>SE,defaultErrorMap:()=>M4,datetimeRegex:()=>RY,date:()=>VE,custom:()=>SY,coerce:()=>oE,boolean:()=>xY,bigint:()=>WE,array:()=>LE,any:()=>NE,addIssueToContext:()=>T,ZodVoid:()=>Fz,ZodUnknown:()=>d4,ZodUnion:()=>z1,ZodUndefined:()=>e_,ZodType:()=>_0,ZodTuple:()=>J4,ZodTransformer:()=>f9,ZodSymbol:()=>Zz,ZodString:()=>C9,ZodSet:()=>U_,ZodSchema:()=>_0,ZodRecord:()=>Kz,ZodReadonly:()=>Q1,ZodPromise:()=>D_,ZodPipeline:()=>Vz,ZodParsedType:()=>k,ZodOptional:()=>y9,ZodObject:()=>S0,ZodNumber:()=>r4,ZodNullable:()=>w4,ZodNull:()=>_1,ZodNever:()=>G4,ZodNativeEnum:()=>J1,ZodNaN:()=>Wz,ZodMap:()=>qz,ZodLiteral:()=>G1,ZodLazy:()=>b1,ZodIssueCode:()=>j,ZodIntersection:()=>A1,ZodFunction:()=>s_,ZodFirstPartyTypeKind:()=>p,ZodError:()=>J9,ZodEnum:()=>i4,ZodEffects:()=>f9,ZodDiscriminatedUnion:()=>z6,ZodDefault:()=>Y1,ZodDate:()=>W_,ZodCatch:()=>X1,ZodBranded:()=>A6,ZodBoolean:()=>t_,ZodBigInt:()=>n4,ZodArray:()=>v9,ZodAny:()=>V_,Schema:()=>_0,ParseStatus:()=>g0,OK:()=>d0,NEVER:()=>aE,INVALID:()=>l,EMPTY_PATH:()=>pw,DIRTY:()=>q_,BRAND:()=>ZE});var z0;(function(_){_.assertEqual=(G)=>{};function z(G){}_.assertIs=z;function A(G){throw Error()}_.assertNever=A,_.arrayToEnum=(G)=>{let J={};for(let Y of G)J[Y]=Y;return J},_.getValidEnumValues=(G)=>{let J=_.objectKeys(G).filter((X)=>typeof G[G[X]]!=="number"),Y={};for(let X of J)Y[X]=G[X];return _.objectValues(Y)},_.objectValues=(G)=>{return _.objectKeys(G).map(function(J){return G[J]})},_.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let J=[];for(let Y in G)if(Object.prototype.hasOwnProperty.call(G,Y))J.push(Y);return J},_.find=(G,J)=>{for(let Y of G)if(J(Y))return Y;return},_.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&Number.isFinite(G)&&Math.floor(G)===G;function b(G,J=" | "){return G.map((Y)=>typeof Y==="string"?`'${Y}'`:Y).join(J)}_.joinValues=b,_.jsonStringifyReplacer=(G,J)=>{if(typeof J==="bigint")return J.toString();return J}})(z0||(z0={}));var H5;(function(_){_.mergeShapes=(z,A)=>{return{...z,...A}}})(H5||(H5={}));var k=z0.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),b4=(_)=>{switch(typeof _){case"undefined":return k.undefined;case"string":return k.string;case"number":return Number.isNaN(_)?k.nan:k.number;case"boolean":return k.boolean;case"function":return k.function;case"bigint":return k.bigint;case"symbol":return k.symbol;case"object":if(Array.isArray(_))return k.array;if(_===null)return k.null;if(_.then&&typeof _.then==="function"&&_.catch&&typeof _.catch==="function")return k.promise;if(typeof Map<"u"&&_ instanceof Map)return k.map;if(typeof Set<"u"&&_ instanceof Set)return k.set;if(typeof Date<"u"&&_ instanceof Date)return k.date;return k.object;default:return k.unknown}};var j=z0.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"]),uw=(_)=>{return JSON.stringify(_,null,2).replace(/"([^"]+)":/g,"$1:")};class J9 extends Error{get errors(){return this.issues}constructor(_){super();this.issues=[],this.addIssue=(A)=>{this.issues=[...this.issues,A]},this.addIssues=(A=[])=>{this.issues=[...this.issues,...A]};let z=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,z);else this.__proto__=z;this.name="ZodError",this.issues=_}format(_){let z=_||function(G){return G.message},A={_errors:[]},b=(G)=>{for(let J of G.issues)if(J.code==="invalid_union")J.unionErrors.map(b);else if(J.code==="invalid_return_type")b(J.returnTypeError);else if(J.code==="invalid_arguments")b(J.argumentsError);else if(J.path.length===0)A._errors.push(z(J));else{let Y=A,X=0;while(X<J.path.length){let Q=J.path[X];if(X!==J.path.length-1)Y[Q]=Y[Q]||{_errors:[]};else Y[Q]=Y[Q]||{_errors:[]},Y[Q]._errors.push(z(J));Y=Y[Q],X++}}};return b(this),A}static assert(_){if(!(_ instanceof J9))throw Error(`Not a ZodError: ${_}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,z0.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(_=(z)=>z.message){let z={},A=[];for(let b of this.issues)if(b.path.length>0){let G=b.path[0];z[G]=z[G]||[],z[G].push(_(b))}else A.push(_(b));return{formErrors:A,fieldErrors:z}}get formErrors(){return this.flatten()}}J9.create=(_)=>{return new J9(_)};var cw=(_,z)=>{let A;switch(_.code){case j.invalid_type:if(_.received===k.undefined)A="Required";else A=`Expected ${_.expected}, received ${_.received}`;break;case j.invalid_literal:A=`Invalid literal value, expected ${JSON.stringify(_.expected,z0.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:A=`Unrecognized key(s) in object: ${z0.joinValues(_.keys,", ")}`;break;case j.invalid_union:A="Invalid input";break;case j.invalid_union_discriminator:A=`Invalid discriminator value. Expected ${z0.joinValues(_.options)}`;break;case j.invalid_enum_value:A=`Invalid enum value. Expected ${z0.joinValues(_.options)}, received '${_.received}'`;break;case j.invalid_arguments:A="Invalid function arguments";break;case j.invalid_return_type:A="Invalid function return type";break;case j.invalid_date:A="Invalid date";break;case j.invalid_string:if(typeof _.validation==="object")if("includes"in _.validation){if(A=`Invalid input: must include "${_.validation.includes}"`,typeof _.validation.position==="number")A=`${A} at one or more positions greater than or equal to ${_.validation.position}`}else if("startsWith"in _.validation)A=`Invalid input: must start with "${_.validation.startsWith}"`;else if("endsWith"in _.validation)A=`Invalid input: must end with "${_.validation.endsWith}"`;else z0.assertNever(_.validation);else if(_.validation!=="regex")A=`Invalid ${_.validation}`;else A="Invalid";break;case j.too_small:if(_.type==="array")A=`Array must contain ${_.exact?"exactly":_.inclusive?"at least":"more than"} ${_.minimum} element(s)`;else if(_.type==="string")A=`String must contain ${_.exact?"exactly":_.inclusive?"at least":"over"} ${_.minimum} character(s)`;else if(_.type==="number")A=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`;else if(_.type==="bigint")A=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`;else if(_.type==="date")A=`Date must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(_.minimum))}`;else A="Invalid input";break;case j.too_big:if(_.type==="array")A=`Array must contain ${_.exact?"exactly":_.inclusive?"at most":"less than"} ${_.maximum} element(s)`;else if(_.type==="string")A=`String must contain ${_.exact?"exactly":_.inclusive?"at most":"under"} ${_.maximum} character(s)`;else if(_.type==="number")A=`Number must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`;else if(_.type==="bigint")A=`BigInt must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`;else if(_.type==="date")A=`Date must be ${_.exact?"exactly":_.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(_.maximum))}`;else A="Invalid input";break;case j.custom:A="Invalid input";break;case j.invalid_intersection_types:A="Intersection results could not be merged";break;case j.not_multiple_of:A=`Number must be a multiple of ${_.multipleOf}`;break;case j.not_finite:A="Number must be finite";break;default:A=z.defaultError,z0.assertNever(_)}return{message:A}},M4=cw;var wY=M4;function lw(_){wY=_}function i_(){return wY}var Bz=(_)=>{let{data:z,path:A,errorMaps:b,issueData:G}=_,J=[...A,...G.path||[]],Y={...G,path:J};if(G.message!==void 0)return{...G,path:J,message:G.message};let X="",Q=b.filter(($)=>!!$).slice().reverse();for(let $ of Q)X=$(Y,{data:z,defaultError:X}).message;return{...G,path:J,message:X}},pw=[];function T(_,z){let A=i_(),b=Bz({issueData:z,data:_.data,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,A,A===M4?void 0:M4].filter((G)=>!!G)});_.common.issues.push(b)}class g0{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(_,z){let A=[];for(let b of z){if(b.status==="aborted")return l;if(b.status==="dirty")_.dirty();A.push(b.value)}return{status:_.value,value:A}}static async mergeObjectAsync(_,z){let A=[];for(let b of z){let G=await b.key,J=await b.value;A.push({key:G,value:J})}return g0.mergeObjectSync(_,A)}static mergeObjectSync(_,z){let A={};for(let b of z){let{key:G,value:J}=b;if(G.status==="aborted")return l;if(J.status==="aborted")return l;if(G.status==="dirty")_.dirty();if(J.status==="dirty")_.dirty();if(G.value!=="__proto__"&&(typeof J.value<"u"||b.alwaysSet))A[G.value]=J.value}return{status:_.value,value:A}}}var l=Object.freeze({status:"aborted"}),q_=(_)=>({status:"dirty",value:_}),d0=(_)=>({status:"valid",value:_}),e3=(_)=>_.status==="aborted",_6=(_)=>_.status==="dirty",p4=(_)=>_.status==="valid",o_=(_)=>typeof Promise<"u"&&_ instanceof Promise;var v;(function(_){_.errToObj=(z)=>typeof z==="string"?{message:z}:z||{},_.toString=(z)=>typeof z==="string"?z:z?.message})(v||(v={}));class g9{constructor(_,z,A,b){this._cachedPath=[],this.parent=_,this.data=z,this._path=A,this._key=b}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 EY=(_,z)=>{if(p4(z))return{success:!0,data:z.value};else{if(!_.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let A=new J9(_.common.issues);return this._error=A,this._error}}}};function o(_){if(!_)return{};let{errorMap:z,invalid_type_error:A,required_error:b,description:G}=_;if(z&&(A||b))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(z)return{errorMap:z,description:G};return{errorMap:(Y,X)=>{let{message:Q}=_;if(Y.code==="invalid_enum_value")return{message:Q??X.defaultError};if(typeof X.data>"u")return{message:Q??b??X.defaultError};if(Y.code!=="invalid_type")return{message:X.defaultError};return{message:Q??A??X.defaultError}},description:G}}class _0{get description(){return this._def.description}_getType(_){return b4(_.data)}_getOrReturnCtx(_,z){return z||{common:_.parent.common,data:_.data,parsedType:b4(_.data),schemaErrorMap:this._def.errorMap,path:_.path,parent:_.parent}}_processInputParams(_){return{status:new g0,ctx:{common:_.parent.common,data:_.data,parsedType:b4(_.data),schemaErrorMap:this._def.errorMap,path:_.path,parent:_.parent}}}_parseSync(_){let z=this._parse(_);if(o_(z))throw Error("Synchronous parse encountered promise.");return z}_parseAsync(_){let z=this._parse(_);return Promise.resolve(z)}parse(_,z){let A=this.safeParse(_,z);if(A.success)return A.data;throw A.error}safeParse(_,z){let A={common:{issues:[],async:z?.async??!1,contextualErrorMap:z?.errorMap},path:z?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:b4(_)},b=this._parseSync({data:_,path:A.path,parent:A});return EY(A,b)}"~validate"(_){let z={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:b4(_)};if(!this["~standard"].async)try{let A=this._parseSync({data:_,path:[],parent:z});return p4(A)?{value:A.value}:{issues:z.common.issues}}catch(A){if(A?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;z.common={issues:[],async:!0}}return this._parseAsync({data:_,path:[],parent:z}).then((A)=>p4(A)?{value:A.value}:{issues:z.common.issues})}async parseAsync(_,z){let A=await this.safeParseAsync(_,z);if(A.success)return A.data;throw A.error}async safeParseAsync(_,z){let A={common:{issues:[],contextualErrorMap:z?.errorMap,async:!0},path:z?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:b4(_)},b=this._parse({data:_,path:A.path,parent:A}),G=await(o_(b)?b:Promise.resolve(b));return EY(A,G)}refine(_,z){let A=(b)=>{if(typeof z==="string"||typeof z>"u")return{message:z};else if(typeof z==="function")return z(b);else return z};return this._refinement((b,G)=>{let J=_(b),Y=()=>G.addIssue({code:j.custom,...A(b)});if(typeof Promise<"u"&&J instanceof Promise)return J.then((X)=>{if(!X)return Y(),!1;else return!0});if(!J)return Y(),!1;else return!0})}refinement(_,z){return this._refinement((A,b)=>{if(!_(A))return b.addIssue(typeof z==="function"?z(A,b):z),!1;else return!0})}_refinement(_){return new f9({schema:this,typeName:p.ZodEffects,effect:{type:"refinement",refinement:_}})}superRefine(_){return this._refinement(_)}constructor(_){this.spa=this.safeParseAsync,this._def=_,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:(z)=>this["~validate"](z)}}optional(){return y9.create(this,this._def)}nullable(){return w4.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return v9.create(this)}promise(){return D_.create(this,this._def)}or(_){return z1.create([this,_],this._def)}and(_){return A1.create(this,_,this._def)}transform(_){return new f9({...o(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:_}})}default(_){let z=typeof _==="function"?_:()=>_;return new Y1({...o(this._def),innerType:this,defaultValue:z,typeName:p.ZodDefault})}brand(){return new A6({typeName:p.ZodBranded,type:this,...o(this._def)})}catch(_){let z=typeof _==="function"?_:()=>_;return new X1({...o(this._def),innerType:this,catchValue:z,typeName:p.ZodCatch})}describe(_){return new this.constructor({...this._def,description:_})}pipe(_){return Vz.create(this,_)}readonly(){return Q1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var dw=/^c[^\s-]{8,}$/i,rw=/^[0-9a-z]+$/,nw=/^[0-9A-HJKMNP-TV-Z]{26}$/i,iw=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ow=/^[a-z0-9_-]{21}$/i,aw=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sw=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,tw=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ew="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",B5,_E=/^(?:(?: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])$/,zE=/^(?:(?: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])$/,AE=/^(([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]))$/,bE=/^(([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])$/,GE=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,JE=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,LY="((\\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])))",YE=new RegExp(`^${LY}$`);function jY(_){let z="[0-5]\\d";if(_.precision)z=`${z}\\.\\d{${_.precision}}`;else if(_.precision==null)z=`${z}(\\.\\d+)?`;let A=_.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${z})${A}`}function XE(_){return new RegExp(`^${jY(_)}$`)}function RY(_){let z=`${LY}T${jY(_)}`,A=[];if(A.push(_.local?"Z?":"Z"),_.offset)A.push("([+-]\\d{2}:?\\d{2})");return z=`${z}(${A.join("|")})`,new RegExp(`^${z}$`)}function QE(_,z){if((z==="v4"||!z)&&_E.test(_))return!0;if((z==="v6"||!z)&&AE.test(_))return!0;return!1}function $E(_,z){if(!aw.test(_))return!1;try{let[A]=_.split(".");if(!A)return!1;let b=A.replace(/-/g,"+").replace(/_/g,"/").padEnd(A.length+(4-A.length%4)%4,"="),G=JSON.parse(atob(b));if(typeof G!=="object"||G===null)return!1;if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(z&&G.alg!==z)return!1;return!0}catch{return!1}}function HE(_,z){if((z==="v4"||!z)&&zE.test(_))return!0;if((z==="v6"||!z)&&bE.test(_))return!0;return!1}class C9 extends _0{_parse(_){if(this._def.coerce)_.data=String(_.data);if(this._getType(_)!==k.string){let G=this._getOrReturnCtx(_);return T(G,{code:j.invalid_type,expected:k.string,received:G.parsedType}),l}let A=new g0,b=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(_.data.length<G.value)b=this._getOrReturnCtx(_,b),T(b,{code:j.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),A.dirty()}else if(G.kind==="max"){if(_.data.length>G.value)b=this._getOrReturnCtx(_,b),T(b,{code:j.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),A.dirty()}else if(G.kind==="length"){let J=_.data.length>G.value,Y=_.data.length<G.value;if(J||Y){if(b=this._getOrReturnCtx(_,b),J)T(b,{code:j.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(Y)T(b,{code:j.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});A.dirty()}}else if(G.kind==="email"){if(!tw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"email",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="emoji"){if(!B5)B5=new RegExp(ew,"u");if(!B5.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"emoji",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="uuid"){if(!iw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"uuid",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="nanoid"){if(!ow.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"nanoid",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="cuid"){if(!dw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"cuid",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="cuid2"){if(!rw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"cuid2",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="ulid"){if(!nw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"ulid",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="url")try{new URL(_.data)}catch{b=this._getOrReturnCtx(_,b),T(b,{validation:"url",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="regex"){if(G.regex.lastIndex=0,!G.regex.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"regex",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="trim")_.data=_.data.trim();else if(G.kind==="includes"){if(!_.data.includes(G.value,G.position))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:{includes:G.value,position:G.position},message:G.message}),A.dirty()}else if(G.kind==="toLowerCase")_.data=_.data.toLowerCase();else if(G.kind==="toUpperCase")_.data=_.data.toUpperCase();else if(G.kind==="startsWith"){if(!_.data.startsWith(G.value))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:{startsWith:G.value},message:G.message}),A.dirty()}else if(G.kind==="endsWith"){if(!_.data.endsWith(G.value))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:{endsWith:G.value},message:G.message}),A.dirty()}else if(G.kind==="datetime"){if(!RY(G).test(_.data))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:"datetime",message:G.message}),A.dirty()}else if(G.kind==="date"){if(!YE.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:"date",message:G.message}),A.dirty()}else if(G.kind==="time"){if(!XE(G).test(_.data))b=this._getOrReturnCtx(_,b),T(b,{code:j.invalid_string,validation:"time",message:G.message}),A.dirty()}else if(G.kind==="duration"){if(!sw.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"duration",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="ip"){if(!QE(_.data,G.version))b=this._getOrReturnCtx(_,b),T(b,{validation:"ip",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="jwt"){if(!$E(_.data,G.alg))b=this._getOrReturnCtx(_,b),T(b,{validation:"jwt",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="cidr"){if(!HE(_.data,G.version))b=this._getOrReturnCtx(_,b),T(b,{validation:"cidr",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="base64"){if(!GE.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"base64",code:j.invalid_string,message:G.message}),A.dirty()}else if(G.kind==="base64url"){if(!JE.test(_.data))b=this._getOrReturnCtx(_,b),T(b,{validation:"base64url",code:j.invalid_string,message:G.message}),A.dirty()}else z0.assertNever(G);return{status:A.value,value:_.data}}_regex(_,z,A){return this.refinement((b)=>_.test(b),{validation:z,code:j.invalid_string,...v.errToObj(A)})}_addCheck(_){return new C9({...this._def,checks:[...this._def.checks,_]})}email(_){return this._addCheck({kind:"email",...v.errToObj(_)})}url(_){return this._addCheck({kind:"url",...v.errToObj(_)})}emoji(_){return this._addCheck({kind:"emoji",...v.errToObj(_)})}uuid(_){return this._addCheck({kind:"uuid",...v.errToObj(_)})}nanoid(_){return this._addCheck({kind:"nanoid",...v.errToObj(_)})}cuid(_){return this._addCheck({kind:"cuid",...v.errToObj(_)})}cuid2(_){return this._addCheck({kind:"cuid2",...v.errToObj(_)})}ulid(_){return this._addCheck({kind:"ulid",...v.errToObj(_)})}base64(_){return this._addCheck({kind:"base64",...v.errToObj(_)})}base64url(_){return this._addCheck({kind:"base64url",...v.errToObj(_)})}jwt(_){return this._addCheck({kind:"jwt",...v.errToObj(_)})}ip(_){return this._addCheck({kind:"ip",...v.errToObj(_)})}cidr(_){return this._addCheck({kind:"cidr",...v.errToObj(_)})}datetime(_){if(typeof _==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:_});return this._addCheck({kind:"datetime",precision:typeof _?.precision>"u"?null:_?.precision,offset:_?.offset??!1,local:_?.local??!1,...v.errToObj(_?.message)})}date(_){return this._addCheck({kind:"date",message:_})}time(_){if(typeof _==="string")return this._addCheck({kind:"time",precision:null,message:_});return this._addCheck({kind:"time",precision:typeof _?.precision>"u"?null:_?.precision,...v.errToObj(_?.message)})}duration(_){return this._addCheck({kind:"duration",...v.errToObj(_)})}regex(_,z){return this._addCheck({kind:"regex",regex:_,...v.errToObj(z)})}includes(_,z){return this._addCheck({kind:"includes",value:_,position:z?.position,...v.errToObj(z?.message)})}startsWith(_,z){return this._addCheck({kind:"startsWith",value:_,...v.errToObj(z)})}endsWith(_,z){return this._addCheck({kind:"endsWith",value:_,...v.errToObj(z)})}min(_,z){return this._addCheck({kind:"min",value:_,...v.errToObj(z)})}max(_,z){return this._addCheck({kind:"max",value:_,...v.errToObj(z)})}length(_,z){return this._addCheck({kind:"length",value:_,...v.errToObj(z)})}nonempty(_){return this.min(1,v.errToObj(_))}trim(){return new C9({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new C9({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new C9({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((_)=>_.kind==="datetime")}get isDate(){return!!this._def.checks.find((_)=>_.kind==="date")}get isTime(){return!!this._def.checks.find((_)=>_.kind==="time")}get isDuration(){return!!this._def.checks.find((_)=>_.kind==="duration")}get isEmail(){return!!this._def.checks.find((_)=>_.kind==="email")}get isURL(){return!!this._def.checks.find((_)=>_.kind==="url")}get isEmoji(){return!!this._def.checks.find((_)=>_.kind==="emoji")}get isUUID(){return!!this._def.checks.find((_)=>_.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((_)=>_.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((_)=>_.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((_)=>_.kind==="cuid2")}get isULID(){return!!this._def.checks.find((_)=>_.kind==="ulid")}get isIP(){return!!this._def.checks.find((_)=>_.kind==="ip")}get isCIDR(){return!!this._def.checks.find((_)=>_.kind==="cidr")}get isBase64(){return!!this._def.checks.find((_)=>_.kind==="base64")}get isBase64url(){return!!this._def.checks.find((_)=>_.kind==="base64url")}get minLength(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _}get maxLength(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _}}C9.create=(_)=>{return new C9({checks:[],typeName:p.ZodString,coerce:_?.coerce??!1,...o(_)})};function BE(_,z){let A=(_.toString().split(".")[1]||"").length,b=(z.toString().split(".")[1]||"").length,G=A>b?A:b,J=Number.parseInt(_.toFixed(G).replace(".","")),Y=Number.parseInt(z.toFixed(G).replace(".",""));return J%Y/10**G}class r4 extends _0{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(_){if(this._def.coerce)_.data=Number(_.data);if(this._getType(_)!==k.number){let G=this._getOrReturnCtx(_);return T(G,{code:j.invalid_type,expected:k.number,received:G.parsedType}),l}let A=void 0,b=new g0;for(let G of this._def.checks)if(G.kind==="int"){if(!z0.isInteger(_.data))A=this._getOrReturnCtx(_,A),T(A,{code:j.invalid_type,expected:"integer",received:"float",message:G.message}),b.dirty()}else if(G.kind==="min"){if(G.inclusive?_.data<G.value:_.data<=G.value)A=this._getOrReturnCtx(_,A),T(A,{code:j.too_small,minimum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),b.dirty()}else if(G.kind==="max"){if(G.inclusive?_.data>G.value:_.data>=G.value)A=this._getOrReturnCtx(_,A),T(A,{code:j.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),b.dirty()}else if(G.kind==="multipleOf"){if(BE(_.data,G.value)!==0)A=this._getOrReturnCtx(_,A),T(A,{code:j.not_multiple_of,multipleOf:G.value,message:G.message}),b.dirty()}else if(G.kind==="finite"){if(!Number.isFinite(_.data))A=this._getOrReturnCtx(_,A),T(A,{code:j.not_finite,message:G.message}),b.dirty()}else z0.assertNever(G);return{status:b.value,value:_.data}}gte(_,z){return this.setLimit("min",_,!0,v.toString(z))}gt(_,z){return this.setLimit("min",_,!1,v.toString(z))}lte(_,z){return this.setLimit("max",_,!0,v.toString(z))}lt(_,z){return this.setLimit("max",_,!1,v.toString(z))}setLimit(_,z,A,b){return new r4({...this._def,checks:[...this._def.checks,{kind:_,value:z,inclusive:A,message:v.toString(b)}]})}_addCheck(_){return new r4({...this._def,checks:[...this._def.checks,_]})}int(_){return this._addCheck({kind:"int",message:v.toString(_)})}positive(_){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(_)})}negative(_){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(_)})}nonpositive(_){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(_)})}nonnegative(_){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(_)})}multipleOf(_,z){return this._addCheck({kind:"multipleOf",value:_,message:v.toString(z)})}finite(_){return this._addCheck({kind:"finite",message:v.toString(_)})}safe(_){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(_)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.toString(_)})}get minValue(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _}get maxValue(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _}get isInt(){return!!this._def.checks.find((_)=>_.kind==="int"||_.kind==="multipleOf"&&z0.isInteger(_.value))}get isFinite(){let _=null,z=null;for(let A of this._def.checks)if(A.kind==="finite"||A.kind==="int"||A.kind==="multipleOf")return!0;else if(A.kind==="min"){if(z===null||A.value>z)z=A.value}else if(A.kind==="max"){if(_===null||A.value<_)_=A.value}return Number.isFinite(z)&&Number.isFinite(_)}}r4.create=(_)=>{return new r4({checks:[],typeName:p.ZodNumber,coerce:_?.coerce||!1,...o(_)})};class n4 extends _0{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(_){if(this._def.coerce)try{_.data=BigInt(_.data)}catch{return this._getInvalidInput(_)}if(this._getType(_)!==k.bigint)return this._getInvalidInput(_);let A=void 0,b=new g0;for(let G of this._def.checks)if(G.kind==="min"){if(G.inclusive?_.data<G.value:_.data<=G.value)A=this._getOrReturnCtx(_,A),T(A,{code:j.too_small,type:"bigint",minimum:G.value,inclusive:G.inclusive,message:G.message}),b.dirty()}else if(G.kind==="max"){if(G.inclusive?_.data>G.value:_.data>=G.value)A=this._getOrReturnCtx(_,A),T(A,{code:j.too_big,type:"bigint",maximum:G.value,inclusive:G.inclusive,message:G.message}),b.dirty()}else if(G.kind==="multipleOf"){if(_.data%G.value!==BigInt(0))A=this._getOrReturnCtx(_,A),T(A,{code:j.not_multiple_of,multipleOf:G.value,message:G.message}),b.dirty()}else z0.assertNever(G);return{status:b.value,value:_.data}}_getInvalidInput(_){let z=this._getOrReturnCtx(_);return T(z,{code:j.invalid_type,expected:k.bigint,received:z.parsedType}),l}gte(_,z){return this.setLimit("min",_,!0,v.toString(z))}gt(_,z){return this.setLimit("min",_,!1,v.toString(z))}lte(_,z){return this.setLimit("max",_,!0,v.toString(z))}lt(_,z){return this.setLimit("max",_,!1,v.toString(z))}setLimit(_,z,A,b){return new n4({...this._def,checks:[...this._def.checks,{kind:_,value:z,inclusive:A,message:v.toString(b)}]})}_addCheck(_){return new n4({...this._def,checks:[...this._def.checks,_]})}positive(_){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(_)})}negative(_){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(_)})}nonpositive(_){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(_)})}nonnegative(_){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(_)})}multipleOf(_,z){return this._addCheck({kind:"multipleOf",value:_,message:v.toString(z)})}get minValue(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _}get maxValue(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _}}n4.create=(_)=>{return new n4({checks:[],typeName:p.ZodBigInt,coerce:_?.coerce??!1,...o(_)})};class t_ extends _0{_parse(_){if(this._def.coerce)_.data=Boolean(_.data);if(this._getType(_)!==k.boolean){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.boolean,received:A.parsedType}),l}return d0(_.data)}}t_.create=(_)=>{return new t_({typeName:p.ZodBoolean,coerce:_?.coerce||!1,...o(_)})};class W_ extends _0{_parse(_){if(this._def.coerce)_.data=new Date(_.data);if(this._getType(_)!==k.date){let G=this._getOrReturnCtx(_);return T(G,{code:j.invalid_type,expected:k.date,received:G.parsedType}),l}if(Number.isNaN(_.data.getTime())){let G=this._getOrReturnCtx(_);return T(G,{code:j.invalid_date}),l}let A=new g0,b=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(_.data.getTime()<G.value)b=this._getOrReturnCtx(_,b),T(b,{code:j.too_small,message:G.message,inclusive:!0,exact:!1,minimum:G.value,type:"date"}),A.dirty()}else if(G.kind==="max"){if(_.data.getTime()>G.value)b=this._getOrReturnCtx(_,b),T(b,{code:j.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),A.dirty()}else z0.assertNever(G);return{status:A.value,value:new Date(_.data.getTime())}}_addCheck(_){return new W_({...this._def,checks:[...this._def.checks,_]})}min(_,z){return this._addCheck({kind:"min",value:_.getTime(),message:v.toString(z)})}max(_,z){return this._addCheck({kind:"max",value:_.getTime(),message:v.toString(z)})}get minDate(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _!=null?new Date(_):null}get maxDate(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _!=null?new Date(_):null}}W_.create=(_)=>{return new W_({checks:[],coerce:_?.coerce||!1,typeName:p.ZodDate,...o(_)})};class Zz extends _0{_parse(_){if(this._getType(_)!==k.symbol){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.symbol,received:A.parsedType}),l}return d0(_.data)}}Zz.create=(_)=>{return new Zz({typeName:p.ZodSymbol,...o(_)})};class e_ extends _0{_parse(_){if(this._getType(_)!==k.undefined){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.undefined,received:A.parsedType}),l}return d0(_.data)}}e_.create=(_)=>{return new e_({typeName:p.ZodUndefined,...o(_)})};class _1 extends _0{_parse(_){if(this._getType(_)!==k.null){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.null,received:A.parsedType}),l}return d0(_.data)}}_1.create=(_)=>{return new _1({typeName:p.ZodNull,...o(_)})};class V_ extends _0{constructor(){super(...arguments);this._any=!0}_parse(_){return d0(_.data)}}V_.create=(_)=>{return new V_({typeName:p.ZodAny,...o(_)})};class d4 extends _0{constructor(){super(...arguments);this._unknown=!0}_parse(_){return d0(_.data)}}d4.create=(_)=>{return new d4({typeName:p.ZodUnknown,...o(_)})};class G4 extends _0{_parse(_){let z=this._getOrReturnCtx(_);return T(z,{code:j.invalid_type,expected:k.never,received:z.parsedType}),l}}G4.create=(_)=>{return new G4({typeName:p.ZodNever,...o(_)})};class Fz extends _0{_parse(_){if(this._getType(_)!==k.undefined){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.void,received:A.parsedType}),l}return d0(_.data)}}Fz.create=(_)=>{return new Fz({typeName:p.ZodVoid,...o(_)})};class v9 extends _0{_parse(_){let{ctx:z,status:A}=this._processInputParams(_),b=this._def;if(z.parsedType!==k.array)return T(z,{code:j.invalid_type,expected:k.array,received:z.parsedType}),l;if(b.exactLength!==null){let J=z.data.length>b.exactLength.value,Y=z.data.length<b.exactLength.value;if(J||Y)T(z,{code:J?j.too_big:j.too_small,minimum:Y?b.exactLength.value:void 0,maximum:J?b.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:b.exactLength.message}),A.dirty()}if(b.minLength!==null){if(z.data.length<b.minLength.value)T(z,{code:j.too_small,minimum:b.minLength.value,type:"array",inclusive:!0,exact:!1,message:b.minLength.message}),A.dirty()}if(b.maxLength!==null){if(z.data.length>b.maxLength.value)T(z,{code:j.too_big,maximum:b.maxLength.value,type:"array",inclusive:!0,exact:!1,message:b.maxLength.message}),A.dirty()}if(z.common.async)return Promise.all([...z.data].map((J,Y)=>{return b.type._parseAsync(new g9(z,J,z.path,Y))})).then((J)=>{return g0.mergeArray(A,J)});let G=[...z.data].map((J,Y)=>{return b.type._parseSync(new g9(z,J,z.path,Y))});return g0.mergeArray(A,G)}get element(){return this._def.type}min(_,z){return new v9({...this._def,minLength:{value:_,message:v.toString(z)}})}max(_,z){return new v9({...this._def,maxLength:{value:_,message:v.toString(z)}})}length(_,z){return new v9({...this._def,exactLength:{value:_,message:v.toString(z)}})}nonempty(_){return this.min(1,_)}}v9.create=(_,z)=>{return new v9({type:_,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,...o(z)})};function a_(_){if(_ instanceof S0){let z={};for(let A in _.shape){let b=_.shape[A];z[A]=y9.create(a_(b))}return new S0({..._._def,shape:()=>z})}else if(_ instanceof v9)return new v9({..._._def,type:a_(_.element)});else if(_ instanceof y9)return y9.create(a_(_.unwrap()));else if(_ instanceof w4)return w4.create(a_(_.unwrap()));else if(_ instanceof J4)return J4.create(_.items.map((z)=>a_(z)));else return _}class S0 extends _0{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let _=this._def.shape(),z=z0.objectKeys(_);return this._cached={shape:_,keys:z},this._cached}_parse(_){if(this._getType(_)!==k.object){let Q=this._getOrReturnCtx(_);return T(Q,{code:j.invalid_type,expected:k.object,received:Q.parsedType}),l}let{status:A,ctx:b}=this._processInputParams(_),{shape:G,keys:J}=this._getCached(),Y=[];if(!(this._def.catchall instanceof G4&&this._def.unknownKeys==="strip")){for(let Q in b.data)if(!J.includes(Q))Y.push(Q)}let X=[];for(let Q of J){let $=G[Q],H=b.data[Q];X.push({key:{status:"valid",value:Q},value:$._parse(new g9(b,H,b.path,Q)),alwaysSet:Q in b.data})}if(this._def.catchall instanceof G4){let Q=this._def.unknownKeys;if(Q==="passthrough")for(let $ of Y)X.push({key:{status:"valid",value:$},value:{status:"valid",value:b.data[$]}});else if(Q==="strict"){if(Y.length>0)T(b,{code:j.unrecognized_keys,keys:Y}),A.dirty()}else if(Q==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let Q=this._def.catchall;for(let $ of Y){let H=b.data[$];X.push({key:{status:"valid",value:$},value:Q._parse(new g9(b,H,b.path,$)),alwaysSet:$ in b.data})}}if(b.common.async)return Promise.resolve().then(async()=>{let Q=[];for(let $ of X){let H=await $.key,B=await $.value;Q.push({key:H,value:B,alwaysSet:$.alwaysSet})}return Q}).then((Q)=>{return g0.mergeObjectSync(A,Q)});else return g0.mergeObjectSync(A,X)}get shape(){return this._def.shape()}strict(_){return v.errToObj,new S0({...this._def,unknownKeys:"strict",..._!==void 0?{errorMap:(z,A)=>{let b=this._def.errorMap?.(z,A).message??A.defaultError;if(z.code==="unrecognized_keys")return{message:v.errToObj(_).message??b};return{message:b}}}:{}})}strip(){return new S0({...this._def,unknownKeys:"strip"})}passthrough(){return new S0({...this._def,unknownKeys:"passthrough"})}extend(_){return new S0({...this._def,shape:()=>({...this._def.shape(),..._})})}merge(_){return new S0({unknownKeys:_._def.unknownKeys,catchall:_._def.catchall,shape:()=>({...this._def.shape(),..._._def.shape()}),typeName:p.ZodObject})}setKey(_,z){return this.augment({[_]:z})}catchall(_){return new S0({...this._def,catchall:_})}pick(_){let z={};for(let A of z0.objectKeys(_))if(_[A]&&this.shape[A])z[A]=this.shape[A];return new S0({...this._def,shape:()=>z})}omit(_){let z={};for(let A of z0.objectKeys(this.shape))if(!_[A])z[A]=this.shape[A];return new S0({...this._def,shape:()=>z})}deepPartial(){return a_(this)}partial(_){let z={};for(let A of z0.objectKeys(this.shape)){let b=this.shape[A];if(_&&!_[A])z[A]=b;else z[A]=b.optional()}return new S0({...this._def,shape:()=>z})}required(_){let z={};for(let A of z0.objectKeys(this.shape))if(_&&!_[A])z[A]=this.shape[A];else{let G=this.shape[A];while(G instanceof y9)G=G._def.innerType;z[A]=G}return new S0({...this._def,shape:()=>z})}keyof(){return PY(z0.objectKeys(this.shape))}}S0.create=(_,z)=>{return new S0({shape:()=>_,unknownKeys:"strip",catchall:G4.create(),typeName:p.ZodObject,...o(z)})};S0.strictCreate=(_,z)=>{return new S0({shape:()=>_,unknownKeys:"strict",catchall:G4.create(),typeName:p.ZodObject,...o(z)})};S0.lazycreate=(_,z)=>{return new S0({shape:_,unknownKeys:"strip",catchall:G4.create(),typeName:p.ZodObject,...o(z)})};class z1 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A=this._def.options;function b(G){for(let Y of G)if(Y.result.status==="valid")return Y.result;for(let Y of G)if(Y.result.status==="dirty")return z.common.issues.push(...Y.ctx.common.issues),Y.result;let J=G.map((Y)=>new J9(Y.ctx.common.issues));return T(z,{code:j.invalid_union,unionErrors:J}),l}if(z.common.async)return Promise.all(A.map(async(G)=>{let J={...z,common:{...z.common,issues:[]},parent:null};return{result:await G._parseAsync({data:z.data,path:z.path,parent:J}),ctx:J}})).then(b);else{let G=void 0,J=[];for(let X of A){let Q={...z,common:{...z.common,issues:[]},parent:null},$=X._parseSync({data:z.data,path:z.path,parent:Q});if($.status==="valid")return $;else if($.status==="dirty"&&!G)G={result:$,ctx:Q};if(Q.common.issues.length)J.push(Q.common.issues)}if(G)return z.common.issues.push(...G.ctx.common.issues),G.result;let Y=J.map((X)=>new J9(X));return T(z,{code:j.invalid_union,unionErrors:Y}),l}}get options(){return this._def.options}}z1.create=(_,z)=>{return new z1({options:_,typeName:p.ZodUnion,...o(z)})};var N4=(_)=>{if(_ instanceof b1)return N4(_.schema);else if(_ instanceof f9)return N4(_.innerType());else if(_ instanceof G1)return[_.value];else if(_ instanceof i4)return _.options;else if(_ instanceof J1)return z0.objectValues(_.enum);else if(_ instanceof Y1)return N4(_._def.innerType);else if(_ instanceof e_)return[void 0];else if(_ instanceof _1)return[null];else if(_ instanceof y9)return[void 0,...N4(_.unwrap())];else if(_ instanceof w4)return[null,...N4(_.unwrap())];else if(_ instanceof A6)return N4(_.unwrap());else if(_ instanceof Q1)return N4(_.unwrap());else if(_ instanceof X1)return N4(_._def.innerType);else return[]};class z6 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_);if(z.parsedType!==k.object)return T(z,{code:j.invalid_type,expected:k.object,received:z.parsedType}),l;let A=this.discriminator,b=z.data[A],G=this.optionsMap.get(b);if(!G)return T(z,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[A]}),l;if(z.common.async)return G._parseAsync({data:z.data,path:z.path,parent:z});else return G._parseSync({data:z.data,path:z.path,parent:z})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(_,z,A){let b=new Map;for(let G of z){let J=N4(G.shape[_]);if(!J.length)throw Error(`A discriminator value for key \`${_}\` could not be extracted from all schema options`);for(let Y of J){if(b.has(Y))throw Error(`Discriminator property ${String(_)} has duplicate value ${String(Y)}`);b.set(Y,G)}}return new z6({typeName:p.ZodDiscriminatedUnion,discriminator:_,options:z,optionsMap:b,...o(A)})}}function Z5(_,z){let A=b4(_),b=b4(z);if(_===z)return{valid:!0,data:_};else if(A===k.object&&b===k.object){let G=z0.objectKeys(z),J=z0.objectKeys(_).filter((X)=>G.indexOf(X)!==-1),Y={..._,...z};for(let X of J){let Q=Z5(_[X],z[X]);if(!Q.valid)return{valid:!1};Y[X]=Q.data}return{valid:!0,data:Y}}else if(A===k.array&&b===k.array){if(_.length!==z.length)return{valid:!1};let G=[];for(let J=0;J<_.length;J++){let Y=_[J],X=z[J],Q=Z5(Y,X);if(!Q.valid)return{valid:!1};G.push(Q.data)}return{valid:!0,data:G}}else if(A===k.date&&b===k.date&&+_===+z)return{valid:!0,data:_};else return{valid:!1}}class A1 extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_),b=(G,J)=>{if(e3(G)||e3(J))return l;let Y=Z5(G.value,J.value);if(!Y.valid)return T(A,{code:j.invalid_intersection_types}),l;if(_6(G)||_6(J))z.dirty();return{status:z.value,value:Y.data}};if(A.common.async)return Promise.all([this._def.left._parseAsync({data:A.data,path:A.path,parent:A}),this._def.right._parseAsync({data:A.data,path:A.path,parent:A})]).then(([G,J])=>b(G,J));else return b(this._def.left._parseSync({data:A.data,path:A.path,parent:A}),this._def.right._parseSync({data:A.data,path:A.path,parent:A}))}}A1.create=(_,z,A)=>{return new A1({left:_,right:z,typeName:p.ZodIntersection,...o(A)})};class J4 extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==k.array)return T(A,{code:j.invalid_type,expected:k.array,received:A.parsedType}),l;if(A.data.length<this._def.items.length)return T(A,{code:j.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l;if(!this._def.rest&&A.data.length>this._def.items.length)T(A,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),z.dirty();let G=[...A.data].map((J,Y)=>{let X=this._def.items[Y]||this._def.rest;if(!X)return null;return X._parse(new g9(A,J,A.path,Y))}).filter((J)=>!!J);if(A.common.async)return Promise.all(G).then((J)=>{return g0.mergeArray(z,J)});else return g0.mergeArray(z,G)}get items(){return this._def.items}rest(_){return new J4({...this._def,rest:_})}}J4.create=(_,z)=>{if(!Array.isArray(_))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new J4({items:_,typeName:p.ZodTuple,rest:null,...o(z)})};class Kz extends _0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==k.object)return T(A,{code:j.invalid_type,expected:k.object,received:A.parsedType}),l;let b=[],G=this._def.keyType,J=this._def.valueType;for(let Y in A.data)b.push({key:G._parse(new g9(A,Y,A.path,Y)),value:J._parse(new g9(A,A.data[Y],A.path,Y)),alwaysSet:Y in A.data});if(A.common.async)return g0.mergeObjectAsync(z,b);else return g0.mergeObjectSync(z,b)}get element(){return this._def.valueType}static create(_,z,A){if(z instanceof _0)return new Kz({keyType:_,valueType:z,typeName:p.ZodRecord,...o(A)});return new Kz({keyType:C9.create(),valueType:_,typeName:p.ZodRecord,...o(z)})}}class qz extends _0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==k.map)return T(A,{code:j.invalid_type,expected:k.map,received:A.parsedType}),l;let b=this._def.keyType,G=this._def.valueType,J=[...A.data.entries()].map(([Y,X],Q)=>{return{key:b._parse(new g9(A,Y,A.path,[Q,"key"])),value:G._parse(new g9(A,X,A.path,[Q,"value"]))}});if(A.common.async){let Y=new Map;return Promise.resolve().then(async()=>{for(let X of J){let Q=await X.key,$=await X.value;if(Q.status==="aborted"||$.status==="aborted")return l;if(Q.status==="dirty"||$.status==="dirty")z.dirty();Y.set(Q.value,$.value)}return{status:z.value,value:Y}})}else{let Y=new Map;for(let X of J){let{key:Q,value:$}=X;if(Q.status==="aborted"||$.status==="aborted")return l;if(Q.status==="dirty"||$.status==="dirty")z.dirty();Y.set(Q.value,$.value)}return{status:z.value,value:Y}}}}qz.create=(_,z,A)=>{return new qz({valueType:z,keyType:_,typeName:p.ZodMap,...o(A)})};class U_ extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==k.set)return T(A,{code:j.invalid_type,expected:k.set,received:A.parsedType}),l;let b=this._def;if(b.minSize!==null){if(A.data.size<b.minSize.value)T(A,{code:j.too_small,minimum:b.minSize.value,type:"set",inclusive:!0,exact:!1,message:b.minSize.message}),z.dirty()}if(b.maxSize!==null){if(A.data.size>b.maxSize.value)T(A,{code:j.too_big,maximum:b.maxSize.value,type:"set",inclusive:!0,exact:!1,message:b.maxSize.message}),z.dirty()}let G=this._def.valueType;function J(X){let Q=new Set;for(let $ of X){if($.status==="aborted")return l;if($.status==="dirty")z.dirty();Q.add($.value)}return{status:z.value,value:Q}}let Y=[...A.data.values()].map((X,Q)=>G._parse(new g9(A,X,A.path,Q)));if(A.common.async)return Promise.all(Y).then((X)=>J(X));else return J(Y)}min(_,z){return new U_({...this._def,minSize:{value:_,message:v.toString(z)}})}max(_,z){return new U_({...this._def,maxSize:{value:_,message:v.toString(z)}})}size(_,z){return this.min(_,z).max(_,z)}nonempty(_){return this.min(1,_)}}U_.create=(_,z)=>{return new U_({valueType:_,minSize:null,maxSize:null,typeName:p.ZodSet,...o(z)})};class s_ extends _0{constructor(){super(...arguments);this.validate=this.implement}_parse(_){let{ctx:z}=this._processInputParams(_);if(z.parsedType!==k.function)return T(z,{code:j.invalid_type,expected:k.function,received:z.parsedType}),l;function A(Y,X){return Bz({data:Y,path:z.path,errorMaps:[z.common.contextualErrorMap,z.schemaErrorMap,i_(),M4].filter((Q)=>!!Q),issueData:{code:j.invalid_arguments,argumentsError:X}})}function b(Y,X){return Bz({data:Y,path:z.path,errorMaps:[z.common.contextualErrorMap,z.schemaErrorMap,i_(),M4].filter((Q)=>!!Q),issueData:{code:j.invalid_return_type,returnTypeError:X}})}let G={errorMap:z.common.contextualErrorMap},J=z.data;if(this._def.returns instanceof D_){let Y=this;return d0(async function(...X){let Q=new J9([]),$=await Y._def.args.parseAsync(X,G).catch((Z)=>{throw Q.addIssue(A(X,Z)),Q}),H=await Reflect.apply(J,this,$);return await Y._def.returns._def.type.parseAsync(H,G).catch((Z)=>{throw Q.addIssue(b(H,Z)),Q})})}else{let Y=this;return d0(function(...X){let Q=Y._def.args.safeParse(X,G);if(!Q.success)throw new J9([A(X,Q.error)]);let $=Reflect.apply(J,this,Q.data),H=Y._def.returns.safeParse($,G);if(!H.success)throw new J9([b($,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(..._){return new s_({...this._def,args:J4.create(_).rest(d4.create())})}returns(_){return new s_({...this._def,returns:_})}implement(_){return this.parse(_)}strictImplement(_){return this.parse(_)}static create(_,z,A){return new s_({args:_?_:J4.create([]).rest(d4.create()),returns:z||d4.create(),typeName:p.ZodFunction,...o(A)})}}class b1 extends _0{get schema(){return this._def.getter()}_parse(_){let{ctx:z}=this._processInputParams(_);return this._def.getter()._parse({data:z.data,path:z.path,parent:z})}}b1.create=(_,z)=>{return new b1({getter:_,typeName:p.ZodLazy,...o(z)})};class G1 extends _0{_parse(_){if(_.data!==this._def.value){let z=this._getOrReturnCtx(_);return T(z,{received:z.data,code:j.invalid_literal,expected:this._def.value}),l}return{status:"valid",value:_.data}}get value(){return this._def.value}}G1.create=(_,z)=>{return new G1({value:_,typeName:p.ZodLiteral,...o(z)})};function PY(_,z){return new i4({values:_,typeName:p.ZodEnum,...o(z)})}class i4 extends _0{_parse(_){if(typeof _.data!=="string"){let z=this._getOrReturnCtx(_),A=this._def.values;return T(z,{expected:z0.joinValues(A),received:z.parsedType,code:j.invalid_type}),l}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(_.data)){let z=this._getOrReturnCtx(_),A=this._def.values;return T(z,{received:z.data,code:j.invalid_enum_value,options:A}),l}return d0(_.data)}get options(){return this._def.values}get enum(){let _={};for(let z of this._def.values)_[z]=z;return _}get Values(){let _={};for(let z of this._def.values)_[z]=z;return _}get Enum(){let _={};for(let z of this._def.values)_[z]=z;return _}extract(_,z=this._def){return i4.create(_,{...this._def,...z})}exclude(_,z=this._def){return i4.create(this.options.filter((A)=>!_.includes(A)),{...this._def,...z})}}i4.create=PY;class J1 extends _0{_parse(_){let z=z0.getValidEnumValues(this._def.values),A=this._getOrReturnCtx(_);if(A.parsedType!==k.string&&A.parsedType!==k.number){let b=z0.objectValues(z);return T(A,{expected:z0.joinValues(b),received:A.parsedType,code:j.invalid_type}),l}if(!this._cache)this._cache=new Set(z0.getValidEnumValues(this._def.values));if(!this._cache.has(_.data)){let b=z0.objectValues(z);return T(A,{received:A.data,code:j.invalid_enum_value,options:b}),l}return d0(_.data)}get enum(){return this._def.values}}J1.create=(_,z)=>{return new J1({values:_,typeName:p.ZodNativeEnum,...o(z)})};class D_ extends _0{unwrap(){return this._def.type}_parse(_){let{ctx:z}=this._processInputParams(_);if(z.parsedType!==k.promise&&z.common.async===!1)return T(z,{code:j.invalid_type,expected:k.promise,received:z.parsedType}),l;let A=z.parsedType===k.promise?z.data:Promise.resolve(z.data);return d0(A.then((b)=>{return this._def.type.parseAsync(b,{path:z.path,errorMap:z.common.contextualErrorMap})}))}}D_.create=(_,z)=>{return new D_({type:_,typeName:p.ZodPromise,...o(z)})};class f9 extends _0{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(_){let{status:z,ctx:A}=this._processInputParams(_),b=this._def.effect||null,G={addIssue:(J)=>{if(T(A,J),J.fatal)z.abort();else z.dirty()},get path(){return A.path}};if(G.addIssue=G.addIssue.bind(G),b.type==="preprocess"){let J=b.transform(A.data,G);if(A.common.async)return Promise.resolve(J).then(async(Y)=>{if(z.value==="aborted")return l;let X=await this._def.schema._parseAsync({data:Y,path:A.path,parent:A});if(X.status==="aborted")return l;if(X.status==="dirty")return q_(X.value);if(z.value==="dirty")return q_(X.value);return X});else{if(z.value==="aborted")return l;let Y=this._def.schema._parseSync({data:J,path:A.path,parent:A});if(Y.status==="aborted")return l;if(Y.status==="dirty")return q_(Y.value);if(z.value==="dirty")return q_(Y.value);return Y}}if(b.type==="refinement"){let J=(Y)=>{let X=b.refinement(Y,G);if(A.common.async)return Promise.resolve(X);if(X instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Y};if(A.common.async===!1){let Y=this._def.schema._parseSync({data:A.data,path:A.path,parent:A});if(Y.status==="aborted")return l;if(Y.status==="dirty")z.dirty();return J(Y.value),{status:z.value,value:Y.value}}else return this._def.schema._parseAsync({data:A.data,path:A.path,parent:A}).then((Y)=>{if(Y.status==="aborted")return l;if(Y.status==="dirty")z.dirty();return J(Y.value).then(()=>{return{status:z.value,value:Y.value}})})}if(b.type==="transform")if(A.common.async===!1){let J=this._def.schema._parseSync({data:A.data,path:A.path,parent:A});if(!p4(J))return l;let Y=b.transform(J.value,G);if(Y instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:z.value,value:Y}}else return this._def.schema._parseAsync({data:A.data,path:A.path,parent:A}).then((J)=>{if(!p4(J))return l;return Promise.resolve(b.transform(J.value,G)).then((Y)=>({status:z.value,value:Y}))});z0.assertNever(b)}}f9.create=(_,z,A)=>{return new f9({schema:_,typeName:p.ZodEffects,effect:z,...o(A)})};f9.createWithPreprocess=(_,z,A)=>{return new f9({schema:z,effect:{type:"preprocess",transform:_},typeName:p.ZodEffects,...o(A)})};class y9 extends _0{_parse(_){if(this._getType(_)===k.undefined)return d0(void 0);return this._def.innerType._parse(_)}unwrap(){return this._def.innerType}}y9.create=(_,z)=>{return new y9({innerType:_,typeName:p.ZodOptional,...o(z)})};class w4 extends _0{_parse(_){if(this._getType(_)===k.null)return d0(null);return this._def.innerType._parse(_)}unwrap(){return this._def.innerType}}w4.create=(_,z)=>{return new w4({innerType:_,typeName:p.ZodNullable,...o(z)})};class Y1 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A=z.data;if(z.parsedType===k.undefined)A=this._def.defaultValue();return this._def.innerType._parse({data:A,path:z.path,parent:z})}removeDefault(){return this._def.innerType}}Y1.create=(_,z)=>{return new Y1({innerType:_,typeName:p.ZodDefault,defaultValue:typeof z.default==="function"?z.default:()=>z.default,...o(z)})};class X1 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A={...z,common:{...z.common,issues:[]}},b=this._def.innerType._parse({data:A.data,path:A.path,parent:{...A}});if(o_(b))return b.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new J9(A.common.issues)},input:A.data})}});else return{status:"valid",value:b.status==="valid"?b.value:this._def.catchValue({get error(){return new J9(A.common.issues)},input:A.data})}}removeCatch(){return this._def.innerType}}X1.create=(_,z)=>{return new X1({innerType:_,typeName:p.ZodCatch,catchValue:typeof z.catch==="function"?z.catch:()=>z.catch,...o(z)})};class Wz extends _0{_parse(_){if(this._getType(_)!==k.nan){let A=this._getOrReturnCtx(_);return T(A,{code:j.invalid_type,expected:k.nan,received:A.parsedType}),l}return{status:"valid",value:_.data}}}Wz.create=(_)=>{return new Wz({typeName:p.ZodNaN,...o(_)})};var ZE=Symbol("zod_brand");class A6 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A=z.data;return this._def.type._parse({data:A,path:z.path,parent:z})}unwrap(){return this._def.type}}class Vz extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.common.async)return(async()=>{let G=await this._def.in._parseAsync({data:A.data,path:A.path,parent:A});if(G.status==="aborted")return l;if(G.status==="dirty")return z.dirty(),q_(G.value);else return this._def.out._parseAsync({data:G.value,path:A.path,parent:A})})();else{let b=this._def.in._parseSync({data:A.data,path:A.path,parent:A});if(b.status==="aborted")return l;if(b.status==="dirty")return z.dirty(),{status:"dirty",value:b.value};else return this._def.out._parseSync({data:b.value,path:A.path,parent:A})}}static create(_,z){return new Vz({in:_,out:z,typeName:p.ZodPipeline})}}class Q1 extends _0{_parse(_){let z=this._def.innerType._parse(_),A=(b)=>{if(p4(b))b.value=Object.freeze(b.value);return b};return o_(z)?z.then((b)=>A(b)):A(z)}unwrap(){return this._def.innerType}}Q1.create=(_,z)=>{return new Q1({innerType:_,typeName:p.ZodReadonly,...o(z)})};function OY(_,z){let A=typeof _==="function"?_(z):typeof _==="string"?{message:_}:_;return typeof A==="string"?{message:A}:A}function SY(_,z={},A){if(_)return V_.create().superRefine((b,G)=>{let J=_(b);if(J instanceof Promise)return J.then((Y)=>{if(!Y){let X=OY(z,b),Q=X.fatal??A??!0;G.addIssue({code:"custom",...X,fatal:Q})}});if(!J){let Y=OY(z,b),X=Y.fatal??A??!0;G.addIssue({code:"custom",...Y,fatal:X})}return});return V_.create()}var FE={object:S0.lazycreate},p;(function(_){_.ZodString="ZodString",_.ZodNumber="ZodNumber",_.ZodNaN="ZodNaN",_.ZodBigInt="ZodBigInt",_.ZodBoolean="ZodBoolean",_.ZodDate="ZodDate",_.ZodSymbol="ZodSymbol",_.ZodUndefined="ZodUndefined",_.ZodNull="ZodNull",_.ZodAny="ZodAny",_.ZodUnknown="ZodUnknown",_.ZodNever="ZodNever",_.ZodVoid="ZodVoid",_.ZodArray="ZodArray",_.ZodObject="ZodObject",_.ZodUnion="ZodUnion",_.ZodDiscriminatedUnion="ZodDiscriminatedUnion",_.ZodIntersection="ZodIntersection",_.ZodTuple="ZodTuple",_.ZodRecord="ZodRecord",_.ZodMap="ZodMap",_.ZodSet="ZodSet",_.ZodFunction="ZodFunction",_.ZodLazy="ZodLazy",_.ZodLiteral="ZodLiteral",_.ZodEnum="ZodEnum",_.ZodEffects="ZodEffects",_.ZodNativeEnum="ZodNativeEnum",_.ZodOptional="ZodOptional",_.ZodNullable="ZodNullable",_.ZodDefault="ZodDefault",_.ZodCatch="ZodCatch",_.ZodPromise="ZodPromise",_.ZodBranded="ZodBranded",_.ZodPipeline="ZodPipeline",_.ZodReadonly="ZodReadonly"})(p||(p={}));var KE=(_,z={message:`Input not instance of ${_.name}`})=>SY((A)=>A instanceof _,z),kY=C9.create,IY=r4.create,qE=Wz.create,WE=n4.create,xY=t_.create,VE=W_.create,UE=Zz.create,DE=e_.create,ME=_1.create,NE=V_.create,wE=d4.create,EE=G4.create,OE=Fz.create,LE=v9.create,jE=S0.create,RE=S0.strictCreate,PE=z1.create,SE=z6.create,kE=A1.create,IE=J4.create,xE=Kz.create,TE=qz.create,CE=U_.create,vE=s_.create,yE=b1.create,gE=G1.create,fE=i4.create,hE=J1.create,mE=D_.create,uE=f9.create,cE=y9.create,lE=w4.create,pE=f9.createWithPreprocess,dE=Vz.create,rE=()=>kY().optional(),nE=()=>IY().optional(),iE=()=>xY().optional(),oE={string:(_)=>C9.create({..._,coerce:!0}),number:(_)=>r4.create({..._,coerce:!0}),boolean:(_)=>t_.create({..._,coerce:!0}),bigint:(_)=>n4.create({..._,coerce:!0}),date:(_)=>W_.create({..._,coerce:!0})};var aE=l;var TY=U.object({sha256:U.string(),mediaType:U.string()}),sE=U.object({type:U.literal("user"),text:U.string(),images:U.array(TY).optional(),id:U.string().optional(),timestamp:U.string().optional()}),tE=U.object({type:U.literal("compaction-summary"),text:U.string(),id:U.string().optional(),timestamp:U.string().optional()}),eE=U.object({type:U.literal("command"),name:U.string(),args:U.string().optional(),output:U.string().optional(),id:U.string().optional(),timestamp:U.string().optional()}),_O=U.object({type:U.literal("agent"),text:U.string(),id:U.string().optional(),timestamp:U.string().optional(),model:U.string().optional()}),zO=U.object({type:U.literal("thinking"),text:U.string(),id:U.string().optional(),timestamp:U.string().optional(),model:U.string().optional()}),CY=U.object({type:U.literal("tool-call"),toolName:U.string().nullable(),input:U.unknown().optional(),output:U.unknown().optional(),images:U.array(TY).optional(),error:U.string().optional(),isError:U.union([U.boolean(),U.string()]).optional(),id:U.string().optional(),timestamp:U.string().optional(),model:U.string().optional()}),Y0=U.discriminatedUnion("type",[sE,tE,eE,_O,zO,CY]),K5=U.object({inputTokens:U.number(),cachedInputTokens:U.number(),outputTokens:U.number(),reasoningOutputTokens:U.number(),totalTokens:U.number()}),Y4=CY,AO=Y4.extend({toolName:U.literal("Write"),input:U.object({file_path:U.string(),content:U.string().optional()}).passthrough().optional(),output:U.object({type:U.string().optional()}).passthrough().optional()}),bO=Y4.extend({toolName:U.literal("Read"),input:U.object({file_path:U.string()}).passthrough().optional(),output:U.union([U.string(),U.object({type:U.string().optional(),file:U.object({content:U.string().optional(),numLines:U.number().optional(),startLine:U.number().optional(),totalLines:U.number().optional()}).passthrough().optional()}).passthrough()]).optional()}),GO=Y4.extend({toolName:U.literal("Edit"),input:U.object({file_path:U.string(),diff:U.string().optional()}).passthrough().optional(),output:U.union([U.string(),U.object({userModified:U.boolean().optional()}).passthrough()]).optional()}),vY=U.object({filenames:U.array(U.string()),durationMs:U.number().optional(),truncated:U.boolean().optional()}).passthrough(),JO=Y4.extend({toolName:U.literal("Glob"),input:U.object({pattern:U.string().optional()}).passthrough().optional(),output:vY.optional()}),YO=Y4.extend({toolName:U.literal("Grep"),input:U.unknown().optional(),output:vY.extend({mode:U.string().optional(),numMatches:U.number().optional()}).passthrough().optional()}),XO=Y4.extend({toolName:U.literal("Bash"),input:U.object({command:U.string(),description:U.string().optional()}).passthrough().optional(),output:U.union([U.string(),U.object({stdout:U.string().optional(),stderr:U.string().optional(),interrupted:U.boolean().optional(),isImage:U.boolean().optional()}).passthrough()]).optional()}),QO=Y4.extend({toolName:U.literal("BashOutput"),input:U.object({bash_id:U.string().optional()}).passthrough().optional(),output:U.object({command:U.string().optional(),exitCode:U.number().optional(),shellId:U.string().optional(),status:U.string().optional(),stderr:U.string().optional(),stdout:U.string().optional(),timestamp:U.string().optional()}).passthrough().optional()}),$O=Y4.extend({toolName:U.literal("Task"),input:U.unknown().optional(),output:U.object({status:U.string().optional(),totalDurationMs:U.number().optional(),totalToolUseCount:U.number().optional(),content:U.array(U.object({type:U.string().optional(),text:U.string().optional()}).passthrough()).optional(),usage:K5.optional()}).passthrough().optional()}),F5=U.object({content:U.string(),status:U.string().optional()}).passthrough(),HO=Y4.extend({toolName:U.literal("TodoWrite"),input:U.object({todos:U.array(F5).optional()}).passthrough().optional(),output:U.object({oldTodos:U.array(F5).optional(),newTodos:U.array(F5).optional()}).passthrough().optional()}),BO=[AO,bO,GO,JO,YO,XO,QO,$O,HO],ZO=Y4,yY=U.union([...BO,ZO]),M_=U.object({model:U.string(),usage:K5}),t0=U.object({relativeCwd:U.string().nullable(),branch:U.string().nullable(),repo:U.string().nullable()}).strict().nullable(),o4=U.object({v:U.literal(1),id:U.string(),source:U.enum(["claude-code","codex","opencode","pi","unknown"]),timestamp:U.coerce.date(),preview:U.string().nullable(),summary:U.string().nullable().default(null),model:U.string().nullable(),clientVersion:U.string().nullable(),blendedTokens:U.number(),costUsd:U.number(),messageCount:U.number(),toolCount:U.number(),userMessageCount:U.number(),filesChanged:U.number(),linesAdded:U.number().default(0),linesRemoved:U.number().default(0),linesModified:U.number().default(0),tokenUsage:K5,modelUsage:U.array(M_),git:t0,cwd:U.string().nullable(),messages:U.array(Y0)});import{appendFileSync as UO,mkdirSync as DO}from"fs";import{dirname as MO}from"path";import{existsSync as FO,readFileSync as KO}from"fs";import{homedir as qO}from"os";import{dirname as gY,resolve as q5}from"path";function WO(){let z=process.env.VI_CLI_PATH;if(z?.startsWith("bun "))z=z.slice(4);let A=z?gY(z):process.cwd(),b=10,G=0;while(G<b){let J=q5(A,"package.json");if(FO(J))try{if(JSON.parse(KO(J,"utf-8")).workspaces)return A}catch{}let Y=gY(A);if(Y===A)break;A=Y,G++}return null}function VO(){let _=WO();return _?q5(_,"logs"):null}function b6(){let _=VO();return _?q5(_,"dev.log"):null}function h9(_){let z=qO();if(_.startsWith(z))return _.replace(z,"~");let A=/^(\/Users\/[^/]+|\/home\/[^/]+)/;return _.replace(A,"~")}function Uz(_){if(_==="."||_===null)return"";return _}function M9(_,z){if(!z)return _;let A=z.endsWith("/")?z:`${z}/`,b=A.slice(0,-1),G=(Y)=>typeof Y==="object"&&Y!==null&&!Array.isArray(Y),J=(Y)=>{if(typeof Y==="string"){if(Y.includes(A))return Y.replaceAll(A,"./");if(Y.includes(b))return Y.replaceAll(b,".");return Y}if(Array.isArray(Y))return Y.map(J);if(G(Y)){let X={};for(let[Q,$]of Object.entries(Y))X[Q]=J($);return X}return Y};return J(_)}var fY=!1;function NO(_){if(_===void 0||_===null)return _;if(process.env.DEBUG_PAYLOADS!=="true"){if(!fY)return fY=!0,"[payload logging disabled - set DEBUG_PAYLOADS=true to enable]";return}if(typeof _==="object"){let A=JSON.stringify(_),b=Math.round(A.length/1024),G=A.includes('"isImage":true')||A.includes('"isImage": true')||A.length>1e4&&/[A-Za-z0-9+/]{100,}/.test(A);if(G||A.length>1e4)return`[payload: ${b}KB${G?", contains binary data":""}]`}return _}class hY{component;logToFile;logFilePath;disableConsole;constructor(_){this.component=_.component,this.disableConsole=_.disableConsole??!1;let z=typeof process<"u"&&!!process.versions?.node;if(this.logToFile=_.logToFile??(z&&!1),z&&this.logToFile){let A=b6(),b=_.logFilePath??A;if(b)this.logFilePath=b;else this.logToFile=!1,this.logFilePath=""}else this.logFilePath="",this.logToFile=!1;if(process.env.DEBUG)console.log(`[${this.component}] Logger config:`,{logToFile:this.logToFile,logFilePath:this.logFilePath,cwd:process.cwd(),NODE_ENV:"production"});if(this.logToFile)try{let A=MO(this.logFilePath);DO(A,{recursive:!0})}catch(A){if(process.env.DEBUG)console.error(`[${this.component}] Failed to create logs directory:`,A)}}log(_,z,A){let b=new Date,J=`[${`${String(b.getMonth()+1).padStart(2,"0")}-${String(b.getDate()).padStart(2,"0")} ${String(b.getHours()).padStart(2,"0")}:${String(b.getMinutes()).padStart(2,"0")}:${String(b.getSeconds()).padStart(2,"0")}`}] [${this.component}] [${_}] ${z}`,Y=_==="ERROR"?console.error:_==="WARN"?console.warn:console.log,X=NO(A);if(!this.disableConsole){if(Y(J),X!==void 0){let Q=typeof X==="object"?JSON.stringify(X,null,2):String(X);Y(` ${Q}`)}}if(this.logToFile)try{let Q=J+`
52
- `;if(X!==void 0){let $=typeof X==="object"?JSON.stringify(X):String(X);Q+=` ${$}
53
- `}UO(this.logFilePath,Q)}catch{}}debug(_,z){if(process.env.DEBUG)this.log("DEBUG",_,z)}info(_,z){this.log("INFO",_,z)}warn(_,z){this.log("WARN",_,z)}error(_,z){this.log("ERROR",_,z)}}function mY(_,z){return new hY({component:_,...z})}import{execSync as wO}from"child_process";import{resolve as EO}from"path";var OO="http://localhost:3000",LO=1e4;async function jO(_,z,A){try{return(await fetch(`${z}/api/blobs/${_}`,{method:"HEAD",headers:{...A&&{Authorization:`Bearer ${A}`}},signal:AbortSignal.timeout(5000)})).ok}catch{return!1}}async function RO(_,z,A){if(!_||_.length===0)return;let G=(await Promise.all(_.map(async(J)=>({blob:J,exists:await jO(J.sha256,z,A)})))).filter((J)=>!J.exists).map((J)=>J.blob);return G.length>0?G:void 0}async function W5(_,z={}){let A=z.serverUrl??process.env.VI_SERVER_URL??OO,b=z.authToken??null,G=z.timeoutMs??LO,J=await RO(_.blobs,A,b),Y=new FormData,X=`${_.unifiedTranscript.id||"transcript"}.jsonl`;if(_.id)Y.set("id",_.id);if(Y.set("sha256",_.sha256),Y.set("unifiedTranscript",JSON.stringify(_.unifiedTranscript)),_.visibility)Y.set("visibility",_.visibility);if(Y.set("transcript",new Blob([_.rawTranscript],{type:"application/jsonl"}),X),J)for(let Q of J){let $=Q.data.buffer.slice(Q.data.byteOffset,Q.data.byteOffset+Q.data.byteLength);Y.append(`blob:${Q.sha256}`,new Blob([$],{type:Q.mediaType}),`${Q.sha256}.blob`)}try{let Q=await fetch(`${A}/api/ingest`,{method:"POST",headers:{...b&&{Authorization:`Bearer ${b}`}},body:Y,signal:AbortSignal.timeout(G)});if(!Q.ok)return console.error(`Upload failed: ${Q.status} ${Q.statusText}`),{success:!1};let $=await Q.json();if(PO($))return{success:!0,id:$.id,transcriptId:$.transcriptId};return console.error("Upload succeeded but response had unexpected shape:",$),{success:!1}}catch(Q){if(Q instanceof Error)console.error("Upload error:",Q.message);return{success:!1}}}function PO(_){if(typeof _!=="object"||_===null)return!1;let z=_;return typeof z.success==="boolean"&&(z.success===!1||typeof z.id==="string"&&typeof z.transcriptId==="string")&&(z.eventsReceived===void 0||typeof z.eventsReceived==="number")}function uY(_){let z=EO(_),A=h9(z);try{let b=wO("git remote get-url origin",{cwd:z,encoding:"utf8",timeout:2000,stdio:["pipe","pipe","ignore"]}).trim(),G=SO(b),J=G.split("/").pop()||"unknown";return{repoId:G,repoName:J,cwd:A}}catch{return{repoId:null,repoName:z.split("/").pop()||"unknown",cwd:A}}}function SO(_){let z=/^(?<user>[^@]+)@(?<host>[^:]+):(?<path>.+)$/,A=_.match(z);if(A?.groups)return`${A.groups.host}/${A.groups.path.replace(/\.git$/i,"")}`;try{let b=new URL(_),G=b.pathname.replace(/\.git$/i,"").replace(/^\//,"");return`${b.host}/${G}`}catch{return _.replace(/\.git$/i,"")}}import kO from"node:crypto";import cY from"node:fs/promises";import IO from"node:path";var xO=200000,TO=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/openai/"],rY=new Set(["[request interrupted by user]","[request aborted by user]","[request cancelled by user]"]),CO=new Set(["/clear"]),vO=/^<\/?(?:command|local)-[a-z-]+>/i,nY=/^[α-ωΑ-Ω]\s/i,yO=/<command-name>(.*?)<\/command-name>/s,gO=/<command-args>(.*?)<\/command-args>/s,fO=/^<local-command-stdout>(.*)<\/local-command-stdout>$/s,hO=/<system-reminder>[\s\S]*?<\/system-reminder>/g,iY=["npm ","npm:","npm error","node:","node.js","error:","fatal:","warning:","traceback (most recent call last):","usage:","hint:","note:","code:","requirestack"],mO=new RegExp("\\b("+["fix","please","should","update","change","add","remove","create","write","implement","refactor","investigate","explain","help","why","what","how","need","ensure","make","build","let's","optimize","review","check"].join("|")+")\\b","i"),uO=3;function N_(_){let z=0,A=0,b=0,G=0,J=0,Y=new Set;for(let X of _)if(X.type==="user")A++;else if(X.type==="tool-call"){if(z++,X.isError||X.error)continue;let{toolName:Q,input:$,output:H}=X;if($&&typeof $.file_path==="string"){if(Q==="Edit"||Q==="Write")Y.add($.file_path)}if(Q==="Write"&&$&&typeof $.content==="string"){let Z=$.content.split(`
54
- `).length;b+=Z}let B=$?.diff??H?.diff;if(Q==="Edit"&&typeof B==="string"){let Z=0,F=0,K=B.split(`
55
- `);for(let W of K)if(W.startsWith("+")&&!W.startsWith("+++"))Z++;else if(W.startsWith("-")&&!W.startsWith("---"))F++;let q=Math.min(Z,F);b+=Z-q,G+=F-q,J+=q}}return{toolCount:z,userMessageCount:A,filesChanged:Y.size,linesAdded:b,linesRemoved:G,linesModified:J}}function J6(_,z={}){let A=cO(_);if(A.records.size===0)return null;let b=dO(A.records);if(b.length===0)return null;let G=b[b.length-1],J=rO(b),Y=iO(J),X=oO(J),Q=YL(Y),$=J.map((L)=>{let R=L.message?.usage;if(!R)return null;return{model:L.message?.model??null,usage:R}}).filter((L)=>L!==null),H=$L($,z.pricing),B=aO(b),Z=B.length>0?eO(B[0]):null,F=_X(G.timestamp)??z.now??new Date,K=AL(b),q=bL(X),W=U5(b),V=z.gitContext!==void 0?z.gitContext:zL(b),w=W?h9(W):"",{messages:O,blobs:M}=WL(b);if(O.length===0)return null;let P=N_(O),D={v:1,id:K??G.uuid,source:"claude-code",timestamp:F,preview:Z,summary:null,model:q,clientVersion:z.clientVersion??_L(b),blendedTokens:Q,costUsd:H,messageCount:O.length,...P,tokenUsage:Y,modelUsage:Array.from(X.entries()).map(([L,R])=>({model:aY(L),usage:R})),git:V,cwd:w,messages:O};return{transcript:o4.parse(D),blobs:M}}function cO(_){let z=new Map,A=new Map;for(let b of _){let G=typeof b.type==="string"?b.type:"";if(G==="summary")continue;let J=typeof b.uuid==="string"?b.uuid:null;if(!J)continue;let Y={uuid:J,type:G,timestamp:typeof b.timestamp==="string"?b.timestamp:void 0,parentUuid:typeof b.parentUuid==="string"||b.parentUuid===null?b.parentUuid:void 0,logicalParentUuid:typeof b.logicalParentUuid==="string"||b.logicalParentUuid===null?b.logicalParentUuid:void 0,isSidechain:Boolean(b.isSidechain),isMeta:Boolean(b.isMeta),isCompactSummary:Boolean(b.isCompactSummary),sessionId:typeof b.sessionId==="string"?b.sessionId:void 0,cwd:typeof b.cwd==="string"?b.cwd:void 0,gitBranch:typeof b.gitBranch==="string"?b.gitBranch:void 0,costUSD:typeof b.costUSD==="number"?b.costUSD:void 0,message:lO(b.message),raw:b};if(z.set(J,Y),Y.parentUuid){let X=A.get(Y.parentUuid)??new Set;X.add(J),A.set(Y.parentUuid,X)}}return{records:z,children:A}}function lO(_){if(!_||typeof _!=="object")return;let z=_,A=typeof z.id==="string"?z.id:void 0,b=typeof z.role==="string"?z.role:void 0,G=z.content,J=typeof z.model==="string"?z.model:void 0,Y=pO(z.usage);return{id:A,role:b,content:G,model:J,usage:Y}}function pO(_){if(!_||typeof _!=="object")return null;let z=_,A={};if(typeof z.input_tokens==="number")A.input_tokens=z.input_tokens;if(typeof z.cache_creation_input_tokens==="number")A.cache_creation_input_tokens=z.cache_creation_input_tokens;if(typeof z.cache_read_input_tokens==="number")A.cache_read_input_tokens=z.cache_read_input_tokens;if(typeof z.output_tokens==="number")A.output_tokens=z.output_tokens;if(typeof z.reasoning_output_tokens==="number")A.reasoning_output_tokens=z.reasoning_output_tokens;return Object.keys(A).length>0?A:null}function dO(_){let z=[];for(let A of _.values()){if(A.isSidechain)continue;z.push(A)}return z.sort((A,b)=>{let G=lY(A.timestamp)??0,J=lY(b.timestamp)??0;if(G!==J)return G-J;return A.uuid.localeCompare(b.uuid)}),z}function rO(_){let z=new Map;for(let A of _){if(A.type!=="assistant")continue;if(!A.message?.usage)continue;let G=nO(A);z.set(G,A)}return Array.from(z.values())}function nO(_){let z=_.message,A=pY(z?.id),b=pY(_.raw.requestId);if(A&&b)return`${A}:${b}`;if(A)return A;if(b)return b;return _.uuid}function iO(_){let z={inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0};for(let A of _){let b=A.message?.usage;if(!b)continue;let G=Y9(b.input_tokens),J=Y9(b.cache_creation_input_tokens),Y=Y9(b.cache_read_input_tokens),X=Y9(b.output_tokens),Q=Y9(b.reasoning_output_tokens);z.inputTokens+=G+J+Y,z.cachedInputTokens+=Y,z.outputTokens+=X,z.reasoningOutputTokens+=Q,z.totalTokens+=G+J+Y+X+Q}return z}function oO(_){let z=new Map;for(let A of _){let b=A.message?.model,G=A.message?.usage;if(!b||!G)continue;let J=z.get(b)??{inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0},Y=Y9(G.input_tokens),X=Y9(G.cache_creation_input_tokens),Q=Y9(G.cache_read_input_tokens),$=Y9(G.output_tokens),H=Y9(G.reasoning_output_tokens);J.inputTokens+=Y+X+Q,J.cachedInputTokens+=Q,J.outputTokens+=$,J.reasoningOutputTokens+=H,J.totalTokens+=Y+X+Q+$+H,z.set(b,J)}return z}function aO(_){let z=[];for(let A of _){if(!sO(A))continue;z.push(A)}return z}function sO(_){if(_.type!=="user")return!1;if(_.isSidechain)return!1;if(_.isMeta)return!1;let z=_.raw;if(z&&typeof z==="object"){if("toolUseResult"in z)return!1}let A=_.message?.content;if(Array.isArray(A)){if(A.some((J)=>tO(J)))return!1}let b=sY(_);if(!b)return!1;let G=b.toLowerCase();if(rY.has(G))return!1;if(oY(b))return!1;if(nY.test(b))return!1;if(iY.some((J)=>G.startsWith(J))){if(!eY(b))return!1}return!0}function tO(_){if(!_||typeof _!=="object")return!1;let z=_;if(z.type==="tool_result")return!0;if(typeof z.tool_use_id==="string")return!0;return!1}function oY(_){return vO.test(_)}function eO(_){let z=sY(_);if(!z)return null;return tY(z)}function U5(_){for(let z of _)if(z.cwd)return z.cwd;return}function _L(_){for(let z of _){let A=z.raw.version;if(typeof A==="string"&&A.length>0)return A}return null}function zL(_){let z=U5(_),A=_.find((J)=>J.gitBranch)?.gitBranch??null;if(!z)return t0.parse({relativeCwd:null,branch:A,repo:null});let b=z.split(/[\\/]+/).filter(Boolean);if(b.length===0)return t0.parse({relativeCwd:null,branch:A,repo:null});let G=b.findIndex((J)=>{let Y=J.toLowerCase();return Y.includes("github")||Y.includes("gitlab")||Y.includes("bitbucket")});if(G>=0){let J=b[G]?.toLowerCase()??"",Y=J.includes("gitlab")?"gitlab.com":J.includes("bitbucket")?"bitbucket.org":"github.com",X=b[G+1],Q=b[G+2]?.replace(/\.git$/i,"");if(X&&Q){let $=b.slice(G+3),H=$.length>0?$.join("/"):".";return t0.parse({relativeCwd:Uz(H),branch:A,repo:`${Y}/${X}/${Q}`})}}return t0.parse({relativeCwd:null,branch:A,repo:null})}async function e0(_,z){if(!_)return null;try{if(!(await cY.stat(_)).isDirectory())return t0.parse({relativeCwd:null,branch:z??null,repo:null})}catch{return t0.parse({relativeCwd:null,branch:z??null,repo:null})}let A=await q8(_);if(!A)return t0.parse({relativeCwd:null,branch:z??null,repo:null});let b=IO.relative(A,_)||".",G=z??await sb(A),J=await W8(A);return t0.parse({relativeCwd:Uz(b),branch:G,repo:J})}function AL(_){for(let z of _){let A=typeof z.sessionId==="string"?z.sessionId.trim():"";if(A.length>0)return A}return null}function aY(_){if(_.includes("/"))return _;return`anthropic/${_}`}function bL(_){let z=null,A=-1;for(let[b,G]of _){let J=G.totalTokens>0?G.totalTokens:G.inputTokens+G.outputTokens;if(J>A)A=J,z=b}return z?aY(z):null}function sY(_){return GL(_.message)[0]??null}function GL(_){if(!_)return[];let z=_.content;if(typeof z==="string"){let A=V5(z);return A?[A]:[]}if(Array.isArray(z)){let A=[];for(let b of z){if(typeof b==="string"){let G=V5(b);if(G)A.push(G);continue}if(b&&typeof b==="object"){let G=b,J=["content","text"];for(let Y of J){let X=G[Y];if(typeof X==="string"){let Q=V5(X);if(Q)A.push(Q)}}}}return A}return[]}function V5(_,z=uO){let A=JL(_);if(A.length===0)return null;let G=A.slice(0,z).join(" "),J=tY(G);return J.length>0?J:null}function JL(_){let z=[];for(let A of _.split(/\r?\n/)){let b=A.trim();if(!b)continue;let G=b.toLowerCase();if(rY.has(G))continue;if(oY(b))continue;if(nY.test(b))continue;if(iY.some((J)=>G.startsWith(J))){if(!eY(b))continue}if(!/[a-z]/i.test(b)&&!/\d/.test(b))continue;z.push(b)}return z}function tY(_){return _.replace(/\s+/g," ").trim()}function eY(_){let z=_.toLowerCase();if(mO.test(z))return!0;if(z.includes("?"))return!0;return["can you","can we","could you","could we","would you","would we","should we","should i","let's","let us"].some((b)=>z.includes(b))}function YL(_){return Math.max(0,_.inputTokens-_.cachedInputTokens)+_.outputTokens+_.reasoningOutputTokens}function _X(_){if(!_)return null;let z=new Date(_);return Number.isNaN(z.getTime())?null:z}function lY(_){let z=_X(_);return z?z.getTime():null}function Y9(_){return typeof _==="number"&&Number.isFinite(_)?_:0}function pY(_){if(typeof _!=="string")return;let z=_.trim();return z.length>0?z:void 0}function XL(_){return kO.createHash("sha256").update(_).digest("hex")}function G6(_,z){if(_===null||_===void 0)return _;if(Array.isArray(_))return _.map((A)=>G6(A,z));if(typeof _==="object"){let A=_;if(A.type==="image"&&A.source&&typeof A.source==="object"){let G=A.source;if(typeof G.data==="string"&&G.data.length>0){let J=G.data,Y=typeof G.mediaType==="string"?G.mediaType:typeof G.media_type==="string"?G.media_type:"image/unknown",X=Buffer.from(J,"base64"),Q=XL(X);if(!z.has(Q))z.set(Q,{data:X,mediaType:Y});return{type:"image",source:{type:"sha256",mediaType:Y,sha256:Q}}}}let b={};for(let[G,J]of Object.entries(A))b[G]=G6(J,z);return b}return _}function QL(_){let z=[];function A(b){if(b===null||b===void 0)return;if(Array.isArray(b)){for(let G of b)A(G);return}if(typeof b==="object"){let G=b;if(G.type==="image"&&G.source&&typeof G.source==="object"){let J=G.source;if(J.type==="sha256"&&typeof J.sha256==="string"){z.push({sha256:J.sha256,mediaType:typeof J.mediaType==="string"?J.mediaType:"image/unknown"});return}}for(let J of Object.values(G))A(J)}}return A(_),z}function $L(_,z){if(!z||Object.keys(z).length===0)return 0;let A=0;for(let b of _){let G=b.model;if(!G)continue;let J=HL(G,z);if(!J)continue;let Y=BL({input_tokens:Y9(b.usage.input_tokens),output_tokens:Y9(b.usage.output_tokens),cache_creation_input_tokens:Y9(b.usage.cache_creation_input_tokens),cache_read_input_tokens:Y9(b.usage.cache_read_input_tokens)},J);A+=Y}return A}function HL(_,z){let A=_.trim();if(!A)return null;let b=new Set;b.add(A);for(let J of TO)b.add(`${J}${A}`);for(let J of b){let Y=z[J];if(Y)return Y}let G=A.toLowerCase();for(let[J,Y]of Object.entries(z)){let X=J.toLowerCase();if(X.includes(G)||G.includes(X))return Y}return null}function BL(_,z){let A=(X,Q,$,H=xO)=>{if(X==null||X<=0)return 0;if(X>H&&$!=null){let B=Math.min(X,H),F=Math.max(0,X-H)*$;if(Q!=null)F+=B*Q;return F}if(Q!=null)return X*Q;return 0},b=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),G=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),J=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),Y=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return b+G+J+Y}function ZL(_){let z=_.match(yO);if(!z)return null;let A=z[1].trim(),G=_.match(gO)?.[1]?.trim()||void 0;return{name:A,args:G||void 0}}function FL(_){let z=_.trim().match(fO);if(!z)return null;return z[1]}function KL(_){return _.replace(hO,"").trim()}function qL(_){return _.replace(/\x1B\[[0-9;]*m/g,"")}function WL(_){let z=[],A=new Map,b=new Map,G=null,J=!1,Y=new Map,X=new Set,Q=U5(_);for(let $ of _){if($.isMeta)continue;let H=UL($),B=$.type;if(B==="user"){let{texts:Z,images:F,toolResults:K}=VL($,A);for(let q of Z){if(!q.trim())continue;let W=FL(q);if(W!==null){if(J){J=!1;continue}if(G){let M=qL(W).trim();z.push(Y0.parse({type:"command",name:G.name,args:G.args,output:M||void 0,id:G.id,timestamp:G.timestamp})),G=null}continue}let V=ZL(q);if(V){if(CO.has(V.name)){J=!0;continue}if(G)z.push(Y0.parse({type:"command",name:G.name,args:G.args,id:G.id,timestamp:G.timestamp}));G={name:V.name,args:V.args,id:$.uuid,timestamp:H.timestamp};continue}let w=KL(q);if(!w)continue;let O=$.isCompactSummary?"compaction-summary":"user";if(O==="user"){let M=`${H.timestamp}:${w}`,P=Y.get(M);if(P){if(!P.hasImages&&F.length>0){let R=z[P.index];R.images=F,P.hasImages=!0}continue}let D={type:O,text:w,id:$.uuid,timestamp:H.timestamp};if(F.length>0)D.images=F;let L=z.length;z.push(Y0.parse(D)),Y.set(M,{index:L,hasImages:F.length>0})}else{let M={type:O,text:w,id:$.uuid,timestamp:H.timestamp};z.push(Y0.parse(M))}}for(let q of K){let W=q.callId?b.get(q.callId):void 0;if(W){let V=z[W.index],w=G6(q.output,A);V.output=w;let O=QL(w);if(O.length>0)V.images=O;if(q.error)V.error=q.error;if(typeof q.isError<"u")V.isError=q.isError;let M=dY(V,Q);z[W.index]=M}}continue}if(B==="assistant"){let Z=$.message?.content;if(!Array.isArray(Z))continue;for(let F of Z){if(!F||typeof F!=="object")continue;let K=F;if(K.type==="thinking"&&typeof K.thinking==="string"){let q=`thinking:${H.id}:${H.timestamp}:${K.thinking}`;if(X.has(q))continue;X.add(q),z.push(Y0.parse({type:"thinking",text:K.thinking,...H}));continue}if(K.type==="text"&&typeof K.text==="string"){let q=`agent:${H.id}:${H.timestamp}:${K.text}`;if(X.has(q))continue;X.add(q),z.push(Y0.parse({type:"agent",text:K.text,...H}));continue}if(K.type==="tool_use"){let q=typeof K.id==="string"?K.id:"",W=typeof K.name==="string"?K.name:null,V=K.input??void 0,w={type:"tool-call",toolName:W,...H,input:V},O=Y0.parse(w),M=dY(O,Q);if(z.push(M),q)b.set(q,{index:z.length-1,toolName:W});continue}if(K.type==="image")continue}}}if(G)z.push(Y0.parse({type:"command",name:G.name,args:G.args,id:G.id,timestamp:G.timestamp}));return{messages:z,blobs:A}}function VL(_,z){let A=_.message;if(!A)return{texts:[],images:[],toolResults:[]};let b=A.content;if(typeof b==="string")return b?{texts:[b],images:[],toolResults:[]}:{texts:[],images:[],toolResults:[]};if(!Array.isArray(b))return{texts:[],images:[],toolResults:[]};let G=[],J=[],Y=[];for(let X of b){if(!X||typeof X!=="object")continue;if(typeof X==="string"){if(X)G.push(X);continue}let Q=X,$=typeof Q.type==="string"?Q.type:void 0;if($==="tool_result"){let H=Q,B=typeof H.tool_use_id==="string"?H.tool_use_id:void 0,Z=H.content,F=_.raw.toolUseResult??_.raw.tool_use_result;if(F)Z=F;let K=typeof H.error==="string"?H.error:void 0,q=H.is_error??H.isError,W=typeof q==="boolean"?q:typeof H.success==="boolean"?!H.success:void 0;Y.push({callId:B,output:Z,error:K,isError:W});continue}if($==="text"&&typeof Q.text==="string"){if(Q.text)G.push(Q.text);continue}if($==="image"){let H=G6(Q,z);if(H&&typeof H==="object"&&H.type==="image"){let B=H.source;if(B?.type==="sha256"&&typeof B.sha256==="string")J.push({sha256:B.sha256,mediaType:typeof B.mediaType==="string"?B.mediaType:"image/unknown"})}continue}for(let H of["content","text"]){let B=Q[H];if(typeof B==="string"&&B)G.push(B)}}return{texts:G,images:J,toolResults:Y}}function UL(_){return{id:_.message?.id,timestamp:_.timestamp,model:_.message?.model}}function dY(_,z){if(!z)return _;let A=z.endsWith("/")?z:`${z}/`,b=(D)=>{if(D.startsWith(A))return`./${D.slice(A.length)}`;return D},G=(D)=>typeof D==="object"&&D!==null&&!Array.isArray(D),J=(D)=>G(D)?{...D}:void 0,Y=(D,L)=>{let R={...D};for(let S of L)delete R[S];return R},X=(D,L)=>{if(typeof D[L]==="string")D[L]=b(D[L])},Q=(D)=>typeof D==="number"&&Number.isFinite(D)?D:0,$=(D)=>{if(!Array.isArray(D))return D;return D.map((L)=>{if(G(L)){let R={...L};return delete R.activeForm,R}return L})},{toolName:H,input:B,output:Z}=_,F=B,K=Z,q=!1,W=!1,V=_.isError;switch(H){case"Write":{let D=J(B);if(D)X(D,"file_path"),F=D,q=!0;let L=J(Z);if(L){let R={};if(L.type!==void 0)R.type=L.type;K=R,W=!0}break}case"Read":{let D=J(B);if(D)X(D,"file_path"),F=D,q=!0;let L=J(Z);if(L){let R={};if(typeof L.type==="string")R.type=L.type;if(L.file&&G(L.file)){let S=L.file,y={};if(typeof S.content==="string")y.content=S.content;if(typeof S.numLines==="number")y.numLines=S.numLines;if(typeof S.startLine==="number")y.startLine=S.startLine;if(typeof S.totalLines==="number")y.totalLines=S.totalLines;if(Object.keys(y).length>0)R.file=y}K=R,W=!0}break}case"Edit":{let D=J(B),L=J(Z),R,S;if(L&&Array.isArray(L.structuredPatch)){let y=[];for(let e of L.structuredPatch)if(G(e)){if(S===void 0&&typeof e.oldStart==="number")S=e.oldStart;if(Array.isArray(e.lines)){for(let u of e.lines)if(typeof u==="string")y.push(u)}}if(y.length>0)R=`${y.join(`
47
+ `),A1}function M4(){return{async get(_,z){let G=(await G6()).get("SELECT value FROM kv WHERE key = ?",_);if(!G)return z;try{return JSON.parse(G.value)}catch{return z}},async set(_,z){let A=await G6(),G=JSON.stringify(z);A.run("INSERT OR REPLACE INTO kv (key, value) VALUES (?, ?)",_,G)},async delete(_){(await G6()).run("DELETE FROM kv WHERE key = ?",_)},async keys(_){let z=await G6();if(_)return z.all("SELECT key FROM kv WHERE key LIKE ?",`${_}%`).map((J)=>J.key);return z.all("SELECT key FROM kv").map((G)=>G.key)}}}async function j9(_){let z=M4(),A=`transcript.${_}.id`,G=await z.get(A);if(G)return G;let J=Xw()();return await z.set(A,J),J}async function Z5(_,z){let A=M4(),G=`transcript.${_}.id`;await A.set(G,z)}async function Kz(_,z){let A=M4(),G=`call.${_}.transcriptId`;await A.set(G,z)}async function Wz(_){let z=M4(),A=`call.${_}.transcriptId`;return z.get(A)}async function Vz(_){let z=M4(),A=`call.${_}.transcriptId`;await z.delete(A)}var q5=jX(Bw(),".config","agentlogs"),F5=jX(q5,"config.json");function RX(){if(!LX(q5))Qw(q5,{recursive:!0})}function K5(){if(RX(),!LX(F5))return{environments:[]};try{let _=$w(F5,"utf-8"),z=JSON.parse(_);return{environments:Array.isArray(z.environments)?z.environments:[]}}catch{return{environments:[]}}}function PX(_){RX();try{Hw(F5,JSON.stringify(_,null,2),"utf-8")}catch(z){throw console.error("Failed to write config file:",z),z}}function G1(){return K5().environments}function J6(_){return G1().find((z)=>z.name===_)}function W5(_){return`auth.token.${_}`}async function V5(_){let z=process.env.AGENTLOGS_AUTH_TOKEN?.trim();if(z)return z;try{if(!J6(_)?.user?.email)return null;return await M4().get(W5(_))??null}catch{return null}}async function SX(_,z,A){try{await M4().set(W5(_),A)}catch(G){throw console.error("Failed to store token:",G),G}}async function kX(_){try{await M4().delete(W5(_))}catch{}}function IX(_){let z=K5(),A=z.environments.findIndex((G)=>G.name===_.name);if(A>=0)z.environments[A]=_;else z.environments.push(_);PX(z)}function xX(_){let z=K5();z.environments=z.environments.filter((A)=>A.name!==_),PX(z)}function Zw(_){try{return new URL(_).host.toLowerCase()}catch{return"custom"}}async function f9(){let _=G1(),z=[];for(let A of _){let G=await V5(A.name);if(G)z.push({...A,token:G})}if(z.length===0){let A=process.env.AGENTLOGS_AUTH_TOKEN?.trim();if(A){let G=process.env.AGENTLOGS_SERVER_URL?.trim()||"https://agentlogs.ai"?.trim()||"https://agentlogs.ai";z.push({name:Zw(G),baseURL:G,user:{id:"ci",email:"ci@agentlogs.ai",name:"CI"},lastLoginTime:new Date().toISOString(),token:A})}}return z}async function TX(_){try{let{host:z,baseURL:A}=e3(_.hostname);console.log("\uD83D\uDD10 AgentLogs Device Authorization"),console.log(`\uD83C\uDF10 Server: ${A}`),console.log("⏳ Requesting device authorization...");let G=_6(A),{data:J,error:Y}=await G.device.code({client_id:"agentlogs-cli",scope:"openid profile email"});if(Y||!J)console.error("❌ Error:",Y?.error_description||"Failed to request device code"),process.exit(1);let{device_code:X,user_code:b,verification_uri:Q,verification_uri_complete:$,interval:H=5}=J;console.log(`
48
+ \uD83D\uDCF1 Device Authorization in Progress`),console.log(`Please visit: ${Q}`),console.log(`Enter code: ${b}
49
+ `);let B=$||Q;if(B)console.log("\uD83C\uDF10 Opening browser..."),await cJ(B);console.log(`⏳ Waiting for authorization... (polling every ${H}s)`),await qw(G,X,H,z,A)}catch(z){console.error("❌ Error:",z instanceof Error?z.message:"Unknown error"),process.exit(1)}}async function qw(_,z,A,G,J){let Y=A;return new Promise((X)=>{let b=async()=>{try{let{data:Q,error:$}=await _.device.token({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:z,client_id:"agentlogs-cli"});if(Q?.access_token){console.log(`
50
+ ✅ Authorization Successful!`),console.log("\uD83D\uDD11 Access token received!");let{data:H}=await _.getSession({fetchOptions:{headers:{Authorization:`Bearer ${Q.access_token}`}}});if(H?.user)await SX(G,H.user.email,Q.access_token),IX({name:G,baseURL:J,user:{id:H.user.id,email:H.user.email,name:H.user.name},lastLoginTime:new Date().toISOString()}),console.log(`\uD83D\uDC4B Hello, ${H.user.name}!`),console.log(`\uD83D\uDCE7 Logged in as: ${H.user.email}`),console.log(`\uD83C\uDF10 Environment: ${G}`);else console.log("⚠️ Warning: Could not retrieve user session");X(),process.exit(0)}else if($)switch($.error){case"authorization_pending":break;case"slow_down":Y+=5,console.log(`⚠️ Slowing down polling to ${Y}s`);break;case"access_denied":console.error("❌ Access was denied by the user"),process.exit(1);break;case"expired_token":console.error("❌ The device code has expired. Please try again."),process.exit(1);break;default:console.error("❌ Error:",$.error_description||$.error),process.exit(1)}}catch(Q){console.error("❌ Error:",Q instanceof Error?Q.message:"Unknown error"),process.exit(1)}setTimeout(b,Y*1000)};setTimeout(b,Y*1000)})}async function CX(_={}){let z;try{z=Fw(_.hostname)}catch(G){console.error("❌ Error:",G instanceof Error?G.message:"Invalid hostname"),process.exit(1)}if(z.length===0){if(_.hostname)console.log(`ℹ️ Not currently logged in to ${_.hostname}`);else console.log("ℹ️ Not currently logged in to any environment");return}let A=[];for(let G of z){let J=J6(G);if(!J)continue;try{await kX(G),xX(G),A.push(J)}catch(Y){console.error(`⚠️ Warning: Could not completely clear credentials for ${G}:`,Y instanceof Error?Y.message:"Unknown error")}}if(A.length===0){console.log("ℹ️ No environments were logged out");return}if(A.length===1){console.log(`✅ Logged out from ${A[0].name} successfully`),console.log(`\uD83D\uDCE7 Was logged in as: ${A[0].user.email}`);return}console.log(`✅ Logged out from ${A.length} environments:`);for(let G of A)console.log(`- ${G.name} (${G.user.email})`)}function Fw(_){if(_){let{host:z}=e3(_);return J6(z)?[z]:[]}return G1().map((z)=>z.name)}async function vX(_={}){if(_.allowMode){let G=_.allowMode.toLowerCase();if(G!=="allowlist"&&G!=="denylist")console.error("Invalid allowMode. Use 'allowlist' or 'denylist'."),process.exit(1);MJ(G),console.log(`Allow mode set to: ${G}`),console.log()}let z=z4();console.log("AgentLogs Settings"),console.log("──────────────────"),console.log(`Mode: ${z.allowMode}`),console.log(`Config: ${NJ()}`),console.log();let A=Object.keys(z.repos);if(A.length===0)console.log("Repos: (none configured)");else{console.log("Repos:");for(let G of A){let J=z.repos[G];if(J.allow){let Y=J.visibility??"(server default)";console.log(` ✓ ${G} ${Y}`)}else console.log(` ✗ ${G} (denied)`)}}process.exit(0)}async function yX(){let _=G1();if(_.length===0)console.log("❌ Not logged in"),console.log("Run `agentlogs login agentlogs.ai` to authenticate"),process.exit(1);console.log(`\uD83D\uDD10 AgentLogs Authentication Status
51
+ `);let z=!1;for(let A of _){let G=await V5(A.name);if(!G){console.log(`${A.name} (${A.baseURL})`),console.log(" ❌ Token not found"),console.log(` \uD83D\uDCE7 Was: ${A.user.email}`),console.log("");continue}try{let J=_6(A.baseURL),{data:Y,error:X}=await J.getSession({fetchOptions:{headers:{Authorization:`Bearer ${G}`}}});if(X||!Y?.user){console.log(`${A.name} (${A.baseURL})`),console.log(" ⚠️ Token invalid or expired"),console.log(` \uD83D\uDCE7 Was: ${A.user.email}`),console.log(` Run \`agentlogs login ${A.name}\` to re-authenticate`),console.log("");continue}if(z=!0,console.log(`${A.name} (${A.baseURL})`),console.log(" ✅ Logged in"),console.log(` \uD83D\uDC64 ${Y.user.name}`),console.log(` \uD83D\uDCE7 ${Y.user.email}`),A.lastLoginTime){let b=new Date(A.lastLoginTime);console.log(` \uD83D\uDD50 Last login: ${b.toLocaleString()}`)}console.log("")}catch(J){console.log(`${A.name} (${A.baseURL})`),console.log(` ❌ Error verifying session: ${J instanceof Error?J.message:"Unknown error"}`),console.log("")}}if(!z)process.exit(1)}import{resolve as xQ}from"path";import{spawnSync as sS}from"child_process";import{existsSync as B2,readFileSync as Z2}from"fs";var D={};qA(D,{void:()=>tw,util:()=>A0,unknown:()=>aw,union:()=>AO,undefined:()=>nw,tuple:()=>YO,transformer:()=>KO,symbol:()=>rw,string:()=>dX,strictObject:()=>zO,setErrorMap:()=>Vw,set:()=>QO,record:()=>XO,quotelessJson:()=>Kw,promise:()=>FO,preprocess:()=>UO,pipeline:()=>DO,ostring:()=>MO,optional:()=>WO,onumber:()=>NO,oboolean:()=>EO,objectUtil:()=>U5,object:()=>_O,number:()=>rX,nullable:()=>VO,null:()=>iw,never:()=>sw,nativeEnum:()=>qO,nan:()=>lw,map:()=>bO,makeIssue:()=>Uz,literal:()=>BO,lazy:()=>HO,late:()=>uw,isValid:()=>s4,isDirty:()=>X6,isAsync:()=>Y1,isAborted:()=>Y6,intersection:()=>JO,instanceof:()=>cw,getParsedType:()=>J4,getErrorMap:()=>J1,function:()=>$O,enum:()=>ZO,effect:()=>KO,discriminatedUnion:()=>GO,defaultErrorMap:()=>N4,datetimeRegex:()=>cX,date:()=>dw,custom:()=>pX,coerce:()=>wO,boolean:()=>nX,bigint:()=>pw,array:()=>ew,any:()=>ow,addIssueToContext:()=>T,ZodVoid:()=>Mz,ZodUnknown:()=>t4,ZodUnion:()=>B1,ZodUndefined:()=>$1,ZodType:()=>_0,ZodTuple:()=>X4,ZodTransformer:()=>l9,ZodSymbol:()=>Dz,ZodString:()=>h9,ZodSet:()=>k_,ZodSchema:()=>_0,ZodRecord:()=>Nz,ZodReadonly:()=>U1,ZodPromise:()=>I_,ZodPipeline:()=>Oz,ZodParsedType:()=>I,ZodOptional:()=>u9,ZodObject:()=>S0,ZodNumber:()=>e4,ZodNullable:()=>w4,ZodNull:()=>H1,ZodNever:()=>Y4,ZodNativeEnum:()=>K1,ZodNaN:()=>wz,ZodMap:()=>Ez,ZodLiteral:()=>F1,ZodLazy:()=>q1,ZodIssueCode:()=>R,ZodIntersection:()=>Z1,ZodFunction:()=>b1,ZodFirstPartyTypeKind:()=>p,ZodError:()=>b9,ZodEnum:()=>z_,ZodEffects:()=>l9,ZodDiscriminatedUnion:()=>b6,ZodDefault:()=>W1,ZodDate:()=>P_,ZodCatch:()=>V1,ZodBranded:()=>Q6,ZodBoolean:()=>Q1,ZodBigInt:()=>__,ZodArray:()=>m9,ZodAny:()=>S_,Schema:()=>_0,ParseStatus:()=>m0,OK:()=>a0,NEVER:()=>OO,INVALID:()=>l,EMPTY_PATH:()=>Uw,DIRTY:()=>R_,BRAND:()=>mw});var A0;(function(_){_.assertEqual=(J)=>{};function z(J){}_.assertIs=z;function A(J){throw Error()}_.assertNever=A,_.arrayToEnum=(J)=>{let Y={};for(let X of J)Y[X]=X;return Y},_.getValidEnumValues=(J)=>{let Y=_.objectKeys(J).filter((b)=>typeof J[J[b]]!=="number"),X={};for(let b of Y)X[b]=J[b];return _.objectValues(X)},_.objectValues=(J)=>{return _.objectKeys(J).map(function(Y){return J[Y]})},_.objectKeys=typeof Object.keys==="function"?(J)=>Object.keys(J):(J)=>{let Y=[];for(let X in J)if(Object.prototype.hasOwnProperty.call(J,X))Y.push(X);return Y},_.find=(J,Y)=>{for(let X of J)if(Y(X))return X;return},_.isInteger=typeof Number.isInteger==="function"?(J)=>Number.isInteger(J):(J)=>typeof J==="number"&&Number.isFinite(J)&&Math.floor(J)===J;function G(J,Y=" | "){return J.map((X)=>typeof X==="string"?`'${X}'`:X).join(Y)}_.joinValues=G,_.jsonStringifyReplacer=(J,Y)=>{if(typeof Y==="bigint")return Y.toString();return Y}})(A0||(A0={}));var U5;(function(_){_.mergeShapes=(z,A)=>{return{...z,...A}}})(U5||(U5={}));var I=A0.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),J4=(_)=>{switch(typeof _){case"undefined":return I.undefined;case"string":return I.string;case"number":return Number.isNaN(_)?I.nan:I.number;case"boolean":return I.boolean;case"function":return I.function;case"bigint":return I.bigint;case"symbol":return I.symbol;case"object":if(Array.isArray(_))return I.array;if(_===null)return I.null;if(_.then&&typeof _.then==="function"&&_.catch&&typeof _.catch==="function")return I.promise;if(typeof Map<"u"&&_ instanceof Map)return I.map;if(typeof Set<"u"&&_ instanceof Set)return I.set;if(typeof Date<"u"&&_ instanceof Date)return I.date;return I.object;default:return I.unknown}};var R=A0.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"]),Kw=(_)=>{return JSON.stringify(_,null,2).replace(/"([^"]+)":/g,"$1:")};class b9 extends Error{get errors(){return this.issues}constructor(_){super();this.issues=[],this.addIssue=(A)=>{this.issues=[...this.issues,A]},this.addIssues=(A=[])=>{this.issues=[...this.issues,...A]};let z=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,z);else this.__proto__=z;this.name="ZodError",this.issues=_}format(_){let z=_||function(J){return J.message},A={_errors:[]},G=(J)=>{for(let Y of J.issues)if(Y.code==="invalid_union")Y.unionErrors.map(G);else if(Y.code==="invalid_return_type")G(Y.returnTypeError);else if(Y.code==="invalid_arguments")G(Y.argumentsError);else if(Y.path.length===0)A._errors.push(z(Y));else{let X=A,b=0;while(b<Y.path.length){let Q=Y.path[b];if(b!==Y.path.length-1)X[Q]=X[Q]||{_errors:[]};else X[Q]=X[Q]||{_errors:[]},X[Q]._errors.push(z(Y));X=X[Q],b++}}};return G(this),A}static assert(_){if(!(_ instanceof b9))throw Error(`Not a ZodError: ${_}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,A0.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(_=(z)=>z.message){let z={},A=[];for(let G of this.issues)if(G.path.length>0){let J=G.path[0];z[J]=z[J]||[],z[J].push(_(G))}else A.push(_(G));return{formErrors:A,fieldErrors:z}}get formErrors(){return this.flatten()}}b9.create=(_)=>{return new b9(_)};var Ww=(_,z)=>{let A;switch(_.code){case R.invalid_type:if(_.received===I.undefined)A="Required";else A=`Expected ${_.expected}, received ${_.received}`;break;case R.invalid_literal:A=`Invalid literal value, expected ${JSON.stringify(_.expected,A0.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:A=`Unrecognized key(s) in object: ${A0.joinValues(_.keys,", ")}`;break;case R.invalid_union:A="Invalid input";break;case R.invalid_union_discriminator:A=`Invalid discriminator value. Expected ${A0.joinValues(_.options)}`;break;case R.invalid_enum_value:A=`Invalid enum value. Expected ${A0.joinValues(_.options)}, received '${_.received}'`;break;case R.invalid_arguments:A="Invalid function arguments";break;case R.invalid_return_type:A="Invalid function return type";break;case R.invalid_date:A="Invalid date";break;case R.invalid_string:if(typeof _.validation==="object")if("includes"in _.validation){if(A=`Invalid input: must include "${_.validation.includes}"`,typeof _.validation.position==="number")A=`${A} at one or more positions greater than or equal to ${_.validation.position}`}else if("startsWith"in _.validation)A=`Invalid input: must start with "${_.validation.startsWith}"`;else if("endsWith"in _.validation)A=`Invalid input: must end with "${_.validation.endsWith}"`;else A0.assertNever(_.validation);else if(_.validation!=="regex")A=`Invalid ${_.validation}`;else A="Invalid";break;case R.too_small:if(_.type==="array")A=`Array must contain ${_.exact?"exactly":_.inclusive?"at least":"more than"} ${_.minimum} element(s)`;else if(_.type==="string")A=`String must contain ${_.exact?"exactly":_.inclusive?"at least":"over"} ${_.minimum} character(s)`;else if(_.type==="number")A=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`;else if(_.type==="bigint")A=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`;else if(_.type==="date")A=`Date must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(_.minimum))}`;else A="Invalid input";break;case R.too_big:if(_.type==="array")A=`Array must contain ${_.exact?"exactly":_.inclusive?"at most":"less than"} ${_.maximum} element(s)`;else if(_.type==="string")A=`String must contain ${_.exact?"exactly":_.inclusive?"at most":"under"} ${_.maximum} character(s)`;else if(_.type==="number")A=`Number must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`;else if(_.type==="bigint")A=`BigInt must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`;else if(_.type==="date")A=`Date must be ${_.exact?"exactly":_.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(_.maximum))}`;else A="Invalid input";break;case R.custom:A="Invalid input";break;case R.invalid_intersection_types:A="Intersection results could not be merged";break;case R.not_multiple_of:A=`Number must be a multiple of ${_.multipleOf}`;break;case R.not_finite:A="Number must be finite";break;default:A=z.defaultError,A0.assertNever(_)}return{message:A}},N4=Ww;var gX=N4;function Vw(_){gX=_}function J1(){return gX}var Uz=(_)=>{let{data:z,path:A,errorMaps:G,issueData:J}=_,Y=[...A,...J.path||[]],X={...J,path:Y};if(J.message!==void 0)return{...J,path:Y,message:J.message};let b="",Q=G.filter(($)=>!!$).slice().reverse();for(let $ of Q)b=$(X,{data:z,defaultError:b}).message;return{...J,path:Y,message:b}},Uw=[];function T(_,z){let A=J1(),G=Uz({issueData:z,data:_.data,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,A,A===N4?void 0:N4].filter((J)=>!!J)});_.common.issues.push(G)}class m0{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(_,z){let A=[];for(let G of z){if(G.status==="aborted")return l;if(G.status==="dirty")_.dirty();A.push(G.value)}return{status:_.value,value:A}}static async mergeObjectAsync(_,z){let A=[];for(let G of z){let J=await G.key,Y=await G.value;A.push({key:J,value:Y})}return m0.mergeObjectSync(_,A)}static mergeObjectSync(_,z){let A={};for(let G of z){let{key:J,value:Y}=G;if(J.status==="aborted")return l;if(Y.status==="aborted")return l;if(J.status==="dirty")_.dirty();if(Y.status==="dirty")_.dirty();if(J.value!=="__proto__"&&(typeof Y.value<"u"||G.alwaysSet))A[J.value]=Y.value}return{status:_.value,value:A}}}var l=Object.freeze({status:"aborted"}),R_=(_)=>({status:"dirty",value:_}),a0=(_)=>({status:"valid",value:_}),Y6=(_)=>_.status==="aborted",X6=(_)=>_.status==="dirty",s4=(_)=>_.status==="valid",Y1=(_)=>typeof Promise<"u"&&_ instanceof Promise;var y;(function(_){_.errToObj=(z)=>typeof z==="string"?{message:z}:z||{},_.toString=(z)=>typeof z==="string"?z:z?.message})(y||(y={}));class c9{constructor(_,z,A,G){this._cachedPath=[],this.parent=_,this.data=z,this._path=A,this._key=G}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 fX=(_,z)=>{if(s4(z))return{success:!0,data:z.value};else{if(!_.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let A=new b9(_.common.issues);return this._error=A,this._error}}}};function a(_){if(!_)return{};let{errorMap:z,invalid_type_error:A,required_error:G,description:J}=_;if(z&&(A||G))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(z)return{errorMap:z,description:J};return{errorMap:(X,b)=>{let{message:Q}=_;if(X.code==="invalid_enum_value")return{message:Q??b.defaultError};if(typeof b.data>"u")return{message:Q??G??b.defaultError};if(X.code!=="invalid_type")return{message:b.defaultError};return{message:Q??A??b.defaultError}},description:J}}class _0{get description(){return this._def.description}_getType(_){return J4(_.data)}_getOrReturnCtx(_,z){return z||{common:_.parent.common,data:_.data,parsedType:J4(_.data),schemaErrorMap:this._def.errorMap,path:_.path,parent:_.parent}}_processInputParams(_){return{status:new m0,ctx:{common:_.parent.common,data:_.data,parsedType:J4(_.data),schemaErrorMap:this._def.errorMap,path:_.path,parent:_.parent}}}_parseSync(_){let z=this._parse(_);if(Y1(z))throw Error("Synchronous parse encountered promise.");return z}_parseAsync(_){let z=this._parse(_);return Promise.resolve(z)}parse(_,z){let A=this.safeParse(_,z);if(A.success)return A.data;throw A.error}safeParse(_,z){let A={common:{issues:[],async:z?.async??!1,contextualErrorMap:z?.errorMap},path:z?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:J4(_)},G=this._parseSync({data:_,path:A.path,parent:A});return fX(A,G)}"~validate"(_){let z={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:J4(_)};if(!this["~standard"].async)try{let A=this._parseSync({data:_,path:[],parent:z});return s4(A)?{value:A.value}:{issues:z.common.issues}}catch(A){if(A?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;z.common={issues:[],async:!0}}return this._parseAsync({data:_,path:[],parent:z}).then((A)=>s4(A)?{value:A.value}:{issues:z.common.issues})}async parseAsync(_,z){let A=await this.safeParseAsync(_,z);if(A.success)return A.data;throw A.error}async safeParseAsync(_,z){let A={common:{issues:[],contextualErrorMap:z?.errorMap,async:!0},path:z?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:J4(_)},G=this._parse({data:_,path:A.path,parent:A}),J=await(Y1(G)?G:Promise.resolve(G));return fX(A,J)}refine(_,z){let A=(G)=>{if(typeof z==="string"||typeof z>"u")return{message:z};else if(typeof z==="function")return z(G);else return z};return this._refinement((G,J)=>{let Y=_(G),X=()=>J.addIssue({code:R.custom,...A(G)});if(typeof Promise<"u"&&Y instanceof Promise)return Y.then((b)=>{if(!b)return X(),!1;else return!0});if(!Y)return X(),!1;else return!0})}refinement(_,z){return this._refinement((A,G)=>{if(!_(A))return G.addIssue(typeof z==="function"?z(A,G):z),!1;else return!0})}_refinement(_){return new l9({schema:this,typeName:p.ZodEffects,effect:{type:"refinement",refinement:_}})}superRefine(_){return this._refinement(_)}constructor(_){this.spa=this.safeParseAsync,this._def=_,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:(z)=>this["~validate"](z)}}optional(){return u9.create(this,this._def)}nullable(){return w4.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return m9.create(this)}promise(){return I_.create(this,this._def)}or(_){return B1.create([this,_],this._def)}and(_){return Z1.create(this,_,this._def)}transform(_){return new l9({...a(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:_}})}default(_){let z=typeof _==="function"?_:()=>_;return new W1({...a(this._def),innerType:this,defaultValue:z,typeName:p.ZodDefault})}brand(){return new Q6({typeName:p.ZodBranded,type:this,...a(this._def)})}catch(_){let z=typeof _==="function"?_:()=>_;return new V1({...a(this._def),innerType:this,catchValue:z,typeName:p.ZodCatch})}describe(_){return new this.constructor({...this._def,description:_})}pipe(_){return Oz.create(this,_)}readonly(){return U1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var Dw=/^c[^\s-]{8,}$/i,Mw=/^[0-9a-z]+$/,Nw=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ew=/^[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,ww=/^[a-z0-9_-]{21}$/i,Ow=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Lw=/^[-+]?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)?)??$/,jw=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Rw="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",D5,Pw=/^(?:(?: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])$/,Sw=/^(?:(?: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])$/,kw=/^(([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]))$/,Iw=/^(([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])$/,xw=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Tw=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mX="((\\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])))",Cw=new RegExp(`^${mX}$`);function uX(_){let z="[0-5]\\d";if(_.precision)z=`${z}\\.\\d{${_.precision}}`;else if(_.precision==null)z=`${z}(\\.\\d+)?`;let A=_.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${z})${A}`}function vw(_){return new RegExp(`^${uX(_)}$`)}function cX(_){let z=`${mX}T${uX(_)}`,A=[];if(A.push(_.local?"Z?":"Z"),_.offset)A.push("([+-]\\d{2}:?\\d{2})");return z=`${z}(${A.join("|")})`,new RegExp(`^${z}$`)}function yw(_,z){if((z==="v4"||!z)&&Pw.test(_))return!0;if((z==="v6"||!z)&&kw.test(_))return!0;return!1}function gw(_,z){if(!Ow.test(_))return!1;try{let[A]=_.split(".");if(!A)return!1;let G=A.replace(/-/g,"+").replace(/_/g,"/").padEnd(A.length+(4-A.length%4)%4,"="),J=JSON.parse(atob(G));if(typeof J!=="object"||J===null)return!1;if("typ"in J&&J?.typ!=="JWT")return!1;if(!J.alg)return!1;if(z&&J.alg!==z)return!1;return!0}catch{return!1}}function fw(_,z){if((z==="v4"||!z)&&Sw.test(_))return!0;if((z==="v6"||!z)&&Iw.test(_))return!0;return!1}class h9 extends _0{_parse(_){if(this._def.coerce)_.data=String(_.data);if(this._getType(_)!==I.string){let J=this._getOrReturnCtx(_);return T(J,{code:R.invalid_type,expected:I.string,received:J.parsedType}),l}let A=new m0,G=void 0;for(let J of this._def.checks)if(J.kind==="min"){if(_.data.length<J.value)G=this._getOrReturnCtx(_,G),T(G,{code:R.too_small,minimum:J.value,type:"string",inclusive:!0,exact:!1,message:J.message}),A.dirty()}else if(J.kind==="max"){if(_.data.length>J.value)G=this._getOrReturnCtx(_,G),T(G,{code:R.too_big,maximum:J.value,type:"string",inclusive:!0,exact:!1,message:J.message}),A.dirty()}else if(J.kind==="length"){let Y=_.data.length>J.value,X=_.data.length<J.value;if(Y||X){if(G=this._getOrReturnCtx(_,G),Y)T(G,{code:R.too_big,maximum:J.value,type:"string",inclusive:!0,exact:!0,message:J.message});else if(X)T(G,{code:R.too_small,minimum:J.value,type:"string",inclusive:!0,exact:!0,message:J.message});A.dirty()}}else if(J.kind==="email"){if(!jw.test(_.data))G=this._getOrReturnCtx(_,G),T(G,{validation:"email",code:R.invalid_string,message:J.message}),A.dirty()}else if(J.kind==="emoji"){if(!D5)D5=new RegExp(Rw,"u");if(!D5.test(_.data))G=this._getOrReturnCtx(_,G),T(G,{validation:"emoji",code:R.invalid_string,message:J.message}),A.dirty()}else if(J.kind==="uuid"){if(!Ew.test(_.data))G=this._getOrReturnCtx(_,G),T(G,{validation:"uuid",code:R.invalid_string,message:J.message}),A.dirty()}else if(J.kind==="nanoid"){if(!ww.test(_.data))G=this._getOrReturnCtx(_,G),T(G,{validation:"nanoid",code:R.invalid_string,message:J.message}),A.dirty()}else if(J.kind==="cuid"){if(!Dw.test(_.data))G=this._getOrReturnCtx(_,G),T(G,{validation:"cuid",code:R.invalid_string,message:J.message}),A.dirty()}else if(J.kind==="cuid2"){if(!Mw.test(_.data))G=this._getOrReturnCtx(_,G),T(G,{validation:"cuid2",code:R.invalid_string,message:J.message}),A.dirty()}else if(J.kind==="ulid"){if(!Nw.test(_.data))G=this._getOrReturnCtx(_,G),T(G,{validation:"ulid",code:R.invalid_string,message:J.message}),A.dirty()}else if(J.kind==="url")try{new URL(_.data)}catch{G=this._getOrReturnCtx(_,G),T(G,{validation:"url",code:R.invalid_string,message:J.message}),A.dirty()}else if(J.kind==="regex"){if(J.regex.lastIndex=0,!J.regex.test(_.data))G=this._getOrReturnCtx(_,G),T(G,{validation:"regex",code:R.invalid_string,message:J.message}),A.dirty()}else if(J.kind==="trim")_.data=_.data.trim();else if(J.kind==="includes"){if(!_.data.includes(J.value,J.position))G=this._getOrReturnCtx(_,G),T(G,{code:R.invalid_string,validation:{includes:J.value,position:J.position},message:J.message}),A.dirty()}else if(J.kind==="toLowerCase")_.data=_.data.toLowerCase();else if(J.kind==="toUpperCase")_.data=_.data.toUpperCase();else if(J.kind==="startsWith"){if(!_.data.startsWith(J.value))G=this._getOrReturnCtx(_,G),T(G,{code:R.invalid_string,validation:{startsWith:J.value},message:J.message}),A.dirty()}else if(J.kind==="endsWith"){if(!_.data.endsWith(J.value))G=this._getOrReturnCtx(_,G),T(G,{code:R.invalid_string,validation:{endsWith:J.value},message:J.message}),A.dirty()}else if(J.kind==="datetime"){if(!cX(J).test(_.data))G=this._getOrReturnCtx(_,G),T(G,{code:R.invalid_string,validation:"datetime",message:J.message}),A.dirty()}else if(J.kind==="date"){if(!Cw.test(_.data))G=this._getOrReturnCtx(_,G),T(G,{code:R.invalid_string,validation:"date",message:J.message}),A.dirty()}else if(J.kind==="time"){if(!vw(J).test(_.data))G=this._getOrReturnCtx(_,G),T(G,{code:R.invalid_string,validation:"time",message:J.message}),A.dirty()}else if(J.kind==="duration"){if(!Lw.test(_.data))G=this._getOrReturnCtx(_,G),T(G,{validation:"duration",code:R.invalid_string,message:J.message}),A.dirty()}else if(J.kind==="ip"){if(!yw(_.data,J.version))G=this._getOrReturnCtx(_,G),T(G,{validation:"ip",code:R.invalid_string,message:J.message}),A.dirty()}else if(J.kind==="jwt"){if(!gw(_.data,J.alg))G=this._getOrReturnCtx(_,G),T(G,{validation:"jwt",code:R.invalid_string,message:J.message}),A.dirty()}else if(J.kind==="cidr"){if(!fw(_.data,J.version))G=this._getOrReturnCtx(_,G),T(G,{validation:"cidr",code:R.invalid_string,message:J.message}),A.dirty()}else if(J.kind==="base64"){if(!xw.test(_.data))G=this._getOrReturnCtx(_,G),T(G,{validation:"base64",code:R.invalid_string,message:J.message}),A.dirty()}else if(J.kind==="base64url"){if(!Tw.test(_.data))G=this._getOrReturnCtx(_,G),T(G,{validation:"base64url",code:R.invalid_string,message:J.message}),A.dirty()}else A0.assertNever(J);return{status:A.value,value:_.data}}_regex(_,z,A){return this.refinement((G)=>_.test(G),{validation:z,code:R.invalid_string,...y.errToObj(A)})}_addCheck(_){return new h9({...this._def,checks:[...this._def.checks,_]})}email(_){return this._addCheck({kind:"email",...y.errToObj(_)})}url(_){return this._addCheck({kind:"url",...y.errToObj(_)})}emoji(_){return this._addCheck({kind:"emoji",...y.errToObj(_)})}uuid(_){return this._addCheck({kind:"uuid",...y.errToObj(_)})}nanoid(_){return this._addCheck({kind:"nanoid",...y.errToObj(_)})}cuid(_){return this._addCheck({kind:"cuid",...y.errToObj(_)})}cuid2(_){return this._addCheck({kind:"cuid2",...y.errToObj(_)})}ulid(_){return this._addCheck({kind:"ulid",...y.errToObj(_)})}base64(_){return this._addCheck({kind:"base64",...y.errToObj(_)})}base64url(_){return this._addCheck({kind:"base64url",...y.errToObj(_)})}jwt(_){return this._addCheck({kind:"jwt",...y.errToObj(_)})}ip(_){return this._addCheck({kind:"ip",...y.errToObj(_)})}cidr(_){return this._addCheck({kind:"cidr",...y.errToObj(_)})}datetime(_){if(typeof _==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:_});return this._addCheck({kind:"datetime",precision:typeof _?.precision>"u"?null:_?.precision,offset:_?.offset??!1,local:_?.local??!1,...y.errToObj(_?.message)})}date(_){return this._addCheck({kind:"date",message:_})}time(_){if(typeof _==="string")return this._addCheck({kind:"time",precision:null,message:_});return this._addCheck({kind:"time",precision:typeof _?.precision>"u"?null:_?.precision,...y.errToObj(_?.message)})}duration(_){return this._addCheck({kind:"duration",...y.errToObj(_)})}regex(_,z){return this._addCheck({kind:"regex",regex:_,...y.errToObj(z)})}includes(_,z){return this._addCheck({kind:"includes",value:_,position:z?.position,...y.errToObj(z?.message)})}startsWith(_,z){return this._addCheck({kind:"startsWith",value:_,...y.errToObj(z)})}endsWith(_,z){return this._addCheck({kind:"endsWith",value:_,...y.errToObj(z)})}min(_,z){return this._addCheck({kind:"min",value:_,...y.errToObj(z)})}max(_,z){return this._addCheck({kind:"max",value:_,...y.errToObj(z)})}length(_,z){return this._addCheck({kind:"length",value:_,...y.errToObj(z)})}nonempty(_){return this.min(1,y.errToObj(_))}trim(){return new h9({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new h9({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new h9({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((_)=>_.kind==="datetime")}get isDate(){return!!this._def.checks.find((_)=>_.kind==="date")}get isTime(){return!!this._def.checks.find((_)=>_.kind==="time")}get isDuration(){return!!this._def.checks.find((_)=>_.kind==="duration")}get isEmail(){return!!this._def.checks.find((_)=>_.kind==="email")}get isURL(){return!!this._def.checks.find((_)=>_.kind==="url")}get isEmoji(){return!!this._def.checks.find((_)=>_.kind==="emoji")}get isUUID(){return!!this._def.checks.find((_)=>_.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((_)=>_.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((_)=>_.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((_)=>_.kind==="cuid2")}get isULID(){return!!this._def.checks.find((_)=>_.kind==="ulid")}get isIP(){return!!this._def.checks.find((_)=>_.kind==="ip")}get isCIDR(){return!!this._def.checks.find((_)=>_.kind==="cidr")}get isBase64(){return!!this._def.checks.find((_)=>_.kind==="base64")}get isBase64url(){return!!this._def.checks.find((_)=>_.kind==="base64url")}get minLength(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _}get maxLength(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _}}h9.create=(_)=>{return new h9({checks:[],typeName:p.ZodString,coerce:_?.coerce??!1,...a(_)})};function hw(_,z){let A=(_.toString().split(".")[1]||"").length,G=(z.toString().split(".")[1]||"").length,J=A>G?A:G,Y=Number.parseInt(_.toFixed(J).replace(".","")),X=Number.parseInt(z.toFixed(J).replace(".",""));return Y%X/10**J}class e4 extends _0{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(_){if(this._def.coerce)_.data=Number(_.data);if(this._getType(_)!==I.number){let J=this._getOrReturnCtx(_);return T(J,{code:R.invalid_type,expected:I.number,received:J.parsedType}),l}let A=void 0,G=new m0;for(let J of this._def.checks)if(J.kind==="int"){if(!A0.isInteger(_.data))A=this._getOrReturnCtx(_,A),T(A,{code:R.invalid_type,expected:"integer",received:"float",message:J.message}),G.dirty()}else if(J.kind==="min"){if(J.inclusive?_.data<J.value:_.data<=J.value)A=this._getOrReturnCtx(_,A),T(A,{code:R.too_small,minimum:J.value,type:"number",inclusive:J.inclusive,exact:!1,message:J.message}),G.dirty()}else if(J.kind==="max"){if(J.inclusive?_.data>J.value:_.data>=J.value)A=this._getOrReturnCtx(_,A),T(A,{code:R.too_big,maximum:J.value,type:"number",inclusive:J.inclusive,exact:!1,message:J.message}),G.dirty()}else if(J.kind==="multipleOf"){if(hw(_.data,J.value)!==0)A=this._getOrReturnCtx(_,A),T(A,{code:R.not_multiple_of,multipleOf:J.value,message:J.message}),G.dirty()}else if(J.kind==="finite"){if(!Number.isFinite(_.data))A=this._getOrReturnCtx(_,A),T(A,{code:R.not_finite,message:J.message}),G.dirty()}else A0.assertNever(J);return{status:G.value,value:_.data}}gte(_,z){return this.setLimit("min",_,!0,y.toString(z))}gt(_,z){return this.setLimit("min",_,!1,y.toString(z))}lte(_,z){return this.setLimit("max",_,!0,y.toString(z))}lt(_,z){return this.setLimit("max",_,!1,y.toString(z))}setLimit(_,z,A,G){return new e4({...this._def,checks:[...this._def.checks,{kind:_,value:z,inclusive:A,message:y.toString(G)}]})}_addCheck(_){return new e4({...this._def,checks:[...this._def.checks,_]})}int(_){return this._addCheck({kind:"int",message:y.toString(_)})}positive(_){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(_)})}negative(_){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(_)})}nonpositive(_){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(_)})}nonnegative(_){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(_)})}multipleOf(_,z){return this._addCheck({kind:"multipleOf",value:_,message:y.toString(z)})}finite(_){return this._addCheck({kind:"finite",message:y.toString(_)})}safe(_){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(_)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(_)})}get minValue(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _}get maxValue(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _}get isInt(){return!!this._def.checks.find((_)=>_.kind==="int"||_.kind==="multipleOf"&&A0.isInteger(_.value))}get isFinite(){let _=null,z=null;for(let A of this._def.checks)if(A.kind==="finite"||A.kind==="int"||A.kind==="multipleOf")return!0;else if(A.kind==="min"){if(z===null||A.value>z)z=A.value}else if(A.kind==="max"){if(_===null||A.value<_)_=A.value}return Number.isFinite(z)&&Number.isFinite(_)}}e4.create=(_)=>{return new e4({checks:[],typeName:p.ZodNumber,coerce:_?.coerce||!1,...a(_)})};class __ extends _0{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(_){if(this._def.coerce)try{_.data=BigInt(_.data)}catch{return this._getInvalidInput(_)}if(this._getType(_)!==I.bigint)return this._getInvalidInput(_);let A=void 0,G=new m0;for(let J of this._def.checks)if(J.kind==="min"){if(J.inclusive?_.data<J.value:_.data<=J.value)A=this._getOrReturnCtx(_,A),T(A,{code:R.too_small,type:"bigint",minimum:J.value,inclusive:J.inclusive,message:J.message}),G.dirty()}else if(J.kind==="max"){if(J.inclusive?_.data>J.value:_.data>=J.value)A=this._getOrReturnCtx(_,A),T(A,{code:R.too_big,type:"bigint",maximum:J.value,inclusive:J.inclusive,message:J.message}),G.dirty()}else if(J.kind==="multipleOf"){if(_.data%J.value!==BigInt(0))A=this._getOrReturnCtx(_,A),T(A,{code:R.not_multiple_of,multipleOf:J.value,message:J.message}),G.dirty()}else A0.assertNever(J);return{status:G.value,value:_.data}}_getInvalidInput(_){let z=this._getOrReturnCtx(_);return T(z,{code:R.invalid_type,expected:I.bigint,received:z.parsedType}),l}gte(_,z){return this.setLimit("min",_,!0,y.toString(z))}gt(_,z){return this.setLimit("min",_,!1,y.toString(z))}lte(_,z){return this.setLimit("max",_,!0,y.toString(z))}lt(_,z){return this.setLimit("max",_,!1,y.toString(z))}setLimit(_,z,A,G){return new __({...this._def,checks:[...this._def.checks,{kind:_,value:z,inclusive:A,message:y.toString(G)}]})}_addCheck(_){return new __({...this._def,checks:[...this._def.checks,_]})}positive(_){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(_)})}negative(_){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(_)})}nonpositive(_){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(_)})}nonnegative(_){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(_)})}multipleOf(_,z){return this._addCheck({kind:"multipleOf",value:_,message:y.toString(z)})}get minValue(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _}get maxValue(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _}}__.create=(_)=>{return new __({checks:[],typeName:p.ZodBigInt,coerce:_?.coerce??!1,...a(_)})};class Q1 extends _0{_parse(_){if(this._def.coerce)_.data=Boolean(_.data);if(this._getType(_)!==I.boolean){let A=this._getOrReturnCtx(_);return T(A,{code:R.invalid_type,expected:I.boolean,received:A.parsedType}),l}return a0(_.data)}}Q1.create=(_)=>{return new Q1({typeName:p.ZodBoolean,coerce:_?.coerce||!1,...a(_)})};class P_ extends _0{_parse(_){if(this._def.coerce)_.data=new Date(_.data);if(this._getType(_)!==I.date){let J=this._getOrReturnCtx(_);return T(J,{code:R.invalid_type,expected:I.date,received:J.parsedType}),l}if(Number.isNaN(_.data.getTime())){let J=this._getOrReturnCtx(_);return T(J,{code:R.invalid_date}),l}let A=new m0,G=void 0;for(let J of this._def.checks)if(J.kind==="min"){if(_.data.getTime()<J.value)G=this._getOrReturnCtx(_,G),T(G,{code:R.too_small,message:J.message,inclusive:!0,exact:!1,minimum:J.value,type:"date"}),A.dirty()}else if(J.kind==="max"){if(_.data.getTime()>J.value)G=this._getOrReturnCtx(_,G),T(G,{code:R.too_big,message:J.message,inclusive:!0,exact:!1,maximum:J.value,type:"date"}),A.dirty()}else A0.assertNever(J);return{status:A.value,value:new Date(_.data.getTime())}}_addCheck(_){return new P_({...this._def,checks:[...this._def.checks,_]})}min(_,z){return this._addCheck({kind:"min",value:_.getTime(),message:y.toString(z)})}max(_,z){return this._addCheck({kind:"max",value:_.getTime(),message:y.toString(z)})}get minDate(){let _=null;for(let z of this._def.checks)if(z.kind==="min"){if(_===null||z.value>_)_=z.value}return _!=null?new Date(_):null}get maxDate(){let _=null;for(let z of this._def.checks)if(z.kind==="max"){if(_===null||z.value<_)_=z.value}return _!=null?new Date(_):null}}P_.create=(_)=>{return new P_({checks:[],coerce:_?.coerce||!1,typeName:p.ZodDate,...a(_)})};class Dz extends _0{_parse(_){if(this._getType(_)!==I.symbol){let A=this._getOrReturnCtx(_);return T(A,{code:R.invalid_type,expected:I.symbol,received:A.parsedType}),l}return a0(_.data)}}Dz.create=(_)=>{return new Dz({typeName:p.ZodSymbol,...a(_)})};class $1 extends _0{_parse(_){if(this._getType(_)!==I.undefined){let A=this._getOrReturnCtx(_);return T(A,{code:R.invalid_type,expected:I.undefined,received:A.parsedType}),l}return a0(_.data)}}$1.create=(_)=>{return new $1({typeName:p.ZodUndefined,...a(_)})};class H1 extends _0{_parse(_){if(this._getType(_)!==I.null){let A=this._getOrReturnCtx(_);return T(A,{code:R.invalid_type,expected:I.null,received:A.parsedType}),l}return a0(_.data)}}H1.create=(_)=>{return new H1({typeName:p.ZodNull,...a(_)})};class S_ extends _0{constructor(){super(...arguments);this._any=!0}_parse(_){return a0(_.data)}}S_.create=(_)=>{return new S_({typeName:p.ZodAny,...a(_)})};class t4 extends _0{constructor(){super(...arguments);this._unknown=!0}_parse(_){return a0(_.data)}}t4.create=(_)=>{return new t4({typeName:p.ZodUnknown,...a(_)})};class Y4 extends _0{_parse(_){let z=this._getOrReturnCtx(_);return T(z,{code:R.invalid_type,expected:I.never,received:z.parsedType}),l}}Y4.create=(_)=>{return new Y4({typeName:p.ZodNever,...a(_)})};class Mz extends _0{_parse(_){if(this._getType(_)!==I.undefined){let A=this._getOrReturnCtx(_);return T(A,{code:R.invalid_type,expected:I.void,received:A.parsedType}),l}return a0(_.data)}}Mz.create=(_)=>{return new Mz({typeName:p.ZodVoid,...a(_)})};class m9 extends _0{_parse(_){let{ctx:z,status:A}=this._processInputParams(_),G=this._def;if(z.parsedType!==I.array)return T(z,{code:R.invalid_type,expected:I.array,received:z.parsedType}),l;if(G.exactLength!==null){let Y=z.data.length>G.exactLength.value,X=z.data.length<G.exactLength.value;if(Y||X)T(z,{code:Y?R.too_big:R.too_small,minimum:X?G.exactLength.value:void 0,maximum:Y?G.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:G.exactLength.message}),A.dirty()}if(G.minLength!==null){if(z.data.length<G.minLength.value)T(z,{code:R.too_small,minimum:G.minLength.value,type:"array",inclusive:!0,exact:!1,message:G.minLength.message}),A.dirty()}if(G.maxLength!==null){if(z.data.length>G.maxLength.value)T(z,{code:R.too_big,maximum:G.maxLength.value,type:"array",inclusive:!0,exact:!1,message:G.maxLength.message}),A.dirty()}if(z.common.async)return Promise.all([...z.data].map((Y,X)=>{return G.type._parseAsync(new c9(z,Y,z.path,X))})).then((Y)=>{return m0.mergeArray(A,Y)});let J=[...z.data].map((Y,X)=>{return G.type._parseSync(new c9(z,Y,z.path,X))});return m0.mergeArray(A,J)}get element(){return this._def.type}min(_,z){return new m9({...this._def,minLength:{value:_,message:y.toString(z)}})}max(_,z){return new m9({...this._def,maxLength:{value:_,message:y.toString(z)}})}length(_,z){return new m9({...this._def,exactLength:{value:_,message:y.toString(z)}})}nonempty(_){return this.min(1,_)}}m9.create=(_,z)=>{return new m9({type:_,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,...a(z)})};function X1(_){if(_ instanceof S0){let z={};for(let A in _.shape){let G=_.shape[A];z[A]=u9.create(X1(G))}return new S0({..._._def,shape:()=>z})}else if(_ instanceof m9)return new m9({..._._def,type:X1(_.element)});else if(_ instanceof u9)return u9.create(X1(_.unwrap()));else if(_ instanceof w4)return w4.create(X1(_.unwrap()));else if(_ instanceof X4)return X4.create(_.items.map((z)=>X1(z)));else return _}class S0 extends _0{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let _=this._def.shape(),z=A0.objectKeys(_);return this._cached={shape:_,keys:z},this._cached}_parse(_){if(this._getType(_)!==I.object){let Q=this._getOrReturnCtx(_);return T(Q,{code:R.invalid_type,expected:I.object,received:Q.parsedType}),l}let{status:A,ctx:G}=this._processInputParams(_),{shape:J,keys:Y}=this._getCached(),X=[];if(!(this._def.catchall instanceof Y4&&this._def.unknownKeys==="strip")){for(let Q in G.data)if(!Y.includes(Q))X.push(Q)}let b=[];for(let Q of Y){let $=J[Q],H=G.data[Q];b.push({key:{status:"valid",value:Q},value:$._parse(new c9(G,H,G.path,Q)),alwaysSet:Q in G.data})}if(this._def.catchall instanceof Y4){let Q=this._def.unknownKeys;if(Q==="passthrough")for(let $ of X)b.push({key:{status:"valid",value:$},value:{status:"valid",value:G.data[$]}});else if(Q==="strict"){if(X.length>0)T(G,{code:R.unrecognized_keys,keys:X}),A.dirty()}else if(Q==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let Q=this._def.catchall;for(let $ of X){let H=G.data[$];b.push({key:{status:"valid",value:$},value:Q._parse(new c9(G,H,G.path,$)),alwaysSet:$ in G.data})}}if(G.common.async)return Promise.resolve().then(async()=>{let Q=[];for(let $ of b){let H=await $.key,B=await $.value;Q.push({key:H,value:B,alwaysSet:$.alwaysSet})}return Q}).then((Q)=>{return m0.mergeObjectSync(A,Q)});else return m0.mergeObjectSync(A,b)}get shape(){return this._def.shape()}strict(_){return y.errToObj,new S0({...this._def,unknownKeys:"strict",..._!==void 0?{errorMap:(z,A)=>{let G=this._def.errorMap?.(z,A).message??A.defaultError;if(z.code==="unrecognized_keys")return{message:y.errToObj(_).message??G};return{message:G}}}:{}})}strip(){return new S0({...this._def,unknownKeys:"strip"})}passthrough(){return new S0({...this._def,unknownKeys:"passthrough"})}extend(_){return new S0({...this._def,shape:()=>({...this._def.shape(),..._})})}merge(_){return new S0({unknownKeys:_._def.unknownKeys,catchall:_._def.catchall,shape:()=>({...this._def.shape(),..._._def.shape()}),typeName:p.ZodObject})}setKey(_,z){return this.augment({[_]:z})}catchall(_){return new S0({...this._def,catchall:_})}pick(_){let z={};for(let A of A0.objectKeys(_))if(_[A]&&this.shape[A])z[A]=this.shape[A];return new S0({...this._def,shape:()=>z})}omit(_){let z={};for(let A of A0.objectKeys(this.shape))if(!_[A])z[A]=this.shape[A];return new S0({...this._def,shape:()=>z})}deepPartial(){return X1(this)}partial(_){let z={};for(let A of A0.objectKeys(this.shape)){let G=this.shape[A];if(_&&!_[A])z[A]=G;else z[A]=G.optional()}return new S0({...this._def,shape:()=>z})}required(_){let z={};for(let A of A0.objectKeys(this.shape))if(_&&!_[A])z[A]=this.shape[A];else{let J=this.shape[A];while(J instanceof u9)J=J._def.innerType;z[A]=J}return new S0({...this._def,shape:()=>z})}keyof(){return lX(A0.objectKeys(this.shape))}}S0.create=(_,z)=>{return new S0({shape:()=>_,unknownKeys:"strip",catchall:Y4.create(),typeName:p.ZodObject,...a(z)})};S0.strictCreate=(_,z)=>{return new S0({shape:()=>_,unknownKeys:"strict",catchall:Y4.create(),typeName:p.ZodObject,...a(z)})};S0.lazycreate=(_,z)=>{return new S0({shape:_,unknownKeys:"strip",catchall:Y4.create(),typeName:p.ZodObject,...a(z)})};class B1 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A=this._def.options;function G(J){for(let X of J)if(X.result.status==="valid")return X.result;for(let X of J)if(X.result.status==="dirty")return z.common.issues.push(...X.ctx.common.issues),X.result;let Y=J.map((X)=>new b9(X.ctx.common.issues));return T(z,{code:R.invalid_union,unionErrors:Y}),l}if(z.common.async)return Promise.all(A.map(async(J)=>{let Y={...z,common:{...z.common,issues:[]},parent:null};return{result:await J._parseAsync({data:z.data,path:z.path,parent:Y}),ctx:Y}})).then(G);else{let J=void 0,Y=[];for(let b of A){let Q={...z,common:{...z.common,issues:[]},parent:null},$=b._parseSync({data:z.data,path:z.path,parent:Q});if($.status==="valid")return $;else if($.status==="dirty"&&!J)J={result:$,ctx:Q};if(Q.common.issues.length)Y.push(Q.common.issues)}if(J)return z.common.issues.push(...J.ctx.common.issues),J.result;let X=Y.map((b)=>new b9(b));return T(z,{code:R.invalid_union,unionErrors:X}),l}}get options(){return this._def.options}}B1.create=(_,z)=>{return new B1({options:_,typeName:p.ZodUnion,...a(z)})};var E4=(_)=>{if(_ instanceof q1)return E4(_.schema);else if(_ instanceof l9)return E4(_.innerType());else if(_ instanceof F1)return[_.value];else if(_ instanceof z_)return _.options;else if(_ instanceof K1)return A0.objectValues(_.enum);else if(_ instanceof W1)return E4(_._def.innerType);else if(_ instanceof $1)return[void 0];else if(_ instanceof H1)return[null];else if(_ instanceof u9)return[void 0,...E4(_.unwrap())];else if(_ instanceof w4)return[null,...E4(_.unwrap())];else if(_ instanceof Q6)return E4(_.unwrap());else if(_ instanceof U1)return E4(_.unwrap());else if(_ instanceof V1)return E4(_._def.innerType);else return[]};class b6 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_);if(z.parsedType!==I.object)return T(z,{code:R.invalid_type,expected:I.object,received:z.parsedType}),l;let A=this.discriminator,G=z.data[A],J=this.optionsMap.get(G);if(!J)return T(z,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[A]}),l;if(z.common.async)return J._parseAsync({data:z.data,path:z.path,parent:z});else return J._parseSync({data:z.data,path:z.path,parent:z})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(_,z,A){let G=new Map;for(let J of z){let Y=E4(J.shape[_]);if(!Y.length)throw Error(`A discriminator value for key \`${_}\` could not be extracted from all schema options`);for(let X of Y){if(G.has(X))throw Error(`Discriminator property ${String(_)} has duplicate value ${String(X)}`);G.set(X,J)}}return new b6({typeName:p.ZodDiscriminatedUnion,discriminator:_,options:z,optionsMap:G,...a(A)})}}function M5(_,z){let A=J4(_),G=J4(z);if(_===z)return{valid:!0,data:_};else if(A===I.object&&G===I.object){let J=A0.objectKeys(z),Y=A0.objectKeys(_).filter((b)=>J.indexOf(b)!==-1),X={..._,...z};for(let b of Y){let Q=M5(_[b],z[b]);if(!Q.valid)return{valid:!1};X[b]=Q.data}return{valid:!0,data:X}}else if(A===I.array&&G===I.array){if(_.length!==z.length)return{valid:!1};let J=[];for(let Y=0;Y<_.length;Y++){let X=_[Y],b=z[Y],Q=M5(X,b);if(!Q.valid)return{valid:!1};J.push(Q.data)}return{valid:!0,data:J}}else if(A===I.date&&G===I.date&&+_===+z)return{valid:!0,data:_};else return{valid:!1}}class Z1 extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_),G=(J,Y)=>{if(Y6(J)||Y6(Y))return l;let X=M5(J.value,Y.value);if(!X.valid)return T(A,{code:R.invalid_intersection_types}),l;if(X6(J)||X6(Y))z.dirty();return{status:z.value,value:X.data}};if(A.common.async)return Promise.all([this._def.left._parseAsync({data:A.data,path:A.path,parent:A}),this._def.right._parseAsync({data:A.data,path:A.path,parent:A})]).then(([J,Y])=>G(J,Y));else return G(this._def.left._parseSync({data:A.data,path:A.path,parent:A}),this._def.right._parseSync({data:A.data,path:A.path,parent:A}))}}Z1.create=(_,z,A)=>{return new Z1({left:_,right:z,typeName:p.ZodIntersection,...a(A)})};class X4 extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==I.array)return T(A,{code:R.invalid_type,expected:I.array,received:A.parsedType}),l;if(A.data.length<this._def.items.length)return T(A,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l;if(!this._def.rest&&A.data.length>this._def.items.length)T(A,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),z.dirty();let J=[...A.data].map((Y,X)=>{let b=this._def.items[X]||this._def.rest;if(!b)return null;return b._parse(new c9(A,Y,A.path,X))}).filter((Y)=>!!Y);if(A.common.async)return Promise.all(J).then((Y)=>{return m0.mergeArray(z,Y)});else return m0.mergeArray(z,J)}get items(){return this._def.items}rest(_){return new X4({...this._def,rest:_})}}X4.create=(_,z)=>{if(!Array.isArray(_))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new X4({items:_,typeName:p.ZodTuple,rest:null,...a(z)})};class Nz extends _0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==I.object)return T(A,{code:R.invalid_type,expected:I.object,received:A.parsedType}),l;let G=[],J=this._def.keyType,Y=this._def.valueType;for(let X in A.data)G.push({key:J._parse(new c9(A,X,A.path,X)),value:Y._parse(new c9(A,A.data[X],A.path,X)),alwaysSet:X in A.data});if(A.common.async)return m0.mergeObjectAsync(z,G);else return m0.mergeObjectSync(z,G)}get element(){return this._def.valueType}static create(_,z,A){if(z instanceof _0)return new Nz({keyType:_,valueType:z,typeName:p.ZodRecord,...a(A)});return new Nz({keyType:h9.create(),valueType:_,typeName:p.ZodRecord,...a(z)})}}class Ez extends _0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==I.map)return T(A,{code:R.invalid_type,expected:I.map,received:A.parsedType}),l;let G=this._def.keyType,J=this._def.valueType,Y=[...A.data.entries()].map(([X,b],Q)=>{return{key:G._parse(new c9(A,X,A.path,[Q,"key"])),value:J._parse(new c9(A,b,A.path,[Q,"value"]))}});if(A.common.async){let X=new Map;return Promise.resolve().then(async()=>{for(let b of Y){let Q=await b.key,$=await b.value;if(Q.status==="aborted"||$.status==="aborted")return l;if(Q.status==="dirty"||$.status==="dirty")z.dirty();X.set(Q.value,$.value)}return{status:z.value,value:X}})}else{let X=new Map;for(let b of Y){let{key:Q,value:$}=b;if(Q.status==="aborted"||$.status==="aborted")return l;if(Q.status==="dirty"||$.status==="dirty")z.dirty();X.set(Q.value,$.value)}return{status:z.value,value:X}}}}Ez.create=(_,z,A)=>{return new Ez({valueType:z,keyType:_,typeName:p.ZodMap,...a(A)})};class k_ extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.parsedType!==I.set)return T(A,{code:R.invalid_type,expected:I.set,received:A.parsedType}),l;let G=this._def;if(G.minSize!==null){if(A.data.size<G.minSize.value)T(A,{code:R.too_small,minimum:G.minSize.value,type:"set",inclusive:!0,exact:!1,message:G.minSize.message}),z.dirty()}if(G.maxSize!==null){if(A.data.size>G.maxSize.value)T(A,{code:R.too_big,maximum:G.maxSize.value,type:"set",inclusive:!0,exact:!1,message:G.maxSize.message}),z.dirty()}let J=this._def.valueType;function Y(b){let Q=new Set;for(let $ of b){if($.status==="aborted")return l;if($.status==="dirty")z.dirty();Q.add($.value)}return{status:z.value,value:Q}}let X=[...A.data.values()].map((b,Q)=>J._parse(new c9(A,b,A.path,Q)));if(A.common.async)return Promise.all(X).then((b)=>Y(b));else return Y(X)}min(_,z){return new k_({...this._def,minSize:{value:_,message:y.toString(z)}})}max(_,z){return new k_({...this._def,maxSize:{value:_,message:y.toString(z)}})}size(_,z){return this.min(_,z).max(_,z)}nonempty(_){return this.min(1,_)}}k_.create=(_,z)=>{return new k_({valueType:_,minSize:null,maxSize:null,typeName:p.ZodSet,...a(z)})};class b1 extends _0{constructor(){super(...arguments);this.validate=this.implement}_parse(_){let{ctx:z}=this._processInputParams(_);if(z.parsedType!==I.function)return T(z,{code:R.invalid_type,expected:I.function,received:z.parsedType}),l;function A(X,b){return Uz({data:X,path:z.path,errorMaps:[z.common.contextualErrorMap,z.schemaErrorMap,J1(),N4].filter((Q)=>!!Q),issueData:{code:R.invalid_arguments,argumentsError:b}})}function G(X,b){return Uz({data:X,path:z.path,errorMaps:[z.common.contextualErrorMap,z.schemaErrorMap,J1(),N4].filter((Q)=>!!Q),issueData:{code:R.invalid_return_type,returnTypeError:b}})}let J={errorMap:z.common.contextualErrorMap},Y=z.data;if(this._def.returns instanceof I_){let X=this;return a0(async function(...b){let Q=new b9([]),$=await X._def.args.parseAsync(b,J).catch((Z)=>{throw Q.addIssue(A(b,Z)),Q}),H=await Reflect.apply(Y,this,$);return await X._def.returns._def.type.parseAsync(H,J).catch((Z)=>{throw Q.addIssue(G(H,Z)),Q})})}else{let X=this;return a0(function(...b){let Q=X._def.args.safeParse(b,J);if(!Q.success)throw new b9([A(b,Q.error)]);let $=Reflect.apply(Y,this,Q.data),H=X._def.returns.safeParse($,J);if(!H.success)throw new b9([G($,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(..._){return new b1({...this._def,args:X4.create(_).rest(t4.create())})}returns(_){return new b1({...this._def,returns:_})}implement(_){return this.parse(_)}strictImplement(_){return this.parse(_)}static create(_,z,A){return new b1({args:_?_:X4.create([]).rest(t4.create()),returns:z||t4.create(),typeName:p.ZodFunction,...a(A)})}}class q1 extends _0{get schema(){return this._def.getter()}_parse(_){let{ctx:z}=this._processInputParams(_);return this._def.getter()._parse({data:z.data,path:z.path,parent:z})}}q1.create=(_,z)=>{return new q1({getter:_,typeName:p.ZodLazy,...a(z)})};class F1 extends _0{_parse(_){if(_.data!==this._def.value){let z=this._getOrReturnCtx(_);return T(z,{received:z.data,code:R.invalid_literal,expected:this._def.value}),l}return{status:"valid",value:_.data}}get value(){return this._def.value}}F1.create=(_,z)=>{return new F1({value:_,typeName:p.ZodLiteral,...a(z)})};function lX(_,z){return new z_({values:_,typeName:p.ZodEnum,...a(z)})}class z_ extends _0{_parse(_){if(typeof _.data!=="string"){let z=this._getOrReturnCtx(_),A=this._def.values;return T(z,{expected:A0.joinValues(A),received:z.parsedType,code:R.invalid_type}),l}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(_.data)){let z=this._getOrReturnCtx(_),A=this._def.values;return T(z,{received:z.data,code:R.invalid_enum_value,options:A}),l}return a0(_.data)}get options(){return this._def.values}get enum(){let _={};for(let z of this._def.values)_[z]=z;return _}get Values(){let _={};for(let z of this._def.values)_[z]=z;return _}get Enum(){let _={};for(let z of this._def.values)_[z]=z;return _}extract(_,z=this._def){return z_.create(_,{...this._def,...z})}exclude(_,z=this._def){return z_.create(this.options.filter((A)=>!_.includes(A)),{...this._def,...z})}}z_.create=lX;class K1 extends _0{_parse(_){let z=A0.getValidEnumValues(this._def.values),A=this._getOrReturnCtx(_);if(A.parsedType!==I.string&&A.parsedType!==I.number){let G=A0.objectValues(z);return T(A,{expected:A0.joinValues(G),received:A.parsedType,code:R.invalid_type}),l}if(!this._cache)this._cache=new Set(A0.getValidEnumValues(this._def.values));if(!this._cache.has(_.data)){let G=A0.objectValues(z);return T(A,{received:A.data,code:R.invalid_enum_value,options:G}),l}return a0(_.data)}get enum(){return this._def.values}}K1.create=(_,z)=>{return new K1({values:_,typeName:p.ZodNativeEnum,...a(z)})};class I_ extends _0{unwrap(){return this._def.type}_parse(_){let{ctx:z}=this._processInputParams(_);if(z.parsedType!==I.promise&&z.common.async===!1)return T(z,{code:R.invalid_type,expected:I.promise,received:z.parsedType}),l;let A=z.parsedType===I.promise?z.data:Promise.resolve(z.data);return a0(A.then((G)=>{return this._def.type.parseAsync(G,{path:z.path,errorMap:z.common.contextualErrorMap})}))}}I_.create=(_,z)=>{return new I_({type:_,typeName:p.ZodPromise,...a(z)})};class l9 extends _0{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(_){let{status:z,ctx:A}=this._processInputParams(_),G=this._def.effect||null,J={addIssue:(Y)=>{if(T(A,Y),Y.fatal)z.abort();else z.dirty()},get path(){return A.path}};if(J.addIssue=J.addIssue.bind(J),G.type==="preprocess"){let Y=G.transform(A.data,J);if(A.common.async)return Promise.resolve(Y).then(async(X)=>{if(z.value==="aborted")return l;let b=await this._def.schema._parseAsync({data:X,path:A.path,parent:A});if(b.status==="aborted")return l;if(b.status==="dirty")return R_(b.value);if(z.value==="dirty")return R_(b.value);return b});else{if(z.value==="aborted")return l;let X=this._def.schema._parseSync({data:Y,path:A.path,parent:A});if(X.status==="aborted")return l;if(X.status==="dirty")return R_(X.value);if(z.value==="dirty")return R_(X.value);return X}}if(G.type==="refinement"){let Y=(X)=>{let b=G.refinement(X,J);if(A.common.async)return Promise.resolve(b);if(b instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return X};if(A.common.async===!1){let X=this._def.schema._parseSync({data:A.data,path:A.path,parent:A});if(X.status==="aborted")return l;if(X.status==="dirty")z.dirty();return Y(X.value),{status:z.value,value:X.value}}else return this._def.schema._parseAsync({data:A.data,path:A.path,parent:A}).then((X)=>{if(X.status==="aborted")return l;if(X.status==="dirty")z.dirty();return Y(X.value).then(()=>{return{status:z.value,value:X.value}})})}if(G.type==="transform")if(A.common.async===!1){let Y=this._def.schema._parseSync({data:A.data,path:A.path,parent:A});if(!s4(Y))return l;let X=G.transform(Y.value,J);if(X instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:z.value,value:X}}else return this._def.schema._parseAsync({data:A.data,path:A.path,parent:A}).then((Y)=>{if(!s4(Y))return l;return Promise.resolve(G.transform(Y.value,J)).then((X)=>({status:z.value,value:X}))});A0.assertNever(G)}}l9.create=(_,z,A)=>{return new l9({schema:_,typeName:p.ZodEffects,effect:z,...a(A)})};l9.createWithPreprocess=(_,z,A)=>{return new l9({schema:z,effect:{type:"preprocess",transform:_},typeName:p.ZodEffects,...a(A)})};class u9 extends _0{_parse(_){if(this._getType(_)===I.undefined)return a0(void 0);return this._def.innerType._parse(_)}unwrap(){return this._def.innerType}}u9.create=(_,z)=>{return new u9({innerType:_,typeName:p.ZodOptional,...a(z)})};class w4 extends _0{_parse(_){if(this._getType(_)===I.null)return a0(null);return this._def.innerType._parse(_)}unwrap(){return this._def.innerType}}w4.create=(_,z)=>{return new w4({innerType:_,typeName:p.ZodNullable,...a(z)})};class W1 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A=z.data;if(z.parsedType===I.undefined)A=this._def.defaultValue();return this._def.innerType._parse({data:A,path:z.path,parent:z})}removeDefault(){return this._def.innerType}}W1.create=(_,z)=>{return new W1({innerType:_,typeName:p.ZodDefault,defaultValue:typeof z.default==="function"?z.default:()=>z.default,...a(z)})};class V1 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A={...z,common:{...z.common,issues:[]}},G=this._def.innerType._parse({data:A.data,path:A.path,parent:{...A}});if(Y1(G))return G.then((J)=>{return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new b9(A.common.issues)},input:A.data})}});else return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new b9(A.common.issues)},input:A.data})}}removeCatch(){return this._def.innerType}}V1.create=(_,z)=>{return new V1({innerType:_,typeName:p.ZodCatch,catchValue:typeof z.catch==="function"?z.catch:()=>z.catch,...a(z)})};class wz extends _0{_parse(_){if(this._getType(_)!==I.nan){let A=this._getOrReturnCtx(_);return T(A,{code:R.invalid_type,expected:I.nan,received:A.parsedType}),l}return{status:"valid",value:_.data}}}wz.create=(_)=>{return new wz({typeName:p.ZodNaN,...a(_)})};var mw=Symbol("zod_brand");class Q6 extends _0{_parse(_){let{ctx:z}=this._processInputParams(_),A=z.data;return this._def.type._parse({data:A,path:z.path,parent:z})}unwrap(){return this._def.type}}class Oz extends _0{_parse(_){let{status:z,ctx:A}=this._processInputParams(_);if(A.common.async)return(async()=>{let J=await this._def.in._parseAsync({data:A.data,path:A.path,parent:A});if(J.status==="aborted")return l;if(J.status==="dirty")return z.dirty(),R_(J.value);else return this._def.out._parseAsync({data:J.value,path:A.path,parent:A})})();else{let G=this._def.in._parseSync({data:A.data,path:A.path,parent:A});if(G.status==="aborted")return l;if(G.status==="dirty")return z.dirty(),{status:"dirty",value:G.value};else return this._def.out._parseSync({data:G.value,path:A.path,parent:A})}}static create(_,z){return new Oz({in:_,out:z,typeName:p.ZodPipeline})}}class U1 extends _0{_parse(_){let z=this._def.innerType._parse(_),A=(G)=>{if(s4(G))G.value=Object.freeze(G.value);return G};return Y1(z)?z.then((G)=>A(G)):A(z)}unwrap(){return this._def.innerType}}U1.create=(_,z)=>{return new U1({innerType:_,typeName:p.ZodReadonly,...a(z)})};function hX(_,z){let A=typeof _==="function"?_(z):typeof _==="string"?{message:_}:_;return typeof A==="string"?{message:A}:A}function pX(_,z={},A){if(_)return S_.create().superRefine((G,J)=>{let Y=_(G);if(Y instanceof Promise)return Y.then((X)=>{if(!X){let b=hX(z,G),Q=b.fatal??A??!0;J.addIssue({code:"custom",...b,fatal:Q})}});if(!Y){let X=hX(z,G),b=X.fatal??A??!0;J.addIssue({code:"custom",...X,fatal:b})}return});return S_.create()}var uw={object:S0.lazycreate},p;(function(_){_.ZodString="ZodString",_.ZodNumber="ZodNumber",_.ZodNaN="ZodNaN",_.ZodBigInt="ZodBigInt",_.ZodBoolean="ZodBoolean",_.ZodDate="ZodDate",_.ZodSymbol="ZodSymbol",_.ZodUndefined="ZodUndefined",_.ZodNull="ZodNull",_.ZodAny="ZodAny",_.ZodUnknown="ZodUnknown",_.ZodNever="ZodNever",_.ZodVoid="ZodVoid",_.ZodArray="ZodArray",_.ZodObject="ZodObject",_.ZodUnion="ZodUnion",_.ZodDiscriminatedUnion="ZodDiscriminatedUnion",_.ZodIntersection="ZodIntersection",_.ZodTuple="ZodTuple",_.ZodRecord="ZodRecord",_.ZodMap="ZodMap",_.ZodSet="ZodSet",_.ZodFunction="ZodFunction",_.ZodLazy="ZodLazy",_.ZodLiteral="ZodLiteral",_.ZodEnum="ZodEnum",_.ZodEffects="ZodEffects",_.ZodNativeEnum="ZodNativeEnum",_.ZodOptional="ZodOptional",_.ZodNullable="ZodNullable",_.ZodDefault="ZodDefault",_.ZodCatch="ZodCatch",_.ZodPromise="ZodPromise",_.ZodBranded="ZodBranded",_.ZodPipeline="ZodPipeline",_.ZodReadonly="ZodReadonly"})(p||(p={}));var cw=(_,z={message:`Input not instance of ${_.name}`})=>pX((A)=>A instanceof _,z),dX=h9.create,rX=e4.create,lw=wz.create,pw=__.create,nX=Q1.create,dw=P_.create,rw=Dz.create,nw=$1.create,iw=H1.create,ow=S_.create,aw=t4.create,sw=Y4.create,tw=Mz.create,ew=m9.create,_O=S0.create,zO=S0.strictCreate,AO=B1.create,GO=b6.create,JO=Z1.create,YO=X4.create,XO=Nz.create,bO=Ez.create,QO=k_.create,$O=b1.create,HO=q1.create,BO=F1.create,ZO=z_.create,qO=K1.create,FO=I_.create,KO=l9.create,WO=u9.create,VO=w4.create,UO=l9.createWithPreprocess,DO=Oz.create,MO=()=>dX().optional(),NO=()=>rX().optional(),EO=()=>nX().optional(),wO={string:(_)=>h9.create({..._,coerce:!0}),number:(_)=>e4.create({..._,coerce:!0}),boolean:(_)=>Q1.create({..._,coerce:!0}),bigint:(_)=>__.create({..._,coerce:!0}),date:(_)=>P_.create({..._,coerce:!0})};var OO=l;var iX=D.object({sha256:D.string(),mediaType:D.string()}),LO=D.object({type:D.literal("user"),text:D.string(),images:D.array(iX).optional(),id:D.string().optional(),timestamp:D.string().optional()}),jO=D.object({type:D.literal("compaction-summary"),text:D.string(),id:D.string().optional(),timestamp:D.string().optional()}),RO=D.object({type:D.literal("command"),name:D.string(),args:D.string().optional(),output:D.string().optional(),id:D.string().optional(),timestamp:D.string().optional()}),PO=D.object({type:D.literal("agent"),text:D.string(),id:D.string().optional(),timestamp:D.string().optional(),model:D.string().optional()}),SO=D.object({type:D.literal("thinking"),text:D.string(),id:D.string().optional(),timestamp:D.string().optional(),model:D.string().optional()}),oX=D.object({type:D.literal("tool-call"),toolName:D.string().nullable(),input:D.unknown().optional(),output:D.unknown().optional(),images:D.array(iX).optional(),error:D.string().optional(),isError:D.union([D.boolean(),D.string()]).optional(),id:D.string().optional(),timestamp:D.string().optional(),model:D.string().optional()}),z0=D.discriminatedUnion("type",[LO,jO,RO,PO,SO,oX]),E5=D.object({inputTokens:D.number(),cachedInputTokens:D.number(),outputTokens:D.number(),reasoningOutputTokens:D.number(),totalTokens:D.number()}),b4=oX,kO=b4.extend({toolName:D.literal("Write"),input:D.object({file_path:D.string(),content:D.string().optional()}).passthrough().optional(),output:D.object({type:D.string().optional()}).passthrough().optional()}),IO=b4.extend({toolName:D.literal("Read"),input:D.object({file_path:D.string()}).passthrough().optional(),output:D.union([D.string(),D.object({type:D.string().optional(),file:D.object({content:D.string().optional(),numLines:D.number().optional(),startLine:D.number().optional(),totalLines:D.number().optional()}).passthrough().optional()}).passthrough()]).optional()}),xO=b4.extend({toolName:D.literal("Edit"),input:D.object({file_path:D.string(),diff:D.string().optional()}).passthrough().optional(),output:D.union([D.string(),D.object({userModified:D.boolean().optional()}).passthrough()]).optional()}),aX=D.object({filenames:D.array(D.string()),durationMs:D.number().optional(),truncated:D.boolean().optional()}).passthrough(),TO=b4.extend({toolName:D.literal("Glob"),input:D.object({pattern:D.string().optional()}).passthrough().optional(),output:aX.optional()}),CO=b4.extend({toolName:D.literal("Grep"),input:D.unknown().optional(),output:aX.extend({mode:D.string().optional(),numMatches:D.number().optional()}).passthrough().optional()}),vO=b4.extend({toolName:D.literal("Bash"),input:D.object({command:D.string(),description:D.string().optional()}).passthrough().optional(),output:D.union([D.string(),D.object({stdout:D.string().optional(),stderr:D.string().optional(),interrupted:D.boolean().optional(),isImage:D.boolean().optional()}).passthrough()]).optional()}),yO=b4.extend({toolName:D.literal("BashOutput"),input:D.object({bash_id:D.string().optional()}).passthrough().optional(),output:D.object({command:D.string().optional(),exitCode:D.number().optional(),shellId:D.string().optional(),status:D.string().optional(),stderr:D.string().optional(),stdout:D.string().optional(),timestamp:D.string().optional()}).passthrough().optional()}),gO=b4.extend({toolName:D.literal("Task"),input:D.unknown().optional(),output:D.object({status:D.string().optional(),totalDurationMs:D.number().optional(),totalToolUseCount:D.number().optional(),content:D.array(D.object({type:D.string().optional(),text:D.string().optional()}).passthrough()).optional(),usage:E5.optional()}).passthrough().optional()}),N5=D.object({content:D.string(),status:D.string().optional()}).passthrough(),fO=b4.extend({toolName:D.literal("TodoWrite"),input:D.object({todos:D.array(N5).optional()}).passthrough().optional(),output:D.object({oldTodos:D.array(N5).optional(),newTodos:D.array(N5).optional()}).passthrough().optional()}),hO=[kO,IO,xO,TO,CO,vO,yO,gO,fO],mO=b4,$6=D.union([...hO,mO]),O4=D.object({model:D.string(),usage:E5}),z9=D.object({relativeCwd:D.string().nullable(),branch:D.string().nullable(),repo:D.string().nullable()}).strict().nullable(),Q4=D.object({v:D.literal(1),id:D.string(),source:D.enum(["claude-code","cline","codex","opencode","pi","unknown"]),timestamp:D.coerce.date(),preview:D.string().nullable(),summary:D.string().nullable().default(null),model:D.string().nullable(),clientVersion:D.string().nullable(),blendedTokens:D.number(),costUsd:D.number(),messageCount:D.number(),toolCount:D.number(),userMessageCount:D.number(),filesChanged:D.number(),linesAdded:D.number().default(0),linesRemoved:D.number().default(0),linesModified:D.number().default(0),tokenUsage:E5,modelUsage:D.array(O4),git:z9,cwd:D.string().nullable(),messages:D.array(z0)});import{appendFileSync as rO,mkdirSync as nO}from"fs";import{dirname as iO}from"path";import{existsSync as uO,readFileSync as cO}from"fs";import{homedir as lO}from"os";import{dirname as sX,resolve as w5}from"path";function pO(){let z=process.env.VI_CLI_PATH;if(z?.startsWith("bun "))z=z.slice(4);let A=z?sX(z):process.cwd(),G=10,J=0;while(J<G){let Y=w5(A,"package.json");if(uO(Y))try{if(JSON.parse(cO(Y,"utf-8")).workspaces)return A}catch{}let X=sX(A);if(X===A)break;A=X,J++}return null}function dO(){let _=pO();return _?w5(_,"logs"):null}function tX(){let _=dO();return _?w5(_,"dev.log"):null}function D9(_){let z=lO();if(_.startsWith(z))return _.replace(z,"~");let A=/^(\/Users\/[^/]+|\/home\/[^/]+)/;return _.replace(A,"~")}function Lz(_){if(_==="."||_===null)return"";return _}function s0(_,z){if(!z)return _;let A=z.endsWith("/")?z:`${z}/`,G=A.slice(0,-1),J=(X)=>typeof X==="object"&&X!==null&&!Array.isArray(X),Y=(X)=>{if(typeof X==="string"){if(X.includes(A))return X.replaceAll(A,"./");if(X.includes(G))return X.replaceAll(G,".");return X}if(Array.isArray(X))return X.map(Y);if(J(X)){let b={};for(let[Q,$]of Object.entries(X))b[Q]=Y($);return b}return X};return Y(_)}var eX=!1;function oO(_){if(_===void 0||_===null)return _;if(process.env.DEBUG_PAYLOADS!=="true"){if(!eX)return eX=!0,"[payload logging disabled - set DEBUG_PAYLOADS=true to enable]";return}if(typeof _==="object"){let A=JSON.stringify(_),G=Math.round(A.length/1024),J=A.includes('"isImage":true')||A.includes('"isImage": true')||A.length>1e4&&/[A-Za-z0-9+/]{100,}/.test(A);if(J||A.length>1e4)return`[payload: ${G}KB${J?", contains binary data":""}]`}return _}class _b{component;logToFile;logFilePath;disableConsole;constructor(_){this.component=_.component,this.disableConsole=_.disableConsole??!1;let z=typeof process<"u"&&!!process.versions?.node;if(this.logToFile=_.logToFile??(z&&!1),z&&this.logToFile){let A=tX(),G=_.logFilePath??A;if(G)this.logFilePath=G;else this.logToFile=!1,this.logFilePath=""}else this.logFilePath="",this.logToFile=!1;if(process.env.DEBUG)console.log(`[${this.component}] Logger config:`,{logToFile:this.logToFile,logFilePath:this.logFilePath,cwd:process.cwd(),NODE_ENV:"production"});if(this.logToFile)try{let A=iO(this.logFilePath);nO(A,{recursive:!0})}catch(A){if(process.env.DEBUG)console.error(`[${this.component}] Failed to create logs directory:`,A)}}log(_,z,A){let G=new Date,Y=`[${`${String(G.getMonth()+1).padStart(2,"0")}-${String(G.getDate()).padStart(2,"0")} ${String(G.getHours()).padStart(2,"0")}:${String(G.getMinutes()).padStart(2,"0")}:${String(G.getSeconds()).padStart(2,"0")}`}] [${this.component}] [${_}] ${z}`,X=_==="ERROR"?console.error:_==="WARN"?console.warn:console.log,b=oO(A);if(!this.disableConsole){if(X(Y),b!==void 0){let Q=typeof b==="object"?JSON.stringify(b,null,2):String(b);X(` ${Q}`)}}if(this.logToFile)try{let Q=Y+`
52
+ `;if(b!==void 0){let $=typeof b==="object"?JSON.stringify(b):String(b);Q+=` ${$}
53
+ `}rO(this.logFilePath,Q)}catch{}}debug(_,z){if(process.env.DEBUG)this.log("DEBUG",_,z)}info(_,z){this.log("INFO",_,z)}warn(_,z){this.log("WARN",_,z)}error(_,z){this.log("ERROR",_,z)}}function zb(_,z){return new _b({component:_,...z})}import{execSync as aO}from"child_process";import{resolve as sO}from"path";var tO="http://localhost:3000",eO=1e4;async function _L(_,z,A){try{return(await fetch(`${z}/api/blobs/${_}`,{method:"HEAD",headers:{...A&&{Authorization:`Bearer ${A}`}},signal:AbortSignal.timeout(5000)})).ok}catch{return!1}}async function zL(_,z,A){if(!_||_.length===0)return;let J=(await Promise.all(_.map(async(Y)=>({blob:Y,exists:await _L(Y.sha256,z,A)})))).filter((Y)=>!Y.exists).map((Y)=>Y.blob);return J.length>0?J:void 0}async function O5(_,z={}){let A=z.serverUrl??process.env.VI_SERVER_URL??tO,G=z.authToken??null,J=z.timeoutMs??eO,Y=await zL(_.blobs,A,G),X=new FormData,b=`${_.unifiedTranscript.id||"transcript"}.jsonl`;if(_.id)X.set("id",_.id);if(X.set("sha256",_.sha256),X.set("unifiedTranscript",JSON.stringify(_.unifiedTranscript)),_.visibility)X.set("visibility",_.visibility);if(X.set("transcript",new Blob([_.rawTranscript],{type:"application/jsonl"}),b),Y)for(let Q of Y){let $=Q.data.buffer.slice(Q.data.byteOffset,Q.data.byteOffset+Q.data.byteLength);X.append(`blob:${Q.sha256}`,new Blob([$],{type:Q.mediaType}),`${Q.sha256}.blob`)}try{let Q=await fetch(`${A}/api/ingest`,{method:"POST",headers:{...G&&{Authorization:`Bearer ${G}`}},body:X,signal:AbortSignal.timeout(J)});if(!Q.ok)return console.error(`Upload failed: ${Q.status} ${Q.statusText}`),{success:!1};let $=await Q.json();if(AL($))return{success:!0,id:$.id,transcriptId:$.transcriptId};return console.error("Upload succeeded but response had unexpected shape:",$),{success:!1}}catch(Q){if(Q instanceof Error)console.error("Upload error:",Q.message);return{success:!1}}}function AL(_){if(typeof _!=="object"||_===null)return!1;let z=_;return typeof z.success==="boolean"&&(z.success===!1||typeof z.id==="string"&&typeof z.transcriptId==="string")&&(z.eventsReceived===void 0||typeof z.eventsReceived==="number")}function Ab(_){let z=sO(_),A=D9(z);try{let G=aO("git remote get-url origin",{cwd:z,encoding:"utf8",timeout:2000,stdio:["pipe","pipe","ignore"]}).trim(),J=GL(G),Y=J.split("/").pop()||"unknown";return{repoId:J,repoName:Y,cwd:A}}catch{return{repoId:null,repoName:z.split("/").pop()||"unknown",cwd:A}}}function GL(_){let z=/^(?<user>[^@]+)@(?<host>[^:]+):(?<path>.+)$/,A=_.match(z);if(A?.groups)return`${A.groups.host}/${A.groups.path.replace(/\.git$/i,"")}`;try{let G=new URL(_),J=G.pathname.replace(/\.git$/i,"").replace(/^\//,"");return`${G.host}/${J}`}catch{return _.replace(/\.git$/i,"")}}import JL from"node:crypto";import Gb from"node:fs/promises";import YL from"node:path";var XL=200000,bL=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/openai/"],bb=new Set(["[request interrupted by user]","[request aborted by user]","[request cancelled by user]"]),QL=new Set(["/clear"]),$L=/^<\/?(?:command|local)-[a-z-]+>/i,Qb=/^[α-ωΑ-Ω]\s/i,HL=/<command-name>(.*?)<\/command-name>/s,BL=/<command-args>(.*?)<\/command-args>/s,ZL=/^<local-command-stdout>(.*)<\/local-command-stdout>$/s,qL=/<system-reminder>[\s\S]*?<\/system-reminder>/g,$b=["npm ","npm:","npm error","node:","node.js","error:","fatal:","warning:","traceback (most recent call last):","usage:","hint:","note:","code:","requirestack"],FL=new RegExp("\\b("+["fix","please","should","update","change","add","remove","create","write","implement","refactor","investigate","explain","help","why","what","how","need","ensure","make","build","let's","optimize","review","check"].join("|")+")\\b","i"),KL=3;function L4(_){let z=0,A=0,G=0,J=0,Y=0,X=new Set;for(let b of _)if(b.type==="user")A++;else if(b.type==="tool-call"){if(z++,b.isError||b.error)continue;let{toolName:Q,input:$,output:H}=b;if($&&typeof $.file_path==="string"){if(Q==="Edit"||Q==="Write")X.add($.file_path)}if(Q==="Write"&&$&&typeof $.content==="string"){let Z=$.content.split(`
54
+ `).length;G+=Z}let B=$?.diff??H?.diff;if(Q==="Edit"&&typeof B==="string"){let Z=0,q=0,F=B.split(`
55
+ `);for(let W of F)if(W.startsWith("+")&&!W.startsWith("+++"))Z++;else if(W.startsWith("-")&&!W.startsWith("---"))q++;let K=Math.min(Z,q);G+=Z-K,J+=q-K,Y+=K}}return{toolCount:z,userMessageCount:A,filesChanged:X.size,linesAdded:G,linesRemoved:J,linesModified:Y}}function B6(_,z={}){let A=WL(_);if(A.records.size===0)return null;let G=DL(A.records);if(G.length===0)return null;let J=G[G.length-1],Y=ML(G),X=EL(Y),b=wL(Y),Q=CL(X),$=Y.map((O)=>{let P=O.message?.usage;if(!P)return null;return{model:O.message?.model??null,usage:P}}).filter((O)=>O!==null),H=gL($,z.pricing),B=OL(G),Z=B.length>0?RL(B[0]):null,q=Kb(J.timestamp)??z.now??new Date,F=kL(G),K=IL(b),W=j5(G),V=z.gitContext!==void 0?z.gitContext:SL(G),N=W?D9(W):"",{messages:L,blobs:M}=pL(G);if(L.length===0)return null;let k=L4(L),U={v:1,id:F??J.uuid,source:"claude-code",timestamp:q,preview:Z,summary:null,model:K,clientVersion:z.clientVersion??PL(G),blendedTokens:Q,costUsd:H,messageCount:L.length,...k,tokenUsage:X,modelUsage:Array.from(b.entries()).map(([O,P])=>({model:Bb(O),usage:P})),git:V,cwd:N,messages:L};return{transcript:Q4.parse(U),blobs:M}}function WL(_){let z=new Map,A=new Map;for(let G of _){let J=typeof G.type==="string"?G.type:"";if(J==="summary")continue;let Y=typeof G.uuid==="string"?G.uuid:null;if(!Y)continue;let X={uuid:Y,type:J,timestamp:typeof G.timestamp==="string"?G.timestamp:void 0,parentUuid:typeof G.parentUuid==="string"||G.parentUuid===null?G.parentUuid:void 0,logicalParentUuid:typeof G.logicalParentUuid==="string"||G.logicalParentUuid===null?G.logicalParentUuid:void 0,isSidechain:Boolean(G.isSidechain),isMeta:Boolean(G.isMeta),isCompactSummary:Boolean(G.isCompactSummary),sessionId:typeof G.sessionId==="string"?G.sessionId:void 0,cwd:typeof G.cwd==="string"?G.cwd:void 0,gitBranch:typeof G.gitBranch==="string"?G.gitBranch:void 0,costUSD:typeof G.costUSD==="number"?G.costUSD:void 0,message:VL(G.message),raw:G};if(z.set(Y,X),X.parentUuid){let b=A.get(X.parentUuid)??new Set;b.add(Y),A.set(X.parentUuid,b)}}return{records:z,children:A}}function VL(_){if(!_||typeof _!=="object")return;let z=_,A=typeof z.id==="string"?z.id:void 0,G=typeof z.role==="string"?z.role:void 0,J=z.content,Y=typeof z.model==="string"?z.model:void 0,X=UL(z.usage);return{id:A,role:G,content:J,model:Y,usage:X}}function UL(_){if(!_||typeof _!=="object")return null;let z=_,A={};if(typeof z.input_tokens==="number")A.input_tokens=z.input_tokens;if(typeof z.cache_creation_input_tokens==="number")A.cache_creation_input_tokens=z.cache_creation_input_tokens;if(typeof z.cache_read_input_tokens==="number")A.cache_read_input_tokens=z.cache_read_input_tokens;if(typeof z.output_tokens==="number")A.output_tokens=z.output_tokens;if(typeof z.reasoning_output_tokens==="number")A.reasoning_output_tokens=z.reasoning_output_tokens;return Object.keys(A).length>0?A:null}function DL(_){let z=[];for(let A of _.values()){if(A.isSidechain)continue;z.push(A)}return z.sort((A,G)=>{let J=Jb(A.timestamp)??0,Y=Jb(G.timestamp)??0;if(J!==Y)return J-Y;return A.uuid.localeCompare(G.uuid)}),z}function ML(_){let z=new Map;for(let A of _){if(A.type!=="assistant")continue;if(!A.message?.usage)continue;let J=NL(A);z.set(J,A)}return Array.from(z.values())}function NL(_){let z=_.message,A=Yb(z?.id),G=Yb(_.raw.requestId);if(A&&G)return`${A}:${G}`;if(A)return A;if(G)return G;return _.uuid}function EL(_){let z={inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0};for(let A of _){let G=A.message?.usage;if(!G)continue;let J=Q9(G.input_tokens),Y=Q9(G.cache_creation_input_tokens),X=Q9(G.cache_read_input_tokens),b=Q9(G.output_tokens),Q=Q9(G.reasoning_output_tokens);z.inputTokens+=J+Y+X,z.cachedInputTokens+=X,z.outputTokens+=b,z.reasoningOutputTokens+=Q,z.totalTokens+=J+Y+X+b+Q}return z}function wL(_){let z=new Map;for(let A of _){let G=A.message?.model,J=A.message?.usage;if(!G||!J)continue;let Y=z.get(G)??{inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0},X=Q9(J.input_tokens),b=Q9(J.cache_creation_input_tokens),Q=Q9(J.cache_read_input_tokens),$=Q9(J.output_tokens),H=Q9(J.reasoning_output_tokens);Y.inputTokens+=X+b+Q,Y.cachedInputTokens+=Q,Y.outputTokens+=$,Y.reasoningOutputTokens+=H,Y.totalTokens+=X+b+Q+$+H,z.set(G,Y)}return z}function OL(_){let z=[];for(let A of _){if(!LL(A))continue;z.push(A)}return z}function LL(_){if(_.type!=="user")return!1;if(_.isSidechain)return!1;if(_.isMeta)return!1;let z=_.raw;if(z&&typeof z==="object"){if("toolUseResult"in z)return!1}let A=_.message?.content;if(Array.isArray(A)){if(A.some((Y)=>jL(Y)))return!1}let G=Zb(_);if(!G)return!1;let J=G.toLowerCase();if(bb.has(J))return!1;if(Hb(G))return!1;if(Qb.test(G))return!1;if($b.some((Y)=>J.startsWith(Y))){if(!Fb(G))return!1}return!0}function jL(_){if(!_||typeof _!=="object")return!1;let z=_;if(z.type==="tool_result")return!0;if(typeof z.tool_use_id==="string")return!0;return!1}function Hb(_){return $L.test(_)}function RL(_){let z=Zb(_);if(!z)return null;return qb(z)}function j5(_){for(let z of _)if(z.cwd)return z.cwd;return}function PL(_){for(let z of _){let A=z.raw.version;if(typeof A==="string"&&A.length>0)return A}return null}function SL(_){let z=j5(_),A=_.find((Y)=>Y.gitBranch)?.gitBranch??null;if(!z)return z9.parse({relativeCwd:null,branch:A,repo:null});let G=z.split(/[\\/]+/).filter(Boolean);if(G.length===0)return z9.parse({relativeCwd:null,branch:A,repo:null});let J=G.findIndex((Y)=>{let X=Y.toLowerCase();return X.includes("github")||X.includes("gitlab")||X.includes("bitbucket")});if(J>=0){let Y=G[J]?.toLowerCase()??"",X=Y.includes("gitlab")?"gitlab.com":Y.includes("bitbucket")?"bitbucket.org":"github.com",b=G[J+1],Q=G[J+2]?.replace(/\.git$/i,"");if(b&&Q){let $=G.slice(J+3),H=$.length>0?$.join("/"):".";return z9.parse({relativeCwd:Lz(H),branch:A,repo:`${X}/${b}/${Q}`})}}return z9.parse({relativeCwd:null,branch:A,repo:null})}async function C0(_,z){if(!_)return null;try{if(!(await Gb.stat(_)).isDirectory())return z9.parse({relativeCwd:null,branch:z??null,repo:null})}catch{return z9.parse({relativeCwd:null,branch:z??null,repo:null})}let A=await wA(_);if(!A)return z9.parse({relativeCwd:null,branch:z??null,repo:null});let G=YL.relative(A,_)||".",J=z??await ZJ(A),Y=await OA(A);return z9.parse({relativeCwd:Lz(G),branch:J,repo:Y})}function kL(_){for(let z of _){let A=typeof z.sessionId==="string"?z.sessionId.trim():"";if(A.length>0)return A}return null}function Bb(_){if(_.includes("/"))return _;return`anthropic/${_}`}function IL(_){let z=null,A=-1;for(let[G,J]of _){let Y=J.totalTokens>0?J.totalTokens:J.inputTokens+J.outputTokens;if(Y>A)A=Y,z=G}return z?Bb(z):null}function Zb(_){return xL(_.message)[0]??null}function xL(_){if(!_)return[];let z=_.content;if(typeof z==="string"){let A=L5(z);return A?[A]:[]}if(Array.isArray(z)){let A=[];for(let G of z){if(typeof G==="string"){let J=L5(G);if(J)A.push(J);continue}if(G&&typeof G==="object"){let J=G,Y=["content","text"];for(let X of Y){let b=J[X];if(typeof b==="string"){let Q=L5(b);if(Q)A.push(Q)}}}}return A}return[]}function L5(_,z=KL){let A=TL(_);if(A.length===0)return null;let J=A.slice(0,z).join(" "),Y=qb(J);return Y.length>0?Y:null}function TL(_){let z=[];for(let A of _.split(/\r?\n/)){let G=A.trim();if(!G)continue;let J=G.toLowerCase();if(bb.has(J))continue;if(Hb(G))continue;if(Qb.test(G))continue;if($b.some((Y)=>J.startsWith(Y))){if(!Fb(G))continue}if(!/[a-z]/i.test(G)&&!/\d/.test(G))continue;z.push(G)}return z}function qb(_){return _.replace(/\s+/g," ").trim()}function Fb(_){let z=_.toLowerCase();if(FL.test(z))return!0;if(z.includes("?"))return!0;return["can you","can we","could you","could we","would you","would we","should we","should i","let's","let us"].some((G)=>z.includes(G))}function CL(_){return Math.max(0,_.inputTokens-_.cachedInputTokens)+_.outputTokens+_.reasoningOutputTokens}function Kb(_){if(!_)return null;let z=new Date(_);return Number.isNaN(z.getTime())?null:z}function Jb(_){let z=Kb(_);return z?z.getTime():null}function Q9(_){return typeof _==="number"&&Number.isFinite(_)?_:0}function Yb(_){if(typeof _!=="string")return;let z=_.trim();return z.length>0?z:void 0}function vL(_){return JL.createHash("sha256").update(_).digest("hex")}function H6(_,z){if(_===null||_===void 0)return _;if(Array.isArray(_))return _.map((A)=>H6(A,z));if(typeof _==="object"){let A=_;if(A.type==="image"&&A.source&&typeof A.source==="object"){let J=A.source;if(typeof J.data==="string"&&J.data.length>0){let Y=J.data,X=typeof J.mediaType==="string"?J.mediaType:typeof J.media_type==="string"?J.media_type:"image/unknown",b=Buffer.from(Y,"base64"),Q=vL(b);if(!z.has(Q))z.set(Q,{data:b,mediaType:X});return{type:"image",source:{type:"sha256",mediaType:X,sha256:Q}}}}let G={};for(let[J,Y]of Object.entries(A))G[J]=H6(Y,z);return G}return _}function yL(_){let z=[];function A(G){if(G===null||G===void 0)return;if(Array.isArray(G)){for(let J of G)A(J);return}if(typeof G==="object"){let J=G;if(J.type==="image"&&J.source&&typeof J.source==="object"){let Y=J.source;if(Y.type==="sha256"&&typeof Y.sha256==="string"){z.push({sha256:Y.sha256,mediaType:typeof Y.mediaType==="string"?Y.mediaType:"image/unknown"});return}}for(let Y of Object.values(J))A(Y)}}return A(_),z}function gL(_,z){if(!z||Object.keys(z).length===0)return 0;let A=0;for(let G of _){let J=G.model;if(!J)continue;let Y=fL(J,z);if(!Y)continue;let X=hL({input_tokens:Q9(G.usage.input_tokens),output_tokens:Q9(G.usage.output_tokens),cache_creation_input_tokens:Q9(G.usage.cache_creation_input_tokens),cache_read_input_tokens:Q9(G.usage.cache_read_input_tokens)},Y);A+=X}return A}function fL(_,z){let A=_.trim();if(!A)return null;let G=new Set;G.add(A);for(let Y of bL)G.add(`${Y}${A}`);for(let Y of G){let X=z[Y];if(X)return X}let J=A.toLowerCase();for(let[Y,X]of Object.entries(z)){let b=Y.toLowerCase();if(b.includes(J)||J.includes(b))return X}return null}function hL(_,z){let A=(b,Q,$,H=XL)=>{if(b==null||b<=0)return 0;if(b>H&&$!=null){let B=Math.min(b,H),q=Math.max(0,b-H)*$;if(Q!=null)q+=B*Q;return q}if(Q!=null)return b*Q;return 0},G=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),J=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),Y=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),X=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return G+J+Y+X}function mL(_){let z=_.match(HL);if(!z)return null;let A=z[1].trim(),J=_.match(BL)?.[1]?.trim()||void 0;return{name:A,args:J||void 0}}function uL(_){let z=_.trim().match(ZL);if(!z)return null;return z[1]}function cL(_){return _.replace(qL,"").trim()}function lL(_){return _.replace(/\x1B\[[0-9;]*m/g,"")}function pL(_){let z=[],A=new Map,G=new Map,J=null,Y=!1,X=new Map,b=new Set,Q=j5(_);for(let $ of _){if($.isMeta)continue;let H=rL($),B=$.type;if(B==="user"){let{texts:Z,images:q,toolResults:F}=dL($,A);for(let K of Z){if(!K.trim())continue;let W=uL(K);if(W!==null){if(Y){Y=!1;continue}if(J){let M=lL(W).trim();z.push(z0.parse({type:"command",name:J.name,args:J.args,output:M||void 0,id:J.id,timestamp:J.timestamp})),J=null}continue}let V=mL(K);if(V){if(QL.has(V.name)){Y=!0;continue}if(J)z.push(z0.parse({type:"command",name:J.name,args:J.args,id:J.id,timestamp:J.timestamp}));J={name:V.name,args:V.args,id:$.uuid,timestamp:H.timestamp};continue}let N=cL(K);if(!N)continue;let L=$.isCompactSummary?"compaction-summary":"user";if(L==="user"){let M=`${H.timestamp}:${N}`,k=X.get(M);if(k){if(!k.hasImages&&q.length>0){let P=z[k.index];P.images=q,k.hasImages=!0}continue}let U={type:L,text:N,id:$.uuid,timestamp:H.timestamp};if(q.length>0)U.images=q;let O=z.length;z.push(z0.parse(U)),X.set(M,{index:O,hasImages:q.length>0})}else{let M={type:L,text:N,id:$.uuid,timestamp:H.timestamp};z.push(z0.parse(M))}}for(let K of F){let W=K.callId?G.get(K.callId):void 0;if(W){let V=z[W.index],N=H6(K.output,A);V.output=N;let L=yL(N);if(L.length>0)V.images=L;if(K.error)V.error=K.error;if(typeof K.isError<"u")V.isError=K.isError;let M=Xb(V,Q);z[W.index]=M}}continue}if(B==="assistant"){let Z=$.message?.content;if(!Array.isArray(Z))continue;for(let q of Z){if(!q||typeof q!=="object")continue;let F=q;if(F.type==="thinking"&&typeof F.thinking==="string"){let K=`thinking:${H.id}:${H.timestamp}:${F.thinking}`;if(b.has(K))continue;b.add(K),z.push(z0.parse({type:"thinking",text:F.thinking,...H}));continue}if(F.type==="text"&&typeof F.text==="string"){let K=`agent:${H.id}:${H.timestamp}:${F.text}`;if(b.has(K))continue;b.add(K),z.push(z0.parse({type:"agent",text:F.text,...H}));continue}if(F.type==="tool_use"){let K=typeof F.id==="string"?F.id:"",W=typeof F.name==="string"?F.name:null,V=F.input??void 0,N={type:"tool-call",toolName:W,...H,input:V},L=z0.parse(N),M=Xb(L,Q);if(z.push(M),K)G.set(K,{index:z.length-1,toolName:W});continue}if(F.type==="image")continue}}}if(J)z.push(z0.parse({type:"command",name:J.name,args:J.args,id:J.id,timestamp:J.timestamp}));return{messages:z,blobs:A}}function dL(_,z){let A=_.message;if(!A)return{texts:[],images:[],toolResults:[]};let G=A.content;if(typeof G==="string")return G?{texts:[G],images:[],toolResults:[]}:{texts:[],images:[],toolResults:[]};if(!Array.isArray(G))return{texts:[],images:[],toolResults:[]};let J=[],Y=[],X=[];for(let b of G){if(!b||typeof b!=="object")continue;if(typeof b==="string"){if(b)J.push(b);continue}let Q=b,$=typeof Q.type==="string"?Q.type:void 0;if($==="tool_result"){let H=Q,B=typeof H.tool_use_id==="string"?H.tool_use_id:void 0,Z=H.content,q=_.raw.toolUseResult??_.raw.tool_use_result;if(q)Z=q;let F=typeof H.error==="string"?H.error:void 0,K=H.is_error??H.isError,W=typeof K==="boolean"?K:typeof H.success==="boolean"?!H.success:void 0;X.push({callId:B,output:Z,error:F,isError:W});continue}if($==="text"&&typeof Q.text==="string"){if(Q.text)J.push(Q.text);continue}if($==="image"){let H=H6(Q,z);if(H&&typeof H==="object"&&H.type==="image"){let B=H.source;if(B?.type==="sha256"&&typeof B.sha256==="string")Y.push({sha256:B.sha256,mediaType:typeof B.mediaType==="string"?B.mediaType:"image/unknown"})}continue}for(let H of["content","text"]){let B=Q[H];if(typeof B==="string"&&B)J.push(B)}}return{texts:J,images:Y,toolResults:X}}function rL(_){return{id:_.message?.id,timestamp:_.timestamp,model:_.message?.model}}function Xb(_,z){if(!z)return _;let A=z.endsWith("/")?z:`${z}/`,G=(U)=>{if(U.startsWith(A))return`./${U.slice(A.length)}`;return U},J=(U)=>typeof U==="object"&&U!==null&&!Array.isArray(U),Y=(U)=>J(U)?{...U}:void 0,X=(U,O)=>{let P={...U};for(let S of O)delete P[S];return P},b=(U,O)=>{if(typeof U[O]==="string")U[O]=G(U[O])},Q=(U)=>typeof U==="number"&&Number.isFinite(U)?U:0,$=(U)=>{if(!Array.isArray(U))return U;return U.map((O)=>{if(J(O)){let P={...O};return delete P.activeForm,P}return O})},{toolName:H,input:B,output:Z}=_,q=B,F=Z,K=!1,W=!1,V=_.isError;switch(H){case"Write":{let U=Y(B);if(U)b(U,"file_path"),q=U,K=!0;let O=Y(Z);if(O){let P={};if(O.type!==void 0)P.type=O.type;F=P,W=!0}break}case"Read":{let U=Y(B);if(U)b(U,"file_path"),q=U,K=!0;let O=Y(Z);if(O){let P={};if(typeof O.type==="string")P.type=O.type;if(O.file&&J(O.file)){let S=O.file,v={};if(typeof S.content==="string")v.content=S.content;if(typeof S.numLines==="number")v.numLines=S.numLines;if(typeof S.startLine==="number")v.startLine=S.startLine;if(typeof S.totalLines==="number")v.totalLines=S.totalLines;if(Object.keys(v).length>0)P.file=v}F=P,W=!0}break}case"Edit":{let U=Y(B),O=Y(Z),P,S;if(O&&Array.isArray(O.structuredPatch)){let v=[];for(let i of O.structuredPatch)if(J(i)){if(S===void 0&&typeof i.oldStart==="number")S=i.oldStart;if(Array.isArray(i.lines)){for(let g of i.lines)if(typeof g==="string")v.push(g)}}if(v.length>0)P=`${v.join(`
56
56
  `)}
57
- `}if(S===void 0&&typeof Z==="string"){let y=Z.match(/^\s*(\d+)[→\t]/m);if(y)S=parseInt(y[1],10)}if(D){X(D,"file_path");let y=typeof D.old_string==="string"?D.old_string:typeof D.oldString==="string"?D.oldString:void 0,e=typeof D.new_string==="string"?D.new_string:typeof D.newString==="string"?D.newString:void 0,u=V===!0||V==="true"||typeof Z==="string"&&!Z.includes("has been updated")||L&&typeof L.type==="string"&&L.type==="error";if(!R&&!u&&y!==void 0&&e!==void 0){let g=y.split(`
58
- `),m=e.split(`
59
- `),d=[];for(let Z0 of g)d.push(`-${Z0}`);for(let Z0 of m)d.push(`+${Z0}`);R=`${d.join(`
57
+ `}if(S===void 0&&typeof Z==="string"){let v=Z.match(/^\s*(\d+)[→\t]/m);if(v)S=parseInt(v[1],10)}if(U){b(U,"file_path");let v=typeof U.old_string==="string"?U.old_string:typeof U.oldString==="string"?U.oldString:void 0,i=typeof U.new_string==="string"?U.new_string:typeof U.newString==="string"?U.newString:void 0,g=V===!0||V==="true"||typeof Z==="string"&&!Z.includes("has been updated")||O&&typeof O.type==="string"&&O.type==="error";if(!P&&!g&&v!==void 0&&i!==void 0){let f=v.split(`
58
+ `),u=i.split(`
59
+ `),d=[];for(let Z0 of f)d.push(`-${Z0}`);for(let Z0 of u)d.push(`+${Z0}`);P=`${d.join(`
60
60
  `)}
61
- `}if(delete D.old_string,delete D.new_string,delete D.oldString,delete D.newString,R)D.diff=R;if(S!==void 0&&S>0)D.lineOffset=S;F=D,q=!0}if(L){let y=Y(L,["filePath","newString","oldString","originalFile","structuredPatch","replaceAll"]);K=Object.keys(y).length>0?y:void 0,W=!0}break}case"Glob":case"Grep":{let D=J(Z);if(D&&Array.isArray(D.filenames))D.filenames=D.filenames.map((L)=>typeof L==="string"?b(L):L),delete D.numFiles,K=D,W=!0;break}case"Bash":{let D=J(B);if(D&&typeof D.command==="string"){let R=D.command.match(/^(?:bash|zsh)\s+-lc\s+['"](.*)['"]$/s);if(R)D.command=R[1];F=D,q=!0}let L=J(Z);if(L)delete L.stdoutLines,delete L.stderrLines,K=L,W=!0;break}case"Task":{let D=J(B);if(D)F=D,q=!0;let L=J(Z);if(L){let R={};for(let[S,y]of Object.entries(L)){if(S==="usage"&&G(y)){let e=y,u=Q(e.input_tokens??e.inputTokens),g=Q(e.cached_input_tokens??e.cachedInputTokens)+Q(e.cache_creation_input_tokens??e.cacheCreationInputTokens)+Q(e.cache_read_input_tokens??e.cacheReadInputTokens),m=Q(e.output_tokens??e.outputTokens),d=Q(e.reasoning_output_tokens??e.reasoningOutputTokens),Z0=e.total_tokens??e.totalTokens,S9=typeof Z0==="number"&&Number.isFinite(Z0)?Z0:u+g+m+d;R.usage={inputTokens:u,cachedInputTokens:g,outputTokens:m,reasoningOutputTokens:d,totalTokens:S9};continue}if(S==="usage"||S==="totalTokens"||S==="prompt")continue;R[S]=y}K=R,W=!0}break}case"TodoWrite":{let D=J(B);if(D){if(Array.isArray(D.todos))D.todos=$(D.todos);F=D,q=!0}let L=J(Z);if(L){let R={...L},S=!1;if(Array.isArray(R.newTodos))R.newTodos=$(R.newTodos),S=!0;if(Array.isArray(R.oldTodos))R.oldTodos=$(R.oldTodos),S=!0;K=S?R:L,W=S}break}case"BashOutput":{let D=J(Z);if(D)delete D.stdoutLines,delete D.stderrLines,K=D,W=!0;break}default:break}if(H==="KillShell"&&typeof V==="boolean")V=String(V);let w={..._};if(F!==void 0)F=M9(F,z);if(K!==void 0)K=M9(K,z);if(q||F!==B)if(typeof F>"u")delete w.input;else w.input=F;if(W||K!==Z)if(typeof K>"u")delete w.output;else w.output=K;if(typeof V>"u"){if(typeof w.error==="string"&&w.error.trim())V=!0;else if(typeof K==="string"&&/^error:/i.test(K.trim()))V=!0}if(typeof V<"u")w.isError=V;let O={},M=["id","input","model","output","timestamp","toolName","error","isError","type"];for(let D of M)if(Object.prototype.hasOwnProperty.call(w,D))O[D]=w[D];for(let D of Object.keys(w))if(!Object.prototype.hasOwnProperty.call(O,D))O[D]=w[D];return yY.parse(O)}import DL from"node:crypto";import D5 from"node:path";var M5={inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0},zX=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/openai/"],ML=200000,NL={shell:"Bash",exec_command:"Bash"},wL=["<user_instructions","<environment_context","# agents.md instructions for","<permissions instructions>"],EL=/^<image name=\[Image #\d+\]>$/i,OL=[/<image[^>]*>/gi,/<\/image>/gi,/\[\s*image\s*#?\d+\s*\]/gi];function O5(_,z={}){let A=LL(_);if(A.length===0)return null;let b=new Map,G=new Set,J=[],Y=[],X=new Map,Q=null,$=null,H=null,B,Z={...M5},F={...M5};for(let L of A){if(!L)continue;let{type:R,payload:S,timestamp:y}=L;if(y&&(!B||nL(y,B)>0))B=y;if(R==="session_meta"&&S){if(Q=jL(S),!$)$=Q.cwd;continue}if(R==="turn_context"&&S){let u=i(S.cwd);if(u)$=u;let g=i(S.model);if(g)H=aL(g);continue}if(R==="event_msg"&&S){if(i(S.type)==="token_count"){let g=AX(S.info,"last_token_usage"),m=AX(S.info,"total_token_usage"),d=null;if(g)d=g;else if(m)d={inputTokens:Math.max(0,m.inputTokens-F.inputTokens),cachedInputTokens:Math.max(0,m.cachedInputTokens-F.cachedInputTokens),outputTokens:Math.max(0,m.outputTokens-F.outputTokens),reasoningOutputTokens:Math.max(0,m.reasoningOutputTokens-F.reasoningOutputTokens),totalTokens:Math.max(0,m.totalTokens-F.totalTokens)};if(d)Z={inputTokens:Z.inputTokens+d.inputTokens,cachedInputTokens:Z.cachedInputTokens+d.cachedInputTokens,outputTokens:Z.outputTokens+d.outputTokens,reasoningOutputTokens:Z.reasoningOutputTokens+d.reasoningOutputTokens,totalTokens:Z.totalTokens+d.totalTokens};if(m)F=m}continue}if(R!=="response_item"||!S)continue;switch(i(S.type)){case"message":{let u=i(S.role);if(u==="user"){let{texts:g,images:m}=SL(S.content,X),d=Y6(g.join(`
61
+ `}if(delete U.old_string,delete U.new_string,delete U.oldString,delete U.newString,P)U.diff=P;if(S!==void 0&&S>0)U.lineOffset=S;q=U,K=!0}if(O){let v=X(O,["filePath","newString","oldString","originalFile","structuredPatch","replaceAll"]);F=Object.keys(v).length>0?v:void 0,W=!0}break}case"Glob":case"Grep":{let U=Y(Z);if(U&&Array.isArray(U.filenames))U.filenames=U.filenames.map((O)=>typeof O==="string"?G(O):O),delete U.numFiles,F=U,W=!0;break}case"Bash":{let U=Y(B);if(U&&typeof U.command==="string"){let P=U.command.match(/^(?:bash|zsh)\s+-lc\s+['"](.*)['"]$/s);if(P)U.command=P[1];q=U,K=!0}let O=Y(Z);if(O)delete O.stdoutLines,delete O.stderrLines,F=O,W=!0;break}case"Task":{let U=Y(B);if(U)q=U,K=!0;let O=Y(Z);if(O){let P={};for(let[S,v]of Object.entries(O)){if(S==="usage"&&J(v)){let i=v,g=Q(i.input_tokens??i.inputTokens),f=Q(i.cached_input_tokens??i.cachedInputTokens)+Q(i.cache_creation_input_tokens??i.cacheCreationInputTokens)+Q(i.cache_read_input_tokens??i.cacheReadInputTokens),u=Q(i.output_tokens??i.outputTokens),d=Q(i.reasoning_output_tokens??i.reasoningOutputTokens),Z0=i.total_tokens??i.totalTokens,C9=typeof Z0==="number"&&Number.isFinite(Z0)?Z0:g+f+u+d;P.usage={inputTokens:g,cachedInputTokens:f,outputTokens:u,reasoningOutputTokens:d,totalTokens:C9};continue}if(S==="usage"||S==="totalTokens"||S==="prompt")continue;P[S]=v}F=P,W=!0}break}case"TodoWrite":{let U=Y(B);if(U){if(Array.isArray(U.todos))U.todos=$(U.todos);q=U,K=!0}let O=Y(Z);if(O){let P={...O},S=!1;if(Array.isArray(P.newTodos))P.newTodos=$(P.newTodos),S=!0;if(Array.isArray(P.oldTodos))P.oldTodos=$(P.oldTodos),S=!0;F=S?P:O,W=S}break}case"BashOutput":{let U=Y(Z);if(U)delete U.stdoutLines,delete U.stderrLines,F=U,W=!0;break}default:break}if(H==="KillShell"&&typeof V==="boolean")V=String(V);let N={..._};if(q!==void 0)q=s0(q,z);if(F!==void 0)F=s0(F,z);if(K||q!==B)if(typeof q>"u")delete N.input;else N.input=q;if(W||F!==Z)if(typeof F>"u")delete N.output;else N.output=F;if(typeof V>"u"){if(typeof N.error==="string"&&N.error.trim())V=!0;else if(typeof F==="string"&&/^error:/i.test(F.trim()))V=!0}if(typeof V<"u")N.isError=V;let L={},M=["id","input","model","output","timestamp","toolName","error","isError","type"];for(let U of M)if(Object.prototype.hasOwnProperty.call(N,U))L[U]=N[U];for(let U of Object.keys(N))if(!Object.prototype.hasOwnProperty.call(L,U))L[U]=N[U];return $6.parse(L)}import nL from"node:crypto";import R5 from"node:path";var iL={read_file:"Read",write_to_file:"Write",replace_in_file:"Edit",execute_command:"Bash",search_files:"Grep",list_files:"Glob",list_code_definition_names:"Ls",load_mcp_documentation:"LoadMcpDocs",access_mcp_resource:"AccessMcpResource",focus_chain:"TodoWrite",web_fetch:"WebFetch",web_search:"WebSearch",ask_followup_question:"AskUserQuestion",use_subagents:"Task",attempt_completion:"AgentResponse",plan_mode_respond:"AgentResponse"},oL=/<environment_details|feedback>[\s\S]*?<\/environment_details|feedback>/g,aL=/^<task>\n?([\s\S]*?)\n?<\/task>/,sL=/^\[[\w_]+ for '[^']*'\] Result:\n?/;function x_(_,z={}){if(!Array.isArray(_)||_.length===0)return null;let A=new Map,G=[],J=new Map,Y=0,X=0,b=0,Q=new Map,$=null,H=z.clientVersion??z.metadata?.environment_history?.[0]?.cline_version??null,B=z.cwd??null;for(let U of _)if(U.role==="user")tL(U,G,J,A,B);else if(U.role==="assistant"){let O=U.modelInfo?$j(U.modelInfo.modelId,U.modelInfo.providerId):null;if(O&&!$)$=O;if(U.metrics?.tokens){let P=U.metrics.tokens,S=P.prompt??0,v=P.completion??0,i=P.cached??0;if(Y+=S+i,X+=v,b+=i,O){let g=Q.get(O)??{inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0};g.inputTokens+=S+i,g.cachedInputTokens+=i,g.outputTokens+=v,g.totalTokens+=S+i+v,Q.set(O,g)}}eL(U,O,G,J,A,B)}if(G.length===0)return null;let Z={inputTokens:Y,cachedInputTokens:b,outputTokens:X,reasoningOutputTokens:0,totalTokens:Y+X},q=Qj(Z),F=$?Zj($,Z,z.pricing):0,K=Xj(G),W=z.now??new Date,V=z.gitContext!==void 0?z.gitContext:null,N=B?D9(B):"",L=L4(G),M=z.taskId??`cline-${W.getTime()}`;return{transcript:Q4.parse({v:1,id:M,source:"cline",timestamp:W,preview:K,summary:null,model:$,clientVersion:H,blendedTokens:q,costUsd:F,messageCount:G.length,...L,tokenUsage:Z,modelUsage:Array.from(Q.entries()).map(([U,O])=>O4.parse({model:U,usage:O})),git:V,cwd:N,messages:G}),blobs:A}}function tL(_,z,A,G,J){for(let Y of _.content)if(Y.type==="text"){let X=P5(Y.text);if(!X)continue;if(sL.test(X))continue;let b=X.replace(oL,"").trim();if(!b)continue;let Q=b.match(aL),$=Q?Q[1].trim():b;if(!$)continue;if(Yj($))continue;z.push(z0.parse({type:"user",text:$}))}else if(Y.type==="tool_result"){let X=Y,b=A.get(X.tool_use_id);if(b!==void 0){let Q=z[b],$=_j(X.content);if(Q.output=$,X.is_error)Q.isError=!0;let H=Vb(Q,J);z[b]=H}}else if(Y.type==="image"){let b=zj(Y,G);if(b){let Q=z[z.length-1];if(Q&&Q.type==="user"){let $=Q,H=$.images??[];H.push(b),$.images=H}}}}function eL(_,z,A,G,J,Y){for(let X of _.content)if(X.type==="text"){let b=P5(X.text);if(!b)continue;A.push(z0.parse({type:"agent",text:b,model:z??void 0}))}else if(X.type==="tool_use"){let b=X,Q=Gj(b.name),$=Jj(Q,b.input,Y);if(Q==="AgentResponse"){let Z=$&&typeof $==="object"?$?.response:typeof $==="string"?$:void 0,q=P5(Z);if(q)A.push(z0.parse({type:"agent",text:q,model:z??void 0}));continue}let H=z0.parse({type:"tool-call",id:b.id,toolName:Q,input:$,model:z??void 0}),B=Vb(H,Y);G.set(b.id,A.length),A.push(B)}}function P5(_){if(typeof _==="string"){let z=_.trim();return z.length>0?z:null}if(_==null)return null;if(typeof _==="number"||typeof _==="boolean"||typeof _==="bigint")return String(_);if(typeof _==="object")try{let z=JSON.stringify(_);if(!z)return null;let A=z.trim();return A.length>0?A:null}catch{return String(_).trim()||null}return String(_).trim()||null}function _j(_){if(typeof _==="string")return _||void 0;if(Array.isArray(_)){let z=[];for(let A of _)if(A.type==="text"&&A.text)z.push(A.text);return z.length>0?z.join(`
62
+ `):void 0}return}function zj(_,z){let A=_.source;if(!A?.data)return null;let G=A.media_type??A.mediaType??"image/unknown",J=Buffer.from(A.data,"base64"),Y=Aj(J);if(!z.has(Y))z.set(Y,{data:J,mediaType:G});return{sha256:Y,mediaType:G}}function Aj(_){return nL.createHash("sha256").update(_).digest("hex")}function Gj(_){return iL[_]??_}function Jj(_,z,A){if(!z||typeof z!=="object")return z;let G={...z};if(delete G.task_progress,typeof G.path==="string"&&A)G.file_path=Wb(G.path,A),delete G.path;if(typeof G.file_path==="string"&&A)G.file_path=Wb(G.file_path,A);if(_==="Write"&&typeof G.content==="string");if(_==="Edit"&&typeof G.diff==="string");if(_==="Bash"&&typeof G.command==="string");if(_==="Grep"){if(typeof G.regex==="string")G.pattern=G.regex,delete G.regex}if(_==="AskUserQuestion")G.answers={question:G.question,options:typeof G.options==="object"?{...G.options}:G.options},delete G.question,delete G.options;if(_==="AgentResponse")return G.response||G.result;return A?s0(G,A):G}function Vb(_,z){if(!z)return _;let{input:A,output:G}=_;A=s0(A,z),G=s0(G,z);let J={..._,input:A,output:G};return $6.parse(J)}function Wb(_,z){if(!_)return _;let A=R5.isAbsolute(_),G=_.replace(/\\/g,"/");if(!A){if(G==="."||G==="./")return".";if(G.startsWith("./")||G.startsWith("../"))return G;return`./${G}`}try{let J=R5.relative(z,_).replace(/\\/g,"/");if(J==="")return".";if(J.startsWith("..")||R5.isAbsolute(J))return _;return`./${J}`}catch{return _}}function Yj(_){if(_.includes("# TODO LIST UPDATE REQUIRED"))return!0;if(_.includes("# task_progress RECOMMENDED"))return!0;if(_.startsWith("[apply_patch for patch application]")||_.startsWith("[read_file for ")||_.startsWith("[write_to_file for ")||_.startsWith("[subagents] Result:")||_.includes("[ERROR] You did not use a tool"))return!0;if(_.startsWith("[replace_in_file for ")||_.startsWith("[execute_command for "))return!0;if(_.startsWith("[search_files for ")||_.startsWith("[list_files for "))return!0;if(_.startsWith("[list_code_definition_names for ")||_.startsWith("[access_mcp_resource for "))return!0;if(_.startsWith("[attempt_completion] ")||_.startsWith("[ask_followup_question] "))return!0;if(_.startsWith("[focus_chain] ")||_.startsWith("[plan_mode_respond] "))return!0;if(_.startsWith("[load_mcp_documentation] "))return!0;if(_.includes("# Current Mode")&&_.includes("environment_details"))return!0;if(_.startsWith("The user has provided feedback on the results."))return!0;return!1}function Xj(_){for(let z of _)if(z.type==="user"&&z.text)return bj(z.text);return null}function bj(_){return _.replace(/\s+/g," ").trim()}function Qj(_){return Math.max(0,_.inputTokens-_.cachedInputTokens)+_.outputTokens+_.reasoningOutputTokens}function $j(_,z){if(_.includes("/"))return _;return`${z}/${_}`}var Hj=["anthropic/","openai/","google/"],Bj=200000;function Zj(_,z,A){if(!A||!_)return 0;let G=qj(_,A);if(!G)return 0;return Fj({input_tokens:Math.max(0,z.inputTokens-z.cachedInputTokens),output_tokens:z.outputTokens,cache_read_input_tokens:z.cachedInputTokens},G)}function qj(_,z){let A=_.trim();if(!A)return null;let G=new Set;G.add(A);for(let J of Hj)G.add(`${J}${A}`);for(let J of G){let Y=z[J];if(Y)return Y}return null}function Fj(_,z){let A=(X,b,Q,$=Bj)=>{if(X==null||X<=0)return 0;if(X>$&&Q!=null){let H=Math.min(X,$),Z=Math.max(0,X-$)*Q;if(b!=null)Z+=H*b;return Z}if(b!=null)return X*b;return 0},G=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),J=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),Y=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return G+J+Y}import Kj from"node:crypto";import S5 from"node:path";var k5={inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0},Ub=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/openai/"],Wj=200000,Vj={shell:"Bash",exec_command:"Bash"},Uj=["<user_instructions","<environment_context","# agents.md instructions for","<permissions instructions>"],Dj=/^<image name=\[Image #\d+\]>$/i,Mj=[/<image[^>]*>/gi,/<\/image>/gi,/\[\s*image\s*#?\d+\s*\]/gi];function C5(_,z={}){let A=Nj(_);if(A.length===0)return null;let G=new Map,J=new Set,Y=[],X=[],b=new Map,Q=null,$=null,H=null,B,Z={...k5},q={...k5};for(let O of A){if(!O)continue;let{type:P,payload:S,timestamp:v}=O;if(v&&(!B||lj(v,B)>0))B=v;if(P==="session_meta"&&S){if(Q=Ej(S),!$)$=Q.cwd;continue}if(P==="turn_context"&&S){let g=o(S.cwd);if(g)$=g;let f=o(S.model);if(f)H=rj(f);continue}if(P==="event_msg"&&S){if(o(S.type)==="token_count"){let f=Db(S.info,"last_token_usage"),u=Db(S.info,"total_token_usage"),d=null;if(f)d=f;else if(u)d={inputTokens:Math.max(0,u.inputTokens-q.inputTokens),cachedInputTokens:Math.max(0,u.cachedInputTokens-q.cachedInputTokens),outputTokens:Math.max(0,u.outputTokens-q.outputTokens),reasoningOutputTokens:Math.max(0,u.reasoningOutputTokens-q.reasoningOutputTokens),totalTokens:Math.max(0,u.totalTokens-q.totalTokens)};if(d)Z={inputTokens:Z.inputTokens+d.inputTokens,cachedInputTokens:Z.cachedInputTokens+d.cachedInputTokens,outputTokens:Z.outputTokens+d.outputTokens,reasoningOutputTokens:Z.reasoningOutputTokens+d.reasoningOutputTokens,totalTokens:Z.totalTokens+d.totalTokens};if(u)q=u}continue}if(P!=="response_item"||!S)continue;switch(o(S.type)){case"message":{let g=o(S.role);if(g==="user"){let{texts:f,images:u}=Lj(S.content,b),d=Z6(f.join(`
62
63
 
63
- `));if(!d&&m.length===0)break;if(d&&cL(d))break;if(d)Y.push(d);let Z0=i(S.id),S9={type:"user",timestamp:y,text:d||""};if(Z0)S9.id=Z0;if(m.length>0)S9.images=m;w5(S9,J,G)}else if(u==="assistant"){let g=RL(S.content,!0);if(g.length===0)break;let m=g.join(`
64
+ `));if(!d&&u.length===0)break;if(d&&fj(d))break;if(d)X.push(d);let Z0=o(S.id),C9={type:"user",timestamp:v,text:d||""};if(Z0)C9.id=Z0;if(u.length>0)C9.images=u;x5(C9,Y,J)}else if(g==="assistant"){let f=wj(S.content,!0);if(f.length===0)break;let u=f.join(`
64
65
 
65
- `).trim();if(!m)break;let d=i(S.id),Z0={type:"agent",timestamp:y,model:H??void 0,text:m};if(d)Z0.id=d;w5(Z0,J,G)}break}case"reasoning":{let u=IL(S);for(let g of u){let m=i(S.id),d={type:"thinking",timestamp:y,model:H??void 0,text:g};if(m)d.id=m;w5(d,J,G)}break}case"function_call":{let u=i(S.call_id)??i(S.id)??void 0,g=i(S.name),m=YX(g),d=N5(S.arguments),Z0=xL(d,$),S9=Y0.parse({type:"tool-call",id:u,timestamp:y,model:H??void 0,toolName:m,input:Z0}),lV=E5(S9,$,g);b.set(u??"",{index:J.push(lV)-1,rawName:g});break}case"function_call_output":{let u=i(S.call_id);if(!u)break;let g=b.get(u);if(!g)break;let m=N5(S.output),d=GX(J[g.index],m,$,g.rawName);J[g.index]=d;break}case"custom_tool_call":{let u=i(S.call_id)??i(S.id)??void 0,g=i(S.name),m=YX(g),d=TL(g,S.input,$),Z0=Y0.parse({type:"tool-call",id:u,timestamp:y,model:H??void 0,toolName:m,input:d}),S9=E5(Z0,$,g);b.set(u??"",{index:J.push(S9)-1,rawName:g});break}case"custom_tool_call_output":{let u=i(S.call_id);if(!u)break;let g=b.get(u);if(!g)break;let m=N5(S.output),d=GX(J[g.index],m,$,g.rawName);J[g.index]=d;break}default:break}}if(J.length===0)return null;let K=iL(B)??z.now??new Date,q=lL(Y),W=Z??{...M5},V=uL(W),w=sL(H,W,z.pricing),O=z.gitContext!==void 0?z.gitContext:pL(Q,$),M=$?h9($):"",P=N_(J);return{transcript:o4.parse({v:1,id:Q?.id??J[0]?.id??oL(K),source:"codex",timestamp:K,preview:q,summary:null,model:H,clientVersion:z.clientVersion??Q?.cliVersion??null,blendedTokens:V,costUsd:w,messageCount:J.length,...P,tokenUsage:W,modelUsage:H?[M_.parse({model:H,usage:W})]:[],git:O,cwd:M,messages:J}),blobs:X}}function LL(_){let z=[];for(let A of _){if(!A||typeof A!=="object")continue;let b=A,G=i(b.type);if(!G)continue;let J=i(b.timestamp)??void 0,Y=b.payload&&typeof b.payload==="object"?b.payload:null;z.push({type:G,timestamp:J,payload:Y})}return z}function jL(_){let z=_.git??{};return{id:i(_.id),cwd:i(_.cwd),cliVersion:i(_.cli_version??_.cliVersion),git:{branch:i(z.branch),repositoryUrl:i(z.repository_url??z.repositoryUrl)}}}function AX(_,z="total_token_usage"){if(!_||typeof _!=="object")return null;let A=_,b;if(z==="last_token_usage")b=A.last_token_usage??A.lastTokenUsage??A.total_token_usage??A.totalTokenUsage;else b=A.total_token_usage??A.totalTokenUsage??A.last_token_usage??A.lastTokenUsage;if(!b||typeof b!=="object")return null;let G=b;return{inputTokens:E4(G.input_tokens??G.inputTokens),cachedInputTokens:E4(G.cached_input_tokens??G.cachedInputTokens),outputTokens:E4(G.output_tokens??G.outputTokens),reasoningOutputTokens:E4(G.reasoning_output_tokens??G.reasoningOutputTokens),totalTokens:E4(G.total_tokens??G.totalTokens)}}function RL(_,z=!1){let A=(G)=>{if(z)return G.trim();return Y6(G)};if(typeof _==="string"){let G=A(_);return G?[G]:[]}if(!Array.isArray(_))return[];let b=[];for(let G of _){if(!G)continue;if(typeof G==="string"){let J=A(G);if(J)b.push(J);continue}if(typeof G==="object"){let J=G,Y=i(J.text??J.content);if(Y){let X=A(Y);if(X)b.push(X)}}}return b}function PL(_){return DL.createHash("sha256").update(_).digest("hex")}function SL(_,z){let A=[],b=[],G=(J)=>{if(!J)return;let Y=kL(J),X=Y.trim();if(!X||EL.test(X))return;A.push(Y)};if(typeof _==="string")return G(_),{texts:A,images:b};if(!Array.isArray(_))return{texts:A,images:b};for(let J of _){if(!J)continue;if(typeof J==="string"){G(J);continue}if(typeof J!=="object")continue;let Y=J,X=i(Y.type);if(X==="input_text"||X==="text"||X==="output_text"){G(i(Y.text??Y.content));continue}if(X==="input_image"||X==="image"){let Q=bX(Y,z);if(Q)b.push(Q);continue}if(Y.image_url||Y.imageUrl||Y.url){let Q=bX(Y,z);if(Q){b.push(Q);continue}}G(i(Y.text??Y.content))}return{texts:A,images:b}}function kL(_){let z=_;for(let A of OL)z=z.replace(A,"");return z}function bX(_,z){let A=_.image_url??_.imageUrl??_.url,b=typeof A==="string"?A:A&&typeof A==="object"?i(A.url):void 0;if(!b)return null;let G=b.match(/^data:([^;]+);base64,([\s\S]+)$/);if(!G)return null;let J=G[1]||"image/unknown",Y=G[2];if(!Y)return null;let X=Buffer.from(Y,"base64"),Q=PL(X);if(!z.has(Q))z.set(Q,{data:X,mediaType:J});return{sha256:Q,mediaType:J}}function IL(_){let z=[],A=_.summary;if(Array.isArray(A)){for(let G of A)if(G&&typeof G==="object"){let J=i(G.text);if(J)z.push(J)}}let b=_.content;if(Array.isArray(b)){for(let G of b)if(G&&typeof G==="object"){let J=G;if(i(J.type)==="reasoning"||i(J.type)==="text"){let Y=i(J.text??J.content);if(Y)z.push(Y)}}}return z}function N5(_){let z=i(_);if(!z)return _;try{return JSON.parse(z)}catch{return _}}function xL(_,z){if(!_||typeof _!=="object")return _;let A={..._};if(typeof A.workdir==="string"&&z)A.workdir=w_(A.workdir,z);return A}function TL(_,z,A){if(!z)return z;if(_==="apply_patch"){let b=i(z);if(!b)return z;let G=mL(b,A);if(G.diff||G.file_path)return G}return z}function GX(_,z,A,b){if(_.type!=="tool-call")return _;let G=z;if(b==="shell")G=XX(z);else if(b==="exec_command")G=fL(z);else if(b==="apply_patch")G=hL(z);let J={..._,output:G};if(b==="shell"||b==="exec_command"){let Y=CL(J,A);if(Y)return Y}return E5(J,A,b)}function CL(_,z){if(_.type!=="tool-call"||!_.input)return null;let A=_.input,b=null;if(typeof A.cmd==="string")b=A.cmd;else if(typeof A.command==="string")b=A.command;else if(Array.isArray(A.command)&&A.command.length>=3){let X=A.command[0];if((X==="bash"||X==="zsh"||X==="/bin/zsh"||X==="/bin/bash")&&A.command[1]==="-lc")b=i(A.command[2])}if(!b)return null;let G=b.match(/^cat\s+<<'EOF'\s+>\s+(\S+)\s*\n([\s\S]*?)EOF$/);if(G){let[,X,Q]=G,$=z?w_(`${z}/${X}`,z):`./${X}`;return Y0.parse({..._,toolName:"Write",input:{file_path:$,content:Q||""},output:void 0})}let J=b.match(/^cat\s+(\S+)$/);if(J){let[,X]=J,Q=z?w_(`${z}/${X}`,z):`./${X}`,$;if(_.output&&typeof _.output==="object"){let H=_.output;$=i(H.stdout)??void 0}return Y0.parse({..._,toolName:"Read",input:{file_path:Q},output:$})}let Y=vL(b);if(Y.length>0&&Y[0]==="rg"){let X=yL(Y,z);if(X){let Q=JX(_.output),$;if(Q){let H=Q.split(`
66
- `).filter((B)=>B.trim().length>0);if(X.input.output_mode==="files_with_matches")$={mode:"files_with_matches",filenames:H,numMatches:H.length};else $={mode:"content",content:Q,numMatches:H.length,numLines:H.length}}return Y0.parse({..._,toolName:"Grep",input:X.input,output:$})}}if(Y.length>=4&&Y[0]==="sed"){let X=gL(Y,z);if(X){let{filePath:Q,startLine:$}=X,H=JX(_.output),B;if(H){let Z=H.split(`
67
- `).length;B={file:{content:H,numLines:Z,startLine:$}}}return Y0.parse({..._,toolName:"Read",input:{file_path:Q},output:B})}}return null}function vL(_){let z=[],A="",b=null,G=!1;for(let J of _){if(G){A+=J,G=!1;continue}if(J==="\\"&&b!=="'"){G=!0;continue}if(b){if(J===b)b=null;else A+=J;continue}if(J==="'"||J==='"'){b=J;continue}if(/\s/.test(J)){if(A.length>0)z.push(A),A="";continue}A+=J}if(A.length>0)z.push(A);return z}function JX(_){if(typeof _==="string")return _;if(_&&typeof _==="object"){let A=i(_.stdout);if(A)return A}return}function yL(_,z){if(_.length<2)return null;let A={},b=null,G=null;for(let J=1;J<_.length;J+=1){let Y=_[J];if(Y==="--")continue;if(Y.startsWith("-")){switch(Y){case"-i":A["-i"]=!0;break;case"-U":A.multiline=!0;break;case"-A":case"-B":case"-C":{let X=_[J+1];if(X)A[Y]=X,J+=1;break}case"-l":case"--files-with-matches":A.output_mode="files_with_matches";break;case"-c":case"--count":A.output_mode="count";break;case"-g":case"--glob":{let X=_[J+1];if(X)A.glob=X,J+=1;break}case"-t":case"--type":{let X=_[J+1];if(X)A.type=X,J+=1;break}case"-e":case"--regexp":{let X=_[J+1];if(X)b=X,J+=1;break}default:break}continue}if(!b){b=Y;continue}if(!G){G=Y;continue}}if(!b)return null;if(A.pattern=b,G)A.path=z?w_(G,z):G;return{input:A}}function gL(_,z){let A=_.indexOf("-n");if(A===-1)return null;let b=_[A+1],G=_[A+2];if(!b||!G)return null;let J=b.match(/^(\d+)(?:,(\d+))?p$/);if(!J)return null;let Y=parseInt(J[1],10);if(!Number.isFinite(Y)||Y<=0)return null;return{filePath:z?w_(G,z):G,startLine:Y}}function E5(_,z,A){if(_.type!=="tool-call")return _;let{toolName:b,input:G,output:J}=_;if(A==="shell"||A==="exec_command"){if(b="Bash",G&&typeof G==="object"){let Y=G,X={},Q=null;if(typeof Y.cmd==="string")Q=Y.cmd;else if(Array.isArray(Y.command)&&Y.command.length>=3){let $=Y.command[0];if(($==="bash"||$==="zsh"||$==="/bin/zsh"||$==="/bin/bash")&&Y.command[1]==="-lc")Q=i(Y.command[2])}else if(typeof Y.command==="string")Q=Y.command;if(Q)X.command=Q;if(typeof Y.description==="string")X.description=Y.description;G=X}}if(A==="apply_patch"){if(b="Edit",G&&typeof G==="object"){let Y={...G},X=i(Y.file_path);if(X&&z)Y.file_path=w_(X,z);G=Y}}if(z)G=M9(G,z),J=M9(J,z);return Y0.parse({..._,toolName:b,input:G,output:J})}function XX(_){if(!_||typeof _!=="object")return _;let z=_,A={},b=i(z.output??z.stdout);if(typeof z.stdout==="string")A.stdout=z.stdout;else if(b)A.stdout=b;let G=i(z.stderr);if(G)A.stderr=G;let J=z.metadata&&typeof z.metadata==="object"?z.metadata:{},Y=E4(J.exit_code??J.exitCode??z.exit_code??z.exitCode);if(Number.isFinite(Y))A.exitCode=Y;let X=E4(J.duration_seconds??J.durationSeconds);if(Number.isFinite(X)&&X>0)A.durationSeconds=X;return Object.keys(A).length>0?A:void 0}function fL(_){let z=i(_);if(!z)return XX(_);let A={},b=z.match(/Process exited with code (\d+)/);if(b)A.exitCode=parseInt(b[1],10);let G=z.match(/Wall time: ([\d.]+) seconds/);if(G){let Y=parseFloat(G[1]);if(Y>0)A.durationSeconds=Y}let J=z.match(/Output:\n([\s\S]*?)$/);if(J&&J[1]){let Y=J[1].trim();if(Y)A.stdout=Y}return Object.keys(A).length>0?A:void 0}function hL(_){if(!_||typeof _!=="object")return _;let z=_,A={},b=i(z.output);if(b)A.message=b;let G=z.metadata&&typeof z.metadata==="object"?z.metadata:null;if(G){let J=E4(G.exit_code??G.exitCode);if(Number.isFinite(J))A.exitCode=J;let Y=E4(G.duration_seconds??G.durationSeconds);if(Number.isFinite(Y)&&Y>0)A.durationSeconds=Y}return Object.keys(A).length>0?A:void 0}function mL(_,z){let A=_.split(/\r?\n/),b=null,G=[];for(let X of A){if(X.startsWith("*** ")){let Q=X.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/);if(Q&&Q[1])b=Q[1].trim();continue}G.push(X)}let J=G.join(`
68
- `).trim(),Y={};if(b)Y.file_path=z?w_(b,z):b;if(J)Y.diff=J.endsWith(`
69
- `)?J:`${J}
70
- `;return Y}function w_(_,z){if(!_)return _;let A=D5.isAbsolute(_),b=_.replace(/\\/g,"/");if(!A){if(b==="."||b==="./")return".";if(b.startsWith("./")||b.startsWith("../"))return b;return`./${b}`}try{let G=D5.relative(z,_).replace(/\\/g,"/");if(G==="")return".";if(G.startsWith("..")||D5.isAbsolute(G))return _;return G==="."?".":`./${G}`}catch{return _}}function uL(_){return Math.max(0,_.inputTokens-_.cachedInputTokens)+_.outputTokens+_.reasoningOutputTokens}function cL(_){let z=_.trim().toLowerCase();return wL.some((A)=>z.startsWith(A))}function lL(_){for(let z of _){let A=Y6(z);if(!A)continue;if(A.startsWith("<user_instructions>")||A.startsWith("<environment_context>"))continue;return A}return _.length>0?Y6(_[0]):null}function pL(_,z){let A=z??_?.cwd??null;if(!_)return t0.parse({repo:null,branch:null,relativeCwd:null});let b=_.git.repositoryUrl?K8(_.git.repositoryUrl):null,G=_.git.branch,J=b?b.split("/").pop()??null:null,Y=dL(A,J);return t0.parse({repo:b,branch:G,relativeCwd:Uz(Y)})}function dL(_,z){if(!_)return null;let b=_.replace(/\\/g,"/").split("/").filter(Boolean);if(b.length===0)return null;if(z){let G=b.lastIndexOf(z);if(G>=0){let J=b.slice(G+1).join("/");return J.length>0?J:"."}}return null}function w5(_,z,A){let b=rL(_);if(b&&A.has(b))return;let G=Y0.parse(_);if(z.push(G),b)A.add(b)}function rL(_){if("text"in _&&typeof _.text==="string")return`${_.type}|${_.timestamp??""}|${_.text}`;if(_.type==="tool-call")return`${_.type}|${_.timestamp??""}|${_.id??""}|${_.toolName??""}`;return null}function YX(_){if(!_)return _;return NL[_]??_}function nL(_,z){let A=Date.parse(_),b=Date.parse(z);if(Number.isNaN(A)||Number.isNaN(b))return 0;return A===b?0:A>b?1:-1}function iL(_){if(!_)return null;let z=new Date(_);return Number.isNaN(z.getTime())?null:z}function E4(_){return typeof _==="number"&&Number.isFinite(_)?_:0}function i(_){if(typeof _!=="string")return null;let z=_.trim();return z.length>0?z:null}function Y6(_){return _.replace(/\s+/g," ").trim()}function oL(_){return`codex-${_.getTime()}`}function aL(_){if(_.includes("/"))return _;return`openai/${_}`}function sL(_,z,A){if(!A||!_)return 0;let b=tL(_,A);if(!b)return 0;return eL({input_tokens:Math.max(0,z.inputTokens-z.cachedInputTokens),output_tokens:z.outputTokens+z.reasoningOutputTokens,cache_creation_input_tokens:0,cache_read_input_tokens:z.cachedInputTokens},b)}function tL(_,z){let A=_.trim();if(!A)return null;let b=new Set;b.add(A);for(let J of zX)b.add(`${J}${A}`);for(let J of zX)if(A.startsWith(J))b.add(A.slice(J.length));for(let J of b){let Y=z[J];if(Y)return Y}let G=A.toLowerCase();for(let[J,Y]of Object.entries(z)){let X=J.toLowerCase();if(X.includes(G)||G.includes(X))return Y}return null}function eL(_,z){let A=(X,Q,$,H=ML)=>{if(X==null||X<=0)return 0;if(X>H&&$!=null){let B=Math.min(X,H),F=Math.max(0,X-H)*$;if(Q!=null)F+=B*Q;return F}if(Q!=null)return X*Q;return 0},b=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),G=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),J=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),Y=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return b+G+J+Y}import Dz from"node:path";var L5={shell:"Bash",bash:"Bash",execute:"Bash",read_file:"Read",read:"Read",write_file:"Write",write:"Write",edit_file:"Edit",edit:"Edit",apply_patch:"Edit",multiedit:"Edit",glob:"Glob",grep:"Grep",find:"Glob",list_files:"Glob",ls:"Glob",webfetch:"WebFetch",websearch:"WebSearch",task:"Task",explore:"Explore",skill:"Skill",todowrite:"TodoWrite",todoread:"TodoRead",question:"Question",plan:"Plan",codesearch:"CodeSearch",lsp:"LSP"},_j=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/","google/","gemini/"],zj=200000;function E_(_,z={}){let{info:A,messages:b}=_;if(!b||b.length===0)return null;let G=z.cwd??A.directory??null,J=[],Y=[],X=null,Q=0,$=0,H=0,B=0,Z=0,F=[...b].sort((L,R)=>{return L.info.time.created-R.info.time.created});for(let L of F){let R=L.info,S=Gj(R);if(R.role==="assistant"&&S&&!X)X=S;if(R.role==="assistant"&&R.tokens)$+=R.tokens.input??0,H+=R.tokens.output??0,B+=R.tokens.reasoning??0,Z+=R.tokens.cache?.read??0;if(R.role==="assistant"&&R.cost)Q+=R.cost;for(let y of L.parts){if(y.type==="step-start"||y.type==="step-finish")continue;let e=new Date(R.time.created).toISOString();switch(y.type){case"text":{let u=y.text?.trim();if(!u)break;if(R.role==="user")Y.push(u),J.push(Y0.parse({type:"user",text:u,id:R.id,timestamp:e}));else J.push(Y0.parse({type:"agent",text:u,id:R.id,timestamp:e,model:S??void 0}));break}case"reasoning":{let u=y.text?.trim();if(!u)break;J.push(Y0.parse({type:"thinking",text:u,timestamp:e,model:S??void 0}));break}case"tool":{let u=y.state??{},g=u.input;if(y.tool==="todoread")break;let m=Aj(y.tool);if(m==="Task"&&g?.subagent_type&&typeof g.subagent_type==="string")m=bj(g.subagent_type);let d=Qj(m,u.input,G,u.metadata),Z0=$j(y.tool,m,u.output,u.metadata,G);J.push(Y0.parse({type:"tool-call",id:y.callID,timestamp:e,model:S??void 0,toolName:m,input:d,output:Z0,error:u.error,isError:u.status==="error"||!!u.error}));break}}}}if(J.length===0)return null;let K={inputTokens:$,cachedInputTokens:Z,outputTokens:H,reasoningOutputTokens:B,totalTokens:$+H},q=K.inputTokens+K.outputTokens,W=Q>0?Q:Hj(X,K,z.pricing),V=new Date(A.time.created),w=Yj(Y),O=z.gitContext!==void 0?z.gitContext:t0.parse({repo:null,branch:null,relativeCwd:Jj(F)}),M=G?h9(G):null,P=N_(J);return o4.parse({v:1,id:A.id,source:"opencode",timestamp:V,preview:w,summary:null,model:X,clientVersion:z.clientVersion??A.version??null,blendedTokens:q,costUsd:W,messageCount:J.length,...P,tokenUsage:K,modelUsage:X?[M_.parse({model:X,usage:K})]:[],git:O,cwd:M,messages:J})}function Aj(_){let z=_.toLowerCase();return L5[z]??_}function bj(_){let z=_.toLowerCase();if(L5[z])return L5[z];return _.charAt(0).toUpperCase()+_.slice(1)}function Gj(_){let z=_.modelID??_.model?.modelID,A=_.providerID??_.model?.providerID;if(!z)return null;if(A)return`${A}/${z}`;return z}function Jj(_){for(let z of _){let A=z.info.path;if(A?.root&&A?.cwd){if(A.root===A.cwd)return null;try{let b=Dz.relative(A.root,A.cwd).replace(/\\/g,"/");if(b&&!b.startsWith("..")&&!Dz.isAbsolute(b))return b}catch{}}}return null}function Yj(_){for(let z of _){let A=z.trim().replace(/\s+/g," ");if(!A)continue;if(A.startsWith("<")&&A.includes(">"))continue;return A.replace(/^["']|["']$/g,"")}return _.length>0?_[0].trim().replace(/\s+/g," "):null}function Xj(_){let z=_,A=z.match(/<file>\n?([\s\S]*?)\n?<\/file>/);if(A)z=A[1];return z=z.replace(/\n?\(End of file - total \d+ lines\)\n?$/,""),z.split(`
71
- `).map((J)=>{let Y=J.match(/^\d+\| (.*)$/);return Y?Y[1]:J}).join(`
72
- `)}function QX(_){if(!_)return _;let z=_.split(`
73
- `),A=[],b=!1;for(let G of z){if(G.startsWith("Index: ")||G.startsWith("===")||G.startsWith("--- ")||G.startsWith("+++ "))continue;if(G.startsWith("@@")){b=!0;continue}if(b)A.push(G)}return A.join(`
74
- `).trim()||void 0}function Qj(_,z,A,b){if(!z||typeof z!=="object")return z;let G={...z};if(_==="Edit"&&typeof G.patchText==="string"&&b?.files){let J=b.files;if(J.length===1){let Y=J[0];return{file_path:Y.relativePath??(A&&Y.filePath?a4(Y.filePath,A):Y.filePath),diff:QX(Y.diff),type:Y.type}}else if(J.length>1)return{files:J.map((Y)=>({file_path:Y.relativePath??(A&&Y.filePath?a4(Y.filePath,A):Y.filePath),type:Y.type,diff:QX(Y.diff)}))}}if(typeof G.filePath==="string")G.file_path=A?a4(G.filePath,A):G.filePath,delete G.filePath;else if(typeof G.file_path==="string"&&A)G.file_path=a4(G.file_path,A);if(_==="Grep"&&typeof G.include==="string")G.glob=G.include,delete G.include;if((_==="Glob"||_==="Grep")&&typeof G.path==="string")delete G.path;else if(typeof G.path==="string"&&A)G.path=a4(G.path,A);if(typeof G.workdir==="string"&&A)G.workdir=a4(G.workdir,A);return A?M9(G,A):G}function $j(_,z,A,b,G){let J=A;if(z==="Bash"&&b){let Y={};if(typeof b.output==="string")Y.stdout=b.output;if(typeof b.exit==="number")Y.exitCode=b.exit;if(typeof b.description==="string")Y.description=b.description;J=Object.keys(Y).length>0?Y:A}else if(z==="Read"){let Y=b?.preview??(typeof A==="string"?Xj(A):null);if(Y){let X=Y.split(`
75
- `).length;J={file:{content:Y,numLines:X,totalLines:X}}}}else if(z==="Glob"){let X=(typeof A==="string"?A:"").split(`
76
- `).map((Q)=>Q.trim()).filter(Boolean).map((Q)=>G?a4(Q,G):Q);J={filenames:X,numFiles:b?.count??X.length}}else if(z==="Grep"){let X=(typeof A==="string"?A:"").split(`
77
- `),Q=b?.matches??0,$=X.slice(1).filter((H)=>H.trim());J={mode:"content",content:$.join(`
78
- `),numMatches:Q,numLines:$.length}}else if(_==="apply_patch"&&b?.files){let Y=b.files;if(Y.length===1){let X=Y[0];J={additions:X.additions,deletions:X.deletions}}else J={files:Y.map((X)=>({file_path:X.relativePath??(G&&X.filePath?a4(X.filePath,G):X.filePath),additions:X.additions,deletions:X.deletions}))}}else if(z==="Edit"&&b?.filediff)J={diff:b.diff,additions:b.filediff.additions,deletions:b.filediff.deletions};else if(z==="Write"&&b)J={created:!b.exists};else if(z==="Explore")J={content:(typeof A==="string"?A:"").replace(/<task_metadata>[\s\S]*?<\/task_metadata>/g,"").trim()};else if(z==="Skill")J={content:typeof A==="string"?A:""};else if(z==="WebFetch")J={content:typeof A==="string"?A:""};else if(z==="TodoWrite"||z==="TodoRead")J={todos:b?.todos??[]};return G?M9(J,G):J}function a4(_,z){if(!_)return _;let A=Dz.isAbsolute(_),b=_.replace(/\\/g,"/");if(!A){if(b==="."||b==="./")return".";if(b.startsWith("./")||b.startsWith("../"))return b;return`./${b}`}try{let G=Dz.relative(z,_).replace(/\\/g,"/");if(G==="")return".";if(G.startsWith("..")||Dz.isAbsolute(G))return _;return G==="."?".":`./${G}`}catch{return _}}function Hj(_,z,A){if(!A||!_)return 0;let b=Bj(_,A);if(!b)return 0;return Zj({input_tokens:z.inputTokens,output_tokens:z.outputTokens,cache_creation_input_tokens:0,cache_read_input_tokens:z.cachedInputTokens},b)}function Bj(_,z){let A=_.trim();if(!A)return null;let b=new Set;b.add(A);for(let J of _j)b.add(`${J}${A}`);for(let J of b){let Y=z[J];if(Y)return Y}let G=A.toLowerCase();for(let[J,Y]of Object.entries(z)){let X=J.toLowerCase();if(X.includes(G)||G.includes(X))return Y}return null}function Zj(_,z){let A=(X,Q,$,H=zj)=>{if(X==null||X<=0)return 0;if(X>H&&$!=null){let B=Math.min(X,H),F=Math.max(0,X-H)*$;if(Q!=null)F+=B*Q;return F}if(Q!=null)return X*Q;return 0},b=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),G=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),J=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),Y=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return b+G+J+Y}import Fj from"node:crypto";var Kj={read:"Read",write:"Write",edit:"Edit",bash:"Bash",grep:"Grep",find:"Glob",ls:"Ls"};function O_(_,z={}){let{header:A,entries:b}=_;if(b.length===0)return null;let G=z.leafId??qj(b);if(!G)return null;let J=Wj(b,G);if(J.length===0)return null;let Y=Vj(b,G),X=Y?`${A.id}-${Y}`:A.id,Q=z.cwd??A.cwd,{messages:$,blobs:H,tokenUsage:B,modelUsageMap:Z,primaryModel:F,cwd:K}=Uj(J,Q);if($.length===0)return null;let q=Lj($),W=Rj(A.timestamp)??z.now??new Date,V=Pj(B),w=B.cost??Ij(F,B,z.pricing),O=z.gitContext!==void 0?z.gitContext:null,M=K?h9(K):"",P=N_($);return{transcript:o4.parse({v:1,id:X,source:"pi",timestamp:W,preview:q,summary:null,model:F,clientVersion:z.clientVersion??null,blendedTokens:V,costUsd:w,messageCount:$.length,...P,tokenUsage:{inputTokens:B.inputTokens,cachedInputTokens:B.cachedInputTokens,outputTokens:B.outputTokens,reasoningOutputTokens:B.reasoningOutputTokens,totalTokens:B.totalTokens},modelUsage:Array.from(Z.entries()).map(([L,R])=>M_.parse({model:L,usage:R})),git:O,cwd:M,messages:$}),blobs:H}}function qj(_){let z=new Set;for(let b of _)if(b.parentId)z.add(b.parentId);let A=null;for(let b of _)if(!z.has(b.id)){if(!A||b.timestamp>A.timestamp)A={id:b.id,timestamp:b.timestamp}}return A?.id??null}function Wj(_,z){let A=new Map(_.map((J)=>[J.id,J])),b=[],G=z;while(G){let J=A.get(G);if(!J)break;b.unshift(J),G=J.parentId}return b}function Vj(_,z){let A=new Map;for(let J of _){let Y=A.get(J.parentId)??[];Y.push(J.id),A.set(J.parentId,Y)}let b=new Map(_.map((J)=>[J.id,J])),G=z;while(G){let J=b.get(G);if(!J)break;let Y=J.parentId;if((A.get(Y)??[]).length>1)return G;G=Y}return null}function Uj(_,z){let A={messages:[],blobs:new Map,tokenUsage:{inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0,cost:0},modelUsageMap:new Map,primaryModel:null,cwd:z,toolCallsById:new Map};for(let b of _)if(b.type==="message")Dj(b,A);else if(b.type==="compaction")Mj(b,A);return A}function Dj(_,z){let{message:A,timestamp:b}=_,G=z.cwd;switch(A.role){case"user":{let{text:J,images:Y}=Nj(A.content,z.blobs);if(J||Y.length>0){let X={type:"user",text:J||"",timestamp:b};if(Y.length>0)X.images=Y;z.messages.push(Y0.parse(X))}break}case"assistant":{let J=`${A.provider}/${A.model}`;if(!z.primaryModel)z.primaryModel=J;if(A.usage){z.tokenUsage.inputTokens+=A.usage.input??0,z.tokenUsage.cachedInputTokens+=A.usage.cacheRead??0,z.tokenUsage.outputTokens+=A.usage.output??0,z.tokenUsage.totalTokens+=A.usage.totalTokens??0,z.tokenUsage.cost+=A.usage.cost?.total??0;let Y=z.modelUsageMap.get(J)??{inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0};Y.inputTokens+=A.usage.input??0,Y.cachedInputTokens+=A.usage.cacheRead??0,Y.outputTokens+=A.usage.output??0,Y.totalTokens+=A.usage.totalTokens??0,z.modelUsageMap.set(J,Y)}for(let Y of A.content)if(Y.type==="thinking"&&Y.thinking)z.messages.push(Y0.parse({type:"thinking",text:Y.thinking,timestamp:b,model:J}));else if(Y.type==="text"&&Y.text)z.messages.push(Y0.parse({type:"agent",text:Y.text,timestamp:b,model:J}));else if(Y.type==="toolCall"){let X=wj(Y.name),Q=Ej(X,Y.arguments,G),$=Y0.parse({type:"tool-call",id:Y.id,toolName:X,input:Q,timestamp:b,model:J});z.toolCallsById.set(Y.id,z.messages.length),z.messages.push($)}break}case"toolResult":{let J=z.toolCallsById.get(A.toolCallId);if(J!==void 0){let Y=z.messages[J],{output:X,images:Q}=Oj(A.toolName,A.content,A.details,G,z.blobs);if(Y.output=X,Q.length>0)Y.images=Q;if(A.isError)Y.isError=!0}break}case"bashExecution":{z.messages.push(Y0.parse({type:"command",name:A.excludeFromContext?"!!":"!",args:A.command,output:A.output||void 0,timestamp:b}));break}case"compactionSummary":{z.messages.push(Y0.parse({type:"compaction-summary",text:A.summary,timestamp:b}));break}case"branchSummary":{z.messages.push(Y0.parse({type:"agent",text:`[Branch summary] ${A.summary}`,timestamp:b}));break}case"custom":break}}function Mj(_,z){z.messages.push(Y0.parse({type:"compaction-summary",text:_.summary,timestamp:_.timestamp}))}function Nj(_,z){if(typeof _==="string")return{text:_,images:[]};let A=[],b=[];for(let G of _)if(G.type==="text"&&G.text)A.push(G.text);else if(G.type==="image"){let J=Buffer.from(G.data,"base64"),Y=HX(J);if(!z.has(Y))z.set(Y,{data:J,mediaType:G.mimeType});b.push({sha256:Y,mediaType:G.mimeType})}return{text:A.join(`
66
+ `).trim();if(!u)break;let d=o(S.id),Z0={type:"agent",timestamp:v,model:H??void 0,text:u};if(d)Z0.id=d;x5(Z0,Y,J)}break}case"reasoning":{let g=Rj(S);for(let f of g){let u=o(S.id),d={type:"thinking",timestamp:v,model:H??void 0,text:f};if(u)d.id=u;x5(d,Y,J)}break}case"function_call":{let g=o(S.call_id)??o(S.id)??void 0,f=o(S.name),u=wb(f),d=I5(S.arguments),Z0=Pj(d,$),C9=z0.parse({type:"tool-call",id:g,timestamp:v,model:H??void 0,toolName:u,input:Z0}),VU=T5(C9,$,f);G.set(g??"",{index:Y.push(VU)-1,rawName:f});break}case"function_call_output":{let g=o(S.call_id);if(!g)break;let f=G.get(g);if(!f)break;let u=I5(S.output),d=Nb(Y[f.index],u,$,f.rawName);Y[f.index]=d;break}case"custom_tool_call":{let g=o(S.call_id)??o(S.id)??void 0,f=o(S.name),u=wb(f),d=Sj(f,S.input,$),Z0=z0.parse({type:"tool-call",id:g,timestamp:v,model:H??void 0,toolName:u,input:d}),C9=T5(Z0,$,f);G.set(g??"",{index:Y.push(C9)-1,rawName:f});break}case"custom_tool_call_output":{let g=o(S.call_id);if(!g)break;let f=G.get(g);if(!f)break;let u=I5(S.output),d=Nb(Y[f.index],u,$,f.rawName);Y[f.index]=d;break}default:break}}if(Y.length===0)return null;let F=pj(B)??z.now??new Date,K=hj(X),W=Z??{...k5},V=gj(W),N=nj(H,W,z.pricing),L=z.gitContext!==void 0?z.gitContext:mj(Q,$),M=$?D9($):"",k=L4(Y);return{transcript:Q4.parse({v:1,id:Q?.id??Y[0]?.id??dj(F),source:"codex",timestamp:F,preview:K,summary:null,model:H,clientVersion:z.clientVersion??Q?.cliVersion??null,blendedTokens:V,costUsd:N,messageCount:Y.length,...k,tokenUsage:W,modelUsage:H?[O4.parse({model:H,usage:W})]:[],git:L,cwd:M,messages:Y}),blobs:b}}function Nj(_){let z=[];for(let A of _){if(!A||typeof A!=="object")continue;let G=A,J=o(G.type);if(!J)continue;let Y=o(G.timestamp)??void 0,X=G.payload&&typeof G.payload==="object"?G.payload:null;z.push({type:J,timestamp:Y,payload:X})}return z}function Ej(_){let z=_.git??{};return{id:o(_.id),cwd:o(_.cwd),cliVersion:o(_.cli_version??_.cliVersion),git:{branch:o(z.branch),repositoryUrl:o(z.repository_url??z.repositoryUrl)}}}function Db(_,z="total_token_usage"){if(!_||typeof _!=="object")return null;let A=_,G;if(z==="last_token_usage")G=A.last_token_usage??A.lastTokenUsage??A.total_token_usage??A.totalTokenUsage;else G=A.total_token_usage??A.totalTokenUsage??A.last_token_usage??A.lastTokenUsage;if(!G||typeof G!=="object")return null;let J=G;return{inputTokens:j4(J.input_tokens??J.inputTokens),cachedInputTokens:j4(J.cached_input_tokens??J.cachedInputTokens),outputTokens:j4(J.output_tokens??J.outputTokens),reasoningOutputTokens:j4(J.reasoning_output_tokens??J.reasoningOutputTokens),totalTokens:j4(J.total_tokens??J.totalTokens)}}function wj(_,z=!1){let A=(J)=>{if(z)return J.trim();return Z6(J)};if(typeof _==="string"){let J=A(_);return J?[J]:[]}if(!Array.isArray(_))return[];let G=[];for(let J of _){if(!J)continue;if(typeof J==="string"){let Y=A(J);if(Y)G.push(Y);continue}if(typeof J==="object"){let Y=J,X=o(Y.text??Y.content);if(X){let b=A(X);if(b)G.push(b)}}}return G}function Oj(_){return Kj.createHash("sha256").update(_).digest("hex")}function Lj(_,z){let A=[],G=[],J=(Y)=>{if(!Y)return;let X=jj(Y),b=X.trim();if(!b||Dj.test(b))return;A.push(X)};if(typeof _==="string")return J(_),{texts:A,images:G};if(!Array.isArray(_))return{texts:A,images:G};for(let Y of _){if(!Y)continue;if(typeof Y==="string"){J(Y);continue}if(typeof Y!=="object")continue;let X=Y,b=o(X.type);if(b==="input_text"||b==="text"||b==="output_text"){J(o(X.text??X.content));continue}if(b==="input_image"||b==="image"){let Q=Mb(X,z);if(Q)G.push(Q);continue}if(X.image_url||X.imageUrl||X.url){let Q=Mb(X,z);if(Q){G.push(Q);continue}}J(o(X.text??X.content))}return{texts:A,images:G}}function jj(_){let z=_;for(let A of Mj)z=z.replace(A,"");return z}function Mb(_,z){let A=_.image_url??_.imageUrl??_.url,G=typeof A==="string"?A:A&&typeof A==="object"?o(A.url):void 0;if(!G)return null;let J=G.match(/^data:([^;]+);base64,([\s\S]+)$/);if(!J)return null;let Y=J[1]||"image/unknown",X=J[2];if(!X)return null;let b=Buffer.from(X,"base64"),Q=Oj(b);if(!z.has(Q))z.set(Q,{data:b,mediaType:Y});return{sha256:Q,mediaType:Y}}function Rj(_){let z=[],A=_.summary;if(Array.isArray(A)){for(let J of A)if(J&&typeof J==="object"){let Y=o(J.text);if(Y)z.push(Y)}}let G=_.content;if(Array.isArray(G)){for(let J of G)if(J&&typeof J==="object"){let Y=J;if(o(Y.type)==="reasoning"||o(Y.type)==="text"){let X=o(Y.text??Y.content);if(X)z.push(X)}}}return z}function I5(_){let z=o(_);if(!z)return _;try{return JSON.parse(z)}catch{return _}}function Pj(_,z){if(!_||typeof _!=="object")return _;let A={..._};if(typeof A.workdir==="string"&&z)A.workdir=T_(A.workdir,z);return A}function Sj(_,z,A){if(!z)return z;if(_==="apply_patch"){let G=o(z);if(!G)return z;let J=yj(G,A);if(J.diff||J.file_path)return J}return z}function Nb(_,z,A,G){if(_.type!=="tool-call")return _;let J=z;if(G==="shell")J=Ob(z);else if(G==="exec_command")J=Cj(z);else if(G==="apply_patch")J=vj(z);let Y={..._,output:J};if(G==="shell"||G==="exec_command"){let X=kj(Y,A);if(X)return X}return T5(Y,A,G)}function kj(_,z){if(_.type!=="tool-call"||!_.input)return null;let A=_.input,G=null;if(typeof A.cmd==="string")G=A.cmd;else if(typeof A.command==="string")G=A.command;else if(Array.isArray(A.command)&&A.command.length>=3){let b=A.command[0];if((b==="bash"||b==="zsh"||b==="/bin/zsh"||b==="/bin/bash")&&A.command[1]==="-lc")G=o(A.command[2])}if(!G)return null;let J=G.match(/^cat\s+<<'EOF'\s+>\s+(\S+)\s*\n([\s\S]*?)EOF$/);if(J){let[,b,Q]=J,$=z?T_(`${z}/${b}`,z):`./${b}`;return z0.parse({..._,toolName:"Write",input:{file_path:$,content:Q||""},output:void 0})}let Y=G.match(/^cat\s+(\S+)$/);if(Y){let[,b]=Y,Q=z?T_(`${z}/${b}`,z):`./${b}`,$;if(_.output&&typeof _.output==="object"){let H=_.output;$=o(H.stdout)??void 0}return z0.parse({..._,toolName:"Read",input:{file_path:Q},output:$})}let X=Ij(G);if(X.length>0&&X[0]==="rg"){let b=xj(X,z);if(b){let Q=Eb(_.output),$;if(Q){let H=Q.split(`
67
+ `).filter((B)=>B.trim().length>0);if(b.input.output_mode==="files_with_matches")$={mode:"files_with_matches",filenames:H,numMatches:H.length};else $={mode:"content",content:Q,numMatches:H.length,numLines:H.length}}return z0.parse({..._,toolName:"Grep",input:b.input,output:$})}}if(X.length>=4&&X[0]==="sed"){let b=Tj(X,z);if(b){let{filePath:Q,startLine:$}=b,H=Eb(_.output),B;if(H){let Z=H.split(`
68
+ `).length;B={file:{content:H,numLines:Z,startLine:$}}}return z0.parse({..._,toolName:"Read",input:{file_path:Q},output:B})}}return null}function Ij(_){let z=[],A="",G=null,J=!1;for(let Y of _){if(J){A+=Y,J=!1;continue}if(Y==="\\"&&G!=="'"){J=!0;continue}if(G){if(Y===G)G=null;else A+=Y;continue}if(Y==="'"||Y==='"'){G=Y;continue}if(/\s/.test(Y)){if(A.length>0)z.push(A),A="";continue}A+=Y}if(A.length>0)z.push(A);return z}function Eb(_){if(typeof _==="string")return _;if(_&&typeof _==="object"){let A=o(_.stdout);if(A)return A}return}function xj(_,z){if(_.length<2)return null;let A={},G=null,J=null;for(let Y=1;Y<_.length;Y+=1){let X=_[Y];if(X==="--")continue;if(X.startsWith("-")){switch(X){case"-i":A["-i"]=!0;break;case"-U":A.multiline=!0;break;case"-A":case"-B":case"-C":{let b=_[Y+1];if(b)A[X]=b,Y+=1;break}case"-l":case"--files-with-matches":A.output_mode="files_with_matches";break;case"-c":case"--count":A.output_mode="count";break;case"-g":case"--glob":{let b=_[Y+1];if(b)A.glob=b,Y+=1;break}case"-t":case"--type":{let b=_[Y+1];if(b)A.type=b,Y+=1;break}case"-e":case"--regexp":{let b=_[Y+1];if(b)G=b,Y+=1;break}default:break}continue}if(!G){G=X;continue}if(!J){J=X;continue}}if(!G)return null;if(A.pattern=G,J)A.path=z?T_(J,z):J;return{input:A}}function Tj(_,z){let A=_.indexOf("-n");if(A===-1)return null;let G=_[A+1],J=_[A+2];if(!G||!J)return null;let Y=G.match(/^(\d+)(?:,(\d+))?p$/);if(!Y)return null;let X=parseInt(Y[1],10);if(!Number.isFinite(X)||X<=0)return null;return{filePath:z?T_(J,z):J,startLine:X}}function T5(_,z,A){if(_.type!=="tool-call")return _;let{toolName:G,input:J,output:Y}=_;if(A==="shell"||A==="exec_command"){if(G="Bash",J&&typeof J==="object"){let X=J,b={},Q=null;if(typeof X.cmd==="string")Q=X.cmd;else if(Array.isArray(X.command)&&X.command.length>=3){let $=X.command[0];if(($==="bash"||$==="zsh"||$==="/bin/zsh"||$==="/bin/bash")&&X.command[1]==="-lc")Q=o(X.command[2])}else if(typeof X.command==="string")Q=X.command;if(Q)b.command=Q;if(typeof X.description==="string")b.description=X.description;J=b}}if(A==="apply_patch"){if(G="Edit",J&&typeof J==="object"){let X={...J},b=o(X.file_path);if(b&&z)X.file_path=T_(b,z);J=X}}if(z)J=s0(J,z),Y=s0(Y,z);return z0.parse({..._,toolName:G,input:J,output:Y})}function Ob(_){if(!_||typeof _!=="object")return _;let z=_,A={},G=o(z.output??z.stdout);if(typeof z.stdout==="string")A.stdout=z.stdout;else if(G)A.stdout=G;let J=o(z.stderr);if(J)A.stderr=J;let Y=z.metadata&&typeof z.metadata==="object"?z.metadata:{},X=j4(Y.exit_code??Y.exitCode??z.exit_code??z.exitCode);if(Number.isFinite(X))A.exitCode=X;let b=j4(Y.duration_seconds??Y.durationSeconds);if(Number.isFinite(b)&&b>0)A.durationSeconds=b;return Object.keys(A).length>0?A:void 0}function Cj(_){let z=o(_);if(!z)return Ob(_);let A={},G=z.match(/Process exited with code (\d+)/);if(G)A.exitCode=parseInt(G[1],10);let J=z.match(/Wall time: ([\d.]+) seconds/);if(J){let X=parseFloat(J[1]);if(X>0)A.durationSeconds=X}let Y=z.match(/Output:\n([\s\S]*?)$/);if(Y&&Y[1]){let X=Y[1].trim();if(X)A.stdout=X}return Object.keys(A).length>0?A:void 0}function vj(_){if(!_||typeof _!=="object")return _;let z=_,A={},G=o(z.output);if(G)A.message=G;let J=z.metadata&&typeof z.metadata==="object"?z.metadata:null;if(J){let Y=j4(J.exit_code??J.exitCode);if(Number.isFinite(Y))A.exitCode=Y;let X=j4(J.duration_seconds??J.durationSeconds);if(Number.isFinite(X)&&X>0)A.durationSeconds=X}return Object.keys(A).length>0?A:void 0}function yj(_,z){let A=_.split(/\r?\n/),G=null,J=[];for(let b of A){if(b.startsWith("*** ")){let Q=b.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/);if(Q&&Q[1])G=Q[1].trim();continue}J.push(b)}let Y=J.join(`
69
+ `).trim(),X={};if(G)X.file_path=z?T_(G,z):G;if(Y)X.diff=Y.endsWith(`
70
+ `)?Y:`${Y}
71
+ `;return X}function T_(_,z){if(!_)return _;let A=S5.isAbsolute(_),G=_.replace(/\\/g,"/");if(!A){if(G==="."||G==="./")return".";if(G.startsWith("./")||G.startsWith("../"))return G;return`./${G}`}try{let J=S5.relative(z,_).replace(/\\/g,"/");if(J==="")return".";if(J.startsWith("..")||S5.isAbsolute(J))return _;return J==="."?".":`./${J}`}catch{return _}}function gj(_){return Math.max(0,_.inputTokens-_.cachedInputTokens)+_.outputTokens+_.reasoningOutputTokens}function fj(_){let z=_.trim().toLowerCase();return Uj.some((A)=>z.startsWith(A))}function hj(_){for(let z of _){let A=Z6(z);if(!A)continue;if(A.startsWith("<user_instructions>")||A.startsWith("<environment_context>"))continue;return A}return _.length>0?Z6(_[0]):null}function mj(_,z){let A=z??_?.cwd??null;if(!_)return z9.parse({repo:null,branch:null,relativeCwd:null});let G=_.git.repositoryUrl?EA(_.git.repositoryUrl):null,J=_.git.branch,Y=G?G.split("/").pop()??null:null,X=uj(A,Y);return z9.parse({repo:G,branch:J,relativeCwd:Lz(X)})}function uj(_,z){if(!_)return null;let G=_.replace(/\\/g,"/").split("/").filter(Boolean);if(G.length===0)return null;if(z){let J=G.lastIndexOf(z);if(J>=0){let Y=G.slice(J+1).join("/");return Y.length>0?Y:"."}}return null}function x5(_,z,A){let G=cj(_);if(G&&A.has(G))return;let J=z0.parse(_);if(z.push(J),G)A.add(G)}function cj(_){if("text"in _&&typeof _.text==="string")return`${_.type}|${_.timestamp??""}|${_.text}`;if(_.type==="tool-call")return`${_.type}|${_.timestamp??""}|${_.id??""}|${_.toolName??""}`;return null}function wb(_){if(!_)return _;return Vj[_]??_}function lj(_,z){let A=Date.parse(_),G=Date.parse(z);if(Number.isNaN(A)||Number.isNaN(G))return 0;return A===G?0:A>G?1:-1}function pj(_){if(!_)return null;let z=new Date(_);return Number.isNaN(z.getTime())?null:z}function j4(_){return typeof _==="number"&&Number.isFinite(_)?_:0}function o(_){if(typeof _!=="string")return null;let z=_.trim();return z.length>0?z:null}function Z6(_){return _.replace(/\s+/g," ").trim()}function dj(_){return`codex-${_.getTime()}`}function rj(_){if(_.includes("/"))return _;return`openai/${_}`}function nj(_,z,A){if(!A||!_)return 0;let G=ij(_,A);if(!G)return 0;return oj({input_tokens:Math.max(0,z.inputTokens-z.cachedInputTokens),output_tokens:z.outputTokens+z.reasoningOutputTokens,cache_creation_input_tokens:0,cache_read_input_tokens:z.cachedInputTokens},G)}function ij(_,z){let A=_.trim();if(!A)return null;let G=new Set;G.add(A);for(let Y of Ub)G.add(`${Y}${A}`);for(let Y of Ub)if(A.startsWith(Y))G.add(A.slice(Y.length));for(let Y of G){let X=z[Y];if(X)return X}let J=A.toLowerCase();for(let[Y,X]of Object.entries(z)){let b=Y.toLowerCase();if(b.includes(J)||J.includes(b))return X}return null}function oj(_,z){let A=(b,Q,$,H=Wj)=>{if(b==null||b<=0)return 0;if(b>H&&$!=null){let B=Math.min(b,H),q=Math.max(0,b-H)*$;if(Q!=null)q+=B*Q;return q}if(Q!=null)return b*Q;return 0},G=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),J=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),Y=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),X=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return G+J+Y+X}import jz from"node:path";var v5={shell:"Bash",bash:"Bash",execute:"Bash",read_file:"Read",read:"Read",write_file:"Write",write:"Write",edit_file:"Edit",edit:"Edit",apply_patch:"Edit",multiedit:"Edit",glob:"Glob",grep:"Grep",find:"Glob",list_files:"Glob",ls:"Glob",webfetch:"WebFetch",websearch:"WebSearch",task:"Task",explore:"Explore",skill:"Skill",todowrite:"TodoWrite",todoread:"TodoRead",question:"Question",plan:"Plan",codesearch:"CodeSearch",lsp:"LSP"},aj=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/","google/","gemini/"],sj=200000;function C_(_,z={}){let{info:A,messages:G}=_;if(!G||G.length===0)return null;let J=z.cwd??A.directory??null,Y=[],X=[],b=null,Q=0,$=0,H=0,B=0,Z=0,q=[...G].sort((O,P)=>{return O.info.time.created-P.info.time.created});for(let O of q){let P=O.info,S=_R(P);if(P.role==="assistant"&&S&&!b)b=S;if(P.role==="assistant"&&P.tokens)$+=P.tokens.input??0,H+=P.tokens.output??0,B+=P.tokens.reasoning??0,Z+=P.tokens.cache?.read??0;if(P.role==="assistant"&&P.cost)Q+=P.cost;for(let v of O.parts){if(v.type==="step-start"||v.type==="step-finish")continue;let i=new Date(P.time.created).toISOString();switch(v.type){case"text":{let g=v.text?.trim();if(!g)break;if(P.role==="user")X.push(g),Y.push(z0.parse({type:"user",text:g,id:P.id,timestamp:i}));else Y.push(z0.parse({type:"agent",text:g,id:P.id,timestamp:i,model:S??void 0}));break}case"reasoning":{let g=v.text?.trim();if(!g)break;Y.push(z0.parse({type:"thinking",text:g,timestamp:i,model:S??void 0}));break}case"tool":{let g=v.state??{},f=g.input;if(v.tool==="todoread")break;let u=tj(v.tool);if(u==="Task"&&f?.subagent_type&&typeof f.subagent_type==="string")u=ej(f.subagent_type);let d=JR(u,g.input,J,g.metadata),Z0=YR(v.tool,u,g.output,g.metadata,J);Y.push(z0.parse({type:"tool-call",id:v.callID,timestamp:i,model:S??void 0,toolName:u,input:d,output:Z0,error:g.error,isError:g.status==="error"||!!g.error}));break}}}}if(Y.length===0)return null;let F={inputTokens:$,cachedInputTokens:Z,outputTokens:H,reasoningOutputTokens:B,totalTokens:$+H},K=F.inputTokens+F.outputTokens,W=Q>0?Q:XR(b,F,z.pricing),V=new Date(A.time.created),N=AR(X),L=z.gitContext!==void 0?z.gitContext:z9.parse({repo:null,branch:null,relativeCwd:zR(q)}),M=J?D9(J):null,k=L4(Y);return Q4.parse({v:1,id:A.id,source:"opencode",timestamp:V,preview:N,summary:null,model:b,clientVersion:z.clientVersion??A.version??null,blendedTokens:K,costUsd:W,messageCount:Y.length,...k,tokenUsage:F,modelUsage:b?[O4.parse({model:b,usage:F})]:[],git:L,cwd:M,messages:Y})}function tj(_){let z=_.toLowerCase();return v5[z]??_}function ej(_){let z=_.toLowerCase();if(v5[z])return v5[z];return _.charAt(0).toUpperCase()+_.slice(1)}function _R(_){let z=_.modelID??_.model?.modelID,A=_.providerID??_.model?.providerID;if(!z)return null;if(A)return`${A}/${z}`;return z}function zR(_){for(let z of _){let A=z.info.path;if(A?.root&&A?.cwd){if(A.root===A.cwd)return null;try{let G=jz.relative(A.root,A.cwd).replace(/\\/g,"/");if(G&&!G.startsWith("..")&&!jz.isAbsolute(G))return G}catch{}}}return null}function AR(_){for(let z of _){let A=z.trim().replace(/\s+/g," ");if(!A)continue;if(A.startsWith("<")&&A.includes(">"))continue;return A.replace(/^["']|["']$/g,"")}return _.length>0?_[0].trim().replace(/\s+/g," "):null}function GR(_){let z=_,A=z.match(/<file>\n?([\s\S]*?)\n?<\/file>/);if(A)z=A[1];return z=z.replace(/\n?\(End of file - total \d+ lines\)\n?$/,""),z.split(`
72
+ `).map((Y)=>{let X=Y.match(/^\d+\| (.*)$/);return X?X[1]:Y}).join(`
73
+ `)}function Lb(_){if(!_)return _;let z=_.split(`
74
+ `),A=[],G=!1;for(let J of z){if(J.startsWith("Index: ")||J.startsWith("===")||J.startsWith("--- ")||J.startsWith("+++ "))continue;if(J.startsWith("@@")){G=!0;continue}if(G)A.push(J)}return A.join(`
75
+ `).trim()||void 0}function JR(_,z,A,G){if(!z||typeof z!=="object")return z;let J={...z};if(_==="Edit"&&typeof J.patchText==="string"&&G?.files){let Y=G.files;if(Y.length===1){let X=Y[0];return{file_path:X.relativePath??(A&&X.filePath?A_(X.filePath,A):X.filePath),diff:Lb(X.diff),type:X.type}}else if(Y.length>1)return{files:Y.map((X)=>({file_path:X.relativePath??(A&&X.filePath?A_(X.filePath,A):X.filePath),type:X.type,diff:Lb(X.diff)}))}}if(typeof J.filePath==="string")J.file_path=A?A_(J.filePath,A):J.filePath,delete J.filePath;else if(typeof J.file_path==="string"&&A)J.file_path=A_(J.file_path,A);if(_==="Grep"&&typeof J.include==="string")J.glob=J.include,delete J.include;if((_==="Glob"||_==="Grep")&&typeof J.path==="string")delete J.path;else if(typeof J.path==="string"&&A)J.path=A_(J.path,A);if(typeof J.workdir==="string"&&A)J.workdir=A_(J.workdir,A);return A?s0(J,A):J}function YR(_,z,A,G,J){let Y=A;if(z==="Bash"&&G){let X={};if(typeof G.output==="string")X.stdout=G.output;if(typeof G.exit==="number")X.exitCode=G.exit;if(typeof G.description==="string")X.description=G.description;Y=Object.keys(X).length>0?X:A}else if(z==="Read"){let X=G?.preview??(typeof A==="string"?GR(A):null);if(X){let b=X.split(`
76
+ `).length;Y={file:{content:X,numLines:b,totalLines:b}}}}else if(z==="Glob"){let b=(typeof A==="string"?A:"").split(`
77
+ `).map((Q)=>Q.trim()).filter(Boolean).map((Q)=>J?A_(Q,J):Q);Y={filenames:b,numFiles:G?.count??b.length}}else if(z==="Grep"){let b=(typeof A==="string"?A:"").split(`
78
+ `),Q=G?.matches??0,$=b.slice(1).filter((H)=>H.trim());Y={mode:"content",content:$.join(`
79
+ `),numMatches:Q,numLines:$.length}}else if(_==="apply_patch"&&G?.files){let X=G.files;if(X.length===1){let b=X[0];Y={additions:b.additions,deletions:b.deletions}}else Y={files:X.map((b)=>({file_path:b.relativePath??(J&&b.filePath?A_(b.filePath,J):b.filePath),additions:b.additions,deletions:b.deletions}))}}else if(z==="Edit"&&G?.filediff)Y={diff:G.diff,additions:G.filediff.additions,deletions:G.filediff.deletions};else if(z==="Write"&&G)Y={created:!G.exists};else if(z==="Explore")Y={content:(typeof A==="string"?A:"").replace(/<task_metadata>[\s\S]*?<\/task_metadata>/g,"").trim()};else if(z==="Skill")Y={content:typeof A==="string"?A:""};else if(z==="WebFetch")Y={content:typeof A==="string"?A:""};else if(z==="TodoWrite"||z==="TodoRead")Y={todos:G?.todos??[]};return J?s0(Y,J):Y}function A_(_,z){if(!_)return _;let A=jz.isAbsolute(_),G=_.replace(/\\/g,"/");if(!A){if(G==="."||G==="./")return".";if(G.startsWith("./")||G.startsWith("../"))return G;return`./${G}`}try{let J=jz.relative(z,_).replace(/\\/g,"/");if(J==="")return".";if(J.startsWith("..")||jz.isAbsolute(J))return _;return J==="."?".":`./${J}`}catch{return _}}function XR(_,z,A){if(!A||!_)return 0;let G=bR(_,A);if(!G)return 0;return QR({input_tokens:z.inputTokens,output_tokens:z.outputTokens,cache_creation_input_tokens:0,cache_read_input_tokens:z.cachedInputTokens},G)}function bR(_,z){let A=_.trim();if(!A)return null;let G=new Set;G.add(A);for(let Y of aj)G.add(`${Y}${A}`);for(let Y of G){let X=z[Y];if(X)return X}let J=A.toLowerCase();for(let[Y,X]of Object.entries(z)){let b=Y.toLowerCase();if(b.includes(J)||J.includes(b))return X}return null}function QR(_,z){let A=(b,Q,$,H=sj)=>{if(b==null||b<=0)return 0;if(b>H&&$!=null){let B=Math.min(b,H),q=Math.max(0,b-H)*$;if(Q!=null)q+=B*Q;return q}if(Q!=null)return b*Q;return 0},G=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),J=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),Y=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),X=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return G+J+Y+X}import $R from"node:crypto";var HR={read:"Read",write:"Write",edit:"Edit",bash:"Bash",grep:"Grep",find:"Glob",ls:"Ls"};function v_(_,z={}){let{header:A,entries:G}=_;if(G.length===0)return null;let J=z.leafId??BR(G);if(!J)return null;let Y=ZR(G,J);if(Y.length===0)return null;let X=qR(G,J),b=X?`${A.id}-${X}`:A.id,Q=z.cwd??A.cwd,{messages:$,blobs:H,tokenUsage:B,modelUsageMap:Z,primaryModel:q,cwd:F}=FR(Y,Q);if($.length===0)return null;let K=NR($),W=wR(A.timestamp)??z.now??new Date,V=OR(B),N=B.cost??RR(q,B,z.pricing),L=z.gitContext!==void 0?z.gitContext:null,M=F?D9(F):"",k=L4($);return{transcript:Q4.parse({v:1,id:b,source:"pi",timestamp:W,preview:K,summary:null,model:q,clientVersion:z.clientVersion??null,blendedTokens:V,costUsd:N,messageCount:$.length,...k,tokenUsage:{inputTokens:B.inputTokens,cachedInputTokens:B.cachedInputTokens,outputTokens:B.outputTokens,reasoningOutputTokens:B.reasoningOutputTokens,totalTokens:B.totalTokens},modelUsage:Array.from(Z.entries()).map(([O,P])=>O4.parse({model:O,usage:P})),git:L,cwd:M,messages:$}),blobs:H}}function BR(_){let z=new Set;for(let G of _)if(G.parentId)z.add(G.parentId);let A=null;for(let G of _)if(!z.has(G.id)){if(!A||G.timestamp>A.timestamp)A={id:G.id,timestamp:G.timestamp}}return A?.id??null}function ZR(_,z){let A=new Map(_.map((Y)=>[Y.id,Y])),G=[],J=z;while(J){let Y=A.get(J);if(!Y)break;G.unshift(Y),J=Y.parentId}return G}function qR(_,z){let A=new Map;for(let Y of _){let X=A.get(Y.parentId)??[];X.push(Y.id),A.set(Y.parentId,X)}let G=new Map(_.map((Y)=>[Y.id,Y])),J=z;while(J){let Y=G.get(J);if(!Y)break;let X=Y.parentId;if((A.get(X)??[]).length>1)return J;J=X}return null}function FR(_,z){let A={messages:[],blobs:new Map,tokenUsage:{inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0,cost:0},modelUsageMap:new Map,primaryModel:null,cwd:z,toolCallsById:new Map};for(let G of _)if(G.type==="message")KR(G,A);else if(G.type==="compaction")WR(G,A);return A}function KR(_,z){let{message:A,timestamp:G}=_,J=z.cwd;switch(A.role){case"user":{let{text:Y,images:X}=VR(A.content,z.blobs);if(Y||X.length>0){let b={type:"user",text:Y||"",timestamp:G};if(X.length>0)b.images=X;z.messages.push(z0.parse(b))}break}case"assistant":{let Y=`${A.provider}/${A.model}`;if(!z.primaryModel)z.primaryModel=Y;if(A.usage){z.tokenUsage.inputTokens+=A.usage.input??0,z.tokenUsage.cachedInputTokens+=A.usage.cacheRead??0,z.tokenUsage.outputTokens+=A.usage.output??0,z.tokenUsage.totalTokens+=A.usage.totalTokens??0,z.tokenUsage.cost+=A.usage.cost?.total??0;let X=z.modelUsageMap.get(Y)??{inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0,totalTokens:0};X.inputTokens+=A.usage.input??0,X.cachedInputTokens+=A.usage.cacheRead??0,X.outputTokens+=A.usage.output??0,X.totalTokens+=A.usage.totalTokens??0,z.modelUsageMap.set(Y,X)}for(let X of A.content)if(X.type==="thinking"&&X.thinking)z.messages.push(z0.parse({type:"thinking",text:X.thinking,timestamp:G,model:Y}));else if(X.type==="text"&&X.text)z.messages.push(z0.parse({type:"agent",text:X.text,timestamp:G,model:Y}));else if(X.type==="toolCall"){let b=UR(X.name),Q=DR(b,X.arguments,J),$=z0.parse({type:"tool-call",id:X.id,toolName:b,input:Q,timestamp:G,model:Y});z.toolCallsById.set(X.id,z.messages.length),z.messages.push($)}break}case"toolResult":{let Y=z.toolCallsById.get(A.toolCallId);if(Y!==void 0){let X=z.messages[Y],{output:b,images:Q}=MR(A.toolName,A.content,A.details,J,z.blobs);if(X.output=b,Q.length>0)X.images=Q;if(A.isError)X.isError=!0}break}case"bashExecution":{z.messages.push(z0.parse({type:"command",name:A.excludeFromContext?"!!":"!",args:A.command,output:A.output||void 0,timestamp:G}));break}case"compactionSummary":{z.messages.push(z0.parse({type:"compaction-summary",text:A.summary,timestamp:G}));break}case"branchSummary":{z.messages.push(z0.parse({type:"agent",text:`[Branch summary] ${A.summary}`,timestamp:G}));break}case"custom":break}}function WR(_,z){z.messages.push(z0.parse({type:"compaction-summary",text:_.summary,timestamp:_.timestamp}))}function VR(_,z){if(typeof _==="string")return{text:_,images:[]};let A=[],G=[];for(let J of _)if(J.type==="text"&&J.text)A.push(J.text);else if(J.type==="image"){let Y=Buffer.from(J.data,"base64"),X=Rb(Y);if(!z.has(X))z.set(X,{data:Y,mediaType:J.mimeType});G.push({sha256:X,mediaType:J.mimeType})}return{text:A.join(`
79
80
 
80
- `),images:b}}function HX(_){return Fj.createHash("sha256").update(_).digest("hex")}function wj(_){return Kj[_.toLowerCase()]??_}function Ej(_,z,A){if(!z||typeof z!=="object")return z;let b={...z};if(typeof b.path==="string")b.file_path=A?$X(b.path,A):b.path,delete b.path;if(typeof b.file_path==="string"&&A)b.file_path=$X(b.file_path,A);return A?M9(b,A):b}function Oj(_,z,A,b,G){let J=[],Y=[];for(let $ of z)if($.type==="text"&&$.text)J.push($.text);else if($.type==="image"){let H=Buffer.from($.data,"base64"),B=HX(H);if(!G.has(B))G.set(B,{data:H,mediaType:$.mimeType});Y.push({sha256:B,mediaType:$.mimeType})}let X=J.join(`
81
- `);if(_==="edit"&&A&&typeof A==="object"){let $=A;if($.diff)return{output:{diff:$.diff},images:Y}}if(_==="read"&&X){let $=X.split(`
82
- `).length;return{output:{file:{content:X,numLines:$,totalLines:$}},images:Y}}return{output:X||(b?M9(A,b):A),images:Y}}function $X(_,z){if(!_)return _;let A=_.startsWith("/"),b=_.replace(/\\/g,"/");if(!A){if(b==="."||b==="./")return".";if(b.startsWith("./")||b.startsWith("../"))return b;return`./${b}`}let G=z.replace(/\\/g,"/");if(b.startsWith(G+"/"))return`./${b.slice(G.length+1)}`;return h9(b)}function Lj(_){for(let z of _)if(z.type==="user"&&z.text)return jj(z.text);return null}function jj(_){return _.replace(/\s+/g," ").trim()}function Rj(_){if(!_)return null;let z=new Date(_);return Number.isNaN(z.getTime())?null:z}function Pj(_){return Math.max(0,_.inputTokens-_.cachedInputTokens)+_.outputTokens+_.reasoningOutputTokens}var Sj=["anthropic/","openai/","google/"],kj=200000;function Ij(_,z,A){if(!A||!_)return 0;let b=xj(_,A);if(!b)return 0;return Tj({input_tokens:Math.max(0,z.inputTokens-z.cachedInputTokens),output_tokens:z.outputTokens,cache_read_input_tokens:z.cachedInputTokens},b)}function xj(_,z){let A=_.trim();if(!A)return null;let b=new Set;b.add(A);for(let G of Sj)b.add(`${G}${A}`);for(let G of b){let J=z[G];if(J)return J}return null}function Tj(_,z){let A=(Y,X,Q,$=kj)=>{if(Y==null||Y<=0)return 0;if(Y>$&&Q!=null){let H=Math.min(Y,$),Z=Math.max(0,Y-$)*Q;if(X!=null)Z+=H*X;return Z}if(X!=null)return Y*X;return 0},b=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),G=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),J=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return b+G+J}var Cj="https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json",vj=200000,yj=U.object({input_cost_per_token:U.number().optional(),output_cost_per_token:U.number().optional(),cache_creation_input_token_cost:U.number().optional(),cache_read_input_token_cost:U.number().optional(),max_tokens:U.number().optional(),max_input_tokens:U.number().optional(),max_output_tokens:U.number().optional(),input_cost_per_token_above_200k_tokens:U.number().optional(),output_cost_per_token_above_200k_tokens:U.number().optional(),cache_creation_input_token_cost_above_200k_tokens:U.number().optional(),cache_read_input_token_cost_above_200k_tokens:U.number().optional(),input_cost_per_token_above_128k_tokens:U.number().optional(),output_cost_per_token_above_128k_tokens:U.number().optional()}),gj=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/openai/"];function fj(_){if(_!=null)return _;return{debug:()=>{},error:()=>{},info:()=>{},warn:()=>{}}}class r0{cachedPricing=null;logger;offline;offlineLoader;url;providerPrefixes;constructor(_={}){this.logger=fj(_.logger),this.offline=Boolean(_.offline),this.offlineLoader=_.offlineLoader,this.url=_.url??Cj,this.providerPrefixes=_.providerPrefixes??gj}[Symbol.dispose](){this.clearCache()}clearCache(){this.cachedPricing=null}async loadOfflinePricing(){if(this.offlineLoader==null)throw Error("Offline loader was not provided");let _=new Map(Object.entries(await this.offlineLoader()));return this.cachedPricing=_,_}async fetchRemotePricing(){this.logger.warn("Fetching latest model pricing from LiteLLM...");let _=await fetch(this.url);if(!_.ok)throw Error(`Failed to fetch pricing data: ${_.statusText}`);let z=await _.json(),A=new Map;for(let[b,G]of Object.entries(z)){if(typeof G!=="object"||G==null)continue;let J=yj.safeParse(G);if(!J.success)continue;A.set(b,J.data)}return this.cachedPricing=A,this.logger.info(`Loaded pricing for ${A.size} models`),A}async ensurePricingLoaded(){if(this.cachedPricing!=null)return this.cachedPricing;if(this.offline)return this.loadOfflinePricing();try{return await this.fetchRemotePricing()}catch(_){if(this.logger.warn("Failed to fetch model pricing from LiteLLM, falling back to offline loader (if available)."),this.offlineLoader!=null)return this.loadOfflinePricing();throw _}}async fetchModelPricing(){return this.ensurePricingLoaded()}createMatchingCandidates(_){let z=new Set;z.add(_);for(let A of this.providerPrefixes)z.add(`${A}${_}`);return Array.from(z)}async getModelPricing(_){let z=await this.ensurePricingLoaded();for(let b of this.createMatchingCandidates(_)){let G=z.get(b);if(G!=null)return G}let A=_.toLowerCase();for(let[b,G]of z){let J=b.toLowerCase();if(J.includes(A)||A.includes(J))return G}return null}async getModelContextLimit(_){return(await this.getModelPricing(_))?.max_input_tokens??null}calculateCostFromPricing(_,z){let A=(X,Q,$,H=vj)=>{if(X==null||X<=0)return 0;if(X>H&&$!=null){let B=Math.min(X,H),F=Math.max(0,X-H)*$;if(Q!=null)F+=B*Q;return F}if(Q!=null)return X*Q;return 0},b=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),G=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),J=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),Y=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return b+G+J+Y}async calculateCostFromTokens(_,z){if(z==null||z==="")return 0;let A=await this.getModelPricing(z);if(A==null)throw Error(`Model pricing not found for ${z}`);return this.calculateCostFromPricing(_,A)}}async function BX(_={}){let z=_.serverUrl??process.env.VI_SERVER_URL??"http://localhost:3000",A=_.authToken??null,b=_.timeoutMs??1e4;try{let G=await fetch(`${z}/api/transcripts`,{method:"GET",headers:{...A&&{Authorization:`Bearer ${A}`}},signal:AbortSignal.timeout(b)});if(!G.ok)return console.error(`Failed to fetch transcript metadata: ${G.status} ${G.statusText}`),[];let J=await G.json();if(hj(J))return J.transcripts;return console.error("Transcript metadata response had unexpected shape:",J),[]}catch(G){if(G instanceof Error)console.error("Failed to fetch transcript metadata:",G.message);return[]}}function hj(_){if(typeof _!=="object"||_===null||!("transcripts"in _))return!1;let{transcripts:z}=_;if(!Array.isArray(z))return!1;return z.every((A)=>{if(typeof A!=="object"||A===null)return!1;let b=A;return typeof b.transcriptId==="string"&&b.transcriptId.length>0&&typeof b.sha256==="string"&&b.sha256.length>0&&typeof b.repoId==="string"&&b.repoId.length>0})}var ZX=[{name:"OpenAI API Key",regex:"sk-[a-zA-Z0-9]{20,}"},{name:"OpenAI Project Key",regex:"sk-proj-[a-zA-Z0-9\\-_]{20,}"},{name:"Anthropic API Key",regex:"sk-ant-[a-zA-Z0-9\\-_]{20,}"},{name:"Cohere API Key",regex:"co-[a-zA-Z0-9]{40,}"},{name:"HuggingFace Token",regex:"hf_[a-zA-Z0-9]{34,}"},{name:"Replicate API Token",regex:"r8_[a-zA-Z0-9]{40}"},{name:"JWT Token",regex:"eyJ[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_.+/=]*"},{name:"OAuth Client Secret",regex:`(?i)client_secret['"\\s:=]+[a-zA-Z0-9\\-_.~]{10,100}`},{name:"OAuth Client ID",regex:`(?i)client_id['"\\s:=]+[a-zA-Z0-9\\-_.~]{10,100}`},{name:"Bearer Token",regex:"Bearer\\s+[a-zA-Z0-9\\-._~+/]+=*"},{name:"Authorization Bearer",regex:"(?i)authorization:\\s*Bearer\\s+[a-zA-Z0-9\\-._~+/]+=*"},{name:"Google OAuth Access Token",regex:"ya29\\.[0-9A-Za-z\\-_]+"},{name:"GitHub Fine-Grained Token",regex:"github_pat_[0-9a-zA-Z_]{20,}"},{name:"GitHub OAuth App Secret",regex:`[g|G][i|I][t|T][h|H][u|U][b|B].*['|"][0-9a-zA-Z]{35,40}['|"]`},{name:"GitLab PAT",regex:"glpat-[a-zA-Z0-9_-]{16,}"},{name:"GitLab Runner Token",regex:"glrt-[a-zA-Z0-9_-]{16,}"},{name:"MongoDB URI",regex:`mongodb(\\+srv)?:\\/\\/[^\\s'"]+`},{name:"PostgreSQL URI",regex:`postgres(?:ql)?:\\/\\/[^\\s'"]+`},{name:"MySQL URI",regex:`mysql:\\/\\/[^\\s'"]+`},{name:"Redis URI",regex:`redis:\\/\\/[^\\s'"]+`},{name:"JDBC URL",regex:`jdbc:\\w+:\\/\\/[^\\s'"]+`},{name:"Password in URL",regex:`[a-zA-Z]{3,10}://[^/\\s:@]{3,20}:[^/\\s:@]{3,20}@.{1,100}["'\\s]`},{name:"DigitalOcean Token",regex:"dop_v1_[a-z0-9]{64}"},{name:"CircleCI Token",regex:"circle-token=[a-z0-9]{40}"},{name:"New Relic Key",regex:"NRII-[a-zA-Z0-9]{20,}"},{name:"Sentry DSN",regex:"https:\\/\\/[a-zA-Z0-9]+@[a-z]+\\.ingest\\.sentry\\.io\\/\\d+"},{name:"Cloudinary URL",regex:"cloudinary:\\/\\/[0-9]{15}:[a-zA-Z0-9]+@[a-zA-Z]+"},{name:"Discord Bot Token",regex:"[MN][A-Za-z\\d]{23}\\.[\\w-]{6}\\.[\\w-]{27}"},{name:"Discord Webhook",regex:"https:\\/\\/discord(?:app)?\\.com\\/api\\/webhooks\\/[0-9]+\\/[a-zA-Z0-9_-]+"},{name:"Telegram Bot Token",regex:"\\d{9}:[a-zA-Z0-9_-]{35}"},{name:"Microsoft Teams Webhook",regex:"https:\\/\\/[a-z]+\\.webhook\\.office\\.com\\/webhookb2\\/[a-zA-Z0-9@\\-]+\\/.*"},{name:"Stripe Publishable Key",regex:"pk_live_[0-9a-zA-Z]{24}"},{name:"PayPal Braintree Token",regex:"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-f]{32}"},{name:"Square Access Token",regex:"sq0atp-[0-9A-Za-z\\-_]{22}"},{name:"Square OAuth Secret",regex:"sq0csp-[0-9A-Za-z\\-_]{43}"},{name:"SendGrid API Key",regex:"SG\\.[\\w\\d\\-_]{22}\\.[\\w\\d\\-_]{43}"},{name:"Mailgun API Key",regex:"key-[0-9a-zA-Z]{32}"},{name:"MailChimp API Key",regex:"[0-9a-f]{32}-us[0-9]{1,2}"},{name:"Shopify Access Token",regex:"shpat_[0-9a-fA-F]{32}"},{name:"Dropbox Access Token",regex:"sl\\.[A-Za-z0-9_-]{20,100}"},{name:"Asana Token",regex:"0\\/[0-9a-z]{32}"},{name:"Linear API Key",regex:"lin_api_[a-zA-Z0-9]{40}"},{name:"Riot Games API Key",regex:"RGAPI-[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}"},{name:"Generic API Key",regex:`(?i)(api[_-]?key)['"\\s:=]+[a-zA-Z0-9\\-_.]{16,}`},{name:"Generic Secret",regex:`(?i)(secret|password|passwd|pwd)['"\\s:=]+[^\\s'"]{8,}`},{name:"Generic Token",regex:`(?i)(token)['"\\s:=]+[a-zA-Z0-9\\-_.]{16,}`},{name:"Private Key Block",regex:"-----BEGIN (RSA|DSA|EC|OPENSSH|PGP)?\\s*PRIVATE\\s+KEY"},{name:"Certificate Block",regex:"-----BEGIN CERTIFICATE-----"},{name:"AWS API Gateway",regex:"[0-9a-z]+.execute-api.[0-9a-z._-]+.amazonaws.com"},{name:"AWS API Key",regex:"AKIA[0-9A-Z]{16}"},{name:"AWS ARN",regex:"arn:aws:[a-z0-9-]+:[a-z]{2}-[a-z]+-[0-9]+:[0-9]+:.+"},{name:"AWS Access Key ID Value",regex:"(A3T[A-Z0-9]|AKIA|AGPA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"},{name:"AWS AppSync GraphQL Key",regex:"da2-[a-z0-9]{26}"},{name:"AWS EC2 External",regex:"ec2-[0-9a-z._-]+.compute(-1)?.amazonaws.com"},{name:"AWS EC2 Internal",regex:"[0-9a-z._-]+.compute(-1)?.internal"},{name:"AWS ELB",regex:"[0-9a-z._-]+.elb.amazonaws.com"},{name:"AWS ElasticCache",regex:"[0-9a-z._-]+.cache.amazonaws.com"},{name:"AWS MWS ID",regex:"mzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},{name:"AWS MWS key",regex:"amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},{name:"AWS RDS",regex:"[0-9a-z._-]+.rds.amazonaws.com"},{name:"AWS S3 Bucket",regex:"s3://[0-9a-z._/-]+"},{name:"AWS client ID",regex:"(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"},{name:"AWS cred file info",regex:"(aws_access_key_id|aws_secret_access_key)"},{name:"Abbysale",regex:"(?:abbysale).{0,40}\\b([a-z0-9A-Z]{40})\\b"},{name:"Abstract",regex:"(?:abstract).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Abuseipdb",regex:"(?:abuseipdb).{0,40}\\b([a-z0-9]{80})\\b"},{name:"Accuweather",regex:"(?:accuweather).{0,40}([a-z0-9A-Z\\%]{35})\\b"},{name:"Adafruitio",regex:"\\b(aio\\_[a-zA-Z0-9]{28})\\b"},{name:"Adobeio - 1",regex:"(?:adobe).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Adzuna - 1",regex:"(?:adzuna).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Adzuna - 2",regex:"(?:adzuna).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aeroworkflow - 1",regex:"(?:aeroworkflow).{0,40}\\b([0-9]{1,})\\b"},{name:"Aeroworkflow - 2",regex:"(?:aeroworkflow).{0,40}\\b([a-zA-Z0-9^!]{20})\\b"},{name:"Agora",regex:"(?:agora).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Airbrakeprojectkey - 1",regex:"(?:airbrake).{0,40}\\b([0-9]{6})\\b"},{name:"Airbrakeprojectkey - 2",regex:"(?:airbrake).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Airbrakeuserkey",regex:"(?:airbrake).{0,40}\\b([a-zA-Z-0-9]{40})\\b"},{name:"Airship",regex:"(?:airship).{0,40}\\b([0-9Aa-zA-Z]{91})\\b"},{name:"Airvisual",regex:"(?:airvisual).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Alconost",regex:"(?:alconost).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Alegra - 1",regex:"(?:alegra).{0,40}\\b([a-z0-9-]{20})\\b"},{name:"Alegra - 2",regex:"(?:alegra).{0,40}\\b([a-zA-Z0-9.-@]{25,30})\\b"},{name:"Aletheiaapi",regex:"(?:aletheiaapi).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Algoliaadminkey - 1",regex:"(?:algolia).{0,40}\\b([A-Z0-9]{10})\\b"},{name:"Algoliaadminkey - 2",regex:"(?:algolia).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Alibaba - 2",regex:"\\b(LTAI[a-zA-Z0-9]{17,21})[\\\"' ;\\s]*"},{name:"Alienvault",regex:"(?:alienvault).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Allsports",regex:"(?:allsports).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Amadeus - 1",regex:"(?:amadeus).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Amadeus - 2",regex:"(?:amadeus).{0,40}\\b([0-9A-Za-z]{16})\\b"},{name:"Amazon SNS Topic",regex:"arn:aws:sns:[a-z0-9\\-]+:[0-9]+:[A-Za-z0-9\\-_]+"},{name:"Ambee",regex:"(?:ambee).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Amplitudeapikey",regex:"(?:amplitude).{0,40}\\b([a-f0-9]{32})"},{name:"Apacta",regex:"(?:apacta).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Api2cart",regex:"(?:api2cart).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Apideck - 1",regex:"\\b(sk_live_[a-z0-9A-Z-]{93})\\b"},{name:"Apideck - 2",regex:"(?:apideck).{0,40}\\b([a-z0-9A-Z]{40})\\b"},{name:"Apiflash - 1",regex:"(?:apiflash).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Apiflash - 2",regex:"(?:apiflash).{0,40}\\b([a-zA-Z0-9\\S]{21,30})\\b"},{name:"Apifonica",regex:"(?:apifonica).{0,40}\\b([0-9a-z]{11}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Apify",regex:"\\b(apify\\_api\\_[a-zA-Z-0-9]{36})\\b"},{name:"Apimatic - 1",regex:"(?:apimatic).{0,40}\\b([a-z0-9-\\S]{8,32})\\b"},{name:"Apimatic - 2",regex:"(?:apimatic).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Apiscience",regex:"(?:apiscience).{0,40}\\b([a-bA-Z0-9\\S]{22})\\b"},{name:"Apollo",regex:"(?:apollo).{0,40}\\b([a-zA-Z0-9]{22})\\b"},{name:"Appcues - 1",regex:"(?:appcues).{0,40}\\b([0-9]{5})\\b"},{name:"Appcues - 2",regex:"(?:appcues).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Appcues - 3",regex:"(?:appcues).{0,40}\\b([a-z0-9-]{39})\\b"},{name:"Appfollow",regex:"(?:appfollow).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Appsynergy",regex:"(?:appsynergy).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Apptivo - 1",regex:"(?:apptivo).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Apptivo - 2",regex:"(?:apptivo).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Artifactory - 2",regex:"\\b([A-Za-z0-9](?:[A-Za-z0-9\\-]{0,61}[A-Za-z0-9])\\.jfrog\\.io)"},{name:"Artifactory API Token",regex:'(?:\\s|=|:|"|^)AKC[a-zA-Z0-9]{10,}'},{name:"Artifactory Password",regex:'(?:\\s|=|:|"|^)AP[\\dABCDEF][a-zA-Z0-9]{8,}'},{name:"Artsy - 1",regex:"(?:artsy).{0,40}\\b([0-9a-zA-Z]{20})\\b"},{name:"Artsy - 2",regex:"(?:artsy).{0,40}\\b([0-9a-zA-Z]{32})\\b"},{name:"Asanaoauth",regex:"(?:asana).{0,40}\\b([a-z\\/:0-9]{51})\\b"},{name:"Asanapersonalaccesstoken",regex:"(?:asana).{0,40}\\b([0-9]{1,}\\/[0-9]{16,}:[A-Za-z0-9]{32,})\\b"},{name:"Assemblyai",regex:"(?:assemblyai).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Asymmetric Private Key",regex:"-----BEGIN ((EC|PGP|DSA|RSA|OPENSSH) )?PRIVATE KEY( BLOCK)?-----"},{name:"Audd",regex:"(?:audd).{0,40}\\b([a-z0-9-]{32})\\b"},{name:"Auth0managementapitoken",regex:"(?:auth0).{0,40}\\b(ey[a-zA-Z0-9._-]+)\\b"},{name:"Auth0oauth - 1",regex:"(?:auth0).{0,40}\\b([a-zA-Z0-9_-]{32,60})\\b"},{name:"Autodesk - 1",regex:"(?:autodesk).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Autodesk - 2",regex:"(?:autodesk).{0,40}\\b([0-9A-Za-z]{16})\\b"},{name:"Autoklose",regex:"(?:autoklose).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Autopilot",regex:"(?:autopilot).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Avazapersonalaccesstoken",regex:"(?:avaza).{0,40}\\b([0-9]+-[0-9a-f]{40})\\b"},{name:"Aviationstack",regex:"(?:aviationstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aws - 1",regex:"\\b((?:AKIA|ABIA|ACCA|ASIA)[0-9A-Z]{16})\\b"},{name:"Axonaut",regex:"(?:axonaut).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aylien - 1",regex:"(?:aylien).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aylien - 2",regex:"(?:aylien).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Ayrshare",regex:"(?:ayrshare).{0,40}\\b([A-Z]{7}-[A-Z0-9]{7}-[A-Z0-9]{7}-[A-Z0-9]{7})\\b"},{name:"Bannerbear",regex:"(?:bannerbear).{0,40}\\b([0-9a-zA-Z]{22}tt)\\b"},{name:"Baremetrics",regex:"(?:baremetrics).{0,40}\\b([a-zA-Z0-9_]{25})\\b"},{name:"Baseapiio",regex:"(?:baseapi|base-api).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Beamer",regex:"(?:beamer).{0,40}\\b([a-zA-Z0-9_+/]{45}=)"},{name:"Beebole",regex:"(?:beebole).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Besttime",regex:"(?:besttime).{0,40}\\b([0-9A-Za-z_]{36})\\b"},{name:"Billomat - 1",regex:"(?:billomat).{0,40}\\b([0-9a-z]{1,})\\b"},{name:"Billomat - 2",regex:"(?:billomat).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Bitbar",regex:"(?:bitbar).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Bitcoinaverage",regex:"(?:bitcoinaverage).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Bitfinex",regex:"(?:bitfinex).{0,40}\\b([A-Za-z0-9_-]{43})\\b"},{name:"Bitly Secret Key",regex:"R_[0-9a-f]{32}"},{name:"Bitlyaccesstoken",regex:"(?:bitly).{0,40}\\b([a-zA-Z-0-9]{40})\\b"},{name:"Bitmex - 1",regex:"(?:bitmex).{0,40}([ \\r\\n]{1}[0-9a-zA-Z\\-\\_]{24}[ \\r\\n]{1})"},{name:"Bitmex - 2",regex:"(?:bitmex).{0,40}([ \\r\\n]{1}[0-9a-zA-Z\\-\\_]{48}[ \\r\\n]{1})"},{name:"Blablabus",regex:"(?:blablabus).{0,40}\\b([0-9A-Za-z]{22})\\b"},{name:"Blazemeter",regex:"(?:blazemeter|runscope).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Blitapp",regex:"(?:blitapp).{0,40}\\b([a-zA-Z0-9_-]{39})\\b"},{name:"Blogger",regex:"(?:blogger).{0,40}\\b([0-9A-Za-z-]{39})\\b"},{name:"Bombbomb",regex:"(?:bombbomb).{0,40}\\b([a-zA-Z0-9-._]{704})\\b"},{name:"Boostnote",regex:"(?:boostnote).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Borgbase",regex:"(?:borgbase).{0,40}\\b([a-zA-Z0-9/_.-]{148,152})\\b"},{name:"Braintree API Key",regex:"access_token$production$[0-9a-z]{16}$[0-9a-f]{32}"},{name:"Brandfetch",regex:"(?:brandfetch).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Browshot",regex:"(?:browshot).{0,40}\\b([a-zA-Z-0-9]{28})\\b"},{name:"Buddyns",regex:"(?:buddyns).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Bugherd",regex:"(?:bugherd).{0,40}\\b([0-9a-z]{22})\\b"},{name:"Bugsnag",regex:"(?:bugsnag).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Buildkite",regex:"(?:buildkite).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Bulbul",regex:"(?:bulbul).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Buttercms",regex:"(?:buttercms).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Caflou",regex:"(?:caflou).{0,40}\\b([a-bA-Z0-9\\S]{155})\\b"},{name:"Calendarific",regex:"(?:calendarific).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Calendlyapikey",regex:"(?:calendly).{0,40}\\b([a-zA-Z-0-9]{20}.[a-zA-Z-0-9]{171}.[a-zA-Z-0-9_]{43})\\b"},{name:"Calorieninja",regex:"(?:calorieninja).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Campayn",regex:"(?:campayn).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Cannyio",regex:"(?:canny).{0,40}\\b([a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[0-9]{4}-[a-z0-9]{12})\\b"},{name:"Capsulecrm",regex:"(?:capsulecrm).{0,40}\\b([a-zA-Z0-9-._+=]{64})\\b"},{name:"Captaindata - 1",regex:"(?:captaindata).{0,40}\\b([0-9a-f]{8}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{12})\\b"},{name:"Captaindata - 2",regex:"(?:captaindata).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Carboninterface",regex:"(?:carboninterface).{0,40}\\b([a-zA-Z0-9]{21})\\b"},{name:"Cashboard - 1",regex:"(?:cashboard).{0,40}\\b([0-9A-Z]{3}-[0-9A-Z]{3}-[0-9A-Z]{3}-[0-9A-Z]{3})\\b"},{name:"Cashboard - 2",regex:"(?:cashboard).{0,40}\\b([0-9a-z]{1,})\\b"},{name:"Caspio - 1",regex:"(?:caspio).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Caspio - 2",regex:"(?:caspio).{0,40}\\b([a-z0-9]{50})\\b"},{name:"Censys - 1",regex:"(?:censys).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Censys - 2",regex:"(?:censys).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Centralstationcrm",regex:"(?:centralstation).{0,40}\\b([a-z0-9]{30})\\b"},{name:"Cexio - 1",regex:"(?:cexio|cex.io).{0,40}\\b([a-z]{2}[0-9]{9})\\b"},{name:"Cexio - 2",regex:"(?:cexio|cex.io).{0,40}\\b([0-9A-Za-z]{24,27})\\b"},{name:"Chatbot",regex:"(?:chatbot).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Chatfule",regex:"(?:chatfuel).{0,40}\\b([a-zA-Z0-9]{128})\\b"},{name:"Checio",regex:"(?:checio).{0,40}\\b(pk_[a-z0-9]{45})\\b"},{name:"Checklyhq",regex:"(?:checklyhq).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Checkout - 1",regex:"(?:checkout).{0,40}\\b((sk_|sk_test_)[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})\\b"},{name:"Checkout - 2",regex:"(?:checkout).{0,40}\\b(cus_[0-9a-zA-Z]{26})\\b"},{name:"Checkvist - 1",regex:"(?:checkvist).{0,40}\\b([\\w\\.-]+@[\\w-]+\\.[\\w\\.-]{2,5})\\b"},{name:"Checkvist - 2",regex:"(?:checkvist).{0,40}\\b([0-9a-zA-Z]{14})\\b"},{name:"Cicero",regex:"(?:cicero).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Circleci",regex:"(?:circle).{0,40}([a-fA-F0-9]{40})"},{name:"Clearbit",regex:"(?:clearbit).{0,40}\\b([0-9a-z_]{35})\\b"},{name:"Clickhelp - 1",regex:"\\b([0-9A-Za-z]{3,20}.try.clickhelp.co)\\b"},{name:"Clickhelp - 2",regex:"(?:clickhelp).{0,40}\\b([0-9A-Za-z]{24})\\b"},{name:"Clicksendsms - 2",regex:"(?:sms).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Clickuppersonaltoken",regex:"(?:clickup).{0,40}\\b(pk_[0-9]{8}_[0-9A-Z]{32})\\b"},{name:"Cliengo",regex:"(?:cliengo).{0,40}\\b([0-9a-f]{8}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{12})\\b"},{name:"Clinchpad",regex:"(?:clinchpad).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Clockify",regex:"(?:clockify).{0,40}\\b([a-zA-Z0-9]{48})\\b"},{name:"Clockworksms - 1",regex:"(?:clockwork|textanywhere).{0,40}\\b([0-9a-zA-Z]{24})\\b"},{name:"Clockworksms - 2",regex:"(?:clockwork|textanywhere).{0,40}\\b([0-9]{5})\\b"},{name:"Closecrm",regex:"\\b(api_[a-z0-9A-Z.]{45})\\b"},{name:"Cloudelements - 1",regex:"(?:cloudelements).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Cloudelements - 2",regex:"(?:cloudelements).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Cloudflareapitoken",regex:"(?:cloudflare).{0,40}\\b([A-Za-z0-9_-]{40})\\b"},{name:"Cloudflarecakey",regex:"(?:cloudflare).{0,40}\\b(v[A-Za-z0-9._-]{173,})\\b"},{name:"Cloudimage",regex:"(?:cloudimage).{0,40}\\b([a-z0-9_]{30})\\b"},{name:"Cloudinary Credentials",regex:"cloudinary://[0-9]+:[A-Za-z0-9\\-_\\.]+@[A-Za-z0-9\\-_\\.]+"},{name:"Cloudmersive",regex:"(?:cloudmersive).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Cloudplan",regex:"(?:cloudplan).{0,40}\\b([A-Z0-9-]{32})\\b"},{name:"Cloverly",regex:"(?:cloverly).{0,40}\\b([a-z0-9:_]{28})\\b"},{name:"Cloze - 1",regex:"(?:cloze).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Cloze - 2",regex:"(?:cloze).{0,40}\\b([\\w\\.-]+@[\\w-]+\\.[\\w\\.-]{2,5})\\b"},{name:"Clustdoc",regex:"(?:clustdoc).{0,40}\\b([0-9a-zA-Z]{60})\\b"},{name:"Codacy",regex:"(?:codacy).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Coinapi",regex:"(?:coinapi).{0,40}\\b([A-Z0-9-]{36})\\b"},{name:"Coinbase",regex:"(?:coinbase).{0,40}\\b([a-zA-Z-0-9]{64})\\b"},{name:"Coinlayer",regex:"(?:coinlayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Coinlib",regex:"(?:coinlib).{0,40}\\b([a-z0-9]{16})\\b"},{name:"Column",regex:"(?:column).{0,40}\\b((?:test|live)_[a-zA-Z0-9]{27})\\b"},{name:"Commercejs",regex:"(?:commercejs).{0,40}\\b([a-z0-9_]{48})\\b"},{name:"Commodities",regex:"(?:commodities).{0,40}\\b([a-zA-Z0-9]{60})\\b"},{name:"Companyhub - 1",regex:"(?:companyhub).{0,40}\\b([0-9a-zA-Z]{20})\\b"},{name:"Companyhub - 2",regex:"(?:companyhub).{0,40}\\b([a-zA-Z0-9$%^=-]{4,32})\\b"},{name:"Confluent - 1",regex:"(?:confluent).{0,40}\\b([a-zA-Z-0-9]{16})\\b"},{name:"Confluent - 2",regex:"(?:confluent).{0,40}\\b([a-zA-Z-0-9]{64})\\b"},{name:"Convertkit",regex:"(?:convertkit).{0,40}\\b([a-z0-9A-Z_]{22})\\b"},{name:"Convier",regex:"(?:convier).{0,40}\\b([0-9]{2}\\|[a-zA-Z0-9]{40})\\b"},{name:"Copper - 2",regex:"(?:copper).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Countrylayer",regex:"(?:countrylayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Courier",regex:"(?:courier).{0,40}\\b(pk\\_[a-zA-Z0-9]{1,}\\_[a-zA-Z0-9]{28})\\b"},{name:"Coveralls",regex:"(?:coveralls).{0,40}\\b([a-zA-Z0-9-]{37})\\b"},{name:"Crowdin",regex:"(?:crowdin).{0,40}\\b([0-9A-Za-z]{80})\\b"},{name:"Cryptocompare",regex:"(?:cryptocompare).{0,40}\\b([a-z-0-9]{64})\\b"},{name:"Currencycloud - 1",regex:"(?:currencycloud).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Currencyfreaks",regex:"(?:currencyfreaks).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Currencylayer",regex:"(?:currencylayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Currencyscoop",regex:"(?:currencyscoop).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Currentsapi",regex:"(?:currentsapi).{0,40}\\b([a-zA-Z0-9\\S]{48})\\b"},{name:"Customerguru - 1",regex:"(?:guru).{0,40}\\b([a-z0-9A-Z]{50})\\b"},{name:"Customerguru - 2",regex:"(?:guru).{0,40}\\b([a-z0-9A-Z]{30})\\b"},{name:"Customerio",regex:"(?:customer).{0,40}\\b([a-z0-9A-Z]{20})\\b"},{name:"D7network",regex:"(?:d7network).{0,40}\\b([a-zA-Z0-9\\W\\S]{23}\\=)"},{name:"Dailyco",regex:"(?:daily).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Dandelion",regex:"(?:dandelion).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Databricks",regex:"dapi[a-f0-9]{32}\\b"},{name:"Datadogtoken - 1",regex:"(?:datadog).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Datadogtoken - 2",regex:"(?:datadog).{0,40}\\b([a-zA-Z-0-9]{40})\\b"},{name:"Datafire",regex:"(?:datafire).{0,40}\\b([a-z0-9\\S]{175,190})\\b"},{name:"Datagov",regex:"(?:data.gov).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Debounce",regex:"(?:debounce).{0,40}\\b([a-zA-Z0-9]{13})\\b"},{name:"Deepai",regex:"(?:deepai).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Deepgram",regex:"(?:deepgram).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Delighted",regex:"(?:delighted).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Deputy - 1",regex:"\\b([0-9a-z]{1,}.as.deputy.com)\\b"},{name:"Deputy - 2",regex:"(?:deputy).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Detectlanguage",regex:"(?:detectlanguage).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Dfuse",regex:"\\b(web\\_[0-9a-z]{32})\\b"},{name:"Diffbot",regex:"(?:diffbot).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Digitaloceantoken",regex:"(?:digitalocean).{0,40}\\b([A-Za-z0-9_-]{64})\\b"},{name:"Discordbottoken - 1",regex:"(?:discord).{0,40}\\b([A-Za-z0-9_-]{24}\\.[A-Za-z0-9_-]{6}\\.[A-Za-z0-9_-]{27})\\b"},{name:"Discordbottoken - 2",regex:"(?:discord).{0,40}\\b([0-9]{17})\\b"},{name:"Discordwebhook",regex:"(https:\\/\\/discord.com\\/api\\/webhooks\\/[0-9]{18}\\/[0-9a-zA-Z-]{68})"},{name:"Ditto",regex:"(?:ditto).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12}\\.[a-z0-9]{40})\\b"},{name:"Dnscheck - 1",regex:"(?:dnscheck).{0,40}\\b([a-z0-9A-Z-]{36})\\b"},{name:"Dnscheck - 2",regex:"(?:dnscheck).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Documo",regex:"\\b(ey[a-zA-Z0-9]{34}.ey[a-zA-Z0-9]{154}.[a-zA-Z0-9_-]{43})\\b"},{name:"Doppler",regex:"\\b(dp\\.pt\\.[a-zA-Z0-9]{43})\\b"},{name:"Dotmailer - 1",regex:"(?:dotmailer).{0,40}\\b(apiuser-[a-z0-9]{12}@apiconnector.com)\\b"},{name:"Dotmailer - 2",regex:"(?:dotmailer).{0,40}\\b([a-zA-Z0-9\\S]{8,24})\\b"},{name:"Dovico",regex:"(?:dovico).{0,40}\\b([0-9a-z]{32}\\.[0-9a-z]{1,}\\b)"},{name:"Dronahq",regex:"(?:dronahq).{0,40}\\b([a-z0-9]{50})\\b"},{name:"Droneci",regex:"(?:droneci).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Dropbox",regex:"\\b(sl\\.[A-Za-z0-9\\-\\_]{130,140})\\b"},{name:"Dwolla",regex:"(?:dwolla).{0,40}\\b([a-zA-Z-0-9]{50})\\b"},{name:"Dynalist",regex:"(?:dynalist).{0,40}\\b([a-zA-Z0-9-_]{128})\\b"},{name:"Dynatrace token",regex:"dt0[a-zA-Z]{1}[0-9]{2}\\.[A-Z0-9]{24}\\.[A-Z0-9]{64}"},{name:"Dyspatch",regex:"(?:dyspatch).{0,40}\\b([A-Z0-9]{52})\\b"},{name:"EC",regex:"-----BEGIN EC PRIVATE KEY-----"},{name:"Eagleeyenetworks - 1",regex:"(?:eagleeyenetworks).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Eagleeyenetworks - 2",regex:"(?:eagleeyenetworks).{0,40}\\b([a-zA-Z0-9]{15})\\b"},{name:"Easyinsight - 1",regex:"(?:easyinsight|easy-insight).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Easyinsight - 2",regex:"(?:easyinsight|easy-insight).{0,40}\\b([0-9Aa-zA-Z]{20})\\b"},{name:"Edamam - 1",regex:"(?:edamam).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Edamam - 2",regex:"(?:edamam).{0,40}\\b([0-9a-z]{8})\\b"},{name:"Edenai",regex:"(?:edenai).{0,40}\\b([a-zA-Z0-9]{36}.[a-zA-Z0-9]{92}.[a-zA-Z0-9_]{43})\\b"},{name:"Eightxeight - 1",regex:"(?:8x8).{0,40}\\b([a-zA-Z0-9_]{18,30})\\b"},{name:"Eightxeight - 2",regex:"(?:8x8).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Elasticemail",regex:"(?:elastic).{0,40}\\b([A-Za-z0-9_-]{96})\\b"},{name:"Enablex - 1",regex:"(?:enablex).{0,40}\\b([a-zA-Z0-9]{36})\\b"},{name:"Enablex - 2",regex:"(?:enablex).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Enigma",regex:"(?:enigma).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Ethplorer",regex:"(?:ethplorer).{0,40}\\b([a-z0-9A-Z-]{22})\\b"},{name:"Etsyapikey",regex:"(?:etsy).{0,40}\\b([a-zA-Z-0-9]{24})\\b"},{name:"Everhour",regex:"(?:everhour).{0,40}\\b([0-9Aa-f]{4}-[0-9a-f]{4}-[0-9a-f]{6}-[0-9a-f]{6}-[0-9a-f]{8})\\b"},{name:"Exchangerateapi",regex:"(?:exchangerate).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Exchangeratesapi",regex:"(?:exchangerates).{0,40}\\b([a-z0-9]{32})\\b"},{name:"FCM Server Key",regex:"AAAA[a-zA-Z0-9_-]{7}:[a-zA-Z0-9_-]{140}"},{name:"FCM_server_key",regex:"(AAAA[a-zA-Z0-9_-]{7}:[a-zA-Z0-9_-]{140})"},{name:"Facebook Access Token",regex:"EAACEdEose0cBA[0-9A-Za-z]+"},{name:"Facebook OAuth",regex:`[fF][aA][cC][eE][bB][oO][oO][kK].*['|"][0-9a-f]{32}['|"]`},{name:"Facebookoauth",regex:"(?:facebook).{0,40}\\b([A-Za-z0-9]{32})\\b"},{name:"Faceplusplus",regex:"(?:faceplusplus).{0,40}\\b([0-9a-zA-Z_-]{32})\\b"},{name:"Fakejson",regex:"(?:fakejson).{0,40}\\b([a-zA-Z0-9]{22})\\b"},{name:"Fastforex",regex:"(?:fastforex).{0,40}\\b([a-z0-9-]{28})\\b"},{name:"Fastlypersonaltoken",regex:"(?:fastly).{0,40}\\b([A-Za-z0-9_-]{32})\\b"},{name:"Feedier",regex:"(?:feedier).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Fetchrss",regex:"(?:fetchrss).{0,40}\\b([0-9A-Za-z.]{40})\\b"},{name:"Figmapersonalaccesstoken",regex:"(?:figma).{0,40}\\b([0-9]{6}-[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Fileio",regex:"(?:fileio).{0,40}\\b([A-Z0-9.-]{39})\\b"},{name:"Finage",regex:"\\b(API_KEY[0-9A-Z]{32})\\b"},{name:"Financialmodelingprep",regex:"(?:financialmodelingprep).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Findl",regex:"(?:findl).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12})\\b"},{name:"Finnhub",regex:"(?:finnhub).{0,40}\\b([0-9a-z]{20})\\b"},{name:"Firebase Database Detect - 1",regex:"[a-z0-9.-]+\\.firebaseio\\.com"},{name:"Firebase Database Detect - 2",regex:"[a-z0-9.-]+\\.firebaseapp\\.com"},{name:"Fixerio",regex:"(?:fixer).{0,40}\\b([A-Za-z0-9]{32})\\b"},{name:"Flatio",regex:"(?:flat).{0,40}\\b([0-9a-z]{128})\\b"},{name:"Fleetbase",regex:"\\b(flb_live_[0-9a-zA-Z]{20})\\b"},{name:"Flickr",regex:"(?:flickr).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Flightapi",regex:"(?:flightapi).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Flightstats - 1",regex:"(?:flightstats).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Flightstats - 2",regex:"(?:flightstats).{0,40}\\b([0-9a-z]{8})\\b"},{name:"Float",regex:"(?:float).{0,40}\\b([a-zA-Z0-9-._+=]{59,60})\\b"},{name:"Flowflu - 2",regex:"(?:flowflu).{0,40}\\b([a-zA-Z0-9]{51})\\b"},{name:"Flutterwave",regex:"\\b(FLWSECK-[0-9a-z]{32}-X)\\b"},{name:"Fmfw - 1",regex:"(?:fmfw).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Fmfw - 2",regex:"(?:fmfw).{0,40}\\b([a-zA-Z0-9_-]{32})\\b"},{name:"Formbucket",regex:"(?:formbucket).{0,40}\\b([0-9A-Za-z]{1,}.[0-9A-Za-z]{1,}\\.[0-9A-Z-a-z\\-_]{1,})"},{name:"Formio",regex:"(?:formio).{0,40}\\b(eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9\\.[0-9A-Za-z]{310}\\.[0-9A-Z-a-z\\-_]{43}[ \\r\\n]{1})"},{name:"Foursquare",regex:"(?:foursquare).{0,40}\\b([0-9A-Z]{48})\\b"},{name:"Frameio",regex:"\\b(fio-u-[0-9a-zA-Z_-]{64})\\b"},{name:"Freshbooks - 1",regex:"(?:freshbooks).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Freshbooks - 2",regex:"(?:freshbooks).{0,40}\\b(https://www.[0-9A-Za-z_-]{1,}.com)\\b"},{name:"Freshdesk - 1",regex:"(?:freshdesk).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Freshdesk - 2",regex:"\\b([0-9a-z-]{1,}.freshdesk.com)\\b"},{name:"Front",regex:"(?:front).{0,40}\\b([0-9a-zA-Z]{36}.[0-9a-zA-Z\\.\\-\\_]{188,244})\\b"},{name:"Fulcrum",regex:"(?:fulcrum).{0,40}\\b([a-z0-9]{80})\\b"},{name:"Fullstory",regex:"(?:fullstory).{0,40}\\b([a-zA-Z-0-9/+]{88})\\b"},{name:"Fusebill",regex:"(?:fusebill).{0,40}\\b([a-zA-Z0-9]{88})\\b"},{name:"Fxmarket",regex:"(?:fxmarket).{0,40}\\b([0-9Aa-zA-Z-_=]{20})\\b"},{name:"Gcp",regex:"\\{[^{]+auth_provider_x509_cert_url[^}]+\\}"},{name:"Geckoboard",regex:"(?:geckoboard).{0,40}\\b([a-zA-Z0-9]{44})\\b"},{name:"Generic - 1376",regex:"jdbc:mysql(=| =|:| :)"},{name:"Generic - 1688",regex:"TOKEN[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1689",regex:"API[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1691",regex:"SECRET[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1692",regex:"AUTHORIZATION[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1693",regex:"PASSWORD[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1695",regex:`(A|a)(P|p)(Ii)[\\-|_|A-Za-z0-9]*(\\''|")?( )*(:|=)( )*(\\''|")?[0-9A-Za-z\\-_]+(\\''|")?`},{name:"Generic - 1700",regex:"BEGIN OPENSSH PRIVATE KEY"},{name:"Generic - 1701",regex:"BEGIN PRIVATE KEY"},{name:"Generic - 1702",regex:"BEGIN RSA PRIVATE KEY"},{name:"Generic - 1703",regex:"BEGIN DSA PRIVATE KEY"},{name:"Generic - 1704",regex:"BEGIN EC PRIVATE KEY"},{name:"Generic - 1705",regex:"BEGIN PGP PRIVATE KEY BLOCK"},{name:"Generic - 1707",regex:"[a-z0-9.-]+\\.s3-[a-z0-9-]\\.amazonaws\\.com"},{name:"Generic - 1708",regex:"[a-z0-9.-]+\\.s3-website[.-](eu|ap|us|ca|sa|cn)"},{name:"Generic - 1710",regex:"algolia_api_key"},{name:"Generic - 1711",regex:"asana_access_token"},{name:"Generic - 1713",regex:"azure_tenant"},{name:"Generic - 1714",regex:"bitly_access_token"},{name:"Generic - 1715",regex:"branchio_secret"},{name:"Generic - 1716",regex:"browserstack_access_key"},{name:"Generic - 1717",regex:"buildkite_access_token"},{name:"Generic - 1718",regex:"comcast_access_token"},{name:"Generic - 1719",regex:"datadog_api_key"},{name:"Generic - 1720",regex:"deviantart_secret"},{name:"Generic - 1721",regex:"deviantart_access_token"},{name:"Generic - 1722",regex:"dropbox_api_token"},{name:"Generic - 1723",regex:"facebook_appsecret"},{name:"Generic - 1724",regex:"facebook_access_token"},{name:"Generic - 1725",regex:"firebase_custom_token"},{name:"Generic - 1726",regex:"firebase_id_token"},{name:"Generic - 1727",regex:"github_client"},{name:"Generic - 1728",regex:"github_ssh_key"},{name:"Generic - 1730",regex:"gitlab_private_token"},{name:"Generic - 1731",regex:"google_cm"},{name:"Generic - 1732",regex:"google_maps_key"},{name:"Generic - 1733",regex:"heroku_api_key"},{name:"Generic - 1734",regex:"instagram_access_token"},{name:"Generic - 1735",regex:"mailchimp_api_key"},{name:"Generic - 1736",regex:"mailgun_api_key"},{name:"Generic - 1737",regex:"mailjet"},{name:"Generic - 1738",regex:"mapbox_access_token"},{name:"Generic - 1739",regex:"pagerduty_api_token"},{name:"Generic - 1740",regex:"paypal_key_sb"},{name:"Generic - 1741",regex:"paypal_key_live"},{name:"Generic - 1742",regex:"paypal_token_sb"},{name:"Generic - 1743",regex:"paypal_token_live"},{name:"Generic - 1744",regex:"pendo_integration_key"},{name:"Generic - 1745",regex:"salesforce_access_token"},{name:"Generic - 1746",regex:"saucelabs_ukey"},{name:"Generic - 1747",regex:"sendgrid_api_key"},{name:"Generic - 1748",regex:"slack_api_token"},{name:"Generic - 1749",regex:"slack_webhook"},{name:"Generic - 1750",regex:"square_secret"},{name:"Generic - 1751",regex:"square_auth_token"},{name:"Generic - 1752",regex:"travisci_api_token"},{name:"Generic - 1753",regex:"twilio_sid_token"},{name:"Generic - 1754",regex:"twitter_api_secret"},{name:"Generic - 1755",regex:"twitter_bearer_token"},{name:"Generic - 1756",regex:"spotify_access_token"},{name:"Generic - 1757",regex:"stripe_key_live"},{name:"Generic - 1758",regex:"wakatime_api_key"},{name:"Generic - 1759",regex:"wompi_auth_bearer_sb"},{name:"Generic - 1760",regex:"wompi_auth_bearer_live"},{name:"Generic - 1761",regex:"wpengine_api_key"},{name:"Generic - 1762",regex:"zapier_webhook"},{name:"Generic - 1763",regex:"zendesk_access_token"},{name:"Generic - 1764",regex:"ssh-rsa"},{name:"Generic - 1765",regex:"s3-[a-z0-9-]+\\.amazonaws\\.com/[a-z0-9._-]+"},{name:"Generic webhook secret",regex:"(webhook).+(secret|token|key).+"},{name:"Gengo",regex:"(?:gengo).{0,40}([ ]{0,1}[0-9a-zA-Z\\[\\]\\-\\(\\)\\{\\}|_^@$=~]{64}[ \\r\\n]{1})"},{name:"Geoapify",regex:"(?:geoapify).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Geocode",regex:"(?:geocode).{0,40}\\b([a-z0-9]{28})\\b"},{name:"Geocodify",regex:"(?:geocodify).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Geocodio - 2",regex:"(?:geocod).{0,40}\\b([a-z0-9]{39})\\b"},{name:"Geoipifi",regex:"(?:ipifi).{0,40}\\b([a-z0-9A-Z_]{32})\\b"},{name:"Getemail",regex:"(?:getemail).{0,40}\\b([a-zA-Z0-9-]{20})\\b"},{name:"Getemails - 1",regex:"(?:getemails).{0,40}\\b([a-z0-9-]{26})\\b"},{name:"Getemails - 2",regex:"(?:getemails).{0,40}\\b([a-z0-9-]{18})\\b"},{name:"Getgeoapi",regex:"(?:getgeoapi).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Getgist",regex:"(?:getgist).{0,40}\\b([a-z0-9A-Z+=]{68})"},{name:"Getsandbox - 1",regex:"(?:getsandbox).{0,40}\\b([a-z0-9-]{40})\\b"},{name:"Getsandbox - 2",regex:"(?:getsandbox).{0,40}\\b([a-z0-9-]{15,30})\\b"},{name:"GitHub",regex:`[gG][iI][tT][hH][uU][bB].*['|"][0-9a-zA-Z]{35,40}['|"]`},{name:"Github - 2",regex:"\\b((?:ghp|gho|ghu|ghs|ghr)_[a-zA-Z0-9]{36,255}\\b)"},{name:"Github App Token",regex:"(ghu|ghs)_[0-9a-zA-Z]{36}"},{name:"Github OAuth Access Token",regex:"gho_[0-9a-zA-Z]{36}"},{name:"Github Personal Access Token",regex:"ghp_[0-9a-zA-Z]{36}"},{name:"Github Refresh Token",regex:"ghr_[0-9a-zA-Z]{76}"},{name:"Github_old",regex:`(?:github)[^\\.].{0,40}[ =:'"]+([a-f0-9]{40})\\b`},{name:"Githubapp - 1",regex:"(?:github).{0,40}\\b([0-9]{6})\\b"},{name:"Githubapp - 2",regex:"(?:github).{0,40}(-----BEGIN RSA PRIVATE KEY-----\\s[A-Za-z0-9+\\/\\s]*\\s-----END RSA PRIVATE KEY-----)"},{name:"Gitlab",regex:"(?:gitlab).{0,40}\\b([a-zA-Z0-9\\-=_]{20,22})\\b"},{name:"Gitlabv2",regex:"\\b(glpat-[a-zA-Z0-9\\-=_]{20,22})\\b"},{name:"Gitter",regex:"(?:gitter).{0,40}\\b([a-z0-9-]{40})\\b"},{name:"Glassnode",regex:"(?:glassnode).{0,40}\\b([0-9A-Za-z]{27})\\b"},{name:"Gocanvas - 1",regex:"(?:gocanvas).{0,40}\\b([0-9A-Za-z/+]{43}=[ \\r\\n]{1})"},{name:"Gocanvas - 2",regex:"(?:gocanvas).{0,40}\\b([\\w\\.-]+@[\\w-]+\\.[\\w\\.-]{2,5})\\b"},{name:"Gocardless",regex:`\\b(live_[0-9A-Za-z\\_\\-]{40}[ "'\\r\\n]{1})`},{name:"Goodday",regex:"(?:goodday).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Google (GCP) Service Account",regex:'"type": "service_account"'},{name:"Google API Key",regex:"AIza[0-9a-z-_]{35}"},{name:"Google Calendar URI",regex:"https://www\\.google\\.com/calendar/embed\\?src=[A-Za-z0-9%@&;=\\-_\\./]+"},{name:"Graphcms - 1",regex:"(?:graph).{0,40}\\b([a-z0-9]{25})\\b"},{name:"Graphcms - 2",regex:"\\b(ey[a-zA-Z0-9]{73}.ey[a-zA-Z0-9]{365}.[a-zA-Z0-9_-]{683})\\b"},{name:"Graphhopper",regex:"(?:graphhopper).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Groovehq",regex:"(?:groove).{0,40}\\b([a-z0-9A-Z]{64})"},{name:"Guru - 1",regex:"(?:guru).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Guru - 2",regex:"(?:guru).{0,40}\\b([a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Gyazo",regex:"(?:gyazo).{0,40}\\b([0-9A-Za-z-]{43})\\b"},{name:"Happi",regex:"(?:happi).{0,40}\\b([a-zA-Z0-9]{56})"},{name:"Happyscribe",regex:"(?:happyscribe).{0,40}\\b([0-9a-zA-Z]{24})\\b"},{name:"Harvest - 1",regex:"(?:harvest).{0,40}\\b([a-z0-9A-Z._]{97})\\b"},{name:"Harvest - 2",regex:"(?:harvest).{0,40}\\b([0-9]{4,9})\\b"},{name:"Hellosign",regex:"(?:hellosign).{0,40}\\b([a-zA-Z-0-9/+]{64})\\b"},{name:"Helpcrunch",regex:"(?:helpcrunch).{0,40}\\b([a-zA-Z-0-9+/=]{328})"},{name:"Helpscout",regex:"(?:helpscout).{0,40}\\b([A-Za-z0-9]{56})\\b"},{name:"Hereapi",regex:"(?:hereapi).{0,40}\\b([a-zA-Z0-9\\S]{43})\\b"},{name:"Heroku",regex:"(?:heroku).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Hive - 1",regex:"(?:hive).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Hive - 2",regex:"(?:hive).{0,40}\\b([0-9A-Za-z]{17})\\b"},{name:"Hiveage",regex:"(?:hiveage).{0,40}\\b([0-9A-Za-z\\_\\-]{20})\\b"},{name:"Holidayapi",regex:"(?:holidayapi).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Host",regex:"(?:host).{0,40}\\b([a-z0-9]{14})\\b"},{name:"Html2pdf",regex:"(?:html2pdf).{0,40}\\b([a-zA-Z0-9]{64})\\b"},{name:"Hubspotapikey",regex:"(?:hubspot).{0,40}\\b([A-Za-z0-9]{8}\\-[A-Za-z0-9]{4}\\-[A-Za-z0-9]{4}\\-[A-Za-z0-9]{4}\\-[A-Za-z0-9]{12})\\b"},{name:"Humanity",regex:"(?:humanity).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Hunter",regex:"(?:hunter).{0,40}\\b([a-z0-9_-]{40})\\b"},{name:"Hypertrack - 1",regex:"(?:hypertrack).{0,40}\\b([0-9a-zA-Z\\_\\-]{54})\\b"},{name:"Hypertrack - 2",regex:"(?:hypertrack).{0,40}\\b([0-9a-zA-Z\\_\\-]{27})\\b"},{name:"Ibmclouduserkey",regex:"(?:ibm).{0,40}\\b([A-Za-z0-9_-]{44})\\b"},{name:"Iconfinder",regex:"(?:iconfinder).{0,40}\\b([a-zA-Z0-9]{64})\\b"},{name:"Iexcloud",regex:"(?:iexcloud).{0,40}\\b([a-z0-9_]{35})\\b"},{name:"Imagekit",regex:"(?:imagekit).{0,40}\\b([a-zA-Z0-9_=]{36})"},{name:"Imagga",regex:"(?:imagga).{0,40}\\b([a-z0-9A-Z=]{72})"},{name:"Impala",regex:"(?:impala).{0,40}\\b([0-9A-Za-z_]{46})\\b"},{name:"Insightly",regex:"(?:insightly).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Integromat",regex:"(?:integromat).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Intercom",regex:"(?:intercom).{0,40}\\b([a-zA-Z0-9\\W\\S]{59}\\=)"},{name:"Intrinio",regex:"(?:intrinio).{0,40}\\b([a-zA-Z0-9]{44})\\b"},{name:"Invoiceocean - 1",regex:"(?:invoiceocean).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Invoiceocean - 2",regex:"\\b([0-9a-z]{1,}.invoiceocean.com)\\b"},{name:"Ipapi",regex:"(?:ipapi).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Ipgeolocation",regex:"(?:ipgeolocation).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Ipify",regex:"(?:ipify).{0,40}\\b([a-zA-Z0-9_-]{32})\\b"},{name:"Ipinfodb",regex:"(?:ipinfodb).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Ipquality",regex:"(?:ipquality).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Ipstack",regex:"(?:ipstack).{0,40}\\b([a-fA-f0-9]{32})\\b"},{name:"JDBC Connection String",regex:"jdbc:[a-z:]+://[A-Za-z0-9\\.\\-_:;=/@?,&]+"},{name:"Jiratoken - 1",regex:"(?:jira).{0,40}\\b([a-zA-Z-0-9]{24})\\b"},{name:"Jiratoken - 2",regex:"(?:jira).{0,40}\\b([a-zA-Z-0-9]{5,24}\\@[a-zA-Z-0-9]{3,16}\\.com)\\b"},{name:"Jiratoken - 3",regex:"(?:jira).{0,40}\\b([a-zA-Z-0-9]{5,24}\\.[a-zA-Z-0-9]{3,16}\\.[a-zA-Z-0-9]{3,16})\\b"},{name:"Jotform",regex:"(?:jotform).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Jumpcloud",regex:"(?:jumpcloud).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Juro",regex:"(?:juro).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Kanban - 1",regex:"(?:kanban).{0,40}\\b([0-9A-Z]{12})\\b"},{name:"Kanban - 2",regex:"\\b([0-9a-z]{1,}.kanbantool.com)\\b"},{name:"Karmacrm",regex:"(?:karma).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Keenio - 1",regex:"(?:keen).{0,40}\\b([0-9a-z]{24})\\b"},{name:"Keenio - 2",regex:"(?:keen).{0,40}\\b([0-9A-Z]{64})\\b"},{name:"Kickbox",regex:"(?:kickbox).{0,40}\\b([a-zA-Z0-9_]+[a-zA-Z0-9]{64})\\b"},{name:"Klipfolio",regex:"(?:klipfolio).{0,40}\\b([0-9a-f]{40})\\b"},{name:"Kontent",regex:"(?:kontent).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Kraken - 1",regex:`(?:kraken).{0,40}\\b([0-9A-Za-z\\/\\+=]{56}[ "'\\r\\n]{1})`},{name:"Kraken - 2",regex:`(?:kraken).{0,40}\\b([0-9A-Za-z\\/\\+=]{86,88}[ "'\\r\\n]{1})`},{name:"Kucoin - 1",regex:"(?:kucoin).{0,40}([ \\r\\n]{1}[!-~]{7,32}[ \\r\\n]{1})"},{name:"Kucoin - 2",regex:"(?:kucoin).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Kucoin - 3",regex:"(?:kucoin).{0,40}\\b([0-9a-f]{24})\\b"},{name:"Kylas",regex:"(?:kylas).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Languagelayer",regex:"(?:languagelayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Lastfm",regex:"(?:lastfm).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Launchdarkly",regex:"(?:launchdarkly).{0,40}\\b([a-z0-9-]{40})\\b"},{name:"Leadfeeder",regex:"(?:leadfeeder).{0,40}\\b([a-zA-Z0-9-]{43})\\b"},{name:"Lendflow",regex:"(?:lendflow).{0,40}\\b([a-zA-Z0-9]{36}\\.[a-zA-Z0-9]{235}\\.[a-zA-Z0-9]{32}\\-[a-zA-Z0-9]{47}\\-[a-zA-Z0-9_]{162}\\-[a-zA-Z0-9]{42}\\-[a-zA-Z0-9_]{40}\\-[a-zA-Z0-9_]{66}\\-[a-zA-Z0-9_]{59}\\-[a-zA-Z0-9]{7}\\-[a-zA-Z0-9_]{220})\\b"},{name:"Lessannoyingcrm",regex:"(?:less).{0,40}\\b([a-zA-Z0-9-]{57})\\b"},{name:"Lexigram",regex:"(?:lexigram).{0,40}\\b([a-zA-Z0-9\\S]{301})\\b"},{name:"Linearapi",regex:"\\b(lin_api_[0-9A-Za-z]{40})\\b"},{name:"Linemessaging",regex:"(?:line).{0,40}\\b([A-Za-z0-9+/]{171,172})\\b"},{name:"Linenotify",regex:"(?:linenotify).{0,40}\\b([0-9A-Za-z]{43})\\b"},{name:"Linkpreview",regex:"(?:linkpreview).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Liveagent",regex:"(?:liveagent).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Livestorm",regex:"(?:livestorm).{0,40}\\b(eyJhbGciOiJIUzI1NiJ9\\.eyJhdWQiOiJhcGkubGl2ZXN0b3JtLmNvIiwianRpIjoi[0-9A-Z-a-z]{134}\\.[0-9A-Za-z\\-\\_]{43}[ \\r\\n]{1})"},{name:"Locationiq",regex:"\\b(pk\\.[a-zA-Z-0-9]{32})\\b"},{name:"Loginradius",regex:"(?:loginradius).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Lokalisetoken",regex:"(?:lokalise).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Loyverse",regex:"(?:loyverse).{0,40}\\b([0-9-a-z]{32})\\b"},{name:"Luno - 1",regex:"(?:luno).{0,40}\\b([a-z0-9]{13})\\b"},{name:"Luno - 2",regex:"(?:luno).{0,40}\\b([a-zA-Z0-9_-]{43})\\b"},{name:"M3o",regex:"(?:m3o).{0,40}\\b([0-9A-Za-z]{48})\\b"},{name:"Macaddress",regex:"(?:macaddress).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Madkudu",regex:"(?:madkudu).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Magnetic",regex:"(?:magnetic).{0,40}\\b([0-9Aa-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Mailboxlayer",regex:"(?:mailboxlayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mailerlite",regex:"(?:mailerlite).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mailgun - 2",regex:"(?:mailgun).{0,40}\\b([a-zA-Z-0-9]{72})\\b"},{name:"Mailgun API Key - 1",regex:"key-[0-9a-zA-Z]{32}"},{name:"Mailgun API key - 2",regex:"(mailgun|mg)[0-9a-z]{32}"},{name:"Mailjetbasicauth",regex:"(?:mailjet).{0,40}\\b([A-Za-z0-9]{87}\\=)"},{name:"Mailjetsms",regex:"(?:mailjet).{0,40}\\b([A-Za-z0-9]{32})\\b"},{name:"Mailmodo",regex:"(?:mailmodo).{0,40}\\b([A-Z0-9]{7}-[A-Z0-9]{7}-[A-Z0-9]{7}-[A-Z0-9]{7})\\b"},{name:"Mailsac",regex:"(?:mailsac).{0,40}\\b(k_[0-9A-Za-z]{36,})\\b"},{name:"Mandrill",regex:"(?:mandrill).{0,40}\\b([A-Za-z0-9_-]{22})\\b"},{name:"Manifest",regex:"(?:manifest).{0,40}\\b([a-zA-z0-9]{32})\\b"},{name:"Mapbox - 2",regex:"\\b(sk\\.[a-zA-Z-0-9\\.]{80,240})\\b"},{name:"Mapquest",regex:"(?:mapquest).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Marketstack",regex:"(?:marketstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mattermostpersonaltoken - 1",regex:"(?:mattermost).{0,40}\\b([A-Za-z0-9-_]{1,}.cloud.mattermost.com)\\b"},{name:"Mattermostpersonaltoken - 2",regex:"(?:mattermost).{0,40}\\b([a-z0-9]{26})\\b"},{name:"Mavenlink",regex:"(?:mavenlink).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Maxmindlicense - 1",regex:"(?:maxmind|geoip).{0,40}\\b([0-9A-Za-z]{16})\\b"},{name:"Maxmindlicense - 2",regex:"(?:maxmind|geoip).{0,40}\\b([0-9]{2,7})\\b"},{name:"Meaningcloud",regex:"(?:meaningcloud).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mediastack",regex:"(?:mediastack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Meistertask",regex:"(?:meistertask).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Mesibo",regex:"(?:mesibo).{0,40}\\b([0-9A-Za-z]{64})\\b"},{name:"Messagebird",regex:"(?:messagebird).{0,40}\\b([A-Za-z0-9_-]{25})\\b"},{name:"Metaapi - 1",regex:"(?:metaapi|meta-api).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Metaapi - 2",regex:"(?:metaapi|meta-api).{0,40}\\b([0-9a-f]{24})\\b"},{name:"Metrilo",regex:"(?:metrilo).{0,40}\\b([a-z0-9]{16})\\b"},{name:"Microsoftteamswebhook",regex:"(https:\\/\\/[a-zA-Z-0-9]+\\.webhook\\.office\\.com\\/webhookb2\\/[a-zA-Z-0-9]{8}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{12}\\@[a-zA-Z-0-9]{8}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{12}\\/IncomingWebhook\\/[a-zA-Z-0-9]{32}\\/[a-zA-Z-0-9]{8}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{12})"},{name:"Midise",regex:"midi-662b69edd2[a-zA-Z0-9]{54}"},{name:"Mindmeister",regex:"(?:mindmeister).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Mite - 1",regex:"(?:mite).{0,40}\\b([0-9a-z]{16})\\b"},{name:"Mite - 2",regex:"\\b([0-9a-z-]{1,}.mite.yo.lk)\\b"},{name:"Mixmax",regex:"(?:mixmax).{0,40}\\b([a-zA-Z0-9_-]{36})\\b"},{name:"Mixpanel - 1",regex:"(?:mixpanel).{0,40}\\b([a-zA-Z0-9.-]{30,40})\\b"},{name:"Mixpanel - 2",regex:"(?:mixpanel).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Moderation",regex:"(?:moderation).{0,40}\\b([a-zA-Z0-9]{36}\\.[a-zA-Z0-9]{115}\\.[a-zA-Z0-9_]{43})\\b"},{name:"Monday",regex:"(?:monday).{0,40}\\b(ey[a-zA-Z0-9_.]{210,225})\\b"},{name:"Moonclerck",regex:"(?:moonclerck).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Moonclerk",regex:"(?:moonclerk).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Moosend",regex:"(?:moosend).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Mrticktock - 1",regex:"(?:mrticktock).{0,40}\\b([a-zA-Z0-9!=@#$%()_^]{1,50})"},{name:"Myfreshworks - 2",regex:"(?:freshworks).{0,40}\\b([a-z0-9A-Z-]{22})\\b"},{name:"Myintervals",regex:"(?:myintervals).{0,40}\\b([0-9a-z]{11})\\b"},{name:"Nasdaqdatalink",regex:"(?:nasdaq).{0,40}\\b([a-zA-Z0-9_-]{20})\\b"},{name:"Nethunt - 1",regex:"(?:nethunt).{0,40}\\b([a-zA-Z0-9.-@]{25,30})\\b"},{name:"Nethunt - 2",regex:"(?:nethunt).{0,40}\\b([a-z0-9-\\S]{36})\\b"},{name:"Netlify",regex:"(?:netlify).{0,40}\\b([A-Za-z0-9_-]{43,45})\\b"},{name:"Neutrinoapi - 1",regex:"(?:neutrinoapi).{0,40}\\b([a-zA-Z0-9]{48})\\b"},{name:"Neutrinoapi - 2",regex:"(?:neutrinoapi).{0,40}\\b([a-zA-Z0-9]{6,24})\\b"},{name:"Newrelic Admin API Key",regex:"NRAA-[a-f0-9]{27}"},{name:"Newrelic Insights API Key",regex:"NRI(?:I|Q)-[A-Za-z0-9\\-_]{32}"},{name:"Newrelic REST API Key",regex:"NRRA-[a-f0-9]{42}"},{name:"Newrelic Synthetics Location Key",regex:"NRSP-[a-z]{2}[0-9]{2}[a-f0-9]{31}"},{name:"Newrelicpersonalapikey",regex:"(?:newrelic).{0,40}\\b([A-Za-z0-9_\\.]{4}-[A-Za-z0-9_\\.]{42})\\b"},{name:"Newsapi",regex:"(?:newsapi).{0,40}\\b([a-z0-9]{32})"},{name:"Newscatcher",regex:"(?:newscatcher).{0,40}\\b([0-9A-Za-z_]{43})\\b"},{name:"Nexmoapikey - 1",regex:"(?:nexmo).{0,40}\\b([A-Za-z0-9_-]{8})\\b"},{name:"Nexmoapikey - 2",regex:"(?:nexmo).{0,40}\\b([A-Za-z0-9_-]{16})\\b"},{name:"Nftport",regex:"(?:nftport).{0,40}\\b([a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Nicereply",regex:"(?:nicereply).{0,40}\\b([0-9a-f]{40})\\b"},{name:"Nimble",regex:"(?:nimble).{0,40}\\b([a-zA-Z0-9]{30})\\b"},{name:"Nitro",regex:"(?:nitro).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Noticeable",regex:"(?:noticeable).{0,40}\\b([0-9a-zA-Z]{20})\\b"},{name:"Notion",regex:"\\b(secret_[A-Za-z0-9]{43})\\b"},{name:"Nozbeteams",regex:"(?:nozbe|nozbeteams).{0,40}\\b([0-9A-Za-z]{16}_[0-9A-Za-z\\-_]{64}[ \\r\\n]{1})"},{name:"Numverify",regex:"(?:numverify).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Nutritionix - 1",regex:"(?:nutritionix).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Nutritionix - 2",regex:"(?:nutritionix).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Nylas",regex:"(?:nylas).{0,40}\\b([0-9A-Za-z]{30})\\b"},{name:"Nytimes",regex:"(?:nytimes).{0,40}\\b([a-z0-9A-Z-]{32})\\b"},{name:"Oanda",regex:"(?:oanda).{0,40}\\b([a-zA-Z0-9]{24})\\b"},{name:"Omnisend",regex:"(?:omnisend).{0,40}\\b([a-z0-9A-Z-]{75})\\b"},{name:"Onedesk - 1",regex:"(?:onedesk).{0,40}\\b([a-zA-Z0-9!=@#$%^]{8,64})"},{name:"Onelogin - 2",regex:`secret[a-zA-Z0-9_' "=]{0,20}([a-z0-9]{64})`},{name:"Onepagecrm - 1",regex:"(?:onepagecrm).{0,40}\\b([a-zA-Z0-9=]{44})"},{name:"Onepagecrm - 2",regex:"(?:onepagecrm).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Onwaterio",regex:"(?:onwater).{0,40}\\b([a-zA-Z0-9_-]{20})\\b"},{name:"Oopspam",regex:"(?:oopspam).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Opencagedata",regex:"(?:opencagedata).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Opengraphr",regex:"(?:opengraphr).{0,40}\\b([0-9Aa-zA-Z]{80})\\b"},{name:"Openuv",regex:"(?:openuv).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Openweather",regex:"(?:openweather).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Optimizely",regex:"(?:optimizely).{0,40}\\b([0-9A-Za-z-:]{54})\\b"},{name:"Owlbot",regex:"(?:owlbot).{0,40}\\b([a-z0-9]{40})\\b"},{name:"PGP private key block",regex:"-----BEGIN PGP PRIVATE KEY BLOCK-----"},{name:"Pagerdutyapikey",regex:"(?:pagerduty).{0,40}\\b([a-z]{1}\\+[a-zA-Z]{9}\\-[a-z]{2}\\-[a-z0-9]{5})\\b"},{name:"Pandadoc",regex:"(?:pandadoc).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Pandascore",regex:"(?:pandascore).{0,40}([ \\r\\n]{0,1}[0-9A-Za-z\\-\\_]{51}[ \\r\\n]{1})"},{name:"Paralleldots",regex:"(?:paralleldots).{0,40}\\b([0-9A-Za-z]{43})\\b"},{name:"Partnerstack",regex:"(?:partnerstack).{0,40}\\b([0-9A-Za-z]{64})\\b"},{name:"Passbase",regex:"(?:passbase).{0,40}\\b([a-zA-Z0-9]{128})\\b"},{name:"Pastebin",regex:"(?:pastebin).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"PayPal Braintree access token",regex:"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-f]{32}"},{name:"Paymoapp",regex:"(?:paymoapp).{0,40}\\b([a-zA-Z0-9]{44})\\b"},{name:"Paymongo",regex:"(?:paymongo).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Paypaloauth - 1",regex:"\\b([A-Za-z0-9_\\.]{7}-[A-Za-z0-9_\\.]{72})\\b"},{name:"Paypaloauth - 2",regex:"\\b([A-Za-z0-9_\\.]{69}-[A-Za-z0-9_\\.]{10})\\b"},{name:"Paystack",regex:"\\b(sk\\_[a-z]{1,}\\_[A-Za-z0-9]{40})\\b"},{name:"Pdflayer",regex:"(?:pdflayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Pdfshift",regex:"(?:pdfshift).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Peopledatalabs",regex:"(?:peopledatalabs).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Pepipost",regex:"(?:pepipost|netcore).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Picatic API key",regex:"sk_live_[0-9a-z]{32}"},{name:"Pipedream",regex:"(?:pipedream).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Pipedrive",regex:"(?:pipedrive).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Pivotaltracker",regex:"(?:pivotal).{0,40}([a-z0-9]{32})"},{name:"Pixabay",regex:"(?:pixabay).{0,40}\\b([a-z0-9-]{34})\\b"},{name:"Plaidkey - 1",regex:"(?:plaid).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Plaidkey - 2",regex:"(?:plaid).{0,40}\\b([a-z0-9]{30})\\b"},{name:"Planviewleankit - 1",regex:"(?:planviewleankit|planview).{0,40}\\b([0-9a-f]{128})\\b"},{name:"Planviewleankit - 2",regex:"(?:planviewleankit|planview).{0,40}(?:subdomain).\\b([a-zA-Z][a-zA-Z0-9.-]{1,23}[a-zA-Z0-9])\\b"},{name:"Planyo",regex:"(?:planyo).{0,40}\\b([0-9a-z]{62})\\b"},{name:"Plivo - 1",regex:"(?:plivo).{0,40}\\b([A-Za-z0-9_-]{40})\\b"},{name:"Plivo - 2",regex:"(?:plivo).{0,40}\\b([A-Z]{20})\\b"},{name:"Poloniex - 1",regex:"(?:poloniex).{0,40}\\b([0-9a-f]{128})\\b"},{name:"Poloniex - 2",regex:"(?:poloniex).{0,40}\\b([0-9A-Z]{8}-[0-9A-Z]{8}-[0-9A-Z]{8}-[0-9A-Z]{8})\\b"},{name:"Polygon",regex:"(?:polygon).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Positionstack",regex:"(?:positionstack).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Postageapp",regex:"(?:postageapp).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Posthog",regex:"\\b(phc_[a-zA-Z0-9_]{43})\\b"},{name:"Postman",regex:"\\b(PMAK-[a-zA-Z-0-9]{59})\\b"},{name:"Postmark",regex:"(?:postmark).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Powrbot",regex:"(?:powrbot).{0,40}\\b([a-z0-9A-Z]{40})\\b"},{name:"Privatekey",regex:"-----\\s*?BEGIN[ A-Z0-9_-]*?PRIVATE KEY\\s*?-----[\\s\\S]*?----\\s*?END[ A-Z0-9_-]*? PRIVATE KEY\\s*?-----"},{name:"Prospectcrm",regex:"(?:prospect).{0,40}\\b([a-z0-9-]{32})\\b"},{name:"Prospectio",regex:"(?:prospect).{0,40}\\b([a-z0-9A-Z-]{50})\\b"},{name:"Protocolsio",regex:"(?:protocols).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Proxycrawl",regex:"(?:proxycrawl).{0,40}\\b([a-zA-Z0-9_]{22})\\b"},{name:"Pubnubpublishkey - 1",regex:"\\b(sub-c-[0-9a-z]{8}-[a-z]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Pubnubpublishkey - 2",regex:"\\b(pub-c-[0-9a-z]{8}-[0-9a-z]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Purestake",regex:"(?:purestake).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Pushbulletapikey",regex:"(?:pushbullet).{0,40}\\b([A-Za-z0-9_\\.]{34})\\b"},{name:"Pusherchannelkey - 1",regex:"(?:key).{0,40}\\b([a-z0-9]{20})\\b"},{name:"Pusherchannelkey - 2",regex:"(?:pusher).{0,40}\\b([a-z0-9]{20})\\b"},{name:"Pusherchannelkey - 3",regex:"(?:pusher).{0,40}\\b([0-9]{7})\\b"},{name:"PyPI upload token",regex:"pypi-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{50,1000}"},{name:"Qualaroo",regex:"(?:qualaroo).{0,40}\\b([a-z0-9A-Z=]{64})"},{name:"Qubole",regex:"(?:qubole).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Quickmetrics",regex:"(?:quickmetrics).{0,40}\\b([a-zA-Z0-9_-]{22})\\b"},{name:"REDIS_URL",regex:"(REDIS_URL).+"},{name:"RKCS8",regex:"-----BEGIN PRIVATE KEY-----"},{name:"RSA private key",regex:"-----BEGIN RSA PRIVATE KEY-----"},{name:"Rapidapi",regex:"(?:rapidapi).{0,40}\\b([A-Za-z0-9_-]{50})\\b"},{name:"Raven",regex:"(?:raven).{0,40}\\b([A-Z0-9-]{16})\\b"},{name:"Rawg",regex:"(?:rawg).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Razorpay - 1",regex:"\\brzp_\\w{2,6}_\\w{10,20}\\b"},{name:"Readme",regex:"(?:readme).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Reallysimplesystems",regex:"\\b(ey[a-zA-Z0-9-._]{153}.ey[a-zA-Z0-9-._]{916,1000})\\b"},{name:"Rebrandly",regex:"(?:rebrandly).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Refiner",regex:"(?:refiner).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Repairshopr - 1",regex:"(?:repairshopr).{0,40}\\b([a-zA-Z0-9_.!+$#^*]{3,32})\\b"},{name:"Repairshopr - 2",regex:"(?:repairshopr).{0,40}\\b([a-zA-Z0-9-]{51})\\b"},{name:"Restpack",regex:"(?:restpack).{0,40}\\b([a-zA-Z0-9]{48})\\b"},{name:"Restpackhtmltopdfapi",regex:"(?:restpack).{0,40}\\b([0-9A-Za-z]{48})\\b"},{name:"Rev - 1",regex:"(?:rev).{0,40}\\b([0-9a-zA-Z\\/\\+]{27}\\=[ \\r\\n]{1})"},{name:"Rev - 2",regex:"(?:rev).{0,40}\\b([0-9a-zA-Z\\-]{27}[ \\r\\n]{1})"},{name:"Revampcrm - 1",regex:"(?:revamp).{0,40}\\b([a-zA-Z0-9]{40}\\b)"},{name:"Revampcrm - 2",regex:"(?:revamp).{0,40}\\b([a-zA-Z0-9.-@]{25,30})\\b"},{name:"Ringcentral - 1",regex:"(?:ringcentral).{0,40}\\b(https://www.[0-9A-Za-z_-]{1,}.com)\\b"},{name:"Ringcentral - 2",regex:"(?:ringcentral).{0,40}\\b([0-9A-Za-z_-]{22})\\b"},{name:"Ritekit",regex:"(?:ritekit).{0,40}\\b([0-9a-f]{44})\\b"},{name:"Roaring",regex:"(?:roaring).{0,40}\\b([0-9A-Za-z_-]{28})\\b"},{name:"Rocketreach",regex:"(?:rocketreach).{0,40}\\b([a-z0-9-]{39})\\b"},{name:"Roninapp - 1",regex:"(?:ronin).{0,40}\\b([0-9Aa-zA-Z]{3,32})\\b"},{name:"Roninapp - 2",regex:"(?:ronin).{0,40}\\b([0-9a-zA-Z]{26})\\b"},{name:"Route4me",regex:"(?:route4me).{0,40}\\b([0-9A-Z]{32})\\b"},{name:"Rownd - 1",regex:"(?:rownd).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12})\\b"},{name:"Rownd - 2",regex:"(?:rownd).{0,40}\\b([a-z0-9]{48})\\b"},{name:"Rownd - 3",regex:"(?:rownd).{0,40}\\b([0-9]{18})\\b"},{name:"Rubygems",regex:"\\b(rubygems_[a-zA0-9]{48})\\b"},{name:"Runrunit - 1",regex:"(?:runrunit).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Runrunit - 2",regex:"(?:runrunit).{0,40}\\b([0-9A-Za-z]{18,20})\\b"},{name:"SSH",regex:"-----BEGIN OPENSSH PRIVATE KEY-----"},{name:"SSH (DSA) private key",regex:"-----BEGIN DSA PRIVATE KEY-----"},{name:"Salesblink",regex:"(?:salesblink).{0,40}\\b([a-zA-Z]{16})\\b"},{name:"Salescookie",regex:"(?:salescookie).{0,40}\\b([a-zA-z0-9]{32})\\b"},{name:"Salesflare",regex:"(?:salesflare).{0,40}\\b([a-zA-Z0-9_]{45})\\b"},{name:"Satismeterprojectkey - 1",regex:"(?:satismeter).{0,40}\\b([a-zA-Z0-9]{4,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,12})\\b"},{name:"Satismeterprojectkey - 2",regex:"(?:satismeter).{0,40}\\b([a-zA-Z0-9]{24})\\b"},{name:"Satismeterprojectkey - 3",regex:"(?:satismeter).{0,40}\\b([a-zA-Z0-9!=@#$%^]{6,32})"},{name:"Satismeterwritekey",regex:"(?:satismeter).{0,40}\\b([a-z0-9A-Z]{16})\\b"},{name:"Saucelabs - 1",regex:"\\b(oauth\\-[a-z0-9]{8,}\\-[a-z0-9]{5})\\b"},{name:"Saucelabs - 2",regex:"(?:saucelabs).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12})\\b"},{name:"Scalewaykey",regex:"(?:scaleway).{0,40}\\b([0-9a-z]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Scrapeowl",regex:"(?:scrapeowl).{0,40}\\b([0-9a-z]{30})\\b"},{name:"Scraperapi",regex:"(?:scraperapi).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scraperbox",regex:"(?:scraperbox).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Scrapersite",regex:"(?:scrapersite).{0,40}\\b([a-zA-Z0-9]{45})\\b"},{name:"Scrapestack",regex:"(?:scrapestack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scrapfly",regex:"(?:scrapfly).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scrapingant",regex:"(?:scrapingant).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scrapingbee",regex:"(?:scrapingbee).{0,40}\\b([A-Z0-9]{80})\\b"},{name:"Screenshotapi",regex:"(?:screenshotapi).{0,40}\\b([0-9A-Z]{7}\\-[0-9A-Z]{7}\\-[0-9A-Z]{7}\\-[0-9A-Z]{7})\\b"},{name:"Screenshotlayer",regex:"(?:screenshotlayer).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Securitytrails",regex:"(?:securitytrails).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Segmentapikey",regex:"(?:segment).{0,40}\\b([A-Za-z0-9_\\-a-zA-Z]{43}\\.[A-Za-z0-9_\\-a-zA-Z]{43})\\b"},{name:"Selectpdf",regex:"(?:selectpdf).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Semaphore",regex:"(?:semaphore).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Sendbird - 1",regex:"(?:sendbird).{0,40}\\b([0-9a-f]{40})\\b"},{name:"Sendbird - 2",regex:"(?:sendbird).{0,40}\\b([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})\\b"},{name:"Sendbirdorganizationapi",regex:"(?:sendbird).{0,40}\\b([0-9a-f]{24})\\b"},{name:"Sendgrid",regex:"(SG\\.[\\w\\-_]{20,24}\\.[\\w\\-_]{39,50})\\b"},{name:"Sendinbluev2",regex:"\\b(xkeysib\\-[A-Za-z0-9_-]{81})\\b"},{name:"Sentiment - 1",regex:"(?:sentiment).{0,40}\\b([0-9]{17})\\b"},{name:"Sentiment - 2",regex:"(?:sentiment).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Sentrytoken",regex:"(?:sentry).{0,40}\\b([a-f0-9]{64})\\b"},{name:"Serphouse",regex:"(?:serphouse).{0,40}\\b([0-9A-Za-z]{60})\\b"},{name:"Serpstack",regex:"(?:serpstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Sheety - 1",regex:"(?:sheety).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Sheety - 2",regex:"(?:sheety).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Sherpadesk",regex:"(?:sherpadesk).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Shipday",regex:"(?:shipday).{0,40}\\b([a-zA-Z0-9.]{11}[a-zA-Z0-9]{20})\\b"},{name:"Shodankey",regex:"(?:shodan).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Shopify custom app access token",regex:"shpca_[a-fA-F0-9]{32}"},{name:"Shopify private app access token",regex:"shppa_[a-fA-F0-9]{32}"},{name:"Shopify shared secret",regex:"shpss_[a-fA-F0-9]{32}"},{name:"Shoppable Service Auth",regex:"data-shoppable-auth-token.+"},{name:"Shortcut",regex:"(?:shortcut).{0,40}\\b([0-9a-f-]{36})\\b"},{name:"Shotstack",regex:"(?:shotstack).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Shutterstock - 1",regex:"(?:shutterstock).{0,40}\\b([0-9a-zA-Z]{32})\\b"},{name:"Shutterstock - 2",regex:"(?:shutterstock).{0,40}\\b([0-9a-zA-Z]{16})\\b"},{name:"Shutterstockoauth",regex:"(?:shutterstock).{0,40}\\b(v2/[0-9A-Za-z]{388})\\b"},{name:"Signalwire - 1",regex:"\\b([0-9a-z-]{3,64}.signalwire.com)\\b"},{name:"Signalwire - 2",regex:"(?:signalwire).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Signalwire - 3",regex:"(?:signalwire).{0,40}\\b([0-9A-Za-z]{50})\\b"},{name:"Signaturit",regex:"(?:signaturit).{0,40}\\b([0-9A-Za-z]{86})\\b"},{name:"Signupgenius",regex:"(?:signupgenius).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Sigopt",regex:"(?:sigopt).{0,40}\\b([A-Z0-9]{48})\\b"},{name:"Simplesat",regex:"(?:simplesat).{0,40}\\b([a-z0-9]{40})"},{name:"Simplynoted",regex:"(?:simplynoted).{0,40}\\b([a-zA-Z0-9\\S]{340,360})\\b"},{name:"Simvoly",regex:"(?:simvoly).{0,40}\\b([a-z0-9]{33})\\b"},{name:"Sinchmessage",regex:"(?:sinch).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Sirv - 1",regex:"(?:sirv).{0,40}\\b([a-zA-Z0-9\\S]{88})"},{name:"Sirv - 2",regex:"(?:sirv).{0,40}\\b([a-zA-Z0-9]{26})\\b"},{name:"Siteleaf",regex:"(?:siteleaf).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Skrappio",regex:"(?:skrapp).{0,40}\\b([a-z0-9A-Z]{42})\\b"},{name:"Skybiometry",regex:"(?:skybiometry).{0,40}\\b([0-9a-z]{25,26})\\b"},{name:"Slack",regex:"xox[baprs]-[0-9a-zA-Z-]{10,72}"},{name:"Slack Token",regex:"(xox[pborsa]-[0-9]{12}-[0-9]{12}-[0-9]{12}-[a-z0-9]{32})"},{name:"Slack User token",regex:"xoxp-[0-9A-Za-z\\-]{72}"},{name:"Slack Webhook",regex:"https://hooks.slack.com/services/T[a-zA-Z0-9_]{8,10}/B[a-zA-Z0-9_]{8,12}/[a-zA-Z0-9_]{23,24}"},{name:"Slack access token",regex:"xoxb-[0-9A-Za-z\\-]{51}"},{name:"Slackwebhook",regex:"(https:\\/\\/hooks.slack.com\\/services\\/[A-Za-z0-9+\\/]{44,46})"},{name:"Smartsheets",regex:"(?:smartsheets).{0,40}\\b([a-zA-Z0-9]{37})\\b"},{name:"Smartystreets - 1",regex:"(?:smartystreets).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Smartystreets - 2",regex:"(?:smartystreets).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Smooch - 1",regex:"(?:smooch).{0,40}\\b(act_[0-9a-z]{24})\\b"},{name:"Smooch - 2",regex:"(?:smooch).{0,40}\\b([0-9a-zA-Z_-]{86})\\b"},{name:"Snipcart",regex:"(?:snipcart).{0,40}\\b([0-9A-Za-z_]{75})\\b"},{name:"Snykkey",regex:"(?:snyk).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"SonarQube Token",regex:"sonar.{0,50}(?:\"|'|`)?[0-9a-f]{40}(?:\"|'|`)?"},{name:"Splunkobservabilitytoken",regex:"(?:splunk).{0,40}\\b([a-z0-9A-Z]{22})\\b"},{name:"Spoonacular",regex:"(?:spoonacular).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Sportsmonk",regex:"(?:sportsmonk).{0,40}\\b([0-9a-zA-Z]{60})\\b"},{name:"Square",regex:"(?:square).{0,40}(EAAA[a-zA-Z0-9\\-\\+\\=]{60})"},{name:"Square API Key",regex:"sq0(atp|csp)-[0-9a-z-_]{22,43}"},{name:"Squareapp - 1",regex:"[\\w\\-]*sq0i[a-z]{2}-[0-9A-Za-z\\-_]{22,43}"},{name:"Squareapp - 2",regex:"[\\w\\-]*sq0c[a-z]{2}-[0-9A-Za-z\\-_]{40,50}"},{name:"Squarespace",regex:"(?:squarespace).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Squareup",regex:"\\b(sq0idp-[0-9A-Za-z]{22})\\b"},{name:"Sslmate",regex:"(?:sslmate).{0,40}\\b([a-zA-Z0-9]{36})\\b"},{name:"Stitchdata",regex:"(?:stitchdata).{0,40}\\b([0-9a-z_]{35})\\b"},{name:"Stockdata",regex:"(?:stockdata).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Storecove",regex:"(?:storecove).{0,40}\\b([a-zA-Z0-9_-]{43})\\b"},{name:"Stormglass",regex:"(?:stormglass).{0,40}\\b([0-9Aa-z-]{73})\\b"},{name:"Storyblok",regex:"(?:storyblok).{0,40}\\b([0-9A-Za-z]{22}t{2})\\b"},{name:"Storychief",regex:"(?:storychief).{0,40}\\b([a-zA-Z0-9_\\-.]{940,1000})"},{name:"Strava - 1",regex:"(?:strava).{0,40}\\b([0-9]{5})\\b"},{name:"Strava - 2",regex:"(?:strava).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Streak",regex:"(?:streak).{0,40}\\b([0-9Aa-f]{32})\\b"},{name:"Stripe",regex:"[rs]k_live_[a-zA-Z0-9]{20,30}"},{name:"Stripe API Key - 1",regex:"sk_live_[0-9a-zA-Z]{24}"},{name:"Stripe API key - 2",regex:"stripe[sr]k_live_[0-9a-zA-Z]{24}"},{name:"Stripe API key - 3",regex:"stripe[sk|rk]_live_[0-9a-zA-Z]{24}"},{name:"Stripe Public Live Key",regex:"pk_live_[0-9a-z]{24}"},{name:"Stripe Public Test Key",regex:"pk_test_[0-9a-z]{24}"},{name:"Stripe Restriced Key",regex:"rk_(?:live|test)_[0-9a-zA-Z]{24}"},{name:"Stripe Restricted API Key",regex:"rk_live_[0-9a-zA-Z]{24}"},{name:"Stripe Secret Key",regex:"sk_(?:live|test)_[0-9a-zA-Z]{24}"},{name:"Stripe Secret Live Key",regex:"(sk|rk)_live_[0-9a-z]{24}"},{name:"Stripe Secret Test Key",regex:"(sk|rk)_test_[0-9a-z]{24}"},{name:"Stytch - 1",regex:"(?:stytch).{0,40}\\b([a-zA-Z0-9-_]{47}=)"},{name:"Stytch - 2",regex:"(?:stytch).{0,40}\\b([a-z0-9-]{49})\\b"},{name:"Sugester - 1",regex:"(?:sugester).{0,40}\\b([a-zA-Z0-9_.!+$#^*%]{3,32})\\b"},{name:"Sugester - 2",regex:"(?:sugester).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Sumologickey - 1",regex:"(?:sumo).{0,40}\\b([A-Za-z0-9]{14})\\b"},{name:"Sumologickey - 2",regex:"(?:sumo).{0,40}\\b([A-Za-z0-9]{64})\\b"},{name:"Supernotesapi",regex:"(?:supernotes).{0,40}([ \\r\\n]{0,1}[0-9A-Za-z\\-_]{43}[ \\r\\n]{1})"},{name:"Surveyanyplace - 1",regex:"(?:survey).{0,40}\\b([a-z0-9A-Z-]{36})\\b"},{name:"Surveyanyplace - 2",regex:"(?:survey).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Surveybot",regex:"(?:surveybot).{0,40}\\b([A-Za-z0-9-]{80})\\b"},{name:"Surveysparrow",regex:"(?:surveysparrow).{0,40}\\b([a-zA-Z0-9-_]{88})\\b"},{name:"Survicate",regex:"(?:survicate).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Swell - 1",regex:"(?:swell).{0,40}\\b([a-zA-Z0-9]{6,24})\\b"},{name:"Swell - 2",regex:"(?:swell).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Swiftype",regex:"(?:swiftype).{0,40}\\b([a-zA-z-0-9]{6}\\_[a-zA-z-0-9]{6}\\-[a-zA-z-0-9]{6})\\b"},{name:"Tallyfy",regex:"(?:tallyfy).{0,40}\\b([0-9A-Za-z]{36}\\.[0-9A-Za-z]{264}\\.[0-9A-Za-z\\-\\_]{683})\\b"},{name:"Tatumio",regex:"(?:tatum).{0,40}\\b([0-9a-z-]{36})\\b"},{name:"Taxjar",regex:"(?:taxjar).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Teamgate - 1",regex:"(?:teamgate).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Teamgate - 2",regex:"(?:teamgate).{0,40}\\b([a-zA-Z0-9]{80})\\b"},{name:"Teamworkcrm",regex:"(?:teamwork|teamworkcrm).{0,40}\\b(tkn\\.v1_[0-9A-Za-z]{71}=[ \\r\\n]{1})"},{name:"Teamworkdesk",regex:"(?:teamwork|teamworkdesk).{0,40}\\b(tkn\\.v1_[0-9A-Za-z]{71}=[ \\r\\n]{1})"},{name:"Teamworkspaces",regex:"(?:teamwork|teamworkspaces).{0,40}\\b(tkn\\.v1_[0-9A-Za-z]{71}=[ \\r\\n]{1})"},{name:"Technicalanalysisapi",regex:"(?:technicalanalysisapi).{0,40}\\b([A-Z0-9]{48})\\b"},{name:"Telegram Bot API Key",regex:"[0-9]+:AA[0-9A-Za-z\\-_]{33}"},{name:"Telegram Secret",regex:"d{5,}:A[0-9a-z_-]{34,34}"},{name:"Telegrambottoken",regex:"(?:telegram).{0,40}\\b([0-9]{8,10}:[a-zA-Z0-9_-]{35})\\b"},{name:"Telnyx",regex:"(?:telnyx).{0,40}\\b(KEY[0-9A-Za-z_-]{55})\\b"},{name:"Terraformcloudpersonaltoken",regex:"\\b([A-Za-z0-9]{14}.atlasv1.[A-Za-z0-9]{67})\\b"},{name:"Text2data",regex:"(?:text2data).{0,40}\\b([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})\\b"},{name:"Textmagic - 1",regex:"(?:textmagic).{0,40}\\b([0-9A-Za-z]{30})\\b"},{name:"Textmagic - 2",regex:"(?:textmagic).{0,40}\\b([0-9A-Za-z]{1,25})\\b"},{name:"Theoddsapi",regex:"(?:theoddsapi|the-odds-api).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Thinkific - 1",regex:"(?:thinkific).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Thinkific - 2",regex:"(?:thinkific).{0,40}\\b([0-9A-Za-z]{4,40})\\b"},{name:"Thousandeyes - 1",regex:"(?:thousandeyes).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Thousandeyes - 2",regex:"(?:thousandeyes).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Ticketmaster",regex:"(?:ticketmaster).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Tiingo",regex:"(?:tiingo).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Timezoneapi",regex:"(?:timezoneapi).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Tly",regex:"(?:tly).{0,40}\\b([0-9A-Za-z]{60})\\b"},{name:"Tmetric",regex:"(?:tmetric).{0,40}\\b([0-9A-Z]{64})\\b"},{name:"Todoist",regex:"(?:todoist).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Toggltrack",regex:"(?:toggl).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Tomorrowio",regex:"(?:tomorrow).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Tomtom",regex:"(?:tomtom).{0,40}\\b([0-9Aa-zA-Z]{32})\\b"},{name:"Tradier",regex:"(?:tradier).{0,40}\\b([a-zA-Z0-9]{28})\\b"},{name:"Travelpayouts",regex:"(?:travelpayouts).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Travisci",regex:"(?:travis).{0,40}\\b([a-zA-Z0-9A-Z_]{22})\\b"},{name:"Trello URL",regex:"https://trello.com/b/[0-9a-z]/[0-9a-z_-]+"},{name:"Trelloapikey - 2",regex:"(?:trello).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Twelvedata",regex:"(?:twelvedata).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Twilio - 1",regex:"\\bAC[0-9a-f]{32}\\b"},{name:"Twilio API Key",regex:"SK[0-9a-fA-F]{32}"},{name:"Twitter Access Token",regex:"[tT][wW][iI][tT][tT][eE][rR].*[1-9][0-9]+-[0-9a-zA-Z]{40}"},{name:"Twitter Client ID",regex:"twitter[0-9a-z]{18,25}"},{name:"Twitter OAuth",regex:`[tT][wW][iI][tT][tT][eE][rR].*['|"][0-9a-zA-Z]{35,44}['|"]`},{name:"Twitter Secret Key",regex:"twitter[0-9a-z]{35,44}"},{name:"Tyntec",regex:"(?:tyntec).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Typeform",regex:"(?:typeform).{0,40}\\b([0-9A-Za-z]{44})\\b"},{name:"Ubidots",regex:"\\b(BBFF-[0-9a-zA-Z]{30})\\b"},{name:"Unifyid",regex:"(?:unify).{0,40}\\b([0-9A-Za-z_=-]{44})"},{name:"Unplugg",regex:"(?:unplu).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Unsplash",regex:"(?:unsplash).{0,40}\\b([0-9A-Za-z_]{43})\\b"},{name:"Upcdatabase",regex:"(?:upcdatabase).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Uplead",regex:"(?:uplead).{0,40}\\b([a-z0-9-]{32})\\b"},{name:"Uploadcare",regex:"(?:uploadcare).{0,40}\\b([a-z0-9]{20})\\b"},{name:"Upwave",regex:"(?:upwave).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Uri",regex:"\\b[a-zA-Z]{1,10}:?\\/\\/[-.%\\w{}]{1,50}:([-.%\\S]{3,50})@[-.%\\w\\/:]+\\b"},{name:"Urlscan",regex:"(?:urlscan).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Userstack",regex:"(?:userstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Vatlayer",regex:"(?:vatlayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Vercel",regex:"(?:vercel).{0,40}\\b([a-zA-Z0-9]{24})\\b"},{name:"Verifier - 1",regex:"(?:verifier).{0,40}\\b([a-zA-Z-0-9-]{5,16}\\@[a-zA-Z-0-9]{4,16}\\.[a-zA-Z-0-9]{3,6})\\b"},{name:"Verifier - 2",regex:"(?:verifier).{0,40}\\b([a-z0-9]{96})\\b"},{name:"Verimail",regex:"(?:verimail).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Veriphone",regex:"(?:veriphone).{0,40}\\b([0-9A-Z]{32})\\b"},{name:"Versioneye",regex:"(?:versioneye).{0,40}\\b([a-zA-Z0-9-]{40})\\b"},{name:"Viewneo",regex:"(?:viewneo).{0,40}\\b([a-z0-9A-Z]{120,300}.[a-z0-9A-Z]{150,300}.[a-z0-9A-Z-_]{600,800})"},{name:"Virustotal",regex:"(?:virustotal).{0,40}\\b([a-f0-9]{64})\\b"},{name:"Visualcrossing",regex:"(?:visualcrossing).{0,40}\\b([0-9A-Z]{25})\\b"},{name:"Voicegain",regex:"(?:voicegain).{0,40}\\b(ey[0-9a-zA-Z_-]{34}.ey[0-9a-zA-Z_-]{108}.[0-9a-zA-Z_-]{43})\\b"},{name:"Vouchery - 1",regex:"(?:vouchery).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Vouchery - 2",regex:"(?:vouchery).{0,40}\\b([a-zA-Z0-9-\\S]{2,20})\\b"},{name:"Vpnapi",regex:"(?:vpnapi).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Vultrapikey",regex:"(?:vultr).{0,40} \\b([A-Z0-9]{36})\\b"},{name:"Vyte",regex:"(?:vyte).{0,40}\\b([0-9a-z]{50})\\b"},{name:"Walkscore",regex:"(?:walkscore).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Weatherbit",regex:"(?:weatherbit).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Weatherstack",regex:"(?:weatherstack).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Webex - 1",regex:"(?:error).{0,40}(redirect_uri_mismatch)"},{name:"Webex - 2",regex:"(?:webex).{0,40}\\b([A-Za-z0-9_-]{65})\\b"},{name:"Webex - 3",regex:"(?:webex).{0,40}\\b([A-Za-z0-9_-]{64})\\b"},{name:"Webflow",regex:"(?:webflow).{0,40}\\b([a-zA0-9]{64})\\b"},{name:"Webscraper",regex:"(?:webscraper).{0,40}\\b([a-zA-Z0-9]{60})\\b"},{name:"Webscraping",regex:"(?:webscraping).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Wepay - 2",regex:"(?:wepay).{0,40}\\b([a-zA-Z0-9_?]{62})\\b"},{name:"Whoxy",regex:"(?:whoxy).{0,40}\\b([0-9a-z]{33})\\b"},{name:"Worksnaps",regex:"(?:worksnaps).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Workstack",regex:"(?:workstack).{0,40}\\b([0-9Aa-zA-Z]{60})\\b"},{name:"Worldcoinindex",regex:"(?:worldcoinindex).{0,40}\\b([a-zA-Z0-9]{35})\\b"},{name:"Worldweather",regex:"(?:worldweather).{0,40}\\b([0-9a-z]{31})\\b"},{name:"Wrike",regex:"(?:wrike).{0,40}\\b(ey[a-zA-Z0-9-._]{333})\\b"},{name:"Yandex",regex:"(?:yandex).{0,40}\\b([a-z0-9A-Z.]{83})\\b"},{name:"Youneedabudget",regex:"(?:youneedabudget).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Yousign",regex:"(?:yousign).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Youtubeapikey - 1",regex:"(?:youtube).{0,40}\\b([a-zA-Z-0-9_]{39})\\b"},{name:"Zapier Webhook",regex:"https://(?:www.)?hooks\\.zapier\\.com/hooks/catch/[A-Za-z0-9]+/[A-Za-z0-9]+/"},{name:"Zapierwebhook",regex:"(https:\\/\\/hooks.zapier.com\\/hooks\\/catch\\/[A-Za-z0-9\\/]{16})"},{name:"Zendeskapi - 3",regex:"(?:zendesk).{0,40}([A-Za-z0-9_-]{40})"},{name:"Zenkitapi",regex:"(?:zenkit).{0,40}\\b([0-9a-z]{8}\\-[0-9A-Za-z]{32})\\b"},{name:"Zenscrape",regex:"(?:zenscrape).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Zenserp",regex:"(?:zenserp).{0,40}\\b([0-9a-z-]{36})\\b"},{name:"Zeplin",regex:"(?:zeplin).{0,40}\\b([a-zA-Z0-9-.]{350,400})\\b"},{name:"Zerobounce",regex:"(?:zerobounce).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Zipapi - 1",regex:"(?:zipapi).{0,40}\\b([a-zA-Z0-9!=@#$%^]{7,})"},{name:"Zipapi - 3",regex:"(?:zipapi).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Zipcodeapi",regex:"(?:zipcodeapi).{0,40}\\b([a-zA-Z0-9]{64})\\b"},{name:"Zoho Webhook",regex:"https://creator\\.zoho\\.com/api/[A-Za-z0-9/\\-_\\.]+\\?authtoken=[A-Za-z0-9]+"},{name:"Zonkafeedback",regex:"(?:zonka).{0,40}\\b([A-Za-z0-9]{36})\\b"},{name:"access_key_secret",regex:"access[_-]?key[_-]?secret(=| =|:| :)"},{name:"access_secret",regex:"access[_-]?secret(=| =|:| :)"},{name:"access_token",regex:"access[_-]?token(=| =|:| :)"},{name:"account_sid",regex:"account[_-]?sid(=| =|:| :)"},{name:"admin_email",regex:"admin[_-]?email(=| =|:| :)"},{name:"adzerk_api_key",regex:"adzerk[_-]?api[_-]?key(=| =|:| :)"},{name:"algolia_admin_key_1",regex:"algolia[_-]?admin[_-]?key[_-]?1(=| =|:| :)"},{name:"algolia_admin_key_2",regex:"algolia[_-]?admin[_-]?key[_-]?2(=| =|:| :)"},{name:"algolia_admin_key_mcm",regex:"algolia[_-]?admin[_-]?key[_-]?mcm(=| =|:| :)"},{name:"algolia_api_key",regex:"algolia[_-]?api[_-]?key(=| =|:| :)"},{name:"algolia_api_key_mcm",regex:"algolia[_-]?api[_-]?key[_-]?mcm(=| =|:| :)"},{name:"algolia_api_key_search",regex:"algolia[_-]?api[_-]?key[_-]?search(=| =|:| :)"},{name:"algolia_search_api_key",regex:"algolia[_-]?search[_-]?api[_-]?key(=| =|:| :)"},{name:"algolia_search_key",regex:"algolia[_-]?search[_-]?key(=| =|:| :)"},{name:"algolia_search_key_1",regex:"algolia[_-]?search[_-]?key[_-]?1(=| =|:| :)"},{name:"alias_pass",regex:"alias[_-]?pass(=| =|:| :)"},{name:"alicloud_access_key",regex:"alicloud[_-]?access[_-]?key(=| =|:| :)"},{name:"alicloud_secret_key",regex:"alicloud[_-]?secret[_-]?key(=| =|:| :)"},{name:"amazon_bucket_name",regex:"amazon[_-]?bucket[_-]?name(=| =|:| :)"},{name:"amazon_secret_access_key",regex:"amazon[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"anaconda_token",regex:"anaconda[_-]?token(=| =|:| :)"},{name:"android_docs_deploy_token",regex:"android[_-]?docs[_-]?deploy[_-]?token(=| =|:| :)"},{name:"ansible_vault_password",regex:"ansible[_-]?vault[_-]?password(=| =|:| :)"},{name:"aos_key",regex:"aos[_-]?key(=| =|:| :)"},{name:"aos_sec",regex:"aos[_-]?sec(=| =|:| :)"},{name:"api_key",regex:"api[_-]?key(=| =|:| :)"},{name:"api_key_secret",regex:"api[_-]?key[_-]?secret(=| =|:| :)"},{name:"api_key_sid",regex:"api[_-]?key[_-]?sid(=| =|:| :)"},{name:"api_secret",regex:"api[_-]?secret(=| =|:| :)"},{name:"apiary_api_key",regex:"apiary[_-]?api[_-]?key(=| =|:| :)"},{name:"apigw_access_token",regex:"apigw[_-]?access[_-]?token(=| =|:| :)"},{name:"apikey_patterns",regex:`apikey[:](?:['"]?[a-zA-Z0-9-_|]+['"]?)`},{name:"app_bucket_perm",regex:"app[_-]?bucket[_-]?perm(=| =|:| :)"},{name:"app_report_token_key",regex:"app[_-]?report[_-]?token[_-]?key(=| =|:| :)"},{name:"app_secrete",regex:"app[_-]?secrete(=| =|:| :)"},{name:"app_token",regex:"app[_-]?token(=| =|:| :)"},{name:"appclientsecret",regex:"appclientsecret(=| =|:| :)"},{name:"apple_id_password",regex:"apple[_-]?id[_-]?password(=| =|:| :)"},{name:"argos_token",regex:"argos[_-]?token(=| =|:| :)"},{name:"artifactory",regex:`(artifactory.{0,50}("|')?[a-zA-Z0-9=]{112}("|')?)`},{name:"artifactory_key",regex:"artifactory[_-]?key(=| =|:| :)"},{name:"artifacts_aws_access_key_id",regex:"artifacts[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"artifacts_aws_secret_access_key",regex:"artifacts[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"artifacts_bucket",regex:"artifacts[_-]?bucket(=| =|:| :)"},{name:"artifacts_key",regex:"artifacts[_-]?key(=| =|:| :)"},{name:"artifacts_secret",regex:"artifacts[_-]?secret(=| =|:| :)"},{name:"assistant_iam_apikey",regex:"assistant[_-]?iam[_-]?apikey(=| =|:| :)"},{name:"auth0_api_clientsecret",regex:"auth0[_-]?api[_-]?clientsecret(=| =|:| :)"},{name:"auth0_client_secret",regex:"auth0[_-]?client[_-]?secret(=| =|:| :)"},{name:"auth_token",regex:"auth[_-]?token(=| =|:| :)"},{name:"author_email_addr",regex:"author[_-]?email[_-]?addr(=| =|:| :)"},{name:"author_npm_api_key",regex:"author[_-]?npm[_-]?api[_-]?key(=| =|:| :)"},{name:"aws_access",regex:"aws[_-]?access(=| =|:| :)"},{name:"aws_access_key",regex:"aws[_-]?access[_-]?key(=| =|:| :)"},{name:"aws_access_key_id - 1",regex:"aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"aws_config_accesskeyid",regex:"aws[_-]?config[_-]?accesskeyid(=| =|:| :)"},{name:"aws_config_secretaccesskey",regex:"aws[_-]?config[_-]?secretaccesskey(=| =|:| :)"},{name:"aws_key",regex:"aws[_-]?key(=| =|:| :)"},{name:"aws_patterns",regex:"(?:accesskeyid|secretaccesskey|aws_access_key_id|aws_secret_access_key)"},{name:"aws_secret",regex:"aws[_-]?secret(=| =|:| :)"},{name:"aws_secret_access_key",regex:"aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"aws_secret_key",regex:"aws[_-]?secret[_-]?key(=| =|:| :)"},{name:"aws_secrets",regex:"aws[_-]?secrets(=| =|:| :)"},{name:"aws_ses_access_key_id",regex:"aws[_-]?ses[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"aws_ses_secret_access_key",regex:"aws[_-]?ses[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"awsaccesskeyid",regex:"awsaccesskeyid(=| =|:| :)"},{name:"awscn_access_key_id",regex:"awscn[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"awscn_secret_access_key",regex:"awscn[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"awssecretkey",regex:"awssecretkey(=| =|:| :)"},{name:"b2_app_key",regex:"b2[_-]?app[_-]?key(=| =|:| :)"},{name:"b2_bucket",regex:"b2[_-]?bucket(=| =|:| :)"},{name:"bintray_api_key",regex:"bintray[_-]?api[_-]?key(=| =|:| :)"},{name:"bintray_apikey",regex:"bintray[_-]?apikey(=| =|:| :)"},{name:"bintray_gpg_password",regex:"bintray[_-]?gpg[_-]?password(=| =|:| :)"},{name:"bintray_key",regex:"bintray[_-]?key(=| =|:| :)"},{name:"bintray_token",regex:"bintray[_-]?token(=| =|:| :)"},{name:"bintraykey",regex:"bintraykey(=| =|:| :)"},{name:"bluemix_api_key",regex:"bluemix[_-]?api[_-]?key(=| =|:| :)"},{name:"bluemix_auth",regex:"bluemix[_-]?auth(=| =|:| :)"},{name:"bluemix_pass",regex:"bluemix[_-]?pass(=| =|:| :)"},{name:"bluemix_pass_prod",regex:"bluemix[_-]?pass[_-]?prod(=| =|:| :)"},{name:"bluemix_password",regex:"bluemix[_-]?password(=| =|:| :)"},{name:"bluemix_pwd",regex:"bluemix[_-]?pwd(=| =|:| :)"},{name:"bluemix_username",regex:"bluemix[_-]?username(=| =|:| :)"},{name:"brackets_repo_oauth_token",regex:"brackets[_-]?repo[_-]?oauth[_-]?token(=| =|:| :)"},{name:"browser_stack_access_key",regex:"browser[_-]?stack[_-]?access[_-]?key(=| =|:| :)"},{name:"browserstack_access_key",regex:"browserstack[_-]?access[_-]?key(=| =|:| :)"},{name:"bucketeer_aws_access_key_id",regex:"bucketeer[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"bucketeer_aws_secret_access_key",regex:"bucketeer[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"built_branch_deploy_key",regex:"built[_-]?branch[_-]?deploy[_-]?key(=| =|:| :)"},{name:"bundlesize_github_token",regex:"bundlesize[_-]?github[_-]?token(=| =|:| :)"},{name:"bx_password",regex:"bx[_-]?password(=| =|:| :)"},{name:"bx_username",regex:"bx[_-]?username(=| =|:| :)"},{name:"cache_s3_secret_key",regex:"cache[_-]?s3[_-]?secret[_-]?key(=| =|:| :)"},{name:"cargo_token",regex:"cargo[_-]?token(=| =|:| :)"},{name:"cattle_access_key",regex:"cattle[_-]?access[_-]?key(=| =|:| :)"},{name:"cattle_agent_instance_auth",regex:"cattle[_-]?agent[_-]?instance[_-]?auth(=| =|:| :)"},{name:"cattle_secret_key",regex:"cattle[_-]?secret[_-]?key(=| =|:| :)"},{name:"censys_secret",regex:"censys[_-]?secret(=| =|:| :)"},{name:"certificate_password",regex:"certificate[_-]?password(=| =|:| :)"},{name:"cf_password",regex:"cf[_-]?password(=| =|:| :)"},{name:"cheverny_token",regex:"cheverny[_-]?token(=| =|:| :)"},{name:"chrome_client_secret",regex:"chrome[_-]?client[_-]?secret(=| =|:| :)"},{name:"chrome_refresh_token",regex:"chrome[_-]?refresh[_-]?token(=| =|:| :)"},{name:"ci_deploy_password",regex:"ci[_-]?deploy[_-]?password(=| =|:| :)"},{name:"ci_project_url",regex:"ci[_-]?project[_-]?url(=| =|:| :)"},{name:"ci_registry_user",regex:"ci[_-]?registry[_-]?user(=| =|:| :)"},{name:"ci_server_name",regex:"ci[_-]?server[_-]?name(=| =|:| :)"},{name:"ci_user_token",regex:"ci[_-]?user[_-]?token(=| =|:| :)"},{name:"claimr_database",regex:"claimr[_-]?database(=| =|:| :)"},{name:"claimr_db",regex:"claimr[_-]?db(=| =|:| :)"},{name:"claimr_superuser",regex:"claimr[_-]?superuser(=| =|:| :)"},{name:"claimr_token",regex:"claimr[_-]?token(=| =|:| :)"},{name:"cli_e2e_cma_token",regex:"cli[_-]?e2e[_-]?cma[_-]?token(=| =|:| :)"},{name:"client_secret",regex:"client[_-]?secret(=| =|:| :)"},{name:"clojars_password",regex:"clojars[_-]?password(=| =|:| :)"},{name:"cloud_api_key",regex:"cloud[_-]?api[_-]?key(=| =|:| :)"},{name:"cloudant_archived_database",regex:"cloudant[_-]?archived[_-]?database(=| =|:| :)"},{name:"cloudant_audited_database",regex:"cloudant[_-]?audited[_-]?database(=| =|:| :)"},{name:"cloudant_database",regex:"cloudant[_-]?database(=| =|:| :)"},{name:"cloudant_instance",regex:"cloudant[_-]?instance(=| =|:| :)"},{name:"cloudant_order_database",regex:"cloudant[_-]?order[_-]?database(=| =|:| :)"},{name:"cloudant_parsed_database",regex:"cloudant[_-]?parsed[_-]?database(=| =|:| :)"},{name:"cloudant_password",regex:"cloudant[_-]?password(=| =|:| :)"},{name:"cloudant_processed_database",regex:"cloudant[_-]?processed[_-]?database(=| =|:| :)"},{name:"cloudant_service_database",regex:"cloudant[_-]?service[_-]?database(=| =|:| :)"},{name:"cloudflare_api_key",regex:"cloudflare[_-]?api[_-]?key(=| =|:| :)"},{name:"cloudflare_auth_email",regex:"cloudflare[_-]?auth[_-]?email(=| =|:| :)"},{name:"cloudflare_auth_key",regex:"cloudflare[_-]?auth[_-]?key(=| =|:| :)"},{name:"cloudflare_email",regex:"cloudflare[_-]?email(=| =|:| :)"},{name:"cloudinary_url",regex:"cloudinary[_-]?url(=| =|:| :)"},{name:"cloudinary_url_staging",regex:"cloudinary[_-]?url[_-]?staging(=| =|:| :)"},{name:"clu_repo_url",regex:"clu[_-]?repo[_-]?url(=| =|:| :)"},{name:"clu_ssh_private_key_base64",regex:"clu[_-]?ssh[_-]?private[_-]?key[_-]?base64(=| =|:| :)"},{name:"cn_access_key_id",regex:"cn[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"cn_secret_access_key",regex:"cn[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"cocoapods_trunk_email",regex:"cocoapods[_-]?trunk[_-]?email(=| =|:| :)"},{name:"cocoapods_trunk_token",regex:"cocoapods[_-]?trunk[_-]?token(=| =|:| :)"},{name:"codacy_project_token",regex:"codacy[_-]?project[_-]?token(=| =|:| :)"},{name:"codeclimate",regex:`(codeclima.{0,50}("|')?[0-9a-f]{64}("|')?)`},{name:"codeclimate_repo_token",regex:"codeclimate[_-]?repo[_-]?token(=| =|:| :)"},{name:"codecov_token",regex:"codecov[_-]?token(=| =|:| :)"},{name:"coding_token",regex:"coding[_-]?token(=| =|:| :)"},{name:"conekta_apikey",regex:"conekta[_-]?apikey(=| =|:| :)"},{name:"consumer_key",regex:"consumer[_-]?key(=| =|:| :)"},{name:"consumerkey",regex:"consumerkey(=| =|:| :)"},{name:"contentful_access_token",regex:"contentful[_-]?access[_-]?token(=| =|:| :)"},{name:"contentful_cma_test_token",regex:"contentful[_-]?cma[_-]?test[_-]?token(=| =|:| :)"},{name:"contentful_integration_management_token",regex:"contentful[_-]?integration[_-]?management[_-]?token(=| =|:| :)"},{name:"contentful_php_management_test_token",regex:"contentful[_-]?php[_-]?management[_-]?test[_-]?token(=| =|:| :)"},{name:"contentful_test_org_cma_token",regex:"contentful[_-]?test[_-]?org[_-]?cma[_-]?token(=| =|:| :)"},{name:"contentful_v2_access_token",regex:"contentful[_-]?v2[_-]?access[_-]?token(=| =|:| :)"},{name:"conversation_password",regex:"conversation[_-]?password(=| =|:| :)"},{name:"conversation_username",regex:"conversation[_-]?username(=| =|:| :)"},{name:"cos_secrets",regex:"cos[_-]?secrets(=| =|:| :)"},{name:"coveralls_api_token",regex:"coveralls[_-]?api[_-]?token(=| =|:| :)"},{name:"coveralls_repo_token",regex:"coveralls[_-]?repo[_-]?token(=| =|:| :)"},{name:"coveralls_token",regex:"coveralls[_-]?token(=| =|:| :)"},{name:"coverity_scan_token",regex:"coverity[_-]?scan[_-]?token(=| =|:| :)"},{name:"cypress_record_key",regex:"cypress[_-]?record[_-]?key(=| =|:| :)"},{name:"danger_github_api_token",regex:"danger[_-]?github[_-]?api[_-]?token(=| =|:| :)"},{name:"database_host",regex:"database[_-]?host(=| =|:| :)"},{name:"database_name",regex:"database[_-]?name(=| =|:| :)"},{name:"database_password",regex:"database[_-]?password(=| =|:| :)"},{name:"database_port",regex:"database[_-]?port(=| =|:| :)"},{name:"database_user",regex:"database[_-]?user(=| =|:| :)"},{name:"database_username",regex:"database[_-]?username(=| =|:| :)"},{name:"datadog_api_key",regex:"datadog[_-]?api[_-]?key(=| =|:| :)"},{name:"datadog_app_key",regex:"datadog[_-]?app[_-]?key(=| =|:| :)"},{name:"db_connection",regex:"db[_-]?connection(=| =|:| :)"},{name:"db_database",regex:"db[_-]?database(=| =|:| :)"},{name:"db_host",regex:"db[_-]?host(=| =|:| :)"},{name:"db_password",regex:"db[_-]?password(=| =|:| :)"},{name:"db_pw",regex:"db[_-]?pw(=| =|:| :)"},{name:"db_user",regex:"db[_-]?user(=| =|:| :)"},{name:"db_username",regex:"db[_-]?username(=| =|:| :)"},{name:"ddg_test_email",regex:"ddg[_-]?test[_-]?email(=| =|:| :)"},{name:"ddg_test_email_pw",regex:"ddg[_-]?test[_-]?email[_-]?pw(=| =|:| :)"},{name:"ddgc_github_token",regex:"ddgc[_-]?github[_-]?token(=| =|:| :)"},{name:"deploy_password",regex:"deploy[_-]?password(=| =|:| :)"},{name:"deploy_secure",regex:"deploy[_-]?secure(=| =|:| :)"},{name:"deploy_token",regex:"deploy[_-]?token(=| =|:| :)"},{name:"deploy_user",regex:"deploy[_-]?user(=| =|:| :)"},{name:"dgpg_passphrase",regex:"dgpg[_-]?passphrase(=| =|:| :)"},{name:"digitalocean_access_token",regex:"digitalocean[_-]?access[_-]?token(=| =|:| :)"},{name:"digitalocean_ssh_key_body",regex:"digitalocean[_-]?ssh[_-]?key[_-]?body(=| =|:| :)"},{name:"digitalocean_ssh_key_ids",regex:"digitalocean[_-]?ssh[_-]?key[_-]?ids(=| =|:| :)"},{name:"docker_hub_password",regex:"docker[_-]?hub[_-]?password(=| =|:| :)"},{name:"docker_key",regex:"docker[_-]?key(=| =|:| :)"},{name:"docker_pass",regex:"docker[_-]?pass(=| =|:| :)"},{name:"docker_passwd",regex:"docker[_-]?passwd(=| =|:| :)"},{name:"docker_password",regex:"docker[_-]?password(=| =|:| :)"},{name:"docker_postgres_url",regex:"docker[_-]?postgres[_-]?url(=| =|:| :)"},{name:"docker_token",regex:"docker[_-]?token(=| =|:| :)"},{name:"dockerhub_password",regex:"dockerhub[_-]?password(=| =|:| :)"},{name:"dockerhubpassword",regex:"dockerhubpassword(=| =|:| :)"},{name:"doordash_auth_token",regex:"doordash[_-]?auth[_-]?token(=| =|:| :)"},{name:"dropbox_oauth_bearer",regex:"dropbox[_-]?oauth[_-]?bearer(=| =|:| :)"},{name:"droplet_travis_password",regex:"droplet[_-]?travis[_-]?password(=| =|:| :)"},{name:"dsonar_login",regex:"dsonar[_-]?login(=| =|:| :)"},{name:"dsonar_projectkey",regex:"dsonar[_-]?projectkey(=| =|:| :)"},{name:"elastic_cloud_auth",regex:"elastic[_-]?cloud[_-]?auth(=| =|:| :)"},{name:"elasticsearch_password",regex:"elasticsearch[_-]?password(=| =|:| :)"},{name:"encryption_password",regex:"encryption[_-]?password(=| =|:| :)"},{name:"end_user_password",regex:"end[_-]?user[_-]?password(=| =|:| :)"},{name:"env_github_oauth_token",regex:"env[_-]?github[_-]?oauth[_-]?token(=| =|:| :)"},{name:"env_heroku_api_key",regex:"env[_-]?heroku[_-]?api[_-]?key(=| =|:| :)"},{name:"env_key",regex:"env[_-]?key(=| =|:| :)"},{name:"env_secret",regex:"env[_-]?secret(=| =|:| :)"},{name:"env_secret_access_key",regex:"env[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"env_sonatype_password",regex:"env[_-]?sonatype[_-]?password(=| =|:| :)"},{name:"eureka_awssecretkey",regex:"eureka[_-]?awssecretkey(=| =|:| :)"},{name:"exp_password",regex:"exp[_-]?password(=| =|:| :)"},{name:"facebook_access_token",regex:"(EAACEdEose0cBA[0-9A-Za-z]+)"},{name:"facebook_oauth",regex:`[f|F][a|A][c|C][e|E][b|B][o|O][o|O][k|K].*['|"][0-9a-f]{32}['|"]`},{name:"file_password",regex:"file[_-]?password(=| =|:| :)"},{name:"firebase_api_json",regex:"firebase[_-]?api[_-]?json(=| =|:| :)"},{name:"firebase_api_token",regex:"firebase[_-]?api[_-]?token(=| =|:| :)"},{name:"firebase_key",regex:"firebase[_-]?key(=| =|:| :)"},{name:"firebase_project_develop",regex:"firebase[_-]?project[_-]?develop(=| =|:| :)"},{name:"firebase_token",regex:"firebase[_-]?token(=| =|:| :)"},{name:"firefox_secret",regex:"firefox[_-]?secret(=| =|:| :)"},{name:"flask_secret_key",regex:"flask[_-]?secret[_-]?key(=| =|:| :)"},{name:"flickr_api_key",regex:"flickr[_-]?api[_-]?key(=| =|:| :)"},{name:"flickr_api_secret",regex:"flickr[_-]?api[_-]?secret(=| =|:| :)"},{name:"fossa_api_key",regex:"fossa[_-]?api[_-]?key(=| =|:| :)"},{name:"ftp_host",regex:"ftp[_-]?host(=| =|:| :)"},{name:"ftp_login",regex:"ftp[_-]?login(=| =|:| :)"},{name:"ftp_password",regex:"ftp[_-]?password(=| =|:| :)"},{name:"ftp_pw",regex:"ftp[_-]?pw(=| =|:| :)"},{name:"ftp_user",regex:"ftp[_-]?user(=| =|:| :)"},{name:"ftp_username",regex:"ftp[_-]?username(=| =|:| :)"},{name:"gcloud_bucket",regex:"gcloud[_-]?bucket(=| =|:| :)"},{name:"gcloud_project",regex:"gcloud[_-]?project(=| =|:| :)"},{name:"gcloud_service_key",regex:"gcloud[_-]?service[_-]?key(=| =|:| :)"},{name:"gcr_password",regex:"gcr[_-]?password(=| =|:| :)"},{name:"gcs_bucket",regex:"gcs[_-]?bucket(=| =|:| :)"},{name:"gh_api_key",regex:"gh[_-]?api[_-]?key(=| =|:| :)"},{name:"gh_email",regex:"gh[_-]?email(=| =|:| :)"},{name:"gh_next_oauth_client_secret",regex:"gh[_-]?next[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"gh_next_unstable_oauth_client_id",regex:"gh[_-]?next[_-]?unstable[_-]?oauth[_-]?client[_-]?id(=| =|:| :)"},{name:"gh_next_unstable_oauth_client_secret",regex:"gh[_-]?next[_-]?unstable[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"gh_oauth_client_secret",regex:"gh[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"gh_oauth_token",regex:"gh[_-]?oauth[_-]?token(=| =|:| :)"},{name:"gh_repo_token",regex:"gh[_-]?repo[_-]?token(=| =|:| :)"},{name:"gh_token",regex:"gh[_-]?token(=| =|:| :)"},{name:"gh_unstable_oauth_client_secret",regex:"gh[_-]?unstable[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"ghb_token",regex:"ghb[_-]?token(=| =|:| :)"},{name:"ghost_api_key",regex:"ghost[_-]?api[_-]?key(=| =|:| :)"},{name:"git_author_email",regex:"git[_-]?author[_-]?email(=| =|:| :)"},{name:"git_author_name",regex:"git[_-]?author[_-]?name(=| =|:| :)"},{name:"git_committer_email",regex:"git[_-]?committer[_-]?email(=| =|:| :)"},{name:"git_committer_name",regex:"git[_-]?committer[_-]?name(=| =|:| :)"},{name:"git_email",regex:"git[_-]?email(=| =|:| :)"},{name:"git_name",regex:"git[_-]?name(=| =|:| :)"},{name:"git_token",regex:"git[_-]?token(=| =|:| :)"},{name:"github_access_token - 1",regex:"github[_-]?access[_-]?token(=| =|:| :)"},{name:"github_access_token - 2",regex:"[a-zA-Z0-9_-]*:[a-zA-Z0-9_-]+@github.com*"},{name:"github_api_key",regex:"github[_-]?api[_-]?key(=| =|:| :)"},{name:"github_api_token",regex:"github[_-]?api[_-]?token(=| =|:| :)"},{name:"github_auth",regex:"github[_-]?auth(=| =|:| :)"},{name:"github_auth_token",regex:"github[_-]?auth[_-]?token(=| =|:| :)"},{name:"github_client_secret",regex:"github[_-]?client[_-]?secret(=| =|:| :)"},{name:"github_deploy_hb_doc_pass",regex:"github[_-]?deploy[_-]?hb[_-]?doc[_-]?pass(=| =|:| :)"},{name:"github_deployment_token",regex:"github[_-]?deployment[_-]?token(=| =|:| :)"},{name:"github_hunter_token",regex:"github[_-]?hunter[_-]?token(=| =|:| :)"},{name:"github_hunter_username",regex:"github[_-]?hunter[_-]?username(=| =|:| :)"},{name:"github_key",regex:"github[_-]?key(=| =|:| :)"},{name:"github_oauth",regex:"github[_-]?oauth(=| =|:| :)"},{name:"github_oauth_token",regex:"github[_-]?oauth[_-]?token(=| =|:| :)"},{name:"github_password",regex:"github[_-]?password(=| =|:| :)"},{name:"github_pwd",regex:"github[_-]?pwd(=| =|:| :)"},{name:"github_release_token",regex:"github[_-]?release[_-]?token(=| =|:| :)"},{name:"github_repo",regex:"github[_-]?repo(=| =|:| :)"},{name:"github_token",regex:"github[_-]?token(=| =|:| :)"},{name:"github_tokens",regex:"github[_-]?tokens(=| =|:| :)"},{name:"gitlab_user_email",regex:"gitlab[_-]?user[_-]?email(=| =|:| :)"},{name:"gogs_password",regex:"gogs[_-]?password(=| =|:| :)"},{name:"google_account_type",regex:"google[_-]?account[_-]?type(=| =|:| :)"},{name:"google_client_email",regex:"google[_-]?client[_-]?email(=| =|:| :)"},{name:"google_client_id",regex:"google[_-]?client[_-]?id(=| =|:| :)"},{name:"google_client_secret",regex:"google[_-]?client[_-]?secret(=| =|:| :)"},{name:"google_maps_api_key",regex:"google[_-]?maps[_-]?api[_-]?key(=| =|:| :)"},{name:"google_oauth",regex:"(ya29.[0-9A-Za-z-_]+)"},{name:"google_patterns",regex:"(?:google_client_id|google_client_secret|google_client_token)"},{name:"google_private_key",regex:"google[_-]?private[_-]?key(=| =|:| :)"},{name:"google_url",regex:"([0-9]{12}-[a-z0-9]{32}.apps.googleusercontent.com)"},{name:"gpg_key_name",regex:"gpg[_-]?key[_-]?name(=| =|:| :)"},{name:"gpg_keyname",regex:"gpg[_-]?keyname(=| =|:| :)"},{name:"gpg_ownertrust",regex:"gpg[_-]?ownertrust(=| =|:| :)"},{name:"gpg_passphrase",regex:"gpg[_-]?passphrase(=| =|:| :)"},{name:"gpg_private_key",regex:"gpg[_-]?private[_-]?key(=| =|:| :)"},{name:"gpg_secret_keys",regex:"gpg[_-]?secret[_-]?keys(=| =|:| :)"},{name:"gradle_publish_key",regex:"gradle[_-]?publish[_-]?key(=| =|:| :)"},{name:"gradle_publish_secret",regex:"gradle[_-]?publish[_-]?secret(=| =|:| :)"},{name:"gradle_signing_key_id",regex:"gradle[_-]?signing[_-]?key[_-]?id(=| =|:| :)"},{name:"gradle_signing_password",regex:"gradle[_-]?signing[_-]?password(=| =|:| :)"},{name:"gren_github_token",regex:"gren[_-]?github[_-]?token(=| =|:| :)"},{name:"grgit_user",regex:"grgit[_-]?user(=| =|:| :)"},{name:"hab_auth_token",regex:"hab[_-]?auth[_-]?token(=| =|:| :)"},{name:"hab_key",regex:"hab[_-]?key(=| =|:| :)"},{name:"hb_codesign_gpg_pass",regex:"hb[_-]?codesign[_-]?gpg[_-]?pass(=| =|:| :)"},{name:"hb_codesign_key_pass",regex:"hb[_-]?codesign[_-]?key[_-]?pass(=| =|:| :)"},{name:"heroku_api_key",regex:"heroku[_-]?api[_-]?key(=| =|:| :)"},{name:"heroku_api_key_api_key",regex:"([h|H][e|E][r|R][o|O][k|K][u|U].{0,30}[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})"},{name:"heroku_email",regex:"heroku[_-]?email(=| =|:| :)"},{name:"heroku_token",regex:"heroku[_-]?token(=| =|:| :)"},{name:"hockeyapp",regex:`hockey.{0,50}("|')?[0-9a-f]{32}("|')?`},{name:"hockeyapp_token",regex:"hockeyapp[_-]?token(=| =|:| :)"},{name:"homebrew_github_api_token",regex:"homebrew[_-]?github[_-]?api[_-]?token(=| =|:| :)"},{name:"hub_dxia2_password",regex:"hub[_-]?dxia2[_-]?password(=| =|:| :)"},{name:"ij_repo_password",regex:"ij[_-]?repo[_-]?password(=| =|:| :)"},{name:"ij_repo_username",regex:"ij[_-]?repo[_-]?username(=| =|:| :)"},{name:"index_name",regex:"index[_-]?name(=| =|:| :)"},{name:"integration_test_api_key",regex:"integration[_-]?test[_-]?api[_-]?key(=| =|:| :)"},{name:"integration_test_appid",regex:"integration[_-]?test[_-]?appid(=| =|:| :)"},{name:"internal_secrets",regex:"internal[_-]?secrets(=| =|:| :)"},{name:"ios_docs_deploy_token",regex:"ios[_-]?docs[_-]?deploy[_-]?token(=| =|:| :)"},{name:"itest_gh_token",regex:"itest[_-]?gh[_-]?token(=| =|:| :)"},{name:"jdbc",regex:"mysql: jdbc:mysql(=| =|:| :)"},{name:"jdbc_databaseurl",regex:"jdbc[_-]?databaseurl(=| =|:| :)"},{name:"jdbc_host",regex:"jdbc[_-]?host(=| =|:| :)"},{name:"jwt_secret",regex:"jwt[_-]?secret(=| =|:| :)"},{name:"kafka_admin_url",regex:"kafka[_-]?admin[_-]?url(=| =|:| :)"},{name:"kafka_instance_name",regex:"kafka[_-]?instance[_-]?name(=| =|:| :)"},{name:"kafka_rest_url",regex:"kafka[_-]?rest[_-]?url(=| =|:| :)"},{name:"keystore_pass",regex:"keystore[_-]?pass(=| =|:| :)"},{name:"kovan_private_key",regex:"kovan[_-]?private[_-]?key(=| =|:| :)"},{name:"kubecfg_s3_path",regex:"kubecfg[_-]?s3[_-]?path(=| =|:| :)"},{name:"kubeconfig",regex:"kubeconfig(=| =|:| :)"},{name:"kxoltsn3vogdop92m",regex:"kxoltsn3vogdop92m(=| =|:| :)"},{name:"leanplum_key",regex:"leanplum[_-]?key(=| =|:| :)"},{name:"lektor_deploy_password",regex:"lektor[_-]?deploy[_-]?password(=| =|:| :)"},{name:"lektor_deploy_username",regex:"lektor[_-]?deploy[_-]?username(=| =|:| :)"},{name:"lighthouse_api_key",regex:"lighthouse[_-]?api[_-]?key(=| =|:| :)"},{name:"linux_signing_key",regex:"linux[_-]?signing[_-]?key(=| =|:| :)"},{name:"ll_publish_url",regex:"ll[_-]?publish[_-]?url(=| =|:| :)"},{name:"ll_shared_key",regex:"ll[_-]?shared[_-]?key(=| =|:| :)"},{name:"looker_test_runner_client_secret",regex:"looker[_-]?test[_-]?runner[_-]?client[_-]?secret(=| =|:| :)"},{name:"lottie_happo_api_key",regex:"lottie[_-]?happo[_-]?api[_-]?key(=| =|:| :)"},{name:"lottie_happo_secret_key",regex:"lottie[_-]?happo[_-]?secret[_-]?key(=| =|:| :)"},{name:"lottie_s3_secret_key",regex:"lottie[_-]?s3[_-]?secret[_-]?key(=| =|:| :)"},{name:"lottie_upload_cert_key_password",regex:"lottie[_-]?upload[_-]?cert[_-]?key[_-]?password(=| =|:| :)"},{name:"lottie_upload_cert_key_store_password",regex:"lottie[_-]?upload[_-]?cert[_-]?key[_-]?store[_-]?password(=| =|:| :)"},{name:"magento_auth_password",regex:"magento[_-]?auth[_-]?password(=| =|:| :)"},{name:"magento_auth_username",regex:"magento[_-]?auth[_-]?username (=| =|:| :)"},{name:"magento_password",regex:"magento[_-]?password(=| =|:| :)"},{name:"mail_password",regex:"mail[_-]?password(=| =|:| :)"},{name:"mailchimp",regex:"(W(?:[a-f0-9]{32}(-us[0-9]{1,2}))a-zA-Z0-9)"},{name:"mailchimp_api_key",regex:"mailchimp[_-]?api[_-]?key(=| =|:| :)"},{name:"mailchimp_key",regex:"mailchimp[_-]?key(=| =|:| :)"},{name:"mailer_password",regex:"mailer[_-]?password(=| =|:| :)"},{name:"mailgun",regex:"(key-[0-9a-f]{32})"},{name:"mailgun_api_key",regex:"mailgun[_-]?api[_-]?key(=| =|:| :)"},{name:"mailgun_apikey",regex:"mailgun[_-]?apikey(=| =|:| :)"},{name:"mailgun_password",regex:"mailgun[_-]?password(=| =|:| :)"},{name:"mailgun_priv_key",regex:"mailgun[_-]?priv[_-]?key(=| =|:| :)"},{name:"mailgun_pub_apikey",regex:"mailgun[_-]?pub[_-]?apikey(=| =|:| :)"},{name:"mailgun_pub_key",regex:"mailgun[_-]?pub[_-]?key(=| =|:| :)"},{name:"mailgun_secret_api_key",regex:"mailgun[_-]?secret[_-]?api[_-]?key(=| =|:| :)"},{name:"manage_key",regex:"manage[_-]?key(=| =|:| :)"},{name:"manage_secret",regex:"manage[_-]?secret(=| =|:| :)"},{name:"management_token",regex:"management[_-]?token(=| =|:| :)"},{name:"managementapiaccesstoken",regex:"managementapiaccesstoken(=| =|:| :)"},{name:"mandrill_api_key",regex:"mandrill[_-]?api[_-]?key(=| =|:| :)"},{name:"manifest_app_token",regex:"manifest[_-]?app[_-]?token(=| =|:| :)"},{name:"manifest_app_url",regex:"manifest[_-]?app[_-]?url(=| =|:| :)"},{name:"mapbox_access_token",regex:"mapbox[_-]?access[_-]?token(=| =|:| :)"},{name:"mapbox_api_token",regex:"mapbox[_-]?api[_-]?token(=| =|:| :)"},{name:"mapbox_aws_access_key_id",regex:"mapbox[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"mapbox_aws_secret_access_key",regex:"mapbox[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"mapboxaccesstoken",regex:"mapboxaccesstoken(=| =|:| :)"},{name:"master_password",regex:"(master_password).+"},{name:"mg_api_key",regex:"mg[_-]?api[_-]?key(=| =|:| :)"},{name:"mg_public_api_key",regex:"mg[_-]?public[_-]?api[_-]?key(=| =|:| :)"},{name:"mh_apikey",regex:"mh[_-]?apikey(=| =|:| :)"},{name:"mh_password",regex:"mh[_-]?password(=| =|:| :)"},{name:"mile_zero_key",regex:"mile[_-]?zero[_-]?key(=| =|:| :)"},{name:"minio_access_key",regex:"minio[_-]?access[_-]?key(=| =|:| :)"},{name:"minio_secret_key",regex:"minio[_-]?secret[_-]?key(=| =|:| :)"},{name:"multi_bob_sid",regex:"multi[_-]?bob[_-]?sid(=| =|:| :)"},{name:"multi_connect_sid",regex:"multi[_-]?connect[_-]?sid(=| =|:| :)"},{name:"multi_disconnect_sid",regex:"multi[_-]?disconnect[_-]?sid(=| =|:| :)"},{name:"multi_workflow_sid",regex:"multi[_-]?workflow[_-]?sid(=| =|:| :)"},{name:"multi_workspace_sid",regex:"multi[_-]?workspace[_-]?sid(=| =|:| :)"},{name:"my_secret_env",regex:"my[_-]?secret[_-]?env(=| =|:| :)"},{name:"mysql_database",regex:"mysql[_-]?database(=| =|:| :)"},{name:"mysql_hostname",regex:"mysql[_-]?hostname(=| =|:| :)"},{name:"mysql_password",regex:"mysql[_-]?password(=| =|:| :)"},{name:"mysql_root_password",regex:"mysql[_-]?root[_-]?password(=| =|:| :)"},{name:"mysql_user",regex:"mysql[_-]?user(=| =|:| :)"},{name:"mysql_username",regex:"mysql[_-]?username(=| =|:| :)"},{name:"mysqlmasteruser",regex:"mysqlmasteruser(=| =|:| :)"},{name:"mysqlsecret",regex:"mysqlsecret(=| =|:| :)"},{name:"nativeevents",regex:"nativeevents(=| =|:| :)"},{name:"netlify_api_key",regex:"netlify[_-]?api[_-]?key(=| =|:| :)"},{name:"new_relic_beta_token",regex:"new[_-]?relic[_-]?beta[_-]?token(=| =|:| :)"},{name:"nexus_password",regex:"nexus[_-]?password(=| =|:| :)"},{name:"nexuspassword",regex:"nexuspassword(=| =|:| :)"},{name:"ngrok_auth_token",regex:"ngrok[_-]?auth[_-]?token(=| =|:| :)"},{name:"ngrok_token",regex:"ngrok[_-]?token(=| =|:| :)"},{name:"node_env",regex:"node[_-]?env(=| =|:| :)"},{name:"node_pre_gyp_accesskeyid",regex:"node[_-]?pre[_-]?gyp[_-]?accesskeyid(=| =|:| :)"},{name:"node_pre_gyp_github_token",regex:"node[_-]?pre[_-]?gyp[_-]?github[_-]?token(=| =|:| :)"},{name:"node_pre_gyp_secretaccesskey",regex:"node[_-]?pre[_-]?gyp[_-]?secretaccesskey(=| =|:| :)"},{name:"non_token",regex:"non[_-]?token(=| =|:| :)"},{name:"now_token",regex:"now[_-]?token(=| =|:| :)"},{name:"npm_api_key",regex:"npm[_-]?api[_-]?key(=| =|:| :)"},{name:"npm_api_token",regex:"npm[_-]?api[_-]?token(=| =|:| :)"},{name:"npm_auth_token",regex:"npm[_-]?auth[_-]?token(=| =|:| :)"},{name:"npm_email",regex:"npm[_-]?email(=| =|:| :)"},{name:"npm_password",regex:"npm[_-]?password(=| =|:| :)"},{name:"npm_secret_key",regex:"npm[_-]?secret[_-]?key(=| =|:| :)"},{name:"npm_token - 1",regex:"npm[_-]?token(=| =|:| :)"},{name:"nuget_api_key - 1",regex:"(oy2[a-z0-9]{43})"},{name:"nuget_api_key - 2",regex:"nuget[_-]?api[_-]?key(=| =|:| :)"},{name:"numbers_service_pass",regex:"numbers[_-]?service[_-]?pass(=| =|:| :)"},{name:"oauth_token",regex:"oauth[_-]?token(=| =|:| :)"},{name:"object_storage_password",regex:"object[_-]?storage[_-]?password(=| =|:| :)"},{name:"object_storage_region_name",regex:"object[_-]?storage[_-]?region[_-]?name(=| =|:| :)"},{name:"object_store_bucket",regex:"object[_-]?store[_-]?bucket(=| =|:| :)"},{name:"object_store_creds",regex:"object[_-]?store[_-]?creds(=| =|:| :)"},{name:"oc_pass",regex:"oc[_-]?pass(=| =|:| :)"},{name:"octest_app_password",regex:"octest[_-]?app[_-]?password(=| =|:| :)"},{name:"octest_app_username",regex:"octest[_-]?app[_-]?username(=| =|:| :)"},{name:"octest_password",regex:"octest[_-]?password(=| =|:| :)"},{name:"ofta_key",regex:"ofta[_-]?key(=| =|:| :)"},{name:"ofta_region",regex:"ofta[_-]?region(=| =|:| :)"},{name:"ofta_secret",regex:"ofta[_-]?secret(=| =|:| :)"},{name:"okta_client_token",regex:"okta[_-]?client[_-]?token(=| =|:| :)"},{name:"okta_oauth2_client_secret",regex:"okta[_-]?oauth2[_-]?client[_-]?secret(=| =|:| :)"},{name:"okta_oauth2_clientsecret",regex:"okta[_-]?oauth2[_-]?clientsecret(=| =|:| :)"},{name:"omise_key",regex:"omise[_-]?key(=| =|:| :)"},{name:"omise_pkey",regex:"omise[_-]?pkey(=| =|:| :)"},{name:"omise_pubkey",regex:"omise[_-]?pubkey(=| =|:| :)"},{name:"omise_skey",regex:"omise[_-]?skey(=| =|:| :)"},{name:"onesignal_api_key",regex:"onesignal[_-]?api[_-]?key(=| =|:| :)"},{name:"onesignal_user_auth_key",regex:"onesignal[_-]?user[_-]?auth[_-]?key(=| =|:| :)"},{name:"open_whisk_key",regex:"open[_-]?whisk[_-]?key(=| =|:| :)"},{name:"openwhisk_key",regex:"openwhisk[_-]?key(=| =|:| :)"},{name:"os_auth_url",regex:"os[_-]?auth[_-]?url(=| =|:| :)"},{name:"os_password",regex:"os[_-]?password(=| =|:| :)"},{name:"ossrh_jira_password",regex:"ossrh[_-]?jira[_-]?password(=| =|:| :)"},{name:"ossrh_pass",regex:"ossrh[_-]?pass(=| =|:| :)"},{name:"ossrh_password",regex:"ossrh[_-]?password(=| =|:| :)"},{name:"ossrh_secret",regex:"ossrh[_-]?secret(=| =|:| :)"},{name:"ossrh_username",regex:"ossrh[_-]?username(=| =|:| :)"},{name:"outlook_team",regex:"(https://outlook.office.com/webhook/[0-9a-f-]{36}@)"},{name:"packagecloud_token",regex:"packagecloud[_-]?token(=| =|:| :)"},{name:"pagerduty_apikey",regex:"pagerduty[_-]?apikey(=| =|:| :)"},{name:"parse_js_key",regex:"parse[_-]?js[_-]?key(=| =|:| :)"},{name:"passwordtravis",regex:"passwordtravis(=| =|:| :)"},{name:"paypal_braintree_access_token",regex:"(access_token$production$[0-9a-z]{16}$[0-9a-f]{32})"},{name:"paypal_client_secret",regex:"paypal[_-]?client[_-]?secret(=| =|:| :)"},{name:"percy_project",regex:"percy[_-]?project(=| =|:| :)"},{name:"percy_token",regex:"percy[_-]?token(=| =|:| :)"},{name:"personal_key",regex:"personal[_-]?key(=| =|:| :)"},{name:"personal_secret",regex:"personal[_-]?secret(=| =|:| :)"},{name:"pg_database",regex:"pg[_-]?database(=| =|:| :)"},{name:"pg_host",regex:"pg[_-]?host(=| =|:| :)"},{name:"places_api_key",regex:"places[_-]?api[_-]?key(=| =|:| :)"},{name:"places_apikey",regex:"places[_-]?apikey(=| =|:| :)"},{name:"plotly_apikey",regex:"plotly[_-]?apikey(=| =|:| :)"},{name:"plugin_password",regex:"plugin[_-]?password(=| =|:| :)"},{name:"postgres_env_postgres_db",regex:"postgres[_-]?env[_-]?postgres[_-]?db(=| =|:| :)"},{name:"postgres_env_postgres_password",regex:"postgres[_-]?env[_-]?postgres[_-]?password(=| =|:| :)"},{name:"postgresql_db",regex:"postgresql[_-]?db(=| =|:| :)"},{name:"postgresql_pass",regex:"postgresql[_-]?pass(=| =|:| :)"},{name:"prebuild_auth",regex:"prebuild[_-]?auth(=| =|:| :)"},{name:"preferred_username",regex:"preferred[_-]?username(=| =|:| :)"},{name:"pring_mail_username",regex:"pring[_-]?mail[_-]?username(=| =|:| :)"},{name:"private_key",regex:"-----(?:(?:BEGIN|END) )(?:(?:EC|PGP|DSA|RSA|OPENSSH).)?PRIVATE.KEY(.BLOCK)?-----"},{name:"private_signing_password",regex:"private[_-]?signing[_-]?password(=| =|:| :)"},{name:"prod_access_key_id",regex:"prod[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"prod_password",regex:"prod[_-]?password(=| =|:| :)"},{name:"prod_secret_key",regex:"prod[_-]?secret[_-]?key(=| =|:| :)"},{name:"project_config",regex:"project[_-]?config(=| =|:| :)"},{name:"publish_access",regex:"publish[_-]?access(=| =|:| :)"},{name:"publish_key",regex:"publish[_-]?key(=| =|:| :)"},{name:"publish_secret",regex:"publish[_-]?secret(=| =|:| :)"},{name:"pushover_token",regex:"pushover[_-]?token(=| =|:| :)"},{name:"pypi_passowrd",regex:"pypi[_-]?passowrd(=| =|:| :)"},{name:"qiita_token",regex:"qiita[_-]?token(=| =|:| :)"},{name:"quip_token",regex:"quip[_-]?token(=| =|:| :)"},{name:"rabbitmq_password",regex:"rabbitmq[_-]?password(=| =|:| :)"},{name:"randrmusicapiaccesstoken",regex:"randrmusicapiaccesstoken(=| =|:| :)"},{name:"redis_stunnel_urls",regex:"redis[_-]?stunnel[_-]?urls(=| =|:| :)"},{name:"rediscloud_url",regex:"rediscloud[_-]?url(=| =|:| :)"},{name:"refresh_token",regex:"refresh[_-]?token(=| =|:| :)"},{name:"registry_pass",regex:"registry[_-]?pass(=| =|:| :)"},{name:"registry_secure",regex:"registry[_-]?secure(=| =|:| :)"},{name:"release_gh_token",regex:"release[_-]?gh[_-]?token(=| =|:| :)"},{name:"release_token",regex:"release[_-]?token(=| =|:| :)"},{name:"reporting_webdav_pwd",regex:"reporting[_-]?webdav[_-]?pwd(=| =|:| :)"},{name:"reporting_webdav_url",regex:"reporting[_-]?webdav[_-]?url(=| =|:| :)"},{name:"repotoken",regex:"repotoken(=| =|:| :)"},{name:"rest_api_key",regex:"rest[_-]?api[_-]?key(=| =|:| :)"},{name:"rinkeby_private_key",regex:"rinkeby[_-]?private[_-]?key(=| =|:| :)"},{name:"ropsten_private_key",regex:"ropsten[_-]?private[_-]?key(=| =|:| :)"},{name:"route53_access_key_id",regex:"route53[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"rtd_key_pass",regex:"rtd[_-]?key[_-]?pass(=| =|:| :)"},{name:"rtd_store_pass",regex:"rtd[_-]?store[_-]?pass(=| =|:| :)"},{name:"rubygems_auth_token",regex:"rubygems[_-]?auth[_-]?token(=| =|:| :)"},{name:"s3_access_key",regex:"s3[_-]?access[_-]?key(=| =|:| :)"},{name:"s3_access_key_id",regex:"s3[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"s3_bucket_name_app_logs",regex:"s3[_-]?bucket[_-]?name[_-]?app[_-]?logs(=| =|:| :)"},{name:"s3_bucket_name_assets",regex:"s3[_-]?bucket[_-]?name[_-]?assets(=| =|:| :)"},{name:"s3_external_3_amazonaws_com",regex:"s3[_-]?external[_-]?3[_-]?amazonaws[_-]?com(=| =|:| :)"},{name:"s3_key",regex:"s3[_-]?key(=| =|:| :)"},{name:"s3_key_app_logs",regex:"s3[_-]?key[_-]?app[_-]?logs(=| =|:| :)"},{name:"s3_key_assets",regex:"s3[_-]?key[_-]?assets(=| =|:| :)"},{name:"s3_secret_app_logs",regex:"s3[_-]?secret[_-]?app[_-]?logs(=| =|:| :)"},{name:"s3_secret_assets",regex:"s3[_-]?secret[_-]?assets(=| =|:| :)"},{name:"s3_secret_key",regex:"s3[_-]?secret[_-]?key(=| =|:| :)"},{name:"s3_user_secret",regex:"s3[_-]?user[_-]?secret(=| =|:| :)"},{name:"sacloud_access_token",regex:"sacloud[_-]?access[_-]?token(=| =|:| :)"},{name:"sacloud_access_token_secret",regex:"sacloud[_-]?access[_-]?token[_-]?secret(=| =|:| :)"},{name:"sacloud_api",regex:"sacloud[_-]?api(=| =|:| :)"},{name:"salesforce_bulk_test_password",regex:"salesforce[_-]?bulk[_-]?test[_-]?password(=| =|:| :)"},{name:"salesforce_bulk_test_security_token",regex:"salesforce[_-]?bulk[_-]?test[_-]?security[_-]?token(=| =|:| :)"},{name:"sandbox_access_token",regex:"sandbox[_-]?access[_-]?token(=| =|:| :)"},{name:"sandbox_aws_access_key_id",regex:"sandbox[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"sandbox_aws_secret_access_key",regex:"sandbox[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"sauce_access_key",regex:"sauce[_-]?access[_-]?key(=| =|:| :)"},{name:"sauce_token",regex:`(sauce.{0,50}("|')?[0-9a-f-]{36}("|')?)`},{name:"scrutinizer_token",regex:"scrutinizer[_-]?token(=| =|:| :)"},{name:"sdr_token",regex:"sdr[_-]?token(=| =|:| :)"},{name:"secret_0",regex:"secret[_-]?0(=| =|:| :)"},{name:"secret_1",regex:"secret[_-]?1(=| =|:| :)"},{name:"secret_10",regex:"secret[_-]?10(=| =|:| :)"},{name:"secret_11",regex:"secret[_-]?11(=| =|:| :)"},{name:"secret_2",regex:"secret[_-]?2(=| =|:| :)"},{name:"secret_3",regex:"secret[_-]?3(=| =|:| :)"},{name:"secret_4",regex:"secret[_-]?4(=| =|:| :)"},{name:"secret_5",regex:"secret[_-]?5(=| =|:| :)"},{name:"secret_6",regex:"secret[_-]?6(=| =|:| :)"},{name:"secret_7",regex:"secret[_-]?7(=| =|:| :)"},{name:"secret_8",regex:"secret[_-]?8(=| =|:| :)"},{name:"secret_9",regex:"secret[_-]?9(=| =|:| :)"},{name:"secret_key_base",regex:"secret[_-]?key[_-]?base(=| =|:| :)"},{name:"secretaccesskey",regex:"secretaccesskey(=| =|:| :)"},{name:"secretkey",regex:"secretkey(=| =|:| :)"},{name:"segment_api_key",regex:"segment[_-]?api[_-]?key(=| =|:| :)"},{name:"selion_log_level_dev",regex:"selion[_-]?log[_-]?level[_-]?dev(=| =|:| :)"},{name:"selion_selenium_host",regex:"selion[_-]?selenium[_-]?host(=| =|:| :)"},{name:"sendgrid - 2",regex:"sendgrid(=| =|:| :)"},{name:"sendgrid_api_key - 1",regex:"sendgrid[_-]?api[_-]?key(=| =|:| :)"},{name:"sendgrid_key",regex:"sendgrid[_-]?key(=| =|:| :)"},{name:"sendgrid_password",regex:"sendgrid[_-]?password(=| =|:| :)"},{name:"sendgrid_user",regex:"sendgrid[_-]?user(=| =|:| :)"},{name:"sendgrid_username",regex:"sendgrid[_-]?username(=| =|:| :)"},{name:"sendwithus_key",regex:"sendwithus[_-]?key(=| =|:| :)"},{name:"sentry_auth_token",regex:"sentry[_-]?auth[_-]?token(=| =|:| :)"},{name:"sentry_default_org",regex:"sentry[_-]?default[_-]?org(=| =|:| :)"},{name:"sentry_endpoint",regex:"sentry[_-]?endpoint(=| =|:| :)"},{name:"sentry_key",regex:"sentry[_-]?key(=| =|:| :)"},{name:"service_account_secret",regex:"service[_-]?account[_-]?secret(=| =|:| :)"},{name:"ses_access_key",regex:"ses[_-]?access[_-]?key(=| =|:| :)"},{name:"ses_secret_key",regex:"ses[_-]?secret[_-]?key(=| =|:| :)"},{name:"setdstaccesskey",regex:"setdstaccesskey(=| =|:| :)"},{name:"setdstsecretkey",regex:"setdstsecretkey(=| =|:| :)"},{name:"setsecretkey",regex:"setsecretkey(=| =|:| :)"},{name:"signing_key",regex:"signing[_-]?key(=| =|:| :)"},{name:"signing_key_password",regex:"signing[_-]?key[_-]?password(=| =|:| :)"},{name:"signing_key_secret",regex:"signing[_-]?key[_-]?secret(=| =|:| :)"},{name:"signing_key_sid",regex:"signing[_-]?key[_-]?sid(=| =|:| :)"},{name:"slack_webhook_url",regex:"(hooks.slack.com/services/T[A-Z0-9]{8}/B[A-Z0-9]{8}/[a-zA-Z0-9]{1,})"},{name:"slash_developer_space",regex:"slash[_-]?developer[_-]?space(=| =|:| :)"},{name:"slash_developer_space_key",regex:"slash[_-]?developer[_-]?space[_-]?key(=| =|:| :)"},{name:"slate_user_email",regex:"slate[_-]?user[_-]?email(=| =|:| :)"},{name:"snoowrap_client_secret",regex:"snoowrap[_-]?client[_-]?secret(=| =|:| :)"},{name:"snoowrap_password",regex:"snoowrap[_-]?password(=| =|:| :)"},{name:"snoowrap_refresh_token",regex:"snoowrap[_-]?refresh[_-]?token(=| =|:| :)"},{name:"snyk_api_token",regex:"snyk[_-]?api[_-]?token(=| =|:| :)"},{name:"snyk_token",regex:"snyk[_-]?token(=| =|:| :)"},{name:"socrata_app_token",regex:"socrata[_-]?app[_-]?token(=| =|:| :)"},{name:"socrata_password",regex:"socrata[_-]?password(=| =|:| :)"},{name:"sonar_organization_key",regex:"sonar[_-]?organization[_-]?key(=| =|:| :)"},{name:"sonar_project_key",regex:"sonar[_-]?project[_-]?key(=| =|:| :)"},{name:"sonar_token",regex:"sonar[_-]?token(=| =|:| :)"},{name:"sonarqube_docs_api_key",regex:`(sonar.{0,50}("|')?[0-9a-f]{40}("|')?)`},{name:"sonatype_gpg_key_name",regex:"sonatype[_-]?gpg[_-]?key[_-]?name(=| =|:| :)"},{name:"sonatype_gpg_passphrase",regex:"sonatype[_-]?gpg[_-]?passphrase(=| =|:| :)"},{name:"sonatype_nexus_password",regex:"sonatype[_-]?nexus[_-]?password(=| =|:| :)"},{name:"sonatype_pass",regex:"sonatype[_-]?pass(=| =|:| :)"},{name:"sonatype_password",regex:"sonatype[_-]?password(=| =|:| :)"},{name:"sonatype_token_password",regex:"sonatype[_-]?token[_-]?password(=| =|:| :)"},{name:"sonatype_token_user",regex:"sonatype[_-]?token[_-]?user(=| =|:| :)"},{name:"sonatypepassword",regex:"sonatypepassword(=| =|:| :)"},{name:"soundcloud_client_secret",regex:"soundcloud[_-]?client[_-]?secret(=| =|:| :)"},{name:"soundcloud_password",regex:"soundcloud[_-]?password(=| =|:| :)"},{name:"spaces_access_key_id",regex:"spaces[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"spaces_secret_access_key",regex:"spaces[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"spotify_api_access_token",regex:"spotify[_-]?api[_-]?access[_-]?token(=| =|:| :)"},{name:"spotify_api_client_secret",regex:"spotify[_-]?api[_-]?client[_-]?secret(=| =|:| :)"},{name:"spring_mail_password",regex:"spring[_-]?mail[_-]?password(=| =|:| :)"},{name:"sqsaccesskey",regex:"sqsaccesskey(=| =|:| :)"},{name:"sqssecretkey",regex:"sqssecretkey(=| =|:| :)"},{name:"square_app_secret",regex:"(sq0[a-z]{3}-[0-9A-Za-z-_]{20,50})"},{name:"square_reader_sdk_repository_password",regex:"square[_-]?reader[_-]?sdk[_-]?repository[_-]?password(=| =|:| :)"},{name:"srcclr_api_token",regex:"srcclr[_-]?api[_-]?token(=| =|:| :)"},{name:"ssh_password",regex:`(sshpass -p.*['|"])`},{name:"sshpass",regex:"sshpass(=| =|:| :)"},{name:"ssmtp_config",regex:"ssmtp[_-]?config(=| =|:| :)"},{name:"staging_base_url_runscope",regex:"staging[_-]?base[_-]?url[_-]?runscope(=| =|:| :)"},{name:"star_test_aws_access_key_id",regex:"star[_-]?test[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"star_test_bucket",regex:"star[_-]?test[_-]?bucket(=| =|:| :)"},{name:"star_test_location",regex:"star[_-]?test[_-]?location(=| =|:| :)"},{name:"star_test_secret_access_key",regex:"star[_-]?test[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"starship_account_sid",regex:"starship[_-]?account[_-]?sid(=| =|:| :)"},{name:"starship_auth_token",regex:"starship[_-]?auth[_-]?token(=| =|:| :)"},{name:"stormpath_api_key_id",regex:"stormpath[_-]?api[_-]?key[_-]?id(=| =|:| :)"},{name:"stormpath_api_key_secret",regex:"stormpath[_-]?api[_-]?key[_-]?secret(=| =|:| :)"},{name:"strip_publishable_key",regex:"strip[_-]?publishable[_-]?key(=| =|:| :)"},{name:"strip_secret_key",regex:"strip[_-]?secret[_-]?key(=| =|:| :)"},{name:"stripe_private",regex:"stripe[_-]?private(=| =|:| :)"},{name:"stripe_public",regex:"stripe[_-]?public(=| =|:| :)"},{name:"stripe_restricted_api",regex:"(rk_live_[0-9a-zA-Z]{24,34})"},{name:"stripe_standard_api",regex:"(sk_live_[0-9a-zA-Z]{24,34})"},{name:"surge_login",regex:"surge[_-]?login(=| =|:| :)"},{name:"surge_token",regex:"surge[_-]?token(=| =|:| :)"},{name:"svn_pass",regex:"svn[_-]?pass(=| =|:| :)"},{name:"tesco_api_key",regex:"tesco[_-]?api[_-]?key(=| =|:| :)"},{name:"test_github_token",regex:"test[_-]?github[_-]?token(=| =|:| :)"},{name:"test_test",regex:"test[_-]?test(=| =|:| :)"},{name:"tester_keys_password",regex:"tester[_-]?keys[_-]?password(=| =|:| :)"},{name:"thera_oss_access_key",regex:"thera[_-]?oss[_-]?access[_-]?key(=| =|:| :)"},{name:"token_core_java",regex:"token[_-]?core[_-]?java(=| =|:| :)"},{name:"travis_access_token",regex:"travis[_-]?access[_-]?token(=| =|:| :)"},{name:"travis_api_token",regex:"travis[_-]?api[_-]?token(=| =|:| :)"},{name:"travis_branch",regex:"travis[_-]?branch(=| =|:| :)"},{name:"travis_com_token",regex:"travis[_-]?com[_-]?token(=| =|:| :)"},{name:"travis_e2e_token",regex:"travis[_-]?e2e[_-]?token(=| =|:| :)"},{name:"travis_gh_token",regex:"travis[_-]?gh[_-]?token(=| =|:| :)"},{name:"travis_pull_request",regex:"travis[_-]?pull[_-]?request(=| =|:| :)"},{name:"travis_secure_env_vars",regex:"travis[_-]?secure[_-]?env[_-]?vars(=| =|:| :)"},{name:"travis_token",regex:"travis[_-]?token(=| =|:| :)"},{name:"trex_client_token",regex:"trex[_-]?client[_-]?token(=| =|:| :)"},{name:"trex_okta_client_token",regex:"trex[_-]?okta[_-]?client[_-]?token(=| =|:| :)"},{name:"twilio_api_key",regex:"twilio[_-]?api[_-]?key(=| =|:| :)"},{name:"twilio_api_secret",regex:"twilio[_-]?api[_-]?secret(=| =|:| :)"},{name:"twilio_chat_account_api_service",regex:"twilio[_-]?chat[_-]?account[_-]?api[_-]?service(=| =|:| :)"},{name:"twilio_configuration_sid",regex:"twilio[_-]?configuration[_-]?sid(=| =|:| :)"},{name:"twilio_sid",regex:"twilio[_-]?sid(=| =|:| :)"},{name:"twilio_token",regex:"twilio[_-]?token(=| =|:| :)"},{name:"twine_password",regex:"twine[_-]?password(=| =|:| :)"},{name:"twitter_consumer_key",regex:"twitter[_-]?consumer[_-]?key(=| =|:| :)"},{name:"twitter_consumer_secret",regex:"twitter[_-]?consumer[_-]?secret(=| =|:| :)"},{name:"twitteroauthaccesssecret",regex:"twitteroauthaccesssecret(=| =|:| :)"},{name:"twitteroauthaccesstoken",regex:"twitteroauthaccesstoken(=| =|:| :)"},{name:"unity_password",regex:"unity[_-]?password(=| =|:| :)"},{name:"unity_serial",regex:"unity[_-]?serial(=| =|:| :)"},{name:"urban_key",regex:"urban[_-]?key(=| =|:| :)"},{name:"urban_master_secret",regex:"urban[_-]?master[_-]?secret(=| =|:| :)"},{name:"urban_secret",regex:"urban[_-]?secret(=| =|:| :)"},{name:"us_east_1_elb_amazonaws_com",regex:"us[_-]?east[_-]?1[_-]?elb[_-]?amazonaws[_-]?com(=| =|:| :)"},{name:"use_ssh",regex:"use[_-]?ssh(=| =|:| :)"},{name:"user_assets_access_key_id",regex:"user[_-]?assets[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"user_assets_secret_access_key",regex:"user[_-]?assets[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"usertravis",regex:"usertravis(=| =|:| :)"},{name:"v_sfdc_client_secret",regex:"v[_-]?sfdc[_-]?client[_-]?secret(=| =|:| :)"},{name:"v_sfdc_password",regex:"v[_-]?sfdc[_-]?password(=| =|:| :)"},{name:"vip_github_build_repo_deploy_key",regex:"vip[_-]?github[_-]?build[_-]?repo[_-]?deploy[_-]?key(=| =|:| :)"},{name:"vip_github_deploy_key",regex:"vip[_-]?github[_-]?deploy[_-]?key(=| =|:| :)"},{name:"vip_github_deploy_key_pass",regex:"vip[_-]?github[_-]?deploy[_-]?key[_-]?pass(=| =|:| :)"},{name:"virustotal_apikey",regex:"virustotal[_-]?apikey(=| =|:| :)"},{name:"visual_recognition_api_key",regex:"visual[_-]?recognition[_-]?api[_-]?key(=| =|:| :)"},{name:"vscetoken",regex:"vscetoken(=| =|:| :)"},{name:"wakatime_api_key",regex:"wakatime[_-]?api[_-]?key(=| =|:| :)"},{name:"watson_conversation_password",regex:"watson[_-]?conversation[_-]?password(=| =|:| :)"},{name:"watson_device_password",regex:"watson[_-]?device[_-]?password(=| =|:| :)"},{name:"watson_password",regex:"watson[_-]?password(=| =|:| :)"},{name:"widget_basic_password",regex:"widget[_-]?basic[_-]?password(=| =|:| :)"},{name:"widget_basic_password_2",regex:"widget[_-]?basic[_-]?password[_-]?2(=| =|:| :)"},{name:"widget_basic_password_3",regex:"widget[_-]?basic[_-]?password[_-]?3(=| =|:| :)"},{name:"widget_basic_password_4",regex:"widget[_-]?basic[_-]?password[_-]?4(=| =|:| :)"},{name:"widget_basic_password_5",regex:"widget[_-]?basic[_-]?password[_-]?5(=| =|:| :)"},{name:"widget_fb_password",regex:"widget[_-]?fb[_-]?password(=| =|:| :)"},{name:"widget_fb_password_2",regex:"widget[_-]?fb[_-]?password[_-]?2(=| =|:| :)"},{name:"widget_fb_password_3",regex:"widget[_-]?fb[_-]?password[_-]?3(=| =|:| :)"},{name:"widget_test_server",regex:"widget[_-]?test[_-]?server(=| =|:| :)"},{name:"wincert_password",regex:"wincert[_-]?password(=| =|:| :)"},{name:"wordpress_db_password",regex:"wordpress[_-]?db[_-]?password(=| =|:| :)"},{name:"wordpress_db_user",regex:"wordpress[_-]?db[_-]?user(=| =|:| :)"},{name:"wpjm_phpunit_google_geocode_api_key",regex:"wpjm[_-]?phpunit[_-]?google[_-]?geocode[_-]?api[_-]?key(=| =|:| :)"},{name:"wporg_password",regex:"wporg[_-]?password(=| =|:| :)"},{name:"wpt_db_password",regex:"wpt[_-]?db[_-]?password(=| =|:| :)"},{name:"wpt_db_user",regex:"wpt[_-]?db[_-]?user(=| =|:| :)"},{name:"wpt_prepare_dir",regex:"wpt[_-]?prepare[_-]?dir(=| =|:| :)"},{name:"wpt_report_api_key",regex:"wpt[_-]?report[_-]?api[_-]?key(=| =|:| :)"},{name:"wpt_ssh_connect",regex:"wpt[_-]?ssh[_-]?connect(=| =|:| :)"},{name:"wpt_ssh_private_key_base64",regex:"wpt[_-]?ssh[_-]?private[_-]?key[_-]?base64(=| =|:| :)"},{name:"www_googleapis_com",regex:"www[_-]?googleapis[_-]?com(=| =|:| :)"},{name:"yangshun_gh_password",regex:"yangshun[_-]?gh[_-]?password(=| =|:| :)"},{name:"yangshun_gh_token",regex:"yangshun[_-]?gh[_-]?token(=| =|:| :)"},{name:"yt_account_client_secret",regex:"yt[_-]?account[_-]?client[_-]?secret(=| =|:| :)"},{name:"yt_account_refresh_token",regex:"yt[_-]?account[_-]?refresh[_-]?token(=| =|:| :)"},{name:"yt_api_key",regex:"yt[_-]?api[_-]?key(=| =|:| :)"},{name:"yt_client_secret",regex:"yt[_-]?client[_-]?secret(=| =|:| :)"},{name:"yt_partner_client_secret",regex:"yt[_-]?partner[_-]?client[_-]?secret(=| =|:| :)"},{name:"yt_partner_refresh_token",regex:"yt[_-]?partner[_-]?refresh[_-]?token(=| =|:| :)"},{name:"yt_server_api_key",regex:"yt[_-]?server[_-]?api[_-]?key(=| =|:| :)"},{name:"zendesk_travis_github",regex:"zendesk[_-]?travis[_-]?github(=| =|:| :)"},{name:"zensonatypepassword",regex:"zensonatypepassword(=| =|:| :)"},{name:"zhuliang_gh_token",regex:"zhuliang[_-]?gh[_-]?token(=| =|:| :)"},{name:"zopim_account_key",regex:"zopim[_-]?account[_-]?key(=| =|:| :)"},{name:"docker_registry_auth",regex:'auth":.*"(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{4}|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{2}={2})'}];var FX="*",mj=new Set([`
83
- `,"\r","\t",'"',"'",":",",","{","}","[","]","\\"]),KX=[];for(let{regex:_}of ZX)try{let z=_,A="g";if(z.startsWith("(?i)"))z=z.slice(4),A="gi";KX.push(new RegExp(z,A))}catch{}function X6(_,z=FX){let A=z.length>0?z[0]:FX,b=_;for(let G of KX)b=b.replace(G,(J)=>Array.from(J,(Y)=>mj.has(Y)?Y:A).join(""));return b}function L_(_){if(typeof _==="string")return X6(_);if(Array.isArray(_))return _.map((z)=>L_(z));if(_ instanceof Date)return _;if(_!==null&&typeof _==="object"){let z={};for(let[A,b]of Object.entries(_))z[A]=L_(b);return z}return _}var uj=[".env",".env.local",".env.development",".env.production",".env.test",".env.staging",/\.env\.(dev|prod|stage|preview|ci|build|docker)$/i,".zshrc",".bashrc",".bash_profile",".profile",".zprofile",".zshenv",".zsh_history",".bash_history","id_rsa","id_ed25519","id_ecdsa","id_dsa",/^id_[a-z0-9]+$/i,/\.pem$/i,/\.key$/i,".aws/credentials",".aws/config",".docker/config.json",".npmrc",".yarnrc",".yarnrc.yml",".git-credentials",".netrc",".kube/config","kubeconfig","database.yml","secrets.yml","secrets.yaml","master.key","credentials.yml.enc",".gcloud/credentials","service-account.json","service_account.json",/gcp.*credentials.*\.json$/i,/firebase.*\.json$/i];function cj(_){let z=_.replace(/\\/g,"/"),A=z.split("/").pop()||"";for(let b of uj)if(typeof b==="string"){if(A===b||z.endsWith(`/${b}`)||z===b)return!0}else if(b.test(A)||b.test(z))return!0;return!1}function j5(_){return _.replace(/[^\s]/g,"*")}function R5(_){let z=_.messages.map((A)=>lj(A));return{..._,messages:z}}function lj(_){if(_.type!=="tool-call")return _;let z=_.toolName;if(z!=="Read"&&z!=="Write")return _;let A=_.input,b=A?.file_path;if(typeof b!=="string"||!cj(b))return _;let G={..._};if(z==="Write"&&A){let J=A.content;if(typeof J==="string")G.input={...A,content:j5(J)}}if(z==="Read"){let J=_.output;if(typeof J==="string")G.output=j5(J);else if(J&&typeof J==="object"){let Y=J,X=Y.file;if(X&&typeof X.content==="string")G.output={...Y,file:{...X,content:j5(X.content)}}}}return G}import{spawn as pj}from"child_process";import{promises as m9}from"fs";import{homedir as P5}from"os";import{basename as dj,extname as rj,join as X4,resolve as qX}from"path";var Mz=100,WX=80,nj=new Set(["[request interrupted by user]","[request aborted by user]","[request cancelled by user]"]),ij=/^<\/?(?:command|local)-[a-z-]+>/i,oj=/^[α-ωΑ-Ω]\s/i,aj=/<system-reminder>[\s\S]*?<\/system-reminder>/g,sj=["npm ","npm:","npm error","node:","node.js","error:","fatal:","warning:","traceback (most recent call last):","usage:","hint:","note:","code:","requirestack"],tj=X4(P5(),".claude"),ej=X4(P5(),".codex"),_R=X4(P5(),".pi","agent","sessions");async function zR(_){let z=_?.limit??Mz,A=process.env.CLAUDE_HOME??tj,b=X4(A,"projects");if(!await S5(b))return[];let G=[];try{let X=await m9.readdir(b,{withFileTypes:!0});for(let Q of X){if(!Q.isDirectory())continue;let $=X4(b,Q.name);try{let H=await m9.readdir($,{withFileTypes:!0});for(let B of H){if(!B.isFile()||rj(B.name)!==".jsonl")continue;let Z=X4($,B.name),F=dj(B.name,".jsonl");try{let K=await m9.stat(Z);G.push({path:Z,id:F,mtime:K.mtime})}catch{}}}catch{}}}catch{}G.sort((X,Q)=>Q.mtime.getTime()-X.mtime.getTime());let J=G.slice(0,z*2),Y=[];for(let X of J)try{let Q=await YR(X.path);Y.push({id:X.id,source:"claude-code",path:X.path,timestamp:Q.timestamp,preview:Q.preview,cwd:Q.cwd,repoId:null,stats:Q.stats})}catch{}return Y.sort((X,Q)=>Q.timestamp.getTime()-X.timestamp.getTime()).slice(0,z)}async function AR(_){let z=_?.limit??Mz,A=process.env.CODEX_HOME??ej,b=X4(A,"sessions");if(!await S5(b))return[];let G=[],Y=(await HR(b)).slice(0,z*2);for(let X of Y)try{let Q=await BR(X);if(!Q)continue;G.push({id:Q.sessionId,source:"codex",path:X,timestamp:Q.timestamp,preview:Q.preview,cwd:Q.cwd,repoId:null,stats:Q.stats})}catch{}return G.sort((X,Q)=>Q.timestamp.getTime()-X.timestamp.getTime()).slice(0,z)}async function bR(_){let z=_?.limit??Mz;try{let A=await GR(z*2);if(!A)return[];let b=JSON.parse(A),G=[];for(let J of b){if(J.parentId)continue;let Y=J.updated?new Date(J.updated):J.created?new Date(J.created):new Date(0);G.push({id:J.id,source:"opencode",path:J.id,timestamp:Y,preview:J.title?Q6(J.title):null,cwd:J.directory??null,repoId:null,stats:null})}return G.sort((J,Y)=>Y.timestamp.getTime()-J.timestamp.getTime()).slice(0,z)}catch{return[]}}function GR(_){return new Promise((z)=>{let A=!1,b=(X)=>{if(!A)A=!0,clearTimeout(Y),z(X)},G=pj("opencode",["session","list","--format","json","-n",String(_)],{stdio:["pipe","pipe","pipe"]}),J="",Y=setTimeout(()=>{G.kill(),b(null)},30000);G.stdout.on("data",(X)=>{J+=X.toString()}),G.on("close",(X)=>{b(X===0?J.trim()||null:null)}),G.on("error",()=>{b(null)})})}async function JR(_){let z=_?.limit??Mz,A=process.env.PI_SESSIONS??_R;if(!await S5(A))return[];let b=[];try{let G=await m9.readdir(A,{withFileTypes:!0});for(let J of G){if(!J.isDirectory())continue;let Y=X4(A,J.name);try{let X=await m9.readdir(Y,{withFileTypes:!0});for(let Q of X){if(!Q.isFile()||!Q.name.endsWith(".jsonl"))continue;let $=X4(Y,Q.name);try{let H=await ZR($);if(!H)continue;b.push({id:H.sessionId,source:"pi",path:$,timestamp:H.timestamp,preview:H.preview,cwd:H.cwd,repoId:null,stats:null})}catch{}}}catch{}}}catch{}return b.sort((G,J)=>J.timestamp.getTime()-G.timestamp.getTime()).slice(0,z)}async function VX(_){let z=_?.sources??["claude-code","codex","opencode","pi"],A=_?.limit??Mz,b=_?.cwd?qX(_.cwd):null,G=A*3,J=await Promise.all([z.includes("claude-code")?zR({limit:G}):[],z.includes("codex")?AR({limit:G}):[],z.includes("opencode")?bR({limit:G}):[],z.includes("pi")?JR({limit:G}):[]]),Y=[];for(let X of J)Y.push(...X);if(Y=Y.filter((X)=>X.preview&&X.preview.trim().length>0),b)Y=Y.filter((X)=>{if(!X.cwd)return!1;let Q=qX(X.cwd);return Q.startsWith(b)||b.startsWith(Q)});return Y.sort((X,Q)=>Q.timestamp.getTime()-X.timestamp.getTime()).slice(0,A)}async function S5(_){try{return(await m9.stat(_)).isDirectory()}catch{return!1}}function Q6(_){let z=_.replace(/\s+/g," ").trim();if(z.length<=WX)return z;return z.slice(0,WX-1)+"…"}var $1=51200,H1=20480;async function YR(_){let z=await m9.open(_,"r");try{let b=(await z.stat()).size,G=null,J=null,Y=null,X=Buffer.alloc(Math.min($1,b));await z.read(X,0,X.length,0);let Q=X.toString("utf8");for(let $ of Q.split(/\r?\n/)){if(!$.trim())continue;if(!$.endsWith("}"))break;try{let H=JSON.parse($);if(!G&&typeof H.cwd==="string")G=H.cwd;if(typeof H.timestamp==="string"){let B=new Date(H.timestamp);if(!Number.isNaN(B.getTime())){if(!Y||B>Y)Y=B}}if(H.isSidechain||H.isMeta)continue;if(!J&&H.type==="user"){let Z=H.message?.content;if(H.toolUseResult||H.tool_use_result)continue;let F=XR(Z);if(F){let K=QR(F);if(K)J=Q6(K)}}if(G&&J)break}catch{continue}}if(b>$1){let $=Math.max(0,b-H1),H=Buffer.alloc(Math.min(H1,b-$));await z.read(H,0,H.length,$);let Z=H.toString("utf8").split(/\r?\n/);if($>0&&Z.length>0)Z.shift();for(let F of Z){if(!F.trim())continue;try{let K=JSON.parse(F);if(typeof K.timestamp==="string"){let q=new Date(K.timestamp);if(!Number.isNaN(q.getTime())){if(!Y||q>Y)Y=q}}}catch{continue}}}return{timestamp:Y??new Date(0),cwd:G,preview:J,stats:null}}finally{await z.close()}}function XR(_){if(typeof _==="string")return _;if(Array.isArray(_))for(let z of _){if(typeof z==="string")return z;if(z&&typeof z==="object"){let A=z;if(A.type==="tool_result")continue;if(A.type==="text"&&typeof A.text==="string")return A.text}}return null}function QR(_){let z=_.replace(aj,""),A=[];for(let b of z.split(/\r?\n/)){let G=b.trim();if(!G)continue;let J=G.toLowerCase();if(nj.has(J))continue;if(ij.test(G))continue;if(oj.test(G))continue;if(sj.some((Y)=>J.startsWith(Y))){if(!G.includes("?")&&!$R(J))continue}if(!/[a-z]/i.test(G)&&!/\d/.test(G))continue;A.push(G)}if(A.length===0)return null;return A.slice(0,3).join(" ").replace(/\s+/g," ").trim()||null}function $R(_){return["can you","could you","please","help","how do","what is","why","fix","add","create","update"].some((A)=>_.includes(A))}async function HR(_){let z=[];async function A(b,G){if(G>4)return;try{let J=await m9.readdir(b,{withFileTypes:!0});for(let Y of J){let X=X4(b,Y.name);if(Y.isDirectory())await A(X,G+1);else if(Y.isFile()&&Y.name.endsWith(".jsonl")){let Q=await m9.stat(X);z.push({path:X,mtime:Q.mtime})}}}catch{}}return await A(_,0),z.sort((b,G)=>G.mtime.getTime()-b.mtime.getTime()),z.map((b)=>b.path)}async function BR(_){let z=await m9.open(_,"r");try{let b=(await z.stat()).size,G=null,J=null,Y=null,X=null,Q=Buffer.alloc(Math.min($1,b));await z.read(Q,0,Q.length,0);let $=Q.toString("utf8");for(let H of $.split(/\r?\n/)){if(!H.trim())continue;if(!H.endsWith("}"))break;try{let B=JSON.parse(H),Z=B.timestamp,F=B.type,K=B.payload;if(Z){let q=new Date(Z);if(!Number.isNaN(q.getTime())){if(!J||q>J)J=q}}if(!K)continue;if(F==="session_meta")G=K.id??null,Y=K.cwd??null;if(F==="event_msg"&&K.type==="user_message"&&!X){let q=K.message;if(q)X=Q6(q)}if(G&&Y&&X)break}catch{continue}}if(b>$1){let H=Math.max(0,b-H1),B=Buffer.alloc(Math.min(H1,b-H));await z.read(B,0,B.length,H);let F=B.toString("utf8").split(/\r?\n/);if(H>0&&F.length>0)F.shift();for(let K of F){if(!K.trim())continue;try{let W=JSON.parse(K).timestamp;if(W){let V=new Date(W);if(!Number.isNaN(V.getTime())){if(!J||V>J)J=V}}}catch{continue}}}if(!G)return null;return{sessionId:G,timestamp:J??new Date(0),cwd:Y,preview:X,stats:null}}finally{await z.close()}}async function ZR(_){let z=await m9.open(_,"r");try{let b=(await z.stat()).size,G=null,J=null,Y=null,X=null,Q=null,$=Buffer.alloc(Math.min($1,b));await z.read($,0,$.length,0);let B=$.toString("utf8").split(/\r?\n/);for(let Z=0;Z<B.length;Z++){let F=B[Z];if(!F.trim())continue;if(!F.endsWith("}"))break;try{let K=JSON.parse(F);if(Z===0&&K.id&&K.timestamp){G=K.id,Y=K.cwd??null,J=new Date(K.timestamp),Q=J;continue}if(K.timestamp){let q=new Date(K.timestamp);if(!Number.isNaN(q.getTime())){if(!Q||q>Q)Q=q}}if(!X&&K.type==="message"){let q=K.message;if(q?.role==="user"){let W=q.content;if(Array.isArray(W)){for(let V of W)if(V&&typeof V==="object"&&V.type==="text"){let w=V.text;if(w){X=Q6(w);break}}}}}if(G&&Y&&X)break}catch{continue}}if(b>$1){let Z=Math.max(0,b-H1),F=Buffer.alloc(Math.min(H1,b-Z));await z.read(F,0,F.length,Z);let q=F.toString("utf8").split(/\r?\n/);if(Z>0&&q.length>0)q.shift();for(let W of q){if(!W.trim())continue;try{let V=JSON.parse(W);if(V.timestamp){let w=new Date(V.timestamp);if(!Number.isNaN(w.getTime())){if(!Q||w>Q)Q=w}}}catch{continue}}}if(!G)return null;return{sessionId:G,timestamp:Q??J??new Date(0),cwd:Y,preview:X}}finally{await z.close()}}function DX(_){return _===161||_===164||_===167||_===168||_===170||_===173||_===174||_>=176&&_<=180||_>=182&&_<=186||_>=188&&_<=191||_===198||_===208||_===215||_===216||_>=222&&_<=225||_===230||_>=232&&_<=234||_===236||_===237||_===240||_===242||_===243||_>=247&&_<=250||_===252||_===254||_===257||_===273||_===275||_===283||_===294||_===295||_===299||_>=305&&_<=307||_===312||_>=319&&_<=322||_===324||_>=328&&_<=331||_===333||_===338||_===339||_===358||_===359||_===363||_===462||_===464||_===466||_===468||_===470||_===472||_===474||_===476||_===593||_===609||_===708||_===711||_>=713&&_<=715||_===717||_===720||_>=728&&_<=731||_===733||_===735||_>=768&&_<=879||_>=913&&_<=929||_>=931&&_<=937||_>=945&&_<=961||_>=963&&_<=969||_===1025||_>=1040&&_<=1103||_===1105||_===8208||_>=8211&&_<=8214||_===8216||_===8217||_===8220||_===8221||_>=8224&&_<=8226||_>=8228&&_<=8231||_===8240||_===8242||_===8243||_===8245||_===8251||_===8254||_===8308||_===8319||_>=8321&&_<=8324||_===8364||_===8451||_===8453||_===8457||_===8467||_===8470||_===8481||_===8482||_===8486||_===8491||_===8531||_===8532||_>=8539&&_<=8542||_>=8544&&_<=8555||_>=8560&&_<=8569||_===8585||_>=8592&&_<=8601||_===8632||_===8633||_===8658||_===8660||_===8679||_===8704||_===8706||_===8707||_===8711||_===8712||_===8715||_===8719||_===8721||_===8725||_===8730||_>=8733&&_<=8736||_===8739||_===8741||_>=8743&&_<=8748||_===8750||_>=8756&&_<=8759||_===8764||_===8765||_===8776||_===8780||_===8786||_===8800||_===8801||_>=8804&&_<=8807||_===8810||_===8811||_===8814||_===8815||_===8834||_===8835||_===8838||_===8839||_===8853||_===8857||_===8869||_===8895||_===8978||_>=9312&&_<=9449||_>=9451&&_<=9547||_>=9552&&_<=9587||_>=9600&&_<=9615||_>=9618&&_<=9621||_===9632||_===9633||_>=9635&&_<=9641||_===9650||_===9651||_===9654||_===9655||_===9660||_===9661||_===9664||_===9665||_>=9670&&_<=9672||_===9675||_>=9678&&_<=9681||_>=9698&&_<=9701||_===9711||_===9733||_===9734||_===9737||_===9742||_===9743||_===9756||_===9758||_===9792||_===9794||_===9824||_===9825||_>=9827&&_<=9829||_>=9831&&_<=9834||_===9836||_===9837||_===9839||_===9886||_===9887||_===9919||_>=9926&&_<=9933||_>=9935&&_<=9939||_>=9941&&_<=9953||_===9955||_===9960||_===9961||_>=9963&&_<=9969||_===9972||_>=9974&&_<=9977||_===9979||_===9980||_===9982||_===9983||_===10045||_>=10102&&_<=10111||_>=11094&&_<=11097||_>=12872&&_<=12879||_>=57344&&_<=63743||_>=65024&&_<=65039||_===65533||_>=127232&&_<=127242||_>=127248&&_<=127277||_>=127280&&_<=127337||_>=127344&&_<=127373||_===127375||_===127376||_>=127387&&_<=127404||_>=917760&&_<=917999||_>=983040&&_<=1048573||_>=1048576&&_<=1114109}function MX(_){return _===12288||_>=65281&&_<=65376||_>=65504&&_<=65510}function NX(_){return _>=4352&&_<=4447||_===8986||_===8987||_===9001||_===9002||_>=9193&&_<=9196||_===9200||_===9203||_===9725||_===9726||_===9748||_===9749||_>=9776&&_<=9783||_>=9800&&_<=9811||_===9855||_>=9866&&_<=9871||_===9875||_===9889||_===9898||_===9899||_===9917||_===9918||_===9924||_===9925||_===9934||_===9940||_===9962||_===9970||_===9971||_===9973||_===9978||_===9981||_===9989||_===9994||_===9995||_===10024||_===10060||_===10062||_>=10067&&_<=10069||_===10071||_>=10133&&_<=10135||_===10160||_===10175||_===11035||_===11036||_===11088||_===11093||_>=11904&&_<=11929||_>=11931&&_<=12019||_>=12032&&_<=12245||_>=12272&&_<=12287||_>=12289&&_<=12350||_>=12353&&_<=12438||_>=12441&&_<=12543||_>=12549&&_<=12591||_>=12593&&_<=12686||_>=12688&&_<=12773||_>=12783&&_<=12830||_>=12832&&_<=12871||_>=12880&&_<=42124||_>=42128&&_<=42182||_>=43360&&_<=43388||_>=44032&&_<=55203||_>=63744&&_<=64255||_>=65040&&_<=65049||_>=65072&&_<=65106||_>=65108&&_<=65126||_>=65128&&_<=65131||_>=94176&&_<=94180||_>=94192&&_<=94198||_>=94208&&_<=101589||_>=101631&&_<=101662||_>=101760&&_<=101874||_>=110576&&_<=110579||_>=110581&&_<=110587||_===110589||_===110590||_>=110592&&_<=110882||_===110898||_>=110928&&_<=110930||_===110933||_>=110948&&_<=110951||_>=110960&&_<=111355||_>=119552&&_<=119638||_>=119648&&_<=119670||_===126980||_===127183||_===127374||_>=127377&&_<=127386||_>=127488&&_<=127490||_>=127504&&_<=127547||_>=127552&&_<=127560||_===127568||_===127569||_>=127584&&_<=127589||_>=127744&&_<=127776||_>=127789&&_<=127797||_>=127799&&_<=127868||_>=127870&&_<=127891||_>=127904&&_<=127946||_>=127951&&_<=127955||_>=127968&&_<=127984||_===127988||_>=127992&&_<=128062||_===128064||_>=128066&&_<=128252||_>=128255&&_<=128317||_>=128331&&_<=128334||_>=128336&&_<=128359||_===128378||_===128405||_===128406||_===128420||_>=128507&&_<=128591||_>=128640&&_<=128709||_===128716||_>=128720&&_<=128722||_>=128725&&_<=128728||_>=128732&&_<=128735||_===128747||_===128748||_>=128756&&_<=128764||_>=128992&&_<=129003||_===129008||_>=129292&&_<=129338||_>=129340&&_<=129349||_>=129351&&_<=129535||_>=129648&&_<=129660||_>=129664&&_<=129674||_>=129678&&_<=129734||_===129736||_>=129741&&_<=129756||_>=129759&&_<=129770||_>=129775&&_<=129784||_>=131072&&_<=196605||_>=196608&&_<=262141}function FR(_){if(!Number.isSafeInteger(_))throw TypeError(`Expected a code point, got \`${typeof _}\`.`)}function k5(_,{ambiguousAsWide:z=!1}={}){if(FR(_),MX(_)||NX(_)||z&&DX(_))return 2;return 1}var B1=new Intl.Segmenter(void 0,{granularity:"grapheme"});function $6(){return B1}function KR(_){let z=_.codePointAt(0);return z>=126976&&z<=130047||z>=8960&&z<=9215||z>=9728&&z<=10175||z>=11088&&z<=11093||_.includes("️")||_.length>2}var qR=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Mark}|\p{Surrogate})+$/v,WR=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,VR=/^\p{RGI_Emoji}$/v,UR=512,Nz=new Map;function x5(_){if(qR.test(_))return 0;if(KR(_)&&VR.test(_))return 2;let A=_.replace(WR,"").codePointAt(0);if(A===void 0)return 0;let b=k5(A);if(_.length>1)for(let G of _.slice(1)){let J=G.codePointAt(0);if(J>=65280&&J<=65519)b+=k5(J)}return b}function W0(_){if(_.length===0)return 0;let z=!0;for(let J=0;J<_.length;J++){let Y=_.charCodeAt(J);if(Y<32||Y>126){z=!1;break}}if(z)return _.length;let A=Nz.get(_);if(A!==void 0)return A;let b=_;if(_.includes("\t"))b=b.replace(/\t/g," ");if(b.includes("\x1B"))b=b.replace(/\x1b\[[0-9;]*[mGKHJ]/g,""),b=b.replace(/\x1b\]8;;[^\x07]*\x07/g,""),b=b.replace(/\x1b_[^\x07\x1b]*(?:\x07|\x1b\\)/g,"");let G=0;for(let{segment:J}of B1.segment(b))G+=x5(J);if(Nz.size>=UR){let J=Nz.keys().next().value;if(J!==void 0)Nz.delete(J)}return Nz.set(_,G),G}function Q4(_,z){if(z>=_.length||_[z]!=="\x1B")return null;let A=_[z+1];if(A==="["){let b=z+2;while(b<_.length&&!/[mGKHJ]/.test(_[b]))b++;if(b<_.length)return{code:_.substring(z,b+1),length:b+1-z};return null}if(A==="]"){let b=z+2;while(b<_.length){if(_[b]==="\x07")return{code:_.substring(z,b+1),length:b+1-z};if(_[b]==="\x1B"&&_[b+1]==="\\")return{code:_.substring(z,b+2),length:b+2-z};b++}return null}if(A==="_"){let b=z+2;while(b<_.length){if(_[b]==="\x07")return{code:_.substring(z,b+1),length:b+1-z};if(_[b]==="\x1B"&&_[b+1]==="\\")return{code:_.substring(z,b+2),length:b+2-z};b++}return null}return null}class H6{bold=!1;dim=!1;italic=!1;underline=!1;blink=!1;inverse=!1;hidden=!1;strikethrough=!1;fgColor=null;bgColor=null;process(_){if(!_.endsWith("m"))return;let z=_.match(/\x1b\[([\d;]*)m/);if(!z)return;let A=z[1];if(A===""||A==="0"){this.reset();return}let b=A.split(";"),G=0;while(G<b.length){let J=Number.parseInt(b[G],10);if(J===38||J===48){if(b[G+1]==="5"&&b[G+2]!==void 0){let Y=`${b[G]};${b[G+1]};${b[G+2]}`;if(J===38)this.fgColor=Y;else this.bgColor=Y;G+=3;continue}else if(b[G+1]==="2"&&b[G+4]!==void 0){let Y=`${b[G]};${b[G+1]};${b[G+2]};${b[G+3]};${b[G+4]}`;if(J===38)this.fgColor=Y;else this.bgColor=Y;G+=5;continue}}switch(J){case 0:this.reset();break;case 1:this.bold=!0;break;case 2:this.dim=!0;break;case 3:this.italic=!0;break;case 4:this.underline=!0;break;case 5:this.blink=!0;break;case 7:this.inverse=!0;break;case 8:this.hidden=!0;break;case 9:this.strikethrough=!0;break;case 21:this.bold=!1;break;case 22:this.bold=!1,this.dim=!1;break;case 23:this.italic=!1;break;case 24:this.underline=!1;break;case 25:this.blink=!1;break;case 27:this.inverse=!1;break;case 28:this.hidden=!1;break;case 29:this.strikethrough=!1;break;case 39:this.fgColor=null;break;case 49:this.bgColor=null;break;default:if(J>=30&&J<=37||J>=90&&J<=97)this.fgColor=String(J);else if(J>=40&&J<=47||J>=100&&J<=107)this.bgColor=String(J);break}G++}}reset(){this.bold=!1,this.dim=!1,this.italic=!1,this.underline=!1,this.blink=!1,this.inverse=!1,this.hidden=!1,this.strikethrough=!1,this.fgColor=null,this.bgColor=null}clear(){this.reset()}getActiveCodes(){let _=[];if(this.bold)_.push("1");if(this.dim)_.push("2");if(this.italic)_.push("3");if(this.underline)_.push("4");if(this.blink)_.push("5");if(this.inverse)_.push("7");if(this.hidden)_.push("8");if(this.strikethrough)_.push("9");if(this.fgColor)_.push(this.fgColor);if(this.bgColor)_.push(this.bgColor);if(_.length===0)return"";return`\x1B[${_.join(";")}m`}hasActiveCodes(){return this.bold||this.dim||this.italic||this.underline||this.blink||this.inverse||this.hidden||this.strikethrough||this.fgColor!==null||this.bgColor!==null}getLineEndReset(){if(this.underline)return"\x1B[24m";return""}}function wX(_,z){let A=0;while(A<_.length){let b=Q4(_,A);if(b)z.process(b.code),A+=b.length;else A++}}function DR(_){let z=[],A="",b="",G=!1,J=0;while(J<_.length){let Y=Q4(_,J);if(Y){b+=Y.code,J+=Y.length;continue}let X=_[J],Q=X===" ";if(Q!==G&&A)z.push(A),A="";if(b)A+=b,b="";G=Q,A+=X,J++}if(b)A+=b;if(A)z.push(A);return z}function wz(_,z){if(!_)return[""];let A=_.split(`
84
- `),b=[],G=new H6;for(let J of A){let Y=b.length>0?G.getActiveCodes():"";b.push(...MR(Y+J,z)),wX(J,G)}return b.length>0?b:[""]}function MR(_,z){if(!_)return[""];if(W0(_)<=z)return[_];let b=[],G=new H6,J=DR(_),Y="",X=0;for(let Q of J){let $=W0(Q),H=Q.trim()==="";if($>z&&!H){if(Y){let F=G.getLineEndReset();if(F)Y+=F;b.push(Y),Y="",X=0}let Z=NR(Q,z,G);b.push(...Z.slice(0,-1)),Y=Z[Z.length-1],X=W0(Y);continue}if(X+$>z&&X>0){let Z=Y.trimEnd(),F=G.getLineEndReset();if(F)Z+=F;if(b.push(Z),H)Y=G.getActiveCodes(),X=0;else Y=G.getActiveCodes()+Q,X=$}else Y+=Q,X+=$;wX(Q,G)}if(Y)b.push(Y);return b.length>0?b.map((Q)=>Q.trimEnd()):[""]}function NR(_,z,A){let b=[],G=A.getActiveCodes(),J=0,Y=0,X=[];while(Y<_.length){let Q=Q4(_,Y);if(Q)X.push({type:"ansi",value:Q.code}),Y+=Q.length;else{let $=Y;while($<_.length){if(Q4(_,$))break;$++}let H=_.slice(Y,$);for(let B of B1.segment(H))X.push({type:"grapheme",value:B.segment});Y=$}}for(let Q of X){if(Q.type==="ansi"){G+=Q.value,A.process(Q.value);continue}let $=Q.value;if(!$)continue;let H=W0($);if(J+H>z){let B=A.getLineEndReset();if(B)G+=B;b.push(G),G=A.getActiveCodes(),J=0}G+=$,J+=H}if(G)b.push(G);return b.length>0?b:[""]}function Ez(_,z,A){let b=W0(_),G=Math.max(0,z-b),J=" ".repeat(G),Y=_+J;return A(Y)}function n0(_,z,A="...",b=!1){let G=W0(_);if(G<=z)return b?_+" ".repeat(z-G):_;let J=W0(A),Y=z-J;if(Y<=0)return A.substring(0,z);let X=0,Q=[];while(X<_.length){let Z=Q4(_,X);if(Z)Q.push({type:"ansi",value:Z.code}),X+=Z.length;else{let F=X;while(F<_.length){if(Q4(_,F))break;F++}let K=_.slice(X,F);for(let q of B1.segment(K))Q.push({type:"grapheme",value:q.segment});X=F}}let $="",H=0;for(let Z of Q){if(Z.type==="ansi"){$+=Z.value;continue}let F=Z.value;if(!F)continue;let K=W0(F);if(H+K>Y)break;$+=F,H+=K}let B=`${$}\x1B[0m${A}`;if(b){let Z=W0(B);return B+" ".repeat(Math.max(0,z-Z))}return B}function B6(_,z,A,b=!1){return T5(_,z,A,b).text}function T5(_,z,A,b=!1){if(A<=0)return{text:"",width:0};let G=z+A,J="",Y=0,X=0,Q=0,$="";while(Q<_.length){let H=Q4(_,Q);if(H){if(X>=z&&X<G)J+=H.code;else if(X<z)$+=H.code;Q+=H.length;continue}let B=Q;while(B<_.length&&!Q4(_,B))B++;for(let{segment:Z}of B1.segment(_.slice(Q,B))){let F=x5(Z),K=X>=z&&X<G,q=!b||X+F<=G;if(K&&q){if($)J+=$,$="";J+=Z,Y+=F}if(X+=F,X>=G)break}if(Q=B,X>=G)break}return{text:J,width:Y}}var I5=new H6;function EX(_,z,A,b,G=!1){let J="",Y=0,X="",Q=0,$=0,H=0,B="",Z=!1,F=A+b;I5.clear();while(H<_.length){let K=Q4(_,H);if(K){if(I5.process(K.code),$<z)B+=K.code;else if($>=A&&$<F&&Z)X+=K.code;H+=K.length;continue}let q=H;while(q<_.length&&!Q4(_,q))q++;for(let{segment:W}of B1.segment(_.slice(H,q))){let V=x5(W);if($<z){if(B)J+=B,B="";J+=W,Y+=V}else if($>=A&&$<F){if(!G||$+V<=F){if(!Z)X+=I5.getActiveCodes(),Z=!0;X+=W,Q+=V}}if($+=V,b<=0?$>=z:$>=F)break}if(H=q,b<=0?$>=z:$>=F)break}return{before:J,beforeWidth:Y,after:X,afterWidth:Q}}var O4=!1;function K6(_){O4=_}var wR=new Set(["`","-","=","[","]","\\",";","'",",",".","/","!","@","#","$","%","^","&","*","(",")","_","+","|","~","{","}",":","<",">","?"]),D0={shift:1,alt:2,ctrl:4},OX=192,C0={escape:27,tab:9,enter:13,space:32,backspace:127,kpEnter:57414},X9={up:-1,down:-2,right:-3,left:-4},T0={delete:-10,insert:-11,pageUp:-12,pageDown:-13,home:-14,end:-15},N9={up:["\x1B[A","\x1BOA"],down:["\x1B[B","\x1BOB"],right:["\x1B[C","\x1BOC"],left:["\x1B[D","\x1BOD"],home:["\x1B[H","\x1BOH","\x1B[1~","\x1B[7~"],end:["\x1B[F","\x1BOF","\x1B[4~","\x1B[8~"],insert:["\x1B[2~"],delete:["\x1B[3~"],pageUp:["\x1B[5~","\x1B[[5~"],pageDown:["\x1B[6~","\x1B[[6~"],clear:["\x1B[E","\x1BOE"],f1:["\x1BOP","\x1B[11~","\x1B[[A"],f2:["\x1BOQ","\x1B[12~","\x1B[[B"],f3:["\x1BOR","\x1B[13~","\x1B[[C"],f4:["\x1BOS","\x1B[14~","\x1B[[D"],f5:["\x1B[15~","\x1B[[E"],f6:["\x1B[17~"],f7:["\x1B[18~"],f8:["\x1B[19~"],f9:["\x1B[20~"],f10:["\x1B[21~"],f11:["\x1B[23~"],f12:["\x1B[24~"]},ER={up:["\x1B[a"],down:["\x1B[b"],right:["\x1B[c"],left:["\x1B[d"],clear:["\x1B[e"],insert:["\x1B[2$"],delete:["\x1B[3$"],pageUp:["\x1B[5$"],pageDown:["\x1B[6$"],home:["\x1B[7$"],end:["\x1B[8$"]},OR={up:["\x1BOa"],down:["\x1BOb"],right:["\x1BOc"],left:["\x1BOd"],clear:["\x1BOe"],insert:["\x1B[2^"],delete:["\x1B[3^"],pageUp:["\x1B[5^"],pageDown:["\x1B[6^"],home:["\x1B[7^"],end:["\x1B[8^"]};var Q9=(_,z)=>z.includes(_),W9=(_,z,A)=>{if(A===D0.shift)return Q9(_,ER[z]);if(A===D0.ctrl)return Q9(_,OR[z]);return!1},Z6="press";function C5(_){if(_.includes("\x1B[200~"))return!1;if(_.includes(":3u")||_.includes(":3~")||_.includes(":3A")||_.includes(":3B")||_.includes(":3C")||_.includes(":3D")||_.includes(":3H")||_.includes(":3F"))return!0;return!1}function F6(_){if(!_)return"press";let z=parseInt(_,10);if(z===2)return"repeat";if(z===3)return"release";return"press"}function LR(_){let z=_.match(/^\x1b\[(\d+)(?::(\d*))?(?::(\d+))?(?:;(\d+))?(?::(\d+))?u$/);if(z){let J=parseInt(z[1],10),Y=z[2]&&z[2].length>0?parseInt(z[2],10):void 0,X=z[3]?parseInt(z[3],10):void 0,Q=z[4]?parseInt(z[4],10):1,$=F6(z[5]);return Z6=$,{codepoint:J,shiftedKey:Y,baseLayoutKey:X,modifier:Q-1,eventType:$}}let A=_.match(/^\x1b\[1;(\d+)(?::(\d+))?([ABCD])$/);if(A){let J=parseInt(A[1],10),Y=F6(A[2]),X={A:-1,B:-2,C:-3,D:-4};return Z6=Y,{codepoint:X[A[3]],modifier:J-1,eventType:Y}}let b=_.match(/^\x1b\[(\d+)(?:;(\d+))?(?::(\d+))?~$/);if(b){let J=parseInt(b[1],10),Y=b[2]?parseInt(b[2],10):1,X=F6(b[3]),$={2:T0.insert,3:T0.delete,5:T0.pageUp,6:T0.pageDown,7:T0.home,8:T0.end}[J];if($!==void 0)return Z6=X,{codepoint:$,modifier:Y-1,eventType:X}}let G=_.match(/^\x1b\[1;(\d+)(?::(\d+))?([HF])$/);if(G){let J=parseInt(G[1],10),Y=F6(G[2]),X=G[3]==="H"?T0.home:T0.end;return Z6=Y,{codepoint:X,modifier:J-1,eventType:Y}}return null}function r(_,z,A){let b=LR(_);if(!b)return!1;let G=b.modifier&~OX,J=A&~OX;if(G!==J)return!1;if(b.codepoint===z)return!0;if(b.baseLayoutKey!==void 0&&b.baseLayoutKey===z)return!0;return!1}function LX(_,z,A){let b=_.match(/^\x1b\[27;(\d+);(\d+)~$/);if(!b)return!1;let G=parseInt(b[1],10),J=parseInt(b[2],10),Y=G-1;return J===z&&Y===A}function jR(_){let z=_.toLowerCase(),A=z.charCodeAt(0);if(A>=97&&A<=122||z==="["||z==="\\"||z==="]"||z==="_")return String.fromCharCode(A&31);if(z==="-")return String.fromCharCode(31);return null}function RR(_){let z=_.toLowerCase().split("+"),A=z[z.length-1];if(!A)return null;return{key:A,ctrl:z.includes("ctrl"),shift:z.includes("shift"),alt:z.includes("alt")}}function Z1(_,z){let A=RR(z);if(!A)return!1;let{key:b,ctrl:G,shift:J,alt:Y}=A,X=0;if(J)X|=D0.shift;if(Y)X|=D0.alt;if(G)X|=D0.ctrl;switch(b){case"escape":case"esc":if(X!==0)return!1;return _==="\x1B"||r(_,C0.escape,0);case"space":if(!O4){if(G&&!Y&&!J&&_==="\x00")return!0;if(Y&&!G&&!J&&_==="\x1B ")return!0}if(X===0)return _===" "||r(_,C0.space,0);return r(_,C0.space,X);case"tab":if(J&&!G&&!Y)return _==="\x1B[Z"||r(_,C0.tab,D0.shift);if(X===0)return _==="\t"||r(_,C0.tab,0);return r(_,C0.tab,X);case"enter":case"return":if(J&&!G&&!Y){if(r(_,C0.enter,D0.shift)||r(_,C0.kpEnter,D0.shift))return!0;if(LX(_,C0.enter,D0.shift))return!0;if(O4)return _==="\x1B\r"||_===`
85
- `;return!1}if(Y&&!G&&!J){if(r(_,C0.enter,D0.alt)||r(_,C0.kpEnter,D0.alt))return!0;if(LX(_,C0.enter,D0.alt))return!0;if(!O4)return _==="\x1B\r";return!1}if(X===0)return _==="\r"||!O4&&_===`
86
- `||_==="\x1BOM"||r(_,C0.enter,0)||r(_,C0.kpEnter,0);return r(_,C0.enter,X)||r(_,C0.kpEnter,X);case"backspace":if(Y&&!G&&!J){if(_==="\x1B"||_==="\x1B\b")return!0;return r(_,C0.backspace,D0.alt)}if(X===0)return _===""||_==="\b"||r(_,C0.backspace,0);return r(_,C0.backspace,X);case"insert":if(X===0)return Q9(_,N9.insert)||r(_,T0.insert,0);if(W9(_,"insert",X))return!0;return r(_,T0.insert,X);case"delete":if(X===0)return Q9(_,N9.delete)||r(_,T0.delete,0);if(W9(_,"delete",X))return!0;return r(_,T0.delete,X);case"clear":if(X===0)return Q9(_,N9.clear);return W9(_,"clear",X);case"home":if(X===0)return Q9(_,N9.home)||r(_,T0.home,0);if(W9(_,"home",X))return!0;return r(_,T0.home,X);case"end":if(X===0)return Q9(_,N9.end)||r(_,T0.end,0);if(W9(_,"end",X))return!0;return r(_,T0.end,X);case"pageup":if(X===0)return Q9(_,N9.pageUp)||r(_,T0.pageUp,0);if(W9(_,"pageUp",X))return!0;return r(_,T0.pageUp,X);case"pagedown":if(X===0)return Q9(_,N9.pageDown)||r(_,T0.pageDown,0);if(W9(_,"pageDown",X))return!0;return r(_,T0.pageDown,X);case"up":if(Y&&!G&&!J)return _==="\x1Bp"||r(_,X9.up,D0.alt);if(X===0)return Q9(_,N9.up)||r(_,X9.up,0);if(W9(_,"up",X))return!0;return r(_,X9.up,X);case"down":if(Y&&!G&&!J)return _==="\x1Bn"||r(_,X9.down,D0.alt);if(X===0)return Q9(_,N9.down)||r(_,X9.down,0);if(W9(_,"down",X))return!0;return r(_,X9.down,X);case"left":if(Y&&!G&&!J)return _==="\x1B[1;3D"||!O4&&_==="\x1BB"||_==="\x1Bb"||r(_,X9.left,D0.alt);if(G&&!Y&&!J)return _==="\x1B[1;5D"||W9(_,"left",D0.ctrl)||r(_,X9.left,D0.ctrl);if(X===0)return Q9(_,N9.left)||r(_,X9.left,0);if(W9(_,"left",X))return!0;return r(_,X9.left,X);case"right":if(Y&&!G&&!J)return _==="\x1B[1;3C"||!O4&&_==="\x1BF"||_==="\x1Bf"||r(_,X9.right,D0.alt);if(G&&!Y&&!J)return _==="\x1B[1;5C"||W9(_,"right",D0.ctrl)||r(_,X9.right,D0.ctrl);if(X===0)return Q9(_,N9.right)||r(_,X9.right,0);if(W9(_,"right",X))return!0;return r(_,X9.right,X);case"f1":case"f2":case"f3":case"f4":case"f5":case"f6":case"f7":case"f8":case"f9":case"f10":case"f11":case"f12":{if(X!==0)return!1;return Q9(_,N9[b])}}if(b.length===1&&(b>="a"&&b<="z"||wR.has(b))){let Q=b.charCodeAt(0),$=jR(b);if(G&&Y&&!J&&!O4&&$)return _===`\x1B${$}`;if(Y&&!G&&!J&&!O4&&b>="a"&&b<="z"){if(_===`\x1B${b}`)return!0}if(G&&!J&&!Y){if($&&_===$)return!0;return r(_,Q,D0.ctrl)}if(G&&J&&!Y)return r(_,Q,D0.shift+D0.ctrl);if(J&&!G&&!Y){if(_===b.toUpperCase())return!0;return r(_,Q,D0.shift)}if(X!==0)return r(_,Q,X);return _===b||r(_,Q,0)}return!1}var jX={cursorUp:"up",cursorDown:"down",cursorLeft:["left","ctrl+b"],cursorRight:["right","ctrl+f"],cursorWordLeft:["alt+left","ctrl+left","alt+b"],cursorWordRight:["alt+right","ctrl+right","alt+f"],cursorLineStart:["home","ctrl+a"],cursorLineEnd:["end","ctrl+e"],jumpForward:"ctrl+]",jumpBackward:"ctrl+alt+]",pageUp:"pageUp",pageDown:"pageDown",deleteCharBackward:"backspace",deleteCharForward:["delete","ctrl+d"],deleteWordBackward:["ctrl+w","alt+backspace"],deleteWordForward:["alt+d","alt+delete"],deleteToLineStart:"ctrl+u",deleteToLineEnd:"ctrl+k",newLine:"shift+enter",submit:"enter",tab:"tab",selectUp:"up",selectDown:"down",selectPageUp:"pageUp",selectPageDown:"pageDown",selectConfirm:"enter",selectCancel:["escape","ctrl+c"],copy:"ctrl+c",yank:"ctrl+y",yankPop:"alt+y",undo:"ctrl+-",expandTools:"ctrl+o",toggleSessionPath:"ctrl+p",toggleSessionSort:"ctrl+s",renameSession:"ctrl+r",deleteSession:"ctrl+d",deleteSessionNoninvasive:"ctrl+backspace"};class y5{actionToKeys;constructor(_={}){this.actionToKeys=new Map,this.buildMaps(_)}buildMaps(_){this.actionToKeys.clear();for(let[z,A]of Object.entries(jX)){let b=Array.isArray(A)?A:[A];this.actionToKeys.set(z,[...b])}for(let[z,A]of Object.entries(_)){if(A===void 0)continue;let b=Array.isArray(A)?A:[A];this.actionToKeys.set(z,b)}}matches(_,z){let A=this.actionToKeys.get(z);if(!A)return!1;for(let b of A)if(Z1(_,b))return!0;return!1}getKeys(_){return this.actionToKeys.get(_)??[]}setConfig(_){this.buildMaps(_)}}var v5=null;function s4(){if(!v5)v5=new y5;return v5}class F1{text;paddingX;paddingY;customBgFn;cachedText;cachedWidth;cachedLines;constructor(_="",z=1,A=1,b){this.text=_,this.paddingX=z,this.paddingY=A,this.customBgFn=b}setText(_){this.text=_,this.cachedText=void 0,this.cachedWidth=void 0,this.cachedLines=void 0}setCustomBgFn(_){this.customBgFn=_,this.cachedText=void 0,this.cachedWidth=void 0,this.cachedLines=void 0}invalidate(){this.cachedText=void 0,this.cachedWidth=void 0,this.cachedLines=void 0}render(_){if(this.cachedLines&&this.cachedText===this.text&&this.cachedWidth===_)return this.cachedLines;if(!this.text||this.text.trim()===""){let H=[];return this.cachedText=this.text,this.cachedWidth=_,this.cachedLines=H,H}let z=this.text.replace(/\t/g," "),A=Math.max(1,_-this.paddingX*2),b=wz(z,A),G=" ".repeat(this.paddingX),J=" ".repeat(this.paddingX),Y=[];for(let H of b){let B=G+H+J;if(this.customBgFn)Y.push(Ez(B,_,this.customBgFn));else{let Z=W0(B),F=Math.max(0,_-Z);Y.push(B+" ".repeat(F))}}let X=" ".repeat(_),Q=[];for(let H=0;H<this.paddingY;H++){let B=this.customBgFn?Ez(X,_,this.customBgFn):X;Q.push(B)}let $=[...Q,...Y,...Q];return this.cachedText=this.text,this.cachedWidth=_,this.cachedLines=$,$.length>0?$:[""]}}class q6 extends F1{spinnerColorFn;messageColorFn;message;frames=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];currentFrame=0;intervalId=null;ui=null;constructor(_,z,A,b="Loading..."){super("",1,0);this.spinnerColorFn=z,this.messageColorFn=A,this.message=b,this.ui=_,this.start()}render(_){return["",...super.render(_)]}start(){this.updateDisplay(),this.intervalId=setInterval(()=>{this.currentFrame=(this.currentFrame+1)%this.frames.length,this.updateDisplay()},80)}stop(){if(this.intervalId)clearInterval(this.intervalId),this.intervalId=null}setMessage(_){this.message=_,this.updateDisplay()}updateDisplay(){let _=this.frames[this.currentFrame];if(this.setText(`${this.spinnerColorFn(_)} ${this.messageColorFn(this.message)}`),this.ui)this.ui.requestRender()}}class RX extends q6{abortController=new AbortController;onAbort;get signal(){return this.abortController.signal}get aborted(){return this.abortController.signal.aborted}handleInput(_){if(s4().matches(_,"selectCancel"))this.abortController.abort(),this.onAbort?.()}dispose(){this.stop()}}import*as K1 from"node:fs";import*as xX from"node:os";import*as Lz from"node:path";var g5=null,PR={widthPx:9,heightPx:18};function f5(_){PR=_}function kX(){let _=process.env.TERM_PROGRAM?.toLowerCase()||"",z=process.env.TERM?.toLowerCase()||"",A=process.env.COLORTERM?.toLowerCase()||"";if(process.env.KITTY_WINDOW_ID||_==="kitty")return{images:"kitty",trueColor:!0,hyperlinks:!0};if(_==="ghostty"||z.includes("ghostty")||process.env.GHOSTTY_RESOURCES_DIR)return{images:"kitty",trueColor:!0,hyperlinks:!0};if(process.env.WEZTERM_PANE||_==="wezterm")return{images:"kitty",trueColor:!0,hyperlinks:!0};if(process.env.ITERM_SESSION_ID||_==="iterm.app")return{images:"iterm2",trueColor:!0,hyperlinks:!0};if(_==="vscode")return{images:null,trueColor:!0,hyperlinks:!0};if(_==="alacritty")return{images:null,trueColor:!0,hyperlinks:!0};return{images:null,trueColor:A==="truecolor"||A==="24bit",hyperlinks:!0}}function W6(){if(!g5)g5=kX();return g5}var PX="\x1B_G",SX="\x1B]1337;File=";function Oz(_){if(_.startsWith(PX)||_.startsWith(SX))return!0;return _.includes(PX)||_.includes(SX)}function h5(_){return _!==null&&"focused"in _}var jz="\x1B_pi:c\x07";function IX(_,z){if(_===void 0)return;if(typeof _==="number")return _;let A=_.match(/^(\d+(?:\.\d+)?)%$/);if(A)return Math.floor(z*parseFloat(A[1])/100);return}class m5{children=[];addChild(_){this.children.push(_)}removeChild(_){let z=this.children.indexOf(_);if(z!==-1)this.children.splice(z,1)}clear(){this.children=[]}invalidate(){for(let _ of this.children)_.invalidate?.()}render(_){let z=[];for(let A of this.children)z.push(...A.render(_));return z}}class q1 extends m5{terminal;previousLines=[];previousWidth=0;previousHeight=0;focusedComponent=null;onDebug;renderRequested=!1;cursorRow=0;hardwareCursorRow=0;inputBuffer="";cellSizeQueryPending=!1;showHardwareCursor=process.env.PI_HARDWARE_CURSOR==="1";maxLinesRendered=0;previousViewportTop=0;fullRedrawCount=0;stopped=!1;overlayStack=[];constructor(_,z){super();if(this.terminal=_,z!==void 0)this.showHardwareCursor=z}get fullRedraws(){return this.fullRedrawCount}getShowHardwareCursor(){return this.showHardwareCursor}setShowHardwareCursor(_){if(this.showHardwareCursor===_)return;if(this.showHardwareCursor=_,!_)this.terminal.hideCursor();this.requestRender()}setFocus(_){if(h5(this.focusedComponent))this.focusedComponent.focused=!1;if(this.focusedComponent=_,h5(_))_.focused=!0}showOverlay(_,z){let A={component:_,options:z,preFocus:this.focusedComponent,hidden:!1};if(this.overlayStack.push(A),this.isOverlayVisible(A))this.setFocus(_);return this.terminal.hideCursor(),this.requestRender(),{hide:()=>{let b=this.overlayStack.indexOf(A);if(b!==-1){if(this.overlayStack.splice(b,1),this.focusedComponent===_){let G=this.getTopmostVisibleOverlay();this.setFocus(G?.component??A.preFocus)}if(this.overlayStack.length===0)this.terminal.hideCursor();this.requestRender()}},setHidden:(b)=>{if(A.hidden===b)return;if(A.hidden=b,b){if(this.focusedComponent===_){let G=this.getTopmostVisibleOverlay();this.setFocus(G?.component??A.preFocus)}}else if(this.isOverlayVisible(A))this.setFocus(_);this.requestRender()},isHidden:()=>A.hidden}}hideOverlay(){let _=this.overlayStack.pop();if(!_)return;let z=this.getTopmostVisibleOverlay();if(this.setFocus(z?.component??_.preFocus),this.overlayStack.length===0)this.terminal.hideCursor();this.requestRender()}hasOverlay(){return this.overlayStack.some((_)=>this.isOverlayVisible(_))}isOverlayVisible(_){if(_.hidden)return!1;if(_.options?.visible)return _.options.visible(this.terminal.columns,this.terminal.rows);return!0}getTopmostVisibleOverlay(){for(let _=this.overlayStack.length-1;_>=0;_--)if(this.isOverlayVisible(this.overlayStack[_]))return this.overlayStack[_];return}invalidate(){super.invalidate();for(let _ of this.overlayStack)_.component.invalidate?.()}start(){this.stopped=!1,this.terminal.start((_)=>this.handleInput(_),()=>this.requestRender()),this.terminal.hideCursor(),this.queryCellSize(),this.requestRender()}queryCellSize(){if(!W6().images)return;this.cellSizeQueryPending=!0,this.terminal.write("\x1B[16t")}stop(){if(this.stopped=!0,this.previousLines.length>0){let z=this.previousLines.length-this.hardwareCursorRow;if(z>0)this.terminal.write(`\x1B[${z}B`);else if(z<0)this.terminal.write(`\x1B[${-z}A`);this.terminal.write(`\r
87
- `)}this.terminal.showCursor(),this.terminal.stop()}requestRender(_=!1){if(_)this.previousLines=[],this.previousWidth=-1,this.previousHeight=-1,this.cursorRow=0,this.hardwareCursorRow=0,this.maxLinesRendered=0,this.previousViewportTop=0;if(this.renderRequested)return;this.renderRequested=!0,process.nextTick(()=>{this.renderRequested=!1,this.doRender()})}handleInput(_){if(this.cellSizeQueryPending){this.inputBuffer+=_;let A=this.parseCellSizeResponse();if(A.length===0)return;_=A}if(Z1(_,"shift+ctrl+d")&&this.onDebug){this.onDebug();return}let z=this.overlayStack.find((A)=>A.component===this.focusedComponent);if(z&&!this.isOverlayVisible(z)){let A=this.getTopmostVisibleOverlay();if(A)this.setFocus(A.component);else this.setFocus(z.preFocus)}if(this.focusedComponent?.handleInput){if(C5(_)&&!this.focusedComponent.wantsKeyRelease)return;this.focusedComponent.handleInput(_),this.requestRender()}}parseCellSizeResponse(){let _=/\x1b\[6;(\d+);(\d+)t/,z=this.inputBuffer.match(_);if(z){let G=parseInt(z[1],10),J=parseInt(z[2],10);if(G>0&&J>0)f5({widthPx:J,heightPx:G}),this.invalidate(),this.requestRender();this.inputBuffer=this.inputBuffer.replace(_,""),this.cellSizeQueryPending=!1}if(/\x1b(\[6?;?[\d;]*)?$/.test(this.inputBuffer)){let G=this.inputBuffer[this.inputBuffer.length-1];if(!/[a-zA-Z~]/.test(G))return""}let b=this.inputBuffer;return this.inputBuffer="",this.cellSizeQueryPending=!1,b}resolveOverlayLayout(_,z,A,b){let G=_??{},J=typeof G.margin==="number"?{top:G.margin,right:G.margin,bottom:G.margin,left:G.margin}:G.margin??{},Y=Math.max(0,J.top??0),X=Math.max(0,J.right??0),Q=Math.max(0,J.bottom??0),$=Math.max(0,J.left??0),H=Math.max(1,A-$-X),B=Math.max(1,b-Y-Q),Z=IX(G.width,A)??Math.min(80,H);if(G.minWidth!==void 0)Z=Math.max(Z,G.minWidth);Z=Math.max(1,Math.min(Z,H));let F=IX(G.maxHeight,b);if(F!==void 0)F=Math.max(1,Math.min(F,B));let K=F!==void 0?Math.min(z,F):z,q,W;if(G.row!==void 0)if(typeof G.row==="string"){let V=G.row.match(/^(\d+(?:\.\d+)?)%$/);if(V){let w=Math.max(0,B-K),O=parseFloat(V[1])/100;q=Y+Math.floor(w*O)}else q=this.resolveAnchorRow("center",K,B,Y)}else q=G.row;else{let V=G.anchor??"center";q=this.resolveAnchorRow(V,K,B,Y)}if(G.col!==void 0)if(typeof G.col==="string"){let V=G.col.match(/^(\d+(?:\.\d+)?)%$/);if(V){let w=Math.max(0,H-Z),O=parseFloat(V[1])/100;W=$+Math.floor(w*O)}else W=this.resolveAnchorCol("center",Z,H,$)}else W=G.col;else{let V=G.anchor??"center";W=this.resolveAnchorCol(V,Z,H,$)}if(G.offsetY!==void 0)q+=G.offsetY;if(G.offsetX!==void 0)W+=G.offsetX;return q=Math.max(Y,Math.min(q,b-Q-K)),W=Math.max($,Math.min(W,A-X-Z)),{width:Z,row:q,col:W,maxHeight:F}}resolveAnchorRow(_,z,A,b){switch(_){case"top-left":case"top-center":case"top-right":return b;case"bottom-left":case"bottom-center":case"bottom-right":return b+A-z;case"left-center":case"center":case"right-center":return b+Math.floor((A-z)/2)}}resolveAnchorCol(_,z,A,b){switch(_){case"top-left":case"left-center":case"bottom-left":return b;case"top-right":case"right-center":case"bottom-right":return b+A-z;case"top-center":case"center":case"bottom-center":return b+Math.floor((A-z)/2)}}compositeOverlays(_,z,A){if(this.overlayStack.length===0)return _;let b=[..._],G=[],J=b.length;for(let $ of this.overlayStack){if(!this.isOverlayVisible($))continue;let{component:H,options:B}=$,{width:Z,maxHeight:F}=this.resolveOverlayLayout(B,0,z,A),K=H.render(Z);if(F!==void 0&&K.length>F)K=K.slice(0,F);let{row:q,col:W}=this.resolveOverlayLayout(B,K.length,z,A);G.push({overlayLines:K,row:q,col:W,w:Z}),J=Math.max(J,q+K.length)}let Y=Math.max(this.maxLinesRendered,J);while(b.length<Y)b.push("");let X=Math.max(0,Y-A),Q=new Set;for(let{overlayLines:$,row:H,col:B,w:Z}of G)for(let F=0;F<$.length;F++){let K=X+H+F;if(K>=0&&K<b.length){let q=W0($[F])>Z?B6($[F],0,Z,!0):$[F];b[K]=this.compositeLineAt(b[K],q,B,Z,z),Q.add(K)}}for(let $ of Q)if(W0(b[$])>z)b[$]=B6(b[$],0,z,!0);return b}static SEGMENT_RESET="\x1B[0m\x1B]8;;\x07";applyLineResets(_){let z=q1.SEGMENT_RESET;for(let A=0;A<_.length;A++){let b=_[A];if(!Oz(b))_[A]=b+z}return _}compositeLineAt(_,z,A,b,G){if(Oz(_))return _;let J=A+b,Y=EX(_,A,J,G-J,!0),X=T5(z,0,b,!0),Q=Math.max(0,A-Y.beforeWidth),$=Math.max(0,b-X.width),H=Math.max(A,Y.beforeWidth),B=Math.max(b,X.width),Z=Math.max(0,G-H-B),F=Math.max(0,Z-Y.afterWidth),K=q1.SEGMENT_RESET,q=Y.before+" ".repeat(Q)+K+X.text+" ".repeat($)+K+Y.after+" ".repeat(F);if(W0(q)<=G)return q;return B6(q,0,G,!0)}extractCursorPosition(_,z){let A=Math.max(0,_.length-z);for(let b=_.length-1;b>=A;b--){let G=_[b],J=G.indexOf(jz);if(J!==-1){let Y=G.slice(0,J),X=W0(Y);return _[b]=G.slice(0,J)+G.slice(J+jz.length),{row:b,col:X}}}return null}doRender(){if(this.stopped)return;let _=this.terminal.columns,z=this.terminal.rows,A=Math.max(0,this.maxLinesRendered-z),b=this.previousViewportTop,G=this.hardwareCursorRow,J=(D)=>{let L=G-b;return D-A-L},Y=this.render(_);if(this.overlayStack.length>0)Y=this.compositeOverlays(Y,_,z);let X=this.extractCursorPosition(Y,z);Y=this.applyLineResets(Y);let Q=this.previousWidth!==0&&this.previousWidth!==_,$=this.previousHeight!==0&&this.previousHeight!==z,H=(D)=>{this.fullRedrawCount+=1;let L="\x1B[?2026h";if(D)L+="\x1B[3J\x1B[2J\x1B[H";for(let R=0;R<Y.length;R++){if(R>0)L+=`\r
88
- `;L+=Y[R]}if(L+="\x1B[?2026l",this.terminal.write(L),this.cursorRow=Math.max(0,Y.length-1),this.hardwareCursorRow=this.cursorRow,D)this.maxLinesRendered=Y.length;else this.maxLinesRendered=Math.max(this.maxLinesRendered,Y.length);this.previousViewportTop=Math.max(0,this.maxLinesRendered-z),this.positionHardwareCursor(X,Y.length),this.previousLines=Y,this.previousWidth=_,this.previousHeight=z};if(this.previousLines.length===0&&!Q&&!$){H(!1);return}if(Q||$){H(!0);return}if(Y.length<this.maxLinesRendered&&this.overlayStack.length===0){H(!0);return}let B=-1,Z=-1,F=Math.max(Y.length,this.previousLines.length);for(let D=0;D<F;D++){let L=D<this.previousLines.length?this.previousLines[D]:"",R=D<Y.length?Y[D]:"";if(L!==R){if(B===-1)B=D;Z=D}}let K=Y.length>this.previousLines.length;if(K){if(B===-1)B=this.previousLines.length;Z=Y.length-1}let q=K&&B===this.previousLines.length&&B>0;if(B===-1){this.positionHardwareCursor(X,Y.length),this.previousViewportTop=Math.max(0,this.maxLinesRendered-z);return}if(B>=Y.length){if(this.previousLines.length>Y.length){let D="\x1B[?2026h",L=Math.max(0,Y.length-1),R=J(L);if(R>0)D+=`\x1B[${R}B`;else if(R<0)D+=`\x1B[${-R}A`;D+="\r";let S=this.previousLines.length-Y.length;if(S>z){H(!0);return}if(S>0)D+="\x1B[1B";for(let y=0;y<S;y++)if(D+="\r\x1B[2K",y<S-1)D+="\x1B[1B";if(S>0)D+=`\x1B[${S}A`;D+="\x1B[?2026l",this.terminal.write(D),this.cursorRow=L,this.hardwareCursorRow=L}this.positionHardwareCursor(X,Y.length),this.previousLines=Y,this.previousWidth=_,this.previousHeight=z,this.previousViewportTop=Math.max(0,this.maxLinesRendered-z);return}if(B<A){H(!0);return}let W="\x1B[?2026h",V=b+z-1,w=q?B-1:B;if(w>V){let D=Math.max(0,Math.min(z-1,G-b)),L=z-1-D;if(L>0)W+=`\x1B[${L}B`;let R=w-V;W+=`\r
89
- `.repeat(R),b+=R,A+=R,G=w}let O=J(w);if(O>0)W+=`\x1B[${O}B`;else if(O<0)W+=`\x1B[${-O}A`;W+=q?`\r
90
- `:"\r";let M=Math.min(Z,Y.length-1);for(let D=B;D<=M;D++){if(D>B)W+=`\r
91
- `;W+="\x1B[2K";let L=Y[D];if(!Oz(L)&&W0(L)>_){let S=Lz.join(xX.homedir(),".pi","agent","pi-crash.log"),y=[`Crash at ${new Date().toISOString()}`,`Terminal width: ${_}`,`Line ${D} visible width: ${W0(L)}`,"","=== All rendered lines ===",...Y.map((u,g)=>`[${g}] (w=${W0(u)}) ${u}`),""].join(`
92
- `);K1.mkdirSync(Lz.dirname(S),{recursive:!0}),K1.writeFileSync(S,y),this.stop();let e=[`Rendered line ${D} exceeds terminal width (${W0(L)} > ${_}).`,"","This is likely caused by a custom TUI component not truncating its output.","Use visibleWidth() to measure and truncateToWidth() to truncate lines.","",`Debug log written to: ${S}`].join(`
93
- `);throw Error(e)}W+=L}let P=M;if(this.previousLines.length>Y.length){if(M<Y.length-1){let L=Y.length-1-M;W+=`\x1B[${L}B`,P=Y.length-1}let D=this.previousLines.length-Y.length;for(let L=Y.length;L<this.previousLines.length;L++)W+=`\r
94
- \x1B[2K`;W+=`\x1B[${D}A`}if(W+="\x1B[?2026l",process.env.PI_TUI_DEBUG==="1"){K1.mkdirSync("/tmp/tui",{recursive:!0});let L=Lz.join("/tmp/tui",`render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`),R=[`firstChanged: ${B}`,`viewportTop: ${A}`,`cursorRow: ${this.cursorRow}`,`height: ${z}`,`lineDiff: ${O}`,`hardwareCursorRow: ${G}`,`renderEnd: ${M}`,`finalCursorRow: ${P}`,`cursorPos: ${JSON.stringify(X)}`,`newLines.length: ${Y.length}`,`previousLines.length: ${this.previousLines.length}`,"","=== newLines ===",JSON.stringify(Y,null,2),"","=== previousLines ===",JSON.stringify(this.previousLines,null,2),"","=== buffer ===",JSON.stringify(W)].join(`
95
- `);K1.writeFileSync(L,R)}this.terminal.write(W),this.cursorRow=Math.max(0,Y.length-1),this.hardwareCursorRow=P,this.maxLinesRendered=Math.max(this.maxLinesRendered,Y.length),this.previousViewportTop=Math.max(0,this.maxLinesRendered-z),this.positionHardwareCursor(X,Y.length),this.previousLines=Y,this.previousWidth=_,this.previousHeight=z}positionHardwareCursor(_,z){if(!_||z<=0){this.terminal.hideCursor();return}let A=Math.max(0,Math.min(_.row,z-1)),b=Math.max(0,_.col),G=A-this.hardwareCursorRow,J="";if(G>0)J+=`\x1B[${G}B`;else if(G<0)J+=`\x1B[${-G}A`;if(J+=`\x1B[${b+1}G`,J)this.terminal.write(J);if(this.hardwareCursorRow=A,this.showHardwareCursor)this.terminal.showCursor();else this.terminal.hideCursor()}}var SR=(_)=>_.replace(/[\r\n]+/g," ").trim();class Rz{items=[];filteredItems=[];selectedIndex=0;maxVisible=5;theme;onSelect;onCancel;onSelectionChange;constructor(_,z,A){this.items=_,this.filteredItems=_,this.maxVisible=z,this.theme=A}setFilter(_){this.filteredItems=this.items.filter((z)=>z.value.toLowerCase().startsWith(_.toLowerCase())),this.selectedIndex=0}setSelectedIndex(_){this.selectedIndex=Math.max(0,Math.min(_,this.filteredItems.length-1))}invalidate(){}render(_){let z=[];if(this.filteredItems.length===0)return z.push(this.theme.noMatch(" No matching commands")),z;let A=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredItems.length-this.maxVisible)),b=Math.min(A+this.maxVisible,this.filteredItems.length);for(let G=A;G<b;G++){let J=this.filteredItems[G];if(!J)continue;let Y=G===this.selectedIndex,X=J.description?SR(J.description):void 0,Q="";if(Y){let H=J.label||J.value;if(X&&_>40){let B=Math.min(30,_-2-4),Z=n0(H,B,""),F=" ".repeat(Math.max(1,32-Z.length)),K=2+Z.length+F.length,q=_-K-2;if(q>10){let W=n0(X,q,"");Q=this.theme.selectedText(`→ ${Z}${F}${W}`)}else{let W=_-2-2;Q=this.theme.selectedText(`→ ${n0(H,W,"")}`)}}else{let B=_-2-2;Q=this.theme.selectedText(`→ ${n0(H,B,"")}`)}}else{let $=J.label||J.value,H=" ";if(X&&_>40){let B=Math.min(30,_-2-4),Z=n0($,B,""),F=" ".repeat(Math.max(1,32-Z.length)),K=2+Z.length+F.length,q=_-K-2;if(q>10){let W=n0(X,q,""),V=this.theme.description(F+W);Q=" "+Z+V}else{let W=_-2-2;Q=" "+n0($,W,"")}}else{let B=_-2-2;Q=" "+n0($,B,"")}}z.push(Q)}if(A>0||b<this.filteredItems.length){let G=` (${this.selectedIndex+1}/${this.filteredItems.length})`;z.push(this.theme.scrollInfo(n0(G,_-2,"")))}return z}handleInput(_){let z=s4();if(z.matches(_,"selectUp"))this.selectedIndex=this.selectedIndex===0?this.filteredItems.length-1:this.selectedIndex-1,this.notifySelectionChange();else if(z.matches(_,"selectDown"))this.selectedIndex=this.selectedIndex===this.filteredItems.length-1?0:this.selectedIndex+1,this.notifySelectionChange();else if(z.matches(_,"selectConfirm")){let A=this.filteredItems[this.selectedIndex];if(A&&this.onSelect)this.onSelect(A)}else if(z.matches(_,"selectCancel")){if(this.onCancel)this.onCancel()}}notifySelectionChange(){let _=this.filteredItems[this.selectedIndex];if(_&&this.onSelectionChange)this.onSelectionChange(_)}getSelectedItem(){return this.filteredItems[this.selectedIndex]||null}}var Fa=$6();var Ma=$6();function c5(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var R_=c5();function fX(_){R_=_}var kz={exec:()=>null};function B0(_,z=""){let A=typeof _==="string"?_:_.source,b={replace:(G,J)=>{let Y=typeof J==="string"?J:J.source;return Y=Y.replace(_9.caret,"$1"),A=A.replace(G,Y),b},getRegex:()=>{return new RegExp(A,z)}};return b}var _9={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:(_)=>new RegExp(`^( {0,3}${_})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}#`),htmlBeginRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}<(?:[a-z].*>|!--)`,"i")},vR=/^(?:[ \t]*(?:\n|$))+/,yR=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,gR=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Iz=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,fR=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,l5=/(?:[*+-]|\d{1,9}[.)])/,hX=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,mX=B0(hX).replace(/bull/g,l5).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),hR=B0(hX).replace(/bull/g,l5).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),p5=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,mR=/^[^\n]+/,d5=/(?!\s*\])(?:\\.|[^\[\]\\])+/,uR=B0(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",d5).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),cR=B0(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,l5).getRegex(),w6="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",r5=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,lR=B0("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",r5).replace("tag",w6).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),uX=B0(p5).replace("hr",Iz).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",w6).getRegex(),pR=B0(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",uX).getRegex(),n5={blockquote:pR,code:yR,def:uR,fences:gR,heading:fR,hr:Iz,html:lR,lheading:mX,list:cR,newline:vR,paragraph:uX,table:kz,text:mR},TX=B0("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Iz).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",w6).getRegex(),dR={...n5,lheading:hR,table:TX,paragraph:B0(p5).replace("hr",Iz).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",TX).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",w6).getRegex()},rR={...n5,html:B0(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",r5).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:kz,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:B0(p5).replace("hr",Iz).replace("heading",` *#{1,6} *[^
96
- ]`).replace("lheading",mX).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},nR=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,iR=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,cX=/^( {2,}|\\)\n(?!\s*$)/,oR=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,E6=/[\p{P}\p{S}]/u,i5=/[\s\p{P}\p{S}]/u,lX=/[^\s\p{P}\p{S}]/u,aR=B0(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,i5).getRegex(),pX=/(?!~)[\p{P}\p{S}]/u,sR=/(?!~)[\s\p{P}\p{S}]/u,tR=/(?:[^\s\p{P}\p{S}]|~)/u,eR=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,dX=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,_P=B0(dX,"u").replace(/punct/g,E6).getRegex(),zP=B0(dX,"u").replace(/punct/g,pX).getRegex(),rX="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",AP=B0(rX,"gu").replace(/notPunctSpace/g,lX).replace(/punctSpace/g,i5).replace(/punct/g,E6).getRegex(),bP=B0(rX,"gu").replace(/notPunctSpace/g,tR).replace(/punctSpace/g,sR).replace(/punct/g,pX).getRegex(),GP=B0("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,lX).replace(/punctSpace/g,i5).replace(/punct/g,E6).getRegex(),JP=B0(/\\(punct)/,"gu").replace(/punct/g,E6).getRegex(),YP=B0(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),XP=B0(r5).replace("(?:-->|$)","-->").getRegex(),QP=B0("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",XP).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),D6=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,$P=B0(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",D6).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nX=B0(/^!?\[(label)\]\[(ref)\]/).replace("label",D6).replace("ref",d5).getRegex(),iX=B0(/^!?\[(ref)\](?:\[\])?/).replace("ref",d5).getRegex(),HP=B0("reflink|nolink(?!\\()","g").replace("reflink",nX).replace("nolink",iX).getRegex(),o5={_backpedal:kz,anyPunctuation:JP,autolink:YP,blockSkip:eR,br:cX,code:iR,del:kz,emStrongLDelim:_P,emStrongRDelimAst:AP,emStrongRDelimUnd:GP,escape:nR,link:$P,nolink:iX,punctuation:aR,reflink:nX,reflinkSearch:HP,tag:QP,text:oR,url:kz},BP={...o5,link:B0(/^!?\[(label)\]\((.*?)\)/).replace("label",D6).getRegex(),reflink:B0(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",D6).getRegex()},u5={...o5,emStrongRDelimAst:bP,emStrongLDelim:zP,url:B0(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},ZP={...u5,br:B0(cX).replace("{2,}","*").getRegex(),text:B0(u5.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},V6={normal:n5,gfm:dR,pedantic:rR},Pz={normal:o5,gfm:u5,breaks:ZP,pedantic:BP},FP={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},CX=(_)=>FP[_];function $4(_,z){if(z){if(_9.escapeTest.test(_))return _.replace(_9.escapeReplace,CX)}else if(_9.escapeTestNoEncode.test(_))return _.replace(_9.escapeReplaceNoEncode,CX);return _}function vX(_){try{_=encodeURI(_).replace(_9.percentDecode,"%")}catch{return null}return _}function yX(_,z){let A=_.replace(_9.findPipe,(J,Y,X)=>{let Q=!1,$=Y;while(--$>=0&&X[$]==="\\")Q=!Q;if(Q)return"|";else return" |"}),b=A.split(_9.splitPipe),G=0;if(!b[0].trim())b.shift();if(b.length>0&&!b.at(-1)?.trim())b.pop();if(z)if(b.length>z)b.splice(z);else while(b.length<z)b.push("");for(;G<b.length;G++)b[G]=b[G].trim().replace(_9.slashPipe,"|");return b}function Sz(_,z,A){let b=_.length;if(b===0)return"";let G=0;while(G<b){let J=_.charAt(b-G-1);if(J===z&&!A)G++;else if(J!==z&&A)G++;else break}return _.slice(0,b-G)}function KP(_,z){if(_.indexOf(z[1])===-1)return-1;let A=0;for(let b=0;b<_.length;b++)if(_[b]==="\\")b++;else if(_[b]===z[0])A++;else if(_[b]===z[1]){if(A--,A<0)return b}if(A>0)return-2;return-1}function gX(_,z,A,b,G){let J=z.href,Y=z.title||null,X=_[1].replace(G.other.outputLinkReplace,"$1");b.state.inLink=!0;let Q={type:_[0].charAt(0)==="!"?"image":"link",raw:A,href:J,title:Y,text:X,tokens:b.inlineTokens(X)};return b.state.inLink=!1,Q}function qP(_,z,A){let b=_.match(A.other.indentCodeCompensation);if(b===null)return z;let G=b[1];return z.split(`
97
- `).map((J)=>{let Y=J.match(A.other.beginningSpace);if(Y===null)return J;let[X]=Y;if(X.length>=G.length)return J.slice(G.length);return J}).join(`
98
- `)}var M6=class{options;rules;lexer;constructor(_){this.options=_||R_}space(_){let z=this.rules.block.newline.exec(_);if(z&&z[0].length>0)return{type:"space",raw:z[0]}}code(_){let z=this.rules.block.code.exec(_);if(z){let A=z[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:z[0],codeBlockStyle:"indented",text:!this.options.pedantic?Sz(A,`
99
- `):A}}}fences(_){let z=this.rules.block.fences.exec(_);if(z){let A=z[0],b=qP(A,z[3]||"",this.rules);return{type:"code",raw:A,lang:z[2]?z[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):z[2],text:b}}}heading(_){let z=this.rules.block.heading.exec(_);if(z){let A=z[2].trim();if(this.rules.other.endingHash.test(A)){let b=Sz(A,"#");if(this.options.pedantic)A=b.trim();else if(!b||this.rules.other.endingSpaceChar.test(b))A=b.trim()}return{type:"heading",raw:z[0],depth:z[1].length,text:A,tokens:this.lexer.inline(A)}}}hr(_){let z=this.rules.block.hr.exec(_);if(z)return{type:"hr",raw:Sz(z[0],`
100
- `)}}blockquote(_){let z=this.rules.block.blockquote.exec(_);if(z){let A=Sz(z[0],`
81
+ `),images:G}}function Rb(_){return $R.createHash("sha256").update(_).digest("hex")}function UR(_){return HR[_.toLowerCase()]??_}function DR(_,z,A){if(!z||typeof z!=="object")return z;let G={...z};if(typeof G.path==="string")G.file_path=A?jb(G.path,A):G.path,delete G.path;if(typeof G.file_path==="string"&&A)G.file_path=jb(G.file_path,A);return A?s0(G,A):G}function MR(_,z,A,G,J){let Y=[],X=[];for(let $ of z)if($.type==="text"&&$.text)Y.push($.text);else if($.type==="image"){let H=Buffer.from($.data,"base64"),B=Rb(H);if(!J.has(B))J.set(B,{data:H,mediaType:$.mimeType});X.push({sha256:B,mediaType:$.mimeType})}let b=Y.join(`
82
+ `);if(_==="edit"&&A&&typeof A==="object"){let $=A;if($.diff)return{output:{diff:$.diff},images:X}}if(_==="read"&&b){let $=b.split(`
83
+ `).length;return{output:{file:{content:b,numLines:$,totalLines:$}},images:X}}return{output:b||(G?s0(A,G):A),images:X}}function jb(_,z){if(!_)return _;let A=_.startsWith("/"),G=_.replace(/\\/g,"/");if(!A){if(G==="."||G==="./")return".";if(G.startsWith("./")||G.startsWith("../"))return G;return`./${G}`}let J=z.replace(/\\/g,"/");if(G.startsWith(J+"/"))return`./${G.slice(J.length+1)}`;return D9(G)}function NR(_){for(let z of _)if(z.type==="user"&&z.text)return ER(z.text);return null}function ER(_){return _.replace(/\s+/g," ").trim()}function wR(_){if(!_)return null;let z=new Date(_);return Number.isNaN(z.getTime())?null:z}function OR(_){return Math.max(0,_.inputTokens-_.cachedInputTokens)+_.outputTokens+_.reasoningOutputTokens}var LR=["anthropic/","openai/","google/"],jR=200000;function RR(_,z,A){if(!A||!_)return 0;let G=PR(_,A);if(!G)return 0;return SR({input_tokens:Math.max(0,z.inputTokens-z.cachedInputTokens),output_tokens:z.outputTokens,cache_read_input_tokens:z.cachedInputTokens},G)}function PR(_,z){let A=_.trim();if(!A)return null;let G=new Set;G.add(A);for(let J of LR)G.add(`${J}${A}`);for(let J of G){let Y=z[J];if(Y)return Y}return null}function SR(_,z){let A=(X,b,Q,$=jR)=>{if(X==null||X<=0)return 0;if(X>$&&Q!=null){let H=Math.min(X,$),Z=Math.max(0,X-$)*Q;if(b!=null)Z+=H*b;return Z}if(b!=null)return X*b;return 0},G=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),J=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),Y=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return G+J+Y}var kR="https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json",IR=200000,xR=D.object({input_cost_per_token:D.number().optional(),output_cost_per_token:D.number().optional(),cache_creation_input_token_cost:D.number().optional(),cache_read_input_token_cost:D.number().optional(),max_tokens:D.number().optional(),max_input_tokens:D.number().optional(),max_output_tokens:D.number().optional(),input_cost_per_token_above_200k_tokens:D.number().optional(),output_cost_per_token_above_200k_tokens:D.number().optional(),cache_creation_input_token_cost_above_200k_tokens:D.number().optional(),cache_read_input_token_cost_above_200k_tokens:D.number().optional(),input_cost_per_token_above_128k_tokens:D.number().optional(),output_cost_per_token_above_128k_tokens:D.number().optional()}),TR=["anthropic/","claude-3-5-","claude-3-","claude-","openai/","azure/","openrouter/openai/"],CR=1e4;function vR(_){if(_!=null)return _;return{debug:()=>{},error:()=>{},info:()=>{},warn:()=>{}}}class I0{cachedPricing=null;logger;offline;offlineLoader;url;providerPrefixes;timeoutMs;constructor(_={}){this.logger=vR(_.logger),this.offline=Boolean(_.offline),this.offlineLoader=_.offlineLoader,this.url=_.url??kR,this.providerPrefixes=_.providerPrefixes??TR,this.timeoutMs=_.timeoutMs??CR}[Symbol.dispose](){this.clearCache()}clearCache(){this.cachedPricing=null}async loadOfflinePricing(){if(this.offlineLoader==null)throw Error("Offline loader was not provided");let _=new Map(Object.entries(await this.offlineLoader()));return this.cachedPricing=_,_}async fetchRemotePricing(){this.logger.warn("Fetching latest model pricing from LiteLLM...");let _=await fetch(this.url,{signal:AbortSignal.timeout(this.timeoutMs)});if(!_.ok)throw Error(`Failed to fetch pricing data: ${_.statusText}`);let z=await _.json(),A=new Map;for(let[G,J]of Object.entries(z)){if(typeof J!=="object"||J==null)continue;let Y=xR.safeParse(J);if(!Y.success)continue;A.set(G,Y.data)}return this.cachedPricing=A,this.logger.info(`Loaded pricing for ${A.size} models`),A}async ensurePricingLoaded(){if(this.cachedPricing!=null)return this.cachedPricing;if(this.offline)return this.loadOfflinePricing();try{return await this.fetchRemotePricing()}catch(_){if(this.logger.warn("Failed to fetch model pricing from LiteLLM, falling back to offline loader (if available)."),this.offlineLoader!=null)return this.loadOfflinePricing();this.logger.warn("No offline pricing loader configured; continuing without model pricing data."),this.logger.debug(_);let z=new Map;return this.cachedPricing=z,z}}async fetchModelPricing(){return this.ensurePricingLoaded()}createMatchingCandidates(_){let z=new Set;z.add(_);for(let A of this.providerPrefixes)z.add(`${A}${_}`);return Array.from(z)}async getModelPricing(_){let z=await this.ensurePricingLoaded();for(let G of this.createMatchingCandidates(_)){let J=z.get(G);if(J!=null)return J}let A=_.toLowerCase();for(let[G,J]of z){let Y=G.toLowerCase();if(Y.includes(A)||A.includes(Y))return J}return null}async getModelContextLimit(_){return(await this.getModelPricing(_))?.max_input_tokens??null}calculateCostFromPricing(_,z){let A=(b,Q,$,H=IR)=>{if(b==null||b<=0)return 0;if(b>H&&$!=null){let B=Math.min(b,H),q=Math.max(0,b-H)*$;if(Q!=null)q+=B*Q;return q}if(Q!=null)return b*Q;return 0},G=A(_.input_tokens,z.input_cost_per_token,z.input_cost_per_token_above_200k_tokens),J=A(_.output_tokens,z.output_cost_per_token,z.output_cost_per_token_above_200k_tokens),Y=A(_.cache_creation_input_tokens,z.cache_creation_input_token_cost,z.cache_creation_input_token_cost_above_200k_tokens),X=A(_.cache_read_input_tokens,z.cache_read_input_token_cost,z.cache_read_input_token_cost_above_200k_tokens);return G+J+Y+X}async calculateCostFromTokens(_,z){if(z==null||z==="")return 0;let A=await this.getModelPricing(z);if(A==null)throw Error(`Model pricing not found for ${z}`);return this.calculateCostFromPricing(_,A)}}async function Pb(_={}){let z=_.serverUrl??process.env.VI_SERVER_URL??"http://localhost:3000",A=_.authToken??null,G=_.timeoutMs??1e4;try{let J=await fetch(`${z}/api/transcripts`,{method:"GET",headers:{...A&&{Authorization:`Bearer ${A}`}},signal:AbortSignal.timeout(G)});if(!J.ok)return console.error(`Failed to fetch transcript metadata: ${J.status} ${J.statusText}`),[];let Y=await J.json();if(yR(Y))return Y.transcripts;return console.error("Transcript metadata response had unexpected shape:",Y),[]}catch(J){if(J instanceof Error)console.error("Failed to fetch transcript metadata:",J.message);return[]}}function yR(_){if(typeof _!=="object"||_===null||!("transcripts"in _))return!1;let{transcripts:z}=_;if(!Array.isArray(z))return!1;return z.every((A)=>{if(typeof A!=="object"||A===null)return!1;let G=A;return typeof G.transcriptId==="string"&&G.transcriptId.length>0&&typeof G.sha256==="string"&&G.sha256.length>0&&typeof G.repoId==="string"&&G.repoId.length>0})}var Sb=[{name:"OpenAI API Key",regex:"sk-[a-zA-Z0-9]{20,}"},{name:"OpenAI Project Key",regex:"sk-proj-[a-zA-Z0-9\\-_]{20,}"},{name:"Anthropic API Key",regex:"sk-ant-[a-zA-Z0-9\\-_]{20,}"},{name:"Cohere API Key",regex:"co-[a-zA-Z0-9]{40,}"},{name:"HuggingFace Token",regex:"hf_[a-zA-Z0-9]{34,}"},{name:"Replicate API Token",regex:"r8_[a-zA-Z0-9]{40}"},{name:"JWT Token",regex:"eyJ[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_.+/=]*"},{name:"OAuth Client Secret",regex:`(?i)client_secret['"\\s:=]+[a-zA-Z0-9\\-_.~]{10,100}`},{name:"OAuth Client ID",regex:`(?i)client_id['"\\s:=]+[a-zA-Z0-9\\-_.~]{10,100}`},{name:"Bearer Token",regex:"Bearer\\s+[a-zA-Z0-9\\-._~+/]+=*"},{name:"Authorization Bearer",regex:"(?i)authorization:\\s*Bearer\\s+[a-zA-Z0-9\\-._~+/]+=*"},{name:"Google OAuth Access Token",regex:"ya29\\.[0-9A-Za-z\\-_]+"},{name:"GitHub Fine-Grained Token",regex:"github_pat_[0-9a-zA-Z_]{20,}"},{name:"GitHub OAuth App Secret",regex:`[g|G][i|I][t|T][h|H][u|U][b|B].*['|"][0-9a-zA-Z]{35,40}['|"]`},{name:"GitLab PAT",regex:"glpat-[a-zA-Z0-9_-]{16,}"},{name:"GitLab Runner Token",regex:"glrt-[a-zA-Z0-9_-]{16,}"},{name:"MongoDB URI",regex:`mongodb(\\+srv)?:\\/\\/[^\\s'"]+`},{name:"PostgreSQL URI",regex:`postgres(?:ql)?:\\/\\/[^\\s'"]+`},{name:"MySQL URI",regex:`mysql:\\/\\/[^\\s'"]+`},{name:"Redis URI",regex:`redis:\\/\\/[^\\s'"]+`},{name:"JDBC URL",regex:`jdbc:\\w+:\\/\\/[^\\s'"]+`},{name:"Password in URL",regex:`[a-zA-Z]{3,10}://[^/\\s:@]{3,20}:[^/\\s:@]{3,20}@.{1,100}["'\\s]`},{name:"DigitalOcean Token",regex:"dop_v1_[a-z0-9]{64}"},{name:"CircleCI Token",regex:"circle-token=[a-z0-9]{40}"},{name:"New Relic Key",regex:"NRII-[a-zA-Z0-9]{20,}"},{name:"Sentry DSN",regex:"https:\\/\\/[a-zA-Z0-9]+@[a-z]+\\.ingest\\.sentry\\.io\\/\\d+"},{name:"Cloudinary URL",regex:"cloudinary:\\/\\/[0-9]{15}:[a-zA-Z0-9]+@[a-zA-Z]+"},{name:"Discord Bot Token",regex:"[MN][A-Za-z\\d]{23}\\.[\\w-]{6}\\.[\\w-]{27}"},{name:"Discord Webhook",regex:"https:\\/\\/discord(?:app)?\\.com\\/api\\/webhooks\\/[0-9]+\\/[a-zA-Z0-9_-]+"},{name:"Telegram Bot Token",regex:"\\d{9}:[a-zA-Z0-9_-]{35}"},{name:"Microsoft Teams Webhook",regex:"https:\\/\\/[a-z]+\\.webhook\\.office\\.com\\/webhookb2\\/[a-zA-Z0-9@\\-]+\\/.*"},{name:"Stripe Publishable Key",regex:"pk_live_[0-9a-zA-Z]{24}"},{name:"PayPal Braintree Token",regex:"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-f]{32}"},{name:"Square Access Token",regex:"sq0atp-[0-9A-Za-z\\-_]{22}"},{name:"Square OAuth Secret",regex:"sq0csp-[0-9A-Za-z\\-_]{43}"},{name:"SendGrid API Key",regex:"SG\\.[\\w\\d\\-_]{22}\\.[\\w\\d\\-_]{43}"},{name:"Mailgun API Key",regex:"key-[0-9a-zA-Z]{32}"},{name:"MailChimp API Key",regex:"[0-9a-f]{32}-us[0-9]{1,2}"},{name:"Shopify Access Token",regex:"shpat_[0-9a-fA-F]{32}"},{name:"Dropbox Access Token",regex:"sl\\.[A-Za-z0-9_-]{20,100}"},{name:"Asana Token",regex:"0\\/[0-9a-z]{32}"},{name:"Linear API Key",regex:"lin_api_[a-zA-Z0-9]{40}"},{name:"Riot Games API Key",regex:"RGAPI-[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}"},{name:"Generic API Key",regex:`(?i)(api[_-]?key)['"\\s:=]+[a-zA-Z0-9\\-_.]{16,}`},{name:"Generic Secret",regex:`(?i)(secret|password|passwd|pwd)['"\\s:=]+[^\\s'"]{8,}`},{name:"Generic Token",regex:`(?i)(token)['"\\s:=]+[a-zA-Z0-9\\-_.]{16,}`},{name:"Private Key Block",regex:"-----BEGIN (RSA|DSA|EC|OPENSSH|PGP)?\\s*PRIVATE\\s+KEY"},{name:"Certificate Block",regex:"-----BEGIN CERTIFICATE-----"},{name:"AWS API Gateway",regex:"[0-9a-z]+.execute-api.[0-9a-z._-]+.amazonaws.com"},{name:"AWS API Key",regex:"AKIA[0-9A-Z]{16}"},{name:"AWS ARN",regex:"arn:aws:[a-z0-9-]+:[a-z]{2}-[a-z]+-[0-9]+:[0-9]+:.+"},{name:"AWS Access Key ID Value",regex:"(A3T[A-Z0-9]|AKIA|AGPA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"},{name:"AWS AppSync GraphQL Key",regex:"da2-[a-z0-9]{26}"},{name:"AWS EC2 External",regex:"ec2-[0-9a-z._-]+.compute(-1)?.amazonaws.com"},{name:"AWS EC2 Internal",regex:"[0-9a-z._-]+.compute(-1)?.internal"},{name:"AWS ELB",regex:"[0-9a-z._-]+.elb.amazonaws.com"},{name:"AWS ElasticCache",regex:"[0-9a-z._-]+.cache.amazonaws.com"},{name:"AWS MWS ID",regex:"mzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},{name:"AWS MWS key",regex:"amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},{name:"AWS RDS",regex:"[0-9a-z._-]+.rds.amazonaws.com"},{name:"AWS S3 Bucket",regex:"s3://[0-9a-z._/-]+"},{name:"AWS client ID",regex:"(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"},{name:"AWS cred file info",regex:"(aws_access_key_id|aws_secret_access_key)"},{name:"Abbysale",regex:"(?:abbysale).{0,40}\\b([a-z0-9A-Z]{40})\\b"},{name:"Abstract",regex:"(?:abstract).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Abuseipdb",regex:"(?:abuseipdb).{0,40}\\b([a-z0-9]{80})\\b"},{name:"Accuweather",regex:"(?:accuweather).{0,40}([a-z0-9A-Z\\%]{35})\\b"},{name:"Adafruitio",regex:"\\b(aio\\_[a-zA-Z0-9]{28})\\b"},{name:"Adobeio - 1",regex:"(?:adobe).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Adzuna - 1",regex:"(?:adzuna).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Adzuna - 2",regex:"(?:adzuna).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aeroworkflow - 1",regex:"(?:aeroworkflow).{0,40}\\b([0-9]{1,})\\b"},{name:"Aeroworkflow - 2",regex:"(?:aeroworkflow).{0,40}\\b([a-zA-Z0-9^!]{20})\\b"},{name:"Agora",regex:"(?:agora).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Airbrakeprojectkey - 1",regex:"(?:airbrake).{0,40}\\b([0-9]{6})\\b"},{name:"Airbrakeprojectkey - 2",regex:"(?:airbrake).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Airbrakeuserkey",regex:"(?:airbrake).{0,40}\\b([a-zA-Z-0-9]{40})\\b"},{name:"Airship",regex:"(?:airship).{0,40}\\b([0-9Aa-zA-Z]{91})\\b"},{name:"Airvisual",regex:"(?:airvisual).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Alconost",regex:"(?:alconost).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Alegra - 1",regex:"(?:alegra).{0,40}\\b([a-z0-9-]{20})\\b"},{name:"Alegra - 2",regex:"(?:alegra).{0,40}\\b([a-zA-Z0-9.-@]{25,30})\\b"},{name:"Aletheiaapi",regex:"(?:aletheiaapi).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Algoliaadminkey - 1",regex:"(?:algolia).{0,40}\\b([A-Z0-9]{10})\\b"},{name:"Algoliaadminkey - 2",regex:"(?:algolia).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Alibaba - 2",regex:"\\b(LTAI[a-zA-Z0-9]{17,21})[\\\"' ;\\s]*"},{name:"Alienvault",regex:"(?:alienvault).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Allsports",regex:"(?:allsports).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Amadeus - 1",regex:"(?:amadeus).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Amadeus - 2",regex:"(?:amadeus).{0,40}\\b([0-9A-Za-z]{16})\\b"},{name:"Amazon SNS Topic",regex:"arn:aws:sns:[a-z0-9\\-]+:[0-9]+:[A-Za-z0-9\\-_]+"},{name:"Ambee",regex:"(?:ambee).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Amplitudeapikey",regex:"(?:amplitude).{0,40}\\b([a-f0-9]{32})"},{name:"Apacta",regex:"(?:apacta).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Api2cart",regex:"(?:api2cart).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Apideck - 1",regex:"\\b(sk_live_[a-z0-9A-Z-]{93})\\b"},{name:"Apideck - 2",regex:"(?:apideck).{0,40}\\b([a-z0-9A-Z]{40})\\b"},{name:"Apiflash - 1",regex:"(?:apiflash).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Apiflash - 2",regex:"(?:apiflash).{0,40}\\b([a-zA-Z0-9\\S]{21,30})\\b"},{name:"Apifonica",regex:"(?:apifonica).{0,40}\\b([0-9a-z]{11}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Apify",regex:"\\b(apify\\_api\\_[a-zA-Z-0-9]{36})\\b"},{name:"Apimatic - 1",regex:"(?:apimatic).{0,40}\\b([a-z0-9-\\S]{8,32})\\b"},{name:"Apimatic - 2",regex:"(?:apimatic).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Apiscience",regex:"(?:apiscience).{0,40}\\b([a-bA-Z0-9\\S]{22})\\b"},{name:"Apollo",regex:"(?:apollo).{0,40}\\b([a-zA-Z0-9]{22})\\b"},{name:"Appcues - 1",regex:"(?:appcues).{0,40}\\b([0-9]{5})\\b"},{name:"Appcues - 2",regex:"(?:appcues).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Appcues - 3",regex:"(?:appcues).{0,40}\\b([a-z0-9-]{39})\\b"},{name:"Appfollow",regex:"(?:appfollow).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Appsynergy",regex:"(?:appsynergy).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Apptivo - 1",regex:"(?:apptivo).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Apptivo - 2",regex:"(?:apptivo).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Artifactory - 2",regex:"\\b([A-Za-z0-9](?:[A-Za-z0-9\\-]{0,61}[A-Za-z0-9])\\.jfrog\\.io)"},{name:"Artifactory API Token",regex:'(?:\\s|=|:|"|^)AKC[a-zA-Z0-9]{10,}'},{name:"Artifactory Password",regex:'(?:\\s|=|:|"|^)AP[\\dABCDEF][a-zA-Z0-9]{8,}'},{name:"Artsy - 1",regex:"(?:artsy).{0,40}\\b([0-9a-zA-Z]{20})\\b"},{name:"Artsy - 2",regex:"(?:artsy).{0,40}\\b([0-9a-zA-Z]{32})\\b"},{name:"Asanaoauth",regex:"(?:asana).{0,40}\\b([a-z\\/:0-9]{51})\\b"},{name:"Asanapersonalaccesstoken",regex:"(?:asana).{0,40}\\b([0-9]{1,}\\/[0-9]{16,}:[A-Za-z0-9]{32,})\\b"},{name:"Assemblyai",regex:"(?:assemblyai).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Asymmetric Private Key",regex:"-----BEGIN ((EC|PGP|DSA|RSA|OPENSSH) )?PRIVATE KEY( BLOCK)?-----"},{name:"Audd",regex:"(?:audd).{0,40}\\b([a-z0-9-]{32})\\b"},{name:"Auth0managementapitoken",regex:"(?:auth0).{0,40}\\b(ey[a-zA-Z0-9._-]+)\\b"},{name:"Auth0oauth - 1",regex:"(?:auth0).{0,40}\\b([a-zA-Z0-9_-]{32,60})\\b"},{name:"Autodesk - 1",regex:"(?:autodesk).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Autodesk - 2",regex:"(?:autodesk).{0,40}\\b([0-9A-Za-z]{16})\\b"},{name:"Autoklose",regex:"(?:autoklose).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Autopilot",regex:"(?:autopilot).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Avazapersonalaccesstoken",regex:"(?:avaza).{0,40}\\b([0-9]+-[0-9a-f]{40})\\b"},{name:"Aviationstack",regex:"(?:aviationstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aws - 1",regex:"\\b((?:AKIA|ABIA|ACCA|ASIA)[0-9A-Z]{16})\\b"},{name:"Axonaut",regex:"(?:axonaut).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aylien - 1",regex:"(?:aylien).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Aylien - 2",regex:"(?:aylien).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Ayrshare",regex:"(?:ayrshare).{0,40}\\b([A-Z]{7}-[A-Z0-9]{7}-[A-Z0-9]{7}-[A-Z0-9]{7})\\b"},{name:"Bannerbear",regex:"(?:bannerbear).{0,40}\\b([0-9a-zA-Z]{22}tt)\\b"},{name:"Baremetrics",regex:"(?:baremetrics).{0,40}\\b([a-zA-Z0-9_]{25})\\b"},{name:"Baseapiio",regex:"(?:baseapi|base-api).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Beamer",regex:"(?:beamer).{0,40}\\b([a-zA-Z0-9_+/]{45}=)"},{name:"Beebole",regex:"(?:beebole).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Besttime",regex:"(?:besttime).{0,40}\\b([0-9A-Za-z_]{36})\\b"},{name:"Billomat - 1",regex:"(?:billomat).{0,40}\\b([0-9a-z]{1,})\\b"},{name:"Billomat - 2",regex:"(?:billomat).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Bitbar",regex:"(?:bitbar).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Bitcoinaverage",regex:"(?:bitcoinaverage).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Bitfinex",regex:"(?:bitfinex).{0,40}\\b([A-Za-z0-9_-]{43})\\b"},{name:"Bitly Secret Key",regex:"R_[0-9a-f]{32}"},{name:"Bitlyaccesstoken",regex:"(?:bitly).{0,40}\\b([a-zA-Z-0-9]{40})\\b"},{name:"Bitmex - 1",regex:"(?:bitmex).{0,40}([ \\r\\n]{1}[0-9a-zA-Z\\-\\_]{24}[ \\r\\n]{1})"},{name:"Bitmex - 2",regex:"(?:bitmex).{0,40}([ \\r\\n]{1}[0-9a-zA-Z\\-\\_]{48}[ \\r\\n]{1})"},{name:"Blablabus",regex:"(?:blablabus).{0,40}\\b([0-9A-Za-z]{22})\\b"},{name:"Blazemeter",regex:"(?:blazemeter|runscope).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Blitapp",regex:"(?:blitapp).{0,40}\\b([a-zA-Z0-9_-]{39})\\b"},{name:"Blogger",regex:"(?:blogger).{0,40}\\b([0-9A-Za-z-]{39})\\b"},{name:"Bombbomb",regex:"(?:bombbomb).{0,40}\\b([a-zA-Z0-9-._]{704})\\b"},{name:"Boostnote",regex:"(?:boostnote).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Borgbase",regex:"(?:borgbase).{0,40}\\b([a-zA-Z0-9/_.-]{148,152})\\b"},{name:"Braintree API Key",regex:"access_token$production$[0-9a-z]{16}$[0-9a-f]{32}"},{name:"Brandfetch",regex:"(?:brandfetch).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Browshot",regex:"(?:browshot).{0,40}\\b([a-zA-Z-0-9]{28})\\b"},{name:"Buddyns",regex:"(?:buddyns).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Bugherd",regex:"(?:bugherd).{0,40}\\b([0-9a-z]{22})\\b"},{name:"Bugsnag",regex:"(?:bugsnag).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Buildkite",regex:"(?:buildkite).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Bulbul",regex:"(?:bulbul).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Buttercms",regex:"(?:buttercms).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Caflou",regex:"(?:caflou).{0,40}\\b([a-bA-Z0-9\\S]{155})\\b"},{name:"Calendarific",regex:"(?:calendarific).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Calendlyapikey",regex:"(?:calendly).{0,40}\\b([a-zA-Z-0-9]{20}.[a-zA-Z-0-9]{171}.[a-zA-Z-0-9_]{43})\\b"},{name:"Calorieninja",regex:"(?:calorieninja).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Campayn",regex:"(?:campayn).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Cannyio",regex:"(?:canny).{0,40}\\b([a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[0-9]{4}-[a-z0-9]{12})\\b"},{name:"Capsulecrm",regex:"(?:capsulecrm).{0,40}\\b([a-zA-Z0-9-._+=]{64})\\b"},{name:"Captaindata - 1",regex:"(?:captaindata).{0,40}\\b([0-9a-f]{8}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{12})\\b"},{name:"Captaindata - 2",regex:"(?:captaindata).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Carboninterface",regex:"(?:carboninterface).{0,40}\\b([a-zA-Z0-9]{21})\\b"},{name:"Cashboard - 1",regex:"(?:cashboard).{0,40}\\b([0-9A-Z]{3}-[0-9A-Z]{3}-[0-9A-Z]{3}-[0-9A-Z]{3})\\b"},{name:"Cashboard - 2",regex:"(?:cashboard).{0,40}\\b([0-9a-z]{1,})\\b"},{name:"Caspio - 1",regex:"(?:caspio).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Caspio - 2",regex:"(?:caspio).{0,40}\\b([a-z0-9]{50})\\b"},{name:"Censys - 1",regex:"(?:censys).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Censys - 2",regex:"(?:censys).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Centralstationcrm",regex:"(?:centralstation).{0,40}\\b([a-z0-9]{30})\\b"},{name:"Cexio - 1",regex:"(?:cexio|cex.io).{0,40}\\b([a-z]{2}[0-9]{9})\\b"},{name:"Cexio - 2",regex:"(?:cexio|cex.io).{0,40}\\b([0-9A-Za-z]{24,27})\\b"},{name:"Chatbot",regex:"(?:chatbot).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Chatfule",regex:"(?:chatfuel).{0,40}\\b([a-zA-Z0-9]{128})\\b"},{name:"Checio",regex:"(?:checio).{0,40}\\b(pk_[a-z0-9]{45})\\b"},{name:"Checklyhq",regex:"(?:checklyhq).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Checkout - 1",regex:"(?:checkout).{0,40}\\b((sk_|sk_test_)[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})\\b"},{name:"Checkout - 2",regex:"(?:checkout).{0,40}\\b(cus_[0-9a-zA-Z]{26})\\b"},{name:"Checkvist - 1",regex:"(?:checkvist).{0,40}\\b([\\w\\.-]+@[\\w-]+\\.[\\w\\.-]{2,5})\\b"},{name:"Checkvist - 2",regex:"(?:checkvist).{0,40}\\b([0-9a-zA-Z]{14})\\b"},{name:"Cicero",regex:"(?:cicero).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Circleci",regex:"(?:circle).{0,40}([a-fA-F0-9]{40})"},{name:"Clearbit",regex:"(?:clearbit).{0,40}\\b([0-9a-z_]{35})\\b"},{name:"Clickhelp - 1",regex:"\\b([0-9A-Za-z]{3,20}.try.clickhelp.co)\\b"},{name:"Clickhelp - 2",regex:"(?:clickhelp).{0,40}\\b([0-9A-Za-z]{24})\\b"},{name:"Clicksendsms - 2",regex:"(?:sms).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Clickuppersonaltoken",regex:"(?:clickup).{0,40}\\b(pk_[0-9]{8}_[0-9A-Z]{32})\\b"},{name:"Cliengo",regex:"(?:cliengo).{0,40}\\b([0-9a-f]{8}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{12})\\b"},{name:"Clinchpad",regex:"(?:clinchpad).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Clockify",regex:"(?:clockify).{0,40}\\b([a-zA-Z0-9]{48})\\b"},{name:"Clockworksms - 1",regex:"(?:clockwork|textanywhere).{0,40}\\b([0-9a-zA-Z]{24})\\b"},{name:"Clockworksms - 2",regex:"(?:clockwork|textanywhere).{0,40}\\b([0-9]{5})\\b"},{name:"Closecrm",regex:"\\b(api_[a-z0-9A-Z.]{45})\\b"},{name:"Cloudelements - 1",regex:"(?:cloudelements).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Cloudelements - 2",regex:"(?:cloudelements).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Cloudflareapitoken",regex:"(?:cloudflare).{0,40}\\b([A-Za-z0-9_-]{40})\\b"},{name:"Cloudflarecakey",regex:"(?:cloudflare).{0,40}\\b(v[A-Za-z0-9._-]{173,})\\b"},{name:"Cloudimage",regex:"(?:cloudimage).{0,40}\\b([a-z0-9_]{30})\\b"},{name:"Cloudinary Credentials",regex:"cloudinary://[0-9]+:[A-Za-z0-9\\-_\\.]+@[A-Za-z0-9\\-_\\.]+"},{name:"Cloudmersive",regex:"(?:cloudmersive).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Cloudplan",regex:"(?:cloudplan).{0,40}\\b([A-Z0-9-]{32})\\b"},{name:"Cloverly",regex:"(?:cloverly).{0,40}\\b([a-z0-9:_]{28})\\b"},{name:"Cloze - 1",regex:"(?:cloze).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Cloze - 2",regex:"(?:cloze).{0,40}\\b([\\w\\.-]+@[\\w-]+\\.[\\w\\.-]{2,5})\\b"},{name:"Clustdoc",regex:"(?:clustdoc).{0,40}\\b([0-9a-zA-Z]{60})\\b"},{name:"Codacy",regex:"(?:codacy).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Coinapi",regex:"(?:coinapi).{0,40}\\b([A-Z0-9-]{36})\\b"},{name:"Coinbase",regex:"(?:coinbase).{0,40}\\b([a-zA-Z-0-9]{64})\\b"},{name:"Coinlayer",regex:"(?:coinlayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Coinlib",regex:"(?:coinlib).{0,40}\\b([a-z0-9]{16})\\b"},{name:"Column",regex:"(?:column).{0,40}\\b((?:test|live)_[a-zA-Z0-9]{27})\\b"},{name:"Commercejs",regex:"(?:commercejs).{0,40}\\b([a-z0-9_]{48})\\b"},{name:"Commodities",regex:"(?:commodities).{0,40}\\b([a-zA-Z0-9]{60})\\b"},{name:"Companyhub - 1",regex:"(?:companyhub).{0,40}\\b([0-9a-zA-Z]{20})\\b"},{name:"Companyhub - 2",regex:"(?:companyhub).{0,40}\\b([a-zA-Z0-9$%^=-]{4,32})\\b"},{name:"Confluent - 1",regex:"(?:confluent).{0,40}\\b([a-zA-Z-0-9]{16})\\b"},{name:"Confluent - 2",regex:"(?:confluent).{0,40}\\b([a-zA-Z-0-9]{64})\\b"},{name:"Convertkit",regex:"(?:convertkit).{0,40}\\b([a-z0-9A-Z_]{22})\\b"},{name:"Convier",regex:"(?:convier).{0,40}\\b([0-9]{2}\\|[a-zA-Z0-9]{40})\\b"},{name:"Copper - 2",regex:"(?:copper).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Countrylayer",regex:"(?:countrylayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Courier",regex:"(?:courier).{0,40}\\b(pk\\_[a-zA-Z0-9]{1,}\\_[a-zA-Z0-9]{28})\\b"},{name:"Coveralls",regex:"(?:coveralls).{0,40}\\b([a-zA-Z0-9-]{37})\\b"},{name:"Crowdin",regex:"(?:crowdin).{0,40}\\b([0-9A-Za-z]{80})\\b"},{name:"Cryptocompare",regex:"(?:cryptocompare).{0,40}\\b([a-z-0-9]{64})\\b"},{name:"Currencycloud - 1",regex:"(?:currencycloud).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Currencyfreaks",regex:"(?:currencyfreaks).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Currencylayer",regex:"(?:currencylayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Currencyscoop",regex:"(?:currencyscoop).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Currentsapi",regex:"(?:currentsapi).{0,40}\\b([a-zA-Z0-9\\S]{48})\\b"},{name:"Customerguru - 1",regex:"(?:guru).{0,40}\\b([a-z0-9A-Z]{50})\\b"},{name:"Customerguru - 2",regex:"(?:guru).{0,40}\\b([a-z0-9A-Z]{30})\\b"},{name:"Customerio",regex:"(?:customer).{0,40}\\b([a-z0-9A-Z]{20})\\b"},{name:"D7network",regex:"(?:d7network).{0,40}\\b([a-zA-Z0-9\\W\\S]{23}\\=)"},{name:"Dailyco",regex:"(?:daily).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Dandelion",regex:"(?:dandelion).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Databricks",regex:"dapi[a-f0-9]{32}\\b"},{name:"Datadogtoken - 1",regex:"(?:datadog).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Datadogtoken - 2",regex:"(?:datadog).{0,40}\\b([a-zA-Z-0-9]{40})\\b"},{name:"Datafire",regex:"(?:datafire).{0,40}\\b([a-z0-9\\S]{175,190})\\b"},{name:"Datagov",regex:"(?:data.gov).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Debounce",regex:"(?:debounce).{0,40}\\b([a-zA-Z0-9]{13})\\b"},{name:"Deepai",regex:"(?:deepai).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Deepgram",regex:"(?:deepgram).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Delighted",regex:"(?:delighted).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Deputy - 1",regex:"\\b([0-9a-z]{1,}.as.deputy.com)\\b"},{name:"Deputy - 2",regex:"(?:deputy).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Detectlanguage",regex:"(?:detectlanguage).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Dfuse",regex:"\\b(web\\_[0-9a-z]{32})\\b"},{name:"Diffbot",regex:"(?:diffbot).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Digitaloceantoken",regex:"(?:digitalocean).{0,40}\\b([A-Za-z0-9_-]{64})\\b"},{name:"Discordbottoken - 1",regex:"(?:discord).{0,40}\\b([A-Za-z0-9_-]{24}\\.[A-Za-z0-9_-]{6}\\.[A-Za-z0-9_-]{27})\\b"},{name:"Discordbottoken - 2",regex:"(?:discord).{0,40}\\b([0-9]{17})\\b"},{name:"Discordwebhook",regex:"(https:\\/\\/discord.com\\/api\\/webhooks\\/[0-9]{18}\\/[0-9a-zA-Z-]{68})"},{name:"Ditto",regex:"(?:ditto).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12}\\.[a-z0-9]{40})\\b"},{name:"Dnscheck - 1",regex:"(?:dnscheck).{0,40}\\b([a-z0-9A-Z-]{36})\\b"},{name:"Dnscheck - 2",regex:"(?:dnscheck).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Documo",regex:"\\b(ey[a-zA-Z0-9]{34}.ey[a-zA-Z0-9]{154}.[a-zA-Z0-9_-]{43})\\b"},{name:"Doppler",regex:"\\b(dp\\.pt\\.[a-zA-Z0-9]{43})\\b"},{name:"Dotmailer - 1",regex:"(?:dotmailer).{0,40}\\b(apiuser-[a-z0-9]{12}@apiconnector.com)\\b"},{name:"Dotmailer - 2",regex:"(?:dotmailer).{0,40}\\b([a-zA-Z0-9\\S]{8,24})\\b"},{name:"Dovico",regex:"(?:dovico).{0,40}\\b([0-9a-z]{32}\\.[0-9a-z]{1,}\\b)"},{name:"Dronahq",regex:"(?:dronahq).{0,40}\\b([a-z0-9]{50})\\b"},{name:"Droneci",regex:"(?:droneci).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Dropbox",regex:"\\b(sl\\.[A-Za-z0-9\\-\\_]{130,140})\\b"},{name:"Dwolla",regex:"(?:dwolla).{0,40}\\b([a-zA-Z-0-9]{50})\\b"},{name:"Dynalist",regex:"(?:dynalist).{0,40}\\b([a-zA-Z0-9-_]{128})\\b"},{name:"Dynatrace token",regex:"dt0[a-zA-Z]{1}[0-9]{2}\\.[A-Z0-9]{24}\\.[A-Z0-9]{64}"},{name:"Dyspatch",regex:"(?:dyspatch).{0,40}\\b([A-Z0-9]{52})\\b"},{name:"EC",regex:"-----BEGIN EC PRIVATE KEY-----"},{name:"Eagleeyenetworks - 1",regex:"(?:eagleeyenetworks).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Eagleeyenetworks - 2",regex:"(?:eagleeyenetworks).{0,40}\\b([a-zA-Z0-9]{15})\\b"},{name:"Easyinsight - 1",regex:"(?:easyinsight|easy-insight).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Easyinsight - 2",regex:"(?:easyinsight|easy-insight).{0,40}\\b([0-9Aa-zA-Z]{20})\\b"},{name:"Edamam - 1",regex:"(?:edamam).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Edamam - 2",regex:"(?:edamam).{0,40}\\b([0-9a-z]{8})\\b"},{name:"Edenai",regex:"(?:edenai).{0,40}\\b([a-zA-Z0-9]{36}.[a-zA-Z0-9]{92}.[a-zA-Z0-9_]{43})\\b"},{name:"Eightxeight - 1",regex:"(?:8x8).{0,40}\\b([a-zA-Z0-9_]{18,30})\\b"},{name:"Eightxeight - 2",regex:"(?:8x8).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Elasticemail",regex:"(?:elastic).{0,40}\\b([A-Za-z0-9_-]{96})\\b"},{name:"Enablex - 1",regex:"(?:enablex).{0,40}\\b([a-zA-Z0-9]{36})\\b"},{name:"Enablex - 2",regex:"(?:enablex).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Enigma",regex:"(?:enigma).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Ethplorer",regex:"(?:ethplorer).{0,40}\\b([a-z0-9A-Z-]{22})\\b"},{name:"Etsyapikey",regex:"(?:etsy).{0,40}\\b([a-zA-Z-0-9]{24})\\b"},{name:"Everhour",regex:"(?:everhour).{0,40}\\b([0-9Aa-f]{4}-[0-9a-f]{4}-[0-9a-f]{6}-[0-9a-f]{6}-[0-9a-f]{8})\\b"},{name:"Exchangerateapi",regex:"(?:exchangerate).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Exchangeratesapi",regex:"(?:exchangerates).{0,40}\\b([a-z0-9]{32})\\b"},{name:"FCM Server Key",regex:"AAAA[a-zA-Z0-9_-]{7}:[a-zA-Z0-9_-]{140}"},{name:"FCM_server_key",regex:"(AAAA[a-zA-Z0-9_-]{7}:[a-zA-Z0-9_-]{140})"},{name:"Facebook Access Token",regex:"EAACEdEose0cBA[0-9A-Za-z]+"},{name:"Facebook OAuth",regex:`[fF][aA][cC][eE][bB][oO][oO][kK].*['|"][0-9a-f]{32}['|"]`},{name:"Facebookoauth",regex:"(?:facebook).{0,40}\\b([A-Za-z0-9]{32})\\b"},{name:"Faceplusplus",regex:"(?:faceplusplus).{0,40}\\b([0-9a-zA-Z_-]{32})\\b"},{name:"Fakejson",regex:"(?:fakejson).{0,40}\\b([a-zA-Z0-9]{22})\\b"},{name:"Fastforex",regex:"(?:fastforex).{0,40}\\b([a-z0-9-]{28})\\b"},{name:"Fastlypersonaltoken",regex:"(?:fastly).{0,40}\\b([A-Za-z0-9_-]{32})\\b"},{name:"Feedier",regex:"(?:feedier).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Fetchrss",regex:"(?:fetchrss).{0,40}\\b([0-9A-Za-z.]{40})\\b"},{name:"Figmapersonalaccesstoken",regex:"(?:figma).{0,40}\\b([0-9]{6}-[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Fileio",regex:"(?:fileio).{0,40}\\b([A-Z0-9.-]{39})\\b"},{name:"Finage",regex:"\\b(API_KEY[0-9A-Z]{32})\\b"},{name:"Financialmodelingprep",regex:"(?:financialmodelingprep).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Findl",regex:"(?:findl).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12})\\b"},{name:"Finnhub",regex:"(?:finnhub).{0,40}\\b([0-9a-z]{20})\\b"},{name:"Firebase Database Detect - 1",regex:"[a-z0-9.-]+\\.firebaseio\\.com"},{name:"Firebase Database Detect - 2",regex:"[a-z0-9.-]+\\.firebaseapp\\.com"},{name:"Fixerio",regex:"(?:fixer).{0,40}\\b([A-Za-z0-9]{32})\\b"},{name:"Flatio",regex:"(?:flat).{0,40}\\b([0-9a-z]{128})\\b"},{name:"Fleetbase",regex:"\\b(flb_live_[0-9a-zA-Z]{20})\\b"},{name:"Flickr",regex:"(?:flickr).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Flightapi",regex:"(?:flightapi).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Flightstats - 1",regex:"(?:flightstats).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Flightstats - 2",regex:"(?:flightstats).{0,40}\\b([0-9a-z]{8})\\b"},{name:"Float",regex:"(?:float).{0,40}\\b([a-zA-Z0-9-._+=]{59,60})\\b"},{name:"Flowflu - 2",regex:"(?:flowflu).{0,40}\\b([a-zA-Z0-9]{51})\\b"},{name:"Flutterwave",regex:"\\b(FLWSECK-[0-9a-z]{32}-X)\\b"},{name:"Fmfw - 1",regex:"(?:fmfw).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Fmfw - 2",regex:"(?:fmfw).{0,40}\\b([a-zA-Z0-9_-]{32})\\b"},{name:"Formbucket",regex:"(?:formbucket).{0,40}\\b([0-9A-Za-z]{1,}.[0-9A-Za-z]{1,}\\.[0-9A-Z-a-z\\-_]{1,})"},{name:"Formio",regex:"(?:formio).{0,40}\\b(eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9\\.[0-9A-Za-z]{310}\\.[0-9A-Z-a-z\\-_]{43}[ \\r\\n]{1})"},{name:"Foursquare",regex:"(?:foursquare).{0,40}\\b([0-9A-Z]{48})\\b"},{name:"Frameio",regex:"\\b(fio-u-[0-9a-zA-Z_-]{64})\\b"},{name:"Freshbooks - 1",regex:"(?:freshbooks).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Freshbooks - 2",regex:"(?:freshbooks).{0,40}\\b(https://www.[0-9A-Za-z_-]{1,}.com)\\b"},{name:"Freshdesk - 1",regex:"(?:freshdesk).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Freshdesk - 2",regex:"\\b([0-9a-z-]{1,}.freshdesk.com)\\b"},{name:"Front",regex:"(?:front).{0,40}\\b([0-9a-zA-Z]{36}.[0-9a-zA-Z\\.\\-\\_]{188,244})\\b"},{name:"Fulcrum",regex:"(?:fulcrum).{0,40}\\b([a-z0-9]{80})\\b"},{name:"Fullstory",regex:"(?:fullstory).{0,40}\\b([a-zA-Z-0-9/+]{88})\\b"},{name:"Fusebill",regex:"(?:fusebill).{0,40}\\b([a-zA-Z0-9]{88})\\b"},{name:"Fxmarket",regex:"(?:fxmarket).{0,40}\\b([0-9Aa-zA-Z-_=]{20})\\b"},{name:"Gcp",regex:"\\{[^{]+auth_provider_x509_cert_url[^}]+\\}"},{name:"Geckoboard",regex:"(?:geckoboard).{0,40}\\b([a-zA-Z0-9]{44})\\b"},{name:"Generic - 1376",regex:"jdbc:mysql(=| =|:| :)"},{name:"Generic - 1688",regex:"TOKEN[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1689",regex:"API[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1691",regex:"SECRET[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1692",regex:"AUTHORIZATION[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1693",regex:"PASSWORD[\\\\-|_|A-Z0-9]*(\\'|\\\")?(:|=)(\\'|\\\")?[\\\\-|_|A-Z0-9]{10}"},{name:"Generic - 1695",regex:`(A|a)(P|p)(Ii)[\\-|_|A-Za-z0-9]*(\\''|")?( )*(:|=)( )*(\\''|")?[0-9A-Za-z\\-_]+(\\''|")?`},{name:"Generic - 1700",regex:"BEGIN OPENSSH PRIVATE KEY"},{name:"Generic - 1701",regex:"BEGIN PRIVATE KEY"},{name:"Generic - 1702",regex:"BEGIN RSA PRIVATE KEY"},{name:"Generic - 1703",regex:"BEGIN DSA PRIVATE KEY"},{name:"Generic - 1704",regex:"BEGIN EC PRIVATE KEY"},{name:"Generic - 1705",regex:"BEGIN PGP PRIVATE KEY BLOCK"},{name:"Generic - 1707",regex:"[a-z0-9.-]+\\.s3-[a-z0-9-]\\.amazonaws\\.com"},{name:"Generic - 1708",regex:"[a-z0-9.-]+\\.s3-website[.-](eu|ap|us|ca|sa|cn)"},{name:"Generic - 1710",regex:"algolia_api_key"},{name:"Generic - 1711",regex:"asana_access_token"},{name:"Generic - 1713",regex:"azure_tenant"},{name:"Generic - 1714",regex:"bitly_access_token"},{name:"Generic - 1715",regex:"branchio_secret"},{name:"Generic - 1716",regex:"browserstack_access_key"},{name:"Generic - 1717",regex:"buildkite_access_token"},{name:"Generic - 1718",regex:"comcast_access_token"},{name:"Generic - 1719",regex:"datadog_api_key"},{name:"Generic - 1720",regex:"deviantart_secret"},{name:"Generic - 1721",regex:"deviantart_access_token"},{name:"Generic - 1722",regex:"dropbox_api_token"},{name:"Generic - 1723",regex:"facebook_appsecret"},{name:"Generic - 1724",regex:"facebook_access_token"},{name:"Generic - 1725",regex:"firebase_custom_token"},{name:"Generic - 1726",regex:"firebase_id_token"},{name:"Generic - 1727",regex:"github_client"},{name:"Generic - 1728",regex:"github_ssh_key"},{name:"Generic - 1730",regex:"gitlab_private_token"},{name:"Generic - 1731",regex:"google_cm"},{name:"Generic - 1732",regex:"google_maps_key"},{name:"Generic - 1733",regex:"heroku_api_key"},{name:"Generic - 1734",regex:"instagram_access_token"},{name:"Generic - 1735",regex:"mailchimp_api_key"},{name:"Generic - 1736",regex:"mailgun_api_key"},{name:"Generic - 1737",regex:"mailjet"},{name:"Generic - 1738",regex:"mapbox_access_token"},{name:"Generic - 1739",regex:"pagerduty_api_token"},{name:"Generic - 1740",regex:"paypal_key_sb"},{name:"Generic - 1741",regex:"paypal_key_live"},{name:"Generic - 1742",regex:"paypal_token_sb"},{name:"Generic - 1743",regex:"paypal_token_live"},{name:"Generic - 1744",regex:"pendo_integration_key"},{name:"Generic - 1745",regex:"salesforce_access_token"},{name:"Generic - 1746",regex:"saucelabs_ukey"},{name:"Generic - 1747",regex:"sendgrid_api_key"},{name:"Generic - 1748",regex:"slack_api_token"},{name:"Generic - 1749",regex:"slack_webhook"},{name:"Generic - 1750",regex:"square_secret"},{name:"Generic - 1751",regex:"square_auth_token"},{name:"Generic - 1752",regex:"travisci_api_token"},{name:"Generic - 1753",regex:"twilio_sid_token"},{name:"Generic - 1754",regex:"twitter_api_secret"},{name:"Generic - 1755",regex:"twitter_bearer_token"},{name:"Generic - 1756",regex:"spotify_access_token"},{name:"Generic - 1757",regex:"stripe_key_live"},{name:"Generic - 1758",regex:"wakatime_api_key"},{name:"Generic - 1759",regex:"wompi_auth_bearer_sb"},{name:"Generic - 1760",regex:"wompi_auth_bearer_live"},{name:"Generic - 1761",regex:"wpengine_api_key"},{name:"Generic - 1762",regex:"zapier_webhook"},{name:"Generic - 1763",regex:"zendesk_access_token"},{name:"Generic - 1764",regex:"ssh-rsa"},{name:"Generic - 1765",regex:"s3-[a-z0-9-]+\\.amazonaws\\.com/[a-z0-9._-]+"},{name:"Generic webhook secret",regex:"(webhook).+(secret|token|key).+"},{name:"Gengo",regex:"(?:gengo).{0,40}([ ]{0,1}[0-9a-zA-Z\\[\\]\\-\\(\\)\\{\\}|_^@$=~]{64}[ \\r\\n]{1})"},{name:"Geoapify",regex:"(?:geoapify).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Geocode",regex:"(?:geocode).{0,40}\\b([a-z0-9]{28})\\b"},{name:"Geocodify",regex:"(?:geocodify).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Geocodio - 2",regex:"(?:geocod).{0,40}\\b([a-z0-9]{39})\\b"},{name:"Geoipifi",regex:"(?:ipifi).{0,40}\\b([a-z0-9A-Z_]{32})\\b"},{name:"Getemail",regex:"(?:getemail).{0,40}\\b([a-zA-Z0-9-]{20})\\b"},{name:"Getemails - 1",regex:"(?:getemails).{0,40}\\b([a-z0-9-]{26})\\b"},{name:"Getemails - 2",regex:"(?:getemails).{0,40}\\b([a-z0-9-]{18})\\b"},{name:"Getgeoapi",regex:"(?:getgeoapi).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Getgist",regex:"(?:getgist).{0,40}\\b([a-z0-9A-Z+=]{68})"},{name:"Getsandbox - 1",regex:"(?:getsandbox).{0,40}\\b([a-z0-9-]{40})\\b"},{name:"Getsandbox - 2",regex:"(?:getsandbox).{0,40}\\b([a-z0-9-]{15,30})\\b"},{name:"GitHub",regex:`[gG][iI][tT][hH][uU][bB].*['|"][0-9a-zA-Z]{35,40}['|"]`},{name:"Github - 2",regex:"\\b((?:ghp|gho|ghu|ghs|ghr)_[a-zA-Z0-9]{36,255}\\b)"},{name:"Github App Token",regex:"(ghu|ghs)_[0-9a-zA-Z]{36}"},{name:"Github OAuth Access Token",regex:"gho_[0-9a-zA-Z]{36}"},{name:"Github Personal Access Token",regex:"ghp_[0-9a-zA-Z]{36}"},{name:"Github Refresh Token",regex:"ghr_[0-9a-zA-Z]{76}"},{name:"Github_old",regex:`(?:github)[^\\.].{0,40}[ =:'"]+([a-f0-9]{40})\\b`},{name:"Githubapp - 1",regex:"(?:github).{0,40}\\b([0-9]{6})\\b"},{name:"Githubapp - 2",regex:"(?:github).{0,40}(-----BEGIN RSA PRIVATE KEY-----\\s[A-Za-z0-9+\\/\\s]*\\s-----END RSA PRIVATE KEY-----)"},{name:"Gitlab",regex:"(?:gitlab).{0,40}\\b([a-zA-Z0-9\\-=_]{20,22})\\b"},{name:"Gitlabv2",regex:"\\b(glpat-[a-zA-Z0-9\\-=_]{20,22})\\b"},{name:"Gitter",regex:"(?:gitter).{0,40}\\b([a-z0-9-]{40})\\b"},{name:"Glassnode",regex:"(?:glassnode).{0,40}\\b([0-9A-Za-z]{27})\\b"},{name:"Gocanvas - 1",regex:"(?:gocanvas).{0,40}\\b([0-9A-Za-z/+]{43}=[ \\r\\n]{1})"},{name:"Gocanvas - 2",regex:"(?:gocanvas).{0,40}\\b([\\w\\.-]+@[\\w-]+\\.[\\w\\.-]{2,5})\\b"},{name:"Gocardless",regex:`\\b(live_[0-9A-Za-z\\_\\-]{40}[ "'\\r\\n]{1})`},{name:"Goodday",regex:"(?:goodday).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Google (GCP) Service Account",regex:'"type": "service_account"'},{name:"Google API Key",regex:"AIza[0-9a-z-_]{35}"},{name:"Google Calendar URI",regex:"https://www\\.google\\.com/calendar/embed\\?src=[A-Za-z0-9%@&;=\\-_\\./]+"},{name:"Graphcms - 1",regex:"(?:graph).{0,40}\\b([a-z0-9]{25})\\b"},{name:"Graphcms - 2",regex:"\\b(ey[a-zA-Z0-9]{73}.ey[a-zA-Z0-9]{365}.[a-zA-Z0-9_-]{683})\\b"},{name:"Graphhopper",regex:"(?:graphhopper).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Groovehq",regex:"(?:groove).{0,40}\\b([a-z0-9A-Z]{64})"},{name:"Guru - 1",regex:"(?:guru).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Guru - 2",regex:"(?:guru).{0,40}\\b([a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Gyazo",regex:"(?:gyazo).{0,40}\\b([0-9A-Za-z-]{43})\\b"},{name:"Happi",regex:"(?:happi).{0,40}\\b([a-zA-Z0-9]{56})"},{name:"Happyscribe",regex:"(?:happyscribe).{0,40}\\b([0-9a-zA-Z]{24})\\b"},{name:"Harvest - 1",regex:"(?:harvest).{0,40}\\b([a-z0-9A-Z._]{97})\\b"},{name:"Harvest - 2",regex:"(?:harvest).{0,40}\\b([0-9]{4,9})\\b"},{name:"Hellosign",regex:"(?:hellosign).{0,40}\\b([a-zA-Z-0-9/+]{64})\\b"},{name:"Helpcrunch",regex:"(?:helpcrunch).{0,40}\\b([a-zA-Z-0-9+/=]{328})"},{name:"Helpscout",regex:"(?:helpscout).{0,40}\\b([A-Za-z0-9]{56})\\b"},{name:"Hereapi",regex:"(?:hereapi).{0,40}\\b([a-zA-Z0-9\\S]{43})\\b"},{name:"Heroku",regex:"(?:heroku).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Hive - 1",regex:"(?:hive).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Hive - 2",regex:"(?:hive).{0,40}\\b([0-9A-Za-z]{17})\\b"},{name:"Hiveage",regex:"(?:hiveage).{0,40}\\b([0-9A-Za-z\\_\\-]{20})\\b"},{name:"Holidayapi",regex:"(?:holidayapi).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Host",regex:"(?:host).{0,40}\\b([a-z0-9]{14})\\b"},{name:"Html2pdf",regex:"(?:html2pdf).{0,40}\\b([a-zA-Z0-9]{64})\\b"},{name:"Hubspotapikey",regex:"(?:hubspot).{0,40}\\b([A-Za-z0-9]{8}\\-[A-Za-z0-9]{4}\\-[A-Za-z0-9]{4}\\-[A-Za-z0-9]{4}\\-[A-Za-z0-9]{12})\\b"},{name:"Humanity",regex:"(?:humanity).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Hunter",regex:"(?:hunter).{0,40}\\b([a-z0-9_-]{40})\\b"},{name:"Hypertrack - 1",regex:"(?:hypertrack).{0,40}\\b([0-9a-zA-Z\\_\\-]{54})\\b"},{name:"Hypertrack - 2",regex:"(?:hypertrack).{0,40}\\b([0-9a-zA-Z\\_\\-]{27})\\b"},{name:"Ibmclouduserkey",regex:"(?:ibm).{0,40}\\b([A-Za-z0-9_-]{44})\\b"},{name:"Iconfinder",regex:"(?:iconfinder).{0,40}\\b([a-zA-Z0-9]{64})\\b"},{name:"Iexcloud",regex:"(?:iexcloud).{0,40}\\b([a-z0-9_]{35})\\b"},{name:"Imagekit",regex:"(?:imagekit).{0,40}\\b([a-zA-Z0-9_=]{36})"},{name:"Imagga",regex:"(?:imagga).{0,40}\\b([a-z0-9A-Z=]{72})"},{name:"Impala",regex:"(?:impala).{0,40}\\b([0-9A-Za-z_]{46})\\b"},{name:"Insightly",regex:"(?:insightly).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Integromat",regex:"(?:integromat).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Intercom",regex:"(?:intercom).{0,40}\\b([a-zA-Z0-9\\W\\S]{59}\\=)"},{name:"Intrinio",regex:"(?:intrinio).{0,40}\\b([a-zA-Z0-9]{44})\\b"},{name:"Invoiceocean - 1",regex:"(?:invoiceocean).{0,40}\\b([0-9A-Za-z]{20})\\b"},{name:"Invoiceocean - 2",regex:"\\b([0-9a-z]{1,}.invoiceocean.com)\\b"},{name:"Ipapi",regex:"(?:ipapi).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Ipgeolocation",regex:"(?:ipgeolocation).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Ipify",regex:"(?:ipify).{0,40}\\b([a-zA-Z0-9_-]{32})\\b"},{name:"Ipinfodb",regex:"(?:ipinfodb).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Ipquality",regex:"(?:ipquality).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Ipstack",regex:"(?:ipstack).{0,40}\\b([a-fA-f0-9]{32})\\b"},{name:"JDBC Connection String",regex:"jdbc:[a-z:]+://[A-Za-z0-9\\.\\-_:;=/@?,&]+"},{name:"Jiratoken - 1",regex:"(?:jira).{0,40}\\b([a-zA-Z-0-9]{24})\\b"},{name:"Jiratoken - 2",regex:"(?:jira).{0,40}\\b([a-zA-Z-0-9]{5,24}\\@[a-zA-Z-0-9]{3,16}\\.com)\\b"},{name:"Jiratoken - 3",regex:"(?:jira).{0,40}\\b([a-zA-Z-0-9]{5,24}\\.[a-zA-Z-0-9]{3,16}\\.[a-zA-Z-0-9]{3,16})\\b"},{name:"Jotform",regex:"(?:jotform).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Jumpcloud",regex:"(?:jumpcloud).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Juro",regex:"(?:juro).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Kanban - 1",regex:"(?:kanban).{0,40}\\b([0-9A-Z]{12})\\b"},{name:"Kanban - 2",regex:"\\b([0-9a-z]{1,}.kanbantool.com)\\b"},{name:"Karmacrm",regex:"(?:karma).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Keenio - 1",regex:"(?:keen).{0,40}\\b([0-9a-z]{24})\\b"},{name:"Keenio - 2",regex:"(?:keen).{0,40}\\b([0-9A-Z]{64})\\b"},{name:"Kickbox",regex:"(?:kickbox).{0,40}\\b([a-zA-Z0-9_]+[a-zA-Z0-9]{64})\\b"},{name:"Klipfolio",regex:"(?:klipfolio).{0,40}\\b([0-9a-f]{40})\\b"},{name:"Kontent",regex:"(?:kontent).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Kraken - 1",regex:`(?:kraken).{0,40}\\b([0-9A-Za-z\\/\\+=]{56}[ "'\\r\\n]{1})`},{name:"Kraken - 2",regex:`(?:kraken).{0,40}\\b([0-9A-Za-z\\/\\+=]{86,88}[ "'\\r\\n]{1})`},{name:"Kucoin - 1",regex:"(?:kucoin).{0,40}([ \\r\\n]{1}[!-~]{7,32}[ \\r\\n]{1})"},{name:"Kucoin - 2",regex:"(?:kucoin).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Kucoin - 3",regex:"(?:kucoin).{0,40}\\b([0-9a-f]{24})\\b"},{name:"Kylas",regex:"(?:kylas).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Languagelayer",regex:"(?:languagelayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Lastfm",regex:"(?:lastfm).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Launchdarkly",regex:"(?:launchdarkly).{0,40}\\b([a-z0-9-]{40})\\b"},{name:"Leadfeeder",regex:"(?:leadfeeder).{0,40}\\b([a-zA-Z0-9-]{43})\\b"},{name:"Lendflow",regex:"(?:lendflow).{0,40}\\b([a-zA-Z0-9]{36}\\.[a-zA-Z0-9]{235}\\.[a-zA-Z0-9]{32}\\-[a-zA-Z0-9]{47}\\-[a-zA-Z0-9_]{162}\\-[a-zA-Z0-9]{42}\\-[a-zA-Z0-9_]{40}\\-[a-zA-Z0-9_]{66}\\-[a-zA-Z0-9_]{59}\\-[a-zA-Z0-9]{7}\\-[a-zA-Z0-9_]{220})\\b"},{name:"Lessannoyingcrm",regex:"(?:less).{0,40}\\b([a-zA-Z0-9-]{57})\\b"},{name:"Lexigram",regex:"(?:lexigram).{0,40}\\b([a-zA-Z0-9\\S]{301})\\b"},{name:"Linearapi",regex:"\\b(lin_api_[0-9A-Za-z]{40})\\b"},{name:"Linemessaging",regex:"(?:line).{0,40}\\b([A-Za-z0-9+/]{171,172})\\b"},{name:"Linenotify",regex:"(?:linenotify).{0,40}\\b([0-9A-Za-z]{43})\\b"},{name:"Linkpreview",regex:"(?:linkpreview).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Liveagent",regex:"(?:liveagent).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Livestorm",regex:"(?:livestorm).{0,40}\\b(eyJhbGciOiJIUzI1NiJ9\\.eyJhdWQiOiJhcGkubGl2ZXN0b3JtLmNvIiwianRpIjoi[0-9A-Z-a-z]{134}\\.[0-9A-Za-z\\-\\_]{43}[ \\r\\n]{1})"},{name:"Locationiq",regex:"\\b(pk\\.[a-zA-Z-0-9]{32})\\b"},{name:"Loginradius",regex:"(?:loginradius).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Lokalisetoken",regex:"(?:lokalise).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Loyverse",regex:"(?:loyverse).{0,40}\\b([0-9-a-z]{32})\\b"},{name:"Luno - 1",regex:"(?:luno).{0,40}\\b([a-z0-9]{13})\\b"},{name:"Luno - 2",regex:"(?:luno).{0,40}\\b([a-zA-Z0-9_-]{43})\\b"},{name:"M3o",regex:"(?:m3o).{0,40}\\b([0-9A-Za-z]{48})\\b"},{name:"Macaddress",regex:"(?:macaddress).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Madkudu",regex:"(?:madkudu).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Magnetic",regex:"(?:magnetic).{0,40}\\b([0-9Aa-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Mailboxlayer",regex:"(?:mailboxlayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mailerlite",regex:"(?:mailerlite).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mailgun - 2",regex:"(?:mailgun).{0,40}\\b([a-zA-Z-0-9]{72})\\b"},{name:"Mailgun API Key - 1",regex:"key-[0-9a-zA-Z]{32}"},{name:"Mailgun API key - 2",regex:"(mailgun|mg)[0-9a-z]{32}"},{name:"Mailjetbasicauth",regex:"(?:mailjet).{0,40}\\b([A-Za-z0-9]{87}\\=)"},{name:"Mailjetsms",regex:"(?:mailjet).{0,40}\\b([A-Za-z0-9]{32})\\b"},{name:"Mailmodo",regex:"(?:mailmodo).{0,40}\\b([A-Z0-9]{7}-[A-Z0-9]{7}-[A-Z0-9]{7}-[A-Z0-9]{7})\\b"},{name:"Mailsac",regex:"(?:mailsac).{0,40}\\b(k_[0-9A-Za-z]{36,})\\b"},{name:"Mandrill",regex:"(?:mandrill).{0,40}\\b([A-Za-z0-9_-]{22})\\b"},{name:"Manifest",regex:"(?:manifest).{0,40}\\b([a-zA-z0-9]{32})\\b"},{name:"Mapbox - 2",regex:"\\b(sk\\.[a-zA-Z-0-9\\.]{80,240})\\b"},{name:"Mapquest",regex:"(?:mapquest).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Marketstack",regex:"(?:marketstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mattermostpersonaltoken - 1",regex:"(?:mattermost).{0,40}\\b([A-Za-z0-9-_]{1,}.cloud.mattermost.com)\\b"},{name:"Mattermostpersonaltoken - 2",regex:"(?:mattermost).{0,40}\\b([a-z0-9]{26})\\b"},{name:"Mavenlink",regex:"(?:mavenlink).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Maxmindlicense - 1",regex:"(?:maxmind|geoip).{0,40}\\b([0-9A-Za-z]{16})\\b"},{name:"Maxmindlicense - 2",regex:"(?:maxmind|geoip).{0,40}\\b([0-9]{2,7})\\b"},{name:"Meaningcloud",regex:"(?:meaningcloud).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Mediastack",regex:"(?:mediastack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Meistertask",regex:"(?:meistertask).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Mesibo",regex:"(?:mesibo).{0,40}\\b([0-9A-Za-z]{64})\\b"},{name:"Messagebird",regex:"(?:messagebird).{0,40}\\b([A-Za-z0-9_-]{25})\\b"},{name:"Metaapi - 1",regex:"(?:metaapi|meta-api).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Metaapi - 2",regex:"(?:metaapi|meta-api).{0,40}\\b([0-9a-f]{24})\\b"},{name:"Metrilo",regex:"(?:metrilo).{0,40}\\b([a-z0-9]{16})\\b"},{name:"Microsoftteamswebhook",regex:"(https:\\/\\/[a-zA-Z-0-9]+\\.webhook\\.office\\.com\\/webhookb2\\/[a-zA-Z-0-9]{8}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{12}\\@[a-zA-Z-0-9]{8}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{12}\\/IncomingWebhook\\/[a-zA-Z-0-9]{32}\\/[a-zA-Z-0-9]{8}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{4}-[a-zA-Z-0-9]{12})"},{name:"Midise",regex:"midi-662b69edd2[a-zA-Z0-9]{54}"},{name:"Mindmeister",regex:"(?:mindmeister).{0,40}\\b([a-zA-Z0-9]{43})\\b"},{name:"Mite - 1",regex:"(?:mite).{0,40}\\b([0-9a-z]{16})\\b"},{name:"Mite - 2",regex:"\\b([0-9a-z-]{1,}.mite.yo.lk)\\b"},{name:"Mixmax",regex:"(?:mixmax).{0,40}\\b([a-zA-Z0-9_-]{36})\\b"},{name:"Mixpanel - 1",regex:"(?:mixpanel).{0,40}\\b([a-zA-Z0-9.-]{30,40})\\b"},{name:"Mixpanel - 2",regex:"(?:mixpanel).{0,40}\\b([a-zA-Z0-9-]{32})\\b"},{name:"Moderation",regex:"(?:moderation).{0,40}\\b([a-zA-Z0-9]{36}\\.[a-zA-Z0-9]{115}\\.[a-zA-Z0-9_]{43})\\b"},{name:"Monday",regex:"(?:monday).{0,40}\\b(ey[a-zA-Z0-9_.]{210,225})\\b"},{name:"Moonclerck",regex:"(?:moonclerck).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Moonclerk",regex:"(?:moonclerk).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Moosend",regex:"(?:moosend).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Mrticktock - 1",regex:"(?:mrticktock).{0,40}\\b([a-zA-Z0-9!=@#$%()_^]{1,50})"},{name:"Myfreshworks - 2",regex:"(?:freshworks).{0,40}\\b([a-z0-9A-Z-]{22})\\b"},{name:"Myintervals",regex:"(?:myintervals).{0,40}\\b([0-9a-z]{11})\\b"},{name:"Nasdaqdatalink",regex:"(?:nasdaq).{0,40}\\b([a-zA-Z0-9_-]{20})\\b"},{name:"Nethunt - 1",regex:"(?:nethunt).{0,40}\\b([a-zA-Z0-9.-@]{25,30})\\b"},{name:"Nethunt - 2",regex:"(?:nethunt).{0,40}\\b([a-z0-9-\\S]{36})\\b"},{name:"Netlify",regex:"(?:netlify).{0,40}\\b([A-Za-z0-9_-]{43,45})\\b"},{name:"Neutrinoapi - 1",regex:"(?:neutrinoapi).{0,40}\\b([a-zA-Z0-9]{48})\\b"},{name:"Neutrinoapi - 2",regex:"(?:neutrinoapi).{0,40}\\b([a-zA-Z0-9]{6,24})\\b"},{name:"Newrelic Admin API Key",regex:"NRAA-[a-f0-9]{27}"},{name:"Newrelic Insights API Key",regex:"NRI(?:I|Q)-[A-Za-z0-9\\-_]{32}"},{name:"Newrelic REST API Key",regex:"NRRA-[a-f0-9]{42}"},{name:"Newrelic Synthetics Location Key",regex:"NRSP-[a-z]{2}[0-9]{2}[a-f0-9]{31}"},{name:"Newrelicpersonalapikey",regex:"(?:newrelic).{0,40}\\b([A-Za-z0-9_\\.]{4}-[A-Za-z0-9_\\.]{42})\\b"},{name:"Newsapi",regex:"(?:newsapi).{0,40}\\b([a-z0-9]{32})"},{name:"Newscatcher",regex:"(?:newscatcher).{0,40}\\b([0-9A-Za-z_]{43})\\b"},{name:"Nexmoapikey - 1",regex:"(?:nexmo).{0,40}\\b([A-Za-z0-9_-]{8})\\b"},{name:"Nexmoapikey - 2",regex:"(?:nexmo).{0,40}\\b([A-Za-z0-9_-]{16})\\b"},{name:"Nftport",regex:"(?:nftport).{0,40}\\b([a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Nicereply",regex:"(?:nicereply).{0,40}\\b([0-9a-f]{40})\\b"},{name:"Nimble",regex:"(?:nimble).{0,40}\\b([a-zA-Z0-9]{30})\\b"},{name:"Nitro",regex:"(?:nitro).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Noticeable",regex:"(?:noticeable).{0,40}\\b([0-9a-zA-Z]{20})\\b"},{name:"Notion",regex:"\\b(secret_[A-Za-z0-9]{43})\\b"},{name:"Nozbeteams",regex:"(?:nozbe|nozbeteams).{0,40}\\b([0-9A-Za-z]{16}_[0-9A-Za-z\\-_]{64}[ \\r\\n]{1})"},{name:"Numverify",regex:"(?:numverify).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Nutritionix - 1",regex:"(?:nutritionix).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Nutritionix - 2",regex:"(?:nutritionix).{0,40}\\b([a-z0-9]{8})\\b"},{name:"Nylas",regex:"(?:nylas).{0,40}\\b([0-9A-Za-z]{30})\\b"},{name:"Nytimes",regex:"(?:nytimes).{0,40}\\b([a-z0-9A-Z-]{32})\\b"},{name:"Oanda",regex:"(?:oanda).{0,40}\\b([a-zA-Z0-9]{24})\\b"},{name:"Omnisend",regex:"(?:omnisend).{0,40}\\b([a-z0-9A-Z-]{75})\\b"},{name:"Onedesk - 1",regex:"(?:onedesk).{0,40}\\b([a-zA-Z0-9!=@#$%^]{8,64})"},{name:"Onelogin - 2",regex:`secret[a-zA-Z0-9_' "=]{0,20}([a-z0-9]{64})`},{name:"Onepagecrm - 1",regex:"(?:onepagecrm).{0,40}\\b([a-zA-Z0-9=]{44})"},{name:"Onepagecrm - 2",regex:"(?:onepagecrm).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Onwaterio",regex:"(?:onwater).{0,40}\\b([a-zA-Z0-9_-]{20})\\b"},{name:"Oopspam",regex:"(?:oopspam).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Opencagedata",regex:"(?:opencagedata).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Opengraphr",regex:"(?:opengraphr).{0,40}\\b([0-9Aa-zA-Z]{80})\\b"},{name:"Openuv",regex:"(?:openuv).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Openweather",regex:"(?:openweather).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Optimizely",regex:"(?:optimizely).{0,40}\\b([0-9A-Za-z-:]{54})\\b"},{name:"Owlbot",regex:"(?:owlbot).{0,40}\\b([a-z0-9]{40})\\b"},{name:"PGP private key block",regex:"-----BEGIN PGP PRIVATE KEY BLOCK-----"},{name:"Pagerdutyapikey",regex:"(?:pagerduty).{0,40}\\b([a-z]{1}\\+[a-zA-Z]{9}\\-[a-z]{2}\\-[a-z0-9]{5})\\b"},{name:"Pandadoc",regex:"(?:pandadoc).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Pandascore",regex:"(?:pandascore).{0,40}([ \\r\\n]{0,1}[0-9A-Za-z\\-\\_]{51}[ \\r\\n]{1})"},{name:"Paralleldots",regex:"(?:paralleldots).{0,40}\\b([0-9A-Za-z]{43})\\b"},{name:"Partnerstack",regex:"(?:partnerstack).{0,40}\\b([0-9A-Za-z]{64})\\b"},{name:"Passbase",regex:"(?:passbase).{0,40}\\b([a-zA-Z0-9]{128})\\b"},{name:"Pastebin",regex:"(?:pastebin).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"PayPal Braintree access token",regex:"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-f]{32}"},{name:"Paymoapp",regex:"(?:paymoapp).{0,40}\\b([a-zA-Z0-9]{44})\\b"},{name:"Paymongo",regex:"(?:paymongo).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Paypaloauth - 1",regex:"\\b([A-Za-z0-9_\\.]{7}-[A-Za-z0-9_\\.]{72})\\b"},{name:"Paypaloauth - 2",regex:"\\b([A-Za-z0-9_\\.]{69}-[A-Za-z0-9_\\.]{10})\\b"},{name:"Paystack",regex:"\\b(sk\\_[a-z]{1,}\\_[A-Za-z0-9]{40})\\b"},{name:"Pdflayer",regex:"(?:pdflayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Pdfshift",regex:"(?:pdfshift).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Peopledatalabs",regex:"(?:peopledatalabs).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Pepipost",regex:"(?:pepipost|netcore).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Picatic API key",regex:"sk_live_[0-9a-z]{32}"},{name:"Pipedream",regex:"(?:pipedream).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Pipedrive",regex:"(?:pipedrive).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Pivotaltracker",regex:"(?:pivotal).{0,40}([a-z0-9]{32})"},{name:"Pixabay",regex:"(?:pixabay).{0,40}\\b([a-z0-9-]{34})\\b"},{name:"Plaidkey - 1",regex:"(?:plaid).{0,40}\\b([a-z0-9]{24})\\b"},{name:"Plaidkey - 2",regex:"(?:plaid).{0,40}\\b([a-z0-9]{30})\\b"},{name:"Planviewleankit - 1",regex:"(?:planviewleankit|planview).{0,40}\\b([0-9a-f]{128})\\b"},{name:"Planviewleankit - 2",regex:"(?:planviewleankit|planview).{0,40}(?:subdomain).\\b([a-zA-Z][a-zA-Z0-9.-]{1,23}[a-zA-Z0-9])\\b"},{name:"Planyo",regex:"(?:planyo).{0,40}\\b([0-9a-z]{62})\\b"},{name:"Plivo - 1",regex:"(?:plivo).{0,40}\\b([A-Za-z0-9_-]{40})\\b"},{name:"Plivo - 2",regex:"(?:plivo).{0,40}\\b([A-Z]{20})\\b"},{name:"Poloniex - 1",regex:"(?:poloniex).{0,40}\\b([0-9a-f]{128})\\b"},{name:"Poloniex - 2",regex:"(?:poloniex).{0,40}\\b([0-9A-Z]{8}-[0-9A-Z]{8}-[0-9A-Z]{8}-[0-9A-Z]{8})\\b"},{name:"Polygon",regex:"(?:polygon).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Positionstack",regex:"(?:positionstack).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Postageapp",regex:"(?:postageapp).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Posthog",regex:"\\b(phc_[a-zA-Z0-9_]{43})\\b"},{name:"Postman",regex:"\\b(PMAK-[a-zA-Z-0-9]{59})\\b"},{name:"Postmark",regex:"(?:postmark).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Powrbot",regex:"(?:powrbot).{0,40}\\b([a-z0-9A-Z]{40})\\b"},{name:"Privatekey",regex:"-----\\s*?BEGIN[ A-Z0-9_-]*?PRIVATE KEY\\s*?-----[\\s\\S]*?----\\s*?END[ A-Z0-9_-]*? PRIVATE KEY\\s*?-----"},{name:"Prospectcrm",regex:"(?:prospect).{0,40}\\b([a-z0-9-]{32})\\b"},{name:"Prospectio",regex:"(?:prospect).{0,40}\\b([a-z0-9A-Z-]{50})\\b"},{name:"Protocolsio",regex:"(?:protocols).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Proxycrawl",regex:"(?:proxycrawl).{0,40}\\b([a-zA-Z0-9_]{22})\\b"},{name:"Pubnubpublishkey - 1",regex:"\\b(sub-c-[0-9a-z]{8}-[a-z]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Pubnubpublishkey - 2",regex:"\\b(pub-c-[0-9a-z]{8}-[0-9a-z]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})\\b"},{name:"Purestake",regex:"(?:purestake).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Pushbulletapikey",regex:"(?:pushbullet).{0,40}\\b([A-Za-z0-9_\\.]{34})\\b"},{name:"Pusherchannelkey - 1",regex:"(?:key).{0,40}\\b([a-z0-9]{20})\\b"},{name:"Pusherchannelkey - 2",regex:"(?:pusher).{0,40}\\b([a-z0-9]{20})\\b"},{name:"Pusherchannelkey - 3",regex:"(?:pusher).{0,40}\\b([0-9]{7})\\b"},{name:"PyPI upload token",regex:"pypi-AgEIcHlwaS5vcmc[A-Za-z0-9-_]{50,1000}"},{name:"Qualaroo",regex:"(?:qualaroo).{0,40}\\b([a-z0-9A-Z=]{64})"},{name:"Qubole",regex:"(?:qubole).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Quickmetrics",regex:"(?:quickmetrics).{0,40}\\b([a-zA-Z0-9_-]{22})\\b"},{name:"REDIS_URL",regex:"(REDIS_URL).+"},{name:"RKCS8",regex:"-----BEGIN PRIVATE KEY-----"},{name:"RSA private key",regex:"-----BEGIN RSA PRIVATE KEY-----"},{name:"Rapidapi",regex:"(?:rapidapi).{0,40}\\b([A-Za-z0-9_-]{50})\\b"},{name:"Raven",regex:"(?:raven).{0,40}\\b([A-Z0-9-]{16})\\b"},{name:"Rawg",regex:"(?:rawg).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Razorpay - 1",regex:"\\brzp_\\w{2,6}_\\w{10,20}\\b"},{name:"Readme",regex:"(?:readme).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Reallysimplesystems",regex:"\\b(ey[a-zA-Z0-9-._]{153}.ey[a-zA-Z0-9-._]{916,1000})\\b"},{name:"Rebrandly",regex:"(?:rebrandly).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Refiner",regex:"(?:refiner).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Repairshopr - 1",regex:"(?:repairshopr).{0,40}\\b([a-zA-Z0-9_.!+$#^*]{3,32})\\b"},{name:"Repairshopr - 2",regex:"(?:repairshopr).{0,40}\\b([a-zA-Z0-9-]{51})\\b"},{name:"Restpack",regex:"(?:restpack).{0,40}\\b([a-zA-Z0-9]{48})\\b"},{name:"Restpackhtmltopdfapi",regex:"(?:restpack).{0,40}\\b([0-9A-Za-z]{48})\\b"},{name:"Rev - 1",regex:"(?:rev).{0,40}\\b([0-9a-zA-Z\\/\\+]{27}\\=[ \\r\\n]{1})"},{name:"Rev - 2",regex:"(?:rev).{0,40}\\b([0-9a-zA-Z\\-]{27}[ \\r\\n]{1})"},{name:"Revampcrm - 1",regex:"(?:revamp).{0,40}\\b([a-zA-Z0-9]{40}\\b)"},{name:"Revampcrm - 2",regex:"(?:revamp).{0,40}\\b([a-zA-Z0-9.-@]{25,30})\\b"},{name:"Ringcentral - 1",regex:"(?:ringcentral).{0,40}\\b(https://www.[0-9A-Za-z_-]{1,}.com)\\b"},{name:"Ringcentral - 2",regex:"(?:ringcentral).{0,40}\\b([0-9A-Za-z_-]{22})\\b"},{name:"Ritekit",regex:"(?:ritekit).{0,40}\\b([0-9a-f]{44})\\b"},{name:"Roaring",regex:"(?:roaring).{0,40}\\b([0-9A-Za-z_-]{28})\\b"},{name:"Rocketreach",regex:"(?:rocketreach).{0,40}\\b([a-z0-9-]{39})\\b"},{name:"Roninapp - 1",regex:"(?:ronin).{0,40}\\b([0-9Aa-zA-Z]{3,32})\\b"},{name:"Roninapp - 2",regex:"(?:ronin).{0,40}\\b([0-9a-zA-Z]{26})\\b"},{name:"Route4me",regex:"(?:route4me).{0,40}\\b([0-9A-Z]{32})\\b"},{name:"Rownd - 1",regex:"(?:rownd).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12})\\b"},{name:"Rownd - 2",regex:"(?:rownd).{0,40}\\b([a-z0-9]{48})\\b"},{name:"Rownd - 3",regex:"(?:rownd).{0,40}\\b([0-9]{18})\\b"},{name:"Rubygems",regex:"\\b(rubygems_[a-zA0-9]{48})\\b"},{name:"Runrunit - 1",regex:"(?:runrunit).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Runrunit - 2",regex:"(?:runrunit).{0,40}\\b([0-9A-Za-z]{18,20})\\b"},{name:"SSH",regex:"-----BEGIN OPENSSH PRIVATE KEY-----"},{name:"SSH (DSA) private key",regex:"-----BEGIN DSA PRIVATE KEY-----"},{name:"Salesblink",regex:"(?:salesblink).{0,40}\\b([a-zA-Z]{16})\\b"},{name:"Salescookie",regex:"(?:salescookie).{0,40}\\b([a-zA-z0-9]{32})\\b"},{name:"Salesflare",regex:"(?:salesflare).{0,40}\\b([a-zA-Z0-9_]{45})\\b"},{name:"Satismeterprojectkey - 1",regex:"(?:satismeter).{0,40}\\b([a-zA-Z0-9]{4,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,12})\\b"},{name:"Satismeterprojectkey - 2",regex:"(?:satismeter).{0,40}\\b([a-zA-Z0-9]{24})\\b"},{name:"Satismeterprojectkey - 3",regex:"(?:satismeter).{0,40}\\b([a-zA-Z0-9!=@#$%^]{6,32})"},{name:"Satismeterwritekey",regex:"(?:satismeter).{0,40}\\b([a-z0-9A-Z]{16})\\b"},{name:"Saucelabs - 1",regex:"\\b(oauth\\-[a-z0-9]{8,}\\-[a-z0-9]{5})\\b"},{name:"Saucelabs - 2",regex:"(?:saucelabs).{0,40}\\b([a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{12})\\b"},{name:"Scalewaykey",regex:"(?:scaleway).{0,40}\\b([0-9a-z]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Scrapeowl",regex:"(?:scrapeowl).{0,40}\\b([0-9a-z]{30})\\b"},{name:"Scraperapi",regex:"(?:scraperapi).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scraperbox",regex:"(?:scraperbox).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Scrapersite",regex:"(?:scrapersite).{0,40}\\b([a-zA-Z0-9]{45})\\b"},{name:"Scrapestack",regex:"(?:scrapestack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scrapfly",regex:"(?:scrapfly).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scrapingant",regex:"(?:scrapingant).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Scrapingbee",regex:"(?:scrapingbee).{0,40}\\b([A-Z0-9]{80})\\b"},{name:"Screenshotapi",regex:"(?:screenshotapi).{0,40}\\b([0-9A-Z]{7}\\-[0-9A-Z]{7}\\-[0-9A-Z]{7}\\-[0-9A-Z]{7})\\b"},{name:"Screenshotlayer",regex:"(?:screenshotlayer).{0,40}\\b([a-zA-Z0-9_]{32})\\b"},{name:"Securitytrails",regex:"(?:securitytrails).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Segmentapikey",regex:"(?:segment).{0,40}\\b([A-Za-z0-9_\\-a-zA-Z]{43}\\.[A-Za-z0-9_\\-a-zA-Z]{43})\\b"},{name:"Selectpdf",regex:"(?:selectpdf).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Semaphore",regex:"(?:semaphore).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Sendbird - 1",regex:"(?:sendbird).{0,40}\\b([0-9a-f]{40})\\b"},{name:"Sendbird - 2",regex:"(?:sendbird).{0,40}\\b([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})\\b"},{name:"Sendbirdorganizationapi",regex:"(?:sendbird).{0,40}\\b([0-9a-f]{24})\\b"},{name:"Sendgrid",regex:"(SG\\.[\\w\\-_]{20,24}\\.[\\w\\-_]{39,50})\\b"},{name:"Sendinbluev2",regex:"\\b(xkeysib\\-[A-Za-z0-9_-]{81})\\b"},{name:"Sentiment - 1",regex:"(?:sentiment).{0,40}\\b([0-9]{17})\\b"},{name:"Sentiment - 2",regex:"(?:sentiment).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Sentrytoken",regex:"(?:sentry).{0,40}\\b([a-f0-9]{64})\\b"},{name:"Serphouse",regex:"(?:serphouse).{0,40}\\b([0-9A-Za-z]{60})\\b"},{name:"Serpstack",regex:"(?:serpstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Sheety - 1",regex:"(?:sheety).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Sheety - 2",regex:"(?:sheety).{0,40}\\b([0-9a-z]{64})\\b"},{name:"Sherpadesk",regex:"(?:sherpadesk).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Shipday",regex:"(?:shipday).{0,40}\\b([a-zA-Z0-9.]{11}[a-zA-Z0-9]{20})\\b"},{name:"Shodankey",regex:"(?:shodan).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Shopify custom app access token",regex:"shpca_[a-fA-F0-9]{32}"},{name:"Shopify private app access token",regex:"shppa_[a-fA-F0-9]{32}"},{name:"Shopify shared secret",regex:"shpss_[a-fA-F0-9]{32}"},{name:"Shoppable Service Auth",regex:"data-shoppable-auth-token.+"},{name:"Shortcut",regex:"(?:shortcut).{0,40}\\b([0-9a-f-]{36})\\b"},{name:"Shotstack",regex:"(?:shotstack).{0,40}\\b([a-zA-Z0-9]{40})\\b"},{name:"Shutterstock - 1",regex:"(?:shutterstock).{0,40}\\b([0-9a-zA-Z]{32})\\b"},{name:"Shutterstock - 2",regex:"(?:shutterstock).{0,40}\\b([0-9a-zA-Z]{16})\\b"},{name:"Shutterstockoauth",regex:"(?:shutterstock).{0,40}\\b(v2/[0-9A-Za-z]{388})\\b"},{name:"Signalwire - 1",regex:"\\b([0-9a-z-]{3,64}.signalwire.com)\\b"},{name:"Signalwire - 2",regex:"(?:signalwire).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"Signalwire - 3",regex:"(?:signalwire).{0,40}\\b([0-9A-Za-z]{50})\\b"},{name:"Signaturit",regex:"(?:signaturit).{0,40}\\b([0-9A-Za-z]{86})\\b"},{name:"Signupgenius",regex:"(?:signupgenius).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Sigopt",regex:"(?:sigopt).{0,40}\\b([A-Z0-9]{48})\\b"},{name:"Simplesat",regex:"(?:simplesat).{0,40}\\b([a-z0-9]{40})"},{name:"Simplynoted",regex:"(?:simplynoted).{0,40}\\b([a-zA-Z0-9\\S]{340,360})\\b"},{name:"Simvoly",regex:"(?:simvoly).{0,40}\\b([a-z0-9]{33})\\b"},{name:"Sinchmessage",regex:"(?:sinch).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Sirv - 1",regex:"(?:sirv).{0,40}\\b([a-zA-Z0-9\\S]{88})"},{name:"Sirv - 2",regex:"(?:sirv).{0,40}\\b([a-zA-Z0-9]{26})\\b"},{name:"Siteleaf",regex:"(?:siteleaf).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Skrappio",regex:"(?:skrapp).{0,40}\\b([a-z0-9A-Z]{42})\\b"},{name:"Skybiometry",regex:"(?:skybiometry).{0,40}\\b([0-9a-z]{25,26})\\b"},{name:"Slack",regex:"xox[baprs]-[0-9a-zA-Z-]{10,72}"},{name:"Slack Token",regex:"(xox[pborsa]-[0-9]{12}-[0-9]{12}-[0-9]{12}-[a-z0-9]{32})"},{name:"Slack User token",regex:"xoxp-[0-9A-Za-z\\-]{72}"},{name:"Slack Webhook",regex:"https://hooks.slack.com/services/T[a-zA-Z0-9_]{8,10}/B[a-zA-Z0-9_]{8,12}/[a-zA-Z0-9_]{23,24}"},{name:"Slack access token",regex:"xoxb-[0-9A-Za-z\\-]{51}"},{name:"Slackwebhook",regex:"(https:\\/\\/hooks.slack.com\\/services\\/[A-Za-z0-9+\\/]{44,46})"},{name:"Smartsheets",regex:"(?:smartsheets).{0,40}\\b([a-zA-Z0-9]{37})\\b"},{name:"Smartystreets - 1",regex:"(?:smartystreets).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Smartystreets - 2",regex:"(?:smartystreets).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Smooch - 1",regex:"(?:smooch).{0,40}\\b(act_[0-9a-z]{24})\\b"},{name:"Smooch - 2",regex:"(?:smooch).{0,40}\\b([0-9a-zA-Z_-]{86})\\b"},{name:"Snipcart",regex:"(?:snipcart).{0,40}\\b([0-9A-Za-z_]{75})\\b"},{name:"Snykkey",regex:"(?:snyk).{0,40}\\b([0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12})\\b"},{name:"SonarQube Token",regex:"sonar.{0,50}(?:\"|'|`)?[0-9a-f]{40}(?:\"|'|`)?"},{name:"Splunkobservabilitytoken",regex:"(?:splunk).{0,40}\\b([a-z0-9A-Z]{22})\\b"},{name:"Spoonacular",regex:"(?:spoonacular).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Sportsmonk",regex:"(?:sportsmonk).{0,40}\\b([0-9a-zA-Z]{60})\\b"},{name:"Square",regex:"(?:square).{0,40}(EAAA[a-zA-Z0-9\\-\\+\\=]{60})"},{name:"Square API Key",regex:"sq0(atp|csp)-[0-9a-z-_]{22,43}"},{name:"Squareapp - 1",regex:"[\\w\\-]*sq0i[a-z]{2}-[0-9A-Za-z\\-_]{22,43}"},{name:"Squareapp - 2",regex:"[\\w\\-]*sq0c[a-z]{2}-[0-9A-Za-z\\-_]{40,50}"},{name:"Squarespace",regex:"(?:squarespace).{0,40}\\b([0-9Aa-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Squareup",regex:"\\b(sq0idp-[0-9A-Za-z]{22})\\b"},{name:"Sslmate",regex:"(?:sslmate).{0,40}\\b([a-zA-Z0-9]{36})\\b"},{name:"Stitchdata",regex:"(?:stitchdata).{0,40}\\b([0-9a-z_]{35})\\b"},{name:"Stockdata",regex:"(?:stockdata).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Storecove",regex:"(?:storecove).{0,40}\\b([a-zA-Z0-9_-]{43})\\b"},{name:"Stormglass",regex:"(?:stormglass).{0,40}\\b([0-9Aa-z-]{73})\\b"},{name:"Storyblok",regex:"(?:storyblok).{0,40}\\b([0-9A-Za-z]{22}t{2})\\b"},{name:"Storychief",regex:"(?:storychief).{0,40}\\b([a-zA-Z0-9_\\-.]{940,1000})"},{name:"Strava - 1",regex:"(?:strava).{0,40}\\b([0-9]{5})\\b"},{name:"Strava - 2",regex:"(?:strava).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Streak",regex:"(?:streak).{0,40}\\b([0-9Aa-f]{32})\\b"},{name:"Stripe",regex:"[rs]k_live_[a-zA-Z0-9]{20,30}"},{name:"Stripe API Key - 1",regex:"sk_live_[0-9a-zA-Z]{24}"},{name:"Stripe API key - 2",regex:"stripe[sr]k_live_[0-9a-zA-Z]{24}"},{name:"Stripe API key - 3",regex:"stripe[sk|rk]_live_[0-9a-zA-Z]{24}"},{name:"Stripe Public Live Key",regex:"pk_live_[0-9a-z]{24}"},{name:"Stripe Public Test Key",regex:"pk_test_[0-9a-z]{24}"},{name:"Stripe Restriced Key",regex:"rk_(?:live|test)_[0-9a-zA-Z]{24}"},{name:"Stripe Restricted API Key",regex:"rk_live_[0-9a-zA-Z]{24}"},{name:"Stripe Secret Key",regex:"sk_(?:live|test)_[0-9a-zA-Z]{24}"},{name:"Stripe Secret Live Key",regex:"(sk|rk)_live_[0-9a-z]{24}"},{name:"Stripe Secret Test Key",regex:"(sk|rk)_test_[0-9a-z]{24}"},{name:"Stytch - 1",regex:"(?:stytch).{0,40}\\b([a-zA-Z0-9-_]{47}=)"},{name:"Stytch - 2",regex:"(?:stytch).{0,40}\\b([a-z0-9-]{49})\\b"},{name:"Sugester - 1",regex:"(?:sugester).{0,40}\\b([a-zA-Z0-9_.!+$#^*%]{3,32})\\b"},{name:"Sugester - 2",regex:"(?:sugester).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Sumologickey - 1",regex:"(?:sumo).{0,40}\\b([A-Za-z0-9]{14})\\b"},{name:"Sumologickey - 2",regex:"(?:sumo).{0,40}\\b([A-Za-z0-9]{64})\\b"},{name:"Supernotesapi",regex:"(?:supernotes).{0,40}([ \\r\\n]{0,1}[0-9A-Za-z\\-_]{43}[ \\r\\n]{1})"},{name:"Surveyanyplace - 1",regex:"(?:survey).{0,40}\\b([a-z0-9A-Z-]{36})\\b"},{name:"Surveyanyplace - 2",regex:"(?:survey).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Surveybot",regex:"(?:surveybot).{0,40}\\b([A-Za-z0-9-]{80})\\b"},{name:"Surveysparrow",regex:"(?:surveysparrow).{0,40}\\b([a-zA-Z0-9-_]{88})\\b"},{name:"Survicate",regex:"(?:survicate).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Swell - 1",regex:"(?:swell).{0,40}\\b([a-zA-Z0-9]{6,24})\\b"},{name:"Swell - 2",regex:"(?:swell).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Swiftype",regex:"(?:swiftype).{0,40}\\b([a-zA-z-0-9]{6}\\_[a-zA-z-0-9]{6}\\-[a-zA-z-0-9]{6})\\b"},{name:"Tallyfy",regex:"(?:tallyfy).{0,40}\\b([0-9A-Za-z]{36}\\.[0-9A-Za-z]{264}\\.[0-9A-Za-z\\-\\_]{683})\\b"},{name:"Tatumio",regex:"(?:tatum).{0,40}\\b([0-9a-z-]{36})\\b"},{name:"Taxjar",regex:"(?:taxjar).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Teamgate - 1",regex:"(?:teamgate).{0,40}\\b([a-z0-9]{40})\\b"},{name:"Teamgate - 2",regex:"(?:teamgate).{0,40}\\b([a-zA-Z0-9]{80})\\b"},{name:"Teamworkcrm",regex:"(?:teamwork|teamworkcrm).{0,40}\\b(tkn\\.v1_[0-9A-Za-z]{71}=[ \\r\\n]{1})"},{name:"Teamworkdesk",regex:"(?:teamwork|teamworkdesk).{0,40}\\b(tkn\\.v1_[0-9A-Za-z]{71}=[ \\r\\n]{1})"},{name:"Teamworkspaces",regex:"(?:teamwork|teamworkspaces).{0,40}\\b(tkn\\.v1_[0-9A-Za-z]{71}=[ \\r\\n]{1})"},{name:"Technicalanalysisapi",regex:"(?:technicalanalysisapi).{0,40}\\b([A-Z0-9]{48})\\b"},{name:"Telegram Bot API Key",regex:"[0-9]+:AA[0-9A-Za-z\\-_]{33}"},{name:"Telegram Secret",regex:"d{5,}:A[0-9a-z_-]{34,34}"},{name:"Telegrambottoken",regex:"(?:telegram).{0,40}\\b([0-9]{8,10}:[a-zA-Z0-9_-]{35})\\b"},{name:"Telnyx",regex:"(?:telnyx).{0,40}\\b(KEY[0-9A-Za-z_-]{55})\\b"},{name:"Terraformcloudpersonaltoken",regex:"\\b([A-Za-z0-9]{14}.atlasv1.[A-Za-z0-9]{67})\\b"},{name:"Text2data",regex:"(?:text2data).{0,40}\\b([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})\\b"},{name:"Textmagic - 1",regex:"(?:textmagic).{0,40}\\b([0-9A-Za-z]{30})\\b"},{name:"Textmagic - 2",regex:"(?:textmagic).{0,40}\\b([0-9A-Za-z]{1,25})\\b"},{name:"Theoddsapi",regex:"(?:theoddsapi|the-odds-api).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Thinkific - 1",regex:"(?:thinkific).{0,40}\\b([0-9a-f]{32})\\b"},{name:"Thinkific - 2",regex:"(?:thinkific).{0,40}\\b([0-9A-Za-z]{4,40})\\b"},{name:"Thousandeyes - 1",regex:"(?:thousandeyes).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Thousandeyes - 2",regex:"(?:thousandeyes).{0,40}\\b([a-zA-Z0-9]{3,20}@[a-zA-Z0-9]{2,12}.[a-zA-Z0-9]{2,5})\\b"},{name:"Ticketmaster",regex:"(?:ticketmaster).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Tiingo",regex:"(?:tiingo).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Timezoneapi",regex:"(?:timezoneapi).{0,40}\\b([a-zA-Z0-9]{20})\\b"},{name:"Tly",regex:"(?:tly).{0,40}\\b([0-9A-Za-z]{60})\\b"},{name:"Tmetric",regex:"(?:tmetric).{0,40}\\b([0-9A-Z]{64})\\b"},{name:"Todoist",regex:"(?:todoist).{0,40}\\b([0-9a-z]{40})\\b"},{name:"Toggltrack",regex:"(?:toggl).{0,40}\\b([0-9Aa-z]{32})\\b"},{name:"Tomorrowio",regex:"(?:tomorrow).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Tomtom",regex:"(?:tomtom).{0,40}\\b([0-9Aa-zA-Z]{32})\\b"},{name:"Tradier",regex:"(?:tradier).{0,40}\\b([a-zA-Z0-9]{28})\\b"},{name:"Travelpayouts",regex:"(?:travelpayouts).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Travisci",regex:"(?:travis).{0,40}\\b([a-zA-Z0-9A-Z_]{22})\\b"},{name:"Trello URL",regex:"https://trello.com/b/[0-9a-z]/[0-9a-z_-]+"},{name:"Trelloapikey - 2",regex:"(?:trello).{0,40}\\b([a-zA-Z-0-9]{32})\\b"},{name:"Twelvedata",regex:"(?:twelvedata).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Twilio - 1",regex:"\\bAC[0-9a-f]{32}\\b"},{name:"Twilio API Key",regex:"SK[0-9a-fA-F]{32}"},{name:"Twitter Access Token",regex:"[tT][wW][iI][tT][tT][eE][rR].*[1-9][0-9]+-[0-9a-zA-Z]{40}"},{name:"Twitter Client ID",regex:"twitter[0-9a-z]{18,25}"},{name:"Twitter OAuth",regex:`[tT][wW][iI][tT][tT][eE][rR].*['|"][0-9a-zA-Z]{35,44}['|"]`},{name:"Twitter Secret Key",regex:"twitter[0-9a-z]{35,44}"},{name:"Tyntec",regex:"(?:tyntec).{0,40}\\b([a-zA-Z0-9]{32})\\b"},{name:"Typeform",regex:"(?:typeform).{0,40}\\b([0-9A-Za-z]{44})\\b"},{name:"Ubidots",regex:"\\b(BBFF-[0-9a-zA-Z]{30})\\b"},{name:"Unifyid",regex:"(?:unify).{0,40}\\b([0-9A-Za-z_=-]{44})"},{name:"Unplugg",regex:"(?:unplu).{0,40}\\b([a-z0-9]{64})\\b"},{name:"Unsplash",regex:"(?:unsplash).{0,40}\\b([0-9A-Za-z_]{43})\\b"},{name:"Upcdatabase",regex:"(?:upcdatabase).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Uplead",regex:"(?:uplead).{0,40}\\b([a-z0-9-]{32})\\b"},{name:"Uploadcare",regex:"(?:uploadcare).{0,40}\\b([a-z0-9]{20})\\b"},{name:"Upwave",regex:"(?:upwave).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Uri",regex:"\\b[a-zA-Z]{1,10}:?\\/\\/[-.%\\w{}]{1,50}:([-.%\\S]{3,50})@[-.%\\w\\/:]+\\b"},{name:"Urlscan",regex:"(?:urlscan).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Userstack",regex:"(?:userstack).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Vatlayer",regex:"(?:vatlayer).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Vercel",regex:"(?:vercel).{0,40}\\b([a-zA-Z0-9]{24})\\b"},{name:"Verifier - 1",regex:"(?:verifier).{0,40}\\b([a-zA-Z-0-9-]{5,16}\\@[a-zA-Z-0-9]{4,16}\\.[a-zA-Z-0-9]{3,6})\\b"},{name:"Verifier - 2",regex:"(?:verifier).{0,40}\\b([a-z0-9]{96})\\b"},{name:"Verimail",regex:"(?:verimail).{0,40}\\b([A-Z0-9]{32})\\b"},{name:"Veriphone",regex:"(?:veriphone).{0,40}\\b([0-9A-Z]{32})\\b"},{name:"Versioneye",regex:"(?:versioneye).{0,40}\\b([a-zA-Z0-9-]{40})\\b"},{name:"Viewneo",regex:"(?:viewneo).{0,40}\\b([a-z0-9A-Z]{120,300}.[a-z0-9A-Z]{150,300}.[a-z0-9A-Z-_]{600,800})"},{name:"Virustotal",regex:"(?:virustotal).{0,40}\\b([a-f0-9]{64})\\b"},{name:"Visualcrossing",regex:"(?:visualcrossing).{0,40}\\b([0-9A-Z]{25})\\b"},{name:"Voicegain",regex:"(?:voicegain).{0,40}\\b(ey[0-9a-zA-Z_-]{34}.ey[0-9a-zA-Z_-]{108}.[0-9a-zA-Z_-]{43})\\b"},{name:"Vouchery - 1",regex:"(?:vouchery).{0,40}\\b([a-z0-9-]{36})\\b"},{name:"Vouchery - 2",regex:"(?:vouchery).{0,40}\\b([a-zA-Z0-9-\\S]{2,20})\\b"},{name:"Vpnapi",regex:"(?:vpnapi).{0,40}\\b([a-z0-9A-Z]{32})\\b"},{name:"Vultrapikey",regex:"(?:vultr).{0,40} \\b([A-Z0-9]{36})\\b"},{name:"Vyte",regex:"(?:vyte).{0,40}\\b([0-9a-z]{50})\\b"},{name:"Walkscore",regex:"(?:walkscore).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Weatherbit",regex:"(?:weatherbit).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Weatherstack",regex:"(?:weatherstack).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Webex - 1",regex:"(?:error).{0,40}(redirect_uri_mismatch)"},{name:"Webex - 2",regex:"(?:webex).{0,40}\\b([A-Za-z0-9_-]{65})\\b"},{name:"Webex - 3",regex:"(?:webex).{0,40}\\b([A-Za-z0-9_-]{64})\\b"},{name:"Webflow",regex:"(?:webflow).{0,40}\\b([a-zA0-9]{64})\\b"},{name:"Webscraper",regex:"(?:webscraper).{0,40}\\b([a-zA-Z0-9]{60})\\b"},{name:"Webscraping",regex:"(?:webscraping).{0,40}\\b([0-9A-Za-z]{32})\\b"},{name:"Wepay - 2",regex:"(?:wepay).{0,40}\\b([a-zA-Z0-9_?]{62})\\b"},{name:"Whoxy",regex:"(?:whoxy).{0,40}\\b([0-9a-z]{33})\\b"},{name:"Worksnaps",regex:"(?:worksnaps).{0,40}\\b([0-9A-Za-z]{40})\\b"},{name:"Workstack",regex:"(?:workstack).{0,40}\\b([0-9Aa-zA-Z]{60})\\b"},{name:"Worldcoinindex",regex:"(?:worldcoinindex).{0,40}\\b([a-zA-Z0-9]{35})\\b"},{name:"Worldweather",regex:"(?:worldweather).{0,40}\\b([0-9a-z]{31})\\b"},{name:"Wrike",regex:"(?:wrike).{0,40}\\b(ey[a-zA-Z0-9-._]{333})\\b"},{name:"Yandex",regex:"(?:yandex).{0,40}\\b([a-z0-9A-Z.]{83})\\b"},{name:"Youneedabudget",regex:"(?:youneedabudget).{0,40}\\b([0-9a-f]{64})\\b"},{name:"Yousign",regex:"(?:yousign).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Youtubeapikey - 1",regex:"(?:youtube).{0,40}\\b([a-zA-Z-0-9_]{39})\\b"},{name:"Zapier Webhook",regex:"https://(?:www.)?hooks\\.zapier\\.com/hooks/catch/[A-Za-z0-9]+/[A-Za-z0-9]+/"},{name:"Zapierwebhook",regex:"(https:\\/\\/hooks.zapier.com\\/hooks\\/catch\\/[A-Za-z0-9\\/]{16})"},{name:"Zendeskapi - 3",regex:"(?:zendesk).{0,40}([A-Za-z0-9_-]{40})"},{name:"Zenkitapi",regex:"(?:zenkit).{0,40}\\b([0-9a-z]{8}\\-[0-9A-Za-z]{32})\\b"},{name:"Zenscrape",regex:"(?:zenscrape).{0,40}\\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\\b"},{name:"Zenserp",regex:"(?:zenserp).{0,40}\\b([0-9a-z-]{36})\\b"},{name:"Zeplin",regex:"(?:zeplin).{0,40}\\b([a-zA-Z0-9-.]{350,400})\\b"},{name:"Zerobounce",regex:"(?:zerobounce).{0,40}\\b([a-z0-9]{32})\\b"},{name:"Zipapi - 1",regex:"(?:zipapi).{0,40}\\b([a-zA-Z0-9!=@#$%^]{7,})"},{name:"Zipapi - 3",regex:"(?:zipapi).{0,40}\\b([0-9a-z]{32})\\b"},{name:"Zipcodeapi",regex:"(?:zipcodeapi).{0,40}\\b([a-zA-Z0-9]{64})\\b"},{name:"Zoho Webhook",regex:"https://creator\\.zoho\\.com/api/[A-Za-z0-9/\\-_\\.]+\\?authtoken=[A-Za-z0-9]+"},{name:"Zonkafeedback",regex:"(?:zonka).{0,40}\\b([A-Za-z0-9]{36})\\b"},{name:"access_key_secret",regex:"access[_-]?key[_-]?secret(=| =|:| :)"},{name:"access_secret",regex:"access[_-]?secret(=| =|:| :)"},{name:"access_token",regex:"access[_-]?token(=| =|:| :)"},{name:"account_sid",regex:"account[_-]?sid(=| =|:| :)"},{name:"admin_email",regex:"admin[_-]?email(=| =|:| :)"},{name:"adzerk_api_key",regex:"adzerk[_-]?api[_-]?key(=| =|:| :)"},{name:"algolia_admin_key_1",regex:"algolia[_-]?admin[_-]?key[_-]?1(=| =|:| :)"},{name:"algolia_admin_key_2",regex:"algolia[_-]?admin[_-]?key[_-]?2(=| =|:| :)"},{name:"algolia_admin_key_mcm",regex:"algolia[_-]?admin[_-]?key[_-]?mcm(=| =|:| :)"},{name:"algolia_api_key",regex:"algolia[_-]?api[_-]?key(=| =|:| :)"},{name:"algolia_api_key_mcm",regex:"algolia[_-]?api[_-]?key[_-]?mcm(=| =|:| :)"},{name:"algolia_api_key_search",regex:"algolia[_-]?api[_-]?key[_-]?search(=| =|:| :)"},{name:"algolia_search_api_key",regex:"algolia[_-]?search[_-]?api[_-]?key(=| =|:| :)"},{name:"algolia_search_key",regex:"algolia[_-]?search[_-]?key(=| =|:| :)"},{name:"algolia_search_key_1",regex:"algolia[_-]?search[_-]?key[_-]?1(=| =|:| :)"},{name:"alias_pass",regex:"alias[_-]?pass(=| =|:| :)"},{name:"alicloud_access_key",regex:"alicloud[_-]?access[_-]?key(=| =|:| :)"},{name:"alicloud_secret_key",regex:"alicloud[_-]?secret[_-]?key(=| =|:| :)"},{name:"amazon_bucket_name",regex:"amazon[_-]?bucket[_-]?name(=| =|:| :)"},{name:"amazon_secret_access_key",regex:"amazon[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"anaconda_token",regex:"anaconda[_-]?token(=| =|:| :)"},{name:"android_docs_deploy_token",regex:"android[_-]?docs[_-]?deploy[_-]?token(=| =|:| :)"},{name:"ansible_vault_password",regex:"ansible[_-]?vault[_-]?password(=| =|:| :)"},{name:"aos_key",regex:"aos[_-]?key(=| =|:| :)"},{name:"aos_sec",regex:"aos[_-]?sec(=| =|:| :)"},{name:"api_key",regex:"api[_-]?key(=| =|:| :)"},{name:"api_key_secret",regex:"api[_-]?key[_-]?secret(=| =|:| :)"},{name:"api_key_sid",regex:"api[_-]?key[_-]?sid(=| =|:| :)"},{name:"api_secret",regex:"api[_-]?secret(=| =|:| :)"},{name:"apiary_api_key",regex:"apiary[_-]?api[_-]?key(=| =|:| :)"},{name:"apigw_access_token",regex:"apigw[_-]?access[_-]?token(=| =|:| :)"},{name:"apikey_patterns",regex:`apikey[:](?:['"]?[a-zA-Z0-9-_|]+['"]?)`},{name:"app_bucket_perm",regex:"app[_-]?bucket[_-]?perm(=| =|:| :)"},{name:"app_report_token_key",regex:"app[_-]?report[_-]?token[_-]?key(=| =|:| :)"},{name:"app_secrete",regex:"app[_-]?secrete(=| =|:| :)"},{name:"app_token",regex:"app[_-]?token(=| =|:| :)"},{name:"appclientsecret",regex:"appclientsecret(=| =|:| :)"},{name:"apple_id_password",regex:"apple[_-]?id[_-]?password(=| =|:| :)"},{name:"argos_token",regex:"argos[_-]?token(=| =|:| :)"},{name:"artifactory",regex:`(artifactory.{0,50}("|')?[a-zA-Z0-9=]{112}("|')?)`},{name:"artifactory_key",regex:"artifactory[_-]?key(=| =|:| :)"},{name:"artifacts_aws_access_key_id",regex:"artifacts[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"artifacts_aws_secret_access_key",regex:"artifacts[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"artifacts_bucket",regex:"artifacts[_-]?bucket(=| =|:| :)"},{name:"artifacts_key",regex:"artifacts[_-]?key(=| =|:| :)"},{name:"artifacts_secret",regex:"artifacts[_-]?secret(=| =|:| :)"},{name:"assistant_iam_apikey",regex:"assistant[_-]?iam[_-]?apikey(=| =|:| :)"},{name:"auth0_api_clientsecret",regex:"auth0[_-]?api[_-]?clientsecret(=| =|:| :)"},{name:"auth0_client_secret",regex:"auth0[_-]?client[_-]?secret(=| =|:| :)"},{name:"auth_token",regex:"auth[_-]?token(=| =|:| :)"},{name:"author_email_addr",regex:"author[_-]?email[_-]?addr(=| =|:| :)"},{name:"author_npm_api_key",regex:"author[_-]?npm[_-]?api[_-]?key(=| =|:| :)"},{name:"aws_access",regex:"aws[_-]?access(=| =|:| :)"},{name:"aws_access_key",regex:"aws[_-]?access[_-]?key(=| =|:| :)"},{name:"aws_access_key_id - 1",regex:"aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"aws_config_accesskeyid",regex:"aws[_-]?config[_-]?accesskeyid(=| =|:| :)"},{name:"aws_config_secretaccesskey",regex:"aws[_-]?config[_-]?secretaccesskey(=| =|:| :)"},{name:"aws_key",regex:"aws[_-]?key(=| =|:| :)"},{name:"aws_patterns",regex:"(?:accesskeyid|secretaccesskey|aws_access_key_id|aws_secret_access_key)"},{name:"aws_secret",regex:"aws[_-]?secret(=| =|:| :)"},{name:"aws_secret_access_key",regex:"aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"aws_secret_key",regex:"aws[_-]?secret[_-]?key(=| =|:| :)"},{name:"aws_secrets",regex:"aws[_-]?secrets(=| =|:| :)"},{name:"aws_ses_access_key_id",regex:"aws[_-]?ses[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"aws_ses_secret_access_key",regex:"aws[_-]?ses[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"awsaccesskeyid",regex:"awsaccesskeyid(=| =|:| :)"},{name:"awscn_access_key_id",regex:"awscn[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"awscn_secret_access_key",regex:"awscn[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"awssecretkey",regex:"awssecretkey(=| =|:| :)"},{name:"b2_app_key",regex:"b2[_-]?app[_-]?key(=| =|:| :)"},{name:"b2_bucket",regex:"b2[_-]?bucket(=| =|:| :)"},{name:"bintray_api_key",regex:"bintray[_-]?api[_-]?key(=| =|:| :)"},{name:"bintray_apikey",regex:"bintray[_-]?apikey(=| =|:| :)"},{name:"bintray_gpg_password",regex:"bintray[_-]?gpg[_-]?password(=| =|:| :)"},{name:"bintray_key",regex:"bintray[_-]?key(=| =|:| :)"},{name:"bintray_token",regex:"bintray[_-]?token(=| =|:| :)"},{name:"bintraykey",regex:"bintraykey(=| =|:| :)"},{name:"bluemix_api_key",regex:"bluemix[_-]?api[_-]?key(=| =|:| :)"},{name:"bluemix_auth",regex:"bluemix[_-]?auth(=| =|:| :)"},{name:"bluemix_pass",regex:"bluemix[_-]?pass(=| =|:| :)"},{name:"bluemix_pass_prod",regex:"bluemix[_-]?pass[_-]?prod(=| =|:| :)"},{name:"bluemix_password",regex:"bluemix[_-]?password(=| =|:| :)"},{name:"bluemix_pwd",regex:"bluemix[_-]?pwd(=| =|:| :)"},{name:"bluemix_username",regex:"bluemix[_-]?username(=| =|:| :)"},{name:"brackets_repo_oauth_token",regex:"brackets[_-]?repo[_-]?oauth[_-]?token(=| =|:| :)"},{name:"browser_stack_access_key",regex:"browser[_-]?stack[_-]?access[_-]?key(=| =|:| :)"},{name:"browserstack_access_key",regex:"browserstack[_-]?access[_-]?key(=| =|:| :)"},{name:"bucketeer_aws_access_key_id",regex:"bucketeer[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"bucketeer_aws_secret_access_key",regex:"bucketeer[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"built_branch_deploy_key",regex:"built[_-]?branch[_-]?deploy[_-]?key(=| =|:| :)"},{name:"bundlesize_github_token",regex:"bundlesize[_-]?github[_-]?token(=| =|:| :)"},{name:"bx_password",regex:"bx[_-]?password(=| =|:| :)"},{name:"bx_username",regex:"bx[_-]?username(=| =|:| :)"},{name:"cache_s3_secret_key",regex:"cache[_-]?s3[_-]?secret[_-]?key(=| =|:| :)"},{name:"cargo_token",regex:"cargo[_-]?token(=| =|:| :)"},{name:"cattle_access_key",regex:"cattle[_-]?access[_-]?key(=| =|:| :)"},{name:"cattle_agent_instance_auth",regex:"cattle[_-]?agent[_-]?instance[_-]?auth(=| =|:| :)"},{name:"cattle_secret_key",regex:"cattle[_-]?secret[_-]?key(=| =|:| :)"},{name:"censys_secret",regex:"censys[_-]?secret(=| =|:| :)"},{name:"certificate_password",regex:"certificate[_-]?password(=| =|:| :)"},{name:"cf_password",regex:"cf[_-]?password(=| =|:| :)"},{name:"cheverny_token",regex:"cheverny[_-]?token(=| =|:| :)"},{name:"chrome_client_secret",regex:"chrome[_-]?client[_-]?secret(=| =|:| :)"},{name:"chrome_refresh_token",regex:"chrome[_-]?refresh[_-]?token(=| =|:| :)"},{name:"ci_deploy_password",regex:"ci[_-]?deploy[_-]?password(=| =|:| :)"},{name:"ci_project_url",regex:"ci[_-]?project[_-]?url(=| =|:| :)"},{name:"ci_registry_user",regex:"ci[_-]?registry[_-]?user(=| =|:| :)"},{name:"ci_server_name",regex:"ci[_-]?server[_-]?name(=| =|:| :)"},{name:"ci_user_token",regex:"ci[_-]?user[_-]?token(=| =|:| :)"},{name:"claimr_database",regex:"claimr[_-]?database(=| =|:| :)"},{name:"claimr_db",regex:"claimr[_-]?db(=| =|:| :)"},{name:"claimr_superuser",regex:"claimr[_-]?superuser(=| =|:| :)"},{name:"claimr_token",regex:"claimr[_-]?token(=| =|:| :)"},{name:"cli_e2e_cma_token",regex:"cli[_-]?e2e[_-]?cma[_-]?token(=| =|:| :)"},{name:"client_secret",regex:"client[_-]?secret(=| =|:| :)"},{name:"clojars_password",regex:"clojars[_-]?password(=| =|:| :)"},{name:"cloud_api_key",regex:"cloud[_-]?api[_-]?key(=| =|:| :)"},{name:"cloudant_archived_database",regex:"cloudant[_-]?archived[_-]?database(=| =|:| :)"},{name:"cloudant_audited_database",regex:"cloudant[_-]?audited[_-]?database(=| =|:| :)"},{name:"cloudant_database",regex:"cloudant[_-]?database(=| =|:| :)"},{name:"cloudant_instance",regex:"cloudant[_-]?instance(=| =|:| :)"},{name:"cloudant_order_database",regex:"cloudant[_-]?order[_-]?database(=| =|:| :)"},{name:"cloudant_parsed_database",regex:"cloudant[_-]?parsed[_-]?database(=| =|:| :)"},{name:"cloudant_password",regex:"cloudant[_-]?password(=| =|:| :)"},{name:"cloudant_processed_database",regex:"cloudant[_-]?processed[_-]?database(=| =|:| :)"},{name:"cloudant_service_database",regex:"cloudant[_-]?service[_-]?database(=| =|:| :)"},{name:"cloudflare_api_key",regex:"cloudflare[_-]?api[_-]?key(=| =|:| :)"},{name:"cloudflare_auth_email",regex:"cloudflare[_-]?auth[_-]?email(=| =|:| :)"},{name:"cloudflare_auth_key",regex:"cloudflare[_-]?auth[_-]?key(=| =|:| :)"},{name:"cloudflare_email",regex:"cloudflare[_-]?email(=| =|:| :)"},{name:"cloudinary_url",regex:"cloudinary[_-]?url(=| =|:| :)"},{name:"cloudinary_url_staging",regex:"cloudinary[_-]?url[_-]?staging(=| =|:| :)"},{name:"clu_repo_url",regex:"clu[_-]?repo[_-]?url(=| =|:| :)"},{name:"clu_ssh_private_key_base64",regex:"clu[_-]?ssh[_-]?private[_-]?key[_-]?base64(=| =|:| :)"},{name:"cn_access_key_id",regex:"cn[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"cn_secret_access_key",regex:"cn[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"cocoapods_trunk_email",regex:"cocoapods[_-]?trunk[_-]?email(=| =|:| :)"},{name:"cocoapods_trunk_token",regex:"cocoapods[_-]?trunk[_-]?token(=| =|:| :)"},{name:"codacy_project_token",regex:"codacy[_-]?project[_-]?token(=| =|:| :)"},{name:"codeclimate",regex:`(codeclima.{0,50}("|')?[0-9a-f]{64}("|')?)`},{name:"codeclimate_repo_token",regex:"codeclimate[_-]?repo[_-]?token(=| =|:| :)"},{name:"codecov_token",regex:"codecov[_-]?token(=| =|:| :)"},{name:"coding_token",regex:"coding[_-]?token(=| =|:| :)"},{name:"conekta_apikey",regex:"conekta[_-]?apikey(=| =|:| :)"},{name:"consumer_key",regex:"consumer[_-]?key(=| =|:| :)"},{name:"consumerkey",regex:"consumerkey(=| =|:| :)"},{name:"contentful_access_token",regex:"contentful[_-]?access[_-]?token(=| =|:| :)"},{name:"contentful_cma_test_token",regex:"contentful[_-]?cma[_-]?test[_-]?token(=| =|:| :)"},{name:"contentful_integration_management_token",regex:"contentful[_-]?integration[_-]?management[_-]?token(=| =|:| :)"},{name:"contentful_php_management_test_token",regex:"contentful[_-]?php[_-]?management[_-]?test[_-]?token(=| =|:| :)"},{name:"contentful_test_org_cma_token",regex:"contentful[_-]?test[_-]?org[_-]?cma[_-]?token(=| =|:| :)"},{name:"contentful_v2_access_token",regex:"contentful[_-]?v2[_-]?access[_-]?token(=| =|:| :)"},{name:"conversation_password",regex:"conversation[_-]?password(=| =|:| :)"},{name:"conversation_username",regex:"conversation[_-]?username(=| =|:| :)"},{name:"cos_secrets",regex:"cos[_-]?secrets(=| =|:| :)"},{name:"coveralls_api_token",regex:"coveralls[_-]?api[_-]?token(=| =|:| :)"},{name:"coveralls_repo_token",regex:"coveralls[_-]?repo[_-]?token(=| =|:| :)"},{name:"coveralls_token",regex:"coveralls[_-]?token(=| =|:| :)"},{name:"coverity_scan_token",regex:"coverity[_-]?scan[_-]?token(=| =|:| :)"},{name:"cypress_record_key",regex:"cypress[_-]?record[_-]?key(=| =|:| :)"},{name:"danger_github_api_token",regex:"danger[_-]?github[_-]?api[_-]?token(=| =|:| :)"},{name:"database_host",regex:"database[_-]?host(=| =|:| :)"},{name:"database_name",regex:"database[_-]?name(=| =|:| :)"},{name:"database_password",regex:"database[_-]?password(=| =|:| :)"},{name:"database_port",regex:"database[_-]?port(=| =|:| :)"},{name:"database_user",regex:"database[_-]?user(=| =|:| :)"},{name:"database_username",regex:"database[_-]?username(=| =|:| :)"},{name:"datadog_api_key",regex:"datadog[_-]?api[_-]?key(=| =|:| :)"},{name:"datadog_app_key",regex:"datadog[_-]?app[_-]?key(=| =|:| :)"},{name:"db_connection",regex:"db[_-]?connection(=| =|:| :)"},{name:"db_database",regex:"db[_-]?database(=| =|:| :)"},{name:"db_host",regex:"db[_-]?host(=| =|:| :)"},{name:"db_password",regex:"db[_-]?password(=| =|:| :)"},{name:"db_pw",regex:"db[_-]?pw(=| =|:| :)"},{name:"db_user",regex:"db[_-]?user(=| =|:| :)"},{name:"db_username",regex:"db[_-]?username(=| =|:| :)"},{name:"ddg_test_email",regex:"ddg[_-]?test[_-]?email(=| =|:| :)"},{name:"ddg_test_email_pw",regex:"ddg[_-]?test[_-]?email[_-]?pw(=| =|:| :)"},{name:"ddgc_github_token",regex:"ddgc[_-]?github[_-]?token(=| =|:| :)"},{name:"deploy_password",regex:"deploy[_-]?password(=| =|:| :)"},{name:"deploy_secure",regex:"deploy[_-]?secure(=| =|:| :)"},{name:"deploy_token",regex:"deploy[_-]?token(=| =|:| :)"},{name:"deploy_user",regex:"deploy[_-]?user(=| =|:| :)"},{name:"dgpg_passphrase",regex:"dgpg[_-]?passphrase(=| =|:| :)"},{name:"digitalocean_access_token",regex:"digitalocean[_-]?access[_-]?token(=| =|:| :)"},{name:"digitalocean_ssh_key_body",regex:"digitalocean[_-]?ssh[_-]?key[_-]?body(=| =|:| :)"},{name:"digitalocean_ssh_key_ids",regex:"digitalocean[_-]?ssh[_-]?key[_-]?ids(=| =|:| :)"},{name:"docker_hub_password",regex:"docker[_-]?hub[_-]?password(=| =|:| :)"},{name:"docker_key",regex:"docker[_-]?key(=| =|:| :)"},{name:"docker_pass",regex:"docker[_-]?pass(=| =|:| :)"},{name:"docker_passwd",regex:"docker[_-]?passwd(=| =|:| :)"},{name:"docker_password",regex:"docker[_-]?password(=| =|:| :)"},{name:"docker_postgres_url",regex:"docker[_-]?postgres[_-]?url(=| =|:| :)"},{name:"docker_token",regex:"docker[_-]?token(=| =|:| :)"},{name:"dockerhub_password",regex:"dockerhub[_-]?password(=| =|:| :)"},{name:"dockerhubpassword",regex:"dockerhubpassword(=| =|:| :)"},{name:"doordash_auth_token",regex:"doordash[_-]?auth[_-]?token(=| =|:| :)"},{name:"dropbox_oauth_bearer",regex:"dropbox[_-]?oauth[_-]?bearer(=| =|:| :)"},{name:"droplet_travis_password",regex:"droplet[_-]?travis[_-]?password(=| =|:| :)"},{name:"dsonar_login",regex:"dsonar[_-]?login(=| =|:| :)"},{name:"dsonar_projectkey",regex:"dsonar[_-]?projectkey(=| =|:| :)"},{name:"elastic_cloud_auth",regex:"elastic[_-]?cloud[_-]?auth(=| =|:| :)"},{name:"elasticsearch_password",regex:"elasticsearch[_-]?password(=| =|:| :)"},{name:"encryption_password",regex:"encryption[_-]?password(=| =|:| :)"},{name:"end_user_password",regex:"end[_-]?user[_-]?password(=| =|:| :)"},{name:"env_github_oauth_token",regex:"env[_-]?github[_-]?oauth[_-]?token(=| =|:| :)"},{name:"env_heroku_api_key",regex:"env[_-]?heroku[_-]?api[_-]?key(=| =|:| :)"},{name:"env_key",regex:"env[_-]?key(=| =|:| :)"},{name:"env_secret",regex:"env[_-]?secret(=| =|:| :)"},{name:"env_secret_access_key",regex:"env[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"env_sonatype_password",regex:"env[_-]?sonatype[_-]?password(=| =|:| :)"},{name:"eureka_awssecretkey",regex:"eureka[_-]?awssecretkey(=| =|:| :)"},{name:"exp_password",regex:"exp[_-]?password(=| =|:| :)"},{name:"facebook_access_token",regex:"(EAACEdEose0cBA[0-9A-Za-z]+)"},{name:"facebook_oauth",regex:`[f|F][a|A][c|C][e|E][b|B][o|O][o|O][k|K].*['|"][0-9a-f]{32}['|"]`},{name:"file_password",regex:"file[_-]?password(=| =|:| :)"},{name:"firebase_api_json",regex:"firebase[_-]?api[_-]?json(=| =|:| :)"},{name:"firebase_api_token",regex:"firebase[_-]?api[_-]?token(=| =|:| :)"},{name:"firebase_key",regex:"firebase[_-]?key(=| =|:| :)"},{name:"firebase_project_develop",regex:"firebase[_-]?project[_-]?develop(=| =|:| :)"},{name:"firebase_token",regex:"firebase[_-]?token(=| =|:| :)"},{name:"firefox_secret",regex:"firefox[_-]?secret(=| =|:| :)"},{name:"flask_secret_key",regex:"flask[_-]?secret[_-]?key(=| =|:| :)"},{name:"flickr_api_key",regex:"flickr[_-]?api[_-]?key(=| =|:| :)"},{name:"flickr_api_secret",regex:"flickr[_-]?api[_-]?secret(=| =|:| :)"},{name:"fossa_api_key",regex:"fossa[_-]?api[_-]?key(=| =|:| :)"},{name:"ftp_host",regex:"ftp[_-]?host(=| =|:| :)"},{name:"ftp_login",regex:"ftp[_-]?login(=| =|:| :)"},{name:"ftp_password",regex:"ftp[_-]?password(=| =|:| :)"},{name:"ftp_pw",regex:"ftp[_-]?pw(=| =|:| :)"},{name:"ftp_user",regex:"ftp[_-]?user(=| =|:| :)"},{name:"ftp_username",regex:"ftp[_-]?username(=| =|:| :)"},{name:"gcloud_bucket",regex:"gcloud[_-]?bucket(=| =|:| :)"},{name:"gcloud_project",regex:"gcloud[_-]?project(=| =|:| :)"},{name:"gcloud_service_key",regex:"gcloud[_-]?service[_-]?key(=| =|:| :)"},{name:"gcr_password",regex:"gcr[_-]?password(=| =|:| :)"},{name:"gcs_bucket",regex:"gcs[_-]?bucket(=| =|:| :)"},{name:"gh_api_key",regex:"gh[_-]?api[_-]?key(=| =|:| :)"},{name:"gh_email",regex:"gh[_-]?email(=| =|:| :)"},{name:"gh_next_oauth_client_secret",regex:"gh[_-]?next[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"gh_next_unstable_oauth_client_id",regex:"gh[_-]?next[_-]?unstable[_-]?oauth[_-]?client[_-]?id(=| =|:| :)"},{name:"gh_next_unstable_oauth_client_secret",regex:"gh[_-]?next[_-]?unstable[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"gh_oauth_client_secret",regex:"gh[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"gh_oauth_token",regex:"gh[_-]?oauth[_-]?token(=| =|:| :)"},{name:"gh_repo_token",regex:"gh[_-]?repo[_-]?token(=| =|:| :)"},{name:"gh_token",regex:"gh[_-]?token(=| =|:| :)"},{name:"gh_unstable_oauth_client_secret",regex:"gh[_-]?unstable[_-]?oauth[_-]?client[_-]?secret(=| =|:| :)"},{name:"ghb_token",regex:"ghb[_-]?token(=| =|:| :)"},{name:"ghost_api_key",regex:"ghost[_-]?api[_-]?key(=| =|:| :)"},{name:"git_author_email",regex:"git[_-]?author[_-]?email(=| =|:| :)"},{name:"git_author_name",regex:"git[_-]?author[_-]?name(=| =|:| :)"},{name:"git_committer_email",regex:"git[_-]?committer[_-]?email(=| =|:| :)"},{name:"git_committer_name",regex:"git[_-]?committer[_-]?name(=| =|:| :)"},{name:"git_email",regex:"git[_-]?email(=| =|:| :)"},{name:"git_name",regex:"git[_-]?name(=| =|:| :)"},{name:"git_token",regex:"git[_-]?token(=| =|:| :)"},{name:"github_access_token - 1",regex:"github[_-]?access[_-]?token(=| =|:| :)"},{name:"github_access_token - 2",regex:"[a-zA-Z0-9_-]*:[a-zA-Z0-9_-]+@github.com*"},{name:"github_api_key",regex:"github[_-]?api[_-]?key(=| =|:| :)"},{name:"github_api_token",regex:"github[_-]?api[_-]?token(=| =|:| :)"},{name:"github_auth",regex:"github[_-]?auth(=| =|:| :)"},{name:"github_auth_token",regex:"github[_-]?auth[_-]?token(=| =|:| :)"},{name:"github_client_secret",regex:"github[_-]?client[_-]?secret(=| =|:| :)"},{name:"github_deploy_hb_doc_pass",regex:"github[_-]?deploy[_-]?hb[_-]?doc[_-]?pass(=| =|:| :)"},{name:"github_deployment_token",regex:"github[_-]?deployment[_-]?token(=| =|:| :)"},{name:"github_hunter_token",regex:"github[_-]?hunter[_-]?token(=| =|:| :)"},{name:"github_hunter_username",regex:"github[_-]?hunter[_-]?username(=| =|:| :)"},{name:"github_key",regex:"github[_-]?key(=| =|:| :)"},{name:"github_oauth",regex:"github[_-]?oauth(=| =|:| :)"},{name:"github_oauth_token",regex:"github[_-]?oauth[_-]?token(=| =|:| :)"},{name:"github_password",regex:"github[_-]?password(=| =|:| :)"},{name:"github_pwd",regex:"github[_-]?pwd(=| =|:| :)"},{name:"github_release_token",regex:"github[_-]?release[_-]?token(=| =|:| :)"},{name:"github_repo",regex:"github[_-]?repo(=| =|:| :)"},{name:"github_token",regex:"github[_-]?token(=| =|:| :)"},{name:"github_tokens",regex:"github[_-]?tokens(=| =|:| :)"},{name:"gitlab_user_email",regex:"gitlab[_-]?user[_-]?email(=| =|:| :)"},{name:"gogs_password",regex:"gogs[_-]?password(=| =|:| :)"},{name:"google_account_type",regex:"google[_-]?account[_-]?type(=| =|:| :)"},{name:"google_client_email",regex:"google[_-]?client[_-]?email(=| =|:| :)"},{name:"google_client_id",regex:"google[_-]?client[_-]?id(=| =|:| :)"},{name:"google_client_secret",regex:"google[_-]?client[_-]?secret(=| =|:| :)"},{name:"google_maps_api_key",regex:"google[_-]?maps[_-]?api[_-]?key(=| =|:| :)"},{name:"google_oauth",regex:"(ya29.[0-9A-Za-z-_]+)"},{name:"google_patterns",regex:"(?:google_client_id|google_client_secret|google_client_token)"},{name:"google_private_key",regex:"google[_-]?private[_-]?key(=| =|:| :)"},{name:"google_url",regex:"([0-9]{12}-[a-z0-9]{32}.apps.googleusercontent.com)"},{name:"gpg_key_name",regex:"gpg[_-]?key[_-]?name(=| =|:| :)"},{name:"gpg_keyname",regex:"gpg[_-]?keyname(=| =|:| :)"},{name:"gpg_ownertrust",regex:"gpg[_-]?ownertrust(=| =|:| :)"},{name:"gpg_passphrase",regex:"gpg[_-]?passphrase(=| =|:| :)"},{name:"gpg_private_key",regex:"gpg[_-]?private[_-]?key(=| =|:| :)"},{name:"gpg_secret_keys",regex:"gpg[_-]?secret[_-]?keys(=| =|:| :)"},{name:"gradle_publish_key",regex:"gradle[_-]?publish[_-]?key(=| =|:| :)"},{name:"gradle_publish_secret",regex:"gradle[_-]?publish[_-]?secret(=| =|:| :)"},{name:"gradle_signing_key_id",regex:"gradle[_-]?signing[_-]?key[_-]?id(=| =|:| :)"},{name:"gradle_signing_password",regex:"gradle[_-]?signing[_-]?password(=| =|:| :)"},{name:"gren_github_token",regex:"gren[_-]?github[_-]?token(=| =|:| :)"},{name:"grgit_user",regex:"grgit[_-]?user(=| =|:| :)"},{name:"hab_auth_token",regex:"hab[_-]?auth[_-]?token(=| =|:| :)"},{name:"hab_key",regex:"hab[_-]?key(=| =|:| :)"},{name:"hb_codesign_gpg_pass",regex:"hb[_-]?codesign[_-]?gpg[_-]?pass(=| =|:| :)"},{name:"hb_codesign_key_pass",regex:"hb[_-]?codesign[_-]?key[_-]?pass(=| =|:| :)"},{name:"heroku_api_key",regex:"heroku[_-]?api[_-]?key(=| =|:| :)"},{name:"heroku_api_key_api_key",regex:"([h|H][e|E][r|R][o|O][k|K][u|U].{0,30}[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})"},{name:"heroku_email",regex:"heroku[_-]?email(=| =|:| :)"},{name:"heroku_token",regex:"heroku[_-]?token(=| =|:| :)"},{name:"hockeyapp",regex:`hockey.{0,50}("|')?[0-9a-f]{32}("|')?`},{name:"hockeyapp_token",regex:"hockeyapp[_-]?token(=| =|:| :)"},{name:"homebrew_github_api_token",regex:"homebrew[_-]?github[_-]?api[_-]?token(=| =|:| :)"},{name:"hub_dxia2_password",regex:"hub[_-]?dxia2[_-]?password(=| =|:| :)"},{name:"ij_repo_password",regex:"ij[_-]?repo[_-]?password(=| =|:| :)"},{name:"ij_repo_username",regex:"ij[_-]?repo[_-]?username(=| =|:| :)"},{name:"index_name",regex:"index[_-]?name(=| =|:| :)"},{name:"integration_test_api_key",regex:"integration[_-]?test[_-]?api[_-]?key(=| =|:| :)"},{name:"integration_test_appid",regex:"integration[_-]?test[_-]?appid(=| =|:| :)"},{name:"internal_secrets",regex:"internal[_-]?secrets(=| =|:| :)"},{name:"ios_docs_deploy_token",regex:"ios[_-]?docs[_-]?deploy[_-]?token(=| =|:| :)"},{name:"itest_gh_token",regex:"itest[_-]?gh[_-]?token(=| =|:| :)"},{name:"jdbc",regex:"mysql: jdbc:mysql(=| =|:| :)"},{name:"jdbc_databaseurl",regex:"jdbc[_-]?databaseurl(=| =|:| :)"},{name:"jdbc_host",regex:"jdbc[_-]?host(=| =|:| :)"},{name:"jwt_secret",regex:"jwt[_-]?secret(=| =|:| :)"},{name:"kafka_admin_url",regex:"kafka[_-]?admin[_-]?url(=| =|:| :)"},{name:"kafka_instance_name",regex:"kafka[_-]?instance[_-]?name(=| =|:| :)"},{name:"kafka_rest_url",regex:"kafka[_-]?rest[_-]?url(=| =|:| :)"},{name:"keystore_pass",regex:"keystore[_-]?pass(=| =|:| :)"},{name:"kovan_private_key",regex:"kovan[_-]?private[_-]?key(=| =|:| :)"},{name:"kubecfg_s3_path",regex:"kubecfg[_-]?s3[_-]?path(=| =|:| :)"},{name:"kubeconfig",regex:"kubeconfig(=| =|:| :)"},{name:"kxoltsn3vogdop92m",regex:"kxoltsn3vogdop92m(=| =|:| :)"},{name:"leanplum_key",regex:"leanplum[_-]?key(=| =|:| :)"},{name:"lektor_deploy_password",regex:"lektor[_-]?deploy[_-]?password(=| =|:| :)"},{name:"lektor_deploy_username",regex:"lektor[_-]?deploy[_-]?username(=| =|:| :)"},{name:"lighthouse_api_key",regex:"lighthouse[_-]?api[_-]?key(=| =|:| :)"},{name:"linux_signing_key",regex:"linux[_-]?signing[_-]?key(=| =|:| :)"},{name:"ll_publish_url",regex:"ll[_-]?publish[_-]?url(=| =|:| :)"},{name:"ll_shared_key",regex:"ll[_-]?shared[_-]?key(=| =|:| :)"},{name:"looker_test_runner_client_secret",regex:"looker[_-]?test[_-]?runner[_-]?client[_-]?secret(=| =|:| :)"},{name:"lottie_happo_api_key",regex:"lottie[_-]?happo[_-]?api[_-]?key(=| =|:| :)"},{name:"lottie_happo_secret_key",regex:"lottie[_-]?happo[_-]?secret[_-]?key(=| =|:| :)"},{name:"lottie_s3_secret_key",regex:"lottie[_-]?s3[_-]?secret[_-]?key(=| =|:| :)"},{name:"lottie_upload_cert_key_password",regex:"lottie[_-]?upload[_-]?cert[_-]?key[_-]?password(=| =|:| :)"},{name:"lottie_upload_cert_key_store_password",regex:"lottie[_-]?upload[_-]?cert[_-]?key[_-]?store[_-]?password(=| =|:| :)"},{name:"magento_auth_password",regex:"magento[_-]?auth[_-]?password(=| =|:| :)"},{name:"magento_auth_username",regex:"magento[_-]?auth[_-]?username (=| =|:| :)"},{name:"magento_password",regex:"magento[_-]?password(=| =|:| :)"},{name:"mail_password",regex:"mail[_-]?password(=| =|:| :)"},{name:"mailchimp",regex:"(W(?:[a-f0-9]{32}(-us[0-9]{1,2}))a-zA-Z0-9)"},{name:"mailchimp_api_key",regex:"mailchimp[_-]?api[_-]?key(=| =|:| :)"},{name:"mailchimp_key",regex:"mailchimp[_-]?key(=| =|:| :)"},{name:"mailer_password",regex:"mailer[_-]?password(=| =|:| :)"},{name:"mailgun",regex:"(key-[0-9a-f]{32})"},{name:"mailgun_api_key",regex:"mailgun[_-]?api[_-]?key(=| =|:| :)"},{name:"mailgun_apikey",regex:"mailgun[_-]?apikey(=| =|:| :)"},{name:"mailgun_password",regex:"mailgun[_-]?password(=| =|:| :)"},{name:"mailgun_priv_key",regex:"mailgun[_-]?priv[_-]?key(=| =|:| :)"},{name:"mailgun_pub_apikey",regex:"mailgun[_-]?pub[_-]?apikey(=| =|:| :)"},{name:"mailgun_pub_key",regex:"mailgun[_-]?pub[_-]?key(=| =|:| :)"},{name:"mailgun_secret_api_key",regex:"mailgun[_-]?secret[_-]?api[_-]?key(=| =|:| :)"},{name:"manage_key",regex:"manage[_-]?key(=| =|:| :)"},{name:"manage_secret",regex:"manage[_-]?secret(=| =|:| :)"},{name:"management_token",regex:"management[_-]?token(=| =|:| :)"},{name:"managementapiaccesstoken",regex:"managementapiaccesstoken(=| =|:| :)"},{name:"mandrill_api_key",regex:"mandrill[_-]?api[_-]?key(=| =|:| :)"},{name:"manifest_app_token",regex:"manifest[_-]?app[_-]?token(=| =|:| :)"},{name:"manifest_app_url",regex:"manifest[_-]?app[_-]?url(=| =|:| :)"},{name:"mapbox_access_token",regex:"mapbox[_-]?access[_-]?token(=| =|:| :)"},{name:"mapbox_api_token",regex:"mapbox[_-]?api[_-]?token(=| =|:| :)"},{name:"mapbox_aws_access_key_id",regex:"mapbox[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"mapbox_aws_secret_access_key",regex:"mapbox[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"mapboxaccesstoken",regex:"mapboxaccesstoken(=| =|:| :)"},{name:"master_password",regex:"(master_password).+"},{name:"mg_api_key",regex:"mg[_-]?api[_-]?key(=| =|:| :)"},{name:"mg_public_api_key",regex:"mg[_-]?public[_-]?api[_-]?key(=| =|:| :)"},{name:"mh_apikey",regex:"mh[_-]?apikey(=| =|:| :)"},{name:"mh_password",regex:"mh[_-]?password(=| =|:| :)"},{name:"mile_zero_key",regex:"mile[_-]?zero[_-]?key(=| =|:| :)"},{name:"minio_access_key",regex:"minio[_-]?access[_-]?key(=| =|:| :)"},{name:"minio_secret_key",regex:"minio[_-]?secret[_-]?key(=| =|:| :)"},{name:"multi_bob_sid",regex:"multi[_-]?bob[_-]?sid(=| =|:| :)"},{name:"multi_connect_sid",regex:"multi[_-]?connect[_-]?sid(=| =|:| :)"},{name:"multi_disconnect_sid",regex:"multi[_-]?disconnect[_-]?sid(=| =|:| :)"},{name:"multi_workflow_sid",regex:"multi[_-]?workflow[_-]?sid(=| =|:| :)"},{name:"multi_workspace_sid",regex:"multi[_-]?workspace[_-]?sid(=| =|:| :)"},{name:"my_secret_env",regex:"my[_-]?secret[_-]?env(=| =|:| :)"},{name:"mysql_database",regex:"mysql[_-]?database(=| =|:| :)"},{name:"mysql_hostname",regex:"mysql[_-]?hostname(=| =|:| :)"},{name:"mysql_password",regex:"mysql[_-]?password(=| =|:| :)"},{name:"mysql_root_password",regex:"mysql[_-]?root[_-]?password(=| =|:| :)"},{name:"mysql_user",regex:"mysql[_-]?user(=| =|:| :)"},{name:"mysql_username",regex:"mysql[_-]?username(=| =|:| :)"},{name:"mysqlmasteruser",regex:"mysqlmasteruser(=| =|:| :)"},{name:"mysqlsecret",regex:"mysqlsecret(=| =|:| :)"},{name:"nativeevents",regex:"nativeevents(=| =|:| :)"},{name:"netlify_api_key",regex:"netlify[_-]?api[_-]?key(=| =|:| :)"},{name:"new_relic_beta_token",regex:"new[_-]?relic[_-]?beta[_-]?token(=| =|:| :)"},{name:"nexus_password",regex:"nexus[_-]?password(=| =|:| :)"},{name:"nexuspassword",regex:"nexuspassword(=| =|:| :)"},{name:"ngrok_auth_token",regex:"ngrok[_-]?auth[_-]?token(=| =|:| :)"},{name:"ngrok_token",regex:"ngrok[_-]?token(=| =|:| :)"},{name:"node_env",regex:"node[_-]?env(=| =|:| :)"},{name:"node_pre_gyp_accesskeyid",regex:"node[_-]?pre[_-]?gyp[_-]?accesskeyid(=| =|:| :)"},{name:"node_pre_gyp_github_token",regex:"node[_-]?pre[_-]?gyp[_-]?github[_-]?token(=| =|:| :)"},{name:"node_pre_gyp_secretaccesskey",regex:"node[_-]?pre[_-]?gyp[_-]?secretaccesskey(=| =|:| :)"},{name:"non_token",regex:"non[_-]?token(=| =|:| :)"},{name:"now_token",regex:"now[_-]?token(=| =|:| :)"},{name:"npm_api_key",regex:"npm[_-]?api[_-]?key(=| =|:| :)"},{name:"npm_api_token",regex:"npm[_-]?api[_-]?token(=| =|:| :)"},{name:"npm_auth_token",regex:"npm[_-]?auth[_-]?token(=| =|:| :)"},{name:"npm_email",regex:"npm[_-]?email(=| =|:| :)"},{name:"npm_password",regex:"npm[_-]?password(=| =|:| :)"},{name:"npm_secret_key",regex:"npm[_-]?secret[_-]?key(=| =|:| :)"},{name:"npm_token - 1",regex:"npm[_-]?token(=| =|:| :)"},{name:"nuget_api_key - 1",regex:"(oy2[a-z0-9]{43})"},{name:"nuget_api_key - 2",regex:"nuget[_-]?api[_-]?key(=| =|:| :)"},{name:"numbers_service_pass",regex:"numbers[_-]?service[_-]?pass(=| =|:| :)"},{name:"oauth_token",regex:"oauth[_-]?token(=| =|:| :)"},{name:"object_storage_password",regex:"object[_-]?storage[_-]?password(=| =|:| :)"},{name:"object_storage_region_name",regex:"object[_-]?storage[_-]?region[_-]?name(=| =|:| :)"},{name:"object_store_bucket",regex:"object[_-]?store[_-]?bucket(=| =|:| :)"},{name:"object_store_creds",regex:"object[_-]?store[_-]?creds(=| =|:| :)"},{name:"oc_pass",regex:"oc[_-]?pass(=| =|:| :)"},{name:"octest_app_password",regex:"octest[_-]?app[_-]?password(=| =|:| :)"},{name:"octest_app_username",regex:"octest[_-]?app[_-]?username(=| =|:| :)"},{name:"octest_password",regex:"octest[_-]?password(=| =|:| :)"},{name:"ofta_key",regex:"ofta[_-]?key(=| =|:| :)"},{name:"ofta_region",regex:"ofta[_-]?region(=| =|:| :)"},{name:"ofta_secret",regex:"ofta[_-]?secret(=| =|:| :)"},{name:"okta_client_token",regex:"okta[_-]?client[_-]?token(=| =|:| :)"},{name:"okta_oauth2_client_secret",regex:"okta[_-]?oauth2[_-]?client[_-]?secret(=| =|:| :)"},{name:"okta_oauth2_clientsecret",regex:"okta[_-]?oauth2[_-]?clientsecret(=| =|:| :)"},{name:"omise_key",regex:"omise[_-]?key(=| =|:| :)"},{name:"omise_pkey",regex:"omise[_-]?pkey(=| =|:| :)"},{name:"omise_pubkey",regex:"omise[_-]?pubkey(=| =|:| :)"},{name:"omise_skey",regex:"omise[_-]?skey(=| =|:| :)"},{name:"onesignal_api_key",regex:"onesignal[_-]?api[_-]?key(=| =|:| :)"},{name:"onesignal_user_auth_key",regex:"onesignal[_-]?user[_-]?auth[_-]?key(=| =|:| :)"},{name:"open_whisk_key",regex:"open[_-]?whisk[_-]?key(=| =|:| :)"},{name:"openwhisk_key",regex:"openwhisk[_-]?key(=| =|:| :)"},{name:"os_auth_url",regex:"os[_-]?auth[_-]?url(=| =|:| :)"},{name:"os_password",regex:"os[_-]?password(=| =|:| :)"},{name:"ossrh_jira_password",regex:"ossrh[_-]?jira[_-]?password(=| =|:| :)"},{name:"ossrh_pass",regex:"ossrh[_-]?pass(=| =|:| :)"},{name:"ossrh_password",regex:"ossrh[_-]?password(=| =|:| :)"},{name:"ossrh_secret",regex:"ossrh[_-]?secret(=| =|:| :)"},{name:"ossrh_username",regex:"ossrh[_-]?username(=| =|:| :)"},{name:"outlook_team",regex:"(https://outlook.office.com/webhook/[0-9a-f-]{36}@)"},{name:"packagecloud_token",regex:"packagecloud[_-]?token(=| =|:| :)"},{name:"pagerduty_apikey",regex:"pagerduty[_-]?apikey(=| =|:| :)"},{name:"parse_js_key",regex:"parse[_-]?js[_-]?key(=| =|:| :)"},{name:"passwordtravis",regex:"passwordtravis(=| =|:| :)"},{name:"paypal_braintree_access_token",regex:"(access_token$production$[0-9a-z]{16}$[0-9a-f]{32})"},{name:"paypal_client_secret",regex:"paypal[_-]?client[_-]?secret(=| =|:| :)"},{name:"percy_project",regex:"percy[_-]?project(=| =|:| :)"},{name:"percy_token",regex:"percy[_-]?token(=| =|:| :)"},{name:"personal_key",regex:"personal[_-]?key(=| =|:| :)"},{name:"personal_secret",regex:"personal[_-]?secret(=| =|:| :)"},{name:"pg_database",regex:"pg[_-]?database(=| =|:| :)"},{name:"pg_host",regex:"pg[_-]?host(=| =|:| :)"},{name:"places_api_key",regex:"places[_-]?api[_-]?key(=| =|:| :)"},{name:"places_apikey",regex:"places[_-]?apikey(=| =|:| :)"},{name:"plotly_apikey",regex:"plotly[_-]?apikey(=| =|:| :)"},{name:"plugin_password",regex:"plugin[_-]?password(=| =|:| :)"},{name:"postgres_env_postgres_db",regex:"postgres[_-]?env[_-]?postgres[_-]?db(=| =|:| :)"},{name:"postgres_env_postgres_password",regex:"postgres[_-]?env[_-]?postgres[_-]?password(=| =|:| :)"},{name:"postgresql_db",regex:"postgresql[_-]?db(=| =|:| :)"},{name:"postgresql_pass",regex:"postgresql[_-]?pass(=| =|:| :)"},{name:"prebuild_auth",regex:"prebuild[_-]?auth(=| =|:| :)"},{name:"preferred_username",regex:"preferred[_-]?username(=| =|:| :)"},{name:"pring_mail_username",regex:"pring[_-]?mail[_-]?username(=| =|:| :)"},{name:"private_key",regex:"-----(?:(?:BEGIN|END) )(?:(?:EC|PGP|DSA|RSA|OPENSSH).)?PRIVATE.KEY(.BLOCK)?-----"},{name:"private_signing_password",regex:"private[_-]?signing[_-]?password(=| =|:| :)"},{name:"prod_access_key_id",regex:"prod[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"prod_password",regex:"prod[_-]?password(=| =|:| :)"},{name:"prod_secret_key",regex:"prod[_-]?secret[_-]?key(=| =|:| :)"},{name:"project_config",regex:"project[_-]?config(=| =|:| :)"},{name:"publish_access",regex:"publish[_-]?access(=| =|:| :)"},{name:"publish_key",regex:"publish[_-]?key(=| =|:| :)"},{name:"publish_secret",regex:"publish[_-]?secret(=| =|:| :)"},{name:"pushover_token",regex:"pushover[_-]?token(=| =|:| :)"},{name:"pypi_passowrd",regex:"pypi[_-]?passowrd(=| =|:| :)"},{name:"qiita_token",regex:"qiita[_-]?token(=| =|:| :)"},{name:"quip_token",regex:"quip[_-]?token(=| =|:| :)"},{name:"rabbitmq_password",regex:"rabbitmq[_-]?password(=| =|:| :)"},{name:"randrmusicapiaccesstoken",regex:"randrmusicapiaccesstoken(=| =|:| :)"},{name:"redis_stunnel_urls",regex:"redis[_-]?stunnel[_-]?urls(=| =|:| :)"},{name:"rediscloud_url",regex:"rediscloud[_-]?url(=| =|:| :)"},{name:"refresh_token",regex:"refresh[_-]?token(=| =|:| :)"},{name:"registry_pass",regex:"registry[_-]?pass(=| =|:| :)"},{name:"registry_secure",regex:"registry[_-]?secure(=| =|:| :)"},{name:"release_gh_token",regex:"release[_-]?gh[_-]?token(=| =|:| :)"},{name:"release_token",regex:"release[_-]?token(=| =|:| :)"},{name:"reporting_webdav_pwd",regex:"reporting[_-]?webdav[_-]?pwd(=| =|:| :)"},{name:"reporting_webdav_url",regex:"reporting[_-]?webdav[_-]?url(=| =|:| :)"},{name:"repotoken",regex:"repotoken(=| =|:| :)"},{name:"rest_api_key",regex:"rest[_-]?api[_-]?key(=| =|:| :)"},{name:"rinkeby_private_key",regex:"rinkeby[_-]?private[_-]?key(=| =|:| :)"},{name:"ropsten_private_key",regex:"ropsten[_-]?private[_-]?key(=| =|:| :)"},{name:"route53_access_key_id",regex:"route53[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"rtd_key_pass",regex:"rtd[_-]?key[_-]?pass(=| =|:| :)"},{name:"rtd_store_pass",regex:"rtd[_-]?store[_-]?pass(=| =|:| :)"},{name:"rubygems_auth_token",regex:"rubygems[_-]?auth[_-]?token(=| =|:| :)"},{name:"s3_access_key",regex:"s3[_-]?access[_-]?key(=| =|:| :)"},{name:"s3_access_key_id",regex:"s3[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"s3_bucket_name_app_logs",regex:"s3[_-]?bucket[_-]?name[_-]?app[_-]?logs(=| =|:| :)"},{name:"s3_bucket_name_assets",regex:"s3[_-]?bucket[_-]?name[_-]?assets(=| =|:| :)"},{name:"s3_external_3_amazonaws_com",regex:"s3[_-]?external[_-]?3[_-]?amazonaws[_-]?com(=| =|:| :)"},{name:"s3_key",regex:"s3[_-]?key(=| =|:| :)"},{name:"s3_key_app_logs",regex:"s3[_-]?key[_-]?app[_-]?logs(=| =|:| :)"},{name:"s3_key_assets",regex:"s3[_-]?key[_-]?assets(=| =|:| :)"},{name:"s3_secret_app_logs",regex:"s3[_-]?secret[_-]?app[_-]?logs(=| =|:| :)"},{name:"s3_secret_assets",regex:"s3[_-]?secret[_-]?assets(=| =|:| :)"},{name:"s3_secret_key",regex:"s3[_-]?secret[_-]?key(=| =|:| :)"},{name:"s3_user_secret",regex:"s3[_-]?user[_-]?secret(=| =|:| :)"},{name:"sacloud_access_token",regex:"sacloud[_-]?access[_-]?token(=| =|:| :)"},{name:"sacloud_access_token_secret",regex:"sacloud[_-]?access[_-]?token[_-]?secret(=| =|:| :)"},{name:"sacloud_api",regex:"sacloud[_-]?api(=| =|:| :)"},{name:"salesforce_bulk_test_password",regex:"salesforce[_-]?bulk[_-]?test[_-]?password(=| =|:| :)"},{name:"salesforce_bulk_test_security_token",regex:"salesforce[_-]?bulk[_-]?test[_-]?security[_-]?token(=| =|:| :)"},{name:"sandbox_access_token",regex:"sandbox[_-]?access[_-]?token(=| =|:| :)"},{name:"sandbox_aws_access_key_id",regex:"sandbox[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"sandbox_aws_secret_access_key",regex:"sandbox[_-]?aws[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"sauce_access_key",regex:"sauce[_-]?access[_-]?key(=| =|:| :)"},{name:"sauce_token",regex:`(sauce.{0,50}("|')?[0-9a-f-]{36}("|')?)`},{name:"scrutinizer_token",regex:"scrutinizer[_-]?token(=| =|:| :)"},{name:"sdr_token",regex:"sdr[_-]?token(=| =|:| :)"},{name:"secret_0",regex:"secret[_-]?0(=| =|:| :)"},{name:"secret_1",regex:"secret[_-]?1(=| =|:| :)"},{name:"secret_10",regex:"secret[_-]?10(=| =|:| :)"},{name:"secret_11",regex:"secret[_-]?11(=| =|:| :)"},{name:"secret_2",regex:"secret[_-]?2(=| =|:| :)"},{name:"secret_3",regex:"secret[_-]?3(=| =|:| :)"},{name:"secret_4",regex:"secret[_-]?4(=| =|:| :)"},{name:"secret_5",regex:"secret[_-]?5(=| =|:| :)"},{name:"secret_6",regex:"secret[_-]?6(=| =|:| :)"},{name:"secret_7",regex:"secret[_-]?7(=| =|:| :)"},{name:"secret_8",regex:"secret[_-]?8(=| =|:| :)"},{name:"secret_9",regex:"secret[_-]?9(=| =|:| :)"},{name:"secret_key_base",regex:"secret[_-]?key[_-]?base(=| =|:| :)"},{name:"secretaccesskey",regex:"secretaccesskey(=| =|:| :)"},{name:"secretkey",regex:"secretkey(=| =|:| :)"},{name:"segment_api_key",regex:"segment[_-]?api[_-]?key(=| =|:| :)"},{name:"selion_log_level_dev",regex:"selion[_-]?log[_-]?level[_-]?dev(=| =|:| :)"},{name:"selion_selenium_host",regex:"selion[_-]?selenium[_-]?host(=| =|:| :)"},{name:"sendgrid - 2",regex:"sendgrid(=| =|:| :)"},{name:"sendgrid_api_key - 1",regex:"sendgrid[_-]?api[_-]?key(=| =|:| :)"},{name:"sendgrid_key",regex:"sendgrid[_-]?key(=| =|:| :)"},{name:"sendgrid_password",regex:"sendgrid[_-]?password(=| =|:| :)"},{name:"sendgrid_user",regex:"sendgrid[_-]?user(=| =|:| :)"},{name:"sendgrid_username",regex:"sendgrid[_-]?username(=| =|:| :)"},{name:"sendwithus_key",regex:"sendwithus[_-]?key(=| =|:| :)"},{name:"sentry_auth_token",regex:"sentry[_-]?auth[_-]?token(=| =|:| :)"},{name:"sentry_default_org",regex:"sentry[_-]?default[_-]?org(=| =|:| :)"},{name:"sentry_endpoint",regex:"sentry[_-]?endpoint(=| =|:| :)"},{name:"sentry_key",regex:"sentry[_-]?key(=| =|:| :)"},{name:"service_account_secret",regex:"service[_-]?account[_-]?secret(=| =|:| :)"},{name:"ses_access_key",regex:"ses[_-]?access[_-]?key(=| =|:| :)"},{name:"ses_secret_key",regex:"ses[_-]?secret[_-]?key(=| =|:| :)"},{name:"setdstaccesskey",regex:"setdstaccesskey(=| =|:| :)"},{name:"setdstsecretkey",regex:"setdstsecretkey(=| =|:| :)"},{name:"setsecretkey",regex:"setsecretkey(=| =|:| :)"},{name:"signing_key",regex:"signing[_-]?key(=| =|:| :)"},{name:"signing_key_password",regex:"signing[_-]?key[_-]?password(=| =|:| :)"},{name:"signing_key_secret",regex:"signing[_-]?key[_-]?secret(=| =|:| :)"},{name:"signing_key_sid",regex:"signing[_-]?key[_-]?sid(=| =|:| :)"},{name:"slack_webhook_url",regex:"(hooks.slack.com/services/T[A-Z0-9]{8}/B[A-Z0-9]{8}/[a-zA-Z0-9]{1,})"},{name:"slash_developer_space",regex:"slash[_-]?developer[_-]?space(=| =|:| :)"},{name:"slash_developer_space_key",regex:"slash[_-]?developer[_-]?space[_-]?key(=| =|:| :)"},{name:"slate_user_email",regex:"slate[_-]?user[_-]?email(=| =|:| :)"},{name:"snoowrap_client_secret",regex:"snoowrap[_-]?client[_-]?secret(=| =|:| :)"},{name:"snoowrap_password",regex:"snoowrap[_-]?password(=| =|:| :)"},{name:"snoowrap_refresh_token",regex:"snoowrap[_-]?refresh[_-]?token(=| =|:| :)"},{name:"snyk_api_token",regex:"snyk[_-]?api[_-]?token(=| =|:| :)"},{name:"snyk_token",regex:"snyk[_-]?token(=| =|:| :)"},{name:"socrata_app_token",regex:"socrata[_-]?app[_-]?token(=| =|:| :)"},{name:"socrata_password",regex:"socrata[_-]?password(=| =|:| :)"},{name:"sonar_organization_key",regex:"sonar[_-]?organization[_-]?key(=| =|:| :)"},{name:"sonar_project_key",regex:"sonar[_-]?project[_-]?key(=| =|:| :)"},{name:"sonar_token",regex:"sonar[_-]?token(=| =|:| :)"},{name:"sonarqube_docs_api_key",regex:`(sonar.{0,50}("|')?[0-9a-f]{40}("|')?)`},{name:"sonatype_gpg_key_name",regex:"sonatype[_-]?gpg[_-]?key[_-]?name(=| =|:| :)"},{name:"sonatype_gpg_passphrase",regex:"sonatype[_-]?gpg[_-]?passphrase(=| =|:| :)"},{name:"sonatype_nexus_password",regex:"sonatype[_-]?nexus[_-]?password(=| =|:| :)"},{name:"sonatype_pass",regex:"sonatype[_-]?pass(=| =|:| :)"},{name:"sonatype_password",regex:"sonatype[_-]?password(=| =|:| :)"},{name:"sonatype_token_password",regex:"sonatype[_-]?token[_-]?password(=| =|:| :)"},{name:"sonatype_token_user",regex:"sonatype[_-]?token[_-]?user(=| =|:| :)"},{name:"sonatypepassword",regex:"sonatypepassword(=| =|:| :)"},{name:"soundcloud_client_secret",regex:"soundcloud[_-]?client[_-]?secret(=| =|:| :)"},{name:"soundcloud_password",regex:"soundcloud[_-]?password(=| =|:| :)"},{name:"spaces_access_key_id",regex:"spaces[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"spaces_secret_access_key",regex:"spaces[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"spotify_api_access_token",regex:"spotify[_-]?api[_-]?access[_-]?token(=| =|:| :)"},{name:"spotify_api_client_secret",regex:"spotify[_-]?api[_-]?client[_-]?secret(=| =|:| :)"},{name:"spring_mail_password",regex:"spring[_-]?mail[_-]?password(=| =|:| :)"},{name:"sqsaccesskey",regex:"sqsaccesskey(=| =|:| :)"},{name:"sqssecretkey",regex:"sqssecretkey(=| =|:| :)"},{name:"square_app_secret",regex:"(sq0[a-z]{3}-[0-9A-Za-z-_]{20,50})"},{name:"square_reader_sdk_repository_password",regex:"square[_-]?reader[_-]?sdk[_-]?repository[_-]?password(=| =|:| :)"},{name:"srcclr_api_token",regex:"srcclr[_-]?api[_-]?token(=| =|:| :)"},{name:"ssh_password",regex:`(sshpass -p.*['|"])`},{name:"sshpass",regex:"sshpass(=| =|:| :)"},{name:"ssmtp_config",regex:"ssmtp[_-]?config(=| =|:| :)"},{name:"staging_base_url_runscope",regex:"staging[_-]?base[_-]?url[_-]?runscope(=| =|:| :)"},{name:"star_test_aws_access_key_id",regex:"star[_-]?test[_-]?aws[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"star_test_bucket",regex:"star[_-]?test[_-]?bucket(=| =|:| :)"},{name:"star_test_location",regex:"star[_-]?test[_-]?location(=| =|:| :)"},{name:"star_test_secret_access_key",regex:"star[_-]?test[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"starship_account_sid",regex:"starship[_-]?account[_-]?sid(=| =|:| :)"},{name:"starship_auth_token",regex:"starship[_-]?auth[_-]?token(=| =|:| :)"},{name:"stormpath_api_key_id",regex:"stormpath[_-]?api[_-]?key[_-]?id(=| =|:| :)"},{name:"stormpath_api_key_secret",regex:"stormpath[_-]?api[_-]?key[_-]?secret(=| =|:| :)"},{name:"strip_publishable_key",regex:"strip[_-]?publishable[_-]?key(=| =|:| :)"},{name:"strip_secret_key",regex:"strip[_-]?secret[_-]?key(=| =|:| :)"},{name:"stripe_private",regex:"stripe[_-]?private(=| =|:| :)"},{name:"stripe_public",regex:"stripe[_-]?public(=| =|:| :)"},{name:"stripe_restricted_api",regex:"(rk_live_[0-9a-zA-Z]{24,34})"},{name:"stripe_standard_api",regex:"(sk_live_[0-9a-zA-Z]{24,34})"},{name:"surge_login",regex:"surge[_-]?login(=| =|:| :)"},{name:"surge_token",regex:"surge[_-]?token(=| =|:| :)"},{name:"svn_pass",regex:"svn[_-]?pass(=| =|:| :)"},{name:"tesco_api_key",regex:"tesco[_-]?api[_-]?key(=| =|:| :)"},{name:"test_github_token",regex:"test[_-]?github[_-]?token(=| =|:| :)"},{name:"test_test",regex:"test[_-]?test(=| =|:| :)"},{name:"tester_keys_password",regex:"tester[_-]?keys[_-]?password(=| =|:| :)"},{name:"thera_oss_access_key",regex:"thera[_-]?oss[_-]?access[_-]?key(=| =|:| :)"},{name:"token_core_java",regex:"token[_-]?core[_-]?java(=| =|:| :)"},{name:"travis_access_token",regex:"travis[_-]?access[_-]?token(=| =|:| :)"},{name:"travis_api_token",regex:"travis[_-]?api[_-]?token(=| =|:| :)"},{name:"travis_branch",regex:"travis[_-]?branch(=| =|:| :)"},{name:"travis_com_token",regex:"travis[_-]?com[_-]?token(=| =|:| :)"},{name:"travis_e2e_token",regex:"travis[_-]?e2e[_-]?token(=| =|:| :)"},{name:"travis_gh_token",regex:"travis[_-]?gh[_-]?token(=| =|:| :)"},{name:"travis_pull_request",regex:"travis[_-]?pull[_-]?request(=| =|:| :)"},{name:"travis_secure_env_vars",regex:"travis[_-]?secure[_-]?env[_-]?vars(=| =|:| :)"},{name:"travis_token",regex:"travis[_-]?token(=| =|:| :)"},{name:"trex_client_token",regex:"trex[_-]?client[_-]?token(=| =|:| :)"},{name:"trex_okta_client_token",regex:"trex[_-]?okta[_-]?client[_-]?token(=| =|:| :)"},{name:"twilio_api_key",regex:"twilio[_-]?api[_-]?key(=| =|:| :)"},{name:"twilio_api_secret",regex:"twilio[_-]?api[_-]?secret(=| =|:| :)"},{name:"twilio_chat_account_api_service",regex:"twilio[_-]?chat[_-]?account[_-]?api[_-]?service(=| =|:| :)"},{name:"twilio_configuration_sid",regex:"twilio[_-]?configuration[_-]?sid(=| =|:| :)"},{name:"twilio_sid",regex:"twilio[_-]?sid(=| =|:| :)"},{name:"twilio_token",regex:"twilio[_-]?token(=| =|:| :)"},{name:"twine_password",regex:"twine[_-]?password(=| =|:| :)"},{name:"twitter_consumer_key",regex:"twitter[_-]?consumer[_-]?key(=| =|:| :)"},{name:"twitter_consumer_secret",regex:"twitter[_-]?consumer[_-]?secret(=| =|:| :)"},{name:"twitteroauthaccesssecret",regex:"twitteroauthaccesssecret(=| =|:| :)"},{name:"twitteroauthaccesstoken",regex:"twitteroauthaccesstoken(=| =|:| :)"},{name:"unity_password",regex:"unity[_-]?password(=| =|:| :)"},{name:"unity_serial",regex:"unity[_-]?serial(=| =|:| :)"},{name:"urban_key",regex:"urban[_-]?key(=| =|:| :)"},{name:"urban_master_secret",regex:"urban[_-]?master[_-]?secret(=| =|:| :)"},{name:"urban_secret",regex:"urban[_-]?secret(=| =|:| :)"},{name:"us_east_1_elb_amazonaws_com",regex:"us[_-]?east[_-]?1[_-]?elb[_-]?amazonaws[_-]?com(=| =|:| :)"},{name:"use_ssh",regex:"use[_-]?ssh(=| =|:| :)"},{name:"user_assets_access_key_id",regex:"user[_-]?assets[_-]?access[_-]?key[_-]?id(=| =|:| :)"},{name:"user_assets_secret_access_key",regex:"user[_-]?assets[_-]?secret[_-]?access[_-]?key(=| =|:| :)"},{name:"usertravis",regex:"usertravis(=| =|:| :)"},{name:"v_sfdc_client_secret",regex:"v[_-]?sfdc[_-]?client[_-]?secret(=| =|:| :)"},{name:"v_sfdc_password",regex:"v[_-]?sfdc[_-]?password(=| =|:| :)"},{name:"vip_github_build_repo_deploy_key",regex:"vip[_-]?github[_-]?build[_-]?repo[_-]?deploy[_-]?key(=| =|:| :)"},{name:"vip_github_deploy_key",regex:"vip[_-]?github[_-]?deploy[_-]?key(=| =|:| :)"},{name:"vip_github_deploy_key_pass",regex:"vip[_-]?github[_-]?deploy[_-]?key[_-]?pass(=| =|:| :)"},{name:"virustotal_apikey",regex:"virustotal[_-]?apikey(=| =|:| :)"},{name:"visual_recognition_api_key",regex:"visual[_-]?recognition[_-]?api[_-]?key(=| =|:| :)"},{name:"vscetoken",regex:"vscetoken(=| =|:| :)"},{name:"wakatime_api_key",regex:"wakatime[_-]?api[_-]?key(=| =|:| :)"},{name:"watson_conversation_password",regex:"watson[_-]?conversation[_-]?password(=| =|:| :)"},{name:"watson_device_password",regex:"watson[_-]?device[_-]?password(=| =|:| :)"},{name:"watson_password",regex:"watson[_-]?password(=| =|:| :)"},{name:"widget_basic_password",regex:"widget[_-]?basic[_-]?password(=| =|:| :)"},{name:"widget_basic_password_2",regex:"widget[_-]?basic[_-]?password[_-]?2(=| =|:| :)"},{name:"widget_basic_password_3",regex:"widget[_-]?basic[_-]?password[_-]?3(=| =|:| :)"},{name:"widget_basic_password_4",regex:"widget[_-]?basic[_-]?password[_-]?4(=| =|:| :)"},{name:"widget_basic_password_5",regex:"widget[_-]?basic[_-]?password[_-]?5(=| =|:| :)"},{name:"widget_fb_password",regex:"widget[_-]?fb[_-]?password(=| =|:| :)"},{name:"widget_fb_password_2",regex:"widget[_-]?fb[_-]?password[_-]?2(=| =|:| :)"},{name:"widget_fb_password_3",regex:"widget[_-]?fb[_-]?password[_-]?3(=| =|:| :)"},{name:"widget_test_server",regex:"widget[_-]?test[_-]?server(=| =|:| :)"},{name:"wincert_password",regex:"wincert[_-]?password(=| =|:| :)"},{name:"wordpress_db_password",regex:"wordpress[_-]?db[_-]?password(=| =|:| :)"},{name:"wordpress_db_user",regex:"wordpress[_-]?db[_-]?user(=| =|:| :)"},{name:"wpjm_phpunit_google_geocode_api_key",regex:"wpjm[_-]?phpunit[_-]?google[_-]?geocode[_-]?api[_-]?key(=| =|:| :)"},{name:"wporg_password",regex:"wporg[_-]?password(=| =|:| :)"},{name:"wpt_db_password",regex:"wpt[_-]?db[_-]?password(=| =|:| :)"},{name:"wpt_db_user",regex:"wpt[_-]?db[_-]?user(=| =|:| :)"},{name:"wpt_prepare_dir",regex:"wpt[_-]?prepare[_-]?dir(=| =|:| :)"},{name:"wpt_report_api_key",regex:"wpt[_-]?report[_-]?api[_-]?key(=| =|:| :)"},{name:"wpt_ssh_connect",regex:"wpt[_-]?ssh[_-]?connect(=| =|:| :)"},{name:"wpt_ssh_private_key_base64",regex:"wpt[_-]?ssh[_-]?private[_-]?key[_-]?base64(=| =|:| :)"},{name:"www_googleapis_com",regex:"www[_-]?googleapis[_-]?com(=| =|:| :)"},{name:"yangshun_gh_password",regex:"yangshun[_-]?gh[_-]?password(=| =|:| :)"},{name:"yangshun_gh_token",regex:"yangshun[_-]?gh[_-]?token(=| =|:| :)"},{name:"yt_account_client_secret",regex:"yt[_-]?account[_-]?client[_-]?secret(=| =|:| :)"},{name:"yt_account_refresh_token",regex:"yt[_-]?account[_-]?refresh[_-]?token(=| =|:| :)"},{name:"yt_api_key",regex:"yt[_-]?api[_-]?key(=| =|:| :)"},{name:"yt_client_secret",regex:"yt[_-]?client[_-]?secret(=| =|:| :)"},{name:"yt_partner_client_secret",regex:"yt[_-]?partner[_-]?client[_-]?secret(=| =|:| :)"},{name:"yt_partner_refresh_token",regex:"yt[_-]?partner[_-]?refresh[_-]?token(=| =|:| :)"},{name:"yt_server_api_key",regex:"yt[_-]?server[_-]?api[_-]?key(=| =|:| :)"},{name:"zendesk_travis_github",regex:"zendesk[_-]?travis[_-]?github(=| =|:| :)"},{name:"zensonatypepassword",regex:"zensonatypepassword(=| =|:| :)"},{name:"zhuliang_gh_token",regex:"zhuliang[_-]?gh[_-]?token(=| =|:| :)"},{name:"zopim_account_key",regex:"zopim[_-]?account[_-]?key(=| =|:| :)"},{name:"docker_registry_auth",regex:'auth":.*"(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{4}|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{2}={2})'}];var kb="*",gR=new Set([`
84
+ `,"\r","\t",'"',"'",":",",","{","}","[","]","\\"]),Ib=[];for(let{regex:_}of Sb)try{let z=_,A="g";if(z.startsWith("(?i)"))z=z.slice(4),A="gi";Ib.push(new RegExp(z,A))}catch{}function q6(_,z=kb){let A=z.length>0?z[0]:kb,G=_;for(let J of Ib)G=G.replace(J,(Y)=>Array.from(Y,(X)=>gR.has(X)?X:A).join(""));return G}function y_(_){if(typeof _==="string")return q6(_);if(Array.isArray(_))return _.map((z)=>y_(z));if(_ instanceof Date)return _;if(_!==null&&typeof _==="object"){let z={};for(let[A,G]of Object.entries(_))z[A]=y_(G);return z}return _}var fR=[".env",".env.local",".env.development",".env.production",".env.test",".env.staging",/\.env\.(dev|prod|stage|preview|ci|build|docker)$/i,".zshrc",".bashrc",".bash_profile",".profile",".zprofile",".zshenv",".zsh_history",".bash_history","id_rsa","id_ed25519","id_ecdsa","id_dsa",/^id_[a-z0-9]+$/i,/\.pem$/i,/\.key$/i,".aws/credentials",".aws/config",".docker/config.json",".npmrc",".yarnrc",".yarnrc.yml",".git-credentials",".netrc",".kube/config","kubeconfig","database.yml","secrets.yml","secrets.yaml","master.key","credentials.yml.enc",".gcloud/credentials","service-account.json","service_account.json",/gcp.*credentials.*\.json$/i,/firebase.*\.json$/i];function hR(_){let z=_.replace(/\\/g,"/"),A=z.split("/").pop()||"";for(let G of fR)if(typeof G==="string"){if(A===G||z.endsWith(`/${G}`)||z===G)return!0}else if(G.test(A)||G.test(z))return!0;return!1}function y5(_){return _.replace(/[^\s]/g,"*")}function g5(_){let z=_.messages.map((A)=>mR(A));return{..._,messages:z}}function mR(_){if(_.type!=="tool-call")return _;let z=_.toolName;if(z!=="Read"&&z!=="Write")return _;let A=_.input,G=A?.file_path;if(typeof G!=="string"||!hR(G))return _;let J={..._};if(z==="Write"&&A){let Y=A.content;if(typeof Y==="string")J.input={...A,content:y5(Y)}}if(z==="Read"){let Y=_.output;if(typeof Y==="string")J.output=y5(Y);else if(Y&&typeof Y==="object"){let X=Y,b=X.file;if(b&&typeof b.content==="string")J.output={...X,file:{...b,content:y5(b.content)}}}}return J}import{spawn as uR}from"child_process";import{promises as $9}from"fs";import{homedir as F6}from"os";import{basename as cR,extname as lR,join as M9,resolve as xb}from"path";var N1=100,Tb=80,pR=new Set(["[request interrupted by user]","[request aborted by user]","[request cancelled by user]"]),dR=/^<\/?(?:command|local)-[a-z-]+>/i,rR=/^[α-ωΑ-Ω]\s/i,nR=/<system-reminder>[\s\S]*?<\/system-reminder>/g,iR=["npm ","npm:","npm error","node:","node.js","error:","fatal:","warning:","traceback (most recent call last):","usage:","hint:","note:","code:","requirestack"],oR=M9(F6(),".claude"),aR=M9(F6(),".cline"),sR=M9(F6(),".codex"),tR=M9(F6(),".pi","agent","sessions");async function eR(_){let z=_?.limit??N1,A=process.env.CLAUDE_HOME??oR,G=M9(A,"projects");if(!await K6(G))return[];let J=[];try{let b=await $9.readdir(G,{withFileTypes:!0});for(let Q of b){if(!Q.isDirectory())continue;let $=M9(G,Q.name);try{let H=await $9.readdir($,{withFileTypes:!0});for(let B of H){if(!B.isFile()||lR(B.name)!==".jsonl")continue;let Z=M9($,B.name),q=cR(B.name,".jsonl");try{let F=await $9.stat(Z);J.push({path:Z,id:q,mtime:F.mtime})}catch{}}}catch{}}}catch{}J.sort((b,Q)=>Q.mtime.getTime()-b.mtime.getTime());let Y=J.slice(0,z*2),X=[];for(let b of Y)try{let Q=await YP(b.path);X.push({id:b.id,source:"claude-code",path:b.path,timestamp:Q.timestamp,preview:Q.preview,cwd:Q.cwd,repoId:null,stats:Q.stats})}catch{}return X.sort((b,Q)=>Q.timestamp.getTime()-b.timestamp.getTime()).slice(0,z)}async function _P(_){let z=_?.limit??N1,A=process.env.CODEX_HOME??sR,G=M9(A,"sessions");if(!await K6(G))return[];let J=[],X=(await $P(G)).slice(0,z*2);for(let b of X)try{let Q=await HP(b);if(!Q)continue;J.push({id:Q.sessionId,source:"codex",path:b,timestamp:Q.timestamp,preview:Q.preview,cwd:Q.cwd,repoId:null,stats:Q.stats})}catch{}return J.sort((b,Q)=>Q.timestamp.getTime()-b.timestamp.getTime()).slice(0,z)}async function zP(_){let z=_?.limit??N1;try{let A=await AP(z*2);if(!A)return[];let G=JSON.parse(A),J=[];for(let Y of G){if(Y.parentId)continue;let X=Y.updated?new Date(Y.updated):Y.created?new Date(Y.created):new Date(0);J.push({id:Y.id,source:"opencode",path:Y.id,timestamp:X,preview:Y.title?D1(Y.title):null,cwd:Y.directory??null,repoId:null,stats:null})}return J.sort((Y,X)=>X.timestamp.getTime()-Y.timestamp.getTime()).slice(0,z)}catch{return[]}}function AP(_){return new Promise((z)=>{let A=!1,G=(b)=>{if(!A)A=!0,clearTimeout(X),z(b)},J=uR("opencode",["session","list","--format","json","-n",String(_)],{stdio:["pipe","pipe","pipe"]}),Y="",X=setTimeout(()=>{J.kill(),G(null)},30000);J.stdout.on("data",(b)=>{Y+=b.toString()}),J.on("close",(b)=>{G(b===0?Y.trim()||null:null)}),J.on("error",()=>{G(null)})})}async function GP(_){let z=_?.limit??N1,A=process.env.PI_SESSIONS??tR;if(!await K6(A))return[];let G=[];try{let J=await $9.readdir(A,{withFileTypes:!0});for(let Y of J){if(!Y.isDirectory())continue;let X=M9(A,Y.name);try{let b=await $9.readdir(X,{withFileTypes:!0});for(let Q of b){if(!Q.isFile()||!Q.name.endsWith(".jsonl"))continue;let $=M9(X,Q.name);try{let H=await ZP($);if(!H)continue;G.push({id:H.sessionId,source:"pi",path:$,timestamp:H.timestamp,preview:H.preview,cwd:H.cwd,repoId:null,stats:null})}catch{}}}catch{}}}catch{}return G.sort((J,Y)=>Y.timestamp.getTime()-J.timestamp.getTime()).slice(0,z)}async function JP(_){let z=_?.limit??N1,A=process.env.CLINE_HOME??aR,G=M9(A,"data","tasks");if(!await K6(G))return[];let J=[];try{let Y=await $9.readdir(G,{withFileTypes:!0}),X=[];for(let Q of Y){if(!Q.isDirectory())continue;let $=M9(G,Q.name,"api_conversation_history.json");try{let H=await $9.stat($);X.push({path:$,id:Q.name,mtime:H.mtime})}catch{}}X.sort((Q,$)=>$.mtime.getTime()-Q.mtime.getTime());let b=X.slice(0,z*2);for(let Q of b)try{let $=await BP(Q.path);if(!$)continue;J.push({id:Q.id,source:"cline",path:Q.path,timestamp:$.timestamp,preview:$.preview,cwd:$.cwd,repoId:null,stats:null})}catch{}}catch{}return J.sort((Y,X)=>X.timestamp.getTime()-Y.timestamp.getTime()).slice(0,z)}async function vb(_){let z=_?.sources??["claude-code","cline","codex","opencode","pi"],A=_?.limit??N1,G=_?.cwd?xb(_.cwd):null,J=A*3,Y=await Promise.all([z.includes("claude-code")?eR({limit:J}):[],z.includes("cline")?JP({limit:J}):[],z.includes("codex")?_P({limit:J}):[],z.includes("opencode")?zP({limit:J}):[],z.includes("pi")?GP({limit:J}):[]]),X=[];for(let b of Y)X.push(...b);if(X=X.filter((b)=>b.preview&&b.preview.trim().length>0),G)X=X.filter((b)=>{if(!b.cwd)return!1;let Q=xb(b.cwd);return Q.startsWith(G)||G.startsWith(Q)});return X.sort((b,Q)=>Q.timestamp.getTime()-b.timestamp.getTime()).slice(0,A)}async function K6(_){try{return(await $9.stat(_)).isDirectory()}catch{return!1}}function D1(_){let z=_.replace(/\s+/g," ").trim();if(z.length<=Tb)return z;return z.slice(0,Tb-1)+"…"}var g_=51200,M1=20480;async function YP(_){let z=await $9.open(_,"r");try{let G=(await z.stat()).size,J=null,Y=null,X=null,b=Buffer.alloc(Math.min(g_,G));await z.read(b,0,b.length,0);let Q=b.toString("utf8");for(let $ of Q.split(/\r?\n/)){if(!$.trim())continue;if(!$.endsWith("}"))break;try{let H=JSON.parse($);if(!J&&typeof H.cwd==="string")J=H.cwd;if(typeof H.timestamp==="string"){let B=new Date(H.timestamp);if(!Number.isNaN(B.getTime())){if(!X||B>X)X=B}}if(H.isSidechain||H.isMeta)continue;if(!Y&&H.type==="user"){let Z=H.message?.content;if(H.toolUseResult||H.tool_use_result)continue;let q=XP(Z);if(q){let F=bP(q);if(F)Y=D1(F)}}if(J&&Y)break}catch{continue}}if(G>g_){let $=Math.max(0,G-M1),H=Buffer.alloc(Math.min(M1,G-$));await z.read(H,0,H.length,$);let Z=H.toString("utf8").split(/\r?\n/);if($>0&&Z.length>0)Z.shift();for(let q of Z){if(!q.trim())continue;try{let F=JSON.parse(q);if(typeof F.timestamp==="string"){let K=new Date(F.timestamp);if(!Number.isNaN(K.getTime())){if(!X||K>X)X=K}}}catch{continue}}}return{timestamp:X??new Date(0),cwd:J,preview:Y,stats:null}}finally{await z.close()}}function XP(_){if(typeof _==="string")return _;if(Array.isArray(_))for(let z of _){if(typeof z==="string")return z;if(z&&typeof z==="object"){let A=z;if(A.type==="tool_result")continue;if(A.type==="text"&&typeof A.text==="string")return A.text}}return null}function bP(_){let z=_.replace(nR,""),A=[];for(let G of z.split(/\r?\n/)){let J=G.trim();if(!J)continue;let Y=J.toLowerCase();if(pR.has(Y))continue;if(dR.test(J))continue;if(rR.test(J))continue;if(iR.some((X)=>Y.startsWith(X))){if(!J.includes("?")&&!QP(Y))continue}if(!/[a-z]/i.test(J)&&!/\d/.test(J))continue;A.push(J)}if(A.length===0)return null;return A.slice(0,3).join(" ").replace(/\s+/g," ").trim()||null}function QP(_){return["can you","could you","please","help","how do","what is","why","fix","add","create","update"].some((A)=>_.includes(A))}async function $P(_){let z=[];async function A(G,J){if(J>4)return;try{let Y=await $9.readdir(G,{withFileTypes:!0});for(let X of Y){let b=M9(G,X.name);if(X.isDirectory())await A(b,J+1);else if(X.isFile()&&X.name.endsWith(".jsonl")){let Q=await $9.stat(b);z.push({path:b,mtime:Q.mtime})}}}catch{}}return await A(_,0),z.sort((G,J)=>J.mtime.getTime()-G.mtime.getTime()),z.map((G)=>G.path)}async function HP(_){let z=await $9.open(_,"r");try{let G=(await z.stat()).size,J=null,Y=null,X=null,b=null,Q=Buffer.alloc(Math.min(g_,G));await z.read(Q,0,Q.length,0);let $=Q.toString("utf8");for(let H of $.split(/\r?\n/)){if(!H.trim())continue;if(!H.endsWith("}"))break;try{let B=JSON.parse(H),Z=B.timestamp,q=B.type,F=B.payload;if(Z){let K=new Date(Z);if(!Number.isNaN(K.getTime())){if(!Y||K>Y)Y=K}}if(!F)continue;if(q==="session_meta")J=F.id??null,X=F.cwd??null;if(q==="event_msg"&&F.type==="user_message"&&!b){let K=F.message;if(K)b=D1(K)}if(J&&X&&b)break}catch{continue}}if(G>g_){let H=Math.max(0,G-M1),B=Buffer.alloc(Math.min(M1,G-H));await z.read(B,0,B.length,H);let q=B.toString("utf8").split(/\r?\n/);if(H>0&&q.length>0)q.shift();for(let F of q){if(!F.trim())continue;try{let W=JSON.parse(F).timestamp;if(W){let V=new Date(W);if(!Number.isNaN(V.getTime())){if(!Y||V>Y)Y=V}}}catch{continue}}}if(!J)return null;return{sessionId:J,timestamp:Y??new Date(0),cwd:X,preview:b,stats:null}}finally{await z.close()}}var Cb=/<environment_details|task|feedback>[\s\S]*?<\/environment_details|task|feedback>/g;async function BP(_){let z=await $9.open(_,"r");try{let A=await z.stat(),G=A.size,J=Buffer.alloc(Math.min(g_,G));await z.read(J,0,J.length,0);let Y=J.toString("utf8"),X=null,b=null,Q=Y.match(/<task>\n?([\s\S]*?)\n?<\/task>/);if(Q?.[1]){let H=Q[1].trim();if(H)X=D1(H)}if(!X){let B=Y.match(/"role"\s*:\s*"user"[\s\S]*?"type"\s*:\s*"text"\s*,\s*"text"\s*:\s*"([^"]{1,200})/)?.[1]?.trim();if(B){let Z=B.replace(Cb,"").replace(Cb,"").replace(/\\n/g," ").trim();if(Z&&!Z.startsWith("[")&&!Z.startsWith("#"))X=D1(Z)}}return{timestamp:A.mtime,cwd:b,preview:X}}finally{await z.close()}}async function ZP(_){let z=await $9.open(_,"r");try{let G=(await z.stat()).size,J=null,Y=null,X=null,b=null,Q=null,$=Buffer.alloc(Math.min(g_,G));await z.read($,0,$.length,0);let B=$.toString("utf8").split(/\r?\n/);for(let Z=0;Z<B.length;Z++){let q=B[Z];if(!q.trim())continue;if(!q.endsWith("}"))break;try{let F=JSON.parse(q);if(Z===0&&F.id&&F.timestamp){J=F.id,X=F.cwd??null,Y=new Date(F.timestamp),Q=Y;continue}if(F.timestamp){let K=new Date(F.timestamp);if(!Number.isNaN(K.getTime())){if(!Q||K>Q)Q=K}}if(!b&&F.type==="message"){let K=F.message;if(K?.role==="user"){let W=K.content;if(Array.isArray(W)){for(let V of W)if(V&&typeof V==="object"&&V.type==="text"){let N=V.text;if(N){b=D1(N);break}}}}}if(J&&X&&b)break}catch{}}if(G>g_){let Z=Math.max(0,G-M1),q=Buffer.alloc(Math.min(M1,G-Z));await z.read(q,0,q.length,Z);let K=q.toString("utf8").split(/\r?\n/);if(Z>0&&K.length>0)K.shift();for(let W of K){if(!W.trim())continue;try{let V=JSON.parse(W);if(V.timestamp){let N=new Date(V.timestamp);if(!Number.isNaN(N.getTime())){if(!Q||N>Q)Q=N}}}catch{}}}if(!J)return null;return{sessionId:J,timestamp:Q??Y??new Date(0),cwd:X,preview:b}}finally{await z.close()}}function gb(_){return _===161||_===164||_===167||_===168||_===170||_===173||_===174||_>=176&&_<=180||_>=182&&_<=186||_>=188&&_<=191||_===198||_===208||_===215||_===216||_>=222&&_<=225||_===230||_>=232&&_<=234||_===236||_===237||_===240||_===242||_===243||_>=247&&_<=250||_===252||_===254||_===257||_===273||_===275||_===283||_===294||_===295||_===299||_>=305&&_<=307||_===312||_>=319&&_<=322||_===324||_>=328&&_<=331||_===333||_===338||_===339||_===358||_===359||_===363||_===462||_===464||_===466||_===468||_===470||_===472||_===474||_===476||_===593||_===609||_===708||_===711||_>=713&&_<=715||_===717||_===720||_>=728&&_<=731||_===733||_===735||_>=768&&_<=879||_>=913&&_<=929||_>=931&&_<=937||_>=945&&_<=961||_>=963&&_<=969||_===1025||_>=1040&&_<=1103||_===1105||_===8208||_>=8211&&_<=8214||_===8216||_===8217||_===8220||_===8221||_>=8224&&_<=8226||_>=8228&&_<=8231||_===8240||_===8242||_===8243||_===8245||_===8251||_===8254||_===8308||_===8319||_>=8321&&_<=8324||_===8364||_===8451||_===8453||_===8457||_===8467||_===8470||_===8481||_===8482||_===8486||_===8491||_===8531||_===8532||_>=8539&&_<=8542||_>=8544&&_<=8555||_>=8560&&_<=8569||_===8585||_>=8592&&_<=8601||_===8632||_===8633||_===8658||_===8660||_===8679||_===8704||_===8706||_===8707||_===8711||_===8712||_===8715||_===8719||_===8721||_===8725||_===8730||_>=8733&&_<=8736||_===8739||_===8741||_>=8743&&_<=8748||_===8750||_>=8756&&_<=8759||_===8764||_===8765||_===8776||_===8780||_===8786||_===8800||_===8801||_>=8804&&_<=8807||_===8810||_===8811||_===8814||_===8815||_===8834||_===8835||_===8838||_===8839||_===8853||_===8857||_===8869||_===8895||_===8978||_>=9312&&_<=9449||_>=9451&&_<=9547||_>=9552&&_<=9587||_>=9600&&_<=9615||_>=9618&&_<=9621||_===9632||_===9633||_>=9635&&_<=9641||_===9650||_===9651||_===9654||_===9655||_===9660||_===9661||_===9664||_===9665||_>=9670&&_<=9672||_===9675||_>=9678&&_<=9681||_>=9698&&_<=9701||_===9711||_===9733||_===9734||_===9737||_===9742||_===9743||_===9756||_===9758||_===9792||_===9794||_===9824||_===9825||_>=9827&&_<=9829||_>=9831&&_<=9834||_===9836||_===9837||_===9839||_===9886||_===9887||_===9919||_>=9926&&_<=9933||_>=9935&&_<=9939||_>=9941&&_<=9953||_===9955||_===9960||_===9961||_>=9963&&_<=9969||_===9972||_>=9974&&_<=9977||_===9979||_===9980||_===9982||_===9983||_===10045||_>=10102&&_<=10111||_>=11094&&_<=11097||_>=12872&&_<=12879||_>=57344&&_<=63743||_>=65024&&_<=65039||_===65533||_>=127232&&_<=127242||_>=127248&&_<=127277||_>=127280&&_<=127337||_>=127344&&_<=127373||_===127375||_===127376||_>=127387&&_<=127404||_>=917760&&_<=917999||_>=983040&&_<=1048573||_>=1048576&&_<=1114109}function fb(_){return _===12288||_>=65281&&_<=65376||_>=65504&&_<=65510}function hb(_){return _>=4352&&_<=4447||_===8986||_===8987||_===9001||_===9002||_>=9193&&_<=9196||_===9200||_===9203||_===9725||_===9726||_===9748||_===9749||_>=9776&&_<=9783||_>=9800&&_<=9811||_===9855||_>=9866&&_<=9871||_===9875||_===9889||_===9898||_===9899||_===9917||_===9918||_===9924||_===9925||_===9934||_===9940||_===9962||_===9970||_===9971||_===9973||_===9978||_===9981||_===9989||_===9994||_===9995||_===10024||_===10060||_===10062||_>=10067&&_<=10069||_===10071||_>=10133&&_<=10135||_===10160||_===10175||_===11035||_===11036||_===11088||_===11093||_>=11904&&_<=11929||_>=11931&&_<=12019||_>=12032&&_<=12245||_>=12272&&_<=12287||_>=12289&&_<=12350||_>=12353&&_<=12438||_>=12441&&_<=12543||_>=12549&&_<=12591||_>=12593&&_<=12686||_>=12688&&_<=12773||_>=12783&&_<=12830||_>=12832&&_<=12871||_>=12880&&_<=42124||_>=42128&&_<=42182||_>=43360&&_<=43388||_>=44032&&_<=55203||_>=63744&&_<=64255||_>=65040&&_<=65049||_>=65072&&_<=65106||_>=65108&&_<=65126||_>=65128&&_<=65131||_>=94176&&_<=94180||_>=94192&&_<=94198||_>=94208&&_<=101589||_>=101631&&_<=101662||_>=101760&&_<=101874||_>=110576&&_<=110579||_>=110581&&_<=110587||_===110589||_===110590||_>=110592&&_<=110882||_===110898||_>=110928&&_<=110930||_===110933||_>=110948&&_<=110951||_>=110960&&_<=111355||_>=119552&&_<=119638||_>=119648&&_<=119670||_===126980||_===127183||_===127374||_>=127377&&_<=127386||_>=127488&&_<=127490||_>=127504&&_<=127547||_>=127552&&_<=127560||_===127568||_===127569||_>=127584&&_<=127589||_>=127744&&_<=127776||_>=127789&&_<=127797||_>=127799&&_<=127868||_>=127870&&_<=127891||_>=127904&&_<=127946||_>=127951&&_<=127955||_>=127968&&_<=127984||_===127988||_>=127992&&_<=128062||_===128064||_>=128066&&_<=128252||_>=128255&&_<=128317||_>=128331&&_<=128334||_>=128336&&_<=128359||_===128378||_===128405||_===128406||_===128420||_>=128507&&_<=128591||_>=128640&&_<=128709||_===128716||_>=128720&&_<=128722||_>=128725&&_<=128728||_>=128732&&_<=128735||_===128747||_===128748||_>=128756&&_<=128764||_>=128992&&_<=129003||_===129008||_>=129292&&_<=129338||_>=129340&&_<=129349||_>=129351&&_<=129535||_>=129648&&_<=129660||_>=129664&&_<=129674||_>=129678&&_<=129734||_===129736||_>=129741&&_<=129756||_>=129759&&_<=129770||_>=129775&&_<=129784||_>=131072&&_<=196605||_>=196608&&_<=262141}function qP(_){if(!Number.isSafeInteger(_))throw TypeError(`Expected a code point, got \`${typeof _}\`.`)}function f5(_,{ambiguousAsWide:z=!1}={}){if(qP(_),fb(_)||hb(_)||z&&gb(_))return 2;return 1}var E1=new Intl.Segmenter(void 0,{granularity:"grapheme"});function W6(){return E1}function FP(_){let z=_.codePointAt(0);return z>=126976&&z<=130047||z>=8960&&z<=9215||z>=9728&&z<=10175||z>=11088&&z<=11093||_.includes("️")||_.length>2}var KP=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Mark}|\p{Surrogate})+$/v,WP=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,VP=/^\p{RGI_Emoji}$/v,UP=512,Rz=new Map;function m5(_){if(KP.test(_))return 0;if(FP(_)&&VP.test(_))return 2;let A=_.replace(WP,"").codePointAt(0);if(A===void 0)return 0;let G=f5(A);if(_.length>1)for(let J of _.slice(1)){let Y=J.codePointAt(0);if(Y>=65280&&Y<=65519)G+=f5(Y)}return G}function W0(_){if(_.length===0)return 0;let z=!0;for(let Y=0;Y<_.length;Y++){let X=_.charCodeAt(Y);if(X<32||X>126){z=!1;break}}if(z)return _.length;let A=Rz.get(_);if(A!==void 0)return A;let G=_;if(_.includes("\t"))G=G.replace(/\t/g," ");if(G.includes("\x1B"))G=G.replace(/\x1b\[[0-9;]*[mGKHJ]/g,""),G=G.replace(/\x1b\]8;;[^\x07]*\x07/g,""),G=G.replace(/\x1b_[^\x07\x1b]*(?:\x07|\x1b\\)/g,"");let J=0;for(let{segment:Y}of E1.segment(G))J+=m5(Y);if(Rz.size>=UP){let Y=Rz.keys().next().value;if(Y!==void 0)Rz.delete(Y)}return Rz.set(_,J),J}function $4(_,z){if(z>=_.length||_[z]!=="\x1B")return null;let A=_[z+1];if(A==="["){let G=z+2;while(G<_.length&&!/[mGKHJ]/.test(_[G]))G++;if(G<_.length)return{code:_.substring(z,G+1),length:G+1-z};return null}if(A==="]"){let G=z+2;while(G<_.length){if(_[G]==="\x07")return{code:_.substring(z,G+1),length:G+1-z};if(_[G]==="\x1B"&&_[G+1]==="\\")return{code:_.substring(z,G+2),length:G+2-z};G++}return null}if(A==="_"){let G=z+2;while(G<_.length){if(_[G]==="\x07")return{code:_.substring(z,G+1),length:G+1-z};if(_[G]==="\x1B"&&_[G+1]==="\\")return{code:_.substring(z,G+2),length:G+2-z};G++}return null}return null}class V6{bold=!1;dim=!1;italic=!1;underline=!1;blink=!1;inverse=!1;hidden=!1;strikethrough=!1;fgColor=null;bgColor=null;process(_){if(!_.endsWith("m"))return;let z=_.match(/\x1b\[([\d;]*)m/);if(!z)return;let A=z[1];if(A===""||A==="0"){this.reset();return}let G=A.split(";"),J=0;while(J<G.length){let Y=Number.parseInt(G[J],10);if(Y===38||Y===48){if(G[J+1]==="5"&&G[J+2]!==void 0){let X=`${G[J]};${G[J+1]};${G[J+2]}`;if(Y===38)this.fgColor=X;else this.bgColor=X;J+=3;continue}else if(G[J+1]==="2"&&G[J+4]!==void 0){let X=`${G[J]};${G[J+1]};${G[J+2]};${G[J+3]};${G[J+4]}`;if(Y===38)this.fgColor=X;else this.bgColor=X;J+=5;continue}}switch(Y){case 0:this.reset();break;case 1:this.bold=!0;break;case 2:this.dim=!0;break;case 3:this.italic=!0;break;case 4:this.underline=!0;break;case 5:this.blink=!0;break;case 7:this.inverse=!0;break;case 8:this.hidden=!0;break;case 9:this.strikethrough=!0;break;case 21:this.bold=!1;break;case 22:this.bold=!1,this.dim=!1;break;case 23:this.italic=!1;break;case 24:this.underline=!1;break;case 25:this.blink=!1;break;case 27:this.inverse=!1;break;case 28:this.hidden=!1;break;case 29:this.strikethrough=!1;break;case 39:this.fgColor=null;break;case 49:this.bgColor=null;break;default:if(Y>=30&&Y<=37||Y>=90&&Y<=97)this.fgColor=String(Y);else if(Y>=40&&Y<=47||Y>=100&&Y<=107)this.bgColor=String(Y);break}J++}}reset(){this.bold=!1,this.dim=!1,this.italic=!1,this.underline=!1,this.blink=!1,this.inverse=!1,this.hidden=!1,this.strikethrough=!1,this.fgColor=null,this.bgColor=null}clear(){this.reset()}getActiveCodes(){let _=[];if(this.bold)_.push("1");if(this.dim)_.push("2");if(this.italic)_.push("3");if(this.underline)_.push("4");if(this.blink)_.push("5");if(this.inverse)_.push("7");if(this.hidden)_.push("8");if(this.strikethrough)_.push("9");if(this.fgColor)_.push(this.fgColor);if(this.bgColor)_.push(this.bgColor);if(_.length===0)return"";return`\x1B[${_.join(";")}m`}hasActiveCodes(){return this.bold||this.dim||this.italic||this.underline||this.blink||this.inverse||this.hidden||this.strikethrough||this.fgColor!==null||this.bgColor!==null}getLineEndReset(){if(this.underline)return"\x1B[24m";return""}}function mb(_,z){let A=0;while(A<_.length){let G=$4(_,A);if(G)z.process(G.code),A+=G.length;else A++}}function DP(_){let z=[],A="",G="",J=!1,Y=0;while(Y<_.length){let X=$4(_,Y);if(X){G+=X.code,Y+=X.length;continue}let b=_[Y],Q=b===" ";if(Q!==J&&A)z.push(A),A="";if(G)A+=G,G="";J=Q,A+=b,Y++}if(G)A+=G;if(A)z.push(A);return z}function Pz(_,z){if(!_)return[""];let A=_.split(`
85
+ `),G=[],J=new V6;for(let Y of A){let X=G.length>0?J.getActiveCodes():"";G.push(...MP(X+Y,z)),mb(Y,J)}return G.length>0?G:[""]}function MP(_,z){if(!_)return[""];if(W0(_)<=z)return[_];let G=[],J=new V6,Y=DP(_),X="",b=0;for(let Q of Y){let $=W0(Q),H=Q.trim()==="";if($>z&&!H){if(X){let q=J.getLineEndReset();if(q)X+=q;G.push(X),X="",b=0}let Z=NP(Q,z,J);G.push(...Z.slice(0,-1)),X=Z[Z.length-1],b=W0(X);continue}if(b+$>z&&b>0){let Z=X.trimEnd(),q=J.getLineEndReset();if(q)Z+=q;if(G.push(Z),H)X=J.getActiveCodes(),b=0;else X=J.getActiveCodes()+Q,b=$}else X+=Q,b+=$;mb(Q,J)}if(X)G.push(X);return G.length>0?G.map((Q)=>Q.trimEnd()):[""]}function NP(_,z,A){let G=[],J=A.getActiveCodes(),Y=0,X=0,b=[];while(X<_.length){let Q=$4(_,X);if(Q)b.push({type:"ansi",value:Q.code}),X+=Q.length;else{let $=X;while($<_.length){if($4(_,$))break;$++}let H=_.slice(X,$);for(let B of E1.segment(H))b.push({type:"grapheme",value:B.segment});X=$}}for(let Q of b){if(Q.type==="ansi"){J+=Q.value,A.process(Q.value);continue}let $=Q.value;if(!$)continue;let H=W0($);if(Y+H>z){let B=A.getLineEndReset();if(B)J+=B;G.push(J),J=A.getActiveCodes(),Y=0}J+=$,Y+=H}if(J)G.push(J);return G.length>0?G:[""]}function Sz(_,z,A){let G=W0(_),J=Math.max(0,z-G),Y=" ".repeat(J),X=_+Y;return A(X)}function t0(_,z,A="...",G=!1){let J=W0(_);if(J<=z)return G?_+" ".repeat(z-J):_;let Y=W0(A),X=z-Y;if(X<=0)return A.substring(0,z);let b=0,Q=[];while(b<_.length){let Z=$4(_,b);if(Z)Q.push({type:"ansi",value:Z.code}),b+=Z.length;else{let q=b;while(q<_.length){if($4(_,q))break;q++}let F=_.slice(b,q);for(let K of E1.segment(F))Q.push({type:"grapheme",value:K.segment});b=q}}let $="",H=0;for(let Z of Q){if(Z.type==="ansi"){$+=Z.value;continue}let q=Z.value;if(!q)continue;let F=W0(q);if(H+F>X)break;$+=q,H+=F}let B=`${$}\x1B[0m${A}`;if(G){let Z=W0(B);return B+" ".repeat(Math.max(0,z-Z))}return B}function U6(_,z,A,G=!1){return u5(_,z,A,G).text}function u5(_,z,A,G=!1){if(A<=0)return{text:"",width:0};let J=z+A,Y="",X=0,b=0,Q=0,$="";while(Q<_.length){let H=$4(_,Q);if(H){if(b>=z&&b<J)Y+=H.code;else if(b<z)$+=H.code;Q+=H.length;continue}let B=Q;while(B<_.length&&!$4(_,B))B++;for(let{segment:Z}of E1.segment(_.slice(Q,B))){let q=m5(Z),F=b>=z&&b<J,K=!G||b+q<=J;if(F&&K){if($)Y+=$,$="";Y+=Z,X+=q}if(b+=q,b>=J)break}if(Q=B,b>=J)break}return{text:Y,width:X}}var h5=new V6;function ub(_,z,A,G,J=!1){let Y="",X=0,b="",Q=0,$=0,H=0,B="",Z=!1,q=A+G;h5.clear();while(H<_.length){let F=$4(_,H);if(F){if(h5.process(F.code),$<z)B+=F.code;else if($>=A&&$<q&&Z)b+=F.code;H+=F.length;continue}let K=H;while(K<_.length&&!$4(_,K))K++;for(let{segment:W}of E1.segment(_.slice(H,K))){let V=m5(W);if($<z){if(B)Y+=B,B="";Y+=W,X+=V}else if($>=A&&$<q){if(!J||$+V<=q){if(!Z)b+=h5.getActiveCodes(),Z=!0;b+=W,Q+=V}}if($+=V,G<=0?$>=z:$>=q)break}if(H=K,G<=0?$>=z:$>=q)break}return{before:Y,beforeWidth:X,after:b,afterWidth:Q}}var R4=!1;function N6(_){R4=_}var EP=new Set(["`","-","=","[","]","\\",";","'",",",".","/","!","@","#","$","%","^","&","*","(",")","_","+","|","~","{","}",":","<",">","?"]),D0={shift:1,alt:2,ctrl:4},cb=192,y0={escape:27,tab:9,enter:13,space:32,backspace:127,kpEnter:57414},H9={up:-1,down:-2,right:-3,left:-4},v0={delete:-10,insert:-11,pageUp:-12,pageDown:-13,home:-14,end:-15},R9={up:["\x1B[A","\x1BOA"],down:["\x1B[B","\x1BOB"],right:["\x1B[C","\x1BOC"],left:["\x1B[D","\x1BOD"],home:["\x1B[H","\x1BOH","\x1B[1~","\x1B[7~"],end:["\x1B[F","\x1BOF","\x1B[4~","\x1B[8~"],insert:["\x1B[2~"],delete:["\x1B[3~"],pageUp:["\x1B[5~","\x1B[[5~"],pageDown:["\x1B[6~","\x1B[[6~"],clear:["\x1B[E","\x1BOE"],f1:["\x1BOP","\x1B[11~","\x1B[[A"],f2:["\x1BOQ","\x1B[12~","\x1B[[B"],f3:["\x1BOR","\x1B[13~","\x1B[[C"],f4:["\x1BOS","\x1B[14~","\x1B[[D"],f5:["\x1B[15~","\x1B[[E"],f6:["\x1B[17~"],f7:["\x1B[18~"],f8:["\x1B[19~"],f9:["\x1B[20~"],f10:["\x1B[21~"],f11:["\x1B[23~"],f12:["\x1B[24~"]},wP={up:["\x1B[a"],down:["\x1B[b"],right:["\x1B[c"],left:["\x1B[d"],clear:["\x1B[e"],insert:["\x1B[2$"],delete:["\x1B[3$"],pageUp:["\x1B[5$"],pageDown:["\x1B[6$"],home:["\x1B[7$"],end:["\x1B[8$"]},OP={up:["\x1BOa"],down:["\x1BOb"],right:["\x1BOc"],left:["\x1BOd"],clear:["\x1BOe"],insert:["\x1B[2^"],delete:["\x1B[3^"],pageUp:["\x1B[5^"],pageDown:["\x1B[6^"],home:["\x1B[7^"],end:["\x1B[8^"]};var B9=(_,z)=>z.includes(_),N9=(_,z,A)=>{if(A===D0.shift)return B9(_,wP[z]);if(A===D0.ctrl)return B9(_,OP[z]);return!1},D6="press";function c5(_){if(_.includes("\x1B[200~"))return!1;if(_.includes(":3u")||_.includes(":3~")||_.includes(":3A")||_.includes(":3B")||_.includes(":3C")||_.includes(":3D")||_.includes(":3H")||_.includes(":3F"))return!0;return!1}function M6(_){if(!_)return"press";let z=parseInt(_,10);if(z===2)return"repeat";if(z===3)return"release";return"press"}function LP(_){let z=_.match(/^\x1b\[(\d+)(?::(\d*))?(?::(\d+))?(?:;(\d+))?(?::(\d+))?u$/);if(z){let Y=parseInt(z[1],10),X=z[2]&&z[2].length>0?parseInt(z[2],10):void 0,b=z[3]?parseInt(z[3],10):void 0,Q=z[4]?parseInt(z[4],10):1,$=M6(z[5]);return D6=$,{codepoint:Y,shiftedKey:X,baseLayoutKey:b,modifier:Q-1,eventType:$}}let A=_.match(/^\x1b\[1;(\d+)(?::(\d+))?([ABCD])$/);if(A){let Y=parseInt(A[1],10),X=M6(A[2]),b={A:-1,B:-2,C:-3,D:-4};return D6=X,{codepoint:b[A[3]],modifier:Y-1,eventType:X}}let G=_.match(/^\x1b\[(\d+)(?:;(\d+))?(?::(\d+))?~$/);if(G){let Y=parseInt(G[1],10),X=G[2]?parseInt(G[2],10):1,b=M6(G[3]),$={2:v0.insert,3:v0.delete,5:v0.pageUp,6:v0.pageDown,7:v0.home,8:v0.end}[Y];if($!==void 0)return D6=b,{codepoint:$,modifier:X-1,eventType:b}}let J=_.match(/^\x1b\[1;(\d+)(?::(\d+))?([HF])$/);if(J){let Y=parseInt(J[1],10),X=M6(J[2]),b=J[3]==="H"?v0.home:v0.end;return D6=X,{codepoint:b,modifier:Y-1,eventType:X}}return null}function r(_,z,A){let G=LP(_);if(!G)return!1;let J=G.modifier&~cb,Y=A&~cb;if(J!==Y)return!1;if(G.codepoint===z)return!0;if(G.baseLayoutKey!==void 0&&G.baseLayoutKey===z)return!0;return!1}function lb(_,z,A){let G=_.match(/^\x1b\[27;(\d+);(\d+)~$/);if(!G)return!1;let J=parseInt(G[1],10),Y=parseInt(G[2],10),X=J-1;return Y===z&&X===A}function jP(_){let z=_.toLowerCase(),A=z.charCodeAt(0);if(A>=97&&A<=122||z==="["||z==="\\"||z==="]"||z==="_")return String.fromCharCode(A&31);if(z==="-")return String.fromCharCode(31);return null}function RP(_){let z=_.toLowerCase().split("+"),A=z[z.length-1];if(!A)return null;return{key:A,ctrl:z.includes("ctrl"),shift:z.includes("shift"),alt:z.includes("alt")}}function w1(_,z){let A=RP(z);if(!A)return!1;let{key:G,ctrl:J,shift:Y,alt:X}=A,b=0;if(Y)b|=D0.shift;if(X)b|=D0.alt;if(J)b|=D0.ctrl;switch(G){case"escape":case"esc":if(b!==0)return!1;return _==="\x1B"||r(_,y0.escape,0);case"space":if(!R4){if(J&&!X&&!Y&&_==="\x00")return!0;if(X&&!J&&!Y&&_==="\x1B ")return!0}if(b===0)return _===" "||r(_,y0.space,0);return r(_,y0.space,b);case"tab":if(Y&&!J&&!X)return _==="\x1B[Z"||r(_,y0.tab,D0.shift);if(b===0)return _==="\t"||r(_,y0.tab,0);return r(_,y0.tab,b);case"enter":case"return":if(Y&&!J&&!X){if(r(_,y0.enter,D0.shift)||r(_,y0.kpEnter,D0.shift))return!0;if(lb(_,y0.enter,D0.shift))return!0;if(R4)return _==="\x1B\r"||_===`
86
+ `;return!1}if(X&&!J&&!Y){if(r(_,y0.enter,D0.alt)||r(_,y0.kpEnter,D0.alt))return!0;if(lb(_,y0.enter,D0.alt))return!0;if(!R4)return _==="\x1B\r";return!1}if(b===0)return _==="\r"||!R4&&_===`
87
+ `||_==="\x1BOM"||r(_,y0.enter,0)||r(_,y0.kpEnter,0);return r(_,y0.enter,b)||r(_,y0.kpEnter,b);case"backspace":if(X&&!J&&!Y){if(_==="\x1B"||_==="\x1B\b")return!0;return r(_,y0.backspace,D0.alt)}if(b===0)return _===""||_==="\b"||r(_,y0.backspace,0);return r(_,y0.backspace,b);case"insert":if(b===0)return B9(_,R9.insert)||r(_,v0.insert,0);if(N9(_,"insert",b))return!0;return r(_,v0.insert,b);case"delete":if(b===0)return B9(_,R9.delete)||r(_,v0.delete,0);if(N9(_,"delete",b))return!0;return r(_,v0.delete,b);case"clear":if(b===0)return B9(_,R9.clear);return N9(_,"clear",b);case"home":if(b===0)return B9(_,R9.home)||r(_,v0.home,0);if(N9(_,"home",b))return!0;return r(_,v0.home,b);case"end":if(b===0)return B9(_,R9.end)||r(_,v0.end,0);if(N9(_,"end",b))return!0;return r(_,v0.end,b);case"pageup":if(b===0)return B9(_,R9.pageUp)||r(_,v0.pageUp,0);if(N9(_,"pageUp",b))return!0;return r(_,v0.pageUp,b);case"pagedown":if(b===0)return B9(_,R9.pageDown)||r(_,v0.pageDown,0);if(N9(_,"pageDown",b))return!0;return r(_,v0.pageDown,b);case"up":if(X&&!J&&!Y)return _==="\x1Bp"||r(_,H9.up,D0.alt);if(b===0)return B9(_,R9.up)||r(_,H9.up,0);if(N9(_,"up",b))return!0;return r(_,H9.up,b);case"down":if(X&&!J&&!Y)return _==="\x1Bn"||r(_,H9.down,D0.alt);if(b===0)return B9(_,R9.down)||r(_,H9.down,0);if(N9(_,"down",b))return!0;return r(_,H9.down,b);case"left":if(X&&!J&&!Y)return _==="\x1B[1;3D"||!R4&&_==="\x1BB"||_==="\x1Bb"||r(_,H9.left,D0.alt);if(J&&!X&&!Y)return _==="\x1B[1;5D"||N9(_,"left",D0.ctrl)||r(_,H9.left,D0.ctrl);if(b===0)return B9(_,R9.left)||r(_,H9.left,0);if(N9(_,"left",b))return!0;return r(_,H9.left,b);case"right":if(X&&!J&&!Y)return _==="\x1B[1;3C"||!R4&&_==="\x1BF"||_==="\x1Bf"||r(_,H9.right,D0.alt);if(J&&!X&&!Y)return _==="\x1B[1;5C"||N9(_,"right",D0.ctrl)||r(_,H9.right,D0.ctrl);if(b===0)return B9(_,R9.right)||r(_,H9.right,0);if(N9(_,"right",b))return!0;return r(_,H9.right,b);case"f1":case"f2":case"f3":case"f4":case"f5":case"f6":case"f7":case"f8":case"f9":case"f10":case"f11":case"f12":{if(b!==0)return!1;return B9(_,R9[G])}}if(G.length===1&&(G>="a"&&G<="z"||EP.has(G))){let Q=G.charCodeAt(0),$=jP(G);if(J&&X&&!Y&&!R4&&$)return _===`\x1B${$}`;if(X&&!J&&!Y&&!R4&&G>="a"&&G<="z"){if(_===`\x1B${G}`)return!0}if(J&&!Y&&!X){if($&&_===$)return!0;return r(_,Q,D0.ctrl)}if(J&&Y&&!X)return r(_,Q,D0.shift+D0.ctrl);if(Y&&!J&&!X){if(_===G.toUpperCase())return!0;return r(_,Q,D0.shift)}if(b!==0)return r(_,Q,b);return _===G||r(_,Q,0)}return!1}var pb={cursorUp:"up",cursorDown:"down",cursorLeft:["left","ctrl+b"],cursorRight:["right","ctrl+f"],cursorWordLeft:["alt+left","ctrl+left","alt+b"],cursorWordRight:["alt+right","ctrl+right","alt+f"],cursorLineStart:["home","ctrl+a"],cursorLineEnd:["end","ctrl+e"],jumpForward:"ctrl+]",jumpBackward:"ctrl+alt+]",pageUp:"pageUp",pageDown:"pageDown",deleteCharBackward:"backspace",deleteCharForward:["delete","ctrl+d"],deleteWordBackward:["ctrl+w","alt+backspace"],deleteWordForward:["alt+d","alt+delete"],deleteToLineStart:"ctrl+u",deleteToLineEnd:"ctrl+k",newLine:"shift+enter",submit:"enter",tab:"tab",selectUp:"up",selectDown:"down",selectPageUp:"pageUp",selectPageDown:"pageDown",selectConfirm:"enter",selectCancel:["escape","ctrl+c"],copy:"ctrl+c",yank:"ctrl+y",yankPop:"alt+y",undo:"ctrl+-",expandTools:"ctrl+o",toggleSessionPath:"ctrl+p",toggleSessionSort:"ctrl+s",renameSession:"ctrl+r",deleteSession:"ctrl+d",deleteSessionNoninvasive:"ctrl+backspace"};class p5{actionToKeys;constructor(_={}){this.actionToKeys=new Map,this.buildMaps(_)}buildMaps(_){this.actionToKeys.clear();for(let[z,A]of Object.entries(pb)){let G=Array.isArray(A)?A:[A];this.actionToKeys.set(z,[...G])}for(let[z,A]of Object.entries(_)){if(A===void 0)continue;let G=Array.isArray(A)?A:[A];this.actionToKeys.set(z,G)}}matches(_,z){let A=this.actionToKeys.get(z);if(!A)return!1;for(let G of A)if(w1(_,G))return!0;return!1}getKeys(_){return this.actionToKeys.get(_)??[]}setConfig(_){this.buildMaps(_)}}var l5=null;function G_(){if(!l5)l5=new p5;return l5}class O1{text;paddingX;paddingY;customBgFn;cachedText;cachedWidth;cachedLines;constructor(_="",z=1,A=1,G){this.text=_,this.paddingX=z,this.paddingY=A,this.customBgFn=G}setText(_){this.text=_,this.cachedText=void 0,this.cachedWidth=void 0,this.cachedLines=void 0}setCustomBgFn(_){this.customBgFn=_,this.cachedText=void 0,this.cachedWidth=void 0,this.cachedLines=void 0}invalidate(){this.cachedText=void 0,this.cachedWidth=void 0,this.cachedLines=void 0}render(_){if(this.cachedLines&&this.cachedText===this.text&&this.cachedWidth===_)return this.cachedLines;if(!this.text||this.text.trim()===""){let H=[];return this.cachedText=this.text,this.cachedWidth=_,this.cachedLines=H,H}let z=this.text.replace(/\t/g," "),A=Math.max(1,_-this.paddingX*2),G=Pz(z,A),J=" ".repeat(this.paddingX),Y=" ".repeat(this.paddingX),X=[];for(let H of G){let B=J+H+Y;if(this.customBgFn)X.push(Sz(B,_,this.customBgFn));else{let Z=W0(B),q=Math.max(0,_-Z);X.push(B+" ".repeat(q))}}let b=" ".repeat(_),Q=[];for(let H=0;H<this.paddingY;H++){let B=this.customBgFn?Sz(b,_,this.customBgFn):b;Q.push(B)}let $=[...Q,...X,...Q];return this.cachedText=this.text,this.cachedWidth=_,this.cachedLines=$,$.length>0?$:[""]}}class E6 extends O1{spinnerColorFn;messageColorFn;message;frames=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];currentFrame=0;intervalId=null;ui=null;constructor(_,z,A,G="Loading..."){super("",1,0);this.spinnerColorFn=z,this.messageColorFn=A,this.message=G,this.ui=_,this.start()}render(_){return["",...super.render(_)]}start(){this.updateDisplay(),this.intervalId=setInterval(()=>{this.currentFrame=(this.currentFrame+1)%this.frames.length,this.updateDisplay()},80)}stop(){if(this.intervalId)clearInterval(this.intervalId),this.intervalId=null}setMessage(_){this.message=_,this.updateDisplay()}updateDisplay(){let _=this.frames[this.currentFrame];if(this.setText(`${this.spinnerColorFn(_)} ${this.messageColorFn(this.message)}`),this.ui)this.ui.requestRender()}}class db extends E6{abortController=new AbortController;onAbort;get signal(){return this.abortController.signal}get aborted(){return this.abortController.signal.aborted}handleInput(_){if(G_().matches(_,"selectCancel"))this.abortController.abort(),this.onAbort?.()}dispose(){this.stop()}}import*as L1 from"node:fs";import*as ab from"node:os";import*as Iz from"node:path";var d5=null,PP={widthPx:9,heightPx:18};function r5(_){PP=_}function ib(){let _=process.env.TERM_PROGRAM?.toLowerCase()||"",z=process.env.TERM?.toLowerCase()||"",A=process.env.COLORTERM?.toLowerCase()||"";if(process.env.KITTY_WINDOW_ID||_==="kitty")return{images:"kitty",trueColor:!0,hyperlinks:!0};if(_==="ghostty"||z.includes("ghostty")||process.env.GHOSTTY_RESOURCES_DIR)return{images:"kitty",trueColor:!0,hyperlinks:!0};if(process.env.WEZTERM_PANE||_==="wezterm")return{images:"kitty",trueColor:!0,hyperlinks:!0};if(process.env.ITERM_SESSION_ID||_==="iterm.app")return{images:"iterm2",trueColor:!0,hyperlinks:!0};if(_==="vscode")return{images:null,trueColor:!0,hyperlinks:!0};if(_==="alacritty")return{images:null,trueColor:!0,hyperlinks:!0};return{images:null,trueColor:A==="truecolor"||A==="24bit",hyperlinks:!0}}function w6(){if(!d5)d5=ib();return d5}var rb="\x1B_G",nb="\x1B]1337;File=";function kz(_){if(_.startsWith(rb)||_.startsWith(nb))return!0;return _.includes(rb)||_.includes(nb)}function n5(_){return _!==null&&"focused"in _}var xz="\x1B_pi:c\x07";function ob(_,z){if(_===void 0)return;if(typeof _==="number")return _;let A=_.match(/^(\d+(?:\.\d+)?)%$/);if(A)return Math.floor(z*parseFloat(A[1])/100);return}class i5{children=[];addChild(_){this.children.push(_)}removeChild(_){let z=this.children.indexOf(_);if(z!==-1)this.children.splice(z,1)}clear(){this.children=[]}invalidate(){for(let _ of this.children)_.invalidate?.()}render(_){let z=[];for(let A of this.children)z.push(...A.render(_));return z}}class j1 extends i5{terminal;previousLines=[];previousWidth=0;previousHeight=0;focusedComponent=null;onDebug;renderRequested=!1;cursorRow=0;hardwareCursorRow=0;inputBuffer="";cellSizeQueryPending=!1;showHardwareCursor=process.env.PI_HARDWARE_CURSOR==="1";maxLinesRendered=0;previousViewportTop=0;fullRedrawCount=0;stopped=!1;overlayStack=[];constructor(_,z){super();if(this.terminal=_,z!==void 0)this.showHardwareCursor=z}get fullRedraws(){return this.fullRedrawCount}getShowHardwareCursor(){return this.showHardwareCursor}setShowHardwareCursor(_){if(this.showHardwareCursor===_)return;if(this.showHardwareCursor=_,!_)this.terminal.hideCursor();this.requestRender()}setFocus(_){if(n5(this.focusedComponent))this.focusedComponent.focused=!1;if(this.focusedComponent=_,n5(_))_.focused=!0}showOverlay(_,z){let A={component:_,options:z,preFocus:this.focusedComponent,hidden:!1};if(this.overlayStack.push(A),this.isOverlayVisible(A))this.setFocus(_);return this.terminal.hideCursor(),this.requestRender(),{hide:()=>{let G=this.overlayStack.indexOf(A);if(G!==-1){if(this.overlayStack.splice(G,1),this.focusedComponent===_){let J=this.getTopmostVisibleOverlay();this.setFocus(J?.component??A.preFocus)}if(this.overlayStack.length===0)this.terminal.hideCursor();this.requestRender()}},setHidden:(G)=>{if(A.hidden===G)return;if(A.hidden=G,G){if(this.focusedComponent===_){let J=this.getTopmostVisibleOverlay();this.setFocus(J?.component??A.preFocus)}}else if(this.isOverlayVisible(A))this.setFocus(_);this.requestRender()},isHidden:()=>A.hidden}}hideOverlay(){let _=this.overlayStack.pop();if(!_)return;let z=this.getTopmostVisibleOverlay();if(this.setFocus(z?.component??_.preFocus),this.overlayStack.length===0)this.terminal.hideCursor();this.requestRender()}hasOverlay(){return this.overlayStack.some((_)=>this.isOverlayVisible(_))}isOverlayVisible(_){if(_.hidden)return!1;if(_.options?.visible)return _.options.visible(this.terminal.columns,this.terminal.rows);return!0}getTopmostVisibleOverlay(){for(let _=this.overlayStack.length-1;_>=0;_--)if(this.isOverlayVisible(this.overlayStack[_]))return this.overlayStack[_];return}invalidate(){super.invalidate();for(let _ of this.overlayStack)_.component.invalidate?.()}start(){this.stopped=!1,this.terminal.start((_)=>this.handleInput(_),()=>this.requestRender()),this.terminal.hideCursor(),this.queryCellSize(),this.requestRender()}queryCellSize(){if(!w6().images)return;this.cellSizeQueryPending=!0,this.terminal.write("\x1B[16t")}stop(){if(this.stopped=!0,this.previousLines.length>0){let z=this.previousLines.length-this.hardwareCursorRow;if(z>0)this.terminal.write(`\x1B[${z}B`);else if(z<0)this.terminal.write(`\x1B[${-z}A`);this.terminal.write(`\r
88
+ `)}this.terminal.showCursor(),this.terminal.stop()}requestRender(_=!1){if(_)this.previousLines=[],this.previousWidth=-1,this.previousHeight=-1,this.cursorRow=0,this.hardwareCursorRow=0,this.maxLinesRendered=0,this.previousViewportTop=0;if(this.renderRequested)return;this.renderRequested=!0,process.nextTick(()=>{this.renderRequested=!1,this.doRender()})}handleInput(_){if(this.cellSizeQueryPending){this.inputBuffer+=_;let A=this.parseCellSizeResponse();if(A.length===0)return;_=A}if(w1(_,"shift+ctrl+d")&&this.onDebug){this.onDebug();return}let z=this.overlayStack.find((A)=>A.component===this.focusedComponent);if(z&&!this.isOverlayVisible(z)){let A=this.getTopmostVisibleOverlay();if(A)this.setFocus(A.component);else this.setFocus(z.preFocus)}if(this.focusedComponent?.handleInput){if(c5(_)&&!this.focusedComponent.wantsKeyRelease)return;this.focusedComponent.handleInput(_),this.requestRender()}}parseCellSizeResponse(){let _=/\x1b\[6;(\d+);(\d+)t/,z=this.inputBuffer.match(_);if(z){let J=parseInt(z[1],10),Y=parseInt(z[2],10);if(J>0&&Y>0)r5({widthPx:Y,heightPx:J}),this.invalidate(),this.requestRender();this.inputBuffer=this.inputBuffer.replace(_,""),this.cellSizeQueryPending=!1}if(/\x1b(\[6?;?[\d;]*)?$/.test(this.inputBuffer)){let J=this.inputBuffer[this.inputBuffer.length-1];if(!/[a-zA-Z~]/.test(J))return""}let G=this.inputBuffer;return this.inputBuffer="",this.cellSizeQueryPending=!1,G}resolveOverlayLayout(_,z,A,G){let J=_??{},Y=typeof J.margin==="number"?{top:J.margin,right:J.margin,bottom:J.margin,left:J.margin}:J.margin??{},X=Math.max(0,Y.top??0),b=Math.max(0,Y.right??0),Q=Math.max(0,Y.bottom??0),$=Math.max(0,Y.left??0),H=Math.max(1,A-$-b),B=Math.max(1,G-X-Q),Z=ob(J.width,A)??Math.min(80,H);if(J.minWidth!==void 0)Z=Math.max(Z,J.minWidth);Z=Math.max(1,Math.min(Z,H));let q=ob(J.maxHeight,G);if(q!==void 0)q=Math.max(1,Math.min(q,B));let F=q!==void 0?Math.min(z,q):z,K,W;if(J.row!==void 0)if(typeof J.row==="string"){let V=J.row.match(/^(\d+(?:\.\d+)?)%$/);if(V){let N=Math.max(0,B-F),L=parseFloat(V[1])/100;K=X+Math.floor(N*L)}else K=this.resolveAnchorRow("center",F,B,X)}else K=J.row;else{let V=J.anchor??"center";K=this.resolveAnchorRow(V,F,B,X)}if(J.col!==void 0)if(typeof J.col==="string"){let V=J.col.match(/^(\d+(?:\.\d+)?)%$/);if(V){let N=Math.max(0,H-Z),L=parseFloat(V[1])/100;W=$+Math.floor(N*L)}else W=this.resolveAnchorCol("center",Z,H,$)}else W=J.col;else{let V=J.anchor??"center";W=this.resolveAnchorCol(V,Z,H,$)}if(J.offsetY!==void 0)K+=J.offsetY;if(J.offsetX!==void 0)W+=J.offsetX;return K=Math.max(X,Math.min(K,G-Q-F)),W=Math.max($,Math.min(W,A-b-Z)),{width:Z,row:K,col:W,maxHeight:q}}resolveAnchorRow(_,z,A,G){switch(_){case"top-left":case"top-center":case"top-right":return G;case"bottom-left":case"bottom-center":case"bottom-right":return G+A-z;case"left-center":case"center":case"right-center":return G+Math.floor((A-z)/2)}}resolveAnchorCol(_,z,A,G){switch(_){case"top-left":case"left-center":case"bottom-left":return G;case"top-right":case"right-center":case"bottom-right":return G+A-z;case"top-center":case"center":case"bottom-center":return G+Math.floor((A-z)/2)}}compositeOverlays(_,z,A){if(this.overlayStack.length===0)return _;let G=[..._],J=[],Y=G.length;for(let $ of this.overlayStack){if(!this.isOverlayVisible($))continue;let{component:H,options:B}=$,{width:Z,maxHeight:q}=this.resolveOverlayLayout(B,0,z,A),F=H.render(Z);if(q!==void 0&&F.length>q)F=F.slice(0,q);let{row:K,col:W}=this.resolveOverlayLayout(B,F.length,z,A);J.push({overlayLines:F,row:K,col:W,w:Z}),Y=Math.max(Y,K+F.length)}let X=Math.max(this.maxLinesRendered,Y);while(G.length<X)G.push("");let b=Math.max(0,X-A),Q=new Set;for(let{overlayLines:$,row:H,col:B,w:Z}of J)for(let q=0;q<$.length;q++){let F=b+H+q;if(F>=0&&F<G.length){let K=W0($[q])>Z?U6($[q],0,Z,!0):$[q];G[F]=this.compositeLineAt(G[F],K,B,Z,z),Q.add(F)}}for(let $ of Q)if(W0(G[$])>z)G[$]=U6(G[$],0,z,!0);return G}static SEGMENT_RESET="\x1B[0m\x1B]8;;\x07";applyLineResets(_){let z=j1.SEGMENT_RESET;for(let A=0;A<_.length;A++){let G=_[A];if(!kz(G))_[A]=G+z}return _}compositeLineAt(_,z,A,G,J){if(kz(_))return _;let Y=A+G,X=ub(_,A,Y,J-Y,!0),b=u5(z,0,G,!0),Q=Math.max(0,A-X.beforeWidth),$=Math.max(0,G-b.width),H=Math.max(A,X.beforeWidth),B=Math.max(G,b.width),Z=Math.max(0,J-H-B),q=Math.max(0,Z-X.afterWidth),F=j1.SEGMENT_RESET,K=X.before+" ".repeat(Q)+F+b.text+" ".repeat($)+F+X.after+" ".repeat(q);if(W0(K)<=J)return K;return U6(K,0,J,!0)}extractCursorPosition(_,z){let A=Math.max(0,_.length-z);for(let G=_.length-1;G>=A;G--){let J=_[G],Y=J.indexOf(xz);if(Y!==-1){let X=J.slice(0,Y),b=W0(X);return _[G]=J.slice(0,Y)+J.slice(Y+xz.length),{row:G,col:b}}}return null}doRender(){if(this.stopped)return;let _=this.terminal.columns,z=this.terminal.rows,A=Math.max(0,this.maxLinesRendered-z),G=this.previousViewportTop,J=this.hardwareCursorRow,Y=(U)=>{let O=J-G;return U-A-O},X=this.render(_);if(this.overlayStack.length>0)X=this.compositeOverlays(X,_,z);let b=this.extractCursorPosition(X,z);X=this.applyLineResets(X);let Q=this.previousWidth!==0&&this.previousWidth!==_,$=this.previousHeight!==0&&this.previousHeight!==z,H=(U)=>{this.fullRedrawCount+=1;let O="\x1B[?2026h";if(U)O+="\x1B[3J\x1B[2J\x1B[H";for(let P=0;P<X.length;P++){if(P>0)O+=`\r
89
+ `;O+=X[P]}if(O+="\x1B[?2026l",this.terminal.write(O),this.cursorRow=Math.max(0,X.length-1),this.hardwareCursorRow=this.cursorRow,U)this.maxLinesRendered=X.length;else this.maxLinesRendered=Math.max(this.maxLinesRendered,X.length);this.previousViewportTop=Math.max(0,this.maxLinesRendered-z),this.positionHardwareCursor(b,X.length),this.previousLines=X,this.previousWidth=_,this.previousHeight=z};if(this.previousLines.length===0&&!Q&&!$){H(!1);return}if(Q||$){H(!0);return}if(X.length<this.maxLinesRendered&&this.overlayStack.length===0){H(!0);return}let B=-1,Z=-1,q=Math.max(X.length,this.previousLines.length);for(let U=0;U<q;U++){let O=U<this.previousLines.length?this.previousLines[U]:"",P=U<X.length?X[U]:"";if(O!==P){if(B===-1)B=U;Z=U}}let F=X.length>this.previousLines.length;if(F){if(B===-1)B=this.previousLines.length;Z=X.length-1}let K=F&&B===this.previousLines.length&&B>0;if(B===-1){this.positionHardwareCursor(b,X.length),this.previousViewportTop=Math.max(0,this.maxLinesRendered-z);return}if(B>=X.length){if(this.previousLines.length>X.length){let U="\x1B[?2026h",O=Math.max(0,X.length-1),P=Y(O);if(P>0)U+=`\x1B[${P}B`;else if(P<0)U+=`\x1B[${-P}A`;U+="\r";let S=this.previousLines.length-X.length;if(S>z){H(!0);return}if(S>0)U+="\x1B[1B";for(let v=0;v<S;v++)if(U+="\r\x1B[2K",v<S-1)U+="\x1B[1B";if(S>0)U+=`\x1B[${S}A`;U+="\x1B[?2026l",this.terminal.write(U),this.cursorRow=O,this.hardwareCursorRow=O}this.positionHardwareCursor(b,X.length),this.previousLines=X,this.previousWidth=_,this.previousHeight=z,this.previousViewportTop=Math.max(0,this.maxLinesRendered-z);return}if(B<A){H(!0);return}let W="\x1B[?2026h",V=G+z-1,N=K?B-1:B;if(N>V){let U=Math.max(0,Math.min(z-1,J-G)),O=z-1-U;if(O>0)W+=`\x1B[${O}B`;let P=N-V;W+=`\r
90
+ `.repeat(P),G+=P,A+=P,J=N}let L=Y(N);if(L>0)W+=`\x1B[${L}B`;else if(L<0)W+=`\x1B[${-L}A`;W+=K?`\r
91
+ `:"\r";let M=Math.min(Z,X.length-1);for(let U=B;U<=M;U++){if(U>B)W+=`\r
92
+ `;W+="\x1B[2K";let O=X[U];if(!kz(O)&&W0(O)>_){let S=Iz.join(ab.homedir(),".pi","agent","pi-crash.log"),v=[`Crash at ${new Date().toISOString()}`,`Terminal width: ${_}`,`Line ${U} visible width: ${W0(O)}`,"","=== All rendered lines ===",...X.map((g,f)=>`[${f}] (w=${W0(g)}) ${g}`),""].join(`
93
+ `);L1.mkdirSync(Iz.dirname(S),{recursive:!0}),L1.writeFileSync(S,v),this.stop();let i=[`Rendered line ${U} exceeds terminal width (${W0(O)} > ${_}).`,"","This is likely caused by a custom TUI component not truncating its output.","Use visibleWidth() to measure and truncateToWidth() to truncate lines.","",`Debug log written to: ${S}`].join(`
94
+ `);throw Error(i)}W+=O}let k=M;if(this.previousLines.length>X.length){if(M<X.length-1){let O=X.length-1-M;W+=`\x1B[${O}B`,k=X.length-1}let U=this.previousLines.length-X.length;for(let O=X.length;O<this.previousLines.length;O++)W+=`\r
95
+ \x1B[2K`;W+=`\x1B[${U}A`}if(W+="\x1B[?2026l",process.env.PI_TUI_DEBUG==="1"){L1.mkdirSync("/tmp/tui",{recursive:!0});let O=Iz.join("/tmp/tui",`render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`),P=[`firstChanged: ${B}`,`viewportTop: ${A}`,`cursorRow: ${this.cursorRow}`,`height: ${z}`,`lineDiff: ${L}`,`hardwareCursorRow: ${J}`,`renderEnd: ${M}`,`finalCursorRow: ${k}`,`cursorPos: ${JSON.stringify(b)}`,`newLines.length: ${X.length}`,`previousLines.length: ${this.previousLines.length}`,"","=== newLines ===",JSON.stringify(X,null,2),"","=== previousLines ===",JSON.stringify(this.previousLines,null,2),"","=== buffer ===",JSON.stringify(W)].join(`
96
+ `);L1.writeFileSync(O,P)}this.terminal.write(W),this.cursorRow=Math.max(0,X.length-1),this.hardwareCursorRow=k,this.maxLinesRendered=Math.max(this.maxLinesRendered,X.length),this.previousViewportTop=Math.max(0,this.maxLinesRendered-z),this.positionHardwareCursor(b,X.length),this.previousLines=X,this.previousWidth=_,this.previousHeight=z}positionHardwareCursor(_,z){if(!_||z<=0){this.terminal.hideCursor();return}let A=Math.max(0,Math.min(_.row,z-1)),G=Math.max(0,_.col),J=A-this.hardwareCursorRow,Y="";if(J>0)Y+=`\x1B[${J}B`;else if(J<0)Y+=`\x1B[${-J}A`;if(Y+=`\x1B[${G+1}G`,Y)this.terminal.write(Y);if(this.hardwareCursorRow=A,this.showHardwareCursor)this.terminal.showCursor();else this.terminal.hideCursor()}}var SP=(_)=>_.replace(/[\r\n]+/g," ").trim();class Tz{items=[];filteredItems=[];selectedIndex=0;maxVisible=5;theme;onSelect;onCancel;onSelectionChange;constructor(_,z,A){this.items=_,this.filteredItems=_,this.maxVisible=z,this.theme=A}setFilter(_){this.filteredItems=this.items.filter((z)=>z.value.toLowerCase().startsWith(_.toLowerCase())),this.selectedIndex=0}setSelectedIndex(_){this.selectedIndex=Math.max(0,Math.min(_,this.filteredItems.length-1))}invalidate(){}render(_){let z=[];if(this.filteredItems.length===0)return z.push(this.theme.noMatch(" No matching commands")),z;let A=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredItems.length-this.maxVisible)),G=Math.min(A+this.maxVisible,this.filteredItems.length);for(let J=A;J<G;J++){let Y=this.filteredItems[J];if(!Y)continue;let X=J===this.selectedIndex,b=Y.description?SP(Y.description):void 0,Q="";if(X){let H=Y.label||Y.value;if(b&&_>40){let B=Math.min(30,_-2-4),Z=t0(H,B,""),q=" ".repeat(Math.max(1,32-Z.length)),F=2+Z.length+q.length,K=_-F-2;if(K>10){let W=t0(b,K,"");Q=this.theme.selectedText(`→ ${Z}${q}${W}`)}else{let W=_-2-2;Q=this.theme.selectedText(`→ ${t0(H,W,"")}`)}}else{let B=_-2-2;Q=this.theme.selectedText(`→ ${t0(H,B,"")}`)}}else{let $=Y.label||Y.value,H=" ";if(b&&_>40){let B=Math.min(30,_-2-4),Z=t0($,B,""),q=" ".repeat(Math.max(1,32-Z.length)),F=2+Z.length+q.length,K=_-F-2;if(K>10){let W=t0(b,K,""),V=this.theme.description(q+W);Q=" "+Z+V}else{let W=_-2-2;Q=" "+t0($,W,"")}}else{let B=_-2-2;Q=" "+t0($,B,"")}}z.push(Q)}if(A>0||G<this.filteredItems.length){let J=` (${this.selectedIndex+1}/${this.filteredItems.length})`;z.push(this.theme.scrollInfo(t0(J,_-2,"")))}return z}handleInput(_){let z=G_();if(z.matches(_,"selectUp"))this.selectedIndex=this.selectedIndex===0?this.filteredItems.length-1:this.selectedIndex-1,this.notifySelectionChange();else if(z.matches(_,"selectDown"))this.selectedIndex=this.selectedIndex===this.filteredItems.length-1?0:this.selectedIndex+1,this.notifySelectionChange();else if(z.matches(_,"selectConfirm")){let A=this.filteredItems[this.selectedIndex];if(A&&this.onSelect)this.onSelect(A)}else if(z.matches(_,"selectCancel")){if(this.onCancel)this.onCancel()}}notifySelectionChange(){let _=this.filteredItems[this.selectedIndex];if(_&&this.onSelectionChange)this.onSelectionChange(_)}getSelectedItem(){return this.filteredItems[this.selectedIndex]||null}}var ys=W6();var ls=W6();function a5(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var h_=a5();function AQ(_){h_=_}var yz={exec:()=>null};function B0(_,z=""){let A=typeof _==="string"?_:_.source,G={replace:(J,Y)=>{let X=typeof Y==="string"?Y:Y.source;return X=X.replace(A9.caret,"$1"),A=A.replace(J,X),G},getRegex:()=>{return new RegExp(A,z)}};return G}var A9={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:(_)=>new RegExp(`^( {0,3}${_})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}#`),htmlBeginRegex:(_)=>new RegExp(`^ {0,${Math.min(3,_-1)}}<(?:[a-z].*>|!--)`,"i")},vP=/^(?:[ \t]*(?:\n|$))+/,yP=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,gP=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,gz=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,fP=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,s5=/(?:[*+-]|\d{1,9}[.)])/,GQ=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,JQ=B0(GQ).replace(/bull/g,s5).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),hP=B0(GQ).replace(/bull/g,s5).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),t5=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,mP=/^[^\n]+/,e5=/(?!\s*\])(?:\\.|[^\[\]\\])+/,uP=B0(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",e5).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),cP=B0(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,s5).getRegex(),S6="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",_2=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,lP=B0("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",_2).replace("tag",S6).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),YQ=B0(t5).replace("hr",gz).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",S6).getRegex(),pP=B0(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",YQ).getRegex(),z2={blockquote:pP,code:yP,def:uP,fences:gP,heading:fP,hr:gz,html:lP,lheading:JQ,list:cP,newline:vP,paragraph:YQ,table:yz,text:mP},sb=B0("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",gz).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",S6).getRegex(),dP={...z2,lheading:hP,table:sb,paragraph:B0(t5).replace("hr",gz).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",sb).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",S6).getRegex()},rP={...z2,html:B0(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",_2).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:yz,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:B0(t5).replace("hr",gz).replace("heading",` *#{1,6} *[^
97
+ ]`).replace("lheading",JQ).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},nP=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,iP=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,XQ=/^( {2,}|\\)\n(?!\s*$)/,oP=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,k6=/[\p{P}\p{S}]/u,A2=/[\s\p{P}\p{S}]/u,bQ=/[^\s\p{P}\p{S}]/u,aP=B0(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,A2).getRegex(),QQ=/(?!~)[\p{P}\p{S}]/u,sP=/(?!~)[\s\p{P}\p{S}]/u,tP=/(?:[^\s\p{P}\p{S}]|~)/u,eP=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,$Q=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,_S=B0($Q,"u").replace(/punct/g,k6).getRegex(),zS=B0($Q,"u").replace(/punct/g,QQ).getRegex(),HQ="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",AS=B0(HQ,"gu").replace(/notPunctSpace/g,bQ).replace(/punctSpace/g,A2).replace(/punct/g,k6).getRegex(),GS=B0(HQ,"gu").replace(/notPunctSpace/g,tP).replace(/punctSpace/g,sP).replace(/punct/g,QQ).getRegex(),JS=B0("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,bQ).replace(/punctSpace/g,A2).replace(/punct/g,k6).getRegex(),YS=B0(/\\(punct)/,"gu").replace(/punct/g,k6).getRegex(),XS=B0(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),bS=B0(_2).replace("(?:-->|$)","-->").getRegex(),QS=B0("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",bS).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),j6=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,$S=B0(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",j6).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),BQ=B0(/^!?\[(label)\]\[(ref)\]/).replace("label",j6).replace("ref",e5).getRegex(),ZQ=B0(/^!?\[(ref)\](?:\[\])?/).replace("ref",e5).getRegex(),HS=B0("reflink|nolink(?!\\()","g").replace("reflink",BQ).replace("nolink",ZQ).getRegex(),G2={_backpedal:yz,anyPunctuation:YS,autolink:XS,blockSkip:eP,br:XQ,code:iP,del:yz,emStrongLDelim:_S,emStrongRDelimAst:AS,emStrongRDelimUnd:JS,escape:nP,link:$S,nolink:ZQ,punctuation:aP,reflink:BQ,reflinkSearch:HS,tag:QS,text:oP,url:yz},BS={...G2,link:B0(/^!?\[(label)\]\((.*?)\)/).replace("label",j6).getRegex(),reflink:B0(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",j6).getRegex()},o5={...G2,emStrongRDelimAst:GS,emStrongLDelim:zS,url:B0(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},ZS={...o5,br:B0(XQ).replace("{2,}","*").getRegex(),text:B0(o5.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},O6={normal:z2,gfm:dP,pedantic:rP},Cz={normal:G2,gfm:o5,breaks:ZS,pedantic:BS},qS={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},tb=(_)=>qS[_];function H4(_,z){if(z){if(A9.escapeTest.test(_))return _.replace(A9.escapeReplace,tb)}else if(A9.escapeTestNoEncode.test(_))return _.replace(A9.escapeReplaceNoEncode,tb);return _}function eb(_){try{_=encodeURI(_).replace(A9.percentDecode,"%")}catch{return null}return _}function _Q(_,z){let A=_.replace(A9.findPipe,(Y,X,b)=>{let Q=!1,$=X;while(--$>=0&&b[$]==="\\")Q=!Q;if(Q)return"|";else return" |"}),G=A.split(A9.splitPipe),J=0;if(!G[0].trim())G.shift();if(G.length>0&&!G.at(-1)?.trim())G.pop();if(z)if(G.length>z)G.splice(z);else while(G.length<z)G.push("");for(;J<G.length;J++)G[J]=G[J].trim().replace(A9.slashPipe,"|");return G}function vz(_,z,A){let G=_.length;if(G===0)return"";let J=0;while(J<G){let Y=_.charAt(G-J-1);if(Y===z&&!A)J++;else if(Y!==z&&A)J++;else break}return _.slice(0,G-J)}function FS(_,z){if(_.indexOf(z[1])===-1)return-1;let A=0;for(let G=0;G<_.length;G++)if(_[G]==="\\")G++;else if(_[G]===z[0])A++;else if(_[G]===z[1]){if(A--,A<0)return G}if(A>0)return-2;return-1}function zQ(_,z,A,G,J){let Y=z.href,X=z.title||null,b=_[1].replace(J.other.outputLinkReplace,"$1");G.state.inLink=!0;let Q={type:_[0].charAt(0)==="!"?"image":"link",raw:A,href:Y,title:X,text:b,tokens:G.inlineTokens(b)};return G.state.inLink=!1,Q}function KS(_,z,A){let G=_.match(A.other.indentCodeCompensation);if(G===null)return z;let J=G[1];return z.split(`
98
+ `).map((Y)=>{let X=Y.match(A.other.beginningSpace);if(X===null)return Y;let[b]=X;if(b.length>=J.length)return Y.slice(J.length);return Y}).join(`
99
+ `)}var R6=class{options;rules;lexer;constructor(_){this.options=_||h_}space(_){let z=this.rules.block.newline.exec(_);if(z&&z[0].length>0)return{type:"space",raw:z[0]}}code(_){let z=this.rules.block.code.exec(_);if(z){let A=z[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:z[0],codeBlockStyle:"indented",text:!this.options.pedantic?vz(A,`
100
+ `):A}}}fences(_){let z=this.rules.block.fences.exec(_);if(z){let A=z[0],G=KS(A,z[3]||"",this.rules);return{type:"code",raw:A,lang:z[2]?z[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):z[2],text:G}}}heading(_){let z=this.rules.block.heading.exec(_);if(z){let A=z[2].trim();if(this.rules.other.endingHash.test(A)){let G=vz(A,"#");if(this.options.pedantic)A=G.trim();else if(!G||this.rules.other.endingSpaceChar.test(G))A=G.trim()}return{type:"heading",raw:z[0],depth:z[1].length,text:A,tokens:this.lexer.inline(A)}}}hr(_){let z=this.rules.block.hr.exec(_);if(z)return{type:"hr",raw:vz(z[0],`
101
+ `)}}blockquote(_){let z=this.rules.block.blockquote.exec(_);if(z){let A=vz(z[0],`
101
102
  `).split(`
102
- `),b="",G="",J=[];while(A.length>0){let Y=!1,X=[],Q;for(Q=0;Q<A.length;Q++)if(this.rules.other.blockquoteStart.test(A[Q]))X.push(A[Q]),Y=!0;else if(!Y)X.push(A[Q]);else break;A=A.slice(Q);let $=X.join(`
103
+ `),G="",J="",Y=[];while(A.length>0){let X=!1,b=[],Q;for(Q=0;Q<A.length;Q++)if(this.rules.other.blockquoteStart.test(A[Q]))b.push(A[Q]),X=!0;else if(!X)b.push(A[Q]);else break;A=A.slice(Q);let $=b.join(`
103
104
  `),H=$.replace(this.rules.other.blockquoteSetextReplace,`
104
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");b=b?`${b}
105
- ${$}`:$,G=G?`${G}
106
- ${H}`:H;let B=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(H,J,!0),this.lexer.state.top=B,A.length===0)break;let Z=J.at(-1);if(Z?.type==="code")break;else if(Z?.type==="blockquote"){let F=Z,K=F.raw+`
105
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");G=G?`${G}
106
+ ${$}`:$,J=J?`${J}
107
+ ${H}`:H;let B=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(H,Y,!0),this.lexer.state.top=B,A.length===0)break;let Z=Y.at(-1);if(Z?.type==="code")break;else if(Z?.type==="blockquote"){let q=Z,F=q.raw+`
107
108
  `+A.join(`
108
- `),q=this.blockquote(K);J[J.length-1]=q,b=b.substring(0,b.length-F.raw.length)+q.raw,G=G.substring(0,G.length-F.text.length)+q.text;break}else if(Z?.type==="list"){let F=Z,K=F.raw+`
109
+ `),K=this.blockquote(F);Y[Y.length-1]=K,G=G.substring(0,G.length-q.raw.length)+K.raw,J=J.substring(0,J.length-q.text.length)+K.text;break}else if(Z?.type==="list"){let q=Z,F=q.raw+`
109
110
  `+A.join(`
110
- `),q=this.list(K);J[J.length-1]=q,b=b.substring(0,b.length-Z.raw.length)+q.raw,G=G.substring(0,G.length-F.raw.length)+q.raw,A=K.substring(J.at(-1).raw.length).split(`
111
- `);continue}}return{type:"blockquote",raw:b,tokens:J,text:G}}}list(_){let z=this.rules.block.list.exec(_);if(z){let A=z[1].trim(),b=A.length>1,G={type:"list",raw:"",ordered:b,start:b?+A.slice(0,-1):"",loose:!1,items:[]};if(A=b?`\\d{1,9}\\${A.slice(-1)}`:`\\${A}`,this.options.pedantic)A=b?A:"[*+-]";let J=this.rules.other.listItemRegex(A),Y=!1;while(_){let Q=!1,$="",H="";if(!(z=J.exec(_)))break;if(this.rules.block.hr.test(_))break;$=z[0],_=_.substring($.length);let B=z[2].split(`
111
+ `),K=this.list(F);Y[Y.length-1]=K,G=G.substring(0,G.length-Z.raw.length)+K.raw,J=J.substring(0,J.length-q.raw.length)+K.raw,A=F.substring(Y.at(-1).raw.length).split(`
112
+ `);continue}}return{type:"blockquote",raw:G,tokens:Y,text:J}}}list(_){let z=this.rules.block.list.exec(_);if(z){let A=z[1].trim(),G=A.length>1,J={type:"list",raw:"",ordered:G,start:G?+A.slice(0,-1):"",loose:!1,items:[]};if(A=G?`\\d{1,9}\\${A.slice(-1)}`:`\\${A}`,this.options.pedantic)A=G?A:"[*+-]";let Y=this.rules.other.listItemRegex(A),X=!1;while(_){let Q=!1,$="",H="";if(!(z=Y.exec(_)))break;if(this.rules.block.hr.test(_))break;$=z[0],_=_.substring($.length);let B=z[2].split(`
112
113
  `,1)[0].replace(this.rules.other.listReplaceTabs,(V)=>" ".repeat(3*V.length)),Z=_.split(`
113
- `,1)[0],F=!B.trim(),K=0;if(this.options.pedantic)K=2,H=B.trimStart();else if(F)K=z[1].length+1;else K=z[2].search(this.rules.other.nonSpaceChar),K=K>4?1:K,H=B.slice(K),K+=z[1].length;if(F&&this.rules.other.blankLine.test(Z))$+=Z+`
114
- `,_=_.substring(Z.length+1),Q=!0;if(!Q){let V=this.rules.other.nextBulletRegex(K),w=this.rules.other.hrRegex(K),O=this.rules.other.fencesBeginRegex(K),M=this.rules.other.headingBeginRegex(K),P=this.rules.other.htmlBeginRegex(K);while(_){let D=_.split(`
115
- `,1)[0],L;if(Z=D,this.options.pedantic)Z=Z.replace(this.rules.other.listReplaceNesting," "),L=Z;else L=Z.replace(this.rules.other.tabCharGlobal," ");if(O.test(Z))break;if(M.test(Z))break;if(P.test(Z))break;if(V.test(Z))break;if(w.test(Z))break;if(L.search(this.rules.other.nonSpaceChar)>=K||!Z.trim())H+=`
116
- `+L.slice(K);else{if(F)break;if(B.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4)break;if(O.test(B))break;if(M.test(B))break;if(w.test(B))break;H+=`
117
- `+Z}if(!F&&!Z.trim())F=!0;$+=D+`
118
- `,_=_.substring(D.length+1),B=L.slice(K)}}if(!G.loose){if(Y)G.loose=!0;else if(this.rules.other.doubleBlankLine.test($))Y=!0}let q=null,W;if(this.options.gfm){if(q=this.rules.other.listIsTask.exec(H),q)W=q[0]!=="[ ] ",H=H.replace(this.rules.other.listReplaceTask,"")}G.items.push({type:"list_item",raw:$,task:!!q,checked:W,loose:!1,text:H,tokens:[]}),G.raw+=$}let X=G.items.at(-1);if(X)X.raw=X.raw.trimEnd(),X.text=X.text.trimEnd();else return;G.raw=G.raw.trimEnd();for(let Q=0;Q<G.items.length;Q++)if(this.lexer.state.top=!1,G.items[Q].tokens=this.lexer.blockTokens(G.items[Q].text,[]),!G.loose){let $=G.items[Q].tokens.filter((B)=>B.type==="space"),H=$.length>0&&$.some((B)=>this.rules.other.anyLine.test(B.raw));G.loose=H}if(G.loose)for(let Q=0;Q<G.items.length;Q++)G.items[Q].loose=!0;return G}}html(_){let z=this.rules.block.html.exec(_);if(z)return{type:"html",block:!0,raw:z[0],pre:z[1]==="pre"||z[1]==="script"||z[1]==="style",text:z[0]}}def(_){let z=this.rules.block.def.exec(_);if(z){let A=z[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),b=z[2]?z[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",G=z[3]?z[3].substring(1,z[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):z[3];return{type:"def",tag:A,raw:z[0],href:b,title:G}}}table(_){let z=this.rules.block.table.exec(_);if(!z)return;if(!this.rules.other.tableDelimiter.test(z[2]))return;let A=yX(z[1]),b=z[2].replace(this.rules.other.tableAlignChars,"").split("|"),G=z[3]?.trim()?z[3].replace(this.rules.other.tableRowBlankLine,"").split(`
119
- `):[],J={type:"table",raw:z[0],header:[],align:[],rows:[]};if(A.length!==b.length)return;for(let Y of b)if(this.rules.other.tableAlignRight.test(Y))J.align.push("right");else if(this.rules.other.tableAlignCenter.test(Y))J.align.push("center");else if(this.rules.other.tableAlignLeft.test(Y))J.align.push("left");else J.align.push(null);for(let Y=0;Y<A.length;Y++)J.header.push({text:A[Y],tokens:this.lexer.inline(A[Y]),header:!0,align:J.align[Y]});for(let Y of G)J.rows.push(yX(Y,J.header.length).map((X,Q)=>{return{text:X,tokens:this.lexer.inline(X),header:!1,align:J.align[Q]}}));return J}lheading(_){let z=this.rules.block.lheading.exec(_);if(z)return{type:"heading",raw:z[0],depth:z[2].charAt(0)==="="?1:2,text:z[1],tokens:this.lexer.inline(z[1])}}paragraph(_){let z=this.rules.block.paragraph.exec(_);if(z){let A=z[1].charAt(z[1].length-1)===`
120
- `?z[1].slice(0,-1):z[1];return{type:"paragraph",raw:z[0],text:A,tokens:this.lexer.inline(A)}}}text(_){let z=this.rules.block.text.exec(_);if(z)return{type:"text",raw:z[0],text:z[0],tokens:this.lexer.inline(z[0])}}escape(_){let z=this.rules.inline.escape.exec(_);if(z)return{type:"escape",raw:z[0],text:z[1]}}tag(_){let z=this.rules.inline.tag.exec(_);if(z){if(!this.lexer.state.inLink&&this.rules.other.startATag.test(z[0]))this.lexer.state.inLink=!0;else if(this.lexer.state.inLink&&this.rules.other.endATag.test(z[0]))this.lexer.state.inLink=!1;if(!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(z[0]))this.lexer.state.inRawBlock=!0;else if(this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(z[0]))this.lexer.state.inRawBlock=!1;return{type:"html",raw:z[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:z[0]}}}link(_){let z=this.rules.inline.link.exec(_);if(z){let A=z[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(A)){if(!this.rules.other.endAngleBracket.test(A))return;let J=Sz(A.slice(0,-1),"\\");if((A.length-J.length)%2===0)return}else{let J=KP(z[2],"()");if(J===-2)return;if(J>-1){let X=(z[0].indexOf("!")===0?5:4)+z[1].length+J;z[2]=z[2].substring(0,J),z[0]=z[0].substring(0,X).trim(),z[3]=""}}let b=z[2],G="";if(this.options.pedantic){let J=this.rules.other.pedanticHrefTitle.exec(b);if(J)b=J[1],G=J[3]}else G=z[3]?z[3].slice(1,-1):"";if(b=b.trim(),this.rules.other.startAngleBracket.test(b))if(this.options.pedantic&&!this.rules.other.endAngleBracket.test(A))b=b.slice(1);else b=b.slice(1,-1);return gX(z,{href:b?b.replace(this.rules.inline.anyPunctuation,"$1"):b,title:G?G.replace(this.rules.inline.anyPunctuation,"$1"):G},z[0],this.lexer,this.rules)}}reflink(_,z){let A;if((A=this.rules.inline.reflink.exec(_))||(A=this.rules.inline.nolink.exec(_))){let b=(A[2]||A[1]).replace(this.rules.other.multipleSpaceGlobal," "),G=z[b.toLowerCase()];if(!G){let J=A[0].charAt(0);return{type:"text",raw:J,text:J}}return gX(A,G,A[0],this.lexer,this.rules)}}emStrong(_,z,A=""){let b=this.rules.inline.emStrongLDelim.exec(_);if(!b)return;if(b[3]&&A.match(this.rules.other.unicodeAlphaNumeric))return;if(!(b[1]||b[2])||!A||this.rules.inline.punctuation.exec(A)){let J=[...b[0]].length-1,Y,X,Q=J,$=0,H=b[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;H.lastIndex=0,z=z.slice(-1*_.length+J);while((b=H.exec(z))!=null){if(Y=b[1]||b[2]||b[3]||b[4]||b[5]||b[6],!Y)continue;if(X=[...Y].length,b[3]||b[4]){Q+=X;continue}else if(b[5]||b[6]){if(J%3&&!((J+X)%3)){$+=X;continue}}if(Q-=X,Q>0)continue;X=Math.min(X,X+Q+$);let B=[...b[0]][0].length,Z=_.slice(0,J+b.index+B+X);if(Math.min(J,X)%2){let K=Z.slice(1,-1);return{type:"em",raw:Z,text:K,tokens:this.lexer.inlineTokens(K)}}let F=Z.slice(2,-2);return{type:"strong",raw:Z,text:F,tokens:this.lexer.inlineTokens(F)}}}}codespan(_){let z=this.rules.inline.code.exec(_);if(z){let A=z[2].replace(this.rules.other.newLineCharGlobal," "),b=this.rules.other.nonSpaceChar.test(A),G=this.rules.other.startingSpaceChar.test(A)&&this.rules.other.endingSpaceChar.test(A);if(b&&G)A=A.substring(1,A.length-1);return{type:"codespan",raw:z[0],text:A}}}br(_){let z=this.rules.inline.br.exec(_);if(z)return{type:"br",raw:z[0]}}del(_){let z=this.rules.inline.del.exec(_);if(z)return{type:"del",raw:z[0],text:z[2],tokens:this.lexer.inlineTokens(z[2])}}autolink(_){let z=this.rules.inline.autolink.exec(_);if(z){let A,b;if(z[2]==="@")A=z[1],b="mailto:"+A;else A=z[1],b=A;return{type:"link",raw:z[0],text:A,href:b,tokens:[{type:"text",raw:A,text:A}]}}}url(_){let z;if(z=this.rules.inline.url.exec(_)){let A,b;if(z[2]==="@")A=z[0],b="mailto:"+A;else{let G;do G=z[0],z[0]=this.rules.inline._backpedal.exec(z[0])?.[0]??"";while(G!==z[0]);if(A=z[0],z[1]==="www.")b="http://"+z[0];else b=z[0]}return{type:"link",raw:z[0],text:A,href:b,tokens:[{type:"text",raw:A,text:A}]}}}inlineText(_){let z=this.rules.inline.text.exec(_);if(z){let A=this.lexer.state.inRawBlock;return{type:"text",raw:z[0],text:z[0],escaped:A}}}},L4=class _{tokens;options;state;tokenizer;inlineQueue;constructor(z){this.tokens=[],this.tokens.links=Object.create(null),this.options=z||R_,this.options.tokenizer=this.options.tokenizer||new M6,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let A={other:_9,block:V6.normal,inline:Pz.normal};if(this.options.pedantic)A.block=V6.pedantic,A.inline=Pz.pedantic;else if(this.options.gfm)if(A.block=V6.gfm,this.options.breaks)A.inline=Pz.breaks;else A.inline=Pz.gfm;this.tokenizer.rules=A}static get rules(){return{block:V6,inline:Pz}}static lex(z,A){return new _(A).lex(z)}static lexInline(z,A){return new _(A).inlineTokens(z)}lex(z){z=z.replace(_9.carriageReturn,`
121
- `),this.blockTokens(z,this.tokens);for(let A=0;A<this.inlineQueue.length;A++){let b=this.inlineQueue[A];this.inlineTokens(b.src,b.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(z,A=[],b=!1){if(this.options.pedantic)z=z.replace(_9.tabCharGlobal," ").replace(_9.spaceLine,"");while(z){let G;if(this.options.extensions?.block?.some((Y)=>{if(G=Y.call({lexer:this},z,A))return z=z.substring(G.raw.length),A.push(G),!0;return!1}))continue;if(G=this.tokenizer.space(z)){z=z.substring(G.raw.length);let Y=A.at(-1);if(G.raw.length===1&&Y!==void 0)Y.raw+=`
122
- `;else A.push(G);continue}if(G=this.tokenizer.code(z)){z=z.substring(G.raw.length);let Y=A.at(-1);if(Y?.type==="paragraph"||Y?.type==="text")Y.raw+=`
123
- `+G.raw,Y.text+=`
124
- `+G.text,this.inlineQueue.at(-1).src=Y.text;else A.push(G);continue}if(G=this.tokenizer.fences(z)){z=z.substring(G.raw.length),A.push(G);continue}if(G=this.tokenizer.heading(z)){z=z.substring(G.raw.length),A.push(G);continue}if(G=this.tokenizer.hr(z)){z=z.substring(G.raw.length),A.push(G);continue}if(G=this.tokenizer.blockquote(z)){z=z.substring(G.raw.length),A.push(G);continue}if(G=this.tokenizer.list(z)){z=z.substring(G.raw.length),A.push(G);continue}if(G=this.tokenizer.html(z)){z=z.substring(G.raw.length),A.push(G);continue}if(G=this.tokenizer.def(z)){z=z.substring(G.raw.length);let Y=A.at(-1);if(Y?.type==="paragraph"||Y?.type==="text")Y.raw+=`
125
- `+G.raw,Y.text+=`
126
- `+G.raw,this.inlineQueue.at(-1).src=Y.text;else if(!this.tokens.links[G.tag])this.tokens.links[G.tag]={href:G.href,title:G.title};continue}if(G=this.tokenizer.table(z)){z=z.substring(G.raw.length),A.push(G);continue}if(G=this.tokenizer.lheading(z)){z=z.substring(G.raw.length),A.push(G);continue}let J=z;if(this.options.extensions?.startBlock){let Y=1/0,X=z.slice(1),Q;if(this.options.extensions.startBlock.forEach(($)=>{if(Q=$.call({lexer:this},X),typeof Q==="number"&&Q>=0)Y=Math.min(Y,Q)}),Y<1/0&&Y>=0)J=z.substring(0,Y+1)}if(this.state.top&&(G=this.tokenizer.paragraph(J))){let Y=A.at(-1);if(b&&Y?.type==="paragraph")Y.raw+=`
127
- `+G.raw,Y.text+=`
128
- `+G.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=Y.text;else A.push(G);b=J.length!==z.length,z=z.substring(G.raw.length);continue}if(G=this.tokenizer.text(z)){z=z.substring(G.raw.length);let Y=A.at(-1);if(Y?.type==="text")Y.raw+=`
129
- `+G.raw,Y.text+=`
130
- `+G.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=Y.text;else A.push(G);continue}if(z){let Y="Infinite loop on byte: "+z.charCodeAt(0);if(this.options.silent){console.error(Y);break}else throw Error(Y)}}return this.state.top=!0,A}inline(z,A=[]){return this.inlineQueue.push({src:z,tokens:A}),A}inlineTokens(z,A=[]){let b=z,G=null;if(this.tokens.links){let X=Object.keys(this.tokens.links);if(X.length>0){while((G=this.tokenizer.rules.inline.reflinkSearch.exec(b))!=null)if(X.includes(G[0].slice(G[0].lastIndexOf("[")+1,-1)))b=b.slice(0,G.index)+"["+"a".repeat(G[0].length-2)+"]"+b.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex)}}while((G=this.tokenizer.rules.inline.anyPunctuation.exec(b))!=null)b=b.slice(0,G.index)+"++"+b.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);while((G=this.tokenizer.rules.inline.blockSkip.exec(b))!=null)b=b.slice(0,G.index)+"["+"a".repeat(G[0].length-2)+"]"+b.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let J=!1,Y="";while(z){if(!J)Y="";J=!1;let X;if(this.options.extensions?.inline?.some(($)=>{if(X=$.call({lexer:this},z,A))return z=z.substring(X.raw.length),A.push(X),!0;return!1}))continue;if(X=this.tokenizer.escape(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.tag(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.link(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.reflink(z,this.tokens.links)){z=z.substring(X.raw.length);let $=A.at(-1);if(X.type==="text"&&$?.type==="text")$.raw+=X.raw,$.text+=X.text;else A.push(X);continue}if(X=this.tokenizer.emStrong(z,b,Y)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.codespan(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.br(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.del(z)){z=z.substring(X.raw.length),A.push(X);continue}if(X=this.tokenizer.autolink(z)){z=z.substring(X.raw.length),A.push(X);continue}if(!this.state.inLink&&(X=this.tokenizer.url(z))){z=z.substring(X.raw.length),A.push(X);continue}let Q=z;if(this.options.extensions?.startInline){let $=1/0,H=z.slice(1),B;if(this.options.extensions.startInline.forEach((Z)=>{if(B=Z.call({lexer:this},H),typeof B==="number"&&B>=0)$=Math.min($,B)}),$<1/0&&$>=0)Q=z.substring(0,$+1)}if(X=this.tokenizer.inlineText(Q)){if(z=z.substring(X.raw.length),X.raw.slice(-1)!=="_")Y=X.raw.slice(-1);J=!0;let $=A.at(-1);if($?.type==="text")$.raw+=X.raw,$.text+=X.text;else A.push(X);continue}if(z){let $="Infinite loop on byte: "+z.charCodeAt(0);if(this.options.silent){console.error($);break}else throw Error($)}}return A}},N6=class{options;parser;constructor(_){this.options=_||R_}space(_){return""}code({text:_,lang:z,escaped:A}){let b=(z||"").match(_9.notSpaceStart)?.[0],G=_.replace(_9.endingNewline,"")+`
131
- `;if(!b)return"<pre><code>"+(A?G:$4(G,!0))+`</code></pre>
132
- `;return'<pre><code class="language-'+$4(b)+'">'+(A?G:$4(G,!0))+`</code></pre>
114
+ `,1)[0],q=!B.trim(),F=0;if(this.options.pedantic)F=2,H=B.trimStart();else if(q)F=z[1].length+1;else F=z[2].search(this.rules.other.nonSpaceChar),F=F>4?1:F,H=B.slice(F),F+=z[1].length;if(q&&this.rules.other.blankLine.test(Z))$+=Z+`
115
+ `,_=_.substring(Z.length+1),Q=!0;if(!Q){let V=this.rules.other.nextBulletRegex(F),N=this.rules.other.hrRegex(F),L=this.rules.other.fencesBeginRegex(F),M=this.rules.other.headingBeginRegex(F),k=this.rules.other.htmlBeginRegex(F);while(_){let U=_.split(`
116
+ `,1)[0],O;if(Z=U,this.options.pedantic)Z=Z.replace(this.rules.other.listReplaceNesting," "),O=Z;else O=Z.replace(this.rules.other.tabCharGlobal," ");if(L.test(Z))break;if(M.test(Z))break;if(k.test(Z))break;if(V.test(Z))break;if(N.test(Z))break;if(O.search(this.rules.other.nonSpaceChar)>=F||!Z.trim())H+=`
117
+ `+O.slice(F);else{if(q)break;if(B.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4)break;if(L.test(B))break;if(M.test(B))break;if(N.test(B))break;H+=`
118
+ `+Z}if(!q&&!Z.trim())q=!0;$+=U+`
119
+ `,_=_.substring(U.length+1),B=O.slice(F)}}if(!J.loose){if(X)J.loose=!0;else if(this.rules.other.doubleBlankLine.test($))X=!0}let K=null,W;if(this.options.gfm){if(K=this.rules.other.listIsTask.exec(H),K)W=K[0]!=="[ ] ",H=H.replace(this.rules.other.listReplaceTask,"")}J.items.push({type:"list_item",raw:$,task:!!K,checked:W,loose:!1,text:H,tokens:[]}),J.raw+=$}let b=J.items.at(-1);if(b)b.raw=b.raw.trimEnd(),b.text=b.text.trimEnd();else return;J.raw=J.raw.trimEnd();for(let Q=0;Q<J.items.length;Q++)if(this.lexer.state.top=!1,J.items[Q].tokens=this.lexer.blockTokens(J.items[Q].text,[]),!J.loose){let $=J.items[Q].tokens.filter((B)=>B.type==="space"),H=$.length>0&&$.some((B)=>this.rules.other.anyLine.test(B.raw));J.loose=H}if(J.loose)for(let Q=0;Q<J.items.length;Q++)J.items[Q].loose=!0;return J}}html(_){let z=this.rules.block.html.exec(_);if(z)return{type:"html",block:!0,raw:z[0],pre:z[1]==="pre"||z[1]==="script"||z[1]==="style",text:z[0]}}def(_){let z=this.rules.block.def.exec(_);if(z){let A=z[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),G=z[2]?z[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",J=z[3]?z[3].substring(1,z[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):z[3];return{type:"def",tag:A,raw:z[0],href:G,title:J}}}table(_){let z=this.rules.block.table.exec(_);if(!z)return;if(!this.rules.other.tableDelimiter.test(z[2]))return;let A=_Q(z[1]),G=z[2].replace(this.rules.other.tableAlignChars,"").split("|"),J=z[3]?.trim()?z[3].replace(this.rules.other.tableRowBlankLine,"").split(`
120
+ `):[],Y={type:"table",raw:z[0],header:[],align:[],rows:[]};if(A.length!==G.length)return;for(let X of G)if(this.rules.other.tableAlignRight.test(X))Y.align.push("right");else if(this.rules.other.tableAlignCenter.test(X))Y.align.push("center");else if(this.rules.other.tableAlignLeft.test(X))Y.align.push("left");else Y.align.push(null);for(let X=0;X<A.length;X++)Y.header.push({text:A[X],tokens:this.lexer.inline(A[X]),header:!0,align:Y.align[X]});for(let X of J)Y.rows.push(_Q(X,Y.header.length).map((b,Q)=>{return{text:b,tokens:this.lexer.inline(b),header:!1,align:Y.align[Q]}}));return Y}lheading(_){let z=this.rules.block.lheading.exec(_);if(z)return{type:"heading",raw:z[0],depth:z[2].charAt(0)==="="?1:2,text:z[1],tokens:this.lexer.inline(z[1])}}paragraph(_){let z=this.rules.block.paragraph.exec(_);if(z){let A=z[1].charAt(z[1].length-1)===`
121
+ `?z[1].slice(0,-1):z[1];return{type:"paragraph",raw:z[0],text:A,tokens:this.lexer.inline(A)}}}text(_){let z=this.rules.block.text.exec(_);if(z)return{type:"text",raw:z[0],text:z[0],tokens:this.lexer.inline(z[0])}}escape(_){let z=this.rules.inline.escape.exec(_);if(z)return{type:"escape",raw:z[0],text:z[1]}}tag(_){let z=this.rules.inline.tag.exec(_);if(z){if(!this.lexer.state.inLink&&this.rules.other.startATag.test(z[0]))this.lexer.state.inLink=!0;else if(this.lexer.state.inLink&&this.rules.other.endATag.test(z[0]))this.lexer.state.inLink=!1;if(!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(z[0]))this.lexer.state.inRawBlock=!0;else if(this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(z[0]))this.lexer.state.inRawBlock=!1;return{type:"html",raw:z[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:z[0]}}}link(_){let z=this.rules.inline.link.exec(_);if(z){let A=z[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(A)){if(!this.rules.other.endAngleBracket.test(A))return;let Y=vz(A.slice(0,-1),"\\");if((A.length-Y.length)%2===0)return}else{let Y=FS(z[2],"()");if(Y===-2)return;if(Y>-1){let b=(z[0].indexOf("!")===0?5:4)+z[1].length+Y;z[2]=z[2].substring(0,Y),z[0]=z[0].substring(0,b).trim(),z[3]=""}}let G=z[2],J="";if(this.options.pedantic){let Y=this.rules.other.pedanticHrefTitle.exec(G);if(Y)G=Y[1],J=Y[3]}else J=z[3]?z[3].slice(1,-1):"";if(G=G.trim(),this.rules.other.startAngleBracket.test(G))if(this.options.pedantic&&!this.rules.other.endAngleBracket.test(A))G=G.slice(1);else G=G.slice(1,-1);return zQ(z,{href:G?G.replace(this.rules.inline.anyPunctuation,"$1"):G,title:J?J.replace(this.rules.inline.anyPunctuation,"$1"):J},z[0],this.lexer,this.rules)}}reflink(_,z){let A;if((A=this.rules.inline.reflink.exec(_))||(A=this.rules.inline.nolink.exec(_))){let G=(A[2]||A[1]).replace(this.rules.other.multipleSpaceGlobal," "),J=z[G.toLowerCase()];if(!J){let Y=A[0].charAt(0);return{type:"text",raw:Y,text:Y}}return zQ(A,J,A[0],this.lexer,this.rules)}}emStrong(_,z,A=""){let G=this.rules.inline.emStrongLDelim.exec(_);if(!G)return;if(G[3]&&A.match(this.rules.other.unicodeAlphaNumeric))return;if(!(G[1]||G[2])||!A||this.rules.inline.punctuation.exec(A)){let Y=[...G[0]].length-1,X,b,Q=Y,$=0,H=G[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;H.lastIndex=0,z=z.slice(-1*_.length+Y);while((G=H.exec(z))!=null){if(X=G[1]||G[2]||G[3]||G[4]||G[5]||G[6],!X)continue;if(b=[...X].length,G[3]||G[4]){Q+=b;continue}else if(G[5]||G[6]){if(Y%3&&!((Y+b)%3)){$+=b;continue}}if(Q-=b,Q>0)continue;b=Math.min(b,b+Q+$);let B=[...G[0]][0].length,Z=_.slice(0,Y+G.index+B+b);if(Math.min(Y,b)%2){let F=Z.slice(1,-1);return{type:"em",raw:Z,text:F,tokens:this.lexer.inlineTokens(F)}}let q=Z.slice(2,-2);return{type:"strong",raw:Z,text:q,tokens:this.lexer.inlineTokens(q)}}}}codespan(_){let z=this.rules.inline.code.exec(_);if(z){let A=z[2].replace(this.rules.other.newLineCharGlobal," "),G=this.rules.other.nonSpaceChar.test(A),J=this.rules.other.startingSpaceChar.test(A)&&this.rules.other.endingSpaceChar.test(A);if(G&&J)A=A.substring(1,A.length-1);return{type:"codespan",raw:z[0],text:A}}}br(_){let z=this.rules.inline.br.exec(_);if(z)return{type:"br",raw:z[0]}}del(_){let z=this.rules.inline.del.exec(_);if(z)return{type:"del",raw:z[0],text:z[2],tokens:this.lexer.inlineTokens(z[2])}}autolink(_){let z=this.rules.inline.autolink.exec(_);if(z){let A,G;if(z[2]==="@")A=z[1],G="mailto:"+A;else A=z[1],G=A;return{type:"link",raw:z[0],text:A,href:G,tokens:[{type:"text",raw:A,text:A}]}}}url(_){let z;if(z=this.rules.inline.url.exec(_)){let A,G;if(z[2]==="@")A=z[0],G="mailto:"+A;else{let J;do J=z[0],z[0]=this.rules.inline._backpedal.exec(z[0])?.[0]??"";while(J!==z[0]);if(A=z[0],z[1]==="www.")G="http://"+z[0];else G=z[0]}return{type:"link",raw:z[0],text:A,href:G,tokens:[{type:"text",raw:A,text:A}]}}}inlineText(_){let z=this.rules.inline.text.exec(_);if(z){let A=this.lexer.state.inRawBlock;return{type:"text",raw:z[0],text:z[0],escaped:A}}}},P4=class _{tokens;options;state;tokenizer;inlineQueue;constructor(z){this.tokens=[],this.tokens.links=Object.create(null),this.options=z||h_,this.options.tokenizer=this.options.tokenizer||new R6,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let A={other:A9,block:O6.normal,inline:Cz.normal};if(this.options.pedantic)A.block=O6.pedantic,A.inline=Cz.pedantic;else if(this.options.gfm)if(A.block=O6.gfm,this.options.breaks)A.inline=Cz.breaks;else A.inline=Cz.gfm;this.tokenizer.rules=A}static get rules(){return{block:O6,inline:Cz}}static lex(z,A){return new _(A).lex(z)}static lexInline(z,A){return new _(A).inlineTokens(z)}lex(z){z=z.replace(A9.carriageReturn,`
122
+ `),this.blockTokens(z,this.tokens);for(let A=0;A<this.inlineQueue.length;A++){let G=this.inlineQueue[A];this.inlineTokens(G.src,G.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(z,A=[],G=!1){if(this.options.pedantic)z=z.replace(A9.tabCharGlobal," ").replace(A9.spaceLine,"");while(z){let J;if(this.options.extensions?.block?.some((X)=>{if(J=X.call({lexer:this},z,A))return z=z.substring(J.raw.length),A.push(J),!0;return!1}))continue;if(J=this.tokenizer.space(z)){z=z.substring(J.raw.length);let X=A.at(-1);if(J.raw.length===1&&X!==void 0)X.raw+=`
123
+ `;else A.push(J);continue}if(J=this.tokenizer.code(z)){z=z.substring(J.raw.length);let X=A.at(-1);if(X?.type==="paragraph"||X?.type==="text")X.raw+=`
124
+ `+J.raw,X.text+=`
125
+ `+J.text,this.inlineQueue.at(-1).src=X.text;else A.push(J);continue}if(J=this.tokenizer.fences(z)){z=z.substring(J.raw.length),A.push(J);continue}if(J=this.tokenizer.heading(z)){z=z.substring(J.raw.length),A.push(J);continue}if(J=this.tokenizer.hr(z)){z=z.substring(J.raw.length),A.push(J);continue}if(J=this.tokenizer.blockquote(z)){z=z.substring(J.raw.length),A.push(J);continue}if(J=this.tokenizer.list(z)){z=z.substring(J.raw.length),A.push(J);continue}if(J=this.tokenizer.html(z)){z=z.substring(J.raw.length),A.push(J);continue}if(J=this.tokenizer.def(z)){z=z.substring(J.raw.length);let X=A.at(-1);if(X?.type==="paragraph"||X?.type==="text")X.raw+=`
126
+ `+J.raw,X.text+=`
127
+ `+J.raw,this.inlineQueue.at(-1).src=X.text;else if(!this.tokens.links[J.tag])this.tokens.links[J.tag]={href:J.href,title:J.title};continue}if(J=this.tokenizer.table(z)){z=z.substring(J.raw.length),A.push(J);continue}if(J=this.tokenizer.lheading(z)){z=z.substring(J.raw.length),A.push(J);continue}let Y=z;if(this.options.extensions?.startBlock){let X=1/0,b=z.slice(1),Q;if(this.options.extensions.startBlock.forEach(($)=>{if(Q=$.call({lexer:this},b),typeof Q==="number"&&Q>=0)X=Math.min(X,Q)}),X<1/0&&X>=0)Y=z.substring(0,X+1)}if(this.state.top&&(J=this.tokenizer.paragraph(Y))){let X=A.at(-1);if(G&&X?.type==="paragraph")X.raw+=`
128
+ `+J.raw,X.text+=`
129
+ `+J.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=X.text;else A.push(J);G=Y.length!==z.length,z=z.substring(J.raw.length);continue}if(J=this.tokenizer.text(z)){z=z.substring(J.raw.length);let X=A.at(-1);if(X?.type==="text")X.raw+=`
130
+ `+J.raw,X.text+=`
131
+ `+J.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=X.text;else A.push(J);continue}if(z){let X="Infinite loop on byte: "+z.charCodeAt(0);if(this.options.silent){console.error(X);break}else throw Error(X)}}return this.state.top=!0,A}inline(z,A=[]){return this.inlineQueue.push({src:z,tokens:A}),A}inlineTokens(z,A=[]){let G=z,J=null;if(this.tokens.links){let b=Object.keys(this.tokens.links);if(b.length>0){while((J=this.tokenizer.rules.inline.reflinkSearch.exec(G))!=null)if(b.includes(J[0].slice(J[0].lastIndexOf("[")+1,-1)))G=G.slice(0,J.index)+"["+"a".repeat(J[0].length-2)+"]"+G.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex)}}while((J=this.tokenizer.rules.inline.anyPunctuation.exec(G))!=null)G=G.slice(0,J.index)+"++"+G.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);while((J=this.tokenizer.rules.inline.blockSkip.exec(G))!=null)G=G.slice(0,J.index)+"["+"a".repeat(J[0].length-2)+"]"+G.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let Y=!1,X="";while(z){if(!Y)X="";Y=!1;let b;if(this.options.extensions?.inline?.some(($)=>{if(b=$.call({lexer:this},z,A))return z=z.substring(b.raw.length),A.push(b),!0;return!1}))continue;if(b=this.tokenizer.escape(z)){z=z.substring(b.raw.length),A.push(b);continue}if(b=this.tokenizer.tag(z)){z=z.substring(b.raw.length),A.push(b);continue}if(b=this.tokenizer.link(z)){z=z.substring(b.raw.length),A.push(b);continue}if(b=this.tokenizer.reflink(z,this.tokens.links)){z=z.substring(b.raw.length);let $=A.at(-1);if(b.type==="text"&&$?.type==="text")$.raw+=b.raw,$.text+=b.text;else A.push(b);continue}if(b=this.tokenizer.emStrong(z,G,X)){z=z.substring(b.raw.length),A.push(b);continue}if(b=this.tokenizer.codespan(z)){z=z.substring(b.raw.length),A.push(b);continue}if(b=this.tokenizer.br(z)){z=z.substring(b.raw.length),A.push(b);continue}if(b=this.tokenizer.del(z)){z=z.substring(b.raw.length),A.push(b);continue}if(b=this.tokenizer.autolink(z)){z=z.substring(b.raw.length),A.push(b);continue}if(!this.state.inLink&&(b=this.tokenizer.url(z))){z=z.substring(b.raw.length),A.push(b);continue}let Q=z;if(this.options.extensions?.startInline){let $=1/0,H=z.slice(1),B;if(this.options.extensions.startInline.forEach((Z)=>{if(B=Z.call({lexer:this},H),typeof B==="number"&&B>=0)$=Math.min($,B)}),$<1/0&&$>=0)Q=z.substring(0,$+1)}if(b=this.tokenizer.inlineText(Q)){if(z=z.substring(b.raw.length),b.raw.slice(-1)!=="_")X=b.raw.slice(-1);Y=!0;let $=A.at(-1);if($?.type==="text")$.raw+=b.raw,$.text+=b.text;else A.push(b);continue}if(z){let $="Infinite loop on byte: "+z.charCodeAt(0);if(this.options.silent){console.error($);break}else throw Error($)}}return A}},P6=class{options;parser;constructor(_){this.options=_||h_}space(_){return""}code({text:_,lang:z,escaped:A}){let G=(z||"").match(A9.notSpaceStart)?.[0],J=_.replace(A9.endingNewline,"")+`
132
+ `;if(!G)return"<pre><code>"+(A?J:H4(J,!0))+`</code></pre>
133
+ `;return'<pre><code class="language-'+H4(G)+'">'+(A?J:H4(J,!0))+`</code></pre>
133
134
  `}blockquote({tokens:_}){return`<blockquote>
134
135
  ${this.parser.parse(_)}</blockquote>
135
136
  `}html({text:_}){return _}heading({tokens:_,depth:z}){return`<h${z}>${this.parser.parseInline(_)}</h${z}>
136
137
  `}hr(_){return`<hr>
137
- `}list(_){let{ordered:z,start:A}=_,b="";for(let Y=0;Y<_.items.length;Y++){let X=_.items[Y];b+=this.listitem(X)}let G=z?"ol":"ul",J=z&&A!==1?' start="'+A+'"':"";return"<"+G+J+`>
138
- `+b+"</"+G+`>
139
- `}listitem(_){let z="";if(_.task){let A=this.checkbox({checked:!!_.checked});if(_.loose)if(_.tokens[0]?.type==="paragraph"){if(_.tokens[0].text=A+" "+_.tokens[0].text,_.tokens[0].tokens&&_.tokens[0].tokens.length>0&&_.tokens[0].tokens[0].type==="text")_.tokens[0].tokens[0].text=A+" "+$4(_.tokens[0].tokens[0].text),_.tokens[0].tokens[0].escaped=!0}else _.tokens.unshift({type:"text",raw:A+" ",text:A+" ",escaped:!0});else z+=A+" "}return z+=this.parser.parse(_.tokens,!!_.loose),`<li>${z}</li>
138
+ `}list(_){let{ordered:z,start:A}=_,G="";for(let X=0;X<_.items.length;X++){let b=_.items[X];G+=this.listitem(b)}let J=z?"ol":"ul",Y=z&&A!==1?' start="'+A+'"':"";return"<"+J+Y+`>
139
+ `+G+"</"+J+`>
140
+ `}listitem(_){let z="";if(_.task){let A=this.checkbox({checked:!!_.checked});if(_.loose)if(_.tokens[0]?.type==="paragraph"){if(_.tokens[0].text=A+" "+_.tokens[0].text,_.tokens[0].tokens&&_.tokens[0].tokens.length>0&&_.tokens[0].tokens[0].type==="text")_.tokens[0].tokens[0].text=A+" "+H4(_.tokens[0].tokens[0].text),_.tokens[0].tokens[0].escaped=!0}else _.tokens.unshift({type:"text",raw:A+" ",text:A+" ",escaped:!0});else z+=A+" "}return z+=this.parser.parse(_.tokens,!!_.loose),`<li>${z}</li>
140
141
  `}checkbox({checked:_}){return"<input "+(_?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:_}){return`<p>${this.parser.parseInline(_)}</p>
141
- `}table(_){let z="",A="";for(let G=0;G<_.header.length;G++)A+=this.tablecell(_.header[G]);z+=this.tablerow({text:A});let b="";for(let G=0;G<_.rows.length;G++){let J=_.rows[G];A="";for(let Y=0;Y<J.length;Y++)A+=this.tablecell(J[Y]);b+=this.tablerow({text:A})}if(b)b=`<tbody>${b}</tbody>`;return`<table>
142
+ `}table(_){let z="",A="";for(let J=0;J<_.header.length;J++)A+=this.tablecell(_.header[J]);z+=this.tablerow({text:A});let G="";for(let J=0;J<_.rows.length;J++){let Y=_.rows[J];A="";for(let X=0;X<Y.length;X++)A+=this.tablecell(Y[X]);G+=this.tablerow({text:A})}if(G)G=`<tbody>${G}</tbody>`;return`<table>
142
143
  <thead>
143
144
  `+z+`</thead>
144
- `+b+`</table>
145
+ `+G+`</table>
145
146
  `}tablerow({text:_}){return`<tr>
146
147
  ${_}</tr>
147
148
  `}tablecell(_){let z=this.parser.parseInline(_.tokens),A=_.header?"th":"td";return(_.align?`<${A} align="${_.align}">`:`<${A}>`)+z+`</${A}>
148
- `}strong({tokens:_}){return`<strong>${this.parser.parseInline(_)}</strong>`}em({tokens:_}){return`<em>${this.parser.parseInline(_)}</em>`}codespan({text:_}){return`<code>${$4(_,!0)}</code>`}br(_){return"<br>"}del({tokens:_}){return`<del>${this.parser.parseInline(_)}</del>`}link({href:_,title:z,tokens:A}){let b=this.parser.parseInline(A),G=vX(_);if(G===null)return b;_=G;let J='<a href="'+_+'"';if(z)J+=' title="'+$4(z)+'"';return J+=">"+b+"</a>",J}image({href:_,title:z,text:A,tokens:b}){if(b)A=this.parser.parseInline(b,this.parser.textRenderer);let G=vX(_);if(G===null)return $4(A);_=G;let J=`<img src="${_}" alt="${A}"`;if(z)J+=` title="${$4(z)}"`;return J+=">",J}text(_){return"tokens"in _&&_.tokens?this.parser.parseInline(_.tokens):("escaped"in _)&&_.escaped?_.text:$4(_.text)}},a5=class{strong({text:_}){return _}em({text:_}){return _}codespan({text:_}){return _}del({text:_}){return _}html({text:_}){return _}text({text:_}){return _}link({text:_}){return""+_}image({text:_}){return""+_}br(){return""}},j4=class _{options;renderer;textRenderer;constructor(z){this.options=z||R_,this.options.renderer=this.options.renderer||new N6,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new a5}static parse(z,A){return new _(A).parse(z)}static parseInline(z,A){return new _(A).parseInline(z)}parse(z,A=!0){let b="";for(let G=0;G<z.length;G++){let J=z[G];if(this.options.extensions?.renderers?.[J.type]){let X=J,Q=this.options.extensions.renderers[X.type].call({parser:this},X);if(Q!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(X.type)){b+=Q||"";continue}}let Y=J;switch(Y.type){case"space":{b+=this.renderer.space(Y);continue}case"hr":{b+=this.renderer.hr(Y);continue}case"heading":{b+=this.renderer.heading(Y);continue}case"code":{b+=this.renderer.code(Y);continue}case"table":{b+=this.renderer.table(Y);continue}case"blockquote":{b+=this.renderer.blockquote(Y);continue}case"list":{b+=this.renderer.list(Y);continue}case"html":{b+=this.renderer.html(Y);continue}case"paragraph":{b+=this.renderer.paragraph(Y);continue}case"text":{let X=Y,Q=this.renderer.text(X);while(G+1<z.length&&z[G+1].type==="text")X=z[++G],Q+=`
149
- `+this.renderer.text(X);if(A)b+=this.renderer.paragraph({type:"paragraph",raw:Q,text:Q,tokens:[{type:"text",raw:Q,text:Q,escaped:!0}]});else b+=Q;continue}default:{let X='Token with "'+Y.type+'" type was not found.';if(this.options.silent)return console.error(X),"";else throw Error(X)}}}return b}parseInline(z,A=this.renderer){let b="";for(let G=0;G<z.length;G++){let J=z[G];if(this.options.extensions?.renderers?.[J.type]){let X=this.options.extensions.renderers[J.type].call({parser:this},J);if(X!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(J.type)){b+=X||"";continue}}let Y=J;switch(Y.type){case"escape":{b+=A.text(Y);break}case"html":{b+=A.html(Y);break}case"link":{b+=A.link(Y);break}case"image":{b+=A.image(Y);break}case"strong":{b+=A.strong(Y);break}case"em":{b+=A.em(Y);break}case"codespan":{b+=A.codespan(Y);break}case"br":{b+=A.br(Y);break}case"del":{b+=A.del(Y);break}case"text":{b+=A.text(Y);break}default:{let X='Token with "'+Y.type+'" type was not found.';if(this.options.silent)return console.error(X),"";else throw Error(X)}}}return b}},U6=class{options;block;constructor(_){this.options=_||R_}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(_){return _}postprocess(_){return _}processAllTokens(_){return _}provideLexer(){return this.block?L4.lex:L4.lexInline}provideParser(){return this.block?j4.parse:j4.parseInline}},WP=class{defaults=c5();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=j4;Renderer=N6;TextRenderer=a5;Lexer=L4;Tokenizer=M6;Hooks=U6;constructor(..._){this.use(..._)}walkTokens(_,z){let A=[];for(let b of _)switch(A=A.concat(z.call(this,b)),b.type){case"table":{let G=b;for(let J of G.header)A=A.concat(this.walkTokens(J.tokens,z));for(let J of G.rows)for(let Y of J)A=A.concat(this.walkTokens(Y.tokens,z));break}case"list":{let G=b;A=A.concat(this.walkTokens(G.items,z));break}default:{let G=b;if(this.defaults.extensions?.childTokens?.[G.type])this.defaults.extensions.childTokens[G.type].forEach((J)=>{let Y=G[J].flat(1/0);A=A.concat(this.walkTokens(Y,z))});else if(G.tokens)A=A.concat(this.walkTokens(G.tokens,z))}}return A}use(..._){let z=this.defaults.extensions||{renderers:{},childTokens:{}};return _.forEach((A)=>{let b={...A};if(b.async=this.defaults.async||b.async||!1,A.extensions)A.extensions.forEach((G)=>{if(!G.name)throw Error("extension name required");if("renderer"in G){let J=z.renderers[G.name];if(J)z.renderers[G.name]=function(...Y){let X=G.renderer.apply(this,Y);if(X===!1)X=J.apply(this,Y);return X};else z.renderers[G.name]=G.renderer}if("tokenizer"in G){if(!G.level||G.level!=="block"&&G.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let J=z[G.level];if(J)J.unshift(G.tokenizer);else z[G.level]=[G.tokenizer];if(G.start){if(G.level==="block")if(z.startBlock)z.startBlock.push(G.start);else z.startBlock=[G.start];else if(G.level==="inline")if(z.startInline)z.startInline.push(G.start);else z.startInline=[G.start]}}if("childTokens"in G&&G.childTokens)z.childTokens[G.name]=G.childTokens}),b.extensions=z;if(A.renderer){let G=this.defaults.renderer||new N6(this.defaults);for(let J in A.renderer){if(!(J in G))throw Error(`renderer '${J}' does not exist`);if(["options","parser"].includes(J))continue;let Y=J,X=A.renderer[Y],Q=G[Y];G[Y]=(...$)=>{let H=X.apply(G,$);if(H===!1)H=Q.apply(G,$);return H||""}}b.renderer=G}if(A.tokenizer){let G=this.defaults.tokenizer||new M6(this.defaults);for(let J in A.tokenizer){if(!(J in G))throw Error(`tokenizer '${J}' does not exist`);if(["options","rules","lexer"].includes(J))continue;let Y=J,X=A.tokenizer[Y],Q=G[Y];G[Y]=(...$)=>{let H=X.apply(G,$);if(H===!1)H=Q.apply(G,$);return H}}b.tokenizer=G}if(A.hooks){let G=this.defaults.hooks||new U6;for(let J in A.hooks){if(!(J in G))throw Error(`hook '${J}' does not exist`);if(["options","block"].includes(J))continue;let Y=J,X=A.hooks[Y],Q=G[Y];if(U6.passThroughHooks.has(J))G[Y]=($)=>{if(this.defaults.async)return Promise.resolve(X.call(G,$)).then((B)=>{return Q.call(G,B)});let H=X.call(G,$);return Q.call(G,H)};else G[Y]=(...$)=>{let H=X.apply(G,$);if(H===!1)H=Q.apply(G,$);return H}}b.hooks=G}if(A.walkTokens){let G=this.defaults.walkTokens,J=A.walkTokens;b.walkTokens=function(Y){let X=[];if(X.push(J.call(this,Y)),G)X=X.concat(G.call(this,Y));return X}}this.defaults={...this.defaults,...b}}),this}setOptions(_){return this.defaults={...this.defaults,..._},this}lexer(_,z){return L4.lex(_,z??this.defaults)}parser(_,z){return j4.parse(_,z??this.defaults)}parseMarkdown(_){return(A,b)=>{let G={...b},J={...this.defaults,...G},Y=this.onError(!!J.silent,!!J.async);if(this.defaults.async===!0&&G.async===!1)return Y(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof A>"u"||A===null)return Y(Error("marked(): input parameter is undefined or null"));if(typeof A!=="string")return Y(Error("marked(): input parameter is of type "+Object.prototype.toString.call(A)+", string expected"));if(J.hooks)J.hooks.options=J,J.hooks.block=_;let X=J.hooks?J.hooks.provideLexer():_?L4.lex:L4.lexInline,Q=J.hooks?J.hooks.provideParser():_?j4.parse:j4.parseInline;if(J.async)return Promise.resolve(J.hooks?J.hooks.preprocess(A):A).then(($)=>X($,J)).then(($)=>J.hooks?J.hooks.processAllTokens($):$).then(($)=>J.walkTokens?Promise.all(this.walkTokens($,J.walkTokens)).then(()=>$):$).then(($)=>Q($,J)).then(($)=>J.hooks?J.hooks.postprocess($):$).catch(Y);try{if(J.hooks)A=J.hooks.preprocess(A);let $=X(A,J);if(J.hooks)$=J.hooks.processAllTokens($);if(J.walkTokens)this.walkTokens($,J.walkTokens);let H=Q($,J);if(J.hooks)H=J.hooks.postprocess(H);return H}catch($){return Y($)}}}onError(_,z){return(A)=>{if(A.message+=`
150
- Please report this to https://github.com/markedjs/marked.`,_){let b="<p>An error occurred:</p><pre>"+$4(A.message+"",!0)+"</pre>";if(z)return Promise.resolve(b);return b}if(z)return Promise.reject(A);throw A}}},j_=new WP;function K0(_,z){return j_.parse(_,z)}K0.options=K0.setOptions=function(_){return j_.setOptions(_),K0.defaults=j_.defaults,fX(K0.defaults),K0};K0.getDefaults=c5;K0.defaults=R_;K0.use=function(..._){return j_.use(..._),K0.defaults=j_.defaults,fX(K0.defaults),K0};K0.walkTokens=function(_,z){return j_.walkTokens(_,z)};K0.parseInline=j_.parseInline;K0.Parser=j4;K0.parser=j4.parse;K0.Renderer=N6;K0.TextRenderer=a5;K0.Lexer=L4;K0.lexer=L4.lex;K0.Tokenizer=M6;K0.Hooks=U6;K0.parse=K0;var{options:wa,setOptions:Ea,use:Oa,walkTokens:La,parseInline:ja}=K0;var Ra=j4.parse,Pa=L4.lex;import{EventEmitter as UP}from"events";var R4="\x1B",oX="\x1B[200~",O6="\x1B[201~";function DP(_){if(!_.startsWith(R4))return"not-escape";if(_.length===1)return"incomplete";let z=_.slice(1);if(z.startsWith("[")){if(z.startsWith("[M"))return _.length>=6?"complete":"incomplete";return MP(_)}if(z.startsWith("]"))return NP(_);if(z.startsWith("P"))return wP(_);if(z.startsWith("_"))return EP(_);if(z.startsWith("O"))return z.length>=2?"complete":"incomplete";if(z.length===1)return"complete";return"complete"}function MP(_){if(!_.startsWith(`${R4}[`))return"complete";if(_.length<3)return"incomplete";let z=_.slice(2),A=z[z.length-1],b=A.charCodeAt(0);if(b>=64&&b<=126){if(z.startsWith("<")){if(/^<\d+;\d+;\d+[Mm]$/.test(z))return"complete";if(A==="M"||A==="m"){let J=z.slice(1,-1).split(";");if(J.length===3&&J.every((Y)=>/^\d+$/.test(Y)))return"complete"}return"incomplete"}return"complete"}return"incomplete"}function NP(_){if(!_.startsWith(`${R4}]`))return"complete";if(_.endsWith(`${R4}\\`)||_.endsWith("\x07"))return"complete";return"incomplete"}function wP(_){if(!_.startsWith(`${R4}P`))return"complete";if(_.endsWith(`${R4}\\`))return"complete";return"incomplete"}function EP(_){if(!_.startsWith(`${R4}_`))return"complete";if(_.endsWith(`${R4}\\`))return"complete";return"incomplete"}function aX(_){let z=[],A=0;while(A<_.length){let b=_.slice(A);if(b.startsWith(R4)){let G=1;while(G<=b.length){let J=b.slice(0,G),Y=DP(J);if(Y==="complete"){z.push(J),A+=G;break}else if(Y==="incomplete")G++;else{z.push(J),A+=G;break}}if(G>b.length)return{sequences:z,remainder:b}}else z.push(b[0]),A++}return{sequences:z,remainder:""}}class L6 extends UP{buffer="";timeout=null;timeoutMs;pasteMode=!1;pasteBuffer="";constructor(_={}){super();this.timeoutMs=_.timeout??10}process(_){if(this.timeout)clearTimeout(this.timeout),this.timeout=null;let z;if(Buffer.isBuffer(_))if(_.length===1&&_[0]>127){let G=_[0]-128;z=`\x1B${String.fromCharCode(G)}`}else z=_.toString();else z=_;if(z.length===0&&this.buffer.length===0){this.emit("data","");return}if(this.buffer+=z,this.pasteMode){this.pasteBuffer+=this.buffer,this.buffer="";let G=this.pasteBuffer.indexOf(O6);if(G!==-1){let J=this.pasteBuffer.slice(0,G),Y=this.pasteBuffer.slice(G+O6.length);if(this.pasteMode=!1,this.pasteBuffer="",this.emit("paste",J),Y.length>0)this.process(Y)}return}let A=this.buffer.indexOf(oX);if(A!==-1){if(A>0){let J=this.buffer.slice(0,A),Y=aX(J);for(let X of Y.sequences)this.emit("data",X)}this.buffer=this.buffer.slice(A+oX.length),this.pasteMode=!0,this.pasteBuffer=this.buffer,this.buffer="";let G=this.pasteBuffer.indexOf(O6);if(G!==-1){let J=this.pasteBuffer.slice(0,G),Y=this.pasteBuffer.slice(G+O6.length);if(this.pasteMode=!1,this.pasteBuffer="",this.emit("paste",J),Y.length>0)this.process(Y)}return}let b=aX(this.buffer);this.buffer=b.remainder;for(let G of b.sequences)this.emit("data",G);if(this.buffer.length>0)this.timeout=setTimeout(()=>{let G=this.flush();for(let J of G)this.emit("data",J)},this.timeoutMs)}flush(){if(this.timeout)clearTimeout(this.timeout),this.timeout=null;if(this.buffer.length===0)return[];let _=[this.buffer];return this.buffer="",_}clear(){if(this.timeout)clearTimeout(this.timeout),this.timeout=null;this.buffer="",this.pasteMode=!1,this.pasteBuffer=""}getBuffer(){return this.buffer}destroy(){this.clear()}}import*as sX from"node:fs";class j6{wasRaw=!1;inputHandler;resizeHandler;_kittyProtocolActive=!1;stdinBuffer;stdinDataHandler;writeLogPath=process.env.PI_TUI_WRITE_LOG||"";get kittyProtocolActive(){return this._kittyProtocolActive}start(_,z){if(this.inputHandler=_,this.resizeHandler=z,this.wasRaw=process.stdin.isRaw||!1,process.stdin.setRawMode)process.stdin.setRawMode(!0);if(process.stdin.setEncoding("utf8"),process.stdin.resume(),process.stdout.write("\x1B[?2004h"),process.stdout.on("resize",this.resizeHandler),process.platform!=="win32")process.kill(process.pid,"SIGWINCH");this.queryAndEnableKittyProtocol()}setupStdinBuffer(){this.stdinBuffer=new L6({timeout:10});let _=/^\x1b\[\?(\d+)u$/;this.stdinBuffer.on("data",(z)=>{if(!this._kittyProtocolActive){if(z.match(_)){this._kittyProtocolActive=!0,K6(!0),process.stdout.write("\x1B[>7u");return}}if(this.inputHandler)this.inputHandler(z)}),this.stdinBuffer.on("paste",(z)=>{if(this.inputHandler)this.inputHandler(`\x1B[200~${z}\x1B[201~`)}),this.stdinDataHandler=(z)=>{this.stdinBuffer.process(z)}}queryAndEnableKittyProtocol(){this.setupStdinBuffer(),process.stdin.on("data",this.stdinDataHandler),process.stdout.write("\x1B[?u")}stop(){if(process.stdout.write("\x1B[?2004l"),this._kittyProtocolActive)process.stdout.write("\x1B[<u"),this._kittyProtocolActive=!1,K6(!1);if(this.stdinBuffer)this.stdinBuffer.destroy(),this.stdinBuffer=void 0;if(this.stdinDataHandler)process.stdin.removeListener("data",this.stdinDataHandler),this.stdinDataHandler=void 0;if(this.inputHandler=void 0,this.resizeHandler)process.stdout.removeListener("resize",this.resizeHandler),this.resizeHandler=void 0;if(process.stdin.setRawMode)process.stdin.setRawMode(this.wasRaw)}write(_){if(process.stdout.write(_),this.writeLogPath)try{sX.appendFileSync(this.writeLogPath,_,{encoding:"utf8"})}catch{}}get columns(){return process.stdout.columns||80}get rows(){return process.stdout.rows||24}moveBy(_){if(_>0)process.stdout.write(`\x1B[${_}B`);else if(_<0)process.stdout.write(`\x1B[${-_}A`)}hideCursor(){process.stdout.write("\x1B[?25l")}showCursor(){process.stdout.write("\x1B[?25h")}clearLine(){process.stdout.write("\x1B[K")}clearFromCursor(){process.stdout.write("\x1B[J")}clearScreen(){process.stdout.write("\x1B[2J\x1B[H")}setTitle(_){process.stdout.write(`\x1B]0;${_}\x07`)}}var tX=(_=0)=>(z)=>`\x1B[${z+_}m`,eX=(_=0)=>(z)=>`\x1B[${38+_};5;${z}m`,_Q=(_=0)=>(z,A,b)=>`\x1B[${38+_};2;${z};${A};${b}m`,E0={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]}},rs=Object.keys(E0.modifier),OP=Object.keys(E0.color),LP=Object.keys(E0.bgColor),ns=[...OP,...LP];function jP(){let _=new Map;for(let[z,A]of Object.entries(E0)){for(let[b,G]of Object.entries(A))E0[b]={open:`\x1B[${G[0]}m`,close:`\x1B[${G[1]}m`},A[b]=E0[b],_.set(G[0],G[1]);Object.defineProperty(E0,z,{value:A,enumerable:!1})}return Object.defineProperty(E0,"codes",{value:_,enumerable:!1}),E0.color.close="\x1B[39m",E0.bgColor.close="\x1B[49m",E0.color.ansi=tX(),E0.color.ansi256=eX(),E0.color.ansi16m=_Q(),E0.bgColor.ansi=tX(10),E0.bgColor.ansi256=eX(10),E0.bgColor.ansi16m=_Q(10),Object.defineProperties(E0,{rgbToAnsi256:{value(z,A,b){if(z===A&&A===b){if(z<8)return 16;if(z>248)return 231;return Math.round((z-8)/247*24)+232}return 16+36*Math.round(z/255*5)+6*Math.round(A/255*5)+Math.round(b/255*5)},enumerable:!1},hexToRgb:{value(z){let A=/[a-f\d]{6}|[a-f\d]{3}/i.exec(z.toString(16));if(!A)return[0,0,0];let[b]=A;if(b.length===3)b=[...b].map((J)=>J+J).join("");let G=Number.parseInt(b,16);return[G>>16&255,G>>8&255,G&255]},enumerable:!1},hexToAnsi256:{value:(z)=>E0.rgbToAnsi256(...E0.hexToRgb(z)),enumerable:!1},ansi256ToAnsi:{value(z){if(z<8)return 30+z;if(z<16)return 90+(z-8);let A,b,G;if(z>=232)A=((z-232)*10+8)/255,b=A,G=A;else{z-=16;let X=z%36;A=Math.floor(z/36)/5,b=Math.floor(X/6)/5,G=X%6/5}let J=Math.max(A,b,G)*2;if(J===0)return 30;let Y=30+(Math.round(G)<<2|Math.round(b)<<1|Math.round(A));if(J===2)Y+=60;return Y},enumerable:!1},rgbToAnsi:{value:(z,A,b)=>E0.ansi256ToAnsi(E0.rgbToAnsi256(z,A,b)),enumerable:!1},hexToAnsi:{value:(z)=>E0.ansi256ToAnsi(E0.hexToAnsi256(z)),enumerable:!1}}),E0}var RP=jP(),u9=RP;import s5 from"node:process";import PP from"node:os";import zQ from"node:tty";function w9(_,z=globalThis.Deno?globalThis.Deno.args:s5.argv){let A=_.startsWith("-")?"":_.length===1?"-":"--",b=z.indexOf(A+_),G=z.indexOf("--");return b!==-1&&(G===-1||b<G)}var{env:O0}=s5,R6;if(w9("no-color")||w9("no-colors")||w9("color=false")||w9("color=never"))R6=0;else if(w9("color")||w9("colors")||w9("color=true")||w9("color=always"))R6=1;function SP(){if("FORCE_COLOR"in O0){if(O0.FORCE_COLOR==="true")return 1;if(O0.FORCE_COLOR==="false")return 0;return O0.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(O0.FORCE_COLOR,10),3)}}function kP(_){if(_===0)return!1;return{level:_,hasBasic:!0,has256:_>=2,has16m:_>=3}}function IP(_,{streamIsTTY:z,sniffFlags:A=!0}={}){let b=SP();if(b!==void 0)R6=b;let G=A?R6:b;if(G===0)return 0;if(A){if(w9("color=16m")||w9("color=full")||w9("color=truecolor"))return 3;if(w9("color=256"))return 2}if("TF_BUILD"in O0&&"AGENT_NAME"in O0)return 1;if(_&&!z&&G===void 0)return 0;let J=G||0;if(O0.TERM==="dumb")return J;if(s5.platform==="win32"){let Y=PP.release().split(".");if(Number(Y[0])>=10&&Number(Y[2])>=10586)return Number(Y[2])>=14931?3:2;return 1}if("CI"in O0){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((Y)=>(Y in O0)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((Y)=>(Y in O0))||O0.CI_NAME==="codeship")return 1;return J}if("TEAMCITY_VERSION"in O0)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(O0.TEAMCITY_VERSION)?1:0;if(O0.COLORTERM==="truecolor")return 3;if(O0.TERM==="xterm-kitty")return 3;if(O0.TERM==="xterm-ghostty")return 3;if(O0.TERM==="wezterm")return 3;if("TERM_PROGRAM"in O0){let Y=Number.parseInt((O0.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(O0.TERM_PROGRAM){case"iTerm.app":return Y>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(O0.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(O0.TERM))return 1;if("COLORTERM"in O0)return 1;return J}function AQ(_,z={}){let A=IP(_,{streamIsTTY:_&&_.isTTY,...z});return kP(A)}var xP={stdout:AQ({isTTY:zQ.isatty(1)}),stderr:AQ({isTTY:zQ.isatty(2)})},bQ=xP;function GQ(_,z,A){let b=_.indexOf(z);if(b===-1)return _;let G=z.length,J=0,Y="";do Y+=_.slice(J,b)+z+A,J=b+G,b=_.indexOf(z,J);while(b!==-1);return Y+=_.slice(J),Y}function JQ(_,z,A,b){let G=0,J="";do{let Y=_[b-1]==="\r";J+=_.slice(G,Y?b-1:b)+z+(Y?`\r
149
+ `}strong({tokens:_}){return`<strong>${this.parser.parseInline(_)}</strong>`}em({tokens:_}){return`<em>${this.parser.parseInline(_)}</em>`}codespan({text:_}){return`<code>${H4(_,!0)}</code>`}br(_){return"<br>"}del({tokens:_}){return`<del>${this.parser.parseInline(_)}</del>`}link({href:_,title:z,tokens:A}){let G=this.parser.parseInline(A),J=eb(_);if(J===null)return G;_=J;let Y='<a href="'+_+'"';if(z)Y+=' title="'+H4(z)+'"';return Y+=">"+G+"</a>",Y}image({href:_,title:z,text:A,tokens:G}){if(G)A=this.parser.parseInline(G,this.parser.textRenderer);let J=eb(_);if(J===null)return H4(A);_=J;let Y=`<img src="${_}" alt="${A}"`;if(z)Y+=` title="${H4(z)}"`;return Y+=">",Y}text(_){return"tokens"in _&&_.tokens?this.parser.parseInline(_.tokens):("escaped"in _)&&_.escaped?_.text:H4(_.text)}},J2=class{strong({text:_}){return _}em({text:_}){return _}codespan({text:_}){return _}del({text:_}){return _}html({text:_}){return _}text({text:_}){return _}link({text:_}){return""+_}image({text:_}){return""+_}br(){return""}},S4=class _{options;renderer;textRenderer;constructor(z){this.options=z||h_,this.options.renderer=this.options.renderer||new P6,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new J2}static parse(z,A){return new _(A).parse(z)}static parseInline(z,A){return new _(A).parseInline(z)}parse(z,A=!0){let G="";for(let J=0;J<z.length;J++){let Y=z[J];if(this.options.extensions?.renderers?.[Y.type]){let b=Y,Q=this.options.extensions.renderers[b.type].call({parser:this},b);if(Q!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(b.type)){G+=Q||"";continue}}let X=Y;switch(X.type){case"space":{G+=this.renderer.space(X);continue}case"hr":{G+=this.renderer.hr(X);continue}case"heading":{G+=this.renderer.heading(X);continue}case"code":{G+=this.renderer.code(X);continue}case"table":{G+=this.renderer.table(X);continue}case"blockquote":{G+=this.renderer.blockquote(X);continue}case"list":{G+=this.renderer.list(X);continue}case"html":{G+=this.renderer.html(X);continue}case"paragraph":{G+=this.renderer.paragraph(X);continue}case"text":{let b=X,Q=this.renderer.text(b);while(J+1<z.length&&z[J+1].type==="text")b=z[++J],Q+=`
150
+ `+this.renderer.text(b);if(A)G+=this.renderer.paragraph({type:"paragraph",raw:Q,text:Q,tokens:[{type:"text",raw:Q,text:Q,escaped:!0}]});else G+=Q;continue}default:{let b='Token with "'+X.type+'" type was not found.';if(this.options.silent)return console.error(b),"";else throw Error(b)}}}return G}parseInline(z,A=this.renderer){let G="";for(let J=0;J<z.length;J++){let Y=z[J];if(this.options.extensions?.renderers?.[Y.type]){let b=this.options.extensions.renderers[Y.type].call({parser:this},Y);if(b!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(Y.type)){G+=b||"";continue}}let X=Y;switch(X.type){case"escape":{G+=A.text(X);break}case"html":{G+=A.html(X);break}case"link":{G+=A.link(X);break}case"image":{G+=A.image(X);break}case"strong":{G+=A.strong(X);break}case"em":{G+=A.em(X);break}case"codespan":{G+=A.codespan(X);break}case"br":{G+=A.br(X);break}case"del":{G+=A.del(X);break}case"text":{G+=A.text(X);break}default:{let b='Token with "'+X.type+'" type was not found.';if(this.options.silent)return console.error(b),"";else throw Error(b)}}}return G}},L6=class{options;block;constructor(_){this.options=_||h_}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(_){return _}postprocess(_){return _}processAllTokens(_){return _}provideLexer(){return this.block?P4.lex:P4.lexInline}provideParser(){return this.block?S4.parse:S4.parseInline}},WS=class{defaults=a5();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=S4;Renderer=P6;TextRenderer=J2;Lexer=P4;Tokenizer=R6;Hooks=L6;constructor(..._){this.use(..._)}walkTokens(_,z){let A=[];for(let G of _)switch(A=A.concat(z.call(this,G)),G.type){case"table":{let J=G;for(let Y of J.header)A=A.concat(this.walkTokens(Y.tokens,z));for(let Y of J.rows)for(let X of Y)A=A.concat(this.walkTokens(X.tokens,z));break}case"list":{let J=G;A=A.concat(this.walkTokens(J.items,z));break}default:{let J=G;if(this.defaults.extensions?.childTokens?.[J.type])this.defaults.extensions.childTokens[J.type].forEach((Y)=>{let X=J[Y].flat(1/0);A=A.concat(this.walkTokens(X,z))});else if(J.tokens)A=A.concat(this.walkTokens(J.tokens,z))}}return A}use(..._){let z=this.defaults.extensions||{renderers:{},childTokens:{}};return _.forEach((A)=>{let G={...A};if(G.async=this.defaults.async||G.async||!1,A.extensions)A.extensions.forEach((J)=>{if(!J.name)throw Error("extension name required");if("renderer"in J){let Y=z.renderers[J.name];if(Y)z.renderers[J.name]=function(...X){let b=J.renderer.apply(this,X);if(b===!1)b=Y.apply(this,X);return b};else z.renderers[J.name]=J.renderer}if("tokenizer"in J){if(!J.level||J.level!=="block"&&J.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let Y=z[J.level];if(Y)Y.unshift(J.tokenizer);else z[J.level]=[J.tokenizer];if(J.start){if(J.level==="block")if(z.startBlock)z.startBlock.push(J.start);else z.startBlock=[J.start];else if(J.level==="inline")if(z.startInline)z.startInline.push(J.start);else z.startInline=[J.start]}}if("childTokens"in J&&J.childTokens)z.childTokens[J.name]=J.childTokens}),G.extensions=z;if(A.renderer){let J=this.defaults.renderer||new P6(this.defaults);for(let Y in A.renderer){if(!(Y in J))throw Error(`renderer '${Y}' does not exist`);if(["options","parser"].includes(Y))continue;let X=Y,b=A.renderer[X],Q=J[X];J[X]=(...$)=>{let H=b.apply(J,$);if(H===!1)H=Q.apply(J,$);return H||""}}G.renderer=J}if(A.tokenizer){let J=this.defaults.tokenizer||new R6(this.defaults);for(let Y in A.tokenizer){if(!(Y in J))throw Error(`tokenizer '${Y}' does not exist`);if(["options","rules","lexer"].includes(Y))continue;let X=Y,b=A.tokenizer[X],Q=J[X];J[X]=(...$)=>{let H=b.apply(J,$);if(H===!1)H=Q.apply(J,$);return H}}G.tokenizer=J}if(A.hooks){let J=this.defaults.hooks||new L6;for(let Y in A.hooks){if(!(Y in J))throw Error(`hook '${Y}' does not exist`);if(["options","block"].includes(Y))continue;let X=Y,b=A.hooks[X],Q=J[X];if(L6.passThroughHooks.has(Y))J[X]=($)=>{if(this.defaults.async)return Promise.resolve(b.call(J,$)).then((B)=>{return Q.call(J,B)});let H=b.call(J,$);return Q.call(J,H)};else J[X]=(...$)=>{let H=b.apply(J,$);if(H===!1)H=Q.apply(J,$);return H}}G.hooks=J}if(A.walkTokens){let J=this.defaults.walkTokens,Y=A.walkTokens;G.walkTokens=function(X){let b=[];if(b.push(Y.call(this,X)),J)b=b.concat(J.call(this,X));return b}}this.defaults={...this.defaults,...G}}),this}setOptions(_){return this.defaults={...this.defaults,..._},this}lexer(_,z){return P4.lex(_,z??this.defaults)}parser(_,z){return S4.parse(_,z??this.defaults)}parseMarkdown(_){return(A,G)=>{let J={...G},Y={...this.defaults,...J},X=this.onError(!!Y.silent,!!Y.async);if(this.defaults.async===!0&&J.async===!1)return X(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof A>"u"||A===null)return X(Error("marked(): input parameter is undefined or null"));if(typeof A!=="string")return X(Error("marked(): input parameter is of type "+Object.prototype.toString.call(A)+", string expected"));if(Y.hooks)Y.hooks.options=Y,Y.hooks.block=_;let b=Y.hooks?Y.hooks.provideLexer():_?P4.lex:P4.lexInline,Q=Y.hooks?Y.hooks.provideParser():_?S4.parse:S4.parseInline;if(Y.async)return Promise.resolve(Y.hooks?Y.hooks.preprocess(A):A).then(($)=>b($,Y)).then(($)=>Y.hooks?Y.hooks.processAllTokens($):$).then(($)=>Y.walkTokens?Promise.all(this.walkTokens($,Y.walkTokens)).then(()=>$):$).then(($)=>Q($,Y)).then(($)=>Y.hooks?Y.hooks.postprocess($):$).catch(X);try{if(Y.hooks)A=Y.hooks.preprocess(A);let $=b(A,Y);if(Y.hooks)$=Y.hooks.processAllTokens($);if(Y.walkTokens)this.walkTokens($,Y.walkTokens);let H=Q($,Y);if(Y.hooks)H=Y.hooks.postprocess(H);return H}catch($){return X($)}}}onError(_,z){return(A)=>{if(A.message+=`
151
+ Please report this to https://github.com/markedjs/marked.`,_){let G="<p>An error occurred:</p><pre>"+H4(A.message+"",!0)+"</pre>";if(z)return Promise.resolve(G);return G}if(z)return Promise.reject(A);throw A}}},f_=new WS;function F0(_,z){return f_.parse(_,z)}F0.options=F0.setOptions=function(_){return f_.setOptions(_),F0.defaults=f_.defaults,AQ(F0.defaults),F0};F0.getDefaults=a5;F0.defaults=h_;F0.use=function(..._){return f_.use(..._),F0.defaults=f_.defaults,AQ(F0.defaults),F0};F0.walkTokens=function(_,z){return f_.walkTokens(_,z)};F0.parseInline=f_.parseInline;F0.Parser=S4;F0.parser=S4.parse;F0.Renderer=P6;F0.TextRenderer=J2;F0.Lexer=P4;F0.lexer=P4.lex;F0.Tokenizer=R6;F0.Hooks=L6;F0.parse=F0;var{options:ds,setOptions:rs,use:ns,walkTokens:is,parseInline:os}=F0;var as=S4.parse,ss=P4.lex;import{EventEmitter as US}from"events";var k4="\x1B",qQ="\x1B[200~",I6="\x1B[201~";function DS(_){if(!_.startsWith(k4))return"not-escape";if(_.length===1)return"incomplete";let z=_.slice(1);if(z.startsWith("[")){if(z.startsWith("[M"))return _.length>=6?"complete":"incomplete";return MS(_)}if(z.startsWith("]"))return NS(_);if(z.startsWith("P"))return ES(_);if(z.startsWith("_"))return wS(_);if(z.startsWith("O"))return z.length>=2?"complete":"incomplete";if(z.length===1)return"complete";return"complete"}function MS(_){if(!_.startsWith(`${k4}[`))return"complete";if(_.length<3)return"incomplete";let z=_.slice(2),A=z[z.length-1],G=A.charCodeAt(0);if(G>=64&&G<=126){if(z.startsWith("<")){if(/^<\d+;\d+;\d+[Mm]$/.test(z))return"complete";if(A==="M"||A==="m"){let Y=z.slice(1,-1).split(";");if(Y.length===3&&Y.every((X)=>/^\d+$/.test(X)))return"complete"}return"incomplete"}return"complete"}return"incomplete"}function NS(_){if(!_.startsWith(`${k4}]`))return"complete";if(_.endsWith(`${k4}\\`)||_.endsWith("\x07"))return"complete";return"incomplete"}function ES(_){if(!_.startsWith(`${k4}P`))return"complete";if(_.endsWith(`${k4}\\`))return"complete";return"incomplete"}function wS(_){if(!_.startsWith(`${k4}_`))return"complete";if(_.endsWith(`${k4}\\`))return"complete";return"incomplete"}function FQ(_){let z=[],A=0;while(A<_.length){let G=_.slice(A);if(G.startsWith(k4)){let J=1;while(J<=G.length){let Y=G.slice(0,J),X=DS(Y);if(X==="complete"){z.push(Y),A+=J;break}else if(X==="incomplete")J++;else{z.push(Y),A+=J;break}}if(J>G.length)return{sequences:z,remainder:G}}else z.push(G[0]),A++}return{sequences:z,remainder:""}}class x6 extends US{buffer="";timeout=null;timeoutMs;pasteMode=!1;pasteBuffer="";constructor(_={}){super();this.timeoutMs=_.timeout??10}process(_){if(this.timeout)clearTimeout(this.timeout),this.timeout=null;let z;if(Buffer.isBuffer(_))if(_.length===1&&_[0]>127){let J=_[0]-128;z=`\x1B${String.fromCharCode(J)}`}else z=_.toString();else z=_;if(z.length===0&&this.buffer.length===0){this.emit("data","");return}if(this.buffer+=z,this.pasteMode){this.pasteBuffer+=this.buffer,this.buffer="";let J=this.pasteBuffer.indexOf(I6);if(J!==-1){let Y=this.pasteBuffer.slice(0,J),X=this.pasteBuffer.slice(J+I6.length);if(this.pasteMode=!1,this.pasteBuffer="",this.emit("paste",Y),X.length>0)this.process(X)}return}let A=this.buffer.indexOf(qQ);if(A!==-1){if(A>0){let Y=this.buffer.slice(0,A),X=FQ(Y);for(let b of X.sequences)this.emit("data",b)}this.buffer=this.buffer.slice(A+qQ.length),this.pasteMode=!0,this.pasteBuffer=this.buffer,this.buffer="";let J=this.pasteBuffer.indexOf(I6);if(J!==-1){let Y=this.pasteBuffer.slice(0,J),X=this.pasteBuffer.slice(J+I6.length);if(this.pasteMode=!1,this.pasteBuffer="",this.emit("paste",Y),X.length>0)this.process(X)}return}let G=FQ(this.buffer);this.buffer=G.remainder;for(let J of G.sequences)this.emit("data",J);if(this.buffer.length>0)this.timeout=setTimeout(()=>{let J=this.flush();for(let Y of J)this.emit("data",Y)},this.timeoutMs)}flush(){if(this.timeout)clearTimeout(this.timeout),this.timeout=null;if(this.buffer.length===0)return[];let _=[this.buffer];return this.buffer="",_}clear(){if(this.timeout)clearTimeout(this.timeout),this.timeout=null;this.buffer="",this.pasteMode=!1,this.pasteBuffer=""}getBuffer(){return this.buffer}destroy(){this.clear()}}import*as KQ from"node:fs";class T6{wasRaw=!1;inputHandler;resizeHandler;_kittyProtocolActive=!1;stdinBuffer;stdinDataHandler;writeLogPath=process.env.PI_TUI_WRITE_LOG||"";get kittyProtocolActive(){return this._kittyProtocolActive}start(_,z){if(this.inputHandler=_,this.resizeHandler=z,this.wasRaw=process.stdin.isRaw||!1,process.stdin.setRawMode)process.stdin.setRawMode(!0);if(process.stdin.setEncoding("utf8"),process.stdin.resume(),process.stdout.write("\x1B[?2004h"),process.stdout.on("resize",this.resizeHandler),process.platform!=="win32")process.kill(process.pid,"SIGWINCH");this.queryAndEnableKittyProtocol()}setupStdinBuffer(){this.stdinBuffer=new x6({timeout:10});let _=/^\x1b\[\?(\d+)u$/;this.stdinBuffer.on("data",(z)=>{if(!this._kittyProtocolActive){if(z.match(_)){this._kittyProtocolActive=!0,N6(!0),process.stdout.write("\x1B[>7u");return}}if(this.inputHandler)this.inputHandler(z)}),this.stdinBuffer.on("paste",(z)=>{if(this.inputHandler)this.inputHandler(`\x1B[200~${z}\x1B[201~`)}),this.stdinDataHandler=(z)=>{this.stdinBuffer.process(z)}}queryAndEnableKittyProtocol(){this.setupStdinBuffer(),process.stdin.on("data",this.stdinDataHandler),process.stdout.write("\x1B[?u")}stop(){if(process.stdout.write("\x1B[?2004l"),this._kittyProtocolActive)process.stdout.write("\x1B[<u"),this._kittyProtocolActive=!1,N6(!1);if(this.stdinBuffer)this.stdinBuffer.destroy(),this.stdinBuffer=void 0;if(this.stdinDataHandler)process.stdin.removeListener("data",this.stdinDataHandler),this.stdinDataHandler=void 0;if(this.inputHandler=void 0,this.resizeHandler)process.stdout.removeListener("resize",this.resizeHandler),this.resizeHandler=void 0;if(process.stdin.setRawMode)process.stdin.setRawMode(this.wasRaw)}write(_){if(process.stdout.write(_),this.writeLogPath)try{KQ.appendFileSync(this.writeLogPath,_,{encoding:"utf8"})}catch{}}get columns(){return process.stdout.columns||80}get rows(){return process.stdout.rows||24}moveBy(_){if(_>0)process.stdout.write(`\x1B[${_}B`);else if(_<0)process.stdout.write(`\x1B[${-_}A`)}hideCursor(){process.stdout.write("\x1B[?25l")}showCursor(){process.stdout.write("\x1B[?25h")}clearLine(){process.stdout.write("\x1B[K")}clearFromCursor(){process.stdout.write("\x1B[J")}clearScreen(){process.stdout.write("\x1B[2J\x1B[H")}setTitle(_){process.stdout.write(`\x1B]0;${_}\x07`)}}var WQ=(_=0)=>(z)=>`\x1B[${z+_}m`,VQ=(_=0)=>(z)=>`\x1B[${38+_};5;${z}m`,UQ=(_=0)=>(z,A,G)=>`\x1B[${38+_};2;${z};${A};${G}m`,w0={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]}},Ke=Object.keys(w0.modifier),OS=Object.keys(w0.color),LS=Object.keys(w0.bgColor),We=[...OS,...LS];function jS(){let _=new Map;for(let[z,A]of Object.entries(w0)){for(let[G,J]of Object.entries(A))w0[G]={open:`\x1B[${J[0]}m`,close:`\x1B[${J[1]}m`},A[G]=w0[G],_.set(J[0],J[1]);Object.defineProperty(w0,z,{value:A,enumerable:!1})}return Object.defineProperty(w0,"codes",{value:_,enumerable:!1}),w0.color.close="\x1B[39m",w0.bgColor.close="\x1B[49m",w0.color.ansi=WQ(),w0.color.ansi256=VQ(),w0.color.ansi16m=UQ(),w0.bgColor.ansi=WQ(10),w0.bgColor.ansi256=VQ(10),w0.bgColor.ansi16m=UQ(10),Object.defineProperties(w0,{rgbToAnsi256:{value(z,A,G){if(z===A&&A===G){if(z<8)return 16;if(z>248)return 231;return Math.round((z-8)/247*24)+232}return 16+36*Math.round(z/255*5)+6*Math.round(A/255*5)+Math.round(G/255*5)},enumerable:!1},hexToRgb:{value(z){let A=/[a-f\d]{6}|[a-f\d]{3}/i.exec(z.toString(16));if(!A)return[0,0,0];let[G]=A;if(G.length===3)G=[...G].map((Y)=>Y+Y).join("");let J=Number.parseInt(G,16);return[J>>16&255,J>>8&255,J&255]},enumerable:!1},hexToAnsi256:{value:(z)=>w0.rgbToAnsi256(...w0.hexToRgb(z)),enumerable:!1},ansi256ToAnsi:{value(z){if(z<8)return 30+z;if(z<16)return 90+(z-8);let A,G,J;if(z>=232)A=((z-232)*10+8)/255,G=A,J=A;else{z-=16;let b=z%36;A=Math.floor(z/36)/5,G=Math.floor(b/6)/5,J=b%6/5}let Y=Math.max(A,G,J)*2;if(Y===0)return 30;let X=30+(Math.round(J)<<2|Math.round(G)<<1|Math.round(A));if(Y===2)X+=60;return X},enumerable:!1},rgbToAnsi:{value:(z,A,G)=>w0.ansi256ToAnsi(w0.rgbToAnsi256(z,A,G)),enumerable:!1},hexToAnsi:{value:(z)=>w0.ansi256ToAnsi(w0.hexToAnsi256(z)),enumerable:!1}}),w0}var RS=jS(),p9=RS;import Y2 from"node:process";import PS from"node:os";import DQ from"node:tty";function P9(_,z=globalThis.Deno?globalThis.Deno.args:Y2.argv){let A=_.startsWith("-")?"":_.length===1?"-":"--",G=z.indexOf(A+_),J=z.indexOf("--");return G!==-1&&(J===-1||G<J)}var{env:O0}=Y2,C6;if(P9("no-color")||P9("no-colors")||P9("color=false")||P9("color=never"))C6=0;else if(P9("color")||P9("colors")||P9("color=true")||P9("color=always"))C6=1;function SS(){if("FORCE_COLOR"in O0){if(O0.FORCE_COLOR==="true")return 1;if(O0.FORCE_COLOR==="false")return 0;return O0.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(O0.FORCE_COLOR,10),3)}}function kS(_){if(_===0)return!1;return{level:_,hasBasic:!0,has256:_>=2,has16m:_>=3}}function IS(_,{streamIsTTY:z,sniffFlags:A=!0}={}){let G=SS();if(G!==void 0)C6=G;let J=A?C6:G;if(J===0)return 0;if(A){if(P9("color=16m")||P9("color=full")||P9("color=truecolor"))return 3;if(P9("color=256"))return 2}if("TF_BUILD"in O0&&"AGENT_NAME"in O0)return 1;if(_&&!z&&J===void 0)return 0;let Y=J||0;if(O0.TERM==="dumb")return Y;if(Y2.platform==="win32"){let X=PS.release().split(".");if(Number(X[0])>=10&&Number(X[2])>=10586)return Number(X[2])>=14931?3:2;return 1}if("CI"in O0){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((X)=>(X in O0)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((X)=>(X in O0))||O0.CI_NAME==="codeship")return 1;return Y}if("TEAMCITY_VERSION"in O0)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(O0.TEAMCITY_VERSION)?1:0;if(O0.COLORTERM==="truecolor")return 3;if(O0.TERM==="xterm-kitty")return 3;if(O0.TERM==="xterm-ghostty")return 3;if(O0.TERM==="wezterm")return 3;if("TERM_PROGRAM"in O0){let X=Number.parseInt((O0.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(O0.TERM_PROGRAM){case"iTerm.app":return X>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(O0.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(O0.TERM))return 1;if("COLORTERM"in O0)return 1;return Y}function MQ(_,z={}){let A=IS(_,{streamIsTTY:_&&_.isTTY,...z});return kS(A)}var xS={stdout:MQ({isTTY:DQ.isatty(1)}),stderr:MQ({isTTY:DQ.isatty(2)})},NQ=xS;function EQ(_,z,A){let G=_.indexOf(z);if(G===-1)return _;let J=z.length,Y=0,X="";do X+=_.slice(Y,G)+z+A,Y=G+J,G=_.indexOf(z,Y);while(G!==-1);return X+=_.slice(Y),X}function wQ(_,z,A,G){let J=0,Y="";do{let X=_[G-1]==="\r";Y+=_.slice(J,X?G-1:G)+z+(X?`\r
151
152
  `:`
152
- `)+A,G=b+1,b=_.indexOf(`
153
- `,G)}while(b!==-1);return J+=_.slice(G),J}var{stdout:YQ,stderr:XQ}=bQ,t5=Symbol("GENERATOR"),W1=Symbol("STYLER"),xz=Symbol("IS_EMPTY"),QQ=["ansi","ansi","ansi256","ansi16m"],V1=Object.create(null),TP=(_,z={})=>{if(z.level&&!(Number.isInteger(z.level)&&z.level>=0&&z.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let A=YQ?YQ.level:0;_.level=z.level===void 0?A:z.level};var CP=(_)=>{let z=(...A)=>A.join(" ");return TP(z,_),Object.setPrototypeOf(z,Tz.prototype),z};function Tz(_){return CP(_)}Object.setPrototypeOf(Tz.prototype,Function.prototype);for(let[_,z]of Object.entries(u9))V1[_]={get(){let A=P6(this,_2(z.open,z.close,this[W1]),this[xz]);return Object.defineProperty(this,_,{value:A}),A}};V1.visible={get(){let _=P6(this,this[W1],!0);return Object.defineProperty(this,"visible",{value:_}),_}};var e5=(_,z,A,...b)=>{if(_==="rgb"){if(z==="ansi16m")return u9[A].ansi16m(...b);if(z==="ansi256")return u9[A].ansi256(u9.rgbToAnsi256(...b));return u9[A].ansi(u9.rgbToAnsi(...b))}if(_==="hex")return e5("rgb",z,A,...u9.hexToRgb(...b));return u9[A][_](...b)},vP=["rgb","hex","ansi256"];for(let _ of vP){V1[_]={get(){let{level:A}=this;return function(...b){let G=_2(e5(_,QQ[A],"color",...b),u9.color.close,this[W1]);return P6(this,G,this[xz])}}};let z="bg"+_[0].toUpperCase()+_.slice(1);V1[z]={get(){let{level:A}=this;return function(...b){let G=_2(e5(_,QQ[A],"bgColor",...b),u9.bgColor.close,this[W1]);return P6(this,G,this[xz])}}}}var yP=Object.defineProperties(()=>{},{...V1,level:{enumerable:!0,get(){return this[t5].level},set(_){this[t5].level=_}}}),_2=(_,z,A)=>{let b,G;if(A===void 0)b=_,G=z;else b=A.openAll+_,G=z+A.closeAll;return{open:_,close:z,openAll:b,closeAll:G,parent:A}},P6=(_,z,A)=>{let b=(...G)=>gP(b,G.length===1?""+G[0]:G.join(" "));return Object.setPrototypeOf(b,yP),b[t5]=_,b[W1]=z,b[xz]=A,b},gP=(_,z)=>{if(_.level<=0||!z)return _[xz]?"":z;let A=_[W1];if(A===void 0)return z;let{openAll:b,closeAll:G}=A;if(z.includes("\x1B"))while(A!==void 0)z=GQ(z,A.close,A.open),A=A.parent;let J=z.indexOf(`
154
- `);if(J!==-1)z=JQ(z,G,b,J);return b+z+G};Object.defineProperties(Tz.prototype,V1);var fP=Tz(),bt=Tz({level:XQ?XQ.level:0});var H4=fP;var hP=15,mP={selectedPrefix:(_)=>H4.cyan(_),selectedText:(_)=>H4.cyan(_),description:(_)=>H4.gray(_),scrollInfo:(_)=>H4.gray(_),noMatch:(_)=>H4.yellow(_)};function uP(_){let A=Date.now()-_.getTime(),b=Math.floor(A/1000),G=Math.floor(b/60),J=Math.floor(G/60),Y=Math.floor(J/24),X=Math.floor(Y/7);if(X>0)return`${X}w ago`;if(Y>0)return`${Y}d ago`;if(J>0)return`${J}h ago`;if(G>0)return`${G}m ago`;return"now"}function cP(_,z){if(!_)return"";let A=process.env.HOME??"",b=_;if(A&&_.startsWith(A))b="~"+_.slice(A.length);return n0(b,z,"…",!1)}function lP(_){if(!_)return"";let z=[];if(_.linesAdded>0)z.push(H4.green(`+${_.linesAdded}`));if(_.linesModified>0)z.push(H4.yellow(`~${_.linesModified}`));if(_.linesRemoved>0)z.push(H4.red(`-${_.linesRemoved}`));return z.join(" ")}function pP(_,z){let A=uP(_.timestamp).padEnd(7),b=_.source.padEnd(11),G=lP(_.stats),J=_.stats?15:0,Y=24+J+(J>0?3:0),X=Math.max(40,z-Y),Q=Math.min(22,Math.floor(X*0.35)),$=X-Q-3,H=cP(_.cwd,Q).padEnd(Q),B=n0(_.preview??"",$,"…",!1);if(G)return`${A} │ ${b} │ ${G.padEnd(15)} │ ${H} │ ${B}`;return`${A} │ ${b} │ ${H} │ ${B}`}async function $Q(_){if(_.length===0)return console.log("No transcripts found."),null;return new Promise((z)=>{let A=new j6,b=new q1(A),G=process.stdout.columns??80,J=_.map((Q)=>({value:Q.id,label:pP(Q,G),description:"",transcript:Q})),Y=new F1(H4.gray("Select a transcript to upload (↑↓ navigate, Enter select, Esc cancel)"),1),X=new Rz(J,hP,mP);X.onSelect=(Q)=>{b.stop(),z(Q.transcript)},X.onCancel=()=>{b.stop(),z(null)},b.addChild(Y),b.addChild(X),b.setFocus(X),b.start()})}import{createHash as HQ}from"crypto";import{existsSync as z2,readFileSync as dP}from"fs";import{dirname as rP,isAbsolute as nP,resolve as iP}from"path";async function BQ(_,z={}){let A=A2(_),b=await a0(A.cwd);if(!e9(b))return{success:!1,eventCount:A.records.length,invalidLines:A.invalidLines,sessionId:"",cwd:A.cwd,unifiedTranscript:{},sha256:"",source:_.source??"claude-code",skipped:!0};let G=await FQ(_,A),J=R5(G.unifiedTranscript),Y=L_(J),X=JSON.stringify(Y),Q=HQ("sha256").update(X).digest("hex"),$=await A4(G.sessionId),H=_.visibility??M8(b),B=X6(G.rawTranscript),Z={id:$,sha256:Q,rawTranscript:B,unifiedTranscript:Y,blobs:G.blobs.length>0?G.blobs:void 0,visibility:H},F=await W5(Z,z);if(F.success&&F.id)await G5(G.sessionId,F.id);return{...F,eventCount:G.eventCount,invalidLines:G.invalidLines,sessionId:G.sessionId,unifiedTranscript:Y,sha256:Q,source:_.source??"claude-code",cwd:G.cwd,skipped:!1}}function ZQ(_){if(!_)return null;if(nP(_))return z2(_)?_:null;let z=new Set,A=(J)=>{if(!J)return null;let Y=iP(J,_);if(z.has(Y))return null;return z.add(Y),z2(Y)?Y:null},b=A(process.cwd())??A(process.env.INIT_CWD)??A(process.env.PWD);if(b)return b;let G=process.cwd();while(!0){let J=A(G);if(J)return J;let Y=rP(G);if(Y===G)break;G=Y}return null}function oP(_){for(let z of _){let A=typeof z.cwd==="string"?z.cwd.trim():"";if(A)return A}return null}function aP(_){for(let z of _){let A=typeof z.gitBranch==="string"?z.gitBranch.trim():"";if(A)return A}return}function A2(_){let{transcriptPath:z}=_;if(!z)throw Error("No transcript path provided.");if(!z2(z))throw Error(`Transcript file not found at path: ${z}`);let A=dP(z,"utf8"),b=A.split(/\r?\n/),G=[],J=0;for(let X of b){let Q=X.trim();if(!Q)continue;try{let $=JSON.parse(Q);if(typeof $==="object"&&$!==null)G.push($);else J+=1}catch{J+=1}}if(G.length===0)throw Error("No transcript events found in the specified file.");let Y=_.cwdOverride&&_.cwdOverride.trim().length>0?_.cwdOverride.trim():oP(G)??process.cwd();return{rawContent:A,records:G,cwd:Y,invalidLines:J}}async function FQ(_,z){let{sessionId:A,source:b="claude-code"}=_,G=z??A2(_),Y=await new r0().fetchModelPricing(),X=Object.fromEntries(Y),Q=aP(G.records),$=await e0(G.cwd,Q),H={pricing:X,gitContext:$},B=b==="codex"?O5(G.records,{pricing:X}):J6(G.records,H);if(!B)throw Error(`Unable to convert ${b} transcript to unified format.`);let{transcript:Z,blobs:F}=B,K=A??Z.id;if(!K)throw Error("Transcript did not include a session identifier.");if(A&&A!==Z.id)throw Error(`Provided sessionId (${A}) does not match unified transcript id (${Z.id}).`);let q=[];for(let[W,V]of F)q.push({sha256:W,data:new Uint8Array(V.data),mediaType:V.mediaType});return{unifiedTranscript:Z,rawTranscript:G.rawContent,blobs:q,sessionId:K,cwd:G.cwd,eventCount:G.records.length,invalidLines:G.invalidLines}}async function P4(_){let z=A2(_),A=await a0(z.cwd);if(!e9(A))return{results:[],eventCount:z.records.length,id:"",sessionId:"",anySuccess:!1,allSuccess:!1};let b=await FQ(_,z),G=await E9({unifiedTranscript:b.unifiedTranscript,sessionId:b.sessionId,cwd:b.cwd,rawTranscript:b.rawTranscript,blobs:b.blobs,visibility:_.visibility});if(G.skipped)return{results:[],eventCount:b.eventCount,id:"",sessionId:b.sessionId,anySuccess:!1,allSuccess:!1};return{results:G.results,eventCount:b.eventCount,id:G.id,sessionId:G.sessionId,anySuccess:G.anySuccess,allSuccess:G.allSuccess}}async function E9(_){let{unifiedTranscript:z,sessionId:A,cwd:b,rawTranscript:G,blobs:J,visibility:Y}=_,X=await a0(b);if(!e9(X))return{results:[],id:"",sessionId:A,anySuccess:!1,allSuccess:!1,skipped:!0};let Q=await T9();if(Q.length===0)throw Error("No authenticated environments found. Run `agentlogs login agentlogs.ai` first.");let $=R5(z),H=L_($),B=JSON.stringify(H),Z=HQ("sha256").update(B).digest("hex"),F=await A4(A),K=Y??M8(X),q=X6(G??B),W={id:F,sha256:Z,rawTranscript:q,unifiedTranscript:H,blobs:J&&J.length>0?J:void 0,visibility:K},V=[],w="";for(let O of Q)try{let M=await W5(W,{serverUrl:O.baseURL,authToken:O.token});if(M.success&&M.id){if(await G5(A,M.id),!w)w=M.id}V.push({envName:O.name,baseURL:O.baseURL,success:M.success,id:M.id,transcriptId:M.transcriptId})}catch(M){V.push({envName:O.name,baseURL:O.baseURL,success:!1,error:M instanceof Error?M.message:String(M)})}return{results:V,id:w,sessionId:A,anySuccess:V.some((O)=>O.success),allSuccess:V.every((O)=>O.success),skipped:!1}}async function KQ(_,z={}){if((await T9()).length===0)console.error("You must be logged in to upload transcripts."),console.error("Run `agentlogs login agentlogs.ai` to authenticate."),process.exit(1);let b=_?sP(_):void 0,G=await VX({sources:z.source?[z.source]:void 0,cwd:b,limit:100});if(G.length===0){let X=[b?`directory: ${b}`:null,z.source?`source: ${z.source}`:null].filter(Boolean).join(", ");console.log(X?`No transcripts found matching filters (${X}).`:"No transcripts found.");return}let J=null;if(z.latest)J=G[0],console.log(`Auto-selecting most recent transcript: ${J.id}`);else J=await $Q(G);if(!J)process.exit(0);let Y=await zS(J);process.exit(Y?0:1)}async function zS(_){if(console.log(""),console.log(`Uploading ${_.source} transcript: ${_.id}`),_.cwd)console.log(`Directory: ${_.cwd}`);try{switch(_.source){case"claude-code":return await AS(_);case"codex":return await bS(_);case"opencode":return await GS(_);case"pi":return await JS(_)}}catch(z){return console.error(""),console.error("Upload failed:",z instanceof Error?z.message:String(z)),!1}}async function AS(_){let z=await P4({transcriptPath:_.path,sessionId:_.id,cwdOverride:_.cwd??void 0,source:"claude-code"});return qQ(z)}async function bS(_){let z=await P4({transcriptPath:_.path,sessionId:_.id,cwdOverride:_.cwd??void 0,source:"codex"});return qQ(z)}async function GS(_){let z=XS(_.id);if(!z)throw Error(`Failed to read OpenCode session: ${_.id}`);let b=await new r0().fetchModelPricing(),G=Object.fromEntries(b),J=z.info.directory??process.cwd(),Y=await e0(J,void 0);if(Y?.repo)console.log(`Repository: ${Y.repo}`);console.log("Converting transcript...");let X=E_(z,{pricing:G,gitContext:Y,cwd:J});if(!X)throw Error("Failed to convert OpenCode transcript");console.log("Uploading...");let Q=await E9({unifiedTranscript:X,sessionId:_.id,cwd:J,rawTranscript:JSON.stringify(z)});if(Q.skipped)return console.log(""),console.log("Skipped: Repository not in allowlist"),!0;if(Q.anySuccess&&Q.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${Q.id}`);for(let $ of Q.results)if($.success){let H=`${$.baseURL}/s/${Q.id}`;console.log(`View: ${H}`)}return!0}else{console.error(""),console.error("Upload failed:");for(let $ of Q.results)if(!$.success&&$.error)console.error(` ${$.envName}: ${$.error}`);return!1}}async function JS(_){let z=YS(_.path);if(!z)throw Error(`Failed to read Pi session: ${_.path}`);let b=await new r0().fetchModelPricing(),G=Object.fromEntries(b),J=z.header.cwd??process.cwd(),Y=await e0(J,void 0);if(Y?.repo)console.log(`Repository: ${Y.repo}`);console.log("Converting transcript...");let X=O_(z,{pricing:G,gitContext:Y,cwd:J});if(!X)throw Error("Failed to convert Pi transcript");console.log("Uploading...");let Q=await E9({unifiedTranscript:X.transcript,sessionId:_.id,cwd:J,rawTranscript:JSON.stringify(z)});if(Q.skipped)return console.log(""),console.log("Skipped: Repository not in allowlist"),!0;if(Q.anySuccess&&Q.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${Q.id}`);for(let $ of Q.results)if($.success){let H=`${$.baseURL}/s/${Q.id}`;console.log(`View: ${H}`)}return!0}else{console.error(""),console.error("Upload failed:");for(let $ of Q.results)if(!$.success&&$.error)console.error(` ${$.envName}: ${$.error}`);return!1}}function YS(_){if(!eP(_))return null;let A=_S(_,"utf-8").split(`
155
- `).filter((J)=>J.trim());if(A.length===0)return null;let b=JSON.parse(A[0]),G=[];for(let J=1;J<A.length;J++)try{G.push(JSON.parse(A[J]))}catch{}return{header:b,entries:G}}function XS(_){try{let z=tP("opencode",["export",_],{encoding:"utf-8",timeout:30000,stdio:["pipe","pipe","pipe"]});if(z.status!==0||z.error)return null;let A=z.stdout.trim();if(!A)return null;return JSON.parse(A)}catch{return null}}function qQ(_){if(_.anySuccess&&_.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${_.id}`);for(let z of _.results)if(z.success){let A=`${z.baseURL}/s/${_.id}`;console.log(`View: ${A}`)}return!0}else if(_.results.length===0)return console.log(""),console.log("Skipped: Repository not in allowlist"),!0;else{console.error(""),console.error("Upload failed:");for(let z of _.results)if(!z.success&&z.error)console.error(` ${z.envName}: ${z.error}`);return!1}}var WQ=b6(),x=mY("cli",{logFilePath:WQ??void 0,logToFile:WQ!==null,disableConsole:!0}),VQ="https://agentlogs.ai",QS=/https?:\/\/[^\s"'`]+\/s\/([a-zA-Z0-9_-]+)/;function $S(_){let z=_.toLowerCase();return z==="localhost"||z==="127.0.0.1"||z==="::1"}function HS(_){try{let z=new URL(_);return $S(z.hostname)}catch{return!1}}function UQ(_){try{let z=new URL(_);return`${z.protocol}//${z.host.toLowerCase()}`}catch{return _.replace(/\/+$/,"")}}function BS(_){let z=_.find((A)=>!HS(A.baseURL))??_[0];return UQ(z?.baseURL??VQ)}async function U1(){let _=await T9();return BS(_)}function P_(_){return/\bgit\s+commit\b/.test(_)}function D1(_,z,A){let G=`\uD83D\uDD2E View transcript: ${UQ(A??VQ)}/s/${z}`;if(_.includes(G)||S_(_)===z)return _;let J=`
153
+ `)+A,J=G+1,G=_.indexOf(`
154
+ `,J)}while(G!==-1);return Y+=_.slice(J),Y}var{stdout:OQ,stderr:LQ}=NQ,X2=Symbol("GENERATOR"),R1=Symbol("STYLER"),fz=Symbol("IS_EMPTY"),jQ=["ansi","ansi","ansi256","ansi16m"],P1=Object.create(null),TS=(_,z={})=>{if(z.level&&!(Number.isInteger(z.level)&&z.level>=0&&z.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let A=OQ?OQ.level:0;_.level=z.level===void 0?A:z.level};var CS=(_)=>{let z=(...A)=>A.join(" ");return TS(z,_),Object.setPrototypeOf(z,hz.prototype),z};function hz(_){return CS(_)}Object.setPrototypeOf(hz.prototype,Function.prototype);for(let[_,z]of Object.entries(p9))P1[_]={get(){let A=v6(this,Q2(z.open,z.close,this[R1]),this[fz]);return Object.defineProperty(this,_,{value:A}),A}};P1.visible={get(){let _=v6(this,this[R1],!0);return Object.defineProperty(this,"visible",{value:_}),_}};var b2=(_,z,A,...G)=>{if(_==="rgb"){if(z==="ansi16m")return p9[A].ansi16m(...G);if(z==="ansi256")return p9[A].ansi256(p9.rgbToAnsi256(...G));return p9[A].ansi(p9.rgbToAnsi(...G))}if(_==="hex")return b2("rgb",z,A,...p9.hexToRgb(...G));return p9[A][_](...G)},vS=["rgb","hex","ansi256"];for(let _ of vS){P1[_]={get(){let{level:A}=this;return function(...G){let J=Q2(b2(_,jQ[A],"color",...G),p9.color.close,this[R1]);return v6(this,J,this[fz])}}};let z="bg"+_[0].toUpperCase()+_.slice(1);P1[z]={get(){let{level:A}=this;return function(...G){let J=Q2(b2(_,jQ[A],"bgColor",...G),p9.bgColor.close,this[R1]);return v6(this,J,this[fz])}}}}var yS=Object.defineProperties(()=>{},{...P1,level:{enumerable:!0,get(){return this[X2].level},set(_){this[X2].level=_}}}),Q2=(_,z,A)=>{let G,J;if(A===void 0)G=_,J=z;else G=A.openAll+_,J=z+A.closeAll;return{open:_,close:z,openAll:G,closeAll:J,parent:A}},v6=(_,z,A)=>{let G=(...J)=>gS(G,J.length===1?""+J[0]:J.join(" "));return Object.setPrototypeOf(G,yS),G[X2]=_,G[R1]=z,G[fz]=A,G},gS=(_,z)=>{if(_.level<=0||!z)return _[fz]?"":z;let A=_[R1];if(A===void 0)return z;let{openAll:G,closeAll:J}=A;if(z.includes("\x1B"))while(A!==void 0)z=EQ(z,A.close,A.open),A=A.parent;let Y=z.indexOf(`
155
+ `);if(Y!==-1)z=wQ(z,J,G,Y);return G+z+J};Object.defineProperties(hz.prototype,P1);var fS=hz(),je=hz({level:LQ?LQ.level:0});var B4=fS;var hS=15,mS={selectedPrefix:(_)=>B4.cyan(_),selectedText:(_)=>B4.cyan(_),description:(_)=>B4.gray(_),scrollInfo:(_)=>B4.gray(_),noMatch:(_)=>B4.yellow(_)};function uS(_){let A=Date.now()-_.getTime(),G=Math.floor(A/1000),J=Math.floor(G/60),Y=Math.floor(J/60),X=Math.floor(Y/24),b=Math.floor(X/7);if(b>0)return`${b}w ago`;if(X>0)return`${X}d ago`;if(Y>0)return`${Y}h ago`;if(J>0)return`${J}m ago`;return"now"}function cS(_,z){if(!_)return"";let A=process.env.HOME??"",G=_;if(A&&_.startsWith(A))G="~"+_.slice(A.length);return t0(G,z,"…",!1)}function lS(_){if(!_)return"";let z=[];if(_.linesAdded>0)z.push(B4.green(`+${_.linesAdded}`));if(_.linesModified>0)z.push(B4.yellow(`~${_.linesModified}`));if(_.linesRemoved>0)z.push(B4.red(`-${_.linesRemoved}`));return z.join(" ")}function pS(_,z){let A=uS(_.timestamp).padEnd(7),G=_.source.padEnd(11),J=lS(_.stats),Y=_.stats?15:0,X=24+Y+(Y>0?3:0),b=Math.max(40,z-X),Q=Math.min(22,Math.floor(b*0.35)),$=b-Q-3,H=cS(_.cwd,Q).padEnd(Q),B=t0(_.preview??"",$,"…",!1);if(J)return`${A} │ ${G} │ ${J.padEnd(15)} │ ${H} │ ${B}`;return`${A} │ ${G} │ ${H} │ ${B}`}async function RQ(_){if(_.length===0)return console.log("No transcripts found."),null;return new Promise((z)=>{let A=new T6,G=new j1(A),J=process.stdout.columns??80,Y=_.map((Q)=>({value:Q.id,label:pS(Q,J),description:"",transcript:Q})),X=new O1(B4.gray("Select a transcript to upload (↑↓ navigate, Enter select, Esc cancel)"),1),b=new Tz(Y,hS,mS);b.onSelect=(Q)=>{G.stop(),z(Q.transcript)},b.onCancel=()=>{G.stop(),z(null)},G.addChild(X),G.addChild(b),G.setFocus(b),G.start()})}import{createHash as PQ}from"crypto";import{existsSync as $2,readFileSync as dS}from"fs";import{dirname as rS,isAbsolute as nS,resolve as iS}from"path";async function SQ(_,z={}){let A=H2(_),G=await h0(A.cwd);if(!L9(G))return{success:!1,eventCount:A.records.length,invalidLines:A.invalidLines,sessionId:"",cwd:A.cwd,unifiedTranscript:{},sha256:"",source:_.source??"claude-code",skipped:!0};let J=await IQ(_,A),Y=g5(J.unifiedTranscript),X=y_(Y),b=JSON.stringify(X),Q=PQ("sha256").update(b).digest("hex"),$=await j9(J.sessionId),H=_.visibility??PA(G),B=q6(J.rawTranscript),Z={id:$,sha256:Q,rawTranscript:B,unifiedTranscript:X,blobs:J.blobs.length>0?J.blobs:void 0,visibility:H},q=await O5(Z,z);if(q.success&&q.id)await Z5(J.sessionId,q.id);return{...q,eventCount:J.eventCount,invalidLines:J.invalidLines,sessionId:J.sessionId,unifiedTranscript:X,sha256:Q,source:_.source??"claude-code",cwd:J.cwd,skipped:!1}}function kQ(_){if(!_)return null;if(nS(_))return $2(_)?_:null;let z=new Set,A=(Y)=>{if(!Y)return null;let X=iS(Y,_);if(z.has(X))return null;return z.add(X),$2(X)?X:null},G=A(process.cwd())??A(process.env.INIT_CWD)??A(process.env.PWD);if(G)return G;let J=process.cwd();while(!0){let Y=A(J);if(Y)return Y;let X=rS(J);if(X===J)break;J=X}return null}function oS(_){for(let z of _){let A=typeof z.cwd==="string"?z.cwd.trim():"";if(A)return A}return null}function aS(_){for(let z of _){let A=typeof z.gitBranch==="string"?z.gitBranch.trim():"";if(A)return A}return}function H2(_){let{transcriptPath:z}=_;if(!z)throw Error("No transcript path provided.");if(!$2(z))throw Error(`Transcript file not found at path: ${z}`);let A=dS(z,"utf8"),G=A.split(/\r?\n/),J=[],Y=0;for(let b of G){let Q=b.trim();if(!Q)continue;try{let $=JSON.parse(Q);if(typeof $==="object"&&$!==null)J.push($);else Y+=1}catch{Y+=1}}if(J.length===0)throw Error("No transcript events found in the specified file.");let X=_.cwdOverride&&_.cwdOverride.trim().length>0?_.cwdOverride.trim():oS(J)??process.cwd();return{rawContent:A,records:J,cwd:X,invalidLines:Y}}async function IQ(_,z){let{sessionId:A,source:G="claude-code"}=_,J=z??H2(_),X=await new I0().fetchModelPricing(),b=Object.fromEntries(X),Q=aS(J.records),$=await C0(J.cwd,Q),H={pricing:b,gitContext:$},B=G==="codex"?C5(J.records,{pricing:b}):B6(J.records,H);if(!B)throw Error(`Unable to convert ${G} transcript to unified format.`);let{transcript:Z,blobs:q}=B,F=A??Z.id;if(!F)throw Error("Transcript did not include a session identifier.");if(A&&A!==Z.id)throw Error(`Provided sessionId (${A}) does not match unified transcript id (${Z.id}).`);let K=[];for(let[W,V]of q)K.push({sha256:W,data:new Uint8Array(V.data),mediaType:V.mediaType});return{unifiedTranscript:Z,rawTranscript:J.rawContent,blobs:K,sessionId:F,cwd:J.cwd,eventCount:J.records.length,invalidLines:J.invalidLines}}async function I4(_){let z=H2(_),A=await h0(z.cwd);if(!L9(A))return{results:[],eventCount:z.records.length,id:"",sessionId:"",anySuccess:!1,allSuccess:!1};let G=await IQ(_,z),J=await u0({unifiedTranscript:G.unifiedTranscript,sessionId:G.sessionId,cwd:G.cwd,rawTranscript:G.rawTranscript,blobs:G.blobs,visibility:_.visibility});if(J.skipped)return{results:[],eventCount:G.eventCount,id:"",sessionId:G.sessionId,anySuccess:!1,allSuccess:!1};return{results:J.results,eventCount:G.eventCount,id:J.id,sessionId:J.sessionId,anySuccess:J.anySuccess,allSuccess:J.allSuccess}}async function u0(_){let{unifiedTranscript:z,sessionId:A,cwd:G,rawTranscript:J,blobs:Y,visibility:X}=_,b=await h0(G);if(!L9(b))return{results:[],id:"",sessionId:A,anySuccess:!1,allSuccess:!1,skipped:!0};let Q=await f9();if(Q.length===0)throw Error("No authenticated environments found. Run `agentlogs login agentlogs.ai` first.");let $=g5(z),H=y_($),B=JSON.stringify(H),Z=PQ("sha256").update(B).digest("hex"),q=await j9(A),F=X??PA(b),K=q6(J??B),W={id:q,sha256:Z,rawTranscript:K,unifiedTranscript:H,blobs:Y&&Y.length>0?Y:void 0,visibility:F},V=[],N="";for(let L of Q)try{let M=await O5(W,{serverUrl:L.baseURL,authToken:L.token});if(M.success&&M.id){if(await Z5(A,M.id),!N)N=M.id}V.push({envName:L.name,baseURL:L.baseURL,success:M.success,id:M.id,transcriptId:M.transcriptId})}catch(M){V.push({envName:L.name,baseURL:L.baseURL,success:!1,error:M instanceof Error?M.message:String(M)})}return{results:V,id:N,sessionId:A,anySuccess:V.some((L)=>L.success),allSuccess:V.every((L)=>L.success),skipped:!1}}async function TQ(_,z={}){if((await f9()).length===0)console.error("You must be logged in to upload transcripts."),console.error("Run `agentlogs login agentlogs.ai` to authenticate."),process.exit(1);let G=_?xQ(_):void 0,J=await vb({sources:z.source?[z.source]:void 0,cwd:G,limit:100});if(J.length===0){let b=[G?`directory: ${G}`:null,z.source?`source: ${z.source}`:null].filter(Boolean).join(", ");console.log(b?`No transcripts found matching filters (${b}).`:"No transcripts found.");return}let Y=null;if(z.latest)Y=J[0],console.log(`Auto-selecting most recent transcript: ${Y.id}`);else Y=await RQ(J);if(!Y)process.exit(0);let X=await tS(Y);process.exit(X?0:1)}async function tS(_){if(console.log(""),console.log(`Uploading ${_.source} transcript: ${_.id}`),_.cwd)console.log(`Directory: ${_.cwd}`);try{switch(_.source){case"claude-code":return await eS(_);case"codex":return await _k(_);case"opencode":return await zk(_);case"cline":return await Ak(_);case"pi":return await Gk(_)}}catch(z){return console.error(""),console.error("Upload failed:",z instanceof Error?z.message:String(z)),!1}}async function eS(_){let z=await I4({transcriptPath:_.path,sessionId:_.id,cwdOverride:_.cwd??void 0,source:"claude-code"});return CQ(z)}async function _k(_){let z=await I4({transcriptPath:_.path,sessionId:_.id,cwdOverride:_.cwd??void 0,source:"codex"});return CQ(z)}async function zk(_){let z=Yk(_.id);if(!z)throw Error(`Failed to read OpenCode session: ${_.id}`);let G=await new I0().fetchModelPricing(),J=Object.fromEntries(G),Y=z.info.directory??process.cwd(),X=await C0(Y,void 0);if(X?.repo)console.log(`Repository: ${X.repo}`);console.log("Converting transcript...");let b=C_(z,{pricing:J,gitContext:X,cwd:Y});if(!b)throw Error("Failed to convert OpenCode transcript");console.log("Uploading...");let Q=await u0({unifiedTranscript:b,sessionId:_.id,cwd:Y,rawTranscript:JSON.stringify(z)});if(Q.skipped)return console.log(""),console.log("Skipped: Repository not in allowlist"),!0;if(Q.anySuccess&&Q.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${Q.id}`);for(let $ of Q.results)if($.success){let H=`${$.baseURL}/s/${Q.id}`;console.log(`View: ${H}`)}return!0}else{console.error(""),console.error("Upload failed:");for(let $ of Q.results)if(!$.success&&$.error)console.error(` ${$.envName}: ${$.error}`);return!1}}async function Ak(_){if(!B2(_.path))throw Error(`Failed to read Cline task: ${_.path}`);let z=Z2(_.path,"utf-8"),A;try{A=JSON.parse(z)}catch{throw Error(`Failed to parse Cline task: ${_.path}`)}let G,J=xQ(_.path,"..","task_metadata.json");if(B2(J))try{G=JSON.parse(Z2(J,"utf-8"))}catch{}let X=await new I0().fetchModelPricing(),b=Object.fromEntries(X),Q=process.cwd(),$=await C0(Q,void 0);if($?.repo)console.log(`Repository: ${$.repo}`);console.log("Converting transcript...");let H=x_(A,{pricing:b,gitContext:$,cwd:Q,taskId:_.id,metadata:G,clientVersion:G?.environment_history?.[0]?.cline_version});if(!H)throw Error("Failed to convert Cline transcript");console.log("Uploading...");let B=await u0({unifiedTranscript:H.transcript,sessionId:_.id,cwd:Q,rawTranscript:z});if(B.skipped)return console.log(""),console.log("Skipped: Repository not in allowlist"),!0;if(B.anySuccess&&B.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${B.id}`);for(let Z of B.results)if(Z.success){let q=`${Z.baseURL}/s/${B.id}`;console.log(`View: ${q}`)}return!0}else{console.error(""),console.error("Upload failed:");for(let Z of B.results)if(!Z.success&&Z.error)console.error(` ${Z.envName}: ${Z.error}`);return!1}}async function Gk(_){let z=Jk(_.path);if(!z)throw Error(`Failed to read Pi session: ${_.path}`);let G=await new I0().fetchModelPricing(),J=Object.fromEntries(G),Y=z.header.cwd??process.cwd(),X=await C0(Y,void 0);if(X?.repo)console.log(`Repository: ${X.repo}`);console.log("Converting transcript...");let b=v_(z,{pricing:J,gitContext:X,cwd:Y});if(!b)throw Error("Failed to convert Pi transcript");console.log("Uploading...");let Q=await u0({unifiedTranscript:b.transcript,sessionId:_.id,cwd:Y,rawTranscript:JSON.stringify(z)});if(Q.skipped)return console.log(""),console.log("Skipped: Repository not in allowlist"),!0;if(Q.anySuccess&&Q.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${Q.id}`);for(let $ of Q.results)if($.success){let H=`${$.baseURL}/s/${Q.id}`;console.log(`View: ${H}`)}return!0}else{console.error(""),console.error("Upload failed:");for(let $ of Q.results)if(!$.success&&$.error)console.error(` ${$.envName}: ${$.error}`);return!1}}function Jk(_){if(!B2(_))return null;let A=Z2(_,"utf-8").split(`
156
+ `).filter((Y)=>Y.trim());if(A.length===0)return null;let G=JSON.parse(A[0]),J=[];for(let Y=1;Y<A.length;Y++)try{J.push(JSON.parse(A[Y]))}catch{}return{header:G,entries:J}}function Yk(_){try{let z=sS("opencode",["export",_],{encoding:"utf-8",timeout:30000,stdio:["pipe","pipe","pipe"]});if(z.status!==0||z.error)return null;let A=z.stdout.trim();if(!A)return null;return JSON.parse(A)}catch{return null}}function CQ(_){if(_.anySuccess&&_.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${_.id}`);for(let z of _.results)if(z.success){let A=`${z.baseURL}/s/${_.id}`;console.log(`View: ${A}`)}return!0}else if(_.results.length===0)return console.log(""),console.log("Skipped: Repository not in allowlist"),!0;else{console.error(""),console.error("Upload failed:");for(let z of _.results)if(!z.success&&z.error)console.error(` ${z.envName}: ${z.error}`);return!1}}var Xk="/tmp/agentlogs.log";function bk(){return!1}var j=zb("cli",{logFilePath:Xk,logToFile:bk(),disableConsole:!0}),vQ="https://agentlogs.ai",Qk=/https?:\/\/[^\s"'`]+\/s\/([a-zA-Z0-9_-]+)/;function $k(_){let z=_.toLowerCase();return z==="localhost"||z==="127.0.0.1"||z==="::1"}function Hk(_){try{let z=new URL(_);return $k(z.hostname)}catch{return!1}}function yQ(_){try{let z=new URL(_);return`${z.protocol}//${z.host.toLowerCase()}`}catch{return _.replace(/\/+$/,"")}}function Bk(_){let z=_.find((A)=>!Hk(A.baseURL))??_[0];return yQ(z?.baseURL??vQ)}async function S1(){let _=await f9();return Bk(_)}function x4(_){return/\bgit\s+commit\b/.test(_)}function k1(_,z,A){let J=`\uD83D\uDD2E View transcript: ${yQ(A??vQ)}/s/${z}`;if(_.includes(J)||m_(_)===z)return _;let Y=`
156
157
 
157
- ${G}`,Y=[{regex:/(\s--message=)"([^"]*)"/,quote:'"',equalsForm:!0},{regex:/(\s--message=)'([^']*)'/,quote:"'",equalsForm:!0},{regex:/(\s(?:-m|--message|-am))\s+"([^"]*)"/,quote:'"',equalsForm:!1},{regex:/(\s(?:-m|--message|-am))\s+'([^']*)'/,quote:"'",equalsForm:!1},{regex:/(\s--message=)([^\s"'][^\s]*)(\s|$)/,quote:'"',equalsForm:!0,unquoted:!0},{regex:/(\s(?:-m|--message|-am))\s+([^\s"'-][^\s]*)(\s|$)/,quote:'"',equalsForm:!1,unquoted:!0}];for(let{regex:X,quote:Q,equalsForm:$,unquoted:H}of Y){let B=_.match(X);if(B){let Z=B[1],F=B[2],K=B[3]||"";if(H&&$)return _.replace(X,`${Z}${Q}${F}${J}${Q}${K}`);if(H)return _.replace(X,`${Z} ${Q}${F}${J}${Q}${K}`);if($)return _.replace(X,`${Z}${Q}${F}${J}${Q}`);return _.replace(X,`${Z} ${Q}${F}${J}${Q}`)}}return _}function S_(_){let z=new RegExp(QS.source,"g"),A=[..._.matchAll(z)];if(A.length===0)return;return A[A.length-1][1]}function M1(_){let z=_.match(/\[[\w/-]+(?:\s+\([^)]+\))?\s+([a-f0-9]{7,40})\]/);return z?z[1]:void 0}function N1(_){let z=_.match(/\[[\w/-]+(?:\s+\([^)]+\))?\s+[a-f0-9]{7,40}\]\s+(.+)/);return z?z[1].trim():void 0}function w1(_){let z=_.match(/\[([\w/-]+)(?:\s+\([^)]+\))?\s+[a-f0-9]{7,40}\]/);return z?z[1]:void 0}async function E1(_){let z=await T9();if(z.length===0){x.warn("Commit tracking skipped: no authenticated environments",{transcriptId:_.transcriptId.substring(0,8)});return}for(let A of z)try{let b=new AbortController,G=setTimeout(()=>b.abort(),5000),J=await fetch(new URL("/api/commit-track",A.baseURL),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${A.token}`},body:JSON.stringify({transcript_id:_.transcriptId,repo_path:_.repoPath,timestamp:_.timestamp,commit_sha:_.commitSha,commit_title:_.commitTitle,branch:_.branch}),signal:b.signal});if(clearTimeout(G),!J.ok){x.warn(`Commit tracking to ${A.name} failed`,{transcriptId:_.transcriptId.substring(0,8),status:J.status});continue}x.info(`Commit tracked (${A.name})`,{transcriptId:_.transcriptId.substring(0,8)})}catch(b){if(b instanceof Error&&b.name==="AbortError"){x.warn(`Commit tracking to ${A.name} timed out`,{transcriptId:_.transcriptId.substring(0,8)});continue}x.error(`Commit tracking to ${A.name} error`,{transcriptId:_.transcriptId.substring(0,8),error:b instanceof Error?b.message:String(b)})}}var ZS=2048;function O1(){return new Promise((_,z)=>{let A="";process.stdin.setEncoding("utf8"),process.stdin.on("data",(b)=>{A+=b}),process.stdin.on("end",()=>{_({preview:A.slice(0,ZS),full:A})}),process.stdin.on("error",(b)=>z(b))})}async function DQ(){let _=Date.now(),z,A;try{let{preview:b,full:G}=await O1();if(x.info(`Hook invoked (stdin: ${G.length} bytes)`),!G.trim())x.warn("Hook received empty stdin - ignoring"),process.exit(0);let J=b.includes('"PreToolUse"'),Y=b.includes("git")&&b.includes("commit");if(J&&!Y){let $={hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}};process.stdout.write(JSON.stringify($));let H=Date.now()-_;x.info(`Hook completed: PreToolUse (fast path, ${H}ms)`),process.exit(0)}let X;try{X=JSON.parse(G)}catch($){x.error("Hook failed to parse stdin JSON",{error:$ instanceof Error?$.message:$}),process.exit(1)}if(z=X.hook_event_name,A=X.session_id||"unknown",!z)x.error("Hook missing event name",{sessionId:A}),process.exit(1);if(x.info(`Hook: ${z} (session: ${A.substring(0,8)}...)`),z==="PreToolUse")await qS(X);else if(z==="PostToolUse")await WS(X);else if(z==="SessionEnd")await VS(X);else if(z==="Stop")await US(X);else x.debug(`Hook: skipping unsupported event ${z}`);let Q=Date.now()-_;x.info(`Hook completed: ${z} (${Q}ms)`,{sessionId:A.substring(0,8)}),process.exit(0)}catch(b){let G=Date.now()-_;x.error(`Hook failed: ${z||"unknown"} (${G}ms)`,{sessionId:A?.substring(0,8),error:b instanceof Error?b.message:String(b)}),process.exit(1)}}function MQ(_){if(_.tool_input&&typeof _.tool_input==="object"&&typeof _.tool_input.command==="string")return{command:_.tool_input.command,updateCommand:(z)=>{if(_.tool_input)_.tool_input.command=z}};if(typeof _.command==="string")return{command:_.command,updateCommand:(z)=>{_.command=z}};return{command:void 0,updateCommand:()=>{}}}function FS(_){if(_.tool_response?.stdout)return _.tool_response.stdout;if(_.tool_response)return JSON.stringify(_.tool_response);return}function KS(_){if(typeof _.repo_path==="string")return _.repo_path;if(typeof _.cwd==="string")return _.cwd;return""}async function qS(_){let z=_.session_id||"unknown",A=!1,b=!1,{command:G,updateCommand:J}=MQ(_),Y=typeof _.tool_name==="string"?_.tool_name:_.tool,X=Y?Y.toLowerCase()==="bash":Boolean(G),Q=typeof _.cwd==="string"?_.cwd:void 0,$=await a0(Q),H=e9($);if(X&&G&&P_(G)&&H){A=!0;let Z=await A4(z),F=await U1(),K=D1(G,Z,F);if(K!==G)J(K),b=!0}let B=b?{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow",updatedInput:_.tool_input}}:{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}};if(process.stdout.write(JSON.stringify(B)),A)await DS({sessionId:z,transcriptPath:_.transcript_path,cwd:typeof _.cwd==="string"?_.cwd:void 0});x.info("PreToolUse handled",{sessionId:z.substring(0,8),shouldTrack:A,modified:b})}async function WS(_){let z=_.session_id||"unknown",A=KS(_),{command:b}=MQ(_);if(!b||!P_(b))return;let G=S_(b);if(!G){x.debug("PostToolUse: git commit without agentlogs link",{sessionId:z.substring(0,8)});return}let J=FS(_),Y=J?M1(J):void 0,X=J?N1(J):void 0,Q=J?w1(J):void 0;await E1({transcriptId:G,repoPath:A,timestamp:new Date().toISOString(),commitSha:Y,commitTitle:X,branch:Q}),x.info("PostToolUse: tracked commit",{sessionId:z.substring(0,8),transcriptId:G,commitSha:Y?.substring(0,8)})}async function VS(_){let z=_.transcript_path,A=_.session_id||"unknown";if(!z){x.error("SessionEnd: missing transcript_path",{sessionId:A});return}try{let b=await P4({transcriptPath:z,sessionId:_.session_id,cwdOverride:_.cwd});if(b.results.length===0){if(!b.anySuccess)x.info("SessionEnd: upload skipped (repo not allowed or no auth)",{sessionId:A});return}for(let G of b.results)if(G.success)x.info(`SessionEnd: uploaded to ${G.envName} (${b.eventCount} events)`,{transcriptId:G.transcriptId,sessionId:A.substring(0,8)});else x.error(`SessionEnd: upload to ${G.envName} failed`,{sessionId:A,error:G.error})}catch(b){x.error("SessionEnd: upload error",{sessionId:A,error:b instanceof Error?b.message:String(b)})}}async function US(_){let z=_.transcript_path,A=_.session_id||"unknown";if(!z){x.error("Stop: missing transcript_path",{sessionId:A});return}if(_.stop_hook_active){x.debug("Stop: skipped (stop_hook_active=true)",{sessionId:A});return}try{let b=await P4({transcriptPath:z,sessionId:_.session_id,cwdOverride:_.cwd});if(b.results.length===0){if(!b.anySuccess)x.info("Stop: upload skipped (repo not allowed or no auth)",{sessionId:A});return}for(let G of b.results)if(G.success)x.info(`Stop: uploaded to ${G.envName} (${b.eventCount} events)`,{transcriptId:G.transcriptId,sessionId:A.substring(0,8)});else x.error(`Stop: upload to ${G.envName} failed`,{sessionId:A,error:G.error})}catch(b){x.error("Stop: upload error",{sessionId:A,error:b instanceof Error?b.message:String(b)})}}async function DS(_){if(!_.transcriptPath){x.warn("Partial upload skipped: missing transcript_path",{sessionId:_.sessionId.substring(0,8)});return}try{let z=await P4({transcriptPath:_.transcriptPath,sessionId:_.sessionId,cwdOverride:_.cwd});if(z.results.length===0){if(!z.anySuccess)x.info("Partial upload: skipped (repo not allowed or no auth)",{sessionId:_.sessionId.substring(0,8)});return}for(let A of z.results)if(A.success)x.info(`Partial upload: uploaded to ${A.envName}`,{transcriptId:A.transcriptId,sessionId:_.sessionId.substring(0,8),eventCount:z.eventCount});else x.error(`Partial upload: to ${A.envName} failed`,{sessionId:_.sessionId.substring(0,8),error:A.error})}catch(z){x.error("Partial upload: error",{sessionId:_.sessionId.substring(0,8),error:z instanceof Error?z.message:String(z)})}}import{createHash as MS}from"crypto";import{promises as S6}from"fs";import{homedir as NS}from"os";import{basename as wS,extname as ES,join as k6,relative as OS,resolve as LS}from"path";var jS=k6(NS(),".claude");async function NQ(_={}){let{repoFilter:z,claudeDir:A}=_,b=await T9();if(b.length===0)console.error("You must be logged in to sync transcripts."),console.error("Run `agentlogs login agentlogs.ai` to authenticate"),process.exit(1);let G=A?LS(A):process.env.CLAUDE_HOME??jS,J=k6(G,"projects"),Y=await PS(J);if(Y.length===0){console.log(`No local Claude Code transcripts were found under ${J}. Nothing to sync.`);return}let X=z?Y.filter(($)=>$.repoId===z):Y;if(z&&X.length===0){let $=Y.filter((H)=>H.repoId===null).length;if(console.log(`No local Claude Code transcripts matched repo ${z}.`),$>0)console.log(`${$} transcript(s) were skipped because their repo could not be determined.`);return}let Q=b.map(($)=>$.name).join(", ");console.log(`Syncing to environments: ${Q}`),console.log(`Found ${X.length} local transcript(s)
158
- `);for(let $ of b)await RS($,X,z)}async function RS(_,z,A){let b=_.name;console.log(`
159
- --- ${b} (${_.baseURL}) ---`);try{let G=await BX({serverUrl:_.baseURL,authToken:_.token}),J=A?G.filter((F)=>F.repoId===A):G,Y=new Map;for(let F of J)Y.set(F.transcriptId,F.sha256);let X=z.filter((F)=>{let K=Y.get(F.transcriptId);return!K||K!==F.sha256});if(X.length===0){console.log("All local transcripts are up to date.");return}console.log(`Uploading ${X.length} transcript(s)...`);let Q=0,$=0,H=0,B=[];for(let[F,K]of X.entries()){let q=`${F+1}/${X.length}`,W=K.repoId?` • ${K.repoId}`:"",V=`${K.transcriptId} – ${K.displayPath}${W}`;try{let w=await BQ({transcriptPath:K.path,sessionId:K.transcriptId,cwdOverride:K.cwd??void 0},{serverUrl:_.baseURL,authToken:_.token});if(w.skipped)$+=1,console.log(`[${q}] - ${V} • skipped (repo not allowed)`);else if(w.success)Q+=1,console.log(`[${q}] ✓ ${V} • ${w.eventCount} events${w.transcriptId?` → ${w.transcriptId}`:""}`);else{H+=1;let O="Upload returned unsuccessful response.";console.error(`[${q}] ✗ ${V} • ${O}`),B.push({transcriptId:K.transcriptId,displayPath:K.displayPath,reason:O})}}catch(w){H+=1;let O=w instanceof Error?w.message:String(w);console.error(`[${q}] ✗ ${V} • ${O}`),B.push({transcriptId:K.transcriptId,displayPath:K.displayPath,reason:O})}}let Z=$>0?`, ${$} skipped`:"";if(console.log(`Sync complete: ${Q} uploaded, ${H} failed${Z}.`),B.length>0){console.error("Failed transcript details:");for(let F of B.slice(0,10))console.error(` - ${F.transcriptId} (${F.displayPath}): ${F.reason}`);if(B.length>10)console.error(` …and ${B.length-10} more failures.`)}}catch(G){console.error(`Error syncing to ${b}: ${G instanceof Error?G.message:String(G)}`)}}async function PS(_){if(!await wQ(_))return[];let z=await S6.readdir(_,{withFileTypes:!0}),A=[],G=await new r0().fetchModelPricing(),J=Object.fromEntries(G);for(let Y of z){if(!Y.isDirectory())continue;let X=k6(_,Y.name),Q=await S6.readdir(X,{withFileTypes:!0});for(let $ of Q){if(!$.isFile()||ES($.name)!==".jsonl")continue;let H=k6(X,$.name),B=wS($.name,".jsonl");try{let Z=await S6.readFile(H,"utf8"),F=kS(Z),K=await xS(F),q=SS(Z),W=IS(q),V=F?await e0(F,W):null,w=J6(q,{pricing:J,gitContext:V});if(!w){console.warn(`Skipped transcript at ${H}: Could not convert to unified format`);continue}let O=L_(w.transcript),M=JSON.stringify(O),P=MS("sha256").update(M).digest("hex");A.push({transcriptId:B,path:H,sha256:P,cwd:F,repoId:K,displayPath:OS(_,H)||$.name})}catch(Z){console.warn(`Skipped transcript at ${H}: ${Z.message}`)}}}return A}async function wQ(_){try{return(await S6.stat(_)).isDirectory()}catch{return!1}}function SS(_){let z=_.split(/\r?\n/),A=[];for(let b of z){let G=b.trim();if(!G)continue;try{let J=JSON.parse(G);if(typeof J==="object"&&J!==null)A.push(J)}catch{continue}}return A}function kS(_){let z=_.split(/\r?\n/);for(let A of z){let b=A.trim();if(!b)continue;try{let J=JSON.parse(b)?.cwd;if(typeof J==="string"&&J.length>0)return J}catch{continue}}return null}function IS(_){for(let z of _){let A=typeof z.gitBranch==="string"?z.gitBranch.trim():"";if(A)return A}return}async function xS(_){if(!_)return null;if(!await wQ(_))return null;try{return uY(_).repoId}catch{return null}}async function I6(_,z="claude-code"){if(!_)console.error("The upload command expects a <transcript> argument."),process.exit(1);let A=ZQ(_);if(!A)console.error(`Transcript file not found for path: ${_}`),process.exit(1);let b=await T9();if(b.length===0)console.error("You must be logged in to upload transcripts."),console.error("Run `agentlogs login agentlogs.ai` to authenticate"),process.exit(1);let G=z==="codex"?"Codex":"Claude Code",J=b.map((Y)=>Y.name).join(", ");console.log(`Uploading ${G} transcript from ${A}`),console.log(`Target environments: ${J}`);try{let Y=await P4({transcriptPath:A,source:z});if(Y.results.length===0){console.log(""),console.log("- Upload skipped (repo not allowed by allowlist)"),console.log(" Use `agentlogs allow` to enable uploads for this repo.");return}console.log("");for(let X of Y.results){let Q=X.envName;if(X.success){if(console.log(`✓ ${Q}: uploaded successfully`),X.id)console.log(` ID: ${X.id}`);if(X.transcriptId)console.log(` Transcript ID: ${X.transcriptId}`)}else if(console.log(`✗ ${Q}: upload failed`),X.error)console.log(` Error: ${X.error}`)}if(console.log(""),Y.allSuccess)console.log(`✓ Upload complete (${Y.eventCount} events)`);else if(Y.anySuccess)console.log(`⚠ Partial upload (${Y.eventCount} events) - some environments failed`),process.exit(1);else console.error("✗ Upload failed for all environments"),process.exit(1)}catch(Y){console.error(Y instanceof Error?Y.message:"Unexpected error occurred while uploading transcript."),process.exit(1)}}async function EQ(_){await I6(_,"claude-code")}async function OQ(_){await I6(_,"codex")}import{spawnSync as TS}from"child_process";function CS(_){try{let z=TS("opencode",["export",_],{encoding:"utf-8",timeout:30000,stdio:["pipe","pipe","pipe"]});if(z.status!==0||z.error)return null;let A=z.stdout.trim();if(!A)return null;return JSON.parse(A)}catch{return null}}async function LQ(_){if(!_)console.error("Error: Session ID is required"),process.exit(1);console.log(`Uploading OpenCode session: ${_}`);let z=CS(_);if(!z)console.error(`Error: Session not found: ${_}`),console.error("Run 'opencode session list' to see available sessions"),process.exit(1);if(z.info.parentID)console.log("Skipping subagent session"),process.exit(0);let A=z.info.title||"Untitled",b=z.messages?.length??0;console.log(`Session: "${A}" (${b} messages)`);let J=await new r0().fetchModelPricing(),Y=Object.fromEntries(J),X=z.info.directory??process.cwd(),Q=await e0(X,void 0);if(Q?.repo)console.log(`Repository: ${Q.repo}`);console.log("Converting transcript...");let $=E_(z,{pricing:Y,gitContext:Q,cwd:X});if(!$)console.error("Error: Failed to convert transcript"),process.exit(1);console.log("Uploading...");let H=await E9({unifiedTranscript:$,sessionId:_,cwd:X,rawTranscript:JSON.stringify(z)});if(H.skipped)console.log("Skipped: Repository not in allowlist"),process.exit(0);if(H.anySuccess&&H.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${H.id}`);for(let B of H.results)if(B.success){let Z=`${B.baseURL}/app/logs/${H.id}`;console.log(`View: ${Z}`)}}else{console.error(""),console.error("Upload failed:");for(let B of H.results)if(!B.success&&B.error)console.error(` ${B.envName}: ${B.error}`);process.exit(1)}}import{spawnSync as vS}from"child_process";async function jQ(){let _=Date.now(),z,A;try{let{preview:b,full:G}=await O1();if(x.info(`OpenCode hook invoked (stdin: ${G.length} bytes)`),!G.trim())x.warn("OpenCode hook received empty stdin - ignoring"),B4({modified:!1}),process.exit(0);let J=b.includes("tool.execute.before"),Y=b.includes("git")&&b.includes("commit");if(J&&!Y){B4({modified:!1});let $=Date.now()-_;x.info(`OpenCode hook completed: tool.execute.before (fast path, ${$}ms)`),process.exit(0)}let X;try{X=JSON.parse(G)}catch($){x.error("OpenCode hook failed to parse stdin JSON",{error:$ instanceof Error?$.message:$}),B4({modified:!1}),process.exit(1)}if(z=X.hook_event_name,A=X.session_id||"unknown",!z)x.error("OpenCode hook missing event name",{sessionId:A}),B4({modified:!1}),process.exit(1);if(x.info(`OpenCode hook: ${z} (session: ${A.substring(0,8)}...)`),z==="tool.execute.before")await yS(X);else if(z==="tool.execute.after")await gS(X),B4({modified:!1});else if(z==="session.idle")await fS(X),B4({modified:!1});else x.debug(`OpenCode hook: skipping unsupported event ${z}`),B4({modified:!1});let Q=Date.now()-_;x.info(`OpenCode hook completed: ${z} (${Q}ms)`,{sessionId:A.substring(0,8)}),process.exit(0)}catch(b){let G=Date.now()-_;x.error(`OpenCode hook failed: ${z||"unknown"} (${G}ms)`,{sessionId:A?.substring(0,8),error:b instanceof Error?b.message:String(b)}),B4({modified:!1}),process.exit(1)}}function B4(_){process.stdout.write(JSON.stringify(_))}async function yS(_){let{session_id:z,call_id:A}=_,b=_.tool||"",G=_.tool_input||{},J=typeof G.command==="string"?G.command:"",Y=_.cwd,X=b==="bash",Q=await a0(Y),$=e9(Q);if(X&&P_(J)&&$){let H=await A4(z),B=await U1(),Z=D1(J,H,B);if(Z!==J){if(x.info("OpenCode hook: intercepting git commit",{sessionId:z.substring(0,8),transcriptId:H,callId:A}),A)await Qz(A,H);await hS(z,Y),B4({modified:!0,args:{...G,command:Z}});return}}B4({modified:!1})}async function gS(_){let{session_id:z,call_id:A}=_,b=_.tool||"",G=_.tool_output||{},J=_.cwd||"";if(b!=="bash")return;let X=G.output||"",Q=S_(X),$=!1;if(!Q&&A)Q=await $z(A),$=!0;if(!Q)return;if(A)await Hz(A);let H=M1(X),B=N1(X),Z=w1(X);if(!H){x.debug("OpenCode PostToolUse: found link but no commit SHA",{sessionId:z.substring(0,8),transcriptId:Q,fromCache:$});return}await E1({transcriptId:Q,repoPath:J,timestamp:new Date().toISOString(),commitSha:H,commitTitle:B,branch:Z}),x.info("OpenCode PostToolUse: tracked commit",{sessionId:z.substring(0,8),transcriptId:Q,commitSha:H.substring(0,8),fromCache:$})}async function fS(_){let{session_id:z,cwd:A}=_;x.info("OpenCode session.idle: uploading transcript",{sessionId:z.substring(0,8)}),await mS(z,A)}function RQ(_){try{let z=vS("opencode",["export",_],{encoding:"utf-8",timeout:30000,stdio:["pipe","pipe","pipe"]});if(z.status!==0||z.error)return x.warn("OpenCode export failed",{sessionId:_.substring(0,8),error:z.error?.message||z.stderr}),null;let A=z.stdout.trim();if(!A)return null;return JSON.parse(A)}catch(z){return x.error("OpenCode export error",{sessionId:_.substring(0,8),error:z instanceof Error?z.message:String(z)}),null}}async function hS(_,z){let A=RQ(_);if(!A){x.warn("OpenCode partial upload: session not found",{sessionId:_.substring(0,8)});return}await PQ(A,_,z,"partial")}async function mS(_,z){let A=RQ(_);if(!A){x.warn("OpenCode full upload: session not found",{sessionId:_.substring(0,8)});return}if(A.info.parentID){x.debug("OpenCode full upload: skipping subagent session",{sessionId:_.substring(0,8)});return}await PQ(A,_,z,"full")}async function PQ(_,z,A,b="full"){try{let J=await new r0().fetchModelPricing(),Y=Object.fromEntries(J),X=A||_.info.directory||process.cwd(),Q=await e0(X,void 0),$=E_(_,{pricing:Y,gitContext:Q,cwd:X});if(!$){x.error(`OpenCode ${b} upload: failed to convert transcript`,{sessionId:z.substring(0,8)});return}let H=await E9({unifiedTranscript:$,sessionId:z,cwd:X,rawTranscript:JSON.stringify(_)});if(H.skipped){x.info(`OpenCode ${b} upload: skipped (repo not allowed)`,{sessionId:z.substring(0,8)});return}for(let B of H.results)if(B.success)x.info(`OpenCode ${b} upload: success (${B.envName})`,{sessionId:z.substring(0,8),transcriptId:H.id});else x.error(`OpenCode ${b} upload: failed (${B.envName})`,{sessionId:z.substring(0,8),error:B.error})}catch(G){x.error(`OpenCode ${b} upload: error`,{sessionId:z.substring(0,8),error:G instanceof Error?G.message:String(G)})}}import{existsSync as j1,readFileSync as b2,readdirSync as x6}from"fs";import{join as L1,basename as uS}from"path";import{homedir as SQ}from"os";var t4=L1(SQ(),".pi","agent","sessions");function cS(_){if(!j1(_))return null;let A=b2(_,"utf-8").split(`
160
- `).filter((J)=>J.trim());if(A.length===0)return null;let b=JSON.parse(A[0]),G=[];for(let J=1;J<A.length;J++)try{G.push(JSON.parse(A[J]))}catch{}return{header:b,entries:G}}function lS(_){if(!j1(t4))return null;for(let z of x6(t4)){let A=L1(t4,z);if(!j1(A))continue;for(let b of x6(A)){if(!b.endsWith(".jsonl"))continue;if(b.includes(_))return L1(A,b);let G=L1(A,b);try{let J=b2(G,"utf-8").split(`
161
- `)[0];if(JSON.parse(J).id===_)return G}catch{}}}return null}function pS(_=10){let z=[];if(!j1(t4))return z;for(let A of x6(t4)){let b=L1(t4,A);if(!j1(b))continue;for(let G of x6(b)){if(!G.endsWith(".jsonl"))continue;let J=L1(b,G);try{let Y=b2(J,"utf-8").split(`
162
- `)[0],X=JSON.parse(Y);z.push({path:J,id:X.id,timestamp:X.timestamp,cwd:X.cwd})}catch{}}}return z.sort((A,b)=>b.timestamp.localeCompare(A.timestamp)),z.slice(0,_)}async function kQ(_){if(!_){console.log("Recent Pi sessions:"),console.log("");let F=pS(10);if(F.length===0)console.log("No sessions found in",t4),process.exit(1);for(let K of F){let W=new Date(K.timestamp).toLocaleString();console.log(` ${K.id.substring(0,8)}... ${W}`),console.log(` ${K.cwd}`),console.log("")}console.log("Usage: agentlogs pi upload <session-id-or-path>"),process.exit(0)}let z,A=_.startsWith("~")?_.replace(/^~/,SQ()):_;if(j1(A))z=A;else{let F=lS(_);if(!F)console.error(`Error: Session not found: ${_}`),console.error(`Searched in: ${t4}`),process.exit(1);z=F}console.log(`Uploading Pi session: ${uS(z)}`);let b=cS(z);if(!b)console.error(`Error: Failed to read session file: ${z}`),process.exit(1);let G=b.entries.filter((F)=>F.type==="message").length;console.log(`Session: ${b.header.id.substring(0,8)}... (${G} messages)`);let Y=await new r0().fetchModelPricing(),X=Object.fromEntries(Y),Q=b.header.cwd??process.cwd(),$=await e0(Q,void 0);if($?.repo)console.log(`Repository: ${$.repo}`);console.log("Converting transcript...");let H=O_(b,{pricing:X,gitContext:$,cwd:Q});if(!H)console.error("Error: Failed to convert transcript"),process.exit(1);let B=[];for(let[F,K]of H.blobs)B.push({sha256:F,data:new Uint8Array(K.data),mediaType:K.mediaType});console.log("Uploading...");let Z=await E9({unifiedTranscript:H.transcript,sessionId:b.header.id,cwd:Q,rawTranscript:JSON.stringify(b),blobs:B.length>0?B:void 0});if(Z.skipped)console.log("Skipped: Repository not in allowlist"),process.exit(0);if(Z.anySuccess&&Z.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${Z.id}`);for(let F of Z.results)if(F.success){let K=`${F.baseURL}/app/logs/${Z.id}`;console.log(`View: ${K}`)}}else{console.error(""),console.error("Upload failed:");for(let F of Z.results)if(!F.success&&F.error)console.error(` ${F.envName}: ${F.error}`);process.exit(1)}}import{existsSync as dS,readFileSync as rS}from"fs";async function IQ(){let _=Date.now(),z,A;try{let{preview:b,full:G}=await O1();if(x.info(`Pi hook invoked (stdin: ${G.length} bytes)`),!G.trim())x.warn("Pi hook received empty stdin - ignoring"),c9({modified:!1}),process.exit(0);let J=b.includes("tool_call")&&!b.includes("tool_call_id"),Y=b.includes("git")&&b.includes("commit");if(J&&!Y){c9({modified:!1});let $=Date.now()-_;x.info(`Pi hook completed: tool_call (fast path, ${$}ms)`),process.exit(0)}let X;try{X=JSON.parse(G)}catch($){x.error("Pi hook failed to parse stdin JSON",{error:$ instanceof Error?$.message:$}),c9({modified:!1}),process.exit(1)}if(z=X.hook_event_name,A=X.session_id||"unknown",!z)x.error("Pi hook missing event name",{sessionId:A}),c9({modified:!1}),process.exit(1);if(x.info(`Pi hook: ${z} (session: ${A.substring(0,8)}...)`),z==="tool_call")await nS(X);else if(z==="tool_result")await iS(X),c9({modified:!1});else if(z==="session_shutdown")await oS(X),c9({modified:!1});else if(z==="agent_end")await aS(X),c9({modified:!1});else x.debug(`Pi hook: skipping unsupported event ${z}`),c9({modified:!1});let Q=Date.now()-_;x.info(`Pi hook completed: ${z} (${Q}ms)`,{sessionId:A.substring(0,8)}),process.exit(0)}catch(b){let G=Date.now()-_;x.error(`Pi hook failed: ${z||"unknown"} (${G}ms)`,{sessionId:A?.substring(0,8),error:b instanceof Error?b.message:String(b)}),c9({modified:!1}),process.exit(1)}}function c9(_){process.stdout.write(JSON.stringify(_))}async function nS(_){let{session_id:z,tool_call_id:A}=_,b=_.tool||"",G=_.tool_input||{},J=typeof G.command==="string"?G.command:"",Y=_.cwd,X=b.toLowerCase()==="bash",Q=await a0(Y),$=e9(Q);if(X&&P_(J)&&$){let H=await A4(z),B=await U1(),Z=D1(J,H,B);if(Z!==J){if(x.info("Pi hook: intercepting git commit",{sessionId:z.substring(0,8),transcriptId:H,toolCallId:A}),A)await Qz(A,H);await sS(_),c9({modified:!0,updatedInput:{...G,command:Z}});return}}c9({modified:!1})}async function iS(_){let{session_id:z,tool_call_id:A}=_,b=_.tool||"",G=_.tool_output||{},J=_.cwd||"";if(b.toLowerCase()!=="bash")return;let X=G.stdout||G.content||"",Q=typeof X==="string"?X:JSON.stringify(X),$=S_(Q),H=!1;if(!$&&A)$=await $z(A),H=!0;if(!$)return;if(A)await Hz(A);let B=M1(Q),Z=N1(Q),F=w1(Q);if(!B){x.debug("Pi tool_result: found link but no commit SHA",{sessionId:z.substring(0,8),transcriptId:$,fromCache:H});return}await E1({transcriptId:$,repoPath:J,timestamp:new Date().toISOString(),commitSha:B,commitTitle:Z,branch:F}),x.info("Pi tool_result: tracked commit",{sessionId:z.substring(0,8),transcriptId:$,commitSha:B.substring(0,8),fromCache:H})}async function oS(_){let z=_.session_id;x.info("Pi session_shutdown: uploading transcript",{sessionId:z.substring(0,8)}),await TQ(_)}async function aS(_){let z=_.session_id;x.info("Pi agent_end: uploading transcript",{sessionId:z.substring(0,8)}),await TQ(_)}function xQ(_){if(!dS(_))return null;try{let A=rS(_,"utf-8").split(`
163
- `).filter((J)=>J.trim());if(A.length===0)return null;let b=JSON.parse(A[0]),G=[];for(let J=1;J<A.length;J++)try{G.push(JSON.parse(A[J]))}catch{}return{header:b,entries:G}}catch(z){return x.error("Pi: failed to read session file",{sessionFile:_,error:z instanceof Error?z.message:String(z)}),null}}async function sS(_){let{session_id:z,cwd:A,session_data:b}=_;if(!b&&_.session_file)b=xQ(_.session_file)??void 0;if(!b){x.warn("Pi partial upload: no session data available",{sessionId:z.substring(0,8)});return}await CQ(b,z,A,_.leaf_id,"partial")}async function TQ(_){let{session_id:z,cwd:A,session_data:b}=_;if(!b&&_.session_file)b=xQ(_.session_file)??void 0;if(!b){x.warn("Pi full upload: no session data available",{sessionId:z.substring(0,8)});return}await CQ(b,z,A,_.leaf_id,"full")}async function CQ(_,z,A,b,G="full"){try{let Y=await new r0().fetchModelPricing(),X=Object.fromEntries(Y),Q=A||_.header.cwd||process.cwd(),$=await e0(Q,void 0),H=O_(_,{pricing:X,gitContext:$,cwd:Q,leafId:b});if(!H){x.error(`Pi ${G} upload: failed to convert transcript`,{sessionId:z.substring(0,8)});return}let B=await E9({unifiedTranscript:H.transcript,sessionId:z,cwd:Q,rawTranscript:JSON.stringify(_)});if(B.skipped){x.info(`Pi ${G} upload: skipped (repo not allowed)`,{sessionId:z.substring(0,8)});return}for(let Z of B.results)if(Z.success)x.info(`Pi ${G} upload: success (${Z.envName})`,{sessionId:z.substring(0,8),transcriptId:B.id});else x.error(`Pi ${G} upload: failed (${Z.envName})`,{sessionId:z.substring(0,8),error:Z.error})}catch(J){x.error(`Pi ${G} upload: error`,{sessionId:z.substring(0,8),error:J instanceof Error?J.message:String(J)})}}import{spawn as _k}from"child_process";import{existsSync as T6,readFileSync as uQ}from"fs";import{createInterface as zk}from"readline";import{dirname as Ak,resolve as hQ}from"path";import{fileURLToPath as bk}from"url";import{homedir as vQ}from"os";import{join as k_}from"path";var R1=k_(vQ(),".agentlogs"),P1=k_(R1,"service.pid"),yQ=k_(R1,"service.sock"),gQ=k_(R1,"service.log"),tS=k_(vQ(),".codex"),fe=k_(tS,"sessions"),S1=k_(R1,"watcher-events.log");import{createServer as ue,connect as eS}from"net";function I_(){return new Promise((_,z)=>{let A=eS(yQ);A.on("connect",()=>{_(A)}),A.on("error",(b)=>{z(b)})})}function Cz(_,z){_.write(JSON.stringify(z)+`
164
- `)}function fQ(_,z,A=5000){return new Promise((b,G)=>{let J="",Y=setTimeout(()=>{G(Error("Timeout waiting for response"))},A),X=(Q)=>{J+=Q.toString();let $=J.split(`
165
- `);J=$.pop()||"";for(let H of $){if(!H.trim())continue;try{let B=JSON.parse(H);if(B.type===z)clearTimeout(Y),_.off("data",X),b(B.data)}catch{}}};_.on("data",X)})}var Gk=bk(import.meta.url),mQ=Ak(Gk);function C6(){if(!T6(P1))return{running:!1};try{let _=parseInt(uQ(P1,"utf-8").trim());return process.kill(_,0),{running:!0,pid:_}}catch{return{running:!1}}}async function cQ(){let _=C6();if(_.running){console.log(`Service already running (PID: ${_.pid})`);return}let z=hQ(mQ,"../../service/server.ts"),A=hQ(mQ,"../../service/server.js"),b=T6(z)?z:A;if(!T6(b))console.error(`Service script not found at ${b}`),process.exit(1);let G=_k("bun",["run",b],{detached:!0,stdio:"ignore",env:{...process.env}});G.unref(),console.log(`Service starting (PID: ${G.pid})...`);let J=50;for(let Y=0;Y<J;Y++)try{(await I_()).end(),console.log("Service ready");return}catch{await new Promise((X)=>setTimeout(X,100))}console.error("Service failed to start. Check logs:"),console.error(` tail -f ${gQ}`),process.exit(1)}async function lQ(){let _=C6();if(!_.running){console.log("Service is not running");return}try{let z=await I_();if(Cz(z,{type:"shutdown"}),z.end(),console.log("Shutdown signal sent"),await new Promise((b)=>setTimeout(b,1000)),C6().running)process.kill(_.pid,"SIGTERM"),console.log(`Sent SIGTERM to PID ${_.pid}`)}catch{if(_.pid)process.kill(_.pid,"SIGTERM"),console.log(`Sent SIGTERM to PID ${_.pid}`)}}async function pQ(){let _=C6();if(!_.running){console.log("Service: not running");return}console.log(`Service: running (PID: ${_.pid})`);try{let z=await I_();Cz(z,{type:"status"});let A=await fQ(z,"status_response");if(z.end(),console.log(`Connections: ${A.connections}`),console.log(`Watching: ${A.watching}`),console.log(`Uptime: ${Math.round(A.uptime/1000)}s`),A.lastEvent){let b=Math.round((Date.now()-A.lastEvent.timestamp)/1000);console.log(`Last event: ${A.lastEvent.type} (${b}s ago)`),console.log(` Path: ${A.lastEvent.path}`)}}catch{console.log("Could not connect to service for status")}}async function dQ(){if(!T6(S1)){console.log("No watcher logs yet"),console.log(`Log file: ${S1}`);return}console.log(`Tailing ${S1} (Ctrl+C to stop)
166
- `);let A=uQ(S1,"utf-8").trim().split(`
167
- `).slice(-20);for(let Y of A)try{let X=JSON.parse(Y),Q=new Date(X.timestamp).toISOString();console.log(`[${Q}] ${X.type}: ${X.path}`)}catch{console.log(Y)}let{spawn:b}=await import("child_process"),G=b("tail",["-f",S1],{stdio:["ignore","pipe","inherit"]});zk({input:G.stdout}).on("line",(Y)=>{try{let X=JSON.parse(Y),Q=new Date(X.timestamp).toISOString();console.log(`[${Q}] ${X.type}: ${X.path}`)}catch{console.log(Y)}}),await new Promise(()=>{})}import{spawn as yu}from"child_process";import{existsSync as Lb,readFileSync as gu,appendFileSync as fu}from"fs";import{dirname as hu,resolve as jb}from"path";import{fileURLToPath as mu}from"url";var te=Object.freeze({status:"aborted"});function E(_,z,A){function b(X,Q){if(!X._zod)Object.defineProperty(X,"_zod",{value:{def:Q,constr:Y,traits:new Set},enumerable:!1});if(X._zod.traits.has(_))return;X._zod.traits.add(_),z(X,Q);let $=Y.prototype,H=Object.keys($);for(let B=0;B<H.length;B++){let Z=H[B];if(!(Z in X))X[Z]=$[Z].bind(X)}}let G=A?.Parent??Object;class J extends G{}Object.defineProperty(J,"name",{value:_});function Y(X){var Q;let $=A?.Parent?new J:this;b($,X),(Q=$._zod).deferred??(Q.deferred=[]);for(let H of $._zod.deferred)H();return $}return Object.defineProperty(Y,"init",{value:b}),Object.defineProperty(Y,Symbol.hasInstance,{value:(X)=>{if(A?.Parent&&X instanceof A.Parent)return!0;return X?._zod?.traits?.has(_)}}),Object.defineProperty(Y,"name",{value:_}),Y}var ee=Symbol("zod_brand");class S4 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class vz extends Error{constructor(_){super(`Encountered unidirectional transform during encode: ${_}`);this.name="ZodEncodeError"}}var v6={};function O9(_){if(_)Object.assign(v6,_);return v6}var X0={};J8(X0,{unwrapMessage:()=>yz,uint8ArrayToHex:()=>Sk,uint8ArrayToBase64url:()=>Rk,uint8ArrayToBase64:()=>tQ,stringifyPrimitive:()=>h6,slugify:()=>Y2,shallowClone:()=>nQ,safeExtend:()=>Nk,required:()=>Ok,randomString:()=>Kk,propertyKeyTypes:()=>Q2,promiseAllObject:()=>Fk,primitiveTypes:()=>iQ,prefixIssues:()=>x4,pick:()=>Uk,partial:()=>Ek,parsedType:()=>B2,optionalKeys:()=>$2,omit:()=>Dk,objectClone:()=>Hk,numKeys:()=>qk,nullish:()=>fz,normalizeParams:()=>c,mergeDefs:()=>k4,merge:()=>wk,jsonStringifyReplacer:()=>k1,joinValues:()=>y6,issue:()=>x1,isPlainObject:()=>__,isObject:()=>x_,hexToUint8Array:()=>Pk,getSizableOrigin:()=>aQ,getParsedType:()=>Wk,getLengthableOrigin:()=>mz,getEnumValues:()=>gz,getElementAtPath:()=>Zk,floatSafeRemainder:()=>J2,finalizeIssue:()=>p9,extend:()=>Mk,escapeRegex:()=>I4,esc:()=>g6,defineLazy:()=>H0,createTransparentProxy:()=>Vk,cloneDef:()=>Bk,clone:()=>l9,cleanRegex:()=>hz,cleanEnum:()=>Lk,captureStackTrace:()=>f6,cached:()=>I1,base64urlToUint8Array:()=>jk,base64ToUint8Array:()=>sQ,assignProp:()=>e4,assertNotEqual:()=>Yk,assertNever:()=>Qk,assertIs:()=>Xk,assertEqual:()=>Jk,assert:()=>$k,allowsEval:()=>X2,aborted:()=>z_,NUMBER_FORMAT_RANGES:()=>H2,Class:()=>eQ,BIGINT_FORMAT_RANGES:()=>oQ});function Jk(_){return _}function Yk(_){return _}function Xk(_){}function Qk(_){throw Error("Unexpected value in exhaustive check")}function $k(_){}function gz(_){let z=Object.values(_).filter((b)=>typeof b==="number");return Object.entries(_).filter(([b,G])=>z.indexOf(+b)===-1).map(([b,G])=>G)}function y6(_,z="|"){return _.map((A)=>h6(A)).join(z)}function k1(_,z){if(typeof z==="bigint")return z.toString();return z}function I1(_){return{get value(){{let A=_();return Object.defineProperty(this,"value",{value:A}),A}throw Error("cached value already set")}}}function fz(_){return _===null||_===void 0}function hz(_){let z=_.startsWith("^")?1:0,A=_.endsWith("$")?_.length-1:_.length;return _.slice(z,A)}function J2(_,z){let A=(_.toString().split(".")[1]||"").length,b=z.toString(),G=(b.split(".")[1]||"").length;if(G===0&&/\d?e-\d?/.test(b)){let Q=b.match(/\d?e-(\d?)/);if(Q?.[1])G=Number.parseInt(Q[1])}let J=A>G?A:G,Y=Number.parseInt(_.toFixed(J).replace(".","")),X=Number.parseInt(z.toFixed(J).replace(".",""));return Y%X/10**J}var rQ=Symbol("evaluating");function H0(_,z,A){let b=void 0;Object.defineProperty(_,z,{get(){if(b===rQ)return;if(b===void 0)b=rQ,b=A();return b},set(G){Object.defineProperty(_,z,{value:G})},configurable:!0})}function Hk(_){return Object.create(Object.getPrototypeOf(_),Object.getOwnPropertyDescriptors(_))}function e4(_,z,A){Object.defineProperty(_,z,{value:A,writable:!0,enumerable:!0,configurable:!0})}function k4(..._){let z={};for(let A of _){let b=Object.getOwnPropertyDescriptors(A);Object.assign(z,b)}return Object.defineProperties({},z)}function Bk(_){return k4(_._zod.def)}function Zk(_,z){if(!z)return _;return z.reduce((A,b)=>A?.[b],_)}function Fk(_){let z=Object.keys(_),A=z.map((b)=>_[b]);return Promise.all(A).then((b)=>{let G={};for(let J=0;J<z.length;J++)G[z[J]]=b[J];return G})}function Kk(_=10){let A="";for(let b=0;b<_;b++)A+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return A}function g6(_){return JSON.stringify(_)}function Y2(_){return _.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var f6="captureStackTrace"in Error?Error.captureStackTrace:(..._)=>{};function x_(_){return typeof _==="object"&&_!==null&&!Array.isArray(_)}var X2=I1(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(_){return!1}});function __(_){if(x_(_)===!1)return!1;let z=_.constructor;if(z===void 0)return!0;if(typeof z!=="function")return!0;let A=z.prototype;if(x_(A)===!1)return!1;if(Object.prototype.hasOwnProperty.call(A,"isPrototypeOf")===!1)return!1;return!0}function nQ(_){if(__(_))return{..._};if(Array.isArray(_))return[..._];return _}function qk(_){let z=0;for(let A in _)if(Object.prototype.hasOwnProperty.call(_,A))z++;return z}var Wk=(_)=>{let z=typeof _;switch(z){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(_)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(_))return"array";if(_===null)return"null";if(_.then&&typeof _.then==="function"&&_.catch&&typeof _.catch==="function")return"promise";if(typeof Map<"u"&&_ instanceof Map)return"map";if(typeof Set<"u"&&_ instanceof Set)return"set";if(typeof Date<"u"&&_ instanceof Date)return"date";if(typeof File<"u"&&_ instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${z}`)}},Q2=new Set(["string","number","symbol"]),iQ=new Set(["string","number","bigint","boolean","symbol","undefined"]);function I4(_){return _.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function l9(_,z,A){let b=new _._zod.constr(z??_._zod.def);if(!z||A?.parent)b._zod.parent=_;return b}function c(_){let z=_;if(!z)return{};if(typeof z==="string")return{error:()=>z};if(z?.message!==void 0){if(z?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");z.error=z.message}if(delete z.message,typeof z.error==="string")return{...z,error:()=>z.error};return z}function Vk(_){let z;return new Proxy({},{get(A,b,G){return z??(z=_()),Reflect.get(z,b,G)},set(A,b,G,J){return z??(z=_()),Reflect.set(z,b,G,J)},has(A,b){return z??(z=_()),Reflect.has(z,b)},deleteProperty(A,b){return z??(z=_()),Reflect.deleteProperty(z,b)},ownKeys(A){return z??(z=_()),Reflect.ownKeys(z)},getOwnPropertyDescriptor(A,b){return z??(z=_()),Reflect.getOwnPropertyDescriptor(z,b)},defineProperty(A,b,G){return z??(z=_()),Reflect.defineProperty(z,b,G)}})}function h6(_){if(typeof _==="bigint")return _.toString()+"n";if(typeof _==="string")return`"${_}"`;return`${_}`}function $2(_){return Object.keys(_).filter((z)=>{return _[z]._zod.optin==="optional"&&_[z]._zod.optout==="optional"})}var H2={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]},oQ={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Uk(_,z){let A=_._zod.def,b=A.checks;if(b&&b.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let J=k4(_._zod.def,{get shape(){let Y={};for(let X in z){if(!(X in A.shape))throw Error(`Unrecognized key: "${X}"`);if(!z[X])continue;Y[X]=A.shape[X]}return e4(this,"shape",Y),Y},checks:[]});return l9(_,J)}function Dk(_,z){let A=_._zod.def,b=A.checks;if(b&&b.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let J=k4(_._zod.def,{get shape(){let Y={..._._zod.def.shape};for(let X in z){if(!(X in A.shape))throw Error(`Unrecognized key: "${X}"`);if(!z[X])continue;delete Y[X]}return e4(this,"shape",Y),Y},checks:[]});return l9(_,J)}function Mk(_,z){if(!__(z))throw Error("Invalid input to extend: expected a plain object");let A=_._zod.def.checks;if(A&&A.length>0){let J=_._zod.def.shape;for(let Y in z)if(Object.getOwnPropertyDescriptor(J,Y)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let G=k4(_._zod.def,{get shape(){let J={..._._zod.def.shape,...z};return e4(this,"shape",J),J}});return l9(_,G)}function Nk(_,z){if(!__(z))throw Error("Invalid input to safeExtend: expected a plain object");let A=k4(_._zod.def,{get shape(){let b={..._._zod.def.shape,...z};return e4(this,"shape",b),b}});return l9(_,A)}function wk(_,z){let A=k4(_._zod.def,{get shape(){let b={..._._zod.def.shape,...z._zod.def.shape};return e4(this,"shape",b),b},get catchall(){return z._zod.def.catchall},checks:[]});return l9(_,A)}function Ek(_,z,A){let G=z._zod.def.checks;if(G&&G.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let Y=k4(z._zod.def,{get shape(){let X=z._zod.def.shape,Q={...X};if(A)for(let $ in A){if(!($ in X))throw Error(`Unrecognized key: "${$}"`);if(!A[$])continue;Q[$]=_?new _({type:"optional",innerType:X[$]}):X[$]}else for(let $ in X)Q[$]=_?new _({type:"optional",innerType:X[$]}):X[$];return e4(this,"shape",Q),Q},checks:[]});return l9(z,Y)}function Ok(_,z,A){let b=k4(z._zod.def,{get shape(){let G=z._zod.def.shape,J={...G};if(A)for(let Y in A){if(!(Y in J))throw Error(`Unrecognized key: "${Y}"`);if(!A[Y])continue;J[Y]=new _({type:"nonoptional",innerType:G[Y]})}else for(let Y in G)J[Y]=new _({type:"nonoptional",innerType:G[Y]});return e4(this,"shape",J),J}});return l9(z,b)}function z_(_,z=0){if(_.aborted===!0)return!0;for(let A=z;A<_.issues.length;A++)if(_.issues[A]?.continue!==!0)return!0;return!1}function x4(_,z){return z.map((A)=>{var b;return(b=A).path??(b.path=[]),A.path.unshift(_),A})}function yz(_){return typeof _==="string"?_:_?.message}function p9(_,z,A){let b={..._,path:_.path??[]};if(!_.message){let G=yz(_.inst?._zod.def?.error?.(_))??yz(z?.error?.(_))??yz(A.customError?.(_))??yz(A.localeError?.(_))??"Invalid input";b.message=G}if(delete b.inst,delete b.continue,!z?.reportInput)delete b.input;return b}function aQ(_){if(_ instanceof Set)return"set";if(_ instanceof Map)return"map";if(_ instanceof File)return"file";return"unknown"}function mz(_){if(Array.isArray(_))return"array";if(typeof _==="string")return"string";return"unknown"}function B2(_){let z=typeof _;switch(z){case"number":return Number.isNaN(_)?"nan":"number";case"object":{if(_===null)return"null";if(Array.isArray(_))return"array";let A=_;if(A&&Object.getPrototypeOf(A)!==Object.prototype&&"constructor"in A&&A.constructor)return A.constructor.name}}return z}function x1(..._){let[z,A,b]=_;if(typeof z==="string")return{message:z,code:"custom",input:A,inst:b};return{...z}}function Lk(_){return Object.entries(_).filter(([z,A])=>{return Number.isNaN(Number.parseInt(z,10))}).map((z)=>z[1])}function sQ(_){let z=atob(_),A=new Uint8Array(z.length);for(let b=0;b<z.length;b++)A[b]=z.charCodeAt(b);return A}function tQ(_){let z="";for(let A=0;A<_.length;A++)z+=String.fromCharCode(_[A]);return btoa(z)}function jk(_){let z=_.replace(/-/g,"+").replace(/_/g,"/"),A="=".repeat((4-z.length%4)%4);return sQ(z+A)}function Rk(_){return tQ(_).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Pk(_){let z=_.replace(/^0x/,"");if(z.length%2!==0)throw Error("Invalid hex string length");let A=new Uint8Array(z.length/2);for(let b=0;b<z.length;b+=2)A[b/2]=Number.parseInt(z.slice(b,b+2),16);return A}function Sk(_){return Array.from(_).map((z)=>z.toString(16).padStart(2,"0")).join("")}class eQ{constructor(..._){}}var _$=(_,z)=>{_.name="$ZodError",Object.defineProperty(_,"_zod",{value:_._zod,enumerable:!1}),Object.defineProperty(_,"issues",{value:z,enumerable:!1}),_.message=JSON.stringify(z,k1,2),Object.defineProperty(_,"toString",{value:()=>_.message,enumerable:!1})},m6=E("$ZodError",_$),Z2=E("$ZodError",_$,{Parent:Error});function z$(_,z=(A)=>A.message){let A={},b=[];for(let G of _.issues)if(G.path.length>0)A[G.path[0]]=A[G.path[0]]||[],A[G.path[0]].push(z(G));else b.push(z(G));return{formErrors:b,fieldErrors:A}}function A$(_,z=(A)=>A.message){let A={_errors:[]},b=(G)=>{for(let J of G.issues)if(J.code==="invalid_union"&&J.errors.length)J.errors.map((Y)=>b({issues:Y}));else if(J.code==="invalid_key")b({issues:J.issues});else if(J.code==="invalid_element")b({issues:J.issues});else if(J.path.length===0)A._errors.push(z(J));else{let Y=A,X=0;while(X<J.path.length){let Q=J.path[X];if(X!==J.path.length-1)Y[Q]=Y[Q]||{_errors:[]};else Y[Q]=Y[Q]||{_errors:[]},Y[Q]._errors.push(z(J));Y=Y[Q],X++}}};return b(_),A}var u6=(_)=>(z,A,b,G)=>{let J=b?Object.assign(b,{async:!1}):{async:!1},Y=z._zod.run({value:A,issues:[]},J);if(Y instanceof Promise)throw new S4;if(Y.issues.length){let X=new(G?.Err??_)(Y.issues.map((Q)=>p9(Q,J,O9())));throw f6(X,G?.callee),X}return Y.value};var c6=(_)=>async(z,A,b,G)=>{let J=b?Object.assign(b,{async:!0}):{async:!0},Y=z._zod.run({value:A,issues:[]},J);if(Y instanceof Promise)Y=await Y;if(Y.issues.length){let X=new(G?.Err??_)(Y.issues.map((Q)=>p9(Q,J,O9())));throw f6(X,G?.callee),X}return Y.value};var uz=(_)=>(z,A,b)=>{let G=b?{...b,async:!1}:{async:!1},J=z._zod.run({value:A,issues:[]},G);if(J instanceof Promise)throw new S4;return J.issues.length?{success:!1,error:new(_??m6)(J.issues.map((Y)=>p9(Y,G,O9())))}:{success:!0,data:J.value}},cz=uz(Z2),lz=(_)=>async(z,A,b)=>{let G=b?Object.assign(b,{async:!0}):{async:!0},J=z._zod.run({value:A,issues:[]},G);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new _(J.issues.map((Y)=>p9(Y,G,O9())))}:{success:!0,data:J.value}},l6=lz(Z2),b$=(_)=>(z,A,b)=>{let G=b?Object.assign(b,{direction:"backward"}):{direction:"backward"};return u6(_)(z,A,G)};var G$=(_)=>(z,A,b)=>{return u6(_)(z,A,b)};var J$=(_)=>async(z,A,b)=>{let G=b?Object.assign(b,{direction:"backward"}):{direction:"backward"};return c6(_)(z,A,G)};var Y$=(_)=>async(z,A,b)=>{return c6(_)(z,A,b)};var X$=(_)=>(z,A,b)=>{let G=b?Object.assign(b,{direction:"backward"}):{direction:"backward"};return uz(_)(z,A,G)};var Q$=(_)=>(z,A,b)=>{return uz(_)(z,A,b)};var $$=(_)=>async(z,A,b)=>{let G=b?Object.assign(b,{direction:"backward"}):{direction:"backward"};return lz(_)(z,A,G)};var H$=(_)=>async(z,A,b)=>{return lz(_)(z,A,b)};var B$=/^[cC][^\s-]{8,}$/,Z$=/^[0-9a-z]+$/,F$=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,K$=/^[0-9a-vA-V]{20}$/,q$=/^[A-Za-z0-9]{27}$/,W$=/^[a-zA-Z0-9_-]{21}$/,V$=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var U$=/^([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})$/,F2=(_)=>{if(!_)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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${_}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var D$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Ik="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function M$(){return new RegExp(Ik,"u")}var N$=/^(?:(?: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])$/,w$=/^(([0-9a-fA-F]{1,4}:){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}|:))$/;var E$=/^((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])$/,O$=/^(([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])$/,L$=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,K2=/^[A-Za-z0-9_-]*$/;var j$=/^\+[1-9]\d{6,14}$/,R$="(?:(?:\\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])))",P$=new RegExp(`^${R$}$`);function S$(_){return typeof _.precision==="number"?_.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":_.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{${_.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function k$(_){return new RegExp(`^${S$(_)}$`)}function I$(_){let z=S$({precision:_.precision}),A=["Z"];if(_.local)A.push("");if(_.offset)A.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let b=`${z}(?:${A.join("|")})`;return new RegExp(`^${R$}T(?:${b})$`)}var x$=(_)=>{let z=_?`[\\s\\S]{${_?.minimum??0},${_?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${z}$`)};var T$=/^-?\d+$/,p6=/^-?\d+(?:\.\d+)?$/,C$=/^(?:true|false)$/i,v$=/^null$/i;var y$=/^[^A-Z]*$/,g$=/^[^a-z]*$/;var f0=E("$ZodCheck",(_,z)=>{var A;_._zod??(_._zod={}),_._zod.def=z,(A=_._zod).onattach??(A.onattach=[])}),f$={number:"number",bigint:"bigint",object:"date"},q2=E("$ZodCheckLessThan",(_,z)=>{f0.init(_,z);let A=f$[typeof z.value];_._zod.onattach.push((b)=>{let G=b._zod.bag,J=(z.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(z.value<J)if(z.inclusive)G.maximum=z.value;else G.exclusiveMaximum=z.value}),_._zod.check=(b)=>{if(z.inclusive?b.value<=z.value:b.value<z.value)return;b.issues.push({origin:A,code:"too_big",maximum:typeof z.value==="object"?z.value.getTime():z.value,input:b.value,inclusive:z.inclusive,inst:_,continue:!z.abort})}}),W2=E("$ZodCheckGreaterThan",(_,z)=>{f0.init(_,z);let A=f$[typeof z.value];_._zod.onattach.push((b)=>{let G=b._zod.bag,J=(z.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(z.value>J)if(z.inclusive)G.minimum=z.value;else G.exclusiveMinimum=z.value}),_._zod.check=(b)=>{if(z.inclusive?b.value>=z.value:b.value>z.value)return;b.issues.push({origin:A,code:"too_small",minimum:typeof z.value==="object"?z.value.getTime():z.value,input:b.value,inclusive:z.inclusive,inst:_,continue:!z.abort})}}),h$=E("$ZodCheckMultipleOf",(_,z)=>{f0.init(_,z),_._zod.onattach.push((A)=>{var b;(b=A._zod.bag).multipleOf??(b.multipleOf=z.value)}),_._zod.check=(A)=>{if(typeof A.value!==typeof z.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof A.value==="bigint"?A.value%z.value===BigInt(0):J2(A.value,z.value)===0)return;A.issues.push({origin:typeof A.value,code:"not_multiple_of",divisor:z.value,input:A.value,inst:_,continue:!z.abort})}}),m$=E("$ZodCheckNumberFormat",(_,z)=>{f0.init(_,z),z.format=z.format||"float64";let A=z.format?.includes("int"),b=A?"int":"number",[G,J]=H2[z.format];_._zod.onattach.push((Y)=>{let X=Y._zod.bag;if(X.format=z.format,X.minimum=G,X.maximum=J,A)X.pattern=T$}),_._zod.check=(Y)=>{let X=Y.value;if(A){if(!Number.isInteger(X)){Y.issues.push({expected:b,format:z.format,code:"invalid_type",continue:!1,input:X,inst:_});return}if(!Number.isSafeInteger(X)){if(X>0)Y.issues.push({input:X,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:_,origin:b,inclusive:!0,continue:!z.abort});else Y.issues.push({input:X,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:_,origin:b,inclusive:!0,continue:!z.abort});return}}if(X<G)Y.issues.push({origin:"number",input:X,code:"too_small",minimum:G,inclusive:!0,inst:_,continue:!z.abort});if(X>J)Y.issues.push({origin:"number",input:X,code:"too_big",maximum:J,inclusive:!0,inst:_,continue:!z.abort})}});var u$=E("$ZodCheckMaxLength",(_,z)=>{var A;f0.init(_,z),(A=_._zod.def).when??(A.when=(b)=>{let G=b.value;return!fz(G)&&G.length!==void 0}),_._zod.onattach.push((b)=>{let G=b._zod.bag.maximum??Number.POSITIVE_INFINITY;if(z.maximum<G)b._zod.bag.maximum=z.maximum}),_._zod.check=(b)=>{let G=b.value;if(G.length<=z.maximum)return;let Y=mz(G);b.issues.push({origin:Y,code:"too_big",maximum:z.maximum,inclusive:!0,input:G,inst:_,continue:!z.abort})}}),c$=E("$ZodCheckMinLength",(_,z)=>{var A;f0.init(_,z),(A=_._zod.def).when??(A.when=(b)=>{let G=b.value;return!fz(G)&&G.length!==void 0}),_._zod.onattach.push((b)=>{let G=b._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(z.minimum>G)b._zod.bag.minimum=z.minimum}),_._zod.check=(b)=>{let G=b.value;if(G.length>=z.minimum)return;let Y=mz(G);b.issues.push({origin:Y,code:"too_small",minimum:z.minimum,inclusive:!0,input:G,inst:_,continue:!z.abort})}}),l$=E("$ZodCheckLengthEquals",(_,z)=>{var A;f0.init(_,z),(A=_._zod.def).when??(A.when=(b)=>{let G=b.value;return!fz(G)&&G.length!==void 0}),_._zod.onattach.push((b)=>{let G=b._zod.bag;G.minimum=z.length,G.maximum=z.length,G.length=z.length}),_._zod.check=(b)=>{let G=b.value,J=G.length;if(J===z.length)return;let Y=mz(G),X=J>z.length;b.issues.push({origin:Y,...X?{code:"too_big",maximum:z.length}:{code:"too_small",minimum:z.length},inclusive:!0,exact:!0,input:b.value,inst:_,continue:!z.abort})}}),pz=E("$ZodCheckStringFormat",(_,z)=>{var A,b;if(f0.init(_,z),_._zod.onattach.push((G)=>{let J=G._zod.bag;if(J.format=z.format,z.pattern)J.patterns??(J.patterns=new Set),J.patterns.add(z.pattern)}),z.pattern)(A=_._zod).check??(A.check=(G)=>{if(z.pattern.lastIndex=0,z.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:z.format,input:G.value,...z.pattern?{pattern:z.pattern.toString()}:{},inst:_,continue:!z.abort})});else(b=_._zod).check??(b.check=()=>{})}),p$=E("$ZodCheckRegex",(_,z)=>{pz.init(_,z),_._zod.check=(A)=>{if(z.pattern.lastIndex=0,z.pattern.test(A.value))return;A.issues.push({origin:"string",code:"invalid_format",format:"regex",input:A.value,pattern:z.pattern.toString(),inst:_,continue:!z.abort})}}),d$=E("$ZodCheckLowerCase",(_,z)=>{z.pattern??(z.pattern=y$),pz.init(_,z)}),r$=E("$ZodCheckUpperCase",(_,z)=>{z.pattern??(z.pattern=g$),pz.init(_,z)}),n$=E("$ZodCheckIncludes",(_,z)=>{f0.init(_,z);let A=I4(z.includes),b=new RegExp(typeof z.position==="number"?`^.{${z.position}}${A}`:A);z.pattern=b,_._zod.onattach.push((G)=>{let J=G._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(b)}),_._zod.check=(G)=>{if(G.value.includes(z.includes,z.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:z.includes,input:G.value,inst:_,continue:!z.abort})}}),i$=E("$ZodCheckStartsWith",(_,z)=>{f0.init(_,z);let A=new RegExp(`^${I4(z.prefix)}.*`);z.pattern??(z.pattern=A),_._zod.onattach.push((b)=>{let G=b._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(A)}),_._zod.check=(b)=>{if(b.value.startsWith(z.prefix))return;b.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:z.prefix,input:b.value,inst:_,continue:!z.abort})}}),o$=E("$ZodCheckEndsWith",(_,z)=>{f0.init(_,z);let A=new RegExp(`.*${I4(z.suffix)}$`);z.pattern??(z.pattern=A),_._zod.onattach.push((b)=>{let G=b._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(A)}),_._zod.check=(b)=>{if(b.value.endsWith(z.suffix))return;b.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:z.suffix,input:b.value,inst:_,continue:!z.abort})}});var a$=E("$ZodCheckOverwrite",(_,z)=>{f0.init(_,z),_._zod.check=(A)=>{A.value=z.tx(A.value)}});class V2{constructor(_=[]){if(this.content=[],this.indent=0,this)this.args=_}indented(_){this.indent+=1,_(this),this.indent-=1}write(_){if(typeof _==="function"){_(this,{execution:"sync"}),_(this,{execution:"async"});return}let A=_.split(`
168
- `).filter((J)=>J),b=Math.min(...A.map((J)=>J.length-J.trimStart().length)),G=A.map((J)=>J.slice(b)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of G)this.content.push(J)}compile(){let _=Function,z=this?.args,b=[...(this?.content??[""]).map((G)=>` ${G}`)];return new _(...z,b.join(`
169
- `))}}var t$={major:4,minor:3,patch:5};var M0=E("$ZodType",(_,z)=>{var A;_??(_={}),_._zod.def=z,_._zod.bag=_._zod.bag||{},_._zod.version=t$;let b=[..._._zod.def.checks??[]];if(_._zod.traits.has("$ZodCheck"))b.unshift(_);for(let G of b)for(let J of G._zod.onattach)J(_);if(b.length===0)(A=_._zod).deferred??(A.deferred=[]),_._zod.deferred?.push(()=>{_._zod.run=_._zod.parse});else{let G=(Y,X,Q)=>{let $=z_(Y),H;for(let B of X){if(B._zod.def.when){if(!B._zod.def.when(Y))continue}else if($)continue;let Z=Y.issues.length,F=B._zod.check(Y);if(F instanceof Promise&&Q?.async===!1)throw new S4;if(H||F instanceof Promise)H=(H??Promise.resolve()).then(async()=>{if(await F,Y.issues.length===Z)return;if(!$)$=z_(Y,Z)});else{if(Y.issues.length===Z)continue;if(!$)$=z_(Y,Z)}}if(H)return H.then(()=>{return Y});return Y},J=(Y,X,Q)=>{if(z_(Y))return Y.aborted=!0,Y;let $=G(X,b,Q);if($ instanceof Promise){if(Q.async===!1)throw new S4;return $.then((H)=>_._zod.parse(H,Q))}return _._zod.parse($,Q)};_._zod.run=(Y,X)=>{if(X.skipChecks)return _._zod.parse(Y,X);if(X.direction==="backward"){let $=_._zod.parse({value:Y.value,issues:[]},{...X,skipChecks:!0});if($ instanceof Promise)return $.then((H)=>{return J(H,Y,X)});return J($,Y,X)}let Q=_._zod.parse(Y,X);if(Q instanceof Promise){if(X.async===!1)throw new S4;return Q.then(($)=>G($,b,X))}return G(Q,b,X)}}H0(_,"~standard",()=>({validate:(G)=>{try{let J=cz(_,G);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return l6(_,G).then((Y)=>Y.success?{value:Y.data}:{issues:Y.error?.issues})}},vendor:"zod",version:1}))}),i6=E("$ZodString",(_,z)=>{M0.init(_,z),_._zod.pattern=[..._?._zod.bag?.patterns??[]].pop()??x$(_._zod.bag),_._zod.parse=(A,b)=>{if(z.coerce)try{A.value=String(A.value)}catch(G){}if(typeof A.value==="string")return A;return A.issues.push({expected:"string",code:"invalid_type",input:A.value,inst:_}),A}}),N0=E("$ZodStringFormat",(_,z)=>{pz.init(_,z),i6.init(_,z)}),XH=E("$ZodGUID",(_,z)=>{z.pattern??(z.pattern=U$),N0.init(_,z)}),QH=E("$ZodUUID",(_,z)=>{if(z.version){let b={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[z.version];if(b===void 0)throw Error(`Invalid UUID version: "${z.version}"`);z.pattern??(z.pattern=F2(b))}else z.pattern??(z.pattern=F2());N0.init(_,z)}),$H=E("$ZodEmail",(_,z)=>{z.pattern??(z.pattern=D$),N0.init(_,z)}),HH=E("$ZodURL",(_,z)=>{N0.init(_,z),_._zod.check=(A)=>{try{let b=A.value.trim(),G=new URL(b);if(z.hostname){if(z.hostname.lastIndex=0,!z.hostname.test(G.hostname))A.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:z.hostname.source,input:A.value,inst:_,continue:!z.abort})}if(z.protocol){if(z.protocol.lastIndex=0,!z.protocol.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.protocol))A.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:z.protocol.source,input:A.value,inst:_,continue:!z.abort})}if(z.normalize)A.value=G.href;else A.value=b;return}catch(b){A.issues.push({code:"invalid_format",format:"url",input:A.value,inst:_,continue:!z.abort})}}}),BH=E("$ZodEmoji",(_,z)=>{z.pattern??(z.pattern=M$()),N0.init(_,z)}),ZH=E("$ZodNanoID",(_,z)=>{z.pattern??(z.pattern=W$),N0.init(_,z)}),FH=E("$ZodCUID",(_,z)=>{z.pattern??(z.pattern=B$),N0.init(_,z)}),KH=E("$ZodCUID2",(_,z)=>{z.pattern??(z.pattern=Z$),N0.init(_,z)}),qH=E("$ZodULID",(_,z)=>{z.pattern??(z.pattern=F$),N0.init(_,z)}),WH=E("$ZodXID",(_,z)=>{z.pattern??(z.pattern=K$),N0.init(_,z)}),VH=E("$ZodKSUID",(_,z)=>{z.pattern??(z.pattern=q$),N0.init(_,z)}),UH=E("$ZodISODateTime",(_,z)=>{z.pattern??(z.pattern=I$(z)),N0.init(_,z)}),DH=E("$ZodISODate",(_,z)=>{z.pattern??(z.pattern=P$),N0.init(_,z)}),MH=E("$ZodISOTime",(_,z)=>{z.pattern??(z.pattern=k$(z)),N0.init(_,z)}),NH=E("$ZodISODuration",(_,z)=>{z.pattern??(z.pattern=V$),N0.init(_,z)}),wH=E("$ZodIPv4",(_,z)=>{z.pattern??(z.pattern=N$),N0.init(_,z),_._zod.bag.format="ipv4"}),EH=E("$ZodIPv6",(_,z)=>{z.pattern??(z.pattern=w$),N0.init(_,z),_._zod.bag.format="ipv6",_._zod.check=(A)=>{try{new URL(`http://[${A.value}]`)}catch{A.issues.push({code:"invalid_format",format:"ipv6",input:A.value,inst:_,continue:!z.abort})}}});var OH=E("$ZodCIDRv4",(_,z)=>{z.pattern??(z.pattern=E$),N0.init(_,z)}),LH=E("$ZodCIDRv6",(_,z)=>{z.pattern??(z.pattern=O$),N0.init(_,z),_._zod.check=(A)=>{let b=A.value.split("/");try{if(b.length!==2)throw Error();let[G,J]=b;if(!J)throw Error();let Y=Number(J);if(`${Y}`!==J)throw Error();if(Y<0||Y>128)throw Error();new URL(`http://[${G}]`)}catch{A.issues.push({code:"invalid_format",format:"cidrv6",input:A.value,inst:_,continue:!z.abort})}}});function jH(_){if(_==="")return!0;if(_.length%4!==0)return!1;try{return atob(_),!0}catch{return!1}}var RH=E("$ZodBase64",(_,z)=>{z.pattern??(z.pattern=L$),N0.init(_,z),_._zod.bag.contentEncoding="base64",_._zod.check=(A)=>{if(jH(A.value))return;A.issues.push({code:"invalid_format",format:"base64",input:A.value,inst:_,continue:!z.abort})}});function Ck(_){if(!K2.test(_))return!1;let z=_.replace(/[-_]/g,(b)=>b==="-"?"+":"/"),A=z.padEnd(Math.ceil(z.length/4)*4,"=");return jH(A)}var PH=E("$ZodBase64URL",(_,z)=>{z.pattern??(z.pattern=K2),N0.init(_,z),_._zod.bag.contentEncoding="base64url",_._zod.check=(A)=>{if(Ck(A.value))return;A.issues.push({code:"invalid_format",format:"base64url",input:A.value,inst:_,continue:!z.abort})}}),SH=E("$ZodE164",(_,z)=>{z.pattern??(z.pattern=j$),N0.init(_,z)});function vk(_,z=null){try{let A=_.split(".");if(A.length!==3)return!1;let[b]=A;if(!b)return!1;let G=JSON.parse(atob(b));if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(z&&(!("alg"in G)||G.alg!==z))return!1;return!0}catch{return!1}}var kH=E("$ZodJWT",(_,z)=>{N0.init(_,z),_._zod.check=(A)=>{if(vk(A.value,z.alg))return;A.issues.push({code:"invalid_format",format:"jwt",input:A.value,inst:_,continue:!z.abort})}});var D2=E("$ZodNumber",(_,z)=>{M0.init(_,z),_._zod.pattern=_._zod.bag.pattern??p6,_._zod.parse=(A,b)=>{if(z.coerce)try{A.value=Number(A.value)}catch(Y){}let G=A.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return A;let J=typeof G==="number"?Number.isNaN(G)?"NaN":!Number.isFinite(G)?"Infinity":void 0:void 0;return A.issues.push({expected:"number",code:"invalid_type",input:G,inst:_,...J?{received:J}:{}}),A}}),IH=E("$ZodNumberFormat",(_,z)=>{m$.init(_,z),D2.init(_,z)}),xH=E("$ZodBoolean",(_,z)=>{M0.init(_,z),_._zod.pattern=C$,_._zod.parse=(A,b)=>{if(z.coerce)try{A.value=Boolean(A.value)}catch(J){}let G=A.value;if(typeof G==="boolean")return A;return A.issues.push({expected:"boolean",code:"invalid_type",input:G,inst:_}),A}});var TH=E("$ZodNull",(_,z)=>{M0.init(_,z),_._zod.pattern=v$,_._zod.values=new Set([null]),_._zod.parse=(A,b)=>{let G=A.value;if(G===null)return A;return A.issues.push({expected:"null",code:"invalid_type",input:G,inst:_}),A}});var CH=E("$ZodUnknown",(_,z)=>{M0.init(_,z),_._zod.parse=(A)=>A}),vH=E("$ZodNever",(_,z)=>{M0.init(_,z),_._zod.parse=(A,b)=>{return A.issues.push({expected:"never",code:"invalid_type",input:A.value,inst:_}),A}});function e$(_,z,A){if(_.issues.length)z.issues.push(...x4(A,_.issues));z.value[A]=_.value}var yH=E("$ZodArray",(_,z)=>{M0.init(_,z),_._zod.parse=(A,b)=>{let G=A.value;if(!Array.isArray(G))return A.issues.push({expected:"array",code:"invalid_type",input:G,inst:_}),A;A.value=Array(G.length);let J=[];for(let Y=0;Y<G.length;Y++){let X=G[Y],Q=z.element._zod.run({value:X,issues:[]},b);if(Q instanceof Promise)J.push(Q.then(($)=>e$($,A,Y)));else e$(Q,A,Y)}if(J.length)return Promise.all(J).then(()=>A);return A}});function n6(_,z,A,b,G){if(_.issues.length){if(G&&!(A in b))return;z.issues.push(...x4(A,_.issues))}if(_.value===void 0){if(A in b)z.value[A]=void 0}else z.value[A]=_.value}function gH(_){let z=Object.keys(_.shape);for(let b of z)if(!_.shape?.[b]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${b}": expected a Zod schema`);let A=$2(_.shape);return{..._,keys:z,keySet:new Set(z),numKeys:z.length,optionalKeys:new Set(A)}}function fH(_,z,A,b,G,J){let Y=[],X=G.keySet,Q=G.catchall._zod,$=Q.def.type,H=Q.optout==="optional";for(let B in z){if(X.has(B))continue;if($==="never"){Y.push(B);continue}let Z=Q.run({value:z[B],issues:[]},b);if(Z instanceof Promise)_.push(Z.then((F)=>n6(F,A,B,z,H)));else n6(Z,A,B,z,H)}if(Y.length)A.issues.push({code:"unrecognized_keys",keys:Y,input:z,inst:J});if(!_.length)return A;return Promise.all(_).then(()=>{return A})}var yk=E("$ZodObject",(_,z)=>{if(M0.init(_,z),!Object.getOwnPropertyDescriptor(z,"shape")?.get){let X=z.shape;Object.defineProperty(z,"shape",{get:()=>{let Q={...X};return Object.defineProperty(z,"shape",{value:Q}),Q}})}let b=I1(()=>gH(z));H0(_._zod,"propValues",()=>{let X=z.shape,Q={};for(let $ in X){let H=X[$]._zod;if(H.values){Q[$]??(Q[$]=new Set);for(let B of H.values)Q[$].add(B)}}return Q});let G=x_,J=z.catchall,Y;_._zod.parse=(X,Q)=>{Y??(Y=b.value);let $=X.value;if(!G($))return X.issues.push({expected:"object",code:"invalid_type",input:$,inst:_}),X;X.value={};let H=[],B=Y.shape;for(let Z of Y.keys){let F=B[Z],K=F._zod.optout==="optional",q=F._zod.run({value:$[Z],issues:[]},Q);if(q instanceof Promise)H.push(q.then((W)=>n6(W,X,Z,$,K)));else n6(q,X,Z,$,K)}if(!J)return H.length?Promise.all(H).then(()=>X):X;return fH(H,$,X,Q,b.value,_)}}),hH=E("$ZodObjectJIT",(_,z)=>{yk.init(_,z);let A=_._zod.parse,b=I1(()=>gH(z)),G=(Z)=>{let F=new V2(["shape","payload","ctx"]),K=b.value,q=(O)=>{let M=g6(O);return`shape[${M}]._zod.run({ value: input[${M}], issues: [] }, ctx)`};F.write("const input = payload.value;");let W=Object.create(null),V=0;for(let O of K.keys)W[O]=`key_${V++}`;F.write("const newResult = {};");for(let O of K.keys){let M=W[O],P=g6(O),L=Z[O]?._zod?.optout==="optional";if(F.write(`const ${M} = ${q(O)};`),L)F.write(`
158
+ ${J}`,X=[{regex:/(\s--message=)"([^"]*)"/,quote:'"',equalsForm:!0},{regex:/(\s--message=)'([^']*)'/,quote:"'",equalsForm:!0},{regex:/(\s(?:-m|--message|-am))\s+"([^"]*)"/,quote:'"',equalsForm:!1},{regex:/(\s(?:-m|--message|-am))\s+'([^']*)'/,quote:"'",equalsForm:!1},{regex:/(\s--message=)([^\s"'][^\s]*)(\s|$)/,quote:'"',equalsForm:!0,unquoted:!0},{regex:/(\s(?:-m|--message|-am))\s+([^\s"'-][^\s]*)(\s|$)/,quote:'"',equalsForm:!1,unquoted:!0}];for(let{regex:b,quote:Q,equalsForm:$,unquoted:H}of X){let B=_.match(b);if(B){let Z=B[1],q=B[2],F=B[3]||"";if(H&&$)return _.replace(b,`${Z}${Q}${q}${Y}${Q}${F}`);if(H)return _.replace(b,`${Z} ${Q}${q}${Y}${Q}${F}`);if($)return _.replace(b,`${Z}${Q}${q}${Y}${Q}`);return _.replace(b,`${Z} ${Q}${q}${Y}${Q}`)}}return _}function m_(_){let z=new RegExp(Qk.source,"g"),A=[..._.matchAll(z)];if(A.length===0)return;return A[A.length-1][1]}function J_(_){let z=_.match(/\[[\w/-]+(?:\s+\([^)]+\))?\s+([a-f0-9]{7,40})\]/);return z?z[1]:void 0}function Y_(_){let z=_.match(/\[[\w/-]+(?:\s+\([^)]+\))?\s+[a-f0-9]{7,40}\]\s+(.+)/);return z?z[1].trim():void 0}function X_(_){let z=_.match(/\[([\w/-]+)(?:\s+\([^)]+\))?\s+[a-f0-9]{7,40}\]/);return z?z[1]:void 0}async function b_(_){let z=await f9();if(z.length===0){j.warn("Commit tracking skipped: no authenticated environments",{transcriptId:_.transcriptId.substring(0,8)});return}for(let A of z)try{let G=new AbortController,J=setTimeout(()=>G.abort(),5000),Y=await fetch(new URL("/api/commit-track",A.baseURL),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${A.token}`},body:JSON.stringify({transcript_id:_.transcriptId,repo_path:_.repoPath,timestamp:_.timestamp,commit_sha:_.commitSha,commit_title:_.commitTitle,branch:_.branch}),signal:G.signal});if(clearTimeout(J),!Y.ok){j.warn(`Commit tracking to ${A.name} failed`,{transcriptId:_.transcriptId.substring(0,8),status:Y.status});continue}j.info(`Commit tracked (${A.name})`,{transcriptId:_.transcriptId.substring(0,8)})}catch(G){if(G instanceof Error&&G.name==="AbortError"){j.warn(`Commit tracking to ${A.name} timed out`,{transcriptId:_.transcriptId.substring(0,8)});continue}j.error(`Commit tracking to ${A.name} error`,{transcriptId:_.transcriptId.substring(0,8),error:G instanceof Error?G.message:String(G)})}}var Zk=2048;function Q_(){return new Promise((_,z)=>{let A="";process.stdin.setEncoding("utf8"),process.stdin.on("data",(G)=>{A+=G}),process.stdin.on("end",()=>{_({preview:A.slice(0,Zk),full:A})}),process.stdin.on("error",(G)=>z(G))})}async function gQ(){let _=Date.now(),z,A;try{let{preview:G,full:J}=await Q_();if(j.info(`Hook invoked (stdin: ${J.length} bytes)`),!J.trim())j.warn("Hook received empty stdin - ignoring"),process.exit(0);let Y=G.includes('"PreToolUse"'),X=G.includes("git")&&G.includes("commit");if(Y&&!X){let $={hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}};process.stdout.write(JSON.stringify($));let H=Date.now()-_;j.info(`Hook completed: PreToolUse (fast path, ${H}ms)`),process.exit(0)}let b;try{b=JSON.parse(J)}catch($){j.error("Hook failed to parse stdin JSON",{error:$ instanceof Error?$.message:$}),process.exit(1)}if(z=b.hook_event_name,A=b.session_id||"unknown",!z)j.error("Hook missing event name",{sessionId:A}),process.exit(1);if(j.info(`Hook: ${z} (session: ${A.substring(0,8)}...)`),z==="PreToolUse")await Kk(b);else if(z==="PostToolUse")await Wk(b);else if(z==="SessionEnd")await Vk(b);else if(z==="Stop")await Uk(b);else j.debug(`Hook: skipping unsupported event ${z}`);let Q=Date.now()-_;j.info(`Hook completed: ${z} (${Q}ms)`,{sessionId:A.substring(0,8)}),process.exit(0)}catch(G){let J=Date.now()-_;j.error(`Hook failed: ${z||"unknown"} (${J}ms)`,{sessionId:A?.substring(0,8),error:G instanceof Error?G.message:String(G)}),process.exit(1)}}function fQ(_){if(_.tool_input&&typeof _.tool_input==="object"&&typeof _.tool_input.command==="string")return{command:_.tool_input.command,updateCommand:(z)=>{if(_.tool_input)_.tool_input.command=z}};if(typeof _.command==="string")return{command:_.command,updateCommand:(z)=>{_.command=z}};return{command:void 0,updateCommand:()=>{}}}function qk(_){if(_.tool_response?.stdout)return _.tool_response.stdout;if(_.tool_response)return JSON.stringify(_.tool_response);return}function Fk(_){if(typeof _.repo_path==="string")return _.repo_path;if(typeof _.cwd==="string")return _.cwd;return""}async function Kk(_){let z=_.session_id||"unknown",A=!1,G=!1,{command:J,updateCommand:Y}=fQ(_),X=typeof _.tool_name==="string"?_.tool_name:_.tool,b=X?X.toLowerCase()==="bash":Boolean(J),Q=typeof _.cwd==="string"?_.cwd:void 0,$=await h0(Q),H=L9($);if(b&&J&&x4(J)&&H){A=!0;let Z=await j9(z),q=await S1(),F=k1(J,Z,q);if(F!==J)Y(F),G=!0}let B=G?{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow",updatedInput:_.tool_input}}:{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}};if(process.stdout.write(JSON.stringify(B)),A)await Dk({sessionId:z,transcriptPath:_.transcript_path,cwd:typeof _.cwd==="string"?_.cwd:void 0});j.info("PreToolUse handled",{sessionId:z.substring(0,8),shouldTrack:A,modified:G})}async function Wk(_){let z=_.session_id||"unknown",A=Fk(_),{command:G}=fQ(_);if(!G||!x4(G))return;let J=m_(G);if(!J){j.debug("PostToolUse: git commit without agentlogs link",{sessionId:z.substring(0,8)});return}let Y=qk(_),X=Y?J_(Y):void 0,b=Y?Y_(Y):void 0,Q=Y?X_(Y):void 0;await b_({transcriptId:J,repoPath:A,timestamp:new Date().toISOString(),commitSha:X,commitTitle:b,branch:Q}),j.info("PostToolUse: tracked commit",{sessionId:z.substring(0,8),transcriptId:J,commitSha:X?.substring(0,8)})}async function Vk(_){let z=_.transcript_path,A=_.session_id||"unknown";if(!z){j.error("SessionEnd: missing transcript_path",{sessionId:A});return}try{let G=await I4({transcriptPath:z,sessionId:_.session_id,cwdOverride:_.cwd});if(G.results.length===0){if(!G.anySuccess)j.info("SessionEnd: upload skipped (repo not allowed or no auth)",{sessionId:A});return}for(let J of G.results)if(J.success)j.info(`SessionEnd: uploaded to ${J.envName} (${G.eventCount} events)`,{transcriptId:J.transcriptId,sessionId:A.substring(0,8)});else j.error(`SessionEnd: upload to ${J.envName} failed`,{sessionId:A,error:J.error})}catch(G){j.error("SessionEnd: upload error",{sessionId:A,error:G instanceof Error?G.message:String(G)})}}async function Uk(_){let z=_.transcript_path,A=_.session_id||"unknown";if(!z){j.error("Stop: missing transcript_path",{sessionId:A});return}if(_.stop_hook_active){j.debug("Stop: skipped (stop_hook_active=true)",{sessionId:A});return}try{let G=await I4({transcriptPath:z,sessionId:_.session_id,cwdOverride:_.cwd});if(G.results.length===0){if(!G.anySuccess)j.info("Stop: upload skipped (repo not allowed or no auth)",{sessionId:A});return}for(let J of G.results)if(J.success)j.info(`Stop: uploaded to ${J.envName} (${G.eventCount} events)`,{transcriptId:J.transcriptId,sessionId:A.substring(0,8)});else j.error(`Stop: upload to ${J.envName} failed`,{sessionId:A,error:J.error})}catch(G){j.error("Stop: upload error",{sessionId:A,error:G instanceof Error?G.message:String(G)})}}async function Dk(_){if(!_.transcriptPath){j.warn("Partial upload skipped: missing transcript_path",{sessionId:_.sessionId.substring(0,8)});return}try{let z=await I4({transcriptPath:_.transcriptPath,sessionId:_.sessionId,cwdOverride:_.cwd});if(z.results.length===0){if(!z.anySuccess)j.info("Partial upload: skipped (repo not allowed or no auth)",{sessionId:_.sessionId.substring(0,8)});return}for(let A of z.results)if(A.success)j.info(`Partial upload: uploaded to ${A.envName}`,{transcriptId:A.transcriptId,sessionId:_.sessionId.substring(0,8),eventCount:z.eventCount});else j.error(`Partial upload: to ${A.envName} failed`,{sessionId:_.sessionId.substring(0,8),error:A.error})}catch(z){j.error("Partial upload: error",{sessionId:_.sessionId.substring(0,8),error:z instanceof Error?z.message:String(z)})}}import{createHash as Mk}from"crypto";import{promises as y6}from"fs";import{homedir as Nk}from"os";import{basename as Ek,extname as wk,join as g6,relative as Ok,resolve as Lk}from"path";var jk=g6(Nk(),".claude");async function hQ(_={}){let{repoFilter:z,claudeDir:A}=_,G=await f9();if(G.length===0)console.error("You must be logged in to sync transcripts."),console.error("Run `agentlogs login agentlogs.ai` to authenticate"),process.exit(1);let J=A?Lk(A):process.env.CLAUDE_HOME??jk,Y=g6(J,"projects"),X=await Pk(Y);if(X.length===0){console.log(`No local Claude Code transcripts were found under ${Y}. Nothing to sync.`);return}let b=z?X.filter(($)=>$.repoId===z):X;if(z&&b.length===0){let $=X.filter((H)=>H.repoId===null).length;if(console.log(`No local Claude Code transcripts matched repo ${z}.`),$>0)console.log(`${$} transcript(s) were skipped because their repo could not be determined.`);return}let Q=G.map(($)=>$.name).join(", ");console.log(`Syncing to environments: ${Q}`),console.log(`Found ${b.length} local transcript(s)
159
+ `);for(let $ of G)await Rk($,b,z)}async function Rk(_,z,A){let G=_.name;console.log(`
160
+ --- ${G} (${_.baseURL}) ---`);try{let J=await Pb({serverUrl:_.baseURL,authToken:_.token}),Y=A?J.filter((q)=>q.repoId===A):J,X=new Map;for(let q of Y)X.set(q.transcriptId,q.sha256);let b=z.filter((q)=>{let F=X.get(q.transcriptId);return!F||F!==q.sha256});if(b.length===0){console.log("All local transcripts are up to date.");return}console.log(`Uploading ${b.length} transcript(s)...`);let Q=0,$=0,H=0,B=[];for(let[q,F]of b.entries()){let K=`${q+1}/${b.length}`,W=F.repoId?` • ${F.repoId}`:"",V=`${F.transcriptId} – ${F.displayPath}${W}`;try{let N=await SQ({transcriptPath:F.path,sessionId:F.transcriptId,cwdOverride:F.cwd??void 0},{serverUrl:_.baseURL,authToken:_.token});if(N.skipped)$+=1,console.log(`[${K}] - ${V} • skipped (repo not allowed)`);else if(N.success)Q+=1,console.log(`[${K}] ✓ ${V} • ${N.eventCount} events${N.transcriptId?` → ${N.transcriptId}`:""}`);else{H+=1;let L="Upload returned unsuccessful response.";console.error(`[${K}] ✗ ${V} • ${L}`),B.push({transcriptId:F.transcriptId,displayPath:F.displayPath,reason:L})}}catch(N){H+=1;let L=N instanceof Error?N.message:String(N);console.error(`[${K}] ✗ ${V} • ${L}`),B.push({transcriptId:F.transcriptId,displayPath:F.displayPath,reason:L})}}let Z=$>0?`, ${$} skipped`:"";if(console.log(`Sync complete: ${Q} uploaded, ${H} failed${Z}.`),B.length>0){console.error("Failed transcript details:");for(let q of B.slice(0,10))console.error(` - ${q.transcriptId} (${q.displayPath}): ${q.reason}`);if(B.length>10)console.error(` …and ${B.length-10} more failures.`)}}catch(J){console.error(`Error syncing to ${G}: ${J instanceof Error?J.message:String(J)}`)}}async function Pk(_){if(!await mQ(_))return[];let z=await y6.readdir(_,{withFileTypes:!0}),A=[],J=await new I0().fetchModelPricing(),Y=Object.fromEntries(J);for(let X of z){if(!X.isDirectory())continue;let b=g6(_,X.name),Q=await y6.readdir(b,{withFileTypes:!0});for(let $ of Q){if(!$.isFile()||wk($.name)!==".jsonl")continue;let H=g6(b,$.name),B=Ek($.name,".jsonl");try{let Z=await y6.readFile(H,"utf8"),q=kk(Z),F=await xk(q),K=Sk(Z),W=Ik(K),V=q?await C0(q,W):null,N=B6(K,{pricing:Y,gitContext:V});if(!N){console.warn(`Skipped transcript at ${H}: Could not convert to unified format`);continue}let L=y_(N.transcript),M=JSON.stringify(L),k=Mk("sha256").update(M).digest("hex");A.push({transcriptId:B,path:H,sha256:k,cwd:q,repoId:F,displayPath:Ok(_,H)||$.name})}catch(Z){console.warn(`Skipped transcript at ${H}: ${Z.message}`)}}}return A}async function mQ(_){try{return(await y6.stat(_)).isDirectory()}catch{return!1}}function Sk(_){let z=_.split(/\r?\n/),A=[];for(let G of z){let J=G.trim();if(!J)continue;try{let Y=JSON.parse(J);if(typeof Y==="object"&&Y!==null)A.push(Y)}catch{continue}}return A}function kk(_){let z=_.split(/\r?\n/);for(let A of z){let G=A.trim();if(!G)continue;try{let Y=JSON.parse(G)?.cwd;if(typeof Y==="string"&&Y.length>0)return Y}catch{continue}}return null}function Ik(_){for(let z of _){let A=typeof z.gitBranch==="string"?z.gitBranch.trim():"";if(A)return A}return}async function xk(_){if(!_)return null;if(!await mQ(_))return null;try{return Ab(_).repoId}catch{return null}}async function f6(_,z="claude-code"){if(!_)console.error("The upload command expects a <transcript> argument."),process.exit(1);let A=kQ(_);if(!A)console.error(`Transcript file not found for path: ${_}`),process.exit(1);let G=await f9();if(G.length===0)console.error("You must be logged in to upload transcripts."),console.error("Run `agentlogs login agentlogs.ai` to authenticate"),process.exit(1);let J=z==="codex"?"Codex":"Claude Code",Y=G.map((X)=>X.name).join(", ");console.log(`Uploading ${J} transcript from ${A}`),console.log(`Target environments: ${Y}`);try{let X=await I4({transcriptPath:A,source:z});if(X.results.length===0){console.log(""),console.log("- Upload skipped (repo not allowed by allowlist)"),console.log(" Use `agentlogs allow` to enable uploads for this repo.");return}console.log("");for(let b of X.results){let Q=b.envName;if(b.success){if(console.log(`✓ ${Q}: uploaded successfully`),b.id)console.log(` ID: ${b.id}`);if(b.transcriptId)console.log(` Transcript ID: ${b.transcriptId}`)}else if(console.log(`✗ ${Q}: upload failed`),b.error)console.log(` Error: ${b.error}`)}if(console.log(""),X.allSuccess)console.log(`✓ Upload complete (${X.eventCount} events)`);else if(X.anySuccess)console.log(`⚠ Partial upload (${X.eventCount} events) - some environments failed`),process.exit(1);else console.error("✗ Upload failed for all environments"),process.exit(1)}catch(X){console.error(X instanceof Error?X.message:"Unexpected error occurred while uploading transcript."),process.exit(1)}}async function uQ(_){await f6(_,"claude-code")}import{existsSync as cQ,readFileSync as lQ}from"fs";import{join as h6}from"path";import{homedir as Tk}from"os";var Ck=h6(Tk(),".cline","data","tasks");async function pQ(){let _=Date.now(),z,A;try{let{preview:G,full:J}=await Q_();if(j.info(`Cline hook invoked (stdin: ${J.length} bytes)`),!J.trim())j.warn("Cline hook received empty stdin - ignoring"),I1(),process.exit(0);let Y=G.includes('"PostToolUse"'),X=G.includes("git")&&G.includes("commit");if(Y&&!X){I1();let $=Date.now()-_;j.info(`Cline hook completed: PostToolUse (fast path, ${$}ms)`),process.exit(0)}let b;try{b=JSON.parse(J)}catch($){j.error("Cline hook failed to parse stdin JSON",{error:$ instanceof Error?$.message:$}),I1(),process.exit(1)}if(z=b.hookName,A=b.taskId,!z)j.error("Cline hook missing hookName",{taskId:A}),I1(),process.exit(1);if(j.info(`Cline hook: ${z} (task: ${A})`),z==="PostToolUse")await vk(b);else if(z==="TaskComplete"||z==="TaskCancel")await yk(b);else j.debug(`Cline hook: skipping unsupported event ${z}`);I1();let Q=Date.now()-_;j.info(`Cline hook completed: ${z} (${Q}ms)`,{taskId:A}),process.exit(0)}catch(G){let J=Date.now()-_;j.error(`Cline hook failed: ${z||"unknown"} (${J}ms)`,{taskId:A,error:G instanceof Error?G.message:String(G)}),I1(),process.exit(1)}}async function vk(_){let{taskId:z,postToolUse:A,workspaceRoots:G}=_;if(!A)return;let{toolName:J,parameters:Y,result:X}=A;if(J!=="execute_command")return;let b=typeof Y.command==="string"?Y.command:void 0;if(!b||!x4(b))return;if(!X)return;let Q=G?.[0],$=await h0(Q);if(!L9($)){j.debug("PostToolUse: repo not allowed",{taskId:z});return}let H=await j9(z),B=J_(X),Z=Y_(X),q=X_(X);if(!B){j.debug("PostToolUse: no commit SHA found in output",{taskId:z});return}await b_({transcriptId:H,repoPath:Q||"",timestamp:new Date().toISOString(),commitSha:B,commitTitle:Z,branch:q}),j.info("PostToolUse: tracked commit",{taskId:z,transcriptId:H.substring(0,8),commitSha:B.substring(0,8)})}async function yk(_){let{taskId:z,workspaceRoots:A}=_,G=h6(Ck,z),J=h6(G,"api_conversation_history.json");if(!cQ(J)){j.error("TaskEnd: conversation file not found",{taskId:z,path:J});return}let Y;try{Y=JSON.parse(lQ(J,"utf-8"))}catch(V){j.error("TaskEnd: failed to parse conversation file",{taskId:z,error:V instanceof Error?V.message:String(V)});return}let X,b=h6(G,"task_metadata.json");if(cQ(b))try{X=JSON.parse(lQ(b,"utf-8"))}catch{}let Q=A?.[0]||process.cwd(),H=await new I0().fetchModelPricing(),B=Object.fromEntries(H),Z=await C0(Q,void 0),q=X?.environment_history?.[0]?.cline_version,F=x_(Y,{pricing:B,gitContext:Z,cwd:Q,taskId:z,metadata:X,clientVersion:q});if(!F){j.error("TaskEnd: failed to convert transcript",{taskId:z});return}let K=[];for(let[V,N]of F.blobs)K.push({sha256:V,data:new Uint8Array(N.data),mediaType:N.mediaType});let W=await u0({unifiedTranscript:F.transcript,sessionId:z,cwd:Q,rawTranscript:JSON.stringify(Y),blobs:K.length>0?K:void 0});if(W.skipped){j.info("TaskEnd: skipped (repo not allowed)",{taskId:z});return}if(W.anySuccess&&W.id){for(let V of W.results)if(V.success)j.info(`TaskEnd: uploaded to ${V.envName}`,{taskId:z,transcriptId:W.id.substring(0,8)});else if(V.error)j.error(`TaskEnd: upload to ${V.envName} failed`,{taskId:z,error:V.error})}else for(let V of W.results)if(!V.success&&V.error)j.error("TaskEnd: upload failed",{taskId:z,env:V.envName,error:V.error})}function I1(){process.stdout.write(JSON.stringify({cancel:!1}))}import{existsSync as gk,mkdirSync as fk,writeFileSync as dQ,chmodSync as hk,readFileSync as mk}from"fs";import{join as nQ}from"node:path";import{homedir as uk}from"node:os";var q2=nQ(uk(),"Documents","Cline","Hooks"),F2="# agentlogs-managed";function rQ(_){if(_==="PostToolUse")return`#!/usr/bin/env bash
161
+ ${F2}
162
+ input=$(cat)
163
+ echo "$input" | npx agentlogs cline hook 2>/dev/null
164
+ echo '{"cancel": false}'
165
+ `;return`#!/usr/bin/env bash
166
+ ${F2}
167
+ input=$(cat)
168
+ echo "$input" | npx agentlogs cline hook &>/dev/null &
169
+ echo '{"cancel": false}'
170
+ `}var ck=[{name:"PostToolUse",description:"Track git commits in agentlogs"},{name:"TaskComplete",description:"Upload transcript when a Cline task completes"},{name:"TaskCancel",description:"Upload transcript when a Cline task is cancelled"}];async function iQ(){console.log("Setting up agentlogs hooks for Cline..."),console.log(`Hooks directory: ${q2}`),console.log(""),fk(q2,{recursive:!0});let _=0,z=0;for(let A of ck){let G=nQ(q2,A.name);if(gk(G))if(mk(G,"utf-8").includes(F2))dQ(G,rQ(A.name),{mode:493}),console.log(` Updated: ${A.name}`),_++;else console.log(` Skipped: ${A.name} (existing hook not managed by agentlogs)`),z++;else dQ(G,rQ(A.name),{mode:493}),hk(G,493),console.log(` Created: ${A.name}`),_++}if(console.log(""),_>0)console.log(`Installed ${_} hook(s).`);if(z>0)console.log(`Skipped ${z} hook(s) with existing non-agentlogs content.`);console.log(""),console.log("Cline will now auto-upload transcripts and track commits."),console.log("Run `agentlogs status` to verify you are logged in.")}import{existsSync as C4,readFileSync as K2,readdirSync as oQ,statSync as aQ}from"fs";import{join as $_,basename as lk}from"path";import{homedir as sQ}from"os";var T4=$_(sQ(),".cline","data","tasks");function pk(_){if(!C4(_))return null;try{let z=K2(_,"utf-8"),A=JSON.parse(z),G,J=$_(_,"..","task_metadata.json");if(C4(J))try{G=JSON.parse(K2(J,"utf-8"))}catch{}return{messages:A,metadata:G}}catch{return null}}function dk(_){let z=$_(T4,_),A=$_(z,"api_conversation_history.json");if(C4(A))return A;if(!C4(T4))return null;for(let G of oQ(T4))if(G.includes(_)){let J=$_(T4,G,"api_conversation_history.json");if(C4(J))return J}return null}function rk(_=10){let z=[];if(!C4(T4))return z;for(let A of oQ(T4)){let G=$_(T4,A,"api_conversation_history.json");if(!C4(G))continue;try{let J=aQ(G),Y="",b=K2(G,"utf-8").match(/<task>\n?([\s\S]*?)\n?<\/task>/);if(b&&b[1])Y=b[1].trim().slice(0,60);z.push({path:G,id:A,mtime:J.mtime,preview:Y})}catch{}}return z.sort((A,G)=>G.mtime.getTime()-A.mtime.getTime()),z.slice(0,_)}async function tQ(_){if(!_){console.log("Recent Cline tasks:"),console.log("");let K=rk(10);if(K.length===0)console.log("No tasks found in",T4),process.exit(1);for(let W of K){let V=W.mtime.toLocaleString();if(console.log(` ${W.id.substring(0,13)}... ${V}`),W.preview)console.log(` ${W.preview}`);console.log("")}console.log("Usage: agentlogs cline upload <task-id-or-path>"),process.exit(0)}let z,A=_.startsWith("~")?_.replace(/^~/,sQ()):_;if(C4(A))if(aQ(A).isDirectory()){let W=$_(A,"api_conversation_history.json");if(C4(W))z=W;else console.error(`Error: No api_conversation_history.json found in: ${A}`),process.exit(1)}else z=A;else{let K=dk(_);if(!K)console.error(`Error: Task not found: ${_}`),console.error(`Searched in: ${T4}`),process.exit(1);z=K}let G=lk($_(z,".."));console.log(`Uploading Cline task: ${G}`);let J=pk(z);if(!J)console.error(`Error: Failed to read task file: ${z}`),process.exit(1);let Y=J.messages.length;console.log(`Task: ${G} (${Y} messages)`);let b=await new I0().fetchModelPricing(),Q=Object.fromEntries(b),$=process.cwd(),H=await C0($,void 0);if(H?.repo)console.log(`Repository: ${H.repo}`);let B=J.metadata?.environment_history?.[0]?.cline_version;console.log("Converting transcript...");let Z=x_(J.messages,{pricing:Q,gitContext:H,cwd:$,taskId:G,metadata:J.metadata,clientVersion:B});if(!Z)console.error("Error: Failed to convert transcript"),process.exit(1);let q=[];for(let[K,W]of Z.blobs)q.push({sha256:K,data:new Uint8Array(W.data),mediaType:W.mediaType});console.log("Uploading...");let F=await u0({unifiedTranscript:Z.transcript,sessionId:G,cwd:$,rawTranscript:JSON.stringify(J.messages),blobs:q.length>0?q:void 0});if(F.skipped)console.log("Skipped: Repository not in allowlist"),process.exit(0);if(F.anySuccess&&F.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${F.id}`);for(let K of F.results)if(K.success){let W=`${K.baseURL}/s/${F.id}`;console.log(`View: ${W}`)}}else{console.error(""),console.error("Upload failed:");for(let K of F.results)if(!K.success&&K.error)console.error(` ${K.envName}: ${K.error}`);process.exit(1)}}async function eQ(_){await f6(_,"codex")}import{spawnSync as nk}from"child_process";function ik(_){try{let z=nk("opencode",["export",_],{encoding:"utf-8",timeout:30000,stdio:["pipe","pipe","pipe"]});if(z.status!==0||z.error)return null;let A=z.stdout.trim();if(!A)return null;return JSON.parse(A)}catch{return null}}async function _$(_){if(!_)console.error("Error: Session ID is required"),process.exit(1);console.log(`Uploading OpenCode session: ${_}`);let z=ik(_);if(!z)console.error(`Error: Session not found: ${_}`),console.error("Run 'opencode session list' to see available sessions"),process.exit(1);if(z.info.parentID)console.log("Skipping subagent session"),process.exit(0);let A=z.info.title||"Untitled",G=z.messages?.length??0;console.log(`Session: "${A}" (${G} messages)`);let Y=await new I0().fetchModelPricing(),X=Object.fromEntries(Y),b=z.info.directory??process.cwd(),Q=await C0(b,void 0);if(Q?.repo)console.log(`Repository: ${Q.repo}`);console.log("Converting transcript...");let $=C_(z,{pricing:X,gitContext:Q,cwd:b});if(!$)console.error("Error: Failed to convert transcript"),process.exit(1);console.log("Uploading...");let H=await u0({unifiedTranscript:$,sessionId:_,cwd:b,rawTranscript:JSON.stringify(z)});if(H.skipped)console.log("Skipped: Repository not in allowlist"),process.exit(0);if(H.anySuccess&&H.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${H.id}`);for(let B of H.results)if(B.success){let Z=`${B.baseURL}/app/logs/${H.id}`;console.log(`View: ${Z}`)}}else{console.error(""),console.error("Upload failed:");for(let B of H.results)if(!B.success&&B.error)console.error(` ${B.envName}: ${B.error}`);process.exit(1)}}import{spawnSync as ok}from"child_process";async function z$(){let _=Date.now(),z,A;try{let{preview:G,full:J}=await Q_();if(j.info(`OpenCode hook invoked (stdin: ${J.length} bytes)`),!J.trim())j.warn("OpenCode hook received empty stdin - ignoring"),Z4({modified:!1}),process.exit(0);let Y=G.includes("tool.execute.before"),X=G.includes("git")&&G.includes("commit");if(Y&&!X){Z4({modified:!1});let $=Date.now()-_;j.info(`OpenCode hook completed: tool.execute.before (fast path, ${$}ms)`),process.exit(0)}let b;try{b=JSON.parse(J)}catch($){j.error("OpenCode hook failed to parse stdin JSON",{error:$ instanceof Error?$.message:$}),Z4({modified:!1}),process.exit(1)}if(z=b.hook_event_name,A=b.session_id||"unknown",!z)j.error("OpenCode hook missing event name",{sessionId:A}),Z4({modified:!1}),process.exit(1);if(j.info(`OpenCode hook: ${z} (session: ${A.substring(0,8)}...)`),z==="tool.execute.before")await ak(b);else if(z==="tool.execute.after")await sk(b),Z4({modified:!1});else if(z==="session.idle")await tk(b),Z4({modified:!1});else j.debug(`OpenCode hook: skipping unsupported event ${z}`),Z4({modified:!1});let Q=Date.now()-_;j.info(`OpenCode hook completed: ${z} (${Q}ms)`,{sessionId:A.substring(0,8)}),process.exit(0)}catch(G){let J=Date.now()-_;j.error(`OpenCode hook failed: ${z||"unknown"} (${J}ms)`,{sessionId:A?.substring(0,8),error:G instanceof Error?G.message:String(G)}),Z4({modified:!1}),process.exit(1)}}function Z4(_){process.stdout.write(JSON.stringify(_))}async function ak(_){let{session_id:z,call_id:A}=_,G=_.tool||"",J=_.tool_input||{},Y=typeof J.command==="string"?J.command:"",X=_.cwd,b=G==="bash",Q=await h0(X),$=L9(Q);if(b&&x4(Y)&&$){let H=await j9(z),B=await S1(),Z=k1(Y,H,B);if(Z!==Y){if(j.info("OpenCode hook: intercepting git commit",{sessionId:z.substring(0,8),transcriptId:H,callId:A}),A)await Kz(A,H);await ek(z,X),Z4({modified:!0,args:{...J,command:Z}});return}}Z4({modified:!1})}async function sk(_){let{session_id:z,call_id:A}=_,G=_.tool||"",J=_.tool_output||{},Y=_.cwd||"";if(G!=="bash")return;let b=J.output||"",Q=m_(b),$=!1;if(!Q&&A)Q=await Wz(A),$=!0;if(!Q)return;if(A)await Vz(A);let H=J_(b),B=Y_(b),Z=X_(b);if(!H){j.debug("OpenCode PostToolUse: found link but no commit SHA",{sessionId:z.substring(0,8),transcriptId:Q,fromCache:$});return}await b_({transcriptId:Q,repoPath:Y,timestamp:new Date().toISOString(),commitSha:H,commitTitle:B,branch:Z}),j.info("OpenCode PostToolUse: tracked commit",{sessionId:z.substring(0,8),transcriptId:Q,commitSha:H.substring(0,8),fromCache:$})}async function tk(_){let{session_id:z,cwd:A}=_;j.info("OpenCode session.idle: uploading transcript",{sessionId:z.substring(0,8)}),await _I(z,A)}function A$(_){try{let z=ok("opencode",["export",_],{encoding:"utf-8",timeout:30000,stdio:["pipe","pipe","pipe"]});if(z.status!==0||z.error)return j.warn("OpenCode export failed",{sessionId:_.substring(0,8),error:z.error?.message||z.stderr}),null;let A=z.stdout.trim();if(!A)return null;return JSON.parse(A)}catch(z){return j.error("OpenCode export error",{sessionId:_.substring(0,8),error:z instanceof Error?z.message:String(z)}),null}}async function ek(_,z){let A=A$(_);if(!A){j.warn("OpenCode partial upload: session not found",{sessionId:_.substring(0,8)});return}await G$(A,_,z,"partial")}async function _I(_,z){let A=A$(_);if(!A){j.warn("OpenCode full upload: session not found",{sessionId:_.substring(0,8)});return}if(A.info.parentID){j.debug("OpenCode full upload: skipping subagent session",{sessionId:_.substring(0,8)});return}await G$(A,_,z,"full")}async function G$(_,z,A,G="full"){try{let Y=await new I0().fetchModelPricing(),X=Object.fromEntries(Y),b=A||_.info.directory||process.cwd(),Q=await C0(b,void 0),$=C_(_,{pricing:X,gitContext:Q,cwd:b});if(!$){j.error(`OpenCode ${G} upload: failed to convert transcript`,{sessionId:z.substring(0,8)});return}let H=await u0({unifiedTranscript:$,sessionId:z,cwd:b,rawTranscript:JSON.stringify(_)});if(H.skipped){j.info(`OpenCode ${G} upload: skipped (repo not allowed)`,{sessionId:z.substring(0,8)});return}for(let B of H.results)if(B.success)j.info(`OpenCode ${G} upload: success (${B.envName})`,{sessionId:z.substring(0,8),transcriptId:H.id});else j.error(`OpenCode ${G} upload: failed (${B.envName})`,{sessionId:z.substring(0,8),error:B.error})}catch(J){j.error(`OpenCode ${G} upload: error`,{sessionId:z.substring(0,8),error:J instanceof Error?J.message:String(J)})}}import{existsSync as T1,readFileSync as W2,readdirSync as m6}from"fs";import{join as x1,basename as zI}from"path";import{homedir as J$}from"os";var H_=x1(J$(),".pi","agent","sessions");function AI(_){if(!T1(_))return null;let A=W2(_,"utf-8").split(`
171
+ `).filter((Y)=>Y.trim());if(A.length===0)return null;let G=JSON.parse(A[0]),J=[];for(let Y=1;Y<A.length;Y++)try{J.push(JSON.parse(A[Y]))}catch{}return{header:G,entries:J}}function GI(_){if(!T1(H_))return null;for(let z of m6(H_)){let A=x1(H_,z);if(!T1(A))continue;for(let G of m6(A)){if(!G.endsWith(".jsonl"))continue;if(G.includes(_))return x1(A,G);let J=x1(A,G);try{let Y=W2(J,"utf-8").split(`
172
+ `)[0];if(JSON.parse(Y).id===_)return J}catch{}}}return null}function JI(_=10){let z=[];if(!T1(H_))return z;for(let A of m6(H_)){let G=x1(H_,A);if(!T1(G))continue;for(let J of m6(G)){if(!J.endsWith(".jsonl"))continue;let Y=x1(G,J);try{let X=W2(Y,"utf-8").split(`
173
+ `)[0],b=JSON.parse(X);z.push({path:Y,id:b.id,timestamp:b.timestamp,cwd:b.cwd})}catch{}}}return z.sort((A,G)=>G.timestamp.localeCompare(A.timestamp)),z.slice(0,_)}async function Y$(_){if(!_){console.log("Recent Pi sessions:"),console.log("");let q=JI(10);if(q.length===0)console.log("No sessions found in",H_),process.exit(1);for(let F of q){let W=new Date(F.timestamp).toLocaleString();console.log(` ${F.id.substring(0,8)}... ${W}`),console.log(` ${F.cwd}`),console.log("")}console.log("Usage: agentlogs pi upload <session-id-or-path>"),process.exit(0)}let z,A=_.startsWith("~")?_.replace(/^~/,J$()):_;if(T1(A))z=A;else{let q=GI(_);if(!q)console.error(`Error: Session not found: ${_}`),console.error(`Searched in: ${H_}`),process.exit(1);z=q}console.log(`Uploading Pi session: ${zI(z)}`);let G=AI(z);if(!G)console.error(`Error: Failed to read session file: ${z}`),process.exit(1);let J=G.entries.filter((q)=>q.type==="message").length;console.log(`Session: ${G.header.id.substring(0,8)}... (${J} messages)`);let X=await new I0().fetchModelPricing(),b=Object.fromEntries(X),Q=G.header.cwd??process.cwd(),$=await C0(Q,void 0);if($?.repo)console.log(`Repository: ${$.repo}`);console.log("Converting transcript...");let H=v_(G,{pricing:b,gitContext:$,cwd:Q});if(!H)console.error("Error: Failed to convert transcript"),process.exit(1);let B=[];for(let[q,F]of H.blobs)B.push({sha256:q,data:new Uint8Array(F.data),mediaType:F.mediaType});console.log("Uploading...");let Z=await u0({unifiedTranscript:H.transcript,sessionId:G.header.id,cwd:Q,rawTranscript:JSON.stringify(G),blobs:B.length>0?B:void 0});if(Z.skipped)console.log("Skipped: Repository not in allowlist"),process.exit(0);if(Z.anySuccess&&Z.id){console.log(""),console.log("Upload successful!"),console.log(`Transcript ID: ${Z.id}`);for(let q of Z.results)if(q.success){let F=`${q.baseURL}/app/logs/${Z.id}`;console.log(`View: ${F}`)}}else{console.error(""),console.error("Upload failed:");for(let q of Z.results)if(!q.success&&q.error)console.error(` ${q.envName}: ${q.error}`);process.exit(1)}}import{existsSync as YI,readFileSync as XI}from"fs";async function X$(){let _=Date.now(),z,A;try{let{preview:G,full:J}=await Q_();if(j.info(`Pi hook invoked (stdin: ${J.length} bytes)`),!J.trim())j.warn("Pi hook received empty stdin - ignoring"),d9({modified:!1}),process.exit(0);let Y=G.includes("tool_call")&&!G.includes("tool_call_id"),X=G.includes("git")&&G.includes("commit");if(Y&&!X){d9({modified:!1});let $=Date.now()-_;j.info(`Pi hook completed: tool_call (fast path, ${$}ms)`),process.exit(0)}let b;try{b=JSON.parse(J)}catch($){j.error("Pi hook failed to parse stdin JSON",{error:$ instanceof Error?$.message:$}),d9({modified:!1}),process.exit(1)}if(z=b.hook_event_name,A=b.session_id||"unknown",!z)j.error("Pi hook missing event name",{sessionId:A}),d9({modified:!1}),process.exit(1);if(j.info(`Pi hook: ${z} (session: ${A.substring(0,8)}...)`),z==="tool_call")await bI(b);else if(z==="tool_result")await QI(b),d9({modified:!1});else if(z==="session_shutdown")await $I(b),d9({modified:!1});else if(z==="agent_end")await HI(b),d9({modified:!1});else j.debug(`Pi hook: skipping unsupported event ${z}`),d9({modified:!1});let Q=Date.now()-_;j.info(`Pi hook completed: ${z} (${Q}ms)`,{sessionId:A.substring(0,8)}),process.exit(0)}catch(G){let J=Date.now()-_;j.error(`Pi hook failed: ${z||"unknown"} (${J}ms)`,{sessionId:A?.substring(0,8),error:G instanceof Error?G.message:String(G)}),d9({modified:!1}),process.exit(1)}}function d9(_){process.stdout.write(JSON.stringify(_))}async function bI(_){let{session_id:z,tool_call_id:A}=_,G=_.tool||"",J=_.tool_input||{},Y=typeof J.command==="string"?J.command:"",X=_.cwd,b=G.toLowerCase()==="bash",Q=await h0(X),$=L9(Q);if(b&&x4(Y)&&$){let H=await j9(z),B=await S1(),Z=k1(Y,H,B);if(Z!==Y){if(j.info("Pi hook: intercepting git commit",{sessionId:z.substring(0,8),transcriptId:H,toolCallId:A}),A)await Kz(A,H);await BI(_),d9({modified:!0,updatedInput:{...J,command:Z}});return}}d9({modified:!1})}async function QI(_){let{session_id:z,tool_call_id:A}=_,G=_.tool||"",J=_.tool_output||{},Y=_.cwd||"";if(G.toLowerCase()!=="bash")return;let b=J.stdout||J.content||"",Q=typeof b==="string"?b:JSON.stringify(b),$=m_(Q),H=!1;if(!$&&A)$=await Wz(A),H=!0;if(!$)return;if(A)await Vz(A);let B=J_(Q),Z=Y_(Q),q=X_(Q);if(!B){j.debug("Pi tool_result: found link but no commit SHA",{sessionId:z.substring(0,8),transcriptId:$,fromCache:H});return}await b_({transcriptId:$,repoPath:Y,timestamp:new Date().toISOString(),commitSha:B,commitTitle:Z,branch:q}),j.info("Pi tool_result: tracked commit",{sessionId:z.substring(0,8),transcriptId:$,commitSha:B.substring(0,8),fromCache:H})}async function $I(_){let z=_.session_id;j.info("Pi session_shutdown: uploading transcript",{sessionId:z.substring(0,8)}),await Q$(_)}async function HI(_){let z=_.session_id;j.info("Pi agent_end: uploading transcript",{sessionId:z.substring(0,8)}),await Q$(_)}function b$(_){if(!YI(_))return null;try{let A=XI(_,"utf-8").split(`
174
+ `).filter((Y)=>Y.trim());if(A.length===0)return null;let G=JSON.parse(A[0]),J=[];for(let Y=1;Y<A.length;Y++)try{J.push(JSON.parse(A[Y]))}catch{}return{header:G,entries:J}}catch(z){return j.error("Pi: failed to read session file",{sessionFile:_,error:z instanceof Error?z.message:String(z)}),null}}async function BI(_){let{session_id:z,cwd:A,session_data:G}=_;if(!G&&_.session_file)G=b$(_.session_file)??void 0;if(!G){j.warn("Pi partial upload: no session data available",{sessionId:z.substring(0,8)});return}await $$(G,z,A,_.leaf_id,"partial")}async function Q$(_){let{session_id:z,cwd:A,session_data:G}=_;if(!G&&_.session_file)G=b$(_.session_file)??void 0;if(!G){j.warn("Pi full upload: no session data available",{sessionId:z.substring(0,8)});return}await $$(G,z,A,_.leaf_id,"full")}async function $$(_,z,A,G,J="full"){try{let X=await new I0().fetchModelPricing(),b=Object.fromEntries(X),Q=A||_.header.cwd||process.cwd(),$=await C0(Q,void 0),H=v_(_,{pricing:b,gitContext:$,cwd:Q,leafId:G});if(!H){j.error(`Pi ${J} upload: failed to convert transcript`,{sessionId:z.substring(0,8)});return}let B=await u0({unifiedTranscript:H.transcript,sessionId:z,cwd:Q,rawTranscript:JSON.stringify(_)});if(B.skipped){j.info(`Pi ${J} upload: skipped (repo not allowed)`,{sessionId:z.substring(0,8)});return}for(let Z of B.results)if(Z.success)j.info(`Pi ${J} upload: success (${Z.envName})`,{sessionId:z.substring(0,8),transcriptId:B.id});else j.error(`Pi ${J} upload: failed (${Z.envName})`,{sessionId:z.substring(0,8),error:Z.error})}catch(Y){j.error(`Pi ${J} upload: error`,{sessionId:z.substring(0,8),error:Y instanceof Error?Y.message:String(Y)})}}import{spawn as KI}from"child_process";import{existsSync as u6,readFileSync as K$}from"fs";import{createInterface as WI}from"readline";import{dirname as VI,resolve as q$}from"path";import{fileURLToPath as UI}from"url";import{homedir as V2}from"os";import{join as v4}from"path";var C1=v4(V2(),".agentlogs"),v1=v4(C1,"service.pid"),H$=v4(C1,"service.sock"),B$=v4(C1,"service.log"),ZI=v4(V2(),".codex"),S90=v4(ZI,"sessions"),qI=v4(V2(),".cline"),k90=v4(qI,"data","tasks"),y1=v4(C1,"watcher-events.log");import{createServer as T90,connect as FI}from"net";function u_(){return new Promise((_,z)=>{let A=FI(H$);A.on("connect",()=>{_(A)}),A.on("error",(G)=>{z(G)})})}function mz(_,z){_.write(JSON.stringify(z)+`
175
+ `)}function Z$(_,z,A=5000){return new Promise((G,J)=>{let Y="",X=setTimeout(()=>{J(Error("Timeout waiting for response"))},A),b=(Q)=>{Y+=Q.toString();let $=Y.split(`
176
+ `);Y=$.pop()||"";for(let H of $){if(!H.trim())continue;try{let B=JSON.parse(H);if(B.type===z)clearTimeout(X),_.off("data",b),G(B.data)}catch{}}};_.on("data",b)})}var DI=UI(import.meta.url),F$=VI(DI);function c6(){if(!u6(v1))return{running:!1};try{let _=parseInt(K$(v1,"utf-8").trim());return process.kill(_,0),{running:!0,pid:_}}catch{return{running:!1}}}async function W$(){let _=c6();if(_.running){console.log(`Service already running (PID: ${_.pid})`);return}let z=q$(F$,"../../service/server.ts"),A=q$(F$,"../../service/server.js"),G=u6(z)?z:A;if(!u6(G))console.error(`Service script not found at ${G}`),process.exit(1);let J=KI("bun",["run",G],{detached:!0,stdio:"ignore",env:{...process.env}});J.unref(),console.log(`Service starting (PID: ${J.pid})...`);let Y=50;for(let X=0;X<Y;X++)try{(await u_()).end(),console.log("Service ready");return}catch{await new Promise((b)=>setTimeout(b,100))}console.error("Service failed to start. Check logs:"),console.error(` tail -f ${B$}`),process.exit(1)}async function V$(){let _=c6();if(!_.running){console.log("Service is not running");return}try{let z=await u_();if(mz(z,{type:"shutdown"}),z.end(),console.log("Shutdown signal sent"),await new Promise((G)=>setTimeout(G,1000)),c6().running)process.kill(_.pid,"SIGTERM"),console.log(`Sent SIGTERM to PID ${_.pid}`)}catch{if(_.pid)process.kill(_.pid,"SIGTERM"),console.log(`Sent SIGTERM to PID ${_.pid}`)}}async function U$(){let _=c6();if(!_.running){console.log("Service: not running");return}console.log(`Service: running (PID: ${_.pid})`);try{let z=await u_();mz(z,{type:"status"});let A=await Z$(z,"status_response");if(z.end(),console.log(`Connections: ${A.connections}`),console.log(`Watching: ${A.watching}`),console.log(`Uptime: ${Math.round(A.uptime/1000)}s`),A.lastEvent){let G=Math.round((Date.now()-A.lastEvent.timestamp)/1000);console.log(`Last event: ${A.lastEvent.type} (${G}s ago)`),console.log(` Path: ${A.lastEvent.path}`)}}catch{console.log("Could not connect to service for status")}}async function D$(){if(!u6(y1)){console.log("No watcher logs yet"),console.log(`Log file: ${y1}`);return}console.log(`Tailing ${y1} (Ctrl+C to stop)
177
+ `);let A=K$(y1,"utf-8").trim().split(`
178
+ `).slice(-20);for(let X of A)try{let b=JSON.parse(X),Q=new Date(b.timestamp).toISOString();console.log(`[${Q}] ${b.type}: ${b.path}`)}catch{console.log(X)}let{spawn:G}=await import("child_process"),J=G("tail",["-f",y1],{stdio:["ignore","pipe","inherit"]});WI({input:J.stdout}).on("line",(X)=>{try{let b=JSON.parse(X),Q=new Date(b.timestamp).toISOString();console.log(`[${Q}] ${b.type}: ${b.path}`)}catch{console.log(X)}}),await new Promise(()=>{})}import{spawn as sc}from"child_process";import{existsSync as hG,readFileSync as tc,appendFileSync as ec}from"fs";import{dirname as _l,resolve as mG}from"path";import{fileURLToPath as zl}from"url";var p90=Object.freeze({status:"aborted"});function w(_,z,A){function G(b,Q){if(!b._zod)Object.defineProperty(b,"_zod",{value:{def:Q,constr:X,traits:new Set},enumerable:!1});if(b._zod.traits.has(_))return;b._zod.traits.add(_),z(b,Q);let $=X.prototype,H=Object.keys($);for(let B=0;B<H.length;B++){let Z=H[B];if(!(Z in b))b[Z]=$[Z].bind(b)}}let J=A?.Parent??Object;class Y extends J{}Object.defineProperty(Y,"name",{value:_});function X(b){var Q;let $=A?.Parent?new Y:this;G($,b),(Q=$._zod).deferred??(Q.deferred=[]);for(let H of $._zod.deferred)H();return $}return Object.defineProperty(X,"init",{value:G}),Object.defineProperty(X,Symbol.hasInstance,{value:(b)=>{if(A?.Parent&&b instanceof A.Parent)return!0;return b?._zod?.traits?.has(_)}}),Object.defineProperty(X,"name",{value:_}),X}var d90=Symbol("zod_brand");class y4 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class uz extends Error{constructor(_){super(`Encountered unidirectional transform during encode: ${_}`);this.name="ZodEncodeError"}}var l6={};function S9(_){if(_)Object.assign(l6,_);return l6}var b0={};qA(b0,{unwrapMessage:()=>cz,uint8ArrayToHex:()=>pI,uint8ArrayToBase64url:()=>cI,uint8ArrayToBase64:()=>j$,stringifyPrimitive:()=>n6,slugify:()=>M2,shallowClone:()=>N$,safeExtend:()=>yI,required:()=>hI,randomString:()=>SI,propertyKeyTypes:()=>E2,promiseAllObject:()=>PI,primitiveTypes:()=>E$,prefixIssues:()=>h4,pick:()=>TI,partial:()=>fI,parsedType:()=>L2,optionalKeys:()=>w2,omit:()=>CI,objectClone:()=>LI,numKeys:()=>kI,nullish:()=>pz,normalizeParams:()=>c,mergeDefs:()=>g4,merge:()=>gI,jsonStringifyReplacer:()=>g1,joinValues:()=>p6,issue:()=>h1,isPlainObject:()=>Z_,isObject:()=>c_,hexToUint8Array:()=>lI,getSizableOrigin:()=>O$,getParsedType:()=>II,getLengthableOrigin:()=>rz,getEnumValues:()=>lz,getElementAtPath:()=>RI,floatSafeRemainder:()=>D2,finalizeIssue:()=>n9,extend:()=>vI,escapeRegex:()=>f4,esc:()=>d6,defineLazy:()=>H0,createTransparentProxy:()=>xI,cloneDef:()=>jI,clone:()=>r9,cleanRegex:()=>dz,cleanEnum:()=>mI,captureStackTrace:()=>r6,cached:()=>f1,base64urlToUint8Array:()=>uI,base64ToUint8Array:()=>L$,assignProp:()=>B_,assertNotEqual:()=>NI,assertNever:()=>wI,assertIs:()=>EI,assertEqual:()=>MI,assert:()=>OI,allowsEval:()=>N2,aborted:()=>q_,NUMBER_FORMAT_RANGES:()=>O2,Class:()=>R$,BIGINT_FORMAT_RANGES:()=>w$});function MI(_){return _}function NI(_){return _}function EI(_){}function wI(_){throw Error("Unexpected value in exhaustive check")}function OI(_){}function lz(_){let z=Object.values(_).filter((G)=>typeof G==="number");return Object.entries(_).filter(([G,J])=>z.indexOf(+G)===-1).map(([G,J])=>J)}function p6(_,z="|"){return _.map((A)=>n6(A)).join(z)}function g1(_,z){if(typeof z==="bigint")return z.toString();return z}function f1(_){return{get value(){{let A=_();return Object.defineProperty(this,"value",{value:A}),A}throw Error("cached value already set")}}}function pz(_){return _===null||_===void 0}function dz(_){let z=_.startsWith("^")?1:0,A=_.endsWith("$")?_.length-1:_.length;return _.slice(z,A)}function D2(_,z){let A=(_.toString().split(".")[1]||"").length,G=z.toString(),J=(G.split(".")[1]||"").length;if(J===0&&/\d?e-\d?/.test(G)){let Q=G.match(/\d?e-(\d?)/);if(Q?.[1])J=Number.parseInt(Q[1])}let Y=A>J?A:J,X=Number.parseInt(_.toFixed(Y).replace(".","")),b=Number.parseInt(z.toFixed(Y).replace(".",""));return X%b/10**Y}var M$=Symbol("evaluating");function H0(_,z,A){let G=void 0;Object.defineProperty(_,z,{get(){if(G===M$)return;if(G===void 0)G=M$,G=A();return G},set(J){Object.defineProperty(_,z,{value:J})},configurable:!0})}function LI(_){return Object.create(Object.getPrototypeOf(_),Object.getOwnPropertyDescriptors(_))}function B_(_,z,A){Object.defineProperty(_,z,{value:A,writable:!0,enumerable:!0,configurable:!0})}function g4(..._){let z={};for(let A of _){let G=Object.getOwnPropertyDescriptors(A);Object.assign(z,G)}return Object.defineProperties({},z)}function jI(_){return g4(_._zod.def)}function RI(_,z){if(!z)return _;return z.reduce((A,G)=>A?.[G],_)}function PI(_){let z=Object.keys(_),A=z.map((G)=>_[G]);return Promise.all(A).then((G)=>{let J={};for(let Y=0;Y<z.length;Y++)J[z[Y]]=G[Y];return J})}function SI(_=10){let A="";for(let G=0;G<_;G++)A+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return A}function d6(_){return JSON.stringify(_)}function M2(_){return _.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var r6="captureStackTrace"in Error?Error.captureStackTrace:(..._)=>{};function c_(_){return typeof _==="object"&&_!==null&&!Array.isArray(_)}var N2=f1(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(_){return!1}});function Z_(_){if(c_(_)===!1)return!1;let z=_.constructor;if(z===void 0)return!0;if(typeof z!=="function")return!0;let A=z.prototype;if(c_(A)===!1)return!1;if(Object.prototype.hasOwnProperty.call(A,"isPrototypeOf")===!1)return!1;return!0}function N$(_){if(Z_(_))return{..._};if(Array.isArray(_))return[..._];return _}function kI(_){let z=0;for(let A in _)if(Object.prototype.hasOwnProperty.call(_,A))z++;return z}var II=(_)=>{let z=typeof _;switch(z){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(_)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(_))return"array";if(_===null)return"null";if(_.then&&typeof _.then==="function"&&_.catch&&typeof _.catch==="function")return"promise";if(typeof Map<"u"&&_ instanceof Map)return"map";if(typeof Set<"u"&&_ instanceof Set)return"set";if(typeof Date<"u"&&_ instanceof Date)return"date";if(typeof File<"u"&&_ instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${z}`)}},E2=new Set(["string","number","symbol"]),E$=new Set(["string","number","bigint","boolean","symbol","undefined"]);function f4(_){return _.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r9(_,z,A){let G=new _._zod.constr(z??_._zod.def);if(!z||A?.parent)G._zod.parent=_;return G}function c(_){let z=_;if(!z)return{};if(typeof z==="string")return{error:()=>z};if(z?.message!==void 0){if(z?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");z.error=z.message}if(delete z.message,typeof z.error==="string")return{...z,error:()=>z.error};return z}function xI(_){let z;return new Proxy({},{get(A,G,J){return z??(z=_()),Reflect.get(z,G,J)},set(A,G,J,Y){return z??(z=_()),Reflect.set(z,G,J,Y)},has(A,G){return z??(z=_()),Reflect.has(z,G)},deleteProperty(A,G){return z??(z=_()),Reflect.deleteProperty(z,G)},ownKeys(A){return z??(z=_()),Reflect.ownKeys(z)},getOwnPropertyDescriptor(A,G){return z??(z=_()),Reflect.getOwnPropertyDescriptor(z,G)},defineProperty(A,G,J){return z??(z=_()),Reflect.defineProperty(z,G,J)}})}function n6(_){if(typeof _==="bigint")return _.toString()+"n";if(typeof _==="string")return`"${_}"`;return`${_}`}function w2(_){return Object.keys(_).filter((z)=>{return _[z]._zod.optin==="optional"&&_[z]._zod.optout==="optional"})}var O2={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]},w$={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function TI(_,z){let A=_._zod.def,G=A.checks;if(G&&G.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let Y=g4(_._zod.def,{get shape(){let X={};for(let b in z){if(!(b in A.shape))throw Error(`Unrecognized key: "${b}"`);if(!z[b])continue;X[b]=A.shape[b]}return B_(this,"shape",X),X},checks:[]});return r9(_,Y)}function CI(_,z){let A=_._zod.def,G=A.checks;if(G&&G.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let Y=g4(_._zod.def,{get shape(){let X={..._._zod.def.shape};for(let b in z){if(!(b in A.shape))throw Error(`Unrecognized key: "${b}"`);if(!z[b])continue;delete X[b]}return B_(this,"shape",X),X},checks:[]});return r9(_,Y)}function vI(_,z){if(!Z_(z))throw Error("Invalid input to extend: expected a plain object");let A=_._zod.def.checks;if(A&&A.length>0){let Y=_._zod.def.shape;for(let X in z)if(Object.getOwnPropertyDescriptor(Y,X)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let J=g4(_._zod.def,{get shape(){let Y={..._._zod.def.shape,...z};return B_(this,"shape",Y),Y}});return r9(_,J)}function yI(_,z){if(!Z_(z))throw Error("Invalid input to safeExtend: expected a plain object");let A=g4(_._zod.def,{get shape(){let G={..._._zod.def.shape,...z};return B_(this,"shape",G),G}});return r9(_,A)}function gI(_,z){let A=g4(_._zod.def,{get shape(){let G={..._._zod.def.shape,...z._zod.def.shape};return B_(this,"shape",G),G},get catchall(){return z._zod.def.catchall},checks:[]});return r9(_,A)}function fI(_,z,A){let J=z._zod.def.checks;if(J&&J.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let X=g4(z._zod.def,{get shape(){let b=z._zod.def.shape,Q={...b};if(A)for(let $ in A){if(!($ in b))throw Error(`Unrecognized key: "${$}"`);if(!A[$])continue;Q[$]=_?new _({type:"optional",innerType:b[$]}):b[$]}else for(let $ in b)Q[$]=_?new _({type:"optional",innerType:b[$]}):b[$];return B_(this,"shape",Q),Q},checks:[]});return r9(z,X)}function hI(_,z,A){let G=g4(z._zod.def,{get shape(){let J=z._zod.def.shape,Y={...J};if(A)for(let X in A){if(!(X in Y))throw Error(`Unrecognized key: "${X}"`);if(!A[X])continue;Y[X]=new _({type:"nonoptional",innerType:J[X]})}else for(let X in J)Y[X]=new _({type:"nonoptional",innerType:J[X]});return B_(this,"shape",Y),Y}});return r9(z,G)}function q_(_,z=0){if(_.aborted===!0)return!0;for(let A=z;A<_.issues.length;A++)if(_.issues[A]?.continue!==!0)return!0;return!1}function h4(_,z){return z.map((A)=>{var G;return(G=A).path??(G.path=[]),A.path.unshift(_),A})}function cz(_){return typeof _==="string"?_:_?.message}function n9(_,z,A){let G={..._,path:_.path??[]};if(!_.message){let J=cz(_.inst?._zod.def?.error?.(_))??cz(z?.error?.(_))??cz(A.customError?.(_))??cz(A.localeError?.(_))??"Invalid input";G.message=J}if(delete G.inst,delete G.continue,!z?.reportInput)delete G.input;return G}function O$(_){if(_ instanceof Set)return"set";if(_ instanceof Map)return"map";if(_ instanceof File)return"file";return"unknown"}function rz(_){if(Array.isArray(_))return"array";if(typeof _==="string")return"string";return"unknown"}function L2(_){let z=typeof _;switch(z){case"number":return Number.isNaN(_)?"nan":"number";case"object":{if(_===null)return"null";if(Array.isArray(_))return"array";let A=_;if(A&&Object.getPrototypeOf(A)!==Object.prototype&&"constructor"in A&&A.constructor)return A.constructor.name}}return z}function h1(..._){let[z,A,G]=_;if(typeof z==="string")return{message:z,code:"custom",input:A,inst:G};return{...z}}function mI(_){return Object.entries(_).filter(([z,A])=>{return Number.isNaN(Number.parseInt(z,10))}).map((z)=>z[1])}function L$(_){let z=atob(_),A=new Uint8Array(z.length);for(let G=0;G<z.length;G++)A[G]=z.charCodeAt(G);return A}function j$(_){let z="";for(let A=0;A<_.length;A++)z+=String.fromCharCode(_[A]);return btoa(z)}function uI(_){let z=_.replace(/-/g,"+").replace(/_/g,"/"),A="=".repeat((4-z.length%4)%4);return L$(z+A)}function cI(_){return j$(_).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function lI(_){let z=_.replace(/^0x/,"");if(z.length%2!==0)throw Error("Invalid hex string length");let A=new Uint8Array(z.length/2);for(let G=0;G<z.length;G+=2)A[G/2]=Number.parseInt(z.slice(G,G+2),16);return A}function pI(_){return Array.from(_).map((z)=>z.toString(16).padStart(2,"0")).join("")}class R${constructor(..._){}}var P$=(_,z)=>{_.name="$ZodError",Object.defineProperty(_,"_zod",{value:_._zod,enumerable:!1}),Object.defineProperty(_,"issues",{value:z,enumerable:!1}),_.message=JSON.stringify(z,g1,2),Object.defineProperty(_,"toString",{value:()=>_.message,enumerable:!1})},i6=w("$ZodError",P$),j2=w("$ZodError",P$,{Parent:Error});function S$(_,z=(A)=>A.message){let A={},G=[];for(let J of _.issues)if(J.path.length>0)A[J.path[0]]=A[J.path[0]]||[],A[J.path[0]].push(z(J));else G.push(z(J));return{formErrors:G,fieldErrors:A}}function k$(_,z=(A)=>A.message){let A={_errors:[]},G=(J)=>{for(let Y of J.issues)if(Y.code==="invalid_union"&&Y.errors.length)Y.errors.map((X)=>G({issues:X}));else if(Y.code==="invalid_key")G({issues:Y.issues});else if(Y.code==="invalid_element")G({issues:Y.issues});else if(Y.path.length===0)A._errors.push(z(Y));else{let X=A,b=0;while(b<Y.path.length){let Q=Y.path[b];if(b!==Y.path.length-1)X[Q]=X[Q]||{_errors:[]};else X[Q]=X[Q]||{_errors:[]},X[Q]._errors.push(z(Y));X=X[Q],b++}}};return G(_),A}var o6=(_)=>(z,A,G,J)=>{let Y=G?Object.assign(G,{async:!1}):{async:!1},X=z._zod.run({value:A,issues:[]},Y);if(X instanceof Promise)throw new y4;if(X.issues.length){let b=new(J?.Err??_)(X.issues.map((Q)=>n9(Q,Y,S9())));throw r6(b,J?.callee),b}return X.value};var a6=(_)=>async(z,A,G,J)=>{let Y=G?Object.assign(G,{async:!0}):{async:!0},X=z._zod.run({value:A,issues:[]},Y);if(X instanceof Promise)X=await X;if(X.issues.length){let b=new(J?.Err??_)(X.issues.map((Q)=>n9(Q,Y,S9())));throw r6(b,J?.callee),b}return X.value};var nz=(_)=>(z,A,G)=>{let J=G?{...G,async:!1}:{async:!1},Y=z._zod.run({value:A,issues:[]},J);if(Y instanceof Promise)throw new y4;return Y.issues.length?{success:!1,error:new(_??i6)(Y.issues.map((X)=>n9(X,J,S9())))}:{success:!0,data:Y.value}},iz=nz(j2),oz=(_)=>async(z,A,G)=>{let J=G?Object.assign(G,{async:!0}):{async:!0},Y=z._zod.run({value:A,issues:[]},J);if(Y instanceof Promise)Y=await Y;return Y.issues.length?{success:!1,error:new _(Y.issues.map((X)=>n9(X,J,S9())))}:{success:!0,data:Y.value}},s6=oz(j2),I$=(_)=>(z,A,G)=>{let J=G?Object.assign(G,{direction:"backward"}):{direction:"backward"};return o6(_)(z,A,J)};var x$=(_)=>(z,A,G)=>{return o6(_)(z,A,G)};var T$=(_)=>async(z,A,G)=>{let J=G?Object.assign(G,{direction:"backward"}):{direction:"backward"};return a6(_)(z,A,J)};var C$=(_)=>async(z,A,G)=>{return a6(_)(z,A,G)};var v$=(_)=>(z,A,G)=>{let J=G?Object.assign(G,{direction:"backward"}):{direction:"backward"};return nz(_)(z,A,J)};var y$=(_)=>(z,A,G)=>{return nz(_)(z,A,G)};var g$=(_)=>async(z,A,G)=>{let J=G?Object.assign(G,{direction:"backward"}):{direction:"backward"};return oz(_)(z,A,J)};var f$=(_)=>async(z,A,G)=>{return oz(_)(z,A,G)};var h$=/^[cC][^\s-]{8,}$/,m$=/^[0-9a-z]+$/,u$=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,c$=/^[0-9a-vA-V]{20}$/,l$=/^[A-Za-z0-9]{27}$/,p$=/^[a-zA-Z0-9_-]{21}$/,d$=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var r$=/^([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})$/,R2=(_)=>{if(!_)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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${_}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var n$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var rI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function i$(){return new RegExp(rI,"u")}var o$=/^(?:(?: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])$/,a$=/^(([0-9a-fA-F]{1,4}:){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}|:))$/;var s$=/^((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])$/,t$=/^(([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])$/,e$=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,P2=/^[A-Za-z0-9_-]*$/;var _H=/^\+[1-9]\d{6,14}$/,zH="(?:(?:\\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])))",AH=new RegExp(`^${zH}$`);function GH(_){return typeof _.precision==="number"?_.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":_.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{${_.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function JH(_){return new RegExp(`^${GH(_)}$`)}function YH(_){let z=GH({precision:_.precision}),A=["Z"];if(_.local)A.push("");if(_.offset)A.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let G=`${z}(?:${A.join("|")})`;return new RegExp(`^${zH}T(?:${G})$`)}var XH=(_)=>{let z=_?`[\\s\\S]{${_?.minimum??0},${_?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${z}$`)};var bH=/^-?\d+$/,t6=/^-?\d+(?:\.\d+)?$/,QH=/^(?:true|false)$/i,$H=/^null$/i;var HH=/^[^A-Z]*$/,BH=/^[^a-z]*$/;var c0=w("$ZodCheck",(_,z)=>{var A;_._zod??(_._zod={}),_._zod.def=z,(A=_._zod).onattach??(A.onattach=[])}),ZH={number:"number",bigint:"bigint",object:"date"},S2=w("$ZodCheckLessThan",(_,z)=>{c0.init(_,z);let A=ZH[typeof z.value];_._zod.onattach.push((G)=>{let J=G._zod.bag,Y=(z.inclusive?J.maximum:J.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(z.value<Y)if(z.inclusive)J.maximum=z.value;else J.exclusiveMaximum=z.value}),_._zod.check=(G)=>{if(z.inclusive?G.value<=z.value:G.value<z.value)return;G.issues.push({origin:A,code:"too_big",maximum:typeof z.value==="object"?z.value.getTime():z.value,input:G.value,inclusive:z.inclusive,inst:_,continue:!z.abort})}}),k2=w("$ZodCheckGreaterThan",(_,z)=>{c0.init(_,z);let A=ZH[typeof z.value];_._zod.onattach.push((G)=>{let J=G._zod.bag,Y=(z.inclusive?J.minimum:J.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(z.value>Y)if(z.inclusive)J.minimum=z.value;else J.exclusiveMinimum=z.value}),_._zod.check=(G)=>{if(z.inclusive?G.value>=z.value:G.value>z.value)return;G.issues.push({origin:A,code:"too_small",minimum:typeof z.value==="object"?z.value.getTime():z.value,input:G.value,inclusive:z.inclusive,inst:_,continue:!z.abort})}}),qH=w("$ZodCheckMultipleOf",(_,z)=>{c0.init(_,z),_._zod.onattach.push((A)=>{var G;(G=A._zod.bag).multipleOf??(G.multipleOf=z.value)}),_._zod.check=(A)=>{if(typeof A.value!==typeof z.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof A.value==="bigint"?A.value%z.value===BigInt(0):D2(A.value,z.value)===0)return;A.issues.push({origin:typeof A.value,code:"not_multiple_of",divisor:z.value,input:A.value,inst:_,continue:!z.abort})}}),FH=w("$ZodCheckNumberFormat",(_,z)=>{c0.init(_,z),z.format=z.format||"float64";let A=z.format?.includes("int"),G=A?"int":"number",[J,Y]=O2[z.format];_._zod.onattach.push((X)=>{let b=X._zod.bag;if(b.format=z.format,b.minimum=J,b.maximum=Y,A)b.pattern=bH}),_._zod.check=(X)=>{let b=X.value;if(A){if(!Number.isInteger(b)){X.issues.push({expected:G,format:z.format,code:"invalid_type",continue:!1,input:b,inst:_});return}if(!Number.isSafeInteger(b)){if(b>0)X.issues.push({input:b,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:_,origin:G,inclusive:!0,continue:!z.abort});else X.issues.push({input:b,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:_,origin:G,inclusive:!0,continue:!z.abort});return}}if(b<J)X.issues.push({origin:"number",input:b,code:"too_small",minimum:J,inclusive:!0,inst:_,continue:!z.abort});if(b>Y)X.issues.push({origin:"number",input:b,code:"too_big",maximum:Y,inclusive:!0,inst:_,continue:!z.abort})}});var KH=w("$ZodCheckMaxLength",(_,z)=>{var A;c0.init(_,z),(A=_._zod.def).when??(A.when=(G)=>{let J=G.value;return!pz(J)&&J.length!==void 0}),_._zod.onattach.push((G)=>{let J=G._zod.bag.maximum??Number.POSITIVE_INFINITY;if(z.maximum<J)G._zod.bag.maximum=z.maximum}),_._zod.check=(G)=>{let J=G.value;if(J.length<=z.maximum)return;let X=rz(J);G.issues.push({origin:X,code:"too_big",maximum:z.maximum,inclusive:!0,input:J,inst:_,continue:!z.abort})}}),WH=w("$ZodCheckMinLength",(_,z)=>{var A;c0.init(_,z),(A=_._zod.def).when??(A.when=(G)=>{let J=G.value;return!pz(J)&&J.length!==void 0}),_._zod.onattach.push((G)=>{let J=G._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(z.minimum>J)G._zod.bag.minimum=z.minimum}),_._zod.check=(G)=>{let J=G.value;if(J.length>=z.minimum)return;let X=rz(J);G.issues.push({origin:X,code:"too_small",minimum:z.minimum,inclusive:!0,input:J,inst:_,continue:!z.abort})}}),VH=w("$ZodCheckLengthEquals",(_,z)=>{var A;c0.init(_,z),(A=_._zod.def).when??(A.when=(G)=>{let J=G.value;return!pz(J)&&J.length!==void 0}),_._zod.onattach.push((G)=>{let J=G._zod.bag;J.minimum=z.length,J.maximum=z.length,J.length=z.length}),_._zod.check=(G)=>{let J=G.value,Y=J.length;if(Y===z.length)return;let X=rz(J),b=Y>z.length;G.issues.push({origin:X,...b?{code:"too_big",maximum:z.length}:{code:"too_small",minimum:z.length},inclusive:!0,exact:!0,input:G.value,inst:_,continue:!z.abort})}}),az=w("$ZodCheckStringFormat",(_,z)=>{var A,G;if(c0.init(_,z),_._zod.onattach.push((J)=>{let Y=J._zod.bag;if(Y.format=z.format,z.pattern)Y.patterns??(Y.patterns=new Set),Y.patterns.add(z.pattern)}),z.pattern)(A=_._zod).check??(A.check=(J)=>{if(z.pattern.lastIndex=0,z.pattern.test(J.value))return;J.issues.push({origin:"string",code:"invalid_format",format:z.format,input:J.value,...z.pattern?{pattern:z.pattern.toString()}:{},inst:_,continue:!z.abort})});else(G=_._zod).check??(G.check=()=>{})}),UH=w("$ZodCheckRegex",(_,z)=>{az.init(_,z),_._zod.check=(A)=>{if(z.pattern.lastIndex=0,z.pattern.test(A.value))return;A.issues.push({origin:"string",code:"invalid_format",format:"regex",input:A.value,pattern:z.pattern.toString(),inst:_,continue:!z.abort})}}),DH=w("$ZodCheckLowerCase",(_,z)=>{z.pattern??(z.pattern=HH),az.init(_,z)}),MH=w("$ZodCheckUpperCase",(_,z)=>{z.pattern??(z.pattern=BH),az.init(_,z)}),NH=w("$ZodCheckIncludes",(_,z)=>{c0.init(_,z);let A=f4(z.includes),G=new RegExp(typeof z.position==="number"?`^.{${z.position}}${A}`:A);z.pattern=G,_._zod.onattach.push((J)=>{let Y=J._zod.bag;Y.patterns??(Y.patterns=new Set),Y.patterns.add(G)}),_._zod.check=(J)=>{if(J.value.includes(z.includes,z.position))return;J.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:z.includes,input:J.value,inst:_,continue:!z.abort})}}),EH=w("$ZodCheckStartsWith",(_,z)=>{c0.init(_,z);let A=new RegExp(`^${f4(z.prefix)}.*`);z.pattern??(z.pattern=A),_._zod.onattach.push((G)=>{let J=G._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(A)}),_._zod.check=(G)=>{if(G.value.startsWith(z.prefix))return;G.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:z.prefix,input:G.value,inst:_,continue:!z.abort})}}),wH=w("$ZodCheckEndsWith",(_,z)=>{c0.init(_,z);let A=new RegExp(`.*${f4(z.suffix)}$`);z.pattern??(z.pattern=A),_._zod.onattach.push((G)=>{let J=G._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(A)}),_._zod.check=(G)=>{if(G.value.endsWith(z.suffix))return;G.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:z.suffix,input:G.value,inst:_,continue:!z.abort})}});var OH=w("$ZodCheckOverwrite",(_,z)=>{c0.init(_,z),_._zod.check=(A)=>{A.value=z.tx(A.value)}});class I2{constructor(_=[]){if(this.content=[],this.indent=0,this)this.args=_}indented(_){this.indent+=1,_(this),this.indent-=1}write(_){if(typeof _==="function"){_(this,{execution:"sync"}),_(this,{execution:"async"});return}let A=_.split(`
179
+ `).filter((Y)=>Y),G=Math.min(...A.map((Y)=>Y.length-Y.trimStart().length)),J=A.map((Y)=>Y.slice(G)).map((Y)=>" ".repeat(this.indent*2)+Y);for(let Y of J)this.content.push(Y)}compile(){let _=Function,z=this?.args,G=[...(this?.content??[""]).map((J)=>` ${J}`)];return new _(...z,G.join(`
180
+ `))}}var jH={major:4,minor:3,patch:5};var M0=w("$ZodType",(_,z)=>{var A;_??(_={}),_._zod.def=z,_._zod.bag=_._zod.bag||{},_._zod.version=jH;let G=[..._._zod.def.checks??[]];if(_._zod.traits.has("$ZodCheck"))G.unshift(_);for(let J of G)for(let Y of J._zod.onattach)Y(_);if(G.length===0)(A=_._zod).deferred??(A.deferred=[]),_._zod.deferred?.push(()=>{_._zod.run=_._zod.parse});else{let J=(X,b,Q)=>{let $=q_(X),H;for(let B of b){if(B._zod.def.when){if(!B._zod.def.when(X))continue}else if($)continue;let Z=X.issues.length,q=B._zod.check(X);if(q instanceof Promise&&Q?.async===!1)throw new y4;if(H||q instanceof Promise)H=(H??Promise.resolve()).then(async()=>{if(await q,X.issues.length===Z)return;if(!$)$=q_(X,Z)});else{if(X.issues.length===Z)continue;if(!$)$=q_(X,Z)}}if(H)return H.then(()=>{return X});return X},Y=(X,b,Q)=>{if(q_(X))return X.aborted=!0,X;let $=J(b,G,Q);if($ instanceof Promise){if(Q.async===!1)throw new y4;return $.then((H)=>_._zod.parse(H,Q))}return _._zod.parse($,Q)};_._zod.run=(X,b)=>{if(b.skipChecks)return _._zod.parse(X,b);if(b.direction==="backward"){let $=_._zod.parse({value:X.value,issues:[]},{...b,skipChecks:!0});if($ instanceof Promise)return $.then((H)=>{return Y(H,X,b)});return Y($,X,b)}let Q=_._zod.parse(X,b);if(Q instanceof Promise){if(b.async===!1)throw new y4;return Q.then(($)=>J($,G,b))}return J(Q,G,b)}}H0(_,"~standard",()=>({validate:(J)=>{try{let Y=iz(_,J);return Y.success?{value:Y.data}:{issues:Y.error?.issues}}catch(Y){return s6(_,J).then((X)=>X.success?{value:X.data}:{issues:X.error?.issues})}},vendor:"zod",version:1}))}),A8=w("$ZodString",(_,z)=>{M0.init(_,z),_._zod.pattern=[..._?._zod.bag?.patterns??[]].pop()??XH(_._zod.bag),_._zod.parse=(A,G)=>{if(z.coerce)try{A.value=String(A.value)}catch(J){}if(typeof A.value==="string")return A;return A.issues.push({expected:"string",code:"invalid_type",input:A.value,inst:_}),A}}),N0=w("$ZodStringFormat",(_,z)=>{az.init(_,z),A8.init(_,z)}),vH=w("$ZodGUID",(_,z)=>{z.pattern??(z.pattern=r$),N0.init(_,z)}),yH=w("$ZodUUID",(_,z)=>{if(z.version){let G={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[z.version];if(G===void 0)throw Error(`Invalid UUID version: "${z.version}"`);z.pattern??(z.pattern=R2(G))}else z.pattern??(z.pattern=R2());N0.init(_,z)}),gH=w("$ZodEmail",(_,z)=>{z.pattern??(z.pattern=n$),N0.init(_,z)}),fH=w("$ZodURL",(_,z)=>{N0.init(_,z),_._zod.check=(A)=>{try{let G=A.value.trim(),J=new URL(G);if(z.hostname){if(z.hostname.lastIndex=0,!z.hostname.test(J.hostname))A.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:z.hostname.source,input:A.value,inst:_,continue:!z.abort})}if(z.protocol){if(z.protocol.lastIndex=0,!z.protocol.test(J.protocol.endsWith(":")?J.protocol.slice(0,-1):J.protocol))A.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:z.protocol.source,input:A.value,inst:_,continue:!z.abort})}if(z.normalize)A.value=J.href;else A.value=G;return}catch(G){A.issues.push({code:"invalid_format",format:"url",input:A.value,inst:_,continue:!z.abort})}}}),hH=w("$ZodEmoji",(_,z)=>{z.pattern??(z.pattern=i$()),N0.init(_,z)}),mH=w("$ZodNanoID",(_,z)=>{z.pattern??(z.pattern=p$),N0.init(_,z)}),uH=w("$ZodCUID",(_,z)=>{z.pattern??(z.pattern=h$),N0.init(_,z)}),cH=w("$ZodCUID2",(_,z)=>{z.pattern??(z.pattern=m$),N0.init(_,z)}),lH=w("$ZodULID",(_,z)=>{z.pattern??(z.pattern=u$),N0.init(_,z)}),pH=w("$ZodXID",(_,z)=>{z.pattern??(z.pattern=c$),N0.init(_,z)}),dH=w("$ZodKSUID",(_,z)=>{z.pattern??(z.pattern=l$),N0.init(_,z)}),rH=w("$ZodISODateTime",(_,z)=>{z.pattern??(z.pattern=YH(z)),N0.init(_,z)}),nH=w("$ZodISODate",(_,z)=>{z.pattern??(z.pattern=AH),N0.init(_,z)}),iH=w("$ZodISOTime",(_,z)=>{z.pattern??(z.pattern=JH(z)),N0.init(_,z)}),oH=w("$ZodISODuration",(_,z)=>{z.pattern??(z.pattern=d$),N0.init(_,z)}),aH=w("$ZodIPv4",(_,z)=>{z.pattern??(z.pattern=o$),N0.init(_,z),_._zod.bag.format="ipv4"}),sH=w("$ZodIPv6",(_,z)=>{z.pattern??(z.pattern=a$),N0.init(_,z),_._zod.bag.format="ipv6",_._zod.check=(A)=>{try{new URL(`http://[${A.value}]`)}catch{A.issues.push({code:"invalid_format",format:"ipv6",input:A.value,inst:_,continue:!z.abort})}}});var tH=w("$ZodCIDRv4",(_,z)=>{z.pattern??(z.pattern=s$),N0.init(_,z)}),eH=w("$ZodCIDRv6",(_,z)=>{z.pattern??(z.pattern=t$),N0.init(_,z),_._zod.check=(A)=>{let G=A.value.split("/");try{if(G.length!==2)throw Error();let[J,Y]=G;if(!Y)throw Error();let X=Number(Y);if(`${X}`!==Y)throw Error();if(X<0||X>128)throw Error();new URL(`http://[${J}]`)}catch{A.issues.push({code:"invalid_format",format:"cidrv6",input:A.value,inst:_,continue:!z.abort})}}});function _B(_){if(_==="")return!0;if(_.length%4!==0)return!1;try{return atob(_),!0}catch{return!1}}var zB=w("$ZodBase64",(_,z)=>{z.pattern??(z.pattern=e$),N0.init(_,z),_._zod.bag.contentEncoding="base64",_._zod.check=(A)=>{if(_B(A.value))return;A.issues.push({code:"invalid_format",format:"base64",input:A.value,inst:_,continue:!z.abort})}});function oI(_){if(!P2.test(_))return!1;let z=_.replace(/[-_]/g,(G)=>G==="-"?"+":"/"),A=z.padEnd(Math.ceil(z.length/4)*4,"=");return _B(A)}var AB=w("$ZodBase64URL",(_,z)=>{z.pattern??(z.pattern=P2),N0.init(_,z),_._zod.bag.contentEncoding="base64url",_._zod.check=(A)=>{if(oI(A.value))return;A.issues.push({code:"invalid_format",format:"base64url",input:A.value,inst:_,continue:!z.abort})}}),GB=w("$ZodE164",(_,z)=>{z.pattern??(z.pattern=_H),N0.init(_,z)});function aI(_,z=null){try{let A=_.split(".");if(A.length!==3)return!1;let[G]=A;if(!G)return!1;let J=JSON.parse(atob(G));if("typ"in J&&J?.typ!=="JWT")return!1;if(!J.alg)return!1;if(z&&(!("alg"in J)||J.alg!==z))return!1;return!0}catch{return!1}}var JB=w("$ZodJWT",(_,z)=>{N0.init(_,z),_._zod.check=(A)=>{if(aI(A.value,z.alg))return;A.issues.push({code:"invalid_format",format:"jwt",input:A.value,inst:_,continue:!z.abort})}});var T2=w("$ZodNumber",(_,z)=>{M0.init(_,z),_._zod.pattern=_._zod.bag.pattern??t6,_._zod.parse=(A,G)=>{if(z.coerce)try{A.value=Number(A.value)}catch(X){}let J=A.value;if(typeof J==="number"&&!Number.isNaN(J)&&Number.isFinite(J))return A;let Y=typeof J==="number"?Number.isNaN(J)?"NaN":!Number.isFinite(J)?"Infinity":void 0:void 0;return A.issues.push({expected:"number",code:"invalid_type",input:J,inst:_,...Y?{received:Y}:{}}),A}}),YB=w("$ZodNumberFormat",(_,z)=>{FH.init(_,z),T2.init(_,z)}),XB=w("$ZodBoolean",(_,z)=>{M0.init(_,z),_._zod.pattern=QH,_._zod.parse=(A,G)=>{if(z.coerce)try{A.value=Boolean(A.value)}catch(Y){}let J=A.value;if(typeof J==="boolean")return A;return A.issues.push({expected:"boolean",code:"invalid_type",input:J,inst:_}),A}});var bB=w("$ZodNull",(_,z)=>{M0.init(_,z),_._zod.pattern=$H,_._zod.values=new Set([null]),_._zod.parse=(A,G)=>{let J=A.value;if(J===null)return A;return A.issues.push({expected:"null",code:"invalid_type",input:J,inst:_}),A}});var QB=w("$ZodUnknown",(_,z)=>{M0.init(_,z),_._zod.parse=(A)=>A}),$B=w("$ZodNever",(_,z)=>{M0.init(_,z),_._zod.parse=(A,G)=>{return A.issues.push({expected:"never",code:"invalid_type",input:A.value,inst:_}),A}});function RH(_,z,A){if(_.issues.length)z.issues.push(...h4(A,_.issues));z.value[A]=_.value}var HB=w("$ZodArray",(_,z)=>{M0.init(_,z),_._zod.parse=(A,G)=>{let J=A.value;if(!Array.isArray(J))return A.issues.push({expected:"array",code:"invalid_type",input:J,inst:_}),A;A.value=Array(J.length);let Y=[];for(let X=0;X<J.length;X++){let b=J[X],Q=z.element._zod.run({value:b,issues:[]},G);if(Q instanceof Promise)Y.push(Q.then(($)=>RH($,A,X)));else RH(Q,A,X)}if(Y.length)return Promise.all(Y).then(()=>A);return A}});function z8(_,z,A,G,J){if(_.issues.length){if(J&&!(A in G))return;z.issues.push(...h4(A,_.issues))}if(_.value===void 0){if(A in G)z.value[A]=void 0}else z.value[A]=_.value}function BB(_){let z=Object.keys(_.shape);for(let G of z)if(!_.shape?.[G]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${G}": expected a Zod schema`);let A=w2(_.shape);return{..._,keys:z,keySet:new Set(z),numKeys:z.length,optionalKeys:new Set(A)}}function ZB(_,z,A,G,J,Y){let X=[],b=J.keySet,Q=J.catchall._zod,$=Q.def.type,H=Q.optout==="optional";for(let B in z){if(b.has(B))continue;if($==="never"){X.push(B);continue}let Z=Q.run({value:z[B],issues:[]},G);if(Z instanceof Promise)_.push(Z.then((q)=>z8(q,A,B,z,H)));else z8(Z,A,B,z,H)}if(X.length)A.issues.push({code:"unrecognized_keys",keys:X,input:z,inst:Y});if(!_.length)return A;return Promise.all(_).then(()=>{return A})}var sI=w("$ZodObject",(_,z)=>{if(M0.init(_,z),!Object.getOwnPropertyDescriptor(z,"shape")?.get){let b=z.shape;Object.defineProperty(z,"shape",{get:()=>{let Q={...b};return Object.defineProperty(z,"shape",{value:Q}),Q}})}let G=f1(()=>BB(z));H0(_._zod,"propValues",()=>{let b=z.shape,Q={};for(let $ in b){let H=b[$]._zod;if(H.values){Q[$]??(Q[$]=new Set);for(let B of H.values)Q[$].add(B)}}return Q});let J=c_,Y=z.catchall,X;_._zod.parse=(b,Q)=>{X??(X=G.value);let $=b.value;if(!J($))return b.issues.push({expected:"object",code:"invalid_type",input:$,inst:_}),b;b.value={};let H=[],B=X.shape;for(let Z of X.keys){let q=B[Z],F=q._zod.optout==="optional",K=q._zod.run({value:$[Z],issues:[]},Q);if(K instanceof Promise)H.push(K.then((W)=>z8(W,b,Z,$,F)));else z8(K,b,Z,$,F)}if(!Y)return H.length?Promise.all(H).then(()=>b):b;return ZB(H,$,b,Q,G.value,_)}}),qB=w("$ZodObjectJIT",(_,z)=>{sI.init(_,z);let A=_._zod.parse,G=f1(()=>BB(z)),J=(Z)=>{let q=new I2(["shape","payload","ctx"]),F=G.value,K=(L)=>{let M=d6(L);return`shape[${M}]._zod.run({ value: input[${M}], issues: [] }, ctx)`};q.write("const input = payload.value;");let W=Object.create(null),V=0;for(let L of F.keys)W[L]=`key_${V++}`;q.write("const newResult = {};");for(let L of F.keys){let M=W[L],k=d6(L),O=Z[L]?._zod?.optout==="optional";if(q.write(`const ${M} = ${K(L)};`),O)q.write(`
170
181
  if (${M}.issues.length) {
171
- if (${P} in input) {
182
+ if (${k} in input) {
172
183
  payload.issues = payload.issues.concat(${M}.issues.map(iss => ({
173
184
  ...iss,
174
- path: iss.path ? [${P}, ...iss.path] : [${P}]
185
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
175
186
  })));
176
187
  }
177
188
  }
178
189
 
179
190
  if (${M}.value === undefined) {
180
- if (${P} in input) {
181
- newResult[${P}] = undefined;
191
+ if (${k} in input) {
192
+ newResult[${k}] = undefined;
182
193
  }
183
194
  } else {
184
- newResult[${P}] = ${M}.value;
195
+ newResult[${k}] = ${M}.value;
185
196
  }
186
197
 
187
- `);else F.write(`
198
+ `);else q.write(`
188
199
  if (${M}.issues.length) {
189
200
  payload.issues = payload.issues.concat(${M}.issues.map(iss => ({
190
201
  ...iss,
191
- path: iss.path ? [${P}, ...iss.path] : [${P}]
202
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
192
203
  })));
193
204
  }
194
205
 
195
206
  if (${M}.value === undefined) {
196
- if (${P} in input) {
197
- newResult[${P}] = undefined;
207
+ if (${k} in input) {
208
+ newResult[${k}] = undefined;
198
209
  }
199
210
  } else {
200
- newResult[${P}] = ${M}.value;
211
+ newResult[${k}] = ${M}.value;
201
212
  }
202
213
 
203
- `)}F.write("payload.value = newResult;"),F.write("return payload;");let w=F.compile();return(O,M)=>w(Z,O,M)},J,Y=x_,X=!v6.jitless,$=X&&X2.value,H=z.catchall,B;_._zod.parse=(Z,F)=>{B??(B=b.value);let K=Z.value;if(!Y(K))return Z.issues.push({expected:"object",code:"invalid_type",input:K,inst:_}),Z;if(X&&$&&F?.async===!1&&F.jitless!==!0){if(!J)J=G(z.shape);if(Z=J(Z,F),!H)return Z;return fH([],K,Z,F,B,_)}return A(Z,F)}});function _H(_,z,A,b){for(let J of _)if(J.issues.length===0)return z.value=J.value,z;let G=_.filter((J)=>!z_(J));if(G.length===1)return z.value=G[0].value,G[0];return z.issues.push({code:"invalid_union",input:z.value,inst:A,errors:_.map((J)=>J.issues.map((Y)=>p9(Y,b,O9())))}),z}var M2=E("$ZodUnion",(_,z)=>{M0.init(_,z),H0(_._zod,"optin",()=>z.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),H0(_._zod,"optout",()=>z.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),H0(_._zod,"values",()=>{if(z.options.every((G)=>G._zod.values))return new Set(z.options.flatMap((G)=>Array.from(G._zod.values)));return}),H0(_._zod,"pattern",()=>{if(z.options.every((G)=>G._zod.pattern)){let G=z.options.map((J)=>J._zod.pattern);return new RegExp(`^(${G.map((J)=>hz(J.source)).join("|")})$`)}return});let A=z.options.length===1,b=z.options[0]._zod.run;_._zod.parse=(G,J)=>{if(A)return b(G,J);let Y=!1,X=[];for(let Q of z.options){let $=Q._zod.run({value:G.value,issues:[]},J);if($ instanceof Promise)X.push($),Y=!0;else{if($.issues.length===0)return $;X.push($)}}if(!Y)return _H(X,G,_,J);return Promise.all(X).then((Q)=>{return _H(Q,G,_,J)})}});var mH=E("$ZodDiscriminatedUnion",(_,z)=>{z.inclusive=!1,M2.init(_,z);let A=_._zod.parse;H0(_._zod,"propValues",()=>{let G={};for(let J of z.options){let Y=J._zod.propValues;if(!Y||Object.keys(Y).length===0)throw Error(`Invalid discriminated union option at index "${z.options.indexOf(J)}"`);for(let[X,Q]of Object.entries(Y)){if(!G[X])G[X]=new Set;for(let $ of Q)G[X].add($)}}return G});let b=I1(()=>{let G=z.options,J=new Map;for(let Y of G){let X=Y._zod.propValues?.[z.discriminator];if(!X||X.size===0)throw Error(`Invalid discriminated union option at index "${z.options.indexOf(Y)}"`);for(let Q of X){if(J.has(Q))throw Error(`Duplicate discriminator value "${String(Q)}"`);J.set(Q,Y)}}return J});_._zod.parse=(G,J)=>{let Y=G.value;if(!x_(Y))return G.issues.push({code:"invalid_type",expected:"object",input:Y,inst:_}),G;let X=b.value.get(Y?.[z.discriminator]);if(X)return X._zod.run(G,J);if(z.unionFallback)return A(G,J);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:z.discriminator,input:Y,path:[z.discriminator],inst:_}),G}}),uH=E("$ZodIntersection",(_,z)=>{M0.init(_,z),_._zod.parse=(A,b)=>{let G=A.value,J=z.left._zod.run({value:G,issues:[]},b),Y=z.right._zod.run({value:G,issues:[]},b);if(J instanceof Promise||Y instanceof Promise)return Promise.all([J,Y]).then(([Q,$])=>{return zH(A,Q,$)});return zH(A,J,Y)}});function U2(_,z){if(_===z)return{valid:!0,data:_};if(_ instanceof Date&&z instanceof Date&&+_===+z)return{valid:!0,data:_};if(__(_)&&__(z)){let A=Object.keys(z),b=Object.keys(_).filter((J)=>A.indexOf(J)!==-1),G={..._,...z};for(let J of b){let Y=U2(_[J],z[J]);if(!Y.valid)return{valid:!1,mergeErrorPath:[J,...Y.mergeErrorPath]};G[J]=Y.data}return{valid:!0,data:G}}if(Array.isArray(_)&&Array.isArray(z)){if(_.length!==z.length)return{valid:!1,mergeErrorPath:[]};let A=[];for(let b=0;b<_.length;b++){let G=_[b],J=z[b],Y=U2(G,J);if(!Y.valid)return{valid:!1,mergeErrorPath:[b,...Y.mergeErrorPath]};A.push(Y.data)}return{valid:!0,data:A}}return{valid:!1,mergeErrorPath:[]}}function zH(_,z,A){let b=new Map,G;for(let X of z.issues)if(X.code==="unrecognized_keys"){G??(G=X);for(let Q of X.keys){if(!b.has(Q))b.set(Q,{});b.get(Q).l=!0}}else _.issues.push(X);for(let X of A.issues)if(X.code==="unrecognized_keys")for(let Q of X.keys){if(!b.has(Q))b.set(Q,{});b.get(Q).r=!0}else _.issues.push(X);let J=[...b].filter(([,X])=>X.l&&X.r).map(([X])=>X);if(J.length&&G)_.issues.push({...G,keys:J});if(z_(_))return _;let Y=U2(z.value,A.value);if(!Y.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(Y.mergeErrorPath)}`);return _.value=Y.data,_}var cH=E("$ZodRecord",(_,z)=>{M0.init(_,z),_._zod.parse=(A,b)=>{let G=A.value;if(!__(G))return A.issues.push({expected:"record",code:"invalid_type",input:G,inst:_}),A;let J=[],Y=z.keyType._zod.values;if(Y){A.value={};let X=new Set;for(let $ of Y)if(typeof $==="string"||typeof $==="number"||typeof $==="symbol"){X.add(typeof $==="number"?$.toString():$);let H=z.valueType._zod.run({value:G[$],issues:[]},b);if(H instanceof Promise)J.push(H.then((B)=>{if(B.issues.length)A.issues.push(...x4($,B.issues));A.value[$]=B.value}));else{if(H.issues.length)A.issues.push(...x4($,H.issues));A.value[$]=H.value}}let Q;for(let $ in G)if(!X.has($))Q=Q??[],Q.push($);if(Q&&Q.length>0)A.issues.push({code:"unrecognized_keys",input:G,inst:_,keys:Q})}else{A.value={};for(let X of Reflect.ownKeys(G)){if(X==="__proto__")continue;let Q=z.keyType._zod.run({value:X,issues:[]},b);if(Q instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof X==="string"&&p6.test(X)&&Q.issues.length&&Q.issues.some((B)=>B.code==="invalid_type"&&B.expected==="number")){let B=z.keyType._zod.run({value:Number(X),issues:[]},b);if(B instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(B.issues.length===0)Q=B}if(Q.issues.length){if(z.mode==="loose")A.value[X]=G[X];else A.issues.push({code:"invalid_key",origin:"record",issues:Q.issues.map((B)=>p9(B,b,O9())),input:X,path:[X],inst:_});continue}let H=z.valueType._zod.run({value:G[X],issues:[]},b);if(H instanceof Promise)J.push(H.then((B)=>{if(B.issues.length)A.issues.push(...x4(X,B.issues));A.value[Q.value]=B.value}));else{if(H.issues.length)A.issues.push(...x4(X,H.issues));A.value[Q.value]=H.value}}}if(J.length)return Promise.all(J).then(()=>A);return A}});var lH=E("$ZodEnum",(_,z)=>{M0.init(_,z);let A=gz(z.entries),b=new Set(A);_._zod.values=b,_._zod.pattern=new RegExp(`^(${A.filter((G)=>Q2.has(typeof G)).map((G)=>typeof G==="string"?I4(G):G.toString()).join("|")})$`),_._zod.parse=(G,J)=>{let Y=G.value;if(b.has(Y))return G;return G.issues.push({code:"invalid_value",values:A,input:Y,inst:_}),G}}),pH=E("$ZodLiteral",(_,z)=>{if(M0.init(_,z),z.values.length===0)throw Error("Cannot create literal schema with no valid values");let A=new Set(z.values);_._zod.values=A,_._zod.pattern=new RegExp(`^(${z.values.map((b)=>typeof b==="string"?I4(b):b?I4(b.toString()):String(b)).join("|")})$`),_._zod.parse=(b,G)=>{let J=b.value;if(A.has(J))return b;return b.issues.push({code:"invalid_value",values:z.values,input:J,inst:_}),b}});var dH=E("$ZodTransform",(_,z)=>{M0.init(_,z),_._zod.parse=(A,b)=>{if(b.direction==="backward")throw new vz(_.constructor.name);let G=z.transform(A.value,A);if(b.async)return(G instanceof Promise?G:Promise.resolve(G)).then((Y)=>{return A.value=Y,A});if(G instanceof Promise)throw new S4;return A.value=G,A}});function AH(_,z){if(_.issues.length&&z===void 0)return{issues:[],value:void 0};return _}var N2=E("$ZodOptional",(_,z)=>{M0.init(_,z),_._zod.optin="optional",_._zod.optout="optional",H0(_._zod,"values",()=>{return z.innerType._zod.values?new Set([...z.innerType._zod.values,void 0]):void 0}),H0(_._zod,"pattern",()=>{let A=z.innerType._zod.pattern;return A?new RegExp(`^(${hz(A.source)})?$`):void 0}),_._zod.parse=(A,b)=>{if(z.innerType._zod.optin==="optional"){let G=z.innerType._zod.run(A,b);if(G instanceof Promise)return G.then((J)=>AH(J,A.value));return AH(G,A.value)}if(A.value===void 0)return A;return z.innerType._zod.run(A,b)}}),rH=E("$ZodExactOptional",(_,z)=>{N2.init(_,z),H0(_._zod,"values",()=>z.innerType._zod.values),H0(_._zod,"pattern",()=>z.innerType._zod.pattern),_._zod.parse=(A,b)=>{return z.innerType._zod.run(A,b)}}),nH=E("$ZodNullable",(_,z)=>{M0.init(_,z),H0(_._zod,"optin",()=>z.innerType._zod.optin),H0(_._zod,"optout",()=>z.innerType._zod.optout),H0(_._zod,"pattern",()=>{let A=z.innerType._zod.pattern;return A?new RegExp(`^(${hz(A.source)}|null)$`):void 0}),H0(_._zod,"values",()=>{return z.innerType._zod.values?new Set([...z.innerType._zod.values,null]):void 0}),_._zod.parse=(A,b)=>{if(A.value===null)return A;return z.innerType._zod.run(A,b)}}),iH=E("$ZodDefault",(_,z)=>{M0.init(_,z),_._zod.optin="optional",H0(_._zod,"values",()=>z.innerType._zod.values),_._zod.parse=(A,b)=>{if(b.direction==="backward")return z.innerType._zod.run(A,b);if(A.value===void 0)return A.value=z.defaultValue,A;let G=z.innerType._zod.run(A,b);if(G instanceof Promise)return G.then((J)=>bH(J,z));return bH(G,z)}});function bH(_,z){if(_.value===void 0)_.value=z.defaultValue;return _}var oH=E("$ZodPrefault",(_,z)=>{M0.init(_,z),_._zod.optin="optional",H0(_._zod,"values",()=>z.innerType._zod.values),_._zod.parse=(A,b)=>{if(b.direction==="backward")return z.innerType._zod.run(A,b);if(A.value===void 0)A.value=z.defaultValue;return z.innerType._zod.run(A,b)}}),aH=E("$ZodNonOptional",(_,z)=>{M0.init(_,z),H0(_._zod,"values",()=>{let A=z.innerType._zod.values;return A?new Set([...A].filter((b)=>b!==void 0)):void 0}),_._zod.parse=(A,b)=>{let G=z.innerType._zod.run(A,b);if(G instanceof Promise)return G.then((J)=>GH(J,_));return GH(G,_)}});function GH(_,z){if(!_.issues.length&&_.value===void 0)_.issues.push({code:"invalid_type",expected:"nonoptional",input:_.value,inst:z});return _}var sH=E("$ZodCatch",(_,z)=>{M0.init(_,z),H0(_._zod,"optin",()=>z.innerType._zod.optin),H0(_._zod,"optout",()=>z.innerType._zod.optout),H0(_._zod,"values",()=>z.innerType._zod.values),_._zod.parse=(A,b)=>{if(b.direction==="backward")return z.innerType._zod.run(A,b);let G=z.innerType._zod.run(A,b);if(G instanceof Promise)return G.then((J)=>{if(A.value=J.value,J.issues.length)A.value=z.catchValue({...A,error:{issues:J.issues.map((Y)=>p9(Y,b,O9()))},input:A.value}),A.issues=[];return A});if(A.value=G.value,G.issues.length)A.value=z.catchValue({...A,error:{issues:G.issues.map((J)=>p9(J,b,O9()))},input:A.value}),A.issues=[];return A}});var tH=E("$ZodPipe",(_,z)=>{M0.init(_,z),H0(_._zod,"values",()=>z.in._zod.values),H0(_._zod,"optin",()=>z.in._zod.optin),H0(_._zod,"optout",()=>z.out._zod.optout),H0(_._zod,"propValues",()=>z.in._zod.propValues),_._zod.parse=(A,b)=>{if(b.direction==="backward"){let J=z.out._zod.run(A,b);if(J instanceof Promise)return J.then((Y)=>r6(Y,z.in,b));return r6(J,z.in,b)}let G=z.in._zod.run(A,b);if(G instanceof Promise)return G.then((J)=>r6(J,z.out,b));return r6(G,z.out,b)}});function r6(_,z,A){if(_.issues.length)return _.aborted=!0,_;return z._zod.run({value:_.value,issues:_.issues},A)}var eH=E("$ZodReadonly",(_,z)=>{M0.init(_,z),H0(_._zod,"propValues",()=>z.innerType._zod.propValues),H0(_._zod,"values",()=>z.innerType._zod.values),H0(_._zod,"optin",()=>z.innerType?._zod?.optin),H0(_._zod,"optout",()=>z.innerType?._zod?.optout),_._zod.parse=(A,b)=>{if(b.direction==="backward")return z.innerType._zod.run(A,b);let G=z.innerType._zod.run(A,b);if(G instanceof Promise)return G.then(JH);return JH(G)}});function JH(_){return _.value=Object.freeze(_.value),_}var _B=E("$ZodCustom",(_,z)=>{f0.init(_,z),M0.init(_,z),_._zod.parse=(A,b)=>{return A},_._zod.check=(A)=>{let b=A.value,G=z.fn(b);if(G instanceof Promise)return G.then((J)=>YH(J,A,b,_));YH(G,A,b,_);return}});function YH(_,z,A,b){if(!_){let G={code:"custom",input:A,inst:b,path:[...b._zod.def.path??[]],continue:!b._zod.def.abort};if(b._zod.def.params)G.params=b._zod.def.params;z.issues.push(x1(G))}}var gk=()=>{let _={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function z(G){return _[G]??null}let A={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",mac:"MAC 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"},b={nan:"NaN"};return(G)=>{switch(G.code){case"invalid_type":{let J=b[G.expected]??G.expected,Y=B2(G.input),X=b[Y]??Y;return`Invalid input: expected ${J}, received ${X}`}case"invalid_value":if(G.values.length===1)return`Invalid input: expected ${h6(G.values[0])}`;return`Invalid option: expected one of ${y6(G.values,"|")}`;case"too_big":{let J=G.inclusive?"<=":"<",Y=z(G.origin);if(Y)return`Too big: expected ${G.origin??"value"} to have ${J}${G.maximum.toString()} ${Y.unit??"elements"}`;return`Too big: expected ${G.origin??"value"} to be ${J}${G.maximum.toString()}`}case"too_small":{let J=G.inclusive?">=":">",Y=z(G.origin);if(Y)return`Too small: expected ${G.origin} to have ${J}${G.minimum.toString()} ${Y.unit}`;return`Too small: expected ${G.origin} to be ${J}${G.minimum.toString()}`}case"invalid_format":{let J=G;if(J.format==="starts_with")return`Invalid string: must start with "${J.prefix}"`;if(J.format==="ends_with")return`Invalid string: must end with "${J.suffix}"`;if(J.format==="includes")return`Invalid string: must include "${J.includes}"`;if(J.format==="regex")return`Invalid string: must match pattern ${J.pattern}`;return`Invalid ${A[J.format]??G.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${G.divisor}`;case"unrecognized_keys":return`Unrecognized key${G.keys.length>1?"s":""}: ${y6(G.keys,", ")}`;case"invalid_key":return`Invalid key in ${G.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${G.origin}`;default:return"Invalid input"}}};function w2(){return{localeError:gk()}}var zB,K00=Symbol("ZodOutput"),q00=Symbol("ZodInput");class AB{constructor(){this._map=new WeakMap,this._idmap=new Map}add(_,...z){let A=z[0];if(this._map.set(_,A),A&&typeof A==="object"&&"id"in A)this._idmap.set(A.id,_);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(_){let z=this._map.get(_);if(z&&typeof z==="object"&&"id"in z)this._idmap.delete(z.id);return this._map.delete(_),this}get(_){let z=_._zod.parent;if(z){let A={...this.get(z)??{}};delete A.id;let b={...A,...this._map.get(_)};return Object.keys(b).length?b:void 0}return this._map.get(_)}has(_){return this._map.has(_)}}function fk(){return new AB}(zB=globalThis).__zod_globalRegistry??(zB.__zod_globalRegistry=fk());var T_=globalThis.__zod_globalRegistry;function bB(_,z){return new _({type:"string",...c(z)})}function GB(_,z){return new _({type:"string",format:"email",check:"string_format",abort:!1,...c(z)})}function E2(_,z){return new _({type:"string",format:"guid",check:"string_format",abort:!1,...c(z)})}function JB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,...c(z)})}function YB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...c(z)})}function XB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...c(z)})}function QB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...c(z)})}function $B(_,z){return new _({type:"string",format:"url",check:"string_format",abort:!1,...c(z)})}function HB(_,z){return new _({type:"string",format:"emoji",check:"string_format",abort:!1,...c(z)})}function BB(_,z){return new _({type:"string",format:"nanoid",check:"string_format",abort:!1,...c(z)})}function ZB(_,z){return new _({type:"string",format:"cuid",check:"string_format",abort:!1,...c(z)})}function FB(_,z){return new _({type:"string",format:"cuid2",check:"string_format",abort:!1,...c(z)})}function KB(_,z){return new _({type:"string",format:"ulid",check:"string_format",abort:!1,...c(z)})}function qB(_,z){return new _({type:"string",format:"xid",check:"string_format",abort:!1,...c(z)})}function WB(_,z){return new _({type:"string",format:"ksuid",check:"string_format",abort:!1,...c(z)})}function VB(_,z){return new _({type:"string",format:"ipv4",check:"string_format",abort:!1,...c(z)})}function UB(_,z){return new _({type:"string",format:"ipv6",check:"string_format",abort:!1,...c(z)})}function DB(_,z){return new _({type:"string",format:"cidrv4",check:"string_format",abort:!1,...c(z)})}function MB(_,z){return new _({type:"string",format:"cidrv6",check:"string_format",abort:!1,...c(z)})}function NB(_,z){return new _({type:"string",format:"base64",check:"string_format",abort:!1,...c(z)})}function wB(_,z){return new _({type:"string",format:"base64url",check:"string_format",abort:!1,...c(z)})}function EB(_,z){return new _({type:"string",format:"e164",check:"string_format",abort:!1,...c(z)})}function OB(_,z){return new _({type:"string",format:"jwt",check:"string_format",abort:!1,...c(z)})}function LB(_,z){return new _({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...c(z)})}function jB(_,z){return new _({type:"string",format:"date",check:"string_format",...c(z)})}function RB(_,z){return new _({type:"string",format:"time",check:"string_format",precision:null,...c(z)})}function PB(_,z){return new _({type:"string",format:"duration",check:"string_format",...c(z)})}function SB(_,z){return new _({type:"number",checks:[],...c(z)})}function kB(_,z){return new _({type:"number",check:"number_format",abort:!1,format:"safeint",...c(z)})}function IB(_,z){return new _({type:"boolean",...c(z)})}function xB(_,z){return new _({type:"null",...c(z)})}function TB(_){return new _({type:"unknown"})}function CB(_,z){return new _({type:"never",...c(z)})}function o6(_,z){return new q2({check:"less_than",...c(z),value:_,inclusive:!1})}function dz(_,z){return new q2({check:"less_than",...c(z),value:_,inclusive:!0})}function a6(_,z){return new W2({check:"greater_than",...c(z),value:_,inclusive:!1})}function rz(_,z){return new W2({check:"greater_than",...c(z),value:_,inclusive:!0})}function s6(_,z){return new h$({check:"multiple_of",...c(z),value:_})}function t6(_,z){return new u$({check:"max_length",...c(z),maximum:_})}function T1(_,z){return new c$({check:"min_length",...c(z),minimum:_})}function e6(_,z){return new l$({check:"length_equals",...c(z),length:_})}function O2(_,z){return new p$({check:"string_format",format:"regex",...c(z),pattern:_})}function L2(_){return new d$({check:"string_format",format:"lowercase",...c(_)})}function j2(_){return new r$({check:"string_format",format:"uppercase",...c(_)})}function R2(_,z){return new n$({check:"string_format",format:"includes",...c(z),includes:_})}function P2(_,z){return new i$({check:"string_format",format:"starts_with",...c(z),prefix:_})}function S2(_,z){return new o$({check:"string_format",format:"ends_with",...c(z),suffix:_})}function A_(_){return new a$({check:"overwrite",tx:_})}function k2(_){return A_((z)=>z.normalize(_))}function I2(){return A_((_)=>_.trim())}function x2(){return A_((_)=>_.toLowerCase())}function T2(){return A_((_)=>_.toUpperCase())}function C2(){return A_((_)=>Y2(_))}function vB(_,z,A){return new _({type:"array",element:z,...c(A)})}function yB(_,z,A){let b=c(A);return b.abort??(b.abort=!0),new _({type:"custom",check:"custom",fn:z,...b})}function gB(_,z,A){return new _({type:"custom",check:"custom",fn:z,...c(A)})}function fB(_){let z=hk((A)=>{return A.addIssue=(b)=>{if(typeof b==="string")A.issues.push(x1(b,A.value,z._zod.def));else{let G=b;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=A.value),G.inst??(G.inst=z),G.continue??(G.continue=!z._zod.def.abort),A.issues.push(x1(G))}},_(A.value,A)});return z}function hk(_,z){let A=new f0({check:"custom",...c(z)});return A._zod.check=_,A}function v2(_){let z=_?.target??"draft-2020-12";if(z==="draft-4")z="draft-04";if(z==="draft-7")z="draft-07";return{processors:_.processors??{},metadataRegistry:_?.metadata??T_,target:z,unrepresentable:_?.unrepresentable??"throw",override:_?.override??(()=>{}),io:_?.io??"output",counter:0,seen:new Map,cycles:_?.cycles??"ref",reused:_?.reused??"inline",external:_?.external??void 0}}function I0(_,z,A={path:[],schemaPath:[]}){var b;let G=_._zod.def,J=z.seen.get(_);if(J){if(J.count++,A.schemaPath.includes(_))J.cycle=A.path;return J.schema}let Y={schema:{},count:1,cycle:void 0,path:A.path};z.seen.set(_,Y);let X=_._zod.toJSONSchema?.();if(X)Y.schema=X;else{let H={...A,schemaPath:[...A.schemaPath,_],path:A.path};if(_._zod.processJSONSchema)_._zod.processJSONSchema(z,Y.schema,H);else{let Z=Y.schema,F=z.processors[G.type];if(!F)throw Error(`[toJSONSchema]: Non-representable type encountered: ${G.type}`);F(_,z,Z,H)}let B=_._zod.parent;if(B){if(!Y.ref)Y.ref=B;I0(B,z,H),z.seen.get(B).isParent=!0}}let Q=z.metadataRegistry.get(_);if(Q)Object.assign(Y.schema,Q);if(z.io==="input"&&z9(_))delete Y.schema.examples,delete Y.schema.default;if(z.io==="input"&&Y.schema._prefault)(b=Y.schema).default??(b.default=Y.schema._prefault);return delete Y.schema._prefault,z.seen.get(_).schema}function y2(_,z){let A=_.seen.get(z);if(!A)throw Error("Unprocessed schema. This is a bug in Zod.");let b=new Map;for(let Y of _.seen.entries()){let X=_.metadataRegistry.get(Y[0])?.id;if(X){let Q=b.get(X);if(Q&&Q!==Y[0])throw Error(`Duplicate schema id "${X}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);b.set(X,Y[0])}}let G=(Y)=>{let X=_.target==="draft-2020-12"?"$defs":"definitions";if(_.external){let B=_.external.registry.get(Y[0])?.id,Z=_.external.uri??((K)=>K);if(B)return{ref:Z(B)};let F=Y[1].defId??Y[1].schema.id??`schema${_.counter++}`;return Y[1].defId=F,{defId:F,ref:`${Z("__shared")}#/${X}/${F}`}}if(Y[1]===A)return{ref:"#"};let $=`${"#"}/${X}/`,H=Y[1].schema.id??`__schema${_.counter++}`;return{defId:H,ref:$+H}},J=(Y)=>{if(Y[1].schema.$ref)return;let X=Y[1],{ref:Q,defId:$}=G(Y);if(X.def={...X.schema},$)X.defId=$;let H=X.schema;for(let B in H)delete H[B];H.$ref=Q};if(_.cycles==="throw")for(let Y of _.seen.entries()){let X=Y[1];if(X.cycle)throw Error(`Cycle detected: #/${X.cycle?.join("/")}/<root>
214
+ `)}q.write("payload.value = newResult;"),q.write("return payload;");let N=q.compile();return(L,M)=>N(Z,L,M)},Y,X=c_,b=!l6.jitless,$=b&&N2.value,H=z.catchall,B;_._zod.parse=(Z,q)=>{B??(B=G.value);let F=Z.value;if(!X(F))return Z.issues.push({expected:"object",code:"invalid_type",input:F,inst:_}),Z;if(b&&$&&q?.async===!1&&q.jitless!==!0){if(!Y)Y=J(z.shape);if(Z=Y(Z,q),!H)return Z;return ZB([],F,Z,q,B,_)}return A(Z,q)}});function PH(_,z,A,G){for(let Y of _)if(Y.issues.length===0)return z.value=Y.value,z;let J=_.filter((Y)=>!q_(Y));if(J.length===1)return z.value=J[0].value,J[0];return z.issues.push({code:"invalid_union",input:z.value,inst:A,errors:_.map((Y)=>Y.issues.map((X)=>n9(X,G,S9())))}),z}var C2=w("$ZodUnion",(_,z)=>{M0.init(_,z),H0(_._zod,"optin",()=>z.options.some((J)=>J._zod.optin==="optional")?"optional":void 0),H0(_._zod,"optout",()=>z.options.some((J)=>J._zod.optout==="optional")?"optional":void 0),H0(_._zod,"values",()=>{if(z.options.every((J)=>J._zod.values))return new Set(z.options.flatMap((J)=>Array.from(J._zod.values)));return}),H0(_._zod,"pattern",()=>{if(z.options.every((J)=>J._zod.pattern)){let J=z.options.map((Y)=>Y._zod.pattern);return new RegExp(`^(${J.map((Y)=>dz(Y.source)).join("|")})$`)}return});let A=z.options.length===1,G=z.options[0]._zod.run;_._zod.parse=(J,Y)=>{if(A)return G(J,Y);let X=!1,b=[];for(let Q of z.options){let $=Q._zod.run({value:J.value,issues:[]},Y);if($ instanceof Promise)b.push($),X=!0;else{if($.issues.length===0)return $;b.push($)}}if(!X)return PH(b,J,_,Y);return Promise.all(b).then((Q)=>{return PH(Q,J,_,Y)})}});var FB=w("$ZodDiscriminatedUnion",(_,z)=>{z.inclusive=!1,C2.init(_,z);let A=_._zod.parse;H0(_._zod,"propValues",()=>{let J={};for(let Y of z.options){let X=Y._zod.propValues;if(!X||Object.keys(X).length===0)throw Error(`Invalid discriminated union option at index "${z.options.indexOf(Y)}"`);for(let[b,Q]of Object.entries(X)){if(!J[b])J[b]=new Set;for(let $ of Q)J[b].add($)}}return J});let G=f1(()=>{let J=z.options,Y=new Map;for(let X of J){let b=X._zod.propValues?.[z.discriminator];if(!b||b.size===0)throw Error(`Invalid discriminated union option at index "${z.options.indexOf(X)}"`);for(let Q of b){if(Y.has(Q))throw Error(`Duplicate discriminator value "${String(Q)}"`);Y.set(Q,X)}}return Y});_._zod.parse=(J,Y)=>{let X=J.value;if(!c_(X))return J.issues.push({code:"invalid_type",expected:"object",input:X,inst:_}),J;let b=G.value.get(X?.[z.discriminator]);if(b)return b._zod.run(J,Y);if(z.unionFallback)return A(J,Y);return J.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:z.discriminator,input:X,path:[z.discriminator],inst:_}),J}}),KB=w("$ZodIntersection",(_,z)=>{M0.init(_,z),_._zod.parse=(A,G)=>{let J=A.value,Y=z.left._zod.run({value:J,issues:[]},G),X=z.right._zod.run({value:J,issues:[]},G);if(Y instanceof Promise||X instanceof Promise)return Promise.all([Y,X]).then(([Q,$])=>{return SH(A,Q,$)});return SH(A,Y,X)}});function x2(_,z){if(_===z)return{valid:!0,data:_};if(_ instanceof Date&&z instanceof Date&&+_===+z)return{valid:!0,data:_};if(Z_(_)&&Z_(z)){let A=Object.keys(z),G=Object.keys(_).filter((Y)=>A.indexOf(Y)!==-1),J={..._,...z};for(let Y of G){let X=x2(_[Y],z[Y]);if(!X.valid)return{valid:!1,mergeErrorPath:[Y,...X.mergeErrorPath]};J[Y]=X.data}return{valid:!0,data:J}}if(Array.isArray(_)&&Array.isArray(z)){if(_.length!==z.length)return{valid:!1,mergeErrorPath:[]};let A=[];for(let G=0;G<_.length;G++){let J=_[G],Y=z[G],X=x2(J,Y);if(!X.valid)return{valid:!1,mergeErrorPath:[G,...X.mergeErrorPath]};A.push(X.data)}return{valid:!0,data:A}}return{valid:!1,mergeErrorPath:[]}}function SH(_,z,A){let G=new Map,J;for(let b of z.issues)if(b.code==="unrecognized_keys"){J??(J=b);for(let Q of b.keys){if(!G.has(Q))G.set(Q,{});G.get(Q).l=!0}}else _.issues.push(b);for(let b of A.issues)if(b.code==="unrecognized_keys")for(let Q of b.keys){if(!G.has(Q))G.set(Q,{});G.get(Q).r=!0}else _.issues.push(b);let Y=[...G].filter(([,b])=>b.l&&b.r).map(([b])=>b);if(Y.length&&J)_.issues.push({...J,keys:Y});if(q_(_))return _;let X=x2(z.value,A.value);if(!X.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(X.mergeErrorPath)}`);return _.value=X.data,_}var WB=w("$ZodRecord",(_,z)=>{M0.init(_,z),_._zod.parse=(A,G)=>{let J=A.value;if(!Z_(J))return A.issues.push({expected:"record",code:"invalid_type",input:J,inst:_}),A;let Y=[],X=z.keyType._zod.values;if(X){A.value={};let b=new Set;for(let $ of X)if(typeof $==="string"||typeof $==="number"||typeof $==="symbol"){b.add(typeof $==="number"?$.toString():$);let H=z.valueType._zod.run({value:J[$],issues:[]},G);if(H instanceof Promise)Y.push(H.then((B)=>{if(B.issues.length)A.issues.push(...h4($,B.issues));A.value[$]=B.value}));else{if(H.issues.length)A.issues.push(...h4($,H.issues));A.value[$]=H.value}}let Q;for(let $ in J)if(!b.has($))Q=Q??[],Q.push($);if(Q&&Q.length>0)A.issues.push({code:"unrecognized_keys",input:J,inst:_,keys:Q})}else{A.value={};for(let b of Reflect.ownKeys(J)){if(b==="__proto__")continue;let Q=z.keyType._zod.run({value:b,issues:[]},G);if(Q instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof b==="string"&&t6.test(b)&&Q.issues.length&&Q.issues.some((B)=>B.code==="invalid_type"&&B.expected==="number")){let B=z.keyType._zod.run({value:Number(b),issues:[]},G);if(B instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(B.issues.length===0)Q=B}if(Q.issues.length){if(z.mode==="loose")A.value[b]=J[b];else A.issues.push({code:"invalid_key",origin:"record",issues:Q.issues.map((B)=>n9(B,G,S9())),input:b,path:[b],inst:_});continue}let H=z.valueType._zod.run({value:J[b],issues:[]},G);if(H instanceof Promise)Y.push(H.then((B)=>{if(B.issues.length)A.issues.push(...h4(b,B.issues));A.value[Q.value]=B.value}));else{if(H.issues.length)A.issues.push(...h4(b,H.issues));A.value[Q.value]=H.value}}}if(Y.length)return Promise.all(Y).then(()=>A);return A}});var VB=w("$ZodEnum",(_,z)=>{M0.init(_,z);let A=lz(z.entries),G=new Set(A);_._zod.values=G,_._zod.pattern=new RegExp(`^(${A.filter((J)=>E2.has(typeof J)).map((J)=>typeof J==="string"?f4(J):J.toString()).join("|")})$`),_._zod.parse=(J,Y)=>{let X=J.value;if(G.has(X))return J;return J.issues.push({code:"invalid_value",values:A,input:X,inst:_}),J}}),UB=w("$ZodLiteral",(_,z)=>{if(M0.init(_,z),z.values.length===0)throw Error("Cannot create literal schema with no valid values");let A=new Set(z.values);_._zod.values=A,_._zod.pattern=new RegExp(`^(${z.values.map((G)=>typeof G==="string"?f4(G):G?f4(G.toString()):String(G)).join("|")})$`),_._zod.parse=(G,J)=>{let Y=G.value;if(A.has(Y))return G;return G.issues.push({code:"invalid_value",values:z.values,input:Y,inst:_}),G}});var DB=w("$ZodTransform",(_,z)=>{M0.init(_,z),_._zod.parse=(A,G)=>{if(G.direction==="backward")throw new uz(_.constructor.name);let J=z.transform(A.value,A);if(G.async)return(J instanceof Promise?J:Promise.resolve(J)).then((X)=>{return A.value=X,A});if(J instanceof Promise)throw new y4;return A.value=J,A}});function kH(_,z){if(_.issues.length&&z===void 0)return{issues:[],value:void 0};return _}var v2=w("$ZodOptional",(_,z)=>{M0.init(_,z),_._zod.optin="optional",_._zod.optout="optional",H0(_._zod,"values",()=>{return z.innerType._zod.values?new Set([...z.innerType._zod.values,void 0]):void 0}),H0(_._zod,"pattern",()=>{let A=z.innerType._zod.pattern;return A?new RegExp(`^(${dz(A.source)})?$`):void 0}),_._zod.parse=(A,G)=>{if(z.innerType._zod.optin==="optional"){let J=z.innerType._zod.run(A,G);if(J instanceof Promise)return J.then((Y)=>kH(Y,A.value));return kH(J,A.value)}if(A.value===void 0)return A;return z.innerType._zod.run(A,G)}}),MB=w("$ZodExactOptional",(_,z)=>{v2.init(_,z),H0(_._zod,"values",()=>z.innerType._zod.values),H0(_._zod,"pattern",()=>z.innerType._zod.pattern),_._zod.parse=(A,G)=>{return z.innerType._zod.run(A,G)}}),NB=w("$ZodNullable",(_,z)=>{M0.init(_,z),H0(_._zod,"optin",()=>z.innerType._zod.optin),H0(_._zod,"optout",()=>z.innerType._zod.optout),H0(_._zod,"pattern",()=>{let A=z.innerType._zod.pattern;return A?new RegExp(`^(${dz(A.source)}|null)$`):void 0}),H0(_._zod,"values",()=>{return z.innerType._zod.values?new Set([...z.innerType._zod.values,null]):void 0}),_._zod.parse=(A,G)=>{if(A.value===null)return A;return z.innerType._zod.run(A,G)}}),EB=w("$ZodDefault",(_,z)=>{M0.init(_,z),_._zod.optin="optional",H0(_._zod,"values",()=>z.innerType._zod.values),_._zod.parse=(A,G)=>{if(G.direction==="backward")return z.innerType._zod.run(A,G);if(A.value===void 0)return A.value=z.defaultValue,A;let J=z.innerType._zod.run(A,G);if(J instanceof Promise)return J.then((Y)=>IH(Y,z));return IH(J,z)}});function IH(_,z){if(_.value===void 0)_.value=z.defaultValue;return _}var wB=w("$ZodPrefault",(_,z)=>{M0.init(_,z),_._zod.optin="optional",H0(_._zod,"values",()=>z.innerType._zod.values),_._zod.parse=(A,G)=>{if(G.direction==="backward")return z.innerType._zod.run(A,G);if(A.value===void 0)A.value=z.defaultValue;return z.innerType._zod.run(A,G)}}),OB=w("$ZodNonOptional",(_,z)=>{M0.init(_,z),H0(_._zod,"values",()=>{let A=z.innerType._zod.values;return A?new Set([...A].filter((G)=>G!==void 0)):void 0}),_._zod.parse=(A,G)=>{let J=z.innerType._zod.run(A,G);if(J instanceof Promise)return J.then((Y)=>xH(Y,_));return xH(J,_)}});function xH(_,z){if(!_.issues.length&&_.value===void 0)_.issues.push({code:"invalid_type",expected:"nonoptional",input:_.value,inst:z});return _}var LB=w("$ZodCatch",(_,z)=>{M0.init(_,z),H0(_._zod,"optin",()=>z.innerType._zod.optin),H0(_._zod,"optout",()=>z.innerType._zod.optout),H0(_._zod,"values",()=>z.innerType._zod.values),_._zod.parse=(A,G)=>{if(G.direction==="backward")return z.innerType._zod.run(A,G);let J=z.innerType._zod.run(A,G);if(J instanceof Promise)return J.then((Y)=>{if(A.value=Y.value,Y.issues.length)A.value=z.catchValue({...A,error:{issues:Y.issues.map((X)=>n9(X,G,S9()))},input:A.value}),A.issues=[];return A});if(A.value=J.value,J.issues.length)A.value=z.catchValue({...A,error:{issues:J.issues.map((Y)=>n9(Y,G,S9()))},input:A.value}),A.issues=[];return A}});var jB=w("$ZodPipe",(_,z)=>{M0.init(_,z),H0(_._zod,"values",()=>z.in._zod.values),H0(_._zod,"optin",()=>z.in._zod.optin),H0(_._zod,"optout",()=>z.out._zod.optout),H0(_._zod,"propValues",()=>z.in._zod.propValues),_._zod.parse=(A,G)=>{if(G.direction==="backward"){let Y=z.out._zod.run(A,G);if(Y instanceof Promise)return Y.then((X)=>_8(X,z.in,G));return _8(Y,z.in,G)}let J=z.in._zod.run(A,G);if(J instanceof Promise)return J.then((Y)=>_8(Y,z.out,G));return _8(J,z.out,G)}});function _8(_,z,A){if(_.issues.length)return _.aborted=!0,_;return z._zod.run({value:_.value,issues:_.issues},A)}var RB=w("$ZodReadonly",(_,z)=>{M0.init(_,z),H0(_._zod,"propValues",()=>z.innerType._zod.propValues),H0(_._zod,"values",()=>z.innerType._zod.values),H0(_._zod,"optin",()=>z.innerType?._zod?.optin),H0(_._zod,"optout",()=>z.innerType?._zod?.optout),_._zod.parse=(A,G)=>{if(G.direction==="backward")return z.innerType._zod.run(A,G);let J=z.innerType._zod.run(A,G);if(J instanceof Promise)return J.then(TH);return TH(J)}});function TH(_){return _.value=Object.freeze(_.value),_}var PB=w("$ZodCustom",(_,z)=>{c0.init(_,z),M0.init(_,z),_._zod.parse=(A,G)=>{return A},_._zod.check=(A)=>{let G=A.value,J=z.fn(G);if(J instanceof Promise)return J.then((Y)=>CH(Y,A,G,_));CH(J,A,G,_);return}});function CH(_,z,A,G){if(!_){let J={code:"custom",input:A,inst:G,path:[...G._zod.def.path??[]],continue:!G._zod.def.abort};if(G._zod.def.params)J.params=G._zod.def.params;z.issues.push(h1(J))}}var tI=()=>{let _={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function z(J){return _[J]??null}let A={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",mac:"MAC 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"},G={nan:"NaN"};return(J)=>{switch(J.code){case"invalid_type":{let Y=G[J.expected]??J.expected,X=L2(J.input),b=G[X]??X;return`Invalid input: expected ${Y}, received ${b}`}case"invalid_value":if(J.values.length===1)return`Invalid input: expected ${n6(J.values[0])}`;return`Invalid option: expected one of ${p6(J.values,"|")}`;case"too_big":{let Y=J.inclusive?"<=":"<",X=z(J.origin);if(X)return`Too big: expected ${J.origin??"value"} to have ${Y}${J.maximum.toString()} ${X.unit??"elements"}`;return`Too big: expected ${J.origin??"value"} to be ${Y}${J.maximum.toString()}`}case"too_small":{let Y=J.inclusive?">=":">",X=z(J.origin);if(X)return`Too small: expected ${J.origin} to have ${Y}${J.minimum.toString()} ${X.unit}`;return`Too small: expected ${J.origin} to be ${Y}${J.minimum.toString()}`}case"invalid_format":{let Y=J;if(Y.format==="starts_with")return`Invalid string: must start with "${Y.prefix}"`;if(Y.format==="ends_with")return`Invalid string: must end with "${Y.suffix}"`;if(Y.format==="includes")return`Invalid string: must include "${Y.includes}"`;if(Y.format==="regex")return`Invalid string: must match pattern ${Y.pattern}`;return`Invalid ${A[Y.format]??J.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${J.divisor}`;case"unrecognized_keys":return`Unrecognized key${J.keys.length>1?"s":""}: ${p6(J.keys,", ")}`;case"invalid_key":return`Invalid key in ${J.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${J.origin}`;default:return"Invalid input"}}};function y2(){return{localeError:tI()}}var SB,X40=Symbol("ZodOutput"),b40=Symbol("ZodInput");class kB{constructor(){this._map=new WeakMap,this._idmap=new Map}add(_,...z){let A=z[0];if(this._map.set(_,A),A&&typeof A==="object"&&"id"in A)this._idmap.set(A.id,_);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(_){let z=this._map.get(_);if(z&&typeof z==="object"&&"id"in z)this._idmap.delete(z.id);return this._map.delete(_),this}get(_){let z=_._zod.parent;if(z){let A={...this.get(z)??{}};delete A.id;let G={...A,...this._map.get(_)};return Object.keys(G).length?G:void 0}return this._map.get(_)}has(_){return this._map.has(_)}}function eI(){return new kB}(SB=globalThis).__zod_globalRegistry??(SB.__zod_globalRegistry=eI());var l_=globalThis.__zod_globalRegistry;function IB(_,z){return new _({type:"string",...c(z)})}function xB(_,z){return new _({type:"string",format:"email",check:"string_format",abort:!1,...c(z)})}function g2(_,z){return new _({type:"string",format:"guid",check:"string_format",abort:!1,...c(z)})}function TB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,...c(z)})}function CB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...c(z)})}function vB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...c(z)})}function yB(_,z){return new _({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...c(z)})}function gB(_,z){return new _({type:"string",format:"url",check:"string_format",abort:!1,...c(z)})}function fB(_,z){return new _({type:"string",format:"emoji",check:"string_format",abort:!1,...c(z)})}function hB(_,z){return new _({type:"string",format:"nanoid",check:"string_format",abort:!1,...c(z)})}function mB(_,z){return new _({type:"string",format:"cuid",check:"string_format",abort:!1,...c(z)})}function uB(_,z){return new _({type:"string",format:"cuid2",check:"string_format",abort:!1,...c(z)})}function cB(_,z){return new _({type:"string",format:"ulid",check:"string_format",abort:!1,...c(z)})}function lB(_,z){return new _({type:"string",format:"xid",check:"string_format",abort:!1,...c(z)})}function pB(_,z){return new _({type:"string",format:"ksuid",check:"string_format",abort:!1,...c(z)})}function dB(_,z){return new _({type:"string",format:"ipv4",check:"string_format",abort:!1,...c(z)})}function rB(_,z){return new _({type:"string",format:"ipv6",check:"string_format",abort:!1,...c(z)})}function nB(_,z){return new _({type:"string",format:"cidrv4",check:"string_format",abort:!1,...c(z)})}function iB(_,z){return new _({type:"string",format:"cidrv6",check:"string_format",abort:!1,...c(z)})}function oB(_,z){return new _({type:"string",format:"base64",check:"string_format",abort:!1,...c(z)})}function aB(_,z){return new _({type:"string",format:"base64url",check:"string_format",abort:!1,...c(z)})}function sB(_,z){return new _({type:"string",format:"e164",check:"string_format",abort:!1,...c(z)})}function tB(_,z){return new _({type:"string",format:"jwt",check:"string_format",abort:!1,...c(z)})}function eB(_,z){return new _({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...c(z)})}function _Z(_,z){return new _({type:"string",format:"date",check:"string_format",...c(z)})}function zZ(_,z){return new _({type:"string",format:"time",check:"string_format",precision:null,...c(z)})}function AZ(_,z){return new _({type:"string",format:"duration",check:"string_format",...c(z)})}function GZ(_,z){return new _({type:"number",checks:[],...c(z)})}function JZ(_,z){return new _({type:"number",check:"number_format",abort:!1,format:"safeint",...c(z)})}function YZ(_,z){return new _({type:"boolean",...c(z)})}function XZ(_,z){return new _({type:"null",...c(z)})}function bZ(_){return new _({type:"unknown"})}function QZ(_,z){return new _({type:"never",...c(z)})}function G8(_,z){return new S2({check:"less_than",...c(z),value:_,inclusive:!1})}function sz(_,z){return new S2({check:"less_than",...c(z),value:_,inclusive:!0})}function J8(_,z){return new k2({check:"greater_than",...c(z),value:_,inclusive:!1})}function tz(_,z){return new k2({check:"greater_than",...c(z),value:_,inclusive:!0})}function Y8(_,z){return new qH({check:"multiple_of",...c(z),value:_})}function X8(_,z){return new KH({check:"max_length",...c(z),maximum:_})}function m1(_,z){return new WH({check:"min_length",...c(z),minimum:_})}function b8(_,z){return new VH({check:"length_equals",...c(z),length:_})}function f2(_,z){return new UH({check:"string_format",format:"regex",...c(z),pattern:_})}function h2(_){return new DH({check:"string_format",format:"lowercase",...c(_)})}function m2(_){return new MH({check:"string_format",format:"uppercase",...c(_)})}function u2(_,z){return new NH({check:"string_format",format:"includes",...c(z),includes:_})}function c2(_,z){return new EH({check:"string_format",format:"starts_with",...c(z),prefix:_})}function l2(_,z){return new wH({check:"string_format",format:"ends_with",...c(z),suffix:_})}function F_(_){return new OH({check:"overwrite",tx:_})}function p2(_){return F_((z)=>z.normalize(_))}function d2(){return F_((_)=>_.trim())}function r2(){return F_((_)=>_.toLowerCase())}function n2(){return F_((_)=>_.toUpperCase())}function i2(){return F_((_)=>M2(_))}function $Z(_,z,A){return new _({type:"array",element:z,...c(A)})}function HZ(_,z,A){let G=c(A);return G.abort??(G.abort=!0),new _({type:"custom",check:"custom",fn:z,...G})}function BZ(_,z,A){return new _({type:"custom",check:"custom",fn:z,...c(A)})}function ZZ(_){let z=_x((A)=>{return A.addIssue=(G)=>{if(typeof G==="string")A.issues.push(h1(G,A.value,z._zod.def));else{let J=G;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=A.value),J.inst??(J.inst=z),J.continue??(J.continue=!z._zod.def.abort),A.issues.push(h1(J))}},_(A.value,A)});return z}function _x(_,z){let A=new c0({check:"custom",...c(z)});return A._zod.check=_,A}function o2(_){let z=_?.target??"draft-2020-12";if(z==="draft-4")z="draft-04";if(z==="draft-7")z="draft-07";return{processors:_.processors??{},metadataRegistry:_?.metadata??l_,target:z,unrepresentable:_?.unrepresentable??"throw",override:_?.override??(()=>{}),io:_?.io??"output",counter:0,seen:new Map,cycles:_?.cycles??"ref",reused:_?.reused??"inline",external:_?.external??void 0}}function x0(_,z,A={path:[],schemaPath:[]}){var G;let J=_._zod.def,Y=z.seen.get(_);if(Y){if(Y.count++,A.schemaPath.includes(_))Y.cycle=A.path;return Y.schema}let X={schema:{},count:1,cycle:void 0,path:A.path};z.seen.set(_,X);let b=_._zod.toJSONSchema?.();if(b)X.schema=b;else{let H={...A,schemaPath:[...A.schemaPath,_],path:A.path};if(_._zod.processJSONSchema)_._zod.processJSONSchema(z,X.schema,H);else{let Z=X.schema,q=z.processors[J.type];if(!q)throw Error(`[toJSONSchema]: Non-representable type encountered: ${J.type}`);q(_,z,Z,H)}let B=_._zod.parent;if(B){if(!X.ref)X.ref=B;x0(B,z,H),z.seen.get(B).isParent=!0}}let Q=z.metadataRegistry.get(_);if(Q)Object.assign(X.schema,Q);if(z.io==="input"&&G9(_))delete X.schema.examples,delete X.schema.default;if(z.io==="input"&&X.schema._prefault)(G=X.schema).default??(G.default=X.schema._prefault);return delete X.schema._prefault,z.seen.get(_).schema}function a2(_,z){let A=_.seen.get(z);if(!A)throw Error("Unprocessed schema. This is a bug in Zod.");let G=new Map;for(let X of _.seen.entries()){let b=_.metadataRegistry.get(X[0])?.id;if(b){let Q=G.get(b);if(Q&&Q!==X[0])throw Error(`Duplicate schema id "${b}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);G.set(b,X[0])}}let J=(X)=>{let b=_.target==="draft-2020-12"?"$defs":"definitions";if(_.external){let B=_.external.registry.get(X[0])?.id,Z=_.external.uri??((F)=>F);if(B)return{ref:Z(B)};let q=X[1].defId??X[1].schema.id??`schema${_.counter++}`;return X[1].defId=q,{defId:q,ref:`${Z("__shared")}#/${b}/${q}`}}if(X[1]===A)return{ref:"#"};let $=`${"#"}/${b}/`,H=X[1].schema.id??`__schema${_.counter++}`;return{defId:H,ref:$+H}},Y=(X)=>{if(X[1].schema.$ref)return;let b=X[1],{ref:Q,defId:$}=J(X);if(b.def={...b.schema},$)b.defId=$;let H=b.schema;for(let B in H)delete H[B];H.$ref=Q};if(_.cycles==="throw")for(let X of _.seen.entries()){let b=X[1];if(b.cycle)throw Error(`Cycle detected: #/${b.cycle?.join("/")}/<root>
204
215
 
205
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let Y of _.seen.entries()){let X=Y[1];if(z===Y[0]){J(Y);continue}if(_.external){let $=_.external.registry.get(Y[0])?.id;if(z!==Y[0]&&$){J(Y);continue}}if(_.metadataRegistry.get(Y[0])?.id){J(Y);continue}if(X.cycle){J(Y);continue}if(X.count>1){if(_.reused==="ref"){J(Y);continue}}}}function g2(_,z){let A=_.seen.get(z);if(!A)throw Error("Unprocessed schema. This is a bug in Zod.");let b=(Y)=>{let X=_.seen.get(Y);if(X.ref===null)return;let Q=X.def??X.schema,$={...Q},H=X.ref;if(X.ref=null,H){b(H);let Z=_.seen.get(H),F=Z.schema;if(F.$ref&&(_.target==="draft-07"||_.target==="draft-04"||_.target==="openapi-3.0"))Q.allOf=Q.allOf??[],Q.allOf.push(F);else Object.assign(Q,F);if(Object.assign(Q,$),Y._zod.parent===H)for(let q in Q){if(q==="$ref"||q==="allOf")continue;if(!(q in $))delete Q[q]}if(F.$ref)for(let q in Q){if(q==="$ref"||q==="allOf")continue;if(q in Z.def&&JSON.stringify(Q[q])===JSON.stringify(Z.def[q]))delete Q[q]}}let B=Y._zod.parent;if(B&&B!==H){b(B);let Z=_.seen.get(B);if(Z?.schema.$ref){if(Q.$ref=Z.schema.$ref,Z.def)for(let F in Q){if(F==="$ref"||F==="allOf")continue;if(F in Z.def&&JSON.stringify(Q[F])===JSON.stringify(Z.def[F]))delete Q[F]}}}_.override({zodSchema:Y,jsonSchema:Q,path:X.path??[]})};for(let Y of[..._.seen.entries()].reverse())b(Y[0]);let G={};if(_.target==="draft-2020-12")G.$schema="https://json-schema.org/draft/2020-12/schema";else if(_.target==="draft-07")G.$schema="http://json-schema.org/draft-07/schema#";else if(_.target==="draft-04")G.$schema="http://json-schema.org/draft-04/schema#";else if(_.target==="openapi-3.0");if(_.external?.uri){let Y=_.external.registry.get(z)?.id;if(!Y)throw Error("Schema is missing an `id` property");G.$id=_.external.uri(Y)}Object.assign(G,A.def??A.schema);let J=_.external?.defs??{};for(let Y of _.seen.entries()){let X=Y[1];if(X.def&&X.defId)J[X.defId]=X.def}if(_.external);else if(Object.keys(J).length>0)if(_.target==="draft-2020-12")G.$defs=J;else G.definitions=J;try{let Y=JSON.parse(JSON.stringify(G));return Object.defineProperty(Y,"~standard",{value:{...z["~standard"],jsonSchema:{input:nz(z,"input",_.processors),output:nz(z,"output",_.processors)}},enumerable:!1,writable:!1}),Y}catch(Y){throw Error("Error converting schema to JSON.")}}function z9(_,z){let A=z??{seen:new Set};if(A.seen.has(_))return!1;A.seen.add(_);let b=_._zod.def;if(b.type==="transform")return!0;if(b.type==="array")return z9(b.element,A);if(b.type==="set")return z9(b.valueType,A);if(b.type==="lazy")return z9(b.getter(),A);if(b.type==="promise"||b.type==="optional"||b.type==="nonoptional"||b.type==="nullable"||b.type==="readonly"||b.type==="default"||b.type==="prefault")return z9(b.innerType,A);if(b.type==="intersection")return z9(b.left,A)||z9(b.right,A);if(b.type==="record"||b.type==="map")return z9(b.keyType,A)||z9(b.valueType,A);if(b.type==="pipe")return z9(b.in,A)||z9(b.out,A);if(b.type==="object"){for(let G in b.shape)if(z9(b.shape[G],A))return!0;return!1}if(b.type==="union"){for(let G of b.options)if(z9(G,A))return!0;return!1}if(b.type==="tuple"){for(let G of b.items)if(z9(G,A))return!0;if(b.rest&&z9(b.rest,A))return!0;return!1}return!1}var hB=(_,z={})=>(A)=>{let b=v2({...A,processors:z});return I0(_,b),y2(b,_),g2(b,_)},nz=(_,z,A={})=>(b)=>{let{libraryOptions:G,target:J}=b??{},Y=v2({...G??{},target:J,io:z,processors:A});return I0(_,Y),y2(Y,_),g2(Y,_)};var mk={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},mB=(_,z,A,b)=>{let G=A;G.type="string";let{minimum:J,maximum:Y,format:X,patterns:Q,contentEncoding:$}=_._zod.bag;if(typeof J==="number")G.minLength=J;if(typeof Y==="number")G.maxLength=Y;if(X){if(G.format=mk[X]??X,G.format==="")delete G.format;if(X==="time")delete G.format}if($)G.contentEncoding=$;if(Q&&Q.size>0){let H=[...Q];if(H.length===1)G.pattern=H[0].source;else if(H.length>1)G.allOf=[...H.map((B)=>({...z.target==="draft-07"||z.target==="draft-04"||z.target==="openapi-3.0"?{type:"string"}:{},pattern:B.source}))]}},uB=(_,z,A,b)=>{let G=A,{minimum:J,maximum:Y,format:X,multipleOf:Q,exclusiveMaximum:$,exclusiveMinimum:H}=_._zod.bag;if(typeof X==="string"&&X.includes("int"))G.type="integer";else G.type="number";if(typeof H==="number")if(z.target==="draft-04"||z.target==="openapi-3.0")G.minimum=H,G.exclusiveMinimum=!0;else G.exclusiveMinimum=H;if(typeof J==="number"){if(G.minimum=J,typeof H==="number"&&z.target!=="draft-04")if(H>=J)delete G.minimum;else delete G.exclusiveMinimum}if(typeof $==="number")if(z.target==="draft-04"||z.target==="openapi-3.0")G.maximum=$,G.exclusiveMaximum=!0;else G.exclusiveMaximum=$;if(typeof Y==="number"){if(G.maximum=Y,typeof $==="number"&&z.target!=="draft-04")if($<=Y)delete G.maximum;else delete G.exclusiveMaximum}if(typeof Q==="number")G.multipleOf=Q},cB=(_,z,A,b)=>{A.type="boolean"};var lB=(_,z,A,b)=>{if(z.target==="openapi-3.0")A.type="string",A.nullable=!0,A.enum=[null];else A.type="null"};var pB=(_,z,A,b)=>{A.not={}};var dB=(_,z,A,b)=>{};var rB=(_,z,A,b)=>{let G=_._zod.def,J=gz(G.entries);if(J.every((Y)=>typeof Y==="number"))A.type="number";if(J.every((Y)=>typeof Y==="string"))A.type="string";A.enum=J},nB=(_,z,A,b)=>{let G=_._zod.def,J=[];for(let Y of G.values)if(Y===void 0){if(z.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof Y==="bigint")if(z.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else J.push(Number(Y));else J.push(Y);if(J.length===0);else if(J.length===1){let Y=J[0];if(A.type=Y===null?"null":typeof Y,z.target==="draft-04"||z.target==="openapi-3.0")A.enum=[Y];else A.const=Y}else{if(J.every((Y)=>typeof Y==="number"))A.type="number";if(J.every((Y)=>typeof Y==="string"))A.type="string";if(J.every((Y)=>typeof Y==="boolean"))A.type="boolean";if(J.every((Y)=>Y===null))A.type="null";A.enum=J}};var iB=(_,z,A,b)=>{if(z.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var oB=(_,z,A,b)=>{if(z.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var aB=(_,z,A,b)=>{let G=A,J=_._zod.def,{minimum:Y,maximum:X}=_._zod.bag;if(typeof Y==="number")G.minItems=Y;if(typeof X==="number")G.maxItems=X;G.type="array",G.items=I0(J.element,z,{...b,path:[...b.path,"items"]})},sB=(_,z,A,b)=>{let G=A,J=_._zod.def;G.type="object",G.properties={};let Y=J.shape;for(let $ in Y)G.properties[$]=I0(Y[$],z,{...b,path:[...b.path,"properties",$]});let X=new Set(Object.keys(Y)),Q=new Set([...X].filter(($)=>{let H=J.shape[$]._zod;if(z.io==="input")return H.optin===void 0;else return H.optout===void 0}));if(Q.size>0)G.required=Array.from(Q);if(J.catchall?._zod.def.type==="never")G.additionalProperties=!1;else if(!J.catchall){if(z.io==="output")G.additionalProperties=!1}else if(J.catchall)G.additionalProperties=I0(J.catchall,z,{...b,path:[...b.path,"additionalProperties"]})},tB=(_,z,A,b)=>{let G=_._zod.def,J=G.inclusive===!1,Y=G.options.map((X,Q)=>I0(X,z,{...b,path:[...b.path,J?"oneOf":"anyOf",Q]}));if(J)A.oneOf=Y;else A.anyOf=Y},eB=(_,z,A,b)=>{let G=_._zod.def,J=I0(G.left,z,{...b,path:[...b.path,"allOf",0]}),Y=I0(G.right,z,{...b,path:[...b.path,"allOf",1]}),X=($)=>("allOf"in $)&&Object.keys($).length===1,Q=[...X(J)?J.allOf:[J],...X(Y)?Y.allOf:[Y]];A.allOf=Q};var _Z=(_,z,A,b)=>{let G=A,J=_._zod.def;G.type="object";let Y=J.keyType,Q=Y._zod.bag?.patterns;if(J.mode==="loose"&&Q&&Q.size>0){let H=I0(J.valueType,z,{...b,path:[...b.path,"patternProperties","*"]});G.patternProperties={};for(let B of Q)G.patternProperties[B.source]=H}else{if(z.target==="draft-07"||z.target==="draft-2020-12")G.propertyNames=I0(J.keyType,z,{...b,path:[...b.path,"propertyNames"]});G.additionalProperties=I0(J.valueType,z,{...b,path:[...b.path,"additionalProperties"]})}let $=Y._zod.values;if($){let H=[...$].filter((B)=>typeof B==="string"||typeof B==="number");if(H.length>0)G.required=H}},zZ=(_,z,A,b)=>{let G=_._zod.def,J=I0(G.innerType,z,b),Y=z.seen.get(_);if(z.target==="openapi-3.0")Y.ref=G.innerType,A.nullable=!0;else A.anyOf=[J,{type:"null"}]},AZ=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);J.ref=G.innerType},bZ=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);J.ref=G.innerType,A.default=JSON.parse(JSON.stringify(G.defaultValue))},GZ=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);if(J.ref=G.innerType,z.io==="input")A._prefault=JSON.parse(JSON.stringify(G.defaultValue))},JZ=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);J.ref=G.innerType;let Y;try{Y=G.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}A.default=Y},YZ=(_,z,A,b)=>{let G=_._zod.def,J=z.io==="input"?G.in._zod.def.type==="transform"?G.out:G.in:G.out;I0(J,z,b);let Y=z.seen.get(_);Y.ref=J},XZ=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);J.ref=G.innerType,A.readOnly=!0};var f2=(_,z,A,b)=>{let G=_._zod.def;I0(G.innerType,z,b);let J=z.seen.get(_);J.ref=G.innerType};function C1(_){return!!_._zod}function b_(_,z){if(C1(_))return cz(_,z);return _.safeParse(z)}function _A(_){if(!_)return;let z;if(C1(_))z=_._zod?.def?.shape;else z=_.shape;if(!z)return;if(typeof z==="function")try{return z()}catch{return}return z}function QZ(_){if(C1(_)){let J=_._zod?.def;if(J){if(J.value!==void 0)return J.value;if(Array.isArray(J.values)&&J.values.length>0)return J.values[0]}}let A=_._def;if(A){if(A.value!==void 0)return A.value;if(Array.isArray(A.values)&&A.values.length>0)return A.values[0]}let b=_.value;if(b!==void 0)return b;return}var oz={};J8(oz,{time:()=>u2,duration:()=>c2,datetime:()=>h2,date:()=>m2,ZodISOTime:()=>BZ,ZodISODuration:()=>ZZ,ZodISODateTime:()=>$Z,ZodISODate:()=>HZ});var $Z=E("ZodISODateTime",(_,z)=>{UH.init(_,z),L0.init(_,z)});function h2(_){return LB($Z,_)}var HZ=E("ZodISODate",(_,z)=>{DH.init(_,z),L0.init(_,z)});function m2(_){return jB(HZ,_)}var BZ=E("ZodISOTime",(_,z)=>{MH.init(_,z),L0.init(_,z)});function u2(_){return RB(BZ,_)}var ZZ=E("ZodISODuration",(_,z)=>{NH.init(_,z),L0.init(_,z)});function c2(_){return PB(ZZ,_)}var FZ=(_,z)=>{m6.init(_,z),_.name="ZodError",Object.defineProperties(_,{format:{value:(A)=>A$(_,A)},flatten:{value:(A)=>z$(_,A)},addIssue:{value:(A)=>{_.issues.push(A),_.message=JSON.stringify(_.issues,k1,2)}},addIssues:{value:(A)=>{_.issues.push(...A),_.message=JSON.stringify(_.issues,k1,2)}},isEmpty:{get(){return _.issues.length===0}}})},G90=E("ZodError",FZ),V9=E("ZodError",FZ,{Parent:Error});var KZ=u6(V9),qZ=c6(V9),WZ=uz(V9),VZ=lz(V9),UZ=b$(V9),DZ=G$(V9),MZ=J$(V9),NZ=Y$(V9),wZ=X$(V9),EZ=Q$(V9),OZ=$$(V9),LZ=H$(V9);var R0=E("ZodType",(_,z)=>{return M0.init(_,z),Object.assign(_["~standard"],{jsonSchema:{input:nz(_,"input"),output:nz(_,"output")}}),_.toJSONSchema=hB(_,{}),_.def=z,_.type=z.type,Object.defineProperty(_,"_def",{value:z}),_.check=(...A)=>{return _.clone(X0.mergeDefs(z,{checks:[...z.checks??[],...A.map((b)=>typeof b==="function"?{_zod:{check:b,def:{check:"custom"},onattach:[]}}:b)]}),{parent:!0})},_.with=_.check,_.clone=(A,b)=>l9(_,A,b),_.brand=()=>_,_.register=(A,b)=>{return A.add(_,b),_},_.parse=(A,b)=>KZ(_,A,b,{callee:_.parse}),_.safeParse=(A,b)=>WZ(_,A,b),_.parseAsync=async(A,b)=>qZ(_,A,b,{callee:_.parseAsync}),_.safeParseAsync=async(A,b)=>VZ(_,A,b),_.spa=_.safeParseAsync,_.encode=(A,b)=>UZ(_,A,b),_.decode=(A,b)=>DZ(_,A,b),_.encodeAsync=async(A,b)=>MZ(_,A,b),_.decodeAsync=async(A,b)=>NZ(_,A,b),_.safeEncode=(A,b)=>wZ(_,A,b),_.safeDecode=(A,b)=>EZ(_,A,b),_.safeEncodeAsync=async(A,b)=>OZ(_,A,b),_.safeDecodeAsync=async(A,b)=>LZ(_,A,b),_.refine=(A,b)=>_.check(hI(A,b)),_.superRefine=(A)=>_.check(mI(A)),_.overwrite=(A)=>_.check(A_(A)),_.optional=()=>k0(_),_.exactOptional=()=>RI(_),_.nullable=()=>PZ(_),_.nullish=()=>k0(PZ(_)),_.nonoptional=(A)=>TI(_,A),_.array=()=>A0(_),_.or=(A)=>U0([_,A]),_.and=(A)=>AA(_,A),_.transform=(A)=>p2(_,TZ(A)),_.default=(A)=>kI(_,A),_.prefault=(A)=>xI(_,A),_.catch=(A)=>vI(_,A),_.pipe=(A)=>p2(_,A),_.readonly=()=>fI(_),_.describe=(A)=>{let b=_.clone();return T_.add(b,{description:A}),b},Object.defineProperty(_,"description",{get(){return T_.get(_)?.description},configurable:!0}),_.meta=(...A)=>{if(A.length===0)return T_.get(_);let b=_.clone();return T_.add(b,A[0]),b},_.isOptional=()=>_.safeParse(void 0).success,_.isNullable=()=>_.safeParse(null).success,_.apply=(A)=>A(_),_}),SZ=E("_ZodString",(_,z)=>{i6.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(b,G,J)=>mB(_,b,G,J);let A=_._zod.bag;_.format=A.format??null,_.minLength=A.minimum??null,_.maxLength=A.maximum??null,_.regex=(...b)=>_.check(O2(...b)),_.includes=(...b)=>_.check(R2(...b)),_.startsWith=(...b)=>_.check(P2(...b)),_.endsWith=(...b)=>_.check(S2(...b)),_.min=(...b)=>_.check(T1(...b)),_.max=(...b)=>_.check(t6(...b)),_.length=(...b)=>_.check(e6(...b)),_.nonempty=(...b)=>_.check(T1(1,...b)),_.lowercase=(b)=>_.check(L2(b)),_.uppercase=(b)=>_.check(j2(b)),_.trim=()=>_.check(I2()),_.normalize=(...b)=>_.check(k2(...b)),_.toLowerCase=()=>_.check(x2()),_.toUpperCase=()=>_.check(T2()),_.slugify=()=>_.check(C2())}),ak=E("ZodString",(_,z)=>{i6.init(_,z),SZ.init(_,z),_.email=(A)=>_.check(GB(sk,A)),_.url=(A)=>_.check($B(tk,A)),_.jwt=(A)=>_.check(OB(FI,A)),_.emoji=(A)=>_.check(HB(ek,A)),_.guid=(A)=>_.check(E2(jZ,A)),_.uuid=(A)=>_.check(JB(zA,A)),_.uuidv4=(A)=>_.check(YB(zA,A)),_.uuidv6=(A)=>_.check(XB(zA,A)),_.uuidv7=(A)=>_.check(QB(zA,A)),_.nanoid=(A)=>_.check(BB(_I,A)),_.guid=(A)=>_.check(E2(jZ,A)),_.cuid=(A)=>_.check(ZB(zI,A)),_.cuid2=(A)=>_.check(FB(AI,A)),_.ulid=(A)=>_.check(KB(bI,A)),_.base64=(A)=>_.check(NB(HI,A)),_.base64url=(A)=>_.check(wB(BI,A)),_.xid=(A)=>_.check(qB(GI,A)),_.ksuid=(A)=>_.check(WB(JI,A)),_.ipv4=(A)=>_.check(VB(YI,A)),_.ipv6=(A)=>_.check(UB(XI,A)),_.cidrv4=(A)=>_.check(DB(QI,A)),_.cidrv6=(A)=>_.check(MB($I,A)),_.e164=(A)=>_.check(EB(ZI,A)),_.datetime=(A)=>_.check(h2(A)),_.date=(A)=>_.check(m2(A)),_.time=(A)=>_.check(u2(A)),_.duration=(A)=>_.check(c2(A))});function N(_){return bB(ak,_)}var L0=E("ZodStringFormat",(_,z)=>{N0.init(_,z),SZ.init(_,z)}),sk=E("ZodEmail",(_,z)=>{$H.init(_,z),L0.init(_,z)});var jZ=E("ZodGUID",(_,z)=>{XH.init(_,z),L0.init(_,z)});var zA=E("ZodUUID",(_,z)=>{QH.init(_,z),L0.init(_,z)});var tk=E("ZodURL",(_,z)=>{HH.init(_,z),L0.init(_,z)});var ek=E("ZodEmoji",(_,z)=>{BH.init(_,z),L0.init(_,z)});var _I=E("ZodNanoID",(_,z)=>{ZH.init(_,z),L0.init(_,z)});var zI=E("ZodCUID",(_,z)=>{FH.init(_,z),L0.init(_,z)});var AI=E("ZodCUID2",(_,z)=>{KH.init(_,z),L0.init(_,z)});var bI=E("ZodULID",(_,z)=>{qH.init(_,z),L0.init(_,z)});var GI=E("ZodXID",(_,z)=>{WH.init(_,z),L0.init(_,z)});var JI=E("ZodKSUID",(_,z)=>{VH.init(_,z),L0.init(_,z)});var YI=E("ZodIPv4",(_,z)=>{wH.init(_,z),L0.init(_,z)});var XI=E("ZodIPv6",(_,z)=>{EH.init(_,z),L0.init(_,z)});var QI=E("ZodCIDRv4",(_,z)=>{OH.init(_,z),L0.init(_,z)});var $I=E("ZodCIDRv6",(_,z)=>{LH.init(_,z),L0.init(_,z)});var HI=E("ZodBase64",(_,z)=>{RH.init(_,z),L0.init(_,z)});var BI=E("ZodBase64URL",(_,z)=>{PH.init(_,z),L0.init(_,z)});var ZI=E("ZodE164",(_,z)=>{SH.init(_,z),L0.init(_,z)});var FI=E("ZodJWT",(_,z)=>{kH.init(_,z),L0.init(_,z)});var kZ=E("ZodNumber",(_,z)=>{D2.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(b,G,J)=>uB(_,b,G,J),_.gt=(b,G)=>_.check(a6(b,G)),_.gte=(b,G)=>_.check(rz(b,G)),_.min=(b,G)=>_.check(rz(b,G)),_.lt=(b,G)=>_.check(o6(b,G)),_.lte=(b,G)=>_.check(dz(b,G)),_.max=(b,G)=>_.check(dz(b,G)),_.int=(b)=>_.check(RZ(b)),_.safe=(b)=>_.check(RZ(b)),_.positive=(b)=>_.check(a6(0,b)),_.nonnegative=(b)=>_.check(rz(0,b)),_.negative=(b)=>_.check(o6(0,b)),_.nonpositive=(b)=>_.check(dz(0,b)),_.multipleOf=(b,G)=>_.check(s6(b,G)),_.step=(b,G)=>_.check(s6(b,G)),_.finite=()=>_;let A=_._zod.bag;_.minValue=Math.max(A.minimum??Number.NEGATIVE_INFINITY,A.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,_.maxValue=Math.min(A.maximum??Number.POSITIVE_INFINITY,A.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,_.isInt=(A.format??"").includes("int")||Number.isSafeInteger(A.multipleOf??0.5),_.isFinite=!0,_.format=A.format??null});function q0(_){return SB(kZ,_)}var KI=E("ZodNumberFormat",(_,z)=>{IH.init(_,z),kZ.init(_,z)});function RZ(_){return kB(KI,_)}var qI=E("ZodBoolean",(_,z)=>{xH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>cB(_,A,b,G)});function y0(_){return IB(qI,_)}var WI=E("ZodNull",(_,z)=>{TH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>lB(_,A,b,G)});function d2(_){return xB(WI,_)}var VI=E("ZodUnknown",(_,z)=>{CH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>dB(_,A,b,G)});function j0(){return TB(VI)}var UI=E("ZodNever",(_,z)=>{vH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>pB(_,A,b,G)});function DI(_){return CB(UI,_)}var MI=E("ZodArray",(_,z)=>{yH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>aB(_,A,b,G),_.element=z.element,_.min=(A,b)=>_.check(T1(A,b)),_.nonempty=(A)=>_.check(T1(1,A)),_.max=(A,b)=>_.check(t6(A,b)),_.length=(A,b)=>_.check(e6(A,b)),_.unwrap=()=>_.element});function A0(_,z){return vB(MI,_,z)}var IZ=E("ZodObject",(_,z)=>{hH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>sB(_,A,b,G),X0.defineLazy(_,"shape",()=>{return z.shape}),_.keyof=()=>$9(Object.keys(_._zod.def.shape)),_.catchall=(A)=>_.clone({..._._zod.def,catchall:A}),_.passthrough=()=>_.clone({..._._zod.def,catchall:j0()}),_.loose=()=>_.clone({..._._zod.def,catchall:j0()}),_.strict=()=>_.clone({..._._zod.def,catchall:DI()}),_.strip=()=>_.clone({..._._zod.def,catchall:void 0}),_.extend=(A)=>{return X0.extend(_,A)},_.safeExtend=(A)=>{return X0.safeExtend(_,A)},_.merge=(A)=>X0.merge(_,A),_.pick=(A)=>X0.pick(_,A),_.omit=(A)=>X0.omit(_,A),_.partial=(...A)=>X0.partial(CZ,_,A[0]),_.required=(...A)=>X0.required(vZ,_,A[0])});function C(_,z){let A={type:"object",shape:_??{},...X0.normalizeParams(z)};return new IZ(A)}function A9(_,z){return new IZ({type:"object",shape:_,catchall:j0(),...X0.normalizeParams(z)})}var xZ=E("ZodUnion",(_,z)=>{M2.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>tB(_,A,b,G),_.options=z.options});function U0(_,z){return new xZ({type:"union",options:_,...X0.normalizeParams(z)})}var NI=E("ZodDiscriminatedUnion",(_,z)=>{xZ.init(_,z),mH.init(_,z)});function r2(_,z,A){return new NI({type:"union",options:z,discriminator:_,...X0.normalizeParams(A)})}var wI=E("ZodIntersection",(_,z)=>{uH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>eB(_,A,b,G)});function AA(_,z){return new wI({type:"intersection",left:_,right:z})}var EI=E("ZodRecord",(_,z)=>{cH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>_Z(_,A,b,G),_.keyType=z.keyType,_.valueType=z.valueType});function P0(_,z,A){return new EI({type:"record",keyType:_,valueType:z,...X0.normalizeParams(A)})}var l2=E("ZodEnum",(_,z)=>{lH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(b,G,J)=>rB(_,b,G,J),_.enum=z.entries,_.options=Object.values(z.entries);let A=new Set(Object.keys(z.entries));_.extract=(b,G)=>{let J={};for(let Y of b)if(A.has(Y))J[Y]=z.entries[Y];else throw Error(`Key ${Y} not found in enum`);return new l2({...z,checks:[],...X0.normalizeParams(G),entries:J})},_.exclude=(b,G)=>{let J={...z.entries};for(let Y of b)if(A.has(Y))delete J[Y];else throw Error(`Key ${Y} not found in enum`);return new l2({...z,checks:[],...X0.normalizeParams(G),entries:J})}});function $9(_,z){let A=Array.isArray(_)?Object.fromEntries(_.map((b)=>[b,b])):_;return new l2({type:"enum",entries:A,...X0.normalizeParams(z)})}var OI=E("ZodLiteral",(_,z)=>{pH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>nB(_,A,b,G),_.values=new Set(z.values),Object.defineProperty(_,"value",{get(){if(z.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return z.values[0]}})});function f(_,z){return new OI({type:"literal",values:Array.isArray(_)?_:[_],...X0.normalizeParams(z)})}var LI=E("ZodTransform",(_,z)=>{dH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>oB(_,A,b,G),_._zod.parse=(A,b)=>{if(b.direction==="backward")throw new vz(_.constructor.name);A.addIssue=(J)=>{if(typeof J==="string")A.issues.push(X0.issue(J,A.value,z));else{let Y=J;if(Y.fatal)Y.continue=!1;Y.code??(Y.code="custom"),Y.input??(Y.input=A.value),Y.inst??(Y.inst=_),A.issues.push(X0.issue(Y))}};let G=z.transform(A.value,A);if(G instanceof Promise)return G.then((J)=>{return A.value=J,A});return A.value=G,A}});function TZ(_){return new LI({type:"transform",transform:_})}var CZ=E("ZodOptional",(_,z)=>{N2.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>f2(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function k0(_){return new CZ({type:"optional",innerType:_})}var jI=E("ZodExactOptional",(_,z)=>{rH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>f2(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function RI(_){return new jI({type:"optional",innerType:_})}var PI=E("ZodNullable",(_,z)=>{nH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>zZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function PZ(_){return new PI({type:"nullable",innerType:_})}var SI=E("ZodDefault",(_,z)=>{iH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>bZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType,_.removeDefault=_.unwrap});function kI(_,z){return new SI({type:"default",innerType:_,get defaultValue(){return typeof z==="function"?z():X0.shallowClone(z)}})}var II=E("ZodPrefault",(_,z)=>{oH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>GZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function xI(_,z){return new II({type:"prefault",innerType:_,get defaultValue(){return typeof z==="function"?z():X0.shallowClone(z)}})}var vZ=E("ZodNonOptional",(_,z)=>{aH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>AZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function TI(_,z){return new vZ({type:"nonoptional",innerType:_,...X0.normalizeParams(z)})}var CI=E("ZodCatch",(_,z)=>{sH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>JZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType,_.removeCatch=_.unwrap});function vI(_,z){return new CI({type:"catch",innerType:_,catchValue:typeof z==="function"?z:()=>z})}var yI=E("ZodPipe",(_,z)=>{tH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>YZ(_,A,b,G),_.in=z.in,_.out=z.out});function p2(_,z){return new yI({type:"pipe",in:_,out:z})}var gI=E("ZodReadonly",(_,z)=>{eH.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>XZ(_,A,b,G),_.unwrap=()=>_._zod.def.innerType});function fI(_){return new gI({type:"readonly",innerType:_})}var yZ=E("ZodCustom",(_,z)=>{_B.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,b,G)=>iB(_,A,b,G)});function gZ(_,z){return yB(yZ,_??(()=>!0),z)}function hI(_,z={}){return gB(yZ,_,z)}function mI(_){return fB(_)}function n2(_,z){return p2(TZ(_),z)}O9(w2());var i2="2025-11-25";var fZ=[i2,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],G_="io.modelcontextprotocol/related-task",GA="2.0",h0=gZ((_)=>_!==null&&(typeof _==="object"||typeof _==="function")),hZ=U0([N(),q0().int()]),mZ=N(),N40=A9({ttl:U0([q0(),d2()]).optional(),pollInterval:q0().optional()}),uI=C({ttl:q0().optional()}),cI=C({taskId:N()}),o2=A9({progressToken:hZ.optional(),[G_]:cI.optional()}),U9=C({_meta:o2.optional()}),az=U9.extend({task:uI.optional()}),uZ=(_)=>az.safeParse(_).success,m0=C({method:N(),params:U9.loose().optional()}),L9=C({_meta:o2.optional()}),j9=C({method:N(),params:L9.loose().optional()}),u0=A9({_meta:o2.optional()}),JA=U0([N(),q0().int()]),cZ=C({jsonrpc:f(GA),id:JA,...m0.shape}).strict(),a2=(_)=>cZ.safeParse(_).success,lZ=C({jsonrpc:f(GA),...j9.shape}).strict(),pZ=(_)=>lZ.safeParse(_).success,s2=C({jsonrpc:f(GA),id:JA,result:u0}).strict(),sz=(_)=>s2.safeParse(_).success;var b0;(function(_){_[_.ConnectionClosed=-32000]="ConnectionClosed",_[_.RequestTimeout=-32001]="RequestTimeout",_[_.ParseError=-32700]="ParseError",_[_.InvalidRequest=-32600]="InvalidRequest",_[_.MethodNotFound=-32601]="MethodNotFound",_[_.InvalidParams=-32602]="InvalidParams",_[_.InternalError=-32603]="InternalError",_[_.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(b0||(b0={}));var t2=C({jsonrpc:f(GA),id:JA.optional(),error:C({code:q0().int(),message:N(),data:j0().optional()})}).strict();var dZ=(_)=>t2.safeParse(_).success;var rZ=U0([cZ,lZ,s2,t2]),w40=U0([s2,t2]),YA=u0.strict(),lI=L9.extend({requestId:JA.optional(),reason:N().optional()}),XA=j9.extend({method:f("notifications/cancelled"),params:lI}),pI=C({src:N(),mimeType:N().optional(),sizes:A0(N()).optional(),theme:$9(["light","dark"]).optional()}),tz=C({icons:A0(pI).optional()}),v1=C({name:N(),title:N().optional()}),nZ=v1.extend({...v1.shape,...tz.shape,version:N(),websiteUrl:N().optional(),description:N().optional()}),dI=AA(C({applyDefaults:y0().optional()}),P0(N(),j0())),rI=n2((_)=>{if(_&&typeof _==="object"&&!Array.isArray(_)){if(Object.keys(_).length===0)return{form:{}}}return _},AA(C({form:dI.optional(),url:h0.optional()}),P0(N(),j0()).optional())),nI=A9({list:h0.optional(),cancel:h0.optional(),requests:A9({sampling:A9({createMessage:h0.optional()}).optional(),elicitation:A9({create:h0.optional()}).optional()}).optional()}),iI=A9({list:h0.optional(),cancel:h0.optional(),requests:A9({tools:A9({call:h0.optional()}).optional()}).optional()}),oI=C({experimental:P0(N(),h0).optional(),sampling:C({context:h0.optional(),tools:h0.optional()}).optional(),elicitation:rI.optional(),roots:C({listChanged:y0().optional()}).optional(),tasks:nI.optional()}),aI=U9.extend({protocolVersion:N(),capabilities:oI,clientInfo:nZ}),e2=m0.extend({method:f("initialize"),params:aI});var sI=C({experimental:P0(N(),h0).optional(),logging:h0.optional(),completions:h0.optional(),prompts:C({listChanged:y0().optional()}).optional(),resources:C({subscribe:y0().optional(),listChanged:y0().optional()}).optional(),tools:C({listChanged:y0().optional()}).optional(),tasks:iI.optional()}),tI=u0.extend({protocolVersion:N(),capabilities:sI,serverInfo:nZ,instructions:N().optional()}),_7=j9.extend({method:f("notifications/initialized"),params:L9.optional()});var QA=m0.extend({method:f("ping"),params:U9.optional()}),eI=C({progress:q0(),total:k0(q0()),message:k0(N())}),_x=C({...L9.shape,...eI.shape,progressToken:hZ}),$A=j9.extend({method:f("notifications/progress"),params:_x}),zx=U9.extend({cursor:mZ.optional()}),ez=m0.extend({params:zx.optional()}),_3=u0.extend({nextCursor:mZ.optional()}),Ax=$9(["working","input_required","completed","failed","cancelled"]),z3=C({taskId:N(),status:Ax,ttl:U0([q0(),d2()]),createdAt:N(),lastUpdatedAt:N(),pollInterval:k0(q0()),statusMessage:k0(N())}),y1=u0.extend({task:z3}),bx=L9.merge(z3),A3=j9.extend({method:f("notifications/tasks/status"),params:bx}),HA=m0.extend({method:f("tasks/get"),params:U9.extend({taskId:N()})}),BA=u0.merge(z3),ZA=m0.extend({method:f("tasks/result"),params:U9.extend({taskId:N()})}),E40=u0.loose(),FA=ez.extend({method:f("tasks/list")}),KA=_3.extend({tasks:A0(z3)}),qA=m0.extend({method:f("tasks/cancel"),params:U9.extend({taskId:N()})}),iZ=u0.merge(z3),oZ=C({uri:N(),mimeType:k0(N()),_meta:P0(N(),j0()).optional()}),aZ=oZ.extend({text:N()}),z7=N().refine((_)=>{try{return atob(_),!0}catch{return!1}},{message:"Invalid Base64 string"}),sZ=oZ.extend({blob:z7}),b3=$9(["user","assistant"]),g1=C({audience:A0(b3).optional(),priority:q0().min(0).max(1).optional(),lastModified:oz.datetime({offset:!0}).optional()}),tZ=C({...v1.shape,...tz.shape,uri:N(),description:k0(N()),mimeType:k0(N()),annotations:g1.optional(),_meta:k0(A9({}))}),Gx=C({...v1.shape,...tz.shape,uriTemplate:N(),description:k0(N()),mimeType:k0(N()),annotations:g1.optional(),_meta:k0(A9({}))}),Jx=ez.extend({method:f("resources/list")}),Yx=_3.extend({resources:A0(tZ)}),Xx=ez.extend({method:f("resources/templates/list")}),Qx=_3.extend({resourceTemplates:A0(Gx)}),A7=U9.extend({uri:N()}),$x=A7,Hx=m0.extend({method:f("resources/read"),params:$x}),Bx=u0.extend({contents:A0(U0([aZ,sZ]))}),Zx=j9.extend({method:f("notifications/resources/list_changed"),params:L9.optional()}),Fx=A7,Kx=m0.extend({method:f("resources/subscribe"),params:Fx}),qx=A7,Wx=m0.extend({method:f("resources/unsubscribe"),params:qx}),Vx=L9.extend({uri:N()}),Ux=j9.extend({method:f("notifications/resources/updated"),params:Vx}),Dx=C({name:N(),description:k0(N()),required:k0(y0())}),Mx=C({...v1.shape,...tz.shape,description:k0(N()),arguments:k0(A0(Dx)),_meta:k0(A9({}))}),b7=ez.extend({method:f("prompts/list")}),Nx=_3.extend({prompts:A0(Mx)}),wx=U9.extend({name:N(),arguments:P0(N(),N()).optional()}),Ex=m0.extend({method:f("prompts/get"),params:wx}),G7=C({type:f("text"),text:N(),annotations:g1.optional(),_meta:P0(N(),j0()).optional()}),J7=C({type:f("image"),data:z7,mimeType:N(),annotations:g1.optional(),_meta:P0(N(),j0()).optional()}),Y7=C({type:f("audio"),data:z7,mimeType:N(),annotations:g1.optional(),_meta:P0(N(),j0()).optional()}),Ox=C({type:f("tool_use"),name:N(),id:N(),input:P0(N(),j0()),_meta:P0(N(),j0()).optional()}),Lx=C({type:f("resource"),resource:U0([aZ,sZ]),annotations:g1.optional(),_meta:P0(N(),j0()).optional()}),jx=tZ.extend({type:f("resource_link")}),X7=U0([G7,J7,Y7,jx,Lx]),Rx=C({role:b3,content:X7}),Px=u0.extend({description:N().optional(),messages:A0(Rx)}),Sx=j9.extend({method:f("notifications/prompts/list_changed"),params:L9.optional()}),kx=C({title:N().optional(),readOnlyHint:y0().optional(),destructiveHint:y0().optional(),idempotentHint:y0().optional(),openWorldHint:y0().optional()}),Ix=C({taskSupport:$9(["required","optional","forbidden"]).optional()}),eZ=C({...v1.shape,...tz.shape,description:N().optional(),inputSchema:C({type:f("object"),properties:P0(N(),h0).optional(),required:A0(N()).optional()}).catchall(j0()),outputSchema:C({type:f("object"),properties:P0(N(),h0).optional(),required:A0(N()).optional()}).catchall(j0()).optional(),annotations:kx.optional(),execution:Ix.optional(),_meta:P0(N(),j0()).optional()}),Q7=ez.extend({method:f("tools/list")}),xx=_3.extend({tools:A0(eZ)}),WA=u0.extend({content:A0(X7).default([]),structuredContent:P0(N(),j0()).optional(),isError:y0().optional()}),O40=WA.or(u0.extend({toolResult:j0()})),Tx=az.extend({name:N(),arguments:P0(N(),j0()).optional()}),$7=m0.extend({method:f("tools/call"),params:Tx}),Cx=j9.extend({method:f("notifications/tools/list_changed"),params:L9.optional()}),L40=C({autoRefresh:y0().default(!0),debounceMs:q0().int().nonnegative().default(300)}),G3=$9(["debug","info","notice","warning","error","critical","alert","emergency"]),vx=U9.extend({level:G3}),H7=m0.extend({method:f("logging/setLevel"),params:vx}),yx=L9.extend({level:G3,logger:N().optional(),data:j0()}),gx=j9.extend({method:f("notifications/message"),params:yx}),fx=C({name:N().optional()}),hx=C({hints:A0(fx).optional(),costPriority:q0().min(0).max(1).optional(),speedPriority:q0().min(0).max(1).optional(),intelligencePriority:q0().min(0).max(1).optional()}),mx=C({mode:$9(["auto","required","none"]).optional()}),ux=C({type:f("tool_result"),toolUseId:N().describe("The unique identifier for the corresponding tool call."),content:A0(X7).default([]),structuredContent:C({}).loose().optional(),isError:y0().optional(),_meta:P0(N(),j0()).optional()}),cx=r2("type",[G7,J7,Y7]),bA=r2("type",[G7,J7,Y7,Ox,ux]),lx=C({role:b3,content:U0([bA,A0(bA)]),_meta:P0(N(),j0()).optional()}),px=az.extend({messages:A0(lx),modelPreferences:hx.optional(),systemPrompt:N().optional(),includeContext:$9(["none","thisServer","allServers"]).optional(),temperature:q0().optional(),maxTokens:q0().int(),stopSequences:A0(N()).optional(),metadata:h0.optional(),tools:A0(eZ).optional(),toolChoice:mx.optional()}),dx=m0.extend({method:f("sampling/createMessage"),params:px}),B7=u0.extend({model:N(),stopReason:k0($9(["endTurn","stopSequence","maxTokens"]).or(N())),role:b3,content:cx}),Z7=u0.extend({model:N(),stopReason:k0($9(["endTurn","stopSequence","maxTokens","toolUse"]).or(N())),role:b3,content:U0([bA,A0(bA)])}),rx=C({type:f("boolean"),title:N().optional(),description:N().optional(),default:y0().optional()}),nx=C({type:f("string"),title:N().optional(),description:N().optional(),minLength:q0().optional(),maxLength:q0().optional(),format:$9(["email","uri","date","date-time"]).optional(),default:N().optional()}),ix=C({type:$9(["number","integer"]),title:N().optional(),description:N().optional(),minimum:q0().optional(),maximum:q0().optional(),default:q0().optional()}),ox=C({type:f("string"),title:N().optional(),description:N().optional(),enum:A0(N()),default:N().optional()}),ax=C({type:f("string"),title:N().optional(),description:N().optional(),oneOf:A0(C({const:N(),title:N()})),default:N().optional()}),sx=C({type:f("string"),title:N().optional(),description:N().optional(),enum:A0(N()),enumNames:A0(N()).optional(),default:N().optional()}),tx=U0([ox,ax]),ex=C({type:f("array"),title:N().optional(),description:N().optional(),minItems:q0().optional(),maxItems:q0().optional(),items:C({type:f("string"),enum:A0(N())}),default:A0(N()).optional()}),_T=C({type:f("array"),title:N().optional(),description:N().optional(),minItems:q0().optional(),maxItems:q0().optional(),items:C({anyOf:A0(C({const:N(),title:N()}))}),default:A0(N()).optional()}),zT=U0([ex,_T]),AT=U0([sx,tx,zT]),bT=U0([AT,rx,nx,ix]),GT=az.extend({mode:f("form").optional(),message:N(),requestedSchema:C({type:f("object"),properties:P0(N(),bT),required:A0(N()).optional()})}),JT=az.extend({mode:f("url"),message:N(),elicitationId:N(),url:N().url()}),YT=U0([GT,JT]),XT=m0.extend({method:f("elicitation/create"),params:YT}),QT=L9.extend({elicitationId:N()}),$T=j9.extend({method:f("notifications/elicitation/complete"),params:QT}),VA=u0.extend({action:$9(["accept","decline","cancel"]),content:n2((_)=>_===null?void 0:_,P0(N(),U0([N(),q0(),y0(),A0(N())])).optional())}),HT=C({type:f("ref/resource"),uri:N()});var BT=C({type:f("ref/prompt"),name:N()}),ZT=U9.extend({ref:U0([BT,HT]),argument:C({name:N(),value:N()}),context:C({arguments:P0(N(),N()).optional()}).optional()}),FT=m0.extend({method:f("completion/complete"),params:ZT});var KT=u0.extend({completion:A9({values:A0(N()).max(100),total:k0(q0().int()),hasMore:k0(y0())})}),qT=C({uri:N().startsWith("file://"),name:N().optional(),_meta:P0(N(),j0()).optional()}),WT=m0.extend({method:f("roots/list"),params:U9.optional()}),F7=u0.extend({roots:A0(qT)}),VT=j9.extend({method:f("notifications/roots/list_changed"),params:L9.optional()}),j40=U0([QA,e2,FT,H7,Ex,b7,Jx,Xx,Hx,Kx,Wx,$7,Q7,HA,ZA,FA,qA]),R40=U0([XA,$A,_7,VT,A3]),P40=U0([YA,B7,Z7,VA,F7,BA,KA,y1]),S40=U0([QA,dx,XT,WT,HA,ZA,FA,qA]),k40=U0([XA,$A,gx,Ux,Zx,Cx,Sx,A3,$T]),I40=U0([YA,tI,KT,Px,Nx,Yx,Qx,Bx,WA,xx,BA,KA,y1]);class s extends Error{constructor(_,z,A){super(`MCP error ${_}: ${z}`);this.code=_,this.data=A,this.name="McpError"}static fromError(_,z,A){if(_===b0.UrlElicitationRequired&&A){let b=A;if(b.elicitations)return new _F(b.elicitations,z)}return new s(_,z,A)}}class _F extends s{constructor(_,z=`URL elicitation${_.length>1?"s":""} required`){super(b0.UrlElicitationRequired,z,{elicitations:_})}get elicitations(){return this.data?.elicitations??[]}}function J_(_){return _==="completed"||_==="failed"||_==="cancelled"}var UT=Symbol("Let zodToJsonSchema decide on which parser to use");var H_0=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function K7(_){let A=_A(_)?.method;if(!A)throw Error("Schema is missing a method literal");let b=QZ(A);if(typeof b!=="string")throw Error("Schema method literal must be a string");return b}function q7(_,z){let A=b_(_,z);if(!A.success)throw A.error;return A.data}var OT=60000;class W7{constructor(_){if(this._options=_,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(XA,(z)=>{this._oncancel(z)}),this.setNotificationHandler($A,(z)=>{this._onprogress(z)}),this.setRequestHandler(QA,(z)=>({})),this._taskStore=_?.taskStore,this._taskMessageQueue=_?.taskMessageQueue,this._taskStore)this.setRequestHandler(HA,async(z,A)=>{let b=await this._taskStore.getTask(z.params.taskId,A.sessionId);if(!b)throw new s(b0.InvalidParams,"Failed to retrieve task: Task not found");return{...b}}),this.setRequestHandler(ZA,async(z,A)=>{let b=async()=>{let G=z.params.taskId;if(this._taskMessageQueue){let Y;while(Y=await this._taskMessageQueue.dequeue(G,A.sessionId)){if(Y.type==="response"||Y.type==="error"){let X=Y.message,Q=X.id,$=this._requestResolvers.get(Q);if($)if(this._requestResolvers.delete(Q),Y.type==="response")$(X);else{let H=X,B=new s(H.error.code,H.error.message,H.error.data);$(B)}else{let H=Y.type==="response"?"Response":"Error";this._onerror(Error(`${H} handler missing for request ${Q}`))}continue}await this._transport?.send(Y.message,{relatedRequestId:A.requestId})}}let J=await this._taskStore.getTask(G,A.sessionId);if(!J)throw new s(b0.InvalidParams,`Task not found: ${G}`);if(!J_(J.status))return await this._waitForTaskUpdate(G,A.signal),await b();if(J_(J.status)){let Y=await this._taskStore.getTaskResult(G,A.sessionId);return this._clearTaskQueue(G),{...Y,_meta:{...Y._meta,[G_]:{taskId:G}}}}return await b()};return await b()}),this.setRequestHandler(FA,async(z,A)=>{try{let{tasks:b,nextCursor:G}=await this._taskStore.listTasks(z.params?.cursor,A.sessionId);return{tasks:b,nextCursor:G,_meta:{}}}catch(b){throw new s(b0.InvalidParams,`Failed to list tasks: ${b instanceof Error?b.message:String(b)}`)}}),this.setRequestHandler(qA,async(z,A)=>{try{let b=await this._taskStore.getTask(z.params.taskId,A.sessionId);if(!b)throw new s(b0.InvalidParams,`Task not found: ${z.params.taskId}`);if(J_(b.status))throw new s(b0.InvalidParams,`Cannot cancel task in terminal status: ${b.status}`);await this._taskStore.updateTaskStatus(z.params.taskId,"cancelled","Client cancelled task execution.",A.sessionId),this._clearTaskQueue(z.params.taskId);let G=await this._taskStore.getTask(z.params.taskId,A.sessionId);if(!G)throw new s(b0.InvalidParams,`Task not found after cancellation: ${z.params.taskId}`);return{_meta:{},...G}}catch(b){if(b instanceof s)throw b;throw new s(b0.InvalidRequest,`Failed to cancel task: ${b instanceof Error?b.message:String(b)}`)}})}async _oncancel(_){if(!_.params.requestId)return;this._requestHandlerAbortControllers.get(_.params.requestId)?.abort(_.params.reason)}_setupTimeout(_,z,A,b,G=!1){this._timeoutInfo.set(_,{timeoutId:setTimeout(b,z),startTime:Date.now(),timeout:z,maxTotalTimeout:A,resetTimeoutOnProgress:G,onTimeout:b})}_resetTimeout(_){let z=this._timeoutInfo.get(_);if(!z)return!1;let A=Date.now()-z.startTime;if(z.maxTotalTimeout&&A>=z.maxTotalTimeout)throw this._timeoutInfo.delete(_),s.fromError(b0.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:z.maxTotalTimeout,totalElapsed:A});return clearTimeout(z.timeoutId),z.timeoutId=setTimeout(z.onTimeout,z.timeout),!0}_cleanupTimeout(_){let z=this._timeoutInfo.get(_);if(z)clearTimeout(z.timeoutId),this._timeoutInfo.delete(_)}async connect(_){this._transport=_;let z=this.transport?.onclose;this._transport.onclose=()=>{z?.(),this._onclose()};let A=this.transport?.onerror;this._transport.onerror=(G)=>{A?.(G),this._onerror(G)};let b=this._transport?.onmessage;this._transport.onmessage=(G,J)=>{if(b?.(G,J),sz(G)||dZ(G))this._onresponse(G);else if(a2(G))this._onrequest(G,J);else if(pZ(G))this._onnotification(G);else this._onerror(Error(`Unknown message type: ${JSON.stringify(G)}`))},await this._transport.start()}_onclose(){let _=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let z=s.fromError(b0.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let A of _.values())A(z)}_onerror(_){this.onerror?.(_)}_onnotification(_){let z=this._notificationHandlers.get(_.method)??this.fallbackNotificationHandler;if(z===void 0)return;Promise.resolve().then(()=>z(_)).catch((A)=>this._onerror(Error(`Uncaught error in notification handler: ${A}`)))}_onrequest(_,z){let A=this._requestHandlers.get(_.method)??this.fallbackRequestHandler,b=this._transport,G=_.params?._meta?.[G_]?.taskId;if(A===void 0){let $={jsonrpc:"2.0",id:_.id,error:{code:b0.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:$,timestamp:Date.now()},b?.sessionId).catch((H)=>this._onerror(Error(`Failed to enqueue error response: ${H}`)));else b?.send($).catch((H)=>this._onerror(Error(`Failed to send an error response: ${H}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(_.id,J);let Y=uZ(_.params)?_.params.task:void 0,X=this._taskStore?this.requestTaskStore(_,b?.sessionId):void 0,Q={signal:J.signal,sessionId:b?.sessionId,_meta:_.params?._meta,sendNotification:async($)=>{let H={relatedRequestId:_.id};if(G)H.relatedTask={taskId:G};await this.notification($,H)},sendRequest:async($,H,B)=>{let Z={...B,relatedRequestId:_.id};if(G&&!Z.relatedTask)Z.relatedTask={taskId:G};let F=Z.relatedTask?.taskId??G;if(F&&X)await X.updateTaskStatus(F,"input_required");return await this.request($,H,Z)},authInfo:z?.authInfo,requestId:_.id,requestInfo:z?.requestInfo,taskId:G,taskStore:X,taskRequestedTtl:Y?.ttl,closeSSEStream:z?.closeSSEStream,closeStandaloneSSEStream:z?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(Y)this.assertTaskHandlerCapability(_.method)}).then(()=>A(_,Q)).then(async($)=>{if(J.signal.aborted)return;let H={result:$,jsonrpc:"2.0",id:_.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:H,timestamp:Date.now()},b?.sessionId);else await b?.send(H)},async($)=>{if(J.signal.aborted)return;let H={jsonrpc:"2.0",id:_.id,error:{code:Number.isSafeInteger($.code)?$.code:b0.InternalError,message:$.message??"Internal error",...$.data!==void 0&&{data:$.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:H,timestamp:Date.now()},b?.sessionId);else await b?.send(H)}).catch(($)=>this._onerror(Error(`Failed to send response: ${$}`))).finally(()=>{this._requestHandlerAbortControllers.delete(_.id)})}_onprogress(_){let{progressToken:z,...A}=_.params,b=Number(z),G=this._progressHandlers.get(b);if(!G){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(_)}`));return}let J=this._responseHandlers.get(b),Y=this._timeoutInfo.get(b);if(Y&&J&&Y.resetTimeoutOnProgress)try{this._resetTimeout(b)}catch(X){this._responseHandlers.delete(b),this._progressHandlers.delete(b),this._cleanupTimeout(b),J(X);return}G(A)}_onresponse(_){let z=Number(_.id),A=this._requestResolvers.get(z);if(A){if(this._requestResolvers.delete(z),sz(_))A(_);else{let J=new s(_.error.code,_.error.message,_.error.data);A(J)}return}let b=this._responseHandlers.get(z);if(b===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(_)}`));return}this._responseHandlers.delete(z),this._cleanupTimeout(z);let G=!1;if(sz(_)&&_.result&&typeof _.result==="object"){let J=_.result;if(J.task&&typeof J.task==="object"){let Y=J.task;if(typeof Y.taskId==="string")G=!0,this._taskProgressTokens.set(Y.taskId,z)}}if(!G)this._progressHandlers.delete(z);if(sz(_))b(_);else{let J=s.fromError(_.error.code,_.error.message,_.error.data);b(J)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(_,z,A){let{task:b}=A??{};if(!b){try{yield{type:"result",result:await this.request(_,z,A)}}catch(J){yield{type:"error",error:J instanceof s?J:new s(b0.InternalError,String(J))}}return}let G;try{let J=await this.request(_,y1,A);if(J.task)G=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new s(b0.InternalError,"Task creation did not return a task");while(!0){let Y=await this.getTask({taskId:G},A);if(yield{type:"taskStatus",task:Y},J_(Y.status)){if(Y.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},z,A)};else if(Y.status==="failed")yield{type:"error",error:new s(b0.InternalError,`Task ${G} failed`)};else if(Y.status==="cancelled")yield{type:"error",error:new s(b0.InternalError,`Task ${G} was cancelled`)};return}if(Y.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},z,A)};return}let X=Y.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((Q)=>setTimeout(Q,X)),A?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof s?J:new s(b0.InternalError,String(J))}}}request(_,z,A){let{relatedRequestId:b,resumptionToken:G,onresumptiontoken:J,task:Y,relatedTask:X}=A??{};return new Promise((Q,$)=>{let H=(V)=>{$(V)};if(!this._transport){H(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(_.method),Y)this.assertTaskCapability(_.method)}catch(V){H(V);return}A?.signal?.throwIfAborted();let B=this._requestMessageId++,Z={..._,jsonrpc:"2.0",id:B};if(A?.onprogress)this._progressHandlers.set(B,A.onprogress),Z.params={..._.params,_meta:{..._.params?._meta||{},progressToken:B}};if(Y)Z.params={...Z.params,task:Y};if(X)Z.params={...Z.params,_meta:{...Z.params?._meta||{},[G_]:X}};let F=(V)=>{this._responseHandlers.delete(B),this._progressHandlers.delete(B),this._cleanupTimeout(B),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:B,reason:String(V)}},{relatedRequestId:b,resumptionToken:G,onresumptiontoken:J}).catch((O)=>this._onerror(Error(`Failed to send cancellation: ${O}`)));let w=V instanceof s?V:new s(b0.RequestTimeout,String(V));$(w)};this._responseHandlers.set(B,(V)=>{if(A?.signal?.aborted)return;if(V instanceof Error)return $(V);try{let w=b_(z,V.result);if(!w.success)$(w.error);else Q(w.data)}catch(w){$(w)}}),A?.signal?.addEventListener("abort",()=>{F(A?.signal?.reason)});let K=A?.timeout??OT,q=()=>F(s.fromError(b0.RequestTimeout,"Request timed out",{timeout:K}));this._setupTimeout(B,K,A?.maxTotalTimeout,q,A?.resetTimeoutOnProgress??!1);let W=X?.taskId;if(W){let V=(w)=>{let O=this._responseHandlers.get(B);if(O)O(w);else this._onerror(Error(`Response handler missing for side-channeled request ${B}`))};this._requestResolvers.set(B,V),this._enqueueTaskMessage(W,{type:"request",message:Z,timestamp:Date.now()}).catch((w)=>{this._cleanupTimeout(B),$(w)})}else this._transport.send(Z,{relatedRequestId:b,resumptionToken:G,onresumptiontoken:J}).catch((V)=>{this._cleanupTimeout(B),$(V)})})}async getTask(_,z){return this.request({method:"tasks/get",params:_},BA,z)}async getTaskResult(_,z,A){return this.request({method:"tasks/result",params:_},z,A)}async listTasks(_,z){return this.request({method:"tasks/list",params:_},KA,z)}async cancelTask(_,z){return this.request({method:"tasks/cancel",params:_},iZ,z)}async notification(_,z){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(_.method);let A=z?.relatedTask?.taskId;if(A){let Y={..._,jsonrpc:"2.0",params:{..._.params,_meta:{..._.params?._meta||{},[G_]:z.relatedTask}}};await this._enqueueTaskMessage(A,{type:"notification",message:Y,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(_.method)&&!_.params&&!z?.relatedRequestId&&!z?.relatedTask){if(this._pendingDebouncedNotifications.has(_.method))return;this._pendingDebouncedNotifications.add(_.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(_.method),!this._transport)return;let Y={..._,jsonrpc:"2.0"};if(z?.relatedTask)Y={...Y,params:{...Y.params,_meta:{...Y.params?._meta||{},[G_]:z.relatedTask}}};this._transport?.send(Y,z).catch((X)=>this._onerror(X))});return}let J={..._,jsonrpc:"2.0"};if(z?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[G_]:z.relatedTask}}};await this._transport.send(J,z)}setRequestHandler(_,z){let A=K7(_);this.assertRequestHandlerCapability(A),this._requestHandlers.set(A,(b,G)=>{let J=q7(_,b);return Promise.resolve(z(J,G))})}removeRequestHandler(_){this._requestHandlers.delete(_)}assertCanSetRequestHandler(_){if(this._requestHandlers.has(_))throw Error(`A request handler for ${_} already exists, which would be overridden`)}setNotificationHandler(_,z){let A=K7(_);this._notificationHandlers.set(A,(b)=>{let G=q7(_,b);return Promise.resolve(z(G))})}removeNotificationHandler(_){this._notificationHandlers.delete(_)}_cleanupTaskProgressHandler(_){let z=this._taskProgressTokens.get(_);if(z!==void 0)this._progressHandlers.delete(z),this._taskProgressTokens.delete(_)}async _enqueueTaskMessage(_,z,A){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let b=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(_,z,A,b)}async _clearTaskQueue(_,z){if(this._taskMessageQueue){let A=await this._taskMessageQueue.dequeueAll(_,z);for(let b of A)if(b.type==="request"&&a2(b.message)){let G=b.message.id,J=this._requestResolvers.get(G);if(J)J(new s(b0.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(G);else this._onerror(Error(`Resolver missing for request ${G} during task ${_} cleanup`))}}}async _waitForTaskUpdate(_,z){let A=this._options?.defaultTaskPollInterval??1000;try{let b=await this._taskStore?.getTask(_);if(b?.pollInterval)A=b.pollInterval}catch{}return new Promise((b,G)=>{if(z.aborted){G(new s(b0.InvalidRequest,"Request cancelled"));return}let J=setTimeout(b,A);z.addEventListener("abort",()=>{clearTimeout(J),G(new s(b0.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(_,z){let A=this._taskStore;if(!A)throw Error("No task store configured");return{createTask:async(b)=>{if(!_)throw Error("No request provided");return await A.createTask(b,_.id,{method:_.method,params:_.params},z)},getTask:async(b)=>{let G=await A.getTask(b,z);if(!G)throw new s(b0.InvalidParams,"Failed to retrieve task: Task not found");return G},storeTaskResult:async(b,G,J)=>{await A.storeTaskResult(b,G,J,z);let Y=await A.getTask(b,z);if(Y){let X=A3.parse({method:"notifications/tasks/status",params:Y});if(await this.notification(X),J_(Y.status))this._cleanupTaskProgressHandler(b)}},getTaskResult:(b)=>{return A.getTaskResult(b,z)},updateTaskStatus:async(b,G,J)=>{let Y=await A.getTask(b,z);if(!Y)throw new s(b0.InvalidParams,`Task "${b}" not found - it may have been cleaned up`);if(J_(Y.status))throw new s(b0.InvalidParams,`Cannot update task "${b}" from terminal status "${Y.status}" to "${G}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await A.updateTaskStatus(b,G,J,z);let X=await A.getTask(b,z);if(X){let Q=A3.parse({method:"notifications/tasks/status",params:X});if(await this.notification(Q),J_(X.status))this._cleanupTaskProgressHandler(b)}},listTasks:(b)=>{return A.listTasks(b,z)}}}}function zF(_){return _!==null&&typeof _==="object"&&!Array.isArray(_)}function AF(_,z){let A={..._};for(let b in z){let G=b,J=z[G];if(J===void 0)continue;let Y=A[G];if(zF(Y)&&zF(J))A[G]={...Y,...J};else A[G]=J}return A}var TV=G8(Hb(),1),CV=G8(xV(),1);function Cu(){let _=new TV.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return CV.default(_),_}class Mb{constructor(_){this._ajv=_??Cu()}getValidator(_){let z="$id"in _&&typeof _.$id==="string"?this._ajv.getSchema(_.$id)??this._ajv.compile(_):this._ajv.compile(_);return(A)=>{if(z(A))return{valid:!0,data:A,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(z.errors)}}}}class Nb{constructor(_){this._server=_}requestStream(_,z,A){return this._server.requestStream(_,z,A)}async getTask(_,z){return this._server.getTask({taskId:_},z)}async getTaskResult(_,z,A){return this._server.getTaskResult({taskId:_},z,A)}async listTasks(_,z){return this._server.listTasks(_?{cursor:_}:void 0,z)}async cancelTask(_,z){return this._server.cancelTask({taskId:_},z)}}function vV(_,z,A){if(!_)throw Error(`${A} does not support task creation (required for ${z})`);switch(z){case"tools/call":if(!_.tools?.call)throw Error(`${A} does not support task creation for tools/call (required for ${z})`);break;default:break}}function yV(_,z,A){if(!_)throw Error(`${A} does not support task creation (required for ${z})`);switch(z){case"sampling/createMessage":if(!_.sampling?.createMessage)throw Error(`${A} does not support task creation for sampling/createMessage (required for ${z})`);break;case"elicitation/create":if(!_.elicitation?.create)throw Error(`${A} does not support task creation for elicitation/create (required for ${z})`);break;default:break}}class wb extends W7{constructor(_,z){super(z);if(this._serverInfo=_,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(G3.options.map((A,b)=>[A,b])),this.isMessageIgnored=(A,b)=>{let G=this._loggingLevels.get(b);return G?this.LOG_LEVEL_SEVERITY.get(A)<this.LOG_LEVEL_SEVERITY.get(G):!1},this._capabilities=z?.capabilities??{},this._instructions=z?.instructions,this._jsonSchemaValidator=z?.jsonSchemaValidator??new Mb,this.setRequestHandler(e2,(A)=>this._oninitialize(A)),this.setNotificationHandler(_7,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(H7,async(A,b)=>{let G=b.sessionId||b.requestInfo?.headers["mcp-session-id"]||void 0,{level:J}=A.params,Y=G3.safeParse(J);if(Y.success)this._loggingLevels.set(G,Y.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new Nb(this)};return this._experimental}registerCapabilities(_){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=AF(this._capabilities,_)}setRequestHandler(_,z){let b=_A(_)?.method;if(!b)throw Error("Schema is missing a method literal");let G;if(C1(b)){let Y=b;G=Y._zod?.def?.value??Y.value}else{let Y=b;G=Y._def?.value??Y.value}if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let Y=async(X,Q)=>{let $=b_($7,X);if(!$.success){let F=$.error instanceof Error?$.error.message:String($.error);throw new s(b0.InvalidParams,`Invalid tools/call request: ${F}`)}let{params:H}=$.data,B=await Promise.resolve(z(X,Q));if(H.task){let F=b_(y1,B);if(!F.success){let K=F.error instanceof Error?F.error.message:String(F.error);throw new s(b0.InvalidParams,`Invalid task creation result: ${K}`)}return F.data}let Z=b_(WA,B);if(!Z.success){let F=Z.error instanceof Error?Z.error.message:String(Z.error);throw new s(b0.InvalidParams,`Invalid tools/call result: ${F}`)}return Z.data};return super.setRequestHandler(_,Y)}return super.setRequestHandler(_,z)}assertCapabilityForMethod(_){switch(_){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${_})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${_})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${_})`);break;case"ping":break}}assertNotificationCapability(_){switch(_){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${_})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${_})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${_})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${_})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${_})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(_){if(!this._capabilities)return;switch(_){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${_})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${_})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${_})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${_})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${_})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${_})`);break;case"ping":case"initialize":break}}assertTaskCapability(_){yV(this._clientCapabilities?.tasks?.requests,_,"Client")}assertTaskHandlerCapability(_){if(!this._capabilities)return;vV(this._capabilities.tasks?.requests,_,"Server")}async _oninitialize(_){let z=_.params.protocolVersion;return this._clientCapabilities=_.params.capabilities,this._clientVersion=_.params.clientInfo,{protocolVersion:fZ.includes(z)?z:i2,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},YA)}async createMessage(_,z){if(_.tools||_.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(_.messages.length>0){let A=_.messages[_.messages.length-1],b=Array.isArray(A.content)?A.content:[A.content],G=b.some((Q)=>Q.type==="tool_result"),J=_.messages.length>1?_.messages[_.messages.length-2]:void 0,Y=J?Array.isArray(J.content)?J.content:[J.content]:[],X=Y.some((Q)=>Q.type==="tool_use");if(G){if(b.some((Q)=>Q.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!X)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(X){let Q=new Set(Y.filter((H)=>H.type==="tool_use").map((H)=>H.id)),$=new Set(b.filter((H)=>H.type==="tool_result").map((H)=>H.toolUseId));if(Q.size!==$.size||![...Q].every((H)=>$.has(H)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(_.tools)return this.request({method:"sampling/createMessage",params:_},Z7,z);return this.request({method:"sampling/createMessage",params:_},B7,z)}async elicitInput(_,z){switch(_.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let b=_;return this.request({method:"elicitation/create",params:b},VA,z)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let b=_.mode==="form"?_:{..._,mode:"form"},G=await this.request({method:"elicitation/create",params:b},VA,z);if(G.action==="accept"&&G.content&&b.requestedSchema)try{let Y=this._jsonSchemaValidator.getValidator(b.requestedSchema)(G.content);if(!Y.valid)throw new s(b0.InvalidParams,`Elicitation response content does not match requested schema: ${Y.errorMessage}`)}catch(J){if(J instanceof s)throw J;throw new s(b0.InternalError,`Error validating elicitation response: ${J instanceof Error?J.message:String(J)}`)}return G}}}createElicitationCompletionNotifier(_,z){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:_}},z)}async listRoots(_,z){return this.request({method:"roots/list",params:_},F7,z)}async sendLoggingMessage(_,z){if(this._capabilities.logging){if(!this.isMessageIgnored(_.level,z))return this.notification({method:"notifications/message",params:_})}}async sendResourceUpdated(_){return this.notification({method:"notifications/resources/updated",params:_})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}import fV from"node:process";class Eb{append(_){this._buffer=this._buffer?Buffer.concat([this._buffer,_]):_}readMessage(){if(!this._buffer)return null;let _=this._buffer.indexOf(`
206
- `);if(_===-1)return null;let z=this._buffer.toString("utf8",0,_).replace(/\r$/,"");return this._buffer=this._buffer.subarray(_+1),vu(z)}clear(){this._buffer=void 0}}function vu(_){return rZ.parse(JSON.parse(_))}function gV(_){return JSON.stringify(_)+`
207
- `}class Ob{constructor(_=fV.stdin,z=fV.stdout){this._stdin=_,this._stdout=z,this._readBuffer=new Eb,this._started=!1,this._ondata=(A)=>{this._readBuffer.append(A),this.processReadBuffer()},this._onerror=(A)=>{this.onerror?.(A)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let _=this._readBuffer.readMessage();if(_===null)break;this.onmessage?.(_)}catch(_){this.onerror?.(_)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(_){return new Promise((z)=>{let A=gV(_);if(this._stdout.write(A))z();else this._stdout.once("drain",z)})}}var uu=mu(import.meta.url),hV=hu(uu),cu=jb(R1,"mcp.log");function D9(_){let A=`[${new Date().toISOString()}] [mcp] ${_}
208
- `;try{fu(cu,A)}catch{}}function lu(){if(!Lb(P1))return!1;try{let _=parseInt(gu(P1,"utf-8").trim());return process.kill(_,0),!0}catch{return!1}}async function pu(){if(lu()){D9("Service already running");return}D9("Starting service...");let _=jb(hV,"../../service/server.ts"),z=jb(hV,"../../service/server.js"),A=Lb(_)?_:z;if(!Lb(A))throw D9(`Service script not found: ${A}`),Error("Service script not found");let b=yu("bun",["run",A],{detached:!0,stdio:"ignore",env:{...process.env}});b.unref(),D9(`Service spawned (PID: ${b.pid})`);let G=50;for(let J=0;J<G;J++)try{(await I_()).end(),D9("Service ready");return}catch{await new Promise((Y)=>setTimeout(Y,100))}throw Error("Service failed to start")}async function du(){let _=await I_(),z=crypto.randomUUID();return Cz(_,{type:"connect",id:z}),D9(`Connected to service with ID: ${z}`),_}async function mV(){D9("MCP server starting");let _=null;try{await pu(),_=await du()}catch(G){D9(`Failed to connect to service: ${G instanceof Error?G.message:String(G)}`)}let z=new wb({name:"agentlogs",version:"0.0.1"},{capabilities:{tools:{},prompts:{}}});z.setRequestHandler(Q7,()=>({tools:[]})),z.setRequestHandler(b7,()=>({prompts:[]}));let A=()=>{if(D9("Shutting down"),_)_.end()};process.on("SIGTERM",()=>{D9("Received SIGTERM"),A(),process.exit(0)}),process.on("SIGINT",()=>{D9("Received SIGINT"),A(),process.exit(0)});let b=new Ob;D9("MCP server connecting to transport"),await z.connect(b),D9("MCP server ready")}var o0=new db;o0.name("agentlogs").description("CLI tools for working with AgentLogs accounts and transcripts from Claude Code and Codex");o0.command("login").description("Authenticate with AgentLogs using device authorization").argument("<hostname>","AgentLogs server hostname, e.g. agentlogs.ai").action(async(_)=>{await UY({hostname:_})});o0.command("status").description("Check your current login status").action(async()=>{await NY()});o0.command("logout").description("Log out and clear stored credentials").argument("[hostname]","Optional hostname to log out from (logs out all when omitted)").action(async(_)=>{await DY({hostname:_})});o0.command("upload").argument("[directory]","Filter transcripts to this directory").option("-s, --source <source>","Filter by source: claude-code, codex, opencode, or pi").option("-l, --latest","Upload the most recent transcript without picker").description("Interactively select and upload a transcript").action(async(_,z)=>{let A=z.source;await KQ(_,{source:A,latest:z.latest})});var Rb=o0.command("claudecode").description("Claude Code transcript utilities for AgentLogs");Rb.command("upload").argument("<transcript>","Path or alias for a transcript JSONL file").description("Upload a transcript JSONL file to AgentLogs").action(async(_)=>{await EQ(_)});Rb.command("hook").description("Process Claude Code hook input from stdin").action(async()=>{await DQ()});var ru=o0.command("codex").description("Codex transcript utilities for AgentLogs");ru.command("upload").argument("<transcript>","Path or alias for a Codex transcript JSONL file").description("Upload a Codex transcript JSONL file to AgentLogs").action(async(_)=>{await OQ(_)});var uV=o0.command("opencode").description("OpenCode transcript utilities for AgentLogs");uV.command("upload").argument("<sessionId>","OpenCode session ID to upload").description("Upload an OpenCode session transcript to AgentLogs").action(async(_)=>{await LQ(_)});uV.command("hook").description("Process OpenCode hook input from stdin").action(async()=>{await jQ()});var cV=o0.command("pi").description("Pi transcript utilities for AgentLogs");cV.command("upload").argument("[sessionIdOrPath]","Pi session ID or path to session file").description("Upload a Pi session transcript to AgentLogs").action(async(_)=>{await kQ(_)});cV.command("hook").description("Process Pi hook input from stdin").action(async()=>{await IQ()});Rb.command("sync").argument("[claudeDir]","Optional Claude data directory (defaults to ~/.claude)").option("-r, --repo <repoId>","Only sync transcripts for the provided repo identifier").description("Upload all local Claude Code transcripts that are missing or outdated on the server").action(async(_,z)=>{await NQ({claudeDir:_,repoFilter:z.repo})});o0.command("settings").description("View and modify AgentLogs settings").option("--allowMode <mode>","Set allow mode: 'allowlist' or 'denylist'").action(async(_)=>{await MY({allowMode:_.allowMode})});o0.command("allow").description("Allow capture for the current repository").option("--visibility <visibility>","Set visibility: 'public', 'team', or 'private'").option("--public","Set visibility to public").option("--team","Set visibility to team").option("--private","Set visibility to private").action(async(_)=>{await XG(_)});o0.command("deny").description("Deny capture for the current repository").action(async()=>{await QG()});var A8=o0.command("service").description("Manage the agentlogs background service");A8.command("start").description("Start the background service").action(async()=>{await cQ()});A8.command("stop").description("Stop the background service").action(async()=>{await lQ()});A8.command("status").description("Show service status").action(async()=>{await pQ()});A8.command("logs").description("Tail the watcher event logs").action(async()=>{await dQ()});o0.command("mcp").description("Start MCP server (used by Codex)").action(async()=>{await mV()});o0.showHelpAfterError("(add --help for additional information)");o0.parseAsync().catch((_)=>{console.error("CLI encountered an unexpected error."),console.error(_),process.exit(1)});
216
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let X of _.seen.entries()){let b=X[1];if(z===X[0]){Y(X);continue}if(_.external){let $=_.external.registry.get(X[0])?.id;if(z!==X[0]&&$){Y(X);continue}}if(_.metadataRegistry.get(X[0])?.id){Y(X);continue}if(b.cycle){Y(X);continue}if(b.count>1){if(_.reused==="ref"){Y(X);continue}}}}function s2(_,z){let A=_.seen.get(z);if(!A)throw Error("Unprocessed schema. This is a bug in Zod.");let G=(X)=>{let b=_.seen.get(X);if(b.ref===null)return;let Q=b.def??b.schema,$={...Q},H=b.ref;if(b.ref=null,H){G(H);let Z=_.seen.get(H),q=Z.schema;if(q.$ref&&(_.target==="draft-07"||_.target==="draft-04"||_.target==="openapi-3.0"))Q.allOf=Q.allOf??[],Q.allOf.push(q);else Object.assign(Q,q);if(Object.assign(Q,$),X._zod.parent===H)for(let K in Q){if(K==="$ref"||K==="allOf")continue;if(!(K in $))delete Q[K]}if(q.$ref)for(let K in Q){if(K==="$ref"||K==="allOf")continue;if(K in Z.def&&JSON.stringify(Q[K])===JSON.stringify(Z.def[K]))delete Q[K]}}let B=X._zod.parent;if(B&&B!==H){G(B);let Z=_.seen.get(B);if(Z?.schema.$ref){if(Q.$ref=Z.schema.$ref,Z.def)for(let q in Q){if(q==="$ref"||q==="allOf")continue;if(q in Z.def&&JSON.stringify(Q[q])===JSON.stringify(Z.def[q]))delete Q[q]}}}_.override({zodSchema:X,jsonSchema:Q,path:b.path??[]})};for(let X of[..._.seen.entries()].reverse())G(X[0]);let J={};if(_.target==="draft-2020-12")J.$schema="https://json-schema.org/draft/2020-12/schema";else if(_.target==="draft-07")J.$schema="http://json-schema.org/draft-07/schema#";else if(_.target==="draft-04")J.$schema="http://json-schema.org/draft-04/schema#";else if(_.target==="openapi-3.0");if(_.external?.uri){let X=_.external.registry.get(z)?.id;if(!X)throw Error("Schema is missing an `id` property");J.$id=_.external.uri(X)}Object.assign(J,A.def??A.schema);let Y=_.external?.defs??{};for(let X of _.seen.entries()){let b=X[1];if(b.def&&b.defId)Y[b.defId]=b.def}if(_.external);else if(Object.keys(Y).length>0)if(_.target==="draft-2020-12")J.$defs=Y;else J.definitions=Y;try{let X=JSON.parse(JSON.stringify(J));return Object.defineProperty(X,"~standard",{value:{...z["~standard"],jsonSchema:{input:ez(z,"input",_.processors),output:ez(z,"output",_.processors)}},enumerable:!1,writable:!1}),X}catch(X){throw Error("Error converting schema to JSON.")}}function G9(_,z){let A=z??{seen:new Set};if(A.seen.has(_))return!1;A.seen.add(_);let G=_._zod.def;if(G.type==="transform")return!0;if(G.type==="array")return G9(G.element,A);if(G.type==="set")return G9(G.valueType,A);if(G.type==="lazy")return G9(G.getter(),A);if(G.type==="promise"||G.type==="optional"||G.type==="nonoptional"||G.type==="nullable"||G.type==="readonly"||G.type==="default"||G.type==="prefault")return G9(G.innerType,A);if(G.type==="intersection")return G9(G.left,A)||G9(G.right,A);if(G.type==="record"||G.type==="map")return G9(G.keyType,A)||G9(G.valueType,A);if(G.type==="pipe")return G9(G.in,A)||G9(G.out,A);if(G.type==="object"){for(let J in G.shape)if(G9(G.shape[J],A))return!0;return!1}if(G.type==="union"){for(let J of G.options)if(G9(J,A))return!0;return!1}if(G.type==="tuple"){for(let J of G.items)if(G9(J,A))return!0;if(G.rest&&G9(G.rest,A))return!0;return!1}return!1}var qZ=(_,z={})=>(A)=>{let G=o2({...A,processors:z});return x0(_,G),a2(G,_),s2(G,_)},ez=(_,z,A={})=>(G)=>{let{libraryOptions:J,target:Y}=G??{},X=o2({...J??{},target:Y,io:z,processors:A});return x0(_,X),a2(X,_),s2(X,_)};var zx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},FZ=(_,z,A,G)=>{let J=A;J.type="string";let{minimum:Y,maximum:X,format:b,patterns:Q,contentEncoding:$}=_._zod.bag;if(typeof Y==="number")J.minLength=Y;if(typeof X==="number")J.maxLength=X;if(b){if(J.format=zx[b]??b,J.format==="")delete J.format;if(b==="time")delete J.format}if($)J.contentEncoding=$;if(Q&&Q.size>0){let H=[...Q];if(H.length===1)J.pattern=H[0].source;else if(H.length>1)J.allOf=[...H.map((B)=>({...z.target==="draft-07"||z.target==="draft-04"||z.target==="openapi-3.0"?{type:"string"}:{},pattern:B.source}))]}},KZ=(_,z,A,G)=>{let J=A,{minimum:Y,maximum:X,format:b,multipleOf:Q,exclusiveMaximum:$,exclusiveMinimum:H}=_._zod.bag;if(typeof b==="string"&&b.includes("int"))J.type="integer";else J.type="number";if(typeof H==="number")if(z.target==="draft-04"||z.target==="openapi-3.0")J.minimum=H,J.exclusiveMinimum=!0;else J.exclusiveMinimum=H;if(typeof Y==="number"){if(J.minimum=Y,typeof H==="number"&&z.target!=="draft-04")if(H>=Y)delete J.minimum;else delete J.exclusiveMinimum}if(typeof $==="number")if(z.target==="draft-04"||z.target==="openapi-3.0")J.maximum=$,J.exclusiveMaximum=!0;else J.exclusiveMaximum=$;if(typeof X==="number"){if(J.maximum=X,typeof $==="number"&&z.target!=="draft-04")if($<=X)delete J.maximum;else delete J.exclusiveMaximum}if(typeof Q==="number")J.multipleOf=Q},WZ=(_,z,A,G)=>{A.type="boolean"};var VZ=(_,z,A,G)=>{if(z.target==="openapi-3.0")A.type="string",A.nullable=!0,A.enum=[null];else A.type="null"};var UZ=(_,z,A,G)=>{A.not={}};var DZ=(_,z,A,G)=>{};var MZ=(_,z,A,G)=>{let J=_._zod.def,Y=lz(J.entries);if(Y.every((X)=>typeof X==="number"))A.type="number";if(Y.every((X)=>typeof X==="string"))A.type="string";A.enum=Y},NZ=(_,z,A,G)=>{let J=_._zod.def,Y=[];for(let X of J.values)if(X===void 0){if(z.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof X==="bigint")if(z.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else Y.push(Number(X));else Y.push(X);if(Y.length===0);else if(Y.length===1){let X=Y[0];if(A.type=X===null?"null":typeof X,z.target==="draft-04"||z.target==="openapi-3.0")A.enum=[X];else A.const=X}else{if(Y.every((X)=>typeof X==="number"))A.type="number";if(Y.every((X)=>typeof X==="string"))A.type="string";if(Y.every((X)=>typeof X==="boolean"))A.type="boolean";if(Y.every((X)=>X===null))A.type="null";A.enum=Y}};var EZ=(_,z,A,G)=>{if(z.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var wZ=(_,z,A,G)=>{if(z.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var OZ=(_,z,A,G)=>{let J=A,Y=_._zod.def,{minimum:X,maximum:b}=_._zod.bag;if(typeof X==="number")J.minItems=X;if(typeof b==="number")J.maxItems=b;J.type="array",J.items=x0(Y.element,z,{...G,path:[...G.path,"items"]})},LZ=(_,z,A,G)=>{let J=A,Y=_._zod.def;J.type="object",J.properties={};let X=Y.shape;for(let $ in X)J.properties[$]=x0(X[$],z,{...G,path:[...G.path,"properties",$]});let b=new Set(Object.keys(X)),Q=new Set([...b].filter(($)=>{let H=Y.shape[$]._zod;if(z.io==="input")return H.optin===void 0;else return H.optout===void 0}));if(Q.size>0)J.required=Array.from(Q);if(Y.catchall?._zod.def.type==="never")J.additionalProperties=!1;else if(!Y.catchall){if(z.io==="output")J.additionalProperties=!1}else if(Y.catchall)J.additionalProperties=x0(Y.catchall,z,{...G,path:[...G.path,"additionalProperties"]})},jZ=(_,z,A,G)=>{let J=_._zod.def,Y=J.inclusive===!1,X=J.options.map((b,Q)=>x0(b,z,{...G,path:[...G.path,Y?"oneOf":"anyOf",Q]}));if(Y)A.oneOf=X;else A.anyOf=X},RZ=(_,z,A,G)=>{let J=_._zod.def,Y=x0(J.left,z,{...G,path:[...G.path,"allOf",0]}),X=x0(J.right,z,{...G,path:[...G.path,"allOf",1]}),b=($)=>("allOf"in $)&&Object.keys($).length===1,Q=[...b(Y)?Y.allOf:[Y],...b(X)?X.allOf:[X]];A.allOf=Q};var PZ=(_,z,A,G)=>{let J=A,Y=_._zod.def;J.type="object";let X=Y.keyType,Q=X._zod.bag?.patterns;if(Y.mode==="loose"&&Q&&Q.size>0){let H=x0(Y.valueType,z,{...G,path:[...G.path,"patternProperties","*"]});J.patternProperties={};for(let B of Q)J.patternProperties[B.source]=H}else{if(z.target==="draft-07"||z.target==="draft-2020-12")J.propertyNames=x0(Y.keyType,z,{...G,path:[...G.path,"propertyNames"]});J.additionalProperties=x0(Y.valueType,z,{...G,path:[...G.path,"additionalProperties"]})}let $=X._zod.values;if($){let H=[...$].filter((B)=>typeof B==="string"||typeof B==="number");if(H.length>0)J.required=H}},SZ=(_,z,A,G)=>{let J=_._zod.def,Y=x0(J.innerType,z,G),X=z.seen.get(_);if(z.target==="openapi-3.0")X.ref=J.innerType,A.nullable=!0;else A.anyOf=[Y,{type:"null"}]},kZ=(_,z,A,G)=>{let J=_._zod.def;x0(J.innerType,z,G);let Y=z.seen.get(_);Y.ref=J.innerType},IZ=(_,z,A,G)=>{let J=_._zod.def;x0(J.innerType,z,G);let Y=z.seen.get(_);Y.ref=J.innerType,A.default=JSON.parse(JSON.stringify(J.defaultValue))},xZ=(_,z,A,G)=>{let J=_._zod.def;x0(J.innerType,z,G);let Y=z.seen.get(_);if(Y.ref=J.innerType,z.io==="input")A._prefault=JSON.parse(JSON.stringify(J.defaultValue))},TZ=(_,z,A,G)=>{let J=_._zod.def;x0(J.innerType,z,G);let Y=z.seen.get(_);Y.ref=J.innerType;let X;try{X=J.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}A.default=X},CZ=(_,z,A,G)=>{let J=_._zod.def,Y=z.io==="input"?J.in._zod.def.type==="transform"?J.out:J.in:J.out;x0(Y,z,G);let X=z.seen.get(_);X.ref=Y},vZ=(_,z,A,G)=>{let J=_._zod.def;x0(J.innerType,z,G);let Y=z.seen.get(_);Y.ref=J.innerType,A.readOnly=!0};var t2=(_,z,A,G)=>{let J=_._zod.def;x0(J.innerType,z,G);let Y=z.seen.get(_);Y.ref=J.innerType};function u1(_){return!!_._zod}function K_(_,z){if(u1(_))return iz(_,z);return _.safeParse(z)}function Q8(_){if(!_)return;let z;if(u1(_))z=_._zod?.def?.shape;else z=_.shape;if(!z)return;if(typeof z==="function")try{return z()}catch{return}return z}function yZ(_){if(u1(_)){let Y=_._zod?.def;if(Y){if(Y.value!==void 0)return Y.value;if(Array.isArray(Y.values)&&Y.values.length>0)return Y.values[0]}}let A=_._def;if(A){if(A.value!==void 0)return A.value;if(Array.isArray(A.values)&&A.values.length>0)return A.values[0]}let G=_.value;if(G!==void 0)return G;return}var z3={};qA(z3,{time:()=>z7,duration:()=>A7,datetime:()=>e2,date:()=>_7,ZodISOTime:()=>hZ,ZodISODuration:()=>mZ,ZodISODateTime:()=>gZ,ZodISODate:()=>fZ});var gZ=w("ZodISODateTime",(_,z)=>{rH.init(_,z),L0.init(_,z)});function e2(_){return eB(gZ,_)}var fZ=w("ZodISODate",(_,z)=>{nH.init(_,z),L0.init(_,z)});function _7(_){return _Z(fZ,_)}var hZ=w("ZodISOTime",(_,z)=>{iH.init(_,z),L0.init(_,z)});function z7(_){return zZ(hZ,_)}var mZ=w("ZodISODuration",(_,z)=>{oH.init(_,z),L0.init(_,z)});function A7(_){return AZ(mZ,_)}var uZ=(_,z)=>{i6.init(_,z),_.name="ZodError",Object.defineProperties(_,{format:{value:(A)=>k$(_,A)},flatten:{value:(A)=>S$(_,A)},addIssue:{value:(A)=>{_.issues.push(A),_.message=JSON.stringify(_.issues,g1,2)}},addIssues:{value:(A)=>{_.issues.push(...A),_.message=JSON.stringify(_.issues,g1,2)}},isEmpty:{get(){return _.issues.length===0}}})},a40=w("ZodError",uZ),E9=w("ZodError",uZ,{Parent:Error});var cZ=o6(E9),lZ=a6(E9),pZ=nz(E9),dZ=oz(E9),rZ=I$(E9),nZ=x$(E9),iZ=T$(E9),oZ=C$(E9),aZ=v$(E9),sZ=y$(E9),tZ=g$(E9),eZ=f$(E9);var R0=w("ZodType",(_,z)=>{return M0.init(_,z),Object.assign(_["~standard"],{jsonSchema:{input:ez(_,"input"),output:ez(_,"output")}}),_.toJSONSchema=qZ(_,{}),_.def=z,_.type=z.type,Object.defineProperty(_,"_def",{value:z}),_.check=(...A)=>{return _.clone(b0.mergeDefs(z,{checks:[...z.checks??[],...A.map((G)=>typeof G==="function"?{_zod:{check:G,def:{check:"custom"},onattach:[]}}:G)]}),{parent:!0})},_.with=_.check,_.clone=(A,G)=>r9(_,A,G),_.brand=()=>_,_.register=(A,G)=>{return A.add(_,G),_},_.parse=(A,G)=>cZ(_,A,G,{callee:_.parse}),_.safeParse=(A,G)=>pZ(_,A,G),_.parseAsync=async(A,G)=>lZ(_,A,G,{callee:_.parseAsync}),_.safeParseAsync=async(A,G)=>dZ(_,A,G),_.spa=_.safeParseAsync,_.encode=(A,G)=>rZ(_,A,G),_.decode=(A,G)=>nZ(_,A,G),_.encodeAsync=async(A,G)=>iZ(_,A,G),_.decodeAsync=async(A,G)=>oZ(_,A,G),_.safeEncode=(A,G)=>aZ(_,A,G),_.safeDecode=(A,G)=>sZ(_,A,G),_.safeEncodeAsync=async(A,G)=>tZ(_,A,G),_.safeDecodeAsync=async(A,G)=>eZ(_,A,G),_.refine=(A,G)=>_.check(_T(A,G)),_.superRefine=(A)=>_.check(zT(A)),_.overwrite=(A)=>_.check(F_(A)),_.optional=()=>k0(_),_.exactOptional=()=>cx(_),_.nullable=()=>Aq(_),_.nullish=()=>k0(Aq(_)),_.nonoptional=(A)=>ix(_,A),_.array=()=>G0(_),_.or=(A)=>U0([_,A]),_.and=(A)=>H8(_,A),_.transform=(A)=>J7(_,bq(A)),_.default=(A)=>dx(_,A),_.prefault=(A)=>nx(_,A),_.catch=(A)=>ax(_,A),_.pipe=(A)=>J7(_,A),_.readonly=()=>ex(_),_.describe=(A)=>{let G=_.clone();return l_.add(G,{description:A}),G},Object.defineProperty(_,"description",{get(){return l_.get(_)?.description},configurable:!0}),_.meta=(...A)=>{if(A.length===0)return l_.get(_);let G=_.clone();return l_.add(G,A[0]),G},_.isOptional=()=>_.safeParse(void 0).success,_.isNullable=()=>_.safeParse(null).success,_.apply=(A)=>A(_),_}),Gq=w("_ZodString",(_,z)=>{A8.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(G,J,Y)=>FZ(_,G,J,Y);let A=_._zod.bag;_.format=A.format??null,_.minLength=A.minimum??null,_.maxLength=A.maximum??null,_.regex=(...G)=>_.check(f2(...G)),_.includes=(...G)=>_.check(u2(...G)),_.startsWith=(...G)=>_.check(c2(...G)),_.endsWith=(...G)=>_.check(l2(...G)),_.min=(...G)=>_.check(m1(...G)),_.max=(...G)=>_.check(X8(...G)),_.length=(...G)=>_.check(b8(...G)),_.nonempty=(...G)=>_.check(m1(1,...G)),_.lowercase=(G)=>_.check(h2(G)),_.uppercase=(G)=>_.check(m2(G)),_.trim=()=>_.check(d2()),_.normalize=(...G)=>_.check(p2(...G)),_.toLowerCase=()=>_.check(r2()),_.toUpperCase=()=>_.check(n2()),_.slugify=()=>_.check(i2())}),Bx=w("ZodString",(_,z)=>{A8.init(_,z),Gq.init(_,z),_.email=(A)=>_.check(xB(Zx,A)),_.url=(A)=>_.check(gB(qx,A)),_.jwt=(A)=>_.check(tB(Px,A)),_.emoji=(A)=>_.check(fB(Fx,A)),_.guid=(A)=>_.check(g2(_q,A)),_.uuid=(A)=>_.check(TB($8,A)),_.uuidv4=(A)=>_.check(CB($8,A)),_.uuidv6=(A)=>_.check(vB($8,A)),_.uuidv7=(A)=>_.check(yB($8,A)),_.nanoid=(A)=>_.check(hB(Kx,A)),_.guid=(A)=>_.check(g2(_q,A)),_.cuid=(A)=>_.check(mB(Wx,A)),_.cuid2=(A)=>_.check(uB(Vx,A)),_.ulid=(A)=>_.check(cB(Ux,A)),_.base64=(A)=>_.check(oB(Lx,A)),_.base64url=(A)=>_.check(aB(jx,A)),_.xid=(A)=>_.check(lB(Dx,A)),_.ksuid=(A)=>_.check(pB(Mx,A)),_.ipv4=(A)=>_.check(dB(Nx,A)),_.ipv6=(A)=>_.check(rB(Ex,A)),_.cidrv4=(A)=>_.check(nB(wx,A)),_.cidrv6=(A)=>_.check(iB(Ox,A)),_.e164=(A)=>_.check(sB(Rx,A)),_.datetime=(A)=>_.check(e2(A)),_.date=(A)=>_.check(_7(A)),_.time=(A)=>_.check(z7(A)),_.duration=(A)=>_.check(A7(A))});function E(_){return IB(Bx,_)}var L0=w("ZodStringFormat",(_,z)=>{N0.init(_,z),Gq.init(_,z)}),Zx=w("ZodEmail",(_,z)=>{gH.init(_,z),L0.init(_,z)});var _q=w("ZodGUID",(_,z)=>{vH.init(_,z),L0.init(_,z)});var $8=w("ZodUUID",(_,z)=>{yH.init(_,z),L0.init(_,z)});var qx=w("ZodURL",(_,z)=>{fH.init(_,z),L0.init(_,z)});var Fx=w("ZodEmoji",(_,z)=>{hH.init(_,z),L0.init(_,z)});var Kx=w("ZodNanoID",(_,z)=>{mH.init(_,z),L0.init(_,z)});var Wx=w("ZodCUID",(_,z)=>{uH.init(_,z),L0.init(_,z)});var Vx=w("ZodCUID2",(_,z)=>{cH.init(_,z),L0.init(_,z)});var Ux=w("ZodULID",(_,z)=>{lH.init(_,z),L0.init(_,z)});var Dx=w("ZodXID",(_,z)=>{pH.init(_,z),L0.init(_,z)});var Mx=w("ZodKSUID",(_,z)=>{dH.init(_,z),L0.init(_,z)});var Nx=w("ZodIPv4",(_,z)=>{aH.init(_,z),L0.init(_,z)});var Ex=w("ZodIPv6",(_,z)=>{sH.init(_,z),L0.init(_,z)});var wx=w("ZodCIDRv4",(_,z)=>{tH.init(_,z),L0.init(_,z)});var Ox=w("ZodCIDRv6",(_,z)=>{eH.init(_,z),L0.init(_,z)});var Lx=w("ZodBase64",(_,z)=>{zB.init(_,z),L0.init(_,z)});var jx=w("ZodBase64URL",(_,z)=>{AB.init(_,z),L0.init(_,z)});var Rx=w("ZodE164",(_,z)=>{GB.init(_,z),L0.init(_,z)});var Px=w("ZodJWT",(_,z)=>{JB.init(_,z),L0.init(_,z)});var Jq=w("ZodNumber",(_,z)=>{T2.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(G,J,Y)=>KZ(_,G,J,Y),_.gt=(G,J)=>_.check(J8(G,J)),_.gte=(G,J)=>_.check(tz(G,J)),_.min=(G,J)=>_.check(tz(G,J)),_.lt=(G,J)=>_.check(G8(G,J)),_.lte=(G,J)=>_.check(sz(G,J)),_.max=(G,J)=>_.check(sz(G,J)),_.int=(G)=>_.check(zq(G)),_.safe=(G)=>_.check(zq(G)),_.positive=(G)=>_.check(J8(0,G)),_.nonnegative=(G)=>_.check(tz(0,G)),_.negative=(G)=>_.check(G8(0,G)),_.nonpositive=(G)=>_.check(sz(0,G)),_.multipleOf=(G,J)=>_.check(Y8(G,J)),_.step=(G,J)=>_.check(Y8(G,J)),_.finite=()=>_;let A=_._zod.bag;_.minValue=Math.max(A.minimum??Number.NEGATIVE_INFINITY,A.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,_.maxValue=Math.min(A.maximum??Number.POSITIVE_INFINITY,A.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,_.isInt=(A.format??"").includes("int")||Number.isSafeInteger(A.multipleOf??0.5),_.isFinite=!0,_.format=A.format??null});function K0(_){return GZ(Jq,_)}var Sx=w("ZodNumberFormat",(_,z)=>{YB.init(_,z),Jq.init(_,z)});function zq(_){return JZ(Sx,_)}var kx=w("ZodBoolean",(_,z)=>{XB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>WZ(_,A,G,J)});function f0(_){return YZ(kx,_)}var Ix=w("ZodNull",(_,z)=>{bB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>VZ(_,A,G,J)});function Y7(_){return XZ(Ix,_)}var xx=w("ZodUnknown",(_,z)=>{QB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>DZ(_,A,G,J)});function j0(){return bZ(xx)}var Tx=w("ZodNever",(_,z)=>{$B.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>UZ(_,A,G,J)});function Cx(_){return QZ(Tx,_)}var vx=w("ZodArray",(_,z)=>{HB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>OZ(_,A,G,J),_.element=z.element,_.min=(A,G)=>_.check(m1(A,G)),_.nonempty=(A)=>_.check(m1(1,A)),_.max=(A,G)=>_.check(X8(A,G)),_.length=(A,G)=>_.check(b8(A,G)),_.unwrap=()=>_.element});function G0(_,z){return $Z(vx,_,z)}var Yq=w("ZodObject",(_,z)=>{qB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>LZ(_,A,G,J),b0.defineLazy(_,"shape",()=>{return z.shape}),_.keyof=()=>Z9(Object.keys(_._zod.def.shape)),_.catchall=(A)=>_.clone({..._._zod.def,catchall:A}),_.passthrough=()=>_.clone({..._._zod.def,catchall:j0()}),_.loose=()=>_.clone({..._._zod.def,catchall:j0()}),_.strict=()=>_.clone({..._._zod.def,catchall:Cx()}),_.strip=()=>_.clone({..._._zod.def,catchall:void 0}),_.extend=(A)=>{return b0.extend(_,A)},_.safeExtend=(A)=>{return b0.safeExtend(_,A)},_.merge=(A)=>b0.merge(_,A),_.pick=(A)=>b0.pick(_,A),_.omit=(A)=>b0.omit(_,A),_.partial=(...A)=>b0.partial(Qq,_,A[0]),_.required=(...A)=>b0.required($q,_,A[0])});function C(_,z){let A={type:"object",shape:_??{},...b0.normalizeParams(z)};return new Yq(A)}function J9(_,z){return new Yq({type:"object",shape:_,catchall:j0(),...b0.normalizeParams(z)})}var Xq=w("ZodUnion",(_,z)=>{C2.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>jZ(_,A,G,J),_.options=z.options});function U0(_,z){return new Xq({type:"union",options:_,...b0.normalizeParams(z)})}var yx=w("ZodDiscriminatedUnion",(_,z)=>{Xq.init(_,z),FB.init(_,z)});function X7(_,z,A){return new yx({type:"union",options:z,discriminator:_,...b0.normalizeParams(A)})}var gx=w("ZodIntersection",(_,z)=>{KB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>RZ(_,A,G,J)});function H8(_,z){return new gx({type:"intersection",left:_,right:z})}var fx=w("ZodRecord",(_,z)=>{WB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>PZ(_,A,G,J),_.keyType=z.keyType,_.valueType=z.valueType});function P0(_,z,A){return new fx({type:"record",keyType:_,valueType:z,...b0.normalizeParams(A)})}var G7=w("ZodEnum",(_,z)=>{VB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(G,J,Y)=>MZ(_,G,J,Y),_.enum=z.entries,_.options=Object.values(z.entries);let A=new Set(Object.keys(z.entries));_.extract=(G,J)=>{let Y={};for(let X of G)if(A.has(X))Y[X]=z.entries[X];else throw Error(`Key ${X} not found in enum`);return new G7({...z,checks:[],...b0.normalizeParams(J),entries:Y})},_.exclude=(G,J)=>{let Y={...z.entries};for(let X of G)if(A.has(X))delete Y[X];else throw Error(`Key ${X} not found in enum`);return new G7({...z,checks:[],...b0.normalizeParams(J),entries:Y})}});function Z9(_,z){let A=Array.isArray(_)?Object.fromEntries(_.map((G)=>[G,G])):_;return new G7({type:"enum",entries:A,...b0.normalizeParams(z)})}var hx=w("ZodLiteral",(_,z)=>{UB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>NZ(_,A,G,J),_.values=new Set(z.values),Object.defineProperty(_,"value",{get(){if(z.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return z.values[0]}})});function h(_,z){return new hx({type:"literal",values:Array.isArray(_)?_:[_],...b0.normalizeParams(z)})}var mx=w("ZodTransform",(_,z)=>{DB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>wZ(_,A,G,J),_._zod.parse=(A,G)=>{if(G.direction==="backward")throw new uz(_.constructor.name);A.addIssue=(Y)=>{if(typeof Y==="string")A.issues.push(b0.issue(Y,A.value,z));else{let X=Y;if(X.fatal)X.continue=!1;X.code??(X.code="custom"),X.input??(X.input=A.value),X.inst??(X.inst=_),A.issues.push(b0.issue(X))}};let J=z.transform(A.value,A);if(J instanceof Promise)return J.then((Y)=>{return A.value=Y,A});return A.value=J,A}});function bq(_){return new mx({type:"transform",transform:_})}var Qq=w("ZodOptional",(_,z)=>{v2.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>t2(_,A,G,J),_.unwrap=()=>_._zod.def.innerType});function k0(_){return new Qq({type:"optional",innerType:_})}var ux=w("ZodExactOptional",(_,z)=>{MB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>t2(_,A,G,J),_.unwrap=()=>_._zod.def.innerType});function cx(_){return new ux({type:"optional",innerType:_})}var lx=w("ZodNullable",(_,z)=>{NB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>SZ(_,A,G,J),_.unwrap=()=>_._zod.def.innerType});function Aq(_){return new lx({type:"nullable",innerType:_})}var px=w("ZodDefault",(_,z)=>{EB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>IZ(_,A,G,J),_.unwrap=()=>_._zod.def.innerType,_.removeDefault=_.unwrap});function dx(_,z){return new px({type:"default",innerType:_,get defaultValue(){return typeof z==="function"?z():b0.shallowClone(z)}})}var rx=w("ZodPrefault",(_,z)=>{wB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>xZ(_,A,G,J),_.unwrap=()=>_._zod.def.innerType});function nx(_,z){return new rx({type:"prefault",innerType:_,get defaultValue(){return typeof z==="function"?z():b0.shallowClone(z)}})}var $q=w("ZodNonOptional",(_,z)=>{OB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>kZ(_,A,G,J),_.unwrap=()=>_._zod.def.innerType});function ix(_,z){return new $q({type:"nonoptional",innerType:_,...b0.normalizeParams(z)})}var ox=w("ZodCatch",(_,z)=>{LB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>TZ(_,A,G,J),_.unwrap=()=>_._zod.def.innerType,_.removeCatch=_.unwrap});function ax(_,z){return new ox({type:"catch",innerType:_,catchValue:typeof z==="function"?z:()=>z})}var sx=w("ZodPipe",(_,z)=>{jB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>CZ(_,A,G,J),_.in=z.in,_.out=z.out});function J7(_,z){return new sx({type:"pipe",in:_,out:z})}var tx=w("ZodReadonly",(_,z)=>{RB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>vZ(_,A,G,J),_.unwrap=()=>_._zod.def.innerType});function ex(_){return new tx({type:"readonly",innerType:_})}var Hq=w("ZodCustom",(_,z)=>{PB.init(_,z),R0.init(_,z),_._zod.processJSONSchema=(A,G,J)=>EZ(_,A,G,J)});function Bq(_,z){return HZ(Hq,_??(()=>!0),z)}function _T(_,z={}){return BZ(Hq,_,z)}function zT(_){return ZZ(_)}function b7(_,z){return J7(bq(_),z)}S9(y2());var Q7="2025-11-25";var Zq=[Q7,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],W_="io.modelcontextprotocol/related-task",Z8="2.0",l0=Bq((_)=>_!==null&&(typeof _==="object"||typeof _==="function")),qq=U0([E(),K0().int()]),Fq=E(),q10=J9({ttl:U0([K0(),Y7()]).optional(),pollInterval:K0().optional()}),AT=C({ttl:K0().optional()}),GT=C({taskId:E()}),$7=J9({progressToken:qq.optional(),[W_]:GT.optional()}),w9=C({_meta:$7.optional()}),A3=w9.extend({task:AT.optional()}),Kq=(_)=>A3.safeParse(_).success,p0=C({method:E(),params:w9.loose().optional()}),k9=C({_meta:$7.optional()}),I9=C({method:E(),params:k9.loose().optional()}),d0=J9({_meta:$7.optional()}),q8=U0([E(),K0().int()]),Wq=C({jsonrpc:h(Z8),id:q8,...p0.shape}).strict(),H7=(_)=>Wq.safeParse(_).success,Vq=C({jsonrpc:h(Z8),...I9.shape}).strict(),Uq=(_)=>Vq.safeParse(_).success,B7=C({jsonrpc:h(Z8),id:q8,result:d0}).strict(),G3=(_)=>B7.safeParse(_).success;var J0;(function(_){_[_.ConnectionClosed=-32000]="ConnectionClosed",_[_.RequestTimeout=-32001]="RequestTimeout",_[_.ParseError=-32700]="ParseError",_[_.InvalidRequest=-32600]="InvalidRequest",_[_.MethodNotFound=-32601]="MethodNotFound",_[_.InvalidParams=-32602]="InvalidParams",_[_.InternalError=-32603]="InternalError",_[_.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(J0||(J0={}));var Z7=C({jsonrpc:h(Z8),id:q8.optional(),error:C({code:K0().int(),message:E(),data:j0().optional()})}).strict();var Dq=(_)=>Z7.safeParse(_).success;var Mq=U0([Wq,Vq,B7,Z7]),F10=U0([B7,Z7]),F8=d0.strict(),JT=k9.extend({requestId:q8.optional(),reason:E().optional()}),K8=I9.extend({method:h("notifications/cancelled"),params:JT}),YT=C({src:E(),mimeType:E().optional(),sizes:G0(E()).optional(),theme:Z9(["light","dark"]).optional()}),J3=C({icons:G0(YT).optional()}),c1=C({name:E(),title:E().optional()}),Nq=c1.extend({...c1.shape,...J3.shape,version:E(),websiteUrl:E().optional(),description:E().optional()}),XT=H8(C({applyDefaults:f0().optional()}),P0(E(),j0())),bT=b7((_)=>{if(_&&typeof _==="object"&&!Array.isArray(_)){if(Object.keys(_).length===0)return{form:{}}}return _},H8(C({form:XT.optional(),url:l0.optional()}),P0(E(),j0()).optional())),QT=J9({list:l0.optional(),cancel:l0.optional(),requests:J9({sampling:J9({createMessage:l0.optional()}).optional(),elicitation:J9({create:l0.optional()}).optional()}).optional()}),$T=J9({list:l0.optional(),cancel:l0.optional(),requests:J9({tools:J9({call:l0.optional()}).optional()}).optional()}),HT=C({experimental:P0(E(),l0).optional(),sampling:C({context:l0.optional(),tools:l0.optional()}).optional(),elicitation:bT.optional(),roots:C({listChanged:f0().optional()}).optional(),tasks:QT.optional()}),BT=w9.extend({protocolVersion:E(),capabilities:HT,clientInfo:Nq}),q7=p0.extend({method:h("initialize"),params:BT});var ZT=C({experimental:P0(E(),l0).optional(),logging:l0.optional(),completions:l0.optional(),prompts:C({listChanged:f0().optional()}).optional(),resources:C({subscribe:f0().optional(),listChanged:f0().optional()}).optional(),tools:C({listChanged:f0().optional()}).optional(),tasks:$T.optional()}),qT=d0.extend({protocolVersion:E(),capabilities:ZT,serverInfo:Nq,instructions:E().optional()}),F7=I9.extend({method:h("notifications/initialized"),params:k9.optional()});var W8=p0.extend({method:h("ping"),params:w9.optional()}),FT=C({progress:K0(),total:k0(K0()),message:k0(E())}),KT=C({...k9.shape,...FT.shape,progressToken:qq}),V8=I9.extend({method:h("notifications/progress"),params:KT}),WT=w9.extend({cursor:Fq.optional()}),Y3=p0.extend({params:WT.optional()}),X3=d0.extend({nextCursor:Fq.optional()}),VT=Z9(["working","input_required","completed","failed","cancelled"]),b3=C({taskId:E(),status:VT,ttl:U0([K0(),Y7()]),createdAt:E(),lastUpdatedAt:E(),pollInterval:k0(K0()),statusMessage:k0(E())}),l1=d0.extend({task:b3}),UT=k9.merge(b3),Q3=I9.extend({method:h("notifications/tasks/status"),params:UT}),U8=p0.extend({method:h("tasks/get"),params:w9.extend({taskId:E()})}),D8=d0.merge(b3),M8=p0.extend({method:h("tasks/result"),params:w9.extend({taskId:E()})}),K10=d0.loose(),N8=Y3.extend({method:h("tasks/list")}),E8=X3.extend({tasks:G0(b3)}),w8=p0.extend({method:h("tasks/cancel"),params:w9.extend({taskId:E()})}),Eq=d0.merge(b3),wq=C({uri:E(),mimeType:k0(E()),_meta:P0(E(),j0()).optional()}),Oq=wq.extend({text:E()}),K7=E().refine((_)=>{try{return atob(_),!0}catch{return!1}},{message:"Invalid Base64 string"}),Lq=wq.extend({blob:K7}),$3=Z9(["user","assistant"]),p1=C({audience:G0($3).optional(),priority:K0().min(0).max(1).optional(),lastModified:z3.datetime({offset:!0}).optional()}),jq=C({...c1.shape,...J3.shape,uri:E(),description:k0(E()),mimeType:k0(E()),annotations:p1.optional(),_meta:k0(J9({}))}),DT=C({...c1.shape,...J3.shape,uriTemplate:E(),description:k0(E()),mimeType:k0(E()),annotations:p1.optional(),_meta:k0(J9({}))}),MT=Y3.extend({method:h("resources/list")}),NT=X3.extend({resources:G0(jq)}),ET=Y3.extend({method:h("resources/templates/list")}),wT=X3.extend({resourceTemplates:G0(DT)}),W7=w9.extend({uri:E()}),OT=W7,LT=p0.extend({method:h("resources/read"),params:OT}),jT=d0.extend({contents:G0(U0([Oq,Lq]))}),RT=I9.extend({method:h("notifications/resources/list_changed"),params:k9.optional()}),PT=W7,ST=p0.extend({method:h("resources/subscribe"),params:PT}),kT=W7,IT=p0.extend({method:h("resources/unsubscribe"),params:kT}),xT=k9.extend({uri:E()}),TT=I9.extend({method:h("notifications/resources/updated"),params:xT}),CT=C({name:E(),description:k0(E()),required:k0(f0())}),vT=C({...c1.shape,...J3.shape,description:k0(E()),arguments:k0(G0(CT)),_meta:k0(J9({}))}),V7=Y3.extend({method:h("prompts/list")}),yT=X3.extend({prompts:G0(vT)}),gT=w9.extend({name:E(),arguments:P0(E(),E()).optional()}),fT=p0.extend({method:h("prompts/get"),params:gT}),U7=C({type:h("text"),text:E(),annotations:p1.optional(),_meta:P0(E(),j0()).optional()}),D7=C({type:h("image"),data:K7,mimeType:E(),annotations:p1.optional(),_meta:P0(E(),j0()).optional()}),M7=C({type:h("audio"),data:K7,mimeType:E(),annotations:p1.optional(),_meta:P0(E(),j0()).optional()}),hT=C({type:h("tool_use"),name:E(),id:E(),input:P0(E(),j0()),_meta:P0(E(),j0()).optional()}),mT=C({type:h("resource"),resource:U0([Oq,Lq]),annotations:p1.optional(),_meta:P0(E(),j0()).optional()}),uT=jq.extend({type:h("resource_link")}),N7=U0([U7,D7,M7,uT,mT]),cT=C({role:$3,content:N7}),lT=d0.extend({description:E().optional(),messages:G0(cT)}),pT=I9.extend({method:h("notifications/prompts/list_changed"),params:k9.optional()}),dT=C({title:E().optional(),readOnlyHint:f0().optional(),destructiveHint:f0().optional(),idempotentHint:f0().optional(),openWorldHint:f0().optional()}),rT=C({taskSupport:Z9(["required","optional","forbidden"]).optional()}),Rq=C({...c1.shape,...J3.shape,description:E().optional(),inputSchema:C({type:h("object"),properties:P0(E(),l0).optional(),required:G0(E()).optional()}).catchall(j0()),outputSchema:C({type:h("object"),properties:P0(E(),l0).optional(),required:G0(E()).optional()}).catchall(j0()).optional(),annotations:dT.optional(),execution:rT.optional(),_meta:P0(E(),j0()).optional()}),E7=Y3.extend({method:h("tools/list")}),nT=X3.extend({tools:G0(Rq)}),O8=d0.extend({content:G0(N7).default([]),structuredContent:P0(E(),j0()).optional(),isError:f0().optional()}),W10=O8.or(d0.extend({toolResult:j0()})),iT=A3.extend({name:E(),arguments:P0(E(),j0()).optional()}),w7=p0.extend({method:h("tools/call"),params:iT}),oT=I9.extend({method:h("notifications/tools/list_changed"),params:k9.optional()}),V10=C({autoRefresh:f0().default(!0),debounceMs:K0().int().nonnegative().default(300)}),H3=Z9(["debug","info","notice","warning","error","critical","alert","emergency"]),aT=w9.extend({level:H3}),O7=p0.extend({method:h("logging/setLevel"),params:aT}),sT=k9.extend({level:H3,logger:E().optional(),data:j0()}),tT=I9.extend({method:h("notifications/message"),params:sT}),eT=C({name:E().optional()}),_C=C({hints:G0(eT).optional(),costPriority:K0().min(0).max(1).optional(),speedPriority:K0().min(0).max(1).optional(),intelligencePriority:K0().min(0).max(1).optional()}),zC=C({mode:Z9(["auto","required","none"]).optional()}),AC=C({type:h("tool_result"),toolUseId:E().describe("The unique identifier for the corresponding tool call."),content:G0(N7).default([]),structuredContent:C({}).loose().optional(),isError:f0().optional(),_meta:P0(E(),j0()).optional()}),GC=X7("type",[U7,D7,M7]),B8=X7("type",[U7,D7,M7,hT,AC]),JC=C({role:$3,content:U0([B8,G0(B8)]),_meta:P0(E(),j0()).optional()}),YC=A3.extend({messages:G0(JC),modelPreferences:_C.optional(),systemPrompt:E().optional(),includeContext:Z9(["none","thisServer","allServers"]).optional(),temperature:K0().optional(),maxTokens:K0().int(),stopSequences:G0(E()).optional(),metadata:l0.optional(),tools:G0(Rq).optional(),toolChoice:zC.optional()}),XC=p0.extend({method:h("sampling/createMessage"),params:YC}),L7=d0.extend({model:E(),stopReason:k0(Z9(["endTurn","stopSequence","maxTokens"]).or(E())),role:$3,content:GC}),j7=d0.extend({model:E(),stopReason:k0(Z9(["endTurn","stopSequence","maxTokens","toolUse"]).or(E())),role:$3,content:U0([B8,G0(B8)])}),bC=C({type:h("boolean"),title:E().optional(),description:E().optional(),default:f0().optional()}),QC=C({type:h("string"),title:E().optional(),description:E().optional(),minLength:K0().optional(),maxLength:K0().optional(),format:Z9(["email","uri","date","date-time"]).optional(),default:E().optional()}),$C=C({type:Z9(["number","integer"]),title:E().optional(),description:E().optional(),minimum:K0().optional(),maximum:K0().optional(),default:K0().optional()}),HC=C({type:h("string"),title:E().optional(),description:E().optional(),enum:G0(E()),default:E().optional()}),BC=C({type:h("string"),title:E().optional(),description:E().optional(),oneOf:G0(C({const:E(),title:E()})),default:E().optional()}),ZC=C({type:h("string"),title:E().optional(),description:E().optional(),enum:G0(E()),enumNames:G0(E()).optional(),default:E().optional()}),qC=U0([HC,BC]),FC=C({type:h("array"),title:E().optional(),description:E().optional(),minItems:K0().optional(),maxItems:K0().optional(),items:C({type:h("string"),enum:G0(E())}),default:G0(E()).optional()}),KC=C({type:h("array"),title:E().optional(),description:E().optional(),minItems:K0().optional(),maxItems:K0().optional(),items:C({anyOf:G0(C({const:E(),title:E()}))}),default:G0(E()).optional()}),WC=U0([FC,KC]),VC=U0([ZC,qC,WC]),UC=U0([VC,bC,QC,$C]),DC=A3.extend({mode:h("form").optional(),message:E(),requestedSchema:C({type:h("object"),properties:P0(E(),UC),required:G0(E()).optional()})}),MC=A3.extend({mode:h("url"),message:E(),elicitationId:E(),url:E().url()}),NC=U0([DC,MC]),EC=p0.extend({method:h("elicitation/create"),params:NC}),wC=k9.extend({elicitationId:E()}),OC=I9.extend({method:h("notifications/elicitation/complete"),params:wC}),L8=d0.extend({action:Z9(["accept","decline","cancel"]),content:b7((_)=>_===null?void 0:_,P0(E(),U0([E(),K0(),f0(),G0(E())])).optional())}),LC=C({type:h("ref/resource"),uri:E()});var jC=C({type:h("ref/prompt"),name:E()}),RC=w9.extend({ref:U0([jC,LC]),argument:C({name:E(),value:E()}),context:C({arguments:P0(E(),E()).optional()}).optional()}),PC=p0.extend({method:h("completion/complete"),params:RC});var SC=d0.extend({completion:J9({values:G0(E()).max(100),total:k0(K0().int()),hasMore:k0(f0())})}),kC=C({uri:E().startsWith("file://"),name:E().optional(),_meta:P0(E(),j0()).optional()}),IC=p0.extend({method:h("roots/list"),params:w9.optional()}),R7=d0.extend({roots:G0(kC)}),xC=I9.extend({method:h("notifications/roots/list_changed"),params:k9.optional()}),U10=U0([W8,q7,PC,O7,fT,V7,MT,ET,LT,ST,IT,w7,E7,U8,M8,N8,w8]),D10=U0([K8,V8,F7,xC,Q3]),M10=U0([F8,L7,j7,L8,R7,D8,E8,l1]),N10=U0([W8,XC,EC,IC,U8,M8,N8,w8]),E10=U0([K8,V8,tT,TT,RT,oT,pT,Q3,OC]),w10=U0([F8,qT,SC,lT,yT,NT,wT,jT,O8,nT,D8,E8,l1]);class t extends Error{constructor(_,z,A){super(`MCP error ${_}: ${z}`);this.code=_,this.data=A,this.name="McpError"}static fromError(_,z,A){if(_===J0.UrlElicitationRequired&&A){let G=A;if(G.elicitations)return new Pq(G.elicitations,z)}return new t(_,z,A)}}class Pq extends t{constructor(_,z=`URL elicitation${_.length>1?"s":""} required`){super(J0.UrlElicitationRequired,z,{elicitations:_})}get elicitations(){return this.data?.elicitations??[]}}function V_(_){return _==="completed"||_==="failed"||_==="cancelled"}var TC=Symbol("Let zodToJsonSchema decide on which parser to use");var Az0=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function P7(_){let A=Q8(_)?.method;if(!A)throw Error("Schema is missing a method literal");let G=yZ(A);if(typeof G!=="string")throw Error("Schema method literal must be a string");return G}function S7(_,z){let A=K_(_,z);if(!A.success)throw A.error;return A.data}var hC=60000;class k7{constructor(_){if(this._options=_,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(K8,(z)=>{this._oncancel(z)}),this.setNotificationHandler(V8,(z)=>{this._onprogress(z)}),this.setRequestHandler(W8,(z)=>({})),this._taskStore=_?.taskStore,this._taskMessageQueue=_?.taskMessageQueue,this._taskStore)this.setRequestHandler(U8,async(z,A)=>{let G=await this._taskStore.getTask(z.params.taskId,A.sessionId);if(!G)throw new t(J0.InvalidParams,"Failed to retrieve task: Task not found");return{...G}}),this.setRequestHandler(M8,async(z,A)=>{let G=async()=>{let J=z.params.taskId;if(this._taskMessageQueue){let X;while(X=await this._taskMessageQueue.dequeue(J,A.sessionId)){if(X.type==="response"||X.type==="error"){let b=X.message,Q=b.id,$=this._requestResolvers.get(Q);if($)if(this._requestResolvers.delete(Q),X.type==="response")$(b);else{let H=b,B=new t(H.error.code,H.error.message,H.error.data);$(B)}else{let H=X.type==="response"?"Response":"Error";this._onerror(Error(`${H} handler missing for request ${Q}`))}continue}await this._transport?.send(X.message,{relatedRequestId:A.requestId})}}let Y=await this._taskStore.getTask(J,A.sessionId);if(!Y)throw new t(J0.InvalidParams,`Task not found: ${J}`);if(!V_(Y.status))return await this._waitForTaskUpdate(J,A.signal),await G();if(V_(Y.status)){let X=await this._taskStore.getTaskResult(J,A.sessionId);return this._clearTaskQueue(J),{...X,_meta:{...X._meta,[W_]:{taskId:J}}}}return await G()};return await G()}),this.setRequestHandler(N8,async(z,A)=>{try{let{tasks:G,nextCursor:J}=await this._taskStore.listTasks(z.params?.cursor,A.sessionId);return{tasks:G,nextCursor:J,_meta:{}}}catch(G){throw new t(J0.InvalidParams,`Failed to list tasks: ${G instanceof Error?G.message:String(G)}`)}}),this.setRequestHandler(w8,async(z,A)=>{try{let G=await this._taskStore.getTask(z.params.taskId,A.sessionId);if(!G)throw new t(J0.InvalidParams,`Task not found: ${z.params.taskId}`);if(V_(G.status))throw new t(J0.InvalidParams,`Cannot cancel task in terminal status: ${G.status}`);await this._taskStore.updateTaskStatus(z.params.taskId,"cancelled","Client cancelled task execution.",A.sessionId),this._clearTaskQueue(z.params.taskId);let J=await this._taskStore.getTask(z.params.taskId,A.sessionId);if(!J)throw new t(J0.InvalidParams,`Task not found after cancellation: ${z.params.taskId}`);return{_meta:{},...J}}catch(G){if(G instanceof t)throw G;throw new t(J0.InvalidRequest,`Failed to cancel task: ${G instanceof Error?G.message:String(G)}`)}})}async _oncancel(_){if(!_.params.requestId)return;this._requestHandlerAbortControllers.get(_.params.requestId)?.abort(_.params.reason)}_setupTimeout(_,z,A,G,J=!1){this._timeoutInfo.set(_,{timeoutId:setTimeout(G,z),startTime:Date.now(),timeout:z,maxTotalTimeout:A,resetTimeoutOnProgress:J,onTimeout:G})}_resetTimeout(_){let z=this._timeoutInfo.get(_);if(!z)return!1;let A=Date.now()-z.startTime;if(z.maxTotalTimeout&&A>=z.maxTotalTimeout)throw this._timeoutInfo.delete(_),t.fromError(J0.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:z.maxTotalTimeout,totalElapsed:A});return clearTimeout(z.timeoutId),z.timeoutId=setTimeout(z.onTimeout,z.timeout),!0}_cleanupTimeout(_){let z=this._timeoutInfo.get(_);if(z)clearTimeout(z.timeoutId),this._timeoutInfo.delete(_)}async connect(_){this._transport=_;let z=this.transport?.onclose;this._transport.onclose=()=>{z?.(),this._onclose()};let A=this.transport?.onerror;this._transport.onerror=(J)=>{A?.(J),this._onerror(J)};let G=this._transport?.onmessage;this._transport.onmessage=(J,Y)=>{if(G?.(J,Y),G3(J)||Dq(J))this._onresponse(J);else if(H7(J))this._onrequest(J,Y);else if(Uq(J))this._onnotification(J);else this._onerror(Error(`Unknown message type: ${JSON.stringify(J)}`))},await this._transport.start()}_onclose(){let _=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let z=t.fromError(J0.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let A of _.values())A(z)}_onerror(_){this.onerror?.(_)}_onnotification(_){let z=this._notificationHandlers.get(_.method)??this.fallbackNotificationHandler;if(z===void 0)return;Promise.resolve().then(()=>z(_)).catch((A)=>this._onerror(Error(`Uncaught error in notification handler: ${A}`)))}_onrequest(_,z){let A=this._requestHandlers.get(_.method)??this.fallbackRequestHandler,G=this._transport,J=_.params?._meta?.[W_]?.taskId;if(A===void 0){let $={jsonrpc:"2.0",id:_.id,error:{code:J0.MethodNotFound,message:"Method not found"}};if(J&&this._taskMessageQueue)this._enqueueTaskMessage(J,{type:"error",message:$,timestamp:Date.now()},G?.sessionId).catch((H)=>this._onerror(Error(`Failed to enqueue error response: ${H}`)));else G?.send($).catch((H)=>this._onerror(Error(`Failed to send an error response: ${H}`)));return}let Y=new AbortController;this._requestHandlerAbortControllers.set(_.id,Y);let X=Kq(_.params)?_.params.task:void 0,b=this._taskStore?this.requestTaskStore(_,G?.sessionId):void 0,Q={signal:Y.signal,sessionId:G?.sessionId,_meta:_.params?._meta,sendNotification:async($)=>{let H={relatedRequestId:_.id};if(J)H.relatedTask={taskId:J};await this.notification($,H)},sendRequest:async($,H,B)=>{let Z={...B,relatedRequestId:_.id};if(J&&!Z.relatedTask)Z.relatedTask={taskId:J};let q=Z.relatedTask?.taskId??J;if(q&&b)await b.updateTaskStatus(q,"input_required");return await this.request($,H,Z)},authInfo:z?.authInfo,requestId:_.id,requestInfo:z?.requestInfo,taskId:J,taskStore:b,taskRequestedTtl:X?.ttl,closeSSEStream:z?.closeSSEStream,closeStandaloneSSEStream:z?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(X)this.assertTaskHandlerCapability(_.method)}).then(()=>A(_,Q)).then(async($)=>{if(Y.signal.aborted)return;let H={result:$,jsonrpc:"2.0",id:_.id};if(J&&this._taskMessageQueue)await this._enqueueTaskMessage(J,{type:"response",message:H,timestamp:Date.now()},G?.sessionId);else await G?.send(H)},async($)=>{if(Y.signal.aborted)return;let H={jsonrpc:"2.0",id:_.id,error:{code:Number.isSafeInteger($.code)?$.code:J0.InternalError,message:$.message??"Internal error",...$.data!==void 0&&{data:$.data}}};if(J&&this._taskMessageQueue)await this._enqueueTaskMessage(J,{type:"error",message:H,timestamp:Date.now()},G?.sessionId);else await G?.send(H)}).catch(($)=>this._onerror(Error(`Failed to send response: ${$}`))).finally(()=>{this._requestHandlerAbortControllers.delete(_.id)})}_onprogress(_){let{progressToken:z,...A}=_.params,G=Number(z),J=this._progressHandlers.get(G);if(!J){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(_)}`));return}let Y=this._responseHandlers.get(G),X=this._timeoutInfo.get(G);if(X&&Y&&X.resetTimeoutOnProgress)try{this._resetTimeout(G)}catch(b){this._responseHandlers.delete(G),this._progressHandlers.delete(G),this._cleanupTimeout(G),Y(b);return}J(A)}_onresponse(_){let z=Number(_.id),A=this._requestResolvers.get(z);if(A){if(this._requestResolvers.delete(z),G3(_))A(_);else{let Y=new t(_.error.code,_.error.message,_.error.data);A(Y)}return}let G=this._responseHandlers.get(z);if(G===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(_)}`));return}this._responseHandlers.delete(z),this._cleanupTimeout(z);let J=!1;if(G3(_)&&_.result&&typeof _.result==="object"){let Y=_.result;if(Y.task&&typeof Y.task==="object"){let X=Y.task;if(typeof X.taskId==="string")J=!0,this._taskProgressTokens.set(X.taskId,z)}}if(!J)this._progressHandlers.delete(z);if(G3(_))G(_);else{let Y=t.fromError(_.error.code,_.error.message,_.error.data);G(Y)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(_,z,A){let{task:G}=A??{};if(!G){try{yield{type:"result",result:await this.request(_,z,A)}}catch(Y){yield{type:"error",error:Y instanceof t?Y:new t(J0.InternalError,String(Y))}}return}let J;try{let Y=await this.request(_,l1,A);if(Y.task)J=Y.task.taskId,yield{type:"taskCreated",task:Y.task};else throw new t(J0.InternalError,"Task creation did not return a task");while(!0){let X=await this.getTask({taskId:J},A);if(yield{type:"taskStatus",task:X},V_(X.status)){if(X.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:J},z,A)};else if(X.status==="failed")yield{type:"error",error:new t(J0.InternalError,`Task ${J} failed`)};else if(X.status==="cancelled")yield{type:"error",error:new t(J0.InternalError,`Task ${J} was cancelled`)};return}if(X.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:J},z,A)};return}let b=X.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((Q)=>setTimeout(Q,b)),A?.signal?.throwIfAborted()}}catch(Y){yield{type:"error",error:Y instanceof t?Y:new t(J0.InternalError,String(Y))}}}request(_,z,A){let{relatedRequestId:G,resumptionToken:J,onresumptiontoken:Y,task:X,relatedTask:b}=A??{};return new Promise((Q,$)=>{let H=(V)=>{$(V)};if(!this._transport){H(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(_.method),X)this.assertTaskCapability(_.method)}catch(V){H(V);return}A?.signal?.throwIfAborted();let B=this._requestMessageId++,Z={..._,jsonrpc:"2.0",id:B};if(A?.onprogress)this._progressHandlers.set(B,A.onprogress),Z.params={..._.params,_meta:{..._.params?._meta||{},progressToken:B}};if(X)Z.params={...Z.params,task:X};if(b)Z.params={...Z.params,_meta:{...Z.params?._meta||{},[W_]:b}};let q=(V)=>{this._responseHandlers.delete(B),this._progressHandlers.delete(B),this._cleanupTimeout(B),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:B,reason:String(V)}},{relatedRequestId:G,resumptionToken:J,onresumptiontoken:Y}).catch((L)=>this._onerror(Error(`Failed to send cancellation: ${L}`)));let N=V instanceof t?V:new t(J0.RequestTimeout,String(V));$(N)};this._responseHandlers.set(B,(V)=>{if(A?.signal?.aborted)return;if(V instanceof Error)return $(V);try{let N=K_(z,V.result);if(!N.success)$(N.error);else Q(N.data)}catch(N){$(N)}}),A?.signal?.addEventListener("abort",()=>{q(A?.signal?.reason)});let F=A?.timeout??hC,K=()=>q(t.fromError(J0.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(B,F,A?.maxTotalTimeout,K,A?.resetTimeoutOnProgress??!1);let W=b?.taskId;if(W){let V=(N)=>{let L=this._responseHandlers.get(B);if(L)L(N);else this._onerror(Error(`Response handler missing for side-channeled request ${B}`))};this._requestResolvers.set(B,V),this._enqueueTaskMessage(W,{type:"request",message:Z,timestamp:Date.now()}).catch((N)=>{this._cleanupTimeout(B),$(N)})}else this._transport.send(Z,{relatedRequestId:G,resumptionToken:J,onresumptiontoken:Y}).catch((V)=>{this._cleanupTimeout(B),$(V)})})}async getTask(_,z){return this.request({method:"tasks/get",params:_},D8,z)}async getTaskResult(_,z,A){return this.request({method:"tasks/result",params:_},z,A)}async listTasks(_,z){return this.request({method:"tasks/list",params:_},E8,z)}async cancelTask(_,z){return this.request({method:"tasks/cancel",params:_},Eq,z)}async notification(_,z){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(_.method);let A=z?.relatedTask?.taskId;if(A){let X={..._,jsonrpc:"2.0",params:{..._.params,_meta:{..._.params?._meta||{},[W_]:z.relatedTask}}};await this._enqueueTaskMessage(A,{type:"notification",message:X,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(_.method)&&!_.params&&!z?.relatedRequestId&&!z?.relatedTask){if(this._pendingDebouncedNotifications.has(_.method))return;this._pendingDebouncedNotifications.add(_.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(_.method),!this._transport)return;let X={..._,jsonrpc:"2.0"};if(z?.relatedTask)X={...X,params:{...X.params,_meta:{...X.params?._meta||{},[W_]:z.relatedTask}}};this._transport?.send(X,z).catch((b)=>this._onerror(b))});return}let Y={..._,jsonrpc:"2.0"};if(z?.relatedTask)Y={...Y,params:{...Y.params,_meta:{...Y.params?._meta||{},[W_]:z.relatedTask}}};await this._transport.send(Y,z)}setRequestHandler(_,z){let A=P7(_);this.assertRequestHandlerCapability(A),this._requestHandlers.set(A,(G,J)=>{let Y=S7(_,G);return Promise.resolve(z(Y,J))})}removeRequestHandler(_){this._requestHandlers.delete(_)}assertCanSetRequestHandler(_){if(this._requestHandlers.has(_))throw Error(`A request handler for ${_} already exists, which would be overridden`)}setNotificationHandler(_,z){let A=P7(_);this._notificationHandlers.set(A,(G)=>{let J=S7(_,G);return Promise.resolve(z(J))})}removeNotificationHandler(_){this._notificationHandlers.delete(_)}_cleanupTaskProgressHandler(_){let z=this._taskProgressTokens.get(_);if(z!==void 0)this._progressHandlers.delete(z),this._taskProgressTokens.delete(_)}async _enqueueTaskMessage(_,z,A){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let G=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(_,z,A,G)}async _clearTaskQueue(_,z){if(this._taskMessageQueue){let A=await this._taskMessageQueue.dequeueAll(_,z);for(let G of A)if(G.type==="request"&&H7(G.message)){let J=G.message.id,Y=this._requestResolvers.get(J);if(Y)Y(new t(J0.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(J);else this._onerror(Error(`Resolver missing for request ${J} during task ${_} cleanup`))}}}async _waitForTaskUpdate(_,z){let A=this._options?.defaultTaskPollInterval??1000;try{let G=await this._taskStore?.getTask(_);if(G?.pollInterval)A=G.pollInterval}catch{}return new Promise((G,J)=>{if(z.aborted){J(new t(J0.InvalidRequest,"Request cancelled"));return}let Y=setTimeout(G,A);z.addEventListener("abort",()=>{clearTimeout(Y),J(new t(J0.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(_,z){let A=this._taskStore;if(!A)throw Error("No task store configured");return{createTask:async(G)=>{if(!_)throw Error("No request provided");return await A.createTask(G,_.id,{method:_.method,params:_.params},z)},getTask:async(G)=>{let J=await A.getTask(G,z);if(!J)throw new t(J0.InvalidParams,"Failed to retrieve task: Task not found");return J},storeTaskResult:async(G,J,Y)=>{await A.storeTaskResult(G,J,Y,z);let X=await A.getTask(G,z);if(X){let b=Q3.parse({method:"notifications/tasks/status",params:X});if(await this.notification(b),V_(X.status))this._cleanupTaskProgressHandler(G)}},getTaskResult:(G)=>{return A.getTaskResult(G,z)},updateTaskStatus:async(G,J,Y)=>{let X=await A.getTask(G,z);if(!X)throw new t(J0.InvalidParams,`Task "${G}" not found - it may have been cleaned up`);if(V_(X.status))throw new t(J0.InvalidParams,`Cannot update task "${G}" from terminal status "${X.status}" to "${J}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await A.updateTaskStatus(G,J,Y,z);let b=await A.getTask(G,z);if(b){let Q=Q3.parse({method:"notifications/tasks/status",params:b});if(await this.notification(Q),V_(b.status))this._cleanupTaskProgressHandler(G)}},listTasks:(G)=>{return A.listTasks(G,z)}}}}function Sq(_){return _!==null&&typeof _==="object"&&!Array.isArray(_)}function kq(_,z){let A={..._};for(let G in z){let J=G,Y=z[J];if(Y===void 0)continue;let X=A[J];if(Sq(X)&&Sq(Y))A[J]={...X,...Y};else A[J]=Y}return A}var bU=ZA(OG(),1),QU=ZA(XU(),1);function oc(){let _=new bU.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return QU.default(_),_}class CG{constructor(_){this._ajv=_??oc()}getValidator(_){let z="$id"in _&&typeof _.$id==="string"?this._ajv.getSchema(_.$id)??this._ajv.compile(_):this._ajv.compile(_);return(A)=>{if(z(A))return{valid:!0,data:A,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(z.errors)}}}}class vG{constructor(_){this._server=_}requestStream(_,z,A){return this._server.requestStream(_,z,A)}async getTask(_,z){return this._server.getTask({taskId:_},z)}async getTaskResult(_,z,A){return this._server.getTaskResult({taskId:_},z,A)}async listTasks(_,z){return this._server.listTasks(_?{cursor:_}:void 0,z)}async cancelTask(_,z){return this._server.cancelTask({taskId:_},z)}}function $U(_,z,A){if(!_)throw Error(`${A} does not support task creation (required for ${z})`);switch(z){case"tools/call":if(!_.tools?.call)throw Error(`${A} does not support task creation for tools/call (required for ${z})`);break;default:break}}function HU(_,z,A){if(!_)throw Error(`${A} does not support task creation (required for ${z})`);switch(z){case"sampling/createMessage":if(!_.sampling?.createMessage)throw Error(`${A} does not support task creation for sampling/createMessage (required for ${z})`);break;case"elicitation/create":if(!_.elicitation?.create)throw Error(`${A} does not support task creation for elicitation/create (required for ${z})`);break;default:break}}class yG extends k7{constructor(_,z){super(z);if(this._serverInfo=_,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(H3.options.map((A,G)=>[A,G])),this.isMessageIgnored=(A,G)=>{let J=this._loggingLevels.get(G);return J?this.LOG_LEVEL_SEVERITY.get(A)<this.LOG_LEVEL_SEVERITY.get(J):!1},this._capabilities=z?.capabilities??{},this._instructions=z?.instructions,this._jsonSchemaValidator=z?.jsonSchemaValidator??new CG,this.setRequestHandler(q7,(A)=>this._oninitialize(A)),this.setNotificationHandler(F7,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(O7,async(A,G)=>{let J=G.sessionId||G.requestInfo?.headers["mcp-session-id"]||void 0,{level:Y}=A.params,X=H3.safeParse(Y);if(X.success)this._loggingLevels.set(J,X.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new vG(this)};return this._experimental}registerCapabilities(_){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=kq(this._capabilities,_)}setRequestHandler(_,z){let G=Q8(_)?.method;if(!G)throw Error("Schema is missing a method literal");let J;if(u1(G)){let X=G;J=X._zod?.def?.value??X.value}else{let X=G;J=X._def?.value??X.value}if(typeof J!=="string")throw Error("Schema method literal must be a string");if(J==="tools/call"){let X=async(b,Q)=>{let $=K_(w7,b);if(!$.success){let q=$.error instanceof Error?$.error.message:String($.error);throw new t(J0.InvalidParams,`Invalid tools/call request: ${q}`)}let{params:H}=$.data,B=await Promise.resolve(z(b,Q));if(H.task){let q=K_(l1,B);if(!q.success){let F=q.error instanceof Error?q.error.message:String(q.error);throw new t(J0.InvalidParams,`Invalid task creation result: ${F}`)}return q.data}let Z=K_(O8,B);if(!Z.success){let q=Z.error instanceof Error?Z.error.message:String(Z.error);throw new t(J0.InvalidParams,`Invalid tools/call result: ${q}`)}return Z.data};return super.setRequestHandler(_,X)}return super.setRequestHandler(_,z)}assertCapabilityForMethod(_){switch(_){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${_})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${_})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${_})`);break;case"ping":break}}assertNotificationCapability(_){switch(_){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${_})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${_})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${_})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${_})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${_})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(_){if(!this._capabilities)return;switch(_){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${_})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${_})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${_})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${_})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${_})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${_})`);break;case"ping":case"initialize":break}}assertTaskCapability(_){HU(this._clientCapabilities?.tasks?.requests,_,"Client")}assertTaskHandlerCapability(_){if(!this._capabilities)return;$U(this._capabilities.tasks?.requests,_,"Server")}async _oninitialize(_){let z=_.params.protocolVersion;return this._clientCapabilities=_.params.capabilities,this._clientVersion=_.params.clientInfo,{protocolVersion:Zq.includes(z)?z:Q7,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},F8)}async createMessage(_,z){if(_.tools||_.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(_.messages.length>0){let A=_.messages[_.messages.length-1],G=Array.isArray(A.content)?A.content:[A.content],J=G.some((Q)=>Q.type==="tool_result"),Y=_.messages.length>1?_.messages[_.messages.length-2]:void 0,X=Y?Array.isArray(Y.content)?Y.content:[Y.content]:[],b=X.some((Q)=>Q.type==="tool_use");if(J){if(G.some((Q)=>Q.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!b)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(b){let Q=new Set(X.filter((H)=>H.type==="tool_use").map((H)=>H.id)),$=new Set(G.filter((H)=>H.type==="tool_result").map((H)=>H.toolUseId));if(Q.size!==$.size||![...Q].every((H)=>$.has(H)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(_.tools)return this.request({method:"sampling/createMessage",params:_},j7,z);return this.request({method:"sampling/createMessage",params:_},L7,z)}async elicitInput(_,z){switch(_.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let G=_;return this.request({method:"elicitation/create",params:G},L8,z)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let G=_.mode==="form"?_:{..._,mode:"form"},J=await this.request({method:"elicitation/create",params:G},L8,z);if(J.action==="accept"&&J.content&&G.requestedSchema)try{let X=this._jsonSchemaValidator.getValidator(G.requestedSchema)(J.content);if(!X.valid)throw new t(J0.InvalidParams,`Elicitation response content does not match requested schema: ${X.errorMessage}`)}catch(Y){if(Y instanceof t)throw Y;throw new t(J0.InternalError,`Error validating elicitation response: ${Y instanceof Error?Y.message:String(Y)}`)}return J}}}createElicitationCompletionNotifier(_,z){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:_}},z)}async listRoots(_,z){return this.request({method:"roots/list",params:_},R7,z)}async sendLoggingMessage(_,z){if(this._capabilities.logging){if(!this.isMessageIgnored(_.level,z))return this.notification({method:"notifications/message",params:_})}}async sendResourceUpdated(_){return this.notification({method:"notifications/resources/updated",params:_})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}import ZU from"node:process";class gG{append(_){this._buffer=this._buffer?Buffer.concat([this._buffer,_]):_}readMessage(){if(!this._buffer)return null;let _=this._buffer.indexOf(`
217
+ `);if(_===-1)return null;let z=this._buffer.toString("utf8",0,_).replace(/\r$/,"");return this._buffer=this._buffer.subarray(_+1),ac(z)}clear(){this._buffer=void 0}}function ac(_){return Mq.parse(JSON.parse(_))}function BU(_){return JSON.stringify(_)+`
218
+ `}class fG{constructor(_=ZU.stdin,z=ZU.stdout){this._stdin=_,this._stdout=z,this._readBuffer=new gG,this._started=!1,this._ondata=(A)=>{this._readBuffer.append(A),this.processReadBuffer()},this._onerror=(A)=>{this.onerror?.(A)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let _=this._readBuffer.readMessage();if(_===null)break;this.onmessage?.(_)}catch(_){this.onerror?.(_)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(_){return new Promise((z)=>{let A=BU(_);if(this._stdout.write(A))z();else this._stdout.once("drain",z)})}}var Al=zl(import.meta.url),qU=_l(Al),Gl=mG(C1,"mcp.log");function O9(_){let A=`[${new Date().toISOString()}] [mcp] ${_}
219
+ `;try{ec(Gl,A)}catch{}}function Jl(){if(!hG(v1))return!1;try{let _=parseInt(tc(v1,"utf-8").trim());return process.kill(_,0),!0}catch{return!1}}async function Yl(){if(Jl()){O9("Service already running");return}O9("Starting service...");let _=mG(qU,"../../service/server.ts"),z=mG(qU,"../../service/server.js"),A=hG(_)?_:z;if(!hG(A))throw O9(`Service script not found: ${A}`),Error("Service script not found");let G=sc("bun",["run",A],{detached:!0,stdio:"ignore",env:{...process.env}});G.unref(),O9(`Service spawned (PID: ${G.pid})`);let J=50;for(let Y=0;Y<J;Y++)try{(await u_()).end(),O9("Service ready");return}catch{await new Promise((X)=>setTimeout(X,100))}throw Error("Service failed to start")}async function Xl(){let _=await u_(),z=crypto.randomUUID();return mz(_,{type:"connect",id:z}),O9(`Connected to service with ID: ${z}`),_}async function FU(){O9("MCP server starting");let _=null;try{await Yl(),_=await Xl()}catch(J){O9(`Failed to connect to service: ${J instanceof Error?J.message:String(J)}`)}let z=new yG({name:"agentlogs",version:"0.0.1"},{capabilities:{tools:{},prompts:{}}});z.setRequestHandler(E7,()=>({tools:[]})),z.setRequestHandler(V7,()=>({prompts:[]}));let A=()=>{if(O9("Shutting down"),_)_.end()};process.on("SIGTERM",()=>{O9("Received SIGTERM"),A(),process.exit(0)}),process.on("SIGINT",()=>{O9("Received SIGINT"),A(),process.exit(0)});let G=new fG;O9("MCP server connecting to transport"),await z.connect(G),O9("MCP server ready")}var i0=new XJ;i0.name("agentlogs").description("CLI tools for working with AgentLogs accounts and transcripts from AI coding agents");i0.command("login").description("Authenticate with AgentLogs using device authorization").argument("<hostname>","AgentLogs server hostname, e.g. agentlogs.ai").action(async(_)=>{await TX({hostname:_})});i0.command("status").description("Check your current login status").action(async()=>{await yX()});i0.command("logout").description("Log out and clear stored credentials").argument("[hostname]","Optional hostname to log out from (logs out all when omitted)").action(async(_)=>{await CX({hostname:_})});i0.command("upload").argument("[directory]","Filter transcripts to this directory").option("-s, --source <source>","Filter by source: claude-code, cline, codex, opencode, or pi").option("-l, --latest","Upload the most recent transcript without picker").description("Interactively select and upload a transcript").action(async(_,z)=>{let A=z.source;await TQ(_,{source:A,latest:z.latest})});var uG=i0.command("claudecode").description("Claude Code transcript utilities for AgentLogs");uG.command("upload").argument("<transcript>","Path or alias for a transcript JSONL file").description("Upload a transcript JSONL file to AgentLogs").action(async(_)=>{await uQ(_)});uG.command("hook").description("Process Claude Code hook input from stdin").action(async()=>{await gQ()});var bl=i0.command("codex").description("Codex transcript utilities for AgentLogs");bl.command("upload").argument("<transcript>","Path or alias for a Codex transcript JSONL file").description("Upload a Codex transcript JSONL file to AgentLogs").action(async(_)=>{await eQ(_)});var KU=i0.command("opencode").description("OpenCode transcript utilities for AgentLogs");KU.command("upload").argument("<sessionId>","OpenCode session ID to upload").description("Upload an OpenCode session transcript to AgentLogs").action(async(_)=>{await _$(_)});KU.command("hook").description("Process OpenCode hook input from stdin").action(async()=>{await z$()});var cG=i0.command("cline").description("Cline transcript utilities for AgentLogs");cG.command("upload").argument("[taskIdOrPath]","Cline task ID or path to task directory/file").description("Upload a Cline task transcript to AgentLogs").action(async(_)=>{await tQ(_)});cG.command("hook").description("Process Cline hook input from stdin").action(async()=>{await pQ()});cG.command("install").description("Install agentlogs hooks into Cline's global hooks directory").action(async()=>{await iQ()});var WU=i0.command("pi").description("Pi transcript utilities for AgentLogs");WU.command("upload").argument("[sessionIdOrPath]","Pi session ID or path to session file").description("Upload a Pi session transcript to AgentLogs").action(async(_)=>{await Y$(_)});WU.command("hook").description("Process Pi hook input from stdin").action(async()=>{await X$()});uG.command("sync").argument("[claudeDir]","Optional Claude data directory (defaults to ~/.claude)").option("-r, --repo <repoId>","Only sync transcripts for the provided repo identifier").description("Upload all local Claude Code transcripts that are missing or outdated on the server").action(async(_,z)=>{await hQ({claudeDir:_,repoFilter:z.repo})});i0.command("settings").description("View and modify AgentLogs settings").option("--allowMode <mode>","Set allow mode: 'allowlist' or 'denylist'").action(async(_)=>{await vX({allowMode:_.allowMode})});i0.command("allow").description("Allow capture for the current repository").option("--visibility <visibility>","Set visibility: 'public', 'team', or 'private'").option("--public","Set visibility to public").option("--team","Set visibility to team").option("--private","Set visibility to private").action(async(_)=>{await EJ(_)});i0.command("deny").description("Deny capture for the current repository").action(async()=>{await wJ()});var HA=i0.command("service").description("Manage the agentlogs background service");HA.command("start").description("Start the background service").action(async()=>{await W$()});HA.command("stop").description("Stop the background service").action(async()=>{await V$()});HA.command("status").description("Show service status").action(async()=>{await U$()});HA.command("logs").description("Tail the watcher event logs").action(async()=>{await D$()});i0.command("mcp").description("Start MCP server (used by Codex)").action(async()=>{await FU()});i0.showHelpAfterError("(add --help for additional information)");i0.parseAsync().catch((_)=>{console.error("CLI encountered an unexpected error."),console.error(_),process.exit(1)});