@tsuga/cli 1.15.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cli.js +62 -62
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`)}displayWidth(r){return(0,
|
|
2
|
+
"use strict";var YN=Object.create;var ru=Object.defineProperty;var VN=Object.getOwnPropertyDescriptor;var QN=Object.getOwnPropertyNames;var WN=Object.getPrototypeOf,ZN=Object.prototype.hasOwnProperty;var Gt=(e,r)=>{for(var n in r)ru(e,n,{get:r[n],enumerable:!0})},XN=(e,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of QN(r))!ZN.call(e,i)&&i!==n&&ru(e,i,{get:()=>r[i],enumerable:!(o=VN(r,i))||o.enumerable});return e};var Sn=(e,r,n)=>(n=e!=null?YN(WN(e)):{},XN(r||!e||!e.__esModule?ru(n,"default",{value:e,enumerable:!0}):n,e));var qr=class extends Error{constructor(r,n,o){super(o),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=n,this.exitCode=r,this.nestedError=void 0}},On=class extends qr{constructor(r){super(1,"commander.invalidArgument",r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var ki=class{constructor(r,n){switch(this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,r[0]){case"<":this.required=!0,this._name=r.slice(1,-1);break;case"[":this.required=!1,this._name=r.slice(1,-1);break;default:this.required=!0,this._name=r;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(r,n){return n===this.defaultValue||!Array.isArray(n)?[r]:(n.push(r),n)}default(r,n){return this.defaultValue=r,this.defaultValueDescription=n,this}argParser(r){return this.parseArg=r,this}choices(r){return this.argChoices=r.slice(),this.parseArg=(n,o)=>{if(!this.argChoices.includes(n))throw new On(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(n,o):n},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function zs(e){let r=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+r+">":"["+r+"]"}var Jf=require("node:events"),Vs=Sn(require("node:child_process"),1),Zt=Sn(require("node:path"),1),Di=Sn(require("node:fs"),1),ce=Sn(require("node:process"),1),eg=require("node:util");var Qf=require("node:util"),Mi=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(r){this.helpWidth=this.helpWidth??r.helpWidth??80}visibleCommands(r){let n=r.commands.filter(i=>!i._hidden),o=r._getHelpCommand();return o&&!o._hidden&&n.push(o),this.sortSubcommands&&n.sort((i,a)=>i.name().localeCompare(a.name())),n}compareOptions(r,n){let o=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return o(r).localeCompare(o(n))}visibleOptions(r){let n=r.options.filter(i=>!i.hidden),o=r._getHelpOption();if(o&&!o.hidden){let i=o.short&&r._findOption(o.short),a=o.long&&r._findOption(o.long);!i&&!a?n.push(o):o.long&&!a?n.push(r.createOption(o.long,o.description)):o.short&&!i&&n.push(r.createOption(o.short,o.description))}return this.sortOptions&&n.sort(this.compareOptions),n}visibleGlobalOptions(r){if(!this.showGlobalOptions)return[];let n=[];for(let o=r.parent;o;o=o.parent){let i=o.options.filter(a=>!a.hidden);n.push(...i)}return this.sortOptions&&n.sort(this.compareOptions),n}visibleArguments(r){return r._argsDescription&&r.registeredArguments.forEach(n=>{n.description=n.description||r._argsDescription[n.name()]||""}),r.registeredArguments.find(n=>n.description)?r.registeredArguments:[]}subcommandTerm(r){let n=r.registeredArguments.map(o=>zs(o)).join(" ");return r._name+(r._aliases[0]?"|"+r._aliases[0]:"")+(r.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(r){return r.flags}argumentTerm(r){return r.name()}longestSubcommandTermLength(r,n){return n.visibleCommands(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleSubcommandTerm(n.subcommandTerm(i)))),0)}longestOptionTermLength(r,n){return n.visibleOptions(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestGlobalOptionTermLength(r,n){return n.visibleGlobalOptions(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestArgumentTermLength(r,n){return n.visibleArguments(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleArgumentTerm(n.argumentTerm(i)))),0)}commandUsage(r){let n=r._name;r._aliases[0]&&(n=n+"|"+r._aliases[0]);let o="";for(let i=r.parent;i;i=i.parent)o=i.name()+" "+o;return o+n+" "+r.usage()}commandDescription(r){return r.description()}subcommandDescription(r){return r.summary()||r.description()}optionDescription(r){let n=[];if(r.argChoices&&n.push(`choices: ${r.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),r.defaultValue!==void 0&&(r.required||r.optional||r.isBoolean()&&typeof r.defaultValue=="boolean")&&n.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),r.presetArg!==void 0&&r.optional&&n.push(`preset: ${JSON.stringify(r.presetArg)}`),r.envVar!==void 0&&n.push(`env: ${r.envVar}`),n.length>0){let o=`(${n.join(", ")})`;return r.description?`${r.description} ${o}`:o}return r.description}argumentDescription(r){let n=[];if(r.argChoices&&n.push(`choices: ${r.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),r.defaultValue!==void 0&&n.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),n.length>0){let o=`(${n.join(", ")})`;return r.description?`${r.description} ${o}`:o}return r.description}formatItemList(r,n,o){return n.length===0?[]:[o.styleTitle(r),...n,""]}groupItems(r,n,o){let i=new Map;return r.forEach(a=>{let c=o(a);i.has(c)||i.set(c,[])}),n.forEach(a=>{let c=o(a);i.has(c)||i.set(c,[]),i.get(c).push(a)}),i}formatHelp(r,n){let o=n.padWidth(r,n),i=n.helpWidth??80;function a(T,_){return n.formatItem(T,o,_,n)}let c=[`${n.styleTitle("Usage:")} ${n.styleUsage(n.commandUsage(r))}`,""],l=n.commandDescription(r);l.length>0&&(c=c.concat([n.boxWrap(n.styleCommandDescription(l),i),""]));let d=n.visibleArguments(r).map(T=>a(n.styleArgumentTerm(n.argumentTerm(T)),n.styleArgumentDescription(n.argumentDescription(T))));if(c=c.concat(this.formatItemList("Arguments:",d,n)),this.groupItems(r.options,n.visibleOptions(r),T=>T.helpGroupHeading??"Options:").forEach((T,_)=>{let se=T.map(ge=>a(n.styleOptionTerm(n.optionTerm(ge)),n.styleOptionDescription(n.optionDescription(ge))));c=c.concat(this.formatItemList(_,se,n))}),n.showGlobalOptions){let T=n.visibleGlobalOptions(r).map(_=>a(n.styleOptionTerm(n.optionTerm(_)),n.styleOptionDescription(n.optionDescription(_))));c=c.concat(this.formatItemList("Global Options:",T,n))}return this.groupItems(r.commands,n.visibleCommands(r),T=>T.helpGroup()||"Commands:").forEach((T,_)=>{let se=T.map(ge=>a(n.styleSubcommandTerm(n.subcommandTerm(ge)),n.styleSubcommandDescription(n.subcommandDescription(ge))));c=c.concat(this.formatItemList(_,se,n))}),c.join(`
|
|
3
|
+
`)}displayWidth(r){return(0,Qf.stripVTControlCharacters)(r).length}styleTitle(r){return r}styleUsage(r){return r.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n==="[command]"?this.styleSubcommandText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleCommandText(n)).join(" ")}styleCommandDescription(r){return this.styleDescriptionText(r)}styleOptionDescription(r){return this.styleDescriptionText(r)}styleSubcommandDescription(r){return this.styleDescriptionText(r)}styleArgumentDescription(r){return this.styleDescriptionText(r)}styleDescriptionText(r){return r}styleOptionTerm(r){return this.styleOptionText(r)}styleSubcommandTerm(r){return r.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleSubcommandText(n)).join(" ")}styleArgumentTerm(r){return this.styleArgumentText(r)}styleOptionText(r){return r}styleArgumentText(r){return r}styleSubcommandText(r){return r}styleCommandText(r){return r}padWidth(r,n){return Math.max(n.longestOptionTermLength(r,n),n.longestGlobalOptionTermLength(r,n),n.longestSubcommandTermLength(r,n),n.longestArgumentTermLength(r,n))}preformatted(r){return/\n[^\S\r\n]/.test(r)}formatItem(r,n,o,i){let c=" ".repeat(2);if(!o)return c+r;let l=r.padEnd(n+r.length-i.displayWidth(r)),d=2,g=(this.helpWidth??80)-n-d-2,T;return g<this.minWidthToWrap||i.preformatted(o)?T=o:T=i.boxWrap(o,g).replace(/\n/g,`
|
|
4
4
|
`+" ".repeat(n+d)),c+l+" ".repeat(d)+T.replace(/\n/g,`
|
|
5
5
|
${c}`)}boxWrap(r,n){if(n<this.minWidthToWrap)return r;let o=r.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,a=[];return o.forEach(c=>{let l=c.match(i);if(l===null){a.push("");return}let d=[l.shift()],f=this.displayWidth(d[0]);l.forEach(g=>{let T=this.displayWidth(g);if(f+T<=n){d.push(g),f+=T;return}a.push(d.join(""));let _=g.trimStart();d=[_],f=this.displayWidth(_)}),a.push(d.join(""))}),a.join(`
|
|
6
|
-
`)}};var yr=class{constructor(r,n){this.flags=r,this.description=n||"",this.required=r.includes("<"),this.optional=r.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(r),this.mandatory=!1;let o=
|
|
6
|
+
`)}};var yr=class{constructor(r,n){this.flags=r,this.description=n||"",this.required=r.includes("<"),this.optional=r.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(r),this.mandatory=!1;let o=JN(r);this.short=o.shortFlag,this.long=o.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(r,n){return this.defaultValue=r,this.defaultValueDescription=n,this}preset(r){return this.presetArg=r,this}conflicts(r){return this.conflictsWith=this.conflictsWith.concat(r),this}implies(r){let n=r;return typeof r=="string"&&(n={[r]:!0}),this.implied=Object.assign(this.implied||{},n),this}env(r){return this.envVar=r,this}argParser(r){return this.parseArg=r,this}makeOptionMandatory(r=!0){return this.mandatory=!!r,this}hideHelp(r=!0){return this.hidden=!!r,this}_collectValue(r,n){return n===this.defaultValue||!Array.isArray(n)?[r]:(n.push(r),n)}choices(r){return this.argChoices=r.slice(),this.parseArg=(n,o)=>{if(!this.argChoices.includes(n))throw new On(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(n,o):n},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Wf(this.name().replace(/^no-/,"")):Wf(this.name())}helpGroup(r){return this.helpGroupHeading=r,this}is(r){return this.short===r||this.long===r}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Ys=class{constructor(r){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,r.forEach(n=>{n.negate?this.negativeOptions.set(n.attributeName(),n):this.positiveOptions.set(n.attributeName(),n)}),this.negativeOptions.forEach((n,o)=>{this.positiveOptions.has(o)&&this.dualOptions.add(o)})}valueFromOption(r,n){let o=n.attributeName();if(!this.dualOptions.has(o))return!0;let i=this.negativeOptions.get(o).presetArg,a=i!==void 0?i:!1;return n.negate===(a===r)}};function Wf(e){return e.split("-").reduce((r,n)=>r+n[0].toUpperCase()+n.slice(1))}function JN(e){let r,n,o=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat("guard");if(o.test(a[0])&&(r=a.shift()),i.test(a[0])&&(n=a.shift()),!r&&o.test(a[0])&&(r=a.shift()),!r&&i.test(a[0])&&(r=n,n=a.shift()),a[0].startsWith("-")){let c=a[0],l=`option creation failed due to '${c}' in option flags '${e}'`;throw/^-[^-][^-]/.test(c)?new Error(`${l}
|
|
7
7
|
- a short flag is a single dash and a single character
|
|
8
8
|
- either use a single dash and a single character (for a short flag)
|
|
9
9
|
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):o.test(c)?new Error(`${l}
|
|
10
10
|
- too many short flags`):i.test(c)?new Error(`${l}
|
|
11
11
|
- too many long flags`):new Error(`${l}
|
|
12
|
-
- unrecognised flag format`)}if(r===void 0&&n===void 0)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:r,longFlag:n}}function
|
|
12
|
+
- unrecognised flag format`)}if(r===void 0&&n===void 0)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:r,longFlag:n}}function eL(e,r){if(Math.abs(e.length-r.length)>3)return Math.max(e.length,r.length);let n=[];for(let o=0;o<=e.length;o++)n[o]=[o];for(let o=0;o<=r.length;o++)n[0][o]=o;for(let o=1;o<=r.length;o++)for(let i=1;i<=e.length;i++){let a;e[i-1]===r[o-1]?a=0:a=1,n[i][o]=Math.min(n[i-1][o]+1,n[i][o-1]+1,n[i-1][o-1]+a),i>1&&o>1&&e[i-1]===r[o-2]&&e[i-2]===r[o-1]&&(n[i][o]=Math.min(n[i][o],n[i-2][o-2]+1))}return n[e.length][r.length]}function nu(e,r){if(!r||r.length===0)return"";r=Array.from(new Set(r));let n=e.startsWith("--");n&&(e=e.slice(2),r=r.map(c=>c.slice(2)));let o=[],i=3,a=.4;return r.forEach(c=>{if(c.length<=1)return;let l=eL(e,c),d=Math.max(e.length,c.length);(d-l)/d>a&&(l<i?(i=l,o=[c]):l===i&&o.push(c))}),o.sort((c,l)=>c.localeCompare(l)),n&&(o=o.map(c=>`--${c}`)),o.length>1?`
|
|
13
13
|
(Did you mean one of ${o.join(", ")}?)`:o.length===1?`
|
|
14
|
-
(Did you mean ${o[0]}?)`:""}var fo=class e extends
|
|
15
|
-
- specify the name in Command constructor or using .name()`);return n=n||{},n.isDefault&&(this._defaultCommandName=r._name),(n.noHelp||n.hidden)&&(r._hidden=!0),this._registerCommand(r),r.parent=this,r._checkForBrokenPassThrough(),this}createArgument(r,n){return new
|
|
16
|
-
Expecting one of '${o.join("', '")}'`);return this._lifeCycleHooks[r]?this._lifeCycleHooks[r].push(n):this._lifeCycleHooks[r]=[n],this}exitOverride(r){return r?this._exitCallback=r:this._exitCallback=n=>{if(n.code!=="commander.executeSubCommandAsync")throw n},this}_exit(r,n,o){this._exitCallback&&this._exitCallback(new
|
|
17
|
-
- already used by option '${n.flags}'`)}this._initOptionGroup(r),this.options.push(r)}_registerCommand(r){let n=i=>[i.name()].concat(i.aliases()),o=n(r).find(i=>this._findCommand(i));if(o){let i=n(this._findCommand(o)).join("|"),a=n(r).join("|");throw new Error(`cannot add command '${a}' as already have command '${i}'`)}this._initCommandGroup(r),this.commands.push(r)}addOption(r){this._registerOption(r);let n=r.name(),o=r.attributeName();r.defaultValue!==void 0&&this.setOptionValueWithSource(o,r.defaultValue,"default");let i=(a,c,l)=>{a==null&&r.presetArg!==void 0&&(a=r.presetArg);let d=this.getOptionValue(o);a!==null&&r.parseArg?a=this._callParseArg(r,a,d,c):a!==null&&r.variadic&&(a=r._collectValue(a,d)),a==null&&(r.negate?a=!1:r.isBoolean()||r.optional?a=!0:a=""),this.setOptionValueWithSource(o,a,l)};return this.on("option:"+n,a=>{let c=`error: option '${r.flags}' argument '${a}' is invalid.`;i(a,c,"cli")}),r.envVar&&this.on("optionEnv:"+n,a=>{let c=`error: option '${r.flags}' value '${a}' from env '${r.envVar}' is invalid.`;i(a,c,"env")}),this}_optionEx(r,n,o,i,a){if(typeof n=="object"&&n instanceof yr)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let c=this.createOption(n,o);if(c.makeOptionMandatory(!!r.mandatory),typeof i=="function")c.default(a).argParser(i);else if(i instanceof RegExp){let l=i;i=(d,f)=>{let g=l.exec(d);return g?g[0]:f},c.default(a).argParser(i)}else c.default(i);return this.addOption(c)}option(r,n,o,i){return this._optionEx({},r,n,o,i)}requiredOption(r,n,o,i){return this._optionEx({mandatory:!0},r,n,o,i)}combineFlagAndOptionalValue(r=!0){return this._combineFlagAndOptionalValue=!!r,this}allowUnknownOption(r=!0){return this._allowUnknownOption=!!r,this}allowExcessArguments(r=!0){return this._allowExcessArguments=!!r,this}enablePositionalOptions(r=!0){return this._enablePositionalOptions=!!r,this}passThroughOptions(r=!0){return this._passThroughOptions=!!r,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(r=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!r,this}getOptionValue(r){return this._storeOptionsAsProperties?this[r]:this._optionValues[r]}setOptionValue(r,n){return this.setOptionValueWithSource(r,n,void 0)}setOptionValueWithSource(r,n,o){return this._storeOptionsAsProperties?this[r]=n:this._optionValues[r]=n,this._optionValueSources[r]=o,this}getOptionValueSource(r){return this._optionValueSources[r]}getOptionValueSourceWithGlobals(r){let n;return this._getCommandAndAncestors().forEach(o=>{o.getOptionValueSource(r)!==void 0&&(n=o.getOptionValueSource(r))}),n}_prepareUserArgs(r,n){if(r!==void 0&&!Array.isArray(r))throw new Error("first parameter to parse must be array or undefined");if(n=n||{},r===void 0&&n.from===void 0){
|
|
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(r,n,o){if(
|
|
14
|
+
(Did you mean ${o[0]}?)`:""}var fo=class e extends Jf.EventEmitter{constructor(r){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=r||"",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:n=>ce.default.stdout.write(n),writeErr:n=>ce.default.stderr.write(n),outputError:(n,o)=>o(n),getOutHelpWidth:()=>ce.default.stdout.isTTY?ce.default.stdout.columns:void 0,getErrHelpWidth:()=>ce.default.stderr.isTTY?ce.default.stderr.columns:void 0,getOutHasColors:()=>Xf()??(ce.default.stdout.isTTY&&ce.default.stdout.hasColors?.()),getErrHasColors:()=>Xf()??(ce.default.stderr.isTTY&&ce.default.stderr.hasColors?.()),stripColor:n=>(0,eg.stripVTControlCharacters)(n)},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(r){return this._outputConfiguration=r._outputConfiguration,this._helpOption=r._helpOption,this._helpCommand=r._helpCommand,this._helpConfiguration=r._helpConfiguration,this._exitCallback=r._exitCallback,this._storeOptionsAsProperties=r._storeOptionsAsProperties,this._combineFlagAndOptionalValue=r._combineFlagAndOptionalValue,this._allowExcessArguments=r._allowExcessArguments,this._enablePositionalOptions=r._enablePositionalOptions,this._showHelpAfterError=r._showHelpAfterError,this._showSuggestionAfterError=r._showSuggestionAfterError,this}_getCommandAndAncestors(){let r=[];for(let n=this;n;n=n.parent)r.push(n);return r}command(r,n,o){let i=n,a=o;typeof i=="object"&&i!==null&&(a=i,i=null),a=a||{};let[,c,l]=r.match(/([^ ]+) *(.*)/),d=this.createCommand(c);return i&&(d.description(i),d._executableHandler=!0),a.isDefault&&(this._defaultCommandName=d._name),d._hidden=!!(a.noHelp||a.hidden),d._executableFile=a.executableFile||null,l&&d.arguments(l),this._registerCommand(d),d.parent=this,d.copyInheritedSettings(this),i?this:d}createCommand(r){return new e(r)}createHelp(){return Object.assign(new Mi,this.configureHelp())}configureHelp(r){return r===void 0?this._helpConfiguration:(this._helpConfiguration=r,this)}configureOutput(r){return r===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...r},this)}showHelpAfterError(r=!0){return typeof r!="string"&&(r=!!r),this._showHelpAfterError=r,this}showSuggestionAfterError(r=!0){return this._showSuggestionAfterError=!!r,this}addCommand(r,n){if(!r._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
15
|
+
- specify the name in Command constructor or using .name()`);return n=n||{},n.isDefault&&(this._defaultCommandName=r._name),(n.noHelp||n.hidden)&&(r._hidden=!0),this._registerCommand(r),r.parent=this,r._checkForBrokenPassThrough(),this}createArgument(r,n){return new ki(r,n)}argument(r,n,o,i){let a=this.createArgument(r,n);return typeof o=="function"?a.default(i).argParser(o):a.default(o),this.addArgument(a),this}arguments(r){return r.trim().split(/ +/).forEach(n=>{this.argument(n)}),this}addArgument(r){let n=this.registeredArguments.slice(-1)[0];if(n?.variadic)throw new Error(`only the last argument can be variadic '${n.name()}'`);if(r.required&&r.defaultValue!==void 0&&r.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${r.name()}'`);return this.registeredArguments.push(r),this}helpCommand(r,n){if(typeof r=="boolean")return this._addImplicitHelpCommand=r,r&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let o=r??"help [command]",[,i,a]=o.match(/([^ ]+) *(.*)/),c=n??"display help for command",l=this.createCommand(i);return l.helpOption(!1),a&&l.arguments(a),c&&l.description(c),this._addImplicitHelpCommand=!0,this._helpCommand=l,(r||n)&&this._initCommandGroup(l),this}addHelpCommand(r,n){return typeof r!="object"?(this.helpCommand(r,n),this):(this._addImplicitHelpCommand=!0,this._helpCommand=r,this._initCommandGroup(r),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(r,n){let o=["preSubcommand","preAction","postAction"];if(!o.includes(r))throw new Error(`Unexpected value for event passed to hook : '${r}'.
|
|
16
|
+
Expecting one of '${o.join("', '")}'`);return this._lifeCycleHooks[r]?this._lifeCycleHooks[r].push(n):this._lifeCycleHooks[r]=[n],this}exitOverride(r){return r?this._exitCallback=r:this._exitCallback=n=>{if(n.code!=="commander.executeSubCommandAsync")throw n},this}_exit(r,n,o){this._exitCallback&&this._exitCallback(new qr(r,n,o)),ce.default.exit(r)}action(r){let n=o=>{let i=this.registeredArguments.length,a=o.slice(0,i);return this._storeOptionsAsProperties?a[i]=this:a[i]=this.opts(),a.push(this),r.apply(this,a)};return this._actionHandler=n,this}createOption(r,n){return new yr(r,n)}_callParseArg(r,n,o,i){try{return r.parseArg(n,o)}catch(a){if(a.code==="commander.invalidArgument"){let c=`${i} ${a.message}`;this.error(c,{exitCode:a.exitCode,code:a.code})}throw a}}_registerOption(r){let n=r.short&&this._findOption(r.short)||r.long&&this._findOption(r.long);if(n){let o=r.long&&this._findOption(r.long)?r.long:r.short;throw new Error(`Cannot add option '${r.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${o}'
|
|
17
|
+
- already used by option '${n.flags}'`)}this._initOptionGroup(r),this.options.push(r)}_registerCommand(r){let n=i=>[i.name()].concat(i.aliases()),o=n(r).find(i=>this._findCommand(i));if(o){let i=n(this._findCommand(o)).join("|"),a=n(r).join("|");throw new Error(`cannot add command '${a}' as already have command '${i}'`)}this._initCommandGroup(r),this.commands.push(r)}addOption(r){this._registerOption(r);let n=r.name(),o=r.attributeName();r.defaultValue!==void 0&&this.setOptionValueWithSource(o,r.defaultValue,"default");let i=(a,c,l)=>{a==null&&r.presetArg!==void 0&&(a=r.presetArg);let d=this.getOptionValue(o);a!==null&&r.parseArg?a=this._callParseArg(r,a,d,c):a!==null&&r.variadic&&(a=r._collectValue(a,d)),a==null&&(r.negate?a=!1:r.isBoolean()||r.optional?a=!0:a=""),this.setOptionValueWithSource(o,a,l)};return this.on("option:"+n,a=>{let c=`error: option '${r.flags}' argument '${a}' is invalid.`;i(a,c,"cli")}),r.envVar&&this.on("optionEnv:"+n,a=>{let c=`error: option '${r.flags}' value '${a}' from env '${r.envVar}' is invalid.`;i(a,c,"env")}),this}_optionEx(r,n,o,i,a){if(typeof n=="object"&&n instanceof yr)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let c=this.createOption(n,o);if(c.makeOptionMandatory(!!r.mandatory),typeof i=="function")c.default(a).argParser(i);else if(i instanceof RegExp){let l=i;i=(d,f)=>{let g=l.exec(d);return g?g[0]:f},c.default(a).argParser(i)}else c.default(i);return this.addOption(c)}option(r,n,o,i){return this._optionEx({},r,n,o,i)}requiredOption(r,n,o,i){return this._optionEx({mandatory:!0},r,n,o,i)}combineFlagAndOptionalValue(r=!0){return this._combineFlagAndOptionalValue=!!r,this}allowUnknownOption(r=!0){return this._allowUnknownOption=!!r,this}allowExcessArguments(r=!0){return this._allowExcessArguments=!!r,this}enablePositionalOptions(r=!0){return this._enablePositionalOptions=!!r,this}passThroughOptions(r=!0){return this._passThroughOptions=!!r,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(r=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!r,this}getOptionValue(r){return this._storeOptionsAsProperties?this[r]:this._optionValues[r]}setOptionValue(r,n){return this.setOptionValueWithSource(r,n,void 0)}setOptionValueWithSource(r,n,o){return this._storeOptionsAsProperties?this[r]=n:this._optionValues[r]=n,this._optionValueSources[r]=o,this}getOptionValueSource(r){return this._optionValueSources[r]}getOptionValueSourceWithGlobals(r){let n;return this._getCommandAndAncestors().forEach(o=>{o.getOptionValueSource(r)!==void 0&&(n=o.getOptionValueSource(r))}),n}_prepareUserArgs(r,n){if(r!==void 0&&!Array.isArray(r))throw new Error("first parameter to parse must be array or undefined");if(n=n||{},r===void 0&&n.from===void 0){ce.default.versions?.electron&&(n.from="electron");let i=ce.default.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(n.from="eval")}r===void 0&&(r=ce.default.argv),this.rawArgs=r.slice();let o;switch(n.from){case void 0:case"node":this._scriptPath=r[1],o=r.slice(2);break;case"electron":ce.default.defaultApp?(this._scriptPath=r[1],o=r.slice(2)):o=r.slice(1);break;case"user":o=r.slice(0);break;case"eval":o=r.slice(1);break;default:throw new Error(`unexpected parse option { from: '${n.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",o}parse(r,n){this._prepareForParse();let o=this._prepareUserArgs(r,n);return this._parseCommand([],o),this}async parseAsync(r,n){this._prepareForParse();let o=this._prepareUserArgs(r,n);return await this._parseCommand([],o),this}_prepareForParse(){this._savedState===null?(this.options.filter(r=>r.negate&&r.defaultValue===void 0&&this.getOptionValue(r.attributeName())===void 0).forEach(r=>{let n=r.long.replace(/^--no-/,"--");this._findOption(n)||this.setOptionValueWithSource(r.attributeName(),!0,"default")}),this.saveStateBeforeParse()):this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
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(r,n,o){if(Di.default.existsSync(r))return;let i=n?`searched for local subcommand relative to directory '${n}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",a=`'${r}' does not exist
|
|
19
19
|
- if '${o}' 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
|
-
- ${i}`;throw new Error(a)}_executeSubCommand(r,n){n=n.slice();let o=[".js",".ts",".tsx",".mjs",".cjs"];function i(g,T){let _=Zt.default.resolve(g,T);if(
|
|
21
|
+
- ${i}`;throw new Error(a)}_executeSubCommand(r,n){n=n.slice();let o=[".js",".ts",".tsx",".mjs",".cjs"];function i(g,T){let _=Zt.default.resolve(g,T);if(Di.default.existsSync(_))return _;if(o.includes(Zt.default.extname(T)))return;let se=o.find(ge=>Di.default.existsSync(`${_}${ge}`));if(se)return`${_}${se}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=r._executableFile||`${this._name}-${r._name}`,c=this._executableDir||"";if(this._scriptPath){let g;try{g=Di.default.realpathSync(this._scriptPath)}catch{g=this._scriptPath}c=Zt.default.resolve(Zt.default.dirname(g),c)}if(c){let g=i(c,a);if(!g&&!r._executableFile&&this._scriptPath){let T=Zt.default.basename(this._scriptPath,Zt.default.extname(this._scriptPath));T!==this._name&&(g=i(c,`${T}-${r._name}`))}a=g||a}let l=o.includes(Zt.default.extname(a)),d;ce.default.platform!=="win32"?l?(n.unshift(a),n=Zf(ce.default.execArgv).concat(n),d=Vs.default.spawn(ce.default.argv[0],n,{stdio:"inherit"})):d=Vs.default.spawn(a,n,{stdio:"inherit"}):(this._checkForMissingExecutable(a,c,r._name),n.unshift(a),n=Zf(ce.default.execArgv).concat(n),d=Vs.default.spawn(ce.default.execPath,n,{stdio:"inherit"})),d.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(T=>{ce.default.on(T,()=>{d.killed===!1&&d.exitCode===null&&d.kill(T)})});let f=this._exitCallback;d.on("close",g=>{g=g??1,f?f(new qr(g,"commander.executeSubCommandAsync","(close)")):ce.default.exit(g)}),d.on("error",g=>{if(g.code==="ENOENT")this._checkForMissingExecutable(a,c,r._name);else if(g.code==="EACCES")throw new Error(`'${a}' not executable`);if(!f)ce.default.exit(1);else{let T=new qr(1,"commander.executeSubCommandAsync","(error)");T.nestedError=g,f(T)}}),this.runningCommand=d}_dispatchSubcommand(r,n,o){let i=this._findCommand(r);i||this.help({error:!0}),i._prepareForParse();let a;return a=this._chainOrCallSubCommandHook(a,i,"preSubcommand"),a=this._chainOrCall(a,()=>{if(i._executableHandler)this._executeSubCommand(i,n.concat(o));else return i._parseCommand(n,o)}),a}_dispatchHelpCommand(r){r||this.help();let n=this._findCommand(r);return n&&!n._executableHandler&&n.help(),this._dispatchSubcommand(r,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((r,n)=>{r.required&&this.args[n]==null&&this.missingArgument(r.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let r=(o,i,a)=>{let c=i;if(i!==null&&o.parseArg){let l=`error: command-argument value '${i}' is invalid for argument '${o.name()}'.`;c=this._callParseArg(o,i,a,l)}return c};this._checkNumberOfArguments();let n=[];this.registeredArguments.forEach((o,i)=>{let a=o.defaultValue;o.variadic?i<this.args.length?(a=this.args.slice(i),o.parseArg&&(a=a.reduce((c,l)=>r(o,l,c),o.defaultValue))):a===void 0&&(a=[]):i<this.args.length&&(a=this.args[i],o.parseArg&&(a=r(o,a,o.defaultValue))),n[i]=a}),this.processedArgs=n}_chainOrCall(r,n){return r?.then&&typeof r.then=="function"?r.then(()=>n()):n()}_chainOrCallHooks(r,n){let o=r,i=[];return this._getCommandAndAncestors().reverse().filter(a=>a._lifeCycleHooks[n]!==void 0).forEach(a=>{a._lifeCycleHooks[n].forEach(c=>{i.push({hookedCommand:a,callback:c})})}),n==="postAction"&&i.reverse(),i.forEach(a=>{o=this._chainOrCall(o,()=>a.callback(a.hookedCommand,this))}),o}_chainOrCallSubCommandHook(r,n,o){let i=r;return this._lifeCycleHooks[o]!==void 0&&this._lifeCycleHooks[o].forEach(a=>{i=this._chainOrCall(i,()=>a(this,n))}),i}_parseCommand(r,n){let o=this.parseOptions(n);if(this._parseOptionsEnv(),this._parseOptionsImplied(),r=r.concat(o.operands),n=o.unknown,this.args=r.concat(n),r&&this._findCommand(r[0]))return this._dispatchSubcommand(r[0],r.slice(1),n);if(this._getHelpCommand()&&r[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(r[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(n),this._dispatchSubcommand(this._defaultCommandName,r,n);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(o.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{o.unknown.length>0&&this.unknownOption(o.unknown[0])},a=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let c;return c=this._chainOrCallHooks(c,"preAction"),c=this._chainOrCall(c,()=>this._actionHandler(this.processedArgs)),this.parent&&(c=this._chainOrCall(c,()=>{this.parent.emit(a,r,n)})),c=this._chainOrCallHooks(c,"postAction"),c}if(this.parent?.listenerCount(a))i(),this._processArguments(),this.parent.emit(a,r,n);else if(r.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",r,n);this.listenerCount("command:*")?this.emit("command:*",r,n):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(r){if(r)return this.commands.find(n=>n._name===r||n._aliases.includes(r))}_findOption(r){return this.options.find(n=>n.is(r))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(r=>{r.options.forEach(n=>{n.mandatory&&r.getOptionValue(n.attributeName())===void 0&&r.missingMandatoryOptionValue(n)})})}_checkForConflictingLocalOptions(){let r=this.options.filter(o=>{let i=o.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});r.filter(o=>o.conflictsWith.length>0).forEach(o=>{let i=r.find(a=>o.conflictsWith.includes(a.attributeName()));i&&this._conflictingOption(o,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(r=>{r._checkForConflictingLocalOptions()})}parseOptions(r){let n=[],o=[],i=n;function a(g){return g.length>1&&g[0]==="-"}let c=g=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(g)?!this._getCommandAndAncestors().some(T=>T.options.map(_=>_.short).some(_=>/^-\d$/.test(_))):!1,l=null,d=null,f=0;for(;f<r.length||d;){let g=d??r[f++];if(d=null,g==="--"){i===o&&i.push(g),i.push(...r.slice(f));break}if(l&&(!a(g)||c(g))){this.emit(`option:${l.name()}`,g);continue}if(l=null,a(g)){let T=this._findOption(g);if(T){if(T.required){let _=r[f++];_===void 0&&this.optionMissingArgument(T),this.emit(`option:${T.name()}`,_)}else if(T.optional){let _=null;f<r.length&&(!a(r[f])||c(r[f]))&&(_=r[f++]),this.emit(`option:${T.name()}`,_)}else this.emit(`option:${T.name()}`);l=T.variadic?T:null;continue}}if(g.length>2&&g[0]==="-"&&g[1]!=="-"){let T=this._findOption(`-${g[1]}`);if(T){T.required||T.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${T.name()}`,g.slice(2)):(this.emit(`option:${T.name()}`),d=`-${g.slice(2)}`);continue}}if(/^--[^=]+=/.test(g)){let T=g.indexOf("="),_=this._findOption(g.slice(0,T));if(_&&(_.required||_.optional)){this.emit(`option:${_.name()}`,g.slice(T+1));continue}}if(i===n&&a(g)&&!(this.commands.length===0&&c(g))&&(i=o),(this._enablePositionalOptions||this._passThroughOptions)&&n.length===0&&o.length===0){if(this._findCommand(g)){n.push(g),o.push(...r.slice(f));break}else if(this._getHelpCommand()&&g===this._getHelpCommand().name()){n.push(g,...r.slice(f));break}else if(this._defaultCommandName){o.push(g,...r.slice(f));break}}if(this._passThroughOptions){i.push(g,...r.slice(f));break}i.push(g)}return{operands:n,unknown:o}}opts(){if(this._storeOptionsAsProperties){let r={},n=this.options.length;for(let o=0;o<n;o++){let i=this.options[o].attributeName();r[i]=i===this._versionOptionName?this._version:this[i]}return r}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((r,n)=>Object.assign(r,n.opts()),{})}error(r,n){this._outputConfiguration.outputError(`${r}
|
|
22
22
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
23
23
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
24
|
-
`),this.outputHelp({error:!0}));let o=n||{},i=o.exitCode||1,a=o.code||"commander.error";this._exit(i,a,r)}_parseOptionsEnv(){this.options.forEach(r=>{if(r.envVar&&r.envVar in
|
|
25
|
-
`),this._exit(0,"commander.version",r)}),this}description(r,n){return r===void 0&&n===void 0?this._description:(this._description=r,n&&(this._argsDescription=n),this)}summary(r){return r===void 0?this._summary:(this._summary=r,this)}alias(r){if(r===void 0)return this._aliases[0];let n=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(n=this.commands[this.commands.length-1]),r===n._name)throw new Error("Command alias can't be the same as its name");let o=this.parent?._findCommand(r);if(o){let i=[o.name()].concat(o.aliases()).join("|");throw new Error(`cannot add alias '${r}' to command '${this.name()}' as already have command '${i}'`)}return n._aliases.push(r),this}aliases(r){return r===void 0?this._aliases:(r.forEach(n=>this.alias(n)),this)}usage(r){if(r===void 0){if(this._usage)return this._usage;let n=this.registeredArguments.map(o=>
|
|
24
|
+
`),this.outputHelp({error:!0}));let o=n||{},i=o.exitCode||1,a=o.code||"commander.error";this._exit(i,a,r)}_parseOptionsEnv(){this.options.forEach(r=>{if(r.envVar&&r.envVar in ce.default.env){let n=r.attributeName();(this.getOptionValue(n)===void 0||["default","config","env"].includes(this.getOptionValueSource(n)))&&(r.required||r.optional?this.emit(`optionEnv:${r.name()}`,ce.default.env[r.envVar]):this.emit(`optionEnv:${r.name()}`))}})}_parseOptionsImplied(){let r=new Ys(this.options),n=o=>this.getOptionValue(o)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(o));this.options.filter(o=>o.implied!==void 0&&n(o.attributeName())&&r.valueFromOption(this.getOptionValue(o.attributeName()),o)).forEach(o=>{Object.keys(o.implied).filter(i=>!n(i)).forEach(i=>{this.setOptionValueWithSource(i,o.implied[i],"implied")})})}missingArgument(r){let n=`error: missing required argument '${r}'`;this.error(n,{code:"commander.missingArgument"})}optionMissingArgument(r){let n=`error: option '${r.flags}' argument missing`;this.error(n,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(r){let n=`error: required option '${r.flags}' not specified`;this.error(n,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(r,n){let o=c=>{let l=c.attributeName(),d=this.getOptionValue(l),f=this.options.find(T=>T.negate&&l===T.attributeName()),g=this.options.find(T=>!T.negate&&l===T.attributeName());return f&&(f.presetArg===void 0&&d===!1||f.presetArg!==void 0&&d===f.presetArg)?f:g||c},i=c=>{let l=o(c),d=l.attributeName();return this.getOptionValueSource(d)==="env"?`environment variable '${l.envVar}'`:`option '${l.flags}'`},a=`error: ${i(r)} cannot be used with ${i(n)}`;this.error(a,{code:"commander.conflictingOption"})}unknownOption(r){if(this._allowUnknownOption)return;let n="";if(r.startsWith("--")&&this._showSuggestionAfterError){let i=[],a=this;do{let c=a.createHelp().visibleOptions(a).filter(l=>l.long).map(l=>l.long);i=i.concat(c),a=a.parent}while(a&&!a._enablePositionalOptions);n=nu(r,i)}let o=`error: unknown option '${r}'${n}`;this.error(o,{code:"commander.unknownOption"})}_excessArguments(r){if(this._allowExcessArguments)return;let n=this.registeredArguments.length,o=n===1?"":"s",i=r.length,a=this.parent?` for '${this.name()}'`:"",c=r.join(", "),l=`error: too many arguments${a}. Expected ${n} argument${o} but got ${i}: ${c}.`;this.error(l,{code:"commander.excessArguments"})}unknownCommand(){let r=this.args[0],n="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(a=>{i.push(a.name()),a.alias()&&i.push(a.alias())}),n=nu(r,i)}let o=`error: unknown command '${r}'${n}`;this.error(o,{code:"commander.unknownCommand"})}version(r,n,o){if(r===void 0)return this._version;this._version=r,n=n||"-V, --version",o=o||"output the version number";let i=this.createOption(n,o);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${r}
|
|
25
|
+
`),this._exit(0,"commander.version",r)}),this}description(r,n){return r===void 0&&n===void 0?this._description:(this._description=r,n&&(this._argsDescription=n),this)}summary(r){return r===void 0?this._summary:(this._summary=r,this)}alias(r){if(r===void 0)return this._aliases[0];let n=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(n=this.commands[this.commands.length-1]),r===n._name)throw new Error("Command alias can't be the same as its name");let o=this.parent?._findCommand(r);if(o){let i=[o.name()].concat(o.aliases()).join("|");throw new Error(`cannot add alias '${r}' to command '${this.name()}' as already have command '${i}'`)}return n._aliases.push(r),this}aliases(r){return r===void 0?this._aliases:(r.forEach(n=>this.alias(n)),this)}usage(r){if(r===void 0){if(this._usage)return this._usage;let n=this.registeredArguments.map(o=>zs(o));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?n:[]).join(" ")}return this._usage=r,this}name(r){return r===void 0?this._name:(this._name=r,this)}helpGroup(r){return r===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=r,this)}commandsGroup(r){return r===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=r,this)}optionsGroup(r){return r===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=r,this)}_initOptionGroup(r){this._defaultOptionGroup&&!r.helpGroupHeading&&r.helpGroup(this._defaultOptionGroup)}_initCommandGroup(r){this._defaultCommandGroup&&!r.helpGroup()&&r.helpGroup(this._defaultCommandGroup)}nameFromFilename(r){return this._name=Zt.default.basename(r,Zt.default.extname(r)),this}executableDir(r){return r===void 0?this._executableDir:(this._executableDir=r,this)}helpInformation(r){let n=this.createHelp(),o=this._getOutputContext(r);n.prepareContext({error:o.error,helpWidth:o.helpWidth,outputHasColors:o.hasColors});let i=n.formatHelp(this,n);return o.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(r){r=r||{};let n=!!r.error,o,i,a;return n?(o=l=>this._outputConfiguration.writeErr(l),i=this._outputConfiguration.getErrHasColors(),a=this._outputConfiguration.getErrHelpWidth()):(o=l=>this._outputConfiguration.writeOut(l),i=this._outputConfiguration.getOutHasColors(),a=this._outputConfiguration.getOutHelpWidth()),{error:n,write:l=>(i||(l=this._outputConfiguration.stripColor(l)),o(l)),hasColors:i,helpWidth:a}}outputHelp(r){let n;typeof r=="function"&&(n=r,r=void 0);let o=this._getOutputContext(r),i={error:o.error,write:o.write,command:this};this._getCommandAndAncestors().reverse().forEach(c=>c.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let a=this.helpInformation({error:o.error});if(n&&(a=n(a),typeof a!="string"&&!Buffer.isBuffer(a)))throw new Error("outputHelp callback must return a string or a Buffer");o.write(a),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(c=>c.emit("afterAllHelp",i))}helpOption(r,n){return typeof r=="boolean"?(r?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(r??"-h, --help",n??"display help for command"),(r||n)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(r){return this._helpOption=r,this._initOptionGroup(r),this}help(r){this.outputHelp(r);let n=Number(ce.default.exitCode??0);n===0&&r&&typeof r!="function"&&r.error&&(n=1),this._exit(n,"commander.help","(outputHelp)")}addHelpText(r,n){let o=["beforeAll","before","after","afterAll"];if(!o.includes(r))throw new Error(`Unexpected value for position to addHelpText.
|
|
26
26
|
Expecting one of '${o.join("', '")}'`);let i=`${r}Help`;return this.on(i,a=>{let c;typeof n=="function"?c=n({error:a.error,command:a.command}):c=n,c&&a.write(`${c}
|
|
27
|
-
`)}),this}_outputHelpIfRequested(r){let n=this._getHelpOption();n&&r.find(i=>n.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function
|
|
27
|
+
`)}),this}_outputHelpIfRequested(r){let n=this._getHelpOption();n&&r.find(i=>n.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Zf(e){return e.map(r=>{if(!r.startsWith("--inspect"))return r;let n,o="127.0.0.1",i="9229",a;return(a=r.match(/^(--inspect(-brk)?)$/))!==null?n=a[1]:(a=r.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(n=a[1],/^\d+$/.test(a[3])?i=a[3]:o=a[3]):(a=r.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(n=a[1],o=a[3],i=a[4]),n&&i!=="0"?`${n}=${o}:${parseInt(i)+1}`:r})}function Xf(){if(ce.default.env.NO_COLOR||ce.default.env.FORCE_COLOR==="0"||ce.default.env.FORCE_COLOR==="false")return!1;if(ce.default.env.FORCE_COLOR||ce.default.env.CLICOLOR_FORCE!==void 0)return!0}var H4=new fo;function Xe(e){throw new Error(`assertUnreachable: ${JSON.stringify(e,null,2)}`)}function Gi(e){return`\u2022\u2022\u2022\u2022${e.slice(-4)}`}function tg(e){return{accessToken:e.accessToken,accessExpiresAt:e.expiresAt.toISOString()}}function rg(e){if(e.overrideKey)return{kind:"operation-api-key",token:e.overrideKey};if(e.operationApiKey)return{kind:"operation-api-key",token:e.operationApiKey};if(e.userAuth)return{kind:"user-session",userAuth:e.userAuth}}function ng(e){if(e)switch(e.kind){case"operation-api-key":return e.token;case"user-session":return e.userAuth.accessToken;default:Xe(e)}}function Qs(e,r){return e?.kind==="user-session"&&new Date(e.userAuth.accessExpiresAt)<=r}var ou={r:8,g:203,b:0},iu={r:0,g:130,b:0},au=["\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 ","\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557"," \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551"," \u2588\u2588\u2551 \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551"," \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551"," \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D"];function su(e,r,n){return Math.round(e+(r-e)*n)}function tL(e,r){let n=su(ou.r,iu.r,r),o=su(ou.g,iu.g,r),i=su(ou.b,iu.b,r);return`\x1B[38;2;${n};${o};${i}m${e}\x1B[0m`}function rL(e){if(!e)return`
|
|
28
28
|
|
|
29
|
-
${
|
|
30
|
-
`)}`;let r=
|
|
29
|
+
${au.join(`
|
|
30
|
+
`)}`;let r=au.length-1;return`
|
|
31
31
|
|
|
32
|
-
${
|
|
33
|
-
`)}`}function
|
|
34
|
-
`)}function Q(e){
|
|
35
|
-
`)}var
|
|
36
|
-
`)}var ig="/oauth/callback",QN=5*ou,WN=tu("Login complete","You can close this tab and return to the terminal."),Qs=tu("Login failed","Return to the terminal for details.");function ZN(e){return(0,uu.platform)()==="darwin"?["open",[e]]:(0,uu.platform)()==="win32"?["rundll32",["url.dll,FileProtocolHandler",e]]:["xdg-open",[e]]}function XN(e){let[r,n]=ZN(e),o=(0,ng.spawnSync)(r,n,{stdio:"ignore"});return o.error===void 0&&o.status===0}async function JN(e,r,n){return new Promise((o,i)=>{let a=setTimeout(()=>{i(new Error("Timed out waiting for the browser to complete login (5 minutes)."))},QN),c=(l,d,f,g)=>{l.writeHead(d,{"Content-Type":"text/html"}),l.end(f),clearTimeout(a),g()};e.on("request",(l,d)=>{let f=new URL(l.url??"/",n);if(f.pathname!==ig){d.writeHead(404,{"Content-Type":"text/html"}),d.end(Qs);return}let g=f.searchParams.get("error");if(g){let _=f.searchParams.get("error_description")??"";c(d,400,Qs,()=>i(new Error(`Authorization failed: ${g}${_?` (${_})`:""}`)));return}if(f.searchParams.get("state")!==r){c(d,400,Qs,()=>i(new Error("State mismatch on OAuth callback; aborting for safety.")));return}let T=f.searchParams.get("code");if(!T){c(d,400,Qs,()=>i(new Error("OAuth callback did not include an authorization code.")));return}c(d,200,WN,()=>o(T))})})}async function ag(e){let r=(0,og.createServer)();r.on("connection",a=>a.unref()),await new Promise((a,c)=>{r.once("error",c),r.listen(0,"127.0.0.1",()=>{r.off("error",c),a()})});let{port:n}=r.address(),o=`http://127.0.0.1:${n}`,i=`${o}${ig}`;try{let a=e.buildAuthorizeUrl(i);return XN(a)?B("Opening your browser to complete login..."):(B("Visit this URL in your browser to complete login:"),B(` ${a}`)),{code:await JN(r,e.state,o),redirectUri:i}}finally{r.close()}}var y={};Mt(y,{Assign:()=>eL,Clone:()=>Gi,Create:()=>rv,Discard:()=>nv,Metrics:()=>qt,Update:()=>ov});var qt={assign:0,create:0,clone:0,discard:0,update:0};function eL(e,r){return qt.assign+=1,{...e,...r}}var s={};Mt(s,{Entries:()=>SL,EntriesRegExp:()=>bL,Every:()=>EL,EveryAll:()=>_L,GraphemeCount:()=>yL,HasPropertyKey:()=>IL,IsArray:()=>An,IsAsyncIterator:()=>aL,IsBigInt:()=>Di,IsBoolean:()=>dg,IsClassInstance:()=>fL,IsConstructor:()=>sL,IsDeepEqual:()=>fu,IsEqual:()=>ee,IsFunction:()=>fg,IsGreaterEqualThan:()=>yg,IsGreaterThan:()=>lL,IsInteger:()=>mu,IsIterator:()=>cL,IsLessEqualThan:()=>gg,IsLessThan:()=>mL,IsMaxLength:()=>hL,IsMinLength:()=>TL,IsMultipleOf:()=>dL,IsNull:()=>Js,IsNumber:()=>ec,IsObject:()=>xn,IsObjectNotArray:()=>pL,IsString:()=>Hr,IsSymbol:()=>uL,IsUndefined:()=>du,IsValueLike:()=>gL,Keys:()=>Xs,Symbols:()=>OL,Values:()=>AL});function Fr(e,r,n){return e>=r&&e<=n}function sg(e){return Fr(e,127462,127487)}function tL(e){return Fr(e,65024,65039)}function rL(e){return Fr(e,768,879)||Fr(e,6832,6911)||Fr(e,7616,7679)||Fr(e,65056,65071)}function Zs(e){return e>65535?2:1}function cg(e,r){for(;r<e.length;){let n=e.codePointAt(r);if(rL(n)||tL(n))r+=Zs(n);else break}return r}function lu(e,r){let n=e.codePointAt(r),o=r+Zs(n);for(o=cg(e,o);o<e.length-1&&e[o]==="\u200D";){let i=e.codePointAt(o+1);o+=1+Zs(i),o=cg(e,o)}return sg(n)&&o<e.length&&sg(e.codePointAt(o))&&(o+=Zs(e.codePointAt(o))),o}function pg(e){return Fr(e,55296,56319)||Fr(e,768,879)||e===8205}function ug(e){let r=0,n=0;for(;n<e.length;)n=lu(e,n),r++;return r}function nL(e,r){let n=0,o=0;for(;o<e.length;)if(o=lu(e,o),n++,n>=r)return!0;return!1}function oL(e,r){let n=0,o=0;for(;o<e.length;)if(o=lu(e,o),n++,n>r)return!1;return!0}function lg(e,r){let n=0;for(;n<e.length;){if(pg(e.charCodeAt(n)))return nL(e,r);if(n++,n>=r)return!0}return!1}function mg(e,r){let n=0;for(;n<e.length;){if(pg(e.charCodeAt(n)))return oL(e,r);if(n++,n>r)return!1}return!0}function An(e){return Array.isArray(e)}function aL(e){return xn(e)&&Symbol.asyncIterator in e}function Di(e){return ee(typeof e,"bigint")}function dg(e){return ee(typeof e,"boolean")}function sL(e){if(du(e)||!fg(e))return!1;let r=Function.prototype.toString.call(e);return!!(/^class\s/.test(r)||/\[native code\]/.test(r))}function fg(e){return ee(typeof e,"function")}function mu(e){return Number.isInteger(e)}function cL(e){return xn(e)&&Symbol.iterator in e}function Js(e){return ee(e,null)}function ec(e){return Number.isFinite(e)}function pL(e){return xn(e)&&!An(e)}function xn(e){return ee(typeof e,"object")&&!Js(e)}function Hr(e){return ee(typeof e,"string")}function uL(e){return ee(typeof e,"symbol")}function du(e){return ee(e,void 0)}function ee(e,r){return e===r}function lL(e,r){return e>r}function mL(e,r){return e<r}function gg(e,r){return e<=r}function yg(e,r){return e>=r}function dL(e,r){if(Di(e)||Di(r))return BigInt(e)%BigInt(r)===0n;let n=1e-10;if(!ec(e)||mu(e)&&1/r%1===0)return!0;let o=e%r;return Math.min(Math.abs(o),Math.abs(o-r))<n}function fL(e){if(!xn(e))return!1;let r=globalThis.Object.getPrototypeOf(e);return Js(r)?!1:ee(typeof r.constructor,"function")&&!(ee(r.constructor,globalThis.Object)||ee(r.constructor.name,"Object"))}function gL(e){return Di(e)||dg(e)||Js(e)||ec(e)||Hr(e)||du(e)}function yL(e){return ug(e)}function hL(e,r){return mg(e,r)}function TL(e,r){return lg(e,r)}function EL(e,r,n){for(let o=r;o<e.length;o++)if(!n(e[o],o))return!1;return!0}function _L(e,r,n){let o=!0;for(let i=r;i<e.length;i++)n(e[i],i)||(o=!1);return o}function IL(e,r){return ee(r,"__proto__")||ee(r,"constructor")?Object.prototype.hasOwnProperty.call(e,r):r in e}function bL(e){return Xs(e).map(r=>[new RegExp(`^${r}$`),e[r]])}function SL(e){return Object.entries(e)}function Xs(e){return Object.getOwnPropertyNames(e)}function OL(e){return Object.getOwnPropertySymbols(e)}function AL(e){return Object.values(e)}function xL(e,r){if(!xn(r))return!1;let n=Xs(e);return ee(n.length,Xs(r).length)&&n.every(o=>fu(e[o],r[o]))}function RL(e,r){return An(r)&&ee(e.length,r.length)&&e.every((n,o)=>fu(e[o],r[o]))}function fu(e,r){return An(e)?RL(e,r):xn(e)?xL(e,r):ee(e,r)}var ct={};Mt(ct,{IsBigInt64Array:()=>qL,IsBigUint64Array:()=>BL,IsBoolean:()=>CL,IsDate:()=>HL,IsFloat32Array:()=>$L,IsFloat64Array:()=>jL,IsInt16Array:()=>kL,IsInt32Array:()=>DL,IsInt8Array:()=>NL,IsMap:()=>zL,IsNumber:()=>PL,IsRegExp:()=>FL,IsSet:()=>KL,IsString:()=>UL,IsTypeArray:()=>wL,IsUint16Array:()=>ML,IsUint32Array:()=>GL,IsUint8Array:()=>LL,IsUint8ClampedArray:()=>vL});function CL(e){return e instanceof Boolean}function PL(e){return e instanceof Number}function UL(e){return e instanceof String}function wL(e){return globalThis.ArrayBuffer.isView(e)}function NL(e){return e instanceof globalThis.Int8Array}function LL(e){return e instanceof globalThis.Uint8Array}function vL(e){return e instanceof globalThis.Uint8ClampedArray}function kL(e){return e instanceof globalThis.Int16Array}function ML(e){return e instanceof globalThis.Uint16Array}function DL(e){return e instanceof globalThis.Int32Array}function GL(e){return e instanceof globalThis.Uint32Array}function $L(e){return e instanceof globalThis.Float32Array}function jL(e){return e instanceof globalThis.Float64Array}function qL(e){return e instanceof globalThis.BigInt64Array}function BL(e){return e instanceof globalThis.BigUint64Array}function FL(e){return e instanceof globalThis.RegExp}function HL(e){return e instanceof globalThis.Date}function KL(e){return e instanceof globalThis.Set}function zL(e){return e instanceof globalThis.Map}function VL(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~guard")}function QL(e){return e.map(r=>gu(r))}function WL(e){let r={},n=Object.getOwnPropertyDescriptors(e);for(let o of Object.keys(n)){let i=n[o];s.HasPropertyKey(i,"value")&&Object.defineProperty(r,o,{...i,value:gu(i.value)})}return r}function ZL(e){return new RegExp(e.source,e.flags)}function gu(e){return e instanceof RegExp?ZL(e):VL(e)?e:s.IsArray(e)?QL(e):s.IsObject(e)?WL(e):e}function Gi(e){return qt.clone+=1,gu(e)}var Pt={};Mt(Pt,{Get:()=>ev,Reset:()=>XL,Set:()=>JL});var Rn={immutableTypes:!1,maxErrors:8,useEval:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1};function XL(){Rn.immutableTypes=!1,Rn.maxErrors=8,Rn.useEval=!0,Rn.exactOptionalPropertyTypes=!1,Rn.enumerableKind=!1}function JL(e){for(let r of s.Keys(e)){let n=e[r];n!==void 0&&Object.defineProperty(Rn,r,{value:n})}}function ev(){return Rn}function tv(e,r,n={}){for(let o of Object.keys(r))Object.defineProperty(e,o,{configurable:!0,writable:!0,enumerable:!1,value:r[o]});return e}function hg(e,r){return{...e,...r}}function rv(e,r,n={}){qt.create+=1;let o=Pt.Get(),i=hg(r,n),a=o.enumerableKind?hg(i,e):tv(i,e);return o.immutableTypes?Object.freeze(a):a}function nv(e,r){qt.discard+=1;let n={},o=Object.getOwnPropertyDescriptors(Gi(e)),i=new Set(r);for(let a of Object.keys(o))i.has(a)||Object.defineProperty(n,a,o[a]);return n}function ov(e,r,n){qt.update+=1;let o=Pt.Get(),i=Gi(e);for(let a of Object.keys(r))Object.defineProperty(i,a,{configurable:!0,writable:!0,enumerable:o.enumerableKind,value:r[a]});for(let a of Object.keys(n))Object.defineProperty(i,a,{configurable:!0,enumerable:!0,writable:!0,value:n[a]});return i}function S(e,r){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],r)}function A(e){return s.IsObject(e)}function Tg(e){return y.Create({"~kind":"OptionalAddAction"},{type:e},{})}function Eg(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"OptionalAddAction")&&A(e.type)}function _g(e){return y.Create({"~kind":"OptionalRemoveAction"},{type:e},{})}function Ig(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"OptionalRemoveAction")&&A(e.type)}function bg(e){return y.Create({"~kind":"ReadonlyAddAction"},{type:e},{})}function Sg(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"ReadonlyAddAction")&&A(e.type)}function Og(e){return y.Create({"~kind":"ReadonlyRemoveAction"},{type:e},{})}function Ag(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"ReadonlyRemoveAction")&&A(e.type)}function P(e,r,n){return y.Create({"~kind":"Deferred"},{action:e,parameters:r,options:n},{})}function xg(e){return S(e,"Deferred")}function yu(e){return y.Update(e,{"~immutable":!0},{})}function Kr(e){return yu(e)}function Cn(e){return A(e)&&s.HasPropertyKey(e,"~immutable")}function go(e){return y.Discard(e,["~optional"])}function Et(e){return y.Update(e,{"~optional":!0},{})}function tc(e){return Et(e)}function Ge(e){return A(e)&&s.HasPropertyKey(e,"~optional")}function rc(e){return y.Discard(e,["~readonly"])}function _t(e){return y.Update(e,{"~readonly":!0},{})}function nc(e){return _t(e)}function Pn(e){return A(e)&&s.HasPropertyKey(e,"~readonly")}function Bt(e,r){return y.Create({"~kind":"Array"},{type:"array",items:e},r)}function te(e){return S(e,"Array")}function oc(e){return y.Discard(e,["~kind","type","items"])}function Xt(e,r){return y.Create({"~kind":"AsyncIterator"},{type:"asyncIterator",iteratorItems:e},r)}function at(e){return S(e,"AsyncIterator")}function Rg(e){return y.Discard(e,["~kind","type","iteratorItems"])}function Cg(e){return{enumerable:Pt.Get().enumerableKind,writable:!1,configurable:!1,value:e}}var ic=class{constructor(){globalThis.Object.defineProperty(this,"~kind",Cg("Base")),globalThis.Object.defineProperty(this,"~guard",Cg({check:r=>this.Check(r),errors:r=>this.Errors(r)}))}Check(r){return!0}Errors(r){return[]}Convert(r){return r}Clean(r){return r}Default(r){return r}Create(){throw new Error("Create not implemented")}Clone(){throw Error("Clone not implemented")}};function Ut(e){return S(e,"Base")}function zr(e,r,n={}){return y.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:r},n)}function $e(e){return S(e,"Constructor")}function Pg(e){return y.Discard(e,["~kind","type","parameters","instanceType"])}function Yr(e,r,n={}){return y.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:r},n)}function je(e){return S(e,"Function")}function Ug(e){return y.Discard(e,["~kind","type","parameters","returnType"])}function Le(e,r){return y.Create({"~kind":"Ref"},{$ref:e},r)}function pe(e){return S(e,"Ref")}function Vr(e,r){return y.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:r})}function yo(e){return S(e,"Generic")}var wg="(?!)";function Z(e){return y.Create({"~kind":"Never"},{not:{}},e)}function hr(e){return S(e,"Never")}function iv(){return["(not-resolvable)",Z()]}function av(){return["(not-generic)",Z()]}function sv(e,r,n){return[e,Vr(r,n)]}function cv(e,r,n){return r in e?Ng(e,r,e[r],n):iv()}function Ng(e,r,n,o){return yo(n)?sv(r,n.parameters,n.expression):pe(n)?cv(e,n.$ref,o):av()}function Lg(e,r,n){return Ng(e,"(anonymous)",r,n)}function Jt(e,r,n){let o=s.Keys(e).reduce((i,a)=>({...i,[a]:y.Update(e[a],{},{$id:a})}),{});return y.Create({"~kind":"Cyclic"},{$defs:o,$ref:r},n)}function me(e){return S(e,"Cyclic")}var ie={};Mt(ie,{Match:()=>pv});function pv(e,r){return r[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function Je(e){return y.Create({"~kind":"Unknown"},{},e)}function It(e){return S(e,"Unknown")}function $i(...e){let[r,n]=ie.Match(e,{2:(o,i)=>[o,i,i],1:o=>[o,Je(),Je()]});return y.Create({"~kind":"Infer"},{type:"infer",name:r,extends:n},{})}function Pe(e){return S(e,"Infer")}function ho(e){return y.Create({"~kind":"Any"},{},e)}function pt(e){return S(e,"Any")}function vg(e){return s.IsObjectNotArray(e)}function kg(e){return s.Keys(e).filter(n=>isNaN(n)).reduce((n,o)=>[...n,e[o]],[])}function Mg(e,r){let n=vg(e)?kg(e):e;return y.Create({"~kind":"Enum"},{enum:n},r)}function Ue(e){return S(e,"Enum")}function wt(e,r={}){return y.Create({"~kind":"Intersect"},{allOf:e},r)}function w(e){return S(e,"Intersect")}function Dg(e){return y.Discard(e,["~kind","allOf"])}function H(){throw new Error("Unreachable")}var Wr={};Mt(Wr,{Hash:()=>Rv,HashCode:()=>Hg});function uv(e){let r=new Set,n=e;for(;n&&n!==Object.prototype;){for(let o of Reflect.ownKeys(n))o!=="constructor"&&typeof o!="symbol"&&r.add(o);n=Object.getPrototypeOf(n)}return[...r]}function lv(e){return typeof e=="number"}var ut;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})(ut||(ut={}));var To=BigInt("14695981039346656037"),[mv,dv]=[BigInt("1099511628211"),BigInt("18446744073709551616")],fv=Array.from({length:256}).map((e,r)=>BigInt(r)),qg=new Float64Array(1),Bg=new DataView(qg.buffer),Fg=new Uint8Array(qg.buffer);function et(e){To=To^fv[e],To=To*mv%dv}function gv(e){et(ut.Array);for(let r of e)Qr(r)}function yv(e){et(ut.BigInt),Bg.setBigInt64(0,e);for(let r of Fg)et(r)}function $g(e){et(ut.Boolean),et(e?1:0)}function hv(e){et(ut.Constructor),Qr(e.toString())}function Tv(e){et(ut.Date),Qr(e.getTime())}function Ev(e){et(ut.Function),Qr(e.toString())}function _v(e){et(ut.Null)}function jg(e){et(ut.Number),Bg.setFloat64(0,e,!0);for(let r of Fg)et(r)}function Iv(e){et(ut.Object);for(let r of uv(e).sort())Qr(r),Qr(e[r])}function bv(e){et(ut.RegExp),hu(e.toString())}var Sv=new TextEncoder;function hu(e){et(ut.String);for(let r of Sv.encode(e))et(r)}function Ov(e){et(ut.Symbol),Qr(e.toString())}function Av(e){et(ut.TypeArray);let r=new Uint8Array(e.buffer);for(let n=0;n<r.length;n++)et(r[n])}function xv(e){return et(ut.Undefined)}function Qr(e){return ct.IsTypeArray(e)?Av(e):ct.IsDate(e)?Tv(e):ct.IsRegExp(e)?bv(e):ct.IsBoolean(e)?$g(e.valueOf()):ct.IsString(e)?hu(e.valueOf()):ct.IsNumber(e)?jg(e.valueOf()):lv(e)?jg(e):s.IsArray(e)?gv(e):s.IsBoolean(e)?$g(e):s.IsBigInt(e)?yv(e):s.IsConstructor(e)?hv(e):s.IsNull(e)?_v(e):s.IsObject(e)?Iv(e):s.IsString(e)?hu(e):s.IsSymbol(e)?Ov(e):s.IsUndefined(e)?xv(e):s.IsFunction(e)?Ev(e):H()}function Hg(e){return To=BigInt("14695981039346656037"),Qr(e),To}function Rv(e){return Hg(e).toString(16).padStart(16,"0")}function Kg(e){switch(e.keyword){case"additionalProperties":return"must not have additional properties";case"anyOf":return"must match a schema in anyOf";case"boolean":return"schema is false";case"const":return"must be equal to constant";case"contains":return"must contain at least 1 valid item";case"dependencies":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"dependentRequired":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"enum":return"must be equal to one of the allowed values";case"exclusiveMaximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"exclusiveMinimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"format":return`must match format "${e.params.format}"`;case"if":return`must match "${e.params.failingKeyword}" schema`;case"maxItems":return`must not have more than ${e.params.limit} items`;case"maxLength":return`must not have more than ${e.params.limit} characters`;case"maxProperties":return`must not have more than ${e.params.limit} properties`;case"maximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"minItems":return`must not have fewer than ${e.params.limit} items`;case"minLength":return`must not have fewer than ${e.params.limit} characters`;case"minProperties":return`must not have fewer than ${e.params.limit} properties`;case"minimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"multipleOf":return`must be multiple of ${e.params.multipleOf}`;case"not":return"must not be valid";case"oneOf":return"must match exactly one schema in oneOf";case"pattern":return`must match pattern "${e.params.pattern}"`;case"propertyNames":return`property names ${e.params.propertyNames.join(", ")} are invalid`;case"required":return`must have required properties ${e.params.requiredProperties.join(", ")}`;case"type":return typeof e.params.type=="string"?`must be ${e.params.type}`:`must be either ${e.params.type.join(" or ")}`;case"unevaluatedItems":return"must not have unevaluated items";case"unevaluatedProperties":return"must not have unevaluated properties";case"uniqueItems":return"must not have duplicate items";case"~guard":return"must match check function";case"~refine":return e.params.message;default:return"an unknown validation error occurred"}}var Cv=Kg;function zg(){return Cv}var ji=class{constructor(r,n){this.type=r,this.decode=n}Encode(r){let n=this.type,o=Un(n)?c=>this.decode(n["~codec"].decode(c)):this.decode,i=Un(n)?c=>n["~codec"].encode(r(c)):r,a={decode:o,encode:i};return y.Update(this.type,{"~codec":a},{})}},qi=class{constructor(r){this.type=r}Decode(r){return new ji(this.type,r)}};function ac(e){return new qi(e)}function Vg(e,r){return ac(e).Decode(r).Encode(()=>{throw Error("Encode not implemented")})}function Qg(e,r){return ac(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(r)}function Un(e){return A(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function Uv(e,r){let n=sc(e)?[...e["~refine"],r]:[r];return y.Update(e,{"~refine":n},{})}function Wg(e,r,n="error"){return Uv(e,{refine:r,message:n})}function sc(e){return A(e)&&s.HasPropertyKey(e,"~refine")}var Zg="-?(?:0|[1-9][0-9]*)n";function Bi(e){return y.Create({"~kind":"BigInt"},{type:"bigint"},e)}function At(e){return S(e,"BigInt")}function cc(e){return y.Create({"~kind":"Boolean"},{type:"boolean"},e)}function lt(e){return S(e,"Boolean")}function Fi(e){return y.Create({"~kind":"Identifier"},{name:e})}function Xg(e){return S(e,"Identifier")}var pc="-?(?:0|[1-9][0-9]*)";function wn(e){return y.Create({"~kind":"Integer"},{type:"integer"},e)}function He(e){return S(e,"Integer")}function er(e,r){return y.Create({"~kind":"Iterator"},{type:"iterator",iteratorItems:e},r)}function st(e){return S(e,"Iterator")}function Jg(e){return y.Discard(e,["~kind","type","iteratorItems"])}var Tu=class extends Error{constructor(r){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:r},writable:!1,configurable:!1,enumerable:!1})}};function wv(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new Tu(e)})()}function Y(e,r){return y.Create({"~kind":"Literal"},{type:wv(e),const:e},r)}function uc(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function ey(e){return X(e)&&s.IsBigInt(e.const)}function ty(e){return X(e)&&s.IsBoolean(e.const)}function Eo(e){return X(e)&&s.IsNumber(e.const)}function _o(e){return X(e)&&s.IsString(e.const)}function X(e){return S(e,"Literal")}function Zr(e){return y.Create({"~kind":"Null"},{type:"null"},e)}function tr(e){return S(e,"Null")}var lc="-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?";function Nt(e){return y.Create({"~kind":"Number"},{type:"number"},e)}function be(e){return S(e,"Number")}function Io(e){return y.Create({"~kind":"Symbol"},{type:"symbol"},e)}function rr(e){return S(e,"Symbol")}function ry(e){return s.Keys(e).filter(r=>!Ge(e[r]))}function ny(e){return s.Keys(e)}function mc(e){return s.Values(e)}function Nv(e,r={}){let n=ry(e),o=n.length>0?{required:n}:{};return y.Create({"~kind":"Object"},{type:"object",...o,properties:e},r)}var N=Nv;function k(e){return S(e,"Object")}function oy(e){return y.Discard(e,["~kind","type","properties","required"])}function Nn(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,a],1:i=>[i,Je(),Je()]});return y.Create({"~kind":"Parameter"},{name:r,extends:n,equals:o},{})}function iy(e){return S(e,"Parameter")}function nr(e,r){return y.Create({"~kind":"Promise"},{type:"promise",item:e},r)}function tt(e){return S(e,"Promise")}function ay(e){return y.Discard(e,["~kind","type","item"])}var dc=".*";function bt(e){return y.Create({"~kind":"String"},{type:"string"},e)}function ve(e){return S(e,"String")}function St(e,r){let n="object",o={[e]:r};return y.Create({"~kind":"Record"},{type:n,patternProperties:o})}var bo=`^${pc}$`,So=`^${lc}$`,Dt=`^${dc}$`;function Hi(e,r,n={}){return P("Record",[e,r],n)}function Lv(e,r,n={}){return C({},Hi(e,r,n))}function fc(e,r,n={}){return Lv(e,r,n)}function gc(e,r){return St(e,r)}function xt(e){return s.Keys(e.patternProperties)[0]}function Oo(e){let r=xt(e);return s.IsEqual(r,bo)?wn():s.IsEqual(r,So)?Nt():bt()}function rt(e){return e.patternProperties[xt(e)]}function Se(e){return S(e,"Record")}function Ln(e){return y.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function Xr(e){return S(e,"Rest")}function yc(e){return y.Create({"~kind":"This"},{$ref:"#"},e)}function sy(e){return S(e,"This")}function Ke(e,r={}){let[n,o,i]=[e,e.length,!1];return y.Create({"~kind":"Tuple"},{type:"array",additionalItems:i,items:n,minItems:o},r)}function V(e){return S(e,"Tuple")}function cy(e){return y.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Ao(e){return y.Create({"~kind":"Undefined"},{type:"undefined"},e)}function or(e){return S(e,"Undefined")}function q(e,r={}){return y.Create({"~kind":"Union"},{anyOf:e},r)}function O(e){return S(e,"Union")}function py(e){return y.Discard(e,["~kind","anyOf"])}function uy(e){return y.Create({"~kind":"Unsafe"},{},e)}function ly(e){return S(e,"Unsafe")}function hc(e){return y.Create({"~kind":"Void"},{type:"void"},e)}function Rt(e){return S(e,"Void")}function kv(e,r){return s.IsEqual(e,"Array")?Bt(r[0]):s.IsEqual(e,"AsyncIterator")?Xt(r[0]):s.IsEqual(e,"Iterator")?er(r[0]):s.IsEqual(e,"Promise")?nr(r[0]):s.IsEqual(e,"Awaited")?pa(r[0]):s.IsEqual(e,"Capitalize")?zi(r[0]):s.IsEqual(e,"ConstructorParameters")?Zi(r[0]):s.IsEqual(e,"Evaluate")?_u(r[0]):s.IsEqual(e,"Exclude")?Xi(r[0],r[1]):s.IsEqual(e,"Extract")?Ji(r[0],r[1]):s.IsEqual(e,"Index")?Co(r[0],r[1]):s.IsEqual(e,"InstanceType")?ea(r[0]):s.IsEqual(e,"Lowercase")?Yi(r[0]):s.IsEqual(e,"NonNullable")?ta(r[0]):s.IsEqual(e,"Omit")?ra(r[0],r[1]):s.IsEqual(e,"Options")?Uo(r[0],r[1]):s.IsEqual(e,"Parameters")?na(r[0]):s.IsEqual(e,"Partial")?oa(r[0]):s.IsEqual(e,"Pick")?ia(r[0],r[1]):s.IsEqual(e,"Readonly")?aa(r[0]):s.IsEqual(e,"KeyOf")?Po(r[0]):s.IsEqual(e,"Record")?Hi(r[0],r[1]):s.IsEqual(e,"Required")?sa(r[0]):s.IsEqual(e,"ReturnType")?ca(r[0]):s.IsEqual(e,"Uncapitalize")?Vi(r[0]):s.IsEqual(e,"Uppercase")?Qi(r[0]):Tc(Le(e),r)}function vn(){throw Error("Unreachable")}var Mv=(e,r=[])=>e.reduce((n,o)=>s.IsArray(o)&&s.IsEqual(o.length,2)?[...n,o[0]]:[...n,o],[]),Tr=e=>{let[r,n]=e;return Mv([...r,...n])};function yy(e){return Nn(e[0],e[2],e[4])}function hy(e){return Nn(e[0],e[2],e[2])}function Ty(e){return Nn(e[0],Je(),e[2])}function Ey(e){return Nn(e,Je(),Je())}function _y(e){return Tr(e)}function Iy(e){return e[1]}function by(e){return Tr(e)}function Sy(e){return e[1]}function Oy(e){return kv(e[0],e[1])}function Ay(e){return null}function xy(e){return bt()}function Ry(e){return Nt()}function Cy(e){return cc()}function Py(e){return Ao()}function Uy(e){return Zr()}function wy(e){return wn()}function Ny(e){return Bi()}function Ly(e){return Je()}function vy(e){return ho()}function ky(e){return N({})}function My(e){return Z()}function Dy(e){return Io()}function Gy(e){return hc()}function $y(e){return yc()}function jy(e){return e[1]}function qy(e){return Y(e)}function By(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function Fy(e){return e[1]}function Hy(e){return Ki(e)}function Ky(e){return Y(BigInt(e))}function zy(e){return Y(s.IsEqual(e,"true"))}function Yy(e){return Y(parseFloat(e))}function Vy(e){return Y(e)}function Qy(e){return e.length>0}function Wy(e){return e.reduce((r,n)=>s.IsEqual(n.length,3)?[...r,[n[1]]]:[...r,[]],[])}function Zy(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Xy(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}var my=(e,r)=>r.reduceRight((n,o)=>{let i=o;return s.IsEqual(i.length,1)?Co(n,i[0]):s.IsEqual(i.length,0)?Bt(n):vn()},e),dy=(e,r)=>s.IsEqual(r.length,3)?Wi(e,r[0],r[1],r[2]):e;function Jy(e){let[r,n,o,i]=e;return dy(r?Po(my(n,o)):my(n,o),i)}function Eu(e,r){return s.IsEqual(r.length,3)?(()=>{let[n,o,i]=r,a=Eu(o,i);if(s.IsEqual(n,"&"))return w(a)?wt([e,...a.allOf]):wt([e,a]);if(s.IsEqual(n,"|"))return O(a)?q([e,...a.anyOf]):q([e,a]);vn()})():e}function eh(e){let[r,n]=e;return Eu(r,n)}function th(e){let[r,n]=e;return Eu(r,n)}function rh(e){return yu(e[1])}function nh(e){return e[1]}function oh(e){return Vr(e[0],e[2])}function ih(e){return s.IsEqual(e.length,4)?$i(e[1],e[3]):s.IsEqual(e.length,2)?$i(e[1],Je()):vn()}function ah(e){return`${e}`}function sh(e){return He(e[3])?bo:be(e[3])?So:rr(e[3])?Dt:ve(e[3])?Dt:vn()}function ch(e){return e.length>0}function ph(e){return e.length>0}function uh(e){let[r,n,o,i,a]=e;return{[n]:r&&o?_t(Et(a)):r&&!o?_t(a):!r&&o?Et(a):a}}function lh(e){return Tr(e)}function mh(e){return e.reduce((r,n)=>s.HasPropertyKey(n,bo)||s.HasPropertyKey(n,So)||s.HasPropertyKey(n,Dt)?[r[0],y.Assign(r[1],n)]:[y.Assign(r[0],n),r[1]],[{},{}])}function dh(e){return mh(e[1])}function fh(e){let[r,n]=e,o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return N(r,o)}function gh(e){return s.IsEqual(e.length,5)?_t(Et(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?_t(e[3]):Et(e[3]):vn()}function yh(e){return _t(Et(e[1]))}function hh(e){return _t(e[1])}function Th(e){return Et(e[0])}function Eh(e){return s.IsEqual(e.length,2)?Ln(e[1]):s.IsEqual(e.length,1)?e[0]:vn()}function _h(e){return Tr(e)}function Ih(e){return Ke(e[1])}function bh(e){return _t(Et(e[4]))}function Sh(e){return _t(e[3])}function Oh(e){return Et(e[3])}function Ah(e){return e[2]}function xh(e){return s.IsEqual(e.length,2)?Ln(e[1]):s.IsEqual(e.length,1)?e[0]:vn()}function Rh(e){return Tr(e)}function Ch(e){return Yr(e[1],e[4])}function Ph(e){return zr(e[2],e[5])}function fy(e,r){return s.IsEqual(e,"remove")?Og(r):s.IsEqual(e,"add")?bg(r):r}function Uh(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function gy(e,r){return s.IsEqual(e,"remove")?_g(r):s.IsEqual(e,"add")?Tg(r):r}function wh(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function Nh(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function Lh(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?xo(Fi(e[3]),e[5],e[6][0],fy(e[1],gy(e[8],e[10]))):xo(Fi(e[3]),e[5],Le(e[3]),fy(e[1],gy(e[8],e[10])))}function vh(e){return Le(e)}function kh(e){return Uo(e[2],e[4])}function Mh(e){return parseFloat(e)}function Dh(e){return s.IsEqual(e,"true")}function Gh(e){return null}function $h(e){return{[e[0]]:e[2]}}function jh(e){return Tr(e)}function Dv(e){return e.reduce((r,n)=>y.Assign(r,n),{})}function qh(e){return Dv(e[1])}function Bh(e){return Tr(e)}function Fh(e){return e[1]}function Hh(e){return Bi()}function Kh(e){return bt()}function zh(e){return Nt()}function Yh(e){return wn()}function Vh(e){return Z()}function Qh(e){return Y(e)}function Wh(e){return q(e[1])}function Zh(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Xh(e){return[e[0],...e[1]]}function Jh(e){return e[1]}function eT(e){return Tr(e)}function tT(e){return s.IsEqual(e.length,2)?e[1]:[]}function rT(e){let r=e[2],n=e[3],[o,i]=e[4],a=s.IsEqual(s.Keys(i).length,0)?{}:{patternProperties:i};return{[e[1]]:Vr(r,Ro(n,o,a))}}function nT(e){let r=e[2],[n,o]=e[3],i=s.IsEqual(s.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:Ro(r,n,i)}}function oT(e){return{[e[1]]:Vr(e[2],e[4])}}function iT(e){return{[e[1]]:e[3]}}function aT(e){return null}function sT(e){return mh(Tr(e))}function cT(e){return e[1]}function pT(e){let r=e[0],n=e[1];return Iu(y.Assign(r,n[0]))}function ce(e){return An(e)&&ee(e.length,2)}function jv(e,r){return ee(r.indexOf(e),0)?[e,r.slice(e.length)]:[]}function qe(e,r){let[n,...o]=e;return Hr(n)?(()=>{let i=jv(n,r);return ee(i.length,2)?i:qe(o,r)})():[]}function bu(e,r){return Array.from({length:r-e+1},(n,o)=>String.fromCharCode(e+o))}var uT=[...bu(97,122),...bu(65,90)],Su="0",Ou=bu(49,57),wo=[Su,...Ou],lT=" ",No=`
|
|
37
|
-
`;var Jr="_",
|
|
32
|
+
${au.map((o,i)=>tL(o,r===0?0:i/r)).join(`
|
|
33
|
+
`)}`}function og(){return rL(process.stdout.isTTY&&!process.env.NO_COLOR)}var Xb=require("node:crypto");var $i=require("node:crypto");function nL(e){return(0,$i.createHash)("sha256").update(e).digest("base64url")}function ig(){let e=(0,$i.randomBytes)(32).toString("base64url");return{verifier:e,challenge:nL(e)}}var fg=require("node:child_process"),gg=require("node:http"),Tu=require("node:os");var oL={"&":"&","<":"<",">":">",'"':""","'":"'"};function cu(e){return e.replace(/[&<>"']/g,r=>oL[r]??r)}var iL=[":root{color-scheme:light dark;--bg:#f9fafb;--card:#fff;--fg:#1f2937;--fg-muted:#6b7280;","--logo-1:#08cb00;--logo-2:#008200;--brand:#08cb00;--bloom:#e5e7eb}","@media(prefers-color-scheme:dark){:root{--bg:#18181b;--card:#202023;--fg:#e4e4e7;","--fg-muted:#a1a1aa;--logo-1:#fff;--logo-2:#fff;--bloom:#52525b}}","*{box-sizing:border-box}","body{margin:0;min-height:100vh;display:flex;align-items:flex-start;justify-content:center;","padding:24px;padding-top:14vh;font-family:Inter,system-ui,-apple-system,'Segoe UI',sans-serif;","color:var(--fg);background-color:var(--bg);background-image:","radial-gradient(72% 78% at 104% 112%,var(--brand) -20%,transparent 64%),","radial-gradient(46% 46% at 94% -4%,var(--brand) -20%,transparent 64%),","radial-gradient(48% 58% at -8% 68%,var(--bloom) -20%,transparent 64%)}","main{display:flex;flex-direction:column;align-items:center;text-align:center;gap:24px;","width:100%;max-width:480px;padding:32px;border-radius:8px;backdrop-filter:blur(8px);","background-color:color-mix(in srgb,var(--card) 55%,transparent);","box-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1)}",".tile{display:flex;padding:6px;border-radius:6px;background-color:var(--card);","box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)}",".tile svg{display:block;width:32px;height:32px}",".copy{display:flex;flex-direction:column;gap:8px}","h1{margin:0;font-size:29px;font-weight:600;line-height:1.2}","p{margin:0;font-size:14px;line-height:20px;color:var(--fg-muted)}"].join(""),aL=['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 111.94 133.41" aria-hidden="true">','<path fill="var(--logo-2)" d="M40.66,54.06c-11.32,8.54-25.39,13.61-40.66,13.61v-23.36c17.9,0,','33.3-10.6,40.29-25.87v28.28c0,2.48.13,4.93.37,7.34Z"/>','<path fill="var(--logo-2)" d="M67.65,103.01v30.4h-23.36v-35.58c-11.87,10.29-27.34,16.54-44.29,','16.54v-23.36c19.33,0,35.76-12.37,41.8-29.63,3.5,16.76,12.87,31.39,25.85,41.63Z"/>','<rect fill="var(--logo-1)" x="44.29" width="23.36" height=".02"/>','<path fill="var(--logo-1)" d="M111.94,67.67c-16.83,0-32.21-6.14-44.05-16.3,2.32,22.28,21.16,',"39.64,44.05,39.64v23.36c-37.36,0-67.65-30.29-67.65-67.65V.02h23.36c0,24.47,19.83,44.29,44.29,",'44.29v23.36Z"/></svg>'].join("");function pu(e,r){let n=cu(e);return['<!doctype html><html lang="en"><head><meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1">',`<title>${n}</title><style>${iL}</style></head><body><main>`,`<span class="tile">${aL}</span>`,`<div class="copy"><h1>${n}</h1><p>${cu(r)}</p></div>`,"</main></body></html>"].join("")}var rY=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z"));var mY=60*1e3;var VY=1/1e6,lu=1e3,mu=60*lu,mL=60*mu,Zs=24*mL,QY=7*Zs,WY=30*Zs;var du=["past-5-minutes","past-15-minutes","past-30-minutes","past-1-hour","past-2-hours","past-4-hours","past-6-hours","past-12-hours","past-24-hours","past-2-days","past-3-days","past-7-days","past-30-days","past-3-months","current-day","current-week","current-month","current-year","previous-day","previous-week","previous-month","previous-3-months","previous-year"];var dL={s:1,m:60,h:3600,d:86400};function sg(e){for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n<48||n>57)return!1}return!0}function cg(){return Math.floor(Date.now()/1e3)}function Xs(e){if(typeof e=="number")return e;if(e==="now")return cg();if(e.startsWith("-")&&e.length>=3){let n=e.at(-1),o=n?dL[n]:void 0;if(o){let i=e.slice(1,-1);if(i.length>0&&sg(i))return cg()-parseInt(i,10)*o}}if(sg(e)&&e.length>0)return parseInt(e,10);let r=Date.parse(e);if(!Number.isNaN(r))return Math.floor(r/1e3);throw new Error(`Invalid time value: ${e}. Use unix seconds, relative (-30m, -1h), 'now', or ISO 8601.`)}function q(e){process.stdout.write(`${e}
|
|
34
|
+
`)}function Q(e){q(JSON.stringify(e,null,2))}function ug(e){process.stderr.write(`${e}
|
|
35
|
+
`)}var pg=["json","tsv","csv"];function fu(e){let r=pg.find(n=>n===e);if(r!==void 0)return r;throw new Error(`--output must be one of: ${pg.join(", ")} (got: ${e})`)}function gu(e){let r=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);if(r.length===0)throw new Error("--fields must contain at least one field name");return r}function lg(e,r){let n=e;for(let o of r.split(".")){if(n===null||typeof n!="object"||!Object.hasOwn(n,o))return;n=n[o]}return n}function yu(e,r){let n=Object.create(null);for(let o of r){let i=lg(e,o);if(i===void 0)continue;let a=o.split("."),c=a.pop();if(c===void 0)continue;let l=n;for(let d of a)(typeof l[d]!="object"||l[d]===null)&&(l[d]=Object.create(null)),l=l[d];l[c]=i}return n}function mg(e){return e==null?null:typeof e=="string"?e:JSON.stringify(e)}var fL={"\\":"\\\\"," ":"\\t","\r":"\\r","\n":"\\n"};function gL(e){let r=mg(e);return r===null?"":r.replace(/[\\\t\r\n]/g,n=>fL[n]??n)}function yL(e){let r=mg(e);return r===null?"":/[,"\n\r]/.test(r)?`"${r.replaceAll('"','""')}"`:r}function hu(e,r,n){if(r.length===0)return"";let o=e==="csv"?",":" ",i=e==="csv"?yL:gL,a=n.map(l=>i(l)).join(o),c=r.map(l=>n.map(d=>i(lg(l,d))).join(o));return[a,...c].join(`
|
|
36
|
+
`)}var yg="/oauth/callback",TL=5*mu,EL=pu("Login complete","You can close this tab and return to the terminal."),Js=pu("Login failed","Return to the terminal for details.");function _L(e){return(0,Tu.platform)()==="darwin"?["open",[e]]:(0,Tu.platform)()==="win32"?["rundll32",["url.dll,FileProtocolHandler",e]]:["xdg-open",[e]]}function IL(e){let[r,n]=_L(e),o=(0,fg.spawnSync)(r,n,{stdio:"ignore"});return o.error===void 0&&o.status===0}async function bL(e,r,n){return new Promise((o,i)=>{let a=setTimeout(()=>{i(new Error("Timed out waiting for the browser to complete login (5 minutes)."))},TL),c=(l,d,f,g)=>{l.writeHead(d,{"Content-Type":"text/html"}),l.end(f),clearTimeout(a),g()};e.on("request",(l,d)=>{let f=new URL(l.url??"/",n);if(f.pathname!==yg){d.writeHead(404,{"Content-Type":"text/html"}),d.end(Js);return}let g=f.searchParams.get("error");if(g){let _=f.searchParams.get("error_description")??"";c(d,400,Js,()=>i(new Error(`Authorization failed: ${g}${_?` (${_})`:""}`)));return}if(f.searchParams.get("state")!==r){c(d,400,Js,()=>i(new Error("State mismatch on OAuth callback; aborting for safety.")));return}let T=f.searchParams.get("code");if(!T){c(d,400,Js,()=>i(new Error("OAuth callback did not include an authorization code.")));return}c(d,200,EL,()=>o(T))})})}async function hg(e){let r=(0,gg.createServer)();r.on("connection",a=>a.unref()),await new Promise((a,c)=>{r.once("error",c),r.listen(0,"127.0.0.1",()=>{r.off("error",c),a()})});let{port:n}=r.address(),o=`http://127.0.0.1:${n}`,i=`${o}${yg}`;try{let a=e.buildAuthorizeUrl(i);return IL(a)?q("Opening your browser to complete login..."):(q("Visit this URL in your browser to complete login:"),q(` ${a}`)),{code:await bL(r,e.state,o),redirectUri:i}}finally{r.close()}}var y={};Gt(y,{Assign:()=>SL,Clone:()=>Bi,Create:()=>Av,Discard:()=>xv,Metrics:()=>Ft,Update:()=>Rv});var Ft={assign:0,create:0,clone:0,discard:0,update:0};function SL(e,r){return Ft.assign+=1,{...e,...r}}var s={};Gt(s,{Entries:()=>zL,EntriesRegExp:()=>KL,Every:()=>qL,EveryAll:()=>FL,GraphemeCount:()=>$L,HasPropertyKey:()=>HL,IsArray:()=>An,IsAsyncIterator:()=>PL,IsBigInt:()=>ji,IsBoolean:()=>Og,IsClassInstance:()=>DL,IsConstructor:()=>UL,IsDeepEqual:()=>bu,IsEqual:()=>ee,IsFunction:()=>Ag,IsGreaterEqualThan:()=>Rg,IsGreaterThan:()=>vL,IsInteger:()=>_u,IsIterator:()=>wL,IsLessEqualThan:()=>xg,IsLessThan:()=>kL,IsMaxLength:()=>jL,IsMinLength:()=>BL,IsMultipleOf:()=>ML,IsNull:()=>nc,IsNumber:()=>oc,IsObject:()=>xn,IsObjectNotArray:()=>NL,IsString:()=>Hr,IsSymbol:()=>LL,IsUndefined:()=>Iu,IsValueLike:()=>GL,Keys:()=>rc,Symbols:()=>YL,Values:()=>VL});function Fr(e,r,n){return e>=r&&e<=n}function Tg(e){return Fr(e,127462,127487)}function OL(e){return Fr(e,65024,65039)}function AL(e){return Fr(e,768,879)||Fr(e,6832,6911)||Fr(e,7616,7679)||Fr(e,65056,65071)}function tc(e){return e>65535?2:1}function Eg(e,r){for(;r<e.length;){let n=e.codePointAt(r);if(AL(n)||OL(n))r+=tc(n);else break}return r}function Eu(e,r){let n=e.codePointAt(r),o=r+tc(n);for(o=Eg(e,o);o<e.length-1&&e[o]==="\u200D";){let i=e.codePointAt(o+1);o+=1+tc(i),o=Eg(e,o)}return Tg(n)&&o<e.length&&Tg(e.codePointAt(o))&&(o+=tc(e.codePointAt(o))),o}function _g(e){return Fr(e,55296,56319)||Fr(e,768,879)||e===8205}function Ig(e){let r=0,n=0;for(;n<e.length;)n=Eu(e,n),r++;return r}function xL(e,r){let n=0,o=0;for(;o<e.length;)if(o=Eu(e,o),n++,n>=r)return!0;return!1}function RL(e,r){let n=0,o=0;for(;o<e.length;)if(o=Eu(e,o),n++,n>r)return!1;return!0}function bg(e,r){let n=0;for(;n<e.length;){if(_g(e.charCodeAt(n)))return xL(e,r);if(n++,n>=r)return!0}return!1}function Sg(e,r){let n=0;for(;n<e.length;){if(_g(e.charCodeAt(n)))return RL(e,r);if(n++,n>r)return!1}return!0}function An(e){return Array.isArray(e)}function PL(e){return xn(e)&&Symbol.asyncIterator in e}function ji(e){return ee(typeof e,"bigint")}function Og(e){return ee(typeof e,"boolean")}function UL(e){if(Iu(e)||!Ag(e))return!1;let r=Function.prototype.toString.call(e);return!!(/^class\s/.test(r)||/\[native code\]/.test(r))}function Ag(e){return ee(typeof e,"function")}function _u(e){return Number.isInteger(e)}function wL(e){return xn(e)&&Symbol.iterator in e}function nc(e){return ee(e,null)}function oc(e){return Number.isFinite(e)}function NL(e){return xn(e)&&!An(e)}function xn(e){return ee(typeof e,"object")&&!nc(e)}function Hr(e){return ee(typeof e,"string")}function LL(e){return ee(typeof e,"symbol")}function Iu(e){return ee(e,void 0)}function ee(e,r){return e===r}function vL(e,r){return e>r}function kL(e,r){return e<r}function xg(e,r){return e<=r}function Rg(e,r){return e>=r}function ML(e,r){if(ji(e)||ji(r))return BigInt(e)%BigInt(r)===0n;let n=1e-10;if(!oc(e)||_u(e)&&1/r%1===0)return!0;let o=e%r;return Math.min(Math.abs(o),Math.abs(o-r))<n}function DL(e){if(!xn(e))return!1;let r=globalThis.Object.getPrototypeOf(e);return nc(r)?!1:ee(typeof r.constructor,"function")&&!(ee(r.constructor,globalThis.Object)||ee(r.constructor.name,"Object"))}function GL(e){return ji(e)||Og(e)||nc(e)||oc(e)||Hr(e)||Iu(e)}function $L(e){return Ig(e)}function jL(e,r){return Sg(e,r)}function BL(e,r){return bg(e,r)}function qL(e,r,n){for(let o=r;o<e.length;o++)if(!n(e[o],o))return!1;return!0}function FL(e,r,n){let o=!0;for(let i=r;i<e.length;i++)n(e[i],i)||(o=!1);return o}function HL(e,r){return ee(r,"__proto__")||ee(r,"constructor")?Object.prototype.hasOwnProperty.call(e,r):r in e}function KL(e){return rc(e).map(r=>[new RegExp(`^${r}$`),e[r]])}function zL(e){return Object.entries(e)}function rc(e){return Object.getOwnPropertyNames(e)}function YL(e){return Object.getOwnPropertySymbols(e)}function VL(e){return Object.values(e)}function QL(e,r){if(!xn(r))return!1;let n=rc(e);return ee(n.length,rc(r).length)&&n.every(o=>bu(e[o],r[o]))}function WL(e,r){return An(r)&&ee(e.length,r.length)&&e.every((n,o)=>bu(e[o],r[o]))}function bu(e,r){return An(e)?WL(e,r):xn(e)?QL(e,r):ee(e,r)}var ct={};Gt(ct,{IsBigInt64Array:()=>uv,IsBigUint64Array:()=>lv,IsBoolean:()=>ZL,IsDate:()=>dv,IsFloat32Array:()=>cv,IsFloat64Array:()=>pv,IsInt16Array:()=>ov,IsInt32Array:()=>av,IsInt8Array:()=>tv,IsMap:()=>gv,IsNumber:()=>XL,IsRegExp:()=>mv,IsSet:()=>fv,IsString:()=>JL,IsTypeArray:()=>ev,IsUint16Array:()=>iv,IsUint32Array:()=>sv,IsUint8Array:()=>rv,IsUint8ClampedArray:()=>nv});function ZL(e){return e instanceof Boolean}function XL(e){return e instanceof Number}function JL(e){return e instanceof String}function ev(e){return globalThis.ArrayBuffer.isView(e)}function tv(e){return e instanceof globalThis.Int8Array}function rv(e){return e instanceof globalThis.Uint8Array}function nv(e){return e instanceof globalThis.Uint8ClampedArray}function ov(e){return e instanceof globalThis.Int16Array}function iv(e){return e instanceof globalThis.Uint16Array}function av(e){return e instanceof globalThis.Int32Array}function sv(e){return e instanceof globalThis.Uint32Array}function cv(e){return e instanceof globalThis.Float32Array}function pv(e){return e instanceof globalThis.Float64Array}function uv(e){return e instanceof globalThis.BigInt64Array}function lv(e){return e instanceof globalThis.BigUint64Array}function mv(e){return e instanceof globalThis.RegExp}function dv(e){return e instanceof globalThis.Date}function fv(e){return e instanceof globalThis.Set}function gv(e){return e instanceof globalThis.Map}function hv(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~guard")}function Tv(e){return e.map(r=>Su(r))}function Ev(e){let r={},n=Object.getOwnPropertyDescriptors(e);for(let o of Object.keys(n)){let i=n[o];s.HasPropertyKey(i,"value")&&Object.defineProperty(r,o,{...i,value:Su(i.value)})}return r}function _v(e){return new RegExp(e.source,e.flags)}function Su(e){return e instanceof RegExp?_v(e):hv(e)?e:s.IsArray(e)?Tv(e):s.IsObject(e)?Ev(e):e}function Bi(e){return Ft.clone+=1,Su(e)}var Pt={};Gt(Pt,{Get:()=>Sv,Reset:()=>Iv,Set:()=>bv});var Rn={immutableTypes:!1,maxErrors:8,useEval:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1};function Iv(){Rn.immutableTypes=!1,Rn.maxErrors=8,Rn.useEval=!0,Rn.exactOptionalPropertyTypes=!1,Rn.enumerableKind=!1}function bv(e){for(let r of s.Keys(e)){let n=e[r];n!==void 0&&Object.defineProperty(Rn,r,{value:n})}}function Sv(){return Rn}function Ov(e,r,n={}){for(let o of Object.keys(r))Object.defineProperty(e,o,{configurable:!0,writable:!0,enumerable:!1,value:r[o]});return e}function Cg(e,r){return{...e,...r}}function Av(e,r,n={}){Ft.create+=1;let o=Pt.Get(),i=Cg(r,n),a=o.enumerableKind?Cg(i,e):Ov(i,e);return o.immutableTypes?Object.freeze(a):a}function xv(e,r){Ft.discard+=1;let n={},o=Object.getOwnPropertyDescriptors(Bi(e)),i=new Set(r);for(let a of Object.keys(o))i.has(a)||Object.defineProperty(n,a,o[a]);return n}function Rv(e,r,n){Ft.update+=1;let o=Pt.Get(),i=Bi(e);for(let a of Object.keys(r))Object.defineProperty(i,a,{configurable:!0,writable:!0,enumerable:o.enumerableKind,value:r[a]});for(let a of Object.keys(n))Object.defineProperty(i,a,{configurable:!0,enumerable:!0,writable:!0,value:n[a]});return i}function S(e,r){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],r)}function A(e){return s.IsObject(e)}function Pg(e){return y.Create({"~kind":"OptionalAddAction"},{type:e},{})}function Ug(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"OptionalAddAction")&&A(e.type)}function wg(e){return y.Create({"~kind":"OptionalRemoveAction"},{type:e},{})}function Ng(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"OptionalRemoveAction")&&A(e.type)}function Lg(e){return y.Create({"~kind":"ReadonlyAddAction"},{type:e},{})}function vg(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"ReadonlyAddAction")&&A(e.type)}function kg(e){return y.Create({"~kind":"ReadonlyRemoveAction"},{type:e},{})}function Mg(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"ReadonlyRemoveAction")&&A(e.type)}function P(e,r,n){return y.Create({"~kind":"Deferred"},{action:e,parameters:r,options:n},{})}function Dg(e){return S(e,"Deferred")}function Ou(e){return y.Update(e,{"~immutable":!0},{})}function Kr(e){return Ou(e)}function Cn(e){return A(e)&&s.HasPropertyKey(e,"~immutable")}function go(e){return y.Discard(e,["~optional"])}function Et(e){return y.Update(e,{"~optional":!0},{})}function ic(e){return Et(e)}function Be(e){return A(e)&&s.HasPropertyKey(e,"~optional")}function ac(e){return y.Discard(e,["~readonly"])}function _t(e){return y.Update(e,{"~readonly":!0},{})}function sc(e){return _t(e)}function Pn(e){return A(e)&&s.HasPropertyKey(e,"~readonly")}function Ht(e,r){return y.Create({"~kind":"Array"},{type:"array",items:e},r)}function te(e){return S(e,"Array")}function cc(e){return y.Discard(e,["~kind","type","items"])}function Xt(e,r){return y.Create({"~kind":"AsyncIterator"},{type:"asyncIterator",iteratorItems:e},r)}function at(e){return S(e,"AsyncIterator")}function Gg(e){return y.Discard(e,["~kind","type","iteratorItems"])}function $g(e){return{enumerable:Pt.Get().enumerableKind,writable:!1,configurable:!1,value:e}}var pc=class{constructor(){globalThis.Object.defineProperty(this,"~kind",$g("Base")),globalThis.Object.defineProperty(this,"~guard",$g({check:r=>this.Check(r),errors:r=>this.Errors(r)}))}Check(r){return!0}Errors(r){return[]}Convert(r){return r}Clean(r){return r}Default(r){return r}Create(){throw new Error("Create not implemented")}Clone(){throw Error("Clone not implemented")}};function Ut(e){return S(e,"Base")}function zr(e,r,n={}){return y.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:r},n)}function qe(e){return S(e,"Constructor")}function jg(e){return y.Discard(e,["~kind","type","parameters","instanceType"])}function Yr(e,r,n={}){return y.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:r},n)}function Fe(e){return S(e,"Function")}function Bg(e){return y.Discard(e,["~kind","type","parameters","returnType"])}function ke(e,r){return y.Create({"~kind":"Ref"},{$ref:e},r)}function ue(e){return S(e,"Ref")}function Vr(e,r){return y.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:r})}function yo(e){return S(e,"Generic")}var qg="(?!)";function Z(e){return y.Create({"~kind":"Never"},{not:{}},e)}function hr(e){return S(e,"Never")}function Cv(){return["(not-resolvable)",Z()]}function Pv(){return["(not-generic)",Z()]}function Uv(e,r,n){return[e,Vr(r,n)]}function wv(e,r,n){return r in e?Fg(e,r,e[r],n):Cv()}function Fg(e,r,n,o){return yo(n)?Uv(r,n.parameters,n.expression):ue(n)?wv(e,n.$ref,o):Pv()}function Hg(e,r,n){return Fg(e,"(anonymous)",r,n)}function Jt(e,r,n){let o=s.Keys(e).reduce((i,a)=>({...i,[a]:y.Update(e[a],{},{$id:a})}),{});return y.Create({"~kind":"Cyclic"},{$defs:o,$ref:r},n)}function me(e){return S(e,"Cyclic")}var ie={};Gt(ie,{Match:()=>Nv});function Nv(e,r){return r[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function Je(e){return y.Create({"~kind":"Unknown"},{},e)}function It(e){return S(e,"Unknown")}function qi(...e){let[r,n]=ie.Match(e,{2:(o,i)=>[o,i,i],1:o=>[o,Je(),Je()]});return y.Create({"~kind":"Infer"},{type:"infer",name:r,extends:n},{})}function we(e){return S(e,"Infer")}function ho(e){return y.Create({"~kind":"Any"},{},e)}function pt(e){return S(e,"Any")}function Kg(e){return s.IsObjectNotArray(e)}function zg(e){return s.Keys(e).filter(n=>isNaN(n)).reduce((n,o)=>[...n,e[o]],[])}function Yg(e,r){let n=Kg(e)?zg(e):e;return y.Create({"~kind":"Enum"},{enum:n},r)}function Ne(e){return S(e,"Enum")}function wt(e,r={}){return y.Create({"~kind":"Intersect"},{allOf:e},r)}function w(e){return S(e,"Intersect")}function Vg(e){return y.Discard(e,["~kind","allOf"])}function H(){throw new Error("Unreachable")}var Wr={};Gt(Wr,{Hash:()=>Wv,HashCode:()=>ty});function Lv(e){let r=new Set,n=e;for(;n&&n!==Object.prototype;){for(let o of Reflect.ownKeys(n))o!=="constructor"&&typeof o!="symbol"&&r.add(o);n=Object.getPrototypeOf(n)}return[...r]}function vv(e){return typeof e=="number"}var ut;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})(ut||(ut={}));var To=BigInt("14695981039346656037"),[kv,Mv]=[BigInt("1099511628211"),BigInt("18446744073709551616")],Dv=Array.from({length:256}).map((e,r)=>BigInt(r)),Xg=new Float64Array(1),Jg=new DataView(Xg.buffer),ey=new Uint8Array(Xg.buffer);function et(e){To=To^Dv[e],To=To*kv%Mv}function Gv(e){et(ut.Array);for(let r of e)Qr(r)}function $v(e){et(ut.BigInt),Jg.setBigInt64(0,e);for(let r of ey)et(r)}function Wg(e){et(ut.Boolean),et(e?1:0)}function jv(e){et(ut.Constructor),Qr(e.toString())}function Bv(e){et(ut.Date),Qr(e.getTime())}function qv(e){et(ut.Function),Qr(e.toString())}function Fv(e){et(ut.Null)}function Zg(e){et(ut.Number),Jg.setFloat64(0,e,!0);for(let r of ey)et(r)}function Hv(e){et(ut.Object);for(let r of Lv(e).sort())Qr(r),Qr(e[r])}function Kv(e){et(ut.RegExp),Au(e.toString())}var zv=new TextEncoder;function Au(e){et(ut.String);for(let r of zv.encode(e))et(r)}function Yv(e){et(ut.Symbol),Qr(e.toString())}function Vv(e){et(ut.TypeArray);let r=new Uint8Array(e.buffer);for(let n=0;n<r.length;n++)et(r[n])}function Qv(e){return et(ut.Undefined)}function Qr(e){return ct.IsTypeArray(e)?Vv(e):ct.IsDate(e)?Bv(e):ct.IsRegExp(e)?Kv(e):ct.IsBoolean(e)?Wg(e.valueOf()):ct.IsString(e)?Au(e.valueOf()):ct.IsNumber(e)?Zg(e.valueOf()):vv(e)?Zg(e):s.IsArray(e)?Gv(e):s.IsBoolean(e)?Wg(e):s.IsBigInt(e)?$v(e):s.IsConstructor(e)?jv(e):s.IsNull(e)?Fv(e):s.IsObject(e)?Hv(e):s.IsString(e)?Au(e):s.IsSymbol(e)?Yv(e):s.IsUndefined(e)?Qv(e):s.IsFunction(e)?qv(e):H()}function ty(e){return To=BigInt("14695981039346656037"),Qr(e),To}function Wv(e){return ty(e).toString(16).padStart(16,"0")}function ry(e){switch(e.keyword){case"additionalProperties":return"must not have additional properties";case"anyOf":return"must match a schema in anyOf";case"boolean":return"schema is false";case"const":return"must be equal to constant";case"contains":return"must contain at least 1 valid item";case"dependencies":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"dependentRequired":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"enum":return"must be equal to one of the allowed values";case"exclusiveMaximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"exclusiveMinimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"format":return`must match format "${e.params.format}"`;case"if":return`must match "${e.params.failingKeyword}" schema`;case"maxItems":return`must not have more than ${e.params.limit} items`;case"maxLength":return`must not have more than ${e.params.limit} characters`;case"maxProperties":return`must not have more than ${e.params.limit} properties`;case"maximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"minItems":return`must not have fewer than ${e.params.limit} items`;case"minLength":return`must not have fewer than ${e.params.limit} characters`;case"minProperties":return`must not have fewer than ${e.params.limit} properties`;case"minimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"multipleOf":return`must be multiple of ${e.params.multipleOf}`;case"not":return"must not be valid";case"oneOf":return"must match exactly one schema in oneOf";case"pattern":return`must match pattern "${e.params.pattern}"`;case"propertyNames":return`property names ${e.params.propertyNames.join(", ")} are invalid`;case"required":return`must have required properties ${e.params.requiredProperties.join(", ")}`;case"type":return typeof e.params.type=="string"?`must be ${e.params.type}`:`must be either ${e.params.type.join(" or ")}`;case"unevaluatedItems":return"must not have unevaluated items";case"unevaluatedProperties":return"must not have unevaluated properties";case"uniqueItems":return"must not have duplicate items";case"~guard":return"must match check function";case"~refine":return e.params.message;default:return"an unknown validation error occurred"}}var Zv=ry;function ny(){return Zv}var Fi=class{constructor(r,n){this.type=r,this.decode=n}Encode(r){let n=this.type,o=Un(n)?c=>this.decode(n["~codec"].decode(c)):this.decode,i=Un(n)?c=>n["~codec"].encode(r(c)):r,a={decode:o,encode:i};return y.Update(this.type,{"~codec":a},{})}},Hi=class{constructor(r){this.type=r}Decode(r){return new Fi(this.type,r)}};function uc(e){return new Hi(e)}function iy(e,r){return uc(e).Decode(r).Encode(()=>{throw Error("Encode not implemented")})}function ay(e,r){return uc(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(r)}function Un(e){return A(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function Jv(e,r){let n=lc(e)?[...e["~refine"],r]:[r];return y.Update(e,{"~refine":n},{})}function sy(e,r,n="error"){return Jv(e,{refine:r,message:n})}function lc(e){return A(e)&&s.HasPropertyKey(e,"~refine")}var cy="-?(?:0|[1-9][0-9]*)n";function Ki(e){return y.Create({"~kind":"BigInt"},{type:"bigint"},e)}function At(e){return S(e,"BigInt")}function mc(e){return y.Create({"~kind":"Boolean"},{type:"boolean"},e)}function lt(e){return S(e,"Boolean")}function zi(e){return y.Create({"~kind":"Identifier"},{name:e})}function py(e){return S(e,"Identifier")}var dc="-?(?:0|[1-9][0-9]*)";function wn(e){return y.Create({"~kind":"Integer"},{type:"integer"},e)}function ze(e){return S(e,"Integer")}function er(e,r){return y.Create({"~kind":"Iterator"},{type:"iterator",iteratorItems:e},r)}function st(e){return S(e,"Iterator")}function uy(e){return y.Discard(e,["~kind","type","iteratorItems"])}var xu=class extends Error{constructor(r){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:r},writable:!1,configurable:!1,enumerable:!1})}};function ek(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new xu(e)})()}function Y(e,r){return y.Create({"~kind":"Literal"},{type:ek(e),const:e},r)}function fc(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function ly(e){return X(e)&&s.IsBigInt(e.const)}function my(e){return X(e)&&s.IsBoolean(e.const)}function Eo(e){return X(e)&&s.IsNumber(e.const)}function _o(e){return X(e)&&s.IsString(e.const)}function X(e){return S(e,"Literal")}function Zr(e){return y.Create({"~kind":"Null"},{type:"null"},e)}function tr(e){return S(e,"Null")}var gc="-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?";function Nt(e){return y.Create({"~kind":"Number"},{type:"number"},e)}function be(e){return S(e,"Number")}function Io(e){return y.Create({"~kind":"Symbol"},{type:"symbol"},e)}function rr(e){return S(e,"Symbol")}function dy(e){return s.Keys(e).filter(r=>!Be(e[r]))}function fy(e){return s.Keys(e)}function yc(e){return s.Values(e)}function tk(e,r={}){let n=dy(e),o=n.length>0?{required:n}:{};return y.Create({"~kind":"Object"},{type:"object",...o,properties:e},r)}var N=tk;function k(e){return S(e,"Object")}function gy(e){return y.Discard(e,["~kind","type","properties","required"])}function Nn(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,a],1:i=>[i,Je(),Je()]});return y.Create({"~kind":"Parameter"},{name:r,extends:n,equals:o},{})}function yy(e){return S(e,"Parameter")}function nr(e,r){return y.Create({"~kind":"Promise"},{type:"promise",item:e},r)}function tt(e){return S(e,"Promise")}function hy(e){return y.Discard(e,["~kind","type","item"])}var hc=".*";function bt(e){return y.Create({"~kind":"String"},{type:"string"},e)}function Me(e){return S(e,"String")}function St(e,r){let n="object",o={[e]:r};return y.Create({"~kind":"Record"},{type:n,patternProperties:o})}var bo=`^${dc}$`,So=`^${gc}$`,$t=`^${hc}$`;function Yi(e,r,n={}){return P("Record",[e,r],n)}function rk(e,r,n={}){return C({},Yi(e,r,n))}function Tc(e,r,n={}){return rk(e,r,n)}function Ec(e,r){return St(e,r)}function xt(e){return s.Keys(e.patternProperties)[0]}function Oo(e){let r=xt(e);return s.IsEqual(r,bo)?wn():s.IsEqual(r,So)?Nt():bt()}function rt(e){return e.patternProperties[xt(e)]}function Se(e){return S(e,"Record")}function Ln(e){return y.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function Xr(e){return S(e,"Rest")}function _c(e){return y.Create({"~kind":"This"},{$ref:"#"},e)}function Ty(e){return S(e,"This")}function Ye(e,r={}){let[n,o,i]=[e,e.length,!1];return y.Create({"~kind":"Tuple"},{type:"array",additionalItems:i,items:n,minItems:o},r)}function V(e){return S(e,"Tuple")}function Ey(e){return y.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Ao(e){return y.Create({"~kind":"Undefined"},{type:"undefined"},e)}function or(e){return S(e,"Undefined")}function B(e,r={}){return y.Create({"~kind":"Union"},{anyOf:e},r)}function O(e){return S(e,"Union")}function _y(e){return y.Discard(e,["~kind","anyOf"])}function Iy(e){return y.Create({"~kind":"Unsafe"},{},e)}function by(e){return S(e,"Unsafe")}function Ic(e){return y.Create({"~kind":"Void"},{type:"void"},e)}function Rt(e){return S(e,"Void")}function ok(e,r){return s.IsEqual(e,"Array")?Ht(r[0]):s.IsEqual(e,"AsyncIterator")?Xt(r[0]):s.IsEqual(e,"Iterator")?er(r[0]):s.IsEqual(e,"Promise")?nr(r[0]):s.IsEqual(e,"Awaited")?ma(r[0]):s.IsEqual(e,"Capitalize")?Qi(r[0]):s.IsEqual(e,"ConstructorParameters")?ea(r[0]):s.IsEqual(e,"Evaluate")?Cu(r[0]):s.IsEqual(e,"Exclude")?ta(r[0],r[1]):s.IsEqual(e,"Extract")?ra(r[0],r[1]):s.IsEqual(e,"Index")?Co(r[0],r[1]):s.IsEqual(e,"InstanceType")?na(r[0]):s.IsEqual(e,"Lowercase")?Wi(r[0]):s.IsEqual(e,"NonNullable")?oa(r[0]):s.IsEqual(e,"Omit")?ia(r[0],r[1]):s.IsEqual(e,"Options")?Uo(r[0],r[1]):s.IsEqual(e,"Parameters")?aa(r[0]):s.IsEqual(e,"Partial")?sa(r[0]):s.IsEqual(e,"Pick")?ca(r[0],r[1]):s.IsEqual(e,"Readonly")?pa(r[0]):s.IsEqual(e,"KeyOf")?Po(r[0]):s.IsEqual(e,"Record")?Yi(r[0],r[1]):s.IsEqual(e,"Required")?ua(r[0]):s.IsEqual(e,"ReturnType")?la(r[0]):s.IsEqual(e,"Uncapitalize")?Zi(r[0]):s.IsEqual(e,"Uppercase")?Xi(r[0]):bc(ke(e),r)}function vn(){throw Error("Unreachable")}var ik=(e,r=[])=>e.reduce((n,o)=>s.IsArray(o)&&s.IsEqual(o.length,2)?[...n,o[0]]:[...n,o],[]),Tr=e=>{let[r,n]=e;return ik([...r,...n])};function Ry(e){return Nn(e[0],e[2],e[4])}function Cy(e){return Nn(e[0],e[2],e[2])}function Py(e){return Nn(e[0],Je(),e[2])}function Uy(e){return Nn(e,Je(),Je())}function wy(e){return Tr(e)}function Ny(e){return e[1]}function Ly(e){return Tr(e)}function vy(e){return e[1]}function ky(e){return ok(e[0],e[1])}function My(e){return null}function Dy(e){return bt()}function Gy(e){return Nt()}function $y(e){return mc()}function jy(e){return Ao()}function By(e){return Zr()}function qy(e){return wn()}function Fy(e){return Ki()}function Hy(e){return Je()}function Ky(e){return ho()}function zy(e){return N({})}function Yy(e){return Z()}function Vy(e){return Io()}function Qy(e){return Ic()}function Wy(e){return _c()}function Zy(e){return e[1]}function Xy(e){return Y(e)}function Jy(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function eh(e){return e[1]}function th(e){return Vi(e)}function rh(e){return Y(BigInt(e))}function nh(e){return Y(s.IsEqual(e,"true"))}function oh(e){return Y(parseFloat(e))}function ih(e){return Y(e)}function ah(e){return e.length>0}function sh(e){return e.reduce((r,n)=>s.IsEqual(n.length,3)?[...r,[n[1]]]:[...r,[]],[])}function ch(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function ph(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}var Sy=(e,r)=>r.reduceRight((n,o)=>{let i=o;return s.IsEqual(i.length,1)?Co(n,i[0]):s.IsEqual(i.length,0)?Ht(n):vn()},e),Oy=(e,r)=>s.IsEqual(r.length,3)?Ji(e,r[0],r[1],r[2]):e;function uh(e){let[r,n,o,i]=e;return Oy(r?Po(Sy(n,o)):Sy(n,o),i)}function Ru(e,r){return s.IsEqual(r.length,3)?(()=>{let[n,o,i]=r,a=Ru(o,i);if(s.IsEqual(n,"&"))return w(a)?wt([e,...a.allOf]):wt([e,a]);if(s.IsEqual(n,"|"))return O(a)?B([e,...a.anyOf]):B([e,a]);vn()})():e}function lh(e){let[r,n]=e;return Ru(r,n)}function mh(e){let[r,n]=e;return Ru(r,n)}function dh(e){return Ou(e[1])}function fh(e){return e[1]}function gh(e){return Vr(e[0],e[2])}function yh(e){return s.IsEqual(e.length,4)?qi(e[1],e[3]):s.IsEqual(e.length,2)?qi(e[1],Je()):vn()}function hh(e){return`${e}`}function Th(e){return ze(e[3])?bo:be(e[3])?So:rr(e[3])?$t:Me(e[3])?$t:vn()}function Eh(e){return e.length>0}function _h(e){return e.length>0}function Ih(e){let[r,n,o,i,a]=e;return{[n]:r&&o?_t(Et(a)):r&&!o?_t(a):!r&&o?Et(a):a}}function bh(e){return Tr(e)}function Sh(e){return e.reduce((r,n)=>s.HasPropertyKey(n,bo)||s.HasPropertyKey(n,So)||s.HasPropertyKey(n,$t)?[r[0],y.Assign(r[1],n)]:[y.Assign(r[0],n),r[1]],[{},{}])}function Oh(e){return Sh(e[1])}function Ah(e){let[r,n]=e,o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return N(r,o)}function xh(e){return s.IsEqual(e.length,5)?_t(Et(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?_t(e[3]):Et(e[3]):vn()}function Rh(e){return _t(Et(e[1]))}function Ch(e){return _t(e[1])}function Ph(e){return Et(e[0])}function Uh(e){return s.IsEqual(e.length,2)?Ln(e[1]):s.IsEqual(e.length,1)?e[0]:vn()}function wh(e){return Tr(e)}function Nh(e){return Ye(e[1])}function Lh(e){return _t(Et(e[4]))}function vh(e){return _t(e[3])}function kh(e){return Et(e[3])}function Mh(e){return e[2]}function Dh(e){return s.IsEqual(e.length,2)?Ln(e[1]):s.IsEqual(e.length,1)?e[0]:vn()}function Gh(e){return Tr(e)}function $h(e){return Yr(e[1],e[4])}function jh(e){return zr(e[2],e[5])}function Ay(e,r){return s.IsEqual(e,"remove")?kg(r):s.IsEqual(e,"add")?Lg(r):r}function Bh(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function xy(e,r){return s.IsEqual(e,"remove")?wg(r):s.IsEqual(e,"add")?Pg(r):r}function qh(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function Fh(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function Hh(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?xo(zi(e[3]),e[5],e[6][0],Ay(e[1],xy(e[8],e[10]))):xo(zi(e[3]),e[5],ke(e[3]),Ay(e[1],xy(e[8],e[10])))}function Kh(e){return ke(e)}function zh(e){return Uo(e[2],e[4])}function Yh(e){return parseFloat(e)}function Vh(e){return s.IsEqual(e,"true")}function Qh(e){return null}function Wh(e){return{[e[0]]:e[2]}}function Zh(e){return Tr(e)}function ak(e){return e.reduce((r,n)=>y.Assign(r,n),{})}function Xh(e){return ak(e[1])}function Jh(e){return Tr(e)}function eT(e){return e[1]}function tT(e){return Ki()}function rT(e){return bt()}function nT(e){return Nt()}function oT(e){return wn()}function iT(e){return Z()}function aT(e){return Y(e)}function sT(e){return B(e[1])}function cT(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function pT(e){return[e[0],...e[1]]}function uT(e){return e[1]}function lT(e){return Tr(e)}function mT(e){return s.IsEqual(e.length,2)?e[1]:[]}function dT(e){let r=e[2],n=e[3],[o,i]=e[4],a=s.IsEqual(s.Keys(i).length,0)?{}:{patternProperties:i};return{[e[1]]:Vr(r,Ro(n,o,a))}}function fT(e){let r=e[2],[n,o]=e[3],i=s.IsEqual(s.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:Ro(r,n,i)}}function gT(e){return{[e[1]]:Vr(e[2],e[4])}}function yT(e){return{[e[1]]:e[3]}}function hT(e){return null}function TT(e){return Sh(Tr(e))}function ET(e){return e[1]}function _T(e){let r=e[0],n=e[1];return Pu(y.Assign(r,n[0]))}function pe(e){return An(e)&&ee(e.length,2)}function pk(e,r){return ee(r.indexOf(e),0)?[e,r.slice(e.length)]:[]}function He(e,r){let[n,...o]=e;return Hr(n)?(()=>{let i=pk(n,r);return ee(i.length,2)?i:He(o,r)})():[]}function Uu(e,r){return Array.from({length:r-e+1},(n,o)=>String.fromCharCode(e+o))}var IT=[...Uu(97,122),...Uu(65,90)],wu="0",Nu=Uu(49,57),wo=[wu,...Nu],bT=" ",No=`
|
|
37
|
+
`;var Jr="_",Sc=".",ST="$",Oc="-";var OT="//",AT="/*",lk="*/";function xT(e){let r=e.indexOf(lk);return ee(r,-1)?"":e.slice(r+2)}function RT(e){let r=e.indexOf(No);return ee(r,-1)?"":e.slice(r)}function mk(e){return e.replace(/^[ \t\r\f\v]+/,"")}function Ac(e){let r=mk(e);return r.startsWith(AT)?Ac(xT(r.slice(2))):r.startsWith(OT)?Ac(RT(r.slice(2))):r}function Ot(e){let r=e.trimStart();return r.startsWith(AT)?Ot(xT(r.slice(2))):r.startsWith(OT)?Ot(RT(r.slice(2))):r}function dk(e,r){return e.includes(r)}function Lo(e,r,n,o=""){let i=He(e,n);return pe(i)?dk(r,i[0])?Lo(e,r,i[1],o):Lo(e,r,i[1],`${o}${i[0]}`):[o,n]}function xc(e,r){let n=He([e],r);return pe(n)?n:["",r]}function fk(e){return xc(Oc,e)}function gk(e){return He(Nu,e)}var yk=[...wo,Jr];function hk(e){return Lo(yk,[Jr],e)}function Tk(e){let r=fk(e);return pe(r)?(()=>{let n=He([wu],r[1]);return pe(n)?[`${r[0]}${n[0]}`,n[1]]:(()=>{let o=gk(r[1]);return pe(o)?(()=>{let i=hk(o[1]);return pe(i)?[`${r[0]}${o[0]}${i[0]}`,i[1]]:[]})():[]})()})():[]}function Rc(e){return Tk(Ot(e))}function Ek(e){let r=Rc(e);return pe(r)?(()=>{let n=He(["n"],r[1]);return pe(n)?[`${r[0]}`,n[1]]:[]})():[]}function CT(e){return Ek(e)}function Lu(e,r){return He([e],r)}function h(e,r){return ee(e,"")?["",r]:e.startsWith(No)?Lu(e,Ac(r)):e.startsWith(bT)?Lu(e,r):Lu(e,Ot(r))}var PT=[...IT,Jr,ST];function _k(e){return He(PT,e)}var Ik=[...PT,...wo];function UT(e,r=""){let n=He(Ik,e);return pe(n)?UT(n[1],`${r}${n[0]}`):[r,e]}function bk(e){let r=_k(e);return pe(r)?(()=>{let n=UT(r[1]);return pe(n)?[`${r[0]}${n[0]}`,n[1]]:[]})():[]}function Oe(e){return bk(Ot(e))}var Sk=[...wo,Jr];function Ok(e){return xc(Oc,e)}function Ak(e){return pe(He([Sc],e))}function wT(e){let r=Lo(Sk,[Jr],e);return pe(r)?ee(r[0],"")?[]:[r[0],r[1]]:[]}function xk(e,r){let n=He([Sc],r);return pe(n)?(()=>{let o=wT(n[1]);return pe(o)?[`${e}0${n[0]}${o[0]}`,o[1]]:[]})():[]}function Rk(e,r){let n=Rc(r);return pe(n)?(()=>{let o=He([Sc],n[1]);return pe(o)?(()=>{let i=wT(o[1]);return pe(i)?[`${e}${n[0]}${o[0]}${i[0]}`,i[1]]:[`${e}${n[0]}`,o[1]]})():[`${e}${n[0]}`,n[1]]})():[]}function Ck(e){let r=Ok(e);return pe(r)?Ak(r[1])?xk(r[0],r[1]):Rk(r[0],r[1]):[]}function Cc(e){return Ck(Ot(e))}function NT(e,r){let[n,...o]=e;return Hr(n)?r.startsWith(n)?!0:NT(o,r):!1}function en(e,r,n=""){return ee(r,"")?[]:NT(e,r)?[n,r]:(()=>{let[o,i]=[r.slice(0,1),r.slice(1)];return en(e,i,`${n}${o}`)})()}function Pk(e,r,n){return n.startsWith(e)?(()=>{let o=en([r],n.slice(e.length));return pe(o)?o[1].startsWith(r)?[`${o[0]}`,o[1].slice(r.length)]:[]:[]})():[]}function Uk(e,r,n){return n.startsWith(e)?(()=>{let o=en([No,r],n.slice(e.length));return pe(o)?o[1].startsWith(r)?[`${o[0]}`,o[1].slice(r.length)]:[]:[]})():[]}function LT(e,r,n,o){return n?Pk(e,r,Ot(o)):Uk(e,r,Ot(o))}function wk(e,r){return He(e,r)}function Nk(e,r){return LT(e,e,!1,r)}function Lk(e,r){let n=wk(e,r);return pe(n)?Nk(n[0],`${n[0]}${n[1]}`):[]}function Pc(e,r){return Lk(e,Ot(r))}function vT(e,r){let n=en(e,r);return pe(n)?ee(n[0],"")?[]:n:[]}var u=(e,r,n=()=>[])=>e.length===2?r(e):n(),kk=e=>u(u(Oe(e),([r,n])=>u(h("extends",n),([o,i])=>u(J(i),([a,c])=>u(h("=",c),([l,d])=>u(J(d),([f,g])=>[[r,o,a,l,f],g]))))),([r,n])=>[Ry(r),n]),Mk=e=>u(u(Oe(e),([r,n])=>u(h("extends",n),([o,i])=>u(J(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[Cy(r),n]),Dk=e=>u(u(Oe(e),([r,n])=>u(h("=",n),([o,i])=>u(J(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[Py(r),n]),Gk=e=>u(Oe(e),([r,n])=>[Uy(r),n]),DT=e=>u(u(kk(e),([r,n])=>[r,n],()=>u(Mk(e),([r,n])=>[r,n],()=>u(Dk(e),([r,n])=>[r,n],()=>u(Gk(e),([r,n])=>[r,n],()=>[])))),([r,n])=>[r,n]),GT=(e,r=[])=>u(u(DT(e),([n,o])=>u(h(",",o),([i,a])=>[[n,i],a])),([n,o])=>GT(o,[...r,n]),()=>[r,e]),$k=e=>u(u(GT(e),([r,n])=>u(u(u(DT(n),([o,i])=>[[o],i]),([o,i])=>[o,i],()=>u([[],n],([o,i])=>[o,i],()=>[])),([o,i])=>[[r,o],i])),([r,n])=>[wy(r),n]),Mu=e=>u(u(h("<",e),([r,n])=>u($k(n),([o,i])=>u(h(">",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[Ny(r),n]),$T=(e,r=[])=>u(u(J(e),([n,o])=>u(h(",",o),([i,a])=>[[n,i],a])),([n,o])=>$T(o,[...r,n]),()=>[r,e]),jk=e=>u(u($T(e),([r,n])=>u(u(u(J(n),([o,i])=>[[o],i]),([o,i])=>[o,i],()=>u([[],n],([o,i])=>[o,i],()=>[])),([o,i])=>[[r,o],i])),([r,n])=>[Ly(r),n]),Bk=e=>u(u(h("<",e),([r,n])=>u(jk(n),([o,i])=>u(h(">",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[vy(r),n]),qk=e=>u(u(Oe(e),([r,n])=>u(Bk(n),([o,i])=>[[r,o],i])),([r,n])=>[ky(r),n]),jT=e=>u(u(u(h(";",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[My(r),n]),BT=e=>u(h("string",e),([r,n])=>[Dy(r),n]),qT=e=>u(h("number",e),([r,n])=>[Gy(r),n]),Fk=e=>u(h("boolean",e),([r,n])=>[$y(r),n]),Hk=e=>u(h("undefined",e),([r,n])=>[jy(r),n]),Kk=e=>u(h("null",e),([r,n])=>[By(r),n]),FT=e=>u(h("integer",e),([r,n])=>[qy(r),n]),zk=e=>u(h("bigint",e),([r,n])=>[Fy(r),n]),Yk=e=>u(h("unknown",e),([r,n])=>[Hy(r),n]),Vk=e=>u(h("any",e),([r,n])=>[Ky(r),n]),Qk=e=>u(h("object",e),([r,n])=>[zy(r),n]),Wk=e=>u(h("never",e),([r,n])=>[Yy(r),n]),HT=e=>u(h("symbol",e),([r,n])=>[Vy(r),n]),Zk=e=>u(h("void",e),([r,n])=>[Qy(r),n]),Xk=e=>u(h("this",e),([r,n])=>[Wy(r),n]),Jk=e=>u(u(BT(e),([r,n])=>[r,n],()=>u(qT(e),([r,n])=>[r,n],()=>u(Fk(e),([r,n])=>[r,n],()=>u(Hk(e),([r,n])=>[r,n],()=>u(Kk(e),([r,n])=>[r,n],()=>u(FT(e),([r,n])=>[r,n],()=>u(zk(e),([r,n])=>[r,n],()=>u(Yk(e),([r,n])=>[r,n],()=>u(Vk(e),([r,n])=>[r,n],()=>u(Qk(e),([r,n])=>[r,n],()=>u(Wk(e),([r,n])=>[r,n],()=>u(HT(e),([r,n])=>[r,n],()=>u(Zk(e),([r,n])=>[r,n],()=>u(Xk(e),([r,n])=>[r,n],()=>[])))))))))))))),([r,n])=>[r,n]),eM=e=>u(u(h("${",e),([r,n])=>u(J(n),([o,i])=>u(h("}",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[Zy(r),n]),vu=e=>u(en(["${","`"],e),([r,n])=>[Xy(r),n]),KT=e=>u(u(u(vu(e),([r,n])=>u(eM(n),([o,i])=>u(KT(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u(u(vu(e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u(u(vu(e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[]))),([r,n])=>[Jy(r),n]),Du=e=>u(u(h("`",e),([r,n])=>u(KT(n),([o,i])=>u(h("`",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[eh(r),n]),tM=e=>u(Du(e),([r,n])=>[th(r),n]),rM=e=>u(CT(e),([r,n])=>[rh(r),n]),nM=e=>u(u(h("true",e),([r,n])=>[r,n],()=>u(h("false",e),([r,n])=>[r,n],()=>[])),([r,n])=>[nh(r),n]),oM=e=>u(Cc(e),([r,n])=>[oh(r),n]),iM=e=>u(Pc(["'",'"'],e),([r,n])=>[ih(r),n]),aM=e=>u(u(rM(e),([r,n])=>[r,n],()=>u(nM(e),([r,n])=>[r,n],()=>u(oM(e),([r,n])=>[r,n],()=>u(iM(e),([r,n])=>[r,n],()=>[])))),([r,n])=>[r,n]),sM=e=>u(u(u(h("keyof",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[ah(r),n]),zT=(e,r=[])=>u(u(u(h("[",e),([n,o])=>u(J(o),([i,a])=>u(h("]",a),([c,l])=>[[n,i,c],l]))),([n,o])=>[n,o],()=>u(u(h("[",e),([n,o])=>u(h("]",o),([i,a])=>[[n,i],a])),([n,o])=>[n,o],()=>[])),([n,o])=>zT(o,[...r,n]),()=>[r,e]),cM=e=>u(zT(e),([r,n])=>[sh(r),n]),pM=e=>u(u(u(h("extends",e),([r,n])=>u(J(n),([o,i])=>u(h("?",i),([a,c])=>u(J(c),([l,d])=>u(h(":",d),([f,g])=>u(J(g),([T,_])=>[[r,o,a,l,f,T],_])))))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[ch(r),n]),uM=e=>u(u(u(h("(",e),([r,n])=>u(J(n),([o,i])=>u(h(")",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u(Jk(e),([r,n])=>[r,n],()=>u(bM(e),([r,n])=>[r,n],()=>u(CM(e),([r,n])=>[r,n],()=>u(tM(e),([r,n])=>[r,n],()=>u(aM(e),([r,n])=>[r,n],()=>u(vM(e),([r,n])=>[r,n],()=>u(LM(e),([r,n])=>[r,n],()=>u(GM(e),([r,n])=>[r,n],()=>u(jM(e),([r,n])=>[r,n],()=>u(qk(e),([r,n])=>[r,n],()=>u($M(e),([r,n])=>[r,n],()=>[])))))))))))),([r,n])=>[ph(r),n]),YT=e=>u(u(sM(e),([r,n])=>u(uM(n),([o,i])=>u(cM(i),([a,c])=>u(pM(c),([l,d])=>[[r,o,a,l],d])))),([r,n])=>[uh(r),n]),VT=e=>u(u(u(h("&",e),([r,n])=>u(YT(n),([o,i])=>u(VT(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[r,n]),QT=e=>u(u(YT(e),([r,n])=>u(VT(n),([o,i])=>[[r,o],i])),([r,n])=>[lh(r),n]),WT=e=>u(u(u(h("|",e),([r,n])=>u(QT(n),([o,i])=>u(WT(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[r,n]),Uc=e=>u(u(QT(e),([r,n])=>u(WT(n),([o,i])=>[[r,o],i])),([r,n])=>[mh(r),n]),lM=e=>u(u(h("readonly",e),([r,n])=>u(Uc(n),([o,i])=>[[r,o],i])),([r,n])=>[dh(r),n]),mM=e=>u(u(h("|",e),([r,n])=>u(Uc(n),([o,i])=>[[r,o],i])),([r,n])=>[fh(r),n]),dM=e=>u(u(Mu(e),([r,n])=>u(h("=",n),([o,i])=>u(J(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[gh(r),n]),fM=e=>u(u(u(h("infer",e),([r,n])=>u(Oe(n),([o,i])=>u(h("extends",i),([a,c])=>u(Uc(c),([l,d])=>[[r,o,a,l],d])))),([r,n])=>[r,n],()=>u(u(h("infer",e),([r,n])=>u(Oe(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>[])),([r,n])=>[yh(r),n]),J=e=>u(u(fM(e),([r,n])=>[r,n],()=>u(mM(e),([r,n])=>[r,n],()=>u(lM(e),([r,n])=>[r,n],()=>u(Uc(e),([r,n])=>[r,n],()=>[])))),([r,n])=>[r,n]),gM=e=>u(Cc(e),([r,n])=>[hh(r),n]),yM=e=>u(Oe(e),([r,n])=>[r,n]),hM=e=>u(Pc(["'",'"'],e),([r,n])=>[r,n]),TM=e=>u(u(h("[",e),([r,n])=>u(Oe(n),([o,i])=>u(h(":",i),([a,c])=>u(u(FT(c),([l,d])=>[l,d],()=>u(qT(c),([l,d])=>[l,d],()=>u(BT(c),([l,d])=>[l,d],()=>u(HT(c),([l,d])=>[l,d],()=>[])))),([l,d])=>u(h("]",d),([f,g])=>[[r,o,a,l,f],g]))))),([r,n])=>[Th(r),n]),ZT=e=>u(u(gM(e),([r,n])=>[r,n],()=>u(yM(e),([r,n])=>[r,n],()=>u(hM(e),([r,n])=>[r,n],()=>u(TM(e),([r,n])=>[r,n],()=>[])))),([r,n])=>[r,n]),EM=e=>u(u(u(h("readonly",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[Eh(r),n]),_M=e=>u(u(u(h("?",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[_h(r),n]),XT=e=>u(u(EM(e),([r,n])=>u(ZT(n),([o,i])=>u(_M(i),([a,c])=>u(h(":",c),([l,d])=>u(J(d),([f,g])=>[[r,o,a,l,f],g]))))),([r,n])=>[Ih(r),n]),JT=e=>u(u(u(h(",",e),([r,n])=>u(h(`
|
|
38
38
|
`,n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(h(";",e),([r,n])=>u(h(`
|
|
39
39
|
`,n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(h(",",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u(u(h(";",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u(u(h(`
|
|
40
|
-
`,e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[]))))),([r,n])=>[r,n]),
|
|
40
|
+
`,e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[]))))),([r,n])=>[r,n]),eE=(e,r=[])=>u(u(XT(e),([n,o])=>u(JT(o),([i,a])=>[[n,i],a])),([n,o])=>eE(o,[...r,n]),()=>[r,e]),IM=e=>u(u(eE(e),([r,n])=>u(u(u(XT(n),([o,i])=>[[o],i]),([o,i])=>[o,i],()=>u([[],n],([o,i])=>[o,i],()=>[])),([o,i])=>[[r,o],i])),([r,n])=>[bh(r),n]),Gu=e=>u(u(h("{",e),([r,n])=>u(IM(n),([o,i])=>u(h("}",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[Oh(r),n]),bM=e=>u(Gu(e),([r,n])=>[Ah(r),n]),SM=e=>u(u(u(Oe(e),([r,n])=>u(h("?",n),([o,i])=>u(h(":",i),([a,c])=>u(h("readonly",c),([l,d])=>u(J(d),([f,g])=>[[r,o,a,l,f],g]))))),([r,n])=>[r,n],()=>u(u(Oe(e),([r,n])=>u(h(":",n),([o,i])=>u(h("readonly",i),([a,c])=>u(J(c),([l,d])=>[[r,o,a,l],d])))),([r,n])=>[r,n],()=>u(u(Oe(e),([r,n])=>u(h("?",n),([o,i])=>u(h(":",i),([a,c])=>u(J(c),([l,d])=>[[r,o,a,l],d])))),([r,n])=>[r,n],()=>u(u(Oe(e),([r,n])=>u(h(":",n),([o,i])=>u(J(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>[])))),([r,n])=>[xh(r),n]),OM=e=>u(u(h("readonly",e),([r,n])=>u(J(n),([o,i])=>u(h("?",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[Rh(r),n]),AM=e=>u(u(h("readonly",e),([r,n])=>u(J(n),([o,i])=>[[r,o],i])),([r,n])=>[Ch(r),n]),xM=e=>u(u(J(e),([r,n])=>u(h("?",n),([o,i])=>[[r,o],i])),([r,n])=>[Ph(r),n]),kT=e=>u(u(SM(e),([r,n])=>[r,n],()=>u(OM(e),([r,n])=>[r,n],()=>u(AM(e),([r,n])=>[r,n],()=>u(xM(e),([r,n])=>[r,n],()=>u(J(e),([r,n])=>[r,n],()=>[]))))),([r,n])=>[r,n]),tE=e=>u(u(u(h("...",e),([r,n])=>u(kT(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(kT(e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[])),([r,n])=>[Uh(r),n]),rE=(e,r=[])=>u(u(tE(e),([n,o])=>u(h(",",o),([i,a])=>[[n,i],a])),([n,o])=>rE(o,[...r,n]),()=>[r,e]),RM=e=>u(u(rE(e),([r,n])=>u(u(u(tE(n),([o,i])=>[[o],i]),([o,i])=>[o,i],()=>u([[],n],([o,i])=>[o,i],()=>[])),([o,i])=>[[r,o],i])),([r,n])=>[wh(r),n]),CM=e=>u(u(h("[",e),([r,n])=>u(RM(n),([o,i])=>u(h("]",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[Nh(r),n]),PM=e=>u(u(Oe(e),([r,n])=>u(h("?",n),([o,i])=>u(h(":",i),([a,c])=>u(h("readonly",c),([l,d])=>u(J(d),([f,g])=>[[r,o,a,l,f],g]))))),([r,n])=>[Lh(r),n]),UM=e=>u(u(Oe(e),([r,n])=>u(h(":",n),([o,i])=>u(h("readonly",i),([a,c])=>u(J(c),([l,d])=>[[r,o,a,l],d])))),([r,n])=>[vh(r),n]),wM=e=>u(u(Oe(e),([r,n])=>u(h("?",n),([o,i])=>u(h(":",i),([a,c])=>u(J(c),([l,d])=>[[r,o,a,l],d])))),([r,n])=>[kh(r),n]),NM=e=>u(u(Oe(e),([r,n])=>u(h(":",n),([o,i])=>u(J(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[Mh(r),n]),MT=e=>u(u(PM(e),([r,n])=>[r,n],()=>u(UM(e),([r,n])=>[r,n],()=>u(wM(e),([r,n])=>[r,n],()=>u(NM(e),([r,n])=>[r,n],()=>[])))),([r,n])=>[r,n]),nE=e=>u(u(u(h("...",e),([r,n])=>u(MT(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(MT(e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[])),([r,n])=>[Dh(r),n]),oE=(e,r=[])=>u(u(nE(e),([n,o])=>u(h(",",o),([i,a])=>[[n,i],a])),([n,o])=>oE(o,[...r,n]),()=>[r,e]),iE=e=>u(u(oE(e),([r,n])=>u(u(u(nE(n),([o,i])=>[[o],i]),([o,i])=>[o,i],()=>u([[],n],([o,i])=>[o,i],()=>[])),([o,i])=>[[r,o],i])),([r,n])=>[Gh(r),n]),LM=e=>u(u(h("(",e),([r,n])=>u(iE(n),([o,i])=>u(h(")",i),([a,c])=>u(h("=>",c),([l,d])=>u(J(d),([f,g])=>[[r,o,a,l,f],g]))))),([r,n])=>[$h(r),n]),vM=e=>u(u(h("new",e),([r,n])=>u(h("(",n),([o,i])=>u(iE(i),([a,c])=>u(h(")",c),([l,d])=>u(h("=>",d),([f,g])=>u(J(g),([T,_])=>[[r,o,a,l,f,T],_])))))),([r,n])=>[jh(r),n]),kM=e=>u(u(u(h("+",e),([r,n])=>u(h("readonly",n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(h("-",e),([r,n])=>u(h("readonly",n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(h("readonly",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])))),([r,n])=>[Bh(r),n]),MM=e=>u(u(u(h("+",e),([r,n])=>u(h("?",n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(h("-",e),([r,n])=>u(h("?",n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(h("?",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])))),([r,n])=>[qh(r),n]),DM=e=>u(u(u(h("as",e),([r,n])=>u(J(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[Fh(r),n]),GM=e=>u(u(h("{",e),([r,n])=>u(kM(n),([o,i])=>u(h("[",i),([a,c])=>u(Oe(c),([l,d])=>u(h("in",d),([f,g])=>u(J(g),([T,_])=>u(DM(_),([se,ge])=>u(h("]",ge),([jr,mo])=>u(MM(mo),([Br,GN])=>u(h(":",GN),([$N,jN])=>u(J(jN),([BN,qN])=>u(jT(qN),([FN,HN])=>u(h("}",HN),([KN,zN])=>[[r,o,a,l,f,T,se,jr,Br,$N,BN,FN,KN],zN]))))))))))))),([r,n])=>[Hh(r),n]),$M=e=>u(Oe(e),([r,n])=>[Kh(r),n]),jM=e=>u(u(h("Options",e),([r,n])=>u(h("<",n),([o,i])=>u(J(i),([a,c])=>u(h(",",c),([l,d])=>u(cE(d),([f,g])=>u(h(">",g),([T,_])=>[[r,o,a,l,f,T],_])))))),([r,n])=>[zh(r),n]),BM=e=>u(Cc(e),([r,n])=>[Yh(r),n]),qM=e=>u(u(h("true",e),([r,n])=>[r,n],()=>u(h("false",e),([r,n])=>[r,n],()=>[])),([r,n])=>[Vh(r),n]),FM=e=>u(Pc(['"',"'"],e),([r,n])=>[r,n]),HM=e=>u(h("null",e),([r,n])=>[Qh(r),n]),aE=e=>u(u(ZT(e),([r,n])=>u(h(":",n),([o,i])=>u($u(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[Wh(r),n]),sE=(e,r=[])=>u(u(aE(e),([n,o])=>u(JT(o),([i,a])=>[[n,i],a])),([n,o])=>sE(o,[...r,n]),()=>[r,e]),KM=e=>u(u(sE(e),([r,n])=>u(u(u(aE(n),([o,i])=>[[o],i]),([o,i])=>[o,i],()=>u([[],n],([o,i])=>[o,i],()=>[])),([o,i])=>[[r,o],i])),([r,n])=>[Zh(r),n]),cE=e=>u(u(h("{",e),([r,n])=>u(KM(n),([o,i])=>u(h("}",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[Xh(r),n]),pE=(e,r=[])=>u(u($u(e),([n,o])=>u(h(",",o),([i,a])=>[[n,i],a])),([n,o])=>pE(o,[...r,n]),()=>[r,e]),zM=e=>u(u(pE(e),([r,n])=>u(u(u($u(n),([o,i])=>[[o],i]),([o,i])=>[o,i],()=>u([[],n],([o,i])=>[o,i],()=>[])),([o,i])=>[[r,o],i])),([r,n])=>[Jh(r),n]),YM=e=>u(u(h("[",e),([r,n])=>u(zM(n),([o,i])=>u(h("]",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[eT(r),n]),$u=e=>u(u(BM(e),([r,n])=>[r,n],()=>u(qM(e),([r,n])=>[r,n],()=>u(FM(e),([r,n])=>[r,n],()=>u(HM(e),([r,n])=>[r,n],()=>u(cE(e),([r,n])=>[r,n],()=>u(YM(e),([r,n])=>[r,n],()=>[])))))),([r,n])=>[r,n]),VM=e=>u(h("-?(?:0|[1-9][0-9]*)n",e),([r,n])=>[tT(r),n]),QM=e=>u(h(".*",e),([r,n])=>[rT(r),n]),WM=e=>u(h("-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?",e),([r,n])=>[nT(r),n]),ZM=e=>u(h("-?(?:0|[1-9][0-9]*)",e),([r,n])=>[oT(r),n]),XM=e=>u(h("(?!)",e),([r,n])=>[iT(r),n]),JM=e=>u(vT(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([r,n])=>[aT(r),n]),e0=e=>u(u(VM(e),([r,n])=>[r,n],()=>u(QM(e),([r,n])=>[r,n],()=>u(WM(e),([r,n])=>[r,n],()=>u(ZM(e),([r,n])=>[r,n],()=>u(XM(e),([r,n])=>[r,n],()=>u(t0(e),([r,n])=>[r,n],()=>u(JM(e),([r,n])=>[r,n],()=>[]))))))),([r,n])=>[r,n]),t0=e=>u(u(h("(",e),([r,n])=>u(ju(n),([o,i])=>u(h(")",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[sT(r),n]),uE=e=>u(u(u(ku(e),([r,n])=>u(h("|",n),([o,i])=>u(uE(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u(u(ku(e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[]))),([r,n])=>[cT(r),n]),ku=e=>u(u(e0(e),([r,n])=>u(ju(n),([o,i])=>[[r,o],i])),([r,n])=>[pT(r),n]),ju=e=>u(u(uE(e),([r,n])=>[r,n],()=>u(ku(e),([r,n])=>[r,n],()=>[])),([r,n])=>[r,n]),lE=e=>u(u(h("^",e),([r,n])=>u(ju(n),([o,i])=>u(h("$",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[uT(r),n]),mE=(e,r=[])=>u(u(J(e),([n,o])=>u(h(",",o),([i,a])=>[[n,i],a])),([n,o])=>mE(o,[...r,n]),()=>[r,e]),r0=e=>u(u(mE(e),([r,n])=>u(u(u(J(n),([o,i])=>[[o],i]),([o,i])=>[o,i],()=>u([[],n],([o,i])=>[o,i],()=>[])),([o,i])=>[[r,o],i])),([r,n])=>[lT(r),n]),dE=e=>u(u(u(h("extends",e),([r,n])=>u(r0(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[mT(r),n]),n0=e=>u(u(h("interface",e),([r,n])=>u(Oe(n),([o,i])=>u(Mu(i),([a,c])=>u(dE(c),([l,d])=>u(Gu(d),([f,g])=>[[r,o,a,l,f],g]))))),([r,n])=>[dT(r),n]),o0=e=>u(u(h("interface",e),([r,n])=>u(Oe(n),([o,i])=>u(dE(i),([a,c])=>u(Gu(c),([l,d])=>[[r,o,a,l],d])))),([r,n])=>[fT(r),n]),i0=e=>u(u(h("type",e),([r,n])=>u(Oe(n),([o,i])=>u(Mu(i),([a,c])=>u(h("=",c),([l,d])=>u(J(d),([f,g])=>[[r,o,a,l,f],g]))))),([r,n])=>[gT(r),n]),a0=e=>u(u(h("type",e),([r,n])=>u(Oe(n),([o,i])=>u(h("=",i),([a,c])=>u(J(c),([l,d])=>[[r,o,a,l],d])))),([r,n])=>[yT(r),n]),s0=e=>u(u(u(h("export",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[hT(r),n]),c0=e=>u(u(u(h(";",e),([r,n])=>u(h(`
|
|
41
41
|
`,n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(h(";",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u(u(h(`
|
|
42
|
-
`,e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[]))),([r,n])=>[r,n]),nE=(e,r=[])=>u(u(Lu(e),([n,o])=>u($M(o),([i,a])=>[[n,i],a])),([n,o])=>nE(o,[...r,n]),()=>[r,e]),jM=e=>u(u(nE(e),([r,n])=>u(u(u(Lu(n),([o,i])=>[[o],i]),([o,i])=>[o,i],()=>u([[],n],([o,i])=>[o,i],()=>[])),([o,i])=>[[r,o],i])),([r,n])=>[sT(r),n]),Lu=e=>u(u(GM(e),([r,n])=>u(u(vM(n),([o,i])=>[o,i],()=>u(kM(n),([o,i])=>[o,i],()=>u(MM(n),([o,i])=>[o,i],()=>u(DM(n),([o,i])=>[o,i],()=>[])))),([o,i])=>u(PT(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[cT(r),n]),qM=e=>u(u(Lu(e),([r,n])=>u(jM(n),([o,i])=>[[r,o],i])),([r,n])=>[pT(r),n]),oE=e=>u(u(qM(e),([r,n])=>[r,n],()=>u(Hk(e),([r,n])=>[r,n],()=>u(J(e),([r,n])=>[r,n],()=>[]))),([r,n])=>[r,n]);function iE(e){let r=Pu(`\`${e}\``);return s.IsEqual(r.length,2)?r[0]:H()}function Ki(e,r={}){return P("TemplateLiteral",[e],r)}function aE(e){return C({},Ki(e,{}))}function FM(e){let r=iE(e);return aE(r)}function sE(e,r={}){let n=s.IsString(e)?FM(e):aE(e);return y.Update(n,{},r)}function we(e){return S(e,"TemplateLiteral")}var L={};Mt(L,{ExtendsFalse:()=>F,ExtendsTrue:()=>x,ExtendsUnion:()=>vu,IsExtendsFalse:()=>HM,IsExtendsTrue:()=>pE,IsExtendsTrueLike:()=>Ae,IsExtendsUnion:()=>cE});function vu(e){return y.Create({"~kind":"ExtendsUnion"},{inferred:e})}function cE(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsUnion")&&s.IsObject(e.inferred)}function x(e){return y.Create({"~kind":"ExtendsTrue"},{inferred:e})}function pE(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsTrue")&&s.IsObject(e.inferred)}function F(){return y.Create({"~kind":"ExtendsFalse"},{})}function HM(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function Ae(e){return cE(e)||pE(e)}function Rc(e){let r=eE(e);return s.IsEqual(r.length,2)?r[0]:H()}function KM(e){return!0}function uE(e){let[r,...n]=e;return A(r)?zM(r)?uE(n):!1:!0}function lE(e){return s.IsEqual(e.length,0)?!1:uE(e)}function zM(e){return O(e)?lE(e.anyOf):X(e)?KM(e.const):!1}function Cc(e){return lE(e)}function mE(e,r,n=[]){let[o,...i]=e;return s.IsString(o)?mE(i,r,[...n,`${o}${r}`]):n}function YM(e,r){return s.IsEqual(e.length,0)?[`${r}`]:mE(e,r)}function dE(e,r,n=[]){let[o,...i]=r;return A(o)?dE(e,i,[...n,...fE(e,o)]):n}function fE(e,r){return O(r)?dE(e,r.anyOf):X(r)?YM(e,r.const):H()}function gE(e,r){let[n,...o]=r;return A(n)?gE(fE(e,n),o):e}function VM(e){return e.map(r=>Y(r))}function QM(e){let r=gE([],e),n=VM(r);return q(n)}function WM(e){return s.IsEqual(e.length,0)?H():s.IsEqual(e.length,1)&&X(e[0])?e[0]:QM(e)}function nt(e){let r=Rc(e);return Cc(r)?WM(r):bt()}function ZM(e){return s.IsString(e)||s.IsNumber(e)?Y(e):s.IsNull(e)?Zr():Z()}function Ft(e){return e.map(n=>ZM(n))}function ua(e){let r=Ft(e);return q(r)}function kn(e){return ua(e.enum)}function XM(e,r,n,o){let i=re(e,n,o);return Ae(i)?x(y.Assign(y.Assign(e,i.inferred),{[r]:n})):F()}function JM(e,r){return x(e)}function e0(e,r,n){let o=ua(n);return re(e,r,o)}function yE(e,r,n){let[o,...i]=n;return A(o)?(()=>{let a=re(e,r,o);return Ae(a)?yE(a.inferred,r,i):F()})():x(e)}function t0(e,r,n){let o=nt(n);return re(e,r,o)}function hE(e,r,n){let[o,...i]=n;return A(o)?(()=>{let a=re(e,r,o);return Ae(a)?x(a.inferred):hE(e,r,i)})():F()}function K(e,r,n){return pt(n)?JM(e,r):Ue(n)?e0(e,r,n.enum):Pe(n)?XM(e,n.name,r,n.extends):w(n)?yE(e,r,n.allOf):we(n)?t0(e,r,n.pattern):O(n)?hE(e,r,n.anyOf):It(n)?x(e):F()}function TE(e,r,n){return Pe(n)?K(e,r,n):pt(n)?x(e):It(n)?x(e):vu(e)}function r0(e,r){let n=Cn(e),o=Cn(r);return n&&o||!n&&o?!0:!(n&&!o)}function EE(e,r,n,o){return te(o)?r0(r,o)?re(e,n,o.items):F():K(e,r,o)}function _E(e,r,n){return at(n)?re(e,r,n.iteratorItems):K(e,Xt(r),n)}function IE(e,r,n){return At(n)?x(e):K(e,r,n)}function bE(e,r,n){return lt(n)?x(e):K(e,r,n)}function n0(e,r,n,o,i){let a=Pe(o)?r:o,c=Pe(o)?o:r,l=Ge(r),d=Ge(o),f=re(e,a,c);return!l&&d?F():Ae(f)?la(f.inferred,n,i):F()}function o0(e,r,n,o){let[i,...a]=o;return A(i)?n0(e,r,n,i,a):Ge(r)?x(e):F()}function i0(e,r,n){let[o,...i]=r;return A(o)?o0(e,o,i,n):x(e)}function la(e,r,n){return i0(e,r,n)}function Pc(e,r,n){return Rt(n)?x(e):re(e,r,n)}function SE(e,r,n,o){return $e(o)?(()=>{let i=la(e,r,o.parameters);return Ae(i)?Pc(i.inferred,n,o.instanceType):F()})():F()}function OE(e,r,n){return re(e,kn(r),n)}function AE(e,r,n,o){return je(o)?(()=>{let i=la(e,r,o.parameters);return Ae(i)?Pc(i.inferred,n,o.returnType):F()})():F()}function xE(e,r,n){return He(n)?x(e):be(n)?x(e):K(e,r,n)}var ma="equal",a0="disjoint",da="left-inside",fa="right-inside";function ga(e,r){let n=[It(e)?L.ExtendsFalse():ot({},e,r),It(e)?L.ExtendsTrue({}):ot({},r,e)];return L.IsExtendsTrueLike(n[0])&&L.IsExtendsTrueLike(n[1])?ma:L.IsExtendsTrueLike(n[0])&&L.IsExtendsFalse(n[1])?da:L.IsExtendsFalse(n[0])&&L.IsExtendsTrueLike(n[1])?fa:a0}function s0(e){return O(e)?ir(e.anyOf):[e]}function ir(e){return e.reduce((r,n)=>[...r,...s0(n)],[])}function ku(e){return e.reduceRight((n,o,i)=>({[i]:o,...n}),{})}function RE(e){let r=ku(e.items);return N(r)}function c0(e,r){return Pn(e)?!!Pn(r):!1}function p0(e,r){return Ge(e)?!!Ge(r):!1}function u0(e,r){let n=c0(e,r),o=p0(e,r),i=Ne([e,r]),a=rc(go(i));return n&&o?_t(Et(a)):n&&!o?_t(a):!n&&o?Et(a):a}function l0(e,r,n){return n in e?n in r?u0(e[n],r[n]):e[n]:n in r?r[n]:Z()}function m0(e,r){return[...new Set([...s.Keys(r),...s.Keys(e)])].reduce((o,i)=>({...o,[i]:l0(e,r,i)}),{})}function CE(e){return k(e)?e.properties:V(e)?ku(e.items):H()}function PE(e,r){let n=CE(e),o=CE(r),i=m0(n,o);return N(i)}function UE(e,r){let n=ga(e,r);return s.IsEqual(n,da)?e:s.IsEqual(n,fa)||s.IsEqual(n,ma)?r:Z()}function wE(e){return k(e)||V(e)}function NE(e){return w(e)?Ne(e.allOf):e}function d0(e,r){let n=NE(e),o=NE(r),i=wE(n),a=wE(o);return i&&a?PE(tn(n),o):i&&!a?tn(n):!i&&a?o:UE(tn(n),o)}function LE(e,r,n=[]){let[o,...i]=r;return s.IsUndefined(o)?n.length===0?[e]:n:LE(e,i,[...n,d0(e,o)])}function vE(e,r,n=[]){let[o,...i]=e;return A(o)?vE(i,r,[...n,...ya([o],r)]):n}function ya(e,r=[]){let[n,...o]=e;return A(n)?O(n)?ya(o,vE(n.anyOf,r)):ya(o,LE(n,r)):r}function Ne(e){let r=ya(e);return Mu(r)}function Er(e){return Mu(e)}function tn(e){return w(e)?Ne(e.allOf):O(e)?Er(e.anyOf):e}function Mn(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?Z():q(e)}function f0(e,r){return r.filter(n=>ga(e,n)!==fa)}function g0(e,r){let n=r.some(o=>{let i=ga(e,o);return s.IsEqual(i,da)||s.IsEqual(i,ma)});return s.IsEqual(n,!1)}function y0(e,r){let n=tn(e);return pt(n)?[n]:g0(n,r)?[...f0(n,r),n]:r}function Du(e,r=[]){let[n,...o]=e;return A(n)?k(n)?Du(o,[...r,n]):Du(o,y0(n,r)):r}function Mu(e){let r=Du(e),n=ir(r);return n.length===0?Z():n.length===1?n[0]:q(n)}function h0(e,r,n,o){let i=I(e,r,n);return y.Update(tn(i),{},o)}function kE(e,r,n,o){return h0(e,r,n,o)}function ME(e,r,n){let o=Ne(r);return re(e,o,n)}function DE(e,r,n){return st(n)?re(e,r,n.iteratorItems):K(e,er(r),n)}function Uc(e,r,n){return r===n?x(e):F()}function T0(e,r,n){return X(n)?Uc(e,r,n.const):At(n)?x(e):K(e,Y(r),n)}function E0(e,r,n){return X(n)?Uc(e,r,n.const):lt(n)?x(e):K(e,Y(r),n)}function _0(e,r,n){return X(n)?Uc(e,r,n.const):be(n)?x(e):K(e,Y(r),n)}function I0(e,r,n){return X(n)?Uc(e,r,n.const):ve(n)?x(e):K(e,Y(r),n)}function GE(e,r,n){return s.IsBigInt(r.const)?T0(e,r.const,n):s.IsBoolean(r.const)?E0(e,r.const,n):s.IsNumber(r.const)?_0(e,r.const,n):s.IsString(r.const)?I0(e,r.const,n):H()}function $E(e,r,n){return Pe(n)?K(e,r,n):x(e)}function jE(e,r,n){return tr(n)?x(e):K(e,r,n)}function qE(e,r,n){return be(n)?x(e):K(e,r,n)}function b0(e,r,n){return Ge(r)?Ge(n)?x(e):F():x(e)}function S0(e,r,n){return Pe(n)&&hr(n.extends)?F():(()=>{let o=re(e,r,n);return Ae(o)?b0(o.inferred,r,n):F()})()}function O0(e,r){return e.reduce((n,o)=>o in r?Ae(r[o])?{...n,...r[o].inferred}:H():H(),{})}function A0(e,r,n){let o={};for(let c of s.Keys(n))o[c]=c in r?S0({},r[c],n[c]):Ge(n[c])?Pe(n[c])?x(y.Assign(e,{[n[c].name]:n[c].extends})):x(e):F();let i=s.Values(o).every(c=>Ae(c)),a=i?O0(s.Keys(o),o):{};return i?x(a):F()}function x0(e,r,n){let o=A0(e,r,n);return Ae(o)?x(y.Assign(e,o.inferred)):F()}function R0(e,r,n){return x0(e,r,n)}function BE(e,r,n){return k(n)?R0(e,r,n.properties):K(e,N(r),n)}function FE(e,r,n){return tt(n)?re(e,r,n.item):K(e,nr(r),n)}function HE(e,r,n){return ve(n)?x(e):K(e,r,n)}function KE(e,r,n){return rr(n)?x(e):K(e,r,n)}function zE(e,r,n){let o=nt(r);return re(e,o,n)}function Gu(e,r){return y.Create({"~kind":"Inferrable"},{name:e,type:r},{})}function ha(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"name")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"Inferrable")&&s.IsString(e.name)&&s.IsObject(e.type)}function $u(e){return Xr(e)?Pe(e.items)?te(e.items.extends)?Gu(e.items.name,e.items.extends.items):It(e.items.extends)?Gu(e.items.name,e.items.extends):void 0:H():void 0}function wc(e){return Pe(e)?Gu(e.name,e.extends):void 0}function ju(e,r,n=[]){let[o,...i]=e;return A(o)?(()=>{let a=re({},o,r);return Ae(a)?ju(i,r,[...n,o]):void 0})():n}function YE(e,r,n,o){let i=ju(n,o);return s.IsArray(i)?x(y.Assign(e,{[r]:Ke(i)})):F()}function Nc(e,r,n,o){let i=ju(n,o);return s.IsArray(i)?x(y.Assign(e,{[r]:q(i)})):F()}function C0(e){return[...e].reverse()}function qu(e,r){return r?C0(e):e}function P0(e){let r=e.length>0?e[0]:void 0,n=A(r)?$u(r):void 0;return A(n)}function U0(e,r,n,o,i,a){let c=re(e,n,i);return Ae(c)?VE(c.inferred,r,o,a):F()}function w0(e,r,n,o,i){let a=$u(o);return ha(a)?YE(e,a.name,qu(n,r),a.type):(()=>{let[c,...l]=n;return A(c)?U0(e,r,c,l,o,i):F()})()}function N0(e,r,n,o){let[i,...a]=o;return A(i)?w0(e,r,n,i,a):s.IsEqual(n.length,0)?x(e):F()}function VE(e,r,n,o){return N0(e,r,n,o)}function L0(e,r,n){let o=Lc(e,{callstack:[]},n),i=P0(o);return VE(e,i,qu(r,i),qu(o,i))}function QE(e,r,n){let o=wc(n);return ha(o)?Nc(e,o.name,r,o.type):(()=>{let[i,...a]=r;return A(i)?(()=>{let c=re(e,i,n);return Ae(c)?QE(c.inferred,a,n):F()})():x(e)})()}function WE(e,r,n){let o=Lc(e,{callstack:[]},r);return V(n)?L0(e,o,n.items):te(n)?QE(e,o,n.items):K(e,Ke(o),n)}function ZE(e,r,n){return Rt(n)?x(e):or(n)?x(e):K(e,r,n)}function XE(e,r,n){let[o,...i]=n;return A(o)?(()=>{let a=re(e,r,o);return Ae(a)?x(a.inferred):XE(e,r,i)})():F()}function Bu(e,r,n){let[o,...i]=r;return A(o)?(()=>{let a=XE(e,o,n);return Ae(a)?Bu(a.inferred,i,n):F()})():x(e)}function JE(e,r,n){let o=wc(n);return ha(o)?Nc(e,o.name,r,o.type):O(n)?Bu(e,r,n.anyOf):Bu(e,r,[n])}function e_(e,r,n){return Pe(n)?K(e,r,n):pt(n)?x(e):It(n)?x(e):F()}function t_(e,r,n){return Rt(n)?x(e):K(e,r,n)}function re(e,r,n){return pt(r)?TE(e,r,n):te(r)?EE(e,r,r.items,n):at(r)?_E(e,r.iteratorItems,n):At(r)?IE(e,r,n):lt(r)?bE(e,r,n):$e(r)?SE(e,r.parameters,r.instanceType,n):Ue(r)?OE(e,r,n):je(r)?AE(e,r.parameters,r.returnType,n):He(r)?xE(e,r,n):w(r)?ME(e,r.allOf,n):st(r)?DE(e,r.iteratorItems,n):X(r)?GE(e,r,n):hr(r)?$E(e,r,n):tr(r)?jE(e,r,n):be(r)?qE(e,r,n):k(r)?BE(e,r.properties,n):tt(r)?FE(e,r.item,n):ve(r)?HE(e,r,n):rr(r)?KE(e,r,n):we(r)?zE(e,r.pattern,n):V(r)?WE(e,r.items,n):or(r)?ZE(e,r,n):O(r)?JE(e,r.anyOf,n):It(r)?e_(e,r,n):Rt(r)?t_(e,r,n):F()}function Ro(e,r,n={}){return P("Interface",[e,r],n)}function vo(e){return A(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function r_(e,r,n={}){return C({},Ro(e,r,n))}function v0(e,r,n){return e.includes(n)?!0:rn([...e,n],r,r[n])}function n_(e,r,n){let o=mc(n);return Dn(e,r,o)}function Dn(e,r,n){let[o,...i]=n;return A(o)?rn(e,r,o)?!0:Dn(e,r,i):!1}function rn(e,r,n){return pe(n)?v0(e,r,n.$ref):te(n)?rn(e,r,n.items):at(n)?rn(e,r,n.iteratorItems):$e(n)?Dn(e,r,[...n.parameters,n.instanceType]):je(n)?Dn(e,r,[...n.parameters,n.returnType]):vo(n)?n_(e,r,n.parameters[1]):w(n)?Dn(e,r,n.allOf):st(n)?rn(e,r,n.iteratorItems):k(n)?n_(e,r,n.properties):tt(n)?rn(e,r,n.item):O(n)?Dn(e,r,n.anyOf):V(n)?Dn(e,r,n.items):Se(n)?rn(e,r,rt(n)):!1}function vc(e,r,n){return rn(e,r,n)}function k0(e,r){return r.reduce((n,o)=>o in e?vc([o],e,e[o])?[...n,o]:n:H(),[])}function o_(e){let r=ny(e);return k0(e,r)}function M0(e,r,n){return n.includes(r)?n:r in e?nn(e,e[r],[...n,r]):H()}function i_(e,r,n){let o=mc(r);return ko(e,o,n)}function ko(e,r,n){return r.reduce((o,i)=>nn(e,i,o),n)}function nn(e,r,n){return pe(r)?M0(e,r.$ref,n):te(r)?nn(e,r.items,n):at(r)?nn(e,r.iteratorItems,n):$e(r)?ko(e,[...r.parameters,r.instanceType],n):je(r)?ko(e,[...r.parameters,r.returnType],n):vo(r)?i_(e,r.parameters[1],n):w(r)?ko(e,r.allOf,n):st(r)?nn(e,r.iteratorItems,n):k(r)?i_(e,r.properties,n):tt(r)?nn(e,r.item,n):O(r)?ko(e,r.anyOf,n):V(r)?ko(e,r.items,n):Se(r)?nn(e,rt(r),n):n}function a_(e,r,n){return nn(e,n,[r])}function D0(e){return ho()}function G0(e){return s.Keys(e).reduce((r,n)=>({...r,[n]:ar(e[n])}),{})}function Ta(e){return e.reduce((r,n)=>[...r,ar(n)],[])}function ar(e){return pe(e)?D0(e.$ref):te(e)?Bt(ar(e.items),oc(e)):at(e)?Xt(ar(e.iteratorItems)):$e(e)?zr(Ta(e.parameters),ar(e.instanceType)):je(e)?Yr(Ta(e.parameters),ar(e.returnType)):w(e)?wt(Ta(e.allOf)):st(e)?er(ar(e.iteratorItems)):k(e)?N(G0(e.properties)):tt(e)?nr(ar(e.item)):Se(e)?fc(Oo(e),ar(rt(e))):O(e)?q(Ta(e.anyOf)):V(e)?Ke(Ta(e.items)):e}function $0(e,r){return r in e?ar(e[r]):Je()}function s_(e){return $0(e.$defs,e.$ref)}function j0(e,r,n){let o=Ct(e,{callstack:[]},r),i=Ea({},{callstack:[]},n);return Ne([...o,N(i)])}function q0(e,r){return s.Keys(e).filter(o=>r.includes(o)).reduce((o,i)=>{let a=e[i],c=vo(a)?j0(e,a.parameters[0],a.parameters[1]):a;return{...o,[i]:c}},{})}function c_(e,r,n){let o=a_(e,r,n),i=q0(e,o);return Jt(i,r)}function p_(e,r){return r in e?pe(e[r])?p_(e,e[r].$ref):e[r]:Z()}function sr(e,r){return p_(e,r)}function u_(e){return me(e)?s_(e):e}function ot(e,r,n){let o=u_(r),i=u_(n);return re(e,o,i)}function B0(e,r,n){if(Pe(r)||Mo(r)||L.IsExtendsTrueLike(ot({},r,n)))return;let o={parameter:e,extends:n,received:r};throw new Error("Generic argument does not satify constraint",{cause:o})}function l_(e,r,n,o,i){let a=I(e,r,i);return B0(n,a,o),y.Assign(e,{[n]:a})}function F0(e,r,n,o,i){let a=I(e,r,n.extends),c=I(e,r,n.equals),[l,...d]=i;return A(l)?Fu(l_(e,r,n.name,a,l),r,o,d):Fu(l_(e,r,n.name,a,c),r,o,[])}function Fu(e,r,n,o){let[i,...a]=n;return A(i)?F0(e,r,i,a,o):e}function m_(e,r,n,o){return Fu(e,r,n,o)}function H0(e){return s.IsGreaterThan(e.length,0)?e[0]:""}function d_(e,r,n,o){let i=Ct(e,r,o);return Tc(n,i)}function K0(e,r,n,o){return d_(e,r,Le(n),o)}function z0(e,r,n,o,i,a){let c=Ct(e,r,a),l=m_(e,r,o,c),d=I(l,{callstack:[...r.callstack,n]},i);return I(e,r,d)}function kc(e,r,n,o){let[i,a]=Lg(e,n,o);return yo(a)?s.IsEqual(H0(r.callstack),i)?K0(e,r,i,o):z0(e,r,i,a.parameters,a.expression,o):d_(e,r,n,o)}function Tc(e,r){return y.Create({"~kind":"Call"},{target:e,arguments:r},{})}function f_(e,r){return kc({},{callstack:[]},e,r)}function Mo(e){return S(e,"Call")}function g_(e){return tt(e)?g_(e.item):e}function Y0(e,r,n,o){let i=I(e,r,n);return y.Update(g_(i),{},o)}function y_(e,r,n,o){return v(e,[n])?Y0(e,r,n,o):pa(n,o)}function h_(e,r){return e(r)}function T_(e,r){return s.IsString(r)?Y(h_(e,r)):Y(r)}function E_(e,r){let n=nt(r);return _r(e,n)}function __(e,r){let n=r.map(o=>_r(e,o));return q(n)}function _r(e,r){return X(r)?T_(e,r.const):we(r)?E_(e,r.pattern):O(r)?__(e,r.anyOf):r}function zi(e,r={}){return P("Capitalize",[e],r)}function I_(e,r={}){return C({},zi(e,r))}function Yi(e,r={}){return P("Lowercase",[e],r)}function b_(e,r={}){return C({},Yi(e,r))}function Vi(e,r={}){return P("Uncapitalize",[e],r)}function S_(e,r={}){return C({},Vi(e,r))}function Qi(e,r={}){return P("Uppercase",[e],r)}function O_(e,r={}){return C({},Qi(e,r))}var V0=e=>e[0].toUpperCase()+e.slice(1),Q0=e=>e.toLowerCase(),W0=e=>e[0].toLowerCase()+e.slice(1),Z0=e=>e.toUpperCase();function X0(e,r,n,o){let i=I(e,r,n);return y.Update(_r(V0,i),{},o)}function A_(e,r,n,o){return v(e,[n])?X0(e,r,n,o):zi(n,o)}function J0(e,r,n,o){let i=I(e,r,n);return y.Update(_r(Q0,i),{},o)}function x_(e,r,n,o){return v(e,[n])?J0(e,r,n,o):Yi(n,o)}function eD(e,r,n,o){let i=I(e,r,n);return y.Update(_r(W0,i),{},o)}function R_(e,r,n,o){return v(e,[n])?eD(e,r,n,o):Vi(n,o)}function tD(e,r,n,o){let i=I(e,r,n);return y.Update(_r(Z0,i),{},o)}function C_(e,r,n,o){return v(e,[n])?tD(e,r,n,o):Qi(n,o)}function Wi(e,r,n,o,i={}){return P("Conditional",[e,r,n,o],i)}function P_(e,r,n,o,i={}){return C({},Wi(e,r,n,o,i))}function rD(e,r,n,o,i,a,c){let l=I(e,r,n),d=I(e,r,o),f=ot(e,l,d);return y.Update(L.IsExtendsUnion(f)?q([I(f.inferred,r,i),I(e,r,a)]):L.IsExtendsTrue(f)?I(f.inferred,r,i):I(e,r,a),{},c)}function U_(e,r,n,o,i,a,c){return v(e,[n,o])?rD(e,r,n,o,i,a,c):Wi(n,o,i,a,c)}function Zi(e,r={}){return P("ConstructorParameters",[e],r)}function w_(e,r={}){return C({},Zi(e,r))}function nD(e){return $e(e)?I({},{callstack:[]},Ke(e.parameters)):Z()}function oD(e,r,n,o){let i=I(e,r,n);return y.Update(nD(i),{},o)}function N_(e,r,n,o){return v(e,[n])?oD(e,r,n,o):Zi(n,o)}function Xi(e,r,n={}){return P("Exclude",[e,r],n)}function L_(e,r,n={}){return C({},Xi(e,r,n))}function v_(e,r){return e.reduce((n,o)=>[...n,...k_(o,r)],[])}function k_(e,r){let n=ot({},e,r);return L.IsExtendsTrueLike(n)?[]:[e]}function iD(e,r){let n=Ue(e)?v_(Ft(e.enum),r):O(e)?v_(ir(e.anyOf),r):k_(e,r);return Er(n)}function aD(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(iD(a,c),{},i)}function Mc(e,r,n,o,i){return v(e,[n,o])?aD(e,r,n,o,i):Xi(n,o,i)}function Ji(e,r,n={}){return P("Extract",[e,r],n)}function M_(e,r,n={}){return C({},Ji(e,r,n))}function D_(e,r){return e.reduce((n,o)=>[...n,...G_(o,r)],[])}function G_(e,r){let n=ot({},e,r);return L.IsExtendsTrueLike(n)?[e]:[]}function sD(e,r){let n=Ue(e)?D_(Ft(e.enum),r):O(e)?D_(ir(e.anyOf),r):G_(e,r);return Er(n)}function cD(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(sD(a,c),{},i)}function $_(e,r,n,o,i){return v(e,[n,o])?cD(e,r,n,o,i):Ji(n,o,i)}var pD=new RegExp("^(?:0|[1-9][0-9]*)$");function Do(e){let r=`${e}`;return pD.test(r)?parseInt(r):e}function uD(e){return Y(Do(e))}function j_(e){return e.map(r=>q_(r))}function q_(e){return w(e)?wt(j_(e.allOf)):O(e)?q(j_(e.anyOf)):X(e)?uD(e.const):e}function B_(e,r){let n=q_(r),o=ot({},n,Nt());return L.IsExtendsTrueLike(o)?e:Z()}function F_(e,r){let n=sr(e,r);return cr(n)}function Dc(e){return e.reduce((r,n)=>[...r,...cr(n)],[])}function H_(e){let r=Ft(e);return Dc(r)}function K_(e){let r=Ne(e);return cr(r)}function z_(e){return[`${e}`]}function Y_(e){let r=nt(e);return cr(r)}function cr(e){return me(e)?F_(e.$defs,e.$ref):Ue(e)?H_(e.enum):w(e)?K_(e.allOf):X(e)?z_(e.const):we(e)?Y_(e.pattern):O(e)?Dc(e.anyOf):[]}function Go(e){return cr(e)}function lD(e,r){return r in e?[e[r]]:[]}function mD(e,r){return r.reduce((n,o)=>[...n,...lD(e,o)],[])}function V_(e,r){let n=Go(r),o=mD(e,n);return Er(o)}function dD(e){return Y(Do(e))}function Q_(e){return e.map(r=>Hu(r))}function Hu(e){return w(e)?wt(Q_(e.allOf)):O(e)?q(Q_(e.anyOf)):X(e)?dD(e.const):e}function fD(e,r){return e.reduceRight((n,o,i)=>{let a=ot({},Y(i),r);return L.IsExtendsTrueLike(a)?[o,...n]:n},[])}function gD(e,r){let n=Hu(r),o=fD(e,n);return Mn(o)}function yD(e){return Mn(e)}function W_(e,r){return be(r)||He(r)?yD(e):gD(e,r)}function hD(e){return e.reduce((r,n)=>uc(n)?[...r,Y(n)]:r,[])}function $o(e){let r=hD(e);return q(r)}function Co(e,r,n={}){return P("Index",[e,r],n)}function Z_(e,r,n={}){let o=s.IsArray(r)?$o(r):r;return C({},Co(e,o,n))}function X_(e,r){let n=sr(e,r);return Ht(n)}function TD(e,r){let n=s.Keys(e).filter(g=>!s.HasPropertyKey(r,g)),o=s.Keys(r).filter(g=>!s.HasPropertyKey(e,g)),i=s.Keys(e).filter(g=>s.HasPropertyKey(r,g)),a=n.reduce((g,T)=>({...g,[T]:e[T]}),{}),c=o.reduce((g,T)=>({...g,[T]:r[T]}),{}),l=i.reduce((g,T)=>({...g,[T]:Ne([e[T],r[T]])}),{}),d=y.Assign(a,c);return y.Assign(d,l)}function J_(e){return e.reduce((r,n)=>TD(r,Ht(n)),{})}function eI(e){let r=RE(Ke(e));return Ht(r)}function ED(e,r){return s.Keys(e).filter(i=>i in r).reduce((i,a)=>({...i,[a]:Er([e[a],r[a]])}),{})}function tI(e,r){let[n,...o]=e;return A(n)?tI(o,ED(r,Ht(n))):r}function rI(e){let[r,...n]=e;return A(r)?tI(n,Ht(r)):H()}function Ht(e){return me(e)?X_(e.$defs,e.$ref):w(e)?J_(e.allOf):O(e)?rI(e.anyOf):V(e)?eI(e.items):k(e)?e.properties:{}}function jo(e){let r=Ht(e);return N(r)}function _D(e){return me(e)||w(e)||O(e)?jo(e):e}function ID(e,r){let n=_D(e);return te(n)?B_(n.items,r):k(n)?V_(n.properties,r):V(n)?W_(n.items,r):Z()}function bD(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(ID(a,c),{},i)}function nI(e,r,n,o,i){return v(e,[n,o])?bD(e,r,n,o,i):Co(n,o,i)}function ea(e,r={}){return P("InstanceType",[e],r)}function oI(e,r={}){return C({},ea(e,r))}function SD(e){return $e(e)?e.instanceType:Z()}function OD(e,r,n,o){let i=I(e,r,n);return y.Update(SD(i),{},o)}function iI(e,r,n,o={}){return v(e,[n])?OD(e,r,n,o):ea(n,o)}function AD(e,r,n,o,i){let a=Ct(e,{callstack:[]},n),c=Ea(e,{callstack:[]},o),l=Ne([...a,N(c)]);return y.Update(l,{},i)}function aI(e,r,n,o,i){return v(e,n)?AD(e,r,n,o,i):Ro(n,o,i)}function Po(e,r={}){return P("KeyOf",[e],r)}function sI(e,r={}){return C({},Po(e,r))}function cI(){return q([Nt(),bt(),Io()])}function pI(e){return Nt()}function xD(e){return e.reduce((n,o)=>uc(o)?[...n,Y(Do(o))]:H(),[])}function uI(e){let r=s.Keys(e),n=xD(r);return Mn(n)}function lI(e){return Oo(e)}function mI(e){let r=e.map((n,o)=>Y(o));return Mn(r)}function RD(e){return me(e)||w(e)||O(e)?jo(e):e}function CD(e){let r=RD(e);return pt(r)?cI():te(r)?pI(r.items):k(r)?uI(r.properties):Se(r)?lI(r):V(r)?mI(r.items):Z()}function PD(e,r,n,o){let i=I(e,r,n);return y.Update(CD(i),{},o)}function dI(e,r,n,o){return v(e,[n])?PD(e,r,n,o):Po(n,o)}function UD(e){let r=nt(e);return Ku(r)}function fI(e){return e.reduce((r,n)=>[...r,...Ku(n)],[])}function Ku(e){return Ue(e)?fI(Ft(e.enum)):_o(e)||Eo(e)?[e]:we(e)?UD(e.pattern):O(e)?fI(e.anyOf):[]}function gI(e){return Ku(e)}function xo(e,r,n,o,i={}){return P("Mapped",[e,r,n,o],i)}function yI(e,r,n,o,i={}){return C({},xo(e,r,n,o,i))}function wD(e,r,n,o,i){let a=y.Assign(e,{[n.name]:o}),c=I(a,r,i);return we(c)?nt(c.pattern):c}function ND(e,r,n,o,i){let a=y.Assign(e,{[n.name]:o});return I(a,r,i)}function LD(e,r,n,o,i,a){let c=ND(e,r,n,o,a),l=wD(e,r,n,o,i);return _o(l)||Eo(l)?{[l.const]:c}:{}}function vD(e,r,n,o,i,a){return o.reduce((c,l)=>({...c,...LD(e,r,n,l,i,a)}),{})}function kD(e,r,n,o,i,a){let c=gI(o),l=vD(e,r,n,c,i,a);return N(l)}function MD(e,r,n,o,i,a,c){let l=I(e,r,o);return y.Update(kD(e,r,n,l,i,a),{},c)}function hI(e,r,n,o,i,a,c){return v(e,[o])?MD(e,r,n,o,i,a,c):xo(n,o,i,a,c)}function DD(e,r){return s.Keys(e).filter(o=>r.includes(o)).reduce((o,i)=>({...o,[i]:c_(e,i,e[i])}),{})}function GD(e,r){return s.Keys(e).filter(o=>!r.includes(o)).reduce((o,i)=>({...o,[i]:I(e,{callstack:[]},e[i])}),{})}function $D(e,r){let n=o_(e),o=DD(e,n),i=GD(e,n),a={...o,...i};return y.Update(a,{},r)}function TI(e,r,n,o){let i=y.Assign(e,n);return $D(i,o)}function ta(e,r={}){return P("NonNullable",[e],r)}function EI(e,r={}){return C({},ta(e,r))}function jD(e){let r=q([Zr(),Ao()]);return Mc({},{callstack:[]},e,r,{})}function qD(e,r,n,o){let i=I(e,r,n);return y.Update(jD(i),{},o)}function _I(e,r,n,o){return v(e,[n])?qD(e,r,n,o):ta(n,o)}function Gc(e){let r=jo(e);return k(r)?r.properties:H()}function ra(e,r,n={}){return P("Omit",[e,r],n)}function II(e,r,n={}){let o=s.IsArray(r)?$o(r):r;return C({},ra(e,o,n))}function BD(e,r){return s.Keys(e).reduce((o,i)=>r.includes(i)?o:{...o,[i]:e[i]},{})}function FD(e,r){let n=Gc(e),o=Go(r),i=BD(n,o);return N(i)}function HD(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(FD(a,c),{},i)}function bI(e,r,n,o,i){return v(e,[n,o])?HD(e,r,n,o,i):ra(n,o,i)}function Uo(e,r){return P("Options",[e,r],{})}function $c(e,r){return C({},Uo(e,r))}function KD(e,r,n,o){let i=I(e,r,n);return y.Update(i,{},o)}function SI(e,r,n,o){return v(e,[n])?KD(e,r,n,o):Uo(n,o)}function na(e,r={}){return P("Parameters",[e],r)}function OI(e,r={}){return C({},na(e,r))}function zD(e){return je(e)?I({},{callstack:[]},Ke(e.parameters)):Z()}function YD(e,r,n,o){let i=I(e,r,n);return y.Update(zD(i),{},o)}function AI(e,r,n,o){return v(e,[n])?YD(e,r,n,o):na(n,o)}function oa(e,r={}){return P("Partial",[e],r)}function xI(e,r={}){return C({},oa(e,r))}function RI(e,r){let n=sr(e,r),o=on(n);return Jt(y.Assign(e,{[r]:o}),r)}function CI(e){let r=e.map(n=>on(n));return Ne(r)}function PI(e){let r=e.map(n=>on(n));return q(r)}function UI(e){let r=s.Keys(e).reduce((o,i)=>({...o,[i]:tc(e[i])}),{});return N(r)}function on(e){return me(e)?RI(e.$defs,e.$ref):w(e)?CI(e.allOf):O(e)?PI(e.anyOf):k(e)?UI(e.properties):N({})}function VD(e,r,n,o){let i=I(e,r,n);return y.Update(on(i),{},o)}function wI(e,r,n,o){return v(e,[n])?VD(e,r,n,o):oa(n,o)}function ia(e,r,n={}){return P("Pick",[e,r],n)}function NI(e,r,n={}){let o=s.IsArray(r)?$o(r):r;return C({},ia(e,o,n))}function QD(e,r){return s.Keys(e).reduce((o,i)=>r.includes(i)?y.Assign(o,{[i]:e[i]}):o,{})}function WD(e,r){let n=Gc(e),o=Go(r),i=QD(n,o);return N(i)}function ZD(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(WD(a,c),{},i)}function LI(e,r,n,o,i){return v(e,[n,o])?ZD(e,r,n,o,i):ia(n,o,i)}function aa(e,r={}){return P("ReadonlyType",[e],r)}function vI(e,r={}){return C({},aa(e,r))}function kI(e){return Kr(Bt(e))}function MI(e,r){let n=sr(e,r),o=an(n);return Jt(y.Assign(e,{[r]:o}),r)}function DI(e){let r=e.map(n=>an(n));return Ne(r)}function GI(e){let r=s.Keys(e).reduce((o,i)=>({...o,[i]:nc(e[i])}),{});return N(r)}function $I(e){return Kr(Ke(e))}function jI(e){let r=e.map(n=>an(n));return q(r)}function an(e){return te(e)?kI(e.items):me(e)?MI(e.$defs,e.$ref):w(e)?DI(e.allOf):k(e)?GI(e.properties):V(e)?$I(e.items):O(e)?jI(e.anyOf):e}function XD(e,r,n,o){let i=I(e,r,n);return y.Update(an(i),{},o)}function qI(e,r,n,o){return v(e,[n])?XD(e,r,n,o):aa(n,o)}function BI(e){return St(Dt,e)}function FI(e){return N({true:e,false:e})}function HI(e,r){let n=ua(e);return sn(n,r)}function KI(e,r){return St(bo,r)}function zI(e,r){let n=Ne(e);return sn(n,r)}function YI(e,r){return s.IsString(e)||s.IsNumber(e)?N({[e]:r}):s.IsEqual(e,!1)?N({false:r}):s.IsEqual(e,!0)?N({true:r}):N({})}function VI(e,r){return St(So,r)}function QI(e,r){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?St(e.pattern.toString(),r):St(Dt,r)}function WI(e,r){let n=Rc(e);return Cc(n)?sn(nt(e),r):St(e,r)}function JD(e){return e.some(r=>ve(r)||be(r)||He(r))}function eG(e,r){return s.IsEqual(JD(e),!0)?St(Dt,r):void 0}function tG(e,r){return e.reduce((n,o)=>X(o)&&(s.IsString(o.const)||s.IsNumber(o.const))?{...n,[o.const]:r}:n,{})}function rG(e,r){let n=tG(e,r);return N(n)}function ZI(e,r){let n=ir(e),o=eG(n,r);return A(o)?o:rG(n,r)}function sn(e,r){return pt(e)?BI(r):lt(e)?FI(r):Ue(e)?HI(e.enum,r):He(e)?KI(e,r):w(e)?zI(e.allOf,r):X(e)?YI(e.const,r):be(e)?VI(e,r):O(e)?ZI(e.anyOf,r):ve(e)?QI(e,r):we(e)?WI(e.pattern,r):N({})}function nG(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(sn(a,c),{},i)}function XI(e,r,n,o,i){return v(e,[n])?nG(e,r,n,o,i):Hi(n,o,i)}function JI(e,r,n){return n in e?vc([n],e,e[n])?Le(n):I(e,r,e[n]):Le(n)}function eb(e,r){let n=sr(e,r),o=cn(n);return Jt(y.Assign(e,{[r]:o}),r)}function tb(e){let r=e.map(n=>cn(n));return Ne(r)}function rb(e){let r=e.map(n=>cn(n));return q(r)}function nb(e){let r=s.Keys(e).reduce((o,i)=>({...o,[i]:go(e[i])}),{});return N(r)}function cn(e){return me(e)?eb(e.$defs,e.$ref):w(e)?tb(e.allOf):O(e)?rb(e.anyOf):k(e)?nb(e.properties):N({})}function sa(e,r={}){return P("Required",[e],r)}function ob(e,r={}){return C({},sa(e,r))}function oG(e,r,n,o){let i=I(e,r,n);return y.Update(cn(i),{},o)}function ib(e,r,n,o){return v(e,[n])?oG(e,r,n,o):sa(n,o)}function ca(e,r={}){return P("ReturnType",[e],r)}function ab(e,r={}){return C({},ca(e,r))}function iG(e){return je(e)?e.returnType:Z()}function aG(e,r,n,o){let i=I(e,r,n);return y.Update(iG(i),{},o)}function sb(e,r,n,o){return v(e,[n])?aG(e,r,n,o):ca(n,o)}function cb(e){return y.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function sG(e){return e.join("|")}function cG(e){return e.slice(1,e.length-1)}function pG(e,r,n){return pn(r,`${n}${e}`)}function uG(e,r){return pn(e,`${r}${Zg}`)}function lG(e,r){return pn(e,`${r}${pc}`)}function mG(e,r){return pn(e,`${r}${lc}`)}function dG(e,r){return Yu(q([Y("false"),Y("true")]),e,r)}function fG(e,r){return pn(e,`${r}${dc}`)}function gG(e,r,n){return pn(r,`${n}${cG(e)}`)}function yG(e,r,n,o=[]){let i=Ft(e);return zu(i,r,n)}function zu(e,r,n,o=[]){let[i,...a]=e;return A(i)?zu(a,r,n,[...o,Yu(i,[],"")]):pn(r,`${n}(${sG(o)})`)}function Yu(e,r,n){return Ue(e)?yG(e.enum,r,n):He(e)?lG(r,n):X(e)?pG(e.const,r,n):At(e)?uG(r,n):lt(e)?dG(r,n):be(e)?mG(r,n):ve(e)?fG(r,n):we(e)?gG(e.pattern,r,n):O(e)?zu(e.anyOf,r,n):wg}function pn(e,r){let[n,...o]=e;return A(n)?Yu(n,o,r):r}function hG(e){return`^${pn(e,"")}$`}function pb(e){let r=hG(e);return cb(r)}function TG(e,r,n,o){let i=Ct(e,r,n);return y.Update(pb(i),{},o)}function ub(e,r,n,o){return v(e,n)?TG(e,r,n,o):Ki(n,o)}function EG(e){return Xr(e)?V(e.items)?Vu(e.items.items):Pe(e.items)?[e]:pe(e.items)?[e]:[Z()]:[e]}function Vu(e){return e.reduce((n,o)=>[...n,...EG(o)],[])}function _G(e,r){return r in e}function IG(e,r){return w(r)?v(e,r.allOf):O(r)?v(e,r.anyOf):pe(r)?_G(e,r.$ref):!0}function v(e,r){let[n,...o]=r;return A(n)?IG(e,n)?v(e,o):!1:!0}function _a(e,r,n){return Ag(e)?_a(e.type,"remove",n):Ig(e)?_a(e.type,r,"remove"):Sg(e)?_a(e.type,"add",n):Eg(e)?_a(e.type,r,"add"):[e,r,n]}function bG(e,r){return s.IsEqual(e,"remove")?rc(r):s.IsEqual(e,"add")?_t(r):r}function SG(e,r){return s.IsEqual(e,"remove")?go(r):s.IsEqual(e,"add")?Et(r):r}function Ea(e,r,n){return s.Keys(n).reduce((o,i)=>({...o,[i]:I(e,r,n[i])}),{})}function Lc(e,r,n){let o=Ct(e,r,n);return Vu(o)}function Ct(e,r,n){return n.map(o=>I(e,r,o))}function OG(e,r,n,o,i){return s.IsEqual(n,"Awaited")?y_(e,r,o[0],i):s.IsEqual(n,"Capitalize")?A_(e,r,o[0],i):s.IsEqual(n,"Conditional")?U_(e,r,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"ConstructorParameters")?N_(e,r,o[0],i):s.IsEqual(n,"Evaluate")?kE(e,r,o[0],i):s.IsEqual(n,"Exclude")?Mc(e,r,o[0],o[1],i):s.IsEqual(n,"Extract")?$_(e,r,o[0],o[1],i):s.IsEqual(n,"Index")?nI(e,r,o[0],o[1],i):s.IsEqual(n,"InstanceType")?iI(e,r,o[0],i):s.IsEqual(n,"Interface")?aI(e,r,o[0],o[1],i):s.IsEqual(n,"KeyOf")?dI(e,r,o[0],i):s.IsEqual(n,"Lowercase")?x_(e,r,o[0],i):s.IsEqual(n,"Mapped")?hI(e,r,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"Module")?TI(e,r,o[0],i):s.IsEqual(n,"NonNullable")?_I(e,r,o[0],i):s.IsEqual(n,"Pick")?LI(e,r,o[0],o[1],i):s.IsEqual(n,"Options")?SI(e,r,o[0],o[1]):s.IsEqual(n,"Parameters")?AI(e,r,o[0],i):s.IsEqual(n,"Partial")?wI(e,r,o[0],i):s.IsEqual(n,"Omit")?bI(e,r,o[0],o[1],i):s.IsEqual(n,"ReadonlyType")?qI(e,r,o[0],i):s.IsEqual(n,"Record")?XI(e,r,o[0],o[1],i):s.IsEqual(n,"Required")?ib(e,r,o[0],i):s.IsEqual(n,"ReturnType")?sb(e,r,o[0],i):s.IsEqual(n,"TemplateLiteral")?ub(e,r,o[0],i):s.IsEqual(n,"Uncapitalize")?R_(e,r,o[0],i):s.IsEqual(n,"Uppercase")?C_(e,r,o[0],i):P(n,o,i)}function I(e,r,n){let o=Cn(n),i=_a(n,Pn(n)?"add":"none",Ge(n)?"add":"none"),a=Ut(i[0])?i[0].Clone():i[0],c=pe(a)?JI(e,r,a.$ref):te(a)?Bt(I(e,r,a.items),oc(a)):at(a)?Xt(I(e,r,a.iteratorItems),Rg(a)):Mo(a)?kc(e,r,a.target,a.arguments):$e(a)?zr(Ct(e,r,a.parameters),I(e,r,a.instanceType),Pg(a)):xg(a)?OG(e,r,a.action,a.parameters,a.options):je(a)?Yr(Ct(e,r,a.parameters),I(e,r,a.returnType),Ug(a)):w(a)?wt(Ct(e,r,a.allOf),Dg(a)):st(a)?er(I(e,r,a.iteratorItems),Jg(a)):k(a)?N(Ea(e,r,a.properties),oy(a)):tt(a)?nr(I(e,r,a.item),ay(a)):Se(a)?gc(xt(a),I(e,r,rt(a))):Xr(a)?Ln(I(e,r,a.items)):V(a)?Ke(Lc(e,r,a.items),cy(a)):O(a)?q(Ct(e,r,a.anyOf),py(a)):a,l=o?Kr(c):c;return bG(i[1],SG(i[2],l))}function C(e,r){return I(e,{callstack:[]},r)}function pa(e,r={}){return P("Awaited",[e],r)}function lb(e,r={}){return C({},pa(e,r))}function _u(e,r={}){return P("Evaluate",[e],r)}function Kt(e,r={}){return C({},_u(e,r))}function Iu(e,r={}){return P("Module",[e],r)}function mb(e,r={}){return C({},Iu(e,r))}function db(...e){let[r,n,o]=ie.Match(e,{2:(c,l)=>s.IsString(c)?[{},c,l]:[c,l,{}],3:(c,l,d)=>[c,l,d],1:c=>[{},c,{}]}),i=oE(n),a=s.IsArray(i)&&s.IsEqual(i.length,2)?I(r,{callstack:[]},i[0]):Z();return y.Update(a,{},o)}var t={};Mt(t,{Any:()=>ho,Array:()=>Bt,AsyncIterator:()=>Xt,Awaited:()=>lb,Base:()=>ic,BigInt:()=>Bi,Boolean:()=>cc,Call:()=>f_,Capitalize:()=>I_,Codec:()=>ac,Conditional:()=>P_,Constructor:()=>zr,ConstructorParameters:()=>w_,Cyclic:()=>Jt,Decode:()=>Vg,DecodeBuilder:()=>qi,Encode:()=>Qg,EncodeBuilder:()=>ji,Enum:()=>Mg,Evaluate:()=>Kt,Exclude:()=>L_,Extends:()=>ot,ExtendsResult:()=>L,Extract:()=>M_,Function:()=>Yr,Generic:()=>Vr,Identifier:()=>Fi,Immutable:()=>Kr,Index:()=>Z_,Infer:()=>$i,InstanceType:()=>oI,Instantiate:()=>C,Integer:()=>wn,Interface:()=>r_,Intersect:()=>wt,IsAny:()=>pt,IsArray:()=>te,IsAsyncIterator:()=>at,IsBase:()=>Ut,IsBigInt:()=>At,IsBoolean:()=>lt,IsCall:()=>Mo,IsCodec:()=>Un,IsConstructor:()=>$e,IsCyclic:()=>me,IsEnum:()=>Ue,IsFunction:()=>je,IsGeneric:()=>yo,IsIdentifier:()=>Xg,IsImmutable:()=>Cn,IsInfer:()=>Pe,IsInteger:()=>He,IsIntersect:()=>w,IsIterator:()=>st,IsKind:()=>S,IsLiteral:()=>X,IsNever:()=>hr,IsNull:()=>tr,IsNumber:()=>be,IsObject:()=>k,IsOptional:()=>Ge,IsParameter:()=>iy,IsPromise:()=>tt,IsReadonly:()=>Pn,IsRecord:()=>Se,IsRef:()=>pe,IsRefine:()=>sc,IsRest:()=>Xr,IsSchema:()=>A,IsString:()=>ve,IsSymbol:()=>rr,IsTemplateLiteral:()=>we,IsThis:()=>sy,IsTuple:()=>V,IsUndefined:()=>or,IsUnion:()=>O,IsUnknown:()=>It,IsUnsafe:()=>ly,IsVoid:()=>Rt,Iterator:()=>er,KeyOf:()=>sI,Literal:()=>Y,Lowercase:()=>b_,Mapped:()=>yI,Module:()=>mb,Never:()=>Z,NonNullable:()=>EI,Null:()=>Zr,Number:()=>Nt,Object:()=>N,Omit:()=>II,Optional:()=>tc,Options:()=>$c,Parameter:()=>Nn,Parameters:()=>OI,Partial:()=>xI,Pick:()=>NI,Promise:()=>nr,Readonly:()=>nc,ReadonlyType:()=>vI,Record:()=>fc,RecordKey:()=>Oo,RecordKeyAsPattern:()=>xt,RecordValue:()=>rt,Ref:()=>Le,Refine:()=>Wg,Required:()=>ob,Rest:()=>Ln,ReturnType:()=>ab,Script:()=>db,String:()=>bt,Symbol:()=>Io,TemplateLiteral:()=>sE,This:()=>yc,Tuple:()=>Ke,Uncapitalize:()=>S_,Undefined:()=>Ao,Union:()=>q,Unknown:()=>Je,Unsafe:()=>uy,Uppercase:()=>O_,Void:()=>hc});var fb="lowercase-email",Qu="iana-timezone",Wu="simple-time",Zu="simple-date-time";var AG=(e,r)=>RegExp(`^${e.source}(${r.source}${e.source})*$`),xG=/[a-zA-Z0-9-_]+/,RG=/\./,d_e=AG(xG,RG);var gb="lowercase-domain";var qo="kebab-case";var yb="camel-case";var CG=new Set;function b(e,r,n={}){let o=r.map(i=>{let a=i;return a.$id?(CG.add(i),t.Ref(a.$id)):i});return t.Unsafe({...n,type:"object",discriminator:{propertyName:e},required:[e],oneOf:o})}function Be(e,r){return t.Object({values:t.Array(e,{maxItems:r.maxItems,description:"Values compared by this filter. When `exclude` is omitted or false, rows matching any value are kept; when `exclude` is true, matching rows are removed."}),exclude:t.Optional(t.Boolean({description:"If true, exclude rows matching these values instead of including them"}))},{description:r.description})}var Fo=1e3,jc=100,ye={limit:t.Optional(t.Integer({minimum:1,maximum:Fo,description:"Maximum number of items to return in this page."})),offset:t.Optional(t.Integer({minimum:0,description:"Zero-based index of the first matching item to return. Increase it with `limit` to request later pages. If `limit` is provided without `offset`, the offset defaults to 0."}))},ze={...ye,limit:t.Optional(t.Integer({minimum:1,maximum:Fo,default:jc,description:`Maximum number of items to return in this page. Omit to use the public API default of ${jc}.`}))},PG=t.Object({totalCount:t.Integer({description:"Total number of items matching the query before `limit` and `offset` are applied."}),pageCount:t.Integer({description:"Total number of pages available for the requested `limit`."})},{description:"Counts describing the full result set that the returned page was taken from, for computing how many further pages remain."}),T_e=t.Object({pagination:PG},{$id:"ResponseMetadata",description:"Metadata accompanying `data` on paginated operations, describing the full result set the page was taken from."});function E(e={}){return t.Unsafe({...e,type:"string"})}var Bo=250;function p({allowEmpty:e=!0,type:r="short",description:n,default:o}={}){let i=e?0:1,a={...n===void 0?{}:{description:n},...o===void 0?{}:{default:o}};switch(r){case"camel-case":return t.String({format:yb,minLength:i,maxLength:Bo,...a});case"kebab-case":return t.String({format:qo,minLength:i,maxLength:Bo,...a});case"email":return t.String({format:fb,minLength:i,maxLength:254,errorMessage:{format:"Must be a valid lowercase email address."},...a});case"lowercase-domain":return t.String({format:gb,minLength:i,maxLength:Bo,...a});case"tsuga-query":return t.String({format:"tsuga-query",minLength:i,maxLength:1e4,...a});case"tags-query":return t.String({format:"tags-query",minLength:i,maxLength:1e4,errorMessage:{format:"Must be a valid tags query: only tag:value searches (no wildcards), boolean operators, and parentheses are supported. The query you provided is invalid: ${0}"},...a});case"date-time":return t.String({format:"date-time",...a});case"uri":return t.String({format:"uri",...a});case"user-password":return t.String({format:"user-password",minLength:12,maxLength:Bo,...a});case"long":return t.String({minLength:i,maxLength:5e4,...a});case"short":return t.String({minLength:i,maxLength:Bo,...a});case"tsuga-formula":return t.String({format:"tsuga-formula",minLength:i,maxLength:Bo,errorMessage:{format:"Must be a simple mathematical formula, and all variables in it should refer to queries (q1, q2, etc.). The formula you provided is invalid: ${0}"},...a});case"time":return t.String({format:"time",...a});case"readonly-sql-query":return t.String({format:"readonly-sql-query",minLength:i,maxLength:5e4,errorMessage:{format:"Must be a readonly SQL query - only SELECT statements are allowed."},...a});default:Xe(r)}}var Ia=["ingestion-api-key","operation-api-key","rum-public-token","dashboard","log-route","metric-route","monitor","notification-rule","notification-silence","slo"],qc=t.Array(t.Enum(Ia,{description:"Tsuga-managed asset type."}),{description:"Tsuga-managed asset types covered by the policy. An empty array means all supported asset types."});var Xu=["CLUSTER_DB_QUERY_INVALID_CONNECTION_PARAMS","CLUSTER_DB_QUERY_INVALID_CREDENTIALS","CLUSTER_DB_QUERY_PERMISSION_DENIED","CLUSTER_DB_QUERY_QUERY_SYNTAX_ERROR","CLUSTER_DB_QUERY_DATABASE_UNREACHABLE","CLUSTER_DB_QUERY_CONNECTION_FAILED","CLUSTER_DB_QUERY_QUERY_EXECUTION_FAILED","CLUSTER_DB_QUERY_QUERY_TIMEOUT"],U_e=t.Enum(Xu),UG=["CLUSTER_AGGREGATION_STRUCTURE"],w_e=t.Object({code:t.Enum(Xu),message:t.String()}),hb=[...Xu,...UG,"ABORT_ERROR","BAD_REQUEST","DUPLICATE_KEY_VIOLATION","FOREIGN_KEY_VIOLATION","FST_ERR_VALIDATION","GROK_RULE_VALIDATION_ERROR","INVALID_INPUT","FORBIDDEN","MISSING_PERMISSION","PRIVILEGE_ESCALATION","RATE_LIMITED","RESERVED_TAG_POLICY_ERROR","RESOURCE_NOT_FOUND","INVALID_INVITATION","TAG_POLICY_ALREADY_EXISTS_ERROR","TAG_POLICY_VALIDATION_ERROR","UNAUTHORIZED","URL_NOT_FOUND"],Tb=["INTERNAL_ERROR","INVALID_QUERY_TO_CLUSTER"];var wG=["NETWORK_ERROR","RESPONSE_PARSE_ERROR"],NG=[...hb,...Tb,...wG],LG=t.Object({assetId:t.Optional(t.String({description:"Identifier of the asset that violated the policy. Set from the existing asset for update and bulk requests. Omitted on create requests before the asset exists."})),assetName:t.String({description:"Name of the asset that violated the policy. Set from submitted data or the existing asset row. Returned for every violation."}),assetType:t.Enum(Ia,{description:"Type of Tsuga asset validated by the policy. Set by the route that ran tag-policy validation. Returned for every violation."}),tagPolicyId:t.String({description:"Identifier of the active tag policy that was violated. Generated by Tsuga when the policy is created. Returned for every violation."}),tagKey:t.String({description:"Tag key required or constrained by the violated policy. Set by the tag policy. Returned for every violation."}),message:t.String({description:"Human-readable reason this policy failed for the asset. Generated by Tsuga's tag-policy validator. Returned for every violation."})},{description:"A single tag-policy violation, identifying the offending asset, the policy and tag key involved, and why validation failed."}),vG=b("type",[t.Object({type:t.Literal("invalid-syntax",{description:"Discriminator identifying a rule the grok parser could not parse at all."}),error:t.Object({offset:t.Integer({description:"Byte offset in the rule where parsing failed."}),detail:t.String({description:"Parser detail message."})},{description:"Position and parser message for the syntax failure."})},{$id:"GrokInvalidSyntax"}),t.Object({type:t.Literal("unknown-pattern",{description:"Discriminator identifying a rule that references a pattern name the grok engine does not provide."}),error:t.Object({offset:t.Integer({description:"Byte offset of the unknown pattern."}),unknownPattern:t.String({description:"The pattern name that is not supported."})},{description:"Position and name of the unsupported pattern."})},{$id:"GrokUnknownPattern"}),t.Object({type:t.Literal("invalid-filter",{description:"Discriminator identifying a rule whose filter is a known filter used incorrectly."}),error:t.Object({offset:t.Integer({description:"Byte offset of the invalid filter."}),invalidFilter:t.String({description:"The filter that is invalid."}),message:t.String({description:"Why the filter is invalid."})},{description:"Position, text, and reason for the invalid filter."})},{$id:"GrokInvalidFilter"}),t.Object({type:t.Literal("unknown-filter",{description:"Discriminator identifying a rule that references a filter name the grok engine does not implement."}),error:t.Object({offset:t.Integer({description:"Byte offset of the unknown filter."}),unknownFilter:t.String({description:"The filter name that is not implemented."}),message:t.String({description:"Details about the unsupported filter."})},{description:"Position and name of the unimplemented filter."})},{$id:"GrokUnknownFilter"})],{description:"Full structured detail of a grok rule that failed to compile, discriminated by `type`."}),kG=t.Object({rule:t.String({description:"The rule that failed to compile."}),ruleIndex:t.Integer({description:"0-based index of the failing rule in the submitted `rules` array."}),error:vG},{description:"A single grok rule that failed to compile, with its position in the submitted rules and the structured compile error."}),Eb=b("type",[t.Object({type:t.Literal("tag_policy_violation",{description:"Discriminator identifying tag-policy validation details. Set by Tsuga to `tag_policy_violation`. Returned when the error code is `TAG_POLICY_VALIDATION_ERROR`."}),violations:t.Array(LG,{description:"Tag-policy violations that caused the request to fail. Built from active policies applicable to the submitted asset type and owner team. Returned on tag-policy validation errors; can contain multiple policies and multiple assets for bulk requests."})},{$id:"TagPolicyViolationDetails"}),t.Object({type:t.Literal("grok_rule_error",{description:"Discriminator identifying grok rule validation details. Set by Tsuga to `grok_rule_error`. Returned when the error code is `GROK_RULE_VALIDATION_ERROR`."}),ruleErrors:t.Array(kG,{description:"Grok rules that failed to compile, with full structured detail. One entry per invalid rule."})},{$id:"GrokRuleErrorDetails"})],{description:"Structured details for a client error. Set by Tsuga only for error types with machine-readable remediation data, and omitted for every other client error."}),N_e=t.Object({code:t.Optional(t.Enum(NG,{description:"Machine readable error code describing what went wrong"})),message:t.String({description:"Human readable explanation of the error"}),statusCode:t.Number({description:"HTTP status code that was returned"}),details:t.Optional(Eb)},{$id:"ErrorResponse",description:"Standard envelope for API errors"}),L_e=t.Object({code:t.Optional(t.Enum(hb,{description:"Machine readable error code describing what went wrong"})),message:t.String({description:"Human readable explanation of the error"}),statusCode:t.Number({description:"HTTP status code that was returned"}),details:t.Optional(Eb)},{$id:"ClientErrorResponse",description:"Standard envelope for client (4XX) API errors"}),v_e=t.Object({code:t.Optional(t.Enum(Tb,{description:"Machine readable error code describing what went wrong"})),message:t.String({description:"Human readable explanation of the error"}),statusCode:t.Number({description:"HTTP status code that was returned"})},{$id:"ServerErrorResponse",description:"Standard envelope for server (5XX) API errors"}),k_e=t.Object({requestId:t.String({description:"Identifier used to trace the lifecycle of this API request"}),error:t.Ref("ClientErrorResponse")},{$id:"ClientErrorEnvelope",description:"Standard envelope wrapping all client (4XX) error responses"}),M_e=t.Object({requestId:t.String({description:"Identifier used to trace the lifecycle of this API request"}),error:t.Ref("ServerErrorResponse")},{$id:"ServerErrorEnvelope",description:"Standard envelope wrapping all server (5XX) error responses"});function m({body:e,description:r,method:n,operationId:o,params:i,tags:a,query:c,paginated:l,response:d,url:f}){return i?{buildUrl:T=>f.replace(/:[a-zA-Z_]+/g,_=>T[_.slice(1)]),method:n,params:i,response:d,templateUrl:f,...e===void 0?{}:{body:e},...r===void 0?{}:{description:r},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}:{method:n,response:d,url:f,templateUrl:f,...e===void 0?{}:{body:e},...r===void 0?{}:{description:r},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}}function _b(e,r){if(!r||typeof r!="object")return e;let n=new URLSearchParams;return Object.entries(r).forEach(([o,i])=>{Array.isArray(i)?i.length>0&&i.forEach(a=>{a!==void 0&&(typeof a=="string"||typeof a=="number"||typeof a=="boolean")&&n.append(o,String(a))}):(typeof i=="boolean"||typeof i=="string"||typeof i=="number")&&n.append(o,String(i))}),`${e}?${n.toString()}`}var R=t.Object({success:t.Literal(!0,{description:"Always `true` when the delete request completed and the resource was removed."})},{$id:"DeleteResponse",description:"Confirmation that the targeted resource was deleted.",example:{success:!0}});var Ju="tsuga-cli";var Gn="/v0/oauth",Ib=m({description:"OAuth 2.1 authorization endpoint: validates the client and redirect URI, then redirects to the consent page",url:`${Gn}/authorize`,method:"GET",query:t.Partial(t.Object({response_type:t.String({description:"Must be `code`"}),client_id:t.String({description:"First-party client id or CIMD document URL"}),redirect_uri:t.String({description:"Client redirect URI"}),code_challenge:t.String({description:"PKCE code challenge"}),code_challenge_method:t.String({description:"Must be `S256`"}),state:t.String({description:"Opaque client state, echoed back"}),resource:t.String({description:"RFC 8707 resource indicator"})})),response:t.Object({},{description:"Never returned: this endpoint redirects (302) or renders an HTML error (400)"})}),bb=m({description:"OAuth 2.1 token endpoint: exchanges an authorization code (PKCE) or refresh token for a token pair",url:`${Gn}/token`,method:"POST",body:t.Partial(t.Object({grant_type:t.String({description:"`authorization_code` or `refresh_token`"}),code:t.String({description:"Authorization code being exchanged"}),code_verifier:t.String({description:"PKCE code verifier"}),redirect_uri:t.String({description:"Must match the redirect URI used on /authorize"}),client_id:t.String({description:"Client id, when sent by the client"}),refresh_token:t.String({description:"Refresh token, for `grant_type=refresh_token`"})})),response:t.Object({access_token:t.String(),token_type:t.Literal("Bearer"),expires_in:t.Number({description:"Access token lifetime in seconds"}),refresh_token:t.String()})}),X_e=m({description:"Resolve a signed authorization request handle for the consent page",url:`${Gn}/authorization-request`,method:"GET",query:t.Object({handle:t.String()}),response:t.Object({clientId:t.String(),clientName:t.String(),redirectUri:t.String()})}),J_e=m({description:"Approve or deny an OAuth authorization request from the consent page",url:`${Gn}/approve`,method:"POST",body:t.Object({handle:t.String({description:"The signed authorization request handle"}),approve:t.Boolean()}),response:t.Object({redirectTo:t.String({description:"The client's redirect URI carrying either the code or the denial"})})}),eIe=m({description:"Validate an OAuth access token (internal, for the MCP resource server)",url:`${Gn}/introspect`,method:"POST",body:t.Object({token:t.String()}),response:t.Object({active:t.Boolean(),userId:t.Optional(t.String()),orgId:t.Optional(t.String())})}),MG=["pending","active","revoked"],DG=t.Object({id:t.String(),createdAt:E(),clientId:t.String({description:"Client ID Metadata Document URL or first-party client id"}),clientName:t.String({description:"Display name derived from the client identity"}),userId:t.String(),status:t.Enum(MG),lastUsedAt:t.Optional(E())}),tIe=m({tags:["oauth"],description:"List OAuth grants: your own, or all users for admins",url:`${Gn}/grants`,method:"GET",query:t.Object({allUsers:t.Optional(t.Boolean({description:"Admins only: list grants of every user in the org"}))}),response:t.Array(DG)}),rIe=m({tags:["oauth"],description:"Delete an OAuth grant (own grant, or any grant for admins)",url:`${Gn}/grants/:id`,method:"DELETE",params:t.Object({id:t.String()}),response:R});function Sb(e,r){let n=new URL(Ib.url,e);return n.search=new URLSearchParams({response_type:"code",client_id:Ju,redirect_uri:r.redirectUri,code_challenge:r.challenge,code_challenge_method:"S256",state:r.state}).toString(),n.href}function GG(e){if(!e)return{};try{let r=JSON.parse(e);return typeof r=="object"&&r!==null?r:{}}catch{return{}}}async function $G(e,r){let n=await fetch(new URL(bb.url,e).href,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(r).toString()}),o=await n.text(),i=GG(o);if(n.status!==200){let a=i.error??`HTTP ${n.status}`;throw new Error(`OAuth token request failed (${a}${i.error_description?`: ${i.error_description}`:""})`)}if(!i.access_token||typeof i.expires_in!="number")throw new Error("OAuth token response was missing required fields");return{accessToken:i.access_token,expiresAt:new Date(Date.now()+i.expires_in*nu)}}async function Ob(e,r){return $G(e,{grant_type:"authorization_code",client_id:Ju,code:r.code,code_verifier:r.verifier,redirect_uri:r.redirectUri})}var Gt=require("node:fs"),tl=require("node:os"),jn=require("node:path");var xb=Sn(require("os"),1),ba=Sn(require("path"),1),un=xb.default.homedir(),{env:$n}=process,Ab=$n.XDG_DATA_HOME||(un?ba.default.join(un,".local","share"):void 0),Bc=$n.XDG_CONFIG_HOME||(un?ba.default.join(un,".config"):void 0),sIe=$n.XDG_STATE_HOME||(un?ba.default.join(un,".local","state"):void 0),Rb=$n.XDG_CACHE_HOME||(un?ba.default.join(un,".cache"):void 0),cIe=$n.XDG_RUNTIME_DIR||void 0,jG=($n.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");Ab&&jG.unshift(Ab);var qG=($n.XDG_CONFIG_DIRS||"/etc/xdg").split(":");Bc&&qG.unshift(Bc);var Cb=(0,jn.join)(Bc??(0,jn.join)((0,tl.homedir)(),".config"),"tsuga"),Sa=(0,jn.join)(Cb,"config.json"),Pb=(0,jn.join)(Rb??(0,jn.join)((0,tl.homedir)(),".cache"),"tsuga"),el=(0,jn.join)(Pb,"update-check.json"),Oa="https://api.tsuga.com";function Ub(e){return zf(e.credential)}function Fc(){if(!(0,Gt.existsSync)(Sa))return{};try{let e=JSON.parse((0,Gt.readFileSync)(Sa,"utf-8")),{operationApiKey:r,userAuth:n,...o}=e;return!r&&!n?e:{...o,credentials:{...e.credentials??{},[Oa]:{...r?{operationApiKey:r}:{},...n?{userAuth:n}:{},...e.credentials?.[Oa]??{}}}}}catch{throw new Error(`Config file corrupted: ${Sa}
|
|
43
|
-
Re-authenticate with \`tsuga auth login\` or \`tsuga auth operation-key <OPERATION_API_KEY>\`.`)}}function
|
|
44
|
-
`,{mode:384})}function
|
|
42
|
+
`,e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[]))),([r,n])=>[r,n]),fE=(e,r=[])=>u(u(Bu(e),([n,o])=>u(c0(o),([i,a])=>[[n,i],a])),([n,o])=>fE(o,[...r,n]),()=>[r,e]),p0=e=>u(u(fE(e),([r,n])=>u(u(u(Bu(n),([o,i])=>[[o],i]),([o,i])=>[o,i],()=>u([[],n],([o,i])=>[o,i],()=>[])),([o,i])=>[[r,o],i])),([r,n])=>[TT(r),n]),Bu=e=>u(u(s0(e),([r,n])=>u(u(n0(n),([o,i])=>[o,i],()=>u(o0(n),([o,i])=>[o,i],()=>u(i0(n),([o,i])=>[o,i],()=>u(a0(n),([o,i])=>[o,i],()=>[])))),([o,i])=>u(jT(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[ET(r),n]),u0=e=>u(u(Bu(e),([r,n])=>u(p0(n),([o,i])=>[[r,o],i])),([r,n])=>[_T(r),n]),gE=e=>u(u(u0(e),([r,n])=>[r,n],()=>u(dM(e),([r,n])=>[r,n],()=>u(J(e),([r,n])=>[r,n],()=>[]))),([r,n])=>[r,n]);function yE(e){let r=Du(`\`${e}\``);return s.IsEqual(r.length,2)?r[0]:H()}function Vi(e,r={}){return P("TemplateLiteral",[e],r)}function hE(e){return C({},Vi(e,{}))}function m0(e){let r=yE(e);return hE(r)}function TE(e,r={}){let n=s.IsString(e)?m0(e):hE(e);return y.Update(n,{},r)}function Le(e){return S(e,"TemplateLiteral")}var L={};Gt(L,{ExtendsFalse:()=>F,ExtendsTrue:()=>R,ExtendsUnion:()=>qu,IsExtendsFalse:()=>d0,IsExtendsTrue:()=>_E,IsExtendsTrueLike:()=>Ae,IsExtendsUnion:()=>EE});function qu(e){return y.Create({"~kind":"ExtendsUnion"},{inferred:e})}function EE(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsUnion")&&s.IsObject(e.inferred)}function R(e){return y.Create({"~kind":"ExtendsTrue"},{inferred:e})}function _E(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsTrue")&&s.IsObject(e.inferred)}function F(){return y.Create({"~kind":"ExtendsFalse"},{})}function d0(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function Ae(e){return EE(e)||_E(e)}function wc(e){let r=lE(e);return s.IsEqual(r.length,2)?r[0]:H()}function f0(e){return!0}function IE(e){let[r,...n]=e;return A(r)?g0(r)?IE(n):!1:!0}function bE(e){return s.IsEqual(e.length,0)?!1:IE(e)}function g0(e){return O(e)?bE(e.anyOf):X(e)?f0(e.const):!1}function Nc(e){return bE(e)}function SE(e,r,n=[]){let[o,...i]=e;return s.IsString(o)?SE(i,r,[...n,`${o}${r}`]):n}function y0(e,r){return s.IsEqual(e.length,0)?[`${r}`]:SE(e,r)}function OE(e,r,n=[]){let[o,...i]=r;return A(o)?OE(e,i,[...n,...AE(e,o)]):n}function AE(e,r){return O(r)?OE(e,r.anyOf):X(r)?y0(e,r.const):H()}function xE(e,r){let[n,...o]=r;return A(n)?xE(AE(e,n),o):e}function h0(e){return e.map(r=>Y(r))}function T0(e){let r=xE([],e),n=h0(r);return B(n)}function E0(e){return s.IsEqual(e.length,0)?H():s.IsEqual(e.length,1)&&X(e[0])?e[0]:T0(e)}function nt(e){let r=wc(e);return Nc(r)?E0(r):bt()}function _0(e){return s.IsString(e)||s.IsNumber(e)?Y(e):s.IsNull(e)?Zr():Z()}function Kt(e){return e.map(n=>_0(n))}function da(e){let r=Kt(e);return B(r)}function kn(e){return da(e.enum)}function I0(e,r,n,o){let i=re(e,n,o);return Ae(i)?R(y.Assign(y.Assign(e,i.inferred),{[r]:n})):F()}function b0(e,r){return R(e)}function S0(e,r,n){let o=da(n);return re(e,r,o)}function RE(e,r,n){let[o,...i]=n;return A(o)?(()=>{let a=re(e,r,o);return Ae(a)?RE(a.inferred,r,i):F()})():R(e)}function O0(e,r,n){let o=nt(n);return re(e,r,o)}function CE(e,r,n){let[o,...i]=n;return A(o)?(()=>{let a=re(e,r,o);return Ae(a)?R(a.inferred):CE(e,r,i)})():F()}function K(e,r,n){return pt(n)?b0(e,r):Ne(n)?S0(e,r,n.enum):we(n)?I0(e,n.name,r,n.extends):w(n)?RE(e,r,n.allOf):Le(n)?O0(e,r,n.pattern):O(n)?CE(e,r,n.anyOf):It(n)?R(e):F()}function PE(e,r,n){return we(n)?K(e,r,n):pt(n)?R(e):It(n)?R(e):qu(e)}function A0(e,r){let n=Cn(e),o=Cn(r);return n&&o||!n&&o?!0:!(n&&!o)}function UE(e,r,n,o){return te(o)?A0(r,o)?re(e,n,o.items):F():K(e,r,o)}function wE(e,r,n){return at(n)?re(e,r,n.iteratorItems):K(e,Xt(r),n)}function NE(e,r,n){return At(n)?R(e):K(e,r,n)}function LE(e,r,n){return lt(n)?R(e):K(e,r,n)}function x0(e,r,n,o,i){let a=we(o)?r:o,c=we(o)?o:r,l=Be(r),d=Be(o),f=re(e,a,c);return!l&&d?F():Ae(f)?fa(f.inferred,n,i):F()}function R0(e,r,n,o){let[i,...a]=o;return A(i)?x0(e,r,n,i,a):Be(r)?R(e):F()}function C0(e,r,n){let[o,...i]=r;return A(o)?R0(e,o,i,n):R(e)}function fa(e,r,n){return C0(e,r,n)}function Lc(e,r,n){return Rt(n)?R(e):re(e,r,n)}function vE(e,r,n,o){return qe(o)?(()=>{let i=fa(e,r,o.parameters);return Ae(i)?Lc(i.inferred,n,o.instanceType):F()})():F()}function kE(e,r,n){return re(e,kn(r),n)}function ME(e,r,n,o){return Fe(o)?(()=>{let i=fa(e,r,o.parameters);return Ae(i)?Lc(i.inferred,n,o.returnType):F()})():F()}function DE(e,r,n){return ze(n)?R(e):be(n)?R(e):K(e,r,n)}var ga="equal",P0="disjoint",ya="left-inside",ha="right-inside";function Ta(e,r){let n=[It(e)?L.ExtendsFalse():ot({},e,r),It(e)?L.ExtendsTrue({}):ot({},r,e)];return L.IsExtendsTrueLike(n[0])&&L.IsExtendsTrueLike(n[1])?ga:L.IsExtendsTrueLike(n[0])&&L.IsExtendsFalse(n[1])?ya:L.IsExtendsFalse(n[0])&&L.IsExtendsTrueLike(n[1])?ha:P0}function U0(e){return O(e)?ir(e.anyOf):[e]}function ir(e){return e.reduce((r,n)=>[...r,...U0(n)],[])}function Fu(e){return e.reduceRight((n,o,i)=>({[i]:o,...n}),{})}function GE(e){let r=Fu(e.items);return N(r)}function w0(e,r){return Pn(e)?!!Pn(r):!1}function N0(e,r){return Be(e)?!!Be(r):!1}function L0(e,r){let n=w0(e,r),o=N0(e,r),i=ve([e,r]),a=ac(go(i));return n&&o?_t(Et(a)):n&&!o?_t(a):!n&&o?Et(a):a}function v0(e,r,n){return n in e?n in r?L0(e[n],r[n]):e[n]:n in r?r[n]:Z()}function k0(e,r){return[...new Set([...s.Keys(r),...s.Keys(e)])].reduce((o,i)=>({...o,[i]:v0(e,r,i)}),{})}function $E(e){return k(e)?e.properties:V(e)?Fu(e.items):H()}function jE(e,r){let n=$E(e),o=$E(r),i=k0(n,o);return N(i)}function BE(e,r){let n=Ta(e,r);return s.IsEqual(n,ya)?e:s.IsEqual(n,ha)||s.IsEqual(n,ga)?r:Z()}function qE(e){return k(e)||V(e)}function FE(e){return w(e)?ve(e.allOf):e}function M0(e,r){let n=FE(e),o=FE(r),i=qE(n),a=qE(o);return i&&a?jE(tn(n),o):i&&!a?tn(n):!i&&a?o:BE(tn(n),o)}function HE(e,r,n=[]){let[o,...i]=r;return s.IsUndefined(o)?n.length===0?[e]:n:HE(e,i,[...n,M0(e,o)])}function KE(e,r,n=[]){let[o,...i]=e;return A(o)?KE(i,r,[...n,...Ea([o],r)]):n}function Ea(e,r=[]){let[n,...o]=e;return A(n)?O(n)?Ea(o,KE(n.anyOf,r)):Ea(o,HE(n,r)):r}function ve(e){let r=Ea(e);return Hu(r)}function Er(e){return Hu(e)}function tn(e){return w(e)?ve(e.allOf):O(e)?Er(e.anyOf):e}function Mn(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?Z():B(e)}function D0(e,r){return r.filter(n=>Ta(e,n)!==ha)}function G0(e,r){let n=r.some(o=>{let i=Ta(e,o);return s.IsEqual(i,ya)||s.IsEqual(i,ga)});return s.IsEqual(n,!1)}function $0(e,r){let n=tn(e);return pt(n)?[n]:G0(n,r)?[...D0(n,r),n]:r}function Ku(e,r=[]){let[n,...o]=e;return A(n)?k(n)?Ku(o,[...r,n]):Ku(o,$0(n,r)):r}function Hu(e){let r=Ku(e),n=ir(r);return n.length===0?Z():n.length===1?n[0]:B(n)}function j0(e,r,n,o){let i=I(e,r,n);return y.Update(tn(i),{},o)}function zE(e,r,n,o){return j0(e,r,n,o)}function YE(e,r,n){let o=ve(r);return re(e,o,n)}function VE(e,r,n){return st(n)?re(e,r,n.iteratorItems):K(e,er(r),n)}function vc(e,r,n){return r===n?R(e):F()}function B0(e,r,n){return X(n)?vc(e,r,n.const):At(n)?R(e):K(e,Y(r),n)}function q0(e,r,n){return X(n)?vc(e,r,n.const):lt(n)?R(e):K(e,Y(r),n)}function F0(e,r,n){return X(n)?vc(e,r,n.const):be(n)?R(e):K(e,Y(r),n)}function H0(e,r,n){return X(n)?vc(e,r,n.const):Me(n)?R(e):K(e,Y(r),n)}function QE(e,r,n){return s.IsBigInt(r.const)?B0(e,r.const,n):s.IsBoolean(r.const)?q0(e,r.const,n):s.IsNumber(r.const)?F0(e,r.const,n):s.IsString(r.const)?H0(e,r.const,n):H()}function WE(e,r,n){return we(n)?K(e,r,n):R(e)}function ZE(e,r,n){return tr(n)?R(e):K(e,r,n)}function XE(e,r,n){return be(n)?R(e):K(e,r,n)}function K0(e,r,n){return Be(r)?Be(n)?R(e):F():R(e)}function z0(e,r,n){return we(n)&&hr(n.extends)?F():(()=>{let o=re(e,r,n);return Ae(o)?K0(o.inferred,r,n):F()})()}function Y0(e,r){return e.reduce((n,o)=>o in r?Ae(r[o])?{...n,...r[o].inferred}:H():H(),{})}function V0(e,r,n){let o={};for(let c of s.Keys(n))o[c]=c in r?z0({},r[c],n[c]):Be(n[c])?we(n[c])?R(y.Assign(e,{[n[c].name]:n[c].extends})):R(e):F();let i=s.Values(o).every(c=>Ae(c)),a=i?Y0(s.Keys(o),o):{};return i?R(a):F()}function Q0(e,r,n){let o=V0(e,r,n);return Ae(o)?R(y.Assign(e,o.inferred)):F()}function W0(e,r,n){return Q0(e,r,n)}function JE(e,r,n){return k(n)?W0(e,r,n.properties):K(e,N(r),n)}function e_(e,r,n){return tt(n)?re(e,r,n.item):K(e,nr(r),n)}function t_(e,r,n){return Me(n)?R(e):K(e,r,n)}function r_(e,r,n){return rr(n)?R(e):K(e,r,n)}function n_(e,r,n){let o=nt(r);return re(e,o,n)}function zu(e,r){return y.Create({"~kind":"Inferrable"},{name:e,type:r},{})}function _a(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"name")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"Inferrable")&&s.IsString(e.name)&&s.IsObject(e.type)}function Yu(e){return Xr(e)?we(e.items)?te(e.items.extends)?zu(e.items.name,e.items.extends.items):It(e.items.extends)?zu(e.items.name,e.items.extends):void 0:H():void 0}function kc(e){return we(e)?zu(e.name,e.extends):void 0}function Vu(e,r,n=[]){let[o,...i]=e;return A(o)?(()=>{let a=re({},o,r);return Ae(a)?Vu(i,r,[...n,o]):void 0})():n}function o_(e,r,n,o){let i=Vu(n,o);return s.IsArray(i)?R(y.Assign(e,{[r]:Ye(i)})):F()}function Mc(e,r,n,o){let i=Vu(n,o);return s.IsArray(i)?R(y.Assign(e,{[r]:B(i)})):F()}function Z0(e){return[...e].reverse()}function Qu(e,r){return r?Z0(e):e}function X0(e){let r=e.length>0?e[0]:void 0,n=A(r)?Yu(r):void 0;return A(n)}function J0(e,r,n,o,i,a){let c=re(e,n,i);return Ae(c)?i_(c.inferred,r,o,a):F()}function eD(e,r,n,o,i){let a=Yu(o);return _a(a)?o_(e,a.name,Qu(n,r),a.type):(()=>{let[c,...l]=n;return A(c)?J0(e,r,c,l,o,i):F()})()}function tD(e,r,n,o){let[i,...a]=o;return A(i)?eD(e,r,n,i,a):s.IsEqual(n.length,0)?R(e):F()}function i_(e,r,n,o){return tD(e,r,n,o)}function rD(e,r,n){let o=Dc(e,{callstack:[]},n),i=X0(o);return i_(e,i,Qu(r,i),Qu(o,i))}function a_(e,r,n){let o=kc(n);return _a(o)?Mc(e,o.name,r,o.type):(()=>{let[i,...a]=r;return A(i)?(()=>{let c=re(e,i,n);return Ae(c)?a_(c.inferred,a,n):F()})():R(e)})()}function s_(e,r,n){let o=Dc(e,{callstack:[]},r);return V(n)?rD(e,o,n.items):te(n)?a_(e,o,n.items):K(e,Ye(o),n)}function c_(e,r,n){return Rt(n)?R(e):or(n)?R(e):K(e,r,n)}function p_(e,r,n){let[o,...i]=n;return A(o)?(()=>{let a=re(e,r,o);return Ae(a)?R(a.inferred):p_(e,r,i)})():F()}function Wu(e,r,n){let[o,...i]=r;return A(o)?(()=>{let a=p_(e,o,n);return Ae(a)?Wu(a.inferred,i,n):F()})():R(e)}function u_(e,r,n){let o=kc(n);return _a(o)?Mc(e,o.name,r,o.type):O(n)?Wu(e,r,n.anyOf):Wu(e,r,[n])}function l_(e,r,n){return we(n)?K(e,r,n):pt(n)?R(e):It(n)?R(e):F()}function m_(e,r,n){return Rt(n)?R(e):K(e,r,n)}function re(e,r,n){return pt(r)?PE(e,r,n):te(r)?UE(e,r,r.items,n):at(r)?wE(e,r.iteratorItems,n):At(r)?NE(e,r,n):lt(r)?LE(e,r,n):qe(r)?vE(e,r.parameters,r.instanceType,n):Ne(r)?kE(e,r,n):Fe(r)?ME(e,r.parameters,r.returnType,n):ze(r)?DE(e,r,n):w(r)?YE(e,r.allOf,n):st(r)?VE(e,r.iteratorItems,n):X(r)?QE(e,r,n):hr(r)?WE(e,r,n):tr(r)?ZE(e,r,n):be(r)?XE(e,r,n):k(r)?JE(e,r.properties,n):tt(r)?e_(e,r.item,n):Me(r)?t_(e,r,n):rr(r)?r_(e,r,n):Le(r)?n_(e,r.pattern,n):V(r)?s_(e,r.items,n):or(r)?c_(e,r,n):O(r)?u_(e,r.anyOf,n):It(r)?l_(e,r,n):Rt(r)?m_(e,r,n):F()}function Ro(e,r,n={}){return P("Interface",[e,r],n)}function vo(e){return A(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function d_(e,r,n={}){return C({},Ro(e,r,n))}function nD(e,r,n){return e.includes(n)?!0:rn([...e,n],r,r[n])}function f_(e,r,n){let o=yc(n);return Dn(e,r,o)}function Dn(e,r,n){let[o,...i]=n;return A(o)?rn(e,r,o)?!0:Dn(e,r,i):!1}function rn(e,r,n){return ue(n)?nD(e,r,n.$ref):te(n)?rn(e,r,n.items):at(n)?rn(e,r,n.iteratorItems):qe(n)?Dn(e,r,[...n.parameters,n.instanceType]):Fe(n)?Dn(e,r,[...n.parameters,n.returnType]):vo(n)?f_(e,r,n.parameters[1]):w(n)?Dn(e,r,n.allOf):st(n)?rn(e,r,n.iteratorItems):k(n)?f_(e,r,n.properties):tt(n)?rn(e,r,n.item):O(n)?Dn(e,r,n.anyOf):V(n)?Dn(e,r,n.items):Se(n)?rn(e,r,rt(n)):!1}function Gc(e,r,n){return rn(e,r,n)}function oD(e,r){return r.reduce((n,o)=>o in e?Gc([o],e,e[o])?[...n,o]:n:H(),[])}function g_(e){let r=fy(e);return oD(e,r)}function iD(e,r,n){return n.includes(r)?n:r in e?nn(e,e[r],[...n,r]):H()}function y_(e,r,n){let o=yc(r);return ko(e,o,n)}function ko(e,r,n){return r.reduce((o,i)=>nn(e,i,o),n)}function nn(e,r,n){return ue(r)?iD(e,r.$ref,n):te(r)?nn(e,r.items,n):at(r)?nn(e,r.iteratorItems,n):qe(r)?ko(e,[...r.parameters,r.instanceType],n):Fe(r)?ko(e,[...r.parameters,r.returnType],n):vo(r)?y_(e,r.parameters[1],n):w(r)?ko(e,r.allOf,n):st(r)?nn(e,r.iteratorItems,n):k(r)?y_(e,r.properties,n):tt(r)?nn(e,r.item,n):O(r)?ko(e,r.anyOf,n):V(r)?ko(e,r.items,n):Se(r)?nn(e,rt(r),n):n}function h_(e,r,n){return nn(e,n,[r])}function aD(e){return ho()}function sD(e){return s.Keys(e).reduce((r,n)=>({...r,[n]:ar(e[n])}),{})}function Ia(e){return e.reduce((r,n)=>[...r,ar(n)],[])}function ar(e){return ue(e)?aD(e.$ref):te(e)?Ht(ar(e.items),cc(e)):at(e)?Xt(ar(e.iteratorItems)):qe(e)?zr(Ia(e.parameters),ar(e.instanceType)):Fe(e)?Yr(Ia(e.parameters),ar(e.returnType)):w(e)?wt(Ia(e.allOf)):st(e)?er(ar(e.iteratorItems)):k(e)?N(sD(e.properties)):tt(e)?nr(ar(e.item)):Se(e)?Tc(Oo(e),ar(rt(e))):O(e)?B(Ia(e.anyOf)):V(e)?Ye(Ia(e.items)):e}function cD(e,r){return r in e?ar(e[r]):Je()}function T_(e){return cD(e.$defs,e.$ref)}function pD(e,r,n){let o=Ct(e,{callstack:[]},r),i=ba({},{callstack:[]},n);return ve([...o,N(i)])}function uD(e,r){return s.Keys(e).filter(o=>r.includes(o)).reduce((o,i)=>{let a=e[i],c=vo(a)?pD(e,a.parameters[0],a.parameters[1]):a;return{...o,[i]:c}},{})}function E_(e,r,n){let o=h_(e,r,n),i=uD(e,o);return Jt(i,r)}function __(e,r){return r in e?ue(e[r])?__(e,e[r].$ref):e[r]:Z()}function sr(e,r){return __(e,r)}function I_(e){return me(e)?T_(e):e}function ot(e,r,n){let o=I_(r),i=I_(n);return re(e,o,i)}function lD(e,r,n){if(we(r)||Mo(r)||L.IsExtendsTrueLike(ot({},r,n)))return;let o={parameter:e,extends:n,received:r};throw new Error("Generic argument does not satify constraint",{cause:o})}function b_(e,r,n,o,i){let a=I(e,r,i);return lD(n,a,o),y.Assign(e,{[n]:a})}function mD(e,r,n,o,i){let a=I(e,r,n.extends),c=I(e,r,n.equals),[l,...d]=i;return A(l)?Zu(b_(e,r,n.name,a,l),r,o,d):Zu(b_(e,r,n.name,a,c),r,o,[])}function Zu(e,r,n,o){let[i,...a]=n;return A(i)?mD(e,r,i,a,o):e}function S_(e,r,n,o){return Zu(e,r,n,o)}function dD(e){return s.IsGreaterThan(e.length,0)?e[0]:""}function O_(e,r,n,o){let i=Ct(e,r,o);return bc(n,i)}function fD(e,r,n,o){return O_(e,r,ke(n),o)}function gD(e,r,n,o,i,a){let c=Ct(e,r,a),l=S_(e,r,o,c),d=I(l,{callstack:[...r.callstack,n]},i);return I(e,r,d)}function $c(e,r,n,o){let[i,a]=Hg(e,n,o);return yo(a)?s.IsEqual(dD(r.callstack),i)?fD(e,r,i,o):gD(e,r,i,a.parameters,a.expression,o):O_(e,r,n,o)}function bc(e,r){return y.Create({"~kind":"Call"},{target:e,arguments:r},{})}function A_(e,r){return $c({},{callstack:[]},e,r)}function Mo(e){return S(e,"Call")}function x_(e){return tt(e)?x_(e.item):e}function yD(e,r,n,o){let i=I(e,r,n);return y.Update(x_(i),{},o)}function R_(e,r,n,o){return v(e,[n])?yD(e,r,n,o):ma(n,o)}function C_(e,r){return e(r)}function P_(e,r){return s.IsString(r)?Y(C_(e,r)):Y(r)}function U_(e,r){let n=nt(r);return _r(e,n)}function w_(e,r){let n=r.map(o=>_r(e,o));return B(n)}function _r(e,r){return X(r)?P_(e,r.const):Le(r)?U_(e,r.pattern):O(r)?w_(e,r.anyOf):r}function Qi(e,r={}){return P("Capitalize",[e],r)}function N_(e,r={}){return C({},Qi(e,r))}function Wi(e,r={}){return P("Lowercase",[e],r)}function L_(e,r={}){return C({},Wi(e,r))}function Zi(e,r={}){return P("Uncapitalize",[e],r)}function v_(e,r={}){return C({},Zi(e,r))}function Xi(e,r={}){return P("Uppercase",[e],r)}function k_(e,r={}){return C({},Xi(e,r))}var hD=e=>e[0].toUpperCase()+e.slice(1),TD=e=>e.toLowerCase(),ED=e=>e[0].toLowerCase()+e.slice(1),_D=e=>e.toUpperCase();function ID(e,r,n,o){let i=I(e,r,n);return y.Update(_r(hD,i),{},o)}function M_(e,r,n,o){return v(e,[n])?ID(e,r,n,o):Qi(n,o)}function bD(e,r,n,o){let i=I(e,r,n);return y.Update(_r(TD,i),{},o)}function D_(e,r,n,o){return v(e,[n])?bD(e,r,n,o):Wi(n,o)}function SD(e,r,n,o){let i=I(e,r,n);return y.Update(_r(ED,i),{},o)}function G_(e,r,n,o){return v(e,[n])?SD(e,r,n,o):Zi(n,o)}function OD(e,r,n,o){let i=I(e,r,n);return y.Update(_r(_D,i),{},o)}function $_(e,r,n,o){return v(e,[n])?OD(e,r,n,o):Xi(n,o)}function Ji(e,r,n,o,i={}){return P("Conditional",[e,r,n,o],i)}function j_(e,r,n,o,i={}){return C({},Ji(e,r,n,o,i))}function AD(e,r,n,o,i,a,c){let l=I(e,r,n),d=I(e,r,o),f=ot(e,l,d);return y.Update(L.IsExtendsUnion(f)?B([I(f.inferred,r,i),I(e,r,a)]):L.IsExtendsTrue(f)?I(f.inferred,r,i):I(e,r,a),{},c)}function B_(e,r,n,o,i,a,c){return v(e,[n,o])?AD(e,r,n,o,i,a,c):Ji(n,o,i,a,c)}function ea(e,r={}){return P("ConstructorParameters",[e],r)}function q_(e,r={}){return C({},ea(e,r))}function xD(e){return qe(e)?I({},{callstack:[]},Ye(e.parameters)):Z()}function RD(e,r,n,o){let i=I(e,r,n);return y.Update(xD(i),{},o)}function F_(e,r,n,o){return v(e,[n])?RD(e,r,n,o):ea(n,o)}function ta(e,r,n={}){return P("Exclude",[e,r],n)}function H_(e,r,n={}){return C({},ta(e,r,n))}function K_(e,r){return e.reduce((n,o)=>[...n,...z_(o,r)],[])}function z_(e,r){let n=ot({},e,r);return L.IsExtendsTrueLike(n)?[]:[e]}function CD(e,r){let n=Ne(e)?K_(Kt(e.enum),r):O(e)?K_(ir(e.anyOf),r):z_(e,r);return Er(n)}function PD(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(CD(a,c),{},i)}function jc(e,r,n,o,i){return v(e,[n,o])?PD(e,r,n,o,i):ta(n,o,i)}function ra(e,r,n={}){return P("Extract",[e,r],n)}function Y_(e,r,n={}){return C({},ra(e,r,n))}function V_(e,r){return e.reduce((n,o)=>[...n,...Q_(o,r)],[])}function Q_(e,r){let n=ot({},e,r);return L.IsExtendsTrueLike(n)?[e]:[]}function UD(e,r){let n=Ne(e)?V_(Kt(e.enum),r):O(e)?V_(ir(e.anyOf),r):Q_(e,r);return Er(n)}function wD(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(UD(a,c),{},i)}function W_(e,r,n,o,i){return v(e,[n,o])?wD(e,r,n,o,i):ra(n,o,i)}var ND=new RegExp("^(?:0|[1-9][0-9]*)$");function Do(e){let r=`${e}`;return ND.test(r)?parseInt(r):e}function LD(e){return Y(Do(e))}function Z_(e){return e.map(r=>X_(r))}function X_(e){return w(e)?wt(Z_(e.allOf)):O(e)?B(Z_(e.anyOf)):X(e)?LD(e.const):e}function J_(e,r){let n=X_(r),o=ot({},n,Nt());return L.IsExtendsTrueLike(o)?e:Z()}function eI(e,r){let n=sr(e,r);return cr(n)}function Bc(e){return e.reduce((r,n)=>[...r,...cr(n)],[])}function tI(e){let r=Kt(e);return Bc(r)}function rI(e){let r=ve(e);return cr(r)}function nI(e){return[`${e}`]}function oI(e){let r=nt(e);return cr(r)}function cr(e){return me(e)?eI(e.$defs,e.$ref):Ne(e)?tI(e.enum):w(e)?rI(e.allOf):X(e)?nI(e.const):Le(e)?oI(e.pattern):O(e)?Bc(e.anyOf):[]}function Go(e){return cr(e)}function vD(e,r){return r in e?[e[r]]:[]}function kD(e,r){return r.reduce((n,o)=>[...n,...vD(e,o)],[])}function iI(e,r){let n=Go(r),o=kD(e,n);return Er(o)}function MD(e){return Y(Do(e))}function aI(e){return e.map(r=>Xu(r))}function Xu(e){return w(e)?wt(aI(e.allOf)):O(e)?B(aI(e.anyOf)):X(e)?MD(e.const):e}function DD(e,r){return e.reduceRight((n,o,i)=>{let a=ot({},Y(i),r);return L.IsExtendsTrueLike(a)?[o,...n]:n},[])}function GD(e,r){let n=Xu(r),o=DD(e,n);return Mn(o)}function $D(e){return Mn(e)}function sI(e,r){return be(r)||ze(r)?$D(e):GD(e,r)}function jD(e){return e.reduce((r,n)=>fc(n)?[...r,Y(n)]:r,[])}function $o(e){let r=jD(e);return B(r)}function Co(e,r,n={}){return P("Index",[e,r],n)}function cI(e,r,n={}){let o=s.IsArray(r)?$o(r):r;return C({},Co(e,o,n))}function pI(e,r){let n=sr(e,r);return zt(n)}function BD(e,r){let n=s.Keys(e).filter(g=>!s.HasPropertyKey(r,g)),o=s.Keys(r).filter(g=>!s.HasPropertyKey(e,g)),i=s.Keys(e).filter(g=>s.HasPropertyKey(r,g)),a=n.reduce((g,T)=>({...g,[T]:e[T]}),{}),c=o.reduce((g,T)=>({...g,[T]:r[T]}),{}),l=i.reduce((g,T)=>({...g,[T]:ve([e[T],r[T]])}),{}),d=y.Assign(a,c);return y.Assign(d,l)}function uI(e){return e.reduce((r,n)=>BD(r,zt(n)),{})}function lI(e){let r=GE(Ye(e));return zt(r)}function qD(e,r){return s.Keys(e).filter(i=>i in r).reduce((i,a)=>({...i,[a]:Er([e[a],r[a]])}),{})}function mI(e,r){let[n,...o]=e;return A(n)?mI(o,qD(r,zt(n))):r}function dI(e){let[r,...n]=e;return A(r)?mI(n,zt(r)):H()}function zt(e){return me(e)?pI(e.$defs,e.$ref):w(e)?uI(e.allOf):O(e)?dI(e.anyOf):V(e)?lI(e.items):k(e)?e.properties:{}}function jo(e){let r=zt(e);return N(r)}function FD(e){return me(e)||w(e)||O(e)?jo(e):e}function HD(e,r){let n=FD(e);return te(n)?J_(n.items,r):k(n)?iI(n.properties,r):V(n)?sI(n.items,r):Z()}function KD(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(HD(a,c),{},i)}function fI(e,r,n,o,i){return v(e,[n,o])?KD(e,r,n,o,i):Co(n,o,i)}function na(e,r={}){return P("InstanceType",[e],r)}function gI(e,r={}){return C({},na(e,r))}function zD(e){return qe(e)?e.instanceType:Z()}function YD(e,r,n,o){let i=I(e,r,n);return y.Update(zD(i),{},o)}function yI(e,r,n,o={}){return v(e,[n])?YD(e,r,n,o):na(n,o)}function VD(e,r,n,o,i){let a=Ct(e,{callstack:[]},n),c=ba(e,{callstack:[]},o),l=ve([...a,N(c)]);return y.Update(l,{},i)}function hI(e,r,n,o,i){return v(e,n)?VD(e,r,n,o,i):Ro(n,o,i)}function Po(e,r={}){return P("KeyOf",[e],r)}function TI(e,r={}){return C({},Po(e,r))}function EI(){return B([Nt(),bt(),Io()])}function _I(e){return Nt()}function QD(e){return e.reduce((n,o)=>fc(o)?[...n,Y(Do(o))]:H(),[])}function II(e){let r=s.Keys(e),n=QD(r);return Mn(n)}function bI(e){return Oo(e)}function SI(e){let r=e.map((n,o)=>Y(o));return Mn(r)}function WD(e){return me(e)||w(e)||O(e)?jo(e):e}function ZD(e){let r=WD(e);return pt(r)?EI():te(r)?_I(r.items):k(r)?II(r.properties):Se(r)?bI(r):V(r)?SI(r.items):Z()}function XD(e,r,n,o){let i=I(e,r,n);return y.Update(ZD(i),{},o)}function OI(e,r,n,o){return v(e,[n])?XD(e,r,n,o):Po(n,o)}function JD(e){let r=nt(e);return Ju(r)}function AI(e){return e.reduce((r,n)=>[...r,...Ju(n)],[])}function Ju(e){return Ne(e)?AI(Kt(e.enum)):_o(e)||Eo(e)?[e]:Le(e)?JD(e.pattern):O(e)?AI(e.anyOf):[]}function xI(e){return Ju(e)}function xo(e,r,n,o,i={}){return P("Mapped",[e,r,n,o],i)}function RI(e,r,n,o,i={}){return C({},xo(e,r,n,o,i))}function eG(e,r,n,o,i){let a=y.Assign(e,{[n.name]:o}),c=I(a,r,i);return Le(c)?nt(c.pattern):c}function tG(e,r,n,o,i){let a=y.Assign(e,{[n.name]:o});return I(a,r,i)}function rG(e,r,n,o,i,a){let c=tG(e,r,n,o,a),l=eG(e,r,n,o,i);return _o(l)||Eo(l)?{[l.const]:c}:{}}function nG(e,r,n,o,i,a){return o.reduce((c,l)=>({...c,...rG(e,r,n,l,i,a)}),{})}function oG(e,r,n,o,i,a){let c=xI(o),l=nG(e,r,n,c,i,a);return N(l)}function iG(e,r,n,o,i,a,c){let l=I(e,r,o);return y.Update(oG(e,r,n,l,i,a),{},c)}function CI(e,r,n,o,i,a,c){return v(e,[o])?iG(e,r,n,o,i,a,c):xo(n,o,i,a,c)}function aG(e,r){return s.Keys(e).filter(o=>r.includes(o)).reduce((o,i)=>({...o,[i]:E_(e,i,e[i])}),{})}function sG(e,r){return s.Keys(e).filter(o=>!r.includes(o)).reduce((o,i)=>({...o,[i]:I(e,{callstack:[]},e[i])}),{})}function cG(e,r){let n=g_(e),o=aG(e,n),i=sG(e,n),a={...o,...i};return y.Update(a,{},r)}function PI(e,r,n,o){let i=y.Assign(e,n);return cG(i,o)}function oa(e,r={}){return P("NonNullable",[e],r)}function UI(e,r={}){return C({},oa(e,r))}function pG(e){let r=B([Zr(),Ao()]);return jc({},{callstack:[]},e,r,{})}function uG(e,r,n,o){let i=I(e,r,n);return y.Update(pG(i),{},o)}function wI(e,r,n,o){return v(e,[n])?uG(e,r,n,o):oa(n,o)}function qc(e){let r=jo(e);return k(r)?r.properties:H()}function ia(e,r,n={}){return P("Omit",[e,r],n)}function NI(e,r,n={}){let o=s.IsArray(r)?$o(r):r;return C({},ia(e,o,n))}function lG(e,r){return s.Keys(e).reduce((o,i)=>r.includes(i)?o:{...o,[i]:e[i]},{})}function mG(e,r){let n=qc(e),o=Go(r),i=lG(n,o);return N(i)}function dG(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(mG(a,c),{},i)}function LI(e,r,n,o,i){return v(e,[n,o])?dG(e,r,n,o,i):ia(n,o,i)}function Uo(e,r){return P("Options",[e,r],{})}function Fc(e,r){return C({},Uo(e,r))}function fG(e,r,n,o){let i=I(e,r,n);return y.Update(i,{},o)}function vI(e,r,n,o){return v(e,[n])?fG(e,r,n,o):Uo(n,o)}function aa(e,r={}){return P("Parameters",[e],r)}function kI(e,r={}){return C({},aa(e,r))}function gG(e){return Fe(e)?I({},{callstack:[]},Ye(e.parameters)):Z()}function yG(e,r,n,o){let i=I(e,r,n);return y.Update(gG(i),{},o)}function MI(e,r,n,o){return v(e,[n])?yG(e,r,n,o):aa(n,o)}function sa(e,r={}){return P("Partial",[e],r)}function DI(e,r={}){return C({},sa(e,r))}function GI(e,r){let n=sr(e,r),o=on(n);return Jt(y.Assign(e,{[r]:o}),r)}function $I(e){let r=e.map(n=>on(n));return ve(r)}function jI(e){let r=e.map(n=>on(n));return B(r)}function BI(e){let r=s.Keys(e).reduce((o,i)=>({...o,[i]:ic(e[i])}),{});return N(r)}function on(e){return me(e)?GI(e.$defs,e.$ref):w(e)?$I(e.allOf):O(e)?jI(e.anyOf):k(e)?BI(e.properties):N({})}function hG(e,r,n,o){let i=I(e,r,n);return y.Update(on(i),{},o)}function qI(e,r,n,o){return v(e,[n])?hG(e,r,n,o):sa(n,o)}function ca(e,r,n={}){return P("Pick",[e,r],n)}function FI(e,r,n={}){let o=s.IsArray(r)?$o(r):r;return C({},ca(e,o,n))}function TG(e,r){return s.Keys(e).reduce((o,i)=>r.includes(i)?y.Assign(o,{[i]:e[i]}):o,{})}function EG(e,r){let n=qc(e),o=Go(r),i=TG(n,o);return N(i)}function _G(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(EG(a,c),{},i)}function HI(e,r,n,o,i){return v(e,[n,o])?_G(e,r,n,o,i):ca(n,o,i)}function pa(e,r={}){return P("ReadonlyType",[e],r)}function KI(e,r={}){return C({},pa(e,r))}function zI(e){return Kr(Ht(e))}function YI(e,r){let n=sr(e,r),o=an(n);return Jt(y.Assign(e,{[r]:o}),r)}function VI(e){let r=e.map(n=>an(n));return ve(r)}function QI(e){let r=s.Keys(e).reduce((o,i)=>({...o,[i]:sc(e[i])}),{});return N(r)}function WI(e){return Kr(Ye(e))}function ZI(e){let r=e.map(n=>an(n));return B(r)}function an(e){return te(e)?zI(e.items):me(e)?YI(e.$defs,e.$ref):w(e)?VI(e.allOf):k(e)?QI(e.properties):V(e)?WI(e.items):O(e)?ZI(e.anyOf):e}function IG(e,r,n,o){let i=I(e,r,n);return y.Update(an(i),{},o)}function XI(e,r,n,o){return v(e,[n])?IG(e,r,n,o):pa(n,o)}function JI(e){return St($t,e)}function eb(e){return N({true:e,false:e})}function tb(e,r){let n=da(e);return sn(n,r)}function rb(e,r){return St(bo,r)}function nb(e,r){let n=ve(e);return sn(n,r)}function ob(e,r){return s.IsString(e)||s.IsNumber(e)?N({[e]:r}):s.IsEqual(e,!1)?N({false:r}):s.IsEqual(e,!0)?N({true:r}):N({})}function ib(e,r){return St(So,r)}function ab(e,r){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?St(e.pattern.toString(),r):St($t,r)}function sb(e,r){let n=wc(e);return Nc(n)?sn(nt(e),r):St(e,r)}function bG(e){return e.some(r=>Me(r)||be(r)||ze(r))}function SG(e,r){return s.IsEqual(bG(e),!0)?St($t,r):void 0}function OG(e,r){return e.reduce((n,o)=>X(o)&&(s.IsString(o.const)||s.IsNumber(o.const))?{...n,[o.const]:r}:n,{})}function AG(e,r){let n=OG(e,r);return N(n)}function cb(e,r){let n=ir(e),o=SG(n,r);return A(o)?o:AG(n,r)}function sn(e,r){return pt(e)?JI(r):lt(e)?eb(r):Ne(e)?tb(e.enum,r):ze(e)?rb(e,r):w(e)?nb(e.allOf,r):X(e)?ob(e.const,r):be(e)?ib(e,r):O(e)?cb(e.anyOf,r):Me(e)?ab(e,r):Le(e)?sb(e.pattern,r):N({})}function xG(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(sn(a,c),{},i)}function pb(e,r,n,o,i){return v(e,[n])?xG(e,r,n,o,i):Yi(n,o,i)}function ub(e,r,n){return n in e?Gc([n],e,e[n])?ke(n):I(e,r,e[n]):ke(n)}function lb(e,r){let n=sr(e,r),o=cn(n);return Jt(y.Assign(e,{[r]:o}),r)}function mb(e){let r=e.map(n=>cn(n));return ve(r)}function db(e){let r=e.map(n=>cn(n));return B(r)}function fb(e){let r=s.Keys(e).reduce((o,i)=>({...o,[i]:go(e[i])}),{});return N(r)}function cn(e){return me(e)?lb(e.$defs,e.$ref):w(e)?mb(e.allOf):O(e)?db(e.anyOf):k(e)?fb(e.properties):N({})}function ua(e,r={}){return P("Required",[e],r)}function gb(e,r={}){return C({},ua(e,r))}function RG(e,r,n,o){let i=I(e,r,n);return y.Update(cn(i),{},o)}function yb(e,r,n,o){return v(e,[n])?RG(e,r,n,o):ua(n,o)}function la(e,r={}){return P("ReturnType",[e],r)}function hb(e,r={}){return C({},la(e,r))}function CG(e){return Fe(e)?e.returnType:Z()}function PG(e,r,n,o){let i=I(e,r,n);return y.Update(CG(i),{},o)}function Tb(e,r,n,o){return v(e,[n])?PG(e,r,n,o):la(n,o)}function Eb(e){return y.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function UG(e){return e.join("|")}function wG(e){return e.slice(1,e.length-1)}function NG(e,r,n){return pn(r,`${n}${e}`)}function LG(e,r){return pn(e,`${r}${cy}`)}function vG(e,r){return pn(e,`${r}${dc}`)}function kG(e,r){return pn(e,`${r}${gc}`)}function MG(e,r){return tl(B([Y("false"),Y("true")]),e,r)}function DG(e,r){return pn(e,`${r}${hc}`)}function GG(e,r,n){return pn(r,`${n}${wG(e)}`)}function $G(e,r,n,o=[]){let i=Kt(e);return el(i,r,n)}function el(e,r,n,o=[]){let[i,...a]=e;return A(i)?el(a,r,n,[...o,tl(i,[],"")]):pn(r,`${n}(${UG(o)})`)}function tl(e,r,n){return Ne(e)?$G(e.enum,r,n):ze(e)?vG(r,n):X(e)?NG(e.const,r,n):At(e)?LG(r,n):lt(e)?MG(r,n):be(e)?kG(r,n):Me(e)?DG(r,n):Le(e)?GG(e.pattern,r,n):O(e)?el(e.anyOf,r,n):qg}function pn(e,r){let[n,...o]=e;return A(n)?tl(n,o,r):r}function jG(e){return`^${pn(e,"")}$`}function _b(e){let r=jG(e);return Eb(r)}function BG(e,r,n,o){let i=Ct(e,r,n);return y.Update(_b(i),{},o)}function Ib(e,r,n,o){return v(e,n)?BG(e,r,n,o):Vi(n,o)}function qG(e){return Xr(e)?V(e.items)?rl(e.items.items):we(e.items)?[e]:ue(e.items)?[e]:[Z()]:[e]}function rl(e){return e.reduce((n,o)=>[...n,...qG(o)],[])}function FG(e,r){return r in e}function HG(e,r){return w(r)?v(e,r.allOf):O(r)?v(e,r.anyOf):ue(r)?FG(e,r.$ref):!0}function v(e,r){let[n,...o]=r;return A(n)?HG(e,n)?v(e,o):!1:!0}function Sa(e,r,n){return Mg(e)?Sa(e.type,"remove",n):Ng(e)?Sa(e.type,r,"remove"):vg(e)?Sa(e.type,"add",n):Ug(e)?Sa(e.type,r,"add"):[e,r,n]}function KG(e,r){return s.IsEqual(e,"remove")?ac(r):s.IsEqual(e,"add")?_t(r):r}function zG(e,r){return s.IsEqual(e,"remove")?go(r):s.IsEqual(e,"add")?Et(r):r}function ba(e,r,n){return s.Keys(n).reduce((o,i)=>({...o,[i]:I(e,r,n[i])}),{})}function Dc(e,r,n){let o=Ct(e,r,n);return rl(o)}function Ct(e,r,n){return n.map(o=>I(e,r,o))}function YG(e,r,n,o,i){return s.IsEqual(n,"Awaited")?R_(e,r,o[0],i):s.IsEqual(n,"Capitalize")?M_(e,r,o[0],i):s.IsEqual(n,"Conditional")?B_(e,r,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"ConstructorParameters")?F_(e,r,o[0],i):s.IsEqual(n,"Evaluate")?zE(e,r,o[0],i):s.IsEqual(n,"Exclude")?jc(e,r,o[0],o[1],i):s.IsEqual(n,"Extract")?W_(e,r,o[0],o[1],i):s.IsEqual(n,"Index")?fI(e,r,o[0],o[1],i):s.IsEqual(n,"InstanceType")?yI(e,r,o[0],i):s.IsEqual(n,"Interface")?hI(e,r,o[0],o[1],i):s.IsEqual(n,"KeyOf")?OI(e,r,o[0],i):s.IsEqual(n,"Lowercase")?D_(e,r,o[0],i):s.IsEqual(n,"Mapped")?CI(e,r,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"Module")?PI(e,r,o[0],i):s.IsEqual(n,"NonNullable")?wI(e,r,o[0],i):s.IsEqual(n,"Pick")?HI(e,r,o[0],o[1],i):s.IsEqual(n,"Options")?vI(e,r,o[0],o[1]):s.IsEqual(n,"Parameters")?MI(e,r,o[0],i):s.IsEqual(n,"Partial")?qI(e,r,o[0],i):s.IsEqual(n,"Omit")?LI(e,r,o[0],o[1],i):s.IsEqual(n,"ReadonlyType")?XI(e,r,o[0],i):s.IsEqual(n,"Record")?pb(e,r,o[0],o[1],i):s.IsEqual(n,"Required")?yb(e,r,o[0],i):s.IsEqual(n,"ReturnType")?Tb(e,r,o[0],i):s.IsEqual(n,"TemplateLiteral")?Ib(e,r,o[0],i):s.IsEqual(n,"Uncapitalize")?G_(e,r,o[0],i):s.IsEqual(n,"Uppercase")?$_(e,r,o[0],i):P(n,o,i)}function I(e,r,n){let o=Cn(n),i=Sa(n,Pn(n)?"add":"none",Be(n)?"add":"none"),a=Ut(i[0])?i[0].Clone():i[0],c=ue(a)?ub(e,r,a.$ref):te(a)?Ht(I(e,r,a.items),cc(a)):at(a)?Xt(I(e,r,a.iteratorItems),Gg(a)):Mo(a)?$c(e,r,a.target,a.arguments):qe(a)?zr(Ct(e,r,a.parameters),I(e,r,a.instanceType),jg(a)):Dg(a)?YG(e,r,a.action,a.parameters,a.options):Fe(a)?Yr(Ct(e,r,a.parameters),I(e,r,a.returnType),Bg(a)):w(a)?wt(Ct(e,r,a.allOf),Vg(a)):st(a)?er(I(e,r,a.iteratorItems),uy(a)):k(a)?N(ba(e,r,a.properties),gy(a)):tt(a)?nr(I(e,r,a.item),hy(a)):Se(a)?Ec(xt(a),I(e,r,rt(a))):Xr(a)?Ln(I(e,r,a.items)):V(a)?Ye(Dc(e,r,a.items),Ey(a)):O(a)?B(Ct(e,r,a.anyOf),_y(a)):a,l=o?Kr(c):c;return KG(i[1],zG(i[2],l))}function C(e,r){return I(e,{callstack:[]},r)}function ma(e,r={}){return P("Awaited",[e],r)}function bb(e,r={}){return C({},ma(e,r))}function Cu(e,r={}){return P("Evaluate",[e],r)}function Yt(e,r={}){return C({},Cu(e,r))}function Pu(e,r={}){return P("Module",[e],r)}function Sb(e,r={}){return C({},Pu(e,r))}function Ob(...e){let[r,n,o]=ie.Match(e,{2:(c,l)=>s.IsString(c)?[{},c,l]:[c,l,{}],3:(c,l,d)=>[c,l,d],1:c=>[{},c,{}]}),i=gE(n),a=s.IsArray(i)&&s.IsEqual(i.length,2)?I(r,{callstack:[]},i[0]):Z();return y.Update(a,{},o)}var t={};Gt(t,{Any:()=>ho,Array:()=>Ht,AsyncIterator:()=>Xt,Awaited:()=>bb,Base:()=>pc,BigInt:()=>Ki,Boolean:()=>mc,Call:()=>A_,Capitalize:()=>N_,Codec:()=>uc,Conditional:()=>j_,Constructor:()=>zr,ConstructorParameters:()=>q_,Cyclic:()=>Jt,Decode:()=>iy,DecodeBuilder:()=>Hi,Encode:()=>ay,EncodeBuilder:()=>Fi,Enum:()=>Yg,Evaluate:()=>Yt,Exclude:()=>H_,Extends:()=>ot,ExtendsResult:()=>L,Extract:()=>Y_,Function:()=>Yr,Generic:()=>Vr,Identifier:()=>zi,Immutable:()=>Kr,Index:()=>cI,Infer:()=>qi,InstanceType:()=>gI,Instantiate:()=>C,Integer:()=>wn,Interface:()=>d_,Intersect:()=>wt,IsAny:()=>pt,IsArray:()=>te,IsAsyncIterator:()=>at,IsBase:()=>Ut,IsBigInt:()=>At,IsBoolean:()=>lt,IsCall:()=>Mo,IsCodec:()=>Un,IsConstructor:()=>qe,IsCyclic:()=>me,IsEnum:()=>Ne,IsFunction:()=>Fe,IsGeneric:()=>yo,IsIdentifier:()=>py,IsImmutable:()=>Cn,IsInfer:()=>we,IsInteger:()=>ze,IsIntersect:()=>w,IsIterator:()=>st,IsKind:()=>S,IsLiteral:()=>X,IsNever:()=>hr,IsNull:()=>tr,IsNumber:()=>be,IsObject:()=>k,IsOptional:()=>Be,IsParameter:()=>yy,IsPromise:()=>tt,IsReadonly:()=>Pn,IsRecord:()=>Se,IsRef:()=>ue,IsRefine:()=>lc,IsRest:()=>Xr,IsSchema:()=>A,IsString:()=>Me,IsSymbol:()=>rr,IsTemplateLiteral:()=>Le,IsThis:()=>Ty,IsTuple:()=>V,IsUndefined:()=>or,IsUnion:()=>O,IsUnknown:()=>It,IsUnsafe:()=>by,IsVoid:()=>Rt,Iterator:()=>er,KeyOf:()=>TI,Literal:()=>Y,Lowercase:()=>L_,Mapped:()=>RI,Module:()=>Sb,Never:()=>Z,NonNullable:()=>UI,Null:()=>Zr,Number:()=>Nt,Object:()=>N,Omit:()=>NI,Optional:()=>ic,Options:()=>Fc,Parameter:()=>Nn,Parameters:()=>kI,Partial:()=>DI,Pick:()=>FI,Promise:()=>nr,Readonly:()=>sc,ReadonlyType:()=>KI,Record:()=>Tc,RecordKey:()=>Oo,RecordKeyAsPattern:()=>xt,RecordValue:()=>rt,Ref:()=>ke,Refine:()=>sy,Required:()=>gb,Rest:()=>Ln,ReturnType:()=>hb,Script:()=>Ob,String:()=>bt,Symbol:()=>Io,TemplateLiteral:()=>TE,This:()=>_c,Tuple:()=>Ye,Uncapitalize:()=>v_,Undefined:()=>Ao,Union:()=>B,Unknown:()=>Je,Unsafe:()=>Iy,Uppercase:()=>k_,Void:()=>Ic});var Ab="lowercase-email",nl="iana-timezone",ol="simple-time",il="simple-date-time";var VG=(e,r)=>RegExp(`^${e.source}(${r.source}${e.source})*$`),QG=/[a-zA-Z0-9-_]+/,WG=/\./,q_e=VG(QG,WG);var xb="lowercase-domain";var Bo="kebab-case";var Rb="camel-case";var ZG=new Set;function b(e,r,n={}){let o=r.map(i=>{let a=i;return a.$id?(ZG.add(i),t.Ref(a.$id)):i});return t.Unsafe({...n,type:"object",discriminator:{propertyName:e},required:[e],oneOf:o})}function xe(e,r){return t.Object({values:t.Array(e,{maxItems:r.maxItems,description:"Values compared by this filter. When `exclude` is omitted or false, rows matching any value are kept; when `exclude` is true, matching rows are removed."}),exclude:t.Optional(t.Boolean({description:"If true, exclude rows matching these values instead of including them"}))},{description:r.description})}var Fo=1e3,Hc=100,de={limit:t.Optional(t.Integer({minimum:1,maximum:Fo,description:"Maximum number of items to return in this page."})),offset:t.Optional(t.Integer({minimum:0,description:"Zero-based index of the first matching item to return. Increase it with `limit` to request later pages. If `limit` is provided without `offset`, the offset defaults to 0."}))},De={...de,limit:t.Optional(t.Integer({minimum:1,maximum:Fo,default:Hc,description:`Maximum number of items to return in this page. Omit to use the public API default of ${Hc}.`}))},XG=t.Object({totalCount:t.Integer({description:"Total number of items matching the query before `limit` and `offset` are applied."}),pageCount:t.Integer({description:"Total number of pages available for the requested `limit`."})},{description:"Counts describing the full result set that the returned page was taken from, for computing how many further pages remain."}),Y_e=t.Object({pagination:XG},{$id:"ResponseMetadata",description:"Metadata accompanying `data` on paginated operations, describing the full result set the page was taken from."});function E(e={}){return t.Unsafe({...e,type:"string"})}var qo=250;function p({allowEmpty:e=!0,type:r="short",description:n,default:o}={}){let i=e?0:1,a={...n===void 0?{}:{description:n},...o===void 0?{}:{default:o}};switch(r){case"camel-case":return t.String({format:Rb,minLength:i,maxLength:qo,...a});case"kebab-case":return t.String({format:Bo,minLength:i,maxLength:qo,...a});case"email":return t.String({format:Ab,minLength:i,maxLength:254,errorMessage:{format:"Must be a valid lowercase email address."},...a});case"lowercase-domain":return t.String({format:xb,minLength:i,maxLength:qo,...a});case"tsuga-query":return t.String({format:"tsuga-query",minLength:i,maxLength:1e4,...a});case"tags-query":return t.String({format:"tags-query",minLength:i,maxLength:1e4,errorMessage:{format:"Must be a valid tags query: only tag:value searches (no wildcards), boolean operators, and parentheses are supported. The query you provided is invalid: ${0}"},...a});case"date-time":return t.String({format:"date-time",...a});case"uri":return t.String({format:"uri",...a});case"user-password":return t.String({format:"user-password",minLength:12,maxLength:qo,...a});case"long":return t.String({minLength:i,maxLength:5e4,...a});case"short":return t.String({minLength:i,maxLength:qo,...a});case"tsuga-formula":return t.String({format:"tsuga-formula",minLength:i,maxLength:qo,errorMessage:{format:"Must be a simple mathematical formula, and all variables in it should refer to queries (q1, q2, etc.). The formula you provided is invalid: ${0}"},...a});case"time":return t.String({format:"time",...a});case"readonly-sql-query":return t.String({format:"readonly-sql-query",minLength:i,maxLength:5e4,errorMessage:{format:"Must be a readonly SQL query - only SELECT statements are allowed."},...a});default:Xe(r)}}var Oa=["ingestion-api-key","operation-api-key","rum-public-token","dashboard","log-route","metric-route","monitor","notification-rule","notification-silence","slo"],Kc=t.Array(t.Enum(Oa,{description:"Tsuga-managed asset type."}),{description:"Tsuga-managed asset types covered by the policy. An empty array means all supported asset types."});var al=["CLUSTER_DB_QUERY_INVALID_CONNECTION_PARAMS","CLUSTER_DB_QUERY_INVALID_CREDENTIALS","CLUSTER_DB_QUERY_PERMISSION_DENIED","CLUSTER_DB_QUERY_QUERY_SYNTAX_ERROR","CLUSTER_DB_QUERY_DATABASE_UNREACHABLE","CLUSTER_DB_QUERY_CONNECTION_FAILED","CLUSTER_DB_QUERY_QUERY_EXECUTION_FAILED","CLUSTER_DB_QUERY_QUERY_TIMEOUT"],iIe=t.Enum(al),JG=["CLUSTER_AGGREGATION_STRUCTURE"],aIe=t.Object({code:t.Enum(al),message:t.String()}),Cb=[...al,...JG,"ABORT_ERROR","BAD_REQUEST","DUPLICATE_KEY_VIOLATION","FOREIGN_KEY_VIOLATION","FST_ERR_VALIDATION","GROK_RULE_VALIDATION_ERROR","INVALID_INPUT","FORBIDDEN","MISSING_PERMISSION","PRIVILEGE_ESCALATION","RATE_LIMITED","RESERVED_TAG_POLICY_ERROR","RESOURCE_NOT_FOUND","INVALID_INVITATION","TAG_POLICY_ALREADY_EXISTS_ERROR","TAG_POLICY_VALIDATION_ERROR","UNAUTHORIZED","URL_NOT_FOUND"],Pb=["INTERNAL_ERROR","INVALID_QUERY_TO_CLUSTER"];var e$=["NETWORK_ERROR","RESPONSE_PARSE_ERROR"],t$=[...Cb,...Pb,...e$],r$=t.Object({assetId:t.Optional(t.String({description:"Identifier of the asset that violated the policy. Set from the existing asset for update and bulk requests. Omitted on create requests before the asset exists."})),assetName:t.String({description:"Name of the asset that violated the policy. Set from submitted data or the existing asset row. Returned for every violation."}),assetType:t.Enum(Oa,{description:"Type of Tsuga asset validated by the policy. Set by the route that ran tag-policy validation. Returned for every violation."}),tagPolicyId:t.String({description:"Identifier of the active tag policy that was violated. Generated by Tsuga when the policy is created. Returned for every violation."}),tagKey:t.String({description:"Tag key required or constrained by the violated policy. Set by the tag policy. Returned for every violation."}),message:t.String({description:"Human-readable reason this policy failed for the asset. Generated by Tsuga's tag-policy validator. Returned for every violation."})},{description:"A single tag-policy violation, identifying the offending asset, the policy and tag key involved, and why validation failed."}),n$=b("type",[t.Object({type:t.Literal("invalid-syntax",{description:"Discriminator identifying a rule the grok parser could not parse at all."}),error:t.Object({offset:t.Integer({description:"Byte offset in the rule where parsing failed."}),detail:t.String({description:"Parser detail message."})},{description:"Position and parser message for the syntax failure."})},{$id:"GrokInvalidSyntax"}),t.Object({type:t.Literal("unknown-pattern",{description:"Discriminator identifying a rule that references a pattern name the grok engine does not provide."}),error:t.Object({offset:t.Integer({description:"Byte offset of the unknown pattern."}),unknownPattern:t.String({description:"The pattern name that is not supported."})},{description:"Position and name of the unsupported pattern."})},{$id:"GrokUnknownPattern"}),t.Object({type:t.Literal("invalid-filter",{description:"Discriminator identifying a rule whose filter is a known filter used incorrectly."}),error:t.Object({offset:t.Integer({description:"Byte offset of the invalid filter."}),invalidFilter:t.String({description:"The filter that is invalid."}),message:t.String({description:"Why the filter is invalid."})},{description:"Position, text, and reason for the invalid filter."})},{$id:"GrokInvalidFilter"}),t.Object({type:t.Literal("unknown-filter",{description:"Discriminator identifying a rule that references a filter name the grok engine does not implement."}),error:t.Object({offset:t.Integer({description:"Byte offset of the unknown filter."}),unknownFilter:t.String({description:"The filter name that is not implemented."}),message:t.String({description:"Details about the unsupported filter."})},{description:"Position and name of the unimplemented filter."})},{$id:"GrokUnknownFilter"})],{description:"Full structured detail of a grok rule that failed to compile, discriminated by `type`."}),o$=t.Object({rule:t.String({description:"The rule that failed to compile."}),ruleIndex:t.Integer({description:"0-based index of the failing rule in the submitted `rules` array."}),error:n$},{description:"A single grok rule that failed to compile, with its position in the submitted rules and the structured compile error."}),Ub=b("type",[t.Object({type:t.Literal("tag_policy_violation",{description:"Discriminator identifying tag-policy validation details. Set by Tsuga to `tag_policy_violation`. Returned when the error code is `TAG_POLICY_VALIDATION_ERROR`."}),violations:t.Array(r$,{description:"Tag-policy violations that caused the request to fail. Built from active policies applicable to the submitted asset type and owner team. Returned on tag-policy validation errors; can contain multiple policies and multiple assets for bulk requests."})},{$id:"TagPolicyViolationDetails"}),t.Object({type:t.Literal("grok_rule_error",{description:"Discriminator identifying grok rule validation details. Set by Tsuga to `grok_rule_error`. Returned when the error code is `GROK_RULE_VALIDATION_ERROR`."}),ruleErrors:t.Array(o$,{description:"Grok rules that failed to compile, with full structured detail. One entry per invalid rule."})},{$id:"GrokRuleErrorDetails"})],{description:"Structured details for a client error. Set by Tsuga only for error types with machine-readable remediation data, and omitted for every other client error."}),sIe=t.Object({code:t.Optional(t.Enum(t$,{description:"Machine readable error code describing what went wrong"})),message:t.String({description:"Human readable explanation of the error"}),statusCode:t.Number({description:"HTTP status code that was returned"}),details:t.Optional(Ub)},{$id:"ErrorResponse",description:"Standard envelope for API errors"}),cIe=t.Object({code:t.Optional(t.Enum(Cb,{description:"Machine readable error code describing what went wrong"})),message:t.String({description:"Human readable explanation of the error"}),statusCode:t.Number({description:"HTTP status code that was returned"}),details:t.Optional(Ub)},{$id:"ClientErrorResponse",description:"Standard envelope for client (4XX) API errors"}),pIe=t.Object({code:t.Optional(t.Enum(Pb,{description:"Machine readable error code describing what went wrong"})),message:t.String({description:"Human readable explanation of the error"}),statusCode:t.Number({description:"HTTP status code that was returned"})},{$id:"ServerErrorResponse",description:"Standard envelope for server (5XX) API errors"}),uIe=t.Object({requestId:t.String({description:"Identifier used to trace the lifecycle of this API request"}),error:t.Ref("ClientErrorResponse")},{$id:"ClientErrorEnvelope",description:"Standard envelope wrapping all client (4XX) error responses"}),lIe=t.Object({requestId:t.String({description:"Identifier used to trace the lifecycle of this API request"}),error:t.Ref("ServerErrorResponse")},{$id:"ServerErrorEnvelope",description:"Standard envelope wrapping all server (5XX) error responses"});function m({body:e,description:r,method:n,operationId:o,params:i,tags:a,query:c,paginated:l,response:d,url:f}){return i?{buildUrl:T=>f.replace(/:[a-zA-Z_]+/g,_=>T[_.slice(1)]),method:n,params:i,response:d,templateUrl:f,...e===void 0?{}:{body:e},...r===void 0?{}:{description:r},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}:{method:n,response:d,url:f,templateUrl:f,...e===void 0?{}:{body:e},...r===void 0?{}:{description:r},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}}function wb(e,r){if(!r||typeof r!="object")return e;let n=new URLSearchParams;return Object.entries(r).forEach(([o,i])=>{Array.isArray(i)?i.length>0&&i.forEach(a=>{a!==void 0&&(typeof a=="string"||typeof a=="number"||typeof a=="boolean")&&n.append(o,String(a))}):(typeof i=="boolean"||typeof i=="string"||typeof i=="number")&&n.append(o,String(i))}),`${e}?${n.toString()}`}var x=t.Object({success:t.Literal(!0,{description:"Always `true` when the delete request completed and the resource was removed."})},{$id:"DeleteResponse",description:"Confirmation that the targeted resource was deleted.",example:{success:!0}});var sl="tsuga-cli";var Gn="/v0/oauth",Nb=m({description:"OAuth 2.1 authorization endpoint: validates the client and redirect URI, then redirects to the consent page",url:`${Gn}/authorize`,method:"GET",query:t.Partial(t.Object({response_type:t.String({description:"Must be `code`"}),client_id:t.String({description:"First-party client id or CIMD document URL"}),redirect_uri:t.String({description:"Client redirect URI"}),code_challenge:t.String({description:"PKCE code challenge"}),code_challenge_method:t.String({description:"Must be `S256`"}),state:t.String({description:"Opaque client state, echoed back"}),resource:t.String({description:"RFC 8707 resource indicator"})})),response:t.Object({},{description:"Never returned: this endpoint redirects (302) or renders an HTML error (400)"})}),Lb=m({description:"OAuth 2.1 token endpoint: exchanges an authorization code (PKCE) or refresh token for a token pair",url:`${Gn}/token`,method:"POST",body:t.Partial(t.Object({grant_type:t.String({description:"`authorization_code` or `refresh_token`"}),code:t.String({description:"Authorization code being exchanged"}),code_verifier:t.String({description:"PKCE code verifier"}),redirect_uri:t.String({description:"Must match the redirect URI used on /authorize"}),client_id:t.String({description:"Client id, when sent by the client"}),refresh_token:t.String({description:"Refresh token, for `grant_type=refresh_token`"})})),response:t.Object({access_token:t.String(),token_type:t.Literal("Bearer"),expires_in:t.Number({description:"Access token lifetime in seconds"}),refresh_token:t.String()})}),RIe=m({description:"Resolve a signed authorization request handle for the consent page",url:`${Gn}/authorization-request`,method:"GET",query:t.Object({handle:t.String()}),response:t.Object({clientId:t.String(),clientName:t.String(),redirectUri:t.String()})}),CIe=m({description:"Approve or deny an OAuth authorization request from the consent page",url:`${Gn}/approve`,method:"POST",body:t.Object({handle:t.String({description:"The signed authorization request handle"}),approve:t.Boolean()}),response:t.Object({redirectTo:t.String({description:"The client's redirect URI carrying either the code or the denial"})})}),PIe=m({description:"Validate an OAuth access token (internal, for the MCP resource server)",url:`${Gn}/introspect`,method:"POST",body:t.Object({token:t.String()}),response:t.Object({active:t.Boolean(),userId:t.Optional(t.String()),orgId:t.Optional(t.String())})}),i$=["pending","active","revoked"],a$=t.Object({id:t.String(),createdAt:E(),clientId:t.String({description:"Client ID Metadata Document URL or first-party client id"}),clientName:t.String({description:"Display name derived from the client identity"}),userId:t.String(),status:t.Enum(i$),lastUsedAt:t.Optional(E())}),UIe=m({tags:["oauth"],description:"List OAuth grants: your own, or all users for admins",url:`${Gn}/grants`,method:"GET",query:t.Object({allUsers:t.Optional(t.Boolean({description:"Admins only: list grants of every user in the org"}))}),response:t.Array(a$)}),wIe=m({tags:["oauth"],description:"Delete an OAuth grant (own grant, or any grant for admins)",url:`${Gn}/grants/:id`,method:"DELETE",params:t.Object({id:t.String()}),response:x});function vb(e,r){let n=new URL(Nb.url,e);return n.search=new URLSearchParams({response_type:"code",client_id:sl,redirect_uri:r.redirectUri,code_challenge:r.challenge,code_challenge_method:"S256",state:r.state}).toString(),n.href}function s$(e){if(!e)return{};try{let r=JSON.parse(e);return typeof r=="object"&&r!==null?r:{}}catch{return{}}}async function c$(e,r){let n=await fetch(new URL(Lb.url,e).href,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(r).toString()}),o=await n.text(),i=s$(o);if(n.status!==200){let a=i.error??`HTTP ${n.status}`;throw new Error(`OAuth token request failed (${a}${i.error_description?`: ${i.error_description}`:""})`)}if(!i.access_token||typeof i.expires_in!="number")throw new Error("OAuth token response was missing required fields");return{accessToken:i.access_token,expiresAt:new Date(Date.now()+i.expires_in*lu)}}async function kb(e,r){return c$(e,{grant_type:"authorization_code",client_id:sl,code:r.code,code_verifier:r.verifier,redirect_uri:r.redirectUri})}var jt=require("node:fs"),pl=require("node:os"),jn=require("node:path");var Db=Sn(require("os"),1),Aa=Sn(require("path"),1),un=Db.default.homedir(),{env:$n}=process,Mb=$n.XDG_DATA_HOME||(un?Aa.default.join(un,".local","share"):void 0),zc=$n.XDG_CONFIG_HOME||(un?Aa.default.join(un,".config"):void 0),MIe=$n.XDG_STATE_HOME||(un?Aa.default.join(un,".local","state"):void 0),Gb=$n.XDG_CACHE_HOME||(un?Aa.default.join(un,".cache"):void 0),DIe=$n.XDG_RUNTIME_DIR||void 0,p$=($n.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");Mb&&p$.unshift(Mb);var u$=($n.XDG_CONFIG_DIRS||"/etc/xdg").split(":");zc&&u$.unshift(zc);var $b=(0,jn.join)(zc??(0,jn.join)((0,pl.homedir)(),".config"),"tsuga"),xa=(0,jn.join)($b,"config.json"),jb=(0,jn.join)(Gb??(0,jn.join)((0,pl.homedir)(),".cache"),"tsuga"),cl=(0,jn.join)(jb,"update-check.json"),Ra="https://api.tsuga.com";function Bb(e){return ng(e.credential)}function Yc(){if(!(0,jt.existsSync)(xa))return{};try{let e=JSON.parse((0,jt.readFileSync)(xa,"utf-8")),{operationApiKey:r,userAuth:n,...o}=e;return!r&&!n?e:{...o,credentials:{...e.credentials??{},[Ra]:{...r?{operationApiKey:r}:{},...n?{userAuth:n}:{},...e.credentials?.[Ra]??{}}}}}catch{throw new Error(`Config file corrupted: ${xa}
|
|
43
|
+
Re-authenticate with \`tsuga auth login\` or \`tsuga auth operation-key <OPERATION_API_KEY>\`.`)}}function Ca(){try{return Yc()}catch{return{}}}function Pa(e){(0,jt.mkdirSync)($b,{recursive:!0,mode:448}),(0,jt.writeFileSync)(xa,`${JSON.stringify(e,null,2)}
|
|
44
|
+
`,{mode:384})}function ul(e,r=Ho()){return e.credentials?.[r]??{}}function ll(e,r,n=Ho()){return{...e,credentials:{...e.credentials??{},[n]:r}}}function Ho(e){return(e?.trim()||process.env.TSUGA_API_URL?.trim()||Ra).replace(/\/+$/,"")}function Ko(e){let r=Yc(),n=Ho(e.apiUrl),o=ul(r,n),i=rg({overrideKey:e.operationApiKey??process.env.TSUGA_OPERATION_API_KEY,operationApiKey:o.operationApiKey,userAuth:o.userAuth}),a=r.defaults??{},c=e.clusterId?.trim()||process.env.TSUGA_CLUSTER_ID?.trim()||a.cluster?.trim()||void 0;return{apiUrl:n,credential:i,clusterId:c,defaults:a}}function qb(){return ul(Yc()).userAuth}function Fb(e){let r=Ca();Pa(ll(r,{userAuth:e}))}function Hb(e){let r=Ca();Pa(ll(r,{operationApiKey:e}))}function Kb(){let e=Ca(),r=ul(e);Pa(ll(e,r.operationApiKey?{operationApiKey:r.operationApiKey}:{}))}function Ua(){return xa}var zb={from:"-30m",to:"now",query:"*","max-results":"100"};function Ir(e){return(Yc().defaults??{})[e]??zb[e]}function Yb(e,r){let n=Ca();Pa({...n,defaults:{...n.defaults??{},[e]:r}})}function Vb(){let{defaults:e,...r}=Ca();Pa(r)}function Qb(e,r){let n=[`API URL: ${e.apiUrl}`],{credential:o}=e;if(o){let a=o.kind;switch(a){case"operation-api-key":n.push(`Operation API key: ${o.token.slice(0,12)}...${o.token.slice(-4)}`);break;case"user-session":n.push(`User session: ${Gi(o.userAuth.accessToken)} (expires ${o.userAuth.accessExpiresAt})`);break;default:Xe(a)}}else n.push("Not authenticated. Run `tsuga auth login` or `tsuga auth operation-key <OPERATION_API_KEY>`.");n.push(`Config: ${r}`),n.push(""),n.push("Defaults (custom overrides marked with *):");let i={...zb,...e.defaults};for(let[a,c]of Object.entries(i)){let l=a in e.defaults?" *":"";n.push(` ${a}: ${c}${l}`)}return`${n.join(`
|
|
45
45
|
`)}
|
|
46
|
-
`}function
|
|
47
|
-
`,{mode:384})}async function
|
|
48
|
-
`),process.exitCode=1;return}if(Ks({kind:"user-session",userAuth:r},new Date)){process.stderr.write("Your session expired. Run `tsuga auth login` to sign in again.\n"),process.exitCode=1;return}B(r.accessToken)}function HG(){let{credential:e}=Ko({});if(!e){B("Not authenticated. Run `tsuga auth login` or `tsuga auth operation-key <OPERATION_API_KEY>`.");return}switch(e.kind){case"user-session":B(`Logged in as a user (token ${ki(e.userAuth.accessToken)}, expires ${e.userAuth.accessExpiresAt}).`);return;case"operation-api-key":B("Authenticated with an operation API key.");return;default:Xe(e)}}function KG(){vb(),B("Local user session cleared.")}function Bb(e){let r=e.command("auth").description("Manage authentication: user login (OAuth) or operation API key");r.action(()=>r.help()),r.command("login").description("Log in as a user with a browser authorization flow and save the session (replaces any saved operation API key)").action(BG),r.command("logout").description("Clear the saved user session").action(KG),r.command("token").description("Print the saved user access token to stdout").action(FG),r.command("operation-key <OPERATION_API_KEY>").description("Save an operation API key to the config file (replaces any saved user session)").action(n=>{Lb(n),B(`Operation API key saved to ${Ra()}`)}),r.command("status").description("Show the current authentication method").action(HG)}var zG=["allowed-domains","cluster-integration-config","custom-usage-tag","database","databricks-connection","explorer-saved-view","host","inventory","monitor-alert","monitor-debugging","oauth-grant","org","retention-policy","saml-config","sensitive-data-scanner-rule","service","service-target","team-remap-config","user-self","widget-share"],YG=["adaptive-notification-rule","audit-log","cloud-account","dashboard-folder","dashboard-report","dashboard","ingestion-api-key","investigation","log-route","metric-route","monitor","notification-integration","notification-rule","notification-silence","operation-api-key","quality-report","rum-public-token","slo","tag-policy","team-members","team","user-data","user-invitation","user-permissions"],VG=["log","metric","trace","rum"],QG=[...YG,...VG],xIe=[...zG,...QG];var Kc=["admin","public_editor","public_viewer","teams_only"],zo=["admin","editor","viewer"];var qn="/v0/team-membership",ol="Role granted to the user inside this team. `admin` gives full team control, including managing assets, members, and settings. `editor` can view and update most team assets (dashboards, monitors, etc.) but cannot manage members or settings. `viewer` can view team data but cannot make changes.",il=t.Object({id:t.String({description:"Tsuga-generated team membership ID assigned when the membership is created."}),userId:t.String({description:"User ID that belongs to the team."}),teamId:t.String({description:"Team ID that contains the user."}),roleKey:t.Enum(zo,{description:ol})}),Fb=t.Object({userId:p({allowEmpty:!1,description:"User ID to add to or update in the team."}),teamId:p({allowEmpty:!1,description:"Team ID receiving the membership change."}),roleKey:t.Enum(zo,{description:ol})}),WG=t.Object({userId:p({allowEmpty:!1,description:"User ID to remove from the team."}),teamId:p({allowEmpty:!1,description:"Team ID to remove the user from."})}),ZG=t.Optional(t.Object({userId:t.Optional(p({allowEmpty:!1,description:"Restrict results to memberships for this user ID."})),teamId:t.Optional(p({allowEmpty:!1,description:"Restrict results to memberships for this team ID."}))})),RIe=m({tags:["access-control"],url:qn,method:"GET",query:ZG,response:t.Array(il)}),CIe=m({tags:["access-control"],url:qn,method:"POST",body:Fb,response:il}),PIe=m({tags:["access-control"],url:qn,method:"PUT",body:Fb,response:il}),UIe=m({tags:["access-control"],url:qn,method:"DELETE",body:WG,response:R}),Hc=500,Hb=t.Object({teamId:p({allowEmpty:!1,description:"Team ID receiving all requested memberships."}),members:t.Array(t.Object({userId:t.Optional(p({allowEmpty:!1,description:"Existing user ID to add to the team."})),userEmail:t.Optional(p({allowEmpty:!1,type:"email",description:"Existing user email to resolve and add to the team."})),roleKey:t.Enum(zo,{description:ol})},{oneOf:[{required:["userId"]},{required:["userEmail"]}]}),{minItems:1,maxItems:Hc,description:"Users to add to the team. Each item must include either `userId` or `userEmail`, not both. Duplicate identifiers (including a `userId` and `userEmail` that resolve to the same user) are rejected. Items are processed independently: an unresolved user does not stop other items from being added."})},{description:"Bulk team-membership creation request. Provide one target team and the users to add by ID or email, with a role for each user."}),XG={teamId:"team-123-abc",members:[{userId:"user-123-abc",roleKey:"viewer"},{userEmail:"sam@example.com",roleKey:"editor"}]};Object.assign(Hb,{examples:[XG]});var Kb=t.Object({results:t.Array(t.Object({userId:t.String({description:"Resolved user ID for this bulk add result. For `user_not_found`, this is the submitted user ID or email that Tsuga could not resolve."}),status:t.Enum(["added","already_member","user_not_found"],{description:"`added` means the membership was created, `already_member` means no change was needed, and `user_not_found` means Tsuga could not resolve the requested user."})}))},{description:"Per-user result summary for a bulk team-membership add request."}),JG={results:[{userId:"user-123-abc",status:"added"},{userId:"sam@example.com",status:"user_not_found"}]};Object.assign(Kb,{examples:[JG]});var wIe=m({tags:["access-control"],url:`${qn}/bulk-add`,method:"POST",body:Hb,response:Kb}),NIe=m({tags:["access-control"],url:`${qn}/bulk-update-user-roles`,method:"PUT",body:t.Object({userIds:t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:Hc}),teamId:p({allowEmpty:!1}),role:t.Enum(zo)}),response:t.Object({})}),zb=t.Object({teamId:p({allowEmpty:!1,description:"Team ID to remove the requested users from."}),userIds:t.Optional(t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:Hc,description:"User IDs to remove from the team. Items are processed independently: a user who is not a member or cannot be resolved does not stop the other items from being removed."})),userEmails:t.Optional(t.Array(p({allowEmpty:!1,type:"email"}),{minItems:1,maxItems:Hc,description:"User emails to resolve and remove from the team."}))},{oneOf:[{required:["userIds"]},{required:["userEmails"]}],description:"Bulk team-membership removal request. Provide one target team and either `userIds` or `userEmails`, not both, with no duplicates."}),e$={teamId:"team-123-abc",userIds:["user-123-abc"]};Object.assign(zb,{examples:[e$]});var Yb=t.Object({results:t.Array(t.Object({userId:t.String({description:"Resolved user ID for this bulk remove result. For `user_not_found`, this is the submitted user ID or email that Tsuga could not resolve."}),status:t.Enum(["removed","not_member","user_not_found"],{description:"`removed` means the membership was deleted, `not_member` means no membership existed, and `user_not_found` means Tsuga could not resolve the requested user."})}))},{description:"Per-user result summary for a bulk team-membership removal request."}),t$={results:[{userId:"user-123-abc",status:"removed"},{userId:"missing@example.com",status:"user_not_found"}]};Object.assign(Yb,{examples:[t$]});var LIe=m({tags:["access-control"],url:`${qn}/bulk-remove`,method:"DELETE",body:zb,response:Yb});var r$=["logs","metrics","traces","llm-obs","profiling","analytics","dashboards","ongoing-alerts","slo","monitor","notification-rules","notification-silences","notification-integrations","investigations","routes","sensitive-data-scanner","inventory","services","rum","sessions","host-catalog","kubernetes"],Vb=t.Enum(r$,{description:"Stable nav item key within a main sidebar category."}),Qb=t.Array(Vb,{description:"Nav item keys shown in the primary sidebar for this category, in display order."}),Wb=t.Optional(t.Array(Vb,{description:"Nav item keys for this category that are folded away (e.g. View more). Omitted or empty means none."})),Zb="Stable category id. Unknown or renamed ids are ignored by the client catalog.",Xb="Sidebar categories in display order. Unknown or renamed ids are ignored by the client catalog.",al=t.Object({categories:t.Array(t.Object({id:t.String({description:Zb}),visible:Qb,folded:Wb}),{description:Xb})}),Jb=t.Object({categories:t.Array(t.Object({id:p({allowEmpty:!1,description:Zb}),visible:Qb,folded:Wb}),{description:Xb})});var zc="/v0/org",n$=`${zc}/current-user`,eS=`${zc}/settings`,tS=`${zc}/allowed-domains`,Yc=50,rS=t.Object({id:t.String(),name:t.String(),createdAt:E(),allowedDomains:t.Array(t.String(),{description:"Email domains whose users are allowed to join the account, via invitation or SSO/SAML just-in-time provisioning. Domains are stored in lowercase."}),enableLlmFeatures:t.Boolean(),allowEmailPasswordLogin:t.Boolean()}),nS=t.Object({allowedDomains:t.Array(p({allowEmpty:!1,type:"lowercase-domain",description:'A lowercase email domain (e.g. "acme.com").'}),{maxItems:Yc,description:"The new full list of email domains whose users are allowed to join the account via invitation or SSO/SAML just-in-time provisioning. Replaces the existing list; omitted domains are no longer allowed."})}),oS=t.Pick(rS,["allowedDomains"]),BIe=m({tags:["organization"],url:n$,method:"GET",response:rS}),FIe=m({tags:["organization"],url:eS,method:"GET",response:t.Object({enableLlmFeatures:t.Boolean(),allowEmailPasswordLogin:t.Boolean(),sidebarNavLayout:t.Optional(al)})}),HIe=m({tags:["organization"],url:eS,method:"PUT",body:t.Object({enableLlmFeatures:t.Optional(t.Boolean()),allowEmailPasswordLogin:t.Optional(t.Boolean()),sidebarNavLayout:t.Optional(t.Union([Jb,t.Null()]))}),response:t.Object({enableLlmFeatures:t.Boolean(),allowEmailPasswordLogin:t.Boolean(),sidebarNavLayout:t.Optional(al)})}),KIe=m({tags:["organization"],url:zc,method:"PUT",body:nS,response:t.Object({allowedDomains:t.Array(t.String())})}),zIe=m({tags:["organization"],url:tS,method:"GET",response:oS}),YIe=m({tags:["organization"],url:tS,method:"PUT",body:nS,response:oS});var Vc="/v0/admin",ke=`${Vc}/clusters`,aS=t.Object({helmParameters:t.Record(t.String(),t.Union([t.Number(),t.Boolean(),t.Null(),t.String()])),helmVersion:t.String()}),iS=t.Record(t.String(),aS),pl=["eu-central-1","eu-central-2","eu-north-1","eu-south-1","eu-south-2","eu-west-1","eu-west-2","eu-west-3","us-east-1","us-east-2","us-west-1","us-west-2","af-south-1","ap-east-1","ap-northeast-1","ap-northeast-2","ap-northeast-3","ap-south-1","ap-south-2","ap-southeast-1","ap-southeast-2","ap-southeast-3","ap-southeast-4","ap-southeast-5","ap-southeast-7","ca-central-1","ca-west-1","il-central-1","me-central-1","me-south-1","mx-central-1","sa-east-1"],ul=["europe-west1","europe-west2","europe-west3","europe-west4","europe-west6","europe-west9","europe-central2","europe-north1","us-central1","us-east1","us-east4","us-west1","us-west2","us-west3","us-west4","northamerica-northeast1","southamerica-east1","asia-east1","asia-east2","asia-northeast1","asia-northeast2","asia-northeast3","asia-south1","asia-south2","asia-southeast1","asia-southeast2","australia-southeast1","australia-southeast2"],ll=["australiacentral","australiacentral2","australiaeast","australiasoutheast","austriaeast","belgiumcentral","brazilsouth","brazilsoutheast","canadacentral","canadaeast","centralindia","centralus","chilecentral","eastasia","eastus","eastus2","francecentral","francesouth","germanynorth","germanywestcentral","indonesiacentral","israelcentral","italynorth","japaneast","japanwest","jioindiacentral","jioindiawest","koreacentral","koreasouth","malaysiawest","mexicocentral","newzealandnorth","northcentralus","northeurope","norwayeast","norwaywest","polandcentral","qatarcentral","southafricanorth","southafricawest","southcentralus","southeastasia","southindia","spaincentral","swedencentral","switzerlandnorth","switzerlandwest","uaecentral","uaenorth","uksouth","ukwest","westcentralus","westeurope","westindia","westus","westus2","westus3"],sS=["aws","gcp","azure"],Ca=["xs","s","m","l"],ml=["1.0"],o$=["tsuga-cluster","tsuga-telemetry","tsuga-deployer","tsuga-events"],Qc=t.Enum(o$,{description:"Helm installation name identifying a chart component on the cluster."}),i$={id:t.String(),name:t.String(),createdAt:E(),clusterCertificateExpiresAt:E(),bridgeEndpoint:t.String(),deployerEndpoint:t.String(),targetConfiguration:iS,appliedConfiguration:t.Optional(iS),automaticallyDeployLatestVersion:t.Boolean(),automatedDeploymentDisabledBy:t.Optional(t.String()),automatedDeploymentDisabledReason:t.Optional(t.String()),automatedDeploymentDisabledAt:t.Optional(E()),soakTimeMin:t.Optional(t.Number()),clusterSize:t.Optional(t.Enum(Ca)),gitSyncByInstallation:t.Record(Qc,t.Boolean(),{description:"Per-installation git-sync state, keyed by installationName."})},sl={...i$,orgId:t.String(),orgName:t.String()},tbe=m({tags:["admin"],method:"GET",url:ke,query:t.Object({orgId:t.Optional(p())}),response:t.Array(b("clusterType",[t.Object({...sl,clusterType:t.Literal("aws"),clusterAccountId:t.String(),clusterBuilderRoleVersion:t.Optional(t.Enum(ml)),clusterRegion:t.Enum(pl)}),t.Object({...sl,clusterType:t.Literal("gcp"),clusterAccountId:t.String(),clusterRegion:t.Enum(ul)}),t.Object({...sl,clusterType:t.Literal("azure"),clusterTenantId:t.String(),clusterSubscriptionId:t.String(),clusterRegion:t.Enum(ll)})]))}),rbe=m({tags:["admin"],method:"PUT",url:`${ke}/create`,body:b("clusterType",[t.Object({clusterType:t.Literal("aws"),orgId:p(),name:p(),clusterSize:t.Enum(Ca),clusterAccountId:t.String({minLength:12,maxLength:12}),clusterBuilderRoleVersion:t.Enum(ml),clusterRegion:t.Enum(pl)}),t.Object({clusterType:t.Literal("gcp"),orgId:p(),name:p(),clusterSize:t.Enum(Ca),clusterAccountId:p(),clusterRegion:t.Enum(ul)}),t.Object({clusterType:t.Literal("azure"),orgId:p(),name:p(),clusterSize:t.Enum(Ca),clusterTenantId:p(),clusterSubscriptionId:p(),clusterRegion:t.Enum(ll)})]),response:t.Object({id:t.String(),bridgeEndpoint:t.String(),deployerEndpoint:t.String()})}),nbe=m({tags:["admin"],method:"DELETE",url:`${ke}/:id`,params:t.Object({id:p()}),body:t.Object({orgId:p()}),response:R}),obe=m({tags:["admin"],method:"PUT",url:`${ke}/add-inbounder-key`,body:t.Object({orgId:p(),clusterId:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),inbounderAuthenticationKey:t.String()})}),ibe=m({tags:["admin"],method:"PUT",url:`${ke}/replace-all-inbounder-keys`,body:t.Object({orgId:p(),clusterId:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),inbounderAuthenticationKey:t.String()})}),abe=m({tags:["admin"],method:"PUT",url:`${ke}/replace-inbounder-key`,body:t.Object({orgId:p(),clusterId:p(),inbounderAuthenticationKeyToReplace:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),inbounderAuthenticationKey:t.String()})}),sbe=m({tags:["admin"],method:"PUT",url:`${ke}/delete-inbounder-key`,body:t.Object({orgId:p(),clusterId:p(),inbounderAuthenticationKeyToDelete:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),isKeyDeleted:t.Boolean()})}),cbe=m({tags:["admin"],method:"PUT",url:`${ke}/rotate-deployer-key`,body:t.Object({orgId:p(),clusterId:p(),newKey:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),isKeyUpdated:t.Boolean()})}),pbe=m({tags:["admin"],method:"PUT",url:`${ke}/rotate-bridge-key`,body:t.Object({orgId:p(),clusterId:p(),newKey:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),isKeyUpdated:t.Boolean()})}),cl={central:t.String(),ngrokBridgeDomain:t.String(),ngrokDeployerDomain:t.String(),clusterCertificateExpiresAt:E(),clusterName:t.String(),clusterSize:t.Optional(t.Enum(Ca)),secretBridgeAuthenticationKey:t.String(),secretDeployerAuthenticationKey:t.String(),secretOutbounderAuthenticationKey:t.String(),slackChannelEmail:t.String(),customerTier:t.String()},ube=m({tags:["admin"],method:"POST",url:`${ke}/:id`,body:t.Object({orgId:p()}),params:t.Object({id:p()}),response:b("clusterType",[t.Object({...cl,clusterType:t.Literal("aws"),clusterAccountId:t.String(),clusterBuilderRoleVersion:t.Optional(t.Enum(ml)),clusterRegion:t.Enum(pl)}),t.Object({...cl,clusterType:t.Literal("gcp"),clusterAccountId:t.String(),clusterRegion:t.Enum(ul)}),t.Object({...cl,clusterType:t.Literal("azure"),clusterTenantId:t.String(),clusterSubscriptionId:t.String(),clusterRegion:t.Enum(ll)})])}),lbe=m({tags:["admin"],method:"POST",url:`${ke}/configuration`,body:t.Object({id:p({allowEmpty:!1}),orgId:p({allowEmpty:!1}),installationName:Qc,targetConfiguration:aS,gitSyncEnabled:t.Boolean({description:"Persisted on upgrade: whether this chart's values are synced from git."})}),response:t.Object({status:t.String()})}),mbe=m({tags:["admin"],method:"GET",url:`${ke}/git-values`,query:t.Object({orgId:p({allowEmpty:!1}),clusterId:p({allowEmpty:!1}),installationName:Qc}),response:t.Object({valuesYaml:t.Optional(t.String({description:"Merged git values rendered as YAML. Absent when the cluster/chart has no resolvable values in the repository mirror."})),sha:t.Optional(t.String({description:"Abbreviated commit SHA of the mirrored repository. Absent if not yet successfully fetched (or sync disabled)."}))})}),dbe=m({tags:["admin"],method:"POST",url:`${ke}/git-sync`,body:t.Object({clusterId:p({allowEmpty:!1}),orgId:p({allowEmpty:!1}),installationName:Qc,gitSyncEnabled:t.Boolean({description:"Whether this chart syncs its Helm values from git."})}),response:t.Object({status:t.String()})}),fbe=m({tags:["admin"],method:"POST",url:`${ke}/automation`,body:t.Object({id:p(),orgId:p(),enableAutomatedDeployment:t.Boolean(),disabledReason:t.Optional(p())}),response:t.Object({status:t.String()})}),gbe=m({tags:["admin"],method:"POST",url:`${ke}/soak-time`,body:t.Object({id:p(),orgId:p(),soakTimeMin:t.Optional(t.Number())}),response:t.Object({status:t.String()})}),ybe=m({tags:["admin"],method:"POST",url:`${ke}/deploy`,body:t.Object({orgId:p(),clusterId:p(),chartName:p(),toVersion:p()}),response:t.Object({id:t.String()})}),a$=b("type",[t.Object({type:t.Literal("pending")}),t.Object({type:t.Literal("running")}),t.Object({type:t.Literal("cancelled")}),t.Object({type:t.Literal("timed_out")}),t.Object({type:t.Literal("success"),stateValue:t.Object({message:t.String()})}),t.Object({type:t.Literal("failure"),stateValue:t.Object({message:t.String()})})]),hbe=m({tags:["admin"],method:"GET",url:`${ke}/deploy`,query:t.Object({orgId:t.Optional(p()),clusterId:t.Optional(p())}),response:t.Array(t.Object({id:t.String(),orgId:t.String(),orgName:t.String(),clusterId:t.String(),clusterName:t.String(),fromVersion:t.Optional(t.String()),toVersion:t.String(),state:a$,updatedAt:E(),createdAt:E(),installationName:t.String(),chartName:t.String(),isAutomated:t.Boolean(),createdBy:t.Optional(t.String()),createdByName:t.Optional(t.String()),createdByEmail:t.Optional(t.String())}))}),s$=t.Object({installations:t.Array(t.Object({installationName:t.String(),parameters:t.Record(t.String(),t.Union([t.Number(),t.Boolean(),t.Null(),t.String()])),version:t.Union([t.String(),t.Null()]),resources:t.Array(t.Object({id:t.Object({kind:t.String(),name:t.String()}),status:t.String(),health:t.String(),rawDetails:t.Optional(t.Any()),liveManifest:t.Optional(t.String()),targetManifest:t.Optional(t.String())})),deployedAt:t.Optional(t.String()),syncStatus:t.Optional(t.String()),healthStatus:t.Optional(t.String())}))}),Tbe=m({tags:["admin"],method:"POST",url:`${ke}/status`,body:t.Object({orgId:t.Optional(p()),clusterId:t.Optional(p())}),response:t.Array(t.Object({orgId:t.String(),clusterId:t.String(),status:s$}))}),Ebe=m({tags:["admin"],method:"POST",url:`${ke}/argocd-cert-info`,body:t.Object({orgId:p(),clusterId:p()}),response:t.Object({certificateExpiresAt:t.String()})}),c$=t.Object({kind:t.String(),name:t.String()}),p$=t.Object({id:c$,liveManifest:t.Optional(t.String()),targetManifest:t.Optional(t.String())}),_be=m({tags:["admin"],method:"POST",url:`${ke}/resource-details`,body:t.Object({orgId:p(),clusterId:p(),installationName:p()}),response:t.Object({resources:t.Array(p$)})}),Ibe=m({tags:["admin"],method:"GET",url:`${ke}/versions`,query:t.Object({chartName:t.Optional(p())}),response:t.Array(t.Object({id:t.String(),chartName:t.String(),locator:t.String(),version:t.String(),repositoryArn:t.String(),type:t.Optional(t.String()),commitHash:t.Optional(t.String()),author:t.Optional(t.String()),lastPulledAt:t.Optional(E()),pushedAt:t.Optional(E())}))});var u$=t.Object({id:t.Object({name:t.String(),kind:t.String()}),previewManifest:t.Optional(t.String())}),bbe=m({tags:["admin"],method:"POST",url:`${ke}/versions/render`,body:t.Object({chartName:p(),version:p(),values:p({type:"long"}),installationName:p(),namespace:p()}),response:t.Array(u$)}),br=`${Vc}/orgs`,Sbe=m({tags:["admin"],url:br,method:"GET",query:t.Object({onlyDeleted:t.Optional(t.Boolean())}),response:t.Array(t.Object({id:t.String(),name:t.String(),allowedDomains:t.Array(t.String()),createdAt:E(),updatedAt:E()}))}),Obe=m({tags:["admin"],url:br,method:"POST",body:t.Object({allowedDomains:t.Array(p({type:"lowercase-domain"}),{maxItems:Yc}),name:p()}),response:t.Object({id:t.String(),name:t.String()})}),Abe=m({tags:["admin"],url:`${br}/:id`,method:"PUT",params:t.Object({id:p()}),body:t.Object({allowedDomains:t.Optional(t.Array(p({type:"lowercase-domain"}),{maxItems:Yc}))}),response:t.Object({id:t.String(),name:t.String(),allowedDomains:t.Array(t.String())})}),xbe=m({tags:["admin"],url:`${br}/:id`,method:"DELETE",params:t.Object({id:p()}),response:R}),Rbe=m({tags:["admin"],url:`${br}/:id/restore`,method:"POST",params:t.Object({id:p()}),response:t.Object({success:t.Boolean()})}),Cbe=m({tags:["admin"],url:`${br}/:id/permanent-delete`,method:"DELETE",params:t.Object({id:p()}),response:t.Object({success:t.Boolean(),hasDeletedSecret:t.Boolean(),hasDeletedTenantDb:t.Boolean(),hasDeletedOrgRow:t.Boolean()})}),Pbe=m({tags:["admin"],url:`${br}/synchronize-sds-rules`,method:"POST",response:t.Object({errorOrgs:t.Optional(t.Array(t.Object({id:t.String(),name:t.String()}))),synchronizedOrgsCount:t.Number()})}),l$=["custom_usage_tag","ingestion_api_key","inventory_resource","monitor","retention_policy","route","sensitive_data_scanner_rule","tag_policy","team"],m$=t.Enum(l$),Ube=m({tags:["admin"],url:`${br}/refresh-assets`,method:"POST",body:t.Object({assetTypes:t.Array(m$,{minItems:1}),orgId:t.Optional(p({allowEmpty:!1}))}),response:t.Array(t.Object({orgId:t.String(),orgName:t.String(),results:t.Record(t.String(),t.Object({success:t.Boolean()}))}))}),wbe=m({tags:["admin"],url:`${br}/sudo`,method:"POST",body:t.Object({orgId:p()}),response:t.Object({sudoToken:t.String()})}),d$=`${Vc}/users`,Nbe=m({tags:["admin"],url:`${d$}/invite`,method:"POST",body:t.Object({email:p({type:"email"}),orgId:p(),userRole:t.Enum(Kc)}),response:t.Array(t.Object({inviteId:t.String(),email:t.String(),result:t.Union([t.Literal("success"),t.Literal("email-failed")])}))});var Lbe=m({tags:["admin"],url:`${Vc}/billing-data`,method:"GET",query:t.Object({orgId:p(),maxDaysFetched:t.Optional(t.Number({minimum:1,maximum:365}))}),response:t.Object({dataPoints:t.Array(t.Object({date:t.String(),telemetryKind:t.Union([t.Literal("logs"),t.Literal("metrics"),t.Literal("rum"),t.Literal("traces")]),totalBytes:t.Number(),clusterId:t.String(),apiKeyId:t.String(),apiKeyName:t.String(),teamName:t.String()})),availableFilters:t.Object({clusters:t.Array(t.Object({id:t.String(),name:t.String()})),apiKeys:t.Array(t.Object({id:t.String(),name:t.String()})),teamNames:t.Array(t.String())})})});var cS=t.Object({id:t.String({description:"Unique Tsuga cluster ID. Tsuga assigns it when the cluster record is created. Use this value as `clusterId` with public API requests that accept `clusterId`."}),name:t.String({description:"Cluster name stored in Tsuga. Usable as a display label when `friendlyName` is not set."}),friendlyName:t.Optional(t.String({description:"Human-readable display name for the cluster. Present when a friendly name is configured."})),clusterType:t.Enum(sS,{description:"Cloud provider selected for the Tsuga cluster."}),clusterRegion:t.String({description:"Cloud region selected for the cluster using the provider region identifier."})},{$id:"Cluster",description:"Tsuga cluster available to the organization. Use its `id` to scope public API requests that accept `clusterId`."}),f$={id:"abc-123-def",name:"production",friendlyName:"Production (US)",clusterType:"aws",clusterRegion:"us-east-1"};Object.assign(cS,{examples:[f$]});var pS=m({description:"Lists Tsuga clusters available to the organization. Use cluster IDs with public API requests that accept `clusterId`, such as telemetry, service, Kubernetes Explorer, and quality-report requests.",operationId:"listClusters",tags:["clusters"],url:`/${"v1"}/clusters`,method:"GET",response:t.Array(cS)});function uS(e,r){e.command("cluster").description("Manage Tsuga cluster selection").command("list").description("List all Tsuga clusters available to the operation API key").action(async()=>{let o=await r()(pS);Q(o)})}function mS(e,r,n,o){let i=e.commands.map(c=>c.name()).filter(c=>!c.startsWith("__")),a=e.options.map(c=>c.long).filter(c=>!!c);for(let c of e.options)(c.required||c.optional)&&(c.long&&o.add(c.long),c.short&&o.add(c.short));n.set(r.join(" "),{cmds:i,flags:[...a,"--help"]});for(let c of e.commands)c.name().startsWith("__")||mS(c,[...r,c.name()],n,o)}function g$(e){let r=new Map,n=new Set;return mS(e,[],r,n),{rows:[...r].map(([i,{cmds:a,flags:c}])=>({key:i,cmds:[...new Set(a)].join(" "),flags:[...new Set(c)].join(" ")})),valueFlags:[...n].join(" ")}}function lS(e){return e.map(({key:r,cmds:n,flags:o})=>` ${JSON.stringify(r)}) cmds=${JSON.stringify(n)} flags=${JSON.stringify(o)} ;;`).join(`
|
|
49
|
-
`)}function
|
|
46
|
+
`}function Wb(){if((0,jt.existsSync)(cl))try{return JSON.parse((0,jt.readFileSync)(cl,"utf-8")).lastUpdateCheck}catch{return}}function Zb(e){(0,jt.mkdirSync)(jb,{recursive:!0,mode:448}),(0,jt.writeFileSync)(cl,`${JSON.stringify({lastUpdateCheck:e})}
|
|
47
|
+
`,{mode:384})}async function l$(){let e=Ho(),{verifier:r,challenge:n}=ig(),o=(0,Xb.randomBytes)(16).toString("base64url"),{code:i,redirectUri:a}=await hg({state:o,buildAuthorizeUrl:l=>vb(e,{redirectUri:l,challenge:n,state:o})}),c=await kb(e,{code:i,verifier:r,redirectUri:a});Fb(tg(c)),q(`Logged in. Session token ${Gi(c.accessToken)} saved to ${Ua()}`)}function m$(){let e=Ho(),r=qb();if(!r){let n=e===Ra?"":` for ${e}`;process.stderr.write(`No user session${n}. Run \`tsuga auth login\`.
|
|
48
|
+
`),process.exitCode=1;return}if(Qs({kind:"user-session",userAuth:r},new Date)){process.stderr.write("Your session expired. Run `tsuga auth login` to sign in again.\n"),process.exitCode=1;return}q(r.accessToken)}function d$(){let{credential:e}=Ko({});if(!e){q("Not authenticated. Run `tsuga auth login` or `tsuga auth operation-key <OPERATION_API_KEY>`.");return}switch(e.kind){case"user-session":q(`Logged in as a user (token ${Gi(e.userAuth.accessToken)}, expires ${e.userAuth.accessExpiresAt}).`);return;case"operation-api-key":q("Authenticated with an operation API key.");return;default:Xe(e)}}function f$(){Kb(),q("Local user session cleared.")}function Jb(e){let r=e.command("auth").description("Manage authentication: user login (OAuth) or operation API key");r.action(()=>r.help()),r.command("login").description("Log in as a user with a browser authorization flow and save the session (replaces any saved operation API key)").action(l$),r.command("logout").description("Clear the saved user session").action(f$),r.command("token").description("Print the saved user access token to stdout").action(m$),r.command("operation-key <OPERATION_API_KEY>").description("Save an operation API key to the config file (replaces any saved user session)").action(n=>{Hb(n),q(`Operation API key saved to ${Ua()}`)}),r.command("status").description("Show the current authentication method").action(d$)}var g$=["allowed-domains","cluster-integration-config","custom-usage-tag","database","databricks-connection","explorer-saved-view","github-connection","host","inventory","monitor-alert","monitor-debugging","oauth-grant","org","retention-policy","saml-config","sensitive-data-scanner-rule","service","service-target","team-remap-config","user-self","widget-share"],y$=["adaptive-notification-rule","audit-log","cloud-account","dashboard-folder","dashboard-report","dashboard","ingestion-api-key","investigation","log-route","metric-route","monitor","notification-integration","notification-rule","notification-silence","operation-api-key","quality-report","rum-public-token","slo","tag-policy","team-members","team","user-data","user-invitation","user-permissions"],h$=["log","metric","trace","rum"],ml=[...y$,...h$],tbe=[...g$,...ml];var Qc=["admin","public_editor","public_viewer","teams_only"],zo=["admin","editor","viewer"];var Bn="/v0/team-membership",dl="Role granted to the user inside this team. `admin` gives full team control, including managing assets, members, and settings. `editor` can view and update most team assets (dashboards, monitors, etc.) but cannot manage members or settings. `viewer` can view team data but cannot make changes.",fl=t.Object({id:t.String({description:"Tsuga-generated team membership ID assigned when the membership is created."}),userId:t.String({description:"User ID that belongs to the team."}),teamId:t.String({description:"Team ID that contains the user."}),roleKey:t.Enum(zo,{description:dl})}),eS=t.Object({userId:p({allowEmpty:!1,description:"User ID to add to or update in the team."}),teamId:p({allowEmpty:!1,description:"Team ID receiving the membership change."}),roleKey:t.Enum(zo,{description:dl})}),T$=t.Object({userId:p({allowEmpty:!1,description:"User ID to remove from the team."}),teamId:p({allowEmpty:!1,description:"Team ID to remove the user from."})}),E$=t.Optional(t.Object({userId:t.Optional(p({allowEmpty:!1,description:"Restrict results to memberships for this user ID."})),teamId:t.Optional(p({allowEmpty:!1,description:"Restrict results to memberships for this team ID."}))})),rbe=m({tags:["access-control"],url:Bn,method:"GET",query:E$,response:t.Array(fl)}),nbe=m({tags:["access-control"],url:Bn,method:"POST",body:eS,response:fl}),obe=m({tags:["access-control"],url:Bn,method:"PUT",body:eS,response:fl}),ibe=m({tags:["access-control"],url:Bn,method:"DELETE",body:T$,response:x}),Vc=500,tS=t.Object({teamId:p({allowEmpty:!1,description:"Team ID receiving all requested memberships."}),members:t.Array(t.Object({userId:t.Optional(p({allowEmpty:!1,description:"Existing user ID to add to the team."})),userEmail:t.Optional(p({allowEmpty:!1,type:"email",description:"Existing user email to resolve and add to the team."})),roleKey:t.Enum(zo,{description:dl})},{oneOf:[{required:["userId"]},{required:["userEmail"]}]}),{minItems:1,maxItems:Vc,description:"Users to add to the team. Each item must include either `userId` or `userEmail`, not both. Duplicate identifiers (including a `userId` and `userEmail` that resolve to the same user) are rejected. Items are processed independently: an unresolved user does not stop other items from being added."})},{description:"Bulk team-membership creation request. Provide one target team and the users to add by ID or email, with a role for each user."}),_$={teamId:"team-123-abc",members:[{userId:"user-123-abc",roleKey:"viewer"},{userEmail:"sam@example.com",roleKey:"editor"}]};Object.assign(tS,{examples:[_$]});var rS=t.Object({results:t.Array(t.Object({userId:t.String({description:"Resolved user ID for this bulk add result. For `user_not_found`, this is the submitted user ID or email that Tsuga could not resolve."}),status:t.Enum(["added","already_member","user_not_found"],{description:"`added` means the membership was created, `already_member` means no change was needed, and `user_not_found` means Tsuga could not resolve the requested user."})}))},{description:"Per-user result summary for a bulk team-membership add request."}),I$={results:[{userId:"user-123-abc",status:"added"},{userId:"sam@example.com",status:"user_not_found"}]};Object.assign(rS,{examples:[I$]});var abe=m({tags:["access-control"],url:`${Bn}/bulk-add`,method:"POST",body:tS,response:rS}),sbe=m({tags:["access-control"],url:`${Bn}/bulk-update-user-roles`,method:"PUT",body:t.Object({userIds:t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:Vc}),teamId:p({allowEmpty:!1}),role:t.Enum(zo)}),response:t.Object({})}),nS=t.Object({teamId:p({allowEmpty:!1,description:"Team ID to remove the requested users from."}),userIds:t.Optional(t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:Vc,description:"User IDs to remove from the team. Items are processed independently: a user who is not a member or cannot be resolved does not stop the other items from being removed."})),userEmails:t.Optional(t.Array(p({allowEmpty:!1,type:"email"}),{minItems:1,maxItems:Vc,description:"User emails to resolve and remove from the team."}))},{oneOf:[{required:["userIds"]},{required:["userEmails"]}],description:"Bulk team-membership removal request. Provide one target team and either `userIds` or `userEmails`, not both, with no duplicates."}),b$={teamId:"team-123-abc",userIds:["user-123-abc"]};Object.assign(nS,{examples:[b$]});var oS=t.Object({results:t.Array(t.Object({userId:t.String({description:"Resolved user ID for this bulk remove result. For `user_not_found`, this is the submitted user ID or email that Tsuga could not resolve."}),status:t.Enum(["removed","not_member","user_not_found"],{description:"`removed` means the membership was deleted, `not_member` means no membership existed, and `user_not_found` means Tsuga could not resolve the requested user."})}))},{description:"Per-user result summary for a bulk team-membership removal request."}),S$={results:[{userId:"user-123-abc",status:"removed"},{userId:"missing@example.com",status:"user_not_found"}]};Object.assign(oS,{examples:[S$]});var cbe=m({tags:["access-control"],url:`${Bn}/bulk-remove`,method:"DELETE",body:nS,response:oS});var O$=["logs","metrics","traces","llm-obs","profiling","analytics","dashboards","ongoing-alerts","slo","monitor","notification-rules","notification-silences","notification-integrations","investigations","routes","sensitive-data-scanner","inventory","services","rum","sessions","host-catalog","kubernetes"],iS=t.Enum(O$,{description:"Stable nav item key within a main sidebar category."}),aS=t.Array(iS,{description:"Nav item keys shown in the primary sidebar for this category, in display order."}),sS=t.Optional(t.Array(iS,{description:"Nav item keys for this category that are folded away (e.g. View more). Omitted or empty means none."})),cS="Stable category id. Unknown or renamed ids are ignored by the client catalog.",pS="Sidebar categories in display order. Unknown or renamed ids are ignored by the client catalog.",gl=t.Object({categories:t.Array(t.Object({id:t.String({description:cS}),visible:aS,folded:sS}),{description:pS})}),uS=t.Object({categories:t.Array(t.Object({id:p({allowEmpty:!1,description:cS}),visible:aS,folded:sS}),{description:pS})});var Wc="/v0/org",A$=`${Wc}/current-user`,lS=`${Wc}/settings`,mS=`${Wc}/allowed-domains`,Zc=50,dS=t.Object({id:t.String(),name:t.String(),createdAt:E(),allowedDomains:t.Array(t.String(),{description:"Email domains whose users are allowed to join the account, via invitation or SSO/SAML just-in-time provisioning. Domains are stored in lowercase."}),enableLlmFeatures:t.Boolean(),allowEmailPasswordLogin:t.Boolean()}),fS=t.Object({allowedDomains:t.Array(p({allowEmpty:!1,type:"lowercase-domain",description:'A lowercase email domain (e.g. "acme.com").'}),{maxItems:Zc,description:"The new full list of email domains whose users are allowed to join the account via invitation or SSO/SAML just-in-time provisioning. Replaces the existing list; omitted domains are no longer allowed."})}),gS=t.Pick(dS,["allowedDomains"]),hbe=m({tags:["organization"],url:A$,method:"GET",response:dS}),Tbe=m({tags:["organization"],url:lS,method:"GET",response:t.Object({enableLlmFeatures:t.Boolean(),allowEmailPasswordLogin:t.Boolean(),sidebarNavLayout:t.Optional(gl)})}),Ebe=m({tags:["organization"],url:lS,method:"PUT",body:t.Object({enableLlmFeatures:t.Optional(t.Boolean()),allowEmailPasswordLogin:t.Optional(t.Boolean()),sidebarNavLayout:t.Optional(t.Union([uS,t.Null()]))}),response:t.Object({enableLlmFeatures:t.Boolean(),allowEmailPasswordLogin:t.Boolean(),sidebarNavLayout:t.Optional(gl)})}),_be=m({tags:["organization"],url:Wc,method:"PUT",body:fS,response:t.Object({allowedDomains:t.Array(t.String())})}),Ibe=m({tags:["organization"],url:mS,method:"GET",response:gS}),bbe=m({tags:["organization"],url:mS,method:"PUT",body:fS,response:gS});var Xc="/v0/admin",Ge=`${Xc}/clusters`,hS=t.Object({helmParameters:t.Record(t.String(),t.Union([t.Number(),t.Boolean(),t.Null(),t.String()])),helmVersion:t.String()}),yS=t.Record(t.String(),hS),Tl=["eu-central-1","eu-central-2","eu-north-1","eu-south-1","eu-south-2","eu-west-1","eu-west-2","eu-west-3","us-east-1","us-east-2","us-west-1","us-west-2","af-south-1","ap-east-1","ap-northeast-1","ap-northeast-2","ap-northeast-3","ap-south-1","ap-south-2","ap-southeast-1","ap-southeast-2","ap-southeast-3","ap-southeast-4","ap-southeast-5","ap-southeast-7","ca-central-1","ca-west-1","il-central-1","me-central-1","me-south-1","mx-central-1","sa-east-1"],El=["europe-west1","europe-west2","europe-west3","europe-west4","europe-west6","europe-west9","europe-central2","europe-north1","us-central1","us-east1","us-east4","us-west1","us-west2","us-west3","us-west4","northamerica-northeast1","southamerica-east1","asia-east1","asia-east2","asia-northeast1","asia-northeast2","asia-northeast3","asia-south1","asia-south2","asia-southeast1","asia-southeast2","australia-southeast1","australia-southeast2"],_l=["australiacentral","australiacentral2","australiaeast","australiasoutheast","austriaeast","belgiumcentral","brazilsouth","brazilsoutheast","canadacentral","canadaeast","centralindia","centralus","chilecentral","eastasia","eastus","eastus2","francecentral","francesouth","germanynorth","germanywestcentral","indonesiacentral","israelcentral","italynorth","japaneast","japanwest","jioindiacentral","jioindiawest","koreacentral","koreasouth","malaysiawest","mexicocentral","newzealandnorth","northcentralus","northeurope","norwayeast","norwaywest","polandcentral","qatarcentral","southafricanorth","southafricawest","southcentralus","southeastasia","southindia","spaincentral","swedencentral","switzerlandnorth","switzerlandwest","uaecentral","uaenorth","uksouth","ukwest","westcentralus","westeurope","westindia","westus","westus2","westus3"],TS=["aws","gcp","azure"],wa=["xs","s","m","l"],Il=["1.0"],x$=["tsuga-cluster","tsuga-telemetry","tsuga-deployer","tsuga-events"],Jc=t.Enum(x$,{description:"Helm installation name identifying a chart component on the cluster."}),R$={id:t.String(),name:t.String(),createdAt:E(),clusterCertificateExpiresAt:E(),bridgeEndpoint:t.String(),deployerEndpoint:t.String(),targetConfiguration:yS,appliedConfiguration:t.Optional(yS),automaticallyDeployLatestVersion:t.Boolean(),automatedDeploymentDisabledBy:t.Optional(t.String()),automatedDeploymentDisabledReason:t.Optional(t.String()),automatedDeploymentDisabledAt:t.Optional(E()),soakTimeMin:t.Optional(t.Number()),clusterSize:t.Optional(t.Enum(wa)),gitSyncByInstallation:t.Record(Jc,t.Boolean(),{description:"Per-installation git-sync state, keyed by installationName."})},yl={...R$,orgId:t.String(),orgName:t.String()},Ube=m({tags:["admin"],method:"GET",url:Ge,query:t.Object({orgId:t.Optional(p())}),response:t.Array(b("clusterType",[t.Object({...yl,clusterType:t.Literal("aws"),clusterAccountId:t.String(),clusterBuilderRoleVersion:t.Optional(t.Enum(Il)),clusterRegion:t.Enum(Tl)}),t.Object({...yl,clusterType:t.Literal("gcp"),clusterAccountId:t.String(),clusterRegion:t.Enum(El)}),t.Object({...yl,clusterType:t.Literal("azure"),clusterTenantId:t.String(),clusterSubscriptionId:t.String(),clusterRegion:t.Enum(_l)})]))}),wbe=m({tags:["admin"],method:"PUT",url:`${Ge}/create`,body:b("clusterType",[t.Object({clusterType:t.Literal("aws"),orgId:p(),name:p(),clusterSize:t.Enum(wa),clusterAccountId:t.String({minLength:12,maxLength:12}),clusterBuilderRoleVersion:t.Enum(Il),clusterRegion:t.Enum(Tl)}),t.Object({clusterType:t.Literal("gcp"),orgId:p(),name:p(),clusterSize:t.Enum(wa),clusterAccountId:p(),clusterRegion:t.Enum(El)}),t.Object({clusterType:t.Literal("azure"),orgId:p(),name:p(),clusterSize:t.Enum(wa),clusterTenantId:p(),clusterSubscriptionId:p(),clusterRegion:t.Enum(_l)})]),response:t.Object({id:t.String(),bridgeEndpoint:t.String(),deployerEndpoint:t.String()})}),Nbe=m({tags:["admin"],method:"DELETE",url:`${Ge}/:id`,params:t.Object({id:p()}),body:t.Object({orgId:p()}),response:x}),Lbe=m({tags:["admin"],method:"PUT",url:`${Ge}/add-inbounder-key`,body:t.Object({orgId:p(),clusterId:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),inbounderAuthenticationKey:t.String()})}),vbe=m({tags:["admin"],method:"PUT",url:`${Ge}/replace-all-inbounder-keys`,body:t.Object({orgId:p(),clusterId:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),inbounderAuthenticationKey:t.String()})}),kbe=m({tags:["admin"],method:"PUT",url:`${Ge}/replace-inbounder-key`,body:t.Object({orgId:p(),clusterId:p(),inbounderAuthenticationKeyToReplace:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),inbounderAuthenticationKey:t.String()})}),Mbe=m({tags:["admin"],method:"PUT",url:`${Ge}/delete-inbounder-key`,body:t.Object({orgId:p(),clusterId:p(),inbounderAuthenticationKeyToDelete:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),isKeyDeleted:t.Boolean()})}),Dbe=m({tags:["admin"],method:"PUT",url:`${Ge}/rotate-deployer-key`,body:t.Object({orgId:p(),clusterId:p(),newKey:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),isKeyUpdated:t.Boolean()})}),Gbe=m({tags:["admin"],method:"PUT",url:`${Ge}/rotate-bridge-key`,body:t.Object({orgId:p(),clusterId:p(),newKey:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),isKeyUpdated:t.Boolean()})}),hl={central:t.String(),ngrokBridgeDomain:t.String(),ngrokDeployerDomain:t.String(),clusterCertificateExpiresAt:E(),clusterName:t.String(),clusterSize:t.Optional(t.Enum(wa)),secretBridgeAuthenticationKey:t.String(),secretDeployerAuthenticationKey:t.String(),secretOutbounderAuthenticationKey:t.String(),slackChannelEmail:t.String(),customerTier:t.String()},$be=m({tags:["admin"],method:"POST",url:`${Ge}/:id`,body:t.Object({orgId:p()}),params:t.Object({id:p()}),response:b("clusterType",[t.Object({...hl,clusterType:t.Literal("aws"),clusterAccountId:t.String(),clusterBuilderRoleVersion:t.Optional(t.Enum(Il)),clusterRegion:t.Enum(Tl)}),t.Object({...hl,clusterType:t.Literal("gcp"),clusterAccountId:t.String(),clusterRegion:t.Enum(El)}),t.Object({...hl,clusterType:t.Literal("azure"),clusterTenantId:t.String(),clusterSubscriptionId:t.String(),clusterRegion:t.Enum(_l)})])}),jbe=m({tags:["admin"],method:"POST",url:`${Ge}/configuration`,body:t.Object({id:p({allowEmpty:!1}),orgId:p({allowEmpty:!1}),installationName:Jc,targetConfiguration:hS,gitSyncEnabled:t.Boolean({description:"Persisted on upgrade: whether this chart's values are synced from git."})}),response:t.Object({status:t.String()})}),Bbe=m({tags:["admin"],method:"GET",url:`${Ge}/git-values`,query:t.Object({orgId:p({allowEmpty:!1}),clusterId:p({allowEmpty:!1}),installationName:Jc}),response:t.Object({valuesYaml:t.Optional(t.String({description:"Merged git values rendered as YAML. Absent when the cluster/chart has no resolvable values in the repository mirror."})),sha:t.Optional(t.String({description:"Abbreviated commit SHA of the mirrored repository. Absent if not yet successfully fetched (or sync disabled)."}))})}),qbe=m({tags:["admin"],method:"POST",url:`${Ge}/git-sync`,body:t.Object({clusterId:p({allowEmpty:!1}),orgId:p({allowEmpty:!1}),installationName:Jc,gitSyncEnabled:t.Boolean({description:"Whether this chart syncs its Helm values from git."})}),response:t.Object({status:t.String()})}),Fbe=m({tags:["admin"],method:"POST",url:`${Ge}/automation`,body:t.Object({id:p(),orgId:p(),enableAutomatedDeployment:t.Boolean(),disabledReason:t.Optional(p())}),response:t.Object({status:t.String()})}),Hbe=m({tags:["admin"],method:"POST",url:`${Ge}/soak-time`,body:t.Object({id:p(),orgId:p(),soakTimeMin:t.Optional(t.Number())}),response:t.Object({status:t.String()})}),Kbe=m({tags:["admin"],method:"POST",url:`${Ge}/deploy`,body:t.Object({orgId:p(),clusterId:p(),chartName:p(),toVersion:p()}),response:t.Object({id:t.String()})}),C$=b("type",[t.Object({type:t.Literal("pending")}),t.Object({type:t.Literal("running")}),t.Object({type:t.Literal("cancelled")}),t.Object({type:t.Literal("timed_out")}),t.Object({type:t.Literal("success"),stateValue:t.Object({message:t.String()})}),t.Object({type:t.Literal("failure"),stateValue:t.Object({message:t.String()})})]),zbe=m({tags:["admin"],method:"GET",url:`${Ge}/deploy`,query:t.Object({orgId:t.Optional(p()),clusterId:t.Optional(p())}),response:t.Array(t.Object({id:t.String(),orgId:t.String(),orgName:t.String(),clusterId:t.String(),clusterName:t.String(),fromVersion:t.Optional(t.String()),toVersion:t.String(),state:C$,updatedAt:E(),createdAt:E(),installationName:t.String(),chartName:t.String(),isAutomated:t.Boolean(),createdBy:t.Optional(t.String()),createdByName:t.Optional(t.String()),createdByEmail:t.Optional(t.String())}))}),P$=t.Object({installations:t.Array(t.Object({installationName:t.String(),parameters:t.Record(t.String(),t.Union([t.Number(),t.Boolean(),t.Null(),t.String()])),version:t.Union([t.String(),t.Null()]),resources:t.Array(t.Object({id:t.Object({kind:t.String(),name:t.String()}),status:t.String(),health:t.String(),rawDetails:t.Optional(t.Any()),liveManifest:t.Optional(t.String()),targetManifest:t.Optional(t.String())})),deployedAt:t.Optional(t.String()),syncStatus:t.Optional(t.String()),healthStatus:t.Optional(t.String())}))}),Ybe=m({tags:["admin"],method:"POST",url:`${Ge}/status`,body:t.Object({orgId:t.Optional(p()),clusterId:t.Optional(p())}),response:t.Array(t.Object({orgId:t.String(),clusterId:t.String(),status:P$}))}),Vbe=m({tags:["admin"],method:"POST",url:`${Ge}/argocd-cert-info`,body:t.Object({orgId:p(),clusterId:p()}),response:t.Object({certificateExpiresAt:t.String()})}),U$=t.Object({kind:t.String(),name:t.String()}),w$=t.Object({id:U$,liveManifest:t.Optional(t.String()),targetManifest:t.Optional(t.String())}),Qbe=m({tags:["admin"],method:"POST",url:`${Ge}/resource-details`,body:t.Object({orgId:p(),clusterId:p(),installationName:p()}),response:t.Object({resources:t.Array(w$)})}),Wbe=m({tags:["admin"],method:"GET",url:`${Ge}/versions`,query:t.Object({chartName:t.Optional(p())}),response:t.Array(t.Object({id:t.String(),chartName:t.String(),locator:t.String(),version:t.String(),repositoryArn:t.String(),type:t.Optional(t.String()),commitHash:t.Optional(t.String()),author:t.Optional(t.String()),lastPulledAt:t.Optional(E()),pushedAt:t.Optional(E())}))});var N$=t.Object({id:t.Object({name:t.String(),kind:t.String()}),previewManifest:t.Optional(t.String())}),Zbe=m({tags:["admin"],method:"POST",url:`${Ge}/versions/render`,body:t.Object({chartName:p(),version:p(),values:p({type:"long"}),installationName:p(),namespace:p()}),response:t.Array(N$)}),br=`${Xc}/orgs`,Xbe=m({tags:["admin"],url:br,method:"GET",query:t.Object({onlyDeleted:t.Optional(t.Boolean())}),response:t.Array(t.Object({id:t.String(),name:t.String(),allowedDomains:t.Array(t.String()),createdAt:E(),updatedAt:E()}))}),Jbe=m({tags:["admin"],url:br,method:"POST",body:t.Object({allowedDomains:t.Array(p({type:"lowercase-domain"}),{maxItems:Zc}),name:p()}),response:t.Object({id:t.String(),name:t.String()})}),eSe=m({tags:["admin"],url:`${br}/:id`,method:"PUT",params:t.Object({id:p()}),body:t.Object({allowedDomains:t.Optional(t.Array(p({type:"lowercase-domain"}),{maxItems:Zc}))}),response:t.Object({id:t.String(),name:t.String(),allowedDomains:t.Array(t.String())})}),tSe=m({tags:["admin"],url:`${br}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),rSe=m({tags:["admin"],url:`${br}/:id/restore`,method:"POST",params:t.Object({id:p()}),response:t.Object({success:t.Boolean()})}),nSe=m({tags:["admin"],url:`${br}/:id/permanent-delete`,method:"DELETE",params:t.Object({id:p()}),response:t.Object({success:t.Boolean(),hasDeletedSecret:t.Boolean(),hasDeletedTenantDb:t.Boolean(),hasDeletedOrgRow:t.Boolean()})}),oSe=m({tags:["admin"],url:`${br}/synchronize-sds-rules`,method:"POST",response:t.Object({errorOrgs:t.Optional(t.Array(t.Object({id:t.String(),name:t.String()}))),synchronizedOrgsCount:t.Number()})}),L$=["custom_usage_tag","ingestion_api_key","inventory_resource","monitor","retention_policy","route","sensitive_data_scanner_rule","tag_policy","team"],v$=t.Enum(L$),iSe=m({tags:["admin"],url:`${br}/refresh-assets`,method:"POST",body:t.Object({assetTypes:t.Array(v$,{minItems:1}),orgId:t.Optional(p({allowEmpty:!1}))}),response:t.Array(t.Object({orgId:t.String(),orgName:t.String(),results:t.Record(t.String(),t.Object({success:t.Boolean()}))}))}),aSe=m({tags:["admin"],url:`${br}/sudo`,method:"POST",body:t.Object({orgId:p()}),response:t.Object({sudoToken:t.String()})}),k$=`${Xc}/users`,sSe=m({tags:["admin"],url:`${k$}/invite`,method:"POST",body:t.Object({email:p({type:"email"}),orgId:p(),userRole:t.Enum(Qc)}),response:t.Array(t.Object({inviteId:t.String(),email:t.String(),result:t.Union([t.Literal("success"),t.Literal("email-failed")])}))});var cSe=m({tags:["admin"],url:`${Xc}/billing-data`,method:"GET",query:t.Object({orgId:p(),maxDaysFetched:t.Optional(t.Number({minimum:1,maximum:365}))}),response:t.Object({dataPoints:t.Array(t.Object({date:t.String(),telemetryKind:t.Union([t.Literal("logs"),t.Literal("metrics"),t.Literal("rum"),t.Literal("traces")]),totalBytes:t.Number(),clusterId:t.String(),apiKeyId:t.String(),apiKeyName:t.String(),teamName:t.String()})),availableFilters:t.Object({clusters:t.Array(t.Object({id:t.String(),name:t.String()})),apiKeys:t.Array(t.Object({id:t.String(),name:t.String()})),teamNames:t.Array(t.String())})})});var ES=t.Object({id:t.String({description:"Unique Tsuga cluster ID. Tsuga assigns it when the cluster record is created. Use this value as `clusterId` with public API requests that accept `clusterId`."}),name:t.String({description:"Cluster name stored in Tsuga. Usable as a display label when `friendlyName` is not set."}),friendlyName:t.Optional(t.String({description:"Human-readable display name for the cluster. Present when a friendly name is configured."})),clusterType:t.Enum(TS,{description:"Cloud provider selected for the Tsuga cluster."}),clusterRegion:t.String({description:"Cloud region selected for the cluster using the provider region identifier."})},{$id:"Cluster",description:"Tsuga cluster available to the organization. Use its `id` to scope public API requests that accept `clusterId`."}),M$={id:"abc-123-def",name:"production",friendlyName:"Production (US)",clusterType:"aws",clusterRegion:"us-east-1"};Object.assign(ES,{examples:[M$]});var _S=m({description:"Lists Tsuga clusters available to the organization. Use cluster IDs with public API requests that accept `clusterId`, such as telemetry, service, Kubernetes Explorer, and quality-report requests.",operationId:"listClusters",tags:["clusters"],url:`/${"v1"}/clusters`,method:"GET",response:t.Array(ES)});function IS(e,r){e.command("clusters").description("Manage Tsuga cluster selection").command("list").description("List all Tsuga clusters available to the operation API key").action(async()=>{let o=await r()(_S);Q(o)})}function SS(e,r,n,o){let i=e.commands.map(c=>c.name()).filter(c=>!c.startsWith("__")),a=e.options.map(c=>c.long).filter(c=>!!c);for(let c of e.options)(c.required||c.optional)&&(c.long&&o.add(c.long),c.short&&o.add(c.short));n.set(r.join(" "),{cmds:i,flags:[...a,"--help"]});for(let c of e.commands)c.name().startsWith("__")||SS(c,[...r,c.name()],n,o)}function D$(e){let r=new Map,n=new Set;return SS(e,[],r,n),{rows:[...r].map(([i,{cmds:a,flags:c}])=>({key:i,cmds:[...new Set(a)].join(" "),flags:[...new Set(c)].join(" ")})),valueFlags:[...n].join(" ")}}function bS(e){return e.map(({key:r,cmds:n,flags:o})=>` ${JSON.stringify(r)}) cmds=${JSON.stringify(n)} flags=${JSON.stringify(o)} ;;`).join(`
|
|
49
|
+
`)}function G$(e,r){return`_tsuga_complete() {
|
|
50
50
|
local cur key cmds flags words i word prev
|
|
51
51
|
local valueflags="${r}"
|
|
52
52
|
local -a path
|
|
@@ -67,7 +67,7 @@ ${e}
|
|
|
67
67
|
COMPREPLY=( $(compgen -W "$words" -- "$cur") )
|
|
68
68
|
}
|
|
69
69
|
complete -F _tsuga_complete tsuga
|
|
70
|
-
`}function
|
|
70
|
+
`}function $$(e,r){return`#compdef tsuga
|
|
71
71
|
_tsuga_complete() {
|
|
72
72
|
local cur key cmds flags out i word prev
|
|
73
73
|
local valueflags="${r}"
|
|
@@ -89,10 +89,10 @@ ${e}
|
|
|
89
89
|
compadd -- \${=out}
|
|
90
90
|
}
|
|
91
91
|
compdef _tsuga_complete tsuga
|
|
92
|
-
`}function
|
|
93
|
-
set cmds ${
|
|
94
|
-
set flags ${
|
|
95
|
-
`)}function
|
|
92
|
+
`}function bl(e){return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function j$(e){return e.map(({key:r,cmds:n,flags:o})=>` case ${bl(r)}
|
|
93
|
+
set cmds ${bl(n)}
|
|
94
|
+
set flags ${bl(o)}`).join(`
|
|
95
|
+
`)}function B$(e,r){return`# Update with: tsuga completion fish > ~/.config/fish/completions/tsuga.fish
|
|
96
96
|
function __tsuga_complete
|
|
97
97
|
set -l valueflags -- ${r}
|
|
98
98
|
set -l tokens (commandline -xpc)
|
|
@@ -127,51 +127,51 @@ ${e}
|
|
|
127
127
|
end
|
|
128
128
|
end
|
|
129
129
|
complete -c tsuga -f -a '(__tsuga_complete)'
|
|
130
|
-
`}function
|
|
130
|
+
`}function OS(e){e.command("completion <SHELL>").description("Print a shell completion script (bash, zsh, or fish)").addHelpText("after",`
|
|
131
131
|
Usage:
|
|
132
132
|
bash: eval "$(tsuga completion bash)" # add to ~/.bashrc
|
|
133
133
|
zsh: eval "$(tsuga completion zsh)" # add to ~/.zshrc
|
|
134
|
-
fish: tsuga completion fish > ~/.config/fish/completions/tsuga.fish`).action(r=>{let{rows:n,valueFlags:o}=
|
|
135
|
-
...`};Object.assign(yS,{examples:[_$]});var hS=t.Object({kind:t.Enum(["doc","api"],{description:"`doc` for documentation pages (guides, references, release notes); `api` for API-reference endpoints indexed from the OpenAPI spec. Use this to decide how to present or follow up on the result."}),path:t.String({description:"Path identifying the result. Documentation pages use a slug path (e.g. `data-collection/guides/how-to-add-resource-attributes`). API-reference results use `api/<operationId>` (e.g. `api/aggregateScalar`)."}),title:t.String({description:'Title of the result (e.g. "How to Add Resource Attributes" or "POST /v1/aggregation/multi-query/scalar")'}),subsection:t.Optional(t.String({description:'For documentation pages: the heading path inside the page that matched (e.g. "Language setup"). For API results: the matched field or parameter breadcrumb (e.g. "Body \u203A queries"). Absent when the match is the page or endpoint intro.'})),tab:t.Optional(t.String({description:'Tab label inside the page that the result matched. Set when the matching content is inside a <Tabs><Tab label="\u2026"> block. Always absent for API results.'})),anchor:t.Optional(t.String({description:"For documentation pages: the slugified heading ID used as the URL fragment (e.g. `language-setup`). For API results: the Scalar deep-link fragment (`tag/<tag>/<METHOD><path>`). The `link` field already has this baked in."})),score:t.Number({description:"Relevance score between 0 and 1 (higher is more relevant)"}),excerpt:t.String({description:"Short snippet of matching content"}),link:t.String({description:"URL to the result in the Tsuga app. Documentation pages include the section anchor and tab query parameter when applicable. API results deep-link into the API reference at `/documentation/api#tag/\u2026`."})},{$id:"DocSearchResult",description:"A documentation page or API-reference endpoint search result"}),I$={kind:"doc",path:"data-collection/guides/how-to-add-resource-attributes",title:"How to Add Resource Attributes",subsection:"Set resource attributes by language",tab:"Python",anchor:"set-resource-attributes-by-language",score:.9,excerpt:"...Python SDK setup should use the default resource detectors...",link:"https://www.app.tsuga.com/documentation/data-collection/guides/how-to-add-resource-attributes?tab=Python#set-resource-attributes-by-language"};Object.assign(hS,{examples:[I$]});var TS=m({description:"Retrieve the raw markdown content of a documentation or API-reference page by its path. Documentation pages use slug paths (e.g. `getting-started/send-your-first-logs`); API-reference pages use `api/<operationId>` (e.g. `api/aggregateScalar`).",operationId:"getDocPage",tags:["public","docs"],url:gS,method:"GET",query:t.Object({path:p({allowEmpty:!1,description:"Documentation path to fetch. Use page slug paths for docs or `api/<operationId>` for API-reference pages."})},{description:"Documentation page lookup query."}),response:yS}),ES=m({description:"Searches public documentation pages and API-reference endpoints. Use this to build help search or route users to Tsuga docs and API reference results. Results are ranked by relevance; an empty array means no page or endpoint matched the query.",operationId:"searchDocs",tags:["public","docs"],url:`${gS}/search`,method:"GET",query:t.Object({query:p({allowEmpty:!1,description:"Search text to match against documentation and API-reference content."})},{description:"Documentation search query."}),response:t.Array(hS)});function _S(e,r){let n=e.command("docs").description("Search and fetch Tsuga documentation and API-reference pages");n.command("get <DOC_PATH>").description("Get a documentation or API-reference page by path (e.g. 'getting-started/send-your-first-logs' or 'api/aggregateScalar')").action(async o=>{let i=await r()(TS,{query:{path:o}});Q(i)}),n.command("search <SEARCH_TEXT>").description("Search Tsuga documentation and the full API reference, ranked by relevance").action(async o=>{let i=await r()(ES,{query:{query:o}});Q(i)})}var b$=`/${"v1"}/feedback`,IS=t.Object({id:t.String({description:"API request ID recorded with the feedback."})},{$id:"Feedback",description:"A recorded piece of feedback"}),S$={id:"request-123-abc"};Object.assign(IS,{examples:[S$]});var bS=t.Object({content:p({allowEmpty:!1,type:"long",description:"Free-text feedback content, e.g. what went wrong, what was confusing, or a suggestion. Required and must be non-empty."})}),O$={content:"The traces command times out for large services."};Object.assign(bS,{examples:[O$]});var SS=m({description:"Submit free-text feedback about Tsuga tools or APIs, e.g. a tool that failed, returned unusable output, or was confusing to use. Feedback is recorded for the Tsuga team to review and improve tooling.",operationId:"createFeedback",tags:["public","feedback"],url:b$,method:"POST",body:bS,response:IS});function OS(e,r){e.command("feedback <MESSAGE...>").description("Send feedback about Tsuga tools or APIs (e.g. a tool that failed or was confusing)").action(async n=>{let o=await r()(SS,{body:{content:n.join(" ")}});Q(o)})}var A$={investigation:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"ingestion-api-key":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"rum-public-token":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"widget-share":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"audit-log":{read:["public_viewer","public_editor","admin"],write:[]},"custom-usage-tag":{read:["public_viewer","public_editor","admin"],write:["admin"]},"cluster-integration-config":{read:["admin"],write:["admin"]},"explorer-saved-view":{read:["public_viewer","public_editor","admin"],write:["public_viewer","public_editor","admin"]},"operation-api-key":{read:["public_viewer","public_editor","admin"],write:["admin"]},"cloud-account":{read:["public_viewer","public_editor","admin"],write:["admin"]},dashboard:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"dashboard-folder":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"dashboard-report":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},inventory:{read:["public_viewer","public_editor","admin"],write:[]},log:{read:["public_viewer","public_editor","admin"],write:[]},"log-route":{read:["public_viewer","public_editor","admin"],write:["admin","public_editor"]},"metric-route":{read:["public_viewer","public_editor","admin"],write:["admin","public_editor"]},metric:{read:["public_viewer","public_editor","admin"],write:[]},trace:{read:["public_viewer","public_editor","admin"],write:[]},rum:{read:["public_viewer","public_editor","admin"],write:[]},monitor:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"monitor-alert":{read:["public_viewer","public_editor","admin"],write:[]},"monitor-debugging":{read:["admin"],write:[]},"notification-integration":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"notification-rule":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"adaptive-notification-rule":{read:["public_viewer","public_editor","admin"],write:["admin"]},"notification-silence":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"saml-config":{read:["admin"],write:["admin"]},org:{read:["public_viewer","public_editor","admin"],write:["admin"]},"allowed-domains":{read:["public_viewer","public_editor","admin"],write:["admin"]},"quality-report":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"sensitive-data-scanner-rule":{read:["public_viewer","public_editor","admin"],write:["admin"]},slo:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"retention-policy":{read:["public_viewer","public_editor","admin"],write:["admin"]},"databricks-connection":{read:["public_viewer","public_editor","admin"],write:["admin"]},service:{read:["public_viewer","public_editor","admin"],write:[]},"service-target":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},host:{read:["public_viewer","public_editor","admin"],write:[]},database:{read:["public_viewer","public_editor","admin"],write:[]},"tag-policy":{read:["public_viewer","public_editor","admin"],write:["admin"]},team:{read:["public_viewer","public_editor","admin"],write:["admin"]},"team-members":{read:["public_viewer","public_editor","admin"],write:["admin"]},"team-remap-config":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-data":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-invitation":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-permissions":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-self":{read:["public_viewer","public_editor","admin"],write:["public_viewer","public_editor","admin"]},"oauth-grant":{read:[],write:[]}},x$={investigation:{read:["viewer","editor","admin"],write:["editor","admin"]},"ingestion-api-key":{read:["viewer","editor","admin"],write:["editor","admin"]},"rum-public-token":{read:["viewer","editor","admin"],write:["editor","admin"]},"widget-share":{read:["viewer","editor","admin"],write:["viewer","editor","admin"]},"audit-log":{read:["viewer","editor","admin"],write:[]},"custom-usage-tag":{read:[],write:[]},"cluster-integration-config":{read:[],write:[]},"explorer-saved-view":{read:["viewer","editor","admin"],write:["viewer","editor","admin"]},"operation-api-key":{read:["viewer","editor","admin"],write:[]},"cloud-account":{read:["viewer","editor","admin"],write:[]},dashboard:{read:["viewer","editor","admin"],write:["editor","admin"]},"dashboard-folder":{read:["viewer","editor","admin"],write:["editor","admin"]},"dashboard-report":{read:["viewer","editor","admin"],write:["editor","admin"]},inventory:{read:["viewer","editor","admin"],write:[]},log:{read:["viewer","editor","admin"],write:[]},"log-route":{read:["viewer","editor","admin"],write:["editor","admin"]},"metric-route":{read:["viewer","editor","admin"],write:["editor","admin"]},metric:{read:["viewer","editor","admin"],write:[]},trace:{read:["viewer","editor","admin"],write:[]},rum:{read:["viewer","editor","admin"],write:[]},monitor:{read:["viewer","editor","admin"],write:["editor","admin"]},"monitor-alert":{read:["viewer","editor","admin"],write:[]},"monitor-debugging":{read:["admin"],write:[]},"notification-integration":{read:["viewer","editor","admin"],write:["editor","admin"]},"notification-rule":{read:["viewer","editor","admin"],write:["editor","admin"]},"adaptive-notification-rule":{read:["viewer","editor","admin"],write:[]},"notification-silence":{read:["viewer","editor","admin"],write:["editor","admin"]},"saml-config":{read:[],write:[]},org:{read:["viewer","editor","admin"],write:[]},"allowed-domains":{read:["viewer","editor","admin"],write:[]},"quality-report":{read:["viewer","editor","admin"],write:["editor","admin"]},"sensitive-data-scanner-rule":{read:["viewer","editor","admin"],write:[]},slo:{read:["viewer","editor","admin"],write:["editor","admin"]},"retention-policy":{read:[],write:[]},"databricks-connection":{read:[],write:[]},service:{read:["viewer","editor","admin"],write:[]},"service-target":{read:["viewer","editor","admin"],write:["editor","admin"]},host:{read:["viewer","editor","admin"],write:[]},database:{read:["viewer","editor","admin"],write:[]},"tag-policy":{read:[],write:[]},team:{read:["viewer","editor","admin"],write:["admin"]},"team-members":{read:["viewer","editor","admin"],write:["admin"]},"team-remap-config":{read:[],write:[]},"user-data":{read:["viewer","editor","admin"],write:["admin"]},"user-invitation":{read:["viewer","editor","admin"],write:["admin"]},"user-permissions":{read:["viewer","editor","admin"],write:[]},"user-self":{read:["viewer","editor","admin"],write:["viewer","editor","admin"]},"oauth-grant":{read:[],write:[]}},R$={user:A$,team:x$};function fl(e){return AS(e,"team")}function gl(e){return AS(e,"user")}function AS(e,r){let n=[],o=R$[r];for(let[i,a]of Object.entries(o))for(let[c,l]of Object.entries(a))l.includes(e)&&n.push({actionType:c,resourceType:i});return n}var gSe={admin:{name:"Global admin",description:"Full control across the organization. Can view and modify everything, including private teams.",permissions:gl("admin"),roleKey:"admin"},public_editor:{name:"Public editor",description:"Can view and edit assets in public teams, but not access private teams or critical settings.",permissions:gl("public_editor"),roleKey:"public_editor"},public_viewer:{name:"Public viewer",description:"Read-only access to public team data. Cannot make changes.",permissions:gl("public_viewer"),roleKey:"public_viewer"},teams_only:{name:"Teams only",description:"Only access data and assets in their own teams.",permissions:[],roleKey:"teams_only"}},ySe={admin:{name:"Team admin",description:"Full team control, manage assets, members, and settings.",permissions:fl("admin"),roleKey:"admin"},editor:{name:"Team editor",description:"Can view and update most assets (like dashboards, monitors).",permissions:fl("editor"),roleKey:"editor"},viewer:{name:"Team viewer",description:"Can view all team data but cannot make changes.",permissions:fl("viewer"),roleKey:"viewer"}};var xS="__tsuga_cluster_id__",C$=t.Object({}),P$=t.Object({status:t.Literal("error"),message:t.String({description:"Why this cluster failed to answer the query."})});function Yo(e=C$){let r=b("status",[t.Object({...e.properties,status:t.Literal("ok")}),P$]);return Object.assign(gc(Dt,r),{description:'Outcome per cluster, keyed by cluster ID. A cluster that failed reports `status: "error"`.'})}var U$=5,Pa=t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:U$,uniqueItems:!0,description:"IDs of the clusters to query, without duplicates. Mutually exclusive with `clusterId`. Omit both to use the default cluster."});var RS=t.Object({type:t.Literal("number"),number:t.String()}),w$=t.Object({type:t.Literal("string"),string:t.String()}),N$=t.Object({type:t.Literal("timestamp"),timestamp:t.String()}),Ua=b("type",[RS,w$,N$]),L$=t.Object({by:t.Record(t.String(),Ua),computed:t.Record(t.String(),RS)}),v$=t.Object({type:t.Literal("buckets"),buckets:t.Array(L$),clusterResponses:t.Optional(Yo())}),k$=t.Object({type:t.Literal("distribution"),bounds:t.Array(t.Number()),buckets:t.Array(t.Object({timestamp:t.Number(),counts:t.Array(t.Number())})),percentiles:t.Optional(t.Array(t.Number()))}),Wc=b("type",[v$,k$]);var M$=["all","owning-team-and-public","owning-team-only"],ln=t.Enum(M$,{description:"`all` allows the resource to query all permitted telemetry, `owning-team-and-public` limits it to the owning team plus public data, and `owning-team-only` limits it to the owning team."});var PS=1456444800,US=4927737600,D$=PS*1e3,G$=US*1e3,Zc=1704067200,yl=Zc*1e3,wS={title:"TimeRange",description:"Inclusive time range for telemetry queries. Use Unix timestamps in seconds unless the field description says milliseconds.",examples:[{from:Zc,to:Zc}]},$$={title:"TimeRange",description:"Inclusive time range for telemetry queries using Unix timestamps in milliseconds.",examples:[{from:yl,to:yl}]},Xc=e=>t.Integer({description:e,examples:[Zc],minimum:PS,maximum:US,format:"int64"}),CS=e=>t.Integer({description:e,examples:[yl],minimum:D$,maximum:G$,format:"int64"}),Ye=t.Object({from:t.Optional(Xc("Start of the query window as a Unix timestamp in seconds")),to:t.Optional(Xc("End of the query window as a Unix timestamp in seconds"))},wS),mt=t.Object({from:Xc("Start of the query window as a Unix timestamp in seconds"),to:Xc("End of the query window as a Unix timestamp in seconds")},wS),Vo=t.Object({from:CS("Start of the query window as a Unix timestamp in milliseconds"),to:CS("End of the query window as a Unix timestamp in milliseconds")},$$);var B$="/v0/aggregation",F$=t.Union([t.Literal("a"),t.Literal("d"),t.Literal("q"),t.Literal("w"),t.Literal("t")]),hl=t.Object({parallelism:t.Number(),engine:F$,recordBatchCache:t.Optional(t.Boolean()),includeNullGroups:t.Optional(t.Boolean()),restartAwareGaugeSum:t.Optional(t.Boolean())}),Tl=["logs","metrics","traces"];var vS={logs:"Logs",metrics:"Metrics",traces:"Spans"},H$=[...Tl,"connections","log-patterns","spans","rum"];var $Se={...vS,connections:"Connections","log-patterns":"Log Patterns",spans:"Spans",rum:"RUM events"},pr=[...Tl,"rum"];var jSe={...vS,rum:"RUM events"};var qSe=t.Enum(H$,{description:"Data source being queried"}),kS=t.Enum(Tl,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, or `traces`."}),zt=t.Enum(pr,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, `traces`, or `rum`."}),Bn=t.String({description:"Attribute containing the values to aggregate"}),Fn=p({description:"Attribute containing the values to aggregate"}),K$=b("type",[t.Object({type:t.Literal("count",{description:"Counts the total number of records"}),field:t.Optional(Bn)},{$id:"AggregateCount",title:"Count"}),t.Object({type:t.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:Bn},{$id:"AggregateUniqueCount",title:"UniqueCount"}),t.Object({type:t.Literal("average",{description:"Calculates the average value of the selected field"}),field:Bn},{$id:"AggregateAverage",title:"Average"}),t.Object({type:t.Literal("max",{description:"Finds the largest value of the field"}),field:Bn},{$id:"AggregateMax",title:"Max"}),t.Object({type:t.Literal("min",{description:"Finds the smallest value of the field"}),field:Bn},{$id:"AggregateMin",title:"Min"}),t.Object({type:t.Literal("sum",{description:"Sums the values of the selected field"}),field:Bn},{$id:"AggregateSum",title:"Sum"}),t.Object({type:t.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:Bn,percentile:t.Number({description:"Percentile to compute for the selected field."})},{$id:"AggregatePercentile",title:"Percentile"})],{title:"Aggregate",description:"Aggregation operation for this query. Required for every query; `field` is required by all aggregate types except `count`."}),z$=b("type",[t.Object({type:t.Literal("count",{description:"Counts the total number of records"}),field:t.Optional(Fn)},{$id:"InputAggregateCount",title:"Count"}),t.Object({type:t.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:Fn},{$id:"InputAggregateUniqueCount",title:"UniqueCount"}),t.Object({type:t.Literal("average",{description:"Calculates the average value of the selected field"}),field:Fn},{$id:"InputAggregateAverage",title:"Average"}),t.Object({type:t.Literal("max",{description:"Finds the largest value of the field"}),field:Fn},{$id:"InputAggregateMax",title:"Max"}),t.Object({type:t.Literal("min",{description:"Finds the smallest value of the field"}),field:Fn},{$id:"InputAggregateMin",title:"Min"}),t.Object({type:t.Literal("sum",{description:"Sums the values of the selected field"}),field:Fn},{$id:"InputAggregateSum",title:"Sum"}),t.Object({type:t.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:Fn,percentile:t.Number({description:"Percentile to compute for the selected field."})},{$id:"InputAggregatePercentile",title:"Percentile"})],{title:"InputAggregate",description:"Aggregation operation for this query. Required for every query; `field` is required by all aggregate types except `count`."}),MS=t.Object({type:t.Literal("per-second",{description:"Normalizes the metric to events per second"})},{$id:"FunctionPerSecond",title:"PerSecond"}),DS=t.Object({type:t.Literal("per-minute",{description:"Normalizes the metric to events per minute"})},{$id:"FunctionPerMinute",title:"PerMinute"}),GS=t.Object({type:t.Literal("per-hour",{description:"Normalizes the metric to events per hour"})},{$id:"FunctionPerHour",title:"PerHour"}),$S=t.Object({type:t.Literal("rate",{description:"Calculates the rate of change"})},{$id:"FunctionRate",title:"Rate"}),jS=t.Object({type:t.Literal("increase",{description:"`Increase` is designed for cumulative metrics. It computes the increase of cumulative metrics by automatically handling counter resets. When used with an aggregation such as `sum` it combines all series without requiring an explicit group-by."})},{$id:"FunctionIncrease",title:"Increase"}),qS=t.Object({type:t.Literal("power",{description:"Raises values to a specified power"}),exponent:t.Integer({description:"The exponent to raise values to"})},{$id:"FunctionPower",title:"Power"}),BS=t.Object({type:t.Literal("sqrt",{description:"Applies a square root transformation to the values"})},{$id:"FunctionSqrt",title:"Sqrt"}),FS=t.Object({type:t.Literal("last",{description:"Takes the last value of the metric for the selected time frame"})},{$id:"FunctionLast",title:"Last"}),Y$=t.Object({type:t.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:t.String({description:"Duration of the rolling window"})},{$id:"FunctionRolling",title:"Rolling"}),V$=t.Object({type:t.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:p({allowEmpty:!1,description:"Duration of the rolling window"})},{$id:"InputFunctionRolling",title:"Rolling"}),Q$=t.Object({type:t.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:t.Integer({description:"The base of the logarithm"})},{$id:"FunctionLog",title:"Log"}),W$=t.Object({type:t.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:t.Integer({description:"The base of the logarithm",minimum:2})},{$id:"InputFunctionLog",title:"Log"}),Z$=t.Object({type:t.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:t.Integer({description:"Number of seconds to offset"})},{$id:"FunctionTimeOffset",title:"TimeOffset"}),X$=t.Object({type:t.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:t.Integer({description:"Number of seconds to offset",minimum:1})},{$id:"InputFunctionTimeOffset",title:"TimeOffset"}),J$=b("type",[MS,DS,GS,$S,jS,Y$,Q$,qS,BS,FS,Z$],{title:"Function",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."}),e1=b("type",[MS,DS,GS,$S,jS,V$,W$,qS,BS,FS,X$],{title:"InputFunction",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."});var NS=t.Object({min:t.Number({description:"Lower bound of the distribution range."}),max:t.Number({description:"Upper bound of the distribution range."})}),t1=["linear","log"],Jc=t.Enum(t1,{description:"Spacing of the bucket boundaries across the distribution range. `linear` splits the range into equal-width buckets; `log` widens each bucket logarithmically, giving finer resolution near the lower bound."}),LS=t.Integer({minimum:1}),r1=b("type",[t.Object({type:t.Literal("scalar")},{title:"Scalar",description:"Returns a single value"}),t.Object({type:t.Literal("timeseries"),aggregationWindow:p({description:'Time bucket size for aggregation (e.g. "10s", "60s", "1m")'})},{title:"Timeseries",description:"Returns a time series"}),t.Object({type:t.Literal("histogram"),by:t.Optional(p()),bucketCount:t.Optional(LS),bounds:t.Optional(NS),boundsScale:t.Optional(Jc),percentiles:t.Optional(t.Array(t.Number({minimum:0,maximum:100,multipleOf:1}),{minItems:1}))},{title:"Histogram",description:"Returns a single distribution over the entire time range"}),t.Object({type:t.Literal("heatmap"),aggregationWindow:p({description:'Time bucket size for the heatmap (e.g. "10s", "60s", "1m")'}),by:t.Optional(p()),bucketCount:t.Optional(LS),bounds:t.Optional(NS)},{title:"Heatmap",description:"Returns a distribution per time window"})]),ep=15,n1=["zero","null"],o1=t.Enum(n1,{description:"`zero` fills missing points with zero. `null` keeps missing points null."}),HS=t.Object({mode:t.Object({type:o1},{description:"How missing aggregation points should be filled."})},{description:"Missing-point fill behavior for aggregation results. Optional; omit to keep missing points null."}),KS=t.Union([t.Literal("avg"),t.Literal("sum"),t.Literal("min"),t.Literal("max"),t.Literal("last")],{description:"Per-series rollup applied within each time bucket before the cross-series aggregate. When omitted, a default is derived from the metric type."}),zS={aggregate:K$,functions:t.Optional(t.Array(J$,{description:"Post-processing functions applied to aggregation results"})),fill:t.Optional(HS),timeAggregate:t.Optional(KS)},YS={aggregate:z$,functions:t.Optional(t.Array(e1,{maxItems:10,description:"Post-processing functions applied to aggregation results. Defaults to an empty array when omitted."})),fill:t.Optional(HS),timeAggregate:t.Optional(KS)},i1={description:"Aggregations that may be combined together in the same query. Each item is referenced from `formula` as q1, q2, and so on, in submission order."},VS={maxItems:ep,description:'Aggregations that may be combined together in the same query. Each item is referenced from `formula` as q1, q2, and so on, in submission order. For dataSource "metrics", each aggregate\'s `field` is the metric name, not an attribute; to count distinct values of an attribute use unique-count with field "<metricName>.context.<attribute>" (e.g. "system.cpu.utilization.context.host.name").'},QS=t.Array(t.Object({...zS,filter:t.Optional(t.String({description:"Filter to apply to the aggregation"}))},{title:"AggregationQuery"}),i1),wa=t.Array(t.Object({...YS,filter:t.Optional(p({type:"tsuga-query",description:"Tsuga query filter to apply to the aggregation. Defaults to an empty string when omitted."}))},{title:"AggregationQuery"}),VS),Sr=t.Array(t.Object({...zS,filter:t.String({description:"Filter to apply to the aggregation"})},{title:"MonitorAggregationQuery",description:"Single aggregation query evaluated by a monitor or SLO."}),{description:"Aggregation queries used by alerting and SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."}),Or=t.Array(t.Object({...YS,filter:p({type:"tsuga-query",description:"Tsuga query filter applied to this alerting or SLO aggregation query. Required by the API; use the query language for the selected data source."})},{title:"MonitorAggregationQuery",description:"Single aggregation query evaluated by a monitor or SLO."}),{...VS,description:"Aggregation queries used by alerting and SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."});var tp=t.String({description:"Formula referencing submitted query outputs, such as `q1 + q2`. References must be within `q1` through `qN` for the submitted queries."}),Hn=p({type:"tsuga-formula",description:"Formula referencing query outputs, such as `q1 + q2`, to compute derived results. Defaults to `q1`. Formulas may reference only submitted queries (`q1` through `qN`); undefined query references return 400."}),a1=t.Object({fields:t.Array(t.String(),{description:"Telemetry attribute names used to group aggregation results."}),limit:t.Number({description:'Maximum number of distinct values of `fields` returned for this grouping level, ranked by aggregate value. Groups beyond the limit are truncated, not merged into an "other" group.'}),sortOrder:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:t.Optional(t.String({description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),s1=t.Object({fields:t.Array(p(),{maxItems:1,description:"Telemetry attribute name to group aggregation results by. Currently limited to one field per grouping level."}),limit:t.Number({description:'Maximum number of distinct values of `fields` to return for this grouping level, ranked by aggregate value. Groups beyond the limit are truncated from the response, not merged into an "other" group.'}),sortOrder:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:t.Optional(p({allowEmpty:!1,description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),WS=7;var Qo=t.Array(a1,{description:"Nested grouping levels applied to the results, outermost first (e.g. group by service, then by level within each service). Each level splits results further, so the response contains one result per unique combination of group values."}),Ar=t.Array(s1,{maxItems:WS,description:"Nested grouping levels applied to aggregation results, outermost first (e.g. group by service, then by level within each service). Each level splits results further, so the response contains one result per unique combination of group values instead of one aggregated total. Defaults to an empty array (one ungrouped result) when omitted."});var BSe=m({tags:["aggregation"],url:`${B$}/multi-query`,method:"POST",body:t.Object({timeRange:Vo,queries:wa,groupBy:t.Optional(Ar),returnType:r1,dataSource:zt,formula:Hn,executionOptions:hl,triggeredBy:t.Optional(t.Literal("refresh")),shouldStreamResults:t.Optional(t.Boolean()),clusterId:t.Optional(p({allowEmpty:!1})),clusterIds:t.Optional(Pa),viewAs:t.Optional(t.Object({owner:p({allowEmpty:!1,description:"Team ID to fetch data as"}),permissions:ln}))}),response:Wc});var El=["red","orange","amber","yellow","green","emerald","teal","cyan","sky","blue","indigo","purple","pink"],_l=["light","dark"];var c1={light:{red:{text:"foreground.red",background:"avatar.background.red"},orange:{text:"foreground.orange",background:"avatar.background.orange"},amber:{text:"foreground.amber",background:"avatar.background.amber"},yellow:{text:"foreground.yellow",background:"avatar.background.yellow"},green:{text:"foreground.green",background:"avatar.background.green"},emerald:{text:"foreground.emerald",background:"avatar.background.emerald"},teal:{text:"foreground.teal",background:"avatar.background.teal"},cyan:{text:"foreground.cyan",background:"avatar.background.cyan"},sky:{text:"foreground.sky",background:"avatar.background.sky"},blue:{text:"foreground.blue",background:"avatar.background.blue"},indigo:{text:"foreground.indigo",background:"avatar.background.indigo"},purple:{text:"foreground.purple",background:"avatar.background.purple"},pink:{text:"foreground.pink",background:"avatar.background.pink"}},dark:{red:{text:"avatar.foreground.foreground",background:"avatar.solid-background.red"},orange:{text:"avatar.foreground.foreground",background:"avatar.solid-background.orange"},amber:{text:"avatar.foreground.foreground",background:"avatar.solid-background.amber"},yellow:{text:"avatar.foreground.foreground",background:"avatar.solid-background.yellow"},green:{text:"avatar.foreground.foreground",background:"avatar.solid-background.green"},emerald:{text:"avatar.foreground.foreground",background:"avatar.solid-background.emerald"},teal:{text:"avatar.foreground.foreground",background:"avatar.solid-background.teal"},cyan:{text:"avatar.foreground.foreground",background:"avatar.solid-background.cyan"},sky:{text:"avatar.foreground.foreground",background:"avatar.solid-background.sky"},blue:{text:"avatar.foreground.foreground",background:"avatar.solid-background.blue"},indigo:{text:"avatar.foreground.foreground",background:"avatar.solid-background.indigo"},purple:{text:"avatar.foreground.foreground",background:"avatar.solid-background.purple"},pink:{text:"avatar.foreground.foreground",background:"avatar.solid-background.pink"}},gradient:{red:"var(--chakra-colors-gradient-red)",orange:"var(--chakra-colors-gradient-orange)",amber:"var(--chakra-colors-gradient-amber)",yellow:"var(--chakra-colors-gradient-yellow)",green:"var(--chakra-colors-gradient-green)",emerald:"var(--chakra-colors-gradient-emerald)",teal:"var(--chakra-colors-gradient-teal)",cyan:"var(--chakra-colors-gradient-cyan)",sky:"var(--chakra-colors-gradient-sky)",blue:"var(--chakra-colors-gradient-blue)",indigo:"var(--chakra-colors-gradient-indigo)",purple:"var(--chakra-colors-gradient-purple)",pink:"var(--chakra-colors-gradient-pink)"}},ZS=["activity-heart","activity","airplay","airpods","alarm-clock","anchor","annotation-dots","annotation-heart","annotation-question","annotation","announcement-03","asterisk-01","atom-01","atom-02","award-03","award-04","award-05","backpack","bank-note-01","bank-note-02","bank-note-03","battery-charging-01","beaker-01","beaker-02","bell-03","bell-04","bell-ringing-03","bell-ringing-04","bluetooth-connect","bluetooth-on","book-closed","book-open-01","book-open-02","bookmark","briefcase-01","briefcase-02","brush-01","brush-02","brush-03","building-01","building-02","building-03","building-08","bus","calculator","calendar-check-01","calendar-date","calendar-heart-01","calendar","camera-01","camera-lens","car-01","certificate-01","certificate-02","check-heart","clipboard-attachment","clipboard-check","clipboard-download","clipboard","clock-snooze","clock-stopwatch","cloud-01","cloud-lightning","cloud-moon","cloud-raining-01","cloud-raining-03","cloud-raining-05","cloud-raining-06","cloud-snowing-01","cloud-sun-01","cloud-sun-02","cloud-sun-03","code-browser","code-circle-01","code-circle-02","code-circle-03","code-square-01","code-square-02","coins-hand","coins-stacked-01","colors","compass-01","compass-02","compass-03","compass","credit-card-01","credit-card-02","cube-02","cube-04","cube-outline","currency-bitcoin-circle","currency-dollar-circle","currency-ethereum-circle","currency-euro-circle","currency-pound-circle","currency-ruble-circle","currency-rupee-circle","currency-yen-circle","cursor-click-01","cursor-click-02","diamond-01","diamond-02","dice-1","dice-2","dice-3","dice-4","dice-5","dice-6","disc-01","disc-02","droplets-01","droplets-02","droplets-03","dropper","face-content","face-frown","face-happy","face-neutral","face-sad","face-smile","face-wink","feather","file-02","file-05","file-06","file-heart-01","file-heart-02","file-search-01","file-search-02","file-search-03","film-01","film-02","fingerprint-03","fingerprint-04","flag-01","flag-04","flash-off","flash","gaming-pad-01","gaming-pad-02","gift-01","glasses-01","glasses-02","globe-03","globe-04","globe-05","globe-06","globe-slated-01","globe-slated-02","graduation-hat-01","graduation-hat-02","hash-01","hash-02","headphones-01","headphones-02","heart-circle","heart-hand","heart-hexagon","heart-octagon","heart-rounded","heart-square","hearts","hexagon-01","hexagon-02","home-03","home-smile","hourglass-01","hourglass-02","hourglass-03","hurricane-01","hurricane-02","hurricane-03","image-01","image-02","image-03","image-04","image-05","keyboard-01","laptop-01","life-buoy-01","life-buoy-02","lightbulb-02","lightbulb-03","lightbulb-04","lock-keyhole-circle","lock-keyhole-square","luggage-01","luggage-02","luggage-03","magic-wand-01","magic-wand-02","map-01","map-02","mark","marker-pin-01","marker-pin-04","marker-pin-05","marker-pin-06","medical-circle","medical-cross","medical-square","message-chat-square","message-notification-square","message-smile-square","message-text-square-02","microphone-01","microphone-02","microscope","modem-01","modem-02","monitor-03","monitor-04","monitor-05","moon-01","moon-eclipse","moon-star","music-note-01","music-note-02","music-note-plus","octagon","palette","paperclip","pentagon","phone-01","phone-02","phone-call-01","phone","piggy-bank-01","pin-01","pin-02","plane","play-circle","play-square","podcast","power-02","presentation-chart-01","printer","receipt","recording-01","recording-02","recording-03","rocket-01","rocket-02","roller-brush","rss-01","rss-02","ruler","scales-01","scales-02","server-06","shield-01","shield-02","shield-03","shield-dollar","shield-zap","shopping-bag-01","shopping-cart-01","signal-01","signal-02","signal-03","simcard","sliders-01","sliders-02","snowflake-01","snowflake-02","speaker-01","speaker-02","speaker-03","speedometer-01","speedometer-02","speedometer-03","speedometer-04","square","stand","star-03","star-07","sticker-circle","sticker-square","sun-setting-01","sun-setting-02","sun-setting-03","sun","sunrise","sunset","tablet-01","tag-01","tag-02","tag-03","target-01","target-02","target-03","target-04","target-05","terminal-browser","terminal-circle","terminal-square","thermometer-02","thermometer-03","thermometer-cold","thermometer-warm","thumbs-down","thumbs-up","ticket-01","tool-01","tool-02","train","tram","translate-01","triangle","trophy-01","trophy-02","truck-01","truck-02","tv-02","umbrella-01","umbrella-02","umbrella-03","virus","voicemail","wallet-01","wallet-02","wallet-05","watch-circle","watch-square","waves","webcam-01","webcam-02","wind-01","wind-02","wind-03","youtube","zap-circle","zap-fast","zap"];var VSe=c1.light.red.background;var XS=[{key:"amex15_digits",name:"American Express card (1x15 digits)",category:"financial-data",example:"378282246310005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"amex4443_digits",name:"American Express card (4+4+4+3 digits)",category:"financial-data",example:"3782 8224 6310 005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"amex465_digits",name:"American Express card (4+6+5 digits)",category:"financial-data",example:"3782 822463 10005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"amex87_digits",name:"American Express card (8+7 digits)",category:"financial-data",example:"37828224 6310005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card14_digits",name:"Diners card (1x14 digits)",category:"financial-data",example:"30569309025904",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card4442_digits",name:"Diners card (4+4+4+2 digits)",category:"financial-data",example:"3056 9309 0259 04",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card464_digits",name:"Diners card (4+6+4 digits)",category:"financial-data",example:"3056 930902 5904",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card86_digits",name:"Diners card (8+6 digits)",category:"financial-data",example:"30569309 025904",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"discover_card16_digits",name:"Discover card (1x16 digits)",category:"financial-data",example:"6011111111111117",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"discover_card88_digits",name:"Discover card (2x8 digits)",category:"financial-data",example:"60111111 11111117",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"discover_card4444_digits",name:"Discover card (4x4 digits)",category:"financial-data",example:"6011 1111 1111 1117",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"jcb_card16_digits",name:"JCB card (1x16 digits)",category:"financial-data",example:"3530111333300000",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"jcb_card88_digits",name:"JCB card (2x8 digits)",category:"financial-data",example:"35301113 33300000",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"jcb_card4444_digits",name:"JCB card (4x4 digits)",category:"financial-data",example:"3530 1113 3330 0000",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"maestro_card16_digits",name:"Maestro card (1x16 digits)",category:"financial-data",example:"6759649826438453",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"maestro_card88_digits",name:"Maestro card (2x8 digits)",category:"financial-data",example:"67596498 26438453",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"maestro_card4444_digits",name:"Maestro card (4x4 digits)",category:"financial-data",example:"6759 6498 2643 8453",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"mastercard16_digits",name:"Mastercard (1x16 digits)",category:"financial-data",example:"5555555555554444",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"mastercard88_digits",name:"MasterCard (2x8 digits)",category:"financial-data",example:"55555555 55554444",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"mastercard4444_digits",name:"MasterCard (4x4 digits)",category:"financial-data",example:"5555 5555 5555 4444",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa16_digits",name:"Visa (1x16 digits)",category:"financial-data",example:"4111111111111111",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa19_digits",name:"Visa (1x19 digits)",category:"financial-data",example:"4111111111111111151",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa88_digits",name:"Visa (2x8 digits)",category:"financial-data",example:"41111111 11111111",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa883_digits",name:"Visa (8+8+3 digits)",category:"financial-data",example:"41111111 11111111 151",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa4444_digits",name:"Visa (4x4 digits)",category:"financial-data",example:"4111 1111 1111 1111",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa44443_digits",name:"Visa (4+4+4+4+3 digits)",category:"financial-data",example:"4111 1111 1111 1111 151",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"dropbox_long_lived_api_token",name:"Dropbox long lived API token",category:"credential",example:"767cb868836AAAAAAAAAAszri2cnmzu5tr0yf-nvclmwfyiswl67qyqw-uzn-scg",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:[a-z0-9]{11}(AAAAAAAAAA)[a-z0-9\\-_=]{43})"},{key:"dropbox_short_lived_api_token",name:"Dropbox short lived API token",category:"credential",example:"sl.nu0yvsrposcjeyjcpmbfrmqygllrxpahrgbt8flml9xroifbic",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:sl\\.[a-z0-9\\-=_]{50})"},{key:"french_nirpp",name:"French social security number (NIRPP)",category:"personal-information",example:"188073512757119",isUsingLuhnAlgorithm:!1,regexp:"([12])\\s*[0-9]{2}\\s*(0[1-9]|1[0-2])\\s*(2[AB]|[0-9]{2})\\s*([0-9]{3})\\s*([0-9]{3})(\\s*[0-9]{2})?"},{key:"ip_address",name:"IP address",category:"device-identifier",example:"81.55.13.53",isUsingLuhnAlgorithm:!1,regexp:""},{key:"social_security_number",name:"Social security number (XXX-XX-XXXX)",category:"personal-information",example:"437-02-2223",isUsingLuhnAlgorithm:!1,regexp:"(?x)(?-u:\\b)(?:00[1-9]|0[1-9][0-9]|[1-578][0-9]{2}|6[0-57-9][0-9]|66[0-57-9])-(?:0[1-9]|[1-9]0|[1-9][1-9])-(?:000[1-9]|00[1-9]0|0[1-9]00|[1-9]000|[1-9]{4})(?-u:\\b)"},{key:"social_security_number_space",name:"Social security number (XXX XX XXXX)",category:"personal-information",example:"437 02 2223",isUsingLuhnAlgorithm:!1,regexp:"(?x)(?-u:\\b)(?:00[1-9]|0[1-9][0-9]|[1-578][0-9]{2}|6[0-57-9][0-9]|66[0-57-9])\\s+(?:0[1-9]|[1-9]0|[1-9][1-9])\\s+(?:000[1-9]|00[1-9]0|0[1-9]00|[1-9]000|[1-9]{4})(?-u:\\b)"},{key:"social_security_number_digits",name:"Social security number (9 digits)",category:"personal-information",example:"437022223",isUsingLuhnAlgorithm:!1,regexp:"(?x)(?-u:\\b)(?:00[1-9]|0[1-9][0-9]|[1-578][0-9]{2}|6[0-57-9][0-9]|66[0-57-9])(?:0[1-9]|[1-9]0|[1-9][1-9])(?:000[1-9]|00[1-9]0|0[1-9]00|[1-9]000|[1-9]{4})(?-u:\\b)"},{key:"email",name:"Email",category:"credential",example:"admin@tsuga.com",isUsingLuhnAlgorithm:!1,regexp:"[a-zA-Z0-9-_.]*[a-zA-Z0-9_](@[a-zA-Z0-9_]+)(\\.[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)?[a-zA-Z])(?-u:\\b)"},{key:"one_password_secret_key",name:"1Password secret key",category:"credential",example:"A3-O28NKC-F58GULWCN72-4NIKS-KGY7V-U7FAT",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)A3-[A-Z0-9]{6}-(?:(?:[A-Z0-9]{11})|(?:[A-Z0-9]{6}-[A-Z0-9]{5}))-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}(?-u:\\b)"},{key:"one_password_service_account_token",name:"1Password service account token",category:"credential",example:"ops_eyJdAZ/FoIyz0jAXpEQOrRdIE8ydVaYfAXeZXGFqHWfBOjnE/Vgf5kHIbwrNAp2WeFNPeFiVJPlLv1hmaTVums0ldq1Kv8JEglMqP3f0ATBuX/WRbKqXYS3Z1wSzxg6S0krW4df7ZplvK04+JhJimejyTEH5dYaxqsYDBSLxjeEq7JWsmHEuXj6WP5qQi7FB+5s+CwhWPWY/jDhUMB3fdowXbfv5VnWri3iYrfBh+bFeRe9KURhXGHRDE9hgs",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ops_eyJ[a-zA-Z0-9+/]{50}"},{key:"adafruit_api_key",name:"Adafruit API key",category:"credential",example:"jb9pb4unb2bhe7xqepmgwtl2jg7ti101",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{32})"},{key:"adobe_client_id",name:"Adobe client ID",category:"credential",example:"c4166853dfd2897ebe706d49ef13fe63",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"adobe_client_secret",name:"Adobe client secret",category:"credential",example:"p8e-bb6e1614324ae48e507d33af176db3b7",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:p8e-[a-z0-9]{32})"},{key:"age_secret_key",name:"Age secret key",category:"credential",example:"AGE-SECRET-KEY-1QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}"},{key:"airtable_api_key",name:"Airtable API key",category:"credential",example:"19b73hbi0tc5cdy4w",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{17})"},{key:"algolia_api_key",name:"Algolia API key",category:"credential",example:"346155deb68d31c4018d73de73452947",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"alibaba_access_key_id",name:"Alibaba Cloud AccessKey ID",category:"credential",example:"LTAI7cc6804e4c2155cd52bd",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:LTAI[a-z0-9]{20})"},{key:"alibaba_secret_key",name:"Alibaba Cloud secret key",category:"credential",example:"suwixirhh10xhnko9bv0vfg2971u9p",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{30})"},{key:"anthropic_admin_api_key",name:"Anthropic admin API key",category:"credential",example:"sk-ant-admin01-abc12fake-456def789ghij-klmnopqrstuvwx-3456yza789bcde-12fakehijklmnopby56aaaogaopaaaabc123xyzAA",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sk-ant-admin01-[a-zA-Z0-9_-]{93}AA)"},{key:"anthropic_api_key",name:"Anthropic API key",category:"credential",example:"sk-ant-api03-abc123xyz-456def789ghij-klmnopqrstuvwx-3456yza789bcde-1234fghijklmnopby56aaaogaopaaaabc123xyzAA",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sk-ant-api03-[a-zA-Z0-9_-]{93}AA)"},{key:"artifactory_api_key",name:"Artifactory API key",category:"credential",example:"AKCpt771klpkqllt647fdf36fq43radbz2w2nyetvx4l90qyeef8kbgkmke63ul5vf6mqsy82",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AKCp[A-Za-z0-9]{69}(?-u:\\b)"},{key:"artifactory_reference_token",name:"Artifactory reference token",category:"credential",example:"cmVmdc6i6888t9viuobfd88e46pdonjjsvmme6np82qti7wzbj7l9m1ygtyl9wik",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)cmVmd[A-Za-z0-9]{59}(?-u:\\b)"},{key:"asana_client_id",name:"Asana client ID",category:"credential",example:"9760134337886314",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{16})"},{key:"asana_client_secret",name:"Asana client secret",category:"credential",example:"tcnc8mjrf5bad359nnz3j1z90gow67ji",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"atlassian_api_token",name:"Atlassian API token",category:"credential",example:"fdo4scsa4kh53jnenkfp5fbe",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:[a-z0-9]{20}[a-f0-9]{4})|(?-u:\\b)(?:ATATT3[A-Za-z0-9_-=]{50})"},{key:"authress_service_client_access_key",name:"Authress service client access key",category:"credential",example:"sc_scmz00n9xj.0ykp.acc_2k5vtnrec4.55vc9459s-gc5qlia7a67jvzm0bobn3g0ezimd3b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\\.[a-z0-9]{4,6}\\.(?-i:acc)[_-][a-z0-9-]{10,32}\\.[a-z0-9+/_=-]{30})"},{key:"aws_access_token",name:"AWS access token",category:"credential",example:"AKIALALEMEL33243OLIB",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})(?-u:\\b)"},{key:"azure_ad_client_secret",name:"Azure AD client secret",category:"credential",example:"bP88Q~rcBcYjzzOhg1Hnn76Wm3jGgakZiZ.8vMgR",isUsingLuhnAlgorithm:!1,regexp:"(?:^|[\\\\'\"` \\r\\n\\t\\f\\v>=:(?:,)])(?:[a-zA-Z0-9_~.]{3}[0-9]Q~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'\"` \\r\\n\\t\\f\\v<),])"},{key:"bitbucket_client_id",name:"Bitbucket client ID",category:"credential",example:"yyxmjnl3kahirvct7sat2082pzqdyf09",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"bitbucket_client_secret",name:"Bitbucket client secret",category:"credential",example:"fylw1pominwz91e5guqjiugw6srutpl64vzch5rnt8xnt31ka7so9va73fscz836",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{64})"},{key:"beamer_api_token",name:"Beamer API token",category:"credential",example:"b_zhy-phuoqk13asco6az4u_0yhtklgswm4umkv95nv4gu",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:b_[a-z0-9=_\\-]{44})"},{key:"codecov_access_token",name:"Codecov access token",category:"credential",example:"r93iopllonuphk41qglet20y8cb83thm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"clickhouse_cloud_api_secret_key",name:"ClickHouse Cloud API secret key",category:"credential",example:"4b1dbRdW3rOcB7xLthrM4BTBGK1qPLkHigpN1bXD6z",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:4b1d[A-Za-z0-9]{38})(?-u:\\b)"},{key:"clojars_api_token",name:"Clojars API token",category:"credential",example:"CLOJARS_d1vd7t0blxaarzx25dxoda4hm5ox86st6o5ww7tnzsfz07wvu223bf0fmgim",isUsingLuhnAlgorithm:!1,regexp:"CLOJARS_[a-z0-9]{60}"},{key:"cloudflare_api_key",name:"Cloudflare API key",category:"credential",example:"ckg0h_dzkxnl627gy3nskpq9wzm4d5hc_vxk272h",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{40})"},{key:"cloudflare_global_api_key",name:"Cloudflare global API key",category:"credential",example:"1d003bb65ec73ad2691fb76631b6496e3c9d9",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{37})"},{key:"cloudflare_origin_ca_key",name:"Cloudflare Origin CA key",category:"credential",example:"v1.0-aaa334dc886f30631ba0a610-0d98ef66290d7e50aac7c27b5986c99e6f3f1084c881d8ac0eae5de1d1aa0644076ff57022069b3237d19afe60ad045f207ef2b16387ee37b749441b2ae2e9ebe5b4606e846475d4a5",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:v1\\.0-[a-f0-9]{24}-[a-f0-9]{50})"},{key:"cohere_api_token",name:"Cohere API token",category:"credential",example:"lpn59BQ4FNUabVJh1vCpIqZpQbaViELQrTa14p9D",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:[a-zA-Z0-9]{40})"},{key:"confluent_access_token",name:"Confluent access token",category:"credential",example:"kkat92sclkukwvr2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{16})"},{key:"confluent_secret_key",name:"Confluent secret key",category:"credential",example:"64d4ppp37l9fjhadm8vv0awie6wjo4d6ourfcqvi2bcs2tm95x4f0e8gyb8z8usj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"contentful_delivery_api_token",name:"Contentful delivery API token",category:"credential",example:"eumospigka64wiwpavfmmblrq7x1hm6gz84wiiw2ff3",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{43})"},{key:"curl_auth_header",name:"Curl authorization header",category:"credential",example:"curl --header 'Authorization: 5eb4223e-5008-46e5-be67-c7b8f2732305'",isUsingLuhnAlgorithm:!1,regexp:`(?-u:\\b)curl(?-u:\\b)(?:.*?|.*?(?:[\\r\\n]{1,2}.*?){1,5})[ \\t\\n\\r](?:-H|--header)(?:=|[ \\t]{0,5})(?:"(?:Authorization:[ \\t]{0,5}(?:Basic[ \\t](?:[a-z0-9+/]{8,}={0,3})|(?:Bearer|(?:Api-)?Token)[ \\t](?:[a-zA-Z0-9_=~@.+/-]{8,})|(?:[a-zA-Z0-9_=~@.+/-]{8,}))|(?:(?:X-(?:[a-z]+-)?)?(?:Api-?)?(?:Key|Token)):[ \\t]{0,5}(?:[a-zA-Z0-9_=~@.+/-]{8,}))"|'(?:Authorization:[ \\t]{0,5}(?:Basic[ \\t](?:[a-z0-9+/]{8,}={0,3})|(?:Bearer|(?:Api-)?Token)[ \\t](?:[a-zA-Z0-9_=~@.+/-]{8,})|(?:[a-zA-Z0-9_=~@.+/-]{8,}))|(?:(?:X-(?:[a-z]+-)?)?(?:Api-?)?(?:Key|Token)):[ \\t]{0,5}(?:[a-zA-Z0-9_=~@.+/-]{8,}))')(?:(?-u:\\B)|[ \\r\\n\\t\\f\\v]|\\z)`},{key:"curl_auth_user",name:"Curl basic authentication",category:"credential",example:"curl -u elastic:P@ssw0rd$1",isUsingLuhnAlgorithm:!1,regexp:`(?-u:\\b)curl(?-u:\\b)(?:.*|.*(?:[\\r\\n]{1,2}.*){1,5})[ \\t\\n\\r](?:-u|--user)(?:=|[ \\t]{0,5})(?:"(:[^"]{3,}|[^:"]{3,}:|[^:"]{3,}:[^"]{3,})"|'(?:[^:']{3,}:[^']{3,})'|(?:(?:"[^"]{3,}"|'[^']{3,}'|[a-zA-Z0-9_$@.-]+):(?:"[^"]{3,}"|'[^']{3,}'|[a-zA-Z0-9_\${}@.-]+)))(?:[ \\r\\n\\t\\f\\v]|\\z)`},{key:"databricks_api_token",name:"Databricks API token",category:"credential",example:"dapia2553f815d29a193fd09c2bb55201895",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:dapi[a-f0-9]{32}(?:-[0-9])?)"},{key:"datadog_access_token",name:"Datadog access token",category:"credential",example:"ljgbhjnca2hy5yc2nv7cag1ag7ehx2hc6geparov",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{40})"},{key:"defined_networking_api_token",name:"Defined Networking API token",category:"credential",example:"dnkey-nowf_nwyqhvqt1gi66xnuuf2rb-bfxnr9_qydyxnxn1y8uijvhhp9owllbg-2czoe-7qs5_w5650xei",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:-[a-z0-9=_\\-]{26}-[a-z0-9=_\\-]{52})"},{key:"digitalocean_pat",name:"DigitalOcean personal access token",category:"credential",example:"dop_v1_ec8f4a856c1459bd442a275461e2f709506347de30b180851cde71f696e9fcc8",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:dop_v1_[a-f0-9]{64})"},{key:"digitalocean_access_token",name:"DigitalOcean OAuth access token",category:"credential",example:"doo_v1_42b8ea6c4b0c373f88aff9d3fa87e123ab23b0d3c22ac6d4361a4e9c1e89eaa6",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:doo_v1_[a-f0-9]{64})"},{key:"digitalocean_refresh_token",name:"DigitalOcean OAuth refresh token",category:"credential",example:"dor_v1_4d9b3e6fbe65ab472e464dfa6377d702e80164442acdfbeb3ef032d917cb9984",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:dor_v1_[a-f0-9]{64})"},{key:"discord_api_token",name:"Discord API token",category:"credential",example:"7eb855d9a40747182d0b0ea74df27aee31d05756a9933a815a3ccb5a46b2d61d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{64})"},{key:"discord_client_id",name:"Discord client ID",category:"credential",example:"763721114261247538",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{18})"},{key:"discord_client_secret",name:"Discord client secret",category:"credential",example:"13641266018325206246161633988007",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{32})"},{key:"doppler_api_token",name:"Doppler API token",category:"credential",example:"dp.pt.vgin8wwjy7sx66fyq99tavkm3y5g2jdxmsufh257dhj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)dp\\.pt\\.[a-z0-9]{43}"},{key:"dropbox_api_token",name:"Dropbox API token",category:"credential",example:"rdlztoij88rzrsk",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{15})"},{key:"droneci_access_token",name:"DroneCI access token",category:"credential",example:"v26gffr903rbti5v7m392ba0u7oarz36",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"duffel_api_token",name:"Duffel API token",category:"credential",example:"duffel_test_-yd6b3pc4jy593pt5kr2l3ynzkb5b_f619dshefiz=v",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)duffel_(?:test|live)_[a-z0-9_\\-=]{43}"},{key:"dynatrace_api_token",name:"Dynatrace API token",category:"credential",example:"dt0c01.ben820rdpb1so4kasfx3yn4a.zkje7lawif35udsin5t1mi1m1sne7wdzphlzrmdnu3j69gr4kgf5dwg4x5lb30zg",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)dt0c01\\.[a-z0-9]{24}\\.[a-z0-9]{64}"},{key:"easypost_api_token",name:"EasyPost API token",category:"credential",example:"EZAKBVScDZwZFv0nJXHBcxPGil7eztnPJOSmDFf2NGKQk6Dn7VqULciSRm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)EZAK[a-z0-9]{54}(?-u:\\b)"},{key:"easypost_test_api_token",name:"EasyPost test API token",category:"credential",example:"EZTKuxUXVU5HBS1K2iyh165t3VtivpdxMgIf5Y2P1oJxeFeaJGcwzVexds",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)EZTK[a-z0-9]{54}(?-u:\\b)"},{key:"etsy_access_token",name:"Etsy access token",category:"credential",example:"8ssp35lhprxpb3sjyergcz5z",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{24})"},{key:"facebook_secret",name:"Facebook secret",category:"credential",example:"c41c21ba4fb5ee05398db86ca83f06db",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"facebook_access_token",name:"Facebook access token",category:"credential",example:"911602140448729|AY-lRJZq9BoDLobvAiP25L7RcMg",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:[0-9]{15,16}(\\||%)[0-9a-z\\-_]{27,40})"},{key:"facebook_page_access_token",name:"Facebook page access token",category:"credential",example:"EAAM9GOnCB9kBO2frzOAWGN2zMnZClQshlWydZCrBNdodesbwimx1mfVJgqZBP5RSpMfUzWhtjTTXHG5I1UlvlwRZCgjm3ZBVGeTYiqAAoxyED6HaUdhpGVNoPUwAuAWWFsi9OvyYBQt22DGLqMIgD7VktuCTTZCWKasz81Q822FPhMTB9VFFyClNzQ0NLZClt9zxpsMMrUZCo1VU1rL3CKavir5QTfBjfCEzHNlWAUDUV2YZD",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:EAA[MC][a-z0-9]{50})"},{key:"fastly_api_token",name:"Fastly API token",category:"credential",example:"im7_ux24tyyxz_4y4mvzj22akpid830c",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{32})"},{key:"finicity_client_secret",name:"Finicity client secret",category:"credential",example:"roepymyr0ce7wxhjvgb2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{20})"},{key:"finicity_api_token",name:"Finicity API token",category:"credential",example:'= "cce089057c8b7fe7f2a8474b9a050816',isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"flickr_access_token",name:"Flickr access token",category:"credential",example:"damvt93tudulk6wrfp36sawndc9pa7bb",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"finnhub_access_token",name:"Finnhub access token",category:"credential",example:"x01lnfp13spcbsa0at32",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{20})"},{key:"flutterwave_public_key",name:"Flutterwave public key",category:"credential",example:"FLWPUBK_TEST-99484d505b4ee5c1181a2884f5fe3852-X",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)FLWPUBK_TEST-[a-h0-9]{32}-X"},{key:"flutterwave_secret_key",name:"Flutterwave secret key",category:"credential",example:"FLWSECK_TEST-66187ac83488c2245f0d7e95fa37e833-X",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)FLWSECK_TEST-[a-h0-9]{32}-X"},{key:"flutterwave_encryption_key",name:"Flutterwave encryption key",category:"credential",example:"FLWSECK_TEST-6262214a02e7",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)FLWSECK_TEST-[a-h0-9]{12}"},{key:"flyio_access_token",name:"Fly.io access token",category:"credential",example:"fo1_m-HT0NHLBSPwMJ2hIer4v3lxtWEC7grXNidQxJMrVVE",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:fo1_[a-zA-Z0-9_-]{43}|fm1[ar]_[a-zA-Z0-9+\\/]{50}))"},{key:"frameio_api_token",name:"Frame.io API token",category:"credential",example:"fio-u-4ov9vjtr2wwj8j1gob-8xrx2-1=z818psmitskgoq4=p-_k77d54034z55xk-lqh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)fio-u-[a-z0-9\\-_=]{64}"},{key:"freshbooks_access_token",name:"FreshBooks access token",category:"credential",example:"gqw118uwne1nddlt4yruvvs4jr9s0vrj5mxaswgb2amacod8lgnmrknsvbovsx1g",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"gocardless_api_token",name:"GoCardless API token",category:"credential",example:"live_-z4lwtrrk6p6=-v1ig_y_4ceplziwek0lw=oz-eu",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:live_[a-z0-9\\-_=]{40})"},{key:"gcp_api_key",name:"GCP API key",category:"credential",example:"AIzaYpvGqEzpgB7R353HD9CxN8LuhZ6d6UfuXLL",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:AIza[a-zA-Z0-9_-]{35})"},{key:"github_pat",name:"GitHub personal access token",category:"credential",example:"ghp_t7i9llxuukeb7apn4zlnyeyz5b0007rsfs54",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ghp_[0-9a-zA-Z]{36}"},{key:"github_fine_grained_pat",name:"GitHub fine-grained personal access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)github_pat_[a-zA-Z0-9_]{82}"},{key:"github_oauth",name:"GitHub OAuth token",category:"credential",example:"gho_anlrm6zqscqityoqozv503by66dobnem4yxh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)gho_[0-9a-zA-Z]{36}"},{key:"github_app_token",name:"GitHub app token",category:"credential",example:"ghs_0zleityj4n1ulz178o9in1w97q1ifw8u3y8h",isUsingLuhnAlgorithm:!1,regexp:"(?:ghu|ghs)_[0-9a-zA-Z]{36}"},{key:"github_refresh_token",name:"GitHub refresh token",category:"credential",example:"ghr_inu1aa7qbgi46cf8nprbgh4kn03d0zk35raj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ghr_[0-9a-zA-Z]{36}"},{key:"gitlab_cicd_job_token",name:"GitLab CI/CD job token",category:"credential",example:"glcbt-7h2nr_6jmho0uoqkb1ww431kfl",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glcbt-[0-9a-zA-Z]{1,5}_[0-9a-zA-Z_-]{20}"},{key:"gitlab_deploy_token",name:"GitLab deploy token",category:"credential",example:"gldt-7a3o70gqa8zkal0zdp4x",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)gldt-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_feature_flag_client_token",name:"GitLab feature flag client token",category:"credential",example:"glffct-dsct62ndnvcj7alw5nas",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glffct-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_feed_token",name:"GitLab feed token",category:"credential",example:"glft-13956nvy00289v6xu0di",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glft-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_incoming_mail_token",name:"GitLab incoming mail token",category:"credential",example:"glimt-fcdt1a5jvj01si61jgkse2r20",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glimt-[0-9a-zA-Z_\\-]{25}"},{key:"gitlab_kubernetes_agent_token",name:"GitLab Kubernetes agent token",category:"credential",example:"glagent-8wxkulkbbuk7u6r3nvrefswdfw5o0v7vy81y4oky8rnfogm826",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glagent-[0-9a-zA-Z_\\-]{50}"},{key:"gitlab_oauth_app_secret",name:"GitLab OAuth app secret",category:"credential",example:"gloas-vawws2nw5kf6rizn49g41jc3jiy4xqioaihrwm1msltbdt4cbmo4x52tygcic7af",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)gloas-[0-9a-zA-Z_\\-]{64}"},{key:"gitlab_pat",name:"GitLab personal access token",category:"credential",example:"glpat-2gl3ku1497ms4gzyv16i",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glpat-[a-zA-Z0-9_-]{20}"},{key:"gitlab_pat_routable",name:"GitLab personal access token (routable)",category:"credential",example:"glpat-2hf7vebpux9j56tdcqqsvap7vxc.chvjof35u",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glpat-[0-9a-zA-Z_-]{27}\\.[0-9a-z]{2}[0-9a-z]{7}(?-u:\\b)"},{key:"gitlab_ptt",name:"GitLab personal access token (temporary)",category:"credential",example:"glptt-b54e8b7b90cf006b79af110baa9b8d9183fd7048",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glptt-[0-9a-f]{40}"},{key:"gitlab_rrt",name:"GitLab registration token",category:"credential",example:"GR1348941vnauzmn2hj0zncvt0nfe",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)GR1348941[a-zA-Z0-9_-]{20}"},{key:"gitlab_runner_authentication_token",name:"GitLab runner authentication token",category:"credential",example:"glrt-xbd1w7c9clbxm52zdxkm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glrt-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_runner_authentication_token_routable",name:"GitLab runner authentication token (routable)",category:"credential",example:"glrt-t5_8d8ugbkfzddae0dw06tvm0x7qxc.mwcd1a7cn",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glrt-t[0-9]_[0-9a-zA-Z_\\-]{27}\\.[0-9a-z]{2}[0-9a-z]{7}(?-u:\\b)"},{key:"gitlab_scim_token",name:"GitLab SCIM token",category:"credential",example:"glsoat-9jb5zk1nvy800c1uqhh0",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glsoat-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_session_cookie",name:"GitLab session cookie",category:"credential",example:"_gitlab_session=yjhub6vtrp60djn6rszuemeacsoqox97",isUsingLuhnAlgorithm:!1,regexp:"_gitlab_session=[0-9a-z]{32}"},{key:"gitter_access_token",name:"Gitter access token",category:"credential",example:"uazubes6trcd_1gym09opuf_8gj1rmvj6jwber4a",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{40})"},{key:"grafana_api_key",name:"Grafana API key",category:"credential",example:"eyJrIjoiyl5shjvqja0xkfbu38m24vn5httsipr1h9fgjhodxzlkpravuiy8h7hom5kt8gtwuguh2v",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:eyJrIjoi[A-Za-z0-9]{70}={0,3})"},{key:"grafana_cloud_api_token",name:"Grafana cloud API token",category:"credential",example:"glc_cb7p4j2g1qu0sy84me72ufmn1z8mqk8y",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:glc_[A-Za-z0-9+/]{32}={0,3})"},{key:"grafana_service_account_token",name:"Grafana service account token",category:"credential",example:"glsa_rm3sadbwl8o2c13v4ipgkz04h66kiy6t_edaea401",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})"},{key:"harness_api_key",name:"Harness API key",category:"credential",example:"pat.vzcxr183pymw194fdq1q0v.qjqjarqkd9ydxqagjmq3f5iq.8nn5nyaow3h5mmgjh053",isUsingLuhnAlgorithm:!1,regexp:"(?:pat|sat)\\.[a-zA-Z0-9_-]{22}\\.[a-zA-Z0-9]{24}\\.[a-zA-Z0-9]{20}"},{key:"hashicorp_tf_api_token",name:"HashiCorp Terraform API token",category:"credential",example:"984d8033429986.atlasv1.799k5cihj_807yc1e8afvla8ackd1khsb50nfeswbxbr1re54y0wpzs2tjy=",isUsingLuhnAlgorithm:!1,regexp:"[a-z0-9]{14}\\.(?-i:atlasv1)\\.[a-z0-9\\-_=]{60,70}"},{key:"heroku_api_key",name:"Heroku API key",category:"credential",example:"9127f65b-8b3f-c0b7-a336-a4347e71bc51",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"heroku_api_key_v2",name:"Heroku API key v2",category:"credential",example:"HRKU-AAxPYvV6l2R3DvF0w9VJ4m8cz9oaygOHxpQvcw--iD51MszQZeakD9DZsclX",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(HRKU-AA[0-9a-zA-Z_-]{58}))"},{key:"hubspot_api_key",name:"HubSpot API key",category:"credential",example:"86cb6664-b191-db72-95a7-49adebe84b74",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})"},{key:"huggingface_access_token",name:"HuggingFace access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:hf_(?i:[a-z]{34}))"},{key:"huggingface_organization_api_token",name:"HuggingFace organization API token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:api_org_(?i:[a-z]{34}))"},{key:"intercom_api_key",name:"Intercom API key",category:"credential",example:"zuc5c=ykf5gcwesqvmh2pji6k3extx0rbalsznte3sdo7iu7f-lumol2npfk",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{60})"},{key:"intra42_client_secret",name:"Intra42 client secret",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:s-s4t2(?:ud|af)-[abcdef0123456789]{64})"},{key:"jfrog_api_key",name:"JFrog API key",category:"credential",example:"lj7nrgoo0kr04kw312zvly7l0olsn37vhto5wdn3yqi5srxnc2axstp7a1kewkxi717w295kh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{73})"},{key:"jfrog_identity_token",name:"JFrog identity token",category:"credential",example:"xh0x2upbtkkg1pseg7ezmcyw2c3kt0bt05l5v8ynvkro6wagolhch0f7kppplt8b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"jwt",name:"JSON web token",category:"credential",example:"ey7gzQUpN8Kz7XY6Yin.ey1o36_XrBphAG8WMHQ.",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:ey[a-zA-Z0-9]{17,}\\.ey[a-zA-Z0-9\\/\\\\_-]{17,}\\.(?:[a-zA-Z0-9\\/\\\\_-]{10,}={0,2})?)"},{key:"jwt_base64",name:"JSON web token base64",category:"credential",example:"ZXlKNE5YUWpVekkxTmlJNklsUjFUM0pDZVRKT1kxUnNSbE5YZFZvNFMyZzRWemhCYWxGaFoySTBabTVtVURGVGJFdE5Uemd0VTI4aWZRLmV5SnBjM01pT2lKcWIyVWlMQTBLSUNKbGVIQWlPakV6TURBNE1Ua3pPREFzRFFvZ0ltaDBkSEE2THk5bGVHRnRjR3hsTG1OdmJTOXBjMTl5YjI5MElqcDBjblZsZlEuZEJqZnRKZVo0Q1ZQLW1COTJLMjd1aGJVSlUxcDFyX3dXMWdGV0ZPRWpYaw==",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ZXlK(?:(?P<alg>aGJHY2lPaU)|(?P<apu>aGNIVWlPaU)|(?P<apv>aGNIWWlPaU)|(?P<aud>aGRXUWlPaU)|(?P<b64>aU5qUWlP)|(?P<crit>amNtbDBJanBi)|(?P<cty>amRIa2lPaU)|(?P<epk>bGNHc2lPbn)|(?P<enc>bGJtTWlPaU)|(?P<jku>cWEzVWlPaU)|(?P<jwk>cWQyc2lPb)|(?P<iss>cGMzTWlPaU)|(?P<iv>cGRpSTZJ)|(?P<kid>cmFXUWlP)|(?P<key_ops>clpYbGZiM0J6SWpwY)|(?P<kty>cmRIa2lPaUp)|(?P<nonce>dWIyNWpaU0k2)|(?P<p2c>d01tTWlP)|(?P<p2s>d01uTWlPaU)|(?P<ppt>d2NIUWlPaU)|(?P<sub>emRXSWlPaU)|(?P<svt>emRuUWlP)|(?P<tag>MFlXY2lPaU)|(?P<typ>MGVYQWlPaUp)|(?P<url>MWNtd2l)|(?P<use>MWMyVWlPaUp)|(?P<ver>MlpYSWlPaU)|(?P<version>MlpYSnphVzl1SWpv)|(?P<x>NElqb2)|(?P<x5c>NE5XTWlP)|(?P<x5t>NE5YUWlPaU)|(?P<x5ts256>NE5YUWpVekkxTmlJNkl)|(?P<x5u>NE5YVWlPaU)|(?P<zip>NmFYQWlPaU))[a-zA-Z0-9\\/\\\\_+\\-\\r\\n]{40,}={0,2}"},{key:"launchdarkly_access_token",name:"LaunchDarkly access token",category:"credential",example:"ezmej9s6yv4qwk2=yeb4kfi162p33b_2hzm7tr-0",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{40})"},{key:"linear_api_key",name:"Linear API key",category:"credential",example:"lin_api_0n5n0k26vb4ka9je9dqdcwl1dae5mbpfhb48xio6",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)lin_api_[a-z0-9]{40}"},{key:"linear_client_secret",name:"Linear client secret",category:"credential",example:"7b956760f09b81684ed833c524f081de",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"linkedin_client_id",name:"LinkedIn client ID",category:"credential",example:"18u930hak0em0r",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{14})"},{key:"linkedin_client_secret",name:"LinkedIn client secret",category:"credential",example:"uvkxd9rw41ylk1zj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{16})"},{key:"lob_api_key",name:"Lob API key",category:"credential",example:"test_02efbb923a38370aac769e3bedc4d3398be",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:(live|test)_[a-f0-9]{35})"},{key:"lob_pub_api_key",name:"Lob publishable API key",category:"credential",example:"test_pub_df170d9f5be9244959713dfee686c42",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:(test|live)_pub_[a-f0-9]{31})"},{key:"mailchimp_api_key",name:"MailChimp API key",category:"credential",example:"81277fbbe2dd9c5e18d5f28cebcc558c-us20",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32}-us[0-9][0-9])"},{key:"mailgun_pub_key",name:"Mailgun public validation key",category:"credential",example:"pubkey-5011bae1a4b57dfa83762c24b0e1299d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:pubkey-[a-f0-9]{32})"},{key:"mailgun_private_api_token",name:"Mailgun private API token",category:"credential",example:"key-176f7ef066471ac351adab734d2c9fb2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:key-[a-f0-9]{32})"},{key:"mailgun_signing_key",name:"Mailgun webhook signing key",category:"credential",example:"24564bd3d54a469601d5ac5daecb9ad2-00001111-22223333",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8})"},{key:"mapbox_api_token",name:"MapBox API token",category:"credential",example:"pk.5ko18udoy3cilkpgyedje9limykwj8n7wmhug4967o9wze284mmpuuhjzgig.edjzuv7jwhc6lnv5b3p9nc",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:pk\\.[a-z0-9]{60}\\.[a-z0-9]{22})"},{key:"mattermost_access_token",name:"Mattermost access token",category:"credential",example:"rtw2hncbfhpbyyri90d3q2mo1m",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{26})"},{key:"maxmind_license_key",name:"MaxMind license key",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:[A-Za-z0-9]{6}_[A-Za-z0-9]{29}_mmk)"},{key:"cisco_meraki_api_key",name:"Cisco Meraki API key",category:"credential",example:"acea14a1470f7cf443a031dde64065ce81c77b2b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:[0-9a-f]{40})"},{key:"messagebird_api_token",name:"MessageBird API token",category:"credential",example:"448q6im7yxutswabdko1n69ry",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{25})"},{key:"messagebird_client_id",name:"MessageBird client ID",category:"credential",example:"12345678-ABCD-ABCD-ABCD-1234567890AB",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"netlify_access_token",name:"Netlify access token",category:"credential",example:"3j1sa0o20v0k-cjbjn3vh_4uqnkvb3w_px5no2in",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{40,46})"},{key:"new_relic_user_api_key",name:"New Relic user API key",category:"credential",example:"NRAK-zozcnrh45ornsbl1duyfhell59u",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:NRAK-[a-z0-9]{27})"},{key:"new_relic_user_api_id",name:"New Relic user API ID",category:"credential",example:"k0jze7delork84k8ke1z1dm275yw2aqf5uu2cy7x1uiloll3xab5203hiz9tx9xx",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"new_relic_browser_api_token",name:"New Relic browser API token",category:"credential",example:"NRJS-c7fa1261a97506e4a45",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:NRJS-[a-f0-9]{19})"},{key:"new_relic_insert_key",name:"New Relic insight insert key",category:"credential",example:"NRII-4168ab7eb2e051f37144ad884d32ab34",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:NRII-[a-z0-9-]{32})"},{key:"notion_api_token",name:"Notion API token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:ntn_[0-9]{11}[A-Za-z0-9]{32}[A-Za-z0-9]{3})"},{key:"npm_access_token",name:"npm access token",category:"credential",example:"npm_vz9e7fvsn7o2n2tddg6b01gs7g9wldlys4vm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:npm_[a-z0-9]{36})"},{key:"nytimes_access_token",name:"NYTimes access token",category:"credential",example:"ako7xzi0mx7w15ogdkew7ilq7h13x8rl",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{32})"},{key:"octopus_deploy_api_key",name:"Octopus Deploy API key",category:"credential",example:"API-NFWN6F7X32BYDBU94IGY3V5ZQY",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:API-[A-Z0-9]{26})"},{key:"okta_access_token",name:"Okta access token",category:"credential",example:"003cKkRNNMy4ul7V8UDHEjEBGbnsQ6tejSHzfeBtcp",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:00[a-zA-Z0-9_=\\-]{40})"},{key:"openai_api_key",name:"OpenAI API key",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sk-(?:proj|svcacct|admin)-(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})T3BlbkFJ(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})(?-u:\\b)|sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20})"},{key:"openshift_user_token",name:"OpenShift user token",category:"credential",example:"sha256~OFL-TnR3jyLteu_rAuff3PUYNELVvByMRFYCcAkaJSR",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sha256~[a-zA-Z0-9_-]{43})(?:[^a-zA-Z0-9_-]|\\z)"},{key:"perplexity_api_key",name:"Perplexity API key",category:"credential",example:"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'",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pplx-[a-zA-Z0-9]{48})(?:[`'\" \\r\\n\\t\\f\\v;]|\\\\[nr]|$|(?-u:\\b))"},{key:"pgpassword_shell_assignment",name:"PGPASSWORD shell assignment",category:"credential",example:"PGPASSWORD='supersecret'",isUsingLuhnAlgorithm:!1,regexp:`(?-u:\\b)PGPASSWORD=(?:"[^"\\r\\n]+"|'[^'\\r\\n]+'|[^\\s'"]+)`},{key:"plaid_api_token",name:"Plaid API token",category:"credential",example:"access-development-4b0f8c31-83fe-e4c5-3d02-91e487b69d2d",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:access-(?:sandbox|development|production)-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"plaid_client_id",name:"Plaid client ID",category:"credential",example:"TTPjxpFNiwOct5XLdxjXD0Ta",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{24})"},{key:"plaid_secret_key",name:"Plaid secret key",category:"credential",example:"ikhqm7a9k76l8f544dl0v8kxvm2w55",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{30})"},{key:"planetscale_password",name:"PlanetScale password",category:"credential",example:"pscale_pw_9gvu8z79m4b814z0vv8266w70h3i7jlq",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pscale_pw_[a-zA-Z0-9_=\\.-]{32,64})"},{key:"planetscale_api_token",name:"PlanetScale API token",category:"credential",example:"pscale_tkn_nwy9jkjgnry96ftecsx_=jrxc6pkmmew",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pscale_tkn_[a-zA-Z0-9_=\\.-]{32,64})"},{key:"planetscale_oauth_token",name:"PlanetScale OAuth token",category:"credential",example:"pscale_oauth_zx8v3gzfnfxbymj__l629i68jnz5gnff",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pscale_oauth_[a-zA-Z0-9_=\\.-]{32,64})"},{key:"postman_api_token",name:"Postman API token",category:"credential",example:"PMAK-525b84aa46e2c588620d8123-06f9ca36c4aad4305baafbe00716b7bc8f",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:PMAK-[a-f0-9]{24}\\-[a-f0-9]{34})"},{key:"prefect_api_token",name:"Prefect API token",category:"credential",example:"pnu_kttbffyfgffu2sfbxzxw8mbpgvvtxjljwe1p",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pnu_[a-zA-Z0-9]{36})"},{key:"privateai_api_token",name:"PrivateAI API token",category:"credential",example:"iwuxqzqilzbfnccncvjz6px23dnej11h",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"private_key",name:"Private key",category:"credential",example:`-----BEGIN PRIVATE KEY-----
|
|
134
|
+
fish: tsuga completion fish > ~/.config/fish/completions/tsuga.fish`).action(r=>{let{rows:n,valueFlags:o}=D$(e);if(r==="bash")q(G$(bS(n),o));else if(r==="zsh")q($$(bS(n),o));else if(r==="fish")q(B$(j$(n),o));else throw new Error(`Unsupported shell "${r}". Supported: bash, zsh, fish.`)})}function AS(e){let r=e.command("config").description("Show or manage configuration");r.action(()=>{let n=e.opts(),o=Ko({operationApiKey:n.operationApiKey,clusterId:n.cluster});q(Qb(o,Ua()).trimEnd())}),r.command("set").description("Set a configuration value").command("default <FLAG_NAME> <VALUE>").description("Set a custom default value for a command flag").allowUnknownOption(!0).action((n,o)=>{Yb(n,o),q(`Default set: ${n} = ${o}`)}),r.command("reset").description("Reset configuration values").command("defaults").description("Clear all custom defaults").action(()=>{Vb(),q("Custom defaults cleared")})}var xS=`/${"v1"}/docs`,RS=t.Object({path:t.String({description:"Path identifying the page. Documentation pages use a slug path (e.g. `getting-started/send-your-first-logs`). API-reference pages use `api/<operationId>` (e.g. `api/aggregateScalar`)."}),title:t.String({description:'Title of the page (e.g. "Send your first logs" or "POST /v1/aggregation/multi-query/scalar")'}),content:t.String({description:"Raw markdown content of the page"})},{$id:"DocPage",description:"A documentation or API-reference page with its raw markdown content"}),q$={path:"getting-started/send-your-first-logs",title:"Send your first logs",content:`# Send your first logs
|
|
135
|
+
...`};Object.assign(RS,{examples:[q$]});var CS=t.Object({kind:t.Enum(["doc","api"],{description:"`doc` for documentation pages (guides, references, release notes); `api` for API-reference endpoints indexed from the OpenAPI spec. Use this to decide how to present or follow up on the result."}),path:t.String({description:"Path identifying the result. Documentation pages use a slug path (e.g. `data-collection/guides/how-to-add-resource-attributes`). API-reference results use `api/<operationId>` (e.g. `api/aggregateScalar`)."}),title:t.String({description:'Title of the result (e.g. "How to Add Resource Attributes" or "POST /v1/aggregation/multi-query/scalar")'}),subsection:t.Optional(t.String({description:'For documentation pages: the heading path inside the page that matched (e.g. "Language setup"). For API results: the matched field or parameter breadcrumb (e.g. "Body \u203A queries"). Absent when the match is the page or endpoint intro.'})),tab:t.Optional(t.String({description:'Tab label inside the page that the result matched. Set when the matching content is inside a <Tabs><Tab label="\u2026"> block. Always absent for API results.'})),anchor:t.Optional(t.String({description:"For documentation pages: the slugified heading ID used as the URL fragment (e.g. `language-setup`). For API results: the Scalar deep-link fragment (`tag/<tag>/<METHOD><path>`). The `link` field already has this baked in."})),score:t.Number({description:"Relevance score between 0 and 1 (higher is more relevant)"}),excerpt:t.String({description:"Short snippet of matching content"}),link:t.String({description:"URL to the result in the Tsuga app. Documentation pages include the section anchor and tab query parameter when applicable. API results deep-link into the API reference at `/documentation/api#tag/\u2026`."})},{$id:"DocSearchResult",description:"A documentation page or API-reference endpoint search result"}),F$={kind:"doc",path:"data-collection/guides/how-to-add-resource-attributes",title:"How to Add Resource Attributes",subsection:"Set resource attributes by language",tab:"Python",anchor:"set-resource-attributes-by-language",score:.9,excerpt:"...Python SDK setup should use the default resource detectors...",link:"https://www.app.tsuga.com/documentation/data-collection/guides/how-to-add-resource-attributes?tab=Python#set-resource-attributes-by-language"};Object.assign(CS,{examples:[F$]});var PS=m({description:"Retrieve the raw markdown content of a documentation or API-reference page by its path. Documentation pages use slug paths (e.g. `getting-started/send-your-first-logs`); API-reference pages use `api/<operationId>` (e.g. `api/aggregateScalar`).",operationId:"getDocPage",tags:["public","docs"],url:xS,method:"GET",query:t.Object({path:p({allowEmpty:!1,description:"Documentation path to fetch. Use page slug paths for docs or `api/<operationId>` for API-reference pages."})},{description:"Documentation page lookup query."}),response:RS}),US=m({description:"Searches public documentation pages and API-reference endpoints. Use this to build help search or route users to Tsuga docs and API reference results. Results are ranked by relevance; an empty array means no page or endpoint matched the query.",operationId:"searchDocs",tags:["public","docs"],url:`${xS}/search`,method:"GET",query:t.Object({query:p({allowEmpty:!1,description:"Search text to match against documentation and API-reference content."})},{description:"Documentation search query."}),response:t.Array(CS)});function wS(e,r){let n=e.command("docs").description("Search and fetch Tsuga documentation and API-reference pages");n.command("get <DOC_PATH>").description("Get a documentation or API-reference page by path (e.g. 'getting-started/send-your-first-logs' or 'api/aggregateScalar')").action(async o=>{let i=await r()(PS,{query:{path:o}});Q(i)}),n.command("search <SEARCH_TEXT>").description("Search Tsuga documentation and the full API reference, ranked by relevance").action(async o=>{let i=await r()(US,{query:{query:o}});Q(i)})}var H$=`/${"v1"}/feedback`,NS=t.Object({id:t.String({description:"API request ID recorded with the feedback."})},{$id:"Feedback",description:"A recorded piece of feedback"}),K$={id:"request-123-abc"};Object.assign(NS,{examples:[K$]});var LS=t.Object({content:p({allowEmpty:!1,type:"long",description:"Free-text feedback content, e.g. what went wrong, what was confusing, or a suggestion. Required and must be non-empty."})}),z$={content:"The traces command times out for large services."};Object.assign(LS,{examples:[z$]});var vS=m({description:"Submit free-text feedback about Tsuga tools or APIs, e.g. a tool that failed, returned unusable output, or was confusing to use. Feedback is recorded for the Tsuga team to review and improve tooling.",operationId:"createFeedback",tags:["public","feedback"],url:H$,method:"POST",body:LS,response:NS});function kS(e,r){e.command("feedback <MESSAGE...>").description("Send feedback about Tsuga tools or APIs (e.g. a tool that failed or was confusing)").action(async n=>{let o=await r()(vS,{body:{content:n.join(" ")}});Q(o)})}var Y$={"github-connection":{read:["admin"],write:["admin"]},investigation:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"ingestion-api-key":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"rum-public-token":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"widget-share":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"audit-log":{read:["public_viewer","public_editor","admin"],write:[]},"custom-usage-tag":{read:["public_viewer","public_editor","admin"],write:["admin"]},"cluster-integration-config":{read:["admin"],write:["admin"]},"explorer-saved-view":{read:["public_viewer","public_editor","admin"],write:["public_viewer","public_editor","admin"]},"operation-api-key":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"cloud-account":{read:["public_viewer","public_editor","admin"],write:["admin"]},dashboard:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"dashboard-folder":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"dashboard-report":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},inventory:{read:["public_viewer","public_editor","admin"],write:[]},log:{read:["public_viewer","public_editor","admin"],write:[]},"log-route":{read:["public_viewer","public_editor","admin"],write:["admin","public_editor"]},"metric-route":{read:["public_viewer","public_editor","admin"],write:["admin","public_editor"]},metric:{read:["public_viewer","public_editor","admin"],write:[]},trace:{read:["public_viewer","public_editor","admin"],write:[]},rum:{read:["public_viewer","public_editor","admin"],write:[]},monitor:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"monitor-alert":{read:["public_viewer","public_editor","admin"],write:[]},"monitor-debugging":{read:["admin"],write:[]},"notification-integration":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"notification-rule":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"adaptive-notification-rule":{read:["public_viewer","public_editor","admin"],write:["admin"]},"notification-silence":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"saml-config":{read:["admin"],write:["admin"]},org:{read:["public_viewer","public_editor","admin"],write:["admin"]},"allowed-domains":{read:["public_viewer","public_editor","admin"],write:["admin"]},"quality-report":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"sensitive-data-scanner-rule":{read:["public_viewer","public_editor","admin"],write:["admin"]},slo:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"retention-policy":{read:["public_viewer","public_editor","admin"],write:["admin"]},"databricks-connection":{read:["public_viewer","public_editor","admin"],write:["admin"]},service:{read:["public_viewer","public_editor","admin"],write:[]},"service-target":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},host:{read:["public_viewer","public_editor","admin"],write:[]},database:{read:["public_viewer","public_editor","admin"],write:[]},"tag-policy":{read:["public_viewer","public_editor","admin"],write:["admin"]},team:{read:["public_viewer","public_editor","admin"],write:["admin"]},"team-members":{read:["public_viewer","public_editor","admin"],write:["admin"]},"team-remap-config":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-data":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-invitation":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-permissions":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-self":{read:["public_viewer","public_editor","admin"],write:["public_viewer","public_editor","admin"]},"oauth-grant":{read:[],write:[]}},V$={"github-connection":{read:["admin"],write:[]},investigation:{read:["viewer","editor","admin"],write:["editor","admin"]},"ingestion-api-key":{read:["viewer","editor","admin"],write:["editor","admin"]},"rum-public-token":{read:["viewer","editor","admin"],write:["editor","admin"]},"widget-share":{read:["viewer","editor","admin"],write:["viewer","editor","admin"]},"audit-log":{read:["viewer","editor","admin"],write:[]},"custom-usage-tag":{read:[],write:[]},"cluster-integration-config":{read:[],write:[]},"explorer-saved-view":{read:["viewer","editor","admin"],write:["viewer","editor","admin"]},"operation-api-key":{read:["viewer","editor","admin"],write:["admin"]},"cloud-account":{read:["viewer","editor","admin"],write:[]},dashboard:{read:["viewer","editor","admin"],write:["editor","admin"]},"dashboard-folder":{read:["viewer","editor","admin"],write:["editor","admin"]},"dashboard-report":{read:["viewer","editor","admin"],write:["editor","admin"]},inventory:{read:["viewer","editor","admin"],write:[]},log:{read:["viewer","editor","admin"],write:[]},"log-route":{read:["viewer","editor","admin"],write:["editor","admin"]},"metric-route":{read:["viewer","editor","admin"],write:["editor","admin"]},metric:{read:["viewer","editor","admin"],write:[]},trace:{read:["viewer","editor","admin"],write:[]},rum:{read:["viewer","editor","admin"],write:[]},monitor:{read:["viewer","editor","admin"],write:["editor","admin"]},"monitor-alert":{read:["viewer","editor","admin"],write:[]},"monitor-debugging":{read:["admin"],write:[]},"notification-integration":{read:["viewer","editor","admin"],write:["editor","admin"]},"notification-rule":{read:["viewer","editor","admin"],write:["editor","admin"]},"adaptive-notification-rule":{read:["viewer","editor","admin"],write:[]},"notification-silence":{read:["viewer","editor","admin"],write:["editor","admin"]},"saml-config":{read:[],write:[]},org:{read:["viewer","editor","admin"],write:[]},"allowed-domains":{read:["viewer","editor","admin"],write:[]},"quality-report":{read:["viewer","editor","admin"],write:["editor","admin"]},"sensitive-data-scanner-rule":{read:["viewer","editor","admin"],write:[]},slo:{read:["viewer","editor","admin"],write:["editor","admin"]},"retention-policy":{read:[],write:[]},"databricks-connection":{read:[],write:[]},service:{read:["viewer","editor","admin"],write:[]},"service-target":{read:["viewer","editor","admin"],write:["editor","admin"]},host:{read:["viewer","editor","admin"],write:[]},database:{read:["viewer","editor","admin"],write:[]},"tag-policy":{read:[],write:[]},team:{read:["viewer","editor","admin"],write:["admin"]},"team-members":{read:["viewer","editor","admin"],write:["admin"]},"team-remap-config":{read:[],write:[]},"user-data":{read:["viewer","editor","admin"],write:["admin"]},"user-invitation":{read:["viewer","editor","admin"],write:["admin"]},"user-permissions":{read:["viewer","editor","admin"],write:[]},"user-self":{read:["viewer","editor","admin"],write:["viewer","editor","admin"]},"oauth-grant":{read:[],write:[]}},Q$={user:Y$,team:V$};function Sl(e){return MS(e,"team")}function Ol(e){return MS(e,"user")}function MS(e,r){let n=[],o=Q$[r];for(let[i,a]of Object.entries(o))for(let[c,l]of Object.entries(a))l.includes(e)&&n.push({actionType:c,resourceType:i});return n}var HSe={admin:{name:"Global admin",description:"Full control across the organization. Can view and modify everything, including private teams.",permissions:Ol("admin"),roleKey:"admin"},public_editor:{name:"Public editor",description:"Can view and edit assets in public teams, but not access private teams or critical settings.",permissions:Ol("public_editor"),roleKey:"public_editor"},public_viewer:{name:"Public viewer",description:"Read-only access to public team data. Cannot make changes.",permissions:Ol("public_viewer"),roleKey:"public_viewer"},teams_only:{name:"Teams only",description:"Only access data and assets in their own teams.",permissions:[],roleKey:"teams_only"}},KSe={admin:{name:"Team admin",description:"Full team control, manage assets, members, and settings.",permissions:Sl("admin"),roleKey:"admin"},editor:{name:"Team editor",description:"Can view and update most assets (like dashboards, monitors).",permissions:Sl("editor"),roleKey:"editor"},viewer:{name:"Team viewer",description:"Can view all team data but cannot make changes.",permissions:Sl("viewer"),roleKey:"viewer"}};var zSe=new Set(ml);var W$={documentation:void 0,investigations:"investigation",logs:"log",metrics:"metric","team-membership":"team-members",traces:"trace",user:"user-data","allowed-domains":"allowed-domains","cloud-account":"cloud-account","custom-usage-tag":"custom-usage-tag",dashboard:"dashboard","dashboard-folder":"dashboard-folder","ingestion-api-key":"ingestion-api-key",inventory:"inventory","log-route":"log-route","metric-route":"metric-route",monitor:"monitor","notification-rule":"notification-rule","notification-silence":"notification-silence","quality-report":"quality-report","retention-policy":"retention-policy","rum-public-token":"rum-public-token",service:"service",slo:"slo","tag-policy":"tag-policy",team:"team","user-invitation":"user-invitation"},Z$=Object.entries(W$),YSe=new Map(Z$.flatMap(([e,r])=>r?[[r,e]]:[]));var DS="__tsuga_cluster_id__",X$=t.Object({}),J$=t.Object({status:t.Literal("error"),message:t.String({description:"Why this cluster failed to answer the query."})});function Yo(e=X$){let r=b("status",[t.Object({...e.properties,status:t.Literal("ok")}),J$]);return Object.assign(Ec($t,r),{description:'Outcome per cluster, keyed by cluster ID. A cluster that failed reports `status: "error"`.'})}var e1=5,Na=t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:e1,uniqueItems:!0,description:"IDs of the clusters to query, without duplicates. Mutually exclusive with `clusterId`. Omit both to use the default cluster."});var GS=t.Object({type:t.Literal("number"),number:t.String()}),t1=t.Object({type:t.Literal("string"),string:t.String()}),r1=t.Object({type:t.Literal("timestamp"),timestamp:t.String()}),La=b("type",[GS,t1,r1]),n1=t.Object({by:t.Record(t.String(),La),computed:t.Record(t.String(),GS)}),o1=t.Object({type:t.Literal("buckets"),buckets:t.Array(n1),clusterResponses:t.Optional(Yo())}),i1=t.Object({type:t.Literal("distribution"),bounds:t.Array(t.Number()),buckets:t.Array(t.Object({timestamp:t.Number(),counts:t.Array(t.Number())})),percentiles:t.Optional(t.Array(t.Number()))}),ep=b("type",[o1,i1]);var a1=["all","owning-team-and-public","owning-team-only"],ln=t.Enum(a1,{description:"`all` allows the resource to query all permitted telemetry, `owning-team-and-public` limits it to the owning team plus public data, and `owning-team-only` limits it to the owning team."});var jS=1456444800,BS=4927737600,s1=jS*1e3,c1=BS*1e3,tp=1704067200,Al=tp*1e3,qS={title:"TimeRange",description:"Inclusive time range for telemetry queries. Use Unix timestamps in seconds unless the field description says milliseconds.",examples:[{from:tp,to:tp}]},p1={title:"TimeRange",description:"Inclusive time range for telemetry queries using Unix timestamps in milliseconds.",examples:[{from:Al,to:Al}]},rp=e=>t.Integer({description:e,examples:[tp],minimum:jS,maximum:BS,format:"int64"}),$S=e=>t.Integer({description:e,examples:[Al],minimum:s1,maximum:c1,format:"int64"}),Ve=t.Object({from:t.Optional(rp("Start of the query window as a Unix timestamp in seconds")),to:t.Optional(rp("End of the query window as a Unix timestamp in seconds"))},qS),mt=t.Object({from:rp("Start of the query window as a Unix timestamp in seconds"),to:rp("End of the query window as a Unix timestamp in seconds")},qS),Vo=t.Object({from:$S("Start of the query window as a Unix timestamp in milliseconds"),to:$S("End of the query window as a Unix timestamp in milliseconds")},p1);var m1="/v0/aggregation",d1=t.Union([t.Literal("a"),t.Literal("d"),t.Literal("q"),t.Literal("w"),t.Literal("t")]),xl=t.Object({parallelism:t.Number(),engine:d1,recordBatchCache:t.Optional(t.Boolean()),includeNullGroups:t.Optional(t.Boolean()),restartAwareGaugeSum:t.Optional(t.Boolean())}),Rl=["logs","metrics","traces"];var KS={logs:"Logs",metrics:"Metrics",traces:"Spans"},f1=[...Rl,"connections","log-patterns","spans","rum"];var yOe={...KS,connections:"Connections","log-patterns":"Log Patterns",spans:"Spans",rum:"RUM events"},pr=[...Rl,"rum"];var hOe={...KS,rum:"RUM events"};var TOe=t.Enum(f1,{description:"Data source being queried"}),zS=t.Enum(Rl,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, or `traces`."}),Vt=t.Enum(pr,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, `traces`, or `rum`."}),qn=t.String({description:"Attribute containing the values to aggregate"}),Fn=p({description:"Attribute containing the values to aggregate"}),g1=b("type",[t.Object({type:t.Literal("count",{description:"Counts the total number of records"}),field:t.Optional(qn)},{$id:"AggregateCount",title:"Count"}),t.Object({type:t.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:qn},{$id:"AggregateUniqueCount",title:"UniqueCount"}),t.Object({type:t.Literal("average",{description:"Calculates the average value of the selected field"}),field:qn},{$id:"AggregateAverage",title:"Average"}),t.Object({type:t.Literal("max",{description:"Finds the largest value of the field"}),field:qn},{$id:"AggregateMax",title:"Max"}),t.Object({type:t.Literal("min",{description:"Finds the smallest value of the field"}),field:qn},{$id:"AggregateMin",title:"Min"}),t.Object({type:t.Literal("sum",{description:"Sums the values of the selected field"}),field:qn},{$id:"AggregateSum",title:"Sum"}),t.Object({type:t.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:qn,percentile:t.Number({description:"Percentile to compute for the selected field."})},{$id:"AggregatePercentile",title:"Percentile"})],{title:"Aggregate",description:"Aggregation operation for this query. Required for every query; `field` is required by all aggregate types except `count`."}),y1=b("type",[t.Object({type:t.Literal("count",{description:"Counts the total number of records"}),field:t.Optional(Fn)},{$id:"InputAggregateCount",title:"Count"}),t.Object({type:t.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:Fn},{$id:"InputAggregateUniqueCount",title:"UniqueCount"}),t.Object({type:t.Literal("average",{description:"Calculates the average value of the selected field"}),field:Fn},{$id:"InputAggregateAverage",title:"Average"}),t.Object({type:t.Literal("max",{description:"Finds the largest value of the field"}),field:Fn},{$id:"InputAggregateMax",title:"Max"}),t.Object({type:t.Literal("min",{description:"Finds the smallest value of the field"}),field:Fn},{$id:"InputAggregateMin",title:"Min"}),t.Object({type:t.Literal("sum",{description:"Sums the values of the selected field"}),field:Fn},{$id:"InputAggregateSum",title:"Sum"}),t.Object({type:t.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:Fn,percentile:t.Number({description:"Percentile to compute for the selected field."})},{$id:"InputAggregatePercentile",title:"Percentile"})],{title:"InputAggregate",description:"Aggregation operation for this query. Required for every query; `field` is required by all aggregate types except `count`."}),YS=t.Object({type:t.Literal("per-second",{description:"Normalizes the metric to events per second"})},{$id:"FunctionPerSecond",title:"PerSecond"}),VS=t.Object({type:t.Literal("per-minute",{description:"Normalizes the metric to events per minute"})},{$id:"FunctionPerMinute",title:"PerMinute"}),QS=t.Object({type:t.Literal("per-hour",{description:"Normalizes the metric to events per hour"})},{$id:"FunctionPerHour",title:"PerHour"}),WS=t.Object({type:t.Literal("rate",{description:"Calculates the rate of change"})},{$id:"FunctionRate",title:"Rate"}),ZS=t.Object({type:t.Literal("increase",{description:"`Increase` is designed for cumulative metrics. It computes the increase of cumulative metrics by automatically handling counter resets. When used with an aggregation such as `sum` it combines all series without requiring an explicit group-by."})},{$id:"FunctionIncrease",title:"Increase"}),XS=t.Object({type:t.Literal("power",{description:"Raises values to a specified power"}),exponent:t.Integer({description:"The exponent to raise values to"})},{$id:"FunctionPower",title:"Power"}),JS=t.Object({type:t.Literal("sqrt",{description:"Applies a square root transformation to the values"})},{$id:"FunctionSqrt",title:"Sqrt"}),eO=t.Object({type:t.Literal("last",{description:"Takes the last value of the metric for the selected time frame"})},{$id:"FunctionLast",title:"Last"}),h1=t.Object({type:t.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:t.String({description:"Duration of the rolling window"})},{$id:"FunctionRolling",title:"Rolling"}),T1=t.Object({type:t.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:p({allowEmpty:!1,description:"Duration of the rolling window"})},{$id:"InputFunctionRolling",title:"Rolling"}),E1=t.Object({type:t.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:t.Integer({description:"The base of the logarithm"})},{$id:"FunctionLog",title:"Log"}),_1=t.Object({type:t.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:t.Integer({description:"The base of the logarithm",minimum:2})},{$id:"InputFunctionLog",title:"Log"}),I1=t.Object({type:t.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:t.Integer({description:"Number of seconds to offset"})},{$id:"FunctionTimeOffset",title:"TimeOffset"}),b1=t.Object({type:t.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:t.Integer({description:"Number of seconds to offset",minimum:1})},{$id:"InputFunctionTimeOffset",title:"TimeOffset"}),S1=b("type",[YS,VS,QS,WS,ZS,h1,E1,XS,JS,eO,I1],{title:"Function",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."}),O1=b("type",[YS,VS,QS,WS,ZS,T1,_1,XS,JS,eO,b1],{title:"InputFunction",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."});var FS=t.Object({min:t.Number({description:"Lower bound of the distribution range."}),max:t.Number({description:"Upper bound of the distribution range."})}),A1=["linear","log"],np=t.Enum(A1,{description:"Spacing of the bucket boundaries across the distribution range. `linear` splits the range into equal-width buckets; `log` widens each bucket logarithmically, giving finer resolution near the lower bound."}),HS=t.Integer({minimum:1}),x1=b("type",[t.Object({type:t.Literal("scalar")},{title:"Scalar",description:"Returns a single value"}),t.Object({type:t.Literal("timeseries"),aggregationWindow:p({description:'Time bucket size for aggregation (e.g. "10s", "60s", "1m")'})},{title:"Timeseries",description:"Returns a time series"}),t.Object({type:t.Literal("histogram"),by:t.Optional(p()),bucketCount:t.Optional(HS),bounds:t.Optional(FS),boundsScale:t.Optional(np),percentiles:t.Optional(t.Array(t.Number({minimum:0,maximum:100,multipleOf:1}),{minItems:1}))},{title:"Histogram",description:"Returns a single distribution over the entire time range"}),t.Object({type:t.Literal("heatmap"),aggregationWindow:p({description:'Time bucket size for the heatmap (e.g. "10s", "60s", "1m")'}),by:t.Optional(p()),bucketCount:t.Optional(HS),bounds:t.Optional(FS)},{title:"Heatmap",description:"Returns a distribution per time window"})]),op=15,R1=["zero","null"],C1=t.Enum(R1,{description:"`zero` fills missing points with zero. `null` keeps missing points null."}),tO=t.Object({mode:t.Object({type:C1},{description:"How missing aggregation points should be filled."})},{description:"Missing-point fill behavior for aggregation results. Optional; omit to keep missing points null."}),rO=t.Union([t.Literal("avg"),t.Literal("sum"),t.Literal("min"),t.Literal("max"),t.Literal("last")],{description:"Per-series rollup applied within each time bucket before the cross-series aggregate. When omitted, a default is derived from the metric type."}),nO={aggregate:g1,functions:t.Optional(t.Array(S1,{description:"Post-processing functions applied to aggregation results"})),fill:t.Optional(tO),timeAggregate:t.Optional(rO)},oO={aggregate:y1,functions:t.Optional(t.Array(O1,{maxItems:10,description:"Post-processing functions applied to aggregation results. Defaults to an empty array when omitted."})),fill:t.Optional(tO),timeAggregate:t.Optional(rO)},P1={description:"Aggregations that may be combined together in the same query. Each item is referenced from `formula` as q1, q2, and so on, in submission order."},iO={maxItems:op,description:'Aggregations that may be combined together in the same query. Each item is referenced from `formula` as q1, q2, and so on, in submission order. For dataSource "metrics", each aggregate\'s `field` is the metric name, not an attribute; to count distinct values of an attribute use unique-count with field "<metricName>.context.<attribute>" (e.g. "system.cpu.utilization.context.host.name").'},aO=t.Array(t.Object({...nO,filter:t.Optional(t.String({description:"Filter to apply to the aggregation"}))},{title:"AggregationQuery"}),P1),va=t.Array(t.Object({...oO,filter:t.Optional(p({type:"tsuga-query",description:"Tsuga query filter to apply to the aggregation. Defaults to an empty string when omitted."}))},{title:"AggregationQuery"}),iO),Sr=t.Array(t.Object({...nO,filter:t.String({description:"Filter to apply to the aggregation"})},{title:"MonitorAggregationQuery",description:"Single aggregation query evaluated by a monitor or SLO."}),{description:"Aggregation queries used by alerting and SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."}),Or=t.Array(t.Object({...oO,filter:p({type:"tsuga-query",description:"Tsuga query filter applied to this alerting or SLO aggregation query. Required by the API; use the query language for the selected data source."})},{title:"MonitorAggregationQuery",description:"Single aggregation query evaluated by a monitor or SLO."}),{...iO,description:"Aggregation queries used by alerting and SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."});var ip=t.String({description:"Formula referencing submitted query outputs, such as `q1 + q2`. References must be within `q1` through `qN` for the submitted queries."}),Hn=p({type:"tsuga-formula",description:"Formula referencing query outputs, such as `q1 + q2`, to compute derived results. Defaults to `q1`. Formulas may reference only submitted queries (`q1` through `qN`); undefined query references return 400."}),U1=t.Object({fields:t.Array(t.String(),{description:"Telemetry attribute names used to group aggregation results."}),limit:t.Number({description:'Maximum number of distinct values of `fields` returned for this grouping level, ranked by aggregate value. Groups beyond the limit are truncated, not merged into an "other" group.'}),sortOrder:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:t.Optional(t.String({description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),w1=t.Object({fields:t.Array(p(),{maxItems:1,description:"Telemetry attribute name to group aggregation results by. Currently limited to one field per grouping level."}),limit:t.Number({description:'Maximum number of distinct values of `fields` to return for this grouping level, ranked by aggregate value. Groups beyond the limit are truncated from the response, not merged into an "other" group.'}),sortOrder:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:t.Optional(p({allowEmpty:!1,description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),sO=7;var Qo=t.Array(U1,{description:"Nested grouping levels applied to the results, outermost first (e.g. group by service, then by level within each service). Each level splits results further, so the response contains one result per unique combination of group values."}),Ar=t.Array(w1,{maxItems:sO,description:"Nested grouping levels applied to aggregation results, outermost first (e.g. group by service, then by level within each service). Each level splits results further, so the response contains one result per unique combination of group values instead of one aggregated total. Defaults to an empty array (one ungrouped result) when omitted."});var EOe=m({tags:["aggregation"],url:`${m1}/multi-query`,method:"POST",body:t.Object({timeRange:Vo,queries:va,groupBy:t.Optional(Ar),returnType:x1,dataSource:Vt,formula:Hn,executionOptions:xl,triggeredBy:t.Optional(t.Literal("refresh")),shouldStreamResults:t.Optional(t.Boolean()),clusterId:t.Optional(p({allowEmpty:!1})),clusterIds:t.Optional(Na),viewAs:t.Optional(t.Object({owner:p({allowEmpty:!1,description:"Team ID to fetch data as"}),permissions:ln}))}),response:ep});var Cl=["red","orange","amber","yellow","green","emerald","teal","cyan","sky","blue","indigo","purple","pink"],Pl=["light","dark"];var N1={light:{red:{text:"foreground.red",background:"avatar.background.red"},orange:{text:"foreground.orange",background:"avatar.background.orange"},amber:{text:"foreground.amber",background:"avatar.background.amber"},yellow:{text:"foreground.yellow",background:"avatar.background.yellow"},green:{text:"foreground.green",background:"avatar.background.green"},emerald:{text:"foreground.emerald",background:"avatar.background.emerald"},teal:{text:"foreground.teal",background:"avatar.background.teal"},cyan:{text:"foreground.cyan",background:"avatar.background.cyan"},sky:{text:"foreground.sky",background:"avatar.background.sky"},blue:{text:"foreground.blue",background:"avatar.background.blue"},indigo:{text:"foreground.indigo",background:"avatar.background.indigo"},purple:{text:"foreground.purple",background:"avatar.background.purple"},pink:{text:"foreground.pink",background:"avatar.background.pink"}},dark:{red:{text:"avatar.foreground.foreground",background:"avatar.solid-background.red"},orange:{text:"avatar.foreground.foreground",background:"avatar.solid-background.orange"},amber:{text:"avatar.foreground.foreground",background:"avatar.solid-background.amber"},yellow:{text:"avatar.foreground.foreground",background:"avatar.solid-background.yellow"},green:{text:"avatar.foreground.foreground",background:"avatar.solid-background.green"},emerald:{text:"avatar.foreground.foreground",background:"avatar.solid-background.emerald"},teal:{text:"avatar.foreground.foreground",background:"avatar.solid-background.teal"},cyan:{text:"avatar.foreground.foreground",background:"avatar.solid-background.cyan"},sky:{text:"avatar.foreground.foreground",background:"avatar.solid-background.sky"},blue:{text:"avatar.foreground.foreground",background:"avatar.solid-background.blue"},indigo:{text:"avatar.foreground.foreground",background:"avatar.solid-background.indigo"},purple:{text:"avatar.foreground.foreground",background:"avatar.solid-background.purple"},pink:{text:"avatar.foreground.foreground",background:"avatar.solid-background.pink"}},gradient:{red:"var(--chakra-colors-gradient-red)",orange:"var(--chakra-colors-gradient-orange)",amber:"var(--chakra-colors-gradient-amber)",yellow:"var(--chakra-colors-gradient-yellow)",green:"var(--chakra-colors-gradient-green)",emerald:"var(--chakra-colors-gradient-emerald)",teal:"var(--chakra-colors-gradient-teal)",cyan:"var(--chakra-colors-gradient-cyan)",sky:"var(--chakra-colors-gradient-sky)",blue:"var(--chakra-colors-gradient-blue)",indigo:"var(--chakra-colors-gradient-indigo)",purple:"var(--chakra-colors-gradient-purple)",pink:"var(--chakra-colors-gradient-pink)"}},cO=["activity-heart","activity","airplay","airpods","alarm-clock","anchor","annotation-dots","annotation-heart","annotation-question","annotation","announcement-03","asterisk-01","atom-01","atom-02","award-03","award-04","award-05","backpack","bank-note-01","bank-note-02","bank-note-03","battery-charging-01","beaker-01","beaker-02","bell-03","bell-04","bell-ringing-03","bell-ringing-04","bluetooth-connect","bluetooth-on","book-closed","book-open-01","book-open-02","bookmark","briefcase-01","briefcase-02","brush-01","brush-02","brush-03","building-01","building-02","building-03","building-08","bus","calculator","calendar-check-01","calendar-date","calendar-heart-01","calendar","camera-01","camera-lens","car-01","certificate-01","certificate-02","check-heart","clipboard-attachment","clipboard-check","clipboard-download","clipboard","clock-snooze","clock-stopwatch","cloud-01","cloud-lightning","cloud-moon","cloud-raining-01","cloud-raining-03","cloud-raining-05","cloud-raining-06","cloud-snowing-01","cloud-sun-01","cloud-sun-02","cloud-sun-03","code-browser","code-circle-01","code-circle-02","code-circle-03","code-square-01","code-square-02","coins-hand","coins-stacked-01","colors","compass-01","compass-02","compass-03","compass","credit-card-01","credit-card-02","cube-02","cube-04","cube-outline","currency-bitcoin-circle","currency-dollar-circle","currency-ethereum-circle","currency-euro-circle","currency-pound-circle","currency-ruble-circle","currency-rupee-circle","currency-yen-circle","cursor-click-01","cursor-click-02","diamond-01","diamond-02","dice-1","dice-2","dice-3","dice-4","dice-5","dice-6","disc-01","disc-02","droplets-01","droplets-02","droplets-03","dropper","face-content","face-frown","face-happy","face-neutral","face-sad","face-smile","face-wink","feather","file-02","file-05","file-06","file-heart-01","file-heart-02","file-search-01","file-search-02","file-search-03","film-01","film-02","fingerprint-03","fingerprint-04","flag-01","flag-04","flash-off","flash","gaming-pad-01","gaming-pad-02","gift-01","glasses-01","glasses-02","globe-03","globe-04","globe-05","globe-06","globe-slated-01","globe-slated-02","graduation-hat-01","graduation-hat-02","hash-01","hash-02","headphones-01","headphones-02","heart-circle","heart-hand","heart-hexagon","heart-octagon","heart-rounded","heart-square","hearts","hexagon-01","hexagon-02","home-03","home-smile","hourglass-01","hourglass-02","hourglass-03","hurricane-01","hurricane-02","hurricane-03","image-01","image-02","image-03","image-04","image-05","keyboard-01","laptop-01","life-buoy-01","life-buoy-02","lightbulb-02","lightbulb-03","lightbulb-04","lock-keyhole-circle","lock-keyhole-square","luggage-01","luggage-02","luggage-03","magic-wand-01","magic-wand-02","map-01","map-02","mark","marker-pin-01","marker-pin-04","marker-pin-05","marker-pin-06","medical-circle","medical-cross","medical-square","message-chat-square","message-notification-square","message-smile-square","message-text-square-02","microphone-01","microphone-02","microscope","modem-01","modem-02","monitor-03","monitor-04","monitor-05","moon-01","moon-eclipse","moon-star","music-note-01","music-note-02","music-note-plus","octagon","palette","paperclip","pentagon","phone-01","phone-02","phone-call-01","phone","piggy-bank-01","pin-01","pin-02","plane","play-circle","play-square","podcast","power-02","presentation-chart-01","printer","receipt","recording-01","recording-02","recording-03","rocket-01","rocket-02","roller-brush","rss-01","rss-02","ruler","scales-01","scales-02","server-06","shield-01","shield-02","shield-03","shield-dollar","shield-zap","shopping-bag-01","shopping-cart-01","signal-01","signal-02","signal-03","simcard","sliders-01","sliders-02","snowflake-01","snowflake-02","speaker-01","speaker-02","speaker-03","speedometer-01","speedometer-02","speedometer-03","speedometer-04","square","stand","star-03","star-07","sticker-circle","sticker-square","sun-setting-01","sun-setting-02","sun-setting-03","sun","sunrise","sunset","tablet-01","tag-01","tag-02","tag-03","target-01","target-02","target-03","target-04","target-05","terminal-browser","terminal-circle","terminal-square","thermometer-02","thermometer-03","thermometer-cold","thermometer-warm","thumbs-down","thumbs-up","ticket-01","tool-01","tool-02","train","tram","translate-01","triangle","trophy-01","trophy-02","truck-01","truck-02","tv-02","umbrella-01","umbrella-02","umbrella-03","virus","voicemail","wallet-01","wallet-02","wallet-05","watch-circle","watch-square","waves","webcam-01","webcam-02","wind-01","wind-02","wind-03","youtube","zap-circle","zap-fast","zap"];var AOe=N1.light.red.background;var pO=[{key:"amex15_digits",name:"American Express card (1x15 digits)",category:"financial-data",example:"378282246310005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"amex4443_digits",name:"American Express card (4+4+4+3 digits)",category:"financial-data",example:"3782 8224 6310 005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"amex465_digits",name:"American Express card (4+6+5 digits)",category:"financial-data",example:"3782 822463 10005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"amex87_digits",name:"American Express card (8+7 digits)",category:"financial-data",example:"37828224 6310005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card14_digits",name:"Diners card (1x14 digits)",category:"financial-data",example:"30569309025904",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card4442_digits",name:"Diners card (4+4+4+2 digits)",category:"financial-data",example:"3056 9309 0259 04",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card464_digits",name:"Diners card (4+6+4 digits)",category:"financial-data",example:"3056 930902 5904",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card86_digits",name:"Diners card (8+6 digits)",category:"financial-data",example:"30569309 025904",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"discover_card16_digits",name:"Discover card (1x16 digits)",category:"financial-data",example:"6011111111111117",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"discover_card88_digits",name:"Discover card (2x8 digits)",category:"financial-data",example:"60111111 11111117",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"discover_card4444_digits",name:"Discover card (4x4 digits)",category:"financial-data",example:"6011 1111 1111 1117",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"jcb_card16_digits",name:"JCB card (1x16 digits)",category:"financial-data",example:"3530111333300000",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"jcb_card88_digits",name:"JCB card (2x8 digits)",category:"financial-data",example:"35301113 33300000",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"jcb_card4444_digits",name:"JCB card (4x4 digits)",category:"financial-data",example:"3530 1113 3330 0000",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"maestro_card16_digits",name:"Maestro card (1x16 digits)",category:"financial-data",example:"6759649826438453",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"maestro_card88_digits",name:"Maestro card (2x8 digits)",category:"financial-data",example:"67596498 26438453",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"maestro_card4444_digits",name:"Maestro card (4x4 digits)",category:"financial-data",example:"6759 6498 2643 8453",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"mastercard16_digits",name:"Mastercard (1x16 digits)",category:"financial-data",example:"5555555555554444",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"mastercard88_digits",name:"MasterCard (2x8 digits)",category:"financial-data",example:"55555555 55554444",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"mastercard4444_digits",name:"MasterCard (4x4 digits)",category:"financial-data",example:"5555 5555 5555 4444",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa16_digits",name:"Visa (1x16 digits)",category:"financial-data",example:"4111111111111111",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa19_digits",name:"Visa (1x19 digits)",category:"financial-data",example:"4111111111111111151",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa88_digits",name:"Visa (2x8 digits)",category:"financial-data",example:"41111111 11111111",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa883_digits",name:"Visa (8+8+3 digits)",category:"financial-data",example:"41111111 11111111 151",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa4444_digits",name:"Visa (4x4 digits)",category:"financial-data",example:"4111 1111 1111 1111",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa44443_digits",name:"Visa (4+4+4+4+3 digits)",category:"financial-data",example:"4111 1111 1111 1111 151",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"dropbox_long_lived_api_token",name:"Dropbox long lived API token",category:"credential",example:"767cb868836AAAAAAAAAAszri2cnmzu5tr0yf-nvclmwfyiswl67qyqw-uzn-scg",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:[a-z0-9]{11}(AAAAAAAAAA)[a-z0-9\\-_=]{43})"},{key:"dropbox_short_lived_api_token",name:"Dropbox short lived API token",category:"credential",example:"sl.nu0yvsrposcjeyjcpmbfrmqygllrxpahrgbt8flml9xroifbic",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:sl\\.[a-z0-9\\-=_]{50})"},{key:"french_nirpp",name:"French social security number (NIRPP)",category:"personal-information",example:"188073512757119",isUsingLuhnAlgorithm:!1,regexp:"([12])\\s*[0-9]{2}\\s*(0[1-9]|1[0-2])\\s*(2[AB]|[0-9]{2})\\s*([0-9]{3})\\s*([0-9]{3})(\\s*[0-9]{2})?"},{key:"ip_address",name:"IP address",category:"device-identifier",example:"81.55.13.53",isUsingLuhnAlgorithm:!1,regexp:""},{key:"social_security_number",name:"Social security number (XXX-XX-XXXX)",category:"personal-information",example:"437-02-2223",isUsingLuhnAlgorithm:!1,regexp:"(?x)(?-u:\\b)(?:00[1-9]|0[1-9][0-9]|[1-578][0-9]{2}|6[0-57-9][0-9]|66[0-57-9])-(?:0[1-9]|[1-9]0|[1-9][1-9])-(?:000[1-9]|00[1-9]0|0[1-9]00|[1-9]000|[1-9]{4})(?-u:\\b)"},{key:"social_security_number_space",name:"Social security number (XXX XX XXXX)",category:"personal-information",example:"437 02 2223",isUsingLuhnAlgorithm:!1,regexp:"(?x)(?-u:\\b)(?:00[1-9]|0[1-9][0-9]|[1-578][0-9]{2}|6[0-57-9][0-9]|66[0-57-9])\\s+(?:0[1-9]|[1-9]0|[1-9][1-9])\\s+(?:000[1-9]|00[1-9]0|0[1-9]00|[1-9]000|[1-9]{4})(?-u:\\b)"},{key:"social_security_number_digits",name:"Social security number (9 digits)",category:"personal-information",example:"437022223",isUsingLuhnAlgorithm:!1,regexp:"(?x)(?-u:\\b)(?:00[1-9]|0[1-9][0-9]|[1-578][0-9]{2}|6[0-57-9][0-9]|66[0-57-9])(?:0[1-9]|[1-9]0|[1-9][1-9])(?:000[1-9]|00[1-9]0|0[1-9]00|[1-9]000|[1-9]{4})(?-u:\\b)"},{key:"email",name:"Email",category:"credential",example:"admin@tsuga.com",isUsingLuhnAlgorithm:!1,regexp:"[a-zA-Z0-9-_.]*[a-zA-Z0-9_](@[a-zA-Z0-9_]+)(\\.[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)?[a-zA-Z])(?-u:\\b)"},{key:"one_password_secret_key",name:"1Password secret key",category:"credential",example:"A3-O28NKC-F58GULWCN72-4NIKS-KGY7V-U7FAT",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)A3-[A-Z0-9]{6}-(?:(?:[A-Z0-9]{11})|(?:[A-Z0-9]{6}-[A-Z0-9]{5}))-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}(?-u:\\b)"},{key:"one_password_service_account_token",name:"1Password service account token",category:"credential",example:"ops_eyJdAZ/FoIyz0jAXpEQOrRdIE8ydVaYfAXeZXGFqHWfBOjnE/Vgf5kHIbwrNAp2WeFNPeFiVJPlLv1hmaTVums0ldq1Kv8JEglMqP3f0ATBuX/WRbKqXYS3Z1wSzxg6S0krW4df7ZplvK04+JhJimejyTEH5dYaxqsYDBSLxjeEq7JWsmHEuXj6WP5qQi7FB+5s+CwhWPWY/jDhUMB3fdowXbfv5VnWri3iYrfBh+bFeRe9KURhXGHRDE9hgs",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ops_eyJ[a-zA-Z0-9+/]{50}"},{key:"adafruit_api_key",name:"Adafruit API key",category:"credential",example:"jb9pb4unb2bhe7xqepmgwtl2jg7ti101",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{32})"},{key:"adobe_client_id",name:"Adobe client ID",category:"credential",example:"c4166853dfd2897ebe706d49ef13fe63",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"adobe_client_secret",name:"Adobe client secret",category:"credential",example:"p8e-bb6e1614324ae48e507d33af176db3b7",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:p8e-[a-z0-9]{32})"},{key:"age_secret_key",name:"Age secret key",category:"credential",example:"AGE-SECRET-KEY-1QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}"},{key:"airtable_api_key",name:"Airtable API key",category:"credential",example:"19b73hbi0tc5cdy4w",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{17})"},{key:"algolia_api_key",name:"Algolia API key",category:"credential",example:"346155deb68d31c4018d73de73452947",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"alibaba_access_key_id",name:"Alibaba Cloud AccessKey ID",category:"credential",example:"LTAI7cc6804e4c2155cd52bd",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:LTAI[a-z0-9]{20})"},{key:"alibaba_secret_key",name:"Alibaba Cloud secret key",category:"credential",example:"suwixirhh10xhnko9bv0vfg2971u9p",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{30})"},{key:"anthropic_admin_api_key",name:"Anthropic admin API key",category:"credential",example:"sk-ant-admin01-abc12fake-456def789ghij-klmnopqrstuvwx-3456yza789bcde-12fakehijklmnopby56aaaogaopaaaabc123xyzAA",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sk-ant-admin01-[a-zA-Z0-9_-]{93}AA)"},{key:"anthropic_api_key",name:"Anthropic API key",category:"credential",example:"sk-ant-api03-abc123xyz-456def789ghij-klmnopqrstuvwx-3456yza789bcde-1234fghijklmnopby56aaaogaopaaaabc123xyzAA",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sk-ant-api03-[a-zA-Z0-9_-]{93}AA)"},{key:"artifactory_api_key",name:"Artifactory API key",category:"credential",example:"AKCpt771klpkqllt647fdf36fq43radbz2w2nyetvx4l90qyeef8kbgkmke63ul5vf6mqsy82",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AKCp[A-Za-z0-9]{69}(?-u:\\b)"},{key:"artifactory_reference_token",name:"Artifactory reference token",category:"credential",example:"cmVmdc6i6888t9viuobfd88e46pdonjjsvmme6np82qti7wzbj7l9m1ygtyl9wik",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)cmVmd[A-Za-z0-9]{59}(?-u:\\b)"},{key:"asana_client_id",name:"Asana client ID",category:"credential",example:"9760134337886314",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{16})"},{key:"asana_client_secret",name:"Asana client secret",category:"credential",example:"tcnc8mjrf5bad359nnz3j1z90gow67ji",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"atlassian_api_token",name:"Atlassian API token",category:"credential",example:"fdo4scsa4kh53jnenkfp5fbe",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:[a-z0-9]{20}[a-f0-9]{4})|(?-u:\\b)(?:ATATT3[A-Za-z0-9_-=]{50})"},{key:"authress_service_client_access_key",name:"Authress service client access key",category:"credential",example:"sc_scmz00n9xj.0ykp.acc_2k5vtnrec4.55vc9459s-gc5qlia7a67jvzm0bobn3g0ezimd3b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\\.[a-z0-9]{4,6}\\.(?-i:acc)[_-][a-z0-9-]{10,32}\\.[a-z0-9+/_=-]{30})"},{key:"aws_access_token",name:"AWS access token",category:"credential",example:"AKIALALEMEL33243OLIB",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})(?-u:\\b)"},{key:"azure_ad_client_secret",name:"Azure AD client secret",category:"credential",example:"bP88Q~rcBcYjzzOhg1Hnn76Wm3jGgakZiZ.8vMgR",isUsingLuhnAlgorithm:!1,regexp:"(?:^|[\\\\'\"` \\r\\n\\t\\f\\v>=:(?:,)])(?:[a-zA-Z0-9_~.]{3}[0-9]Q~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'\"` \\r\\n\\t\\f\\v<),])"},{key:"bitbucket_client_id",name:"Bitbucket client ID",category:"credential",example:"yyxmjnl3kahirvct7sat2082pzqdyf09",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"bitbucket_client_secret",name:"Bitbucket client secret",category:"credential",example:"fylw1pominwz91e5guqjiugw6srutpl64vzch5rnt8xnt31ka7so9va73fscz836",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{64})"},{key:"beamer_api_token",name:"Beamer API token",category:"credential",example:"b_zhy-phuoqk13asco6az4u_0yhtklgswm4umkv95nv4gu",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:b_[a-z0-9=_\\-]{44})"},{key:"codecov_access_token",name:"Codecov access token",category:"credential",example:"r93iopllonuphk41qglet20y8cb83thm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"clickhouse_cloud_api_secret_key",name:"ClickHouse Cloud API secret key",category:"credential",example:"4b1dbRdW3rOcB7xLthrM4BTBGK1qPLkHigpN1bXD6z",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:4b1d[A-Za-z0-9]{38})(?-u:\\b)"},{key:"clojars_api_token",name:"Clojars API token",category:"credential",example:"CLOJARS_d1vd7t0blxaarzx25dxoda4hm5ox86st6o5ww7tnzsfz07wvu223bf0fmgim",isUsingLuhnAlgorithm:!1,regexp:"CLOJARS_[a-z0-9]{60}"},{key:"cloudflare_api_key",name:"Cloudflare API key",category:"credential",example:"ckg0h_dzkxnl627gy3nskpq9wzm4d5hc_vxk272h",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{40})"},{key:"cloudflare_global_api_key",name:"Cloudflare global API key",category:"credential",example:"1d003bb65ec73ad2691fb76631b6496e3c9d9",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{37})"},{key:"cloudflare_origin_ca_key",name:"Cloudflare Origin CA key",category:"credential",example:"v1.0-aaa334dc886f30631ba0a610-0d98ef66290d7e50aac7c27b5986c99e6f3f1084c881d8ac0eae5de1d1aa0644076ff57022069b3237d19afe60ad045f207ef2b16387ee37b749441b2ae2e9ebe5b4606e846475d4a5",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:v1\\.0-[a-f0-9]{24}-[a-f0-9]{50})"},{key:"cohere_api_token",name:"Cohere API token",category:"credential",example:"lpn59BQ4FNUabVJh1vCpIqZpQbaViELQrTa14p9D",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:[a-zA-Z0-9]{40})"},{key:"confluent_access_token",name:"Confluent access token",category:"credential",example:"kkat92sclkukwvr2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{16})"},{key:"confluent_secret_key",name:"Confluent secret key",category:"credential",example:"64d4ppp37l9fjhadm8vv0awie6wjo4d6ourfcqvi2bcs2tm95x4f0e8gyb8z8usj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"contentful_delivery_api_token",name:"Contentful delivery API token",category:"credential",example:"eumospigka64wiwpavfmmblrq7x1hm6gz84wiiw2ff3",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{43})"},{key:"curl_auth_header",name:"Curl authorization header",category:"credential",example:"curl --header 'Authorization: 5eb4223e-5008-46e5-be67-c7b8f2732305'",isUsingLuhnAlgorithm:!1,regexp:`(?-u:\\b)curl(?-u:\\b)(?:.*?|.*?(?:[\\r\\n]{1,2}.*?){1,5})[ \\t\\n\\r](?:-H|--header)(?:=|[ \\t]{0,5})(?:"(?:Authorization:[ \\t]{0,5}(?:Basic[ \\t](?:[a-z0-9+/]{8,}={0,3})|(?:Bearer|(?:Api-)?Token)[ \\t](?:[a-zA-Z0-9_=~@.+/-]{8,})|(?:[a-zA-Z0-9_=~@.+/-]{8,}))|(?:(?:X-(?:[a-z]+-)?)?(?:Api-?)?(?:Key|Token)):[ \\t]{0,5}(?:[a-zA-Z0-9_=~@.+/-]{8,}))"|'(?:Authorization:[ \\t]{0,5}(?:Basic[ \\t](?:[a-z0-9+/]{8,}={0,3})|(?:Bearer|(?:Api-)?Token)[ \\t](?:[a-zA-Z0-9_=~@.+/-]{8,})|(?:[a-zA-Z0-9_=~@.+/-]{8,}))|(?:(?:X-(?:[a-z]+-)?)?(?:Api-?)?(?:Key|Token)):[ \\t]{0,5}(?:[a-zA-Z0-9_=~@.+/-]{8,}))')(?:(?-u:\\B)|[ \\r\\n\\t\\f\\v]|\\z)`},{key:"curl_auth_user",name:"Curl basic authentication",category:"credential",example:"curl -u elastic:P@ssw0rd$1",isUsingLuhnAlgorithm:!1,regexp:`(?-u:\\b)curl(?-u:\\b)(?:.*|.*(?:[\\r\\n]{1,2}.*){1,5})[ \\t\\n\\r](?:-u|--user)(?:=|[ \\t]{0,5})(?:"(:[^"]{3,}|[^:"]{3,}:|[^:"]{3,}:[^"]{3,})"|'(?:[^:']{3,}:[^']{3,})'|(?:(?:"[^"]{3,}"|'[^']{3,}'|[a-zA-Z0-9_$@.-]+):(?:"[^"]{3,}"|'[^']{3,}'|[a-zA-Z0-9_\${}@.-]+)))(?:[ \\r\\n\\t\\f\\v]|\\z)`},{key:"databricks_api_token",name:"Databricks API token",category:"credential",example:"dapia2553f815d29a193fd09c2bb55201895",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:dapi[a-f0-9]{32}(?:-[0-9])?)"},{key:"datadog_access_token",name:"Datadog access token",category:"credential",example:"ljgbhjnca2hy5yc2nv7cag1ag7ehx2hc6geparov",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{40})"},{key:"defined_networking_api_token",name:"Defined Networking API token",category:"credential",example:"dnkey-nowf_nwyqhvqt1gi66xnuuf2rb-bfxnr9_qydyxnxn1y8uijvhhp9owllbg-2czoe-7qs5_w5650xei",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:-[a-z0-9=_\\-]{26}-[a-z0-9=_\\-]{52})"},{key:"digitalocean_pat",name:"DigitalOcean personal access token",category:"credential",example:"dop_v1_ec8f4a856c1459bd442a275461e2f709506347de30b180851cde71f696e9fcc8",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:dop_v1_[a-f0-9]{64})"},{key:"digitalocean_access_token",name:"DigitalOcean OAuth access token",category:"credential",example:"doo_v1_42b8ea6c4b0c373f88aff9d3fa87e123ab23b0d3c22ac6d4361a4e9c1e89eaa6",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:doo_v1_[a-f0-9]{64})"},{key:"digitalocean_refresh_token",name:"DigitalOcean OAuth refresh token",category:"credential",example:"dor_v1_4d9b3e6fbe65ab472e464dfa6377d702e80164442acdfbeb3ef032d917cb9984",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:dor_v1_[a-f0-9]{64})"},{key:"discord_api_token",name:"Discord API token",category:"credential",example:"7eb855d9a40747182d0b0ea74df27aee31d05756a9933a815a3ccb5a46b2d61d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{64})"},{key:"discord_client_id",name:"Discord client ID",category:"credential",example:"763721114261247538",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{18})"},{key:"discord_client_secret",name:"Discord client secret",category:"credential",example:"13641266018325206246161633988007",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{32})"},{key:"doppler_api_token",name:"Doppler API token",category:"credential",example:"dp.pt.vgin8wwjy7sx66fyq99tavkm3y5g2jdxmsufh257dhj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)dp\\.pt\\.[a-z0-9]{43}"},{key:"dropbox_api_token",name:"Dropbox API token",category:"credential",example:"rdlztoij88rzrsk",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{15})"},{key:"droneci_access_token",name:"DroneCI access token",category:"credential",example:"v26gffr903rbti5v7m392ba0u7oarz36",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"duffel_api_token",name:"Duffel API token",category:"credential",example:"duffel_test_-yd6b3pc4jy593pt5kr2l3ynzkb5b_f619dshefiz=v",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)duffel_(?:test|live)_[a-z0-9_\\-=]{43}"},{key:"dynatrace_api_token",name:"Dynatrace API token",category:"credential",example:"dt0c01.ben820rdpb1so4kasfx3yn4a.zkje7lawif35udsin5t1mi1m1sne7wdzphlzrmdnu3j69gr4kgf5dwg4x5lb30zg",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)dt0c01\\.[a-z0-9]{24}\\.[a-z0-9]{64}"},{key:"easypost_api_token",name:"EasyPost API token",category:"credential",example:"EZAKBVScDZwZFv0nJXHBcxPGil7eztnPJOSmDFf2NGKQk6Dn7VqULciSRm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)EZAK[a-z0-9]{54}(?-u:\\b)"},{key:"easypost_test_api_token",name:"EasyPost test API token",category:"credential",example:"EZTKuxUXVU5HBS1K2iyh165t3VtivpdxMgIf5Y2P1oJxeFeaJGcwzVexds",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)EZTK[a-z0-9]{54}(?-u:\\b)"},{key:"etsy_access_token",name:"Etsy access token",category:"credential",example:"8ssp35lhprxpb3sjyergcz5z",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{24})"},{key:"facebook_secret",name:"Facebook secret",category:"credential",example:"c41c21ba4fb5ee05398db86ca83f06db",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"facebook_access_token",name:"Facebook access token",category:"credential",example:"911602140448729|AY-lRJZq9BoDLobvAiP25L7RcMg",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:[0-9]{15,16}(\\||%)[0-9a-z\\-_]{27,40})"},{key:"facebook_page_access_token",name:"Facebook page access token",category:"credential",example:"EAAM9GOnCB9kBO2frzOAWGN2zMnZClQshlWydZCrBNdodesbwimx1mfVJgqZBP5RSpMfUzWhtjTTXHG5I1UlvlwRZCgjm3ZBVGeTYiqAAoxyED6HaUdhpGVNoPUwAuAWWFsi9OvyYBQt22DGLqMIgD7VktuCTTZCWKasz81Q822FPhMTB9VFFyClNzQ0NLZClt9zxpsMMrUZCo1VU1rL3CKavir5QTfBjfCEzHNlWAUDUV2YZD",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:EAA[MC][a-z0-9]{50})"},{key:"fastly_api_token",name:"Fastly API token",category:"credential",example:"im7_ux24tyyxz_4y4mvzj22akpid830c",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{32})"},{key:"finicity_client_secret",name:"Finicity client secret",category:"credential",example:"roepymyr0ce7wxhjvgb2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{20})"},{key:"finicity_api_token",name:"Finicity API token",category:"credential",example:'= "cce089057c8b7fe7f2a8474b9a050816',isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"flickr_access_token",name:"Flickr access token",category:"credential",example:"damvt93tudulk6wrfp36sawndc9pa7bb",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"finnhub_access_token",name:"Finnhub access token",category:"credential",example:"x01lnfp13spcbsa0at32",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{20})"},{key:"flutterwave_public_key",name:"Flutterwave public key",category:"credential",example:"FLWPUBK_TEST-99484d505b4ee5c1181a2884f5fe3852-X",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)FLWPUBK_TEST-[a-h0-9]{32}-X"},{key:"flutterwave_secret_key",name:"Flutterwave secret key",category:"credential",example:"FLWSECK_TEST-66187ac83488c2245f0d7e95fa37e833-X",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)FLWSECK_TEST-[a-h0-9]{32}-X"},{key:"flutterwave_encryption_key",name:"Flutterwave encryption key",category:"credential",example:"FLWSECK_TEST-6262214a02e7",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)FLWSECK_TEST-[a-h0-9]{12}"},{key:"flyio_access_token",name:"Fly.io access token",category:"credential",example:"fo1_m-HT0NHLBSPwMJ2hIer4v3lxtWEC7grXNidQxJMrVVE",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:fo1_[a-zA-Z0-9_-]{43}|fm1[ar]_[a-zA-Z0-9+\\/]{50}))"},{key:"frameio_api_token",name:"Frame.io API token",category:"credential",example:"fio-u-4ov9vjtr2wwj8j1gob-8xrx2-1=z818psmitskgoq4=p-_k77d54034z55xk-lqh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)fio-u-[a-z0-9\\-_=]{64}"},{key:"freshbooks_access_token",name:"FreshBooks access token",category:"credential",example:"gqw118uwne1nddlt4yruvvs4jr9s0vrj5mxaswgb2amacod8lgnmrknsvbovsx1g",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"gocardless_api_token",name:"GoCardless API token",category:"credential",example:"live_-z4lwtrrk6p6=-v1ig_y_4ceplziwek0lw=oz-eu",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:live_[a-z0-9\\-_=]{40})"},{key:"gcp_api_key",name:"GCP API key",category:"credential",example:"AIzaYpvGqEzpgB7R353HD9CxN8LuhZ6d6UfuXLL",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:AIza[a-zA-Z0-9_-]{35})"},{key:"github_pat",name:"GitHub personal access token",category:"credential",example:"ghp_t7i9llxuukeb7apn4zlnyeyz5b0007rsfs54",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ghp_[0-9a-zA-Z]{36}"},{key:"github_fine_grained_pat",name:"GitHub fine-grained personal access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)github_pat_[a-zA-Z0-9_]{82}"},{key:"github_oauth",name:"GitHub OAuth token",category:"credential",example:"gho_anlrm6zqscqityoqozv503by66dobnem4yxh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)gho_[0-9a-zA-Z]{36}"},{key:"github_app_token",name:"GitHub app token",category:"credential",example:"ghs_0zleityj4n1ulz178o9in1w97q1ifw8u3y8h",isUsingLuhnAlgorithm:!1,regexp:"(?:ghu|ghs)_[0-9a-zA-Z]{36}"},{key:"github_refresh_token",name:"GitHub refresh token",category:"credential",example:"ghr_inu1aa7qbgi46cf8nprbgh4kn03d0zk35raj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ghr_[0-9a-zA-Z]{36}"},{key:"gitlab_cicd_job_token",name:"GitLab CI/CD job token",category:"credential",example:"glcbt-7h2nr_6jmho0uoqkb1ww431kfl",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glcbt-[0-9a-zA-Z]{1,5}_[0-9a-zA-Z_-]{20}"},{key:"gitlab_deploy_token",name:"GitLab deploy token",category:"credential",example:"gldt-7a3o70gqa8zkal0zdp4x",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)gldt-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_feature_flag_client_token",name:"GitLab feature flag client token",category:"credential",example:"glffct-dsct62ndnvcj7alw5nas",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glffct-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_feed_token",name:"GitLab feed token",category:"credential",example:"glft-13956nvy00289v6xu0di",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glft-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_incoming_mail_token",name:"GitLab incoming mail token",category:"credential",example:"glimt-fcdt1a5jvj01si61jgkse2r20",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glimt-[0-9a-zA-Z_\\-]{25}"},{key:"gitlab_kubernetes_agent_token",name:"GitLab Kubernetes agent token",category:"credential",example:"glagent-8wxkulkbbuk7u6r3nvrefswdfw5o0v7vy81y4oky8rnfogm826",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glagent-[0-9a-zA-Z_\\-]{50}"},{key:"gitlab_oauth_app_secret",name:"GitLab OAuth app secret",category:"credential",example:"gloas-vawws2nw5kf6rizn49g41jc3jiy4xqioaihrwm1msltbdt4cbmo4x52tygcic7af",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)gloas-[0-9a-zA-Z_\\-]{64}"},{key:"gitlab_pat",name:"GitLab personal access token",category:"credential",example:"glpat-2gl3ku1497ms4gzyv16i",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glpat-[a-zA-Z0-9_-]{20}"},{key:"gitlab_pat_routable",name:"GitLab personal access token (routable)",category:"credential",example:"glpat-2hf7vebpux9j56tdcqqsvap7vxc.chvjof35u",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glpat-[0-9a-zA-Z_-]{27}\\.[0-9a-z]{2}[0-9a-z]{7}(?-u:\\b)"},{key:"gitlab_ptt",name:"GitLab personal access token (temporary)",category:"credential",example:"glptt-b54e8b7b90cf006b79af110baa9b8d9183fd7048",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glptt-[0-9a-f]{40}"},{key:"gitlab_rrt",name:"GitLab registration token",category:"credential",example:"GR1348941vnauzmn2hj0zncvt0nfe",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)GR1348941[a-zA-Z0-9_-]{20}"},{key:"gitlab_runner_authentication_token",name:"GitLab runner authentication token",category:"credential",example:"glrt-xbd1w7c9clbxm52zdxkm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glrt-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_runner_authentication_token_routable",name:"GitLab runner authentication token (routable)",category:"credential",example:"glrt-t5_8d8ugbkfzddae0dw06tvm0x7qxc.mwcd1a7cn",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glrt-t[0-9]_[0-9a-zA-Z_\\-]{27}\\.[0-9a-z]{2}[0-9a-z]{7}(?-u:\\b)"},{key:"gitlab_scim_token",name:"GitLab SCIM token",category:"credential",example:"glsoat-9jb5zk1nvy800c1uqhh0",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glsoat-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_session_cookie",name:"GitLab session cookie",category:"credential",example:"_gitlab_session=yjhub6vtrp60djn6rszuemeacsoqox97",isUsingLuhnAlgorithm:!1,regexp:"_gitlab_session=[0-9a-z]{32}"},{key:"gitter_access_token",name:"Gitter access token",category:"credential",example:"uazubes6trcd_1gym09opuf_8gj1rmvj6jwber4a",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{40})"},{key:"grafana_api_key",name:"Grafana API key",category:"credential",example:"eyJrIjoiyl5shjvqja0xkfbu38m24vn5httsipr1h9fgjhodxzlkpravuiy8h7hom5kt8gtwuguh2v",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:eyJrIjoi[A-Za-z0-9]{70}={0,3})"},{key:"grafana_cloud_api_token",name:"Grafana cloud API token",category:"credential",example:"glc_cb7p4j2g1qu0sy84me72ufmn1z8mqk8y",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:glc_[A-Za-z0-9+/]{32}={0,3})"},{key:"grafana_service_account_token",name:"Grafana service account token",category:"credential",example:"glsa_rm3sadbwl8o2c13v4ipgkz04h66kiy6t_edaea401",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})"},{key:"harness_api_key",name:"Harness API key",category:"credential",example:"pat.vzcxr183pymw194fdq1q0v.qjqjarqkd9ydxqagjmq3f5iq.8nn5nyaow3h5mmgjh053",isUsingLuhnAlgorithm:!1,regexp:"(?:pat|sat)\\.[a-zA-Z0-9_-]{22}\\.[a-zA-Z0-9]{24}\\.[a-zA-Z0-9]{20}"},{key:"hashicorp_tf_api_token",name:"HashiCorp Terraform API token",category:"credential",example:"984d8033429986.atlasv1.799k5cihj_807yc1e8afvla8ackd1khsb50nfeswbxbr1re54y0wpzs2tjy=",isUsingLuhnAlgorithm:!1,regexp:"[a-z0-9]{14}\\.(?-i:atlasv1)\\.[a-z0-9\\-_=]{60,70}"},{key:"heroku_api_key",name:"Heroku API key",category:"credential",example:"9127f65b-8b3f-c0b7-a336-a4347e71bc51",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"heroku_api_key_v2",name:"Heroku API key v2",category:"credential",example:"HRKU-AAxPYvV6l2R3DvF0w9VJ4m8cz9oaygOHxpQvcw--iD51MszQZeakD9DZsclX",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(HRKU-AA[0-9a-zA-Z_-]{58}))"},{key:"hubspot_api_key",name:"HubSpot API key",category:"credential",example:"86cb6664-b191-db72-95a7-49adebe84b74",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})"},{key:"huggingface_access_token",name:"HuggingFace access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:hf_(?i:[a-z]{34}))"},{key:"huggingface_organization_api_token",name:"HuggingFace organization API token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:api_org_(?i:[a-z]{34}))"},{key:"intercom_api_key",name:"Intercom API key",category:"credential",example:"zuc5c=ykf5gcwesqvmh2pji6k3extx0rbalsznte3sdo7iu7f-lumol2npfk",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{60})"},{key:"intra42_client_secret",name:"Intra42 client secret",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:s-s4t2(?:ud|af)-[abcdef0123456789]{64})"},{key:"jfrog_api_key",name:"JFrog API key",category:"credential",example:"lj7nrgoo0kr04kw312zvly7l0olsn37vhto5wdn3yqi5srxnc2axstp7a1kewkxi717w295kh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{73})"},{key:"jfrog_identity_token",name:"JFrog identity token",category:"credential",example:"xh0x2upbtkkg1pseg7ezmcyw2c3kt0bt05l5v8ynvkro6wagolhch0f7kppplt8b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"jwt",name:"JSON web token",category:"credential",example:"ey7gzQUpN8Kz7XY6Yin.ey1o36_XrBphAG8WMHQ.",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:ey[a-zA-Z0-9]{17,}\\.ey[a-zA-Z0-9\\/\\\\_-]{17,}\\.(?:[a-zA-Z0-9\\/\\\\_-]{10,}={0,2})?)"},{key:"jwt_base64",name:"JSON web token base64",category:"credential",example:"ZXlKNE5YUWpVekkxTmlJNklsUjFUM0pDZVRKT1kxUnNSbE5YZFZvNFMyZzRWemhCYWxGaFoySTBabTVtVURGVGJFdE5Uemd0VTI4aWZRLmV5SnBjM01pT2lKcWIyVWlMQTBLSUNKbGVIQWlPakV6TURBNE1Ua3pPREFzRFFvZ0ltaDBkSEE2THk5bGVHRnRjR3hsTG1OdmJTOXBjMTl5YjI5MElqcDBjblZsZlEuZEJqZnRKZVo0Q1ZQLW1COTJLMjd1aGJVSlUxcDFyX3dXMWdGV0ZPRWpYaw==",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ZXlK(?:(?P<alg>aGJHY2lPaU)|(?P<apu>aGNIVWlPaU)|(?P<apv>aGNIWWlPaU)|(?P<aud>aGRXUWlPaU)|(?P<b64>aU5qUWlP)|(?P<crit>amNtbDBJanBi)|(?P<cty>amRIa2lPaU)|(?P<epk>bGNHc2lPbn)|(?P<enc>bGJtTWlPaU)|(?P<jku>cWEzVWlPaU)|(?P<jwk>cWQyc2lPb)|(?P<iss>cGMzTWlPaU)|(?P<iv>cGRpSTZJ)|(?P<kid>cmFXUWlP)|(?P<key_ops>clpYbGZiM0J6SWpwY)|(?P<kty>cmRIa2lPaUp)|(?P<nonce>dWIyNWpaU0k2)|(?P<p2c>d01tTWlP)|(?P<p2s>d01uTWlPaU)|(?P<ppt>d2NIUWlPaU)|(?P<sub>emRXSWlPaU)|(?P<svt>emRuUWlP)|(?P<tag>MFlXY2lPaU)|(?P<typ>MGVYQWlPaUp)|(?P<url>MWNtd2l)|(?P<use>MWMyVWlPaUp)|(?P<ver>MlpYSWlPaU)|(?P<version>MlpYSnphVzl1SWpv)|(?P<x>NElqb2)|(?P<x5c>NE5XTWlP)|(?P<x5t>NE5YUWlPaU)|(?P<x5ts256>NE5YUWpVekkxTmlJNkl)|(?P<x5u>NE5YVWlPaU)|(?P<zip>NmFYQWlPaU))[a-zA-Z0-9\\/\\\\_+\\-\\r\\n]{40,}={0,2}"},{key:"launchdarkly_access_token",name:"LaunchDarkly access token",category:"credential",example:"ezmej9s6yv4qwk2=yeb4kfi162p33b_2hzm7tr-0",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{40})"},{key:"linear_api_key",name:"Linear API key",category:"credential",example:"lin_api_0n5n0k26vb4ka9je9dqdcwl1dae5mbpfhb48xio6",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)lin_api_[a-z0-9]{40}"},{key:"linear_client_secret",name:"Linear client secret",category:"credential",example:"7b956760f09b81684ed833c524f081de",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"linkedin_client_id",name:"LinkedIn client ID",category:"credential",example:"18u930hak0em0r",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{14})"},{key:"linkedin_client_secret",name:"LinkedIn client secret",category:"credential",example:"uvkxd9rw41ylk1zj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{16})"},{key:"lob_api_key",name:"Lob API key",category:"credential",example:"test_02efbb923a38370aac769e3bedc4d3398be",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:(live|test)_[a-f0-9]{35})"},{key:"lob_pub_api_key",name:"Lob publishable API key",category:"credential",example:"test_pub_df170d9f5be9244959713dfee686c42",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:(test|live)_pub_[a-f0-9]{31})"},{key:"mailchimp_api_key",name:"MailChimp API key",category:"credential",example:"81277fbbe2dd9c5e18d5f28cebcc558c-us20",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32}-us[0-9][0-9])"},{key:"mailgun_pub_key",name:"Mailgun public validation key",category:"credential",example:"pubkey-5011bae1a4b57dfa83762c24b0e1299d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:pubkey-[a-f0-9]{32})"},{key:"mailgun_private_api_token",name:"Mailgun private API token",category:"credential",example:"key-176f7ef066471ac351adab734d2c9fb2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:key-[a-f0-9]{32})"},{key:"mailgun_signing_key",name:"Mailgun webhook signing key",category:"credential",example:"24564bd3d54a469601d5ac5daecb9ad2-00001111-22223333",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8})"},{key:"mapbox_api_token",name:"MapBox API token",category:"credential",example:"pk.5ko18udoy3cilkpgyedje9limykwj8n7wmhug4967o9wze284mmpuuhjzgig.edjzuv7jwhc6lnv5b3p9nc",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:pk\\.[a-z0-9]{60}\\.[a-z0-9]{22})"},{key:"mattermost_access_token",name:"Mattermost access token",category:"credential",example:"rtw2hncbfhpbyyri90d3q2mo1m",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{26})"},{key:"maxmind_license_key",name:"MaxMind license key",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:[A-Za-z0-9]{6}_[A-Za-z0-9]{29}_mmk)"},{key:"cisco_meraki_api_key",name:"Cisco Meraki API key",category:"credential",example:"acea14a1470f7cf443a031dde64065ce81c77b2b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:[0-9a-f]{40})"},{key:"messagebird_api_token",name:"MessageBird API token",category:"credential",example:"448q6im7yxutswabdko1n69ry",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{25})"},{key:"messagebird_client_id",name:"MessageBird client ID",category:"credential",example:"12345678-ABCD-ABCD-ABCD-1234567890AB",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"netlify_access_token",name:"Netlify access token",category:"credential",example:"3j1sa0o20v0k-cjbjn3vh_4uqnkvb3w_px5no2in",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{40,46})"},{key:"new_relic_user_api_key",name:"New Relic user API key",category:"credential",example:"NRAK-zozcnrh45ornsbl1duyfhell59u",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:NRAK-[a-z0-9]{27})"},{key:"new_relic_user_api_id",name:"New Relic user API ID",category:"credential",example:"k0jze7delork84k8ke1z1dm275yw2aqf5uu2cy7x1uiloll3xab5203hiz9tx9xx",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"new_relic_browser_api_token",name:"New Relic browser API token",category:"credential",example:"NRJS-c7fa1261a97506e4a45",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:NRJS-[a-f0-9]{19})"},{key:"new_relic_insert_key",name:"New Relic insight insert key",category:"credential",example:"NRII-4168ab7eb2e051f37144ad884d32ab34",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:NRII-[a-z0-9-]{32})"},{key:"notion_api_token",name:"Notion API token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:ntn_[0-9]{11}[A-Za-z0-9]{32}[A-Za-z0-9]{3})"},{key:"npm_access_token",name:"npm access token",category:"credential",example:"npm_vz9e7fvsn7o2n2tddg6b01gs7g9wldlys4vm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:npm_[a-z0-9]{36})"},{key:"nytimes_access_token",name:"NYTimes access token",category:"credential",example:"ako7xzi0mx7w15ogdkew7ilq7h13x8rl",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{32})"},{key:"octopus_deploy_api_key",name:"Octopus Deploy API key",category:"credential",example:"API-NFWN6F7X32BYDBU94IGY3V5ZQY",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:API-[A-Z0-9]{26})"},{key:"okta_access_token",name:"Okta access token",category:"credential",example:"003cKkRNNMy4ul7V8UDHEjEBGbnsQ6tejSHzfeBtcp",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:00[a-zA-Z0-9_=\\-]{40})"},{key:"openai_api_key",name:"OpenAI API key",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sk-(?:proj|svcacct|admin)-(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})T3BlbkFJ(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})(?-u:\\b)|sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20})"},{key:"openshift_user_token",name:"OpenShift user token",category:"credential",example:"sha256~OFL-TnR3jyLteu_rAuff3PUYNELVvByMRFYCcAkaJSR",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sha256~[a-zA-Z0-9_-]{43})(?:[^a-zA-Z0-9_-]|\\z)"},{key:"perplexity_api_key",name:"Perplexity API key",category:"credential",example:"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'",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pplx-[a-zA-Z0-9]{48})(?:[`'\" \\r\\n\\t\\f\\v;]|\\\\[nr]|$|(?-u:\\b))"},{key:"pgpassword_shell_assignment",name:"PGPASSWORD shell assignment",category:"credential",example:"PGPASSWORD='supersecret'",isUsingLuhnAlgorithm:!1,regexp:`(?-u:\\b)PGPASSWORD=(?:"[^"\\r\\n]+"|'[^'\\r\\n]+'|[^\\s'"]+)`},{key:"plaid_api_token",name:"Plaid API token",category:"credential",example:"access-development-4b0f8c31-83fe-e4c5-3d02-91e487b69d2d",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:access-(?:sandbox|development|production)-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"plaid_client_id",name:"Plaid client ID",category:"credential",example:"TTPjxpFNiwOct5XLdxjXD0Ta",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{24})"},{key:"plaid_secret_key",name:"Plaid secret key",category:"credential",example:"ikhqm7a9k76l8f544dl0v8kxvm2w55",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{30})"},{key:"planetscale_password",name:"PlanetScale password",category:"credential",example:"pscale_pw_9gvu8z79m4b814z0vv8266w70h3i7jlq",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pscale_pw_[a-zA-Z0-9_=\\.-]{32,64})"},{key:"planetscale_api_token",name:"PlanetScale API token",category:"credential",example:"pscale_tkn_nwy9jkjgnry96ftecsx_=jrxc6pkmmew",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pscale_tkn_[a-zA-Z0-9_=\\.-]{32,64})"},{key:"planetscale_oauth_token",name:"PlanetScale OAuth token",category:"credential",example:"pscale_oauth_zx8v3gzfnfxbymj__l629i68jnz5gnff",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pscale_oauth_[a-zA-Z0-9_=\\.-]{32,64})"},{key:"postman_api_token",name:"Postman API token",category:"credential",example:"PMAK-525b84aa46e2c588620d8123-06f9ca36c4aad4305baafbe00716b7bc8f",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:PMAK-[a-f0-9]{24}\\-[a-f0-9]{34})"},{key:"prefect_api_token",name:"Prefect API token",category:"credential",example:"pnu_kttbffyfgffu2sfbxzxw8mbpgvvtxjljwe1p",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pnu_[a-zA-Z0-9]{36})"},{key:"privateai_api_token",name:"PrivateAI API token",category:"credential",example:"iwuxqzqilzbfnccncvjz6px23dnej11h",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"private_key",name:"Private key",category:"credential",example:`-----BEGIN PRIVATE KEY-----
|
|
136
136
|
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDAC4AWkdwKYSd8
|
|
137
137
|
Ks14IReLcYgADhoXk56ZzXI=
|
|
138
|
-
-----END PRIVATE KEY-----`,isUsingLuhnAlgorithm:!1,regexp:"-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[ \\r\\n\\t\\f\\v\\S-]{64,}?KEY(?: BLOCK)?-----"},{key:"pulumi_api_token",name:"Pulumi API token",category:"credential",example:"pul-b77e6bff9fddebbc2bb8eca94e3f29a41f6da70a",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pul-[a-f0-9]{40})"},{key:"pypi_upload_token",name:"PyPI upload token",category:"credential",example:"pypi-AgEIcHlwaS5vcmc128fd9e0b47dde39cfecad3a997273458e6392f6aac649ae38864bdd7ff12836",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)pypi-AgEIcHlwaS5vcmc[a-zA-Z0-9_-]{50}"},{key:"rapidapi_access_token",name:"RapidAPI access token",category:"credential",example:"g4x40h94pi_-zlklfz3-qvhiiu5zankyrqqwmsl60decihbqvl",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{50})"},{key:"readme_api_token",name:"ReadMe API token",category:"credential",example:"rdme_k38kau741xa5lw03mdkvcd4vn6s6hdhvhg1wxa4ls7dp8h58r0yxq65nsqwndn056pxsc4",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:rdme_[a-z0-9]{70})"},{key:"rubygems_api_token",name:"RubyGems API token",category:"credential",example:"rubygems_7790aaa8102395704a64594a11f6de4941a27f86bc3fc9d4",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:rubygems_[a-f0-9]{48})"},{key:"scalingo_api_token",name:"Scalingo API token",category:"credential",example:"tk-us-4fhmqrg-rl4416b3oij_qx3q284wbhbqpk7r3te4r14lafou",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:tk-us-[a-zA-Z0-9_-]{48})"},{key:"sendbird_access_id",name:"SendBird access ID",category:"credential",example:"7e7801fd-c25d-50ab-a723-01b94c8d6c5f",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"sendbird_access_token",name:"SendBird access token",category:"credential",example:"305f75f04e3afa65360c25d9944fdae91138328d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{40})"},{key:"sendgrid_api_token",name:"SendGrid API token",category:"credential",example:"SG.--ed-fvdeffijnle7575jp1sh24wq_9y9hcjua5w3dnqh5-wyegkpzenziy1_qr=hf",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:SG\\.[a-z0-9=_\\-\\.]{66})"},{key:"sendinblue_api_token",name:"Sendinblue API token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:xkeysib-[a-f0-9]{64}\\-[a-z0-9]{16})"},{key:"sentry_access_token",name:"Sentry access token",category:"credential",example:"1ad463398f40a52bb94a3795762f4003d51b03b8a788cba55e3a81de81c72940",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{64})"},{key:"sentry_org_token",name:"Sentry org token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)sntrys_eyJpYXQiO[a-zA-Z0-9+/]{10}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10}={0,2}_[a-zA-Z0-9+/]{43}(?:[^a-zA-Z0-9+/]|\\z)"},{key:"sentry_user_token",name:"Sentry user token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sntryu_[a-f0-9]{64})"},{key:"settlemint_application_access_token",name:"Settlemint application access token",category:"credential",example:"sm_aat_gshgzsv353m5yb9s",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sm_aat_[a-zA-Z0-9]{16})"},{key:"settlemint_personal_access_token",name:"Settlemint personal access token",category:"credential",example:"sm_pat_1yhza49gsle0trg8",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sm_pat_[a-zA-Z0-9]{16})"},{key:"settlemint_service_access_token",name:"Settlemint service access token",category:"credential",example:"sm_sat_cha543e6lb19llli",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sm_sat_[a-zA-Z0-9]{16})"},{key:"shippo_api_token",name:"Shippo API token",category:"credential",example:"shippo_live_1d0f80d04e7788c1edb8fc2b8076bbf8f59b84b7",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:shippo_(?:live|test)_[a-fA-F0-9]{40})"},{key:"shopify_access_token",name:"Shopify access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shpat_[a-fA-F0-9]{32}"},{key:"shopify_custom_access_token",name:"Shopify custom access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shpca_[a-fA-F0-9]{32}"},{key:"shopify_private_app_access_token",name:"Shopify private app access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shppa_[a-fA-F0-9]{32}"},{key:"shopify_shared_secret",name:"Shopify shared secret",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shpss_[a-fA-F0-9]{32}"},{key:"sidekiq_secret",name:"Sidekiq secret",category:"credential",example:"aa8d3915:64fb5cb5",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{8}:[a-f0-9]{8})"},{key:"sidekiq_sensitive_url",name:"Sidekiq sensitive URL",category:"credential",example:"https://cafebabe:deadbeef@gems.contribsys.com/",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)https?://(?:[a-f0-9]{8}:[a-f0-9]{8})@(?:gems.contribsys.com|enterprise.contribsys.com)(?:[\\/|\\#|\\?|:]|$)"},{key:"slack_bot_token",name:"Slack bot token",category:"credential",example:"xoxb-781236542736-2364535789652-GkwFDQoHqzXDVsC6GzqYUypD",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*"},{key:"slack_user_token",name:"Slack user token",category:"credential",example:"xoxp-41684372915-1320496754-45609968301-e708ba56e1517a99f6b5fb07349476ef",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}"},{key:"slack_app_token",name:"Slack app token",category:"credential",example:"xapp-1-A052FGTS2DL-5171572773297-610b6a11f4b7eb819e87b767d80e6575a3634791acb9a9ead051da879eb5b55e",isUsingLuhnAlgorithm:!1,regexp:"xapp-[0-9]-[A-Z0-9]+-[0-9]+-[a-z0-9]+"},{key:"slack_config_access_token",name:"Slack config access token",category:"credential",example:"xoxe.xoxp-1-Mi0yLTM0MTQwNDE0MDE3Ni0zNjU5NDY0Njg4MTctNTE4MjA3NTQ5NjA4MC01NDEyOTYyODY5NzUxLThhMTBjZmI1ZWIzMGIwNTg0ZDdmMDI5Y2UxNzVlZWVhYzU2ZWQyZTZiODNjNDZiMGUxMzRlNmNjNDEwYmQxMjQ",isUsingLuhnAlgorithm:!1,regexp:"xoxe.xox[bp]-[0-9]-[A-Z0-9]{50}"},{key:"slack_config_refresh_token",name:"Slack config refresh token",category:"credential",example:"xoxe-1-My0xLTMxNzcwMjQ0MTcxMy01MTU4MTUyNjkxNzE0LTUxODE4NDI0MDY3MzYtMjA5MGFkOTFlZThkZWE2OGFlZDYwYWJjODNhYzAxYjA5ZjVmODBhYjgzN2QyNDdjOTNlOGY5NTg2YWM1OGM4Mg",isUsingLuhnAlgorithm:!1,regexp:"xoxe-[0-9]-[A-Z0-9]{50}"},{key:"slack_legacy_bot_token",name:"Slack legacy bot token",category:"credential",example:"xoxb-263594206564-FGqddMF8t08v8N7Oq4i57vs1",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xoxb-[0-9]{8,14}-[a-zA-Z0-9]{18,26}"},{key:"slack_legacy_workspace_token",name:"Slack legacy workspace token",category:"credential",example:"xoxa-2-511111111-31111111111-3111111111111-e039d02840a0b9379c",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xox[ar]-(?:[0-9]-)?[0-9a-zA-Z]{8,48}"},{key:"slack_legacy_token",name:"Slack legacy token",category:"credential",example:"xoxs-416843729158-132049654-5609968301-e708ba56e1",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xox[os]-[0-9]+-[0-9]+-[0-9]+-[a-fA-F0-9]+"},{key:"slack_webhook_url",name:"Slack webhook URL",category:"credential",example:"hooks.slack.com/services/z6cvbfngk3h7i0vts4akmbxidtb8o3b4pq2sbbd6o86g",isUsingLuhnAlgorithm:!1,regexp:"(?:https?://)?hooks.slack.com/(?:services|workflows|triggers)/[A-Za-z0-9+/]{43,56}"},{key:"snyk_api_token",name:"Snyk API token",category:"credential",example:"12345678-ABCD-ABCD-ABCD-1234567890AB",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"sonar_api_token",name:"Sonar API token",category:"credential",example:"12345678ABCDEFH1234567890ABCDEFH12345678",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:(?:squ_|sqp_|sqa_)?[a-z0-9=_-]{40})"},{key:"stripe_access_token",name:"Stripe access token",category:"credential",example:"sk_test_cyge9m4s1kxiqdkszz0a57nyx6wk73",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})"},{key:"square_access_token",name:"Square access token",category:"credential",example:"sq0atp-OQUxovdrj3tfFpSd66r3sY",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:EAAA|sq0atp-)[a-zA-Z0-9_-]{22,60})"},{key:"squarespace_access_token",name:"Squarespace access token",category:"credential",example:"86447eab-140f-2563-3572-bb016dafd692",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"sumologic_access_id",name:"SumoLogic access ID",category:"credential",example:"suJS4ZsaD5bQTt",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:su[a-zA-Z0-9]{12})"},{key:"sumologic_access_token",name:"SumoLogic access token",category:"credential",example:"1xohkwr8lpvm4osygkpe5zbd16c3376ver2qed1bssuko4uy4tij1bnf4dnwy7o4",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"microsoft_teams_webhook",name:"Microsoft Teams webhook URL",category:"credential",example:"https://mycompany.webhook.office.com/webhookb2/767lrnj6-okh8-dnh8-jey2-y2iteohrwz75@6igi6oz6-ud9w-wior-2zva-5vx0wp6wuiqk/IncomingWebhook/o1zox92ssprrppjtnvcjqq0q09k2wnc3/qwox5p9d-x4zr-3yis-t1on-s67zj50tmyht",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)https://[a-z0-9]+\\.webhook\\.office\\.com/webhookb2/[a-z0-9]{8}-(?:[a-z0-9]{4}-){3}[a-z0-9]{12}@[a-z0-9]{8}-(?:[a-z0-9]{4}-){3}[a-z0-9]{12}/IncomingWebhook/[a-z0-9]{32}/[a-z0-9]{8}-(?:[a-z0-9]{4}-){3}[a-z0-9]{12}"},{key:"telegram_bot_api_token",name:"Telegram bot API token",category:"credential",example:"59015865:A12o5wu6f78zofs0udypf9ti23u82g-qkfz",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{5,16}:(?-i:A)[a-z0-9_\\-]{34})"},{key:"travisci_access_token",name:"Travis CI access token",category:"credential",example:"zjgfo5fhshd5c60hpz22wh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{22})"},{key:"twilio_api_key",name:"Twilio API key",category:"credential",example:"SKa585fd034fcd16cdd741f7df9b57fb3b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)SK[0-9a-fA-F]{32}"},{key:"twitch_api_token",name:"Twitch API token",category:"credential",example:"1hm9gcychlkpf93jdjnwdu0uaamu6d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{30})"},{key:"twitter_api_key",name:"Twitter API key",category:"credential",example:"m8zqu4etx07bjt7tyeacc6pox",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{25})"},{key:"twitter_api_secret",name:"Twitter API secret",category:"credential",example:"7f4gxkubw9qs346ik99zk3z8b6kk3d7g8toi7zujgvgbt8q0yv",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{50})"},{key:"twitter_access_token",name:"Twitter access token",category:"credential",example:"465616696186918-96B1NCD5CH0uyi7zUHiS",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{15,25}-[a-zA-Z0-9]{20,40})"},{key:"twitter_access_secret",name:"Twitter access secret",category:"credential",example:"vyuo5peybdzznr7z0ua5wamhogusans4m29uzi25w4jgj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{45})"},{key:"twitter_bearer_token",name:"Twitter bearer token",category:"credential",example:"AAAAAAAAAAAAAAAAAAAAAAWRGWFGlfwyqNrrIa3pewqNNLX0jQMj2sR6M2cZUfBdqXDtkt7Nsb56F4tCz7Pt8ujbosrLxnRqYgwI0b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:A{22}[a-zA-Z0-9%]{80})"},{key:"typeform_api_token",name:"Typeform API token",category:"credential",example:"tfp_o-nsn=6eg2ios=4g652xhf933qor4jj7ort2qh_uw_5jdsuffp31ln=e-2a",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:tfp_[a-z0-9\\-_\\.=]{59})"},{key:"vault_batch_token",name:"Vault batch token",category:"credential",example:"hvb.x84j4cl53mzvhvb1nfc3mfi721gh5i-92f96lt0gns5lpksfu5f0199j-gw4ycxg6au4ser86mczcr_nx6ur2elbpazfrybo80fxjv3bghxshml3g261l6qi03yrz03qup84jk-fc2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:hvb\\.[a-zA-Z0-9_-]{50})"},{key:"vault_service_token",name:"Vault service token",category:"credential",example:"s.8QH9knZV94f0IjBZismfOPD0",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:hvs\\.[a-zA-Z0-9_-]{90}|s\\.(?i:[a-z0-9]{24})))"},{key:"yandex_api_key",name:"Yandex API key",category:"credential",example:"AQVN9wiAh8pyz3lmB5WTo_KUuPDXlxtzkA5-YFG",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:AQVN[A-Za-z0-9_\\-]{35,38})"},{key:"yandex_aws_access_token",name:"Yandex AWS access token",category:"credential",example:"YCZ6DHVrZONPNtgwWLZPrIGyviSrudRVSr8w0b1S",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:YC[a-zA-Z0-9_\\-]{38})"},{key:"yandex_access_token",name:"Yandex access token",category:"credential",example:"t1.L=.WJ9CYVI5eeLkTOrMM_dgaPgdmpen48R8RYsL4VJqelVKDmrqYsSHkH6QyVVhJkuHSQFTd0NOhClEDyCz7eEbh5=",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:t1\\.[A-Z0-9a-z_-]+[=]{0,2}\\.[A-Z0-9a-z_-]{86}[=]{0,2})"},{key:"zendesk_secret_key",name:"Zendesk secret key",category:"credential",example:"iydgm2jofftb2xu7niv55qnfxdwbwmqt2s561bgc",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{40})"},{key:"infracost_api_token",name:"Infracost API token",category:"credential",example:"ico-fNZw8jjy6TugMUHKWX4l9iSP3i95SPNH",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:ico-[a-zA-Z0-9]{32})"},{key:"iban",name:"Iban",category:"financial-data",example:"FR7630006000011234567890189",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{11,30}(?-u:\\b)"},{key:"aikido_token",name:"Aikido token",category:"credential",example:"AIK_SECRET_XU28CmBY7Kxk3RPrqfHk9n6p5QX4p1tXzvJ7J1B3RPrqfHk9n6p5QX4p1tXzvJ7J",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AIK_SECRET_[A-Za-z0-9]{64}"},{key:"aikido_ci_token",name:"Aikido CI secret",category:"credential",example:"AIK_CI_US_XU28CmBY7Kxk3RPrqfHk9n6p5QX4p1tXzvJ7J1B3RPrqfHk9n6p5QX4p1tXzvJ7J",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AIK_CI_(US_|ME_)?[A-Za-z0-9]{64}"},{key:"tsuga_ingestion_key",name:"Tsuga ingestion key",category:"credential",example:"tsuga_in:v1:OUvrwavCG//ixL08HEds9OAT",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)tsuga_in:v1:[A-Za-z0-9+/]{24}"},{key:"tsuga_operation_key",name:"Tsuga operation key",category:"credential",example:"tsuga_op:v1:zz3-LWv-sLy:0k7Skt255M0yXe/ZLBoiSamb",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)tsuga_op:v1:[A-Za-z0-9_-]+:[A-Za-z0-9+/]{24}"}],p1=XS.map(e=>e.key);var rOe=new Set(p1),nOe=XS.map(e=>e.key);var M="context";var JS="trace_id",dOe=`${M}.team`,fOe=`${M}.env`,gOe=`${M}.api_key_id`,rp=`${M}.service.name`,yOe=`${M}.service.version`,Il=`${M}.span.kind`,bl=`${M}.span.name`,Sl=`${M}.status.code`,eO=["SPAN_KIND_UNSPECIFIED","SPAN_KIND_INTERNAL","SPAN_KIND_SERVER","SPAN_KIND_CLIENT","SPAN_KIND_PRODUCER","SPAN_KIND_CONSUMER"];var Na=`${M}.host.name`,u1=`${M}.instance`,l1=`${M}.instanceid`,m1=`${M}.instance_name`,hOe=`${M}.telemetry.sdk.language`,TOe=`${M}.process.runtime.name`,EOe=`${M}.scope.name`,_Oe=`${M}.cloud.provider`,IOe=`${M}.cloud.platform`,bOe=`${M}.aws.ecs.task.arn`,SOe=`${M}.k8s.cluster.name`,OOe=`${M}.k8s.cluster.uid`,AOe=`${M}.k8s.namespace.name`,d1=`${M}.k8s.pod.name`,xOe=`${M}.k8s.pod.uid`,ROe=`${M}.k8s.container.name`,COe=`${M}.k8s.node.name`,POe=`${M}.k8s.node.uid`,f1=`${M}.k8s.deployment.name`,UOe=`${M}.k8s.deployment.uid`,g1=`${M}.k8s.replicaset.name`,wOe=`${M}.k8s.replicaset.uid`,y1=`${M}.k8s.statefulset.name`,NOe=`${M}.k8s.statefulset.uid`,h1=`${M}.k8s.daemonset.name`,LOe=`${M}.k8s.daemonset.uid`,vOe=`${M}.k8s.job.name`,kOe=`${M}.k8s.job.uid`,MOe=`${M}.k8s.cronjob.name`,DOe=`${M}.k8s.cronjob.uid`,Ol="status_code",Al="span.name";var xl="span.kind";var T1="db.system.name",E1="db.system",_1="db.namespace",I1="db.name";var GOe=`span_attributes.${_1}`,$Oe=`span_attributes.${I1}`,jOe=`span_attributes.${T1}`,qOe=`span_attributes.${E1}`;var BOe={name:"tsuga.internal.processing_tag_policy_violations_total",attributes:{tagPolicyId:`${M}.tag_policy_id`,dataSource:`${M}.data_source`}};var FOe={name:"tsuga.internal.event_size_bytes",attributes:{batchKind:`${M}.batch_kind`,batchKindMetricsFilter:`${M}.batch_kind:metrics`,sourceApiKeyId:`${M}.source_api_key_id`,sourceEnv:`${M}.source_env`,sourceTeam:`${M}.source_team`}};var Rl="__tsuga_metadata__",HOe=`${Rl}.signature`,KOe=`${Rl}.routes`,zOe=`${Rl}.trace_id_bucket`;var ZOe={[Il]:xl,[Il.replace(`${M}.`,"")]:xl,[bl]:Al,[bl.replace(`${M}.`,"")]:Al,[Sl]:Ol,[Sl.replace(`${M}.`,"")]:Ol};function tO(e){return e.replace(/ies$/,"y").replace(/s$/,"")}var rO=["alert_cluster","alert_conditions","alert_data_url","alert_id","alert_owner","alert_previous_status","alert_priority","alert_start_time","alert_status","alert_tags","alert_timeframe","alert_title","alert_transition","alert_triggered_by","dashboard_url","monitor_url"],nO=["alert_queries","alert_thresholds","alert_values"],b1=[...rO,...nO],oO=["alert_event_name","alert_message"],SAe=[...b1,...oO],OAe=new Set([...rO,...oO]),AAe=new Set(nO);var S1="^\\S(.*\\S)?$",O1=128,A1=256,x1=t.Object({key:t.String({description:"Tag key attached to the resource. Consumers can use key/value tags for filtering, ownership context, and policy checks."}),value:t.String({description:"Tag value attached to the resource for this key. Tsuga returns the value exactly as stored."})},{title:"Tag"}),R1=t.Object({key:t.String({maxLength:O1,description:"Tag key to attach to the resource."}),value:t.String({maxLength:A1,pattern:S1,description:"Tag value to attach to the resource. Leading or trailing whitespace is rejected."})},{title:"Tag"}),Yt=t.Array(x1,{title:"Tags",description:"Key/value tags applied to the resource. Use them to organize resources and to satisfy tag policies."}),Vt=t.Array(R1,{title:"Tags",maxItems:50,description:"Key/value tags to apply to the resource. Tag policies may require specific keys or values."}),Me=t.Optional(Yt),Ve=t.Optional(Vt);var mn="/v0/teams",op=["public","private"],np={NAME:"name",CREATED_AT:"createdAt",MEMBER_COUNT:"memberCount",VISIBILITY:"visibility"},C1=t.Enum([np.NAME,np.CREATED_AT,np.MEMBER_COUNT,np.VISIBILITY],{description:"Team field used for sorting list responses. Use `name`, `createdAt`, `memberCount`, or `visibility`."}),sO=t.Object({color:t.Enum(El,{description:"Color token used by Tsuga when rendering the team avatar."}),mode:t.Enum(_l,{description:"Avatar rendering mode selected for the team."}),iconName:t.Enum(ZS,{description:"Icon name rendered inside the team avatar when icon mode is used."})}),Cl=t.Object({color:t.Enum(El),mode:t.Enum(_l)}),iO=100,aO=250,Wo=t.Object({id:t.String({description:"Unique identifier of the team. Generated by Tsuga and stable for the team lifetime."}),name:t.String({description:"Human-readable team name displayed throughout Tsuga and used in team search."}),description:t.Optional(t.String({description:"Optional free-text description of the team."})),visibility:t.Enum(op,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:Me,createdAt:E({description:"Timestamp when Tsuga created the team."}),updatedAt:E({description:"Timestamp when Tsuga last updated the team metadata."}),memberCount:t.Optional(t.Number({description:"Number of members currently in the team"})),avatar:t.Optional(sO)}),ip=t.Object({name:t.String({minLength:1,maxLength:iO,format:qo,description:`Name to assign to the team. Must be kebab-case (lowercase letters, numbers, and dashes only) and unique in the organization. Maximum length is ${iO} characters.`}),description:t.Optional(t.String({maxLength:aO,description:`Optional team description. Maximum length is ${aO} characters.`})),visibility:t.Enum(op,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:Ve,avatar:t.Optional(sO)}),P1=t.Object({id:t.String(),name:t.String(),email:t.String(),role:t.Enum(zo),joinedTeamAt:E(),orgRole:t.Enum(Kc),avatar:t.Optional(Cl)}),Ixe=m({tags:["teams"],url:mn,method:"GET",paginated:!0,response:t.Array(Wo),query:t.Object({...ye,includeMemberCount:t.Optional(t.Boolean()),searchQuery:t.Optional(p({description:"Substring matched against team names and descriptions."})),visibility:t.Optional(t.Enum(op,{description:"Restrict results to teams with this visibility."})),myTeamsOnly:t.Optional(t.Boolean({description:"If true, return only teams that include the authenticated user."})),sortBy:t.Optional(C1),sortDirection:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending."}))})}),bxe=m({tags:["teams"],url:`${mn}/:id`,method:"GET",params:t.Object({id:p()}),response:Wo}),Sxe=m({tags:["teams"],url:`${mn}/:id/members`,method:"GET",params:t.Object({id:p()}),response:t.Array(P1)}),Oxe=m({tags:["teams"],url:`${mn}/:id/assets`,method:"GET",params:t.Object({id:p()}),response:t.Object({apiKeyCount:t.Number(),logRouteCount:t.Number(),monitorCount:t.Number(),notificationRuleCount:t.Number(),dashboardCount:t.Number()})}),Axe=m({tags:["teams"],url:mn,method:"POST",body:ip,response:Wo}),xxe=m({tags:["teams"],url:`${mn}/:id`,method:"PUT",params:t.Object({id:p()}),body:ip,response:Wo}),Rxe=m({tags:["teams"],url:`${mn}/bulk-update`,method:"POST",body:t.Object({teamIds:t.Array(p(),{maxItems:100}),config:t.Object({visibility:t.Enum(op)})}),response:t.Object({})}),Cxe=m({tags:["teams"],url:`${mn}/:id`,method:"DELETE",params:t.Object({id:p()}),response:R});var U1=t.Enum(["terraform-provider","web-frontend","mcp-server","cli"],{description:"Tsuga client surface that performed the operation. Use this to distinguish UI, CLI, MCP, and Terraform-originated changes."}),ue=b("type",[t.Object({type:t.Literal("user",{description:"The resource was created or updated by a user."}),id:t.String({description:"Unique identifier of the user actor."}),name:t.String({description:"Display name of the user actor at the time of response."}),avatar:t.Optional(Cl)}),t.Object({type:t.Literal("operation-api-key",{description:"The resource was created or updated by an operation API key."}),id:t.String({description:"Unique identifier of the operation API key actor."}),name:t.String({description:"Display name of the operation API key actor."}),source:t.Optional(U1)})],{description:"User or operation API key responsible for creating or updating a resource. Returned by Tsuga for audit context."});var ft="/v0/monitors",Zo=["alert","resolve","keep_last_status","consider_zero"],Xo=["alert","resolve","keep_last_status"];var pO=["no_aggregation","all","any","each","proportion"],uO=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"];var w1=t.Object({formula:t.String({description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:t.Enum(uO,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:t.Number({description:"Numeric threshold value used by the comparison."})}),N1=t.Object({formula:p({type:"tsuga-formula",description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:t.Enum(uO,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:t.Number({description:"Numeric threshold value used by the comparison."})}),L1=5,Pl=t.Array(w1,{description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),Ul=t.Array(N1,{minItems:1,maxItems:L1,description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),wl=t.Object({formula:t.String({description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:t.Enum(["rate","error","cpu","general","to_be_set"],{description:"Anomaly model type Tsuga uses to classify expected behavior: `rate` flags downward anomalies (e.g. count rates), `error` and `cpu` flag upward anomalies (e.g. error counts/rates, CPU usage), `general` flags both directions, and `to_be_set` is a placeholder Tsuga replaces by inferring the model type from the monitor query when the monitor is created or updated."})},{description:"Anomaly detection condition evaluated by this monitor. The `formula` result is compared against behavior learned from historical query results, and the monitor alerts on deviations in the direction implied by `conditionType`."}),Nl=t.Object({formula:p({type:"tsuga-formula",description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:t.Enum(["rate","error","cpu","general","to_be_set"],{description:"Anomaly model type used to classify expected behavior: `rate` flags downward anomalies (e.g. count rates), `error` and `cpu` flag upward anomalies (e.g. error counts/rates, CPU usage), and `general` flags both directions. Use `to_be_set` to let Tsuga infer the model type from the monitor query during create or update."})},{description:"Anomaly detection condition evaluated by this monitor. The `formula` result is compared against behavior learned from historical query results, and the monitor alerts on deviations in the direction implied by `conditionType`."}),dt=[1,2,3,4,5];var ap={timeframe:t.Number({description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over. Always a whole number, at least 1."}),groupByFields:t.Array(t.Object({fields:t.Array(t.String(),{description:"Attribute names the monitor splits results by, evaluating each resulting group independently. Empty means the monitor evaluates a single ungrouped series."}),limit:t.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:t.Optional(t.String({description:"Value used to group documents that have no value for a grouped field."}))}),{description:"Monitor group by configuration. The `limit` setting is currently ignored; evaluation applies a fixed limit of 100 groups per field."}),aggregationAlertLogic:t.Optional(t.Enum(pO,{description:"How grouped results are combined into alert state. Use `no_aggregation` only when `groupByFields` is empty; use `all`, `any`, `each`, or `proportion` with non-empty `groupByFields`. `proportion` also requires `proportionAlertThreshold`."})),proportionAlertThreshold:t.Optional(t.Integer({description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},sp={timeframe:t.Integer({minimum:1,description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over."}),groupByFields:t.Array(t.Object({fields:t.Array(p(),{description:"Attribute names the monitor splits results by, evaluating each resulting group independently. Empty or omitted means the monitor evaluates a single ungrouped series."}),limit:t.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:t.Optional(p({allowEmpty:!1,description:"Value used to group documents that have no value for a grouped field."}))}),{maxItems:1,description:"Monitor group by configuration. The `limit` setting is currently ignored; evaluation applies a fixed limit of 100 groups per field."}),aggregationAlertLogic:t.Optional(t.Enum(pO,{description:"How grouped results are combined into alert state. Use `no_aggregation` only when `groupByFields` is empty; use `all`, `any`, `each`, or `proportion` with non-empty `groupByFields`. `proportion` also requires `proportionAlertThreshold`. On create, omitted query-monitor values default to `no_aggregation`; on update, omitted values keep the existing aggregation logic."})),proportionAlertThreshold:t.Optional(t.Integer({minimum:1,maximum:99,description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},Ll={...ap,timeframe:t.Number({description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over. Always a whole number from 5 through 1440."})},vl={...sp,timeframe:t.Integer({minimum:5,maximum:1440,description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over."})},lO=t.Object({type:t.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:Pl,noDataBehavior:t.Enum(Zo,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...ap,queries:Sr},{$id:"MonitorConfigurationMetric"}),mO=t.Object({type:t.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:Ul,noDataBehavior:t.Enum(Zo,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...sp,queries:Or},{$id:"InputMonitorConfigurationMetric"}),dO=t.Object({type:t.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:Pl,noDataBehavior:t.Enum(Zo,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...ap,queries:Sr},{$id:"MonitorConfigurationLog"}),fO=t.Object({type:t.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:Ul,noDataBehavior:t.Enum(Zo,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...sp,queries:Or},{$id:"InputMonitorConfigurationLog"}),gO=t.Object({type:t.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:Pl,noDataBehavior:t.Enum(Zo,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...ap,queries:Sr},{$id:"MonitorConfigurationTrace"}),v1=t.Object({type:t.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:Ul,noDataBehavior:t.Enum(Zo,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...sp,queries:Or},{$id:"InputMonitorConfigurationTrace"}),yO=t.Object({type:t.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:wl,noDataBehavior:t.Enum(Xo,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...Ll,queries:Sr},{$id:"MonitorConfigurationAnomalyLog"}),hO=t.Object({type:t.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:Nl,noDataBehavior:t.Enum(Xo,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...vl,queries:Or},{$id:"InputMonitorConfigurationAnomalyLog"}),TO=t.Object({type:t.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:wl,noDataBehavior:t.Enum(Xo,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...Ll,queries:Sr},{$id:"MonitorConfigurationAnomalyMetric"}),EO=t.Object({type:t.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:Nl,noDataBehavior:t.Enum(Xo,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...vl,queries:Or},{$id:"InputMonitorConfigurationAnomalyMetric"}),_O=t.Object({type:t.Literal("anomaly-trace",{description:"Anomaly monitor over trace aggregations. Use this configuration when Tsuga should learn historical trace query behavior and alert on unusual movement in trace-derived values."}),condition:wl,noDataBehavior:t.Enum(Xo,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...Ll,queries:Sr},{$id:"MonitorConfigurationAnomalyTrace"}),k1=t.Object({type:t.Literal("anomaly-trace",{description:"Anomaly monitor over trace aggregations. Set this value to create or update an anomaly monitor that learns historical trace query behavior and alerts on unusual movement in trace-derived values."}),condition:Nl,noDataBehavior:t.Enum(Xo,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...vl,queries:Or},{$id:"InputMonitorConfigurationAnomalyTrace"}),IO=t.Object({type:t.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:t.Integer({description:"Number of days before certificate expiry when the monitor should warn."}),cloudAccounts:t.Optional(t.Array(t.String(),{description:"Cloud account IDs whose certificates are checked. Omitted means certificates from all cloud accounts are checked."})),aggregationAlertLogic:t.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:t.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"MonitorConfigurationCertificateExpiry"}),M1=t.Object({type:t.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:t.Integer({minimum:1,maximum:365,description:"Number of days before certificate expiry when the monitor should warn. Valid values are 1 through 365."}),cloudAccounts:t.Optional(t.Array(t.String(),{minItems:1,description:"Cloud account IDs whose certificates are checked. Omit to check certificates from all cloud accounts."})),aggregationAlertLogic:t.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:t.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"InputMonitorConfigurationCertificateExpiry"}),D1=t.Object({type:t.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured team, environment, and optional service. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:t.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:t.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:t.Object({teamIds:t.Array(t.String(),{description:"Team IDs whose logs are searched for new error patterns. Tsuga resolves these team IDs to team names when exporting monitor assets."}),env:t.String({description:"Environment whose logs are searched for new error patterns."}),service:t.Optional(t.String({description:"Optional service name whose logs are searched for new error patterns. If omitted, the monitor searches all services matching the team and environment filter."}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included."})},{$id:"MonitorConfigurationLogErrorPattern"}),G1=t.Object({type:t.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured team, environment, and optional service. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:t.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:t.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:t.Object({teamIds:t.Array(p(),{description:"Team IDs whose logs are searched for new error patterns. Tsuga resolves these team IDs to team names when exporting monitor assets."}),env:p({description:"Environment whose logs are searched for new error patterns."}),service:t.Optional(p({description:"Optional service name whose logs are searched for new error patterns. If omitted, the monitor searches all services matching the team and environment filter."}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included."})},{$id:"InputMonitorConfigurationLogErrorPattern"}),$1=b("type",[lO,dO,gO,yO,TO,D1,_O,IO],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."}),j1=b("type",[mO,fO,v1,hO,EO,k1,G1,M1],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."});var xr=t.Object({id:t.String({description:"Tsuga-generated monitor ID assigned when the monitor is created."}),name:t.String({description:"Display name of the monitor and alert source."}),owner:t.String({description:"Team ID that owns and manages the monitor."}),message:t.Optional(t.String({description:"Caller-supplied message included in notifications triggered by this monitor. Omitted when the monitor was created or last updated without one."})),tags:Me,configuration:$1,priority:t.Enum(dt,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),permissions:ln,dashboardId:t.Optional(t.String({description:"ID of the dashboard linked to this monitor for context when investigating alerts. Caller-supplied. Omitted when no dashboard is linked."})),pauseUntil:t.Optional(E({description:"Timestamp until which the monitor is snoozed."})),creator:t.Optional(ue),updater:t.Optional(ue),createdAt:E({description:"Timestamp when Tsuga created the monitor."}),updatedAt:E({description:"Timestamp when Tsuga last updated the monitor."}),assetUpdatedAt:E({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."}),clusterIds:t.Array(t.String(),{description:"Cluster IDs where the monitor is deployed. Empty means all eligible clusters."})},{title:"Monitor"}),q1=b("type",[lO,dO,gO,yO,TO,_O,IO]),Vxe=t.Object({...xr.properties,configuration:q1},{title:"Monitor"}),Qxe=t.Object({...xr.properties,configuration:b("type",[mO,fO,hO,EO])},{title:"Monitor"}),La=t.Object({name:p({description:"Display name of the monitor and alert source."}),message:t.Optional(p({type:"long",description:"Message included in notifications triggered by this monitor. Optional on create. On update, omitting it keeps the existing message."})),tags:Ve,configuration:j1,priority:t.Enum(dt,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the monitor."}),dashboardId:t.Optional(t.Union([t.Null(),p({allowEmpty:!1})],{description:"ID of the dashboard to link to this monitor for context when investigating alerts. On create: omit or send `null` to leave the monitor unlinked. On update: omit to skip updating this field, send `null` to clear an existing link."})),pauseUntil:t.Optional(p({allowEmpty:!1,type:"date-time",description:"ISO timestamp until which the monitor should be snoozed."})),permissions:ln,clusterIds:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Cluster IDs where the monitor should be deployed. Empty or omitted means all eligible clusters for cluster-deployed monitor types."}))}),cO=["threshold","certificate-expiry","anomaly-detection","log-error-pattern"],dn={PRIORITY:"priority",TYPE:"type",NAME:"name",OWNER:"owner",TAGS:"tags",CLUSTER_IDS:"clusterIds",PAUSE_UNTIL:"pauseUntil",ASSET_UPDATED_AT:"assetUpdatedAt"};var kl=t.Object({owners:Be(p({allowEmpty:!1}),{description:"Restrict results to monitors owned by any of these team IDs",maxItems:50}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Case-insensitive substring matched against monitor ID, monitor name, query filters, and aggregate fields. Wildcard characters are treated literally."}),exclude:t.Optional(t.Boolean({description:"If true, exclude monitors matching this value instead of including them"}))},{description:"Search query filter for monitors."}),tags:Be(Vt.items,{description:"Restrict results to monitors that have at least one of the listed key/value tags",maxItems:50}),priorities:Be(t.Enum(dt),{description:"Restrict results to monitors with one of these priorities",maxItems:dt.length}),types:Be(t.Enum(cO),{description:"Restrict results to monitors with these types",maxItems:cO.length}),activity:t.Enum(["active","snoozed"],{description:"Restrict results by activity status: active monitors or currently snoozed monitors"}),clusterIds:Be(p({allowEmpty:!1}),{description:"Restrict results to monitors deployed to any of these cluster IDs (monitors with no cluster restriction are always included)",maxItems:50})},{description:"Optional filters applied to narrow the returned monitors"}),Ml=t.Partial(t.Object({...ye,filters:t.Partial(kl),sort:t.Object({by:t.Enum([dn.PRIORITY,dn.TYPE,dn.NAME,dn.OWNER,dn.TAGS,dn.CLUSTER_IDS,dn.PAUSE_UNTIL,dn.ASSET_UPDATED_AT],{description:"Field to sort the returned monitors by. For `priority`, `desc` returns highest-priority monitors first because priority 1 is highest."}),direction:t.Enum(["asc","desc"],{description:"Sort direction. For `priority`, `desc` returns priority 1 first and `asc` returns priority 5 first."})},{description:"Optional sorting applied to the returned monitors. Ties are broken by creation time and monitor ID for stable pagination."})})),Wxe=m({tags:["monitors"],url:`${ft}/query`,method:"POST",paginated:!0,response:t.Array(xr),body:Ml}),Zxe=m({tags:["monitors"],url:`${ft}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(kl,["tags"])))}),response:Yt}),Xxe=m({tags:["monitors"],url:`${ft}/counts/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(kl,["activity"])))}),response:t.Object({all:t.Integer({description:"Total number of monitors matching the filters that the user can read."}),active:t.Integer({description:"Number of matching readable monitors that are not currently snoozed."}),snoozed:t.Integer({description:"Number of matching readable monitors that are currently snoozed."})})}),Jxe=m({tags:["monitors"],url:`${ft}/:id`,method:"GET",params:t.Object({id:p()}),response:xr}),eRe=m({tags:["monitors"],url:ft,method:"POST",body:La,response:xr}),tRe=m({tags:["monitors"],url:`${ft}/:id`,method:"PUT",params:t.Object({id:p()}),body:La,response:xr}),rRe=m({tags:["monitors"],url:`${ft}/bulk-update`,method:"PUT",body:t.Object({monitorIds:t.Array(p({allowEmpty:!1}),{minItems:1}),owner:p({allowEmpty:!1})}),response:t.Object({})}),nRe=m({tags:["monitors"],url:`${ft}/:id`,method:"DELETE",params:t.Object({id:p()}),response:R}),oRe=m({tags:["monitors"],url:`${ft}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})}),iRe=m({tags:["monitors"],url:`${ft}/:id/snooze`,method:"POST",params:t.Object({id:p()}),body:t.Object({pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:xr}),aRe=m({tags:["monitors"],url:`${ft}/bulk-snooze`,method:"POST",body:t.Object({monitorIds:t.Array(p()),pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:t.Object({})}),B1=["alert","alert_consider_zero","alert_no_data","keep_last_status_alert"],F1=["ok","ok_consider_zero","ok_no_data","keep_last_status_ok"],H1=[...B1,...F1],Kn=t.Enum(H1),K1=b("type",[t.Object({type:t.Literal("each"),subStates:t.Record(t.String(),t.Object({stateValue:t.Union([Kn,t.Null()]),lastChangedAt:E()}))}),t.Object({type:t.Literal("no_aggregation"),stateValue:t.Optional(Kn)}),t.Object({type:t.Literal("any"),stateValue:t.Optional(Kn)}),t.Object({type:t.Literal("all"),stateValue:t.Optional(Kn)}),t.Object({type:t.Literal("proportion"),stateValue:t.Optional(Kn)})]),z1=t.Object({monitorId:t.String(),currentState:K1,lastChangedAt:t.Optional(E())}),sRe=m({tags:["monitors"],url:`${ft}/states/:id`,method:"GET",params:t.Object({id:p()}),response:z1}),cRe=m({tags:["monitors"],url:`${ft}/:id/transitions`,method:"GET",params:t.Object({id:p()}),query:t.Object({from:t.Number(),to:t.Number()}),response:t.Array(t.Object({id:t.String(),createdAt:E(),fromState:t.Optional(Kn),toState:t.Optional(Kn),dimension:t.Optional(t.String())}))}),Y1=["unprocessed","processed","failed-to-process"],pRe=m({tags:["monitors"],url:`${ft}/:id/results`,method:"GET",params:t.Object({id:p()}),query:t.Object({from:t.Number(),to:t.Number()}),response:t.Object({isTruncated:t.Boolean(),results:t.Array(t.Object({id:t.String(),evaluationAt:E(),formulaResult:t.Object({groups:t.Array(t.Object({groupKey:t.Record(t.String(),Ua),results:t.Array(t.Union([t.Number(),t.Null()])),conditionMet:t.Enum(["true","false","nan-no-data"])}))}),createdAt:E(),status:t.Enum(Y1)}))})});var Rr="/v0/slos",V1=[7,30,90],Q1=["good","bad"],AO=t.Enum(Q1,{description:"How to treat SLO with no data: good (count as meeting the SLO), bad (count as breaching it)"}),W1=["good","bad","ignore"],xO=t.Enum(W1,{description:"How to treat time buckets with no data: good (count as meeting the SLO), bad (count as breaching it), or ignore (exclude from the error budget)"}),bO=30,SO=1440,RO=["greater_than","less_than","greater_than_or_equal","less_than_or_equal"],Z1=["healthy","breached","no_data"],cp=t.Enum(Z1,{description:"SLO status: healthy (meeting the target), breached (breaching it), or no_data (not evaluated yet)"}),OO={sli:t.Optional(t.Number({description:"Service level indicator for the latest evaluation; absent when there is no data"})),errorBudget:t.Optional(t.Number({description:"Remaining error budget at the latest evaluation; negative when exhausted, absent when there is no data"})),status:cp},X1=t.Object({overall:t.Object(OO,{description:"Latest overall evaluation for the cluster"}),perGroup:t.Array(t.Object({groupKey:t.Record(t.String(),Ua,{description:"Group-by field values identifying this group, keyed by field name. Present only when the SLO configuration sets `groupByFields`."}),...OO}),{description:"Latest evaluation for each group produced by the SLO configuration's `groupByFields`. Empty when the SLO is not grouped."})},{title:"SloClusterResults"}),CO=t.Record(t.String(),X1,{description:"Latest evaluation results keyed by cluster ID."}),Dl=t.Object({queries:Sr,formula:tp},{title:"SloQueryFormula",description:"Aggregation queries combined by a formula to produce the SLO signal. Tsuga evaluates this query formula during SLO evaluation and returns it as part of the saved SLO configuration."}),Gl=t.Object({queries:Or,formula:Hn},{title:"SloQueryFormula",description:"Aggregation queries combined by a formula to produce the SLO signal. Formulas reference queries as q1, q2, and so on."}),J1=t.Object({type:t.Literal("burn-rate",{description:"Alert configuration kind. Set to `burn-rate` for alerts that fire when the SLO consumes error budget faster than the configured multiplier."}),burnRate:t.Number({description:"Burn-rate multiplier that triggers this alert. The short and long evaluation windows are derived from the predefined template with the closest burn rate."})},{title:"BurnRateAlert"}),ej=t.Object({type:t.Literal("burn-rate",{description:"Alert configuration kind. Set to `burn-rate` for alerts that fire when the SLO consumes error budget faster than the configured multiplier."}),burnRate:t.Number({minimum:1,maximum:100,description:"Burn-rate multiplier that triggers this alert. Required for burn-rate alerts; valid input is 1 through 100. Non-template values are accepted; short and long evaluation windows are derived from the predefined template with the closest burn rate."})},{title:"BurnRateAlert"});var tj=t.Object({type:t.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:t.Number({description:"SLI percentage threshold for this alert. The alert passes when SLI is at or above this value and fires when SLI is strictly below it."})},{title:"ThresholdAlert"}),rj=t.Object({type:t.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:t.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"SLI percentage threshold for this alert. Required for threshold alerts; valid input is greater than 0 and less than 100. The alert passes when SLI is at or above this value and fires when SLI is strictly below it."})},{title:"ThresholdAlert"}),nj=b("type",[J1,tj],{description:"Alert trigger configuration: burn-rate or threshold"}),PO=b("type",[ej,rj],{description:"Alert trigger configuration: burn-rate or threshold"}),$l=t.Enum(dt,{description:"Alert priority (1 is highest, 5 is lowest)"}),jl=t.Object({id:t.String({description:"Tsuga-generated SLO alert ID assigned when the alert is created."}),sloId:t.String({description:"Parent SLO ID for this alert."}),priority:$l,configuration:nj,createdAt:E({description:"Timestamp when Tsuga created the alert."}),updatedAt:E({description:"Timestamp when Tsuga last updated the alert."}),assetUpdatedAt:E({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"SloAlert"}),oj=t.Object({priority:$l,configuration:PO}),ij=t.Object({id:t.Optional(p({allowEmpty:!1,description:"Identifier of an existing alert to update. Omit to create a new alert on this SLO."})),priority:$l,configuration:PO}),aj=b("type",[t.Object({type:t.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:zt,goodQuery:Dl,totalQuery:Dl,groupByFields:t.Optional(Qo),noDataBehavior:AO},{title:"EventSloConfiguration"}),t.Object({type:t.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:zt,query:Dl,sliceSizeMinutes:t.Integer({description:"Length of each time-SLO evaluation slice in minutes. Required for `type: time`."}),threshold:t.Object({operator:t.Enum(RO,{description:"Comparison operator between the query value and the threshold"}),value:t.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:t.Optional(Qo),noDataBehavior:xO},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),sj=b("type",[t.Object({type:t.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:zt,goodQuery:Gl,totalQuery:Gl,groupByFields:t.Optional(Ar),noDataBehavior:AO},{title:"EventSloConfiguration"}),t.Object({type:t.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:zt,query:Gl,sliceSizeMinutes:t.Integer({minimum:bO,maximum:SO,description:`Length of each time-SLO evaluation slice in minutes. Required for \`type: time\`. Valid input is ${bO} through ${SO}.`}),threshold:t.Object({operator:t.Enum(RO,{description:"Comparison operator between the query value and the threshold"}),value:t.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:t.Optional(Ar),noDataBehavior:xO},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),cj=t.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"Target percentage (0 < target < 100, e.g. 99.9)"}),UO=t.Enum(V1,{type:"integer",description:"Rolling SLO evaluation window in days. Set by the caller on create or update and returned on read and list responses. Allowed values are 7, 30, and 90."}),pj=t.Array(t.String(),{description:"Cluster IDs this SLO is evaluated on. Omit or send an empty array on input to run on all clusters; responses use an empty array to mean all clusters. Non-empty input values must reference existing clusters."}),uj=t.Array(p({allowEmpty:!1}),{description:"Cluster IDs this SLO is evaluated on. Omit or send an empty array on input to run on all clusters; responses use an empty array to mean all clusters. Non-empty input values must reference existing clusters."}),Jo=t.Object({id:t.String({description:"Tsuga-generated SLO ID assigned when the SLO is created."}),name:t.String({description:"Display name of the SLO, set by the caller."}),description:t.Optional(t.String({description:"Free-form, caller-provided description of what the SLO measures. Absent when not set."})),tags:Me,configuration:aj,target:t.Number({description:"Target percentage (0 < target < 100, e.g. 99.9)"}),timeframeDays:UO,owner:t.String({description:"Team ID that owns the SLO"}),permissions:ln,clusterIds:pj,creator:t.Optional(ue),updater:t.Optional(ue),alerts:t.Array(jl,{description:"Alerts attached to this SLO"}),createdAt:E({description:"Timestamp when Tsuga created the SLO."}),updatedAt:E({description:"Timestamp when Tsuga last updated the SLO."}),assetUpdatedAt:E({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"Slo"}),lj=t.Object({...Jo.properties,results:CO},{title:"SloWithResults"}),pp=t.Object({name:p({allowEmpty:!1,description:"Display name of the SLO."}),description:t.Optional(p({type:"long",description:"Free-form, caller-provided description of what the SLO measures. Optional."})),tags:Ve,configuration:sj,target:cj,timeframeDays:UO,owner:p({allowEmpty:!1,description:"Team ID that owns the SLO"}),permissions:ln,clusterIds:t.Optional(uj),alerts:t.Array(oj,{description:"Alerts to create on this SLO. Send an empty array for none."})}),ql=t.Object({...t.Omit(pp,["alerts"]).properties,alerts:t.Array(ij,{description:"Alerts attached to this SLO. The SLO owns its alerts: the set is reconciled to exactly this list \u2014 existing alerts are matched by id, alerts without an id are created, and existing alerts absent from the list are deleted. Send an empty array to clear all alerts."})}),wO=t.Object({owners:Be(p({allowEmpty:!1}),{description:"Restrict results to SLOs owned by any of these team IDs",maxItems:50}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against the SLO name or SLO ID."}),exclude:t.Optional(t.Boolean({description:"If true, exclude SLOs matching this value instead of including them"}))},{description:"Text filter for SLO names or IDs. Optional; `exclude: true` removes matching SLOs."}),tags:Be(Vt.items,{description:"Restrict results to SLOs that have at least one of the listed key/value tags",maxItems:50}),clusterIds:Be(p({allowEmpty:!1}),{description:"Restrict results to SLOs that run against any of these cluster IDs (SLOs with no cluster restriction are always included)",maxItems:50}),statuses:Be(cp,{description:"Restrict results to SLOs whose status is one of these values",maxItems:3})},{description:"Optional filters applied to narrow the returned SLOs"}),Bl=t.Partial(t.Object({...ye,filters:t.Partial(wO),sort:t.Object({by:t.Enum(["name","owner","tags","updatedAt","sli","errorBudget","status"],{description:"Field to sort by"}),direction:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned SLOs"})})),IRe=m({tags:["slos"],url:`${Rr}/query`,method:"POST",paginated:!0,response:t.Array(lj),body:Bl}),bRe=m({tags:["slos"],url:`${Rr}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(wO,["tags","statuses"])))}),response:Yt}),SRe=m({tags:["slos"],url:`${Rr}/:id`,method:"GET",params:t.Object({id:p()}),response:Jo}),ORe=m({tags:["slos"],url:`${Rr}/:id/results`,method:"GET",params:t.Object({id:p()}),response:CO}),ARe=m({tags:["slos"],url:Rr,method:"POST",body:pp,response:Jo}),xRe=m({tags:["slos"],url:`${Rr}/:id`,method:"PUT",params:t.Object({id:p()}),body:ql,response:Jo}),RRe=m({tags:["slos"],url:`${Rr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:R}),CRe=m({tags:["slos"],url:`${Rr}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})}),PRe=m({tags:["slos"],url:`${Rr}/bulk-update`,method:"PUT",body:t.Object({sloIds:t.Array(p()),owner:p({allowEmpty:!1})}),response:t.Object({})});var ei="/v0/notifications",Yn=`${ei}/rules`,NO=`${ei}/slack/setup`,va=`${ei}/integrations`,zn=["triggered","resolved","no-data"],mj=["sent","stale","pending","rate-limited","failed","silenced"],dj=t.Optional(t.Object({maxMessages:t.Integer({description:"Maximum number of notifications this target can send during the rate-limiting window."}),minutes:t.Integer({description:"Length of the rate-limiting window, in minutes."})},{description:"Per-target rate limit used when sending notifications. If omitted, Tsuga allows up to 1000 notifications every 10 minutes for this target."})),Fl=t.Object({maxMessages:t.Integer({minimum:1,description:"Maximum number of notifications this target can send during the rate-limiting window. The ratio of `maxMessages` to `minutes` cannot exceed 100 notifications per minute."}),minutes:t.Integer({minimum:1,description:"Length of the rate-limiting window, in minutes. The ratio of `maxMessages` to `minutes` cannot exceed 100 notifications per minute."})},{description:"Per-target rate limit used when sending notifications. If omitted, Tsuga allows up to 1000 notifications every 10 minutes for this target."}),fj=t.Optional(Fl),ur=t.Optional(t.Object({mode:t.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:t.Array(t.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:t.Integer({description:"Minimum number of minutes to wait after the previous notification."})},{description:"Configuration for repeat monitor notifications on this target. If omitted, Tsuga sends only the original notification for each alert transition."})),lr=t.Optional(t.Object({mode:t.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:t.Array(t.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:t.Integer({minimum:1,description:"Minimum number of minutes to wait after the previous notification."})},{description:"Configuration for repeat monitor notifications on this target. If omitted, Tsuga sends only the original notification for each alert transition."})),ka=t.Object({id:t.String({description:"Identifier of the notification target within this rule, used with the rule ID for per-target delivery state such as rate limiting."}),rateLimit:dj,config:b("type",[t.Object({type:t.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:t.String({description:"Slack channel ID that receives the notification"}),integrationId:t.String({description:"Slack workspace ID that receives the notification"}),integrationName:t.String({description:"Human readable name of the Slack integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigSlack"}),t.Object({type:t.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:t.String({description:"Identifier of the incident.io integration to use"}),integrationName:t.String({description:"Human readable name of the incident.io integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigIncidentIo"}),t.Object({type:t.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:t.Array(t.String(),{description:"Email addresses that will receive the alert"}),renotifyConfig:ur},{$id:"RuleTargetConfigEmail"}),t.Object({type:t.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:t.String({description:"Identifier of the Grafana IRM integration to use"}),integrationName:t.String({description:"Human readable name of the Grafana IRM integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigGrafanaIrm"}),t.Object({type:t.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:t.String({description:"Identifier of the PagerDuty integration to use"}),integrationName:t.String({description:"Human readable name of the PagerDuty integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigPagerDuty"}),t.Object({type:t.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:t.String({description:"Identifier of the Microsoft Teams integration to use"}),integrationName:t.String({description:"Human readable name of the Microsoft Teams integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigMicrosoftTeams"}),t.Object({type:t.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:t.String({description:"Identifier of the webhook integration to use"}),integrationName:t.String({description:"Human readable name of the webhook integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigWebhook"}),t.Object({type:t.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:t.String({description:"Identifier of the ServiceNow integration to use"}),integrationName:t.String({description:"Human readable name of the ServiceNow integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigServiceNow"}),t.Object({type:t.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:t.String({description:"Identifier of the Google Chat integration to use"}),integrationName:t.String({description:"Human readable name of the Google Chat integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigGoogleChat"}),t.Object({type:t.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:t.String({description:"Identifier of the Squadcast integration to use"}),integrationName:t.String({description:"Human readable name of the Squadcast integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigSquadcast"}),t.Object({type:t.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:t.String({description:"Identifier of the Jira integration to use"}),integrationName:t.String({description:"Human readable name of the Jira integration"}),projectKey:t.String({description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:t.String({description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:t.Optional(t.String({description:"Jira status the alert ticket is moved to right after it is filed for a firing alert. A later transition between two firing states leaves the ticket status alone."})),closedStatus:t.Optional(t.String({description:"Jira status the alert ticket is moved to when the alert resolves. Only takes effect when the rule delivers recovery transitions."}))},{$id:"RuleTargetConfigJira"})],{description:"Destination that received the notification. The `type` field discriminates the variant: `email` sends directly to the listed addresses, and every other type routes through the named integration referenced by `integrationId`."})}),ti=t.Object({id:p({description:"Identifier of the notification target within this rule. Choose a stable ID that is unique among this rule's targets; Tsuga uses it with the rule ID for per-target delivery state such as rate limiting."}),rateLimit:fj,config:b("type",[t.Object({type:t.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:p({allowEmpty:!1,description:"Slack channel ID that receives the notification"}),integrationId:p({allowEmpty:!1,description:"Slack workspace ID that receives the notification"}),renotifyConfig:lr},{$id:"RuleTargetInputSlack"}),t.Object({type:t.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the incident.io integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputIncidentIo"}),t.Object({type:t.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the PagerDuty integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputPagerDuty"}),t.Object({type:t.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:t.Array(p({type:"email"}),{minItems:1,maxItems:20,description:"Email addresses that will receive the alert"}),renotifyConfig:lr},{$id:"RuleTargetInputEmail"}),t.Object({type:t.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Grafana IRM integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputGrafanaIrm"}),t.Object({type:t.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Microsoft Teams integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputMicrosoftTeams"}),t.Object({type:t.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the webhook integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputWebhook"}),t.Object({type:t.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the ServiceNow integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputServiceNow"}),t.Object({type:t.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Google Chat integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputGoogleChat"}),t.Object({type:t.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Squadcast integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputSquadcast"}),t.Object({type:t.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Jira integration to use"}),projectKey:p({allowEmpty:!1,description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:p({allowEmpty:!1,description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:t.Optional(p({allowEmpty:!1,description:"Jira status the alert ticket is moved to right after it is filed for a firing alert. A later transition between two firing states leaves the ticket status alone."})),closedStatus:t.Optional(p({allowEmpty:!1,description:"Jira status the alert ticket is moved to when the alert resolves. Only takes effect when the rule delivers recovery transitions."}))},{$id:"RuleTargetInputJira"})],{description:"Destination that should receive the notification. The `type` field discriminates the variant: `email` sends directly to the listed addresses and needs no integration; every other type routes through the integration identified by `integrationId`, which must already exist (create it first with the notification integration endpoints)."})}),Hl=b("type",[t.Object({type:t.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:t.Array(t.String(),{description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),t.Object({type:t.Literal("all-teams",{description:"Match alert transitions for every team in the organization. Public API callers need an API key with `all` scope to create or update this filter."})},{title:"AllTeams"}),t.Object({type:t.Literal("all-public-teams",{description:"Match alert transitions for all public teams. Public API callers need an API key with `all` or `owning-team-and-public` scope to create or update this filter."})},{title:"AllPublicTeams"})],{description:"Team visibility filter used when matching alert transitions. Tsuga validates create and update requests against the caller permissions."}),Kl=b("type",[t.Object({type:t.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:t.Array(p(),{minItems:1,maxItems:100,description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),t.Object({type:t.Literal("all-teams",{description:"Match alert transitions for every team in the organization. Public API callers need an API key with `all` scope to create or update this filter."})},{title:"AllTeams"}),t.Object({type:t.Literal("all-public-teams",{description:"Match alert transitions for all public teams. Public API callers need an API key with `all` or `owning-team-and-public` scope to create or update this filter."})},{title:"AllPublicTeams"})],{description:"Team visibility filter used when matching alert transitions. Tsuga validates create and update requests against the caller permissions."}),ri=t.Object({id:t.String({description:"Tsuga-generated notification rule ID assigned when the rule is created."}),name:t.String({description:"Display name of the notification rule."}),queryString:t.Optional(t.String({description:"Optional query that narrows which alert transitions trigger the rule. Matches on the monitor transition group key and the monitor tags, e.g. `env:prod service:api`. Omit or leave empty to match regardless of tags."})),teamsFilter:Hl,prioritiesFilter:t.Array(t.Enum(dt),{description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(zn),{description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:t.Array(t.String(),{description:"Cluster IDs that must match for this rule to fire. An empty array matches every cluster, as does a transition that has no cluster ID."}),owner:t.String({description:"Team ID that owns and manages the rule."}),createdAt:E({description:"Timestamp when Tsuga created the rule."}),updatedAt:E({description:"Timestamp when Tsuga last updated the rule."}),isActive:t.Boolean({description:"Whether the rule currently sends notifications when its filters match."}),tags:Me,targets:t.Array(ka,{description:"Destinations that receive a notification whenever this rule matches an alert transition. Every target in the list is notified independently, subject to its own rate limit and renotification settings."}),creator:t.Optional(ue),updater:t.Optional(ue)}),Ma=t.Object({name:p({description:"Display name of the notification rule."}),queryString:t.Optional(p({type:"tags-query",description:"Optional query that narrows which alert transitions trigger the rule. Matches on the monitor transition group key and the monitor tags, e.g. `env:prod service:api`. Omit or leave empty to match regardless of tags."})),teamsFilter:Kl,prioritiesFilter:t.Array(t.Enum(dt),{maxItems:dt.length,description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(zn),{maxItems:zn.length,description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Cluster IDs that must match for this rule to fire. Omit it, or leave it empty, to match every cluster."})),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:Ve,isActive:t.Boolean({description:"Set to true for the rule to send notifications when its filters match."}),targets:t.Array(ti,{minItems:1,description:"Destinations that receive a notification whenever this rule matches an alert transition. This list replaces the existing targets on update."})}),up=t.Object({id:t.String({description:"Unique identifier of the adaptive notification rule. Generated by Tsuga."}),name:t.String({description:"Display name of the adaptive notification rule."}),owner:t.String({description:"Team ID that owns and manages the rule."}),createdAt:E({description:"Timestamp when Tsuga created the rule."}),updatedAt:E({description:"Timestamp when Tsuga last updated the rule."}),isActive:t.Boolean({description:"Whether the rule currently sends notifications when one of its monitors fires."}),tags:Me,monitorIds:t.Array(t.String(),{description:"Monitors this rule reacts to."}),fallbackTarget:ka,creator:t.Optional(ue),updater:t.Optional(ue)}),LO=t.Object({name:p({description:"Display name of the adaptive notification rule."}),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:Ve,isActive:t.Boolean({description:"Set to true for the rule to send notifications when one of its monitors fires."}),monitorIds:t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:100,description:"Monitors this rule reacts to. Only trace monitors and metric monitors over OTel span metrics are eligible."}),fallbackTarget:ti}),GRe=m({tags:["notification-rules"],url:Yn,method:"GET",paginated:!0,query:t.Object(ye),response:t.Array(ri)}),$Re=m({tags:["notification-rules"],url:`${Yn}/:id`,params:t.Object({id:p()}),method:"GET",response:ri}),jRe=m({tags:["notification-rules"],url:Yn,method:"POST",body:Ma,response:ri}),qRe=m({tags:["notification-rules"],url:`${Yn}/:id`,method:"PUT",params:t.Object({id:p()}),body:Ma,response:ri}),BRe=m({tags:["notification-rules"],url:`${Yn}/:id`,method:"DELETE",params:t.Object({id:p()}),response:R}),Da=`${ei}/adaptive-rules`,FRe=m({tags:["notification-rules"],url:Da,method:"GET",paginated:!0,query:t.Object(ye),response:t.Array(up)}),HRe=m({tags:["notification-rules"],url:`${Da}/:id`,params:t.Object({id:p()}),method:"GET",response:up}),KRe=m({tags:["notification-rules"],url:Da,method:"POST",body:LO,response:up}),zRe=m({tags:["notification-rules"],url:`${Da}/:id`,method:"PUT",params:t.Object({id:p()}),body:LO,response:up}),YRe=m({tags:["notification-rules"],url:`${Da}/:id`,method:"DELETE",params:t.Object({id:p()}),response:R}),VRe=m({tags:["notification-integrations"],url:`${NO}/start`,method:"POST",response:t.Object({redirectUrl:t.String()})}),gj=["google-chat","grafana-irm","incident-io","jira","microsoft-teams","pagerduty","servicenow","slack","squadcast","webhook"],yj=t.Object({id:t.String(),name:t.String(),type:t.Enum(gj),createdAt:E(),ruleCount:t.Number(),creator:t.Optional(ue)}),QRe=m({tags:["notification-integrations"],url:`${Yn}/integrations`,method:"GET",paginated:!0,query:t.Object(ye),response:t.Array(yj)}),WRe=m({tags:["notification-integrations"],url:`${NO}/callback`,method:"GET",query:t.Object({code:p()}),response:t.Object({success:t.Boolean()})}),zl=["POST","PUT"],hj=t.Record(t.String(),t.String()),Tj=t.Record(t.String(),t.Unknown()),Ej=t.Record(t.String(),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))])),_j=b("type",[t.Object({type:t.Literal("json"),value:Tj}),t.Object({type:t.Literal("form"),value:Ej})]),Ij=t.Object({ok:t.String(),alert:t.String()}),Yl=t.Object({id:t.String(),name:t.String(),setting:b("type",[t.Object({type:t.Literal("incident-io"),alertSourceConfigId:t.String(),tokenLastChars:t.String()}),t.Object({type:t.Literal("grafana-irm"),urlLastChars:t.String()}),t.Object({type:t.Literal("pagerduty"),integrationKeyLastChars:t.String()}),t.Object({type:t.Literal("microsoft-teams"),webhookUrlLastChars:t.String()}),t.Object({type:t.Literal("webhook"),urlLastChars:t.String(),method:t.Enum(zl),authentication:b("type",[t.Object({type:t.Literal("bearer"),tokenLastChars:t.String()}),t.Object({type:t.Literal("basic"),username:t.String(),passwordLastChars:t.String()}),t.Object({type:t.Literal("custom-header"),key:t.String(),valueLastChars:t.String()}),t.Object({type:t.Literal("none")})]),customHeaders:t.Optional(hj),payloadTemplate:_j,eventNameMapping:t.Optional(Ij)}),t.Object({type:t.Literal("servicenow"),instanceName:t.String(),username:t.String(),passwordLastChars:t.String()}),t.Object({type:t.Literal("google-chat"),webhookUrlLastChars:t.String()}),t.Object({type:t.Literal("squadcast"),webhookUrlLastChars:t.String()}),t.Object({type:t.Literal("jira"),siteUrl:t.String(),email:t.String(),apiTokenLastChars:t.String()})]),tags:Me}),bj=t.Object({type:t.Literal("webhook"),url:p({type:"uri"}),method:t.Enum(zl),authentication:b("type",[t.Object({type:t.Literal("bearer"),token:p({allowEmpty:!1})}),t.Object({type:t.Literal("basic"),username:p({allowEmpty:!1}),password:p({allowEmpty:!1})}),t.Object({type:t.Literal("custom-header"),key:p({allowEmpty:!1}),value:p({allowEmpty:!1})}),t.Object({type:t.Literal("none")})]),customHeaders:t.Record(p({allowEmpty:!1}),p()),payloadTemplate:b("type",[t.Object({type:t.Literal("json"),value:t.Record(p({allowEmpty:!1}),t.Unknown())}),t.Object({type:t.Literal("form"),value:t.Record(p({allowEmpty:!1}),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))]))})]),eventNameMapping:t.Optional(t.Object({ok:p({allowEmpty:!1}),alert:p({allowEmpty:!1})}))}),vO=t.Object({type:t.Literal("incident-io"),alertSourceConfigId:p(),token:p()}),kO=t.Object({type:t.Literal("grafana-irm"),url:p({type:"uri"})}),MO=t.Object({type:t.Literal("pagerduty"),integrationKey:p()}),DO=t.Object({type:t.Literal("microsoft-teams"),webhookUrl:p({type:"uri"})}),Sj=t.Object({type:t.Literal("servicenow"),instanceName:p({allowEmpty:!1,description:'Instance name of the ServiceNow instance. This corresponds to the subdomain part of the instance URL, like "my-instance" in "my-instance.service-now.com"'}),username:p({allowEmpty:!1}),password:p({allowEmpty:!1})}),Oj=t.Object({type:t.Literal("google-chat"),webhookUrl:p({type:"uri"})}),Aj=t.Object({type:t.Literal("squadcast"),webhookUrl:p({type:"uri"})}),xj=t.Object({type:t.Literal("jira"),siteUrl:p({type:"uri",allowEmpty:!1,description:'Base URL of the Jira Cloud site, like "https://your-company.atlassian.net". Tsuga files issues against this site.'}),email:p({type:"email",allowEmpty:!1,description:"Atlassian account email used together with the API token for Basic authentication."}),apiToken:p({allowEmpty:!1,description:"Atlassian API token minted for the account, used as the Basic auth password."})}),Rj=t.Object({name:p(),setting:b("type",[vO,kO,MO,DO,bj,Sj,Oj,Aj,xj]),tags:Ve}),Cj=t.Object({type:t.Literal("webhook"),url:t.Optional(p({type:"uri"})),method:t.Optional(t.Enum(zl)),authentication:t.Optional(b("type",[t.Object({type:t.Literal("bearer"),token:t.Optional(p({allowEmpty:!1}))}),t.Object({type:t.Literal("basic"),username:t.Optional(p({allowEmpty:!1})),password:t.Optional(p({allowEmpty:!1}))}),t.Object({type:t.Literal("custom-header"),key:t.Optional(p({allowEmpty:!1})),value:t.Optional(p({allowEmpty:!1}))}),t.Object({type:t.Literal("none")})])),customHeaders:t.Optional(t.Record(p({allowEmpty:!1}),p())),payloadTemplate:t.Optional(b("type",[t.Object({type:t.Literal("json"),value:t.Record(p({allowEmpty:!1}),t.Unknown())}),t.Object({type:t.Literal("form"),value:t.Record(p({allowEmpty:!1}),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))]))})])),eventNameMapping:t.Optional(t.Object({ok:t.Optional(p({allowEmpty:!1})),alert:t.Optional(p({allowEmpty:!1}))}))}),Pj=t.Object({type:t.Literal("servicenow"),instanceName:t.Optional(p({allowEmpty:!1})),username:t.Optional(p({allowEmpty:!1})),password:t.Optional(p({allowEmpty:!1}))}),Uj=t.Object({type:t.Literal("jira"),siteUrl:t.Optional(p({type:"uri",allowEmpty:!1})),email:t.Optional(p({allowEmpty:!1})),apiToken:t.Optional(p({allowEmpty:!1}))}),wj=t.Object({type:t.Literal("google-chat"),webhookUrl:p({type:"uri"})}),Nj=t.Object({type:t.Literal("squadcast"),webhookUrl:p({type:"uri"})}),Lj=t.Object({name:t.Optional(p()),setting:t.Optional(b("type",[vO,kO,MO,DO,Cj,Pj,wj,Nj,Uj]))}),ZRe=m({tags:["notification-integrations"],url:va,method:"POST",body:Rj,response:Yl}),XRe=m({tags:["notification-integrations"],url:`${va}/:id`,method:"GET",params:t.Object({id:p()}),response:Yl}),JRe=m({tags:["notification-integrations"],url:`${va}/:id`,method:"PUT",params:t.Object({id:p()}),body:Lj,response:Yl}),eCe=m({tags:["notification-integrations"],url:`${va}/:id`,method:"DELETE",params:t.Object({id:p()}),response:R}),vj=b("status",[t.Object({status:t.Literal("ok",{description:"Tsuga reached Jira and listed the projects the credentials can file into."}),projects:t.Array(t.Object({key:t.String({description:'Jira project key, like "OPS".'}),name:t.String({description:"Human readable Jira project name."}),issueTypes:t.Array(t.String(),{description:"Issue type names available when creating an issue in this project."}),statuses:t.Optional(t.Array(t.String(),{description:"Status names an issue in this project can be transitioned to. Omitted when Jira refused the status lookup for this project."}))}),{description:"Projects the connected Jira account can file issues into."})},{title:"JiraMetadataOk"}),t.Object({status:t.Literal("error",{description:"Tsuga could not load Jira metadata with the stored credentials."}),message:t.String({description:"Human readable reason the Jira metadata could not be loaded."})},{title:"JiraMetadataError"})],{description:"Result of probing Jira for the projects, issue types and statuses reachable with a stored integration. Returns a typed error instead of failing so the rule editor can fall back to free-text entry."}),tCe=m({tags:["notification-integrations"],url:`${va}/:id/jira-metadata`,method:"GET",params:t.Object({id:p()}),response:vj}),rCe=m({tags:["notification-rules"],url:`${ft}/:id/notifications`,method:"GET",params:t.Object({id:p()}),query:t.Optional(t.Object({from:t.Optional(t.Number()),to:t.Optional(t.Number())})),response:t.Object({notifications:t.Array(t.Object({id:t.String(),monitorId:t.String(),monitorResultId:t.String(),ruleId:t.Optional(t.String()),targetId:t.Optional(t.String()),status:t.Enum(mj),tryCount:t.Number(),nextTryAt:E(),createdAt:E(),updatedAt:E(),sentAt:t.Optional(E())})),isTruncated:t.Boolean()})}),kj=["slack","incident-io","pagerduty","email","grafana-irm","microsoft-teams","webhook","servicenow","google-chat","squadcast","jira"],nCe=m({tags:["notification-rules"],url:`${Yn}/test`,method:"POST",body:t.Object({notificationRule:Ma,targetIds:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Target IDs to test specific targets",minItems:1,maxItems:10}))}),response:t.Union([t.Object({success:t.Literal(!1),overallMessage:t.String({description:"Message when there is an overall error"})}),t.Object({success:t.Boolean(),results:t.Array(t.Object({targetId:t.String({description:"The ID of the target that was tested"}),targetType:t.Enum(kj,{description:"The type of the target (e.g., slack, webhook)"}),status:t.Enum(["success","failure"],{description:"Whether the test notification was sent successfully"}),message:t.Optional(t.String({description:"Message if the notification failed for this specific target"}))}))})])});var Lt="/v0/service-catalog";var Mj=t.Object({team:t.String({description:"Team name observed on telemetry for this service."}),lastSeenAt:E({description:"Most recent time this team was observed for the service."})},{description:"A team name observed on telemetry for this service, with the last time it was seen."}),Dj=t.Object({ingestionApiKey:t.String({description:"Ingestion API key name or identifier observed on telemetry for this service."}),lastSeenAt:E({description:"Most recent time this ingestion key was observed for the service."})},{description:"An ingestion API key observed on telemetry for this service, with the last time it was seen."}),Gj=t.Object({version:t.String({description:"Service version value observed in telemetry."}),firstSeenAt:E({description:"First time this version was observed for the service."}),lastSeenAt:E({description:"Most recent time this version was observed for the service."}),faulty:t.Optional(t.Boolean({description:"Whether Tsuga detected this version as associated with faulty behavior."})),faultyLatency:t.Optional(t.Boolean({description:"Whether the faulty behavior Tsuga detected for this version is a latency degradation. Only set by faulty deployment detection when it reports on latency; absent when the detection did not evaluate latency."})),detectionTriggered:t.Optional(t.Boolean({description:"Whether faulty deployment detection has already been triggered for this version. Set when the detection job is launched to avoid re-triggering it. Absent on versions predating this field."}))},{description:"A service version observed in telemetry, with first and last seen timestamps and faulty deployment detection results."}),$j=t.Object({language:t.String({description:"Programming language observed for this service."}),lastSeenAt:E({description:"Most recent time this language was observed."})},{description:"A programming language observed for this service, with the last time it was seen."}),jj=t.Object({runtime:t.String({description:"Runtime observed for this service."}),lastSeenAt:E({description:"Most recent time this runtime was observed."})},{description:"A runtime observed for this service, with the last time it was seen."}),GO=t.Object({protocol:t.String({description:"Observed API protocol (e.g. 'http', 'grpc', 'graphql')"}),lastSeenAt:E({description:"Most recent observation timestamp"})},{description:"An API protocol observed for this service, with the last time it was seen."}),qj=t.Object({framework:t.String({description:"Observed application framework (e.g. 'express', 'fastify', 'django', 'rails')"}),lastSeenAt:E({description:"Most recent observation timestamp"})},{description:"An application framework detected from OpenTelemetry instrumentation scope, with the last time it was seen."}),Bj=t.Object({platform:t.String({description:"Observed cloud or orchestration platform (e.g. 'aws_eks', 'kubernetes')"}),lastSeenAt:E({description:"Most recent observation timestamp"})},{description:"A cloud or orchestration platform this service runs on, with the last time it was seen."}),Fj=t.Object({provider:t.String({description:"Observed cloud provider (e.g. 'aws', 'gcp', 'azure')"}),lastSeenAt:E({description:"Most recent observation timestamp"})},{description:"A cloud provider this service runs on, with the last time it was seen."}),Ga=t.Object({id:t.String({description:"Unique identifier of this service. Use it with service detail and graph endpoints."}),serviceName:t.String({description:"OpenTelemetry service name observed in telemetry."}),serviceNamespace:t.Optional(t.String({description:"OpenTelemetry service namespace observed in telemetry."})),env:t.Optional(t.String({description:"Environment value observed for this service."})),teams:t.Array(Mj,{description:"Team names observed on telemetry for this service and when each was last seen."}),ingestionApiKeys:t.Array(Dj,{description:"Ingestion API keys observed on telemetry for this service and when each was last seen."}),versions:t.Array(Gj,{description:"Service version values observed in telemetry, including first and last seen timestamps."}),languages:t.Array($j,{description:"Programming languages observed for this service."}),runtimes:t.Array(jj,{description:"Runtime values observed for this service."}),serverProtocols:t.Array(GO,{description:"API protocols this service exposes (from server-kind spans)"}),clientProtocols:t.Array(GO,{description:"API protocols this service calls out over (from client-kind spans)"}),frameworks:t.Array(qj,{description:"Application frameworks detected from OTel instrumentation scope"}),cloudPlatforms:t.Array(Bj,{description:"Cloud platforms this service is running on"}),cloudProviders:t.Array(Fj,{description:"Cloud providers this service is running on"}),lastSeenAt:E({description:"Most recent time Tsuga observed telemetry for this service."}),firstSeenAt:E({description:"First time Tsuga observed telemetry for this service."}),sources:t.Array(t.String(),{description:"Telemetry sources that contributed evidence for this service entry."}),additionalUserFields:t.Optional(t.Unsafe({type:"object",additionalProperties:!0,description:"Additional user-defined service metadata, when configured."})),logsCount24h:t.Number({description:"Number of logs observed for this service in the last 24 hours."}),errorLogsCount24h:t.Number({description:"Number of error logs observed for this service in the last 24 hours."}),tracesCount24h:t.Number({description:"Number of traces observed for this service in the last 24 hours."}),errorTracesCount24h:t.Number({description:"Number of error traces observed for this service in the last 24 hours."}),createdAt:E({description:"Timestamp when Tsuga created this service catalog entry."}),updatedAt:E({description:"Timestamp when Tsuga last updated this service catalog entry."})}),fCe=m({tags:["service-catalog"],query:t.Object({...ye,clusterId:t.Optional(p())}),method:"GET",paginated:!0,url:`${Lt}/services`,response:t.Array(Ga)}),Hj=t.Object({spanKind:t.Enum(eO),count:t.Number()}),$O=t.Object({...Ga.properties,spanKindCounts:t.Array(Hj),envs:t.Object({primaryEnv:t.String(),allEnvs:t.Array(t.String())})}),gCe=m({tags:["service-catalog"],query:t.Object({...ye,clusterId:t.Optional(p()),env:t.Optional(p())}),method:"GET",paginated:!0,url:`${Lt}/v2/services`,response:t.Array($O)}),yCe=m({tags:["service-catalog"],query:t.Object({serviceName:p({allowEmpty:!1}),serviceNamespace:t.Optional(p({allowEmpty:!1})),env:p({allowEmpty:!1}),clusterId:t.Optional(p())}),method:"GET",url:`${Lt}/v2/service`,response:$O}),hCe=m({tags:["service-catalog"],method:"GET",url:`${Lt}/services/:serviceId`,params:t.Object({serviceId:p()}),response:Ga}),Vl=t.Object({id:t.String({description:"Tsuga-generated identifier of this service target, unique across all services. Used with delivery state such as rate limiting and re-notification."}),serviceId:t.String({description:"Identifier of the service catalog entry this target is attached to."}),config:ka.properties.config,rateLimit:ka.properties.rateLimit,createdAt:E({description:"Timestamp when user created this service target."}),updatedAt:E({description:"Timestamp when user last updated this service target."})}),Kj=t.Object({config:ti.properties.config,rateLimit:ti.properties.rateLimit}),zj=t.Object({config:ti.properties.config,rateLimit:t.Union([Fl,t.Null()])}),TCe=m({tags:["service-catalog"],method:"GET",url:`${Lt}/services/:serviceId/targets`,params:t.Object({serviceId:p()}),response:t.Array(Vl)}),ECe=m({tags:["service-catalog"],method:"POST",url:`${Lt}/services/:serviceId/targets`,params:t.Object({serviceId:p()}),body:Kj,response:Vl}),_Ce=m({tags:["service-catalog"],method:"PUT",url:`${Lt}/services/:serviceId/targets/:targetId`,params:t.Object({serviceId:p(),targetId:p()}),body:zj,response:Vl}),ICe=m({tags:["service-catalog"],method:"DELETE",url:`${Lt}/services/:serviceId/targets/:targetId`,params:t.Object({serviceId:p(),targetId:p()}),response:R}),Yj=["otel_kube","otel_host_kube","otel_host","prometheus","aws_ec2","gcp_compute_engine"];var jO=t.Object({id:t.String(),hostName:t.String(),env:t.Optional(t.String()),cpuUtilizationAverage:t.Number(),hostType:t.Enum(Yj),teams:t.Array(t.String()),tags:t.Array(t.String()),firstSeenAt:E(),lastSeenAt:E(),clusterId:t.String()}),bCe=m({tags:["service-catalog"],method:"GET",url:`${Lt}/hosts`,response:t.Array(jO)}),SCe=m({tags:["service-catalog"],method:"GET",url:`${Lt}/hosts/:hostId`,params:t.Object({hostId:p()}),response:jO}),Vj=["http","rpc","messaging","genai","object_store"],qO={name:t.String({description:"Service or inferred dependency name shown in the graph."}),env:t.Optional(t.String({description:"Environment observed from spans."}))},Ql=t.Object({...qO,nodeType:t.Literal("observed",{description:"Discriminator for this node variant. Always `observed` for a graph node matched to a service catalog entry by name and env."}),id:t.Union([t.String(),t.Null()],{description:"Service ID, or null when multiple namespaces match the observed service name."}),namespace:t.Union([t.String(),t.Null()],{description:"Service namespace, or null when multiple namespaces match the observed service name."}),errorRate:t.Optional(t.Number({description:"Ratio of entry requests with at least one error to total entry requests observed on this service. Omitted when no entry requests were observed."})),entryErrorRequestCount:t.Number({description:"Number of entry requests on this service where at least one entry span had error status."}),entryRequestCount:t.Number({description:"Number of entry requests observed on this service, counted as unique trace IDs that have at least one entry span on this service. An entry span is a consumer-kind span, a root span (no parent), or any span whose parent belongs to a different service."})}),BO={...qO,endpoint:t.Optional(t.String({description:"Inferred service endpoint address"})),resourceName:t.Optional(t.String({description:"Inferred resource name, e.g. table or queue name"}))},Wl=t.Object({...BO,nodeType:t.Literal("inferred_db",{description:"Discriminator for this node variant. Always `inferred_db` for a database dependency detected from client-span attributes that could not be matched to a service catalog entry."}),serviceType:t.Literal("db",{description:"Inferred dependency type. Always `db` for this node variant."}),databaseName:t.Optional(t.String({description:"Database name from span_attributes db.namespace (falling back to legacy db.name). Matches the database catalog `name`."})),databaseSystem:t.String({description:"Database system from span_attributes db.system.name (falling back to legacy db.system). Matches the database catalog `databaseSystem`."})}),Zl=t.Object({...BO,nodeType:t.Literal("inferred",{description:"Discriminator for this node variant. Always `inferred` for a non-database dependency detected from client-span attributes (e.g. a queue or external HTTP call) that could not be matched to a service catalog entry. Database dependencies use the `inferred_db` variant."}),serviceType:t.Enum(Vj,{description:"Inferred dependency type from span metadata: http, rpc, messaging, genai, or object_store."})}),Qj=b("nodeType",[Ql,Wl,Zl]),Xl=t.Object({from:t.Object({env:t.Optional(t.String({description:"Environment of the source node"})),name:t.String({description:"Name of the source node"})},{description:"Reference to the caller node, i.e. the service or dependency that issued the request."}),to:t.Object({env:t.Optional(t.String({description:"Environment of the target node"})),name:t.String({description:"Name of the target node"}),databaseSystem:t.Optional(t.String({description:"Database system of the target when it is an inferred database node (`inferred_db`). Together with `name` and `env` it identifies the target node, distinguishing a database from a same-named service or a same-named database on another system."}))},{description:"Reference to the callee node, i.e. the service or dependency that received the request."}),count:t.Number({description:"Number of cross-service transitions observed on this directed edge in the graph query window."}),errorRate:t.Optional(t.Number({description:"Ratio of errored client spans to total client spans observed on this edge. Omitted when no client spans were observed. For edges to inferred services, the originating span is treated as the client span regardless of its kind."})),errorCount:t.Number({description:"Number of client spans with error status observed on this edge"}),clientSpanCount:t.Number({description:"Number of client spans observed on this edge"})},{description:"Directed dependency edge from a caller node (`from`) to a callee node (`to`) in the service graph, with call-volume and error counts observed over the query window."}),OCe=m({tags:["service-catalog"],url:`${Lt}/services/:serviceId/graph`,method:"GET",params:t.Object({serviceId:p()}),query:t.Object({...Ye.properties,query:t.Optional(p({type:"tsuga-query"}))}),response:t.Object({clusterId:t.String(),nodes:t.Array(Qj),edges:t.Array(Xl)})}),Wj=t.Object({monitors:t.Array(t.Object({id:t.String({description:"Identifier of the monitor"}),name:t.String({description:"Display name of the monitor"}),owner:t.String({description:"Team ID that owns the monitor"}),priority:t.Enum(dt,{description:"Priority of the monitor"})})),slos:t.Array(t.Object({id:t.String({description:"Identifier of the SLO"}),name:t.String({description:"Display name of the SLO"}),owner:t.String({description:"Team ID that owns the SLO"}),statusCount:t.Partial(t.Record(cp,t.Number()),{description:"Count of SLO statuses for this service: one entry per group matching the service when the SLO groups by service.name, otherwise the overall status"})}))}),ACe=m({tags:["service-catalog"],method:"GET",url:`${Lt}/services/:serviceId/related-resources`,params:t.Object({serviceId:p()}),response:Wj}),xCe=m({tags:["service-catalog"],method:"GET",url:`${Lt}/services/by-api-keys`,response:t.Record(t.String(),t.Array(t.Object({serviceName:t.String(),serviceNamespace:t.Optional(t.String())})))});var Jl=`/${"v1"}/services`,em=t.Pick(Ga,["id","serviceName","serviceNamespace","env","teams","versions","languages","runtimes","serverProtocols","clientProtocols","frameworks","cloudPlatforms","cloudProviders","lastSeenAt","firstSeenAt","sources","logsCount24h","errorLogsCount24h","tracesCount24h","errorTracesCount24h"],{$id:"Service",description:"Service inferred from telemetry, with observed metadata, activity counts, and version signals. See [Services](/documentation/categorize/services/index)."}),Zj={id:"123-456-abc",serviceName:"api-gateway",serviceNamespace:"platform",env:"production",teams:[{team:"platform",lastSeenAt:"2024-01-15T12:34:56.000Z"}],versions:[{version:"1.2.3",firstSeenAt:"2024-01-01T08:00:00.000Z",lastSeenAt:"2024-01-15T12:34:56.000Z",faulty:!0,faultyLatency:!0}],languages:[{language:"go",lastSeenAt:"2024-01-15T12:34:56.000Z"}],runtimes:[{runtime:"go",lastSeenAt:"2024-01-15T12:34:56.000Z"}],serverProtocols:[{protocol:"http",lastSeenAt:"2024-01-15T12:34:56.000Z"}],clientProtocols:[{protocol:"grpc",lastSeenAt:"2024-01-15T12:34:56.000Z"}],frameworks:[{framework:"gin",lastSeenAt:"2024-01-15T12:34:56.000Z"}],cloudPlatforms:[{platform:"aws_eks",lastSeenAt:"2024-01-15T12:34:56.000Z"},{platform:"kubernetes",lastSeenAt:"2024-01-15T12:34:56.000Z"}],cloudProviders:[{provider:"aws",lastSeenAt:"2024-01-15T12:34:56.000Z"}],lastSeenAt:"2024-01-15T12:34:56.000Z",firstSeenAt:"2024-01-01T08:00:00.000Z",sources:["logs","metrics","traces"],logsCount24h:12e3,errorLogsCount24h:42,tracesCount24h:8500,errorTracesCount24h:17};Object.assign(em,{examples:[Zj]});var FO=m({description:"Lists services inferred from telemetry. Use this endpoint to inventory service ownership, environments, versions, runtimes, and recent activity. Pagination fields limit the returned page.",operationId:"listServices",tags:["services"],url:Jl,method:"GET",paginated:!0,query:t.Object({...ze,clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Omit to use the first cluster in the organization; this does not query all clusters."}))},{description:"Service list query. Use pagination and optional cluster scope."}),response:t.Array(em)}),HO=m({description:"Retrieves one telemetry-inferred service by service ID.",operationId:"getService",tags:["services"],url:`${Jl}/:serviceId`,method:"GET",params:t.Object({serviceId:p({allowEmpty:!1,description:"Identifier of the service to retrieve. Use the `id` returned by service list responses."})}),response:em}),Xj=t.Pick(Ql,["name","env","nodeType","id","namespace","errorRate","entryErrorRequestCount","entryRequestCount"],{$id:"ObservedServiceGraphNode",description:"Service graph node matched to a service catalog entry by name and env. `id`/`namespace` are null when multiple namespaces share the observed service name."}),Jj=t.Pick(Zl,["name","env","nodeType","serviceType","endpoint","resourceName"],{$id:"InferredServiceGraphNode",description:"Dependency node detected from client-span attributes (e.g. a queue or external HTTP call) that could not be matched to a service catalog entry. Database dependencies use the `inferred_db` variant."}),eq=t.Pick(Wl,["name","env","nodeType","serviceType","endpoint","resourceName"],{$id:"InferredDbServiceGraphNode",description:"Database dependency node detected from client-span attributes that could not be matched to a service catalog entry."}),tq=b("nodeType",[Xj,eq,Jj]),rq=t.Pick(Xl,["from","to","count","errorRate","errorCount","clientSpanCount"],{$id:"ServiceGraphEdge",description:"Directed dependency edge from a caller node (`from`) to a callee node (`to`), with call-volume and error counts observed over the query window."}),nq=t.Optional(t.Integer({...Ye.properties.from,description:"Start of the service graph query window as a Unix timestamp in seconds. Provide both `from` and `to` for a deterministic graph window; otherwise Tsuga uses backend graph defaults."})),oq=t.Optional(t.Integer({...Ye.properties.to,description:"End of the service graph query window as a Unix timestamp in seconds. Provide both `from` and `to` for a deterministic graph window; otherwise Tsuga uses backend graph defaults."})),iq=p({type:"tsuga-query",default:"*",description:"Tsuga query used to filter spans considered for the graph. Defaults to `*`, which applies no additional filter beyond the service identity."}),KO=m({description:"Retrieves a dependency graph for one service over an optional time range and query filter. Provide an explicit time range for deterministic results. Use this to inspect observed downstream and upstream service relationships. See [Service page](/documentation/categorize/services/service-page).",operationId:"getServiceGraph",tags:["services"],url:`${Jl}/:serviceId/graph`,method:"GET",params:t.Object({serviceId:p({allowEmpty:!1,description:"Identifier of the service to use as the graph root. Use the `id` returned by service list or get responses."})}),query:t.Object({from:nq,to:oq,query:t.Optional(iq)},{description:"Service graph query. Use time range and optional span query filters."}),response:t.Object({clusterId:t.String({description:"Cluster ID the graph was built from"}),nodes:t.Array(tq,{description:"Observed and inferred nodes included in the service dependency graph."}),edges:t.Array(rq,{description:"Directed dependency edges between graph nodes."})})});var xe=" (unix seconds, ISO 8601, or relative like -1h/-30m/now)";function zO(e,r){let n=r??Ir(e);return n===void 0?void 0:Vs(n)}function tm(e){let r=Ir(e);return r===void 0?"":` (default: ${r})`}function YO(e,r){e.command("service-graph").description("Inspect service dependency graphs").command("get <SERVICE_ID>").description("Retrieve the dependency graph for a service").option("--from <TIMESTAMP>",`Start of time range${xe}${tm("from")}`).option("--to <TIMESTAMP>",`End of time range${xe}${tm("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter graph spans${tm("query")}`).action(async(o,i)=>{let a={},c=zO("from",i.from),l=zO("to",i.to);c!==void 0&&(a.from=c),l!==void 0&&(a.to=l),i.query!==void 0&&(a.query=i.query);let d=await r()(KO,{params:{serviceId:o},query:a});Q(d)})}var aq=`/${"v1"}/grok`,sq=25,cq=100,VO=t.Object({rules:t.Array(p({allowEmpty:!1,type:"long",description:"Grok parsing rule to preview against each sample. The rule uses the same Grok syntax as the log route **Grok parser** processor, for example `pod:%{DATA:namespace}/%{DATA:name}`."}),{minItems:1,maxItems:sq,description:"Ordered Grok parsing rules to preview. For each sample, Tsuga tries the rules in order and returns the first successful match, matching route Grok processor semantics."}),samples:t.Array(p({allowEmpty:!1,type:"long",description:"Raw log line to parse with the provided Grok rules. The value is parsed as preview input only; this endpoint does not ingest or store the sample."}),{minItems:1,maxItems:cq,description:"Sample log lines to run against the rules. Results are returned in the same order as this array."})},{description:"Grok rules and sample log lines to preview extraction before saving a route processor. The endpoint uses the same parser as the route builder preview and does not create or update routes."}),pq={rules:['pod:%{DATA:pod_namespace}/%{DATA:pod_name}\\] "%{DATA:request}" HTTP/%{POSINT:status}'],samples:['[conn-id:abc pod:tsuga-events/tsuga-events-searcher-0] "/token" HTTP/200']};Object.assign(VO,{examples:[pq]});var QO=t.Object({results:t.Array(t.Object({sample:t.String({description:"Echo of the submitted log line, so results can be matched to the samples in the request."}),matched:t.Boolean({description:"Whether any submitted rule matched this sample. `true` means `extracted` contains the captured fields; `false` means no rule matched."}),extracted:t.Union([t.Record(t.String(),t.Unknown()),t.Null()],{description:"Fields extracted from the first matching Grok rule when `matched` is `true`; dotted capture names are expanded into nested objects. `null` when no rule matched."})}),{description:"Preview result for each submitted sample, in the same order as the request `samples` array."})},{description:"Grok extraction preview results from applying the ordered rules to each submitted sample."}),uq={results:[{sample:'[conn-id:abc pod:tsuga-events/tsuga-events-searcher-0] "/token" HTTP/200',matched:!0,extracted:{pod_namespace:"tsuga-events",pod_name:"tsuga-events-searcher-0",request:"/token",status:"200"}}]};Object.assign(QO,{examples:[uq]});var WO=m({url:`${aq}/parse`,method:"POST",operationId:"parseGrok",tags:["public","grok"],body:VO,response:QO,description:"Parses sample log lines with Grok rules and returns extracted fields, using the same Grok engine as the log route processor. Use this endpoint to author and test route Grok rules before saving them. The operation requires public API read access to log routes. A rule that fails to compile returns a 400 response with error code `GROK_RULE_VALIDATION_ERROR` and structured details in `error.details.ruleErrors`."});var ZO=Sn(require("node:fs"));function ni(e){if(e.file){let r=ZO.default.readFileSync(e.file==="-"?0:e.file,"utf-8");return JSON.parse(r)}if(e.data)return JSON.parse(e.data);throw new Error("Provide a request body with -f <FILE_PATH> or -d <JSON>. Use --generate-skeleton to get a template.")}function lq(e){return s.IsObject(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"errors")&&s.IsFunction(e.check)&&s.IsFunction(e.errors)}function rm(e){return s.HasPropertyKey(e,"~guard")&&lq(e["~guard"])}function nm(e){return s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,r=>s.IsObject(r)&&s.HasPropertyKey(r,"refine")&&s.HasPropertyKey(r,"message")&&s.IsFunction(r.refine)&&s.IsString(r.message))}function Cr(e){return s.IsObject(e)&&!s.IsArray(e)}function lp(e){return s.IsBoolean(e)}function j(e){return Cr(e)||lp(e)}function om(e){return s.HasPropertyKey(e,"additionalItems")&&j(e.additionalItems)}function Pr(e){return s.HasPropertyKey(e,"additionalProperties")&&j(e.additionalProperties)}function im(e){return s.HasPropertyKey(e,"allOf")&&s.IsArray(e.allOf)&&e.allOf.every(r=>j(r))}function $a(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function am(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(r=>j(r))}function sm(e){return s.HasPropertyKey(e,"const")}function Vn(e){return s.HasPropertyKey(e,"contains")&&j(e.contains)}function vt(e){return s.HasPropertyKey(e,"default")}function cm(e){return s.HasPropertyKey(e,"dependencies")&&s.IsObject(e.dependencies)&&Object.values(e.dependencies).every(r=>j(r)||s.IsArray(r)&&r.every(n=>s.IsString(n)))}function pm(e){return s.HasPropertyKey(e,"dependentRequired")&&s.IsObject(e.dependentRequired)&&Object.values(e.dependentRequired).every(r=>s.IsArray(r)&&r.every(n=>s.IsString(n)))}function um(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(r=>j(r))}function lm(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function mm(e){return s.HasPropertyKey(e,"else")&&j(e.else)}function dm(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function fm(e){return s.HasPropertyKey(e,"exclusiveMaximum")&&(s.IsNumber(e.exclusiveMaximum)||s.IsBigInt(e.exclusiveMaximum))}function Ur(e){return s.HasPropertyKey(e,"exclusiveMinimum")&&(s.IsNumber(e.exclusiveMinimum)||s.IsBigInt(e.exclusiveMinimum))}function ja(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function Qn(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function gm(e){return s.HasPropertyKey(e,"if")&&j(e.if)}function oi(e){return s.HasPropertyKey(e,"items")&&(j(e.items)||s.IsArray(e.items)&&e.items.every(r=>j(r)))}function ym(e){return oi(e)&&s.IsArray(e.items)}function hm(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function Tm(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function mp(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function Em(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function _m(e){return s.HasPropertyKey(e,"maxProperties")&&s.IsNumber(e.maxProperties)}function wr(e){return s.HasPropertyKey(e,"minimum")&&(s.IsNumber(e.minimum)||s.IsBigInt(e.minimum))}function Wn(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function ii(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function qa(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function Ba(e){return s.HasPropertyKey(e,"minProperties")&&s.IsNumber(e.minProperties)}function Im(e){return s.HasPropertyKey(e,"multipleOf")&&(s.IsNumber(e.multipleOf)||s.IsBigInt(e.multipleOf))}function bm(e){return s.HasPropertyKey(e,"not")&&j(e.not)}function Sm(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(r=>j(r))}function Fa(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function Ha(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(r=>j(r))}function ai(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(r=>j(r))}function Ka(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(r=>j(r))}function Om(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||j(e.propertyNames))}function mq(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function dp(e){return mq(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function Am(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function xm(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function Zn(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(r=>s.IsString(r))}function Rm(e){return s.HasPropertyKey(e,"then")&&j(e.then)}function Cm(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(r=>s.IsString(r)))}function si(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function fp(e){return s.HasPropertyKey(e,"unevaluatedItems")&&j(e.unevaluatedItems)}function gp(e){return s.HasPropertyKey(e,"unevaluatedProperties")&&j(e.unevaluatedProperties)}var yt=class{constructor(){this.indices=new Set,this.keys=new Set}AddIndex(r){return this.indices.add(r),!0}AddKey(r){return this.keys.add(r),!0}GetIndices(){return this.indices}GetKeys(){return this.keys}Merge(r){for(let n of r)n.indices.forEach(o=>this.indices.add(o)),n.keys.forEach(o=>this.keys.add(o));return!0}},za=class extends yt{constructor(r){super(),this.callback=r}AddError(r){return this.callback(r),!1}},Qe=class extends za{constructor(){super(r=>this.errors.push(r)),this.errors=[]}AddError(r){return this.errors.push(r),!1}GetErrors(){return this.errors}};var dq="external_",fq=0,hNe={identifier:`${dq}${fq}`,variables:[]};function XO(e,r,n,o){return n["~guard"].check(o)}function JO(e,r,n,o,i,a){return i["~guard"].check(a)||r.AddError({keyword:"~guard",schemaPath:n,instancePath:o,params:{errors:i["~guard"].errors(a)}})}function eA(e,r,n,o){return s.Every(n["~refine"],0,(i,a)=>i.refine(o))}function tA(e,r,n,o,i,a){return s.EveryAll(i["~refine"],0,(c,l)=>c.refine(a)||r.AddError({keyword:"~refine",schemaPath:n,instancePath:o,params:{index:l,message:c.message}}))}function rA(e){return oi(e)&&s.IsArray(e.items)}function nA(e,r,n,o){return rA(n)?o.every((a,c)=>s.IsLessThan(c,n.items.length)||G(e,r,n.additionalItems,a)&&r.AddIndex(c)):!0}function oA(e,r,n,o,i,a){return rA(i)?a.every((l,d)=>{let f=`${n}/additionalItems`,g=`${o}/${d}`;return s.IsLessThan(d,i.items.length)||W(e,r,f,g,i.additionalItems,l)&&r.AddIndex(d)}):!0}function gq(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function iA(e){let r=[];return Ha(e)&&r.push(...s.Keys(e.patternProperties)),Ka(e)&&r.push(...s.Keys(e.properties).map(gq)),s.IsEqual(r.length,0)?"(?!)":`(${r.join("|")})`}function aA(e,r,n,o){let i=new RegExp(iA(n));return s.Every(s.Keys(o),0,(c,l)=>i.test(c)||G(e,r,n.additionalProperties,o[c])&&r.AddKey(c))}function sA(e,r,n,o,i,a){let c=new RegExp(iA(i)),l=[];return s.EveryAll(s.Keys(a),0,(f,g)=>{let T=`${n}/additionalProperties`,_=`${o}/${f}`,ae=new Qe,fe=c.test(f)||W(e,ae,T,_,i.additionalProperties,a[f])&&r.AddKey(f);return fe||l.push(f),fe})||r.AddError({keyword:"additionalProperties",schemaPath:n,instancePath:o,params:{additionalProperties:l}})}function cA(e,r,n,o){let i=n.allOf.reduce((a,c)=>{let l=new yt;return G(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,n.allOf.length)&&r.Merge(i)}function pA(e,r,n,o,i,a){let c=[],l=i.allOf.reduce((f,g,T)=>{let _=`${n}/allOf/${T}`,ae=new Qe,fe=W(e,ae,_,o,g,a);return fe||c.push(ae),fe?[...f,ae]:f},[]),d=s.IsEqual(l.length,i.allOf.length)&&r.Merge(l);return d||c.forEach(f=>f.GetErrors().forEach(g=>r.AddError(g))),d}function uA(e,r,n,o){let i=n.anyOf.reduce((a,c,l)=>{let d=new yt;return G(e,d,c,o)?[...a,d]:a},[]);return s.IsGreaterThan(i.length,0)&&r.Merge(i)}function lA(e,r,n,o,i,a){let c=[],l=i.anyOf.reduce((f,g,T)=>{let _=new Qe,ae=`${n}/anyOf/${T}`,fe=W(e,_,ae,o,g,a);return fe||c.push(_),fe?[...f,_]:f},[]),d=s.IsGreaterThan(l.length,0)&&r.Merge(l);return d||c.forEach(f=>f.GetErrors().forEach(g=>r.AddError(g))),d||r.AddError({keyword:"anyOf",schemaPath:n,instancePath:o,params:{}})}function Um(e,r,n,o){return n}function mA(e,r,n,o,i,a){return Um(e,r,i,a)||r.AddError({keyword:"boolean",schemaPath:n,instancePath:o,params:{}})}function wm(e,r,n,o){return s.IsValueLike(n.const)?s.IsEqual(o,n.const):s.IsDeepEqual(o,n.const)}function dA(e,r,n,o,i,a){return wm(e,r,i,a)||r.AddError({keyword:"const",schemaPath:n,instancePath:o,params:{allowedValue:i.const}})}function yq(e){return!(Wn(e)&&s.IsEqual(e.minContains,0))}function Nm(e,r,n,o){return yq(n)?!s.IsEqual(o.length,0)&&o.some(i=>G(e,r,n.contains,i)):!0}function fA(e,r,n,o,i,a){return Nm(e,r,i,a)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:1}})}function gA(e,r,n,o){let i=s.IsEqual(s.Keys(o).length,0),a=s.Every(s.Entries(n.dependencies),0,([c,l])=>!s.HasPropertyKey(o,c)||(s.IsArray(l)?l.every(d=>s.HasPropertyKey(o,d)):G(e,r,l,o)));return i||a}function yA(e,r,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependencies),0,([d,f])=>{let g=`${n}/dependencies/${d}`;return!s.HasPropertyKey(a,d)||(s.IsArray(f)?f.every(T=>s.HasPropertyKey(a,T)||r.AddError({keyword:"dependencies",schemaPath:n,instancePath:o,params:{property:d,dependencies:f}})):W(e,r,g,o,f,a))});return c||l}function hA(e,r,n,o){let i=s.IsEqual(s.Keys(o).length,0),a=s.Every(s.Entries(n.dependentRequired),0,([c,l])=>!s.HasPropertyKey(o,c)||l.every(d=>s.HasPropertyKey(o,d)));return i||a}function TA(e,r,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependentRequired),0,([d,f])=>!s.HasPropertyKey(a,d)||s.EveryAll(f,0,g=>s.HasPropertyKey(a,g)||r.AddError({keyword:"dependentRequired",schemaPath:n,instancePath:o,params:{property:d,dependencies:f}})));return c||l}function EA(e,r,n,o){let i=s.IsEqual(s.Keys(o).length,0),a=s.Every(s.Entries(n.dependentSchemas),0,([c,l])=>!s.HasPropertyKey(o,c)||G(e,r,l,o));return i||a}function _A(e,r,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependentSchemas),0,([d,f])=>{let g=`${n}/dependentSchemas/${d}`;return!s.HasPropertyKey(a,d)||W(e,r,g,o,f,a)});return c||l}function Lm(e,r,n,o){return n.enum.some(i=>s.IsValueLike(i)?s.IsEqual(o,i):s.IsDeepEqual(o,i))}function IA(e,r,n,o,i,a){return Lm(e,r,i,a)||r.AddError({keyword:"enum",schemaPath:n,instancePath:o,params:{allowedValues:i.enum}})}function vm(e,r,n,o){return s.IsLessThan(o,n.exclusiveMaximum)}function bA(e,r,n,o,i,a){return vm(e,r,i,a)||r.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:o,params:{comparison:"<",limit:i.exclusiveMaximum}})}function km(e,r,n,o){return s.IsGreaterThan(o,n.exclusiveMinimum)}function SA(e,r,n,o,i,a){return km(e,r,i,a)||r.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:o,params:{comparison:">",limit:i.exclusiveMinimum}})}var pi={};Mt(pi,{Clear:()=>AA,Entries:()=>kq,Get:()=>Gq,Has:()=>Dq,IsDate:()=>Ya,IsDateTime:()=>Mm,IsDuration:()=>Dm,IsEmail:()=>Gm,IsHostname:()=>$m,IsIPv4:()=>Fm,IsIPv6:()=>Hm,IsIdnEmail:()=>jm,IsIdnHostname:()=>Bm,IsIri:()=>zm,IsIriReference:()=>Km,IsJsonPointer:()=>Vm,IsJsonPointerUriFragment:()=>Ym,IsRegex:()=>Qm,IsRelativeJsonPointer:()=>Wm,IsTime:()=>Va,IsUri:()=>Jm,IsUriReference:()=>Zm,IsUriTemplate:()=>Xm,IsUrl:()=>ed,IsUuid:()=>td,Reset:()=>xA,Set:()=>Mq,Test:()=>$q});var hq=[0,31,28,31,30,31,30,31,31,30,31,30,31],Tq=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function Eq(e){return e%4===0&&(e%100!==0||e%400===0)}function Ya(e){let r=Tq.exec(e);if(!r)return!1;let n=+r[1],o=+r[2],i=+r[3];return o>=1&&o<=12&&i>=1&&i<=(o===2&&Eq(n)?29:hq[o])}var _q=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function Va(e,r=!0){let n=_q.exec(e);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],c=n[4]==="-"?-1:1,l=+(n[5]||0),d=+(n[6]||0);if(l>23||d>59||r&&!n[4]&&e.toLowerCase().indexOf("z")===-1)return!1;if(o<=23&&i<=59&&a<60)return!0;let f=i-d*c,g=o-l*c-(f<0?1:0);return(g===23||g===-1)&&(f===59||f===-1)&&a<61}function Mm(e,r=!0){let n=e.split(/T/i);return n.length===2&&Ya(n[0])&&Va(n[1],r)}var Iq=/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/;function Dm(e){return Iq.test(e)}var bq=/^(?!.*\.\.)[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[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;function Gm(e){return bq.test(e)}var Sq=/^(?=.{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;function $m(e){return Sq.test(e)}var Oq=/^(?!.*\.\.)[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+(?:\.[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+)*@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?)*$/iu;function jm(e){return Oq.test(e)}function qm(e){let r=e.codePointAt(0);return r===void 0?!1:r>=12352&&r<=12447||r>=12448&&r<=12543&&r!==12539||r>=19968&&r<=40959}function Bm(e){if(e.length===0||e.includes(" "))return!1;let r=/[\u002E\u3002\uFF0E\uFF61]/g,n=e.normalize("NFC").replace(r,".");if(n.length>253)return!1;let o=n.split(".");if(o.some(i=>i.length===0))return!1;for(let i of o){if(i.length>63||i.startsWith("-")||i.endsWith("-"))return!1;if(/^xn--/i.test(i)){let d=i.slice(4);if(d.length<2||d.includes("---"))return!1;continue}if(/[\u302E\u302F\u3031\u3032\u3033\u3034\u3035\u303B\u0640\u07FA]/.test(i))return!1;let a=i.charAt(0);if(/[\u0903\u0300\u0488]/.test(a))return!1;for(let d=0;d<i.length;d++){let f=i.charAt(d);if(f==="\xB7"){if(d===0||d===i.length-1)return!1;let g=i.charAt(d-1),T=i.charAt(d+1);if(!/^[lL]$/.test(g)||!/^[lL]$/.test(T))return!1}if(f==="\u30FB"){if(i.length===1)return!1;if(d===0){let g=i.charAt(d+1);if(!qm(g))return!1}else{let g=i.charAt(d-1),T=i.charAt(d+1);if(!qm(g)||!qm(T))return!1}}if(f==="\u0375"){if(d===i.length-1)return!1;let g=i.charAt(d+1);if(!/[\u0370-\u03FF]/.test(g))return!1}if(f==="\u05F3"||f==="\u05F4"){if(d===0)return!1;let g=i.charAt(d-1);if(!/[\u05D0-\u05EA]/.test(g))return!1}if(f==="\u200D"&&(d===0||i.charAt(d-1)!=="\u094D"))return!1}let c=!1,l=!1;for(let d=0;d<i.length;d++){let f=i.charAt(d);/[\u0660-\u0669]/.test(f)&&(c=!0),/[\u06F0-\u06F9]/.test(f)&&(l=!0)}if(c&&l)return!1}return!0}var Aq=/^(?:(?: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)$/;function Fm(e){return Aq.test(e)}var xq=/^((([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;function Hm(e){return xq.test(e)}function OA(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function Km(e){if(e.includes(" ")||e.includes("\\")||/[\x00-\x1F\x7F]/.test(e)||/%(?![0-9a-fA-F]{2})/.test(e))return!1;if(e==="")return!0;let r=e.indexOf(":");return r>0&&/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e.substring(0,r))?OA(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&r===-1?!1:OA(e)}function zm(e){try{return new URL(e),!0}catch{return!1}}var Rq=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function Ym(e){return Rq.test(e)}var Cq=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function Vm(e){return Cq.test(e)}function Qm(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}var Pq=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function Wm(e){return Pq.test(e)}var Uq=/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i;function Zm(e){return Uq.test(e)}var wq=/^(?:(?:[^\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;function Xm(e){return wq.test(e)}var Nq=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i;function Jm(e){return Nq.test(e)}var Lq=/^(?: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;function ed(e){return Lq.test(e)}var vq=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function td(e){return vq.test(e)}var he=new Map;function AA(){he.clear()}function kq(){return[...he.entries()]}function Mq(e,r){he.set(e,r)}function Dq(e){return he.has(e)}function Gq(e){return he.get(e)}function $q(e,r){return he.get(e)?.(r)??!0}function xA(){AA(),he.set("date-time",Mm),he.set("date",Ya),he.set("duration",Dm),he.set("email",Gm),he.set("hostname",$m),he.set("idn-email",jm),he.set("idn-hostname",Bm),he.set("ipv4",Fm),he.set("ipv6",Hm),he.set("iri-reference",Km),he.set("iri",zm),he.set("json-pointer-uri-fragment",Ym),he.set("json-pointer",Vm),he.set("regex",Qm),he.set("relative-json-pointer",Wm),he.set("time",Va),he.set("uri-reference",Zm),he.set("uri-template",Xm),he.set("uri",Jm),he.set("url",ed),he.set("uuid",td)}xA();function rd(e,r,n,o){return pi.Test(n.format,o)}function RA(e,r,n,o,i,a){return rd(e,r,i,a)||r.AddError({keyword:"format",schemaPath:n,instancePath:o,params:{format:i.format}})}function CA(e,r,n,o){let i=Rm(n)?n.then:!0,a=mm(n)?n.else:!0;return G(e,r,n.if,o)?G(e,r,i,o):G(e,r,a,o)}function PA(e,r,n,o,i,a){let c=Rm(i)?i.then:!0,l=mm(i)?i.else:!0,d=new Qe,f=W(e,d,`${n}/if`,o,i.if,a)?W(e,d,`${n}/then`,o,c,a)||r.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"then"}}):W(e,r,`${n}/else`,o,l,a)||r.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"else"}});return f&&r.Merge([d]),f}function jq(e,r,n,o){return s.Every(n.items,0,(i,a)=>s.IsLessEqualThan(o.length,a)||G(e,r,i,o[a])&&r.AddIndex(a))}function qq(e,r,n,o,i,a){return s.EveryAll(i.items,0,(c,l)=>{let d=`${n}/items/${l}`,f=`${o}/${l}`;return s.IsLessEqualThan(a.length,l)||W(e,r,d,f,c,a[l])&&r.AddIndex(l)})}function Bq(e,r,n,o){let i=ai(n)?n.prefixItems.length:0;return s.Every(o,i,(a,c)=>G(e,r,n.items,a)&&r.AddIndex(c))}function Fq(e,r,n,o,i,a){let c=ai(i)?i.prefixItems.length:0;return s.EveryAll(a,c,(l,d)=>{let f=`${n}/items`,g=`${o}/${d}`;return W(e,r,f,g,i.items,l)&&r.AddIndex(d)})}function UA(e,r,n,o){return ym(n)?jq(e,r,n,o):Bq(e,r,n,o)}function wA(e,r,n,o,i,a){return ym(i)?qq(e,r,n,o,i,a):Fq(e,r,n,o,i,a)}function Hq(e){return Vn(e)}function nd(e,r,n,o){if(!Hq(n))return!0;let i=o.reduce((a,c)=>G(e,r,n.contains,c)?++a:a,0);return s.IsLessEqualThan(i,n.maxContains)}function NA(e,r,n,o,i,a){let c=Wn(i)?i.minContains:1;return nd(e,r,i,a)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:c,maxContains:i.maxContains}})}function od(e,r,n,o){return s.IsLessEqualThan(o,n.maximum)}function LA(e,r,n,o,i,a){return od(e,r,i,a)||r.AddError({keyword:"maximum",schemaPath:n,instancePath:o,params:{comparison:"<=",limit:i.maximum}})}function id(e,r,n,o){return s.IsLessEqualThan(o.length,n.maxItems)}function vA(e,r,n,o,i,a){return id(e,r,i,a)||r.AddError({keyword:"maxItems",schemaPath:n,instancePath:o,params:{limit:i.maxItems}})}function ad(e,r,n,o){return s.IsMaxLength(o,n.maxLength)}function kA(e,r,n,o,i,a){return ad(e,r,i,a)||r.AddError({keyword:"maxLength",schemaPath:n,instancePath:o,params:{limit:i.maxLength}})}function sd(e,r,n,o){return s.IsLessEqualThan(s.Keys(o).length,n.maxProperties)}function MA(e,r,n,o,i,a){return sd(e,r,i,a)||r.AddError({keyword:"maxProperties",schemaPath:n,instancePath:o,params:{limit:i.maxProperties}})}function Kq(e){return Vn(e)}function cd(e,r,n,o){if(!Kq(n))return!0;let i=o.reduce((a,c)=>G(e,r,n.contains,c)?++a:a,0);return s.IsGreaterEqualThan(i,n.minContains)}function DA(e,r,n,o,i,a){return cd(e,r,i,a)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:i.minContains}})}function pd(e,r,n,o){return s.IsGreaterEqualThan(o,n.minimum)}function GA(e,r,n,o,i,a){return pd(e,r,i,a)||r.AddError({keyword:"minimum",schemaPath:n,instancePath:o,params:{comparison:">=",limit:i.minimum}})}function ud(e,r,n,o){return s.IsGreaterEqualThan(o.length,n.minItems)}function $A(e,r,n,o,i,a){return ud(e,r,i,a)||r.AddError({keyword:"minItems",schemaPath:n,instancePath:o,params:{limit:i.minItems}})}function ld(e,r,n,o){return s.IsMinLength(o,n.minLength)}function jA(e,r,n,o,i,a){return ld(e,r,i,a)||r.AddError({keyword:"minLength",schemaPath:n,instancePath:o,params:{limit:i.minLength}})}function md(e,r,n,o){return s.IsGreaterEqualThan(s.Keys(o).length,n.minProperties)}function qA(e,r,n,o,i,a){return md(e,r,i,a)||r.AddError({keyword:"minProperties",schemaPath:n,instancePath:o,params:{limit:i.minProperties}})}function dd(e,r,n,o){return s.IsMultipleOf(o,n.multipleOf)}function BA(e,r,n,o,i,a){return dd(e,r,i,a)||r.AddError({keyword:"multipleOf",schemaPath:n,instancePath:o,params:{multipleOf:i.multipleOf}})}function fd(e,r,n,o){let i=new yt;return!G(e,i,n.not,o)&&r.Merge([i])}function FA(e,r,n,o,i,a){return fd(e,r,i,a)||r.AddError({keyword:"not",schemaPath:n,instancePath:o,params:{}})}function HA(e,r,n,o){let i=n.oneOf.reduce((a,c)=>{let l=new yt;return G(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,1)&&r.Merge(i)}function KA(e,r,n,o,i,a){let c=[],l=[],d=i.oneOf.reduce((g,T,_)=>{let ae=new Qe,fe=`${n}/oneOf/${_}`,jr=W(e,ae,fe,o,T,a);return jr&&l.push(_),jr||c.push(ae),jr?[...g,ae]:g},[]),f=s.IsEqual(d.length,1)&&r.Merge(d);return!f&&s.IsEqual(l.length,0)&&c.forEach(g=>g.GetErrors().forEach(T=>r.AddError(T))),f||r.AddError({keyword:"oneOf",schemaPath:n,instancePath:o,params:{passingSchemas:l}})}function gd(e,r,n,o){return(s.IsString(n.pattern)?new RegExp(n.pattern):n.pattern).test(o)}function zA(e,r,n,o,i,a){return gd(e,r,i,a)||r.AddError({keyword:"pattern",schemaPath:n,instancePath:o,params:{pattern:i.pattern}})}function YA(e,r,n,o){return s.Every(s.Entries(n.patternProperties),0,([i,a])=>{let c=new RegExp(i);return s.Every(s.Entries(o),0,([l,d])=>!c.test(l)||G(e,r,a,d)&&r.AddKey(l))})}function VA(e,r,n,o,i,a){return s.EveryAll(s.Entries(i.patternProperties),0,([c,l])=>{let d=`${n}/patternProperties/${c}`,f=new RegExp(c);return s.EveryAll(s.Entries(a),0,([g,T])=>{let _=`${o}/${g}`;return!f.test(g)||W(e,r,d,_,l,T)&&r.AddKey(g)})})}function QA(e,r,n,o){return s.IsEqual(o.length,0)||s.Every(n.prefixItems,0,(i,a)=>s.IsLessEqualThan(o.length,a)||G(e,r,i,o[a])&&r.AddIndex(a))}function WA(e,r,n,o,i,a){return s.IsEqual(a.length,0)||s.EveryAll(i.prefixItems,0,(c,l)=>{let d=`${n}/prefixItems/${l}`,f=`${o}/${l}`;return s.IsLessEqualThan(a.length,l)||W(e,r,d,f,c,a[l])&&r.AddIndex(l)})}function yd(e,r){return e.includes(r)||Pt.Get().exactOptionalPropertyTypes}function hd(e,r){return s.IsUndefined(e[r])}function ZA(e,r,n,o){let i=Zn(n)?n.required:[];return s.Every(s.Entries(n.properties),0,([c,l])=>{let d=!s.HasPropertyKey(o,c)||G(e,r,l,o[c])&&r.AddKey(c);return yd(i,c)?d:hd(o,c)||d})}function XA(e,r,n,o,i,a){let c=Zn(i)?i.required:[];return s.EveryAll(s.Entries(i.properties),0,([d,f])=>{let g=`${n}/properties/${d}`,T=`${o}/${d}`,_=()=>!s.HasPropertyKey(a,d)||W(e,r,g,T,f,a[d])&&r.AddKey(d);return yd(c,d)?_():hd(a,d)||_()})}function JA(e,r,n,o){return s.Every(s.Keys(o),0,(i,a)=>G(e,r,n.propertyNames,i))}function ex(e,r,n,o,i,a){let c=[];return s.EveryAll(s.Keys(a),0,(d,f)=>{let g=`${o}/${d}`,T=`${n}/propertyNames`,_=new Qe,ae=W(e,_,T,g,i.propertyNames,d);return ae||c.push(d),ae})||r.AddError({keyword:"propertyNames",schemaPath:n,instancePath:o,params:{propertyNames:c}})}function tx(e,r,n,o){let i=e.RecursiveRef(n.$recursiveRef)??!1;return j(i)&&G(e,r,i,o)}function rx(e,r,n,o,i,a){let c=e.RecursiveRef(i.$recursiveRef)??!1;return j(c)&&W(e,r,"#",o,c,a)}function ix(e,r,n,o){let i=e.Ref(n.$ref)??!1,a=new yt,c=j(i)&&G(e,a,i,o);return c&&r.Merge([a]),c}function ax(e,r,n,o,i,a){let c=e.Ref(i.$ref)??!1,l=new Qe,d=j(c)&&W(e,l,"#",o,c,a);return d&&r.Merge([l]),d||l.GetErrors().forEach(f=>r.AddError(f)),d}function sx(e,r,n,o){return s.Every(n.required,0,i=>s.HasPropertyKey(o,i))}function cx(e,r,n,o,i,a){let c=[];return s.EveryAll(i.required,0,d=>{let f=s.HasPropertyKey(a,d);return f||c.push(d),f})||r.AddError({keyword:"required",schemaPath:n,instancePath:o,params:{requiredProperties:c}})}function Td(e,r,n,o,i){return s.IsEqual(n,"object")?s.IsObjectNotArray(i):s.IsEqual(n,"array")?s.IsArray(i):s.IsEqual(n,"boolean")?s.IsBoolean(i):s.IsEqual(n,"integer")?s.IsInteger(i):s.IsEqual(n,"number")?s.IsNumber(i):s.IsEqual(n,"null")?s.IsNull(i):s.IsEqual(n,"string")?s.IsString(i):s.IsEqual(n,"asyncIterator")?s.IsAsyncIterator(i):s.IsEqual(n,"bigint")?s.IsBigInt(i):s.IsEqual(n,"constructor")?s.IsConstructor(i):s.IsEqual(n,"function")?s.IsFunction(i):s.IsEqual(n,"iterator")?s.IsIterator(i):s.IsEqual(n,"symbol")?s.IsSymbol(i):s.IsEqual(n,"undefined")?s.IsUndefined(i):s.IsEqual(n,"void")?s.IsUndefined(i):!0}function px(e,r,n,o,i){return n.some(a=>Td(e,r,a,o,i))}function ux(e,r,n,o){return s.IsArray(n.type)?px(e,r,n.type,n,o):Td(e,r,n.type,n,o)}function lx(e,r,n,o,i,a){return(s.IsArray(i.type)?px(e,r,i.type,i,a):Td(e,r,i.type,i,a))||r.AddError({keyword:"type",schemaPath:n,instancePath:o,params:{type:i.type}})}function mx(e,r,n,o){let i=r.GetIndices();return s.Every(o,0,(a,c)=>(i.has(c)||G(e,r,n.unevaluatedItems,a))&&r.AddIndex(c))}function dx(e,r,n,o,i,a){let c=r.GetIndices(),l=[];return s.EveryAll(a,0,(f,g)=>{let T=new Qe,_=(c.has(g)||W(e,T,n,o,i.unevaluatedItems,f))&&r.AddIndex(g);return _||l.push(g),_})||r.AddError({keyword:"unevaluatedItems",schemaPath:n,instancePath:o,params:{unevaluatedItems:l}})}function fx(e,r,n,o){let i=r.GetKeys();return s.Every(s.Entries(o),0,([a,c])=>i.has(a)||G(e,r,n.unevaluatedProperties,c)&&r.AddKey(a))}function gx(e,r,n,o,i,a){let c=r.GetKeys(),l=[];return s.EveryAll(s.Entries(a),0,([f,g])=>{let T=new Qe,_=c.has(f)||W(e,T,n,o,i.unevaluatedProperties,g)&&r.AddKey(f);return _||l.push(f),_})||r.AddError({keyword:"unevaluatedProperties",schemaPath:n,instancePath:o,params:{unevaluatedProperties:l}})}function yx(e){return!s.IsEqual(e.uniqueItems,!1)}function hx(e,r,n,o){if(!yx(n))return!0;let i=new Set(o.map(Wr.Hash)).size,a=o.length;return s.IsEqual(i,a)}function Tx(e,r,n,o,i,a){if(!yx(i))return!0;let c=new Set,l=a.reduce((f,g,T)=>{let _=Wr.Hash(g);return c.has(_)?[...f,T]:(c.add(_),f)},[]);return s.IsEqual(l.length,0)||r.AddError({keyword:"uniqueItems",schemaPath:n,instancePath:o,params:{duplicateItems:l}})}function G(e,r,n,o){e.Push(n);let i=lp(n)?Um(e,r,n,o):(!Cm(n)||ux(e,r,n,o))&&(!(s.IsObject(o)&&!s.IsArray(o))||(!Zn(n)||sx(e,r,n,o))&&(!Pr(n)||aA(e,r,n,o))&&(!cm(n)||gA(e,r,n,o))&&(!pm(n)||hA(e,r,n,o))&&(!um(n)||EA(e,r,n,o))&&(!Ha(n)||YA(e,r,n,o))&&(!Ka(n)||ZA(e,r,n,o))&&(!Om(n)||JA(e,r,n,o))&&(!Ba(n)||md(e,r,n,o))&&(!_m(n)||sd(e,r,n,o)))&&(!s.IsArray(o)||(!om(n)||nA(e,r,n,o))&&(!Vn(n)||Nm(e,r,n,o))&&(!oi(n)||UA(e,r,n,o))&&(!Tm(n)||nd(e,r,n,o))&&(!mp(n)||id(e,r,n,o))&&(!Wn(n)||cd(e,r,n,o))&&(!ii(n)||ud(e,r,n,o))&&(!ai(n)||QA(e,r,n,o))&&(!si(n)||hx(e,r,n,o)))&&(!s.IsString(o)||(!ja(n)||rd(e,r,n,o))&&(!Em(n)||ad(e,r,n,o))&&(!qa(n)||ld(e,r,n,o))&&(!Fa(n)||gd(e,r,n,o)))&&(!(s.IsNumber(o)||s.IsBigInt(o))||(!fm(n)||vm(e,r,n,o))&&(!Ur(n)||km(e,r,n,o))&&(!hm(n)||od(e,r,n,o))&&(!wr(n)||pd(e,r,n,o))&&(!Im(n)||dd(e,r,n,o)))&&(!Am(n)||tx(e,r,n,o))&&(!xm(n)||ix(e,r,n,o))&&(!rm(n)||XO(e,r,n,o))&&(!sm(n)||wm(e,r,n,o))&&(!dm(n)||Lm(e,r,n,o))&&(!gm(n)||CA(e,r,n,o))&&(!bm(n)||fd(e,r,n,o))&&(!im(n)||cA(e,r,n,o))&&(!am(n)||uA(e,r,n,o))&&(!Sm(n)||HA(e,r,n,o))&&(!fp(n)||!s.IsArray(o)||mx(e,r,n,o))&&(!gp(n)||!s.IsObject(o)||fx(e,r,n,o))&&(!nm(n)||eA(e,r,n,o));return e.Pop(n),i}function W(e,r,n,o,i,a){e.Push(i);let c=lp(i)?mA(e,r,n,o,i,a):!!(+(!Cm(i)||lx(e,r,n,o,i,a))&+(!(s.IsObject(a)&&!s.IsArray(a))||!!(+(!Zn(i)||cx(e,r,n,o,i,a))&+(!Pr(i)||sA(e,r,n,o,i,a))&+(!cm(i)||yA(e,r,n,o,i,a))&+(!pm(i)||TA(e,r,n,o,i,a))&+(!um(i)||_A(e,r,n,o,i,a))&+(!Ha(i)||VA(e,r,n,o,i,a))&+(!Ka(i)||XA(e,r,n,o,i,a))&+(!Om(i)||ex(e,r,n,o,i,a))&+(!Ba(i)||qA(e,r,n,o,i,a))&+(!_m(i)||MA(e,r,n,o,i,a))))&+(!s.IsArray(a)||!!(+(!om(i)||oA(e,r,n,o,i,a))&+(!Vn(i)||fA(e,r,n,o,i,a))&+(!oi(i)||wA(e,r,n,o,i,a))&+(!Tm(i)||NA(e,r,n,o,i,a))&+(!mp(i)||vA(e,r,n,o,i,a))&+(!Wn(i)||DA(e,r,n,o,i,a))&+(!ii(i)||$A(e,r,n,o,i,a))&+(!ai(i)||WA(e,r,n,o,i,a))&+(!si(i)||Tx(e,r,n,o,i,a))))&+(!s.IsString(a)||!!(+(!ja(i)||RA(e,r,n,o,i,a))&+(!Em(i)||kA(e,r,n,o,i,a))&+(!qa(i)||jA(e,r,n,o,i,a))&+(!Fa(i)||zA(e,r,n,o,i,a))))&+(!(s.IsNumber(a)||s.IsBigInt(a))||!!(+(!fm(i)||bA(e,r,n,o,i,a))&+(!Ur(i)||SA(e,r,n,o,i,a))&+(!hm(i)||LA(e,r,n,o,i,a))&+(!wr(i)||GA(e,r,n,o,i,a))&+(!Im(i)||BA(e,r,n,o,i,a))))&+(!Am(i)||rx(e,r,n,o,i,a))&+(!xm(i)||ax(e,r,n,o,i,a))&+(!rm(i)||JO(e,r,n,o,i,a))&+(!sm(i)||dA(e,r,n,o,i,a))&+(!dm(i)||IA(e,r,n,o,i,a))&+(!gm(i)||PA(e,r,n,o,i,a))&+(!bm(i)||FA(e,r,n,o,i,a))&+(!im(i)||pA(e,r,n,o,i,a))&+(!am(i)||lA(e,r,n,o,i,a))&+(!Sm(i)||KA(e,r,n,o,i,a))&+(!fp(i)||!s.IsArray(a)||dx(e,r,n,o,i,a))&+(!gp(i)||!s.IsObject(a)||gx(e,r,n,o,i,a)))&&(!nm(i)||tA(e,r,n,o,i,a));return e.Pop(i),c}var Jn={};Mt(Jn,{Ref:()=>oB});var Nr={};Mt(Nr,{Delete:()=>Xq,Get:()=>Wq,Has:()=>Qq,Indices:()=>Qa,Set:()=>Zq});function Ex(e){if(e.length===0)throw Error("Cannot set root")}function _x(e){if(!s.IsObject(e))throw Error("Cannot set value")}function zq(e){return/^(0|[1-9]\d*)$/.test(e)}function Ix(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function Yq(e,r){return s.IsObject(r)&&s.HasPropertyKey(r,e)}function Vq(e,r){return s.IsObject(r)?r[e]:void 0}function Ed(e,r){return e.reduce((n,o)=>Vq(o,n),r)}function Qa(e){if(s.IsEqual(e.length,0))return[];let r=e.split("/").map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"));return r.length>0&&r[0]===""?r.slice(1):r}function Qq(e,r){let n=e;return Qa(r).every(o=>Yq(o,n)?(n=n[o],!0):!1)}function Wq(e,r){let n=Qa(r);return Ed(n,e)}function Zq(e,r,n){let o=Qa(r);Ex(o);let[i,a]=Ix(o),c=Ed(i,e);return _x(c),c[a]=n,e}function Xq(e,r){let n=Qa(r);Ex(n);let[o,i]=Ix(n),a=Ed(o,e);return _x(a),s.IsArray(a)&&zq(i)?a.splice(+i,1):delete a[i],e}function Jq(e,r,n){if(e.$id===n.hash)return e;let o=new URL(e.$id,r.href),i=new URL(n.href,r.href);if(s.IsEqual(o.pathname,i.pathname))return n.hash.startsWith("#")?bx(e,r,n):e}function eB(e,r,n){let o=new URL(`#${e.$anchor}`,r.href),i=new URL(n.href,r.href);if(s.IsEqual(o.href,i.href))return e}function bx(e,r,n){return n.href.endsWith("#")?e:n.hash.startsWith("#")?Nr.Get(e,decodeURIComponent(n.hash.slice(1))):void 0}function tB(e,r,n){if(Qn(e)){let o=Jq(e,r,n);if(!s.IsUndefined(o))return o}if($a(e)){let o=eB(e,r,n);if(!s.IsUndefined(o))return o}return bx(e,r,n)}function rB(e,r,n){return e.reduce((o,i)=>{let a=_d(i,r,n);return s.IsUndefined(a)?o:a},void 0)}function nB(e,r,n){return s.Keys(e).reduce((o,i)=>{let a=_d(e[i],r,n);return s.IsUndefined(a)?o:a},void 0)}function _d(e,r,n){if(r=Cr(e)&&Qn(e)?new URL(e.$id,r.href):r,Cr(e)){let o=tB(e,r,n);if(!s.IsUndefined(o))return o}if(s.IsArray(e))return rB(e,r,n);if(s.IsObject(e))return nB(e,r,n)}function oB(e,r){let n=new URL("http://unknown"),o=Qn(e)?new URL(e.$id,n.href):n,i=new URL(r,o.href);return _d(e,o,i)}var eo=class{constructor(r,n){this.context=r,this.schema=n,this.ids=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[]}BaseURL(){return this.ids.reduce((r,n)=>new URL(n.$id,r),new URL("http://unknown"))}Base(){return this.ids[this.ids.length-1]??this.schema}Push(r){Cr(r)&&(Qn(r)&&this.ids.push(r),$a(r)&&this.anchors.push(r),dp(r)&&this.recursiveAnchors.push(r),lm(r)&&this.dynamicAnchors.push(r))}Pop(r){Cr(r)&&(Qn(r)&&this.ids.pop(),$a(r)&&this.anchors.pop(),dp(r)&&this.recursiveAnchors.pop(),lm(r)&&this.dynamicAnchors.pop())}FromContext(r){return s.HasPropertyKey(this.context,r)?this.context[r]:void 0}FromRef(r){return r.startsWith("#")?Jn.Ref(this.Base(),r):Jn.Ref(this.schema,r)}Ref(r){return this.FromContext(r)??this.FromRef(r)}RecursiveRef(r){return dp(this.Base())?Jn.Ref(this.recursiveAnchors[0],r):Jn.Ref(this.Base(),r)}};function Sx(...e){let[r,n,o]=ie.Match(e,{3:(c,l,d)=>[c,l,d],2:(c,l)=>[{},c,l]}),i=new eo(r,n),a=new yt;return G(i,a,n,o)}function Ox(...e){let[r,n,o]=ie.Match(e,{3:(g,T,_)=>[g,T,_],2:(g,T)=>[{},g,T]}),i=Pt.Get(),a=zg(),c=[],l=new eo(r,n),d=new za(g=>{if(!s.IsGreaterEqualThan(c.length,i.maxErrors))return c.push({...g,message:a(g)})});return[W(l,d,"#","",n,o),c]}function de(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return Sx(r,n,o)}function gn(...e){let[r,n,o]=ie.Match(e,{3:(c,l,d)=>[c,l,d],2:(c,l)=>[{},c,l]}),[i,a]=Ox(r,n,o);return a}var yn=class extends Error{constructor(r,n,o){super(r),Object.defineProperty(this,"cause",{value:{source:r,errors:o,value:n},writable:!1,configurable:!1,enumerable:!1})}};function Ax(e,r,n){return s.IsArray(n)?n.map(o=>Ze(e,r.items,o)):n}function xx(e,r,n){return r.Clean(n)}function Rx(e,r,n){return Ze({...e,...r.$defs},Le(r.$ref),n)}function aB(e){let r=s.HasPropertyKey(e,"unevaluatedProperties")?{additionalProperties:e.unevaluatedProperties}:{},n=Kt(e);return k(n)?$c(n,r):n}function Cx(e,r,n){let o=aB(r);return Ze(e,o,n)}function yp(e){return s.HasPropertyKey(e,"additionalProperties")?e.additionalProperties:void 0}function Px(e,r,n){if(!s.IsObject(n)||s.IsArray(n))return n;let o=yp(r);for(let i of s.Keys(n)){if(s.HasPropertyKey(r.properties,i)){n[i]=Ze(e,r.properties[i],n[i]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||A(o)&&de(e,o,n[i])){n[i]=Ze(e,o,n[i]);continue}delete n[i]}return n}function Ux(e,r,n){if(!s.IsObject(n))return n;let o=yp(r),[i,a]=[new RegExp(xt(r)),rt(r)];for(let c of s.Keys(n)){if(i.test(c)){n[c]=Ze(e,a,n[c]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||A(o)&&de(e,o,n[c])){n[c]=Ze(e,o,n[c]);continue}delete n[c]}return n}function wx(e,r,n){return s.HasPropertyKey(e,r.$ref)?Ze(e,e[r.$ref],n):n}function Nx(e,r,n){if(!s.IsArray(n))return n;let o=Math.min(n.length,r.items.length);for(let i=0;i<o;i++)n[i]=Ze(e,r.items[i],n[i]);return s.IsGreaterThan(n.length,o)?n.slice(0,o):n}function sB(e){let r={};for(let n of Object.getOwnPropertyNames(e))r[n]=ge(e[n]);for(let n of Object.getOwnPropertySymbols(e))r[n]=ge(e[n]);return r}function cB(e){return s.IsClassInstance(e)?e:sB(e)}function pB(e){return e.map(r=>ge(r))}function uB(e){return e.slice()}function lB(e){return new Map(ge([...e.entries()]))}function mB(e){return new Set(ge([...e.values()]))}function ge(e){return ct.IsTypeArray(e)?uB(e):ct.IsMap(e)?lB(e):ct.IsSet(e)?mB(e):s.IsArray(e)?pB(e):s.IsObject(e)?cB(e):e}function Lx(e,r,n){for(let o of r.anyOf){let i=Ze(e,o,ge(n));if(de(e,o,i))return i}return n}function Ze(e,r,n){return te(r)?Ax(e,r,n):Ut(r)?xx(e,r,n):me(r)?Rx(e,r,n):w(r)?Cx(e,r,n):k(r)?Px(e,r,n):Se(r)?Ux(e,r,n):pe(r)?wx(e,r,n):V(r)?Nx(e,r,n):O(r)?Lx(e,r,n):n}function ro(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return Ze(r,n,o)}function vx(e,r,n){return s.IsArray(n)?n.map(o=>De(e,r.items,o)):n}function kx(e,r,n){return r.Convert(n)}var ne={};Mt(ne,{Fail:()=>no,IsOk:()=>bd,Ok:()=>U,TryBigInt:()=>Sd,TryBoolean:()=>wB,TryNull:()=>GB,TryNumber:()=>YB,TryString:()=>eF,TryUndefined:()=>sF});function bd(e){return s.IsObject(e)&&s.HasPropertyKey(e,"value")}function U(e){return{value:e}}function no(){}function dB(e){return U(e)}function fB(e){return s.IsEqual(e,!0)?U(BigInt(1)):U(BigInt(0))}function gB(e){return U(BigInt(Math.trunc(e)))}function yB(e){return U(BigInt(0))}var hB=/^-?(0|[1-9]\d*)n$/,TB=/^-?(0|[1-9]\d*)\.\d+$/,EB=/^-?(0|[1-9]\d*)$/;function _B(e){return hB.test(e)}function IB(e){return TB.test(e)}function bB(e){return EB.test(e)}function SB(e){let r=e.toLowerCase();return _B(e)?U(BigInt(e.slice(0,e.length-1))):IB(e)?U(BigInt(e.split(".")[0])):bB(e)?U(BigInt(e)):s.IsEqual(r,"false")?U(BigInt(0)):s.IsEqual(r,"true")?U(BigInt(1)):void 0}function OB(e){return U(BigInt(0))}function Sd(e){return s.IsBigInt(e)?dB(e):s.IsBoolean(e)?fB(e):s.IsNumber(e)?gB(e):s.IsNull(e)?yB(e):s.IsString(e)?SB(e):s.IsUndefined(e)?OB(e):void 0}function AB(e){return s.IsEqual(e,BigInt(0))?U(!1):s.IsEqual(e,BigInt(1))?U(!0):void 0}function xB(e){return U(e)}function RB(e){return s.IsEqual(e,0)?U(!1):s.IsEqual(e,1)?U(!0):void 0}function CB(e){return U(!1)}function PB(e){return s.IsEqual(e.toLowerCase(),"false")?U(!1):s.IsEqual(e.toLowerCase(),"true")?U(!0):s.IsEqual(e,"0")?U(!1):s.IsEqual(e,"1")?U(!0):void 0}function UB(e){return U(!1)}function wB(e){return s.IsBigInt(e)?AB(e):s.IsBoolean(e)?xB(e):s.IsNumber(e)?RB(e):s.IsNull(e)?CB(e):s.IsString(e)?PB(e):s.IsUndefined(e)?UB(e):void 0}function NB(e){return s.IsEqual(e,BigInt(0))?U(null):void 0}function LB(e){return s.IsEqual(e,!1)?U(null):void 0}function vB(e){return s.IsEqual(e,0)?U(null):void 0}function kB(e){return U(null)}function MB(e){let r=e.toLowerCase();return s.IsEqual(r,"undefined")||s.IsEqual(r,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?U(null):void 0}function DB(e){return U(null)}function GB(e){return s.IsBigInt(e)?NB(e):s.IsBoolean(e)?LB(e):s.IsNumber(e)?vB(e):s.IsNull(e)?kB(e):s.IsString(e)?MB(e):s.IsUndefined(e)?DB(e):void 0}var $B=BigInt(Number.MAX_SAFE_INTEGER),jB=BigInt(Number.MIN_SAFE_INTEGER);function qB(e){return e<=$B&&e>=jB}function Mx(e){return qB(e)?U(Number(e)):void 0}function BB(e){return e?U(1):U(0)}function FB(e){return U(e)}function HB(e){return U(0)}function KB(e){let r=+e;if(s.IsNumber(r))return U(r);let n=e.toLowerCase();if(s.IsEqual(n,"false"))return U(0);if(s.IsEqual(n,"true"))return U(1);let o=Sd(e);return bd(o)?Mx(o.value):void 0}function zB(e){return U(0)}function YB(e){return s.IsBigInt(e)?Mx(e):s.IsBoolean(e)?BB(e):s.IsNumber(e)?FB(e):s.IsNull(e)?HB(e):s.IsString(e)?KB(e):s.IsUndefined(e)?zB(e):void 0}function VB(e){return U(e.toString())}function QB(e){return U(e.toString())}function WB(e){return U(e.toString())}function ZB(e){return U("null")}function XB(e){return U(e)}function JB(e){return U("")}function eF(e){return s.IsBigInt(e)?VB(e):s.IsBoolean(e)?QB(e):s.IsNumber(e)?WB(e):s.IsNull(e)?ZB(e):s.IsString(e)?XB(e):s.IsUndefined(e)?JB(e):void 0}function tF(e){return s.IsEqual(e,BigInt(0))?U(void 0):void 0}function rF(e){return s.IsEqual(e,!1)?U(void 0):void 0}function nF(e){return s.IsEqual(e,0)?U(void 0):void 0}function oF(e){return U(void 0)}function iF(e){let r=e.toLowerCase();return s.IsEqual(r,"undefined")||s.IsEqual(r,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?U(void 0):void 0}function aF(e){return U(void 0)}function sF(e){return s.IsBigInt(e)?tF(e):s.IsBoolean(e)?rF(e):s.IsNumber(e)?nF(e):s.IsNull(e)?oF(e):s.IsString(e)?iF(e):s.IsUndefined(e)?aF(e):void 0}function Dx(e,r,n){if(s.IsBigInt(n))return n;let o=ne.TryBigInt(n);return ne.IsOk(o)?o.value:n}function Gx(e,r,n){if(s.IsBoolean(n))return n;let o=ne.TryBoolean(n);return ne.IsOk(o)?o.value:n}function $x(e,r,n){return De({...e,...r.$defs},Le(r.$ref),n)}function hp(e,r,n){if(r.anyOf.some(c=>de(e,c,n)))return n;let a=r.anyOf.map(c=>De(e,c,ge(n))).find(c=>de(e,r,c));return s.IsUndefined(a)?n:a}function jx(e,r,n){let o=kn(r);return hp(e,o,n)}function qx(e,r,n){if(s.IsInteger(n))return n;let o=ne.TryNumber(n);return ne.IsOk(o)?Math.trunc(o.value):n}function Bx(e,r,n){let o=Kt(r);return De(e,o,n)}function cF(e,r,n){let o=ne.TryBigInt(n);return ne.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function pF(e,r,n){let o=ne.TryBoolean(n);return ne.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function uF(e,r,n){let o=ne.TryNumber(n);return ne.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function lF(e,r,n){let o=ne.TryString(n);return ne.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function Fx(e,r,n){return s.IsEqual(r.const,n)?n:ey(r)?cF(e,r,n):ty(r)?pF(e,r,n):Eo(r)?uF(e,r,n):_o(r)?lF(e,r,n):H()}function Hx(e,r,n){if(s.IsNull(n))return n;let o=ne.TryNull(n);return ne.IsOk(o)?o.value:n}function Kx(e,r,n){if(s.IsNumber(n))return n;let o=ne.TryNumber(n);return ne.IsOk(o)?o.value:n}function Tp(e,r,n,o){let i=s.Keys(o);for(let[a,c]of r)for(let l of i)a.test(l)||(o[l]=De(e,n,o[l]));return o}function Wa(e,r,n){return Ge(e)&&s.IsUndefined(n[r])}function mF(e,r,n){let o=s.EntriesRegExp(r.properties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)!a.test(l)||Wa(c,l,n)||(n[l]=De(e,c,n[l]));return s.HasPropertyKey(r,"additionalProperties")&&s.IsObject(r.additionalProperties)?Tp(e,o,r.additionalProperties,n):n}function zx(e,r,n){return s.IsObjectNotArray(n)?mF(e,r,n):n}function dF(e,r,n){let o=s.EntriesRegExp(r.patternProperties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)a.test(l)&&(n[l]=De(e,c,n[l]));return s.HasPropertyKey(r,"additionalProperties")&&s.IsObject(r.additionalProperties)?Tp(e,o,r.additionalProperties,n):n}function Yx(e,r,n){return s.IsObjectNotArray(n)?dF(e,r,n):n}function Vx(e,r,n){return s.HasPropertyKey(e,r.$ref)?De(e,e[r.$ref],n):n}function Qx(e,r,n){if(s.IsString(n))return n;let o=ne.TryString(n);return ne.IsOk(o)?o.value:n}function Wx(e,r,n){let o=nt(r.pattern);return De(e,o,n)}function Zx(e,r,n){if(!s.IsArray(n))return n;for(let o=0;o<Math.min(r.items.length,n.length);o++)n[o]=De(e,r.items[o],n[o]);return n}function Xx(e,r,n){if(s.IsUndefined(n))return n;let o=ne.TryUndefined(n);return ne.IsOk(o)?o.value:n}function Jx(e,r,n){if(s.IsUndefined(n))return n;let o=ne.TryUndefined(n);return ne.IsOk(o)?void 0:n}function De(e,r,n){return te(r)?vx(e,r,n):Ut(r)?kx(e,r,n):At(r)?Dx(e,r,n):lt(r)?Gx(e,r,n):me(r)?$x(e,r,n):Ue(r)?jx(e,r,n):He(r)?qx(e,r,n):w(r)?Bx(e,r,n):X(r)?Fx(e,r,n):tr(r)?Hx(e,r,n):be(r)?Kx(e,r,n):k(r)?zx(e,r,n):Se(r)?Yx(e,r,n):pe(r)?Vx(e,r,n):ve(r)?Qx(e,r,n):we(r)?Wx(e,r,n):V(r)?Zx(e,r,n):or(r)?Xx(e,r,n):O(r)?hp(e,r,n):Rt(r)?Jx(e,r,n):n}function hn(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return De(r,n,o)}function eR(e,r,n){if(!s.IsArray(n))return n;for(let o=0;o<n.length;o++)n[o]=Fe(e,r.items,n[o]);return n}function tR(e,r,n){return r.Default(n)}function rR(e,r,n){return Fe({...e,...r.$defs},Le(r.$ref),n)}function nR(e,r){return s.IsUndefined(r)?s.IsFunction(e.default)?e.default():ge(e.default):r}function oR(e,r,n){let o=Kt(r);return Fe(e,o,n)}function iR(e,r,n){if(!s.IsObject(n))return n;let o=s.Keys(r.properties);for(let i of o){let a=Fe(e,r.properties[i],n[i]);s.IsUndefined(a)&&(Ge(r.properties[i])||!s.HasPropertyKey(r.properties[i],"default"))||(n[i]=Fe(e,r.properties[i],n[i]))}if(!Pr(r)||s.IsBoolean(r.additionalProperties))return n;for(let i of s.Keys(n))o.includes(i)||(n[i]=Fe(e,r.additionalProperties,n[i]));return n}function aR(e,r,n){if(!s.IsObject(n))return n;let[o,i]=[new RegExp(xt(r)),rt(r)];for(let a of s.Keys(n))o.test(a)&&vt(i)&&(n[a]=Fe(e,i,n[a]));if(!Pr(r))return n;for(let a of s.Keys(n))o.test(a)||(n[a]=Fe(e,r.additionalProperties,n[a]));return n}function sR(e,r,n){return s.HasPropertyKey(e,r.$ref)?Fe(e,e[r.$ref],n):n}function cR(e,r,n){if(!s.IsArray(n))return n;let[o,i]=[r.items,Math.max(r.items.length,n.length)];for(let a=0;a<i;a++)a<o.length&&(n[a]=Fe(e,o[a],n[a]));return n}function pR(e,r,n){for(let o of r.anyOf){let i=Fe(e,o,ge(n));if(de(e,o,i))return i}return n}function Fe(e,r,n){let o=vt(r)?nR(r,n):n;return te(r)?eR(e,r,o):Ut(r)?tR(e,r,o):me(r)?rR(e,r,o):w(r)?oR(e,r,o):k(r)?iR(e,r,o):Se(r)?aR(e,r,o):pe(r)?sR(e,r,o):V(r)?cR(e,r,o):O(r)?pR(e,r,o):o}function oo(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return Fe(r,n,o)}function ui(e){return(...r)=>{let[n,o,i]=ie.Match(r,{3:(a,c,l)=>[a,c,l],2:(a,c)=>[{},a,c]});return e.reduce((a,c)=>c(n,o,a),i)}}function fF(e,r,n){return r["~codec"].decode(n)}function gF(e,r,n){return r["~codec"].encode(n)}function Re(e,r,n,o){return Un(n)?s.IsEqual(e,"Decode")?fF(r,n,o):gF(r,n,o):o}function yF(e,r,n,o){if(!s.IsArray(o))return H();for(let i=0;i<o.length;i++)o[i]=Te(e,r,n.items,o[i]);return Re(e,r,n,o)}function hF(e,r,n,o){let i=Re(e,r,n,o);if(!s.IsArray(i))return i;for(let a=0;a<i.length;a++)i[a]=Te(e,r,n.items,i[a]);return i}function uR(e,r,n,o){return s.IsEqual(e,"Decode")?yF(e,r,n,o):hF(e,r,n,o)}function lR(e,r,n,o){return o=Te(e,{...r,...n.$defs},Le(n.$ref),o),Re(e,r,n,o)}function TF(e,r,n,o){for(let i of n.allOf)o=Te(e,r,i,o);return Re(e,r,n,o)}function EF(e,r,n,o){let i=Re(e,r,n,o);for(let a of n.allOf)i=Te(e,r,a,i);return i}function mR(e,r,n,o){return s.IsEqual(e,"Decode")?TF(e,r,n,o):EF(e,r,n,o)}function _F(e,r,n,o){if(!s.IsObjectNotArray(o))return H();for(let i of s.Keys(n.properties))!s.HasPropertyKey(o,i)||Wa(n.properties[i],i,o)||(o[i]=Te(e,r,n.properties[i],o[i]));return Re(e,r,n,o)}function IF(e,r,n,o){let i=Re(e,r,n,o);if(!s.IsObjectNotArray(i))return i;for(let a of s.Keys(n.properties))!s.HasPropertyKey(i,a)||Wa(n.properties[a],a,i)||(i[a]=Te(e,r,n.properties[a],i[a]));return i}function dR(e,r,n,o){return s.IsEqual(e,"Decode")?_F(e,r,n,o):IF(e,r,n,o)}function bF(e,r,n,o){if(!s.IsObjectNotArray(o))return H();let i=new RegExp(xt(n));for(let a of s.Keys(o))i.test(a)||H(),o[a]=Te(e,r,rt(n),o[a]);return Re(e,r,n,o)}function SF(e,r,n,o){let i=Re(e,r,n,o);if(!s.IsObjectNotArray(i))return i;let a=new RegExp(xt(n));for(let c of s.Keys(i))a.test(c)&&(i[c]=Te(e,r,rt(n),i[c]));return i}function fR(e,r,n,o){return s.IsEqual(e,"Decode")?bF(e,r,n,o):SF(e,r,n,o)}function gR(e,r,n,o){return o=s.HasPropertyKey(r,n.$ref)?Te(e,r,r[n.$ref],o):o,Re(e,r,n,o)}function OF(e,r,n,o){if(!s.IsArray(o))return H();for(let i=0;i<Math.min(n.items.length,o.length);i++)o[i]=Te(e,r,n.items[i],o[i]);return Re(e,r,n,o)}function AF(e,r,n,o){let i=Re(e,r,n,o);if(!s.IsArray(i))return o;for(let a=0;a<Math.min(n.items.length,i.length);a++)i[a]=Te(e,r,n.items[a],i[a]);return i}function yR(e,r,n,o){return s.IsEqual(e,"Decode")?OF(e,r,n,o):AF(e,r,n,o)}function xF(e,r,n,o){for(let i of n.anyOf){if(!de(r,i,o))continue;let a=Te(e,r,i,o);return Re(e,r,n,a)}return H()}function RF(e,r,n,o){let i=Re(e,r,n,o);for(let a of n.anyOf){let c=Te(e,r,a,ge(i));if(de(r,a,c))return c}return i}function hR(e,r,n,o){return s.IsEqual(e,"Decode")?xF(e,r,n,o):RF(e,r,n,o)}function Te(e,r,n,o){return te(n)?uR(e,r,n,o):me(n)?lR(e,r,n,o):w(n)?mR(e,r,n,o):k(n)?dR(e,r,n,o):Se(n)?fR(e,r,n,o):pe(n)?gR(e,r,n,o):V(n)?yR(e,r,n,o):O(n)?hR(e,r,n,o):Re(e,r,n,o)}var Od=class extends yn{constructor(r,n){super("Decode",r,n)}};function CF(e,r,n){if(!de(e,r,n))throw new Od(n,gn(e,r,n));return n}function PF(e,r,n){return Te("Decode",e,r,n)}var xFe=ui([(e,r,n)=>ge(n),(e,r,n)=>oo(e,r,n),(e,r,n)=>hn(e,r,n),(e,r,n)=>ro(e,r,n),(e,r,n)=>CF(e,r,n),(e,r,n)=>PF(e,r,n)]);var Ad=class extends yn{constructor(r,n){super("Encode",r,n)}};function UF(e,r,n){if(!de(e,r,n))throw new Ad(n,gn(e,r,n));return n}function wF(e,r,n){return Te("Encode",e,r,n)}var GFe=ui([(e,r,n)=>ge(n),(e,r,n)=>wF(e,r,n),(e,r,n)=>oo(e,r,n),(e,r,n)=>hn(e,r,n),(e,r,n)=>ro(e,r,n),(e,r,n)=>UF(e,r,n)]);var $t=class extends Error{constructor(r,n){super(n),this.type=r}};function TR(e,r){return s.IsFunction(r.default)?r.default(r):s.IsObject(r.default)?ge(r.default):r.default}function ER(e,r){if(si(r)&&!vt(r))throw new $t(r,"Arrays with uniqueItems constraints must specify a default annotation");let n=ii(r)?r.minItems:0;return Array.from({length:n},()=>Ee(e,r.items))}async function*NF(){}function _R(e,r){return NF()}function IR(e,r){return r.Create()}function bR(e,r){return Ur(r)?BigInt(r.exclusiveMinimum)+BigInt(1):wr(r)?BigInt(r.minimum):BigInt(0)}function SR(e,r){return!1}function OR(e,r){let n=Ee(e,r.instanceType);return class{constructor(){Object.assign(this,n)}}}function AR(e,r){return Ee({...e,...r.$defs},Le(r.$ref))}function xR(e,r){return Ee(e,kn(r))}function RR(e,r){let n=Ee(e,r.returnType);return()=>n}function CR(e,r){return Ur(r)&&s.IsNumber(r.exclusiveMinimum)?r.exclusiveMinimum+1:wr(r)?r.minimum:0}function PR(e,r){return Ee(e,Kt(r))}function*LF(){}function UR(e,r){return LF()}function wR(e,r){return r.const}function NR(e,r){throw new $t(r,"Cannot create TNever types")}function LR(e,r){return null}function vR(e,r){return Ur(r)&&s.IsNumber(r.exclusiveMinimum)?r.exclusiveMinimum+1:wr(r)?r.minimum:0}function kR(e,r){return(s.IsUndefined(r.required)?[]:r.required).reduce((o,i)=>({...o,[i]:Ee(e,r.properties[i])}),{})}function MR(e,r){return Promise.resolve(Ee(e,r.item))}function DR(e,r){if(Ba(r)&&!vt(r))throw new $t(r,"Record with the minProperties constraint must have a default annotation");return{}}function GR(e,r){return s.HasPropertyKey(e,r.$ref)?Ee(e,e[r.$ref]):(()=>{throw new $t(r,"Unable to deref Ref")})()}function $R(e,r){if((Fa(r)||ja(r))&&!vt(r))throw Error("Strings with format or pattern constraints must specify default");let o=qa(r)?r.minLength:0;return"".padEnd(o)}function jR(e,r){return Symbol()}function qR(e,r){let n=nt(r.pattern);if(ve(n))throw new $t(r,"Unable to create TemplateLiteral due to infinite type expansion");return Ee(e,n)}function BR(e,r){return Array.from({length:r.minItems},(n,o)=>Ee(e,r.items[o]))}function FR(e,r){if(s.IsEqual(r.anyOf.length,0))throw Error("Unable to create Union with no variants");return Ee(e,r.anyOf[0])}function Ee(e,r){return vt(r)?TR(e,r):te(r)?ER(e,r):at(r)?_R(e,r):Ut(r)?IR(e,r):At(r)?bR(e,r):lt(r)?SR(e,r):$e(r)?OR(e,r):me(r)?AR(e,r):Ue(r)?xR(e,r):je(r)?RR(e,r):He(r)?CR(e,r):w(r)?PR(e,r):st(r)?UR(e,r):X(r)?wR(e,r):hr(r)?NR(e,r):tr(r)?LR(e,r):be(r)?vR(e,r):k(r)?kR(e,r):tt(r)?MR(e,r):Se(r)?DR(e,r):pe(r)?GR(e,r):ve(r)?$R(e,r):rr(r)?jR(e,r):we(r)?qR(e,r):V(r)?BR(e,r):or(r)?void 0:O(r)?FR(e,r):Rt(r)?void 0:void 0}function mr(...e){let[r,n]=ie.Match(e,{2:(o,i)=>[o,i],1:o=>[{},o]});return Ee(r,n)}var xd=class extends yn{constructor(r,n){super("Parse",r,n)}};function vF(e,r,n){if(!de(e,r,n))throw new xd(n,gn(e,r,n));return n}var FKe=ui([(e,r,n)=>ge(n),(e,r,n)=>oo(e,r,n),(e,r,n)=>hn(e,r,n),(e,r,n)=>ro(e,r,n),(e,r,n)=>vF(e,r,n)]);var MF=N({type:Y("insert"),path:bt(),value:Je()}),DF=Object({type:Y("update"),path:bt(),value:Je()}),GF=N({type:Y("delete"),path:bt()}),WKe=q([MF,DF,GF]);function li(e){if(!e.body)throw new Error("This command does not accept a request body");let r=e.body;return r.examples?.length?r.examples[0]:mr(r)}function io(e,r,n,o,i){e.command(r).description(n).option("-f, --file <FILE_PATH>","Read body from file (use - for stdin)").option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async a=>{if(a.generateSkeleton){Q(li(o));return}let c=ni(a),l=await i()(o,{body:c});Q(l)})}function zR(e,r){let n=e.command("grok").description("Test and preview grok parsing rules");io(n,"parse","Parse sample log lines with grok rules and return the extracted fields",WO,r)}var YR=require("node:child_process"),VR=require("node:fs"),QR=require("node:os"),Ip=require("node:path");var ao=require("node:fs");function Za(e,r){let n=`${e}.tmp.${process.pid}`;(0,ao.writeFileSync)(n,r),(0,ao.renameSync)(n,e)}function Xa(e){try{return(0,ao.readFileSync)(e,"utf8")}catch(r){if(r.code==="ENOENT")return;throw r}}function Ja(e,r){if(r===void 0)return;let n=`${e}.bak.${new Date().toISOString().replaceAll(":","-")}`;return(0,ao.writeFileSync)(n,r),n}function so(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Cd="tsuga-dev/agent-plugins",Ep="tsuga";function _p(e,r){B(` $ ${e} ${r.join(" ")}`);try{(0,YR.execFileSync)(e,r,{stdio:["ignore","inherit","inherit"]})}catch(n){let o=n.status??1;throw new Error(`${e} ${r.join(" ")} exited ${o}`,{cause:n})}}function BF(e,r){B("Claude Code \u2192 installing Tsuga plugin"),_p("claude",["plugin","marketplace","add",Cd]),_p("claude",["plugin","install",`tsuga@${Ep}`]),r.autoUpdate&&FF(e)}function FF(e){let r=(0,Ip.join)(e,".claude","settings.json");B(`Claude Code \u2192 ${r} (autoUpdate)`),(0,VR.mkdirSync)((0,Ip.dirname)(r),{recursive:!0});let n=Xa(r),o=JSON.parse(n??"{}");if(!so(o))throw new Error(`${r} must contain a JSON object`);let i=o.extraKnownMarketplaces??{};if(!so(i))throw new Error(`${r} "extraKnownMarketplaces" must be a JSON object`);let a=i[Ep],c=so(a)?a:{};o.extraKnownMarketplaces={...i,[Ep]:{source:{source:"github",repo:Cd},...c,autoUpdate:!0}};let l=Ja(r,n);Za(r,`${JSON.stringify(o,null,2)}
|
|
139
|
-
`),B(l===void 0?" created":` patched (backup: ${l})`)}function HF(){B("Codex \u2192 installing Tsuga plugin"),_p("codex",["plugin","marketplace","add",Cd]),_p("codex",["plugin","add",`tsuga@${Ep}`])}function WR(e){let r=e.command("install").description("Install Tsuga plugins into local LLM CLIs").command("plugin").description("Install the Tsuga plugin into a specific LLM CLI");r.command("claude-code").description("Install the Tsuga plugin into Claude Code (requires the claude CLI in PATH)").option("--no-auto-update","Skip patching ~/.claude/settings.json with autoUpdate=true").action(n=>{BF((0,QR.homedir)(),n),B("Restart your claude session to load the new plugins.")}),r.command("codex").description("Install the Tsuga plugin into Codex (requires the codex CLI in PATH)").action(()=>{HF(),B("Restart your codex session to load the new plugins.")})}var Qt="/v0/kubernetes-explorer",KF="^[a-z0-9.-]+$",zF="^[A-Za-z0-9._-]+$",ZR=256,XR=t.Optional(p({allowEmpty:!1,description:"Tsuga cluster ID to target. Tsuga assigns it when a cluster is connected to the organization. Optional for single-cluster organizations and required for organizations with multiple clusters to scope the request to one cluster."}));var dr=e=>t.Optional(t.Array(p({allowEmpty:!1}),{description:e})),JR={clusterId:XR,search:t.Optional(t.String({pattern:KF,minLength:1,maxLength:ZR,description:"Substring matched against the resource name. Kubernetes names are lowercase RFC 1123, so only lowercase letters, digits, `.` and `-` are accepted; uppercase and other characters are rejected. Wildcard and other query-syntax characters are treated literally."}))},eC={clusterId:XR,search:t.Optional(t.String({pattern:zF,minLength:1,maxLength:ZR,description:"Substring matched against the Kubernetes cluster name. Unlike Kubernetes resource names this is a collector-assigned identifier, so uppercase letters, digits, `.`, `-` and `_` are accepted. Wildcard and other query-syntax characters are treated literally."}))},tC=t.Object(JR),rC=t.Object(eC),es={...JR,includeInternalNamespaces:t.Optional(t.Boolean({description:"When false or omitted, resources in internal namespaces (kube-system, kube-public, kube-node-lease, local-path-storage, gke-managed-*) are excluded."})),clusters:dr("Restrict results to these Kubernetes cluster names."),namespaces:dr("Restrict results to these namespaces."),teams:dr("Restrict results to these team names."),envs:dr("Restrict results to these environments."),...ye},nC=["Pending","Running","Succeeded","Failed","Unknown","CrashLoopBackOff","Error"],YF={...es,nodes:dr("Restrict results to pods scheduled on these nodes."),deployments:dr("Restrict results to pods owned by these Deployments."),statefulsets:dr("Restrict results to pods owned by these StatefulSets."),daemonsets:dr("Restrict results to pods owned by these DaemonSets."),podStatus:t.Optional(t.Array(t.Enum(nC),{description:"Restrict results to pods whose resolved status matches any of these values. Includes the five Kubernetes phases plus Tsuga-derived CrashLoopBackOff and Error. Applied after stitching pod phase and container status reason telemetry, because phase is not a filterable metric attribute."}))},mi=t.Enum(["asc","desc"],{description:"Sort direction. Defaults to ascending."}),VF=["deployment","statefulset","daemonset"],oC=t.Object({kind:t.Enum(VF,{description:"Kind of Kubernetes workload associated with the pod. Derived from workload attributes in pod telemetry."}),name:t.String({description:"Name of the workload associated with the pod. Derived from workload attributes in pod telemetry."})},{description:"Kubernetes workload controller that owns the pod. Present when workload attributes are observed in pod telemetry."}),iC=t.Object({podName:t.String({description:"Name of the Kubernetes pod. Set when the pod is created."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the pod. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that reported the pod. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the pod. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the pod, such as production or staging. Present when an environment label or mapping is observed."})),node:t.Optional(t.String({description:"Kubernetes node currently or most recently running the pod. Present when node telemetry is observed."})),phase:t.Enum(nC,{description:"Current or most recently observed pod status. From pod status and container state telemetry. Values include the Kubernetes phases Pending, Running, Succeeded, Failed, and Unknown, plus Tsuga-derived CrashLoopBackOff and Error values."}),readyContainers:t.Integer({description:"Number of containers in the pod that are currently ready. From container readiness telemetry. Zero or greater."}),totalContainers:t.Integer({description:"Number of observed containers for the pod based on container readiness telemetry. Zero or greater."}),restarts:t.Integer({description:"Total restart count across containers in the pod. From container restart telemetry. Zero or greater."}),createdAt:t.Optional(E({description:"Timestamp from pod start time telemetry for the selected pod instance. Present when pod start time telemetry is observed."}))}),Pd=t.Object({...iC.properties,workload:t.Optional(oC),cpuUsageMilli:t.Optional(t.Number({description:"Recent pod CPU usage in millicores. Present when CPU usage telemetry is observed."})),cpuLimitMilli:t.Optional(t.Number({description:"Configured pod CPU limit in millicores, summed across observed containers. Present when a CPU limit is configured and observed."})),cpuRequestMilli:t.Optional(t.Number({description:"Configured pod CPU request in millicores, summed across observed containers. Present when a CPU request is configured and observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent pod memory usage in bytes. Present when memory usage telemetry is observed."})),memoryLimitBytes:t.Optional(t.Number({description:"Configured pod memory limit in bytes, summed across observed containers. Present when a memory limit is configured and observed."})),memoryRequestBytes:t.Optional(t.Number({description:"Configured pod memory request in bytes, summed across observed containers. Present when a memory request is configured and observed."})),cpuUtilization:t.Optional(t.Number({description:"Recent CPU usage divided by the configured CPU limit. Present when both usage and limit are observed."})),memoryUtilization:t.Optional(t.Number({description:"Recent memory usage divided by the configured memory limit. Present when both usage and limit are observed."})),cpuRequestUtilization:t.Optional(t.Number({description:"Recent CPU usage divided by the configured CPU request. Present when both usage and request are observed."})),memoryRequestUtilization:t.Optional(t.Number({description:"Recent memory usage divided by the configured memory request. Present when both usage and request are observed."}))}),QF=["podName","namespace","cluster","team","env","node","phase","restarts","cpuUsageMilli","cpuUtilization","cpuRequestUtilization","memoryUsageBytes","memoryUtilization","memoryRequestUtilization","createdAt"],F9e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/pods`,query:t.Object({...YF,sortBy:t.Optional(t.Enum(QF,{description:"Field to sort pods by."})),sortDirection:t.Optional(mi)}),paginated:!0,response:t.Array(Pd)}),Ud=t.Object({cluster:t.String({description:"Kubernetes cluster name from cluster telemetry."}),teams:t.Optional(t.Array(t.String(),{description:"Team metadata values observed on pods in non-default Kubernetes namespaces on the cluster. Present when team labels or mappings are observed."})),envs:t.Optional(t.Array(t.String(),{description:"Environment metadata values observed on pods in non-default Kubernetes namespaces on the cluster. Present when environment labels or mappings are observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Aggregate recent CPU usage for observed pods in the cluster, excluding default Kubernetes namespaces, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Aggregate recent memory usage for observed pods in the cluster, excluding default Kubernetes namespaces, in bytes. Present when memory usage telemetry is observed."})),readyNodes:t.Optional(t.Integer({description:"Number of Kubernetes nodes in the cluster that are ready. Present when node readiness telemetry is observed."})),podPhaseCounts:t.Optional(t.Object({Pending:t.Integer({description:"Number of observed pods currently in the Pending phase."}),Running:t.Integer({description:"Number of observed pods currently in the Running phase."}),Succeeded:t.Integer({description:"Number of observed pods currently in the Succeeded phase."}),Failed:t.Integer({description:"Number of observed pods currently in the Failed phase."}),Unknown:t.Integer({description:"Number of observed pods currently in the Unknown phase."})},{description:"Counts of observed pods by Kubernetes phase, excluding default Kubernetes namespaces. Present when pod phase telemetry is observed."}))}),WF=["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes"],H9e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/clusters`,query:t.Object({...eC,teams:dr("Restrict to clusters that host workloads from these team names."),envs:dr("Restrict to clusters that host workloads in these environments."),sortBy:t.Optional(t.Enum(WF,{description:"Field to sort clusters by."})),sortDirection:t.Optional(mi),...ye}),paginated:!0,response:t.Array(Ud)}),wd=t.Object({namespace:t.String({description:"Kubernetes namespace name from namespace telemetry. Includes namespaces with no observed pods when namespace telemetry is observed."}),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the namespace. Present when cluster telemetry is observed."})),teams:t.Optional(t.Array(t.String(),{description:"Team metadata values observed in workloads in the namespace. Present when team labels or mappings are observed."})),envs:t.Optional(t.Array(t.String(),{description:"Environment metadata values observed in workloads in the namespace. Present when environment labels or mappings are observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods in the namespace. Present when pod telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Aggregate recent CPU usage for observed pods in the namespace, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Aggregate recent memory usage for observed pods in the namespace, in bytes. Present when memory usage telemetry is observed."}))}),ZF=["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],K9e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/namespaces`,query:t.Object({...es,sortBy:t.Optional(t.Enum(ZF,{description:"Field to sort namespaces by."})),sortDirection:t.Optional(mi)}),paginated:!0,response:t.Array(wd)}),Nd=t.Object({deployment:t.String({description:"Kubernetes Deployment name from workload telemetry."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the Deployment. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the Deployment. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the Deployment. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the Deployment. Present when an environment label or mapping is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods associated with the Deployment. Present when pod telemetry and workload attributes are observed."})),availableReplicas:t.Optional(t.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:t.Optional(t.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent aggregate CPU usage for observed Deployment pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent aggregate memory usage for observed Deployment pods, in bytes. Present when memory usage telemetry is observed."}))}),XF=["deployment","namespace","cluster","team","env","pods","availableReplicas","cpuUsageMilli","memoryUsageBytes"],z9e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/deployments`,query:t.Object({...es,sortBy:t.Optional(t.Enum(XF,{description:"Field to sort deployments by."})),sortDirection:t.Optional(mi)}),paginated:!0,response:t.Array(Nd)}),Ld=t.Object({statefulSet:t.String({description:"Kubernetes StatefulSet name from workload telemetry."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the StatefulSet. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the StatefulSet. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the StatefulSet. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the StatefulSet. Present when an environment label or mapping is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods associated with the StatefulSet. Present when pod telemetry and workload attributes are observed."})),readyReplicas:t.Optional(t.Integer({description:"Number of ready StatefulSet replicas from StatefulSet status telemetry. Present when StatefulSet status is observed."})),desiredReplicas:t.Optional(t.Integer({description:"Desired replica count configured for the StatefulSet. Present when StatefulSet spec telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent aggregate CPU usage for observed StatefulSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent aggregate memory usage for observed StatefulSet pods, in bytes. Present when memory usage telemetry is observed."}))}),JF=["statefulSet","namespace","cluster","team","env","pods","cpuUsageMilli","memoryUsageBytes"],Y9e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/statefulsets`,query:t.Object({...es,sortBy:t.Optional(t.Enum(JF,{description:"Field to sort StatefulSets by."})),sortDirection:t.Optional(mi)}),paginated:!0,response:t.Array(Ld)}),vd=t.Object({daemonSet:t.String({description:"Kubernetes DaemonSet name from workload telemetry."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the DaemonSet. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the DaemonSet. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the DaemonSet. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the DaemonSet. Present when an environment label or mapping is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods associated with the DaemonSet. Present when pod telemetry and workload attributes are observed."})),readyNodes:t.Optional(t.Integer({description:"Number of eligible nodes with a ready DaemonSet pod. Present when DaemonSet status telemetry is observed."})),desiredNodes:t.Optional(t.Integer({description:"Number of eligible nodes where the DaemonSet should run a pod. Present when DaemonSet status telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent aggregate CPU usage for observed DaemonSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent aggregate memory usage for observed DaemonSet pods, in bytes. Present when memory usage telemetry is observed."}))}),eH=["daemonSet","namespace","cluster","team","env","pods","readyNodes","cpuUsageMilli","memoryUsageBytes"],V9e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/daemonsets`,query:t.Object({...es,sortBy:t.Optional(t.Enum(eH,{description:"Field to sort DaemonSets by."})),sortDirection:t.Optional(mi)}),paginated:!0,response:t.Array(vd)}),kd=t.Object({overview:t.Object({...iC.properties,workload:t.Optional(oC)},{description:"Pod identity, status, and owning workload, derived from recent pod metrics."}),healthMetrics:t.Object({cpu:t.Object({usage:t.String({description:"Metric name callers can use to query pod CPU usage. This is not the current CPU value."}),limit:t.String({description:"Metric name callers can use to query configured container CPU limits for the pod. This is not the current CPU limit value."}),request:t.String({description:"Metric name callers can use to query configured container CPU requests for the pod. This is not the current CPU request value."})},{description:"Metric names for pod CPU usage and for configured container CPU limits and requests."}),memory:t.Object({usage:t.String({description:"Metric name callers can use to query pod memory usage. This is not the current memory value."}),limit:t.String({description:"Metric name callers can use to query configured container memory limits for the pod. This is not the current memory limit value."}),request:t.String({description:"Metric name callers can use to query configured container memory requests for the pod. This is not the current memory request value."})},{description:"Metric names for pod memory usage and for configured container memory limits and requests."})},{description:"Metric names callers can use to query pod CPU and memory telemetry. These are fixed metric identifiers, not current values."}),searchFilters:t.Object({logs:t.String({description:"TQL log search filter scoped to this pod. Built from cluster, namespace, and pod identifiers."}),traces:t.String({description:"TQL trace search filter scoped to this pod. Built from cluster, namespace, and pod identifiers."})},{description:"TQL filters scoped to this pod, ready to use as the query for log and trace search."})}),aC=t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),podName:p({allowEmpty:!1})}),Q9e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/pod-details`,query:aC,response:kd}),Md=t.Object({configuration:t.Optional(t.Object({spec:t.Record(t.String(),t.Unknown(),{description:"Kubernetes PodSpec from the latest observed pod manifest. Fields outside `object.spec` are stripped."}),lastObservedAt:E({description:"Timestamp when Tsuga last observed the pod manifest used for configuration."})},{description:"Pod configuration from the latest observed pod manifest. Present when a pod manifest log is found for the pod."})),labels:t.Record(t.String(),t.String(),{description:"Kubernetes labels on the pod from the latest observed pod manifest. Key-value strings."}),annotations:t.Record(t.String(),t.String(),{description:"Kubernetes annotations on the pod from the latest observed pod manifest. Key-value strings."}),deletedAt:t.Optional(E({description:"Timestamp when Tsuga last observed the pod deletion event. Present when the latest observed pod event is deleted."}))}),W9e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/pod-manifest`,query:aC,response:Md}),Dd=t.Object({podName:t.String({description:"Name of a pod instance associated with the workload. Resolved from recent pod usage telemetry and workload attributes."}),podUid:t.Optional(t.String({description:"Kubernetes UID for the pod replica. Present when UID telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent CPU usage for the pod replica, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent memory usage for the pod replica, in bytes. Present when memory usage telemetry is observed."}))},{description:"A single pod instance with recent CPU or memory telemetry for the workload, resolved from pod usage telemetry and workload attributes."}),Gd=t.Object({overview:t.Object({deploymentName:t.String({description:"Kubernetes Deployment name for this detail response."}),namespace:t.Optional(t.String({description:"Kubernetes namespace for this detail response. Present when any deployment signal is found."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name for this detail response. Present when any deployment signal is found."})),team:t.Optional(t.String({description:"Team metadata from the Deployment available-replica metric. Present when the metric includes team metadata."})),env:t.Optional(t.String({description:"Environment metadata from the Deployment available-replica metric. Present when the metric includes environment metadata."})),availableReplicas:t.Optional(t.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:t.Optional(t.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),latestRevisionAt:t.Optional(E({description:"Latest ReplicaSet metadata.creationTimestamp observed for the Deployment. Present when ReplicaSet object telemetry is observed."}))}),podReplicas:t.Array(Dd,{description:"Pod instances with recent CPU or memory telemetry for the Deployment. Tsuga builds this list from pod usage telemetry and workload attributes. Empty when no matching pod usage telemetry is observed."}),revisions:t.Array(t.Object({replicaSetName:t.String({description:"ReplicaSet name for a Deployment revision from workload telemetry."}),revision:t.Integer({description:"Deployment revision number from ReplicaSet annotations. Integer greater than or equal to zero."}),firstSeen:t.Optional(E({description:"ReplicaSet metadata.creationTimestamp from the latest observed ReplicaSet object. Present when creation time is observed."})),observedGeneration:t.Optional(t.Integer({description:"Latest generation observed for the ReplicaSet revision. Present when generation telemetry is observed."})),readyReplicas:t.Optional(t.Integer({description:"Number of ready replicas for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),replicas:t.Optional(t.Integer({description:"Total replica count for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),logsSearchFilter:t.String({description:"TQL log search filter scoped to this ReplicaSet revision. Built from cluster, namespace, and ReplicaSet identifiers."})}),{description:"Deployment rollout revisions from recent ReplicaSet object telemetry. Includes the latest observed event per ReplicaSet, excludes ReplicaSets whose latest observed spec.replicas is 0, and returns up to 8 revisions sorted by revision number descending."})}),Z9e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/deployment-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),deploymentName:p({allowEmpty:!1})}),response:Gd}),tH=t.Object({overview:t.Object({statefulSetName:t.String(),namespace:t.Optional(t.String()),cluster:t.Optional(t.String()),team:t.Optional(t.String()),env:t.Optional(t.String()),readyReplicas:t.Optional(t.Integer()),desiredReplicas:t.Optional(t.Integer()),latestRevisionAt:t.Optional(E())}),podReplicas:t.Array(Dd,{description:"Pod instances with recent CPU or memory telemetry for the StatefulSet. Tsuga builds this list from pod usage telemetry and workload attributes. Empty when no matching pod usage telemetry is observed."}),revisions:t.Array(t.Object({revisionName:t.String(),firstSeen:t.Optional(E())}))}),X9e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/statefulset-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),statefulSetName:p({allowEmpty:!1})}),response:tH}),rH=t.Object({overview:t.Object({daemonSetName:t.String(),namespace:t.Optional(t.String()),cluster:t.Optional(t.String()),team:t.Optional(t.String()),env:t.Optional(t.String()),readyNodes:t.Optional(t.Integer()),desiredNodes:t.Optional(t.Integer()),latestRevisionAt:t.Optional(E())}),podReplicas:t.Array(Dd,{description:"Pod instances with recent CPU or memory telemetry for the DaemonSet. Tsuga builds this list from pod usage telemetry and workload attributes. Empty when no matching pod usage telemetry is observed."}),revisions:t.Array(t.Object({observedGeneration:t.Integer(),firstSeen:t.Optional(E())}))}),J9e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/daemonset-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),daemonSetName:p({allowEmpty:!1})}),response:rH});var vr=`/${"v1"}/kubernetes-explorer`,sC=t.Pick(Pd,["podName","namespace","cluster","team","env","node","phase","readyContainers","totalContainers","restarts","createdAt","workload","cpuUsageMilli","cpuLimitMilli","memoryUsageBytes","memoryLimitBytes","cpuUtilization","memoryUtilization"],{description:"A Kubernetes pod with its current phase, owning workload, and resource usage."}),nH={podName:"api-gateway-7d9f8c6b5-2xk4p",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",node:"ip-10-0-1-23.ec2.internal",phase:"Running",readyContainers:1,totalContainers:1,restarts:0,createdAt:"2024-01-15T12:34:56.000Z",workload:{kind:"deployment",name:"api-gateway"},cpuUsageMilli:125,cpuLimitMilli:500,memoryUsageBytes:134217728,memoryLimitBytes:536870912,cpuUtilization:.25,memoryUtilization:.25};Object.assign(sC,{examples:[nH]});var cC=t.Pick(Ud,["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes","podPhaseCounts"],{description:"A Kubernetes cluster with aggregate resource usage, node readiness, and pod phase counts."}),oH={cluster:"prod-us-east",teams:["platform","payments"],envs:["production"],cpuUsageMilli:4200,memoryUsageBytes:8589934592,readyNodes:6,podPhaseCounts:{Pending:1,Running:42,Succeeded:3,Failed:0,Unknown:0}};Object.assign(cC,{examples:[oH]});var pC=t.Pick(wd,["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes namespace with pod count and aggregate resource usage."}),iH={namespace:"production",cluster:"prod-us-east",teams:["platform"],envs:["production"],pods:24,cpuUsageMilli:1800,memoryUsageBytes:3221225472};Object.assign(pC,{examples:[iH]});var uC=t.Pick(Nd,["deployment","namespace","cluster","team","env","pods","availableReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes deployment with replica counts and aggregate resource usage."}),aH={deployment:"api-gateway",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,availableReplicas:3,desiredReplicas:3,cpuUsageMilli:375,memoryUsageBytes:402653184};Object.assign(uC,{examples:[aH]});var lC=t.Pick(Ld,["statefulSet","namespace","cluster","team","env","pods","readyReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes StatefulSet with replica counts and aggregate resource usage."}),sH={statefulSet:"postgres",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,readyReplicas:3,desiredReplicas:3,cpuUsageMilli:900,memoryUsageBytes:2147483648};Object.assign(lC,{examples:[sH]});var mC=t.Pick(vd,["daemonSet","namespace","cluster","team","env","pods","readyNodes","desiredNodes","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes DaemonSet with eligible-node readiness and aggregate resource usage."}),cH={daemonSet:"otel-collector",namespace:"observability",cluster:"prod-us-east",team:"platform",env:"production",pods:6,readyNodes:6,desiredNodes:6,cpuUsageMilli:300,memoryUsageBytes:805306368};Object.assign(mC,{examples:[cH]});var dC=t.Pick(kd,["overview","healthMetrics","searchFilters"],{description:"Metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and log/trace filters."}),pH={overview:{podName:"api-gateway-7d9f8c6b5-2xk4p",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",node:"ip-10-0-1-23.ec2.internal",phase:"Running",readyContainers:1,totalContainers:1,restarts:0,createdAt:"2024-01-15T12:34:56.000Z",workload:{kind:"deployment",name:"api-gateway"}},healthMetrics:{cpu:{usage:"k8s.pod.cpu.usage",limit:"k8s.container.cpu_limit",request:"k8s.container.cpu_request"},memory:{usage:"k8s.pod.memory.usage",limit:"k8s.container.memory_limit",request:"k8s.container.memory_request"}},searchFilters:{logs:'context.k8s.cluster.name:"prod-us-east" AND context.k8s.namespace.name:"production" AND context.k8s.pod.name:"api-gateway-7d9f8c6b5-2xk4p"',traces:'context.k8s.cluster.name:"prod-us-east" AND context.k8s.namespace.name:"production" AND context.k8s.pod.name:"api-gateway-7d9f8c6b5-2xk4p"'}};Object.assign(dC,{examples:[pH]});var fC=t.Pick(Md,["configuration","labels","annotations","deletedAt"],{description:"Manifest-derived details for a single Kubernetes pod: the pod manifest spec, labels, and annotations from the pod's most recently observed manifest."}),uH={configuration:{spec:{restartPolicy:"Always",serviceAccountName:"api-gateway"},lastObservedAt:"2024-01-15T12:30:00.000Z"},labels:{app:"api-gateway","pod-template-hash":"7d9f8c6b5"},annotations:{"prometheus.io/scrape":"true"}};Object.assign(fC,{examples:[uH]});var gC=t.Pick(Gd,["overview","podReplicas","revisions"],{description:"Detailed information for a single Kubernetes deployment: replica status, backing pods, and rollout revisions."}),lH={overview:{deploymentName:"api-gateway",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",availableReplicas:3,desiredReplicas:3,latestRevisionAt:"2024-01-15T12:00:00.000Z"},podReplicas:[{podName:"api-gateway-7d9f8c6b5-2xk4p",podUid:"a1b2c3d4-e5f6-7890-abcd-ef1234567890",cpuUsageMilli:125,memoryUsageBytes:134217728}],revisions:[{replicaSetName:"api-gateway-7d9f8c6b5",revision:7,firstSeen:"2024-01-15T12:00:00.000Z",observedGeneration:7,readyReplicas:3,replicas:3,logsSearchFilter:'context.k8s.cluster.name:"prod-us-east" context.k8s.namespace.name:"production" context.k8s.replicaset.name:"api-gateway-7d9f8c6b5"'}]};Object.assign(gC,{examples:[lH]});var yC=t.Object({clusterId:t.Optional(p({allowEmpty:!1,description:"Tsuga cluster ID to target. Tsuga assigns it when a cluster is connected to the organization. Optional for single-cluster organizations and required for organizations with multiple clusters to scope the request to one cluster."}))}),ts=t.Pick(tC,["clusterId","search"]),mH=t.Pick(rC,["clusterId","search"]),hC=m({description:"Lists Kubernetes pods observed across the organization with their current phase, owning workload, and resource usage.",operationId:"listKubernetesPods",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/pods`,query:ts,response:t.Array(sC)}),TC=m({description:"Lists Kubernetes clusters observed across the organization with aggregate resource usage, node readiness, and pod phase counts.",operationId:"listKubernetesClusters",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/clusters`,query:mH,response:t.Array(cC)}),EC=m({description:"Lists Kubernetes namespaces observed across the organization with pod counts and aggregate resource usage.",operationId:"listKubernetesNamespaces",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/namespaces`,query:ts,response:t.Array(pC)}),_C=m({description:"Lists Kubernetes deployments observed across the organization with replica counts and aggregate resource usage.",operationId:"listKubernetesDeployments",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/deployments`,query:ts,response:t.Array(uC)}),IC=m({description:"Lists Kubernetes StatefulSets observed across the organization with replica counts and aggregate resource usage.",operationId:"listKubernetesStatefulSets",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/statefulsets`,query:ts,response:t.Array(lC)}),bC=m({description:"Lists Kubernetes DaemonSets observed across the organization with eligible-node readiness and aggregate resource usage.",operationId:"listKubernetesDaemonSets",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/daemonsets`,query:ts,response:t.Array(mC)}),SC=t.Object({...yC.properties,k8sCluster:p({allowEmpty:!1,description:"Kubernetes cluster name that contains the pod. From cluster telemetry. Required to identify the pod because pod names are only unique within a namespace and cluster."}),k8sNamespace:p({allowEmpty:!1,description:"Kubernetes namespace that contains the pod. From pod metadata. Required to identify the pod because pod names are only unique within a namespace and cluster."}),podName:p({allowEmpty:!1,description:"Kubernetes pod name to retrieve. Set when the pod is created. Required to fetch pod details for the selected cluster and namespace."})}),OC=m({description:"Retrieves metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and ready-to-use log and trace filters. Manifest configuration, labels, and annotations are served by the pod-manifest endpoint.",operationId:"getKubernetesPodDetails",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/pod-details`,query:SC,response:dC}),AC=m({description:"Retrieves the manifest-derived details for a single Kubernetes pod: the pod manifest spec, labels, and annotations from the pod's most recently observed manifest.",operationId:"getKubernetesPodManifest",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/pod-manifest`,query:SC,response:fC}),xC=m({description:"Retrieves detailed information for a single Kubernetes deployment: replica status, backing pods, and rollout revisions with ready-to-use log filters.",operationId:"getKubernetesDeploymentDetails",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/deployment-details`,query:t.Object({...yC.properties,k8sCluster:p({allowEmpty:!1,description:"Kubernetes cluster name that contains the Deployment. From cluster telemetry. Required to identify the Deployment because names are only unique within a namespace and cluster."}),k8sNamespace:p({allowEmpty:!1,description:"Kubernetes namespace that contains the Deployment. From workload metadata. Required to identify the Deployment because names are only unique within a namespace and cluster."}),deploymentName:p({allowEmpty:!1,description:"Kubernetes Deployment name to retrieve. From workload telemetry. Required to fetch deployment details for the selected cluster and namespace."})}),response:gC});var dH="clusterId";function RC(e,r,n){let o=r.query.properties??{},i=Object.keys(o).filter(a=>a!==dH);for(let a of i){let c=a.replace(/([A-Z])/g,"-$1").toLowerCase(),l=c.replace(/-/g,"_").toUpperCase(),d=o[a]?.description??"";n?e.requiredOption(`--${c} <${l}>`,d):e.option(`--${c} <${l}>`,d)}return i}function di(e,r,n,o){let i=e.command(r).description(n.description??`List Kubernetes ${r}`),a=RC(i,n,!1);i.action(async c=>{let l={};for(let d of a)c[d]!==void 0&&(l[d]=c[d]);Q(Object.keys(l).length>0?await o()(n,{query:l}):await o()(n))})}function $d(e,r,n,o){let i=e.command(r).description(n.description??`Get Kubernetes ${r}`),a=RC(i,n,!0);i.action(async c=>{let l={};for(let d of a)l[d]=c[d];Q(await o()(n,{query:l}))})}function CC(e,r){let n=e.command("kubernetes").description("Explore Kubernetes resources observed across the organization");di(n,"pods",hC,r),di(n,"clusters",TC,r),di(n,"namespaces",EC,r),di(n,"deployments",_C,r),di(n,"statefulsets",IC,r),di(n,"daemonsets",bC,r),$d(n,"pod-details",OC,r),$d(n,"pod-manifest",AC,r),$d(n,"deployment-details",xC,r)}var fH=t.Union([t.Literal("scalar"),t.Literal("timeseries")]),gH="/v0/promql",bp=t.Object({query:p({type:"long",allowEmpty:!1,description:"PromQL expression to evaluate."}),timeRange:Vo,step:p({allowEmpty:!1,description:"Evaluation step interval (e.g. `1m`, `5m`, `1h`). Must be a valid Prometheus duration string."}),returnType:t.Optional(fH),executionOptions:hl,shouldStreamResults:t.Optional(t.Boolean()),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster to target. Defaults to the first cluster created in the organization when omitted."}))}),yH={query:'rate({"otel.trace.span_processor.spans"}[5m])',timeRange:{from:17822015e5,to:17822034e5},step:"1m",executionOptions:{parallelism:1,engine:"q"},clusterId:"cluster-abc"};Object.assign(bp,{examples:[yH]});var y4e=m({tags:["promql"],url:gH,method:"POST",body:bp,response:Wc});var PC=`/${"v1"}/aggregation`,UC=t.Object({id:t.String({description:"Result identifier. Query results use `q1`, `q2`, and so on; formula results use `formula`."}),group:t.Record(t.String(),t.Union([t.String(),t.Number()]),{description:"Group-by field values for this result. Empty when no group-by is requested."})}),wC=t.Object({results:t.Array(t.Object({...UC.properties,value:t.Number({description:"Aggregated value for this query or formula and group, over the full time range."})},{title:"ScalarResult"}),{description:"One aggregated value per query or formula and group."})},{$id:"ScalarAggregationResponse",title:"ScalarAggregationResponse",description:"Scalar aggregation response with one value per query or formula and group."}),hH={results:[{id:"q1",group:{host:"server-1"},value:123.45}]};Object.assign(wC,{examples:[hH]});var Sp=t.Object({series:t.Array(t.Object({...UC.properties,points:t.Array(t.Object({timestamp:t.Integer({description:"Unix timestamp in milliseconds for this point, spaced by `aggregationWindow`."}),value:t.Number({description:"Aggregated value at this timestamp."})}),{description:"Ordered data points for this query or formula and group."})},{title:"Series"}),{description:"One time series per query or formula and group."})},{$id:"TimeseriesAggregationResponse",title:"TimeseriesAggregationResponse",description:"Timeseries aggregation response with timestamped points over time."}),TH={series:[{id:"q1",group:{host:"server-1"},points:[{timestamp:16094592e5,value:123.45},{timestamp:160945926e4,value:456.78}]}]};Object.assign(Sp,{examples:[TH]});var EH=t.Omit(wa.items,["fill"],{title:"AggregationQuery",description:"Aggregation query. Omit `filter` for an unfiltered query and omit `functions` when no post-processing is needed."}),_H=t.Optional(Ar),NC={timeRange:mt,queries:t.Array(EH,{maxItems:ep,description:`Aggregations that may be combined together in the same query. Each item is referenced from \`formula\` as q1, q2, and so on, in submission order. Limited to ${ep} items. For dataSource "metrics", each aggregate's \`field\` is the metric name, not an attribute; to count distinct values of an attribute use unique-count with field "<metricName>.context.<attribute>" (e.g. "system.cpu.utilization.context.host.name").`}),groupBy:_H,dataSource:kS,formula:t.Optional(Hn)},LC=t.Object({clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),vC=t.Object(NC,{description:"Scalar aggregation request. Provide a time range, one or more queries, a telemetry data source, and optional grouping or formula. Omit `groupBy` for ungrouped results. Send `clusterId` as a query parameter, not in the JSON body."}),IH={timeRange:{from:1782201500,to:1782203400},dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(vC,{examples:[IH]});var kC=m({description:"Runs one or more aggregation queries over logs, metrics, or traces and returns scalar values. Use optional group-by and formula fields to compute grouped or derived results. See [Analytics queries](/documentation/visualize/analytics/queries).",operationId:"aggregateScalar",tags:["public","aggregation"],url:`${PC}/multi-query/scalar`,method:"POST",body:vC,query:LC,response:wC}),MC=t.Object({...NC,aggregationWindow:p({description:"Time bucket size for timeseries aggregation, such as `10s`, `1m`, or `1h`."})},{description:"Timeseries aggregation request. Provide a time range, bucket size, one or more queries, a telemetry data source, and optional grouping or formula. Omit `groupBy` for ungrouped series. Send `clusterId` as a query parameter, not in the JSON body."}),bH={timeRange:{from:1782201500,to:1782203400},aggregationWindow:"1m",dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(MC,{examples:[bH]});var DC=m({description:"Runs one or more aggregation queries over logs, metrics, or traces and returns timestamped series. Use `aggregationWindow` to choose the time bucket size. See [Analytics queries](/documentation/visualize/analytics/queries).",operationId:"aggregateTimeseries",tags:["public","aggregation"],url:`${PC}/multi-query/timeseries`,method:"POST",body:MC,query:LC,response:Sp});var SH=`/${"v1"}/promql`,OH=t.Object({...t.Pick(bp,["query","step"]).properties,timeRange:mt},{description:"PromQL range-query request. Send clusterId as a query parameter, not in this JSON body.",examples:[{query:'sum by ("context.service.name") (sum_over_time({"traces.span.metrics.calls", "span.kind"="SPAN_KIND_SERVER"}[5m]))',timeRange:{from:1782201500,to:1782203400},step:"1m"}]}),AH=t.Object({clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to query. Set by the client as the clusterId query parameter, not in the JSON body. Required when the organization has multiple clusters; omit only for single-cluster organizations. Unknown cluster IDs return 404."}))}),GC=m({description:"Runs a PromQL range query over Tsuga metric data and returns timeseries results. Authenticate with a bearer operation API key or OAuth access token that can read metrics. Send clusterId as a query parameter; multi-cluster organizations must provide it. See [How to write PromQL queries](/documentation/visualize/guides/how-to-write-promql-queries) for query syntax and examples.",operationId:"queryPromql",tags:["public","promql"],url:SH,method:"POST",body:OH,query:AH,response:Sp});function $C(e,r){let n=e.command("promql").description("Run PromQL queries over metric data");io(n,"query","Run a PromQL range query over metric data",GC,r)}var kr="/v0/dashboards",qC=["white","gray.100","amber.200","lime.200","emerald.200","cyan.200","blue.200","violet.200","fuchsia.200","pink.200","red.200"],xH=["bar","distribution","gauge","heatmap","list","pie","query-value","table","timeseries","top-list"],z4e=[...xH,"note"];var RH=["ns","us","ms","s","m","h","days"];var CH=["B","KB","MB","GB","TB","PB"];var PH=20;var BC=t.Object({type:t.Literal("cpu",{description:"Normalizes values as CPU usage"})},{$id:"DataNormalizerCpu",title:"CPU"}),FC=t.Object({type:t.Literal("duration",{description:"Normalizes values as durations using standard time units"}),unit:t.Enum(RH,{description:"Time unit used to present the normalized values"})},{$id:"DataNormalizerDuration",title:"Duration"}),HC=t.Object({type:t.Literal("data",{description:"Normalizes values as data sizes using byte units"}),unit:t.Enum(CH,{description:"Data size unit used to present the normalized values"})},{$id:"DataNormalizerData",title:"Data"}),KC=t.Object({type:t.Literal("percent",{description:"Formats numeric values as percentages. Use it when the raw value is already on a 0-100 scale, for example `25` to display `25%`."})},{$id:"DataNormalizerPercent",title:"Percent"}),zC=t.Object({type:t.Literal("percent-fraction",{description:"Formats numeric values as percentages. Use it when the raw value is a 0-1 fraction; Tsuga multiplies the value by 100 for display, for example `0.2` to display `20%`."})},{$id:"DataNormalizerPercentFraction",title:"Percent Fraction"}),YC=t.Object({type:t.Literal("date",{description:"Formats values as calendar dates"})},{$id:"DataNormalizerDate",title:"Date"}),VC=t.Object({type:t.Literal("level",{description:"Displays values using their log level name"})},{$id:"DataNormalizerLevel",title:"Level"}),QC=t.Object({type:t.Literal("none",{description:"Displays raw values without a unit. Records an explicit removal of the unit, so it is not re-derived from metric metadata"})},{$id:"DataNormalizerNone",title:"None"}),UH=t.Object({type:t.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:t.String({description:"Text label describing the custom unit"})},{$id:"DataNormalizerCustom",title:"Custom"}),wH=t.Object({type:t.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:t.String({description:"Text label describing the custom unit. Must not be empty.",minLength:1,maxLength:PH})},{$id:"InputDataNormalizerCustom",title:"Custom"}),ht=b("type",[FC,HC,KC,zC,YC,VC,BC,QC,UH],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),Tt=b("type",[FC,HC,KC,zC,YC,VC,BC,QC,wH],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),jd=t.Object({attribute:t.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:t.Optional(ht)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),qd=t.Object({attribute:t.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:t.Optional(Tt)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),fi=["background","no-background"],NH=["table","legend-only","no-legend"];var LH=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"],WC=["alert","warning","success"],fr=t.Object({operator:t.Enum(LH,{description:"Comparator used to evaluate the metric value"}),value:t.Number({description:"Threshold value used when evaluating the operator"}),color:t.Enum(WC,{description:"Color applied when the condition is met"})},{title:"ConditionalFormatting",description:"Color rule evaluated against the displayed value. The first matching rule in the array is applied."}),vH=t.Object({value:t.Number({description:"Y-axis value where the threshold marker is placed"}),level:t.Enum(WC,{description:"Level applied to the threshold marker"})},{title:"ThresholdMarker",description:"Marker line drawn across the chart at a fixed value, colored by its level."}),kH=["sec","min","hour","day"],En=t.Object({time:t.Number({description:"Numeric count of `metric` units in each bucket. Required when `timeBucket` is present."}),metric:t.Enum(kH,{description:"Unit used to measure the bucket width"})},{description:"Time bucket width for time-based chart widgets. Optional; when present, `time` and `metric` together define the bucket width."});var Tn=t.Enum(["flex-start","center","flex-end"],{description:"Flex alignment keyword used for widget layout"}),gi=t.Object({formula:t.Optional(t.String({description:"Optional alias for formula (only used for display in the UI)"})),queries:t.Optional(t.Record(t.String(),t.String({description:'Display name for this query series in the legend, keyed by the zero-based query index as a string ("0" = first query, "1" = second, and so on). This differs from `formula`, which references queries as "q1", "q2". Omit to fall back to an auto-generated label like "Count on <filter>".'}),{description:"Display names for individual query series, keyed by the zero-based query index as a string."}))},{description:"Display names used for the formula series and the individual query series instead of auto-generated labels."}),yi=t.Object({formula:t.Optional(p({type:"short",description:"Optional alias for formula (only used for display in the UI)"})),queries:t.Optional(t.Record(t.String(),p({type:"short",description:'Display name for this query series in the legend, keyed by the zero-based query index as a string ("0" = first query, "1" = second, and so on). This differs from `formula`, which references queries as "q1", "q2". Omit to fall back to an auto-generated label like "Count on <filter>".'}),{description:"Display names for individual query series, keyed by the zero-based query index as a string."}))},{description:"Display names used for the formula series and the individual query series instead of auto-generated labels."}),Ap={source:zt,queries:QS,formula:t.Optional(tp),aliases:t.Optional(gi),visibleSeries:t.Optional(t.Array(t.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},xp={source:zt,queries:wa,formula:t.Optional(Hn),aliases:t.Optional(yi),visibleSeries:t.Optional(t.Array(t.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},hi={...Ap,groupBy:t.Optional(Qo)},Ti={...xp,groupBy:t.Optional(Ar)},Ce=t.Enum(NH,{description:"Controls whether and how the widget displays legend or series details (e.g. table, legend-only, or no legend)"}),le=t.Optional(t.Union([t.Number(),t.Literal("max")],{description:"Display precision for numeric labels, tooltips, tables, and scalar values. Use a number of decimal places to round displayed values, or `max` to display the full submitted precision."})),jt=t.Optional(t.Array(vH,{description:"Threshold markers displayed on the chart"})),MH=t.Object({name:t.String({description:"Display name of the table column"}),...Ap,source:zt,normalizer:t.Optional(ht),precision:le},{title:"TableColumn",description:"Table column backed by its own aggregation. `defaultSorting` and `columnSizes` reference it as `col-<index>`, using its zero-based position in `columns`."}),DH=t.Object({name:p({description:"Display name of the table column"}),...xp,source:zt,normalizer:t.Optional(Tt),precision:le},{title:"TableColumn",description:"Table column backed by its own aggregation. `defaultSorting` and `columnSizes` reference it as `col-<index>`, using its zero-based position in `columns`."}),GH=t.Array(t.Object({id:t.String({description:"ID of the column to sort by"}),desc:t.Boolean({description:"Whether the sort is descending"})},{title:"TableDefaultSorting"}),{description:"Default sorting applied to a table widget. Column IDs are `label` for the grouping column and `col-<index>` for each entry in `columns`. Users can still change sorting by selecting columns in the rendered table."}),$H=t.Array(t.Object({id:p({description:"ID of the column to sort by"}),desc:t.Boolean({description:"Whether the sort is descending"})},{title:"TableDefaultSorting"}),{description:"Default sorting applied to a table widget. Column IDs are `label` for the grouping column and `col-<index>` for each entry in `columns`. Users can still change sorting by selecting columns in the rendered table."}),Bd=t.Array(t.Object({id:t.String({description:"Column attribute used for the default list sort. It matches an attribute in `listColumns` or a built-in list column for the selected list source."}),desc:t.Boolean({description:"Sort direction for the default list sort. `true` sorts descending; `false` sorts ascending."})},{title:"ListDefaultSorting"}),{description:"Default sorting applied to a list widget. Applies to log, span, or connection list widgets. Users can still change sorting by selecting columns in the rendered list."}),Fd=t.Array(t.Object({id:p({description:"Column attribute used for the default list sort. Set this to an attribute in `listColumns` or a built-in list column for the selected list source."}),desc:t.Boolean({description:"Sort direction for the default list sort. Set `true` for descending order or `false` for ascending order."})},{title:"ListDefaultSorting"}),{description:"Default sorting applied to a list widget. Optional on create or update for log, span, or connection list widgets. Users can still change sorting by selecting columns in the rendered list."}),ZC=["horizontal","vertical"],jH=t.Object({type:t.Literal("list",{description:"Displays matching logs in a tabular list"}),query:t.String({description:"Query that selects logs for the list"}),listColumns:t.Optional(t.Array(jd,{description:"Custom columns to display for each log"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to list widgets."})),defaultSorting:t.Optional(Bd)},{$id:"GraphVisualizationList",title:"List"}),qH=t.Object({type:t.Literal("list",{description:"Displays matching logs in a tabular list"}),query:p({type:"tsuga-query",description:"Query that selects logs for the list"}),listColumns:t.Optional(t.Array(qd,{description:"Custom columns to display for each log"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to list widgets. Optional; omit or set false to use truncated cells."})),defaultSorting:t.Optional(Fd)},{$id:"InputGraphVisualizationList",title:"List"}),Op=b("type",[t.Object({type:t.Literal("auto",{description:"Automatically choose this axis bound"})}),t.Object({type:t.Literal("number",{description:"Use a fixed numeric axis bound"}),value:t.Number({description:"Fixed numeric axis bound value"})})],{description:"Axis bound mode: automatic or fixed numeric value"}),Ei=t.Object({min:Op,max:Op,scale:b("type",[t.Object({type:t.Literal("pow",{description:"Power scale"}),exponent:t.Number({description:"Exponent used by the power scale"})}),t.Object({type:t.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:t.Boolean({description:"Whether the rendered Y axis should always include zero"})},{description:"Y-axis bounds and scale configuration for chart widgets."}),_i=t.Object({min:Op,max:Op,scale:b("type",[t.Object({type:t.Literal("pow",{description:"Power scale"}),exponent:t.Number({minimum:0,description:"Exponent used by the power scale"})}),t.Object({type:t.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:t.Boolean({description:"Whether the rendered Y axis should always include zero"})},{description:"Y-axis bounds and scale configuration for chart widgets. Optional on create or update."}),BH=t.Array(t.Integer({description:"Marker value expressed as a percentage between 0 and 100"}),{description:"Percentile markers displayed on top of the distribution chart"}),FH=t.Array(t.Integer({minimum:0,maximum:100,description:"Marker value expressed as a percentage between 0 and 100"}),{description:"Percentile markers displayed on top of the distribution chart"});var HH=t.Object({type:t.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),legendMode:t.Optional(Ce),thresholds:jt,yAxisSettings:t.Optional(Ei)},{$id:"GraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),KH=t.Object({type:t.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:t.Optional(Ce),thresholds:jt,yAxisSettings:t.Optional(_i)},{$id:"InputGraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),zH=t.Object({type:t.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),query:t.String({description:"The read-only SQL query to execute against the connection."}),listColumns:t.Optional(t.Array(jd,{description:"Custom columns to display for each database row"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to connection list widgets."})),defaultSorting:t.Optional(Bd)},{$id:"GraphVisualizationListConnection",title:"ListConnection"}),YH=t.Object({type:t.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),query:p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),listColumns:t.Optional(t.Array(qd,{description:"Custom columns to display for each database row"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to connection list widgets. Optional; omit or set false to use truncated cells."})),defaultSorting:t.Optional(Fd)},{$id:"InputGraphVisualizationListConnection",title:"ListConnection"}),VH=t.Object({type:t.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."}))},{$id:"GraphVisualizationTopListConnection",title:"TopListConnection"}),QH=t.Object({type:t.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1})},{$id:"InputGraphVisualizationTopListConnection",title:"TopListConnection"}),WH=t.Object({type:t.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),legendMode:t.Optional(Ce)},{$id:"GraphVisualizationPieConnection",title:"PieConnection"}),ZH=t.Object({type:t.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:t.Optional(Ce)},{$id:"InputGraphVisualizationPieConnection",title:"PieConnection"}),XH=t.Object({type:t.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),legendMode:t.Optional(Ce),thresholds:jt,yAxisSettings:t.Optional(Ei)},{$id:"GraphVisualizationBarConnection",title:"BarConnection"}),JH=t.Object({type:t.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:t.Optional(Ce),thresholds:jt,yAxisSettings:t.Optional(_i)},{$id:"InputGraphVisualizationBarConnection",title:"BarConnection"}),e2=t.Object({type:t.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),backgroundMode:t.Optional(t.Enum(fi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(ht),legendMode:t.Optional(Ce)},{$id:"GraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),t2=t.Object({type:t.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),backgroundMode:t.Optional(t.Enum(fi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(Tt),legendMode:t.Optional(Ce)},{$id:"InputGraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),r2=t.Object({type:t.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:t.String({description:"Tsuga query that selects logs to cluster into patterns"}),layout:t.Optional(t.Enum(ZC,{description:"Layout used to render log patterns"}))},{$id:"GraphVisualizationListLogPatterns",title:"ListLogPatterns"}),n2=t.Object({type:t.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:p({type:"tsuga-query",description:"Tsuga query that selects logs to cluster into patterns"}),layout:t.Optional(t.Enum(ZC,{description:"Layout used to render log patterns"}))},{$id:"InputGraphVisualizationListLogPatterns",title:"ListLogPatterns"}),o2=t.Object({type:t.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:t.String({description:"Query that selects trace spans for the list"}),listColumns:t.Optional(t.Array(jd,{description:"Custom columns to display for each span"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to span list widgets."})),defaultSorting:t.Optional(Bd)},{$id:"GraphVisualizationListSpans",title:"ListSpans"}),i2=t.Object({type:t.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:p({type:"tsuga-query",description:"Query that selects trace spans for the list"}),listColumns:t.Optional(t.Array(qd,{description:"Custom columns to display for each span"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to span list widgets. Optional; omit or set false to use truncated cells."})),defaultSorting:t.Optional(Fd)},{$id:"InputGraphVisualizationListSpans",title:"ListSpans"}),rs=t.Array(t.String({description:"Raw PromQL expression for this widget, returned exactly as stored."}),{description:"PromQL expressions configured for this widget. PromQL-backed widgets require at least one query."}),ns=t.Array(p({allowEmpty:!1,type:"long",description:"Raw PromQL expression for this widget."}),{minItems:1,description:"PromQL expressions configured for this widget."}),a2=t.Object({type:t.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:rs,aliases:t.Optional(gi),timeBucket:t.Optional(En),normalizer:t.Optional(ht),precision:le,legendMode:t.Optional(Ce),thresholds:jt,yAxisSettings:t.Optional(Ei),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),s2=t.Object({type:t.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:ns,aliases:t.Optional(yi),timeBucket:t.Optional(En),normalizer:t.Optional(Tt),precision:le,legendMode:t.Optional(Ce),thresholds:jt,yAxisSettings:t.Optional(_i),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),c2=t.Object({type:t.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:rs,aliases:t.Optional(gi),backgroundMode:t.Optional(t.Enum(fi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(ht),legendMode:t.Optional(Ce)},{$id:"GraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),p2=t.Object({type:t.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:ns,aliases:t.Optional(yi),backgroundMode:t.Optional(t.Enum(fi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(Tt),legendMode:t.Optional(Ce)},{$id:"InputGraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),u2=t.Object({type:t.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:rs,aliases:t.Optional(gi),normalizer:t.Optional(ht),precision:le,conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"GraphVisualizationTopListPromql",title:"TopListPromql"}),l2=t.Object({type:t.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:ns,aliases:t.Optional(yi),normalizer:t.Optional(Tt),precision:le,conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"InputGraphVisualizationTopListPromql",title:"TopListPromql"}),m2=t.Object({type:t.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:rs,aliases:t.Optional(gi),normalizer:t.Optional(ht),precision:le,legendMode:t.Optional(Ce)},{$id:"GraphVisualizationPiePromql",title:"PiePromql"}),d2=t.Object({type:t.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:ns,aliases:t.Optional(yi),normalizer:t.Optional(Tt),precision:le,legendMode:t.Optional(Ce)},{$id:"InputGraphVisualizationPiePromql",title:"PiePromql"}),f2=t.Object({type:t.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:rs,aliases:t.Optional(gi),timeBucket:t.Optional(En),precision:le,normalizer:t.Optional(ht),thresholds:jt,legendMode:t.Optional(Ce),yAxisSettings:t.Optional(Ei)},{$id:"GraphVisualizationBarPromql",title:"BarPromql"}),g2=t.Object({type:t.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:ns,aliases:t.Optional(yi),timeBucket:t.Optional(En),precision:le,normalizer:t.Optional(Tt),thresholds:jt,legendMode:t.Optional(Ce),yAxisSettings:t.Optional(_i)},{$id:"InputGraphVisualizationBarPromql",title:"BarPromql"}),y2=t.Object({type:t.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...hi,timeBucket:t.Optional(En),normalizer:t.Optional(ht),precision:le,legendMode:t.Optional(Ce),thresholds:jt,yAxisSettings:t.Optional(Ei),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseries",title:"Timeseries"}),h2=t.Object({type:t.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...Ti,timeBucket:t.Optional(En),normalizer:t.Optional(Tt),precision:le,legendMode:t.Optional(Ce),thresholds:jt,yAxisSettings:t.Optional(_i),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseries",title:"Timeseries"}),T2=t.Object({type:t.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...hi,normalizer:t.Optional(ht),precision:le,conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"GraphVisualizationTopList",title:"TopList"}),E2=t.Object({type:t.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...Ti,normalizer:t.Optional(Tt),precision:le,conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"InputGraphVisualizationTopList",title:"TopList"}),_2=t.Object({type:t.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...hi,normalizer:t.Optional(ht),precision:le,legendMode:t.Optional(Ce)},{$id:"GraphVisualizationPie",title:"Pie"}),I2=t.Object({type:t.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...Ti,normalizer:t.Optional(Tt),precision:le,legendMode:t.Optional(Ce)},{$id:"InputGraphVisualizationPie",title:"Pie"}),b2=t.Object({type:t.Literal("query-value",{description:"Displays the aggregation as a single value"}),...Ap,backgroundMode:t.Optional(t.Enum(fi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(ht),legendMode:t.Optional(Ce)},{$id:"GraphVisualizationQueryValue",title:"QueryValue"}),S2=t.Object({type:t.Literal("query-value",{description:"Displays the aggregation as a single value"}),...xp,backgroundMode:t.Optional(t.Enum(fi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(Tt),legendMode:t.Optional(Ce)},{$id:"InputGraphVisualizationQueryValue",title:"QueryValue"}),O2=t.Object({type:t.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...hi,timeBucket:t.Optional(En),precision:le,normalizer:t.Optional(ht),thresholds:jt,legendMode:t.Optional(Ce),yAxisSettings:t.Optional(Ei)},{$id:"GraphVisualizationBar",title:"Bar"}),A2=t.Object({type:t.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...Ti,timeBucket:t.Optional(En),precision:le,normalizer:t.Optional(Tt),thresholds:jt,legendMode:t.Optional(Ce),yAxisSettings:t.Optional(_i)},{$id:"InputGraphVisualizationBar",title:"Bar"}),x2=t.Object({type:t.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...hi,precision:le,normalizer:t.Optional(ht),percentileMarkers:t.Optional(BH),boundsScale:t.Optional(Jc)},{$id:"GraphVisualizationDistribution",title:"Distribution"}),R2=t.Object({type:t.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...Ti,precision:le,normalizer:t.Optional(Tt),percentileMarkers:t.Optional(FH),boundsScale:t.Optional(Jc)},{$id:"InputGraphVisualizationDistribution",title:"Distribution"}),XC=["red","pink","violet","blue","cyan","green","yellow","orange"],JC=t.Enum(XC,{description:"Color palette used to render the heatmap intensity gradient"}),C2=t.Object({type:t.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...hi,precision:le,normalizer:t.Optional(ht),palette:t.Optional(JC)},{$id:"GraphVisualizationHeatmap",title:"Heatmap"}),P2=t.Object({type:t.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...Ti,precision:le,normalizer:t.Optional(Tt),palette:t.Optional(JC)},{$id:"InputGraphVisualizationHeatmap",title:"Heatmap"}),eP=t.Object({from:t.Number({description:"Lower bound of the Gauge color threshold; runs up to the next threshold or the max"}),color:t.Enum(XC,{description:"Color applied to the band starting at this value"})},{title:"GaugeColorThreshold",description:"Color band of the gauge range. Bands are ordered by `from`, so entries may be listed in any order."}),U2=t.Object({type:t.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...Ap,max:t.Optional(t.Number({description:"Gauge maximum value"})),colorThresholds:t.Optional(t.Array(eP,{description:"Color thresholds inside the gauge range"})),precision:le,normalizer:t.Optional(ht)},{$id:"GraphVisualizationGauge",title:"Gauge"}),w2=t.Object({type:t.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...xp,max:t.Optional(t.Number({description:"Gauge maximum value"})),colorThresholds:t.Optional(t.Array(eP,{description:"Color thresholds inside the gauge range"})),precision:le,normalizer:t.Optional(Tt)},{$id:"InputGraphVisualizationGauge",title:"Gauge"}),N2=t.Object({type:t.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:t.Array(MH,{description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:t.Optional(Qo),defaultSorting:t.Optional(GH),columnSizes:t.Optional(t.Record(t.String(),t.Number({description:"Column width by column id"}),{description:"Table column widths in pixels, keyed by column id: `label` for the grouping column and `col-<index>` for each entry in `columns`. Columns without an entry keep their default width."}))},{$id:"GraphVisualizationTable",title:"Table"}),L2=t.Object({type:t.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:t.Array(DH,{minItems:1,description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:t.Optional(Ar),defaultSorting:t.Optional($H),columnSizes:t.Optional(t.Record(t.String(),t.Number({description:"Column width by column id"}),{description:"Table column widths in pixels, keyed by column id: `label` for the grouping column and `col-<index>` for each entry in `columns`. Columns without an entry keep their default width."}))},{$id:"InputGraphVisualizationTable",title:"Table"}),v2=t.Object({type:t.Literal("note",{description:"Displays static text on the dashboard"}),note:t.Optional(t.String({description:"Markdown-compatible text shown in the note"})),noteColor:t.Optional(t.Enum(qC,{description:"Background color used to render the note"})),noteAlign:t.Optional(Tn),noteJustifyContent:t.Optional(Tn)},{$id:"GraphVisualizationNote",title:"Note"}),k2=t.Object({type:t.Literal("note",{description:"Displays static text on the dashboard"}),note:t.Optional(p({type:"long",description:"Markdown-compatible text shown in the note"})),noteColor:t.Optional(t.Enum(qC,{description:"Background color used to render the note"})),noteAlign:t.Optional(Tn),noteJustifyContent:t.Optional(Tn)},{$id:"InputGraphVisualizationNote",title:"Note"}),M2=b("type",[HH,zH,VH,WH,XH,e2,a2,c2,u2,m2,f2,y2,T2,_2,b2,U2,O2,x2,C2,N2,jH,v2,r2,o2],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),D2=b("type",[KH,YH,QH,ZH,JH,t2,s2,p2,l2,d2,g2,h2,E2,I2,S2,w2,A2,R2,P2,L2,qH,k2,n2,i2],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),Rp=t.Object({id:t.String({description:"Unique identifier of the graph widget inside the dashboard. Set by the caller when the graph is created; use it to target the graph in later update requests."}),name:t.Optional(t.String({description:"Display name of the graph widget."})),description:t.Optional(t.String({description:"Optional text shown with the graph widget."})),descriptionAlign:t.Optional(Tn),descriptionJustifyContent:t.Optional(Tn),visualization:M2,layout:t.Optional(t.Object({x:t.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:t.Number({description:"Row position of the widget on the dashboard grid, in row units of 50 pixels each. 0 is the topmost row; increasing values move down."}),w:t.Number({description:"Width of the widget in grid columns, out of the 12-column grid."}),h:t.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall."})},{description:"Grid position and size of the widget. Optional; when provided, width and height must meet the minimum size for the widget type."}))},{title:"Graph",description:"Single dashboard widget, combining its identity, its visualization configuration, and its position on the dashboard grid."}),Cp=t.Object({id:p({description:"Unique identifier of the graph widget inside the dashboard. Assign it when the graph is created; use it to target the graph in later update requests."}),name:t.Optional(p({description:"Display name of the graph widget."})),description:t.Optional(t.String({minLength:1,maxLength:800,description:"Text shown with the graph widget."})),descriptionAlign:t.Optional(Tn),descriptionJustifyContent:t.Optional(Tn),visualization:D2,layout:t.Optional(t.Object({x:t.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:t.Number({description:"Row position of the widget on the dashboard grid, in row units of 50 pixels each. 0 is the topmost row; increasing values move down."}),w:t.Number({description:"Width of the widget in grid columns, out of the 12-column grid."}),h:t.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall."})},{description:"Grid position and size of the widget. Optional; when provided, width and height must meet the minimum size for the widget type."}))},{title:"Graph",description:"Single dashboard widget, combining its identity, its visualization configuration, and its position on the dashboard grid."}),jC=10,G2=t.Array(t.Object({key:t.String({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:t.Array(t.String({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:t.Optional(t.Boolean({description:"If true, widgets exclude telemetry whose value matches this filter instead of including it (is-not)."}))}),{description:"Dashboard-wide filters applied to every widget on the dashboard."}),$2=t.Array(t.Object({key:p({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:t.Array(p({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:t.Optional(t.Boolean({description:"If true, widgets exclude telemetry whose value matches this filter instead of including it (is-not)."}))}),{maxItems:jC,description:`Dashboard-wide filters applied to every widget on the dashboard. Up to ${jC} filters are allowed.`}),Ii=t.Object({id:t.String({description:"Tsuga-generated dashboard ID assigned when the dashboard is created."}),name:t.String({description:"Display name of the dashboard. Set by the caller on create or update."}),owner:t.String({description:"ID of the team that owns the dashboard. Set by the caller on create or update and used for dashboard access control."}),graphs:t.Array(Rp,{description:"Ordered widgets that compose the dashboard"}),filters:t.Optional(G2),createdAt:E({description:"Timestamp when Tsuga created the dashboard."}),updatedAt:E({description:"Timestamp when Tsuga last updated the dashboard."}),creator:t.Optional(ue),updater:t.Optional(ue),tags:Me,timePreset:t.Optional(t.Enum(iu,{description:"Relative time preset used when opening the dashboard."})),folderId:t.Optional(t.String({description:"Folder that contains the dashboard. Set from the dashboard's saved folder relationship. Returned when the dashboard is in a folder; omitted when it is not."}))}),Pp=t.Object({name:p({description:"Display name of the dashboard."}),owner:p({allowEmpty:!1,description:"ID of the team that owns the dashboard. Required and used for dashboard access control."}),graphs:t.Array(Cp,{description:"Ordered widgets that compose the dashboard"}),filters:t.Optional($2),tags:Ve,timePreset:t.Optional(t.Enum(iu,{description:"Relative time preset used when opening the dashboard. Optional; create defaults to `past-30-minutes` when omitted, and update omission preserves the current value."})),folderId:t.Optional(t.Union([t.Null(),p({allowEmpty:!1})],{description:"Folder that should contain the dashboard. Optional; omit on update to keep the current folder, pass null to clear the folder, or pass a readable dashboard-folder ID to move it."}))}),Wt={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",WIDGET_COUNT:"widgetCount",UPDATED_AT:"updatedAt",NAME:"name"},tP=[Wt.OWNER,Wt.TAGS,Wt.WIDGET_COUNT,Wt.UPDATED_AT,Wt.NAME],Up=t.Partial(t.Object({owners:Be(p({allowEmpty:!1}),{description:"Restrict results to dashboards owned by any of these team IDs",maxItems:50}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against dashboard names or dashboard IDs. Omit the whole `searchQuery` filter to skip text filtering."}),exclude:t.Optional(t.Boolean({description:"If true, exclude dashboards matching this value instead of including them"}))},{description:"Text filter for dashboard names or IDs. Optional; `exclude: true` returns dashboards whose name and ID do not match the substring."}),tags:Be(Vt.items,{description:"Restrict results to dashboards that have at least one of the listed key/value tags",maxItems:50}),folderId:t.Union([t.Null(),p({allowEmpty:!1})],{description:"Folder filter for dashboard query results. Optional; pass a folder ID to return dashboards in that folder, or null to return only dashboards that are not in any folder."})},{description:"Optional filters applied to narrow the returned dashboards"})),j2=t.Partial(t.Object({...ye,filters:Up,sort:t.Object({by:t.Enum([Wt.IS_FAVORITE,Wt.OWNER,Wt.TAGS,Wt.WIDGET_COUNT,Wt.UPDATED_AT,Wt.NAME],{description:"Field to sort the returned dashboards by"}),direction:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboards"})})),Y4e=m({tags:["dashboards"],url:`${kr}/query`,method:"POST",paginated:!0,response:t.Array(Ii),body:j2}),V4e=m({tags:["dashboards"],url:`${kr}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Omit(Up,["tags"]))}),response:Yt}),Q4e=m({tags:["dashboards"],url:`${kr}/:id`,method:"GET",params:t.Object({id:p()}),response:Ii}),W4e=m({tags:["dashboards"],url:kr,method:"POST",body:Pp,response:Ii}),Z4e=m({tags:["dashboards"],url:`${kr}/:id`,method:"PUT",params:t.Object({id:p()}),body:t.Partial(Pp),response:Ii}),X4e=m({tags:["dashboards"],url:`${kr}/bulk-update`,method:"PUT",body:t.Object({dashboardIds:t.Array(p(),{description:"Dashboard IDs to update. At least one dashboard ID is required."}),owner:t.Optional(p({allowEmpty:!1,description:"Owning team ID to apply to every dashboard. Optional when folderId is provided; omit to keep the current owner."})),folderId:t.Optional(t.Union([t.Null(),p({allowEmpty:!1})],{description:"Folder that should contain every dashboard. Optional when owner is provided; omit to keep the current folder, pass null to clear the folder, or pass a dashboard-folder ID to move dashboards."}))}),response:t.Object({})}),J4e=m({tags:["dashboards"],url:`${kr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:R}),eYe=m({tags:["dashboards"],url:`${kr}/:id/graphs/:graphId`,method:"PUT",params:t.Object({id:p({allowEmpty:!1}),graphId:p({allowEmpty:!1})}),body:t.Omit(Cp,["id"]),response:Rp}),tYe=m({tags:["dashboards"],url:`${kr}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})});var bi=`/${"v1"}/dashboards`,os=t.Pick(Ii,["id","name","owner","graphs","filters","tags","timePreset","folderId"],{$id:"Dashboard",description:"Saved visualization made of dashboard-wide filters and ordered graphs. Use dashboards to preserve reusable views for a team or workflow. See [Dashboards](/documentation/visualize/dashboards/index)."}),q2={id:"123-456-abc",name:"API Performance Overview",owner:"team-123-abc",graphs:[{id:"789-abc-def",name:"Request Latency P99",visualization:{type:"timeseries",source:"metrics",queries:[{aggregate:{type:"percentile",field:"duration",percentile:99},filter:"service:api-gateway"}]},layout:{x:0,y:0,w:6,h:4}}],filters:[{key:"env",values:["production"]}],tags:[{key:"team",value:"platform"}],timePreset:"past-1-hour"};Object.assign(os,{examples:[q2]});var B2=t.Object({by:t.Enum([...tP],{description:"Field to sort the returned dashboards by: `owner` sorts by owning team ID, `tags` sorts by tag key/value pairs, `widgetCount` sorts by the number of graphs on the dashboard, `updatedAt` sorts by last-updated timestamp, and `name` sorts alphabetically by dashboard name."}),direction:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboards"}),rP=t.Object({...ze,filters:t.Optional(t.Pick(Up,["owners","searchQuery","tags","folderId"])),sort:t.Optional(B2)},{description:"Dashboard query request. Use filters, sorting, limit, and offset to page through visible dashboards."}),F2={filters:{owners:{values:["team-123-abc"]},searchQuery:{value:"API"},tags:{values:[{key:"service",value:"api-gateway"}]},folderId:"folder-123-abc"},sort:{by:"name",direction:"asc"},limit:10,offset:0};Object.assign(rP,{examples:[F2]});var nP=m({description:"Queries dashboards visible to the authenticated operation key. Use this endpoint to build dashboard inventories or synchronize dashboard metadata. Pagination fields limit the returned page; use the response metadata to request additional pages. See [Dashboards](/documentation/visualize/dashboards/index).",operationId:"queryDashboards",tags:["dashboards"],url:`${bi}/query`,method:"POST",paginated:!0,body:rP,response:t.Array(os)}),oP=m({description:"Retrieves one dashboard by ID.",operationId:"getDashboard",tags:["dashboards"],url:`${bi}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved dashboard to retrieve. Use the `id` returned by dashboard query, create, or update responses."})}),response:os}),Hd=t.Pick(Pp,["name","owner","graphs","filters","tags","timePreset","folderId"],{description:"Dashboard create or update request. Provide the dashboard identity, owner team, widgets, filters, tags, and optional time preset."}),H2={name:"API Performance Overview",owner:"team-123-abc",graphs:[{id:"789-abc-def",name:"Request Latency P99",visualization:{type:"timeseries",source:"metrics",queries:[{aggregate:{type:"percentile",field:"duration",percentile:99},filter:"service:api-gateway"}]},layout:{x:0,y:0,w:6,h:4}}],filters:[{key:"env",values:["production"]}],tags:[{key:"team",value:"platform"}],timePreset:"past-1-hour",folderId:null};Object.assign(Hd,{examples:[H2]});var K2=t.Omit(Cp,["id"],{description:"Dashboard graph update request. The graph identifier is supplied in the `graphId` path parameter; provide the replacement graph definition without an `id` field."}),iP=m({description:"Creates a dashboard owned by the specified team. Use this to provision dashboards from automation or templates. The response returns the saved dashboard definition.",operationId:"createDashboard",tags:["dashboards"],url:bi,method:"POST",body:Hd,response:os}),aP=m({description:"Updates an existing dashboard by ID. Fields are patched from the request body; omitted fields keep their current values.",operationId:"updateDashboard",tags:["dashboards"],url:`${bi}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved dashboard to update. Use the `id` returned by dashboard query, get, or create responses."})}),body:t.Partial(Hd),response:os}),z2=t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved dashboard to delete. Use the `id` returned by dashboard query, get, create, or update responses."})}),sP=m({description:"Deletes a dashboard by ID. Use only after confirming no users or automation still rely on the dashboard.",operationId:"deleteDashboard",tags:["dashboards"],url:`${bi}/:id`,method:"DELETE",params:z2,response:R}),pYe=m({description:"Updates one graph inside a dashboard without replacing the full dashboard. Use this for targeted widget edits when you already know the dashboard ID and graph ID.",operationId:"updateDashboardGraph",tags:["dashboards"],url:`${bi}/:id/graphs/:graphId`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard that contains the graph to update. Use the `id` returned by dashboard responses."}),graphId:p({allowEmpty:!1,description:"Identifier of the graph to update within the dashboard. Use graph IDs from the dashboard response."})}),body:K2,response:Rp});var cP=100,pP=3,Si=t.Object({id:t.String({description:"Tsuga-generated ingestion API key ID assigned when the key is created."}),name:t.String({description:"Human-readable key name. Names must be kebab-case when creating or updating keys."}),keyLastCharacters:t.String({description:"Last visible characters of the secret key. Use this to identify a key without exposing the full secret."}),owner:t.String({description:"Team ID that owns and manages the ingestion API key."}),tags:Yt,teamOverrideFields:t.Optional(t.Array(t.String(),{description:"Telemetry attribute names used to override ownership for data sent with this key."})),updatedAt:E({description:"Timestamp when Tsuga last updated the key metadata."}),createdAt:E({description:"Timestamp when Tsuga created the key."}),creator:t.Optional(ue),updater:t.Optional(ue),assetUpdatedAt:E({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})}),is=t.Object({name:t.String({format:qo,minLength:1,maxLength:cP,description:`Kebab-case name for the ingestion API key. Maximum length is ${cP} characters.`}),owner:p({allowEmpty:!1,description:"Team ID that will own and manage the ingestion API key."}),tags:Vt,teamOverrideFields:t.Union([t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:pP,description:`Array form. Up to ${pP} fields are allowed.`}),t.Null({description:"Clear any existing team override fields."})],{description:"Telemetry attribute names used to override ownership for data sent with this key. Send null to clear existing override fields."})}),as="/v0/ingestion-api-keys",TYe=m({tags:["ingestion-api-keys"],url:as,method:"POST",body:is,response:t.Intersect([Si,t.Object({key:t.String({description:"Full secret value of the ingestion API key. Generated by Tsuga and returned only in this create response; subsequent get and list responses expose only `keyLastCharacters`. Store it immediately, since it cannot be retrieved again after this response."})})])}),EYe=m({tags:["ingestion-api-keys"],url:as,method:"GET",paginated:!0,query:t.Object(ye),response:t.Array(Si)}),_Ye=m({tags:["ingestion-api-keys"],url:`${as}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1})}),response:Si}),IYe=m({tags:["ingestion-api-keys"],url:`${as}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1})}),body:is,response:Si}),bYe=m({tags:["ingestion-api-keys"],url:`${as}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1})}),response:R});var ss=`/${"v1"}/ingestion-api-keys`,cs=t.Pick(Si,["id","name","owner","tags","teamOverrideFields","keyLastCharacters"],{$id:"IngestionApiKey",description:"API key used to send telemetry data to Tsuga. The full key secret is returned only when the key is created. See [API keys](/documentation/account-and-settings/api-keys)."}),uP={id:"123-456-abc",name:"production-logs-ingestion",keyLastCharacters:"x7Qm",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(cs,{examples:[uP]});var lP=t.Pick(is,["name","owner","tags","teamOverrideFields"],{$id:"CreateIngestionApiKeyRequest",description:"Ingestion API key creation request. Provide a kebab-case name, owner team, required tags, and required team override fields as an array of fields or null."}),mP=t.Pick(is,["name","owner","tags","teamOverrideFields"],{$id:"UpdateIngestionApiKeyRequest",description:"Ingestion API key update request. Provide the full metadata definition, including name, owner team, tags, and team override fields."}),dP={name:"production-logs-ingestion",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(lP,{examples:[dP]});Object.assign(mP,{examples:[dP]});var Y2={...uP,key:"tsuga_in:v1:abc123xyx7Qm"},fP=m({description:"Lists ingestion API keys visible to the authenticated operation key. Use this to inventory telemetry intake keys, owners, tags, and team override fields. Pagination fields limit the returned page.",operationId:"listIngestionApiKeys",tags:["ingestion-api-keys"],url:ss,method:"GET",paginated:!0,query:t.Object(ze),response:t.Array(cs)}),UYe=m({description:"Retrieves one ingestion API key by ID. The response never includes the full secret key value; only the last visible characters are returned.",operationId:"getIngestionApiKey",tags:["ingestion-api-keys"],url:`${ss}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the ingestion API key to retrieve. Use the `id` returned by ingestion API key list or create responses."})}),response:cs}),V2=t.Intersect([t.Pick(cs,["id","name","keyLastCharacters","owner","tags","teamOverrideFields"]),t.Object({key:t.String({description:"Full Tsuga-generated ingestion API key secret. Returned only in the create response; list, get, and update responses expose only `keyLastCharacters`."})})],{title:"IngestionApiKeyCreated",example:Y2}),gP=m({description:"Creates an ingestion API key for telemetry intake. Store the returned `key` immediately because Tsuga returns the full secret only in this response.",operationId:"createIngestionApiKey",tags:["ingestion-api-keys"],url:ss,method:"POST",body:lP,response:V2}),yP=m({description:"Updates ingestion API key metadata by ID, including name, owner, tags, and team override fields. The secret key value is not rotated by this operation.",operationId:"updateIngestionApiKey",tags:["ingestion-api-keys"],url:`${ss}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the ingestion API key to update. Use the `id` returned by ingestion API key list, get, or create responses."})}),body:mP,response:cs}),hP=m({description:"Deletes an ingestion API key by ID. Telemetry clients using the deleted key can no longer send data with it.",operationId:"deleteIngestionApiKey",tags:["ingestion-api-keys"],url:`${ss}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the ingestion API key to delete. Use the `id` returned by ingestion API key list, create, or update responses."})}),response:R});var Q2={application:{webService:["azure_web_app","gcp_app_engine_service"]},data:{bucket:["aws_s3_bucket","gcp_bucket","azure_blob_storage_container"],messagingService:["aws_kinesis_data_stream","aws_sqs_queue","aws_sns_topic","azure_service_bus_namespace","azure_service_bus_queue","gcp_pubsub_topic","azure_event_grid_topic","azure_event_hub_namespace","azure_event_hub"],fileSystem:["aws_efs","azure_file_share"],contentDeliveryNetwork:["aws_cloudfront_distribution","gcp_cloud_cdn_configuration"],database:["aws_dynamodb_table","aws_elasticache","aws_rds_instance","azure_database_for_mysql_server","azure_database_for_postgres_server","azure_sql_database_server","azure_sql_database","gcp_bigtable_instance","gcp_cloud_sql_instance","gcp_firestore_database","gcp_spanner_instance","azure_cosmos_db_account"],storageAccount:["azure_storage_account"],volume:["aws_ebs_volume","gcp_compute_disk","azure_disk"]},compute:{virtualMachine:["aws_ec2_instance","gcp_compute_instance","azure_compute_virtual_machine"],serverless:["aws_lambda_function","gcp_cloud_run_function","gcp_cloud_run_job","gcp_cloud_run_service","azure_function_app"]},container:{kubernetesCluster:["aws_eks_cluster","gcp_gke_cluster","azure_aks_cluster"],containerRepository:["aws_ecr_repository","gcp_artifact_registry_repository","azure_container_registry"],containerCluster:["aws_ecs_cluster"],containerServiceTask:["aws_ecs_task"],containerService:["aws_ecs_service","azure_container_instance_group"],containerImage:["aws_ecr_image","gcp_artifact_registry_docker_image","azure_container_registry_image"]},network:{virtualNetwork:["aws_vpc","gcp_vpc","azure_virtual_network"],loadBalancer:["aws_elastic_load_balancer","gcp_forwarding_rule","azure_load_balancer","azure_traffic_manager_profile"],targetGroup:["aws_target_group"],certificate:["aws_acm_certificate","gcp_certificate_manager_certificate","azure_app_service_certificate"]}},[vYe,Yd,ps]=W2(Q2);function W2(e){let r=[],n=[],o=[],i=Object.keys(e);for(let a of i){r.push(a);let c=e[a];for(let l in c){n.push(l);let d=c[l];Array.isArray(d)&&o.push(...d)}}return[Kd(r),Kd(n),Kd(o)]}function Kd(e){if(e.length===0)throw new Error("Array must have at least one element.");return e}var zd=t.Enum(["HTTP","HTTPS","TCP","UDP","GENEVE","TLS","TLS_QUIC","TCP_UDP","TCP_QUIC","QUIC"]),Z2=t.Object({versioningStatus:t.Optional(t.Enum(["Enabled","Disabled","Suspended","Not configured"]))}),X2=t.Object({domainName:t.Optional(t.String()),origins:t.Optional(t.Array(t.String()))}),J2=t.Object({allocatedStorageGib:t.Optional(t.Number()),encryptedAtRest:t.Optional(t.Boolean()),engine:t.Optional(t.String()),dynamoDbItemCount:t.Optional(t.Number()),dynamoDbActualSizeGib:t.Optional(t.Number())}),eK=t.Object({version:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),subnets:t.Optional(t.Array(t.String()))}),tK=t.Object({artifactRegistryFormat:t.Optional(t.Enum(["FORMAT_UNSPECIFIED","DOCKER","MAVEN","NPM","APT","YUM","PYTHON","KFP","GO","GENERIC"])),uri:t.Optional(t.String()),tagMutability:t.Optional(t.Enum(["MUTABLE","IMMUTABLE"])),scanOnPush:t.Optional(t.Boolean()),encryptionType:t.Optional(t.String())}),rK=t.Object({status:t.Optional(t.String()),activeServices:t.Optional(t.Number()),pendingTasks:t.Optional(t.Number()),runningTasks:t.Optional(t.Number()),registeredContainerInstances:t.Optional(t.Number()),capacityProviders:t.Optional(t.Array(t.String()))}),nK=t.Object({status:t.Optional(t.String()),desiredStatus:t.Optional(t.String()),healthStatus:t.Optional(t.String()),availabilityZone:t.Optional(t.String()),startedAt:t.Optional(E())}),oK=t.Object({isEncrypted:t.Optional(t.Boolean()),ownerId:t.Optional(t.String()),state:t.Optional(t.Enum(["creating","available","deleting","deleted","error","updating"]))}),iK=t.Object({type:t.Optional(t.String()),osType:t.Optional(t.String()),subnetIds:t.Optional(t.Array(t.String())),nbContainers:t.Optional(t.Number())}),aK=t.Object({digest:t.String(),imageTags:t.Array(t.String()),imageSizeBytes:t.Optional(t.Number()),imagePushedAt:t.Optional(E()),mediaType:t.Optional(t.String()),repositoryName:t.String(),repositoryId:t.Optional(t.String()),scanStatus:t.Optional(t.String())}),sK=t.Object({url:t.Optional(t.String()),maxMessageSizeBytes:t.Optional(t.Number()),messageRetentionHours:t.Optional(t.Number())}),cK=t.Object({runtime:t.Optional(t.String()),memoryAllocationMib:t.Optional(t.Number()),timeoutMs:t.Optional(t.Number()),codeSha256:t.Optional(t.String())}),pK=t.Object({kind:t.Optional(t.String())}),uK=t.Object({instanceId:t.String(),architecture:t.Optional(t.String()),instanceType:t.Optional(t.String()),operatingSystem:t.Optional(t.String()),memoryMib:t.Optional(t.Number()),vCpus:t.Optional(t.Number()),vpcId:t.Optional(t.String()),k8sClusterId:t.Optional(t.String())}),lK=t.Object({id:t.Optional(t.String()),ipCidrBlocks:t.Array(t.String())}),mK=t.Object({protocol:t.Optional(zd),port:t.Optional(t.Number()),instanceProtocol:t.Optional(zd),instancePort:t.Optional(t.Number())}),dK=t.Object({protocol:t.Optional(t.String()),ports:t.Optional(t.Array(t.String())),portRange:t.Optional(t.String()),allPorts:t.Optional(t.Boolean())}),fK=t.Object({name:t.String(),ip:t.Optional(t.String()),type:t.Enum(["public","private"])}),gK=t.Object({type:t.String(),name:t.String()}),yK=t.Object({frontendIp:t.Optional(fK),backendIpPools:t.Array(gK)}),hK=t.Object({targetId:t.String(),targetPort:t.Optional(t.Number()),targetType:t.Optional(t.Enum(["instance","ip","lambda","alb"])),healthState:t.Optional(t.String()),healthReason:t.Optional(t.String()),healthDescription:t.Optional(t.String()),availabilityZone:t.Optional(t.String())}),TK=t.Object({protocol:t.Optional(zd),port:t.Optional(t.Number()),type:t.Optional(t.Enum(["alb","lambda","instance","ip"])),name:t.Optional(t.String()),targetGroupArn:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),healthCheckProtocol:t.Optional(t.String()),healthCheckPort:t.Optional(t.String()),healthCheckPath:t.Optional(t.String()),healthCheckIntervalSeconds:t.Optional(t.Number()),healthCheckTimeoutSeconds:t.Optional(t.Number()),healthyThresholdCount:t.Optional(t.Number()),unhealthyThresholdCount:t.Optional(t.Number()),targets:t.Optional(t.Array(hK)),targetCount:t.Optional(t.Number()),healthyTargetCount:t.Optional(t.Number()),loadBalancerArns:t.Optional(t.Array(t.String()))}),EK=t.Object({first:t.Optional(t.String()),last:t.Optional(t.String()),scope:t.Optional(t.Number())}),_K=t.Object({type:t.Optional(t.String()),name:t.Optional(t.String()),alwaysServe:t.Optional(t.Boolean()),subnets:t.Optional(t.Array(t.Union([t.Number(),EK]))),target:t.Optional(t.String()),weight:t.Optional(t.Number()),priority:t.Optional(t.Number()),status:t.Optional(t.String())}),IK=t.Object({instanceId:t.Optional(t.String()),state:t.Optional(t.String()),reasonCode:t.Optional(t.String()),description:t.Optional(t.String())}),bK=t.Object({loadBalancerType:t.Optional(t.String()),dnsName:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),subnetIds:t.Array(t.String()),scheme:t.Optional(t.String()),listeners:t.Optional(t.Union([t.Array(mK),t.Array(dK)])),targets:t.Optional(t.Union([t.Array(t.String()),t.Array(IK),t.Array(_K)])),azureLoadBalancingRules:t.Optional(t.Array(yK))}),SK=t.Object({domainName:t.Optional(t.String()),expiresAt:t.Optional(E()),inUseBy:t.Optional(t.Array(t.String())),renewalEligibility:t.Optional(t.String()),revokedAt:t.Optional(E()),status:t.Optional(t.String()),type:t.Optional(t.String())}),OK=t.Object({state:t.Optional(t.Enum(["creating","available","deleting","deleted","error","in-use"])),volumeType:t.Optional(t.Enum(["gp2","gp3","io1","io2","st1","sc1","standard"]))}),AK=t.Object({osType:t.Optional(t.Enum(["Windows","Linux"]))}),xK=t.Object({state:t.Optional(t.String()),volumeType:t.Optional(t.String())}),RK=t.Intersect([t.Object({isEncrypted:t.Optional(t.Boolean()),sizeGib:t.Optional(t.Number())}),t.Union([OK,xK,AK])]),CK=t.Object({instanceCount:t.Optional(t.Number()),hostnames:t.Optional(t.Array(t.String())),runtime:t.Optional(t.String())}),wp=t.Union([t.Object({category:t.Literal("application"),resourceType:t.Literal("webService"),attributes:t.Optional(CK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("bucket"),attributes:t.Optional(Z2)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("messagingService"),attributes:t.Optional(sK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("fileSystem"),attributes:t.Optional(oK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("contentDeliveryNetwork"),attributes:t.Optional(X2)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("database"),attributes:t.Optional(J2)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("storageAccount"),attributes:t.Optional(pK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("volume"),attributes:t.Optional(RK)}),t.Object({category:t.Literal("compute"),resourceType:t.Literal("virtualMachine"),attributes:t.Optional(uK)}),t.Object({category:t.Literal("compute"),resourceType:t.Literal("serverless"),attributes:t.Optional(cK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("kubernetesCluster"),attributes:t.Optional(eK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerRepository"),attributes:t.Optional(tK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerCluster"),attributes:t.Optional(rK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerServiceTask"),attributes:t.Optional(nK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerService"),attributes:t.Optional(iK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerImage"),attributes:t.Optional(aK)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("virtualNetwork"),attributes:t.Optional(lK)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("loadBalancer"),attributes:bK}),t.Object({category:t.Literal("network"),resourceType:t.Literal("targetGroup"),attributes:t.Optional(TK)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("certificate"),attributes:t.Optional(SK)})],{description:"Normalized public inventory category, resource type, and category-specific attributes. Attribute shape depends on the category and resourceType combination."});var co="/v0/inventory",us=["aws","gcp","azure"],TP=["scan_in_progress","success","failure","partial"],Qd=t.Object({id:t.String({description:"Identifier of the inventory resource. Generated by Tsuga."}),cloudPlatform:t.Enum(us,{description:"Cloud platform where Tsuga discovered this resource."}),cloudAccount:t.String({description:"Cloud-native account identifier where Tsuga discovered this resource, such as an AWS account ID, GCP project ID, or Azure subscription ID."}),cloudRegion:t.Optional(t.String({description:"Cloud region where Tsuga discovered this resource, when the resource is regional."})),fullyQualifiedResourceId:t.String({description:"Cloud-native unique identifier for this resource, such as an AWS ARN, GCP resource name, or Azure resource ID."}),displayName:t.String({description:"Human-readable resource name shown in Tsuga. Derived from cloud provider metadata when available."}),nativeResourceType:t.String({description:"Cloud-native resource type reported by the inventory integration, for example `aws_ec2_instance` or `gcp_bucket`."}),resourceCreatedAt:t.Optional(E({description:"Timestamp when the resource was created in the cloud, when known."})),resourceUpdatedAt:t.Optional(E({description:"Timestamp when the resource was last updated in the cloud, when known."})),resourceLastSeenAt:E({description:"Timestamp when Tsuga last observed this resource during an inventory scan."}),tags:Me,nativeAttributes:t.Optional(t.Unsafe({type:"object",additionalProperties:!0})),covered:t.Optional(t.Boolean({description:"Whether the resource is covered by the configured infrastructure-as-code identifiers"}))}),Oi={DISPLAY_NAME:"displayName",CLOUD_ACCOUNT:"cloudAccount",NATIVE_RESOURCE_TYPE:"nativeResourceType",CLOUD_REGION:"cloudRegion",RESOURCE_TYPE:"resourceType",RESOURCE_CREATED_AT:"resourceCreatedAt"},EP=t.Object({cloudPlatforms:Be(t.Enum(us),{description:"Restrict results to resources discovered on any of these cloud platforms",maxItems:us.length}),cloudAccounts:Be(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud accounts",maxItems:500}),cloudRegions:Be(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud regions",maxItems:500}),nativeResourceTypes:Be(t.Enum(ps),{description:"Restrict results to resources of any of these cloud-native resource types",maxItems:ps.length}),resourceTypes:Be(t.Enum(Yd),{description:"Restrict results to resources of any of these normalized resource types",maxItems:Yd.length}),tags:Be(Vt.items,{description:"Restrict results to resources that have at least one of the listed key/value tags",maxItems:50}),isIacManaged:t.Boolean({description:"Restrict results by infrastructure-as-code coverage. When true, only resources covered by the configured IaC identifiers are returned; when false, only uncovered resources are returned."}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Case-insensitive substring matched against resource ID, display name, fully-qualified resource ID, cloud account, region, and resource type. Use the `tags` filter to narrow by tag. Wildcard characters are treated literally."}),exclude:t.Optional(t.Boolean({description:"If true, exclude resources matching this value instead of including them"}))},{description:"Search query filter for resources."})},{description:"Optional filters applied to narrow the returned resources"}),Wd=t.Partial(t.Object({...ye,filters:t.Partial(EP,{description:"Filters applied to narrow the returned resources."}),sort:t.Object({by:t.Enum([Oi.DISPLAY_NAME,Oi.CLOUD_ACCOUNT,Oi.NATIVE_RESOURCE_TYPE,Oi.CLOUD_REGION,Oi.RESOURCE_TYPE,Oi.RESOURCE_CREATED_AT],{description:"Field to sort the returned resources by"}),direction:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned resources. Ties are broken by resource ID for stable pagination."})})),BYe=m({tags:["inventory"],method:"POST",url:`${co}/resources/query`,paginated:!0,body:Wd,response:t.Array(t.Intersect([Qd,wp]))}),PK=["resourceType","cloudAccount","isIacManaged"],FYe=m({tags:["inventory"],method:"POST",url:`${co}/resources/counts`,body:t.Object({filters:t.Optional(t.Partial(EP)),groupBy:t.Enum(PK,{description:"Dimension to group the resource counts by."})}),response:t.Array(t.Object({value:t.String({description:'The group value the count belongs to: a resource type, a cloud account id, or "true"/"false" for IaC coverage.'}),count:t.Integer({description:"Number of resources in this group matching the requested filters."})}))}),HYe=m({tags:["inventory"],method:"GET",url:`${co}/resources/filter-options`,response:t.Object({cloudRegions:t.Array(t.String(),{description:"Distinct cloud regions present across the tenant's resources."}),nativeResourceTypes:t.Array(t.String(),{description:"Distinct cloud-native resource types present across the tenant's resources."}),tags:Yt})}),KYe=b("type",[t.Object({type:t.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:t.String({description:"AWS account ID that Tsuga scans."}),externalId:t.String({description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:t.String({description:"ARN of the IAM role Tsuga assumes to read inventory in the account."})}),t.Object({type:t.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:t.String({description:"GCP project ID that Tsuga scans."}),serviceAccountId:t.String({description:"Service account Tsuga impersonates to read inventory."}),workloadIdentityProvider:t.String({description:"Workload identity provider resource name used for federated authentication."})}),t.Object({type:t.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:t.String({description:"Client ID of the Azure application Tsuga authenticates as."}),subscriptionId:t.String({description:"Azure subscription ID that Tsuga scans."}),tenantId:t.String({description:"Azure tenant ID that owns the subscription."})})]),UK="^[0-9]{12}$",wK="^arn:aws[a-z-]*:iam::[0-9]{12}:role/.+$",NK="^[a-z][a-z0-9-]{4,28}[a-z0-9]$",LK="^[^@\\s]+@[^@\\s]+\\.iam\\.gserviceaccount\\.com$",vK="^//iam\\.googleapis\\.com/projects/[0-9]+/locations/global/workloadIdentityPools/[^/]+/providers/[^/]+$",Vd="^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$",kK=t.Object({type:t.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:t.String({pattern:UK,description:"AWS account ID that Tsuga scans.",errorMessage:{pattern:"Must be a 12-digit AWS account ID."}}),externalId:p({allowEmpty:!1,description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:t.String({pattern:wK,minLength:1,maxLength:2048,description:"ARN of the IAM role Tsuga assumes to read inventory in the account.",errorMessage:{pattern:"Must be an IAM role ARN, e.g. arn:aws:iam::123456789012:role/MyRole."}})},{$id:"AwsConnectionSettings"}),MK=t.Object({type:t.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:t.String({pattern:NK,minLength:6,maxLength:30,description:"GCP project ID that Tsuga scans.",errorMessage:{pattern:"Must be a GCP project ID (6-30 chars: lowercase letters, digits, hyphens)."}}),serviceAccountId:t.String({pattern:LK,minLength:1,maxLength:128,description:"Service account Tsuga impersonates to read inventory.",errorMessage:{pattern:"Must be a service account email, e.g. name@project.iam.gserviceaccount.com."}}),workloadIdentityProvider:t.String({pattern:vK,minLength:1,maxLength:256,description:"Full resource name of the workload identity provider used for federated authentication, e.g. //iam.googleapis.com/projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider.",errorMessage:{pattern:"Must be the full provider resource name: //iam.googleapis.com/projects/<PROJECT_NUMBER>/locations/global/workloadIdentityPools/<POOL_ID>/providers/<PROVIDER_ID>."}})},{$id:"GcpConnectionSettings"}),DK=t.Object({type:t.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:t.String({pattern:Vd,minLength:1,description:"Client ID of the Azure application Tsuga authenticates as (GUID).",errorMessage:{pattern:"Must be a GUID."}}),subscriptionId:t.String({pattern:Vd,minLength:1,description:"Azure subscription ID that Tsuga scans (GUID).",errorMessage:{pattern:"Must be a GUID."}}),tenantId:t.String({pattern:Vd,minLength:1,description:"Azure tenant ID that owns the subscription (GUID).",errorMessage:{pattern:"Must be a GUID."}})},{$id:"AzureConnectionSettings"}),_P=b("type",[kK,MK,DK],{description:"Credentials Tsuga uses to scan the account, in the provider-specific shape selected by `type`. Credentials are stored as provided and are not validated at creation time; failures surface through `lastScanStatus`."}),Ai=t.Object({id:t.String({description:"Identifier of the cloud account. Generated by Tsuga."}),cloudType:t.Enum(us,{description:"Cloud provider of the account."}),cloudAccountId:t.String({description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:t.Optional(t.String({description:"Human-readable name for the account shown in Tsuga."})),organizationId:t.Optional(t.String({description:"Cloud organization identifier, when known."})),createdBy:t.Optional(t.String({description:"Identifier of the user who created the account, when created by a user."})),createdAt:E({description:"Timestamp when the account was registered in Tsuga."}),lastScanStartedAt:t.Optional(E({description:"Timestamp when the most recent inventory scan started."})),lastScanFinishedAt:t.Optional(E({description:"Timestamp when the most recent inventory scan finished."})),lastScanStatus:t.Optional(t.Enum(TP,{description:"Status of the most recent inventory scan."}))}),Zd=t.Object({cloudType:t.Enum(us,{description:"Cloud provider of the account."}),cloudAccountId:p({allowEmpty:!1,description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:t.Optional(p({description:"Human-readable name for the account shown in Tsuga."})),organizationId:t.Optional(p({description:"Cloud organization identifier, when known."})),connectionSettings:_P,lastScanStatus:t.Optional(t.Enum(TP,{description:"Status of the most recent inventory scan."}))}),po=`${co}/cloud-accounts`,zYe=m({tags:["inventory"],url:po,method:"GET",response:t.Array(Ai)}),YYe=m({tags:["inventory"],url:`${po}/:id`,method:"GET",params:t.Object({id:p()}),response:Ai}),VYe=m({tags:["inventory"],url:po,method:"POST",body:Zd,response:Ai}),Xd=t.Object({accountFriendlyName:p({description:"Human-readable name for the account shown in Tsuga."})}),QYe=m({tags:["inventory"],url:`${po}/:id`,method:"PUT",params:t.Object({id:p()}),body:Xd,response:Ai}),WYe=m({tags:["inventory"],url:`${po}/:id`,method:"DELETE",params:t.Object({id:p()}),response:R}),ZYe=m({tags:["inventory"],url:`${co}/trigger-scan`,method:"POST",body:t.Object({}),response:t.Object({success:t.Literal(!0)})}),XYe=m({tags:["inventory"],url:`${po}/azure/onboarding`,method:"POST",body:t.Object({tenantId:p()}),response:t.Object({subjectId:t.String(),audience:t.String()})}),JYe=m({tags:["inventory"],method:"POST",url:`${po}/validate/:type`,params:t.Object({type:p()}),body:t.Object({data:_P,id:t.Optional(p())}),response:t.Object({areAccountSettingsValid:t.Boolean(),message:t.Optional(t.String())})}),IP=`${co}/settings`,eVe=m({tags:["inventory"],url:IP,method:"GET",response:t.Object({settings:t.Optional(t.Object({id:t.String(),infrastructureIdentifiers:t.Array(t.Object({name:t.String(),value:t.Optional(t.String())}))}))})}),GK=50,tVe=m({tags:["inventory"],url:IP,method:"POST",body:t.Object({infrastructureIdentifiers:t.Array(t.Object({name:p({allowEmpty:!1}),value:t.Optional(p({allowEmpty:!1}))}),{maxItems:GK})}),response:t.Object({})}),rVe=m({tags:["inventory"],url:`${co}/iac-tags-proposal`,method:"GET",response:t.Array(t.Object({name:t.String(),value:t.Optional(t.String())}))});var bP=`/${"v1"}/inventory`,$K=t.Omit(Qd,["nativeAttributes","covered"],{$id:"InventoryResourceBase",description:"Base fields shared by cloud resources discovered during inventory scans. Public inventory resources omit raw provider-native attributes and infrastructure-as-code coverage fields. See [Cloud resources](/documentation/categorize/cloud-resources)."}),SP=t.Intersect([$K,wp],{$id:"InventoryResource",description:"Cloud resource discovered by an inventory scan, together with normalized category, resource type, and public category-specific attributes. See [Cloud resources](/documentation/categorize/cloud-resources)."}),jK={id:"123-456-abc",cloudPlatform:"aws",cloudAccount:"123456789012",cloudRegion:"us-east-1",fullyQualifiedResourceId:"arn:aws:s3:::tsuga-example-bucket",displayName:"tsuga-example-bucket",nativeResourceType:"aws_s3_bucket",resourceCreatedAt:"2024-01-01T08:00:00.000Z",resourceLastSeenAt:"2024-01-15T12:34:56.000Z",tags:[{key:"team",value:"platform"}],category:"data",resourceType:"bucket",attributes:{versioningStatus:"Enabled"}};Object.assign(SP,{examples:[jK]});var OP=t.Object({...Wd.properties,...ze},{description:"Inventory resource query request. Use filters, sorting, limit, and offset to page through discovered resources."}),qK={filters:{cloudPlatforms:{values:["aws"]},cloudAccounts:{values:["123456789012"]},cloudRegions:{values:["us-east-1"]},resourceTypes:{values:["bucket"]},nativeResourceTypes:{values:["aws_s3_bucket"]},tags:{values:[{key:"team",value:"platform"}]},isIacManaged:!0,searchQuery:{value:"tsuga-example"}},sort:{by:"displayName",direction:"asc"},limit:10,offset:0};Object.assign(OP,{examples:[qK]});var AP=m({description:"Queries cloud resources discovered by inventory scans, with optional filters, sorting, and pagination. Use this endpoint to build infrastructure inventories across connected cloud accounts.",operationId:"queryInventoryResources",tags:["inventory"],url:`${bP}/resources/query`,method:"POST",paginated:!0,body:OP,response:t.Array(SP)}),ls=`${bP}/cloud-accounts`,ms=t.Pick(Ai,["id","cloudType","cloudAccountId","accountFriendlyName"],{$id:"CloudAccount"}),BK={id:"123-456-abc",cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS"};Object.assign(ms,{examples:[BK]});var xP=t.Pick(Zd,["cloudType","cloudAccountId","accountFriendlyName","connectionSettings"]),FK={cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS",connectionSettings:{type:"aws",accountId:"123456789012",externalId:"tsuga-external-id",roleArn:"arn:aws:iam::123456789012:role/tsuga-inventory"}};Object.assign(xP,{examples:[FK]});var HK=t.Pick(Xd,["accountFriendlyName"]),lVe=m({description:"Lists cloud accounts connected to Tsuga that the authenticated operation key can read.",operationId:"listCloudAccounts",tags:["inventory"],url:ls,method:"GET",response:t.Array(ms)}),mVe=m({description:"Retrieves one cloud account by ID.",operationId:"getCloudAccount",tags:["inventory"],url:`${ls}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the cloud account to retrieve. Use the `id` returned by the cloud account list or create operations."})}),response:ms}),dVe=m({description:"Registers a cloud account for inventory scanning. Connection settings are stored as provided and are not validated at creation time; scan failures surface through `lastScanStatus`.",operationId:"createCloudAccount",tags:["inventory"],url:ls,method:"POST",body:xP,response:ms}),fVe=m({description:"Updates the friendly name of a cloud account by ID.",operationId:"updateCloudAccount",tags:["inventory"],url:`${ls}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the cloud account to update. Use the `id` returned by the cloud account list or create operations."})}),body:HK,response:ms}),gVe=m({description:"Deletes a cloud account by ID. Future inventory scans stop for the account, and the trust relationship on the cloud side can be safely removed afterward.",operationId:"deleteCloudAccount",tags:["inventory"],url:`${ls}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the cloud account to delete. Use the `id` returned by the cloud account list or create operations."})}),response:R});var ds="/v0/investigations",KK=["dashboard","monitor","service","slo","log-route"],zK=t.Object({type:t.String({description:'Kind of linked asset, e.g. "dashboard"'}),id:t.String({description:"Identifier of the linked asset"})}),YK=t.Object({type:t.Enum(KK,{description:"Kind of linked asset"}),id:p({allowEmpty:!1,description:"Identifier of the linked asset"})}),Mr=t.Object({id:t.String({description:"Identifier of the investigation"}),name:t.String({description:"Human readable name shown for the investigation"}),slug:t.Optional(t.String({description:'Immutable identifier supplied by the creating agent, e.g. "incident-2024-06-payments-5xx". Set once at creation and matched against the agent telemetry to link back to the run that created the investigation.'})),contentMd:t.Optional(t.String({description:"Markdown content capturing the investigation notes and findings"})),tags:Me,owner:t.String({description:"Team ID owning the investigation"}),env:t.Optional(t.String({description:'Environment the investigation relates to, e.g. "prod"'})),linkedAssets:t.Array(zK,{description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}),creator:t.Optional(ue),updater:t.Optional(ue),createdAt:E({description:"Timestamp the investigation was created at."}),updatedAt:E({description:"Timestamp the investigation was last updated at."})},{title:"Investigation"}),Np=t.Object({name:p({allowEmpty:!1,description:"Human readable name shown for the investigation"}),slug:p({type:"kebab-case",allowEmpty:!1,description:'Immutable, unique identifier supplied by the creating agent, used to link the investigation back to the agent run, e.g. "incident-2024-06-payments-5xx". The agent should also emit this value in its telemetry.'}),contentMd:t.Optional(p({type:"long",description:"Markdown content capturing the investigation notes and findings"})),tags:Ve,owner:p({allowEmpty:!1,description:"Team ID owning the investigation"}),env:t.Optional(p({allowEmpty:!0,description:"Environment the investigation relates to"})),linkedAssets:t.Optional(t.Array(YK,{maxItems:100,description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}))}),Jd=t.Object(t.Omit(Np,["slug"]).properties),SVe=m({tags:["investigations"],url:ds,method:"GET",paginated:!0,query:t.Object(ye),response:t.Array(Mr)}),OVe=m({tags:["investigations"],url:`${ds}/:id`,params:t.Object({id:p()}),method:"GET",response:Mr}),AVe=m({tags:["investigations"],url:ds,method:"POST",body:Np,response:Mr}),xVe=m({tags:["investigations"],url:`${ds}/:id`,method:"PUT",body:Jd,params:t.Object({id:p()}),response:Mr}),RVe=m({tags:["investigations"],url:`${ds}/:id`,method:"DELETE",params:t.Object({id:p()}),response:R});var fs=`/${"v1"}/investigations`,RP=m({description:"Retrieve all investigations",tags:["private"],url:fs,method:"GET",paginated:!0,query:t.Object(ze),response:t.Array(Mr)}),CP=m({description:"Retrieve an investigation by its id",tags:["private"],url:`${fs}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1})}),response:Mr}),PP=m({description:"Create a new investigation",tags:["private"],url:fs,method:"POST",body:Np,response:Mr}),UP=m({description:"Update an investigation by its id",tags:["private"],url:`${fs}/:id`,method:"PUT",body:Jd,params:t.Object({id:p({allowEmpty:!1})}),response:Mr}),wP=m({description:"Delete an investigation by its id",tags:["private"],url:`${fs}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1})}),response:R});var NP=15,Lp={id:t.String({description:"Unique identifier of the processor within the route. Used to preserve processor identity during updates."}),description:t.Optional(t.String({description:"Optional user-provided processor note."})),tags:Me,updatedAt:t.Optional(E({description:"Timestamp when Tsuga last updated the processor."}))},vp={id:p({allowEmpty:!1,description:"Unique identifier of the processor within the route. Preserve it across updates for existing processors."}),description:t.Optional(p({type:"long",description:"Optional processor note."})),tags:Ve,updatedAt:t.Optional(E({description:"Backend-maintained timestamp for this processor. Omit this field on create and update requests; Tsuga sets or preserves it based on processor changes."}))},LP={...Lp,type:t.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},vP={...vp,type:t.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},VK=b("subtype",[t.Object({targetAttribute:t.String({description:"Attribute that will receive the formatted value"}),formatString:t.String({description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:t.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Whether missing referenced attributes render as empty strings. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorFormatString"}),t.Object({targetAttribute:t.String({description:"Attribute that will receive the computed value"}),formula:t.String({description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:t.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:t.Optional(t.Boolean({description:"Whether missing referenced attributes evaluate as zero. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorMathFormula"}),t.Object({targetAttribute:t.String({description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:t.String({description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:t.String({description:"String category value assigned when this clause matches."})}),{description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:t.Optional(t.String({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:t.Literal("category",{description:"Assigns the first matching category value from ordered query clauses, with an optional default."})},{$id:"ProcessorParamsCreatorCategory"})],{description:"Create processor configuration. The `subtype` discriminator selects how the value written to `targetAttribute` is built and which fields are required."}),QK=b("subtype",[t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:p({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:t.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))},{$id:"InputProcessorParamsCreatorFormatString"}),t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the computed value"}),formula:p({allowEmpty:!1,type:"long",description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:t.Optional(t.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:t.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:t.Optional(t.Boolean({description:"Set to true for missing referenced attributes to evaluate as zero. Defaults to true."}))},{$id:"InputProcessorParamsCreatorMathFormula"}),t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:p({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:p({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:NP,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:t.Optional(p({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:t.Literal("category",{description:"Assigns the first matching category value from ordered query clauses, with an optional default."})},{$id:"InputProcessorParamsCreatorCategory"})],{description:"Create processor configuration. The `subtype` discriminator selects how the value written to `targetAttribute` is built and which fields are required."}),WK=t.Object({...LP,params:VK}),ZK=t.Object({...vP,params:QK}),kP={...Lp,type:t.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},MP={...vp,type:t.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},XK=b("subtype",[t.Object({attributes:t.Array(t.Object({originAttribute:t.String({description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Whether the source attribute is preserved after mapping. If omitted, route processing treats this as false."})),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),targetAttribute:t.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"ProcessorParamsMapperMapAttributes"}),t.Object({attributeName:t.String({description:"Attribute whose value will determine the log level"}),subtype:t.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"ProcessorParamsMapperMapLevel"}),t.Object({attributeName:t.String({description:"Attribute whose value will determine the log timestamp"}),subtype:t.Literal("map-timestamp",{description:"Uses an event-time attribute as the log timestamp."})},{$id:"ProcessorParamsMapperMapTimestamp"})],{description:"Map processor configuration. The `subtype` discriminator selects whether existing attributes are copied or moved to new names, or used to set the log level or timestamp."}),JK=b("subtype",[t.Object({attributes:t.Array(t.Object({originAttribute:p({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:t.Optional(t.Boolean({description:"Overwrite the target attribute when it already exists (defaults to true)"})),targetAttribute:p({allowEmpty:!1,description:"Attribute name that will receive the mapped value"})}),{minItems:1,maxItems:50,description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"InputProcessorParamsMapperMapAttributes"}),t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will determine the log level"}),subtype:t.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"InputProcessorParamsMapperMapLevel"}),t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will determine the log timestamp"}),subtype:t.Literal("map-timestamp",{description:"Uses an event-time attribute as the log timestamp."})},{$id:"InputProcessorParamsMapperMapTimestamp"})],{description:"Map processor configuration. The `subtype` discriminator selects whether existing attributes are copied or moved to new names, or used to set the log level or timestamp."}),ez=t.Object({...MP,params:JK}),tz=t.Object({...kP,params:XK}),DP={...Lp,type:t.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},GP={...vp,type:t.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},$P=5,rz=b("subtype",[t.Object({attributeName:t.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(t.String({description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(t.String(),{description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:t.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),t.Object({sourceAttribute:t.String({description:"Attribute containing the URL to parse"}),subtype:t.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),t.Object({sourceAttribute:t.String({description:"Attribute containing the user agent string to parse"}),subtype:t.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),t.Object({sourceAttribute:t.String({description:"Attribute containing the key/value string segment to parse"}),targetAttribute:t.String({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:t.String({description:"Delimiter separating keys from values in the source string"}),pairsSplitter:t.String({description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:t.Boolean({description:"Whether keys without explicit values are accepted by the parser."}),subtype:t.Literal("key-value",{description:"Parses delimited key/value text into attributes."})})],{description:"Parse processor configuration. The `subtype` discriminator selects which parser reads the source text attribute and which fields it extracts."}),nz=b("subtype",[t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(p({allowEmpty:!1,type:"long",description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{minItems:1,maxItems:5,description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(p({type:"long"}),{maxItems:$P,description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:t.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),t.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the URL to parse"}),subtype:t.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),t.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the user agent string to parse"}),subtype:t.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),t.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the key/value string segment to parse"}),targetAttribute:p({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:p({allowEmpty:!1,description:"Delimiter separating keys from values in the source string"}),pairsSplitter:p({allowEmpty:!0,description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:t.Boolean({description:"Set to true to accept keys without explicit values."}),subtype:t.Literal("key-value",{description:"Parses delimited key/value text into attributes."})})],{description:"Parse processor configuration. The `subtype` discriminator selects which parser reads the source text attribute and which fields it extracts."}),oz=t.Object({...DP,params:rz}),iz=t.Object({...GP,params:nz}),az=t.Object({...vP,params:b("subtype",[t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:p({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:t.Literal("format-string"),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))}),t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:p({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:p({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:NP,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:t.Optional(p({description:"String category value used when no clause matches."})),subtype:t.Literal("category")})])}),sz=t.Object({...MP,params:t.Object({attributes:t.Array(t.Object({originAttribute:p({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:t.Optional(t.Boolean({description:"Overwrite the target attribute when it already exists (defaults to true)"})),targetAttribute:p({allowEmpty:!1,description:"Attribute name that will receive the mapped value"})}),{minItems:1,maxItems:50,description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes")})}),cz=t.Object({...GP,params:t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(p({allowEmpty:!1,type:"long",description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{minItems:1,maxItems:5,description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(p({type:"long"}),{maxItems:$P,description:"Example log lines for validating the Grok rules."})),subtype:t.Literal("grok")})}),jVe=b("type",[sz,cz,az]),pz=t.Object({...LP,params:b("subtype",[t.Object({targetAttribute:t.String({description:"Attribute that will receive the formatted value"}),formatString:t.String({description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),subtype:t.Literal("format-string"),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Whether missing referenced attributes render as empty strings."}))}),t.Object({targetAttribute:t.String({description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:t.String({description:"Query that selects logs for this category clause."}),value:t.String({description:"String category value assigned when this clause matches."})}),{description:"Conditions evaluated in order to determine the category value."}),defaultValue:t.Optional(t.String({description:"String category value used when no clause matches."})),subtype:t.Literal("category")})])}),uz=t.Object({...kP,params:t.Object({attributes:t.Array(t.Object({originAttribute:t.String({description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Whether the source attribute is preserved after mapping."})),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),targetAttribute:t.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes")})}),lz=t.Object({...DP,params:t.Object({attributeName:t.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(t.String({description:"Grok rule applied to parse text."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(t.String(),{description:"Example log lines for validating the Grok rules."})),subtype:t.Literal("grok")})}),qVe=b("type",[uz,lz,pz]),mz=11,jP=t.Cyclic({OutputProcessor:t.Union([tz,oz,WK,t.Object({...Lp,params:t.Object({items:t.Array(t.Object({query:t.String({description:"Query that determines whether logs enter this branch"}),processors:t.Array(t.Ref("OutputProcessor"),{description:"Processors executed when the branch query matches"})}),{description:"Conditional branches evaluated in order before falling back to the default"})}),type:t.Literal("split",{description:"Split processor. It sends each log through the first matching conditional branch."})})])},"OutputProcessor",{description:"Processing step executed sequentially on route logs"}),qP=t.Cyclic({InputProcessor:t.Union([ez,iz,ZK,t.Object({...vp,params:t.Object({items:t.Array(t.Object({query:p({type:"tsuga-query",description:"Query that determines whether logs enter this branch"}),processors:t.Array(t.Ref("InputProcessor"),{maxItems:50,description:"Processors executed when the branch query matches"})}),{minItems:2,maxItems:mz,description:"Conditional branches evaluated in order before falling back to the default"})}),type:t.Literal("split",{description:"Split processor. It sends each log through the first matching conditional branch."})})])},"InputProcessor",{description:"Processing step executed sequentially on route logs"});var dz="/v0/logs",_n=`${dz}/routes`,In=t.Object({id:t.String({description:"Tsuga-generated log route ID assigned when the route is created."}),name:t.String({description:"Human-readable route name shown in Tsuga."}),description:t.Optional(t.String({description:"Optional free-text note about the route's purpose, set by the caller. This metadata is not evaluated when matching or processing logs."})),isEnabled:t.Boolean({description:"Whether this route is active for newly ingested logs. Disabled routes remain saved but do not process logs."}),query:t.String({description:"Tsuga query that selects which newly ingested logs enter the route processor chain."}),rank:t.Number({description:"Tsuga-assigned evaluation order, unique across all routes and dense (no gaps). Enabled routes are checked from lower rank to higher rank during ingestion, and every route whose query matches a log applies its processors to it \u2014 matching is not stopped after the first hit. New routes are appended with the highest rank; deleting a route shifts all higher ranks down by one to close the gap. Use `PUT /:id/modify-ranking` to move a route to a different rank, which shifts the routes between its old and new position accordingly."}),tags:Me,owner:t.String({description:"ID of the team that owns the route. Determines which team members can view and manage it, and which tag policies apply to it. Only an org admin or an admin of this team may change the `query` field or delete the route."}),processors:t.Array(jP,{description:"Processors applied in array order to logs that match the route, each transforming the output of the previous one. A `split` processor forks the chain into branches and cannot be followed by another processor at the same level."}),creator:t.Optional(ue),updater:t.Optional(ue),updatedAt:E({description:"Timestamp when Tsuga last updated the route."}),createdAt:E({description:"Timestamp when Tsuga created the route."}),assetUpdatedAt:E({description:"Timestamp when Tsuga last changed route behavior. This can differ from `updatedAt` when only metadata such as `description` or `tags` changed."})},{title:"LogRoute"}),gs=t.Object({name:p({allowEmpty:!1,description:"Human-readable log route name shown in Tsuga."}),description:t.Optional(p({type:"long",description:"Optional free-text note about the log route's purpose. This metadata is not evaluated when matching or processing logs."})),isEnabled:t.Boolean({description:"Set to true for the log route to process newly ingested matching logs. Set to false to save it without running it."}),query:p({type:"tsuga-query",description:"Tsuga query that selects which newly ingested logs enter the log route processor chain."}),tags:Ve,owner:p({allowEmpty:!1,description:"ID of the team that will own the log route, determining which team members can view and manage it and which tag policies apply. Only an org admin or an admin of this team may change the `query` field or delete the log route."}),processors:t.Array(qP,{maxItems:50,description:"Processors applied in array order to logs that match the log route, each transforming the output of the previous one. Up to 50 are accepted. A `split` processor forks the chain into branches and cannot be followed by another processor at the same level."})});var WVe=m({tags:["routes"],url:_n,method:"GET",paginated:!0,query:t.Object(ye),response:t.Array(In)}),ZVe=m({tags:["routes"],url:`${_n}/:id`,params:t.Object({id:p()}),method:"GET",response:In}),XVe=m({tags:["routes"],url:_n,method:"POST",body:gs,response:In}),JVe=m({tags:["routes"],url:`${_n}/:id`,method:"PUT",body:gs,params:t.Object({id:p()}),response:In}),e5e=m({tags:["routes"],url:`${_n}/:id/clone`,method:"POST",params:t.Object({id:p()}),body:gs,response:In}),t5e=m({tags:["routes"],url:`${_n}/:id`,method:"DELETE",params:t.Object({id:p()}),response:R}),r5e=m({description:"Moves a route to a new rank, shifting the ranks of the routes between its old and new position by one to keep ranks dense and unique. Affects the route's evaluation order for newly ingested logs; does not change any route's processors or other fields.",tags:["routes"],url:`${_n}/:id/modify-ranking`,method:"PUT",params:t.Object({id:p()}),body:t.Object({rank:t.Integer({minimum:1,description:"Target rank for the route, from 1 to the total number of routes. Requests outside that range are rejected."})}),response:t.Object({})}),n5e=m({description:"Sets a route's `isEnabled` state without changing any other field. Disabling a route stops it from processing newly ingested logs while keeping it saved and its rank unchanged.",tags:["routes"],url:`${_n}/:id/enable`,method:"PUT",params:t.Object({id:p()}),body:t.Object({enable:t.Boolean({description:"Set to true to enable the route, or false to disable it."})}),response:In});var ys=`/${"v1"}/routes`,BP={name:"Enrich API Gateway Logs",description:"Adds service metadata and normalizes log format",isEnabled:!0,query:"service:api-gateway",tags:[{key:"category",value:"enrichment"}],owner:"team-123-abc",processors:[{id:"parse-gateway-message",type:"parse-attribute",tags:[],params:{subtype:"grok",attributeName:"message",rules:["%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} %{GREEDYDATA:msg}"]}}]},FP={name:"Normalize Checkout Logs",description:"Maps service fields and extracts key/value details",isEnabled:!0,query:"context.service.name:checkout",tags:[{key:"category",value:"normalization"}],owner:"team-123-abc",processors:[{id:"map-service-name",type:"mapper",tags:[],params:{subtype:"map-attributes",attributes:[{originAttribute:"context.service.name",targetAttribute:"service",keepOrigin:!1,overrideTarget:!0}]}},{id:"parse-logfmt-message",type:"parse-attribute",tags:[],params:{subtype:"key-value",sourceAttribute:"message",targetAttribute:"logfmt",keyValueSplitter:"=",pairsSplitter:" ",acceptStandaloneKey:!1}}]},hs=t.Pick(In,["id","name","description","isEnabled","query","tags","owner","processors"],{$id:"Route",description:"Team-owned log processing definition that selects newly ingested logs and applies ordered processors. See [Routes](/documentation/process/routes/index)."}),fz={id:"123-456-abc",...BP},gz={id:"456-789-def",...FP};Object.assign(hs,{examples:[fz,gz]});var HP=m({description:"Lists log routes visible to the authenticated operation key. Returned routes are ordered by evaluation order, with earlier routes evaluated first. Use this to inventory ingest-time processing definitions and owners. Pagination fields limit the returned page.",operationId:"listRoutes",tags:["routes"],url:ys,method:"GET",paginated:!0,query:t.Object(ze),response:t.Array(hs)}),KP=m({description:"Retrieves one log route by ID.",operationId:"getRoute",tags:["routes"],url:`${ys}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to retrieve. Use the `id` returned by route list or create responses."})}),response:hs}),ef=t.Pick(gs,["name","description","isEnabled","query","tags","owner","processors"],{description:"Log route create or update request. Provide the route metadata, source query, owner team, enabled state, tags, and ordered processors."});Object.assign(ef,{examples:[BP,FP]});var zP=m({description:"Creates a log route at the end of the evaluation order. Routes affect only newly ingested logs after the cluster receives the updated configuration.",operationId:"createRoute",tags:["routes"],url:ys,method:"POST",body:ef,response:hs}),YP=m({description:"Updates an existing log route by ID without changing its evaluation order. Fields omitted from the request keep their existing values. Routes affect only newly ingested logs after the cluster receives the updated configuration.",operationId:"updateRoute",tags:["routes"],url:`${ys}/:id`,method:"PUT",body:ef,params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to update. Use the `id` returned by route list, get, or create responses."})}),response:hs}),VP=m({description:"Deletes a log route by ID and compacts the evaluation order for remaining routes. The route stops processing future logs after the cluster receives the updated configuration.",operationId:"deleteRoute",tags:["routes"],url:`${ys}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to delete. Use the `id` returned by route list, create, or update responses."})}),response:R});var Ts=`/${"v1"}/monitors`,Es=t.Pick(xr,["id","name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],{$id:"Monitor",description:"Saved alert definition that evaluates telemetry and creates alert transitions. Notification delivery is configured separately with notification rules. See [Monitors](/documentation/alert/monitors/index)."}),WP={name:"High Error Rate Alert",message:"Error rate exceeded threshold. Check the API gateway logs.",tags:[{key:"severity",value:"critical"}],configuration:{type:"log",timeframe:5,groupByFields:[],aggregationAlertLogic:"no_aggregation",queries:[{aggregate:{type:"count"},filter:"level:ERROR service:api-gateway"}],conditions:[{formula:"q1",operator:"greater_than",threshold:100}],noDataBehavior:"resolve"},priority:1,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},ZP={name:"High CPU Utilization By Service",message:"More than half of grouped services are above the CPU threshold.",tags:[{key:"severity",value:"warning"}],configuration:{type:"metric",timeframe:10,groupByFields:[{fields:["context.service.name"],limit:10}],aggregationAlertLogic:"proportion",proportionAlertThreshold:50,queries:[{aggregate:{type:"average",field:"system.cpu.utilization"},filter:"context.service.name:checkout"}],conditions:[{formula:"q1",operator:"greater_than",threshold:.8}],noDataBehavior:"keep_last_status"},priority:2,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},XP={name:"Certificate Expiry Warning",message:"A certificate is approaching expiry.",tags:[{key:"environment",value:"production"}],configuration:{type:"certificate-expiry",warnBeforeInDays:30,cloudAccounts:["aws-prod"],aggregationAlertLogic:"each",noDataBehavior:"resolve"},priority:3,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},JP={name:"New Error Pattern Detector",message:"A new error pattern was detected in the logs.",tags:[{key:"team",value:"platform"}],configuration:{type:"log-error-pattern",aggregationAlertLogic:"each",noDataBehavior:"keep_last_status",filter:{teamIds:["team-123-abc"],env:"production",service:"api-gateway"}},priority:2,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},yz={id:"123-456-abc",...WP},hz={id:"234-567-bcd",...ZP},Tz={id:"345-678-cde",...XP},Ez={id:"456-789-def",...JP};Object.assign(Es,{examples:[yz,hz,Tz,Ez]});var QP=t.Pick(Ml,["filters","sort","limit","offset"]),eU=t.Object({...QP.properties,...ze,filters:QP.properties.filters},{description:"Monitor query request. Use filters, sorting, limit, and offset to page through visible monitors."}),_z={filters:{owners:{values:["team-123-abc"]},searchQuery:{value:"service:api-gateway"},tags:{values:[{key:"paging",value:"true"}]},priorities:{values:[4,5],exclude:!0},types:{values:["threshold"]},activity:"active",clusterIds:{values:["cluster-123-abc"]}},sort:{by:"name",direction:"asc"},limit:10,offset:0};Object.assign(eU,{examples:[_z]});var tU=m({description:"Queries monitors visible to the authenticated operation key. Use this endpoint to inventory monitor definitions, filter by owner, tag, priority, type, activity, or cluster, and page through results. See [Monitors](/documentation/alert/monitors/index).",operationId:"queryMonitors",tags:["monitors"],url:`${Ts}/query`,method:"POST",paginated:!0,body:eU,response:t.Array(Es)}),rU=m({description:"Retrieves one monitor definition by ID.",operationId:"getMonitor",tags:["monitors"],url:`${Ts}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Monitor ID returned by monitor query, create, or update operations."})}),response:Es}),nU=["name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],oU=t.Pick(La,nU,{$id:"CreateMonitorRequest",description:"Monitor creation request. Provide ownership, data access, alert configuration, priority, tags, and optional dashboard or cluster scope."}),iU=t.Pick(La,nU,{$id:"UpdateMonitorRequest",description:"Monitor update request. Required fields and the submitted configuration are overwritten; omitted `message`, `tags`, and `clusterIds` keep their existing values. Omitting `dashboardId` clears the dashboard link."}),aU=WP,sU=ZP,cU=XP,pU=JP;Object.assign(oU,{examples:[aU,sU,cU,pU]});Object.assign(iU,{examples:[aU,sU,cU,pU]});var uU=m({description:"Creates a monitor owned by the specified team. The monitor can evaluate logs, metrics, traces, anomaly behavior, certificate expiry, or new error patterns depending on its configuration.",operationId:"createMonitor",tags:["monitors"],url:Ts,method:"POST",body:oU,response:Es}),lU=m({description:"Updates an existing monitor definition by ID. Required fields and the submitted configuration are overwritten; omitted `message`, `tags`, and `clusterIds` keep their existing values. Omitting `dashboardId` clears the dashboard link, and public updates clear any existing snooze because `pauseUntil` is not part of the public schema.",operationId:"updateMonitor",tags:["monitors"],url:`${Ts}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved monitor to update. Use the `id` returned by monitor query or create responses."})}),body:iU,response:Es}),Iz=t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved monitor to delete. Use the `id` returned by monitor query, create, or update responses."})}),mU=m({description:"Deletes a monitor by ID. Deleting a monitor stops future evaluations and alert transitions for that monitor.",operationId:"deleteMonitor",tags:["monitors"],url:`${Ts}/:id`,method:"DELETE",params:Iz,response:R});var _s=`/${"v1"}/notification-rules`,Is=t.Pick(ri,["id","name","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter","clusterIdsFilter","owner","isActive","tags","targets"],{$id:"Rule",description:"Notification rule that matches alert transitions and routes notifications to one or more targets. See [Rules](/documentation/alert/notifications/rules)."}),dU={name:"Critical Alerts",queryString:"env:prod service:api",teamsFilter:{type:"all-public-teams"},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"],clusterIdsFilter:[],owner:"team-123-abc",isActive:!0,tags:[{key:"channel",value:"alerts"}],targets:[{id:"789-abc-def",rateLimit:{maxMessages:10,minutes:5},config:{type:"email",addresses:["oncall@example.com"],renotifyConfig:{mode:"each",renotificationStates:["alert"],renotifyIntervalMinutes:30}}}]},bz={id:"123-456-abc",...dU};Object.assign(Is,{examples:[bz]});var fU=m({description:"Lists notification rules visible to the authenticated operation key. Use this endpoint to audit alert delivery routing. Pagination fields limit the returned page.",operationId:"listNotificationRules",tags:["notification-rules"],url:_s,method:"GET",paginated:!0,query:t.Object(ze),response:t.Array(Is)}),gU=m({description:"Retrieves one notification rule by ID.",operationId:"getNotificationRule",tags:["notification-rules"],url:`${_s}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification rule to retrieve. Use the `id` returned by notification rule list or create responses."})}),response:Is}),tf=t.Pick(Ma,["name","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter","clusterIdsFilter","owner","tags","isActive","targets"],{description:"Notification rule create or update request. Provide matching filters, owner, tags, active state, and delivery targets."}),Sz=dU;Object.assign(tf,{examples:[Sz]});var yU=m({description:"Creates a notification rule that matches alert transitions and sends notifications to configured targets. Monitors keep evaluating separately from notification rules.",operationId:"createNotificationRule",tags:["notification-rules"],url:_s,method:"POST",body:tf,response:Is}),hU=m({description:"Updates an existing notification rule by ID. Required fields and the submitted target list are overwritten; omitted optional fields keep their existing values.",operationId:"updateNotificationRule",tags:["notification-rules"],url:`${_s}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification rule to update. Use the `id` returned by notification rule list, get, or create responses."})}),body:tf,response:Is}),Oz=t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification rule to delete. Use the `id` returned by notification rule list, get, create, or update responses."})}),TU=m({description:"Deletes a notification rule by ID. Alerting monitors continue to evaluate, but this rule no longer sends notifications.",operationId:"deleteNotificationRule",tags:["notification-rules"],url:`${_s}/:id`,method:"DELETE",params:Oz,response:R});var xi=`${ei}/silences`,EU=t.Union([t.Literal("monday"),t.Literal("tuesday"),t.Literal("wednesday"),t.Literal("thursday"),t.Literal("friday"),t.Literal("saturday"),t.Literal("sunday")]),Az=t.Partial(t.Record(EU,t.Array(t.Object({startTime:t.String({format:Wu,description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:t.String({format:Wu,description:"Local end time for this recurring silence window on this day. It must be after `startTime`, and ranges on the same day cannot overlap."})},{title:"SilenceTimeRange"}),{minItems:1,description:"Silence windows for this day. Each window uses the schedule time zone, and windows on the same day cannot overlap."})),{description:"Recurring silence windows keyed by day of week, evaluated in the schedule `timeZone` or in UTC when it is omitted. At least one day must be listed, and a day with no entry is never silenced. Each window covers `startTime` up to but not including `endTime`."}),xz=t.Partial(t.Record(EU,t.Array(t.Object({startTime:t.String({description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:t.String({description:"Local end time for this recurring silence window on this day. It must be after `startTime`, and ranges on the same day cannot overlap."})},{title:"SilenceTimeRange"}),{description:"Silence windows for this day. Each window uses the schedule time zone, and windows on the same day cannot overlap."})),{description:"Recurring silence windows keyed by day of week, evaluated in the schedule `timeZone` or in UTC when it is omitted. A day with no entry is never silenced. Each window covers `startTime` up to but not including `endTime`."}),kp='IANA timezone identifier (e.g. "America/New_York"). Defaults to UTC if omitted.',_U="One-time silence schedule with specific start and end times",IU="Recurring weekly silence schedule",Rz=b("type",[t.Object({type:t.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:t.String({format:Zu,description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:t.String({format:Zu,description:"Local end date and time for the one-time silence. It must be after `startTime` and in the future."}),timeZone:t.Optional(t.String({format:Qu,description:kp}))},{$id:"InputSilenceScheduleOneTime",description:_U}),t.Object({type:t.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:Az,timeZone:t.Optional(t.String({format:Qu,description:kp}))},{$id:"InputSilenceScheduleRecurring",description:IU})],{description:"Schedule defining when the silence is active. The `type` field discriminates between a `one-time` window and a `recurring` weekly window. Once a one-time schedule's `endTime` passes, or a recurring window closes, the silence stops suppressing notifications but is not deleted; delete it explicitly if it is no longer needed."}),Cz=b("type",[t.Object({type:t.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:t.String({description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:t.String({description:"Local end date and time for the one-time silence. It must be after `startTime` and in the future when created or updated."}),timeZone:t.Optional(t.String({description:kp}))},{$id:"OutputSilenceScheduleOneTime",description:_U}),t.Object({type:t.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:xz,timeZone:t.Optional(t.String({description:kp}))},{$id:"OutputSilenceScheduleRecurring",description:IU})],{description:"Schedule defining when the silence is active. The `type` field discriminates between a `one-time` window and a `recurring` weekly window. Once a one-time schedule's `endTime` passes, or a recurring window closes, the silence stops suppressing notifications but is not deleted; delete it explicitly if it is no longer needed."}),Mp=t.Object({name:p({description:"Display name of the silence"}),reason:p({allowEmpty:!1,type:"long",description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the silence"}),tags:Ve,isActive:t.Boolean({description:"Set to true for the silence to suppress matching notifications while its schedule is active. Set to false to keep the silence without suppressing anything."}),schedule:Rz,notificationRuleIds:t.Optional(t.Array(p(),{description:"Notification rule IDs this silence applies to directly, matching any notification produced by one of these rules regardless of priority or transition type. Mutually exclusive with `prioritiesFilter`, `transitionTypesFilter`, and `queryString`: a request combining this field with any of those is rejected."})),queryString:t.Optional(p({type:"tags-query",description:"Query string to filter which alerts this silence applies to"})),teamsFilter:Kl,prioritiesFilter:t.Array(t.Enum(dt),{maxItems:dt.length,description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(zn),{maxItems:zn.length,description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."})}),Ri=t.Object({id:t.String({description:"Tsuga-generated notification silence ID assigned when the silence is created."}),name:t.String({description:"Display name of the silence"}),reason:t.String({description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:t.String({description:"Team ID that owns and manages the silence"}),tags:Me,isActive:t.Boolean({description:"Whether the silence suppresses matching notifications while its schedule is active. When false, the silence is kept but never suppresses anything."}),schedule:Cz,notificationRuleIds:t.Optional(t.Array(t.String(),{description:"Notification rule IDs this silence applies to directly, matching any notification produced by one of these rules regardless of priority or transition type. Set only when `prioritiesFilter`, `transitionTypesFilter`, and `queryString` are not used to filter alerts."})),queryString:t.Optional(t.String({description:"Query string filtering which alerts this silence applies to"})),teamsFilter:Hl,prioritiesFilter:t.Array(t.Enum(dt),{description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(zn),{description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."}),createdAt:E(),updatedAt:E(),creator:t.Optional(ue),updater:t.Optional(ue)}),k5e=m({tags:["notification-silences"],url:xi,method:"GET",response:t.Array(Ri)}),M5e=m({tags:["notification-silences"],url:`${xi}/:id`,params:t.Object({id:p()}),method:"GET",response:Ri}),D5e=m({tags:["notification-silences"],url:xi,method:"POST",body:Mp,response:Ri}),G5e=m({tags:["notification-silences"],url:`${xi}/:id`,method:"PUT",params:t.Object({id:p()}),body:Mp,response:Ri}),$5e=m({tags:["notification-silences"],url:`${xi}/:id`,method:"DELETE",params:t.Object({id:p()}),response:R}),j5e=m({tags:["notification-silences"],url:`${xi}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})});var bs=`/${"v1"}/notification-silences`,Ss=t.Pick(Ri,["id","name","reason","owner","tags","isActive","schedule","notificationRuleIds","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter"],{$id:"NotificationSilence",description:"Scheduled mute rule that suppresses matching notification delivery while monitors continue evaluating. See [Silences](/documentation/alert/notifications/silences)."}),Pz={id:"sil-weekend-maintenance",name:"Weekend maintenance",reason:"Suppress expected alerts during the weekly maintenance window.",owner:"team-123-abc",tags:[{key:"environment",value:"production"}],isActive:!0,schedule:{type:"recurring",weeklySchedule:{saturday:[{startTime:"02:00",endTime:"06:00"}],sunday:[{startTime:"02:00",endTime:"06:00"}]},timeZone:"UTC"},teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"]},Uz={id:"sil-critical-routing",name:"Critical routing maintenance",reason:"Temporarily suppress notifications from the critical routing rule.",owner:"team-123-abc",tags:[{key:"change",value:"chg-1234"}],isActive:!0,schedule:{type:"one-time",startTime:"2026-07-04T02:00:00",endTime:"2026-07-04T04:00:00",timeZone:"UTC"},notificationRuleIds:["rule-critical-routing"],teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[],transitionTypesFilter:[]};Object.assign(Ss,{examples:[Pz,Uz]});var bU=m({description:"Lists notification silences visible to the authenticated operation key. Use this endpoint to audit maintenance windows and notification muting rules.",operationId:"listNotificationSilences",tags:["notification-silences"],url:bs,method:"GET",response:t.Array(Ss)}),SU=m({description:"Retrieves one notification silence by ID.",operationId:"getNotificationSilence",tags:["notification-silences"],url:`${bs}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification silence to retrieve. Use the `id` returned by notification silence list or create responses."})}),response:Ss}),rf=t.Pick(Mp,["name","reason","owner","tags","isActive","schedule","notificationRuleIds","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter"],{description:"Notification silence create or update request. Provide the mute reason, owner, schedule, filters, active state, and tags."}),wz={name:"Weekend maintenance",reason:"Suppress expected alerts during the weekly maintenance window.",owner:"team-123-abc",tags:[{key:"environment",value:"production"}],isActive:!0,schedule:{type:"recurring",weeklySchedule:{saturday:[{startTime:"02:00",endTime:"06:00"}],sunday:[{startTime:"02:00",endTime:"06:00"}]},timeZone:"UTC"},teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"]},Nz={name:"Critical routing maintenance",reason:"Temporarily suppress notifications from the critical routing rule.",owner:"team-123-abc",tags:[{key:"change",value:"chg-1234"}],isActive:!0,schedule:{type:"one-time",startTime:"2026-07-04T02:00:00",endTime:"2026-07-04T04:00:00",timeZone:"UTC"},notificationRuleIds:["rule-critical-routing"],teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[],transitionTypesFilter:[]};Object.assign(rf,{examples:[wz,Nz]});var OU=m({description:"Creates a notification silence. Matching notifications that have not yet been sent are suppressed as soon as the schedule becomes active, including ones already queued when the silence is created; monitor evaluation itself is not paused, so alerts still transition and are visible in the UI.",operationId:"createNotificationSilence",tags:["notification-silences"],url:bs,method:"POST",body:rf,response:Ss}),AU=m({description:"Updates an existing notification silence by ID. Required fields are overwritten; omitted optional fields keep their existing values.",operationId:"updateNotificationSilence",tags:["notification-silences"],url:`${bs}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification silence to update. Use the `id` returned by notification silence list, get, or create responses."})}),body:rf,response:Ss}),Lz=t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification silence to delete. Use the `id` returned by notification silence list, get, create, or update responses."})}),xU=m({description:"Deletes a notification silence. Any notification not yet sent is re-evaluated against the remaining silences and, if none match, is delivered normally; notifications already marked as silenced are not resent.",operationId:"deleteNotificationSilence",tags:["notification-silences"],url:`${bs}/:id`,method:"DELETE",params:Lz,response:R});var vz={critical:3,important:2,normal:1},oe=e=>({label:e,weight:vz[e]}),kz={"unrouted-logs":{key:"unrouted-logs",title:"Logs with no matching route",summary:"Any log that reaches processing without a matched route is flagged.",rationale:"Close gaps by ensuring each event flows through a governed route.",objectType:"route",category:"observability-assets",impact:oe("important"),recommendation:"Ensure each team maintains a route that captures all of its logs exactly once."},"no-over-routed-logs":{key:"no-over-routed-logs",title:"No logs matching 3+ routes",summary:"Detects logs that match 3 or more processing routes during the lookback window.",rationale:"A log usually only needs one or two routes. Matching many routes typically means the route queries overlap unintentionally, multiplying the processing and storage cost without adding observability value.",objectType:"route",category:"observability-assets",impact:oe("important"),recommendation:"Review the route queries owned by this team for overlap. Tighten the filter on each route so a given log matches the minimum number of routes needed (usually one)."},"team-has-route":{key:"team-has-route",title:"\u22651 route per team",summary:"Each team owns at least one active route that filters on its team name.",rationale:"Provides clear governance boundaries for routing and enrichment.",objectType:"route",category:"observability-assets",impact:oe("important"),recommendation:"Ensure every team manages a dedicated route scoped to its context.team value."},"service-name-present":{key:"service-name-present",title:`${rp} present`,summary:`Logs and spans must populate ${rp} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:oe("critical"),recommendation:`Populate ${rp} in all log and span payloads.`},"no-orphan-spans":{key:"no-orphan-spans",title:"No orphan spans",summary:"Every span with parent_span_id references an existing span in the same trace.",rationale:"Trace integrity depends on preserving parent-child hierarchies.",objectType:"span",category:"telemetry-hygiene",impact:oe("normal"),recommendation:"Emit parent spans before their children so references always resolve."},"metric-unit-consistency":{key:"metric-unit-consistency",title:"Name\u2192unit consistency",summary:"All series for a metric name report the same UCUM-compliant unit across the lookback period.",rationale:"Avoid ambiguity when charting and alerting on metrics with shared names.",objectType:"metric",category:"telemetry-hygiene",impact:oe("important"),recommendation:"Align exporters so each metric name emits a single consistent unit across services and environments."},"host-name-present":{key:"host-name-present",title:`${Na} presence`,summary:`Logs and spans must populate ${Na} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:oe("important"),recommendation:`Populate ${Na} in all log and span payloads.`},"inconsistent-attribute-naming":{key:"inconsistent-attribute-naming",title:"Consistent attribute naming",summary:"Detects attributes with multiple naming variants (e.g., userId vs user_id).",rationale:"Consistent naming improves queryability.",objectType:"log",category:"telemetry-hygiene",impact:oe("normal"),recommendation:"Standardize attribute naming conventions across all log sources."},"no-duplicate-attr-values":{key:"no-duplicate-attr-values",title:"No duplicate attribute values",summary:"Detects when different attributes consistently carry identical values across logs (e.g., err.type and error.type always having the same value).",rationale:"Redundant attributes waste storage and complicate querying. Consolidate to one.",objectType:"log",category:"telemetry-hygiene",impact:oe("normal"),recommendation:"Consolidate duplicate attributes at the source to reduce storage costs."},"no-debug-logs-in-prod":{key:"no-debug-logs-in-prod",title:"No DEBUG logs in production",summary:"Detects DEBUG-level logs emitted in production environments.",rationale:"DEBUG logs in production increase costs and risk exposing sensitive data.",objectType:"log",category:"telemetry-hygiene",impact:oe("important"),recommendation:"Remove DEBUG-level logging from production environment or adjust log level configuration."},"no-multiline-logs":{key:"no-multiline-logs",title:"No ungrouped multiline logs",summary:"Detects orphaned stack-trace and traceback continuation lines that should have been grouped into a single log entry by the collector.",rationale:"Ungrouped multiline logs fragment errors across many entries, making them harder to read, search, and alert on.",objectType:"log",category:"telemetry-hygiene",impact:oe("important"),recommendation:"Configure multiline grouping on the log collector using a line_start_pattern (e.g. a timestamp regex) so stack traces are sent as a single entry."},"no-error-logs-as-info":{key:"no-error-logs-as-info",title:"No error logs mapped as info",summary:"Detects INFO-level logs that carry error fields such as error.*, err.*, exception.*, or a stack trace.",rationale:"A log with error or exception attributes but an INFO severity is never surfaced as an error, so teams miss real failures caused by a misconfigured level mapper or bad logging.",objectType:"log",category:"telemetry-hygiene",impact:oe("important"),recommendation:"Map these logs to ERROR in the level mapper, or fix the source logging so errors and exceptions are emitted at the right severity."},"no-empty-dashboards":{key:"no-empty-dashboards",title:"No empty dashboards",summary:"Flags dashboards with 1 or fewer widgets.",rationale:"Empty or near-empty dashboards add clutter and make it harder to find useful dashboards.",objectType:"dashboard",category:"observability-assets",impact:oe("normal"),recommendation:"Add meaningful widgets to dashboards or remove empty ones to reduce clutter."},"monitor-has-notification":{key:"monitor-has-notification",title:"No monitors without notification",summary:"Every monitor has at least one active notification destination configured.",rationale:"A monitor without notifications is effectively silent - it detects issues but nobody is alerted.",objectType:"monitor",category:"observability-assets",impact:oe("important"),recommendation:"Add a notification destination to every monitor - a monitor without notifications is effectively silent."},"no-future-dated-logs":{key:"no-future-dated-logs",title:"No future-dated logs",summary:"Detects logs with timestamps more than 59 minutes ahead of their intake time.",rationale:"Future-dated logs break dashboards, alerting, and log ordering - they indicate clock skew or incorrect timestamp generation.",objectType:"log",category:"telemetry-hygiene",impact:oe("important"),recommendation:"Fix clock synchronization or timestamp generation for services emitting future-dated logs - they break dashboards and alerting."},"metric-usage":{key:"metric-usage",title:"Metric usage",summary:"Percentage of ingested metrics that are referenced by a dashboard or monitor, or were queried in the last 30 days.",rationale:"Metrics that are never visualized, alerted on, or queried add ingestion cost and cardinality without providing value.",objectType:"metric",category:"telemetry-adoption",impact:oe("important"),recommendation:"Stop emitting metrics that are never referenced or queried to reduce ingestion cost and cardinality.",scope:"global"},"no-stale-dashboards":{key:"no-stale-dashboards",title:"No stale dashboards",summary:"Flags dashboards that have not been edited in over 180 days.",rationale:"Stale dashboards may contain outdated queries or irrelevant data, making it harder for teams to find useful, up-to-date information.",objectType:"dashboard",category:"observability-assets",impact:oe("normal"),recommendation:"Review and update dashboards that haven't been edited in 180+ days, or archive them if no longer relevant."},"no-unused-dashboards":{key:"no-unused-dashboards",title:"No unused dashboards",summary:"Flags dashboards with zero views in the last 60 days.",rationale:"Dashboards that nobody views add clutter and may confuse team members looking for relevant information.",objectType:"dashboard",category:"telemetry-adoption",impact:oe("important"),recommendation:"Archive or delete dashboards that nobody has viewed in the last 60 days to reduce noise."},"no-orphan-monitors":{key:"no-orphan-monitors",title:"No monitors without dashboards",summary:"Every monitor should be linked to at least one dashboard.",rationale:"Monitors without a linked dashboard make it harder for teams to investigate alerts \u2014 responders need a dashboard to quickly understand the context and scope of an issue.",objectType:"monitor",category:"observability-assets",impact:oe("important"),recommendation:"Link monitors to relevant dashboards so teams can quickly investigate when alerts fire."},"no-flapping-monitors":{key:"no-flapping-monitors",title:"No flappy monitors",summary:"P1/P2 monitors should not have any group (or the monitor itself) trigger 7+ alerts within 7 days.",rationale:"Monitors that constantly flip between alert and OK cause alert fatigue. Teams start ignoring notifications, increasing the risk of missing real incidents.",objectType:"monitor",category:"observability-assets",impact:oe("important"),recommendation:"Tune thresholds, add hysteresis, or adjust evaluation windows to reduce flapping."},"no-noisy-group-monitors":{key:"no-noisy-group-monitors",title:"No noisy group-by monitors",summary:"P1/P2 group-by monitors should not have 5+ groups triggering alerts simultaneously on 2+ occasions within 7 days.",rationale:"When a group-by monitor triggers alerts for many groups at once repeatedly, the signal gets lost in noise. Responders cannot prioritize and the monitor effectively becomes useless.",objectType:"monitor",category:"observability-assets",impact:oe("important"),recommendation:"Narrow the group-by scope, raise thresholds, or split into more targeted monitors."},"no-long-alert-monitors":{key:"no-long-alert-monitors",title:"No monitors stuck in alert",summary:"P1/P2 monitors should not remain in alert state for more than 15 days.",rationale:"A high-priority monitor stuck in alert for weeks signals an unresolved issue or a misconfigured threshold. Either way, the alert loses meaning and contributes to alert fatigue.",objectType:"monitor",category:"observability-assets",impact:oe("important"),recommendation:"Investigate and resolve the underlying issue, adjust the threshold, or acknowledge and close the alert."},"no-redundant-monitors":{key:"no-redundant-monitors",title:"No redundant monitors",summary:"P1/P2 monitors should not always trigger at the same time as another monitor (3+ co-triggers within 7 days).",rationale:"A monitor that always fires alongside another monitor is redundant. It adds noise without providing additional signal, making it harder for responders to identify the root cause.",objectType:"monitor",category:"observability-assets",impact:oe("important"),recommendation:"Investigate whether the redundant monitor can be removed or consolidated with the one it always co-triggers with."},"no-absent-log-fields":{key:"no-absent-log-fields",title:"No absent log fields",summary:"Dashboards and monitors should reference log fields that still appear in recent logs (last 24 hours).",rationale:"References to log fields that no longer exist silently break dashboards and monitors, eroding trust in observability.",objectType:"dashboard",category:"observability-assets",impact:oe("important"),recommendation:"Remove, rename, or backfill log fields that are referenced by dashboards or monitors but have not been seen in the last 24 hours.",scope:"global"},"k8s-recommended-attributes":{key:"k8s-recommended-attributes",title:"Kubernetes recommended resource attributes",summary:"Kubernetes logs and spans should populate core identity attributes and at least one workload-ownership attribute.",rationale:"These attributes let Tsuga correlate telemetry with the Kubernetes objects that produced it, which is required for faulty-deployment detection and rollback suggestions.",objectType:"resource",category:"collection-coverage",impact:oe("important"),recommendation:"Make sure every Kubernetes workload emits k8s.cluster.name, k8s.namespace.name, k8s.pod.name, k8s.pod.uid, k8s.container.name, k8s.node.name and one workload-ownership attribute (for example via the OpenTelemetry Collector k8s_attributes processor)."},"k8s-recommended-metrics":{key:"k8s-recommended-metrics",title:"Kubernetes recommended cluster metrics",summary:"All recommended Kubernetes cluster metrics are collected.",rationale:"These metrics are the primary signals for faulty-deployment detection; without k8s.container.status.reason and the usage/limit pairs, container crash loops and resource starvation cannot be diagnosed.",objectType:"metric",category:"collection-coverage",impact:oe("important"),recommendation:"Enable the OpenTelemetry Collector k8s_cluster receiver (for example via the Tsuga Helm chart) so the required Kubernetes metrics are emitted.",scope:"global"},"k8s-recommended-change-events":{key:"k8s-recommended-change-events",title:"Kubernetes recommended change events",summary:"Change events are collected for the Kubernetes object kinds recommended for rollback suggestions.",rationale:"Faulty-deployment detection needs the history of ReplicaSet, Deployment, Pod and Node changes to identify failing revisions and propose rollbacks.",objectType:"log",category:"collection-coverage",impact:oe("important"),recommendation:"Configure the Kubernetes change-event collector (for example the OpenTelemetry k8sobjects receiver) so change events for Pod, Deployment, ReplicaSet, StatefulSet, DaemonSet, Namespace and Node are ingested."},"otel-collector-self-metrics":{key:"otel-collector-self-metrics",title:"OpenTelemetry Collector self-metrics",summary:"A cluster collecting Kubernetes metrics through an OpenTelemetry Collector also emits the collector self-metrics (otelcol_*).",rationale:"The Kubernetes receivers feed the Kubernetes explorer. Without the collector self-metrics there is no way to tell a healthy pipeline from one that drops data or fails to export, so a stale or missing Kubernetes view cannot be explained.",objectType:"metric",category:"collection-coverage",impact:oe("important"),recommendation:"Enable the collector's internal telemetry (service.telemetry.metrics) and export it to Tsuga so otelcol_* metrics are available.",scope:"global"},"use-standard-attributes":{key:"use-standard-attributes",title:"Standard attribute usage",summary:"Detects log attributes that should be remapped to Tsuga standard attributes.",rationale:"Standard attributes enable consistent querying, out-of-the-box dashboards, and cross-team correlation.",objectType:"log",category:"telemetry-hygiene",impact:oe("important"),recommendation:"Use the attribute remapper in your routes to rename attributes to their standard equivalents."},"no-unused-operation-api-keys":{key:"no-unused-operation-api-keys",title:"No unused operation API keys",summary:"Flags operation API keys with no activity in the last 180 days.",rationale:"Long-idle operation credentials add risk if leaked and clutter the inventory. Tracking last-used activity makes it easy to rotate or delete the unused ones.",objectType:"api-key",category:"observability-assets",impact:oe("important"),recommendation:"Rotate or delete operation API keys that have not been used in the last 180 days."},"no-unused-ingestion-api-keys":{key:"no-unused-ingestion-api-keys",title:"No unused ingestion API keys",summary:"Flags ingestion API keys with no telemetry in the last 30 days across any cluster.",rationale:"Dormant ingestion credentials add risk if leaked and clutter the inventory. Tracking key activity makes it easy to rotate or delete the unused ones.",objectType:"api-key",category:"observability-assets",impact:oe("important"),recommendation:"Rotate or delete ingestion API keys that have sent no data in the last 30 days."},"db-logs-trace-correlation":{key:"db-logs-trace-correlation",title:"Database logs correlated with traces",summary:`Database logs should carry ${JS} so they can be tied back to the trace that issued the query.`,rationale:"Linking database server logs to client traces lets users jump from a slow request to the exact query log. Without a trace id, database logs cannot be joined to the request that produced them.",objectType:"log",category:"telemetry-hygiene",impact:oe("normal"),recommendation:"Enable trace correlation on the database log pipeline (for example via SQLcommenter, which embeds the traceparent in each statement) so query logs carry a trace id.",scope:"team"},"db-server-metrics-collected":{key:"db-server-metrics-collected",title:"Database server metrics collected",summary:"Every database technology seen in client spans should have its OpenTelemetry server-metrics receiver configured.",rationale:"Server metrics (connections, throughput, replication, contention) are needed to investigate database slowness beyond what client spans show. A detected database with no server metrics has a gap in its monitoring setup.",objectType:"metric",category:"collection-coverage",impact:oe("important"),recommendation:"Configure the matching OpenTelemetry server-metrics receiver for each detected database technology (for example postgresqlreceiver, mysqlreceiver, mongodbreceiver, redisreceiver).",scope:"global"}},Mz=new Set(["azure_container_registry","azure_container_registry_image","azure_app_service_certificate","azure_virtual_network"]),Dz=ps.filter(e=>e.startsWith("azure_")&&!Mz.has(e)),RU={"aws-sqs-metrics-collected":{label:"Amazon SQS",source:"AWS/SQS",nativeResourceTypes:["aws_sqs_queue"],metricPrefixes:["aws_sqs_"]},"aws-sns-metrics-collected":{label:"Amazon SNS",source:"AWS/SNS",nativeResourceTypes:["aws_sns_topic"],metricPrefixes:["aws_sns_"]},"aws-kinesis-metrics-collected":{label:"Amazon Kinesis Data Streams",source:"AWS/Kinesis",nativeResourceTypes:["aws_kinesis_data_stream"],metricPrefixes:["aws_kinesis_"]},"aws-dynamodb-metrics-collected":{label:"Amazon DynamoDB",source:"AWS/DynamoDB",nativeResourceTypes:["aws_dynamodb_table"],metricPrefixes:["aws_dynamodb_"]},"aws-rds-metrics-collected":{label:"Amazon RDS",source:"AWS/RDS",nativeResourceTypes:["aws_rds_instance"],metricPrefixes:["aws_rds_"]},"aws-elasticache-metrics-collected":{label:"Amazon ElastiCache",source:"AWS/ElastiCache",nativeResourceTypes:["aws_elasticache"],metricPrefixes:["aws_elasticache_"]},"aws-s3-metrics-collected":{label:"Amazon S3",source:"AWS/S3",nativeResourceTypes:["aws_s3_bucket"],metricPrefixes:["aws_s3_"]},"aws-ebs-metrics-collected":{label:"Amazon EBS",source:"AWS/EBS",nativeResourceTypes:["aws_ebs_volume"],metricPrefixes:["aws_ebs_"]},"aws-efs-metrics-collected":{label:"Amazon EFS",source:"AWS/EFS",nativeResourceTypes:["aws_efs"],metricPrefixes:["aws_efs_"]},"aws-ec2-metrics-collected":{label:"Amazon EC2",source:"AWS/EC2",nativeResourceTypes:["aws_ec2_instance"],metricPrefixes:["aws_ec2_"]},"aws-lambda-metrics-collected":{label:"AWS Lambda",source:"AWS/Lambda",nativeResourceTypes:["aws_lambda_function"],metricPrefixes:["aws_lambda_"]},"aws-ecs-metrics-collected":{label:"Amazon ECS",source:"AWS/ECS",nativeResourceTypes:["aws_ecs_cluster","aws_ecs_service","aws_ecs_task"],metricPrefixes:["aws_ecs_"]},"aws-ecr-metrics-collected":{label:"Amazon ECR",source:"AWS/ECR",nativeResourceTypes:["aws_ecr_repository"],metricPrefixes:["aws_ecr_"]},"aws-elb-metrics-collected":{label:"Elastic Load Balancing",source:"AWS/ApplicationELB, AWS/NetworkELB",nativeResourceTypes:["aws_elastic_load_balancer"],metricPrefixes:["aws_applicationelb_","aws_networkelb_","aws_gatewayelb_","aws_elb_"]},"aws-cloudfront-metrics-collected":{label:"Amazon CloudFront",source:"AWS/CloudFront",nativeResourceTypes:["aws_cloudfront_distribution"],metricPrefixes:["aws_cloudfront_"]},"aws-acm-metrics-collected":{label:"AWS Certificate Manager",source:"AWS/CertificateManager",nativeResourceTypes:["aws_acm_certificate"],metricPrefixes:["aws_certificatemanager_"]},"gcp-pubsub-metrics-collected":{label:"Google Cloud Pub/Sub",source:"pubsub.googleapis.com",nativeResourceTypes:["gcp_pubsub_topic"],metricPrefixes:["pubsub.googleapis.com/"]},"gcp-storage-metrics-collected":{label:"Google Cloud Storage",source:"storage.googleapis.com",nativeResourceTypes:["gcp_bucket"],metricPrefixes:["storage.googleapis.com/"]},"gcp-compute-metrics-collected":{label:"Google Compute Engine",source:"compute.googleapis.com",nativeResourceTypes:["gcp_compute_instance","gcp_compute_disk"],metricPrefixes:["compute.googleapis.com/"]},"gcp-cloud-sql-metrics-collected":{label:"Google Cloud SQL",source:"cloudsql.googleapis.com",nativeResourceTypes:["gcp_cloud_sql_instance"],metricPrefixes:["cloudsql.googleapis.com/"]},"gcp-gke-metrics-collected":{label:"Google Kubernetes Engine",source:"kubernetes.io, container.googleapis.com",nativeResourceTypes:["gcp_gke_cluster"],metricPrefixes:["kubernetes.io/","container.googleapis.com/"]},"gcp-cloud-run-metrics-collected":{label:"Google Cloud Run",source:"run.googleapis.com",nativeResourceTypes:["gcp_cloud_run_service","gcp_cloud_run_job","gcp_cloud_run_function"],metricPrefixes:["run.googleapis.com/"]},"gcp-artifact-registry-metrics-collected":{label:"Google Artifact Registry",source:"artifactregistry.googleapis.com",nativeResourceTypes:["gcp_artifact_registry_repository"],metricPrefixes:["artifactregistry.googleapis.com/"]},"gcp-load-balancing-metrics-collected":{label:"Google Cloud Load Balancing",source:"loadbalancing.googleapis.com",nativeResourceTypes:["gcp_forwarding_rule"],metricPrefixes:["loadbalancing.googleapis.com/"]},"gcp-bigtable-metrics-collected":{label:"Google Cloud Bigtable",source:"bigtable.googleapis.com",nativeResourceTypes:["gcp_bigtable_instance"],metricPrefixes:["bigtable.googleapis.com/"]},"gcp-spanner-metrics-collected":{label:"Google Cloud Spanner",source:"spanner.googleapis.com",nativeResourceTypes:["gcp_spanner_instance"],metricPrefixes:["spanner.googleapis.com/"]},"gcp-firestore-metrics-collected":{label:"Google Cloud Firestore",source:"firestore.googleapis.com",nativeResourceTypes:["gcp_firestore_database"],metricPrefixes:["firestore.googleapis.com/"]},"gcp-app-engine-metrics-collected":{label:"Google App Engine",source:"appengine.googleapis.com",nativeResourceTypes:["gcp_app_engine_service"],metricPrefixes:["appengine.googleapis.com/"]},"azure-metrics-collected":{label:"Azure",source:"Azure Monitor",nativeResourceTypes:Dz,metricPrefixes:["azure_"]}},Gz=Object.fromEntries(Object.keys(RU).map(e=>{let{label:r,source:n}=RU[e];return[e,{key:e,title:`${r} metrics collected`,summary:`${r} resources found in inventory should have their metrics collected.`,rationale:"A resource that appears in inventory but whose metrics are not collected leaves its dashboards and resource-explorer views empty and impossible to alert on.",objectType:"metric",category:"collection-coverage",impact:oe("important"),recommendation:`Enable the ${n} metrics integration so ${r} metrics are ingested.`,scope:"global"}]})),$z={...kz,...Gz},CU=Object.values($z);var PU=["passed","failed","ignored"],jz=t.Enum(PU,{description:"Evaluation outcome for this rule row. Allowed values are passed, failed, and ignored; ignored means the rule was not applicable to the available data."}),qz=["aws-sqs-metrics-collected","aws-sns-metrics-collected","aws-kinesis-metrics-collected","aws-dynamodb-metrics-collected","aws-rds-metrics-collected","aws-elasticache-metrics-collected","aws-s3-metrics-collected","aws-ebs-metrics-collected","aws-efs-metrics-collected","aws-ec2-metrics-collected","aws-lambda-metrics-collected","aws-ecs-metrics-collected","aws-ecr-metrics-collected","aws-elb-metrics-collected","aws-cloudfront-metrics-collected","aws-acm-metrics-collected","gcp-pubsub-metrics-collected","gcp-storage-metrics-collected","gcp-compute-metrics-collected","gcp-cloud-sql-metrics-collected","gcp-gke-metrics-collected","gcp-cloud-run-metrics-collected","gcp-artifact-registry-metrics-collected","gcp-load-balancing-metrics-collected","gcp-bigtable-metrics-collected","gcp-spanner-metrics-collected","gcp-firestore-metrics-collected","gcp-app-engine-metrics-collected","azure-metrics-collected"],of=["unrouted-logs","no-over-routed-logs","team-has-route","service-name-present","no-orphan-spans","metric-unit-consistency","host-name-present","inconsistent-attribute-naming","no-duplicate-attr-values","no-debug-logs-in-prod","no-multiline-logs","no-error-logs-as-info","no-empty-dashboards","monitor-has-notification","no-future-dated-logs","metric-usage","no-stale-dashboards","no-unused-dashboards","no-orphan-monitors","no-flapping-monitors","no-noisy-group-monitors","no-long-alert-monitors","no-redundant-monitors","no-absent-log-fields","k8s-recommended-attributes","k8s-recommended-metrics","k8s-recommended-change-events","otel-collector-self-metrics","use-standard-attributes","no-unused-operation-api-keys","no-unused-ingestion-api-keys","db-logs-trace-correlation","db-server-metrics-collected",...qz],Bz=t.Enum(of),Fz=["log","metric","resource","span","api-key","dashboard","monitor","route"],Hz=["collection-coverage","telemetry-hygiene","observability-assets","telemetry-adoption"],Kz=["critical","important","normal"],zz=["team","global"],af=t.Object({key:t.Enum(of),title:t.String(),summary:t.String(),rationale:t.String(),objectType:t.Enum(Fz),category:t.Enum(Hz),impact:t.Object({label:t.Enum(Kz),weight:t.Number()}),recommendation:t.String(),scope:t.Optional(t.Enum(zz))}),UU=t.Object({type:t.String({description:"Tsuga asset kind referenced by this example (e.g. `monitor`)"}),label:t.String({description:"Human-readable summary of the example"}),link:t.Object({to:t.String({description:"In-app route the example deep-links to"}),search:t.Optional(t.Unknown({description:"Search-query payload for the deep link"})),params:t.Optional(t.Unknown({description:"Route params for the deep link"}))},{description:"In-app deep link to inspect the example"})}),nf=t.Intersect([af,t.Object({status:jz,normalizedScore:t.Number(),details:t.Optional(t.Record(t.String(),t.Unknown())),recommendation:t.Optional(t.String()),examples:t.Optional(t.Array(UU))})]),Yz=t.Object({generatedAt:t.String(),overallScore:t.Optional(t.Number()),rules:t.Array(af),teamResults:t.Array(t.Object({teamId:t.String(),teamName:t.String(),teamWeight:t.Number(),score:t.Number(),weightedScore:t.Number(),totalWeight:t.Number(),ruleResults:t.Array(nf)})),globalResults:t.Optional(t.Object({score:t.Optional(t.Number()),ruleResults:t.Array(nf)}))}),sf=t.Object({id:t.String({description:"Identifier of this persisted quality-report row. Generated by Tsuga when report rows are stored. Returned on every row. Treat it as an opaque ID."}),reportId:t.String({description:"Identifier shared by rows from the same report generation for the same team or global cluster-wide scope. Generated by Tsuga when the report is stored. Returned on every row."}),ruleId:t.Enum(of,{description:"Stable key for the telemetry-quality rule evaluated by this row. Set by Tsuga from the quality-rule catalog. Returned on every row. The enum may grow as Tsuga adds rules; clients should display unknown future values as opaque rule keys if they do not have local labels."}),owner:t.Optional(t.String({description:"Team identifier this row applies to. Set to the owning team ID for team-scoped rules. Returned for team rows; omitted for global cluster-wide rows."})),status:t.Enum(PU,{description:"Evaluation outcome for this rule row. Set by the rule evaluator when the report is generated. Returned on every row. Allowed values are passed, failed, and ignored; ignored means the rule was not applicable to the available data."}),score:t.Number({description:"Normalized score for this rule row. Set by the rule evaluator when the report is generated. Returned on every row. Values are between 0 and 1."}),weight:t.Number({description:"Impact weight of this rule, captured at report-generation time. Set by Tsuga from the rule's impact label: 1 for normal, 2 for important, 3 for critical. Used with score to compute reportOverallScore."}),reportOverallScore:t.Number({description:"Aggregate score for this row's report group. Calculated by Tsuga from non-ignored rows in the same team or global cluster-wide report. Returned on every row in that group with the same value."}),reportTotalWeight:t.Number({description:"Sum of non-ignored rule weights for this row's report group. Calculated by Tsuga when the report is generated. Returned on every row in that group with the same value."}),recommendation:t.Optional(t.String({description:"Recommendation stored with this row. Set by the rule evaluator when the report is generated. Returned when a recommendation was persisted; omitted otherwise. The latest-report endpoint does not recompute or default it at read time."})),examples:t.Optional(t.Array(UU,{description:"Assets, logs, metrics, or links supporting this rule result. Set by the rule evaluator when the report is generated. Returned when examples were persisted and visible to the caller; global row examples are returned only to admin users."})),createdAt:t.String({description:"ISO timestamp the row was generated at"})}),r6e=m({tags:["quality-reports"],url:"/v0/quality-reports",method:"POST",response:Yz}),cf=t.Optional(p({allowEmpty:!1,description:"Identifier of the cluster whose latest quality-report rows are returned. Use the id from the clusters API. Required when the organization has multiple clusters; omit only in single-cluster organizations. Unknown cluster IDs return RESOURCE_NOT_FOUND."})),n6e=m({tags:["quality-reports"],url:"/v0/quality-reports/latest",method:"GET",query:t.Object({clusterId:cf,team:t.Optional(p({allowEmpty:!1}))}),response:t.Array(sf,{description:"Latest persisted rule evaluation rows for the cluster"})}),o6e=m({tags:["quality-reports"],url:"/v0/quality-reports/preview",method:"POST",body:t.Object({ruleKey:Bz,teamId:t.Optional(p({allowEmpty:!1})),lookbackMinutes:t.Optional(t.Integer({minimum:1,maximum:60})),clusterId:t.Optional(p({allowEmpty:!1}))}),response:t.Object({rule:af,result:nf,teamId:t.Optional(t.String()),teamName:t.Optional(t.String())})}),i6e=new Map(CU.map(e=>[e.key,e]));var Vz=`/${"v1"}/quality-reports`,wU=t.Pick(sf,["id","reportId","ruleId","owner","status","score","weight","reportOverallScore","reportTotalWeight","recommendation","examples","createdAt"],{$id:"QualityReportRow",description:"Persisted evaluation of one telemetry-quality rule for a team or cluster-wide scope. See [Quality reports](/documentation/account-and-settings/quality-reports)."}),Qz={id:"01j9x3z4vyabcdfghjkmnpqrst",reportId:"01j9x3z4vyabcdfghjkmnpqrsu",ruleId:"team-has-route",owner:"01j9x3z4vyabcdfghjkmnpqrr",status:"passed",score:1,weight:2,reportOverallScore:.85,reportTotalWeight:2,createdAt:"2026-02-26T12:00:00.000Z"};Object.assign(wU,{examples:[Qz]});var Wz=t.Object({clusterId:cf,team:t.Optional(p({allowEmpty:!1,description:"Team name used to scope the report. Matched against Tsuga team names. Optional; when set, returns only rows for that team and omits global rows. Unknown team names return RESOURCE_NOT_FOUND; teams the caller cannot access return an empty result."}))},{description:"Latest quality report lookup query."}),NU=m({description:"Retrieves the latest persisted quality-report rows for a cluster, optionally scoped to one team. Use this to audit telemetry hygiene and routing recommendations.",operationId:"getLatestQualityReport",tags:["quality-reports"],url:`${Vz}/latest`,method:"GET",query:Wz,response:t.Array(wU)});var Os="/v0/admin-center";var gr=`${Os}/retention-policies`,LU=3650,Zz=t.Integer({description:"Number of days Tsuga retains matching telemetry."}),vU=t.Integer({minimum:1,maximum:LU,description:`Number of days Tsuga should retain matching telemetry. Valid values are 1 through ${LU}.`}),Dr=t.Object({id:t.String({description:"Unique identifier of the retention policy. Generated by Tsuga."}),env:t.Optional(t.String({description:"Environment tag value this policy applies to. Omitted policies apply across environments unless a more specific policy exists."})),teamId:t.Optional(t.String({description:"Team ID this policy applies to. Omitted policies apply globally unless a team-specific policy exists."})),dataSource:t.Enum(pr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:Zz,isEnabled:t.Boolean({description:"Whether this policy participates in retention resolution."}),createdAt:E({description:"Timestamp when Tsuga created the retention policy."}),updatedAt:E({description:"Timestamp when Tsuga last updated the retention policy."})}),Dp=t.Object({env:t.Optional(p({description:"Environment tag value this policy applies to. Omit for a policy that is not environment-specific."})),teamId:t.Optional(p({description:"Team ID this policy applies to. Omit for a policy that is not team-specific."})),dataSource:t.Enum(pr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:vU,isEnabled:t.Boolean({description:"Set to true for the policy to participate in retention resolution."})}),kU=t.Array(t.Object({env:p(),dataSource:t.Enum(pr),durationDays:t.Union([vU,t.Null()]),isEnabled:t.Boolean()})),MU=t.Object({inserted:t.Array(Dr),updated:t.Array(Dr),deleted:t.Array(Dr)}),_6e=m({tags:["retention-policies"],url:gr,method:"POST",body:Dp,response:Dr}),I6e=m({tags:["retention-policies"],url:gr,method:"GET",response:t.Array(Dr)}),b6e=m({tags:["retention-policies"],url:`${gr}/:id`,method:"GET",params:t.Object({id:p()}),response:Dr}),S6e=m({tags:["retention-policies"],url:`${gr}/:id`,method:"PUT",params:t.Object({id:p()}),body:Dp,response:Dr}),O6e=m({tags:["retention-policies"],url:`${gr}/bulk-update`,method:"POST",body:kU,response:MU}),A6e=m({tags:["retention-policies"],url:`${gr}/bulk-update-for-team`,method:"POST",body:t.Object({teamId:p(),policies:kU}),response:MU}),x6e=m({tags:["retention-policies"],url:`${gr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:R}),As=["past-24-hours","past-7-days","past-30-days"],R6e=m({tags:["retention-policies"],url:`${gr}/requested-history-percentile/:teamId`,method:"POST",params:t.Object({teamId:p()}),body:t.Object({percentile:t.Number({minimum:0,maximum:1}),observationWindow:t.Enum(As),dataSource:t.Enum(pr)}),response:t.Object({percentile:t.Number(),observationWindow:t.Enum(As),dataSource:t.Enum(pr),teamId:t.String(),requestedHistoryDays:t.Number()})}),Xz=["1-day","3-days","7-days","1-month","6-months","more-than-6-months"];var Jz=t.Array(t.Object({bucket:t.Enum(Xz),count:t.Number()})),C6e=m({tags:["retention-policies"],url:`${gr}/requested-history-histogram/:teamId`,method:"POST",params:t.Object({teamId:p()}),body:t.Object({observationWindow:t.Enum(As),dataSource:t.Enum(pr)}),response:t.Object({observationWindow:t.Enum(As),dataSource:t.Enum(pr),teamId:t.String(),histogram:Jz})}),P6e=m({tags:["retention-policies"],url:`${gr}/top-teams-with-retention-surplus`,method:"POST",body:t.Object({dataSource:t.Enum(pr),observationWindow:t.Enum(As),percentile:t.Number({minimum:0,maximum:1}),topN:t.Optional(t.Number({minimum:1,maximum:20}))}),response:t.Array(t.Object({teamId:t.String(),retentionSurplusDays:t.Number()}))});var xs=`/${"v1"}/retention-policies`,Rs=t.Pick(Dr,["id","env","teamId","dataSource","durationDays","isEnabled"],{$id:"RetentionPolicy",description:"Retention rule for logs, metrics, or traces. Policies can apply globally, to an environment, or to a team depending on which scope fields are present. See [Retention](/documentation/account-and-settings/retention)."}),e3={id:"123-456-abc",env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(Rs,{examples:[e3]});var DU=m({description:"Lists retention policy rows visible to the authenticated operation key. Use this to audit retention duration by signal, environment, and team.",operationId:"listRetentionPolicies",tags:["retention-policies"],url:xs,method:"GET",response:t.Array(Rs)}),GU=m({description:"Retrieves one retention policy by ID.",operationId:"getRetentionPolicy",tags:["retention-policies"],url:`${xs}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the retention policy to retrieve. Use the `id` returned by retention policy list or create responses."})}),response:Rs}),pf=t.Pick(Dp,["env","teamId","dataSource","durationDays","isEnabled"],{description:"Retention policy create or update request. Provide the telemetry signal, retention duration, enabled state, and optional environment or team scope."}),t3={env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(pf,{examples:[t3]});var $U=m({description:"Creates a retention policy row for a telemetry signal, optionally scoped to an environment or team. Only one policy may exist per combination of data source, environment, and team; creating a duplicate combination fails.",operationId:"createRetentionPolicy",tags:["retention-policies"],url:xs,method:"POST",body:pf,response:Rs}),jU=m({description:"Replaces an existing retention policy by ID, including signal, scope fields, duration, and enabled state.",operationId:"updateRetentionPolicy",tags:["retention-policies"],url:`${xs}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the retention policy to update. Use the `id` returned by retention policy list, get, or create responses."})}),body:pf,response:Rs}),qU=m({description:"Deletes a retention policy by ID. Retention resolution falls back to the next broader matching policy when one exists.",operationId:"deleteRetentionPolicy",tags:["retention-policies"],url:`${xs}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the retention policy to delete. Use the `id` returned by retention policy list, create, or update responses."})}),response:R});var Cs=`/${"v1"}/slos`,r3=t.Pick(jl,["id","sloId","priority","configuration"],{$id:"SloAlert",description:"Alert attached to an SLO, triggered on a burn-rate multiplier or an SLO target threshold"}),Ps=t.Object({...t.Pick(Jo,["id","name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds"]).properties,alerts:t.Array(r3,{description:"Alerts attached to this SLO"})},{$id:"Slo",description:"Service Level Objective definition: its SLI configuration, target percentage, rolling timeframe, cluster scope, and attached alerts"}),n3={id:"123-456-abc",name:"API availability 99.9%",description:"Overall API gateway availability over the last 30 days",tags:[{key:"team",value:"platform"}],configuration:{type:"event",dataSource:"logs",goodQuery:{queries:[{filter:"status:ok",aggregate:{type:"count"}}],formula:"q1"},totalQuery:{queries:[{filter:"*",aggregate:{type:"count"}}],formula:"q1"},noDataBehavior:"good"},target:99.9,timeframeDays:30,owner:"team-123-abc",permissions:"all",clusterIds:[],alerts:[{id:"alert-123-abc",sloId:"123-456-abc",priority:1,configuration:{type:"burn-rate",burnRate:14.4}}]};Object.assign(Ps,{examples:[n3]});var BU=t.Pick(Bl,["filters","sort","limit","offset"]),FU=t.Object({...BU.properties,...ze,filters:BU.properties.filters},{description:"SLO query request. Use filters, sorting, limit, and offset to page through visible SLOs."}),o3={filters:{owners:{values:["team-123-abc"]},searchQuery:{value:"availability"},tags:{values:[{key:"team",value:"platform"}]},statuses:{values:["breached"]},clusterIds:{values:["cluster-123-abc"]}},sort:{by:"name",direction:"asc"},limit:10,offset:0};Object.assign(FU,{examples:[o3]});var HU=m({description:"Queries SLOs visible to the authenticated operation key. Use this endpoint to inventory SLO definitions, filter by owner, tag, status, or cluster, and page through results.",operationId:"querySlos",tags:["slos"],url:`${Cs}/query`,method:"POST",paginated:!0,body:FU,response:t.Array(Ps)}),KU=m({description:"Retrieves one SLO definition by ID.",operationId:"getSlo",tags:["slos"],url:`${Cs}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"SLO ID returned by SLO query, create, or update operations."})}),response:Ps}),zU=["name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds","alerts"],YU=t.Pick(pp,zU,{$id:"CreateSloRequest",description:"SLO creation request. Provide ownership, data access, SLI configuration, target, timeframe, optional cluster scope, and the alerts to create."}),VU=t.Pick(ql,zU,{$id:"UpdateSloRequest",description:"SLO update request. Send all required SLO fields and the full alert list. Alerts are reconciled to exactly the provided list: alerts with a known id are updated, alerts without an id are created, and existing alerts absent from the list are deleted. Omit `clusterIds` to preserve the current cluster scope; send an empty array to run on all clusters."}),QU={name:"API availability 99.9%",description:"Overall API gateway availability over the last 30 days",tags:[{key:"team",value:"platform"}],configuration:{type:"event",dataSource:"logs",goodQuery:{queries:[{filter:"status:ok",aggregate:{type:"count"}}],formula:"q1"},totalQuery:{queries:[{filter:"*",aggregate:{type:"count"}}],formula:"q1"},noDataBehavior:"good"},target:99.9,timeframeDays:30,owner:"team-123-abc",permissions:"all",clusterIds:[],alerts:[{priority:1,configuration:{type:"burn-rate",burnRate:14.4}}]};Object.assign(YU,{examples:[QU]});Object.assign(VU,{examples:[QU]});var WU=m({description:"Creates an SLO owned by the specified team. The SLO can be event-based (good/total queries) or time-based (a thresholded query over evaluation slices) depending on its configuration.",operationId:"createSlo",tags:["slos"],url:Cs,method:"POST",body:YU,response:Ps}),ZU=m({description:"Replaces an existing SLO definition by ID. Send the full SLO input shape, including configuration, ownership, permissions, cluster scope, and the reconciled alert list. Changing configuration, target, timeframe, permissions, or cluster scope resets evaluated SLO state, so returned status and error budget are based on data evaluated after the update.",operationId:"updateSlo",tags:["slos"],url:`${Cs}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the SLO to update. Use the `id` returned by SLO query or create."})}),body:VU,response:Ps}),XU=m({description:"Deletes an SLO by ID. Deleting an SLO stops future evaluations and removes its attached alerts.",operationId:"deleteSlo",tags:["slos"],url:`${Cs}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the SLO to delete. Use the `id` returned by SLO query or create."})}),response:R});var uo=`${Os}/tag-policies`;var i3=["logs","metrics","traces"],uf=t.Array(t.Enum(i3,{description:"Telemetry signal covered by a data tag policy."}),{description:"Telemetry signals covered by the policy. An empty array means logs, metrics, and traces."}),a3=t.Union([qc,uf]),s3=t.Object({teamIds:t.Array(t.String(),{description:"Team IDs used by this policy scope."}),mode:t.Enum(["include","exclude"],{description:"`include` applies the policy only to listed teams. `exclude` applies it to all teams except the listed teams."})},{description:"Team scope that limits where this policy applies. Omitted means the policy applies to all teams."}),c3=b("type",[t.Object({type:t.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:uf,shouldInsertWarning:t.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:t.Optional(t.Number({description:"Percentage of non-compliant telemetry datapoints to drop. Omitted means no sampling drop is configured."}))},{title:"TelemetryTagPolicy"}),t.Object({type:t.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:qc},{title:"TsugaAssetTagPolicy"})]),p3=b("type",[t.Object({type:t.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:uf,shouldInsertWarning:t.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:t.Optional(t.Number({minimum:0,maximum:100,description:"Percentage of non-compliant telemetry datapoints to drop. Valid values are 0 through 100."}))},{title:"TelemetryTagPolicy"}),t.Object({type:t.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:qc},{title:"TsugaAssetTagPolicy"})]),JU="Policy surface and enforcement behavior. Use `telemetry` for telemetry data or `tsuga_asset` for Tsuga-managed resources.",u3=t.Unsafe({...c3,description:JU}),l3=t.Unsafe({...p3,description:JU}),Ci=t.Object({id:t.String({description:"Tsuga-generated tag policy ID assigned when the policy is created."}),name:t.String({description:"Human-readable tag policy name."}),description:t.Optional(t.String({description:"Optional user-provided policy description."})),isActive:t.Boolean({description:"Whether Tsuga currently evaluates this policy. Reserved policies (for example the built-in `env` policy on ingestion API keys) cannot be set to false."}),tagKey:t.String({description:"Tag key enforced by this policy."}),allowedTagValues:t.Array(t.String(),{description:"Allowed values for `tagKey`. An empty array means any value is accepted when the tag exists."}),isRequired:t.Boolean({description:"Whether the tag must be present. If false, `allowedTagValues` is still enforced when the tag exists. Reserved policies cannot be set to false."}),teamScope:t.Optional(s3),configuration:u3,creator:t.Optional(ue),updater:t.Optional(ue),owner:t.Optional(t.String({description:"Team ID that owns and manages the policy."})),createdAt:E({description:"Timestamp when Tsuga created the tag policy."}),updatedAt:E({description:"Timestamp when Tsuga last updated the tag policy."}),assetUpdatedAt:E({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})});var Us=t.Object({name:p({description:"Human-readable tag policy name."}),description:t.Optional(p({description:"Optional policy description."})),isActive:t.Boolean({description:"Set to true for Tsuga to evaluate this policy. Reserved policies (for example the built-in `env` policy on ingestion API keys) reject a false value."}),tagKey:p({allowEmpty:!1,description:"Tag key enforced by this policy. Tsuga trims surrounding whitespace before storing the policy."}),allowedTagValues:t.Array(p({allowEmpty:!1}),{maxItems:1e3,description:"Allowed values for `tagKey`. Leave empty to allow any value when the tag exists. Tsuga trims each submitted value before storing the policy."}),isRequired:t.Boolean({description:"Set to true to require the tag. If false, allowed values still apply when the tag exists. Reserved policies reject a false value."}),teamScope:t.Optional(t.Object({teamIds:t.Array(p(),{minItems:1,maxItems:100,description:"Team IDs used by this policy scope."}),mode:t.Enum(["include","exclude"],{description:"`include` applies the policy only to listed teams. `exclude` applies it to all teams except the listed teams."})},{description:"Team scope to store for this policy. Omit this field to apply the policy to all teams."})),configuration:l3,owner:p({allowEmpty:!1,description:"Team ID that will own and manage the policy."})}),X6e=m({tags:["tag-policies"],url:uo,method:"GET",query:t.Object({teamIds:t.Optional(t.Array(p(),{maxItems:100})),assetTypes:t.Optional(a3),searchQuery:t.Optional(p())}),response:t.Array(Ci)}),J6e=m({tags:["tag-policies"],url:`${uo}/:id`,method:"GET",params:t.Object({id:p()}),response:Ci}),e8e=m({tags:["tag-policies"],url:uo,method:"POST",body:Us,response:Ci}),t8e=m({tags:["tag-policies"],url:`${uo}/:id`,method:"PUT",params:t.Object({id:p()}),body:Us,response:Ci}),r8e=m({tags:["tag-policies"],url:`${uo}/:id`,method:"DELETE",params:t.Object({id:p()}),response:R}),n8e=m({tags:["tag-policies"],url:`${Os}/applicable-tag-rules`,method:"GET",query:t.Object({assetType:t.Enum(Ia),teamId:p()}),response:t.Array(t.Object({tagKey:t.String(),allowedTagValues:t.Array(t.String()),isRequired:t.Boolean(),tagPolicyId:t.String()}))}),ew=t.Object({total:t.Number(),totalNonCompliant:t.Number(),idsNonCompliant:t.Array(t.String())}),tw=t.Union([t.Literal("ingestion-api-key"),t.Literal("operation-api-key"),t.Literal("rum-public-token"),t.Literal("dashboard"),t.Literal("log-route"),t.Literal("metric-route"),t.Literal("monitor"),t.Literal("notification-rule"),t.Literal("notification-silence"),t.Literal("slo")]),m3=t.Object({total:t.Number(),totalNonCompliant:t.Number(),byAssetType:t.Record(tw,ew)}),d3=t.Omit(ew,["total"]),f3=t.Object({totalNonCompliant:t.Number(),byAssetType:t.Record(tw,d3)}),rw=t.Object({totals:m3,byTeam:t.Record(t.String(),f3)}),o8e=m({tags:["tag-policies"],url:`${uo}/:id/stats`,method:"GET",params:t.Object({id:p()}),response:rw}),i8e=m({tags:["tag-policies"],url:`${uo}/new-policy-stats`,method:"POST",body:Us,response:rw});var ws=`/${"v1"}/tag-policies`,nw={name:"Required Environment Tag",description:"Requires dashboards and monitors to declare an environment.",isActive:!0,tagKey:"environment",allowedTagValues:["production","staging"],isRequired:!0,teamScope:{teamIds:["team-123-abc"],mode:"include"},configuration:{type:"tsuga_asset",assetTypes:["dashboard","monitor"]},owner:"team-123-abc"},ow={name:"Telemetry Environment Policy",description:"Warns when telemetry is missing a known deployment environment.",isActive:!0,tagKey:"deployment.environment.name",allowedTagValues:["production","staging","development"],isRequired:!0,configuration:{type:"telemetry",assetTypes:[],shouldInsertWarning:!0,dropSample:25},owner:"team-123-abc"},g3={id:"123-456-abc",...nw},y3={id:"456-789-def",...ow},Ns=t.Pick(Ci,["id","name","description","isActive","tagKey","allowedTagValues","isRequired","teamScope","configuration","owner"],{$id:"TagPolicy",description:"Policy that enforces tag requirements on Tsuga-managed assets or telemetry data. See [Tag policies](/documentation/account-and-settings/tag-policies)."}),h3=g3,T3=y3;Object.assign(Ns,{examples:[h3,T3]});var lf=t.Pick(Us,["name","description","isActive","tagKey","allowedTagValues","isRequired","teamScope","configuration","owner"],{description:"Tag policy create or update request. Provide policy identity, owner, enforced tag key, allowed values, team scope, active state, and asset or telemetry configuration."}),E3=nw,_3=ow;Object.assign(lf,{examples:[E3,_3]});var iw=m({description:"Lists tag policies visible to the authenticated operation key. Use this to audit required tags, allowed values, team scope, and whether each policy applies to assets or telemetry.",operationId:"listTagPolicies",tags:["tag-policies"],url:ws,method:"GET",response:t.Array(Ns)}),aw=m({description:"Retrieves one tag policy by ID.",operationId:"getTagPolicy",tags:["tag-policies"],url:`${ws}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the tag policy to retrieve. Use the `id` returned by tag policy list or create responses."})}),response:Ns}),sw=m({description:"Creates a tag policy for Tsuga-managed assets or telemetry data. Use the configuration type to choose the policy surface.",operationId:"createTagPolicy",tags:["tag-policies"],url:ws,method:"POST",body:lf,response:Ns}),cw=m({description:"Replaces an existing tag policy by ID, including scope, requiredness, allowed values, owner, active state, and configuration. Reserved policies (for example the built-in `env` policy on ingestion API keys) reject changes to `tagKey` and reject `isActive: false` or `isRequired: false`.",operationId:"updateTagPolicy",tags:["tag-policies"],url:`${ws}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the tag policy to update. Use the `id` returned by tag policy list, get, or create responses."})}),body:lf,response:Ns}),pw=m({description:"Deletes a tag policy by ID. Tsuga stops evaluating the policy after deletion. Reserved policies (for example the built-in `env` policy on ingestion API keys) cannot be deleted.",operationId:"deleteTagPolicy",tags:["tag-policies"],url:`${ws}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the tag policy to delete. Use the `id` returned by tag policy list, create, or update responses."})}),response:R});var Ls=`/${"v1"}/teams`,vs=t.Pick(Wo,["id","name","description","visibility","tags"],{$id:"Team",description:"Collection of users used to manage ownership, visibility, and access to team-owned Tsuga resources. See [Teams](/documentation/account-and-settings/teams)."}),I3={id:"team-123-abc",name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(vs,{examples:[I3]});var uw=m({description:"Lists teams visible to the authenticated operation key. Use this endpoint to inventory owners for resources, dashboards, monitors, routes, and policies. Pagination fields limit the returned page.",operationId:"listTeams",tags:["teams"],url:Ls,method:"GET",paginated:!0,query:t.Object(ze),response:t.Array(vs)}),lw=m({description:"Retrieves one team by ID.",operationId:"getTeam",tags:["teams"],url:`${Ls}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the team to retrieve. Use the `id` returned by team list or create responses."})}),response:vs}),mf=t.Pick(ip,["name","description","visibility","tags"],{description:"Team create or update request. Provide the team name, optional description, visibility, and tags."}),b3={name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(mf,{examples:[b3]});var mw=m({description:"Creates a team for ownership and access control. Use this before assigning resources to a new owner team.",operationId:"createTeam",tags:["teams"],url:Ls,method:"POST",body:mf,response:vs}),dw=m({description:"Replaces a team definition by ID, including name, description, visibility, and tags.",operationId:"updateTeam",tags:["teams"],url:`${Ls}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the team to update. Use the `id` returned by team list, get, or create responses."})}),body:mf,response:vs}),fw=m({description:"Deletes a team. Fails while the team still owns resources (dashboards, monitors, routes, API keys, etc.); reassign or delete those first. Team memberships are removed automatically as part of the deletion.",operationId:"deleteTeam",tags:["teams"],url:`${Ls}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the team to delete. Use the `id` returned by team list, create, or update responses."})}),response:R});function S3(e){return/^[aeiou]/i.test(e)||e==="SLO"?"an":"a"}function gw(e,r){let n=Number(r);if(Number.isNaN(n))throw new Error(`--${e} must be a number (got: ${r})`);return n}function yw(e){let r={};return e.limit!==void 0&&(r.limit=gw("limit",e.limit)),e.offset!==void 0&&(r.offset=gw("offset",e.offset)),r}function df(e){let r=e.params;if(r?.properties){let n=Object.keys(r.properties);if(n.length===1&&n[0])return n[0]}return"id"}function hw(e,r,n){let o=e.command(r.commandName).description(r.description),i=r.singularOverride??tO(r.commandName).replace(/-/g," "),a=r.pluralOverride??r.commandName.replace(/-/g," "),c=S3(i),l=o.command("list").description(r.listDescription??`List all ${a}`);if(r.listOptions)for(let d of r.listOptions)l.option(d.flag,d.description);if(r.endpoints.list.paginated===!0&&l.option("--limit <n>",`Maximum number of items to return, up to ${Fo} (default: ${jc})`).option("--offset <n>","Number of items to skip, to request a later page"),r.enableListBody?l.option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async d=>{if(d.generateSkeleton){Q(li(r.endpoints.list));return}let f=d.data?ni({data:d.data}):{},g=await n()(r.endpoints.list,{body:{...f,...yw(d)}});Q(g)}):l.action(async d=>{let f=yw(d);if(r.listOptions)for(let T of r.listOptions){let _=d[T.queryParam];_!==void 0&&(f[T.queryParam]=_)}let g=await n()(r.endpoints.list,Object.keys(f).length>0?{query:f}:void 0);Q(g)}),r.endpoints.get){let d=r.endpoints.get,f=df(d);o.command("get <ID>").description(`Get ${c} ${i} by ID`).action(async g=>{let T=await n()(d,{params:{[f]:g}});Q(T)})}if(r.endpoints.create){let d=r.endpoints.create;o.command("create").description(`Create a new ${i}`).option("-f, --file <FILE_PATH>","Read body from file (use - for stdin)").option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async f=>{if(f.generateSkeleton){Q(li(d));return}let g=ni(f),T=await n()(d,{body:g});Q(T)})}if(r.endpoints.update){let d=r.endpoints.update,f=df(d);o.command("update <ID>").description(`Update ${c} ${i} by ID`).option("-f, --file <FILE_PATH>","Read body from file (use - for stdin)").option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async(g,T)=>{if(T.generateSkeleton){Q(li(d));return}let _=ni(T),ae=await n()(d,{params:{[f]:g},body:_});Q(ae)})}if(r.endpoints.delete){let d=r.endpoints.delete,f=df(d);o.command("delete <ID>").description(`Delete ${c} ${i} by ID`).action(async g=>{let T=await n()(d,{params:{[f]:g}});Q(T)})}}var O3=[{commandName:"cloud-resources",description:"List cloud resources discovered by inventory scans",endpoints:{list:AP},enableListBody:!0},{commandName:"dashboards",description:"Manage dashboards",endpoints:{list:nP,get:oP,create:iP,update:aP,delete:sP},enableListBody:!0},{commandName:"ingestion-api-keys",description:"Manage ingestion API keys",singularOverride:"ingestion API key",pluralOverride:"ingestion API keys",endpoints:{list:fP,create:gP,update:yP,delete:hP}},{commandName:"investigations",description:"Manage investigations (beta)",endpoints:{list:RP,get:CP,create:PP,update:UP,delete:wP}},{commandName:"monitors",description:"Manage monitors",endpoints:{list:tU,get:rU,create:uU,update:lU,delete:mU},enableListBody:!0},{commandName:"notification-rules",description:"Manage notification rules",endpoints:{list:fU,get:gU,create:yU,update:hU,delete:TU}},{commandName:"notification-silences",description:"Manage notification silences",endpoints:{list:bU,get:SU,create:OU,update:AU,delete:xU}},{commandName:"quality-reports",description:"Get the latest quality report rows for a cluster",listDescription:"Get the latest quality report rows for a cluster (pass --cluster <CLUSTER_ID> when the org has more than one cluster)",endpoints:{list:NU},listOptions:[{flag:"--team <TEAM_NAME>",description:"Only return rows for this team by name (omits cluster-wide global rows)",queryParam:"team"}]},{commandName:"retention-policies",description:"Manage retention policies",endpoints:{list:DU,get:GU,create:$U,update:jU,delete:qU}},{commandName:"log-routes",description:"Manage log routes",endpoints:{list:HP,get:KP,create:zP,update:YP,delete:VP}},{commandName:"services",description:"List and inspect services (read-only; services are inferred from telemetry)",endpoints:{list:FO,get:HO}},{commandName:"slos",description:"Manage SLOs",singularOverride:"SLO",pluralOverride:"SLOs",endpoints:{list:HU,get:KU,create:WU,update:ZU,delete:XU},enableListBody:!0},{commandName:"tag-policies",description:"Manage tag policies",endpoints:{list:iw,get:aw,create:sw,update:cw,delete:pw}},{commandName:"teams",description:"Manage teams",endpoints:{list:uw,get:lw,create:mw,update:dw,delete:fw}}];function Tw(e,r){for(let n of O3)hw(e,n,r)}var Ew=require("node:child_process");var Gp="@tsuga/cli@latest";function A3(){B(`Updating ${Gp}`),B(` $ npm install -g ${Gp}`);try{(0,Ew.execFileSync)("npm",["install","-g",Gp],{stdio:["ignore","inherit","inherit"]})}catch(e){let r=e.status??1;throw new Error(`npm install -g ${Gp} exited ${r}`,{cause:e})}B("Updated. Run `tsuga --version` to confirm the new version.")}function _w(e){e.command("self-update").description("Update the Tsuga CLI to the latest version via npm").action(()=>{A3()})}var _f=require("node:fs"),Ef=require("node:os"),Ui=require("node:path");function x3(e,r){let n=e.slice(0,r).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function R3(e,r,n){let o=e.split(/\r\n|\n|\r/g),i="",a=(Math.log10(r+1)|0)+1;for(let c=r-1;c<=r+1;c++){let l=o[c-1];l&&(i+=c.toString().padEnd(a," "),i+=": ",i+=l,i+=`
|
|
138
|
+
-----END PRIVATE KEY-----`,isUsingLuhnAlgorithm:!1,regexp:"-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[ \\r\\n\\t\\f\\v\\S-]{64,}?KEY(?: BLOCK)?-----"},{key:"pulumi_api_token",name:"Pulumi API token",category:"credential",example:"pul-b77e6bff9fddebbc2bb8eca94e3f29a41f6da70a",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pul-[a-f0-9]{40})"},{key:"pypi_upload_token",name:"PyPI upload token",category:"credential",example:"pypi-AgEIcHlwaS5vcmc128fd9e0b47dde39cfecad3a997273458e6392f6aac649ae38864bdd7ff12836",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)pypi-AgEIcHlwaS5vcmc[a-zA-Z0-9_-]{50}"},{key:"rapidapi_access_token",name:"RapidAPI access token",category:"credential",example:"g4x40h94pi_-zlklfz3-qvhiiu5zankyrqqwmsl60decihbqvl",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{50})"},{key:"readme_api_token",name:"ReadMe API token",category:"credential",example:"rdme_k38kau741xa5lw03mdkvcd4vn6s6hdhvhg1wxa4ls7dp8h58r0yxq65nsqwndn056pxsc4",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:rdme_[a-z0-9]{70})"},{key:"rubygems_api_token",name:"RubyGems API token",category:"credential",example:"rubygems_7790aaa8102395704a64594a11f6de4941a27f86bc3fc9d4",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:rubygems_[a-f0-9]{48})"},{key:"scalingo_api_token",name:"Scalingo API token",category:"credential",example:"tk-us-4fhmqrg-rl4416b3oij_qx3q284wbhbqpk7r3te4r14lafou",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:tk-us-[a-zA-Z0-9_-]{48})"},{key:"sendbird_access_id",name:"SendBird access ID",category:"credential",example:"7e7801fd-c25d-50ab-a723-01b94c8d6c5f",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"sendbird_access_token",name:"SendBird access token",category:"credential",example:"305f75f04e3afa65360c25d9944fdae91138328d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{40})"},{key:"sendgrid_api_token",name:"SendGrid API token",category:"credential",example:"SG.--ed-fvdeffijnle7575jp1sh24wq_9y9hcjua5w3dnqh5-wyegkpzenziy1_qr=hf",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:SG\\.[a-z0-9=_\\-\\.]{66})"},{key:"sendinblue_api_token",name:"Sendinblue API token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:xkeysib-[a-f0-9]{64}\\-[a-z0-9]{16})"},{key:"sentry_access_token",name:"Sentry access token",category:"credential",example:"1ad463398f40a52bb94a3795762f4003d51b03b8a788cba55e3a81de81c72940",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{64})"},{key:"sentry_org_token",name:"Sentry org token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)sntrys_eyJpYXQiO[a-zA-Z0-9+/]{10}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10}={0,2}_[a-zA-Z0-9+/]{43}(?:[^a-zA-Z0-9+/]|\\z)"},{key:"sentry_user_token",name:"Sentry user token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sntryu_[a-f0-9]{64})"},{key:"settlemint_application_access_token",name:"Settlemint application access token",category:"credential",example:"sm_aat_gshgzsv353m5yb9s",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sm_aat_[a-zA-Z0-9]{16})"},{key:"settlemint_personal_access_token",name:"Settlemint personal access token",category:"credential",example:"sm_pat_1yhza49gsle0trg8",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sm_pat_[a-zA-Z0-9]{16})"},{key:"settlemint_service_access_token",name:"Settlemint service access token",category:"credential",example:"sm_sat_cha543e6lb19llli",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sm_sat_[a-zA-Z0-9]{16})"},{key:"shippo_api_token",name:"Shippo API token",category:"credential",example:"shippo_live_1d0f80d04e7788c1edb8fc2b8076bbf8f59b84b7",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:shippo_(?:live|test)_[a-fA-F0-9]{40})"},{key:"shopify_access_token",name:"Shopify access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shpat_[a-fA-F0-9]{32}"},{key:"shopify_custom_access_token",name:"Shopify custom access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shpca_[a-fA-F0-9]{32}"},{key:"shopify_private_app_access_token",name:"Shopify private app access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shppa_[a-fA-F0-9]{32}"},{key:"shopify_shared_secret",name:"Shopify shared secret",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shpss_[a-fA-F0-9]{32}"},{key:"sidekiq_secret",name:"Sidekiq secret",category:"credential",example:"aa8d3915:64fb5cb5",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{8}:[a-f0-9]{8})"},{key:"sidekiq_sensitive_url",name:"Sidekiq sensitive URL",category:"credential",example:"https://cafebabe:deadbeef@gems.contribsys.com/",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)https?://(?:[a-f0-9]{8}:[a-f0-9]{8})@(?:gems.contribsys.com|enterprise.contribsys.com)(?:[\\/|\\#|\\?|:]|$)"},{key:"slack_bot_token",name:"Slack bot token",category:"credential",example:"xoxb-781236542736-2364535789652-GkwFDQoHqzXDVsC6GzqYUypD",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*"},{key:"slack_user_token",name:"Slack user token",category:"credential",example:"xoxp-41684372915-1320496754-45609968301-e708ba56e1517a99f6b5fb07349476ef",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}"},{key:"slack_app_token",name:"Slack app token",category:"credential",example:"xapp-1-A052FGTS2DL-5171572773297-610b6a11f4b7eb819e87b767d80e6575a3634791acb9a9ead051da879eb5b55e",isUsingLuhnAlgorithm:!1,regexp:"xapp-[0-9]-[A-Z0-9]+-[0-9]+-[a-z0-9]+"},{key:"slack_config_access_token",name:"Slack config access token",category:"credential",example:"xoxe.xoxp-1-Mi0yLTM0MTQwNDE0MDE3Ni0zNjU5NDY0Njg4MTctNTE4MjA3NTQ5NjA4MC01NDEyOTYyODY5NzUxLThhMTBjZmI1ZWIzMGIwNTg0ZDdmMDI5Y2UxNzVlZWVhYzU2ZWQyZTZiODNjNDZiMGUxMzRlNmNjNDEwYmQxMjQ",isUsingLuhnAlgorithm:!1,regexp:"xoxe.xox[bp]-[0-9]-[A-Z0-9]{50}"},{key:"slack_config_refresh_token",name:"Slack config refresh token",category:"credential",example:"xoxe-1-My0xLTMxNzcwMjQ0MTcxMy01MTU4MTUyNjkxNzE0LTUxODE4NDI0MDY3MzYtMjA5MGFkOTFlZThkZWE2OGFlZDYwYWJjODNhYzAxYjA5ZjVmODBhYjgzN2QyNDdjOTNlOGY5NTg2YWM1OGM4Mg",isUsingLuhnAlgorithm:!1,regexp:"xoxe-[0-9]-[A-Z0-9]{50}"},{key:"slack_legacy_bot_token",name:"Slack legacy bot token",category:"credential",example:"xoxb-263594206564-FGqddMF8t08v8N7Oq4i57vs1",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xoxb-[0-9]{8,14}-[a-zA-Z0-9]{18,26}"},{key:"slack_legacy_workspace_token",name:"Slack legacy workspace token",category:"credential",example:"xoxa-2-511111111-31111111111-3111111111111-e039d02840a0b9379c",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xox[ar]-(?:[0-9]-)?[0-9a-zA-Z]{8,48}"},{key:"slack_legacy_token",name:"Slack legacy token",category:"credential",example:"xoxs-416843729158-132049654-5609968301-e708ba56e1",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xox[os]-[0-9]+-[0-9]+-[0-9]+-[a-fA-F0-9]+"},{key:"slack_webhook_url",name:"Slack webhook URL",category:"credential",example:"hooks.slack.com/services/z6cvbfngk3h7i0vts4akmbxidtb8o3b4pq2sbbd6o86g",isUsingLuhnAlgorithm:!1,regexp:"(?:https?://)?hooks.slack.com/(?:services|workflows|triggers)/[A-Za-z0-9+/]{43,56}"},{key:"snyk_api_token",name:"Snyk API token",category:"credential",example:"12345678-ABCD-ABCD-ABCD-1234567890AB",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"sonar_api_token",name:"Sonar API token",category:"credential",example:"12345678ABCDEFH1234567890ABCDEFH12345678",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:(?:squ_|sqp_|sqa_)?[a-z0-9=_-]{40})"},{key:"stripe_access_token",name:"Stripe access token",category:"credential",example:"sk_test_cyge9m4s1kxiqdkszz0a57nyx6wk73",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})"},{key:"square_access_token",name:"Square access token",category:"credential",example:"sq0atp-OQUxovdrj3tfFpSd66r3sY",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:EAAA|sq0atp-)[a-zA-Z0-9_-]{22,60})"},{key:"squarespace_access_token",name:"Squarespace access token",category:"credential",example:"86447eab-140f-2563-3572-bb016dafd692",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"sumologic_access_id",name:"SumoLogic access ID",category:"credential",example:"suJS4ZsaD5bQTt",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:su[a-zA-Z0-9]{12})"},{key:"sumologic_access_token",name:"SumoLogic access token",category:"credential",example:"1xohkwr8lpvm4osygkpe5zbd16c3376ver2qed1bssuko4uy4tij1bnf4dnwy7o4",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"microsoft_teams_webhook",name:"Microsoft Teams webhook URL",category:"credential",example:"https://mycompany.webhook.office.com/webhookb2/767lrnj6-okh8-dnh8-jey2-y2iteohrwz75@6igi6oz6-ud9w-wior-2zva-5vx0wp6wuiqk/IncomingWebhook/o1zox92ssprrppjtnvcjqq0q09k2wnc3/qwox5p9d-x4zr-3yis-t1on-s67zj50tmyht",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)https://[a-z0-9]+\\.webhook\\.office\\.com/webhookb2/[a-z0-9]{8}-(?:[a-z0-9]{4}-){3}[a-z0-9]{12}@[a-z0-9]{8}-(?:[a-z0-9]{4}-){3}[a-z0-9]{12}/IncomingWebhook/[a-z0-9]{32}/[a-z0-9]{8}-(?:[a-z0-9]{4}-){3}[a-z0-9]{12}"},{key:"telegram_bot_api_token",name:"Telegram bot API token",category:"credential",example:"59015865:A12o5wu6f78zofs0udypf9ti23u82g-qkfz",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{5,16}:(?-i:A)[a-z0-9_\\-]{34})"},{key:"travisci_access_token",name:"Travis CI access token",category:"credential",example:"zjgfo5fhshd5c60hpz22wh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{22})"},{key:"twilio_api_key",name:"Twilio API key",category:"credential",example:"SKa585fd034fcd16cdd741f7df9b57fb3b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)SK[0-9a-fA-F]{32}"},{key:"twitch_api_token",name:"Twitch API token",category:"credential",example:"1hm9gcychlkpf93jdjnwdu0uaamu6d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{30})"},{key:"twitter_api_key",name:"Twitter API key",category:"credential",example:"m8zqu4etx07bjt7tyeacc6pox",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{25})"},{key:"twitter_api_secret",name:"Twitter API secret",category:"credential",example:"7f4gxkubw9qs346ik99zk3z8b6kk3d7g8toi7zujgvgbt8q0yv",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{50})"},{key:"twitter_access_token",name:"Twitter access token",category:"credential",example:"465616696186918-96B1NCD5CH0uyi7zUHiS",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{15,25}-[a-zA-Z0-9]{20,40})"},{key:"twitter_access_secret",name:"Twitter access secret",category:"credential",example:"vyuo5peybdzznr7z0ua5wamhogusans4m29uzi25w4jgj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{45})"},{key:"twitter_bearer_token",name:"Twitter bearer token",category:"credential",example:"AAAAAAAAAAAAAAAAAAAAAAWRGWFGlfwyqNrrIa3pewqNNLX0jQMj2sR6M2cZUfBdqXDtkt7Nsb56F4tCz7Pt8ujbosrLxnRqYgwI0b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:A{22}[a-zA-Z0-9%]{80})"},{key:"typeform_api_token",name:"Typeform API token",category:"credential",example:"tfp_o-nsn=6eg2ios=4g652xhf933qor4jj7ort2qh_uw_5jdsuffp31ln=e-2a",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:tfp_[a-z0-9\\-_\\.=]{59})"},{key:"vault_batch_token",name:"Vault batch token",category:"credential",example:"hvb.x84j4cl53mzvhvb1nfc3mfi721gh5i-92f96lt0gns5lpksfu5f0199j-gw4ycxg6au4ser86mczcr_nx6ur2elbpazfrybo80fxjv3bghxshml3g261l6qi03yrz03qup84jk-fc2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:hvb\\.[a-zA-Z0-9_-]{50})"},{key:"vault_service_token",name:"Vault service token",category:"credential",example:"s.8QH9knZV94f0IjBZismfOPD0",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:hvs\\.[a-zA-Z0-9_-]{90}|s\\.(?i:[a-z0-9]{24})))"},{key:"yandex_api_key",name:"Yandex API key",category:"credential",example:"AQVN9wiAh8pyz3lmB5WTo_KUuPDXlxtzkA5-YFG",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:AQVN[A-Za-z0-9_\\-]{35,38})"},{key:"yandex_aws_access_token",name:"Yandex AWS access token",category:"credential",example:"YCZ6DHVrZONPNtgwWLZPrIGyviSrudRVSr8w0b1S",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:YC[a-zA-Z0-9_\\-]{38})"},{key:"yandex_access_token",name:"Yandex access token",category:"credential",example:"t1.L=.WJ9CYVI5eeLkTOrMM_dgaPgdmpen48R8RYsL4VJqelVKDmrqYsSHkH6QyVVhJkuHSQFTd0NOhClEDyCz7eEbh5=",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:t1\\.[A-Z0-9a-z_-]+[=]{0,2}\\.[A-Z0-9a-z_-]{86}[=]{0,2})"},{key:"zendesk_secret_key",name:"Zendesk secret key",category:"credential",example:"iydgm2jofftb2xu7niv55qnfxdwbwmqt2s561bgc",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{40})"},{key:"infracost_api_token",name:"Infracost API token",category:"credential",example:"ico-fNZw8jjy6TugMUHKWX4l9iSP3i95SPNH",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:ico-[a-zA-Z0-9]{32})"},{key:"iban",name:"Iban",category:"financial-data",example:"FR7630006000011234567890189",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{11,30}(?-u:\\b)"},{key:"aikido_token",name:"Aikido token",category:"credential",example:"AIK_SECRET_XU28CmBY7Kxk3RPrqfHk9n6p5QX4p1tXzvJ7J1B3RPrqfHk9n6p5QX4p1tXzvJ7J",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AIK_SECRET_[A-Za-z0-9]{64}"},{key:"aikido_ci_token",name:"Aikido CI secret",category:"credential",example:"AIK_CI_US_XU28CmBY7Kxk3RPrqfHk9n6p5QX4p1tXzvJ7J1B3RPrqfHk9n6p5QX4p1tXzvJ7J",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AIK_CI_(US_|ME_)?[A-Za-z0-9]{64}"},{key:"tsuga_ingestion_key",name:"Tsuga ingestion key",category:"credential",example:"tsuga_in:v1:OUvrwavCG//ixL08HEds9OAT",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)tsuga_in:v1:[A-Za-z0-9+/]{24}"},{key:"tsuga_operation_key",name:"Tsuga operation key",category:"credential",example:"tsuga_op:v1:zz3-LWv-sLy:0k7Skt255M0yXe/ZLBoiSamb",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)tsuga_op:v1:[A-Za-z0-9_-]+:[A-Za-z0-9+/]{24}"}],L1=pO.map(e=>e.key);var LOe=new Set(L1),vOe=pO.map(e=>e.key);var D="context";var uO="trace_id",HOe=`${D}.team`,KOe=`${D}.env`,zOe=`${D}.api_key_id`,ap=`${D}.service.name`,YOe=`${D}.service.version`,Ul=`${D}.span.kind`,wl=`${D}.span.name`,Nl=`${D}.status.code`,lO=["SPAN_KIND_UNSPECIFIED","SPAN_KIND_INTERNAL","SPAN_KIND_SERVER","SPAN_KIND_CLIENT","SPAN_KIND_PRODUCER","SPAN_KIND_CONSUMER"];var ka=`${D}.host.name`,v1=`${D}.instance`,k1=`${D}.instanceid`,M1=`${D}.instance_name`,VOe=`${D}.telemetry.sdk.language`,QOe=`${D}.process.runtime.name`,WOe=`${D}.scope.name`,ZOe=`${D}.cloud.provider`,XOe=`${D}.cloud.platform`,JOe=`${D}.aws.ecs.task.arn`,eAe=`${D}.k8s.cluster.name`,tAe=`${D}.k8s.cluster.uid`,rAe=`${D}.k8s.namespace.name`,D1=`${D}.k8s.pod.name`,nAe=`${D}.k8s.pod.uid`,oAe=`${D}.k8s.container.name`,iAe=`${D}.k8s.node.name`,aAe=`${D}.k8s.node.uid`,G1=`${D}.k8s.deployment.name`,sAe=`${D}.k8s.deployment.uid`,$1=`${D}.k8s.replicaset.name`,cAe=`${D}.k8s.replicaset.uid`,j1=`${D}.k8s.statefulset.name`,pAe=`${D}.k8s.statefulset.uid`,B1=`${D}.k8s.daemonset.name`,uAe=`${D}.k8s.daemonset.uid`,lAe=`${D}.k8s.job.name`,mAe=`${D}.k8s.job.uid`,dAe=`${D}.k8s.cronjob.name`,fAe=`${D}.k8s.cronjob.uid`,Ll="status_code",vl="span.name";var kl="span.kind";var q1="db.system.name",F1="db.system",H1="db.namespace",K1="db.name";var gAe=`span_attributes.${H1}`,yAe=`span_attributes.${K1}`,hAe=`span_attributes.${q1}`,TAe=`span_attributes.${F1}`;var EAe={name:"tsuga.internal.processing_tag_policy_violations_total",attributes:{tagPolicyId:`${D}.tag_policy_id`,dataSource:`${D}.data_source`}};var _Ae={name:"tsuga.internal.event_size_bytes",attributes:{batchKind:`${D}.batch_kind`,batchKindMetricsFilter:`${D}.batch_kind:metrics`,sourceApiKeyId:`${D}.source_api_key_id`,sourceEnv:`${D}.source_env`,sourceTeam:`${D}.source_team`}};var Ml="__tsuga_metadata__",IAe=`${Ml}.signature`,bAe=`${Ml}.routes`,SAe=`${Ml}.trace_id_bucket`;var CAe={[Ul]:kl,[Ul.replace(`${D}.`,"")]:kl,[wl]:vl,[wl.replace(`${D}.`,"")]:vl,[Nl]:Ll,[Nl.replace(`${D}.`,"")]:Ll};function mO(e){return e.replace(/ies$/,"y").replace(/s$/,"")}var dO=["alert_cluster","alert_conditions","alert_data_url","alert_id","alert_owner","alert_previous_status","alert_priority","alert_start_time","alert_status","alert_tags","alert_timeframe","alert_title","alert_transition","alert_triggered_by","dashboard_url","monitor_url"],fO=["alert_queries","alert_thresholds","alert_values"],z1=[...dO,...fO],gO=["alert_event_name","alert_message"],exe=[...z1,...gO],txe=new Set([...dO,...gO]),rxe=new Set(fO);var Y1="^\\S(.*\\S)?$",V1=128,Q1=256,W1=t.Object({key:t.String({description:"Tag key attached to the resource. Consumers can use key/value tags for filtering, ownership context, and policy checks."}),value:t.String({description:"Tag value attached to the resource for this key. Tsuga returns the value exactly as stored."})},{title:"Tag"}),Z1=t.Object({key:t.String({maxLength:V1,description:"Tag key to attach to the resource."}),value:t.String({maxLength:Q1,pattern:Y1,description:"Tag value to attach to the resource. Leading or trailing whitespace is rejected."})},{title:"Tag"}),Lt=t.Array(W1,{title:"Tags",description:"Key/value tags applied to the resource. Use them to organize resources and to satisfy tag policies."}),vt=t.Array(Z1,{title:"Tags",maxItems:50,description:"Key/value tags to apply to the resource. Tag policies may require specific keys or values."}),Re=t.Optional(Lt),$e=t.Optional(vt);var mn="/v0/teams",cp=["public","private"],sp={NAME:"name",CREATED_AT:"createdAt",MEMBER_COUNT:"memberCount",VISIBILITY:"visibility"},X1=t.Enum([sp.NAME,sp.CREATED_AT,sp.MEMBER_COUNT,sp.VISIBILITY],{description:"Team field used for sorting list responses. Use `name`, `createdAt`, `memberCount`, or `visibility`."}),TO=t.Object({color:t.Enum(Cl,{description:"Color token used by Tsuga when rendering the team avatar."}),mode:t.Enum(Pl,{description:"Avatar rendering mode selected for the team."}),iconName:t.Enum(cO,{description:"Icon name rendered inside the team avatar when icon mode is used."})}),Dl=t.Object({color:t.Enum(Cl),mode:t.Enum(Pl)}),yO=100,hO=250,Wo=t.Object({id:t.String({description:"Unique identifier of the team. Generated by Tsuga and stable for the team lifetime."}),name:t.String({description:"Human-readable team name displayed throughout Tsuga and used in team search."}),description:t.Optional(t.String({description:"Optional free-text description of the team."})),visibility:t.Enum(cp,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:Re,createdAt:E({description:"Timestamp when Tsuga created the team."}),updatedAt:E({description:"Timestamp when Tsuga last updated the team metadata."}),memberCount:t.Optional(t.Number({description:"Number of members currently in the team"})),avatar:t.Optional(TO)}),pp=t.Object({name:t.String({minLength:1,maxLength:yO,format:Bo,description:`Name to assign to the team. Must be kebab-case (lowercase letters, numbers, and dashes only) and unique in the organization. Maximum length is ${yO} characters.`}),description:t.Optional(t.String({maxLength:hO,description:`Optional team description. Maximum length is ${hO} characters.`})),visibility:t.Enum(cp,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:$e,avatar:t.Optional(TO)}),J1=t.Object({id:t.String(),name:t.String(),email:t.String(),role:t.Enum(zo),joinedTeamAt:E(),orgRole:t.Enum(Qc),avatar:t.Optional(Dl)}),Xxe=m({tags:["teams"],url:mn,method:"GET",paginated:!0,response:t.Array(Wo),query:t.Object({...de,includeMemberCount:t.Optional(t.Boolean()),searchQuery:t.Optional(p({description:"Substring matched against team names and descriptions."})),visibility:t.Optional(t.Enum(cp,{description:"Restrict results to teams with this visibility."})),myTeamsOnly:t.Optional(t.Boolean({description:"If true, return only teams that include the authenticated user."})),sortBy:t.Optional(X1),sortDirection:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending."}))})}),Jxe=m({tags:["teams"],url:`${mn}/:id`,method:"GET",params:t.Object({id:p()}),response:Wo}),eRe=m({tags:["teams"],url:`${mn}/:id/members`,method:"GET",params:t.Object({id:p()}),response:t.Array(J1)}),tRe=m({tags:["teams"],url:`${mn}/:id/assets`,method:"GET",params:t.Object({id:p()}),response:t.Object({apiKeyCount:t.Number(),logRouteCount:t.Number(),monitorCount:t.Number(),notificationRuleCount:t.Number(),dashboardCount:t.Number()})}),rRe=m({tags:["teams"],url:mn,method:"POST",body:pp,response:Wo}),nRe=m({tags:["teams"],url:`${mn}/:id`,method:"PUT",params:t.Object({id:p()}),body:pp,response:Wo}),oRe=m({tags:["teams"],url:`${mn}/bulk-update`,method:"POST",body:t.Object({teamIds:t.Array(p(),{maxItems:100}),config:t.Object({visibility:t.Enum(cp)})}),response:t.Object({})}),iRe=m({tags:["teams"],url:`${mn}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x});var ej=t.Enum(["terraform-provider","web-frontend","mcp-server","cli"],{description:"Tsuga client surface that performed the operation. Use this to distinguish UI, CLI, MCP, and Terraform-originated changes."}),ae=b("type",[t.Object({type:t.Literal("user",{description:"The resource was created or updated by a user."}),id:t.String({description:"Unique identifier of the user actor."}),name:t.String({description:"Display name of the user actor at the time of response."}),avatar:t.Optional(Dl)}),t.Object({type:t.Literal("operation-api-key",{description:"The resource was created or updated by an operation API key."}),id:t.String({description:"Unique identifier of the operation API key actor."}),name:t.String({description:"Display name of the operation API key actor."}),source:t.Optional(ej)})],{description:"User or operation API key responsible for creating or updating a resource. Returned by Tsuga for audit context."});var ft="/v0/monitors",Zo=["alert","resolve","keep_last_status","consider_zero"],Xo=["alert","resolve","keep_last_status"];var _O=["no_aggregation","all","any","each","proportion"],IO=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"];var tj=t.Object({formula:t.String({description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:t.Enum(IO,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:t.Number({description:"Numeric threshold value used by the comparison."})}),rj=t.Object({formula:p({type:"tsuga-formula",description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:t.Enum(IO,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:t.Number({description:"Numeric threshold value used by the comparison."})}),nj=5,Gl=t.Array(tj,{description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),$l=t.Array(rj,{minItems:1,maxItems:nj,description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),jl=t.Object({formula:t.String({description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:t.Enum(["rate","error","cpu","general","to_be_set"],{description:"Anomaly model type Tsuga uses to classify expected behavior: `rate` flags downward anomalies (e.g. count rates), `error` and `cpu` flag upward anomalies (e.g. error counts/rates, CPU usage), `general` flags both directions, and `to_be_set` is a placeholder Tsuga replaces by inferring the model type from the monitor query when the monitor is created or updated."})},{description:"Anomaly detection condition evaluated by this monitor. The `formula` result is compared against behavior learned from historical query results, and the monitor alerts on deviations in the direction implied by `conditionType`."}),Bl=t.Object({formula:p({type:"tsuga-formula",description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:t.Enum(["rate","error","cpu","general","to_be_set"],{description:"Anomaly model type used to classify expected behavior: `rate` flags downward anomalies (e.g. count rates), `error` and `cpu` flag upward anomalies (e.g. error counts/rates, CPU usage), and `general` flags both directions. Use `to_be_set` to let Tsuga infer the model type from the monitor query during create or update."})},{description:"Anomaly detection condition evaluated by this monitor. The `formula` result is compared against behavior learned from historical query results, and the monitor alerts on deviations in the direction implied by `conditionType`."}),dt=[1,2,3,4,5];var up={timeframe:t.Number({description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over. Always a whole number, at least 1."}),groupByFields:t.Array(t.Object({fields:t.Array(t.String(),{description:"Attribute names the monitor splits results by, evaluating each resulting group independently. Empty means the monitor evaluates a single ungrouped series."}),limit:t.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:t.Optional(t.String({description:"Value used to group documents that have no value for a grouped field."}))}),{description:"Monitor group by configuration. The `limit` setting is currently ignored; evaluation applies a fixed limit of 100 groups per field."}),aggregationAlertLogic:t.Optional(t.Enum(_O,{description:"How grouped results are combined into alert state. Use `no_aggregation` only when `groupByFields` is empty; use `all`, `any`, `each`, or `proportion` with non-empty `groupByFields`. `proportion` also requires `proportionAlertThreshold`."})),proportionAlertThreshold:t.Optional(t.Integer({description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},lp={timeframe:t.Integer({minimum:1,description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over."}),groupByFields:t.Array(t.Object({fields:t.Array(p(),{description:"Attribute names the monitor splits results by, evaluating each resulting group independently. Empty or omitted means the monitor evaluates a single ungrouped series."}),limit:t.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:t.Optional(p({allowEmpty:!1,description:"Value used to group documents that have no value for a grouped field."}))}),{maxItems:1,description:"Monitor group by configuration. The `limit` setting is currently ignored; evaluation applies a fixed limit of 100 groups per field."}),aggregationAlertLogic:t.Optional(t.Enum(_O,{description:"How grouped results are combined into alert state. Use `no_aggregation` only when `groupByFields` is empty; use `all`, `any`, `each`, or `proportion` with non-empty `groupByFields`. `proportion` also requires `proportionAlertThreshold`. On create, omitted query-monitor values default to `no_aggregation`; on update, omitted values keep the existing aggregation logic."})),proportionAlertThreshold:t.Optional(t.Integer({minimum:1,maximum:99,description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},ql={...up,timeframe:t.Number({description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over. Always a whole number from 5 through 1440."})},Fl={...lp,timeframe:t.Integer({minimum:5,maximum:1440,description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over."})},bO=t.Object({type:t.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:Gl,noDataBehavior:t.Enum(Zo,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...up,queries:Sr},{$id:"MonitorConfigurationMetric"}),SO=t.Object({type:t.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:$l,noDataBehavior:t.Enum(Zo,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...lp,queries:Or},{$id:"InputMonitorConfigurationMetric"}),OO=t.Object({type:t.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:Gl,noDataBehavior:t.Enum(Zo,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...up,queries:Sr},{$id:"MonitorConfigurationLog"}),AO=t.Object({type:t.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:$l,noDataBehavior:t.Enum(Zo,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...lp,queries:Or},{$id:"InputMonitorConfigurationLog"}),xO=t.Object({type:t.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:Gl,noDataBehavior:t.Enum(Zo,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...up,queries:Sr},{$id:"MonitorConfigurationTrace"}),oj=t.Object({type:t.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:$l,noDataBehavior:t.Enum(Zo,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...lp,queries:Or},{$id:"InputMonitorConfigurationTrace"}),RO=t.Object({type:t.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:jl,noDataBehavior:t.Enum(Xo,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...ql,queries:Sr},{$id:"MonitorConfigurationAnomalyLog"}),CO=t.Object({type:t.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:Bl,noDataBehavior:t.Enum(Xo,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...Fl,queries:Or},{$id:"InputMonitorConfigurationAnomalyLog"}),PO=t.Object({type:t.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:jl,noDataBehavior:t.Enum(Xo,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...ql,queries:Sr},{$id:"MonitorConfigurationAnomalyMetric"}),UO=t.Object({type:t.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:Bl,noDataBehavior:t.Enum(Xo,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...Fl,queries:Or},{$id:"InputMonitorConfigurationAnomalyMetric"}),wO=t.Object({type:t.Literal("anomaly-trace",{description:"Anomaly monitor over trace aggregations. Use this configuration when Tsuga should learn historical trace query behavior and alert on unusual movement in trace-derived values."}),condition:jl,noDataBehavior:t.Enum(Xo,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...ql,queries:Sr},{$id:"MonitorConfigurationAnomalyTrace"}),ij=t.Object({type:t.Literal("anomaly-trace",{description:"Anomaly monitor over trace aggregations. Set this value to create or update an anomaly monitor that learns historical trace query behavior and alerts on unusual movement in trace-derived values."}),condition:Bl,noDataBehavior:t.Enum(Xo,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...Fl,queries:Or},{$id:"InputMonitorConfigurationAnomalyTrace"}),NO=t.Object({type:t.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:t.Integer({description:"Number of days before certificate expiry when the monitor should warn."}),cloudAccounts:t.Optional(t.Array(t.String(),{description:"Cloud account IDs whose certificates are checked. Omitted means certificates from all cloud accounts are checked."})),aggregationAlertLogic:t.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:t.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"MonitorConfigurationCertificateExpiry"}),aj=t.Object({type:t.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:t.Integer({minimum:1,maximum:365,description:"Number of days before certificate expiry when the monitor should warn. Valid values are 1 through 365."}),cloudAccounts:t.Optional(t.Array(t.String(),{minItems:1,description:"Cloud account IDs whose certificates are checked. Omit to check certificates from all cloud accounts."})),aggregationAlertLogic:t.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:t.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"InputMonitorConfigurationCertificateExpiry"}),sj=t.Object({type:t.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured team, environment, and optional service. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:t.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:t.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:t.Object({teamIds:t.Array(t.String(),{description:"Team IDs whose logs are searched for new error patterns. Tsuga resolves these team IDs to team names when exporting monitor assets."}),env:t.String({description:"Environment whose logs are searched for new error patterns."}),service:t.Optional(t.String({description:"Optional service name whose logs are searched for new error patterns. If omitted, the monitor searches all services matching the team and environment filter."}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included."})},{$id:"MonitorConfigurationLogErrorPattern"}),cj=t.Object({type:t.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured team, environment, and optional service. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:t.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:t.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:t.Object({teamIds:t.Array(p(),{description:"Team IDs whose logs are searched for new error patterns. Tsuga resolves these team IDs to team names when exporting monitor assets."}),env:p({description:"Environment whose logs are searched for new error patterns."}),service:t.Optional(p({description:"Optional service name whose logs are searched for new error patterns. If omitted, the monitor searches all services matching the team and environment filter."}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included."})},{$id:"InputMonitorConfigurationLogErrorPattern"}),pj=b("type",[bO,OO,xO,RO,PO,sj,wO,NO],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."}),uj=b("type",[SO,AO,oj,CO,UO,ij,cj,aj],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."});var xr=t.Object({id:t.String({description:"Tsuga-generated monitor ID assigned when the monitor is created."}),name:t.String({description:"Display name of the monitor and alert source."}),owner:t.String({description:"Team ID that owns and manages the monitor."}),message:t.Optional(t.String({description:"Caller-supplied message included in notifications triggered by this monitor. Omitted when the monitor was created or last updated without one."})),tags:Re,configuration:pj,priority:t.Enum(dt,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),permissions:ln,dashboardId:t.Optional(t.String({description:"ID of the dashboard linked to this monitor for context when investigating alerts. Caller-supplied. Omitted when no dashboard is linked."})),pauseUntil:t.Optional(E({description:"Timestamp until which the monitor is snoozed."})),creator:t.Optional(ae),updater:t.Optional(ae),createdAt:E({description:"Timestamp when Tsuga created the monitor."}),updatedAt:E({description:"Timestamp when Tsuga last updated the monitor."}),assetUpdatedAt:E({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."}),clusterIds:t.Array(t.String(),{description:"Cluster IDs where the monitor is deployed. Empty means all eligible clusters."})},{title:"Monitor"}),lj=b("type",[bO,OO,xO,RO,PO,wO,NO]),ARe=t.Object({...xr.properties,configuration:lj},{title:"Monitor"}),xRe=t.Object({...xr.properties,configuration:b("type",[SO,AO,CO,UO])},{title:"Monitor"}),Ma=t.Object({name:p({description:"Display name of the monitor and alert source."}),message:t.Optional(p({type:"long",description:"Message included in notifications triggered by this monitor. Optional on create. On update, omitting it keeps the existing message."})),tags:$e,configuration:uj,priority:t.Enum(dt,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the monitor."}),dashboardId:t.Optional(t.Union([t.Null(),p({allowEmpty:!1})],{description:"ID of the dashboard to link to this monitor for context when investigating alerts. On create: omit or send `null` to leave the monitor unlinked. On update: omit to skip updating this field, send `null` to clear an existing link."})),pauseUntil:t.Optional(p({allowEmpty:!1,type:"date-time",description:"ISO timestamp until which the monitor should be snoozed."})),permissions:ln,clusterIds:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Cluster IDs where the monitor should be deployed. Empty or omitted means all eligible clusters for cluster-deployed monitor types."}))}),EO=["threshold","certificate-expiry","anomaly-detection","log-error-pattern"],dn={PRIORITY:"priority",TYPE:"type",NAME:"name",OWNER:"owner",TAGS:"tags",CLUSTER_IDS:"clusterIds",PAUSE_UNTIL:"pauseUntil",ASSET_UPDATED_AT:"assetUpdatedAt"};var Hl=t.Object({owners:xe(p({allowEmpty:!1}),{description:"Restrict results to monitors owned by any of these team IDs",maxItems:50}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Case-insensitive substring matched against monitor ID, monitor name, query filters, and aggregate fields. Wildcard characters are treated literally."}),exclude:t.Optional(t.Boolean({description:"If true, exclude monitors matching this value instead of including them"}))},{description:"Search query filter for monitors."}),tags:xe(vt.items,{description:"Restrict results to monitors that have at least one of the listed key/value tags",maxItems:50}),priorities:xe(t.Enum(dt),{description:"Restrict results to monitors with one of these priorities",maxItems:dt.length}),types:xe(t.Enum(EO),{description:"Restrict results to monitors with these types",maxItems:EO.length}),activity:t.Enum(["active","snoozed"],{description:"Restrict results by activity status: active monitors or currently snoozed monitors"}),clusterIds:xe(p({allowEmpty:!1}),{description:"Restrict results to monitors deployed to any of these cluster IDs (monitors with no cluster restriction are always included)",maxItems:50})},{description:"Optional filters applied to narrow the returned monitors"}),Kl=t.Partial(t.Object({...de,filters:t.Partial(Hl),sort:t.Object({by:t.Enum([dn.PRIORITY,dn.TYPE,dn.NAME,dn.OWNER,dn.TAGS,dn.CLUSTER_IDS,dn.PAUSE_UNTIL,dn.ASSET_UPDATED_AT],{description:"Field to sort the returned monitors by. For `priority`, `desc` returns highest-priority monitors first because priority 1 is highest."}),direction:t.Enum(["asc","desc"],{description:"Sort direction. For `priority`, `desc` returns priority 1 first and `asc` returns priority 5 first."})},{description:"Optional sorting applied to the returned monitors. Ties are broken by creation time and monitor ID for stable pagination."})})),RRe=m({tags:["monitors"],url:`${ft}/query`,method:"POST",paginated:!0,response:t.Array(xr),body:Kl}),CRe=m({tags:["monitors"],url:`${ft}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(Hl,["tags"])))}),response:Lt}),PRe=m({tags:["monitors"],url:`${ft}/counts/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(Hl,["activity"])))}),response:t.Object({all:t.Integer({description:"Total number of monitors matching the filters that the user can read."}),active:t.Integer({description:"Number of matching readable monitors that are not currently snoozed."}),snoozed:t.Integer({description:"Number of matching readable monitors that are currently snoozed."})})}),URe=m({tags:["monitors"],url:`${ft}/:id`,method:"GET",params:t.Object({id:p()}),response:xr}),wRe=m({tags:["monitors"],url:ft,method:"POST",body:Ma,response:xr}),NRe=m({tags:["monitors"],url:`${ft}/:id`,method:"PUT",params:t.Object({id:p()}),body:Ma,response:xr}),LRe=m({tags:["monitors"],url:`${ft}/bulk-update`,method:"PUT",body:t.Object({monitorIds:t.Array(p({allowEmpty:!1}),{minItems:1}),owner:p({allowEmpty:!1})}),response:t.Object({})}),vRe=m({tags:["monitors"],url:`${ft}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),kRe=m({tags:["monitors"],url:`${ft}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})}),MRe=m({tags:["monitors"],url:`${ft}/:id/snooze`,method:"POST",params:t.Object({id:p()}),body:t.Object({pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:xr}),DRe=m({tags:["monitors"],url:`${ft}/bulk-snooze`,method:"POST",body:t.Object({monitorIds:t.Array(p()),pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:t.Object({})}),mj=["alert","alert_consider_zero","alert_no_data","keep_last_status_alert"],dj=["ok","ok_consider_zero","ok_no_data","keep_last_status_ok"],fj=[...mj,...dj],Kn=t.Enum(fj),gj=b("type",[t.Object({type:t.Literal("each"),subStates:t.Record(t.String(),t.Object({stateValue:t.Union([Kn,t.Null()]),lastChangedAt:E()}))}),t.Object({type:t.Literal("no_aggregation"),stateValue:t.Optional(Kn)}),t.Object({type:t.Literal("any"),stateValue:t.Optional(Kn)}),t.Object({type:t.Literal("all"),stateValue:t.Optional(Kn)}),t.Object({type:t.Literal("proportion"),stateValue:t.Optional(Kn)})]),yj=t.Object({monitorId:t.String(),currentState:gj,lastChangedAt:t.Optional(E())}),GRe=m({tags:["monitors"],url:`${ft}/states/:id`,method:"GET",params:t.Object({id:p()}),response:yj}),$Re=m({tags:["monitors"],url:`${ft}/:id/transitions`,method:"GET",params:t.Object({id:p()}),query:t.Object({from:t.Number(),to:t.Number()}),response:t.Array(t.Object({id:t.String(),createdAt:E(),fromState:t.Optional(Kn),toState:t.Optional(Kn),dimension:t.Optional(t.String())}))}),hj=["unprocessed","processed","failed-to-process"],jRe=m({tags:["monitors"],url:`${ft}/:id/results`,method:"GET",params:t.Object({id:p()}),query:t.Object({from:t.Number(),to:t.Number()}),response:t.Object({isTruncated:t.Boolean(),results:t.Array(t.Object({id:t.String(),evaluationAt:E(),formulaResult:t.Object({groups:t.Array(t.Object({groupKey:t.Record(t.String(),La),results:t.Array(t.Union([t.Number(),t.Null()])),conditionMet:t.Enum(["true","false","nan-no-data"])}))}),createdAt:E(),status:t.Enum(hj)}))})});var Rr="/v0/slos",Tj=[7,30,90],Ej=["good","bad"],MO=t.Enum(Ej,{description:"How to treat SLO with no data: good (count as meeting the SLO), bad (count as breaching it)"}),_j=["good","bad","ignore"],DO=t.Enum(_j,{description:"How to treat time buckets with no data: good (count as meeting the SLO), bad (count as breaching it), or ignore (exclude from the error budget)"}),LO=30,vO=1440,GO=["greater_than","less_than","greater_than_or_equal","less_than_or_equal"],Ij=["healthy","breached","no_data"],mp=t.Enum(Ij,{description:"SLO status: healthy (meeting the target), breached (breaching it), or no_data (not evaluated yet)"}),kO={sli:t.Optional(t.Number({description:"Service level indicator for the latest evaluation; absent when there is no data"})),errorBudget:t.Optional(t.Number({description:"Remaining error budget at the latest evaluation; negative when exhausted, absent when there is no data"})),status:mp},bj=t.Object({overall:t.Object(kO,{description:"Latest overall evaluation for the cluster"}),perGroup:t.Array(t.Object({groupKey:t.Record(t.String(),La,{description:"Group-by field values identifying this group, keyed by field name. Present only when the SLO configuration sets `groupByFields`."}),...kO}),{description:"Latest evaluation for each group produced by the SLO configuration's `groupByFields`. Empty when the SLO is not grouped."})},{title:"SloClusterResults"}),$O=t.Record(t.String(),bj,{description:"Latest evaluation results keyed by cluster ID."}),zl=t.Object({queries:Sr,formula:ip},{title:"SloQueryFormula",description:"Aggregation queries combined by a formula to produce the SLO signal. Tsuga evaluates this query formula during SLO evaluation and returns it as part of the saved SLO configuration."}),Yl=t.Object({queries:Or,formula:Hn},{title:"SloQueryFormula",description:"Aggregation queries combined by a formula to produce the SLO signal. Formulas reference queries as q1, q2, and so on."}),Sj=t.Object({type:t.Literal("burn-rate",{description:"Alert configuration kind. Set to `burn-rate` for alerts that fire when the SLO consumes error budget faster than the configured multiplier."}),burnRate:t.Number({description:"Burn-rate multiplier that triggers this alert. The short and long evaluation windows are derived from the predefined template with the closest burn rate."})},{title:"BurnRateAlert"}),Oj=t.Object({type:t.Literal("burn-rate",{description:"Alert configuration kind. Set to `burn-rate` for alerts that fire when the SLO consumes error budget faster than the configured multiplier."}),burnRate:t.Number({minimum:1,maximum:100,description:"Burn-rate multiplier that triggers this alert. Required for burn-rate alerts; valid input is 1 through 100. Non-template values are accepted; short and long evaluation windows are derived from the predefined template with the closest burn rate."})},{title:"BurnRateAlert"});var Aj=t.Object({type:t.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:t.Number({description:"SLI percentage threshold for this alert. The alert passes when SLI is at or above this value and fires when SLI is strictly below it."})},{title:"ThresholdAlert"}),xj=t.Object({type:t.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:t.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"SLI percentage threshold for this alert. Required for threshold alerts; valid input is greater than 0 and less than 100. The alert passes when SLI is at or above this value and fires when SLI is strictly below it."})},{title:"ThresholdAlert"}),Rj=b("type",[Sj,Aj],{description:"Alert trigger configuration: burn-rate or threshold"}),jO=b("type",[Oj,xj],{description:"Alert trigger configuration: burn-rate or threshold"}),Vl=t.Enum(dt,{description:"Alert priority (1 is highest, 5 is lowest)"}),Ql=t.Object({id:t.String({description:"Tsuga-generated SLO alert ID assigned when the alert is created."}),sloId:t.String({description:"Parent SLO ID for this alert."}),priority:Vl,configuration:Rj,createdAt:E({description:"Timestamp when Tsuga created the alert."}),updatedAt:E({description:"Timestamp when Tsuga last updated the alert."}),assetUpdatedAt:E({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"SloAlert"}),Cj=t.Object({priority:Vl,configuration:jO}),Pj=t.Object({id:t.Optional(p({allowEmpty:!1,description:"Identifier of an existing alert to update. Omit to create a new alert on this SLO."})),priority:Vl,configuration:jO}),Uj=b("type",[t.Object({type:t.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:Vt,goodQuery:zl,totalQuery:zl,groupByFields:t.Optional(Qo),noDataBehavior:MO},{title:"EventSloConfiguration"}),t.Object({type:t.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:Vt,query:zl,sliceSizeMinutes:t.Integer({description:"Length of each time-SLO evaluation slice in minutes. Required for `type: time`."}),threshold:t.Object({operator:t.Enum(GO,{description:"Comparison operator between the query value and the threshold"}),value:t.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:t.Optional(Qo),noDataBehavior:DO},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),wj=b("type",[t.Object({type:t.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:Vt,goodQuery:Yl,totalQuery:Yl,groupByFields:t.Optional(Ar),noDataBehavior:MO},{title:"EventSloConfiguration"}),t.Object({type:t.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:Vt,query:Yl,sliceSizeMinutes:t.Integer({minimum:LO,maximum:vO,description:`Length of each time-SLO evaluation slice in minutes. Required for \`type: time\`. Valid input is ${LO} through ${vO}.`}),threshold:t.Object({operator:t.Enum(GO,{description:"Comparison operator between the query value and the threshold"}),value:t.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:t.Optional(Ar),noDataBehavior:DO},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),Nj=t.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"Target percentage (0 < target < 100, e.g. 99.9)"}),BO=t.Enum(Tj,{type:"integer",description:"Rolling SLO evaluation window in days. Set by the caller on create or update and returned on read and list responses. Allowed values are 7, 30, and 90."}),Lj=t.Array(t.String(),{description:"Cluster IDs this SLO is evaluated on. Omit or send an empty array on input to run on all clusters; responses use an empty array to mean all clusters. Non-empty input values must reference existing clusters."}),vj=t.Array(p({allowEmpty:!1}),{description:"Cluster IDs this SLO is evaluated on. Omit or send an empty array on input to run on all clusters; responses use an empty array to mean all clusters. Non-empty input values must reference existing clusters."}),Jo=t.Object({id:t.String({description:"Tsuga-generated SLO ID assigned when the SLO is created."}),name:t.String({description:"Display name of the SLO, set by the caller."}),description:t.Optional(t.String({description:"Free-form, caller-provided description of what the SLO measures. Absent when not set."})),tags:Re,configuration:Uj,target:t.Number({description:"Target percentage (0 < target < 100, e.g. 99.9)"}),timeframeDays:BO,owner:t.String({description:"Team ID that owns the SLO"}),permissions:ln,clusterIds:Lj,creator:t.Optional(ae),updater:t.Optional(ae),alerts:t.Array(Ql,{description:"Alerts attached to this SLO"}),createdAt:E({description:"Timestamp when Tsuga created the SLO."}),updatedAt:E({description:"Timestamp when Tsuga last updated the SLO."}),assetUpdatedAt:E({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"Slo"}),kj=t.Object({...Jo.properties,results:$O},{title:"SloWithResults"}),dp=t.Object({name:p({allowEmpty:!1,description:"Display name of the SLO."}),description:t.Optional(p({type:"long",description:"Free-form, caller-provided description of what the SLO measures. Optional."})),tags:$e,configuration:wj,target:Nj,timeframeDays:BO,owner:p({allowEmpty:!1,description:"Team ID that owns the SLO"}),permissions:ln,clusterIds:t.Optional(vj),alerts:t.Array(Cj,{description:"Alerts to create on this SLO. Send an empty array for none."})}),Wl=t.Object({...t.Omit(dp,["alerts"]).properties,alerts:t.Array(Pj,{description:"Alerts attached to this SLO. The SLO owns its alerts: the set is reconciled to exactly this list \u2014 existing alerts are matched by id, alerts without an id are created, and existing alerts absent from the list are deleted. Send an empty array to clear all alerts."})}),qO=t.Object({owners:xe(p({allowEmpty:!1}),{description:"Restrict results to SLOs owned by any of these team IDs",maxItems:50}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against the SLO name or SLO ID."}),exclude:t.Optional(t.Boolean({description:"If true, exclude SLOs matching this value instead of including them"}))},{description:"Text filter for SLO names or IDs. Optional; `exclude: true` removes matching SLOs."}),tags:xe(vt.items,{description:"Restrict results to SLOs that have at least one of the listed key/value tags",maxItems:50}),clusterIds:xe(p({allowEmpty:!1}),{description:"Restrict results to SLOs that run against any of these cluster IDs (SLOs with no cluster restriction are always included)",maxItems:50}),statuses:xe(mp,{description:"Restrict results to SLOs whose status is one of these values",maxItems:3})},{description:"Optional filters applied to narrow the returned SLOs"}),Zl=t.Partial(t.Object({...de,filters:t.Partial(qO),sort:t.Object({by:t.Enum(["name","owner","tags","updatedAt","sli","errorBudget","status"],{description:"Field to sort by"}),direction:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned SLOs"})})),XRe=m({tags:["slos"],url:`${Rr}/query`,method:"POST",paginated:!0,response:t.Array(kj),body:Zl}),JRe=m({tags:["slos"],url:`${Rr}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(qO,["tags","statuses"])))}),response:Lt}),eCe=m({tags:["slos"],url:`${Rr}/:id`,method:"GET",params:t.Object({id:p()}),response:Jo}),tCe=m({tags:["slos"],url:`${Rr}/:id/results`,method:"GET",params:t.Object({id:p()}),response:$O}),rCe=m({tags:["slos"],url:Rr,method:"POST",body:dp,response:Jo}),nCe=m({tags:["slos"],url:`${Rr}/:id`,method:"PUT",params:t.Object({id:p()}),body:Wl,response:Jo}),oCe=m({tags:["slos"],url:`${Rr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),iCe=m({tags:["slos"],url:`${Rr}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})}),aCe=m({tags:["slos"],url:`${Rr}/bulk-update`,method:"PUT",body:t.Object({sloIds:t.Array(p()),owner:p({allowEmpty:!1})}),response:t.Object({})});var ei="/v0/notifications",Yn=`${ei}/rules`,FO=`${ei}/slack/setup`,Da=`${ei}/integrations`,zn=["triggered","resolved","no-data"],Mj=["sent","stale","pending","rate-limited","failed","silenced"],Dj=t.Optional(t.Object({maxMessages:t.Integer({description:"Maximum number of notifications this target can send during the rate-limiting window."}),minutes:t.Integer({description:"Length of the rate-limiting window, in minutes."})},{description:"Per-target rate limit used when sending notifications. If omitted, Tsuga allows up to 1000 notifications every 10 minutes for this target."})),Xl=t.Object({maxMessages:t.Integer({minimum:1,description:"Maximum number of notifications this target can send during the rate-limiting window. The ratio of `maxMessages` to `minutes` cannot exceed 100 notifications per minute."}),minutes:t.Integer({minimum:1,description:"Length of the rate-limiting window, in minutes. The ratio of `maxMessages` to `minutes` cannot exceed 100 notifications per minute."})},{description:"Per-target rate limit used when sending notifications. If omitted, Tsuga allows up to 1000 notifications every 10 minutes for this target."}),Gj=t.Optional(Xl),ur=t.Optional(t.Object({mode:t.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:t.Array(t.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:t.Integer({description:"Minimum number of minutes to wait after the previous notification."})},{description:"Configuration for repeat monitor notifications on this target. If omitted, Tsuga sends only the original notification for each alert transition."})),lr=t.Optional(t.Object({mode:t.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:t.Array(t.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:t.Integer({minimum:1,description:"Minimum number of minutes to wait after the previous notification."})},{description:"Configuration for repeat monitor notifications on this target. If omitted, Tsuga sends only the original notification for each alert transition."})),Ga=t.Object({id:t.String({description:"Identifier of the notification target within this rule, used with the rule ID for per-target delivery state such as rate limiting."}),rateLimit:Dj,config:b("type",[t.Object({type:t.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:t.String({description:"Slack channel ID that receives the notification"}),integrationId:t.String({description:"Slack workspace ID that receives the notification"}),integrationName:t.String({description:"Human readable name of the Slack integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigSlack"}),t.Object({type:t.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:t.String({description:"Identifier of the incident.io integration to use"}),integrationName:t.String({description:"Human readable name of the incident.io integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigIncidentIo"}),t.Object({type:t.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:t.Array(t.String(),{description:"Email addresses that will receive the alert"}),renotifyConfig:ur},{$id:"RuleTargetConfigEmail"}),t.Object({type:t.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:t.String({description:"Identifier of the Grafana IRM integration to use"}),integrationName:t.String({description:"Human readable name of the Grafana IRM integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigGrafanaIrm"}),t.Object({type:t.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:t.String({description:"Identifier of the PagerDuty integration to use"}),integrationName:t.String({description:"Human readable name of the PagerDuty integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigPagerDuty"}),t.Object({type:t.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:t.String({description:"Identifier of the Microsoft Teams integration to use"}),integrationName:t.String({description:"Human readable name of the Microsoft Teams integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigMicrosoftTeams"}),t.Object({type:t.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:t.String({description:"Identifier of the webhook integration to use"}),integrationName:t.String({description:"Human readable name of the webhook integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigWebhook"}),t.Object({type:t.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:t.String({description:"Identifier of the ServiceNow integration to use"}),integrationName:t.String({description:"Human readable name of the ServiceNow integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigServiceNow"}),t.Object({type:t.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:t.String({description:"Identifier of the Google Chat integration to use"}),integrationName:t.String({description:"Human readable name of the Google Chat integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigGoogleChat"}),t.Object({type:t.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:t.String({description:"Identifier of the Squadcast integration to use"}),integrationName:t.String({description:"Human readable name of the Squadcast integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigSquadcast"}),t.Object({type:t.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:t.String({description:"Identifier of the Jira integration to use"}),integrationName:t.String({description:"Human readable name of the Jira integration"}),projectKey:t.String({description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:t.String({description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:t.Optional(t.String({description:"Jira status the alert ticket is moved to right after it is filed for a firing alert. A later transition between two firing states leaves the ticket status alone."})),closedStatus:t.Optional(t.String({description:"Jira status the alert ticket is moved to when the alert resolves. Only takes effect when the rule delivers recovery transitions."}))},{$id:"RuleTargetConfigJira"})],{description:"Destination that received the notification. The `type` field discriminates the variant: `email` sends directly to the listed addresses, and every other type routes through the named integration referenced by `integrationId`."})}),ti=t.Object({id:p({description:"Identifier of the notification target within this rule. Choose a stable ID that is unique among this rule's targets; Tsuga uses it with the rule ID for per-target delivery state such as rate limiting."}),rateLimit:Gj,config:b("type",[t.Object({type:t.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:p({allowEmpty:!1,description:"Slack channel ID that receives the notification"}),integrationId:p({allowEmpty:!1,description:"Slack workspace ID that receives the notification"}),renotifyConfig:lr},{$id:"RuleTargetInputSlack"}),t.Object({type:t.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the incident.io integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputIncidentIo"}),t.Object({type:t.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the PagerDuty integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputPagerDuty"}),t.Object({type:t.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:t.Array(p({type:"email"}),{minItems:1,maxItems:20,description:"Email addresses that will receive the alert"}),renotifyConfig:lr},{$id:"RuleTargetInputEmail"}),t.Object({type:t.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Grafana IRM integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputGrafanaIrm"}),t.Object({type:t.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Microsoft Teams integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputMicrosoftTeams"}),t.Object({type:t.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the webhook integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputWebhook"}),t.Object({type:t.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the ServiceNow integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputServiceNow"}),t.Object({type:t.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Google Chat integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputGoogleChat"}),t.Object({type:t.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Squadcast integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputSquadcast"}),t.Object({type:t.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Jira integration to use"}),projectKey:p({allowEmpty:!1,description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:p({allowEmpty:!1,description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:t.Optional(p({allowEmpty:!1,description:"Jira status the alert ticket is moved to right after it is filed for a firing alert. A later transition between two firing states leaves the ticket status alone."})),closedStatus:t.Optional(p({allowEmpty:!1,description:"Jira status the alert ticket is moved to when the alert resolves. Only takes effect when the rule delivers recovery transitions."}))},{$id:"RuleTargetInputJira"})],{description:"Destination that should receive the notification. The `type` field discriminates the variant: `email` sends directly to the listed addresses and needs no integration; every other type routes through the integration identified by `integrationId`, which must already exist (create it first with the notification integration endpoints)."})}),Jl=b("type",[t.Object({type:t.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:t.Array(t.String(),{description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),t.Object({type:t.Literal("all-teams",{description:"Match alert transitions for every team in the organization. Public API callers need an API key with `all` scope to create or update this filter."})},{title:"AllTeams"}),t.Object({type:t.Literal("all-public-teams",{description:"Match alert transitions for all public teams. Public API callers need an API key with `all` or `owning-team-and-public` scope to create or update this filter."})},{title:"AllPublicTeams"})],{description:"Team visibility filter used when matching alert transitions. Tsuga validates create and update requests against the caller permissions."}),em=b("type",[t.Object({type:t.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:t.Array(p(),{minItems:1,maxItems:100,description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),t.Object({type:t.Literal("all-teams",{description:"Match alert transitions for every team in the organization. Public API callers need an API key with `all` scope to create or update this filter."})},{title:"AllTeams"}),t.Object({type:t.Literal("all-public-teams",{description:"Match alert transitions for all public teams. Public API callers need an API key with `all` or `owning-team-and-public` scope to create or update this filter."})},{title:"AllPublicTeams"})],{description:"Team visibility filter used when matching alert transitions. Tsuga validates create and update requests against the caller permissions."}),ri=t.Object({id:t.String({description:"Tsuga-generated notification rule ID assigned when the rule is created."}),name:t.String({description:"Display name of the notification rule."}),queryString:t.Optional(t.String({description:"Optional query that narrows which alert transitions trigger the rule. Matches on the monitor transition group key and the monitor tags, e.g. `env:prod service:api`. Omit or leave empty to match regardless of tags."})),teamsFilter:Jl,prioritiesFilter:t.Array(t.Enum(dt),{description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(zn),{description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:t.Array(t.String(),{description:"Cluster IDs that must match for this rule to fire. An empty array matches every cluster, as does a transition that has no cluster ID."}),owner:t.String({description:"Team ID that owns and manages the rule."}),createdAt:E({description:"Timestamp when Tsuga created the rule."}),updatedAt:E({description:"Timestamp when Tsuga last updated the rule."}),isActive:t.Boolean({description:"Whether the rule currently sends notifications when its filters match."}),tags:Re,targets:t.Array(Ga,{description:"Destinations that receive a notification whenever this rule matches an alert transition. Every target in the list is notified independently, subject to its own rate limit and renotification settings."}),creator:t.Optional(ae),updater:t.Optional(ae)}),$a=t.Object({name:p({description:"Display name of the notification rule."}),queryString:t.Optional(p({type:"tags-query",description:"Optional query that narrows which alert transitions trigger the rule. Matches on the monitor transition group key and the monitor tags, e.g. `env:prod service:api`. Omit or leave empty to match regardless of tags."})),teamsFilter:em,prioritiesFilter:t.Array(t.Enum(dt),{maxItems:dt.length,description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(zn),{maxItems:zn.length,description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Cluster IDs that must match for this rule to fire. Omit it, or leave it empty, to match every cluster."})),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:$e,isActive:t.Boolean({description:"Set to true for the rule to send notifications when its filters match."}),targets:t.Array(ti,{minItems:1,description:"Destinations that receive a notification whenever this rule matches an alert transition. This list replaces the existing targets on update."})}),fp=t.Object({id:t.String({description:"Unique identifier of the adaptive notification rule. Generated by Tsuga."}),name:t.String({description:"Display name of the adaptive notification rule."}),owner:t.String({description:"Team ID that owns and manages the rule."}),createdAt:E({description:"Timestamp when Tsuga created the rule."}),updatedAt:E({description:"Timestamp when Tsuga last updated the rule."}),isActive:t.Boolean({description:"Whether the rule currently sends notifications when one of its monitors fires."}),shouldCreateInvestigation:t.Boolean({description:"Whether each page records an investigation holding the sampled traces and the call graph the destination was resolved from, linked from the notification body."}),tags:Re,monitorIds:t.Array(t.String(),{description:"Monitors this rule reacts to."}),fallbackTarget:Ga,creator:t.Optional(ae),updater:t.Optional(ae)}),HO=t.Object({name:p({description:"Display name of the adaptive notification rule."}),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:$e,isActive:t.Boolean({description:"Set to true for the rule to send notifications when one of its monitors fires."}),shouldCreateInvestigation:t.Optional(t.Boolean({description:"Set to true to record an investigation for each page, holding the sampled traces and the call graph the destination was resolved from, and to link it from the notification body. Defaults to false."})),monitorIds:t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:100,description:"Monitors this rule reacts to. Only trace monitors and metric monitors over OTel span metrics are eligible."}),fallbackTarget:ti}),gCe=m({tags:["notification-rules"],url:Yn,method:"GET",paginated:!0,query:t.Object(de),response:t.Array(ri)}),yCe=m({tags:["notification-rules"],url:`${Yn}/:id`,params:t.Object({id:p()}),method:"GET",response:ri}),hCe=m({tags:["notification-rules"],url:Yn,method:"POST",body:$a,response:ri}),TCe=m({tags:["notification-rules"],url:`${Yn}/:id`,method:"PUT",params:t.Object({id:p()}),body:$a,response:ri}),ECe=m({tags:["notification-rules"],url:`${Yn}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),ja=`${ei}/adaptive-rules`,_Ce=m({tags:["notification-rules"],url:ja,method:"GET",paginated:!0,query:t.Object(de),response:t.Array(fp)}),ICe=m({tags:["notification-rules"],url:`${ja}/:id`,params:t.Object({id:p()}),method:"GET",response:fp}),bCe=m({tags:["notification-rules"],url:ja,method:"POST",body:HO,response:fp}),SCe=m({tags:["notification-rules"],url:`${ja}/:id`,method:"PUT",params:t.Object({id:p()}),body:HO,response:fp}),OCe=m({tags:["notification-rules"],url:`${ja}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),ACe=m({tags:["notification-integrations"],url:`${FO}/start`,method:"POST",response:t.Object({redirectUrl:t.String()})}),$j=["google-chat","grafana-irm","incident-io","jira","microsoft-teams","pagerduty","servicenow","slack","squadcast","webhook"],jj=t.Object({id:t.String(),name:t.String(),type:t.Enum($j),createdAt:E(),ruleCount:t.Number(),creator:t.Optional(ae)}),xCe=m({tags:["notification-integrations"],url:`${Yn}/integrations`,method:"GET",paginated:!0,query:t.Object(de),response:t.Array(jj)}),RCe=m({tags:["notification-integrations"],url:`${FO}/callback`,method:"GET",query:t.Object({code:p()}),response:t.Object({success:t.Boolean()})}),tm=["POST","PUT"],Bj=t.Record(t.String(),t.String()),qj=t.Record(t.String(),t.Unknown()),Fj=t.Record(t.String(),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))])),Hj=b("type",[t.Object({type:t.Literal("json"),value:qj}),t.Object({type:t.Literal("form"),value:Fj})]),Kj=t.Object({ok:t.String(),alert:t.String()}),rm=t.Object({id:t.String(),name:t.String(),setting:b("type",[t.Object({type:t.Literal("incident-io"),alertSourceConfigId:t.String(),tokenLastChars:t.String()}),t.Object({type:t.Literal("grafana-irm"),urlLastChars:t.String()}),t.Object({type:t.Literal("pagerduty"),integrationKeyLastChars:t.String()}),t.Object({type:t.Literal("microsoft-teams"),webhookUrlLastChars:t.String()}),t.Object({type:t.Literal("webhook"),urlLastChars:t.String(),method:t.Enum(tm),authentication:b("type",[t.Object({type:t.Literal("bearer"),tokenLastChars:t.String()}),t.Object({type:t.Literal("basic"),username:t.String(),passwordLastChars:t.String()}),t.Object({type:t.Literal("custom-header"),key:t.String(),valueLastChars:t.String()}),t.Object({type:t.Literal("none")})]),customHeaders:t.Optional(Bj),payloadTemplate:Hj,eventNameMapping:t.Optional(Kj)}),t.Object({type:t.Literal("servicenow"),instanceName:t.String(),username:t.String(),passwordLastChars:t.String()}),t.Object({type:t.Literal("google-chat"),webhookUrlLastChars:t.String()}),t.Object({type:t.Literal("squadcast"),webhookUrlLastChars:t.String()}),t.Object({type:t.Literal("jira"),siteUrl:t.String(),email:t.String(),apiTokenLastChars:t.String()})]),tags:Re}),zj=t.Object({type:t.Literal("webhook"),url:p({type:"uri"}),method:t.Enum(tm),authentication:b("type",[t.Object({type:t.Literal("bearer"),token:p({allowEmpty:!1})}),t.Object({type:t.Literal("basic"),username:p({allowEmpty:!1}),password:p({allowEmpty:!1})}),t.Object({type:t.Literal("custom-header"),key:p({allowEmpty:!1}),value:p({allowEmpty:!1})}),t.Object({type:t.Literal("none")})]),customHeaders:t.Record(p({allowEmpty:!1}),p()),payloadTemplate:b("type",[t.Object({type:t.Literal("json"),value:t.Record(p({allowEmpty:!1}),t.Unknown())}),t.Object({type:t.Literal("form"),value:t.Record(p({allowEmpty:!1}),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))]))})]),eventNameMapping:t.Optional(t.Object({ok:p({allowEmpty:!1}),alert:p({allowEmpty:!1})}))}),KO=t.Object({type:t.Literal("incident-io"),alertSourceConfigId:p(),token:p()}),zO=t.Object({type:t.Literal("grafana-irm"),url:p({type:"uri"})}),YO=t.Object({type:t.Literal("pagerduty"),integrationKey:p()}),VO=t.Object({type:t.Literal("microsoft-teams"),webhookUrl:p({type:"uri"})}),Yj=t.Object({type:t.Literal("servicenow"),instanceName:p({allowEmpty:!1,description:'Instance name of the ServiceNow instance. This corresponds to the subdomain part of the instance URL, like "my-instance" in "my-instance.service-now.com"'}),username:p({allowEmpty:!1}),password:p({allowEmpty:!1})}),Vj=t.Object({type:t.Literal("google-chat"),webhookUrl:p({type:"uri"})}),Qj=t.Object({type:t.Literal("squadcast"),webhookUrl:p({type:"uri"})}),Wj=t.Object({type:t.Literal("jira"),siteUrl:p({type:"uri",allowEmpty:!1,description:'Base URL of the Jira Cloud site, like "https://your-company.atlassian.net". Tsuga files issues against this site.'}),email:p({type:"email",allowEmpty:!1,description:"Atlassian account email used together with the API token for Basic authentication."}),apiToken:p({allowEmpty:!1,description:"Atlassian API token minted for the account, used as the Basic auth password."})}),Zj=t.Object({name:p(),setting:b("type",[KO,zO,YO,VO,zj,Yj,Vj,Qj,Wj]),tags:$e}),Xj=t.Object({type:t.Literal("webhook"),url:t.Optional(p({type:"uri"})),method:t.Optional(t.Enum(tm)),authentication:t.Optional(b("type",[t.Object({type:t.Literal("bearer"),token:t.Optional(p({allowEmpty:!1}))}),t.Object({type:t.Literal("basic"),username:t.Optional(p({allowEmpty:!1})),password:t.Optional(p({allowEmpty:!1}))}),t.Object({type:t.Literal("custom-header"),key:t.Optional(p({allowEmpty:!1})),value:t.Optional(p({allowEmpty:!1}))}),t.Object({type:t.Literal("none")})])),customHeaders:t.Optional(t.Record(p({allowEmpty:!1}),p())),payloadTemplate:t.Optional(b("type",[t.Object({type:t.Literal("json"),value:t.Record(p({allowEmpty:!1}),t.Unknown())}),t.Object({type:t.Literal("form"),value:t.Record(p({allowEmpty:!1}),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))]))})])),eventNameMapping:t.Optional(t.Object({ok:t.Optional(p({allowEmpty:!1})),alert:t.Optional(p({allowEmpty:!1}))}))}),Jj=t.Object({type:t.Literal("servicenow"),instanceName:t.Optional(p({allowEmpty:!1})),username:t.Optional(p({allowEmpty:!1})),password:t.Optional(p({allowEmpty:!1}))}),eB=t.Object({type:t.Literal("jira"),siteUrl:t.Optional(p({type:"uri",allowEmpty:!1})),email:t.Optional(p({allowEmpty:!1})),apiToken:t.Optional(p({allowEmpty:!1}))}),tB=t.Object({type:t.Literal("google-chat"),webhookUrl:p({type:"uri"})}),rB=t.Object({type:t.Literal("squadcast"),webhookUrl:p({type:"uri"})}),nB=t.Object({name:t.Optional(p()),setting:t.Optional(b("type",[KO,zO,YO,VO,Xj,Jj,tB,rB,eB]))}),CCe=m({tags:["notification-integrations"],url:Da,method:"POST",body:Zj,response:rm}),PCe=m({tags:["notification-integrations"],url:`${Da}/:id`,method:"GET",params:t.Object({id:p()}),response:rm}),UCe=m({tags:["notification-integrations"],url:`${Da}/:id`,method:"PUT",params:t.Object({id:p()}),body:nB,response:rm}),wCe=m({tags:["notification-integrations"],url:`${Da}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),oB=b("status",[t.Object({status:t.Literal("ok",{description:"Tsuga reached Jira and listed the projects the credentials can file into."}),projects:t.Array(t.Object({key:t.String({description:'Jira project key, like "OPS".'}),name:t.String({description:"Human readable Jira project name."}),issueTypes:t.Array(t.String(),{description:"Issue type names available when creating an issue in this project."}),statuses:t.Optional(t.Array(t.String(),{description:"Status names an issue in this project can be transitioned to. Omitted when Jira refused the status lookup for this project."}))}),{description:"Projects the connected Jira account can file issues into."})},{title:"JiraMetadataOk"}),t.Object({status:t.Literal("error",{description:"Tsuga could not load Jira metadata with the stored credentials."}),message:t.String({description:"Human readable reason the Jira metadata could not be loaded."})},{title:"JiraMetadataError"})],{description:"Result of probing Jira for the projects, issue types and statuses reachable with a stored integration. Returns a typed error instead of failing so the rule editor can fall back to free-text entry."}),NCe=m({tags:["notification-integrations"],url:`${Da}/:id/jira-metadata`,method:"GET",params:t.Object({id:p()}),response:oB}),LCe=m({tags:["notification-rules"],url:`${ft}/:id/notifications`,method:"GET",params:t.Object({id:p()}),query:t.Optional(t.Object({from:t.Optional(t.Number()),to:t.Optional(t.Number())})),response:t.Object({notifications:t.Array(t.Object({id:t.String(),monitorId:t.String(),monitorResultId:t.String(),ruleId:t.Optional(t.String()),targetId:t.Optional(t.String()),status:t.Enum(Mj),tryCount:t.Number(),nextTryAt:E(),createdAt:E(),updatedAt:E(),sentAt:t.Optional(E())})),isTruncated:t.Boolean()})}),iB=["slack","incident-io","pagerduty","email","grafana-irm","microsoft-teams","webhook","servicenow","google-chat","squadcast","jira"],vCe=m({tags:["notification-rules"],url:`${Yn}/test`,method:"POST",body:t.Object({notificationRule:$a,targetIds:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Target IDs to test specific targets",minItems:1,maxItems:10}))}),response:t.Union([t.Object({success:t.Literal(!1),overallMessage:t.String({description:"Message when there is an overall error"})}),t.Object({success:t.Boolean(),results:t.Array(t.Object({targetId:t.String({description:"The ID of the target that was tested"}),targetType:t.Enum(iB,{description:"The type of the target (e.g., slack, webhook)"}),status:t.Enum(["success","failure"],{description:"Whether the test notification was sent successfully"}),message:t.Optional(t.String({description:"Message if the notification failed for this specific target"}))}))})])});var kt="/v0/service-catalog";var aB=t.Object({team:t.String({description:"Team name observed on telemetry for this service."}),lastSeenAt:E({description:"Most recent time this team was observed for the service."})},{description:"A team name observed on telemetry for this service, with the last time it was seen."}),sB=t.Object({ingestionApiKey:t.String({description:"Ingestion API key name or identifier observed on telemetry for this service."}),lastSeenAt:E({description:"Most recent time this ingestion key was observed for the service."})},{description:"An ingestion API key observed on telemetry for this service, with the last time it was seen."}),cB=t.Object({version:t.String({description:"Service version value observed in telemetry."}),firstSeenAt:E({description:"First time this version was observed for the service."}),lastSeenAt:E({description:"Most recent time this version was observed for the service."}),faulty:t.Optional(t.Boolean({description:"Whether Tsuga detected this version as associated with faulty behavior."})),faultyLatency:t.Optional(t.Boolean({description:"Whether the faulty behavior Tsuga detected for this version is a latency degradation. Only set by faulty deployment detection when it reports on latency; absent when the detection did not evaluate latency."})),detectionTriggered:t.Optional(t.Boolean({description:"Whether faulty deployment detection has already been triggered for this version. Set when the detection job is launched to avoid re-triggering it. Absent on versions predating this field."}))},{description:"A service version observed in telemetry, with first and last seen timestamps and faulty deployment detection results."}),pB=t.Object({language:t.String({description:"Programming language observed for this service."}),lastSeenAt:E({description:"Most recent time this language was observed."})},{description:"A programming language observed for this service, with the last time it was seen."}),uB=t.Object({runtime:t.String({description:"Runtime observed for this service."}),lastSeenAt:E({description:"Most recent time this runtime was observed."})},{description:"A runtime observed for this service, with the last time it was seen."}),QO=t.Object({protocol:t.String({description:"Observed API protocol (e.g. 'http', 'grpc', 'graphql')"}),lastSeenAt:E({description:"Most recent observation timestamp"})},{description:"An API protocol observed for this service, with the last time it was seen."}),lB=t.Object({framework:t.String({description:"Observed application framework (e.g. 'express', 'fastify', 'django', 'rails')"}),lastSeenAt:E({description:"Most recent observation timestamp"})},{description:"An application framework detected from OpenTelemetry instrumentation scope, with the last time it was seen."}),mB=t.Object({platform:t.String({description:"Observed cloud or orchestration platform (e.g. 'aws_eks', 'kubernetes')"}),lastSeenAt:E({description:"Most recent observation timestamp"})},{description:"A cloud or orchestration platform this service runs on, with the last time it was seen."}),dB=t.Object({provider:t.String({description:"Observed cloud provider (e.g. 'aws', 'gcp', 'azure')"}),lastSeenAt:E({description:"Most recent observation timestamp"})},{description:"A cloud provider this service runs on, with the last time it was seen."}),gp=t.Object({id:t.String({description:"Tsuga-generated identifier of this service target, unique across all services. Used with delivery state such as rate limiting and re-notification."}),serviceId:t.String({description:"Identifier of the service catalog entry this target is attached to."}),config:Ga.properties.config,rateLimit:Ga.properties.rateLimit,createdAt:E({description:"Timestamp when user created this service target."}),updatedAt:E({description:"Timestamp when user last updated this service target."})}),fB=t.Object({config:ti.properties.config,rateLimit:ti.properties.rateLimit}),gB=t.Object({config:ti.properties.config,rateLimit:t.Union([Xl,t.Null()])}),Ba=t.Object({id:t.String({description:"Unique identifier of this service. Use it with service detail and graph endpoints."}),serviceName:t.String({description:"OpenTelemetry service name observed in telemetry."}),serviceNamespace:t.Optional(t.String({description:"OpenTelemetry service namespace observed in telemetry."})),env:t.Optional(t.String({description:"Environment value observed for this service."})),teams:t.Array(aB,{description:"Team names observed on telemetry for this service and when each was last seen."}),ingestionApiKeys:t.Array(sB,{description:"Ingestion API keys observed on telemetry for this service and when each was last seen."}),versions:t.Array(cB,{description:"Service version values observed in telemetry, including first and last seen timestamps."}),languages:t.Array(pB,{description:"Programming languages observed for this service."}),runtimes:t.Array(uB,{description:"Runtime values observed for this service."}),serverProtocols:t.Array(QO,{description:"API protocols this service exposes (from server-kind spans)"}),clientProtocols:t.Array(QO,{description:"API protocols this service calls out over (from client-kind spans)"}),frameworks:t.Array(lB,{description:"Application frameworks detected from OTel instrumentation scope"}),cloudPlatforms:t.Array(mB,{description:"Cloud platforms this service is running on"}),cloudProviders:t.Array(dB,{description:"Cloud providers this service is running on"}),lastSeenAt:E({description:"Most recent time Tsuga observed telemetry for this service."}),firstSeenAt:E({description:"First time Tsuga observed telemetry for this service."}),sources:t.Array(t.String(),{description:"Telemetry sources that contributed evidence for this service entry."}),additionalUserFields:t.Optional(t.Unsafe({type:"object",additionalProperties:!0,description:"Additional user-defined service metadata, when configured."})),logsCount24h:t.Number({description:"Number of logs observed for this service in the last 24 hours."}),errorLogsCount24h:t.Number({description:"Number of error logs observed for this service in the last 24 hours."}),tracesCount24h:t.Number({description:"Number of traces observed for this service in the last 24 hours."}),errorTracesCount24h:t.Number({description:"Number of error traces observed for this service in the last 24 hours."}),notificationTargets:t.Array(gp,{description:"Notification targets attached to this service, used by adaptive notification rules to page its owners."}),createdAt:E({description:"Timestamp when Tsuga created this service catalog entry."}),updatedAt:E({description:"Timestamp when Tsuga last updated this service catalog entry."})}),KCe=m({tags:["service-catalog"],query:t.Object({...de,clusterId:t.Optional(p())}),method:"GET",paginated:!0,url:`${kt}/services`,response:t.Array(Ba)}),yB=t.Object({spanKind:t.Enum(lO),count:t.Number()}),WO=t.Object({...Ba.properties,spanKindCounts:t.Array(yB),envs:t.Object({primaryEnv:t.String(),allEnvs:t.Array(t.String())})}),zCe=m({tags:["service-catalog"],query:t.Object({...de,clusterId:t.Optional(p()),env:t.Optional(p())}),method:"GET",paginated:!0,url:`${kt}/v2/services`,response:t.Array(WO)}),YCe=m({tags:["service-catalog"],query:t.Object({serviceName:p({allowEmpty:!1}),serviceNamespace:t.Optional(p({allowEmpty:!1})),env:p({allowEmpty:!1}),clusterId:t.Optional(p())}),method:"GET",url:`${kt}/v2/service`,response:WO}),VCe=m({tags:["service-catalog"],method:"GET",url:`${kt}/services/:serviceId`,params:t.Object({serviceId:p()}),response:Ba}),QCe=m({tags:["service-catalog"],method:"GET",url:`${kt}/services/:serviceId/targets`,params:t.Object({serviceId:p()}),response:t.Array(gp)}),WCe=m({tags:["service-catalog"],method:"POST",url:`${kt}/services/:serviceId/targets`,params:t.Object({serviceId:p()}),body:fB,response:gp}),ZCe=m({tags:["service-catalog"],method:"PUT",url:`${kt}/services/:serviceId/targets/:targetId`,params:t.Object({serviceId:p(),targetId:p()}),body:gB,response:gp}),XCe=m({tags:["service-catalog"],method:"DELETE",url:`${kt}/services/:serviceId/targets/:targetId`,params:t.Object({serviceId:p(),targetId:p()}),response:x}),hB=["otel_kube","otel_host_kube","otel_host","prometheus","aws_ec2","gcp_compute_engine"];var ZO=t.Object({id:t.String(),hostName:t.String(),env:t.Optional(t.String()),cpuUtilizationAverage:t.Number(),hostType:t.Enum(hB),teams:t.Array(t.String()),tags:t.Array(t.String()),firstSeenAt:E(),lastSeenAt:E(),clusterId:t.String()}),JCe=m({tags:["service-catalog"],method:"GET",url:`${kt}/hosts`,response:t.Array(ZO)}),ePe=m({tags:["service-catalog"],method:"GET",url:`${kt}/hosts/:hostId`,params:t.Object({hostId:p()}),response:ZO}),TB=["http","rpc","messaging","genai","object_store"],XO={name:t.String({description:"Service or inferred dependency name shown in the graph."}),env:t.Optional(t.String({description:"Environment observed from spans."}))},nm=t.Object({...XO,nodeType:t.Literal("observed",{description:"Discriminator for this node variant. Always `observed` for a graph node matched to a service catalog entry by name and env."}),id:t.Union([t.String(),t.Null()],{description:"Service ID, or null when multiple namespaces match the observed service name."}),namespace:t.Union([t.String(),t.Null()],{description:"Service namespace, or null when multiple namespaces match the observed service name."}),errorRate:t.Optional(t.Number({description:"Ratio of entry requests with at least one error to total entry requests observed on this service. Omitted when no entry requests were observed."})),entryErrorRequestCount:t.Number({description:"Number of entry requests on this service where at least one entry span had error status."}),entryRequestCount:t.Number({description:"Number of entry requests observed on this service, counted as unique trace IDs that have at least one entry span on this service. An entry span is a consumer-kind span, a root span (no parent), or any span whose parent belongs to a different service."})}),JO={...XO,endpoint:t.Optional(t.String({description:"Inferred service endpoint address"})),resourceName:t.Optional(t.String({description:"Inferred resource name, e.g. table or queue name"}))},om=t.Object({...JO,nodeType:t.Literal("inferred_db",{description:"Discriminator for this node variant. Always `inferred_db` for a database dependency detected from client-span attributes that could not be matched to a service catalog entry."}),serviceType:t.Literal("db",{description:"Inferred dependency type. Always `db` for this node variant."}),databaseName:t.Optional(t.String({description:"Database name from span_attributes db.namespace (falling back to legacy db.name). Matches the database catalog `name`."})),databaseSystem:t.String({description:"Database system from span_attributes db.system.name (falling back to legacy db.system). Matches the database catalog `databaseSystem`."})}),im=t.Object({...JO,nodeType:t.Literal("inferred",{description:"Discriminator for this node variant. Always `inferred` for a non-database dependency detected from client-span attributes (e.g. a queue or external HTTP call) that could not be matched to a service catalog entry. Database dependencies use the `inferred_db` variant."}),serviceType:t.Enum(TB,{description:"Inferred dependency type from span metadata: http, rpc, messaging, genai, or object_store."})}),EB=b("nodeType",[nm,om,im]),am=t.Object({from:t.Object({env:t.Optional(t.String({description:"Environment of the source node"})),name:t.String({description:"Name of the source node"})},{description:"Reference to the caller node, i.e. the service or dependency that issued the request."}),to:t.Object({env:t.Optional(t.String({description:"Environment of the target node"})),name:t.String({description:"Name of the target node"}),databaseSystem:t.Optional(t.String({description:"Database system of the target when it is an inferred database node (`inferred_db`). Together with `name` and `env` it identifies the target node, distinguishing a database from a same-named service or a same-named database on another system."}))},{description:"Reference to the callee node, i.e. the service or dependency that received the request."}),count:t.Number({description:"Number of cross-service transitions observed on this directed edge in the graph query window."}),errorRate:t.Optional(t.Number({description:"Ratio of errored client spans to total client spans observed on this edge. Omitted when no client spans were observed. For edges to inferred services, the originating span is treated as the client span regardless of its kind."})),errorCount:t.Number({description:"Number of client spans with error status observed on this edge"}),clientSpanCount:t.Number({description:"Number of client spans observed on this edge"})},{description:"Directed dependency edge from a caller node (`from`) to a callee node (`to`) in the service graph, with call-volume and error counts observed over the query window."}),tPe=m({tags:["service-catalog"],url:`${kt}/services/:serviceId/graph`,method:"GET",params:t.Object({serviceId:p()}),query:t.Object({...Ve.properties,query:t.Optional(p({type:"tsuga-query"}))}),response:t.Object({clusterId:t.String(),nodes:t.Array(EB),edges:t.Array(am)})}),_B=t.Object({monitors:t.Array(t.Object({id:t.String({description:"Identifier of the monitor"}),name:t.String({description:"Display name of the monitor"}),owner:t.String({description:"Team ID that owns the monitor"}),priority:t.Enum(dt,{description:"Priority of the monitor"})})),slos:t.Array(t.Object({id:t.String({description:"Identifier of the SLO"}),name:t.String({description:"Display name of the SLO"}),owner:t.String({description:"Team ID that owns the SLO"}),statusCount:t.Partial(t.Record(mp,t.Number()),{description:"Count of SLO statuses for this service: one entry per group matching the service when the SLO groups by service.name, otherwise the overall status"})}))}),rPe=m({tags:["service-catalog"],method:"GET",url:`${kt}/services/:serviceId/related-resources`,params:t.Object({serviceId:p()}),response:_B}),nPe=m({tags:["service-catalog"],method:"GET",url:`${kt}/services/by-api-keys`,response:t.Record(t.String(),t.Array(t.Object({serviceName:t.String(),serviceNamespace:t.Optional(t.String())})))});var sm=`/${"v1"}/services`,cm=t.Pick(Ba,["id","serviceName","serviceNamespace","env","teams","versions","languages","runtimes","serverProtocols","clientProtocols","frameworks","cloudPlatforms","cloudProviders","lastSeenAt","firstSeenAt","sources","logsCount24h","errorLogsCount24h","tracesCount24h","errorTracesCount24h"],{$id:"Service",description:"Service inferred from telemetry, with observed metadata, activity counts, and version signals. See [Services](/documentation/categorize/services/index)."}),IB={id:"123-456-abc",serviceName:"api-gateway",serviceNamespace:"platform",env:"production",teams:[{team:"platform",lastSeenAt:"2024-01-15T12:34:56.000Z"}],versions:[{version:"1.2.3",firstSeenAt:"2024-01-01T08:00:00.000Z",lastSeenAt:"2024-01-15T12:34:56.000Z",faulty:!0,faultyLatency:!0}],languages:[{language:"go",lastSeenAt:"2024-01-15T12:34:56.000Z"}],runtimes:[{runtime:"go",lastSeenAt:"2024-01-15T12:34:56.000Z"}],serverProtocols:[{protocol:"http",lastSeenAt:"2024-01-15T12:34:56.000Z"}],clientProtocols:[{protocol:"grpc",lastSeenAt:"2024-01-15T12:34:56.000Z"}],frameworks:[{framework:"gin",lastSeenAt:"2024-01-15T12:34:56.000Z"}],cloudPlatforms:[{platform:"aws_eks",lastSeenAt:"2024-01-15T12:34:56.000Z"},{platform:"kubernetes",lastSeenAt:"2024-01-15T12:34:56.000Z"}],cloudProviders:[{provider:"aws",lastSeenAt:"2024-01-15T12:34:56.000Z"}],lastSeenAt:"2024-01-15T12:34:56.000Z",firstSeenAt:"2024-01-01T08:00:00.000Z",sources:["logs","metrics","traces"],logsCount24h:12e3,errorLogsCount24h:42,tracesCount24h:8500,errorTracesCount24h:17};Object.assign(cm,{examples:[IB]});var eA=m({description:"Lists services inferred from telemetry. Use this endpoint to inventory service ownership, environments, versions, runtimes, and recent activity. Pagination fields limit the returned page.",operationId:"listServices",tags:["services"],url:sm,method:"GET",paginated:!0,query:t.Object({...De,clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Omit to use the first cluster in the organization; this does not query all clusters."}))},{description:"Service list query. Use pagination and optional cluster scope."}),response:t.Array(cm)}),tA=m({description:"Retrieves one telemetry-inferred service by service ID.",operationId:"getService",tags:["services"],url:`${sm}/:serviceId`,method:"GET",params:t.Object({serviceId:p({allowEmpty:!1,description:"Identifier of the service to retrieve. Use the `id` returned by service list responses."})}),response:cm}),bB=t.Pick(nm,["name","env","nodeType","id","namespace","errorRate","entryErrorRequestCount","entryRequestCount"],{$id:"ObservedServiceGraphNode",description:"Service graph node matched to a service catalog entry by name and env. `id`/`namespace` are null when multiple namespaces share the observed service name."}),SB=t.Pick(im,["name","env","nodeType","serviceType","endpoint","resourceName"],{$id:"InferredServiceGraphNode",description:"Dependency node detected from client-span attributes (e.g. a queue or external HTTP call) that could not be matched to a service catalog entry. Database dependencies use the `inferred_db` variant."}),OB=t.Pick(om,["name","env","nodeType","serviceType","endpoint","resourceName"],{$id:"InferredDbServiceGraphNode",description:"Database dependency node detected from client-span attributes that could not be matched to a service catalog entry."}),AB=b("nodeType",[bB,OB,SB]),xB=t.Pick(am,["from","to","count","errorRate","errorCount","clientSpanCount"],{$id:"ServiceGraphEdge",description:"Directed dependency edge from a caller node (`from`) to a callee node (`to`), with call-volume and error counts observed over the query window."}),RB=t.Optional(t.Integer({...Ve.properties.from,description:"Start of the service graph query window as a Unix timestamp in seconds. Provide both `from` and `to` for a deterministic graph window; otherwise Tsuga uses backend graph defaults."})),CB=t.Optional(t.Integer({...Ve.properties.to,description:"End of the service graph query window as a Unix timestamp in seconds. Provide both `from` and `to` for a deterministic graph window; otherwise Tsuga uses backend graph defaults."})),PB=p({type:"tsuga-query",default:"*",description:"Tsuga query used to filter spans considered for the graph. Defaults to `*`, which applies no additional filter beyond the service identity."}),rA=m({description:"Retrieves a dependency graph for one service over an optional time range and query filter. Provide an explicit time range for deterministic results. Use this to inspect observed downstream and upstream service relationships. See [Service page](/documentation/categorize/services/service-page).",operationId:"getServiceGraph",tags:["services"],url:`${sm}/:serviceId/graph`,method:"GET",params:t.Object({serviceId:p({allowEmpty:!1,description:"Identifier of the service to use as the graph root. Use the `id` returned by service list or get responses."})}),query:t.Object({from:RB,to:CB,query:t.Optional(PB)},{description:"Service graph query. Use time range and optional span query filters."}),response:t.Object({clusterId:t.String({description:"Cluster ID the graph was built from"}),nodes:t.Array(AB,{description:"Observed and inferred nodes included in the service dependency graph."}),edges:t.Array(xB,{description:"Directed dependency edges between graph nodes."})})});var Ce=" (unix seconds, ISO 8601, or relative like -1h/-30m/now)";function nA(e,r){let n=r??Ir(e);return n===void 0?void 0:Xs(n)}function pm(e){let r=Ir(e);return r===void 0?"":` (default: ${r})`}function oA(e,r){e.command("service-graph").description("Inspect service dependency graphs").command("get <SERVICE_ID>").description("Retrieve the dependency graph for a service").option("--from <TIMESTAMP>",`Start of time range${Ce}${pm("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${pm("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter graph spans${pm("query")}`).action(async(o,i)=>{let a={},c=nA("from",i.from),l=nA("to",i.to);c!==void 0&&(a.from=c),l!==void 0&&(a.to=l),i.query!==void 0&&(a.query=i.query);let d=await r()(rA,{params:{serviceId:o},query:a});Q(d)})}var UB=`/${"v1"}/grok`,wB=25,NB=100,iA=t.Object({rules:t.Array(p({allowEmpty:!1,type:"long",description:"Grok parsing rule to preview against each sample. The rule uses the same Grok syntax as the log route **Grok parser** processor, for example `pod:%{DATA:namespace}/%{DATA:name}`."}),{minItems:1,maxItems:wB,description:"Ordered Grok parsing rules to preview. For each sample, Tsuga tries the rules in order and returns the first successful match, matching route Grok processor semantics."}),samples:t.Array(p({allowEmpty:!1,type:"long",description:"Raw log line to parse with the provided Grok rules. The value is parsed as preview input only; this endpoint does not ingest or store the sample."}),{minItems:1,maxItems:NB,description:"Sample log lines to run against the rules. Results are returned in the same order as this array."})},{description:"Grok rules and sample log lines to preview extraction before saving a route processor. The endpoint uses the same parser as the route builder preview and does not create or update routes."}),LB={rules:['pod:%{DATA:pod_namespace}/%{DATA:pod_name}\\] "%{DATA:request}" HTTP/%{POSINT:status}'],samples:['[conn-id:abc pod:tsuga-events/tsuga-events-searcher-0] "/token" HTTP/200']};Object.assign(iA,{examples:[LB]});var aA=t.Object({results:t.Array(t.Object({sample:t.String({description:"Echo of the submitted log line, so results can be matched to the samples in the request."}),matched:t.Boolean({description:"Whether any submitted rule matched this sample. `true` means `extracted` contains the captured fields; `false` means no rule matched."}),extracted:t.Union([t.Record(t.String(),t.Unknown()),t.Null()],{description:"Fields extracted from the first matching Grok rule when `matched` is `true`; dotted capture names are expanded into nested objects. `null` when no rule matched."})}),{description:"Preview result for each submitted sample, in the same order as the request `samples` array."})},{description:"Grok extraction preview results from applying the ordered rules to each submitted sample."}),vB={results:[{sample:'[conn-id:abc pod:tsuga-events/tsuga-events-searcher-0] "/token" HTTP/200',matched:!0,extracted:{pod_namespace:"tsuga-events",pod_name:"tsuga-events-searcher-0",request:"/token",status:"200"}}]};Object.assign(aA,{examples:[vB]});var sA=m({url:`${UB}/parse`,method:"POST",operationId:"parseGrok",tags:["public","grok"],body:iA,response:aA,description:"Parses sample log lines with Grok rules and returns extracted fields, using the same Grok engine as the log route processor. Use this endpoint to author and test route Grok rules before saving them. The operation requires public API read access to log routes. A rule that fails to compile returns a 400 response with error code `GROK_RULE_VALIDATION_ERROR` and structured details in `error.details.ruleErrors`."});var cA=Sn(require("node:fs"));function ni(e){if(e.file){let r=cA.default.readFileSync(e.file==="-"?0:e.file,"utf-8");return JSON.parse(r)}if(e.data)return JSON.parse(e.data);throw new Error("Provide a request body with -f <FILE_PATH> or -d <JSON>. Use --generate-skeleton to get a template.")}function kB(e){return s.IsObject(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"errors")&&s.IsFunction(e.check)&&s.IsFunction(e.errors)}function um(e){return s.HasPropertyKey(e,"~guard")&&kB(e["~guard"])}function lm(e){return s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,r=>s.IsObject(r)&&s.HasPropertyKey(r,"refine")&&s.HasPropertyKey(r,"message")&&s.IsFunction(r.refine)&&s.IsString(r.message))}function Cr(e){return s.IsObject(e)&&!s.IsArray(e)}function yp(e){return s.IsBoolean(e)}function j(e){return Cr(e)||yp(e)}function mm(e){return s.HasPropertyKey(e,"additionalItems")&&j(e.additionalItems)}function Pr(e){return s.HasPropertyKey(e,"additionalProperties")&&j(e.additionalProperties)}function dm(e){return s.HasPropertyKey(e,"allOf")&&s.IsArray(e.allOf)&&e.allOf.every(r=>j(r))}function qa(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function fm(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(r=>j(r))}function gm(e){return s.HasPropertyKey(e,"const")}function Vn(e){return s.HasPropertyKey(e,"contains")&&j(e.contains)}function Mt(e){return s.HasPropertyKey(e,"default")}function ym(e){return s.HasPropertyKey(e,"dependencies")&&s.IsObject(e.dependencies)&&Object.values(e.dependencies).every(r=>j(r)||s.IsArray(r)&&r.every(n=>s.IsString(n)))}function hm(e){return s.HasPropertyKey(e,"dependentRequired")&&s.IsObject(e.dependentRequired)&&Object.values(e.dependentRequired).every(r=>s.IsArray(r)&&r.every(n=>s.IsString(n)))}function Tm(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(r=>j(r))}function Em(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function _m(e){return s.HasPropertyKey(e,"else")&&j(e.else)}function Im(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function bm(e){return s.HasPropertyKey(e,"exclusiveMaximum")&&(s.IsNumber(e.exclusiveMaximum)||s.IsBigInt(e.exclusiveMaximum))}function Ur(e){return s.HasPropertyKey(e,"exclusiveMinimum")&&(s.IsNumber(e.exclusiveMinimum)||s.IsBigInt(e.exclusiveMinimum))}function Fa(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function Qn(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function Sm(e){return s.HasPropertyKey(e,"if")&&j(e.if)}function oi(e){return s.HasPropertyKey(e,"items")&&(j(e.items)||s.IsArray(e.items)&&e.items.every(r=>j(r)))}function Om(e){return oi(e)&&s.IsArray(e.items)}function Am(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function xm(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function hp(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function Rm(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function Cm(e){return s.HasPropertyKey(e,"maxProperties")&&s.IsNumber(e.maxProperties)}function wr(e){return s.HasPropertyKey(e,"minimum")&&(s.IsNumber(e.minimum)||s.IsBigInt(e.minimum))}function Wn(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function ii(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function Ha(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function Ka(e){return s.HasPropertyKey(e,"minProperties")&&s.IsNumber(e.minProperties)}function Pm(e){return s.HasPropertyKey(e,"multipleOf")&&(s.IsNumber(e.multipleOf)||s.IsBigInt(e.multipleOf))}function Um(e){return s.HasPropertyKey(e,"not")&&j(e.not)}function wm(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(r=>j(r))}function za(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function Ya(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(r=>j(r))}function ai(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(r=>j(r))}function Va(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(r=>j(r))}function Nm(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||j(e.propertyNames))}function MB(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function Tp(e){return MB(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function Lm(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function vm(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function Zn(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(r=>s.IsString(r))}function km(e){return s.HasPropertyKey(e,"then")&&j(e.then)}function Mm(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(r=>s.IsString(r)))}function si(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function Ep(e){return s.HasPropertyKey(e,"unevaluatedItems")&&j(e.unevaluatedItems)}function _p(e){return s.HasPropertyKey(e,"unevaluatedProperties")&&j(e.unevaluatedProperties)}var yt=class{constructor(){this.indices=new Set,this.keys=new Set}AddIndex(r){return this.indices.add(r),!0}AddKey(r){return this.keys.add(r),!0}GetIndices(){return this.indices}GetKeys(){return this.keys}Merge(r){for(let n of r)n.indices.forEach(o=>this.indices.add(o)),n.keys.forEach(o=>this.keys.add(o));return!0}},Qa=class extends yt{constructor(r){super(),this.callback=r}AddError(r){return this.callback(r),!1}},Qe=class extends Qa{constructor(){super(r=>this.errors.push(r)),this.errors=[]}AddError(r){return this.errors.push(r),!1}GetErrors(){return this.errors}};var DB="external_",GB=0,VNe={identifier:`${DB}${GB}`,variables:[]};function pA(e,r,n,o){return n["~guard"].check(o)}function uA(e,r,n,o,i,a){return i["~guard"].check(a)||r.AddError({keyword:"~guard",schemaPath:n,instancePath:o,params:{errors:i["~guard"].errors(a)}})}function lA(e,r,n,o){return s.Every(n["~refine"],0,(i,a)=>i.refine(o))}function mA(e,r,n,o,i,a){return s.EveryAll(i["~refine"],0,(c,l)=>c.refine(a)||r.AddError({keyword:"~refine",schemaPath:n,instancePath:o,params:{index:l,message:c.message}}))}function dA(e){return oi(e)&&s.IsArray(e.items)}function fA(e,r,n,o){return dA(n)?o.every((a,c)=>s.IsLessThan(c,n.items.length)||$(e,r,n.additionalItems,a)&&r.AddIndex(c)):!0}function gA(e,r,n,o,i,a){return dA(i)?a.every((l,d)=>{let f=`${n}/additionalItems`,g=`${o}/${d}`;return s.IsLessThan(d,i.items.length)||W(e,r,f,g,i.additionalItems,l)&&r.AddIndex(d)}):!0}function $B(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function yA(e){let r=[];return Ya(e)&&r.push(...s.Keys(e.patternProperties)),Va(e)&&r.push(...s.Keys(e.properties).map($B)),s.IsEqual(r.length,0)?"(?!)":`(${r.join("|")})`}function hA(e,r,n,o){let i=new RegExp(yA(n));return s.Every(s.Keys(o),0,(c,l)=>i.test(c)||$(e,r,n.additionalProperties,o[c])&&r.AddKey(c))}function TA(e,r,n,o,i,a){let c=new RegExp(yA(i)),l=[];return s.EveryAll(s.Keys(a),0,(f,g)=>{let T=`${n}/additionalProperties`,_=`${o}/${f}`,se=new Qe,ge=c.test(f)||W(e,se,T,_,i.additionalProperties,a[f])&&r.AddKey(f);return ge||l.push(f),ge})||r.AddError({keyword:"additionalProperties",schemaPath:n,instancePath:o,params:{additionalProperties:l}})}function EA(e,r,n,o){let i=n.allOf.reduce((a,c)=>{let l=new yt;return $(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,n.allOf.length)&&r.Merge(i)}function _A(e,r,n,o,i,a){let c=[],l=i.allOf.reduce((f,g,T)=>{let _=`${n}/allOf/${T}`,se=new Qe,ge=W(e,se,_,o,g,a);return ge||c.push(se),ge?[...f,se]:f},[]),d=s.IsEqual(l.length,i.allOf.length)&&r.Merge(l);return d||c.forEach(f=>f.GetErrors().forEach(g=>r.AddError(g))),d}function IA(e,r,n,o){let i=n.anyOf.reduce((a,c,l)=>{let d=new yt;return $(e,d,c,o)?[...a,d]:a},[]);return s.IsGreaterThan(i.length,0)&&r.Merge(i)}function bA(e,r,n,o,i,a){let c=[],l=i.anyOf.reduce((f,g,T)=>{let _=new Qe,se=`${n}/anyOf/${T}`,ge=W(e,_,se,o,g,a);return ge||c.push(_),ge?[...f,_]:f},[]),d=s.IsGreaterThan(l.length,0)&&r.Merge(l);return d||c.forEach(f=>f.GetErrors().forEach(g=>r.AddError(g))),d||r.AddError({keyword:"anyOf",schemaPath:n,instancePath:o,params:{}})}function Gm(e,r,n,o){return n}function SA(e,r,n,o,i,a){return Gm(e,r,i,a)||r.AddError({keyword:"boolean",schemaPath:n,instancePath:o,params:{}})}function $m(e,r,n,o){return s.IsValueLike(n.const)?s.IsEqual(o,n.const):s.IsDeepEqual(o,n.const)}function OA(e,r,n,o,i,a){return $m(e,r,i,a)||r.AddError({keyword:"const",schemaPath:n,instancePath:o,params:{allowedValue:i.const}})}function jB(e){return!(Wn(e)&&s.IsEqual(e.minContains,0))}function jm(e,r,n,o){return jB(n)?!s.IsEqual(o.length,0)&&o.some(i=>$(e,r,n.contains,i)):!0}function AA(e,r,n,o,i,a){return jm(e,r,i,a)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:1}})}function xA(e,r,n,o){let i=s.IsEqual(s.Keys(o).length,0),a=s.Every(s.Entries(n.dependencies),0,([c,l])=>!s.HasPropertyKey(o,c)||(s.IsArray(l)?l.every(d=>s.HasPropertyKey(o,d)):$(e,r,l,o)));return i||a}function RA(e,r,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependencies),0,([d,f])=>{let g=`${n}/dependencies/${d}`;return!s.HasPropertyKey(a,d)||(s.IsArray(f)?f.every(T=>s.HasPropertyKey(a,T)||r.AddError({keyword:"dependencies",schemaPath:n,instancePath:o,params:{property:d,dependencies:f}})):W(e,r,g,o,f,a))});return c||l}function CA(e,r,n,o){let i=s.IsEqual(s.Keys(o).length,0),a=s.Every(s.Entries(n.dependentRequired),0,([c,l])=>!s.HasPropertyKey(o,c)||l.every(d=>s.HasPropertyKey(o,d)));return i||a}function PA(e,r,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependentRequired),0,([d,f])=>!s.HasPropertyKey(a,d)||s.EveryAll(f,0,g=>s.HasPropertyKey(a,g)||r.AddError({keyword:"dependentRequired",schemaPath:n,instancePath:o,params:{property:d,dependencies:f}})));return c||l}function UA(e,r,n,o){let i=s.IsEqual(s.Keys(o).length,0),a=s.Every(s.Entries(n.dependentSchemas),0,([c,l])=>!s.HasPropertyKey(o,c)||$(e,r,l,o));return i||a}function wA(e,r,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependentSchemas),0,([d,f])=>{let g=`${n}/dependentSchemas/${d}`;return!s.HasPropertyKey(a,d)||W(e,r,g,o,f,a)});return c||l}function Bm(e,r,n,o){return n.enum.some(i=>s.IsValueLike(i)?s.IsEqual(o,i):s.IsDeepEqual(o,i))}function NA(e,r,n,o,i,a){return Bm(e,r,i,a)||r.AddError({keyword:"enum",schemaPath:n,instancePath:o,params:{allowedValues:i.enum}})}function qm(e,r,n,o){return s.IsLessThan(o,n.exclusiveMaximum)}function LA(e,r,n,o,i,a){return qm(e,r,i,a)||r.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:o,params:{comparison:"<",limit:i.exclusiveMaximum}})}function Fm(e,r,n,o){return s.IsGreaterThan(o,n.exclusiveMinimum)}function vA(e,r,n,o,i,a){return Fm(e,r,i,a)||r.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:o,params:{comparison:">",limit:i.exclusiveMinimum}})}var pi={};Gt(pi,{Clear:()=>MA,Entries:()=>iq,Get:()=>cq,Has:()=>sq,IsDate:()=>Wa,IsDateTime:()=>Hm,IsDuration:()=>Km,IsEmail:()=>zm,IsHostname:()=>Ym,IsIPv4:()=>Zm,IsIPv6:()=>Xm,IsIdnEmail:()=>Vm,IsIdnHostname:()=>Wm,IsIri:()=>ed,IsIriReference:()=>Jm,IsJsonPointer:()=>rd,IsJsonPointerUriFragment:()=>td,IsRegex:()=>nd,IsRelativeJsonPointer:()=>od,IsTime:()=>Za,IsUri:()=>sd,IsUriReference:()=>id,IsUriTemplate:()=>ad,IsUrl:()=>cd,IsUuid:()=>pd,Reset:()=>DA,Set:()=>aq,Test:()=>pq});var BB=[0,31,28,31,30,31,30,31,31,30,31,30,31],qB=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function FB(e){return e%4===0&&(e%100!==0||e%400===0)}function Wa(e){let r=qB.exec(e);if(!r)return!1;let n=+r[1],o=+r[2],i=+r[3];return o>=1&&o<=12&&i>=1&&i<=(o===2&&FB(n)?29:BB[o])}var HB=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function Za(e,r=!0){let n=HB.exec(e);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],c=n[4]==="-"?-1:1,l=+(n[5]||0),d=+(n[6]||0);if(l>23||d>59||r&&!n[4]&&e.toLowerCase().indexOf("z")===-1)return!1;if(o<=23&&i<=59&&a<60)return!0;let f=i-d*c,g=o-l*c-(f<0?1:0);return(g===23||g===-1)&&(f===59||f===-1)&&a<61}function Hm(e,r=!0){let n=e.split(/T/i);return n.length===2&&Wa(n[0])&&Za(n[1],r)}var KB=/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/;function Km(e){return KB.test(e)}var zB=/^(?!.*\.\.)[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[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;function zm(e){return zB.test(e)}var YB=/^(?=.{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;function Ym(e){return YB.test(e)}var VB=/^(?!.*\.\.)[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+(?:\.[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+)*@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?)*$/iu;function Vm(e){return VB.test(e)}function Qm(e){let r=e.codePointAt(0);return r===void 0?!1:r>=12352&&r<=12447||r>=12448&&r<=12543&&r!==12539||r>=19968&&r<=40959}function Wm(e){if(e.length===0||e.includes(" "))return!1;let r=/[\u002E\u3002\uFF0E\uFF61]/g,n=e.normalize("NFC").replace(r,".");if(n.length>253)return!1;let o=n.split(".");if(o.some(i=>i.length===0))return!1;for(let i of o){if(i.length>63||i.startsWith("-")||i.endsWith("-"))return!1;if(/^xn--/i.test(i)){let d=i.slice(4);if(d.length<2||d.includes("---"))return!1;continue}if(/[\u302E\u302F\u3031\u3032\u3033\u3034\u3035\u303B\u0640\u07FA]/.test(i))return!1;let a=i.charAt(0);if(/[\u0903\u0300\u0488]/.test(a))return!1;for(let d=0;d<i.length;d++){let f=i.charAt(d);if(f==="\xB7"){if(d===0||d===i.length-1)return!1;let g=i.charAt(d-1),T=i.charAt(d+1);if(!/^[lL]$/.test(g)||!/^[lL]$/.test(T))return!1}if(f==="\u30FB"){if(i.length===1)return!1;if(d===0){let g=i.charAt(d+1);if(!Qm(g))return!1}else{let g=i.charAt(d-1),T=i.charAt(d+1);if(!Qm(g)||!Qm(T))return!1}}if(f==="\u0375"){if(d===i.length-1)return!1;let g=i.charAt(d+1);if(!/[\u0370-\u03FF]/.test(g))return!1}if(f==="\u05F3"||f==="\u05F4"){if(d===0)return!1;let g=i.charAt(d-1);if(!/[\u05D0-\u05EA]/.test(g))return!1}if(f==="\u200D"&&(d===0||i.charAt(d-1)!=="\u094D"))return!1}let c=!1,l=!1;for(let d=0;d<i.length;d++){let f=i.charAt(d);/[\u0660-\u0669]/.test(f)&&(c=!0),/[\u06F0-\u06F9]/.test(f)&&(l=!0)}if(c&&l)return!1}return!0}var QB=/^(?:(?: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)$/;function Zm(e){return QB.test(e)}var WB=/^((([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;function Xm(e){return WB.test(e)}function kA(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function Jm(e){if(e.includes(" ")||e.includes("\\")||/[\x00-\x1F\x7F]/.test(e)||/%(?![0-9a-fA-F]{2})/.test(e))return!1;if(e==="")return!0;let r=e.indexOf(":");return r>0&&/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e.substring(0,r))?kA(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&r===-1?!1:kA(e)}function ed(e){try{return new URL(e),!0}catch{return!1}}var ZB=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function td(e){return ZB.test(e)}var XB=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function rd(e){return XB.test(e)}function nd(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}var JB=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function od(e){return JB.test(e)}var eq=/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i;function id(e){return eq.test(e)}var tq=/^(?:(?:[^\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;function ad(e){return tq.test(e)}var rq=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i;function sd(e){return rq.test(e)}var nq=/^(?: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;function cd(e){return nq.test(e)}var oq=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function pd(e){return oq.test(e)}var he=new Map;function MA(){he.clear()}function iq(){return[...he.entries()]}function aq(e,r){he.set(e,r)}function sq(e){return he.has(e)}function cq(e){return he.get(e)}function pq(e,r){return he.get(e)?.(r)??!0}function DA(){MA(),he.set("date-time",Hm),he.set("date",Wa),he.set("duration",Km),he.set("email",zm),he.set("hostname",Ym),he.set("idn-email",Vm),he.set("idn-hostname",Wm),he.set("ipv4",Zm),he.set("ipv6",Xm),he.set("iri-reference",Jm),he.set("iri",ed),he.set("json-pointer-uri-fragment",td),he.set("json-pointer",rd),he.set("regex",nd),he.set("relative-json-pointer",od),he.set("time",Za),he.set("uri-reference",id),he.set("uri-template",ad),he.set("uri",sd),he.set("url",cd),he.set("uuid",pd)}DA();function ud(e,r,n,o){return pi.Test(n.format,o)}function GA(e,r,n,o,i,a){return ud(e,r,i,a)||r.AddError({keyword:"format",schemaPath:n,instancePath:o,params:{format:i.format}})}function $A(e,r,n,o){let i=km(n)?n.then:!0,a=_m(n)?n.else:!0;return $(e,r,n.if,o)?$(e,r,i,o):$(e,r,a,o)}function jA(e,r,n,o,i,a){let c=km(i)?i.then:!0,l=_m(i)?i.else:!0,d=new Qe,f=W(e,d,`${n}/if`,o,i.if,a)?W(e,d,`${n}/then`,o,c,a)||r.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"then"}}):W(e,r,`${n}/else`,o,l,a)||r.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"else"}});return f&&r.Merge([d]),f}function uq(e,r,n,o){return s.Every(n.items,0,(i,a)=>s.IsLessEqualThan(o.length,a)||$(e,r,i,o[a])&&r.AddIndex(a))}function lq(e,r,n,o,i,a){return s.EveryAll(i.items,0,(c,l)=>{let d=`${n}/items/${l}`,f=`${o}/${l}`;return s.IsLessEqualThan(a.length,l)||W(e,r,d,f,c,a[l])&&r.AddIndex(l)})}function mq(e,r,n,o){let i=ai(n)?n.prefixItems.length:0;return s.Every(o,i,(a,c)=>$(e,r,n.items,a)&&r.AddIndex(c))}function dq(e,r,n,o,i,a){let c=ai(i)?i.prefixItems.length:0;return s.EveryAll(a,c,(l,d)=>{let f=`${n}/items`,g=`${o}/${d}`;return W(e,r,f,g,i.items,l)&&r.AddIndex(d)})}function BA(e,r,n,o){return Om(n)?uq(e,r,n,o):mq(e,r,n,o)}function qA(e,r,n,o,i,a){return Om(i)?lq(e,r,n,o,i,a):dq(e,r,n,o,i,a)}function fq(e){return Vn(e)}function ld(e,r,n,o){if(!fq(n))return!0;let i=o.reduce((a,c)=>$(e,r,n.contains,c)?++a:a,0);return s.IsLessEqualThan(i,n.maxContains)}function FA(e,r,n,o,i,a){let c=Wn(i)?i.minContains:1;return ld(e,r,i,a)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:c,maxContains:i.maxContains}})}function md(e,r,n,o){return s.IsLessEqualThan(o,n.maximum)}function HA(e,r,n,o,i,a){return md(e,r,i,a)||r.AddError({keyword:"maximum",schemaPath:n,instancePath:o,params:{comparison:"<=",limit:i.maximum}})}function dd(e,r,n,o){return s.IsLessEqualThan(o.length,n.maxItems)}function KA(e,r,n,o,i,a){return dd(e,r,i,a)||r.AddError({keyword:"maxItems",schemaPath:n,instancePath:o,params:{limit:i.maxItems}})}function fd(e,r,n,o){return s.IsMaxLength(o,n.maxLength)}function zA(e,r,n,o,i,a){return fd(e,r,i,a)||r.AddError({keyword:"maxLength",schemaPath:n,instancePath:o,params:{limit:i.maxLength}})}function gd(e,r,n,o){return s.IsLessEqualThan(s.Keys(o).length,n.maxProperties)}function YA(e,r,n,o,i,a){return gd(e,r,i,a)||r.AddError({keyword:"maxProperties",schemaPath:n,instancePath:o,params:{limit:i.maxProperties}})}function gq(e){return Vn(e)}function yd(e,r,n,o){if(!gq(n))return!0;let i=o.reduce((a,c)=>$(e,r,n.contains,c)?++a:a,0);return s.IsGreaterEqualThan(i,n.minContains)}function VA(e,r,n,o,i,a){return yd(e,r,i,a)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:i.minContains}})}function hd(e,r,n,o){return s.IsGreaterEqualThan(o,n.minimum)}function QA(e,r,n,o,i,a){return hd(e,r,i,a)||r.AddError({keyword:"minimum",schemaPath:n,instancePath:o,params:{comparison:">=",limit:i.minimum}})}function Td(e,r,n,o){return s.IsGreaterEqualThan(o.length,n.minItems)}function WA(e,r,n,o,i,a){return Td(e,r,i,a)||r.AddError({keyword:"minItems",schemaPath:n,instancePath:o,params:{limit:i.minItems}})}function Ed(e,r,n,o){return s.IsMinLength(o,n.minLength)}function ZA(e,r,n,o,i,a){return Ed(e,r,i,a)||r.AddError({keyword:"minLength",schemaPath:n,instancePath:o,params:{limit:i.minLength}})}function _d(e,r,n,o){return s.IsGreaterEqualThan(s.Keys(o).length,n.minProperties)}function XA(e,r,n,o,i,a){return _d(e,r,i,a)||r.AddError({keyword:"minProperties",schemaPath:n,instancePath:o,params:{limit:i.minProperties}})}function Id(e,r,n,o){return s.IsMultipleOf(o,n.multipleOf)}function JA(e,r,n,o,i,a){return Id(e,r,i,a)||r.AddError({keyword:"multipleOf",schemaPath:n,instancePath:o,params:{multipleOf:i.multipleOf}})}function bd(e,r,n,o){let i=new yt;return!$(e,i,n.not,o)&&r.Merge([i])}function ex(e,r,n,o,i,a){return bd(e,r,i,a)||r.AddError({keyword:"not",schemaPath:n,instancePath:o,params:{}})}function tx(e,r,n,o){let i=n.oneOf.reduce((a,c)=>{let l=new yt;return $(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,1)&&r.Merge(i)}function rx(e,r,n,o,i,a){let c=[],l=[],d=i.oneOf.reduce((g,T,_)=>{let se=new Qe,ge=`${n}/oneOf/${_}`,jr=W(e,se,ge,o,T,a);return jr&&l.push(_),jr||c.push(se),jr?[...g,se]:g},[]),f=s.IsEqual(d.length,1)&&r.Merge(d);return!f&&s.IsEqual(l.length,0)&&c.forEach(g=>g.GetErrors().forEach(T=>r.AddError(T))),f||r.AddError({keyword:"oneOf",schemaPath:n,instancePath:o,params:{passingSchemas:l}})}function Sd(e,r,n,o){return(s.IsString(n.pattern)?new RegExp(n.pattern):n.pattern).test(o)}function nx(e,r,n,o,i,a){return Sd(e,r,i,a)||r.AddError({keyword:"pattern",schemaPath:n,instancePath:o,params:{pattern:i.pattern}})}function ox(e,r,n,o){return s.Every(s.Entries(n.patternProperties),0,([i,a])=>{let c=new RegExp(i);return s.Every(s.Entries(o),0,([l,d])=>!c.test(l)||$(e,r,a,d)&&r.AddKey(l))})}function ix(e,r,n,o,i,a){return s.EveryAll(s.Entries(i.patternProperties),0,([c,l])=>{let d=`${n}/patternProperties/${c}`,f=new RegExp(c);return s.EveryAll(s.Entries(a),0,([g,T])=>{let _=`${o}/${g}`;return!f.test(g)||W(e,r,d,_,l,T)&&r.AddKey(g)})})}function ax(e,r,n,o){return s.IsEqual(o.length,0)||s.Every(n.prefixItems,0,(i,a)=>s.IsLessEqualThan(o.length,a)||$(e,r,i,o[a])&&r.AddIndex(a))}function sx(e,r,n,o,i,a){return s.IsEqual(a.length,0)||s.EveryAll(i.prefixItems,0,(c,l)=>{let d=`${n}/prefixItems/${l}`,f=`${o}/${l}`;return s.IsLessEqualThan(a.length,l)||W(e,r,d,f,c,a[l])&&r.AddIndex(l)})}function Od(e,r){return e.includes(r)||Pt.Get().exactOptionalPropertyTypes}function Ad(e,r){return s.IsUndefined(e[r])}function cx(e,r,n,o){let i=Zn(n)?n.required:[];return s.Every(s.Entries(n.properties),0,([c,l])=>{let d=!s.HasPropertyKey(o,c)||$(e,r,l,o[c])&&r.AddKey(c);return Od(i,c)?d:Ad(o,c)||d})}function px(e,r,n,o,i,a){let c=Zn(i)?i.required:[];return s.EveryAll(s.Entries(i.properties),0,([d,f])=>{let g=`${n}/properties/${d}`,T=`${o}/${d}`,_=()=>!s.HasPropertyKey(a,d)||W(e,r,g,T,f,a[d])&&r.AddKey(d);return Od(c,d)?_():Ad(a,d)||_()})}function ux(e,r,n,o){return s.Every(s.Keys(o),0,(i,a)=>$(e,r,n.propertyNames,i))}function lx(e,r,n,o,i,a){let c=[];return s.EveryAll(s.Keys(a),0,(d,f)=>{let g=`${o}/${d}`,T=`${n}/propertyNames`,_=new Qe,se=W(e,_,T,g,i.propertyNames,d);return se||c.push(d),se})||r.AddError({keyword:"propertyNames",schemaPath:n,instancePath:o,params:{propertyNames:c}})}function mx(e,r,n,o){let i=e.RecursiveRef(n.$recursiveRef)??!1;return j(i)&&$(e,r,i,o)}function dx(e,r,n,o,i,a){let c=e.RecursiveRef(i.$recursiveRef)??!1;return j(c)&&W(e,r,"#",o,c,a)}function yx(e,r,n,o){let i=e.Ref(n.$ref)??!1,a=new yt,c=j(i)&&$(e,a,i,o);return c&&r.Merge([a]),c}function hx(e,r,n,o,i,a){let c=e.Ref(i.$ref)??!1,l=new Qe,d=j(c)&&W(e,l,"#",o,c,a);return d&&r.Merge([l]),d||l.GetErrors().forEach(f=>r.AddError(f)),d}function Tx(e,r,n,o){return s.Every(n.required,0,i=>s.HasPropertyKey(o,i))}function Ex(e,r,n,o,i,a){let c=[];return s.EveryAll(i.required,0,d=>{let f=s.HasPropertyKey(a,d);return f||c.push(d),f})||r.AddError({keyword:"required",schemaPath:n,instancePath:o,params:{requiredProperties:c}})}function xd(e,r,n,o,i){return s.IsEqual(n,"object")?s.IsObjectNotArray(i):s.IsEqual(n,"array")?s.IsArray(i):s.IsEqual(n,"boolean")?s.IsBoolean(i):s.IsEqual(n,"integer")?s.IsInteger(i):s.IsEqual(n,"number")?s.IsNumber(i):s.IsEqual(n,"null")?s.IsNull(i):s.IsEqual(n,"string")?s.IsString(i):s.IsEqual(n,"asyncIterator")?s.IsAsyncIterator(i):s.IsEqual(n,"bigint")?s.IsBigInt(i):s.IsEqual(n,"constructor")?s.IsConstructor(i):s.IsEqual(n,"function")?s.IsFunction(i):s.IsEqual(n,"iterator")?s.IsIterator(i):s.IsEqual(n,"symbol")?s.IsSymbol(i):s.IsEqual(n,"undefined")?s.IsUndefined(i):s.IsEqual(n,"void")?s.IsUndefined(i):!0}function _x(e,r,n,o,i){return n.some(a=>xd(e,r,a,o,i))}function Ix(e,r,n,o){return s.IsArray(n.type)?_x(e,r,n.type,n,o):xd(e,r,n.type,n,o)}function bx(e,r,n,o,i,a){return(s.IsArray(i.type)?_x(e,r,i.type,i,a):xd(e,r,i.type,i,a))||r.AddError({keyword:"type",schemaPath:n,instancePath:o,params:{type:i.type}})}function Sx(e,r,n,o){let i=r.GetIndices();return s.Every(o,0,(a,c)=>(i.has(c)||$(e,r,n.unevaluatedItems,a))&&r.AddIndex(c))}function Ox(e,r,n,o,i,a){let c=r.GetIndices(),l=[];return s.EveryAll(a,0,(f,g)=>{let T=new Qe,_=(c.has(g)||W(e,T,n,o,i.unevaluatedItems,f))&&r.AddIndex(g);return _||l.push(g),_})||r.AddError({keyword:"unevaluatedItems",schemaPath:n,instancePath:o,params:{unevaluatedItems:l}})}function Ax(e,r,n,o){let i=r.GetKeys();return s.Every(s.Entries(o),0,([a,c])=>i.has(a)||$(e,r,n.unevaluatedProperties,c)&&r.AddKey(a))}function xx(e,r,n,o,i,a){let c=r.GetKeys(),l=[];return s.EveryAll(s.Entries(a),0,([f,g])=>{let T=new Qe,_=c.has(f)||W(e,T,n,o,i.unevaluatedProperties,g)&&r.AddKey(f);return _||l.push(f),_})||r.AddError({keyword:"unevaluatedProperties",schemaPath:n,instancePath:o,params:{unevaluatedProperties:l}})}function Rx(e){return!s.IsEqual(e.uniqueItems,!1)}function Cx(e,r,n,o){if(!Rx(n))return!0;let i=new Set(o.map(Wr.Hash)).size,a=o.length;return s.IsEqual(i,a)}function Px(e,r,n,o,i,a){if(!Rx(i))return!0;let c=new Set,l=a.reduce((f,g,T)=>{let _=Wr.Hash(g);return c.has(_)?[...f,T]:(c.add(_),f)},[]);return s.IsEqual(l.length,0)||r.AddError({keyword:"uniqueItems",schemaPath:n,instancePath:o,params:{duplicateItems:l}})}function $(e,r,n,o){e.Push(n);let i=yp(n)?Gm(e,r,n,o):(!Mm(n)||Ix(e,r,n,o))&&(!(s.IsObject(o)&&!s.IsArray(o))||(!Zn(n)||Tx(e,r,n,o))&&(!Pr(n)||hA(e,r,n,o))&&(!ym(n)||xA(e,r,n,o))&&(!hm(n)||CA(e,r,n,o))&&(!Tm(n)||UA(e,r,n,o))&&(!Ya(n)||ox(e,r,n,o))&&(!Va(n)||cx(e,r,n,o))&&(!Nm(n)||ux(e,r,n,o))&&(!Ka(n)||_d(e,r,n,o))&&(!Cm(n)||gd(e,r,n,o)))&&(!s.IsArray(o)||(!mm(n)||fA(e,r,n,o))&&(!Vn(n)||jm(e,r,n,o))&&(!oi(n)||BA(e,r,n,o))&&(!xm(n)||ld(e,r,n,o))&&(!hp(n)||dd(e,r,n,o))&&(!Wn(n)||yd(e,r,n,o))&&(!ii(n)||Td(e,r,n,o))&&(!ai(n)||ax(e,r,n,o))&&(!si(n)||Cx(e,r,n,o)))&&(!s.IsString(o)||(!Fa(n)||ud(e,r,n,o))&&(!Rm(n)||fd(e,r,n,o))&&(!Ha(n)||Ed(e,r,n,o))&&(!za(n)||Sd(e,r,n,o)))&&(!(s.IsNumber(o)||s.IsBigInt(o))||(!bm(n)||qm(e,r,n,o))&&(!Ur(n)||Fm(e,r,n,o))&&(!Am(n)||md(e,r,n,o))&&(!wr(n)||hd(e,r,n,o))&&(!Pm(n)||Id(e,r,n,o)))&&(!Lm(n)||mx(e,r,n,o))&&(!vm(n)||yx(e,r,n,o))&&(!um(n)||pA(e,r,n,o))&&(!gm(n)||$m(e,r,n,o))&&(!Im(n)||Bm(e,r,n,o))&&(!Sm(n)||$A(e,r,n,o))&&(!Um(n)||bd(e,r,n,o))&&(!dm(n)||EA(e,r,n,o))&&(!fm(n)||IA(e,r,n,o))&&(!wm(n)||tx(e,r,n,o))&&(!Ep(n)||!s.IsArray(o)||Sx(e,r,n,o))&&(!_p(n)||!s.IsObject(o)||Ax(e,r,n,o))&&(!lm(n)||lA(e,r,n,o));return e.Pop(n),i}function W(e,r,n,o,i,a){e.Push(i);let c=yp(i)?SA(e,r,n,o,i,a):!!(+(!Mm(i)||bx(e,r,n,o,i,a))&+(!(s.IsObject(a)&&!s.IsArray(a))||!!(+(!Zn(i)||Ex(e,r,n,o,i,a))&+(!Pr(i)||TA(e,r,n,o,i,a))&+(!ym(i)||RA(e,r,n,o,i,a))&+(!hm(i)||PA(e,r,n,o,i,a))&+(!Tm(i)||wA(e,r,n,o,i,a))&+(!Ya(i)||ix(e,r,n,o,i,a))&+(!Va(i)||px(e,r,n,o,i,a))&+(!Nm(i)||lx(e,r,n,o,i,a))&+(!Ka(i)||XA(e,r,n,o,i,a))&+(!Cm(i)||YA(e,r,n,o,i,a))))&+(!s.IsArray(a)||!!(+(!mm(i)||gA(e,r,n,o,i,a))&+(!Vn(i)||AA(e,r,n,o,i,a))&+(!oi(i)||qA(e,r,n,o,i,a))&+(!xm(i)||FA(e,r,n,o,i,a))&+(!hp(i)||KA(e,r,n,o,i,a))&+(!Wn(i)||VA(e,r,n,o,i,a))&+(!ii(i)||WA(e,r,n,o,i,a))&+(!ai(i)||sx(e,r,n,o,i,a))&+(!si(i)||Px(e,r,n,o,i,a))))&+(!s.IsString(a)||!!(+(!Fa(i)||GA(e,r,n,o,i,a))&+(!Rm(i)||zA(e,r,n,o,i,a))&+(!Ha(i)||ZA(e,r,n,o,i,a))&+(!za(i)||nx(e,r,n,o,i,a))))&+(!(s.IsNumber(a)||s.IsBigInt(a))||!!(+(!bm(i)||LA(e,r,n,o,i,a))&+(!Ur(i)||vA(e,r,n,o,i,a))&+(!Am(i)||HA(e,r,n,o,i,a))&+(!wr(i)||QA(e,r,n,o,i,a))&+(!Pm(i)||JA(e,r,n,o,i,a))))&+(!Lm(i)||dx(e,r,n,o,i,a))&+(!vm(i)||hx(e,r,n,o,i,a))&+(!um(i)||uA(e,r,n,o,i,a))&+(!gm(i)||OA(e,r,n,o,i,a))&+(!Im(i)||NA(e,r,n,o,i,a))&+(!Sm(i)||jA(e,r,n,o,i,a))&+(!Um(i)||ex(e,r,n,o,i,a))&+(!dm(i)||_A(e,r,n,o,i,a))&+(!fm(i)||bA(e,r,n,o,i,a))&+(!wm(i)||rx(e,r,n,o,i,a))&+(!Ep(i)||!s.IsArray(a)||Ox(e,r,n,o,i,a))&+(!_p(i)||!s.IsObject(a)||xx(e,r,n,o,i,a)))&&(!lm(i)||mA(e,r,n,o,i,a));return e.Pop(i),c}var Jn={};Gt(Jn,{Ref:()=>Cq});var Nr={};Gt(Nr,{Delete:()=>bq,Get:()=>_q,Has:()=>Eq,Indices:()=>Xa,Set:()=>Iq});function Ux(e){if(e.length===0)throw Error("Cannot set root")}function wx(e){if(!s.IsObject(e))throw Error("Cannot set value")}function yq(e){return/^(0|[1-9]\d*)$/.test(e)}function Nx(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function hq(e,r){return s.IsObject(r)&&s.HasPropertyKey(r,e)}function Tq(e,r){return s.IsObject(r)?r[e]:void 0}function Rd(e,r){return e.reduce((n,o)=>Tq(o,n),r)}function Xa(e){if(s.IsEqual(e.length,0))return[];let r=e.split("/").map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"));return r.length>0&&r[0]===""?r.slice(1):r}function Eq(e,r){let n=e;return Xa(r).every(o=>hq(o,n)?(n=n[o],!0):!1)}function _q(e,r){let n=Xa(r);return Rd(n,e)}function Iq(e,r,n){let o=Xa(r);Ux(o);let[i,a]=Nx(o),c=Rd(i,e);return wx(c),c[a]=n,e}function bq(e,r){let n=Xa(r);Ux(n);let[o,i]=Nx(n),a=Rd(o,e);return wx(a),s.IsArray(a)&&yq(i)?a.splice(+i,1):delete a[i],e}function Sq(e,r,n){if(e.$id===n.hash)return e;let o=new URL(e.$id,r.href),i=new URL(n.href,r.href);if(s.IsEqual(o.pathname,i.pathname))return n.hash.startsWith("#")?Lx(e,r,n):e}function Oq(e,r,n){let o=new URL(`#${e.$anchor}`,r.href),i=new URL(n.href,r.href);if(s.IsEqual(o.href,i.href))return e}function Lx(e,r,n){return n.href.endsWith("#")?e:n.hash.startsWith("#")?Nr.Get(e,decodeURIComponent(n.hash.slice(1))):void 0}function Aq(e,r,n){if(Qn(e)){let o=Sq(e,r,n);if(!s.IsUndefined(o))return o}if(qa(e)){let o=Oq(e,r,n);if(!s.IsUndefined(o))return o}return Lx(e,r,n)}function xq(e,r,n){return e.reduce((o,i)=>{let a=Cd(i,r,n);return s.IsUndefined(a)?o:a},void 0)}function Rq(e,r,n){return s.Keys(e).reduce((o,i)=>{let a=Cd(e[i],r,n);return s.IsUndefined(a)?o:a},void 0)}function Cd(e,r,n){if(r=Cr(e)&&Qn(e)?new URL(e.$id,r.href):r,Cr(e)){let o=Aq(e,r,n);if(!s.IsUndefined(o))return o}if(s.IsArray(e))return xq(e,r,n);if(s.IsObject(e))return Rq(e,r,n)}function Cq(e,r){let n=new URL("http://unknown"),o=Qn(e)?new URL(e.$id,n.href):n,i=new URL(r,o.href);return Cd(e,o,i)}var eo=class{constructor(r,n){this.context=r,this.schema=n,this.ids=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[]}BaseURL(){return this.ids.reduce((r,n)=>new URL(n.$id,r),new URL("http://unknown"))}Base(){return this.ids[this.ids.length-1]??this.schema}Push(r){Cr(r)&&(Qn(r)&&this.ids.push(r),qa(r)&&this.anchors.push(r),Tp(r)&&this.recursiveAnchors.push(r),Em(r)&&this.dynamicAnchors.push(r))}Pop(r){Cr(r)&&(Qn(r)&&this.ids.pop(),qa(r)&&this.anchors.pop(),Tp(r)&&this.recursiveAnchors.pop(),Em(r)&&this.dynamicAnchors.pop())}FromContext(r){return s.HasPropertyKey(this.context,r)?this.context[r]:void 0}FromRef(r){return r.startsWith("#")?Jn.Ref(this.Base(),r):Jn.Ref(this.schema,r)}Ref(r){return this.FromContext(r)??this.FromRef(r)}RecursiveRef(r){return Tp(this.Base())?Jn.Ref(this.recursiveAnchors[0],r):Jn.Ref(this.Base(),r)}};function vx(...e){let[r,n,o]=ie.Match(e,{3:(c,l,d)=>[c,l,d],2:(c,l)=>[{},c,l]}),i=new eo(r,n),a=new yt;return $(i,a,n,o)}function kx(...e){let[r,n,o]=ie.Match(e,{3:(g,T,_)=>[g,T,_],2:(g,T)=>[{},g,T]}),i=Pt.Get(),a=ny(),c=[],l=new eo(r,n),d=new Qa(g=>{if(!s.IsGreaterEqualThan(c.length,i.maxErrors))return c.push({...g,message:a(g)})});return[W(l,d,"#","",n,o),c]}function fe(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return vx(r,n,o)}function gn(...e){let[r,n,o]=ie.Match(e,{3:(c,l,d)=>[c,l,d],2:(c,l)=>[{},c,l]}),[i,a]=kx(r,n,o);return a}var yn=class extends Error{constructor(r,n,o){super(r),Object.defineProperty(this,"cause",{value:{source:r,errors:o,value:n},writable:!1,configurable:!1,enumerable:!1})}};function Mx(e,r,n){return s.IsArray(n)?n.map(o=>Ze(e,r.items,o)):n}function Dx(e,r,n){return r.Clean(n)}function Gx(e,r,n){return Ze({...e,...r.$defs},ke(r.$ref),n)}function Uq(e){let r=s.HasPropertyKey(e,"unevaluatedProperties")?{additionalProperties:e.unevaluatedProperties}:{},n=Yt(e);return k(n)?Fc(n,r):n}function $x(e,r,n){let o=Uq(r);return Ze(e,o,n)}function Ip(e){return s.HasPropertyKey(e,"additionalProperties")?e.additionalProperties:void 0}function jx(e,r,n){if(!s.IsObject(n)||s.IsArray(n))return n;let o=Ip(r);for(let i of s.Keys(n)){if(s.HasPropertyKey(r.properties,i)){n[i]=Ze(e,r.properties[i],n[i]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||A(o)&&fe(e,o,n[i])){n[i]=Ze(e,o,n[i]);continue}delete n[i]}return n}function Bx(e,r,n){if(!s.IsObject(n))return n;let o=Ip(r),[i,a]=[new RegExp(xt(r)),rt(r)];for(let c of s.Keys(n)){if(i.test(c)){n[c]=Ze(e,a,n[c]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||A(o)&&fe(e,o,n[c])){n[c]=Ze(e,o,n[c]);continue}delete n[c]}return n}function qx(e,r,n){return s.HasPropertyKey(e,r.$ref)?Ze(e,e[r.$ref],n):n}function Fx(e,r,n){if(!s.IsArray(n))return n;let o=Math.min(n.length,r.items.length);for(let i=0;i<o;i++)n[i]=Ze(e,r.items[i],n[i]);return s.IsGreaterThan(n.length,o)?n.slice(0,o):n}function wq(e){let r={};for(let n of Object.getOwnPropertyNames(e))r[n]=ye(e[n]);for(let n of Object.getOwnPropertySymbols(e))r[n]=ye(e[n]);return r}function Nq(e){return s.IsClassInstance(e)?e:wq(e)}function Lq(e){return e.map(r=>ye(r))}function vq(e){return e.slice()}function kq(e){return new Map(ye([...e.entries()]))}function Mq(e){return new Set(ye([...e.values()]))}function ye(e){return ct.IsTypeArray(e)?vq(e):ct.IsMap(e)?kq(e):ct.IsSet(e)?Mq(e):s.IsArray(e)?Lq(e):s.IsObject(e)?Nq(e):e}function Hx(e,r,n){for(let o of r.anyOf){let i=Ze(e,o,ye(n));if(fe(e,o,i))return i}return n}function Ze(e,r,n){return te(r)?Mx(e,r,n):Ut(r)?Dx(e,r,n):me(r)?Gx(e,r,n):w(r)?$x(e,r,n):k(r)?jx(e,r,n):Se(r)?Bx(e,r,n):ue(r)?qx(e,r,n):V(r)?Fx(e,r,n):O(r)?Hx(e,r,n):n}function ro(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return Ze(r,n,o)}function Kx(e,r,n){return s.IsArray(n)?n.map(o=>je(e,r.items,o)):n}function zx(e,r,n){return r.Convert(n)}var ne={};Gt(ne,{Fail:()=>no,IsOk:()=>Ud,Ok:()=>U,TryBigInt:()=>wd,TryBoolean:()=>tF,TryNull:()=>cF,TryNumber:()=>hF,TryString:()=>OF,TryUndefined:()=>wF});function Ud(e){return s.IsObject(e)&&s.HasPropertyKey(e,"value")}function U(e){return{value:e}}function no(){}function Dq(e){return U(e)}function Gq(e){return s.IsEqual(e,!0)?U(BigInt(1)):U(BigInt(0))}function $q(e){return U(BigInt(Math.trunc(e)))}function jq(e){return U(BigInt(0))}var Bq=/^-?(0|[1-9]\d*)n$/,qq=/^-?(0|[1-9]\d*)\.\d+$/,Fq=/^-?(0|[1-9]\d*)$/;function Hq(e){return Bq.test(e)}function Kq(e){return qq.test(e)}function zq(e){return Fq.test(e)}function Yq(e){let r=e.toLowerCase();return Hq(e)?U(BigInt(e.slice(0,e.length-1))):Kq(e)?U(BigInt(e.split(".")[0])):zq(e)?U(BigInt(e)):s.IsEqual(r,"false")?U(BigInt(0)):s.IsEqual(r,"true")?U(BigInt(1)):void 0}function Vq(e){return U(BigInt(0))}function wd(e){return s.IsBigInt(e)?Dq(e):s.IsBoolean(e)?Gq(e):s.IsNumber(e)?$q(e):s.IsNull(e)?jq(e):s.IsString(e)?Yq(e):s.IsUndefined(e)?Vq(e):void 0}function Qq(e){return s.IsEqual(e,BigInt(0))?U(!1):s.IsEqual(e,BigInt(1))?U(!0):void 0}function Wq(e){return U(e)}function Zq(e){return s.IsEqual(e,0)?U(!1):s.IsEqual(e,1)?U(!0):void 0}function Xq(e){return U(!1)}function Jq(e){return s.IsEqual(e.toLowerCase(),"false")?U(!1):s.IsEqual(e.toLowerCase(),"true")?U(!0):s.IsEqual(e,"0")?U(!1):s.IsEqual(e,"1")?U(!0):void 0}function eF(e){return U(!1)}function tF(e){return s.IsBigInt(e)?Qq(e):s.IsBoolean(e)?Wq(e):s.IsNumber(e)?Zq(e):s.IsNull(e)?Xq(e):s.IsString(e)?Jq(e):s.IsUndefined(e)?eF(e):void 0}function rF(e){return s.IsEqual(e,BigInt(0))?U(null):void 0}function nF(e){return s.IsEqual(e,!1)?U(null):void 0}function oF(e){return s.IsEqual(e,0)?U(null):void 0}function iF(e){return U(null)}function aF(e){let r=e.toLowerCase();return s.IsEqual(r,"undefined")||s.IsEqual(r,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?U(null):void 0}function sF(e){return U(null)}function cF(e){return s.IsBigInt(e)?rF(e):s.IsBoolean(e)?nF(e):s.IsNumber(e)?oF(e):s.IsNull(e)?iF(e):s.IsString(e)?aF(e):s.IsUndefined(e)?sF(e):void 0}var pF=BigInt(Number.MAX_SAFE_INTEGER),uF=BigInt(Number.MIN_SAFE_INTEGER);function lF(e){return e<=pF&&e>=uF}function Yx(e){return lF(e)?U(Number(e)):void 0}function mF(e){return e?U(1):U(0)}function dF(e){return U(e)}function fF(e){return U(0)}function gF(e){let r=+e;if(s.IsNumber(r))return U(r);let n=e.toLowerCase();if(s.IsEqual(n,"false"))return U(0);if(s.IsEqual(n,"true"))return U(1);let o=wd(e);return Ud(o)?Yx(o.value):void 0}function yF(e){return U(0)}function hF(e){return s.IsBigInt(e)?Yx(e):s.IsBoolean(e)?mF(e):s.IsNumber(e)?dF(e):s.IsNull(e)?fF(e):s.IsString(e)?gF(e):s.IsUndefined(e)?yF(e):void 0}function TF(e){return U(e.toString())}function EF(e){return U(e.toString())}function _F(e){return U(e.toString())}function IF(e){return U("null")}function bF(e){return U(e)}function SF(e){return U("")}function OF(e){return s.IsBigInt(e)?TF(e):s.IsBoolean(e)?EF(e):s.IsNumber(e)?_F(e):s.IsNull(e)?IF(e):s.IsString(e)?bF(e):s.IsUndefined(e)?SF(e):void 0}function AF(e){return s.IsEqual(e,BigInt(0))?U(void 0):void 0}function xF(e){return s.IsEqual(e,!1)?U(void 0):void 0}function RF(e){return s.IsEqual(e,0)?U(void 0):void 0}function CF(e){return U(void 0)}function PF(e){let r=e.toLowerCase();return s.IsEqual(r,"undefined")||s.IsEqual(r,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?U(void 0):void 0}function UF(e){return U(void 0)}function wF(e){return s.IsBigInt(e)?AF(e):s.IsBoolean(e)?xF(e):s.IsNumber(e)?RF(e):s.IsNull(e)?CF(e):s.IsString(e)?PF(e):s.IsUndefined(e)?UF(e):void 0}function Vx(e,r,n){if(s.IsBigInt(n))return n;let o=ne.TryBigInt(n);return ne.IsOk(o)?o.value:n}function Qx(e,r,n){if(s.IsBoolean(n))return n;let o=ne.TryBoolean(n);return ne.IsOk(o)?o.value:n}function Wx(e,r,n){return je({...e,...r.$defs},ke(r.$ref),n)}function bp(e,r,n){if(r.anyOf.some(c=>fe(e,c,n)))return n;let a=r.anyOf.map(c=>je(e,c,ye(n))).find(c=>fe(e,r,c));return s.IsUndefined(a)?n:a}function Zx(e,r,n){let o=kn(r);return bp(e,o,n)}function Xx(e,r,n){if(s.IsInteger(n))return n;let o=ne.TryNumber(n);return ne.IsOk(o)?Math.trunc(o.value):n}function Jx(e,r,n){let o=Yt(r);return je(e,o,n)}function NF(e,r,n){let o=ne.TryBigInt(n);return ne.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function LF(e,r,n){let o=ne.TryBoolean(n);return ne.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function vF(e,r,n){let o=ne.TryNumber(n);return ne.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function kF(e,r,n){let o=ne.TryString(n);return ne.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function eR(e,r,n){return s.IsEqual(r.const,n)?n:ly(r)?NF(e,r,n):my(r)?LF(e,r,n):Eo(r)?vF(e,r,n):_o(r)?kF(e,r,n):H()}function tR(e,r,n){if(s.IsNull(n))return n;let o=ne.TryNull(n);return ne.IsOk(o)?o.value:n}function rR(e,r,n){if(s.IsNumber(n))return n;let o=ne.TryNumber(n);return ne.IsOk(o)?o.value:n}function Sp(e,r,n,o){let i=s.Keys(o);for(let[a,c]of r)for(let l of i)a.test(l)||(o[l]=je(e,n,o[l]));return o}function Ja(e,r,n){return Be(e)&&s.IsUndefined(n[r])}function MF(e,r,n){let o=s.EntriesRegExp(r.properties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)!a.test(l)||Ja(c,l,n)||(n[l]=je(e,c,n[l]));return s.HasPropertyKey(r,"additionalProperties")&&s.IsObject(r.additionalProperties)?Sp(e,o,r.additionalProperties,n):n}function nR(e,r,n){return s.IsObjectNotArray(n)?MF(e,r,n):n}function DF(e,r,n){let o=s.EntriesRegExp(r.patternProperties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)a.test(l)&&(n[l]=je(e,c,n[l]));return s.HasPropertyKey(r,"additionalProperties")&&s.IsObject(r.additionalProperties)?Sp(e,o,r.additionalProperties,n):n}function oR(e,r,n){return s.IsObjectNotArray(n)?DF(e,r,n):n}function iR(e,r,n){return s.HasPropertyKey(e,r.$ref)?je(e,e[r.$ref],n):n}function aR(e,r,n){if(s.IsString(n))return n;let o=ne.TryString(n);return ne.IsOk(o)?o.value:n}function sR(e,r,n){let o=nt(r.pattern);return je(e,o,n)}function cR(e,r,n){if(!s.IsArray(n))return n;for(let o=0;o<Math.min(r.items.length,n.length);o++)n[o]=je(e,r.items[o],n[o]);return n}function pR(e,r,n){if(s.IsUndefined(n))return n;let o=ne.TryUndefined(n);return ne.IsOk(o)?o.value:n}function uR(e,r,n){if(s.IsUndefined(n))return n;let o=ne.TryUndefined(n);return ne.IsOk(o)?void 0:n}function je(e,r,n){return te(r)?Kx(e,r,n):Ut(r)?zx(e,r,n):At(r)?Vx(e,r,n):lt(r)?Qx(e,r,n):me(r)?Wx(e,r,n):Ne(r)?Zx(e,r,n):ze(r)?Xx(e,r,n):w(r)?Jx(e,r,n):X(r)?eR(e,r,n):tr(r)?tR(e,r,n):be(r)?rR(e,r,n):k(r)?nR(e,r,n):Se(r)?oR(e,r,n):ue(r)?iR(e,r,n):Me(r)?aR(e,r,n):Le(r)?sR(e,r,n):V(r)?cR(e,r,n):or(r)?pR(e,r,n):O(r)?bp(e,r,n):Rt(r)?uR(e,r,n):n}function hn(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return je(r,n,o)}function lR(e,r,n){if(!s.IsArray(n))return n;for(let o=0;o<n.length;o++)n[o]=Ke(e,r.items,n[o]);return n}function mR(e,r,n){return r.Default(n)}function dR(e,r,n){return Ke({...e,...r.$defs},ke(r.$ref),n)}function fR(e,r){return s.IsUndefined(r)?s.IsFunction(e.default)?e.default():ye(e.default):r}function gR(e,r,n){let o=Yt(r);return Ke(e,o,n)}function yR(e,r,n){if(!s.IsObject(n))return n;let o=s.Keys(r.properties);for(let i of o){let a=Ke(e,r.properties[i],n[i]);s.IsUndefined(a)&&(Be(r.properties[i])||!s.HasPropertyKey(r.properties[i],"default"))||(n[i]=Ke(e,r.properties[i],n[i]))}if(!Pr(r)||s.IsBoolean(r.additionalProperties))return n;for(let i of s.Keys(n))o.includes(i)||(n[i]=Ke(e,r.additionalProperties,n[i]));return n}function hR(e,r,n){if(!s.IsObject(n))return n;let[o,i]=[new RegExp(xt(r)),rt(r)];for(let a of s.Keys(n))o.test(a)&&Mt(i)&&(n[a]=Ke(e,i,n[a]));if(!Pr(r))return n;for(let a of s.Keys(n))o.test(a)||(n[a]=Ke(e,r.additionalProperties,n[a]));return n}function TR(e,r,n){return s.HasPropertyKey(e,r.$ref)?Ke(e,e[r.$ref],n):n}function ER(e,r,n){if(!s.IsArray(n))return n;let[o,i]=[r.items,Math.max(r.items.length,n.length)];for(let a=0;a<i;a++)a<o.length&&(n[a]=Ke(e,o[a],n[a]));return n}function _R(e,r,n){for(let o of r.anyOf){let i=Ke(e,o,ye(n));if(fe(e,o,i))return i}return n}function Ke(e,r,n){let o=Mt(r)?fR(r,n):n;return te(r)?lR(e,r,o):Ut(r)?mR(e,r,o):me(r)?dR(e,r,o):w(r)?gR(e,r,o):k(r)?yR(e,r,o):Se(r)?hR(e,r,o):ue(r)?TR(e,r,o):V(r)?ER(e,r,o):O(r)?_R(e,r,o):o}function oo(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return Ke(r,n,o)}function ui(e){return(...r)=>{let[n,o,i]=ie.Match(r,{3:(a,c,l)=>[a,c,l],2:(a,c)=>[{},a,c]});return e.reduce((a,c)=>c(n,o,a),i)}}function GF(e,r,n){return r["~codec"].decode(n)}function $F(e,r,n){return r["~codec"].encode(n)}function Pe(e,r,n,o){return Un(n)?s.IsEqual(e,"Decode")?GF(r,n,o):$F(r,n,o):o}function jF(e,r,n,o){if(!s.IsArray(o))return H();for(let i=0;i<o.length;i++)o[i]=Te(e,r,n.items,o[i]);return Pe(e,r,n,o)}function BF(e,r,n,o){let i=Pe(e,r,n,o);if(!s.IsArray(i))return i;for(let a=0;a<i.length;a++)i[a]=Te(e,r,n.items,i[a]);return i}function IR(e,r,n,o){return s.IsEqual(e,"Decode")?jF(e,r,n,o):BF(e,r,n,o)}function bR(e,r,n,o){return o=Te(e,{...r,...n.$defs},ke(n.$ref),o),Pe(e,r,n,o)}function qF(e,r,n,o){for(let i of n.allOf)o=Te(e,r,i,o);return Pe(e,r,n,o)}function FF(e,r,n,o){let i=Pe(e,r,n,o);for(let a of n.allOf)i=Te(e,r,a,i);return i}function SR(e,r,n,o){return s.IsEqual(e,"Decode")?qF(e,r,n,o):FF(e,r,n,o)}function HF(e,r,n,o){if(!s.IsObjectNotArray(o))return H();for(let i of s.Keys(n.properties))!s.HasPropertyKey(o,i)||Ja(n.properties[i],i,o)||(o[i]=Te(e,r,n.properties[i],o[i]));return Pe(e,r,n,o)}function KF(e,r,n,o){let i=Pe(e,r,n,o);if(!s.IsObjectNotArray(i))return i;for(let a of s.Keys(n.properties))!s.HasPropertyKey(i,a)||Ja(n.properties[a],a,i)||(i[a]=Te(e,r,n.properties[a],i[a]));return i}function OR(e,r,n,o){return s.IsEqual(e,"Decode")?HF(e,r,n,o):KF(e,r,n,o)}function zF(e,r,n,o){if(!s.IsObjectNotArray(o))return H();let i=new RegExp(xt(n));for(let a of s.Keys(o))i.test(a)||H(),o[a]=Te(e,r,rt(n),o[a]);return Pe(e,r,n,o)}function YF(e,r,n,o){let i=Pe(e,r,n,o);if(!s.IsObjectNotArray(i))return i;let a=new RegExp(xt(n));for(let c of s.Keys(i))a.test(c)&&(i[c]=Te(e,r,rt(n),i[c]));return i}function AR(e,r,n,o){return s.IsEqual(e,"Decode")?zF(e,r,n,o):YF(e,r,n,o)}function xR(e,r,n,o){return o=s.HasPropertyKey(r,n.$ref)?Te(e,r,r[n.$ref],o):o,Pe(e,r,n,o)}function VF(e,r,n,o){if(!s.IsArray(o))return H();for(let i=0;i<Math.min(n.items.length,o.length);i++)o[i]=Te(e,r,n.items[i],o[i]);return Pe(e,r,n,o)}function QF(e,r,n,o){let i=Pe(e,r,n,o);if(!s.IsArray(i))return o;for(let a=0;a<Math.min(n.items.length,i.length);a++)i[a]=Te(e,r,n.items[a],i[a]);return i}function RR(e,r,n,o){return s.IsEqual(e,"Decode")?VF(e,r,n,o):QF(e,r,n,o)}function WF(e,r,n,o){for(let i of n.anyOf){if(!fe(r,i,o))continue;let a=Te(e,r,i,o);return Pe(e,r,n,a)}return H()}function ZF(e,r,n,o){let i=Pe(e,r,n,o);for(let a of n.anyOf){let c=Te(e,r,a,ye(i));if(fe(r,a,c))return c}return i}function CR(e,r,n,o){return s.IsEqual(e,"Decode")?WF(e,r,n,o):ZF(e,r,n,o)}function Te(e,r,n,o){return te(n)?IR(e,r,n,o):me(n)?bR(e,r,n,o):w(n)?SR(e,r,n,o):k(n)?OR(e,r,n,o):Se(n)?AR(e,r,n,o):ue(n)?xR(e,r,n,o):V(n)?RR(e,r,n,o):O(n)?CR(e,r,n,o):Pe(e,r,n,o)}var Nd=class extends yn{constructor(r,n){super("Decode",r,n)}};function XF(e,r,n){if(!fe(e,r,n))throw new Nd(n,gn(e,r,n));return n}function JF(e,r,n){return Te("Decode",e,r,n)}var nHe=ui([(e,r,n)=>ye(n),(e,r,n)=>oo(e,r,n),(e,r,n)=>hn(e,r,n),(e,r,n)=>ro(e,r,n),(e,r,n)=>XF(e,r,n),(e,r,n)=>JF(e,r,n)]);var Ld=class extends yn{constructor(r,n){super("Encode",r,n)}};function eH(e,r,n){if(!fe(e,r,n))throw new Ld(n,gn(e,r,n));return n}function tH(e,r,n){return Te("Encode",e,r,n)}var gHe=ui([(e,r,n)=>ye(n),(e,r,n)=>tH(e,r,n),(e,r,n)=>oo(e,r,n),(e,r,n)=>hn(e,r,n),(e,r,n)=>ro(e,r,n),(e,r,n)=>eH(e,r,n)]);var Bt=class extends Error{constructor(r,n){super(n),this.type=r}};function PR(e,r){return s.IsFunction(r.default)?r.default(r):s.IsObject(r.default)?ye(r.default):r.default}function UR(e,r){if(si(r)&&!Mt(r))throw new Bt(r,"Arrays with uniqueItems constraints must specify a default annotation");let n=ii(r)?r.minItems:0;return Array.from({length:n},()=>Ee(e,r.items))}async function*rH(){}function wR(e,r){return rH()}function NR(e,r){return r.Create()}function LR(e,r){return Ur(r)?BigInt(r.exclusiveMinimum)+BigInt(1):wr(r)?BigInt(r.minimum):BigInt(0)}function vR(e,r){return!1}function kR(e,r){let n=Ee(e,r.instanceType);return class{constructor(){Object.assign(this,n)}}}function MR(e,r){return Ee({...e,...r.$defs},ke(r.$ref))}function DR(e,r){return Ee(e,kn(r))}function GR(e,r){let n=Ee(e,r.returnType);return()=>n}function $R(e,r){return Ur(r)&&s.IsNumber(r.exclusiveMinimum)?r.exclusiveMinimum+1:wr(r)?r.minimum:0}function jR(e,r){return Ee(e,Yt(r))}function*nH(){}function BR(e,r){return nH()}function qR(e,r){return r.const}function FR(e,r){throw new Bt(r,"Cannot create TNever types")}function HR(e,r){return null}function KR(e,r){return Ur(r)&&s.IsNumber(r.exclusiveMinimum)?r.exclusiveMinimum+1:wr(r)?r.minimum:0}function zR(e,r){return(s.IsUndefined(r.required)?[]:r.required).reduce((o,i)=>({...o,[i]:Ee(e,r.properties[i])}),{})}function YR(e,r){return Promise.resolve(Ee(e,r.item))}function VR(e,r){if(Ka(r)&&!Mt(r))throw new Bt(r,"Record with the minProperties constraint must have a default annotation");return{}}function QR(e,r){return s.HasPropertyKey(e,r.$ref)?Ee(e,e[r.$ref]):(()=>{throw new Bt(r,"Unable to deref Ref")})()}function WR(e,r){if((za(r)||Fa(r))&&!Mt(r))throw Error("Strings with format or pattern constraints must specify default");let o=Ha(r)?r.minLength:0;return"".padEnd(o)}function ZR(e,r){return Symbol()}function XR(e,r){let n=nt(r.pattern);if(Me(n))throw new Bt(r,"Unable to create TemplateLiteral due to infinite type expansion");return Ee(e,n)}function JR(e,r){return Array.from({length:r.minItems},(n,o)=>Ee(e,r.items[o]))}function eC(e,r){if(s.IsEqual(r.anyOf.length,0))throw Error("Unable to create Union with no variants");return Ee(e,r.anyOf[0])}function Ee(e,r){return Mt(r)?PR(e,r):te(r)?UR(e,r):at(r)?wR(e,r):Ut(r)?NR(e,r):At(r)?LR(e,r):lt(r)?vR(e,r):qe(r)?kR(e,r):me(r)?MR(e,r):Ne(r)?DR(e,r):Fe(r)?GR(e,r):ze(r)?$R(e,r):w(r)?jR(e,r):st(r)?BR(e,r):X(r)?qR(e,r):hr(r)?FR(e,r):tr(r)?HR(e,r):be(r)?KR(e,r):k(r)?zR(e,r):tt(r)?YR(e,r):Se(r)?VR(e,r):ue(r)?QR(e,r):Me(r)?WR(e,r):rr(r)?ZR(e,r):Le(r)?XR(e,r):V(r)?JR(e,r):or(r)?void 0:O(r)?eC(e,r):Rt(r)?void 0:void 0}function mr(...e){let[r,n]=ie.Match(e,{2:(o,i)=>[o,i],1:o=>[{},o]});return Ee(r,n)}var vd=class extends yn{constructor(r,n){super("Parse",r,n)}};function oH(e,r,n){if(!fe(e,r,n))throw new vd(n,gn(e,r,n));return n}var _ze=ui([(e,r,n)=>ye(n),(e,r,n)=>oo(e,r,n),(e,r,n)=>hn(e,r,n),(e,r,n)=>ro(e,r,n),(e,r,n)=>oH(e,r,n)]);var aH=N({type:Y("insert"),path:bt(),value:Je()}),sH=Object({type:Y("update"),path:bt(),value:Je()}),cH=N({type:Y("delete"),path:bt()}),Rze=B([aH,sH,cH]);function li(e){if(!e.body)throw new Error("This command does not accept a request body");let r=e.body;return r.examples?.length?r.examples[0]:mr(r)}function io(e,r,n,o,i){e.command(r).description(n).option("-f, --file <FILE_PATH>","Read body from file (use - for stdin)").option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async a=>{if(a.generateSkeleton){Q(li(o));return}let c=ni(a),l=await i()(o,{body:c});Q(l)})}function nC(e,r){let n=e.command("grok").description("Test and preview grok parsing rules");io(n,"parse","Parse sample log lines with grok rules and return the extracted fields",sA,r)}var oC=require("node:child_process"),iC=require("node:fs"),aC=require("node:os"),xp=require("node:path");var ao=require("node:fs");function es(e,r){let n=`${e}.tmp.${process.pid}`;(0,ao.writeFileSync)(n,r),(0,ao.renameSync)(n,e)}function ts(e){try{return(0,ao.readFileSync)(e,"utf8")}catch(r){if(r.code==="ENOENT")return;throw r}}function rs(e,r){if(r===void 0)return;let n=`${e}.bak.${new Date().toISOString().replaceAll(":","-")}`;return(0,ao.writeFileSync)(n,r),n}function so(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Md="tsuga-dev/agent-plugins",Op="tsuga";function Ap(e,r){q(` $ ${e} ${r.join(" ")}`);try{(0,oC.execFileSync)(e,r,{stdio:["ignore","inherit","inherit"]})}catch(n){let o=n.status??1;throw new Error(`${e} ${r.join(" ")} exited ${o}`,{cause:n})}}function mH(e,r){q("Claude Code \u2192 installing Tsuga plugin"),Ap("claude",["plugin","marketplace","add",Md]),Ap("claude",["plugin","install",`tsuga@${Op}`]),r.autoUpdate&&dH(e)}function dH(e){let r=(0,xp.join)(e,".claude","settings.json");q(`Claude Code \u2192 ${r} (autoUpdate)`),(0,iC.mkdirSync)((0,xp.dirname)(r),{recursive:!0});let n=ts(r),o=JSON.parse(n??"{}");if(!so(o))throw new Error(`${r} must contain a JSON object`);let i=o.extraKnownMarketplaces??{};if(!so(i))throw new Error(`${r} "extraKnownMarketplaces" must be a JSON object`);let a=i[Op],c=so(a)?a:{};o.extraKnownMarketplaces={...i,[Op]:{source:{source:"github",repo:Md},...c,autoUpdate:!0}};let l=rs(r,n);es(r,`${JSON.stringify(o,null,2)}
|
|
139
|
+
`),q(l===void 0?" created":` patched (backup: ${l})`)}function fH(){q("Codex \u2192 installing Tsuga plugin"),Ap("codex",["plugin","marketplace","add",Md]),Ap("codex",["plugin","add",`tsuga@${Op}`])}function sC(e){let r=e.command("install").description("Install Tsuga plugins into local LLM CLIs").command("plugin").description("Install the Tsuga plugin into a specific LLM CLI");r.command("claude-code").description("Install the Tsuga plugin into Claude Code (requires the claude CLI in PATH)").option("--no-auto-update","Skip patching ~/.claude/settings.json with autoUpdate=true").action(n=>{mH((0,aC.homedir)(),n),q("Restart your claude session to load the new plugins.")}),r.command("codex").description("Install the Tsuga plugin into Codex (requires the codex CLI in PATH)").action(()=>{fH(),q("Restart your codex session to load the new plugins.")})}var Qt="/v0/kubernetes-explorer",gH="^[a-z0-9.-]+$",yH="^[A-Za-z0-9._-]+$",cC=256,pC=t.Optional(p({allowEmpty:!1,description:"Tsuga cluster ID to target. Tsuga assigns it when a cluster is connected to the organization. Optional for single-cluster organizations and required for organizations with multiple clusters to scope the request to one cluster."}));var dr=e=>t.Optional(t.Array(p({allowEmpty:!1}),{description:e})),uC={clusterId:pC,search:t.Optional(t.String({pattern:gH,minLength:1,maxLength:cC,description:"Substring matched against the resource name. Kubernetes names are lowercase RFC 1123, so only lowercase letters, digits, `.` and `-` are accepted; uppercase and other characters are rejected. Wildcard and other query-syntax characters are treated literally."}))},lC={clusterId:pC,search:t.Optional(t.String({pattern:yH,minLength:1,maxLength:cC,description:"Substring matched against the Kubernetes cluster name. Unlike Kubernetes resource names this is a collector-assigned identifier, so uppercase letters, digits, `.`, `-` and `_` are accepted. Wildcard and other query-syntax characters are treated literally."}))},mC=t.Object(uC),dC=t.Object(lC),ns={...uC,includeInternalNamespaces:t.Optional(t.Boolean({description:"When false or omitted, resources in internal namespaces (kube-system, kube-public, kube-node-lease, local-path-storage, gke-managed-*) are excluded."})),clusters:dr("Restrict results to these Kubernetes cluster names."),namespaces:dr("Restrict results to these namespaces."),teams:dr("Restrict results to these team names."),envs:dr("Restrict results to these environments."),...de},fC=["Pending","Running","Succeeded","Failed","Unknown","CrashLoopBackOff","Error"],hH={...ns,nodes:dr("Restrict results to pods scheduled on these nodes."),deployments:dr("Restrict results to pods owned by these Deployments."),statefulsets:dr("Restrict results to pods owned by these StatefulSets."),daemonsets:dr("Restrict results to pods owned by these DaemonSets."),podStatus:t.Optional(t.Array(t.Enum(fC),{description:"Restrict results to pods whose resolved status matches any of these values. Includes the five Kubernetes phases plus Tsuga-derived CrashLoopBackOff and Error. Applied after stitching pod phase and container status reason telemetry, because phase is not a filterable metric attribute."}))},mi=t.Enum(["asc","desc"],{description:"Sort direction. Defaults to ascending."}),TH=["deployment","statefulset","daemonset"],gC=t.Object({kind:t.Enum(TH,{description:"Kind of Kubernetes workload associated with the pod. Derived from workload attributes in pod telemetry."}),name:t.String({description:"Name of the workload associated with the pod. Derived from workload attributes in pod telemetry."})},{description:"Kubernetes workload controller that owns the pod. Present when workload attributes are observed in pod telemetry."}),yC=t.Object({podName:t.String({description:"Name of the Kubernetes pod. Set when the pod is created."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the pod. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that reported the pod. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the pod. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the pod, such as production or staging. Present when an environment label or mapping is observed."})),node:t.Optional(t.String({description:"Kubernetes node currently or most recently running the pod. Present when node telemetry is observed."})),phase:t.Enum(fC,{description:"Current or most recently observed pod status. From pod status and container state telemetry. Values include the Kubernetes phases Pending, Running, Succeeded, Failed, and Unknown, plus Tsuga-derived CrashLoopBackOff and Error values."}),readyContainers:t.Integer({description:"Number of containers in the pod that are currently ready. From container readiness telemetry. Zero or greater."}),totalContainers:t.Integer({description:"Number of observed containers for the pod based on container readiness telemetry. Zero or greater."}),restarts:t.Integer({description:"Total restart count across containers in the pod. From container restart telemetry. Zero or greater."}),createdAt:t.Optional(E({description:"Timestamp from pod start time telemetry for the selected pod instance. Present when pod start time telemetry is observed."}))}),Dd=t.Object({...yC.properties,workload:t.Optional(gC),cpuUsageMilli:t.Optional(t.Number({description:"Recent pod CPU usage in millicores. Present when CPU usage telemetry is observed."})),cpuLimitMilli:t.Optional(t.Number({description:"Configured pod CPU limit in millicores, summed across observed containers. Present when a CPU limit is configured and observed."})),cpuRequestMilli:t.Optional(t.Number({description:"Configured pod CPU request in millicores, summed across observed containers. Present when a CPU request is configured and observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent pod memory usage in bytes. Present when memory usage telemetry is observed."})),memoryLimitBytes:t.Optional(t.Number({description:"Configured pod memory limit in bytes, summed across observed containers. Present when a memory limit is configured and observed."})),memoryRequestBytes:t.Optional(t.Number({description:"Configured pod memory request in bytes, summed across observed containers. Present when a memory request is configured and observed."})),cpuUtilization:t.Optional(t.Number({description:"Recent CPU usage divided by the configured CPU limit. Present when both usage and limit are observed."})),memoryUtilization:t.Optional(t.Number({description:"Recent memory usage divided by the configured memory limit. Present when both usage and limit are observed."})),cpuRequestUtilization:t.Optional(t.Number({description:"Recent CPU usage divided by the configured CPU request. Present when both usage and request are observed."})),memoryRequestUtilization:t.Optional(t.Number({description:"Recent memory usage divided by the configured memory request. Present when both usage and request are observed."}))}),EH=["podName","namespace","cluster","team","env","node","phase","restarts","cpuUsageMilli","cpuUtilization","cpuRequestUtilization","memoryUsageBytes","memoryUtilization","memoryRequestUtilization","createdAt"],_4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/pods`,query:t.Object({...hH,sortBy:t.Optional(t.Enum(EH,{description:"Field to sort pods by."})),sortDirection:t.Optional(mi)}),paginated:!0,response:t.Array(Dd)}),Gd=t.Object({cluster:t.String({description:"Kubernetes cluster name from cluster telemetry."}),teams:t.Optional(t.Array(t.String(),{description:"Team metadata values observed on pods in non-default Kubernetes namespaces on the cluster. Present when team labels or mappings are observed."})),envs:t.Optional(t.Array(t.String(),{description:"Environment metadata values observed on pods in non-default Kubernetes namespaces on the cluster. Present when environment labels or mappings are observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Aggregate recent CPU usage for observed pods in the cluster, excluding default Kubernetes namespaces, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Aggregate recent memory usage for observed pods in the cluster, excluding default Kubernetes namespaces, in bytes. Present when memory usage telemetry is observed."})),readyNodes:t.Optional(t.Integer({description:"Number of Kubernetes nodes in the cluster that are ready. Present when node readiness telemetry is observed."})),podPhaseCounts:t.Optional(t.Object({Pending:t.Integer({description:"Number of observed pods currently in the Pending phase."}),Running:t.Integer({description:"Number of observed pods currently in the Running phase."}),Succeeded:t.Integer({description:"Number of observed pods currently in the Succeeded phase."}),Failed:t.Integer({description:"Number of observed pods currently in the Failed phase."}),Unknown:t.Integer({description:"Number of observed pods currently in the Unknown phase."})},{description:"Counts of observed pods by Kubernetes phase, excluding default Kubernetes namespaces. Present when pod phase telemetry is observed."}))}),_H=["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes"],I4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/clusters`,query:t.Object({...lC,teams:dr("Restrict to clusters that host workloads from these team names."),envs:dr("Restrict to clusters that host workloads in these environments."),sortBy:t.Optional(t.Enum(_H,{description:"Field to sort clusters by."})),sortDirection:t.Optional(mi),...de}),paginated:!0,response:t.Array(Gd)}),$d=t.Object({namespace:t.String({description:"Kubernetes namespace name from namespace telemetry. Includes namespaces with no observed pods when namespace telemetry is observed."}),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the namespace. Present when cluster telemetry is observed."})),teams:t.Optional(t.Array(t.String(),{description:"Team metadata values observed in workloads in the namespace. Present when team labels or mappings are observed."})),envs:t.Optional(t.Array(t.String(),{description:"Environment metadata values observed in workloads in the namespace. Present when environment labels or mappings are observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods in the namespace. Present when pod telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Aggregate recent CPU usage for observed pods in the namespace, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Aggregate recent memory usage for observed pods in the namespace, in bytes. Present when memory usage telemetry is observed."}))}),IH=["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],b4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/namespaces`,query:t.Object({...ns,sortBy:t.Optional(t.Enum(IH,{description:"Field to sort namespaces by."})),sortDirection:t.Optional(mi)}),paginated:!0,response:t.Array($d)}),jd=t.Object({deployment:t.String({description:"Kubernetes Deployment name from workload telemetry."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the Deployment. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the Deployment. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the Deployment. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the Deployment. Present when an environment label or mapping is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods associated with the Deployment. Present when pod telemetry and workload attributes are observed."})),availableReplicas:t.Optional(t.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:t.Optional(t.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent aggregate CPU usage for observed Deployment pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent aggregate memory usage for observed Deployment pods, in bytes. Present when memory usage telemetry is observed."}))}),bH=["deployment","namespace","cluster","team","env","pods","availableReplicas","cpuUsageMilli","memoryUsageBytes"],S4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/deployments`,query:t.Object({...ns,sortBy:t.Optional(t.Enum(bH,{description:"Field to sort deployments by."})),sortDirection:t.Optional(mi)}),paginated:!0,response:t.Array(jd)}),Bd=t.Object({statefulSet:t.String({description:"Kubernetes StatefulSet name from workload telemetry."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the StatefulSet. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the StatefulSet. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the StatefulSet. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the StatefulSet. Present when an environment label or mapping is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods associated with the StatefulSet. Present when pod telemetry and workload attributes are observed."})),readyReplicas:t.Optional(t.Integer({description:"Number of ready StatefulSet replicas from StatefulSet status telemetry. Present when StatefulSet status is observed."})),desiredReplicas:t.Optional(t.Integer({description:"Desired replica count configured for the StatefulSet. Present when StatefulSet spec telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent aggregate CPU usage for observed StatefulSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent aggregate memory usage for observed StatefulSet pods, in bytes. Present when memory usage telemetry is observed."}))}),SH=["statefulSet","namespace","cluster","team","env","pods","cpuUsageMilli","memoryUsageBytes"],O4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/statefulsets`,query:t.Object({...ns,sortBy:t.Optional(t.Enum(SH,{description:"Field to sort StatefulSets by."})),sortDirection:t.Optional(mi)}),paginated:!0,response:t.Array(Bd)}),qd=t.Object({daemonSet:t.String({description:"Kubernetes DaemonSet name from workload telemetry."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the DaemonSet. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the DaemonSet. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the DaemonSet. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the DaemonSet. Present when an environment label or mapping is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods associated with the DaemonSet. Present when pod telemetry and workload attributes are observed."})),readyNodes:t.Optional(t.Integer({description:"Number of eligible nodes with a ready DaemonSet pod. Present when DaemonSet status telemetry is observed."})),desiredNodes:t.Optional(t.Integer({description:"Number of eligible nodes where the DaemonSet should run a pod. Present when DaemonSet status telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent aggregate CPU usage for observed DaemonSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent aggregate memory usage for observed DaemonSet pods, in bytes. Present when memory usage telemetry is observed."}))}),OH=["daemonSet","namespace","cluster","team","env","pods","readyNodes","cpuUsageMilli","memoryUsageBytes"],A4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/daemonsets`,query:t.Object({...ns,sortBy:t.Optional(t.Enum(OH,{description:"Field to sort DaemonSets by."})),sortDirection:t.Optional(mi)}),paginated:!0,response:t.Array(qd)}),Fd=t.Object({overview:t.Object({...yC.properties,workload:t.Optional(gC)},{description:"Pod identity, status, and owning workload, derived from recent pod metrics."}),healthMetrics:t.Object({cpu:t.Object({usage:t.String({description:"Metric name callers can use to query pod CPU usage. This is not the current CPU value."}),limit:t.String({description:"Metric name callers can use to query configured container CPU limits for the pod. This is not the current CPU limit value."}),request:t.String({description:"Metric name callers can use to query configured container CPU requests for the pod. This is not the current CPU request value."})},{description:"Metric names for pod CPU usage and for configured container CPU limits and requests."}),memory:t.Object({usage:t.String({description:"Metric name callers can use to query pod memory usage. This is not the current memory value."}),limit:t.String({description:"Metric name callers can use to query configured container memory limits for the pod. This is not the current memory limit value."}),request:t.String({description:"Metric name callers can use to query configured container memory requests for the pod. This is not the current memory request value."})},{description:"Metric names for pod memory usage and for configured container memory limits and requests."})},{description:"Metric names callers can use to query pod CPU and memory telemetry. These are fixed metric identifiers, not current values."}),searchFilters:t.Object({logs:t.String({description:"TQL log search filter scoped to this pod. Built from cluster, namespace, and pod identifiers."}),traces:t.String({description:"TQL trace search filter scoped to this pod. Built from cluster, namespace, and pod identifiers."})},{description:"TQL filters scoped to this pod, ready to use as the query for log and trace search."})}),hC=t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),podName:p({allowEmpty:!1})}),x4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/pod-details`,query:hC,response:Fd}),Hd=t.Object({configuration:t.Optional(t.Object({spec:t.Record(t.String(),t.Unknown(),{description:"Kubernetes PodSpec from the latest observed pod manifest. Fields outside `object.spec` are stripped."}),lastObservedAt:E({description:"Timestamp when Tsuga last observed the pod manifest used for configuration."})},{description:"Pod configuration from the latest observed pod manifest. Present when a pod manifest log is found for the pod."})),labels:t.Record(t.String(),t.String(),{description:"Kubernetes labels on the pod from the latest observed pod manifest. Key-value strings."}),annotations:t.Record(t.String(),t.String(),{description:"Kubernetes annotations on the pod from the latest observed pod manifest. Key-value strings."}),deletedAt:t.Optional(E({description:"Timestamp when Tsuga last observed the pod deletion event. Present when the latest observed pod event is deleted."}))}),R4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/pod-manifest`,query:hC,response:Hd}),Kd=t.Object({podName:t.String({description:"Name of a pod instance associated with the workload. Resolved from recent pod usage telemetry and workload attributes."}),podUid:t.Optional(t.String({description:"Kubernetes UID for the pod replica. Present when UID telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent CPU usage for the pod replica, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent memory usage for the pod replica, in bytes. Present when memory usage telemetry is observed."}))},{description:"A single pod instance with recent CPU or memory telemetry for the workload, resolved from pod usage telemetry and workload attributes."}),zd=t.Object({overview:t.Object({deploymentName:t.String({description:"Kubernetes Deployment name for this detail response."}),namespace:t.Optional(t.String({description:"Kubernetes namespace for this detail response. Present when any deployment signal is found."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name for this detail response. Present when any deployment signal is found."})),team:t.Optional(t.String({description:"Team metadata from the Deployment available-replica metric. Present when the metric includes team metadata."})),env:t.Optional(t.String({description:"Environment metadata from the Deployment available-replica metric. Present when the metric includes environment metadata."})),availableReplicas:t.Optional(t.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:t.Optional(t.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),latestRevisionAt:t.Optional(E({description:"Latest ReplicaSet metadata.creationTimestamp observed for the Deployment. Present when ReplicaSet object telemetry is observed."}))}),podReplicas:t.Array(Kd,{description:"Pod instances with recent CPU or memory telemetry for the Deployment. Tsuga builds this list from pod usage telemetry and workload attributes. Empty when no matching pod usage telemetry is observed."}),revisions:t.Array(t.Object({replicaSetName:t.String({description:"ReplicaSet name for a Deployment revision from workload telemetry."}),revision:t.Integer({description:"Deployment revision number from ReplicaSet annotations. Integer greater than or equal to zero."}),firstSeen:t.Optional(E({description:"ReplicaSet metadata.creationTimestamp from the latest observed ReplicaSet object. Present when creation time is observed."})),observedGeneration:t.Optional(t.Integer({description:"Latest generation observed for the ReplicaSet revision. Present when generation telemetry is observed."})),readyReplicas:t.Optional(t.Integer({description:"Number of ready replicas for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),replicas:t.Optional(t.Integer({description:"Total replica count for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),logsSearchFilter:t.String({description:"TQL log search filter scoped to this ReplicaSet revision. Built from cluster, namespace, and ReplicaSet identifiers."})}),{description:"Deployment rollout revisions from recent ReplicaSet object telemetry. Includes the latest observed event per ReplicaSet, excludes ReplicaSets whose latest observed spec.replicas is 0, and returns up to 8 revisions sorted by revision number descending."})}),C4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/deployment-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),deploymentName:p({allowEmpty:!1})}),response:zd}),AH=t.Object({overview:t.Object({statefulSetName:t.String(),namespace:t.Optional(t.String()),cluster:t.Optional(t.String()),team:t.Optional(t.String()),env:t.Optional(t.String()),readyReplicas:t.Optional(t.Integer()),desiredReplicas:t.Optional(t.Integer()),latestRevisionAt:t.Optional(E())}),podReplicas:t.Array(Kd,{description:"Pod instances with recent CPU or memory telemetry for the StatefulSet. Tsuga builds this list from pod usage telemetry and workload attributes. Empty when no matching pod usage telemetry is observed."}),revisions:t.Array(t.Object({revisionName:t.String(),firstSeen:t.Optional(E())}))}),P4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/statefulset-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),statefulSetName:p({allowEmpty:!1})}),response:AH}),xH=t.Object({overview:t.Object({daemonSetName:t.String(),namespace:t.Optional(t.String()),cluster:t.Optional(t.String()),team:t.Optional(t.String()),env:t.Optional(t.String()),readyNodes:t.Optional(t.Integer()),desiredNodes:t.Optional(t.Integer()),latestRevisionAt:t.Optional(E())}),podReplicas:t.Array(Kd,{description:"Pod instances with recent CPU or memory telemetry for the DaemonSet. Tsuga builds this list from pod usage telemetry and workload attributes. Empty when no matching pod usage telemetry is observed."}),revisions:t.Array(t.Object({observedGeneration:t.Integer(),firstSeen:t.Optional(E())}))}),U4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/daemonset-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),daemonSetName:p({allowEmpty:!1})}),response:xH});var vr=`/${"v1"}/kubernetes-explorer`,TC=t.Pick(Dd,["podName","namespace","cluster","team","env","node","phase","readyContainers","totalContainers","restarts","createdAt","workload","cpuUsageMilli","cpuLimitMilli","memoryUsageBytes","memoryLimitBytes","cpuUtilization","memoryUtilization"],{description:"A Kubernetes pod with its current phase, owning workload, and resource usage."}),RH={podName:"api-gateway-7d9f8c6b5-2xk4p",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",node:"ip-10-0-1-23.ec2.internal",phase:"Running",readyContainers:1,totalContainers:1,restarts:0,createdAt:"2024-01-15T12:34:56.000Z",workload:{kind:"deployment",name:"api-gateway"},cpuUsageMilli:125,cpuLimitMilli:500,memoryUsageBytes:134217728,memoryLimitBytes:536870912,cpuUtilization:.25,memoryUtilization:.25};Object.assign(TC,{examples:[RH]});var EC=t.Pick(Gd,["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes","podPhaseCounts"],{description:"A Kubernetes cluster with aggregate resource usage, node readiness, and pod phase counts."}),CH={cluster:"prod-us-east",teams:["platform","payments"],envs:["production"],cpuUsageMilli:4200,memoryUsageBytes:8589934592,readyNodes:6,podPhaseCounts:{Pending:1,Running:42,Succeeded:3,Failed:0,Unknown:0}};Object.assign(EC,{examples:[CH]});var _C=t.Pick($d,["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes namespace with pod count and aggregate resource usage."}),PH={namespace:"production",cluster:"prod-us-east",teams:["platform"],envs:["production"],pods:24,cpuUsageMilli:1800,memoryUsageBytes:3221225472};Object.assign(_C,{examples:[PH]});var IC=t.Pick(jd,["deployment","namespace","cluster","team","env","pods","availableReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes deployment with replica counts and aggregate resource usage."}),UH={deployment:"api-gateway",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,availableReplicas:3,desiredReplicas:3,cpuUsageMilli:375,memoryUsageBytes:402653184};Object.assign(IC,{examples:[UH]});var bC=t.Pick(Bd,["statefulSet","namespace","cluster","team","env","pods","readyReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes StatefulSet with replica counts and aggregate resource usage."}),wH={statefulSet:"postgres",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,readyReplicas:3,desiredReplicas:3,cpuUsageMilli:900,memoryUsageBytes:2147483648};Object.assign(bC,{examples:[wH]});var SC=t.Pick(qd,["daemonSet","namespace","cluster","team","env","pods","readyNodes","desiredNodes","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes DaemonSet with eligible-node readiness and aggregate resource usage."}),NH={daemonSet:"otel-collector",namespace:"observability",cluster:"prod-us-east",team:"platform",env:"production",pods:6,readyNodes:6,desiredNodes:6,cpuUsageMilli:300,memoryUsageBytes:805306368};Object.assign(SC,{examples:[NH]});var OC=t.Pick(Fd,["overview","healthMetrics","searchFilters"],{description:"Metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and log/trace filters."}),LH={overview:{podName:"api-gateway-7d9f8c6b5-2xk4p",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",node:"ip-10-0-1-23.ec2.internal",phase:"Running",readyContainers:1,totalContainers:1,restarts:0,createdAt:"2024-01-15T12:34:56.000Z",workload:{kind:"deployment",name:"api-gateway"}},healthMetrics:{cpu:{usage:"k8s.pod.cpu.usage",limit:"k8s.container.cpu_limit",request:"k8s.container.cpu_request"},memory:{usage:"k8s.pod.memory.usage",limit:"k8s.container.memory_limit",request:"k8s.container.memory_request"}},searchFilters:{logs:'context.k8s.cluster.name:"prod-us-east" AND context.k8s.namespace.name:"production" AND context.k8s.pod.name:"api-gateway-7d9f8c6b5-2xk4p"',traces:'context.k8s.cluster.name:"prod-us-east" AND context.k8s.namespace.name:"production" AND context.k8s.pod.name:"api-gateway-7d9f8c6b5-2xk4p"'}};Object.assign(OC,{examples:[LH]});var AC=t.Pick(Hd,["configuration","labels","annotations","deletedAt"],{description:"Manifest-derived details for a single Kubernetes pod: the pod manifest spec, labels, and annotations from the pod's most recently observed manifest."}),vH={configuration:{spec:{restartPolicy:"Always",serviceAccountName:"api-gateway"},lastObservedAt:"2024-01-15T12:30:00.000Z"},labels:{app:"api-gateway","pod-template-hash":"7d9f8c6b5"},annotations:{"prometheus.io/scrape":"true"}};Object.assign(AC,{examples:[vH]});var xC=t.Pick(zd,["overview","podReplicas","revisions"],{description:"Detailed information for a single Kubernetes deployment: replica status, backing pods, and rollout revisions."}),kH={overview:{deploymentName:"api-gateway",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",availableReplicas:3,desiredReplicas:3,latestRevisionAt:"2024-01-15T12:00:00.000Z"},podReplicas:[{podName:"api-gateway-7d9f8c6b5-2xk4p",podUid:"a1b2c3d4-e5f6-7890-abcd-ef1234567890",cpuUsageMilli:125,memoryUsageBytes:134217728}],revisions:[{replicaSetName:"api-gateway-7d9f8c6b5",revision:7,firstSeen:"2024-01-15T12:00:00.000Z",observedGeneration:7,readyReplicas:3,replicas:3,logsSearchFilter:'context.k8s.cluster.name:"prod-us-east" context.k8s.namespace.name:"production" context.k8s.replicaset.name:"api-gateway-7d9f8c6b5"'}]};Object.assign(xC,{examples:[kH]});var RC=t.Object({clusterId:t.Optional(p({allowEmpty:!1,description:"Tsuga cluster ID to target. Tsuga assigns it when a cluster is connected to the organization. Optional for single-cluster organizations and required for organizations with multiple clusters to scope the request to one cluster."}))}),os=t.Pick(mC,["clusterId","search"]),MH=t.Pick(dC,["clusterId","search"]),CC=m({description:"Lists Kubernetes pods observed across the organization with their current phase, owning workload, and resource usage.",operationId:"listKubernetesPods",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/pods`,query:os,response:t.Array(TC)}),PC=m({description:"Lists Kubernetes clusters observed across the organization with aggregate resource usage, node readiness, and pod phase counts.",operationId:"listKubernetesClusters",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/clusters`,query:MH,response:t.Array(EC)}),UC=m({description:"Lists Kubernetes namespaces observed across the organization with pod counts and aggregate resource usage.",operationId:"listKubernetesNamespaces",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/namespaces`,query:os,response:t.Array(_C)}),wC=m({description:"Lists Kubernetes deployments observed across the organization with replica counts and aggregate resource usage.",operationId:"listKubernetesDeployments",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/deployments`,query:os,response:t.Array(IC)}),NC=m({description:"Lists Kubernetes StatefulSets observed across the organization with replica counts and aggregate resource usage.",operationId:"listKubernetesStatefulSets",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/statefulsets`,query:os,response:t.Array(bC)}),LC=m({description:"Lists Kubernetes DaemonSets observed across the organization with eligible-node readiness and aggregate resource usage.",operationId:"listKubernetesDaemonSets",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/daemonsets`,query:os,response:t.Array(SC)}),vC=t.Object({...RC.properties,k8sCluster:p({allowEmpty:!1,description:"Kubernetes cluster name that contains the pod. From cluster telemetry. Required to identify the pod because pod names are only unique within a namespace and cluster."}),k8sNamespace:p({allowEmpty:!1,description:"Kubernetes namespace that contains the pod. From pod metadata. Required to identify the pod because pod names are only unique within a namespace and cluster."}),podName:p({allowEmpty:!1,description:"Kubernetes pod name to retrieve. Set when the pod is created. Required to fetch pod details for the selected cluster and namespace."})}),kC=m({description:"Retrieves metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and ready-to-use log and trace filters. Manifest configuration, labels, and annotations are served by the pod-manifest endpoint.",operationId:"getKubernetesPodDetails",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/pod-details`,query:vC,response:OC}),MC=m({description:"Retrieves the manifest-derived details for a single Kubernetes pod: the pod manifest spec, labels, and annotations from the pod's most recently observed manifest.",operationId:"getKubernetesPodManifest",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/pod-manifest`,query:vC,response:AC}),DC=m({description:"Retrieves detailed information for a single Kubernetes deployment: replica status, backing pods, and rollout revisions with ready-to-use log filters.",operationId:"getKubernetesDeploymentDetails",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/deployment-details`,query:t.Object({...RC.properties,k8sCluster:p({allowEmpty:!1,description:"Kubernetes cluster name that contains the Deployment. From cluster telemetry. Required to identify the Deployment because names are only unique within a namespace and cluster."}),k8sNamespace:p({allowEmpty:!1,description:"Kubernetes namespace that contains the Deployment. From workload metadata. Required to identify the Deployment because names are only unique within a namespace and cluster."}),deploymentName:p({allowEmpty:!1,description:"Kubernetes Deployment name to retrieve. From workload telemetry. Required to fetch deployment details for the selected cluster and namespace."})}),response:xC});var DH="clusterId";function GC(e,r,n){let o=r.query.properties??{},i=Object.keys(o).filter(a=>a!==DH);for(let a of i){let c=a.replace(/([A-Z])/g,"-$1").toLowerCase(),l=c.replace(/-/g,"_").toUpperCase(),d=o[a]?.description??"";n?e.requiredOption(`--${c} <${l}>`,d):e.option(`--${c} <${l}>`,d)}return i}function di(e,r,n,o){let i=e.command(r).description(n.description??`List Kubernetes ${r}`),a=GC(i,n,!1);i.action(async c=>{let l={};for(let d of a)c[d]!==void 0&&(l[d]=c[d]);Q(Object.keys(l).length>0?await o()(n,{query:l}):await o()(n))})}function Yd(e,r,n,o){let i=e.command(r).description(n.description??`Get Kubernetes ${r}`),a=GC(i,n,!0);i.action(async c=>{let l={};for(let d of a)l[d]=c[d];Q(await o()(n,{query:l}))})}function $C(e,r){let n=e.command("kubernetes").description("Explore Kubernetes resources observed across the organization");di(n,"pods",CC,r),di(n,"clusters",PC,r),di(n,"namespaces",UC,r),di(n,"deployments",wC,r),di(n,"statefulsets",NC,r),di(n,"daemonsets",LC,r),Yd(n,"pod-details",kC,r),Yd(n,"pod-manifest",MC,r),Yd(n,"deployment-details",DC,r)}var GH=t.Union([t.Literal("scalar"),t.Literal("timeseries")]),$H="/v0/promql",Rp=t.Object({query:p({type:"long",allowEmpty:!1,description:"PromQL expression to evaluate."}),timeRange:Vo,step:p({allowEmpty:!1,description:"Evaluation step interval (e.g. `1m`, `5m`, `1h`). Must be a valid Prometheus duration string."}),returnType:t.Optional(GH),executionOptions:xl,shouldStreamResults:t.Optional(t.Boolean()),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster to target. Defaults to the first cluster created in the organization when omitted."}))}),jH={query:'rate({"otel.trace.span_processor.spans"}[5m])',timeRange:{from:17822015e5,to:17822034e5},step:"1m",executionOptions:{parallelism:1,engine:"q"},clusterId:"cluster-abc"};Object.assign(Rp,{examples:[jH]});var Y4e=m({tags:["promql"],url:$H,method:"POST",body:Rp,response:ep});var jC=`/${"v1"}/aggregation`,BC=t.Object({id:t.String({description:"Result identifier. Query results use `q1`, `q2`, and so on; formula results use `formula`."}),group:t.Record(t.String(),t.Union([t.String(),t.Number()]),{description:"Group-by field values for this result. Empty when no group-by is requested."})}),qC=t.Object({results:t.Array(t.Object({...BC.properties,value:t.Number({description:"Aggregated value for this query or formula and group, over the full time range."})},{title:"ScalarResult"}),{description:"One aggregated value per query or formula and group."})},{$id:"ScalarAggregationResponse",title:"ScalarAggregationResponse",description:"Scalar aggregation response with one value per query or formula and group."}),BH={results:[{id:"q1",group:{host:"server-1"},value:123.45}]};Object.assign(qC,{examples:[BH]});var Cp=t.Object({series:t.Array(t.Object({...BC.properties,points:t.Array(t.Object({timestamp:t.Integer({description:"Unix timestamp in milliseconds for this point, spaced by `aggregationWindow`."}),value:t.Number({description:"Aggregated value at this timestamp."})}),{description:"Ordered data points for this query or formula and group."})},{title:"Series"}),{description:"One time series per query or formula and group."})},{$id:"TimeseriesAggregationResponse",title:"TimeseriesAggregationResponse",description:"Timeseries aggregation response with timestamped points over time."}),qH={series:[{id:"q1",group:{host:"server-1"},points:[{timestamp:16094592e5,value:123.45},{timestamp:160945926e4,value:456.78}]}]};Object.assign(Cp,{examples:[qH]});var FH=t.Omit(va.items,["fill"],{title:"AggregationQuery",description:"Aggregation query. Omit `filter` for an unfiltered query and omit `functions` when no post-processing is needed."}),HH=t.Optional(Ar),FC={timeRange:mt,queries:t.Array(FH,{maxItems:op,description:`Aggregations that may be combined together in the same query. Each item is referenced from \`formula\` as q1, q2, and so on, in submission order. Limited to ${op} items. For dataSource "metrics", each aggregate's \`field\` is the metric name, not an attribute; to count distinct values of an attribute use unique-count with field "<metricName>.context.<attribute>" (e.g. "system.cpu.utilization.context.host.name").`}),groupBy:HH,dataSource:zS,formula:t.Optional(Hn)},HC=t.Object({clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),KC=t.Object(FC,{description:"Scalar aggregation request. Provide a time range, one or more queries, a telemetry data source, and optional grouping or formula. Omit `groupBy` for ungrouped results. Send `clusterId` as a query parameter, not in the JSON body."}),KH={timeRange:{from:1782201500,to:1782203400},dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(KC,{examples:[KH]});var zC=m({description:"Runs one or more aggregation queries over logs, metrics, or traces and returns scalar values. Use optional group-by and formula fields to compute grouped or derived results. See [Analytics queries](/documentation/visualize/analytics/queries).",operationId:"aggregateScalar",tags:["public","aggregation"],url:`${jC}/multi-query/scalar`,method:"POST",body:KC,query:HC,response:qC}),YC=t.Object({...FC,aggregationWindow:p({description:"Time bucket size for timeseries aggregation, such as `10s`, `1m`, or `1h`."})},{description:"Timeseries aggregation request. Provide a time range, bucket size, one or more queries, a telemetry data source, and optional grouping or formula. Omit `groupBy` for ungrouped series. Send `clusterId` as a query parameter, not in the JSON body."}),zH={timeRange:{from:1782201500,to:1782203400},aggregationWindow:"1m",dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(YC,{examples:[zH]});var VC=m({description:"Runs one or more aggregation queries over logs, metrics, or traces and returns timestamped series. Use `aggregationWindow` to choose the time bucket size. See [Analytics queries](/documentation/visualize/analytics/queries).",operationId:"aggregateTimeseries",tags:["public","aggregation"],url:`${jC}/multi-query/timeseries`,method:"POST",body:YC,query:HC,response:Cp});var YH=`/${"v1"}/promql`,VH=t.Object({...t.Pick(Rp,["query","step"]).properties,timeRange:mt},{description:"PromQL range-query request. Send clusterId as a query parameter, not in this JSON body.",examples:[{query:'sum by ("context.service.name") (sum_over_time({"traces.span.metrics.calls", "span.kind"="SPAN_KIND_SERVER"}[5m]))',timeRange:{from:1782201500,to:1782203400},step:"1m"}]}),QH=t.Object({clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to query. Set by the client as the clusterId query parameter, not in the JSON body. Required when the organization has multiple clusters; omit only for single-cluster organizations. Unknown cluster IDs return 404."}))}),QC=m({description:"Runs a PromQL range query over Tsuga metric data and returns timeseries results. Authenticate with a bearer operation API key or OAuth access token that can read metrics. Send clusterId as a query parameter; multi-cluster organizations must provide it. See [How to write PromQL queries](/documentation/visualize/guides/how-to-write-promql-queries) for query syntax and examples.",operationId:"queryPromql",tags:["public","promql"],url:YH,method:"POST",body:VH,query:QH,response:Cp});function WC(e,r){let n=e.command("promql").description("Run PromQL queries over metric data");io(n,"query","Run a PromQL range query over metric data",QC,r)}var gi="/v0/dashboard-folders",yi=t.Object({id:t.String({description:"Tsuga-generated dashboard folder ID assigned when the folder is created. Use it as dashboard `folderId` or child-folder `parentFolderId`."}),name:t.String({description:"Display name of the dashboard folder. Set by the caller on create or update."}),owner:t.String({description:"ID of the team that owns the dashboard folder. Set by the caller on create or update and used for folder access control."}),parentFolderId:t.Optional(t.String({description:"ID of the top-level parent folder when this folder is nested. Set by the caller on create or update. Returned only for child folders; omitted for top-level folders."})),tags:Re,creator:t.Optional(ae),updater:t.Optional(ae),createdAt:E(),updatedAt:E()},{title:"DashboardFolder"}),Vd=t.Object({...yi.properties,dashboardCount:t.Number({description:"Number of dashboards directly assigned to this folder that the caller can read. Returned only by folder list responses; callers without dashboard read access see 0."})}),Pp=t.Object({name:p({allowEmpty:!1,description:"Display name of the dashboard folder. Required and non-empty."}),owner:p({allowEmpty:!1,description:"ID of the team that owns the dashboard folder. Required and used for folder access control."}),parentFolderId:t.Optional(t.Union([t.Null(),p({allowEmpty:!1})],{description:"ID of the top-level folder to nest this folder under. Omit on create or pass null to create a top-level folder; omit on update to keep the current parent; pass null on update to move the folder to top level. Non-null values must name a readable top-level folder. Folders can be nested at most two levels deep."})),tags:$e}),Up=t.Partial(t.Object({owners:xe(p({allowEmpty:!1}),{description:"Restrict results to dashboard folders owned by any of these team IDs",maxItems:50}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against dashboard folder names or folder IDs. Omit the whole `searchQuery` filter to skip text filtering."}),exclude:t.Optional(t.Boolean({description:"If true, exclude dashboard folders matching this value instead of including them"}))},{description:"Text filter for dashboard folder names or IDs. Optional; `exclude: true` returns folders whose name and ID do not match the substring."}),tags:xe(vt.items,{description:"Restrict results to dashboard folders that have at least one of the listed key/value tags",maxItems:50}),parentFolderId:t.Union([t.Null(),p({allowEmpty:!1})],{description:"Parent folder filter for dashboard folder query results. Optional; pass a folder ID to return the child folders nested directly under it, or null to return only top-level folders. Omit to return all folders."})},{description:"Optional filters applied to narrow the returned dashboard folders"})),fi={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",DASHBOARD_COUNT:"dashboardCount",UPDATED_AT:"updatedAt",NAME:"name"},Qd=[fi.OWNER,fi.TAGS,fi.DASHBOARD_COUNT,fi.UPDATED_AT,fi.NAME],WH=t.Partial(t.Object({...de,filters:Up,sort:t.Object({by:t.Enum([...Qd,fi.IS_FAVORITE],{description:"Field to sort the returned dashboard folders by"}),direction:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboard folders"})})),EYe=m({tags:["dashboard-folders"],url:`${gi}/query`,method:"POST",paginated:!0,body:WH,response:t.Array(Vd)}),_Ye=m({tags:["dashboard-folders"],url:`${gi}/:id`,method:"GET",params:t.Object({id:p()}),response:yi}),IYe=m({tags:["dashboard-folders"],url:gi,method:"POST",body:Pp,response:yi}),bYe=m({tags:["dashboard-folders"],url:`${gi}/:id`,method:"PUT",params:t.Object({id:p()}),body:Pp,response:yi}),SYe=m({tags:["dashboard-folders"],url:`${gi}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),OYe=m({tags:["dashboard-folders"],url:`${gi}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Omit(Up,["tags"]))}),response:Lt});var is=`/${"v1"}/dashboard-folders`,wp=t.Pick(yi,["id","name","owner","parentFolderId","tags"],{$id:"DashboardFolder",description:"Folder used to organize dashboards into a two-level hierarchy"}),ZC={id:"123-456-abc",name:"Platform",owner:"team-123-abc",tags:[{key:"team",value:"platform"}]};Object.assign(wp,{examples:[ZC]});var XC=t.Pick(Vd,["id","name","owner","parentFolderId","tags","dashboardCount"],{$id:"DashboardFolderWithDashboardCount",description:"Folder used to organize dashboards into a two-level hierarchy, including the number of readable dashboards it directly contains."}),ZH={...ZC,dashboardCount:10};Object.assign(XC,{examples:[ZH]});var Wd=t.Pick(Pp,["name","owner","parentFolderId","tags"],{description:"Dashboard folder create or update request. Provide a name, owner team, optional parent folder, and optional tags."}),XH={name:"Platform",owner:"team-123-abc",parentFolderId:null,tags:[{key:"team",value:"platform"}]};Object.assign(Wd,{examples:[XH]});var JH=t.Object({by:t.Enum(Qd,{description:"Field to sort the returned dashboard folders by: `owner` sorts by owning team name, `tags` sorts by tag key/value pairs, `dashboardCount` sorts by the number of readable dashboards directly in the folder, `updatedAt` sorts by last-updated timestamp, and `name` sorts alphabetically by folder name."}),direction:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboard folders"}),JC=t.Object({...De,filters:t.Optional(t.Pick(Up,["owners","searchQuery","tags","parentFolderId"])),sort:t.Optional(JH)},{description:"Dashboard folder query request. Use filters, sorting, limit, and offset to page through visible dashboard folders."}),e2={filters:{owners:{values:["team-123-abc"]},searchQuery:{value:"Platform"},tags:{values:[{key:"team",value:"platform"}]}},sort:{by:"name",direction:"asc"},limit:10,offset:0};Object.assign(JC,{examples:[e2]});var eP=m({description:"Queries dashboard folders visible to the authenticated operation key. Returns all folders unless the `parentFolderId` filter is set: pass a folder ID to select the children of that folder, or null to return only top-level folders. Results are ordered by most recently updated folder first unless `sort` is set, and include the number of readable dashboards directly assigned to each folder. Use filters to narrow by owning team, name or ID substring, or tags.",operationId:"queryDashboardFolders",tags:["dashboard-folders"],url:`${is}/query`,method:"POST",paginated:!0,body:JC,response:t.Array(XC)}),tP=m({description:"Retrieves one dashboard folder by ID.",operationId:"getDashboardFolder",tags:["dashboard-folders"],url:`${is}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard folder to retrieve. Use the `id` returned by folder list, get, create, or update responses."})}),response:wp}),rP=m({description:"Creates a dashboard folder owned by the specified team. To create a child folder, set `parentFolderId` to a readable top-level folder.",operationId:"createDashboardFolder",tags:["dashboard-folders"],url:is,method:"POST",body:Wd,response:wp}),nP=m({description:"Updates an existing dashboard folder by ID. Send the folder name, owner, tags, and parent relationship; omit `parentFolderId` to keep the current parent or send null to move the folder to top level.",operationId:"updateDashboardFolder",tags:["dashboard-folders"],url:`${is}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard folder to update. Use the `id` returned by folder list, get, create, or update responses."})}),body:Wd,response:wp}),oP=m({description:"Deletes an empty dashboard folder by ID. The request fails if the folder still contains dashboards or child folders; dashboards and child folders are not moved or deleted automatically.",operationId:"deleteDashboardFolder",tags:["dashboard-folders"],url:`${is}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard folder to delete. Use the `id` returned by folder list, get, create, or update responses."})}),response:x});var kr="/v0/dashboards",aP=["white","gray.100","amber.200","lime.200","emerald.200","cyan.200","blue.200","violet.200","fuchsia.200","pink.200","red.200"],t2=["bar","distribution","gauge","heatmap","list","pie","query-value","table","timeseries","top-list"],FYe=[...t2,"note"];var r2=["ns","us","ms","s","m","h","days"];var n2=["B","KB","MB","GB","TB","PB"];var o2=20;var sP=t.Object({type:t.Literal("cpu",{description:"Normalizes values as CPU usage"})},{$id:"DataNormalizerCpu",title:"CPU"}),cP=t.Object({type:t.Literal("duration",{description:"Normalizes values as durations using standard time units"}),unit:t.Enum(r2,{description:"Time unit used to present the normalized values"})},{$id:"DataNormalizerDuration",title:"Duration"}),pP=t.Object({type:t.Literal("data",{description:"Normalizes values as data sizes using byte units"}),unit:t.Enum(n2,{description:"Data size unit used to present the normalized values"})},{$id:"DataNormalizerData",title:"Data"}),uP=t.Object({type:t.Literal("percent",{description:"Formats numeric values as percentages. Use it when the raw value is already on a 0-100 scale, for example `25` to display `25%`."})},{$id:"DataNormalizerPercent",title:"Percent"}),lP=t.Object({type:t.Literal("percent-fraction",{description:"Formats numeric values as percentages. Use it when the raw value is a 0-1 fraction; Tsuga multiplies the value by 100 for display, for example `0.2` to display `20%`."})},{$id:"DataNormalizerPercentFraction",title:"Percent Fraction"}),mP=t.Object({type:t.Literal("date",{description:"Formats values as calendar dates"})},{$id:"DataNormalizerDate",title:"Date"}),dP=t.Object({type:t.Literal("level",{description:"Displays values using their log level name"})},{$id:"DataNormalizerLevel",title:"Level"}),fP=t.Object({type:t.Literal("none",{description:"Displays raw values without a unit. Records an explicit removal of the unit, so it is not re-derived from metric metadata"})},{$id:"DataNormalizerNone",title:"None"}),i2=t.Object({type:t.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:t.String({description:"Text label describing the custom unit"})},{$id:"DataNormalizerCustom",title:"Custom"}),a2=t.Object({type:t.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:t.String({description:"Text label describing the custom unit. Must not be empty.",minLength:1,maxLength:o2})},{$id:"InputDataNormalizerCustom",title:"Custom"}),ht=b("type",[cP,pP,uP,lP,mP,dP,sP,fP,i2],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),Tt=b("type",[cP,pP,uP,lP,mP,dP,sP,fP,a2],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),Zd=t.Object({attribute:t.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:t.Optional(ht)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),Xd=t.Object({attribute:t.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:t.Optional(Tt)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),hi=["background","no-background"],s2=["table","legend-only","no-legend"];var c2=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"],gP=["alert","warning","success"],fr=t.Object({operator:t.Enum(c2,{description:"Comparator used to evaluate the metric value"}),value:t.Number({description:"Threshold value used when evaluating the operator"}),color:t.Enum(gP,{description:"Color applied when the condition is met"})},{title:"ConditionalFormatting",description:"Color rule evaluated against the displayed value. The first matching rule in the array is applied."}),p2=t.Object({value:t.Number({description:"Y-axis value where the threshold marker is placed"}),level:t.Enum(gP,{description:"Level applied to the threshold marker"})},{title:"ThresholdMarker",description:"Marker line drawn across the chart at a fixed value, colored by its level."}),u2=["sec","min","hour","day"],En=t.Object({time:t.Number({description:"Numeric count of `metric` units in each bucket. Required when `timeBucket` is present."}),metric:t.Enum(u2,{description:"Unit used to measure the bucket width"})},{description:"Time bucket width for time-based chart widgets. Optional; when present, `time` and `metric` together define the bucket width."});var Tn=t.Enum(["flex-start","center","flex-end"],{description:"Flex alignment keyword used for widget layout"}),Ti=t.Object({formula:t.Optional(t.String({description:"Optional alias for formula (only used for display in the UI)"})),queries:t.Optional(t.Record(t.String(),t.String({description:'Display name for this query series in the legend, keyed by the zero-based query index as a string ("0" = first query, "1" = second, and so on). This differs from `formula`, which references queries as "q1", "q2". Omit to fall back to an auto-generated label like "Count on <filter>".'}),{description:"Display names for individual query series, keyed by the zero-based query index as a string."}))},{description:"Display names used for the formula series and the individual query series instead of auto-generated labels."}),Ei=t.Object({formula:t.Optional(p({type:"short",description:"Optional alias for formula (only used for display in the UI)"})),queries:t.Optional(t.Record(t.String(),p({type:"short",description:'Display name for this query series in the legend, keyed by the zero-based query index as a string ("0" = first query, "1" = second, and so on). This differs from `formula`, which references queries as "q1", "q2". Omit to fall back to an auto-generated label like "Count on <filter>".'}),{description:"Display names for individual query series, keyed by the zero-based query index as a string."}))},{description:"Display names used for the formula series and the individual query series instead of auto-generated labels."}),Lp={source:Vt,queries:aO,formula:t.Optional(ip),aliases:t.Optional(Ti),visibleSeries:t.Optional(t.Array(t.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},vp={source:Vt,queries:va,formula:t.Optional(Hn),aliases:t.Optional(Ei),visibleSeries:t.Optional(t.Array(t.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},_i={...Lp,groupBy:t.Optional(Qo)},Ii={...vp,groupBy:t.Optional(Ar)},Ue=t.Enum(s2,{description:"Controls whether and how the widget displays legend or series details (e.g. table, legend-only, or no legend)"}),le=t.Optional(t.Union([t.Number(),t.Literal("max")],{description:"Display precision for numeric labels, tooltips, tables, and scalar values. Use a number of decimal places to round displayed values, or `max` to display the full submitted precision."})),qt=t.Optional(t.Array(p2,{description:"Threshold markers displayed on the chart"})),l2=t.Object({name:t.String({description:"Display name of the table column"}),...Lp,source:Vt,normalizer:t.Optional(ht),precision:le},{title:"TableColumn",description:"Table column backed by its own aggregation. `defaultSorting` and `columnSizes` reference it as `col-<index>`, using its zero-based position in `columns`."}),m2=t.Object({name:p({description:"Display name of the table column"}),...vp,source:Vt,normalizer:t.Optional(Tt),precision:le},{title:"TableColumn",description:"Table column backed by its own aggregation. `defaultSorting` and `columnSizes` reference it as `col-<index>`, using its zero-based position in `columns`."}),d2=t.Array(t.Object({id:t.String({description:"ID of the column to sort by"}),desc:t.Boolean({description:"Whether the sort is descending"})},{title:"TableDefaultSorting"}),{description:"Default sorting applied to a table widget. Column IDs are `label` for the grouping column and `col-<index>` for each entry in `columns`. Users can still change sorting by selecting columns in the rendered table."}),f2=t.Array(t.Object({id:p({description:"ID of the column to sort by"}),desc:t.Boolean({description:"Whether the sort is descending"})},{title:"TableDefaultSorting"}),{description:"Default sorting applied to a table widget. Column IDs are `label` for the grouping column and `col-<index>` for each entry in `columns`. Users can still change sorting by selecting columns in the rendered table."}),Jd=t.Array(t.Object({id:t.String({description:"Column attribute used for the default list sort. It matches an attribute in `listColumns` or a built-in list column for the selected list source."}),desc:t.Boolean({description:"Sort direction for the default list sort. `true` sorts descending; `false` sorts ascending."})},{title:"ListDefaultSorting"}),{description:"Default sorting applied to a list widget. Applies to log, span, or connection list widgets. Users can still change sorting by selecting columns in the rendered list."}),ef=t.Array(t.Object({id:p({description:"Column attribute used for the default list sort. Set this to an attribute in `listColumns` or a built-in list column for the selected list source."}),desc:t.Boolean({description:"Sort direction for the default list sort. Set `true` for descending order or `false` for ascending order."})},{title:"ListDefaultSorting"}),{description:"Default sorting applied to a list widget. Optional on create or update for log, span, or connection list widgets. Users can still change sorting by selecting columns in the rendered list."}),yP=["horizontal","vertical"],g2=t.Object({type:t.Literal("list",{description:"Displays matching logs in a tabular list"}),query:t.String({description:"Query that selects logs for the list"}),listColumns:t.Optional(t.Array(Zd,{description:"Custom columns to display for each log"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to list widgets."})),defaultSorting:t.Optional(Jd)},{$id:"GraphVisualizationList",title:"List"}),y2=t.Object({type:t.Literal("list",{description:"Displays matching logs in a tabular list"}),query:p({type:"tsuga-query",description:"Query that selects logs for the list"}),listColumns:t.Optional(t.Array(Xd,{description:"Custom columns to display for each log"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to list widgets. Optional; omit or set false to use truncated cells."})),defaultSorting:t.Optional(ef)},{$id:"InputGraphVisualizationList",title:"List"}),Np=b("type",[t.Object({type:t.Literal("auto",{description:"Automatically choose this axis bound"})}),t.Object({type:t.Literal("number",{description:"Use a fixed numeric axis bound"}),value:t.Number({description:"Fixed numeric axis bound value"})})],{description:"Axis bound mode: automatic or fixed numeric value"}),bi=t.Object({min:Np,max:Np,scale:b("type",[t.Object({type:t.Literal("pow",{description:"Power scale"}),exponent:t.Number({description:"Exponent used by the power scale"})}),t.Object({type:t.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:t.Boolean({description:"Whether the rendered Y axis should always include zero"})},{description:"Y-axis bounds and scale configuration for chart widgets."}),Si=t.Object({min:Np,max:Np,scale:b("type",[t.Object({type:t.Literal("pow",{description:"Power scale"}),exponent:t.Number({minimum:0,description:"Exponent used by the power scale"})}),t.Object({type:t.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:t.Boolean({description:"Whether the rendered Y axis should always include zero"})},{description:"Y-axis bounds and scale configuration for chart widgets. Optional on create or update."}),h2=t.Array(t.Integer({description:"Marker value expressed as a percentage between 0 and 100"}),{description:"Percentile markers displayed on top of the distribution chart"}),T2=t.Array(t.Integer({minimum:0,maximum:100,description:"Marker value expressed as a percentage between 0 and 100"}),{description:"Percentile markers displayed on top of the distribution chart"});var E2=t.Object({type:t.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(bi)},{$id:"GraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),_2=t.Object({type:t.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(Si)},{$id:"InputGraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),I2=t.Object({type:t.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),query:t.String({description:"The read-only SQL query to execute against the connection."}),listColumns:t.Optional(t.Array(Zd,{description:"Custom columns to display for each database row"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to connection list widgets."})),defaultSorting:t.Optional(Jd)},{$id:"GraphVisualizationListConnection",title:"ListConnection"}),b2=t.Object({type:t.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),query:p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),listColumns:t.Optional(t.Array(Xd,{description:"Custom columns to display for each database row"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to connection list widgets. Optional; omit or set false to use truncated cells."})),defaultSorting:t.Optional(ef)},{$id:"InputGraphVisualizationListConnection",title:"ListConnection"}),S2=t.Object({type:t.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."}))},{$id:"GraphVisualizationTopListConnection",title:"TopListConnection"}),O2=t.Object({type:t.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1})},{$id:"InputGraphVisualizationTopListConnection",title:"TopListConnection"}),A2=t.Object({type:t.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),legendMode:t.Optional(Ue)},{$id:"GraphVisualizationPieConnection",title:"PieConnection"}),x2=t.Object({type:t.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:t.Optional(Ue)},{$id:"InputGraphVisualizationPieConnection",title:"PieConnection"}),R2=t.Object({type:t.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(bi)},{$id:"GraphVisualizationBarConnection",title:"BarConnection"}),C2=t.Object({type:t.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(Si)},{$id:"InputGraphVisualizationBarConnection",title:"BarConnection"}),P2=t.Object({type:t.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),backgroundMode:t.Optional(t.Enum(hi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(ht),legendMode:t.Optional(Ue)},{$id:"GraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),U2=t.Object({type:t.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),backgroundMode:t.Optional(t.Enum(hi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(Tt),legendMode:t.Optional(Ue)},{$id:"InputGraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),w2=t.Object({type:t.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:t.String({description:"Tsuga query that selects logs to cluster into patterns"}),layout:t.Optional(t.Enum(yP,{description:"Layout used to render log patterns"}))},{$id:"GraphVisualizationListLogPatterns",title:"ListLogPatterns"}),N2=t.Object({type:t.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:p({type:"tsuga-query",description:"Tsuga query that selects logs to cluster into patterns"}),layout:t.Optional(t.Enum(yP,{description:"Layout used to render log patterns"}))},{$id:"InputGraphVisualizationListLogPatterns",title:"ListLogPatterns"}),L2=t.Object({type:t.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:t.String({description:"Query that selects trace spans for the list"}),listColumns:t.Optional(t.Array(Zd,{description:"Custom columns to display for each span"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to span list widgets."})),defaultSorting:t.Optional(Jd)},{$id:"GraphVisualizationListSpans",title:"ListSpans"}),v2=t.Object({type:t.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:p({type:"tsuga-query",description:"Query that selects trace spans for the list"}),listColumns:t.Optional(t.Array(Xd,{description:"Custom columns to display for each span"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to span list widgets. Optional; omit or set false to use truncated cells."})),defaultSorting:t.Optional(ef)},{$id:"InputGraphVisualizationListSpans",title:"ListSpans"}),as=t.Array(t.String({description:"Raw PromQL expression for this widget, returned exactly as stored."}),{description:"PromQL expressions configured for this widget. PromQL-backed widgets require at least one query."}),ss=t.Array(p({allowEmpty:!1,type:"long",description:"Raw PromQL expression for this widget."}),{minItems:1,description:"PromQL expressions configured for this widget."}),k2=t.Object({type:t.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:as,aliases:t.Optional(Ti),timeBucket:t.Optional(En),normalizer:t.Optional(ht),precision:le,legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(bi),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),M2=t.Object({type:t.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:ss,aliases:t.Optional(Ei),timeBucket:t.Optional(En),normalizer:t.Optional(Tt),precision:le,legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(Si),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),D2=t.Object({type:t.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:as,aliases:t.Optional(Ti),backgroundMode:t.Optional(t.Enum(hi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(ht),legendMode:t.Optional(Ue)},{$id:"GraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),G2=t.Object({type:t.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:ss,aliases:t.Optional(Ei),backgroundMode:t.Optional(t.Enum(hi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(Tt),legendMode:t.Optional(Ue)},{$id:"InputGraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),$2=t.Object({type:t.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:as,aliases:t.Optional(Ti),normalizer:t.Optional(ht),precision:le,conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"GraphVisualizationTopListPromql",title:"TopListPromql"}),j2=t.Object({type:t.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:ss,aliases:t.Optional(Ei),normalizer:t.Optional(Tt),precision:le,conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"InputGraphVisualizationTopListPromql",title:"TopListPromql"}),B2=t.Object({type:t.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:as,aliases:t.Optional(Ti),normalizer:t.Optional(ht),precision:le,legendMode:t.Optional(Ue)},{$id:"GraphVisualizationPiePromql",title:"PiePromql"}),q2=t.Object({type:t.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:ss,aliases:t.Optional(Ei),normalizer:t.Optional(Tt),precision:le,legendMode:t.Optional(Ue)},{$id:"InputGraphVisualizationPiePromql",title:"PiePromql"}),F2=t.Object({type:t.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:as,aliases:t.Optional(Ti),timeBucket:t.Optional(En),precision:le,normalizer:t.Optional(ht),thresholds:qt,legendMode:t.Optional(Ue),yAxisSettings:t.Optional(bi)},{$id:"GraphVisualizationBarPromql",title:"BarPromql"}),H2=t.Object({type:t.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:ss,aliases:t.Optional(Ei),timeBucket:t.Optional(En),precision:le,normalizer:t.Optional(Tt),thresholds:qt,legendMode:t.Optional(Ue),yAxisSettings:t.Optional(Si)},{$id:"InputGraphVisualizationBarPromql",title:"BarPromql"}),K2=t.Object({type:t.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),..._i,timeBucket:t.Optional(En),normalizer:t.Optional(ht),precision:le,legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(bi),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseries",title:"Timeseries"}),z2=t.Object({type:t.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...Ii,timeBucket:t.Optional(En),normalizer:t.Optional(Tt),precision:le,legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(Si),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseries",title:"Timeseries"}),Y2=t.Object({type:t.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),..._i,normalizer:t.Optional(ht),precision:le,conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"GraphVisualizationTopList",title:"TopList"}),V2=t.Object({type:t.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...Ii,normalizer:t.Optional(Tt),precision:le,conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"InputGraphVisualizationTopList",title:"TopList"}),Q2=t.Object({type:t.Literal("pie",{description:"Displays the aggregation as a pie chart"}),..._i,normalizer:t.Optional(ht),precision:le,legendMode:t.Optional(Ue)},{$id:"GraphVisualizationPie",title:"Pie"}),W2=t.Object({type:t.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...Ii,normalizer:t.Optional(Tt),precision:le,legendMode:t.Optional(Ue)},{$id:"InputGraphVisualizationPie",title:"Pie"}),Z2=t.Object({type:t.Literal("query-value",{description:"Displays the aggregation as a single value"}),...Lp,backgroundMode:t.Optional(t.Enum(hi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(ht),legendMode:t.Optional(Ue)},{$id:"GraphVisualizationQueryValue",title:"QueryValue"}),X2=t.Object({type:t.Literal("query-value",{description:"Displays the aggregation as a single value"}),...vp,backgroundMode:t.Optional(t.Enum(hi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(Tt),legendMode:t.Optional(Ue)},{$id:"InputGraphVisualizationQueryValue",title:"QueryValue"}),J2=t.Object({type:t.Literal("bar",{description:"Displays the aggregation as a bar chart"}),..._i,timeBucket:t.Optional(En),precision:le,normalizer:t.Optional(ht),thresholds:qt,legendMode:t.Optional(Ue),yAxisSettings:t.Optional(bi)},{$id:"GraphVisualizationBar",title:"Bar"}),eK=t.Object({type:t.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...Ii,timeBucket:t.Optional(En),precision:le,normalizer:t.Optional(Tt),thresholds:qt,legendMode:t.Optional(Ue),yAxisSettings:t.Optional(Si)},{$id:"InputGraphVisualizationBar",title:"Bar"}),hP='Attribute that switches the count to "Groups" mode: records are grouped by this attribute, the aggregation produces one value per group, and the chart buckets those per-group values. When omitted, individual records are bucketed.',TP=t.String({description:hP}),EP=p({description:hP}),tK=t.Object({type:t.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),..._i,group:t.Optional(TP),precision:le,normalizer:t.Optional(ht),percentileMarkers:t.Optional(h2),boundsScale:t.Optional(np)},{$id:"GraphVisualizationDistribution",title:"Distribution"}),rK=t.Object({type:t.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...Ii,group:t.Optional(EP),precision:le,normalizer:t.Optional(Tt),percentileMarkers:t.Optional(T2),boundsScale:t.Optional(np)},{$id:"InputGraphVisualizationDistribution",title:"Distribution"}),_P=["red","pink","violet","blue","cyan","green","yellow","orange"],IP=t.Enum(_P,{description:"Color palette used to render the heatmap intensity gradient"}),nK=t.Object({type:t.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),..._i,group:t.Optional(TP),precision:le,normalizer:t.Optional(ht),palette:t.Optional(IP)},{$id:"GraphVisualizationHeatmap",title:"Heatmap"}),oK=t.Object({type:t.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...Ii,group:t.Optional(EP),precision:le,normalizer:t.Optional(Tt),palette:t.Optional(IP)},{$id:"InputGraphVisualizationHeatmap",title:"Heatmap"}),bP=t.Object({from:t.Number({description:"Lower bound of the Gauge color threshold; runs up to the next threshold or the max"}),color:t.Enum(_P,{description:"Color applied to the band starting at this value"})},{title:"GaugeColorThreshold",description:"Color band of the gauge range. Bands are ordered by `from`, so entries may be listed in any order."}),iK=t.Object({type:t.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...Lp,max:t.Optional(t.Number({description:"Gauge maximum value"})),colorThresholds:t.Optional(t.Array(bP,{description:"Color thresholds inside the gauge range"})),precision:le,normalizer:t.Optional(ht)},{$id:"GraphVisualizationGauge",title:"Gauge"}),aK=t.Object({type:t.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...vp,max:t.Optional(t.Number({description:"Gauge maximum value"})),colorThresholds:t.Optional(t.Array(bP,{description:"Color thresholds inside the gauge range"})),precision:le,normalizer:t.Optional(Tt)},{$id:"InputGraphVisualizationGauge",title:"Gauge"}),sK=t.Object({type:t.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:t.Array(l2,{description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:t.Optional(Qo),defaultSorting:t.Optional(d2),columnSizes:t.Optional(t.Record(t.String(),t.Number({description:"Column width by column id"}),{description:"Table column widths in pixels, keyed by column id: `label` for the grouping column and `col-<index>` for each entry in `columns`. Columns without an entry keep their default width."}))},{$id:"GraphVisualizationTable",title:"Table"}),cK=t.Object({type:t.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:t.Array(m2,{minItems:1,description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:t.Optional(Ar),defaultSorting:t.Optional(f2),columnSizes:t.Optional(t.Record(t.String(),t.Number({description:"Column width by column id"}),{description:"Table column widths in pixels, keyed by column id: `label` for the grouping column and `col-<index>` for each entry in `columns`. Columns without an entry keep their default width."}))},{$id:"InputGraphVisualizationTable",title:"Table"}),pK=t.Object({type:t.Literal("note",{description:"Displays static text on the dashboard"}),note:t.Optional(t.String({description:"Markdown-compatible text shown in the note"})),noteColor:t.Optional(t.Enum(aP,{description:"Background color used to render the note"})),noteAlign:t.Optional(Tn),noteJustifyContent:t.Optional(Tn)},{$id:"GraphVisualizationNote",title:"Note"}),uK=t.Object({type:t.Literal("note",{description:"Displays static text on the dashboard"}),note:t.Optional(p({type:"long",description:"Markdown-compatible text shown in the note"})),noteColor:t.Optional(t.Enum(aP,{description:"Background color used to render the note"})),noteAlign:t.Optional(Tn),noteJustifyContent:t.Optional(Tn)},{$id:"InputGraphVisualizationNote",title:"Note"}),lK=b("type",[E2,I2,S2,A2,R2,P2,k2,D2,$2,B2,F2,K2,Y2,Q2,Z2,iK,J2,tK,nK,sK,g2,pK,w2,L2],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),mK=b("type",[_2,b2,O2,x2,C2,U2,M2,G2,j2,q2,H2,z2,V2,W2,X2,aK,eK,rK,oK,cK,y2,uK,N2,v2],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),kp=t.Object({id:t.String({description:"Unique identifier of the graph widget inside the dashboard. Set by the caller when the graph is created; use it to target the graph in later update requests."}),name:t.Optional(t.String({description:"Display name of the graph widget."})),description:t.Optional(t.String({description:"Optional text shown with the graph widget."})),descriptionAlign:t.Optional(Tn),descriptionJustifyContent:t.Optional(Tn),visualization:lK,layout:t.Optional(t.Object({x:t.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:t.Number({description:"Row position of the widget on the dashboard grid, in row units of 50 pixels each. 0 is the topmost row; increasing values move down."}),w:t.Number({description:"Width of the widget in grid columns, out of the 12-column grid."}),h:t.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall."})},{description:"Grid position and size of the widget. Optional; when provided, width and height must meet the minimum size for the widget type."}))},{title:"Graph",description:"Single dashboard widget, combining its identity, its visualization configuration, and its position on the dashboard grid."}),Mp=t.Object({id:p({description:"Unique identifier of the graph widget inside the dashboard. Assign it when the graph is created; use it to target the graph in later update requests."}),name:t.Optional(p({description:"Display name of the graph widget."})),description:t.Optional(t.String({minLength:1,maxLength:800,description:"Text shown with the graph widget."})),descriptionAlign:t.Optional(Tn),descriptionJustifyContent:t.Optional(Tn),visualization:mK,layout:t.Optional(t.Object({x:t.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:t.Number({description:"Row position of the widget on the dashboard grid, in row units of 50 pixels each. 0 is the topmost row; increasing values move down."}),w:t.Number({description:"Width of the widget in grid columns, out of the 12-column grid."}),h:t.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall."})},{description:"Grid position and size of the widget. Optional; when provided, width and height must meet the minimum size for the widget type."}))},{title:"Graph",description:"Single dashboard widget, combining its identity, its visualization configuration, and its position on the dashboard grid."}),iP=10,dK=t.Array(t.Object({key:t.String({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:t.Array(t.String({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:t.Optional(t.Boolean({description:"If true, widgets exclude telemetry whose value matches this filter instead of including it (is-not)."}))}),{description:"Dashboard-wide filters applied to every widget on the dashboard."}),fK=t.Array(t.Object({key:p({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:t.Array(p({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:t.Optional(t.Boolean({description:"If true, widgets exclude telemetry whose value matches this filter instead of including it (is-not)."}))}),{maxItems:iP,description:`Dashboard-wide filters applied to every widget on the dashboard. Up to ${iP} filters are allowed.`}),Oi=t.Object({id:t.String({description:"Tsuga-generated dashboard ID assigned when the dashboard is created."}),name:t.String({description:"Display name of the dashboard. Set by the caller on create or update."}),owner:t.String({description:"ID of the team that owns the dashboard. Set by the caller on create or update and used for dashboard access control."}),graphs:t.Array(kp,{description:"Ordered widgets that compose the dashboard"}),filters:t.Optional(dK),createdAt:E({description:"Timestamp when Tsuga created the dashboard."}),updatedAt:E({description:"Timestamp when Tsuga last updated the dashboard."}),creator:t.Optional(ae),updater:t.Optional(ae),tags:Re,timePreset:t.Optional(t.Enum(du,{description:"Relative time preset used when opening the dashboard."})),folderId:t.Optional(t.String({description:"Folder that contains the dashboard. Set from the dashboard's saved folder relationship. Returned when the dashboard is in a folder; omitted when it is not."}))}),Dp=t.Object({name:p({description:"Display name of the dashboard."}),owner:p({allowEmpty:!1,description:"ID of the team that owns the dashboard. Required and used for dashboard access control."}),graphs:t.Array(Mp,{description:"Ordered widgets that compose the dashboard"}),filters:t.Optional(fK),tags:$e,timePreset:t.Optional(t.Enum(du,{description:"Relative time preset used when opening the dashboard. Optional; create defaults to `past-30-minutes` when omitted, and update omission preserves the current value."})),folderId:t.Optional(t.Union([t.Null(),p({allowEmpty:!1})],{description:"Folder that should contain the dashboard. Optional; omit on update to keep the current folder, pass null to clear the folder, or pass a readable dashboard-folder ID to move it."}))}),Wt={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",WIDGET_COUNT:"widgetCount",UPDATED_AT:"updatedAt",NAME:"name"},SP=[Wt.OWNER,Wt.TAGS,Wt.WIDGET_COUNT,Wt.UPDATED_AT,Wt.NAME],Gp=t.Partial(t.Object({owners:xe(p({allowEmpty:!1}),{description:"Restrict results to dashboards owned by any of these team IDs",maxItems:50}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against dashboard names or dashboard IDs. Omit the whole `searchQuery` filter to skip text filtering."}),exclude:t.Optional(t.Boolean({description:"If true, exclude dashboards matching this value instead of including them"}))},{description:"Text filter for dashboard names or IDs. Optional; `exclude: true` returns dashboards whose name and ID do not match the substring."}),tags:xe(vt.items,{description:"Restrict results to dashboards that have at least one of the listed key/value tags",maxItems:50}),folderId:t.Union([t.Null(),p({allowEmpty:!1})],{description:"Folder filter for dashboard query results. Optional; pass a folder ID to return dashboards in that folder, or null to return only dashboards that are not in any folder."})},{description:"Optional filters applied to narrow the returned dashboards"})),gK=t.Partial(t.Object({...de,filters:Gp,sort:t.Object({by:t.Enum([Wt.IS_FAVORITE,Wt.OWNER,Wt.TAGS,Wt.WIDGET_COUNT,Wt.UPDATED_AT,Wt.NAME],{description:"Field to sort the returned dashboards by"}),direction:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboards"})})),HYe=m({tags:["dashboards"],url:`${kr}/query`,method:"POST",paginated:!0,response:t.Array(Oi),body:gK}),KYe=m({tags:["dashboards"],url:`${kr}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Omit(Gp,["tags"]))}),response:Lt}),zYe=m({tags:["dashboards"],url:`${kr}/:id`,method:"GET",params:t.Object({id:p()}),response:Oi}),YYe=m({tags:["dashboards"],url:kr,method:"POST",body:Dp,response:Oi}),VYe=m({tags:["dashboards"],url:`${kr}/:id`,method:"PUT",params:t.Object({id:p()}),body:t.Partial(Dp),response:Oi}),QYe=m({tags:["dashboards"],url:`${kr}/bulk-update`,method:"PUT",body:t.Object({dashboardIds:t.Array(p(),{description:"Dashboard IDs to update. At least one dashboard ID is required."}),owner:t.Optional(p({allowEmpty:!1,description:"Owning team ID to apply to every dashboard. Optional when folderId is provided; omit to keep the current owner."})),folderId:t.Optional(t.Union([t.Null(),p({allowEmpty:!1})],{description:"Folder that should contain every dashboard. Optional when owner is provided; omit to keep the current folder, pass null to clear the folder, or pass a dashboard-folder ID to move dashboards."}))}),response:t.Object({})}),WYe=m({tags:["dashboards"],url:`${kr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),ZYe=m({tags:["dashboards"],url:`${kr}/:id/graphs/:graphId`,method:"PUT",params:t.Object({id:p({allowEmpty:!1}),graphId:p({allowEmpty:!1})}),body:t.Omit(Mp,["id"]),response:kp}),XYe=m({tags:["dashboards"],url:`${kr}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})});var Ai=`/${"v1"}/dashboards`,cs=t.Pick(Oi,["id","name","owner","graphs","filters","tags","timePreset","folderId"],{$id:"Dashboard",description:"Saved visualization made of dashboard-wide filters and ordered graphs. Use dashboards to preserve reusable views for a team or workflow. See [Dashboards](/documentation/visualize/dashboards/index)."}),yK={id:"123-456-abc",name:"API Performance Overview",owner:"team-123-abc",graphs:[{id:"789-abc-def",name:"Request Latency P99",visualization:{type:"timeseries",source:"metrics",queries:[{aggregate:{type:"percentile",field:"duration",percentile:99},filter:"service:api-gateway"}]},layout:{x:0,y:0,w:6,h:4}}],filters:[{key:"env",values:["production"]}],tags:[{key:"team",value:"platform"}],timePreset:"past-1-hour"};Object.assign(cs,{examples:[yK]});var hK=t.Object({by:t.Enum([...SP],{description:"Field to sort the returned dashboards by: `owner` sorts by owning team ID, `tags` sorts by tag key/value pairs, `widgetCount` sorts by the number of graphs on the dashboard, `updatedAt` sorts by last-updated timestamp, and `name` sorts alphabetically by dashboard name."}),direction:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboards"}),OP=t.Object({...De,filters:t.Optional(t.Pick(Gp,["owners","searchQuery","tags","folderId"])),sort:t.Optional(hK)},{description:"Dashboard query request. Use filters, sorting, limit, and offset to page through visible dashboards."}),TK={filters:{owners:{values:["team-123-abc"]},searchQuery:{value:"API"},tags:{values:[{key:"service",value:"api-gateway"}]},folderId:"folder-123-abc"},sort:{by:"name",direction:"asc"},limit:10,offset:0};Object.assign(OP,{examples:[TK]});var AP=m({description:"Queries dashboards visible to the authenticated operation key. Use this endpoint to build dashboard inventories or synchronize dashboard metadata. Pagination fields limit the returned page; use the response metadata to request additional pages. See [Dashboards](/documentation/visualize/dashboards/index).",operationId:"queryDashboards",tags:["dashboards"],url:`${Ai}/query`,method:"POST",paginated:!0,body:OP,response:t.Array(cs)}),xP=m({description:"Retrieves one dashboard by ID.",operationId:"getDashboard",tags:["dashboards"],url:`${Ai}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved dashboard to retrieve. Use the `id` returned by dashboard query, create, or update responses."})}),response:cs}),tf=t.Pick(Dp,["name","owner","graphs","filters","tags","timePreset","folderId"],{description:"Dashboard create or update request. Provide the dashboard identity, owner team, widgets, filters, tags, and optional time preset."}),EK={name:"API Performance Overview",owner:"team-123-abc",graphs:[{id:"789-abc-def",name:"Request Latency P99",visualization:{type:"timeseries",source:"metrics",queries:[{aggregate:{type:"percentile",field:"duration",percentile:99},filter:"service:api-gateway"}]},layout:{x:0,y:0,w:6,h:4}}],filters:[{key:"env",values:["production"]}],tags:[{key:"team",value:"platform"}],timePreset:"past-1-hour",folderId:null};Object.assign(tf,{examples:[EK]});var _K=t.Omit(Mp,["id"],{description:"Dashboard graph update request. The graph identifier is supplied in the `graphId` path parameter; provide the replacement graph definition without an `id` field."}),RP=m({description:"Creates a dashboard owned by the specified team. Use this to provision dashboards from automation or templates. The response returns the saved dashboard definition.",operationId:"createDashboard",tags:["dashboards"],url:Ai,method:"POST",body:tf,response:cs}),CP=m({description:"Updates an existing dashboard by ID. Fields are patched from the request body; omitted fields keep their current values.",operationId:"updateDashboard",tags:["dashboards"],url:`${Ai}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved dashboard to update. Use the `id` returned by dashboard query, get, or create responses."})}),body:t.Partial(tf),response:cs}),IK=t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved dashboard to delete. Use the `id` returned by dashboard query, get, create, or update responses."})}),PP=m({description:"Deletes a dashboard by ID. Use only after confirming no users or automation still rely on the dashboard.",operationId:"deleteDashboard",tags:["dashboards"],url:`${Ai}/:id`,method:"DELETE",params:IK,response:x}),aVe=m({description:"Updates one graph inside a dashboard without replacing the full dashboard. Use this for targeted widget edits when you already know the dashboard ID and graph ID.",operationId:"updateDashboardGraph",tags:["dashboards"],url:`${Ai}/:id/graphs/:graphId`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard that contains the graph to update. Use the `id` returned by dashboard responses."}),graphId:p({allowEmpty:!1,description:"Identifier of the graph to update within the dashboard. Use graph IDs from the dashboard response."})}),body:_K,response:kp});var UP=100,wP=3,xi=t.Object({id:t.String({description:"Tsuga-generated ingestion API key ID assigned when the key is created."}),name:t.String({description:"Human-readable key name. Names must be kebab-case when creating or updating keys."}),keyLastCharacters:t.String({description:"Last visible characters of the secret key. Use this to identify a key without exposing the full secret."}),owner:t.String({description:"Team ID that owns and manages the ingestion API key."}),tags:Lt,teamOverrideFields:t.Optional(t.Array(t.String(),{description:"Telemetry attribute names used to override ownership for data sent with this key."})),updatedAt:E({description:"Timestamp when Tsuga last updated the key metadata."}),createdAt:E({description:"Timestamp when Tsuga created the key."}),creator:t.Optional(ae),updater:t.Optional(ae),assetUpdatedAt:E({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})}),ps=t.Object({name:t.String({format:Bo,minLength:1,maxLength:UP,description:`Kebab-case name for the ingestion API key. Maximum length is ${UP} characters.`}),owner:p({allowEmpty:!1,description:"Team ID that will own and manage the ingestion API key."}),tags:vt,teamOverrideFields:t.Union([t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:wP,description:`Array form. Up to ${wP} fields are allowed.`}),t.Null({description:"Clear any existing team override fields."})],{description:"Telemetry attribute names used to override ownership for data sent with this key. Send null to clear existing override fields."})}),us="/v0/ingestion-api-keys",gVe=m({tags:["ingestion-api-keys"],url:us,method:"POST",body:ps,response:t.Intersect([xi,t.Object({key:t.String({description:"Full secret value of the ingestion API key. Generated by Tsuga and returned only in this create response; subsequent get and list responses expose only `keyLastCharacters`. Store it immediately, since it cannot be retrieved again after this response."})})])}),yVe=m({tags:["ingestion-api-keys"],url:us,method:"GET",paginated:!0,query:t.Object(de),response:t.Array(xi)}),hVe=m({tags:["ingestion-api-keys"],url:`${us}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1})}),response:xi}),TVe=m({tags:["ingestion-api-keys"],url:`${us}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1})}),body:ps,response:xi}),EVe=m({tags:["ingestion-api-keys"],url:`${us}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1})}),response:x});var ls=`/${"v1"}/ingestion-api-keys`,ms=t.Pick(xi,["id","name","owner","tags","teamOverrideFields","keyLastCharacters"],{$id:"IngestionApiKey",description:"API key used to send telemetry data to Tsuga. The full key secret is returned only when the key is created. See [API keys](/documentation/account-and-settings/api-keys)."}),NP={id:"123-456-abc",name:"production-logs-ingestion",keyLastCharacters:"x7Qm",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(ms,{examples:[NP]});var LP=t.Pick(ps,["name","owner","tags","teamOverrideFields"],{$id:"CreateIngestionApiKeyRequest",description:"Ingestion API key creation request. Provide a kebab-case name, owner team, required tags, and required team override fields as an array of fields or null."}),vP=t.Pick(ps,["name","owner","tags","teamOverrideFields"],{$id:"UpdateIngestionApiKeyRequest",description:"Ingestion API key update request. Provide the full metadata definition, including name, owner team, tags, and team override fields."}),kP={name:"production-logs-ingestion",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(LP,{examples:[kP]});Object.assign(vP,{examples:[kP]});var bK={...NP,key:"tsuga_in:v1:abc123xyx7Qm"},MP=m({description:"Lists ingestion API keys visible to the authenticated operation key. Use this to inventory telemetry intake keys, owners, tags, and team override fields. Pagination fields limit the returned page.",operationId:"listIngestionApiKeys",tags:["ingestion-api-keys"],url:ls,method:"GET",paginated:!0,query:t.Object(De),response:t.Array(ms)}),RVe=m({description:"Retrieves one ingestion API key by ID. The response never includes the full secret key value; only the last visible characters are returned.",operationId:"getIngestionApiKey",tags:["ingestion-api-keys"],url:`${ls}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the ingestion API key to retrieve. Use the `id` returned by ingestion API key list or create responses."})}),response:ms}),SK=t.Intersect([t.Pick(ms,["id","name","keyLastCharacters","owner","tags","teamOverrideFields"]),t.Object({key:t.String({description:"Full Tsuga-generated ingestion API key secret. Returned only in the create response; list, get, and update responses expose only `keyLastCharacters`."})})],{title:"IngestionApiKeyCreated",example:bK}),DP=m({description:"Creates an ingestion API key for telemetry intake. Store the returned `key` immediately because Tsuga returns the full secret only in this response.",operationId:"createIngestionApiKey",tags:["ingestion-api-keys"],url:ls,method:"POST",body:LP,response:SK}),GP=m({description:"Updates ingestion API key metadata by ID, including name, owner, tags, and team override fields. The secret key value is not rotated by this operation.",operationId:"updateIngestionApiKey",tags:["ingestion-api-keys"],url:`${ls}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the ingestion API key to update. Use the `id` returned by ingestion API key list, get, or create responses."})}),body:vP,response:ms}),$P=m({description:"Deletes an ingestion API key by ID. Telemetry clients using the deleted key can no longer send data with it.",operationId:"deleteIngestionApiKey",tags:["ingestion-api-keys"],url:`${ls}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the ingestion API key to delete. Use the `id` returned by ingestion API key list, create, or update responses."})}),response:x});var OK={application:{webService:["azure_web_app","gcp_app_engine_service"]},data:{bucket:["aws_s3_bucket","gcp_bucket","azure_blob_storage_container"],messagingService:["aws_kinesis_data_stream","aws_sqs_queue","aws_sns_topic","azure_service_bus_namespace","azure_service_bus_queue","gcp_pubsub_topic","azure_event_grid_topic","azure_event_hub_namespace","azure_event_hub"],fileSystem:["aws_efs","azure_file_share"],contentDeliveryNetwork:["aws_cloudfront_distribution","gcp_cloud_cdn_configuration"],database:["aws_dynamodb_table","aws_elasticache","aws_rds_instance","azure_database_for_mysql_server","azure_database_for_postgres_server","azure_sql_database_server","azure_sql_database","gcp_bigtable_instance","gcp_cloud_sql_instance","gcp_firestore_database","gcp_spanner_instance","azure_cosmos_db_account"],storageAccount:["azure_storage_account"],volume:["aws_ebs_volume","gcp_compute_disk","azure_disk"]},compute:{virtualMachine:["aws_ec2_instance","gcp_compute_instance","azure_compute_virtual_machine"],serverless:["aws_lambda_function","gcp_cloud_run_function","gcp_cloud_run_job","gcp_cloud_run_service","azure_function_app"]},container:{kubernetesCluster:["aws_eks_cluster","gcp_gke_cluster","azure_aks_cluster"],containerRepository:["aws_ecr_repository","gcp_artifact_registry_repository","azure_container_registry"],containerCluster:["aws_ecs_cluster"],containerServiceTask:["aws_ecs_task"],containerService:["aws_ecs_service","azure_container_instance_group"],containerImage:["aws_ecr_image","gcp_artifact_registry_docker_image","azure_container_registry_image"]},network:{virtualNetwork:["aws_vpc","gcp_vpc","azure_virtual_network"],loadBalancer:["aws_elastic_load_balancer","gcp_forwarding_rule","azure_load_balancer","azure_traffic_manager_profile"],targetGroup:["aws_target_group"],certificate:["aws_acm_certificate","gcp_certificate_manager_certificate","azure_app_service_certificate"]}},[wVe,of,ds]=AK(OK);function AK(e){let r=[],n=[],o=[],i=Object.keys(e);for(let a of i){r.push(a);let c=e[a];for(let l in c){n.push(l);let d=c[l];Array.isArray(d)&&o.push(...d)}}return[rf(r),rf(n),rf(o)]}function rf(e){if(e.length===0)throw new Error("Array must have at least one element.");return e}var nf=t.Enum(["HTTP","HTTPS","TCP","UDP","GENEVE","TLS","TLS_QUIC","TCP_UDP","TCP_QUIC","QUIC"]),xK=t.Object({versioningStatus:t.Optional(t.Enum(["Enabled","Disabled","Suspended","Not configured"]))}),RK=t.Object({domainName:t.Optional(t.String()),origins:t.Optional(t.Array(t.String()))}),CK=t.Object({allocatedStorageGib:t.Optional(t.Number()),encryptedAtRest:t.Optional(t.Boolean()),engine:t.Optional(t.String()),dynamoDbItemCount:t.Optional(t.Number()),dynamoDbActualSizeGib:t.Optional(t.Number())}),PK=t.Object({version:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),subnets:t.Optional(t.Array(t.String()))}),UK=t.Object({artifactRegistryFormat:t.Optional(t.Enum(["FORMAT_UNSPECIFIED","DOCKER","MAVEN","NPM","APT","YUM","PYTHON","KFP","GO","GENERIC"])),uri:t.Optional(t.String()),tagMutability:t.Optional(t.Enum(["MUTABLE","IMMUTABLE"])),scanOnPush:t.Optional(t.Boolean()),encryptionType:t.Optional(t.String())}),wK=t.Object({status:t.Optional(t.String()),activeServices:t.Optional(t.Number()),pendingTasks:t.Optional(t.Number()),runningTasks:t.Optional(t.Number()),registeredContainerInstances:t.Optional(t.Number()),capacityProviders:t.Optional(t.Array(t.String()))}),NK=t.Object({status:t.Optional(t.String()),desiredStatus:t.Optional(t.String()),healthStatus:t.Optional(t.String()),availabilityZone:t.Optional(t.String()),startedAt:t.Optional(E())}),LK=t.Object({isEncrypted:t.Optional(t.Boolean()),ownerId:t.Optional(t.String()),state:t.Optional(t.Enum(["creating","available","deleting","deleted","error","updating"]))}),vK=t.Object({type:t.Optional(t.String()),osType:t.Optional(t.String()),subnetIds:t.Optional(t.Array(t.String())),nbContainers:t.Optional(t.Number())}),kK=t.Object({digest:t.String(),imageTags:t.Array(t.String()),imageSizeBytes:t.Optional(t.Number()),imagePushedAt:t.Optional(E()),mediaType:t.Optional(t.String()),repositoryName:t.String(),repositoryId:t.Optional(t.String()),scanStatus:t.Optional(t.String())}),MK=t.Object({url:t.Optional(t.String()),maxMessageSizeBytes:t.Optional(t.Number()),messageRetentionHours:t.Optional(t.Number())}),DK=t.Object({runtime:t.Optional(t.String()),memoryAllocationMib:t.Optional(t.Number()),timeoutMs:t.Optional(t.Number()),codeSha256:t.Optional(t.String())}),GK=t.Object({kind:t.Optional(t.String())}),$K=t.Object({instanceId:t.String(),architecture:t.Optional(t.String()),instanceType:t.Optional(t.String()),operatingSystem:t.Optional(t.String()),memoryMib:t.Optional(t.Number()),vCpus:t.Optional(t.Number()),vpcId:t.Optional(t.String()),k8sClusterId:t.Optional(t.String())}),jK=t.Object({id:t.Optional(t.String()),ipCidrBlocks:t.Array(t.String())}),BK=t.Object({protocol:t.Optional(nf),port:t.Optional(t.Number()),instanceProtocol:t.Optional(nf),instancePort:t.Optional(t.Number())}),qK=t.Object({protocol:t.Optional(t.String()),ports:t.Optional(t.Array(t.String())),portRange:t.Optional(t.String()),allPorts:t.Optional(t.Boolean())}),FK=t.Object({name:t.String(),ip:t.Optional(t.String()),type:t.Enum(["public","private"])}),HK=t.Object({type:t.String(),name:t.String()}),KK=t.Object({frontendIp:t.Optional(FK),backendIpPools:t.Array(HK)}),zK=t.Object({targetId:t.String(),targetPort:t.Optional(t.Number()),targetType:t.Optional(t.Enum(["instance","ip","lambda","alb"])),healthState:t.Optional(t.String()),healthReason:t.Optional(t.String()),healthDescription:t.Optional(t.String()),availabilityZone:t.Optional(t.String())}),YK=t.Object({protocol:t.Optional(nf),port:t.Optional(t.Number()),type:t.Optional(t.Enum(["alb","lambda","instance","ip"])),name:t.Optional(t.String()),targetGroupArn:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),healthCheckProtocol:t.Optional(t.String()),healthCheckPort:t.Optional(t.String()),healthCheckPath:t.Optional(t.String()),healthCheckIntervalSeconds:t.Optional(t.Number()),healthCheckTimeoutSeconds:t.Optional(t.Number()),healthyThresholdCount:t.Optional(t.Number()),unhealthyThresholdCount:t.Optional(t.Number()),targets:t.Optional(t.Array(zK)),targetCount:t.Optional(t.Number()),healthyTargetCount:t.Optional(t.Number()),loadBalancerArns:t.Optional(t.Array(t.String()))}),VK=t.Object({first:t.Optional(t.String()),last:t.Optional(t.String()),scope:t.Optional(t.Number())}),QK=t.Object({type:t.Optional(t.String()),name:t.Optional(t.String()),alwaysServe:t.Optional(t.Boolean()),subnets:t.Optional(t.Array(t.Union([t.Number(),VK]))),target:t.Optional(t.String()),weight:t.Optional(t.Number()),priority:t.Optional(t.Number()),status:t.Optional(t.String())}),WK=t.Object({instanceId:t.Optional(t.String()),state:t.Optional(t.String()),reasonCode:t.Optional(t.String()),description:t.Optional(t.String())}),ZK=t.Object({loadBalancerType:t.Optional(t.String()),dnsName:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),subnetIds:t.Array(t.String()),scheme:t.Optional(t.String()),listeners:t.Optional(t.Union([t.Array(BK),t.Array(qK)])),targets:t.Optional(t.Union([t.Array(t.String()),t.Array(WK),t.Array(QK)])),azureLoadBalancingRules:t.Optional(t.Array(KK))}),XK=t.Object({domainName:t.Optional(t.String()),expiresAt:t.Optional(E()),inUseBy:t.Optional(t.Array(t.String())),renewalEligibility:t.Optional(t.String()),revokedAt:t.Optional(E()),status:t.Optional(t.String()),type:t.Optional(t.String())}),JK=t.Object({state:t.Optional(t.Enum(["creating","available","deleting","deleted","error","in-use"])),volumeType:t.Optional(t.Enum(["gp2","gp3","io1","io2","st1","sc1","standard"]))}),ez=t.Object({osType:t.Optional(t.Enum(["Windows","Linux"]))}),tz=t.Object({state:t.Optional(t.String()),volumeType:t.Optional(t.String())}),rz=t.Intersect([t.Object({isEncrypted:t.Optional(t.Boolean()),sizeGib:t.Optional(t.Number())}),t.Union([JK,tz,ez])]),nz=t.Object({instanceCount:t.Optional(t.Number()),hostnames:t.Optional(t.Array(t.String())),runtime:t.Optional(t.String())}),$p=t.Union([t.Object({category:t.Literal("application"),resourceType:t.Literal("webService"),attributes:t.Optional(nz)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("bucket"),attributes:t.Optional(xK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("messagingService"),attributes:t.Optional(MK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("fileSystem"),attributes:t.Optional(LK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("contentDeliveryNetwork"),attributes:t.Optional(RK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("database"),attributes:t.Optional(CK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("storageAccount"),attributes:t.Optional(GK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("volume"),attributes:t.Optional(rz)}),t.Object({category:t.Literal("compute"),resourceType:t.Literal("virtualMachine"),attributes:t.Optional($K)}),t.Object({category:t.Literal("compute"),resourceType:t.Literal("serverless"),attributes:t.Optional(DK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("kubernetesCluster"),attributes:t.Optional(PK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerRepository"),attributes:t.Optional(UK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerCluster"),attributes:t.Optional(wK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerServiceTask"),attributes:t.Optional(NK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerService"),attributes:t.Optional(vK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerImage"),attributes:t.Optional(kK)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("virtualNetwork"),attributes:t.Optional(jK)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("loadBalancer"),attributes:ZK}),t.Object({category:t.Literal("network"),resourceType:t.Literal("targetGroup"),attributes:t.Optional(YK)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("certificate"),attributes:t.Optional(XK)})],{description:"Normalized public inventory category, resource type, and category-specific attributes. Attribute shape depends on the category and resourceType combination."});var co="/v0/inventory",fs=["aws","gcp","azure"],jP=["scan_in_progress","success","failure","partial"],sf=t.Object({id:t.String({description:"Identifier of the inventory resource. Generated by Tsuga."}),cloudPlatform:t.Enum(fs,{description:"Cloud platform where Tsuga discovered this resource."}),cloudAccount:t.String({description:"Cloud-native account identifier where Tsuga discovered this resource, such as an AWS account ID, GCP project ID, or Azure subscription ID."}),cloudRegion:t.Optional(t.String({description:"Cloud region where Tsuga discovered this resource, when the resource is regional."})),fullyQualifiedResourceId:t.String({description:"Cloud-native unique identifier for this resource, such as an AWS ARN, GCP resource name, or Azure resource ID."}),displayName:t.String({description:"Human-readable resource name shown in Tsuga. Derived from cloud provider metadata when available."}),nativeResourceType:t.String({description:"Cloud-native resource type reported by the inventory integration, for example `aws_ec2_instance` or `gcp_bucket`."}),resourceCreatedAt:t.Optional(E({description:"Timestamp when the resource was created in the cloud, when known."})),resourceUpdatedAt:t.Optional(E({description:"Timestamp when the resource was last updated in the cloud, when known."})),resourceLastSeenAt:E({description:"Timestamp when Tsuga last observed this resource during an inventory scan."}),tags:Re,nativeAttributes:t.Optional(t.Unsafe({type:"object",additionalProperties:!0})),covered:t.Optional(t.Boolean({description:"Whether the resource is covered by the configured infrastructure-as-code identifiers"}))}),Ri={DISPLAY_NAME:"displayName",CLOUD_ACCOUNT:"cloudAccount",NATIVE_RESOURCE_TYPE:"nativeResourceType",CLOUD_REGION:"cloudRegion",RESOURCE_TYPE:"resourceType",RESOURCE_CREATED_AT:"resourceCreatedAt"},BP=t.Object({cloudPlatforms:xe(t.Enum(fs),{description:"Restrict results to resources discovered on any of these cloud platforms",maxItems:fs.length}),cloudAccounts:xe(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud accounts",maxItems:500}),cloudRegions:xe(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud regions",maxItems:500}),nativeResourceTypes:xe(t.Enum(ds),{description:"Restrict results to resources of any of these cloud-native resource types",maxItems:ds.length}),resourceTypes:xe(t.Enum(of),{description:"Restrict results to resources of any of these normalized resource types",maxItems:of.length}),tags:xe(vt.items,{description:"Restrict results to resources that have at least one of the listed key/value tags",maxItems:50}),isIacManaged:t.Boolean({description:"Restrict results by infrastructure-as-code coverage. When true, only resources covered by the configured IaC identifiers are returned; when false, only uncovered resources are returned."}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Case-insensitive substring matched against resource ID, display name, fully-qualified resource ID, cloud account, region, and resource type. Use the `tags` filter to narrow by tag. Wildcard characters are treated literally."}),exclude:t.Optional(t.Boolean({description:"If true, exclude resources matching this value instead of including them"}))},{description:"Search query filter for resources."})},{description:"Optional filters applied to narrow the returned resources"}),cf=t.Partial(t.Object({...de,filters:t.Partial(BP,{description:"Filters applied to narrow the returned resources."}),sort:t.Object({by:t.Enum([Ri.DISPLAY_NAME,Ri.CLOUD_ACCOUNT,Ri.NATIVE_RESOURCE_TYPE,Ri.CLOUD_REGION,Ri.RESOURCE_TYPE,Ri.RESOURCE_CREATED_AT],{description:"Field to sort the returned resources by"}),direction:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned resources. Ties are broken by resource ID for stable pagination."})})),$Ve=m({tags:["inventory"],method:"POST",url:`${co}/resources/query`,paginated:!0,body:cf,response:t.Array(t.Intersect([sf,$p]))}),oz=["resourceType","cloudAccount","isIacManaged"],jVe=m({tags:["inventory"],method:"POST",url:`${co}/resources/counts`,body:t.Object({filters:t.Optional(t.Partial(BP)),groupBy:t.Enum(oz,{description:"Dimension to group the resource counts by."})}),response:t.Array(t.Object({value:t.String({description:'The group value the count belongs to: a resource type, a cloud account id, or "true"/"false" for IaC coverage.'}),count:t.Integer({description:"Number of resources in this group matching the requested filters."})}))}),BVe=m({tags:["inventory"],method:"GET",url:`${co}/resources/filter-options`,response:t.Object({cloudRegions:t.Array(t.String(),{description:"Distinct cloud regions present across the tenant's resources."}),nativeResourceTypes:t.Array(t.String(),{description:"Distinct cloud-native resource types present across the tenant's resources."}),tags:Lt})}),qVe=b("type",[t.Object({type:t.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:t.String({description:"AWS account ID that Tsuga scans."}),externalId:t.String({description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:t.String({description:"ARN of the IAM role Tsuga assumes to read inventory in the account."})}),t.Object({type:t.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:t.String({description:"GCP project ID that Tsuga scans."}),serviceAccountId:t.String({description:"Service account Tsuga impersonates to read inventory."}),workloadIdentityProvider:t.String({description:"Workload identity provider resource name used for federated authentication."})}),t.Object({type:t.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:t.String({description:"Client ID of the Azure application Tsuga authenticates as."}),subscriptionId:t.String({description:"Azure subscription ID that Tsuga scans."}),tenantId:t.String({description:"Azure tenant ID that owns the subscription."})})]),iz="^[0-9]{12}$",az="^arn:aws[a-z-]*:iam::[0-9]{12}:role/.+$",sz="^[a-z][a-z0-9-]{4,28}[a-z0-9]$",cz="^[^@\\s]+@[^@\\s]+\\.iam\\.gserviceaccount\\.com$",pz="^//iam\\.googleapis\\.com/projects/[0-9]+/locations/global/workloadIdentityPools/[^/]+/providers/[^/]+$",af="^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$",uz=t.Object({type:t.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:t.String({pattern:iz,description:"AWS account ID that Tsuga scans.",errorMessage:{pattern:"Must be a 12-digit AWS account ID."}}),externalId:p({allowEmpty:!1,description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:t.String({pattern:az,minLength:1,maxLength:2048,description:"ARN of the IAM role Tsuga assumes to read inventory in the account.",errorMessage:{pattern:"Must be an IAM role ARN, e.g. arn:aws:iam::123456789012:role/MyRole."}})},{$id:"AwsConnectionSettings"}),lz=t.Object({type:t.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:t.String({pattern:sz,minLength:6,maxLength:30,description:"GCP project ID that Tsuga scans.",errorMessage:{pattern:"Must be a GCP project ID (6-30 chars: lowercase letters, digits, hyphens)."}}),serviceAccountId:t.String({pattern:cz,minLength:1,maxLength:128,description:"Service account Tsuga impersonates to read inventory.",errorMessage:{pattern:"Must be a service account email, e.g. name@project.iam.gserviceaccount.com."}}),workloadIdentityProvider:t.String({pattern:pz,minLength:1,maxLength:256,description:"Full resource name of the workload identity provider used for federated authentication, e.g. //iam.googleapis.com/projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider.",errorMessage:{pattern:"Must be the full provider resource name: //iam.googleapis.com/projects/<PROJECT_NUMBER>/locations/global/workloadIdentityPools/<POOL_ID>/providers/<PROVIDER_ID>."}})},{$id:"GcpConnectionSettings"}),mz=t.Object({type:t.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:t.String({pattern:af,minLength:1,description:"Client ID of the Azure application Tsuga authenticates as (GUID).",errorMessage:{pattern:"Must be a GUID."}}),subscriptionId:t.String({pattern:af,minLength:1,description:"Azure subscription ID that Tsuga scans (GUID).",errorMessage:{pattern:"Must be a GUID."}}),tenantId:t.String({pattern:af,minLength:1,description:"Azure tenant ID that owns the subscription (GUID).",errorMessage:{pattern:"Must be a GUID."}})},{$id:"AzureConnectionSettings"}),qP=b("type",[uz,lz,mz],{description:"Credentials Tsuga uses to scan the account, in the provider-specific shape selected by `type`. Credentials are stored as provided and are not validated at creation time; failures surface through `lastScanStatus`."}),Ci=t.Object({id:t.String({description:"Identifier of the cloud account. Generated by Tsuga."}),cloudType:t.Enum(fs,{description:"Cloud provider of the account."}),cloudAccountId:t.String({description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:t.Optional(t.String({description:"Human-readable name for the account shown in Tsuga."})),organizationId:t.Optional(t.String({description:"Cloud organization identifier, when known."})),createdBy:t.Optional(t.String({description:"Identifier of the user who created the account, when created by a user."})),createdAt:E({description:"Timestamp when the account was registered in Tsuga."}),lastScanStartedAt:t.Optional(E({description:"Timestamp when the most recent inventory scan started."})),lastScanFinishedAt:t.Optional(E({description:"Timestamp when the most recent inventory scan finished."})),lastScanStatus:t.Optional(t.Enum(jP,{description:"Status of the most recent inventory scan."}))}),pf=t.Object({cloudType:t.Enum(fs,{description:"Cloud provider of the account."}),cloudAccountId:p({allowEmpty:!1,description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:t.Optional(p({description:"Human-readable name for the account shown in Tsuga."})),organizationId:t.Optional(p({description:"Cloud organization identifier, when known."})),connectionSettings:qP,lastScanStatus:t.Optional(t.Enum(jP,{description:"Status of the most recent inventory scan."}))}),po=`${co}/cloud-accounts`,FVe=m({tags:["inventory"],url:po,method:"GET",response:t.Array(Ci)}),HVe=m({tags:["inventory"],url:`${po}/:id`,method:"GET",params:t.Object({id:p()}),response:Ci}),KVe=m({tags:["inventory"],url:po,method:"POST",body:pf,response:Ci}),uf=t.Object({accountFriendlyName:p({description:"Human-readable name for the account shown in Tsuga."})}),zVe=m({tags:["inventory"],url:`${po}/:id`,method:"PUT",params:t.Object({id:p()}),body:uf,response:Ci}),YVe=m({tags:["inventory"],url:`${po}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),VVe=m({tags:["inventory"],url:`${co}/trigger-scan`,method:"POST",body:t.Object({}),response:t.Object({success:t.Literal(!0)})}),QVe=m({tags:["inventory"],url:`${po}/azure/onboarding`,method:"POST",body:t.Object({tenantId:p()}),response:t.Object({subjectId:t.String(),audience:t.String()})}),WVe=m({tags:["inventory"],method:"POST",url:`${po}/validate/:type`,params:t.Object({type:p()}),body:t.Object({data:qP,id:t.Optional(p())}),response:t.Object({areAccountSettingsValid:t.Boolean(),message:t.Optional(t.String())})}),FP=`${co}/settings`,ZVe=m({tags:["inventory"],url:FP,method:"GET",response:t.Object({settings:t.Optional(t.Object({id:t.String(),infrastructureIdentifiers:t.Array(t.Object({name:t.String(),value:t.Optional(t.String())}))}))})}),dz=50,XVe=m({tags:["inventory"],url:FP,method:"POST",body:t.Object({infrastructureIdentifiers:t.Array(t.Object({name:p({allowEmpty:!1}),value:t.Optional(p({allowEmpty:!1}))}),{maxItems:dz})}),response:t.Object({})}),JVe=m({tags:["inventory"],url:`${co}/iac-tags-proposal`,method:"GET",response:t.Array(t.Object({name:t.String(),value:t.Optional(t.String())}))});var HP=`/${"v1"}/inventory`,fz=t.Omit(sf,["nativeAttributes","covered"],{$id:"InventoryResourceBase",description:"Base fields shared by cloud resources discovered during inventory scans. Public inventory resources omit raw provider-native attributes and infrastructure-as-code coverage fields. See [Cloud resources](/documentation/categorize/cloud-resources)."}),KP=t.Intersect([fz,$p],{$id:"InventoryResource",description:"Cloud resource discovered by an inventory scan, together with normalized category, resource type, and public category-specific attributes. See [Cloud resources](/documentation/categorize/cloud-resources)."}),gz={id:"123-456-abc",cloudPlatform:"aws",cloudAccount:"123456789012",cloudRegion:"us-east-1",fullyQualifiedResourceId:"arn:aws:s3:::tsuga-example-bucket",displayName:"tsuga-example-bucket",nativeResourceType:"aws_s3_bucket",resourceCreatedAt:"2024-01-01T08:00:00.000Z",resourceLastSeenAt:"2024-01-15T12:34:56.000Z",tags:[{key:"team",value:"platform"}],category:"data",resourceType:"bucket",attributes:{versioningStatus:"Enabled"}};Object.assign(KP,{examples:[gz]});var zP=t.Object({...cf.properties,...De},{description:"Inventory resource query request. Use filters, sorting, limit, and offset to page through discovered resources."}),yz={filters:{cloudPlatforms:{values:["aws"]},cloudAccounts:{values:["123456789012"]},cloudRegions:{values:["us-east-1"]},resourceTypes:{values:["bucket"]},nativeResourceTypes:{values:["aws_s3_bucket"]},tags:{values:[{key:"team",value:"platform"}]},isIacManaged:!0,searchQuery:{value:"tsuga-example"}},sort:{by:"displayName",direction:"asc"},limit:10,offset:0};Object.assign(zP,{examples:[yz]});var YP=m({description:"Queries cloud resources discovered by inventory scans, with optional filters, sorting, and pagination. Use this endpoint to build infrastructure inventories across connected cloud accounts.",operationId:"queryInventoryResources",tags:["inventory"],url:`${HP}/resources/query`,method:"POST",paginated:!0,body:zP,response:t.Array(KP)}),gs=`${HP}/cloud-accounts`,ys=t.Pick(Ci,["id","cloudType","cloudAccountId","accountFriendlyName"],{$id:"CloudAccount"}),hz={id:"123-456-abc",cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS"};Object.assign(ys,{examples:[hz]});var VP=t.Pick(pf,["cloudType","cloudAccountId","accountFriendlyName","connectionSettings"]),Tz={cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS",connectionSettings:{type:"aws",accountId:"123456789012",externalId:"tsuga-external-id",roleArn:"arn:aws:iam::123456789012:role/tsuga-inventory"}};Object.assign(VP,{examples:[Tz]});var Ez=t.Pick(uf,["accountFriendlyName"]),c5e=m({description:"Lists cloud accounts connected to Tsuga that the authenticated operation key can read.",operationId:"listCloudAccounts",tags:["inventory"],url:gs,method:"GET",response:t.Array(ys)}),p5e=m({description:"Retrieves one cloud account by ID.",operationId:"getCloudAccount",tags:["inventory"],url:`${gs}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the cloud account to retrieve. Use the `id` returned by the cloud account list or create operations."})}),response:ys}),u5e=m({description:"Registers a cloud account for inventory scanning. Connection settings are stored as provided and are not validated at creation time; scan failures surface through `lastScanStatus`.",operationId:"createCloudAccount",tags:["inventory"],url:gs,method:"POST",body:VP,response:ys}),l5e=m({description:"Updates the friendly name of a cloud account by ID.",operationId:"updateCloudAccount",tags:["inventory"],url:`${gs}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the cloud account to update. Use the `id` returned by the cloud account list or create operations."})}),body:Ez,response:ys}),m5e=m({description:"Deletes a cloud account by ID. Future inventory scans stop for the account, and the trust relationship on the cloud side can be safely removed afterward.",operationId:"deleteCloudAccount",tags:["inventory"],url:`${gs}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the cloud account to delete. Use the `id` returned by the cloud account list or create operations."})}),response:x});var hs="/v0/investigations",_z=["dashboard","monitor","service","slo","log-route","adaptive-notification-rule"],Iz=t.Object({type:t.String({description:'Kind of linked asset, e.g. "dashboard"'}),id:t.String({description:"Identifier of the linked asset"})}),bz=t.Object({type:t.Enum(_z,{description:"Kind of linked asset"}),id:p({allowEmpty:!1,description:"Identifier of the linked asset"})}),Mr=t.Object({id:t.String({description:"Identifier of the investigation"}),name:t.String({description:"Human readable name shown for the investigation"}),slug:t.Optional(t.String({description:'Immutable identifier supplied by the creating agent, e.g. "incident-2024-06-payments-5xx". Set once at creation and matched against the agent telemetry to link back to the run that created the investigation.'})),contentMd:t.Optional(t.String({description:"Markdown content capturing the investigation notes and findings"})),tags:Re,owner:t.String({description:"Team ID owning the investigation"}),env:t.Optional(t.String({description:'Environment the investigation relates to, e.g. "prod"'})),linkedAssets:t.Array(Iz,{description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}),creator:t.Optional(ae),updater:t.Optional(ae),createdAt:E({description:"Timestamp the investigation was created at."}),updatedAt:E({description:"Timestamp the investigation was last updated at."})},{title:"Investigation"}),jp=t.Object({name:p({allowEmpty:!1,description:"Human readable name shown for the investigation"}),slug:p({type:"kebab-case",allowEmpty:!1,description:'Immutable, unique identifier supplied by the creating agent, used to link the investigation back to the agent run, e.g. "incident-2024-06-payments-5xx". The agent should also emit this value in its telemetry.'}),contentMd:t.Optional(p({type:"long",description:"Markdown content capturing the investigation notes and findings"})),tags:$e,owner:p({allowEmpty:!1,description:"Team ID owning the investigation"}),env:t.Optional(p({allowEmpty:!0,description:"Environment the investigation relates to"})),linkedAssets:t.Optional(t.Array(bz,{maxItems:100,description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}))}),lf=t.Object(t.Omit(jp,["slug"]).properties),_5e=m({tags:["investigations"],url:hs,method:"GET",paginated:!0,query:t.Object(de),response:t.Array(Mr)}),I5e=m({tags:["investigations"],url:`${hs}/:id`,params:t.Object({id:p()}),method:"GET",response:Mr}),b5e=m({tags:["investigations"],url:hs,method:"POST",body:jp,response:Mr}),S5e=m({tags:["investigations"],url:`${hs}/:id`,method:"PUT",body:lf,params:t.Object({id:p()}),response:Mr}),O5e=m({tags:["investigations"],url:`${hs}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x});var Ts=`/${"v1"}/investigations`,QP=m({description:"Retrieve all investigations",tags:["private"],url:Ts,method:"GET",paginated:!0,query:t.Object(De),response:t.Array(Mr)}),WP=m({description:"Retrieve an investigation by its id",tags:["private"],url:`${Ts}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1})}),response:Mr}),ZP=m({description:"Create a new investigation",tags:["private"],url:Ts,method:"POST",body:jp,response:Mr}),XP=m({description:"Update an investigation by its id",tags:["private"],url:`${Ts}/:id`,method:"PUT",body:lf,params:t.Object({id:p({allowEmpty:!1})}),response:Mr}),JP=m({description:"Delete an investigation by its id",tags:["private"],url:`${Ts}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1})}),response:x});var eU=15,Bp={id:t.String({description:"Unique identifier of the processor within the route. Used to preserve processor identity during updates."}),description:t.Optional(t.String({description:"Optional user-provided processor note."})),tags:Re,updatedAt:t.Optional(E({description:"Timestamp when Tsuga last updated the processor."}))},qp={id:p({allowEmpty:!1,description:"Unique identifier of the processor within the route. Preserve it across updates for existing processors."}),description:t.Optional(p({type:"long",description:"Optional processor note."})),tags:$e,updatedAt:t.Optional(E({description:"Backend-maintained timestamp for this processor. Omit this field on create and update requests; Tsuga sets or preserves it based on processor changes."}))},tU={...Bp,type:t.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},rU={...qp,type:t.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},Sz=b("subtype",[t.Object({targetAttribute:t.String({description:"Attribute that will receive the formatted value"}),formatString:t.String({description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:t.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Whether missing referenced attributes render as empty strings. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorFormatString"}),t.Object({targetAttribute:t.String({description:"Attribute that will receive the computed value"}),formula:t.String({description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:t.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:t.Optional(t.Boolean({description:"Whether missing referenced attributes evaluate as zero. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorMathFormula"}),t.Object({targetAttribute:t.String({description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:t.String({description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:t.String({description:"String category value assigned when this clause matches."})}),{description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:t.Optional(t.String({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:t.Literal("category",{description:"Assigns the first matching category value from ordered query clauses, with an optional default."})},{$id:"ProcessorParamsCreatorCategory"})],{description:"Create processor configuration. The `subtype` discriminator selects how the value written to `targetAttribute` is built and which fields are required."}),Oz=b("subtype",[t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:p({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:t.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))},{$id:"InputProcessorParamsCreatorFormatString"}),t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the computed value"}),formula:p({allowEmpty:!1,type:"long",description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:t.Optional(t.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:t.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:t.Optional(t.Boolean({description:"Set to true for missing referenced attributes to evaluate as zero. Defaults to true."}))},{$id:"InputProcessorParamsCreatorMathFormula"}),t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:p({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:p({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:eU,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:t.Optional(p({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:t.Literal("category",{description:"Assigns the first matching category value from ordered query clauses, with an optional default."})},{$id:"InputProcessorParamsCreatorCategory"})],{description:"Create processor configuration. The `subtype` discriminator selects how the value written to `targetAttribute` is built and which fields are required."}),Az=t.Object({...tU,params:Sz}),xz=t.Object({...rU,params:Oz}),nU={...Bp,type:t.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},oU={...qp,type:t.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},Rz=b("subtype",[t.Object({attributes:t.Array(t.Object({originAttribute:t.String({description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Whether the source attribute is preserved after mapping. If omitted, route processing treats this as false."})),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),targetAttribute:t.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"ProcessorParamsMapperMapAttributes"}),t.Object({attributeName:t.String({description:"Attribute whose value will determine the log level"}),subtype:t.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"ProcessorParamsMapperMapLevel"}),t.Object({attributeName:t.String({description:"Attribute whose value will determine the log timestamp"}),subtype:t.Literal("map-timestamp",{description:"Uses an event-time attribute as the log timestamp."})},{$id:"ProcessorParamsMapperMapTimestamp"})],{description:"Map processor configuration. The `subtype` discriminator selects whether existing attributes are copied or moved to new names, or used to set the log level or timestamp."}),Cz=b("subtype",[t.Object({attributes:t.Array(t.Object({originAttribute:p({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:t.Optional(t.Boolean({description:"Overwrite the target attribute when it already exists (defaults to true)"})),targetAttribute:p({allowEmpty:!1,description:"Attribute name that will receive the mapped value"})}),{minItems:1,maxItems:50,description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"InputProcessorParamsMapperMapAttributes"}),t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will determine the log level"}),subtype:t.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"InputProcessorParamsMapperMapLevel"}),t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will determine the log timestamp"}),subtype:t.Literal("map-timestamp",{description:"Uses an event-time attribute as the log timestamp."})},{$id:"InputProcessorParamsMapperMapTimestamp"})],{description:"Map processor configuration. The `subtype` discriminator selects whether existing attributes are copied or moved to new names, or used to set the log level or timestamp."}),Pz=t.Object({...oU,params:Cz}),Uz=t.Object({...nU,params:Rz}),iU={...Bp,type:t.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},aU={...qp,type:t.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},sU=5,wz=b("subtype",[t.Object({attributeName:t.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(t.String({description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(t.String(),{description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:t.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),t.Object({sourceAttribute:t.String({description:"Attribute containing the URL to parse"}),subtype:t.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),t.Object({sourceAttribute:t.String({description:"Attribute containing the user agent string to parse"}),subtype:t.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),t.Object({sourceAttribute:t.String({description:"Attribute containing the key/value string segment to parse"}),targetAttribute:t.String({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:t.String({description:"Delimiter separating keys from values in the source string"}),pairsSplitter:t.String({description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:t.Boolean({description:"Whether keys without explicit values are accepted by the parser."}),subtype:t.Literal("key-value",{description:"Parses delimited key/value text into attributes."})})],{description:"Parse processor configuration. The `subtype` discriminator selects which parser reads the source text attribute and which fields it extracts."}),Nz=b("subtype",[t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(p({allowEmpty:!1,type:"long",description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{minItems:1,maxItems:5,description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(p({type:"long"}),{maxItems:sU,description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:t.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),t.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the URL to parse"}),subtype:t.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),t.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the user agent string to parse"}),subtype:t.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),t.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the key/value string segment to parse"}),targetAttribute:p({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:p({allowEmpty:!1,description:"Delimiter separating keys from values in the source string"}),pairsSplitter:p({allowEmpty:!0,description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:t.Boolean({description:"Set to true to accept keys without explicit values."}),subtype:t.Literal("key-value",{description:"Parses delimited key/value text into attributes."})})],{description:"Parse processor configuration. The `subtype` discriminator selects which parser reads the source text attribute and which fields it extracts."}),Lz=t.Object({...iU,params:wz}),vz=t.Object({...aU,params:Nz}),kz=t.Object({...rU,params:b("subtype",[t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:p({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:t.Literal("format-string"),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))}),t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:p({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:p({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:eU,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:t.Optional(p({description:"String category value used when no clause matches."})),subtype:t.Literal("category")})])}),Mz=t.Object({...oU,params:t.Object({attributes:t.Array(t.Object({originAttribute:p({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:t.Optional(t.Boolean({description:"Overwrite the target attribute when it already exists (defaults to true)"})),targetAttribute:p({allowEmpty:!1,description:"Attribute name that will receive the mapped value"})}),{minItems:1,maxItems:50,description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes")})}),Dz=t.Object({...aU,params:t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(p({allowEmpty:!1,type:"long",description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{minItems:1,maxItems:5,description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(p({type:"long"}),{maxItems:sU,description:"Example log lines for validating the Grok rules."})),subtype:t.Literal("grok")})}),D5e=b("type",[Mz,Dz,kz]),Gz=t.Object({...tU,params:b("subtype",[t.Object({targetAttribute:t.String({description:"Attribute that will receive the formatted value"}),formatString:t.String({description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),subtype:t.Literal("format-string"),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Whether missing referenced attributes render as empty strings."}))}),t.Object({targetAttribute:t.String({description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:t.String({description:"Query that selects logs for this category clause."}),value:t.String({description:"String category value assigned when this clause matches."})}),{description:"Conditions evaluated in order to determine the category value."}),defaultValue:t.Optional(t.String({description:"String category value used when no clause matches."})),subtype:t.Literal("category")})])}),$z=t.Object({...nU,params:t.Object({attributes:t.Array(t.Object({originAttribute:t.String({description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Whether the source attribute is preserved after mapping."})),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),targetAttribute:t.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes")})}),jz=t.Object({...iU,params:t.Object({attributeName:t.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(t.String({description:"Grok rule applied to parse text."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(t.String(),{description:"Example log lines for validating the Grok rules."})),subtype:t.Literal("grok")})}),G5e=b("type",[$z,jz,Gz]),Bz=11,cU=t.Cyclic({OutputProcessor:t.Union([Uz,Lz,Az,t.Object({...Bp,params:t.Object({items:t.Array(t.Object({query:t.String({description:"Query that determines whether logs enter this branch"}),processors:t.Array(t.Ref("OutputProcessor"),{description:"Processors executed when the branch query matches"})}),{description:"Conditional branches evaluated in order before falling back to the default"})}),type:t.Literal("split",{description:"Split processor. It sends each log through the first matching conditional branch."})})])},"OutputProcessor",{description:"Processing step executed sequentially on route logs"}),pU=t.Cyclic({InputProcessor:t.Union([Pz,vz,xz,t.Object({...qp,params:t.Object({items:t.Array(t.Object({query:p({type:"tsuga-query",description:"Query that determines whether logs enter this branch"}),processors:t.Array(t.Ref("InputProcessor"),{maxItems:50,description:"Processors executed when the branch query matches"})}),{minItems:2,maxItems:Bz,description:"Conditional branches evaluated in order before falling back to the default"})}),type:t.Literal("split",{description:"Split processor. It sends each log through the first matching conditional branch."})})])},"InputProcessor",{description:"Processing step executed sequentially on route logs"});var qz="/v0/logs",_n=`${qz}/routes`,In=t.Object({id:t.String({description:"Tsuga-generated log route ID assigned when the route is created."}),name:t.String({description:"Human-readable route name shown in Tsuga."}),description:t.Optional(t.String({description:"Optional free-text note about the route's purpose, set by the caller. This metadata is not evaluated when matching or processing logs."})),isEnabled:t.Boolean({description:"Whether this route is active for newly ingested logs. Disabled routes remain saved but do not process logs."}),query:t.String({description:"Tsuga query that selects which newly ingested logs enter the route processor chain."}),rank:t.Number({description:"Tsuga-assigned evaluation order, unique across all routes and dense (no gaps). Enabled routes are checked from lower rank to higher rank during ingestion, and every route whose query matches a log applies its processors to it \u2014 matching is not stopped after the first hit. New routes are appended with the highest rank; deleting a route shifts all higher ranks down by one to close the gap. Use `PUT /:id/modify-ranking` to move a route to a different rank, which shifts the routes between its old and new position accordingly."}),tags:Re,owner:t.String({description:"ID of the team that owns the route. Determines which team members can view and manage it, and which tag policies apply to it. Only an org admin or an admin of this team may change the `query` field or delete the route."}),processors:t.Array(cU,{description:"Processors applied in array order to logs that match the route, each transforming the output of the previous one. A `split` processor forks the chain into branches and cannot be followed by another processor at the same level."}),creator:t.Optional(ae),updater:t.Optional(ae),updatedAt:E({description:"Timestamp when Tsuga last updated the route."}),createdAt:E({description:"Timestamp when Tsuga created the route."}),assetUpdatedAt:E({description:"Timestamp when Tsuga last changed route behavior. This can differ from `updatedAt` when only metadata such as `description` or `tags` changed."})},{title:"LogRoute"}),Es=t.Object({name:p({allowEmpty:!1,description:"Human-readable log route name shown in Tsuga."}),description:t.Optional(p({type:"long",description:"Optional free-text note about the log route's purpose. This metadata is not evaluated when matching or processing logs."})),isEnabled:t.Boolean({description:"Set to true for the log route to process newly ingested matching logs. Set to false to save it without running it."}),query:p({type:"tsuga-query",description:"Tsuga query that selects which newly ingested logs enter the log route processor chain."}),tags:$e,owner:p({allowEmpty:!1,description:"ID of the team that will own the log route, determining which team members can view and manage it and which tag policies apply. Only an org admin or an admin of this team may change the `query` field or delete the log route."}),processors:t.Array(pU,{maxItems:50,description:"Processors applied in array order to logs that match the log route, each transforming the output of the previous one. Up to 50 are accepted. A `split` processor forks the chain into branches and cannot be followed by another processor at the same level."})});var Y5e=m({tags:["routes"],url:_n,method:"GET",paginated:!0,query:t.Object(de),response:t.Array(In)}),V5e=m({tags:["routes"],url:`${_n}/:id`,params:t.Object({id:p()}),method:"GET",response:In}),Q5e=m({tags:["routes"],url:_n,method:"POST",body:Es,response:In}),W5e=m({tags:["routes"],url:`${_n}/:id`,method:"PUT",body:Es,params:t.Object({id:p()}),response:In}),Z5e=m({tags:["routes"],url:`${_n}/:id/clone`,method:"POST",params:t.Object({id:p()}),body:Es,response:In}),X5e=m({tags:["routes"],url:`${_n}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),J5e=m({description:"Moves a route to a new rank, shifting the ranks of the routes between its old and new position by one to keep ranks dense and unique. Affects the route's evaluation order for newly ingested logs; does not change any route's processors or other fields.",tags:["routes"],url:`${_n}/:id/modify-ranking`,method:"PUT",params:t.Object({id:p()}),body:t.Object({rank:t.Integer({minimum:1,description:"Target rank for the route, from 1 to the total number of routes. Requests outside that range are rejected."})}),response:t.Object({})}),e6e=m({description:"Sets a route's `isEnabled` state without changing any other field. Disabling a route stops it from processing newly ingested logs while keeping it saved and its rank unchanged.",tags:["routes"],url:`${_n}/:id/enable`,method:"PUT",params:t.Object({id:p()}),body:t.Object({enable:t.Boolean({description:"Set to true to enable the route, or false to disable it."})}),response:In});var _s=`/${"v1"}/routes`,uU={name:"Enrich API Gateway Logs",description:"Adds service metadata and normalizes log format",isEnabled:!0,query:"service:api-gateway",tags:[{key:"category",value:"enrichment"}],owner:"team-123-abc",processors:[{id:"parse-gateway-message",type:"parse-attribute",tags:[],params:{subtype:"grok",attributeName:"message",rules:["%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} %{GREEDYDATA:msg}"]}}]},lU={name:"Normalize Checkout Logs",description:"Maps service fields and extracts key/value details",isEnabled:!0,query:"context.service.name:checkout",tags:[{key:"category",value:"normalization"}],owner:"team-123-abc",processors:[{id:"map-service-name",type:"mapper",tags:[],params:{subtype:"map-attributes",attributes:[{originAttribute:"context.service.name",targetAttribute:"service",keepOrigin:!1,overrideTarget:!0}]}},{id:"parse-logfmt-message",type:"parse-attribute",tags:[],params:{subtype:"key-value",sourceAttribute:"message",targetAttribute:"logfmt",keyValueSplitter:"=",pairsSplitter:" ",acceptStandaloneKey:!1}}]},Is=t.Pick(In,["id","name","description","isEnabled","query","tags","owner","processors"],{$id:"Route",description:"Team-owned log processing definition that selects newly ingested logs and applies ordered processors. See [Routes](/documentation/process/routes/index)."}),Fz={id:"123-456-abc",...uU},Hz={id:"456-789-def",...lU};Object.assign(Is,{examples:[Fz,Hz]});var mU=m({description:"Lists log routes visible to the authenticated operation key. Returned routes are ordered by evaluation order, with earlier routes evaluated first. Use this to inventory ingest-time processing definitions and owners. Pagination fields limit the returned page.",operationId:"listRoutes",tags:["routes"],url:_s,method:"GET",paginated:!0,query:t.Object(De),response:t.Array(Is)}),dU=m({description:"Retrieves one log route by ID.",operationId:"getRoute",tags:["routes"],url:`${_s}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to retrieve. Use the `id` returned by route list or create responses."})}),response:Is}),mf=t.Pick(Es,["name","description","isEnabled","query","tags","owner","processors"],{description:"Log route create or update request. Provide the route metadata, source query, owner team, enabled state, tags, and ordered processors."});Object.assign(mf,{examples:[uU,lU]});var fU=m({description:"Creates a log route at the end of the evaluation order. Routes affect only newly ingested logs after the cluster receives the updated configuration.",operationId:"createRoute",tags:["routes"],url:_s,method:"POST",body:mf,response:Is}),gU=m({description:"Updates an existing log route by ID without changing its evaluation order. Fields omitted from the request keep their existing values. Routes affect only newly ingested logs after the cluster receives the updated configuration.",operationId:"updateRoute",tags:["routes"],url:`${_s}/:id`,method:"PUT",body:mf,params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to update. Use the `id` returned by route list, get, or create responses."})}),response:Is}),yU=m({description:"Deletes a log route by ID and compacts the evaluation order for remaining routes. The route stops processing future logs after the cluster receives the updated configuration.",operationId:"deleteRoute",tags:["routes"],url:`${_s}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to delete. Use the `id` returned by route list, create, or update responses."})}),response:x});var bs=`/${"v1"}/monitors`,Ss=t.Pick(xr,["id","name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],{$id:"Monitor",description:"Saved alert definition that evaluates telemetry and creates alert transitions. Notification delivery is configured separately with notification rules. See [Monitors](/documentation/alert/monitors/index)."}),TU={name:"High Error Rate Alert",message:"Error rate exceeded threshold. Check the API gateway logs.",tags:[{key:"severity",value:"critical"}],configuration:{type:"log",timeframe:5,groupByFields:[],aggregationAlertLogic:"no_aggregation",queries:[{aggregate:{type:"count"},filter:"level:ERROR service:api-gateway"}],conditions:[{formula:"q1",operator:"greater_than",threshold:100}],noDataBehavior:"resolve"},priority:1,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},EU={name:"High CPU Utilization By Service",message:"More than half of grouped services are above the CPU threshold.",tags:[{key:"severity",value:"warning"}],configuration:{type:"metric",timeframe:10,groupByFields:[{fields:["context.service.name"],limit:10}],aggregationAlertLogic:"proportion",proportionAlertThreshold:50,queries:[{aggregate:{type:"average",field:"system.cpu.utilization"},filter:"context.service.name:checkout"}],conditions:[{formula:"q1",operator:"greater_than",threshold:.8}],noDataBehavior:"keep_last_status"},priority:2,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},_U={name:"Certificate Expiry Warning",message:"A certificate is approaching expiry.",tags:[{key:"environment",value:"production"}],configuration:{type:"certificate-expiry",warnBeforeInDays:30,cloudAccounts:["aws-prod"],aggregationAlertLogic:"each",noDataBehavior:"resolve"},priority:3,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},IU={name:"New Error Pattern Detector",message:"A new error pattern was detected in the logs.",tags:[{key:"team",value:"platform"}],configuration:{type:"log-error-pattern",aggregationAlertLogic:"each",noDataBehavior:"keep_last_status",filter:{teamIds:["team-123-abc"],env:"production",service:"api-gateway"}},priority:2,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},Kz={id:"123-456-abc",...TU},zz={id:"234-567-bcd",...EU},Yz={id:"345-678-cde",..._U},Vz={id:"456-789-def",...IU};Object.assign(Ss,{examples:[Kz,zz,Yz,Vz]});var hU=t.Pick(Kl,["filters","sort","limit","offset"]),bU=t.Object({...hU.properties,...De,filters:hU.properties.filters},{description:"Monitor query request. Use filters, sorting, limit, and offset to page through visible monitors."}),Qz={filters:{owners:{values:["team-123-abc"]},searchQuery:{value:"service:api-gateway"},tags:{values:[{key:"paging",value:"true"}]},priorities:{values:[4,5],exclude:!0},types:{values:["threshold"]},activity:"active",clusterIds:{values:["cluster-123-abc"]}},sort:{by:"name",direction:"asc"},limit:10,offset:0};Object.assign(bU,{examples:[Qz]});var SU=m({description:"Queries monitors visible to the authenticated operation key. Use this endpoint to inventory monitor definitions, filter by owner, tag, priority, type, activity, or cluster, and page through results. See [Monitors](/documentation/alert/monitors/index).",operationId:"queryMonitors",tags:["monitors"],url:`${bs}/query`,method:"POST",paginated:!0,body:bU,response:t.Array(Ss)}),OU=m({description:"Retrieves one monitor definition by ID.",operationId:"getMonitor",tags:["monitors"],url:`${bs}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Monitor ID returned by monitor query, create, or update operations."})}),response:Ss}),AU=["name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],xU=t.Pick(Ma,AU,{$id:"CreateMonitorRequest",description:"Monitor creation request. Provide ownership, data access, alert configuration, priority, tags, and optional dashboard or cluster scope."}),RU=t.Pick(Ma,AU,{$id:"UpdateMonitorRequest",description:"Monitor update request. Required fields and the submitted configuration are overwritten; omitted `message`, `tags`, and `clusterIds` keep their existing values. Omitting `dashboardId` clears the dashboard link."}),CU=TU,PU=EU,UU=_U,wU=IU;Object.assign(xU,{examples:[CU,PU,UU,wU]});Object.assign(RU,{examples:[CU,PU,UU,wU]});var NU=m({description:"Creates a monitor owned by the specified team. The monitor can evaluate logs, metrics, traces, anomaly behavior, certificate expiry, or new error patterns depending on its configuration.",operationId:"createMonitor",tags:["monitors"],url:bs,method:"POST",body:xU,response:Ss}),LU=m({description:"Updates an existing monitor definition by ID. Required fields and the submitted configuration are overwritten; omitted `message`, `tags`, and `clusterIds` keep their existing values. Omitting `dashboardId` clears the dashboard link, and public updates clear any existing snooze because `pauseUntil` is not part of the public schema.",operationId:"updateMonitor",tags:["monitors"],url:`${bs}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved monitor to update. Use the `id` returned by monitor query or create responses."})}),body:RU,response:Ss}),Wz=t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved monitor to delete. Use the `id` returned by monitor query, create, or update responses."})}),vU=m({description:"Deletes a monitor by ID. Deleting a monitor stops future evaluations and alert transitions for that monitor.",operationId:"deleteMonitor",tags:["monitors"],url:`${bs}/:id`,method:"DELETE",params:Wz,response:x});var Os=`/${"v1"}/notification-rules`,As=t.Pick(ri,["id","name","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter","clusterIdsFilter","owner","isActive","tags","targets"],{$id:"Rule",description:"Notification rule that matches alert transitions and routes notifications to one or more targets. See [Rules](/documentation/alert/notifications/rules)."}),kU={name:"Critical Alerts",queryString:"env:prod service:api",teamsFilter:{type:"all-public-teams"},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"],clusterIdsFilter:[],owner:"team-123-abc",isActive:!0,tags:[{key:"channel",value:"alerts"}],targets:[{id:"789-abc-def",rateLimit:{maxMessages:10,minutes:5},config:{type:"email",addresses:["oncall@example.com"],renotifyConfig:{mode:"each",renotificationStates:["alert"],renotifyIntervalMinutes:30}}}]},Zz={id:"123-456-abc",...kU};Object.assign(As,{examples:[Zz]});var MU=m({description:"Lists notification rules visible to the authenticated operation key. Use this endpoint to audit alert delivery routing. Pagination fields limit the returned page.",operationId:"listNotificationRules",tags:["notification-rules"],url:Os,method:"GET",paginated:!0,query:t.Object(De),response:t.Array(As)}),DU=m({description:"Retrieves one notification rule by ID.",operationId:"getNotificationRule",tags:["notification-rules"],url:`${Os}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification rule to retrieve. Use the `id` returned by notification rule list or create responses."})}),response:As}),df=t.Pick($a,["name","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter","clusterIdsFilter","owner","tags","isActive","targets"],{description:"Notification rule create or update request. Provide matching filters, owner, tags, active state, and delivery targets."}),Xz=kU;Object.assign(df,{examples:[Xz]});var GU=m({description:"Creates a notification rule that matches alert transitions and sends notifications to configured targets. Monitors keep evaluating separately from notification rules.",operationId:"createNotificationRule",tags:["notification-rules"],url:Os,method:"POST",body:df,response:As}),$U=m({description:"Updates an existing notification rule by ID. Required fields and the submitted target list are overwritten; omitted optional fields keep their existing values.",operationId:"updateNotificationRule",tags:["notification-rules"],url:`${Os}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification rule to update. Use the `id` returned by notification rule list, get, or create responses."})}),body:df,response:As}),Jz=t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification rule to delete. Use the `id` returned by notification rule list, get, create, or update responses."})}),jU=m({description:"Deletes a notification rule by ID. Alerting monitors continue to evaluate, but this rule no longer sends notifications.",operationId:"deleteNotificationRule",tags:["notification-rules"],url:`${Os}/:id`,method:"DELETE",params:Jz,response:x});var Pi=`${ei}/silences`,BU=t.Union([t.Literal("monday"),t.Literal("tuesday"),t.Literal("wednesday"),t.Literal("thursday"),t.Literal("friday"),t.Literal("saturday"),t.Literal("sunday")]),e3=t.Partial(t.Record(BU,t.Array(t.Object({startTime:t.String({format:ol,description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:t.String({format:ol,description:"Local end time for this recurring silence window on this day. It must be after `startTime`, and ranges on the same day cannot overlap."})},{title:"SilenceTimeRange"}),{minItems:1,description:"Silence windows for this day. Each window uses the schedule time zone, and windows on the same day cannot overlap."})),{description:"Recurring silence windows keyed by day of week, evaluated in the schedule `timeZone` or in UTC when it is omitted. At least one day must be listed, and a day with no entry is never silenced. Each window covers `startTime` up to but not including `endTime`."}),t3=t.Partial(t.Record(BU,t.Array(t.Object({startTime:t.String({description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:t.String({description:"Local end time for this recurring silence window on this day. It must be after `startTime`, and ranges on the same day cannot overlap."})},{title:"SilenceTimeRange"}),{description:"Silence windows for this day. Each window uses the schedule time zone, and windows on the same day cannot overlap."})),{description:"Recurring silence windows keyed by day of week, evaluated in the schedule `timeZone` or in UTC when it is omitted. A day with no entry is never silenced. Each window covers `startTime` up to but not including `endTime`."}),Fp='IANA timezone identifier (e.g. "America/New_York"). Defaults to UTC if omitted.',qU="One-time silence schedule with specific start and end times",FU="Recurring weekly silence schedule",r3=b("type",[t.Object({type:t.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:t.String({format:il,description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:t.String({format:il,description:"Local end date and time for the one-time silence. It must be after `startTime` and in the future."}),timeZone:t.Optional(t.String({format:nl,description:Fp}))},{$id:"InputSilenceScheduleOneTime",description:qU}),t.Object({type:t.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:e3,timeZone:t.Optional(t.String({format:nl,description:Fp}))},{$id:"InputSilenceScheduleRecurring",description:FU})],{description:"Schedule defining when the silence is active. The `type` field discriminates between a `one-time` window and a `recurring` weekly window. Once a one-time schedule's `endTime` passes, or a recurring window closes, the silence stops suppressing notifications but is not deleted; delete it explicitly if it is no longer needed."}),n3=b("type",[t.Object({type:t.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:t.String({description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:t.String({description:"Local end date and time for the one-time silence. It must be after `startTime` and in the future when created or updated."}),timeZone:t.Optional(t.String({description:Fp}))},{$id:"OutputSilenceScheduleOneTime",description:qU}),t.Object({type:t.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:t3,timeZone:t.Optional(t.String({description:Fp}))},{$id:"OutputSilenceScheduleRecurring",description:FU})],{description:"Schedule defining when the silence is active. The `type` field discriminates between a `one-time` window and a `recurring` weekly window. Once a one-time schedule's `endTime` passes, or a recurring window closes, the silence stops suppressing notifications but is not deleted; delete it explicitly if it is no longer needed."}),Hp=t.Object({name:p({description:"Display name of the silence"}),reason:p({allowEmpty:!1,type:"long",description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the silence"}),tags:$e,isActive:t.Boolean({description:"Set to true for the silence to suppress matching notifications while its schedule is active. Set to false to keep the silence without suppressing anything."}),schedule:r3,notificationRuleIds:t.Optional(t.Array(p(),{description:"Notification rule IDs this silence applies to directly, matching any notification produced by one of these rules regardless of priority or transition type. Mutually exclusive with `prioritiesFilter`, `transitionTypesFilter`, and `queryString`: a request combining this field with any of those is rejected."})),queryString:t.Optional(p({type:"tags-query",description:"Query string to filter which alerts this silence applies to"})),teamsFilter:em,prioritiesFilter:t.Array(t.Enum(dt),{maxItems:dt.length,description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(zn),{maxItems:zn.length,description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."})}),Ui=t.Object({id:t.String({description:"Tsuga-generated notification silence ID assigned when the silence is created."}),name:t.String({description:"Display name of the silence"}),reason:t.String({description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:t.String({description:"Team ID that owns and manages the silence"}),tags:Re,isActive:t.Boolean({description:"Whether the silence suppresses matching notifications while its schedule is active. When false, the silence is kept but never suppresses anything."}),schedule:n3,notificationRuleIds:t.Optional(t.Array(t.String(),{description:"Notification rule IDs this silence applies to directly, matching any notification produced by one of these rules regardless of priority or transition type. Set only when `prioritiesFilter`, `transitionTypesFilter`, and `queryString` are not used to filter alerts."})),queryString:t.Optional(t.String({description:"Query string filtering which alerts this silence applies to"})),teamsFilter:Jl,prioritiesFilter:t.Array(t.Enum(dt),{description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(zn),{description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."}),createdAt:E(),updatedAt:E(),creator:t.Optional(ae),updater:t.Optional(ae)}),N6e=m({tags:["notification-silences"],url:Pi,method:"GET",response:t.Array(Ui)}),L6e=m({tags:["notification-silences"],url:`${Pi}/:id`,params:t.Object({id:p()}),method:"GET",response:Ui}),v6e=m({tags:["notification-silences"],url:Pi,method:"POST",body:Hp,response:Ui}),k6e=m({tags:["notification-silences"],url:`${Pi}/:id`,method:"PUT",params:t.Object({id:p()}),body:Hp,response:Ui}),M6e=m({tags:["notification-silences"],url:`${Pi}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),D6e=m({tags:["notification-silences"],url:`${Pi}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})});var xs=`/${"v1"}/notification-silences`,Rs=t.Pick(Ui,["id","name","reason","owner","tags","isActive","schedule","notificationRuleIds","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter"],{$id:"NotificationSilence",description:"Scheduled mute rule that suppresses matching notification delivery while monitors continue evaluating. See [Silences](/documentation/alert/notifications/silences)."}),o3={id:"sil-weekend-maintenance",name:"Weekend maintenance",reason:"Suppress expected alerts during the weekly maintenance window.",owner:"team-123-abc",tags:[{key:"environment",value:"production"}],isActive:!0,schedule:{type:"recurring",weeklySchedule:{saturday:[{startTime:"02:00",endTime:"06:00"}],sunday:[{startTime:"02:00",endTime:"06:00"}]},timeZone:"UTC"},teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"]},i3={id:"sil-critical-routing",name:"Critical routing maintenance",reason:"Temporarily suppress notifications from the critical routing rule.",owner:"team-123-abc",tags:[{key:"change",value:"chg-1234"}],isActive:!0,schedule:{type:"one-time",startTime:"2026-07-04T02:00:00",endTime:"2026-07-04T04:00:00",timeZone:"UTC"},notificationRuleIds:["rule-critical-routing"],teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[],transitionTypesFilter:[]};Object.assign(Rs,{examples:[o3,i3]});var HU=m({description:"Lists notification silences visible to the authenticated operation key. Use this endpoint to audit maintenance windows and notification muting rules.",operationId:"listNotificationSilences",tags:["notification-silences"],url:xs,method:"GET",response:t.Array(Rs)}),KU=m({description:"Retrieves one notification silence by ID.",operationId:"getNotificationSilence",tags:["notification-silences"],url:`${xs}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification silence to retrieve. Use the `id` returned by notification silence list or create responses."})}),response:Rs}),ff=t.Pick(Hp,["name","reason","owner","tags","isActive","schedule","notificationRuleIds","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter"],{description:"Notification silence create or update request. Provide the mute reason, owner, schedule, filters, active state, and tags."}),a3={name:"Weekend maintenance",reason:"Suppress expected alerts during the weekly maintenance window.",owner:"team-123-abc",tags:[{key:"environment",value:"production"}],isActive:!0,schedule:{type:"recurring",weeklySchedule:{saturday:[{startTime:"02:00",endTime:"06:00"}],sunday:[{startTime:"02:00",endTime:"06:00"}]},timeZone:"UTC"},teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"]},s3={name:"Critical routing maintenance",reason:"Temporarily suppress notifications from the critical routing rule.",owner:"team-123-abc",tags:[{key:"change",value:"chg-1234"}],isActive:!0,schedule:{type:"one-time",startTime:"2026-07-04T02:00:00",endTime:"2026-07-04T04:00:00",timeZone:"UTC"},notificationRuleIds:["rule-critical-routing"],teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[],transitionTypesFilter:[]};Object.assign(ff,{examples:[a3,s3]});var zU=m({description:"Creates a notification silence. Matching notifications that have not yet been sent are suppressed as soon as the schedule becomes active, including ones already queued when the silence is created; monitor evaluation itself is not paused, so alerts still transition and are visible in the UI.",operationId:"createNotificationSilence",tags:["notification-silences"],url:xs,method:"POST",body:ff,response:Rs}),YU=m({description:"Updates an existing notification silence by ID. Required fields are overwritten; omitted optional fields keep their existing values.",operationId:"updateNotificationSilence",tags:["notification-silences"],url:`${xs}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification silence to update. Use the `id` returned by notification silence list, get, or create responses."})}),body:ff,response:Rs}),c3=t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification silence to delete. Use the `id` returned by notification silence list, get, create, or update responses."})}),VU=m({description:"Deletes a notification silence. Any notification not yet sent is re-evaluated against the remaining silences and, if none match, is delivered normally; notifications already marked as silenced are not resent.",operationId:"deleteNotificationSilence",tags:["notification-silences"],url:`${xs}/:id`,method:"DELETE",params:c3,response:x});var p3={critical:3,important:2,normal:1},oe=e=>({label:e,weight:p3[e]}),u3={"unrouted-logs":{key:"unrouted-logs",title:"Logs with no matching route",summary:"Any log that reaches processing without a matched route is flagged.",rationale:"Close gaps by ensuring each event flows through a governed route.",objectType:"route",category:"observability-assets",impact:oe("important"),recommendation:"Ensure each team maintains a route that captures all of its logs exactly once."},"no-over-routed-logs":{key:"no-over-routed-logs",title:"No logs matching 3+ routes",summary:"Detects logs that match 3 or more processing routes during the lookback window.",rationale:"A log usually only needs one or two routes. Matching many routes typically means the route queries overlap unintentionally, multiplying the processing and storage cost without adding observability value.",objectType:"route",category:"observability-assets",impact:oe("important"),recommendation:"Review the route queries owned by this team for overlap. Tighten the filter on each route so a given log matches the minimum number of routes needed (usually one)."},"team-has-route":{key:"team-has-route",title:"\u22651 route per team",summary:"Each team owns at least one active route that filters on its team name.",rationale:"Provides clear governance boundaries for routing and enrichment.",objectType:"route",category:"observability-assets",impact:oe("important"),recommendation:"Ensure every team manages a dedicated route scoped to its context.team value."},"service-name-present":{key:"service-name-present",title:`${ap} present`,summary:`Logs and spans must populate ${ap} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:oe("critical"),recommendation:`Populate ${ap} in all log and span payloads.`},"no-orphan-spans":{key:"no-orphan-spans",title:"No orphan spans",summary:"Every span with parent_span_id references an existing span in the same trace.",rationale:"Trace integrity depends on preserving parent-child hierarchies.",objectType:"span",category:"telemetry-hygiene",impact:oe("normal"),recommendation:"Emit parent spans before their children so references always resolve."},"metric-unit-consistency":{key:"metric-unit-consistency",title:"Name\u2192unit consistency",summary:"All series for a metric name report the same UCUM-compliant unit across the lookback period.",rationale:"Avoid ambiguity when charting and alerting on metrics with shared names.",objectType:"metric",category:"telemetry-hygiene",impact:oe("important"),recommendation:"Align exporters so each metric name emits a single consistent unit across services and environments."},"host-name-present":{key:"host-name-present",title:`${ka} presence`,summary:`Logs and spans must populate ${ka} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:oe("important"),recommendation:`Populate ${ka} in all log and span payloads.`},"inconsistent-attribute-naming":{key:"inconsistent-attribute-naming",title:"Consistent attribute naming",summary:"Detects attributes with multiple naming variants (e.g., userId vs user_id).",rationale:"Consistent naming improves queryability.",objectType:"log",category:"telemetry-hygiene",impact:oe("normal"),recommendation:"Standardize attribute naming conventions across all log sources."},"no-duplicate-attr-values":{key:"no-duplicate-attr-values",title:"No duplicate attribute values",summary:"Detects when different attributes consistently carry identical values across logs (e.g., err.type and error.type always having the same value).",rationale:"Redundant attributes waste storage and complicate querying. Consolidate to one.",objectType:"log",category:"telemetry-hygiene",impact:oe("normal"),recommendation:"Consolidate duplicate attributes at the source to reduce storage costs."},"no-debug-logs-in-prod":{key:"no-debug-logs-in-prod",title:"No DEBUG logs in production",summary:"Detects DEBUG-level logs emitted in production environments.",rationale:"DEBUG logs in production increase costs and risk exposing sensitive data.",objectType:"log",category:"telemetry-hygiene",impact:oe("important"),recommendation:"Remove DEBUG-level logging from production environment or adjust log level configuration."},"no-multiline-logs":{key:"no-multiline-logs",title:"No ungrouped multiline logs",summary:"Detects orphaned stack-trace and traceback continuation lines that should have been grouped into a single log entry by the collector.",rationale:"Ungrouped multiline logs fragment errors across many entries, making them harder to read, search, and alert on.",objectType:"log",category:"telemetry-hygiene",impact:oe("important"),recommendation:"Configure multiline grouping on the log collector using a line_start_pattern (e.g. a timestamp regex) so stack traces are sent as a single entry."},"no-error-logs-as-info":{key:"no-error-logs-as-info",title:"No error logs mapped as info",summary:"Detects INFO-level logs that carry error fields such as error.*, err.*, exception.*, or a stack trace.",rationale:"A log with error or exception attributes but an INFO severity is never surfaced as an error, so teams miss real failures caused by a misconfigured level mapper or bad logging.",objectType:"log",category:"telemetry-hygiene",impact:oe("important"),recommendation:"Map these logs to ERROR in the level mapper, or fix the source logging so errors and exceptions are emitted at the right severity."},"no-empty-dashboards":{key:"no-empty-dashboards",title:"No empty dashboards",summary:"Flags dashboards with 1 or fewer widgets.",rationale:"Empty or near-empty dashboards add clutter and make it harder to find useful dashboards.",objectType:"dashboard",category:"observability-assets",impact:oe("normal"),recommendation:"Add meaningful widgets to dashboards or remove empty ones to reduce clutter."},"monitor-has-notification":{key:"monitor-has-notification",title:"No monitors without notification",summary:"Every monitor has at least one active notification destination configured.",rationale:"A monitor without notifications is effectively silent - it detects issues but nobody is alerted.",objectType:"monitor",category:"observability-assets",impact:oe("important"),recommendation:"Add a notification destination to every monitor - a monitor without notifications is effectively silent."},"no-future-dated-logs":{key:"no-future-dated-logs",title:"No future-dated logs",summary:"Detects logs with timestamps more than 59 minutes ahead of their intake time.",rationale:"Future-dated logs break dashboards, alerting, and log ordering - they indicate clock skew or incorrect timestamp generation.",objectType:"log",category:"telemetry-hygiene",impact:oe("important"),recommendation:"Fix clock synchronization or timestamp generation for services emitting future-dated logs - they break dashboards and alerting."},"metric-usage":{key:"metric-usage",title:"Metric usage",summary:"Percentage of ingested metrics that are referenced by a dashboard or monitor, or were queried in the last 30 days.",rationale:"Metrics that are never visualized, alerted on, or queried add ingestion cost and cardinality without providing value.",objectType:"metric",category:"telemetry-adoption",impact:oe("important"),recommendation:"Stop emitting metrics that are never referenced or queried to reduce ingestion cost and cardinality.",scope:"global"},"no-stale-dashboards":{key:"no-stale-dashboards",title:"No stale dashboards",summary:"Flags dashboards that have not been edited in over 180 days.",rationale:"Stale dashboards may contain outdated queries or irrelevant data, making it harder for teams to find useful, up-to-date information.",objectType:"dashboard",category:"observability-assets",impact:oe("normal"),recommendation:"Review and update dashboards that haven't been edited in 180+ days, or archive them if no longer relevant."},"no-unused-dashboards":{key:"no-unused-dashboards",title:"No unused dashboards",summary:"Flags dashboards with zero views in the last 60 days.",rationale:"Dashboards that nobody views add clutter and may confuse team members looking for relevant information.",objectType:"dashboard",category:"telemetry-adoption",impact:oe("important"),recommendation:"Archive or delete dashboards that nobody has viewed in the last 60 days to reduce noise."},"no-orphan-monitors":{key:"no-orphan-monitors",title:"No monitors without dashboards",summary:"Every monitor should be linked to at least one dashboard.",rationale:"Monitors without a linked dashboard make it harder for teams to investigate alerts \u2014 responders need a dashboard to quickly understand the context and scope of an issue.",objectType:"monitor",category:"observability-assets",impact:oe("important"),recommendation:"Link monitors to relevant dashboards so teams can quickly investigate when alerts fire."},"no-flapping-monitors":{key:"no-flapping-monitors",title:"No flappy monitors",summary:"P1/P2 monitors should not have any group (or the monitor itself) trigger 7+ alerts within 7 days.",rationale:"Monitors that constantly flip between alert and OK cause alert fatigue. Teams start ignoring notifications, increasing the risk of missing real incidents.",objectType:"monitor",category:"observability-assets",impact:oe("important"),recommendation:"Tune thresholds, add hysteresis, or adjust evaluation windows to reduce flapping."},"no-noisy-group-monitors":{key:"no-noisy-group-monitors",title:"No noisy group-by monitors",summary:"P1/P2 group-by monitors should not have 5+ groups triggering alerts simultaneously on 2+ occasions within 7 days.",rationale:"When a group-by monitor triggers alerts for many groups at once repeatedly, the signal gets lost in noise. Responders cannot prioritize and the monitor effectively becomes useless.",objectType:"monitor",category:"observability-assets",impact:oe("important"),recommendation:"Narrow the group-by scope, raise thresholds, or split into more targeted monitors."},"no-long-alert-monitors":{key:"no-long-alert-monitors",title:"No monitors stuck in alert",summary:"P1/P2 monitors should not remain in alert state for more than 15 days.",rationale:"A high-priority monitor stuck in alert for weeks signals an unresolved issue or a misconfigured threshold. Either way, the alert loses meaning and contributes to alert fatigue.",objectType:"monitor",category:"observability-assets",impact:oe("important"),recommendation:"Investigate and resolve the underlying issue, adjust the threshold, or acknowledge and close the alert."},"no-redundant-monitors":{key:"no-redundant-monitors",title:"No redundant monitors",summary:"P1/P2 monitors should not always trigger at the same time as another monitor (3+ co-triggers within 7 days).",rationale:"A monitor that always fires alongside another monitor is redundant. It adds noise without providing additional signal, making it harder for responders to identify the root cause.",objectType:"monitor",category:"observability-assets",impact:oe("important"),recommendation:"Investigate whether the redundant monitor can be removed or consolidated with the one it always co-triggers with."},"no-absent-log-fields":{key:"no-absent-log-fields",title:"No absent log fields",summary:"Dashboards and monitors should reference log fields that still appear in recent logs (last 24 hours).",rationale:"References to log fields that no longer exist silently break dashboards and monitors, eroding trust in observability.",objectType:"dashboard",category:"observability-assets",impact:oe("important"),recommendation:"Remove, rename, or backfill log fields that are referenced by dashboards or monitors but have not been seen in the last 24 hours.",scope:"global"},"k8s-recommended-attributes":{key:"k8s-recommended-attributes",title:"Kubernetes recommended resource attributes",summary:"Kubernetes logs and spans should populate core identity attributes and at least one workload-ownership attribute.",rationale:"These attributes let Tsuga correlate telemetry with the Kubernetes objects that produced it, which is required for faulty-deployment detection and rollback suggestions.",objectType:"resource",category:"collection-coverage",impact:oe("important"),recommendation:"Make sure every Kubernetes workload emits k8s.cluster.name, k8s.namespace.name, k8s.pod.name, k8s.pod.uid, k8s.container.name, k8s.node.name and one workload-ownership attribute (for example via the OpenTelemetry Collector k8s_attributes processor)."},"k8s-recommended-metrics":{key:"k8s-recommended-metrics",title:"Kubernetes recommended cluster metrics",summary:"All recommended Kubernetes cluster metrics are collected.",rationale:"These metrics are the primary signals for faulty-deployment detection; without k8s.container.status.reason and the usage/limit pairs, container crash loops and resource starvation cannot be diagnosed.",objectType:"metric",category:"collection-coverage",impact:oe("important"),recommendation:"Enable the OpenTelemetry Collector k8s_cluster receiver (for example via the Tsuga Helm chart) so the required Kubernetes metrics are emitted.",scope:"global"},"k8s-recommended-change-events":{key:"k8s-recommended-change-events",title:"Kubernetes recommended change events",summary:"Change events are collected for the Kubernetes object kinds recommended for rollback suggestions.",rationale:"Faulty-deployment detection needs the history of ReplicaSet, Deployment, Pod and Node changes to identify failing revisions and propose rollbacks.",objectType:"log",category:"collection-coverage",impact:oe("important"),recommendation:"Configure the Kubernetes change-event collector (for example the OpenTelemetry k8sobjects receiver) so change events for Pod, Deployment, ReplicaSet, StatefulSet, DaemonSet, Namespace and Node are ingested."},"otel-collector-self-metrics":{key:"otel-collector-self-metrics",title:"OpenTelemetry Collector self-metrics",summary:"A cluster collecting Kubernetes metrics through an OpenTelemetry Collector also emits the collector self-metrics (otelcol_*).",rationale:"The Kubernetes receivers feed the Kubernetes explorer. Without the collector self-metrics there is no way to tell a healthy pipeline from one that drops data or fails to export, so a stale or missing Kubernetes view cannot be explained.",objectType:"metric",category:"collection-coverage",impact:oe("important"),recommendation:"Enable the collector's internal telemetry (service.telemetry.metrics) and export it to Tsuga so otelcol_* metrics are available.",scope:"global"},"use-standard-attributes":{key:"use-standard-attributes",title:"Standard attribute usage",summary:"Detects log attributes that should be remapped to Tsuga standard attributes.",rationale:"Standard attributes enable consistent querying, out-of-the-box dashboards, and cross-team correlation.",objectType:"log",category:"telemetry-hygiene",impact:oe("important"),recommendation:"Use the attribute remapper in your routes to rename attributes to their standard equivalents."},"no-unused-operation-api-keys":{key:"no-unused-operation-api-keys",title:"No unused operation API keys",summary:"Flags operation API keys with no activity in the last 180 days.",rationale:"Long-idle operation credentials add risk if leaked and clutter the inventory. Tracking last-used activity makes it easy to rotate or delete the unused ones.",objectType:"api-key",category:"observability-assets",impact:oe("important"),recommendation:"Rotate or delete operation API keys that have not been used in the last 180 days."},"no-unused-ingestion-api-keys":{key:"no-unused-ingestion-api-keys",title:"No unused ingestion API keys",summary:"Flags ingestion API keys with no telemetry in the last 30 days across any cluster.",rationale:"Dormant ingestion credentials add risk if leaked and clutter the inventory. Tracking key activity makes it easy to rotate or delete the unused ones.",objectType:"api-key",category:"observability-assets",impact:oe("important"),recommendation:"Rotate or delete ingestion API keys that have sent no data in the last 30 days."},"db-logs-trace-correlation":{key:"db-logs-trace-correlation",title:"Database logs correlated with traces",summary:`Database logs should carry ${uO} so they can be tied back to the trace that issued the query.`,rationale:"Linking database server logs to client traces lets users jump from a slow request to the exact query log. Without a trace id, database logs cannot be joined to the request that produced them.",objectType:"log",category:"telemetry-hygiene",impact:oe("normal"),recommendation:"Enable trace correlation on the database log pipeline (for example via SQLcommenter, which embeds the traceparent in each statement) so query logs carry a trace id.",scope:"team"},"db-server-metrics-collected":{key:"db-server-metrics-collected",title:"Database server metrics collected",summary:"Every database technology seen in client spans should have its OpenTelemetry server-metrics receiver configured.",rationale:"Server metrics (connections, throughput, replication, contention) are needed to investigate database slowness beyond what client spans show. A detected database with no server metrics has a gap in its monitoring setup.",objectType:"metric",category:"collection-coverage",impact:oe("important"),recommendation:"Configure the matching OpenTelemetry server-metrics receiver for each detected database technology (for example postgresqlreceiver, mysqlreceiver, mongodbreceiver, redisreceiver).",scope:"global"}},l3=new Set(["azure_container_registry","azure_container_registry_image","azure_app_service_certificate","azure_virtual_network"]),m3=ds.filter(e=>e.startsWith("azure_")&&!l3.has(e)),QU={"aws-sqs-metrics-collected":{label:"Amazon SQS",source:"AWS/SQS",nativeResourceTypes:["aws_sqs_queue"],metricPrefixes:["aws_sqs_"]},"aws-sns-metrics-collected":{label:"Amazon SNS",source:"AWS/SNS",nativeResourceTypes:["aws_sns_topic"],metricPrefixes:["aws_sns_"]},"aws-kinesis-metrics-collected":{label:"Amazon Kinesis Data Streams",source:"AWS/Kinesis",nativeResourceTypes:["aws_kinesis_data_stream"],metricPrefixes:["aws_kinesis_"]},"aws-dynamodb-metrics-collected":{label:"Amazon DynamoDB",source:"AWS/DynamoDB",nativeResourceTypes:["aws_dynamodb_table"],metricPrefixes:["aws_dynamodb_"]},"aws-rds-metrics-collected":{label:"Amazon RDS",source:"AWS/RDS",nativeResourceTypes:["aws_rds_instance"],metricPrefixes:["aws_rds_"]},"aws-elasticache-metrics-collected":{label:"Amazon ElastiCache",source:"AWS/ElastiCache",nativeResourceTypes:["aws_elasticache"],metricPrefixes:["aws_elasticache_"]},"aws-s3-metrics-collected":{label:"Amazon S3",source:"AWS/S3",nativeResourceTypes:["aws_s3_bucket"],metricPrefixes:["aws_s3_"]},"aws-ebs-metrics-collected":{label:"Amazon EBS",source:"AWS/EBS",nativeResourceTypes:["aws_ebs_volume"],metricPrefixes:["aws_ebs_"]},"aws-efs-metrics-collected":{label:"Amazon EFS",source:"AWS/EFS",nativeResourceTypes:["aws_efs"],metricPrefixes:["aws_efs_"]},"aws-ec2-metrics-collected":{label:"Amazon EC2",source:"AWS/EC2",nativeResourceTypes:["aws_ec2_instance"],metricPrefixes:["aws_ec2_"]},"aws-lambda-metrics-collected":{label:"AWS Lambda",source:"AWS/Lambda",nativeResourceTypes:["aws_lambda_function"],metricPrefixes:["aws_lambda_"]},"aws-ecs-metrics-collected":{label:"Amazon ECS",source:"AWS/ECS",nativeResourceTypes:["aws_ecs_cluster","aws_ecs_service","aws_ecs_task"],metricPrefixes:["aws_ecs_"]},"aws-ecr-metrics-collected":{label:"Amazon ECR",source:"AWS/ECR",nativeResourceTypes:["aws_ecr_repository"],metricPrefixes:["aws_ecr_"]},"aws-elb-metrics-collected":{label:"Elastic Load Balancing",source:"AWS/ApplicationELB, AWS/NetworkELB",nativeResourceTypes:["aws_elastic_load_balancer"],metricPrefixes:["aws_applicationelb_","aws_networkelb_","aws_gatewayelb_","aws_elb_"]},"aws-cloudfront-metrics-collected":{label:"Amazon CloudFront",source:"AWS/CloudFront",nativeResourceTypes:["aws_cloudfront_distribution"],metricPrefixes:["aws_cloudfront_"]},"aws-acm-metrics-collected":{label:"AWS Certificate Manager",source:"AWS/CertificateManager",nativeResourceTypes:["aws_acm_certificate"],metricPrefixes:["aws_certificatemanager_"]},"gcp-pubsub-metrics-collected":{label:"Google Cloud Pub/Sub",source:"pubsub.googleapis.com",nativeResourceTypes:["gcp_pubsub_topic"],metricPrefixes:["pubsub.googleapis.com/"]},"gcp-storage-metrics-collected":{label:"Google Cloud Storage",source:"storage.googleapis.com",nativeResourceTypes:["gcp_bucket"],metricPrefixes:["storage.googleapis.com/"]},"gcp-compute-metrics-collected":{label:"Google Compute Engine",source:"compute.googleapis.com",nativeResourceTypes:["gcp_compute_instance","gcp_compute_disk"],metricPrefixes:["compute.googleapis.com/"]},"gcp-cloud-sql-metrics-collected":{label:"Google Cloud SQL",source:"cloudsql.googleapis.com",nativeResourceTypes:["gcp_cloud_sql_instance"],metricPrefixes:["cloudsql.googleapis.com/"]},"gcp-gke-metrics-collected":{label:"Google Kubernetes Engine",source:"kubernetes.io, container.googleapis.com",nativeResourceTypes:["gcp_gke_cluster"],metricPrefixes:["kubernetes.io/","container.googleapis.com/"]},"gcp-cloud-run-metrics-collected":{label:"Google Cloud Run",source:"run.googleapis.com",nativeResourceTypes:["gcp_cloud_run_service","gcp_cloud_run_job","gcp_cloud_run_function"],metricPrefixes:["run.googleapis.com/"]},"gcp-artifact-registry-metrics-collected":{label:"Google Artifact Registry",source:"artifactregistry.googleapis.com",nativeResourceTypes:["gcp_artifact_registry_repository"],metricPrefixes:["artifactregistry.googleapis.com/"]},"gcp-load-balancing-metrics-collected":{label:"Google Cloud Load Balancing",source:"loadbalancing.googleapis.com",nativeResourceTypes:["gcp_forwarding_rule"],metricPrefixes:["loadbalancing.googleapis.com/"]},"gcp-bigtable-metrics-collected":{label:"Google Cloud Bigtable",source:"bigtable.googleapis.com",nativeResourceTypes:["gcp_bigtable_instance"],metricPrefixes:["bigtable.googleapis.com/"]},"gcp-spanner-metrics-collected":{label:"Google Cloud Spanner",source:"spanner.googleapis.com",nativeResourceTypes:["gcp_spanner_instance"],metricPrefixes:["spanner.googleapis.com/"]},"gcp-firestore-metrics-collected":{label:"Google Cloud Firestore",source:"firestore.googleapis.com",nativeResourceTypes:["gcp_firestore_database"],metricPrefixes:["firestore.googleapis.com/"]},"gcp-app-engine-metrics-collected":{label:"Google App Engine",source:"appengine.googleapis.com",nativeResourceTypes:["gcp_app_engine_service"],metricPrefixes:["appengine.googleapis.com/"]},"azure-metrics-collected":{label:"Azure",source:"Azure Monitor",nativeResourceTypes:m3,metricPrefixes:["azure_"]}},d3=Object.fromEntries(Object.keys(QU).map(e=>{let{label:r,source:n}=QU[e];return[e,{key:e,title:`${r} metrics collected`,summary:`${r} resources found in inventory should have their metrics collected.`,rationale:"A resource that appears in inventory but whose metrics are not collected leaves its dashboards and resource-explorer views empty and impossible to alert on.",objectType:"metric",category:"collection-coverage",impact:oe("important"),recommendation:`Enable the ${n} metrics integration so ${r} metrics are ingested.`,scope:"global"}]})),f3={...u3,...d3},WU=Object.values(f3);var ZU=["passed","failed","ignored"],g3=t.Enum(ZU,{description:"Evaluation outcome for this rule row. Allowed values are passed, failed, and ignored; ignored means the rule was not applicable to the available data."}),y3=["aws-sqs-metrics-collected","aws-sns-metrics-collected","aws-kinesis-metrics-collected","aws-dynamodb-metrics-collected","aws-rds-metrics-collected","aws-elasticache-metrics-collected","aws-s3-metrics-collected","aws-ebs-metrics-collected","aws-efs-metrics-collected","aws-ec2-metrics-collected","aws-lambda-metrics-collected","aws-ecs-metrics-collected","aws-ecr-metrics-collected","aws-elb-metrics-collected","aws-cloudfront-metrics-collected","aws-acm-metrics-collected","gcp-pubsub-metrics-collected","gcp-storage-metrics-collected","gcp-compute-metrics-collected","gcp-cloud-sql-metrics-collected","gcp-gke-metrics-collected","gcp-cloud-run-metrics-collected","gcp-artifact-registry-metrics-collected","gcp-load-balancing-metrics-collected","gcp-bigtable-metrics-collected","gcp-spanner-metrics-collected","gcp-firestore-metrics-collected","gcp-app-engine-metrics-collected","azure-metrics-collected"],yf=["unrouted-logs","no-over-routed-logs","team-has-route","service-name-present","no-orphan-spans","metric-unit-consistency","host-name-present","inconsistent-attribute-naming","no-duplicate-attr-values","no-debug-logs-in-prod","no-multiline-logs","no-error-logs-as-info","no-empty-dashboards","monitor-has-notification","no-future-dated-logs","metric-usage","no-stale-dashboards","no-unused-dashboards","no-orphan-monitors","no-flapping-monitors","no-noisy-group-monitors","no-long-alert-monitors","no-redundant-monitors","no-absent-log-fields","k8s-recommended-attributes","k8s-recommended-metrics","k8s-recommended-change-events","otel-collector-self-metrics","use-standard-attributes","no-unused-operation-api-keys","no-unused-ingestion-api-keys","db-logs-trace-correlation","db-server-metrics-collected",...y3],h3=t.Enum(yf),T3=["log","metric","resource","span","api-key","dashboard","monitor","route"],E3=["collection-coverage","telemetry-hygiene","observability-assets","telemetry-adoption"],_3=["critical","important","normal"],I3=["team","global"],hf=t.Object({key:t.Enum(yf),title:t.String(),summary:t.String(),rationale:t.String(),objectType:t.Enum(T3),category:t.Enum(E3),impact:t.Object({label:t.Enum(_3),weight:t.Number()}),recommendation:t.String(),scope:t.Optional(t.Enum(I3))}),XU=t.Object({type:t.String({description:"Tsuga asset kind referenced by this example (e.g. `monitor`)"}),label:t.String({description:"Human-readable summary of the example"}),link:t.Object({to:t.String({description:"In-app route the example deep-links to"}),search:t.Optional(t.Unknown({description:"Search-query payload for the deep link"})),params:t.Optional(t.Unknown({description:"Route params for the deep link"}))},{description:"In-app deep link to inspect the example"})}),gf=t.Intersect([hf,t.Object({status:g3,normalizedScore:t.Number(),details:t.Optional(t.Record(t.String(),t.Unknown())),recommendation:t.Optional(t.String()),examples:t.Optional(t.Array(XU))})]),b3=t.Object({generatedAt:t.String(),overallScore:t.Optional(t.Number()),rules:t.Array(hf),teamResults:t.Array(t.Object({teamId:t.String(),teamName:t.String(),teamWeight:t.Number(),score:t.Number(),weightedScore:t.Number(),totalWeight:t.Number(),ruleResults:t.Array(gf)})),globalResults:t.Optional(t.Object({score:t.Optional(t.Number()),ruleResults:t.Array(gf)}))}),Tf=t.Object({id:t.String({description:"Identifier of this persisted quality-report row. Generated by Tsuga when report rows are stored. Returned on every row. Treat it as an opaque ID."}),reportId:t.String({description:"Identifier shared by rows from the same report generation for the same team or global cluster-wide scope. Generated by Tsuga when the report is stored. Returned on every row."}),ruleId:t.Enum(yf,{description:"Stable key for the telemetry-quality rule evaluated by this row. Set by Tsuga from the quality-rule catalog. Returned on every row. The enum may grow as Tsuga adds rules; clients should display unknown future values as opaque rule keys if they do not have local labels."}),owner:t.Optional(t.String({description:"Team identifier this row applies to. Set to the owning team ID for team-scoped rules. Returned for team rows; omitted for global cluster-wide rows."})),status:t.Enum(ZU,{description:"Evaluation outcome for this rule row. Set by the rule evaluator when the report is generated. Returned on every row. Allowed values are passed, failed, and ignored; ignored means the rule was not applicable to the available data."}),score:t.Number({description:"Normalized score for this rule row. Set by the rule evaluator when the report is generated. Returned on every row. Values are between 0 and 1."}),weight:t.Number({description:"Impact weight of this rule, captured at report-generation time. Set by Tsuga from the rule's impact label: 1 for normal, 2 for important, 3 for critical. Used with score to compute reportOverallScore."}),reportOverallScore:t.Number({description:"Aggregate score for this row's report group. Calculated by Tsuga from non-ignored rows in the same team or global cluster-wide report. Returned on every row in that group with the same value."}),reportTotalWeight:t.Number({description:"Sum of non-ignored rule weights for this row's report group. Calculated by Tsuga when the report is generated. Returned on every row in that group with the same value."}),recommendation:t.Optional(t.String({description:"Recommendation stored with this row. Set by the rule evaluator when the report is generated. Returned when a recommendation was persisted; omitted otherwise. The latest-report endpoint does not recompute or default it at read time."})),examples:t.Optional(t.Array(XU,{description:"Assets, logs, metrics, or links supporting this rule result. Set by the rule evaluator when the report is generated. Returned when examples were persisted and visible to the caller; global row examples are returned only to admin users."})),createdAt:t.String({description:"ISO timestamp the row was generated at"})}),J6e=m({tags:["quality-reports"],url:"/v0/quality-reports",method:"POST",response:b3}),Ef=t.Optional(p({allowEmpty:!1,description:"Identifier of the cluster whose latest quality-report rows are returned. Use the id from the clusters API. Required when the organization has multiple clusters; omit only in single-cluster organizations. Unknown cluster IDs return RESOURCE_NOT_FOUND."})),eQe=m({tags:["quality-reports"],url:"/v0/quality-reports/latest",method:"GET",query:t.Object({clusterId:Ef,team:t.Optional(p({allowEmpty:!1}))}),response:t.Array(Tf,{description:"Latest persisted rule evaluation rows for the cluster"})}),tQe=m({tags:["quality-reports"],url:"/v0/quality-reports/preview",method:"POST",body:t.Object({ruleKey:h3,teamId:t.Optional(p({allowEmpty:!1})),lookbackMinutes:t.Optional(t.Integer({minimum:1,maximum:60})),clusterId:t.Optional(p({allowEmpty:!1}))}),response:t.Object({rule:hf,result:gf,teamId:t.Optional(t.String()),teamName:t.Optional(t.String())})}),rQe=new Map(WU.map(e=>[e.key,e]));var S3=`/${"v1"}/quality-reports`,JU=t.Pick(Tf,["id","reportId","ruleId","owner","status","score","weight","reportOverallScore","reportTotalWeight","recommendation","examples","createdAt"],{$id:"QualityReportRow",description:"Persisted evaluation of one telemetry-quality rule for a team or cluster-wide scope. See [Quality reports](/documentation/account-and-settings/quality-reports)."}),O3={id:"01j9x3z4vyabcdfghjkmnpqrst",reportId:"01j9x3z4vyabcdfghjkmnpqrsu",ruleId:"team-has-route",owner:"01j9x3z4vyabcdfghjkmnpqrr",status:"passed",score:1,weight:2,reportOverallScore:.85,reportTotalWeight:2,createdAt:"2026-02-26T12:00:00.000Z"};Object.assign(JU,{examples:[O3]});var A3=t.Object({clusterId:Ef,team:t.Optional(p({allowEmpty:!1,description:"Team name used to scope the report. Matched against Tsuga team names. Optional; when set, returns only rows for that team and omits global rows. Unknown team names return RESOURCE_NOT_FOUND; teams the caller cannot access return an empty result."}))},{description:"Latest quality report lookup query."}),ew=m({description:"Retrieves the latest persisted quality-report rows for a cluster, optionally scoped to one team. Use this to audit telemetry hygiene and routing recommendations.",operationId:"getLatestQualityReport",tags:["quality-reports"],url:`${S3}/latest`,method:"GET",query:A3,response:t.Array(JU)});var Cs="/v0/admin-center";var gr=`${Cs}/retention-policies`,tw=3650,x3=t.Integer({description:"Number of days Tsuga retains matching telemetry."}),rw=t.Integer({minimum:1,maximum:tw,description:`Number of days Tsuga should retain matching telemetry. Valid values are 1 through ${tw}.`}),Dr=t.Object({id:t.String({description:"Unique identifier of the retention policy. Generated by Tsuga."}),env:t.Optional(t.String({description:"Environment tag value this policy applies to. Omitted policies apply across environments unless a more specific policy exists."})),teamId:t.Optional(t.String({description:"Team ID this policy applies to. Omitted policies apply globally unless a team-specific policy exists."})),dataSource:t.Enum(pr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:x3,isEnabled:t.Boolean({description:"Whether this policy participates in retention resolution."}),createdAt:E({description:"Timestamp when Tsuga created the retention policy."}),updatedAt:E({description:"Timestamp when Tsuga last updated the retention policy."})}),Kp=t.Object({env:t.Optional(p({description:"Environment tag value this policy applies to. Omit for a policy that is not environment-specific."})),teamId:t.Optional(p({description:"Team ID this policy applies to. Omit for a policy that is not team-specific."})),dataSource:t.Enum(pr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:rw,isEnabled:t.Boolean({description:"Set to true for the policy to participate in retention resolution."})}),nw=t.Array(t.Object({env:p(),dataSource:t.Enum(pr),durationDays:t.Union([rw,t.Null()]),isEnabled:t.Boolean()})),ow=t.Object({inserted:t.Array(Dr),updated:t.Array(Dr),deleted:t.Array(Dr)}),hQe=m({tags:["retention-policies"],url:gr,method:"POST",body:Kp,response:Dr}),TQe=m({tags:["retention-policies"],url:gr,method:"GET",response:t.Array(Dr)}),EQe=m({tags:["retention-policies"],url:`${gr}/:id`,method:"GET",params:t.Object({id:p()}),response:Dr}),_Qe=m({tags:["retention-policies"],url:`${gr}/:id`,method:"PUT",params:t.Object({id:p()}),body:Kp,response:Dr}),IQe=m({tags:["retention-policies"],url:`${gr}/bulk-update`,method:"POST",body:nw,response:ow}),bQe=m({tags:["retention-policies"],url:`${gr}/bulk-update-for-team`,method:"POST",body:t.Object({teamId:p(),policies:nw}),response:ow}),SQe=m({tags:["retention-policies"],url:`${gr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),Ps=["past-24-hours","past-7-days","past-30-days"],OQe=m({tags:["retention-policies"],url:`${gr}/requested-history-percentile/:teamId`,method:"POST",params:t.Object({teamId:p()}),body:t.Object({percentile:t.Number({minimum:0,maximum:1}),observationWindow:t.Enum(Ps),dataSource:t.Enum(pr)}),response:t.Object({percentile:t.Number(),observationWindow:t.Enum(Ps),dataSource:t.Enum(pr),teamId:t.String(),requestedHistoryDays:t.Number()})}),R3=["1-day","3-days","7-days","1-month","6-months","more-than-6-months"];var C3=t.Array(t.Object({bucket:t.Enum(R3),count:t.Number()})),AQe=m({tags:["retention-policies"],url:`${gr}/requested-history-histogram/:teamId`,method:"POST",params:t.Object({teamId:p()}),body:t.Object({observationWindow:t.Enum(Ps),dataSource:t.Enum(pr)}),response:t.Object({observationWindow:t.Enum(Ps),dataSource:t.Enum(pr),teamId:t.String(),histogram:C3})}),xQe=m({tags:["retention-policies"],url:`${gr}/top-teams-with-retention-surplus`,method:"POST",body:t.Object({dataSource:t.Enum(pr),observationWindow:t.Enum(Ps),percentile:t.Number({minimum:0,maximum:1}),topN:t.Optional(t.Number({minimum:1,maximum:20}))}),response:t.Array(t.Object({teamId:t.String(),retentionSurplusDays:t.Number()}))});var Us=`/${"v1"}/retention-policies`,ws=t.Pick(Dr,["id","env","teamId","dataSource","durationDays","isEnabled"],{$id:"RetentionPolicy",description:"Retention rule for logs, metrics, or traces. Policies can apply globally, to an environment, or to a team depending on which scope fields are present. See [Retention](/documentation/account-and-settings/retention)."}),P3={id:"123-456-abc",env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(ws,{examples:[P3]});var iw=m({description:"Lists retention policy rows visible to the authenticated operation key. Use this to audit retention duration by signal, environment, and team.",operationId:"listRetentionPolicies",tags:["retention-policies"],url:Us,method:"GET",response:t.Array(ws)}),aw=m({description:"Retrieves one retention policy by ID.",operationId:"getRetentionPolicy",tags:["retention-policies"],url:`${Us}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the retention policy to retrieve. Use the `id` returned by retention policy list or create responses."})}),response:ws}),_f=t.Pick(Kp,["env","teamId","dataSource","durationDays","isEnabled"],{description:"Retention policy create or update request. Provide the telemetry signal, retention duration, enabled state, and optional environment or team scope."}),U3={env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(_f,{examples:[U3]});var sw=m({description:"Creates a retention policy row for a telemetry signal, optionally scoped to an environment or team. Only one policy may exist per combination of data source, environment, and team; creating a duplicate combination fails.",operationId:"createRetentionPolicy",tags:["retention-policies"],url:Us,method:"POST",body:_f,response:ws}),cw=m({description:"Replaces an existing retention policy by ID, including signal, scope fields, duration, and enabled state.",operationId:"updateRetentionPolicy",tags:["retention-policies"],url:`${Us}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the retention policy to update. Use the `id` returned by retention policy list, get, or create responses."})}),body:_f,response:ws}),pw=m({description:"Deletes a retention policy by ID. Retention resolution falls back to the next broader matching policy when one exists.",operationId:"deleteRetentionPolicy",tags:["retention-policies"],url:`${Us}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the retention policy to delete. Use the `id` returned by retention policy list, create, or update responses."})}),response:x});var Ns=`/${"v1"}/slos`,w3=t.Pick(Ql,["id","sloId","priority","configuration"],{$id:"SloAlert",description:"Alert attached to an SLO, triggered on a burn-rate multiplier or an SLO target threshold"}),Ls=t.Object({...t.Pick(Jo,["id","name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds"]).properties,alerts:t.Array(w3,{description:"Alerts attached to this SLO"})},{$id:"Slo",description:"Service Level Objective definition: its SLI configuration, target percentage, rolling timeframe, cluster scope, and attached alerts"}),N3={id:"123-456-abc",name:"API availability 99.9%",description:"Overall API gateway availability over the last 30 days",tags:[{key:"team",value:"platform"}],configuration:{type:"event",dataSource:"logs",goodQuery:{queries:[{filter:"status:ok",aggregate:{type:"count"}}],formula:"q1"},totalQuery:{queries:[{filter:"*",aggregate:{type:"count"}}],formula:"q1"},noDataBehavior:"good"},target:99.9,timeframeDays:30,owner:"team-123-abc",permissions:"all",clusterIds:[],alerts:[{id:"alert-123-abc",sloId:"123-456-abc",priority:1,configuration:{type:"burn-rate",burnRate:14.4}}]};Object.assign(Ls,{examples:[N3]});var uw=t.Pick(Zl,["filters","sort","limit","offset"]),lw=t.Object({...uw.properties,...De,filters:uw.properties.filters},{description:"SLO query request. Use filters, sorting, limit, and offset to page through visible SLOs."}),L3={filters:{owners:{values:["team-123-abc"]},searchQuery:{value:"availability"},tags:{values:[{key:"team",value:"platform"}]},statuses:{values:["breached"]},clusterIds:{values:["cluster-123-abc"]}},sort:{by:"name",direction:"asc"},limit:10,offset:0};Object.assign(lw,{examples:[L3]});var mw=m({description:"Queries SLOs visible to the authenticated operation key. Use this endpoint to inventory SLO definitions, filter by owner, tag, status, or cluster, and page through results.",operationId:"querySlos",tags:["slos"],url:`${Ns}/query`,method:"POST",paginated:!0,body:lw,response:t.Array(Ls)}),dw=m({description:"Retrieves one SLO definition by ID.",operationId:"getSlo",tags:["slos"],url:`${Ns}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"SLO ID returned by SLO query, create, or update operations."})}),response:Ls}),fw=["name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds","alerts"],gw=t.Pick(dp,fw,{$id:"CreateSloRequest",description:"SLO creation request. Provide ownership, data access, SLI configuration, target, timeframe, optional cluster scope, and the alerts to create."}),yw=t.Pick(Wl,fw,{$id:"UpdateSloRequest",description:"SLO update request. Send all required SLO fields and the full alert list. Alerts are reconciled to exactly the provided list: alerts with a known id are updated, alerts without an id are created, and existing alerts absent from the list are deleted. Omit `clusterIds` to preserve the current cluster scope; send an empty array to run on all clusters."}),hw={name:"API availability 99.9%",description:"Overall API gateway availability over the last 30 days",tags:[{key:"team",value:"platform"}],configuration:{type:"event",dataSource:"logs",goodQuery:{queries:[{filter:"status:ok",aggregate:{type:"count"}}],formula:"q1"},totalQuery:{queries:[{filter:"*",aggregate:{type:"count"}}],formula:"q1"},noDataBehavior:"good"},target:99.9,timeframeDays:30,owner:"team-123-abc",permissions:"all",clusterIds:[],alerts:[{priority:1,configuration:{type:"burn-rate",burnRate:14.4}}]};Object.assign(gw,{examples:[hw]});Object.assign(yw,{examples:[hw]});var Tw=m({description:"Creates an SLO owned by the specified team. The SLO can be event-based (good/total queries) or time-based (a thresholded query over evaluation slices) depending on its configuration.",operationId:"createSlo",tags:["slos"],url:Ns,method:"POST",body:gw,response:Ls}),Ew=m({description:"Replaces an existing SLO definition by ID. Send the full SLO input shape, including configuration, ownership, permissions, cluster scope, and the reconciled alert list. Changing configuration, target, timeframe, permissions, or cluster scope resets evaluated SLO state, so returned status and error budget are based on data evaluated after the update.",operationId:"updateSlo",tags:["slos"],url:`${Ns}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the SLO to update. Use the `id` returned by SLO query or create."})}),body:yw,response:Ls}),_w=m({description:"Deletes an SLO by ID. Deleting an SLO stops future evaluations and removes its attached alerts.",operationId:"deleteSlo",tags:["slos"],url:`${Ns}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the SLO to delete. Use the `id` returned by SLO query or create."})}),response:x});var uo=`${Cs}/tag-policies`;var v3=["logs","metrics","traces"],If=t.Array(t.Enum(v3,{description:"Telemetry signal covered by a data tag policy."}),{description:"Telemetry signals covered by the policy. An empty array means logs, metrics, and traces."}),k3=t.Union([Kc,If]),M3=t.Object({teamIds:t.Array(t.String(),{description:"Team IDs used by this policy scope."}),mode:t.Enum(["include","exclude"],{description:"`include` applies the policy only to listed teams. `exclude` applies it to all teams except the listed teams."})},{description:"Team scope that limits where this policy applies. Omitted means the policy applies to all teams."}),D3=b("type",[t.Object({type:t.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:If,shouldInsertWarning:t.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:t.Optional(t.Number({description:"Percentage of non-compliant telemetry datapoints to drop. Omitted means no sampling drop is configured."}))},{title:"TelemetryTagPolicy"}),t.Object({type:t.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:Kc},{title:"TsugaAssetTagPolicy"})]),G3=b("type",[t.Object({type:t.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:If,shouldInsertWarning:t.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:t.Optional(t.Number({minimum:0,maximum:100,description:"Percentage of non-compliant telemetry datapoints to drop. Valid values are 0 through 100."}))},{title:"TelemetryTagPolicy"}),t.Object({type:t.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:Kc},{title:"TsugaAssetTagPolicy"})]),Iw="Policy surface and enforcement behavior. Use `telemetry` for telemetry data or `tsuga_asset` for Tsuga-managed resources.",$3=t.Unsafe({...D3,description:Iw}),j3=t.Unsafe({...G3,description:Iw}),wi=t.Object({id:t.String({description:"Tsuga-generated tag policy ID assigned when the policy is created."}),name:t.String({description:"Human-readable tag policy name."}),description:t.Optional(t.String({description:"Optional user-provided policy description."})),isActive:t.Boolean({description:"Whether Tsuga currently evaluates this policy. Reserved policies (for example the built-in `env` policy on ingestion API keys) cannot be set to false."}),tagKey:t.String({description:"Tag key enforced by this policy."}),allowedTagValues:t.Array(t.String(),{description:"Allowed values for `tagKey`. An empty array means any value is accepted when the tag exists."}),isRequired:t.Boolean({description:"Whether the tag must be present. If false, `allowedTagValues` is still enforced when the tag exists. Reserved policies cannot be set to false."}),teamScope:t.Optional(M3),configuration:$3,creator:t.Optional(ae),updater:t.Optional(ae),owner:t.Optional(t.String({description:"Team ID that owns and manages the policy."})),createdAt:E({description:"Timestamp when Tsuga created the tag policy."}),updatedAt:E({description:"Timestamp when Tsuga last updated the tag policy."}),assetUpdatedAt:E({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})});var vs=t.Object({name:p({description:"Human-readable tag policy name."}),description:t.Optional(p({description:"Optional policy description."})),isActive:t.Boolean({description:"Set to true for Tsuga to evaluate this policy. Reserved policies (for example the built-in `env` policy on ingestion API keys) reject a false value."}),tagKey:p({allowEmpty:!1,description:"Tag key enforced by this policy. Tsuga trims surrounding whitespace before storing the policy."}),allowedTagValues:t.Array(p({allowEmpty:!1}),{maxItems:1e3,description:"Allowed values for `tagKey`. Leave empty to allow any value when the tag exists. Tsuga trims each submitted value before storing the policy."}),isRequired:t.Boolean({description:"Set to true to require the tag. If false, allowed values still apply when the tag exists. Reserved policies reject a false value."}),teamScope:t.Optional(t.Object({teamIds:t.Array(p(),{minItems:1,maxItems:100,description:"Team IDs used by this policy scope."}),mode:t.Enum(["include","exclude"],{description:"`include` applies the policy only to listed teams. `exclude` applies it to all teams except the listed teams."})},{description:"Team scope to store for this policy. Omit this field to apply the policy to all teams."})),configuration:j3,owner:p({allowEmpty:!1,description:"Team ID that will own and manage the policy."})}),QQe=m({tags:["tag-policies"],url:uo,method:"GET",query:t.Object({teamIds:t.Optional(t.Array(p(),{maxItems:100})),assetTypes:t.Optional(k3),searchQuery:t.Optional(p())}),response:t.Array(wi)}),WQe=m({tags:["tag-policies"],url:`${uo}/:id`,method:"GET",params:t.Object({id:p()}),response:wi}),ZQe=m({tags:["tag-policies"],url:uo,method:"POST",body:vs,response:wi}),XQe=m({tags:["tag-policies"],url:`${uo}/:id`,method:"PUT",params:t.Object({id:p()}),body:vs,response:wi}),JQe=m({tags:["tag-policies"],url:`${uo}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),e8e=m({tags:["tag-policies"],url:`${Cs}/applicable-tag-rules`,method:"GET",query:t.Object({assetType:t.Enum(Oa),teamId:p()}),response:t.Array(t.Object({tagKey:t.String(),allowedTagValues:t.Array(t.String()),isRequired:t.Boolean(),tagPolicyId:t.String()}))}),bw=t.Object({total:t.Number(),totalNonCompliant:t.Number(),idsNonCompliant:t.Array(t.String())}),Sw=t.Union([t.Literal("ingestion-api-key"),t.Literal("operation-api-key"),t.Literal("rum-public-token"),t.Literal("dashboard"),t.Literal("log-route"),t.Literal("metric-route"),t.Literal("monitor"),t.Literal("notification-rule"),t.Literal("notification-silence"),t.Literal("slo")]),B3=t.Object({total:t.Number(),totalNonCompliant:t.Number(),byAssetType:t.Record(Sw,bw)}),q3=t.Omit(bw,["total"]),F3=t.Object({totalNonCompliant:t.Number(),byAssetType:t.Record(Sw,q3)}),Ow=t.Object({totals:B3,byTeam:t.Record(t.String(),F3)}),t8e=m({tags:["tag-policies"],url:`${uo}/:id/stats`,method:"GET",params:t.Object({id:p()}),response:Ow}),r8e=m({tags:["tag-policies"],url:`${uo}/new-policy-stats`,method:"POST",body:vs,response:Ow});var ks=`/${"v1"}/tag-policies`,Aw={name:"Required Environment Tag",description:"Requires dashboards and monitors to declare an environment.",isActive:!0,tagKey:"environment",allowedTagValues:["production","staging"],isRequired:!0,teamScope:{teamIds:["team-123-abc"],mode:"include"},configuration:{type:"tsuga_asset",assetTypes:["dashboard","monitor"]},owner:"team-123-abc"},xw={name:"Telemetry Environment Policy",description:"Warns when telemetry is missing a known deployment environment.",isActive:!0,tagKey:"deployment.environment.name",allowedTagValues:["production","staging","development"],isRequired:!0,configuration:{type:"telemetry",assetTypes:[],shouldInsertWarning:!0,dropSample:25},owner:"team-123-abc"},H3={id:"123-456-abc",...Aw},K3={id:"456-789-def",...xw},Ms=t.Pick(wi,["id","name","description","isActive","tagKey","allowedTagValues","isRequired","teamScope","configuration","owner"],{$id:"TagPolicy",description:"Policy that enforces tag requirements on Tsuga-managed assets or telemetry data. See [Tag policies](/documentation/account-and-settings/tag-policies)."}),z3=H3,Y3=K3;Object.assign(Ms,{examples:[z3,Y3]});var bf=t.Pick(vs,["name","description","isActive","tagKey","allowedTagValues","isRequired","teamScope","configuration","owner"],{description:"Tag policy create or update request. Provide policy identity, owner, enforced tag key, allowed values, team scope, active state, and asset or telemetry configuration."}),V3=Aw,Q3=xw;Object.assign(bf,{examples:[V3,Q3]});var Rw=m({description:"Lists tag policies visible to the authenticated operation key. Use this to audit required tags, allowed values, team scope, and whether each policy applies to assets or telemetry.",operationId:"listTagPolicies",tags:["tag-policies"],url:ks,method:"GET",response:t.Array(Ms)}),Cw=m({description:"Retrieves one tag policy by ID.",operationId:"getTagPolicy",tags:["tag-policies"],url:`${ks}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the tag policy to retrieve. Use the `id` returned by tag policy list or create responses."})}),response:Ms}),Pw=m({description:"Creates a tag policy for Tsuga-managed assets or telemetry data. Use the configuration type to choose the policy surface.",operationId:"createTagPolicy",tags:["tag-policies"],url:ks,method:"POST",body:bf,response:Ms}),Uw=m({description:"Replaces an existing tag policy by ID, including scope, requiredness, allowed values, owner, active state, and configuration. Reserved policies (for example the built-in `env` policy on ingestion API keys) reject changes to `tagKey` and reject `isActive: false` or `isRequired: false`.",operationId:"updateTagPolicy",tags:["tag-policies"],url:`${ks}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the tag policy to update. Use the `id` returned by tag policy list, get, or create responses."})}),body:bf,response:Ms}),ww=m({description:"Deletes a tag policy by ID. Tsuga stops evaluating the policy after deletion. Reserved policies (for example the built-in `env` policy on ingestion API keys) cannot be deleted.",operationId:"deleteTagPolicy",tags:["tag-policies"],url:`${ks}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the tag policy to delete. Use the `id` returned by tag policy list, create, or update responses."})}),response:x});var Ds=`/${"v1"}/teams`,Gs=t.Pick(Wo,["id","name","description","visibility","tags"],{$id:"Team",description:"Collection of users used to manage ownership, visibility, and access to team-owned Tsuga resources. See [Teams](/documentation/account-and-settings/teams)."}),W3={id:"team-123-abc",name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(Gs,{examples:[W3]});var Nw=m({description:"Lists teams visible to the authenticated operation key. Use this endpoint to inventory owners for resources, dashboards, monitors, routes, and policies. Pagination fields limit the returned page.",operationId:"listTeams",tags:["teams"],url:Ds,method:"GET",paginated:!0,query:t.Object(De),response:t.Array(Gs)}),Lw=m({description:"Retrieves one team by ID.",operationId:"getTeam",tags:["teams"],url:`${Ds}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the team to retrieve. Use the `id` returned by team list or create responses."})}),response:Gs}),Sf=t.Pick(pp,["name","description","visibility","tags"],{description:"Team create or update request. Provide the team name, optional description, visibility, and tags."}),Z3={name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(Sf,{examples:[Z3]});var vw=m({description:"Creates a team for ownership and access control. Use this before assigning resources to a new owner team. A new team sits outside every existing team, so the operation key must be scoped to all teams: a key scoped to its owning team cannot create teams, even with write access to teams.",operationId:"createTeam",tags:["teams"],url:Ds,method:"POST",body:Sf,response:Gs}),kw=m({description:"Replaces a team definition by ID, including name, description, visibility, and tags.",operationId:"updateTeam",tags:["teams"],url:`${Ds}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the team to update. Use the `id` returned by team list, get, or create responses."})}),body:Sf,response:Gs}),Mw=m({description:"Deletes a team. Fails while the team still owns resources (dashboards, monitors, routes, API keys, etc.); reassign or delete those first. Team memberships are removed automatically as part of the deletion.",operationId:"deleteTeam",tags:["teams"],url:`${Ds}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the team to delete. Use the `id` returned by team list, create, or update responses."})}),response:x});function X3(e){return/^[aeiou]/i.test(e)||e==="SLO"?"an":"a"}function Dw(e,r){let n=Number(r);if(Number.isNaN(n))throw new Error(`--${e} must be a number (got: ${r})`);return n}function Gw(e){let r={};return e.limit!==void 0&&(r.limit=Dw("limit",e.limit)),e.offset!==void 0&&(r.offset=Dw("offset",e.offset)),r}function Of(e){let r=e.params;if(r?.properties){let n=Object.keys(r.properties);if(n.length===1&&n[0])return n[0]}return"id"}function $w(e,r,n){let o=e.command(r.commandName).description(r.description),i=r.singularOverride??mO(r.commandName).replace(/-/g," "),a=r.pluralOverride??r.commandName.replace(/-/g," "),c=X3(i),l=o.command("list").description(r.listDescription??`List all ${a}`);if(r.listOptions)for(let d of r.listOptions)l.option(d.flag,d.description);if(r.endpoints.list.paginated===!0&&l.option("--limit <n>",`Maximum number of items to return, up to ${Fo} (default: ${Hc})`).option("--offset <n>","Number of items to skip, to request a later page"),r.enableListBody?l.option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async d=>{if(d.generateSkeleton){Q(li(r.endpoints.list));return}let f=d.data?ni({data:d.data}):{},g=await n()(r.endpoints.list,{body:{...f,...Gw(d)}});Q(g)}):l.action(async d=>{let f=Gw(d);if(r.listOptions)for(let T of r.listOptions){let _=d[T.queryParam];_!==void 0&&(f[T.queryParam]=_)}let g=await n()(r.endpoints.list,Object.keys(f).length>0?{query:f}:void 0);Q(g)}),r.endpoints.get){let d=r.endpoints.get,f=Of(d);o.command("get <ID>").description(`Get ${c} ${i} by ID`).action(async g=>{let T=await n()(d,{params:{[f]:g}});Q(T)})}if(r.endpoints.create){let d=r.endpoints.create;o.command("create").description(`Create a new ${i}`).option("-f, --file <FILE_PATH>","Read body from file (use - for stdin)").option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async f=>{if(f.generateSkeleton){Q(li(d));return}let g=ni(f),T=await n()(d,{body:g});Q(T)})}if(r.endpoints.update){let d=r.endpoints.update,f=Of(d);o.command("update <ID>").description(`Update ${c} ${i} by ID`).option("-f, --file <FILE_PATH>","Read body from file (use - for stdin)").option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async(g,T)=>{if(T.generateSkeleton){Q(li(d));return}let _=ni(T),se=await n()(d,{params:{[f]:g},body:_});Q(se)})}if(r.endpoints.delete){let d=r.endpoints.delete,f=Of(d);o.command("delete <ID>").description(`Delete ${c} ${i} by ID`).action(async g=>{let T=await n()(d,{params:{[f]:g}});Q(T)})}}var J3=[{commandName:"cloud-resources",description:"List cloud resources discovered by inventory scans",endpoints:{list:YP},enableListBody:!0},{commandName:"dashboard-folders",description:"Manage dashboard folders",endpoints:{list:eP,get:tP,create:rP,update:nP,delete:oP},enableListBody:!0},{commandName:"dashboards",description:"Manage dashboards",endpoints:{list:AP,get:xP,create:RP,update:CP,delete:PP},enableListBody:!0},{commandName:"ingestion-api-keys",description:"Manage ingestion API keys",singularOverride:"ingestion API key",pluralOverride:"ingestion API keys",endpoints:{list:MP,create:DP,update:GP,delete:$P}},{commandName:"investigations",description:"Manage investigations (beta)",endpoints:{list:QP,get:WP,create:ZP,update:XP,delete:JP}},{commandName:"monitors",description:"Manage monitors",endpoints:{list:SU,get:OU,create:NU,update:LU,delete:vU},enableListBody:!0},{commandName:"notification-rules",description:"Manage notification rules",endpoints:{list:MU,get:DU,create:GU,update:$U,delete:jU}},{commandName:"notification-silences",description:"Manage notification silences",endpoints:{list:HU,get:KU,create:zU,update:YU,delete:VU}},{commandName:"quality-reports",description:"Get the latest quality report rows for a cluster",listDescription:"Get the latest quality report rows for a cluster (pass --cluster <CLUSTER_ID> when the org has more than one cluster)",endpoints:{list:ew},listOptions:[{flag:"--team <TEAM_NAME>",description:"Only return rows for this team by name (omits cluster-wide global rows)",queryParam:"team"}]},{commandName:"retention-policies",description:"Manage retention policies",endpoints:{list:iw,get:aw,create:sw,update:cw,delete:pw}},{commandName:"log-routes",description:"Manage log routes",endpoints:{list:mU,get:dU,create:fU,update:gU,delete:yU}},{commandName:"services",description:"List and inspect services (read-only; services are inferred from telemetry)",endpoints:{list:eA,get:tA}},{commandName:"slos",description:"Manage SLOs",singularOverride:"SLO",pluralOverride:"SLOs",endpoints:{list:mw,get:dw,create:Tw,update:Ew,delete:_w},enableListBody:!0},{commandName:"tag-policies",description:"Manage tag policies",endpoints:{list:Rw,get:Cw,create:Pw,update:Uw,delete:ww}},{commandName:"teams",description:"Manage teams",endpoints:{list:Nw,get:Lw,create:vw,update:kw,delete:Mw}}];function jw(e,r){for(let n of J3)$w(e,n,r)}var Bw=require("node:child_process");var zp="@tsuga/cli@latest";function e9(){q(`Updating ${zp}`),q(` $ npm install -g ${zp}`);try{(0,Bw.execFileSync)("npm",["install","-g",zp],{stdio:["ignore","inherit","inherit"]})}catch(e){let r=e.status??1;throw new Error(`npm install -g ${zp} exited ${r}`,{cause:e})}q("Updated. Run `tsuga --version` to confirm the new version.")}function qw(e){e.command("self-update").description("Update the Tsuga CLI to the latest version via npm").action(()=>{e9()})}var wf=require("node:fs"),Uf=require("node:os"),Li=require("node:path");function t9(e,r){let n=e.slice(0,r).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function r9(e,r,n){let o=e.split(/\r\n|\n|\r/g),i="",a=(Math.log10(r+1)|0)+1;for(let c=r-1;c<=r+1;c++){let l=o[c-1];l&&(i+=c.toString().padEnd(a," "),i+=": ",i+=l,i+=`
|
|
140
140
|
`,c===r&&(i+=" ".repeat(a+n+2),i+=`^
|
|
141
|
-
`))}return i}var z=class extends Error{line;column;codeblock;constructor(r,n){let[o,i]=
|
|
141
|
+
`))}return i}var z=class extends Error{line;column;codeblock;constructor(r,n){let[o,i]=t9(n.toml,n.ptr),a=r9(n.toml,o,i);super(`Invalid TOML document: ${r}
|
|
142
142
|
|
|
143
|
-
${a}`,n),this.line=o,this.column=i,this.codeblock=a}};function
|
|
144
|
-
`,r);return e[o-1]==="\r"&&o--,o<=n?o:-1}function
|
|
143
|
+
${a}`,n),this.line=o,this.column=i,this.codeblock=a}};function n9(e,r){let n=0;for(;e[r-++n]==="\\";);return--n&&n%2}function Yp(e,r=0,n=e.length){let o=e.indexOf(`
|
|
144
|
+
`,r);return e[o-1]==="\r"&&o--,o<=n?o:-1}function Ni(e,r){for(let n=r;n<e.length;n++){let o=e[n];if(o===`
|
|
145
145
|
`)return n;if(o==="\r"&&e[n+1]===`
|
|
146
|
-
`)return n+1;if(o<" "&&o!==" "||o==="\x7F")throw new z("control characters are not allowed in comments",{toml:e,ptr:r})}return e.length}function
|
|
146
|
+
`)return n+1;if(o<" "&&o!==" "||o==="\x7F")throw new z("control characters are not allowed in comments",{toml:e,ptr:r})}return e.length}function Dt(e,r,n,o){let i;for(;;){for(;(i=e[r])===" "||i===" "||!n&&(i===`
|
|
147
147
|
`||i==="\r"&&e[r+1]===`
|
|
148
|
-
`);)r++;if(o||i!=="#")break;r=
|
|
148
|
+
`);)r++;if(o||i!=="#")break;r=Ni(e,r)}return r}function Fw(e,r,n,o,i=!1){if(!o)return r=Yp(e,r),r<0?e.length:r;for(let a=r;a<e.length;a++){let c=e[a];if(c==="#")a=Yp(e,a);else{if(c===n)return a+1;if(c===o||i&&(c===`
|
|
149
149
|
`||c==="\r"&&e[a+1]===`
|
|
150
|
-
`))return a}}throw new z("cannot find end of structure",{toml:e,ptr:r})}function
|
|
151
|
-
`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function
|
|
150
|
+
`))return a}}throw new z("cannot find end of structure",{toml:e,ptr:r})}function Vp(e,r){let n=e[r],o=n===e[r+1]&&e[r+1]===e[r+2]?e.slice(r,r+3):n;r+=o.length-1;do r=e.indexOf(o,++r);while(r>-1&&n!=="'"&&n9(e,r));return r>-1&&(r+=o.length,o.length>1&&(e[r]===n&&r++,e[r]===n&&r++)),r}var o9=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,$s=class e extends Date{#t=!1;#r=!1;#e=null;constructor(r){let n=!0,o=!0,i="Z";if(typeof r=="string"){let a=r.match(o9);a?(a[1]||(n=!1,r=`0000-01-01T${r}`),o=!!a[2],o&&r[10]===" "&&(r=r.replace(" ","T")),a[2]&&+a[2]>23?r="":(i=a[3]||null,r=r.toUpperCase(),!i&&o&&(r+="Z"))):r=""}super(r),isNaN(this.getTime())||(this.#t=n,this.#r=o,this.#e=i)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let r=super.toISOString();if(this.isDate())return r.slice(0,10);if(this.isTime())return r.slice(11,23);if(this.#e===null)return r.slice(0,-1);if(this.#e==="Z")return r;let n=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return n=this.#e[0]==="-"?n:-n,new Date(this.getTime()-n*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(r,n="Z"){let o=new e(r);return o.#e=n,o}static wrapAsLocalDateTime(r){let n=new e(r);return n.#e=null,n}static wrapAsLocalDate(r){let n=new e(r);return n.#r=!1,n.#e=null,n}static wrapAsLocalTime(r){let n=new e(r);return n.#t=!1,n.#e=null,n}};var i9=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,a9=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,s9=/^[+-]?0[0-9_]/,c9=/^[0-9a-f]{2,8}$/i,Hw={b:"\b",t:" ",n:`
|
|
151
|
+
`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function Qp(e,r=0,n=e.length){let o=e[r]==="'",i=e[r++]===e[r]&&e[r]===e[r+1];i&&(n-=2,e[r+=2]==="\r"&&r++,e[r]===`
|
|
152
152
|
`&&r++);let a=0,c,l="",d=r;for(;r<n-1;){let f=e[r++];if(f===`
|
|
153
153
|
`||f==="\r"&&e[r]===`
|
|
154
|
-
`){if(!i)throw new z("newlines are not allowed in strings",{toml:e,ptr:r-1})}else if(f<" "&&f!==" "||f==="\x7F")throw new z("control characters are not allowed in strings",{toml:e,ptr:r-1});if(c){if(c=!1,f==="x"||f==="u"||f==="U"){let g=e.slice(r,r+=f==="x"?2:f==="u"?4:8);if(!
|
|
155
|
-
`||f===" "||f===" "||f==="\r")){if(r=
|
|
156
|
-
`&&e[r]!=="\r")throw new z("invalid escape: only line-ending whitespace may be escaped",{toml:e,ptr:a});r=
|
|
157
|
-
`&&e[c]!=="\r")throw new z("unexpected character encountered",{toml:e,ptr:c});c+=+(e[c]===",")}return[d,c]}c=
|
|
158
|
-
`&&c!=="\r"){let l,d=i,f=!1,[g,T]=
|
|
159
|
-
`&&a!=="\r"){let c=
|
|
160
|
-
`&&e[l]!=="\r")throw new z("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:l});l=
|
|
154
|
+
`){if(!i)throw new z("newlines are not allowed in strings",{toml:e,ptr:r-1})}else if(f<" "&&f!==" "||f==="\x7F")throw new z("control characters are not allowed in strings",{toml:e,ptr:r-1});if(c){if(c=!1,f==="x"||f==="u"||f==="U"){let g=e.slice(r,r+=f==="x"?2:f==="u"?4:8);if(!c9.test(g))throw new z("invalid unicode escape",{toml:e,ptr:a});try{l+=String.fromCodePoint(parseInt(g,16))}catch{throw new z("invalid unicode escape",{toml:e,ptr:a})}}else if(i&&(f===`
|
|
155
|
+
`||f===" "||f===" "||f==="\r")){if(r=Dt(e,r-1,!0),e[r]!==`
|
|
156
|
+
`&&e[r]!=="\r")throw new z("invalid escape: only line-ending whitespace may be escaped",{toml:e,ptr:a});r=Dt(e,r)}else if(f in Hw)l+=Hw[f];else throw new z("unrecognized escape sequence",{toml:e,ptr:a});d=r}else!o&&f==="\\"&&(a=r-1,c=!0,l+=e.slice(d,a))}return l+e.slice(d,n-1)}function Kw(e,r,n,o){if(e==="true")return!0;if(e==="false")return!1;if(e==="-inf")return-1/0;if(e==="inf"||e==="+inf")return 1/0;if(e==="nan"||e==="+nan"||e==="-nan")return NaN;if(e==="-0")return o?0n:0;let i=i9.test(e);if(i||a9.test(e)){if(s9.test(e))throw new z("leading zeroes are not allowed",{toml:r,ptr:n});e=e.replace(/_/g,"");let c=+e;if(isNaN(c))throw new z("invalid number",{toml:r,ptr:n});if(i){if((i=!Number.isSafeInteger(c))&&!o)throw new z("integer value cannot be represented losslessly",{toml:r,ptr:n});(i||o===!0)&&(c=BigInt(e))}return c}let a=new $s(e);if(!a.isValid())throw new z("invalid value",{toml:r,ptr:n});return a}function p9(e,r,n){let o=e.slice(r,n),i=o.indexOf("#");return i>-1&&(Ni(e,i),o=o.slice(0,i)),[o.trimEnd(),i]}function js(e,r,n,o,i){if(o===0)throw new z("document contains excessively nested structures. aborting.",{toml:e,ptr:r});let a=e[r];if(a==="["||a==="{"){let[d,f]=a==="["?Yw(e,r,o,i):zw(e,r,o,i);if(n){if(f=Dt(e,f),e[f]===",")f++;else if(e[f]!==n)throw new z("expected comma or end of structure",{toml:e,ptr:f})}return[d,f]}let c;if(a==='"'||a==="'"){c=Vp(e,r);let d=Qp(e,r,c);if(n){if(c=Dt(e,c),e[c]&&e[c]!==","&&e[c]!==n&&e[c]!==`
|
|
157
|
+
`&&e[c]!=="\r")throw new z("unexpected character encountered",{toml:e,ptr:c});c+=+(e[c]===",")}return[d,c]}c=Fw(e,r,",",n);let l=p9(e,r,c-+(e[c-1]===","));if(!l[0])throw new z("incomplete key-value declaration: no value specified",{toml:e,ptr:r});return n&&l[1]>-1&&(c=Dt(e,r+l[1]),c+=+(e[c]===",")),[Kw(l[0],e,r,i),c]}var u9=/^[a-zA-Z0-9-_]+[ \t]*$/;function Wp(e,r,n="="){let o=r-1,i=[],a=e.indexOf(n,r);if(a<0)throw new z("incomplete key-value: cannot find end of key",{toml:e,ptr:r});do{let c=e[r=++o];if(c!==" "&&c!==" ")if(c==='"'||c==="'"){if(c===e[r+1]&&c===e[r+2])throw new z("multiline strings are not allowed in keys",{toml:e,ptr:r});let l=Vp(e,r);if(l<0)throw new z("unfinished string encountered",{toml:e,ptr:r});o=e.indexOf(".",l);let d=e.slice(l,o<0||o>a?a:o),f=Yp(d);if(f>-1)throw new z("newlines are not allowed in keys",{toml:e,ptr:r+o+f});if(d.trimStart())throw new z("found extra tokens after the string part",{toml:e,ptr:l});if(a<l&&(a=e.indexOf(n,l),a<0))throw new z("incomplete key-value: cannot find end of key",{toml:e,ptr:r});i.push(Qp(e,r,l))}else{o=e.indexOf(".",r);let l=e.slice(r,o<0||o>a?a:o);if(!u9.test(l))throw new z("only letter, numbers, dashes and underscores are allowed in keys",{toml:e,ptr:r});i.push(l.trimEnd())}}while(o+1&&o<a);return[i,Dt(e,a+1,!0,!0)]}function zw(e,r,n,o){let i={},a=new Set,c;for(r++;(c=e[r++])!=="}"&&c;){if(c===",")throw new z("expected value, found comma",{toml:e,ptr:r-1});if(c==="#")r=Ni(e,r);else if(c!==" "&&c!==" "&&c!==`
|
|
158
|
+
`&&c!=="\r"){let l,d=i,f=!1,[g,T]=Wp(e,r-1);for(let ge=0;ge<g.length;ge++){if(ge&&(d=f?d[l]:d[l]={}),l=g[ge],(f=Object.hasOwn(d,l))&&(typeof d[l]!="object"||a.has(d[l])))throw new z("trying to redefine an already defined value",{toml:e,ptr:r});!f&&l==="__proto__"&&Object.defineProperty(d,l,{enumerable:!0,configurable:!0,writable:!0})}if(f)throw new z("trying to redefine an already defined value",{toml:e,ptr:r});let[_,se]=js(e,T,"}",n-1,o);a.add(_),d[l]=_,r=se}}if(!c)throw new z("unfinished table encountered",{toml:e,ptr:r});return[i,r]}function Yw(e,r,n,o){let i=[],a;for(r++;(a=e[r++])!=="]"&&a;){if(a===",")throw new z("expected value, found comma",{toml:e,ptr:r-1});if(a==="#")r=Ni(e,r);else if(a!==" "&&a!==" "&&a!==`
|
|
159
|
+
`&&a!=="\r"){let c=js(e,r-1,"]",n-1,o);i.push(c[0]),r=c[1]}}if(!a)throw new z("unfinished array encountered",{toml:e,ptr:r});return[i,r]}function Vw(e,r,n,o){let i=r,a=n,c,l=!1,d;for(let f=0;f<e.length;f++){if(f){if(i=l?i[c]:i[c]={},a=(d=a[c]).c,o===0&&(d.t===1||d.t===2))return null;if(d.t===2){let g=i.length-1;i=i[g],a=a[g].c}}if(c=e[f],(l=Object.hasOwn(i,c))&&a[c]?.t===0&&a[c]?.d)return null;l||(c==="__proto__"&&(Object.defineProperty(i,c,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(a,c,{enumerable:!0,configurable:!0,writable:!0})),a[c]={t:f<e.length-1&&o===2?3:o,d:!1,i:0,c:{}})}if(d=a[c],d.t!==o&&!(o===1&&d.t===3)||(o===2&&(d.d||(d.d=!0,i[c]=[]),i[c].push(i={}),d.c[d.i++]=d={t:1,d:!1,i:0,c:{}}),d.d))return null;if(d.d=!0,o===1)i=l?i[c]:i[c]={};else if(o===0&&l)return null;return[c,i,d.c]}function Af(e,{maxDepth:r=1e3,integersAsBigInt:n}={}){let o={},i={},a=o,c=i;for(let l=Dt(e,0);l<e.length;){if(e[l]==="["){let d=e[++l]==="[",f=Wp(e,l+=+d,"]");if(d){if(e[f[1]-1]!=="]")throw new z("expected end of table declaration",{toml:e,ptr:f[1]-1});f[1]++}let g=Vw(f[0],o,i,d?2:1);if(!g)throw new z("trying to redefine an already defined table or value",{toml:e,ptr:l});c=g[2],a=g[1],l=f[1]}else{let d=Wp(e,l),f=Vw(d[0],a,c,0);if(!f)throw new z("trying to redefine an already defined table or value",{toml:e,ptr:l});let g=js(e,d[1],void 0,r,n);f[1][f[0]]=g[0],l=g[1]}if(l=Dt(e,l,!0),e[l]&&e[l]!==`
|
|
160
|
+
`&&e[l]!=="\r")throw new z("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:l});l=Dt(e,l)}return o}var Qw=/^[a-z0-9-_]+$/i;function Bs(e){let r=typeof e;if(r==="object"){if(Array.isArray(e))return"array";if(e instanceof Date)return"date"}return r}function l9(e){for(let r=0;r<e.length;r++)if(Bs(e[r])!=="object")return!1;return e.length!=0}function xf(e){return JSON.stringify(e).replace(/\x7f/g,"\\u007f")}function Rf(e,r,n,o){if(n===0)throw new Error("Could not stringify the object: maximum object depth exceeded");if(r==="number")return isNaN(e)?"nan":e===1/0?"inf":e===-1/0?"-inf":o&&Number.isInteger(e)?e.toFixed(1):e.toString();if(r==="bigint"||r==="boolean")return e.toString();if(r==="string")return xf(e);if(r==="date"){if(isNaN(e.getTime()))throw new TypeError("cannot serialize invalid date");return e.toISOString()}if(r==="object")return m9(e,n,o);if(r==="array")return d9(e,n,o)}function m9(e,r,n){let o=Object.keys(e);if(o.length===0)return"{}";let i="{ ";for(let a=0;a<o.length;a++){let c=o[a];a&&(i+=", "),i+=Qw.test(c)?c:xf(c),i+=" = ",i+=Rf(e[c],Bs(e[c]),r-1,n)}return i+" }"}function d9(e,r,n){if(e.length===0)return"[]";let o="[ ";for(let i=0;i<e.length;i++){if(i&&(o+=", "),e[i]===null||e[i]===void 0)throw new TypeError("arrays cannot contain null or undefined values");o+=Rf(e[i],Bs(e[i]),r-1,n)}return o+" ]"}function f9(e,r,n,o){if(n===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let i="";for(let a=0;a<e.length;a++)i+=`${i&&`
|
|
161
161
|
`}[[${r}]]
|
|
162
|
-
`,i+=
|
|
163
|
-
`)
|
|
164
|
-
`)+
|
|
162
|
+
`,i+=Cf(0,e[a],r,n,o);return i}function Cf(e,r,n,o,i){if(o===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let a="",c="",l=Object.keys(r);for(let d=0;d<l.length;d++){let f=l[d];if(r[f]!==null&&r[f]!==void 0){let g=Bs(r[f]);if(g==="symbol"||g==="function")throw new TypeError(`cannot serialize values of type '${g}'`);let T=Qw.test(f)?f:xf(f);if(g==="array"&&l9(r[f]))c+=(c&&`
|
|
163
|
+
`)+f9(r[f],n?`${n}.${T}`:T,o-1,i);else if(g==="object"){let _=n?`${n}.${T}`:T;c+=(c&&`
|
|
164
|
+
`)+Cf(_,r[f],_,o-1,i)}else a+=T,a+=" = ",a+=Rf(r[f],g,o,i),a+=`
|
|
165
165
|
`}}return e&&(a||!c)&&(a=a?`[${e}]
|
|
166
166
|
${a}`:`[${e}]`),a&&c?`${a}
|
|
167
|
-
${c}`:a||c}function
|
|
167
|
+
${c}`:a||c}function Pf(e,{maxDepth:r=1e3,numbersAsFloat:n=!1}={}){if(Bs(e)!=="object")throw new TypeError("stringify can only be called with an object");let o=Cf(0,e,"",r,n);return o[o.length-1]!==`
|
|
168
168
|
`?o+`
|
|
169
|
-
`:o}var
|
|
170
|
-
`),B(f===void 0?" created":` patched (backup: ${f})`)}function B3(e,r,n){return{environment:"dev",log_user_prompt:n,exporter:{"otlp-http":{endpoint:`${e}/v1/logs`,protocol:"binary",headers:{Authorization:`Bearer ${r}`}}},trace_exporter:{"otlp-http":{endpoint:`${e}/v1/traces`,protocol:"binary",headers:{Authorization:`Bearer ${r}`}}}}}function F3(e,r,n,o){let i=(0,Ui.join)(e,".codex"),a=(0,Ui.join)(i,"config.toml");B(`Codex \u2192 ${a}`),(0,_f.mkdirSync)(i,{recursive:!0});let c=Xa(a),l=c===void 0?{}:ff(c),d="otel"in l;delete l.otel,l.otel=B3(r,n,o);let f=Ja(a,c);Za(a,Tf(l)),B(f===void 0?" created":d?` replaced existing [otel] tables (backup: ${f})`:` appended (backup: ${f})`)}function Cw(){return new yr("--endpoint <OTLP_ENDPOINT>","OTLP base URL").env("TSUGA_OTLP_ENDPOINT").makeOptionMandatory()}function Pw(){return new yr("--ingestion-api-key <INGESTION_API_KEY>","Tsuga ingestion API key").env("TSUGA_INGESTION_API_KEY").makeOptionMandatory()}var Uw="Restart your claude / codex session to load the new config.";function ww(e){let r=e.command("setup").description("Configure local LLM CLIs to ship OTEL telemetry to Tsuga");r.command("claude-code").description("Patch ~/.claude/settings.json with Tsuga OTEL env").addOption(Cw()).addOption(Pw()).option("--no-include-prompts","Strip user prompts + tool content from telemetry (default: include)").action(n=>{q3((0,Ef.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),B(Uw)}),r.command("codex").description("Patch ~/.codex/config.toml with Tsuga OTEL settings (replaces any existing [otel] table)").addOption(Cw()).addOption(Pw()).option("--no-include-prompts","Strip user prompts from telemetry (default: include)").action(n=>{F3((0,Ef.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),B(Uw)})}var Fp="/v0/logs";var If=["CRITICAL","ERROR","WARN","NOTICE","INFO","DEBUG","TRACE"];var Gs=0,bf=t.Object({__tsuga_metadata__:t.Object({id:t.String(),source:t.Optional(t.String())},{additionalProperties:!0}),context:t.Optional(t.Object({team:t.Optional(t.String({description:"Team name associated with this log."})),tag_policy_warnings:t.Optional(t.Record(t.String(),t.String()))},{additionalProperties:!0,description:"Context attributes attached to the log after ingestion and route processing. `team` comes from telemetry or route-enriched context when present."})),message:t.Optional(t.Unknown({description:"Log message after ingestion and route processing. It can be any JSON value because processors may map arbitrary data into `message`."})),timestamp:t.Number({description:"Log timestamp as a Unix timestamp in milliseconds."}),level:t.Enum(If,{description:"Log severity, normalized from the source severity into one of the fixed Tsuga levels (ordered `CRITICAL` to `TRACE`)."}),[xS]:t.Optional(t.String({description:"ID of the cluster this log was read from. Only set when the request spanned several clusters."}))},{additionalProperties:!0}),Nw=100,H3="timestamp",K3=t.Union([t.Literal(H3)]),lo=t.Partial(t.Object({...Ye.properties,query:p({type:"tsuga-query",description:"Tsuga query used to filter logs in the selected time range."}),maxResults:t.Integer({minimum:1,maximum:1e3,description:"Maximum number of logs to return. Valid values are 1 through 1000."}),shouldRecommendAttributes:t.Boolean({description:"Whether Tsuga should return suggested attributes to highlight in results."}),triggeredBy:t.Literal("refresh",{description:"Indicates the query was triggered by a refresh action."}),startOffset:t.Number({minimum:Gs,description:"Result offset used when fetching additional log rows."}),startOffsets:t.Array(t.Number({minimum:Gs}),{description:`Result offsets used when fetching additional log rows, one per entry of \`clusterIds\` and in the same order. Echo back each cluster's \`nextStartOffset\` from the previous response. Must have the same length as \`clusterIds\`. Defaults to ${Gs} for every cluster.`}),clusterId:p({allowEmpty:!1,description:"ID of the cluster to target. Omit to use the default cluster."}),clusterIds:Pa,sortBy:K3,sortDirection:t.Union([t.Literal("asc"),t.Literal("desc")],{description:"Timestamp sort direction for log results."})})),UQe=m({tags:["logs"],url:`${Fp}/count`,method:"GET",query:t.Pick(lo,["from","to","query","clusterId","clusterIds"]),response:t.Object({count:t.Number(),clusterResponses:t.Optional(Yo())})}),$s=t.Object({value:t.String(),priority:t.Number()}),wQe=m({tags:["logs"],url:`${Fp}/search`,method:"GET",query:lo,response:t.Object({logs:t.Optional(t.Array(bf)),attributesToHighlight:t.Optional(t.Array($s)),clusterResponses:t.Optional(Yo(t.Object({nextStartOffset:t.Number({description:"Number of logs consumed on this cluster so far. Echo it back at this cluster's position in `startOffsets` to fetch the next page."})})))},{additionalProperties:!0})}),z3=t.Cyclic({TokenOutput:t.Union([t.Object({type:t.Literal("top"),values:t.Array(t.String())}),t.Object({type:t.Literal("ip"),value:t.String()}),t.Object({type:t.Literal("range"),min:t.Number(),max:t.Number()}),t.Object({type:t.Literal("variable"),value:t.String()}),t.Object({type:t.Literal("text"),value:t.String()}),t.Object({type:t.Literal("date"),value:t.String()}),t.Object({type:t.Literal("url"),value:t.String()}),t.Object({type:t.Literal("structure"),key:t.Array(t.String()),value:t.Array(t.Ref("TokenOutput"))})])},"TokenOutput",{description:"A token identified as part of the pattern"}),Y3=t.Object({id:t.String(),pattern:t.Array(z3),size:t.Integer({description:"Number of logs that matched the pattern"}),examples:t.Array(t.Object({id:t.String(),timestampUnix:t.Number()})),timeDistribution:t.Array(t.Number()),staticFeatures:t.Array(t.Object({key:t.String(),value:t.String()},{description:"Fixed groups present in all logs matching the pattern"}))}),NQe=m({tags:["logs"],url:`${Fp}/patterns`,method:"GET",query:t.Object({...Ye.properties,query:p({type:"tsuga-query"}),clusteringThreshold:t.Optional(t.Number()),clusterId:t.Optional(p({allowEmpty:!1}))}),response:t.Object({patterns:t.Array(Y3),sampleSize:t.Number()})}),LQe=m({tags:["logs"],url:`${Fp}/attributes`,method:"GET",query:t.Object({...Ye.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),clusterIds:t.Optional(Pa)}),response:t.Object({attributes:t.Array(t.String()),clusterResponses:t.Optional(Yo())})});var js=`/${"v1"}/logs`,Sf=t.Object({context:t.Optional(t.Object({team:t.Optional(t.String({description:"Team name associated with this log."}))},{additionalProperties:!0,$id:"LogContext",description:"Context attributes attached to the log after ingestion and route processing. `team` comes from telemetry or route-enriched context when present."})),...t.Pick(bf,["message","timestamp","level"]).properties},{additionalProperties:!0,$id:"LogEvent",description:"Log event including message, timestamp, severity level, and optional enriched context attributes."}),V3={context:{team:"platform"},message:"Request completed successfully",timestamp:17040672e5,level:"INFO"};Object.assign(Sf,{examples:[V3]});var Lw=t.Object({query:t.Optional(p({type:"tsuga-query",default:"*",description:"Tsuga query selecting logs to return. Omit to search all logs with `*`."})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e3,default:Nw,description:"Maximum number of logs to return. Defaults to 100. Valid values are 1 through 1000."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),...mt.properties},{description:"Log search query. Provide a time range, optional Tsuga query, and optional limit."}),Q3={query:"level:ERROR",maxResults:100,from:1704067200,to:1704070800};Object.assign(Lw,{examples:[Q3]});var vw=m({description:"Searches logs in a required time range using Tsuga query syntax. Use this endpoint to retrieve raw log events for investigations or automation. See [Logs](/documentation/explore/logs) and [Query syntax](/documentation/explore/query-syntax).",operationId:"searchLogs",tags:["public","logs"],url:`${js}/search`,method:"GET",query:Lw,response:t.Object({logs:t.Array(Sf,{description:"Log events matching the query and time range."})})}),W3=t.Object({pattern:t.String({description:"Clustered log pattern formatted as a readable string."}),size:t.Integer({description:"Number of logs that matched the pattern"}),groups:t.Array(t.Object({key:t.String({description:"Attribute dot-path shared by all logs in the pattern."}),value:t.String({description:"Value of the attribute identified by `key`, common to all logs in the pattern."})},{description:"Attribute key-value pair that is constant across every log matching this pattern, e.g. a shared `level` or `context.team`."}))}),kw=t.Object({patterns:t.Array(W3,{description:"Log patterns clustered from logs matching the query."}),sampleSize:t.Number({description:"Number of logs sampled while computing patterns."})},{}),Z3={patterns:[{pattern:"Resolved segment SegmentId([0:1]) from cache",size:37004,groups:[{key:"level",value:"DEBUG"},{key:"context.team",value:"infra"}]}],sampleSize:100};Object.assign(kw,{examples:[Z3]});var Mw=m({description:"Clusters matching logs into readable patterns for the requested time range. Use this to summarize common log shapes before drilling into raw events. See [Logs](/documentation/explore/logs).",operationId:"getLogPatterns",tags:["public","logs"],url:`${js}/patterns`,method:"GET",query:t.Object({...mt.properties,query:p({type:"tsuga-query",description:"Tsuga query selecting logs to cluster into patterns."}),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:kw}),X3=t.Object({exampleLog:t.Optional(Sf),team:t.String({description:"Team associated with the new error pattern."}),env:t.String({description:"Environment associated with the new error pattern."}),service:t.String({description:"Service associated with the new error pattern."}),firstSeen:t.Number({description:"Unix timestamp in seconds when this pattern was first seen."}),lastSeen:t.Number({description:"Unix timestamp in seconds when this pattern was last seen."})}),Dw=t.Object({newErrorPatterns:t.Array(X3,{description:"Error patterns first seen in the requested time range."})},{}),J3={newErrorPatterns:[{team:"platform",env:"production",service:"api-gateway",firstSeen:1704067200,lastSeen:1704153600,exampleLog:{message:"ConnectionError: Failed to connect to database",timestamp:17041536e5,level:"ERROR"}}]};Object.assign(Dw,{examples:[J3]});var Gw=m({description:"Finds error patterns first seen in the requested time range, optionally filtered by team, environment, or service. Use this to detect newly appearing failures. See [Logs](/documentation/explore/logs).",operationId:"getNewErrorPatterns",tags:["public","logs"],url:`${js}/patterns/new`,method:"GET",query:t.Object({...mt.properties,team:t.Optional(p({description:"Team name to restrict pattern detection to."})),env:t.Optional(p({description:"Environment to restrict pattern detection to."})),service:t.Optional(p({description:"Service name to restrict pattern detection to."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:Dw}),e9=t.Object({team:t.String({description:"Team associated with the error pattern."}),env:t.String({description:"Environment associated with the error pattern."}),pattern:t.String({description:"Error pattern formatted as a readable string."}),increaseTimestamps:t.Array(t.Number({description:"Unix timestamp in milliseconds of a detected spike in occurrence of this pattern. One entry per spike detected in the requested time range."}))}),$w=t.Object({errorPatternIncreases:t.Array(e9,{description:"Error patterns with increased occurrence in the requested time range."})},{}),t9={errorPatternIncreases:[{team:"platform",env:"production",pattern:"Non-resolved segment SegmentId(*) from cache",increaseTimestamps:[17041536e5,17042392e5]}]};Object.assign($w,{examples:[t9]});var jw=m({description:"Finds error patterns whose occurrence increased for a team in the requested time range. Use this to identify growing failure modes. See [Logs](/documentation/explore/logs).",operationId:"getErrorPatternIncrease",tags:["public","logs"],url:`${js}/patterns/increase`,method:"GET",query:t.Object({...mt.properties,team:p({description:"Team name to analyze for pattern increases."}),env:t.Optional(p({description:"Environment to restrict the analysis to."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:$w}),qw=t.Object({attributes:t.Array(t.String(),{description:"Log attribute dot-paths observed in the time range"})},{}),r9={attributes:["context.env","context.k8s.pod.name","context.service.name","context.team","level","message","timestamp"]};Object.assign(qw,{examples:[r9]});var n9=t.Object({...mt.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))},{description:"Log attribute discovery query. Provide a time range and optional cluster ID."}),Bw=m({description:"Lists log attribute dot-paths observed in the requested time range. This endpoint requires a public API credential that can read all relevant teams because attribute discovery is not team-filtered. Use this to discover fields for Tsuga queries, filters, and grouping. See [Logs](/documentation/explore/logs).",operationId:"getLogAttributes",tags:["public","logs"],url:`${js}/attributes`,method:"GET",query:n9,response:qw});var Gr="/v0/metrics",o9=t.Object({__tsuga_metadata__:t.Object({},{additionalProperties:!0}),context:t.Optional(t.Object({},{additionalProperties:!0})),message:t.Optional(t.String()),timestamp:t.Number(),level:t.Enum(If)},{additionalProperties:!0}),YQe=m({tags:["metrics"],url:`${Gr}/count`,method:"GET",query:t.Pick(lo,["from","to","query","clusterId"]),response:t.Object({count:t.Number()})}),VQe=m({tags:["metrics"],url:`${Gr}/search`,method:"GET",query:lo,response:t.Object({logs:t.Optional(t.Array(o9)),totalHits:t.Optional(t.Number()),attributesToHighlight:t.Optional(t.Array($s))},{additionalProperties:!0})}),Hp=t.Enum(["counter","gauge","histogram","summary","composite_histogram"],{description:"Metric instrument type, set by the reporting instrumentation. `counter` accumulates a monotonically increasing total (aggregate with `sum` or `increase`); `gauge` reports a point-in-time value that can go up or down (aggregate with `average`, `max`, `min`, or `last`); `histogram`, `composite_histogram`, and `summary` report a distribution of values, from which percentiles can be computed. Tsuga displays `composite_histogram` metrics as Histogram in the app."}),Of=t.Enum(["delta","cumulative","none"],{description:"Metric temporality. `delta` reports changes per collection interval, `cumulative` reports running totals, and `none` means temporality is not applicable or unknown."}),i9=t.Object({capabilities:t.Optional(t.Array(t.String(),{description:"Aggregate function types (such as `max`, `min`, `sum`) supported when querying or graphing this metric. If this field is omitted or empty, all aggregate types are supported."})),description:t.Optional(t.String({description:"Human-readable description of the metric"})),tags:t.Optional(t.Array(t.String(),{description:"Attribute names available as dimensions for filtering or grouping this metric. Exposed publicly as `attributes`."})),temporality:t.Optional(Of),type:t.Optional(Hp),unit:t.Optional(t.String({description:"Metric unit reported by instrumentation or inferred metadata."}))}),QQe=m({url:`${Gr}/metadata`,method:"GET",query:t.Object({...Ye.properties,metricName:p({allowEmpty:!1}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:i9}),WQe=m({tags:["metrics"],url:Gr,method:"GET",query:t.Object({...Ye.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:t.Array(t.String())}),Kp=t.Array(t.Object({name:t.String({description:"Metric name observed by Tsuga."}),type:Hp}),{description:"Metrics observed in the requested time range, with the instrument type each was reported as."}),a9=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Kp,{examples:[a9]});var ZQe=m({tags:["metrics"],url:`${Gr}/names-and-types`,method:"GET",query:t.Object({...Ye.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Kp}),qs=t.Array(t.String(),{description:"Attribute names available as dimensions for filtering or grouping the requested metric(s)."}),s9=["service","env","host","method","status_code"];Object.assign(qs,{examples:[s9]});var XQe=m({tags:["metrics"],url:`${Gr}/attributes`,method:"GET",query:t.Object({...Ye.properties,metricName:p({allowEmpty:!1}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:qs}),JQe=m({tags:["metrics"],url:`${Gr}/attributes/batch`,method:"GET",query:t.Object({...Ye.properties,metricNames:t.Array(p({allowEmpty:!1}),{minItems:1,description:"Metric names to fetch attributes for"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:qs}),Af=t.Object({assets:t.Array(t.Object({type:t.Enum(["dashboard","monitor"],{description:"Kind of asset referencing the metric."}),id:t.String({description:"Dashboard or monitor ID for the asset that queries this metric."}),name:t.String({description:"Display name of the referencing dashboard or monitor."}),owner:t.String({description:"Team ID that owns the referencing dashboard or monitor."})},{description:"A dashboard or monitor that queries this metric."}),{description:"Dashboards and monitors that currently query this metric."})}),eWe=m({tags:["metrics"],url:`${Gr}/assets-usage`,method:"GET",query:t.Object({metricName:p({allowEmpty:!1})}),response:Af}),tWe=m({url:`${Gr}/per-attribute`,method:"GET",query:t.Object({from:t.Optional(t.Number()),to:t.Optional(t.Number()),attribute:p(),clusterId:t.Optional(p({allowEmpty:!1}))}),response:t.Array(t.String())});var xf=`/${"v1"}/metrics`,c9=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Kp,{examples:[c9]});var Rf=t.Object({name:t.String({description:"Metric name observed by Tsuga. Use this value in metric queries and aggregations."}),type:Hp,description:t.Optional(t.String({description:"Human-readable description of what the metric measures, set by the reporting instrumentation. Omitted when the instrumentation did not provide one."})),unit:t.Optional(t.String({description:"Metric unit reported by instrumentation or inferred metadata."})),temporality:t.Optional(Of),capabilities:t.Optional(t.Array(t.String(),{description:"Aggregate function types (such as `max`, `min`, `sum`) supported when querying or graphing this metric. An empty or omitted array means all aggregate types are supported."})),attributes:t.Optional(t.Array(t.String(),{description:"Metric attribute names available as dimensions for filtering or grouping."}))}),p9={name:"http.server.request.duration",type:"histogram",description:"Duration of HTTP server requests",unit:"ms",temporality:"delta",capabilities:["max","min","sum"],attributes:["context.team","context.environment","context.region"]};Object.assign(Rf,{examples:[p9]});var Fw=t.Object({...mt.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))},{description:"Metric metadata query. Provide the time range to inspect and optionally a cluster ID."}),Hw=m({description:"Lists metrics observed in the requested time range with metadata such as type, unit, temporality, capabilities, and attributes. Use this to discover metric names before querying or graphing them. See [Metrics](/documentation/explore/metrics/index).",operationId:"listMetrics",tags:["public","metrics"],url:xf,method:"GET",query:Fw,response:t.Array(Rf)}),Kw=m({description:"Retrieves metadata for one metric name in the requested time range. Use this to inspect available dimensions and supported query behavior for a metric. See [Metric details](/documentation/explore/metrics/metric-details).",operationId:"getMetric",tags:["public","metrics"],url:`${xf}/:name`,method:"GET",params:t.Object({name:p({allowEmpty:!1,description:"Metric name to retrieve, for example `http.server.request.duration`."})}),query:Fw,response:Rf}),u9=["service","env","host","method","status_code"];Object.assign(qs,{examples:[u9]});var zw=t.Pick(Af,["assets"]),l9={assets:[{type:"dashboard",id:"dash-123-abc",name:"API Performance Overview",owner:"team-123-abc"},{type:"monitor",id:"mon-789-ghi",name:"High Latency Alert",owner:"team-123-abc"}]};Object.assign(zw,{examples:[l9]});var Yw=m({description:"Retrieve dashboards and monitors that use a specific metric",operationId:"getMetricAssetsUsage",tags:["private"],url:`${xf}/assets-usage`,method:"GET",query:t.Object({metricName:p({allowEmpty:!1,description:"The name of the metric to find usage for"})}),response:zw});var wi="/v0/traces",gWe=m({tags:["traces"],url:`${wi}/count`,method:"GET",query:t.Pick(lo,["from","to","query","clusterId"]),response:t.Object({count:t.Number()})}),m9=["unset","ok","error"],d9=t.Enum(m9),f9=["unspecified","internal","server","client","producer","consumer"],g9=t.Enum(f9),Qw=t.Object({__tsuga_metadata__:t.Optional(t.Object({},{additionalProperties:!0})),context:t.Optional(t.Object({telemetry:t.Optional(t.Object({sdk:t.Optional(t.Object({language:t.Optional(t.String())},{additionalProperties:!0}))},{additionalProperties:!0})),tag_policy_warnings:t.Optional(t.Record(t.String(),t.String())),service:t.Optional(t.Object({name:t.Optional(t.String()),version:t.Optional(t.String())},{additionalProperties:!0})),env:t.Optional(t.String())},{additionalProperties:!0})),parent_span_id:t.Optional(t.String()),resource_attributes:t.Object({},{additionalProperties:!0}),span_attributes:t.Object({},{additionalProperties:!0}),duration:t.Number({description:"In milliseconds."}),duration_ns:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),start_time:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),end_time:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),error:t.Optional(t.Object({message:t.String()})),events:t.Optional(t.Array(t.Object({event_attributes:t.Object({},{additionalProperties:!0}),event_name:t.String(),event_timestamp_nanos:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."})}))),links:t.Optional(t.Array(t.Object({},{additionalProperties:!0}))),span_id:t.String(),span:t.Object({kind:g9,name:t.String()}),status_code:t.Optional(d9),trace_id:t.String()}),Ww=100,y9="start_time",h9="duration_ns",T9=t.Union([t.Literal(y9),t.Literal(h9)]),E9={...Ye.properties,query:t.Optional(p({type:"tsuga-query"})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e4})),shouldRecommendAttributes:t.Optional(t.Boolean()),startOffset:t.Optional(t.Number({minimum:Gs})),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),sortBy:t.Optional(T9),sortDirection:t.Optional(t.Union([t.Literal("asc"),t.Literal("desc")]))},yWe=m({tags:["traces"],url:`${wi}/search`,method:"GET",query:t.Object(E9),response:t.Object({spans:t.Optional(t.Array(Qw)),attributesToHighlight:t.Optional(t.Array($s))})});var _9=t.Object({groupByAttributes:t.Array(p({allowEmpty:!1}),{description:'Glob patterns of span_attributes keys to use as additional grouping dimensions (e.g. "db.*"). Matches against flattened dotted keys of span_attributes only.'}),minLeafSpansToAggregate:t.Integer({minimum:2,description:"Minimum leaf-group size before aggregation occurs. Default 5."}),maxParentDepth:t.Integer({minimum:-1,description:"Max depth of recursive parent aggregation. 0 = leaves only, -1 = unlimited (default)."}),aggregationHistogramBucketsSeconds:t.Array(t.Number({minimum:0}),{description:"Upper bounds for the latency histogram in seconds. Empty array disables the histogram attributes."}),sortSpans:t.Boolean({description:"Whether to sort the returned spans by start_time (span_id tie-breaker). Set false when the caller reconstructs the trace tree and does not need ordering. Default true."})}),I9=t.Object({...Ye.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),...t.Partial(_9).properties}),hWe=m({tags:["traces"],url:`${wi}/summarize`,method:"GET",query:I9,response:t.Object({spans:t.Array(Qw)})}),TWe=m({tags:["traces"],url:`${wi}/attributes`,method:"GET",query:t.Object({...Ye.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:t.Object({attributes:t.Array(t.String())})}),b9=t.Object({key:t.String({description:"Opaque stable key identifying this contributing service within the response. Tsuga assigns it while building the summary; `ranges[].contributions[].serviceKey` and `serviceTotals[].serviceKey` reference this value."}),name:t.String({description:"Observed service name that contributed leaf-span time to the trace. Comes from trace service context and is returned for every contributing service."}),env:t.Optional(t.String({description:"Observed service environment for this contributing service. Comes from trace service context and is absent when the spans do not carry an environment."})),id:t.Optional(t.String({description:"Service catalog ID for this contributing service. Tsuga sets it when exactly one catalog entry matches the observed service and environment; absent when the service is not cataloged or matches ambiguously."})),namespace:t.Optional(t.String({description:"Service namespace from the matched service catalog entry. Returned only when Tsuga can resolve the contributing service to one catalog entry with a namespace."}))}),S9=t.Object({fromNs:t.String({description:"Range start time in nanoseconds since Unix epoch. Tsuga sets it from the trace timeline split where active leaf spans change. Transmitted as a string to avoid losing precision."}),toNs:t.String({description:"Range end time in nanoseconds since Unix epoch. Tsuga sets it from the trace timeline split where active leaf spans change. Transmitted as a string to avoid losing precision."}),durationNs:t.String({description:"Range duration in nanoseconds, computed as `toNs - fromNs`. Transmitted as a string to avoid losing precision."}),contributions:t.Array(t.Object({serviceKey:t.String({description:"Contributing service key for this range. References `services[].key` in the same response."}),weight:t.Number({description:"Share of this range attributed to the service, from `0` through `1`. Tsuga computes the weight from active leaf spans in the range; weights inside one range sum to `1`."}),durationNs:t.String({description:"Estimated duration attributed to this service in the range, computed as `weight` times the range's own `durationNs` and rounded to whole nanoseconds. Use `serviceTotals` as authoritative when rounded range values do not add up exactly."})}),{description:"Services contributing active leaf-span time to this range, with weighted shares for the range duration."}),spanIds:t.Array(t.String(),{description:"Leaf span IDs that produced this range. Tsuga returns IDs from the leaf-only attribution set, including merged sub-ranges after short-range collapsing."})}),O9=t.Object({serviceKey:t.String({description:"Contributing service key for this aggregate total. References `services[].key` in the same response."}),durationNs:t.String({description:"Total wall-clock contribution of this service across the trace, in nanoseconds. Sum of `weight * durationNs` over every range the service contributes to; authoritative when it disagrees with rounded per-range values. Transmitted as a string to avoid losing precision."}),share:t.Number({description:"Share of total trace duration attributed to this service, from `0` through `1`. Computed as `durationNs / totalDurationNs`; multiply by 100 for a percentage."})}),Cf=t.Optional(t.Number({minimum:0,description:"Minimum range duration in milliseconds. Shorter ranges are collapsed (absorbed into a neighbor or blended with adjacent shorts) to keep the timeline readable. When omitted, the default depends on the trace: max(1ms, 1% of the total trace duration), so e.g. a 10s trace collapses ranges shorter than 100ms. Pass 0 to disable collapsing."})),Pf=t.Optional(t.Boolean({default:!0,description:"When false, omits the per-range timeline (returns `ranges: []`) and returns only `services` and `serviceTotals`. Cuts payload size for callers that only need the headline. Defaults to true."})),zp=t.Object({traceId:t.String({description:"Trace ID summarized by the response. Echoes the required `traceId` query parameter."}),startTimeNs:t.String({description:"Earliest `start_time` across fetched spans, in nanoseconds since Unix epoch. If the request window does not cover the full trace, this reflects the fetched subset, not necessarily the trace's true start. Transmitted as a string to avoid losing precision."}),endTimeNs:t.String({description:"Latest `end_time` across fetched spans, in nanoseconds since Unix epoch. If the request window does not cover the full trace, this reflects the fetched subset, not necessarily the trace's true end. Transmitted as a string to avoid losing precision."}),totalDurationNs:t.String({description:"Total fetched trace duration in nanoseconds, computed as `endTimeNs - startTimeNs`. Transmitted as a string to avoid losing precision."}),truncated:t.Boolean({description:"Whether the underlying span fetch hit its result cap. When true, the latency summary may be incomplete because not every span in the trace was available."}),services:t.Array(b9,{description:"Unique services that contributed leaf-span time to the trace, enriched with catalog IDs when Tsuga can resolve them. Referenced by `serviceKey` from `ranges` and `serviceTotals`."}),ranges:t.Array(S9,{description:"Sequential trace timeline split into ranges wherever the active leaf-span set changes. Empty when the request sets `includeRanges` to false."}),serviceTotals:t.Array(O9,{description:"Aggregated wall-clock contribution per service across the fetched trace. Use this for service-level latency ownership without processing the per-range timeline."})}),A9={traceId:"78c99c5bb1e4a30297fa134b9dbec64f",startTimeNs:"1704067200000000000",endTimeNs:"1704067202400000000",totalDurationNs:"2400000000",truncated:!1,services:[{key:"checkout|prod",name:"checkout",env:"prod",id:"123-456-abc",namespace:"default"},{key:"payments|prod",name:"payments",env:"prod",id:"456-789-def",namespace:"default"}],ranges:[{fromNs:"1704067200000000000",toNs:"1704067201200000000",durationNs:"1200000000",contributions:[{serviceKey:"checkout|prod",weight:1,durationNs:"1200000000"}],spanIds:["3df8cc3449378f66"]},{fromNs:"1704067201200000000",toNs:"1704067202400000000",durationNs:"1200000000",contributions:[{serviceKey:"checkout|prod",weight:.5,durationNs:"600000000"},{serviceKey:"payments|prod",weight:.5,durationNs:"600000000"}],spanIds:["187a47da1b2560f8","3df8cc3449378f66"]}],serviceTotals:[{serviceKey:"checkout|prod",durationNs:"1800000000",share:.75},{serviceKey:"payments|prod",durationNs:"600000000",share:.25}]};Object.assign(zp,{examples:[A9]});var EWe=m({tags:["traces"],url:`${wi}/latency-summary`,method:"GET",query:t.Object({...Ye.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),minRangeDurationMs:Cf,includeRanges:Pf}),response:zp}),Vw=t.Object({filter:p({type:"tsuga-query",description:"TQL filter defining the group"}),timeRange:Vo}),x9=t.Object({value:t.String(),supportA:t.Number(),supportB:t.Number()}),R9=t.Object({value:t.String(),supportA:t.Number(),supportB:t.Number(),lift:t.Union([t.Number(),t.Null()]),pValue:t.Number()}),C9=t.Object({attr:t.String(),values:t.Array(R9),otherValues:t.Array(x9)}),_We=m({tags:["traces"],url:`${wi}/contrast-sets`,method:"POST",body:t.Object({groupA:Vw,groupB:Vw,candidateAttrs:t.Optional(t.Array(p({allowEmpty:!1}))),topK:t.Optional(t.Integer({minimum:1,maximum:100})),minLift:t.Optional(t.Number({minimum:1})),minSupport:t.Optional(t.Number({minimum:0,maximum:100})),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:t.Object({contrastSets:t.Array(C9),groupACount:t.Number(),groupBCount:t.Number()})});var Uf=`/${"v1"}/traces`,wf=t.Object({context:t.Optional(t.Object({service:t.Optional(t.Object({name:t.Optional(t.String({description:"Service name associated with the span."})),version:t.Optional(t.String({description:"Service version associated with the span."}))},{additionalProperties:!0,description:"Service identity associated with the span, from OpenTelemetry service resource attributes."}))},{additionalProperties:!0,description:"OpenTelemetry resource context resolved for the span, holding the identity of the emitting service."})),parentSpanId:t.Optional(t.String({description:"`spanId` of this span's parent within the same trace. Absent for the root span."})),resourceAttributes:t.Object({},{additionalProperties:!0,description:"OpenTelemetry resource attributes describing the process/host that emitted the span (e.g. `host.name`, `k8s.pod.name`), as a flat key-value map set by the instrumented service or its SDK."}),spanAttributes:t.Object({},{additionalProperties:!0,description:"OpenTelemetry span attributes describing this operation (e.g. HTTP method, DB statement), as a flat key-value map set by the instrumented code or auto-instrumentation."}),duration:t.Number({description:"Span duration in milliseconds, derived from the nanosecond `startTime` and `endTime` values."}),startTime:t.String({description:"Span start time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),endTime:t.String({description:"Span end time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),error:t.Optional(t.Object({message:t.String({description:"Error message associated with the span."})},{description:"Error details associated with the span, separate from the OpenTelemetry `statusCode` field."})),events:t.Optional(t.Array(t.Object({event_attributes:t.Object({},{additionalProperties:!0,description:"Key-value attributes recorded with this event, set by the instrumented code when the event was added to the span (e.g. exception details)."}),event_name:t.String({description:"Name of the span event."}),event_timestamp_nanos:t.String({description:"Event timestamp in nanoseconds, transmitted as a string for precision."})},{description:"A single timestamped event recorded on the span, with its name and attributes."}),{description:"Events recorded on the span."})),spanId:t.String({description:"Unique span ID within the trace."}),span:t.Object({kind:t.String({description:"OpenTelemetry span kind describing the relationship to remote calls: `unspecified`, `internal`, `server`, `client`, `producer`, or `consumer`."}),name:t.String({description:"Operation name recorded on the span."})},{description:"Operation identity for the span, combining the recorded operation name and the OpenTelemetry span kind."}),statusCode:t.Optional(t.String({description:"OpenTelemetry span status set by the instrumented code: `unset` (default, no explicit status), `ok`, or `error`. Absent if the source span never set a status."})),traceId:t.String({description:"Trace ID shared by all spans in the trace."})},{additionalProperties:!0,$id:"SpanEvent",description:"Distributed tracing span including timing, identifiers, OpenTelemetry attributes, events, and status metadata."}),P9={context:{service:{name:"my-service",version:"1.0.0"}},parentSpanId:"187a47da1b2560f8",resourceAttributes:{},spanAttributes:{busyNs:374640,code:{file:{path:"src/queue/sqs.rs"},line:{number:162},module:{name:"queue::sqs"}},idleNs:23621445,maxMessages:"1",target:"queue::sqs",thread:{id:2,name:"tokio-runtime-worker"}},duration:23,startTime:"1770923469995353600",endTime:"1770923470019349500",spanId:"3df8cc3449378f66",span:{kind:"internal",name:"receive_messages"},statusCode:"ok",traceId:"78c99c5bb1e4a30297fa134b9dbec64f"};Object.assign(wf,{examples:[P9]});var U9={from:1704067200,to:1704070800,query:"context.service.name:my-service",maxResults:100},Zw=t.Object({...mt.properties,query:t.Optional(p({type:"tsuga-query",default:"*",description:"Tsuga query selecting spans to return. Omit to search all spans in the range with `*`."})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e4,default:Ww,description:"Maximum number of spans to return. Defaults to 100. Valid values are 1 through 10000."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))},{description:"Span search query. Provide a time range, optional Tsuga query, and optional limit."});Object.assign(Zw,{examples:[U9]});var Xw=m({description:"Searches spans in a required time range using Tsuga query syntax. Use this endpoint to retrieve trace spans for investigations or automation. See [Traces](/documentation/explore/traces) and [Query syntax](/documentation/explore/query-syntax).",operationId:"searchSpans",tags:["public","traces"],url:`${Uf}/search`,method:"GET",query:Zw,response:t.Object({spans:t.Array(wf,{description:"Spans matching the query and time range."})})}),w9={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},Jw=t.Object({...mt.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize. Use the `traceId` returned by span search, the trace details page, or your tracing instrumentation. Required; the requested time range must include the trace."}),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),groupByAttributes:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Glob patterns of span attribute keys to use as additional grouping dimensions. Use this when spans should be summarized separately for matching attributes, such as `db.*`. Matches flattened dotted span attribute keys; omitted by default."})),minLeafSpansToAggregate:t.Optional(t.Integer({minimum:2,default:5,description:"Minimum number of similar leaf spans in a group before Tsuga replaces them with one synthetic summary span. Use higher values for less aggressive summarization. Optional; defaults to 5 and must be at least 2."})),maxParentDepth:t.Optional(t.Integer({minimum:-1,default:-1,description:"Maximum depth of recursive parent aggregation after leaf spans are summarized. Use this to limit parent-level aggregation. Use `0` to aggregate leaf spans only or `-1` for unlimited depth; defaults to `-1`."})),aggregationHistogramBucketsSeconds:t.Optional(t.Array(t.Number({minimum:0}),{description:"Upper-bound bucket values, in seconds, for the latency histogram recorded on synthetic summary spans. Provide custom buckets when the default latency buckets are not suitable. Pass an empty array to omit histogram attributes; omitted values use Tsuga defaults from 5 ms through 10 s."})),sortSpans:t.Optional(t.Boolean({default:!0,description:"Whether Tsuga sorts returned spans by start time, using span ID as the tie-breaker for identical start times. Defaults to `true`; set to `false` only when reconstructing the trace tree yourself, in which case summary spans are appended after surviving spans."}))},{description:"Trace summarization query. Provide a trace ID, a time range covering the trace, and optional aggregation tuning."});Object.assign(Jw,{examples:[w9]});var eN=m({description:"Summarizes a trace by aggregating groups of similar spans into synthetic summary spans, producing a compact view of large traces. Summary spans are marked with `spanAttributes.aggregation.is_summary` and carry span counts, duration statistics, and an optional latency histogram. See [Traces](/documentation/explore/traces).",operationId:"summarizeTrace",tags:["public","traces"],url:`${Uf}/summarize`,method:"GET",query:Jw,response:t.Object({spans:t.Array(wf,{description:"Summarized trace spans, sorted by start time unless `sortSpans` is false. Aggregated groups are replaced by synthetic summary spans marked with `spanAttributes.aggregation.is_summary`."})})}),N9={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},tN=t.Object({...mt.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize. Use the `traceId` returned by span search, the trace details page, or your tracing instrumentation. Required; the requested time range must include the trace."}),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),minRangeDurationMs:Cf,includeRanges:Pf},{description:"Trace latency summary query. Provide a trace ID, a time range covering the trace, and optional timeline tuning."});Object.assign(tN,{examples:[N9]});var rN=m({description:"Summarizes where wall-clock time is spent in a trace, attributing each slice of the trace timeline to the services with active leaf spans. Returns per-service totals and an optional sequential range timeline. See [Traces](/documentation/explore/traces).",operationId:"getTraceLatencySummary",tags:["public","traces"],url:`${Uf}/latency-summary`,method:"GET",query:tN,response:zp});var iN=["timestamp","level","message"],aN=["count","ratio","team","level","pattern"];function it(e,r){let n=r??Ir(e);if(!n)throw new Error(`--${e} is required`);return Vs(n)}function nN(e){let r={from:it("from",e.from),to:it("to",e.to)},n=e.query??Ir("query");n!==void 0&&(r.query=n);let o=e.maxResults??Ir("max-results");if(o!==void 0){let i=Number(o);if(Number.isNaN(i))throw new Error(`--max-results must be a number (got: ${o})`);r.maxResults=i}return r}function Ie(e){let r=Ir(e);return r===void 0?"":` (default: ${r})`}function L9(e){let r=au(e.output),n=e.fields===void 0?void 0:su(e.fields);return r==="json"?{format:r,fields:n}:{format:r,fields:n??iN}}function v9(e){let r=au(e.output),n=e.fields===void 0?void 0:su(e.fields);return r==="json"?{format:r,fields:n}:{format:r,fields:n??aN}}function oN(e,r){let n={count:e.size,ratio:r>0?e.size/r:0,pattern:e.pattern};for(let{key:o,value:i}of e.groups)o==="context.team"?n.team=i:n[o]=i;return n}function k9(e,r){if(r.format==="json"){if(r.fields===void 0){Q(e);return}let{fields:i}=r;Q({patterns:e.patterns.map(a=>oN(a,e.sampleSize)).map(a=>cu(a,i)),sampleSize:e.sampleSize});return}let n=e.patterns.map(i=>oN(i,e.sampleSize)),o=pu(r.format,n,r.fields);o.length>0&&B(o)}function M9(e,r){if(r.format==="json"){if(r.fields===void 0){Q(e);return}let{fields:o}=r;Q({logs:e.logs.map(i=>cu(i,o))});return}let n=pu(r.format,e.logs,r.fields);n.length>0&&B(n)}function sN(e,r){let n=e.command("logs").description("Search and analyze logs");n.command("search").description("Search logs").option("--from <TIMESTAMP>",`Start of time range${xe}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${xe}${Ie("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs${Ie("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-1000${Ie("max-results")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each log (default for --output=tsv|csv: ${iN.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=L9(c),d=await r()(vw,{query:nN(c)});M9(d,l)}),n.command("attributes").description("List log attribute dot-paths observed in the time range").option("--from <TIMESTAMP>",`Start of time range${xe}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${xe}${Ie("to")}`).action(async c=>{let l=await r()(Bw,{query:{from:it("from",c.from),to:it("to",c.to)}});Q(l)}),n.command("patterns").description("List log patterns").option("--from <TIMESTAMP>",`Start of time range${xe}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${xe}${Ie("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs before clustering into patterns${Ie("query")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each pattern (default for --output=tsv|csv: ${aN.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=v9(c),d={from:it("from",c.from),to:it("to",c.to)},f=c.query??Ir("query");f!==void 0&&(d.query=f);let g=await r()(Mw,{query:d});k9(g,l)}),n.command("new-error-patterns").description("List error patterns first seen in this time range").option("--from <TIMESTAMP>",`Start of time range${xe}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${xe}${Ie("to")}`).option("--team <TEAM_NAME>","Filter by team").option("--env <ENV_NAME>","Filter by environment").option("--service <SERVICE_NAME>","Filter by service").action(async c=>{let l={from:it("from",c.from),to:it("to",c.to)};c.team!==void 0&&(l.team=c.team),c.env!==void 0&&(l.env=c.env),c.service!==void 0&&(l.service=c.service);let d=await r()(Gw,{query:l});Q(d)}),n.command("error-pattern-increases").description("List error pattern increases for a given team").option("--from <TIMESTAMP>",`Start of time range${xe}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${xe}${Ie("to")}`).requiredOption("--team <TEAM_NAME>","Team to query").option("--env <ENV_NAME>","Filter by environment").action(async c=>{let l={from:it("from",c.from),to:it("to",c.to),team:c.team};c.env!==void 0&&(l.env=c.env);let d=await r()(jw,{query:l});Q(d)});let o=e.command("metrics").description("List and inspect metrics");o.command("list").description("List all metrics with their metadata").option("--from <TIMESTAMP>",`Start of time range${xe}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${xe}${Ie("to")}`).action(async c=>{let l=await r()(Hw,{query:{from:it("from",c.from),to:it("to",c.to)}});Q(l)}),o.command("get <METRIC_NAME>").description("Retrieve a metric by name with its metadata").option("--from <TIMESTAMP>",`Start of time range${xe}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${xe}${Ie("to")}`).action(async(c,l)=>{let d=await r()(Kw,{params:{name:c},query:{from:it("from",l.from),to:it("to",l.to)}});Q(d)}),o.command("assets-usage <METRIC_NAME>").description("List dashboards and monitors that use a specific metric").action(async c=>{let l=await r()(Yw,{query:{metricName:c}});Q(l)});let i=e.command("traces").description("Search and summarize traces");i.command("search").description("Search spans").option("--from <TIMESTAMP>",`Start of time range${xe}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${xe}${Ie("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter spans${Ie("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-10000${Ie("max-results")}`).action(async c=>{let l=await r()(Xw,{query:nN(c)});Q(l)}),i.command("summarize").description("Summarize a trace by aggregating groups of similar spans into summary spans").requiredOption("--trace-id <TRACE_ID>","Trace ID to summarize").option("--from <TIMESTAMP>",`Start of time range${xe}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${xe}${Ie("to")}`).action(async c=>{let l=await r()(eN,{query:{traceId:c.traceId,from:it("from",c.from),to:it("to",c.to)}});Q(l)}),i.command("latency-summary").description("Summarize where wall-clock time is spent in a trace, attributed per service").requiredOption("--trace-id <TRACE_ID>","Trace ID to summarize").option("--from <TIMESTAMP>",`Start of time range${xe}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${xe}${Ie("to")}`).option("--min-range-duration-ms <MILLISECONDS>","Collapse timeline ranges shorter than this (default: max(1ms, 1% of trace duration); 0 disables collapsing)").option("--no-ranges","Omit the per-range timeline; return only services and serviceTotals").action(async c=>{let l={traceId:c.traceId,from:it("from",c.from),to:it("to",c.to)};if(c.minRangeDurationMs!==void 0){let f=Number(c.minRangeDurationMs);if(Number.isNaN(f))throw new Error(`--min-range-duration-ms must be a number (got: ${c.minRangeDurationMs})`);l.minRangeDurationMs=f}c.ranges||(l.includeRanges=!1);let d=await r()(rN,{query:l});Q(d)});let a=e.command("aggregation").description("Run aggregation queries");io(a,"scalar","Run aggregation queries and return scalar results",kC,r),io(a,"timeseries","Run aggregation queries and return timeseries results",DC,r)}var D9="x-tsuga-session-id",Nf="x-tsuga-source",Lf="x-tsuga-source-version",vf="x-tsuga-source-commit",kf="x-tsuga-source-date",Mf="x-tsuga-rationale",G9="x-tsuga-dashboard-id",$9="x-tsuga-widget-id",j9="x-request-id",$We={[D9]:"Session identifier for request correlation",[Nf]:"SDK or client source identifier (e.g., web-frontend, terraform-provider)",[Lf]:"SDK version",[vf]:"SDK commit hash",[kf]:"SDK commit date",[Mf]:"Optional caller-supplied rationale for this request, recorded for telemetry",[G9]:"ID of the dashboard a query is issued from, when the request originates from a dashboard widget",[$9]:"ID of the dashboard widget (graph) a query is issued from, when the request originates from a dashboard widget",[j9]:"Unique identifier for this API request, useful for debugging and support"};var bn=class e extends Error{constructor(n,o,i,a,c){super(n);this.statusCode=o;this.code=i;this.requestId=a;this.details=c;this.name="CliError"}static fromErrorResponse(n,o){return new e(n.message,n.statusCode,n.code,o,n.details)}};function cN(e){if(e instanceof bn){let r=[`Error: ${e.message}`];return e.code&&r.push(`Code: ${e.code}`),e.statusCode&&r.push(`Status: ${e.statusCode}`),e.requestId&&r.push(`Request ID: ${e.requestId}`),e.details&&r.push(`Details: ${JSON.stringify(e.details,null,2)}`),r.join(`
|
|
171
|
-
`)}return e instanceof Error?`Error: ${e.message}`:String(e)}function
|
|
169
|
+
`:o}var g9={CLAUDE_CODE_ENABLE_TELEMETRY:"1",CLAUDE_CODE_ENHANCED_TELEMETRY_BETA:"1",OTEL_METRICS_EXPORTER:"otlp",OTEL_LOGS_EXPORTER:"otlp",OTEL_TRACES_EXPORTER:"otlp",OTEL_EXPORTER_OTLP_PROTOCOL:"http/json",OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:"delta"};function y9(e,r,n,o){let i=(0,Li.join)(e,".claude","settings.json");q(`Claude Code \u2192 ${i}`),(0,wf.mkdirSync)((0,Li.dirname)(i),{recursive:!0});let a=ts(i),c;try{c=JSON.parse(a??"{}")}catch{throw new Error(`${i} is not valid JSON. Fix or remove it before re-running.`)}if(!so(c))throw new Error(`${i} must contain a JSON object at the top level.`);let l=c.env??{};if(!so(l))throw new Error(`${i} "env" must be a JSON object.`);let d=o?"1":"0";c.env={...l,...g9,OTEL_EXPORTER_OTLP_ENDPOINT:r,OTEL_LOG_USER_PROMPTS:d,OTEL_LOG_TOOL_DETAILS:d,OTEL_LOG_TOOL_CONTENT:d,OTEL_EXPORTER_OTLP_HEADERS:`Authorization=Bearer ${n}`};let f=rs(i,a);es(i,`${JSON.stringify(c,null,2)}
|
|
170
|
+
`),q(f===void 0?" created":` patched (backup: ${f})`)}function h9(e,r,n){return{environment:"dev",log_user_prompt:n,exporter:{"otlp-http":{endpoint:`${e}/v1/logs`,protocol:"binary",headers:{Authorization:`Bearer ${r}`}}},trace_exporter:{"otlp-http":{endpoint:`${e}/v1/traces`,protocol:"binary",headers:{Authorization:`Bearer ${r}`}}}}}function T9(e,r,n,o){let i=(0,Li.join)(e,".codex"),a=(0,Li.join)(i,"config.toml");q(`Codex \u2192 ${a}`),(0,wf.mkdirSync)(i,{recursive:!0});let c=ts(a),l=c===void 0?{}:Af(c),d="otel"in l;delete l.otel,l.otel=h9(r,n,o);let f=rs(a,c);es(a,Pf(l)),q(f===void 0?" created":d?` replaced existing [otel] tables (backup: ${f})`:` appended (backup: ${f})`)}function Ww(){return new yr("--endpoint <OTLP_ENDPOINT>","OTLP base URL").env("TSUGA_OTLP_ENDPOINT").makeOptionMandatory()}function Zw(){return new yr("--ingestion-api-key <INGESTION_API_KEY>","Tsuga ingestion API key").env("TSUGA_INGESTION_API_KEY").makeOptionMandatory()}var Xw="Restart your claude / codex session to load the new config.";function Jw(e){let r=e.command("setup").description("Configure local LLM CLIs to ship OTEL telemetry to Tsuga");r.command("claude-code").description("Patch ~/.claude/settings.json with Tsuga OTEL env").addOption(Ww()).addOption(Zw()).option("--no-include-prompts","Strip user prompts + tool content from telemetry (default: include)").action(n=>{y9((0,Uf.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),q(Xw)}),r.command("codex").description("Patch ~/.codex/config.toml with Tsuga OTEL settings (replaces any existing [otel] table)").addOption(Ww()).addOption(Zw()).option("--no-include-prompts","Strip user prompts from telemetry (default: include)").action(n=>{T9((0,Uf.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),q(Xw)})}var Zp="/v0/logs";var Nf=["CRITICAL","ERROR","WARN","NOTICE","INFO","DEBUG","TRACE"];var qs=0,Lf=t.Object({__tsuga_metadata__:t.Object({id:t.String(),source:t.Optional(t.String())},{additionalProperties:!0}),context:t.Optional(t.Object({team:t.Optional(t.String({description:"Team name associated with this log."})),tag_policy_warnings:t.Optional(t.Record(t.String(),t.String()))},{additionalProperties:!0,description:"Context attributes attached to the log after ingestion and route processing. `team` comes from telemetry or route-enriched context when present."})),message:t.Optional(t.Unknown({description:"Log message after ingestion and route processing. It can be any JSON value because processors may map arbitrary data into `message`."})),timestamp:t.Number({description:"Log timestamp as a Unix timestamp in milliseconds."}),level:t.Enum(Nf,{description:"Log severity, normalized from the source severity into one of the fixed Tsuga levels (ordered `CRITICAL` to `TRACE`)."}),[DS]:t.Optional(t.String({description:"ID of the cluster this log was read from. Only set when the request spanned several clusters."}))},{additionalProperties:!0}),eN=100,E9="timestamp",_9=t.Union([t.Literal(E9)]),lo=t.Partial(t.Object({...Ve.properties,query:p({type:"tsuga-query",description:"Tsuga query used to filter logs in the selected time range."}),maxResults:t.Integer({minimum:1,maximum:1e3,description:"Maximum number of logs to return. Valid values are 1 through 1000."}),shouldRecommendAttributes:t.Boolean({description:"Whether Tsuga should return suggested attributes to highlight in results."}),triggeredBy:t.Literal("refresh",{description:"Indicates the query was triggered by a refresh action."}),startOffset:t.Number({minimum:qs,description:"Result offset used when fetching additional log rows."}),startOffsets:t.Array(t.Number({minimum:qs}),{description:`Result offsets used when fetching additional log rows, one per entry of \`clusterIds\` and in the same order. Echo back each cluster's \`nextStartOffset\` from the previous response. Must have the same length as \`clusterIds\`. Defaults to ${qs} for every cluster.`}),clusterId:p({allowEmpty:!1,description:"ID of the cluster to target. Omit to use the default cluster."}),clusterIds:Na,sortBy:_9,sortDirection:t.Union([t.Literal("asc"),t.Literal("desc")],{description:"Timestamp sort direction for log results."})})),CWe=m({tags:["logs"],url:`${Zp}/count`,method:"GET",query:t.Pick(lo,["from","to","query","clusterId","clusterIds"]),response:t.Object({count:t.Number(),clusterResponses:t.Optional(Yo())})}),Fs=t.Object({value:t.String(),priority:t.Number()}),PWe=m({tags:["logs"],url:`${Zp}/search`,method:"GET",query:lo,response:t.Object({logs:t.Optional(t.Array(Lf)),attributesToHighlight:t.Optional(t.Array(Fs)),clusterResponses:t.Optional(Yo(t.Object({nextStartOffset:t.Number({description:"Number of logs consumed on this cluster so far. Echo it back at this cluster's position in `startOffsets` to fetch the next page."})})))},{additionalProperties:!0})}),I9=t.Cyclic({TokenOutput:t.Union([t.Object({type:t.Literal("top"),values:t.Array(t.String())}),t.Object({type:t.Literal("ip"),value:t.String()}),t.Object({type:t.Literal("range"),min:t.Number(),max:t.Number()}),t.Object({type:t.Literal("variable"),value:t.String()}),t.Object({type:t.Literal("text"),value:t.String()}),t.Object({type:t.Literal("date"),value:t.String()}),t.Object({type:t.Literal("url"),value:t.String()}),t.Object({type:t.Literal("structure"),key:t.Array(t.String()),value:t.Array(t.Ref("TokenOutput"))})])},"TokenOutput",{description:"A token identified as part of the pattern"}),b9=t.Object({id:t.String(),pattern:t.Array(I9),size:t.Integer({description:"Number of logs that matched the pattern"}),examples:t.Array(t.Object({id:t.String(),timestampUnix:t.Number()})),timeDistribution:t.Array(t.Number()),staticFeatures:t.Array(t.Object({key:t.String(),value:t.String()},{description:"Fixed groups present in all logs matching the pattern"}))}),UWe=m({tags:["logs"],url:`${Zp}/patterns`,method:"GET",query:t.Object({...Ve.properties,query:p({type:"tsuga-query"}),clusteringThreshold:t.Optional(t.Number()),clusterId:t.Optional(p({allowEmpty:!1}))}),response:t.Object({patterns:t.Array(b9),sampleSize:t.Number()})}),wWe=m({tags:["logs"],url:`${Zp}/attributes`,method:"GET",query:t.Object({...Ve.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),clusterIds:t.Optional(Na)}),response:t.Object({attributes:t.Array(t.String()),clusterResponses:t.Optional(Yo())})});var Hs=`/${"v1"}/logs`,vf=t.Object({context:t.Optional(t.Object({team:t.Optional(t.String({description:"Team name associated with this log."}))},{additionalProperties:!0,$id:"LogContext",description:"Context attributes attached to the log after ingestion and route processing. `team` comes from telemetry or route-enriched context when present."})),...t.Pick(Lf,["message","timestamp","level"]).properties},{additionalProperties:!0,$id:"LogEvent",description:"Log event including message, timestamp, severity level, and optional enriched context attributes."}),S9={context:{team:"platform"},message:"Request completed successfully",timestamp:17040672e5,level:"INFO"};Object.assign(vf,{examples:[S9]});var tN=t.Object({query:t.Optional(p({type:"tsuga-query",default:"*",description:"Tsuga query selecting logs to return. Omit to search all logs with `*`."})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e3,default:eN,description:"Maximum number of logs to return. Defaults to 100. Valid values are 1 through 1000."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),...mt.properties},{description:"Log search query. Provide a time range, optional Tsuga query, and optional limit."}),O9={query:"level:ERROR",maxResults:100,from:1704067200,to:1704070800};Object.assign(tN,{examples:[O9]});var rN=m({description:"Searches logs in a required time range using Tsuga query syntax. Use this endpoint to retrieve raw log events for investigations or automation. See [Logs](/documentation/explore/logs) and [Query syntax](/documentation/explore/query-syntax).",operationId:"searchLogs",tags:["public","logs"],url:`${Hs}/search`,method:"GET",query:tN,response:t.Object({logs:t.Array(vf,{description:"Log events matching the query and time range."})})}),A9=t.Object({pattern:t.String({description:"Clustered log pattern formatted as a readable string."}),size:t.Integer({description:"Number of logs that matched the pattern"}),groups:t.Array(t.Object({key:t.String({description:"Attribute dot-path shared by all logs in the pattern."}),value:t.String({description:"Value of the attribute identified by `key`, common to all logs in the pattern."})},{description:"Attribute key-value pair that is constant across every log matching this pattern, e.g. a shared `level` or `context.team`."}))}),nN=t.Object({patterns:t.Array(A9,{description:"Log patterns clustered from logs matching the query."}),sampleSize:t.Number({description:"Number of logs sampled while computing patterns."})},{}),x9={patterns:[{pattern:"Resolved segment SegmentId([0:1]) from cache",size:37004,groups:[{key:"level",value:"DEBUG"},{key:"context.team",value:"infra"}]}],sampleSize:100};Object.assign(nN,{examples:[x9]});var oN=m({description:"Clusters matching logs into readable patterns for the requested time range. Use this to summarize common log shapes before drilling into raw events. See [Logs](/documentation/explore/logs).",operationId:"getLogPatterns",tags:["public","logs"],url:`${Hs}/patterns`,method:"GET",query:t.Object({...mt.properties,query:p({type:"tsuga-query",description:"Tsuga query selecting logs to cluster into patterns."}),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:nN}),R9=t.Object({exampleLog:t.Optional(vf),team:t.String({description:"Team associated with the new error pattern."}),env:t.String({description:"Environment associated with the new error pattern."}),service:t.String({description:"Service associated with the new error pattern."}),firstSeen:t.Number({description:"Unix timestamp in seconds when this pattern was first seen."}),lastSeen:t.Number({description:"Unix timestamp in seconds when this pattern was last seen."})}),iN=t.Object({newErrorPatterns:t.Array(R9,{description:"Error patterns first seen in the requested time range."})},{}),C9={newErrorPatterns:[{team:"platform",env:"production",service:"api-gateway",firstSeen:1704067200,lastSeen:1704153600,exampleLog:{message:"ConnectionError: Failed to connect to database",timestamp:17041536e5,level:"ERROR"}}]};Object.assign(iN,{examples:[C9]});var aN=m({description:"Finds error patterns first seen in the requested time range, optionally filtered by team, environment, or service. Use this to detect newly appearing failures. See [Logs](/documentation/explore/logs).",operationId:"getNewErrorPatterns",tags:["public","logs"],url:`${Hs}/patterns/new`,method:"GET",query:t.Object({...mt.properties,team:t.Optional(p({description:"Team name to restrict pattern detection to."})),env:t.Optional(p({description:"Environment to restrict pattern detection to."})),service:t.Optional(p({description:"Service name to restrict pattern detection to."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:iN}),P9=t.Object({team:t.String({description:"Team associated with the error pattern."}),env:t.String({description:"Environment associated with the error pattern."}),pattern:t.String({description:"Error pattern formatted as a readable string."}),increaseTimestamps:t.Array(t.Number({description:"Unix timestamp in milliseconds of a detected spike in occurrence of this pattern. One entry per spike detected in the requested time range."}))}),sN=t.Object({errorPatternIncreases:t.Array(P9,{description:"Error patterns with increased occurrence in the requested time range."})},{}),U9={errorPatternIncreases:[{team:"platform",env:"production",pattern:"Non-resolved segment SegmentId(*) from cache",increaseTimestamps:[17041536e5,17042392e5]}]};Object.assign(sN,{examples:[U9]});var cN=m({description:"Finds error patterns whose occurrence increased for a team in the requested time range. Use this to identify growing failure modes. See [Logs](/documentation/explore/logs).",operationId:"getErrorPatternIncrease",tags:["public","logs"],url:`${Hs}/patterns/increase`,method:"GET",query:t.Object({...mt.properties,team:p({description:"Team name to analyze for pattern increases."}),env:t.Optional(p({description:"Environment to restrict the analysis to."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:sN}),pN=t.Object({attributes:t.Array(t.String(),{description:"Log attribute dot-paths observed in the time range"})},{}),w9={attributes:["context.env","context.k8s.pod.name","context.service.name","context.team","level","message","timestamp"]};Object.assign(pN,{examples:[w9]});var N9=t.Object({...mt.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))},{description:"Log attribute discovery query. Provide a time range and optional cluster ID."}),uN=m({description:"Lists log attribute dot-paths observed in the requested time range. This endpoint requires a public API credential that can read all relevant teams because attribute discovery is not team-filtered. Use this to discover fields for Tsuga queries, filters, and grouping. See [Logs](/documentation/explore/logs).",operationId:"getLogAttributes",tags:["public","logs"],url:`${Hs}/attributes`,method:"GET",query:N9,response:pN});var Gr="/v0/metrics",L9=t.Object({__tsuga_metadata__:t.Object({},{additionalProperties:!0}),context:t.Optional(t.Object({},{additionalProperties:!0})),message:t.Optional(t.String()),timestamp:t.Number(),level:t.Enum(Nf)},{additionalProperties:!0}),KWe=m({tags:["metrics"],url:`${Gr}/count`,method:"GET",query:t.Pick(lo,["from","to","query","clusterId"]),response:t.Object({count:t.Number()})}),zWe=m({tags:["metrics"],url:`${Gr}/search`,method:"GET",query:lo,response:t.Object({logs:t.Optional(t.Array(L9)),totalHits:t.Optional(t.Number()),attributesToHighlight:t.Optional(t.Array(Fs))},{additionalProperties:!0})}),Xp=t.Enum(["counter","gauge","histogram","summary","composite_histogram"],{description:"Metric instrument type, set by the reporting instrumentation. `counter` accumulates a monotonically increasing total (aggregate with `sum` or `increase`); `gauge` reports a point-in-time value that can go up or down (aggregate with `average`, `max`, `min`, or `last`); `histogram`, `composite_histogram`, and `summary` report a distribution of values, from which percentiles can be computed. Tsuga displays `composite_histogram` metrics as Histogram in the app."}),kf=t.Enum(["delta","cumulative","none"],{description:"Metric temporality. `delta` reports changes per collection interval, `cumulative` reports running totals, and `none` means temporality is not applicable or unknown."}),lN=t.Number({description:"Timestamp of the most recent data point recorded for this metric, in milliseconds since the Unix epoch. Omitted when Tsuga has no record of it. Computed from a periodically refreshed metadata snapshot, so it can lag ingestion by a few minutes and should not be used to detect sub-minute gaps."}),v9=t.Object({capabilities:t.Optional(t.Array(t.String(),{description:"Aggregate function types (such as `max`, `min`, `sum`) supported when querying or graphing this metric. If this field is omitted or empty, all aggregate types are supported."})),description:t.Optional(t.String({description:"Human-readable description of the metric"})),tags:t.Optional(t.Array(t.String(),{description:"Attribute names available as dimensions for filtering or grouping this metric. Exposed publicly as `attributes`."})),temporality:t.Optional(kf),type:t.Optional(Xp),unit:t.Optional(t.String({description:"Metric unit reported by instrumentation or inferred metadata."})),lastSeen:t.Optional(lN)}),YWe=m({url:`${Gr}/metadata`,method:"GET",query:t.Object({...Ve.properties,metricName:p({allowEmpty:!1}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:v9}),VWe=m({tags:["metrics"],url:Gr,method:"GET",query:t.Object({...Ve.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:t.Array(t.String())}),Jp=t.Array(t.Object({name:t.String({description:"Metric name observed by Tsuga."}),type:Xp,lastSeen:t.Optional(lN)}),{description:"Metrics observed in the requested time range, with the instrument type each was reported as."}),k9=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Jp,{examples:[k9]});var QWe=m({tags:["metrics"],url:`${Gr}/names-and-types`,method:"GET",query:t.Object({...Ve.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Jp}),Ks=t.Array(t.String(),{description:"Attribute names available as dimensions for filtering or grouping the requested metric(s)."}),M9=["service","env","host","method","status_code"];Object.assign(Ks,{examples:[M9]});var WWe=m({tags:["metrics"],url:`${Gr}/attributes`,method:"GET",query:t.Object({...Ve.properties,metricName:p({allowEmpty:!1}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Ks}),ZWe=m({tags:["metrics"],url:`${Gr}/attributes/batch`,method:"GET",query:t.Object({...Ve.properties,metricNames:t.Array(p({allowEmpty:!1}),{minItems:1,description:"Metric names to fetch attributes for"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Ks}),Mf=t.Object({assets:t.Array(t.Object({type:t.Enum(["dashboard","monitor"],{description:"Kind of asset referencing the metric."}),id:t.String({description:"Dashboard or monitor ID for the asset that queries this metric."}),name:t.String({description:"Display name of the referencing dashboard or monitor."}),owner:t.String({description:"Team ID that owns the referencing dashboard or monitor."})},{description:"A dashboard or monitor that queries this metric."}),{description:"Dashboards and monitors that currently query this metric."})}),XWe=m({tags:["metrics"],url:`${Gr}/assets-usage`,method:"GET",query:t.Object({metricName:p({allowEmpty:!1})}),response:Mf}),JWe=m({url:`${Gr}/per-attribute`,method:"GET",query:t.Object({from:t.Optional(t.Number()),to:t.Optional(t.Number()),attribute:p(),clusterId:t.Optional(p({allowEmpty:!1}))}),response:t.Array(t.String())});var Df=`/${"v1"}/metrics`,D9=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Jp,{examples:[D9]});var Gf=t.Object({name:t.String({description:"Metric name observed by Tsuga. Use this value in metric queries and aggregations."}),type:Xp,description:t.Optional(t.String({description:"Human-readable description of what the metric measures, set by the reporting instrumentation. Omitted when the instrumentation did not provide one."})),unit:t.Optional(t.String({description:"Metric unit reported by instrumentation or inferred metadata."})),temporality:t.Optional(kf),capabilities:t.Optional(t.Array(t.String(),{description:"Aggregate function types (such as `max`, `min`, `sum`) supported when querying or graphing this metric. An empty or omitted array means all aggregate types are supported."})),attributes:t.Optional(t.Array(t.String(),{description:"Metric attribute names available as dimensions for filtering or grouping."}))}),G9={name:"http.server.request.duration",type:"histogram",description:"Duration of HTTP server requests",unit:"ms",temporality:"delta",capabilities:["max","min","sum"],attributes:["context.team","context.environment","context.region"]};Object.assign(Gf,{examples:[G9]});var mN=t.Object({...mt.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))},{description:"Metric metadata query. Provide the time range to inspect and optionally a cluster ID."}),dN=m({description:"Lists metrics observed in the requested time range with metadata such as type, unit, temporality, capabilities, and attributes. Use this to discover metric names before querying or graphing them. See [Metrics](/documentation/explore/metrics/index).",operationId:"listMetrics",tags:["public","metrics"],url:Df,method:"GET",query:mN,response:t.Array(Gf)}),fN=m({description:"Retrieves metadata for one metric name in the requested time range. Use this to inspect available dimensions and supported query behavior for a metric. See [Metric details](/documentation/explore/metrics/metric-details).",operationId:"getMetric",tags:["public","metrics"],url:`${Df}/:name`,method:"GET",params:t.Object({name:p({allowEmpty:!1,description:"Metric name to retrieve, for example `http.server.request.duration`."})}),query:mN,response:Gf}),$9=["service","env","host","method","status_code"];Object.assign(Ks,{examples:[$9]});var gN=t.Pick(Mf,["assets"]),j9={assets:[{type:"dashboard",id:"dash-123-abc",name:"API Performance Overview",owner:"team-123-abc"},{type:"monitor",id:"mon-789-ghi",name:"High Latency Alert",owner:"team-123-abc"}]};Object.assign(gN,{examples:[j9]});var yN=m({description:"Retrieve dashboards and monitors that use a specific metric",operationId:"getMetricAssetsUsage",tags:["private"],url:`${Df}/assets-usage`,method:"GET",query:t.Object({metricName:p({allowEmpty:!1,description:"The name of the metric to find usage for"})}),response:gN});var vi="/v0/traces",d7e=m({tags:["traces"],url:`${vi}/count`,method:"GET",query:t.Pick(lo,["from","to","query","clusterId"]),response:t.Object({count:t.Number()})}),B9=["unset","ok","error"],q9=t.Enum(B9),F9=["unspecified","internal","server","client","producer","consumer"],H9=t.Enum(F9),TN=t.Object({__tsuga_metadata__:t.Optional(t.Object({},{additionalProperties:!0})),context:t.Optional(t.Object({telemetry:t.Optional(t.Object({sdk:t.Optional(t.Object({language:t.Optional(t.String())},{additionalProperties:!0}))},{additionalProperties:!0})),tag_policy_warnings:t.Optional(t.Record(t.String(),t.String())),service:t.Optional(t.Object({name:t.Optional(t.String()),version:t.Optional(t.String())},{additionalProperties:!0})),env:t.Optional(t.String())},{additionalProperties:!0})),parent_span_id:t.Optional(t.String()),resource_attributes:t.Object({},{additionalProperties:!0}),span_attributes:t.Object({},{additionalProperties:!0}),duration:t.Number({description:"In milliseconds."}),duration_ns:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),start_time:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),end_time:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),error:t.Optional(t.Object({message:t.String()})),events:t.Optional(t.Array(t.Object({event_attributes:t.Object({},{additionalProperties:!0}),event_name:t.String(),event_timestamp_nanos:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."})}))),links:t.Optional(t.Array(t.Object({},{additionalProperties:!0}))),span_id:t.String(),span:t.Object({kind:H9,name:t.String()}),status_code:t.Optional(q9),trace_id:t.String()}),EN=100,K9="start_time",z9="duration_ns",Y9=t.Union([t.Literal(K9),t.Literal(z9)]),V9={...Ve.properties,query:t.Optional(p({type:"tsuga-query"})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e4})),shouldRecommendAttributes:t.Optional(t.Boolean()),startOffset:t.Optional(t.Number({minimum:qs})),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),sortBy:t.Optional(Y9),sortDirection:t.Optional(t.Union([t.Literal("asc"),t.Literal("desc")]))},f7e=m({tags:["traces"],url:`${vi}/search`,method:"GET",query:t.Object(V9),response:t.Object({spans:t.Optional(t.Array(TN)),attributesToHighlight:t.Optional(t.Array(Fs))})});var Q9=t.Object({groupByAttributes:t.Array(p({allowEmpty:!1}),{description:'Glob patterns of span_attributes keys to use as additional grouping dimensions (e.g. "db.*"). Matches against flattened dotted keys of span_attributes only.'}),minLeafSpansToAggregate:t.Integer({minimum:2,description:"Minimum leaf-group size before aggregation occurs. Default 5."}),maxParentDepth:t.Integer({minimum:-1,description:"Max depth of recursive parent aggregation. 0 = leaves only, -1 = unlimited (default)."}),aggregationHistogramBucketsSeconds:t.Array(t.Number({minimum:0}),{description:"Upper bounds for the latency histogram in seconds. Empty array disables the histogram attributes."}),sortSpans:t.Boolean({description:"Whether to sort the returned spans by start_time (span_id tie-breaker). Set false when the caller reconstructs the trace tree and does not need ordering. Default true."})}),W9=t.Object({...Ve.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),...t.Partial(Q9).properties}),g7e=m({tags:["traces"],url:`${vi}/summarize`,method:"GET",query:W9,response:t.Object({spans:t.Array(TN)})}),y7e=m({tags:["traces"],url:`${vi}/attributes`,method:"GET",query:t.Object({...Ve.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:t.Object({attributes:t.Array(t.String())})}),Z9=t.Object({key:t.String({description:"Opaque stable key identifying this contributing service within the response. Tsuga assigns it while building the summary; `ranges[].contributions[].serviceKey` and `serviceTotals[].serviceKey` reference this value."}),name:t.String({description:"Observed service name that contributed leaf-span time to the trace. Comes from trace service context and is returned for every contributing service."}),env:t.Optional(t.String({description:"Observed service environment for this contributing service. Comes from trace service context and is absent when the spans do not carry an environment."})),id:t.Optional(t.String({description:"Service catalog ID for this contributing service. Tsuga sets it when exactly one catalog entry matches the observed service and environment; absent when the service is not cataloged or matches ambiguously."})),namespace:t.Optional(t.String({description:"Service namespace from the matched service catalog entry. Returned only when Tsuga can resolve the contributing service to one catalog entry with a namespace."}))}),X9=t.Object({fromNs:t.String({description:"Range start time in nanoseconds since Unix epoch. Tsuga sets it from the trace timeline split where active leaf spans change. Transmitted as a string to avoid losing precision."}),toNs:t.String({description:"Range end time in nanoseconds since Unix epoch. Tsuga sets it from the trace timeline split where active leaf spans change. Transmitted as a string to avoid losing precision."}),durationNs:t.String({description:"Range duration in nanoseconds, computed as `toNs - fromNs`. Transmitted as a string to avoid losing precision."}),contributions:t.Array(t.Object({serviceKey:t.String({description:"Contributing service key for this range. References `services[].key` in the same response."}),weight:t.Number({description:"Share of this range attributed to the service, from `0` through `1`. Tsuga computes the weight from active leaf spans in the range; weights inside one range sum to `1`."}),durationNs:t.String({description:"Estimated duration attributed to this service in the range, computed as `weight` times the range's own `durationNs` and rounded to whole nanoseconds. Use `serviceTotals` as authoritative when rounded range values do not add up exactly."})}),{description:"Services contributing active leaf-span time to this range, with weighted shares for the range duration."}),spanIds:t.Array(t.String(),{description:"Leaf span IDs that produced this range. Tsuga returns IDs from the leaf-only attribution set, including merged sub-ranges after short-range collapsing."})}),J9=t.Object({serviceKey:t.String({description:"Contributing service key for this aggregate total. References `services[].key` in the same response."}),durationNs:t.String({description:"Total wall-clock contribution of this service across the trace, in nanoseconds. Sum of `weight * durationNs` over every range the service contributes to; authoritative when it disagrees with rounded per-range values. Transmitted as a string to avoid losing precision."}),share:t.Number({description:"Share of total trace duration attributed to this service, from `0` through `1`. Computed as `durationNs / totalDurationNs`; multiply by 100 for a percentage."})}),$f=t.Optional(t.Number({minimum:0,description:"Minimum range duration in milliseconds. Shorter ranges are collapsed (absorbed into a neighbor or blended with adjacent shorts) to keep the timeline readable. When omitted, the default depends on the trace: max(1ms, 1% of the total trace duration), so e.g. a 10s trace collapses ranges shorter than 100ms. Pass 0 to disable collapsing."})),jf=t.Optional(t.Boolean({default:!0,description:"When false, omits the per-range timeline (returns `ranges: []`) and returns only `services` and `serviceTotals`. Cuts payload size for callers that only need the headline. Defaults to true."})),eu=t.Object({traceId:t.String({description:"Trace ID summarized by the response. Echoes the required `traceId` query parameter."}),startTimeNs:t.String({description:"Earliest `start_time` across fetched spans, in nanoseconds since Unix epoch. If the request window does not cover the full trace, this reflects the fetched subset, not necessarily the trace's true start. Transmitted as a string to avoid losing precision."}),endTimeNs:t.String({description:"Latest `end_time` across fetched spans, in nanoseconds since Unix epoch. If the request window does not cover the full trace, this reflects the fetched subset, not necessarily the trace's true end. Transmitted as a string to avoid losing precision."}),totalDurationNs:t.String({description:"Total fetched trace duration in nanoseconds, computed as `endTimeNs - startTimeNs`. Transmitted as a string to avoid losing precision."}),truncated:t.Boolean({description:"Whether the underlying span fetch hit its result cap. When true, the latency summary may be incomplete because not every span in the trace was available."}),services:t.Array(Z9,{description:"Unique services that contributed leaf-span time to the trace, enriched with catalog IDs when Tsuga can resolve them. Referenced by `serviceKey` from `ranges` and `serviceTotals`."}),ranges:t.Array(X9,{description:"Sequential trace timeline split into ranges wherever the active leaf-span set changes. Empty when the request sets `includeRanges` to false."}),serviceTotals:t.Array(J9,{description:"Aggregated wall-clock contribution per service across the fetched trace. Use this for service-level latency ownership without processing the per-range timeline."})}),e4={traceId:"78c99c5bb1e4a30297fa134b9dbec64f",startTimeNs:"1704067200000000000",endTimeNs:"1704067202400000000",totalDurationNs:"2400000000",truncated:!1,services:[{key:"checkout|prod",name:"checkout",env:"prod",id:"123-456-abc",namespace:"default"},{key:"payments|prod",name:"payments",env:"prod",id:"456-789-def",namespace:"default"}],ranges:[{fromNs:"1704067200000000000",toNs:"1704067201200000000",durationNs:"1200000000",contributions:[{serviceKey:"checkout|prod",weight:1,durationNs:"1200000000"}],spanIds:["3df8cc3449378f66"]},{fromNs:"1704067201200000000",toNs:"1704067202400000000",durationNs:"1200000000",contributions:[{serviceKey:"checkout|prod",weight:.5,durationNs:"600000000"},{serviceKey:"payments|prod",weight:.5,durationNs:"600000000"}],spanIds:["187a47da1b2560f8","3df8cc3449378f66"]}],serviceTotals:[{serviceKey:"checkout|prod",durationNs:"1800000000",share:.75},{serviceKey:"payments|prod",durationNs:"600000000",share:.25}]};Object.assign(eu,{examples:[e4]});var h7e=m({tags:["traces"],url:`${vi}/latency-summary`,method:"GET",query:t.Object({...Ve.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),minRangeDurationMs:$f,includeRanges:jf}),response:eu}),hN=t.Object({filter:p({type:"tsuga-query",description:"TQL filter defining the group"}),timeRange:Vo}),t4=t.Object({value:t.String(),supportA:t.Number(),supportB:t.Number()}),r4=t.Object({value:t.String(),supportA:t.Number(),supportB:t.Number(),lift:t.Union([t.Number(),t.Null()]),pValue:t.Number()}),n4=t.Object({attr:t.String(),values:t.Array(r4),otherValues:t.Array(t4)}),T7e=m({tags:["traces"],url:`${vi}/contrast-sets`,method:"POST",body:t.Object({groupA:hN,groupB:hN,candidateAttrs:t.Optional(t.Array(p({allowEmpty:!1}))),topK:t.Optional(t.Integer({minimum:1,maximum:100})),minLift:t.Optional(t.Number({minimum:1})),minSupport:t.Optional(t.Number({minimum:0,maximum:100})),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:t.Object({contrastSets:t.Array(n4),groupACount:t.Number(),groupBCount:t.Number()})});var Bf=`/${"v1"}/traces`,qf=t.Object({context:t.Optional(t.Object({service:t.Optional(t.Object({name:t.Optional(t.String({description:"Service name associated with the span."})),version:t.Optional(t.String({description:"Service version associated with the span."}))},{additionalProperties:!0,description:"Service identity associated with the span, from OpenTelemetry service resource attributes."}))},{additionalProperties:!0,description:"OpenTelemetry resource context resolved for the span, holding the identity of the emitting service."})),parentSpanId:t.Optional(t.String({description:"`spanId` of this span's parent within the same trace. Absent for the root span."})),resourceAttributes:t.Object({},{additionalProperties:!0,description:"OpenTelemetry resource attributes describing the process/host that emitted the span (e.g. `host.name`, `k8s.pod.name`), as a flat key-value map set by the instrumented service or its SDK."}),spanAttributes:t.Object({},{additionalProperties:!0,description:"OpenTelemetry span attributes describing this operation (e.g. HTTP method, DB statement), as a flat key-value map set by the instrumented code or auto-instrumentation."}),duration:t.Number({description:"Span duration in milliseconds, derived from the nanosecond `startTime` and `endTime` values."}),startTime:t.String({description:"Span start time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),endTime:t.String({description:"Span end time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),error:t.Optional(t.Object({message:t.String({description:"Error message associated with the span."})},{description:"Error details associated with the span, separate from the OpenTelemetry `statusCode` field."})),events:t.Optional(t.Array(t.Object({event_attributes:t.Object({},{additionalProperties:!0,description:"Key-value attributes recorded with this event, set by the instrumented code when the event was added to the span (e.g. exception details)."}),event_name:t.String({description:"Name of the span event."}),event_timestamp_nanos:t.String({description:"Event timestamp in nanoseconds, transmitted as a string for precision."})},{description:"A single timestamped event recorded on the span, with its name and attributes."}),{description:"Events recorded on the span."})),spanId:t.String({description:"Unique span ID within the trace."}),span:t.Object({kind:t.String({description:"OpenTelemetry span kind describing the relationship to remote calls: `unspecified`, `internal`, `server`, `client`, `producer`, or `consumer`."}),name:t.String({description:"Operation name recorded on the span."})},{description:"Operation identity for the span, combining the recorded operation name and the OpenTelemetry span kind."}),statusCode:t.Optional(t.String({description:"OpenTelemetry span status set by the instrumented code: `unset` (default, no explicit status), `ok`, or `error`. Absent if the source span never set a status."})),traceId:t.String({description:"Trace ID shared by all spans in the trace."})},{additionalProperties:!0,$id:"SpanEvent",description:"Distributed tracing span including timing, identifiers, OpenTelemetry attributes, events, and status metadata."}),o4={context:{service:{name:"my-service",version:"1.0.0"}},parentSpanId:"187a47da1b2560f8",resourceAttributes:{},spanAttributes:{busyNs:374640,code:{file:{path:"src/queue/sqs.rs"},line:{number:162},module:{name:"queue::sqs"}},idleNs:23621445,maxMessages:"1",target:"queue::sqs",thread:{id:2,name:"tokio-runtime-worker"}},duration:23,startTime:"1770923469995353600",endTime:"1770923470019349500",spanId:"3df8cc3449378f66",span:{kind:"internal",name:"receive_messages"},statusCode:"ok",traceId:"78c99c5bb1e4a30297fa134b9dbec64f"};Object.assign(qf,{examples:[o4]});var i4={from:1704067200,to:1704070800,query:"context.service.name:my-service",maxResults:100},_N=t.Object({...mt.properties,query:t.Optional(p({type:"tsuga-query",default:"*",description:"Tsuga query selecting spans to return. Omit to search all spans in the range with `*`."})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e4,default:EN,description:"Maximum number of spans to return. Defaults to 100. Valid values are 1 through 10000."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))},{description:"Span search query. Provide a time range, optional Tsuga query, and optional limit."});Object.assign(_N,{examples:[i4]});var IN=m({description:"Searches spans in a required time range using Tsuga query syntax. Use this endpoint to retrieve trace spans for investigations or automation. See [Traces](/documentation/explore/traces) and [Query syntax](/documentation/explore/query-syntax).",operationId:"searchSpans",tags:["public","traces"],url:`${Bf}/search`,method:"GET",query:_N,response:t.Object({spans:t.Array(qf,{description:"Spans matching the query and time range."})})}),a4={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},bN=t.Object({...mt.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize. Use the `traceId` returned by span search, the trace details page, or your tracing instrumentation. Required; the requested time range must include the trace."}),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),groupByAttributes:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Glob patterns of span attribute keys to use as additional grouping dimensions. Use this when spans should be summarized separately for matching attributes, such as `db.*`. Matches flattened dotted span attribute keys; omitted by default."})),minLeafSpansToAggregate:t.Optional(t.Integer({minimum:2,default:5,description:"Minimum number of similar leaf spans in a group before Tsuga replaces them with one synthetic summary span. Use higher values for less aggressive summarization. Optional; defaults to 5 and must be at least 2."})),maxParentDepth:t.Optional(t.Integer({minimum:-1,default:-1,description:"Maximum depth of recursive parent aggregation after leaf spans are summarized. Use this to limit parent-level aggregation. Use `0` to aggregate leaf spans only or `-1` for unlimited depth; defaults to `-1`."})),aggregationHistogramBucketsSeconds:t.Optional(t.Array(t.Number({minimum:0}),{description:"Upper-bound bucket values, in seconds, for the latency histogram recorded on synthetic summary spans. Provide custom buckets when the default latency buckets are not suitable. Pass an empty array to omit histogram attributes; omitted values use Tsuga defaults from 5 ms through 10 s."})),sortSpans:t.Optional(t.Boolean({default:!0,description:"Whether Tsuga sorts returned spans by start time, using span ID as the tie-breaker for identical start times. Defaults to `true`; set to `false` only when reconstructing the trace tree yourself, in which case summary spans are appended after surviving spans."}))},{description:"Trace summarization query. Provide a trace ID, a time range covering the trace, and optional aggregation tuning."});Object.assign(bN,{examples:[a4]});var SN=m({description:"Summarizes a trace by aggregating groups of similar spans into synthetic summary spans, producing a compact view of large traces. Summary spans are marked with `spanAttributes.aggregation.is_summary` and carry span counts, duration statistics, and an optional latency histogram. See [Traces](/documentation/explore/traces).",operationId:"summarizeTrace",tags:["public","traces"],url:`${Bf}/summarize`,method:"GET",query:bN,response:t.Object({spans:t.Array(qf,{description:"Summarized trace spans, sorted by start time unless `sortSpans` is false. Aggregated groups are replaced by synthetic summary spans marked with `spanAttributes.aggregation.is_summary`."})})}),s4={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},ON=t.Object({...mt.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize. Use the `traceId` returned by span search, the trace details page, or your tracing instrumentation. Required; the requested time range must include the trace."}),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),minRangeDurationMs:$f,includeRanges:jf},{description:"Trace latency summary query. Provide a trace ID, a time range covering the trace, and optional timeline tuning."});Object.assign(ON,{examples:[s4]});var AN=m({description:"Summarizes where wall-clock time is spent in a trace, attributing each slice of the trace timeline to the services with active leaf spans. Returns per-service totals and an optional sequential range timeline. See [Traces](/documentation/explore/traces).",operationId:"getTraceLatencySummary",tags:["public","traces"],url:`${Bf}/latency-summary`,method:"GET",query:ON,response:eu});var CN=["timestamp","level","message"],PN=["count","ratio","team","level","pattern"];function it(e,r){let n=r??Ir(e);if(!n)throw new Error(`--${e} is required`);return Xs(n)}function xN(e){let r={from:it("from",e.from),to:it("to",e.to)},n=e.query??Ir("query");n!==void 0&&(r.query=n);let o=e.maxResults??Ir("max-results");if(o!==void 0){let i=Number(o);if(Number.isNaN(i))throw new Error(`--max-results must be a number (got: ${o})`);r.maxResults=i}return r}function Ie(e){let r=Ir(e);return r===void 0?"":` (default: ${r})`}function c4(e){let r=fu(e.output),n=e.fields===void 0?void 0:gu(e.fields);return r==="json"?{format:r,fields:n}:{format:r,fields:n??CN}}function p4(e){let r=fu(e.output),n=e.fields===void 0?void 0:gu(e.fields);return r==="json"?{format:r,fields:n}:{format:r,fields:n??PN}}function RN(e,r){let n={count:e.size,ratio:r>0?e.size/r:0,pattern:e.pattern};for(let{key:o,value:i}of e.groups)o==="context.team"?n.team=i:n[o]=i;return n}function u4(e,r){if(r.format==="json"){if(r.fields===void 0){Q(e);return}let{fields:i}=r;Q({patterns:e.patterns.map(a=>RN(a,e.sampleSize)).map(a=>yu(a,i)),sampleSize:e.sampleSize});return}let n=e.patterns.map(i=>RN(i,e.sampleSize)),o=hu(r.format,n,r.fields);o.length>0&&q(o)}function l4(e,r){if(r.format==="json"){if(r.fields===void 0){Q(e);return}let{fields:o}=r;Q({logs:e.logs.map(i=>yu(i,o))});return}let n=hu(r.format,e.logs,r.fields);n.length>0&&q(n)}function UN(e,r){let n=e.command("logs").description("Search and analyze logs");n.command("search").description("Search logs").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs${Ie("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-1000${Ie("max-results")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each log (default for --output=tsv|csv: ${CN.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=c4(c),d=await r()(rN,{query:xN(c)});l4(d,l)}),n.command("attributes").description("List log attribute dot-paths observed in the time range").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).action(async c=>{let l=await r()(uN,{query:{from:it("from",c.from),to:it("to",c.to)}});Q(l)}),n.command("patterns").description("List log patterns").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs before clustering into patterns${Ie("query")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each pattern (default for --output=tsv|csv: ${PN.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=p4(c),d={from:it("from",c.from),to:it("to",c.to)},f=c.query??Ir("query");f!==void 0&&(d.query=f);let g=await r()(oN,{query:d});u4(g,l)}),n.command("new-error-patterns").description("List error patterns first seen in this time range").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).option("--team <TEAM_NAME>","Filter by team").option("--env <ENV_NAME>","Filter by environment").option("--service <SERVICE_NAME>","Filter by service").action(async c=>{let l={from:it("from",c.from),to:it("to",c.to)};c.team!==void 0&&(l.team=c.team),c.env!==void 0&&(l.env=c.env),c.service!==void 0&&(l.service=c.service);let d=await r()(aN,{query:l});Q(d)}),n.command("error-pattern-increases").description("List error pattern increases for a given team").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).requiredOption("--team <TEAM_NAME>","Team to query").option("--env <ENV_NAME>","Filter by environment").action(async c=>{let l={from:it("from",c.from),to:it("to",c.to),team:c.team};c.env!==void 0&&(l.env=c.env);let d=await r()(cN,{query:l});Q(d)});let o=e.command("metrics").description("List and inspect metrics");o.command("list").description("List all metrics with their metadata").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).action(async c=>{let l=await r()(dN,{query:{from:it("from",c.from),to:it("to",c.to)}});Q(l)}),o.command("get <METRIC_NAME>").description("Retrieve a metric by name with its metadata").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).action(async(c,l)=>{let d=await r()(fN,{params:{name:c},query:{from:it("from",l.from),to:it("to",l.to)}});Q(d)}),o.command("assets-usage <METRIC_NAME>").description("List dashboards and monitors that use a specific metric").action(async c=>{let l=await r()(yN,{query:{metricName:c}});Q(l)});let i=e.command("traces").description("Search and summarize traces");i.command("search").description("Search spans").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter spans${Ie("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-10000${Ie("max-results")}`).action(async c=>{let l=await r()(IN,{query:xN(c)});Q(l)}),i.command("summarize").description("Summarize a trace by aggregating groups of similar spans into summary spans").requiredOption("--trace-id <TRACE_ID>","Trace ID to summarize").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).action(async c=>{let l=await r()(SN,{query:{traceId:c.traceId,from:it("from",c.from),to:it("to",c.to)}});Q(l)}),i.command("latency-summary").description("Summarize where wall-clock time is spent in a trace, attributed per service").requiredOption("--trace-id <TRACE_ID>","Trace ID to summarize").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).option("--min-range-duration-ms <MILLISECONDS>","Collapse timeline ranges shorter than this (default: max(1ms, 1% of trace duration); 0 disables collapsing)").option("--no-ranges","Omit the per-range timeline; return only services and serviceTotals").action(async c=>{let l={traceId:c.traceId,from:it("from",c.from),to:it("to",c.to)};if(c.minRangeDurationMs!==void 0){let f=Number(c.minRangeDurationMs);if(Number.isNaN(f))throw new Error(`--min-range-duration-ms must be a number (got: ${c.minRangeDurationMs})`);l.minRangeDurationMs=f}c.ranges||(l.includeRanges=!1);let d=await r()(AN,{query:l});Q(d)});let a=e.command("aggregation").description("Run aggregation queries");io(a,"scalar","Run aggregation queries and return scalar results",zC,r),io(a,"timeseries","Run aggregation queries and return timeseries results",VC,r)}var m4="x-tsuga-session-id",Ff="x-tsuga-source",Hf="x-tsuga-source-version",Kf="x-tsuga-source-commit",zf="x-tsuga-source-date",Yf="x-tsuga-rationale",d4="x-tsuga-dashboard-id",f4="x-tsuga-widget-id",g4="x-request-id",D7e={[m4]:"Session identifier for request correlation",[Ff]:"SDK or client source identifier (e.g., web-frontend, terraform-provider)",[Hf]:"SDK version",[Kf]:"SDK commit hash",[zf]:"SDK commit date",[Yf]:"Optional caller-supplied rationale for this request, recorded for telemetry",[d4]:"ID of the dashboard a query is issued from, when the request originates from a dashboard widget",[f4]:"ID of the dashboard widget (graph) a query is issued from, when the request originates from a dashboard widget",[g4]:"Unique identifier for this API request, useful for debugging and support"};var bn=class e extends Error{constructor(n,o,i,a,c){super(n);this.statusCode=o;this.code=i;this.requestId=a;this.details=c;this.name="CliError"}static fromErrorResponse(n,o){return new e(n.message,n.statusCode,n.code,o,n.details)}};function wN(e){if(e instanceof bn){let r=[`Error: ${e.message}`];return e.code&&r.push(`Code: ${e.code}`),e.statusCode&&r.push(`Status: ${e.statusCode}`),e.requestId&&r.push(`Request ID: ${e.requestId}`),e.details&&r.push(`Details: ${JSON.stringify(e.details,null,2)}`),r.join(`
|
|
171
|
+
`)}return e instanceof Error?`Error: ${e.message}`:String(e)}function y4(e){return e.replace(/\s+/g," ").replace(/[^\x20-\x7e\x80-\xff]/g,"").trim()}function NN(e,r,n,o){return async function(a,c={}){let{body:l,params:d,query:f}=c,g;if(a.url!==void 0)g=a.url;else if(a.buildUrl){if(!d)throw new bn("Internal error: params required for this endpoint");g=a.buildUrl(d)}else throw new bn("Internal error: endpoint has neither url nor buildUrl");let T=n===void 0?f:{clusterId:n,...f},_=wb(`${e}${g}`,T),se={Accept:"application/json",Authorization:`Bearer ${r}`,[Ff]:"cli",[Hf]:"1.17.0",[Kf]:"39070c46e",[zf]:"2026-08-13T12:27:34.868Z"};l&&(se["Content-Type"]="application/json");let ge=o?.(),jr=ge?y4(ge):"";jr&&(se[Yf]=jr);let mo=await fetch(_,{method:a.method,headers:se,body:l?JSON.stringify(l):null}),Br;try{Br=await mo.json()}catch{throw new bn(mo.status===504?"The server timed out (504). Try a smaller time range.":`Server returned a non-JSON response (HTTP ${mo.status}).`,mo.status)}if(Br.error)throw bn.fromErrorResponse(Br.error,Br.requestId);return T4(Br,h4(c)),Br.data}}function h4({body:e,query:r}){let n=r?.offset??e?.offset;return typeof n=="number"?n:0}function T4(e,r){let n=e.metadata?.pagination;if(n===void 0||!Array.isArray(e.data))return;let o=r+e.data.length;o>=n.totalCount||ug(`Showing ${e.data.length} of ${n.totalCount} (offset ${r}). Use --limit (max ${Fo}) and --offset ${o} for the next page.`)}function Vf(e,r=n=>{process.exit(n)}){e.on("error",n=>{if(n.code==="EPIPE"){r(process.exitCode);return}throw n})}var E4=3e3,_4="https://registry.npmjs.org/@tsuga/cli/latest";function I4(e,r){let n=e.split(".").map(Number),o=r.split(".").map(Number);for(let i=0;i<Math.max(n.length,o.length);i++){let a=n[i]??0,c=o[i]??0;if(a>c)return!0;if(a<c)return!1}return!1}async function LN(e){try{let r=Wb();if(r&&Date.now()-new Date(r).getTime()<Zs)return;let n=await fetch(_4,{signal:AbortSignal.timeout(E4)});if(!n.ok)return;let i=(await n.json()).version;I4(i,e)&&(process.stderr.write(`
|
|
172
172
|
Update available: ${e} \u2192 ${i}
|
|
173
|
-
`),process.stderr.write("Run `tsuga self-update` to update\n")),
|
|
174
|
-
`).configureHelp({sortSubcommands:!0}).helpOption("-h, --help","Display help for command").helpCommand("help [command]","Display help for command").option("--operation-api-key <OPERATION_API_KEY>","Operation API key (overrides config and TSUGA_OPERATION_API_KEY)").option("--cluster <CLUSTER_ID>","Target cluster (overrides config and TSUGA_CLUSTER_ID)"),
|
|
173
|
+
`),process.stderr.write("Run `tsuga self-update` to update\n")),Zb(new Date().toISOString())}catch{}}Vf(process.stdout);Vf(process.stderr);var _e=new fo().name("tsuga").description("Manage Tsuga resources, telemetry, and configuration from the command line").version("1.17.0").addHelpText("before",()=>`${og()}
|
|
174
|
+
`).configureHelp({sortSubcommands:!0}).helpOption("-h, --help","Display help for command").helpCommand("help [command]","Display help for command").option("--operation-api-key <OPERATION_API_KEY>","Operation API key (overrides config and TSUGA_OPERATION_API_KEY)").option("--cluster <CLUSTER_ID>","Target cluster (overrides config and TSUGA_CLUSTER_ID)"),tu,vN;function $r(){if(tu)return tu;let e=_e.opts(),r=Ko({operationApiKey:e.operationApiKey,clusterId:e.cluster});Qs(r.credential,new Date)&&(console.error("Your session expired. Run `tsuga auth login` to sign in again."),process.exit(1));let n=Bb(r);return n||(console.error("Error: no credentials. Authenticate with one of:"),console.error(" tsuga auth login # log in as a user (OAuth)"),console.error(" tsuga auth operation-key <OPERATION_API_KEY> # save an operation API key"),console.error(" export TSUGA_OPERATION_API_KEY=<OPERATION_API_KEY>"),console.error(" tsuga --operation-api-key <OPERATION_API_KEY> <COMMAND>"),process.exit(1)),tu=NN(r.apiUrl,n,r.clusterId,()=>vN),tu}var kN="Setup & config:",MN="Documentation, help & feedback:";_e.commandsGroup(kN);Jb(_e);AS(_e);var b4=new Set(_e.commands);_e.commandsGroup("Resources:");jw(_e,$r);_e.commandsGroup("Query & explore:");UN(_e,$r);oA(_e,$r);nC(_e,$r);$C(_e,$r);WC(_e,$r);_e.commandsGroup(MN);wS(_e,$r);kS(_e,$r);_e.commandsGroup(kN);IS(_e,$r);Jw(_e);sC(_e);qw(_e);OS(_e);_e.commandsGroup(MN).helpCommand("help [command]");function DN(e){if(e.commands.length===0){e.option("--rationale <RATIONALE>",'Why you are making this call, e.g. "confirming the deploy caused the error spike". Recorded to explain intent; does not affect the result.');return}for(let r of e.commands)DN(r)}var S4=new Set(["completion","self-update","install","setup","feedback"]);for(let e of _e.commands)!b4.has(e)&&!S4.has(e.name())&&DN(e);_e.hook("preAction",(e,r)=>{let{rationale:n}=r.opts();vN=n});_e.parseAsync().then(()=>LN("1.17.0")).catch(e=>{console.error(wN(e)),process.exitCode=1});
|
|
175
175
|
/**
|
|
176
176
|
* The following is a list of HTTP status codes and their meanings.
|
|
177
177
|
*
|