@tsuga/cli 1.30.0 → 1.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +63 -63
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,60 +1,60 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var o0=Object.create;var Jl=Object.defineProperty;var i0=Object.getOwnPropertyDescriptor;var a0=Object.getOwnPropertyNames;var s0=Object.getPrototypeOf,c0=Object.prototype.hasOwnProperty;var p0=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Zt=(e,t)=>{for(var n in t)Jl(e,n,{get:t[n],enumerable:!0})},u0=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of a0(t))!c0.call(e,i)&&i!==n&&Jl(e,i,{get:()=>t[i],enumerable:!(o=i0(t,i))||o.enumerable});return e};var pn=(e,t,n)=>(n=e!=null?o0(s0(e)):{},u0(t||!e||!e.__esModule?Jl(n,"default",{value:e,enumerable:!0}):n,e));var AA=p0((OA,ru)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},o=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",l={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${t}\\.${t}\\.${t}\\.${t}(${a})?$`,"i")};function m(g,T){if(g.indexOf("::")!==g.lastIndexOf("::"))return null;let O=0,b=-1,x=(g.match(l.zoneIndex)||[])[0],P,me;for(x&&(x=x.substring(1),g=g.replace(/%.+$/,""));(b=g.indexOf(":",b+1))>=0;)O++;if(g.substr(0,2)==="::"&&O--,g.substr(-2,2)==="::"&&O--,O>=T)return null;for(me=T-O,P=":";me--;)P+="0:";return g=g.replace("::",P),g[0]===":"&&(g=g.slice(1)),g[g.length-1]===":"&&(g=g.slice(0,-1)),T=(function(){let cn=g.split(":"),Br=[];for(let Hr=0;Hr<cn.length;Hr++)Br.push(cn[Hr].length>4?NaN:parseInt(cn[Hr],16));return Br})(),{parts:T,zoneId:x}}function f(g,T,O,b){if(g.length!==T.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let x=0,P;for(;b>0;){if(P=O-b,P<0&&(P=0),g[x]>>P!==T[x]>>P)return!1;b-=O,x+=1}return!0}function h(g){if(i.test(g))return parseInt(g,16);if(g[0]==="0"&&!isNaN(parseInt(g[1],10))){if(o.test(g))return parseInt(g,8);throw new Error(`ipaddr: cannot parse ${g} as octal`)}return parseInt(g,10)}function E(g,T){for(;g.length<T;)g=`0${g}`;return g}let I={};I.IPv4=(function(){function g(T){if(T.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let O,b;for(O=0;O<T.length;O++)if(b=T[O],!(0<=b&&b<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=T}return g.prototype.SpecialRanges={unspecified:[[new g([0,0,0,0]),8]],broadcast:[[new g([255,255,255,255]),32]],multicast:[[new g([224,0,0,0]),4]],linkLocal:[[new g([169,254,0,0]),16]],loopback:[[new g([127,0,0,0]),8]],carrierGradeNat:[[new g([100,64,0,0]),10]],private:[[new g([10,0,0,0]),8],[new g([172,16,0,0]),12],[new g([192,168,0,0]),16]],reserved:[[new g([192,0,0,0]),24],[new g([192,0,2,0]),24],[new g([192,88,99,0]),24],[new g([198,18,0,0]),15],[new g([198,51,100,0]),24],[new g([203,0,113,0]),24],[new g([240,0,0,0]),4]],as112:[[new g([192,175,48,0]),24],[new g([192,31,196,0]),24]],amt:[[new g([192,52,193,0]),24]]},g.prototype.kind=function(){return"ipv4"},g.prototype.match=function(T,O){let b;if(O===void 0&&(b=T,T=b[0],O=b[1]),T.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,T.octets,8,O)},g.prototype.prefixLengthFromSubnetMask=function(){let T=0,O=!1,b={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},x,P,me;for(x=3;x>=0;x-=1)if(P=this.octets[x],P in b){if(me=b[P],O&&me!==0)return null;me!==8&&(O=!0),T+=me}else return null;return 32-T},g.prototype.range=function(){return I.subnetMatch(this,this.SpecialRanges)},g.prototype.toByteArray=function(){return this.octets.slice(0)},g.prototype.toIPv4MappedAddress=function(){return I.IPv6.parse(`::ffff:${this.toString()}`)},g.prototype.toNormalizedString=function(){return this.toString()},g.prototype.toString=function(){return this.octets.join(".")},g})(),I.IPv4.broadcastAddressFromCIDR=function(g){try{let T=this.parseCIDR(g),O=T[0].toByteArray(),b=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],P=0;for(;P<4;)x.push(parseInt(O[P],10)|parseInt(b[P],10)^255),P++;return new this(x)}catch(T){throw new Error("ipaddr: the address does not have IPv4 CIDR format",{cause:T})}},I.IPv4.isIPv4=function(g){return this.parser(g)!==null},I.IPv4.isValid=function(g){try{return new this(this.parser(g)),!0}catch{return!1}},I.IPv4.isValidCIDR=function(g){try{return this.parseCIDR(g),!0}catch{return!1}},I.IPv4.isValidFourPartDecimal=function(g){return!!(I.IPv4.isValid(g)&&g.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},I.IPv4.isValidCIDRFourPartDecimal=function(g){let T=g.match(/^(.+)\/(\d+)$/);return!I.IPv4.isValidCIDR(g)||!T?!1:I.IPv4.isValidFourPartDecimal(T[1])},I.IPv4.networkAddressFromCIDR=function(g){let T,O,b,x,P;try{for(T=this.parseCIDR(g),b=T[0].toByteArray(),P=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],O=0;O<4;)x.push(parseInt(b[O],10)&parseInt(P[O],10)),O++;return new this(x)}catch(me){throw new Error("ipaddr: the address does not have IPv4 CIDR format",{cause:me})}},I.IPv4.parse=function(g){let T=this.parser(g);if(T===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(T)},I.IPv4.parseCIDR=function(g){let T;if(T=g.match(/^(.+)\/(\d+)$/)){let O=parseInt(T[2]);if(O>=0&&O<=32){let b=[this.parse(T[1]),O];return Object.defineProperty(b,"toString",{value:function(){return this.join("/")}}),b}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},I.IPv4.parser=function(g){let T,O,b;if(T=g.match(n.fourOctet))return(function(){let x=T.slice(1,6),P=[];for(let me=0;me<x.length;me++)O=x[me],P.push(h(O));return P})();if(T=g.match(n.longValue)){if(b=h(T[1]),b>4294967295||b<0)throw new Error("ipaddr: address outside defined range");return(function(){let x=[],P;for(P=0;P<=24;P+=8)x.push(b>>P&255);return x})().reverse()}else return(T=g.match(n.twoOctet))?(function(){let x=T.slice(1,4),P=[];if(b=h(x[1]),b>16777215||b<0)throw new Error("ipaddr: address outside defined range");return P.push(h(x[0])),P.push(b>>16&255),P.push(b>>8&255),P.push(b&255),P})():(T=g.match(n.threeOctet))?(function(){let x=T.slice(1,5),P=[];if(b=h(x[2]),b>65535||b<0)throw new Error("ipaddr: address outside defined range");return P.push(h(x[0])),P.push(h(x[1])),P.push(b>>8&255),P.push(b&255),P})():null},I.IPv4.subnetMaskFromPrefixLength=function(g){if(g=parseInt(g),Number.isNaN(g)||g<0||g>32)throw new Error("ipaddr: invalid IPv4 prefix length");let T=[0,0,0,0],O=0,b=Math.floor(g/8);for(;O<b;)T[O]=255,O++;return b<4&&(T[b]=Math.pow(2,g%8)-1<<8-g%8),new this(T)},I.IPv6=(function(){function g(T,O){let b,x;if(T.length===16)for(this.parts=[],b=0;b<=14;b+=2)this.parts.push(T[b]<<8|T[b+1]);else if(T.length===8)this.parts=T;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(b=0;b<this.parts.length;b++)if(x=this.parts[b],!(0<=x&&x<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");O&&(this.zoneId=O)}return g.prototype.SpecialRanges={unspecified:[new g([0,0,0,0,0,0,0,0]),128],linkLocal:[new g([65152,0,0,0,0,0,0,0]),10],multicast:[new g([65280,0,0,0,0,0,0,0]),8],loopback:[new g([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new g([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new g([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new g([65216,0,0,0,0,0,0,0]),10],discard:[new g([256,0,0,0,0,0,0,0]),64],rfc6145:[new g([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new g([100,65435,0,0,0,0,0,0]),96],[new g([100,65435,1,0,0,0,0,0]),48]],"6to4":[new g([8194,0,0,0,0,0,0,0]),16],teredo:[new g([8193,0,0,0,0,0,0,0]),32],benchmarking:[new g([8193,2,0,0,0,0,0,0]),48],amt:[new g([8193,3,0,0,0,0,0,0]),32],as112v6:[[new g([8193,4,274,0,0,0,0,0]),48],[new g([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new g([8193,16,0,0,0,0,0,0]),28],orchid2:[new g([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new g([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new g([24320,0,0,0,0,0,0,0]),16],reserved:[[new g([8193,0,0,0,0,0,0,0]),23],[new g([8193,3512,0,0,0,0,0,0]),32],[new g([16383,0,0,0,0,0,0,0]),20]]},g.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},g.prototype.kind=function(){return"ipv6"},g.prototype.match=function(T,O){let b;if(O===void 0&&(b=T,T=b[0],O=b[1]),T.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,T.parts,16,O)},g.prototype.prefixLengthFromSubnetMask=function(){let T=0,O=!1,b={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},x,P;for(let me=7;me>=0;me-=1)if(x=this.parts[me],x in b){if(P=b[x],O&&P!==0)return null;P!==16&&(O=!0),T+=P}else return null;return 128-T},g.prototype.range=function(){return I.subnetMatch(this,this.SpecialRanges)},g.prototype.toByteArray=function(){let T,O=[],b=this.parts;for(let x=0;x<b.length;x++)T=b[x],O.push(T>>8),O.push(T&255);return O},g.prototype.toFixedLengthString=function(){let T=(function(){let b=[];for(let x=0;x<this.parts.length;x++)b.push(E(this.parts[x].toString(16),4));return b}).call(this).join(":"),O="";return this.zoneId&&(O=`%${this.zoneId}`),T+O},g.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let T=this.parts.slice(-2),O=T[0],b=T[1];return new I.IPv4([O>>8,O&255,b>>8,b&255])},g.prototype.toNormalizedString=function(){let T=(function(){let b=[];for(let x=0;x<this.parts.length;x++)b.push(this.parts[x].toString(16));return b}).call(this).join(":"),O="";return this.zoneId&&(O=`%${this.zoneId}`),T+O},g.prototype.toRFC5952String=function(){let T=/((^|:)(0(:|$)){2,})/g,O="";this.zoneId&&(O=`%${this.zoneId}`);let b=this.toNormalizedString(),x=b.slice(0,b.length-O.length),P=0,me=-1,cn=-1,Br;for(;Br=T.exec(x);){let Hr=(Br[0].match(/0/g)||[]).length;Hr>cn&&(cn=Hr,P=Br.index,me=Br[0].length)}return me<0?x+O:`${x.substring(0,P)}::${x.substring(P+me)}${O}`},g.prototype.toString=function(){return this.toRFC5952String()},g})(),I.IPv6.broadcastAddressFromCIDR=function(g){try{let T=this.parseCIDR(g),O=T[0].toByteArray(),b=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],P=0;for(;P<16;)x.push(parseInt(O[P],10)|parseInt(b[P],10)^255),P++;return new this(x)}catch(T){throw new Error("ipaddr: the address does not have IPv6 CIDR format",{cause:T})}},I.IPv6.isIPv6=function(g){return this.parser(g)!==null},I.IPv6.isValid=function(g){if(typeof g=="string"&&g.indexOf(":")===-1)return!1;try{let T=this.parser(g);return new this(T.parts,T.zoneId),!0}catch{return!1}},I.IPv6.isValidCIDR=function(g){if(typeof g=="string"&&g.indexOf(":")===-1)return!1;try{return this.parseCIDR(g),!0}catch{return!1}},I.IPv6.networkAddressFromCIDR=function(g){let T,O,b,x,P;try{for(T=this.parseCIDR(g),b=T[0].toByteArray(),P=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],O=0;O<16;)x.push(parseInt(b[O],10)&parseInt(P[O],10)),O++;return new this(x)}catch(me){throw new Error("ipaddr: the address does not have IPv6 CIDR format",{cause:me})}},I.IPv6.parse=function(g){let T=this.parser(g);if(T===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(T.parts,T.zoneId)},I.IPv6.parseCIDR=function(g){let T,O,b;if((O=g.match(/^(.+)\/(\d+)$/))&&(T=parseInt(O[2]),T>=0&&T<=128))return b=[this.parse(O[1]),T],Object.defineProperty(b,"toString",{value:function(){return this.join("/")}}),b;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},I.IPv6.parser=function(g){let T,O,b,x,P,me;if(b=g.match(l.deprecatedTransitional))return this.parser(`::ffff:${b[1]}`);if(l.native.test(g))return m(g,8);if((b=g.match(l.transitional))&&(me=b[6]||"",T=b[1],b[1].endsWith("::")||(T=T.slice(0,-1)),T=m(T+me,6),T&&T.parts)){for(P=[parseInt(b[2]),parseInt(b[3]),parseInt(b[4]),parseInt(b[5])],O=0;O<P.length;O++)if(x=P[O],!(0<=x&&x<=255))return null;return T.parts.push(P[0]<<8|P[1]),T.parts.push(P[2]<<8|P[3]),{parts:T.parts,zoneId:T.zoneId}}return null},I.IPv6.subnetMaskFromPrefixLength=function(g){if(g=parseInt(g),Number.isNaN(g)||g<0||g>128)throw new Error("ipaddr: invalid IPv6 prefix length");let T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O=0,b=Math.floor(g/8);for(;O<b;)T[O]=255,O++;return b<16&&(T[b]=Math.pow(2,g%8)-1<<8-g%8),new this(T)},I.fromByteArray=function(g){let T=g.length;if(T===4)return new I.IPv4(g);if(T===16)return new I.IPv6(g);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},I.isValid=function(g){return I.IPv6.isValid(g)||I.IPv4.isValid(g)},I.isValidCIDR=function(g){return I.IPv6.isValidCIDR(g)||I.IPv4.isValidCIDR(g)},I.parse=function(g){if(I.IPv6.isValid(g))return I.IPv6.parse(g);if(I.IPv4.isValid(g))return I.IPv4.parse(g);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},I.parseCIDR=function(g){try{return I.IPv6.parseCIDR(g)}catch{try{return I.IPv4.parseCIDR(g)}catch(T){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format",{cause:T})}}},I.process=function(g){let T=this.parse(g);return T.kind()==="ipv6"&&T.isIPv4MappedAddress()?T.toIPv4Address():T},I.subnetMatch=function(g,T,O){let b,x,P,me;O==null&&(O="unicast");for(x in T)if(Object.prototype.hasOwnProperty.call(T,x)){for(P=T[x],P[0]&&!(P[0]instanceof Array)&&(P=[P]),b=0;b<P.length;b++)if(me=P[b],g.kind()===me[0].kind()&&g.match.apply(g,me))return x}return O},typeof ru<"u"&&ru.exports?ru.exports=I:e.ipaddr=I})(OA)});var un=class extends Error{constructor(t,n,o){super(o),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=n,this.exitCode=t,this.nestedError=void 0}},Yn=class extends un{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var Ea=class{constructor(t,n){switch(this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,n){return n===this.defaultValue||!Array.isArray(n)?[t]:(n.push(t),n)}default(t,n){return this.defaultValue=t,this.defaultValueDescription=n,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(n,o)=>{if(!this.argChoices.includes(n))throw new Yn(`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 Dc(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}var dy=require("node:events"),$c=pn(require("node:child_process"),1),Tr=pn(require("node:path"),1),Ia=pn(require("node:fs"),1),de=pn(require("node:process"),1),fy=require("node:util");var py=require("node:util"),_a=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let n=t.commands.filter(i=>!i._hidden),o=t._getHelpCommand();return o&&!o._hidden&&n.push(o),this.sortSubcommands&&n.sort((i,a)=>i.name().localeCompare(a.name())),n}compareOptions(t,n){let o=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return o(t).localeCompare(o(n))}visibleOptions(t){let n=t.options.filter(i=>!i.hidden),o=t._getHelpOption();if(o&&!o.hidden){let i=o.short&&t._findOption(o.short),a=o.long&&t._findOption(o.long);!i&&!a?n.push(o):o.long&&!a?n.push(t.createOption(o.long,o.description)):o.short&&!i&&n.push(t.createOption(o.short,o.description))}return this.sortOptions&&n.sort(this.compareOptions),n}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let n=[];for(let o=t.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(t){return t._argsDescription&&t.registeredArguments.forEach(n=>{n.description=n.description||t._argsDescription[n.name()]||""}),t.registeredArguments.find(n=>n.description)?t.registeredArguments:[]}subcommandTerm(t){let n=t.registeredArguments.map(o=>Dc(o)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,n){return n.visibleCommands(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleSubcommandTerm(n.subcommandTerm(i)))),0)}longestOptionTermLength(t,n){return n.visibleOptions(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestGlobalOptionTermLength(t,n){return n.visibleGlobalOptions(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestArgumentTermLength(t,n){return n.visibleArguments(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleArgumentTerm(n.argumentTerm(i)))),0)}commandUsage(t){let n=t._name;t._aliases[0]&&(n=n+"|"+t._aliases[0]);let o="";for(let i=t.parent;i;i=i.parent)o=i.name()+" "+o;return o+n+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let n=[];if(t.argChoices&&n.push(`choices: ${t.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&n.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&n.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&n.push(`env: ${t.envVar}`),n.length>0){let o=`(${n.join(", ")})`;return t.description?`${t.description} ${o}`:o}return t.description}argumentDescription(t){let n=[];if(t.argChoices&&n.push(`choices: ${t.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),t.defaultValue!==void 0&&n.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),n.length>0){let o=`(${n.join(", ")})`;return t.description?`${t.description} ${o}`:o}return t.description}formatItemList(t,n,o){return n.length===0?[]:[o.styleTitle(t),...n,""]}groupItems(t,n,o){let i=new Map;return t.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(t,n){let o=n.padWidth(t,n),i=n.helpWidth??80;function a(E,I){return n.formatItem(E,o,I,n)}let c=[`${n.styleTitle("Usage:")} ${n.styleUsage(n.commandUsage(t))}`,""],l=n.commandDescription(t);l.length>0&&(c=c.concat([n.boxWrap(n.styleCommandDescription(l),i),""]));let m=n.visibleArguments(t).map(E=>a(n.styleArgumentTerm(n.argumentTerm(E)),n.styleArgumentDescription(n.argumentDescription(E))));if(c=c.concat(this.formatItemList("Arguments:",m,n)),this.groupItems(t.options,n.visibleOptions(t),E=>E.helpGroupHeading??"Options:").forEach((E,I)=>{let g=E.map(T=>a(n.styleOptionTerm(n.optionTerm(T)),n.styleOptionDescription(n.optionDescription(T))));c=c.concat(this.formatItemList(I,g,n))}),n.showGlobalOptions){let E=n.visibleGlobalOptions(t).map(I=>a(n.styleOptionTerm(n.optionTerm(I)),n.styleOptionDescription(n.optionDescription(I))));c=c.concat(this.formatItemList("Global Options:",E,n))}return this.groupItems(t.commands,n.visibleCommands(t),E=>E.helpGroup()||"Commands:").forEach((E,I)=>{let g=E.map(T=>a(n.styleSubcommandTerm(n.subcommandTerm(T)),n.styleSubcommandDescription(n.subcommandDescription(T))));c=c.concat(this.formatItemList(I,g,n))}),c.join(`
3
- `)}displayWidth(t){return(0,py.stripVTControlCharacters)(t).length}styleTitle(t){return t}styleUsage(t){return t.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(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleSubcommandText(n)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,n){return Math.max(n.longestOptionTermLength(t,n),n.longestGlobalOptionTermLength(t,n),n.longestSubcommandTermLength(t,n),n.longestArgumentTermLength(t,n))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,n,o,i){let c=" ".repeat(2);if(!o)return c+t;let l=t.padEnd(n+t.length-i.displayWidth(t)),m=2,h=(this.helpWidth??80)-n-m-2,E;return h<this.minWidthToWrap||i.preformatted(o)?E=o:E=i.boxWrap(o,h).replace(/\n/g,`
2
+ "use strict";var c0=Object.create;var tm=Object.defineProperty;var p0=Object.getOwnPropertyDescriptor;var u0=Object.getOwnPropertyNames;var l0=Object.getPrototypeOf,m0=Object.prototype.hasOwnProperty;var d0=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Zt=(e,t)=>{for(var n in t)tm(e,n,{get:t[n],enumerable:!0})},f0=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of u0(t))!m0.call(e,i)&&i!==n&&tm(e,i,{get:()=>t[i],enumerable:!(o=p0(t,i))||o.enumerable});return e};var pn=(e,t,n)=>(n=e!=null?c0(l0(e)):{},f0(t||!e||!e.__esModule?tm(n,"default",{value:e,enumerable:!0}):n,e));var RA=d0((xA,nu)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},o=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",l={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${t}\\.${t}\\.${t}\\.${t}(${a})?$`,"i")};function m(g,T){if(g.indexOf("::")!==g.lastIndexOf("::"))return null;let O=0,b=-1,x=(g.match(l.zoneIndex)||[])[0],P,me;for(x&&(x=x.substring(1),g=g.replace(/%.+$/,""));(b=g.indexOf(":",b+1))>=0;)O++;if(g.substr(0,2)==="::"&&O--,g.substr(-2,2)==="::"&&O--,O>=T)return null;for(me=T-O,P=":";me--;)P+="0:";return g=g.replace("::",P),g[0]===":"&&(g=g.slice(1)),g[g.length-1]===":"&&(g=g.slice(0,-1)),T=(function(){let cn=g.split(":"),Br=[];for(let Hr=0;Hr<cn.length;Hr++)Br.push(cn[Hr].length>4?NaN:parseInt(cn[Hr],16));return Br})(),{parts:T,zoneId:x}}function f(g,T,O,b){if(g.length!==T.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let x=0,P;for(;b>0;){if(P=O-b,P<0&&(P=0),g[x]>>P!==T[x]>>P)return!1;b-=O,x+=1}return!0}function h(g){if(i.test(g))return parseInt(g,16);if(g[0]==="0"&&!isNaN(parseInt(g[1],10))){if(o.test(g))return parseInt(g,8);throw new Error(`ipaddr: cannot parse ${g} as octal`)}return parseInt(g,10)}function E(g,T){for(;g.length<T;)g=`0${g}`;return g}let I={};I.IPv4=(function(){function g(T){if(T.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let O,b;for(O=0;O<T.length;O++)if(b=T[O],!(0<=b&&b<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=T}return g.prototype.SpecialRanges={unspecified:[[new g([0,0,0,0]),8]],broadcast:[[new g([255,255,255,255]),32]],multicast:[[new g([224,0,0,0]),4]],linkLocal:[[new g([169,254,0,0]),16]],loopback:[[new g([127,0,0,0]),8]],carrierGradeNat:[[new g([100,64,0,0]),10]],private:[[new g([10,0,0,0]),8],[new g([172,16,0,0]),12],[new g([192,168,0,0]),16]],reserved:[[new g([192,0,0,0]),24],[new g([192,0,2,0]),24],[new g([192,88,99,0]),24],[new g([198,18,0,0]),15],[new g([198,51,100,0]),24],[new g([203,0,113,0]),24],[new g([240,0,0,0]),4]],as112:[[new g([192,175,48,0]),24],[new g([192,31,196,0]),24]],amt:[[new g([192,52,193,0]),24]]},g.prototype.kind=function(){return"ipv4"},g.prototype.match=function(T,O){let b;if(O===void 0&&(b=T,T=b[0],O=b[1]),T.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,T.octets,8,O)},g.prototype.prefixLengthFromSubnetMask=function(){let T=0,O=!1,b={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},x,P,me;for(x=3;x>=0;x-=1)if(P=this.octets[x],P in b){if(me=b[P],O&&me!==0)return null;me!==8&&(O=!0),T+=me}else return null;return 32-T},g.prototype.range=function(){return I.subnetMatch(this,this.SpecialRanges)},g.prototype.toByteArray=function(){return this.octets.slice(0)},g.prototype.toIPv4MappedAddress=function(){return I.IPv6.parse(`::ffff:${this.toString()}`)},g.prototype.toNormalizedString=function(){return this.toString()},g.prototype.toString=function(){return this.octets.join(".")},g})(),I.IPv4.broadcastAddressFromCIDR=function(g){try{let T=this.parseCIDR(g),O=T[0].toByteArray(),b=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],P=0;for(;P<4;)x.push(parseInt(O[P],10)|parseInt(b[P],10)^255),P++;return new this(x)}catch(T){throw new Error("ipaddr: the address does not have IPv4 CIDR format",{cause:T})}},I.IPv4.isIPv4=function(g){return this.parser(g)!==null},I.IPv4.isValid=function(g){try{return new this(this.parser(g)),!0}catch{return!1}},I.IPv4.isValidCIDR=function(g){try{return this.parseCIDR(g),!0}catch{return!1}},I.IPv4.isValidFourPartDecimal=function(g){return!!(I.IPv4.isValid(g)&&g.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},I.IPv4.isValidCIDRFourPartDecimal=function(g){let T=g.match(/^(.+)\/(\d+)$/);return!I.IPv4.isValidCIDR(g)||!T?!1:I.IPv4.isValidFourPartDecimal(T[1])},I.IPv4.networkAddressFromCIDR=function(g){let T,O,b,x,P;try{for(T=this.parseCIDR(g),b=T[0].toByteArray(),P=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],O=0;O<4;)x.push(parseInt(b[O],10)&parseInt(P[O],10)),O++;return new this(x)}catch(me){throw new Error("ipaddr: the address does not have IPv4 CIDR format",{cause:me})}},I.IPv4.parse=function(g){let T=this.parser(g);if(T===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(T)},I.IPv4.parseCIDR=function(g){let T;if(T=g.match(/^(.+)\/(\d+)$/)){let O=parseInt(T[2]);if(O>=0&&O<=32){let b=[this.parse(T[1]),O];return Object.defineProperty(b,"toString",{value:function(){return this.join("/")}}),b}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},I.IPv4.parser=function(g){let T,O,b;if(T=g.match(n.fourOctet))return(function(){let x=T.slice(1,6),P=[];for(let me=0;me<x.length;me++)O=x[me],P.push(h(O));return P})();if(T=g.match(n.longValue)){if(b=h(T[1]),b>4294967295||b<0)throw new Error("ipaddr: address outside defined range");return(function(){let x=[],P;for(P=0;P<=24;P+=8)x.push(b>>P&255);return x})().reverse()}else return(T=g.match(n.twoOctet))?(function(){let x=T.slice(1,4),P=[];if(b=h(x[1]),b>16777215||b<0)throw new Error("ipaddr: address outside defined range");return P.push(h(x[0])),P.push(b>>16&255),P.push(b>>8&255),P.push(b&255),P})():(T=g.match(n.threeOctet))?(function(){let x=T.slice(1,5),P=[];if(b=h(x[2]),b>65535||b<0)throw new Error("ipaddr: address outside defined range");return P.push(h(x[0])),P.push(h(x[1])),P.push(b>>8&255),P.push(b&255),P})():null},I.IPv4.subnetMaskFromPrefixLength=function(g){if(g=parseInt(g),Number.isNaN(g)||g<0||g>32)throw new Error("ipaddr: invalid IPv4 prefix length");let T=[0,0,0,0],O=0,b=Math.floor(g/8);for(;O<b;)T[O]=255,O++;return b<4&&(T[b]=Math.pow(2,g%8)-1<<8-g%8),new this(T)},I.IPv6=(function(){function g(T,O){let b,x;if(T.length===16)for(this.parts=[],b=0;b<=14;b+=2)this.parts.push(T[b]<<8|T[b+1]);else if(T.length===8)this.parts=T;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(b=0;b<this.parts.length;b++)if(x=this.parts[b],!(0<=x&&x<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");O&&(this.zoneId=O)}return g.prototype.SpecialRanges={unspecified:[new g([0,0,0,0,0,0,0,0]),128],linkLocal:[new g([65152,0,0,0,0,0,0,0]),10],multicast:[new g([65280,0,0,0,0,0,0,0]),8],loopback:[new g([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new g([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new g([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new g([65216,0,0,0,0,0,0,0]),10],discard:[new g([256,0,0,0,0,0,0,0]),64],rfc6145:[new g([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new g([100,65435,0,0,0,0,0,0]),96],[new g([100,65435,1,0,0,0,0,0]),48]],"6to4":[new g([8194,0,0,0,0,0,0,0]),16],teredo:[new g([8193,0,0,0,0,0,0,0]),32],benchmarking:[new g([8193,2,0,0,0,0,0,0]),48],amt:[new g([8193,3,0,0,0,0,0,0]),32],as112v6:[[new g([8193,4,274,0,0,0,0,0]),48],[new g([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new g([8193,16,0,0,0,0,0,0]),28],orchid2:[new g([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new g([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new g([24320,0,0,0,0,0,0,0]),16],reserved:[[new g([8193,0,0,0,0,0,0,0]),23],[new g([8193,3512,0,0,0,0,0,0]),32],[new g([16383,0,0,0,0,0,0,0]),20]]},g.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},g.prototype.kind=function(){return"ipv6"},g.prototype.match=function(T,O){let b;if(O===void 0&&(b=T,T=b[0],O=b[1]),T.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,T.parts,16,O)},g.prototype.prefixLengthFromSubnetMask=function(){let T=0,O=!1,b={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},x,P;for(let me=7;me>=0;me-=1)if(x=this.parts[me],x in b){if(P=b[x],O&&P!==0)return null;P!==16&&(O=!0),T+=P}else return null;return 128-T},g.prototype.range=function(){return I.subnetMatch(this,this.SpecialRanges)},g.prototype.toByteArray=function(){let T,O=[],b=this.parts;for(let x=0;x<b.length;x++)T=b[x],O.push(T>>8),O.push(T&255);return O},g.prototype.toFixedLengthString=function(){let T=(function(){let b=[];for(let x=0;x<this.parts.length;x++)b.push(E(this.parts[x].toString(16),4));return b}).call(this).join(":"),O="";return this.zoneId&&(O=`%${this.zoneId}`),T+O},g.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let T=this.parts.slice(-2),O=T[0],b=T[1];return new I.IPv4([O>>8,O&255,b>>8,b&255])},g.prototype.toNormalizedString=function(){let T=(function(){let b=[];for(let x=0;x<this.parts.length;x++)b.push(this.parts[x].toString(16));return b}).call(this).join(":"),O="";return this.zoneId&&(O=`%${this.zoneId}`),T+O},g.prototype.toRFC5952String=function(){let T=/((^|:)(0(:|$)){2,})/g,O="";this.zoneId&&(O=`%${this.zoneId}`);let b=this.toNormalizedString(),x=b.slice(0,b.length-O.length),P=0,me=-1,cn=-1,Br;for(;Br=T.exec(x);){let Hr=(Br[0].match(/0/g)||[]).length;Hr>cn&&(cn=Hr,P=Br.index,me=Br[0].length)}return me<0?x+O:`${x.substring(0,P)}::${x.substring(P+me)}${O}`},g.prototype.toString=function(){return this.toRFC5952String()},g})(),I.IPv6.broadcastAddressFromCIDR=function(g){try{let T=this.parseCIDR(g),O=T[0].toByteArray(),b=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],P=0;for(;P<16;)x.push(parseInt(O[P],10)|parseInt(b[P],10)^255),P++;return new this(x)}catch(T){throw new Error("ipaddr: the address does not have IPv6 CIDR format",{cause:T})}},I.IPv6.isIPv6=function(g){return this.parser(g)!==null},I.IPv6.isValid=function(g){if(typeof g=="string"&&g.indexOf(":")===-1)return!1;try{let T=this.parser(g);return new this(T.parts,T.zoneId),!0}catch{return!1}},I.IPv6.isValidCIDR=function(g){if(typeof g=="string"&&g.indexOf(":")===-1)return!1;try{return this.parseCIDR(g),!0}catch{return!1}},I.IPv6.networkAddressFromCIDR=function(g){let T,O,b,x,P;try{for(T=this.parseCIDR(g),b=T[0].toByteArray(),P=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],O=0;O<16;)x.push(parseInt(b[O],10)&parseInt(P[O],10)),O++;return new this(x)}catch(me){throw new Error("ipaddr: the address does not have IPv6 CIDR format",{cause:me})}},I.IPv6.parse=function(g){let T=this.parser(g);if(T===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(T.parts,T.zoneId)},I.IPv6.parseCIDR=function(g){let T,O,b;if((O=g.match(/^(.+)\/(\d+)$/))&&(T=parseInt(O[2]),T>=0&&T<=128))return b=[this.parse(O[1]),T],Object.defineProperty(b,"toString",{value:function(){return this.join("/")}}),b;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},I.IPv6.parser=function(g){let T,O,b,x,P,me;if(b=g.match(l.deprecatedTransitional))return this.parser(`::ffff:${b[1]}`);if(l.native.test(g))return m(g,8);if((b=g.match(l.transitional))&&(me=b[6]||"",T=b[1],b[1].endsWith("::")||(T=T.slice(0,-1)),T=m(T+me,6),T&&T.parts)){for(P=[parseInt(b[2]),parseInt(b[3]),parseInt(b[4]),parseInt(b[5])],O=0;O<P.length;O++)if(x=P[O],!(0<=x&&x<=255))return null;return T.parts.push(P[0]<<8|P[1]),T.parts.push(P[2]<<8|P[3]),{parts:T.parts,zoneId:T.zoneId}}return null},I.IPv6.subnetMaskFromPrefixLength=function(g){if(g=parseInt(g),Number.isNaN(g)||g<0||g>128)throw new Error("ipaddr: invalid IPv6 prefix length");let T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O=0,b=Math.floor(g/8);for(;O<b;)T[O]=255,O++;return b<16&&(T[b]=Math.pow(2,g%8)-1<<8-g%8),new this(T)},I.fromByteArray=function(g){let T=g.length;if(T===4)return new I.IPv4(g);if(T===16)return new I.IPv6(g);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},I.isValid=function(g){return I.IPv6.isValid(g)||I.IPv4.isValid(g)},I.isValidCIDR=function(g){return I.IPv6.isValidCIDR(g)||I.IPv4.isValidCIDR(g)},I.parse=function(g){if(I.IPv6.isValid(g))return I.IPv6.parse(g);if(I.IPv4.isValid(g))return I.IPv4.parse(g);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},I.parseCIDR=function(g){try{return I.IPv6.parseCIDR(g)}catch{try{return I.IPv4.parseCIDR(g)}catch(T){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format",{cause:T})}}},I.process=function(g){let T=this.parse(g);return T.kind()==="ipv6"&&T.isIPv4MappedAddress()?T.toIPv4Address():T},I.subnetMatch=function(g,T,O){let b,x,P,me;O==null&&(O="unicast");for(x in T)if(Object.prototype.hasOwnProperty.call(T,x)){for(P=T[x],P[0]&&!(P[0]instanceof Array)&&(P=[P]),b=0;b<P.length;b++)if(me=P[b],g.kind()===me[0].kind()&&g.match.apply(g,me))return x}return O},typeof nu<"u"&&nu.exports?nu.exports=I:e.ipaddr=I})(xA)});var un=class extends Error{constructor(t,n,o){super(o),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=n,this.exitCode=t,this.nestedError=void 0}},Yn=class extends un{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var Ia=class{constructor(t,n){switch(this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,n){return n===this.defaultValue||!Array.isArray(n)?[t]:(n.push(t),n)}default(t,n){return this.defaultValue=t,this.defaultValueDescription=n,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(n,o)=>{if(!this.argChoices.includes(n))throw new Yn(`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 Gc(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}var gy=require("node:events"),Fc=pn(require("node:child_process"),1),Er=pn(require("node:path"),1),ba=pn(require("node:fs"),1),de=pn(require("node:process"),1),hy=require("node:util");var ly=require("node:util"),Sa=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let n=t.commands.filter(i=>!i._hidden),o=t._getHelpCommand();return o&&!o._hidden&&n.push(o),this.sortSubcommands&&n.sort((i,a)=>i.name().localeCompare(a.name())),n}compareOptions(t,n){let o=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return o(t).localeCompare(o(n))}visibleOptions(t){let n=t.options.filter(i=>!i.hidden),o=t._getHelpOption();if(o&&!o.hidden){let i=o.short&&t._findOption(o.short),a=o.long&&t._findOption(o.long);!i&&!a?n.push(o):o.long&&!a?n.push(t.createOption(o.long,o.description)):o.short&&!i&&n.push(t.createOption(o.short,o.description))}return this.sortOptions&&n.sort(this.compareOptions),n}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let n=[];for(let o=t.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(t){return t._argsDescription&&t.registeredArguments.forEach(n=>{n.description=n.description||t._argsDescription[n.name()]||""}),t.registeredArguments.find(n=>n.description)?t.registeredArguments:[]}subcommandTerm(t){let n=t.registeredArguments.map(o=>Gc(o)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,n){return n.visibleCommands(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleSubcommandTerm(n.subcommandTerm(i)))),0)}longestOptionTermLength(t,n){return n.visibleOptions(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestGlobalOptionTermLength(t,n){return n.visibleGlobalOptions(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestArgumentTermLength(t,n){return n.visibleArguments(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleArgumentTerm(n.argumentTerm(i)))),0)}commandUsage(t){let n=t._name;t._aliases[0]&&(n=n+"|"+t._aliases[0]);let o="";for(let i=t.parent;i;i=i.parent)o=i.name()+" "+o;return o+n+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let n=[];if(t.argChoices&&n.push(`choices: ${t.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&n.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&n.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&n.push(`env: ${t.envVar}`),n.length>0){let o=`(${n.join(", ")})`;return t.description?`${t.description} ${o}`:o}return t.description}argumentDescription(t){let n=[];if(t.argChoices&&n.push(`choices: ${t.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),t.defaultValue!==void 0&&n.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),n.length>0){let o=`(${n.join(", ")})`;return t.description?`${t.description} ${o}`:o}return t.description}formatItemList(t,n,o){return n.length===0?[]:[o.styleTitle(t),...n,""]}groupItems(t,n,o){let i=new Map;return t.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(t,n){let o=n.padWidth(t,n),i=n.helpWidth??80;function a(E,I){return n.formatItem(E,o,I,n)}let c=[`${n.styleTitle("Usage:")} ${n.styleUsage(n.commandUsage(t))}`,""],l=n.commandDescription(t);l.length>0&&(c=c.concat([n.boxWrap(n.styleCommandDescription(l),i),""]));let m=n.visibleArguments(t).map(E=>a(n.styleArgumentTerm(n.argumentTerm(E)),n.styleArgumentDescription(n.argumentDescription(E))));if(c=c.concat(this.formatItemList("Arguments:",m,n)),this.groupItems(t.options,n.visibleOptions(t),E=>E.helpGroupHeading??"Options:").forEach((E,I)=>{let g=E.map(T=>a(n.styleOptionTerm(n.optionTerm(T)),n.styleOptionDescription(n.optionDescription(T))));c=c.concat(this.formatItemList(I,g,n))}),n.showGlobalOptions){let E=n.visibleGlobalOptions(t).map(I=>a(n.styleOptionTerm(n.optionTerm(I)),n.styleOptionDescription(n.optionDescription(I))));c=c.concat(this.formatItemList("Global Options:",E,n))}return this.groupItems(t.commands,n.visibleCommands(t),E=>E.helpGroup()||"Commands:").forEach((E,I)=>{let g=E.map(T=>a(n.styleSubcommandTerm(n.subcommandTerm(T)),n.styleSubcommandDescription(n.subcommandDescription(T))));c=c.concat(this.formatItemList(I,g,n))}),c.join(`
3
+ `)}displayWidth(t){return(0,ly.stripVTControlCharacters)(t).length}styleTitle(t){return t}styleUsage(t){return t.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(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleSubcommandText(n)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,n){return Math.max(n.longestOptionTermLength(t,n),n.longestGlobalOptionTermLength(t,n),n.longestSubcommandTermLength(t,n),n.longestArgumentTermLength(t,n))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,n,o,i){let c=" ".repeat(2);if(!o)return c+t;let l=t.padEnd(n+t.length-i.displayWidth(t)),m=2,h=(this.helpWidth??80)-n-m-2,E;return h<this.minWidthToWrap||i.preformatted(o)?E=o:E=i.boxWrap(o,h).replace(/\n/g,`
4
4
  `+" ".repeat(n+m)),c+l+" ".repeat(m)+E.replace(/\n/g,`
5
5
  ${c}`)}boxWrap(t,n){if(n<this.minWidthToWrap)return t;let o=t.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 m=[l.shift()],f=this.displayWidth(m[0]);l.forEach(h=>{let E=this.displayWidth(h);if(f+E<=n){m.push(h),f+=E;return}a.push(m.join(""));let I=h.trimStart();m=[I],f=this.displayWidth(I)}),a.push(m.join(""))}),a.join(`
6
- `)}};var cr=class{constructor(t,n){this.flags=t,this.description=n||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let o=l0(t);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(t,n){return this.defaultValue=t,this.defaultValueDescription=n,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let n=t;return typeof t=="string"&&(n={[t]:!0}),this.implied=Object.assign(this.implied||{},n),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_collectValue(t,n){return n===this.defaultValue||!Array.isArray(n)?[t]:(n.push(t),n)}choices(t){return this.argChoices=t.slice(),this.parseArg=(n,o)=>{if(!this.argChoices.includes(n))throw new Yn(`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?uy(this.name().replace(/^no-/,"")):uy(this.name())}helpGroup(t){return this.helpGroupHeading=t,this}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Gc=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.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(t,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===t)}};function uy(e){return e.split("-").reduce((t,n)=>t+n[0].toUpperCase()+n.slice(1))}function l0(e){let t,n,o=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat("guard");if(o.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&o.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=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}
6
+ `)}};var pr=class{constructor(t,n){this.flags=t,this.description=n||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let o=g0(t);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(t,n){return this.defaultValue=t,this.defaultValueDescription=n,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let n=t;return typeof t=="string"&&(n={[t]:!0}),this.implied=Object.assign(this.implied||{},n),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_collectValue(t,n){return n===this.defaultValue||!Array.isArray(n)?[t]:(n.push(t),n)}choices(t){return this.argChoices=t.slice(),this.parseArg=(n,o)=>{if(!this.argChoices.includes(n))throw new Yn(`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?my(this.name().replace(/^no-/,"")):my(this.name())}helpGroup(t){return this.helpGroupHeading=t,this}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},$c=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.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(t,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===t)}};function my(e){return e.split("-").reduce((t,n)=>t+n[0].toUpperCase()+n.slice(1))}function g0(e){let t,n,o=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat("guard");if(o.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&o.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=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(t===void 0&&n===void 0)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}function m0(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let o=0;o<=e.length;o++)n[o]=[o];for(let o=0;o<=t.length;o++)n[0][o]=o;for(let o=1;o<=t.length;o++)for(let i=1;i<=e.length;i++){let a;e[i-1]===t[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]===t[o-2]&&e[i-2]===t[o-1]&&(n[i][o]=Math.min(n[i][o],n[i-2][o-2]+1))}return n[e.length][t.length]}function em(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let n=e.startsWith("--");n&&(e=e.slice(2),t=t.map(c=>c.slice(2)));let o=[],i=3,a=.4;return t.forEach(c=>{if(c.length<=1)return;let l=m0(e,c),m=Math.max(e.length,c.length);(m-l)/m>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?`
12
+ - unrecognised flag format`)}if(t===void 0&&n===void 0)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}function h0(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let o=0;o<=e.length;o++)n[o]=[o];for(let o=0;o<=t.length;o++)n[0][o]=o;for(let o=1;o<=t.length;o++)for(let i=1;i<=e.length;i++){let a;e[i-1]===t[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]===t[o-2]&&e[i-2]===t[o-1]&&(n[i][o]=Math.min(n[i][o],n[i-2][o-2]+1))}return n[e.length][t.length]}function rm(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let n=e.startsWith("--");n&&(e=e.slice(2),t=t.map(c=>c.slice(2)));let o=[],i=3,a=.4;return t.forEach(c=>{if(c.length<=1)return;let l=h0(e,c),m=Math.max(e.length,c.length);(m-l)/m>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 dy.EventEmitter{constructor(t){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=t||"",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=>de.default.stdout.write(n),writeErr:n=>de.default.stderr.write(n),outputError:(n,o)=>o(n),getOutHelpWidth:()=>de.default.stdout.isTTY?de.default.stdout.columns:void 0,getErrHelpWidth:()=>de.default.stderr.isTTY?de.default.stderr.columns:void 0,getOutHasColors:()=>my()??(de.default.stdout.isTTY&&de.default.stdout.hasColors?.()),getErrHasColors:()=>my()??(de.default.stderr.isTTY&&de.default.stderr.hasColors?.()),stripColor:n=>(0,fy.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(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let n=this;n;n=n.parent)t.push(n);return t}command(t,n,o){let i=n,a=o;typeof i=="object"&&i!==null&&(a=i,i=null),a=a||{};let[,c,l]=t.match(/([^ ]+) *(.*)/),m=this.createCommand(c);return i&&(m.description(i),m._executableHandler=!0),a.isDefault&&(this._defaultCommandName=m._name),m._hidden=!!(a.noHelp||a.hidden),m._executableFile=a.executableFile||null,l&&m.arguments(l),this._registerCommand(m),m.parent=this,m.copyInheritedSettings(this),i?this:m}createCommand(t){return new e(t)}createHelp(){return Object.assign(new _a,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...t},this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,n){if(!t._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=t._name),(n.noHelp||n.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,n){return new Ea(t,n)}argument(t,n,o,i){let a=this.createArgument(t,n);return typeof o=="function"?a.default(i).argParser(o):a.default(o),this.addArgument(a),this}arguments(t){return t.trim().split(/ +/).forEach(n=>{this.argument(n)}),this}addArgument(t){let n=this.registeredArguments.slice(-1)[0];if(n?.variadic)throw new Error(`only the last argument can be variadic '${n.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,n){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,t&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let o=t??"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,(t||n)&&this._initCommandGroup(l),this}addHelpCommand(t,n){return typeof t!="object"?(this.helpCommand(t,n),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this._initCommandGroup(t),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(t,n){let o=["preSubcommand","preAction","postAction"];if(!o.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
16
- Expecting one of '${o.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(n):this._lifeCycleHooks[t]=[n],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=n=>{if(n.code!=="commander.executeSubCommandAsync")throw n},this}_exit(t,n,o){this._exitCallback&&this._exitCallback(new un(t,n,o)),de.default.exit(t)}action(t){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),t.apply(this,a)};return this._actionHandler=n,this}createOption(t,n){return new cr(t,n)}_callParseArg(t,n,o,i){try{return t.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(t){let n=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(n){let o=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${o}'
17
- - already used by option '${n.flags}'`)}this._initOptionGroup(t),this.options.push(t)}_registerCommand(t){let n=i=>[i.name()].concat(i.aliases()),o=n(t).find(i=>this._findCommand(i));if(o){let i=n(this._findCommand(o)).join("|"),a=n(t).join("|");throw new Error(`cannot add command '${a}' as already have command '${i}'`)}this._initCommandGroup(t),this.commands.push(t)}addOption(t){this._registerOption(t);let n=t.name(),o=t.attributeName();t.defaultValue!==void 0&&this.setOptionValueWithSource(o,t.defaultValue,"default");let i=(a,c,l)=>{a==null&&t.presetArg!==void 0&&(a=t.presetArg);let m=this.getOptionValue(o);a!==null&&t.parseArg?a=this._callParseArg(t,a,m,c):a!==null&&t.variadic&&(a=t._collectValue(a,m)),a==null&&(t.negate?a=!1:t.isBoolean()||t.optional?a=!0:a=""),this.setOptionValueWithSource(o,a,l)};return this.on("option:"+n,a=>{let c=`error: option '${t.flags}' argument '${a}' is invalid.`;i(a,c,"cli")}),t.envVar&&this.on("optionEnv:"+n,a=>{let c=`error: option '${t.flags}' value '${a}' from env '${t.envVar}' is invalid.`;i(a,c,"env")}),this}_optionEx(t,n,o,i,a){if(typeof n=="object"&&n instanceof cr)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let c=this.createOption(n,o);if(c.makeOptionMandatory(!!t.mandatory),typeof i=="function")c.default(a).argParser(i);else if(i instanceof RegExp){let l=i;i=(m,f)=>{let h=l.exec(m);return h?h[0]:f},c.default(a).argParser(i)}else c.default(i);return this.addOption(c)}option(t,n,o,i){return this._optionEx({},t,n,o,i)}requiredOption(t,n,o,i){return this._optionEx({mandatory:!0},t,n,o,i)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,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(t=!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=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,n){return this.setOptionValueWithSource(t,n,void 0)}setOptionValueWithSource(t,n,o){return this._storeOptionsAsProperties?this[t]=n:this._optionValues[t]=n,this._optionValueSources[t]=o,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let n;return this._getCommandAndAncestors().forEach(o=>{o.getOptionValueSource(t)!==void 0&&(n=o.getOptionValueSource(t))}),n}_prepareUserArgs(t,n){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(n=n||{},t===void 0&&n.from===void 0){de.default.versions?.electron&&(n.from="electron");let i=de.default.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(n.from="eval")}t===void 0&&(t=de.default.argv),this.rawArgs=t.slice();let o;switch(n.from){case void 0:case"node":this._scriptPath=t[1],o=t.slice(2);break;case"electron":de.default.defaultApp?(this._scriptPath=t[1],o=t.slice(2)):o=t.slice(1);break;case"user":o=t.slice(0);break;case"eval":o=t.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(t,n){this._prepareForParse();let o=this._prepareUserArgs(t,n);return this._parseCommand([],o),this}async parseAsync(t,n){this._prepareForParse();let o=this._prepareUserArgs(t,n);return await this._parseCommand([],o),this}_prepareForParse(){this._savedState===null?(this.options.filter(t=>t.negate&&t.defaultValue===void 0&&this.getOptionValue(t.attributeName())===void 0).forEach(t=>{let n=t.long.replace(/^--no-/,"--");this._findOption(n)||this.setOptionValueWithSource(t.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(t,n,o){if(Ia.default.existsSync(t))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=`'${t}' does not exist
14
+ (Did you mean ${o[0]}?)`:""}var jo=class e extends gy.EventEmitter{constructor(t){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=t||"",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=>de.default.stdout.write(n),writeErr:n=>de.default.stderr.write(n),outputError:(n,o)=>o(n),getOutHelpWidth:()=>de.default.stdout.isTTY?de.default.stdout.columns:void 0,getErrHelpWidth:()=>de.default.stderr.isTTY?de.default.stderr.columns:void 0,getOutHasColors:()=>fy()??(de.default.stdout.isTTY&&de.default.stdout.hasColors?.()),getErrHasColors:()=>fy()??(de.default.stderr.isTTY&&de.default.stderr.hasColors?.()),stripColor:n=>(0,hy.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(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let n=this;n;n=n.parent)t.push(n);return t}command(t,n,o){let i=n,a=o;typeof i=="object"&&i!==null&&(a=i,i=null),a=a||{};let[,c,l]=t.match(/([^ ]+) *(.*)/),m=this.createCommand(c);return i&&(m.description(i),m._executableHandler=!0),a.isDefault&&(this._defaultCommandName=m._name),m._hidden=!!(a.noHelp||a.hidden),m._executableFile=a.executableFile||null,l&&m.arguments(l),this._registerCommand(m),m.parent=this,m.copyInheritedSettings(this),i?this:m}createCommand(t){return new e(t)}createHelp(){return Object.assign(new Sa,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...t},this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,n){if(!t._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=t._name),(n.noHelp||n.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,n){return new Ia(t,n)}argument(t,n,o,i){let a=this.createArgument(t,n);return typeof o=="function"?a.default(i).argParser(o):a.default(o),this.addArgument(a),this}arguments(t){return t.trim().split(/ +/).forEach(n=>{this.argument(n)}),this}addArgument(t){let n=this.registeredArguments.slice(-1)[0];if(n?.variadic)throw new Error(`only the last argument can be variadic '${n.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,n){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,t&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let o=t??"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,(t||n)&&this._initCommandGroup(l),this}addHelpCommand(t,n){return typeof t!="object"?(this.helpCommand(t,n),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this._initCommandGroup(t),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(t,n){let o=["preSubcommand","preAction","postAction"];if(!o.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
16
+ Expecting one of '${o.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(n):this._lifeCycleHooks[t]=[n],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=n=>{if(n.code!=="commander.executeSubCommandAsync")throw n},this}_exit(t,n,o){this._exitCallback&&this._exitCallback(new un(t,n,o)),de.default.exit(t)}action(t){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),t.apply(this,a)};return this._actionHandler=n,this}createOption(t,n){return new pr(t,n)}_callParseArg(t,n,o,i){try{return t.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(t){let n=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(n){let o=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${o}'
17
+ - already used by option '${n.flags}'`)}this._initOptionGroup(t),this.options.push(t)}_registerCommand(t){let n=i=>[i.name()].concat(i.aliases()),o=n(t).find(i=>this._findCommand(i));if(o){let i=n(this._findCommand(o)).join("|"),a=n(t).join("|");throw new Error(`cannot add command '${a}' as already have command '${i}'`)}this._initCommandGroup(t),this.commands.push(t)}addOption(t){this._registerOption(t);let n=t.name(),o=t.attributeName();t.defaultValue!==void 0&&this.setOptionValueWithSource(o,t.defaultValue,"default");let i=(a,c,l)=>{a==null&&t.presetArg!==void 0&&(a=t.presetArg);let m=this.getOptionValue(o);a!==null&&t.parseArg?a=this._callParseArg(t,a,m,c):a!==null&&t.variadic&&(a=t._collectValue(a,m)),a==null&&(t.negate?a=!1:t.isBoolean()||t.optional?a=!0:a=""),this.setOptionValueWithSource(o,a,l)};return this.on("option:"+n,a=>{let c=`error: option '${t.flags}' argument '${a}' is invalid.`;i(a,c,"cli")}),t.envVar&&this.on("optionEnv:"+n,a=>{let c=`error: option '${t.flags}' value '${a}' from env '${t.envVar}' is invalid.`;i(a,c,"env")}),this}_optionEx(t,n,o,i,a){if(typeof n=="object"&&n instanceof pr)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let c=this.createOption(n,o);if(c.makeOptionMandatory(!!t.mandatory),typeof i=="function")c.default(a).argParser(i);else if(i instanceof RegExp){let l=i;i=(m,f)=>{let h=l.exec(m);return h?h[0]:f},c.default(a).argParser(i)}else c.default(i);return this.addOption(c)}option(t,n,o,i){return this._optionEx({},t,n,o,i)}requiredOption(t,n,o,i){return this._optionEx({mandatory:!0},t,n,o,i)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,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(t=!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=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,n){return this.setOptionValueWithSource(t,n,void 0)}setOptionValueWithSource(t,n,o){return this._storeOptionsAsProperties?this[t]=n:this._optionValues[t]=n,this._optionValueSources[t]=o,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let n;return this._getCommandAndAncestors().forEach(o=>{o.getOptionValueSource(t)!==void 0&&(n=o.getOptionValueSource(t))}),n}_prepareUserArgs(t,n){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(n=n||{},t===void 0&&n.from===void 0){de.default.versions?.electron&&(n.from="electron");let i=de.default.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(n.from="eval")}t===void 0&&(t=de.default.argv),this.rawArgs=t.slice();let o;switch(n.from){case void 0:case"node":this._scriptPath=t[1],o=t.slice(2);break;case"electron":de.default.defaultApp?(this._scriptPath=t[1],o=t.slice(2)):o=t.slice(1);break;case"user":o=t.slice(0);break;case"eval":o=t.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(t,n){this._prepareForParse();let o=this._prepareUserArgs(t,n);return this._parseCommand([],o),this}async parseAsync(t,n){this._prepareForParse();let o=this._prepareUserArgs(t,n);return await this._parseCommand([],o),this}_prepareForParse(){this._savedState===null?(this.options.filter(t=>t.negate&&t.defaultValue===void 0&&this.getOptionValue(t.attributeName())===void 0).forEach(t=>{let n=t.long.replace(/^--no-/,"--");this._findOption(n)||this.setOptionValueWithSource(t.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(t,n,o){if(ba.default.existsSync(t))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=`'${t}' 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(t,n){n=n.slice();let o=[".js",".ts",".tsx",".mjs",".cjs"];function i(h,E){let I=Tr.default.resolve(h,E);if(Ia.default.existsSync(I))return I;if(o.includes(Tr.default.extname(E)))return;let g=o.find(T=>Ia.default.existsSync(`${I}${T}`));if(g)return`${I}${g}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=t._executableFile||`${this._name}-${t._name}`,c=this._executableDir||"";if(this._scriptPath){let h;try{h=Ia.default.realpathSync(this._scriptPath)}catch{h=this._scriptPath}c=Tr.default.resolve(Tr.default.dirname(h),c)}if(c){let h=i(c,a);if(!h&&!t._executableFile&&this._scriptPath){let E=Tr.default.basename(this._scriptPath,Tr.default.extname(this._scriptPath));E!==this._name&&(h=i(c,`${E}-${t._name}`))}a=h||a}let l=o.includes(Tr.default.extname(a)),m;de.default.platform!=="win32"?l?(n.unshift(a),n=ly(de.default.execArgv).concat(n),m=$c.default.spawn(de.default.argv[0],n,{stdio:"inherit"})):m=$c.default.spawn(a,n,{stdio:"inherit"}):(this._checkForMissingExecutable(a,c,t._name),n.unshift(a),n=ly(de.default.execArgv).concat(n),m=$c.default.spawn(de.default.execPath,n,{stdio:"inherit"})),m.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(E=>{de.default.on(E,()=>{m.killed===!1&&m.exitCode===null&&m.kill(E)})});let f=this._exitCallback;m.on("close",h=>{h=h??1,f?f(new un(h,"commander.executeSubCommandAsync","(close)")):de.default.exit(h)}),m.on("error",h=>{if(h.code==="ENOENT")this._checkForMissingExecutable(a,c,t._name);else if(h.code==="EACCES")throw new Error(`'${a}' not executable`);if(!f)de.default.exit(1);else{let E=new un(1,"commander.executeSubCommandAsync","(error)");E.nestedError=h,f(E)}}),this.runningCommand=m}_dispatchSubcommand(t,n,o){let i=this._findCommand(t);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(t){t||this.help();let n=this._findCommand(t);return n&&!n._executableHandler&&n.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,n)=>{t.required&&this.args[n]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(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)=>t(o,l,c),o.defaultValue))):a===void 0&&(a=[]):i<this.args.length&&(a=this.args[i],o.parseArg&&(a=t(o,a,o.defaultValue))),n[i]=a}),this.processedArgs=n}_chainOrCall(t,n){return t?.then&&typeof t.then=="function"?t.then(()=>n()):n()}_chainOrCallHooks(t,n){let o=t,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(t,n,o){let i=t;return this._lifeCycleHooks[o]!==void 0&&this._lifeCycleHooks[o].forEach(a=>{i=this._chainOrCall(i,()=>a(this,n))}),i}_parseCommand(t,n){let o=this.parseOptions(n);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(o.operands),n=o.unknown,this.args=t.concat(n),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),n);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(n),this._dispatchSubcommand(this._defaultCommandName,t,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,t,n)})),c=this._chainOrCallHooks(c,"postAction"),c}if(this.parent?.listenerCount(a))i(),this._processArguments(),this.parent.emit(a,t,n);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,n);this.listenerCount("command:*")?this.emit("command:*",t,n):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(n=>n._name===t||n._aliases.includes(t))}_findOption(t){return this.options.find(n=>n.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(n=>{n.mandatory&&t.getOptionValue(n.attributeName())===void 0&&t.missingMandatoryOptionValue(n)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(o=>{let i=o.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});t.filter(o=>o.conflictsWith.length>0).forEach(o=>{let i=t.find(a=>o.conflictsWith.includes(a.attributeName()));i&&this._conflictingOption(o,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let n=[],o=[],i=n;function a(h){return h.length>1&&h[0]==="-"}let c=h=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(h)?!this._getCommandAndAncestors().some(E=>E.options.map(I=>I.short).some(I=>/^-\d$/.test(I))):!1,l=null,m=null,f=0;for(;f<t.length||m;){let h=m??t[f++];if(m=null,h==="--"){i===o&&i.push(h),i.push(...t.slice(f));break}if(l&&(!a(h)||c(h))){this.emit(`option:${l.name()}`,h);continue}if(l=null,a(h)){let E=this._findOption(h);if(E){if(E.required){let I=t[f++];I===void 0&&this.optionMissingArgument(E),this.emit(`option:${E.name()}`,I)}else if(E.optional){let I=null;f<t.length&&(!a(t[f])||c(t[f]))&&(I=t[f++]),this.emit(`option:${E.name()}`,I)}else this.emit(`option:${E.name()}`);l=E.variadic?E:null;continue}}if(h.length>2&&h[0]==="-"&&h[1]!=="-"){let E=this._findOption(`-${h[1]}`);if(E){E.required||E.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${E.name()}`,h.slice(2)):(this.emit(`option:${E.name()}`),m=`-${h.slice(2)}`);continue}}if(/^--[^=]+=/.test(h)){let E=h.indexOf("="),I=this._findOption(h.slice(0,E));if(I&&(I.required||I.optional)){this.emit(`option:${I.name()}`,h.slice(E+1));continue}}if(i===n&&a(h)&&!(this.commands.length===0&&c(h))&&(i=o),(this._enablePositionalOptions||this._passThroughOptions)&&n.length===0&&o.length===0){if(this._findCommand(h)){n.push(h),o.push(...t.slice(f));break}else if(this._getHelpCommand()&&h===this._getHelpCommand().name()){n.push(h,...t.slice(f));break}else if(this._defaultCommandName){o.push(h,...t.slice(f));break}}if(this._passThroughOptions){i.push(h,...t.slice(f));break}i.push(h)}return{operands:n,unknown:o}}opts(){if(this._storeOptionsAsProperties){let t={},n=this.options.length;for(let o=0;o<n;o++){let i=this.options[o].attributeName();t[i]=i===this._versionOptionName?this._version:this[i]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,n)=>Object.assign(t,n.opts()),{})}error(t,n){this._outputConfiguration.outputError(`${t}
21
+ - ${i}`;throw new Error(a)}_executeSubCommand(t,n){n=n.slice();let o=[".js",".ts",".tsx",".mjs",".cjs"];function i(h,E){let I=Er.default.resolve(h,E);if(ba.default.existsSync(I))return I;if(o.includes(Er.default.extname(E)))return;let g=o.find(T=>ba.default.existsSync(`${I}${T}`));if(g)return`${I}${g}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=t._executableFile||`${this._name}-${t._name}`,c=this._executableDir||"";if(this._scriptPath){let h;try{h=ba.default.realpathSync(this._scriptPath)}catch{h=this._scriptPath}c=Er.default.resolve(Er.default.dirname(h),c)}if(c){let h=i(c,a);if(!h&&!t._executableFile&&this._scriptPath){let E=Er.default.basename(this._scriptPath,Er.default.extname(this._scriptPath));E!==this._name&&(h=i(c,`${E}-${t._name}`))}a=h||a}let l=o.includes(Er.default.extname(a)),m;de.default.platform!=="win32"?l?(n.unshift(a),n=dy(de.default.execArgv).concat(n),m=Fc.default.spawn(de.default.argv[0],n,{stdio:"inherit"})):m=Fc.default.spawn(a,n,{stdio:"inherit"}):(this._checkForMissingExecutable(a,c,t._name),n.unshift(a),n=dy(de.default.execArgv).concat(n),m=Fc.default.spawn(de.default.execPath,n,{stdio:"inherit"})),m.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(E=>{de.default.on(E,()=>{m.killed===!1&&m.exitCode===null&&m.kill(E)})});let f=this._exitCallback;m.on("close",h=>{h=h??1,f?f(new un(h,"commander.executeSubCommandAsync","(close)")):de.default.exit(h)}),m.on("error",h=>{if(h.code==="ENOENT")this._checkForMissingExecutable(a,c,t._name);else if(h.code==="EACCES")throw new Error(`'${a}' not executable`);if(!f)de.default.exit(1);else{let E=new un(1,"commander.executeSubCommandAsync","(error)");E.nestedError=h,f(E)}}),this.runningCommand=m}_dispatchSubcommand(t,n,o){let i=this._findCommand(t);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(t){t||this.help();let n=this._findCommand(t);return n&&!n._executableHandler&&n.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,n)=>{t.required&&this.args[n]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(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)=>t(o,l,c),o.defaultValue))):a===void 0&&(a=[]):i<this.args.length&&(a=this.args[i],o.parseArg&&(a=t(o,a,o.defaultValue))),n[i]=a}),this.processedArgs=n}_chainOrCall(t,n){return t?.then&&typeof t.then=="function"?t.then(()=>n()):n()}_chainOrCallHooks(t,n){let o=t,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(t,n,o){let i=t;return this._lifeCycleHooks[o]!==void 0&&this._lifeCycleHooks[o].forEach(a=>{i=this._chainOrCall(i,()=>a(this,n))}),i}_parseCommand(t,n){let o=this.parseOptions(n);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(o.operands),n=o.unknown,this.args=t.concat(n),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),n);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(n),this._dispatchSubcommand(this._defaultCommandName,t,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,t,n)})),c=this._chainOrCallHooks(c,"postAction"),c}if(this.parent?.listenerCount(a))i(),this._processArguments(),this.parent.emit(a,t,n);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,n);this.listenerCount("command:*")?this.emit("command:*",t,n):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(n=>n._name===t||n._aliases.includes(t))}_findOption(t){return this.options.find(n=>n.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(n=>{n.mandatory&&t.getOptionValue(n.attributeName())===void 0&&t.missingMandatoryOptionValue(n)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(o=>{let i=o.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});t.filter(o=>o.conflictsWith.length>0).forEach(o=>{let i=t.find(a=>o.conflictsWith.includes(a.attributeName()));i&&this._conflictingOption(o,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let n=[],o=[],i=n;function a(h){return h.length>1&&h[0]==="-"}let c=h=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(h)?!this._getCommandAndAncestors().some(E=>E.options.map(I=>I.short).some(I=>/^-\d$/.test(I))):!1,l=null,m=null,f=0;for(;f<t.length||m;){let h=m??t[f++];if(m=null,h==="--"){i===o&&i.push(h),i.push(...t.slice(f));break}if(l&&(!a(h)||c(h))){this.emit(`option:${l.name()}`,h);continue}if(l=null,a(h)){let E=this._findOption(h);if(E){if(E.required){let I=t[f++];I===void 0&&this.optionMissingArgument(E),this.emit(`option:${E.name()}`,I)}else if(E.optional){let I=null;f<t.length&&(!a(t[f])||c(t[f]))&&(I=t[f++]),this.emit(`option:${E.name()}`,I)}else this.emit(`option:${E.name()}`);l=E.variadic?E:null;continue}}if(h.length>2&&h[0]==="-"&&h[1]!=="-"){let E=this._findOption(`-${h[1]}`);if(E){E.required||E.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${E.name()}`,h.slice(2)):(this.emit(`option:${E.name()}`),m=`-${h.slice(2)}`);continue}}if(/^--[^=]+=/.test(h)){let E=h.indexOf("="),I=this._findOption(h.slice(0,E));if(I&&(I.required||I.optional)){this.emit(`option:${I.name()}`,h.slice(E+1));continue}}if(i===n&&a(h)&&!(this.commands.length===0&&c(h))&&(i=o),(this._enablePositionalOptions||this._passThroughOptions)&&n.length===0&&o.length===0){if(this._findCommand(h)){n.push(h),o.push(...t.slice(f));break}else if(this._getHelpCommand()&&h===this._getHelpCommand().name()){n.push(h,...t.slice(f));break}else if(this._defaultCommandName){o.push(h,...t.slice(f));break}}if(this._passThroughOptions){i.push(h,...t.slice(f));break}i.push(h)}return{operands:n,unknown:o}}opts(){if(this._storeOptionsAsProperties){let t={},n=this.options.length;for(let o=0;o<n;o++){let i=this.options[o].attributeName();t[i]=i===this._versionOptionName?this._version:this[i]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,n)=>Object.assign(t,n.opts()),{})}error(t,n){this._outputConfiguration.outputError(`${t}
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,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in de.default.env){let n=t.attributeName();(this.getOptionValue(n)===void 0||["default","config","env"].includes(this.getOptionValueSource(n)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,de.default.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new Gc(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())&&t.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(t){let n=`error: missing required argument '${t}'`;this.error(n,{code:"commander.missingArgument"})}optionMissingArgument(t){let n=`error: option '${t.flags}' argument missing`;this.error(n,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let n=`error: required option '${t.flags}' not specified`;this.error(n,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,n){let o=c=>{let l=c.attributeName(),m=this.getOptionValue(l),f=this.options.find(E=>E.negate&&l===E.attributeName()),h=this.options.find(E=>!E.negate&&l===E.attributeName());return f&&(f.presetArg===void 0&&m===!1||f.presetArg!==void 0&&m===f.presetArg)?f:h||c},i=c=>{let l=o(c),m=l.attributeName();return this.getOptionValueSource(m)==="env"?`environment variable '${l.envVar}'`:`option '${l.flags}'`},a=`error: ${i(t)} cannot be used with ${i(n)}`;this.error(a,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let n="";if(t.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=em(t,i)}let o=`error: unknown option '${t}'${n}`;this.error(o,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let n=this.registeredArguments.length,o=n===1?"":"s",i=t.length,a=this.parent?` for '${this.name()}'`:"",c=t.join(", "),l=`error: too many arguments${a}. Expected ${n} argument${o} but got ${i}: ${c}.`;this.error(l,{code:"commander.excessArguments"})}unknownCommand(){let t=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=em(t,i)}let o=`error: unknown command '${t}'${n}`;this.error(o,{code:"commander.unknownCommand"})}version(t,n,o){if(t===void 0)return this._version;this._version=t,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(`${t}
25
- `),this._exit(0,"commander.version",t)}),this}description(t,n){return t===void 0&&n===void 0?this._description:(this._description=t,n&&(this._argsDescription=n),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===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]),t===n._name)throw new Error("Command alias can't be the same as its name");let o=this.parent?._findCommand(t);if(o){let i=[o.name()].concat(o.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${i}'`)}return n._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(n=>this.alias(n)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let n=this.registeredArguments.map(o=>Dc(o));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?n:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}helpGroup(t){return t===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return t===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return t===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=Tr.default.basename(t,Tr.default.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let n=this.createHelp(),o=this._getOutputContext(t);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(t){t=t||{};let n=!!t.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(t){let n;typeof t=="function"&&(n=t,t=void 0);let o=this._getOutputContext(t),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(t,n){return typeof t=="boolean"?(t?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(t??"-h, --help",n??"display help for command"),(t||n)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let n=Number(de.default.exitCode??0);n===0&&t&&typeof t!="function"&&t.error&&(n=1),this._exit(n,"commander.help","(outputHelp)")}addHelpText(t,n){let o=["beforeAll","before","after","afterAll"];if(!o.includes(t))throw new Error(`Unexpected value for position to addHelpText.
24
+ `),this.outputHelp({error:!0}));let o=n||{},i=o.exitCode||1,a=o.code||"commander.error";this._exit(i,a,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in de.default.env){let n=t.attributeName();(this.getOptionValue(n)===void 0||["default","config","env"].includes(this.getOptionValueSource(n)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,de.default.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new $c(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())&&t.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(t){let n=`error: missing required argument '${t}'`;this.error(n,{code:"commander.missingArgument"})}optionMissingArgument(t){let n=`error: option '${t.flags}' argument missing`;this.error(n,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let n=`error: required option '${t.flags}' not specified`;this.error(n,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,n){let o=c=>{let l=c.attributeName(),m=this.getOptionValue(l),f=this.options.find(E=>E.negate&&l===E.attributeName()),h=this.options.find(E=>!E.negate&&l===E.attributeName());return f&&(f.presetArg===void 0&&m===!1||f.presetArg!==void 0&&m===f.presetArg)?f:h||c},i=c=>{let l=o(c),m=l.attributeName();return this.getOptionValueSource(m)==="env"?`environment variable '${l.envVar}'`:`option '${l.flags}'`},a=`error: ${i(t)} cannot be used with ${i(n)}`;this.error(a,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let n="";if(t.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=rm(t,i)}let o=`error: unknown option '${t}'${n}`;this.error(o,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let n=this.registeredArguments.length,o=n===1?"":"s",i=t.length,a=this.parent?` for '${this.name()}'`:"",c=t.join(", "),l=`error: too many arguments${a}. Expected ${n} argument${o} but got ${i}: ${c}.`;this.error(l,{code:"commander.excessArguments"})}unknownCommand(){let t=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=rm(t,i)}let o=`error: unknown command '${t}'${n}`;this.error(o,{code:"commander.unknownCommand"})}version(t,n,o){if(t===void 0)return this._version;this._version=t,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(`${t}
25
+ `),this._exit(0,"commander.version",t)}),this}description(t,n){return t===void 0&&n===void 0?this._description:(this._description=t,n&&(this._argsDescription=n),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===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]),t===n._name)throw new Error("Command alias can't be the same as its name");let o=this.parent?._findCommand(t);if(o){let i=[o.name()].concat(o.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${i}'`)}return n._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(n=>this.alias(n)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let n=this.registeredArguments.map(o=>Gc(o));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?n:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}helpGroup(t){return t===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return t===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return t===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=Er.default.basename(t,Er.default.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let n=this.createHelp(),o=this._getOutputContext(t);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(t){t=t||{};let n=!!t.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(t){let n;typeof t=="function"&&(n=t,t=void 0);let o=this._getOutputContext(t),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(t,n){return typeof t=="boolean"?(t?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(t??"-h, --help",n??"display help for command"),(t||n)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let n=Number(de.default.exitCode??0);n===0&&t&&typeof t!="function"&&t.error&&(n=1),this._exit(n,"commander.help","(outputHelp)")}addHelpText(t,n){let o=["beforeAll","before","after","afterAll"];if(!o.includes(t))throw new Error(`Unexpected value for position to addHelpText.
26
26
  Expecting one of '${o.join("', '")}'`);let i=`${t}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(t){let n=this._getHelpOption();n&&t.find(i=>n.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function ly(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let n,o="127.0.0.1",i="9229",a;return(a=t.match(/^(--inspect(-brk)?)$/))!==null?n=a[1]:(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(n=a[1],/^\d+$/.test(a[3])?i=a[3]:o=a[3]):(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(n=a[1],o=a[3],i=a[4]),n&&i!=="0"?`${n}=${o}:${parseInt(i)+1}`:t})}function my(){if(de.default.env.NO_COLOR||de.default.env.FORCE_COLOR==="0"||de.default.env.FORCE_COLOR==="false")return!1;if(de.default.env.FORCE_COLOR||de.default.env.CLICOLOR_FORCE!==void 0)return!0}var B8=new Fo;function Ze(e){throw new Error(`assertUnreachable: ${JSON.stringify(e,null,2)}`)}var d0=Math.pow(10,8)*24*60*60*1e3,z8=-d0;var gy=864e5,hy=6e4,yy=36e5;var f0=3600;var Ty=f0*24,Y8=Ty*7,g0=Ty*365.2425,h0=g0/12,V8=h0*3,tm=Symbol.for("constructDateFrom");function pr(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&tm in e?e[tm](t):e instanceof Date?new e.constructor(t):new Date(t)}function Xe(e,t){return pr(t||e,e)}function Ey(e,t,n){let o=Xe(e,n?.in);return isNaN(t)?pr(n?.in||e,NaN):(t&&o.setDate(o.getDate()+t),o)}function _y(e,t,n){let o=Xe(e,n?.in);if(isNaN(t))return pr(n?.in||e,NaN);if(!t)return o;let i=o.getDate(),a=pr(n?.in||e,o.getTime());a.setMonth(o.getMonth()+t+1,0);let c=a.getDate();return i>=c?a:(o.setFullYear(a.getFullYear(),a.getMonth(),i),o)}function jo(e,t,n){let{years:o=0,months:i=0,weeks:a=0,days:c=0,hours:l=0,minutes:m=0,seconds:f=0}=t,h=Xe(e,n?.in),E=i||o?_y(h,i+o*12):h,I=c||a?Ey(E,c+a*7):E,g=m+l*60,O=(f+g*60)*1e3;return pr(n?.in||e,+I+O)}var y0={};function Iy(){return y0}function rm(e){let t=Xe(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function It(e,...t){let n=pr.bind(null,e||t.find(o=>typeof o=="object"));return t.map(n)}function nm(e,t){let n=Xe(e,t?.in);return n.setHours(0,0,0,0),n}function Sy(e,t,n){let[o,i]=It(n?.in,e,t),a=nm(o),c=nm(i),l=+a-rm(a),m=+c-rm(c);return Math.round((l-m)/gy)}function Vn(e,t){let n=+Xe(e)-+Xe(t);return n<0?-1:n>0?1:n}function by(e,t,n){let[o,i]=It(n?.in,e,t),a=o.getFullYear()-i.getFullYear(),c=o.getMonth()-i.getMonth();return a*12+c}function Oy(e,t,n){let[o,i]=It(n?.in,e,t);return o.getFullYear()-i.getFullYear()}function xy(e,t,n){let[o,i]=It(n?.in,e,t),a=Ay(o,i),c=Math.abs(Sy(o,i));o.setDate(o.getDate()-a*c);let l=+(Ay(o,i)===-a),m=a*(c-l);return m===0?0:m}function Ay(e,t){let n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function qo(e){return t=>{let o=(e?Math[e]:Math.trunc)(t);return o===0?0:o}}function Ry(e,t,n){let[o,i]=It(n?.in,e,t),a=(+o-+i)/yy;return qo(n?.roundingMethod)(a)}function Fc(e,t){return+Xe(e)-+Xe(t)}function Cy(e,t,n){let o=Fc(e,t)/hy;return qo(n?.roundingMethod)(o)}function Py(e,t){let n=Xe(e,t?.in);return n.setHours(23,59,59,999),n}function Uy(e,t){let n=Xe(e,t?.in),o=n.getMonth();return n.setFullYear(n.getFullYear(),o+1,0),n.setHours(23,59,59,999),n}function wy(e,t){let n=Xe(e,t?.in);return+Py(n,t)==+Uy(n,t)}function vy(e,t,n){let[o,i,a]=It(n?.in,e,e,t),c=Vn(i,a),l=Math.abs(by(i,a));if(l<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-c*l);let m=Vn(i,a)===-c;wy(o)&&l===1&&Vn(o,a)===1&&(m=!1);let f=c*(l-+m);return f===0?0:f}function Ny(e,t,n){let o=Fc(e,t)/1e3;return qo(n?.roundingMethod)(o)}function Ly(e,t,n){let[o,i]=It(n?.in,e,t),a=Vn(o,i),c=Math.abs(Oy(o,i));o.setFullYear(1584),i.setFullYear(1584);let l=Vn(o,i)===-a,m=a*(c-+l);return m===0?0:m}function ky(e,t){let[n,o]=It(e,t.start,t.end);return{start:n,end:o}}var T0={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},My=(e,t,n)=>{let o,i=T0[e];return typeof i=="string"?o=i:t===1?o=i.one:o=i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+o:o+" ago":o};function jc(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var E0={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},_0={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},I0={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Dy={date:jc({formats:E0,defaultWidth:"full"}),time:jc({formats:_0,defaultWidth:"full"}),dateTime:jc({formats:I0,defaultWidth:"full"})};var S0={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Gy=(e,t,n,o)=>S0[e];function Bo(e){return(t,n)=>{let o=n?.context?String(n.context):"standalone",i;if(o==="formatting"&&e.formattingValues){let c=e.defaultFormattingWidth||e.defaultWidth,l=n?.width?String(n.width):c;i=e.formattingValues[l]||e.formattingValues[c]}else{let c=e.defaultWidth,l=n?.width?String(n.width):e.defaultWidth;i=e.values[l]||e.values[c]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var b0={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},O0={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},A0={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},x0={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},R0={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},C0={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},P0=(e,t)=>{let n=Number(e),o=n%100;if(o>20||o<10)switch(o%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},$y={ordinalNumber:P0,era:Bo({values:b0,defaultWidth:"wide"}),quarter:Bo({values:O0,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Bo({values:A0,defaultWidth:"wide"}),day:Bo({values:x0,defaultWidth:"wide"}),dayPeriod:Bo({values:R0,defaultWidth:"wide",formattingValues:C0,defaultFormattingWidth:"wide"})};function Ho(e){return(t,n={})=>{let o=n.width,i=o&&e.matchPatterns[o]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let c=a[0],l=o&&e.parsePatterns[o]||e.parsePatterns[e.defaultParseWidth],m=Array.isArray(l)?w0(l,E=>E.test(c)):U0(l,E=>E.test(c)),f;f=e.valueCallback?e.valueCallback(m):m,f=n.valueCallback?n.valueCallback(f):f;let h=t.slice(c.length);return{value:f,rest:h}}}function U0(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function w0(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Fy(e){return(t,n={})=>{let o=t.match(e.matchPattern);if(!o)return null;let i=o[0],a=t.match(e.parsePattern);if(!a)return null;let c=e.valueCallback?e.valueCallback(a[0]):a[0];c=n.valueCallback?n.valueCallback(c):c;let l=t.slice(i.length);return{value:c,rest:l}}}var v0=/^(\d+)(th|st|nd|rd)?/i,N0=/\d+/i,L0={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},k0={any:[/^b/i,/^(a|c)/i]},M0={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},D0={any:[/1/i,/2/i,/3/i,/4/i]},G0={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},$0={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},F0={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},j0={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},q0={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},B0={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},jy={ordinalNumber:Fy({matchPattern:v0,parsePattern:N0,valueCallback:e=>parseInt(e,10)}),era:Ho({matchPatterns:L0,defaultMatchWidth:"wide",parsePatterns:k0,defaultParseWidth:"any"}),quarter:Ho({matchPatterns:M0,defaultMatchWidth:"wide",parsePatterns:D0,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ho({matchPatterns:G0,defaultMatchWidth:"wide",parsePatterns:$0,defaultParseWidth:"any"}),day:Ho({matchPatterns:F0,defaultMatchWidth:"wide",parsePatterns:j0,defaultParseWidth:"any"}),dayPeriod:Ho({matchPatterns:q0,defaultMatchWidth:"any",parsePatterns:B0,defaultParseWidth:"any"})};var om={code:"en-US",formatDistance:My,formatLong:Dy,formatRelative:Gy,localize:$y,match:jy,options:{weekStartsOn:0,firstWeekContainsDate:1}};var H0=["years","months","weeks","days","hours","minutes","seconds"];function qy(e,t){let n=Iy(),o=t?.locale??n.locale??om,i=t?.format??H0,a=t?.zero??!1,c=t?.delimiter??" ";return o.formatDistance?i.reduce((m,f)=>{let h=`x${f.replace(/(^.)/,I=>I.toUpperCase())}`,E=e[f];return E!==void 0&&(a||e[f])?m.concat(o.formatDistance(h,E)):m},[]).join(c):""}function By(e,t){let{start:n,end:o}=ky(t?.in,e),i={},a=Ly(o,n);a&&(i.years=a);let c=jo(n,{years:i.years}),l=vy(o,c);l&&(i.months=l);let m=jo(c,{months:i.months}),f=xy(o,m);f&&(i.days=f);let h=jo(m,{days:i.days}),E=Ry(o,h);E&&(i.hours=E);let I=jo(h,{hours:i.hours}),g=Cy(o,I);g&&(i.minutes=g);let T=jo(I,{minutes:i.minutes}),O=Ny(o,T);return O&&(i.seconds=O),i}var K7=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 tZ=60*1e3;var DZ=1/1e6,am=1e3,Sa=60*am,W0=60*Sa,Bc=24*W0,GZ=7*Bc,$Z=30*Bc;var sm=["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-15-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 Z0={s:1,m:60,h:3600,d:86400};function Ky(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<48||n>57)return!1}return!0}function zy(){return Math.floor(Date.now()/1e3)}function Ko(e){if(typeof e=="number")return e;if(e==="now")return zy();if(e.startsWith("-")&&e.length>=3){let n=e.at(-1),o=n?Z0[n]:void 0;if(o){let i=e.slice(1,-1);if(i.length>0&&Ky(i))return zy()-parseInt(i,10)*o}}if(Ky(e)&&e.length>0)return parseInt(e,10);let t=Date.parse(e);if(!Number.isNaN(t))return Math.floor(t/1e3);throw new Error(`Invalid time value: ${e}. Use unix seconds, relative (-30m, -1h), 'now', or ISO 8601.`)}var y={};Zt(y,{Assign:()=>X0,Clone:()=>Zn,Create:()=>iG,Discard:()=>aG,Metrics:()=>ur,Update:()=>sG});var ur={assign:0,create:0,clone:0,discard:0,update:0};function X0(e,t){return ur.assign+=1,{...e,...t}}var s={};Zt(s,{Counted:()=>TD,Entries:()=>ID,EntriesRegExp:()=>_D,Every:()=>fD,EveryAll:()=>gD,GraphemeCount:()=>lD,HasPropertyKey:()=>ED,IsArray:()=>Oa,IsBigInt:()=>ba,IsBoolean:()=>tT,IsClassInstance:()=>uD,IsConstructor:()=>oD,IsDeepEqual:()=>lm,IsEqual:()=>te,IsFunction:()=>rT,IsGreaterEqualThan:()=>oT,IsGreaterThan:()=>sD,IsInteger:()=>pm,IsLessEqualThan:()=>nT,IsLessThan:()=>cD,IsMaxLength:()=>mD,IsMinLength:()=>dD,IsMultipleOf:()=>pD,IsNull:()=>zc,IsNumber:()=>Yc,IsObject:()=>Aa,IsObjectNotArray:()=>iD,IsString:()=>Vc,IsSymbol:()=>aD,IsUndefined:()=>um,IsUnsafePropertyKey:()=>aT,IsValueLike:()=>iT,Keys:()=>Kc,ShiftLeft:()=>Qc,Some:()=>hD,SomeAll:()=>yD,Symbols:()=>SD,Values:()=>bD});function Qn(e,t,n){return e>=t&&e<=n}function J0(e){return e===8205}function eD(e){return Qn(e,55296,56319)}function Yy(e){return Qn(e,127462,127487)}function Qy(e){return Qn(e,65024,65039)}function Wy(e){return Qn(e,768,879)||Qn(e,6832,6911)||Qn(e,7616,7679)||Qn(e,65056,65071)}function Hc(e){return e>65535?2:1}function Vy(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(Wy(n)||Qy(n))t+=Hc(n);else break}return t}function cm(e,t){let n=e.codePointAt(t),o=t+Hc(n);for(o=Vy(e,o);o<e.length-1&&e[o]==="\u200D";){let i=e.codePointAt(o+1);o+=1+Hc(i),o=Vy(e,o)}return Yy(n)&&o<e.length&&Yy(e.codePointAt(o))&&(o+=Hc(e.codePointAt(o))),o}function Zy(e){return eD(e)||Wy(e)||Qy(e)||J0(e)}function Xy(e){let t=0,n=0;for(;n<e.length;)n=cm(e,n),t++;return t}function tD(e,t){if(t===0)return!0;let n=0,o=0;for(;o<e.length;)if(o=cm(e,o),n++,n>=t)return!0;return!1}function rD(e,t){let n=0,o=0;for(;o<e.length;)if(o=cm(e,o),n++,n>t)return!1;return!0}function Jy(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Zy(e.charCodeAt(n)))return tD(e,t);if(n++,n>=t)return!0}return!1}function eT(e,t){let n=0;for(;n<e.length;){if(Zy(e.charCodeAt(n)))return rD(e,t);if(n++,n>t)return!1}return!0}function Oa(e){return Array.isArray(e)}function ba(e){return te(typeof e,"bigint")}function tT(e){return te(typeof e,"boolean")}function oD(e){if(um(e)||!rT(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function rT(e){return te(typeof e,"function")}function pm(e){return Number.isInteger(e)}function zc(e){return te(e,null)}function Yc(e){return Number.isFinite(e)}function iD(e){return Aa(e)&&!Oa(e)}function Aa(e){return te(typeof e,"object")&&!zc(e)}function Vc(e){return te(typeof e,"string")}function aD(e){return te(typeof e,"symbol")}function um(e){return te(e,void 0)}function te(e,t){return e===t}function sD(e,t){return e>t}function cD(e,t){return e<t}function nT(e,t){return e<=t}function oT(e,t){return e>=t}function pD(e,t){if(ba(e)||ba(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!Yc(e)||pm(e)&&1/t%1===0)return!0;let o=e%t;return Math.min(Math.abs(o),Math.abs(o-t),Math.abs(o+t))<n}function uD(e){if(!Aa(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return zc(t)?!1:te(typeof t.constructor,"function")&&!(te(t.constructor,globalThis.Object)||te(t.constructor.name,"Object"))}function iT(e){return ba(e)||tT(e)||zc(e)||Yc(e)||Vc(e)||um(e)}function lD(e){return Xy(e)}function mD(e,t){return eT(e,t)}function dD(e,t){return Jy(e,t)}function fD(e,t,n){for(let o=t;o<e.length;o++)if(!n(e[o],o))return!1;return!0}function gD(e,t,n){let o=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(o=!1);return o}function hD(e,t){for(let n=0;n<e.length;n++)if(t(e[n],n))return!0;return!1}function yD(e,t){let n=!1;for(let o=0;o<e.length;o++)t(e[o],o)&&(n=!0);return n}function TD(e,t){return e.reduce((n,o,i)=>t(o,i)?++n:n,0)}function Qc(e,t,n){return te(e.length,0)?n():t(e[0],e.slice(1))}function aT(e){return te(e,"__proto__")||te(e,"constructor")||te(e,"prototype")}function ED(e,t){return aT(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function _D(e){return Kc(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function ID(e){return Object.entries(e)}function Kc(e){return Object.getOwnPropertyNames(e)}function SD(e){return Object.getOwnPropertySymbols(e)}function bD(e){return Object.values(e)}function OD(e,t){if(!Aa(t))return!1;let n=Kc(e);return te(n.length,Kc(t).length)&&n.every(o=>lm(e[o],t[o]))}function AD(e,t){return Oa(t)&&te(e.length,t.length)&&e.every((n,o)=>lm(e[o],t[o]))}function lm(e,t){return Oa(e)?AD(e,t):Aa(e)?OD(e,t):te(e,t)}var St={};Zt(St,{IsBigInt64Array:()=>$D,IsBigUint64Array:()=>FD,IsBoolean:()=>xD,IsDate:()=>qD,IsFloat32Array:()=>DD,IsFloat64Array:()=>GD,IsInt16Array:()=>ND,IsInt32Array:()=>kD,IsInt8Array:()=>UD,IsMap:()=>HD,IsNumber:()=>RD,IsRegExp:()=>jD,IsSet:()=>BD,IsString:()=>CD,IsTypeArray:()=>PD,IsUint16Array:()=>LD,IsUint32Array:()=>MD,IsUint8Array:()=>wD,IsUint8ClampedArray:()=>vD});function xD(e){return e instanceof Boolean}function RD(e){return e instanceof Number}function CD(e){return e instanceof String}function PD(e){return globalThis.ArrayBuffer.isView(e)}function UD(e){return e instanceof globalThis.Int8Array}function wD(e){return e instanceof globalThis.Uint8Array}function vD(e){return e instanceof globalThis.Uint8ClampedArray}function ND(e){return e instanceof globalThis.Int16Array}function LD(e){return e instanceof globalThis.Uint16Array}function kD(e){return e instanceof globalThis.Int32Array}function MD(e){return e instanceof globalThis.Uint32Array}function DD(e){return e instanceof globalThis.Float32Array}function GD(e){return e instanceof globalThis.Float64Array}function $D(e){return e instanceof globalThis.BigInt64Array}function FD(e){return e instanceof globalThis.BigUint64Array}function jD(e){return e instanceof globalThis.RegExp}function qD(e){return e instanceof globalThis.Date}function BD(e){return e instanceof globalThis.Set}function HD(e){return e instanceof globalThis.Map}var Wc=s;function zD(e){return s.HasPropertyKey(e,"~kind")||s.HasPropertyKey(e,"~unsafe")}function YD(e){let t={};for(let n of Object.getOwnPropertyNames(e)){if(s.IsUnsafePropertyKey(n))continue;let o=Object.getOwnPropertyDescriptor(e,n);o.value=Wn(o.value),s.IsEqual(o.enumerable,!0)?t[n]=o.value:Object.defineProperty(t,n,o)}return t}function VD(e){let t={};for(let n of s.Keys(e))s.IsUnsafePropertyKey(n)||(t[n]=Wn(e[n]));for(let n of s.Symbols(e))t[n]=Wn(e[n]);return t}function QD(e){return s.IsClassInstance(e)?e:zD(e)?YD(e):VD(e)}function WD(e){return e.map(t=>Wn(t))}function ZD(e){return e.slice()}function XD(e){return new RegExp(e.source,e.flags)}function JD(e){return new Map(Wn([...e.entries()]))}function eG(e){return new Set(Wn([...e.values()]))}function Wn(e){return St.IsTypeArray(e)?ZD(e):St.IsRegExp(e)?XD(e):St.IsMap(e)?JD(e):St.IsSet(e)?eG(e):s.IsArray(e)?WD(e):s.IsObject(e)?QD(e):e}function Zn(e){return ur.clone+=1,Wn(e)}var at={};Zt(at,{Get:()=>nG,Reset:()=>tG,Set:()=>rG});var Er={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function tG(){Er.immutableTypes=!1,Er.maxErrors=8,Er.maxInstantiationCount=128,Er.useAcceleration=!0,Er.exactOptionalPropertyTypes=!1,Er.enumerableKind=!1,Er.correctiveParse=!1,Er.unionPrioritySort=!0}function rG(e){for(let t of s.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(Er,t,{value:n})}}function nG(){return Er}function oG(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function sT(e,t){return{...e,...t}}function iG(e,t,n={}){ur.create+=1;let o=at.Get(),i=sT(t,n),a=o.enumerableKind?sT(i,e):oG(i,e);return o.immutableTypes?Object.freeze(a):a}function aG(e,t){ur.discard+=1;let n={};for(let o of Object.getOwnPropertyNames(e)){if(t.includes(o))continue;let i=Object.getOwnPropertyDescriptor(e,o);i.value=Zn(i.value),Object.defineProperty(n,o,i)}return n}function sG(e,t,n){ur.update+=1;let o=at.Get(),i=Zn(e);for(let a of Object.keys(t))Object.defineProperty(i,a,{configurable:!0,writable:!0,enumerable:o.enumerableKind,value:t[a]});for(let a of Object.keys(n))Object.defineProperty(i,a,{configurable:!0,enumerable:!0,writable:!0,value:n[a]});return i}function w(e,t){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],t)}function Le(e){return s.IsObject(e)}function N(e,t,n){return y.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function ln(e){return w(e,"Deferred")}function cG(e){return y.Update(e,{"~readonly":!0},{})}function xa(e,t){return y.Update(cG(e),{},t)}function cT(e,t,n,o){let i=A(e,t,n);return xa(i,o)}function pG(e){return y.Update(e,{"~optional":!0},{})}function Ra(e,t){return y.Update(pG(e),{},t)}function pT(e,t,n,o){let i=A(e,t,n);return Ra(i,o)}function vt(e,t){return y.Create({"~kind":"Array"},{type:"array",items:e},t)}function X(e){return w(e,"Array")}function zo(e){return y.Discard(e,["~kind","type","items"])}function _r(e,t,n={}){return y.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function Ye(e){return w(e,"Constructor")}function uT(e){return y.Discard(e,["~kind","type","parameters","instanceType"])}function Ir(e,t,n={}){return y.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function Ve(e){return w(e,"Function")}function lT(e){return y.Discard(e,["~kind","type","parameters","returnType"])}function st(e,t){return y.Create({"~kind":"Ref"},{$ref:e},t)}function ue(e){return w(e,"Ref")}function mn(e,t){return y.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Yo(e){return w(e,"Generic")}function Vo(e){return y.Create({"~kind":"Any"},{},e)}function Je(e){return w(e,"Any")}var mT="(?!)";function fe(e){return y.Create({"~kind":"Never"},{not:{}},e)}function lr(e){return w(e,"Never")}function Sr(e,t={}){return N("AddOptional",[e],t)}function Xn(e,t={}){return Ra(e,t)}function dT(e){return Xn(e)}function nt(e){return Le(e)&&s.HasPropertyKey(e,"~optional")}function fT(e){return s.Keys(e).filter(t=>!nt(e[t]))}function Zc(e){return s.Keys(e)}function Xc(e){return s.Values(e)}function D(e,t={}){let n=fT(e),o=n.length>0?{required:n}:{};return y.Create({"~kind":"Object"},{type:"object",...o,properties:e},t)}function $(e){return w(e,"Object")}function gT(e){return y.Discard(e,["~kind","type","properties","required"])}function et(e){return y.Create({"~kind":"Unknown"},{},e)}function ot(e){return w(e,"Unknown")}function br(e,t,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:t},n)}function Ee(e){return w(e,"Cyclic")}function hT(e){return y.Update(e,{"~unsafe":null},{})}function Jc(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}var ie={};Zt(ie,{Match:()=>uG});function uG(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function Ca(...e){let[t,n]=ie.Match(e,{2:(o,i)=>[o,i,i],1:o=>[o,et(),et()]});return y.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function Qe(e){return w(e,"Infer")}function Jn(e,t,n,o={}){return y.Create({"~kind":"Dependent"},{if:e,then:t,else:n},o)}function $e(e){return w(e,"Dependent")}function yT(e){return y.Discard(e,["~kind","if","then","else"])}function TT(e){return s.IsObjectNotArray(e)}function ET(e){return s.Keys(e).filter(n=>isNaN(n)).reduce((n,o)=>[...n,e[o]],[])}function _T(e){return s.IsString(e)||s.IsNumber(e)}function IT(e,t){let n=TT(e)?ET(e):e;return y.Create({"~kind":"Enum"},{enum:n},t)}function We(e){return w(e,"Enum")}function dt(e,t={}){return y.Create({"~kind":"Intersect"},{allOf:e},t)}function G(e){return w(e,"Intersect")}function ST(e){return y.Discard(e,["~kind","allOf"])}var eo={};Zt(eo,{Hash:()=>CG,HashCode:()=>PT});function he(){throw new Error("Unreachable")}function lG(e){let t=new Set,n=e;for(;n&&n!==Object.prototype;){for(let o of Reflect.ownKeys(n))o!=="constructor"&&typeof o!="symbol"&&t.add(o);n=Object.getPrototypeOf(n)}return[...t]}function mG(e){return typeof e=="number"}var bt;(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"})(bt||(bt={}));var Qo=BigInt("14695981039346656037"),[dG,fG]=[BigInt("1099511628211"),BigInt("18446744073709551616")],gG=Array.from({length:256}).map((e,t)=>BigInt(t)),xT=new Float64Array(1),RT=new DataView(xT.buffer),CT=new Uint8Array(xT.buffer);function ft(e){Qo=Qo^gG[e],Qo=Qo*dG%fG}function hG(e){ft(bt.Array);for(let t of e)dn(t)}function yG(e){ft(bt.BigInt),RT.setBigInt64(0,e);for(let t of CT)ft(t)}function OT(e){ft(bt.Boolean),ft(e?1:0)}function TG(e){ft(bt.Constructor),dn(e.toString())}function EG(e){ft(bt.Date),dn(e.getTime())}function _G(e){ft(bt.Function),dn(e.toString())}function IG(e){ft(bt.Null)}function AT(e){ft(bt.Number),RT.setFloat64(0,e,!0);for(let t of CT)ft(t)}function SG(e){ft(bt.Object);for(let t of lG(e).sort())dn(t),dn(e[t])}function bG(e){ft(bt.RegExp),mm(e.toString())}var OG=new TextEncoder;function mm(e){ft(bt.String);for(let t of OG.encode(e))ft(t)}function AG(e){ft(bt.Symbol),dn(e.toString())}function xG(e){ft(bt.TypeArray);let t=new Uint8Array(e.buffer);for(let n=0;n<t.length;n++)ft(t[n])}function RG(e){return ft(bt.Undefined)}function dn(e){return St.IsTypeArray(e)?xG(e):St.IsDate(e)?EG(e):St.IsRegExp(e)?bG(e):St.IsBoolean(e)?OT(e.valueOf()):St.IsString(e)?mm(e.valueOf()):St.IsNumber(e)?AT(e.valueOf()):mG(e)?AT(e):s.IsArray(e)?hG(e):s.IsBoolean(e)?OT(e):s.IsBigInt(e)?yG(e):s.IsConstructor(e)?TG(e):s.IsNull(e)?IG(e):s.IsObject(e)?SG(e):s.IsString(e)?mm(e):s.IsSymbol(e)?AG(e):s.IsUndefined(e)?RG(e):s.IsFunction(e)?_G(e):he()}function PT(e){return Qo=BigInt("14695981039346656037"),dn(e),Qo}function CG(e){return PT(e).toString(16).padStart(16,"0")}function UT(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"~refine":return e.params.message;default:return"an unknown validation error occurred"}}var PG=UT;function wT(){return PG}var Pa=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,o=to(n)?c=>this.decode(n["~codec"].decode(c)):this.decode,i=to(n)?c=>n["~codec"].encode(t(c)):t,a={decode:o,encode:i};return y.Update(this.type,{"~codec":a},{})}},Ua=class{constructor(t){this.type=t}Decode(t){return new Pa(this.type,t)}};function ep(e){return new Ua(e)}function NT(e,t){return ep(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function LT(e,t){return ep(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function to(e){return Le(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function kT(e){return Wo(e)}function ro(e){return Le(e)&&s.HasPropertyKey(e,"~immutable")}function Or(e,t={}){return N("AddReadonly",[e],t)}function no(e,t={}){return xa(e,t)}function MT(e){return no(e)}function oo(e){return Le(e)&&s.HasPropertyKey(e,"~readonly")}function wG(e,t){let n=tp(e)?[...e["~refine"],t]:[t];return y.Update(e,{"~refine":n},{})}function DT(...e){let[t,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,()=>"Refine Error"]});return wG(t,{check:n,error:o})}function vG(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function tp(e){return Le(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>vG(t))}var GT="-?(?:0|[1-9][0-9]*)n";function wa(e){return y.Create({"~kind":"BigInt"},{type:"bigint"},e)}function kt(e){return w(e,"BigInt")}function rp(e){return y.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Ot(e){return w(e,"Boolean")}function va(e){return y.Create({"~kind":"Identifier"},{name:e})}function $T(e){return w(e,"Identifier")}var np="-?(?:0|[1-9][0-9]*)";function io(e){return y.Create({"~kind":"Integer"},{type:"integer"},e)}function ct(e){return w(e,"Integer")}var dm=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function NG(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new dm(e)})()}function Y(e,t){return y.Create({"~kind":"Literal"},{type:NG(e),const:e},t)}function op(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function FT(e){return W(e)&&s.IsBigInt(e.const)}function jT(e){return W(e)&&s.IsBoolean(e.const)}function ip(e){return W(e)&&s.IsNumber(e.const)}function ap(e){return W(e)&&s.IsString(e.const)}function W(e){return w(e,"Literal")}function Zo(e){return y.Create({"~kind":"Null"},{type:"null"},e)}function Ar(e){return w(e,"Null")}var sp="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Mt(e){return y.Create({"~kind":"Number"},{type:"number"},e)}function we(e){return w(e,"Number")}function Xo(e){return y.Create({"~kind":"Symbol"},{type:"symbol"},e)}function xr(e){return w(e,"Symbol")}function ao(...e){let[t,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,a],1:i=>[i,et(),et()]});return y.Create({"~kind":"Parameter"},{name:t,extends:n,equals:o},{})}function qT(e){return w(e,"Parameter")}var cp=".*";function At(e){return y.Create({"~kind":"String"},{type:"string"},e)}function tt(e){return w(e,"String")}function q(e,t={}){return y.Create({"~kind":"Union"},{anyOf:e},t)}function C(e){return w(e,"Union")}function BT(e){return y.Discard(e,["~kind","anyOf"])}function Na(e){let t=HT(e);return s.IsEqual(t.length,2)?t[0]:[]}function LG(e){return!0}function KT(e){return s.ShiftLeft(e,(t,n)=>kG(t)?KT(n):!1,()=>!0)}function zT(e){return s.IsEqual(e.length,0)?!1:KT(e)}function kG(e){return C(e)?zT(e.anyOf):W(e)?LG(e.const):!1}function pp(e){return zT(e)}function up(e){return y.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function YT(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>YT(i,t,[...n,`${o}${t}`]),()=>n)}function MG(e,t){return s.IsEqual(e.length,0)?[`${t}`]:YT(e,t)}function VT(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>VT(e,i,[...n,...QT(e,o)]),()=>n)}function QT(e,t){return C(t)?VT(e,t.anyOf):W(t)?MG(e,t.const):he()}function WT(e,t){return s.ShiftLeft(t,(n,o)=>WT(QT(e,n),o),()=>e)}function DG(e){return e.map(t=>Y(t))}function GG(e){let t=WT([],e),n=DG(t);return q(n)}function $G(e){return s.IsEqual(e.length,0)?he():s.IsEqual(e.length,1)&&W(e[0])?e[0]:GG(e)}function fm(e){let t=Na(e);return s.IsEqual(t.length,0)?At():pp(t)?$G(t):up(e)}function La(e){let t=fm(e);return _e(t)?At():t}function Nt(e,t){let n="object",o={[e]:t};return y.Create({"~kind":"Record"},{type:n,patternProperties:o})}function ZT(e){return Nt(qt,e)}function XT(e){return D({true:e,false:e})}function Fe(e,t={}){let[n,o,i]=[e,e.length,!1];return y.Create({"~kind":"Tuple"},{type:"array",additionalItems:i,items:n,minItems:o},t)}function V(e){return w(e,"Tuple")}function JT(e){return y.Discard(e,["~kind","type","items","minItems","additionalItems"])}function FG(e){return y.Discard(e,["~readonly"])}function gm(e,t){return y.Update(FG(e),{},t)}function eE(e,t,n,o){let i=A(e,t,n);return gm(i,o)}function tE(e,t={}){return N("RemoveReadonly",[e],t)}function rE(e,t={}){return gm(e,t)}function jG(e){return y.Discard(e,["~optional"])}function hm(e,t){return y.Update(jG(e),{},t)}function nE(e,t,n,o){let i=A(e,t,n);return hm(i,o)}function oE(e,t={}){return N("RemoveOptional",[e],t)}function lp(e,t={}){return hm(e,t)}function ym(e){return e.reduceRight((n,o,i)=>({[i]:o,...n}),{})}function iE(e){let t=ym(e.items);return D(t)}function qG(e,t){return oo(e)?!!oo(t):!1}function BG(e,t){return nt(e)?!!nt(t):!1}function HG(e,t){let n=qG(e,t),o=BG(e,t),i=ke([e,t]),a=rE(lp(i));return n&&o?no(Xn(a)):n&&!o?no(a):!n&&o?Xn(a):a}function KG(e,t,n){return n in e?n in t?HG(e[n],t[n]):e[n]:n in t?t[n]:fe()}function zG(e,t){return[...new Set([...s.Keys(t),...s.Keys(e)])].reduce((o,i)=>({...o,[i]:KG(e,t,i)}),{})}function aE(e){return $(e)?e.properties:V(e)?ym(e.items):he()}function sE(e,t){let n=aE(e),o=aE(t),i=zG(n,o);return D(i)}function cE(e,t){let n=so(e,t);return s.IsEqual(n,Ma)?e:s.IsEqual(n,Da)||s.IsEqual(n,ka)?t:fe()}function pE(e){return $(e)||V(e)}function YG(e,t){let n=C(e),o=C(t);return n||o}function VG(e,t){let n=Xt(e),o=Xt(t),i=YG(n,o),a=pE(n),c=pE(o);return i?ke([n,o]):a&&c?sE(n,o):a&&!c?n:!a&&c?o:cE(n,o)}function uE(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>uE(e,i,[...n,VG(e,o)]),()=>s.IsEqual(n.length,0)?[e]:n)}function lE(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>lE(i,t,[...n,...Ga([o],t)]),()=>n)}function Ga(e,t=[]){return s.ShiftLeft(e,(n,o)=>C(n)?Ga(o,lE(n.anyOf,t)):Ga(o,uE(n,t)),()=>t)}function QG(e,t){let n=ht({},e,t);return F.IsExtendsTrueLike(n)?[]:[e]}function WG(e,t){return e.reduce((n,o)=>[...n,...QG(o,t)],[])}function mp(e,t){let n=Xt(e),o=C(n)?n.anyOf:[n],i=WG(o,t);return Dt(i)}function mr(e,t,n){let o=dt([e,t]),i=mp(n,e);return Dt([o,i])}function Lt(e){let t=e.map(n=>Y(n));return Dt(t)}function ke(e){let t=Ga(e),n=Tm(t);return Kr(n)}function _t(e){let t=La(e);return Xt(t)}function Dt(e){let t=Tm(e);return Kr(t)}function Xt(e){return $e(e)?mr(e.if,e.then,e.else):We(e)?Lt(e.enum):G(e)?ke(e.allOf):_e(e)?_t(e.pattern):C(e)?Dt(e.anyOf):e}function Kr(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?fe():q(e)}function mE(e,t){let n=Lt(e);return fn(n,t)}function dE(e,t){return Nt(gn,t)}function fE(e,t){let n=ke(e);return fn(n,t)}function gE(e,t){return s.IsString(e)||s.IsNumber(e)?D({[e]:t}):s.IsEqual(e,!1)?D({false:t}):s.IsEqual(e,!0)?D({true:t}):D({})}function hE(e,t){return Nt(Jo,t)}function yE(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?Nt(e.pattern.toString(),t):Nt(qt,t)}function TE(e,t){let n=Na(e);return pp(n)?fn(_t(e),t):Nt(e,t)}function ZG(e){return C(e)?ei(e.anyOf):[e]}function ei(e){return e.reduce((t,n)=>[...t,...ZG(n)],[])}function XG(e){return e.some(t=>tt(t)||we(t)||ct(t))}function JG(e,t){return s.IsEqual(XG(e),!0)?Nt(qt,t):void 0}function e$(e,t){return e.reduce((n,o)=>W(o)&&(s.IsString(o.const)||s.IsNumber(o.const))?{...n,[o.const]:t}:n,{})}function t$(e,t){let n=e$(e,t);return D(n)}function EE(e,t){let n=ei(e),o=JG(n,t);return Le(o)?o:t$(n,t)}function fn(e,t){return Je(e)?ZT(t):Ot(e)?XT(t):We(e)?mE(e.enum,t):ct(e)?dE(e,t):G(e)?fE(e.allOf,t):W(e)?gE(e.const,t):we(e)?hE(e,t):C(e)?EE(e.anyOf,t):tt(e)?yE(e,t):_e(e)?TE(e.pattern,t):D({})}function Em(e,t,n){return K([e])?y.Update(fn(e,t),{},n):dp(e,t,n)}function _E(e,t,n,o,i){let a=A(e,t,n),c=A(e,t,o);return Em(a,c,i)}var gn=`^${np}$`,Jo=`^${sp}$`,qt=`^${cp}$`;function dp(e,t,n={}){return N("Record",[e,t],n)}function ti(e,t,n={}){return Em(e,t,n)}function fp(e,t){return Nt(e,t)}function gp(e){return s.IsEqual(e,qt)?At():s.IsEqual(e,gn)?io():s.IsEqual(e,Jo)?Mt():fm(e)}function pt(e){return s.Keys(e.patternProperties)[0]}function hn(e){let t=pt(e);return gp(t)}function xe(e){return e.patternProperties[pt(e)]}function ge(e){return w(e,"Record")}function co(e){return y.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function yn(e){return w(e,"Rest")}function hp(e){return y.Create({"~kind":"This"},{$ref:"#"},e)}function yp(e){return w(e,"This")}function ri(e){return y.Create({"~kind":"Undefined"},{type:"undefined"},e)}function dr(e){return w(e,"Undefined")}function Tp(e){return y.Create({"~kind":"Void"},{type:"void"},e)}function Gt(e){return w(e,"Void")}function n$(e,t){return s.IsEqual(e,"Array")?vt(t[0]):s.IsEqual(e,"Capitalize")?_p(t[0]):s.IsEqual(e,"ConstructorParameters")?Ap(t[0]):s.IsEqual(e,"Evaluate")?II(t[0]):s.IsEqual(e,"Exclude")?xp(t[0],t[1]):s.IsEqual(e,"Extract")?Rp(t[0],t[1]):s.IsEqual(e,"Index")?qa(t[0],t[1]):s.IsEqual(e,"InstanceType")?Cp(t[0]):s.IsEqual(e,"Lowercase")?Ip(t[0]):s.IsEqual(e,"NonNullable")?Pp(t[0]):s.IsEqual(e,"Omit")?Up(t[0],t[1]):s.IsEqual(e,"Parameters")?wp(t[0]):s.IsEqual(e,"Partial")?vp(t[0]):s.IsEqual(e,"Pick")?Np(t[0],t[1]):s.IsEqual(e,"Readonly")?Lp(t[0]):s.IsEqual(e,"KeyOf")?Ba(t[0]):s.IsEqual(e,"Record")?dp(t[0],t[1]):s.IsEqual(e,"Required")?kp(t[0]):s.IsEqual(e,"ReturnType")?Mp(t[0]):s.IsEqual(e,"Uncapitalize")?Sp(t[0]):s.IsEqual(e,"Uppercase")?bp(t[0]):ja(st(e),t)}function po(){throw Error("Unreachable")}function AE(e,t=[]){return s.ShiftLeft(e,(n,o)=>AE(o,[...t,n[1]]),()=>t)}function zr(e){return s.IsEqual(e.length,3)?[e[0],...AE(e[1])]:[]}function xE(e){return ao(e[0],e[2],e[4])}function RE(e){return ao(e[0],e[2],e[2])}function CE(e){return ao(e[0],et(),e[2])}function PE(e){return ao(e,et(),et())}function UE(e){return zr(e)}function wE(e){return e[1]}function vE(e){return zr(e)}function NE(e){return e[1]}function LE(e){return n$(e[0],e[1])}function kE(e){return null}function ME(e){return At()}function DE(e){return Mt()}function GE(e){return rp()}function $E(e){return ri()}function FE(e){return Zo()}function jE(e){return io()}function qE(e){return wa()}function BE(e){return et()}function HE(e){return Vo()}function KE(e){return D({})}function zE(e){return fe()}function YE(e){return Xo()}function VE(e){return Tp()}function QE(e){return hp()}function WE(e){return Y(BigInt(e))}function ZE(e){return Y(s.IsEqual(e,"true"))}function XE(e){return Y(parseFloat(e))}function JE(e){return Y(e)}function e_(e){return e[1]}function t_(e){return Y(e)}function r_(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function n_(e){return e[1]}function o_(e){return Ep(e)}function i_(e){return s.IsEqual(e.length,6)?Jn(e[1],e[3],e[5]):Jn(e[1],e[3],et())}function a_(e){return e.length>0}function s_(e){return e.reduce((t,n)=>s.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function c_(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function p_(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function u_(e){return s.IsEqual(e.length,2)?e[1]:[]}function IE(e,t){return t.reduce((n,o)=>{let i=o;return s.IsEqual(i.length,1)?qa(n,i[0]):s.IsEqual(i.length,0)?vt(n):po()},e)}function SE(e,t){return s.IsEqual(t.length,3)?Op(e,t[0],t[1],t[2]):e}function o$(e,t){return s.IsArray(t)&&s.IsEqual(t.length,0)?e:Dp(e,t)}function l_(e){let[t,n,o,i,a]=e;return o$(SE(t?Ba(IE(n,o)):IE(n,o),i),a)}function _m(e,t){return s.IsEqual(t.length,3)?(()=>{let[n,o,i]=t,a=_m(o,i);if(s.IsEqual(n,"&"))return G(a)?dt([e,...a.allOf]):dt([e,a]);if(s.IsEqual(n,"|"))return C(a)?q([e,...a.anyOf]):q([e,a]);po()})():e}function m_(e){let[t,n]=e;return _m(t,n)}function d_(e){let[t,n]=e;return _m(t,n)}function f_(e){return _I(e[1])}function g_(e){return e[1]}function h_(e){return mn(e[0],e[2])}function y_(e){return s.IsEqual(e.length,4)?Ca(e[1],e[3]):s.IsEqual(e.length,2)?Ca(e[1],et()):po()}function T_(e){return`${e}`}function E_(e){return ct(e[3])?gn:we(e[3])?Jo:xr(e[3])?qt:tt(e[3])?qt:po()}function __(e){return e.length>0}function I_(e){return e.length>0}function S_(e){let[t,n,o,i,a]=e;return{[n]:t&&o?Or(Sr(a)):t&&!o?Or(a):!t&&o?Sr(a):a}}function b_(e){return zr(e)}function O_(e){return e.reduce((t,n)=>s.HasPropertyKey(n,gn)||s.HasPropertyKey(n,Jo)||s.HasPropertyKey(n,qt)?[t[0],y.Assign(t[1],n)]:[y.Assign(t[0],n),t[1]],[{},{}])}function A_(e){return O_(e[1])}function x_(e){let[t,n]=e,o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return D(t,o)}function R_(e){return s.IsEqual(e.length,5)?Or(Sr(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?Or(e[3]):Sr(e[3]):po()}function C_(e){if(!s.IsArray(e)||!s.IsEqual(e.length,3))return e;let[t,n,o]=e;return t&&o?Or(Sr(n)):t&&!o?Or(n):!t&&o?Sr(n):n}function P_(e){return s.IsEqual(e.length,2)?co(e[1]):s.IsEqual(e.length,1)?e[0]:po()}function U_(e){return zr(e)}function w_(e){return Fe(e[1])}function v_(e){return Or(Sr(e[4]))}function N_(e){return Or(e[3])}function L_(e){return Sr(e[3])}function k_(e){return e[2]}function M_(e){return s.IsEqual(e.length,2)?co(e[1]):s.IsEqual(e.length,1)?e[0]:po()}function D_(e){return zr(e)}function G_(e){return Ir(e[1],e[4])}function $_(e){return _r(e[2],e[5])}function bE(e,t){return s.IsEqual(e,"remove")?tE(t):s.IsEqual(e,"add")?Or(t):t}function F_(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 OE(e,t){return s.IsEqual(e,"remove")?oE(t):s.IsEqual(e,"add")?Sr(t):t}function j_(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 q_(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function B_(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?$a(va(e[3]),e[5],e[6][0],bE(e[1],OE(e[8],e[10]))):$a(va(e[3]),e[5],st(e[3]),bE(e[1],OE(e[8],e[10])))}function H_(e){return st(e)}function K_(e){return BigInt(e)}function z_(e){return parseFloat(e)}function Y_(e){return s.IsEqual(e,"true")}function V_(e){return null}function Q_(e){return{[e[0]]:e[2]}}function W_(e){return zr(e)}function i$(e){return e.reduce((t,n)=>y.Assign(t,n),{})}function Z_(e){return i$(e[1])}function X_(e){return zr(e)}function J_(e){return e[1]}function eI(e){return wa()}function tI(e){return At()}function rI(e){return Mt()}function nI(e){return io()}function oI(e){return fe()}function iI(e){return Y(e)}function aI(e){return q(e[1])}function sI(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function cI(e){return[e[0],...e[1]]}function pI(e){return e[1]}function uI(e){return zr(e)}function lI(e){return s.IsEqual(e.length,2)?e[1]:[]}function mI(e){let t=e[2],n=e[3],[o,i]=e[4],a=s.IsEqual(s.Keys(i).length,0)?{}:{patternProperties:i};return{[e[1]]:mn(t,Fa(n,o,a))}}function dI(e){let t=e[2],[n,o]=e[3],i=s.IsEqual(s.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:Fa(t,n,i)}}function fI(e){return{[e[1]]:mn(e[2],e[4])}}function gI(e){return{[e[1]]:e[3]}}function hI(e){return null}function yI(e){return zr(e)}function TI(e){return e[1]}function EI(e){let[t,n]=[e[0],e[1]];return SI(y.Assign(t,O_(n)[0]))}function Ha(e){return te(e.length,2)}function Z(e,t,n){return Ha(e)?t(e[0],e[1]):n()}function c$(e,t){return te(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function Me(e,t){for(let n=0;n<e.length;n++){let o=c$(e[n],t);if(Ha(o))return o}return[]}function Im(e,t){return Array.from({length:t-e+1},(n,o)=>String.fromCharCode(e+o))}var bI=[...Im(97,122),...Im(65,90)],Sm="0",bm=Im(49,57),ni=[Sm,...bm],OI=" ",oi=`
28
- `;var Tn="_",Gp=".",AI="$",$p="-";var xI="//",RI="/*",u$="*/";function CI(e){let t=e.indexOf(u$);return te(t,-1)?"":e.slice(t+2)}function PI(e){let t=e.indexOf(oi);return te(t,-1)?"":e.slice(t)}function l$(e){return e.replace(/^[ \t\r\f\v]+/,"")}function Fp(e){let t=l$(e);return t.startsWith(RI)?Fp(CI(t.slice(2))):t.startsWith(xI)?Fp(PI(t.slice(2))):t}function gt(e){let t=e.trimStart();return t.startsWith(RI)?gt(CI(t.slice(2))):t.startsWith(xI)?gt(PI(t.slice(2))):t}function jp(e,t){return Z(Me([e],t),(n,o)=>[n,o],()=>["",t])}function m$(e,t){return e.includes(t)}function ii(e,t,n,o=""){return Z(Me(e,n),(i,a)=>m$(t,i)?ii(e,t,a,o):ii(e,t,a,`${o}${i}`),()=>[o,n])}function d$(e){return Me(bm,e)}var f$=[...ni,Tn];function g$(e){return ii(f$,[Tn],e)}function h$(e){return Z(Me([Sm],e),(t,n)=>[t,n],()=>Z(d$(e),(t,n)=>Z(g$(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[]))}function qp(e){return h$(gt(e))}function y$(e){return jp($p,e)}function T$(e){return Z(y$(e),(t,n)=>Z(qp(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[])}function UI(e){return T$(gt(e))}function E$(e){return Z(UI(e),(t,n)=>Z(Me(["n"],n),(o,i)=>[`${t}`,i],()=>[]),()=>[])}function Om(e){return E$(e)}function Am(e,t){return Me([e],t)}function _(e,t){return te(e,"")?["",t]:e.startsWith(oi)?Am(e,Fp(t)):e.startsWith(OI)?Am(e,t):Am(e,gt(t))}var wI=[...bI,Tn,AI];function _$(e){return Me(wI,e)}var I$=[...wI,...ni];function vI(e,t=""){return Z(Me(I$,e),(n,o)=>vI(o,`${t}${n}`),()=>[t,e])}function S$(e){return Z(_$(e),(t,n)=>Z(vI(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[])}function je(e){return S$(gt(e))}var b$=[...ni,Tn];function O$(e){return Ha(Me([Gp],e))}function NI(e){return Z(ii(b$,[Tn],e),(t,n)=>te(t,"")?[]:[t,n],()=>[])}function A$(e){return Z(Me([Gp],e),(t,n)=>Z(NI(n),(o,i)=>[`0${t}${o}`,i],()=>[]),()=>[])}function x$(e){return Z(qp(e),(t,n)=>Z(Me([Gp],n),(o,i)=>Z(NI(i),(a,c)=>[`${t}${o}${a}`,c],()=>[`${t}`,i]),()=>[`${t}`,n]),()=>[])}function R$(e){return O$(e)?A$(e):x$(e)}function LI(e){return R$(gt(e))}function C$(e){return jp($p,e)}function P$(e){return Z(C$(e),(t,n)=>Z(LI(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[])}function Bp(e){return P$(gt(e))}function U$(e){return te(e,"")?[]:[e.slice(0,1),e.slice(1)]}function kI(e,t){return Qc(e,(n,o)=>t.startsWith(n)?!0:kI(o,t),()=>!1)}function En(e,t,n=""){return Z(U$(t),(o,i)=>kI(e,t)?[n,t]:En(e,i,`${n}${o}`),()=>[])}function w$(e,t,n){return Z(Me([e],n),(o,i)=>Z(En([t],i),(a,c)=>Z(Me([t],c),(l,m)=>[`${a}`,m],()=>[]),()=>[]),()=>[])}function v$(e,t,n){return Z(Me([e],n),(o,i)=>Z(En([oi,t],i),(a,c)=>Z(Me([t],c),(l,m)=>[`${a}`,m],()=>[]),()=>[]),()=>[])}function MI(e,t,n,o){return n?w$(e,t,gt(o)):v$(e,t,gt(o))}function N$(e,t){return Me(e,t)}function L$(e,t){return MI(e,e,!1,t)}function k$(e,t){return Z(N$(e,t),(n,o)=>L$(n,`${n}${o}`),()=>[])}function Hp(e,t){return k$(e,gt(t))}function DI(e,t){return Z(En(e,t),(n,o)=>te(n,"")?[]:[n,o],()=>[])}var u=(e,t,n=()=>[])=>e.length===2?t(e):n(),D$=e=>u(u(je(e),([t,n])=>u(_("extends",n),([o,i])=>u(re(i),([a,c])=>u(_("=",c),([l,m])=>u(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[xE(t),n]),G$=e=>u(u(je(e),([t,n])=>u(_("extends",n),([o,i])=>u(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[RE(t),n]),$$=e=>u(u(je(e),([t,n])=>u(_("=",n),([o,i])=>u(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[CE(t),n]),F$=e=>u(je(e),([t,n])=>[PE(t),n]),FI=e=>u(u(D$(e),([t,n])=>[t,n],()=>u(G$(e),([t,n])=>[t,n],()=>u($$(e),([t,n])=>[t,n],()=>u(F$(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),jI=(e,t=[])=>u(u(_(",",e),([n,o])=>u(FI(o),([i,a])=>[[n,i],a])),([n,o])=>jI(o,[...t,n]),()=>[t,e]),j$=e=>u(u(u(FI(e),([t,n])=>u(jI(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[UE(t),n]),Cm=e=>u(u(_("<",e),([t,n])=>u(j$(n),([o,i])=>u(_(">",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[wE(t),n]),qI=(e,t=[])=>u(u(_(",",e),([n,o])=>u(re(o),([i,a])=>[[n,i],a])),([n,o])=>qI(o,[...t,n]),()=>[t,e]),q$=e=>u(u(u(re(e),([t,n])=>u(qI(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[vE(t),n]),B$=e=>u(u(_("<",e),([t,n])=>u(q$(n),([o,i])=>u(_(">",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[NE(t),n]),H$=e=>u(u(je(e),([t,n])=>u(B$(n),([o,i])=>[[t,o],i])),([t,n])=>[LE(t),n]),BI=e=>u(u(u(_(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[kE(t),n]),HI=e=>u(_("string",e),([t,n])=>[ME(t),n]),KI=e=>u(_("number",e),([t,n])=>[DE(t),n]),K$=e=>u(_("boolean",e),([t,n])=>[GE(t),n]),z$=e=>u(_("undefined",e),([t,n])=>[$E(t),n]),Y$=e=>u(_("null",e),([t,n])=>[FE(t),n]),zI=e=>u(_("integer",e),([t,n])=>[jE(t),n]),V$=e=>u(_("bigint",e),([t,n])=>[qE(t),n]),Q$=e=>u(_("unknown",e),([t,n])=>[BE(t),n]),W$=e=>u(_("any",e),([t,n])=>[HE(t),n]),Z$=e=>u(_("object",e),([t,n])=>[KE(t),n]),X$=e=>u(_("never",e),([t,n])=>[zE(t),n]),YI=e=>u(_("symbol",e),([t,n])=>[YE(t),n]),J$=e=>u(_("void",e),([t,n])=>[VE(t),n]),e1=e=>u(_("this",e),([t,n])=>[QE(t),n]),t1=e=>u(u(_("${",e),([t,n])=>u(re(n),([o,i])=>u(_("}",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[e_(t),n]),xm=e=>u(En(["${","`"],e),([t,n])=>[t_(t),n]),VI=e=>u(u(u(xm(e),([t,n])=>u(t1(n),([o,i])=>u(VI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u(u(xm(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u(u(xm(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[r_(t),n]),Pm=e=>u(u(_("`",e),([t,n])=>u(VI(n),([o,i])=>u(_("`",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[n_(t),n]),r1=e=>u(Pm(e),([t,n])=>[o_(t),n]),n1=e=>u(u(u(_("if",e),([t,n])=>u(re(n),([o,i])=>u(_("then",i),([a,c])=>u(re(c),([l,m])=>u(_("else",m),([f,h])=>u(re(h),([E,I])=>[[t,o,a,l,f,E],I])))))),([t,n])=>[t,n],()=>u(u(_("if",e),([t,n])=>u(re(n),([o,i])=>u(_("then",i),([a,c])=>u(re(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[t,n],()=>[])),([t,n])=>[i_(t),n]),o1=e=>u(Om(e),([t,n])=>[WE(t),n]),i1=e=>u(u(_("true",e),([t,n])=>[t,n],()=>u(_("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[ZE(t),n]),a1=e=>u(Bp(e),([t,n])=>[XE(t),n]),s1=e=>u(Hp(["'",'"'],e),([t,n])=>[JE(t),n]),c1=e=>u(u(u(_("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[a_(t),n]),QI=(e,t=[])=>u(u(u(_("[",e),([n,o])=>u(re(o),([i,a])=>u(_("]",a),([c,l])=>[[n,i,c],l]))),([n,o])=>[n,o],()=>u(u(_("[",e),([n,o])=>u(_("]",o),([i,a])=>[[n,i],a])),([n,o])=>[n,o],()=>[])),([n,o])=>QI(o,[...t,n]),()=>[t,e]),p1=e=>u(QI(e),([t,n])=>[s_(t),n]),u1=e=>u(u(u(_("extends",e),([t,n])=>u(re(n),([o,i])=>u(_("?",i),([a,c])=>u(re(c),([l,m])=>u(_(":",m),([f,h])=>u(re(h),([E,I])=>[[t,o,a,l,f,E],I])))))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[c_(t),n]),l1=e=>u(u(u(_("(",e),([t,n])=>u(re(n),([o,i])=>u(_(")",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u(HI(e),([t,n])=>[t,n],()=>u(KI(e),([t,n])=>[t,n],()=>u(K$(e),([t,n])=>[t,n],()=>u(z$(e),([t,n])=>[t,n],()=>u(Y$(e),([t,n])=>[t,n],()=>u(zI(e),([t,n])=>[t,n],()=>u(V$(e),([t,n])=>[t,n],()=>u(Q$(e),([t,n])=>[t,n],()=>u(W$(e),([t,n])=>[t,n],()=>u(Z$(e),([t,n])=>[t,n],()=>u(X$(e),([t,n])=>[t,n],()=>u(YI(e),([t,n])=>[t,n],()=>u(J$(e),([t,n])=>[t,n],()=>u(e1(e),([t,n])=>[t,n],()=>u(o1(e),([t,n])=>[t,n],()=>u(i1(e),([t,n])=>[t,n],()=>u(a1(e),([t,n])=>[t,n],()=>u(s1(e),([t,n])=>[t,n],()=>u(r1(e),([t,n])=>[t,n],()=>u(n1(e),([t,n])=>[t,n],()=>u(S1(e),([t,n])=>[t,n],()=>u(A1(e),([t,n])=>[t,n],()=>u(w1(e),([t,n])=>[t,n],()=>u(U1(e),([t,n])=>[t,n],()=>u(k1(e),([t,n])=>[t,n],()=>u(H$(e),([t,n])=>[t,n],()=>u(M1(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[p_(t),n]),m1=e=>u(u(u(_("with",e),([t,n])=>u(mS(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[u_(t),n]),WI=e=>u(u(c1(e),([t,n])=>u(l1(n),([o,i])=>u(p1(i),([a,c])=>u(u1(c),([l,m])=>u(m1(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[l_(t),n]),ZI=e=>u(u(u(_("&",e),([t,n])=>u(WI(n),([o,i])=>u(ZI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),XI=e=>u(u(WI(e),([t,n])=>u(ZI(n),([o,i])=>[[t,o],i])),([t,n])=>[m_(t),n]),JI=e=>u(u(u(_("|",e),([t,n])=>u(XI(n),([o,i])=>u(JI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Kp=e=>u(u(XI(e),([t,n])=>u(JI(n),([o,i])=>[[t,o],i])),([t,n])=>[d_(t),n]),d1=e=>u(u(_("readonly",e),([t,n])=>u(Kp(n),([o,i])=>[[t,o],i])),([t,n])=>[f_(t),n]),f1=e=>u(u(_("|",e),([t,n])=>u(Kp(n),([o,i])=>[[t,o],i])),([t,n])=>[g_(t),n]),g1=e=>u(u(Cm(e),([t,n])=>u(_("=",n),([o,i])=>u(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[h_(t),n]),h1=e=>u(u(u(_("infer",e),([t,n])=>u(je(n),([o,i])=>u(_("extends",i),([a,c])=>u(Kp(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[t,n],()=>u(u(_("infer",e),([t,n])=>u(je(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>[])),([t,n])=>[y_(t),n]),re=e=>u(u(h1(e),([t,n])=>[t,n],()=>u(f1(e),([t,n])=>[t,n],()=>u(d1(e),([t,n])=>[t,n],()=>u(Kp(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),y1=e=>u(Bp(e),([t,n])=>[T_(t),n]),T1=e=>u(je(e),([t,n])=>[t,n]),E1=e=>u(Hp(["'",'"'],e),([t,n])=>[t,n]),_1=e=>u(u(_("[",e),([t,n])=>u(je(n),([o,i])=>u(_(":",i),([a,c])=>u(u(zI(c),([l,m])=>[l,m],()=>u(KI(c),([l,m])=>[l,m],()=>u(HI(c),([l,m])=>[l,m],()=>u(YI(c),([l,m])=>[l,m],()=>[])))),([l,m])=>u(_("]",m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[E_(t),n]),eS=e=>u(u(y1(e),([t,n])=>[t,n],()=>u(T1(e),([t,n])=>[t,n],()=>u(E1(e),([t,n])=>[t,n],()=>u(_1(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),tS=e=>u(u(u(_("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[__(t),n]),rS=e=>u(u(u(_("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[I_(t),n]),nS=e=>u(u(tS(e),([t,n])=>u(eS(n),([o,i])=>u(rS(i),([a,c])=>u(_(":",c),([l,m])=>u(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[S_(t),n]),zp=e=>u(u(u(_(",",e),([t,n])=>u(_(`
27
+ `)}),this}_outputHelpIfRequested(t){let n=this._getHelpOption();n&&t.find(i=>n.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function dy(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let n,o="127.0.0.1",i="9229",a;return(a=t.match(/^(--inspect(-brk)?)$/))!==null?n=a[1]:(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(n=a[1],/^\d+$/.test(a[3])?i=a[3]:o=a[3]):(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(n=a[1],o=a[3],i=a[4]),n&&i!=="0"?`${n}=${o}:${parseInt(i)+1}`:t})}function fy(){if(de.default.env.NO_COLOR||de.default.env.FORCE_COLOR==="0"||de.default.env.FORCE_COLOR==="false")return!1;if(de.default.env.FORCE_COLOR||de.default.env.CLICOLOR_FORCE!==void 0)return!0}var J8=new jo;function Ze(e){throw new Error(`assertUnreachable: ${JSON.stringify(e,null,2)}`)}var y0=Math.pow(10,8)*24*60*60*1e3,rW=-y0;var yy=864e5,Ty=6e4,Ey=36e5;var T0=3600;var _y=T0*24,nW=_y*7,E0=_y*365.2425,_0=E0/12,oW=_0*3,nm=Symbol.for("constructDateFrom");function ur(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&nm in e?e[nm](t):e instanceof Date?new e.constructor(t):new Date(t)}function Xe(e,t){return ur(t||e,e)}function Iy(e,t,n){let o=Xe(e,n?.in);return isNaN(t)?ur(n?.in||e,NaN):(t&&o.setDate(o.getDate()+t),o)}function Sy(e,t,n){let o=Xe(e,n?.in);if(isNaN(t))return ur(n?.in||e,NaN);if(!t)return o;let i=o.getDate(),a=ur(n?.in||e,o.getTime());a.setMonth(o.getMonth()+t+1,0);let c=a.getDate();return i>=c?a:(o.setFullYear(a.getFullYear(),a.getMonth(),i),o)}function qo(e,t,n){let{years:o=0,months:i=0,weeks:a=0,days:c=0,hours:l=0,minutes:m=0,seconds:f=0}=t,h=Xe(e,n?.in),E=i||o?Sy(h,i+o*12):h,I=c||a?Iy(E,c+a*7):E,g=m+l*60,O=(f+g*60)*1e3;return ur(n?.in||e,+I+O)}var I0={};function by(){return I0}function om(e){let t=Xe(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function It(e,...t){let n=ur.bind(null,e||t.find(o=>typeof o=="object"));return t.map(n)}function im(e,t){let n=Xe(e,t?.in);return n.setHours(0,0,0,0),n}function Oy(e,t,n){let[o,i]=It(n?.in,e,t),a=im(o),c=im(i),l=+a-om(a),m=+c-om(c);return Math.round((l-m)/yy)}function Vn(e,t){let n=+Xe(e)-+Xe(t);return n<0?-1:n>0?1:n}function Ay(e,t,n){let[o,i]=It(n?.in,e,t),a=o.getFullYear()-i.getFullYear(),c=o.getMonth()-i.getMonth();return a*12+c}function xy(e,t,n){let[o,i]=It(n?.in,e,t);return o.getFullYear()-i.getFullYear()}function Cy(e,t,n){let[o,i]=It(n?.in,e,t),a=Ry(o,i),c=Math.abs(Oy(o,i));o.setDate(o.getDate()-a*c);let l=+(Ry(o,i)===-a),m=a*(c-l);return m===0?0:m}function Ry(e,t){let n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function Bo(e){return t=>{let o=(e?Math[e]:Math.trunc)(t);return o===0?0:o}}function Py(e,t,n){let[o,i]=It(n?.in,e,t),a=(+o-+i)/Ey;return Bo(n?.roundingMethod)(a)}function jc(e,t){return+Xe(e)-+Xe(t)}function Uy(e,t,n){let o=jc(e,t)/Ty;return Bo(n?.roundingMethod)(o)}function wy(e,t){let n=Xe(e,t?.in);return n.setHours(23,59,59,999),n}function vy(e,t){let n=Xe(e,t?.in),o=n.getMonth();return n.setFullYear(n.getFullYear(),o+1,0),n.setHours(23,59,59,999),n}function Ny(e,t){let n=Xe(e,t?.in);return+wy(n,t)==+vy(n,t)}function Ly(e,t,n){let[o,i,a]=It(n?.in,e,e,t),c=Vn(i,a),l=Math.abs(Ay(i,a));if(l<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-c*l);let m=Vn(i,a)===-c;Ny(o)&&l===1&&Vn(o,a)===1&&(m=!1);let f=c*(l-+m);return f===0?0:f}function ky(e,t,n){let o=jc(e,t)/1e3;return Bo(n?.roundingMethod)(o)}function My(e,t,n){let[o,i]=It(n?.in,e,t),a=Vn(o,i),c=Math.abs(xy(o,i));o.setFullYear(1584),i.setFullYear(1584);let l=Vn(o,i)===-a,m=a*(c-+l);return m===0?0:m}function Dy(e,t){let[n,o]=It(e,t.start,t.end);return{start:n,end:o}}var S0={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Gy=(e,t,n)=>{let o,i=S0[e];return typeof i=="string"?o=i:t===1?o=i.one:o=i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+o:o+" ago":o};function qc(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var b0={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},O0={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},A0={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$y={date:qc({formats:b0,defaultWidth:"full"}),time:qc({formats:O0,defaultWidth:"full"}),dateTime:qc({formats:A0,defaultWidth:"full"})};var x0={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Fy=(e,t,n,o)=>x0[e];function Ho(e){return(t,n)=>{let o=n?.context?String(n.context):"standalone",i;if(o==="formatting"&&e.formattingValues){let c=e.defaultFormattingWidth||e.defaultWidth,l=n?.width?String(n.width):c;i=e.formattingValues[l]||e.formattingValues[c]}else{let c=e.defaultWidth,l=n?.width?String(n.width):e.defaultWidth;i=e.values[l]||e.values[c]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var R0={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},C0={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},P0={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},U0={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},w0={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},v0={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},N0=(e,t)=>{let n=Number(e),o=n%100;if(o>20||o<10)switch(o%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},jy={ordinalNumber:N0,era:Ho({values:R0,defaultWidth:"wide"}),quarter:Ho({values:C0,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Ho({values:P0,defaultWidth:"wide"}),day:Ho({values:U0,defaultWidth:"wide"}),dayPeriod:Ho({values:w0,defaultWidth:"wide",formattingValues:v0,defaultFormattingWidth:"wide"})};function Ko(e){return(t,n={})=>{let o=n.width,i=o&&e.matchPatterns[o]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let c=a[0],l=o&&e.parsePatterns[o]||e.parsePatterns[e.defaultParseWidth],m=Array.isArray(l)?k0(l,E=>E.test(c)):L0(l,E=>E.test(c)),f;f=e.valueCallback?e.valueCallback(m):m,f=n.valueCallback?n.valueCallback(f):f;let h=t.slice(c.length);return{value:f,rest:h}}}function L0(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function k0(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function qy(e){return(t,n={})=>{let o=t.match(e.matchPattern);if(!o)return null;let i=o[0],a=t.match(e.parsePattern);if(!a)return null;let c=e.valueCallback?e.valueCallback(a[0]):a[0];c=n.valueCallback?n.valueCallback(c):c;let l=t.slice(i.length);return{value:c,rest:l}}}var M0=/^(\d+)(th|st|nd|rd)?/i,D0=/\d+/i,G0={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},$0={any:[/^b/i,/^(a|c)/i]},F0={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},j0={any:[/1/i,/2/i,/3/i,/4/i]},q0={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},B0={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},H0={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},K0={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},z0={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Y0={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},By={ordinalNumber:qy({matchPattern:M0,parsePattern:D0,valueCallback:e=>parseInt(e,10)}),era:Ko({matchPatterns:G0,defaultMatchWidth:"wide",parsePatterns:$0,defaultParseWidth:"any"}),quarter:Ko({matchPatterns:F0,defaultMatchWidth:"wide",parsePatterns:j0,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ko({matchPatterns:q0,defaultMatchWidth:"wide",parsePatterns:B0,defaultParseWidth:"any"}),day:Ko({matchPatterns:H0,defaultMatchWidth:"wide",parsePatterns:K0,defaultParseWidth:"any"}),dayPeriod:Ko({matchPatterns:z0,defaultMatchWidth:"any",parsePatterns:Y0,defaultParseWidth:"any"})};var am={code:"en-US",formatDistance:Gy,formatLong:$y,formatRelative:Fy,localize:jy,match:By,options:{weekStartsOn:0,firstWeekContainsDate:1}};var V0=["years","months","weeks","days","hours","minutes","seconds"];function Hy(e,t){let n=by(),o=t?.locale??n.locale??am,i=t?.format??V0,a=t?.zero??!1,c=t?.delimiter??" ";return o.formatDistance?i.reduce((m,f)=>{let h=`x${f.replace(/(^.)/,I=>I.toUpperCase())}`,E=e[f];return E!==void 0&&(a||e[f])?m.concat(o.formatDistance(h,E)):m},[]).join(c):""}function Ky(e,t){let{start:n,end:o}=Dy(t?.in,e),i={},a=My(o,n);a&&(i.years=a);let c=qo(n,{years:i.years}),l=Ly(o,c);l&&(i.months=l);let m=qo(c,{months:i.months}),f=Cy(o,m);f&&(i.days=f);let h=qo(m,{days:i.days}),E=Py(o,h);E&&(i.hours=E);let I=qo(h,{hours:i.hours}),g=Uy(o,I);g&&(i.minutes=g);let T=qo(I,{minutes:i.minutes}),O=ky(o,T);return O&&(i.seconds=O),i}var tZ=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 lZ=60*1e3;var YZ=1/1e6,cm=1e3,Oa=60*cm,eD=60*Oa,Hc=24*eD,VZ=7*Hc,QZ=30*Hc;var pm=["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-15-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 tD={s:1,m:60,h:3600,d:86400};function Yy(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<48||n>57)return!1}return!0}function Vy(){return Math.floor(Date.now()/1e3)}function zo(e){if(typeof e=="number")return e;if(e==="now")return Vy();if(e.startsWith("-")&&e.length>=3){let n=e.at(-1),o=n?tD[n]:void 0;if(o){let i=e.slice(1,-1);if(i.length>0&&Yy(i))return Vy()-parseInt(i,10)*o}}if(Yy(e)&&e.length>0)return parseInt(e,10);let t=Date.parse(e);if(!Number.isNaN(t))return Math.floor(t/1e3);throw new Error(`Invalid time value: ${e}. Use unix seconds, relative (-30m, -1h), 'now', or ISO 8601.`)}var y={};Zt(y,{Assign:()=>rD,Clone:()=>Zn,Create:()=>pG,Discard:()=>uG,Metrics:()=>lr,Update:()=>lG});var lr={assign:0,create:0,clone:0,discard:0,update:0};function rD(e,t){return lr.assign+=1,{...e,...t}}var s={};Zt(s,{Counted:()=>SD,Entries:()=>AD,EntriesRegExp:()=>OD,Every:()=>TD,EveryAll:()=>ED,GraphemeCount:()=>gD,HasPropertyKey:()=>bD,IsArray:()=>xa,IsBigInt:()=>Aa,IsBoolean:()=>nT,IsClassInstance:()=>fD,IsConstructor:()=>cD,IsDeepEqual:()=>dm,IsEqual:()=>re,IsFunction:()=>oT,IsGreaterEqualThan:()=>aT,IsGreaterThan:()=>lD,IsInteger:()=>lm,IsLessEqualThan:()=>iT,IsLessThan:()=>mD,IsMaxLength:()=>hD,IsMinLength:()=>yD,IsMultipleOf:()=>dD,IsNull:()=>Yc,IsNumber:()=>Vc,IsObject:()=>Ra,IsObjectNotArray:()=>pD,IsString:()=>Qc,IsSymbol:()=>uD,IsUndefined:()=>mm,IsUnsafePropertyKey:()=>cT,IsValueLike:()=>sT,Keys:()=>zc,ShiftLeft:()=>Wc,Some:()=>_D,SomeAll:()=>ID,Symbols:()=>xD,Values:()=>RD});function Qn(e,t,n){return e>=t&&e<=n}function nD(e){return e===8205}function oD(e){return Qn(e,55296,56319)}function Qy(e){return Qn(e,127462,127487)}function Zy(e){return Qn(e,65024,65039)}function Xy(e){return Qn(e,768,879)||Qn(e,6832,6911)||Qn(e,7616,7679)||Qn(e,65056,65071)}function Kc(e){return e>65535?2:1}function Wy(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(Xy(n)||Zy(n))t+=Kc(n);else break}return t}function um(e,t){let n=e.codePointAt(t),o=t+Kc(n);for(o=Wy(e,o);o<e.length-1&&e[o]==="\u200D";){let i=e.codePointAt(o+1);o+=1+Kc(i),o=Wy(e,o)}return Qy(n)&&o<e.length&&Qy(e.codePointAt(o))&&(o+=Kc(e.codePointAt(o))),o}function Jy(e){return oD(e)||Xy(e)||Zy(e)||nD(e)}function eT(e){let t=0,n=0;for(;n<e.length;)n=um(e,n),t++;return t}function iD(e,t){if(t===0)return!0;let n=0,o=0;for(;o<e.length;)if(o=um(e,o),n++,n>=t)return!0;return!1}function aD(e,t){let n=0,o=0;for(;o<e.length;)if(o=um(e,o),n++,n>t)return!1;return!0}function tT(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Jy(e.charCodeAt(n)))return iD(e,t);if(n++,n>=t)return!0}return!1}function rT(e,t){let n=0;for(;n<e.length;){if(Jy(e.charCodeAt(n)))return aD(e,t);if(n++,n>t)return!1}return!0}function xa(e){return Array.isArray(e)}function Aa(e){return re(typeof e,"bigint")}function nT(e){return re(typeof e,"boolean")}function cD(e){if(mm(e)||!oT(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function oT(e){return re(typeof e,"function")}function lm(e){return Number.isInteger(e)}function Yc(e){return re(e,null)}function Vc(e){return Number.isFinite(e)}function pD(e){return Ra(e)&&!xa(e)}function Ra(e){return re(typeof e,"object")&&!Yc(e)}function Qc(e){return re(typeof e,"string")}function uD(e){return re(typeof e,"symbol")}function mm(e){return re(e,void 0)}function re(e,t){return e===t}function lD(e,t){return e>t}function mD(e,t){return e<t}function iT(e,t){return e<=t}function aT(e,t){return e>=t}function dD(e,t){if(Aa(e)||Aa(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!Vc(e)||lm(e)&&1/t%1===0)return!0;let o=e%t;return Math.min(Math.abs(o),Math.abs(o-t),Math.abs(o+t))<n}function fD(e){if(!Ra(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Yc(t)?!1:re(typeof t.constructor,"function")&&!(re(t.constructor,globalThis.Object)||re(t.constructor.name,"Object"))}function sT(e){return Aa(e)||nT(e)||Yc(e)||Vc(e)||Qc(e)||mm(e)}function gD(e){return eT(e)}function hD(e,t){return rT(e,t)}function yD(e,t){return tT(e,t)}function TD(e,t,n){for(let o=t;o<e.length;o++)if(!n(e[o],o))return!1;return!0}function ED(e,t,n){let o=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(o=!1);return o}function _D(e,t){for(let n=0;n<e.length;n++)if(t(e[n],n))return!0;return!1}function ID(e,t){let n=!1;for(let o=0;o<e.length;o++)t(e[o],o)&&(n=!0);return n}function SD(e,t){return e.reduce((n,o,i)=>t(o,i)?++n:n,0)}function Wc(e,t,n){return re(e.length,0)?n():t(e[0],e.slice(1))}function cT(e){return re(e,"__proto__")||re(e,"constructor")||re(e,"prototype")}function bD(e,t){return cT(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function OD(e){return zc(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function AD(e){return Object.entries(e)}function zc(e){return Object.getOwnPropertyNames(e)}function xD(e){return Object.getOwnPropertySymbols(e)}function RD(e){return Object.values(e)}function CD(e,t){if(!Ra(t))return!1;let n=zc(e);return re(n.length,zc(t).length)&&n.every(o=>dm(e[o],t[o]))}function PD(e,t){return xa(t)&&re(e.length,t.length)&&e.every((n,o)=>dm(e[o],t[o]))}function dm(e,t){return xa(e)?PD(e,t):Ra(e)?CD(e,t):re(e,t)}var St={};Zt(St,{IsBigInt64Array:()=>BD,IsBigUint64Array:()=>HD,IsBoolean:()=>UD,IsDate:()=>zD,IsFloat32Array:()=>jD,IsFloat64Array:()=>qD,IsInt16Array:()=>DD,IsInt32Array:()=>$D,IsInt8Array:()=>LD,IsMap:()=>VD,IsNumber:()=>wD,IsRegExp:()=>KD,IsSet:()=>YD,IsString:()=>vD,IsTypeArray:()=>ND,IsUint16Array:()=>GD,IsUint32Array:()=>FD,IsUint8Array:()=>kD,IsUint8ClampedArray:()=>MD});function UD(e){return e instanceof Boolean}function wD(e){return e instanceof Number}function vD(e){return e instanceof String}function ND(e){return globalThis.ArrayBuffer.isView(e)}function LD(e){return e instanceof globalThis.Int8Array}function kD(e){return e instanceof globalThis.Uint8Array}function MD(e){return e instanceof globalThis.Uint8ClampedArray}function DD(e){return e instanceof globalThis.Int16Array}function GD(e){return e instanceof globalThis.Uint16Array}function $D(e){return e instanceof globalThis.Int32Array}function FD(e){return e instanceof globalThis.Uint32Array}function jD(e){return e instanceof globalThis.Float32Array}function qD(e){return e instanceof globalThis.Float64Array}function BD(e){return e instanceof globalThis.BigInt64Array}function HD(e){return e instanceof globalThis.BigUint64Array}function KD(e){return e instanceof globalThis.RegExp}function zD(e){return e instanceof globalThis.Date}function YD(e){return e instanceof globalThis.Set}function VD(e){return e instanceof globalThis.Map}var Zc=s;function WD(e){return s.HasPropertyKey(e,"~kind")||s.HasPropertyKey(e,"~unsafe")}function ZD(e){let t={};for(let n of Object.getOwnPropertyNames(e)){if(s.IsUnsafePropertyKey(n))continue;let o=Object.getOwnPropertyDescriptor(e,n);o.value=Wn(o.value),s.IsEqual(o.enumerable,!0)?t[n]=o.value:Object.defineProperty(t,n,o)}return t}function XD(e){let t={};for(let n of s.Keys(e))s.IsUnsafePropertyKey(n)||(t[n]=Wn(e[n]));for(let n of s.Symbols(e))t[n]=Wn(e[n]);return t}function JD(e){return s.IsClassInstance(e)?e:WD(e)?ZD(e):XD(e)}function eG(e){return e.map(t=>Wn(t))}function tG(e){return e.slice()}function rG(e){return new RegExp(e.source,e.flags)}function nG(e){return new Map(Wn([...e.entries()]))}function oG(e){return new Set(Wn([...e.values()]))}function Wn(e){return St.IsTypeArray(e)?tG(e):St.IsRegExp(e)?rG(e):St.IsMap(e)?nG(e):St.IsSet(e)?oG(e):s.IsArray(e)?eG(e):s.IsObject(e)?JD(e):e}function Zn(e){return lr.clone+=1,Wn(e)}var at={};Zt(at,{Get:()=>sG,Reset:()=>iG,Set:()=>aG});var _r={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function iG(){_r.immutableTypes=!1,_r.maxErrors=8,_r.maxInstantiationCount=128,_r.useAcceleration=!0,_r.exactOptionalPropertyTypes=!1,_r.enumerableKind=!1,_r.correctiveParse=!1,_r.unionPrioritySort=!0}function aG(e){for(let t of s.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(_r,t,{value:n})}}function sG(){return _r}function cG(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function pT(e,t){return{...e,...t}}function pG(e,t,n={}){lr.create+=1;let o=at.Get(),i=pT(t,n),a=o.enumerableKind?pT(i,e):cG(i,e);return o.immutableTypes?Object.freeze(a):a}function uG(e,t){lr.discard+=1;let n={};for(let o of Object.getOwnPropertyNames(e)){if(t.includes(o))continue;let i=Object.getOwnPropertyDescriptor(e,o);i.value=Zn(i.value),Object.defineProperty(n,o,i)}return n}function lG(e,t,n){lr.update+=1;let o=at.Get(),i=Zn(e);for(let a of Object.keys(t))Object.defineProperty(i,a,{configurable:!0,writable:!0,enumerable:o.enumerableKind,value:t[a]});for(let a of Object.keys(n))Object.defineProperty(i,a,{configurable:!0,enumerable:!0,writable:!0,value:n[a]});return i}function w(e,t){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],t)}function Le(e){return s.IsObject(e)}function N(e,t,n){return y.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function ln(e){return w(e,"Deferred")}function mG(e){return y.Update(e,{"~readonly":!0},{})}function Ca(e,t){return y.Update(mG(e),{},t)}function uT(e,t,n,o){let i=A(e,t,n);return Ca(i,o)}function dG(e){return y.Update(e,{"~optional":!0},{})}function Pa(e,t){return y.Update(dG(e),{},t)}function lT(e,t,n,o){let i=A(e,t,n);return Pa(i,o)}function vt(e,t){return y.Create({"~kind":"Array"},{type:"array",items:e},t)}function X(e){return w(e,"Array")}function Yo(e){return y.Discard(e,["~kind","type","items"])}function Ir(e,t,n={}){return y.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function Ye(e){return w(e,"Constructor")}function mT(e){return y.Discard(e,["~kind","type","parameters","instanceType"])}function Sr(e,t,n={}){return y.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function Ve(e){return w(e,"Function")}function dT(e){return y.Discard(e,["~kind","type","parameters","returnType"])}function st(e,t){return y.Create({"~kind":"Ref"},{$ref:e},t)}function le(e){return w(e,"Ref")}function mn(e,t){return y.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Vo(e){return w(e,"Generic")}function Qo(e){return y.Create({"~kind":"Any"},{},e)}function Je(e){return w(e,"Any")}var fT="(?!)";function fe(e){return y.Create({"~kind":"Never"},{not:{}},e)}function mr(e){return w(e,"Never")}function br(e,t={}){return N("AddOptional",[e],t)}function Xn(e,t={}){return Pa(e,t)}function gT(e){return Xn(e)}function nt(e){return Le(e)&&s.HasPropertyKey(e,"~optional")}function hT(e){return s.Keys(e).filter(t=>!nt(e[t]))}function Xc(e){return s.Keys(e)}function Jc(e){return s.Values(e)}function D(e,t={}){let n=hT(e),o=n.length>0?{required:n}:{};return y.Create({"~kind":"Object"},{type:"object",...o,properties:e},t)}function $(e){return w(e,"Object")}function yT(e){return y.Discard(e,["~kind","type","properties","required"])}function et(e){return y.Create({"~kind":"Unknown"},{},e)}function ot(e){return w(e,"Unknown")}function Or(e,t,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:t},n)}function Ee(e){return w(e,"Cyclic")}function TT(e){return y.Update(e,{"~unsafe":null},{})}function ep(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}var ie={};Zt(ie,{Match:()=>fG});function fG(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function Ua(...e){let[t,n]=ie.Match(e,{2:(o,i)=>[o,i,i],1:o=>[o,et(),et()]});return y.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function Qe(e){return w(e,"Infer")}function Jn(e,t,n,o={}){return y.Create({"~kind":"Dependent"},{if:e,then:t,else:n},o)}function $e(e){return w(e,"Dependent")}function ET(e){return y.Discard(e,["~kind","if","then","else"])}function _T(e){return s.IsObjectNotArray(e)}function IT(e){return s.Keys(e).filter(n=>isNaN(n)).reduce((n,o)=>[...n,e[o]],[])}function ST(e){return s.IsString(e)||s.IsNumber(e)}function bT(e,t){let n=_T(e)?IT(e):e;return y.Create({"~kind":"Enum"},{enum:n},t)}function We(e){return w(e,"Enum")}function dt(e,t={}){return y.Create({"~kind":"Intersect"},{allOf:e},t)}function G(e){return w(e,"Intersect")}function OT(e){return y.Discard(e,["~kind","allOf"])}var eo={};Zt(eo,{Hash:()=>vG,HashCode:()=>wT});function he(){throw new Error("Unreachable")}function gG(e){let t=new Set,n=e;for(;n&&n!==Object.prototype;){for(let o of Reflect.ownKeys(n))o!=="constructor"&&typeof o!="symbol"&&t.add(o);n=Object.getPrototypeOf(n)}return[...t]}function hG(e){return typeof e=="number"}var bt;(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"})(bt||(bt={}));var Wo=BigInt("14695981039346656037"),[yG,TG]=[BigInt("1099511628211"),BigInt("18446744073709551616")],EG=Array.from({length:256}).map((e,t)=>BigInt(t)),CT=new Float64Array(1),PT=new DataView(CT.buffer),UT=new Uint8Array(CT.buffer);function ft(e){Wo=Wo^EG[e],Wo=Wo*yG%TG}function _G(e){ft(bt.Array);for(let t of e)dn(t)}function IG(e){ft(bt.BigInt),PT.setBigInt64(0,e);for(let t of UT)ft(t)}function xT(e){ft(bt.Boolean),ft(e?1:0)}function SG(e){ft(bt.Constructor),dn(e.toString())}function bG(e){ft(bt.Date),dn(e.getTime())}function OG(e){ft(bt.Function),dn(e.toString())}function AG(e){ft(bt.Null)}function RT(e){ft(bt.Number),PT.setFloat64(0,e,!0);for(let t of UT)ft(t)}function xG(e){ft(bt.Object);for(let t of gG(e).sort())dn(t),dn(e[t])}function RG(e){ft(bt.RegExp),fm(e.toString())}var CG=new TextEncoder;function fm(e){ft(bt.String);for(let t of CG.encode(e))ft(t)}function PG(e){ft(bt.Symbol),dn(e.toString())}function UG(e){ft(bt.TypeArray);let t=new Uint8Array(e.buffer);for(let n=0;n<t.length;n++)ft(t[n])}function wG(e){return ft(bt.Undefined)}function dn(e){return St.IsTypeArray(e)?UG(e):St.IsDate(e)?bG(e):St.IsRegExp(e)?RG(e):St.IsBoolean(e)?xT(e.valueOf()):St.IsString(e)?fm(e.valueOf()):St.IsNumber(e)?RT(e.valueOf()):hG(e)?RT(e):s.IsArray(e)?_G(e):s.IsBoolean(e)?xT(e):s.IsBigInt(e)?IG(e):s.IsConstructor(e)?SG(e):s.IsNull(e)?AG(e):s.IsObject(e)?xG(e):s.IsString(e)?fm(e):s.IsSymbol(e)?PG(e):s.IsUndefined(e)?wG(e):s.IsFunction(e)?OG(e):he()}function wT(e){return Wo=BigInt("14695981039346656037"),dn(e),Wo}function vG(e){return wT(e).toString(16).padStart(16,"0")}function vT(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"~refine":return e.params.message;default:return"an unknown validation error occurred"}}var NG=vT;function NT(){return NG}var wa=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,o=to(n)?c=>this.decode(n["~codec"].decode(c)):this.decode,i=to(n)?c=>n["~codec"].encode(t(c)):t,a={decode:o,encode:i};return y.Update(this.type,{"~codec":a},{})}},va=class{constructor(t){this.type=t}Decode(t){return new wa(this.type,t)}};function tp(e){return new va(e)}function kT(e,t){return tp(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function MT(e,t){return tp(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function to(e){return Le(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function DT(e){return Zo(e)}function ro(e){return Le(e)&&s.HasPropertyKey(e,"~immutable")}function Ar(e,t={}){return N("AddReadonly",[e],t)}function no(e,t={}){return Ca(e,t)}function GT(e){return no(e)}function oo(e){return Le(e)&&s.HasPropertyKey(e,"~readonly")}function kG(e,t){let n=rp(e)?[...e["~refine"],t]:[t];return y.Update(e,{"~refine":n},{})}function $T(...e){let[t,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,()=>"Refine Error"]});return kG(t,{check:n,error:o})}function MG(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function rp(e){return Le(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>MG(t))}var FT="-?(?:0|[1-9][0-9]*)n";function Na(e){return y.Create({"~kind":"BigInt"},{type:"bigint"},e)}function kt(e){return w(e,"BigInt")}function np(e){return y.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Ot(e){return w(e,"Boolean")}function La(e){return y.Create({"~kind":"Identifier"},{name:e})}function jT(e){return w(e,"Identifier")}var op="-?(?:0|[1-9][0-9]*)";function io(e){return y.Create({"~kind":"Integer"},{type:"integer"},e)}function ct(e){return w(e,"Integer")}var gm=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function DG(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new gm(e)})()}function Y(e,t){return y.Create({"~kind":"Literal"},{type:DG(e),const:e},t)}function ip(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function qT(e){return W(e)&&s.IsBigInt(e.const)}function BT(e){return W(e)&&s.IsBoolean(e.const)}function ap(e){return W(e)&&s.IsNumber(e.const)}function sp(e){return W(e)&&s.IsString(e.const)}function W(e){return w(e,"Literal")}function Xo(e){return y.Create({"~kind":"Null"},{type:"null"},e)}function xr(e){return w(e,"Null")}var cp="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Mt(e){return y.Create({"~kind":"Number"},{type:"number"},e)}function we(e){return w(e,"Number")}function Jo(e){return y.Create({"~kind":"Symbol"},{type:"symbol"},e)}function Rr(e){return w(e,"Symbol")}function ao(...e){let[t,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,a],1:i=>[i,et(),et()]});return y.Create({"~kind":"Parameter"},{name:t,extends:n,equals:o},{})}function HT(e){return w(e,"Parameter")}var pp=".*";function At(e){return y.Create({"~kind":"String"},{type:"string"},e)}function tt(e){return w(e,"String")}function q(e,t={}){return y.Create({"~kind":"Union"},{anyOf:e},t)}function C(e){return w(e,"Union")}function KT(e){return y.Discard(e,["~kind","anyOf"])}function ka(e){let t=zT(e);return s.IsEqual(t.length,2)?t[0]:[]}function GG(e){return!0}function YT(e){return s.ShiftLeft(e,(t,n)=>$G(t)?YT(n):!1,()=>!0)}function VT(e){return s.IsEqual(e.length,0)?!1:YT(e)}function $G(e){return C(e)?VT(e.anyOf):W(e)?GG(e.const):!1}function up(e){return VT(e)}function lp(e){return y.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function QT(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>QT(i,t,[...n,`${o}${t}`]),()=>n)}function FG(e,t){return s.IsEqual(e.length,0)?[`${t}`]:QT(e,t)}function WT(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>WT(e,i,[...n,...ZT(e,o)]),()=>n)}function ZT(e,t){return C(t)?WT(e,t.anyOf):W(t)?FG(e,t.const):he()}function XT(e,t){return s.ShiftLeft(t,(n,o)=>XT(ZT(e,n),o),()=>e)}function jG(e){return e.map(t=>Y(t))}function qG(e){let t=XT([],e),n=jG(t);return q(n)}function BG(e){return s.IsEqual(e.length,0)?he():s.IsEqual(e.length,1)&&W(e[0])?e[0]:qG(e)}function hm(e){let t=ka(e);return s.IsEqual(t.length,0)?At():up(t)?BG(t):lp(e)}function Ma(e){let t=hm(e);return _e(t)?At():t}function Nt(e,t){let n="object",o={[e]:t};return y.Create({"~kind":"Record"},{type:n,patternProperties:o})}function JT(e){return Nt(qt,e)}function eE(e){return D({true:e,false:e})}function Fe(e,t={}){let[n,o,i]=[e,e.length,!1];return y.Create({"~kind":"Tuple"},{type:"array",additionalItems:i,items:n,minItems:o},t)}function V(e){return w(e,"Tuple")}function tE(e){return y.Discard(e,["~kind","type","items","minItems","additionalItems"])}function HG(e){return y.Discard(e,["~readonly"])}function ym(e,t){return y.Update(HG(e),{},t)}function rE(e,t,n,o){let i=A(e,t,n);return ym(i,o)}function nE(e,t={}){return N("RemoveReadonly",[e],t)}function oE(e,t={}){return ym(e,t)}function KG(e){return y.Discard(e,["~optional"])}function Tm(e,t){return y.Update(KG(e),{},t)}function iE(e,t,n,o){let i=A(e,t,n);return Tm(i,o)}function aE(e,t={}){return N("RemoveOptional",[e],t)}function mp(e,t={}){return Tm(e,t)}function Em(e){return e.reduceRight((n,o,i)=>({[i]:o,...n}),{})}function sE(e){let t=Em(e.items);return D(t)}function zG(e,t){return oo(e)?!!oo(t):!1}function YG(e,t){return nt(e)?!!nt(t):!1}function VG(e,t){let n=zG(e,t),o=YG(e,t),i=ke([e,t]),a=oE(mp(i));return n&&o?no(Xn(a)):n&&!o?no(a):!n&&o?Xn(a):a}function QG(e,t,n){return n in e?n in t?VG(e[n],t[n]):e[n]:n in t?t[n]:fe()}function WG(e,t){return[...new Set([...s.Keys(t),...s.Keys(e)])].reduce((o,i)=>({...o,[i]:QG(e,t,i)}),{})}function cE(e){return $(e)?e.properties:V(e)?Em(e.items):he()}function pE(e,t){let n=cE(e),o=cE(t),i=WG(n,o);return D(i)}function uE(e,t){let n=so(e,t);return s.IsEqual(n,Ga)?e:s.IsEqual(n,$a)||s.IsEqual(n,Da)?t:fe()}function lE(e){return $(e)||V(e)}function ZG(e,t){let n=C(e),o=C(t);return n||o}function XG(e,t){let n=Xt(e),o=Xt(t),i=ZG(n,o),a=lE(n),c=lE(o);return i?ke([n,o]):a&&c?pE(n,o):a&&!c?n:!a&&c?o:uE(n,o)}function mE(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>mE(e,i,[...n,XG(e,o)]),()=>s.IsEqual(n.length,0)?[e]:n)}function dE(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>dE(i,t,[...n,...Fa([o],t)]),()=>n)}function Fa(e,t=[]){return s.ShiftLeft(e,(n,o)=>C(n)?Fa(o,dE(n.anyOf,t)):Fa(o,mE(n,t)),()=>t)}function JG(e,t){let n=ht({},e,t);return F.IsExtendsTrueLike(n)?[]:[e]}function e$(e,t){return e.reduce((n,o)=>[...n,...JG(o,t)],[])}function dp(e,t){let n=Xt(e),o=C(n)?n.anyOf:[n],i=e$(o,t);return Dt(i)}function dr(e,t,n){let o=dt([e,t]),i=dp(n,e);return Dt([o,i])}function Lt(e){let t=e.map(n=>Y(n));return Dt(t)}function ke(e){let t=Fa(e),n=_m(t);return Kr(n)}function _t(e){let t=Ma(e);return Xt(t)}function Dt(e){let t=_m(e);return Kr(t)}function Xt(e){return $e(e)?dr(e.if,e.then,e.else):We(e)?Lt(e.enum):G(e)?ke(e.allOf):_e(e)?_t(e.pattern):C(e)?Dt(e.anyOf):e}function Kr(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?fe():q(e)}function fE(e,t){let n=Lt(e);return fn(n,t)}function gE(e,t){return Nt(gn,t)}function hE(e,t){let n=ke(e);return fn(n,t)}function yE(e,t){return s.IsString(e)||s.IsNumber(e)?D({[e]:t}):s.IsEqual(e,!1)?D({false:t}):s.IsEqual(e,!0)?D({true:t}):D({})}function TE(e,t){return Nt(ei,t)}function EE(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?Nt(e.pattern.toString(),t):Nt(qt,t)}function _E(e,t){let n=ka(e);return up(n)?fn(_t(e),t):Nt(e,t)}function t$(e){return C(e)?ti(e.anyOf):[e]}function ti(e){return e.reduce((t,n)=>[...t,...t$(n)],[])}function r$(e){return e.some(t=>tt(t)||we(t)||ct(t))}function n$(e,t){return s.IsEqual(r$(e),!0)?Nt(qt,t):void 0}function o$(e,t){return e.reduce((n,o)=>W(o)&&(s.IsString(o.const)||s.IsNumber(o.const))?{...n,[o.const]:t}:n,{})}function i$(e,t){let n=o$(e,t);return D(n)}function IE(e,t){let n=ti(e),o=n$(n,t);return Le(o)?o:i$(n,t)}function fn(e,t){return Je(e)?JT(t):Ot(e)?eE(t):We(e)?fE(e.enum,t):ct(e)?gE(e,t):G(e)?hE(e.allOf,t):W(e)?yE(e.const,t):we(e)?TE(e,t):C(e)?IE(e.anyOf,t):tt(e)?EE(e,t):_e(e)?_E(e.pattern,t):D({})}function Im(e,t,n){return K([e])?y.Update(fn(e,t),{},n):fp(e,t,n)}function SE(e,t,n,o,i){let a=A(e,t,n),c=A(e,t,o);return Im(a,c,i)}var gn=`^${op}$`,ei=`^${cp}$`,qt=`^${pp}$`;function fp(e,t,n={}){return N("Record",[e,t],n)}function ri(e,t,n={}){return Im(e,t,n)}function gp(e,t){return Nt(e,t)}function hp(e){return s.IsEqual(e,qt)?At():s.IsEqual(e,gn)?io():s.IsEqual(e,ei)?Mt():hm(e)}function pt(e){return s.Keys(e.patternProperties)[0]}function hn(e){let t=pt(e);return hp(t)}function xe(e){return e.patternProperties[pt(e)]}function ge(e){return w(e,"Record")}function co(e){return y.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function yn(e){return w(e,"Rest")}function yp(e){return y.Create({"~kind":"This"},{$ref:"#"},e)}function Tp(e){return w(e,"This")}function ni(e){return y.Create({"~kind":"Undefined"},{type:"undefined"},e)}function fr(e){return w(e,"Undefined")}function Ep(e){return y.Create({"~kind":"Void"},{type:"void"},e)}function Gt(e){return w(e,"Void")}function s$(e,t){return s.IsEqual(e,"Array")?vt(t[0]):s.IsEqual(e,"Capitalize")?Ip(t[0]):s.IsEqual(e,"ConstructorParameters")?xp(t[0]):s.IsEqual(e,"Evaluate")?bI(t[0]):s.IsEqual(e,"Exclude")?Rp(t[0],t[1]):s.IsEqual(e,"Extract")?Cp(t[0],t[1]):s.IsEqual(e,"Index")?Ha(t[0],t[1]):s.IsEqual(e,"InstanceType")?Pp(t[0]):s.IsEqual(e,"Lowercase")?Sp(t[0]):s.IsEqual(e,"NonNullable")?Up(t[0]):s.IsEqual(e,"Omit")?wp(t[0],t[1]):s.IsEqual(e,"Parameters")?vp(t[0]):s.IsEqual(e,"Partial")?Np(t[0]):s.IsEqual(e,"Pick")?Lp(t[0],t[1]):s.IsEqual(e,"Readonly")?kp(t[0]):s.IsEqual(e,"KeyOf")?Ka(t[0]):s.IsEqual(e,"Record")?fp(t[0],t[1]):s.IsEqual(e,"Required")?Mp(t[0]):s.IsEqual(e,"ReturnType")?Dp(t[0]):s.IsEqual(e,"Uncapitalize")?bp(t[0]):s.IsEqual(e,"Uppercase")?Op(t[0]):Ba(st(e),t)}function po(){throw Error("Unreachable")}function RE(e,t=[]){return s.ShiftLeft(e,(n,o)=>RE(o,[...t,n[1]]),()=>t)}function zr(e){return s.IsEqual(e.length,3)?[e[0],...RE(e[1])]:[]}function CE(e){return ao(e[0],e[2],e[4])}function PE(e){return ao(e[0],e[2],e[2])}function UE(e){return ao(e[0],et(),e[2])}function wE(e){return ao(e,et(),et())}function vE(e){return zr(e)}function NE(e){return e[1]}function LE(e){return zr(e)}function kE(e){return e[1]}function ME(e){return s$(e[0],e[1])}function DE(e){return null}function GE(e){return At()}function $E(e){return Mt()}function FE(e){return np()}function jE(e){return ni()}function qE(e){return Xo()}function BE(e){return io()}function HE(e){return Na()}function KE(e){return et()}function zE(e){return Qo()}function YE(e){return D({})}function VE(e){return fe()}function QE(e){return Jo()}function WE(e){return Ep()}function ZE(e){return yp()}function XE(e){return Y(BigInt(e))}function JE(e){return Y(s.IsEqual(e,"true"))}function e_(e){return Y(parseFloat(e))}function t_(e){return Y(e)}function r_(e){return e[1]}function n_(e){return Y(e)}function o_(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function i_(e){return e[1]}function a_(e){return _p(e)}function s_(e){return s.IsEqual(e.length,6)?Jn(e[1],e[3],e[5]):Jn(e[1],e[3],et())}function c_(e){return e.length>0}function p_(e){return e.reduce((t,n)=>s.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function u_(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function l_(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function m_(e){return s.IsEqual(e.length,2)?e[1]:[]}function bE(e,t){return t.reduce((n,o)=>{let i=o;return s.IsEqual(i.length,1)?Ha(n,i[0]):s.IsEqual(i.length,0)?vt(n):po()},e)}function OE(e,t){return s.IsEqual(t.length,3)?Ap(e,t[0],t[1],t[2]):e}function c$(e,t){return s.IsArray(t)&&s.IsEqual(t.length,0)?e:Gp(e,t)}function d_(e){let[t,n,o,i,a]=e;return c$(OE(t?Ka(bE(n,o)):bE(n,o),i),a)}function Sm(e,t){return s.IsEqual(t.length,3)?(()=>{let[n,o,i]=t,a=Sm(o,i);if(s.IsEqual(n,"&"))return G(a)?dt([e,...a.allOf]):dt([e,a]);if(s.IsEqual(n,"|"))return C(a)?q([e,...a.anyOf]):q([e,a]);po()})():e}function f_(e){let[t,n]=e;return Sm(t,n)}function g_(e){let[t,n]=e;return Sm(t,n)}function h_(e){return SI(e[1])}function y_(e){return e[1]}function T_(e){return mn(e[0],e[2])}function E_(e){return s.IsEqual(e.length,4)?Ua(e[1],e[3]):s.IsEqual(e.length,2)?Ua(e[1],et()):po()}function __(e){return`${e}`}function I_(e){return ct(e[3])?gn:we(e[3])?ei:Rr(e[3])?qt:tt(e[3])?qt:po()}function S_(e){return e.length>0}function b_(e){return e.length>0}function O_(e){let[t,n,o,i,a]=e;return{[n]:t&&o?Ar(br(a)):t&&!o?Ar(a):!t&&o?br(a):a}}function A_(e){return zr(e)}function x_(e){return e.reduce((t,n)=>s.HasPropertyKey(n,gn)||s.HasPropertyKey(n,ei)||s.HasPropertyKey(n,qt)?[t[0],y.Assign(t[1],n)]:[y.Assign(t[0],n),t[1]],[{},{}])}function R_(e){return x_(e[1])}function C_(e){let[t,n]=e,o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return D(t,o)}function P_(e){return s.IsEqual(e.length,5)?Ar(br(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?Ar(e[3]):br(e[3]):po()}function U_(e){if(!s.IsArray(e)||!s.IsEqual(e.length,3))return e;let[t,n,o]=e;return t&&o?Ar(br(n)):t&&!o?Ar(n):!t&&o?br(n):n}function w_(e){return s.IsEqual(e.length,2)?co(e[1]):s.IsEqual(e.length,1)?e[0]:po()}function v_(e){return zr(e)}function N_(e){return Fe(e[1])}function L_(e){return Ar(br(e[4]))}function k_(e){return Ar(e[3])}function M_(e){return br(e[3])}function D_(e){return e[2]}function G_(e){return s.IsEqual(e.length,2)?co(e[1]):s.IsEqual(e.length,1)?e[0]:po()}function $_(e){return zr(e)}function F_(e){return Sr(e[1],e[4])}function j_(e){return Ir(e[2],e[5])}function AE(e,t){return s.IsEqual(e,"remove")?nE(t):s.IsEqual(e,"add")?Ar(t):t}function q_(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 xE(e,t){return s.IsEqual(e,"remove")?aE(t):s.IsEqual(e,"add")?br(t):t}function B_(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 H_(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function K_(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?ja(La(e[3]),e[5],e[6][0],AE(e[1],xE(e[8],e[10]))):ja(La(e[3]),e[5],st(e[3]),AE(e[1],xE(e[8],e[10])))}function z_(e){return st(e)}function Y_(e){return BigInt(e)}function V_(e){return parseFloat(e)}function Q_(e){return s.IsEqual(e,"true")}function W_(e){return null}function Z_(e){return{[e[0]]:e[2]}}function X_(e){return zr(e)}function p$(e){return e.reduce((t,n)=>y.Assign(t,n),{})}function J_(e){return p$(e[1])}function eI(e){return zr(e)}function tI(e){return e[1]}function rI(e){return Na()}function nI(e){return At()}function oI(e){return Mt()}function iI(e){return io()}function aI(e){return fe()}function sI(e){return Y(e)}function cI(e){return q(e[1])}function pI(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function uI(e){return[e[0],...e[1]]}function lI(e){return e[1]}function mI(e){return zr(e)}function dI(e){return s.IsEqual(e.length,2)?e[1]:[]}function fI(e){let t=e[2],n=e[3],[o,i]=e[4],a=s.IsEqual(s.Keys(i).length,0)?{}:{patternProperties:i};return{[e[1]]:mn(t,qa(n,o,a))}}function gI(e){let t=e[2],[n,o]=e[3],i=s.IsEqual(s.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:qa(t,n,i)}}function hI(e){return{[e[1]]:mn(e[2],e[4])}}function yI(e){return{[e[1]]:e[3]}}function TI(e){return null}function EI(e){return zr(e)}function _I(e){return e[1]}function II(e){let[t,n]=[e[0],e[1]];return OI(y.Assign(t,x_(n)[0]))}function za(e){return re(e.length,2)}function Z(e,t,n){return za(e)?t(e[0],e[1]):n()}function m$(e,t){return re(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function Me(e,t){for(let n=0;n<e.length;n++){let o=m$(e[n],t);if(za(o))return o}return[]}function bm(e,t){return Array.from({length:t-e+1},(n,o)=>String.fromCharCode(e+o))}var AI=[...bm(97,122),...bm(65,90)],Om="0",Am=bm(49,57),oi=[Om,...Am],xI=" ",ii=`
28
+ `;var Tn="_",$p=".",RI="$",Fp="-";var CI="//",PI="/*",f$="*/";function UI(e){let t=e.indexOf(f$);return re(t,-1)?"":e.slice(t+2)}function wI(e){let t=e.indexOf(ii);return re(t,-1)?"":e.slice(t)}function g$(e){return e.replace(/^[ \t\r\f\v]+/,"")}function jp(e){let t=g$(e);return t.startsWith(PI)?jp(UI(t.slice(2))):t.startsWith(CI)?jp(wI(t.slice(2))):t}function gt(e){let t=e.trimStart();return t.startsWith(PI)?gt(UI(t.slice(2))):t.startsWith(CI)?gt(wI(t.slice(2))):t}function qp(e,t){return Z(Me([e],t),(n,o)=>[n,o],()=>["",t])}function h$(e,t){return e.includes(t)}function ai(e,t,n,o=""){return Z(Me(e,n),(i,a)=>h$(t,i)?ai(e,t,a,o):ai(e,t,a,`${o}${i}`),()=>[o,n])}function y$(e){return Me(Am,e)}var T$=[...oi,Tn];function E$(e){return ai(T$,[Tn],e)}function _$(e){return Z(Me([Om],e),(t,n)=>[t,n],()=>Z(y$(e),(t,n)=>Z(E$(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[]))}function Bp(e){return _$(gt(e))}function I$(e){return qp(Fp,e)}function S$(e){return Z(I$(e),(t,n)=>Z(Bp(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[])}function vI(e){return S$(gt(e))}function b$(e){return Z(vI(e),(t,n)=>Z(Me(["n"],n),(o,i)=>[`${t}`,i],()=>[]),()=>[])}function xm(e){return b$(e)}function Rm(e,t){return Me([e],t)}function _(e,t){return re(e,"")?["",t]:e.startsWith(ii)?Rm(e,jp(t)):e.startsWith(xI)?Rm(e,t):Rm(e,gt(t))}var NI=[...AI,Tn,RI];function O$(e){return Me(NI,e)}var A$=[...NI,...oi];function LI(e,t=""){return Z(Me(A$,e),(n,o)=>LI(o,`${t}${n}`),()=>[t,e])}function x$(e){return Z(O$(e),(t,n)=>Z(LI(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[])}function je(e){return x$(gt(e))}var R$=[...oi,Tn];function C$(e){return za(Me([$p],e))}function kI(e){return Z(ai(R$,[Tn],e),(t,n)=>re(t,"")?[]:[t,n],()=>[])}function P$(e){return Z(Me([$p],e),(t,n)=>Z(kI(n),(o,i)=>[`0${t}${o}`,i],()=>[]),()=>[])}function U$(e){return Z(Bp(e),(t,n)=>Z(Me([$p],n),(o,i)=>Z(kI(i),(a,c)=>[`${t}${o}${a}`,c],()=>[`${t}`,i]),()=>[`${t}`,n]),()=>[])}function w$(e){return C$(e)?P$(e):U$(e)}function MI(e){return w$(gt(e))}function v$(e){return qp(Fp,e)}function N$(e){return Z(v$(e),(t,n)=>Z(MI(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[])}function Hp(e){return N$(gt(e))}function L$(e){return re(e,"")?[]:[e.slice(0,1),e.slice(1)]}function DI(e,t){return Wc(e,(n,o)=>t.startsWith(n)?!0:DI(o,t),()=>!1)}function En(e,t,n=""){return Z(L$(t),(o,i)=>DI(e,t)?[n,t]:En(e,i,`${n}${o}`),()=>[])}function k$(e,t,n){return Z(Me([e],n),(o,i)=>Z(En([t],i),(a,c)=>Z(Me([t],c),(l,m)=>[`${a}`,m],()=>[]),()=>[]),()=>[])}function M$(e,t,n){return Z(Me([e],n),(o,i)=>Z(En([ii,t],i),(a,c)=>Z(Me([t],c),(l,m)=>[`${a}`,m],()=>[]),()=>[]),()=>[])}function GI(e,t,n,o){return n?k$(e,t,gt(o)):M$(e,t,gt(o))}function D$(e,t){return Me(e,t)}function G$(e,t){return GI(e,e,!1,t)}function $$(e,t){return Z(D$(e,t),(n,o)=>G$(n,`${n}${o}`),()=>[])}function Kp(e,t){return $$(e,gt(t))}function $I(e,t){return Z(En(e,t),(n,o)=>re(n,"")?[]:[n,o],()=>[])}var u=(e,t,n=()=>[])=>e.length===2?t(e):n(),j$=e=>u(u(je(e),([t,n])=>u(_("extends",n),([o,i])=>u(ne(i),([a,c])=>u(_("=",c),([l,m])=>u(ne(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[CE(t),n]),q$=e=>u(u(je(e),([t,n])=>u(_("extends",n),([o,i])=>u(ne(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[PE(t),n]),B$=e=>u(u(je(e),([t,n])=>u(_("=",n),([o,i])=>u(ne(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[UE(t),n]),H$=e=>u(je(e),([t,n])=>[wE(t),n]),qI=e=>u(u(j$(e),([t,n])=>[t,n],()=>u(q$(e),([t,n])=>[t,n],()=>u(B$(e),([t,n])=>[t,n],()=>u(H$(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),BI=(e,t=[])=>u(u(_(",",e),([n,o])=>u(qI(o),([i,a])=>[[n,i],a])),([n,o])=>BI(o,[...t,n]),()=>[t,e]),K$=e=>u(u(u(qI(e),([t,n])=>u(BI(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[vE(t),n]),Um=e=>u(u(_("<",e),([t,n])=>u(K$(n),([o,i])=>u(_(">",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[NE(t),n]),HI=(e,t=[])=>u(u(_(",",e),([n,o])=>u(ne(o),([i,a])=>[[n,i],a])),([n,o])=>HI(o,[...t,n]),()=>[t,e]),z$=e=>u(u(u(ne(e),([t,n])=>u(HI(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[LE(t),n]),Y$=e=>u(u(_("<",e),([t,n])=>u(z$(n),([o,i])=>u(_(">",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[kE(t),n]),V$=e=>u(u(je(e),([t,n])=>u(Y$(n),([o,i])=>[[t,o],i])),([t,n])=>[ME(t),n]),KI=e=>u(u(u(_(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[DE(t),n]),zI=e=>u(_("string",e),([t,n])=>[GE(t),n]),YI=e=>u(_("number",e),([t,n])=>[$E(t),n]),Q$=e=>u(_("boolean",e),([t,n])=>[FE(t),n]),W$=e=>u(_("undefined",e),([t,n])=>[jE(t),n]),Z$=e=>u(_("null",e),([t,n])=>[qE(t),n]),VI=e=>u(_("integer",e),([t,n])=>[BE(t),n]),X$=e=>u(_("bigint",e),([t,n])=>[HE(t),n]),J$=e=>u(_("unknown",e),([t,n])=>[KE(t),n]),e1=e=>u(_("any",e),([t,n])=>[zE(t),n]),t1=e=>u(_("object",e),([t,n])=>[YE(t),n]),r1=e=>u(_("never",e),([t,n])=>[VE(t),n]),QI=e=>u(_("symbol",e),([t,n])=>[QE(t),n]),n1=e=>u(_("void",e),([t,n])=>[WE(t),n]),o1=e=>u(_("this",e),([t,n])=>[ZE(t),n]),i1=e=>u(u(_("${",e),([t,n])=>u(ne(n),([o,i])=>u(_("}",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[r_(t),n]),Cm=e=>u(En(["${","`"],e),([t,n])=>[n_(t),n]),WI=e=>u(u(u(Cm(e),([t,n])=>u(i1(n),([o,i])=>u(WI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u(u(Cm(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u(u(Cm(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[o_(t),n]),wm=e=>u(u(_("`",e),([t,n])=>u(WI(n),([o,i])=>u(_("`",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[i_(t),n]),a1=e=>u(wm(e),([t,n])=>[a_(t),n]),s1=e=>u(u(u(_("if",e),([t,n])=>u(ne(n),([o,i])=>u(_("then",i),([a,c])=>u(ne(c),([l,m])=>u(_("else",m),([f,h])=>u(ne(h),([E,I])=>[[t,o,a,l,f,E],I])))))),([t,n])=>[t,n],()=>u(u(_("if",e),([t,n])=>u(ne(n),([o,i])=>u(_("then",i),([a,c])=>u(ne(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[t,n],()=>[])),([t,n])=>[s_(t),n]),c1=e=>u(xm(e),([t,n])=>[XE(t),n]),p1=e=>u(u(_("true",e),([t,n])=>[t,n],()=>u(_("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[JE(t),n]),u1=e=>u(Hp(e),([t,n])=>[e_(t),n]),l1=e=>u(Kp(["'",'"'],e),([t,n])=>[t_(t),n]),m1=e=>u(u(u(_("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[c_(t),n]),ZI=(e,t=[])=>u(u(u(_("[",e),([n,o])=>u(ne(o),([i,a])=>u(_("]",a),([c,l])=>[[n,i,c],l]))),([n,o])=>[n,o],()=>u(u(_("[",e),([n,o])=>u(_("]",o),([i,a])=>[[n,i],a])),([n,o])=>[n,o],()=>[])),([n,o])=>ZI(o,[...t,n]),()=>[t,e]),d1=e=>u(ZI(e),([t,n])=>[p_(t),n]),f1=e=>u(u(u(_("extends",e),([t,n])=>u(ne(n),([o,i])=>u(_("?",i),([a,c])=>u(ne(c),([l,m])=>u(_(":",m),([f,h])=>u(ne(h),([E,I])=>[[t,o,a,l,f,E],I])))))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[u_(t),n]),g1=e=>u(u(u(_("(",e),([t,n])=>u(ne(n),([o,i])=>u(_(")",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u(zI(e),([t,n])=>[t,n],()=>u(YI(e),([t,n])=>[t,n],()=>u(Q$(e),([t,n])=>[t,n],()=>u(W$(e),([t,n])=>[t,n],()=>u(Z$(e),([t,n])=>[t,n],()=>u(VI(e),([t,n])=>[t,n],()=>u(X$(e),([t,n])=>[t,n],()=>u(J$(e),([t,n])=>[t,n],()=>u(e1(e),([t,n])=>[t,n],()=>u(t1(e),([t,n])=>[t,n],()=>u(r1(e),([t,n])=>[t,n],()=>u(QI(e),([t,n])=>[t,n],()=>u(n1(e),([t,n])=>[t,n],()=>u(o1(e),([t,n])=>[t,n],()=>u(c1(e),([t,n])=>[t,n],()=>u(p1(e),([t,n])=>[t,n],()=>u(u1(e),([t,n])=>[t,n],()=>u(l1(e),([t,n])=>[t,n],()=>u(a1(e),([t,n])=>[t,n],()=>u(s1(e),([t,n])=>[t,n],()=>u(x1(e),([t,n])=>[t,n],()=>u(P1(e),([t,n])=>[t,n],()=>u(k1(e),([t,n])=>[t,n],()=>u(L1(e),([t,n])=>[t,n],()=>u($1(e),([t,n])=>[t,n],()=>u(V$(e),([t,n])=>[t,n],()=>u(F1(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[l_(t),n]),h1=e=>u(u(u(_("with",e),([t,n])=>u(fS(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[m_(t),n]),XI=e=>u(u(m1(e),([t,n])=>u(g1(n),([o,i])=>u(d1(i),([a,c])=>u(f1(c),([l,m])=>u(h1(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[d_(t),n]),JI=e=>u(u(u(_("&",e),([t,n])=>u(XI(n),([o,i])=>u(JI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),eS=e=>u(u(XI(e),([t,n])=>u(JI(n),([o,i])=>[[t,o],i])),([t,n])=>[f_(t),n]),tS=e=>u(u(u(_("|",e),([t,n])=>u(eS(n),([o,i])=>u(tS(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),zp=e=>u(u(eS(e),([t,n])=>u(tS(n),([o,i])=>[[t,o],i])),([t,n])=>[g_(t),n]),y1=e=>u(u(_("readonly",e),([t,n])=>u(zp(n),([o,i])=>[[t,o],i])),([t,n])=>[h_(t),n]),T1=e=>u(u(_("|",e),([t,n])=>u(zp(n),([o,i])=>[[t,o],i])),([t,n])=>[y_(t),n]),E1=e=>u(u(Um(e),([t,n])=>u(_("=",n),([o,i])=>u(ne(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[T_(t),n]),_1=e=>u(u(u(_("infer",e),([t,n])=>u(je(n),([o,i])=>u(_("extends",i),([a,c])=>u(zp(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[t,n],()=>u(u(_("infer",e),([t,n])=>u(je(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>[])),([t,n])=>[E_(t),n]),ne=e=>u(u(_1(e),([t,n])=>[t,n],()=>u(T1(e),([t,n])=>[t,n],()=>u(y1(e),([t,n])=>[t,n],()=>u(zp(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),I1=e=>u(Hp(e),([t,n])=>[__(t),n]),S1=e=>u(je(e),([t,n])=>[t,n]),b1=e=>u(Kp(["'",'"'],e),([t,n])=>[t,n]),O1=e=>u(u(_("[",e),([t,n])=>u(je(n),([o,i])=>u(_(":",i),([a,c])=>u(u(VI(c),([l,m])=>[l,m],()=>u(YI(c),([l,m])=>[l,m],()=>u(zI(c),([l,m])=>[l,m],()=>u(QI(c),([l,m])=>[l,m],()=>[])))),([l,m])=>u(_("]",m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[I_(t),n]),rS=e=>u(u(I1(e),([t,n])=>[t,n],()=>u(S1(e),([t,n])=>[t,n],()=>u(b1(e),([t,n])=>[t,n],()=>u(O1(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),nS=e=>u(u(u(_("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[S_(t),n]),oS=e=>u(u(u(_("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[b_(t),n]),iS=e=>u(u(nS(e),([t,n])=>u(rS(n),([o,i])=>u(oS(i),([a,c])=>u(_(":",c),([l,m])=>u(ne(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[O_(t),n]),Yp=e=>u(u(u(_(",",e),([t,n])=>u(_(`
29
29
  `,n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u(u(_(";",e),([t,n])=>u(_(`
30
30
  `,n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u(u(_(",",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u(u(_(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u(u(_(`
31
- `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),oS=(e,t=[])=>u(u(zp(e),([n,o])=>u(nS(o),([i,a])=>[[n,i],a])),([n,o])=>oS(o,[...t,n]),()=>[t,e]),I1=e=>u(u(u(nS(e),([t,n])=>u(oS(n),([o,i])=>u(u(zp(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[b_(t),n]),Um=e=>u(u(_("{",e),([t,n])=>u(I1(n),([o,i])=>u(_("}",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[A_(t),n]),S1=e=>u(Um(e),([t,n])=>[x_(t),n]),b1=e=>u(u(u(je(e),([t,n])=>u(_("?",n),([o,i])=>u(_(":",i),([a,c])=>u(_("readonly",c),([l,m])=>u(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[t,n],()=>u(u(je(e),([t,n])=>u(_(":",n),([o,i])=>u(_("readonly",i),([a,c])=>u(re(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[t,n],()=>u(u(je(e),([t,n])=>u(_("?",n),([o,i])=>u(_(":",i),([a,c])=>u(re(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[t,n],()=>u(u(je(e),([t,n])=>u(_(":",n),([o,i])=>u(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[R_(t),n]),GI=e=>u(u(b1(e),([t,n])=>[t,n],()=>u(u(tS(e),([t,n])=>u(re(n),([o,i])=>u(rS(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>[])),([t,n])=>[C_(t),n]),iS=e=>u(u(u(_("...",e),([t,n])=>u(GI(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u(u(GI(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[P_(t),n]),aS=(e,t=[])=>u(u(_(",",e),([n,o])=>u(iS(o),([i,a])=>[[n,i],a])),([n,o])=>aS(o,[...t,n]),()=>[t,e]),O1=e=>u(u(u(iS(e),([t,n])=>u(aS(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[U_(t),n]),A1=e=>u(u(_("[",e),([t,n])=>u(O1(n),([o,i])=>u(_("]",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[w_(t),n]),x1=e=>u(u(je(e),([t,n])=>u(_("?",n),([o,i])=>u(_(":",i),([a,c])=>u(_("readonly",c),([l,m])=>u(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[v_(t),n]),R1=e=>u(u(je(e),([t,n])=>u(_(":",n),([o,i])=>u(_("readonly",i),([a,c])=>u(re(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[N_(t),n]),C1=e=>u(u(je(e),([t,n])=>u(_("?",n),([o,i])=>u(_(":",i),([a,c])=>u(re(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[L_(t),n]),P1=e=>u(u(je(e),([t,n])=>u(_(":",n),([o,i])=>u(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[k_(t),n]),$I=e=>u(u(x1(e),([t,n])=>[t,n],()=>u(R1(e),([t,n])=>[t,n],()=>u(C1(e),([t,n])=>[t,n],()=>u(P1(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),sS=e=>u(u(u(_("...",e),([t,n])=>u($I(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u(u($I(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[M_(t),n]),cS=(e,t=[])=>u(u(_(",",e),([n,o])=>u(sS(o),([i,a])=>[[n,i],a])),([n,o])=>cS(o,[...t,n]),()=>[t,e]),pS=e=>u(u(u(sS(e),([t,n])=>u(cS(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[D_(t),n]),U1=e=>u(u(_("(",e),([t,n])=>u(pS(n),([o,i])=>u(_(")",i),([a,c])=>u(_("=>",c),([l,m])=>u(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[G_(t),n]),w1=e=>u(u(_("new",e),([t,n])=>u(_("(",n),([o,i])=>u(pS(i),([a,c])=>u(_(")",c),([l,m])=>u(_("=>",m),([f,h])=>u(re(h),([E,I])=>[[t,o,a,l,f,E],I])))))),([t,n])=>[$_(t),n]),v1=e=>u(u(u(_("+",e),([t,n])=>u(_("readonly",n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u(u(_("-",e),([t,n])=>u(_("readonly",n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u(u(_("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[F_(t),n]),N1=e=>u(u(u(_("+",e),([t,n])=>u(_("?",n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u(u(_("-",e),([t,n])=>u(_("?",n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u(u(_("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[j_(t),n]),L1=e=>u(u(u(_("as",e),([t,n])=>u(re(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[q_(t),n]),k1=e=>u(u(_("{",e),([t,n])=>u(v1(n),([o,i])=>u(_("[",i),([a,c])=>u(je(c),([l,m])=>u(_("in",m),([f,h])=>u(re(h),([E,I])=>u(L1(I),([g,T])=>u(_("]",T),([O,b])=>u(N1(b),([x,P])=>u(_(":",P),([me,cn])=>u(re(cn),([Br,Hr])=>u(BI(Hr),([e0,t0])=>u(_("}",t0),([r0,n0])=>[[t,o,a,l,f,E,g,O,x,me,Br,e0,r0],n0]))))))))))))),([t,n])=>[B_(t),n]),M1=e=>u(je(e),([t,n])=>[H_(t),n]),D1=e=>u(Om(e),([t,n])=>[K_(t),n]),G1=e=>u(Bp(e),([t,n])=>[z_(t),n]),$1=e=>u(u(_("true",e),([t,n])=>[t,n],()=>u(_("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[Y_(t),n]),F1=e=>u(Hp(['"',"'"],e),([t,n])=>[t,n]),j1=e=>u(_("null",e),([t,n])=>[V_(t),n]),q1=e=>u(_("undefined",e),([t,n])=>[void 0,n]),uS=e=>u(u(eS(e),([t,n])=>u(_(":",n),([o,i])=>u(wm(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[Q_(t),n]),lS=(e,t=[])=>u(u(zp(e),([n,o])=>u(uS(o),([i,a])=>[[n,i],a])),([n,o])=>lS(o,[...t,n]),()=>[t,e]),B1=e=>u(u(u(uS(e),([t,n])=>u(lS(n),([o,i])=>u(u(zp(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[W_(t),n]),mS=e=>u(u(_("{",e),([t,n])=>u(B1(n),([o,i])=>u(_("}",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[Z_(t),n]),dS=(e,t=[])=>u(u(_(",",e),([n,o])=>u(wm(o),([i,a])=>[[n,i],a])),([n,o])=>dS(o,[...t,n]),()=>[t,e]),H1=e=>u(u(u(wm(e),([t,n])=>u(dS(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[X_(t),n]),K1=e=>u(u(_("[",e),([t,n])=>u(H1(n),([o,i])=>u(_("]",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[J_(t),n]),wm=e=>u(u(D1(e),([t,n])=>[t,n],()=>u(G1(e),([t,n])=>[t,n],()=>u($1(e),([t,n])=>[t,n],()=>u(F1(e),([t,n])=>[t,n],()=>u(j1(e),([t,n])=>[t,n],()=>u(q1(e),([t,n])=>[t,n],()=>u(mS(e),([t,n])=>[t,n],()=>u(K1(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),z1=e=>u(_("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[eI(t),n]),Y1=e=>u(_(".*",e),([t,n])=>[tI(t),n]),V1=e=>u(_("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[rI(t),n]),Q1=e=>u(_("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[nI(t),n]),W1=e=>u(_("(?!)",e),([t,n])=>[oI(t),n]),Z1=e=>u(DI(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[iI(t),n]),X1=e=>u(u(z1(e),([t,n])=>[t,n],()=>u(Y1(e),([t,n])=>[t,n],()=>u(V1(e),([t,n])=>[t,n],()=>u(Q1(e),([t,n])=>[t,n],()=>u(W1(e),([t,n])=>[t,n],()=>u(J1(e),([t,n])=>[t,n],()=>u(Z1(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),J1=e=>u(u(_("(",e),([t,n])=>u(vm(n),([o,i])=>u(_(")",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[aI(t),n]),fS=e=>u(u(u(Rm(e),([t,n])=>u(_("|",n),([o,i])=>u(fS(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u(u(Rm(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[sI(t),n]),Rm=e=>u(u(X1(e),([t,n])=>u(vm(n),([o,i])=>[[t,o],i])),([t,n])=>[cI(t),n]),vm=e=>u(u(fS(e),([t,n])=>[t,n],()=>u(Rm(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),HT=e=>u(u(_("^",e),([t,n])=>u(vm(n),([o,i])=>u(_("$",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[pI(t),n]),gS=(e,t=[])=>u(u(_(",",e),([n,o])=>u(re(o),([i,a])=>[[n,i],a])),([n,o])=>gS(o,[...t,n]),()=>[t,e]),eF=e=>u(u(u(re(e),([t,n])=>u(gS(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[uI(t),n]),hS=e=>u(u(u(_("extends",e),([t,n])=>u(eF(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[lI(t),n]),tF=e=>u(u(_("interface",e),([t,n])=>u(je(n),([o,i])=>u(Cm(i),([a,c])=>u(hS(c),([l,m])=>u(Um(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[mI(t),n]),rF=e=>u(u(_("interface",e),([t,n])=>u(je(n),([o,i])=>u(hS(i),([a,c])=>u(Um(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[dI(t),n]),nF=e=>u(u(_("type",e),([t,n])=>u(je(n),([o,i])=>u(Cm(i),([a,c])=>u(_("=",c),([l,m])=>u(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[fI(t),n]),oF=e=>u(u(_("type",e),([t,n])=>u(je(n),([o,i])=>u(_("=",i),([a,c])=>u(re(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[gI(t),n]),iF=e=>u(u(u(_("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[hI(t),n]),yS=e=>u(u(u(_(";",e),([t,n])=>u(_(`
31
+ `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),aS=(e,t=[])=>u(u(Yp(e),([n,o])=>u(iS(o),([i,a])=>[[n,i],a])),([n,o])=>aS(o,[...t,n]),()=>[t,e]),A1=e=>u(u(u(iS(e),([t,n])=>u(aS(n),([o,i])=>u(u(Yp(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[A_(t),n]),vm=e=>u(u(_("{",e),([t,n])=>u(A1(n),([o,i])=>u(_("}",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[R_(t),n]),x1=e=>u(vm(e),([t,n])=>[C_(t),n]),R1=e=>u(u(u(je(e),([t,n])=>u(_("?",n),([o,i])=>u(_(":",i),([a,c])=>u(_("readonly",c),([l,m])=>u(ne(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[t,n],()=>u(u(je(e),([t,n])=>u(_(":",n),([o,i])=>u(_("readonly",i),([a,c])=>u(ne(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[t,n],()=>u(u(je(e),([t,n])=>u(_("?",n),([o,i])=>u(_(":",i),([a,c])=>u(ne(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[t,n],()=>u(u(je(e),([t,n])=>u(_(":",n),([o,i])=>u(ne(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[P_(t),n]),FI=e=>u(u(R1(e),([t,n])=>[t,n],()=>u(u(nS(e),([t,n])=>u(ne(n),([o,i])=>u(oS(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>[])),([t,n])=>[U_(t),n]),sS=e=>u(u(u(_("...",e),([t,n])=>u(FI(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u(u(FI(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[w_(t),n]),cS=(e,t=[])=>u(u(_(",",e),([n,o])=>u(sS(o),([i,a])=>[[n,i],a])),([n,o])=>cS(o,[...t,n]),()=>[t,e]),C1=e=>u(u(u(sS(e),([t,n])=>u(cS(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[v_(t),n]),P1=e=>u(u(_("[",e),([t,n])=>u(C1(n),([o,i])=>u(_("]",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[N_(t),n]),U1=e=>u(u(je(e),([t,n])=>u(_("?",n),([o,i])=>u(_(":",i),([a,c])=>u(_("readonly",c),([l,m])=>u(ne(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[L_(t),n]),w1=e=>u(u(je(e),([t,n])=>u(_(":",n),([o,i])=>u(_("readonly",i),([a,c])=>u(ne(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[k_(t),n]),v1=e=>u(u(je(e),([t,n])=>u(_("?",n),([o,i])=>u(_(":",i),([a,c])=>u(ne(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[M_(t),n]),N1=e=>u(u(je(e),([t,n])=>u(_(":",n),([o,i])=>u(ne(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[D_(t),n]),jI=e=>u(u(U1(e),([t,n])=>[t,n],()=>u(w1(e),([t,n])=>[t,n],()=>u(v1(e),([t,n])=>[t,n],()=>u(N1(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),pS=e=>u(u(u(_("...",e),([t,n])=>u(jI(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u(u(jI(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[G_(t),n]),uS=(e,t=[])=>u(u(_(",",e),([n,o])=>u(pS(o),([i,a])=>[[n,i],a])),([n,o])=>uS(o,[...t,n]),()=>[t,e]),lS=e=>u(u(u(pS(e),([t,n])=>u(uS(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[$_(t),n]),L1=e=>u(u(_("(",e),([t,n])=>u(lS(n),([o,i])=>u(_(")",i),([a,c])=>u(_("=>",c),([l,m])=>u(ne(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[F_(t),n]),k1=e=>u(u(_("new",e),([t,n])=>u(_("(",n),([o,i])=>u(lS(i),([a,c])=>u(_(")",c),([l,m])=>u(_("=>",m),([f,h])=>u(ne(h),([E,I])=>[[t,o,a,l,f,E],I])))))),([t,n])=>[j_(t),n]),M1=e=>u(u(u(_("+",e),([t,n])=>u(_("readonly",n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u(u(_("-",e),([t,n])=>u(_("readonly",n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u(u(_("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[q_(t),n]),D1=e=>u(u(u(_("+",e),([t,n])=>u(_("?",n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u(u(_("-",e),([t,n])=>u(_("?",n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u(u(_("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[B_(t),n]),G1=e=>u(u(u(_("as",e),([t,n])=>u(ne(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[H_(t),n]),$1=e=>u(u(_("{",e),([t,n])=>u(M1(n),([o,i])=>u(_("[",i),([a,c])=>u(je(c),([l,m])=>u(_("in",m),([f,h])=>u(ne(h),([E,I])=>u(G1(I),([g,T])=>u(_("]",T),([O,b])=>u(D1(b),([x,P])=>u(_(":",P),([me,cn])=>u(ne(cn),([Br,Hr])=>u(KI(Hr),([o0,i0])=>u(_("}",i0),([a0,s0])=>[[t,o,a,l,f,E,g,O,x,me,Br,o0,a0],s0]))))))))))))),([t,n])=>[K_(t),n]),F1=e=>u(je(e),([t,n])=>[z_(t),n]),j1=e=>u(xm(e),([t,n])=>[Y_(t),n]),q1=e=>u(Hp(e),([t,n])=>[V_(t),n]),B1=e=>u(u(_("true",e),([t,n])=>[t,n],()=>u(_("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[Q_(t),n]),H1=e=>u(Kp(['"',"'"],e),([t,n])=>[t,n]),K1=e=>u(_("null",e),([t,n])=>[W_(t),n]),z1=e=>u(_("undefined",e),([t,n])=>[void 0,n]),mS=e=>u(u(rS(e),([t,n])=>u(_(":",n),([o,i])=>u(Nm(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[Z_(t),n]),dS=(e,t=[])=>u(u(Yp(e),([n,o])=>u(mS(o),([i,a])=>[[n,i],a])),([n,o])=>dS(o,[...t,n]),()=>[t,e]),Y1=e=>u(u(u(mS(e),([t,n])=>u(dS(n),([o,i])=>u(u(Yp(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[X_(t),n]),fS=e=>u(u(_("{",e),([t,n])=>u(Y1(n),([o,i])=>u(_("}",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[J_(t),n]),gS=(e,t=[])=>u(u(_(",",e),([n,o])=>u(Nm(o),([i,a])=>[[n,i],a])),([n,o])=>gS(o,[...t,n]),()=>[t,e]),V1=e=>u(u(u(Nm(e),([t,n])=>u(gS(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[eI(t),n]),Q1=e=>u(u(_("[",e),([t,n])=>u(V1(n),([o,i])=>u(_("]",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[tI(t),n]),Nm=e=>u(u(j1(e),([t,n])=>[t,n],()=>u(q1(e),([t,n])=>[t,n],()=>u(B1(e),([t,n])=>[t,n],()=>u(H1(e),([t,n])=>[t,n],()=>u(K1(e),([t,n])=>[t,n],()=>u(z1(e),([t,n])=>[t,n],()=>u(fS(e),([t,n])=>[t,n],()=>u(Q1(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),W1=e=>u(_("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[rI(t),n]),Z1=e=>u(_(".*",e),([t,n])=>[nI(t),n]),X1=e=>u(_("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[oI(t),n]),J1=e=>u(_("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[iI(t),n]),eF=e=>u(_("(?!)",e),([t,n])=>[aI(t),n]),tF=e=>u($I(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[sI(t),n]),rF=e=>u(u(W1(e),([t,n])=>[t,n],()=>u(Z1(e),([t,n])=>[t,n],()=>u(X1(e),([t,n])=>[t,n],()=>u(J1(e),([t,n])=>[t,n],()=>u(eF(e),([t,n])=>[t,n],()=>u(nF(e),([t,n])=>[t,n],()=>u(tF(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),nF=e=>u(u(_("(",e),([t,n])=>u(Lm(n),([o,i])=>u(_(")",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[cI(t),n]),hS=e=>u(u(u(Pm(e),([t,n])=>u(_("|",n),([o,i])=>u(hS(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u(u(Pm(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[pI(t),n]),Pm=e=>u(u(rF(e),([t,n])=>u(Lm(n),([o,i])=>[[t,o],i])),([t,n])=>[uI(t),n]),Lm=e=>u(u(hS(e),([t,n])=>[t,n],()=>u(Pm(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),zT=e=>u(u(_("^",e),([t,n])=>u(Lm(n),([o,i])=>u(_("$",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[lI(t),n]),yS=(e,t=[])=>u(u(_(",",e),([n,o])=>u(ne(o),([i,a])=>[[n,i],a])),([n,o])=>yS(o,[...t,n]),()=>[t,e]),oF=e=>u(u(u(ne(e),([t,n])=>u(yS(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[mI(t),n]),TS=e=>u(u(u(_("extends",e),([t,n])=>u(oF(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[dI(t),n]),iF=e=>u(u(_("interface",e),([t,n])=>u(je(n),([o,i])=>u(Um(i),([a,c])=>u(TS(c),([l,m])=>u(vm(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[fI(t),n]),aF=e=>u(u(_("interface",e),([t,n])=>u(je(n),([o,i])=>u(TS(i),([a,c])=>u(vm(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[gI(t),n]),sF=e=>u(u(_("type",e),([t,n])=>u(je(n),([o,i])=>u(Um(i),([a,c])=>u(_("=",c),([l,m])=>u(ne(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[hI(t),n]),cF=e=>u(u(_("type",e),([t,n])=>u(je(n),([o,i])=>u(_("=",i),([a,c])=>u(ne(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[yI(t),n]),pF=e=>u(u(u(_("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[TI(t),n]),ES=e=>u(u(u(_(";",e),([t,n])=>u(_(`
32
32
  `,n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>u(u(_(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u(u(_(`
33
- `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),TS=(e,t=[])=>u(u(yS(e),([n,o])=>u(Nm(o),([i,a])=>[[n,i],a])),([n,o])=>TS(o,[...t,n]),()=>[t,e]),aF=e=>u(u(u(Nm(e),([t,n])=>u(TS(n),([o,i])=>u(u(yS(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[yI(t),n]),Nm=e=>u(u(iF(e),([t,n])=>u(u(tF(n),([o,i])=>[o,i],()=>u(rF(n),([o,i])=>[o,i],()=>u(nF(n),([o,i])=>[o,i],()=>u(oF(n),([o,i])=>[o,i],()=>[])))),([o,i])=>u(BI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[TI(t),n]),sF=e=>u(u(Nm(e),([t,n])=>u(aF(n),([o,i])=>[[t,o],i])),([t,n])=>[EI(t),n]),ES=e=>u(u(sF(e),([t,n])=>[t,n],()=>u(g1(e),([t,n])=>[t,n],()=>u(re(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function _S(e){let t=Pm(`\`${e}\``);return s.IsEqual(t.length,2)?t[0]:he()}function pF(e){return e.join("|")}function uF(e){return e.slice(1,e.length-1)}function lF(e,t,n){return _n(t,`${n}${e}`)}function mF(e,t){return _n(e,`${t}${GT}`)}function dF(e,t){return _n(e,`${t}${np}`)}function fF(e,t){return _n(e,`${t}${sp}`)}function gF(e,t){return Ka(q([Y("false"),Y("true")]),e,t)}function hF(e,t){return _n(e,`${t}${cp}`)}function yF(e,t,n){return _n(t,`${n}${uF(e)}`)}function TF(e,t,n){let o=za(e,{});return Ka(o,t,n)}function EF(e,t,n){let o=Lt(e);return Ka(o,t,n)}function IS(e,t,n,o=[]){return s.ShiftLeft(e,(i,a)=>IS(a,t,n,[...o,Ka(i,[],"")]),()=>_n(t,`${n}(${pF(o)})`))}function Ka(e,t,n){return We(e)?EF(e.enum,t,n):ct(e)?dF(t,n):W(e)?lF(e.const,t,n):kt(e)?mF(t,n):Ot(e)?gF(t,n):we(e)?fF(t,n):tt(e)?hF(t,n):_e(e)?yF(e.pattern,t,n):bS(e)?TF(e.parameters[0],t,n):C(e)?IS(e.anyOf,t,n):mT}function _n(e,t){return s.ShiftLeft(e,(n,o)=>Ka(n,o,t),()=>t)}function _F(e){return`^${_n(e,"")}$`}function SS(e){let t=_F(e);return up(t)}function za(e,t){return K(e)?y.Update(SS(e),{},t):Ep(e,t)}function OS(e,t,n,o){let i=Bt(e,t,n);return za(i,o)}function Ep(e,t={}){return N("TemplateLiteral",[e],t)}function bS(e){return Le(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"TemplateLiteral")}function AS(e){return za(e,{})}function IF(e){let t=_S(e);return AS(t)}function xS(e,t={}){let n=s.IsString(e)?IF(e):AS(e);return y.Update(n,{},t)}function _e(e){return w(e,"TemplateLiteral")}var F={};Zt(F,{ExtendsFalse:()=>B,ExtendsTrue:()=>U,ExtendsUnion:()=>Lm,IsExtendsFalse:()=>SF,IsExtendsTrue:()=>CS,IsExtendsTrueLike:()=>ai,IsExtendsUnion:()=>RS,Match:()=>Re});function Lm(e){return y.Create({"~kind":"ExtendsUnion"},{inferred:e})}function RS(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsUnion")&&s.IsObject(e.inferred)}function U(e){return y.Create({"~kind":"ExtendsTrue"},{inferred:e})}function CS(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsTrue")&&s.IsObject(e.inferred)}function B(){return y.Create({"~kind":"ExtendsFalse"},{})}function SF(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function ai(e){return RS(e)||CS(e)}function Re(e,t,n){return ai(e)?t(e.inferred):n()}function bF(e,t,n,o){return Re(ee(e,n,o),i=>U(y.Assign(y.Assign(e,i),{[t]:n})),()=>B())}function OF(e,t){return U(e)}function AF(e,t,n,o,i){return Re(ee(e,t,n),a=>Re(ee(a,t,o),c=>U(c),()=>B()),()=>Re(ee(e,t,i),a=>U(a),()=>B()))}function xF(e,t,n){let o=Lt(n);return ee(e,t,o)}function PS(e,t,n){return s.ShiftLeft(n,(o,i)=>Re(ee(e,t,o),a=>PS(a,t,i),()=>B()),()=>U(e))}function RF(e,t,n){let o=_t(n);return ee(e,t,o)}function US(e,t,n){return s.ShiftLeft(n,(o,i)=>Re(ee(e,t,o),a=>U(a),()=>US(e,t,i)),()=>B())}function ce(e,t,n){return Je(n)?OF(e,t):$e(n)?AF(e,t,n.if,n.then,n.else):We(n)?xF(e,t,n.enum):Qe(n)?bF(e,n.name,t,n.extends):G(n)?PS(e,t,n.allOf):_e(n)?RF(e,t,n.pattern):C(n)?US(e,t,n.anyOf):ot(n)?U(e):B()}function wS(e,t,n){return Qe(n)?ce(e,t,n):Je(n)?U(e):ot(n)?U(e):Lm(e)}function CF(e,t){let n=ro(e),o=ro(t);return n&&o||!n&&o?!0:!(n&&!o)}function vS(e,t,n,o){return X(o)?CF(t,o)?ee(e,n,o.items):B():ce(e,t,o)}function NS(e,t,n){return kt(n)?U(e):ce(e,t,n)}function LS(e,t,n){return Ot(n)?U(e):ce(e,t,n)}function PF(e,t,n,o,i){let a=Qe(o)?t:o,c=Qe(o)?o:t,l=nt(t),m=nt(o);return!l&&m?B():Re(ee(e,a,c),f=>Ya(f,n,i),()=>B())}function UF(e,t,n,o){return s.ShiftLeft(o,(i,a)=>PF(e,t,n,i,a),()=>nt(t)?U(e):B())}function wF(e,t,n){return s.ShiftLeft(t,(o,i)=>UF(e,o,i,n),()=>U(e))}function Ya(e,t,n){return wF(e,t,n)}function Yp(e,t,n){return Gt(n)?U(e):ee(e,t,n)}function kS(e,t,n,o){return Je(o)?U(e):ot(o)?U(e):Ye(o)?Re(Ya(e,t,o.parameters),i=>Yp(i,n,o.instanceType),()=>B()):B()}function MS(e,t,n,o,i){return Re(ee(e,t,i),()=>ee(e,n,i),()=>ee(e,o,i))}function DS(e,t,n){let o=Lt(t);return ee(e,o,n)}function GS(e,t,n,o){return Je(o)?U(e):ot(o)?U(e):Ve(o)?Re(Ya(e,t,o.parameters),i=>Yp(i,n,o.returnType),()=>B()):B()}function $S(e,t,n){return ct(n)?U(e):we(n)?U(e):ce(e,t,n)}function FS(e,t,n){let o=ke(t);return ee(e,o,n)}function Vp(e,t,n){return t===n?U(e):B()}function vF(e,t,n){return W(n)?Vp(e,t,n.const):kt(n)?U(e):ce(e,Y(t),n)}function NF(e,t,n){return W(n)?Vp(e,t,n.const):Ot(n)?U(e):ce(e,Y(t),n)}function LF(e,t,n){return W(n)?Vp(e,t,n.const):we(n)?U(e):ce(e,Y(t),n)}function kF(e,t,n){return W(n)?Vp(e,t,n.const):tt(n)?U(e):ce(e,Y(t),n)}function jS(e,t,n){return s.IsBigInt(t.const)?vF(e,t.const,n):s.IsBoolean(t.const)?NF(e,t.const,n):s.IsNumber(t.const)?LF(e,t.const,n):s.IsString(t.const)?kF(e,t.const,n):he()}function qS(e,t,n){return Qe(n)?ce(e,t,n):U(e)}function BS(e,t,n){return Ar(n)?U(e):ce(e,t,n)}function HS(e,t,n){return we(n)?U(e):ce(e,t,n)}function MF(e,t,n){return nt(t)?nt(n)?U(e):B():U(e)}function DF(e,t,n){return Qe(n)&&lr(n.extends)?B():Re(ee(e,t,n),o=>MF(o,t,n),()=>B())}function GF(e,t){return e.reduce((n,o)=>o in t?ai(t[o])?{...n,...t[o].inferred}:he():he(),{})}function $F(e,t,n){let o={};for(let c of s.Keys(n))o[c]=c in t?DF({},t[c],n[c]):nt(n[c])?Qe(n[c])?U(y.Assign(e,{[n[c].name]:n[c].extends})):U(e):B();let i=s.Values(o).every(c=>ai(c)),a=i?GF(s.Keys(o),o):{};return i?U(a):B()}function FF(e,t,n){let o=$F(e,t,n);return ai(o)?U(y.Assign(e,o.inferred)):B()}function jF(e,t,n){return FF(e,t,n)}function qF(e,t){return s.Keys(t).reduce((n,o)=>({...n,[o]:s.HasPropertyKey(e,o)?C(n[o])?q([...n[o].anyOf,t[o]]):q([e[o],t[o]]):t[o]}),e)}function KS(e,t,n,o){return s.ShiftLeft(t,(i,a)=>Re(ee({},e[i],n),c=>KS(e,a,n,qF(o,c)),()=>B()),()=>U(o))}function BF(e,t,n,o){let i=s.Keys(t);return KS(t,i,o,e)}function zS(e,t,n){return ge(n)?BF(e,t,pt(n),xe(n)):$(n)?jF(e,t,n.properties):ce(e,D(t),n)}function HF(e,t){return s.IsEqual(s.Keys(t).length,0)?U(e):B()}function KF(e,t,n,o,i){return ee(e,n,i)}function YS(e,t,n,o){return ge(o)?KF(e,gp(t),n,gp(pt(o)),xe(o)):$(o)?HF(e,o.properties):Je(o)?U(e):ot(o)?U(e):B()}function VS(e,t,n){return tt(n)?U(e):ce(e,t,n)}function QS(e,t,n){return xr(n)?U(e):ce(e,t,n)}function WS(e,t,n){let o=_t(t);return ee(e,o,n)}function km(e,t){return y.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function Va(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 Mm(e){return yn(e)?Qe(e.items)?X(e.items.extends)?km(e.items.name,e.items.extends.items):ot(e.items.extends)?km(e.items.name,e.items.extends):void 0:he():void 0}function Qp(e){return Qe(e)?km(e.name,e.extends):void 0}function Dm(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>Re(ee({},o,t),()=>Dm(i,t,[...n,o]),()=>{}),()=>n)}function ZS(e,t,n,o){let i=Dm(n,o);return s.IsArray(i)?U(y.Assign(e,{[t]:Fe(i)})):B()}function Wp(e,t,n,o){let i=Dm(n,o);return s.IsArray(i)?U(y.Assign(e,{[t]:q(i)})):B()}function zF(e){return[...e].reverse()}function Gm(e,t){return t?zF(e):e}function YF(e){let t=e.length>0?e[0]:void 0,n=Le(t)?Mm(t):void 0;return Le(n)}function VF(e,t,n,o,i,a){return Re(ee(e,n,i),c=>XS(c,t,o,a),()=>B())}function QF(e,t,n,o,i){let a=Mm(o);return Va(a)?ZS(e,a.name,Gm(n,t),a.type):s.ShiftLeft(n,(c,l)=>VF(e,t,c,l,o,i),()=>B())}function WF(e,t,n,o){return s.ShiftLeft(o,(i,a)=>QF(e,t,n,i,a),()=>s.IsEqual(n.length,0)?U(e):B())}function XS(e,t,n,o){return WF(e,t,n,o)}function ZF(e,t,n){let o=In(e,Oe([],[]),n),i=YF(o);return XS(e,i,Gm(t,i),Gm(o,i))}function JS(e,t,n){let o=Qp(n);return Va(o)?Wp(e,o.name,t,o.type):s.ShiftLeft(t,(i,a)=>Re(ee(e,i,n),c=>JS(c,a,n),()=>B()),()=>U(e))}function eb(e,t,n){let o=In(e,Oe([],[]),t);return V(n)?ZF(e,o,n.items):X(n)?JS(e,o,n.items):ce(e,Fe(o),n)}function tb(e,t,n){return Gt(n)?U(e):dr(n)?U(e):ce(e,t,n)}function rb(e,t,n){return s.ShiftLeft(n,(o,i)=>Re(ee(e,t,o),a=>U(a),()=>rb(e,t,i)),()=>B())}function $m(e,t,n){return s.ShiftLeft(t,(o,i)=>Re(rb(e,o,n),a=>$m(a,i,n),()=>B()),()=>U(e))}function nb(e,t,n){let o=Qp(n);return Va(o)?Wp(e,o.name,t,o.type):C(n)?$m(e,t,n.anyOf):$m(e,t,[n])}function ob(e,t,n){return Qe(n)?ce(e,t,n):Je(n)?U(e):ot(n)?U(e):B()}function ib(e,t,n){return Gt(n)?U(e):ce(e,t,n)}function ee(e,t,n){return Je(t)?wS(e,t,n):X(t)?vS(e,t,t.items,n):kt(t)?NS(e,t,n):Ot(t)?LS(e,t,n):Ye(t)?kS(e,t.parameters,t.instanceType,n):$e(t)?MS(e,t.if,t.then,t.else,n):We(t)?DS(e,t.enum,n):Ve(t)?GS(e,t.parameters,t.returnType,n):ct(t)?$S(e,t,n):G(t)?FS(e,t.allOf,n):W(t)?jS(e,t,n):lr(t)?qS(e,t,n):Ar(t)?BS(e,t,n):we(t)?HS(e,t,n):$(t)?zS(e,t.properties,n):ge(t)?YS(e,pt(t),xe(t),n):tt(t)?VS(e,t,n):xr(t)?QS(e,t,n):_e(t)?WS(e,t.pattern,n):V(t)?eb(e,t.items,n):dr(t)?tb(e,t,n):C(t)?nb(e,t.anyOf,n):ot(t)?ob(e,t,n):Gt(t)?ib(e,t,n):B()}function XF(e,t){return ke([...e,D(t)])}function Fm(e,t,n){return K(e)?y.Update(XF(e,t),{},n):Fa(e,t,n)}function ab(e,t,n,o,i){let a=Bt(e,t,n),c=Qa(e,t,o);return Fm(a,c,i)}function Fa(e,t,n={}){return N("Interface",[e,t],n)}function si(e){return Le(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function sb(e,t,n={}){return Fm(e,t,n)}function JF(e,t,n){return e.includes(n)?!0:Wa([...e,n],t,t[n])}function cb(e,t,n){let o=Xc(n);return uo(e,t,o)}function uo(e,t,n){return s.ShiftLeft(n,(o,i)=>Wa(e,t,o)?!0:uo(e,t,i),()=>!1)}function Wa(e,t,n){return ue(n)?JF(e,t,n.$ref):X(n)?Wa(e,t,n.items):Ye(n)?uo(e,t,[...n.parameters,n.instanceType]):Ve(n)?uo(e,t,[...n.parameters,n.returnType]):si(n)?cb(e,t,n.parameters[1]):G(n)?uo(e,t,n.allOf):$(n)?cb(e,t,n.properties):C(n)?uo(e,t,n.anyOf):V(n)?uo(e,t,n.items):ge(n)?Wa(e,t,xe(n)):!1}function pb(e,t,n){return Wa(e,t,n)}function ej(e,t){return t.reduce((n,o)=>pb([o],e,e[o])?[...n,o]:n,[])}function ub(e){let t=Zc(e);return ej(e,t)}function tj(e,t,n){return n.includes(t)?n:t in e?Za(e,e[t],[...n,t]):he()}function lb(e,t,n){let o=Xc(t);return ci(e,o,n)}function ci(e,t,n){return t.reduce((o,i)=>Za(e,i,o),n)}function Za(e,t,n){return ue(t)?tj(e,t.$ref,n):X(t)?Za(e,t.items,n):Ye(t)?ci(e,[...t.parameters,t.instanceType],n):Ve(t)?ci(e,[...t.parameters,t.returnType],n):si(t)?lb(e,t.parameters[1],n):G(t)?ci(e,t.allOf,n):$(t)?lb(e,t.properties,n):C(t)?ci(e,t.anyOf,n):V(t)?ci(e,t.items,n):ge(t)?Za(e,xe(t),n):n}function mb(e,t,n){return Za(e,n,[t])}function rj(e){return Vo()}function nj(e){return s.Keys(e).reduce((t,n)=>({...t,[n]:lo(e[n])}),{})}function Xa(e){return e.reduce((t,n)=>[...t,lo(n)],[])}function lo(e){return ue(e)?rj(e.$ref):X(e)?vt(lo(e.items),zo(e)):Ye(e)?_r(Xa(e.parameters),lo(e.instanceType)):Ve(e)?Ir(Xa(e.parameters),lo(e.returnType)):G(e)?dt(Xa(e.allOf)):$(e)?D(nj(e.properties)):ge(e)?ti(hn(e),lo(xe(e))):C(e)?q(Xa(e.anyOf)):V(e)?Fe(Xa(e.items)):e}function oj(e,t){return t in e?lo(e[t]):et()}function db(e){return oj(e.$defs,e.$ref)}function ij(e,t,n){let o=Bt(e,Oe([],[]),t),i=Qa({},Oe([],[]),n);return ke([...o,D(i)])}function aj(e,t){return s.Keys(e).filter(o=>t.includes(o)).reduce((o,i)=>{let a=e[i],c=si(a)?ij(e,a.parameters[0],a.parameters[1]):a;return{...o,[i]:c}},{})}function fb(e,t,n){let o=mb(e,t,n),i=aj(e,o);return br(i,t)}function gb(e,t){return t in e?ue(e[t])?gb(e,e[t].$ref):e[t]:fe()}function Rr(e,t){return gb(e,t)}function hb(e){return Ee(e)?db(e):Jc(e)?et():e}function ht(e,t,n){let o=hb(t),i=hb(n);return ee(e,o,i)}var ka="equal",sj="disjoint",Ma="left-inside",Da="right-inside";function so(e,t){let n=[ot(e)?F.ExtendsFalse():ht({},e,t),ot(e)?F.ExtendsTrue({}):ht({},t,e)];return F.IsExtendsTrueLike(n[0])&&F.IsExtendsTrueLike(n[1])?ka:F.IsExtendsTrueLike(n[0])&&F.IsExtendsFalse(n[1])?Ma:F.IsExtendsFalse(n[0])&&F.IsExtendsTrueLike(n[1])?Da:sj}function cj(e,t){return t.filter(n=>so(e,n)!==Da)}function pj(e,t){let n=t.some(o=>{let i=so(e,o);return s.IsEqual(i,Ma)||s.IsEqual(i,ka)});return s.IsEqual(n,!1)}function uj(e,t){let n=Xt(e);return Je(n)?[n]:pj(n,t)?[...cj(n,t),n]:t}function lj(e){return e.reduce((t,n)=>$(n)?[...t,n]:lr(n)?t:uj(n,t),[])}function Tm(e){let t=lj(e);return ei(t)}function jm(e,t){return y.Update(Xt(e),{},t)}function yb(e,t,n,o){let i=A(e,t,n);return jm(i,o)}function Ja(e,t=[]){return ln(e)&&s.IsEqual(e.action,"Conditional")?ue(e.parameters[0])?Ja(e.parameters[2],Ja(e.parameters[3],[...t,e.parameters[0].$ref])):Ja(e.parameters[2],Ja(e.parameters[3],t)):ln(e)&&s.IsEqual(e.action,"Mapped")&&ln(e.parameters[1])&&s.IsEqual(e.parameters[1].action,"KeyOf")&&ue(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function mj(e,t){return e.reduce((n,o)=>[...n,t.includes(o.name)],[])}function _b(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>s.ShiftLeft(t,(a,c)=>_b(i,c,[...n,[a,o]]),()=>n),()=>n)}function dj(e){return _e(e)?_t(e.pattern):We(e)?Lt(e.enum):e}function fj(e){let t=dj(e);return C(t)?[...t.anyOf]:[t]}function gj(e,t){return e.reduce((n,o)=>[...n,[...o,t]],[])}function Tb(e,t){return t.reduce((n,o)=>[...n,...gj(e,o)],[])}function Eb(e){return e.reduce((t,n)=>s.IsEqual(n[0],!0)?Tb(t,fj(n[1])):Tb(t,[n[1]]),[[]])}function Ib(e,t,n){let o=Ja(n),i=mj(e,o),a=_b(t,i);return ln(n)&&s.IsEqual(n.action,"Conditional")||ln(n)&&s.IsEqual(n.action,"Mapped")?Eb(a):[t]}function hj(){return["(not-resolvable)",fe()]}function yj(){return["(not-generic)",fe()]}function Tj(e,t,n){return[e,mn(t,n)]}function Ej(e,t,n){return t in e?Sb(e,t,e[t],n):hj()}function Sb(e,t,n,o){return Yo(n)?Tj(t,n.parameters,n.expression):ue(n)?Ej(e,n.$ref,o):yj()}function bb(e,t,n){return Sb(e,"(anonymous)",t,n)}function _j(e,t,n){if(Qe(t)||pi(t)||F.IsExtendsTrueLike(ht({},t,n)))return;let o={parameter:e,expect:n,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:o})}function Ob(e,t,n,o,i){let a=A(e,t,i);return _j(n,a,o),y.Assign(e,{[n]:a})}function Ij(e,t,n,o,i){let a=A(e,t,n.extends),c=A(e,t,n.equals);return s.ShiftLeft(i,(l,m)=>qm(Ob(e,t,n.name,a,l),t,o,m),()=>qm(Ob(e,t,n.name,a,c),t,o,[]))}function qm(e,t,n,o){return s.ShiftLeft(n,(i,a)=>Ij(e,t,i,a,o),()=>e)}function Ab(e,t,n,o){return qm(e,t,n,o)}var Bm=0,Hm=0;function Sj(){if(!s.IsLessThan(Hm,at.Get().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function bj(){Sj(),Hm++,Bm++}function Oj(){Bm--,s.IsEqual(Bm,0)&&(Hm=0)}function Aj(e){return s.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function xj(e,t){return s.IsEqual(Aj(e),t)}function Rj(e,t,n,o,i,a){bj();try{let c=Ab(e,t,o,a),l=A(c,Oe([...t.callstack,n.$ref],t.visited),i);return A(c,Oe([],[]),l)}finally{Oj()}}function Cj(e,t,n,o,i,a){return a.reduce((c,l)=>{let m=Rj(e,t,n,o,i,l);return[...c,m]},[])}function Pj(e,t,n,o,i,a){let c=Ib(o,a,i),l=Cj(e,t,n,o,i,c);return s.IsEqual(l.length,1)?l[0]:Dt(l)}function Zp(e,t,n,o){let i=Bt(e,t,o),a=bb(e,n,o),c=a[0],l=a[1];return Yo(l)?xj(t,c)?ja(st(c),i):Pj(e,t,st(c),l.parameters,l.expression,i):ja(n,i)}function ja(e,t){return y.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function xb(e,t){return Zp({},Oe([],[]),e,t)}function pi(e){return w(e,"Call")}function Uj(e){return y.Discard(e,["~immutable"])}function Rb(e,t){return y.Update(Uj(e),{},t)}function Cb(e,t,n,o){let i=A(e,t,n);return Rb(i,o)}function Pb(e,t){return e(t)}function Ub(e,t){return s.IsString(t)?Y(Pb(e,t)):Y(t)}function wb(e,t){let n=_t(t);return Yr(e,n)}function vb(e,t){let n=t.map(o=>Yr(e,o));return q(n)}function Yr(e,t){return W(t)?Ub(e,t.const):_e(t)?wb(e,t.pattern):C(t)?vb(e,t.anyOf):t}function _p(e,t={}){return N("Capitalize",[e],t)}function Nb(e,t={}){return Km(e,t)}function Ip(e,t={}){return N("Lowercase",[e],t)}function Lb(e,t={}){return zm(e,t)}function Sp(e,t={}){return N("Uncapitalize",[e],t)}function kb(e,t={}){return Ym(e,t)}function bp(e,t={}){return N("Uppercase",[e],t)}function Mb(e,t={}){return Vm(e,t)}var wj=e=>e[0].toUpperCase()+e.slice(1),vj=e=>e.toLowerCase(),Nj=e=>e[0].toLowerCase()+e.slice(1),Lj=e=>e.toUpperCase();function Km(e,t){return K([e])?y.Update(Yr(wj,e),{},t):_p(e,t)}function zm(e,t){return K([e])?y.Update(Yr(vj,e),{},t):Ip(e,t)}function Ym(e,t){return K([e])?y.Update(Yr(Nj,e),{},t):Sp(e,t)}function Vm(e,t){return K([e])?y.Update(Yr(Lj,e),{},t):bp(e,t)}function Db(e,t,n,o){let i=A(e,t,n);return Km(i,o)}function Gb(e,t,n,o){let i=A(e,t,n);return zm(i,o)}function $b(e,t,n,o){let i=A(e,t,n);return Ym(i,o)}function Fb(e,t,n,o){let i=A(e,t,n);return Vm(i,o)}function Op(e,t,n,o,i={}){return N("Conditional",[e,t,n,o],i)}function jb(e,t,n,o,i={}){return Qm({},Oe([],[]),e,t,n,o,i)}function kj(e,t,n,o,i,a){let c=ht(e,n,o);return F.IsExtendsUnion(c)?q([A(c.inferred,t,i),A(e,t,a)]):F.IsExtendsTrue(c)?A(c.inferred,t,i):A(e,t,a)}function Qm(e,t,n,o,i,a,c){return K([n,o])?y.Update(kj(e,t,n,o,i,a),{},c):Op(n,o,i,a,c)}function qb(e,t,n,o,i,a,c){let l=A(e,t,n),m=A(e,t,o);return Qm(e,t,l,m,i,a,c)}function Ap(e,t={}){return N("ConstructorParameters",[e],t)}function Bb(e,t={}){return Wm(e,t)}function Mj(e){let t=Ye(e)?e.parameters:[],n=In({},Oe([],[]),t);return Fe(n)}function Wm(e,t){return K([e])?y.Update(Mj(e),{},t):Ap(e,t)}function Hb(e,t,n,o){let i=A(e,t,n);return Wm(i,o)}function xp(e,t,n={}){return N("Exclude",[e,t],n)}function Kb(e,t,n={}){return es(e,t,n)}function es(e,t,n){return K([e,t])?y.Update(mp(e,t),{},n):xp(e,t,n)}function zb(e,t,n,o,i){let a=A(e,t,n),c=A(e,t,o);return es(a,c,i)}function Rp(e,t,n={}){return N("Extract",[e,t],n)}function Yb(e,t,n={}){return Zm(e,t,n)}function Dj(e,t){let n=ht({},e,t);return F.IsExtendsTrueLike(n)?[e]:[]}function Gj(e,t){return e.reduce((n,o)=>[...n,...Dj(o,t)],[])}function Vb(e,t){let n=Xt(e),o=C(n)?n.anyOf:[n],i=Gj(o,t);return Dt(i)}function Zm(e,t,n){return K([e,t])?y.Update(Vb(e,t),{},n):Rp(e,t,n)}function Qb(e,t,n,o,i){let a=A(e,t,n),c=A(e,t,o);return Zm(a,c,i)}function $j(e){return e.reduce((t,n)=>op(n)?[...t,Y(n)]:t,[])}function ui(e){let t=$j(e);return q(t)}function qa(e,t,n={}){return N("Index",[e,t],n)}function Wb(e,t,n={}){let o=s.IsArray(t)?ui(t):t;return Xm(e,o,n)}function Zb(e,t){let n=Rr(e,t);return Ht(n)}function Xb(e,t,n){let o=mr(e,t,n);return Ht(o)}function Fj(e,t){let n=s.Keys(e).filter(h=>!s.HasPropertyKey(t,h)),o=s.Keys(t).filter(h=>!s.HasPropertyKey(e,h)),i=s.Keys(e).filter(h=>s.HasPropertyKey(t,h)),a=n.reduce((h,E)=>({...h,[E]:e[E]}),{}),c=o.reduce((h,E)=>({...h,[E]:t[E]}),{}),l=i.reduce((h,E)=>({...h,[E]:ke([e[E],t[E]])}),{}),m=y.Assign(a,c);return y.Assign(m,l)}function Jb(e){return e.reduce((t,n)=>Fj(t,Ht(n)),{})}function eO(e){let t=iE(Fe(e));return Ht(t)}function jj(e,t){return s.Keys(e).filter(i=>i in t).reduce((i,a)=>({...i,[a]:Dt([e[a],t[a]])}),{})}function tO(e,t){return s.ShiftLeft(e,(n,o)=>tO(o,jj(t,Ht(n))),()=>t)}function rO(e){return s.ShiftLeft(e,(t,n)=>tO(n,Ht(t)),()=>he())}function Ht(e){return Ee(e)?Zb(e.$defs,e.$ref):$e(e)?Xb(e.if,e.then,e.else):G(e)?Jb(e.allOf):C(e)?rO(e.anyOf):V(e)?eO(e.items):$(e)?e.properties:{}}function li(e){let t=Ht(e);return D(t)}var qj=new RegExp("^(?:0|[1-9][0-9]*)$");function mi(e){let t=`${e}`;return qj.test(t)?parseInt(t):e}function Bj(e){return Y(mi(e))}function nO(e){return e.map(t=>oO(t))}function oO(e){return G(e)?dt(nO(e.allOf)):C(e)?q(nO(e.anyOf)):W(e)?Bj(e.const):e}function iO(e,t){let n=oO(t),o=ht({},n,Mt());return F.IsExtendsTrueLike(o)?e:W(t)&&s.IsEqual(t.const,"length")?Mt():fe()}function aO(e,t){let n=Rr(e,t);return $t(n)}function sO(e,t,n){let o=mr(e,t,n);return $t(o)}function cO(e){let t=Lt(e);return $t(t)}function pO(e){let t=ke(e);return $t(t)}function uO(e){return[`${e}`]}function lO(e){let t=_t(e);return $t(t)}function mO(e){return e.reduce((t,n)=>[...t,...$t(n)],[])}function $t(e){return Ee(e)?aO(e.$defs,e.$ref):$e(e)?sO(e.if,e.then,e.else):We(e)?cO(e.enum):G(e)?pO(e.allOf):W(e)?uO(e.const):_e(e)?lO(e.pattern):C(e)?mO(e.anyOf):[]}function di(e){return $t(e)}function ts(e,t){return t.map(n=>rs(e,n))}function rs(e,t){return X(t)?vt(rs(e,t.items)):Ye(t)?_r(ts(e,t.parameters),rs(e,t.instanceType)):Ve(t)?Ir(ts(e,t.parameters),rs(e,t.returnType)):V(t)?Fe(ts(e,t.items)):C(t)?q(ts(e,t.anyOf)):G(t)?dt(ts(e,t.allOf)):yp(t)?D(e):t}function dO(e,t){return rs(e,t)}function Hj(e,t){let n=t in e?e[t]:fe();return dO(e,n)}function fO(e,t){return t.reduce((n,o)=>[...n,Hj(e,o)],[])}function Kj(e,t){let n=di(t),o=fO(e,n);return Dt(o)}var zj=new RegExp(gn);function Yj(e){return e.filter(n=>zj.test(n))}function Vj(e){let t=Zc(e),n=Yj(t),o=fO(e,n);return Dt(o)}function gO(e,t){return we(t)?Vj(e):Kj(e,t)}function Qj(e){return Y(mi(e))}function hO(e){return e.map(t=>Jm(t))}function Jm(e){return G(e)?dt(hO(e.allOf)):C(e)?q(hO(e.anyOf)):W(e)?Qj(e.const):e}function Wj(e,t){return e.reduceRight((n,o,i)=>{let a=ht({},Y(i),t);return F.IsExtendsTrueLike(a)?[o,...n]:n},[])}function Zj(e,t){let n=Jm(t),o=Wj(e,n);return Kr(o)}function Xj(e){return Kr(e)}function yO(e,t){return W(t)&&s.IsEqual(t.const,"length")?Y(e.length):we(t)||ct(t)?Xj(e):Zj(e,t)}function TO(e,t){return X(e)?iO(e.items,t):$(e)?gO(e.properties,t):V(e)?yO(e.items,t):fe()}function Jj(e){return Ee(e)||$e(e)||G(e)||C(e)?li(e):e}function Xm(e,t,n){return K([e,t])?y.Update(TO(Jj(e),t),{},n):qa(e,t,n)}function EO(e,t,n,o,i){let a=A(e,t,n),c=A(e,t,o);return Xm(a,c,i)}function Cp(e,t={}){return N("InstanceType",[e],t)}function _O(e,t={}){return ed(e,t)}function eq(e){return Ye(e)?e.instanceType:fe()}function ed(e,t){return K([e])?y.Update(eq(e),{},t):Cp(e,t)}function IO(e,t,n,o={}){let i=A(e,t,n);return ed(i,o)}function Ba(e,t={}){return N("KeyOf",[e],t)}function SO(e,t={}){return td(e,t)}function bO(){return q([Mt(),At(),Xo()])}function OO(e){return Mt()}function tq(e){return e.reduce((n,o)=>op(o)?[...n,Y(mi(o))]:he(),[])}function AO(e){let t=s.Keys(e),n=tq(t);return Kr(n)}function xO(e){return hn(e)}function RO(e){let t=e.map((n,o)=>Y(o));return Kr(t)}function CO(e){return Je(e)?bO():X(e)?OO(e.items):$(e)?AO(e.properties):ge(e)?xO(e):V(e)?RO(e.items):fe()}function rq(e){return Ee(e)||$e(e)||G(e)||C(e)?li(e):e}function td(e,t){return K([e])?y.Update(CO(rq(e)),{},t):Ba(e,t)}function PO(e,t,n,o){let i=A(e,t,n);return td(i,o)}function $a(e,t,n,o,i={}){return N("Mapped",[e,t,n,o],i)}function UO(e,t,n,o,i={}){return rd({},Oe([],[]),e,t,n,o,i)}function nq(e){let t=_t(e);return Xp(t)}function oq(e){return e.reduce((t,n)=>[...t,...Xp(n)],[])}function iq(e){let t=Lt(e);return Xp(t)}function aq(e){return s.IsNumber(e)?[Y(`${e}`)]:[Y(e)]}function Xp(e){return We(e)?iq(e.enum):W(e)?aq(e.const):_e(e)?nq(e.pattern):C(e)?oq(e.anyOf):[e]}function wO(e){return Xp(e)}function sq(e){return _e(e)?_t(e.pattern):e}function cq(e,t,n,o,i,a){let c=y.Assign(e,{[n.name]:o}),l=A(c,t,i),m=sq(l),f=A(c,t,a);return ip(m)||ap(m)?{[m.const]:f}:{}}function pq(e,t,n,o,i,a){return o.reduce((c,l)=>[...c,cq(e,t,n,l,i,a)],[])}function uq(e){return e.reduce((t,n)=>[...t,D(n)],[])}function vO(e,t,n,o,i,a){let c=wO(o),l=pq(e,t,n,c,i,a),m=uq(l);return ke(m)}function rd(e,t,n,o,i,a,c){return K([o])?y.Update(vO(e,t,n,o,i,a),{},c):$a(n,o,i,a,c)}function NO(e,t,n,o,i,a,c){let l=A(e,t,o);return rd(e,t,n,l,i,a,c)}function lq(e,t,n){let o=y.Assign(e,t);return s.Keys(t).filter(a=>n.includes(a)).reduce((a,c)=>({...a,[c]:fb(o,c,t[c])}),{})}function mq(e,t,n){let o=y.Assign(e,t);return s.Keys(t).filter(a=>!n.includes(a)).reduce((a,c)=>({...a,[c]:A(o,Oe([],[]),t[c])}),{})}function dq(e,t,n){let o=ub(t),i=lq(e,t,o),a=mq(e,t,o),c={...i,...a};return y.Update(c,{},n)}function Jp(e,t,n,o){return dq(e,n,o)}function Pp(e,t={}){return N("NonNullable",[e],t)}function LO(e,t={}){return nd(e,t)}function fq(e){let t=q([Zo(),ri()]);return es(e,t,{})}function nd(e,t){return K([e])?y.Update(fq(e),{},t):Pp(e,t)}function kO(e,t,n,o){let i=A(e,t,n);return nd(i,o)}function Up(e,t,n={}){return N("Omit",[e,t],n)}function MO(e,t,n={}){let o=s.IsArray(t)?ui(t):t;return od(e,o,n)}function eu(e){let t=li(e);return $(t)?t.properties:he()}function gq(e,t){return s.Keys(e).reduce((o,i)=>t.includes(i)?o:{...o,[i]:e[i]},{})}function DO(e,t){let n=eu(e),o=di(t),i=gq(n,o);return D(i)}function od(e,t,n){return K([e,t])?y.Update(DO(e,t),{},n):Up(e,t,n)}function GO(e,t,n,o,i){let a=A(e,t,n),c=A(e,t,o);return od(a,c,i)}function wp(e,t={}){return N("Parameters",[e],t)}function $O(e,t={}){return id(e,t)}function hq(e){let t=Ve(e)?e.parameters:[],n=In({},Oe([],[]),t);return Fe(n)}function id(e,t){return K([e])?y.Update(hq(e),{},t):wp(e,t)}function FO(e,t,n,o){let i=A(e,t,n);return id(i,o)}function vp(e,t={}){return N("Partial",[e],t)}function jO(e,t={}){return ad(e,t)}function qO(e,t){let n=Rr(e,t),o=Cr(n);return br(y.Assign(e,{[t]:o}),t)}function BO(e,t,n){let o=mr(e,t,n);return Cr(o)}function HO(e){let t=ke(e);return Cr(t)}function KO(e){let t=e.map(n=>Cr(n));return q(t)}function zO(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:Xn(e[i])}),{});return D(t)}function Cr(e){return Ee(e)?qO(e.$defs,e.$ref):$e(e)?BO(e.if,e.then,e.else):G(e)?HO(e.allOf):C(e)?KO(e.anyOf):$(e)?zO(e.properties):D({})}function ad(e,t){return K([e])?y.Update(Cr(e),{},t):vp(e,t)}function YO(e,t,n,o){let i=A(e,t,n);return ad(i,o)}function Np(e,t,n={}){return N("Pick",[e,t],n)}function VO(e,t,n={}){let o=s.IsArray(t)?ui(t):t;return sd(e,o,n)}function yq(e,t){return s.Keys(e).reduce((o,i)=>t.includes(i)?y.Assign(o,{[i]:e[i]}):o,{})}function QO(e,t){let n=eu(e),o=di(t),i=yq(n,o);return D(i)}function sd(e,t,n){return K([e,t])?y.Update(QO(e,t),{},n):Np(e,t,n)}function WO(e,t,n,o,i){let a=A(e,t,n),c=A(e,t,o);return sd(a,c,i)}function Lp(e,t={}){return N("ReadonlyObject",[e],t)}function cd(e,t={}){return pd(e,t)}var ZO=cd;function XO(e){return Wo(vt(e))}function JO(e,t){let n=Rr(e,t),o=Pr(n);return br(y.Assign(e,{[t]:o}),t)}function eA(e,t,n){let o=mr(e,t,n);return Pr(o)}function tA(e){let t=ke(e);return Pr(t)}function rA(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:no(e[i])}),{});return D(t)}function nA(e){return Wo(Fe(e))}function oA(e){let t=e.map(n=>Pr(n));return q(t)}function Pr(e){return X(e)?XO(e.items):Ee(e)?JO(e.$defs,e.$ref):$e(e)?eA(e.if,e.then,e.else):G(e)?tA(e.allOf):$(e)?rA(e.properties):V(e)?nA(e.items):C(e)?oA(e.anyOf):e}function pd(e,t){return K([e])?y.Update(Pr(e),{},t):Lp(e)}function iA(e,t,n,o){let i=A(e,t,n);return pd(i,o)}function aA(e,t,n,o){return t.visited.includes(o)?n:o in e?A(e,Oe(t.callstack,[...t.visited,o]),e[o]):n}function sA(e,t){let n=Rr(e,t),o=Ur(n);return br(y.Assign(e,{[t]:o}),t)}function cA(e,t,n){let o=mr(e,t,n);return Ur(o)}function pA(e){let t=ke(e);return Ur(t)}function uA(e){let t=e.map(n=>Ur(n));return q(t)}function lA(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:lp(e[i])}),{});return D(t)}function Ur(e){return Ee(e)?sA(e.$defs,e.$ref):$e(e)?cA(e.if,e.then,e.else):G(e)?pA(e.allOf):C(e)?uA(e.anyOf):$(e)?lA(e.properties):D({})}function kp(e,t={}){return N("Required",[e],t)}function mA(e,t={}){return ud(e,t)}function ud(e,t){return K([e])?y.Update(Ur(e),{},t):kp(e,t)}function dA(e,t,n,o){let i=A(e,t,n);return ud(i,o)}function Mp(e,t={}){return N("ReturnType",[e],t)}function fA(e,t={}){return ld(e,t)}function Tq(e){return Ve(e)?e.returnType:fe()}function ld(e,t){return K([e])?y.Update(Tq(e),{},t):Mp(e,t)}function gA(e,t,n,o={}){let i=A(e,t,n);return ld(i,o)}function Dp(e,t){return N("With",[e,t],{})}function tu(e,t){return md(e,t)}function md(e,t){return K([e])?y.Update(e,{},t):Dp(e,t)}function hA(e,t,n,o){let i=A(e,t,n);return md(i,o)}function Eq(e){return yn(e)?V(e.items)?dd(e.items.items):Qe(e.items)?[e]:ue(e.items)?[e]:[fe()]:[e]}function dd(e){return e.reduce((n,o)=>[...n,...Eq(o)],[])}function Oe(e,t){return{callstack:e,visited:t}}function K(e){return s.ShiftLeft(e,(t,n)=>ue(t)?!1:K(n),()=>!0)}function Qa(e,t,n){return s.Keys(n).reduce((o,i)=>({...o,[i]:A(e,t,n[i])}),{})}function In(e,t,n){let o=Bt(e,t,n);return dd(o)}function Bt(e,t,n){return n.map(o=>A(e,t,o))}function _q(e,t){let n=nt(e)?Ra(t,{}):t,o=oo(e)?xa(n,{}):n;return ro(e)?ns(o,{}):o}function Iq(e,t,n,o,i){return s.IsEqual(n,"AddImmutable")?yA(e,t,o[0],i):s.IsEqual(n,"RemoveImmutable")?Cb(e,t,o[0],i):s.IsEqual(n,"AddReadonly")?cT(e,t,o[0],i):s.IsEqual(n,"RemoveReadonly")?eE(e,t,o[0],i):s.IsEqual(n,"AddOptional")?pT(e,t,o[0],i):s.IsEqual(n,"RemoveOptional")?nE(e,t,o[0],i):s.IsEqual(n,"Capitalize")?Db(e,t,o[0],i):s.IsEqual(n,"Conditional")?qb(e,t,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"ConstructorParameters")?Hb(e,t,o[0],i):s.IsEqual(n,"Evaluate")?yb(e,t,o[0],i):s.IsEqual(n,"Exclude")?zb(e,t,o[0],o[1],i):s.IsEqual(n,"Extract")?Qb(e,t,o[0],o[1],i):s.IsEqual(n,"Index")?EO(e,t,o[0],o[1],i):s.IsEqual(n,"InstanceType")?IO(e,t,o[0],i):s.IsEqual(n,"Interface")?ab(e,t,o[0],o[1],i):s.IsEqual(n,"KeyOf")?PO(e,t,o[0],i):s.IsEqual(n,"Lowercase")?Gb(e,t,o[0],i):s.IsEqual(n,"Mapped")?NO(e,t,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"Module")?Jp(e,t,o[0],i):s.IsEqual(n,"NonNullable")?kO(e,t,o[0],i):s.IsEqual(n,"Pick")?WO(e,t,o[0],o[1],i):s.IsEqual(n,"Parameters")?FO(e,t,o[0],i):s.IsEqual(n,"Partial")?YO(e,t,o[0],i):s.IsEqual(n,"Omit")?GO(e,t,o[0],o[1],i):s.IsEqual(n,"ReadonlyObject")?iA(e,t,o[0],i):s.IsEqual(n,"Record")?_E(e,t,o[0],o[1],i):s.IsEqual(n,"Required")?dA(e,t,o[0],i):s.IsEqual(n,"ReturnType")?gA(e,t,o[0],i):s.IsEqual(n,"TemplateLiteral")?OS(e,t,o[0],i):s.IsEqual(n,"Uncapitalize")?$b(e,t,o[0],i):s.IsEqual(n,"Uppercase")?Fb(e,t,o[0],i):s.IsEqual(n,"With")?hA(e,t,o[0],o[1]):N(n,o,i)}function Sq(e,t,n){let o=ue(n)?aA(e,t,n,n.$ref):X(n)?vt(A(e,t,n.items),zo(n)):pi(n)?Zp(e,t,n.target,n.arguments):Ye(n)?_r(Bt(e,t,n.parameters),A(e,t,n.instanceType),uT(n)):Ve(n)?Ir(Bt(e,t,n.parameters),A(e,t,n.returnType),lT(n)):$e(n)?Jn(A(e,t,n.if),A(e,t,n.then),A(e,t,n.else),yT(n)):G(n)?dt(Bt(e,t,n.allOf),ST(n)):$(n)?D(Qa(e,t,n.properties),gT(n)):ge(n)?fp(pt(n),A(e,t,xe(n))):yn(n)?co(A(e,t,n.items)):V(n)?Fe(In(e,t,n.items),JT(n)):C(n)?q(Bt(e,t,n.anyOf),BT(n)):n;return _q(n,o)}function A(e,t,n){return ln(n)?Iq(e,t,n.action,n.parameters,n.options):Sq(e,t,n)}function Jt(e,t){return A(e,Oe([],[]),t)}function bq(e){return y.Update(e,{"~immutable":!0},{})}function ns(e,t){return y.Update(bq(e),{},t)}function yA(e,t,n,o){let i=A(e,t,n);return ns(i,o)}function _I(e,t={}){return N("AddImmutable",[e],t)}function Wo(e,t={}){return ns(e,t)}function II(e,t={}){return N("Evaluate",[e],t)}function yt(e,t={}){return jm(e,t)}function SI(e,t={}){return N("Module",[e],t)}function TA(e,t={}){return Jp({},Oe([],[]),e,t)}function Oq(e,t){let n=so(e,t);return s.IsEqual(n,"right-inside")||s.IsEqual(n,"disjoint")?1:0}function EA(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>s.IsEqual(Oq(e,o),1)?EA(e,i,[...n,o]):[...n,e,...t],()=>[...n,e])}function _A(e,t=[]){return s.ShiftLeft(e,(n,o)=>_A(o,EA(n,t)),()=>t)}function IA(e){return _A(e)}function SA(...e){let[t,n,o]=ie.Match(e,{2:(c,l)=>s.IsString(c)?[{},c,l]:[c,l,{}],3:(c,l,m)=>[c,l,m],1:c=>[{},c,{}]}),i=ES(n),a=s.IsArray(i)&&s.IsEqual(i.length,2)?A(t,Oe([],[]),i[0]):fe();return y.Update(a,{},o)}var r={};Zt(r,{Any:()=>Vo,Array:()=>vt,BigInt:()=>wa,Boolean:()=>rp,Call:()=>xb,Capitalize:()=>Nb,Codec:()=>ep,Conditional:()=>jb,Constructor:()=>_r,ConstructorParameters:()=>Bb,Cyclic:()=>br,Decode:()=>NT,DecodeBuilder:()=>Ua,Dependent:()=>Jn,Encode:()=>LT,EncodeBuilder:()=>Pa,Enum:()=>IT,Evaluate:()=>yt,Exclude:()=>Kb,Extends:()=>ht,ExtendsResult:()=>F,Extract:()=>Yb,Function:()=>Ir,Generic:()=>mn,Identifier:()=>va,Immutable:()=>kT,Index:()=>Wb,Infer:()=>Ca,InstanceType:()=>_O,Instantiate:()=>Jt,Integer:()=>io,Interface:()=>sb,Intersect:()=>dt,IsAny:()=>Je,IsArray:()=>X,IsBigInt:()=>kt,IsBoolean:()=>Ot,IsCall:()=>pi,IsCodec:()=>to,IsConstructor:()=>Ye,IsCyclic:()=>Ee,IsDependent:()=>$e,IsEnum:()=>We,IsEnumValue:()=>_T,IsFunction:()=>Ve,IsGeneric:()=>Yo,IsIdentifier:()=>$T,IsImmutable:()=>ro,IsInfer:()=>Qe,IsInteger:()=>ct,IsIntersect:()=>G,IsKind:()=>w,IsLiteral:()=>W,IsNever:()=>lr,IsNull:()=>Ar,IsNumber:()=>we,IsObject:()=>$,IsOptional:()=>nt,IsParameter:()=>qT,IsReadonly:()=>oo,IsRecord:()=>ge,IsRef:()=>ue,IsRefine:()=>tp,IsRest:()=>yn,IsSchema:()=>Le,IsString:()=>tt,IsSymbol:()=>xr,IsTemplateLiteral:()=>_e,IsThis:()=>yp,IsTuple:()=>V,IsUndefined:()=>dr,IsUnion:()=>C,IsUnknown:()=>ot,IsUnsafe:()=>Jc,IsVoid:()=>Gt,KeyOf:()=>SO,Literal:()=>Y,Lowercase:()=>Lb,Mapped:()=>UO,Module:()=>TA,Never:()=>fe,NonNullable:()=>LO,Null:()=>Zo,Number:()=>Mt,Object:()=>D,Omit:()=>MO,Optional:()=>dT,Parameter:()=>ao,Parameters:()=>$O,Partial:()=>jO,Pick:()=>VO,Readonly:()=>MT,ReadonlyObject:()=>cd,ReadonlyType:()=>ZO,Record:()=>ti,RecordKey:()=>hn,RecordPattern:()=>pt,RecordValue:()=>xe,Ref:()=>st,Refine:()=>DT,Required:()=>mA,Rest:()=>co,ReturnType:()=>fA,Script:()=>SA,String:()=>At,Symbol:()=>Xo,TemplateLiteral:()=>xS,This:()=>hp,Tuple:()=>Fe,Uncapitalize:()=>kb,Undefined:()=>ri,Union:()=>q,Unknown:()=>et,Unsafe:()=>hT,Uppercase:()=>Mb,Void:()=>Tp,With:()=>tu});var bA="Must be a valid tags query: only tag:value searches (no wildcards), boolean operators, and parentheses are supported.";var Aq=pn(AA());var xA="lowercase-email",os="iana-timezone",fd="simple-time",gd="simple-date-time";var xq=(e,t)=>RegExp(`^${e.source}(${t.source}${e.source})*$`),Rq=/[a-zA-Z0-9-_]+/,Cq=/\./,AUe=xq(Rq,Cq);var RA="lowercase-domain";var fi="kebab-case";var CA="camel-case";var Pq=new Set;function R(e,t,n={}){let o=t.map(i=>{let a=i;return a.$id?(Pq.add(i),r.Ref(a.$id)):i});return r.Unsafe({...n,type:"object",discriminator:{propertyName:e},required:[e],oneOf:o})}function Ie(e,t){return r.Object({values:r.Array(e,{maxItems:t.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:r.Optional(r.Boolean({description:"If true, exclude rows matching these values instead of including them"}))},{description:t.description})}function Kt(e,t={}){return R("type",[r.Object({type:r.Literal("ids"),ids:r.Array(p({allowEmpty:!1}),{minItems:1,...t.maxIds!==void 0&&{maxItems:t.maxIds}})}),r.Object({type:r.Literal("all"),filters:r.Optional(e)})])}function ou(e){return r.Object({value:p({allowEmpty:!1,description:e.valueDescription}),exclude:r.Optional(r.Boolean({description:"If true, exclude rows matching this value instead of including them"}))},{description:e.description})}var hi=1e3,nu=100,le={limit:r.Optional(r.Integer({minimum:1,maximum:hi,description:"Maximum number of items to return in this page."})),offset:r.Optional(r.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."}))},Uq=["asc","desc"],ne=r.Enum(Uq,{description:"Sort direction: ascending or descending."}),qe={...le,limit:r.Optional(r.Integer({minimum:1,maximum:hi,default:nu,description:`Maximum number of items to return in this page. Omit to use the public API default of ${nu}.`}))},wq=r.Object({totalCount:r.Integer({description:"Total number of items matching the query before `limit` and `offset` are applied."}),pageCount:r.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."}),wUe=r.Object({pagination:wq},{$id:"ResponseMetadata",description:"Metadata accompanying `data` on paginated operations, describing the full result set the page was taken from."});function Se(e,t={}){return r.Optional(r.Union([r.Null(),e],t))}function S(e={}){return r.Unsafe({...e,type:"string"})}var gi=250;function p({allowEmpty:e=!0,type:t="short",description:n,default:o}={}){let i=e?0:1,a={...n===void 0?{}:{description:n},...o===void 0?{}:{default:o}};switch(t){case"camel-case":return r.String({format:CA,minLength:i,maxLength:gi,...a});case"kebab-case":return r.String({format:fi,minLength:i,maxLength:gi,...a});case"email":return r.String({format:xA,minLength:i,maxLength:254,errorMessage:{format:"Must be a valid lowercase email address."},...a});case"lowercase-domain":return r.String({format:RA,minLength:i,maxLength:gi,...a});case"tsuga-query":return r.String({format:"tsuga-query",minLength:i,maxLength:1e4,...a});case"tags-query":return r.String({format:"tags-query",minLength:i,maxLength:1e4,errorMessage:{format:`${bA} The query you provided is invalid: \${0}`},...a});case"date-time":return r.String({format:"date-time",...a});case"uri":return r.String({format:"uri",...a});case"user-password":return r.String({format:"user-password",minLength:12,maxLength:gi,...a});case"long":return r.String({minLength:i,maxLength:5e4,...a});case"short":return r.String({minLength:i,maxLength:gi,...a});case"tsuga-formula":return r.String({format:"tsuga-formula",minLength:i,maxLength:gi,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 r.String({format:"time",...a});case"readonly-sql-query":return r.String({format:"readonly-sql-query",minLength:i,maxLength:5e4,errorMessage:{format:"Must be a readonly SQL query - only SELECT statements are allowed."},...a});default:Ze(t)}}var is=["ingestion-api-key","operation-api-key","rum-public-token","dashboard","log-route","metric-route","monitor","notification-rule","notification-silence","slo"],iu=r.Array(r.Enum(is,{description:"Tsuga-managed asset type."}),{description:"Tsuga-managed asset types covered by the policy. An empty array means all supported asset types."});var hd=["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","CLUSTER_DB_QUERY_CONNECTION_TIMEOUT"],HUe=r.Enum(hd),vq=["CLUSTER_AGGREGATION_STRUCTURE"];var KUe=r.Object({code:r.Enum(hd),message:r.String()}),UA=[...hd,...vq,"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"],wA=["INTERNAL_ERROR","INVALID_QUERY_TO_CLUSTER"];var Nq=["NETWORK_ERROR","RESPONSE_PARSE_ERROR"],Lq=[...UA,...wA,...Nq],kq=r.Object({assetId:r.Optional(r.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:r.String({description:"Name of the asset that violated the policy. Set from submitted data or the existing asset row. Returned for every violation."}),assetType:r.Enum(is,{description:"Type of Tsuga asset validated by the policy. Set by the route that ran tag-policy validation. Returned for every violation."}),tagPolicyId:r.String({description:"Identifier of the active tag policy that was violated. Generated by Tsuga when the policy is created. Returned for every violation."}),tagKey:r.String({description:"Tag key required or constrained by the violated policy. Set by the tag policy. Returned for every violation."}),message:r.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."}),Mq=R("type",[r.Object({type:r.Literal("invalid-syntax",{description:"Discriminator identifying a rule the grok parser could not parse at all."}),error:r.Object({offset:r.Integer({description:"Byte offset in the rule where parsing failed."}),detail:r.String({description:"Parser detail message."})},{description:"Position and parser message for the syntax failure."})},{$id:"GrokInvalidSyntax"}),r.Object({type:r.Literal("unknown-pattern",{description:"Discriminator identifying a rule that references a pattern name the grok engine does not provide."}),error:r.Object({offset:r.Integer({description:"Byte offset of the unknown pattern."}),unknownPattern:r.String({description:"The pattern name that is not supported."})},{description:"Position and name of the unsupported pattern."})},{$id:"GrokUnknownPattern"}),r.Object({type:r.Literal("invalid-filter",{description:"Discriminator identifying a rule whose filter is a known filter used incorrectly."}),error:r.Object({offset:r.Integer({description:"Byte offset of the invalid filter."}),invalidFilter:r.String({description:"The filter that is invalid."}),message:r.String({description:"Why the filter is invalid."})},{description:"Position, text, and reason for the invalid filter."})},{$id:"GrokInvalidFilter"}),r.Object({type:r.Literal("unknown-filter",{description:"Discriminator identifying a rule that references a filter name the grok engine does not implement."}),error:r.Object({offset:r.Integer({description:"Byte offset of the unknown filter."}),unknownFilter:r.String({description:"The filter name that is not implemented."}),message:r.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`."}),Dq=r.Object({rule:r.String({description:"The rule that failed to compile."}),ruleIndex:r.Integer({description:"0-based index of the failing rule in the submitted `rules` array."}),error:Mq},{description:"A single grok rule that failed to compile, with its position in the submitted rules and the structured compile error."}),vA=R("type",[r.Object({type:r.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:r.Array(kq,{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"}),r.Object({type:r.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:r.Array(Dq,{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."}),zUe=r.Object({code:r.Optional(r.Enum(Lq,{description:"Machine readable error code describing what went wrong"})),message:r.String({description:"Human readable explanation of the error"}),statusCode:r.Number({description:"HTTP status code that was returned"}),details:r.Optional(vA)},{$id:"ErrorResponse",description:"Standard envelope for API errors"}),YUe=r.Object({code:r.Optional(r.Enum(UA,{description:"Machine readable error code describing what went wrong"})),message:r.String({description:"Human readable explanation of the error"}),statusCode:r.Number({description:"HTTP status code that was returned"}),details:r.Optional(vA)},{$id:"ClientErrorResponse",description:"Standard envelope for client (4XX) API errors"}),VUe=r.Object({code:r.Optional(r.Enum(wA,{description:"Machine readable error code describing what went wrong"})),message:r.String({description:"Human readable explanation of the error"}),statusCode:r.Number({description:"HTTP status code that was returned"})},{$id:"ServerErrorResponse",description:"Standard envelope for server (5XX) API errors"}),QUe=r.Object({requestId:r.String({description:"Identifier used to trace the lifecycle of this API request"}),error:r.Ref("ClientErrorResponse")},{$id:"ClientErrorEnvelope",description:"Standard envelope wrapping all client (4XX) error responses"}),WUe=r.Object({requestId:r.String({description:"Identifier used to trace the lifecycle of this API request"}),error:r.Ref("ServerErrorResponse")},{$id:"ServerErrorEnvelope",description:"Standard envelope wrapping all server (5XX) error responses"});function d({body:e,description:t,method:n,operationId:o,params:i,tags:a,query:c,paginated:l,response:m,url:f}){return i?{buildUrl:E=>f.replace(/:[a-zA-Z_]+/g,I=>E[I.slice(1)]),method:n,params:i,response:m,templateUrl:f,...e===void 0?{}:{body:e},...t===void 0?{}:{description:t},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}:{method:n,response:m,url:f,templateUrl:f,...e===void 0?{}:{body:e},...t===void 0?{}:{description:t},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}}function NA(e,t){if(!t||typeof t!="object")return e;let n=new URLSearchParams;return Object.entries(t).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 v=r.Object({success:r.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 su="tsuga-cli";var mo="/v0/oauth",LA=d({description:"OAuth 2.1 authorization endpoint: validates the client and redirect URI, then redirects to the consent page",url:`${mo}/authorize`,method:"GET",query:r.Partial(r.Object({response_type:r.String({description:"Must be `code`"}),client_id:r.String({description:"First-party client id or CIMD document URL"}),redirect_uri:r.String({description:"Client redirect URI"}),code_challenge:r.String({description:"PKCE code challenge"}),code_challenge_method:r.String({description:"Must be `S256`"}),state:r.String({description:"Opaque client state, echoed back"}),resource:r.String({description:"RFC 8707 resource indicator"})})),response:r.Object({},{description:"Never returned: this endpoint redirects (302) or renders an HTML error (400)"})}),kA=d({description:"OAuth 2.1 token endpoint: exchanges an authorization code (PKCE) or refresh token for a token pair",url:`${mo}/token`,method:"POST",body:r.Partial(r.Object({grant_type:r.String({description:"`authorization_code` or `refresh_token`"}),code:r.String({description:"Authorization code being exchanged"}),code_verifier:r.String({description:"PKCE code verifier"}),redirect_uri:r.String({description:"Must match the redirect URI used on /authorize"}),client_id:r.String({description:"Client id, when sent by the client"}),refresh_token:r.String({description:"Refresh token, for `grant_type=refresh_token`"})})),response:r.Object({access_token:r.String(),token_type:r.Literal("Bearer"),expires_in:r.Number({description:"Access token lifetime in seconds"}),refresh_token:r.String()})}),mwe=d({description:"Resolve a signed authorization request handle for the consent page",url:`${mo}/authorization-request`,method:"GET",query:r.Object({handle:r.String()}),response:r.Object({clientId:r.String(),clientName:r.String(),redirectUri:r.String()})}),dwe=d({description:"Approve or deny an OAuth authorization request from the consent page",url:`${mo}/approve`,method:"POST",body:r.Object({handle:r.String({description:"The signed authorization request handle"}),approve:r.Boolean()}),response:r.Object({redirectTo:r.String({description:"The client's redirect URI carrying either the code or the denial"})})}),fwe=d({description:"Validate an OAuth access token (internal, for the MCP resource server)",url:`${mo}/introspect`,method:"POST",body:r.Object({token:r.String()}),response:r.Object({active:r.Boolean(),userId:r.Optional(r.String()),orgId:r.Optional(r.String())})}),Gq=["pending","active","revoked"],$q=r.Object({id:r.String(),createdAt:S(),clientId:r.String({description:"Client ID Metadata Document URL or first-party client id"}),clientName:r.String({description:"Display name derived from the client identity"}),userId:r.String(),status:r.Enum(Gq),lastUsedAt:r.Optional(S())}),gwe=d({tags:["oauth"],description:"List OAuth grants: your own, or all users for admins",url:`${mo}/grants`,method:"GET",query:r.Object({allUsers:r.Optional(r.Boolean({description:"Admins only: list grants of every user in the org"}))}),response:r.Array($q)}),hwe=d({tags:["oauth"],description:"Delete an OAuth grant (own grant, or any grant for admins)",url:`${mo}/grants/:id`,method:"DELETE",params:r.Object({id:r.String()}),response:v});function MA(e,t){let n=new URL(LA.url,e);return n.search=new URLSearchParams({response_type:"code",client_id:su,redirect_uri:t.redirectUri,code_challenge:t.challenge,code_challenge_method:"S256",state:t.state}).toString(),n.href}var as=class extends Error{constructor(n,o){super(n);this.code=o;this.name="OAuthTokenError"}};function Fq(e){if(!e)return{};try{let t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}async function DA(e,t){let n=await fetch(new URL(kA.url,e).href,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(t).toString()}),o=await n.text(),i=Fq(o);if(n.status!==200){let a=i.error??`HTTP ${n.status}`;throw new as(`OAuth token request failed (${a}${i.error_description?`: ${i.error_description}`:""})`,a)}if(typeof i.access_token!="string"||i.access_token===""||typeof i.refresh_token!="string"||i.refresh_token===""||typeof i.expires_in!="number")throw new Error("OAuth token response was missing required fields");return{accessToken:i.access_token,refreshToken:i.refresh_token,expiresAt:new Date(Date.now()+i.expires_in*am)}}async function GA(e,t){return DA(e,{grant_type:"authorization_code",client_id:su,code:t.code,code_verifier:t.verifier,redirect_uri:t.redirectUri})}async function cu(e,t){return DA(e,{grant_type:"refresh_token",client_id:su,refresh_token:t})}var jq="Your session expired. Run `tsuga auth login` to sign in again.",qq="Your session could not be renewed: the refresh token was already used, revoked or expired. A refresh token is single-use, so the server revokes the whole session when one is replayed - run `tsuga auth login` to sign in again.",Bq=5*Sa;function $A(e,t){let n=new Date(e.accessExpiresAt).getTime();return Number.isNaN(n)||n<=t.getTime()+Bq}function ss(e){return`\u2022\u2022\u2022\u2022${e.slice(-4)}`}function pu(e){let t;try{t=JSON.parse(e)}catch{return}if(typeof t!="object"||t===null)return;let{accessToken:n,accessExpiresAt:o,refreshToken:i}=t;if(!(typeof n!="string"||n==="")&&!(typeof o!="string"||o==="")&&!(i!==void 0&&typeof i!="string"))return{accessToken:n,accessExpiresAt:o,...i===void 0?{}:{refreshToken:i}}}function yd(e){return{accessToken:e.accessToken,accessExpiresAt:e.expiresAt.toISOString(),refreshToken:e.refreshToken}}function FA(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 jA(e){if(e)switch(e.kind){case"operation-api-key":return e.token;case"user-session":return e.userAuth.accessToken;default:Ze(e)}}async function uu({userAuth:e,now:t,reload:n,refresh:o,persist:i}){if(!$A(e,t))return e;let a=n()??e;if(!$A(a,t))return a;if(!a.refreshToken)throw new Error(jq);let c;try{c=await o(a.refreshToken)}catch(m){throw m instanceof as&&m.code==="invalid_grant"?new Error(qq,{cause:m}):new Error(`Could not renew your session: ${m instanceof Error?m.message:String(m)}. Retry the command.`,{cause:m})}let l=yd(c);try{i(l)}catch(m){console.error(`Warning: could not save the renewed session (${m instanceof Error?m.message:String(m)}). Run \`tsuga auth login\` before the next command.`)}return l}var Td={r:8,g:203,b:0},Ed={r:0,g:130,b:0},_d=["\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 Id(e,t,n){return Math.round(e+(t-e)*n)}function Hq(e,t){let n=Id(Td.r,Ed.r,t),o=Id(Td.g,Ed.g,t),i=Id(Td.b,Ed.b,t);return`\x1B[38;2;${n};${o};${i}m${e}\x1B[0m`}function Kq(e){if(!e)return`
33
+ `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),_S=(e,t=[])=>u(u(ES(e),([n,o])=>u(km(o),([i,a])=>[[n,i],a])),([n,o])=>_S(o,[...t,n]),()=>[t,e]),uF=e=>u(u(u(km(e),([t,n])=>u(_S(n),([o,i])=>u(u(ES(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[EI(t),n]),km=e=>u(u(pF(e),([t,n])=>u(u(iF(n),([o,i])=>[o,i],()=>u(aF(n),([o,i])=>[o,i],()=>u(sF(n),([o,i])=>[o,i],()=>u(cF(n),([o,i])=>[o,i],()=>[])))),([o,i])=>u(KI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[_I(t),n]),lF=e=>u(u(km(e),([t,n])=>u(uF(n),([o,i])=>[[t,o],i])),([t,n])=>[II(t),n]),IS=e=>u(u(lF(e),([t,n])=>[t,n],()=>u(E1(e),([t,n])=>[t,n],()=>u(ne(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function SS(e){let t=wm(`\`${e}\``);return s.IsEqual(t.length,2)?t[0]:he()}function dF(e){return e.join("|")}function fF(e){return e.slice(1,e.length-1)}function gF(e,t,n){return _n(t,`${n}${e}`)}function hF(e,t){return _n(e,`${t}${FT}`)}function yF(e,t){return _n(e,`${t}${op}`)}function TF(e,t){return _n(e,`${t}${cp}`)}function EF(e,t){return Ya(q([Y("false"),Y("true")]),e,t)}function _F(e,t){return _n(e,`${t}${pp}`)}function IF(e,t,n){return _n(t,`${n}${fF(e)}`)}function SF(e,t,n){let o=Va(e,{});return Ya(o,t,n)}function bF(e,t,n){let o=Lt(e);return Ya(o,t,n)}function bS(e,t,n,o=[]){return s.ShiftLeft(e,(i,a)=>bS(a,t,n,[...o,Ya(i,[],"")]),()=>_n(t,`${n}(${dF(o)})`))}function Ya(e,t,n){return We(e)?bF(e.enum,t,n):ct(e)?yF(t,n):W(e)?gF(e.const,t,n):kt(e)?hF(t,n):Ot(e)?EF(t,n):we(e)?TF(t,n):tt(e)?_F(t,n):_e(e)?IF(e.pattern,t,n):AS(e)?SF(e.parameters[0],t,n):C(e)?bS(e.anyOf,t,n):fT}function _n(e,t){return s.ShiftLeft(e,(n,o)=>Ya(n,o,t),()=>t)}function OF(e){return`^${_n(e,"")}$`}function OS(e){let t=OF(e);return lp(t)}function Va(e,t){return K(e)?y.Update(OS(e),{},t):_p(e,t)}function xS(e,t,n,o){let i=Bt(e,t,n);return Va(i,o)}function _p(e,t={}){return N("TemplateLiteral",[e],t)}function AS(e){return Le(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"TemplateLiteral")}function RS(e){return Va(e,{})}function AF(e){let t=SS(e);return RS(t)}function CS(e,t={}){let n=s.IsString(e)?AF(e):RS(e);return y.Update(n,{},t)}function _e(e){return w(e,"TemplateLiteral")}var F={};Zt(F,{ExtendsFalse:()=>B,ExtendsTrue:()=>U,ExtendsUnion:()=>Mm,IsExtendsFalse:()=>xF,IsExtendsTrue:()=>US,IsExtendsTrueLike:()=>si,IsExtendsUnion:()=>PS,Match:()=>Re});function Mm(e){return y.Create({"~kind":"ExtendsUnion"},{inferred:e})}function PS(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsUnion")&&s.IsObject(e.inferred)}function U(e){return y.Create({"~kind":"ExtendsTrue"},{inferred:e})}function US(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsTrue")&&s.IsObject(e.inferred)}function B(){return y.Create({"~kind":"ExtendsFalse"},{})}function xF(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function si(e){return PS(e)||US(e)}function Re(e,t,n){return si(e)?t(e.inferred):n()}function RF(e,t,n,o){return Re(ee(e,n,o),i=>U(y.Assign(y.Assign(e,i),{[t]:n})),()=>B())}function CF(e,t){return U(e)}function PF(e,t,n,o,i){return Re(ee(e,t,n),a=>Re(ee(a,t,o),c=>U(c),()=>B()),()=>Re(ee(e,t,i),a=>U(a),()=>B()))}function UF(e,t,n){let o=Lt(n);return ee(e,t,o)}function wS(e,t,n){return s.ShiftLeft(n,(o,i)=>Re(ee(e,t,o),a=>wS(a,t,i),()=>B()),()=>U(e))}function wF(e,t,n){let o=_t(n);return ee(e,t,o)}function vS(e,t,n){return s.ShiftLeft(n,(o,i)=>Re(ee(e,t,o),a=>U(a),()=>vS(e,t,i)),()=>B())}function ce(e,t,n){return Je(n)?CF(e,t):$e(n)?PF(e,t,n.if,n.then,n.else):We(n)?UF(e,t,n.enum):Qe(n)?RF(e,n.name,t,n.extends):G(n)?wS(e,t,n.allOf):_e(n)?wF(e,t,n.pattern):C(n)?vS(e,t,n.anyOf):ot(n)?U(e):B()}function NS(e,t,n){return Qe(n)?ce(e,t,n):Je(n)?U(e):ot(n)?U(e):Mm(e)}function vF(e,t){let n=ro(e),o=ro(t);return n&&o||!n&&o?!0:!(n&&!o)}function LS(e,t,n,o){return X(o)?vF(t,o)?ee(e,n,o.items):B():ce(e,t,o)}function kS(e,t,n){return kt(n)?U(e):ce(e,t,n)}function MS(e,t,n){return Ot(n)?U(e):ce(e,t,n)}function NF(e,t,n,o,i){let a=Qe(o)?t:o,c=Qe(o)?o:t,l=nt(t),m=nt(o);return!l&&m?B():Re(ee(e,a,c),f=>Qa(f,n,i),()=>B())}function LF(e,t,n,o){return s.ShiftLeft(o,(i,a)=>NF(e,t,n,i,a),()=>nt(t)?U(e):B())}function kF(e,t,n){return s.ShiftLeft(t,(o,i)=>LF(e,o,i,n),()=>U(e))}function Qa(e,t,n){return kF(e,t,n)}function Vp(e,t,n){return Gt(n)?U(e):ee(e,t,n)}function DS(e,t,n,o){return Je(o)?U(e):ot(o)?U(e):Ye(o)?Re(Qa(e,t,o.parameters),i=>Vp(i,n,o.instanceType),()=>B()):B()}function GS(e,t,n,o,i){return Re(ee(e,t,i),()=>ee(e,n,i),()=>ee(e,o,i))}function $S(e,t,n){let o=Lt(t);return ee(e,o,n)}function FS(e,t,n,o){return Je(o)?U(e):ot(o)?U(e):Ve(o)?Re(Qa(e,t,o.parameters),i=>Vp(i,n,o.returnType),()=>B()):B()}function jS(e,t,n){return ct(n)?U(e):we(n)?U(e):ce(e,t,n)}function qS(e,t,n){let o=ke(t);return ee(e,o,n)}function Qp(e,t,n){return t===n?U(e):B()}function MF(e,t,n){return W(n)?Qp(e,t,n.const):kt(n)?U(e):ce(e,Y(t),n)}function DF(e,t,n){return W(n)?Qp(e,t,n.const):Ot(n)?U(e):ce(e,Y(t),n)}function GF(e,t,n){return W(n)?Qp(e,t,n.const):we(n)?U(e):ce(e,Y(t),n)}function $F(e,t,n){return W(n)?Qp(e,t,n.const):tt(n)?U(e):ce(e,Y(t),n)}function BS(e,t,n){return s.IsBigInt(t.const)?MF(e,t.const,n):s.IsBoolean(t.const)?DF(e,t.const,n):s.IsNumber(t.const)?GF(e,t.const,n):s.IsString(t.const)?$F(e,t.const,n):he()}function HS(e,t,n){return Qe(n)?ce(e,t,n):U(e)}function KS(e,t,n){return xr(n)?U(e):ce(e,t,n)}function zS(e,t,n){return we(n)?U(e):ce(e,t,n)}function FF(e,t,n){return nt(t)?nt(n)?U(e):B():U(e)}function jF(e,t,n){return Qe(n)&&mr(n.extends)?B():Re(ee(e,t,n),o=>FF(o,t,n),()=>B())}function qF(e,t){return e.reduce((n,o)=>o in t?si(t[o])?{...n,...t[o].inferred}:he():he(),{})}function BF(e,t,n){let o={};for(let c of s.Keys(n))o[c]=c in t?jF({},t[c],n[c]):nt(n[c])?Qe(n[c])?U(y.Assign(e,{[n[c].name]:n[c].extends})):U(e):B();let i=s.Values(o).every(c=>si(c)),a=i?qF(s.Keys(o),o):{};return i?U(a):B()}function HF(e,t,n){let o=BF(e,t,n);return si(o)?U(y.Assign(e,o.inferred)):B()}function KF(e,t,n){return HF(e,t,n)}function zF(e,t){return s.Keys(t).reduce((n,o)=>({...n,[o]:s.HasPropertyKey(e,o)?C(n[o])?q([...n[o].anyOf,t[o]]):q([e[o],t[o]]):t[o]}),e)}function YS(e,t,n,o){return s.ShiftLeft(t,(i,a)=>Re(ee({},e[i],n),c=>YS(e,a,n,zF(o,c)),()=>B()),()=>U(o))}function YF(e,t,n,o){let i=s.Keys(t);return YS(t,i,o,e)}function VS(e,t,n){return ge(n)?YF(e,t,pt(n),xe(n)):$(n)?KF(e,t,n.properties):ce(e,D(t),n)}function VF(e,t){return s.IsEqual(s.Keys(t).length,0)?U(e):B()}function QF(e,t,n,o,i){return ee(e,n,i)}function QS(e,t,n,o){return ge(o)?QF(e,hp(t),n,hp(pt(o)),xe(o)):$(o)?VF(e,o.properties):Je(o)?U(e):ot(o)?U(e):B()}function WS(e,t,n){return tt(n)?U(e):ce(e,t,n)}function ZS(e,t,n){return Rr(n)?U(e):ce(e,t,n)}function XS(e,t,n){let o=_t(t);return ee(e,o,n)}function Dm(e,t){return y.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function Wa(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 Gm(e){return yn(e)?Qe(e.items)?X(e.items.extends)?Dm(e.items.name,e.items.extends.items):ot(e.items.extends)?Dm(e.items.name,e.items.extends):void 0:he():void 0}function Wp(e){return Qe(e)?Dm(e.name,e.extends):void 0}function $m(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>Re(ee({},o,t),()=>$m(i,t,[...n,o]),()=>{}),()=>n)}function JS(e,t,n,o){let i=$m(n,o);return s.IsArray(i)?U(y.Assign(e,{[t]:Fe(i)})):B()}function Zp(e,t,n,o){let i=$m(n,o);return s.IsArray(i)?U(y.Assign(e,{[t]:q(i)})):B()}function WF(e){return[...e].reverse()}function Fm(e,t){return t?WF(e):e}function ZF(e){let t=e.length>0?e[0]:void 0,n=Le(t)?Gm(t):void 0;return Le(n)}function XF(e,t,n,o,i,a){return Re(ee(e,n,i),c=>eb(c,t,o,a),()=>B())}function JF(e,t,n,o,i){let a=Gm(o);return Wa(a)?JS(e,a.name,Fm(n,t),a.type):s.ShiftLeft(n,(c,l)=>XF(e,t,c,l,o,i),()=>B())}function ej(e,t,n,o){return s.ShiftLeft(o,(i,a)=>JF(e,t,n,i,a),()=>s.IsEqual(n.length,0)?U(e):B())}function eb(e,t,n,o){return ej(e,t,n,o)}function tj(e,t,n){let o=In(e,Oe([],[]),n),i=ZF(o);return eb(e,i,Fm(t,i),Fm(o,i))}function tb(e,t,n){let o=Wp(n);return Wa(o)?Zp(e,o.name,t,o.type):s.ShiftLeft(t,(i,a)=>Re(ee(e,i,n),c=>tb(c,a,n),()=>B()),()=>U(e))}function rb(e,t,n){let o=In(e,Oe([],[]),t);return V(n)?tj(e,o,n.items):X(n)?tb(e,o,n.items):ce(e,Fe(o),n)}function nb(e,t,n){return Gt(n)?U(e):fr(n)?U(e):ce(e,t,n)}function ob(e,t,n){return s.ShiftLeft(n,(o,i)=>Re(ee(e,t,o),a=>U(a),()=>ob(e,t,i)),()=>B())}function jm(e,t,n){return s.ShiftLeft(t,(o,i)=>Re(ob(e,o,n),a=>jm(a,i,n),()=>B()),()=>U(e))}function ib(e,t,n){let o=Wp(n);return Wa(o)?Zp(e,o.name,t,o.type):C(n)?jm(e,t,n.anyOf):jm(e,t,[n])}function ab(e,t,n){return Qe(n)?ce(e,t,n):Je(n)?U(e):ot(n)?U(e):B()}function sb(e,t,n){return Gt(n)?U(e):ce(e,t,n)}function ee(e,t,n){return Je(t)?NS(e,t,n):X(t)?LS(e,t,t.items,n):kt(t)?kS(e,t,n):Ot(t)?MS(e,t,n):Ye(t)?DS(e,t.parameters,t.instanceType,n):$e(t)?GS(e,t.if,t.then,t.else,n):We(t)?$S(e,t.enum,n):Ve(t)?FS(e,t.parameters,t.returnType,n):ct(t)?jS(e,t,n):G(t)?qS(e,t.allOf,n):W(t)?BS(e,t,n):mr(t)?HS(e,t,n):xr(t)?KS(e,t,n):we(t)?zS(e,t,n):$(t)?VS(e,t.properties,n):ge(t)?QS(e,pt(t),xe(t),n):tt(t)?WS(e,t,n):Rr(t)?ZS(e,t,n):_e(t)?XS(e,t.pattern,n):V(t)?rb(e,t.items,n):fr(t)?nb(e,t,n):C(t)?ib(e,t.anyOf,n):ot(t)?ab(e,t,n):Gt(t)?sb(e,t,n):B()}function rj(e,t){return ke([...e,D(t)])}function qm(e,t,n){return K(e)?y.Update(rj(e,t),{},n):qa(e,t,n)}function cb(e,t,n,o,i){let a=Bt(e,t,n),c=Za(e,t,o);return qm(a,c,i)}function qa(e,t,n={}){return N("Interface",[e,t],n)}function ci(e){return Le(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function pb(e,t,n={}){return qm(e,t,n)}function nj(e,t,n){return e.includes(n)?!0:Xa([...e,n],t,t[n])}function ub(e,t,n){let o=Jc(n);return uo(e,t,o)}function uo(e,t,n){return s.ShiftLeft(n,(o,i)=>Xa(e,t,o)?!0:uo(e,t,i),()=>!1)}function Xa(e,t,n){return le(n)?nj(e,t,n.$ref):X(n)?Xa(e,t,n.items):Ye(n)?uo(e,t,[...n.parameters,n.instanceType]):Ve(n)?uo(e,t,[...n.parameters,n.returnType]):ci(n)?ub(e,t,n.parameters[1]):G(n)?uo(e,t,n.allOf):$(n)?ub(e,t,n.properties):C(n)?uo(e,t,n.anyOf):V(n)?uo(e,t,n.items):ge(n)?Xa(e,t,xe(n)):!1}function lb(e,t,n){return Xa(e,t,n)}function oj(e,t){return t.reduce((n,o)=>lb([o],e,e[o])?[...n,o]:n,[])}function mb(e){let t=Xc(e);return oj(e,t)}function ij(e,t,n){return n.includes(t)?n:t in e?Ja(e,e[t],[...n,t]):he()}function db(e,t,n){let o=Jc(t);return pi(e,o,n)}function pi(e,t,n){return t.reduce((o,i)=>Ja(e,i,o),n)}function Ja(e,t,n){return le(t)?ij(e,t.$ref,n):X(t)?Ja(e,t.items,n):Ye(t)?pi(e,[...t.parameters,t.instanceType],n):Ve(t)?pi(e,[...t.parameters,t.returnType],n):ci(t)?db(e,t.parameters[1],n):G(t)?pi(e,t.allOf,n):$(t)?db(e,t.properties,n):C(t)?pi(e,t.anyOf,n):V(t)?pi(e,t.items,n):ge(t)?Ja(e,xe(t),n):n}function fb(e,t,n){return Ja(e,n,[t])}function aj(e){return Qo()}function sj(e){return s.Keys(e).reduce((t,n)=>({...t,[n]:lo(e[n])}),{})}function es(e){return e.reduce((t,n)=>[...t,lo(n)],[])}function lo(e){return le(e)?aj(e.$ref):X(e)?vt(lo(e.items),Yo(e)):Ye(e)?Ir(es(e.parameters),lo(e.instanceType)):Ve(e)?Sr(es(e.parameters),lo(e.returnType)):G(e)?dt(es(e.allOf)):$(e)?D(sj(e.properties)):ge(e)?ri(hn(e),lo(xe(e))):C(e)?q(es(e.anyOf)):V(e)?Fe(es(e.items)):e}function cj(e,t){return t in e?lo(e[t]):et()}function gb(e){return cj(e.$defs,e.$ref)}function pj(e,t,n){let o=Bt(e,Oe([],[]),t),i=Za({},Oe([],[]),n);return ke([...o,D(i)])}function uj(e,t){return s.Keys(e).filter(o=>t.includes(o)).reduce((o,i)=>{let a=e[i],c=ci(a)?pj(e,a.parameters[0],a.parameters[1]):a;return{...o,[i]:c}},{})}function hb(e,t,n){let o=fb(e,t,n),i=uj(e,o);return Or(i,t)}function yb(e,t){return t in e?le(e[t])?yb(e,e[t].$ref):e[t]:fe()}function Cr(e,t){return yb(e,t)}function Tb(e){return Ee(e)?gb(e):ep(e)?et():e}function ht(e,t,n){let o=Tb(t),i=Tb(n);return ee(e,o,i)}var Da="equal",lj="disjoint",Ga="left-inside",$a="right-inside";function so(e,t){let n=[ot(e)?F.ExtendsFalse():ht({},e,t),ot(e)?F.ExtendsTrue({}):ht({},t,e)];return F.IsExtendsTrueLike(n[0])&&F.IsExtendsTrueLike(n[1])?Da:F.IsExtendsTrueLike(n[0])&&F.IsExtendsFalse(n[1])?Ga:F.IsExtendsFalse(n[0])&&F.IsExtendsTrueLike(n[1])?$a:lj}function mj(e,t){return t.filter(n=>so(e,n)!==$a)}function dj(e,t){let n=t.some(o=>{let i=so(e,o);return s.IsEqual(i,Ga)||s.IsEqual(i,Da)});return s.IsEqual(n,!1)}function fj(e,t){let n=Xt(e);return Je(n)?[n]:dj(n,t)?[...mj(n,t),n]:t}function gj(e){return e.reduce((t,n)=>$(n)?[...t,n]:mr(n)?t:fj(n,t),[])}function _m(e){let t=gj(e);return ti(t)}function Bm(e,t){return y.Update(Xt(e),{},t)}function Eb(e,t,n,o){let i=A(e,t,n);return Bm(i,o)}function ts(e,t=[]){return ln(e)&&s.IsEqual(e.action,"Conditional")?le(e.parameters[0])?ts(e.parameters[2],ts(e.parameters[3],[...t,e.parameters[0].$ref])):ts(e.parameters[2],ts(e.parameters[3],t)):ln(e)&&s.IsEqual(e.action,"Mapped")&&ln(e.parameters[1])&&s.IsEqual(e.parameters[1].action,"KeyOf")&&le(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function hj(e,t){return e.reduce((n,o)=>[...n,t.includes(o.name)],[])}function Sb(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>s.ShiftLeft(t,(a,c)=>Sb(i,c,[...n,[a,o]]),()=>n),()=>n)}function yj(e){return _e(e)?_t(e.pattern):We(e)?Lt(e.enum):e}function Tj(e){let t=yj(e);return C(t)?[...t.anyOf]:[t]}function Ej(e,t){return e.reduce((n,o)=>[...n,[...o,t]],[])}function _b(e,t){return t.reduce((n,o)=>[...n,...Ej(e,o)],[])}function Ib(e){return e.reduce((t,n)=>s.IsEqual(n[0],!0)?_b(t,Tj(n[1])):_b(t,[n[1]]),[[]])}function bb(e,t,n){let o=ts(n),i=hj(e,o),a=Sb(t,i);return ln(n)&&s.IsEqual(n.action,"Conditional")||ln(n)&&s.IsEqual(n.action,"Mapped")?Ib(a):[t]}function _j(){return["(not-resolvable)",fe()]}function Ij(){return["(not-generic)",fe()]}function Sj(e,t,n){return[e,mn(t,n)]}function bj(e,t,n){return t in e?Ob(e,t,e[t],n):_j()}function Ob(e,t,n,o){return Vo(n)?Sj(t,n.parameters,n.expression):le(n)?bj(e,n.$ref,o):Ij()}function Ab(e,t,n){return Ob(e,"(anonymous)",t,n)}function Oj(e,t,n){if(Qe(t)||ui(t)||F.IsExtendsTrueLike(ht({},t,n)))return;let o={parameter:e,expect:n,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:o})}function xb(e,t,n,o,i){let a=A(e,t,i);return Oj(n,a,o),y.Assign(e,{[n]:a})}function Aj(e,t,n,o,i){let a=A(e,t,n.extends),c=A(e,t,n.equals);return s.ShiftLeft(i,(l,m)=>Hm(xb(e,t,n.name,a,l),t,o,m),()=>Hm(xb(e,t,n.name,a,c),t,o,[]))}function Hm(e,t,n,o){return s.ShiftLeft(n,(i,a)=>Aj(e,t,i,a,o),()=>e)}function Rb(e,t,n,o){return Hm(e,t,n,o)}var Km=0,zm=0;function xj(){if(!s.IsLessThan(zm,at.Get().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function Rj(){xj(),zm++,Km++}function Cj(){Km--,s.IsEqual(Km,0)&&(zm=0)}function Pj(e){return s.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function Uj(e,t){return s.IsEqual(Pj(e),t)}function wj(e,t,n,o,i,a){Rj();try{let c=Rb(e,t,o,a),l=A(c,Oe([...t.callstack,n.$ref],t.visited),i);return A(c,Oe([],[]),l)}finally{Cj()}}function vj(e,t,n,o,i,a){return a.reduce((c,l)=>{let m=wj(e,t,n,o,i,l);return[...c,m]},[])}function Nj(e,t,n,o,i,a){let c=bb(o,a,i),l=vj(e,t,n,o,i,c);return s.IsEqual(l.length,1)?l[0]:Dt(l)}function Xp(e,t,n,o){let i=Bt(e,t,o),a=Ab(e,n,o),c=a[0],l=a[1];return Vo(l)?Uj(t,c)?Ba(st(c),i):Nj(e,t,st(c),l.parameters,l.expression,i):Ba(n,i)}function Ba(e,t){return y.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Cb(e,t){return Xp({},Oe([],[]),e,t)}function ui(e){return w(e,"Call")}function Lj(e){return y.Discard(e,["~immutable"])}function Pb(e,t){return y.Update(Lj(e),{},t)}function Ub(e,t,n,o){let i=A(e,t,n);return Pb(i,o)}function wb(e,t){return e(t)}function vb(e,t){return s.IsString(t)?Y(wb(e,t)):Y(t)}function Nb(e,t){let n=_t(t);return Yr(e,n)}function Lb(e,t){let n=t.map(o=>Yr(e,o));return q(n)}function Yr(e,t){return W(t)?vb(e,t.const):_e(t)?Nb(e,t.pattern):C(t)?Lb(e,t.anyOf):t}function Ip(e,t={}){return N("Capitalize",[e],t)}function kb(e,t={}){return Ym(e,t)}function Sp(e,t={}){return N("Lowercase",[e],t)}function Mb(e,t={}){return Vm(e,t)}function bp(e,t={}){return N("Uncapitalize",[e],t)}function Db(e,t={}){return Qm(e,t)}function Op(e,t={}){return N("Uppercase",[e],t)}function Gb(e,t={}){return Wm(e,t)}var kj=e=>e[0].toUpperCase()+e.slice(1),Mj=e=>e.toLowerCase(),Dj=e=>e[0].toLowerCase()+e.slice(1),Gj=e=>e.toUpperCase();function Ym(e,t){return K([e])?y.Update(Yr(kj,e),{},t):Ip(e,t)}function Vm(e,t){return K([e])?y.Update(Yr(Mj,e),{},t):Sp(e,t)}function Qm(e,t){return K([e])?y.Update(Yr(Dj,e),{},t):bp(e,t)}function Wm(e,t){return K([e])?y.Update(Yr(Gj,e),{},t):Op(e,t)}function $b(e,t,n,o){let i=A(e,t,n);return Ym(i,o)}function Fb(e,t,n,o){let i=A(e,t,n);return Vm(i,o)}function jb(e,t,n,o){let i=A(e,t,n);return Qm(i,o)}function qb(e,t,n,o){let i=A(e,t,n);return Wm(i,o)}function Ap(e,t,n,o,i={}){return N("Conditional",[e,t,n,o],i)}function Bb(e,t,n,o,i={}){return Zm({},Oe([],[]),e,t,n,o,i)}function $j(e,t,n,o,i,a){let c=ht(e,n,o);return F.IsExtendsUnion(c)?q([A(c.inferred,t,i),A(e,t,a)]):F.IsExtendsTrue(c)?A(c.inferred,t,i):A(e,t,a)}function Zm(e,t,n,o,i,a,c){return K([n,o])?y.Update($j(e,t,n,o,i,a),{},c):Ap(n,o,i,a,c)}function Hb(e,t,n,o,i,a,c){let l=A(e,t,n),m=A(e,t,o);return Zm(e,t,l,m,i,a,c)}function xp(e,t={}){return N("ConstructorParameters",[e],t)}function Kb(e,t={}){return Xm(e,t)}function Fj(e){let t=Ye(e)?e.parameters:[],n=In({},Oe([],[]),t);return Fe(n)}function Xm(e,t){return K([e])?y.Update(Fj(e),{},t):xp(e,t)}function zb(e,t,n,o){let i=A(e,t,n);return Xm(i,o)}function Rp(e,t,n={}){return N("Exclude",[e,t],n)}function Yb(e,t,n={}){return rs(e,t,n)}function rs(e,t,n){return K([e,t])?y.Update(dp(e,t),{},n):Rp(e,t,n)}function Vb(e,t,n,o,i){let a=A(e,t,n),c=A(e,t,o);return rs(a,c,i)}function Cp(e,t,n={}){return N("Extract",[e,t],n)}function Qb(e,t,n={}){return Jm(e,t,n)}function jj(e,t){let n=ht({},e,t);return F.IsExtendsTrueLike(n)?[e]:[]}function qj(e,t){return e.reduce((n,o)=>[...n,...jj(o,t)],[])}function Wb(e,t){let n=Xt(e),o=C(n)?n.anyOf:[n],i=qj(o,t);return Dt(i)}function Jm(e,t,n){return K([e,t])?y.Update(Wb(e,t),{},n):Cp(e,t,n)}function Zb(e,t,n,o,i){let a=A(e,t,n),c=A(e,t,o);return Jm(a,c,i)}function Bj(e){return e.reduce((t,n)=>ip(n)?[...t,Y(n)]:t,[])}function li(e){let t=Bj(e);return q(t)}function Ha(e,t,n={}){return N("Index",[e,t],n)}function Xb(e,t,n={}){let o=s.IsArray(t)?li(t):t;return ed(e,o,n)}function Jb(e,t){let n=Cr(e,t);return Ht(n)}function eO(e,t,n){let o=dr(e,t,n);return Ht(o)}function Hj(e,t){let n=s.Keys(e).filter(h=>!s.HasPropertyKey(t,h)),o=s.Keys(t).filter(h=>!s.HasPropertyKey(e,h)),i=s.Keys(e).filter(h=>s.HasPropertyKey(t,h)),a=n.reduce((h,E)=>({...h,[E]:e[E]}),{}),c=o.reduce((h,E)=>({...h,[E]:t[E]}),{}),l=i.reduce((h,E)=>({...h,[E]:ke([e[E],t[E]])}),{}),m=y.Assign(a,c);return y.Assign(m,l)}function tO(e){return e.reduce((t,n)=>Hj(t,Ht(n)),{})}function rO(e){let t=sE(Fe(e));return Ht(t)}function Kj(e,t){return s.Keys(e).filter(i=>i in t).reduce((i,a)=>({...i,[a]:Dt([e[a],t[a]])}),{})}function nO(e,t){return s.ShiftLeft(e,(n,o)=>nO(o,Kj(t,Ht(n))),()=>t)}function oO(e){return s.ShiftLeft(e,(t,n)=>nO(n,Ht(t)),()=>he())}function Ht(e){return Ee(e)?Jb(e.$defs,e.$ref):$e(e)?eO(e.if,e.then,e.else):G(e)?tO(e.allOf):C(e)?oO(e.anyOf):V(e)?rO(e.items):$(e)?e.properties:{}}function mi(e){let t=Ht(e);return D(t)}var zj=new RegExp("^(?:0|[1-9][0-9]*)$");function di(e){let t=`${e}`;return zj.test(t)?parseInt(t):e}function Yj(e){return Y(di(e))}function iO(e){return e.map(t=>aO(t))}function aO(e){return G(e)?dt(iO(e.allOf)):C(e)?q(iO(e.anyOf)):W(e)?Yj(e.const):e}function sO(e,t){let n=aO(t),o=ht({},n,Mt());return F.IsExtendsTrueLike(o)?e:W(t)&&s.IsEqual(t.const,"length")?Mt():fe()}function cO(e,t){let n=Cr(e,t);return $t(n)}function pO(e,t,n){let o=dr(e,t,n);return $t(o)}function uO(e){let t=Lt(e);return $t(t)}function lO(e){let t=ke(e);return $t(t)}function mO(e){return[`${e}`]}function dO(e){let t=_t(e);return $t(t)}function fO(e){return e.reduce((t,n)=>[...t,...$t(n)],[])}function $t(e){return Ee(e)?cO(e.$defs,e.$ref):$e(e)?pO(e.if,e.then,e.else):We(e)?uO(e.enum):G(e)?lO(e.allOf):W(e)?mO(e.const):_e(e)?dO(e.pattern):C(e)?fO(e.anyOf):[]}function fi(e){return $t(e)}function ns(e,t){return t.map(n=>os(e,n))}function os(e,t){return X(t)?vt(os(e,t.items)):Ye(t)?Ir(ns(e,t.parameters),os(e,t.instanceType)):Ve(t)?Sr(ns(e,t.parameters),os(e,t.returnType)):V(t)?Fe(ns(e,t.items)):C(t)?q(ns(e,t.anyOf)):G(t)?dt(ns(e,t.allOf)):Tp(t)?D(e):t}function gO(e,t){return os(e,t)}function Vj(e,t){let n=t in e?e[t]:fe();return gO(e,n)}function hO(e,t){return t.reduce((n,o)=>[...n,Vj(e,o)],[])}function Qj(e,t){let n=fi(t),o=hO(e,n);return Dt(o)}var Wj=new RegExp(gn);function Zj(e){return e.filter(n=>Wj.test(n))}function Xj(e){let t=Xc(e),n=Zj(t),o=hO(e,n);return Dt(o)}function yO(e,t){return we(t)?Xj(e):Qj(e,t)}function Jj(e){return Y(di(e))}function TO(e){return e.map(t=>td(t))}function td(e){return G(e)?dt(TO(e.allOf)):C(e)?q(TO(e.anyOf)):W(e)?Jj(e.const):e}function eq(e,t){return e.reduceRight((n,o,i)=>{let a=ht({},Y(i),t);return F.IsExtendsTrueLike(a)?[o,...n]:n},[])}function tq(e,t){let n=td(t),o=eq(e,n);return Kr(o)}function rq(e){return Kr(e)}function EO(e,t){return W(t)&&s.IsEqual(t.const,"length")?Y(e.length):we(t)||ct(t)?rq(e):tq(e,t)}function _O(e,t){return X(e)?sO(e.items,t):$(e)?yO(e.properties,t):V(e)?EO(e.items,t):fe()}function nq(e){return Ee(e)||$e(e)||G(e)||C(e)?mi(e):e}function ed(e,t,n){return K([e,t])?y.Update(_O(nq(e),t),{},n):Ha(e,t,n)}function IO(e,t,n,o,i){let a=A(e,t,n),c=A(e,t,o);return ed(a,c,i)}function Pp(e,t={}){return N("InstanceType",[e],t)}function SO(e,t={}){return rd(e,t)}function oq(e){return Ye(e)?e.instanceType:fe()}function rd(e,t){return K([e])?y.Update(oq(e),{},t):Pp(e,t)}function bO(e,t,n,o={}){let i=A(e,t,n);return rd(i,o)}function Ka(e,t={}){return N("KeyOf",[e],t)}function OO(e,t={}){return nd(e,t)}function AO(){return q([Mt(),At(),Jo()])}function xO(e){return Mt()}function iq(e){return e.reduce((n,o)=>ip(o)?[...n,Y(di(o))]:he(),[])}function RO(e){let t=s.Keys(e),n=iq(t);return Kr(n)}function CO(e){return hn(e)}function PO(e){let t=e.map((n,o)=>Y(o));return Kr(t)}function UO(e){return Je(e)?AO():X(e)?xO(e.items):$(e)?RO(e.properties):ge(e)?CO(e):V(e)?PO(e.items):fe()}function aq(e){return Ee(e)||$e(e)||G(e)||C(e)?mi(e):e}function nd(e,t){return K([e])?y.Update(UO(aq(e)),{},t):Ka(e,t)}function wO(e,t,n,o){let i=A(e,t,n);return nd(i,o)}function ja(e,t,n,o,i={}){return N("Mapped",[e,t,n,o],i)}function vO(e,t,n,o,i={}){return od({},Oe([],[]),e,t,n,o,i)}function sq(e){let t=_t(e);return Jp(t)}function cq(e){return e.reduce((t,n)=>[...t,...Jp(n)],[])}function pq(e){let t=Lt(e);return Jp(t)}function uq(e){return s.IsNumber(e)?[Y(`${e}`)]:[Y(e)]}function Jp(e){return We(e)?pq(e.enum):W(e)?uq(e.const):_e(e)?sq(e.pattern):C(e)?cq(e.anyOf):[e]}function NO(e){return Jp(e)}function lq(e){return _e(e)?_t(e.pattern):e}function mq(e,t,n,o,i,a){let c=y.Assign(e,{[n.name]:o}),l=A(c,t,i),m=lq(l),f=A(c,t,a);return ap(m)||sp(m)?{[m.const]:f}:{}}function dq(e,t,n,o,i,a){return o.reduce((c,l)=>[...c,mq(e,t,n,l,i,a)],[])}function fq(e){return e.reduce((t,n)=>[...t,D(n)],[])}function LO(e,t,n,o,i,a){let c=NO(o),l=dq(e,t,n,c,i,a),m=fq(l);return ke(m)}function od(e,t,n,o,i,a,c){return K([o])?y.Update(LO(e,t,n,o,i,a),{},c):ja(n,o,i,a,c)}function kO(e,t,n,o,i,a,c){let l=A(e,t,o);return od(e,t,n,l,i,a,c)}function gq(e,t,n){let o=y.Assign(e,t);return s.Keys(t).filter(a=>n.includes(a)).reduce((a,c)=>({...a,[c]:hb(o,c,t[c])}),{})}function hq(e,t,n){let o=y.Assign(e,t);return s.Keys(t).filter(a=>!n.includes(a)).reduce((a,c)=>({...a,[c]:A(o,Oe([],[]),t[c])}),{})}function yq(e,t,n){let o=mb(t),i=gq(e,t,o),a=hq(e,t,o),c={...i,...a};return y.Update(c,{},n)}function eu(e,t,n,o){return yq(e,n,o)}function Up(e,t={}){return N("NonNullable",[e],t)}function MO(e,t={}){return id(e,t)}function Tq(e){let t=q([Xo(),ni()]);return rs(e,t,{})}function id(e,t){return K([e])?y.Update(Tq(e),{},t):Up(e,t)}function DO(e,t,n,o){let i=A(e,t,n);return id(i,o)}function wp(e,t,n={}){return N("Omit",[e,t],n)}function GO(e,t,n={}){let o=s.IsArray(t)?li(t):t;return ad(e,o,n)}function tu(e){let t=mi(e);return $(t)?t.properties:he()}function Eq(e,t){return s.Keys(e).reduce((o,i)=>t.includes(i)?o:{...o,[i]:e[i]},{})}function $O(e,t){let n=tu(e),o=fi(t),i=Eq(n,o);return D(i)}function ad(e,t,n){return K([e,t])?y.Update($O(e,t),{},n):wp(e,t,n)}function FO(e,t,n,o,i){let a=A(e,t,n),c=A(e,t,o);return ad(a,c,i)}function vp(e,t={}){return N("Parameters",[e],t)}function jO(e,t={}){return sd(e,t)}function _q(e){let t=Ve(e)?e.parameters:[],n=In({},Oe([],[]),t);return Fe(n)}function sd(e,t){return K([e])?y.Update(_q(e),{},t):vp(e,t)}function qO(e,t,n,o){let i=A(e,t,n);return sd(i,o)}function Np(e,t={}){return N("Partial",[e],t)}function BO(e,t={}){return cd(e,t)}function HO(e,t){let n=Cr(e,t),o=Pr(n);return Or(y.Assign(e,{[t]:o}),t)}function KO(e,t,n){let o=dr(e,t,n);return Pr(o)}function zO(e){let t=ke(e);return Pr(t)}function YO(e){let t=e.map(n=>Pr(n));return q(t)}function VO(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:Xn(e[i])}),{});return D(t)}function Pr(e){return Ee(e)?HO(e.$defs,e.$ref):$e(e)?KO(e.if,e.then,e.else):G(e)?zO(e.allOf):C(e)?YO(e.anyOf):$(e)?VO(e.properties):D({})}function cd(e,t){return K([e])?y.Update(Pr(e),{},t):Np(e,t)}function QO(e,t,n,o){let i=A(e,t,n);return cd(i,o)}function Lp(e,t,n={}){return N("Pick",[e,t],n)}function WO(e,t,n={}){let o=s.IsArray(t)?li(t):t;return pd(e,o,n)}function Iq(e,t){return s.Keys(e).reduce((o,i)=>t.includes(i)?y.Assign(o,{[i]:e[i]}):o,{})}function ZO(e,t){let n=tu(e),o=fi(t),i=Iq(n,o);return D(i)}function pd(e,t,n){return K([e,t])?y.Update(ZO(e,t),{},n):Lp(e,t,n)}function XO(e,t,n,o,i){let a=A(e,t,n),c=A(e,t,o);return pd(a,c,i)}function kp(e,t={}){return N("ReadonlyObject",[e],t)}function ud(e,t={}){return ld(e,t)}var JO=ud;function eA(e){return Zo(vt(e))}function tA(e,t){let n=Cr(e,t),o=Ur(n);return Or(y.Assign(e,{[t]:o}),t)}function rA(e,t,n){let o=dr(e,t,n);return Ur(o)}function nA(e){let t=ke(e);return Ur(t)}function oA(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:no(e[i])}),{});return D(t)}function iA(e){return Zo(Fe(e))}function aA(e){let t=e.map(n=>Ur(n));return q(t)}function Ur(e){return X(e)?eA(e.items):Ee(e)?tA(e.$defs,e.$ref):$e(e)?rA(e.if,e.then,e.else):G(e)?nA(e.allOf):$(e)?oA(e.properties):V(e)?iA(e.items):C(e)?aA(e.anyOf):e}function ld(e,t){return K([e])?y.Update(Ur(e),{},t):kp(e)}function sA(e,t,n,o){let i=A(e,t,n);return ld(i,o)}function cA(e,t,n,o){return t.visited.includes(o)?n:o in e?A(e,Oe(t.callstack,[...t.visited,o]),e[o]):n}function pA(e,t){let n=Cr(e,t),o=wr(n);return Or(y.Assign(e,{[t]:o}),t)}function uA(e,t,n){let o=dr(e,t,n);return wr(o)}function lA(e){let t=ke(e);return wr(t)}function mA(e){let t=e.map(n=>wr(n));return q(t)}function dA(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:mp(e[i])}),{});return D(t)}function wr(e){return Ee(e)?pA(e.$defs,e.$ref):$e(e)?uA(e.if,e.then,e.else):G(e)?lA(e.allOf):C(e)?mA(e.anyOf):$(e)?dA(e.properties):D({})}function Mp(e,t={}){return N("Required",[e],t)}function fA(e,t={}){return md(e,t)}function md(e,t){return K([e])?y.Update(wr(e),{},t):Mp(e,t)}function gA(e,t,n,o){let i=A(e,t,n);return md(i,o)}function Dp(e,t={}){return N("ReturnType",[e],t)}function hA(e,t={}){return dd(e,t)}function Sq(e){return Ve(e)?e.returnType:fe()}function dd(e,t){return K([e])?y.Update(Sq(e),{},t):Dp(e,t)}function yA(e,t,n,o={}){let i=A(e,t,n);return dd(i,o)}function Gp(e,t){return N("With",[e,t],{})}function ru(e,t){return fd(e,t)}function fd(e,t){return K([e])?y.Update(e,{},t):Gp(e,t)}function TA(e,t,n,o){let i=A(e,t,n);return fd(i,o)}function bq(e){return yn(e)?V(e.items)?gd(e.items.items):Qe(e.items)?[e]:le(e.items)?[e]:[fe()]:[e]}function gd(e){return e.reduce((n,o)=>[...n,...bq(o)],[])}function Oe(e,t){return{callstack:e,visited:t}}function K(e){return s.ShiftLeft(e,(t,n)=>le(t)?!1:K(n),()=>!0)}function Za(e,t,n){return s.Keys(n).reduce((o,i)=>({...o,[i]:A(e,t,n[i])}),{})}function In(e,t,n){let o=Bt(e,t,n);return gd(o)}function Bt(e,t,n){return n.map(o=>A(e,t,o))}function Oq(e,t){let n=nt(e)?Pa(t,{}):t,o=oo(e)?Ca(n,{}):n;return ro(e)?is(o,{}):o}function Aq(e,t,n,o,i){return s.IsEqual(n,"AddImmutable")?EA(e,t,o[0],i):s.IsEqual(n,"RemoveImmutable")?Ub(e,t,o[0],i):s.IsEqual(n,"AddReadonly")?uT(e,t,o[0],i):s.IsEqual(n,"RemoveReadonly")?rE(e,t,o[0],i):s.IsEqual(n,"AddOptional")?lT(e,t,o[0],i):s.IsEqual(n,"RemoveOptional")?iE(e,t,o[0],i):s.IsEqual(n,"Capitalize")?$b(e,t,o[0],i):s.IsEqual(n,"Conditional")?Hb(e,t,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"ConstructorParameters")?zb(e,t,o[0],i):s.IsEqual(n,"Evaluate")?Eb(e,t,o[0],i):s.IsEqual(n,"Exclude")?Vb(e,t,o[0],o[1],i):s.IsEqual(n,"Extract")?Zb(e,t,o[0],o[1],i):s.IsEqual(n,"Index")?IO(e,t,o[0],o[1],i):s.IsEqual(n,"InstanceType")?bO(e,t,o[0],i):s.IsEqual(n,"Interface")?cb(e,t,o[0],o[1],i):s.IsEqual(n,"KeyOf")?wO(e,t,o[0],i):s.IsEqual(n,"Lowercase")?Fb(e,t,o[0],i):s.IsEqual(n,"Mapped")?kO(e,t,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"Module")?eu(e,t,o[0],i):s.IsEqual(n,"NonNullable")?DO(e,t,o[0],i):s.IsEqual(n,"Pick")?XO(e,t,o[0],o[1],i):s.IsEqual(n,"Parameters")?qO(e,t,o[0],i):s.IsEqual(n,"Partial")?QO(e,t,o[0],i):s.IsEqual(n,"Omit")?FO(e,t,o[0],o[1],i):s.IsEqual(n,"ReadonlyObject")?sA(e,t,o[0],i):s.IsEqual(n,"Record")?SE(e,t,o[0],o[1],i):s.IsEqual(n,"Required")?gA(e,t,o[0],i):s.IsEqual(n,"ReturnType")?yA(e,t,o[0],i):s.IsEqual(n,"TemplateLiteral")?xS(e,t,o[0],i):s.IsEqual(n,"Uncapitalize")?jb(e,t,o[0],i):s.IsEqual(n,"Uppercase")?qb(e,t,o[0],i):s.IsEqual(n,"With")?TA(e,t,o[0],o[1]):N(n,o,i)}function xq(e,t,n){let o=le(n)?cA(e,t,n,n.$ref):X(n)?vt(A(e,t,n.items),Yo(n)):ui(n)?Xp(e,t,n.target,n.arguments):Ye(n)?Ir(Bt(e,t,n.parameters),A(e,t,n.instanceType),mT(n)):Ve(n)?Sr(Bt(e,t,n.parameters),A(e,t,n.returnType),dT(n)):$e(n)?Jn(A(e,t,n.if),A(e,t,n.then),A(e,t,n.else),ET(n)):G(n)?dt(Bt(e,t,n.allOf),OT(n)):$(n)?D(Za(e,t,n.properties),yT(n)):ge(n)?gp(pt(n),A(e,t,xe(n))):yn(n)?co(A(e,t,n.items)):V(n)?Fe(In(e,t,n.items),tE(n)):C(n)?q(Bt(e,t,n.anyOf),KT(n)):n;return Oq(n,o)}function A(e,t,n){return ln(n)?Aq(e,t,n.action,n.parameters,n.options):xq(e,t,n)}function Jt(e,t){return A(e,Oe([],[]),t)}function Rq(e){return y.Update(e,{"~immutable":!0},{})}function is(e,t){return y.Update(Rq(e),{},t)}function EA(e,t,n,o){let i=A(e,t,n);return is(i,o)}function SI(e,t={}){return N("AddImmutable",[e],t)}function Zo(e,t={}){return is(e,t)}function bI(e,t={}){return N("Evaluate",[e],t)}function yt(e,t={}){return Bm(e,t)}function OI(e,t={}){return N("Module",[e],t)}function _A(e,t={}){return eu({},Oe([],[]),e,t)}function Cq(e,t){let n=so(e,t);return s.IsEqual(n,"right-inside")||s.IsEqual(n,"disjoint")?1:0}function IA(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>s.IsEqual(Cq(e,o),1)?IA(e,i,[...n,o]):[...n,e,...t],()=>[...n,e])}function SA(e,t=[]){return s.ShiftLeft(e,(n,o)=>SA(o,IA(n,t)),()=>t)}function bA(e){return SA(e)}function OA(...e){let[t,n,o]=ie.Match(e,{2:(c,l)=>s.IsString(c)?[{},c,l]:[c,l,{}],3:(c,l,m)=>[c,l,m],1:c=>[{},c,{}]}),i=IS(n),a=s.IsArray(i)&&s.IsEqual(i.length,2)?A(t,Oe([],[]),i[0]):fe();return y.Update(a,{},o)}var r={};Zt(r,{Any:()=>Qo,Array:()=>vt,BigInt:()=>Na,Boolean:()=>np,Call:()=>Cb,Capitalize:()=>kb,Codec:()=>tp,Conditional:()=>Bb,Constructor:()=>Ir,ConstructorParameters:()=>Kb,Cyclic:()=>Or,Decode:()=>kT,DecodeBuilder:()=>va,Dependent:()=>Jn,Encode:()=>MT,EncodeBuilder:()=>wa,Enum:()=>bT,Evaluate:()=>yt,Exclude:()=>Yb,Extends:()=>ht,ExtendsResult:()=>F,Extract:()=>Qb,Function:()=>Sr,Generic:()=>mn,Identifier:()=>La,Immutable:()=>DT,Index:()=>Xb,Infer:()=>Ua,InstanceType:()=>SO,Instantiate:()=>Jt,Integer:()=>io,Interface:()=>pb,Intersect:()=>dt,IsAny:()=>Je,IsArray:()=>X,IsBigInt:()=>kt,IsBoolean:()=>Ot,IsCall:()=>ui,IsCodec:()=>to,IsConstructor:()=>Ye,IsCyclic:()=>Ee,IsDependent:()=>$e,IsEnum:()=>We,IsEnumValue:()=>ST,IsFunction:()=>Ve,IsGeneric:()=>Vo,IsIdentifier:()=>jT,IsImmutable:()=>ro,IsInfer:()=>Qe,IsInteger:()=>ct,IsIntersect:()=>G,IsKind:()=>w,IsLiteral:()=>W,IsNever:()=>mr,IsNull:()=>xr,IsNumber:()=>we,IsObject:()=>$,IsOptional:()=>nt,IsParameter:()=>HT,IsReadonly:()=>oo,IsRecord:()=>ge,IsRef:()=>le,IsRefine:()=>rp,IsRest:()=>yn,IsSchema:()=>Le,IsString:()=>tt,IsSymbol:()=>Rr,IsTemplateLiteral:()=>_e,IsThis:()=>Tp,IsTuple:()=>V,IsUndefined:()=>fr,IsUnion:()=>C,IsUnknown:()=>ot,IsUnsafe:()=>ep,IsVoid:()=>Gt,KeyOf:()=>OO,Literal:()=>Y,Lowercase:()=>Mb,Mapped:()=>vO,Module:()=>_A,Never:()=>fe,NonNullable:()=>MO,Null:()=>Xo,Number:()=>Mt,Object:()=>D,Omit:()=>GO,Optional:()=>gT,Parameter:()=>ao,Parameters:()=>jO,Partial:()=>BO,Pick:()=>WO,Readonly:()=>GT,ReadonlyObject:()=>ud,ReadonlyType:()=>JO,Record:()=>ri,RecordKey:()=>hn,RecordPattern:()=>pt,RecordValue:()=>xe,Ref:()=>st,Refine:()=>$T,Required:()=>fA,Rest:()=>co,ReturnType:()=>hA,Script:()=>OA,String:()=>At,Symbol:()=>Jo,TemplateLiteral:()=>CS,This:()=>yp,Tuple:()=>Fe,Uncapitalize:()=>Db,Undefined:()=>ni,Union:()=>q,Unknown:()=>et,Unsafe:()=>TT,Uppercase:()=>Gb,Void:()=>Ep,With:()=>ru});var AA="Must be a valid tags query: only tag:value searches (no wildcards), boolean operators, and parentheses are supported.";var Pq=pn(RA());var CA="lowercase-email",mo="iana-timezone",hd="simple-time",yd="simple-date-time";var Uq=(e,t)=>RegExp(`^${e.source}(${t.source}${e.source})*$`),wq=/[a-zA-Z0-9-_]+/,vq=/\./,kUe=Uq(wq,vq);var PA="lowercase-domain";var gi="kebab-case";var UA="camel-case";var Nq=new Set;function R(e,t,n={}){let o=t.map(i=>{let a=i;return a.$id?(Nq.add(i),r.Ref(a.$id)):i});return r.Unsafe({...n,type:"object",discriminator:{propertyName:e},required:[e],oneOf:o})}function Ie(e,t){return r.Object({values:r.Array(e,{maxItems:t.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:r.Optional(r.Boolean({description:"If true, exclude rows matching these values instead of including them"}))},{description:t.description})}function Kt(e,t={}){return R("type",[r.Object({type:r.Literal("ids"),ids:r.Array(p({allowEmpty:!1}),{minItems:1,...t.maxIds!==void 0&&{maxItems:t.maxIds}})}),r.Object({type:r.Literal("all"),filters:r.Optional(e)})])}function iu(e){return r.Object({value:p({allowEmpty:!1,description:e.valueDescription}),exclude:r.Optional(r.Boolean({description:"If true, exclude rows matching this value instead of including them"}))},{description:e.description})}var yi=1e3,ou=100,ue={limit:r.Optional(r.Integer({minimum:1,maximum:yi,description:"Maximum number of items to return in this page."})),offset:r.Optional(r.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."}))},Lq=["asc","desc"],te=r.Enum(Lq,{description:"Sort direction: ascending or descending."}),qe={...ue,limit:r.Optional(r.Integer({minimum:1,maximum:yi,default:ou,description:`Maximum number of items to return in this page. Omit to use the public API default of ${ou}.`}))},kq=r.Object({totalCount:r.Integer({description:"Total number of items matching the query before `limit` and `offset` are applied."}),pageCount:r.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."}),jUe=r.Object({pagination:kq},{$id:"ResponseMetadata",description:"Metadata accompanying `data` on paginated operations, describing the full result set the page was taken from."});function Se(e,t={}){return r.Optional(r.Union([r.Null(),e],t))}function Ti(e){return{...e,method:"PUT"}}function S(e={}){return r.Unsafe({...e,type:"string"})}var hi=250;function p({allowEmpty:e=!0,type:t="short",description:n,default:o}={}){let i=e?0:1,a={...n===void 0?{}:{description:n},...o===void 0?{}:{default:o}};switch(t){case"camel-case":return r.String({format:UA,minLength:i,maxLength:hi,...a});case"kebab-case":return r.String({format:gi,minLength:i,maxLength:hi,...a});case"email":return r.String({format:CA,minLength:i,maxLength:254,errorMessage:{format:"Must be a valid lowercase email address."},...a});case"lowercase-domain":return r.String({format:PA,minLength:i,maxLength:hi,...a});case"tsuga-query":return r.String({format:"tsuga-query",minLength:i,maxLength:1e4,...a});case"tags-query":return r.String({format:"tags-query",minLength:i,maxLength:1e4,errorMessage:{format:`${AA} The query you provided is invalid: \${0}`},...a});case"date-time":return r.String({format:"date-time",...a});case"uri":return r.String({format:"uri",...a});case"user-password":return r.String({format:"user-password",minLength:12,maxLength:hi,...a});case"long":return r.String({minLength:i,maxLength:5e4,...a});case"short":return r.String({minLength:i,maxLength:hi,...a});case"tsuga-formula":return r.String({format:"tsuga-formula",minLength:i,maxLength:hi,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 r.String({format:"time",...a});case"readonly-sql-query":return r.String({format:"readonly-sql-query",minLength:i,maxLength:5e4,errorMessage:{format:"Must be a readonly SQL query - only SELECT statements are allowed."},...a});default:Ze(t)}}var as=["ingestion-api-key","operation-api-key","rum-public-token","dashboard","log-route","metric-route","monitor","notification-rule","notification-silence","slo"],au=r.Array(r.Enum(as,{description:"Tsuga-managed asset type."}),{description:"Tsuga-managed asset types covered by the policy. An empty array means all supported asset types."});var Td=["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","CLUSTER_DB_QUERY_CONNECTION_TIMEOUT"],ewe=r.Enum(Td),Mq=["CLUSTER_AGGREGATION_STRUCTURE"];var twe=r.Object({code:r.Enum(Td),message:r.String()}),vA=[...Td,...Mq,"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"],NA=["INTERNAL_ERROR","INVALID_QUERY_TO_CLUSTER"];var Dq=["NETWORK_ERROR","RESPONSE_PARSE_ERROR"],Gq=[...vA,...NA,...Dq],$q=r.Object({assetId:r.Optional(r.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:r.String({description:"Name of the asset that violated the policy. Set from submitted data or the existing asset row. Returned for every violation."}),assetType:r.Enum(as,{description:"Type of Tsuga asset validated by the policy. Set by the route that ran tag-policy validation. Returned for every violation."}),tagPolicyId:r.String({description:"Identifier of the active tag policy that was violated. Generated by Tsuga when the policy is created. Returned for every violation."}),tagKey:r.String({description:"Tag key required or constrained by the violated policy. Set by the tag policy. Returned for every violation."}),message:r.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."}),Fq=R("type",[r.Object({type:r.Literal("invalid-syntax",{description:"Discriminator identifying a rule the grok parser could not parse at all."}),error:r.Object({offset:r.Integer({description:"Byte offset in the rule where parsing failed."}),detail:r.String({description:"Parser detail message."})},{description:"Position and parser message for the syntax failure."})},{$id:"GrokInvalidSyntax"}),r.Object({type:r.Literal("unknown-pattern",{description:"Discriminator identifying a rule that references a pattern name the grok engine does not provide."}),error:r.Object({offset:r.Integer({description:"Byte offset of the unknown pattern."}),unknownPattern:r.String({description:"The pattern name that is not supported."})},{description:"Position and name of the unsupported pattern."})},{$id:"GrokUnknownPattern"}),r.Object({type:r.Literal("invalid-filter",{description:"Discriminator identifying a rule whose filter is a known filter used incorrectly."}),error:r.Object({offset:r.Integer({description:"Byte offset of the invalid filter."}),invalidFilter:r.String({description:"The filter that is invalid."}),message:r.String({description:"Why the filter is invalid."})},{description:"Position, text, and reason for the invalid filter."})},{$id:"GrokInvalidFilter"}),r.Object({type:r.Literal("unknown-filter",{description:"Discriminator identifying a rule that references a filter name the grok engine does not implement."}),error:r.Object({offset:r.Integer({description:"Byte offset of the unknown filter."}),unknownFilter:r.String({description:"The filter name that is not implemented."}),message:r.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`."}),jq=r.Object({rule:r.String({description:"The rule that failed to compile."}),ruleIndex:r.Integer({description:"0-based index of the failing rule in the submitted `rules` array."}),error:Fq},{description:"A single grok rule that failed to compile, with its position in the submitted rules and the structured compile error."}),LA=R("type",[r.Object({type:r.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:r.Array($q,{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"}),r.Object({type:r.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:r.Array(jq,{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."}),rwe=r.Object({code:r.Optional(r.Enum(Gq,{description:"Machine readable error code describing what went wrong"})),message:r.String({description:"Human readable explanation of the error"}),statusCode:r.Number({description:"HTTP status code that was returned"}),details:r.Optional(LA)},{$id:"ErrorResponse",description:"Standard envelope for API errors"}),nwe=r.Object({code:r.Optional(r.Enum(vA,{description:"Machine readable error code describing what went wrong"})),message:r.String({description:"Human readable explanation of the error"}),statusCode:r.Number({description:"HTTP status code that was returned"}),details:r.Optional(LA)},{$id:"ClientErrorResponse",description:"Standard envelope for client (4XX) API errors"}),owe=r.Object({code:r.Optional(r.Enum(NA,{description:"Machine readable error code describing what went wrong"})),message:r.String({description:"Human readable explanation of the error"}),statusCode:r.Number({description:"HTTP status code that was returned"})},{$id:"ServerErrorResponse",description:"Standard envelope for server (5XX) API errors"}),iwe=r.Object({requestId:r.String({description:"Identifier used to trace the lifecycle of this API request"}),error:r.Ref("ClientErrorResponse")},{$id:"ClientErrorEnvelope",description:"Standard envelope wrapping all client (4XX) error responses"}),awe=r.Object({requestId:r.String({description:"Identifier used to trace the lifecycle of this API request"}),error:r.Ref("ServerErrorResponse")},{$id:"ServerErrorEnvelope",description:"Standard envelope wrapping all server (5XX) error responses"});function d({body:e,description:t,method:n,operationId:o,params:i,tags:a,query:c,paginated:l,response:m,url:f}){return i?{buildUrl:E=>f.replace(/:[a-zA-Z_]+/g,I=>E[I.slice(1)]),method:n,params:i,response:m,templateUrl:f,...e===void 0?{}:{body:e},...t===void 0?{}:{description:t},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}:{method:n,response:m,url:f,templateUrl:f,...e===void 0?{}:{body:e},...t===void 0?{}:{description:t},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}}function kA(e,t){if(!t||typeof t!="object")return e;let n=new URLSearchParams;return Object.entries(t).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 v=r.Object({success:r.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 cu="tsuga-cli";var fo="/v0/oauth",MA=d({description:"OAuth 2.1 authorization endpoint: validates the client and redirect URI, then redirects to the consent page",url:`${fo}/authorize`,method:"GET",query:r.Partial(r.Object({response_type:r.String({description:"Must be `code`"}),client_id:r.String({description:"First-party client id or CIMD document URL"}),redirect_uri:r.String({description:"Client redirect URI"}),code_challenge:r.String({description:"PKCE code challenge"}),code_challenge_method:r.String({description:"Must be `S256`"}),state:r.String({description:"Opaque client state, echoed back"}),resource:r.String({description:"RFC 8707 resource indicator"})})),response:r.Object({},{description:"Never returned: this endpoint redirects (302) or renders an HTML error (400)"})}),DA=d({description:"OAuth 2.1 token endpoint: exchanges an authorization code (PKCE) or refresh token for a token pair",url:`${fo}/token`,method:"POST",body:r.Partial(r.Object({grant_type:r.String({description:"`authorization_code` or `refresh_token`"}),code:r.String({description:"Authorization code being exchanged"}),code_verifier:r.String({description:"PKCE code verifier"}),redirect_uri:r.String({description:"Must match the redirect URI used on /authorize"}),client_id:r.String({description:"Client id, when sent by the client"}),refresh_token:r.String({description:"Refresh token, for `grant_type=refresh_token`"})})),response:r.Object({access_token:r.String(),token_type:r.Literal("Bearer"),expires_in:r.Number({description:"Access token lifetime in seconds"}),refresh_token:r.String()})}),Swe=d({description:"Resolve a signed authorization request handle for the consent page",url:`${fo}/authorization-request`,method:"GET",query:r.Object({handle:r.String()}),response:r.Object({clientId:r.String(),clientName:r.String(),redirectUri:r.String()})}),bwe=d({description:"Approve or deny an OAuth authorization request from the consent page",url:`${fo}/approve`,method:"POST",body:r.Object({handle:r.String({description:"The signed authorization request handle"}),approve:r.Boolean()}),response:r.Object({redirectTo:r.String({description:"The client's redirect URI carrying either the code or the denial"})})}),Owe=d({description:"Validate an OAuth access token (internal, for the MCP resource server)",url:`${fo}/introspect`,method:"POST",body:r.Object({token:r.String()}),response:r.Object({active:r.Boolean(),userId:r.Optional(r.String()),orgId:r.Optional(r.String())})}),qq=["pending","active","revoked"],Bq=r.Object({id:r.String(),createdAt:S(),clientId:r.String({description:"Client ID Metadata Document URL or first-party client id"}),clientName:r.String({description:"Display name derived from the client identity"}),userId:r.String(),status:r.Enum(qq),lastUsedAt:r.Optional(S())}),Awe=d({tags:["oauth"],description:"List OAuth grants: your own, or all users for admins",url:`${fo}/grants`,method:"GET",query:r.Object({allUsers:r.Optional(r.Boolean({description:"Admins only: list grants of every user in the org"}))}),response:r.Array(Bq)}),xwe=d({tags:["oauth"],description:"Delete an OAuth grant (own grant, or any grant for admins)",url:`${fo}/grants/:id`,method:"DELETE",params:r.Object({id:r.String()}),response:v});function GA(e,t){let n=new URL(MA.url,e);return n.search=new URLSearchParams({response_type:"code",client_id:cu,redirect_uri:t.redirectUri,code_challenge:t.challenge,code_challenge_method:"S256",state:t.state}).toString(),n.href}var ss=class extends Error{constructor(n,o){super(n);this.code=o;this.name="OAuthTokenError"}};function Hq(e){if(!e)return{};try{let t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}async function $A(e,t){let n=await fetch(new URL(DA.url,e).href,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(t).toString()}),o=await n.text(),i=Hq(o);if(n.status!==200){let a=i.error??`HTTP ${n.status}`;throw new ss(`OAuth token request failed (${a}${i.error_description?`: ${i.error_description}`:""})`,a)}if(typeof i.access_token!="string"||i.access_token===""||typeof i.refresh_token!="string"||i.refresh_token===""||typeof i.expires_in!="number")throw new Error("OAuth token response was missing required fields");return{accessToken:i.access_token,refreshToken:i.refresh_token,expiresAt:new Date(Date.now()+i.expires_in*cm)}}async function FA(e,t){return $A(e,{grant_type:"authorization_code",client_id:cu,code:t.code,code_verifier:t.verifier,redirect_uri:t.redirectUri})}async function pu(e,t){return $A(e,{grant_type:"refresh_token",client_id:cu,refresh_token:t})}var Kq="Your session expired. Run `tsuga auth login` to sign in again.",zq="Your session could not be renewed: the refresh token was already used, revoked or expired. A refresh token is single-use, so the server revokes the whole session when one is replayed - run `tsuga auth login` to sign in again.",Yq=5*Oa;function jA(e,t){let n=new Date(e.accessExpiresAt).getTime();return Number.isNaN(n)||n<=t.getTime()+Yq}function cs(e){return`\u2022\u2022\u2022\u2022${e.slice(-4)}`}function uu(e){let t;try{t=JSON.parse(e)}catch{return}if(typeof t!="object"||t===null)return;let{accessToken:n,accessExpiresAt:o,refreshToken:i}=t;if(!(typeof n!="string"||n==="")&&!(typeof o!="string"||o==="")&&!(i!==void 0&&typeof i!="string"))return{accessToken:n,accessExpiresAt:o,...i===void 0?{}:{refreshToken:i}}}function Ed(e){return{accessToken:e.accessToken,accessExpiresAt:e.expiresAt.toISOString(),refreshToken:e.refreshToken}}function qA(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 BA(e){if(e)switch(e.kind){case"operation-api-key":return e.token;case"user-session":return e.userAuth.accessToken;default:Ze(e)}}async function lu({userAuth:e,now:t,reload:n,refresh:o,persist:i}){if(!jA(e,t))return e;let a=n()??e;if(!jA(a,t))return a;if(!a.refreshToken)throw new Error(Kq);let c;try{c=await o(a.refreshToken)}catch(m){throw m instanceof ss&&m.code==="invalid_grant"?new Error(zq,{cause:m}):new Error(`Could not renew your session: ${m instanceof Error?m.message:String(m)}. Retry the command.`,{cause:m})}let l=Ed(c);try{i(l)}catch(m){console.error(`Warning: could not save the renewed session (${m instanceof Error?m.message:String(m)}). Run \`tsuga auth login\` before the next command.`)}return l}var _d={r:8,g:203,b:0},Id={r:0,g:130,b:0},Sd=["\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 bd(e,t,n){return Math.round(e+(t-e)*n)}function Vq(e,t){let n=bd(_d.r,Id.r,t),o=bd(_d.g,Id.g,t),i=bd(_d.b,Id.b,t);return`\x1B[38;2;${n};${o};${i}m${e}\x1B[0m`}function Qq(e){if(!e)return`
34
34
 
35
- ${_d.join(`
36
- `)}`;let t=_d.length-1;return`
35
+ ${Sd.join(`
36
+ `)}`;let t=Sd.length-1;return`
37
37
 
38
- ${_d.map((o,i)=>Hq(o,t===0?0:i/t)).join(`
39
- `)}`}function qA(){return Kq(process.stdout.isTTY&&!process.env.NO_COLOR)}var oR=require("node:crypto");var Sd=["red","orange","amber","yellow","green","emerald","teal","cyan","sky","blue","indigo","purple","pink"],bd=["light","dark"];var zq={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)"}},BA=["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 xwe=zq.light.red.background;var Yq=["allowed-domains","cluster-integration-config","custom-usage-tag","database","databricks-connection","explorer-saved-view","github-connection","host","inventory","llm-provider","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"],Vq=["adaptive-notification-rule","audit-log","cloud-account","dashboard-folder","dashboard-report","dashboard","ingestion-api-key","investigation","log-route","metric-route","monitor","notebook","notification-integration","notification-rule","notification-silence","operation-api-key","quality-report","rum-public-token","sandbox-environment","slo","tag-policy","team-members","team","user-data","user-invitation","user-permissions"],Qq=["log","metric","trace","rum"],Od=[...Vq,...Qq],vwe=[...Yq,...Od];var yi=["admin","public_editor","public_viewer","teams_only"],wr=["admin","editor","viewer"];var fo="/v0/team-membership",Ad="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.",xd=r.Object({id:r.String({description:"Tsuga-generated team membership ID assigned when the membership is created."}),userId:r.String({description:"User ID that belongs to the team."}),teamId:r.String({description:"Team ID that contains the user."}),roleKey:r.Enum(wr,{description:Ad})}),HA=r.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:r.Enum(wr,{description:Ad})}),Wq=r.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."})}),Zq=r.Optional(r.Object({userId:r.Optional(p({allowEmpty:!1,description:"Restrict results to memberships for this user ID."})),teamId:r.Optional(p({allowEmpty:!1,description:"Restrict results to memberships for this team ID."}))})),Nwe=d({tags:["access-control"],url:fo,method:"GET",query:Zq,response:r.Array(xd)}),Lwe=d({tags:["access-control"],url:fo,method:"POST",body:HA,response:xd}),kwe=d({tags:["access-control"],url:fo,method:"PUT",body:HA,response:xd}),Mwe=d({tags:["access-control"],url:fo,method:"DELETE",body:Wq,response:v}),lu=500,KA=r.Object({teamId:p({allowEmpty:!1,description:"Team ID receiving all requested memberships."}),members:r.Array(r.Object({userId:r.Optional(p({allowEmpty:!1,description:"Existing user ID to add to the team."})),userEmail:r.Optional(p({allowEmpty:!1,type:"email",description:"Existing user email to resolve and add to the team."})),roleKey:r.Enum(wr,{description:Ad})},{oneOf:[{required:["userId"]},{required:["userEmail"]}]}),{minItems:1,maxItems:lu,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."}),Xq={teamId:"team-123-abc",members:[{userId:"user-123-abc",roleKey:"viewer"},{userEmail:"sam@example.com",roleKey:"editor"}]};Object.assign(KA,{examples:[Xq]});var zA=r.Object({results:r.Array(r.Object({userId:r.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:r.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."}),Jq={results:[{userId:"user-123-abc",status:"added"},{userId:"sam@example.com",status:"user_not_found"}]};Object.assign(zA,{examples:[Jq]});var Dwe=d({tags:["access-control"],url:`${fo}/bulk-add`,method:"POST",body:KA,response:zA}),Gwe=d({tags:["access-control"],url:`${fo}/bulk-update-user-roles`,method:"PUT",body:r.Object({userIds:r.Array(p({allowEmpty:!1}),{minItems:1,maxItems:lu}),teamId:p({allowEmpty:!1}),role:r.Enum(wr)}),response:r.Object({})}),YA=r.Object({teamId:p({allowEmpty:!1,description:"Team ID to remove the requested users from."}),userIds:r.Optional(r.Array(p({allowEmpty:!1}),{minItems:1,maxItems:lu,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:r.Optional(r.Array(p({allowEmpty:!1,type:"email"}),{minItems:1,maxItems:lu,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."}),eB={teamId:"team-123-abc",userIds:["user-123-abc"]};Object.assign(YA,{examples:[eB]});var VA=r.Object({results:r.Array(r.Object({userId:r.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:r.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."}),tB={results:[{userId:"user-123-abc",status:"removed"},{userId:"missing@example.com",status:"user_not_found"}]};Object.assign(VA,{examples:[tB]});var $we=d({tags:["access-control"],url:`${fo}/bulk-remove`,method:"DELETE",body:YA,response:VA});var rB="^\\S(.*\\S)?$",nB=128,oB=256,iB=r.Object({key:r.String({description:"Tag key attached to the resource. Consumers can use key/value tags for filtering, ownership context, and policy checks."}),value:r.String({description:"Tag value attached to the resource for this key. Tsuga returns the value exactly as stored."})},{title:"Tag"}),aB=r.Object({key:r.String({maxLength:nB,description:"Tag key to attach to the resource."}),value:r.String({maxLength:oB,pattern:rB,description:"Tag value to attach to the resource. Leading or trailing whitespace is rejected."})},{title:"Tag"}),zt=r.Array(iB,{title:"Tags",description:"Key/value tags applied to the resource. Use them to organize resources and to satisfy tag policies."}),Yt=r.Array(aB,{title:"Tags",maxItems:50,description:"Key/value tags to apply to the resource. Tag policies may require specific keys or values."}),ve=r.Optional(zt),De=r.Optional(Yt);var Sn="/v0/teams",du=["public","private"],mu={NAME:"name",CREATED_AT:"createdAt",MEMBER_COUNT:"memberCount",VISIBILITY:"visibility"},sB=r.Enum([mu.NAME,mu.CREATED_AT,mu.MEMBER_COUNT,mu.VISIBILITY],{description:"Team field used for sorting list responses. Use `name`, `createdAt`, `memberCount`, or `visibility`."}),fu=r.Object({color:r.Enum(Sd,{description:"Color token used by Tsuga when rendering the team avatar."}),mode:r.Enum(bd,{description:"Avatar rendering mode selected for the team."}),iconName:r.Enum(BA,{description:"Icon name rendered inside the team avatar when icon mode is used."})}),Ti=r.Object({color:r.Enum(Sd),mode:r.Enum(bd)}),QA=100,WA=250,bn=r.Object({id:r.String({description:"Unique identifier of the team. Generated by Tsuga and stable for the team lifetime."}),name:r.String({description:"Human-readable team name displayed throughout Tsuga and used in team search."}),description:r.Optional(r.String({description:"Optional free-text description of the team."})),visibility:r.Enum(du,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:ve,createdAt:S({description:"Timestamp when Tsuga created the team."}),updatedAt:S({description:"Timestamp when Tsuga last updated the team metadata."}),memberCount:r.Optional(r.Number({description:"Number of members currently in the team"})),avatar:r.Optional(fu)}),gu=r.Object({name:r.String({minLength:1,maxLength:QA,format:fi,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 ${QA} characters.`}),description:Se(r.String({maxLength:WA}),{description:`Optional team description. Maximum length is ${WA} characters.`}),visibility:r.Enum(du,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:De,avatar:Se(fu)}),cB=r.Object({id:r.String(),name:r.String(),email:r.String(),role:r.Enum(wr),joinedTeamAt:S(),orgRole:r.Enum(yi),avatar:r.Optional(Ti)}),ZA=r.Object({searchQuery:r.Optional(p({description:"Substring matched against team names and descriptions."})),visibility:r.Optional(r.Enum(du,{description:"Restrict results to teams with this visibility."})),myTeamsOnly:r.Optional(r.Boolean({description:"If true, return only teams that include the authenticated user."}))}),Zwe=d({tags:["teams"],url:Sn,method:"GET",paginated:!0,response:r.Array(bn),query:r.Object({...le,includeMemberCount:r.Optional(r.Boolean()),...ZA.properties,sortBy:r.Optional(sB),sortDirection:r.Optional(ne)})}),Xwe=d({tags:["teams"],url:`${Sn}/:id`,method:"GET",params:r.Object({id:p()}),response:bn}),Jwe=d({tags:["teams"],url:`${Sn}/:id/members`,method:"GET",params:r.Object({id:p()}),response:r.Array(cB)}),eve=d({tags:["teams"],url:`${Sn}/:id/assets`,method:"GET",params:r.Object({id:p()}),response:r.Object({apiKeyCount:r.Number(),logRouteCount:r.Number(),monitorCount:r.Number(),notificationRuleCount:r.Number(),dashboardCount:r.Number()})}),tve=d({tags:["teams"],url:Sn,method:"POST",body:gu,response:bn}),rve=d({tags:["teams"],url:`${Sn}/:id`,method:"PUT",params:r.Object({id:p()}),body:gu,response:bn}),pB=R("type",[r.Object({type:r.Literal("ids"),teamIds:r.Array(p({allowEmpty:!1}),{minItems:1,maxItems:100})}),r.Object({type:r.Literal("all"),filters:r.Optional(ZA)})]),nve=d({tags:["teams"],url:`${Sn}/bulk-update`,method:"POST",body:r.Object({selection:pB,config:r.Object({visibility:r.Enum(du)})}),response:r.Object({})}),ove=d({tags:["teams"],url:`${Sn}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v});var uB=r.Enum(["agent","cli","mcp-codemode","mcp-server","terraform-provider","web-frontend"],{description:"Tsuga client surface that performed the operation. Use this to distinguish UI, CLI, MCP, and Terraform-originated changes."}),se=R("type",[r.Object({type:r.Literal("user",{description:"The resource was created or updated by a user."}),id:r.String({description:"Unique identifier of the user actor."}),name:r.String({description:"Display name of the user actor at the time of response."}),avatar:r.Optional(Ti)}),r.Object({type:r.Literal("operation-api-key",{description:"The resource was created or updated by an operation API key."}),id:r.String({description:"Unique identifier of the operation API key actor."}),name:r.String({description:"Display name of the operation API key actor."}),source:r.Optional(uB)})],{description:"User or operation API key responsible for creating or updating a resource. Returned by Tsuga for audit context."});var Rd=["all","owning-team-and-public","owning-team-only"],On=r.Enum(Rd,{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 cs="/v0/operation-api-keys";var lB=100,hu=r.Enum(Rd,{description:"Team-access boundary for the operation API key. Set when the key is created or updated. `all` can reach all teams, `owning-team-and-public` can reach the owning team and public teams, and `owning-team-only` can reach only the owning team."}),go=e=>r.Literal("read",{description:e}),rt=e=>r.Enum(["read","write"],{description:e}),yu=r.Partial(r.Object({investigations:rt("Investigations, the records collecting the timeline and findings of an incident analysis."),dashboard:rt("Dashboards and the graphs they contain."),"dashboard-folder":rt("Folders organizing dashboards."),documentation:go("Tsuga documentation and API reference pages, which are public content rather than account data."),"ingestion-api-key":rt("Ingestion API keys, used to send telemetry data to Tsuga."),"rum-public-token":rt("RUM public tokens, embedded in web and mobile applications to send real user monitoring telemetry."),inventory:go("Cloud resources discovered by inventory scans."),"cloud-account":rt("Cloud accounts Tsuga scans to discover resources."),logs:go("Ingested log events, through search and aggregation endpoints."),"log-route":rt("Log routes, which select newly ingested logs and apply processors to them."),metrics:go("Ingested metrics, through query and aggregation endpoints."),"metric-route":rt("Metric routes, which select newly ingested metrics by name and apply processors to them."),monitor:rt("Monitors, the alert definitions evaluated against telemetry."),"allowed-domains":rt("Email domains whose users are allowed to join the organization."),"quality-report":go("Telemetry quality reports."),service:go("Services of the catalog, inferred from telemetry."),"service-target":rt("Notification targets attached to a service."),slo:rt("Service level objectives and the alerts attached to them."),"notification-rule":rt("Notification rules, which route alert transitions to notification targets."),"notification-integration":rt("Notification integrations, containing the credentials Tsuga uses when sending notifications."),"notification-silence":rt("Notification silences, which suppress matching notification delivery."),"custom-usage-tag":rt("Custom usage tags, the telemetry tag keys tracked as usage dimensions."),"retention-policy":rt("Retention policies applied to logs, metrics, and traces."),"tag-policy":rt("Tag policies, which enforce tag requirements on Tsuga-managed assets and telemetry data."),team:rt("Teams and their settings."),"team-membership":rt("Team memberships, each pairing a user with a team role."),traces:go("Ingested spans, through search and aggregation endpoints."),user:rt("User accounts of the organization."),"user-invitation":rt("Invitations for people who do not belong to the organization yet.")}),{description:"Resource types the key can act on, each mapped to `read` or `write`. `write` also grants read access. A resource type absent from the map is not accessible to the key at all."}),Cd=r.Object({id:r.String(),name:r.String(),owner:r.String(),tags:ve,scope:hu,permissions:yu,keyLastCharacters:r.String(),updatedAt:S(),createdAt:S(),creator:r.Optional(se),updater:r.Optional(se),expiresAt:r.Optional(S()),lastUsedAt:r.Optional(S())}),XA=r.Object({name:r.String({minLength:1,maxLength:lB}),owner:p({allowEmpty:!1}),tags:De,scope:hu,permissions:yu,expiresAt:Se(p({allowEmpty:!1,type:"date-time"}))}),Eve=d({tags:["operation-api-keys"],url:cs,method:"POST",body:XA,response:r.Intersect([Cd,r.Object({key:r.String()})])}),_ve=d({tags:["operation-api-keys"],url:cs,method:"GET",response:r.Array(Cd)}),Ive=d({tags:["operation-api-keys"],url:`${cs}/:id`,method:"PUT",params:r.Object({id:p()}),body:XA,response:Cd}),Sve=d({tags:["operation-api-keys"],url:`${cs}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),bve=d({tags:["operation-api-keys"],url:`${cs}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(p({allowEmpty:!1}))}),response:r.Object({})});var mB=["logs","metrics","traces","profiling","analytics","dashboards","notebooks","ongoing-alerts","slo","monitor","notification-rules","notification-silences","notification-integrations","investigations","routes","sensitive-data-scanner","ai-sandboxes","inventory","services","rum","browser-views","mobile","sessions","host-catalog","kubernetes","ecs","serverless"],JA=r.Enum(mB,{description:"Stable nav item key within a main sidebar category."}),ex=r.Array(JA,{description:"Nav item keys shown in the primary sidebar for this category, in display order."}),tx=r.Optional(r.Array(JA,{description:"Nav item keys for this category that are folded away (e.g. View more). Omitted or empty means none."})),rx="Stable category id. Unknown or renamed ids are ignored by the client catalog.",nx="Sidebar categories in display order. Unknown or renamed ids are ignored by the client catalog.",ox=r.Object({categories:r.Array(r.Object({id:r.String({description:rx}),visible:ex,folded:tx}),{description:nx})}),ix=r.Object({categories:r.Array(r.Object({id:p({allowEmpty:!1,description:rx}),visible:ex,folded:tx}),{description:nx})});var ax=["YYYY-MM-DD","DD-MM-YYYY","MM-DD-YYYY"],sx=["12h","24h"],dB=r.Union([r.Object({type:r.Literal("home")}),r.Object({type:r.Literal("explorer")}),r.Object({type:r.Literal("metrics")}),r.Object({type:r.Literal("traces")}),r.Object({type:r.Literal("analytics")}),r.Object({type:r.Literal("dashboards"),id:r.String()}),r.Object({type:r.Literal("ongoing-alerts")}),r.Object({type:r.Literal("services")}),r.Object({type:r.Literal("rum-views")}),r.Null()]),fB=r.Union([R("type",[r.Object({type:r.Literal("home")}),r.Object({type:r.Literal("explorer")}),r.Object({type:r.Literal("metrics")}),r.Object({type:r.Literal("traces")}),r.Object({type:r.Literal("analytics")}),r.Object({type:r.Literal("dashboards"),id:p()}),r.Object({type:r.Literal("ongoing-alerts")}),r.Object({type:r.Literal("services")}),r.Object({type:r.Literal("rum-views")})]),r.Null()]),An=r.Object({email:r.String({description:"Lowercase email address for the user. Use this for display and invitation matching, not as a stable identifier."}),id:r.String({description:"Unique identifier of the user. Generated by Tsuga and stable for the user lifetime."}),name:r.String({description:"Display name of the user."}),role:r.Enum(yi,{description:"Organization role for the user: `admin`, `public_editor`, `public_viewer`, or `teams_only`."}),orgId:r.String({description:"Identifier of the Tsuga organization the user belongs to."}),orgName:r.Optional(r.String({description:"Display name of the organization."})),avatar:r.Optional(Ti),defaultView:r.Optional(dB),timezone:r.Optional(r.Union([r.String(),r.Null()],{description:"IANA timezone used to display dates and times (e.g. `Europe/Paris`). Absent or `null` means the timezone is auto-detected from the browser."})),dateFormat:r.Optional(r.Union([r.Enum(ax),r.Null()],{description:"Preferred format for displaying dates: `YYYY-MM-DD`, `DD-MM-YYYY`, or `MM-DD-YYYY`. Absent or `null` means the Tsuga default format."})),hourFormat:r.Optional(r.Union([r.Enum(sx),r.Null()],{description:"Preferred format for displaying times: `12h` (AM/PM) or `24h`. Absent or `null` means the Tsuga default format."})),favoriteDashboards:r.Optional(r.Array(r.String(),{description:"Dashboard IDs the user marked as favorites."})),favoriteFolders:r.Optional(r.Array(r.String(),{description:"Dashboard folder IDs the user marked as favorites."})),filterDataByTeams:r.Optional(r.Boolean({description:"Whether the user wants data across the application filtered to the teams they belong to. Set by the user in their profile settings."})),sidebarNavLayout:r.Optional(ox),fromSso:r.Boolean({description:"Whether the user account was provisioned or authenticated through SSO."}),createdAt:S({description:"Timestamp when Tsuga created the user."}),updatedAt:S({description:"Timestamp when Tsuga last updated the user."}),teamIds:r.Optional(r.Array(r.String(),{description:"Team IDs the user currently belongs to."}))}),cx=r.Intersect([bn,r.Object({userRole:r.Enum(wr)})]),px=r.Object({token:r.String(),user:An}),Mve=d({tags:["users"],url:"/v0/login",method:"POST",body:r.Object({email:p({type:"email"}),password:p({type:"long"})}),response:px}),Dve=d({tags:["users"],url:"/v0/forgot-password",method:"POST",body:r.Object({email:p({type:"email"})}),response:r.Object({})}),Gve=d({tags:["users"],url:"/v0/reset-password",method:"POST",body:r.Object({resetToken:p(),password:p({type:"user-password"})}),response:r.Object({})}),gB=["active","expired"],$ve=d({tags:["users"],url:"/v0/reset-password-status/:resetToken",method:"GET",params:r.Object({resetToken:p()}),response:r.Object({status:r.Enum(gB)})}),Fve=d({tags:["users"],url:"/v0/change-password",method:"POST",body:r.Object({currentPassword:p({type:"long"}),newPassword:p({type:"user-password"})}),response:r.Object({})}),Ei="/v0/users",Pd="/v0/current-user",jve=d({tags:["users"],url:Pd,method:"GET",response:An}),qve=d({tags:["users"],url:`${Pd}/teams`,method:"GET",response:r.Array(cx)}),Bve=d({tags:["users"],url:"/v0/logout",method:"POST",response:r.Object({})}),Hve=d({tags:["users"],method:"PUT",url:Pd,body:r.Object({avatar:r.Optional(Ti),defaultView:r.Optional(fB),timezone:r.Optional(r.Union([r.String({format:os}),r.Null()])),dateFormat:r.Optional(r.Union([r.Enum(ax),r.Null()])),hourFormat:r.Optional(r.Union([r.Enum(sx),r.Null()])),favoriteDashboards:r.Optional(r.Array(p({allowEmpty:!1}))),favoriteFolders:r.Optional(r.Array(p({allowEmpty:!1}))),filterDataByTeams:r.Optional(r.Boolean()),sidebarNavLayout:r.Optional(r.Union([ix,r.Null()])),name:p()}),response:An}),Kve=d({tags:["users"],url:Ei,method:"GET",response:r.Array(An),query:r.Optional(r.Object({includeTeamIds:r.Optional(r.Boolean())}))}),ps={NAME:"name",ROLE:"role",LOGIN_METHOD:"fromSso",TEAMS:"teams",CREATED_AT:"createdAt"},ux=r.Partial(r.Object({searchQuery:r.Object({value:p({allowEmpty:!1,description:"Substring to match against the member name or email."})},{description:"Substring matched against the member name or email"})},{description:"Optional filters applied to narrow the returned members"})),hB=r.Partial(r.Object({...le,includeTeamIds:r.Boolean({description:"When true, include the IDs of the teams each member belongs to."}),filters:ux,sort:r.Object({by:r.Enum([ps.NAME,ps.ROLE,ps.LOGIN_METHOD,ps.TEAMS,ps.CREATED_AT],{description:"Field to sort the returned members by"}),direction:ne},{description:"Optional sorting applied to the returned members"})})),zve=d({tags:["users"],url:`${Ei}/query`,method:"POST",paginated:!0,response:r.Array(An),body:hB}),{teamIds:Yve,...yB}=An.properties,TB=r.Object({...yB,teams:r.Optional(r.Array(cx))}),Vve=d({tags:["users"],url:`${Ei}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1})}),query:r.Optional(r.Object({includeTeamRoles:r.Optional(r.Boolean())})),response:TB}),EB=Kt(ux),Qve=d({tags:["users"],method:"PUT",url:`${Ei}/bulk-update-role`,body:r.Object({selection:EB,role:r.Enum(yi)}),response:r.Object({})}),Wve=d({tags:["users"],url:`${Ei}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),Zve=d({tags:["users"],url:`${Ei}/all-emails`,method:"GET",response:r.Array(r.String())}),lx=["pending","accepted","expired","revoked"],_B=r.Enum(lx),ho="/v0/invitations",IB=10,SB=r.Object({email:p({type:"email",description:"Lowercase email address to invite into the organization."}),teamId:p({description:"Team ID to add the invited user to after acceptance."}),teamRole:r.Enum(wr,{description:"Role the invited user receives in the target team once accepted: `admin`, `editor`, or `viewer`."}),userRole:r.Enum(yi,{description:"Organization role the invited user receives after acceptance: `admin`, `public_editor`, `public_viewer`, or `teams_only`."})}),Xve=d({tags:["invitations"],url:`${ho}/create`,method:"POST",body:r.Array(SB,{maxItems:IB}),response:r.Object({success:r.Boolean(),message:r.String()})}),Jve=d({tags:["invitations"],url:`${ho}/resend/:id`,params:r.Object({id:p()}),method:"POST",response:r.Object({success:r.Boolean(),message:r.String()})}),mx=r.Partial(r.Object({searchQuery:r.Object({value:p({allowEmpty:!1,description:"Substring to match against the invitation email, team name, or status."})},{description:"Substring matched against the invitation email, team name, or status"})},{description:"Optional filters applied to narrow the returned invitations"})),bB=Kt(mx),eNe=d({tags:["invitations"],url:`${ho}/bulk-resend`,method:"POST",body:r.Object({selection:bB}),response:r.Object({success:r.Boolean(),message:r.String()})}),tNe=d({tags:["invitations"],url:ho,method:"POST",body:r.Object({secret:p()}),response:r.Object({status:_B,email:r.String(),teamName:r.Optional(r.String()),avatar:r.Optional(fu)})}),rNe=d({tags:["invitations"],url:`${ho}/accept`,method:"POST",body:r.Object({name:p({type:"short"}),password:p({type:"user-password"}),secret:p()}),response:px}),nNe=d({tags:["invitations"],url:`${ho}/revoke/:id`,params:r.Object({id:p()}),method:"POST",response:r.Object({success:r.Boolean(),message:r.String()})}),OB=r.Object({id:r.String({description:"Unique identifier of the invitation. Generated by Tsuga."}),email:r.String({description:"Email address invited to join the organization."}),teamId:r.Optional(r.String({description:"Team ID assigned when the invitation is accepted."})),teamRole:r.Optional(r.Enum(wr,{description:"Team role assigned when the invitation is accepted: `admin`, `editor`, or `viewer`."})),createdBy:r.Optional(r.String({description:"User ID that created the invitation."})),status:r.Enum(lx,{description:"Invitation lifecycle status: `pending`, `accepted`, `expired`, or `revoked`. `expired` can be computed from `expiresAt` when invitations are listed."}),expiresAt:S({description:"Timestamp when the invitation expires if not accepted."}),createdAt:S({description:"Timestamp when Tsuga created the invitation."}),updatedAt:S({description:"Timestamp when Tsuga last updated the invitation."})}),Tu={EMAIL:"email",TEAM:"team",STATUS:"status",CREATED_AT:"createdAt"},AB=r.Partial(r.Object({...le,filters:mx,sort:r.Object({by:r.Enum([Tu.EMAIL,Tu.TEAM,Tu.STATUS,Tu.CREATED_AT],{description:"Field to sort the returned invitations by"}),direction:ne},{description:"Optional sorting applied to the returned invitations"})})),oNe=d({tags:["invitations"],url:`${ho}/query`,method:"POST",paginated:!0,response:r.Array(OB),body:AB});var xB=`/${"v1"}/me`,dx=r.Object({type:r.Literal("operation-api-key",{description:"Credential type for this response variant. Set by Tsuga from the bearer token used on the request. Returned as `operation-api-key` when the request authenticated with an operation API key."}),id:r.String({description:"Unique identifier of the operation API key. Generated by Tsuga when the key is created. Use this as the stable key identifier when correlating API calls with audit logs or key-management records."}),name:r.String({description:"Display name of the operation API key. Set by the user who created or last updated the key. Returned for every operation-key-authenticated request so clients can show which saved key is active."}),owner:r.String({description:"Identifier of the team that owns the operation API key. Set when the key is created or updated. Combined with `scope`, it determines which team-owned resources the key can reach."}),scope:hu,permissions:yu,keyLastCharacters:r.String({description:"Last characters of the operation API key secret. Set by Tsuga from the generated secret and returned because the full secret is only shown once at creation. Use this to distinguish saved keys without exposing the secret."}),expiresAt:r.Optional(S({description:"Timestamp after which the operation API key stops authenticating. Set when the key is created or updated. Returned only for keys that have an expiration date."}))},{$id:"OperationApiKeyIdentity",description:"Identity and effective access for the operation API key used on the request. Returned when the bearer token is an operation API key. See [API keys](/documentation/account-and-settings/api-keys)."}),RB={type:"operation-api-key",id:"key-123-abc",name:"ci-deploy",owner:"team-123-abc",scope:"owning-team-and-public",permissions:{dashboard:"write",logs:"read",monitor:"read"},keyLastCharacters:"a9f2",expiresAt:"2026-12-01T00:00:00.000Z"};Object.assign(dx,{examples:[RB]});var fx=r.Object({type:r.Literal("user",{description:"Credential type for this response variant. Set by Tsuga from the bearer token used on the request. Returned as `user` when the request authenticated with a user OAuth access token."}),...r.Pick(An,["id","email","name","role"]).properties},{$id:"UserIdentity",description:"Identity for the user OAuth access token used on the request. Returned when the bearer token is a user access token. Access follows the user organization role rather than an operation-key permission map. See [Members](/documentation/account-and-settings/members)."}),CB={type:"user",id:"user-123-abc",email:"john@tsuga.com",name:"John Doe",role:"public_viewer"};Object.assign(fx,{examples:[CB]});var PB=R("type",[dx,fx],{description:"Identity and access for the credential used on the request. Returned for any valid public API credential and discriminated by `type` because the API accepts both operation API keys and user OAuth access tokens."}),gx=d({description:"Retrieves the identity and access of the credential the request authenticated with. Use this to check which scope and permissions an operation API key carries before calling other endpoints, or to confirm which user an OAuth access token belongs to. Any valid public API credential can call this endpoint without additional resource permissions.",operationId:"getMe",tags:["public","authentication"],url:xB,method:"GET",response:PB});var us=require("node:crypto");function UB(e){return(0,us.createHash)("sha256").update(e).digest("base64url")}function hx(){let e=(0,us.randomBytes)(32).toString("base64url");return{verifier:e,challenge:UB(e)}}var Ix=require("node:child_process"),Sx=require("node:http"),vd=require("node:os");var wB={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Ud(e){return e.replace(/[&<>"']/g,t=>wB[t]??t)}var vB=[":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(""),NB=['<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 wd(e,t){let n=Ud(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>${vB}</style></head><body><main>`,`<span class="tile">${NB}</span>`,`<div class="copy"><h1>${n}</h1><p>${Ud(t)}</p></div>`,"</main></body></html>"].join("")}function z(e){process.stdout.write(`${e}
40
- `)}function Q(e){z(JSON.stringify(e,null,2))}function Tx(e){process.stderr.write(`${e}
41
- `)}var yx=["json","tsv","csv"];function ls(e){let t=yx.find(n=>n===e);if(t!==void 0)return t;throw new Error(`--output must be one of: ${yx.join(", ")} (got: ${e})`)}function ms(e){let t=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);if(t.length===0)throw new Error("--fields must contain at least one field name");return t}function Ex(e,t){let n=e;for(let o of t.split(".")){if(n===null||typeof n!="object"||!Object.hasOwn(n,o))return;n=n[o]}return n}function ds(e,t){let n=Object.create(null);for(let o of t){let i=Ex(e,o);if(i===void 0)continue;let a=o.split("."),c=a.pop();if(c===void 0)continue;let l=n;for(let m of a)(typeof l[m]!="object"||l[m]===null)&&(l[m]=Object.create(null)),l=l[m];l[c]=i}return n}function _x(e){return e==null?null:typeof e=="string"?e:JSON.stringify(e)}var LB={"\\":"\\\\"," ":"\\t","\r":"\\r","\n":"\\n"};function kB(e){let t=_x(e);return t===null?"":t.replace(/[\\\t\r\n]/g,n=>LB[n]??n)}function MB(e){let t=_x(e);return t===null?"":/[,"\n\r]/.test(t)?`"${t.replaceAll('"','""')}"`:t}function fs(e,t,n){if(t.length===0)return"";let o=e==="csv"?",":" ",i=e==="csv"?MB:kB,a=n.map(l=>i(l)).join(o),c=t.map(l=>n.map(m=>i(Ex(l,m))).join(o));return[a,...c].join(`
42
- `)}var bx="/oauth/callback",GB=5*Sa,$B=wd("Login complete","You can close this tab and return to the terminal."),Eu=wd("Login failed","Return to the terminal for details.");function FB(e){return(0,vd.platform)()==="darwin"?["open",[e]]:(0,vd.platform)()==="win32"?["rundll32",["url.dll,FileProtocolHandler",e]]:["xdg-open",[e]]}function jB(e){let[t,n]=FB(e),o=(0,Ix.spawnSync)(t,n,{stdio:"ignore"});return o.error===void 0&&o.status===0}async function qB(e,t,n){return new Promise((o,i)=>{let a=setTimeout(()=>{i(new Error("Timed out waiting for the browser to complete login (5 minutes)."))},GB),c=(l,m,f,h)=>{l.writeHead(m,{"Content-Type":"text/html"}),l.end(f),clearTimeout(a),h()};e.on("request",(l,m)=>{let f=new URL(l.url??"/",n);if(f.pathname!==bx){m.writeHead(404,{"Content-Type":"text/html"}),m.end(Eu);return}let h=f.searchParams.get("error");if(h){let I=f.searchParams.get("error_description")??"";c(m,400,Eu,()=>i(new Error(`Authorization failed: ${h}${I?` (${I})`:""}`)));return}if(f.searchParams.get("state")!==t){c(m,400,Eu,()=>i(new Error("State mismatch on OAuth callback; aborting for safety.")));return}let E=f.searchParams.get("code");if(!E){c(m,400,Eu,()=>i(new Error("OAuth callback did not include an authorization code.")));return}c(m,200,$B,()=>o(E))})})}async function Ox(e){let t=(0,Sx.createServer)();t.on("connection",a=>a.unref()),await new Promise((a,c)=>{t.once("error",c),t.listen(0,"127.0.0.1",()=>{t.off("error",c),a()})});let{port:n}=t.address(),o=`http://127.0.0.1:${n}`,i=`${o}${bx}`;try{let a=e.buildAuthorizeUrl(i);return jB(a)?z("Opening your browser to complete login..."):(z("Visit this URL in your browser to complete login:"),z(` ${a}`)),{code:await qB(t,e.state,o),redirectUri:i}}finally{t.close()}}var er=require("node:fs"),Fd=require("node:os"),To=require("node:path");var xx=pn(require("os"),1),gs=pn(require("path"),1),xn=xx.default.homedir(),{env:yo}=process,Ax=yo.XDG_DATA_HOME||(xn?gs.default.join(xn,".local","share"):void 0),_u=yo.XDG_CONFIG_HOME||(xn?gs.default.join(xn,".config"):void 0),ONe=yo.XDG_STATE_HOME||(xn?gs.default.join(xn,".local","state"):void 0),Rx=yo.XDG_CACHE_HOME||(xn?gs.default.join(xn,".cache"):void 0),ANe=yo.XDG_RUNTIME_DIR||void 0,BB=(yo.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");Ax&&BB.unshift(Ax);var HB=(yo.XDG_CONFIG_DIRS||"/etc/xdg").split(":");_u&&HB.unshift(_u);var Cx=new Set(["api.tsuga.com","api.tsuga-staging.com"]),KB=new Set(["localhost","127.0.0.1","[::1]"]);function Nd(e){let t=e.replace(/\/+$/,"");if(!URL.canParse(t))throw new Error(`TSUGA_API_URL is not a URL: ${t}`);if(/[\s"'\\]/.test(t))throw new Error(`TSUGA_API_URL holds whitespace, quotes or a backslash: ${JSON.stringify(t)}`);let n=new URL(t);if(!KB.has(n.hostname)&&(n.protocol!=="https:"||!Cx.has(n.hostname)))throw new Error(`Refusing to send credentials to ${t}. Set TSUGA_API_URL to ${[...Cx].map(o=>`https://${o}`).join(", ")}, or a localhost URL.`);return t}var Px=require("node:child_process"),Ux=require("node:fs");var Rn="tsuga-cli";var wx="/usr/bin/secret-tool",zB="Tsuga CLI session",vx="the login keyring";function YB(){try{return(0,Ux.lstatSync)(wx).isFile()}catch{return!1}}var VB=["DBUS_SESSION_BUS_ADDRESS","XDG_RUNTIME_DIR"];function QB(){let e={};for(let t of VB){let n=process.env[t];n!==void 0&&(e[t]=n)}return e}function Ld(e,t){if(!(process.platform!=="linux"||!YB()))try{return{status:0,stdout:(0,Px.execFileSync)(wx,e,{env:QB(),input:t,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),stderr:""}}catch(n){let{status:o,stderr:i}=n;return{status:o??1,stdout:"",stderr:i??""}}}function kd(e){let t=Ld(["lookup","service",Rn,"account",e]);if(t&&t.status===0)return pu(t.stdout)}function Nx(e,t){let n=Ld(["store","--label",zB,"service",Rn,"account",e],`${JSON.stringify(t)}
43
- `);return!(!n||n.status!==0)}function Lx(e){return Ld(["clear","service",Rn,"account",e]),kd(e)===void 0}var kx=require("node:child_process"),Mx=require("node:fs");var Dx="/usr/bin/security",Gx="the macOS Keychain";function Md(){if(process.platform!=="darwin")return!1;try{return(0,Mx.lstatSync)(Dx).isFile()}catch{return!1}}function Dd(e,t){try{return{status:0,stdout:(0,kx.execFileSync)(Dx,e,{env:{},input:t,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),stderr:""}}catch(n){let{status:o,stderr:i}=n;return{status:o??1,stdout:"",stderr:i??""}}}function Gd(e){if(!Md())return;let t=Dd(["find-generic-password","-s",Rn,"-a",e,"-w"]);if(t.status===0)return pu(t.stdout)}function $x(e,t){if(!Md())return!1;let n=Buffer.from(JSON.stringify(t),"utf-8").toString("hex");return Dd(["-i"],`add-generic-password -U -s ${Rn} -a ${e} -X ${n}
44
- `).status===0}function Fx(e){return Md()?(Dd(["delete-generic-password","-s",Rn,"-a",e]),Gd(e)===void 0):!0}var WB={friendlyLocationName:Gx,read:Gd,save:$x,remove:Fx},ZB={friendlyLocationName:vx,read:kd,save:Nx,remove:Lx},Iu=class e extends Error{constructor(t){super(t),this.name="SecretStoreError"}static stillHoldsSession(t){return new e(`The session is still in ${t.friendlyLocationName}. Unlock it and run \`tsuga auth logout\` again.`)}};function hs(){return process.platform==="darwin"?WB:process.platform==="linux"?ZB:void 0}function jx(e){return hs()?.read(e)}function qx(e,t){return hs()?.save(e,t)??!1}function Bx(e){let t=hs();return t&&!t.remove(e)?t:void 0}var Hx=(0,To.join)(_u??(0,To.join)((0,Fd.homedir)(),".config"),"tsuga"),_i=(0,To.join)(Hx,"config.json"),Kx=(0,To.join)(Rx??(0,To.join)((0,Fd.homedir)(),".cache"),"tsuga"),$d=(0,To.join)(Kx,"update-check.json"),ys=Nd("https://api.tsuga.com");function zx(e){return jA(e.credential)}function bu(){if(!(0,er.existsSync)(_i))return{};try{let e=JSON.parse((0,er.readFileSync)(_i,"utf-8")),{operationApiKey:t,userAuth:n,...o}=e;return!t&&!n?e:{...o,credentials:{...e.credentials,[ys]:{...t?{operationApiKey:t}:{},...n?{userAuth:n}:{},...e.credentials?.[ys]}}}}catch{throw new Error(`Config file corrupted: ${_i}
45
- Re-authenticate with \`tsuga auth login\` or \`tsuga auth operation-key <OPERATION_API_KEY>\`.`)}}function Ts(){try{return bu()}catch{return{}}}function Ii(e){(0,er.mkdirSync)(Hx,{recursive:!0,mode:448}),(0,er.writeFileSync)(_i,`${JSON.stringify(e,null,2)}
46
- `,{mode:384})}function jd(e,t=Cn()){let n=e.credentials?.[t]??{};if(n.operationApiKey)return n;let o=jx(t);return o?{...n,userAuth:o}:n}function Su(e,t,n=Cn()){return{...e,credentials:{...e.credentials,[n]:t}}}function Cn(){return Nd(process.env.TSUGA_API_URL?.trim()||ys)}function Si(e){let t=bu(),n=Cn(),o=process.env.TSUGA_OPERATION_API_KEY,i=o?{}:jd(t,n),a=FA({overrideKey:o,operationApiKey:i.operationApiKey,userAuth:i.userAuth}),c=t.defaults??{},l=e.clusterId?.trim()||process.env.TSUGA_CLUSTER_ID?.trim()||c.cluster?.trim()||void 0;return{apiUrl:n,credential:a,clusterId:l,defaults:c}}function Es(){return jd(bu()).userAuth}function Yx(e,t){let n=Ts(),o=Cn(),{operationApiKey:i}=n.credentials?.[o]??{},a=t&&i?{operationApiKey:i}:{},c=hs();return c&&qx(o,e)?(Ii(Su(n,a,o)),c.friendlyLocationName):(Ii(Su(n,{...a,userAuth:e},o)),_i)}function Vx(e){return Yx(e,!1)}function Ou(e){Yx(e,!0)}function Qx(e){let t=Ts();Ii(Su(t,{operationApiKey:e}))}function Wx(){let e=Cn(),t=Bx(e),n=Ts(),o=jd(n,e);if(Ii(Su(n,o.operationApiKey?{operationApiKey:o.operationApiKey}:{},e)),t)throw Iu.stillHoldsSession(t)}function Au(){return _i}var Zx={from:"-30m",to:"now",query:"*","max-results":"100"};function tr(e){return(bu().defaults??{})[e]??Zx[e]}function Xx(e,t){let n=Ts();Ii({...n,defaults:{...n.defaults,[e]:t}})}function Jx(){let{defaults:e,...t}=Ts();Ii(t)}function eR(e,t){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: ${ss(o.userAuth.accessToken)} (expires ${o.userAuth.accessExpiresAt})`);break;default:Ze(a)}}else n.push("Not authenticated. Run `tsuga auth login` or `tsuga auth operation-key <OPERATION_API_KEY>`.");n.push(`Config: ${t}`),n.push(""),n.push("Defaults (custom overrides marked with *):");let i={...Zx,...e.defaults};for(let[a,c]of Object.entries(i)){let l=a in e.defaults?" *":"";n.push(` ${a}: ${c}${l}`)}return`${n.join(`
38
+ ${Sd.map((o,i)=>Vq(o,t===0?0:i/t)).join(`
39
+ `)}`}function HA(){return Qq(process.stdout.isTTY&&!process.env.NO_COLOR)}var aR=require("node:crypto");var Od=["red","orange","amber","yellow","green","emerald","teal","cyan","sky","blue","indigo","purple","pink"],Ad=["light","dark"];var Wq={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)"}},KA=["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 Mwe=Wq.light.red.background;var Zq=["allowed-domains","cluster-integration-config","custom-usage-tag","database","databricks-connection","explorer-saved-view","github-connection","host","inventory","llm-provider","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"],Xq=["adaptive-notification-rule","audit-log","cloud-account","dashboard-folder","dashboard-report","dashboard","ingestion-api-key","investigation","log-route","metric-route","monitor","notebook","notification-integration","notification-rule","notification-silence","operation-api-key","quality-report","rum-public-token","sandbox-environment","slo","tag-policy","team-members","team","user-data","user-invitation","user-permissions"],Jq=["log","metric","trace","rum"],xd=[...Xq,...Jq],qwe=[...Zq,...xd];var Ei=["admin","public_editor","public_viewer","teams_only"],er=["admin","editor","viewer"];var go="/v0/team-membership",Rd="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.",Cd=r.Object({id:r.String({description:"Tsuga-generated team membership ID assigned when the membership is created."}),userId:r.String({description:"User ID that belongs to the team."}),teamId:r.String({description:"Team ID that contains the user."}),roleKey:r.Enum(er,{description:Rd})}),zA=r.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:r.Enum(er,{description:Rd})}),eB=r.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."})}),tB=r.Optional(r.Object({userId:r.Optional(p({allowEmpty:!1,description:"Restrict results to memberships for this user ID."})),teamId:r.Optional(p({allowEmpty:!1,description:"Restrict results to memberships for this team ID."}))})),Bwe=d({tags:["access-control"],url:go,method:"GET",query:tB,response:r.Array(Cd)}),Hwe=d({tags:["access-control"],url:go,method:"POST",body:zA,response:Cd}),Kwe=d({tags:["access-control"],url:go,method:"PUT",body:zA,response:Cd}),zwe=d({tags:["access-control"],url:go,method:"DELETE",body:eB,response:v}),mu=500,YA=r.Object({teamId:p({allowEmpty:!1,description:"Team ID receiving all requested memberships."}),members:r.Array(r.Object({userId:r.Optional(p({allowEmpty:!1,description:"Existing user ID to add to the team."})),userEmail:r.Optional(p({allowEmpty:!1,type:"email",description:"Existing user email to resolve and add to the team."})),roleKey:r.Enum(er,{description:Rd})},{oneOf:[{required:["userId"]},{required:["userEmail"]}]}),{minItems:1,maxItems:mu,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."}),rB={teamId:"team-123-abc",members:[{userId:"user-123-abc",roleKey:"viewer"},{userEmail:"sam@example.com",roleKey:"editor"}]};Object.assign(YA,{examples:[rB]});var VA=r.Object({results:r.Array(r.Object({userId:r.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:r.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."}),nB={results:[{userId:"user-123-abc",status:"added"},{userId:"sam@example.com",status:"user_not_found"}]};Object.assign(VA,{examples:[nB]});var Ywe=d({tags:["access-control"],url:`${go}/bulk-add`,method:"POST",body:YA,response:VA}),Vwe=d({tags:["access-control"],url:`${go}/bulk-update-user-roles`,method:"PUT",body:r.Object({userIds:r.Array(p({allowEmpty:!1}),{minItems:1,maxItems:mu}),teamId:p({allowEmpty:!1}),role:r.Enum(er)}),response:r.Object({})}),QA=r.Object({teamId:p({allowEmpty:!1,description:"Team ID to remove the requested users from."}),userIds:r.Optional(r.Array(p({allowEmpty:!1}),{minItems:1,maxItems:mu,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:r.Optional(r.Array(p({allowEmpty:!1,type:"email"}),{minItems:1,maxItems:mu,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."}),oB={teamId:"team-123-abc",userIds:["user-123-abc"]};Object.assign(QA,{examples:[oB]});var WA=r.Object({results:r.Array(r.Object({userId:r.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:r.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."}),iB={results:[{userId:"user-123-abc",status:"removed"},{userId:"missing@example.com",status:"user_not_found"}]};Object.assign(WA,{examples:[iB]});var Qwe=d({tags:["access-control"],url:`${go}/bulk-remove`,method:"DELETE",body:QA,response:WA});var aB="^\\S(.*\\S)?$",sB=50,cB=128,pB=256,uB=r.Object({key:r.String({description:"Tag key attached to the resource. Consumers can use key/value tags for filtering, ownership context, and policy checks."}),value:r.String({description:"Tag value attached to the resource for this key. Tsuga returns the value exactly as stored."})},{title:"Tag"}),lB=r.Object({key:r.String({maxLength:cB,description:"Tag key to attach to the resource."}),value:r.String({maxLength:pB,pattern:aB,description:"Tag value to attach to the resource. Leading or trailing whitespace is rejected."})},{title:"Tag"}),zt=r.Array(uB,{title:"Tags",description:"Key/value tags applied to the resource. Use them to organize resources and to satisfy tag policies."}),Yt=r.Array(lB,{title:"Tags",maxItems:sB,description:"Key/value tags to apply to the resource. Tag policies may require specific keys or values."}),ve=r.Optional(zt),De=r.Optional(Yt);var Sn="/v0/teams",gu=["public","private"],du={NAME:"name",CREATED_AT:"createdAt",MEMBER_COUNT:"memberCount",VISIBILITY:"visibility"},mB=r.Enum([du.NAME,du.CREATED_AT,du.MEMBER_COUNT,du.VISIBILITY],{description:"Team field used for sorting list responses. Use `name`, `createdAt`, `memberCount`, or `visibility`."}),hu=r.Object({color:r.Enum(Od,{description:"Color token used by Tsuga when rendering the team avatar."}),mode:r.Enum(Ad,{description:"Avatar rendering mode selected for the team."}),iconName:r.Enum(KA,{description:"Icon name rendered inside the team avatar when icon mode is used."})}),_i=r.Object({color:r.Enum(Od),mode:r.Enum(Ad)}),ZA=100,XA=250,bn=r.Object({id:r.String({description:"Unique identifier of the team. Generated by Tsuga and stable for the team lifetime."}),name:r.String({description:"Human-readable team name displayed throughout Tsuga and used in team search."}),description:r.Optional(r.String({description:"Optional free-text description of the team."})),visibility:r.Enum(gu,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:ve,createdAt:S({description:"Timestamp when Tsuga created the team."}),updatedAt:S({description:"Timestamp when Tsuga last updated the team metadata."}),memberCount:r.Optional(r.Number({description:"Number of members currently in the team"})),avatar:r.Optional(hu)}),yu=r.Object({name:r.String({minLength:1,maxLength:ZA,format:gi,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 ${ZA} characters.`}),description:Se(r.String({maxLength:XA}),{description:`Optional team description. Maximum length is ${XA} characters.`}),visibility:r.Enum(gu,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:De,avatar:Se(hu)}),dB=r.Object({id:r.String(),name:r.String(),email:r.String(),role:r.Enum(er),joinedTeamAt:S(),orgRole:r.Enum(Ei),avatar:r.Optional(_i)}),JA=r.Object({searchQuery:r.Optional(p({description:"Substring matched against team names and descriptions."})),visibility:r.Optional(r.Enum(gu,{description:"Restrict results to teams with this visibility."})),myTeamsOnly:r.Optional(r.Boolean({description:"If true, return only teams that include the authenticated user."}))}),sve=d({tags:["teams"],url:Sn,method:"GET",paginated:!0,response:r.Array(bn),query:r.Object({...ue,includeMemberCount:r.Optional(r.Boolean()),...JA.properties,sortBy:r.Optional(mB),sortDirection:r.Optional(te)})}),cve=d({tags:["teams"],url:`${Sn}/:id`,method:"GET",params:r.Object({id:p()}),response:bn}),fu={NAME:"name",ROLE:"role",ORG_ROLE:"orgRole",JOINED_TEAM_AT:"joinedTeamAt"},fB=r.Enum([fu.NAME,fu.ROLE,fu.ORG_ROLE,fu.JOINED_TEAM_AT]),pve=d({tags:["teams"],url:`${Sn}/:id/members`,method:"GET",paginated:!0,params:r.Object({id:p()}),query:r.Object({...ue,searchQuery:r.Optional(p({description:"Substring matched against member names and emails."})),teamRole:r.Optional(r.Array(r.Enum(er),{maxItems:er.length,uniqueItems:!0,description:"Restrict results to members with one of these team roles."})),sortBy:r.Optional(fB),sortDirection:r.Optional(te)}),response:r.Array(dB)}),uve=d({tags:["teams"],url:`${Sn}/:id/assets`,method:"GET",params:r.Object({id:p()}),response:r.Object({apiKeyCount:r.Number(),logRouteCount:r.Number(),monitorCount:r.Number(),notificationRuleCount:r.Number(),dashboardCount:r.Number()})}),lve=d({tags:["teams"],url:Sn,method:"POST",body:yu,response:bn}),mve=d({tags:["teams"],url:`${Sn}/:id`,method:"PUT",params:r.Object({id:p()}),body:yu,response:bn}),gB=R("type",[r.Object({type:r.Literal("ids"),teamIds:r.Array(p({allowEmpty:!1}),{minItems:1,maxItems:100})}),r.Object({type:r.Literal("all"),filters:r.Optional(JA)})]),dve=d({tags:["teams"],url:`${Sn}/bulk-update`,method:"POST",body:r.Object({selection:gB,config:r.Object({visibility:r.Enum(gu)})}),response:r.Object({})}),fve=d({tags:["teams"],url:`${Sn}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v});var hB=r.Enum(["agent","cli","mcp-codemode","mcp-server","tadmin","terraform-provider","web-frontend"],{description:"Tsuga client surface that performed the operation. Use this to distinguish UI, CLI, MCP, and Terraform-originated changes."}),se=R("type",[r.Object({type:r.Literal("user",{description:"The resource was created or updated by a user."}),id:r.String({description:"Unique identifier of the user actor."}),name:r.String({description:"Display name of the user actor at the time of response."}),avatar:r.Optional(_i)}),r.Object({type:r.Literal("operation-api-key",{description:"The resource was created or updated by an operation API key."}),id:r.String({description:"Unique identifier of the operation API key actor."}),name:r.String({description:"Display name of the operation API key actor."}),source:r.Optional(hB)})],{description:"User or operation API key responsible for creating or updating a resource. Returned by Tsuga for audit context."});var Pd=["all","owning-team-and-public","owning-team-only"],On=r.Enum(Pd,{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="/v0/operation-api-keys";var yB=100,Tu=r.Enum(Pd,{description:"Team-access boundary for the operation API key. Set when the key is created or updated. `all` can reach all teams, `owning-team-and-public` can reach the owning team and public teams, and `owning-team-only` can reach only the owning team."}),ho=e=>r.Literal("read",{description:e}),rt=e=>r.Enum(["read","write"],{description:e}),Eu=r.Partial(r.Object({investigations:rt("Investigations, the records collecting the timeline and findings of an incident analysis."),dashboard:rt("Dashboards and the graphs they contain."),"dashboard-folder":rt("Folders organizing dashboards."),documentation:ho("Tsuga documentation and API reference pages, which are public content rather than account data."),"ingestion-api-key":rt("Ingestion API keys, used to send telemetry data to Tsuga."),"rum-public-token":rt("RUM public tokens, embedded in web and mobile applications to send real user monitoring telemetry."),inventory:ho("Cloud resources discovered by inventory scans."),"cloud-account":rt("Cloud accounts Tsuga scans to discover resources."),logs:ho("Ingested log events, through search and aggregation endpoints."),"log-route":rt("Log routes, which select newly ingested logs and apply processors to them."),metrics:ho("Ingested metrics, through query and aggregation endpoints."),"metric-route":rt("Metric routes, which select newly ingested metrics by name and apply processors to them."),monitor:rt("Monitors, the alert definitions evaluated against telemetry."),"allowed-domains":rt("Email domains whose users are allowed to join the organization."),"quality-report":ho("Telemetry quality reports."),service:ho("Services of the catalog, inferred from telemetry."),"service-target":rt("Notification targets attached to a service."),slo:rt("Service level objectives and the alerts attached to them."),"notification-rule":rt("Notification rules, which route alert transitions to notification targets."),"notification-integration":rt("Notification integrations, containing the credentials Tsuga uses when sending notifications."),"notification-silence":rt("Notification silences, which suppress matching notification delivery."),"custom-usage-tag":rt("Custom usage tags, the telemetry tag keys tracked as usage dimensions."),"retention-policy":rt("Retention policies applied to logs, metrics, and traces."),"tag-policy":rt("Tag policies, which enforce tag requirements on Tsuga-managed assets and telemetry data."),team:rt("Teams and their settings."),"team-membership":rt("Team memberships, each pairing a user with a team role."),traces:ho("Ingested spans, through search and aggregation endpoints."),user:rt("User accounts of the organization."),"user-invitation":rt("Invitations for people who do not belong to the organization yet.")}),{description:"Resource types the key can act on, each mapped to `read` or `write`. `write` also grants read access. A resource type absent from the map is not accessible to the key at all."}),Ud=r.Object({id:r.String(),name:r.String(),owner:r.String(),tags:ve,scope:Tu,permissions:Eu,keyLastCharacters:r.String(),updatedAt:S(),createdAt:S(),creator:r.Optional(se),updater:r.Optional(se),expiresAt:r.Optional(S()),lastUsedAt:r.Optional(S())}),ex=r.Object({name:r.String({minLength:1,maxLength:yB}),owner:p({allowEmpty:!1}),tags:De,scope:Tu,permissions:Eu,expiresAt:Se(p({allowEmpty:!1,type:"date-time"}))}),Pve=d({tags:["operation-api-keys"],url:ps,method:"POST",body:ex,response:r.Intersect([Ud,r.Object({key:r.String()})])}),Uve=d({tags:["operation-api-keys"],url:ps,method:"GET",response:r.Array(Ud)}),wve=d({tags:["operation-api-keys"],url:`${ps}/:id`,method:"PUT",params:r.Object({id:p()}),body:ex,response:Ud}),vve=d({tags:["operation-api-keys"],url:`${ps}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),Nve=d({tags:["operation-api-keys"],url:`${ps}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(p({allowEmpty:!1}))}),response:r.Object({})});var TB=["logs","metrics","traces","profiling","analytics","dashboards","notebooks","ongoing-alerts","slo","monitor","notification-rules","notification-silences","notification-integrations","investigations","routes","sensitive-data-scanner","ai-sandboxes","inventory","services","rum","browser-views","mobile","sessions","host-catalog","kubernetes","ecs","serverless"],tx=r.Enum(TB,{description:"Stable nav item key within a main sidebar category."}),rx=r.Array(tx,{description:"Nav item keys shown in the primary sidebar for this category, in display order."}),nx=r.Optional(r.Array(tx,{description:"Nav item keys for this category that are folded away (e.g. View more). Omitted or empty means none."})),ox="Stable category id. Unknown or renamed ids are ignored by the client catalog.",ix="Sidebar categories in display order. Unknown or renamed ids are ignored by the client catalog.",ax=r.Object({categories:r.Array(r.Object({id:r.String({description:ox}),visible:rx,folded:nx}),{description:ix})}),sx=r.Object({categories:r.Array(r.Object({id:p({allowEmpty:!1,description:ox}),visible:rx,folded:nx}),{description:ix})});var cx=["YYYY-MM-DD","DD-MM-YYYY","MM-DD-YYYY"],px=["12h","24h"],EB=r.Union([r.Object({type:r.Literal("home")}),r.Object({type:r.Literal("explorer")}),r.Object({type:r.Literal("metrics")}),r.Object({type:r.Literal("traces")}),r.Object({type:r.Literal("analytics")}),r.Object({type:r.Literal("dashboards"),id:r.String()}),r.Object({type:r.Literal("ongoing-alerts")}),r.Object({type:r.Literal("services")}),r.Object({type:r.Literal("rum-views")}),r.Null()]),_B=r.Union([R("type",[r.Object({type:r.Literal("home")}),r.Object({type:r.Literal("explorer")}),r.Object({type:r.Literal("metrics")}),r.Object({type:r.Literal("traces")}),r.Object({type:r.Literal("analytics")}),r.Object({type:r.Literal("dashboards"),id:p()}),r.Object({type:r.Literal("ongoing-alerts")}),r.Object({type:r.Literal("services")}),r.Object({type:r.Literal("rum-views")})]),r.Null()]),An=r.Object({email:r.String({description:"Lowercase email address for the user. Use this for display and invitation matching, not as a stable identifier."}),id:r.String({description:"Unique identifier of the user. Generated by Tsuga and stable for the user lifetime."}),name:r.String({description:"Display name of the user."}),role:r.Enum(Ei,{description:"Organization role for the user: `admin`, `public_editor`, `public_viewer`, or `teams_only`."}),orgId:r.String({description:"Identifier of the Tsuga organization the user belongs to."}),orgName:r.Optional(r.String({description:"Display name of the Tsuga organization the user belongs to. Absent when the organization record cannot be resolved."})),avatar:r.Optional(_i),defaultView:r.Optional(EB),timezone:r.Optional(r.Union([r.String(),r.Null()],{description:"IANA timezone used to display dates and times (e.g. `Europe/Paris`). Absent or `null` means the timezone is auto-detected from the browser."})),dateFormat:r.Optional(r.Union([r.Enum(cx),r.Null()],{description:"Preferred format for displaying dates: `YYYY-MM-DD`, `DD-MM-YYYY`, or `MM-DD-YYYY`. Absent or `null` means the Tsuga default format."})),hourFormat:r.Optional(r.Union([r.Enum(px),r.Null()],{description:"Preferred format for displaying times: `12h` (AM/PM) or `24h`. Absent or `null` means the Tsuga default format."})),favoriteDashboards:r.Optional(r.Array(r.String(),{description:"Dashboard IDs the user marked as favorites."})),favoriteFolders:r.Optional(r.Array(r.String(),{description:"Dashboard folder IDs the user marked as favorites."})),filterDataByTeams:r.Optional(r.Boolean({description:"Whether the user wants data across the application filtered to the teams they belong to. Set by the user in their profile settings."})),sidebarNavLayout:r.Optional(ax),fromSso:r.Boolean({description:"Whether the user account was provisioned or authenticated through SSO."}),createdAt:S({description:"Timestamp when Tsuga created the user."}),updatedAt:S({description:"Timestamp when Tsuga last updated the user."}),teamIds:r.Optional(r.Array(r.String(),{description:"Team IDs the user currently belongs to."}))}),ux=r.Intersect([bn,r.Object({userRole:r.Enum(er)})]),lx=r.Object({token:r.String(),user:An}),zve=d({tags:["users"],url:"/v0/login",method:"POST",body:r.Object({email:p({type:"email"}),password:p({type:"long"})}),response:lx}),Yve=d({tags:["users"],url:"/v0/forgot-password",method:"POST",body:r.Object({email:p({type:"email"})}),response:r.Object({})}),Vve=d({tags:["users"],url:"/v0/reset-password",method:"POST",body:r.Object({resetToken:p(),password:p({type:"user-password"})}),response:r.Object({})}),IB=["active","expired"],Qve=d({tags:["users"],url:"/v0/reset-password-status/:resetToken",method:"GET",params:r.Object({resetToken:p()}),response:r.Object({status:r.Enum(IB)})}),Wve=d({tags:["users"],url:"/v0/change-password",method:"POST",body:r.Object({currentPassword:p({type:"long"}),newPassword:p({type:"user-password"})}),response:r.Object({})}),Ii="/v0/users",wd="/v0/current-user",Zve=d({tags:["users"],url:wd,method:"GET",response:An}),Xve=d({tags:["users"],url:`${wd}/teams`,method:"GET",response:r.Array(ux)}),Jve=d({tags:["users"],url:"/v0/logout",method:"POST",response:r.Object({})}),SB=d({tags:["users"],method:"PATCH",url:wd,body:r.Partial(r.Object({avatar:r.Union([_i,r.Null()]),defaultView:_B,timezone:r.Union([r.String({format:mo}),r.Null()]),dateFormat:r.Union([r.Enum(cx),r.Null()]),hourFormat:r.Union([r.Enum(px),r.Null()]),favoriteDashboards:r.Array(p({allowEmpty:!1})),favoriteFolders:r.Array(p({allowEmpty:!1})),filterDataByTeams:r.Boolean(),sidebarNavLayout:r.Union([sx,r.Null()]),name:p()}),{minProperties:1}),response:An}),eNe=Ti(SB),tNe=d({tags:["users"],url:Ii,method:"GET",response:r.Array(An),query:r.Optional(r.Object({includeTeamIds:r.Optional(r.Boolean())}))}),us={NAME:"name",ROLE:"role",LOGIN_METHOD:"fromSso",TEAMS:"teams",CREATED_AT:"createdAt"},mx=r.Partial(r.Object({searchQuery:r.Object({value:p({allowEmpty:!1,description:"Substring to match against the member name or email."})},{description:"Substring matched against the member name or email"})},{description:"Optional filters applied to narrow the returned members"})),bB=r.Partial(r.Object({...ue,includeTeamIds:r.Boolean({description:"When true, include the IDs of the teams each member belongs to."}),filters:mx,sort:r.Object({by:r.Enum([us.NAME,us.ROLE,us.LOGIN_METHOD,us.TEAMS,us.CREATED_AT],{description:"Field to sort the returned members by"}),direction:te},{description:"Optional sorting applied to the returned members"})})),rNe=d({tags:["users"],url:`${Ii}/query`,method:"POST",paginated:!0,response:r.Array(An),body:bB}),{teamIds:nNe,...OB}=An.properties,AB=r.Object({...OB,teams:r.Optional(r.Array(ux))}),oNe=d({tags:["users"],url:`${Ii}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1})}),query:r.Optional(r.Object({includeTeamRoles:r.Optional(r.Boolean())})),response:AB}),xB=Kt(mx),iNe=d({tags:["users"],method:"PUT",url:`${Ii}/bulk-update-role`,body:r.Object({selection:xB,role:r.Enum(Ei)}),response:r.Object({})}),aNe=d({tags:["users"],url:`${Ii}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),sNe=d({tags:["users"],url:`${Ii}/all-emails`,method:"GET",response:r.Array(r.String())}),dx=["pending","accepted","expired","revoked"],RB=r.Enum(dx),yo="/v0/invitations",CB=10,PB=r.Object({email:p({type:"email",description:"Lowercase email address to invite into the organization."}),teamId:p({description:"Team ID to add the invited user to after acceptance."}),teamRole:r.Enum(er,{description:"Role the invited user receives in the target team once accepted: `admin`, `editor`, or `viewer`."}),userRole:r.Enum(Ei,{description:"Organization role the invited user receives after acceptance: `admin`, `public_editor`, `public_viewer`, or `teams_only`."})}),cNe=d({tags:["invitations"],url:`${yo}/create`,method:"POST",body:r.Array(PB,{maxItems:CB}),response:r.Object({success:r.Boolean(),message:r.String()})}),pNe=d({tags:["invitations"],url:`${yo}/resend/:id`,params:r.Object({id:p()}),method:"POST",response:r.Object({success:r.Boolean(),message:r.String()})}),fx=r.Partial(r.Object({searchQuery:r.Object({value:p({allowEmpty:!1,description:"Substring to match against the invitation email, team name, or status."})},{description:"Substring matched against the invitation email, team name, or status"})},{description:"Optional filters applied to narrow the returned invitations"})),UB=Kt(fx),uNe=d({tags:["invitations"],url:`${yo}/bulk-resend`,method:"POST",body:r.Object({selection:UB}),response:r.Object({success:r.Boolean(),message:r.String()})}),lNe=d({tags:["invitations"],url:yo,method:"POST",body:r.Object({secret:p()}),response:r.Object({status:RB,email:r.String(),teamName:r.Optional(r.String()),avatar:r.Optional(hu)})}),mNe=d({tags:["invitations"],url:`${yo}/accept`,method:"POST",body:r.Object({name:p({type:"short"}),password:p({type:"user-password"}),secret:p()}),response:lx}),dNe=d({tags:["invitations"],url:`${yo}/revoke/:id`,params:r.Object({id:p()}),method:"POST",response:r.Object({success:r.Boolean(),message:r.String()})}),wB=r.Object({id:r.String({description:"Unique identifier of the invitation. Generated by Tsuga."}),email:r.String({description:"Email address invited to join the organization."}),teamId:r.Optional(r.String({description:"Team ID assigned when the invitation is accepted."})),teamRole:r.Optional(r.Enum(er,{description:"Team role assigned when the invitation is accepted: `admin`, `editor`, or `viewer`."})),createdBy:r.Optional(r.String({description:"User ID that created the invitation."})),status:r.Enum(dx,{description:"Invitation lifecycle status: `pending`, `accepted`, `expired`, or `revoked`. `expired` can be computed from `expiresAt` when invitations are listed."}),expiresAt:S({description:"Timestamp when the invitation expires if not accepted."}),createdAt:S({description:"Timestamp when Tsuga created the invitation."}),updatedAt:S({description:"Timestamp when Tsuga last updated the invitation."})}),_u={EMAIL:"email",TEAM:"team",STATUS:"status",CREATED_AT:"createdAt"},vB=r.Partial(r.Object({...ue,filters:fx,sort:r.Object({by:r.Enum([_u.EMAIL,_u.TEAM,_u.STATUS,_u.CREATED_AT],{description:"Field to sort the returned invitations by"}),direction:te},{description:"Optional sorting applied to the returned invitations"})})),fNe=d({tags:["invitations"],url:`${yo}/query`,method:"POST",paginated:!0,response:r.Array(wB),body:vB});var NB=`/${"v1"}/me`,gx=r.Object({type:r.Literal("operation-api-key",{description:"Credential type for this response variant. Set by Tsuga from the bearer token used on the request. Returned as `operation-api-key` when the request authenticated with an operation API key."}),id:r.String({description:"Unique identifier of the operation API key. Generated by Tsuga when the key is created. Use this as the stable key identifier when correlating API calls with audit logs or key-management records."}),name:r.String({description:"Display name of the operation API key. Set by the user who created or last updated the key. Returned for every operation-key-authenticated request so clients can show which saved key is active."}),owner:r.String({description:"Identifier of the team that owns the operation API key. Set when the key is created or updated. Combined with `scope`, it determines which team-owned resources the key can reach."}),scope:Tu,permissions:Eu,keyLastCharacters:r.String({description:"Last characters of the operation API key secret. Set by Tsuga from the generated secret and returned because the full secret is only shown once at creation. Use this to distinguish saved keys without exposing the secret."}),expiresAt:r.Optional(S({description:"Timestamp after which the operation API key stops authenticating. Set when the key is created or updated. Returned only for keys that have an expiration date."}))},{$id:"OperationApiKeyIdentity",description:"Identity and effective access for the operation API key used on the request. Returned when the bearer token is an operation API key. See [API keys](/documentation/account-and-settings/api-keys)."}),LB={type:"operation-api-key",id:"key-123-abc",name:"ci-deploy",owner:"team-123-abc",scope:"owning-team-and-public",permissions:{dashboard:"write",logs:"read",monitor:"read"},keyLastCharacters:"a9f2",expiresAt:"2026-12-01T00:00:00.000Z"};Object.assign(gx,{examples:[LB]});var hx=r.Object({type:r.Literal("user",{description:"Credential type for this response variant. Set by Tsuga from the bearer token used on the request. Returned as `user` when the request authenticated with a user OAuth access token."}),...r.Pick(An,["id","email","name","role","orgId","orgName"]).properties},{$id:"UserIdentity",description:"Identity for the user OAuth access token used on the request. Returned when the bearer token is a user access token. Access follows the user organization role rather than an operation-key permission map. See [Members](/documentation/account-and-settings/members)."}),kB={type:"user",id:"user-123-abc",email:"john@tsuga.com",name:"John Doe",role:"public_viewer",orgId:"org-123-abc",orgName:"Acme Inc."};Object.assign(hx,{examples:[kB]});var MB=R("type",[gx,hx],{description:"Identity and access for the credential used on the request. Returned for any valid public API credential and discriminated by `type` because the API accepts both operation API keys and user OAuth access tokens."}),yx=d({description:"Retrieves the identity and access of the credential the request authenticated with. Use this to check which scope and permissions an operation API key carries before calling other endpoints, or to confirm which user an OAuth access token belongs to. Any valid public API credential can call this endpoint without additional resource permissions.",operationId:"getMe",tags:["public","authentication"],url:NB,method:"GET",response:MB});var ls=require("node:crypto");function DB(e){return(0,ls.createHash)("sha256").update(e).digest("base64url")}function Tx(){let e=(0,ls.randomBytes)(32).toString("base64url");return{verifier:e,challenge:DB(e)}}var bx=require("node:child_process"),Ox=require("node:http"),Ld=require("node:os");var GB={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function vd(e){return e.replace(/[&<>"']/g,t=>GB[t]??t)}var $B=[":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(""),FB=['<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 Nd(e,t){let n=vd(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>${$B}</style></head><body><main>`,`<span class="tile">${FB}</span>`,`<div class="copy"><h1>${n}</h1><p>${vd(t)}</p></div>`,"</main></body></html>"].join("")}function z(e){process.stdout.write(`${e}
40
+ `)}function Q(e){z(JSON.stringify(e,null,2))}function _x(e){process.stderr.write(`${e}
41
+ `)}var Ex=["json","tsv","csv"];function ms(e){let t=Ex.find(n=>n===e);if(t!==void 0)return t;throw new Error(`--output must be one of: ${Ex.join(", ")} (got: ${e})`)}function ds(e){let t=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);if(t.length===0)throw new Error("--fields must contain at least one field name");return t}function Ix(e,t){let n=e;for(let o of t.split(".")){if(n===null||typeof n!="object"||!Object.hasOwn(n,o))return;n=n[o]}return n}function fs(e,t){let n=Object.create(null);for(let o of t){let i=Ix(e,o);if(i===void 0)continue;let a=o.split("."),c=a.pop();if(c===void 0)continue;let l=n;for(let m of a)(typeof l[m]!="object"||l[m]===null)&&(l[m]=Object.create(null)),l=l[m];l[c]=i}return n}function Sx(e){return e==null?null:typeof e=="string"?e:JSON.stringify(e)}var jB={"\\":"\\\\"," ":"\\t","\r":"\\r","\n":"\\n"};function qB(e){let t=Sx(e);return t===null?"":t.replace(/[\\\t\r\n]/g,n=>jB[n]??n)}function BB(e){let t=Sx(e);return t===null?"":/[,"\n\r]/.test(t)?`"${t.replaceAll('"','""')}"`:t}function gs(e,t,n){if(t.length===0)return"";let o=e==="csv"?",":" ",i=e==="csv"?BB:qB,a=n.map(l=>i(l)).join(o),c=t.map(l=>n.map(m=>i(Ix(l,m))).join(o));return[a,...c].join(`
42
+ `)}var Ax="/oauth/callback",KB=5*Oa,zB=Nd("Login complete","You can close this tab and return to the terminal."),Iu=Nd("Login failed","Return to the terminal for details.");function YB(e){return(0,Ld.platform)()==="darwin"?["open",[e]]:(0,Ld.platform)()==="win32"?["rundll32",["url.dll,FileProtocolHandler",e]]:["xdg-open",[e]]}function VB(e){let[t,n]=YB(e),o=(0,bx.spawnSync)(t,n,{stdio:"ignore"});return o.error===void 0&&o.status===0}async function QB(e,t,n){return new Promise((o,i)=>{let a=setTimeout(()=>{i(new Error("Timed out waiting for the browser to complete login (5 minutes)."))},KB),c=(l,m,f,h)=>{l.writeHead(m,{"Content-Type":"text/html"}),l.end(f),clearTimeout(a),h()};e.on("request",(l,m)=>{let f=new URL(l.url??"/",n);if(f.pathname!==Ax){m.writeHead(404,{"Content-Type":"text/html"}),m.end(Iu);return}let h=f.searchParams.get("error");if(h){let I=f.searchParams.get("error_description")??"";c(m,400,Iu,()=>i(new Error(`Authorization failed: ${h}${I?` (${I})`:""}`)));return}if(f.searchParams.get("state")!==t){c(m,400,Iu,()=>i(new Error("State mismatch on OAuth callback; aborting for safety.")));return}let E=f.searchParams.get("code");if(!E){c(m,400,Iu,()=>i(new Error("OAuth callback did not include an authorization code.")));return}c(m,200,zB,()=>o(E))})})}async function xx(e){let t=(0,Ox.createServer)();t.on("connection",a=>a.unref()),await new Promise((a,c)=>{t.once("error",c),t.listen(0,"127.0.0.1",()=>{t.off("error",c),a()})});let{port:n}=t.address(),o=`http://127.0.0.1:${n}`,i=`${o}${Ax}`;try{let a=e.buildAuthorizeUrl(i);return VB(a)?z("Opening your browser to complete login..."):(z("Visit this URL in your browser to complete login:"),z(` ${a}`)),{code:await QB(t,e.state,o),redirectUri:i}}finally{t.close()}}var tr=require("node:fs"),qd=require("node:os"),Eo=require("node:path");var Cx=pn(require("os"),1),hs=pn(require("path"),1),xn=Cx.default.homedir(),{env:To}=process,Rx=To.XDG_DATA_HOME||(xn?hs.default.join(xn,".local","share"):void 0),Su=To.XDG_CONFIG_HOME||(xn?hs.default.join(xn,".config"):void 0),LNe=To.XDG_STATE_HOME||(xn?hs.default.join(xn,".local","state"):void 0),Px=To.XDG_CACHE_HOME||(xn?hs.default.join(xn,".cache"):void 0),kNe=To.XDG_RUNTIME_DIR||void 0,WB=(To.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");Rx&&WB.unshift(Rx);var ZB=(To.XDG_CONFIG_DIRS||"/etc/xdg").split(":");Su&&ZB.unshift(Su);var Ux=new Set(["api.tsuga.com","api.tsuga-staging.com"]),XB=new Set(["localhost","127.0.0.1","[::1]"]);function kd(e){let t=e.replace(/\/+$/,"");if(!URL.canParse(t))throw new Error(`TSUGA_API_URL is not a URL: ${t}`);if(/[\s"'\\]/.test(t))throw new Error(`TSUGA_API_URL holds whitespace, quotes or a backslash: ${JSON.stringify(t)}`);let n=new URL(t);if(!XB.has(n.hostname)&&(n.protocol!=="https:"||!Ux.has(n.hostname)))throw new Error(`Refusing to send credentials to ${t}. Set TSUGA_API_URL to ${[...Ux].map(o=>`https://${o}`).join(", ")}, or a localhost URL.`);return t}var wx=require("node:child_process"),vx=require("node:fs");var Rn="tsuga-cli";var Nx="/usr/bin/secret-tool",JB="Tsuga CLI session",Lx="the login keyring";function eH(){try{return(0,vx.lstatSync)(Nx).isFile()}catch{return!1}}var tH=["DBUS_SESSION_BUS_ADDRESS","XDG_RUNTIME_DIR"];function rH(){let e={};for(let t of tH){let n=process.env[t];n!==void 0&&(e[t]=n)}return e}function Md(e,t){if(!(process.platform!=="linux"||!eH()))try{return{status:0,stdout:(0,wx.execFileSync)(Nx,e,{env:rH(),input:t,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),stderr:""}}catch(n){let{status:o,stderr:i}=n;return{status:o??1,stdout:"",stderr:i??""}}}function Dd(e){let t=Md(["lookup","service",Rn,"account",e]);if(t&&t.status===0)return uu(t.stdout)}function kx(e,t){let n=Md(["store","--label",JB,"service",Rn,"account",e],`${JSON.stringify(t)}
43
+ `);return!(!n||n.status!==0)}function Mx(e){return Md(["clear","service",Rn,"account",e]),Dd(e)===void 0}var Dx=require("node:child_process"),Gx=require("node:fs");var $x="/usr/bin/security",Fx="the macOS Keychain";function Gd(){if(process.platform!=="darwin")return!1;try{return(0,Gx.lstatSync)($x).isFile()}catch{return!1}}function $d(e,t){try{return{status:0,stdout:(0,Dx.execFileSync)($x,e,{env:{},input:t,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),stderr:""}}catch(n){let{status:o,stderr:i}=n;return{status:o??1,stdout:"",stderr:i??""}}}function Fd(e){if(!Gd())return;let t=$d(["find-generic-password","-s",Rn,"-a",e,"-w"]);if(t.status===0)return uu(t.stdout)}function jx(e,t){if(!Gd())return!1;let n=Buffer.from(JSON.stringify(t),"utf-8").toString("hex");return $d(["-i"],`add-generic-password -U -s ${Rn} -a ${e} -X ${n}
44
+ `).status===0}function qx(e){return Gd()?($d(["delete-generic-password","-s",Rn,"-a",e]),Fd(e)===void 0):!0}var nH={friendlyLocationName:Fx,read:Fd,save:jx,remove:qx},oH={friendlyLocationName:Lx,read:Dd,save:kx,remove:Mx},bu=class e extends Error{constructor(t){super(t),this.name="SecretStoreError"}static stillHoldsSession(t){return new e(`The session is still in ${t.friendlyLocationName}. Unlock it and run \`tsuga auth logout\` again.`)}};function ys(){return process.platform==="darwin"?nH:process.platform==="linux"?oH:void 0}function Bx(e){return ys()?.read(e)}function Hx(e,t){return ys()?.save(e,t)??!1}function Kx(e){let t=ys();return t&&!t.remove(e)?t:void 0}var zx=(0,Eo.join)(Su??(0,Eo.join)((0,qd.homedir)(),".config"),"tsuga"),Si=(0,Eo.join)(zx,"config.json"),Yx=(0,Eo.join)(Px??(0,Eo.join)((0,qd.homedir)(),".cache"),"tsuga"),jd=(0,Eo.join)(Yx,"update-check.json"),Ts=kd("https://api.tsuga.com");function Vx(e){return BA(e.credential)}function Au(){if(!(0,tr.existsSync)(Si))return{};try{let e=JSON.parse((0,tr.readFileSync)(Si,"utf-8")),{operationApiKey:t,userAuth:n,...o}=e;return!t&&!n?e:{...o,credentials:{...e.credentials,[Ts]:{...t?{operationApiKey:t}:{},...n?{userAuth:n}:{},...e.credentials?.[Ts]}}}}catch{throw new Error(`Config file corrupted: ${Si}
45
+ Re-authenticate with \`tsuga auth login\` or \`tsuga auth operation-key <OPERATION_API_KEY>\`.`)}}function Es(){try{return Au()}catch{return{}}}function bi(e){(0,tr.mkdirSync)(zx,{recursive:!0,mode:448}),(0,tr.writeFileSync)(Si,`${JSON.stringify(e,null,2)}
46
+ `,{mode:384})}function Bd(e,t=Cn()){let n=e.credentials?.[t]??{};if(n.operationApiKey)return n;let o=Bx(t);return o?{...n,userAuth:o}:n}function Ou(e,t,n=Cn()){return{...e,credentials:{...e.credentials,[n]:t}}}function Cn(){return kd(process.env.TSUGA_API_URL?.trim()||Ts)}function Oi(e){let t=Au(),n=Cn(),o=process.env.TSUGA_OPERATION_API_KEY,i=o?{}:Bd(t,n),a=qA({overrideKey:o,operationApiKey:i.operationApiKey,userAuth:i.userAuth}),c=t.defaults??{},l=e.clusterId?.trim()||process.env.TSUGA_CLUSTER_ID?.trim()||c.cluster?.trim()||void 0;return{apiUrl:n,credential:a,clusterId:l,defaults:c}}function _s(){return Bd(Au()).userAuth}function Qx(e,t){let n=Es(),o=Cn(),{operationApiKey:i}=n.credentials?.[o]??{},a=t&&i?{operationApiKey:i}:{},c=ys();return c&&Hx(o,e)?(bi(Ou(n,a,o)),c.friendlyLocationName):(bi(Ou(n,{...a,userAuth:e},o)),Si)}function Wx(e){return Qx(e,!1)}function xu(e){Qx(e,!0)}function Zx(e){let t=Es();bi(Ou(t,{operationApiKey:e}))}function Xx(){let e=Cn(),t=Kx(e),n=Es(),o=Bd(n,e);if(bi(Ou(n,o.operationApiKey?{operationApiKey:o.operationApiKey}:{},e)),t)throw bu.stillHoldsSession(t)}function Ru(){return Si}var Jx={from:"-30m",to:"now",query:"*","max-results":"100"};function rr(e){return(Au().defaults??{})[e]??Jx[e]}function eR(e,t){let n=Es();bi({...n,defaults:{...n.defaults,[e]:t}})}function tR(){let{defaults:e,...t}=Es();bi(t)}function rR(e,t){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: ${cs(o.userAuth.accessToken)} (expires ${o.userAuth.accessExpiresAt})`);break;default:Ze(a)}}else n.push("Not authenticated. Run `tsuga auth login` or `tsuga auth operation-key <OPERATION_API_KEY>`.");n.push(`Config: ${t}`),n.push(""),n.push("Defaults (custom overrides marked with *):");let i={...Jx,...e.defaults};for(let[a,c]of Object.entries(i)){let l=a in e.defaults?" *":"";n.push(` ${a}: ${c}${l}`)}return`${n.join(`
47
47
  `)}
48
- `}function tR(){if((0,er.existsSync)($d))try{return JSON.parse((0,er.readFileSync)($d,"utf-8")).lastUpdateCheck}catch{return}}function rR(e){(0,er.mkdirSync)(Kx,{recursive:!0,mode:448}),(0,er.writeFileSync)($d,`${JSON.stringify({lastUpdateCheck:e})}
49
- `,{mode:384})}async function XB(){let e=Cn(),{verifier:t,challenge:n}=hx(),o=(0,oR.randomBytes)(16).toString("base64url"),{code:i,redirectUri:a}=await Ox({state:o,buildAuthorizeUrl:m=>MA(e,{redirectUri:m,challenge:n,state:o})}),c=await GA(e,{code:i,verifier:t,redirectUri:a}),l=Vx(yd(c));z(`Logged in. Session token ${ss(c.accessToken)} saved to ${l}`)}async function JB(){let e=Cn(),t=Es();if(!t){let n=e===ys?"":` for ${e}`;process.stderr.write(`No user session${n}. Run \`tsuga auth login\`.
50
- `),process.exitCode=1;return}try{let n=await uu({userAuth:t,now:new Date,reload:Es,refresh:o=>cu(e,o),persist:Ou});z(n.accessToken)}catch(n){process.stderr.write(`${n instanceof Error?n.message:String(n)}
51
- `),process.exitCode=1}}function xu(e,t){let n=qy(By({start:e,end:t}),{format:["years","months","days","hours","minutes"]});return n===""?"less than a minute":n}function eH(e){let t=ss(e.accessToken),n=new Date,o=new Date(e.accessExpiresAt),i=!!e.refreshToken;return Number.isNaN(o.getTime())?`Logged in as a user (token ${t}, expires ${e.accessExpiresAt}).`:o<=n?i?`Logged in as a user (token ${t}). Access token expired ${xu(o,n)} ago, on ${e.accessExpiresAt}; the next command renews it automatically.`:`Logged in as a user (token ${t}). Session expired ${xu(o,n)} ago, on ${e.accessExpiresAt}. Run \`tsuga auth login\` to sign in again.`:i?`Logged in as a user (token ${t}). Access token expires in ${xu(n,o)}, on ${e.accessExpiresAt}; the session renews automatically.`:`Logged in as a user (token ${t}). Session expires in ${xu(n,o)}, on ${e.accessExpiresAt}.`}function tH(){let{credential:e}=Si({});if(!e){z("Not authenticated. Run `tsuga auth login` or `tsuga auth operation-key <OPERATION_API_KEY>`.");return}switch(e.kind){case"user-session":z(eH(e.userAuth));return;case"operation-api-key":z("Authenticated with an operation API key.");return;default:Ze(e)}}function rH(){Wx(),z("Local user session cleared.")}var nH={all:"all permitted telemetry","owning-team-and-public":"owning team plus public data","owning-team-only":"owning team only"};function qd(e){let t=Math.max(...e.map(([n])=>n.length));return e.map(([n,o])=>` ${n.padEnd(t)} ${o}`)}function oH(e){let t=Object.entries(e).sort(([o],[i])=>o.localeCompare(i)),n=["write","read"].map(o=>[o,t.filter(([,i])=>i===o).map(([i])=>i).sort().join(", ")]).filter(([,o])=>o!=="");return n.length===0?["Permissions: none. This key cannot reach any resource."]:["Permissions:",...qd(n)]}function iH(e){switch(e.type){case"operation-api-key":return["Authenticated as an operation API key.",...qd([["Name",e.name],["Key",`\u2022\u2022\u2022\u2022${e.keyLastCharacters}`],["ID",e.id],["Owning team",e.owner],["Data scope",`${e.scope} (${nH[e.scope]})`],["Expires",e.expiresAt===void 0?"never":String(e.expiresAt)]]),"",...oH(e.permissions)].join(`
52
- `);case"user":return["Authenticated as a user.",...qd([["Name",e.name],["Email",e.email],["ID",e.id],["Role",e.role]]),"","Access follows the organization role, not a per-resource permission map."].join(`
53
- `);default:Ze(e)}}var nR=["text","json"];function aH(e){let t=nR.find(n=>n===e);if(t!==void 0)return t;throw new Error(`--output must be one of: ${nR.join(", ")} (got: ${e})`)}function iR(e,t){let n=e.command("auth").description("Manage authentication: user login (OAuth) or operation API key");n.action(()=>n.help()),n.command("login").description("Log in as a user with a browser authorization flow and save the session (replaces any saved operation API key)").action(XB),n.command("logout").description("Clear the saved user session").action(rH),n.command("token").description("Print the saved user access token to stdout").action(JB),n.command("operation-key <OPERATION_API_KEY>").description("Save an operation API key to the config file (replaces any saved user session)").action(o=>{Qx(o),z(`Operation API key saved to ${Au()}`)}),n.command("status").description("Show the current authentication method").action(tH),n.command("whoami").description("Ask Tsuga which credential this CLI authenticates as, and print its scope and permissions").option("-o, --output <FORMAT>","Output format: text | json","text").action(async o=>{let i=aH(o.output),a=await t()(gx);if(i==="json"){Q(a);return}z(iH(a))})}var sH={"sandbox-environment":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"github-connection":{read:["admin"],write:["admin"]},"llm-provider":{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"]},notebook:{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:[]}},cH={"sandbox-environment":{read:["viewer","editor","admin"],write:["editor","admin"]},"github-connection":{read:["admin"],write:[]},"llm-provider":{read:[],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"]},notebook:{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:[]}},pH={user:sH,team:cH};function Bd(e){return aR(e,"team")}function Hd(e){return aR(e,"user")}function aR(e,t){let n=[],o=pH[t];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 oLe={admin:{name:"Global admin",description:"Full control across the organization. Can view and modify everything, including private teams.",permissions:Hd("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:Hd("public_editor"),roleKey:"public_editor"},public_viewer:{name:"Public viewer",description:"Read-only access to public team data. Cannot make changes.",permissions:Hd("public_viewer"),roleKey:"public_viewer"},teams_only:{name:"Teams only",description:"Only access data and assets in their own teams.",permissions:[],roleKey:"teams_only"}},iLe={admin:{name:"Team admin",description:"Full team control, manage assets, members, and settings.",permissions:Bd("admin"),roleKey:"admin"},editor:{name:"Team editor",description:"Can view and update most assets (like dashboards, monitors).",permissions:Bd("editor"),roleKey:"editor"},viewer:{name:"Team viewer",description:"Can view all team data but cannot make changes.",permissions:Bd("viewer"),roleKey:"viewer"}};var aLe=new Set(Od);var uH={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-integration":"notification-integration","notification-rule":"notification-rule","notification-silence":"notification-silence","quality-report":"quality-report","retention-policy":"retention-policy","rum-public-token":"rum-public-token",service:"service","service-target":"service-target",slo:"slo","tag-policy":"tag-policy",team:"team","user-invitation":"user-invitation"},lH=Object.entries(uH),sLe=new Map(lH.flatMap(([e,t])=>t?[[t,e]]:[]));var L="context";var sR="trace_id",Ru=`${L}.team`,pLe=`${L}.env`,uLe=`${L}.api_key_id`,Cu=`${L}.service.name`,lLe=`${L}.service.version`,Pu=`${L}.span.kind`,Uu=`${L}.span.name`,Pn=`${L}.status.code`,mLe=`${L}.stack_trace`,mH="STATUS_CODE_ERROR",dLe=`${Pn}:${mH}`,Kd="resource.attributes.team",cR=["SPAN_KIND_UNSPECIFIED","SPAN_KIND_INTERNAL","SPAN_KIND_SERVER","SPAN_KIND_CLIENT","SPAN_KIND_PRODUCER","SPAN_KIND_CONSUMER"];var _s=`${L}.host.name`,dH=`${L}.instance`,fH=`${L}.instanceid`,gH=`${L}.instance_name`,fLe=`${L}.telemetry.sdk.language`,gLe=`${L}.process.runtime.name`,hLe=`${L}.scope.name`,yLe=`${L}.page.id`,TLe=`${L}.app.name`,ELe=`${L}.page.attributes.view_id`,_Le=`${L}.cloud.provider`,ILe=`${L}.cloud.platform`,SLe=`${L}.aws.ecs.task.arn`,bLe=`${L}.aws.ecs.task.id`,OLe=`${L}.aws.ecs.cluster.arn`,ALe=`${L}.faas.name`,xLe=`${L}.faas.invoked_provider`,RLe=`${L}.gcp.label.service_name`,CLe=`${L}.k8s.cluster.name`,PLe=`${L}.k8s.cluster.uid`,ULe=`${L}.k8s.namespace.name`,hH=`${L}.k8s.pod.name`,wLe=`${L}.k8s.pod.uid`,vLe=`${L}.k8s.container.name`,NLe=`${L}.k8s.node.name`,LLe=`${L}.k8s.node.uid`,yH=`${L}.k8s.deployment.name`,kLe=`${L}.k8s.deployment.uid`,TH=`${L}.k8s.replicaset.name`,MLe=`${L}.k8s.replicaset.uid`,EH=`${L}.k8s.statefulset.name`,DLe=`${L}.k8s.statefulset.uid`,_H=`${L}.k8s.daemonset.name`,GLe=`${L}.k8s.daemonset.uid`,$Le=`${L}.k8s.job.name`,FLe=`${L}.k8s.job.uid`,jLe=`${L}.k8s.cronjob.name`,qLe=`${L}.k8s.cronjob.uid`,bi="status_code",wu="span.name";var vu="span.kind";var IH="db.system.name",SH="db.system",bH="db.namespace",OH="db.name";var BLe=`span_attributes.${bH}`,HLe=`span_attributes.${OH}`,KLe=`span_attributes.${IH}`,zLe=`span_attributes.${SH}`;var YLe={name:"tsuga.internal.processing_tag_policy_violations_total",attributes:{tagPolicyId:`${L}.tag_policy_id`,dataSource:`${L}.data_source`}};var VLe={name:"tsuga.internal.event_size_bytes",attributes:{batchKind:`${L}.batch_kind`,batchKindMetricsFilter:`${L}.batch_kind:metrics`,sourceApiKeyId:`${L}.source_api_key_id`,sourceEnv:`${L}.source_env`,sourceTeam:`${L}.source_team`}};var zd="__tsuga_metadata__",QLe=`${zd}.signature`,WLe=`${zd}.routes`,ZLe=`${zd}.trace_id_bucket`;var oke=[bi,Pn,Pn.replace(`${L}.`,"")];var pR="__tsuga_cluster_id__",AH=r.Object({}),xH=r.Object({status:r.Literal("error"),message:r.String({description:"Why this cluster failed to answer the query."})});function Oi(e=AH){let t=R("status",[r.Object({...e.properties,status:r.Literal("ok")}),xH]);return Object.assign(fp(qt,t),{description:'Outcome per cluster, keyed by cluster ID. A cluster that failed reports `status: "error"`.'})}var RH=5,Is=r.Array(p({allowEmpty:!1}),{minItems:1,maxItems:RH,uniqueItems:!0,description:"IDs of the clusters to query, without duplicates. Mutually exclusive with `clusterId`. Omit both to use the default cluster."});var uR=r.Object({type:r.Literal("number"),number:r.String()}),CH=r.Object({type:r.Literal("string"),string:r.String()}),PH=r.Object({type:r.Literal("timestamp"),timestamp:r.String()}),Ss=R("type",[uR,CH,PH]),UH=r.Object({by:r.Record(r.String(),Ss),computed:r.Record(r.String(),uR)}),wH=r.Object({type:r.Literal("buckets"),buckets:r.Array(UH),clusterResponses:r.Optional(Oi())}),vH=r.Object({type:r.Literal("distribution"),bounds:r.Array(r.Number()),buckets:r.Array(r.Object({timestamp:r.Number(),counts:r.Array(r.Number())})),percentiles:r.Optional(r.Array(r.Number()))}),Ai=R("type",[wH,vH]);var mR=1456444800,dR=4927737600,NH=mR*1e3,LH=dR*1e3,Nu=1704067200,Yd=Nu*1e3,fR={title:"TimeRange",description:"Inclusive time range for telemetry queries. Use Unix timestamps in seconds unless the field description says milliseconds.",examples:[{from:Nu,to:Nu}]},kH={title:"TimeRange",description:"Inclusive time range for telemetry queries using Unix timestamps in milliseconds.",examples:[{from:Yd,to:Yd}]},Lu=e=>r.Integer({description:e,examples:[Nu],minimum:mR,maximum:dR,format:"int64"}),lR=e=>r.Integer({description:e,examples:[Yd],minimum:NH,maximum:LH,format:"int64"}),it=r.Object({from:r.Optional(Lu("Start of the query window as a Unix timestamp in seconds")),to:r.Optional(Lu("End of the query window as a Unix timestamp in seconds"))},fR),Tt=r.Object({from:Lu("Start of the query window as a Unix timestamp in seconds"),to:Lu("End of the query window as a Unix timestamp in seconds")},fR),Un=r.Object({from:lR("Start of the query window as a Unix timestamp in milliseconds"),to:lR("End of the query window as a Unix timestamp in milliseconds")},kH);var GH="/v0/aggregation",$H=r.Union([r.Literal("a"),r.Literal("d"),r.Literal("q"),r.Literal("w"),r.Literal("t")]),Vd=r.Object({parallelism:r.Number(),engine:$H,recordBatchCache:r.Optional(r.Boolean()),includeNullGroups:r.Optional(r.Boolean()),restartAwareGaugeSum:r.Optional(r.Boolean())}),Qd=["logs","metrics","traces"];var yR={logs:"Logs",metrics:"Metrics",traces:"Spans"},FH=[...Qd,"connections","log-patterns","spans","rum"];var Ake={...yR,connections:"Connections","log-patterns":"Log Patterns",spans:"Spans",rum:"RUM events"},vr=[...Qd,"rum"];var xke={...yR,rum:"RUM events"};var Rke=r.Enum(FH,{description:"Data source being queried"}),TR=r.Enum(Qd,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, or `traces`."}),fr=r.Enum(vr,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, `traces`, or `rum`."}),Eo=r.String({description:"Attribute containing the values to aggregate"}),_o=p({description:"Attribute containing the values to aggregate"}),jH=R("type",[r.Object({type:r.Literal("count",{description:"Counts the total number of records"}),field:r.Optional(Eo)},{$id:"AggregateCount",title:"Count"}),r.Object({type:r.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:Eo},{$id:"AggregateUniqueCount",title:"UniqueCount"}),r.Object({type:r.Literal("average",{description:"Calculates the average value of the selected field"}),field:Eo},{$id:"AggregateAverage",title:"Average"}),r.Object({type:r.Literal("max",{description:"Finds the largest value of the field"}),field:Eo},{$id:"AggregateMax",title:"Max"}),r.Object({type:r.Literal("min",{description:"Finds the smallest value of the field"}),field:Eo},{$id:"AggregateMin",title:"Min"}),r.Object({type:r.Literal("sum",{description:"Sums the values of the selected field"}),field:Eo},{$id:"AggregateSum",title:"Sum"}),r.Object({type:r.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:Eo,percentile:r.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`."}),qH=R("type",[r.Object({type:r.Literal("count",{description:"Counts the total number of records"}),field:r.Optional(_o)},{$id:"InputAggregateCount",title:"Count"}),r.Object({type:r.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:_o},{$id:"InputAggregateUniqueCount",title:"UniqueCount"}),r.Object({type:r.Literal("average",{description:"Calculates the average value of the selected field"}),field:_o},{$id:"InputAggregateAverage",title:"Average"}),r.Object({type:r.Literal("max",{description:"Finds the largest value of the field"}),field:_o},{$id:"InputAggregateMax",title:"Max"}),r.Object({type:r.Literal("min",{description:"Finds the smallest value of the field"}),field:_o},{$id:"InputAggregateMin",title:"Min"}),r.Object({type:r.Literal("sum",{description:"Sums the values of the selected field"}),field:_o},{$id:"InputAggregateSum",title:"Sum"}),r.Object({type:r.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:_o,percentile:r.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`."}),ER=r.Object({type:r.Literal("per-second",{description:"Normalizes the metric to events per second"})},{$id:"FunctionPerSecond",title:"PerSecond"}),_R=r.Object({type:r.Literal("per-minute",{description:"Normalizes the metric to events per minute"})},{$id:"FunctionPerMinute",title:"PerMinute"}),IR=r.Object({type:r.Literal("per-hour",{description:"Normalizes the metric to events per hour"})},{$id:"FunctionPerHour",title:"PerHour"}),SR=r.Object({type:r.Literal("rate",{description:"Calculates the rate of change"})},{$id:"FunctionRate",title:"Rate"}),bR=r.Object({type:r.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"}),OR=r.Object({type:r.Literal("power",{description:"Raises values to a specified power"}),exponent:r.Integer({description:"The exponent to raise values to"})},{$id:"FunctionPower",title:"Power"}),AR=r.Object({type:r.Literal("sqrt",{description:"Applies a square root transformation to the values"})},{$id:"FunctionSqrt",title:"Sqrt"}),xR=r.Object({type:r.Literal("last",{description:"Takes the last value of the metric for the selected time frame"})},{$id:"FunctionLast",title:"Last"}),BH=r.Object({type:r.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:r.String({description:"Duration of the rolling window"})},{$id:"FunctionRolling",title:"Rolling"}),HH=r.Object({type:r.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:p({allowEmpty:!1,description:"Duration of the rolling window"})},{$id:"InputFunctionRolling",title:"Rolling"}),KH=r.Object({type:r.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:r.Integer({description:"The base of the logarithm"})},{$id:"FunctionLog",title:"Log"}),zH=r.Object({type:r.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:r.Integer({description:"The base of the logarithm",minimum:2})},{$id:"InputFunctionLog",title:"Log"}),YH=r.Object({type:r.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:r.Integer({description:"Number of seconds to offset"})},{$id:"FunctionTimeOffset",title:"TimeOffset"}),VH=r.Object({type:r.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:r.Integer({description:"Number of seconds to offset",minimum:1})},{$id:"InputFunctionTimeOffset",title:"TimeOffset"}),QH=R("type",[ER,_R,IR,SR,bR,BH,KH,OR,AR,xR,YH],{title:"Function",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."}),WH=R("type",[ER,_R,IR,SR,bR,HH,zH,OR,AR,xR,VH],{title:"InputFunction",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."});var gR=r.Object({min:r.Number({description:"Lower bound of the distribution range."}),max:r.Number({description:"Upper bound of the distribution range."})}),ZH=["linear","log"],ku=r.Enum(ZH,{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."}),hR=r.Integer({minimum:1}),XH=R("type",[r.Object({type:r.Literal("scalar")},{title:"Scalar",description:"Returns a single value"}),r.Object({type:r.Literal("timeseries"),aggregationWindow:p({description:'Time bucket size for aggregation (e.g. "10s", "60s", "1m")'})},{title:"Timeseries",description:"Returns a time series"}),r.Object({type:r.Literal("histogram"),by:r.Optional(p()),bucketCount:r.Optional(hR),bounds:r.Optional(gR),boundsScale:r.Optional(ku),percentiles:r.Optional(r.Array(r.Number({minimum:0,maximum:100,multipleOf:1}),{minItems:1}))},{title:"Histogram",description:"Returns a single distribution over the entire time range"}),r.Object({type:r.Literal("heatmap"),aggregationWindow:p({description:'Time bucket size for the heatmap (e.g. "10s", "60s", "1m")'}),by:r.Optional(p()),bucketCount:r.Optional(hR),bounds:r.Optional(gR)},{title:"Heatmap",description:"Returns a distribution per time window"})]),bs=15,JH=["zero","null"],e2=r.Enum(JH,{description:"`zero` fills missing points with zero. `null` keeps missing points null."}),RR=r.Object({mode:r.Object({type:e2},{description:"How missing aggregation points should be filled."})},{description:"Missing-point fill behavior for aggregation results. Optional; omit to keep missing points null."}),t2=["avg","sum","min","max","last"],CR=r.Enum(t2,{description:"Per-series rollup applied within each time bucket before the cross-series aggregate. Use it on metric queries when `aggregate.type` is `sum` and no `rate`, `increase`, `last`, or `rolling` function is present. When omitted, Tsuga derives the rollup from the metric type."});var PR={aggregate:jH,functions:r.Optional(r.Array(QH,{description:"Post-processing functions applied to aggregation results"})),fill:r.Optional(RR),timeAggregate:r.Optional(CR)},UR={aggregate:qH,functions:r.Optional(r.Array(WH,{maxItems:10,description:"Post-processing functions applied to aggregation results. Defaults to an empty array when omitted."})),fill:r.Optional(RR),timeAggregate:r.Optional(CR)},r2={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."},wR={maxItems:bs,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").'},vR=r.Array(r.Object({...PR,filter:r.Optional(r.String({description:"Filter to apply to the aggregation"}))},{title:"AggregationQuery"}),r2),Os=r.Array(r.Object({...UR,filter:r.Optional(p({type:"tsuga-query",description:"Tsuga query filter to apply to the aggregation. Defaults to an empty string when omitted."}))},{title:"AggregationQuery"}),wR),Vr=r.Array(r.Object({...PR,filter:r.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."}),wn=r.Array(r.Object({...UR,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."}),{...wR,description:"Aggregation queries used by alerting. Each query is referenced from formulas as q1, q2, and so on."}),NR=r.Array(r.Omit(wn.items,["fill"],{title:"SloAggregationQuery",description:"Single aggregation query evaluated by an SLO."}),{minItems:1,maxItems:bs,description:"Aggregation queries used by SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."});var Mu=r.String({description:"Formula referencing submitted query outputs, such as `q1 + q2`. References must be within `q1` through `qN` for the submitted queries."}),Io=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."}),n2=r.Object({fields:r.Array(r.String(),{description:"Telemetry attribute names used to group aggregation results."}),limit:r.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:r.Optional(ne),replaceNullWith:r.Optional(r.String({description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),o2=r.Object({fields:r.Array(p(),{maxItems:1,description:"Telemetry attribute name to group aggregation results by. Currently limited to one field per grouping level."}),limit:r.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:r.Optional(ne),replaceNullWith:r.Optional(p({allowEmpty:!1,description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),LR=7;var xi=r.Array(n2,{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."}),Qr=r.Array(o2,{maxItems:LR,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 Cke=d({tags:["aggregation"],url:`${GH}/multi-query`,method:"POST",body:r.Object({timeRange:Un,queries:Os,groupBy:r.Optional(Qr),returnType:XH,dataSource:fr,formula:Io,executionOptions:Vd,triggeredBy:r.Optional(r.Literal("refresh")),shouldStreamResults:r.Optional(r.Boolean()),clusterId:r.Optional(p({allowEmpty:!1})),clusterIds:r.Optional(Is),viewAs:r.Optional(r.Object({owner:p({allowEmpty:!1,description:"Team ID to fetch data as"}),permissions:On}))}),response:Ai});var Wd=2,Zd=2;var kR=[{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-----
48
+ `}function nR(){if((0,tr.existsSync)(jd))try{return JSON.parse((0,tr.readFileSync)(jd,"utf-8")).lastUpdateCheck}catch{return}}function oR(e){(0,tr.mkdirSync)(Yx,{recursive:!0,mode:448}),(0,tr.writeFileSync)(jd,`${JSON.stringify({lastUpdateCheck:e})}
49
+ `,{mode:384})}async function iH(){let e=Cn(),{verifier:t,challenge:n}=Tx(),o=(0,aR.randomBytes)(16).toString("base64url"),{code:i,redirectUri:a}=await xx({state:o,buildAuthorizeUrl:m=>GA(e,{redirectUri:m,challenge:n,state:o})}),c=await FA(e,{code:i,verifier:t,redirectUri:a}),l=Wx(Ed(c));z(`Logged in. Session token ${cs(c.accessToken)} saved to ${l}`)}async function aH(){let e=Cn(),t=_s();if(!t){let n=e===Ts?"":` for ${e}`;process.stderr.write(`No user session${n}. Run \`tsuga auth login\`.
50
+ `),process.exitCode=1;return}try{let n=await lu({userAuth:t,now:new Date,reload:_s,refresh:o=>pu(e,o),persist:xu});z(n.accessToken)}catch(n){process.stderr.write(`${n instanceof Error?n.message:String(n)}
51
+ `),process.exitCode=1}}function Cu(e,t){let n=Hy(Ky({start:e,end:t}),{format:["years","months","days","hours","minutes"]});return n===""?"less than a minute":n}function sH(e){let t=cs(e.accessToken),n=new Date,o=new Date(e.accessExpiresAt),i=!!e.refreshToken;return Number.isNaN(o.getTime())?`Logged in as a user (token ${t}, expires ${e.accessExpiresAt}).`:o<=n?i?`Logged in as a user (token ${t}). Access token expired ${Cu(o,n)} ago, on ${e.accessExpiresAt}; the next command renews it automatically.`:`Logged in as a user (token ${t}). Session expired ${Cu(o,n)} ago, on ${e.accessExpiresAt}. Run \`tsuga auth login\` to sign in again.`:i?`Logged in as a user (token ${t}). Access token expires in ${Cu(n,o)}, on ${e.accessExpiresAt}; the session renews automatically.`:`Logged in as a user (token ${t}). Session expires in ${Cu(n,o)}, on ${e.accessExpiresAt}.`}function cH(){let{credential:e}=Oi({});if(!e){z("Not authenticated. Run `tsuga auth login` or `tsuga auth operation-key <OPERATION_API_KEY>`.");return}switch(e.kind){case"user-session":z(sH(e.userAuth));return;case"operation-api-key":z("Authenticated with an operation API key.");return;default:Ze(e)}}function pH(){Xx(),z("Local user session cleared.")}var uH={all:"all permitted telemetry","owning-team-and-public":"owning team plus public data","owning-team-only":"owning team only"};function Hd(e){let t=Math.max(...e.map(([n])=>n.length));return e.map(([n,o])=>` ${n.padEnd(t)} ${o}`)}function lH(e){let t=Object.entries(e).sort(([o],[i])=>o.localeCompare(i)),n=["write","read"].map(o=>[o,t.filter(([,i])=>i===o).map(([i])=>i).sort().join(", ")]).filter(([,o])=>o!=="");return n.length===0?["Permissions: none. This key cannot reach any resource."]:["Permissions:",...Hd(n)]}function mH(e){switch(e.type){case"operation-api-key":return["Authenticated as an operation API key.",...Hd([["Name",e.name],["Key",`\u2022\u2022\u2022\u2022${e.keyLastCharacters}`],["ID",e.id],["Owning team",e.owner],["Data scope",`${e.scope} (${uH[e.scope]})`],["Expires",e.expiresAt===void 0?"never":String(e.expiresAt)]]),"",...lH(e.permissions)].join(`
52
+ `);case"user":return["Authenticated as a user.",...Hd([["Name",e.name],["Email",e.email],["ID",e.id],["Role",e.role]]),"","Access follows the organization role, not a per-resource permission map."].join(`
53
+ `);default:Ze(e)}}var iR=["text","json"];function dH(e){let t=iR.find(n=>n===e);if(t!==void 0)return t;throw new Error(`--output must be one of: ${iR.join(", ")} (got: ${e})`)}function sR(e,t){let n=e.command("auth").description("Manage authentication: user login (OAuth) or operation API key");n.action(()=>n.help()),n.command("login").description("Log in as a user with a browser authorization flow and save the session (replaces any saved operation API key)").action(iH),n.command("logout").description("Clear the saved user session").action(pH),n.command("token").description("Print the saved user access token to stdout").action(aH),n.command("operation-key <OPERATION_API_KEY>").description("Save an operation API key to the config file (replaces any saved user session)").action(o=>{Zx(o),z(`Operation API key saved to ${Ru()}`)}),n.command("status").description("Show the current authentication method").action(cH),n.command("whoami").description("Ask Tsuga which credential this CLI authenticates as, and print its scope and permissions").option("-o, --output <FORMAT>","Output format: text | json","text").action(async o=>{let i=dH(o.output),a=await t()(yx);if(i==="json"){Q(a);return}z(mH(a))})}var fH={"sandbox-environment":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"github-connection":{read:["admin"],write:["admin"]},"llm-provider":{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"]},notebook:{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:[]}},gH={"sandbox-environment":{read:["viewer","editor","admin"],write:["editor","admin"]},"github-connection":{read:["admin"],write:[]},"llm-provider":{read:[],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"]},notebook:{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:[]}},hH={user:fH,team:gH};function Kd(e){return cR(e,"team")}function zd(e){return cR(e,"user")}function cR(e,t){let n=[],o=hH[t];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 fLe={admin:{name:"Global admin",description:"Full control across the organization. Can view and modify everything, including private teams.",permissions:zd("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:zd("public_editor"),roleKey:"public_editor"},public_viewer:{name:"Public viewer",description:"Read-only access to public team data. Cannot make changes.",permissions:zd("public_viewer"),roleKey:"public_viewer"},teams_only:{name:"Teams only",description:"Only access data and assets in their own teams.",permissions:[],roleKey:"teams_only"}},gLe={admin:{name:"Team admin",description:"Full team control, manage assets, members, and settings.",permissions:Kd("admin"),roleKey:"admin"},editor:{name:"Team editor",description:"Can view and update most assets (like dashboards, monitors).",permissions:Kd("editor"),roleKey:"editor"},viewer:{name:"Team viewer",description:"Can view all team data but cannot make changes.",permissions:Kd("viewer"),roleKey:"viewer"}};var hLe=new Set(xd);var yH={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-integration":"notification-integration","notification-rule":"notification-rule","notification-silence":"notification-silence","quality-report":"quality-report","retention-policy":"retention-policy","rum-public-token":"rum-public-token",service:"service","service-target":"service-target",slo:"slo","tag-policy":"tag-policy",team:"team","user-invitation":"user-invitation"},TH=Object.entries(yH),yLe=new Map(TH.flatMap(([e,t])=>t?[[t,e]]:[]));var L="context";var pR="trace_id",Pu=`${L}.team`,ELe=`${L}.env`,_Le=`${L}.api_key_id`,Uu=`${L}.service.name`,ILe=`${L}.service.version`,wu=`${L}.span.kind`,vu=`${L}.span.name`,Pn=`${L}.status.code`,SLe=`${L}.stack_trace`,EH="STATUS_CODE_ERROR",bLe=`${Pn}:${EH}`,Yd="resource.attributes.team",uR=["SPAN_KIND_UNSPECIFIED","SPAN_KIND_INTERNAL","SPAN_KIND_SERVER","SPAN_KIND_CLIENT","SPAN_KIND_PRODUCER","SPAN_KIND_CONSUMER"];var Is=`${L}.host.name`,_H=`${L}.instance`,IH=`${L}.instanceid`,SH=`${L}.instance_name`,OLe=`${L}.telemetry.sdk.language`,ALe=`${L}.process.runtime.name`,xLe=`${L}.scope.name`,RLe=`${L}.page.id`,CLe=`${L}.app.name`,PLe=`${L}.page.attributes.view_id`,ULe=`${L}.cloud.provider`,wLe=`${L}.cloud.platform`,vLe=`${L}.aws.ecs.task.arn`,NLe=`${L}.aws.ecs.task.id`,LLe=`${L}.aws.ecs.cluster.arn`,kLe=`${L}.faas.name`,MLe=`${L}.faas.invoked_provider`,DLe=`${L}.gcp.label.service_name`,GLe=`${L}.k8s.cluster.name`,$Le=`${L}.k8s.cluster.uid`,FLe=`${L}.k8s.namespace.name`,bH=`${L}.k8s.pod.name`,jLe=`${L}.k8s.pod.uid`,qLe=`${L}.k8s.container.name`,BLe=`${L}.k8s.node.name`,HLe=`${L}.k8s.node.uid`,OH=`${L}.k8s.deployment.name`,KLe=`${L}.k8s.deployment.uid`,AH=`${L}.k8s.replicaset.name`,zLe=`${L}.k8s.replicaset.uid`,xH=`${L}.k8s.statefulset.name`,YLe=`${L}.k8s.statefulset.uid`,RH=`${L}.k8s.daemonset.name`,VLe=`${L}.k8s.daemonset.uid`,QLe=`${L}.k8s.job.name`,WLe=`${L}.k8s.job.uid`,ZLe=`${L}.k8s.cronjob.name`,XLe=`${L}.k8s.cronjob.uid`,Ai="status_code",Nu="span.name";var Lu="span.kind";var CH="db.system.name",PH="db.system",UH="db.namespace",wH="db.name";var JLe=`span_attributes.${UH}`,eke=`span_attributes.${wH}`,tke=`span_attributes.${CH}`,rke=`span_attributes.${PH}`;var nke={name:"tsuga.internal.processing_tag_policy_violations_total",attributes:{tagPolicyId:`${L}.tag_policy_id`,dataSource:`${L}.data_source`}};var oke={name:"tsuga.internal.event_size_bytes",attributes:{batchKind:`${L}.batch_kind`,batchKindMetricsFilter:`${L}.batch_kind:metrics`,sourceApiKeyId:`${L}.source_api_key_id`,sourceEnv:`${L}.source_env`,sourceTeam:`${L}.source_team`}};var Vd="__tsuga_metadata__",ike=`${Vd}.signature`,ake=`${Vd}.routes`,ske=`${Vd}.trace_id_bucket`;var fke=[Ai,Pn,Pn.replace(`${L}.`,"")];var lR="__tsuga_cluster_id__",vH=r.Object({}),NH=r.Object({status:r.Literal("error"),message:r.String({description:"Why this cluster failed to answer the query."})});function xi(e=vH){let t=R("status",[r.Object({...e.properties,status:r.Literal("ok")}),NH]);return Object.assign(gp(qt,t),{description:'Outcome per cluster, keyed by cluster ID. A cluster that failed reports `status: "error"`.'})}var LH=5,Ss=r.Array(p({allowEmpty:!1}),{minItems:1,maxItems:LH,uniqueItems:!0,description:"IDs of the clusters to query, without duplicates. Mutually exclusive with `clusterId`. Omit both to use the default cluster."});var mR=r.Object({type:r.Literal("number"),number:r.String()}),kH=r.Object({type:r.Literal("string"),string:r.String()}),MH=r.Object({type:r.Literal("timestamp"),timestamp:r.String()}),bs=R("type",[mR,kH,MH]),DH=r.Object({by:r.Record(r.String(),bs),computed:r.Record(r.String(),mR)}),GH=r.Object({type:r.Literal("buckets"),buckets:r.Array(DH),clusterResponses:r.Optional(xi())}),$H=r.Object({type:r.Literal("distribution"),bounds:r.Array(r.Number()),buckets:r.Array(r.Object({timestamp:r.Number(),counts:r.Array(r.Number())})),percentiles:r.Optional(r.Array(r.Number()))}),Ri=R("type",[GH,$H]);var fR=1456444800,gR=4927737600,FH=fR*1e3,jH=gR*1e3,ku=1704067200,Qd=ku*1e3,hR={title:"TimeRange",description:"Inclusive time range for telemetry queries. Use Unix timestamps in seconds unless the field description says milliseconds.",examples:[{from:ku,to:ku}]},qH={title:"TimeRange",description:"Inclusive time range for telemetry queries using Unix timestamps in milliseconds.",examples:[{from:Qd,to:Qd}]},Mu=e=>r.Integer({description:e,examples:[ku],minimum:fR,maximum:gR,format:"int64"}),dR=e=>r.Integer({description:e,examples:[Qd],minimum:FH,maximum:jH,format:"int64"}),it=r.Object({from:r.Optional(Mu("Start of the query window as a Unix timestamp in seconds")),to:r.Optional(Mu("End of the query window as a Unix timestamp in seconds"))},hR),Tt=r.Object({from:Mu("Start of the query window as a Unix timestamp in seconds"),to:Mu("End of the query window as a Unix timestamp in seconds")},hR),Un=r.Object({from:dR("Start of the query window as a Unix timestamp in milliseconds"),to:dR("End of the query window as a Unix timestamp in milliseconds")},qH);var KH="/v0/aggregation",zH=r.Union([r.Literal("a"),r.Literal("d"),r.Literal("q"),r.Literal("w"),r.Literal("t")]),Wd=r.Object({parallelism:r.Number(),engine:zH,recordBatchCache:r.Optional(r.Boolean()),includeNullGroups:r.Optional(r.Boolean()),restartAwareGaugeSum:r.Optional(r.Boolean())}),Zd=["logs","metrics","traces"];var ER={logs:"Logs",metrics:"Metrics",traces:"Spans"},YH=[...Zd,"connections","log-patterns","spans","rum"];var kke={...ER,connections:"Connections","log-patterns":"Log Patterns",spans:"Spans",rum:"RUM events"},vr=[...Zd,"rum"];var Mke={...ER,rum:"RUM events"};var Dke=r.Enum(YH,{description:"Data source being queried"}),_R=r.Enum(Zd,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, or `traces`."}),gr=r.Enum(vr,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, `traces`, or `rum`."}),_o=r.String({description:"Attribute containing the values to aggregate"}),Io=p({description:"Attribute containing the values to aggregate"}),VH=R("type",[r.Object({type:r.Literal("count",{description:"Counts the total number of records"}),field:r.Optional(_o)},{$id:"AggregateCount",title:"Count"}),r.Object({type:r.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:_o},{$id:"AggregateUniqueCount",title:"UniqueCount"}),r.Object({type:r.Literal("average",{description:"Calculates the average value of the selected field"}),field:_o},{$id:"AggregateAverage",title:"Average"}),r.Object({type:r.Literal("max",{description:"Finds the largest value of the field"}),field:_o},{$id:"AggregateMax",title:"Max"}),r.Object({type:r.Literal("min",{description:"Finds the smallest value of the field"}),field:_o},{$id:"AggregateMin",title:"Min"}),r.Object({type:r.Literal("sum",{description:"Sums the values of the selected field"}),field:_o},{$id:"AggregateSum",title:"Sum"}),r.Object({type:r.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:_o,percentile:r.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`."}),QH=R("type",[r.Object({type:r.Literal("count",{description:"Counts the total number of records"}),field:r.Optional(Io)},{$id:"InputAggregateCount",title:"Count"}),r.Object({type:r.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:Io},{$id:"InputAggregateUniqueCount",title:"UniqueCount"}),r.Object({type:r.Literal("average",{description:"Calculates the average value of the selected field"}),field:Io},{$id:"InputAggregateAverage",title:"Average"}),r.Object({type:r.Literal("max",{description:"Finds the largest value of the field"}),field:Io},{$id:"InputAggregateMax",title:"Max"}),r.Object({type:r.Literal("min",{description:"Finds the smallest value of the field"}),field:Io},{$id:"InputAggregateMin",title:"Min"}),r.Object({type:r.Literal("sum",{description:"Sums the values of the selected field"}),field:Io},{$id:"InputAggregateSum",title:"Sum"}),r.Object({type:r.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:Io,percentile:r.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`."}),IR=r.Object({type:r.Literal("per-second",{description:"Normalizes the metric to events per second"})},{$id:"FunctionPerSecond",title:"PerSecond"}),SR=r.Object({type:r.Literal("per-minute",{description:"Normalizes the metric to events per minute"})},{$id:"FunctionPerMinute",title:"PerMinute"}),bR=r.Object({type:r.Literal("per-hour",{description:"Normalizes the metric to events per hour"})},{$id:"FunctionPerHour",title:"PerHour"}),OR=r.Object({type:r.Literal("rate",{description:"Calculates the rate of change"})},{$id:"FunctionRate",title:"Rate"}),AR=r.Object({type:r.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"}),xR=r.Object({type:r.Literal("power",{description:"Raises values to a specified power"}),exponent:r.Integer({description:"The exponent to raise values to"})},{$id:"FunctionPower",title:"Power"}),RR=r.Object({type:r.Literal("sqrt",{description:"Applies a square root transformation to the values"})},{$id:"FunctionSqrt",title:"Sqrt"}),CR=r.Object({type:r.Literal("last",{description:"Takes the last value of the metric for the selected time frame"})},{$id:"FunctionLast",title:"Last"}),WH=r.Object({type:r.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:r.String({description:"Duration of the rolling window"})},{$id:"FunctionRolling",title:"Rolling"}),ZH=r.Object({type:r.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:p({allowEmpty:!1,description:"Duration of the rolling window"})},{$id:"InputFunctionRolling",title:"Rolling"}),XH=r.Object({type:r.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:r.Integer({description:"The base of the logarithm"})},{$id:"FunctionLog",title:"Log"}),JH=r.Object({type:r.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:r.Integer({description:"The base of the logarithm",minimum:2})},{$id:"InputFunctionLog",title:"Log"}),e2=r.Object({type:r.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:r.Integer({description:"Number of seconds to offset"})},{$id:"FunctionTimeOffset",title:"TimeOffset"}),t2=r.Object({type:r.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:r.Integer({description:"Number of seconds to offset",minimum:1})},{$id:"InputFunctionTimeOffset",title:"TimeOffset"}),r2=R("type",[IR,SR,bR,OR,AR,WH,XH,xR,RR,CR,e2],{title:"Function",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."}),n2=R("type",[IR,SR,bR,OR,AR,ZH,JH,xR,RR,CR,t2],{title:"InputFunction",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."});var yR=r.Object({min:r.Number({description:"Lower bound of the distribution range."}),max:r.Number({description:"Upper bound of the distribution range."})}),o2=["linear","log"],Du=r.Enum(o2,{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."}),TR=r.Integer({minimum:1}),i2=R("type",[r.Object({type:r.Literal("scalar")},{title:"Scalar",description:"Returns a single value"}),r.Object({type:r.Literal("timeseries"),aggregationWindow:p({description:'Time bucket size for aggregation (e.g. "10s", "60s", "1m")'})},{title:"Timeseries",description:"Returns a time series"}),r.Object({type:r.Literal("histogram"),by:r.Optional(p()),bucketCount:r.Optional(TR),bounds:r.Optional(yR),boundsScale:r.Optional(Du),percentiles:r.Optional(r.Array(r.Number({minimum:0,maximum:100,multipleOf:1}),{minItems:1}))},{title:"Histogram",description:"Returns a single distribution over the entire time range"}),r.Object({type:r.Literal("heatmap"),aggregationWindow:p({description:'Time bucket size for the heatmap (e.g. "10s", "60s", "1m")'}),by:r.Optional(p()),bucketCount:r.Optional(TR),bounds:r.Optional(yR)},{title:"Heatmap",description:"Returns a distribution per time window"})]),Os=15,a2=["zero","null"],s2=r.Enum(a2,{description:"`zero` fills missing points with zero. `null` keeps missing points null."}),PR=r.Object({mode:r.Object({type:s2},{description:"How missing aggregation points should be filled."})},{description:"Missing-point fill behavior for aggregation results. Optional; omit to keep missing points null."}),c2=["avg","sum","min","max","last"],UR=r.Enum(c2,{description:"Per-series rollup applied within each time bucket before the cross-series aggregate. Use it on metric queries when `aggregate.type` is `sum` and no `rate`, `increase`, `last`, or `rolling` function is present. When omitted, Tsuga derives the rollup from the metric type."});var wR={aggregate:VH,functions:r.Optional(r.Array(r2,{description:"Post-processing functions applied to aggregation results"})),fill:r.Optional(PR),timeAggregate:r.Optional(UR)},vR={aggregate:QH,functions:r.Optional(r.Array(n2,{maxItems:10,description:"Post-processing functions applied to aggregation results. Defaults to an empty array when omitted."})),fill:r.Optional(PR),timeAggregate:r.Optional(UR)},p2={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."},NR={maxItems:Os,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").'},LR=r.Array(r.Object({...wR,filter:r.Optional(r.String({description:"Filter to apply to the aggregation"}))},{title:"AggregationQuery"}),p2),As=r.Array(r.Object({...vR,filter:r.Optional(p({type:"tsuga-query",description:"Tsuga query filter to apply to the aggregation. Defaults to an empty string when omitted."}))},{title:"AggregationQuery"}),NR),Vr=r.Array(r.Object({...wR,filter:r.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."}),wn=r.Array(r.Object({...vR,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."}),{...NR,description:"Aggregation queries used by alerting. Each query is referenced from formulas as q1, q2, and so on."}),kR=r.Array(r.Omit(wn.items,["fill"],{title:"SloAggregationQuery",description:"Single aggregation query evaluated by an SLO."}),{minItems:1,maxItems:Os,description:"Aggregation queries used by SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."});var Gu=r.String({description:"Formula referencing submitted query outputs, such as `q1 + q2`. References must be within `q1` through `qN` for the submitted queries."}),So=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."}),u2=r.Object({fields:r.Array(r.String(),{description:"Telemetry attribute names used to group aggregation results."}),limit:r.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:r.Optional(te),replaceNullWith:r.Optional(r.String({description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),l2=r.Object({fields:r.Array(p(),{maxItems:1,description:"Telemetry attribute name to group aggregation results by. Currently limited to one field per grouping level."}),limit:r.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:r.Optional(te),replaceNullWith:r.Optional(p({allowEmpty:!1,description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),MR=7;var Ci=r.Array(u2,{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."}),Qr=r.Array(l2,{maxItems:MR,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 Gke=d({tags:["aggregation"],url:`${KH}/multi-query`,method:"POST",body:r.Object({timeRange:Un,queries:As,groupBy:r.Optional(Qr),returnType:i2,dataSource:gr,formula:So,executionOptions:Wd,triggeredBy:r.Optional(r.Literal("refresh")),shouldStreamResults:r.Optional(r.Boolean()),clusterId:r.Optional(p({allowEmpty:!1})),clusterIds:r.Optional(Ss),viewAs:r.Optional(r.Object({owner:p({allowEmpty:!1,description:"Team ID to fetch data as"}),permissions:On}))}),response:Ri});var Xd=2,Jd=2;var DR=[{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-----
54
54
  MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDAC4AWkdwKYSd8
55
55
  Ks14IReLcYgADhoXk56ZzXI=
56
- -----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}"}],i2=kR.map(e=>e.key);var jke=new Set(i2),qke=kR.map(e=>e.key);var tMe={[Pu]:vu,[Pu.replace(`${L}.`,"")]:vu,[Uu]:wu,[Uu.replace(`${L}.`,"")]:wu,[Pn]:bi,[Pn.replace(`${L}.`,"")]:bi},rMe={[vu]:Pu,[wu]:Uu,[bi]:Pn};function MR(e){return e.replace(/ies$/,"y").replace(/s$/,"")}var DR=["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"],GR=["alert_queries","alert_thresholds","alert_values"],a2=[...DR,...GR],$R=["alert_event_name","alert_message"],CMe=[...a2,...$R],PMe=new Set([...DR,...$R]),UMe=new Set(GR);var Xd={aws:"aws",gcp:"gcp",azure:"azure"},vn=[Xd.aws,Xd.gcp,Xd.azure];var FR=r.Object({id:r.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:r.String({description:"Cluster name stored in Tsuga. Usable as a display label when `friendlyName` is not set."}),friendlyName:r.Optional(r.String({description:"Human-readable display name for the cluster. Present when a friendly name is configured."})),clusterType:r.Enum(vn,{description:"Cloud provider selected for the Tsuga cluster."}),clusterRegion:r.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`."}),s2={id:"abc-123-def",name:"production",friendlyName:"Production (US)",clusterType:"aws",clusterRegion:"us-east-1"};Object.assign(FR,{examples:[s2]});var jR=d({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:r.Array(FR)});function qR(e,t){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 t()(jR);Q(o)})}function HR(e,t,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(t.join(" "),{cmds:i,flags:[...a,"--help"]});for(let c of e.commands)c.name().startsWith("__")||HR(c,[...t,c.name()],n,o)}function c2(e){let t=new Map,n=new Set;return HR(e,[],t,n),{rows:[...t].map(([i,{cmds:a,flags:c}])=>({key:i,cmds:[...new Set(a)].join(" "),flags:[...new Set(c)].join(" ")})),valueFlags:[...n].join(" ")}}function BR(e){return e.map(({key:t,cmds:n,flags:o})=>` ${JSON.stringify(t)}) cmds=${JSON.stringify(n)} flags=${JSON.stringify(o)} ;;`).join(`
57
- `)}function p2(e,t){return`_tsuga_complete() {
56
+ -----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}"}],m2=DR.map(e=>e.key);var Zke=new Set(m2),Xke=DR.map(e=>e.key);var lMe={[wu]:Lu,[wu.replace(`${L}.`,"")]:Lu,[vu]:Nu,[vu.replace(`${L}.`,"")]:Nu,[Pn]:Ai,[Pn.replace(`${L}.`,"")]:Ai},mMe={[Lu]:wu,[Nu]:vu,[Ai]:Pn};function GR(e){return e.replace(/ies$/,"y").replace(/s$/,"")}var $R=["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"],FR=["alert_queries","alert_thresholds","alert_values"],d2=[...$R,...FR],jR=["alert_event_name","alert_message"],GMe=[...d2,...jR],$Me=new Set([...$R,...jR]),FMe=new Set(FR);var ef={aws:"aws",gcp:"gcp",azure:"azure"},vn=[ef.aws,ef.gcp,ef.azure];var qR=r.Object({id:r.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:r.String({description:"Cluster name stored in Tsuga. Usable as a display label when `friendlyName` is not set."}),friendlyName:r.Optional(r.String({description:"Human-readable display name for the cluster. Present when a friendly name is configured."})),clusterType:r.Enum(vn,{description:"Cloud provider selected for the Tsuga cluster."}),clusterRegion:r.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`."}),f2={id:"abc-123-def",name:"production",friendlyName:"Production (US)",clusterType:"aws",clusterRegion:"us-east-1"};Object.assign(qR,{examples:[f2]});var BR=d({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:r.Array(qR)});function HR(e,t){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 t()(BR);Q(o)})}function zR(e,t,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(t.join(" "),{cmds:i,flags:[...a,"--help"]});for(let c of e.commands)c.name().startsWith("__")||zR(c,[...t,c.name()],n,o)}function g2(e){let t=new Map,n=new Set;return zR(e,[],t,n),{rows:[...t].map(([i,{cmds:a,flags:c}])=>({key:i,cmds:[...new Set(a)].join(" "),flags:[...new Set(c)].join(" ")})),valueFlags:[...n].join(" ")}}function KR(e){return e.map(({key:t,cmds:n,flags:o})=>` ${JSON.stringify(t)}) cmds=${JSON.stringify(n)} flags=${JSON.stringify(o)} ;;`).join(`
57
+ `)}function h2(e,t){return`_tsuga_complete() {
58
58
  local cur key cmds flags words i word prev
59
59
  local valueflags="${t}"
60
60
  local -a path
@@ -75,7 +75,7 @@ ${e}
75
75
  COMPREPLY=( $(compgen -W "$words" -- "$cur") )
76
76
  }
77
77
  complete -F _tsuga_complete tsuga
78
- `}function u2(e,t){return`#compdef tsuga
78
+ `}function y2(e,t){return`#compdef tsuga
79
79
  _tsuga_complete() {
80
80
  local cur key cmds flags out i word prev
81
81
  local valueflags="${t}"
@@ -97,10 +97,10 @@ ${e}
97
97
  compadd -- \${=out}
98
98
  }
99
99
  compdef _tsuga_complete tsuga
100
- `}function Jd(e){return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function l2(e){return e.map(({key:t,cmds:n,flags:o})=>` case ${Jd(t)}
101
- set cmds ${Jd(n)}
102
- set flags ${Jd(o)}`).join(`
103
- `)}function m2(e,t){return`# Update with: tsuga completion fish > ~/.config/fish/completions/tsuga.fish
100
+ `}function tf(e){return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function T2(e){return e.map(({key:t,cmds:n,flags:o})=>` case ${tf(t)}
101
+ set cmds ${tf(n)}
102
+ set flags ${tf(o)}`).join(`
103
+ `)}function E2(e,t){return`# Update with: tsuga completion fish > ~/.config/fish/completions/tsuga.fish
104
104
  function __tsuga_complete
105
105
  set -l valueflags -- ${t}
106
106
  set -l tokens (commandline -xpc)
@@ -135,47 +135,47 @@ ${e}
135
135
  end
136
136
  end
137
137
  complete -c tsuga -f -a '(__tsuga_complete)'
138
- `}function KR(e){e.command("completion <SHELL>").description("Print a shell completion script (bash, zsh, or fish)").addHelpText("after",`
138
+ `}function YR(e){e.command("completion <SHELL>").description("Print a shell completion script (bash, zsh, or fish)").addHelpText("after",`
139
139
  Usage:
140
140
  bash: eval "$(tsuga completion bash)" # add to ~/.bashrc
141
141
  zsh: eval "$(tsuga completion zsh)" # add to ~/.zshrc
142
- fish: tsuga completion fish > ~/.config/fish/completions/tsuga.fish`).action(t=>{let{rows:n,valueFlags:o}=c2(e);if(t==="bash")z(p2(BR(n),o));else if(t==="zsh")z(u2(BR(n),o));else if(t==="fish")z(m2(l2(n),o));else throw new Error(`Unsupported shell "${t}". Supported: bash, zsh, fish.`)})}function zR(e){let t=e.command("config").description("Show or manage configuration");t.action(()=>{let n=e.opts(),o=Si({clusterId:n.cluster});z(eR(o,Au()).trimEnd())}),t.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)=>{Xx(n,o),z(`Default set: ${n} = ${o}`)}),t.command("reset").description("Reset configuration values").command("defaults").description("Clear all custom defaults").action(()=>{Jx(),z("Custom defaults cleared")})}var YR=`/${"v1"}/docs`,VR=r.Object({path:r.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:r.String({description:'Title of the page (e.g. "Send your first logs" or "POST /v1/aggregation/multi-query/scalar")'}),content:r.String({description:"Raw markdown content of the page"})},{$id:"DocPage",description:"A documentation or API-reference page with its raw markdown content"}),d2={path:"getting-started/send-your-first-logs",title:"Send your first logs",content:`# Send your first logs
143
- ...`};Object.assign(VR,{examples:[d2]});var QR=r.Object({kind:r.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:r.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:r.String({description:'Title of the result (e.g. "How to Add Resource Attributes" or "POST /v1/aggregation/multi-query/scalar")'}),subsection:r.Optional(r.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:r.Optional(r.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:r.Optional(r.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:r.Number({description:"Relevance score between 0 and 1 (higher is more relevant)"}),excerpt:r.String({description:"Short snippet of matching content"}),link:r.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"}),f2={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(QR,{examples:[f2]});var WR=d({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:YR,method:"GET",query:r.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:VR}),ZR=d({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:`${YR}/search`,method:"GET",query:r.Object({query:p({allowEmpty:!1,description:"Search text to match against documentation and API-reference content."})},{description:"Documentation search query."}),response:r.Array(QR)});function XR(e,t){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 t()(WR,{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 t()(ZR,{query:{query:o}});Q(i)})}var Ew=require("node:fs");var g2="/v0/profiles",h2=["cpu","samples","wall","off_cpu","space","inuse_space","objects","inuse_objects","alloc_space","alloc_objects","goroutine"],y2=20,As={service:p({allowEmpty:!1,description:"Service the profiles belong to, as it appears in `profile.{type}.{service}`."}),type:r.Enum(h2,{description:"pprof sample type."}),filter:r.Optional(p({type:"tsuga-query",description:"TQL over the profile labels. Only label equality, negation and wildcards are accepted."})),groupBy:r.Optional(r.Array(p({allowEmpty:!1}),{description:"Labels to split the flamegraph by. The stack itself cannot be a group-by."})),limit:r.Optional(r.Integer({minimum:1,default:y2,description:"Maximum number of groups, ranked by total value."})),minFraction:r.Optional(r.Number({minimum:0,maximum:1,description:"Nodes below this share of the root total fold into their parent."}))},z0e=d({tags:["profiles"],url:`${g2}/query`,method:"POST",body:r.Object({...As,timeRange:Un,clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster to target. Defaults to the first cluster created in the organization when omitted."}))}),response:Ai});var JR=`/${"v1"}/aggregation`,eC=r.Object({id:r.String({description:"Result identifier. Query results use `q1`, `q2`, and so on; formula results use `formula`."}),group:r.Record(r.String(),r.Union([r.String(),r.Number()]),{description:"Group-by field values for this result. Empty when no group-by is requested."})}),tC=r.Object({results:r.Array(r.Object({...eC.properties,value:r.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."}),T2={results:[{id:"q1",group:{host:"server-1"},value:123.45}]};Object.assign(tC,{examples:[T2]});var Du=r.Object({series:r.Array(r.Object({...eC.properties,points:r.Array(r.Object({timestamp:r.Integer({description:"Unix timestamp in milliseconds for this point, spaced by `aggregationWindow`."}),value:r.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."}),E2={series:[{id:"q1",group:{host:"server-1"},points:[{timestamp:16094592e5,value:123.45},{timestamp:160945926e4,value:456.78}]}]};Object.assign(Du,{examples:[E2]});var _2=r.Omit(Os.items,["fill"],{title:"AggregationQuery",description:"Aggregation query. Omit `filter` for an unfiltered query and omit `functions` when no post-processing is needed."}),I2=r.Optional(Qr),rC={timeRange:Tt,queries:r.Array(_2,{maxItems:bs,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 ${bs} 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:I2,dataSource:TR,formula:r.Optional(Io)},xs=r.Object({clusterId:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),nC=r.Object(rC,{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."}),S2={timeRange:{from:1782201500,to:1782203400},dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(nC,{examples:[S2]});var oC=d({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:`${JR}/multi-query/scalar`,method:"POST",body:nC,query:xs,response:tC}),iC=r.Object({...rC,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."}),b2={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(iC,{examples:[b2]});var aC=d({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:`${JR}/multi-query/timeseries`,method:"POST",body:iC,query:xs,response:Du});var sC=`/${"v1"}/profiles`,cC=r.Object({...As,timeRange:Tt},{description:"Profile query request. Send clusterId as a query parameter, not in this JSON body.",examples:[{service:"api",type:"cpu",timeRange:{from:1782201500,to:1782203400},filter:"context.env:prod"}]}),O2=r.Object({stacks:r.Array(r.Object({stack:r.String({description:"Frames from the root to the leaf, joined with `;` (folded stack format)."}),group:r.Record(r.String(),r.String(),{description:"Group-by label values for this stack. Empty when no group-by is requested."}),value:r.Number({description:"Total sample value of this stack, in the unit of the profile type."})}),{description:"One entry per distinct leaf stack, after folding nodes below minFraction."})},{examples:[{stacks:[{stack:"main;handleRequest;encodeJson",group:{},value:125e7},{stack:"main;handleRequest;queryDb",group:{},value:8e8}]}]}),ef=d({description:"Aggregates continuous profiling samples for a service into folded stacks, optionally split by profile labels.",tags:["private"],url:`${sC}/query`,method:"POST",body:cC,query:xs,response:O2}),A2=r.Object({pprof:r.String({description:"Merged pprof profile, base64-encoded (standard alphabet, padded)."})}),pC=d({description:"Merges continuous profiling samples for a service into a single pprof profile.",tags:["private"],url:`${sC}/pprof`,method:"POST",body:cC,query:xs,response:A2});var rr=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 uC(e){if(e instanceof rr){let t=[`Error: ${e.message}`];return e.code&&t.push(`Code: ${e.code}`),e.statusCode&&t.push(`Status: ${e.statusCode}`),e.requestId&&t.push(`Request ID: ${e.requestId}`),e.details&&t.push(`Details: ${JSON.stringify(e.details,null,2)}`),t.join(`
144
- `)}return e instanceof Error?`Error: ${e.message}`:String(e)}var lC=pn(require("node:fs"));function Ri(e){if(e.file){let t=lC.default.readFileSync(e.file==="-"?0:e.file,"utf-8");return JSON.parse(t)}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 tf(e){return s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>s.IsObject(t)&&s.HasPropertyKey(t,"check")&&s.HasPropertyKey(t,"error")&&s.IsFunction(t.check)&&s.IsFunction(t.error))}function gr(e){return s.IsObject(e)&&!s.IsArray(e)}function Gu(e){return s.IsBoolean(e)}function j(e){return gr(e)||Gu(e)}function rf(e){return s.HasPropertyKey(e,"additionalItems")&&j(e.additionalItems)}function Wr(e){return s.HasPropertyKey(e,"additionalProperties")&&j(e.additionalProperties)}function nf(e){return s.HasPropertyKey(e,"allOf")&&s.IsArray(e.allOf)&&e.allOf.every(t=>j(t))}function Rs(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function of(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(t=>j(t))}function af(e){return s.HasPropertyKey(e,"const")}function So(e){return s.HasPropertyKey(e,"contains")&&j(e.contains)}function Vt(e){return s.HasPropertyKey(e,"default")}function sf(e){return s.HasPropertyKey(e,"dependencies")&&s.IsObject(e.dependencies)&&Object.values(e.dependencies).every(t=>j(t)||s.IsArray(t)&&t.every(n=>s.IsString(n)))}function cf(e){return s.HasPropertyKey(e,"dependentRequired")&&s.IsObject(e.dependentRequired)&&Object.values(e.dependentRequired).every(t=>s.IsArray(t)&&t.every(n=>s.IsString(n)))}function pf(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>j(t))}function Nn(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function uf(e){return s.HasPropertyKey(e,"$dynamicRef")&&s.IsString(e.$dynamicRef)}function lf(e){return s.HasPropertyKey(e,"else")&&j(e.else)}function mf(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function df(e){return s.HasPropertyKey(e,"exclusiveMaximum")&&(s.IsNumber(e.exclusiveMaximum)||s.IsBigInt(e.exclusiveMaximum))}function Zr(e){return s.HasPropertyKey(e,"exclusiveMinimum")&&(s.IsNumber(e.exclusiveMinimum)||s.IsBigInt(e.exclusiveMinimum))}function Cs(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function Xr(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function ff(e){return s.HasPropertyKey(e,"if")&&j(e.if)}function Ci(e){return s.HasPropertyKey(e,"items")&&(j(e.items)||s.IsArray(e.items)&&e.items.every(t=>j(t)))}function gf(e){return Ci(e)&&s.IsArray(e.items)}function hf(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function yf(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function $u(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function Tf(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function Ef(e){return s.HasPropertyKey(e,"maxProperties")&&s.IsNumber(e.maxProperties)}function Jr(e){return s.HasPropertyKey(e,"minimum")&&(s.IsNumber(e.minimum)||s.IsBigInt(e.minimum))}function bo(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function Pi(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function Ps(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function Us(e){return s.HasPropertyKey(e,"minProperties")&&s.IsNumber(e.minProperties)}function _f(e){return s.HasPropertyKey(e,"multipleOf")&&(s.IsNumber(e.multipleOf)||s.IsBigInt(e.multipleOf))}function If(e){return s.HasPropertyKey(e,"not")&&j(e.not)}function Sf(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(t=>j(t))}function ws(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function vs(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(t=>j(t))}function Ui(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(t=>j(t))}function Ns(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(t=>j(t))}function bf(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||j(e.propertyNames))}function x2(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function Fu(e){return x2(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function Of(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function Af(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function Oo(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(t=>s.IsString(t))}function xf(e){return s.HasPropertyKey(e,"then")&&j(e.then)}function Rf(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(t=>s.IsString(t)))}function wi(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function ju(e){return s.HasPropertyKey(e,"unevaluatedItems")&&j(e.unevaluatedItems)}function qu(e){return s.HasPropertyKey(e,"unevaluatedProperties")&&j(e.unevaluatedProperties)}var Rt=class{constructor(){let t=new Set,n=new Set;this.stack=[{indices:t,keys:n}]}Push(){let t=new Set,n=new Set;return this.stack.push({indices:t,keys:n}),!0}Pop(){return this.stack.pop(),!0}AddIndex(t){return this.GetIndices().add(t),!0}AddKey(t){return this.GetKeys().add(t),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(t){for(let n of t)n.GetIndices().forEach(o=>this.GetIndices().add(o)),n.GetKeys().forEach(o=>this.GetKeys().add(o));return!0}},Ls=class extends Rt{constructor(t){super(),this.callback=t}AddError(t){return this.callback(t),!1}},ut=class extends Ls{constructor(){super(t=>this.errors.push(t)),this.errors=[]}AddError(t){return this.errors.push(t),!1}GetErrors(){return this.errors}};function mC(e,t,n,o){return s.Every(n["~refine"],0,(i,a)=>i.check(o))}function dC(e,t,n,o,i,a){return s.EveryAll(i["~refine"],0,(c,l)=>c.check(a)||t.AddError({keyword:"~refine",schemaPath:n,instancePath:o,params:{index:l,message:c.error(a)}}))}function fC(e){return Ci(e)&&s.IsArray(e.items)}function gC(e,t,n,o){return fC(n)?s.Every(o,0,(a,c)=>s.IsLessThan(c,n.items.length)||Qt(e,t,n.additionalItems,a)&&t.AddIndex(c)):!0}function hC(e,t,n,o,i,a){return fC(i)?s.Every(a,0,(l,m)=>{let f=`${n}/additionalItems`,h=`${o}/${m}`;return s.IsLessThan(m,i.items.length)||Wt(e,t,f,h,i.additionalItems,l)&&t.AddIndex(m)}):!0}function R2(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function yC(e){let t=[];return vs(e)&&t.push(...s.Keys(e.patternProperties)),Ns(e)&&t.push(...s.Keys(e.properties).map(R2)),s.IsEqual(t.length,0)?"(?!)":`(${t.join("|")})`}function TC(e,t,n,o){let i=new RegExp(yC(n));return s.Every(s.Keys(o),0,(c,l)=>i.test(c)||Qt(e,t,n.additionalProperties,o[c])&&t.AddKey(c))}function EC(e,t,n,o,i,a){let c=new RegExp(yC(i)),l=[];return s.EveryAll(s.Keys(a),0,(f,h)=>{let E=`${n}/additionalProperties`,I=`${o}/${f}`,g=new ut,T=c.test(f)||Wt(e,g,E,I,i.additionalProperties,a[f])&&t.AddKey(f);return T||l.push(f),T})||t.AddError({keyword:"additionalProperties",schemaPath:n,instancePath:o,params:{additionalProperties:l}})}function _C(e,t,n,o){let i=n.allOf.reduce((a,c)=>{let l=new Rt;return oe(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,n.allOf.length)&&t.Merge(i)}function IC(e,t,n,o,i,a){let c=[],l=i.allOf.reduce((f,h,E)=>{let I=`${n}/allOf/${E}`,g=new ut,T=be(e,g,I,o,h,a);return T||c.push(g),T?[...f,g]:f},[]),m=s.IsEqual(l.length,i.allOf.length)&&t.Merge(l);return m||c.forEach(f=>f.GetErrors().forEach(h=>t.AddError(h))),m}function SC(e,t,n,o){let i=n.anyOf.reduce((a,c)=>{let l=new Rt;return oe(e,l,c,o)?[...a,l]:a},[]);return s.IsGreaterThan(i.length,0)&&t.Merge(i)}function bC(e,t,n,o,i,a){let c=[],l=i.anyOf.reduce((f,h,E)=>{let I=new ut,g=`${n}/anyOf/${E}`,T=be(e,I,g,o,h,a);return T||c.push(I),T?[...f,I]:f},[]),m=s.IsGreaterThan(l.length,0)&&t.Merge(l);return m||c.forEach(f=>f.GetErrors().forEach(h=>t.AddError(h))),m||t.AddError({keyword:"anyOf",schemaPath:n,instancePath:o,params:{}})}function Pf(e,t,n,o){return n}function OC(e,t,n,o,i,a){return Pf(e,t,i,a)||t.AddError({keyword:"boolean",schemaPath:n,instancePath:o,params:{}})}function Uf(e,t,n,o){return s.IsValueLike(n.const)?s.IsEqual(o,n.const):s.IsDeepEqual(o,n.const)}function AC(e,t,n,o,i,a){return Uf(e,t,i,a)||t.AddError({keyword:"const",schemaPath:n,instancePath:o,params:{allowedValue:i.const}})}function C2(e){return!(bo(e)&&s.IsEqual(e.minContains,0))}function wf(e,t,n,o){return C2(n)?!s.IsEqual(o.length,0)&&s.SomeAll(o,(i,a)=>oe(e,t,n.contains,i)&&t.AddIndex(a)):!0}function xC(e,t,n,o,i,a){return wf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:1}})}function RC(e,t,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(m=>s.HasPropertyKey(o,m)):oe(e,t,l,o)));return i||a}function CC(e,t,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependencies),0,([m,f])=>{let h=`${n}/dependencies/${m}`;return!s.HasPropertyKey(a,m)||(s.IsArray(f)?f.every(E=>s.HasPropertyKey(a,E)||t.AddError({keyword:"dependencies",schemaPath:n,instancePath:o,params:{property:m,dependencies:f}})):be(e,t,h,o,f,a))});return c||l}function PC(e,t,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(m=>s.HasPropertyKey(o,m)));return i||a}function UC(e,t,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependentRequired),0,([m,f])=>!s.HasPropertyKey(a,m)||s.EveryAll(f,0,h=>s.HasPropertyKey(a,h)||t.AddError({keyword:"dependentRequired",schemaPath:n,instancePath:o,params:{property:m,dependencies:f}})));return c||l}function wC(e,t,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)||oe(e,t,l,o));return i||a}function vC(e,t,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependentSchemas),0,([m,f])=>{let h=`${n}/dependentSchemas/${m}`;return!s.HasPropertyKey(a,m)||be(e,t,h,o,f,a)});return c||l}function NC(e,t,n,o){let i=e.DynamicRef(n)??!1;return j(i)&&oe(e,t,i,o)}function LC(e,t,n,o,i,a){let c=e.DynamicRef(i)??!1;return j(c)&&be(e,t,"#",o,c,a)}function Lf(e,t,n,o){return s.Some(n.enum,i=>s.IsValueLike(i)?s.IsEqual(o,i):s.IsDeepEqual(o,i))}function kC(e,t,n,o,i,a){return Lf(e,t,i,a)||t.AddError({keyword:"enum",schemaPath:n,instancePath:o,params:{allowedValues:i.enum}})}function kf(e,t,n,o){return s.IsLessThan(o,n.exclusiveMaximum)}function MC(e,t,n,o,i,a){return kf(e,t,i,a)||t.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:o,params:{comparison:"<",limit:i.exclusiveMaximum}})}function Mf(e,t,n,o){return s.IsGreaterThan(o,n.exclusiveMinimum)}function DC(e,t,n,o,i,a){return Mf(e,t,i,a)||t.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:o,params:{comparison:">",limit:i.exclusiveMinimum}})}var ki={};Zt(ki,{Clear:()=>VC,Entries:()=>dK,Get:()=>hK,Has:()=>gK,IsDate:()=>Ni,IsDateTime:()=>Bu,IsDuration:()=>Hu,IsEmail:()=>Ku,IsHostname:()=>Yu,IsIPv4:()=>Wu,IsIPv6:()=>Zu,IsIdnEmail:()=>Vu,IsIdnHostname:()=>Qu,IsIri:()=>Ju,IsIriReference:()=>Xu,IsJsonPointer:()=>tl,IsJsonPointerUriFragment:()=>el,IsRegex:()=>rl,IsRelativeJsonPointer:()=>nl,IsTime:()=>Li,IsUri:()=>sl,IsUriReference:()=>ol,IsUriTemplate:()=>il,IsUrl:()=>cl,IsUuid:()=>pl,Reset:()=>QC,Set:()=>fK,Test:()=>yK});var P2=[0,31,28,31,30,31,30,31,31,30,31,30,31],U2=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function w2(e){return e%4===0&&(e%100!==0||e%400===0)}function Ni(e){let t=U2.exec(e);if(!t)return!1;let n=+t[1],o=+t[2],i=+t[3];return o>=1&&o<=12&&i>=1&&i<=(o===2&&w2(n)?29:P2[o])}var v2=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function Li(e,t=!0){let n=v2.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),m=+(n[6]||0);if(l>23||m>59||t&&!n[4]&&e.toLowerCase().indexOf("z")===-1)return!1;if(o<=23&&i<=59&&a<60)return!0;let f=i-m*c,h=o-l*c-(f<0?1:0);return(h===23||h===-1)&&(f===59||f===-1)&&a<61}function Bu(e,t=!0){let n=e.split(/T/i);return n.length===2&&Ni(n[0])&&Li(n[1],t)}var N2=/^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;function Hu(e){return N2.test(e)}var L2=/^(?!.*\.\.)[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 Ku(e){return L2.test(e)}var Ao=36,zu=1,Df=26,k2=38,M2=700,D2=72,G2=128;function $2(e,t,n){e=n?Math.floor(e/M2):e>>1,e+=Math.floor(e/t);let o=0;for(;e>(Ao-zu)*Df>>1;)e=Math.floor(e/(Ao-zu)),o+=Ao;return o+Math.floor((Ao-zu+1)*e/(e+k2))}function GC(e){let t=[],n=G2,o=0,i=D2,a=e.lastIndexOf("-");if(a>0)for(let l=0;l<a;l++){let m=e.charCodeAt(l);if(m>=128)throw new Error("Invalid punycode: non-basic before delimiter");t.push(m)}let c=a<0?0:a+1;for(;c<e.length;){let l=o,m=1,f=Ao;for(;;){if(c>=e.length)throw new Error("Invalid punycode: unexpected end of input");let E=e.charCodeAt(c++),I;if(E>=97&&E<=122)I=E-97;else if(E>=48&&E<=57)I=E-48+26;else if(E>=65&&E<=90)he();else throw new Error("Invalid punycode: bad digit character");o+=I*m;let g=f<=i?zu:f>=i+Df?Df:f-i;if(I<g)break;m*=Ao-g,f+=Ao}let h=t.length+1;i=$2(o-l,h,l===0),n+=Math.floor(o/h),o%=h,t.splice(o,0,n),o++}return globalThis.String.fromCodePoint(...t)}function j2(e){return new RegExp("\\p{Mn}","u").test(String.fromCodePoint(e))}function q2(e){return new RegExp("\\p{Mc}","u").test(String.fromCodePoint(e))}function B2(e){return new RegExp("\\p{Me}","u").test(String.fromCodePoint(e))}function H2(e){return j2(e)||q2(e)||B2(e)}var K2=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347]),z2=new Set([2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,6980,7082,7083,43456,69702,69759,69817,69939,69940,70080,70197,70477,70722,70850,71103,71231,71350,72767,73028,73029]);function Y2(e){return new RegExp("\\p{Script=Greek}","u").test(String.fromCodePoint(e))}function V2(e){return new RegExp("\\p{Script=Hebrew}","u").test(String.fromCodePoint(e))}function Q2(e){return new RegExp("\\p{Script=Hiragana}","u").test(String.fromCodePoint(e))}function W2(e){return new RegExp("\\p{Script=Katakana}","u").test(String.fromCodePoint(e))}function Z2(e){return new RegExp("\\p{Script=Han}","u").test(String.fromCodePoint(e))}function X2(e){return e>=1632&&e<=1641}function J2(e){return e>=1776&&e<=1785}function $C(e){return z2.has(e)}function FC(e){if(e.length===0)return he();let t=[...e].map(c=>c.codePointAt(0)),n=t.length;if(t[0]===45||t[n-1]===45||n>=4&&t[2]===45&&t[3]===45||H2(t[0]))return!1;let o=!1,i=!1,a=!1;for(let c=0;c<n;c++){let l=t[c];if(K2.has(l))return!1;(Q2(l)||W2(l)||Z2(l))&&(o=!0),X2(l)&&(i=!0),J2(l)&&(a=!0);let m=t[c-1],f=t[c+1];switch(l){case 183:if(m!==108||f!==108)return!1;break;case 885:if(f===void 0||!Y2(f))return!1;break;case 1523:case 1524:if(m===void 0||!V2(m))return!1;break;case 8204:if(m===void 0||m<128&&!$C(m))return!1;break;case 8205:if(m===void 0||!$C(m))return!1;break;case 12539:break}}return!(e.includes("\u30FB")&&!o||i&&a)}function eK(e){if(e.charCodeAt(0)===45||e.charCodeAt(e.length-1)===45||e.length>=4&&e.charCodeAt(2)===45&&e.charCodeAt(3)===45)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45))return!1}return!0}function jC(e){return e.toLowerCase().startsWith("xn--")}function qC(e){try{let t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;let o=GC(t);return o?FC(o):!1}catch{return!1}}function BC(e){return e.length===0||e.length>63?!1:jC(e)?qC(e):FC(e)}function HC(e){return e.length===0||e.length>63?!1:jC(e)?qC(e):eK(e)}function Yu(e){if(e.length===0||e.length>253||e.charCodeAt(e.length-1)===46)return!1;for(let t of e.split("."))if(!HC(t))return!1;return!0}var rK=/^(?!.*\.\.)[\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 Vu(e){return rK.test(e)}function Qu(e){if(e.length===0||e.includes(" "))return!1;let t=e.normalize("NFC").replace(/[\u002E\u3002\uFF0E\uFF61]/g,".");if(t.length>253)return!1;for(let n of t.split("."))if(!BC(n))return!1;return!0}function Gf(e,t,n){let o=0,i=0,a=0,c=0;for(let l=t;l<n;l++){let m=e.charCodeAt(l);if(m===46){if(a===0||i>255||c===48&&a>1)return!1;o++,i=0,a=0,c=0}else if(m>=48&&m<=57)a===0&&(c=m),i=i*10+(m-48),a++;else return!1}return o===3&&a>0&&i<=255&&!(c===48&&a>1)}function Wu(e){return Gf(e,0,e.length)}function nK(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Zu(e){let t=e.length;if(t===0)return!1;let n=0,o=!1,i=0;if(e.charCodeAt(0)===58&&e.charCodeAt(1)===58){if(t===2)return!0;o=!0,i=2}for(;i<t;){let a=0,c=i;for(;i<t&&nK(e.charCodeAt(i));)i++,a++;if(a===0)return!1;let l=e.charCodeAt(i);if(l===46){if(!Gf(e,c,t))return!1;n+=2,i=t;break}if(a>4)return!1;if(n++,i===t)break;if(l!==58)return!1;if(i++,e.charCodeAt(i)===58){if(o||e.charCodeAt(i+1)===58)return!1;if(o=!0,i++,i===t)break}}return o?n<=7:n===8}function KC(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function Xu(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 t=e.indexOf(":");return t>0&&/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e.substring(0,t))?KC(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&t===-1?!1:KC(e)}function Ju(e){try{return new URL(e),!0}catch{return!1}}var oK=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function el(e){return oK.test(e)}var iK=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function tl(e){return iK.test(e)}function rl(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}var aK=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function nl(e){return aK.test(e)}var sK=/^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;function ol(e){return sK.test(e)}var cK=/^(?:(?:[^\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 il(e){return cK.test(e)}function zC(e){return e>=97&&e<=122||e>=65&&e<=90}function YC(e){return zC(e)||e>=48&&e<=57}function al(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function pK(e){return YC(e)||e===43||e===45||e===46}function $f(e){return YC(e)||e===45||e===46||e===95||e===126}function Ff(e){return e===33||e===36||e===38||e===39||e===40||e===41||e===42||e===43||e===44||e===59||e===61}function uK(e){return $f(e)||Ff(e)||e===58||e===64}function sl(e){let t=e.length;if(t===0||!zC(e.charCodeAt(0)))return!1;let n=1;for(;n<t;){let o=e.charCodeAt(n);if(o===58)break;if(!pK(o))return!1;n++}if(e.charCodeAt(n)!==58)return!1;if(n++,e.charCodeAt(n)===47&&e.charCodeAt(n+1)===47){n+=2;let o=n,i=-1;for(let a=n;a<t;a++){let c=e.charCodeAt(a);if(c===64){i=a;break}if(c===47||c===63||c===35)break}if(i!==-1){for(let a=o;a<i;a++){let c=e.charCodeAt(a);if(c===91||c===93)return!1;if(c===37){if(a+2>=i||!al(e.charCodeAt(a+1))||!al(e.charCodeAt(a+2)))return!1;a+=2}else if(!$f(c)&&!Ff(c)&&c!==58)return!1}n=i+1}if(e.charCodeAt(n)===91){for(n++;n<t&&e.charCodeAt(n)!==93;)n++;if(e.charCodeAt(n)!==93)return!1;n++}else for(;n<t;){let a=e.charCodeAt(n);if(a===47||a===63||a===35||a===58)break;if(a<128&&!$f(a)&&!Ff(a))return!1;n++}if(e.charCodeAt(n)===58)for(n++;n<t;){let a=e.charCodeAt(n);if(a===47||a===63||a===35)break;if(a<48||a>57)return!1;n++}}for(;n<t;){let o=e.charCodeAt(n);if(o===37){if(n+2>=t||!al(e.charCodeAt(n+1))||!al(e.charCodeAt(n+2)))return!1;n+=2}else{if(o>127)return!1;if(!(uK(o)||o===47||o===63||o===35))return!1}n++}return!0}var lK=/^(?: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 cl(e){return lK.test(e)}var mK=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function pl(e){return mK.test(e)}var Ce=new Map;function VC(){Ce.clear()}function dK(){return[...Ce.entries()]}function fK(e,t){Ce.set(e,t)}function gK(e){return Ce.has(e)}function hK(e){return Ce.get(e)}function yK(e,t){return Ce.get(e)?.(t)??!0}function QC(){VC(),Ce.set("date-time",Bu),Ce.set("date",Ni),Ce.set("duration",Hu),Ce.set("email",Ku),Ce.set("hostname",Yu),Ce.set("idn-email",Vu),Ce.set("idn-hostname",Qu),Ce.set("ipv4",Wu),Ce.set("ipv6",Zu),Ce.set("iri-reference",Xu),Ce.set("iri",Ju),Ce.set("json-pointer-uri-fragment",el),Ce.set("json-pointer",tl),Ce.set("regex",rl),Ce.set("relative-json-pointer",nl),Ce.set("time",Li),Ce.set("uri-reference",ol),Ce.set("uri-template",il),Ce.set("uri",sl),Ce.set("url",cl),Ce.set("uuid",pl)}QC();function jf(e,t,n,o){return ki.Test(n.format,o)}function WC(e,t,n,o,i,a){return jf(e,t,i,a)||t.AddError({keyword:"format",schemaPath:n,instancePath:o,params:{format:i.format}})}function ZC(e,t,n,o){let i=xf(n)?n.then:!0,a=lf(n)?n.else:!0;return oe(e,t,n.if,o)?oe(e,t,i,o):oe(e,t,a,o)}function XC(e,t,n,o,i,a){let c=xf(i)?i.then:!0,l=lf(i)?i.else:!0,m=new ut,f=be(e,m,`${n}/if`,o,i.if,a)?be(e,m,`${n}/then`,o,c,a)||t.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"then"}}):be(e,t,`${n}/else`,o,l,a)||t.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"else"}});return f&&t.Merge([m]),f}function TK(e,t,n,o){return s.Every(n.items,0,(i,a)=>s.IsLessEqualThan(o.length,a)||Qt(e,t,i,o[a])&&t.AddIndex(a))}function EK(e,t,n,o,i,a){return s.EveryAll(i.items,0,(c,l)=>{let m=`${n}/items/${l}`,f=`${o}/${l}`;return s.IsLessEqualThan(a.length,l)||Wt(e,t,m,f,c,a[l])&&t.AddIndex(l)})}function _K(e,t,n,o){let i=Ui(n)?n.prefixItems.length:0;return s.Every(o,i,(a,c)=>Qt(e,t,n.items,a)&&t.AddIndex(c))}function IK(e,t,n,o,i,a){let c=Ui(i)?i.prefixItems.length:0;return s.EveryAll(a,c,(l,m)=>{let f=`${n}/items`,h=`${o}/${m}`;return Wt(e,t,f,h,i.items,l)&&t.AddIndex(m)})}function JC(e,t,n,o){return gf(n)?TK(e,t,n,o):_K(e,t,n,o)}function eP(e,t,n,o,i,a){return gf(i)?EK(e,t,n,o,i,a):IK(e,t,n,o,i,a)}function SK(e){return So(e)}function qf(e,t,n,o){if(!SK(n))return!0;let i=s.Counted(o,a=>oe(e,t,n.contains,a));return s.IsLessEqualThan(i,n.maxContains)}function tP(e,t,n,o,i,a){let c=bo(i)?i.minContains:1;return qf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:c,maxContains:i.maxContains}})}function Bf(e,t,n,o){return s.IsLessEqualThan(o,n.maximum)}function rP(e,t,n,o,i,a){return Bf(e,t,i,a)||t.AddError({keyword:"maximum",schemaPath:n,instancePath:o,params:{comparison:"<=",limit:i.maximum}})}function Hf(e,t,n,o){return s.IsLessEqualThan(o.length,n.maxItems)}function nP(e,t,n,o,i,a){return Hf(e,t,i,a)||t.AddError({keyword:"maxItems",schemaPath:n,instancePath:o,params:{limit:i.maxItems}})}function Kf(e,t,n,o){return s.IsMaxLength(o,n.maxLength)}function oP(e,t,n,o,i,a){return Kf(e,t,i,a)||t.AddError({keyword:"maxLength",schemaPath:n,instancePath:o,params:{limit:i.maxLength}})}function zf(e,t,n,o){return s.IsLessEqualThan(s.Keys(o).length,n.maxProperties)}function iP(e,t,n,o,i,a){return zf(e,t,i,a)||t.AddError({keyword:"maxProperties",schemaPath:n,instancePath:o,params:{limit:i.maxProperties}})}function bK(e){return So(e)}function Yf(e,t,n,o){if(!bK(n))return!0;let i=s.Counted(o,(a,c)=>oe(e,t,n.contains,a)&&t.AddIndex(c));return s.IsGreaterEqualThan(i,n.minContains)}function aP(e,t,n,o,i,a){return Yf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:i.minContains}})}function Vf(e,t,n,o){return s.IsGreaterEqualThan(o,n.minimum)}function sP(e,t,n,o,i,a){return Vf(e,t,i,a)||t.AddError({keyword:"minimum",schemaPath:n,instancePath:o,params:{comparison:">=",limit:i.minimum}})}function Qf(e,t,n,o){return s.IsGreaterEqualThan(o.length,n.minItems)}function cP(e,t,n,o,i,a){return Qf(e,t,i,a)||t.AddError({keyword:"minItems",schemaPath:n,instancePath:o,params:{limit:i.minItems}})}function Wf(e,t,n,o){return s.IsMinLength(o,n.minLength)}function pP(e,t,n,o,i,a){return Wf(e,t,i,a)||t.AddError({keyword:"minLength",schemaPath:n,instancePath:o,params:{limit:i.minLength}})}function Zf(e,t,n,o){return s.IsGreaterEqualThan(s.Keys(o).length,n.minProperties)}function uP(e,t,n,o,i,a){return Zf(e,t,i,a)||t.AddError({keyword:"minProperties",schemaPath:n,instancePath:o,params:{limit:i.minProperties}})}function Xf(e,t,n,o){return s.IsMultipleOf(o,n.multipleOf)}function lP(e,t,n,o,i,a){return Xf(e,t,i,a)||t.AddError({keyword:"multipleOf",schemaPath:n,instancePath:o,params:{multipleOf:i.multipleOf}})}function Jf(e,t,n,o){let i=new Rt;return!oe(e,i,n.not,o)&&t.Merge([i])}function mP(e,t,n,o,i,a){return Jf(e,t,i,a)||t.AddError({keyword:"not",schemaPath:n,instancePath:o,params:{}})}function dP(e,t,n,o){let i=n.oneOf.reduce((a,c)=>{let l=new Rt;return oe(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,1)&&t.Merge(i)}function fP(e,t,n,o,i,a){let c=[],l=[],m=i.oneOf.reduce((h,E,I)=>{let g=new ut,T=`${n}/oneOf/${I}`,O=be(e,g,T,o,E,a);return O&&l.push(I),O||c.push(g),O?[...h,g]:h},[]),f=s.IsEqual(m.length,1)&&t.Merge(m);return!f&&s.IsEqual(l.length,0)&&c.forEach(h=>h.GetErrors().forEach(E=>t.AddError(E))),f||t.AddError({keyword:"oneOf",schemaPath:n,instancePath:o,params:{passingSchemas:l}})}function eg(e,t,n,o){return(s.IsString(n.pattern)?new RegExp(n.pattern,"u"):n.pattern).test(o)}function gP(e,t,n,o,i,a){return eg(e,t,i,a)||t.AddError({keyword:"pattern",schemaPath:n,instancePath:o,params:{pattern:i.pattern}})}function hP(e,t,n,o){return s.Every(s.Entries(n.patternProperties),0,([i,a])=>{let c=new RegExp(i,"u");return s.Every(s.Entries(o),0,([l,m])=>!c.test(l)||Qt(e,t,a,m)&&t.AddKey(l))})}function yP(e,t,n,o,i,a){return s.EveryAll(s.Entries(i.patternProperties),0,([c,l])=>{let m=`${n}/patternProperties/${c}`,f=new RegExp(c,"u");return s.EveryAll(s.Entries(a),0,([h,E])=>{let I=`${o}/${h}`;return!f.test(h)||Wt(e,t,m,I,l,E)&&t.AddKey(h)})})}function TP(e,t,n,o){return s.IsEqual(o.length,0)||s.Every(n.prefixItems,0,(i,a)=>s.IsLessEqualThan(o.length,a)||Qt(e,t,i,o[a])&&t.AddIndex(a))}function EP(e,t,n,o,i,a){return s.IsEqual(a.length,0)||s.EveryAll(i.prefixItems,0,(c,l)=>{let m=`${n}/prefixItems/${l}`,f=`${o}/${l}`;return s.IsLessEqualThan(a.length,l)||Wt(e,t,m,f,c,a[l])&&t.AddIndex(l)})}function tg(e,t){return e.includes(t)||at.Get().exactOptionalPropertyTypes}function rg(e,t){return s.IsUndefined(e[t])}function _P(e,t,n,o){let i=Oo(n)?n.required:[];return s.Every(s.Entries(n.properties),0,([c,l])=>{let m=!s.HasPropertyKey(o,c)||Qt(e,t,l,o[c])&&t.AddKey(c);return tg(i,c)?m:rg(o,c)||m})}function IP(e,t,n,o,i,a){let c=Oo(i)?i.required:[];return s.EveryAll(s.Entries(i.properties),0,([m,f])=>{let h=`${n}/properties/${m}`,E=`${o}/${m}`,I=()=>!s.HasPropertyKey(a,m)||Wt(e,t,h,E,f,a[m])&&t.AddKey(m);return tg(c,m)?I():rg(a,m)||I()})}function SP(e,t,n,o){return s.Every(s.Keys(o),0,(i,a)=>oe(e,t,n.propertyNames,i))}function bP(e,t,n,o,i,a){let c=[];return s.EveryAll(s.Keys(a),0,(m,f)=>{let h=`${o}/${m}`,E=`${n}/propertyNames`,I=new ut,g=be(e,I,E,h,i.propertyNames,m);return g||c.push(m),g})||t.AddError({keyword:"propertyNames",schemaPath:n,instancePath:o,params:{propertyNames:c}})}function OP(e,t,n,o){let i=e.RecursiveRef(n)??!1;return j(i)&&oe(e,t,i,o)}function AP(e,t,n,o,i,a){let c=e.RecursiveRef(i)??!1;return j(c)&&be(e,t,"#",o,c,a)}function xP(e,t,n,o){let i=e.Ref(n)??!1,a=new Rt,c=j(i)&&oe(e,a,i,o);return c&&t.Merge([a]),c}function RP(e,t,n,o,i,a){let c=e.Ref(i)??!1,l=new ut,m=j(c)&&be(e,l,"#",o,c,a);return m&&t.Merge([l]),m||l.GetErrors().forEach(f=>t.AddError(f)),m}function CP(e,t,n,o){return s.Every(n.required,0,i=>s.HasPropertyKey(o,i))}function PP(e,t,n,o,i,a){let c=[];return s.EveryAll(i.required,0,m=>{let f=s.HasPropertyKey(a,m);return f||c.push(m),f})||t.AddError({keyword:"required",schemaPath:n,instancePath:o,params:{requiredProperties:c}})}function ng(e,t,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,"bigint")?s.IsBigInt(i):s.IsEqual(n,"constructor")?s.IsConstructor(i):s.IsEqual(n,"function")?s.IsFunction(i):s.IsEqual(n,"symbol")?s.IsSymbol(i):s.IsEqual(n,"undefined")?s.IsUndefined(i):s.IsEqual(n,"void")?s.IsUndefined(i):!0}function UP(e,t,n,o,i){return s.Some(n,a=>ng(e,t,a,o,i))}function wP(e,t,n,o){return s.IsArray(n.type)?UP(e,t,n.type,n,o):ng(e,t,n.type,n,o)}function vP(e,t,n,o,i,a){return(s.IsArray(i.type)?UP(e,t,i.type,i,a):ng(e,t,i.type,i,a))||t.AddError({keyword:"type",schemaPath:n,instancePath:o,params:{type:i.type}})}function NP(e,t,n,o){let i=t.GetIndices();return s.Every(o,0,(a,c)=>(i.has(c)||oe(e,t,n.unevaluatedItems,a))&&t.AddIndex(c))}function LP(e,t,n,o,i,a){let c=t.GetIndices(),l=[];return s.EveryAll(a,0,(f,h)=>{let E=new ut,I=(c.has(h)||be(e,E,n,o,i.unevaluatedItems,f))&&t.AddIndex(h);return I||l.push(h),I})||t.AddError({keyword:"unevaluatedItems",schemaPath:n,instancePath:o,params:{unevaluatedItems:l}})}function kP(e,t,n,o){let i=t.GetKeys();return s.Every(s.Entries(o),0,([a,c])=>i.has(a)||oe(e,t,n.unevaluatedProperties,c)&&t.AddKey(a))}function MP(e,t,n,o,i,a){let c=t.GetKeys(),l=[];return s.EveryAll(s.Entries(a),0,([f,h])=>{let E=new ut,I=c.has(f)||be(e,E,n,o,i.unevaluatedProperties,h)&&t.AddKey(f);return I||l.push(f),I})||t.AddError({keyword:"unevaluatedProperties",schemaPath:n,instancePath:o,params:{unevaluatedProperties:l}})}function DP(e){return!s.IsEqual(e.uniqueItems,!1)}function GP(e,t,n,o){if(!DP(n))return!0;let i=new Set(o.map(eo.Hash)).size,a=o.length;return s.IsEqual(i,a)}function $P(e,t,n,o,i,a){if(!DP(i))return!0;let c=new Set,l=a.reduce((f,h,E)=>{let I=eo.Hash(h);return c.has(I)?[...f,E]:(c.add(I),f)},[]);return s.IsEqual(l.length,0)||t.AddError({keyword:"uniqueItems",schemaPath:n,instancePath:o,params:{duplicateItems:l}})}function Qt(e,t,n,o){return t.Push()&&oe(e,t,n,o)&&t.Pop()}function oe(e,t,n,o){e.Push(n);let i=Gu(n)?Pf(e,t,n,o):(!Rf(n)||wP(e,t,n,o))&&(!(s.IsObject(o)&&!s.IsArray(o))||(!Oo(n)||CP(e,t,n,o))&&(!Wr(n)||TC(e,t,n,o))&&(!sf(n)||RC(e,t,n,o))&&(!cf(n)||PC(e,t,n,o))&&(!pf(n)||wC(e,t,n,o))&&(!vs(n)||hP(e,t,n,o))&&(!Ns(n)||_P(e,t,n,o))&&(!bf(n)||SP(e,t,n,o))&&(!Us(n)||Zf(e,t,n,o))&&(!Ef(n)||zf(e,t,n,o)))&&(!s.IsArray(o)||(!rf(n)||gC(e,t,n,o))&&(!So(n)||wf(e,t,n,o))&&(!Ci(n)||JC(e,t,n,o))&&(!yf(n)||qf(e,t,n,o))&&(!$u(n)||Hf(e,t,n,o))&&(!bo(n)||Yf(e,t,n,o))&&(!Pi(n)||Qf(e,t,n,o))&&(!Ui(n)||TP(e,t,n,o))&&(!wi(n)||GP(e,t,n,o)))&&(!s.IsString(o)||(!Tf(n)||Kf(e,t,n,o))&&(!Ps(n)||Wf(e,t,n,o))&&(!Cs(n)||jf(e,t,n,o))&&(!ws(n)||eg(e,t,n,o)))&&(!(s.IsNumber(o)||s.IsBigInt(o))||(!df(n)||kf(e,t,n,o))&&(!Zr(n)||Mf(e,t,n,o))&&(!hf(n)||Bf(e,t,n,o))&&(!Jr(n)||Vf(e,t,n,o))&&(!_f(n)||Xf(e,t,n,o)))&&(!Af(n)||xP(e,t,n,o))&&(!Of(n)||OP(e,t,n,o))&&(!uf(n)||NC(e,t,n,o))&&(!af(n)||Uf(e,t,n,o))&&(!mf(n)||Lf(e,t,n,o))&&(!ff(n)||ZC(e,t,n,o))&&(!If(n)||Jf(e,t,n,o))&&(!nf(n)||_C(e,t,n,o))&&(!of(n)||SC(e,t,n,o))&&(!Sf(n)||dP(e,t,n,o))&&(!ju(n)||!s.IsArray(o)||NP(e,t,n,o))&&(!qu(n)||!s.IsObject(o)||kP(e,t,n,o))&&(!tf(n)||mC(e,t,n,o));return e.Pop(n),i}function Wt(e,t,n,o,i,a){return t.Push()&&be(e,t,n,o,i,a)&&t.Pop()}function be(e,t,n,o,i,a){e.Push(i);let c=Gu(i)?OC(e,t,n,o,i,a):!!(+(!Rf(i)||vP(e,t,n,o,i,a))&+(!(s.IsObject(a)&&!s.IsArray(a))||!!(+(!Oo(i)||PP(e,t,n,o,i,a))&+(!Wr(i)||EC(e,t,n,o,i,a))&+(!sf(i)||CC(e,t,n,o,i,a))&+(!cf(i)||UC(e,t,n,o,i,a))&+(!pf(i)||vC(e,t,n,o,i,a))&+(!vs(i)||yP(e,t,n,o,i,a))&+(!Ns(i)||IP(e,t,n,o,i,a))&+(!bf(i)||bP(e,t,n,o,i,a))&+(!Us(i)||uP(e,t,n,o,i,a))&+(!Ef(i)||iP(e,t,n,o,i,a))))&+(!s.IsArray(a)||!!(+(!rf(i)||hC(e,t,n,o,i,a))&+(!So(i)||xC(e,t,n,o,i,a))&+(!Ci(i)||eP(e,t,n,o,i,a))&+(!yf(i)||tP(e,t,n,o,i,a))&+(!$u(i)||nP(e,t,n,o,i,a))&+(!bo(i)||aP(e,t,n,o,i,a))&+(!Pi(i)||cP(e,t,n,o,i,a))&+(!Ui(i)||EP(e,t,n,o,i,a))&+(!wi(i)||$P(e,t,n,o,i,a))))&+(!s.IsString(a)||!!(+(!Tf(i)||oP(e,t,n,o,i,a))&+(!Ps(i)||pP(e,t,n,o,i,a))&+(!Cs(i)||WC(e,t,n,o,i,a))&+(!ws(i)||gP(e,t,n,o,i,a))))&+(!(s.IsNumber(a)||s.IsBigInt(a))||!!(+(!df(i)||MC(e,t,n,o,i,a))&+(!Zr(i)||DC(e,t,n,o,i,a))&+(!hf(i)||rP(e,t,n,o,i,a))&+(!Jr(i)||sP(e,t,n,o,i,a))&+(!_f(i)||lP(e,t,n,o,i,a))))&+(!Af(i)||RP(e,t,n,o,i,a))&+(!Of(i)||AP(e,t,n,o,i,a))&+(!uf(i)||LC(e,t,n,o,i,a))&+(!af(i)||AC(e,t,n,o,i,a))&+(!mf(i)||kC(e,t,n,o,i,a))&+(!ff(i)||XC(e,t,n,o,i,a))&+(!If(i)||mP(e,t,n,o,i,a))&+(!nf(i)||IC(e,t,n,o,i,a))&+(!of(i)||bC(e,t,n,o,i,a))&+(!Sf(i)||fP(e,t,n,o,i,a))&+(!ju(i)||!s.IsArray(a)||LP(e,t,n,o,i,a))&+(!qu(i)||!s.IsObject(a)||MP(e,t,n,o,i,a)))&&(!tf(i)||dC(e,t,n,o,i,a));return e.Pop(i),c}var Ln={};Zt(Ln,{DynamicRef:()=>GK,Ref:()=>ig});var Mi={};Zt(Mi,{Delete:()=>wK,Get:()=>PK,Has:()=>CK,Indices:()=>Ds,Set:()=>UK});function FP(e){if(e.length===0)throw Error("Cannot set root")}function jP(e){if(!s.IsObject(e))throw Error("Cannot set value")}function OK(e){if(s.IsUnsafePropertyKey(e))throw Error("Pointer contains unsafe property key")}function qP(e){for(let t of e)OK(t)}function AK(e){return/^(0|[1-9]\d*)$/.test(e)}function BP(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function xK(e,t){return s.IsObject(t)&&s.HasPropertyKey(t,e)}function RK(e,t){return s.IsObject(t)&&!s.IsUnsafePropertyKey(e)?t[e]:void 0}function og(e,t){return e.reduce((n,o)=>RK(o,n),t)}function Ds(e){if(s.IsEqual(e.length,0))return[];let t=e.split("/").map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"));return t.length>0&&t[0]===""?t.slice(1):t}function CK(e,t){let n=e;return Ds(t).every(o=>xK(o,n)?(n=n[o],!0):!1)}function PK(e,t){let n=Ds(t);return og(n,e)}function UK(e,t,n){let o=Ds(t);FP(o),qP(o);let[i,a]=BP(o),c=og(i,e);return jP(c),c[a]=n,e}function wK(e,t){let n=Ds(t);FP(n),qP(n);let[o,i]=BP(n),a=og(o,e);return jP(a),s.IsArray(a)&&AK(i)?a.splice(+i,1):delete a[i],e}function vK(e,t,n){if(e.$id===n.hash)return e;let o=new URL(e.$id,t.href),i=new URL(n.href,t.href);if(s.IsEqual(o.pathname,i.pathname))return n.hash.startsWith("#")?HP(e,t,n):e}function NK(e,t,n){let o=new URL(`#${e.$anchor}`,t.href),i=new URL(n.href,t.href);return s.IsEqual(o.href,i.href)?e:void 0}function LK(e,t,n){let o=new URL(`#${e.$dynamicAnchor}`,t.href),i=new URL(n.href,t.href);return s.IsEqual(o.href,i.href)?e:void 0}function HP(e,t,n){if(n.href.endsWith("#"))return e;if(!n.hash.startsWith("#"))return;let o=decodeURIComponent(n.hash.slice(1));if(o.startsWith("/"))return Mi.Get(e,o)}function kK(e,t,n){if(Xr(e)){let o=vK(e,t,n);if(!s.IsUndefined(o))return o}if(Rs(e)){let o=NK(e,t,n);if(!s.IsUndefined(o))return o}if(Nn(e)){let o=LK(e,t,n);if(!s.IsUndefined(o))return o}return HP(e,t,n)}function MK(e,t,n){return e.reduce((o,i)=>{let a=ag(i,t,n);return s.IsUndefined(a)?o:a},void 0)}function DK(e,t,n){return s.Keys(e).reduce((o,i)=>{let a=ag(e[i],t,n);return s.IsUndefined(a)?o:a},void 0)}function ag(e,t,n){let o=gr(e)&&Xr(e)?new URL(e.$id,t.href):t;if(gr(e)){let i=kK(e,o,n);if(!s.IsUndefined(i))return i}if(s.IsArray(e))return MK(e,o,n);if(s.IsObject(e))return DK(e,o,n)}function ig(e,t){let n=new URL("http://unknown/"),o=Xr(e)?new URL(e.$id,n.href):n,i=new URL(t,o.href);return ag(e,o,i)}function GK(e,t,n,o){let i=n.$dynamicRef.startsWith("#")?ig(t,n.$dynamicRef):ig(e,n.$dynamicRef);return s.IsUndefined(i)?void 0:!gr(i)||!Nn(i)||new URL(n.$dynamicRef,"http://unknown/").hash.startsWith("#/")?i:o.find(l=>l.$dynamicAnchor===i.$dynamicAnchor)??i}var Di=function(e,t,n,o){if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?o:n==="a"?o.call(e):o?o.value:t.get(e)},kn,KP,zP,YP,VP,xo=class{constructor(t,n){kn.add(this),this.context=t,this.schema=n,this.ids=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[]}BaseURL(){return this.ids.reduce((t,n)=>new URL(n.$id,t),new URL("http://unknown"))}Base(){return this.ids[this.ids.length-1]??this.schema}Push(t){gr(t)&&(Xr(t)&&(this.ids.push(t),Di(this,kn,"m",KP).call(this,t)),Rs(t)&&this.anchors.push(t),Fu(t)&&this.recursiveAnchors.push(t),Nn(t)&&this.dynamicAnchors.push(t))}Pop(t){gr(t)&&(Xr(t)&&(this.ids.pop(),Di(this,kn,"m",zP).call(this,t)),Rs(t)&&this.anchors.pop(),Fu(t)&&this.recursiveAnchors.pop(),Nn(t)&&this.dynamicAnchors.pop())}Ref(t){return Di(this,kn,"m",YP).call(this,t)??Di(this,kn,"m",VP).call(this,t)}RecursiveRef(t){return Fu(this.Base())?Ln.Ref(this.recursiveAnchors[0],t.$recursiveRef):Ln.Ref(this.Base(),t.$recursiveRef)}DynamicRef(t){let n=this.schema;return Ln.DynamicRef(n,this.Base(),t,this.dynamicAnchors)}};kn=new WeakSet,KP=function e(t,n=!0){if(!gr(t))return;let o=t;if(!(!n&&Xr(o))){!n&&Nn(o)&&this.dynamicAnchors.push(o);for(let i of s.Keys(o))Di(this,kn,"m",e).call(this,o[i],!1)}},zP=function e(t,n=!0){if(!gr(t))return;let o=t;if(!(!n&&Xr(o))){!n&&Nn(o)&&this.dynamicAnchors.pop();for(let i of s.Keys(o))Di(this,kn,"m",e).call(this,o[i],!1)}},YP=function(t){return s.HasPropertyKey(this.context,t.$ref)?this.context[t.$ref]:void 0},VP=function(t){let n=this.schema;return t.$ref.startsWith("#")?Ln.Ref(this.Base(),t.$ref):Ln.Ref(n,t.$ref)};function ul(...e){let[t,n,o]=ie.Match(e,{3:(h,E,I)=>[h,E,I],2:(h,E)=>[{},h,E]}),i=at.Get(),a=wT(),c=[],l=new xo(t,n),m=new Ls(h=>{if(!s.IsGreaterEqualThan(c.length,i.maxErrors))return c.push({...h,message:a(h)})});return[be(l,m,"#","",n,o),c]}function cg(...e){let[t,n,o]=ie.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),i=new xo(t,n),a=new Rt;return oe(i,a,n,o)}function ye(...e){let[t,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return cg(t,n,o)}function Mn(...e){let[t,n,o]=ie.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),[i,a]=ul(t,n,o);return a}var Dn=class extends Error{constructor(t,n,o){super(t),Object.defineProperty(this,"cause",{value:{source:t,errors:o,value:n},writable:!1,configurable:!1,enumerable:!1})}};function QP(e,t,n){return s.IsArray(n)?n.map(o=>lt(e,t.items,o)):n}function WP(e,t,n){return lt({...e,...t.$defs},st(t.$ref),n)}function jK(e,t){let n=s.HasPropertyKey(t,"unevaluatedProperties")?{additionalProperties:t.unevaluatedProperties}:{},o=Jt(e,t),i=yt(o);return $(i)?tu(i,n):i}function ZP(e,t,n){let o=jK(e,t);return lt(e,o,n)}function ll(e){return s.HasPropertyKey(e,"additionalProperties")?e.additionalProperties:void 0}function XP(e,t,n){if(!s.IsObject(n)||s.IsArray(n))return n;let o=ll(t);for(let i of s.Keys(n)){if(s.HasPropertyKey(t.properties,i)){n[i]=lt(e,t.properties[i],n[i]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||Le(o)&&ye(e,o,n[i])){n[i]=lt(e,o,n[i]);continue}delete n[i]}return n}function JP(e,t,n){if(!s.IsObject(n))return n;let o=ll(t),[i,a]=[new RegExp(pt(t)),xe(t)];for(let c of s.Keys(n)){if(i.test(c)){n[c]=lt(e,a,n[c]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||Le(o)&&ye(e,o,n[c])){n[c]=lt(e,o,n[c]);continue}delete n[c]}return n}function eU(e,t,n){return s.HasPropertyKey(e,t.$ref)?lt(e,e[t.$ref],n):n}function tU(e,t,n){if(!s.IsArray(n))return n;let o=Math.min(n.length,t.items.length);for(let i=0;i<o;i++)n[i]=lt(e,t.items[i],n[i]);return s.IsGreaterThan(n.length,o)?n.slice(0,o):n}function Be(e){return Zn(e)}function rU(e,t,n){for(let o of t.anyOf){let i=lt(e,o,Be(n));if(ye(e,o,i))return i}return n}function lt(e,t,n){return X(t)?QP(e,t,n):Ee(t)?WP(e,t,n):G(t)?ZP(e,t,n):$(t)?XP(e,t,n):ge(t)?JP(e,t,n):ue(t)?eU(e,t,n):V(t)?tU(e,t,n):C(t)?rU(e,t,n):n}function qK(e,t){for(let n of Wc.Keys(e))Wc.HasPropertyKey(t,n)||(t[n]=e[n]);return t}function BK(e){let t={};for(let n of Wc.Keys(e))t[n]=Gs(e[n]);return t}function HK(e){return pg(IA(e))}function pg(e){return e.map(t=>Gs(t))}function Gs(e){let t=X(e)?vt(Gs(e.items),zo(e)):G(e)?dt(pg(e.allOf)):C(e)?q(HK(e.anyOf)):$(e)?D(BK(e.properties)):ge(e)?ti(hn(e),Gs(xe(e))):V(e)?Fe(pg(e.items)):e;return qK(e,t)}function Gi(e){return Gs(e)}function Nr(...e){let[t,n,o]=ie.Match(e,{3:(a,c,l)=>[a,c,l],2:(a,c)=>[{},a,c]}),i=at.Get().unionPrioritySort?Gi(n):n;return lt(t,i,o)}var ae={};Zt(ae,{Fail:()=>Co,IsOk:()=>ug,Ok:()=>k,TryArray:()=>KK,TryBigInt:()=>lg,TryBoolean:()=>nz,TryNull:()=>cz,TryNumber:()=>mz,TryString:()=>dz,TryUndefined:()=>Tz});function ug(e){return s.IsObject(e)&&s.HasPropertyKey(e,"value")}function k(e){return{value:e}}function Co(){}function KK(e){return s.IsArray(e)?k(e):k([e])}function zK(e){return s.IsEqual(e,!0)?k(BigInt(1)):k(BigInt(0))}var YK=/^-?(0|[1-9]\d*)n$/,VK=/^-?(0|[1-9]\d*)\.\d+$/,QK=/^-?(0|[1-9]\d*)$/;function WK(e){return YK.test(e)}function ZK(e){return VK.test(e)}function XK(e){return QK.test(e)}function JK(e){let t=e.toLowerCase();return WK(e)?k(BigInt(e.slice(0,e.length-1))):ZK(e)?k(BigInt(e.split(".")[0])):XK(e)?k(BigInt(e)):s.IsEqual(t,"false")?k(BigInt(0)):s.IsEqual(t,"true")?k(BigInt(1)):void 0}function lg(e){return s.IsBigInt(e)?k(e):s.IsBoolean(e)?zK(e):s.IsNumber(e)?k(BigInt(Math.trunc(e))):s.IsNull(e)?k(BigInt(0)):s.IsString(e)?JK(e):s.IsUndefined(e)?k(BigInt(0)):void 0}function ez(e){return s.IsEqual(e,BigInt(0))?k(!1):s.IsEqual(e,BigInt(1))?k(!0):void 0}function tz(e){return s.IsEqual(e,0)?k(!1):s.IsEqual(e,1)?k(!0):void 0}function rz(e){return s.IsEqual(e.toLowerCase(),"false")?k(!1):s.IsEqual(e.toLowerCase(),"true")?k(!0):s.IsEqual(e,"0")?k(!1):s.IsEqual(e,"1")?k(!0):void 0}function nz(e){return s.IsBigInt(e)?ez(e):s.IsBoolean(e)?k(e):s.IsNumber(e)?tz(e):s.IsNull(e)?k(!1):s.IsString(e)?rz(e):s.IsUndefined(e)?k(!1):void 0}function oz(e){return s.IsEqual(e,BigInt(0))?k(null):void 0}function iz(e){return s.IsEqual(e,!1)?k(null):void 0}function az(e){return s.IsEqual(e,0)?k(null):void 0}function sz(e){let t=e.toLowerCase();return s.IsEqual(t,"undefined")||s.IsEqual(t,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?k(null):void 0}function cz(e){return s.IsBigInt(e)?oz(e):s.IsBoolean(e)?iz(e):s.IsNumber(e)?az(e):s.IsNull(e)?k(null):s.IsString(e)?sz(e):s.IsUndefined(e)?k(null):void 0}var nU=BigInt(Number.MAX_SAFE_INTEGER),oU=BigInt(Number.MIN_SAFE_INTEGER);function pz(e){return e<=nU&&e>=oU?k(Number(e)):void 0}function uz(e){return k(e?1:0)}function lz(e){let t=+e;if(s.IsNumber(t))return k(t);let n=e.toLowerCase();if(s.IsEqual(n,"false"))return k(0);if(s.IsEqual(n,"true"))return k(1);let o=lg(e);return ug(o)?o.value<=nU&&o.value>=oU?k(Number(o.value)):void 0:void 0}function mz(e){return s.IsBigInt(e)?pz(e):s.IsBoolean(e)?uz(e):s.IsNumber(e)?k(e):s.IsNull(e)?k(0):s.IsString(e)?lz(e):s.IsUndefined(e)?k(0):void 0}function dz(e){return s.IsBigInt(e)?k(e.toString()):s.IsBoolean(e)?k(e.toString()):s.IsNumber(e)?k(e.toString()):s.IsNull(e)?k("null"):s.IsString(e)?k(e):s.IsUndefined(e)?k(""):void 0}function fz(e){return s.IsEqual(e,BigInt(0))?k(void 0):void 0}function gz(e){return s.IsEqual(e,!1)?k(void 0):void 0}function hz(e){return s.IsEqual(e,0)?k(void 0):void 0}function yz(e){let t=e.toLowerCase();return s.IsEqual(t,"undefined")||s.IsEqual(t,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?k(void 0):void 0}function Tz(e){return s.IsBigInt(e)?fz(e):s.IsBoolean(e)?gz(e):s.IsNumber(e)?hz(e):s.IsNull(e)?k(void 0):s.IsString(e)?yz(e):s.IsUndefined(e)?k(e):void 0}function iU(e,t,n){return ae.TryArray(n).value.map(i=>He(e,t.items,i))}function aU(e,t,n){let o=ae.TryBigInt(n);return ae.IsOk(o)?o.value:n}function sU(e,t,n){let o=ae.TryBoolean(n);return ae.IsOk(o)?o.value:n}function cU(e,t,n){return He({...e,...t.$defs},st(t.$ref),n)}function pU(e,t,n){return He(e,yt(t),n)}function uU(e,t,n){let o=ae.TryNumber(n);return ae.IsOk(o)?Math.trunc(o.value):n}function lU(e,t,n){let o=Jt(e,t),i=yt(o);return He(e,i,n)}function Ez(e,t,n){let o=ae.TryBigInt(n);return ae.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function _z(e,t,n){let o=ae.TryBoolean(n);return ae.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function Iz(e,t,n){let o=ae.TryNumber(n);return ae.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function Sz(e,t,n){let o=ae.TryString(n);return ae.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function mU(e,t,n){return s.IsEqual(t.const,n)?n:FT(t)?Ez(e,t,n):jT(t)?_z(e,t,n):ip(t)?Iz(e,t,n):ap(t)?Sz(e,t,n):he()}function dU(e,t,n){let o=ae.TryNull(n);return ae.IsOk(o)?o.value:n}function fU(e,t,n){let o=ae.TryNumber(n);return ae.IsOk(o)?o.value:n}function ml(e,t,n,o){let i=s.Keys(o);for(let[a,c]of t)for(let l of i)a.test(l)||(o[l]=He(e,n,o[l]));return o}function $s(e,t,n){return nt(e)&&s.IsUndefined(n[t])}function bz(e,t,n){let o=s.EntriesRegExp(t.properties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)!a.test(l)||$s(c,l,n)||(n[l]=He(e,c,n[l]));return s.HasPropertyKey(t,"additionalProperties")&&s.IsObject(t.additionalProperties)?ml(e,o,t.additionalProperties,n):n}function gU(e,t,n){return s.IsObjectNotArray(n)?bz(e,t,n):n}function Oz(e,t,n){let o=s.EntriesRegExp(t.patternProperties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)a.test(l)&&(n[l]=He(e,c,n[l]));return s.HasPropertyKey(t,"additionalProperties")&&s.IsObject(t.additionalProperties)?ml(e,o,t.additionalProperties,n):n}function hU(e,t,n){return s.IsObjectNotArray(n)?Oz(e,t,n):n}function yU(e,t,n){return s.HasPropertyKey(e,t.$ref)?He(e,e[t.$ref],n):n}function TU(e,t,n){let o=ae.TryString(n);return ae.IsOk(o)?o.value:n}function EU(e,t,n){return He(e,yt(t),n)}function _U(e,t,n){if(!s.IsArray(n))return n;for(let o=0;o<Math.min(t.items.length,n.length);o++)n[o]=He(e,t.items[o],n[o]);return n}function IU(e,t,n){let o=ae.TryUndefined(n);return ae.IsOk(o)?o.value:n}function SU(e,t,n){if(t.anyOf.some(c=>ye(e,c,n)))return n;let a=t.anyOf.map(c=>He(e,c,Be(n))).find(c=>ye(e,t,c));return s.IsUndefined(a)?n:a}function bU(e,t,n){let o=ae.TryUndefined(n);return ae.IsOk(o)?void 0:n}function He(e,t,n){return X(t)?iU(e,t,n):kt(t)?aU(e,t,n):Ot(t)?sU(e,t,n):Ee(t)?cU(e,t,n):We(t)?pU(e,t,n):ct(t)?uU(e,t,n):G(t)?lU(e,t,n):W(t)?mU(e,t,n):Ar(t)?dU(e,t,n):we(t)?fU(e,t,n):$(t)?gU(e,t,n):ge(t)?hU(e,t,n):ue(t)?yU(e,t,n):tt(t)?TU(e,t,n):_e(t)?EU(e,t,n):V(t)?_U(e,t,n):dr(t)?IU(e,t,n):C(t)?SU(e,t,n):Gt(t)?bU(e,t,n):n}function Gn(...e){let[t,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return He(t,n,o)}function OU(e,t,n){if(!s.IsArray(n))return n;for(let o=0;o<n.length;o++)n[o]=mt(e,t.items,n[o]);return n}function AU(e,t,n){return mt({...e,...t.$defs},st(t.$ref),n)}function xU(e,t){return s.IsUndefined(t)?s.IsFunction(e.default)?e.default():Be(e.default):t}function RU(e,t,n){let o=Jt(e,t),i=yt(o);return mt(e,i,n)}function CU(e,t,n){if(!s.IsObject(n))return n;let o=s.Keys(t.properties);for(let i of o){let a=mt(e,t.properties[i],n[i]);s.IsUndefined(a)&&(nt(t.properties[i])||!s.HasPropertyKey(t.properties[i],"default"))||(n[i]=a)}if(!Wr(t)||s.IsBoolean(t.additionalProperties))return n;for(let i of s.Keys(n))o.includes(i)||(n[i]=mt(e,t.additionalProperties,n[i]));return n}function PU(e,t,n){if(!s.IsObject(n))return n;let[o,i]=[new RegExp(pt(t)),xe(t)];for(let a of s.Keys(n))o.test(a)&&Vt(i)&&(n[a]=mt(e,i,n[a]));if(!Wr(t))return n;for(let a of s.Keys(n))o.test(a)||(n[a]=mt(e,t.additionalProperties,n[a]));return n}function UU(e,t,n){return s.HasPropertyKey(e,t.$ref)?mt(e,e[t.$ref],n):n}function wU(e,t,n){if(!s.IsArray(n))return n;let[o,i]=[t.items,Math.max(t.items.length,n.length)];for(let a=0;a<i;a++)a<o.length&&(n[a]=mt(e,o[a],n[a]));return n}function vU(e,t,n){for(let o of t.anyOf){let i=mt(e,o,Be(n));if(ye(e,o,i))return i}return n}function mt(e,t,n){let o=Vt(t)?xU(t,n):n;return X(t)?OU(e,t,o):Ee(t)?AU(e,t,o):G(t)?RU(e,t,o):$(t)?CU(e,t,o):ge(t)?PU(e,t,o):ue(t)?UU(e,t,o):V(t)?wU(e,t,o):C(t)?vU(e,t,o):o}function Po(...e){let[t,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return mt(t,n,o)}function $i(e){return(...t)=>{let[n,o,i]=ie.Match(t,{3:(a,c,l)=>[a,c,l],2:(a,c)=>[{},a,c]});return e.reduce((a,c)=>c(n,o,a),i)}}function Az(e,t,n){return t["~codec"].decode(n)}function xz(e,t,n){return t["~codec"].encode(n)}function Pe(e,t,n,o){return to(n)?s.IsEqual(e,"Decode")?Az(t,n,o):xz(t,n,o):o}function Rz(e,t,n,o){if(!s.IsArray(o))return o;for(let i=0;i<o.length;i++)o[i]=Ne(e,t,n.items,o[i]);return Pe(e,t,n,o)}function Cz(e,t,n,o){let i=Pe(e,t,n,o);if(!s.IsArray(i))return i;for(let a=0;a<i.length;a++)i[a]=Ne(e,t,n.items,i[a]);return i}function NU(e,t,n,o){return s.IsEqual(e,"Decode")?Rz(e,t,n,o):Cz(e,t,n,o)}function LU(e,t,n,o){return o=Ne(e,{...t,...n.$defs},st(n.$ref),o),Pe(e,t,n,o)}function kU(e){return e.reduce((t,n)=>({...t,...n}),{})}function MU(e,t){for(let n of t)if(!s.IsDeepEqual(e,n))return n;return e}function Pz(e,t,n,o){if(s.IsEqual(n.allOf.length,0))return Pe(e,t,n,o);let i=n.allOf.map(l=>Ne(e,t,l,Nr(l,Be(o)))),c=i.every(l=>s.IsObject(l))?kU(i):MU(o,i);return Pe(e,t,n,c)}function Uz(e,t,n,o){if(s.IsEqual(n.allOf.length,0))return Pe(e,t,n,o);let i=Pe(e,t,n,o),a=n.allOf.map(l=>Ne(e,t,l,Nr(l,Be(i))));return a.every(l=>s.IsObject(l))?kU(a):MU(i,a)}function DU(e,t,n,o){return s.IsEqual(e,"Decode")?Pz(e,t,n,o):Uz(e,t,n,o)}function wz(e,t,n,o){if(!s.IsObjectNotArray(o))return o;for(let i of s.Keys(n.properties))!s.HasPropertyKey(o,i)||$s(n.properties[i],i,o)||(o[i]=Ne(e,t,n.properties[i],o[i]));return Pe(e,t,n,o)}function vz(e,t,n,o){let i=Pe(e,t,n,o);if(!s.IsObjectNotArray(i))return i;for(let a of s.Keys(n.properties))!s.HasPropertyKey(i,a)||$s(n.properties[a],a,i)||(i[a]=Ne(e,t,n.properties[a],i[a]));return i}function GU(e,t,n,o){return s.IsEqual(e,"Decode")?wz(e,t,n,o):vz(e,t,n,o)}function Nz(e,t,n,o){if(!s.IsObjectNotArray(o))return o;let i=new RegExp(pt(n));for(let a of s.Keys(o))i.test(a)&&(o[a]=Ne(e,t,xe(n),o[a]));return Pe(e,t,n,o)}function Lz(e,t,n,o){let i=Pe(e,t,n,o);if(!s.IsObjectNotArray(i))return i;let a=new RegExp(pt(n));for(let c of s.Keys(i))a.test(c)&&(i[c]=Ne(e,t,xe(n),i[c]));return i}function $U(e,t,n,o){return s.IsEqual(e,"Decode")?Nz(e,t,n,o):Lz(e,t,n,o)}function FU(e,t,n,o){return s.HasPropertyKey(t,n.$ref)?Ne(e,t,t[n.$ref],o):o}function jU(e,t,n,o){return s.IsEqual(e,"Decode")?Pe(e,t,n,FU(e,t,n,o)):FU(e,t,n,Pe(e,t,n,o))}function kz(e,t,n,o){if(!s.IsArray(o))return o;for(let i=0;i<Math.min(n.items.length,o.length);i++)o[i]=Ne(e,t,n.items[i],o[i]);return Pe(e,t,n,o)}function Mz(e,t,n,o){let i=Pe(e,t,n,o);if(!s.IsArray(i))return o;for(let a=0;a<Math.min(n.items.length,i.length);a++)i[a]=Ne(e,t,n.items[a],i[a]);return i}function qU(e,t,n,o){return s.IsEqual(e,"Decode")?kz(e,t,n,o):Mz(e,t,n,o)}function Dz(e,t,n,o){for(let i of n.anyOf){if(!ye(t,i,o))continue;let a=Ne(e,t,i,o);return Pe(e,t,n,a)}return o}function Gz(e,t,n,o){let i=Pe(e,t,n,o);for(let a of n.anyOf){let c=Ne(e,t,a,Be(i));if(ye(t,a,c))return c}return i}function BU(e,t,n,o){return s.IsEqual(e,"Decode")?Dz(e,t,n,o):Gz(e,t,n,o)}function Ne(e,t,n,o){return X(n)?NU(e,t,n,o):Ee(n)?LU(e,t,n,o):G(n)?DU(e,t,n,o):$(n)?GU(e,t,n,o):ge(n)?$U(e,t,n,o):ue(n)?jU(e,t,n,o):V(n)?qU(e,t,n,o):C(n)?BU(e,t,n,o):Pe(e,t,n,o)}var mg=class extends Dn{constructor(t,n){super("Decode",t,n)}};function $z(e,t,n){if(!ye(e,t,n))throw new mg(n,Mn(e,t,n));return n}function Fz(e,t,n){let o=at.Get().unionPrioritySort?Gi(t):t;return Ne("Decode",e,o,n)}var Y9e=$i([(e,t,n)=>Be(n),(e,t,n)=>Po(e,t,n),(e,t,n)=>Gn(e,t,n),(e,t,n)=>Nr(e,t,n),(e,t,n)=>$z(e,t,n),(e,t,n)=>Fz(e,t,n)]);var dg=class extends Dn{constructor(t,n){super("Encode",t,n)}};function jz(e,t,n){if(!ye(e,t,n))throw new dg(n,Mn(e,t,n));return n}function qz(e,t,n){let o=at.Get().unionPrioritySort?Gi(t):t;return Ne("Encode",e,o,n)}var a6e=$i([(e,t,n)=>Be(n),(e,t,n)=>qz(e,t,n),(e,t,n)=>Po(e,t,n),(e,t,n)=>Gn(e,t,n),(e,t,n)=>Nr(e,t,n),(e,t,n)=>jz(e,t,n)]);var nr=class extends Error{constructor(t,n){super(n),this.type=t}};function HU(e,t){return s.IsFunction(t.default)?t.default(t):s.IsObject(t.default)?Be(t.default):t.default}function KU(e,t){if(wi(t)&&!Vt(t))throw new nr(t,"Arrays with uniqueItems constraints must specify a default annotation");let n=Pi(t)?t.minItems:0;return Array.from({length:n},()=>Ke(e,t.items))}function zU(e,t){return Zr(t)?BigInt(t.exclusiveMinimum)+BigInt(1):Jr(t)?BigInt(t.minimum):BigInt(0)}function YU(e,t){return!1}function VU(e,t){let n=Ke(e,t.instanceType);return class{constructor(){Object.assign(this,n)}}}function QU(e,t){return Ke({...e,...t.$defs},st(t.$ref))}function WU(e,t){return Ke(e,yt(t))}function ZU(e,t){let n=Ke(e,t.returnType);return()=>n}function XU(e,t){return Zr(t)&&s.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:Jr(t)?t.minimum:0}function JU(e,t){let n=Jt(e,t),o=yt(n);return Ke(e,o)}function ew(e,t){return t.const}function tw(e,t){throw new nr(t,"Cannot create TNever types")}function rw(e,t){return null}function nw(e,t){return Zr(t)&&s.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:Jr(t)?t.minimum:0}function ow(e,t){return(s.IsUndefined(t.required)?[]:t.required).reduce((o,i)=>({...o,[i]:Ke(e,t.properties[i])}),{})}function iw(e,t){if(Us(t)&&!Vt(t))throw new nr(t,"Record with the minProperties constraint must have a default annotation");return{}}function aw(e,t){return s.HasPropertyKey(e,t.$ref)?Ke(e,e[t.$ref]):(()=>{throw new nr(t,"Unable to deref Ref")})()}function sw(e,t){if((ws(t)||Cs(t))&&!Vt(t))throw Error("Strings with format or pattern constraints must specify default");let o=Ps(t)?t.minLength:0;return"".padEnd(o)}function cw(e,t){return Symbol()}function pw(e,t){let n=La(t.pattern);if(tt(n))throw new nr(t,"Unable to create TemplateLiteral due to infinite type expansion");return Ke(e,n)}function uw(e,t){return Array.from({length:t.minItems},(n,o)=>Ke(e,t.items[o]))}function lw(e,t){if(s.IsEqual(t.anyOf.length,0))throw Error("Unable to create Union with no variants");return Ke(e,t.anyOf[0])}function Ke(e,t){return Vt(t)?HU(e,t):X(t)?KU(e,t):kt(t)?zU(e,t):Ot(t)?YU(e,t):Ye(t)?VU(e,t):Ee(t)?QU(e,t):We(t)?WU(e,t):Ve(t)?ZU(e,t):ct(t)?XU(e,t):G(t)?JU(e,t):W(t)?ew(e,t):lr(t)?tw(e,t):Ar(t)?rw(e,t):we(t)?nw(e,t):$(t)?ow(e,t):ge(t)?iw(e,t):ue(t)?aw(e,t):tt(t)?sw(e,t):xr(t)?cw(e,t):_e(t)?pw(e,t):V(t)?uw(e,t):dr(t)?void 0:C(t)?lw(e,t):Gt(t)?void 0:void 0}function Lr(...e){let[t,n]=ie.Match(e,{2:(o,i)=>[o,i],1:o=>[{},o]});return Ke(t,n)}var fg=class extends Dn{constructor(t,n){super("Parse",t,n)}};function Bz(e,t,n){if(!ye(e,t,n))throw new fg(n,Mn(e,t,n));return n}var RQe=$i([(e,t,n)=>Be(n),(e,t,n)=>Po(e,t,n),(e,t,n)=>Gn(e,t,n),(e,t,n)=>Nr(e,t,n),(e,t,n)=>Bz(e,t,n)]);var Kz=D({type:Y("insert"),path:At(),value:et()}),zz=Object({type:Y("update"),path:At(),value:et()}),Yz=D({type:Y("delete"),path:At()}),LQe=q([Kz,zz,Yz]);function Fi(e){if(!e.body)throw new Error("This command does not accept a request body");let t=e.body;return t.examples?.length?t.examples[0]:Lr(t)}function hr(e,t,n,o,i){e.command(t).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(Fi(o));return}let c=Ri(a),l=await i()(o,{body:c});Q(l)})}var Ue=" (unix seconds, ISO 8601, or relative like -1h/-30m/now)";var Wz=30,fw=["flat","flatPercent","cum","cumPercent","function"];function _w(e,t){let n=e.command("profiles").description("Query continuous profiling data");gw(n.command("top").description("Rank functions by self (flat) and inclusive (cum) sample value, like pprof -top")).option("--limit <COUNT>","Maximum number of functions to print",String(Wz)).option("--fields <FIELDS>",`Comma-separated fields to project from each function (default for --output=tsv|csv: ${fw.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async o=>{let i=ls(o.output),a=o.fields===void 0?void 0:ms(o.fields),c=Number(o.limit);if(!Number.isInteger(c)||c<1)throw new rr(`--limit must be a positive integer (got: ${o.limit})`);let l=await t()(ef,{body:hw(o)}),{total:m,functions:f}=Zz(l.stacks),h=f.slice(0,c);if(i==="json"){Q({total:m,functions:a?h.map(I=>ds(I,a)):h});return}let E=fs(i,h,a??fw);E.length>0&&z(E)}),gw(n.command("pprof").description("Download a merged pprof profile (raw protobuf, not gzipped)")).option("-O, --output-file <FILE_PATH>","Write the profile to this file instead of stdout").action(async o=>{if(o.outputFile===void 0&&process.stdout.isTTY)throw new rr("Refusing to write a binary profile to the terminal. Use --output-file <FILE_PATH> or pipe stdout.");let i=await t()(pC,{body:hw(o)}),a=Buffer.from(i.pprof,"base64");if(o.outputFile===void 0){process.stdout.write(a);return}(0,Ew.writeFileSync)(o.outputFile,a)}),hr(n,"query","Run a raw profile query and print the folded stacks",ef,t)}function gw(e){return e.requiredOption("--service <SERVICE_NAME>","Service the profiles belong to").addOption(new cr("--type <PROFILE_TYPE>","Profile type").choices(As.type.enum).makeOptionMandatory()).option("--from <TIMESTAMP>",`Start of time range${Ue}${Tw("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Tw("to")}`).option("--filter <TSUGA_QUERY>","Tsuga query over profile labels (equality, negation, wildcards)")}function hw(e){return{service:e.service,type:e.type,timeRange:{from:yw("from",e.from),to:yw("to",e.to)},...e.filter===void 0?{}:{filter:e.filter}}}function Zz(e){let t=new Map,n=new Map,o=0;for(let{stack:c,value:l}of e){let m=c.split(";"),f=m[m.length-1];if(f!==void 0){o+=l,t.set(f,(t.get(f)??0)+l);for(let h of new Set(m))n.set(h,(n.get(h)??0)+l)}}let i=c=>o===0?0:Math.round(c/o*1e4)/100,a=[...n.entries()].map(([c,l])=>{let m=t.get(c)??0;return{function:c,flat:m,flatPercent:i(m),cum:l,cumPercent:i(l)}}).sort((c,l)=>l.flat-c.flat||l.cum-c.cum||c.function.localeCompare(l.function));return{total:o,functions:a}}function yw(e,t){let n=t??tr(e);if(!n)throw new rr(`--${e} is required`);return Ko(n)}function Tw(e){let t=tr(e);return t===void 0?"":` (default: ${t})`}function Iw(e,t){let n=e.command("experimental").description("Experimental commands that may change or be removed without notice");_w(n,t)}var Xz=`/${"v1"}/feedback`,Sw=r.Object({id:r.String({description:"API request ID recorded with the feedback."})},{$id:"Feedback",description:"A recorded piece of feedback"}),Jz={id:"request-123-abc"};Object.assign(Sw,{examples:[Jz]});var bw=r.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."})}),e4={content:"The traces command times out for large services."};Object.assign(bw,{examples:[e4]});var Ow=d({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:Xz,method:"POST",body:bw,response:Sw});function Aw(e,t){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 t()(Ow,{body:{content:n.join(" ")}});Q(o)})}var Pt="/v0/monitors",ji=["alert","resolve","keep_last_status","consider_zero"],qi=["alert","resolve","keep_last_status"];var Rw=["no_aggregation","all","any","each","proportion"],Cw=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"];var t4=r.Object({formula:r.String({description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:r.Enum(Cw,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:r.Number({description:"Numeric threshold value used by the comparison. May be negative when the formula result can be below zero."})}),r4=r.Object({formula:p({type:"tsuga-formula",description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:r.Enum(Cw,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:r.Number({description:"Numeric threshold value used by the comparison. May be negative when the formula result can be below zero."})}),n4=5,gg=r.Array(t4,{description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),hg=r.Array(r4,{minItems:1,maxItems:n4,description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),yg=r.Object({formula:r.String({description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:r.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`."}),Tg=r.Object({formula:p({type:"tsuga-formula",description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:r.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`."}),Ct=[1,2,3,4,5];var dl={timeframe:r.Number({description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over. Always a whole number, at least 1."}),groupByFields:r.Array(r.Object({fields:r.Array(r.String(),{description:"Attribute names the monitor splits results by, evaluating each resulting group independently. Empty means the monitor evaluates a single ungrouped series."}),limit:r.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:r.Optional(ne),replaceNullWith:r.Optional(r.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:r.Optional(r.Enum(Rw,{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:r.Optional(r.Integer({description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},fl={timeframe:r.Integer({minimum:1,description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over."}),groupByFields:r.Array(r.Object({fields:r.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:r.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:r.Optional(ne),replaceNullWith:r.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:r.Optional(r.Enum(Rw,{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:r.Optional(r.Integer({minimum:1,maximum:99,description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},Eg={...dl,timeframe:r.Number({description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over. Always a whole number from 5 through 1440."})},_g={...fl,timeframe:r.Integer({minimum:5,maximum:1440,description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over."})},Pw=r.Object({type:r.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:gg,noDataBehavior:r.Enum(ji,{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."}),...dl,queries:Vr},{$id:"MonitorConfigurationMetric"}),Uw=r.Object({type:r.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:hg,noDataBehavior:r.Enum(ji,{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."}),...fl,queries:wn},{$id:"InputMonitorConfigurationMetric"}),ww=r.Object({type:r.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:gg,noDataBehavior:r.Enum(ji,{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."}),...dl,queries:Vr},{$id:"MonitorConfigurationLog"}),vw=r.Object({type:r.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:hg,noDataBehavior:r.Enum(ji,{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."}),...fl,queries:wn},{$id:"InputMonitorConfigurationLog"}),Nw=r.Object({type:r.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:gg,noDataBehavior:r.Enum(ji,{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."}),...dl,queries:Vr},{$id:"MonitorConfigurationTrace"}),o4=r.Object({type:r.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:hg,noDataBehavior:r.Enum(ji,{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."}),...fl,queries:wn},{$id:"InputMonitorConfigurationTrace"}),Lw=r.Object({type:r.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:yg,noDataBehavior:r.Enum(qi,{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."}),...Eg,queries:Vr},{$id:"MonitorConfigurationAnomalyLog"}),kw=r.Object({type:r.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:Tg,noDataBehavior:r.Enum(qi,{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."}),..._g,queries:wn},{$id:"InputMonitorConfigurationAnomalyLog"}),Mw=r.Object({type:r.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:yg,noDataBehavior:r.Enum(qi,{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."}),...Eg,queries:Vr},{$id:"MonitorConfigurationAnomalyMetric"}),Dw=r.Object({type:r.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:Tg,noDataBehavior:r.Enum(qi,{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."}),..._g,queries:wn},{$id:"InputMonitorConfigurationAnomalyMetric"}),Gw=r.Object({type:r.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:yg,noDataBehavior:r.Enum(qi,{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."}),...Eg,queries:Vr},{$id:"MonitorConfigurationAnomalyTrace"}),i4=r.Object({type:r.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:Tg,noDataBehavior:r.Enum(qi,{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."}),..._g,queries:wn},{$id:"InputMonitorConfigurationAnomalyTrace"}),$w=r.Object({type:r.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:r.Integer({description:"Number of days before certificate expiry when the monitor should warn."}),cloudAccounts:r.Optional(r.Array(r.String(),{description:"Cloud account IDs whose certificates are checked. Omitted means certificates from all cloud accounts are checked."})),aggregationAlertLogic:r.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:r.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"MonitorConfigurationCertificateExpiry"}),a4=r.Object({type:r.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:r.Integer({minimum:1,maximum:365,description:"Number of days before certificate expiry when the monitor should warn. Valid values are 1 through 365."}),cloudAccounts:r.Optional(r.Array(r.String(),{minItems:1,description:"Cloud account IDs whose certificates are checked. Omit to check certificates from all cloud accounts."})),aggregationAlertLogic:r.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:r.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"InputMonitorConfigurationCertificateExpiry"}),s4=r.Object({type:r.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured environment, scoped by teams, services, or both. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:r.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:r.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:r.Object({teamIds:r.Optional(r.Array(r.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:r.String({description:"Environment whose logs are searched for new error patterns."}),services:r.Optional(r.Array(r.String(),{description:"Service names whose logs are searched for new error patterns."}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included, so sending both teams and services searches only the listed services owned by the listed teams. Send a non-empty `teamIds`, a non-empty `services`, or both."})},{$id:"MonitorConfigurationLogErrorPattern"}),c4=r.Object({type:r.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured environment, scoped by teams, services, or both. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:r.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:r.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:r.Object({teamIds:r.Optional(r.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.",minItems:1})),env:p({description:"Environment whose logs are searched for new error patterns."}),services:r.Optional(r.Array(p(),{description:"Service names whose logs are searched for new error patterns.",minItems:1})),service:r.Optional(p({description:"Single service name whose logs are searched for new error patterns. Superseded by `services`, which this value is merged into. Send `services` instead."}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included, so sending both teams and services searches only the listed services owned by the listed teams. Send a non-empty `teamIds`, a non-empty `services`, or both."})},{$id:"InputMonitorConfigurationLogErrorPattern"}),p4=R("type",[Pw,ww,Nw,Lw,Mw,s4,Gw,$w],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."}),u4=R("type",[Uw,vw,o4,kw,Dw,i4,c4,a4],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."});var rn=r.Object({id:r.String({description:"Tsuga-generated monitor ID assigned when the monitor is created."}),name:r.String({description:"Display name of the monitor and alert source."}),owner:r.String({description:"Team ID that owns and manages the monitor."}),message:r.Optional(r.String({description:"Caller-supplied message included in notifications triggered by this monitor. Omitted when the monitor was created or last updated without one."})),tags:ve,configuration:p4,priority:r.Enum(Ct,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),permissions:On,dashboardId:r.Optional(r.String({description:"ID of the dashboard linked to this monitor for context when investigating alerts. Caller-supplied. Omitted when no dashboard is linked."})),pauseUntil:r.Optional(S({description:"Timestamp until which the monitor is snoozed."})),creator:r.Optional(se),updater:r.Optional(se),createdAt:S({description:"Timestamp when Tsuga created the monitor."}),updatedAt:S({description:"Timestamp when Tsuga last updated the monitor."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."}),clusterIds:r.Array(r.String(),{description:"Cluster IDs where the monitor is deployed. Empty means all eligible clusters."})},{title:"Monitor"}),l4=R("type",[Pw,ww,Nw,Lw,Mw,Gw,$w]),eZe=r.Object({...rn.properties,configuration:l4},{title:"Monitor"}),tZe=r.Object({...rn.properties,configuration:R("type",[Uw,vw,kw,Dw])},{title:"Monitor"}),Fs=r.Object({name:p({description:"Display name of the monitor and alert source."}),message:Se(p({type:"long"}),{description:"Message included in notifications triggered by this monitor. Optional on create."}),tags:De,configuration:u4,priority:r.Enum(Ct,{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:Se(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:Se(p({allowEmpty:!1,type:"date-time"}),{description:"ISO timestamp until which the monitor should be snoozed."}),permissions:On,clusterIds:r.Optional(r.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."}))}),xw=["threshold","certificate-expiry","anomaly-detection","log-error-pattern"],$n={PRIORITY:"priority",TYPE:"type",NAME:"name",OWNER:"owner",TAGS:"tags",CLUSTER_IDS:"clusterIds",PAUSE_UNTIL:"pauseUntil",ASSET_UPDATED_AT:"assetUpdatedAt"};var Ig=r.Object({owners:Ie(p({allowEmpty:!1}),{description:"Restrict results to monitors owned by any of these team IDs",maxItems:50}),searchQuery:ou({description:"Search query filter for monitors.",valueDescription:"Case-insensitive substring matched against monitor ID, monitor name, query filters, and aggregate fields. Wildcard characters are treated literally."}),tags:Ie(Yt.items,{description:"Restrict results to monitors that have at least one of the listed key/value tags",maxItems:50}),priorities:Ie(r.Enum(Ct),{description:"Restrict results to monitors with one of these priorities",maxItems:Ct.length}),types:Ie(r.Enum(xw),{description:"Restrict results to monitors with these types",maxItems:xw.length}),activity:r.Enum(["active","snoozed"],{description:"Restrict results by activity status: active monitors or currently snoozed monitors"}),clusterIds:Ie(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"}),gl=r.Partial(Ig),Sg=r.Partial(r.Object({...le,filters:gl,sort:r.Object({by:r.Enum([$n.PRIORITY,$n.TYPE,$n.NAME,$n.OWNER,$n.TAGS,$n.CLUSTER_IDS,$n.PAUSE_UNTIL,$n.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:ne},{description:"Optional sorting applied to the returned monitors. Ties are broken by creation time and monitor ID for stable pagination."})})),rZe=d({tags:["monitors"],url:`${Pt}/query`,method:"POST",paginated:!0,response:r.Array(rn),body:Sg}),nZe=d({tags:["monitors"],url:`${Pt}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(Ig,["tags"])))}),response:zt}),oZe=d({tags:["monitors"],url:`${Pt}/counts/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(Ig,["activity"])))}),response:r.Object({all:r.Integer({description:"Total number of monitors matching the filters that the user can read."}),active:r.Integer({description:"Number of matching readable monitors that are not currently snoozed."}),snoozed:r.Integer({description:"Number of matching readable monitors that are currently snoozed."})})}),iZe=d({tags:["monitors"],url:`${Pt}/:id`,method:"GET",params:r.Object({id:p()}),response:rn}),aZe=d({tags:["monitors"],url:Pt,method:"POST",body:Fs,response:rn}),sZe=d({tags:["monitors"],url:`${Pt}/:id`,method:"PUT",params:r.Object({id:p()}),body:Fs,response:rn}),m4=Kt(gl,{maxIds:100}),cZe=d({tags:["monitors"],url:`${Pt}/bulk-update`,method:"PUT",body:r.Object({selection:m4,owner:p({allowEmpty:!1})}),response:r.Object({})}),pZe=d({tags:["monitors"],url:`${Pt}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),d4=Kt(gl),uZe=d({tags:["monitors"],url:`${Pt}/bulk-delete`,method:"DELETE",body:r.Object({selection:d4}),response:r.Object({})}),lZe=d({tags:["monitors"],url:`${Pt}/:id/snooze`,method:"POST",params:r.Object({id:p()}),body:r.Object({pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:rn}),f4=Kt(gl,{maxIds:100}),mZe=d({tags:["monitors"],url:`${Pt}/bulk-snooze`,method:"POST",body:r.Object({selection:f4,pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:r.Object({})}),g4=["alert","alert_consider_zero","alert_no_data","keep_last_status_alert"],h4=["ok","ok_consider_zero","ok_no_data","keep_last_status_ok"],y4=[...g4,...h4],Uo=r.Enum(y4),T4=R("type",[r.Object({type:r.Literal("each"),subStates:r.Record(r.String(),r.Object({stateValue:r.Union([Uo,r.Null()]),lastChangedAt:S()}))}),r.Object({type:r.Literal("no_aggregation"),stateValue:r.Optional(Uo)}),r.Object({type:r.Literal("any"),stateValue:r.Optional(Uo)}),r.Object({type:r.Literal("all"),stateValue:r.Optional(Uo)}),r.Object({type:r.Literal("proportion"),stateValue:r.Optional(Uo)})]),E4=r.Object({monitorId:r.String(),currentState:T4,lastChangedAt:r.Optional(S())}),dZe=d({tags:["monitors"],url:`${Pt}/states/:id`,method:"GET",params:r.Object({id:p()}),response:E4}),fZe=d({tags:["monitors"],url:`${Pt}/:id/transitions`,method:"GET",params:r.Object({id:p()}),query:r.Object({from:r.Number(),to:r.Number()}),response:r.Array(r.Object({id:r.String(),createdAt:S(),fromState:r.Optional(Uo),toState:r.Optional(Uo),dimension:r.Optional(r.String())}))}),_4=["unprocessed","processed","failed-to-process"],gZe=d({tags:["monitors"],url:`${Pt}/:id/results`,method:"GET",params:r.Object({id:p()}),query:r.Object({from:r.Number(),to:r.Number()}),response:r.Object({isTruncated:r.Boolean(),results:r.Array(r.Object({id:r.String(),evaluationAt:S(),formulaResult:r.Object({groups:r.Array(r.Object({groupKey:r.Record(r.String(),Ss),results:r.Array(r.Union([r.Number(),r.Null()])),conditionMet:r.Enum(["true","false","nan-no-data"])}))}),createdAt:S(),status:r.Enum(_4)}))})});var Bi="/v0/notifications",Fn=`${Bi}/rules`,Fw=`${Bi}/slack/setup`,js=`${Bi}/integrations`,wo=["triggered","resolved","no-data"],I4=["sent","stale","pending","rate-limited","failed","silenced"],S4=r.Optional(r.Object({maxMessages:r.Integer({description:"Maximum number of notifications this target can send during the rate-limiting window."}),minutes:r.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."})),bg=r.Object({maxMessages:r.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:r.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."}),b4=r.Optional(bg),kr=r.Optional(r.Object({mode:r.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:r.Array(r.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:r.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."})),Mr=r.Optional(r.Object({mode:r.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:r.Array(r.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:r.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."})),qs=r.Object({id:r.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:S4,config:R("type",[r.Object({type:r.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:r.String({description:"Slack channel ID that receives the notification"}),integrationId:r.String({description:"Slack workspace ID that receives the notification"}),integrationName:r.String({description:"Human readable name of the Slack integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigSlack"}),r.Object({type:r.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:r.String({description:"Identifier of the incident.io integration to use"}),integrationName:r.String({description:"Human readable name of the incident.io integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigIncidentIo"}),r.Object({type:r.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:r.Array(r.String(),{description:"Email addresses that will receive the alert"}),renotifyConfig:kr},{$id:"RuleTargetConfigEmail"}),r.Object({type:r.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:r.String({description:"Identifier of the Grafana IRM integration to use"}),integrationName:r.String({description:"Human readable name of the Grafana IRM integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigGrafanaIrm"}),r.Object({type:r.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:r.String({description:"Identifier of the PagerDuty integration to use"}),integrationName:r.String({description:"Human readable name of the PagerDuty integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigPagerDuty"}),r.Object({type:r.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:r.String({description:"Identifier of the Microsoft Teams integration to use"}),integrationName:r.String({description:"Human readable name of the Microsoft Teams integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigMicrosoftTeams"}),r.Object({type:r.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:r.String({description:"Identifier of the webhook integration to use"}),integrationName:r.String({description:"Human readable name of the webhook integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigWebhook"}),r.Object({type:r.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:r.String({description:"Identifier of the ServiceNow integration to use"}),integrationName:r.String({description:"Human readable name of the ServiceNow integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigServiceNow"}),r.Object({type:r.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:r.String({description:"Identifier of the Google Chat integration to use"}),integrationName:r.String({description:"Human readable name of the Google Chat integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigGoogleChat"}),r.Object({type:r.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:r.String({description:"Identifier of the Squadcast integration to use"}),integrationName:r.String({description:"Human readable name of the Squadcast integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigSquadcast"}),r.Object({type:r.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:r.String({description:"Identifier of the Jira integration to use"}),integrationName:r.String({description:"Human readable name of the Jira integration"}),projectKey:r.String({description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:r.String({description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:r.Optional(r.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:r.Optional(r.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`."})}),Hi=r.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:b4,config:R("type",[r.Object({type:r.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:Mr},{$id:"RuleTargetInputSlack"}),r.Object({type:r.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:Mr},{$id:"RuleTargetInputIncidentIo"}),r.Object({type:r.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the PagerDuty integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputPagerDuty"}),r.Object({type:r.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:r.Array(p({type:"email"}),{minItems:1,maxItems:20,description:"Email addresses that will receive the alert"}),renotifyConfig:Mr},{$id:"RuleTargetInputEmail"}),r.Object({type:r.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:Mr},{$id:"RuleTargetInputGrafanaIrm"}),r.Object({type:r.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:Mr},{$id:"RuleTargetInputMicrosoftTeams"}),r.Object({type:r.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the webhook integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputWebhook"}),r.Object({type:r.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the ServiceNow integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputServiceNow"}),r.Object({type:r.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:Mr},{$id:"RuleTargetInputGoogleChat"}),r.Object({type:r.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Squadcast integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputSquadcast"}),r.Object({type:r.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:r.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:r.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)."})}),Og=R("type",[r.Object({type:r.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:r.Array(r.String(),{description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),r.Object({type:r.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"}),r.Object({type:r.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."}),Ag=R("type",[r.Object({type:r.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:r.Array(p(),{minItems:1,maxItems:100,description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),r.Object({type:r.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"}),r.Object({type:r.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."}),Ki=r.Object({id:r.String({description:"Tsuga-generated notification rule ID assigned when the rule is created."}),name:r.String({description:"Display name of the notification rule."}),queryString:r.Optional(r.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:Og,prioritiesFilter:r.Array(r.Enum(Ct),{description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.Enum(wo),{description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:r.Array(r.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:r.String({description:"Team ID that owns and manages the rule."}),createdAt:S({description:"Timestamp when Tsuga created the rule."}),updatedAt:S({description:"Timestamp when Tsuga last updated the rule."}),isActive:r.Boolean({description:"Whether the rule currently sends notifications when its filters match."}),tags:ve,targets:r.Array(qs,{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:r.Optional(se),updater:r.Optional(se)}),Bs=r.Object({name:p({description:"Display name of the notification rule."}),queryString:Se(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:Ag,prioritiesFilter:r.Array(r.Enum(Ct),{maxItems:Ct.length,description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.Enum(wo),{maxItems:wo.length,description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:r.Optional(r.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:De,isActive:r.Boolean({description:"Set to true for the rule to send notifications when its filters match."}),targets:r.Array(Hi,{minItems:1,description:"Destinations that receive a notification whenever this rule matches an alert transition. This list replaces the existing targets on update."})}),hl=r.Object({id:r.String({description:"Unique identifier of the adaptive notification rule. Generated by Tsuga."}),name:r.String({description:"Display name of the adaptive notification rule."}),owner:r.String({description:"Team ID that owns and manages the rule."}),createdAt:S({description:"Timestamp when Tsuga created the rule."}),updatedAt:S({description:"Timestamp when Tsuga last updated the rule."}),isActive:r.Boolean({description:"Whether the rule currently sends notifications when one of its monitors fires."}),shouldCreateInvestigation:r.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:ve,monitorIds:r.Array(r.String(),{description:"Monitors this rule reacts to."}),sloIds:r.Array(r.String(),{description:"SLOs this rule reacts to."}),fallbackTarget:qs,creator:r.Optional(se),updater:r.Optional(se)}),jw=r.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:De,isActive:r.Boolean({description:"Set to true for the rule to send notifications when one of its monitors fires."}),shouldCreateInvestigation:r.Optional(r.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:r.Optional(r.Array(p({allowEmpty:!1}),{maxItems:100,description:"Monitors this rule reacts to. Only trace monitors and metric monitors over OTel span metrics are eligible. Send at least one monitor or SLO."})),sloIds:r.Optional(r.Array(p({allowEmpty:!1}),{maxItems:100,description:"SLOs this rule reacts to. Only SLOs over traces or OTel span metrics are eligible. Omit for a rule that reacts to monitors only; send at least one monitor or SLO."})),fallbackTarget:Hi}),OZe=d({tags:["notification-rules"],url:Fn,method:"GET",paginated:!0,query:r.Object(le),response:r.Array(Ki)}),AZe=d({tags:["notification-rules"],url:`${Fn}/:id`,params:r.Object({id:p()}),method:"GET",response:Ki}),xZe=d({tags:["notification-rules"],url:Fn,method:"POST",body:Bs,response:Ki}),RZe=d({tags:["notification-rules"],url:`${Fn}/:id`,method:"PUT",params:r.Object({id:p()}),body:Bs,response:Ki}),CZe=d({tags:["notification-rules"],url:`${Fn}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),PZe=d({tags:["notification-rules"],url:`${Fn}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(p())}),response:r.Object({})}),zi=`${Bi}/adaptive-rules`,UZe=d({tags:["notification-rules"],url:zi,method:"GET",paginated:!0,query:r.Object(le),response:r.Array(hl)}),wZe=d({tags:["notification-rules"],url:`${zi}/:id`,params:r.Object({id:p()}),method:"GET",response:hl}),vZe=d({tags:["notification-rules"],url:zi,method:"POST",body:jw,response:hl}),NZe=d({tags:["notification-rules"],url:`${zi}/:id`,method:"PUT",params:r.Object({id:p()}),body:jw,response:hl}),LZe=d({tags:["notification-rules"],url:`${zi}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),kZe=d({tags:["notification-rules"],url:`${zi}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(p())}),response:r.Object({})}),MZe=d({tags:["notification-integrations"],url:`${Fw}/start`,method:"POST",response:r.Object({redirectUrl:r.String()})}),O4=["google-chat","grafana-irm","incident-io","jira","microsoft-teams","pagerduty","servicenow","slack","squadcast","webhook"],A4=r.Object({id:r.String(),name:r.String(),type:r.Enum(O4),createdAt:S(),ruleCount:r.Number(),creator:r.Optional(se)}),DZe=d({tags:["notification-integrations"],url:`${Fn}/integrations`,method:"GET",paginated:!0,query:r.Object(le),response:r.Array(A4)}),GZe=d({tags:["notification-integrations"],url:`${Fw}/callback`,method:"GET",query:r.Object({code:p()}),response:r.Object({success:r.Boolean()})}),xg=["POST","PUT"],x4=r.Record(r.String(),r.String()),R4=r.Record(r.String(),r.Unknown()),C4=r.Record(r.String(),r.Union([r.String(),r.Number(),r.Boolean(),r.Null(),r.Array(r.Union([r.String(),r.Number(),r.Boolean()]))])),P4=R("type",[r.Object({type:r.Literal("json"),value:R4}),r.Object({type:r.Literal("form"),value:C4})]),U4=r.Object({ok:r.String(),alert:r.String()}),Hs=r.Object({id:r.String(),name:r.String(),setting:R("type",[r.Object({type:r.Literal("incident-io"),alertSourceConfigId:r.String(),tokenLastChars:r.String()}),r.Object({type:r.Literal("grafana-irm"),urlLastChars:r.String()}),r.Object({type:r.Literal("pagerduty"),integrationKeyLastChars:r.String()}),r.Object({type:r.Literal("microsoft-teams"),webhookUrlLastChars:r.String()}),r.Object({type:r.Literal("webhook"),urlLastChars:r.String(),method:r.Enum(xg),authentication:R("type",[r.Object({type:r.Literal("bearer"),tokenLastChars:r.String()}),r.Object({type:r.Literal("basic"),username:r.String(),passwordLastChars:r.String()}),r.Object({type:r.Literal("custom-header"),key:r.String(),valueLastChars:r.String()}),r.Object({type:r.Literal("none")})]),customHeaders:r.Optional(x4),payloadTemplate:P4,eventNameMapping:r.Optional(U4)}),r.Object({type:r.Literal("servicenow"),instanceName:r.String(),username:r.String(),passwordLastChars:r.String()}),r.Object({type:r.Literal("google-chat"),webhookUrlLastChars:r.String()}),r.Object({type:r.Literal("squadcast"),webhookUrlLastChars:r.String()}),r.Object({type:r.Literal("jira"),siteUrl:r.String(),email:r.String(),apiTokenLastChars:r.String()})]),tags:ve}),w4=r.Object({type:r.Literal("webhook"),url:p({type:"uri"}),method:r.Enum(xg),authentication:R("type",[r.Object({type:r.Literal("bearer"),token:p({allowEmpty:!1})}),r.Object({type:r.Literal("basic"),username:p({allowEmpty:!1}),password:p({allowEmpty:!1})}),r.Object({type:r.Literal("custom-header"),key:p({allowEmpty:!1}),value:p({allowEmpty:!1})}),r.Object({type:r.Literal("none")})]),customHeaders:r.Record(p({allowEmpty:!1}),p()),payloadTemplate:R("type",[r.Object({type:r.Literal("json"),value:r.Record(p({allowEmpty:!1}),r.Unknown())}),r.Object({type:r.Literal("form"),value:r.Record(p({allowEmpty:!1}),r.Union([r.String(),r.Number(),r.Boolean(),r.Null(),r.Array(r.Union([r.String(),r.Number(),r.Boolean()]))]))})]),eventNameMapping:r.Optional(r.Object({ok:p({allowEmpty:!1}),alert:p({allowEmpty:!1})}))}),qw=r.Object({type:r.Literal("incident-io"),alertSourceConfigId:p(),token:p()}),Bw=r.Object({type:r.Literal("grafana-irm"),url:p({type:"uri"})}),Hw=r.Object({type:r.Literal("pagerduty"),integrationKey:p()}),Kw=r.Object({type:r.Literal("microsoft-teams"),webhookUrl:p({type:"uri"})}),v4=r.Object({type:r.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})}),N4=r.Object({type:r.Literal("google-chat"),webhookUrl:p({type:"uri"})}),L4=r.Object({type:r.Literal("squadcast"),webhookUrl:p({type:"uri"})}),k4=r.Object({type:r.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."})}),Rg=r.Object({name:p(),setting:R("type",[qw,Bw,Hw,Kw,w4,v4,N4,L4,k4]),tags:De}),M4=r.Object({type:r.Literal("webhook"),url:r.Optional(p({type:"uri"})),method:r.Optional(r.Enum(xg)),authentication:r.Optional(R("type",[r.Object({type:r.Literal("bearer"),token:r.Optional(p({allowEmpty:!1}))}),r.Object({type:r.Literal("basic"),username:r.Optional(p({allowEmpty:!1})),password:r.Optional(p({allowEmpty:!1}))}),r.Object({type:r.Literal("custom-header"),key:r.Optional(p({allowEmpty:!1})),value:r.Optional(p({allowEmpty:!1}))}),r.Object({type:r.Literal("none")})])),customHeaders:r.Optional(r.Record(p({allowEmpty:!1}),p())),payloadTemplate:r.Optional(R("type",[r.Object({type:r.Literal("json"),value:r.Record(p({allowEmpty:!1}),r.Unknown())}),r.Object({type:r.Literal("form"),value:r.Record(p({allowEmpty:!1}),r.Union([r.String(),r.Number(),r.Boolean(),r.Null(),r.Array(r.Union([r.String(),r.Number(),r.Boolean()]))]))})])),eventNameMapping:Se(r.Object({ok:r.Optional(p({allowEmpty:!1})),alert:r.Optional(p({allowEmpty:!1}))}))}),D4=r.Object({type:r.Literal("servicenow"),instanceName:r.Optional(p({allowEmpty:!1})),username:r.Optional(p({allowEmpty:!1})),password:r.Optional(p({allowEmpty:!1}))}),G4=r.Object({type:r.Literal("jira"),siteUrl:r.Optional(p({type:"uri",allowEmpty:!1})),email:r.Optional(p({allowEmpty:!1})),apiToken:r.Optional(p({allowEmpty:!1}))}),$4=r.Object({type:r.Literal("google-chat"),webhookUrl:p({type:"uri"})}),F4=r.Object({type:r.Literal("squadcast"),webhookUrl:p({type:"uri"})}),Cg=r.Object({name:r.Optional(p()),tags:De,setting:r.Optional(R("type",[qw,Bw,Hw,Kw,M4,D4,$4,F4,G4]))}),$Ze=d({tags:["notification-integrations"],url:js,method:"POST",body:Rg,response:Hs}),FZe=d({tags:["notification-integrations"],url:`${js}/:id`,method:"GET",params:r.Object({id:p()}),response:Hs}),jZe=d({tags:["notification-integrations"],url:`${js}/:id`,method:"PUT",params:r.Object({id:p()}),body:Cg,response:Hs}),qZe=d({tags:["notification-integrations"],url:`${js}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),j4=R("status",[r.Object({status:r.Literal("ok",{description:"Tsuga reached Jira and listed the projects the credentials can file into."}),projects:r.Array(r.Object({key:r.String({description:'Jira project key, like "OPS".'}),name:r.String({description:"Human readable Jira project name."}),issueTypes:r.Array(r.String(),{description:"Issue type names available when creating an issue in this project."}),statuses:r.Optional(r.Array(r.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"}),r.Object({status:r.Literal("error",{description:"Tsuga could not load Jira metadata with the stored credentials."}),message:r.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."}),BZe=d({tags:["notification-integrations"],url:`${js}/:id/jira-metadata`,method:"GET",params:r.Object({id:p()}),response:j4}),HZe=d({tags:["notification-rules"],url:`${Pt}/:id/notifications`,method:"GET",params:r.Object({id:p()}),query:r.Optional(r.Object({from:r.Optional(r.Number()),to:r.Optional(r.Number())})),response:r.Object({notifications:r.Array(r.Object({id:r.String(),monitorId:r.String(),monitorResultId:r.String(),ruleId:r.Optional(r.String()),targetId:r.Optional(r.String()),status:r.Enum(I4),tryCount:r.Number(),nextTryAt:S(),createdAt:S(),updatedAt:S(),sentAt:r.Optional(S())})),isTruncated:r.Boolean()})}),q4=["slack","incident-io","pagerduty","email","grafana-irm","microsoft-teams","webhook","servicenow","google-chat","squadcast","jira"],KZe=d({tags:["notification-rules"],url:`${Fn}/test`,method:"POST",body:r.Object({notificationRule:Bs,targetIds:r.Optional(r.Array(p({allowEmpty:!1}),{description:"Target IDs to test specific targets",minItems:1,maxItems:10}))}),response:r.Union([r.Object({success:r.Literal(!1),overallMessage:r.String({description:"Message when there is an overall error"})}),r.Object({success:r.Boolean(),results:r.Array(r.Object({targetId:r.String({description:"The ID of the target that was tested"}),targetType:r.Enum(q4,{description:"The type of the target (e.g., slack, webhook)"}),status:r.Enum(["success","failure"],{description:"Whether the test notification was sent successfully"}),message:r.Optional(r.String({description:"Message if the notification failed for this specific target"}))}))})])});var nn="/v0/slos",B4=[7,30,90],H4=["good","bad"],Qw=r.Enum(H4,{description:"How to treat SLO with no data: good (count as meeting the SLO), bad (count as breaching it)"}),K4=["good","bad","ignore"],Ww=r.Enum(K4,{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)"}),zw=30,Yw=1440,Zw=["greater_than","less_than","greater_than_or_equal","less_than_or_equal"],z4=["healthy","breached","no_data"],yl=r.Enum(z4,{description:"SLO status: healthy (meeting the target), breached (breaching it), or no_data (not evaluated yet)"}),Vw={sli:r.Optional(r.Number({description:"Service level indicator for the latest evaluation; absent when there is no data"})),errorBudget:r.Optional(r.Number({description:"Remaining error budget at the latest evaluation; negative when exhausted, absent when there is no data"})),status:yl},Y4=r.Object({overall:r.Object(Vw,{description:"Latest overall evaluation for the cluster"}),perGroup:r.Array(r.Object({groupKey:r.Record(r.String(),Ss,{description:"Group-by field values identifying this group, keyed by field name. Present only when the SLO configuration sets `groupByFields`."}),...Vw}),{description:"Latest evaluation for each group produced by the SLO configuration's `groupByFields`. Empty when the SLO is not grouped."})},{title:"SloClusterResults"}),Xw=r.Record(r.String(),Y4,{description:"Latest evaluation results keyed by cluster ID."}),Pg=r.Object({queries:Vr,formula:Mu},{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. Returned queries include Tsuga-derived missing-point fill: event SLO queries use zero fill, and time SLO queries keep missing points null."}),Ug=r.Object({queries:NR,formula:Io},{title:"SloQueryFormula",description:"Aggregation queries combined by a formula to produce the SLO signal. Formulas reference queries as q1, q2, and so on. Do not send per-query fill; Tsuga derives the fill behavior from the SLO type."}),V4=r.Object({type:r.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:r.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"}),Q4=r.Object({type:r.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:r.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 W4=r.Object({type:r.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:r.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"}),Z4=r.Object({type:r.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:r.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"}),X4=R("type",[V4,W4],{description:"Alert trigger configuration: burn-rate or threshold"}),Jw=R("type",[Q4,Z4],{description:"Alert trigger configuration: burn-rate or threshold"}),wg=r.Enum(Ct,{description:"Alert priority (1 is highest, 5 is lowest)"}),vg=r.Object({id:r.String({description:"Tsuga-generated SLO alert ID assigned when the alert is created."}),sloId:r.String({description:"Parent SLO ID for this alert."}),priority:wg,configuration:X4,createdAt:S({description:"Timestamp when Tsuga created the alert."}),updatedAt:S({description:"Timestamp when Tsuga last updated the alert."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"SloAlert"}),J4=r.Object({priority:wg,configuration:Jw}),eY=r.Object({id:r.Optional(p({allowEmpty:!1,description:"Identifier of an existing alert to update. Omit to create a new alert on this SLO."})),priority:wg,configuration:Jw}),tY=R("type",[r.Object({type:r.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:fr,goodQuery:Pg,totalQuery:Pg,groupByFields:r.Optional(xi),noDataBehavior:Qw},{title:"EventSloConfiguration"}),r.Object({type:r.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:fr,query:Pg,sliceSizeMinutes:r.Integer({description:"Length of each time-SLO evaluation slice in minutes. Required for `type: time`."}),threshold:r.Object({operator:r.Enum(Zw,{description:"Comparison operator between the query value and the threshold"}),value:r.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:r.Optional(xi),noDataBehavior:Ww},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),rY=R("type",[r.Object({type:r.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:fr,goodQuery:Ug,totalQuery:Ug,groupByFields:r.Optional(Qr),noDataBehavior:Qw},{title:"EventSloConfiguration"}),r.Object({type:r.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:fr,query:Ug,sliceSizeMinutes:r.Integer({minimum:zw,maximum:Yw,description:`Length of each time-SLO evaluation slice in minutes. Required for \`type: time\`. Valid input is ${zw} through ${Yw}.`}),threshold:r.Object({operator:r.Enum(Zw,{description:"Comparison operator between the query value and the threshold"}),value:r.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:r.Optional(Qr),noDataBehavior:Ww},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),nY=r.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"Target percentage (0 < target < 100, e.g. 99.9)"}),ev=r.Enum(B4,{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."}),oY=r.Array(r.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."}),iY=r.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."}),Yi=r.Object({id:r.String({description:"Tsuga-generated SLO ID assigned when the SLO is created."}),name:r.String({description:"Display name of the SLO, set by the caller."}),description:r.Optional(r.String({description:"Free-form, caller-provided description of what the SLO measures. Absent when not set."})),tags:ve,configuration:tY,target:r.Number({description:"Target percentage (0 < target < 100, e.g. 99.9)"}),timeframeDays:ev,owner:r.String({description:"Team ID that owns the SLO"}),permissions:On,clusterIds:oY,creator:r.Optional(se),updater:r.Optional(se),alerts:r.Array(vg,{description:"Alerts attached to this SLO"}),createdAt:S({description:"Timestamp when Tsuga created the SLO."}),updatedAt:S({description:"Timestamp when Tsuga last updated the SLO."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"Slo"}),aY=r.Object({...Yi.properties,results:Xw},{title:"SloWithResults"}),Tl=r.Object({name:p({allowEmpty:!1,description:"Display name of the SLO."}),description:Se(p({type:"long"}),{description:"Free-form, caller-provided description of what the SLO measures. Optional."}),tags:De,configuration:rY,target:nY,timeframeDays:ev,owner:p({allowEmpty:!1,description:"Team ID that owns the SLO"}),permissions:On,clusterIds:r.Optional(iY),alerts:r.Array(J4,{description:"Alerts to create on this SLO. Send an empty array for none."})}),Ng=r.Object({...r.Omit(Tl,["alerts"]).properties,alerts:r.Array(eY,{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."})}),tv=r.Object({owners:Ie(p({allowEmpty:!1}),{description:"Restrict results to SLOs owned by any of these team IDs",maxItems:50}),searchQuery:ou({description:"Text filter for SLO names or IDs. Optional; `exclude: true` removes matching SLOs.",valueDescription:"Substring matched case-insensitively against the SLO name or SLO ID."}),tags:Ie(Yt.items,{description:"Restrict results to SLOs that have at least one of the listed key/value tags",maxItems:50}),clusterIds:Ie(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:Ie(yl,{description:"Restrict results to SLOs whose status is one of these values",maxItems:3})},{description:"Optional filters applied to narrow the returned SLOs"}),Lg=r.Partial(tv),kg=r.Partial(r.Object({...le,filters:Lg,sort:r.Object({by:r.Enum(["name","owner","tags","updatedAt","sli","errorBudget","status"],{description:"Field to sort by"}),direction:ne},{description:"Optional sorting applied to the returned SLOs"})})),nXe=d({tags:["slos"],url:`${nn}/query`,method:"POST",paginated:!0,response:r.Array(aY),body:kg}),oXe=d({tags:["slos"],url:`${nn}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(tv,["tags","statuses"])))}),response:zt}),iXe=d({tags:["slos"],url:`${nn}/:id`,method:"GET",params:r.Object({id:p()}),response:Yi}),aXe=d({tags:["slos"],url:`${nn}/:id/results`,method:"GET",params:r.Object({id:p()}),response:Xw}),sXe=d({tags:["slos"],url:nn,method:"POST",body:Tl,response:Yi}),cXe=d({tags:["slos"],url:`${nn}/:id`,method:"PUT",params:r.Object({id:p()}),body:Ng,response:Yi}),pXe=d({tags:["slos"],url:`${nn}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),sY=Kt(Lg),uXe=d({tags:["slos"],url:`${nn}/bulk-delete`,method:"DELETE",body:r.Object({selection:sY}),response:r.Object({})}),cY=Kt(Lg,{maxIds:100}),lXe=d({tags:["slos"],url:`${nn}/bulk-update`,method:"PUT",body:r.Object({selection:cY,owner:p({allowEmpty:!1})}),response:r.Object({})});var jt="/v0/service-catalog",pY=r.Object({team:r.String({description:"Team name observed on telemetry for this service. The emitting service sets it through telemetry attributes. Returned when Tsuga has observed a team value for the service; metadata refreshes weekly or when a new service version appears."}),lastSeenAt:S({description:"Most recent time this team was observed for the service. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A team name observed on telemetry for this service, with the last time it was seen."}),uY=r.Object({ingestionApiKey:r.String({description:"Ingestion API key name or identifier observed on telemetry for this service. Tsuga sets it from the key used to ingest matching telemetry. Returned when key metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this ingestion key was observed for the service. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"An ingestion API key observed on telemetry for this service, with the last time it was seen."}),lY=r.Object({version:r.String({description:"Service version value observed in telemetry. The emitting service sets it through `context.service.version`. Returned when Tsuga has observed a version for the service."}),firstSeenAt:S({description:"First time this version was observed for the service. Tsuga sets it from telemetry timestamps and refreshes observed versions on each service catalog pass."}),lastSeenAt:S({description:"Most recent time this version was observed for the service. Tsuga sets it from telemetry timestamps and refreshes observed versions on each service catalog pass."}),faulty:r.Optional(r.Boolean({description:"Whether Tsuga detected this version as associated with faulty behavior."})),faultyLatency:r.Optional(r.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:r.Optional(r.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."}),mY=r.Object({language:r.String({description:"Programming language observed for this service. The OpenTelemetry SDK sets it through telemetry metadata. Returned when language metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this language was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A programming language observed for this service, with the last time it was seen."}),dY=r.Object({runtime:r.String({description:"Runtime observed for this service. The emitting service or OpenTelemetry instrumentation sets it through telemetry metadata. Returned when runtime metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this runtime was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A runtime observed for this service, with the last time it was seen."}),rv=r.Object({protocol:r.String({description:"Observed API protocol, such as `http`, `grpc`, or `graphql`. Tsuga infers it from span metadata. Returned when protocol metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this protocol was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"An API protocol observed for this service, with the last time it was seen."}),fY=r.Object({framework:r.String({description:"Observed application framework, such as `express`, `fastify`, `django`, or `rails`. Tsuga detects it from OpenTelemetry instrumentation scope. Returned when framework metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this framework was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"An application framework detected from OpenTelemetry instrumentation scope, with the last time it was seen."}),gY=r.Object({platform:r.String({description:"Observed cloud or orchestration platform, such as `aws_eks` or `kubernetes`. The emitting service or collector sets it through telemetry resource attributes. Returned when platform metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this platform was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A cloud or orchestration platform this service runs on, with the last time it was seen."}),hY=r.Object({provider:r.String({description:"Observed cloud provider, such as `aws`, `gcp`, or `azure`. The emitting service or collector sets it through telemetry resource attributes. Returned when provider metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this provider was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A cloud provider this service runs on, with the last time it was seen."}),Vi=r.Object({id:r.String({description:"Tsuga-generated identifier of this service notification target. Tsuga returns it when the target is created or listed, and clients use it to update or delete the target. It is unique across service targets."}),serviceId:r.String({description:"Identifier of the service catalog entry this target is attached to. Tsuga sets it from the service path parameter and returns it on read and write responses."}),config:qs.properties.config,rateLimit:qs.properties.rateLimit,createdAt:S({description:"Timestamp when the service notification target was created. Tsuga sets this value and returns it on private service-catalog responses."}),updatedAt:S({description:"Timestamp when the service notification target was last updated. Tsuga sets this value and returns it on private service-catalog responses."})}),Mg=r.Object({config:Hi.properties.config,rateLimit:Hi.properties.rateLimit},{description:"Service notification target create request. The caller provides the destination configuration and optional rate limit; Tsuga attaches the target to the service in the path."}),Dg=r.Object({config:Hi.properties.config,rateLimit:r.Union([bg,r.Null()],{description:"Per-target rate limit to apply when sending notifications. Set it to `null` to drop the current limit and fall back to the default of 1000 notifications every 10 minutes."})},{description:"Service notification target update request. The caller provides the replacement destination configuration and rate limit; omitted fields are not supported by this schema."}),El=r.Object({id:r.String({description:"Unique identifier of this service. Use it with service detail and graph endpoints."}),serviceName:r.String({description:"OpenTelemetry service name observed in telemetry."}),serviceNamespace:r.Optional(r.String({description:"OpenTelemetry service namespace observed in telemetry."})),env:r.String({description:"Environment value observed for this service."}),teams:r.Array(pY,{description:"Team names observed on telemetry for this service and when each was last seen."}),ingestionApiKeys:r.Array(uY,{description:"Ingestion API keys observed on telemetry for this service and when each was last seen."}),versions:r.Array(lY,{description:"Service version values observed in telemetry, including first and last seen timestamps."}),languages:r.Array(mY,{description:"Programming languages observed for this service."}),runtimes:r.Array(dY,{description:"Runtime values observed for this service."}),serverProtocols:r.Array(rv,{description:"API protocols this service exposes (from server-kind spans)"}),clientProtocols:r.Array(rv,{description:"API protocols this service calls out over (from client-kind spans)"}),frameworks:r.Array(fY,{description:"Application frameworks detected from OTel instrumentation scope"}),cloudPlatforms:r.Array(gY,{description:"Cloud platforms this service is running on"}),cloudProviders:r.Array(hY,{description:"Cloud providers this service is running on"}),lastSeenAt:S({description:"Most recent time Tsuga observed telemetry for this service."}),firstSeenAt:S({description:"First time Tsuga observed telemetry for this service."}),additionalUserFields:r.Optional(r.Unsafe({type:"object",additionalProperties:!0,description:"Additional user-defined service metadata, when configured."})),traceRequestRate:r.Optional(r.Number({description:"Requests per second observed for this service over the queried window, counting calls of its primary span kind. Omitted when the trace query failed, which is distinct from `0` (the service is quiet)."})),traceErrorRate:r.Optional(r.Number({description:"Percentage of this service\u2019s primary-span-kind calls over the queried window that ended with error status. Omitted when the trace query failed."})),notificationTargets:r.Array(Vi,{description:"Notification targets attached to this service, used by adaptive notification rules to page its owners."}),createdAt:S({description:"Timestamp when Tsuga created this service catalog entry."}),updatedAt:S({description:"Timestamp when Tsuga last updated this service catalog entry."})}),yY=r.Object({spanKind:r.Enum(cR),count:r.Number()}),Gg=r.Object({...El.properties,spanKindCounts:r.Array(yY)}),SXe=d({tags:["service-catalog"],query:r.Object({...le,clusterId:r.Optional(p()),env:r.Optional(p())}),method:"GET",paginated:!0,url:`${jt}/services`,response:r.Array(Gg)}),TY=["serviceName","env","lastDeploy","traceErrorRate","traceRequestRate","teams","api","frameworks","languages","pagingDestination"],EY=r.Object({searchQuery:r.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against service names."})},{description:"Text filter for service names."}),teams:Ie(p({allowEmpty:!1}),{description:"Restrict results to services observed under any of these team names",maxItems:50}),envs:Ie(p({allowEmpty:!1}),{description:"Restrict results to services observed in any of these environments",maxItems:50}),versions:Ie(p({allowEmpty:!1}),{description:"Restrict results to services whose latest observed version is one of these",maxItems:50}),languages:Ie(p({allowEmpty:!1}),{description:"Restrict results to services written in any of these languages",maxItems:50}),hasRecentData:r.Boolean({description:"When true, only return services whose request rate over the queried window is non-zero"})}),_Y=["1h","4h","24h"];var IY=r.Partial(r.Object({...le,clusterId:p(),filters:r.Partial(EY,{description:"Optional filters applied to narrow the returned services"}),sort:r.Object({by:r.Enum(TY,{description:"Field to sort the returned services by"}),direction:ne},{description:"Optional sorting applied to the returned services"}),statsWindow:r.Enum(_Y,{description:"Lookback used to compute the trace request rate and trace error rate fields, and the span-call totals that pick each service's primary environment. Defaults to `1h`."})})),bXe=d({tags:["service-catalog"],url:`${jt}/v2/services/query`,method:"POST",paginated:!0,body:IY,response:r.Array(Gg)}),OXe=d({tags:["service-catalog"],query:r.Object({serviceName:p({allowEmpty:!1}),serviceNamespace:r.Optional(p({allowEmpty:!1})),env:p({allowEmpty:!1}),clusterId:r.Optional(p())}),method:"GET",url:`${jt}/v2/service`,response:Gg}),AXe=d({tags:["service-catalog"],query:r.Object({serviceName:p({allowEmpty:!1}),serviceNamespace:r.Optional(p({allowEmpty:!1})),clusterId:r.Optional(p())}),method:"GET",url:`${jt}/v2/service/envs`,response:r.Array(r.Object({env:r.String({description:"Environment the service was observed in."}),ingestedBytes:r.Number({description:"Trace bytes ingested for the service in this environment over the lookback."})}),{description:"Environments the service was observed in, busiest first."})}),xXe=d({tags:["service-catalog"],method:"GET",url:`${jt}/services/:serviceId`,params:r.Object({serviceId:p()}),response:El}),RXe=d({tags:["service-catalog"],method:"GET",url:`${jt}/services/:serviceId/targets`,params:r.Object({serviceId:p()}),response:r.Array(Vi)}),CXe=d({tags:["service-catalog"],method:"POST",url:`${jt}/services/:serviceId/targets`,params:r.Object({serviceId:p()}),body:Mg,response:Vi}),PXe=d({tags:["service-catalog"],method:"PUT",url:`${jt}/services/:serviceId/targets/:targetId`,params:r.Object({serviceId:p(),targetId:p()}),body:Dg,response:Vi}),UXe=d({tags:["service-catalog"],method:"DELETE",url:`${jt}/services/:serviceId/targets/:targetId`,params:r.Object({serviceId:p(),targetId:p()}),response:v}),SY=["otel_kube","otel_host_kube","otel_host","prometheus","aws_ec2","gcp_compute_engine"];var nv=r.Object({id:r.String(),hostName:r.String(),env:r.Optional(r.String()),cpuUtilizationAverage:r.Number(),hostType:r.Enum(SY),teams:r.Array(r.String()),tags:r.Array(r.String()),firstSeenAt:S(),lastSeenAt:S(),clusterId:r.String()}),wXe=d({tags:["service-catalog"],method:"GET",url:`${jt}/hosts`,response:r.Array(nv)}),vXe=d({tags:["service-catalog"],method:"GET",url:`${jt}/hosts/:hostId`,params:r.Object({hostId:p()}),response:nv}),bY=["http","rpc","messaging","genai","object_store"],ov={name:r.String({description:"Service or inferred dependency name shown in the graph."}),env:r.Optional(r.String({description:"Environment observed from spans."}))},$g=r.Object({...ov,nodeType:r.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:r.Union([r.String(),r.Null()],{description:"Service ID, or null when multiple namespaces match the observed service name."}),namespace:r.Union([r.String(),r.Null()],{description:"Service namespace, or null when multiple namespaces match the observed service name."}),errorRate:r.Optional(r.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. Computed from the raw sampled counts, so trace sampling does not affect it."})),entryErrorRequestCount:r.Number({description:"Estimated number of entry requests on this service where at least one entry span had error status, projected from the sampled traces onto the full population."}),entryRequestCount:r.Number({description:"Estimated number of entry requests on this service, projected from the sampled traces onto the full population. Observed 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."})}),iv={...ov,endpoint:r.Optional(r.String({description:"Inferred service endpoint address"})),resourceName:r.Optional(r.String({description:"Inferred resource name, e.g. table or queue name"}))},Fg=r.Object({...iv,nodeType:r.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:r.Literal("db",{description:"Inferred dependency type. Always `db` for this node variant."}),databaseName:r.Optional(r.String({description:"Database name from span_attributes db.namespace. Matches the database catalog `name`."})),databaseSystem:r.String({description:"Database system from span_attributes db.system.name (falling back to legacy db.system). Matches the database catalog `databaseSystem`."})}),jg=r.Object({...iv,nodeType:r.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:r.Enum(bY,{description:"Inferred dependency type from span metadata: http, rpc, messaging, genai, or object_store."})}),OY=R("nodeType",[$g,Fg,jg]),qg=r.Object({from:r.Object({env:r.Optional(r.String({description:"Environment of the source node"})),name:r.String({description:"Name of the source node"})},{description:"Reference to the caller node, i.e. the service or dependency that issued the request."}),to:r.Object({env:r.Optional(r.String({description:"Environment of the target node"})),name:r.String({description:"Name of the target node"}),databaseSystem:r.Optional(r.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:r.Number({description:"Estimated number of cross-service transitions on this directed edge in the graph query window. The graph is built from a uniform sample of traces, so this is projected onto the full population rather than counted directly."}),errorRate:r.Optional(r.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. Computed from the raw sampled counts, so trace sampling does not affect it."})),errorCount:r.Number({description:"Estimated number of client spans with error status on this edge, projected from the sampled traces onto the full population."}),clientSpanCount:r.Number({description:"Estimated number of client spans on this edge, projected from the sampled traces onto the full population."})},{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."}),NXe=d({tags:["service-catalog"],url:`${jt}/services/:serviceId/graph`,method:"GET",params:r.Object({serviceId:p()}),query:r.Object({...it.properties,query:r.Optional(p({type:"tsuga-query"}))}),response:r.Object({clusterId:r.String(),nodes:r.Array(OY),edges:r.Array(qg)})}),AY=r.Object({monitors:r.Array(r.Object({id:r.String({description:"Identifier of the monitor"}),name:r.String({description:"Display name of the monitor"}),owner:r.String({description:"Team ID that owns the monitor"}),priority:r.Enum(Ct,{description:"Priority of the monitor"})})),slos:r.Array(r.Object({id:r.String({description:"Identifier of the SLO"}),name:r.String({description:"Display name of the SLO"}),owner:r.String({description:"Team ID that owns the SLO"}),statusCount:r.Partial(r.Record(yl,r.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"})}))}),LXe=d({tags:["service-catalog"],method:"GET",url:`${jt}/services/:serviceId/related-resources`,params:r.Object({serviceId:p()}),response:AY}),kXe=d({tags:["service-catalog"],method:"GET",url:`${jt}/services/by-api-keys`,response:r.Record(r.String(),r.Array(r.Object({serviceName:r.String(),serviceNamespace:r.Optional(r.String())})))});var _l=`/${"v1"}/services`,Bg=r.Pick(El,["id","serviceName","serviceNamespace","env","teams","versions","languages","runtimes","serverProtocols","clientProtocols","frameworks","cloudPlatforms","cloudProviders","lastSeenAt","firstSeenAt","traceRequestRate","traceErrorRate"],{$id:"Service",description:"Service inferred from telemetry, with observed metadata, activity counts, and version signals. See [Services](/documentation/categorize/services/index)."}),xY={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",traceRequestRate:2.36,traceErrorRate:8.2};Object.assign(Bg,{examples:[xY]});var av=d({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:_l,method:"GET",paginated:!0,query:r.Object({...qe,clusterId:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Omit to use the first cluster in the organization; this does not query all clusters."})),env:r.Optional(p({allowEmpty:!1,description:"Environment whose activity and metadata each returned service is described by. Services not observed in it are omitted. Omit to describe each service by its busiest environment."}))},{description:"Service list query. Use pagination and optional cluster and environment scope."}),response:r.Array(Bg)}),sv=d({description:"Retrieves one telemetry-inferred service by service ID.",operationId:"getService",tags:["services"],url:`${_l}/:serviceId`,method:"GET",params:r.Object({serviceId:p({allowEmpty:!1,description:"Identifier of the service to retrieve. Use the `id` returned by service list responses."})}),response:Bg}),RY=r.Pick($g,["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."}),CY=r.Pick(jg,["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."}),PY=r.Pick(Fg,["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."}),UY=R("nodeType",[RY,PY,CY]),wY=r.Pick(qg,["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."}),vY=r.Optional(r.Integer({...it.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."})),NY=r.Optional(r.Integer({...it.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."})),LY=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."}),cv=d({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:`${_l}/:serviceId/graph`,method:"GET",params:r.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:r.Object({from:vY,to:NY,query:r.Optional(LY)},{description:"Service graph query. Use time range and optional span query filters."}),response:r.Object({clusterId:r.String({description:"Cluster ID the graph was built from"}),nodes:r.Array(UY,{description:"Observed and inferred nodes included in the service dependency graph."}),edges:r.Array(wY,{description:"Directed dependency edges between graph nodes."})})}),Il=`${_l}/:serviceId/notification-targets`,Sl=r.Pick(Vi,["id","serviceId","config","rateLimit"],{$id:"ServiceNotificationTarget",description:"Notification target attached to a service, used by adaptive notification rules to page the service owners. See [Rules](/documentation/alert/notifications/rules)."}),Hg={rateLimit:{maxMessages:10,minutes:5},config:{type:"email",addresses:["oncall@example.com"],renotifyConfig:{mode:"each",renotificationStates:["alert"],renotifyIntervalMinutes:30}}},kY={id:"789-abc-def",serviceId:"123-456-abc",...Hg};Object.assign(Sl,{examples:[kY]});var bl=p({allowEmpty:!1,description:"Identifier of the service the notification target belongs to. Use the `id` returned by service list or get responses."}),HXe=d({description:"Lists the notification targets attached to one service. Use this to discover target IDs before updating or deleting a target.",operationId:"listServiceNotificationTargets",tags:["services"],url:Il,method:"GET",params:r.Object({serviceId:bl}),response:r.Array(Sl)}),MY=r.Pick(Mg,["config","rateLimit"],{description:"Service notification target create request. Provide the delivery destination and an optional per-target rate limit.",examples:[Hg]}),DY=r.Pick(Dg,["config","rateLimit"],{description:"Service notification target update request. The submitted destination and rate limit overwrite the stored ones.",examples:[Hg]}),KXe=d({description:"Attaches a notification target to a service. Adaptive notification rules matching the service page this target on alert transitions.",operationId:"createServiceNotificationTarget",tags:["services"],url:Il,method:"POST",params:r.Object({serviceId:bl}),body:MY,response:Sl}),zXe=d({description:"Updates one notification target attached to a service.",operationId:"updateServiceNotificationTarget",tags:["services"],url:`${Il}/:targetId`,method:"PUT",params:r.Object({serviceId:bl,targetId:p({allowEmpty:!1,description:"Identifier of the notification target to update. Use the `id` returned by service notification target list or create responses."})}),body:DY,response:Sl}),YXe=d({description:"Detaches a notification target from a service. Notification rules stop paging this destination for the service.",operationId:"deleteServiceNotificationTarget",tags:["services"],url:`${Il}/:targetId`,method:"DELETE",params:r.Object({serviceId:bl,targetId:p({allowEmpty:!1,description:"Identifier of the notification target to delete. Use the `id` returned by service notification target list or create responses."})}),response:v});function pv(e,t){let n=t??tr(e);return n===void 0?void 0:Ko(n)}function Kg(e){let t=tr(e);return t===void 0?"":` (default: ${t})`}function uv(e,t){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${Ue}${Kg("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Kg("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter graph spans${Kg("query")}`).action(async(o,i)=>{let a={},c=pv("from",i.from),l=pv("to",i.to);c!==void 0&&(a.from=c),l!==void 0&&(a.to=l),i.query!==void 0&&(a.query=i.query);let m=await t()(cv,{params:{serviceId:o},query:a});Q(m)})}var GY=`/${"v1"}/grok`,$Y=25,FY=100,lv=r.Object({rules:r.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:$Y,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:r.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:FY,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."}),jY={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(lv,{examples:[jY]});var mv=r.Object({results:r.Array(r.Object({sample:r.String({description:"Echo of the submitted log line, so results can be matched to the samples in the request."}),matched:r.Boolean({description:"Whether any submitted rule matched this sample. `true` means `extracted` contains the captured fields; `false` means no rule matched."}),extracted:r.Union([r.Record(r.String(),r.Unknown()),r.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."}),qY={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(mv,{examples:[qY]});var dv=d({url:`${GY}/parse`,method:"POST",operationId:"parseGrok",tags:["public","grok"],body:lv,response:mv,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`."});function fv(e,t){let n=e.command("grok").description("Test and preview grok parsing rules");hr(n,"parse","Parse sample log lines with grok rules and return the extracted fields",dv,t)}var gv=require("node:child_process"),hv=require("node:fs"),yv=require("node:os"),xl=require("node:path");var vo=require("node:fs");function Ks(e,t){let n=`${e}.tmp.${process.pid}`;(0,vo.writeFileSync)(n,t),(0,vo.renameSync)(n,e)}function zs(e){try{return(0,vo.readFileSync)(e,"utf8")}catch(t){if(t.code==="ENOENT")return;throw t}}function Ys(e,t){if(t===void 0)return;let n=`${e}.bak.${new Date().toISOString().replaceAll(":","-")}`;return(0,vo.writeFileSync)(n,t),n}function No(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var zg="tsuga-dev/agent-plugins",Ol="tsuga";function Al(e,t){z(` $ ${e} ${t.join(" ")}`);try{(0,gv.execFileSync)(e,t,{stdio:["ignore","inherit","inherit"]})}catch(n){let o=n.status??1;throw new Error(`${e} ${t.join(" ")} exited ${o}`,{cause:n})}}function BY(e,t){z("Claude Code \u2192 installing Tsuga plugin"),Al("claude",["plugin","marketplace","add",zg]),Al("claude",["plugin","install",`tsuga@${Ol}`]),t.autoUpdate&&HY(e)}function HY(e){let t=(0,xl.join)(e,".claude","settings.json");z(`Claude Code \u2192 ${t} (autoUpdate)`),(0,hv.mkdirSync)((0,xl.dirname)(t),{recursive:!0});let n=zs(t),o=JSON.parse(n??"{}");if(!No(o))throw new Error(`${t} must contain a JSON object`);let i=o.extraKnownMarketplaces??{};if(!No(i))throw new Error(`${t} "extraKnownMarketplaces" must be a JSON object`);let a=i[Ol],c=No(a)?a:{};o.extraKnownMarketplaces={...i,[Ol]:{source:{source:"github",repo:zg},...c,autoUpdate:!0}};let l=Ys(t,n);Ks(t,`${JSON.stringify(o,null,2)}
145
- `),z(l===void 0?" created":` patched (backup: ${l})`)}function KY(){z("Codex \u2192 installing Tsuga plugin"),Al("codex",["plugin","marketplace","add",zg]),Al("codex",["plugin","add",`tsuga@${Ol}`])}function Tv(e){let t=e.command("install").description("Install Tsuga plugins into local LLM CLIs").command("plugin").description("Install the Tsuga plugin into a specific LLM CLI");t.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=>{BY((0,yv.homedir)(),n),z("Restart your claude session to load the new plugins.")}),t.command("codex").description("Install the Tsuga plugin into Codex (requires the codex CLI in PATH)").action(()=>{KY(),z("Restart your codex session to load the new plugins.")})}var zY=10,YY=r.Object({key:p({allowEmpty:!1,description:"Telemetry attribute key to scope the ranking by: a service, environment, team, route, or other positive equality term in the population you want fields for. Use dot-path keys such as `context.service.name`."}),value:r.Optional(p({allowEmpty:!1,description:"Attribute value the scoped telemetry should match, when the scope is a specific service, environment, team, route, or other known value. When omitted, artifacts that reference the key match this entry at full weight regardless of value."})),valueMustMatch:r.Optional(r.Boolean({description:"When true, this entry is a hard filter rather than a weight: any widget or monitor that does not match it exactly (key = value) contributes no fields at all, instead of contributing at a reduced weight. Other widgets of the same dashboard still contribute if they match. Requires `value`."}))}),Yg=r.Object({field:r.String({description:"Field name to use in queries. For `kind: attribute`, this is an attribute dot path. For `kind: metric`, this is either a metric name or a `metricName.context.attribute` path when the metric query used a metric attribute."}),kind:r.Enum(["attribute","metric"],{description:"Whether the field is a telemetry attribute or a metric name. `metric` appears only in the metrics bucket, for fields referenced as the aggregated field of a metrics-source query."}),inferredType:r.Enum(["numeric","categorical","unknown"],{description:"Value type inferred from how the field is used: `numeric` when aggregated with sum/average/percentile, referenced by numeric or range filters, or a metric name; `categorical` when only grouped by or matched with equality/text filters; `unknown` otherwise. Evidence-based \u2014 a numeric field used only in equality filters reads as categorical."}),score:r.Number({description:"Relative relevance score computed by Tsuga from how strongly readable dashboards and monitors use this field for the requested scope, discounted when the field is common across the whole organization. Higher values mean stronger evidence that the field is useful for this scope. Scores are intended for ranking, not for comparison across unrelated scopes."}),artifacts:r.Number({description:"Number of distinct readable dashboards and monitors that reference this field and match the requested scope. Tsuga counts an artifact once per field even if it uses the field in multiple widgets or queries."}),globalArtifacts:r.Number({description:"Number of organization-wide dashboards and monitors that reference this field, regardless of the requested scope or caller permissions. Tsuga uses this anonymous baseline to down-rank fields that are common everywhere."}),usage:r.Object({groupBy:r.Number({description:"Number of distinct readable matching artifacts that use this field as a group-by or split dimension."}),filter:r.Number({description:"Number of distinct readable matching artifacts that filter on this field in widget queries, monitor queries, or dashboard-wide filters."}),measure:r.Number({description:"Number of distinct readable matching artifacts that aggregate this field as `aggregate.field`."}),column:r.Number({description:"Number of distinct readable matching artifacts that pin this field as a list-widget column."})},{description:"Distinct-artifact counts by usage kind, explaining why the field ranked where it did; a dashboard referencing the field the same way in many widgets counts once for that usage kind."})}),Vg=r.Object({logs:r.Array(Yg,{description:"Top log fields for the requested scope, ranked by score and mined from readable logs-sourced dashboards and monitors."}),traces:r.Array(Yg,{description:"Top trace fields for the requested scope, ranked by score and mined from readable traces-sourced dashboards and monitors."}),metrics:r.Array(Yg,{description:"Top metric names and metric-attribute fields for the requested scope, ranked by score and mined from readable metrics-sourced dashboards and monitors."}),dashboardsMatched:r.Number({description:"Number of dashboards that matched the requested scope and that the caller can read. Dashboards the caller cannot read are removed before field rankings are returned."}),monitorsMatched:r.Number({description:"Number of monitors that matched the requested scope and that the caller can read. Monitors the caller cannot read are removed before field rankings are returned."})}),Qg=r.Object({scope:r.Array(YY,{minItems:1,maxItems:zY,description:"Scope entries that define the population to rank fields for, drawn from positive equality pairs in a TQL query, such as service and environment. Tsuga matches entries softly by default: an artifact's contribution is weighted by the fraction of entries it matches."})}),hJe=d({tags:["interesting-fields"],url:"/v0/interesting-fields",method:"POST",body:Qg,response:Vg});var VY=`/${"v1"}/interesting-fields`,QY={scope:[{key:"context.service.name",value:"payments"},{key:"context.env",value:"prod",valueMustMatch:!0}]},WY=r.Object(Qg.properties,{description:"The scope to rank fields for, as attribute key/value pairs such as a service name and an environment. Entries are matched softly by default: a widget contributes in proportion to how many entries it matches, so a broader scope returns a broader ranking. Set `valueMustMatch` on an entry to make it a hard filter instead: a widget that does not match it exactly contributes nothing, even when other entries match.",examples:[QY]}),Ev=d({url:VY,method:"POST",operationId:"getInterestingFields",tags:["public","interesting-fields"],body:WY,response:Vg,description:"Ranks the telemetry fields most relevant to a scope, mined from how the org already uses them in dashboards and monitors, bucketed by logs, traces, and metrics. Use this before guessing a field or metric name: a field that many scope-matching dashboards group or filter on is the one an operator would reach for. Ranking is TF-IDF style, so a field used everywhere in the org scores below one that is distinctive to the scope. Dashboards and monitors the caller cannot read never contribute field names, only the anonymous frequency baseline. The operation requires public API read access to dashboards and monitors."});function _v(e,t){let n=e.command("interesting-fields").description("Discover the telemetry fields an org already uses for a scope");hr(n,"list","Rank the log, trace and metric fields most relevant to a scope, mined from dashboards and monitors",Ev,t)}var ir="/v0/kubernetes-explorer",ZY="^[a-z0-9.-]+$",XY="^[A-Za-z0-9._-]+$",Iv=256,Sv=r.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 or=e=>r.Optional(r.Array(p({allowEmpty:!1}),{description:e})),bv=["clusters","namespaces","teams","envs"],Rl="Names of other filter fields in this query whose values exclude rather than include. Set this to a field name to keep only the resources matching none of that field's values; fields left out keep the resources matching any of their values.",Wg={clusterId:Sv,search:r.Optional(r.String({pattern:ZY,minLength:1,maxLength:Iv,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."}))},Ov={clusterId:Sv,search:r.Optional(r.String({pattern:XY,minLength:1,maxLength:Iv,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."}))},Av=r.Object(Wg),xv=r.Object(Ov),Vs={...Wg,includeInternalNamespaces:r.Optional(r.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:or("Restrict results to these Kubernetes cluster names."),namespaces:or("Restrict results to these namespaces."),teams:or("Restrict results to these team names."),envs:or("Restrict results to these environments."),exclusiveFilters:r.Optional(r.Array(r.Enum(bv),{description:Rl})),...le},JY=["Pending","Running","Succeeded","Failed","Unknown","CrashLoopBackOff","Error"],e3=[...bv,"nodes","deployments","statefulsets","daemonsets","podStatus"],t3={...Vs,nodes:or("Restrict results to pods scheduled on these nodes."),deployments:or("Restrict results to pods owned by these Deployments."),statefulsets:or("Restrict results to pods owned by these StatefulSets."),daemonsets:or("Restrict results to pods owned by these DaemonSets."),podStatus:or("Restrict results to pods whose resolved status matches any of these values. Typical values are 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. When exclusiveFilters includes podStatus, keep pods whose status matches none of these values instead."),exclusiveFilters:r.Optional(r.Array(r.Enum(e3),{description:`${Rl} Excluding podStatus is applied after stitching pod phase and container status reason telemetry, because phase is not a filterable metric attribute.`}))},r3=["deployment","statefulset","daemonset"],Rv=r.Object({kind:r.Enum(r3,{description:"Kind of Kubernetes workload associated with the pod. Derived from workload attributes in pod telemetry."}),name:r.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."}),Cv=r.Object({podName:r.String({description:"Name of the Kubernetes pod. Set when the pod is created."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the pod. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that reported the pod. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the pod. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the pod, such as production or staging. Present when an environment label or mapping is observed."})),node:r.Optional(r.String({description:"Kubernetes node currently or most recently running the pod. Present when node telemetry is observed."})),phase:r.Enum(JY,{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:r.Integer({description:"Number of containers in the pod that are currently ready. From container readiness telemetry. Zero or greater."}),totalContainers:r.Integer({description:"Number of observed containers for the pod based on container readiness telemetry. Zero or greater."}),restarts:r.Integer({description:"Total restart count across containers in the pod. From container restart telemetry. Zero or greater."}),createdAt:r.Optional(S({description:"Timestamp from pod start time telemetry for the selected pod instance. Present when pod start time telemetry is observed."}))}),Zg=r.Object({...Cv.properties,workload:r.Optional(Rv),cpuUsageMilli:r.Optional(r.Number({description:"Recent pod CPU usage in millicores. Present when CPU usage telemetry is observed."})),cpuLimitMilli:r.Optional(r.Number({description:"Configured pod CPU limit in millicores, summed across observed containers. Present when a CPU limit is configured and observed."})),cpuRequestMilli:r.Optional(r.Number({description:"Configured pod CPU request in millicores, summed across observed containers. Present when a CPU request is configured and observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent pod memory usage in bytes. Present when memory usage telemetry is observed."})),memoryLimitBytes:r.Optional(r.Number({description:"Configured pod memory limit in bytes, summed across observed containers. Present when a memory limit is configured and observed."})),memoryRequestBytes:r.Optional(r.Number({description:"Configured pod memory request in bytes, summed across observed containers. Present when a memory request is configured and observed."})),cpuUtilization:r.Optional(r.Number({description:"Recent CPU usage divided by the configured CPU limit. Present when both usage and limit are observed."})),memoryUtilization:r.Optional(r.Number({description:"Recent memory usage divided by the configured memory limit. Present when both usage and limit are observed."})),cpuRequestUtilization:r.Optional(r.Number({description:"Recent CPU usage divided by the configured CPU request. Present when both usage and request are observed."})),memoryRequestUtilization:r.Optional(r.Number({description:"Recent memory usage divided by the configured memory request. Present when both usage and request are observed."}))}),n3=["podName","namespace","cluster","team","env","node","phase","restarts","cpuUsageMilli","cpuUtilization","cpuRequestUtilization","memoryUsageBytes","memoryUtilization","memoryRequestUtilization","createdAt"],PJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ir}/pods`,query:r.Object({...t3,sortBy:r.Optional(r.Enum(n3,{description:"Field to sort pods by."})),sortDirection:r.Optional(ne)}),paginated:!0,response:r.Array(Zg)}),o3=["teams","envs"],Xg=r.Object({cluster:r.String({description:"Kubernetes cluster name from cluster telemetry."}),teams:r.Optional(r.Array(r.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:r.Optional(r.Array(r.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:r.Optional(r.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:r.Optional(r.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:r.Optional(r.Integer({description:"Number of Kubernetes nodes in the cluster that are ready. Present when node readiness telemetry is observed."})),podPhaseCounts:r.Optional(r.Object({Pending:r.Integer({description:"Number of observed pods currently in the Pending phase."}),Running:r.Integer({description:"Number of observed pods currently in the Running phase."}),Succeeded:r.Integer({description:"Number of observed pods currently in the Succeeded phase."}),Failed:r.Integer({description:"Number of observed pods currently in the Failed phase."}),Unknown:r.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."}))}),i3=["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes"],UJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ir}/clusters`,query:r.Object({...Ov,teams:or("Restrict to clusters that host workloads from these team names."),envs:or("Restrict to clusters that host workloads in these environments."),exclusiveFilters:r.Optional(r.Array(r.Enum(o3),{description:Rl})),sortBy:r.Optional(r.Enum(i3,{description:"Field to sort clusters by."})),sortDirection:r.Optional(ne),...le}),paginated:!0,response:r.Array(Xg)}),a3=["clusters"],s3=["Ready","NotReady","Unknown"],Jg=r.Object({node:r.String({description:"Kubernetes node name from node telemetry."}),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the node. Present when cluster telemetry is observed."})),status:r.Optional(r.Enum(s3,{description:"Readiness of the node, derived from its Ready condition. Present when node condition telemetry is observed."})),instanceType:r.Optional(r.String({description:"Cloud instance type backing the node (for example `r7g.2xlarge`). Present when host telemetry is observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods scheduled on the node, including pods in internal namespaces since they occupy node capacity. Present when pod telemetry is observed."})),allocatablePods:r.Optional(r.Integer({description:"Maximum number of pods the node can run. Present when node allocatable telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent CPU usage for the node, in millicores. Reported by the kubelet, so it is absent on nodes that only report cluster-level telemetry."})),cpuAllocatableMilli:r.Optional(r.Number({description:"CPU available to pods on the node, in millicores. Present when node allocatable telemetry is observed."})),cpuUtilization:r.Optional(r.Number({description:"Node CPU usage divided by allocatable CPU. Present when both usage and allocatable telemetry are observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent memory usage for the node, in bytes. Reported by the kubelet, so it is absent on nodes that only report cluster-level telemetry."})),memoryAllocatableBytes:r.Optional(r.Number({description:"Memory available to pods on the node, in bytes. Present when node allocatable telemetry is observed."})),memoryUtilization:r.Optional(r.Number({description:"Node memory usage divided by allocatable memory. Present when both usage and allocatable telemetry are observed."}))}),c3=["node","cluster","status","instanceType","pods","allocatablePods","cpuUsageMilli","cpuAllocatableMilli","cpuUtilization","memoryUsageBytes","memoryAllocatableBytes","memoryUtilization"],wJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ir}/nodes`,query:r.Object({...Wg,clusters:or("Restrict results to these Kubernetes cluster names."),exclusiveFilters:r.Optional(r.Array(r.Enum(a3),{description:Rl})),sortBy:r.Optional(r.Enum(c3,{description:"Field to sort nodes by."})),sortDirection:r.Optional(ne),...le}),paginated:!0,response:r.Array(Jg)}),eh=r.Object({namespace:r.String({description:"Kubernetes namespace name from namespace telemetry. Includes namespaces with no observed pods when namespace telemetry is observed."}),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the namespace. Present when cluster telemetry is observed."})),teams:r.Optional(r.Array(r.String(),{description:"Team metadata values observed in workloads in the namespace. Present when team labels or mappings are observed."})),envs:r.Optional(r.Array(r.String(),{description:"Environment metadata values observed in workloads in the namespace. Present when environment labels or mappings are observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods in the namespace. Present when pod telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Aggregate recent CPU usage for observed pods in the namespace, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Aggregate recent memory usage for observed pods in the namespace, in bytes. Present when memory usage telemetry is observed."}))}),p3=["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],vJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ir}/namespaces`,query:r.Object({...Vs,sortBy:r.Optional(r.Enum(p3,{description:"Field to sort namespaces by."})),sortDirection:r.Optional(ne)}),paginated:!0,response:r.Array(eh)}),th=r.Object({deployment:r.String({description:"Kubernetes Deployment name from workload telemetry."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the Deployment. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the Deployment. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the Deployment. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the Deployment. Present when an environment label or mapping is observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods associated with the Deployment. Present when pod telemetry and workload attributes are observed."})),availableReplicas:r.Optional(r.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:r.Optional(r.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent aggregate CPU usage for observed Deployment pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent aggregate memory usage for observed Deployment pods, in bytes. Present when memory usage telemetry is observed."}))}),u3=["deployment","namespace","cluster","team","env","pods","availableReplicas","cpuUsageMilli","memoryUsageBytes"],NJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ir}/deployments`,query:r.Object({...Vs,sortBy:r.Optional(r.Enum(u3,{description:"Field to sort deployments by."})),sortDirection:r.Optional(ne)}),paginated:!0,response:r.Array(th)}),rh=r.Object({statefulSet:r.String({description:"Kubernetes StatefulSet name from workload telemetry."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the StatefulSet. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the StatefulSet. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the StatefulSet. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the StatefulSet. Present when an environment label or mapping is observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods associated with the StatefulSet. Present when pod telemetry and workload attributes are observed."})),readyReplicas:r.Optional(r.Integer({description:"Number of ready StatefulSet replicas from StatefulSet status telemetry. Present when StatefulSet status is observed."})),desiredReplicas:r.Optional(r.Integer({description:"Desired replica count configured for the StatefulSet. Present when StatefulSet spec telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent aggregate CPU usage for observed StatefulSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent aggregate memory usage for observed StatefulSet pods, in bytes. Present when memory usage telemetry is observed."}))}),l3=["statefulSet","namespace","cluster","team","env","pods","cpuUsageMilli","memoryUsageBytes"],LJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ir}/statefulsets`,query:r.Object({...Vs,sortBy:r.Optional(r.Enum(l3,{description:"Field to sort StatefulSets by."})),sortDirection:r.Optional(ne)}),paginated:!0,response:r.Array(rh)}),nh=r.Object({daemonSet:r.String({description:"Kubernetes DaemonSet name from workload telemetry."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the DaemonSet. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the DaemonSet. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the DaemonSet. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the DaemonSet. Present when an environment label or mapping is observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods associated with the DaemonSet. Present when pod telemetry and workload attributes are observed."})),readyNodes:r.Optional(r.Integer({description:"Number of eligible nodes with a ready DaemonSet pod. Present when DaemonSet status telemetry is observed."})),desiredNodes:r.Optional(r.Integer({description:"Number of eligible nodes where the DaemonSet should run a pod. Present when DaemonSet status telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent aggregate CPU usage for observed DaemonSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent aggregate memory usage for observed DaemonSet pods, in bytes. Present when memory usage telemetry is observed."}))}),m3=["daemonSet","namespace","cluster","team","env","pods","readyNodes","cpuUsageMilli","memoryUsageBytes"],kJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ir}/daemonsets`,query:r.Object({...Vs,sortBy:r.Optional(r.Enum(m3,{description:"Field to sort DaemonSets by."})),sortDirection:r.Optional(ne)}),paginated:!0,response:r.Array(nh)}),oh=r.Object({overview:r.Object({...Cv.properties,workload:r.Optional(Rv)},{description:"Pod identity, status, and owning workload, derived from recent pod metrics."}),healthMetrics:r.Object({cpu:r.Object({usage:r.String({description:"Metric name callers can use to query pod CPU usage. This is not the current CPU value."}),limit:r.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:r.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:r.Object({usage:r.String({description:"Metric name callers can use to query pod memory usage. This is not the current memory value."}),limit:r.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:r.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:r.Object({logs:r.String({description:"TQL log search filter scoped to this pod. Built from cluster, namespace, and pod identifiers."}),traces:r.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."})}),Pv=r.Object({clusterId:r.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),podName:p({allowEmpty:!1})}),MJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ir}/pod-details`,query:Pv,response:oh}),ih=r.Object({configuration:r.Optional(r.Object({spec:r.Record(r.String(),r.Unknown(),{description:"Kubernetes PodSpec from the latest observed pod manifest. Fields outside `object.spec` are stripped."}),lastObservedAt:S({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:r.Record(r.String(),r.String(),{description:"Kubernetes labels on the pod from the latest observed pod manifest. Key-value strings."}),annotations:r.Record(r.String(),r.String(),{description:"Kubernetes annotations on the pod from the latest observed pod manifest. Key-value strings."}),deletedAt:r.Optional(S({description:"Timestamp when Tsuga last observed the pod deletion event. Present when the latest observed pod event is deleted."}))}),DJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ir}/pod-manifest`,query:Pv,response:ih}),ah=r.Object({podName:r.String({description:"Name of a pod instance associated with the workload. Resolved from recent pod usage telemetry and workload attributes."}),podUid:r.Optional(r.String({description:"Kubernetes UID for the pod replica. Present when UID telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent CPU usage for the pod replica, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.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."}),sh=r.Object({overview:r.Object({deploymentName:r.String({description:"Kubernetes Deployment name for this detail response."}),namespace:r.Optional(r.String({description:"Kubernetes namespace for this detail response. Present when any deployment signal is found."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name for this detail response. Present when any deployment signal is found."})),team:r.Optional(r.String({description:"Team metadata from the Deployment available-replica metric. Present when the metric includes team metadata."})),env:r.Optional(r.String({description:"Environment metadata from the Deployment available-replica metric. Present when the metric includes environment metadata."})),availableReplicas:r.Optional(r.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:r.Optional(r.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),latestRevisionAt:r.Optional(S({description:"Latest ReplicaSet metadata.creationTimestamp observed for the Deployment. Present when ReplicaSet object telemetry is observed."}))}),podReplicas:r.Array(ah,{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:r.Array(r.Object({replicaSetName:r.String({description:"ReplicaSet name for a Deployment revision from workload telemetry."}),revision:r.Integer({description:"Deployment revision number from ReplicaSet annotations. Integer greater than or equal to zero."}),firstSeen:r.Optional(S({description:"ReplicaSet metadata.creationTimestamp from the latest observed ReplicaSet object. Present when creation time is observed."})),observedGeneration:r.Optional(r.Integer({description:"Latest generation observed for the ReplicaSet revision. Present when generation telemetry is observed."})),readyReplicas:r.Optional(r.Integer({description:"Number of ready replicas for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),replicas:r.Optional(r.Integer({description:"Total replica count for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),logsSearchFilter:r.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."})}),GJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ir}/deployment-details`,query:r.Object({clusterId:r.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),deploymentName:p({allowEmpty:!1})}),response:sh}),d3=r.Object({overview:r.Object({statefulSetName:r.String(),namespace:r.Optional(r.String()),cluster:r.Optional(r.String()),team:r.Optional(r.String()),env:r.Optional(r.String()),readyReplicas:r.Optional(r.Integer()),desiredReplicas:r.Optional(r.Integer()),latestRevisionAt:r.Optional(S())}),podReplicas:r.Array(ah,{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:r.Array(r.Object({revisionName:r.String(),firstSeen:r.Optional(S())}))}),$Je=d({tags:["kubernetes-explorer"],method:"GET",url:`${ir}/statefulset-details`,query:r.Object({clusterId:r.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),statefulSetName:p({allowEmpty:!1})}),response:d3}),f3=r.Object({overview:r.Object({daemonSetName:r.String(),namespace:r.Optional(r.String()),cluster:r.Optional(r.String()),team:r.Optional(r.String()),env:r.Optional(r.String()),readyNodes:r.Optional(r.Integer()),desiredNodes:r.Optional(r.Integer()),latestRevisionAt:r.Optional(S())}),podReplicas:r.Array(ah,{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:r.Array(r.Object({observedGeneration:r.Integer(),firstSeen:r.Optional(S())}))}),FJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ir}/daemonset-details`,query:r.Object({clusterId:r.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),daemonSetName:p({allowEmpty:!1})}),response:f3});var Dr=`/${"v1"}/kubernetes-explorer`,Uv=r.Pick(Zg,["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."}),g3={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(Uv,{examples:[g3]});var wv=r.Pick(Xg,["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes","podPhaseCounts"],{description:"A Kubernetes cluster with aggregate resource usage, node readiness, and pod phase counts."}),h3={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(wv,{examples:[h3]});var vv=r.Pick(eh,["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes namespace with pod count and aggregate resource usage."}),y3={namespace:"production",cluster:"prod-us-east",teams:["platform"],envs:["production"],pods:24,cpuUsageMilli:1800,memoryUsageBytes:3221225472};Object.assign(vv,{examples:[y3]});var Nv=r.Pick(Jg,["node","cluster","status","instanceType","pods","allocatablePods","cpuUsageMilli","cpuAllocatableMilli","cpuUtilization","memoryUsageBytes","memoryAllocatableBytes","memoryUtilization"],{description:"A Kubernetes node with its readiness, instance type, and usage against what it can allocate to pods."}),T3={node:"ip-10-0-1-23.ec2.internal",cluster:"prod-us-east",status:"Ready",instanceType:"r7g.2xlarge",pods:25,allocatablePods:234,cpuUsageMilli:4e3,cpuAllocatableMilli:8e3,cpuUtilization:.5,memoryUsageBytes:4e9,memoryAllocatableBytes:16e9,memoryUtilization:.25};Object.assign(Nv,{examples:[T3]});var Lv=r.Pick(th,["deployment","namespace","cluster","team","env","pods","availableReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes deployment with replica counts and aggregate resource usage."}),E3={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(Lv,{examples:[E3]});var kv=r.Pick(rh,["statefulSet","namespace","cluster","team","env","pods","readyReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes StatefulSet with replica counts and aggregate resource usage."}),_3={statefulSet:"postgres",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,readyReplicas:3,desiredReplicas:3,cpuUsageMilli:900,memoryUsageBytes:2147483648};Object.assign(kv,{examples:[_3]});var Mv=r.Pick(nh,["daemonSet","namespace","cluster","team","env","pods","readyNodes","desiredNodes","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes DaemonSet with eligible-node readiness and aggregate resource usage."}),I3={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(Mv,{examples:[I3]});var Dv=r.Pick(oh,["overview","healthMetrics","searchFilters"],{description:"Metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and log/trace filters."}),S3={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(Dv,{examples:[S3]});var Gv=r.Pick(ih,["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."}),b3={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(Gv,{examples:[b3]});var $v=r.Pick(sh,["overview","podReplicas","revisions"],{description:"Detailed information for a single Kubernetes deployment: replica status, backing pods, and rollout revisions."}),O3={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($v,{examples:[O3]});var Fv=r.Object({clusterId:r.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."}))}),Qi=r.Pick(Av,["clusterId","search"]),A3=r.Pick(xv,["clusterId","search"]),jv=d({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:`${Dr}/pods`,query:Qi,response:r.Array(Uv)}),qv=d({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:`${Dr}/clusters`,query:A3,response:r.Array(wv)}),Bv=d({description:"Lists Kubernetes namespaces observed across the organization with pod counts and aggregate resource usage.",operationId:"listKubernetesNamespaces",tags:["public","kubernetes-explorer"],method:"GET",url:`${Dr}/namespaces`,query:Qi,response:r.Array(vv)}),Hv=d({description:"Lists Kubernetes nodes observed across the organization with their readiness, instance type, and resource usage against allocatable capacity.",operationId:"listKubernetesNodes",tags:["public","kubernetes-explorer"],method:"GET",url:`${Dr}/nodes`,query:Qi,response:r.Array(Nv)}),Kv=d({description:"Lists Kubernetes deployments observed across the organization with replica counts and aggregate resource usage.",operationId:"listKubernetesDeployments",tags:["public","kubernetes-explorer"],method:"GET",url:`${Dr}/deployments`,query:Qi,response:r.Array(Lv)}),zv=d({description:"Lists Kubernetes StatefulSets observed across the organization with replica counts and aggregate resource usage.",operationId:"listKubernetesStatefulSets",tags:["public","kubernetes-explorer"],method:"GET",url:`${Dr}/statefulsets`,query:Qi,response:r.Array(kv)}),Yv=d({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:`${Dr}/daemonsets`,query:Qi,response:r.Array(Mv)}),Vv=r.Object({...Fv.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."})}),Qv=d({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:`${Dr}/pod-details`,query:Vv,response:Dv}),Wv=d({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:`${Dr}/pod-manifest`,query:Vv,response:Gv}),Zv=d({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:`${Dr}/deployment-details`,query:r.Object({...Fv.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:$v});var x3="clusterId";function Xv(e,t,n){let o=t.query.properties??{},i=Object.keys(o).filter(a=>a!==x3);for(let a of i){let c=a.replace(/([A-Z])/g,"-$1").toLowerCase(),l=c.replace(/-/g,"_").toUpperCase(),m=o[a]?.description??"";n?e.requiredOption(`--${c} <${l}>`,m):e.option(`--${c} <${l}>`,m)}return i}function Lo(e,t,n,o){let i=e.command(t).description(n.description??`List Kubernetes ${t}`),a=Xv(i,n,!1);i.action(async c=>{let l={};for(let m of a)c[m]!==void 0&&(l[m]=c[m]);Q(Object.keys(l).length>0?await o()(n,{query:l}):await o()(n))})}function ch(e,t,n,o){let i=e.command(t).description(n.description??`Get Kubernetes ${t}`),a=Xv(i,n,!0);i.action(async c=>{let l={};for(let m of a)l[m]=c[m];Q(await o()(n,{query:l}))})}function Jv(e,t){let n=e.command("kubernetes").description("Explore Kubernetes resources observed across the organization");Lo(n,"pods",jv,t),Lo(n,"clusters",qv,t),Lo(n,"namespaces",Bv,t),Lo(n,"nodes",Hv,t),Lo(n,"deployments",Kv,t),Lo(n,"statefulsets",zv,t),Lo(n,"daemonsets",Yv,t),ch(n,"pod-details",Qv,t),ch(n,"pod-manifest",Wv,t),ch(n,"deployment-details",Zv,t)}var R3=r.Union([r.Literal("scalar"),r.Literal("timeseries")]),C3="/v0/promql",Cl=r.Object({query:p({type:"long",allowEmpty:!1,description:"PromQL expression to evaluate."}),timeRange:Un,step:p({allowEmpty:!1,description:"Evaluation step interval (e.g. `1m`, `5m`, `1h`). Must be a valid Prometheus duration string."}),returnType:r.Optional(R3),executionOptions:Vd,shouldStreamResults:r.Optional(r.Boolean()),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster to target. Defaults to the first cluster created in the organization when omitted."}))}),P3={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(Cl,{examples:[P3]});var net=d({tags:["promql"],url:C3,method:"POST",body:Cl,response:Ai});var U3=`/${"v1"}/promql`,w3=r.Object({...r.Pick(Cl,["query","step"]).properties,timeRange:Tt},{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"}]}),v3=r.Object({clusterId:r.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."}))}),eN=d({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:U3,method:"POST",body:w3,query:v3,response:Du});function tN(e,t){let n=e.command("promql").description("Run PromQL queries over metric data");hr(n,"query","Run a PromQL range query over metric data",eN,t)}var Zi="/v0/dashboard-folders",Xi=r.Object({id:r.String({description:"Tsuga-generated dashboard folder ID assigned when the folder is created. Use it as dashboard `folderId` or child-folder `parentFolderId`."}),name:r.String({description:"Display name of the dashboard folder. Set by the caller on create or update."}),owner:r.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:r.Optional(r.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:ve,creator:r.Optional(se),updater:r.Optional(se),createdAt:S(),updatedAt:S()},{title:"DashboardFolder"}),ph=r.Object({...Xi.properties,dashboardCount:r.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."})}),Pl=r.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:r.Optional(r.Union([r.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:De}),Ul=r.Partial(r.Object({owners:Ie(p({allowEmpty:!1}),{description:"Restrict results to dashboard folders owned by any of these team IDs",maxItems:50}),searchQuery:r.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:r.Optional(r.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:Ie(Yt.items,{description:"Restrict results to dashboard folders that have at least one of the listed key/value tags",maxItems:50}),parentFolderId:r.Union([r.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"})),Wi={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",DASHBOARD_COUNT:"dashboardCount",UPDATED_AT:"updatedAt",NAME:"name"},uh=[Wi.OWNER,Wi.TAGS,Wi.DASHBOARD_COUNT,Wi.UPDATED_AT,Wi.NAME],N3=r.Partial(r.Object({...le,filters:Ul,sort:r.Object({by:r.Enum([...uh,Wi.IS_FAVORITE],{description:"Field to sort the returned dashboard folders by"}),direction:ne},{description:"Optional sorting applied to the returned dashboard folders"})})),Oet=d({tags:["dashboard-folders"],url:`${Zi}/query`,method:"POST",paginated:!0,body:N3,response:r.Array(ph)}),Aet=d({tags:["dashboard-folders"],url:`${Zi}/:id`,method:"GET",params:r.Object({id:p()}),response:Xi}),xet=d({tags:["dashboard-folders"],url:Zi,method:"POST",body:Pl,response:Xi}),Ret=d({tags:["dashboard-folders"],url:`${Zi}/:id`,method:"PUT",params:r.Object({id:p()}),body:Pl,response:Xi}),Cet=d({tags:["dashboard-folders"],url:`${Zi}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),Pet=d({tags:["dashboard-folders"],url:`${Zi}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Omit(Ul,["tags"]))}),response:zt});var Qs=`/${"v1"}/dashboard-folders`,wl=r.Pick(Xi,["id","name","owner","parentFolderId","tags"],{$id:"DashboardFolder",description:"Folder used to organize dashboards into a two-level hierarchy"}),rN={id:"123-456-abc",name:"Platform",owner:"team-123-abc",tags:[{key:"team",value:"platform"}]};Object.assign(wl,{examples:[rN]});var nN=r.Pick(ph,["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."}),L3={...rN,dashboardCount:10};Object.assign(nN,{examples:[L3]});var lh=r.Pick(Pl,["name","owner","parentFolderId","tags"],{description:"Dashboard folder create or update request. Provide a name, owner team, optional parent folder, and optional tags."}),k3={name:"Platform",owner:"team-123-abc",parentFolderId:null,tags:[{key:"team",value:"platform"}]};Object.assign(lh,{examples:[k3]});var M3=r.Object({by:r.Enum(uh,{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:ne},{description:"Optional sorting applied to the returned dashboard folders"}),oN=r.Object({...qe,filters:r.Optional(r.Pick(Ul,["owners","searchQuery","tags","parentFolderId"])),sort:r.Optional(M3)},{description:"Dashboard folder query request. Use filters, sorting, limit, and offset to page through visible dashboard folders."}),D3={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(oN,{examples:[D3]});var iN=d({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:`${Qs}/query`,method:"POST",paginated:!0,body:oN,response:r.Array(nN)}),aN=d({description:"Retrieves one dashboard folder by ID.",operationId:"getDashboardFolder",tags:["dashboard-folders"],url:`${Qs}/:id`,method:"GET",params:r.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:wl}),sN=d({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:Qs,method:"POST",body:lh,response:wl}),cN=d({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:`${Qs}/:id`,method:"PUT",params:r.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:lh,response:wl}),pN=d({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:`${Qs}/:id`,method:"DELETE",params:r.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:v});var Gr="/v0/dashboards",lN=["white","gray.100","amber.200","lime.200","emerald.200","cyan.200","blue.200","violet.200","fuchsia.200","pink.200","red.200"],G3=["bar","distribution","gauge","heatmap","list","pie","query-value","table","timeseries","top-list"],Qet=[...G3,"note","slo"];var $3=["ns","us","ms","s","m","h","days"];var F3=["B","KB","MB","GB","TB","PB"];var j3=20;var mN=r.Object({type:r.Literal("cpu",{description:"Normalizes values as CPU usage"})},{$id:"DataNormalizerCpu",title:"CPU"}),dN=r.Object({type:r.Literal("duration",{description:"Normalizes values as durations using standard time units"}),unit:r.Enum($3,{description:"Time unit used to present the normalized values"})},{$id:"DataNormalizerDuration",title:"Duration"}),fN=r.Object({type:r.Literal("data",{description:"Normalizes values as data sizes using byte units"}),unit:r.Enum(F3,{description:"Data size unit used to present the normalized values"})},{$id:"DataNormalizerData",title:"Data"}),gN=r.Object({type:r.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"}),hN=r.Object({type:r.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"}),yN=r.Object({type:r.Literal("date",{description:"Formats values as calendar dates"})},{$id:"DataNormalizerDate",title:"Date"}),TN=r.Object({type:r.Literal("level",{description:"Displays values using their log level name"})},{$id:"DataNormalizerLevel",title:"Level"}),EN=r.Object({type:r.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"}),q3=r.Object({type:r.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:r.String({description:"Text label describing the custom unit"})},{$id:"DataNormalizerCustom",title:"Custom"}),B3=r.Object({type:r.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:r.String({description:"Text label describing the custom unit. Must not be empty.",minLength:1,maxLength:j3})},{$id:"InputDataNormalizerCustom",title:"Custom"}),Ut=R("type",[dN,fN,gN,hN,yN,TN,mN,EN,q3],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),wt=R("type",[dN,fN,gN,hN,yN,TN,mN,EN,B3],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),mh=r.Object({attribute:r.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:r.Optional(Ut)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),dh=r.Object({attribute:r.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:r.Optional(wt)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),Ji=["background","no-background"],H3=["table","legend-only","no-legend"];var K3=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"],_N=["alert","warning","success"],$r=r.Object({operator:r.Enum(K3,{description:"Comparator used to evaluate the metric value"}),value:r.Number({description:"Threshold value used when evaluating the operator"}),color:r.Enum(_N,{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."}),z3=r.Object({value:r.Number({description:"Y-axis value where the threshold marker is placed"}),level:r.Enum(_N,{description:"Level applied to the threshold marker"})},{title:"ThresholdMarker",description:"Marker line drawn across the chart at a fixed value, colored by its level."}),Y3=["sec","min","hour","day"],qn=r.Object({time:r.Number({description:"Numeric count of `metric` units in each bucket. Required when `timeBucket` is present."}),metric:r.Enum(Y3,{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 jn=r.Enum(["flex-start","center","flex-end"],{description:"Flex alignment keyword used for widget layout"}),ea=r.Object({formula:r.Optional(r.String({description:"Optional alias for formula (only used for display in the UI)"})),queries:r.Optional(r.Record(r.String(),r.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."}),ta=r.Object({formula:r.Optional(p({type:"short",description:"Optional alias for formula (only used for display in the UI)"})),queries:r.Optional(r.Record(r.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."}),Nl={source:fr,queries:vR,formula:r.Optional(Mu),aliases:r.Optional(ea),visibleSeries:r.Optional(r.Array(r.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},Ll={source:fr,queries:Os,formula:r.Optional(Io),aliases:r.Optional(ta),visibleSeries:r.Optional(r.Array(r.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},Fr=r.Optional(r.Enum(["relative","absolute"],{description:"Whether each group holds its own value or its percentage of the ungrouped total (defaults to absolute)"})),ra={...Nl,groupBy:r.Optional(xi)},na={...Ll,groupBy:r.Optional(Qr)},ze=r.Enum(H3,{description:"Controls whether and how the widget displays legend or series details (e.g. table, legend-only, or no legend)"}),Te=r.Optional(r.Union([r.Number(),r.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."})),ar=r.Optional(r.Array(z3,{description:"Threshold markers displayed on the chart"})),V3=r.Object({name:r.String({description:"Display name of the table column"}),...Nl,source:fr,normalizer:r.Optional(Ut),precision:Te},{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`."}),Q3=r.Object({name:p({description:"Display name of the table column"}),...Ll,source:fr,normalizer:r.Optional(wt),precision:Te},{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`."}),W3=r.Array(r.Object({id:r.String({description:"ID of the column to sort by"}),desc:r.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."}),Z3=r.Array(r.Object({id:p({description:"ID of the column to sort by"}),desc:r.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."}),fh=r.Array(r.Object({id:r.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:r.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."}),gh=r.Array(r.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:r.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."}),IN=["horizontal","vertical"],X3=r.Object({type:r.Literal("list",{description:"Displays matching logs in a tabular list"}),query:r.String({description:"Query that selects logs for the list"}),listColumns:r.Optional(r.Array(mh,{description:"Custom columns to display for each log"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to list widgets."})),defaultSorting:r.Optional(fh)},{$id:"GraphVisualizationList",title:"List"}),J3=r.Object({type:r.Literal("list",{description:"Displays matching logs in a tabular list"}),query:p({type:"tsuga-query",description:"Query that selects logs for the list"}),listColumns:r.Optional(r.Array(dh,{description:"Custom columns to display for each log"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.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:r.Optional(gh)},{$id:"InputGraphVisualizationList",title:"List"}),vl=R("type",[r.Object({type:r.Literal("auto",{description:"Automatically choose this axis bound"})}),r.Object({type:r.Literal("number",{description:"Use a fixed numeric axis bound"}),value:r.Number({description:"Fixed numeric axis bound value"})})],{description:"Axis bound mode: automatic or fixed numeric value"}),oa=r.Object({min:vl,max:vl,scale:R("type",[r.Object({type:r.Literal("pow",{description:"Power scale"}),exponent:r.Number({description:"Exponent used by the power scale"})}),r.Object({type:r.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:r.Boolean({description:"Whether the rendered Y axis should always include zero"})},{description:"Y-axis bounds and scale configuration for chart widgets."}),ia=r.Object({min:vl,max:vl,scale:R("type",[r.Object({type:r.Literal("pow",{description:"Power scale"}),exponent:r.Number({minimum:0,description:"Exponent used by the power scale"})}),r.Object({type:r.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:r.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."}),eV=r.Array(r.Integer({description:"Marker value expressed as a percentage between 0 and 100"}),{description:"Percentile markers displayed on top of the distribution chart"}),tV=r.Array(r.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 rV=["regular","dashed"],aa=r.Record(r.String(),r.Object({groupId:r.String(),lineStyle:r.Enum(rV)}),{description:"Line style of each series, keyed by 1-based query index. The last index is the formula when there is one. For widgets with a single query, only the `1` entry is read and it applies to every series."}),nV=r.Object({type:r.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),legendMode:r.Optional(ze),thresholds:ar,yAxisSettings:r.Optional(oa),lineStyleOptions:r.Optional(aa)},{$id:"GraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),oV=r.Object({type:r.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:r.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:r.Optional(ze),thresholds:ar,yAxisSettings:r.Optional(ia),lineStyleOptions:r.Optional(aa)},{$id:"InputGraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),iV=r.Object({type:r.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),query:r.String({description:"The read-only SQL query to execute against the connection."}),listColumns:r.Optional(r.Array(mh,{description:"Custom columns to display for each database row"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to connection list widgets."})),defaultSorting:r.Optional(fh)},{$id:"GraphVisualizationListConnection",title:"ListConnection"}),aV=r.Object({type:r.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:r.Optional(r.Array(dh,{description:"Custom columns to display for each database row"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.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:r.Optional(gh)},{$id:"InputGraphVisualizationListConnection",title:"ListConnection"}),sV=r.Object({type:r.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."}))},{$id:"GraphVisualizationTopListConnection",title:"TopListConnection"}),cV=r.Object({type:r.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:r.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"}),pV=r.Object({type:r.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),legendMode:r.Optional(ze)},{$id:"GraphVisualizationPieConnection",title:"PieConnection"}),uV=r.Object({type:r.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:r.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:r.Optional(ze)},{$id:"InputGraphVisualizationPieConnection",title:"PieConnection"}),lV=r.Object({type:r.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),legendMode:r.Optional(ze),thresholds:ar,yAxisSettings:r.Optional(oa)},{$id:"GraphVisualizationBarConnection",title:"BarConnection"}),mV=r.Object({type:r.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:r.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:r.Optional(ze),thresholds:ar,yAxisSettings:r.Optional(ia)},{$id:"InputGraphVisualizationBarConnection",title:"BarConnection"}),dV=r.Object({type:r.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),backgroundMode:r.Optional(r.Enum(Ji,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),precision:Te,normalizer:r.Optional(Ut),legendMode:r.Optional(ze)},{$id:"GraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),fV=r.Object({type:r.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:r.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),backgroundMode:r.Optional(r.Enum(Ji,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),precision:Te,normalizer:r.Optional(wt),legendMode:r.Optional(ze)},{$id:"InputGraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),gV=r.Object({type:r.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:r.String({description:"Tsuga query that selects logs to cluster into patterns"}),layout:r.Optional(r.Enum(IN,{description:"Layout used to render log patterns"}))},{$id:"GraphVisualizationListLogPatterns",title:"ListLogPatterns"}),hV=r.Object({type:r.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:r.Optional(r.Enum(IN,{description:"Layout used to render log patterns"}))},{$id:"InputGraphVisualizationListLogPatterns",title:"ListLogPatterns"}),yV=r.Object({type:r.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:r.String({description:"Query that selects trace spans for the list"}),listColumns:r.Optional(r.Array(mh,{description:"Custom columns to display for each span"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to span list widgets."})),defaultSorting:r.Optional(fh)},{$id:"GraphVisualizationListSpans",title:"ListSpans"}),TV=r.Object({type:r.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:r.Optional(r.Array(dh,{description:"Custom columns to display for each span"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.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:r.Optional(gh)},{$id:"InputGraphVisualizationListSpans",title:"ListSpans"}),Ws=r.Array(r.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."}),Zs=r.Array(p({allowEmpty:!1,type:"long",description:"Raw PromQL expression for this widget."}),{minItems:1,description:"PromQL expressions configured for this widget."}),EV=r.Object({type:r.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:Ws,aliases:r.Optional(ea),timeBucket:r.Optional(qn),normalizer:r.Optional(Ut),precision:Te,legendMode:r.Optional(ze),thresholds:ar,yAxisSettings:r.Optional(oa),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:r.Optional(aa)},{$id:"GraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),_V=r.Object({type:r.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:Zs,aliases:r.Optional(ta),timeBucket:r.Optional(qn),normalizer:r.Optional(wt),precision:Te,legendMode:r.Optional(ze),thresholds:ar,yAxisSettings:r.Optional(ia),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:r.Optional(aa)},{$id:"InputGraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),IV=r.Object({type:r.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:Ws,aliases:r.Optional(ea),backgroundMode:r.Optional(r.Enum(Ji,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),precision:Te,normalizer:r.Optional(Ut),legendMode:r.Optional(ze)},{$id:"GraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),SV=r.Object({type:r.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:Zs,aliases:r.Optional(ta),backgroundMode:r.Optional(r.Enum(Ji,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),precision:Te,normalizer:r.Optional(wt),legendMode:r.Optional(ze)},{$id:"InputGraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),bV=r.Object({type:r.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:Ws,aliases:r.Optional(ea),normalizer:r.Optional(Ut),precision:Te,conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"GraphVisualizationTopListPromql",title:"TopListPromql"}),OV=r.Object({type:r.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:Zs,aliases:r.Optional(ta),normalizer:r.Optional(wt),precision:Te,conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"InputGraphVisualizationTopListPromql",title:"TopListPromql"}),AV=r.Object({type:r.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:Ws,aliases:r.Optional(ea),normalizer:r.Optional(Ut),precision:Te,legendMode:r.Optional(ze)},{$id:"GraphVisualizationPiePromql",title:"PiePromql"}),xV=r.Object({type:r.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:Zs,aliases:r.Optional(ta),normalizer:r.Optional(wt),precision:Te,legendMode:r.Optional(ze)},{$id:"InputGraphVisualizationPiePromql",title:"PiePromql"}),RV=r.Object({type:r.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:Ws,aliases:r.Optional(ea),timeBucket:r.Optional(qn),precision:Te,normalizer:r.Optional(Ut),thresholds:ar,legendMode:r.Optional(ze),yAxisSettings:r.Optional(oa)},{$id:"GraphVisualizationBarPromql",title:"BarPromql"}),CV=r.Object({type:r.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:Zs,aliases:r.Optional(ta),timeBucket:r.Optional(qn),precision:Te,normalizer:r.Optional(wt),thresholds:ar,legendMode:r.Optional(ze),yAxisSettings:r.Optional(ia)},{$id:"InputGraphVisualizationBarPromql",title:"BarPromql"}),PV=r.Object({type:r.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...ra,groupByMode:Fr,timeBucket:r.Optional(qn),normalizer:r.Optional(Ut),precision:Te,legendMode:r.Optional(ze),thresholds:ar,yAxisSettings:r.Optional(oa),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:r.Optional(aa)},{$id:"GraphVisualizationTimeseries",title:"Timeseries"}),UV=r.Object({type:r.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...na,groupByMode:Fr,timeBucket:r.Optional(qn),normalizer:r.Optional(wt),precision:Te,legendMode:r.Optional(ze),thresholds:ar,yAxisSettings:r.Optional(ia),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:r.Optional(aa)},{$id:"InputGraphVisualizationTimeseries",title:"Timeseries"}),SN="Requests stacked rendering for a top-list widget. Tsuga renders stacked rows only for one count or sum query with exactly two grouped fields, no formula, non-negative values, and a single-cluster context; otherwise the widget renders as a normal top list.",wV=r.Object({type:r.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...ra,groupByMode:Fr,normalizer:r.Optional(Ut),precision:Te,conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:r.Optional(r.Boolean({description:SN}))},{$id:"GraphVisualizationTopList",title:"TopList"}),vV=r.Object({type:r.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...na,groupByMode:Fr,normalizer:r.Optional(wt),precision:Te,conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:r.Optional(r.Boolean({description:SN}))},{$id:"InputGraphVisualizationTopList",title:"TopList"}),NV=r.Object({type:r.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...ra,groupByMode:Fr,normalizer:r.Optional(Ut),precision:Te,legendMode:r.Optional(ze)},{$id:"GraphVisualizationPie",title:"Pie"}),LV=r.Object({type:r.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...na,groupByMode:Fr,normalizer:r.Optional(wt),precision:Te,legendMode:r.Optional(ze)},{$id:"InputGraphVisualizationPie",title:"Pie"}),kV=r.Object({type:r.Literal("query-value",{description:"Displays the aggregation as a single value"}),...Nl,backgroundMode:r.Optional(r.Enum(Ji,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),precision:Te,normalizer:r.Optional(Ut),legendMode:r.Optional(ze)},{$id:"GraphVisualizationQueryValue",title:"QueryValue"}),MV=r.Object({type:r.Literal("query-value",{description:"Displays the aggregation as a single value"}),...Ll,backgroundMode:r.Optional(r.Enum(Ji,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),precision:Te,normalizer:r.Optional(wt),legendMode:r.Optional(ze)},{$id:"InputGraphVisualizationQueryValue",title:"QueryValue"}),DV=r.Object({type:r.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...ra,groupByMode:Fr,timeBucket:r.Optional(qn),precision:Te,normalizer:r.Optional(Ut),thresholds:ar,legendMode:r.Optional(ze),yAxisSettings:r.Optional(oa)},{$id:"GraphVisualizationBar",title:"Bar"}),GV=r.Object({type:r.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...na,groupByMode:Fr,timeBucket:r.Optional(qn),precision:Te,normalizer:r.Optional(wt),thresholds:ar,legendMode:r.Optional(ze),yAxisSettings:r.Optional(ia)},{$id:"InputGraphVisualizationBar",title:"Bar"}),bN='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.',ON=r.String({description:bN}),AN=p({description:bN}),$V=r.Object({type:r.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...ra,group:r.Optional(ON),precision:Te,normalizer:r.Optional(Ut),percentileMarkers:r.Optional(eV),boundsScale:r.Optional(ku)},{$id:"GraphVisualizationDistribution",title:"Distribution"}),FV=r.Object({type:r.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...na,group:r.Optional(AN),precision:Te,normalizer:r.Optional(wt),percentileMarkers:r.Optional(tV),boundsScale:r.Optional(ku)},{$id:"InputGraphVisualizationDistribution",title:"Distribution"}),xN=["red","pink","violet","blue","cyan","green","yellow","orange"],RN=r.Enum(xN,{description:"Color palette used to render the heatmap intensity gradient"}),jV=r.Object({type:r.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...ra,group:r.Optional(ON),precision:Te,normalizer:r.Optional(Ut),palette:r.Optional(RN)},{$id:"GraphVisualizationHeatmap",title:"Heatmap"}),qV=r.Object({type:r.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...na,group:r.Optional(AN),precision:Te,normalizer:r.Optional(wt),palette:r.Optional(RN)},{$id:"InputGraphVisualizationHeatmap",title:"Heatmap"}),CN=r.Object({from:r.Number({description:"Lower bound of the Gauge color threshold; runs up to the next threshold or the max"}),color:r.Enum(xN,{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."}),BV=r.Object({type:r.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...Nl,max:r.Optional(r.Number({description:"Gauge maximum value"})),colorThresholds:r.Optional(r.Array(CN,{description:"Color thresholds inside the gauge range"})),precision:Te,normalizer:r.Optional(Ut)},{$id:"GraphVisualizationGauge",title:"Gauge"}),HV=r.Object({type:r.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...Ll,max:r.Optional(r.Number({description:"Gauge maximum value"})),colorThresholds:r.Optional(r.Array(CN,{description:"Color thresholds inside the gauge range"})),precision:Te,normalizer:r.Optional(wt)},{$id:"InputGraphVisualizationGauge",title:"Gauge"}),KV=r.Object({type:r.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:r.Array(V3,{description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:r.Optional(xi),groupByMode:Fr,defaultSorting:r.Optional(W3),columnSizes:r.Optional(r.Record(r.String(),r.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"}),zV=r.Object({type:r.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:r.Array(Q3,{minItems:1,description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:r.Optional(Qr),groupByMode:Fr,defaultSorting:r.Optional(Z3),columnSizes:r.Optional(r.Record(r.String(),r.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"}),YV=r.Object({type:r.Literal("note",{description:"Displays static text on the dashboard"}),note:r.Optional(r.String({description:"Markdown-compatible text shown in the note"})),noteColor:r.Optional(r.Enum(lN,{description:"Background color used to render the note"})),noteAlign:r.Optional(jn),noteJustifyContent:r.Optional(jn)},{$id:"GraphVisualizationNote",title:"Note"}),VV=r.Object({type:r.Literal("note",{description:"Displays static text on the dashboard"}),note:r.Optional(p({type:"long",description:"Markdown-compatible text shown in the note"})),noteColor:r.Optional(r.Enum(lN,{description:"Background color used to render the note"})),noteAlign:r.Optional(jn),noteJustifyContent:r.Optional(jn)},{$id:"InputGraphVisualizationNote",title:"Note"}),QV=r.Object({type:r.Literal("slo-uptime",{description:"Displays the SLI percentage of an SLO computed over the dashboard time range, colored against the SLO target. Experimental."}),sloId:r.String({description:"Id of the SLO to display"})},{$id:"GraphVisualizationSloUptime",title:"SloUptime"}),WV=r.Object({type:r.Literal("slo-uptime",{description:"Displays the SLI percentage of an SLO computed over the dashboard time range, colored against the SLO target. Experimental."}),sloId:p({allowEmpty:!1,description:"Id of the SLO to display"})},{$id:"InputGraphVisualizationSloUptime",title:"SloUptime"}),ZV=r.Object({type:r.Literal("slo-over-time",{description:"Displays the good and bad events, or the per-slice status, of an SLO over the dashboard time range. Experimental."}),sloId:r.String({description:"Id of the SLO to display"})},{$id:"GraphVisualizationSloOverTime",title:"SloOverTime"}),XV=r.Object({type:r.Literal("slo-over-time",{description:"Displays the good and bad events, or the per-slice status, of an SLO over the dashboard time range. Experimental."}),sloId:p({allowEmpty:!1,description:"Id of the SLO to display"})},{$id:"InputGraphVisualizationSloOverTime",title:"SloOverTime"}),JV=R("type",[nV,iV,sV,pV,lV,dV,EV,IV,bV,AV,RV,PV,wV,NV,kV,BV,DV,$V,jV,KV,X3,YV,gV,yV,QV,ZV],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),e9=R("type",[oV,aV,cV,uV,mV,fV,_V,SV,OV,xV,CV,UV,vV,LV,MV,HV,GV,FV,qV,zV,J3,VV,hV,TV,WV,XV],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),kl=r.Object({id:r.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:r.Optional(r.String({description:"Display name of the graph widget."})),description:r.Optional(r.String({description:"Optional text shown with the graph widget."})),descriptionAlign:r.Optional(jn),descriptionJustifyContent:r.Optional(jn),visualization:JV,layout:r.Optional(r.Object({x:r.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:r.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:r.Number({description:"Width of the widget in grid columns, out of the 12-column grid. Dashboard validation uses this with `h` and the widget type to reject layouts below the widget minimum."}),h:r.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall. Dashboard validation uses this with `w` and the widget type to reject layouts below the widget minimum."})},{description:`Grid position and size of the widget. Optional; when provided, the size must be at least ${Wd}\xD7${Zd} (width\xD7height) grid units, except note widgets which can go down to 1\xD71.`}))},{title:"Graph",description:"Single dashboard widget, combining its identity, its visualization configuration, and its position on the dashboard grid."}),Ml=r.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:r.Optional(p({description:"Display name of the graph widget."})),description:r.Optional(r.String({minLength:1,maxLength:800,description:"Text shown with the graph widget."})),descriptionAlign:r.Optional(jn),descriptionJustifyContent:r.Optional(jn),visualization:e9,layout:r.Optional(r.Object({x:r.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:r.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:r.Number({description:"Width of the widget in grid columns, out of the 12-column grid. Dashboard validation uses this with `h` and the widget type to reject layouts below the widget minimum."}),h:r.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall. Dashboard validation uses this with `w` and the widget type to reject layouts below the widget minimum."})},{description:`Grid position and size of the widget. Optional; when provided, the size must be at least ${Wd}\xD7${Zd} (width\xD7height) grid units, except note widgets which can go down to 1\xD71.`}))},{title:"Graph",description:"Single dashboard widget, combining its identity, its visualization configuration, and its position on the dashboard grid."}),uN=10,t9=r.Array(r.Object({key:r.String({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:r.Array(r.String({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:r.Optional(r.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."}),r9=r.Array(r.Object({key:p({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:r.Array(p({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:r.Optional(r.Boolean({description:"If true, widgets exclude telemetry whose value matches this filter instead of including it (is-not)."}))}),{maxItems:uN,description:`Dashboard-wide filters applied to every widget on the dashboard. Up to ${uN} filters are allowed.`}),sa=r.Object({id:r.String({description:"Tsuga-generated dashboard ID assigned when the dashboard is created."}),name:r.String({description:"Display name of the dashboard. Set by the caller on create or update."}),owner:r.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:r.Array(kl,{description:"Ordered widgets that compose the dashboard"}),filters:r.Optional(t9),createdAt:S({description:"Timestamp when Tsuga created the dashboard."}),updatedAt:S({description:"Timestamp when Tsuga last updated the dashboard."}),creator:r.Optional(se),updater:r.Optional(se),tags:ve,timePreset:r.Optional(r.Enum(sm,{description:"Relative time preset used when opening the dashboard."})),folderId:r.Optional(r.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."}))}),Dl=r.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:r.Array(Ml,{description:"Ordered widgets that compose the dashboard"}),filters:r.Optional(r9),tags:De,timePreset:r.Optional(r.Enum(sm,{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:r.Optional(r.Union([r.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."}))}),yr={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",WIDGET_COUNT:"widgetCount",UPDATED_AT:"updatedAt",NAME:"name"},PN=[yr.OWNER,yr.TAGS,yr.WIDGET_COUNT,yr.UPDATED_AT,yr.NAME],ko=r.Partial(r.Object({owners:Ie(p({allowEmpty:!1}),{description:"Restrict results to dashboards owned by any of these team IDs",maxItems:50}),searchQuery:r.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:r.Optional(r.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:Ie(Yt.items,{description:"Restrict results to dashboards that have at least one of the listed key/value tags",maxItems:50}),folderId:r.Union([r.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"})),n9=r.Partial(r.Object({...le,filters:ko,sort:r.Object({by:r.Enum([yr.IS_FAVORITE,yr.OWNER,yr.TAGS,yr.WIDGET_COUNT,yr.UPDATED_AT,yr.NAME],{description:"Field to sort the returned dashboards by"}),direction:ne},{description:"Optional sorting applied to the returned dashboards"})})),Wet=d({tags:["dashboards"],url:`${Gr}/query`,method:"POST",paginated:!0,response:r.Array(sa),body:n9}),Zet=d({tags:["dashboards"],url:`${Gr}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Omit(ko,["tags"]))}),response:zt}),Xet=d({tags:["dashboards"],url:`${Gr}/counts/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(ko))}),response:r.Object({all:r.Integer({description:"Total number of dashboards matching the filters that the user can read."})})}),Jet=d({tags:["dashboards"],url:`${Gr}/:id`,method:"GET",params:r.Object({id:p()}),response:sa}),ett=d({tags:["dashboards"],url:Gr,method:"POST",body:Dl,response:sa}),ttt=d({tags:["dashboards"],url:`${Gr}/:id`,method:"PUT",params:r.Object({id:p()}),body:r.Partial(Dl),response:sa}),o9=Kt(ko,{maxIds:100}),rtt=d({tags:["dashboards"],url:`${Gr}/bulk-update`,method:"PUT",body:r.Object({selection:o9,owner:r.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:Se(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:r.Object({})}),ntt=d({tags:["dashboards"],url:`${Gr}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),ott=d({tags:["dashboards"],url:`${Gr}/:id/graphs/:graphId`,method:"PUT",params:r.Object({id:p({allowEmpty:!1}),graphId:p({allowEmpty:!1})}),body:r.Omit(Ml,["id"]),response:kl}),i9=Kt(ko),itt=d({tags:["dashboards"],url:`${Gr}/bulk-delete`,method:"DELETE",body:r.Object({selection:i9}),response:r.Object({})});var ca=`/${"v1"}/dashboards`,Xs=r.Pick(sa,["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)."}),a9={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(Xs,{examples:[a9]});var s9=r.Object({by:r.Enum([...PN],{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:ne},{description:"Optional sorting applied to the returned dashboards"}),UN=r.Object({...qe,filters:r.Optional(r.Pick(ko,["owners","searchQuery","tags","folderId"])),sort:r.Optional(s9)},{description:"Dashboard query request. Use filters, sorting, limit, and offset to page through visible dashboards."}),c9={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(UN,{examples:[c9]});var wN=d({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:`${ca}/query`,method:"POST",paginated:!0,body:UN,response:r.Array(Xs)}),vN=d({description:"Retrieves one dashboard by ID.",operationId:"getDashboard",tags:["dashboards"],url:`${ca}/:id`,method:"GET",params:r.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:Xs}),hh=r.Pick(Dl,["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."}),p9={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(hh,{examples:[p9]});var u9=r.Omit(Ml,["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."}),NN=d({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:ca,method:"POST",body:hh,response:Xs}),LN=d({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:`${ca}/:id`,method:"PUT",params:r.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:r.Partial(hh),response:Xs}),l9=r.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."})}),kN=d({description:"Deletes a dashboard by ID. Use only after confirming no users or automation still rely on the dashboard.",operationId:"deleteDashboard",tags:["dashboards"],url:`${ca}/:id`,method:"DELETE",params:l9,response:v}),dtt=d({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:`${ca}/:id/graphs/:graphId`,method:"PUT",params:r.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:u9,response:kl});var MN=100,DN=3,pa=r.Object({id:r.String({description:"Tsuga-generated ingestion API key ID assigned when the key is created."}),name:r.String({description:"Human-readable key name. Names must be kebab-case when creating or updating keys."}),keyLastCharacters:r.String({description:"Last visible characters of the secret key. Use this to identify a key without exposing the full secret."}),owner:r.String({description:"Team ID that owns and manages the ingestion API key."}),tags:zt,teamOverrideFields:r.Optional(r.Array(r.String(),{description:"Telemetry attribute names used to override ownership for data sent with this key."})),updatedAt:S({description:"Timestamp when Tsuga last updated the key metadata."}),createdAt:S({description:"Timestamp when Tsuga created the key."}),creator:r.Optional(se),updater:r.Optional(se),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})}),Js=r.Object({name:r.String({format:fi,minLength:1,maxLength:MN,description:`Kebab-case name for the ingestion API key. Maximum length is ${MN} characters.`}),owner:p({allowEmpty:!1,description:"Team ID that will own and manage the ingestion API key."}),tags:Yt,teamOverrideFields:r.Union([r.Array(p({allowEmpty:!1}),{minItems:1,maxItems:DN,description:`Array form. Up to ${DN} fields are allowed.`}),r.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."})}),ua="/v0/ingestion-api-keys",Stt=d({tags:["ingestion-api-keys"],url:ua,method:"POST",body:Js,response:r.Intersect([pa,r.Object({key:r.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."})})])}),btt=d({tags:["ingestion-api-keys"],url:ua,method:"GET",paginated:!0,query:r.Object(le),response:r.Array(pa)}),Ott=d({tags:["ingestion-api-keys"],url:`${ua}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1})}),response:pa}),Att=d({tags:["ingestion-api-keys"],url:`${ua}/:id`,method:"PUT",params:r.Object({id:p({allowEmpty:!1})}),body:Js,response:pa}),xtt=d({tags:["ingestion-api-keys"],url:`${ua}/:id`,method:"DELETE",params:r.Object({id:p({allowEmpty:!1})}),response:v}),Rtt=d({tags:["ingestion-api-keys"],url:`${ua}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(p({allowEmpty:!1}))}),response:r.Object({})});var ec=`/${"v1"}/ingestion-api-keys`,tc=r.Pick(pa,["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)."}),GN={id:"123-456-abc",name:"production-logs-ingestion",keyLastCharacters:"x7Qm",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(tc,{examples:[GN]});var $N=r.Pick(Js,["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."}),FN=r.Pick(Js,["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."}),jN={name:"production-logs-ingestion",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign($N,{examples:[jN]});Object.assign(FN,{examples:[jN]});var m9={...GN,key:"tsuga_in:v1:abc123xyx7Qm"},qN=d({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:ec,method:"GET",paginated:!0,query:r.Object(qe),response:r.Array(tc)}),ktt=d({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:`${ec}/:id`,method:"GET",params:r.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:tc}),d9=r.Intersect([r.Pick(tc,["id","name","keyLastCharacters","owner","tags","teamOverrideFields"]),r.Object({key:r.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:m9}),BN=d({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:ec,method:"POST",body:$N,response:d9}),HN=d({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:`${ec}/:id`,method:"PUT",params:r.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:FN,response:tc}),KN=d({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:`${ec}/:id`,method:"DELETE",params:r.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:v});var f9={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"]}},[$tt,Gl,rc]=g9(f9),Ftt=Object.fromEntries(Gl.map(e=>[e,e]));function g9(e){let t=[],n=[],o=[],i=Object.keys(e);for(let a of i){t.push(a);let c=e[a];for(let l in c){n.push(l);let m=c[l];Array.isArray(m)&&o.push(...m)}}return[yh(t),yh(n),yh(o)]}function yh(e){if(e.length===0)throw new Error("Array must have at least one element.");return e}var Th=r.Enum(["HTTP","HTTPS","TCP","UDP","GENEVE","TLS","TLS_QUIC","TCP_UDP","TCP_QUIC","QUIC"]),h9=r.Object({versioningStatus:r.Optional(r.Enum(["Enabled","Disabled","Suspended","Not configured"]))}),y9=r.Object({domainName:r.Optional(r.String()),origins:r.Optional(r.Array(r.String()))}),T9=r.Object({allocatedStorageGib:r.Optional(r.Number()),encryptedAtRest:r.Optional(r.Boolean()),engine:r.Optional(r.String()),dynamoDbItemCount:r.Optional(r.Number()),dynamoDbActualSizeGib:r.Optional(r.Number())}),E9=r.Object({version:r.Optional(r.String()),virtualNetworkId:r.Optional(r.String()),subnets:r.Optional(r.Array(r.String()))}),_9=r.Object({artifactRegistryFormat:r.Optional(r.Enum(["FORMAT_UNSPECIFIED","DOCKER","MAVEN","NPM","APT","YUM","PYTHON","KFP","GO","GENERIC"])),uri:r.Optional(r.String()),tagMutability:r.Optional(r.Enum(["MUTABLE","IMMUTABLE"])),scanOnPush:r.Optional(r.Boolean()),encryptionType:r.Optional(r.String())}),I9=r.Object({status:r.Optional(r.String()),activeServices:r.Optional(r.Number()),pendingTasks:r.Optional(r.Number()),runningTasks:r.Optional(r.Number()),registeredContainerInstances:r.Optional(r.Number()),capacityProviders:r.Optional(r.Array(r.String()))}),S9=r.Object({status:r.Optional(r.String()),desiredStatus:r.Optional(r.String()),healthStatus:r.Optional(r.String()),availabilityZone:r.Optional(r.String()),startedAt:r.Optional(S())}),b9=r.Object({isEncrypted:r.Optional(r.Boolean()),ownerId:r.Optional(r.String()),state:r.Optional(r.Enum(["creating","available","deleting","deleted","error","updating"]))}),O9=r.Object({type:r.Optional(r.String()),osType:r.Optional(r.String()),subnetIds:r.Optional(r.Array(r.String())),nbContainers:r.Optional(r.Number())}),A9=r.Object({digest:r.String(),imageTags:r.Array(r.String()),imageSizeBytes:r.Optional(r.Number()),imagePushedAt:r.Optional(S()),mediaType:r.Optional(r.String()),repositoryName:r.String(),repositoryId:r.Optional(r.String()),scanStatus:r.Optional(r.String())}),x9=r.Object({url:r.Optional(r.String()),maxMessageSizeBytes:r.Optional(r.Number()),messageRetentionHours:r.Optional(r.Number())}),R9=r.Object({runtime:r.Optional(r.String()),memoryAllocationMib:r.Optional(r.Number()),timeoutMs:r.Optional(r.Number()),ephemeralStorageMib:r.Optional(r.Number({description:"Size of the temporary storage mounted on the function instance, in MiB. Only present for platforms that expose it, such as AWS Lambda."})),codeSha256:r.Optional(r.String())}),C9=r.Object({kind:r.Optional(r.String())}),P9=r.Object({instanceId:r.String(),architecture:r.Optional(r.String()),instanceType:r.Optional(r.String()),operatingSystem:r.Optional(r.String()),memoryMib:r.Optional(r.Number()),vCpus:r.Optional(r.Number()),vpcId:r.Optional(r.String()),k8sClusterId:r.Optional(r.String())}),U9=r.Object({id:r.Optional(r.String()),ipCidrBlocks:r.Array(r.String())}),w9=r.Object({protocol:r.Optional(Th),port:r.Optional(r.Number()),instanceProtocol:r.Optional(Th),instancePort:r.Optional(r.Number())}),v9=r.Object({protocol:r.Optional(r.String()),ports:r.Optional(r.Array(r.String())),portRange:r.Optional(r.String()),allPorts:r.Optional(r.Boolean())}),N9=r.Object({name:r.String(),ip:r.Optional(r.String()),type:r.Enum(["public","private"])}),L9=r.Object({type:r.String(),name:r.String()}),k9=r.Object({frontendIp:r.Optional(N9),backendIpPools:r.Array(L9)}),M9=r.Object({targetId:r.String(),targetPort:r.Optional(r.Number()),targetType:r.Optional(r.Enum(["instance","ip","lambda","alb"])),healthState:r.Optional(r.String()),healthReason:r.Optional(r.String()),healthDescription:r.Optional(r.String()),availabilityZone:r.Optional(r.String())}),D9=r.Object({protocol:r.Optional(Th),port:r.Optional(r.Number()),type:r.Optional(r.Enum(["alb","lambda","instance","ip"])),name:r.Optional(r.String()),targetGroupArn:r.Optional(r.String()),virtualNetworkId:r.Optional(r.String()),healthCheckProtocol:r.Optional(r.String()),healthCheckPort:r.Optional(r.String()),healthCheckPath:r.Optional(r.String()),healthCheckIntervalSeconds:r.Optional(r.Number()),healthCheckTimeoutSeconds:r.Optional(r.Number()),healthyThresholdCount:r.Optional(r.Number()),unhealthyThresholdCount:r.Optional(r.Number()),targets:r.Optional(r.Array(M9)),targetCount:r.Optional(r.Number()),healthyTargetCount:r.Optional(r.Number()),loadBalancerArns:r.Optional(r.Array(r.String()))}),G9=r.Object({first:r.Optional(r.String()),last:r.Optional(r.String()),scope:r.Optional(r.Number())}),$9=r.Object({type:r.Optional(r.String()),name:r.Optional(r.String()),alwaysServe:r.Optional(r.Boolean()),subnets:r.Optional(r.Array(r.Union([r.Number(),G9]))),target:r.Optional(r.String()),weight:r.Optional(r.Number()),priority:r.Optional(r.Number()),status:r.Optional(r.String())}),F9=r.Object({instanceId:r.Optional(r.String()),state:r.Optional(r.String()),reasonCode:r.Optional(r.String()),description:r.Optional(r.String())}),j9=r.Object({loadBalancerType:r.Optional(r.String()),dnsName:r.Optional(r.String()),virtualNetworkId:r.Optional(r.String()),subnetIds:r.Array(r.String()),scheme:r.Optional(r.String()),listeners:r.Optional(r.Union([r.Array(w9),r.Array(v9)])),targets:r.Optional(r.Union([r.Array(r.String()),r.Array(F9),r.Array($9)])),azureLoadBalancingRules:r.Optional(r.Array(k9))}),q9=r.Object({domainName:r.Optional(r.String()),expiresAt:r.Optional(S()),inUseBy:r.Optional(r.Array(r.String())),renewalEligibility:r.Optional(r.String()),revokedAt:r.Optional(S()),status:r.Optional(r.String()),type:r.Optional(r.String())}),B9=r.Object({state:r.Optional(r.Enum(["creating","available","deleting","deleted","error","in-use"])),volumeType:r.Optional(r.Enum(["gp2","gp3","io1","io2","st1","sc1","standard"]))}),H9=r.Object({osType:r.Optional(r.Enum(["Windows","Linux"]))}),K9=r.Object({state:r.Optional(r.String()),volumeType:r.Optional(r.String())}),z9=r.Intersect([r.Object({isEncrypted:r.Optional(r.Boolean()),sizeGib:r.Optional(r.Number())}),r.Union([B9,K9,H9])]),Y9=r.Object({instanceCount:r.Optional(r.Number()),hostnames:r.Optional(r.Array(r.String())),runtime:r.Optional(r.String())}),$l=r.Union([r.Object({category:r.Literal("application"),resourceType:r.Literal("webService"),attributes:r.Optional(Y9)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("bucket"),attributes:r.Optional(h9)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("messagingService"),attributes:r.Optional(x9)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("fileSystem"),attributes:r.Optional(b9)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("contentDeliveryNetwork"),attributes:r.Optional(y9)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("database"),attributes:r.Optional(T9)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("storageAccount"),attributes:r.Optional(C9)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("volume"),attributes:r.Optional(z9)}),r.Object({category:r.Literal("compute"),resourceType:r.Literal("virtualMachine"),attributes:r.Optional(P9)}),r.Object({category:r.Literal("compute"),resourceType:r.Literal("serverless"),attributes:r.Optional(R9)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("kubernetesCluster"),attributes:r.Optional(E9)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerRepository"),attributes:r.Optional(_9)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerCluster"),attributes:r.Optional(I9)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerServiceTask"),attributes:r.Optional(S9)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerService"),attributes:r.Optional(O9)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerImage"),attributes:r.Optional(A9)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("virtualNetwork"),attributes:r.Optional(U9)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("loadBalancer"),attributes:j9}),r.Object({category:r.Literal("network"),resourceType:r.Literal("targetGroup"),attributes:r.Optional(D9)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("certificate"),attributes:r.Optional(q9)})],{description:"Normalized public inventory category, resource type, and category-specific attributes. Attribute shape depends on the category and resourceType combination."});var Mo="/v0/inventory",zN=["scan_in_progress","success","failure","partial"],_h=r.Object({id:r.String({description:"Identifier of the inventory resource. Generated by Tsuga."}),cloudPlatform:r.Enum(vn,{description:"Cloud platform where Tsuga discovered this resource."}),cloudAccount:r.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:r.Optional(r.String({description:"Cloud region where Tsuga discovered this resource, when the resource is regional."})),fullyQualifiedResourceId:r.String({description:"Cloud-native unique identifier for this resource, such as an AWS ARN, GCP resource name, or Azure resource ID."}),displayName:r.String({description:"Human-readable resource name shown in Tsuga. Derived from cloud provider metadata when available."}),nativeResourceType:r.String({description:"Cloud-native resource type reported by the inventory integration, for example `aws_ec2_instance` or `gcp_bucket`."}),resourceCreatedAt:r.Optional(S({description:"Timestamp when the resource was created in the cloud, when known."})),resourceUpdatedAt:r.Optional(S({description:"Timestamp when the resource was last updated in the cloud, when known."})),resourceLastSeenAt:S({description:"Timestamp when Tsuga last observed this resource during an inventory scan."}),tags:ve,nativeAttributes:r.Optional(r.Unsafe({type:"object",additionalProperties:!0})),covered:r.Optional(r.Boolean({description:"Whether the resource is covered by the configured infrastructure-as-code identifiers"}))}),la={DISPLAY_NAME:"displayName",CLOUD_ACCOUNT:"cloudAccount",NATIVE_RESOURCE_TYPE:"nativeResourceType",CLOUD_REGION:"cloudRegion",RESOURCE_TYPE:"resourceType",RESOURCE_CREATED_AT:"resourceCreatedAt"},YN=r.Object({cloudPlatforms:Ie(r.Enum(vn),{description:"Restrict results to resources discovered on any of these cloud platforms",maxItems:vn.length}),cloudAccounts:Ie(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud accounts",maxItems:500}),cloudRegions:Ie(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud regions",maxItems:500}),nativeResourceTypes:Ie(r.Enum(rc),{description:"Restrict results to resources of any of these cloud-native resource types",maxItems:rc.length}),resourceTypes:Ie(r.Enum(Gl),{description:"Restrict results to resources of any of these normalized resource types",maxItems:Gl.length}),tags:Ie(Yt.items,{description:"Restrict results to resources that have at least one of the listed key/value tags",maxItems:50}),isIacManaged:r.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:r.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:r.Optional(r.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"}),Ih=r.Partial(r.Object({...le,filters:r.Partial(YN,{description:"Filters applied to narrow the returned resources."}),sort:r.Object({by:r.Enum([la.DISPLAY_NAME,la.CLOUD_ACCOUNT,la.NATIVE_RESOURCE_TYPE,la.CLOUD_REGION,la.RESOURCE_TYPE,la.RESOURCE_CREATED_AT],{description:"Field to sort the returned resources by"}),direction:ne},{description:"Optional sorting applied to the returned resources. Ties are broken by resource ID for stable pagination."})})),Qtt=d({tags:["inventory"],method:"POST",url:`${Mo}/resources/query`,paginated:!0,body:Ih,response:r.Array(r.Intersect([_h,$l]))}),V9=["resourceType","cloudAccount","isIacManaged"],Wtt=d({tags:["inventory"],method:"POST",url:`${Mo}/resources/counts`,body:r.Object({filters:r.Optional(r.Partial(YN)),groupBy:r.Enum(V9,{description:"Dimension to group the resource counts by."})}),response:r.Array(r.Object({value:r.String({description:'The group value the count belongs to: a resource type, a cloud account id, or "true"/"false" for IaC coverage.'}),count:r.Integer({description:"Number of resources in this group matching the requested filters."})}))}),Ztt=d({tags:["inventory"],method:"GET",url:`${Mo}/resources/filter-options`,response:r.Object({cloudRegions:r.Array(r.String(),{description:"Distinct cloud regions present across the tenant's resources."}),nativeResourceTypes:r.Array(r.String(),{description:"Distinct cloud-native resource types present across the tenant's resources."}),tags:zt})}),Xtt=R("type",[r.Object({type:r.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:r.String({description:"AWS account ID that Tsuga scans."}),externalId:r.String({description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:r.String({description:"ARN of the IAM role Tsuga assumes to read inventory in the account."})}),r.Object({type:r.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:r.String({description:"GCP project ID that Tsuga scans."}),serviceAccountId:r.String({description:"Service account Tsuga impersonates to read inventory."}),workloadIdentityProvider:r.String({description:"Workload identity provider resource name used for federated authentication."})}),r.Object({type:r.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:r.String({description:"Client ID of the Azure application Tsuga authenticates as."}),subscriptionId:r.String({description:"Azure subscription ID that Tsuga scans."}),tenantId:r.String({description:"Azure tenant ID that owns the subscription."})})]),Q9="^[0-9]{12}$",W9="^arn:aws[a-z-]*:iam::[0-9]{12}:role/.+$",Z9="^[a-z][a-z0-9-]{4,28}[a-z0-9]$",X9="^[^@\\s]+@[^@\\s]+\\.iam\\.gserviceaccount\\.com$",J9="^//iam\\.googleapis\\.com/projects/[0-9]+/locations/global/workloadIdentityPools/[^/]+/providers/[^/]+$",Eh="^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$",e6=r.Object({type:r.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:r.String({pattern:Q9,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:r.String({pattern:W9,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"}),t6=r.Object({type:r.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:r.String({pattern:Z9,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:r.String({pattern:X9,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:r.String({pattern:J9,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"}),r6=r.Object({type:r.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:r.String({pattern:Eh,minLength:1,description:"Client ID of the Azure application Tsuga authenticates as (GUID).",errorMessage:{pattern:"Must be a GUID."}}),subscriptionId:r.String({pattern:Eh,minLength:1,description:"Azure subscription ID that Tsuga scans (GUID).",errorMessage:{pattern:"Must be a GUID."}}),tenantId:r.String({pattern:Eh,minLength:1,description:"Azure tenant ID that owns the subscription (GUID).",errorMessage:{pattern:"Must be a GUID."}})},{$id:"AzureConnectionSettings"}),VN=R("type",[e6,t6,r6],{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`."}),ma=r.Object({id:r.String({description:"Identifier of the cloud account. Generated by Tsuga."}),cloudType:r.Enum(vn,{description:"Cloud provider of the account."}),cloudAccountId:r.String({description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:r.Optional(r.String({description:"Human-readable name for the account shown in Tsuga."})),organizationId:r.Optional(r.String({description:"Cloud organization identifier, when known."})),createdBy:r.Optional(r.String({description:"Identifier of the user who created the account, when created by a user."})),createdAt:S({description:"Timestamp when the account was registered in Tsuga."}),lastScanStartedAt:r.Optional(S({description:"Timestamp when the most recent inventory scan started."})),lastScanFinishedAt:r.Optional(S({description:"Timestamp when the most recent inventory scan finished."})),lastScanStatus:r.Optional(r.Enum(zN,{description:"Status of the most recent inventory scan."}))}),Sh=r.Object({cloudType:r.Enum(vn,{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:r.Optional(p({description:"Human-readable name for the account shown in Tsuga."})),organizationId:r.Optional(p({description:"Cloud organization identifier, when known."})),connectionSettings:VN,lastScanStatus:r.Optional(r.Enum(zN,{description:"Status of the most recent inventory scan."}))}),Do=`${Mo}/cloud-accounts`,Jtt=d({tags:["inventory"],url:Do,method:"GET",response:r.Array(ma)}),ert=d({tags:["inventory"],url:`${Do}/:id`,method:"GET",params:r.Object({id:p()}),response:ma}),trt=d({tags:["inventory"],url:Do,method:"POST",body:Sh,response:ma}),bh=r.Object({accountFriendlyName:p({description:"Human-readable name for the account shown in Tsuga."})}),rrt=d({tags:["inventory"],url:`${Do}/:id`,method:"PUT",params:r.Object({id:p()}),body:bh,response:ma}),nrt=d({tags:["inventory"],url:`${Do}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),ort=d({tags:["inventory"],url:`${Mo}/trigger-scan`,method:"POST",body:r.Object({}),response:r.Object({success:r.Literal(!0)})}),irt=d({tags:["inventory"],url:`${Do}/azure/onboarding`,method:"POST",body:r.Object({tenantId:p()}),response:r.Object({subjectId:r.String(),audience:r.String()})}),art=d({tags:["inventory"],method:"POST",url:`${Do}/validate/:type`,params:r.Object({type:p()}),body:r.Object({data:VN,id:r.Optional(p())}),response:r.Object({areAccountSettingsValid:r.Boolean(),message:r.Optional(r.String())})}),QN=`${Mo}/settings`,srt=d({tags:["inventory"],url:QN,method:"GET",response:r.Object({settings:r.Optional(r.Object({id:r.String(),infrastructureIdentifiers:r.Array(r.Object({name:r.String(),value:r.Optional(r.String())}))}))})}),n6=50,crt=d({tags:["inventory"],url:QN,method:"POST",body:r.Object({infrastructureIdentifiers:r.Array(r.Object({name:p({allowEmpty:!1}),value:r.Optional(p({allowEmpty:!1}))}),{maxItems:n6})}),response:r.Object({})}),prt=d({tags:["inventory"],url:`${Mo}/iac-tags-proposal`,method:"GET",response:r.Array(r.Object({name:r.String(),value:r.Optional(r.String())}))});var WN=`/${"v1"}/inventory`,o6=r.Omit(_h,["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)."}),ZN=r.Intersect([o6,$l],{$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)."}),i6={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(ZN,{examples:[i6]});var XN=r.Object({...Ih.properties,...qe},{description:"Inventory resource query request. Use filters, sorting, limit, and offset to page through discovered resources."}),a6={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(XN,{examples:[a6]});var JN=d({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:`${WN}/resources/query`,method:"POST",paginated:!0,body:XN,response:r.Array(ZN)}),nc=`${WN}/cloud-accounts`,oc=r.Pick(ma,["id","cloudType","cloudAccountId","accountFriendlyName"],{$id:"CloudAccount"}),s6={id:"123-456-abc",cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS"};Object.assign(oc,{examples:[s6]});var eL=r.Pick(Sh,["cloudType","cloudAccountId","accountFriendlyName","connectionSettings"]),c6={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(eL,{examples:[c6]});var p6=r.Pick(bh,["accountFriendlyName"]),Trt=d({description:"Lists cloud accounts connected to Tsuga that the authenticated operation key can read.",operationId:"listCloudAccounts",tags:["inventory"],url:nc,method:"GET",response:r.Array(oc)}),Ert=d({description:"Retrieves one cloud account by ID.",operationId:"getCloudAccount",tags:["inventory"],url:`${nc}/:id`,method:"GET",params:r.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:oc}),_rt=d({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:nc,method:"POST",body:eL,response:oc}),Irt=d({description:"Updates the friendly name of a cloud account by ID.",operationId:"updateCloudAccount",tags:["inventory"],url:`${nc}/:id`,method:"PUT",params:r.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:p6,response:oc}),Srt=d({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:`${nc}/:id`,method:"DELETE",params:r.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:v});var ic="/v0/investigations",u6=["dashboard","monitor","service","slo","log-route","adaptive-notification-rule"],l6=r.Object({type:r.String({description:'Kind of linked asset, e.g. "dashboard"'}),id:r.String({description:"Identifier of the linked asset"})}),m6=r.Object({type:r.Enum(u6,{description:"Kind of linked asset"}),id:p({allowEmpty:!1,description:"Identifier of the linked asset"})}),on=r.Object({id:r.String({description:"Identifier of the investigation"}),name:r.String({description:"Human readable name shown for the investigation"}),slug:r.Optional(r.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:r.Optional(r.String({description:"Markdown content capturing the investigation notes and findings"})),tags:ve,owner:r.String({description:"Team ID owning the investigation"}),env:r.Optional(r.String({description:'Environment the investigation relates to, e.g. "prod"'})),linkedAssets:r.Array(l6,{description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}),creator:r.Optional(se),updater:r.Optional(se),createdAt:S({description:"Timestamp the investigation was created at."}),updatedAt:S({description:"Timestamp the investigation was last updated at."})},{title:"Investigation"}),Fl=r.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:Se(p({type:"long"}),{description:"Markdown content capturing the investigation notes and findings"}),tags:De,owner:p({allowEmpty:!1,description:"Team ID owning the investigation"}),env:Se(p({allowEmpty:!0}),{description:"Environment the investigation relates to"}),linkedAssets:r.Optional(r.Array(m6,{maxItems:100,description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}))}),Oh=r.Object(r.Omit(Fl,["slug"]).properties),Urt=d({tags:["investigations"],url:ic,method:"GET",paginated:!0,query:r.Object(le),response:r.Array(on)}),wrt=d({tags:["investigations"],url:`${ic}/:id`,params:r.Object({id:p()}),method:"GET",response:on}),vrt=d({tags:["investigations"],url:ic,method:"POST",body:Fl,response:on}),Nrt=d({tags:["investigations"],url:`${ic}/:id`,method:"PUT",body:Oh,params:r.Object({id:p()}),response:on}),Lrt=d({tags:["investigations"],url:`${ic}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v});var ac=`/${"v1"}/investigations`,tL=d({description:"Retrieve all investigations",tags:["private"],url:ac,method:"GET",paginated:!0,query:r.Object(qe),response:r.Array(on)}),rL=d({description:"Retrieve an investigation by its id",tags:["private"],url:`${ac}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1})}),response:on}),nL=d({description:"Create a new investigation",tags:["private"],url:ac,method:"POST",body:Fl,response:on}),oL=d({description:"Update an investigation by its id",tags:["private"],url:`${ac}/:id`,method:"PUT",body:Oh,params:r.Object({id:p({allowEmpty:!1})}),response:on}),iL=d({description:"Delete an investigation by its id",tags:["private"],url:`${ac}/:id`,method:"DELETE",params:r.Object({id:p({allowEmpty:!1})}),response:v});var aL=15,jl={id:r.String({description:"Unique identifier of the processor within the route. Used to preserve processor identity during updates."}),description:r.Optional(r.String({description:"Optional user-provided processor note."})),tags:ve,updatedAt:r.Optional(S({description:"Timestamp when Tsuga last updated the processor."}))},ql={id:p({allowEmpty:!1,description:"Unique identifier of the processor within the route. Preserve it across updates for existing processors."}),description:r.Optional(p({type:"long",description:"Optional processor note."})),tags:De,updatedAt:r.Optional(S({description:"Backend-maintained timestamp for this processor. Omit this field on create and update requests; Tsuga sets or preserves it based on processor changes."}))},sL={...jl,type:r.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},cL={...ql,type:r.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},d6=R("subtype",[r.Object({targetAttribute:r.String({description:"Attribute that will receive the formatted value"}),formatString:r.String({description:"Template string used to build the target attribute value"}),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:r.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Whether missing referenced attributes render as empty strings. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorFormatString"}),r.Object({targetAttribute:r.String({description:"Attribute that will receive the computed value"}),formula:r.String({description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:r.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:r.Optional(r.Boolean({description:"Whether missing referenced attributes evaluate as zero. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorMathFormula"}),r.Object({targetAttribute:r.String({description:"Attribute that will receive the category value"}),clauses:r.Array(r.Object({query:r.String({description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:r.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:r.Optional(r.String({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:r.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."}),f6=R("subtype",[r.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:r.Optional(r.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:r.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))},{$id:"InputProcessorParamsCreatorFormatString"}),r.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:r.Optional(r.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:r.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:r.Optional(r.Boolean({description:"Set to true for missing referenced attributes to evaluate as zero. Defaults to true."}))},{$id:"InputProcessorParamsCreatorMathFormula"}),r.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:r.Array(r.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:aL,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:r.Optional(p({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:r.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."}),g6=r.Object({...sL,params:d6}),h6=r.Object({...cL,params:f6}),pL={...jl,type:r.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},uL={...ql,type:r.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},y6=R("subtype",[r.Object({attributes:r.Array(r.Object({originAttribute:r.String({description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Whether the source attribute is preserved after mapping. If omitted, route processing treats this as false."})),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),targetAttribute:r.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:r.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"ProcessorParamsMapperMapAttributes"}),r.Object({attributeName:r.String({description:"Attribute whose value will determine the log level"}),subtype:r.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"ProcessorParamsMapperMapLevel"}),r.Object({attributeName:r.String({description:"Attribute whose value will determine the log timestamp"}),subtype:r.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."}),T6=R("subtype",[r.Object({attributes:r.Array(r.Object({originAttribute:p({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:r.Optional(r.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:r.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"InputProcessorParamsMapperMapAttributes"}),r.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will determine the log level"}),subtype:r.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"InputProcessorParamsMapperMapLevel"}),r.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will determine the log timestamp"}),subtype:r.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."}),E6=r.Object({...uL,params:T6}),_6=r.Object({...pL,params:y6}),lL={...jl,type:r.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},mL={...ql,type:r.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},dL=5,I6=R("subtype",[r.Object({attributeName:r.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:r.Array(r.String({description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:r.Optional(r.Array(r.String(),{description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:r.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),r.Object({sourceAttribute:r.String({description:"Attribute containing the URL to parse"}),subtype:r.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),r.Object({sourceAttribute:r.String({description:"Attribute containing the user agent string to parse"}),subtype:r.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),r.Object({sourceAttribute:r.String({description:"Attribute containing the key/value string segment to parse"}),targetAttribute:r.String({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:r.String({description:"Delimiter separating keys from values in the source string"}),pairsSplitter:r.String({description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:r.Boolean({description:"Whether keys without explicit values are accepted by the parser."}),subtype:r.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."}),S6=R("subtype",[r.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:r.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:r.Optional(r.Array(p({type:"long"}),{maxItems:dL,description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:r.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),r.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the URL to parse"}),subtype:r.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),r.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the user agent string to parse"}),subtype:r.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),r.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:r.Boolean({description:"Set to true to accept keys without explicit values."}),subtype:r.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."}),b6=r.Object({...lL,params:I6}),O6=r.Object({...mL,params:S6}),A6=r.Object({...cL,params:R("subtype",[r.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:r.Optional(r.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:r.Literal("format-string"),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))}),r.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:r.Array(r.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:aL,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:r.Optional(p({description:"String category value used when no clause matches."})),subtype:r.Literal("category")})])}),x6=r.Object({...uL,params:r.Object({attributes:r.Array(r.Object({originAttribute:p({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:r.Optional(r.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:r.Literal("map-attributes")})}),R6=r.Object({...mL,params:r.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:r.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:r.Optional(r.Array(p({type:"long"}),{maxItems:dL,description:"Example log lines for validating the Grok rules."})),subtype:r.Literal("grok")})}),Yrt=R("type",[x6,R6,A6]),C6=r.Object({...sL,params:R("subtype",[r.Object({targetAttribute:r.String({description:"Attribute that will receive the formatted value"}),formatString:r.String({description:"Template string used to build the target attribute value"}),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),subtype:r.Literal("format-string"),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Whether missing referenced attributes render as empty strings."}))}),r.Object({targetAttribute:r.String({description:"Attribute that will receive the category value"}),clauses:r.Array(r.Object({query:r.String({description:"Query that selects logs for this category clause."}),value:r.String({description:"String category value assigned when this clause matches."})}),{description:"Conditions evaluated in order to determine the category value."}),defaultValue:r.Optional(r.String({description:"String category value used when no clause matches."})),subtype:r.Literal("category")})])}),P6=r.Object({...pL,params:r.Object({attributes:r.Array(r.Object({originAttribute:r.String({description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Whether the source attribute is preserved after mapping."})),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),targetAttribute:r.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:r.Literal("map-attributes")})}),U6=r.Object({...lL,params:r.Object({attributeName:r.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:r.Array(r.String({description:"Grok rule applied to parse text."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:r.Optional(r.Array(r.String(),{description:"Example log lines for validating the Grok rules."})),subtype:r.Literal("grok")})}),Vrt=R("type",[P6,U6,C6]),w6=11,fL=r.Cyclic({OutputProcessor:r.Union([_6,b6,g6,r.Object({...jl,params:r.Object({items:r.Array(r.Object({query:r.String({description:"Query that determines whether logs enter this branch"}),processors:r.Array(r.Ref("OutputProcessor"),{description:"Processors executed when the branch query matches"})}),{description:"Conditional branches evaluated in order before falling back to the default"})}),type:r.Literal("split",{description:"Split processor. It sends each log through the first matching conditional branch."})})])},"OutputProcessor",{description:"Processing step executed sequentially on route logs"}),gL=r.Cyclic({InputProcessor:r.Union([E6,O6,h6,r.Object({...ql,params:r.Object({items:r.Array(r.Object({query:p({type:"tsuga-query",description:"Query that determines whether logs enter this branch"}),processors:r.Array(r.Ref("InputProcessor"),{maxItems:50,description:"Processors executed when the branch query matches"})}),{minItems:2,maxItems:w6,description:"Conditional branches evaluated in order before falling back to the default"})}),type:r.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 v6="/v0/logs",Bn=`${v6}/routes`,Hn=r.Object({id:r.String({description:"Tsuga-generated log route ID assigned when the route is created."}),name:r.String({description:"Human-readable route name shown in Tsuga."}),description:r.Optional(r.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:r.Boolean({description:"Whether this route is active for newly ingested logs. Disabled routes remain saved but do not process logs."}),query:r.String({description:"Tsuga query that selects which newly ingested logs enter the route processor chain."}),rank:r.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:ve,owner:r.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:r.Array(fL,{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:r.Optional(se),updater:r.Optional(se),updatedAt:S({description:"Timestamp when Tsuga last updated the route."}),createdAt:S({description:"Timestamp when Tsuga created the route."}),assetUpdatedAt:S({description:"Timestamp when Tsuga last changed route behavior. This can differ from `updatedAt` when only metadata such as `description` or `tags` changed."})},{title:"LogRoute"}),sc=r.Object({name:p({allowEmpty:!1,description:"Human-readable log route name shown in Tsuga."}),description:Se(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:r.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:De,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:r.Array(gL,{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 nnt=d({tags:["routes"],url:Bn,method:"GET",paginated:!0,query:r.Object(le),response:r.Array(Hn)}),ont=d({tags:["routes"],url:`${Bn}/:id`,params:r.Object({id:p()}),method:"GET",response:Hn}),int=d({tags:["routes"],url:Bn,method:"POST",body:sc,response:Hn}),ant=d({tags:["routes"],url:`${Bn}/:id`,method:"PUT",body:sc,params:r.Object({id:p()}),response:Hn}),snt=d({tags:["routes"],url:`${Bn}/:id/clone`,method:"POST",params:r.Object({id:p()}),body:sc,response:Hn}),cnt=d({tags:["routes"],url:`${Bn}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),pnt=d({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:`${Bn}/:id/modify-ranking`,method:"PUT",params:r.Object({id:p()}),body:r.Object({rank:r.Integer({minimum:1,description:"Target rank for the route, from 1 to the total number of routes. Requests outside that range are rejected."})}),response:r.Object({})}),unt=d({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:`${Bn}/:id/enable`,method:"PUT",params:r.Object({id:p()}),body:r.Object({enable:r.Boolean({description:"Set to true to enable the route, or false to disable it."})}),response:Hn});var cc=`/${"v1"}/routes`,hL={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}"]}}]},yL={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}}]},pc=r.Pick(Hn,["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)."}),N6={id:"123-456-abc",...hL},L6={id:"456-789-def",...yL};Object.assign(pc,{examples:[N6,L6]});var TL=d({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:cc,method:"GET",paginated:!0,query:r.Object(qe),response:r.Array(pc)}),EL=d({description:"Retrieves one log route by ID.",operationId:"getRoute",tags:["routes"],url:`${cc}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to retrieve. Use the `id` returned by route list or create responses."})}),response:pc}),Ah=r.Pick(sc,["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(Ah,{examples:[hL,yL]});var _L=d({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:cc,method:"POST",body:Ah,response:pc}),IL=d({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:`${cc}/:id`,method:"PUT",body:Ah,params:r.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:pc}),SL=d({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:`${cc}/:id`,method:"DELETE",params:r.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:v});var uc=`/${"v1"}/monitors`,lc=r.Pick(rn,["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)."}),OL={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:[]},AL={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:[]},xL={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:[]},RL={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",services:["api-gateway"]}},priority:2,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},k6={id:"123-456-abc",...OL},M6={id:"234-567-bcd",...AL},D6={id:"345-678-cde",...xL},G6={id:"456-789-def",...RL};Object.assign(lc,{examples:[k6,M6,D6,G6]});var bL=r.Pick(Sg,["filters","sort","limit","offset"]),CL=r.Object({...bL.properties,...qe,filters:bL.properties.filters},{description:"Monitor query request. Use filters, sorting, limit, and offset to page through visible monitors."}),$6={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(CL,{examples:[$6]});var PL=d({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:`${uc}/query`,method:"POST",paginated:!0,body:CL,response:r.Array(lc)}),UL=d({description:"Retrieves one monitor definition by ID.",operationId:"getMonitor",tags:["monitors"],url:`${uc}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1,description:"Monitor ID returned by monitor query, create, or update operations."})}),response:lc}),wL=["name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],vL=r.Pick(Fs,wL,{$id:"CreateMonitorRequest",description:"Monitor creation request. Provide ownership, data access, alert configuration, priority, tags, and optional dashboard or cluster scope."}),NL=r.Pick(Fs,wL,{$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."}),LL=OL,kL=AL,ML=xL,DL=RL;Object.assign(vL,{examples:[LL,kL,ML,DL]});Object.assign(NL,{examples:[LL,kL,ML,DL]});var GL=d({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:uc,method:"POST",body:vL,response:lc}),$L=d({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:`${uc}/:id`,method:"PUT",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the saved monitor to update. Use the `id` returned by monitor query or create responses."})}),body:NL,response:lc}),F6=r.Object({id:p({allowEmpty:!1,description:"Identifier of the saved monitor to delete. Use the `id` returned by monitor query, create, or update responses."})}),FL=d({description:"Deletes a monitor by ID. Deleting a monitor stops future evaluations and alert transitions for that monitor.",operationId:"deleteMonitor",tags:["monitors"],url:`${uc}/:id`,method:"DELETE",params:F6,response:v});var mc=`/${"v1"}/notification-integrations`,dc=r.Pick(Hs,["id","name","setting","tags"],{$id:"NotificationIntegration",description:"A reusable external destination that notification rules can send to. See [Integrations](/documentation/alert/notifications/index#integrations). Slack integrations are OAuth-based and are not readable, creatable, or editable through this API; connect Slack from the app."}),j6={id:"456-def-abc",name:"Primary on-call",setting:{type:"pagerduty",integrationKeyLastChars:"ab12"},tags:[{key:"team",value:"platform"}]};Object.assign(dc,{examples:[j6]});var jL=d({description:"Lists non-OAuth notification integrations visible to the authenticated operation key. Slack integrations do not appear here because they are OAuth-based. Pagination fields limit the returned page.",operationId:"listNotificationIntegrations",tags:["public","notification-integrations"],url:mc,method:"GET",paginated:!0,query:r.Object(qe),response:r.Array(dc)}),qL=d({description:"Retrieves one non-OAuth notification integration by ID.",operationId:"getNotificationIntegration",tags:["notification-integrations"],url:`${mc}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the notification integration to retrieve. Use the `id` returned by notification integration list or create responses."})}),response:dc}),BL=r.Pick(Rg,["name","setting","tags"],{description:"Notification integration create request containing the display name, destination setting, and tags. `setting.type` cannot be `slack`; add Slack integrations from the app instead."}),q6={name:"Primary on-call",setting:{type:"pagerduty",integrationKey:"abcdef1234567890ab12"},tags:[{key:"team",value:"platform"}]};Object.assign(BL,{examples:[q6]});var HL=d({description:"Creates a non-OAuth notification integration that notification rules can target as a destination.",operationId:"createNotificationIntegration",tags:["notification-integrations"],url:mc,method:"POST",body:BL,response:dc}),KL=r.Pick(Cg,["name","setting","tags"],{description:"Notification integration update request. Omitted optional fields keep their existing values."}),B6={name:"Primary on-call"};Object.assign(KL,{examples:[B6]});var zL=d({description:"Updates an existing non-OAuth notification integration by ID. The submitted `setting` is overwritten in full; omitted optional fields keep their existing values.",operationId:"updateNotificationIntegration",tags:["notification-integrations"],url:`${mc}/:id`,method:"PUT",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the notification integration to update. Use the `id` returned by notification integration list, get, or create responses."})}),body:KL,response:dc}),YL=d({description:"Deletes a non-OAuth notification integration by ID. Deletion is blocked while a notification rule still targets the integration; remove it from those rules first.",operationId:"deleteNotificationIntegration",tags:["notification-integrations"],url:`${mc}/:id`,method:"DELETE",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the notification integration to delete. Use the `id` returned by notification integration list, get, or create responses."})}),response:v});var fc=`/${"v1"}/notification-rules`,gc=r.Pick(Ki,["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)."}),VL={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}}}]},H6={id:"123-456-abc",...VL};Object.assign(gc,{examples:[H6]});var QL=d({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:fc,method:"GET",paginated:!0,query:r.Object(qe),response:r.Array(gc)}),WL=d({description:"Retrieves one notification rule by ID.",operationId:"getNotificationRule",tags:["notification-rules"],url:`${fc}/:id`,method:"GET",params:r.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:gc}),xh=r.Pick(Bs,["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."}),K6=VL;Object.assign(xh,{examples:[K6]});var ZL=d({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:fc,method:"POST",body:xh,response:gc}),XL=d({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:`${fc}/:id`,method:"PUT",params:r.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:xh,response:gc}),z6=r.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."})}),JL=d({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:`${fc}/:id`,method:"DELETE",params:z6,response:v});var da=`${Bi}/silences`,ek=r.Union([r.Literal("monday"),r.Literal("tuesday"),r.Literal("wednesday"),r.Literal("thursday"),r.Literal("friday"),r.Literal("saturday"),r.Literal("sunday")]),Y6=r.Partial(r.Record(ek,r.Array(r.Object({startTime:r.String({format:fd,description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:r.String({format:fd,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`."}),V6=r.Partial(r.Record(ek,r.Array(r.Object({startTime:r.String({description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:r.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`."}),Bl='IANA timezone identifier (e.g. "America/New_York"). Defaults to UTC if omitted.',tk="One-time silence schedule with specific start and end times",rk="Recurring weekly silence schedule",Q6=R("type",[r.Object({type:r.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:r.String({format:gd,description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:r.String({format:gd,description:"Local end date and time for the one-time silence. It must be after `startTime` and in the future."}),timeZone:r.Optional(r.String({format:os,description:Bl}))},{$id:"InputSilenceScheduleOneTime",description:tk}),r.Object({type:r.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:Y6,timeZone:r.Optional(r.String({format:os,description:Bl}))},{$id:"InputSilenceScheduleRecurring",description:rk})],{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."}),W6=R("type",[r.Object({type:r.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:r.String({description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:r.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:r.Optional(r.String({description:Bl}))},{$id:"OutputSilenceScheduleOneTime",description:tk}),r.Object({type:r.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:V6,timeZone:r.Optional(r.String({description:Bl}))},{$id:"OutputSilenceScheduleRecurring",description:rk})],{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."}),Z6="monitor_id",nk=`Query on the alerting monitor tags and group-by dimensions, e.g. \`env:prod AND service:bridge\`. The monitor itself can be targeted with \`${Z6}:<monitor id>\`.`,Hl=r.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:De,isActive:r.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:Q6,notificationRuleIds:Se(r.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:Se(p({type:"tags-query"}),{description:nk}),teamsFilter:Ag,prioritiesFilter:r.Array(r.Enum(Ct),{maxItems:Ct.length,description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.Enum(wo),{maxItems:wo.length,description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."})}),fa=r.Object({id:r.String({description:"Tsuga-generated notification silence ID assigned when the silence is created."}),name:r.String({description:"Display name of the silence"}),reason:r.String({description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:r.String({description:"Team ID that owns and manages the silence"}),tags:ve,isActive:r.Boolean({description:"Whether the silence suppresses matching notifications while its schedule is active. When false, the silence is kept but never suppresses anything."}),schedule:W6,notificationRuleIds:r.Optional(r.Array(r.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:r.Optional(r.String({description:nk})),teamsFilter:Og,prioritiesFilter:r.Array(r.Enum(Ct),{description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.Enum(wo),{description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."}),createdAt:S(),updatedAt:S(),creator:r.Optional(se),updater:r.Optional(se)}),Qnt=d({tags:["notification-silences"],url:da,method:"GET",response:r.Array(fa)}),Wnt=d({tags:["notification-silences"],url:`${da}/:id`,params:r.Object({id:p()}),method:"GET",response:fa}),Znt=d({tags:["notification-silences"],url:da,method:"POST",body:Hl,response:fa}),Xnt=d({tags:["notification-silences"],url:`${da}/:id`,method:"PUT",params:r.Object({id:p()}),body:Hl,response:fa}),Jnt=d({tags:["notification-silences"],url:`${da}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),eot=d({tags:["notification-silences"],url:`${da}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(p())}),response:r.Object({})});var hc=`/${"v1"}/notification-silences`,yc=r.Pick(fa,["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)."}),X6={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"]},J6={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(yc,{examples:[X6,J6]});var ok=d({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:hc,method:"GET",response:r.Array(yc)}),ik=d({description:"Retrieves one notification silence by ID.",operationId:"getNotificationSilence",tags:["notification-silences"],url:`${hc}/:id`,method:"GET",params:r.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:yc}),Rh=r.Pick(Hl,["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."}),e5={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"]},t5={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(Rh,{examples:[e5,t5]});var ak=d({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:hc,method:"POST",body:Rh,response:yc}),sk=d({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:`${hc}/:id`,method:"PUT",params:r.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:Rh,response:yc}),r5=r.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."})}),ck=d({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:`${hc}/:id`,method:"DELETE",params:r5,response:v});var n5={critical:3,important:2,normal:1},pe=e=>({label:e,weight:n5[e]}),o5={"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:pe("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:pe("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:pe("important"),recommendation:"Ensure every team manages a dedicated route scoped to its context.team value."},"no-team-override-mismatch":{key:"no-team-override-mismatch",title:`${Kd} matches ${Ru}`,summary:`Detects logs and spans whose ${Kd} resource attribute names a different team than the ${Ru} resolved at ingestion.`,rationale:`${Ru} is reserved and comes from the ingestion API key, so a \`team\` resource attribute never reassigns ownership. A disagreement means the sender expects an ownership Tsuga did not apply.`,objectType:"resource",category:"telemetry-hygiene",impact:pe("important"),recommendation:"Drop the `team` resource attribute, or set the ingestion API key team override fields to read ownership from a differently named attribute."},"service-name-present":{key:"service-name-present",title:`${Cu} present`,summary:`Logs and spans must populate ${Cu} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:pe("critical"),recommendation:`Populate ${Cu} 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:pe("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:pe("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:`${_s} presence`,summary:`Logs and spans must populate ${_s} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:pe("important"),recommendation:`Populate ${_s} 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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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 ${sR} 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:pe("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"}},pk={"postgresql-server-metrics-collected":{label:"PostgreSQL",systemValues:["postgresql"],metricPrefixes:["postgresql.","pg_"],receiver:"postgresqlreceiver"},"mysql-server-metrics-collected":{label:"MySQL",systemValues:["mysql","mariadb"],metricPrefixes:["mysql.","mysql_"],receiver:"mysqlreceiver"},"mongodb-server-metrics-collected":{label:"MongoDB",systemValues:["mongodb"],metricPrefixes:["mongodb.","mongodbatlas.","mongodb_"],receiver:"mongodbreceiver"},"redis-server-metrics-collected":{label:"Redis",systemValues:["redis"],metricPrefixes:["redis.","redis_"],receiver:"redisreceiver"},"memcached-server-metrics-collected":{label:"Memcached",systemValues:["memcached"],metricPrefixes:["memcached.","memcached_"],receiver:"memcachedreceiver"},"couchdb-server-metrics-collected":{label:"CouchDB",systemValues:["couchdb"],metricPrefixes:["couchdb.","couchdb_"],receiver:"couchdbreceiver"},"elasticsearch-server-metrics-collected":{label:"Elasticsearch",systemValues:["elasticsearch"],metricPrefixes:["elasticsearch.","elasticsearch_"],receiver:"elasticsearchreceiver"},"oracledb-server-metrics-collected":{label:"Oracle DB",systemValues:["oracle.db","oracle"],metricPrefixes:["oracledb.","oracledb_"],receiver:"oracledbreceiver"},"sqlserver-server-metrics-collected":{label:"Microsoft SQL Server",systemValues:["microsoft.sql_server","mssql"],metricPrefixes:["sqlserver.","mssql_"],receiver:"sqlserverreceiver"},"saphana-server-metrics-collected":{label:"SAP HANA",systemValues:["sap.hana","hanadb"],metricPrefixes:["saphana."],receiver:"saphanareceiver"},"cassandra-server-metrics-collected":{label:"Cassandra",systemValues:["cassandra"],metricPrefixes:["cassandra.","cassandra_"]},"clickhouse-server-metrics-collected":{label:"ClickHouse",systemValues:["clickhouse"],metricPrefixes:["ClickHouse"]},"couchbase-server-metrics-collected":{label:"Couchbase",systemValues:["couchbase"],metricPrefixes:["couchbase_"]},"neo4j-server-metrics-collected":{label:"Neo4j",systemValues:["neo4j"],metricPrefixes:["neo4j_"]},"opensearch-server-metrics-collected":{label:"OpenSearch",systemValues:["opensearch"],metricPrefixes:["opensearch_"]},"db2-server-metrics-collected":{label:"IBM Db2",systemValues:["ibm.db2","db2"],metricPrefixes:["ibm_db2_"]}},i5=Object.fromEntries(Object.keys(pk).map(e=>{let{label:t,receiver:n}=pk[e];return[e,{key:e,title:`${t} server metrics collected`,summary:`${t} seen in client spans should have its server metrics collected.`,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:pe("important"),recommendation:n?`Configure the ${n} OpenTelemetry receiver so ${t} server metrics are collected.`:`Collect ${t} server metrics, for example via its Prometheus exporter.`,scope:"global"}]})),a5=new Set(["azure_container_registry","azure_container_registry_image","azure_app_service_certificate","azure_virtual_network"]),s5=rc.filter(e=>e.startsWith("azure_")&&!a5.has(e)),uk={"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:s5,metricPrefixes:["azure_"]}},c5=Object.fromEntries(Object.keys(uk).map(e=>{let{label:t,source:n}=uk[e];return[e,{key:e,title:`${t} metrics collected`,summary:`${t} 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:pe("important"),recommendation:`Enable the ${n} metrics integration so ${t} metrics are ingested.`,scope:"global"}]})),p5={...o5,...i5,...c5},lk=Object.values(p5);var mk=["passed","failed","ignored"],u5=10,l5=r.Enum(mk,{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."}),m5=["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"],d5=["postgresql-server-metrics-collected","mysql-server-metrics-collected","mongodb-server-metrics-collected","redis-server-metrics-collected","memcached-server-metrics-collected","couchdb-server-metrics-collected","elasticsearch-server-metrics-collected","oracledb-server-metrics-collected","sqlserver-server-metrics-collected","saphana-server-metrics-collected","cassandra-server-metrics-collected","clickhouse-server-metrics-collected","couchbase-server-metrics-collected","neo4j-server-metrics-collected","opensearch-server-metrics-collected","db2-server-metrics-collected"],Ph=["unrouted-logs","no-over-routed-logs","team-has-route","no-team-override-mismatch","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",...d5,...m5],f5=r.Enum(Ph),g5=["log","metric","resource","span","api-key","dashboard","monitor","route"],h5=["collection-coverage","telemetry-hygiene","observability-assets","telemetry-adoption"],y5=["critical","important","normal"],T5=["team","global"],Uh=r.Object({key:r.Enum(Ph),title:r.String(),summary:r.String(),rationale:r.String(),objectType:r.Enum(g5),category:r.Enum(h5),impact:r.Object({label:r.Enum(y5),weight:r.Number()}),recommendation:r.String(),scope:r.Optional(r.Enum(T5))}),Tc=r.Object({type:r.String({description:"Tsuga asset or telemetry kind referenced by this example. Set by the rule evaluator from the failing object, record, or lookup result; examples include `monitor`, `dashboard`, `metric`, `log`, and `api-key`."}),label:r.String({description:"Human-readable summary of the example. Set by the rule evaluator from the asset name, telemetry identifier, or lookup result so clients can display the example without following the link."}),link:r.Object({to:r.String({description:"In-app route that opens the example in Tsuga. Set by the rule evaluator when the example has a product surface for inspection."}),search:r.Optional(r.Unknown({description:"Route search payload for the in-app link. Set when the destination needs query-string state such as a search query, time range, or table filter."})),params:r.Optional(r.Unknown({description:"Route params for the in-app link. Set when the destination route needs path parameters such as an asset identifier."}))},{description:"In-app deep link for inspecting the example. Returned when Tsuga can route from the quality-report row to a relevant product page."})}),Ch=r.Intersect([Uh,r.Object({id:r.Optional(r.String()),status:l5,normalizedScore:r.Number(),details:r.Optional(r.Record(r.String(),r.Unknown())),recommendation:r.Optional(r.String()),examples:r.Optional(r.Array(Tc)),exampleCount:r.Optional(r.Integer())})]),E5=r.Object({generatedAt:r.String(),overallScore:r.Optional(r.Number()),rules:r.Array(Uh),teamResults:r.Array(r.Object({teamId:r.String(),teamName:r.String(),teamWeight:r.Number(),score:r.Number(),weightedScore:r.Number(),totalWeight:r.Number(),ruleResults:r.Array(Ch)})),globalResults:r.Optional(r.Object({score:r.Optional(r.Number()),ruleResults:r.Array(Ch)}))}),wh=r.Object({id:r.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:r.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:r.Enum(Ph,{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:r.Optional(r.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:r.Enum(mk,{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:r.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:r.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:r.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:r.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:r.Optional(r.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:r.Optional(r.Array(Tc,{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. Truncated to the first ${u5}; compare against exampleCount to detect truncation.`})),exampleCount:r.Optional(r.Integer({description:"Total number of examples persisted for this row, before the preview truncation applied to examples. Returned whenever examples are visible to the caller."})),createdAt:r.String({description:"ISO timestamp the row was generated at"})}),hot=d({tags:["quality-reports"],url:"/v0/quality-reports",method:"POST",response:E5}),vh=r.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."})),yot=d({tags:["quality-reports"],url:"/v0/quality-reports/latest",method:"GET",query:r.Object({clusterId:vh,team:r.Optional(p({allowEmpty:!1}))}),response:r.Array(wh,{description:"Latest persisted rule evaluation rows for the cluster"})}),Tot=d({tags:["quality-reports"],url:"/v0/quality-reports/:id/examples",method:"GET",params:r.Object({id:p({allowEmpty:!1})}),response:r.Object({examples:r.Array(Tc)})}),Eot=d({tags:["quality-reports"],url:"/v0/quality-reports/preview",method:"POST",body:r.Object({ruleKey:f5,teamId:r.Optional(p({allowEmpty:!1})),lookbackMinutes:r.Optional(r.Integer({minimum:1,maximum:60})),clusterId:r.Optional(p({allowEmpty:!1}))}),response:r.Object({rule:Uh,result:Ch,teamId:r.Optional(r.String()),teamName:r.Optional(r.String())})}),_ot=new Map(lk.map(e=>[e.key,e]));var dk=`/${"v1"}/quality-reports`,fk=r.Pick(wh,["id","reportId","ruleId","owner","status","score","weight","reportOverallScore","reportTotalWeight","recommendation","examples","exampleCount","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)."}),_5={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(fk,{examples:[_5]});var I5=r.Object({clusterId:vh,team:r.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."}),gk=d({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:`${dk}/latest`,method:"GET",query:I5,response:r.Array(fk)}),Rot=d({description:"Retrieves every example stored for one quality-report row. The latest-report endpoint returns only a preview of each row's examples, so use this to page past that preview when exampleCount exceeds the number of examples returned there.",operationId:"getQualityReportExamples",tags:["quality-reports"],url:`${dk}/:id/examples`,method:"GET",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the quality-report row whose examples are returned. Use the id from the latest-report endpoint. Unknown ids, rows the caller cannot access, and cluster-wide rows requested by a non-admin all return RESOURCE_NOT_FOUND."})}),response:r.Object({examples:r.Array(Tc,{description:"Every example stored for this row, untruncated. Empty when the rule evaluation produced none."})},{description:"All examples stored for one quality-report row."})});var Ec="/v0/admin-center";var jr=`${Ec}/retention-policies`,hk=3650,S5=r.Integer({description:"Number of days Tsuga retains matching telemetry."}),yk=r.Integer({minimum:1,maximum:hk,description:`Number of days Tsuga should retain matching telemetry. Valid values are 1 through ${hk}.`}),an=r.Object({id:r.String({description:"Unique identifier of the retention policy. Generated by Tsuga."}),env:r.Optional(r.String({description:"Environment tag value this policy applies to. Omitted policies apply across environments unless a more specific policy exists."})),teamId:r.Optional(r.String({description:"Team ID this policy applies to. Omitted policies apply globally unless a team-specific policy exists."})),dataSource:r.Enum(vr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:S5,isEnabled:r.Boolean({description:"Whether this policy participates in retention resolution."}),createdAt:S({description:"Timestamp when Tsuga created the retention policy."}),updatedAt:S({description:"Timestamp when Tsuga last updated the retention policy."})}),Kl=r.Object({env:Se(p(),{description:"Environment tag value this policy applies to. Omit for a policy that is not environment-specific."}),teamId:Se(p(),{description:"Team ID this policy applies to. Omit for a policy that is not team-specific."}),dataSource:r.Enum(vr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:yk,isEnabled:r.Boolean({description:"Set to true for the policy to participate in retention resolution."})}),Tk=r.Array(r.Object({env:p(),dataSource:r.Enum(vr),durationDays:r.Union([yk,r.Null()]),isEnabled:r.Boolean()})),Ek=r.Object({inserted:r.Array(an),updated:r.Array(an),deleted:r.Array(an)}),Mot=d({tags:["retention-policies"],url:jr,method:"POST",body:Kl,response:an}),Dot=d({tags:["retention-policies"],url:jr,method:"GET",response:r.Array(an)}),Got=d({tags:["retention-policies"],url:`${jr}/:id`,method:"GET",params:r.Object({id:p()}),response:an}),$ot=d({tags:["retention-policies"],url:`${jr}/:id`,method:"PUT",params:r.Object({id:p()}),body:Kl,response:an}),Fot=d({tags:["retention-policies"],url:`${jr}/bulk-update`,method:"POST",body:Tk,response:Ek}),jot=d({tags:["retention-policies"],url:`${jr}/bulk-update-for-team`,method:"POST",body:r.Object({teamId:p(),policies:Tk}),response:Ek}),qot=d({tags:["retention-policies"],url:`${jr}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),_c=["past-24-hours","past-7-days","past-30-days"],Bot=d({tags:["retention-policies"],url:`${jr}/requested-history-percentile/:teamId`,method:"POST",params:r.Object({teamId:p()}),body:r.Object({percentile:r.Number({minimum:0,maximum:1}),observationWindow:r.Enum(_c),dataSource:r.Enum(vr)}),response:r.Object({percentile:r.Number(),observationWindow:r.Enum(_c),dataSource:r.Enum(vr),teamId:r.String(),requestedHistoryDays:r.Number()})}),b5=["1-day","3-days","7-days","1-month","6-months","more-than-6-months"];var O5=r.Array(r.Object({bucket:r.Enum(b5),count:r.Number()})),Hot=d({tags:["retention-policies"],url:`${jr}/requested-history-histogram/:teamId`,method:"POST",params:r.Object({teamId:p()}),body:r.Object({observationWindow:r.Enum(_c),dataSource:r.Enum(vr)}),response:r.Object({observationWindow:r.Enum(_c),dataSource:r.Enum(vr),teamId:r.String(),histogram:O5})}),Kot=d({tags:["retention-policies"],url:`${jr}/top-teams-with-retention-surplus`,method:"POST",body:r.Object({dataSource:r.Enum(vr),observationWindow:r.Enum(_c),percentile:r.Number({minimum:0,maximum:1}),topN:r.Optional(r.Number({minimum:1,maximum:20}))}),response:r.Array(r.Object({teamId:r.String(),retentionSurplusDays:r.Number()}))});var Ic=`/${"v1"}/retention-policies`,Sc=r.Pick(an,["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)."}),A5={id:"123-456-abc",env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(Sc,{examples:[A5]});var _k=d({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:Ic,method:"GET",response:r.Array(Sc)}),Ik=d({description:"Retrieves one retention policy by ID.",operationId:"getRetentionPolicy",tags:["retention-policies"],url:`${Ic}/:id`,method:"GET",params:r.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:Sc}),Nh=r.Pick(Kl,["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."}),x5={env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(Nh,{examples:[x5]});var Sk=d({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:Ic,method:"POST",body:Nh,response:Sc}),bk=d({description:"Replaces an existing retention policy by ID, including signal, scope fields, duration, and enabled state.",operationId:"updateRetentionPolicy",tags:["retention-policies"],url:`${Ic}/:id`,method:"PUT",params:r.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:Nh,response:Sc}),Ok=d({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:`${Ic}/:id`,method:"DELETE",params:r.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:v});var bc=`/${"v1"}/slos`,R5=r.Pick(vg,["id","sloId","priority","configuration"],{$id:"SloAlert",description:"Alert attached to an SLO, triggered on a burn-rate multiplier or an SLO target threshold"}),Oc=r.Object({...r.Pick(Yi,["id","name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds"]).properties,alerts:r.Array(R5,{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"}),C5={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(Oc,{examples:[C5]});var Ak=r.Pick(kg,["filters","sort","limit","offset"]),xk=r.Object({...Ak.properties,...qe,filters:Ak.properties.filters},{description:"SLO query request. Use filters, sorting, limit, and offset to page through visible SLOs."}),P5={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(xk,{examples:[P5]});var Rk=d({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:`${bc}/query`,method:"POST",paginated:!0,body:xk,response:r.Array(Oc)}),Ck=d({description:"Retrieves one SLO definition by ID.",operationId:"getSlo",tags:["slos"],url:`${bc}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1,description:"SLO ID returned by SLO query, create, or update operations."})}),response:Oc}),Pk=["name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds","alerts"],Uk=r.Pick(Tl,Pk,{$id:"CreateSloRequest",description:"SLO creation request. Provide ownership, data access, SLI configuration, target, timeframe, optional cluster scope, and the alerts to create."}),wk=r.Pick(Ng,Pk,{$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."}),vk={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(Uk,{examples:[vk]});Object.assign(wk,{examples:[vk]});var Nk=d({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:bc,method:"POST",body:Uk,response:Oc}),Lk=d({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:`${bc}/:id`,method:"PUT",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the SLO to update. Use the `id` returned by SLO query or create."})}),body:wk,response:Oc}),kk=d({description:"Deletes an SLO by ID. Deleting an SLO stops future evaluations and removes its attached alerts.",operationId:"deleteSlo",tags:["slos"],url:`${bc}/:id`,method:"DELETE",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the SLO to delete. Use the `id` returned by SLO query or create."})}),response:v});var Go=`${Ec}/tag-policies`;var U5=["logs","metrics","traces"],Lh=r.Array(r.Enum(U5,{description:"Telemetry signal covered by a data tag policy."}),{description:"Telemetry signals covered by the policy. An empty array means logs, metrics, and traces."}),w5=r.Union([iu,Lh]),v5=r.Object({teamIds:r.Array(r.String(),{description:"Team IDs used by this policy scope."}),mode:r.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."}),N5=R("type",[r.Object({type:r.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:Lh,shouldInsertWarning:r.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:r.Optional(r.Number({description:"Percentage of non-compliant telemetry datapoints to drop. Omitted means no sampling drop is configured."}))},{title:"TelemetryTagPolicy"}),r.Object({type:r.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:iu},{title:"TsugaAssetTagPolicy"})]),L5=R("type",[r.Object({type:r.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:Lh,shouldInsertWarning:r.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:r.Optional(r.Number({minimum:0,maximum:100,description:"Percentage of non-compliant telemetry datapoints to drop. Valid values are 0 through 100."}))},{title:"TelemetryTagPolicy"}),r.Object({type:r.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:iu},{title:"TsugaAssetTagPolicy"})]),Mk="Policy surface and enforcement behavior. Use `telemetry` for telemetry data or `tsuga_asset` for Tsuga-managed resources.",k5=r.Unsafe({...N5,description:Mk}),M5=r.Unsafe({...L5,description:Mk}),ga=r.Object({id:r.String({description:"Tsuga-generated tag policy ID assigned when the policy is created."}),name:r.String({description:"Human-readable tag policy name."}),description:r.Optional(r.String({description:"Optional user-provided policy description."})),isActive:r.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:r.String({description:"Tag key enforced by this policy."}),allowedTagValues:r.Array(r.String(),{description:"Allowed values for `tagKey`. An empty array means any value is accepted when the tag exists."}),isRequired:r.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:r.Optional(v5),configuration:k5,creator:r.Optional(se),updater:r.Optional(se),owner:r.Optional(r.String({description:"Team ID that owns and manages the policy."})),createdAt:S({description:"Timestamp when Tsuga created the tag policy."}),updatedAt:S({description:"Timestamp when Tsuga last updated the tag policy."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})});var Ac=r.Object({name:p({description:"Human-readable tag policy name."}),description:Se(p(),{description:"Optional policy description."}),isActive:r.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:r.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:r.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:r.Optional(r.Object({teamIds:r.Array(p(),{minItems:1,maxItems:100,description:"Team IDs used by this policy scope."}),mode:r.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:M5,owner:p({allowEmpty:!1,description:"Team ID that will own and manage the policy."})}),fit=d({tags:["tag-policies"],url:Go,method:"GET",query:r.Object({teamIds:r.Optional(r.Array(p(),{maxItems:100})),assetTypes:r.Optional(w5),searchQuery:r.Optional(p())}),response:r.Array(ga)}),git=d({tags:["tag-policies"],url:`${Go}/:id`,method:"GET",params:r.Object({id:p()}),response:ga}),hit=d({tags:["tag-policies"],url:Go,method:"POST",body:Ac,response:ga}),yit=d({tags:["tag-policies"],url:`${Go}/:id`,method:"PUT",params:r.Object({id:p()}),body:Ac,response:ga}),Tit=d({tags:["tag-policies"],url:`${Go}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),Eit=d({tags:["tag-policies"],url:`${Ec}/applicable-tag-rules`,method:"GET",query:r.Object({assetType:r.Enum(is),teamId:p()}),response:r.Array(r.Object({tagKey:r.String(),allowedTagValues:r.Array(r.String()),isRequired:r.Boolean(),tagPolicyId:r.String()}))}),Dk=r.Object({total:r.Number(),totalNonCompliant:r.Number(),idsNonCompliant:r.Array(r.String())}),Gk=r.Union([r.Literal("ingestion-api-key"),r.Literal("operation-api-key"),r.Literal("rum-public-token"),r.Literal("dashboard"),r.Literal("log-route"),r.Literal("metric-route"),r.Literal("monitor"),r.Literal("notification-rule"),r.Literal("notification-silence"),r.Literal("slo")]),D5=r.Object({total:r.Number(),totalNonCompliant:r.Number(),byAssetType:r.Record(Gk,Dk)}),G5=r.Omit(Dk,["total"]),$5=r.Object({totalNonCompliant:r.Number(),byAssetType:r.Record(Gk,G5)}),$k=r.Object({totals:D5,byTeam:r.Record(r.String(),$5)}),_it=d({tags:["tag-policies"],url:`${Go}/:id/stats`,method:"GET",params:r.Object({id:p()}),response:$k}),Iit=d({tags:["tag-policies"],url:`${Go}/new-policy-stats`,method:"POST",body:Ac,response:$k});var xc=`/${"v1"}/tag-policies`,Fk={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"},jk={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"},F5={id:"123-456-abc",...Fk},j5={id:"456-789-def",...jk},Rc=r.Pick(ga,["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)."}),q5=F5,B5=j5;Object.assign(Rc,{examples:[q5,B5]});var kh=r.Pick(Ac,["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."}),H5=Fk,K5=jk;Object.assign(kh,{examples:[H5,K5]});var qk=d({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:xc,method:"GET",response:r.Array(Rc)}),Bk=d({description:"Retrieves one tag policy by ID.",operationId:"getTagPolicy",tags:["tag-policies"],url:`${xc}/:id`,method:"GET",params:r.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:Rc}),Hk=d({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:xc,method:"POST",body:kh,response:Rc}),Kk=d({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:`${xc}/:id`,method:"PUT",params:r.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:kh,response:Rc}),zk=d({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:`${xc}/:id`,method:"DELETE",params:r.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:v});var Cc=`/${"v1"}/teams`,Pc=r.Pick(bn,["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)."}),z5={id:"team-123-abc",name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(Pc,{examples:[z5]});var Yk=d({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:Cc,method:"GET",paginated:!0,query:r.Object(qe),response:r.Array(Pc)}),Vk=d({description:"Retrieves one team by ID.",operationId:"getTeam",tags:["teams"],url:`${Cc}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the team to retrieve. Use the `id` returned by team list or create responses."})}),response:Pc}),Mh=r.Pick(gu,["name","description","visibility","tags"],{description:"Team create or update request. Provide the team name, optional description, visibility, and tags."}),Y5={name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(Mh,{examples:[Y5]});var Qk=d({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:Cc,method:"POST",body:Mh,response:Pc}),Wk=d({description:"Replaces a team definition by ID, including name, description, visibility, and tags.",operationId:"updateTeam",tags:["teams"],url:`${Cc}/:id`,method:"PUT",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the team to update. Use the `id` returned by team list, get, or create responses."})}),body:Mh,response:Pc}),Zk=d({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:`${Cc}/:id`,method:"DELETE",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the team to delete. Use the `id` returned by team list, create, or update responses."})}),response:v});function V5(e){return/^[aeiou]/i.test(e)||e==="SLO"?"an":"a"}function Xk(e,t){let n=Number(t);if(Number.isNaN(n))throw new Error(`--${e} must be a number (got: ${t})`);return n}function Jk(e){let t={};return e.limit!==void 0&&(t.limit=Xk("limit",e.limit)),e.offset!==void 0&&(t.offset=Xk("offset",e.offset)),t}function Dh(e){let t=e.params;if(t?.properties){let n=Object.keys(t.properties);if(n.length===1&&n[0])return n[0]}return"id"}function eM(e,t,n){let o=e.command(t.commandName).description(t.description),i=t.singularOverride??MR(t.commandName).replace(/-/g," "),a=t.pluralOverride??t.commandName.replace(/-/g," "),c=V5(i),l=o.command("list").description(t.listDescription??`List all ${a}`);if(t.listOptions)for(let m of t.listOptions)l.option(m.flag,m.description);if(t.endpoints.list.paginated===!0&&l.option("--limit <n>",`Maximum number of items to return, up to ${hi} (default: ${nu})`).option("--offset <n>","Number of items to skip, to request a later page"),t.enableListBody?l.option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async m=>{if(m.generateSkeleton){Q(Fi(t.endpoints.list));return}let f=m.data?Ri({data:m.data}):{},h=await n()(t.endpoints.list,{body:{...f,...Jk(m)}});Q(h)}):l.action(async m=>{let f=Jk(m);if(t.listOptions)for(let E of t.listOptions){let I=m[E.queryParam];I!==void 0&&(f[E.queryParam]=I)}let h=await n()(t.endpoints.list,Object.keys(f).length>0?{query:f}:void 0);Q(h)}),t.endpoints.get){let m=t.endpoints.get,f=Dh(m);o.command("get <ID>").description(`Get ${c} ${i} by ID`).action(async h=>{let E=await n()(m,{params:{[f]:h}});Q(E)})}if(t.endpoints.create){let m=t.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(Fi(m));return}let h=Ri(f),E=await n()(m,{body:h});Q(E)})}if(t.endpoints.update){let m=t.endpoints.update,f=Dh(m);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(h,E)=>{if(E.generateSkeleton){Q(Fi(m));return}let I=Ri(E),g=await n()(m,{params:{[f]:h},body:I});Q(g)})}if(t.endpoints.delete){let m=t.endpoints.delete,f=Dh(m);o.command("delete <ID>").description(`Delete ${c} ${i} by ID`).action(async h=>{let E=await n()(m,{params:{[f]:h}});Q(E)})}}var Q5=[{commandName:"cloud-resources",description:"List cloud resources discovered by inventory scans",endpoints:{list:JN},enableListBody:!0},{commandName:"dashboard-folders",description:"Manage dashboard folders",endpoints:{list:iN,get:aN,create:sN,update:cN,delete:pN},enableListBody:!0},{commandName:"dashboards",description:"Manage dashboards",endpoints:{list:wN,get:vN,create:NN,update:LN,delete:kN},enableListBody:!0},{commandName:"ingestion-api-keys",description:"Manage ingestion API keys",singularOverride:"ingestion API key",pluralOverride:"ingestion API keys",endpoints:{list:qN,create:BN,update:HN,delete:KN}},{commandName:"investigations",description:"Manage investigations (beta)",endpoints:{list:tL,get:rL,create:nL,update:oL,delete:iL}},{commandName:"monitors",description:"Manage monitors",endpoints:{list:PL,get:UL,create:GL,update:$L,delete:FL},enableListBody:!0},{commandName:"notification-rules",description:"Manage notification rules",endpoints:{list:QL,get:WL,create:ZL,update:XL,delete:JL}},{commandName:"notification-silences",description:"Manage notification silences",endpoints:{list:ok,get:ik,create:ak,update:sk,delete:ck}},{commandName:"notification-integrations",description:"Manage notification integrations",endpoints:{list:jL,get:qL,create:HL,update:zL,delete:YL}},{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:gk},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:_k,get:Ik,create:Sk,update:bk,delete:Ok}},{commandName:"log-routes",description:"Manage log routes",endpoints:{list:TL,get:EL,create:_L,update:IL,delete:SL}},{commandName:"services",description:"List and inspect services (read-only; services are inferred from telemetry)",endpoints:{list:av,get:sv}},{commandName:"slos",description:"Manage SLOs",singularOverride:"SLO",pluralOverride:"SLOs",endpoints:{list:Rk,get:Ck,create:Nk,update:Lk,delete:kk},enableListBody:!0},{commandName:"tag-policies",description:"Manage tag policies",endpoints:{list:qk,get:Bk,create:Hk,update:Kk,delete:zk}},{commandName:"teams",description:"Manage teams",endpoints:{list:Yk,get:Vk,create:Qk,update:Wk,delete:Zk}}];function tM(e,t){for(let n of Q5)eM(e,n,t)}var rM=require("node:child_process");var zl="@tsuga/cli@latest";function W5(){z(`Updating ${zl}`),z(` $ npm install -g ${zl}`);try{(0,rM.execFileSync)("npm",["install","-g",zl],{stdio:["ignore","inherit","inherit"]})}catch(e){let t=e.status??1;throw new Error(`npm install -g ${zl} exited ${t}`,{cause:e})}z("Updated. Run `tsuga --version` to confirm the new version.")}function nM(e){e.command("self-update").description("Update the Tsuga CLI to the latest version via npm").action(()=>{W5()})}var Hh=require("node:fs"),Bh=require("node:os"),ya=require("node:path");var Z5=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,Uc=class e extends Date{#t=!1;#r=!1;#e=null;constructor(t){let n=!0,o=!0,i="Z";if(typeof t=="string"){let a=t.match(Z5);a?(a[1]||(n=!1,t=`0000-01-01T${t}`),o=!!a[2],o&&t[10]===" "&&(t=t.replace(" ","T")),a[2]&&+a[2]>23?t="":(i=a[3]||null,t=t.toUpperCase(),!i&&o&&(t+="Z"))):t=""}super(t),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 t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z")return t;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(t,n="Z"){let o=new e(t);return o.#e=n,o}static wrapAsLocalDateTime(t){let n=new e(t);return n.#e=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#r=!1,n.#e=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#t=!1,n.#e=null,n}};function X5(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function J5(e,t,n){let o=e.split(/\r\n|\n|\r/g),i="",a=(Math.log10(t+1)|0)+1;for(let c=t-1;c<=t+1;c++){let l=o[c-1];l&&(i+=c.toString().padEnd(a," "),i+=": ",i+=l,i+=`
142
+ fish: tsuga completion fish > ~/.config/fish/completions/tsuga.fish`).action(t=>{let{rows:n,valueFlags:o}=g2(e);if(t==="bash")z(h2(KR(n),o));else if(t==="zsh")z(y2(KR(n),o));else if(t==="fish")z(E2(T2(n),o));else throw new Error(`Unsupported shell "${t}". Supported: bash, zsh, fish.`)})}function VR(e){let t=e.command("config").description("Show or manage configuration");t.action(()=>{let n=e.opts(),o=Oi({clusterId:n.cluster});z(rR(o,Ru()).trimEnd())}),t.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)=>{eR(n,o),z(`Default set: ${n} = ${o}`)}),t.command("reset").description("Reset configuration values").command("defaults").description("Clear all custom defaults").action(()=>{tR(),z("Custom defaults cleared")})}var QR=`/${"v1"}/docs`,WR=r.Object({path:r.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:r.String({description:'Title of the page (e.g. "Send your first logs" or "POST /v1/aggregation/multi-query/scalar")'}),content:r.String({description:"Raw markdown content of the page"})},{$id:"DocPage",description:"A documentation or API-reference page with its raw markdown content"}),_2={path:"getting-started/send-your-first-logs",title:"Send your first logs",content:`# Send your first logs
143
+ ...`};Object.assign(WR,{examples:[_2]});var ZR=r.Object({kind:r.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:r.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:r.String({description:'Title of the result (e.g. "How to Add Resource Attributes" or "POST /v1/aggregation/multi-query/scalar")'}),subsection:r.Optional(r.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:r.Optional(r.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:r.Optional(r.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:r.Number({description:"Relevance score between 0 and 1 (higher is more relevant)"}),excerpt:r.String({description:"Short snippet of matching content"}),link:r.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"}),I2={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(ZR,{examples:[I2]});var XR=d({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:QR,method:"GET",query:r.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:WR}),JR=d({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:`${QR}/search`,method:"GET",query:r.Object({query:p({allowEmpty:!1,description:"Search text to match against documentation and API-reference content."})},{description:"Documentation search query."}),response:r.Array(ZR)});function eC(e,t){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 t()(XR,{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 t()(JR,{query:{query:o}});Q(i)})}var Iw=require("node:fs");var S2="/v0/profiles",b2=["cpu","samples","wall","off_cpu","space","inuse_space","objects","inuse_objects","alloc_space","alloc_objects","goroutine"],O2=20,xs={service:p({allowEmpty:!1,description:"Service the profiles belong to, as it appears in `profile.{type}.{service}`."}),type:r.Enum(b2,{description:"pprof sample type."}),filter:r.Optional(p({type:"tsuga-query",description:"TQL over the profile labels. Only label equality, negation and wildcards are accepted."})),groupBy:r.Optional(r.Array(p({allowEmpty:!1}),{description:"Labels to split the flamegraph by. The stack itself cannot be a group-by."})),limit:r.Optional(r.Integer({minimum:1,default:O2,description:"Maximum number of groups, ranked by total value."})),minFraction:r.Optional(r.Number({minimum:0,maximum:1,description:"Nodes below this share of the root total fold into their parent."}))},rDe=d({tags:["profiles"],url:`${S2}/query`,method:"POST",body:r.Object({...xs,timeRange:Un,clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster to target. Defaults to the first cluster created in the organization when omitted."}))}),response:Ri});var tC=`/${"v1"}/aggregation`,rC=r.Object({id:r.String({description:"Result identifier. Query results use `q1`, `q2`, and so on; formula results use `formula`."}),group:r.Record(r.String(),r.Union([r.String(),r.Number()]),{description:"Group-by field values for this result. Empty when no group-by is requested."})}),nC=r.Object({results:r.Array(r.Object({...rC.properties,value:r.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."}),A2={results:[{id:"q1",group:{host:"server-1"},value:123.45}]};Object.assign(nC,{examples:[A2]});var $u=r.Object({series:r.Array(r.Object({...rC.properties,points:r.Array(r.Object({timestamp:r.Integer({description:"Unix timestamp in milliseconds for this point, spaced by `aggregationWindow`."}),value:r.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."}),x2={series:[{id:"q1",group:{host:"server-1"},points:[{timestamp:16094592e5,value:123.45},{timestamp:160945926e4,value:456.78}]}]};Object.assign($u,{examples:[x2]});var R2=r.Omit(As.items,["fill"],{title:"AggregationQuery",description:"Aggregation query. Omit `filter` for an unfiltered query and omit `functions` when no post-processing is needed."}),C2=r.Optional(Qr),oC={timeRange:Tt,queries:r.Array(R2,{maxItems:Os,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 ${Os} 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:C2,dataSource:_R,formula:r.Optional(So)},Rs=r.Object({clusterId:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),iC=r.Object(oC,{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."}),P2={timeRange:{from:1782201500,to:1782203400},dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(iC,{examples:[P2]});var aC=d({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:`${tC}/multi-query/scalar`,method:"POST",body:iC,query:Rs,response:nC}),sC=r.Object({...oC,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."}),U2={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(sC,{examples:[U2]});var cC=d({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:`${tC}/multi-query/timeseries`,method:"POST",body:sC,query:Rs,response:$u});var pC=`/${"v1"}/profiles`,uC=r.Object({...xs,timeRange:Tt},{description:"Profile query request. Send clusterId as a query parameter, not in this JSON body.",examples:[{service:"api",type:"cpu",timeRange:{from:1782201500,to:1782203400},filter:"context.env:prod"}]}),w2=r.Object({stacks:r.Array(r.Object({stack:r.String({description:"Frames from the root to the leaf, joined with `;` (folded stack format)."}),group:r.Record(r.String(),r.String(),{description:"Group-by label values for this stack. Empty when no group-by is requested."}),value:r.Number({description:"Total sample value of this stack, in the unit of the profile type."})}),{description:"One entry per distinct leaf stack, after folding nodes below minFraction."})},{examples:[{stacks:[{stack:"main;handleRequest;encodeJson",group:{},value:125e7},{stack:"main;handleRequest;queryDb",group:{},value:8e8}]}]}),rf=d({description:"Aggregates continuous profiling samples for a service into folded stacks, optionally split by profile labels.",tags:["private"],url:`${pC}/query`,method:"POST",body:uC,query:Rs,response:w2}),v2=r.Object({pprof:r.String({description:"Merged pprof profile, base64-encoded (standard alphabet, padded)."})}),lC=d({description:"Merges continuous profiling samples for a service into a single pprof profile.",tags:["private"],url:`${pC}/pprof`,method:"POST",body:uC,query:Rs,response:v2});var nr=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 mC(e){if(e instanceof nr){let t=[`Error: ${e.message}`];return e.statusCode&&t.push(`Status: ${e.statusCode}`),e.requestId&&t.push(`Request ID: ${e.requestId}`),e.details&&t.push(`Details: ${JSON.stringify(e.details,null,2)}`),t.join(`
144
+ `)}return e instanceof Error?`Error: ${e.message}`:String(e)}var dC=pn(require("node:fs"));function Pi(e){if(e.file){let t=dC.default.readFileSync(e.file==="-"?0:e.file,"utf-8");return JSON.parse(t)}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 nf(e){return s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>s.IsObject(t)&&s.HasPropertyKey(t,"check")&&s.HasPropertyKey(t,"error")&&s.IsFunction(t.check)&&s.IsFunction(t.error))}function hr(e){return s.IsObject(e)&&!s.IsArray(e)}function Fu(e){return s.IsBoolean(e)}function j(e){return hr(e)||Fu(e)}function of(e){return s.HasPropertyKey(e,"additionalItems")&&j(e.additionalItems)}function Wr(e){return s.HasPropertyKey(e,"additionalProperties")&&j(e.additionalProperties)}function af(e){return s.HasPropertyKey(e,"allOf")&&s.IsArray(e.allOf)&&e.allOf.every(t=>j(t))}function Cs(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function sf(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(t=>j(t))}function cf(e){return s.HasPropertyKey(e,"const")}function bo(e){return s.HasPropertyKey(e,"contains")&&j(e.contains)}function Vt(e){return s.HasPropertyKey(e,"default")}function pf(e){return s.HasPropertyKey(e,"dependencies")&&s.IsObject(e.dependencies)&&Object.values(e.dependencies).every(t=>j(t)||s.IsArray(t)&&t.every(n=>s.IsString(n)))}function uf(e){return s.HasPropertyKey(e,"dependentRequired")&&s.IsObject(e.dependentRequired)&&Object.values(e.dependentRequired).every(t=>s.IsArray(t)&&t.every(n=>s.IsString(n)))}function lf(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>j(t))}function Nn(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function mf(e){return s.HasPropertyKey(e,"$dynamicRef")&&s.IsString(e.$dynamicRef)}function df(e){return s.HasPropertyKey(e,"else")&&j(e.else)}function ff(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function gf(e){return s.HasPropertyKey(e,"exclusiveMaximum")&&(s.IsNumber(e.exclusiveMaximum)||s.IsBigInt(e.exclusiveMaximum))}function Zr(e){return s.HasPropertyKey(e,"exclusiveMinimum")&&(s.IsNumber(e.exclusiveMinimum)||s.IsBigInt(e.exclusiveMinimum))}function Ps(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function Xr(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function hf(e){return s.HasPropertyKey(e,"if")&&j(e.if)}function Ui(e){return s.HasPropertyKey(e,"items")&&(j(e.items)||s.IsArray(e.items)&&e.items.every(t=>j(t)))}function yf(e){return Ui(e)&&s.IsArray(e.items)}function Tf(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function Ef(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function ju(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function _f(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function If(e){return s.HasPropertyKey(e,"maxProperties")&&s.IsNumber(e.maxProperties)}function Jr(e){return s.HasPropertyKey(e,"minimum")&&(s.IsNumber(e.minimum)||s.IsBigInt(e.minimum))}function Oo(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function wi(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function Us(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function ws(e){return s.HasPropertyKey(e,"minProperties")&&s.IsNumber(e.minProperties)}function Sf(e){return s.HasPropertyKey(e,"multipleOf")&&(s.IsNumber(e.multipleOf)||s.IsBigInt(e.multipleOf))}function bf(e){return s.HasPropertyKey(e,"not")&&j(e.not)}function Of(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(t=>j(t))}function vs(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function Ns(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(t=>j(t))}function vi(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(t=>j(t))}function Ls(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(t=>j(t))}function Af(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||j(e.propertyNames))}function N2(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function qu(e){return N2(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function xf(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function Rf(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function Ao(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(t=>s.IsString(t))}function Cf(e){return s.HasPropertyKey(e,"then")&&j(e.then)}function Pf(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(t=>s.IsString(t)))}function Ni(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function Bu(e){return s.HasPropertyKey(e,"unevaluatedItems")&&j(e.unevaluatedItems)}function Hu(e){return s.HasPropertyKey(e,"unevaluatedProperties")&&j(e.unevaluatedProperties)}var Rt=class{constructor(){let t=new Set,n=new Set;this.stack=[{indices:t,keys:n}]}Push(){let t=new Set,n=new Set;return this.stack.push({indices:t,keys:n}),!0}Pop(){return this.stack.pop(),!0}AddIndex(t){return this.GetIndices().add(t),!0}AddKey(t){return this.GetKeys().add(t),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(t){for(let n of t)n.GetIndices().forEach(o=>this.GetIndices().add(o)),n.GetKeys().forEach(o=>this.GetKeys().add(o));return!0}},ks=class extends Rt{constructor(t){super(),this.callback=t}AddError(t){return this.callback(t),!1}},ut=class extends ks{constructor(){super(t=>this.errors.push(t)),this.errors=[]}AddError(t){return this.errors.push(t),!1}GetErrors(){return this.errors}};function fC(e,t,n,o){return s.Every(n["~refine"],0,(i,a)=>i.check(o))}function gC(e,t,n,o,i,a){return s.EveryAll(i["~refine"],0,(c,l)=>c.check(a)||t.AddError({keyword:"~refine",schemaPath:n,instancePath:o,params:{index:l,message:c.error(a)}}))}function hC(e){return Ui(e)&&s.IsArray(e.items)}function yC(e,t,n,o){return hC(n)?s.Every(o,0,(a,c)=>s.IsLessThan(c,n.items.length)||Qt(e,t,n.additionalItems,a)&&t.AddIndex(c)):!0}function TC(e,t,n,o,i,a){return hC(i)?s.Every(a,0,(l,m)=>{let f=`${n}/additionalItems`,h=`${o}/${m}`;return s.IsLessThan(m,i.items.length)||Wt(e,t,f,h,i.additionalItems,l)&&t.AddIndex(m)}):!0}function L2(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function EC(e){let t=[];return Ns(e)&&t.push(...s.Keys(e.patternProperties)),Ls(e)&&t.push(...s.Keys(e.properties).map(L2)),s.IsEqual(t.length,0)?"(?!)":`(${t.join("|")})`}function _C(e,t,n,o){let i=new RegExp(EC(n));return s.Every(s.Keys(o),0,(c,l)=>i.test(c)||Qt(e,t,n.additionalProperties,o[c])&&t.AddKey(c))}function IC(e,t,n,o,i,a){let c=new RegExp(EC(i)),l=[];return s.EveryAll(s.Keys(a),0,(f,h)=>{let E=`${n}/additionalProperties`,I=`${o}/${f}`,g=new ut,T=c.test(f)||Wt(e,g,E,I,i.additionalProperties,a[f])&&t.AddKey(f);return T||l.push(f),T})||t.AddError({keyword:"additionalProperties",schemaPath:n,instancePath:o,params:{additionalProperties:l}})}function SC(e,t,n,o){let i=n.allOf.reduce((a,c)=>{let l=new Rt;return oe(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,n.allOf.length)&&t.Merge(i)}function bC(e,t,n,o,i,a){let c=[],l=i.allOf.reduce((f,h,E)=>{let I=`${n}/allOf/${E}`,g=new ut,T=be(e,g,I,o,h,a);return T||c.push(g),T?[...f,g]:f},[]),m=s.IsEqual(l.length,i.allOf.length)&&t.Merge(l);return m||c.forEach(f=>f.GetErrors().forEach(h=>t.AddError(h))),m}function OC(e,t,n,o){let i=n.anyOf.reduce((a,c)=>{let l=new Rt;return oe(e,l,c,o)?[...a,l]:a},[]);return s.IsGreaterThan(i.length,0)&&t.Merge(i)}function AC(e,t,n,o,i,a){let c=[],l=i.anyOf.reduce((f,h,E)=>{let I=new ut,g=`${n}/anyOf/${E}`,T=be(e,I,g,o,h,a);return T||c.push(I),T?[...f,I]:f},[]),m=s.IsGreaterThan(l.length,0)&&t.Merge(l);return m||c.forEach(f=>f.GetErrors().forEach(h=>t.AddError(h))),m||t.AddError({keyword:"anyOf",schemaPath:n,instancePath:o,params:{}})}function wf(e,t,n,o){return n}function xC(e,t,n,o,i,a){return wf(e,t,i,a)||t.AddError({keyword:"boolean",schemaPath:n,instancePath:o,params:{}})}function vf(e,t,n,o){return s.IsValueLike(n.const)?s.IsEqual(o,n.const):s.IsDeepEqual(o,n.const)}function RC(e,t,n,o,i,a){return vf(e,t,i,a)||t.AddError({keyword:"const",schemaPath:n,instancePath:o,params:{allowedValue:i.const}})}function k2(e){return!(Oo(e)&&s.IsEqual(e.minContains,0))}function Nf(e,t,n,o){return k2(n)?!s.IsEqual(o.length,0)&&s.SomeAll(o,(i,a)=>oe(e,t,n.contains,i)&&t.AddIndex(a)):!0}function CC(e,t,n,o,i,a){return Nf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:1}})}function PC(e,t,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(m=>s.HasPropertyKey(o,m)):oe(e,t,l,o)));return i||a}function UC(e,t,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependencies),0,([m,f])=>{let h=`${n}/dependencies/${m}`;return!s.HasPropertyKey(a,m)||(s.IsArray(f)?f.every(E=>s.HasPropertyKey(a,E)||t.AddError({keyword:"dependencies",schemaPath:n,instancePath:o,params:{property:m,dependencies:f}})):be(e,t,h,o,f,a))});return c||l}function wC(e,t,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(m=>s.HasPropertyKey(o,m)));return i||a}function vC(e,t,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependentRequired),0,([m,f])=>!s.HasPropertyKey(a,m)||s.EveryAll(f,0,h=>s.HasPropertyKey(a,h)||t.AddError({keyword:"dependentRequired",schemaPath:n,instancePath:o,params:{property:m,dependencies:f}})));return c||l}function NC(e,t,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)||oe(e,t,l,o));return i||a}function LC(e,t,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependentSchemas),0,([m,f])=>{let h=`${n}/dependentSchemas/${m}`;return!s.HasPropertyKey(a,m)||be(e,t,h,o,f,a)});return c||l}function kC(e,t,n,o){let i=e.DynamicRef(n)??!1;return j(i)&&oe(e,t,i,o)}function MC(e,t,n,o,i,a){let c=e.DynamicRef(i)??!1;return j(c)&&be(e,t,"#",o,c,a)}function Mf(e,t,n,o){return s.Some(n.enum,i=>s.IsValueLike(i)?s.IsEqual(o,i):s.IsDeepEqual(o,i))}function DC(e,t,n,o,i,a){return Mf(e,t,i,a)||t.AddError({keyword:"enum",schemaPath:n,instancePath:o,params:{allowedValues:i.enum}})}function Df(e,t,n,o){return s.IsLessThan(o,n.exclusiveMaximum)}function GC(e,t,n,o,i,a){return Df(e,t,i,a)||t.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:o,params:{comparison:"<",limit:i.exclusiveMaximum}})}function Gf(e,t,n,o){return s.IsGreaterThan(o,n.exclusiveMinimum)}function $C(e,t,n,o,i,a){return Gf(e,t,i,a)||t.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:o,params:{comparison:">",limit:i.exclusiveMinimum}})}var Di={};Zt(Di,{Clear:()=>WC,Entries:()=>_K,Get:()=>bK,Has:()=>SK,IsDate:()=>ki,IsDateTime:()=>Ku,IsDuration:()=>zu,IsEmail:()=>Yu,IsHostname:()=>Qu,IsIPv4:()=>Xu,IsIPv6:()=>Ju,IsIdnEmail:()=>Wu,IsIdnHostname:()=>Zu,IsIri:()=>tl,IsIriReference:()=>el,IsJsonPointer:()=>nl,IsJsonPointerUriFragment:()=>rl,IsRegex:()=>ol,IsRelativeJsonPointer:()=>il,IsTime:()=>Mi,IsUri:()=>pl,IsUriReference:()=>al,IsUriTemplate:()=>sl,IsUrl:()=>ul,IsUuid:()=>ll,Reset:()=>ZC,Set:()=>IK,Test:()=>OK});var M2=[0,31,28,31,30,31,30,31,31,30,31,30,31],D2=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function G2(e){return e%4===0&&(e%100!==0||e%400===0)}function ki(e){let t=D2.exec(e);if(!t)return!1;let n=+t[1],o=+t[2],i=+t[3];return o>=1&&o<=12&&i>=1&&i<=(o===2&&G2(n)?29:M2[o])}var $2=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function Mi(e,t=!0){let n=$2.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),m=+(n[6]||0);if(l>23||m>59||t&&!n[4]&&e.toLowerCase().indexOf("z")===-1)return!1;if(o<=23&&i<=59&&a<60)return!0;let f=i-m*c,h=o-l*c-(f<0?1:0);return(h===23||h===-1)&&(f===59||f===-1)&&a<61}function Ku(e,t=!0){let n=e.split(/T/i);return n.length===2&&ki(n[0])&&Mi(n[1],t)}var F2=/^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;function zu(e){return F2.test(e)}var j2=/^(?!.*\.\.)[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 Yu(e){return j2.test(e)}var xo=36,Vu=1,$f=26,q2=38,B2=700,H2=72,K2=128;function z2(e,t,n){e=n?Math.floor(e/B2):e>>1,e+=Math.floor(e/t);let o=0;for(;e>(xo-Vu)*$f>>1;)e=Math.floor(e/(xo-Vu)),o+=xo;return o+Math.floor((xo-Vu+1)*e/(e+q2))}function FC(e){let t=[],n=K2,o=0,i=H2,a=e.lastIndexOf("-");if(a>0)for(let l=0;l<a;l++){let m=e.charCodeAt(l);if(m>=128)throw new Error("Invalid punycode: non-basic before delimiter");t.push(m)}let c=a<0?0:a+1;for(;c<e.length;){let l=o,m=1,f=xo;for(;;){if(c>=e.length)throw new Error("Invalid punycode: unexpected end of input");let E=e.charCodeAt(c++),I;if(E>=97&&E<=122)I=E-97;else if(E>=48&&E<=57)I=E-48+26;else if(E>=65&&E<=90)he();else throw new Error("Invalid punycode: bad digit character");o+=I*m;let g=f<=i?Vu:f>=i+$f?$f:f-i;if(I<g)break;m*=xo-g,f+=xo}let h=t.length+1;i=z2(o-l,h,l===0),n+=Math.floor(o/h),o%=h,t.splice(o,0,n),o++}return globalThis.String.fromCodePoint(...t)}function V2(e){return new RegExp("\\p{Mn}","u").test(String.fromCodePoint(e))}function Q2(e){return new RegExp("\\p{Mc}","u").test(String.fromCodePoint(e))}function W2(e){return new RegExp("\\p{Me}","u").test(String.fromCodePoint(e))}function Z2(e){return V2(e)||Q2(e)||W2(e)}var X2=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347]),J2=new Set([2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,6980,7082,7083,43456,69702,69759,69817,69939,69940,70080,70197,70477,70722,70850,71103,71231,71350,72767,73028,73029]);function eK(e){return new RegExp("\\p{Script=Greek}","u").test(String.fromCodePoint(e))}function tK(e){return new RegExp("\\p{Script=Hebrew}","u").test(String.fromCodePoint(e))}function rK(e){return new RegExp("\\p{Script=Hiragana}","u").test(String.fromCodePoint(e))}function nK(e){return new RegExp("\\p{Script=Katakana}","u").test(String.fromCodePoint(e))}function oK(e){return new RegExp("\\p{Script=Han}","u").test(String.fromCodePoint(e))}function iK(e){return e>=1632&&e<=1641}function aK(e){return e>=1776&&e<=1785}function jC(e){return J2.has(e)}function qC(e){if(e.length===0)return he();let t=[...e].map(c=>c.codePointAt(0)),n=t.length;if(t[0]===45||t[n-1]===45||n>=4&&t[2]===45&&t[3]===45||Z2(t[0]))return!1;let o=!1,i=!1,a=!1;for(let c=0;c<n;c++){let l=t[c];if(X2.has(l))return!1;(rK(l)||nK(l)||oK(l))&&(o=!0),iK(l)&&(i=!0),aK(l)&&(a=!0);let m=t[c-1],f=t[c+1];switch(l){case 183:if(m!==108||f!==108)return!1;break;case 885:if(f===void 0||!eK(f))return!1;break;case 1523:case 1524:if(m===void 0||!tK(m))return!1;break;case 8204:if(m===void 0||m<128&&!jC(m))return!1;break;case 8205:if(m===void 0||!jC(m))return!1;break;case 12539:break}}return!(e.includes("\u30FB")&&!o||i&&a)}function sK(e){if(e.charCodeAt(0)===45||e.charCodeAt(e.length-1)===45||e.length>=4&&e.charCodeAt(2)===45&&e.charCodeAt(3)===45)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45))return!1}return!0}function BC(e){return e.toLowerCase().startsWith("xn--")}function HC(e){try{let t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;let o=FC(t);return o?qC(o):!1}catch{return!1}}function KC(e){return e.length===0||e.length>63?!1:BC(e)?HC(e):qC(e)}function zC(e){return e.length===0||e.length>63?!1:BC(e)?HC(e):sK(e)}function Qu(e){if(e.length===0||e.length>253||e.charCodeAt(e.length-1)===46)return!1;for(let t of e.split("."))if(!zC(t))return!1;return!0}var pK=/^(?!.*\.\.)[\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 Wu(e){return pK.test(e)}function Zu(e){if(e.length===0||e.includes(" "))return!1;let t=e.normalize("NFC").replace(/[\u002E\u3002\uFF0E\uFF61]/g,".");if(t.length>253)return!1;for(let n of t.split("."))if(!KC(n))return!1;return!0}function Ff(e,t,n){let o=0,i=0,a=0,c=0;for(let l=t;l<n;l++){let m=e.charCodeAt(l);if(m===46){if(a===0||i>255||c===48&&a>1)return!1;o++,i=0,a=0,c=0}else if(m>=48&&m<=57)a===0&&(c=m),i=i*10+(m-48),a++;else return!1}return o===3&&a>0&&i<=255&&!(c===48&&a>1)}function Xu(e){return Ff(e,0,e.length)}function uK(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Ju(e){let t=e.length;if(t===0)return!1;let n=0,o=!1,i=0;if(e.charCodeAt(0)===58&&e.charCodeAt(1)===58){if(t===2)return!0;o=!0,i=2}for(;i<t;){let a=0,c=i;for(;i<t&&uK(e.charCodeAt(i));)i++,a++;if(a===0)return!1;let l=e.charCodeAt(i);if(l===46){if(!Ff(e,c,t))return!1;n+=2,i=t;break}if(a>4)return!1;if(n++,i===t)break;if(l!==58)return!1;if(i++,e.charCodeAt(i)===58){if(o||e.charCodeAt(i+1)===58)return!1;if(o=!0,i++,i===t)break}}return o?n<=7:n===8}function YC(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function el(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 t=e.indexOf(":");return t>0&&/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e.substring(0,t))?YC(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&t===-1?!1:YC(e)}function tl(e){try{return new URL(e),!0}catch{return!1}}var lK=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function rl(e){return lK.test(e)}var mK=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function nl(e){return mK.test(e)}function ol(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}var dK=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function il(e){return dK.test(e)}var fK=/^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;function al(e){return fK.test(e)}var gK=/^(?:(?:[^\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 sl(e){return gK.test(e)}function VC(e){return e>=97&&e<=122||e>=65&&e<=90}function QC(e){return VC(e)||e>=48&&e<=57}function cl(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function hK(e){return QC(e)||e===43||e===45||e===46}function jf(e){return QC(e)||e===45||e===46||e===95||e===126}function qf(e){return e===33||e===36||e===38||e===39||e===40||e===41||e===42||e===43||e===44||e===59||e===61}function yK(e){return jf(e)||qf(e)||e===58||e===64}function pl(e){let t=e.length;if(t===0||!VC(e.charCodeAt(0)))return!1;let n=1;for(;n<t;){let o=e.charCodeAt(n);if(o===58)break;if(!hK(o))return!1;n++}if(e.charCodeAt(n)!==58)return!1;if(n++,e.charCodeAt(n)===47&&e.charCodeAt(n+1)===47){n+=2;let o=n,i=-1;for(let a=n;a<t;a++){let c=e.charCodeAt(a);if(c===64){i=a;break}if(c===47||c===63||c===35)break}if(i!==-1){for(let a=o;a<i;a++){let c=e.charCodeAt(a);if(c===91||c===93)return!1;if(c===37){if(a+2>=i||!cl(e.charCodeAt(a+1))||!cl(e.charCodeAt(a+2)))return!1;a+=2}else if(!jf(c)&&!qf(c)&&c!==58)return!1}n=i+1}if(e.charCodeAt(n)===91){for(n++;n<t&&e.charCodeAt(n)!==93;)n++;if(e.charCodeAt(n)!==93)return!1;n++}else for(;n<t;){let a=e.charCodeAt(n);if(a===47||a===63||a===35||a===58)break;if(a<128&&!jf(a)&&!qf(a))return!1;n++}if(e.charCodeAt(n)===58)for(n++;n<t;){let a=e.charCodeAt(n);if(a===47||a===63||a===35)break;if(a<48||a>57)return!1;n++}}for(;n<t;){let o=e.charCodeAt(n);if(o===37){if(n+2>=t||!cl(e.charCodeAt(n+1))||!cl(e.charCodeAt(n+2)))return!1;n+=2}else{if(o>127)return!1;if(!(yK(o)||o===47||o===63||o===35))return!1}n++}return!0}var TK=/^(?: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 ul(e){return TK.test(e)}var EK=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function ll(e){return EK.test(e)}var Ce=new Map;function WC(){Ce.clear()}function _K(){return[...Ce.entries()]}function IK(e,t){Ce.set(e,t)}function SK(e){return Ce.has(e)}function bK(e){return Ce.get(e)}function OK(e,t){return Ce.get(e)?.(t)??!0}function ZC(){WC(),Ce.set("date-time",Ku),Ce.set("date",ki),Ce.set("duration",zu),Ce.set("email",Yu),Ce.set("hostname",Qu),Ce.set("idn-email",Wu),Ce.set("idn-hostname",Zu),Ce.set("ipv4",Xu),Ce.set("ipv6",Ju),Ce.set("iri-reference",el),Ce.set("iri",tl),Ce.set("json-pointer-uri-fragment",rl),Ce.set("json-pointer",nl),Ce.set("regex",ol),Ce.set("relative-json-pointer",il),Ce.set("time",Mi),Ce.set("uri-reference",al),Ce.set("uri-template",sl),Ce.set("uri",pl),Ce.set("url",ul),Ce.set("uuid",ll)}ZC();function Bf(e,t,n,o){return Di.Test(n.format,o)}function XC(e,t,n,o,i,a){return Bf(e,t,i,a)||t.AddError({keyword:"format",schemaPath:n,instancePath:o,params:{format:i.format}})}function JC(e,t,n,o){let i=Cf(n)?n.then:!0,a=df(n)?n.else:!0;return oe(e,t,n.if,o)?oe(e,t,i,o):oe(e,t,a,o)}function eP(e,t,n,o,i,a){let c=Cf(i)?i.then:!0,l=df(i)?i.else:!0,m=new ut,f=be(e,m,`${n}/if`,o,i.if,a)?be(e,m,`${n}/then`,o,c,a)||t.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"then"}}):be(e,t,`${n}/else`,o,l,a)||t.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"else"}});return f&&t.Merge([m]),f}function AK(e,t,n,o){return s.Every(n.items,0,(i,a)=>s.IsLessEqualThan(o.length,a)||Qt(e,t,i,o[a])&&t.AddIndex(a))}function xK(e,t,n,o,i,a){return s.EveryAll(i.items,0,(c,l)=>{let m=`${n}/items/${l}`,f=`${o}/${l}`;return s.IsLessEqualThan(a.length,l)||Wt(e,t,m,f,c,a[l])&&t.AddIndex(l)})}function RK(e,t,n,o){let i=vi(n)?n.prefixItems.length:0;return s.Every(o,i,(a,c)=>Qt(e,t,n.items,a)&&t.AddIndex(c))}function CK(e,t,n,o,i,a){let c=vi(i)?i.prefixItems.length:0;return s.EveryAll(a,c,(l,m)=>{let f=`${n}/items`,h=`${o}/${m}`;return Wt(e,t,f,h,i.items,l)&&t.AddIndex(m)})}function tP(e,t,n,o){return yf(n)?AK(e,t,n,o):RK(e,t,n,o)}function rP(e,t,n,o,i,a){return yf(i)?xK(e,t,n,o,i,a):CK(e,t,n,o,i,a)}function PK(e){return bo(e)}function Hf(e,t,n,o){if(!PK(n))return!0;let i=s.Counted(o,a=>oe(e,t,n.contains,a));return s.IsLessEqualThan(i,n.maxContains)}function nP(e,t,n,o,i,a){let c=Oo(i)?i.minContains:1;return Hf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:c,maxContains:i.maxContains}})}function Kf(e,t,n,o){return s.IsLessEqualThan(o,n.maximum)}function oP(e,t,n,o,i,a){return Kf(e,t,i,a)||t.AddError({keyword:"maximum",schemaPath:n,instancePath:o,params:{comparison:"<=",limit:i.maximum}})}function zf(e,t,n,o){return s.IsLessEqualThan(o.length,n.maxItems)}function iP(e,t,n,o,i,a){return zf(e,t,i,a)||t.AddError({keyword:"maxItems",schemaPath:n,instancePath:o,params:{limit:i.maxItems}})}function Yf(e,t,n,o){return s.IsMaxLength(o,n.maxLength)}function aP(e,t,n,o,i,a){return Yf(e,t,i,a)||t.AddError({keyword:"maxLength",schemaPath:n,instancePath:o,params:{limit:i.maxLength}})}function Vf(e,t,n,o){return s.IsLessEqualThan(s.Keys(o).length,n.maxProperties)}function sP(e,t,n,o,i,a){return Vf(e,t,i,a)||t.AddError({keyword:"maxProperties",schemaPath:n,instancePath:o,params:{limit:i.maxProperties}})}function UK(e){return bo(e)}function Qf(e,t,n,o){if(!UK(n))return!0;let i=s.Counted(o,(a,c)=>oe(e,t,n.contains,a)&&t.AddIndex(c));return s.IsGreaterEqualThan(i,n.minContains)}function cP(e,t,n,o,i,a){return Qf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:i.minContains}})}function Wf(e,t,n,o){return s.IsGreaterEqualThan(o,n.minimum)}function pP(e,t,n,o,i,a){return Wf(e,t,i,a)||t.AddError({keyword:"minimum",schemaPath:n,instancePath:o,params:{comparison:">=",limit:i.minimum}})}function Zf(e,t,n,o){return s.IsGreaterEqualThan(o.length,n.minItems)}function uP(e,t,n,o,i,a){return Zf(e,t,i,a)||t.AddError({keyword:"minItems",schemaPath:n,instancePath:o,params:{limit:i.minItems}})}function Xf(e,t,n,o){return s.IsMinLength(o,n.minLength)}function lP(e,t,n,o,i,a){return Xf(e,t,i,a)||t.AddError({keyword:"minLength",schemaPath:n,instancePath:o,params:{limit:i.minLength}})}function Jf(e,t,n,o){return s.IsGreaterEqualThan(s.Keys(o).length,n.minProperties)}function mP(e,t,n,o,i,a){return Jf(e,t,i,a)||t.AddError({keyword:"minProperties",schemaPath:n,instancePath:o,params:{limit:i.minProperties}})}function eg(e,t,n,o){return s.IsMultipleOf(o,n.multipleOf)}function dP(e,t,n,o,i,a){return eg(e,t,i,a)||t.AddError({keyword:"multipleOf",schemaPath:n,instancePath:o,params:{multipleOf:i.multipleOf}})}function tg(e,t,n,o){let i=new Rt;return!oe(e,i,n.not,o)&&t.Merge([i])}function fP(e,t,n,o,i,a){return tg(e,t,i,a)||t.AddError({keyword:"not",schemaPath:n,instancePath:o,params:{}})}function gP(e,t,n,o){let i=n.oneOf.reduce((a,c)=>{let l=new Rt;return oe(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,1)&&t.Merge(i)}function hP(e,t,n,o,i,a){let c=[],l=[],m=i.oneOf.reduce((h,E,I)=>{let g=new ut,T=`${n}/oneOf/${I}`,O=be(e,g,T,o,E,a);return O&&l.push(I),O||c.push(g),O?[...h,g]:h},[]),f=s.IsEqual(m.length,1)&&t.Merge(m);return!f&&s.IsEqual(l.length,0)&&c.forEach(h=>h.GetErrors().forEach(E=>t.AddError(E))),f||t.AddError({keyword:"oneOf",schemaPath:n,instancePath:o,params:{passingSchemas:l}})}function rg(e,t,n,o){return(s.IsString(n.pattern)?new RegExp(n.pattern,"u"):n.pattern).test(o)}function yP(e,t,n,o,i,a){return rg(e,t,i,a)||t.AddError({keyword:"pattern",schemaPath:n,instancePath:o,params:{pattern:i.pattern}})}function TP(e,t,n,o){return s.Every(s.Entries(n.patternProperties),0,([i,a])=>{let c=new RegExp(i,"u");return s.Every(s.Entries(o),0,([l,m])=>!c.test(l)||Qt(e,t,a,m)&&t.AddKey(l))})}function EP(e,t,n,o,i,a){return s.EveryAll(s.Entries(i.patternProperties),0,([c,l])=>{let m=`${n}/patternProperties/${c}`,f=new RegExp(c,"u");return s.EveryAll(s.Entries(a),0,([h,E])=>{let I=`${o}/${h}`;return!f.test(h)||Wt(e,t,m,I,l,E)&&t.AddKey(h)})})}function _P(e,t,n,o){return s.IsEqual(o.length,0)||s.Every(n.prefixItems,0,(i,a)=>s.IsLessEqualThan(o.length,a)||Qt(e,t,i,o[a])&&t.AddIndex(a))}function IP(e,t,n,o,i,a){return s.IsEqual(a.length,0)||s.EveryAll(i.prefixItems,0,(c,l)=>{let m=`${n}/prefixItems/${l}`,f=`${o}/${l}`;return s.IsLessEqualThan(a.length,l)||Wt(e,t,m,f,c,a[l])&&t.AddIndex(l)})}function ng(e,t){return e.includes(t)||at.Get().exactOptionalPropertyTypes}function og(e,t){return s.IsUndefined(e[t])}function SP(e,t,n,o){let i=Ao(n)?n.required:[];return s.Every(s.Entries(n.properties),0,([c,l])=>{let m=!s.HasPropertyKey(o,c)||Qt(e,t,l,o[c])&&t.AddKey(c);return ng(i,c)?m:og(o,c)||m})}function bP(e,t,n,o,i,a){let c=Ao(i)?i.required:[];return s.EveryAll(s.Entries(i.properties),0,([m,f])=>{let h=`${n}/properties/${m}`,E=`${o}/${m}`,I=()=>!s.HasPropertyKey(a,m)||Wt(e,t,h,E,f,a[m])&&t.AddKey(m);return ng(c,m)?I():og(a,m)||I()})}function OP(e,t,n,o){return s.Every(s.Keys(o),0,(i,a)=>oe(e,t,n.propertyNames,i))}function AP(e,t,n,o,i,a){let c=[];return s.EveryAll(s.Keys(a),0,(m,f)=>{let h=`${o}/${m}`,E=`${n}/propertyNames`,I=new ut,g=be(e,I,E,h,i.propertyNames,m);return g||c.push(m),g})||t.AddError({keyword:"propertyNames",schemaPath:n,instancePath:o,params:{propertyNames:c}})}function xP(e,t,n,o){let i=e.RecursiveRef(n)??!1;return j(i)&&oe(e,t,i,o)}function RP(e,t,n,o,i,a){let c=e.RecursiveRef(i)??!1;return j(c)&&be(e,t,"#",o,c,a)}function CP(e,t,n,o){let i=e.Ref(n)??!1,a=new Rt,c=j(i)&&oe(e,a,i,o);return c&&t.Merge([a]),c}function PP(e,t,n,o,i,a){let c=e.Ref(i)??!1,l=new ut,m=j(c)&&be(e,l,"#",o,c,a);return m&&t.Merge([l]),m||l.GetErrors().forEach(f=>t.AddError(f)),m}function UP(e,t,n,o){return s.Every(n.required,0,i=>s.HasPropertyKey(o,i))}function wP(e,t,n,o,i,a){let c=[];return s.EveryAll(i.required,0,m=>{let f=s.HasPropertyKey(a,m);return f||c.push(m),f})||t.AddError({keyword:"required",schemaPath:n,instancePath:o,params:{requiredProperties:c}})}function ig(e,t,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,"bigint")?s.IsBigInt(i):s.IsEqual(n,"constructor")?s.IsConstructor(i):s.IsEqual(n,"function")?s.IsFunction(i):s.IsEqual(n,"symbol")?s.IsSymbol(i):s.IsEqual(n,"undefined")?s.IsUndefined(i):s.IsEqual(n,"void")?s.IsUndefined(i):!0}function vP(e,t,n,o,i){return s.Some(n,a=>ig(e,t,a,o,i))}function NP(e,t,n,o){return s.IsArray(n.type)?vP(e,t,n.type,n,o):ig(e,t,n.type,n,o)}function LP(e,t,n,o,i,a){return(s.IsArray(i.type)?vP(e,t,i.type,i,a):ig(e,t,i.type,i,a))||t.AddError({keyword:"type",schemaPath:n,instancePath:o,params:{type:i.type}})}function kP(e,t,n,o){let i=t.GetIndices();return s.Every(o,0,(a,c)=>(i.has(c)||oe(e,t,n.unevaluatedItems,a))&&t.AddIndex(c))}function MP(e,t,n,o,i,a){let c=t.GetIndices(),l=[];return s.EveryAll(a,0,(f,h)=>{let E=new ut,I=(c.has(h)||be(e,E,n,o,i.unevaluatedItems,f))&&t.AddIndex(h);return I||l.push(h),I})||t.AddError({keyword:"unevaluatedItems",schemaPath:n,instancePath:o,params:{unevaluatedItems:l}})}function DP(e,t,n,o){let i=t.GetKeys();return s.Every(s.Entries(o),0,([a,c])=>i.has(a)||oe(e,t,n.unevaluatedProperties,c)&&t.AddKey(a))}function GP(e,t,n,o,i,a){let c=t.GetKeys(),l=[];return s.EveryAll(s.Entries(a),0,([f,h])=>{let E=new ut,I=c.has(f)||be(e,E,n,o,i.unevaluatedProperties,h)&&t.AddKey(f);return I||l.push(f),I})||t.AddError({keyword:"unevaluatedProperties",schemaPath:n,instancePath:o,params:{unevaluatedProperties:l}})}function $P(e){return!s.IsEqual(e.uniqueItems,!1)}function FP(e,t,n,o){if(!$P(n))return!0;let i=new Set(o.map(eo.Hash)).size,a=o.length;return s.IsEqual(i,a)}function jP(e,t,n,o,i,a){if(!$P(i))return!0;let c=new Set,l=a.reduce((f,h,E)=>{let I=eo.Hash(h);return c.has(I)?[...f,E]:(c.add(I),f)},[]);return s.IsEqual(l.length,0)||t.AddError({keyword:"uniqueItems",schemaPath:n,instancePath:o,params:{duplicateItems:l}})}function Qt(e,t,n,o){return t.Push()&&oe(e,t,n,o)&&t.Pop()}function oe(e,t,n,o){e.Push(n);let i=Fu(n)?wf(e,t,n,o):(!Pf(n)||NP(e,t,n,o))&&(!(s.IsObject(o)&&!s.IsArray(o))||(!Ao(n)||UP(e,t,n,o))&&(!Wr(n)||_C(e,t,n,o))&&(!pf(n)||PC(e,t,n,o))&&(!uf(n)||wC(e,t,n,o))&&(!lf(n)||NC(e,t,n,o))&&(!Ns(n)||TP(e,t,n,o))&&(!Ls(n)||SP(e,t,n,o))&&(!Af(n)||OP(e,t,n,o))&&(!ws(n)||Jf(e,t,n,o))&&(!If(n)||Vf(e,t,n,o)))&&(!s.IsArray(o)||(!of(n)||yC(e,t,n,o))&&(!bo(n)||Nf(e,t,n,o))&&(!Ui(n)||tP(e,t,n,o))&&(!Ef(n)||Hf(e,t,n,o))&&(!ju(n)||zf(e,t,n,o))&&(!Oo(n)||Qf(e,t,n,o))&&(!wi(n)||Zf(e,t,n,o))&&(!vi(n)||_P(e,t,n,o))&&(!Ni(n)||FP(e,t,n,o)))&&(!s.IsString(o)||(!_f(n)||Yf(e,t,n,o))&&(!Us(n)||Xf(e,t,n,o))&&(!Ps(n)||Bf(e,t,n,o))&&(!vs(n)||rg(e,t,n,o)))&&(!(s.IsNumber(o)||s.IsBigInt(o))||(!gf(n)||Df(e,t,n,o))&&(!Zr(n)||Gf(e,t,n,o))&&(!Tf(n)||Kf(e,t,n,o))&&(!Jr(n)||Wf(e,t,n,o))&&(!Sf(n)||eg(e,t,n,o)))&&(!Rf(n)||CP(e,t,n,o))&&(!xf(n)||xP(e,t,n,o))&&(!mf(n)||kC(e,t,n,o))&&(!cf(n)||vf(e,t,n,o))&&(!ff(n)||Mf(e,t,n,o))&&(!hf(n)||JC(e,t,n,o))&&(!bf(n)||tg(e,t,n,o))&&(!af(n)||SC(e,t,n,o))&&(!sf(n)||OC(e,t,n,o))&&(!Of(n)||gP(e,t,n,o))&&(!Bu(n)||!s.IsArray(o)||kP(e,t,n,o))&&(!Hu(n)||!s.IsObject(o)||DP(e,t,n,o))&&(!nf(n)||fC(e,t,n,o));return e.Pop(n),i}function Wt(e,t,n,o,i,a){return t.Push()&&be(e,t,n,o,i,a)&&t.Pop()}function be(e,t,n,o,i,a){e.Push(i);let c=Fu(i)?xC(e,t,n,o,i,a):!!(+(!Pf(i)||LP(e,t,n,o,i,a))&+(!(s.IsObject(a)&&!s.IsArray(a))||!!(+(!Ao(i)||wP(e,t,n,o,i,a))&+(!Wr(i)||IC(e,t,n,o,i,a))&+(!pf(i)||UC(e,t,n,o,i,a))&+(!uf(i)||vC(e,t,n,o,i,a))&+(!lf(i)||LC(e,t,n,o,i,a))&+(!Ns(i)||EP(e,t,n,o,i,a))&+(!Ls(i)||bP(e,t,n,o,i,a))&+(!Af(i)||AP(e,t,n,o,i,a))&+(!ws(i)||mP(e,t,n,o,i,a))&+(!If(i)||sP(e,t,n,o,i,a))))&+(!s.IsArray(a)||!!(+(!of(i)||TC(e,t,n,o,i,a))&+(!bo(i)||CC(e,t,n,o,i,a))&+(!Ui(i)||rP(e,t,n,o,i,a))&+(!Ef(i)||nP(e,t,n,o,i,a))&+(!ju(i)||iP(e,t,n,o,i,a))&+(!Oo(i)||cP(e,t,n,o,i,a))&+(!wi(i)||uP(e,t,n,o,i,a))&+(!vi(i)||IP(e,t,n,o,i,a))&+(!Ni(i)||jP(e,t,n,o,i,a))))&+(!s.IsString(a)||!!(+(!_f(i)||aP(e,t,n,o,i,a))&+(!Us(i)||lP(e,t,n,o,i,a))&+(!Ps(i)||XC(e,t,n,o,i,a))&+(!vs(i)||yP(e,t,n,o,i,a))))&+(!(s.IsNumber(a)||s.IsBigInt(a))||!!(+(!gf(i)||GC(e,t,n,o,i,a))&+(!Zr(i)||$C(e,t,n,o,i,a))&+(!Tf(i)||oP(e,t,n,o,i,a))&+(!Jr(i)||pP(e,t,n,o,i,a))&+(!Sf(i)||dP(e,t,n,o,i,a))))&+(!Rf(i)||PP(e,t,n,o,i,a))&+(!xf(i)||RP(e,t,n,o,i,a))&+(!mf(i)||MC(e,t,n,o,i,a))&+(!cf(i)||RC(e,t,n,o,i,a))&+(!ff(i)||DC(e,t,n,o,i,a))&+(!hf(i)||eP(e,t,n,o,i,a))&+(!bf(i)||fP(e,t,n,o,i,a))&+(!af(i)||bC(e,t,n,o,i,a))&+(!sf(i)||AC(e,t,n,o,i,a))&+(!Of(i)||hP(e,t,n,o,i,a))&+(!Bu(i)||!s.IsArray(a)||MP(e,t,n,o,i,a))&+(!Hu(i)||!s.IsObject(a)||GP(e,t,n,o,i,a)))&&(!nf(i)||gC(e,t,n,o,i,a));return e.Pop(i),c}var Ln={};Zt(Ln,{DynamicRef:()=>KK,Ref:()=>sg});var Gi={};Zt(Gi,{Delete:()=>GK,Get:()=>MK,Has:()=>kK,Indices:()=>Gs,Set:()=>DK});function qP(e){if(e.length===0)throw Error("Cannot set root")}function BP(e){if(!s.IsObject(e))throw Error("Cannot set value")}function wK(e){if(s.IsUnsafePropertyKey(e))throw Error("Pointer contains unsafe property key")}function HP(e){for(let t of e)wK(t)}function vK(e){return/^(0|[1-9]\d*)$/.test(e)}function KP(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function NK(e,t){return s.IsObject(t)&&s.HasPropertyKey(t,e)}function LK(e,t){return s.IsObject(t)&&!s.IsUnsafePropertyKey(e)?t[e]:void 0}function ag(e,t){return e.reduce((n,o)=>LK(o,n),t)}function Gs(e){if(s.IsEqual(e.length,0))return[];let t=e.split("/").map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"));return t.length>0&&t[0]===""?t.slice(1):t}function kK(e,t){let n=e;return Gs(t).every(o=>NK(o,n)?(n=n[o],!0):!1)}function MK(e,t){let n=Gs(t);return ag(n,e)}function DK(e,t,n){let o=Gs(t);qP(o),HP(o);let[i,a]=KP(o),c=ag(i,e);return BP(c),c[a]=n,e}function GK(e,t){let n=Gs(t);qP(n),HP(n);let[o,i]=KP(n),a=ag(o,e);return BP(a),s.IsArray(a)&&vK(i)?a.splice(+i,1):delete a[i],e}function $K(e,t,n){if(e.$id===n.hash)return e;let o=new URL(e.$id,t.href),i=new URL(n.href,t.href);if(s.IsEqual(o.pathname,i.pathname))return n.hash.startsWith("#")?zP(e,t,n):e}function FK(e,t,n){let o=new URL(`#${e.$anchor}`,t.href),i=new URL(n.href,t.href);return s.IsEqual(o.href,i.href)?e:void 0}function jK(e,t,n){let o=new URL(`#${e.$dynamicAnchor}`,t.href),i=new URL(n.href,t.href);return s.IsEqual(o.href,i.href)?e:void 0}function zP(e,t,n){if(n.href.endsWith("#"))return e;if(!n.hash.startsWith("#"))return;let o=decodeURIComponent(n.hash.slice(1));if(o.startsWith("/"))return Gi.Get(e,o)}function qK(e,t,n){if(Xr(e)){let o=$K(e,t,n);if(!s.IsUndefined(o))return o}if(Cs(e)){let o=FK(e,t,n);if(!s.IsUndefined(o))return o}if(Nn(e)){let o=jK(e,t,n);if(!s.IsUndefined(o))return o}return zP(e,t,n)}function BK(e,t,n){return e.reduce((o,i)=>{let a=cg(i,t,n);return s.IsUndefined(a)?o:a},void 0)}function HK(e,t,n){return s.Keys(e).reduce((o,i)=>{let a=cg(e[i],t,n);return s.IsUndefined(a)?o:a},void 0)}function cg(e,t,n){let o=hr(e)&&Xr(e)?new URL(e.$id,t.href):t;if(hr(e)){let i=qK(e,o,n);if(!s.IsUndefined(i))return i}if(s.IsArray(e))return BK(e,o,n);if(s.IsObject(e))return HK(e,o,n)}function sg(e,t){let n=new URL("http://unknown/"),o=Xr(e)?new URL(e.$id,n.href):n,i=new URL(t,o.href);return cg(e,o,i)}function KK(e,t,n,o){let i=n.$dynamicRef.startsWith("#")?sg(t,n.$dynamicRef):sg(e,n.$dynamicRef);return s.IsUndefined(i)?void 0:!hr(i)||!Nn(i)||new URL(n.$dynamicRef,"http://unknown/").hash.startsWith("#/")?i:o.find(l=>l.$dynamicAnchor===i.$dynamicAnchor)??i}var $i=function(e,t,n,o){if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?o:n==="a"?o.call(e):o?o.value:t.get(e)},kn,YP,VP,QP,WP,Ro=class{constructor(t,n){kn.add(this),this.context=t,this.schema=n,this.ids=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[]}BaseURL(){return this.ids.reduce((t,n)=>new URL(n.$id,t),new URL("http://unknown"))}Base(){return this.ids[this.ids.length-1]??this.schema}Push(t){hr(t)&&(Xr(t)&&(this.ids.push(t),$i(this,kn,"m",YP).call(this,t)),Cs(t)&&this.anchors.push(t),qu(t)&&this.recursiveAnchors.push(t),Nn(t)&&this.dynamicAnchors.push(t))}Pop(t){hr(t)&&(Xr(t)&&(this.ids.pop(),$i(this,kn,"m",VP).call(this,t)),Cs(t)&&this.anchors.pop(),qu(t)&&this.recursiveAnchors.pop(),Nn(t)&&this.dynamicAnchors.pop())}Ref(t){return $i(this,kn,"m",QP).call(this,t)??$i(this,kn,"m",WP).call(this,t)}RecursiveRef(t){return qu(this.Base())?Ln.Ref(this.recursiveAnchors[0],t.$recursiveRef):Ln.Ref(this.Base(),t.$recursiveRef)}DynamicRef(t){let n=this.schema;return Ln.DynamicRef(n,this.Base(),t,this.dynamicAnchors)}};kn=new WeakSet,YP=function e(t,n=!0){if(!hr(t))return;let o=t;if(!(!n&&Xr(o))){!n&&Nn(o)&&this.dynamicAnchors.push(o);for(let i of s.Keys(o))$i(this,kn,"m",e).call(this,o[i],!1)}},VP=function e(t,n=!0){if(!hr(t))return;let o=t;if(!(!n&&Xr(o))){!n&&Nn(o)&&this.dynamicAnchors.pop();for(let i of s.Keys(o))$i(this,kn,"m",e).call(this,o[i],!1)}},QP=function(t){return s.HasPropertyKey(this.context,t.$ref)?this.context[t.$ref]:void 0},WP=function(t){let n=this.schema;return t.$ref.startsWith("#")?Ln.Ref(this.Base(),t.$ref):Ln.Ref(n,t.$ref)};function ml(...e){let[t,n,o]=ie.Match(e,{3:(h,E,I)=>[h,E,I],2:(h,E)=>[{},h,E]}),i=at.Get(),a=NT(),c=[],l=new Ro(t,n),m=new ks(h=>{if(!s.IsGreaterEqualThan(c.length,i.maxErrors))return c.push({...h,message:a(h)})});return[be(l,m,"#","",n,o),c]}function ug(...e){let[t,n,o]=ie.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),i=new Ro(t,n),a=new Rt;return oe(i,a,n,o)}function ye(...e){let[t,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return ug(t,n,o)}function Mn(...e){let[t,n,o]=ie.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),[i,a]=ml(t,n,o);return a}var Dn=class extends Error{constructor(t,n,o){super(t),Object.defineProperty(this,"cause",{value:{source:t,errors:o,value:n},writable:!1,configurable:!1,enumerable:!1})}};function ZP(e,t,n){return s.IsArray(n)?n.map(o=>lt(e,t.items,o)):n}function XP(e,t,n){return lt({...e,...t.$defs},st(t.$ref),n)}function VK(e,t){let n=s.HasPropertyKey(t,"unevaluatedProperties")?{additionalProperties:t.unevaluatedProperties}:{},o=Jt(e,t),i=yt(o);return $(i)?ru(i,n):i}function JP(e,t,n){let o=VK(e,t);return lt(e,o,n)}function dl(e){return s.HasPropertyKey(e,"additionalProperties")?e.additionalProperties:void 0}function eU(e,t,n){if(!s.IsObject(n)||s.IsArray(n))return n;let o=dl(t);for(let i of s.Keys(n)){if(s.HasPropertyKey(t.properties,i)){n[i]=lt(e,t.properties[i],n[i]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||Le(o)&&ye(e,o,n[i])){n[i]=lt(e,o,n[i]);continue}delete n[i]}return n}function tU(e,t,n){if(!s.IsObject(n))return n;let o=dl(t),[i,a]=[new RegExp(pt(t)),xe(t)];for(let c of s.Keys(n)){if(i.test(c)){n[c]=lt(e,a,n[c]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||Le(o)&&ye(e,o,n[c])){n[c]=lt(e,o,n[c]);continue}delete n[c]}return n}function rU(e,t,n){return s.HasPropertyKey(e,t.$ref)?lt(e,e[t.$ref],n):n}function nU(e,t,n){if(!s.IsArray(n))return n;let o=Math.min(n.length,t.items.length);for(let i=0;i<o;i++)n[i]=lt(e,t.items[i],n[i]);return s.IsGreaterThan(n.length,o)?n.slice(0,o):n}function Be(e){return Zn(e)}function oU(e,t,n){for(let o of t.anyOf){let i=lt(e,o,Be(n));if(ye(e,o,i))return i}return n}function lt(e,t,n){return X(t)?ZP(e,t,n):Ee(t)?XP(e,t,n):G(t)?JP(e,t,n):$(t)?eU(e,t,n):ge(t)?tU(e,t,n):le(t)?rU(e,t,n):V(t)?nU(e,t,n):C(t)?oU(e,t,n):n}function QK(e,t){for(let n of Zc.Keys(e))Zc.HasPropertyKey(t,n)||(t[n]=e[n]);return t}function WK(e){let t={};for(let n of Zc.Keys(e))t[n]=$s(e[n]);return t}function ZK(e){return lg(bA(e))}function lg(e){return e.map(t=>$s(t))}function $s(e){let t=X(e)?vt($s(e.items),Yo(e)):G(e)?dt(lg(e.allOf)):C(e)?q(ZK(e.anyOf)):$(e)?D(WK(e.properties)):ge(e)?ri(hn(e),$s(xe(e))):V(e)?Fe(lg(e.items)):e;return QK(e,t)}function Fi(e){return $s(e)}function Nr(...e){let[t,n,o]=ie.Match(e,{3:(a,c,l)=>[a,c,l],2:(a,c)=>[{},a,c]}),i=at.Get().unionPrioritySort?Fi(n):n;return lt(t,i,o)}var ae={};Zt(ae,{Fail:()=>Po,IsOk:()=>mg,Ok:()=>k,TryArray:()=>XK,TryBigInt:()=>dg,TryBoolean:()=>uz,TryNull:()=>gz,TryNumber:()=>Ez,TryString:()=>_z,TryUndefined:()=>Az});function mg(e){return s.IsObject(e)&&s.HasPropertyKey(e,"value")}function k(e){return{value:e}}function Po(){}function XK(e){return s.IsArray(e)?k(e):k([e])}function JK(e){return s.IsEqual(e,!0)?k(BigInt(1)):k(BigInt(0))}var ez=/^-?(0|[1-9]\d*)n$/,tz=/^-?(0|[1-9]\d*)\.\d+$/,rz=/^-?(0|[1-9]\d*)$/;function nz(e){return ez.test(e)}function oz(e){return tz.test(e)}function iz(e){return rz.test(e)}function az(e){let t=e.toLowerCase();return nz(e)?k(BigInt(e.slice(0,e.length-1))):oz(e)?k(BigInt(e.split(".")[0])):iz(e)?k(BigInt(e)):s.IsEqual(t,"false")?k(BigInt(0)):s.IsEqual(t,"true")?k(BigInt(1)):void 0}function dg(e){return s.IsBigInt(e)?k(e):s.IsBoolean(e)?JK(e):s.IsNumber(e)?k(BigInt(Math.trunc(e))):s.IsNull(e)?k(BigInt(0)):s.IsString(e)?az(e):s.IsUndefined(e)?k(BigInt(0)):void 0}function sz(e){return s.IsEqual(e,BigInt(0))?k(!1):s.IsEqual(e,BigInt(1))?k(!0):void 0}function cz(e){return s.IsEqual(e,0)?k(!1):s.IsEqual(e,1)?k(!0):void 0}function pz(e){return s.IsEqual(e.toLowerCase(),"false")?k(!1):s.IsEqual(e.toLowerCase(),"true")?k(!0):s.IsEqual(e,"0")?k(!1):s.IsEqual(e,"1")?k(!0):void 0}function uz(e){return s.IsBigInt(e)?sz(e):s.IsBoolean(e)?k(e):s.IsNumber(e)?cz(e):s.IsNull(e)?k(!1):s.IsString(e)?pz(e):s.IsUndefined(e)?k(!1):void 0}function lz(e){return s.IsEqual(e,BigInt(0))?k(null):void 0}function mz(e){return s.IsEqual(e,!1)?k(null):void 0}function dz(e){return s.IsEqual(e,0)?k(null):void 0}function fz(e){let t=e.toLowerCase();return s.IsEqual(t,"undefined")||s.IsEqual(t,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?k(null):void 0}function gz(e){return s.IsBigInt(e)?lz(e):s.IsBoolean(e)?mz(e):s.IsNumber(e)?dz(e):s.IsNull(e)?k(null):s.IsString(e)?fz(e):s.IsUndefined(e)?k(null):void 0}var iU=BigInt(Number.MAX_SAFE_INTEGER),aU=BigInt(Number.MIN_SAFE_INTEGER);function hz(e){return e<=iU&&e>=aU?k(Number(e)):void 0}function yz(e){return k(e?1:0)}function Tz(e){let t=+e;if(s.IsNumber(t))return k(t);let n=e.toLowerCase();if(s.IsEqual(n,"false"))return k(0);if(s.IsEqual(n,"true"))return k(1);let o=dg(e);return mg(o)?o.value<=iU&&o.value>=aU?k(Number(o.value)):void 0:void 0}function Ez(e){return s.IsBigInt(e)?hz(e):s.IsBoolean(e)?yz(e):s.IsNumber(e)?k(e):s.IsNull(e)?k(0):s.IsString(e)?Tz(e):s.IsUndefined(e)?k(0):void 0}function _z(e){return s.IsBigInt(e)?k(e.toString()):s.IsBoolean(e)?k(e.toString()):s.IsNumber(e)?k(e.toString()):s.IsNull(e)?k("null"):s.IsString(e)?k(e):s.IsUndefined(e)?k(""):void 0}function Iz(e){return s.IsEqual(e,BigInt(0))?k(void 0):void 0}function Sz(e){return s.IsEqual(e,!1)?k(void 0):void 0}function bz(e){return s.IsEqual(e,0)?k(void 0):void 0}function Oz(e){let t=e.toLowerCase();return s.IsEqual(t,"undefined")||s.IsEqual(t,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?k(void 0):void 0}function Az(e){return s.IsBigInt(e)?Iz(e):s.IsBoolean(e)?Sz(e):s.IsNumber(e)?bz(e):s.IsNull(e)?k(void 0):s.IsString(e)?Oz(e):s.IsUndefined(e)?k(e):void 0}function sU(e,t,n){return ae.TryArray(n).value.map(i=>He(e,t.items,i))}function cU(e,t,n){let o=ae.TryBigInt(n);return ae.IsOk(o)?o.value:n}function pU(e,t,n){let o=ae.TryBoolean(n);return ae.IsOk(o)?o.value:n}function uU(e,t,n){return He({...e,...t.$defs},st(t.$ref),n)}function lU(e,t,n){return He(e,yt(t),n)}function mU(e,t,n){let o=ae.TryNumber(n);return ae.IsOk(o)?Math.trunc(o.value):n}function dU(e,t,n){let o=Jt(e,t),i=yt(o);return He(e,i,n)}function xz(e,t,n){let o=ae.TryBigInt(n);return ae.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function Rz(e,t,n){let o=ae.TryBoolean(n);return ae.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function Cz(e,t,n){let o=ae.TryNumber(n);return ae.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function Pz(e,t,n){let o=ae.TryString(n);return ae.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function fU(e,t,n){return s.IsEqual(t.const,n)?n:qT(t)?xz(e,t,n):BT(t)?Rz(e,t,n):ap(t)?Cz(e,t,n):sp(t)?Pz(e,t,n):he()}function gU(e,t,n){let o=ae.TryNull(n);return ae.IsOk(o)?o.value:n}function hU(e,t,n){let o=ae.TryNumber(n);return ae.IsOk(o)?o.value:n}function fl(e,t,n,o){let i=s.Keys(o);for(let[a,c]of t)for(let l of i)a.test(l)||(o[l]=He(e,n,o[l]));return o}function Fs(e,t,n){return nt(e)&&s.IsUndefined(n[t])}function Uz(e,t,n){let o=s.EntriesRegExp(t.properties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)!a.test(l)||Fs(c,l,n)||(n[l]=He(e,c,n[l]));return s.HasPropertyKey(t,"additionalProperties")&&s.IsObject(t.additionalProperties)?fl(e,o,t.additionalProperties,n):n}function yU(e,t,n){return s.IsObjectNotArray(n)?Uz(e,t,n):n}function wz(e,t,n){let o=s.EntriesRegExp(t.patternProperties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)a.test(l)&&(n[l]=He(e,c,n[l]));return s.HasPropertyKey(t,"additionalProperties")&&s.IsObject(t.additionalProperties)?fl(e,o,t.additionalProperties,n):n}function TU(e,t,n){return s.IsObjectNotArray(n)?wz(e,t,n):n}function EU(e,t,n){return s.HasPropertyKey(e,t.$ref)?He(e,e[t.$ref],n):n}function _U(e,t,n){let o=ae.TryString(n);return ae.IsOk(o)?o.value:n}function IU(e,t,n){return He(e,yt(t),n)}function SU(e,t,n){if(!s.IsArray(n))return n;for(let o=0;o<Math.min(t.items.length,n.length);o++)n[o]=He(e,t.items[o],n[o]);return n}function bU(e,t,n){let o=ae.TryUndefined(n);return ae.IsOk(o)?o.value:n}function OU(e,t,n){if(t.anyOf.some(c=>ye(e,c,n)))return n;let a=t.anyOf.map(c=>He(e,c,Be(n))).find(c=>ye(e,t,c));return s.IsUndefined(a)?n:a}function AU(e,t,n){let o=ae.TryUndefined(n);return ae.IsOk(o)?void 0:n}function He(e,t,n){return X(t)?sU(e,t,n):kt(t)?cU(e,t,n):Ot(t)?pU(e,t,n):Ee(t)?uU(e,t,n):We(t)?lU(e,t,n):ct(t)?mU(e,t,n):G(t)?dU(e,t,n):W(t)?fU(e,t,n):xr(t)?gU(e,t,n):we(t)?hU(e,t,n):$(t)?yU(e,t,n):ge(t)?TU(e,t,n):le(t)?EU(e,t,n):tt(t)?_U(e,t,n):_e(t)?IU(e,t,n):V(t)?SU(e,t,n):fr(t)?bU(e,t,n):C(t)?OU(e,t,n):Gt(t)?AU(e,t,n):n}function Gn(...e){let[t,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return He(t,n,o)}function xU(e,t,n){if(!s.IsArray(n))return n;for(let o=0;o<n.length;o++)n[o]=mt(e,t.items,n[o]);return n}function RU(e,t,n){return mt({...e,...t.$defs},st(t.$ref),n)}function CU(e,t){return s.IsUndefined(t)?s.IsFunction(e.default)?e.default():Be(e.default):t}function PU(e,t,n){let o=Jt(e,t),i=yt(o);return mt(e,i,n)}function UU(e,t,n){if(!s.IsObject(n))return n;let o=s.Keys(t.properties);for(let i of o){let a=mt(e,t.properties[i],n[i]);s.IsUndefined(a)&&(nt(t.properties[i])||!s.HasPropertyKey(t.properties[i],"default"))||(n[i]=a)}if(!Wr(t)||s.IsBoolean(t.additionalProperties))return n;for(let i of s.Keys(n))o.includes(i)||(n[i]=mt(e,t.additionalProperties,n[i]));return n}function wU(e,t,n){if(!s.IsObject(n))return n;let[o,i]=[new RegExp(pt(t)),xe(t)];for(let a of s.Keys(n))o.test(a)&&Vt(i)&&(n[a]=mt(e,i,n[a]));if(!Wr(t))return n;for(let a of s.Keys(n))o.test(a)||(n[a]=mt(e,t.additionalProperties,n[a]));return n}function vU(e,t,n){return s.HasPropertyKey(e,t.$ref)?mt(e,e[t.$ref],n):n}function NU(e,t,n){if(!s.IsArray(n))return n;let[o,i]=[t.items,Math.max(t.items.length,n.length)];for(let a=0;a<i;a++)a<o.length&&(n[a]=mt(e,o[a],n[a]));return n}function LU(e,t,n){for(let o of t.anyOf){let i=mt(e,o,Be(n));if(ye(e,o,i))return i}return n}function mt(e,t,n){let o=Vt(t)?CU(t,n):n;return X(t)?xU(e,t,o):Ee(t)?RU(e,t,o):G(t)?PU(e,t,o):$(t)?UU(e,t,o):ge(t)?wU(e,t,o):le(t)?vU(e,t,o):V(t)?NU(e,t,o):C(t)?LU(e,t,o):o}function Uo(...e){let[t,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return mt(t,n,o)}function ji(e){return(...t)=>{let[n,o,i]=ie.Match(t,{3:(a,c,l)=>[a,c,l],2:(a,c)=>[{},a,c]});return e.reduce((a,c)=>c(n,o,a),i)}}function vz(e,t,n){return t["~codec"].decode(n)}function Nz(e,t,n){return t["~codec"].encode(n)}function Pe(e,t,n,o){return to(n)?s.IsEqual(e,"Decode")?vz(t,n,o):Nz(t,n,o):o}function Lz(e,t,n,o){if(!s.IsArray(o))return o;for(let i=0;i<o.length;i++)o[i]=Ne(e,t,n.items,o[i]);return Pe(e,t,n,o)}function kz(e,t,n,o){let i=Pe(e,t,n,o);if(!s.IsArray(i))return i;for(let a=0;a<i.length;a++)i[a]=Ne(e,t,n.items,i[a]);return i}function kU(e,t,n,o){return s.IsEqual(e,"Decode")?Lz(e,t,n,o):kz(e,t,n,o)}function MU(e,t,n,o){return o=Ne(e,{...t,...n.$defs},st(n.$ref),o),Pe(e,t,n,o)}function DU(e){return e.reduce((t,n)=>({...t,...n}),{})}function GU(e,t){for(let n of t)if(!s.IsDeepEqual(e,n))return n;return e}function Mz(e,t,n,o){if(s.IsEqual(n.allOf.length,0))return Pe(e,t,n,o);let i=n.allOf.map(l=>Ne(e,t,l,Nr(l,Be(o)))),c=i.every(l=>s.IsObject(l))?DU(i):GU(o,i);return Pe(e,t,n,c)}function Dz(e,t,n,o){if(s.IsEqual(n.allOf.length,0))return Pe(e,t,n,o);let i=Pe(e,t,n,o),a=n.allOf.map(l=>Ne(e,t,l,Nr(l,Be(i))));return a.every(l=>s.IsObject(l))?DU(a):GU(i,a)}function $U(e,t,n,o){return s.IsEqual(e,"Decode")?Mz(e,t,n,o):Dz(e,t,n,o)}function Gz(e,t,n,o){if(!s.IsObjectNotArray(o))return o;for(let i of s.Keys(n.properties))!s.HasPropertyKey(o,i)||Fs(n.properties[i],i,o)||(o[i]=Ne(e,t,n.properties[i],o[i]));return Pe(e,t,n,o)}function $z(e,t,n,o){let i=Pe(e,t,n,o);if(!s.IsObjectNotArray(i))return i;for(let a of s.Keys(n.properties))!s.HasPropertyKey(i,a)||Fs(n.properties[a],a,i)||(i[a]=Ne(e,t,n.properties[a],i[a]));return i}function FU(e,t,n,o){return s.IsEqual(e,"Decode")?Gz(e,t,n,o):$z(e,t,n,o)}function Fz(e,t,n,o){if(!s.IsObjectNotArray(o))return o;let i=new RegExp(pt(n));for(let a of s.Keys(o))i.test(a)&&(o[a]=Ne(e,t,xe(n),o[a]));return Pe(e,t,n,o)}function jz(e,t,n,o){let i=Pe(e,t,n,o);if(!s.IsObjectNotArray(i))return i;let a=new RegExp(pt(n));for(let c of s.Keys(i))a.test(c)&&(i[c]=Ne(e,t,xe(n),i[c]));return i}function jU(e,t,n,o){return s.IsEqual(e,"Decode")?Fz(e,t,n,o):jz(e,t,n,o)}function qU(e,t,n,o){return s.HasPropertyKey(t,n.$ref)?Ne(e,t,t[n.$ref],o):o}function BU(e,t,n,o){return s.IsEqual(e,"Decode")?Pe(e,t,n,qU(e,t,n,o)):qU(e,t,n,Pe(e,t,n,o))}function qz(e,t,n,o){if(!s.IsArray(o))return o;for(let i=0;i<Math.min(n.items.length,o.length);i++)o[i]=Ne(e,t,n.items[i],o[i]);return Pe(e,t,n,o)}function Bz(e,t,n,o){let i=Pe(e,t,n,o);if(!s.IsArray(i))return o;for(let a=0;a<Math.min(n.items.length,i.length);a++)i[a]=Ne(e,t,n.items[a],i[a]);return i}function HU(e,t,n,o){return s.IsEqual(e,"Decode")?qz(e,t,n,o):Bz(e,t,n,o)}function Hz(e,t,n,o){for(let i of n.anyOf){if(!ye(t,i,o))continue;let a=Ne(e,t,i,o);return Pe(e,t,n,a)}return o}function Kz(e,t,n,o){let i=Pe(e,t,n,o);for(let a of n.anyOf){let c=Ne(e,t,a,Be(i));if(ye(t,a,c))return c}return i}function KU(e,t,n,o){return s.IsEqual(e,"Decode")?Hz(e,t,n,o):Kz(e,t,n,o)}function Ne(e,t,n,o){return X(n)?kU(e,t,n,o):Ee(n)?MU(e,t,n,o):G(n)?$U(e,t,n,o):$(n)?FU(e,t,n,o):ge(n)?jU(e,t,n,o):le(n)?BU(e,t,n,o):V(n)?HU(e,t,n,o):C(n)?KU(e,t,n,o):Pe(e,t,n,o)}var fg=class extends Dn{constructor(t,n){super("Decode",t,n)}};function zz(e,t,n){if(!ye(e,t,n))throw new fg(n,Mn(e,t,n));return n}function Yz(e,t,n){let o=at.Get().unionPrioritySort?Fi(t):t;return Ne("Decode",e,o,n)}var n6e=ji([(e,t,n)=>Be(n),(e,t,n)=>Uo(e,t,n),(e,t,n)=>Gn(e,t,n),(e,t,n)=>Nr(e,t,n),(e,t,n)=>zz(e,t,n),(e,t,n)=>Yz(e,t,n)]);var gg=class extends Dn{constructor(t,n){super("Encode",t,n)}};function Vz(e,t,n){if(!ye(e,t,n))throw new gg(n,Mn(e,t,n));return n}function Qz(e,t,n){let o=at.Get().unionPrioritySort?Fi(t):t;return Ne("Encode",e,o,n)}var h6e=ji([(e,t,n)=>Be(n),(e,t,n)=>Qz(e,t,n),(e,t,n)=>Uo(e,t,n),(e,t,n)=>Gn(e,t,n),(e,t,n)=>Nr(e,t,n),(e,t,n)=>Vz(e,t,n)]);var or=class extends Error{constructor(t,n){super(n),this.type=t}};function zU(e,t){return s.IsFunction(t.default)?t.default(t):s.IsObject(t.default)?Be(t.default):t.default}function YU(e,t){if(Ni(t)&&!Vt(t))throw new or(t,"Arrays with uniqueItems constraints must specify a default annotation");let n=wi(t)?t.minItems:0;return Array.from({length:n},()=>Ke(e,t.items))}function VU(e,t){return Zr(t)?BigInt(t.exclusiveMinimum)+BigInt(1):Jr(t)?BigInt(t.minimum):BigInt(0)}function QU(e,t){return!1}function WU(e,t){let n=Ke(e,t.instanceType);return class{constructor(){Object.assign(this,n)}}}function ZU(e,t){return Ke({...e,...t.$defs},st(t.$ref))}function XU(e,t){return Ke(e,yt(t))}function JU(e,t){let n=Ke(e,t.returnType);return()=>n}function ew(e,t){return Zr(t)&&s.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:Jr(t)?t.minimum:0}function tw(e,t){let n=Jt(e,t),o=yt(n);return Ke(e,o)}function rw(e,t){return t.const}function nw(e,t){throw new or(t,"Cannot create TNever types")}function ow(e,t){return null}function iw(e,t){return Zr(t)&&s.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:Jr(t)?t.minimum:0}function aw(e,t){return(s.IsUndefined(t.required)?[]:t.required).reduce((o,i)=>({...o,[i]:Ke(e,t.properties[i])}),{})}function sw(e,t){if(ws(t)&&!Vt(t))throw new or(t,"Record with the minProperties constraint must have a default annotation");return{}}function cw(e,t){return s.HasPropertyKey(e,t.$ref)?Ke(e,e[t.$ref]):(()=>{throw new or(t,"Unable to deref Ref")})()}function pw(e,t){if((vs(t)||Ps(t))&&!Vt(t))throw Error("Strings with format or pattern constraints must specify default");let o=Us(t)?t.minLength:0;return"".padEnd(o)}function uw(e,t){return Symbol()}function lw(e,t){let n=Ma(t.pattern);if(tt(n))throw new or(t,"Unable to create TemplateLiteral due to infinite type expansion");return Ke(e,n)}function mw(e,t){return Array.from({length:t.minItems},(n,o)=>Ke(e,t.items[o]))}function dw(e,t){if(s.IsEqual(t.anyOf.length,0))throw Error("Unable to create Union with no variants");return Ke(e,t.anyOf[0])}function Ke(e,t){return Vt(t)?zU(e,t):X(t)?YU(e,t):kt(t)?VU(e,t):Ot(t)?QU(e,t):Ye(t)?WU(e,t):Ee(t)?ZU(e,t):We(t)?XU(e,t):Ve(t)?JU(e,t):ct(t)?ew(e,t):G(t)?tw(e,t):W(t)?rw(e,t):mr(t)?nw(e,t):xr(t)?ow(e,t):we(t)?iw(e,t):$(t)?aw(e,t):ge(t)?sw(e,t):le(t)?cw(e,t):tt(t)?pw(e,t):Rr(t)?uw(e,t):_e(t)?lw(e,t):V(t)?mw(e,t):fr(t)?void 0:C(t)?dw(e,t):Gt(t)?void 0:void 0}function Lr(...e){let[t,n]=ie.Match(e,{2:(o,i)=>[o,i],1:o=>[{},o]});return Ke(t,n)}var hg=class extends Dn{constructor(t,n){super("Parse",t,n)}};function Wz(e,t,n){if(!ye(e,t,n))throw new hg(n,Mn(e,t,n));return n}var DQe=ji([(e,t,n)=>Be(n),(e,t,n)=>Uo(e,t,n),(e,t,n)=>Gn(e,t,n),(e,t,n)=>Nr(e,t,n),(e,t,n)=>Wz(e,t,n)]);var Xz=D({type:Y("insert"),path:At(),value:et()}),Jz=Object({type:Y("update"),path:At(),value:et()}),e4=D({type:Y("delete"),path:At()}),HQe=q([Xz,Jz,e4]);function qi(e){if(!e.body)throw new Error("This command does not accept a request body");let t=e.body;return t.examples?.length?t.examples[0]:Lr(t)}function yr(e,t,n,o,i){e.command(t).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(qi(o));return}let c=Pi(a),l=await i()(o,{body:c});Q(l)})}var Ue=" (unix seconds, ISO 8601, or relative like -1h/-30m/now)";var n4=30,hw=["flat","flatPercent","cum","cumPercent","function"];function Sw(e,t){let n=e.command("profiles").description("Query continuous profiling data");yw(n.command("top").description("Rank functions by self (flat) and inclusive (cum) sample value, like pprof -top")).option("--limit <COUNT>","Maximum number of functions to print",String(n4)).option("--fields <FIELDS>",`Comma-separated fields to project from each function (default for --output=tsv|csv: ${hw.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async o=>{let i=ms(o.output),a=o.fields===void 0?void 0:ds(o.fields),c=Number(o.limit);if(!Number.isInteger(c)||c<1)throw new nr(`--limit must be a positive integer (got: ${o.limit})`);let l=await t()(rf,{body:Tw(o)}),{total:m,functions:f}=o4(l.stacks),h=f.slice(0,c);if(i==="json"){Q({total:m,functions:a?h.map(I=>fs(I,a)):h});return}let E=gs(i,h,a??hw);E.length>0&&z(E)}),yw(n.command("pprof").description("Download a merged pprof profile (raw protobuf, not gzipped)")).option("-O, --output-file <FILE_PATH>","Write the profile to this file instead of stdout").action(async o=>{if(o.outputFile===void 0&&process.stdout.isTTY)throw new nr("Refusing to write a binary profile to the terminal. Use --output-file <FILE_PATH> or pipe stdout.");let i=await t()(lC,{body:Tw(o)}),a=Buffer.from(i.pprof,"base64");if(o.outputFile===void 0){process.stdout.write(a);return}(0,Iw.writeFileSync)(o.outputFile,a)}),yr(n,"query","Run a raw profile query and print the folded stacks",rf,t)}function yw(e){return e.requiredOption("--service <SERVICE_NAME>","Service the profiles belong to").addOption(new pr("--type <PROFILE_TYPE>","Profile type").choices(xs.type.enum).makeOptionMandatory()).option("--from <TIMESTAMP>",`Start of time range${Ue}${_w("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${_w("to")}`).option("--filter <TSUGA_QUERY>","Tsuga query over profile labels (equality, negation, wildcards)")}function Tw(e){return{service:e.service,type:e.type,timeRange:{from:Ew("from",e.from),to:Ew("to",e.to)},...e.filter===void 0?{}:{filter:e.filter}}}function o4(e){let t=new Map,n=new Map,o=0;for(let{stack:c,value:l}of e){let m=c.split(";"),f=m[m.length-1];if(f!==void 0){o+=l,t.set(f,(t.get(f)??0)+l);for(let h of new Set(m))n.set(h,(n.get(h)??0)+l)}}let i=c=>o===0?0:Math.round(c/o*1e4)/100,a=[...n.entries()].map(([c,l])=>{let m=t.get(c)??0;return{function:c,flat:m,flatPercent:i(m),cum:l,cumPercent:i(l)}}).sort((c,l)=>l.flat-c.flat||l.cum-c.cum||c.function.localeCompare(l.function));return{total:o,functions:a}}function Ew(e,t){let n=t??rr(e);if(!n)throw new nr(`--${e} is required`);return zo(n)}function _w(e){let t=rr(e);return t===void 0?"":` (default: ${t})`}function bw(e,t){let n=e.command("experimental").description("Experimental commands that may change or be removed without notice");Sw(n,t)}var i4=`/${"v1"}/feedback`,Ow=r.Object({id:r.String({description:"API request ID recorded with the feedback."})},{$id:"Feedback",description:"A recorded piece of feedback"}),a4={id:"request-123-abc"};Object.assign(Ow,{examples:[a4]});var Aw=r.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."})}),s4={content:"The traces command times out for large services."};Object.assign(Aw,{examples:[s4]});var xw=d({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:i4,method:"POST",body:Aw,response:Ow});function Rw(e,t){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 t()(xw,{body:{content:n.join(" ")}});Q(o)})}var Pt="/v0/monitors",Bi=["alert","resolve","keep_last_status","consider_zero"],Hi=["alert","resolve","keep_last_status"];var Pw=["no_aggregation","all","any","each","proportion"],Uw=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"];var c4=r.Object({formula:r.String({description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:r.Enum(Uw,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:r.Number({description:"Numeric threshold value used by the comparison. May be negative when the formula result can be below zero."})}),p4=r.Object({formula:p({type:"tsuga-formula",description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:r.Enum(Uw,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:r.Number({description:"Numeric threshold value used by the comparison. May be negative when the formula result can be below zero."})}),u4=5,yg=r.Array(c4,{description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),Tg=r.Array(p4,{minItems:1,maxItems:u4,description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),Eg=r.Object({formula:r.String({description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:r.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`."}),_g=r.Object({formula:p({type:"tsuga-formula",description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:r.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`."}),Ct=[1,2,3,4,5];var gl={timeframe:r.Number({description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over. Always a whole number, at least 1."}),groupByFields:r.Array(r.Object({fields:r.Array(r.String(),{description:"Attribute names the monitor splits results by, evaluating each resulting group independently. Empty means the monitor evaluates a single ungrouped series."}),limit:r.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:r.Optional(te),replaceNullWith:r.Optional(r.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:r.Optional(r.Enum(Pw,{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:r.Optional(r.Integer({description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},hl={timeframe:r.Integer({minimum:1,description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over."}),groupByFields:r.Array(r.Object({fields:r.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:r.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:r.Optional(te),replaceNullWith:r.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:r.Optional(r.Enum(Pw,{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:r.Optional(r.Integer({minimum:1,maximum:99,description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},Ig={...gl,timeframe:r.Number({description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over. Always a whole number from 5 through 1440."})},Sg={...hl,timeframe:r.Integer({minimum:5,maximum:1440,description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over."})},ww=r.Object({type:r.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:yg,noDataBehavior:r.Enum(Bi,{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."}),...gl,queries:Vr},{$id:"MonitorConfigurationMetric"}),vw=r.Object({type:r.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:Tg,noDataBehavior:r.Enum(Bi,{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."}),...hl,queries:wn},{$id:"InputMonitorConfigurationMetric"}),Nw=r.Object({type:r.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:yg,noDataBehavior:r.Enum(Bi,{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."}),...gl,queries:Vr},{$id:"MonitorConfigurationLog"}),Lw=r.Object({type:r.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:Tg,noDataBehavior:r.Enum(Bi,{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."}),...hl,queries:wn},{$id:"InputMonitorConfigurationLog"}),kw=r.Object({type:r.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:yg,noDataBehavior:r.Enum(Bi,{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."}),...gl,queries:Vr},{$id:"MonitorConfigurationTrace"}),l4=r.Object({type:r.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:Tg,noDataBehavior:r.Enum(Bi,{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."}),...hl,queries:wn},{$id:"InputMonitorConfigurationTrace"}),Mw=r.Object({type:r.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:Eg,noDataBehavior:r.Enum(Hi,{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."}),...Ig,queries:Vr},{$id:"MonitorConfigurationAnomalyLog"}),Dw=r.Object({type:r.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:_g,noDataBehavior:r.Enum(Hi,{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."}),...Sg,queries:wn},{$id:"InputMonitorConfigurationAnomalyLog"}),Gw=r.Object({type:r.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:Eg,noDataBehavior:r.Enum(Hi,{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."}),...Ig,queries:Vr},{$id:"MonitorConfigurationAnomalyMetric"}),$w=r.Object({type:r.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:_g,noDataBehavior:r.Enum(Hi,{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."}),...Sg,queries:wn},{$id:"InputMonitorConfigurationAnomalyMetric"}),Fw=r.Object({type:r.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:Eg,noDataBehavior:r.Enum(Hi,{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."}),...Ig,queries:Vr},{$id:"MonitorConfigurationAnomalyTrace"}),m4=r.Object({type:r.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:_g,noDataBehavior:r.Enum(Hi,{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."}),...Sg,queries:wn},{$id:"InputMonitorConfigurationAnomalyTrace"}),jw=r.Object({type:r.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:r.Integer({description:"Number of days before certificate expiry when the monitor should warn."}),cloudAccounts:r.Optional(r.Array(r.String(),{description:"Cloud account IDs whose certificates are checked. Omitted means certificates from all cloud accounts are checked."})),aggregationAlertLogic:r.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:r.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"MonitorConfigurationCertificateExpiry"}),d4=r.Object({type:r.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:r.Integer({minimum:1,maximum:365,description:"Number of days before certificate expiry when the monitor should warn. Valid values are 1 through 365."}),cloudAccounts:r.Optional(r.Array(r.String(),{minItems:1,description:"Cloud account IDs whose certificates are checked. Omit to check certificates from all cloud accounts."})),aggregationAlertLogic:r.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:r.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"InputMonitorConfigurationCertificateExpiry"}),f4=r.Object({type:r.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured environment, scoped by teams, services, or both. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:r.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:r.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:r.Object({teamIds:r.Optional(r.Array(r.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:r.String({description:"Environment whose logs are searched for new error patterns."}),services:r.Optional(r.Array(r.String(),{description:"Service names whose logs are searched for new error patterns."}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included, so sending both teams and services searches only the listed services owned by the listed teams. Send a non-empty `teamIds`, a non-empty `services`, or both."})},{$id:"MonitorConfigurationLogErrorPattern"}),g4=r.Object({type:r.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured environment, scoped by teams, services, or both. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:r.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:r.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:r.Object({teamIds:r.Optional(r.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.",minItems:1})),env:p({description:"Environment whose logs are searched for new error patterns."}),services:r.Optional(r.Array(p(),{description:"Service names whose logs are searched for new error patterns.",minItems:1}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included, so sending both teams and services searches only the listed services owned by the listed teams. Send a non-empty `teamIds`, a non-empty `services`, or both."})},{$id:"InputMonitorConfigurationLogErrorPattern"}),h4=R("type",[ww,Nw,kw,Mw,Gw,f4,Fw,jw],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."}),y4=R("type",[vw,Lw,l4,Dw,$w,m4,g4,d4],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."});var rn=r.Object({id:r.String({description:"Tsuga-generated monitor ID assigned when the monitor is created."}),name:r.String({description:"Display name of the monitor and alert source."}),owner:r.String({description:"Team ID that owns and manages the monitor."}),message:r.Optional(r.String({description:"Caller-supplied message included in notifications triggered by this monitor. Omitted when the monitor was created or last updated without one."})),tags:ve,configuration:h4,priority:r.Enum(Ct,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),permissions:On,dashboardId:r.Optional(r.String({description:"ID of the dashboard linked to this monitor for context when investigating alerts. Caller-supplied. Omitted when no dashboard is linked."})),pauseUntil:r.Optional(S({description:"Timestamp until which the monitor is snoozed."})),creator:r.Optional(se),updater:r.Optional(se),createdAt:S({description:"Timestamp when Tsuga created the monitor."}),updatedAt:S({description:"Timestamp when Tsuga last updated the monitor."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."}),clusterIds:r.Array(r.String(),{description:"Cluster IDs where the monitor is deployed. Empty means all eligible clusters."})},{title:"Monitor"}),T4=R("type",[ww,Nw,kw,Mw,Gw,Fw,jw]),uZe=r.Object({...rn.properties,configuration:T4},{title:"Monitor"}),lZe=r.Object({...rn.properties,configuration:R("type",[vw,Lw,Dw,$w])},{title:"Monitor"}),js=r.Object({name:p({description:"Display name of the monitor and alert source."}),message:Se(p({type:"long"}),{description:"Message included in notifications triggered by this monitor. Optional on create."}),tags:De,configuration:y4,priority:r.Enum(Ct,{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:Se(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:Se(p({allowEmpty:!1,type:"date-time"}),{description:"ISO timestamp until which the monitor should be snoozed."}),permissions:On,clusterIds:r.Optional(r.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."}))}),Cw=["threshold","certificate-expiry","anomaly-detection","log-error-pattern"],$n={PRIORITY:"priority",TYPE:"type",NAME:"name",OWNER:"owner",TAGS:"tags",CLUSTER_IDS:"clusterIds",PAUSE_UNTIL:"pauseUntil",ASSET_UPDATED_AT:"assetUpdatedAt"};var bg=r.Object({owners:Ie(p({allowEmpty:!1}),{description:"Restrict results to monitors owned by any of these team IDs",maxItems:50}),searchQuery:iu({description:"Search query filter for monitors.",valueDescription:"Case-insensitive substring matched against monitor ID, monitor name, query filters, and aggregate fields. Wildcard characters are treated literally."}),tags:Ie(Yt.items,{description:"Restrict results to monitors that have at least one of the listed key/value tags",maxItems:50}),priorities:Ie(r.Enum(Ct),{description:"Restrict results to monitors with one of these priorities",maxItems:Ct.length}),types:Ie(r.Enum(Cw),{description:"Restrict results to monitors with these types",maxItems:Cw.length}),activity:r.Enum(["active","snoozed"],{description:"Restrict results by activity status: active monitors or currently snoozed monitors"}),clusterIds:Ie(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"}),yl=r.Partial(bg),Og=r.Partial(r.Object({...ue,filters:yl,sort:r.Object({by:r.Enum([$n.PRIORITY,$n.TYPE,$n.NAME,$n.OWNER,$n.TAGS,$n.CLUSTER_IDS,$n.PAUSE_UNTIL,$n.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:te},{description:"Optional sorting applied to the returned monitors. Ties are broken by creation time and monitor ID for stable pagination."})})),mZe=d({tags:["monitors"],url:`${Pt}/query`,method:"POST",paginated:!0,response:r.Array(rn),body:Og}),dZe=d({tags:["monitors"],url:`${Pt}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(bg,["tags"])))}),response:zt}),fZe=d({tags:["monitors"],url:`${Pt}/counts/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(bg,["activity"])))}),response:r.Object({all:r.Integer({description:"Total number of monitors matching the filters that the user can read."}),active:r.Integer({description:"Number of matching readable monitors that are not currently snoozed."}),snoozed:r.Integer({description:"Number of matching readable monitors that are currently snoozed."})})}),gZe=d({tags:["monitors"],url:`${Pt}/:id`,method:"GET",params:r.Object({id:p()}),response:rn}),hZe=d({tags:["monitors"],url:Pt,method:"POST",body:js,response:rn}),yZe=d({tags:["monitors"],url:`${Pt}/:id`,method:"PUT",params:r.Object({id:p()}),body:js,response:rn}),E4=Kt(yl,{maxIds:100}),TZe=d({tags:["monitors"],url:`${Pt}/bulk-update`,method:"PUT",body:r.Object({selection:E4,owner:p({allowEmpty:!1})}),response:r.Object({})}),EZe=d({tags:["monitors"],url:`${Pt}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),_4=Kt(yl),_Ze=d({tags:["monitors"],url:`${Pt}/bulk-delete`,method:"DELETE",body:r.Object({selection:_4}),response:r.Object({})}),IZe=d({tags:["monitors"],url:`${Pt}/:id/snooze`,method:"POST",params:r.Object({id:p()}),body:r.Object({pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:rn}),I4=Kt(yl,{maxIds:100}),SZe=d({tags:["monitors"],url:`${Pt}/bulk-snooze`,method:"POST",body:r.Object({selection:I4,pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:r.Object({})}),S4=["alert","alert_consider_zero","alert_no_data","keep_last_status_alert"],b4=["ok","ok_consider_zero","ok_no_data","keep_last_status_ok"],O4=[...S4,...b4],wo=r.Enum(O4),A4=R("type",[r.Object({type:r.Literal("each"),subStates:r.Record(r.String(),r.Object({stateValue:r.Union([wo,r.Null()]),lastChangedAt:S()}))}),r.Object({type:r.Literal("no_aggregation"),stateValue:r.Optional(wo)}),r.Object({type:r.Literal("any"),stateValue:r.Optional(wo)}),r.Object({type:r.Literal("all"),stateValue:r.Optional(wo)}),r.Object({type:r.Literal("proportion"),stateValue:r.Optional(wo)})]),x4=r.Object({monitorId:r.String(),currentState:A4,lastChangedAt:r.Optional(S())}),bZe=d({tags:["monitors"],url:`${Pt}/states/:id`,method:"GET",params:r.Object({id:p()}),response:x4}),OZe=d({tags:["monitors"],url:`${Pt}/:id/transitions`,method:"GET",params:r.Object({id:p()}),query:r.Object({from:r.Number(),to:r.Number()}),response:r.Array(r.Object({id:r.String(),createdAt:S(),fromState:r.Optional(wo),toState:r.Optional(wo),dimension:r.Optional(r.String())}))}),R4=["unprocessed","processed","failed-to-process"],AZe=d({tags:["monitors"],url:`${Pt}/:id/results`,method:"GET",params:r.Object({id:p()}),query:r.Object({from:r.Number(),to:r.Number()}),response:r.Object({isTruncated:r.Boolean(),results:r.Array(r.Object({id:r.String(),evaluationAt:S(),formulaResult:r.Object({groups:r.Array(r.Object({groupKey:r.Record(r.String(),bs),results:r.Array(r.Union([r.Number(),r.Null()])),conditionMet:r.Enum(["true","false","nan-no-data"])}))}),createdAt:S(),status:r.Enum(R4)}))})});var Ki="/v0/notifications",Fn=`${Ki}/rules`,qw=`${Ki}/slack/setup`,qs=`${Ki}/integrations`,vo=["triggered","resolved","no-data"],C4=["sent","stale","pending","rate-limited","failed","silenced"],P4=r.Optional(r.Object({maxMessages:r.Integer({description:"Maximum number of notifications this target can send during the rate-limiting window."}),minutes:r.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."})),Ag=r.Object({maxMessages:r.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:r.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."}),U4=r.Optional(Ag),kr=r.Optional(r.Object({mode:r.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:r.Array(r.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:r.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."})),Mr=r.Optional(r.Object({mode:r.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:r.Array(r.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:r.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."})),Bs=r.Object({id:r.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:P4,config:R("type",[r.Object({type:r.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:r.String({description:"Slack channel ID that receives the notification"}),integrationId:r.String({description:"Slack workspace ID that receives the notification"}),integrationName:r.String({description:"Human readable name of the Slack integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigSlack"}),r.Object({type:r.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:r.String({description:"Identifier of the incident.io integration to use"}),integrationName:r.String({description:"Human readable name of the incident.io integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigIncidentIo"}),r.Object({type:r.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:r.Array(r.String(),{description:"Email addresses that will receive the alert"}),renotifyConfig:kr},{$id:"RuleTargetConfigEmail"}),r.Object({type:r.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:r.String({description:"Identifier of the Grafana IRM integration to use"}),integrationName:r.String({description:"Human readable name of the Grafana IRM integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigGrafanaIrm"}),r.Object({type:r.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:r.String({description:"Identifier of the PagerDuty integration to use"}),integrationName:r.String({description:"Human readable name of the PagerDuty integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigPagerDuty"}),r.Object({type:r.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:r.String({description:"Identifier of the Microsoft Teams integration to use"}),integrationName:r.String({description:"Human readable name of the Microsoft Teams integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigMicrosoftTeams"}),r.Object({type:r.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:r.String({description:"Identifier of the webhook integration to use"}),integrationName:r.String({description:"Human readable name of the webhook integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigWebhook"}),r.Object({type:r.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:r.String({description:"Identifier of the ServiceNow integration to use"}),integrationName:r.String({description:"Human readable name of the ServiceNow integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigServiceNow"}),r.Object({type:r.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:r.String({description:"Identifier of the Google Chat integration to use"}),integrationName:r.String({description:"Human readable name of the Google Chat integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigGoogleChat"}),r.Object({type:r.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:r.String({description:"Identifier of the Squadcast integration to use"}),integrationName:r.String({description:"Human readable name of the Squadcast integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigSquadcast"}),r.Object({type:r.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:r.String({description:"Identifier of the Jira integration to use"}),integrationName:r.String({description:"Human readable name of the Jira integration"}),projectKey:r.String({description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:r.String({description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:r.Optional(r.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:r.Optional(r.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`."})}),zi=r.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:U4,config:R("type",[r.Object({type:r.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:Mr},{$id:"RuleTargetInputSlack"}),r.Object({type:r.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:Mr},{$id:"RuleTargetInputIncidentIo"}),r.Object({type:r.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the PagerDuty integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputPagerDuty"}),r.Object({type:r.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:r.Array(p({type:"email"}),{minItems:1,maxItems:20,description:"Email addresses that will receive the alert"}),renotifyConfig:Mr},{$id:"RuleTargetInputEmail"}),r.Object({type:r.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:Mr},{$id:"RuleTargetInputGrafanaIrm"}),r.Object({type:r.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:Mr},{$id:"RuleTargetInputMicrosoftTeams"}),r.Object({type:r.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the webhook integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputWebhook"}),r.Object({type:r.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the ServiceNow integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputServiceNow"}),r.Object({type:r.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:Mr},{$id:"RuleTargetInputGoogleChat"}),r.Object({type:r.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Squadcast integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputSquadcast"}),r.Object({type:r.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:r.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:r.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)."})}),xg=R("type",[r.Object({type:r.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:r.Array(r.String(),{description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),r.Object({type:r.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"}),r.Object({type:r.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."}),Rg=R("type",[r.Object({type:r.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:r.Array(p(),{minItems:1,maxItems:100,description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),r.Object({type:r.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"}),r.Object({type:r.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."}),Yi=r.Object({id:r.String({description:"Tsuga-generated notification rule ID assigned when the rule is created."}),name:r.String({description:"Display name of the notification rule."}),queryString:r.Optional(r.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:xg,prioritiesFilter:r.Array(r.Enum(Ct),{description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.Enum(vo),{description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:r.Array(r.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:r.String({description:"Team ID that owns and manages the rule."}),createdAt:S({description:"Timestamp when Tsuga created the rule."}),updatedAt:S({description:"Timestamp when Tsuga last updated the rule."}),isActive:r.Boolean({description:"Whether the rule currently sends notifications when its filters match."}),tags:ve,targets:r.Array(Bs,{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:r.Optional(se),updater:r.Optional(se)}),Hs=r.Object({name:p({description:"Display name of the notification rule."}),queryString:Se(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:Rg,prioritiesFilter:r.Array(r.Enum(Ct),{maxItems:Ct.length,description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.Enum(vo),{maxItems:vo.length,description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:r.Optional(r.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:De,isActive:r.Boolean({description:"Set to true for the rule to send notifications when its filters match."}),targets:r.Array(zi,{minItems:1,description:"Destinations that receive a notification whenever this rule matches an alert transition. This list replaces the existing targets on update."})}),Tl=r.Object({id:r.String({description:"Unique identifier of the adaptive notification rule. Generated by Tsuga."}),name:r.String({description:"Display name of the adaptive notification rule."}),owner:r.String({description:"Team ID that owns and manages the rule."}),createdAt:S({description:"Timestamp when Tsuga created the rule."}),updatedAt:S({description:"Timestamp when Tsuga last updated the rule."}),isActive:r.Boolean({description:"Whether the rule currently sends notifications when one of its monitors fires."}),shouldCreateInvestigation:r.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:ve,monitorIds:r.Array(r.String(),{description:"Monitors this rule reacts to."}),sloIds:r.Array(r.String(),{description:"SLOs this rule reacts to."}),fallbackTarget:Bs,creator:r.Optional(se),updater:r.Optional(se)}),Bw=r.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:De,isActive:r.Boolean({description:"Set to true for the rule to send notifications when one of its monitors fires."}),shouldCreateInvestigation:r.Optional(r.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:r.Optional(r.Array(p({allowEmpty:!1}),{maxItems:100,description:"Monitors this rule reacts to. Only trace monitors and metric monitors over OTel span metrics are eligible. Send at least one monitor or SLO."})),sloIds:r.Optional(r.Array(p({allowEmpty:!1}),{maxItems:100,description:"SLOs this rule reacts to. Only SLOs over traces or OTel span metrics are eligible. Omit for a rule that reacts to monitors only; send at least one monitor or SLO."})),fallbackTarget:zi}),LZe=d({tags:["notification-rules"],url:Fn,method:"GET",paginated:!0,query:r.Object(ue),response:r.Array(Yi)}),kZe=d({tags:["notification-rules"],url:`${Fn}/:id`,params:r.Object({id:p()}),method:"GET",response:Yi}),MZe=d({tags:["notification-rules"],url:Fn,method:"POST",body:Hs,response:Yi}),DZe=d({tags:["notification-rules"],url:`${Fn}/:id`,method:"PUT",params:r.Object({id:p()}),body:Hs,response:Yi}),GZe=d({tags:["notification-rules"],url:`${Fn}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),$Ze=d({tags:["notification-rules"],url:`${Fn}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(p())}),response:r.Object({})}),Vi=`${Ki}/adaptive-rules`,FZe=d({tags:["notification-rules"],url:Vi,method:"GET",paginated:!0,query:r.Object(ue),response:r.Array(Tl)}),jZe=d({tags:["notification-rules"],url:`${Vi}/:id`,params:r.Object({id:p()}),method:"GET",response:Tl}),qZe=d({tags:["notification-rules"],url:Vi,method:"POST",body:Bw,response:Tl}),BZe=d({tags:["notification-rules"],url:`${Vi}/:id`,method:"PUT",params:r.Object({id:p()}),body:Bw,response:Tl}),HZe=d({tags:["notification-rules"],url:`${Vi}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),KZe=d({tags:["notification-rules"],url:`${Vi}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(p())}),response:r.Object({})}),zZe=d({tags:["notification-integrations"],url:`${qw}/start`,method:"POST",response:r.Object({redirectUrl:r.String()})}),w4=["google-chat","grafana-irm","incident-io","jira","microsoft-teams","pagerduty","servicenow","slack","squadcast","webhook"],v4=r.Object({id:r.String(),name:r.String(),type:r.Enum(w4),createdAt:S(),ruleCount:r.Number(),creator:r.Optional(se)}),YZe=d({tags:["notification-integrations"],url:`${Fn}/integrations`,method:"GET",paginated:!0,query:r.Object(ue),response:r.Array(v4)}),VZe=d({tags:["notification-integrations"],url:`${qw}/callback`,method:"GET",query:r.Object({code:p()}),response:r.Object({success:r.Boolean()})}),Cg=["POST","PUT"],N4=r.Record(r.String(),r.String()),L4=r.Record(r.String(),r.Unknown()),k4=r.Record(r.String(),r.Union([r.String(),r.Number(),r.Boolean(),r.Null(),r.Array(r.Union([r.String(),r.Number(),r.Boolean()]))])),M4=R("type",[r.Object({type:r.Literal("json"),value:L4}),r.Object({type:r.Literal("form"),value:k4})]),D4=r.Object({ok:r.String(),alert:r.String()}),Ks=r.Object({id:r.String(),name:r.String(),setting:R("type",[r.Object({type:r.Literal("incident-io"),alertSourceConfigId:r.String(),tokenLastChars:r.String()}),r.Object({type:r.Literal("grafana-irm"),urlLastChars:r.String()}),r.Object({type:r.Literal("pagerduty"),integrationKeyLastChars:r.String()}),r.Object({type:r.Literal("microsoft-teams"),webhookUrlLastChars:r.String()}),r.Object({type:r.Literal("webhook"),urlLastChars:r.String(),method:r.Enum(Cg),authentication:R("type",[r.Object({type:r.Literal("bearer"),tokenLastChars:r.String()}),r.Object({type:r.Literal("basic"),username:r.String(),passwordLastChars:r.String()}),r.Object({type:r.Literal("custom-header"),key:r.String(),valueLastChars:r.String()}),r.Object({type:r.Literal("none")})]),customHeaders:r.Optional(N4),payloadTemplate:M4,eventNameMapping:r.Optional(D4)}),r.Object({type:r.Literal("servicenow"),instanceName:r.String(),username:r.String(),passwordLastChars:r.String()}),r.Object({type:r.Literal("google-chat"),webhookUrlLastChars:r.String()}),r.Object({type:r.Literal("squadcast"),webhookUrlLastChars:r.String()}),r.Object({type:r.Literal("jira"),siteUrl:r.String(),email:r.String(),apiTokenLastChars:r.String()})]),tags:ve}),G4=r.Object({type:r.Literal("webhook"),url:p({type:"uri"}),method:r.Enum(Cg),authentication:R("type",[r.Object({type:r.Literal("bearer"),token:p({allowEmpty:!1})}),r.Object({type:r.Literal("basic"),username:p({allowEmpty:!1}),password:p({allowEmpty:!1})}),r.Object({type:r.Literal("custom-header"),key:p({allowEmpty:!1}),value:p({allowEmpty:!1})}),r.Object({type:r.Literal("none")})]),customHeaders:r.Record(p({allowEmpty:!1}),p()),payloadTemplate:R("type",[r.Object({type:r.Literal("json"),value:r.Record(p({allowEmpty:!1}),r.Unknown())}),r.Object({type:r.Literal("form"),value:r.Record(p({allowEmpty:!1}),r.Union([r.String(),r.Number(),r.Boolean(),r.Null(),r.Array(r.Union([r.String(),r.Number(),r.Boolean()]))]))})]),eventNameMapping:r.Optional(r.Object({ok:p({allowEmpty:!1}),alert:p({allowEmpty:!1})}))}),Hw=r.Object({type:r.Literal("incident-io"),alertSourceConfigId:p(),token:p()}),Kw=r.Object({type:r.Literal("grafana-irm"),url:p({type:"uri"})}),zw=r.Object({type:r.Literal("pagerduty"),integrationKey:p()}),Yw=r.Object({type:r.Literal("microsoft-teams"),webhookUrl:p({type:"uri"})}),$4=r.Object({type:r.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})}),F4=r.Object({type:r.Literal("google-chat"),webhookUrl:p({type:"uri"})}),j4=r.Object({type:r.Literal("squadcast"),webhookUrl:p({type:"uri"})}),q4=r.Object({type:r.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."})}),Pg=r.Object({name:p(),setting:R("type",[Hw,Kw,zw,Yw,G4,$4,F4,j4,q4]),tags:De}),B4=r.Object({type:r.Literal("webhook"),url:r.Optional(p({type:"uri"})),method:r.Optional(r.Enum(Cg)),authentication:r.Optional(R("type",[r.Object({type:r.Literal("bearer"),token:r.Optional(p({allowEmpty:!1}))}),r.Object({type:r.Literal("basic"),username:r.Optional(p({allowEmpty:!1})),password:r.Optional(p({allowEmpty:!1}))}),r.Object({type:r.Literal("custom-header"),key:r.Optional(p({allowEmpty:!1})),value:r.Optional(p({allowEmpty:!1}))}),r.Object({type:r.Literal("none")})])),customHeaders:r.Optional(r.Record(p({allowEmpty:!1}),p())),payloadTemplate:r.Optional(R("type",[r.Object({type:r.Literal("json"),value:r.Record(p({allowEmpty:!1}),r.Unknown())}),r.Object({type:r.Literal("form"),value:r.Record(p({allowEmpty:!1}),r.Union([r.String(),r.Number(),r.Boolean(),r.Null(),r.Array(r.Union([r.String(),r.Number(),r.Boolean()]))]))})])),eventNameMapping:Se(r.Object({ok:r.Optional(p({allowEmpty:!1})),alert:r.Optional(p({allowEmpty:!1}))}))}),H4=r.Object({type:r.Literal("servicenow"),instanceName:r.Optional(p({allowEmpty:!1})),username:r.Optional(p({allowEmpty:!1})),password:r.Optional(p({allowEmpty:!1}))}),K4=r.Object({type:r.Literal("jira"),siteUrl:r.Optional(p({type:"uri",allowEmpty:!1})),email:r.Optional(p({allowEmpty:!1})),apiToken:r.Optional(p({allowEmpty:!1}))}),z4=r.Object({type:r.Literal("google-chat"),webhookUrl:p({type:"uri"})}),Y4=r.Object({type:r.Literal("squadcast"),webhookUrl:p({type:"uri"})}),Ug=r.Object({name:r.Optional(p()),tags:De,setting:r.Optional(R("type",[Hw,Kw,zw,Yw,B4,H4,z4,Y4,K4]))}),QZe=d({tags:["notification-integrations"],url:qs,method:"POST",body:Pg,response:Ks}),WZe=d({tags:["notification-integrations"],url:`${qs}/:id`,method:"GET",params:r.Object({id:p()}),response:Ks}),V4=d({tags:["notification-integrations"],url:`${qs}/:id`,method:"PATCH",params:r.Object({id:p()}),body:Ug,response:Ks}),ZZe=Ti(V4),XZe=d({tags:["notification-integrations"],url:`${qs}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),Q4=R("status",[r.Object({status:r.Literal("ok",{description:"Tsuga reached Jira and listed the projects the credentials can file into."}),projects:r.Array(r.Object({key:r.String({description:'Jira project key, like "OPS".'}),name:r.String({description:"Human readable Jira project name."}),issueTypes:r.Array(r.String(),{description:"Issue type names available when creating an issue in this project."}),statuses:r.Optional(r.Array(r.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"}),r.Object({status:r.Literal("error",{description:"Tsuga could not load Jira metadata with the stored credentials."}),message:r.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."}),JZe=d({tags:["notification-integrations"],url:`${qs}/:id/jira-metadata`,method:"GET",params:r.Object({id:p()}),response:Q4}),eXe=d({tags:["notification-rules"],url:`${Pt}/:id/notifications`,method:"GET",params:r.Object({id:p()}),query:r.Optional(r.Object({from:r.Optional(r.Number()),to:r.Optional(r.Number())})),response:r.Object({notifications:r.Array(r.Object({id:r.String(),monitorId:r.String(),monitorResultId:r.String(),ruleId:r.Optional(r.String()),targetId:r.Optional(r.String()),status:r.Enum(C4),tryCount:r.Number(),nextTryAt:S(),createdAt:S(),updatedAt:S(),sentAt:r.Optional(S())})),isTruncated:r.Boolean()})}),W4=["slack","incident-io","pagerduty","email","grafana-irm","microsoft-teams","webhook","servicenow","google-chat","squadcast","jira"],tXe=d({tags:["notification-rules"],url:`${Fn}/test`,method:"POST",body:r.Object({notificationRule:Hs,targetIds:r.Optional(r.Array(p({allowEmpty:!1}),{description:"Target IDs to test specific targets",minItems:1,maxItems:10}))}),response:r.Union([r.Object({success:r.Literal(!1),overallMessage:r.String({description:"Message when there is an overall error"})}),r.Object({success:r.Boolean(),results:r.Array(r.Object({targetId:r.String({description:"The ID of the target that was tested"}),targetType:r.Enum(W4,{description:"The type of the target (e.g., slack, webhook)"}),status:r.Enum(["success","failure"],{description:"Whether the test notification was sent successfully"}),message:r.Optional(r.String({description:"Message if the notification failed for this specific target"}))}))})])});var nn="/v0/slos",Z4=[7,30,90],X4=["good","bad"],Zw=r.Enum(X4,{description:"How to treat SLO with no data: good (count as meeting the SLO), bad (count as breaching it)"}),J4=["good","bad","ignore"],Xw=r.Enum(J4,{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)"}),Vw=30,Qw=1440,Jw=["greater_than","less_than","greater_than_or_equal","less_than_or_equal"],eY=["healthy","breached","no_data"],El=r.Enum(eY,{description:"SLO status: healthy (meeting the target), breached (breaching it), or no_data (not evaluated yet)"}),Ww={sli:r.Optional(r.Number({description:"Service level indicator for the latest evaluation; absent when there is no data"})),errorBudget:r.Optional(r.Number({description:"Remaining error budget at the latest evaluation; negative when exhausted, absent when there is no data"})),status:El},tY=r.Object({overall:r.Object(Ww,{description:"Latest overall evaluation for the cluster"}),perGroup:r.Array(r.Object({groupKey:r.Record(r.String(),bs,{description:"Group-by field values identifying this group, keyed by field name. Present only when the SLO configuration sets `groupByFields`."}),...Ww}),{description:"Latest evaluation for each group produced by the SLO configuration's `groupByFields`. Empty when the SLO is not grouped."})},{title:"SloClusterResults"}),ev=r.Record(r.String(),tY,{description:"Latest evaluation results keyed by cluster ID."}),wg=r.Object({queries:Vr,formula:Gu},{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. Returned queries include Tsuga-derived missing-point fill: event SLO queries use zero fill, and time SLO queries keep missing points null."}),vg=r.Object({queries:kR,formula:So},{title:"SloQueryFormula",description:"Aggregation queries combined by a formula to produce the SLO signal. Formulas reference queries as q1, q2, and so on. Do not send per-query fill; Tsuga derives the fill behavior from the SLO type."}),rY=r.Object({type:r.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:r.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"}),nY=r.Object({type:r.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:r.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 oY=r.Object({type:r.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:r.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"}),iY=r.Object({type:r.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:r.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"}),aY=R("type",[rY,oY],{description:"Alert trigger configuration: burn-rate or threshold"}),tv=R("type",[nY,iY],{description:"Alert trigger configuration: burn-rate or threshold"}),Ng=r.Enum(Ct,{description:"Alert priority (1 is highest, 5 is lowest)"}),Lg=r.Object({id:r.String({description:"Tsuga-generated SLO alert ID assigned when the alert is created."}),sloId:r.String({description:"Parent SLO ID for this alert."}),priority:Ng,configuration:aY,createdAt:S({description:"Timestamp when Tsuga created the alert."}),updatedAt:S({description:"Timestamp when Tsuga last updated the alert."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"SloAlert"}),sY=r.Object({priority:Ng,configuration:tv}),cY=r.Object({id:r.Optional(p({allowEmpty:!1,description:"Identifier of an existing alert to update. Omit to create a new alert on this SLO."})),priority:Ng,configuration:tv}),pY=R("type",[r.Object({type:r.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:gr,goodQuery:wg,totalQuery:wg,groupByFields:r.Optional(Ci),noDataBehavior:Zw},{title:"EventSloConfiguration"}),r.Object({type:r.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:gr,query:wg,sliceSizeMinutes:r.Integer({description:"Length of each time-SLO evaluation slice in minutes. Required for `type: time`."}),threshold:r.Object({operator:r.Enum(Jw,{description:"Comparison operator between the query value and the threshold"}),value:r.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:r.Optional(Ci),noDataBehavior:Xw},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),uY=R("type",[r.Object({type:r.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:gr,goodQuery:vg,totalQuery:vg,groupByFields:r.Optional(Qr),noDataBehavior:Zw},{title:"EventSloConfiguration"}),r.Object({type:r.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:gr,query:vg,sliceSizeMinutes:r.Integer({minimum:Vw,maximum:Qw,description:`Length of each time-SLO evaluation slice in minutes. Required for \`type: time\`. Valid input is ${Vw} through ${Qw}.`}),threshold:r.Object({operator:r.Enum(Jw,{description:"Comparison operator between the query value and the threshold"}),value:r.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:r.Optional(Qr),noDataBehavior:Xw},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),lY=r.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"Target percentage (0 < target < 100, e.g. 99.9)"}),rv=r.Enum(Z4,{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."}),mY=r.Array(r.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."}),dY=r.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."}),Qi=r.Object({id:r.String({description:"Tsuga-generated SLO ID assigned when the SLO is created."}),name:r.String({description:"Display name of the SLO, set by the caller."}),description:r.Optional(r.String({description:"Free-form, caller-provided description of what the SLO measures. Absent when not set."})),tags:ve,configuration:pY,target:r.Number({description:"Target percentage (0 < target < 100, e.g. 99.9)"}),timeframeDays:rv,owner:r.String({description:"Team ID that owns the SLO"}),permissions:On,clusterIds:mY,creator:r.Optional(se),updater:r.Optional(se),alerts:r.Array(Lg,{description:"Alerts attached to this SLO"}),createdAt:S({description:"Timestamp when Tsuga created the SLO."}),updatedAt:S({description:"Timestamp when Tsuga last updated the SLO."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"Slo"}),fY=r.Object({...Qi.properties,results:ev},{title:"SloWithResults"}),_l=r.Object({name:p({allowEmpty:!1,description:"Display name of the SLO."}),description:Se(p({type:"long"}),{description:"Free-form, caller-provided description of what the SLO measures. Optional."}),tags:De,configuration:uY,target:lY,timeframeDays:rv,owner:p({allowEmpty:!1,description:"Team ID that owns the SLO"}),permissions:On,clusterIds:r.Optional(dY),alerts:r.Array(sY,{description:"Alerts to create on this SLO. Send an empty array for none."})}),kg=r.Object({...r.Omit(_l,["alerts"]).properties,alerts:r.Array(cY,{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."})}),nv=r.Object({owners:Ie(p({allowEmpty:!1}),{description:"Restrict results to SLOs owned by any of these team IDs",maxItems:50}),searchQuery:iu({description:"Text filter for SLO names or IDs. Optional; `exclude: true` removes matching SLOs.",valueDescription:"Substring matched case-insensitively against the SLO name or SLO ID."}),tags:Ie(Yt.items,{description:"Restrict results to SLOs that have at least one of the listed key/value tags",maxItems:50}),clusterIds:Ie(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:Ie(El,{description:"Restrict results to SLOs whose status is one of these values",maxItems:3})},{description:"Optional filters applied to narrow the returned SLOs"}),Mg=r.Partial(nv),gY=["name","owner","tags","updatedAt","sli","errorBudget","status"],Dg=r.Partial(r.Object({...ue,filters:Mg,sort:r.Object({by:r.Enum(gY,{description:"Field to sort by"}),direction:te},{description:"Optional sorting applied to the returned SLOs"})})),dXe=d({tags:["slos"],url:`${nn}/query`,method:"POST",paginated:!0,response:r.Array(fY),body:Dg}),fXe=d({tags:["slos"],url:`${nn}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(nv,["tags","statuses"])))}),response:zt}),gXe=d({tags:["slos"],url:`${nn}/:id`,method:"GET",params:r.Object({id:p()}),response:Qi}),hXe=d({tags:["slos"],url:`${nn}/:id/results`,method:"GET",params:r.Object({id:p()}),response:ev}),yXe=d({tags:["slos"],url:nn,method:"POST",body:_l,response:Qi}),TXe=d({tags:["slos"],url:`${nn}/:id`,method:"PUT",params:r.Object({id:p()}),body:kg,response:Qi}),EXe=d({tags:["slos"],url:`${nn}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),hY=Kt(Mg),_Xe=d({tags:["slos"],url:`${nn}/bulk-delete`,method:"DELETE",body:r.Object({selection:hY}),response:r.Object({})}),yY=Kt(Mg,{maxIds:100}),IXe=d({tags:["slos"],url:`${nn}/bulk-update`,method:"PUT",body:r.Object({selection:yY,owner:p({allowEmpty:!1})}),response:r.Object({})});var jt="/v0/service-catalog",TY=r.Object({team:r.String({description:"Team name observed on telemetry for this service. The emitting service sets it through telemetry attributes. Returned when Tsuga has observed a team value for the service; metadata refreshes weekly or when a new service version appears."}),lastSeenAt:S({description:"Most recent time this team was observed for the service. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A team name observed on telemetry for this service, with the last time it was seen."}),EY=r.Object({ingestionApiKey:r.String({description:"Ingestion API key name or identifier observed on telemetry for this service. Tsuga sets it from the key used to ingest matching telemetry. Returned when key metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this ingestion key was observed for the service. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"An ingestion API key observed on telemetry for this service, with the last time it was seen."}),_Y=r.Object({version:r.String({description:"Service version value observed in telemetry. The emitting service sets it through `context.service.version`. Returned when Tsuga has observed a version for the service."}),firstSeenAt:S({description:"First time this version was observed for the service. Tsuga sets it from telemetry timestamps and refreshes observed versions on each service catalog pass."}),lastSeenAt:S({description:"Most recent time this version was observed for the service. Tsuga sets it from telemetry timestamps and refreshes observed versions on each service catalog pass."}),faulty:r.Optional(r.Boolean({description:"Whether Tsuga detected this version as associated with faulty behavior."})),faultyLatency:r.Optional(r.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:r.Optional(r.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."}),IY=r.Object({language:r.String({description:"Programming language observed for this service. The OpenTelemetry SDK sets it through telemetry metadata. Returned when language metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this language was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A programming language observed for this service, with the last time it was seen."}),SY=r.Object({runtime:r.String({description:"Runtime observed for this service. The emitting service or OpenTelemetry instrumentation sets it through telemetry metadata. Returned when runtime metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this runtime was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A runtime observed for this service, with the last time it was seen."}),ov=r.Object({protocol:r.String({description:"Observed API protocol, such as `http`, `grpc`, or `graphql`. Tsuga infers it from span metadata. Returned when protocol metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this protocol was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"An API protocol observed for this service, with the last time it was seen."}),bY=r.Object({framework:r.String({description:"Observed application framework, such as `express`, `fastify`, `django`, or `rails`. Tsuga detects it from OpenTelemetry instrumentation scope. Returned when framework metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this framework was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"An application framework detected from OpenTelemetry instrumentation scope, with the last time it was seen."}),OY=r.Object({platform:r.String({description:"Observed cloud or orchestration platform, such as `aws_eks` or `kubernetes`. The emitting service or collector sets it through telemetry resource attributes. Returned when platform metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this platform was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A cloud or orchestration platform this service runs on, with the last time it was seen."}),AY=r.Object({provider:r.String({description:"Observed cloud provider, such as `aws`, `gcp`, or `azure`. The emitting service or collector sets it through telemetry resource attributes. Returned when provider metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this provider was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A cloud provider this service runs on, with the last time it was seen."}),Wi=r.Object({id:r.String({description:"Tsuga-generated identifier of this service notification target. Tsuga returns it when the target is created or listed, and clients use it to update or delete the target. It is unique across service targets."}),serviceId:r.String({description:"Identifier of the service catalog entry this target is attached to. Tsuga sets it from the service path parameter and returns it on read and write responses."}),config:Bs.properties.config,rateLimit:Bs.properties.rateLimit,createdAt:S({description:"Timestamp when the service notification target was created. Tsuga sets this value and returns it on private service-catalog responses."}),updatedAt:S({description:"Timestamp when the service notification target was last updated. Tsuga sets this value and returns it on private service-catalog responses."})}),Gg=r.Object({config:zi.properties.config,rateLimit:zi.properties.rateLimit},{description:"Service notification target create request. The caller provides the destination configuration and optional rate limit; Tsuga attaches the target to the service in the path."}),$g=r.Object({config:zi.properties.config,rateLimit:r.Union([Ag,r.Null()],{description:"Per-target rate limit to apply when sending notifications. Set it to `null` to drop the current limit and fall back to the default of 1000 notifications every 10 minutes."})},{description:"Service notification target update request. The caller provides the replacement destination configuration and rate limit; omitted fields are not supported by this schema."}),Il=r.Object({id:r.String({description:"Unique identifier of this service. Use it with service detail and graph endpoints."}),serviceName:r.String({description:"OpenTelemetry service name observed in telemetry."}),serviceNamespace:r.Optional(r.String({description:"OpenTelemetry service namespace observed in telemetry."})),env:r.String({description:"Environment value observed for this service."}),teams:r.Array(TY,{description:"Team names observed on telemetry for this service and when each was last seen."}),ingestionApiKeys:r.Array(EY,{description:"Ingestion API keys observed on telemetry for this service and when each was last seen."}),versions:r.Array(_Y,{description:"Service version values observed in telemetry, including first and last seen timestamps."}),languages:r.Array(IY,{description:"Programming languages observed for this service."}),runtimes:r.Array(SY,{description:"Runtime values observed for this service."}),serverProtocols:r.Array(ov,{description:"API protocols this service exposes (from server-kind spans)"}),clientProtocols:r.Array(ov,{description:"API protocols this service calls out over (from client-kind spans)"}),frameworks:r.Array(bY,{description:"Application frameworks detected from OTel instrumentation scope"}),cloudPlatforms:r.Array(OY,{description:"Cloud platforms this service is running on"}),cloudProviders:r.Array(AY,{description:"Cloud providers this service is running on"}),lastSeenAt:S({description:"Most recent time Tsuga observed telemetry for this service."}),firstSeenAt:S({description:"First time Tsuga observed telemetry for this service."}),additionalUserFields:r.Optional(r.Unsafe({type:"object",additionalProperties:!0,description:"Additional user-defined service metadata, when configured."})),traceRequestRate:r.Optional(r.Number({description:"Requests per second observed for this service over the queried window, counting calls of its primary span kind. Omitted when the trace query failed, which is distinct from `0` (the service is quiet)."})),traceErrorRate:r.Optional(r.Number({description:"Percentage of this service\u2019s primary-span-kind calls over the queried window that ended with error status. Omitted when the trace query failed."})),notificationTargets:r.Array(Wi,{description:"Notification targets attached to this service, used by adaptive notification rules to page its owners."}),createdAt:S({description:"Timestamp when Tsuga created this service catalog entry."}),updatedAt:S({description:"Timestamp when Tsuga last updated this service catalog entry."})}),xY=r.Object({spanKind:r.Enum(uR),count:r.Number()}),Fg=r.Object({...Il.properties,spanKindCounts:r.Array(xY)}),vXe=d({tags:["service-catalog"],query:r.Object({...ue,clusterId:r.Optional(p()),env:r.Optional(p())}),method:"GET",paginated:!0,url:`${jt}/services`,response:r.Array(Fg)}),RY=["serviceName","env","lastDeploy","traceErrorRate","traceRequestRate","teams","api","frameworks","languages","pagingDestination"],CY=r.Object({searchQuery:r.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against service names."})},{description:"Text filter for service names."}),teams:Ie(p({allowEmpty:!1}),{description:"Restrict results to services observed under any of these team names",maxItems:50}),envs:Ie(p({allowEmpty:!1}),{description:"Restrict results to services observed in any of these environments",maxItems:50}),versions:Ie(p({allowEmpty:!1}),{description:"Restrict results to services whose latest observed version is one of these",maxItems:50}),languages:Ie(p({allowEmpty:!1}),{description:"Restrict results to services written in any of these languages",maxItems:50}),hasRecentData:r.Boolean({description:"When true, only return services whose request rate over the queried window is non-zero"})}),PY=["1h","4h","24h"];var UY=r.Partial(r.Object({...ue,clusterId:p(),filters:r.Partial(CY,{description:"Optional filters applied to narrow the returned services"}),sort:r.Object({by:r.Enum(RY,{description:"Field to sort the returned services by"}),direction:te},{description:"Optional sorting applied to the returned services"}),statsWindow:r.Enum(PY,{description:"Lookback used to compute the trace request rate and trace error rate fields, and the span-call totals that pick each service's primary environment. Defaults to `1h`."})})),NXe=d({tags:["service-catalog"],url:`${jt}/v2/services/query`,method:"POST",paginated:!0,body:UY,response:r.Array(Fg)}),LXe=d({tags:["service-catalog"],query:r.Object({serviceName:p({allowEmpty:!1}),serviceNamespace:r.Optional(p({allowEmpty:!1})),env:p({allowEmpty:!1}),clusterId:r.Optional(p())}),method:"GET",url:`${jt}/v2/service`,response:Fg}),kXe=d({tags:["service-catalog"],query:r.Object({serviceName:p({allowEmpty:!1}),serviceNamespace:r.Optional(p({allowEmpty:!1})),clusterId:r.Optional(p())}),method:"GET",url:`${jt}/v2/service/envs`,response:r.Array(r.Object({env:r.String({description:"Environment the service was observed in."}),ingestedBytes:r.Number({description:"Trace bytes ingested for the service in this environment over the lookback."})}),{description:"Environments the service was observed in, busiest first."})}),MXe=d({tags:["service-catalog"],method:"GET",url:`${jt}/services/:serviceId`,params:r.Object({serviceId:p()}),response:Il}),DXe=d({tags:["service-catalog"],method:"GET",url:`${jt}/services/:serviceId/targets`,params:r.Object({serviceId:p()}),response:r.Array(Wi)}),GXe=d({tags:["service-catalog"],method:"POST",url:`${jt}/services/:serviceId/targets`,params:r.Object({serviceId:p()}),body:Gg,response:Wi}),$Xe=d({tags:["service-catalog"],method:"PUT",url:`${jt}/services/:serviceId/targets/:targetId`,params:r.Object({serviceId:p(),targetId:p()}),body:$g,response:Wi}),FXe=d({tags:["service-catalog"],method:"DELETE",url:`${jt}/services/:serviceId/targets/:targetId`,params:r.Object({serviceId:p(),targetId:p()}),response:v}),wY=["otel_kube","otel_host_kube","otel_host","prometheus","aws_ec2","gcp_compute_engine"];var iv=r.Object({id:r.String(),hostName:r.String(),env:r.Optional(r.String()),cpuUtilizationAverage:r.Number(),hostType:r.Enum(wY),teams:r.Array(r.String()),tags:r.Array(r.String()),firstSeenAt:S(),lastSeenAt:S(),clusterId:r.String()}),jXe=d({tags:["service-catalog"],method:"GET",url:`${jt}/hosts`,response:r.Array(iv)}),qXe=d({tags:["service-catalog"],method:"GET",url:`${jt}/hosts/:hostId`,params:r.Object({hostId:p()}),response:iv}),vY=["http","rpc","messaging","genai","object_store"],av={name:r.String({description:"Service or inferred dependency name shown in the graph."}),env:r.Optional(r.String({description:"Environment observed from spans."}))},jg=r.Object({...av,nodeType:r.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:r.Union([r.String(),r.Null()],{description:"Service ID, or null when multiple namespaces match the observed service name."}),namespace:r.Union([r.String(),r.Null()],{description:"Service namespace, or null when multiple namespaces match the observed service name."}),errorRate:r.Optional(r.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. Computed from the raw sampled counts, so trace sampling does not affect it."})),entryErrorRequestCount:r.Number({description:"Estimated number of entry requests on this service where at least one entry span had error status, projected from the sampled traces onto the full population."}),entryRequestCount:r.Number({description:"Estimated number of entry requests on this service, projected from the sampled traces onto the full population. Observed 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."})}),sv={...av,endpoint:r.Optional(r.String({description:"Inferred service endpoint address"})),resourceName:r.Optional(r.String({description:"Inferred resource name, e.g. table or queue name"}))},qg=r.Object({...sv,nodeType:r.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:r.Literal("db",{description:"Inferred dependency type. Always `db` for this node variant."}),databaseName:r.Optional(r.String({description:"Database name from span_attributes db.namespace. Matches the database catalog `name`."})),databaseSystem:r.String({description:"Database system from span_attributes db.system.name (falling back to legacy db.system). Matches the database catalog `databaseSystem`."})}),Bg=r.Object({...sv,nodeType:r.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:r.Enum(vY,{description:"Inferred dependency type from span metadata: http, rpc, messaging, genai, or object_store."})}),NY=R("nodeType",[jg,qg,Bg]),Hg=r.Object({from:r.Object({env:r.Optional(r.String({description:"Environment of the source node"})),name:r.String({description:"Name of the source node"})},{description:"Reference to the caller node, i.e. the service or dependency that issued the request."}),to:r.Object({env:r.Optional(r.String({description:"Environment of the target node"})),name:r.String({description:"Name of the target node"}),databaseSystem:r.Optional(r.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:r.Number({description:"Estimated number of cross-service transitions on this directed edge in the graph query window. The graph is built from a uniform sample of traces, so this is projected onto the full population rather than counted directly."}),errorRate:r.Optional(r.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. Computed from the raw sampled counts, so trace sampling does not affect it."})),errorCount:r.Number({description:"Estimated number of client spans with error status on this edge, projected from the sampled traces onto the full population."}),clientSpanCount:r.Number({description:"Estimated number of client spans on this edge, projected from the sampled traces onto the full population."})},{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."}),BXe=d({tags:["service-catalog"],url:`${jt}/services/:serviceId/graph`,method:"GET",params:r.Object({serviceId:p()}),query:r.Object({...it.properties,query:r.Optional(p({type:"tsuga-query"}))}),response:r.Object({clusterId:r.String(),nodes:r.Array(NY),edges:r.Array(Hg)})}),LY=r.Object({monitors:r.Array(r.Object({id:r.String({description:"Identifier of the monitor"}),name:r.String({description:"Display name of the monitor"}),owner:r.String({description:"Team ID that owns the monitor"}),priority:r.Enum(Ct,{description:"Priority of the monitor"})})),slos:r.Array(r.Object({id:r.String({description:"Identifier of the SLO"}),name:r.String({description:"Display name of the SLO"}),owner:r.String({description:"Team ID that owns the SLO"}),statusCount:r.Partial(r.Record(El,r.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"})}))}),HXe=d({tags:["service-catalog"],method:"GET",url:`${jt}/services/:serviceId/related-resources`,params:r.Object({serviceId:p()}),response:LY}),KXe=d({tags:["service-catalog"],method:"GET",url:`${jt}/services/by-api-keys`,response:r.Record(r.String(),r.Array(r.Object({serviceName:r.String(),serviceNamespace:r.Optional(r.String())})))});var Sl=`/${"v1"}/services`,Kg=r.Pick(Il,["id","serviceName","serviceNamespace","env","teams","versions","languages","runtimes","serverProtocols","clientProtocols","frameworks","cloudPlatforms","cloudProviders","lastSeenAt","firstSeenAt","traceRequestRate","traceErrorRate"],{$id:"Service",description:"Service inferred from telemetry, with observed metadata, activity counts, and version signals. See [Services](/documentation/categorize/services/index)."}),kY={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",traceRequestRate:2.36,traceErrorRate:8.2};Object.assign(Kg,{examples:[kY]});var cv=d({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:Sl,method:"GET",paginated:!0,query:r.Object({...qe,clusterId:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Omit to use the first cluster in the organization; this does not query all clusters."})),env:r.Optional(p({allowEmpty:!1,description:"Environment whose activity and metadata each returned service is described by. Services not observed in it are omitted. Omit to describe each service by its busiest environment."}))},{description:"Service list query. Use pagination and optional cluster and environment scope."}),response:r.Array(Kg)}),pv=d({description:"Retrieves one telemetry-inferred service by service ID.",operationId:"getService",tags:["services"],url:`${Sl}/:serviceId`,method:"GET",params:r.Object({serviceId:p({allowEmpty:!1,description:"Identifier of the service to retrieve. Use the `id` returned by service list responses."})}),response:Kg}),MY=r.Pick(jg,["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."}),DY=r.Pick(Bg,["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."}),GY=r.Pick(qg,["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."}),$Y=R("nodeType",[MY,GY,DY]),FY=r.Pick(Hg,["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."}),jY=r.Optional(r.Integer({...it.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."})),qY=r.Optional(r.Integer({...it.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."})),BY=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."}),uv=d({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:`${Sl}/:serviceId/graph`,method:"GET",params:r.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:r.Object({from:jY,to:qY,query:r.Optional(BY)},{description:"Service graph query. Use time range and optional span query filters."}),response:r.Object({clusterId:r.String({description:"Cluster ID the graph was built from"}),nodes:r.Array($Y,{description:"Observed and inferred nodes included in the service dependency graph."}),edges:r.Array(FY,{description:"Directed dependency edges between graph nodes."})})}),bl=`${Sl}/:serviceId/notification-targets`,Ol=r.Pick(Wi,["id","serviceId","config","rateLimit"],{$id:"ServiceNotificationTarget",description:"Notification target attached to a service, used by adaptive notification rules to page the service owners. See [Rules](/documentation/alert/notifications/rules)."}),zg={rateLimit:{maxMessages:10,minutes:5},config:{type:"email",addresses:["oncall@example.com"],renotifyConfig:{mode:"each",renotificationStates:["alert"],renotifyIntervalMinutes:30}}},HY={id:"789-abc-def",serviceId:"123-456-abc",...zg};Object.assign(Ol,{examples:[HY]});var Al=p({allowEmpty:!1,description:"Identifier of the service the notification target belongs to. Use the `id` returned by service list or get responses."}),eJe=d({description:"Lists the notification targets attached to one service. Use this to discover target IDs before updating or deleting a target.",operationId:"listServiceNotificationTargets",tags:["services"],url:bl,method:"GET",params:r.Object({serviceId:Al}),response:r.Array(Ol)}),KY=r.Pick(Gg,["config","rateLimit"],{description:"Service notification target create request. Provide the delivery destination and an optional per-target rate limit.",examples:[zg]}),zY=r.Pick($g,["config","rateLimit"],{description:"Service notification target update request. The submitted destination and rate limit overwrite the stored ones.",examples:[zg]}),tJe=d({description:"Attaches a notification target to a service. Adaptive notification rules matching the service page this target on alert transitions.",operationId:"createServiceNotificationTarget",tags:["services"],url:bl,method:"POST",params:r.Object({serviceId:Al}),body:KY,response:Ol}),rJe=d({description:"Updates one notification target attached to a service.",operationId:"updateServiceNotificationTarget",tags:["services"],url:`${bl}/:targetId`,method:"PUT",params:r.Object({serviceId:Al,targetId:p({allowEmpty:!1,description:"Identifier of the notification target to update. Use the `id` returned by service notification target list or create responses."})}),body:zY,response:Ol}),nJe=d({description:"Detaches a notification target from a service. Notification rules stop paging this destination for the service.",operationId:"deleteServiceNotificationTarget",tags:["services"],url:`${bl}/:targetId`,method:"DELETE",params:r.Object({serviceId:Al,targetId:p({allowEmpty:!1,description:"Identifier of the notification target to delete. Use the `id` returned by service notification target list or create responses."})}),response:v});function lv(e,t){let n=t??rr(e);return n===void 0?void 0:zo(n)}function Yg(e){let t=rr(e);return t===void 0?"":` (default: ${t})`}function mv(e,t){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${Ue}${Yg("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Yg("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter graph spans${Yg("query")}`).action(async(o,i)=>{let a={},c=lv("from",i.from),l=lv("to",i.to);c!==void 0&&(a.from=c),l!==void 0&&(a.to=l),i.query!==void 0&&(a.query=i.query);let m=await t()(uv,{params:{serviceId:o},query:a});Q(m)})}var YY=`/${"v1"}/grok`,VY=25,QY=100,dv=r.Object({rules:r.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:VY,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:r.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:QY,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."}),WY={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(dv,{examples:[WY]});var fv=r.Object({results:r.Array(r.Object({sample:r.String({description:"Echo of the submitted log line, so results can be matched to the samples in the request."}),matched:r.Boolean({description:"Whether any submitted rule matched this sample. `true` means `extracted` contains the captured fields; `false` means no rule matched."}),extracted:r.Union([r.Record(r.String(),r.Unknown()),r.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."}),ZY={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(fv,{examples:[ZY]});var gv=d({url:`${YY}/parse`,method:"POST",operationId:"parseGrok",tags:["public","grok"],body:dv,response:fv,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`."});function hv(e,t){let n=e.command("grok").description("Test and preview grok parsing rules");yr(n,"parse","Parse sample log lines with grok rules and return the extracted fields",gv,t)}var yv=require("node:child_process"),Tv=require("node:fs"),Ev=require("node:os"),Cl=require("node:path");var No=require("node:fs");function zs(e,t){let n=`${e}.tmp.${process.pid}`;(0,No.writeFileSync)(n,t),(0,No.renameSync)(n,e)}function Ys(e){try{return(0,No.readFileSync)(e,"utf8")}catch(t){if(t.code==="ENOENT")return;throw t}}function Vs(e,t){if(t===void 0)return;let n=`${e}.bak.${new Date().toISOString().replaceAll(":","-")}`;return(0,No.writeFileSync)(n,t),n}function Lo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Vg="tsuga-dev/agent-plugins",xl="tsuga";function Rl(e,t){z(` $ ${e} ${t.join(" ")}`);try{(0,yv.execFileSync)(e,t,{stdio:["ignore","inherit","inherit"]})}catch(n){let o=n.status??1;throw new Error(`${e} ${t.join(" ")} exited ${o}`,{cause:n})}}function XY(e,t){z("Claude Code \u2192 installing Tsuga plugin"),Rl("claude",["plugin","marketplace","add",Vg]),Rl("claude",["plugin","install",`tsuga@${xl}`]),t.autoUpdate&&JY(e)}function JY(e){let t=(0,Cl.join)(e,".claude","settings.json");z(`Claude Code \u2192 ${t} (autoUpdate)`),(0,Tv.mkdirSync)((0,Cl.dirname)(t),{recursive:!0});let n=Ys(t),o=JSON.parse(n??"{}");if(!Lo(o))throw new Error(`${t} must contain a JSON object`);let i=o.extraKnownMarketplaces??{};if(!Lo(i))throw new Error(`${t} "extraKnownMarketplaces" must be a JSON object`);let a=i[xl],c=Lo(a)?a:{};o.extraKnownMarketplaces={...i,[xl]:{source:{source:"github",repo:Vg},...c,autoUpdate:!0}};let l=Vs(t,n);zs(t,`${JSON.stringify(o,null,2)}
145
+ `),z(l===void 0?" created":` patched (backup: ${l})`)}function e3(){z("Codex \u2192 installing Tsuga plugin"),Rl("codex",["plugin","marketplace","add",Vg]),Rl("codex",["plugin","add",`tsuga@${xl}`])}function _v(e){let t=e.command("install").description("Install Tsuga plugins into local LLM CLIs").command("plugin").description("Install the Tsuga plugin into a specific LLM CLI");t.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=>{XY((0,Ev.homedir)(),n),z("Restart your claude session to load the new plugins.")}),t.command("codex").description("Install the Tsuga plugin into Codex (requires the codex CLI in PATH)").action(()=>{e3(),z("Restart your codex session to load the new plugins.")})}var t3=10,r3=r.Object({key:p({allowEmpty:!1,description:"Telemetry attribute key to scope the ranking by: a service, environment, team, route, or other positive equality term in the population you want fields for. Use dot-path keys such as `context.service.name`."}),value:r.Optional(p({allowEmpty:!1,description:"Attribute value the scoped telemetry should match, when the scope is a specific service, environment, team, route, or other known value. When omitted, artifacts that reference the key match this entry at full weight regardless of value."})),valueMustMatch:r.Optional(r.Boolean({description:"When true, this entry is a hard filter rather than a weight: any widget or monitor that does not match it exactly (key = value) contributes no fields at all, instead of contributing at a reduced weight. Other widgets of the same dashboard still contribute if they match. Requires `value`."}))}),Qg=r.Object({field:r.String({description:"Field name to use in queries. For `kind: attribute`, this is an attribute dot path. For `kind: metric`, this is either a metric name or a `metricName.context.attribute` path when the metric query used a metric attribute."}),kind:r.Enum(["attribute","metric"],{description:"Whether the field is a telemetry attribute or a metric name. `metric` appears only in the metrics bucket, for fields referenced as the aggregated field of a metrics-source query."}),inferredType:r.Enum(["numeric","categorical","unknown"],{description:"Value type inferred from how the field is used: `numeric` when aggregated with sum/average/percentile, referenced by numeric or range filters, or a metric name; `categorical` when only grouped by or matched with equality/text filters; `unknown` otherwise. Evidence-based \u2014 a numeric field used only in equality filters reads as categorical."}),score:r.Number({description:"Relative relevance score computed by Tsuga from how strongly readable dashboards and monitors use this field for the requested scope, discounted when the field is common across the whole organization. Higher values mean stronger evidence that the field is useful for this scope. Scores are intended for ranking, not for comparison across unrelated scopes."}),artifacts:r.Number({description:"Number of distinct readable dashboards and monitors that reference this field and match the requested scope. Tsuga counts an artifact once per field even if it uses the field in multiple widgets or queries."}),globalArtifacts:r.Number({description:"Number of organization-wide dashboards and monitors that reference this field, regardless of the requested scope or caller permissions. Tsuga uses this anonymous baseline to down-rank fields that are common everywhere."}),usage:r.Object({groupBy:r.Number({description:"Number of distinct readable matching artifacts that use this field as a group-by or split dimension."}),filter:r.Number({description:"Number of distinct readable matching artifacts that filter on this field in widget queries, monitor queries, or dashboard-wide filters."}),measure:r.Number({description:"Number of distinct readable matching artifacts that aggregate this field as `aggregate.field`."}),column:r.Number({description:"Number of distinct readable matching artifacts that pin this field as a list-widget column."})},{description:"Distinct-artifact counts by usage kind, explaining why the field ranked where it did; a dashboard referencing the field the same way in many widgets counts once for that usage kind."})}),Wg=r.Object({logs:r.Array(Qg,{description:"Top log fields for the requested scope, ranked by score and mined from readable logs-sourced dashboards and monitors."}),traces:r.Array(Qg,{description:"Top trace fields for the requested scope, ranked by score and mined from readable traces-sourced dashboards and monitors."}),metrics:r.Array(Qg,{description:"Top metric names and metric-attribute fields for the requested scope, ranked by score and mined from readable metrics-sourced dashboards and monitors."}),dashboardsMatched:r.Number({description:"Number of dashboards that matched the requested scope and that the caller can read. Dashboards the caller cannot read are removed before field rankings are returned."}),monitorsMatched:r.Number({description:"Number of monitors that matched the requested scope and that the caller can read. Monitors the caller cannot read are removed before field rankings are returned."})}),Zg=r.Object({scope:r.Array(r3,{minItems:1,maxItems:t3,description:"Scope entries that define the population to rank fields for, drawn from positive equality pairs in a TQL query, such as service and environment. Tsuga matches entries softly by default: an artifact's contribution is weighted by the fraction of entries it matches."})}),xJe=d({tags:["interesting-fields"],url:"/v0/interesting-fields",method:"POST",body:Zg,response:Wg});var n3=`/${"v1"}/interesting-fields`,o3={scope:[{key:"context.service.name",value:"payments"},{key:"context.env",value:"prod",valueMustMatch:!0}]},i3=r.Object(Zg.properties,{description:"The scope to rank fields for, as attribute key/value pairs such as a service name and an environment. Entries are matched softly by default: a widget contributes in proportion to how many entries it matches, so a broader scope returns a broader ranking. Set `valueMustMatch` on an entry to make it a hard filter instead: a widget that does not match it exactly contributes nothing, even when other entries match.",examples:[o3]}),Iv=d({url:n3,method:"POST",operationId:"getInterestingFields",tags:["public","interesting-fields"],body:i3,response:Wg,description:"Ranks the telemetry fields most relevant to a scope, mined from how the org already uses them in dashboards and monitors, bucketed by logs, traces, and metrics. Use this before guessing a field or metric name: a field that many scope-matching dashboards group or filter on is the one an operator would reach for. Ranking is TF-IDF style, so a field used everywhere in the org scores below one that is distinctive to the scope. Dashboards and monitors the caller cannot read never contribute field names, only the anonymous frequency baseline. The operation requires public API read access to dashboards and monitors."});function Sv(e,t){let n=e.command("interesting-fields").description("Discover the telemetry fields an org already uses for a scope");yr(n,"list","Rank the log, trace and metric fields most relevant to a scope, mined from dashboards and monitors",Iv,t)}var ar="/v0/kubernetes-explorer",a3="^[a-z0-9.-]+$",s3="^[A-Za-z0-9._-]+$",bv=256,Ov=r.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 ir=e=>r.Optional(r.Array(p({allowEmpty:!1}),{description:e})),Av=["clusters","namespaces","teams","envs"],Pl="Names of other filter fields in this query whose values exclude rather than include. Set this to a field name to keep only the resources matching none of that field's values; fields left out keep the resources matching any of their values.",Xg={clusterId:Ov,search:r.Optional(r.String({pattern:a3,minLength:1,maxLength:bv,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."}))},xv={clusterId:Ov,search:r.Optional(r.String({pattern:s3,minLength:1,maxLength:bv,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."}))},Rv=r.Object(Xg),Cv=r.Object(xv),Qs={...Xg,includeInternalNamespaces:r.Optional(r.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:ir("Restrict results to these Kubernetes cluster names."),namespaces:ir("Restrict results to these namespaces."),teams:ir("Restrict results to these team names."),envs:ir("Restrict results to these environments."),exclusiveFilters:r.Optional(r.Array(r.Enum(Av),{description:Pl})),...ue},c3=["Pending","Running","Succeeded","Failed","Unknown","CrashLoopBackOff","Error"],p3=[...Av,"nodes","deployments","statefulsets","daemonsets","podStatus"],u3={...Qs,nodes:ir("Restrict results to pods scheduled on these nodes."),deployments:ir("Restrict results to pods owned by these Deployments."),statefulsets:ir("Restrict results to pods owned by these StatefulSets."),daemonsets:ir("Restrict results to pods owned by these DaemonSets."),podStatus:ir("Restrict results to pods whose resolved status matches any of these values. Typical values are 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. When exclusiveFilters includes podStatus, keep pods whose status matches none of these values instead."),exclusiveFilters:r.Optional(r.Array(r.Enum(p3),{description:`${Pl} Excluding podStatus is applied after stitching pod phase and container status reason telemetry, because phase is not a filterable metric attribute.`}))},l3=["deployment","statefulset","daemonset"],Pv=r.Object({kind:r.Enum(l3,{description:"Kind of Kubernetes workload associated with the pod. Derived from workload attributes in pod telemetry."}),name:r.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."}),Uv=r.Object({podName:r.String({description:"Name of the Kubernetes pod. Set when the pod is created."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the pod. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that reported the pod. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the pod. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the pod, such as production or staging. Present when an environment label or mapping is observed."})),node:r.Optional(r.String({description:"Kubernetes node currently or most recently running the pod. Present when node telemetry is observed."})),phase:r.Enum(c3,{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:r.Integer({description:"Number of containers in the pod that are currently ready. From container readiness telemetry. Zero or greater."}),totalContainers:r.Integer({description:"Number of observed containers for the pod based on container readiness telemetry. Zero or greater."}),restarts:r.Integer({description:"Total restart count across containers in the pod. From container restart telemetry. Zero or greater."}),createdAt:r.Optional(S({description:"Timestamp from pod start time telemetry for the selected pod instance. Present when pod start time telemetry is observed."}))}),Jg=r.Object({...Uv.properties,workload:r.Optional(Pv),cpuUsageMilli:r.Optional(r.Number({description:"Recent pod CPU usage in millicores. Present when CPU usage telemetry is observed."})),cpuLimitMilli:r.Optional(r.Number({description:"Configured pod CPU limit in millicores, summed across observed containers. Present when a CPU limit is configured and observed."})),cpuRequestMilli:r.Optional(r.Number({description:"Configured pod CPU request in millicores, summed across observed containers. Present when a CPU request is configured and observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent pod memory usage in bytes. Present when memory usage telemetry is observed."})),memoryLimitBytes:r.Optional(r.Number({description:"Configured pod memory limit in bytes, summed across observed containers. Present when a memory limit is configured and observed."})),memoryRequestBytes:r.Optional(r.Number({description:"Configured pod memory request in bytes, summed across observed containers. Present when a memory request is configured and observed."})),cpuUtilization:r.Optional(r.Number({description:"Recent CPU usage divided by the configured CPU limit. Present when both usage and limit are observed."})),memoryUtilization:r.Optional(r.Number({description:"Recent memory usage divided by the configured memory limit. Present when both usage and limit are observed."})),cpuRequestUtilization:r.Optional(r.Number({description:"Recent CPU usage divided by the configured CPU request. Present when both usage and request are observed."})),memoryRequestUtilization:r.Optional(r.Number({description:"Recent memory usage divided by the configured memory request. Present when both usage and request are observed."}))}),m3=["podName","namespace","cluster","team","env","node","phase","restarts","cpuUsageMilli","cpuUtilization","cpuRequestUtilization","memoryUsageBytes","memoryUtilization","memoryRequestUtilization","createdAt"],$Je=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/pods`,query:r.Object({...u3,sortBy:r.Optional(r.Enum(m3,{description:"Field to sort pods by."})),sortDirection:r.Optional(te)}),paginated:!0,response:r.Array(Jg)}),d3=["teams","envs"],eh=r.Object({cluster:r.String({description:"Kubernetes cluster name from cluster telemetry."}),teams:r.Optional(r.Array(r.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:r.Optional(r.Array(r.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:r.Optional(r.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:r.Optional(r.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:r.Optional(r.Integer({description:"Number of Kubernetes nodes in the cluster that are ready. Present when node readiness telemetry is observed."})),podPhaseCounts:r.Optional(r.Object({Pending:r.Integer({description:"Number of observed pods currently in the Pending phase."}),Running:r.Integer({description:"Number of observed pods currently in the Running phase."}),Succeeded:r.Integer({description:"Number of observed pods currently in the Succeeded phase."}),Failed:r.Integer({description:"Number of observed pods currently in the Failed phase."}),Unknown:r.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."}))}),f3=["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes"],FJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/clusters`,query:r.Object({...xv,teams:ir("Restrict to clusters that host workloads from these team names."),envs:ir("Restrict to clusters that host workloads in these environments."),exclusiveFilters:r.Optional(r.Array(r.Enum(d3),{description:Pl})),sortBy:r.Optional(r.Enum(f3,{description:"Field to sort clusters by."})),sortDirection:r.Optional(te),...ue}),paginated:!0,response:r.Array(eh)}),g3=["clusters"],h3=["Ready","NotReady","Unknown"],th=r.Object({node:r.String({description:"Kubernetes node name from node telemetry."}),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the node. Present when cluster telemetry is observed."})),status:r.Optional(r.Enum(h3,{description:"Readiness of the node, derived from its Ready condition. Present when node condition telemetry is observed."})),instanceType:r.Optional(r.String({description:"Cloud instance type backing the node (for example `r7g.2xlarge`). Present when host telemetry is observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods scheduled on the node, including pods in internal namespaces since they occupy node capacity. Present when pod telemetry is observed."})),allocatablePods:r.Optional(r.Integer({description:"Maximum number of pods the node can run. Present when node allocatable telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent CPU usage for the node, in millicores. Reported by the kubelet, so it is absent on nodes that only report cluster-level telemetry."})),cpuAllocatableMilli:r.Optional(r.Number({description:"CPU available to pods on the node, in millicores. Present when node allocatable telemetry is observed."})),cpuUtilization:r.Optional(r.Number({description:"Node CPU usage divided by allocatable CPU. Present when both usage and allocatable telemetry are observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent memory usage for the node, in bytes. Reported by the kubelet, so it is absent on nodes that only report cluster-level telemetry."})),memoryAllocatableBytes:r.Optional(r.Number({description:"Memory available to pods on the node, in bytes. Present when node allocatable telemetry is observed."})),memoryUtilization:r.Optional(r.Number({description:"Node memory usage divided by allocatable memory. Present when both usage and allocatable telemetry are observed."}))}),y3=["node","cluster","status","instanceType","pods","allocatablePods","cpuUsageMilli","cpuAllocatableMilli","cpuUtilization","memoryUsageBytes","memoryAllocatableBytes","memoryUtilization"],jJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/nodes`,query:r.Object({...Xg,clusters:ir("Restrict results to these Kubernetes cluster names."),exclusiveFilters:r.Optional(r.Array(r.Enum(g3),{description:Pl})),sortBy:r.Optional(r.Enum(y3,{description:"Field to sort nodes by."})),sortDirection:r.Optional(te),...ue}),paginated:!0,response:r.Array(th)}),rh=r.Object({namespace:r.String({description:"Kubernetes namespace name from namespace telemetry. Includes namespaces with no observed pods when namespace telemetry is observed."}),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the namespace. Present when cluster telemetry is observed."})),teams:r.Optional(r.Array(r.String(),{description:"Team metadata values observed in workloads in the namespace. Present when team labels or mappings are observed."})),envs:r.Optional(r.Array(r.String(),{description:"Environment metadata values observed in workloads in the namespace. Present when environment labels or mappings are observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods in the namespace. Present when pod telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Aggregate recent CPU usage for observed pods in the namespace, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Aggregate recent memory usage for observed pods in the namespace, in bytes. Present when memory usage telemetry is observed."}))}),T3=["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],qJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/namespaces`,query:r.Object({...Qs,sortBy:r.Optional(r.Enum(T3,{description:"Field to sort namespaces by."})),sortDirection:r.Optional(te)}),paginated:!0,response:r.Array(rh)}),nh=r.Object({deployment:r.String({description:"Kubernetes Deployment name from workload telemetry."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the Deployment. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the Deployment. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the Deployment. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the Deployment. Present when an environment label or mapping is observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods associated with the Deployment. Present when pod telemetry and workload attributes are observed."})),availableReplicas:r.Optional(r.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:r.Optional(r.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent aggregate CPU usage for observed Deployment pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent aggregate memory usage for observed Deployment pods, in bytes. Present when memory usage telemetry is observed."}))}),E3=["deployment","namespace","cluster","team","env","pods","availableReplicas","cpuUsageMilli","memoryUsageBytes"],BJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/deployments`,query:r.Object({...Qs,sortBy:r.Optional(r.Enum(E3,{description:"Field to sort deployments by."})),sortDirection:r.Optional(te)}),paginated:!0,response:r.Array(nh)}),oh=r.Object({statefulSet:r.String({description:"Kubernetes StatefulSet name from workload telemetry."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the StatefulSet. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the StatefulSet. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the StatefulSet. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the StatefulSet. Present when an environment label or mapping is observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods associated with the StatefulSet. Present when pod telemetry and workload attributes are observed."})),readyReplicas:r.Optional(r.Integer({description:"Number of ready StatefulSet replicas from StatefulSet status telemetry. Present when StatefulSet status is observed."})),desiredReplicas:r.Optional(r.Integer({description:"Desired replica count configured for the StatefulSet. Present when StatefulSet spec telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent aggregate CPU usage for observed StatefulSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent aggregate memory usage for observed StatefulSet pods, in bytes. Present when memory usage telemetry is observed."}))}),_3=["statefulSet","namespace","cluster","team","env","pods","cpuUsageMilli","memoryUsageBytes"],HJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/statefulsets`,query:r.Object({...Qs,sortBy:r.Optional(r.Enum(_3,{description:"Field to sort StatefulSets by."})),sortDirection:r.Optional(te)}),paginated:!0,response:r.Array(oh)}),ih=r.Object({daemonSet:r.String({description:"Kubernetes DaemonSet name from workload telemetry."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the DaemonSet. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the DaemonSet. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the DaemonSet. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the DaemonSet. Present when an environment label or mapping is observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods associated with the DaemonSet. Present when pod telemetry and workload attributes are observed."})),readyNodes:r.Optional(r.Integer({description:"Number of eligible nodes with a ready DaemonSet pod. Present when DaemonSet status telemetry is observed."})),desiredNodes:r.Optional(r.Integer({description:"Number of eligible nodes where the DaemonSet should run a pod. Present when DaemonSet status telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent aggregate CPU usage for observed DaemonSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent aggregate memory usage for observed DaemonSet pods, in bytes. Present when memory usage telemetry is observed."}))}),I3=["daemonSet","namespace","cluster","team","env","pods","readyNodes","cpuUsageMilli","memoryUsageBytes"],KJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/daemonsets`,query:r.Object({...Qs,sortBy:r.Optional(r.Enum(I3,{description:"Field to sort DaemonSets by."})),sortDirection:r.Optional(te)}),paginated:!0,response:r.Array(ih)}),ah=r.Object({overview:r.Object({...Uv.properties,workload:r.Optional(Pv)},{description:"Pod identity, status, and owning workload, derived from recent pod metrics."}),healthMetrics:r.Object({cpu:r.Object({usage:r.String({description:"Metric name callers can use to query pod CPU usage. This is not the current CPU value."}),limit:r.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:r.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:r.Object({usage:r.String({description:"Metric name callers can use to query pod memory usage. This is not the current memory value."}),limit:r.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:r.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:r.Object({logs:r.String({description:"TQL log search filter scoped to this pod. Built from cluster, namespace, and pod identifiers."}),traces:r.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."})}),wv=r.Object({clusterId:r.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),podName:p({allowEmpty:!1})}),zJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/pod-details`,query:wv,response:ah}),sh=r.Object({configuration:r.Optional(r.Object({spec:r.Record(r.String(),r.Unknown(),{description:"Kubernetes PodSpec from the latest observed pod manifest. Fields outside `object.spec` are stripped."}),lastObservedAt:S({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:r.Record(r.String(),r.String(),{description:"Kubernetes labels on the pod from the latest observed pod manifest. Key-value strings."}),annotations:r.Record(r.String(),r.String(),{description:"Kubernetes annotations on the pod from the latest observed pod manifest. Key-value strings."}),deletedAt:r.Optional(S({description:"Timestamp when Tsuga last observed the pod deletion event. Present when the latest observed pod event is deleted."}))}),YJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/pod-manifest`,query:wv,response:sh}),ch=r.Object({podName:r.String({description:"Name of a pod instance associated with the workload. Resolved from recent pod usage telemetry and workload attributes."}),podUid:r.Optional(r.String({description:"Kubernetes UID for the pod replica. Present when UID telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent CPU usage for the pod replica, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.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."}),ph=r.Object({overview:r.Object({deploymentName:r.String({description:"Kubernetes Deployment name for this detail response."}),namespace:r.Optional(r.String({description:"Kubernetes namespace for this detail response. Present when any deployment signal is found."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name for this detail response. Present when any deployment signal is found."})),team:r.Optional(r.String({description:"Team metadata from the Deployment available-replica metric. Present when the metric includes team metadata."})),env:r.Optional(r.String({description:"Environment metadata from the Deployment available-replica metric. Present when the metric includes environment metadata."})),availableReplicas:r.Optional(r.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:r.Optional(r.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),latestRevisionAt:r.Optional(S({description:"Latest ReplicaSet metadata.creationTimestamp observed for the Deployment. Present when ReplicaSet object telemetry is observed."}))}),podReplicas:r.Array(ch,{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:r.Array(r.Object({replicaSetName:r.String({description:"ReplicaSet name for a Deployment revision from workload telemetry."}),revision:r.Integer({description:"Deployment revision number from ReplicaSet annotations. Integer greater than or equal to zero."}),firstSeen:r.Optional(S({description:"ReplicaSet metadata.creationTimestamp from the latest observed ReplicaSet object. Present when creation time is observed."})),observedGeneration:r.Optional(r.Integer({description:"Latest generation observed for the ReplicaSet revision. Present when generation telemetry is observed."})),readyReplicas:r.Optional(r.Integer({description:"Number of ready replicas for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),replicas:r.Optional(r.Integer({description:"Total replica count for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),logsSearchFilter:r.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."})}),VJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/deployment-details`,query:r.Object({clusterId:r.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),deploymentName:p({allowEmpty:!1})}),response:ph}),S3=r.Object({overview:r.Object({statefulSetName:r.String(),namespace:r.Optional(r.String()),cluster:r.Optional(r.String()),team:r.Optional(r.String()),env:r.Optional(r.String()),readyReplicas:r.Optional(r.Integer()),desiredReplicas:r.Optional(r.Integer()),latestRevisionAt:r.Optional(S())}),podReplicas:r.Array(ch,{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:r.Array(r.Object({revisionName:r.String(),firstSeen:r.Optional(S())}))}),QJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/statefulset-details`,query:r.Object({clusterId:r.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),statefulSetName:p({allowEmpty:!1})}),response:S3}),b3=r.Object({overview:r.Object({daemonSetName:r.String(),namespace:r.Optional(r.String()),cluster:r.Optional(r.String()),team:r.Optional(r.String()),env:r.Optional(r.String()),readyNodes:r.Optional(r.Integer()),desiredNodes:r.Optional(r.Integer()),latestRevisionAt:r.Optional(S())}),podReplicas:r.Array(ch,{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:r.Array(r.Object({observedGeneration:r.Integer(),firstSeen:r.Optional(S())}))}),WJe=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/daemonset-details`,query:r.Object({clusterId:r.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),daemonSetName:p({allowEmpty:!1})}),response:b3});var Dr=`/${"v1"}/kubernetes-explorer`,vv=r.Pick(Jg,["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."}),O3={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(vv,{examples:[O3]});var Nv=r.Pick(eh,["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes","podPhaseCounts"],{description:"A Kubernetes cluster with aggregate resource usage, node readiness, and pod phase counts."}),A3={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(Nv,{examples:[A3]});var Lv=r.Pick(rh,["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes namespace with pod count and aggregate resource usage."}),x3={namespace:"production",cluster:"prod-us-east",teams:["platform"],envs:["production"],pods:24,cpuUsageMilli:1800,memoryUsageBytes:3221225472};Object.assign(Lv,{examples:[x3]});var kv=r.Pick(th,["node","cluster","status","instanceType","pods","allocatablePods","cpuUsageMilli","cpuAllocatableMilli","cpuUtilization","memoryUsageBytes","memoryAllocatableBytes","memoryUtilization"],{description:"A Kubernetes node with its readiness, instance type, and usage against what it can allocate to pods."}),R3={node:"ip-10-0-1-23.ec2.internal",cluster:"prod-us-east",status:"Ready",instanceType:"r7g.2xlarge",pods:25,allocatablePods:234,cpuUsageMilli:4e3,cpuAllocatableMilli:8e3,cpuUtilization:.5,memoryUsageBytes:4e9,memoryAllocatableBytes:16e9,memoryUtilization:.25};Object.assign(kv,{examples:[R3]});var Mv=r.Pick(nh,["deployment","namespace","cluster","team","env","pods","availableReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes deployment with replica counts and aggregate resource usage."}),C3={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(Mv,{examples:[C3]});var Dv=r.Pick(oh,["statefulSet","namespace","cluster","team","env","pods","readyReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes StatefulSet with replica counts and aggregate resource usage."}),P3={statefulSet:"postgres",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,readyReplicas:3,desiredReplicas:3,cpuUsageMilli:900,memoryUsageBytes:2147483648};Object.assign(Dv,{examples:[P3]});var Gv=r.Pick(ih,["daemonSet","namespace","cluster","team","env","pods","readyNodes","desiredNodes","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes DaemonSet with eligible-node readiness and aggregate resource usage."}),U3={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(Gv,{examples:[U3]});var $v=r.Pick(ah,["overview","healthMetrics","searchFilters"],{description:"Metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and log/trace filters."}),w3={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($v,{examples:[w3]});var Fv=r.Pick(sh,["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."}),v3={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(Fv,{examples:[v3]});var jv=r.Pick(ph,["overview","podReplicas","revisions"],{description:"Detailed information for a single Kubernetes deployment: replica status, backing pods, and rollout revisions."}),N3={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(jv,{examples:[N3]});var qv=r.Object({clusterId:r.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."}))}),Zi=r.Pick(Rv,["clusterId","search"]),L3=r.Pick(Cv,["clusterId","search"]),Bv=d({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:`${Dr}/pods`,query:Zi,response:r.Array(vv)}),Hv=d({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:`${Dr}/clusters`,query:L3,response:r.Array(Nv)}),Kv=d({description:"Lists Kubernetes namespaces observed across the organization with pod counts and aggregate resource usage.",operationId:"listKubernetesNamespaces",tags:["public","kubernetes-explorer"],method:"GET",url:`${Dr}/namespaces`,query:Zi,response:r.Array(Lv)}),zv=d({description:"Lists Kubernetes nodes observed across the organization with their readiness, instance type, and resource usage against allocatable capacity.",operationId:"listKubernetesNodes",tags:["public","kubernetes-explorer"],method:"GET",url:`${Dr}/nodes`,query:Zi,response:r.Array(kv)}),Yv=d({description:"Lists Kubernetes deployments observed across the organization with replica counts and aggregate resource usage.",operationId:"listKubernetesDeployments",tags:["public","kubernetes-explorer"],method:"GET",url:`${Dr}/deployments`,query:Zi,response:r.Array(Mv)}),Vv=d({description:"Lists Kubernetes StatefulSets observed across the organization with replica counts and aggregate resource usage.",operationId:"listKubernetesStatefulSets",tags:["public","kubernetes-explorer"],method:"GET",url:`${Dr}/statefulsets`,query:Zi,response:r.Array(Dv)}),Qv=d({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:`${Dr}/daemonsets`,query:Zi,response:r.Array(Gv)}),Wv=r.Object({...qv.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."})}),Zv=d({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:`${Dr}/pod-details`,query:Wv,response:$v}),Xv=d({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:`${Dr}/pod-manifest`,query:Wv,response:Fv}),Jv=d({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:`${Dr}/deployment-details`,query:r.Object({...qv.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:jv});var k3="clusterId";function eN(e,t,n){let o=t.query.properties??{},i=Object.keys(o).filter(a=>a!==k3);for(let a of i){let c=a.replace(/([A-Z])/g,"-$1").toLowerCase(),l=c.replace(/-/g,"_").toUpperCase(),m=o[a]?.description??"";n?e.requiredOption(`--${c} <${l}>`,m):e.option(`--${c} <${l}>`,m)}return i}function ko(e,t,n,o){let i=e.command(t).description(n.description??`List Kubernetes ${t}`),a=eN(i,n,!1);i.action(async c=>{let l={};for(let m of a)c[m]!==void 0&&(l[m]=c[m]);Q(Object.keys(l).length>0?await o()(n,{query:l}):await o()(n))})}function uh(e,t,n,o){let i=e.command(t).description(n.description??`Get Kubernetes ${t}`),a=eN(i,n,!0);i.action(async c=>{let l={};for(let m of a)l[m]=c[m];Q(await o()(n,{query:l}))})}function tN(e,t){let n=e.command("kubernetes").description("Explore Kubernetes resources observed across the organization");ko(n,"pods",Bv,t),ko(n,"clusters",Hv,t),ko(n,"namespaces",Kv,t),ko(n,"nodes",zv,t),ko(n,"deployments",Yv,t),ko(n,"statefulsets",Vv,t),ko(n,"daemonsets",Qv,t),uh(n,"pod-details",Zv,t),uh(n,"pod-manifest",Xv,t),uh(n,"deployment-details",Jv,t)}var M3=r.Union([r.Literal("scalar"),r.Literal("timeseries")]),D3="/v0/promql",Ul=r.Object({query:p({type:"long",allowEmpty:!1,description:"PromQL expression to evaluate."}),timeRange:Un,step:p({allowEmpty:!1,description:"Evaluation step interval (e.g. `1m`, `5m`, `1h`). Must be a valid Prometheus duration string."}),returnType:r.Optional(M3),executionOptions:Wd,shouldStreamResults:r.Optional(r.Boolean()),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster to target. Defaults to the first cluster created in the organization when omitted."}))}),G3={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(Ul,{examples:[G3]});var fet=d({tags:["promql"],url:D3,method:"POST",body:Ul,response:Ri});var $3=`/${"v1"}/promql`,F3=r.Object({...r.Pick(Ul,["query","step"]).properties,timeRange:Tt},{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"}]}),j3=r.Object({clusterId:r.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."}))}),rN=d({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:$3,method:"POST",body:F3,query:j3,response:$u});function nN(e,t){let n=e.command("promql").description("Run PromQL queries over metric data");yr(n,"query","Run a PromQL range query over metric data",rN,t)}var Ji="/v0/dashboard-folders",ea=r.Object({id:r.String({description:"Tsuga-generated dashboard folder ID assigned when the folder is created. Use it as dashboard `folderId` or child-folder `parentFolderId`."}),name:r.String({description:"Display name of the dashboard folder. Set by the caller on create or update."}),owner:r.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:r.Optional(r.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:ve,creator:r.Optional(se),updater:r.Optional(se),createdAt:S(),updatedAt:S()},{title:"DashboardFolder"}),lh=r.Object({...ea.properties,dashboardCount:r.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."})}),wl=r.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:r.Optional(r.Union([r.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:De}),vl=r.Partial(r.Object({owners:Ie(p({allowEmpty:!1}),{description:"Restrict results to dashboard folders owned by any of these team IDs",maxItems:50}),searchQuery:r.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:r.Optional(r.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:Ie(Yt.items,{description:"Restrict results to dashboard folders that have at least one of the listed key/value tags",maxItems:50}),parentFolderId:r.Union([r.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"})),Xi={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",DASHBOARD_COUNT:"dashboardCount",UPDATED_AT:"updatedAt",NAME:"name"},mh=[Xi.OWNER,Xi.TAGS,Xi.DASHBOARD_COUNT,Xi.UPDATED_AT,Xi.NAME],q3=r.Partial(r.Object({...ue,filters:vl,sort:r.Object({by:r.Enum([...mh,Xi.IS_FAVORITE],{description:"Field to sort the returned dashboard folders by"}),direction:te},{description:"Optional sorting applied to the returned dashboard folders"})})),Let=d({tags:["dashboard-folders"],url:`${Ji}/query`,method:"POST",paginated:!0,body:q3,response:r.Array(lh)}),ket=d({tags:["dashboard-folders"],url:`${Ji}/:id`,method:"GET",params:r.Object({id:p()}),response:ea}),Met=d({tags:["dashboard-folders"],url:Ji,method:"POST",body:wl,response:ea}),Det=d({tags:["dashboard-folders"],url:`${Ji}/:id`,method:"PUT",params:r.Object({id:p()}),body:wl,response:ea}),Get=d({tags:["dashboard-folders"],url:`${Ji}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),$et=d({tags:["dashboard-folders"],url:`${Ji}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Omit(vl,["tags"]))}),response:zt});var Ws=`/${"v1"}/dashboard-folders`,Nl=r.Pick(ea,["id","name","owner","parentFolderId","tags"],{$id:"DashboardFolder",description:"Folder used to organize dashboards into a two-level hierarchy"}),oN={id:"123-456-abc",name:"Platform",owner:"team-123-abc",tags:[{key:"team",value:"platform"}]};Object.assign(Nl,{examples:[oN]});var iN=r.Pick(lh,["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."}),B3={...oN,dashboardCount:10};Object.assign(iN,{examples:[B3]});var dh=r.Pick(wl,["name","owner","parentFolderId","tags"],{description:"Dashboard folder create or update request. Provide a name, owner team, optional parent folder, and optional tags."}),H3={name:"Platform",owner:"team-123-abc",parentFolderId:null,tags:[{key:"team",value:"platform"}]};Object.assign(dh,{examples:[H3]});var K3=r.Object({by:r.Enum(mh,{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:te},{description:"Optional sorting applied to the returned dashboard folders"}),aN=r.Object({...qe,filters:r.Optional(r.Pick(vl,["owners","searchQuery","tags","parentFolderId"])),sort:r.Optional(K3)},{description:"Dashboard folder query request. Use filters, sorting, limit, and offset to page through visible dashboard folders."}),z3={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(aN,{examples:[z3]});var sN=d({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:`${Ws}/query`,method:"POST",paginated:!0,body:aN,response:r.Array(iN)}),cN=d({description:"Retrieves one dashboard folder by ID.",operationId:"getDashboardFolder",tags:["dashboard-folders"],url:`${Ws}/:id`,method:"GET",params:r.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:Nl}),pN=d({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:Ws,method:"POST",body:dh,response:Nl}),uN=d({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:`${Ws}/:id`,method:"PUT",params:r.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:dh,response:Nl}),lN=d({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:`${Ws}/:id`,method:"DELETE",params:r.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:v});var Gr="/v0/dashboards",dN=["white","gray.100","amber.200","lime.200","emerald.200","cyan.200","blue.200","violet.200","fuchsia.200","pink.200","red.200"],Y3=["bar","distribution","gauge","heatmap","list","pie","query-value","table","timeseries","top-list"],itt=[...Y3,"note","slo"];var V3=["ns","us","ms","s","m","h","days"];var Q3=["B","KB","MB","GB","TB","PB"];var W3=20;var fN=r.Object({type:r.Literal("cpu",{description:"Normalizes values as CPU usage"})},{$id:"DataNormalizerCpu",title:"CPU"}),gN=r.Object({type:r.Literal("duration",{description:"Normalizes values as durations using standard time units"}),unit:r.Enum(V3,{description:"Time unit used to present the normalized values"})},{$id:"DataNormalizerDuration",title:"Duration"}),hN=r.Object({type:r.Literal("data",{description:"Normalizes values as data sizes using byte units"}),unit:r.Enum(Q3,{description:"Data size unit used to present the normalized values"})},{$id:"DataNormalizerData",title:"Data"}),yN=r.Object({type:r.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"}),TN=r.Object({type:r.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"}),EN=r.Object({type:r.Literal("date",{description:"Formats values as calendar dates"})},{$id:"DataNormalizerDate",title:"Date"}),_N=r.Object({type:r.Literal("level",{description:"Displays values using their log level name"})},{$id:"DataNormalizerLevel",title:"Level"}),IN=r.Object({type:r.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"}),Z3=r.Object({type:r.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:r.String({description:"Text label describing the custom unit"})},{$id:"DataNormalizerCustom",title:"Custom"}),X3=r.Object({type:r.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:r.String({description:"Text label describing the custom unit. Must not be empty.",minLength:1,maxLength:W3})},{$id:"InputDataNormalizerCustom",title:"Custom"}),Ut=R("type",[gN,hN,yN,TN,EN,_N,fN,IN,Z3],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),wt=R("type",[gN,hN,yN,TN,EN,_N,fN,IN,X3],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),fh=r.Object({attribute:r.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:r.Optional(Ut)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),gh=r.Object({attribute:r.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:r.Optional(wt)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),ta=["background","no-background"],J3=["table","legend-only","no-legend"];var eV=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"],SN=["alert","warning","success"],$r=r.Object({operator:r.Enum(eV,{description:"Comparator used to evaluate the metric value"}),value:r.Number({description:"Threshold value used when evaluating the operator"}),color:r.Enum(SN,{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."}),tV=r.Object({value:r.Number({description:"Y-axis value where the threshold marker is placed"}),level:r.Enum(SN,{description:"Level applied to the threshold marker"})},{title:"ThresholdMarker",description:"Marker line drawn across the chart at a fixed value, colored by its level."}),rV=["sec","min","hour","day"],qn=r.Object({time:r.Number({description:"Numeric count of `metric` units in each bucket. Required when `timeBucket` is present."}),metric:r.Enum(rV,{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 jn=r.Enum(["flex-start","center","flex-end"],{description:"Flex alignment keyword used for widget layout"}),ra=r.Object({formula:r.Optional(r.String({description:"Optional alias for formula (only used for display in the UI)"})),queries:r.Optional(r.Record(r.String(),r.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."}),na=r.Object({formula:r.Optional(p({type:"short",description:"Optional alias for formula (only used for display in the UI)"})),queries:r.Optional(r.Record(r.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."}),kl={source:gr,queries:LR,formula:r.Optional(Gu),aliases:r.Optional(ra),visibleSeries:r.Optional(r.Array(r.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},Ml={source:gr,queries:As,formula:r.Optional(So),aliases:r.Optional(na),visibleSeries:r.Optional(r.Array(r.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},Fr=r.Optional(r.Enum(["relative","absolute"],{description:"`absolute` keeps each group at its own value; `relative` shows it as a percentage of the ungrouped total (defaults to absolute)"})),oa={...kl,groupBy:r.Optional(Ci)},ia={...Ml,groupBy:r.Optional(Qr)},ze=r.Enum(J3,{description:"Controls whether and how the widget displays legend or series details (e.g. table, legend-only, or no legend)"}),Te=r.Optional(r.Union([r.Number(),r.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."})),sr=r.Optional(r.Array(tV,{description:"Threshold markers displayed on the chart"})),nV=r.Object({name:r.String({description:"Display name of the table column"}),...kl,source:gr,normalizer:r.Optional(Ut),precision:Te},{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`."}),oV=r.Object({name:p({description:"Display name of the table column"}),...Ml,source:gr,normalizer:r.Optional(wt),precision:Te},{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`."}),iV=r.Array(r.Object({id:r.String({description:"ID of the column to sort by"}),desc:r.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."}),aV=r.Array(r.Object({id:p({description:"ID of the column to sort by"}),desc:r.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."}),hh=r.Array(r.Object({id:r.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:r.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."}),yh=r.Array(r.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:r.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."}),bN=["horizontal","vertical"],sV=r.Object({type:r.Literal("list",{description:"Displays matching logs in a tabular list"}),query:r.String({description:"Query that selects logs for the list"}),listColumns:r.Optional(r.Array(fh,{description:"Custom columns to display for each log"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to list widgets."})),defaultSorting:r.Optional(hh)},{$id:"GraphVisualizationList",title:"List"}),cV=r.Object({type:r.Literal("list",{description:"Displays matching logs in a tabular list"}),query:p({type:"tsuga-query",description:"Query that selects logs for the list"}),listColumns:r.Optional(r.Array(gh,{description:"Custom columns to display for each log"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.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:r.Optional(yh)},{$id:"InputGraphVisualizationList",title:"List"}),Ll=R("type",[r.Object({type:r.Literal("auto",{description:"Automatically choose this axis bound"})}),r.Object({type:r.Literal("number",{description:"Use a fixed numeric axis bound"}),value:r.Number({description:"Fixed numeric axis bound value"})})],{description:"Axis bound mode: automatic or fixed numeric value"}),aa=r.Object({min:Ll,max:Ll,scale:R("type",[r.Object({type:r.Literal("pow",{description:"Power scale"}),exponent:r.Number({description:"Exponent used by the power scale"})}),r.Object({type:r.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:r.Boolean({description:"Whether the rendered Y axis should always include zero"})},{description:"Y-axis bounds and scale configuration for chart widgets."}),sa=r.Object({min:Ll,max:Ll,scale:R("type",[r.Object({type:r.Literal("pow",{description:"Power scale"}),exponent:r.Number({minimum:0,description:"Exponent used by the power scale"})}),r.Object({type:r.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:r.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."}),pV=r.Array(r.Integer({description:"Marker value expressed as a percentage between 0 and 100"}),{description:"Percentile markers displayed on top of the distribution chart"}),uV=r.Array(r.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 lV=["regular","dashed"],ca=r.Record(r.String(),r.Object({groupId:r.String(),lineStyle:r.Enum(lV)}),{description:"Line style of each series, keyed by 1-based query index. The last index is the formula when there is one. For widgets with a single query, only the `1` entry is read and it applies to every series. Defaults to regular."}),mV=r.Object({type:r.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),legendMode:r.Optional(ze),thresholds:sr,yAxisSettings:r.Optional(aa),lineStyleOptions:r.Optional(ca)},{$id:"GraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),dV=r.Object({type:r.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:r.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:r.Optional(ze),thresholds:sr,yAxisSettings:r.Optional(sa),lineStyleOptions:r.Optional(ca)},{$id:"InputGraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),fV=r.Object({type:r.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),query:r.String({description:"The read-only SQL query to execute against the connection."}),listColumns:r.Optional(r.Array(fh,{description:"Custom columns to display for each database row"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to connection list widgets."})),defaultSorting:r.Optional(hh)},{$id:"GraphVisualizationListConnection",title:"ListConnection"}),gV=r.Object({type:r.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:r.Optional(r.Array(gh,{description:"Custom columns to display for each database row"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.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:r.Optional(yh)},{$id:"InputGraphVisualizationListConnection",title:"ListConnection"}),hV=r.Object({type:r.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."}))},{$id:"GraphVisualizationTopListConnection",title:"TopListConnection"}),yV=r.Object({type:r.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:r.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"}),TV=r.Object({type:r.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),legendMode:r.Optional(ze)},{$id:"GraphVisualizationPieConnection",title:"PieConnection"}),EV=r.Object({type:r.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:r.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:r.Optional(ze)},{$id:"InputGraphVisualizationPieConnection",title:"PieConnection"}),_V=r.Object({type:r.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),legendMode:r.Optional(ze),thresholds:sr,yAxisSettings:r.Optional(aa)},{$id:"GraphVisualizationBarConnection",title:"BarConnection"}),IV=r.Object({type:r.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:r.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:r.Optional(ze),thresholds:sr,yAxisSettings:r.Optional(sa)},{$id:"InputGraphVisualizationBarConnection",title:"BarConnection"}),SV=r.Object({type:r.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),backgroundMode:r.Optional(r.Enum(ta,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),precision:Te,normalizer:r.Optional(Ut),legendMode:r.Optional(ze)},{$id:"GraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),bV=r.Object({type:r.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:r.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),backgroundMode:r.Optional(r.Enum(ta,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),precision:Te,normalizer:r.Optional(wt),legendMode:r.Optional(ze)},{$id:"InputGraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),OV=r.Object({type:r.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:r.String({description:"Tsuga query that selects logs to cluster into patterns"}),layout:r.Optional(r.Enum(bN,{description:"Layout used to render log patterns"}))},{$id:"GraphVisualizationListLogPatterns",title:"ListLogPatterns"}),AV=r.Object({type:r.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:r.Optional(r.Enum(bN,{description:"Layout used to render log patterns"}))},{$id:"InputGraphVisualizationListLogPatterns",title:"ListLogPatterns"}),xV=r.Object({type:r.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:r.String({description:"Query that selects trace spans for the list"}),listColumns:r.Optional(r.Array(fh,{description:"Custom columns to display for each span"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to span list widgets."})),defaultSorting:r.Optional(hh)},{$id:"GraphVisualizationListSpans",title:"ListSpans"}),RV=r.Object({type:r.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:r.Optional(r.Array(gh,{description:"Custom columns to display for each span"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.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:r.Optional(yh)},{$id:"InputGraphVisualizationListSpans",title:"ListSpans"}),Zs=r.Array(r.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."}),Xs=r.Array(p({allowEmpty:!1,type:"long",description:"Raw PromQL expression for this widget."}),{minItems:1,description:"PromQL expressions configured for this widget."}),CV=r.Object({type:r.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:Zs,aliases:r.Optional(ra),timeBucket:r.Optional(qn),normalizer:r.Optional(Ut),precision:Te,legendMode:r.Optional(ze),thresholds:sr,yAxisSettings:r.Optional(aa),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:r.Optional(ca)},{$id:"GraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),PV=r.Object({type:r.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:Xs,aliases:r.Optional(na),timeBucket:r.Optional(qn),normalizer:r.Optional(wt),precision:Te,legendMode:r.Optional(ze),thresholds:sr,yAxisSettings:r.Optional(sa),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:r.Optional(ca)},{$id:"InputGraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),UV=r.Object({type:r.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:Zs,aliases:r.Optional(ra),backgroundMode:r.Optional(r.Enum(ta,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),precision:Te,normalizer:r.Optional(Ut),legendMode:r.Optional(ze)},{$id:"GraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),wV=r.Object({type:r.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:Xs,aliases:r.Optional(na),backgroundMode:r.Optional(r.Enum(ta,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),precision:Te,normalizer:r.Optional(wt),legendMode:r.Optional(ze)},{$id:"InputGraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),vV=r.Object({type:r.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:Zs,aliases:r.Optional(ra),normalizer:r.Optional(Ut),precision:Te,conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"GraphVisualizationTopListPromql",title:"TopListPromql"}),NV=r.Object({type:r.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:Xs,aliases:r.Optional(na),normalizer:r.Optional(wt),precision:Te,conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"InputGraphVisualizationTopListPromql",title:"TopListPromql"}),LV=r.Object({type:r.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:Zs,aliases:r.Optional(ra),normalizer:r.Optional(Ut),precision:Te,legendMode:r.Optional(ze)},{$id:"GraphVisualizationPiePromql",title:"PiePromql"}),kV=r.Object({type:r.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:Xs,aliases:r.Optional(na),normalizer:r.Optional(wt),precision:Te,legendMode:r.Optional(ze)},{$id:"InputGraphVisualizationPiePromql",title:"PiePromql"}),MV=r.Object({type:r.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:Zs,aliases:r.Optional(ra),timeBucket:r.Optional(qn),precision:Te,normalizer:r.Optional(Ut),thresholds:sr,legendMode:r.Optional(ze),yAxisSettings:r.Optional(aa)},{$id:"GraphVisualizationBarPromql",title:"BarPromql"}),DV=r.Object({type:r.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:Xs,aliases:r.Optional(na),timeBucket:r.Optional(qn),precision:Te,normalizer:r.Optional(wt),thresholds:sr,legendMode:r.Optional(ze),yAxisSettings:r.Optional(sa)},{$id:"InputGraphVisualizationBarPromql",title:"BarPromql"}),GV=r.Object({type:r.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...oa,groupByMode:Fr,timeBucket:r.Optional(qn),normalizer:r.Optional(Ut),precision:Te,legendMode:r.Optional(ze),thresholds:sr,yAxisSettings:r.Optional(aa),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:r.Optional(ca)},{$id:"GraphVisualizationTimeseries",title:"Timeseries"}),$V=r.Object({type:r.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...ia,groupByMode:Fr,timeBucket:r.Optional(qn),normalizer:r.Optional(wt),precision:Te,legendMode:r.Optional(ze),thresholds:sr,yAxisSettings:r.Optional(sa),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:r.Optional(ca)},{$id:"InputGraphVisualizationTimeseries",title:"Timeseries"}),ON="Requests stacked rendering for a top-list widget. Tsuga renders stacked rows only for one count or sum query with exactly two grouped fields, no formula, non-negative values, and a single-cluster context; otherwise the widget renders as a normal top list.",FV=r.Object({type:r.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...oa,groupByMode:Fr,normalizer:r.Optional(Ut),precision:Te,conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:r.Optional(r.Boolean({description:ON}))},{$id:"GraphVisualizationTopList",title:"TopList"}),jV=r.Object({type:r.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...ia,groupByMode:Fr,normalizer:r.Optional(wt),precision:Te,conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:r.Optional(r.Boolean({description:ON}))},{$id:"InputGraphVisualizationTopList",title:"TopList"}),qV=r.Object({type:r.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...oa,groupByMode:Fr,normalizer:r.Optional(Ut),precision:Te,legendMode:r.Optional(ze)},{$id:"GraphVisualizationPie",title:"Pie"}),BV=r.Object({type:r.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...ia,groupByMode:Fr,normalizer:r.Optional(wt),precision:Te,legendMode:r.Optional(ze)},{$id:"InputGraphVisualizationPie",title:"Pie"}),HV=r.Object({type:r.Literal("query-value",{description:"Displays the aggregation as a single value"}),...kl,backgroundMode:r.Optional(r.Enum(ta,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),precision:Te,normalizer:r.Optional(Ut),legendMode:r.Optional(ze)},{$id:"GraphVisualizationQueryValue",title:"QueryValue"}),KV=r.Object({type:r.Literal("query-value",{description:"Displays the aggregation as a single value"}),...Ml,backgroundMode:r.Optional(r.Enum(ta,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array($r,{description:"Conditional formatting rules applied to the displayed value"})),precision:Te,normalizer:r.Optional(wt),legendMode:r.Optional(ze)},{$id:"InputGraphVisualizationQueryValue",title:"QueryValue"}),zV=r.Object({type:r.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...oa,groupByMode:Fr,timeBucket:r.Optional(qn),precision:Te,normalizer:r.Optional(Ut),thresholds:sr,legendMode:r.Optional(ze),yAxisSettings:r.Optional(aa)},{$id:"GraphVisualizationBar",title:"Bar"}),YV=r.Object({type:r.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...ia,groupByMode:Fr,timeBucket:r.Optional(qn),precision:Te,normalizer:r.Optional(wt),thresholds:sr,legendMode:r.Optional(ze),yAxisSettings:r.Optional(sa)},{$id:"InputGraphVisualizationBar",title:"Bar"}),AN='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.',xN=r.String({description:AN}),RN=p({description:AN}),VV=r.Object({type:r.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...oa,group:r.Optional(xN),precision:Te,normalizer:r.Optional(Ut),percentileMarkers:r.Optional(pV),boundsScale:r.Optional(Du)},{$id:"GraphVisualizationDistribution",title:"Distribution"}),QV=r.Object({type:r.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...ia,group:r.Optional(RN),precision:Te,normalizer:r.Optional(wt),percentileMarkers:r.Optional(uV),boundsScale:r.Optional(Du)},{$id:"InputGraphVisualizationDistribution",title:"Distribution"}),CN=["red","pink","violet","blue","cyan","green","yellow","orange"],PN=r.Enum(CN,{description:"Color palette used to render the heatmap intensity gradient"}),WV=r.Object({type:r.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...oa,group:r.Optional(xN),precision:Te,normalizer:r.Optional(Ut),palette:r.Optional(PN)},{$id:"GraphVisualizationHeatmap",title:"Heatmap"}),ZV=r.Object({type:r.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...ia,group:r.Optional(RN),precision:Te,normalizer:r.Optional(wt),palette:r.Optional(PN)},{$id:"InputGraphVisualizationHeatmap",title:"Heatmap"}),UN=r.Object({from:r.Number({description:"Lower bound of the Gauge color threshold; runs up to the next threshold or the max"}),color:r.Enum(CN,{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."}),XV=r.Object({type:r.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...kl,max:r.Optional(r.Number({description:"Gauge maximum value"})),colorThresholds:r.Optional(r.Array(UN,{description:"Color thresholds inside the gauge range"})),precision:Te,normalizer:r.Optional(Ut)},{$id:"GraphVisualizationGauge",title:"Gauge"}),JV=r.Object({type:r.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...Ml,max:r.Optional(r.Number({description:"Gauge maximum value"})),colorThresholds:r.Optional(r.Array(UN,{description:"Color thresholds inside the gauge range"})),precision:Te,normalizer:r.Optional(wt)},{$id:"InputGraphVisualizationGauge",title:"Gauge"}),e9=r.Object({type:r.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:r.Array(nV,{description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:r.Optional(Ci),groupByMode:Fr,defaultSorting:r.Optional(iV),columnSizes:r.Optional(r.Record(r.String(),r.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"}),t9=r.Object({type:r.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:r.Array(oV,{minItems:1,description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:r.Optional(Qr),groupByMode:Fr,defaultSorting:r.Optional(aV),columnSizes:r.Optional(r.Record(r.String(),r.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"}),r9=r.Object({type:r.Literal("note",{description:"Displays static text on the dashboard"}),note:r.Optional(r.String({description:"Markdown-compatible text shown in the note"})),noteColor:r.Optional(r.Enum(dN,{description:"Background color used to render the note"})),noteAlign:r.Optional(jn),noteJustifyContent:r.Optional(jn)},{$id:"GraphVisualizationNote",title:"Note"}),n9=r.Object({type:r.Literal("note",{description:"Displays static text on the dashboard"}),note:r.Optional(p({type:"long",description:"Markdown-compatible text shown in the note"})),noteColor:r.Optional(r.Enum(dN,{description:"Background color used to render the note"})),noteAlign:r.Optional(jn),noteJustifyContent:r.Optional(jn)},{$id:"InputGraphVisualizationNote",title:"Note"}),o9=r.Object({type:r.Literal("slo-uptime",{description:"Displays the SLI percentage of an SLO computed over the dashboard time range, colored against the SLO target. Experimental."}),sloId:r.String({description:"Id of the SLO to display"})},{$id:"GraphVisualizationSloUptime",title:"SloUptime"}),i9=r.Object({type:r.Literal("slo-uptime",{description:"Displays the SLI percentage of an SLO computed over the dashboard time range, colored against the SLO target. Experimental."}),sloId:p({allowEmpty:!1,description:"Id of the SLO to display"})},{$id:"InputGraphVisualizationSloUptime",title:"SloUptime"}),a9=r.Object({type:r.Literal("slo-over-time",{description:"Displays the good and bad events, or the per-slice status, of an SLO over the dashboard time range. Experimental."}),sloId:r.String({description:"Id of the SLO to display"})},{$id:"GraphVisualizationSloOverTime",title:"SloOverTime"}),s9=r.Object({type:r.Literal("slo-over-time",{description:"Displays the good and bad events, or the per-slice status, of an SLO over the dashboard time range. Experimental."}),sloId:p({allowEmpty:!1,description:"Id of the SLO to display"})},{$id:"InputGraphVisualizationSloOverTime",title:"SloOverTime"}),c9=R("type",[mV,fV,hV,TV,_V,SV,CV,UV,vV,LV,MV,GV,FV,qV,HV,XV,zV,VV,WV,e9,sV,r9,OV,xV,o9,a9],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),p9=R("type",[dV,gV,yV,EV,IV,bV,PV,wV,NV,kV,DV,$V,jV,BV,KV,JV,YV,QV,ZV,t9,cV,n9,AV,RV,i9,s9],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),Dl=r.Object({id:r.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:r.Optional(r.String({description:"Display name of the graph widget."})),description:r.Optional(r.String({description:"Optional text shown with the graph widget."})),descriptionAlign:r.Optional(jn),descriptionJustifyContent:r.Optional(jn),visualization:c9,layout:r.Optional(r.Object({x:r.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:r.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:r.Number({description:"Width of the widget in grid columns, out of the 12-column grid. Dashboard validation uses this with `h` and the widget type to reject layouts below the widget minimum."}),h:r.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall. Dashboard validation uses this with `w` and the widget type to reject layouts below the widget minimum."})},{description:`Grid position and size of the widget. Optional; when provided, the size must be at least ${Xd}\xD7${Jd} (width\xD7height) grid units, except note widgets which can go down to 1\xD71.`}))},{title:"Graph",description:"Single dashboard widget, combining its identity, its visualization configuration, and its position on the dashboard grid."}),Gl=r.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:r.Optional(p({description:"Display name of the graph widget."})),description:r.Optional(r.String({minLength:1,maxLength:800,description:"Text shown with the graph widget."})),descriptionAlign:r.Optional(jn),descriptionJustifyContent:r.Optional(jn),visualization:p9,layout:r.Optional(r.Object({x:r.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:r.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:r.Number({description:"Width of the widget in grid columns, out of the 12-column grid. Dashboard validation uses this with `h` and the widget type to reject layouts below the widget minimum."}),h:r.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall. Dashboard validation uses this with `w` and the widget type to reject layouts below the widget minimum."})},{description:`Grid position and size of the widget. Optional; when provided, the size must be at least ${Xd}\xD7${Jd} (width\xD7height) grid units, except note widgets which can go down to 1\xD71.`}))},{title:"Graph",description:"Single dashboard widget, combining its identity, its visualization configuration, and its position on the dashboard grid."}),mN=10,u9=r.Array(r.Object({key:r.String({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:r.Array(r.String({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:r.Optional(r.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."}),l9=r.Array(r.Object({key:p({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:r.Array(p({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:r.Optional(r.Boolean({description:"If true, widgets exclude telemetry whose value matches this filter instead of including it (is-not)."}))}),{maxItems:mN,description:`Dashboard-wide filters applied to every widget on the dashboard. Up to ${mN} filters are allowed.`}),pa=r.Object({id:r.String({description:"Tsuga-generated dashboard ID assigned when the dashboard is created."}),name:r.String({description:"Display name of the dashboard. Set by the caller on create or update."}),owner:r.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:r.Array(Dl,{description:"Ordered widgets that compose the dashboard"}),filters:r.Optional(u9),createdAt:S({description:"Timestamp when Tsuga created the dashboard."}),updatedAt:S({description:"Timestamp when Tsuga last updated the dashboard."}),creator:r.Optional(se),updater:r.Optional(se),tags:ve,timePreset:r.Optional(r.Enum(pm,{description:"Relative time preset used when opening the dashboard."})),folderId:r.Optional(r.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."}))}),$l=r.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:r.Array(Gl,{description:"Ordered widgets that compose the dashboard"}),filters:r.Optional(l9),tags:De,timePreset:r.Optional(r.Enum(pm,{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:r.Optional(r.Union([r.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."}))}),Tr={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",WIDGET_COUNT:"widgetCount",UPDATED_AT:"updatedAt",NAME:"name"},wN=[Tr.OWNER,Tr.TAGS,Tr.WIDGET_COUNT,Tr.UPDATED_AT,Tr.NAME],Mo=r.Partial(r.Object({owners:Ie(p({allowEmpty:!1}),{description:"Restrict results to dashboards owned by any of these team IDs",maxItems:50}),searchQuery:r.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:r.Optional(r.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:Ie(Yt.items,{description:"Restrict results to dashboards that have at least one of the listed key/value tags",maxItems:50}),folderId:r.Union([r.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"})),m9=r.Partial(r.Object({...ue,filters:Mo,sort:r.Object({by:r.Enum([Tr.IS_FAVORITE,Tr.OWNER,Tr.TAGS,Tr.WIDGET_COUNT,Tr.UPDATED_AT,Tr.NAME],{description:"Field to sort the returned dashboards by"}),direction:te},{description:"Optional sorting applied to the returned dashboards"})})),att=d({tags:["dashboards"],url:`${Gr}/query`,method:"POST",paginated:!0,response:r.Array(pa),body:m9}),stt=d({tags:["dashboards"],url:`${Gr}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Omit(Mo,["tags"]))}),response:zt}),ctt=d({tags:["dashboards"],url:`${Gr}/counts/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(Mo))}),response:r.Object({all:r.Integer({description:"Total number of dashboards matching the filters that the user can read."})})}),ptt=d({tags:["dashboards"],url:`${Gr}/:id`,method:"GET",params:r.Object({id:p()}),response:pa}),utt=d({tags:["dashboards"],url:Gr,method:"POST",body:$l,response:pa}),d9=d({tags:["dashboards"],url:`${Gr}/:id`,method:"PATCH",params:r.Object({id:p()}),body:r.Partial($l),response:pa}),ltt=Ti(d9),f9=Kt(Mo,{maxIds:100}),mtt=d({tags:["dashboards"],url:`${Gr}/bulk-update`,method:"PUT",body:r.Object({selection:f9,owner:r.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:Se(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:r.Object({})}),dtt=d({tags:["dashboards"],url:`${Gr}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),ftt=d({tags:["dashboards"],url:`${Gr}/:id/graphs/:graphId`,method:"PUT",params:r.Object({id:p({allowEmpty:!1}),graphId:p({allowEmpty:!1})}),body:r.Omit(Gl,["id"]),response:Dl}),g9=Kt(Mo),gtt=d({tags:["dashboards"],url:`${Gr}/bulk-delete`,method:"DELETE",body:r.Object({selection:g9}),response:r.Object({})});var ua=`/${"v1"}/dashboards`,Js=r.Pick(pa,["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)."}),h9={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(Js,{examples:[h9]});var y9=r.Object({by:r.Enum([...wN],{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:te},{description:"Optional sorting applied to the returned dashboards"}),vN=r.Object({...qe,filters:r.Optional(r.Pick(Mo,["owners","searchQuery","tags","folderId"])),sort:r.Optional(y9)},{description:"Dashboard query request. Use filters, sorting, limit, and offset to page through visible dashboards."}),T9={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(vN,{examples:[T9]});var NN=d({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:`${ua}/query`,method:"POST",paginated:!0,body:vN,response:r.Array(Js)}),LN=d({description:"Retrieves one dashboard by ID.",operationId:"getDashboard",tags:["dashboards"],url:`${ua}/:id`,method:"GET",params:r.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:Js}),Th=r.Pick($l,["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."}),E9={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(Th,{examples:[E9]});var _9=r.Omit(Gl,["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."}),kN=d({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:ua,method:"POST",body:Th,response:Js}),MN=d({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:`${ua}/:id`,method:"PUT",params:r.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:r.Partial(Th),response:Js}),I9=r.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."})}),DN=d({description:"Deletes a dashboard by ID. Use only after confirming no users or automation still rely on the dashboard.",operationId:"deleteDashboard",tags:["dashboards"],url:`${ua}/:id`,method:"DELETE",params:I9,response:v}),btt=d({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:`${ua}/:id/graphs/:graphId`,method:"PUT",params:r.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:_9,response:Dl});var GN=100,$N=3,la=r.Object({id:r.String({description:"Tsuga-generated ingestion API key ID assigned when the key is created."}),name:r.String({description:"Human-readable key name. Names must be kebab-case when creating or updating keys."}),keyLastCharacters:r.String({description:"Last visible characters of the secret key. Use this to identify a key without exposing the full secret."}),owner:r.String({description:"Team ID that owns and manages the ingestion API key."}),tags:zt,teamOverrideFields:r.Optional(r.Array(r.String(),{description:"Telemetry attribute names used to override ownership for data sent with this key."})),updatedAt:S({description:"Timestamp when Tsuga last updated the key metadata."}),createdAt:S({description:"Timestamp when Tsuga created the key."}),creator:r.Optional(se),updater:r.Optional(se),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})}),ec=r.Object({name:r.String({format:gi,minLength:1,maxLength:GN,description:`Kebab-case name for the ingestion API key. Maximum length is ${GN} characters.`}),owner:p({allowEmpty:!1,description:"Team ID that will own and manage the ingestion API key."}),tags:Yt,teamOverrideFields:r.Union([r.Array(p({allowEmpty:!1}),{minItems:1,maxItems:$N,description:`Array form. Up to ${$N} fields are allowed.`}),r.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."})}),ma="/v0/ingestion-api-keys",vtt=d({tags:["ingestion-api-keys"],url:ma,method:"POST",body:ec,response:r.Intersect([la,r.Object({key:r.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."})})])}),Ntt=d({tags:["ingestion-api-keys"],url:ma,method:"GET",paginated:!0,query:r.Object(ue),response:r.Array(la)}),Ltt=d({tags:["ingestion-api-keys"],url:`${ma}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1})}),response:la}),ktt=d({tags:["ingestion-api-keys"],url:`${ma}/:id`,method:"PUT",params:r.Object({id:p({allowEmpty:!1})}),body:ec,response:la}),Mtt=d({tags:["ingestion-api-keys"],url:`${ma}/:id`,method:"DELETE",params:r.Object({id:p({allowEmpty:!1})}),response:v}),Dtt=d({tags:["ingestion-api-keys"],url:`${ma}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(p({allowEmpty:!1}))}),response:r.Object({})});var tc=`/${"v1"}/ingestion-api-keys`,rc=r.Pick(la,["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)."}),FN={id:"123-456-abc",name:"production-logs-ingestion",keyLastCharacters:"x7Qm",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(rc,{examples:[FN]});var jN=r.Pick(ec,["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."}),qN=r.Pick(ec,["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."}),BN={name:"production-logs-ingestion",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(jN,{examples:[BN]});Object.assign(qN,{examples:[BN]});var S9={...FN,key:"tsuga_in:v1:abc123xyx7Qm"},HN=d({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:tc,method:"GET",paginated:!0,query:r.Object(qe),response:r.Array(rc)}),Ktt=d({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:`${tc}/:id`,method:"GET",params:r.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:rc}),b9=r.Intersect([r.Pick(rc,["id","name","keyLastCharacters","owner","tags","teamOverrideFields"]),r.Object({key:r.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:S9}),KN=d({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:tc,method:"POST",body:jN,response:b9}),zN=d({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:`${tc}/:id`,method:"PUT",params:r.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:qN,response:rc}),YN=d({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:`${tc}/:id`,method:"DELETE",params:r.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:v});var O9={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"]}},[Qtt,Fl,nc]=A9(O9),Wtt=Object.fromEntries(Fl.map(e=>[e,e]));function A9(e){let t=[],n=[],o=[],i=Object.keys(e);for(let a of i){t.push(a);let c=e[a];for(let l in c){n.push(l);let m=c[l];Array.isArray(m)&&o.push(...m)}}return[Eh(t),Eh(n),Eh(o)]}function Eh(e){if(e.length===0)throw new Error("Array must have at least one element.");return e}var _h=r.Enum(["HTTP","HTTPS","TCP","UDP","GENEVE","TLS","TLS_QUIC","TCP_UDP","TCP_QUIC","QUIC"]),x9=r.Object({versioningStatus:r.Optional(r.Enum(["Enabled","Disabled","Suspended","Not configured"]))}),R9=r.Object({domainName:r.Optional(r.String()),origins:r.Optional(r.Array(r.String()))}),C9=r.Object({allocatedStorageGib:r.Optional(r.Number()),encryptedAtRest:r.Optional(r.Boolean()),engine:r.Optional(r.String()),dynamoDbItemCount:r.Optional(r.Number()),dynamoDbActualSizeGib:r.Optional(r.Number())}),P9=r.Object({version:r.Optional(r.String()),virtualNetworkId:r.Optional(r.String()),subnets:r.Optional(r.Array(r.String()))}),U9=r.Object({artifactRegistryFormat:r.Optional(r.Enum(["FORMAT_UNSPECIFIED","DOCKER","MAVEN","NPM","APT","YUM","PYTHON","KFP","GO","GENERIC"])),uri:r.Optional(r.String()),tagMutability:r.Optional(r.Enum(["MUTABLE","IMMUTABLE"])),scanOnPush:r.Optional(r.Boolean()),encryptionType:r.Optional(r.String())}),w9=r.Object({status:r.Optional(r.String()),activeServices:r.Optional(r.Number()),pendingTasks:r.Optional(r.Number()),runningTasks:r.Optional(r.Number()),registeredContainerInstances:r.Optional(r.Number()),capacityProviders:r.Optional(r.Array(r.String()))}),v9=r.Object({status:r.Optional(r.String()),desiredStatus:r.Optional(r.String()),healthStatus:r.Optional(r.String()),availabilityZone:r.Optional(r.String()),startedAt:r.Optional(S())}),N9=r.Object({isEncrypted:r.Optional(r.Boolean()),ownerId:r.Optional(r.String()),state:r.Optional(r.Enum(["creating","available","deleting","deleted","error","updating"]))}),L9=r.Object({type:r.Optional(r.String()),osType:r.Optional(r.String()),subnetIds:r.Optional(r.Array(r.String())),nbContainers:r.Optional(r.Number())}),k9=r.Object({digest:r.String(),imageTags:r.Array(r.String()),imageSizeBytes:r.Optional(r.Number()),imagePushedAt:r.Optional(S()),mediaType:r.Optional(r.String()),repositoryName:r.String(),repositoryId:r.Optional(r.String()),scanStatus:r.Optional(r.String())}),M9=r.Object({url:r.Optional(r.String()),maxMessageSizeBytes:r.Optional(r.Number()),messageRetentionHours:r.Optional(r.Number())}),D9=r.Object({runtime:r.Optional(r.String()),memoryAllocationMib:r.Optional(r.Number()),timeoutMs:r.Optional(r.Number()),ephemeralStorageMib:r.Optional(r.Number({description:"Size of the temporary storage mounted on the function instance, in MiB. Only present for platforms that expose it, such as AWS Lambda."})),codeSha256:r.Optional(r.String())}),G9=r.Object({kind:r.Optional(r.String())}),$9=r.Object({instanceId:r.String(),architecture:r.Optional(r.String()),instanceType:r.Optional(r.String()),operatingSystem:r.Optional(r.String()),memoryMib:r.Optional(r.Number()),vCpus:r.Optional(r.Number()),vpcId:r.Optional(r.String()),k8sClusterId:r.Optional(r.String())}),F9=r.Object({id:r.Optional(r.String()),ipCidrBlocks:r.Array(r.String())}),j9=r.Object({protocol:r.Optional(_h),port:r.Optional(r.Number()),instanceProtocol:r.Optional(_h),instancePort:r.Optional(r.Number())}),q9=r.Object({protocol:r.Optional(r.String()),ports:r.Optional(r.Array(r.String())),portRange:r.Optional(r.String()),allPorts:r.Optional(r.Boolean())}),B9=r.Object({name:r.String(),ip:r.Optional(r.String()),type:r.Enum(["public","private"])}),H9=r.Object({type:r.String(),name:r.String()}),K9=r.Object({frontendIp:r.Optional(B9),backendIpPools:r.Array(H9)}),z9=r.Object({targetId:r.String(),targetPort:r.Optional(r.Number()),targetType:r.Optional(r.Enum(["instance","ip","lambda","alb"])),healthState:r.Optional(r.String()),healthReason:r.Optional(r.String()),healthDescription:r.Optional(r.String()),availabilityZone:r.Optional(r.String())}),Y9=r.Object({protocol:r.Optional(_h),port:r.Optional(r.Number()),type:r.Optional(r.Enum(["alb","lambda","instance","ip"])),name:r.Optional(r.String()),targetGroupArn:r.Optional(r.String()),virtualNetworkId:r.Optional(r.String()),healthCheckProtocol:r.Optional(r.String()),healthCheckPort:r.Optional(r.String()),healthCheckPath:r.Optional(r.String()),healthCheckIntervalSeconds:r.Optional(r.Number()),healthCheckTimeoutSeconds:r.Optional(r.Number()),healthyThresholdCount:r.Optional(r.Number()),unhealthyThresholdCount:r.Optional(r.Number()),targets:r.Optional(r.Array(z9)),targetCount:r.Optional(r.Number()),healthyTargetCount:r.Optional(r.Number()),loadBalancerArns:r.Optional(r.Array(r.String()))}),V9=r.Object({first:r.Optional(r.String()),last:r.Optional(r.String()),scope:r.Optional(r.Number())}),Q9=r.Object({type:r.Optional(r.String()),name:r.Optional(r.String()),alwaysServe:r.Optional(r.Boolean()),subnets:r.Optional(r.Array(r.Union([r.Number(),V9]))),target:r.Optional(r.String()),weight:r.Optional(r.Number()),priority:r.Optional(r.Number()),status:r.Optional(r.String())}),W9=r.Object({instanceId:r.Optional(r.String()),state:r.Optional(r.String()),reasonCode:r.Optional(r.String()),description:r.Optional(r.String())}),Z9=r.Object({loadBalancerType:r.Optional(r.String()),dnsName:r.Optional(r.String()),virtualNetworkId:r.Optional(r.String()),subnetIds:r.Array(r.String()),scheme:r.Optional(r.String()),listeners:r.Optional(r.Union([r.Array(j9),r.Array(q9)])),targets:r.Optional(r.Union([r.Array(r.String()),r.Array(W9),r.Array(Q9)])),azureLoadBalancingRules:r.Optional(r.Array(K9))}),X9=r.Object({domainName:r.Optional(r.String()),expiresAt:r.Optional(S()),inUseBy:r.Optional(r.Array(r.String())),renewalEligibility:r.Optional(r.String()),revokedAt:r.Optional(S()),status:r.Optional(r.String()),type:r.Optional(r.String())}),J9=r.Object({state:r.Optional(r.Enum(["creating","available","deleting","deleted","error","in-use"])),volumeType:r.Optional(r.Enum(["gp2","gp3","io1","io2","st1","sc1","standard"]))}),e6=r.Object({osType:r.Optional(r.Enum(["Windows","Linux"]))}),t6=r.Object({state:r.Optional(r.String()),volumeType:r.Optional(r.String())}),r6=r.Intersect([r.Object({isEncrypted:r.Optional(r.Boolean()),sizeGib:r.Optional(r.Number())}),r.Union([J9,t6,e6])]),n6=r.Object({instanceCount:r.Optional(r.Number()),hostnames:r.Optional(r.Array(r.String())),runtime:r.Optional(r.String())}),jl=r.Union([r.Object({category:r.Literal("application"),resourceType:r.Literal("webService"),attributes:r.Optional(n6)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("bucket"),attributes:r.Optional(x9)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("messagingService"),attributes:r.Optional(M9)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("fileSystem"),attributes:r.Optional(N9)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("contentDeliveryNetwork"),attributes:r.Optional(R9)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("database"),attributes:r.Optional(C9)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("storageAccount"),attributes:r.Optional(G9)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("volume"),attributes:r.Optional(r6)}),r.Object({category:r.Literal("compute"),resourceType:r.Literal("virtualMachine"),attributes:r.Optional($9)}),r.Object({category:r.Literal("compute"),resourceType:r.Literal("serverless"),attributes:r.Optional(D9)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("kubernetesCluster"),attributes:r.Optional(P9)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerRepository"),attributes:r.Optional(U9)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerCluster"),attributes:r.Optional(w9)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerServiceTask"),attributes:r.Optional(v9)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerService"),attributes:r.Optional(L9)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerImage"),attributes:r.Optional(k9)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("virtualNetwork"),attributes:r.Optional(F9)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("loadBalancer"),attributes:Z9}),r.Object({category:r.Literal("network"),resourceType:r.Literal("targetGroup"),attributes:r.Optional(Y9)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("certificate"),attributes:r.Optional(X9)})],{description:"Normalized public inventory category, resource type, and category-specific attributes. Attribute shape depends on the category and resourceType combination."});var Do="/v0/inventory",VN=["scan_in_progress","success","failure","partial"],Sh=r.Object({id:r.String({description:"Identifier of the inventory resource. Generated by Tsuga."}),cloudPlatform:r.Enum(vn,{description:"Cloud platform where Tsuga discovered this resource."}),cloudAccount:r.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:r.Optional(r.String({description:"Cloud region where Tsuga discovered this resource, when the resource is regional."})),fullyQualifiedResourceId:r.String({description:"Cloud-native unique identifier for this resource, such as an AWS ARN, GCP resource name, or Azure resource ID."}),displayName:r.String({description:"Human-readable resource name shown in Tsuga. Derived from cloud provider metadata when available."}),nativeResourceType:r.String({description:"Cloud-native resource type reported by the inventory integration, for example `aws_ec2_instance` or `gcp_bucket`."}),resourceCreatedAt:r.Optional(S({description:"Timestamp when the resource was created in the cloud, when known."})),resourceUpdatedAt:r.Optional(S({description:"Timestamp when the resource was last updated in the cloud, when known."})),resourceLastSeenAt:S({description:"Timestamp when Tsuga last observed this resource during an inventory scan."}),tags:ve,nativeAttributes:r.Optional(r.Unsafe({type:"object",additionalProperties:!0})),covered:r.Optional(r.Boolean({description:"Whether the resource is covered by the configured infrastructure-as-code identifiers"}))}),da={DISPLAY_NAME:"displayName",CLOUD_ACCOUNT:"cloudAccount",NATIVE_RESOURCE_TYPE:"nativeResourceType",CLOUD_REGION:"cloudRegion",RESOURCE_TYPE:"resourceType",RESOURCE_CREATED_AT:"resourceCreatedAt"},QN=r.Object({cloudPlatforms:Ie(r.Enum(vn),{description:"Restrict results to resources discovered on any of these cloud platforms",maxItems:vn.length}),cloudAccounts:Ie(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud accounts",maxItems:500}),cloudRegions:Ie(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud regions",maxItems:500}),nativeResourceTypes:Ie(r.Enum(nc),{description:"Restrict results to resources of any of these cloud-native resource types",maxItems:nc.length}),resourceTypes:Ie(r.Enum(Fl),{description:"Restrict results to resources of any of these normalized resource types",maxItems:Fl.length}),tags:Ie(Yt.items,{description:"Restrict results to resources that have at least one of the listed key/value tags",maxItems:50}),isIacManaged:r.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:r.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:r.Optional(r.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"}),bh=r.Partial(r.Object({...ue,filters:r.Partial(QN,{description:"Filters applied to narrow the returned resources."}),sort:r.Object({by:r.Enum([da.DISPLAY_NAME,da.CLOUD_ACCOUNT,da.NATIVE_RESOURCE_TYPE,da.CLOUD_REGION,da.RESOURCE_TYPE,da.RESOURCE_CREATED_AT],{description:"Field to sort the returned resources by"}),direction:te},{description:"Optional sorting applied to the returned resources. Ties are broken by resource ID for stable pagination."})})),irt=d({tags:["inventory"],method:"POST",url:`${Do}/resources/query`,paginated:!0,body:bh,response:r.Array(r.Intersect([Sh,jl]))}),o6=["resourceType","cloudAccount","isIacManaged"],art=d({tags:["inventory"],method:"POST",url:`${Do}/resources/counts`,body:r.Object({filters:r.Optional(r.Partial(QN)),groupBy:r.Enum(o6,{description:"Dimension to group the resource counts by."})}),response:r.Array(r.Object({value:r.String({description:'The group value the count belongs to: a resource type, a cloud account id, or "true"/"false" for IaC coverage.'}),count:r.Integer({description:"Number of resources in this group matching the requested filters."})}))}),srt=d({tags:["inventory"],method:"GET",url:`${Do}/resources/filter-options`,response:r.Object({cloudRegions:r.Array(r.String(),{description:"Distinct cloud regions present across the tenant's resources."}),nativeResourceTypes:r.Array(r.String(),{description:"Distinct cloud-native resource types present across the tenant's resources."}),tags:zt})}),crt=R("type",[r.Object({type:r.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:r.String({description:"AWS account ID that Tsuga scans."}),externalId:r.String({description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:r.String({description:"ARN of the IAM role Tsuga assumes to read inventory in the account."})}),r.Object({type:r.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:r.String({description:"GCP project ID that Tsuga scans."}),serviceAccountId:r.String({description:"Service account Tsuga impersonates to read inventory."}),workloadIdentityProvider:r.String({description:"Workload identity provider resource name used for federated authentication."})}),r.Object({type:r.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:r.String({description:"Client ID of the Azure application Tsuga authenticates as."}),subscriptionId:r.String({description:"Azure subscription ID that Tsuga scans."}),tenantId:r.String({description:"Azure tenant ID that owns the subscription."})})]),i6="^[0-9]{12}$",a6="^arn:aws[a-z-]*:iam::[0-9]{12}:role/.+$",s6="^[a-z][a-z0-9-]{4,28}[a-z0-9]$",c6="^[^@\\s]+@[^@\\s]+\\.iam\\.gserviceaccount\\.com$",p6="^//iam\\.googleapis\\.com/projects/[0-9]+/locations/global/workloadIdentityPools/[^/]+/providers/[^/]+$",Ih="^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$",u6=r.Object({type:r.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:r.String({pattern:i6,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:r.String({pattern:a6,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"}),l6=r.Object({type:r.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:r.String({pattern:s6,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:r.String({pattern:c6,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:r.String({pattern:p6,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"}),m6=r.Object({type:r.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:r.String({pattern:Ih,minLength:1,description:"Client ID of the Azure application Tsuga authenticates as (GUID).",errorMessage:{pattern:"Must be a GUID."}}),subscriptionId:r.String({pattern:Ih,minLength:1,description:"Azure subscription ID that Tsuga scans (GUID).",errorMessage:{pattern:"Must be a GUID."}}),tenantId:r.String({pattern:Ih,minLength:1,description:"Azure tenant ID that owns the subscription (GUID).",errorMessage:{pattern:"Must be a GUID."}})},{$id:"AzureConnectionSettings"}),WN=R("type",[u6,l6,m6],{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`."}),fa=r.Object({id:r.String({description:"Identifier of the cloud account. Generated by Tsuga."}),cloudType:r.Enum(vn,{description:"Cloud provider of the account."}),cloudAccountId:r.String({description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:r.Optional(r.String({description:"Human-readable name for the account shown in Tsuga."})),organizationId:r.Optional(r.String({description:"Cloud organization identifier, when known."})),createdBy:r.Optional(r.String({description:"Identifier of the user who created the account, when created by a user."})),createdAt:S({description:"Timestamp when the account was registered in Tsuga."}),lastScanStartedAt:r.Optional(S({description:"Timestamp when the most recent inventory scan started."})),lastScanFinishedAt:r.Optional(S({description:"Timestamp when the most recent inventory scan finished."})),lastScanStatus:r.Optional(r.Enum(VN,{description:"Status of the most recent inventory scan."}))}),Oh=r.Object({cloudType:r.Enum(vn,{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:r.Optional(p({description:"Human-readable name for the account shown in Tsuga."})),organizationId:r.Optional(p({description:"Cloud organization identifier, when known."})),connectionSettings:WN,lastScanStatus:r.Optional(r.Enum(VN,{description:"Status of the most recent inventory scan."}))}),Go=`${Do}/cloud-accounts`,prt=d({tags:["inventory"],url:Go,method:"GET",response:r.Array(fa)}),urt=d({tags:["inventory"],url:`${Go}/:id`,method:"GET",params:r.Object({id:p()}),response:fa}),lrt=d({tags:["inventory"],url:Go,method:"POST",body:Oh,response:fa}),Ah=r.Object({accountFriendlyName:p({description:"Human-readable name for the account shown in Tsuga."})}),mrt=d({tags:["inventory"],url:`${Go}/:id`,method:"PUT",params:r.Object({id:p()}),body:Ah,response:fa}),drt=d({tags:["inventory"],url:`${Go}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),frt=d({tags:["inventory"],url:`${Do}/trigger-scan`,method:"POST",body:r.Object({}),response:r.Object({success:r.Literal(!0)})}),grt=d({tags:["inventory"],url:`${Go}/azure/onboarding`,method:"POST",body:r.Object({tenantId:p()}),response:r.Object({subjectId:r.String(),audience:r.String()})}),hrt=d({tags:["inventory"],method:"POST",url:`${Go}/validate/:type`,params:r.Object({type:p()}),body:r.Object({data:WN,id:r.Optional(p())}),response:r.Object({areAccountSettingsValid:r.Boolean(),message:r.Optional(r.String())})}),ZN=`${Do}/settings`,yrt=d({tags:["inventory"],url:ZN,method:"GET",response:r.Object({settings:r.Optional(r.Object({id:r.String(),infrastructureIdentifiers:r.Array(r.Object({name:r.String(),value:r.Optional(r.String())}))}))})}),d6=50,Trt=d({tags:["inventory"],url:ZN,method:"POST",body:r.Object({infrastructureIdentifiers:r.Array(r.Object({name:p({allowEmpty:!1}),value:r.Optional(p({allowEmpty:!1}))}),{maxItems:d6})}),response:r.Object({})}),Ert=d({tags:["inventory"],url:`${Do}/iac-tags-proposal`,method:"GET",response:r.Array(r.Object({name:r.String(),value:r.Optional(r.String())}))});var XN=`/${"v1"}/inventory`,f6=r.Omit(Sh,["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)."}),JN=r.Intersect([f6,jl],{$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)."}),g6={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(JN,{examples:[g6]});var eL=r.Object({...bh.properties,...qe},{description:"Inventory resource query request. Use filters, sorting, limit, and offset to page through discovered resources."}),h6={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(eL,{examples:[h6]});var tL=d({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:`${XN}/resources/query`,method:"POST",paginated:!0,body:eL,response:r.Array(JN)}),oc=`${XN}/cloud-accounts`,ic=r.Pick(fa,["id","cloudType","cloudAccountId","accountFriendlyName"],{$id:"CloudAccount"}),y6={id:"123-456-abc",cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS"};Object.assign(ic,{examples:[y6]});var rL=r.Pick(Oh,["cloudType","cloudAccountId","accountFriendlyName","connectionSettings"]),T6={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(rL,{examples:[T6]});var E6=r.Pick(Ah,["accountFriendlyName"]),Crt=d({description:"Lists cloud accounts connected to Tsuga that the authenticated operation key can read.",operationId:"listCloudAccounts",tags:["inventory"],url:oc,method:"GET",response:r.Array(ic)}),Prt=d({description:"Retrieves one cloud account by ID.",operationId:"getCloudAccount",tags:["inventory"],url:`${oc}/:id`,method:"GET",params:r.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:ic}),Urt=d({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:oc,method:"POST",body:rL,response:ic}),wrt=d({description:"Updates the friendly name of a cloud account by ID.",operationId:"updateCloudAccount",tags:["inventory"],url:`${oc}/:id`,method:"PUT",params:r.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:E6,response:ic}),vrt=d({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:`${oc}/:id`,method:"DELETE",params:r.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:v});var ac="/v0/investigations",_6=["dashboard","monitor","service","slo","log-route","adaptive-notification-rule"],I6=r.Object({type:r.String({description:'Kind of linked asset, e.g. "dashboard"'}),id:r.String({description:"Identifier of the linked asset"})}),S6=r.Object({type:r.Enum(_6,{description:"Kind of linked asset"}),id:p({allowEmpty:!1,description:"Identifier of the linked asset"})}),on=r.Object({id:r.String({description:"Identifier of the investigation"}),name:r.String({description:"Human readable name shown for the investigation"}),slug:r.Optional(r.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:r.Optional(r.String({description:"Markdown content capturing the investigation notes and findings"})),tags:ve,owner:r.String({description:"Team ID owning the investigation"}),env:r.Optional(r.String({description:'Environment the investigation relates to, e.g. "prod"'})),linkedAssets:r.Array(I6,{description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}),creator:r.Optional(se),updater:r.Optional(se),createdAt:S({description:"Timestamp the investigation was created at."}),updatedAt:S({description:"Timestamp the investigation was last updated at."})},{title:"Investigation"}),ql=r.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:Se(p({type:"long"}),{description:"Markdown content capturing the investigation notes and findings"}),tags:De,owner:p({allowEmpty:!1,description:"Team ID owning the investigation"}),env:Se(p({allowEmpty:!0}),{description:"Environment the investigation relates to"}),linkedAssets:r.Optional(r.Array(S6,{maxItems:100,description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}))}),xh=r.Object(r.Omit(ql,["slug"]).properties),Frt=d({tags:["investigations"],url:ac,method:"GET",paginated:!0,query:r.Object(ue),response:r.Array(on)}),jrt=d({tags:["investigations"],url:`${ac}/:id`,params:r.Object({id:p()}),method:"GET",response:on}),qrt=d({tags:["investigations"],url:ac,method:"POST",body:ql,response:on}),Brt=d({tags:["investigations"],url:`${ac}/:id`,method:"PUT",body:xh,params:r.Object({id:p()}),response:on}),Hrt=d({tags:["investigations"],url:`${ac}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v});var sc=`/${"v1"}/investigations`,nL=d({description:"Retrieve all investigations",tags:["private"],url:sc,method:"GET",paginated:!0,query:r.Object(qe),response:r.Array(on)}),oL=d({description:"Retrieve an investigation by its id",tags:["private"],url:`${sc}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1})}),response:on}),iL=d({description:"Create a new investigation",tags:["private"],url:sc,method:"POST",body:ql,response:on}),aL=d({description:"Update an investigation by its id",tags:["private"],url:`${sc}/:id`,method:"PUT",body:xh,params:r.Object({id:p({allowEmpty:!1})}),response:on}),sL=d({description:"Delete an investigation by its id",tags:["private"],url:`${sc}/:id`,method:"DELETE",params:r.Object({id:p({allowEmpty:!1})}),response:v});var cL=15,Bl={id:r.String({description:"Unique identifier of the processor within the route. Used to preserve processor identity during updates."}),description:r.Optional(r.String({description:"Optional user-provided processor note."})),tags:ve,updatedAt:r.Optional(S({description:"Timestamp when Tsuga last updated the processor."}))},Hl={id:p({allowEmpty:!1,description:"Unique identifier of the processor within the route. Preserve it across updates for existing processors."}),description:r.Optional(p({type:"long",description:"Optional processor note."})),tags:De,updatedAt:r.Optional(S({description:"Backend-maintained timestamp for this processor. Omit this field on create and update requests; Tsuga sets or preserves it based on processor changes."}))},pL={...Bl,type:r.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},uL={...Hl,type:r.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},b6=R("subtype",[r.Object({targetAttribute:r.String({description:"Attribute that will receive the formatted value"}),formatString:r.String({description:"Template string used to build the target attribute value"}),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:r.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Whether missing referenced attributes render as empty strings. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorFormatString"}),r.Object({targetAttribute:r.String({description:"Attribute that will receive the computed value"}),formula:r.String({description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:r.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:r.Optional(r.Boolean({description:"Whether missing referenced attributes evaluate as zero. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorMathFormula"}),r.Object({targetAttribute:r.String({description:"Attribute that will receive the category value"}),clauses:r.Array(r.Object({query:r.String({description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:r.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:r.Optional(r.String({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:r.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."}),O6=R("subtype",[r.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:r.Optional(r.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:r.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))},{$id:"InputProcessorParamsCreatorFormatString"}),r.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:r.Optional(r.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:r.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:r.Optional(r.Boolean({description:"Set to true for missing referenced attributes to evaluate as zero. Defaults to true."}))},{$id:"InputProcessorParamsCreatorMathFormula"}),r.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:r.Array(r.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:cL,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:r.Optional(p({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:r.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."}),A6=r.Object({...pL,params:b6}),x6=r.Object({...uL,params:O6}),lL={...Bl,type:r.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},mL={...Hl,type:r.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},R6=R("subtype",[r.Object({attributes:r.Array(r.Object({originAttribute:r.String({description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Whether the source attribute is preserved after mapping. If omitted, route processing treats this as false."})),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),targetAttribute:r.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:r.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"ProcessorParamsMapperMapAttributes"}),r.Object({attributeName:r.String({description:"Attribute whose value will determine the log level"}),subtype:r.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"ProcessorParamsMapperMapLevel"}),r.Object({attributeName:r.String({description:"Attribute whose value will determine the log timestamp"}),subtype:r.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."}),C6=R("subtype",[r.Object({attributes:r.Array(r.Object({originAttribute:p({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:r.Optional(r.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:r.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"InputProcessorParamsMapperMapAttributes"}),r.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will determine the log level"}),subtype:r.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"InputProcessorParamsMapperMapLevel"}),r.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will determine the log timestamp"}),subtype:r.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."}),P6=r.Object({...mL,params:C6}),U6=r.Object({...lL,params:R6}),dL={...Bl,type:r.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},fL={...Hl,type:r.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},gL=5,w6=R("subtype",[r.Object({attributeName:r.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:r.Array(r.String({description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:r.Optional(r.Array(r.String(),{description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:r.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),r.Object({sourceAttribute:r.String({description:"Attribute containing the URL to parse"}),subtype:r.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),r.Object({sourceAttribute:r.String({description:"Attribute containing the user agent string to parse"}),subtype:r.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),r.Object({sourceAttribute:r.String({description:"Attribute containing the key/value string segment to parse"}),targetAttribute:r.String({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:r.String({description:"Delimiter separating keys from values in the source string"}),pairsSplitter:r.String({description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:r.Boolean({description:"Whether keys without explicit values are accepted by the parser."}),subtype:r.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."}),v6=R("subtype",[r.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:r.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:r.Optional(r.Array(p({type:"long"}),{maxItems:gL,description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:r.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),r.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the URL to parse"}),subtype:r.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),r.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the user agent string to parse"}),subtype:r.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),r.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:r.Boolean({description:"Set to true to accept keys without explicit values."}),subtype:r.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."}),N6=r.Object({...dL,params:w6}),L6=r.Object({...fL,params:v6}),k6=r.Object({...uL,params:R("subtype",[r.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:r.Optional(r.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:r.Literal("format-string"),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))}),r.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:r.Array(r.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:cL,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:r.Optional(p({description:"String category value used when no clause matches."})),subtype:r.Literal("category")})])}),M6=r.Object({...mL,params:r.Object({attributes:r.Array(r.Object({originAttribute:p({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:r.Optional(r.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:r.Literal("map-attributes")})}),D6=r.Object({...fL,params:r.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:r.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:r.Optional(r.Array(p({type:"long"}),{maxItems:gL,description:"Example log lines for validating the Grok rules."})),subtype:r.Literal("grok")})}),nnt=R("type",[M6,D6,k6]),G6=r.Object({...pL,params:R("subtype",[r.Object({targetAttribute:r.String({description:"Attribute that will receive the formatted value"}),formatString:r.String({description:"Template string used to build the target attribute value"}),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),subtype:r.Literal("format-string"),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Whether missing referenced attributes render as empty strings."}))}),r.Object({targetAttribute:r.String({description:"Attribute that will receive the category value"}),clauses:r.Array(r.Object({query:r.String({description:"Query that selects logs for this category clause."}),value:r.String({description:"String category value assigned when this clause matches."})}),{description:"Conditions evaluated in order to determine the category value."}),defaultValue:r.Optional(r.String({description:"String category value used when no clause matches."})),subtype:r.Literal("category")})])}),$6=r.Object({...lL,params:r.Object({attributes:r.Array(r.Object({originAttribute:r.String({description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Whether the source attribute is preserved after mapping."})),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),targetAttribute:r.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:r.Literal("map-attributes")})}),F6=r.Object({...dL,params:r.Object({attributeName:r.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:r.Array(r.String({description:"Grok rule applied to parse text."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:r.Optional(r.Array(r.String(),{description:"Example log lines for validating the Grok rules."})),subtype:r.Literal("grok")})}),ont=R("type",[$6,F6,G6]),j6=11,hL=r.Cyclic({OutputProcessor:r.Union([U6,N6,A6,r.Object({...Bl,params:r.Object({items:r.Array(r.Object({query:r.String({description:"Query that determines whether logs enter this branch"}),processors:r.Array(r.Ref("OutputProcessor"),{description:"Processors executed when the branch query matches"})}),{description:"Conditional branches evaluated in order before falling back to the default"})}),type:r.Literal("split",{description:"Split processor. It sends each log through the first matching conditional branch."})})])},"OutputProcessor",{description:"Processing step executed sequentially on route logs"}),yL=r.Cyclic({InputProcessor:r.Union([P6,L6,x6,r.Object({...Hl,params:r.Object({items:r.Array(r.Object({query:p({type:"tsuga-query",description:"Query that determines whether logs enter this branch"}),processors:r.Array(r.Ref("InputProcessor"),{maxItems:50,description:"Processors executed when the branch query matches"})}),{minItems:2,maxItems:j6,description:"Conditional branches evaluated in order before falling back to the default"})}),type:r.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 q6="/v0/logs",Bn=`${q6}/routes`,Hn=r.Object({id:r.String({description:"Tsuga-generated log route ID assigned when the route is created."}),name:r.String({description:"Human-readable route name shown in Tsuga."}),description:r.Optional(r.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:r.Boolean({description:"Whether this route is active for newly ingested logs. Disabled routes remain saved but do not process logs."}),query:r.String({description:"Tsuga query that selects which newly ingested logs enter the route processor chain."}),rank:r.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:ve,owner:r.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:r.Array(hL,{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:r.Optional(se),updater:r.Optional(se),updatedAt:S({description:"Timestamp when Tsuga last updated the route."}),createdAt:S({description:"Timestamp when Tsuga created the route."}),assetUpdatedAt:S({description:"Timestamp when Tsuga last changed route behavior. This can differ from `updatedAt` when only metadata such as `description` or `tags` changed."})},{title:"LogRoute"}),cc=r.Object({name:p({allowEmpty:!1,description:"Human-readable log route name shown in Tsuga."}),description:Se(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:r.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:De,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:r.Array(yL,{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 dnt=d({tags:["routes"],url:Bn,method:"GET",paginated:!0,query:r.Object(ue),response:r.Array(Hn)}),fnt=d({tags:["routes"],url:`${Bn}/:id`,params:r.Object({id:p()}),method:"GET",response:Hn}),gnt=d({tags:["routes"],url:Bn,method:"POST",body:cc,response:Hn}),hnt=d({tags:["routes"],url:`${Bn}/:id`,method:"PUT",body:cc,params:r.Object({id:p()}),response:Hn}),ynt=d({tags:["routes"],url:`${Bn}/:id/clone`,method:"POST",params:r.Object({id:p()}),body:cc,response:Hn}),Tnt=d({tags:["routes"],url:`${Bn}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),Ent=d({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:`${Bn}/:id/modify-ranking`,method:"PUT",params:r.Object({id:p()}),body:r.Object({rank:r.Integer({minimum:1,description:"Target rank for the route, from 1 to the total number of routes. Requests outside that range are rejected."})}),response:r.Object({})}),_nt=d({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:`${Bn}/:id/enable`,method:"PUT",params:r.Object({id:p()}),body:r.Object({enable:r.Boolean({description:"Set to true to enable the route, or false to disable it."})}),response:Hn});var pc=`/${"v1"}/routes`,TL={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}"]}}]},EL={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}}]},uc=r.Pick(Hn,["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)."}),B6={id:"123-456-abc",...TL},H6={id:"456-789-def",...EL};Object.assign(uc,{examples:[B6,H6]});var _L=d({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:pc,method:"GET",paginated:!0,query:r.Object(qe),response:r.Array(uc)}),IL=d({description:"Retrieves one log route by ID.",operationId:"getRoute",tags:["routes"],url:`${pc}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to retrieve. Use the `id` returned by route list or create responses."})}),response:uc}),Rh=r.Pick(cc,["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(Rh,{examples:[TL,EL]});var SL=d({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:pc,method:"POST",body:Rh,response:uc}),bL=d({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:`${pc}/:id`,method:"PUT",body:Rh,params:r.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:uc}),OL=d({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:`${pc}/:id`,method:"DELETE",params:r.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:v});var lc=`/${"v1"}/monitors`,mc=r.Pick(rn,["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)."}),xL={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:[]},RL={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:[]},CL={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:[]},PL={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",services:["api-gateway"]}},priority:2,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},K6={id:"123-456-abc",...xL},z6={id:"234-567-bcd",...RL},Y6={id:"345-678-cde",...CL},V6={id:"456-789-def",...PL};Object.assign(mc,{examples:[K6,z6,Y6,V6]});var AL=r.Pick(Og,["filters","sort","limit","offset"]),UL=r.Object({...AL.properties,...qe,filters:AL.properties.filters},{description:"Monitor query request. Use filters, sorting, limit, and offset to page through visible monitors."}),Q6={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(UL,{examples:[Q6]});var wL=d({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:`${lc}/query`,method:"POST",paginated:!0,body:UL,response:r.Array(mc)}),vL=d({description:"Retrieves one monitor definition by ID.",operationId:"getMonitor",tags:["monitors"],url:`${lc}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1,description:"Monitor ID returned by monitor query, create, or update operations."})}),response:mc}),NL=["name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],LL=r.Pick(js,NL,{$id:"CreateMonitorRequest",description:"Monitor creation request. Provide ownership, data access, alert configuration, priority, tags, and optional dashboard or cluster scope."}),kL=r.Pick(js,NL,{$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."}),ML=xL,DL=RL,GL=CL,$L=PL;Object.assign(LL,{examples:[ML,DL,GL,$L]});Object.assign(kL,{examples:[ML,DL,GL,$L]});var FL=d({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:lc,method:"POST",body:LL,response:mc}),jL=d({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:`${lc}/:id`,method:"PUT",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the saved monitor to update. Use the `id` returned by monitor query or create responses."})}),body:kL,response:mc}),W6=r.Object({id:p({allowEmpty:!1,description:"Identifier of the saved monitor to delete. Use the `id` returned by monitor query, create, or update responses."})}),qL=d({description:"Deletes a monitor by ID. Deleting a monitor stops future evaluations and alert transitions for that monitor.",operationId:"deleteMonitor",tags:["monitors"],url:`${lc}/:id`,method:"DELETE",params:W6,response:v});var dc=`/${"v1"}/notification-integrations`,fc=r.Pick(Ks,["id","name","setting","tags"],{$id:"NotificationIntegration",description:"A reusable external destination that notification rules can send to. See [Integrations](/documentation/alert/notifications/index#integrations). Slack integrations are OAuth-based and are not readable, creatable, or editable through this API; connect Slack from the app."}),Z6={id:"456-def-abc",name:"Primary on-call",setting:{type:"pagerduty",integrationKeyLastChars:"ab12"},tags:[{key:"team",value:"platform"}]};Object.assign(fc,{examples:[Z6]});var BL=d({description:"Lists non-OAuth notification integrations visible to the authenticated operation key. Slack integrations do not appear here because they are OAuth-based. Pagination fields limit the returned page.",operationId:"listNotificationIntegrations",tags:["public","notification-integrations"],url:dc,method:"GET",paginated:!0,query:r.Object(qe),response:r.Array(fc)}),HL=d({description:"Retrieves one non-OAuth notification integration by ID.",operationId:"getNotificationIntegration",tags:["notification-integrations"],url:`${dc}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the notification integration to retrieve. Use the `id` returned by notification integration list or create responses."})}),response:fc}),KL=r.Pick(Pg,["name","setting","tags"],{description:"Notification integration create request containing the display name, destination setting, and tags. `setting.type` cannot be `slack`; add Slack integrations from the app instead."}),X6={name:"Primary on-call",setting:{type:"pagerduty",integrationKey:"abcdef1234567890ab12"},tags:[{key:"team",value:"platform"}]};Object.assign(KL,{examples:[X6]});var zL=d({description:"Creates a non-OAuth notification integration that notification rules can target as a destination.",operationId:"createNotificationIntegration",tags:["notification-integrations"],url:dc,method:"POST",body:KL,response:fc}),YL=r.Pick(Ug,["name","setting","tags"],{description:"Notification integration update request. Omitted optional fields keep their existing values."}),J6={name:"Primary on-call"};Object.assign(YL,{examples:[J6]});var VL=d({description:"Updates an existing non-OAuth notification integration by ID. The submitted `setting` is overwritten in full; omitted optional fields keep their existing values.",operationId:"updateNotificationIntegration",tags:["notification-integrations"],url:`${dc}/:id`,method:"PUT",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the notification integration to update. Use the `id` returned by notification integration list, get, or create responses."})}),body:YL,response:fc}),QL=d({description:"Deletes a non-OAuth notification integration by ID. Deletion is blocked while a notification rule still targets the integration; remove it from those rules first.",operationId:"deleteNotificationIntegration",tags:["notification-integrations"],url:`${dc}/:id`,method:"DELETE",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the notification integration to delete. Use the `id` returned by notification integration list, get, or create responses."})}),response:v});var gc=`/${"v1"}/notification-rules`,hc=r.Pick(Yi,["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)."}),WL={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}}}]},e5={id:"123-456-abc",...WL};Object.assign(hc,{examples:[e5]});var ZL=d({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:gc,method:"GET",paginated:!0,query:r.Object(qe),response:r.Array(hc)}),XL=d({description:"Retrieves one notification rule by ID.",operationId:"getNotificationRule",tags:["notification-rules"],url:`${gc}/:id`,method:"GET",params:r.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:hc}),Ch=r.Pick(Hs,["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."}),t5=WL;Object.assign(Ch,{examples:[t5]});var JL=d({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:gc,method:"POST",body:Ch,response:hc}),ek=d({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:`${gc}/:id`,method:"PUT",params:r.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:Ch,response:hc}),r5=r.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."})}),tk=d({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:`${gc}/:id`,method:"DELETE",params:r5,response:v});var ga=`${Ki}/silences`,rk=r.Union([r.Literal("monday"),r.Literal("tuesday"),r.Literal("wednesday"),r.Literal("thursday"),r.Literal("friday"),r.Literal("saturday"),r.Literal("sunday")]),n5=r.Partial(r.Record(rk,r.Array(r.Object({startTime:r.String({format:hd,description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:r.String({format:hd,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`."}),o5=r.Partial(r.Record(rk,r.Array(r.Object({startTime:r.String({description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:r.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`."}),Kl='IANA timezone identifier (e.g. "America/New_York"). Defaults to UTC if omitted.',nk="One-time silence schedule with specific start and end times",ok="Recurring weekly silence schedule",i5=R("type",[r.Object({type:r.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:r.String({format:yd,description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:r.String({format:yd,description:"Local end date and time for the one-time silence. It must be after `startTime` and in the future."}),timeZone:r.Optional(r.String({format:mo,description:Kl}))},{$id:"InputSilenceScheduleOneTime",description:nk}),r.Object({type:r.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:n5,timeZone:r.Optional(r.String({format:mo,description:Kl}))},{$id:"InputSilenceScheduleRecurring",description:ok})],{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."}),a5=R("type",[r.Object({type:r.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:r.String({description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:r.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:r.Optional(r.String({description:Kl}))},{$id:"OutputSilenceScheduleOneTime",description:nk}),r.Object({type:r.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:o5,timeZone:r.Optional(r.String({description:Kl}))},{$id:"OutputSilenceScheduleRecurring",description:ok})],{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."}),s5="monitor_id",ik=`Query on the alerting monitor tags and group-by dimensions, e.g. \`env:prod AND service:bridge\`. The monitor itself can be targeted with \`${s5}:<monitor id>\`.`,zl=r.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:De,isActive:r.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:i5,notificationRuleIds:Se(r.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:Se(p({type:"tags-query"}),{description:ik}),teamsFilter:Rg,prioritiesFilter:r.Array(r.Enum(Ct),{maxItems:Ct.length,description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.Enum(vo),{maxItems:vo.length,description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."})}),ha=r.Object({id:r.String({description:"Tsuga-generated notification silence ID assigned when the silence is created."}),name:r.String({description:"Display name of the silence"}),reason:r.String({description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:r.String({description:"Team ID that owns and manages the silence"}),tags:ve,isActive:r.Boolean({description:"Whether the silence suppresses matching notifications while its schedule is active. When false, the silence is kept but never suppresses anything."}),schedule:a5,notificationRuleIds:r.Optional(r.Array(r.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:r.Optional(r.String({description:ik})),teamsFilter:xg,prioritiesFilter:r.Array(r.Enum(Ct),{description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.Enum(vo),{description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."}),createdAt:S(),updatedAt:S(),creator:r.Optional(se),updater:r.Optional(se)}),iot=d({tags:["notification-silences"],url:ga,method:"GET",response:r.Array(ha)}),aot=d({tags:["notification-silences"],url:`${ga}/:id`,params:r.Object({id:p()}),method:"GET",response:ha}),sot=d({tags:["notification-silences"],url:ga,method:"POST",body:zl,response:ha}),cot=d({tags:["notification-silences"],url:`${ga}/:id`,method:"PUT",params:r.Object({id:p()}),body:zl,response:ha}),pot=d({tags:["notification-silences"],url:`${ga}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),uot=d({tags:["notification-silences"],url:`${ga}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(p())}),response:r.Object({})});var yc=`/${"v1"}/notification-silences`,Tc=r.Pick(ha,["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)."}),c5={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"]},p5={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(Tc,{examples:[c5,p5]});var ak=d({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:yc,method:"GET",response:r.Array(Tc)}),sk=d({description:"Retrieves one notification silence by ID.",operationId:"getNotificationSilence",tags:["notification-silences"],url:`${yc}/:id`,method:"GET",params:r.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:Tc}),Ph=r.Pick(zl,["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."}),u5={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"]},l5={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(Ph,{examples:[u5,l5]});var ck=d({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:yc,method:"POST",body:Ph,response:Tc}),pk=d({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:`${yc}/:id`,method:"PUT",params:r.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:Ph,response:Tc}),m5=r.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."})}),uk=d({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:`${yc}/:id`,method:"DELETE",params:m5,response:v});var d5={critical:3,important:2,normal:1},pe=e=>({label:e,weight:d5[e]}),f5={"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:pe("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:pe("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:pe("important"),recommendation:"Ensure every team manages a dedicated route scoped to its context.team value."},"no-team-override-mismatch":{key:"no-team-override-mismatch",title:`${Yd} matches ${Pu}`,summary:`Detects logs and spans whose ${Yd} resource attribute names a different team than the ${Pu} resolved at ingestion.`,rationale:`${Pu} is reserved and comes from the ingestion API key, so a \`team\` resource attribute never reassigns ownership. A disagreement means the sender expects an ownership Tsuga did not apply.`,objectType:"resource",category:"telemetry-hygiene",impact:pe("important"),recommendation:"Drop the `team` resource attribute, or set the ingestion API key team override fields to read ownership from a differently named attribute."},"service-name-present":{key:"service-name-present",title:`${Uu} present`,summary:`Logs and spans must populate ${Uu} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:pe("critical"),recommendation:`Populate ${Uu} 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:pe("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:pe("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:`${Is} presence`,summary:`Logs and spans must populate ${Is} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:pe("important"),recommendation:`Populate ${Is} 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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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:pe("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 ${pR} 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:pe("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"}},lk={"postgresql-server-metrics-collected":{label:"PostgreSQL",systemValues:["postgresql"],metricPrefixes:["postgresql.","pg_"],receiver:"postgresqlreceiver"},"mysql-server-metrics-collected":{label:"MySQL",systemValues:["mysql","mariadb"],metricPrefixes:["mysql.","mysql_"],receiver:"mysqlreceiver"},"mongodb-server-metrics-collected":{label:"MongoDB",systemValues:["mongodb"],metricPrefixes:["mongodb.","mongodbatlas.","mongodb_"],receiver:"mongodbreceiver"},"redis-server-metrics-collected":{label:"Redis",systemValues:["redis"],metricPrefixes:["redis.","redis_"],receiver:"redisreceiver"},"memcached-server-metrics-collected":{label:"Memcached",systemValues:["memcached"],metricPrefixes:["memcached.","memcached_"],receiver:"memcachedreceiver"},"couchdb-server-metrics-collected":{label:"CouchDB",systemValues:["couchdb"],metricPrefixes:["couchdb.","couchdb_"],receiver:"couchdbreceiver"},"elasticsearch-server-metrics-collected":{label:"Elasticsearch",systemValues:["elasticsearch"],metricPrefixes:["elasticsearch.","elasticsearch_"],receiver:"elasticsearchreceiver"},"oracledb-server-metrics-collected":{label:"Oracle DB",systemValues:["oracle.db","oracle"],metricPrefixes:["oracledb.","oracledb_"],receiver:"oracledbreceiver"},"sqlserver-server-metrics-collected":{label:"Microsoft SQL Server",systemValues:["microsoft.sql_server","mssql"],metricPrefixes:["sqlserver.","mssql_"],receiver:"sqlserverreceiver"},"saphana-server-metrics-collected":{label:"SAP HANA",systemValues:["sap.hana","hanadb"],metricPrefixes:["saphana."],receiver:"saphanareceiver"},"cassandra-server-metrics-collected":{label:"Cassandra",systemValues:["cassandra"],metricPrefixes:["cassandra.","cassandra_"]},"clickhouse-server-metrics-collected":{label:"ClickHouse",systemValues:["clickhouse"],metricPrefixes:["ClickHouse"]},"couchbase-server-metrics-collected":{label:"Couchbase",systemValues:["couchbase"],metricPrefixes:["couchbase_"]},"neo4j-server-metrics-collected":{label:"Neo4j",systemValues:["neo4j"],metricPrefixes:["neo4j_"]},"opensearch-server-metrics-collected":{label:"OpenSearch",systemValues:["opensearch"],metricPrefixes:["opensearch_"]},"db2-server-metrics-collected":{label:"IBM Db2",systemValues:["ibm.db2","db2"],metricPrefixes:["ibm_db2_"]}},g5=Object.fromEntries(Object.keys(lk).map(e=>{let{label:t,receiver:n}=lk[e];return[e,{key:e,title:`${t} server metrics collected`,summary:`${t} seen in client spans should have its server metrics collected.`,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:pe("important"),recommendation:n?`Configure the ${n} OpenTelemetry receiver so ${t} server metrics are collected.`:`Collect ${t} server metrics, for example via its Prometheus exporter.`,scope:"global"}]})),h5=new Set(["azure_container_registry","azure_container_registry_image","azure_app_service_certificate","azure_virtual_network"]),y5=nc.filter(e=>e.startsWith("azure_")&&!h5.has(e)),mk={"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:y5,metricPrefixes:["azure_"]}},T5=Object.fromEntries(Object.keys(mk).map(e=>{let{label:t,source:n}=mk[e];return[e,{key:e,title:`${t} metrics collected`,summary:`${t} 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:pe("important"),recommendation:`Enable the ${n} metrics integration so ${t} metrics are ingested.`,scope:"global"}]})),E5={...f5,...g5,...T5},dk=Object.values(E5);var fk=["passed","failed","ignored"],_5=10,I5=r.Enum(fk,{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."}),S5=["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"],b5=["postgresql-server-metrics-collected","mysql-server-metrics-collected","mongodb-server-metrics-collected","redis-server-metrics-collected","memcached-server-metrics-collected","couchdb-server-metrics-collected","elasticsearch-server-metrics-collected","oracledb-server-metrics-collected","sqlserver-server-metrics-collected","saphana-server-metrics-collected","cassandra-server-metrics-collected","clickhouse-server-metrics-collected","couchbase-server-metrics-collected","neo4j-server-metrics-collected","opensearch-server-metrics-collected","db2-server-metrics-collected"],wh=["unrouted-logs","no-over-routed-logs","team-has-route","no-team-override-mismatch","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",...b5,...S5],O5=r.Enum(wh),A5=["log","metric","resource","span","api-key","dashboard","monitor","route"],x5=["collection-coverage","telemetry-hygiene","observability-assets","telemetry-adoption"],R5=["critical","important","normal"],C5=["team","global"],vh=r.Object({key:r.Enum(wh),title:r.String(),summary:r.String(),rationale:r.String(),objectType:r.Enum(A5),category:r.Enum(x5),impact:r.Object({label:r.Enum(R5),weight:r.Number()}),recommendation:r.String(),scope:r.Optional(r.Enum(C5))}),Ec=r.Object({type:r.String({description:"Tsuga asset or telemetry kind referenced by this example. Set by the rule evaluator from the failing object, record, or lookup result; examples include `monitor`, `dashboard`, `metric`, `log`, and `api-key`."}),label:r.String({description:"Human-readable summary of the example. Set by the rule evaluator from the asset name, telemetry identifier, or lookup result so clients can display the example without following the link."}),link:r.Object({to:r.String({description:"In-app route that opens the example in Tsuga. Set by the rule evaluator when the example has a product surface for inspection."}),search:r.Optional(r.Unknown({description:"Route search payload for the in-app link. Set when the destination needs query-string state such as a search query, time range, or table filter."})),params:r.Optional(r.Unknown({description:"Route params for the in-app link. Set when the destination route needs path parameters such as an asset identifier."}))},{description:"In-app deep link for inspecting the example. Returned when Tsuga can route from the quality-report row to a relevant product page."})}),Uh=r.Intersect([vh,r.Object({id:r.Optional(r.String()),status:I5,normalizedScore:r.Number(),details:r.Optional(r.Record(r.String(),r.Unknown())),recommendation:r.Optional(r.String()),examples:r.Optional(r.Array(Ec)),exampleCount:r.Optional(r.Integer())})]),P5=r.Object({generatedAt:r.String(),overallScore:r.Optional(r.Number()),rules:r.Array(vh),teamResults:r.Array(r.Object({teamId:r.String(),teamName:r.String(),teamWeight:r.Number(),score:r.Number(),weightedScore:r.Number(),totalWeight:r.Number(),ruleResults:r.Array(Uh)})),globalResults:r.Optional(r.Object({score:r.Optional(r.Number()),ruleResults:r.Array(Uh)}))}),Nh=r.Object({id:r.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:r.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:r.Enum(wh,{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:r.Optional(r.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:r.Enum(fk,{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:r.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:r.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:r.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:r.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:r.Optional(r.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:r.Optional(r.Array(Ec,{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. Truncated to the first ${_5}; compare against exampleCount to detect truncation.`})),exampleCount:r.Optional(r.Integer({description:"Total number of examples persisted for this row, before the preview truncation applied to examples. Returned whenever examples are visible to the caller."})),createdAt:r.String({description:"ISO timestamp the row was generated at"})}),xot=d({tags:["quality-reports"],url:"/v0/quality-reports",method:"POST",response:P5}),Lh=r.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."})),Rot=d({tags:["quality-reports"],url:"/v0/quality-reports/latest",method:"GET",query:r.Object({clusterId:Lh,team:r.Optional(p({allowEmpty:!1}))}),response:r.Array(Nh,{description:"Latest persisted rule evaluation rows for the cluster"})}),Cot=d({tags:["quality-reports"],url:"/v0/quality-reports/:id/examples",method:"GET",params:r.Object({id:p({allowEmpty:!1})}),response:r.Object({examples:r.Array(Ec)})}),Pot=d({tags:["quality-reports"],url:"/v0/quality-reports/preview",method:"POST",body:r.Object({ruleKey:O5,teamId:r.Optional(p({allowEmpty:!1})),lookbackMinutes:r.Optional(r.Integer({minimum:1,maximum:60})),clusterId:r.Optional(p({allowEmpty:!1}))}),response:r.Object({rule:vh,result:Uh,teamId:r.Optional(r.String()),teamName:r.Optional(r.String())})}),Uot=new Map(dk.map(e=>[e.key,e]));var gk=`/${"v1"}/quality-reports`,hk=r.Pick(Nh,["id","reportId","ruleId","owner","status","score","weight","reportOverallScore","reportTotalWeight","recommendation","examples","exampleCount","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)."}),U5={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(hk,{examples:[U5]});var w5=r.Object({clusterId:Lh,team:r.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."}),yk=d({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:`${gk}/latest`,method:"GET",query:w5,response:r.Array(hk)}),Dot=d({description:"Retrieves every example stored for one quality-report row. The latest-report endpoint returns only a preview of each row's examples, so use this to page past that preview when exampleCount exceeds the number of examples returned there.",operationId:"getQualityReportExamples",tags:["quality-reports"],url:`${gk}/:id/examples`,method:"GET",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the quality-report row whose examples are returned. Use the id from the latest-report endpoint. Unknown ids, rows the caller cannot access, and cluster-wide rows requested by a non-admin all return RESOURCE_NOT_FOUND."})}),response:r.Object({examples:r.Array(Ec,{description:"Every example stored for this row, untruncated. Empty when the rule evaluation produced none."})},{description:"All examples stored for one quality-report row."})});var _c="/v0/admin-center";var jr=`${_c}/retention-policies`,Tk=3650,v5=r.Integer({description:"Number of days Tsuga retains matching telemetry."}),Ek=r.Integer({minimum:1,maximum:Tk,description:`Number of days Tsuga should retain matching telemetry. Valid values are 1 through ${Tk}.`}),an=r.Object({id:r.String({description:"Unique identifier of the retention policy. Generated by Tsuga."}),env:r.Optional(r.String({description:"Environment tag value this policy applies to. Omitted policies apply across environments unless a more specific policy exists."})),teamId:r.Optional(r.String({description:"Team ID this policy applies to. Omitted policies apply globally unless a team-specific policy exists."})),dataSource:r.Enum(vr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:v5,isEnabled:r.Boolean({description:"Whether this policy participates in retention resolution."}),createdAt:S({description:"Timestamp when Tsuga created the retention policy."}),updatedAt:S({description:"Timestamp when Tsuga last updated the retention policy."})}),Yl=r.Object({env:Se(p(),{description:"Environment tag value this policy applies to. Omit for a policy that is not environment-specific."}),teamId:Se(p(),{description:"Team ID this policy applies to. Omit for a policy that is not team-specific."}),dataSource:r.Enum(vr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:Ek,isEnabled:r.Boolean({description:"Set to true for the policy to participate in retention resolution."})}),_k=r.Array(r.Object({env:p(),dataSource:r.Enum(vr),durationDays:r.Union([Ek,r.Null()]),isEnabled:r.Boolean()})),Ik=r.Object({inserted:r.Array(an),updated:r.Array(an),deleted:r.Array(an)}),zot=d({tags:["retention-policies"],url:jr,method:"POST",body:Yl,response:an}),Yot=d({tags:["retention-policies"],url:jr,method:"GET",response:r.Array(an)}),Vot=d({tags:["retention-policies"],url:`${jr}/:id`,method:"GET",params:r.Object({id:p()}),response:an}),Qot=d({tags:["retention-policies"],url:`${jr}/:id`,method:"PUT",params:r.Object({id:p()}),body:Yl,response:an}),Wot=d({tags:["retention-policies"],url:`${jr}/bulk-update`,method:"POST",body:_k,response:Ik}),Zot=d({tags:["retention-policies"],url:`${jr}/bulk-update-for-team`,method:"POST",body:r.Object({teamId:p(),policies:_k}),response:Ik}),Xot=d({tags:["retention-policies"],url:`${jr}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),Ic=["past-24-hours","past-7-days","past-30-days"],Jot=d({tags:["retention-policies"],url:`${jr}/requested-history-percentile/:teamId`,method:"POST",params:r.Object({teamId:p()}),body:r.Object({percentile:r.Number({minimum:0,maximum:1}),observationWindow:r.Enum(Ic),dataSource:r.Enum(vr)}),response:r.Object({percentile:r.Number(),observationWindow:r.Enum(Ic),dataSource:r.Enum(vr),teamId:r.String(),requestedHistoryDays:r.Number()})}),N5=["1-day","3-days","7-days","1-month","6-months","more-than-6-months"];var L5=r.Array(r.Object({bucket:r.Enum(N5),count:r.Number()})),eit=d({tags:["retention-policies"],url:`${jr}/requested-history-histogram/:teamId`,method:"POST",params:r.Object({teamId:p()}),body:r.Object({observationWindow:r.Enum(Ic),dataSource:r.Enum(vr)}),response:r.Object({observationWindow:r.Enum(Ic),dataSource:r.Enum(vr),teamId:r.String(),histogram:L5})}),tit=d({tags:["retention-policies"],url:`${jr}/top-teams-with-retention-surplus`,method:"POST",body:r.Object({dataSource:r.Enum(vr),observationWindow:r.Enum(Ic),percentile:r.Number({minimum:0,maximum:1}),topN:r.Optional(r.Number({minimum:1,maximum:20}))}),response:r.Array(r.Object({teamId:r.String(),retentionSurplusDays:r.Number()}))});var Sc=`/${"v1"}/retention-policies`,bc=r.Pick(an,["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)."}),k5={id:"123-456-abc",env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(bc,{examples:[k5]});var Sk=d({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:Sc,method:"GET",response:r.Array(bc)}),bk=d({description:"Retrieves one retention policy by ID.",operationId:"getRetentionPolicy",tags:["retention-policies"],url:`${Sc}/:id`,method:"GET",params:r.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:bc}),kh=r.Pick(Yl,["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."}),M5={env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(kh,{examples:[M5]});var Ok=d({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:Sc,method:"POST",body:kh,response:bc}),Ak=d({description:"Replaces an existing retention policy by ID, including signal, scope fields, duration, and enabled state.",operationId:"updateRetentionPolicy",tags:["retention-policies"],url:`${Sc}/:id`,method:"PUT",params:r.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:kh,response:bc}),xk=d({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:`${Sc}/:id`,method:"DELETE",params:r.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:v});var Oc=`/${"v1"}/slos`,D5=r.Pick(Lg,["id","sloId","priority","configuration"],{$id:"SloAlert",description:"Alert attached to an SLO, triggered on a burn-rate multiplier or an SLO target threshold"}),Ac=r.Object({...r.Pick(Qi,["id","name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds"]).properties,alerts:r.Array(D5,{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"}),G5={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(Ac,{examples:[G5]});var Rk=r.Pick(Dg,["filters","sort","limit","offset"]),Ck=r.Object({...Rk.properties,...qe,filters:Rk.properties.filters},{description:"SLO query request. Use filters, sorting, limit, and offset to page through visible SLOs."}),$5={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(Ck,{examples:[$5]});var Pk=d({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:`${Oc}/query`,method:"POST",paginated:!0,body:Ck,response:r.Array(Ac)}),Uk=d({description:"Retrieves one SLO definition by ID.",operationId:"getSlo",tags:["slos"],url:`${Oc}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1,description:"SLO ID returned by SLO query, create, or update operations."})}),response:Ac}),wk=["name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds","alerts"],vk=r.Pick(_l,wk,{$id:"CreateSloRequest",description:"SLO creation request. Provide ownership, data access, SLI configuration, target, timeframe, optional cluster scope, and the alerts to create."}),Nk=r.Pick(kg,wk,{$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."}),Lk={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(vk,{examples:[Lk]});Object.assign(Nk,{examples:[Lk]});var kk=d({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:Oc,method:"POST",body:vk,response:Ac}),Mk=d({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:`${Oc}/:id`,method:"PUT",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the SLO to update. Use the `id` returned by SLO query or create."})}),body:Nk,response:Ac}),Dk=d({description:"Deletes an SLO by ID. Deleting an SLO stops future evaluations and removes its attached alerts.",operationId:"deleteSlo",tags:["slos"],url:`${Oc}/:id`,method:"DELETE",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the SLO to delete. Use the `id` returned by SLO query or create."})}),response:v});var $o=`${_c}/tag-policies`;var F5=["logs","metrics","traces"],Mh=r.Array(r.Enum(F5,{description:"Telemetry signal covered by a data tag policy."}),{description:"Telemetry signals covered by the policy. An empty array means logs, metrics, and traces."}),j5=r.Union([au,Mh]),q5=r.Object({teamIds:r.Array(r.String(),{description:"Team IDs used by this policy scope."}),mode:r.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."}),B5=R("type",[r.Object({type:r.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:Mh,shouldInsertWarning:r.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:r.Optional(r.Number({description:"Percentage of non-compliant telemetry datapoints to drop. Omitted means no sampling drop is configured."}))},{title:"TelemetryTagPolicy"}),r.Object({type:r.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:au},{title:"TsugaAssetTagPolicy"})]),H5=R("type",[r.Object({type:r.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:Mh,shouldInsertWarning:r.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:r.Optional(r.Number({minimum:0,maximum:100,description:"Percentage of non-compliant telemetry datapoints to drop. Valid values are 0 through 100."}))},{title:"TelemetryTagPolicy"}),r.Object({type:r.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:au},{title:"TsugaAssetTagPolicy"})]),Gk="Policy surface and enforcement behavior. Use `telemetry` for telemetry data or `tsuga_asset` for Tsuga-managed resources.",K5=r.Unsafe({...B5,description:Gk}),z5=r.Unsafe({...H5,description:Gk}),ya=r.Object({id:r.String({description:"Tsuga-generated tag policy ID assigned when the policy is created."}),name:r.String({description:"Human-readable tag policy name."}),description:r.Optional(r.String({description:"Optional user-provided policy description."})),isActive:r.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:r.String({description:"Tag key enforced by this policy."}),allowedTagValues:r.Array(r.String(),{description:"Allowed values for `tagKey`. An empty array means any value is accepted when the tag exists."}),isRequired:r.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:r.Optional(q5),configuration:K5,creator:r.Optional(se),updater:r.Optional(se),owner:r.Optional(r.String({description:"Team ID that owns and manages the policy."})),createdAt:S({description:"Timestamp when Tsuga created the tag policy."}),updatedAt:S({description:"Timestamp when Tsuga last updated the tag policy."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})});var xc=r.Object({name:p({description:"Human-readable tag policy name."}),description:Se(p(),{description:"Optional policy description."}),isActive:r.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:r.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:r.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:r.Optional(r.Object({teamIds:r.Array(p(),{minItems:1,maxItems:100,description:"Team IDs used by this policy scope."}),mode:r.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:z5,owner:p({allowEmpty:!1,description:"Team ID that will own and manage the policy."})}),Oit=d({tags:["tag-policies"],url:$o,method:"GET",query:r.Object({teamIds:r.Optional(r.Array(p(),{maxItems:100})),assetTypes:r.Optional(j5),searchQuery:r.Optional(p())}),response:r.Array(ya)}),Ait=d({tags:["tag-policies"],url:`${$o}/:id`,method:"GET",params:r.Object({id:p()}),response:ya}),xit=d({tags:["tag-policies"],url:$o,method:"POST",body:xc,response:ya}),Rit=d({tags:["tag-policies"],url:`${$o}/:id`,method:"PUT",params:r.Object({id:p()}),body:xc,response:ya}),Cit=d({tags:["tag-policies"],url:`${$o}/:id`,method:"DELETE",params:r.Object({id:p()}),response:v}),Pit=d({tags:["tag-policies"],url:`${_c}/applicable-tag-rules`,method:"GET",query:r.Object({assetType:r.Enum(as),teamId:p()}),response:r.Array(r.Object({tagKey:r.String(),allowedTagValues:r.Array(r.String()),isRequired:r.Boolean(),tagPolicyId:r.String()}))}),$k=r.Object({total:r.Number(),totalNonCompliant:r.Number(),idsNonCompliant:r.Array(r.String())}),Fk=r.Union([r.Literal("ingestion-api-key"),r.Literal("operation-api-key"),r.Literal("rum-public-token"),r.Literal("dashboard"),r.Literal("log-route"),r.Literal("metric-route"),r.Literal("monitor"),r.Literal("notification-rule"),r.Literal("notification-silence"),r.Literal("slo")]),Y5=r.Object({total:r.Number(),totalNonCompliant:r.Number(),byAssetType:r.Record(Fk,$k)}),V5=r.Omit($k,["total"]),Q5=r.Object({totalNonCompliant:r.Number(),byAssetType:r.Record(Fk,V5)}),jk=r.Object({totals:Y5,byTeam:r.Record(r.String(),Q5)}),Uit=d({tags:["tag-policies"],url:`${$o}/:id/stats`,method:"GET",params:r.Object({id:p()}),response:jk}),wit=d({tags:["tag-policies"],url:`${$o}/new-policy-stats`,method:"POST",body:xc,response:jk});var Rc=`/${"v1"}/tag-policies`,qk={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"},Bk={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"},W5={id:"123-456-abc",...qk},Z5={id:"456-789-def",...Bk},Cc=r.Pick(ya,["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)."}),X5=W5,J5=Z5;Object.assign(Cc,{examples:[X5,J5]});var Dh=r.Pick(xc,["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."}),eQ=qk,tQ=Bk;Object.assign(Dh,{examples:[eQ,tQ]});var Hk=d({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:Rc,method:"GET",response:r.Array(Cc)}),Kk=d({description:"Retrieves one tag policy by ID.",operationId:"getTagPolicy",tags:["tag-policies"],url:`${Rc}/:id`,method:"GET",params:r.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:Cc}),zk=d({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:Rc,method:"POST",body:Dh,response:Cc}),Yk=d({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:`${Rc}/:id`,method:"PUT",params:r.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:Dh,response:Cc}),Vk=d({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:`${Rc}/:id`,method:"DELETE",params:r.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:v});var Pc=`/${"v1"}/teams`,Uc=r.Pick(bn,["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)."}),rQ={id:"team-123-abc",name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(Uc,{examples:[rQ]});var Qk=d({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:Pc,method:"GET",paginated:!0,query:r.Object(qe),response:r.Array(Uc)}),Wk=d({description:"Retrieves one team by ID.",operationId:"getTeam",tags:["teams"],url:`${Pc}/:id`,method:"GET",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the team to retrieve. Use the `id` returned by team list or create responses."})}),response:Uc}),Gh=r.Pick(yu,["name","description","visibility","tags"],{description:"Team create or update request. Provide the team name, optional description, visibility, and tags."}),nQ={name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(Gh,{examples:[nQ]});var Zk=d({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:Pc,method:"POST",body:Gh,response:Uc}),Xk=d({description:"Replaces a team definition by ID, including name, description, visibility, and tags.",operationId:"updateTeam",tags:["teams"],url:`${Pc}/:id`,method:"PUT",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the team to update. Use the `id` returned by team list, get, or create responses."})}),body:Gh,response:Uc}),Jk=d({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:`${Pc}/:id`,method:"DELETE",params:r.Object({id:p({allowEmpty:!1,description:"Identifier of the team to delete. Use the `id` returned by team list, create, or update responses."})}),response:v});function oQ(e){return/^[aeiou]/i.test(e)||e==="SLO"?"an":"a"}function eM(e,t){let n=Number(t);if(Number.isNaN(n))throw new Error(`--${e} must be a number (got: ${t})`);return n}function tM(e){let t={};return e.limit!==void 0&&(t.limit=eM("limit",e.limit)),e.offset!==void 0&&(t.offset=eM("offset",e.offset)),t}function $h(e){let t=e.params;if(t?.properties){let n=Object.keys(t.properties);if(n.length===1&&n[0])return n[0]}return"id"}function rM(e,t,n){let o=e.command(t.commandName).description(t.description),i=t.singularOverride??GR(t.commandName).replace(/-/g," "),a=t.pluralOverride??t.commandName.replace(/-/g," "),c=oQ(i),l=o.command("list").description(t.listDescription??`List all ${a}`);if(t.listOptions)for(let m of t.listOptions)l.option(m.flag,m.description);if(t.endpoints.list.paginated===!0&&l.option("--limit <n>",`Maximum number of items to return, up to ${yi} (default: ${ou})`).option("--offset <n>","Number of items to skip, to request a later page"),t.enableListBody?l.option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async m=>{if(m.generateSkeleton){Q(qi(t.endpoints.list));return}let f=m.data?Pi({data:m.data}):{},h=await n()(t.endpoints.list,{body:{...f,...tM(m)}});Q(h)}):l.action(async m=>{let f=tM(m);if(t.listOptions)for(let E of t.listOptions){let I=m[E.queryParam];I!==void 0&&(f[E.queryParam]=I)}let h=await n()(t.endpoints.list,Object.keys(f).length>0?{query:f}:void 0);Q(h)}),t.endpoints.get){let m=t.endpoints.get,f=$h(m);o.command("get <ID>").description(`Get ${c} ${i} by ID`).action(async h=>{let E=await n()(m,{params:{[f]:h}});Q(E)})}if(t.endpoints.create){let m=t.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(qi(m));return}let h=Pi(f),E=await n()(m,{body:h});Q(E)})}if(t.endpoints.update){let m=t.endpoints.update,f=$h(m);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(h,E)=>{if(E.generateSkeleton){Q(qi(m));return}let I=Pi(E),g=await n()(m,{params:{[f]:h},body:I});Q(g)})}if(t.endpoints.delete){let m=t.endpoints.delete,f=$h(m);o.command("delete <ID>").description(`Delete ${c} ${i} by ID`).action(async h=>{let E=await n()(m,{params:{[f]:h}});Q(E)})}}var iQ=[{commandName:"cloud-resources",description:"List cloud resources discovered by inventory scans",endpoints:{list:tL},enableListBody:!0},{commandName:"dashboard-folders",description:"Manage dashboard folders",endpoints:{list:sN,get:cN,create:pN,update:uN,delete:lN},enableListBody:!0},{commandName:"dashboards",description:"Manage dashboards",endpoints:{list:NN,get:LN,create:kN,update:MN,delete:DN},enableListBody:!0},{commandName:"ingestion-api-keys",description:"Manage ingestion API keys",singularOverride:"ingestion API key",pluralOverride:"ingestion API keys",endpoints:{list:HN,create:KN,update:zN,delete:YN}},{commandName:"investigations",description:"Manage investigations (beta)",endpoints:{list:nL,get:oL,create:iL,update:aL,delete:sL}},{commandName:"monitors",description:"Manage monitors",endpoints:{list:wL,get:vL,create:FL,update:jL,delete:qL},enableListBody:!0},{commandName:"notification-rules",description:"Manage notification rules",endpoints:{list:ZL,get:XL,create:JL,update:ek,delete:tk}},{commandName:"notification-silences",description:"Manage notification silences",endpoints:{list:ak,get:sk,create:ck,update:pk,delete:uk}},{commandName:"notification-integrations",description:"Manage notification integrations",endpoints:{list:BL,get:HL,create:zL,update:VL,delete:QL}},{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:yk},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:Sk,get:bk,create:Ok,update:Ak,delete:xk}},{commandName:"log-routes",description:"Manage log routes",endpoints:{list:_L,get:IL,create:SL,update:bL,delete:OL}},{commandName:"services",description:"List and inspect services (read-only; services are inferred from telemetry)",endpoints:{list:cv,get:pv}},{commandName:"slos",description:"Manage SLOs",singularOverride:"SLO",pluralOverride:"SLOs",endpoints:{list:Pk,get:Uk,create:kk,update:Mk,delete:Dk},enableListBody:!0},{commandName:"tag-policies",description:"Manage tag policies",endpoints:{list:Hk,get:Kk,create:zk,update:Yk,delete:Vk}},{commandName:"teams",description:"Manage teams",endpoints:{list:Qk,get:Wk,create:Zk,update:Xk,delete:Jk}}];function nM(e,t){for(let n of iQ)rM(e,n,t)}var oM=require("node:child_process");var Vl="@tsuga/cli@latest";function aQ(){z(`Updating ${Vl}`),z(` $ npm install -g ${Vl}`);try{(0,oM.execFileSync)("npm",["install","-g",Vl],{stdio:["ignore","inherit","inherit"]})}catch(e){let t=e.status??1;throw new Error(`npm install -g ${Vl} exited ${t}`,{cause:e})}z("Updated. Run `tsuga --version` to confirm the new version.")}function iM(e){e.command("self-update").description("Update the Tsuga CLI to the latest version via npm").action(()=>{aQ()})}var zh=require("node:fs"),Kh=require("node:os"),Ea=require("node:path");var sQ=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,wc=class e extends Date{#t=!1;#r=!1;#e=null;constructor(t){let n=!0,o=!0,i="Z";if(typeof t=="string"){let a=t.match(sQ);a?(a[1]||(n=!1,t=`0000-01-01T${t}`),o=!!a[2],o&&t[10]===" "&&(t=t.replace(" ","T")),a[2]&&+a[2]>23?t="":(i=a[3]||null,t=t.toUpperCase(),!i&&o&&(t+="Z"))):t=""}super(t),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 t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z")return t;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(t,n="Z"){let o=new e(t);return o.#e=n,o}static wrapAsLocalDateTime(t){let n=new e(t);return n.#e=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#r=!1,n.#e=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#t=!1,n.#e=null,n}};function cQ(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function pQ(e,t,n){let o=e.split(/\r\n|\n|\r/g),i="",a=(Math.log10(t+1)|0)+1;for(let c=t-1;c<=t+1;c++){let l=o[c-1];l&&(i+=c.toString().padEnd(a," "),i+=": ",i+=l,i+=`
146
146
  `,c===t&&(i+=" ".repeat(a+n+2),i+=`^
147
- `))}return i}var J=class extends Error{line;column;codeblock;constructor(t,n){let[o,i]=X5(n.toml,n.ptr),a=J5(n.toml,o,i);super(`Invalid TOML document: ${t}
147
+ `))}return i}var J=class extends Error{line;column;codeblock;constructor(t,n){let[o,i]=cQ(n.toml,n.ptr),a=pQ(n.toml,o,i);super(`Invalid TOML document: ${t}
148
148
 
149
- ${a}`,n),this.line=o,this.column=i,this.codeblock=a}};var eQ=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,tQ=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,rQ=/^[+-]?0[0-9_]/;function Yl(e,t){let n=e[t++],o=n,i=n==="'",a=n===e[t]&&n===e[t+1];a&&(e[t+=2]===`
149
+ ${a}`,n),this.line=o,this.column=i,this.codeblock=a}};var uQ=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,lQ=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,mQ=/^[+-]?0[0-9_]/;function Ql(e,t){let n=e[t++],o=n,i=n==="'",a=n===e[t]&&n===e[t+1];a&&(e[t+=2]===`
150
150
  `?t++:e[t]==="\r"&&e[t+1]===`
151
151
  `&&(t+=2));let c="",l=t,m=0;for(let f=t;f<e.length;f++)if(n=e[f],a&&(n===`
152
152
  `||n==="\r"&&e[f+1]===`
153
153
  `))m=m&&3;else{if(n<" "&&n!==" "||n==="\x7F")throw new J("control characters are not allowed in strings",{toml:e,ptr:f});if((!m||m===3)&&n===o&&(!a||e[f+1]===o&&e[f+2]===o))return a&&(e[f+3]===o&&f++,e[f+3]===o&&f++),[m?c:c+e.slice(l,f),f+(a?3:1)];if(!m)!i&&n==="\\"&&(c+=e.slice(l,l=f),m=1);else if(m===1)if(n==="x"||n==="u"||n==="U"){let h=0,E=n==="x"?2:n==="u"?4:8;for(let I=0;I<E;I++,f++){let g=e.charCodeAt(f+1),T=g>=48&&g<=57?g-48:g>=65&&g<=70?g-65+10:g>=97&&g<=102?g-97+10:-1;if(T<0)throw new J("invalid non-hex character in unicode escape",{toml:e,ptr:f+1});h=h<<4|T}if(h<0||h>1114111||h>=55296&&h<=57343)throw new J("invalid unicode escape",{toml:e,ptr:f});c+=String.fromCodePoint(h),l=f+1,m=0}else if(n===" "||n===" ")m=2;else{if(n==="b")c+="\b";else if(n==="t")c+=" ";else if(n==="n")c+=`
154
- `;else if(n==="f")c+="\f";else if(n==="r")c+="\r";else if(n==="e")c+="\x1B";else if(n==='"')c+='"';else if(n==="\\")c+="\\";else throw new J("unrecognized escape sequence",{toml:e,ptr:f});l=f+1,m=0}else if(n!==" "&&n!==" "){if(m===2)throw new J("invalid escape: only line-ending whitespace may be escaped",{toml:e,ptr:l});m=!i&&n==="\\"?1:0,l=f}}throw new J("unfinished string",{toml:e,ptr:t})}function oM(e,t,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=eQ.test(e);if(i||tQ.test(e)){if(rQ.test(e))throw new J("leading zeroes are not allowed",{toml:t,ptr:n});e=e.replace(/_/g,"");let c=+e;if(isNaN(c))throw new J("invalid number",{toml:t,ptr:n});if(i){if((i=!Number.isSafeInteger(c))&&!o)throw new J("integer value cannot be represented losslessly",{toml:t,ptr:n});(i||o===!0)&&(c=BigInt(e))}return c}let a=new Uc(e);if(!a.isValid())throw new J("invalid value",{toml:t,ptr:n});return a}function Vl(e,t=0,n=e.length){let o=e.indexOf(`
155
- `,t);return e[o-1]==="\r"&&o--,o<=n?o:-1}function ha(e,t){for(let n=t;n<e.length;n++){let o=e[n];if(o===`
154
+ `;else if(n==="f")c+="\f";else if(n==="r")c+="\r";else if(n==="e")c+="\x1B";else if(n==='"')c+='"';else if(n==="\\")c+="\\";else throw new J("unrecognized escape sequence",{toml:e,ptr:f});l=f+1,m=0}else if(n!==" "&&n!==" "){if(m===2)throw new J("invalid escape: only line-ending whitespace may be escaped",{toml:e,ptr:l});m=!i&&n==="\\"?1:0,l=f}}throw new J("unfinished string",{toml:e,ptr:t})}function aM(e,t,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=uQ.test(e);if(i||lQ.test(e)){if(mQ.test(e))throw new J("leading zeroes are not allowed",{toml:t,ptr:n});e=e.replace(/_/g,"");let c=+e;if(isNaN(c))throw new J("invalid number",{toml:t,ptr:n});if(i){if((i=!Number.isSafeInteger(c))&&!o)throw new J("integer value cannot be represented losslessly",{toml:t,ptr:n});(i||o===!0)&&(c=BigInt(e))}return c}let a=new wc(e);if(!a.isValid())throw new J("invalid value",{toml:t,ptr:n});return a}function Wl(e,t=0,n=e.length){let o=e.indexOf(`
155
+ `,t);return e[o-1]==="\r"&&o--,o<=n?o:-1}function Ta(e,t){for(let n=t;n<e.length;n++){let o=e[n];if(o===`
156
156
  `)return n;if(o==="\r"&&e[n+1]===`
157
157
  `)return n+1;if(o<" "&&o!==" "||o==="\x7F")throw new J("control characters are not allowed in comments",{toml:e,ptr:t})}return e.length}function qr(e,t,n,o){let i;for(;;){for(;(i=e[t])===" "||i===" "||!n&&(i===`
158
158
  `||i==="\r"&&e[t+1]===`
159
- `);)t++;if(o||i!=="#")break;t=ha(e,t)}return t}function iM(e,t,n,o,i=!1){if(!o)return t=Vl(e,t),t<0?e.length:t;for(let a=t;a<e.length;a++){let c=e[a];if(c==="#"){if(a=Vl(e,a),a<0)break}else{if(c===n)return a+1;if(c===o||i&&(c===`
159
+ `);)t++;if(o||i!=="#")break;t=Ta(e,t)}return t}function sM(e,t,n,o,i=!1){if(!o)return t=Wl(e,t),t<0?e.length:t;for(let a=t;a<e.length;a++){let c=e[a];if(c==="#"){if(a=Wl(e,a),a<0)break}else{if(c===n)return a+1;if(c===o||i&&(c===`
160
160
  `||c==="\r"&&e[a+1]===`
161
- `))return a}}throw new J("cannot find end of structure",{toml:e,ptr:t})}function nQ(e,t,n){let o=e.slice(t,n),i=o.indexOf("#");return i>-1&&(ha(e,i),o=o.slice(0,i)),[o.trimEnd(),i]}function wc(e,t,n,o,i){if(o===0)throw new J("document contains excessively nested structures. aborting.",{toml:e,ptr:t});let a=e[t];if(a==="["||a==="{"){let[m,f]=a==="["?sM(e,t,o,i):aM(e,t,o,i);if(n){if(f=qr(e,f),e[f]===",")f++;else if(e[f]!==n)throw new J("expected comma or end of structure",{toml:e,ptr:f})}return[m,f]}if(a==='"'||a==="'"){let[m,f]=Yl(e,t);if(n){if(f=qr(e,f),e[f]&&e[f]!==","&&e[f]!==n&&e[f]!==`
162
- `&&e[f]!=="\r")throw new J("unexpected character encountered",{toml:e,ptr:f});e[f]===","&&f++}return[m,f]}let c=iM(e,t,",",n),l=nQ(e,t,c-(e[c-1]===","?1:0));if(!l[0])throw new J("incomplete key-value declaration: no value specified",{toml:e,ptr:t});return n&&l[1]>-1&&(c=qr(e,t+l[1]),e[c]===","&&c++),[oM(l[0],e,t,i),c]}var oQ=/^[a-zA-Z0-9-_]+[ \t]*$/;function Ql(e,t,n="="){let o=t-1,i=[],a=e.indexOf(n,t);if(a<0)throw new J("incomplete key-value: cannot find end of key",{toml:e,ptr:t});do{let c=e[t=++o];if(c!==" "&&c!==" ")if(c==='"'||c==="'"){if(c===e[t+1]&&c===e[t+2])throw new J("multiline strings are not allowed in keys",{toml:e,ptr:t});let[l,m]=Yl(e,t);o=e.indexOf(".",m);let f=e.slice(m,o<0||o>a?a:o),h=Vl(f);if(h>-1)throw new J("newlines are not allowed in keys",{toml:e,ptr:t+o+h});if(f.trimStart())throw new J("found extra tokens after the string part",{toml:e,ptr:m});if(a<m&&(a=e.indexOf(n,m),a<0))throw new J("incomplete key-value: cannot find end of key",{toml:e,ptr:t});i.push(l)}else{o=e.indexOf(".",t);let l=e.slice(t,o<0||o>a?a:o);if(!oQ.test(l))throw new J("only letter, numbers, dashes and underscores are allowed in keys",{toml:e,ptr:t});i.push(l.trimEnd())}}while(o+1&&o<a);return[i,qr(e,a+1,!0,!0)]}function aM(e,t,n,o){let i={},a=new Set,c;for(t++;(c=e[t++])!=="}"&&c;){if(c===",")throw new J("expected value, found comma",{toml:e,ptr:t-1});if(c==="#")t=ha(e,t);else if(c!==" "&&c!==" "&&c!==`
163
- `&&c!=="\r"){let l,m=i,f=!1,[h,E]=Ql(e,t-1);for(let T=0;T<h.length;T++){if(T&&(m=f?m[l]:m[l]={}),l=h[T],(f=Object.hasOwn(m,l))&&(typeof m[l]!="object"||a.has(m[l])))throw new J("trying to redefine an already defined value",{toml:e,ptr:t});!f&&l==="__proto__"&&Object.defineProperty(m,l,{enumerable:!0,configurable:!0,writable:!0})}if(f)throw new J("trying to redefine an already defined value",{toml:e,ptr:t});let[I,g]=wc(e,E,"}",n-1,o);a.add(I),m[l]=I,t=g}}if(!c)throw new J("unfinished table encountered",{toml:e,ptr:t});return[i,t]}function sM(e,t,n,o){let i=[],a;for(t++;(a=e[t++])!=="]"&&a;){if(a===",")throw new J("expected value, found comma",{toml:e,ptr:t-1});if(a==="#")t=ha(e,t);else if(a!==" "&&a!==" "&&a!==`
164
- `&&a!=="\r"){let c=wc(e,t-1,"]",n-1,o);i.push(c[0]),t=c[1]}}if(!a)throw new J("unfinished array encountered",{toml:e,ptr:t});return[i,t]}function cM(e,t,n,o){let i=t,a=n,c,l=!1,m;for(let f=0;f<e.length;f++){if(f){if(i=l?i[c]:i[c]={},a=(m=a[c]).c,o===0&&(m.t===1||m.t===2))return null;if(m.t===2){let h=i.length-1;i=i[h],a=a[h].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(m=a[c],m.t!==o&&!(o===1&&m.t===3)||(o===2&&(m.d||(m.d=!0,i[c]=[]),i[c].push(i={}),m.c[m.i++]=m={t:1,d:!1,i:0,c:{}}),m.d))return null;if(m.d=!0,o===1)i=l?i[c]:i[c]={};else if(o===0&&l)return null;return[c,i,m.c]}function Gh(e,{maxDepth:t=1e3,integersAsBigInt:n}={}){let o={},i={},a=o,c=i;for(let l=qr(e,0);l<e.length;){if(e[l]==="["){let m=e[++l]==="[",f=Ql(e,l+=+m,"]");if(m){if(e[f[1]-1]!=="]")throw new J("expected end of table declaration",{toml:e,ptr:f[1]-1});f[1]++}let h=cM(f[0],o,i,m?2:1);if(!h)throw new J("trying to redefine an already defined table or value",{toml:e,ptr:l});c=h[2],a=h[1],l=f[1]}else{let m=Ql(e,l),f=cM(m[0],a,c,0);if(!f)throw new J("trying to redefine an already defined table or value",{toml:e,ptr:l});let h=wc(e,m[1],void 0,t,n);f[1][f[0]]=h[0],l=h[1]}if(l=qr(e,l,!0),e[l]&&e[l]!==`
165
- `&&e[l]!=="\r")throw new J("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:l});l=qr(e,l)}return o}var pM=/^[a-z0-9-_]+$/i;function vc(e){let t=typeof e;if(t==="object"){if(Array.isArray(e))return"array";if(e instanceof Date)return"date"}return t}function iQ(e){for(let t=0;t<e.length;t++)if(vc(e[t])!=="object")return!1;return e.length!=0}function $h(e){return JSON.stringify(e).replace(/\x7f/g,"\\u007f")}function Fh(e,t,n,o){if(n===0)throw new Error("Could not stringify the object: maximum object depth exceeded");if(t==="number")return isNaN(e)?"nan":e===1/0?"inf":e===-1/0?"-inf":Number.isInteger(e)&&(o||!Number.isSafeInteger(e))?e.toFixed(1):e.toString();if(t==="bigint"||t==="boolean")return e.toString();if(t==="string")return $h(e);if(t==="date"){if(isNaN(e.getTime()))throw new TypeError("cannot serialize invalid date");return e.toISOString()}if(t==="object")return aQ(e,n,o);if(t==="array")return sQ(e,n,o)}function aQ(e,t,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+=pM.test(c)?c:$h(c),i+=" = ",i+=Fh(e[c],vc(e[c]),t-1,n)}return i+" }"}function sQ(e,t,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+=Fh(e[i],vc(e[i]),t-1,n)}return o+" ]"}function cQ(e,t,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
+ `))return a}}throw new J("cannot find end of structure",{toml:e,ptr:t})}function dQ(e,t,n){let o=e.slice(t,n),i=o.indexOf("#");return i>-1&&(Ta(e,i),o=o.slice(0,i)),[o.trimEnd(),i]}function vc(e,t,n,o,i){if(o===0)throw new J("document contains excessively nested structures. aborting.",{toml:e,ptr:t});let a=e[t];if(a==="["||a==="{"){let[m,f]=a==="["?pM(e,t,o,i):cM(e,t,o,i);if(n){if(f=qr(e,f),e[f]===",")f++;else if(e[f]!==n)throw new J("expected comma or end of structure",{toml:e,ptr:f})}return[m,f]}if(a==='"'||a==="'"){let[m,f]=Ql(e,t);if(n){if(f=qr(e,f),e[f]&&e[f]!==","&&e[f]!==n&&e[f]!==`
162
+ `&&e[f]!=="\r")throw new J("unexpected character encountered",{toml:e,ptr:f});e[f]===","&&f++}return[m,f]}let c=sM(e,t,",",n),l=dQ(e,t,c-(e[c-1]===","?1:0));if(!l[0])throw new J("incomplete key-value declaration: no value specified",{toml:e,ptr:t});return n&&l[1]>-1&&(c=qr(e,t+l[1]),e[c]===","&&c++),[aM(l[0],e,t,i),c]}var fQ=/^[a-zA-Z0-9-_]+[ \t]*$/;function Zl(e,t,n="="){let o=t-1,i=[],a=e.indexOf(n,t);if(a<0)throw new J("incomplete key-value: cannot find end of key",{toml:e,ptr:t});do{let c=e[t=++o];if(c!==" "&&c!==" ")if(c==='"'||c==="'"){if(c===e[t+1]&&c===e[t+2])throw new J("multiline strings are not allowed in keys",{toml:e,ptr:t});let[l,m]=Ql(e,t);o=e.indexOf(".",m);let f=e.slice(m,o<0||o>a?a:o),h=Wl(f);if(h>-1)throw new J("newlines are not allowed in keys",{toml:e,ptr:t+o+h});if(f.trimStart())throw new J("found extra tokens after the string part",{toml:e,ptr:m});if(a<m&&(a=e.indexOf(n,m),a<0))throw new J("incomplete key-value: cannot find end of key",{toml:e,ptr:t});i.push(l)}else{o=e.indexOf(".",t);let l=e.slice(t,o<0||o>a?a:o);if(!fQ.test(l))throw new J("only letter, numbers, dashes and underscores are allowed in keys",{toml:e,ptr:t});i.push(l.trimEnd())}}while(o+1&&o<a);return[i,qr(e,a+1,!0,!0)]}function cM(e,t,n,o){let i={},a=new Set,c;for(t++;(c=e[t++])!=="}"&&c;){if(c===",")throw new J("expected value, found comma",{toml:e,ptr:t-1});if(c==="#")t=Ta(e,t);else if(c!==" "&&c!==" "&&c!==`
163
+ `&&c!=="\r"){let l,m=i,f=!1,[h,E]=Zl(e,t-1);for(let T=0;T<h.length;T++){if(T&&(m=f?m[l]:m[l]={}),l=h[T],(f=Object.hasOwn(m,l))&&(typeof m[l]!="object"||a.has(m[l])))throw new J("trying to redefine an already defined value",{toml:e,ptr:t});!f&&l==="__proto__"&&Object.defineProperty(m,l,{enumerable:!0,configurable:!0,writable:!0})}if(f)throw new J("trying to redefine an already defined value",{toml:e,ptr:t});let[I,g]=vc(e,E,"}",n-1,o);a.add(I),m[l]=I,t=g}}if(!c)throw new J("unfinished table encountered",{toml:e,ptr:t});return[i,t]}function pM(e,t,n,o){let i=[],a;for(t++;(a=e[t++])!=="]"&&a;){if(a===",")throw new J("expected value, found comma",{toml:e,ptr:t-1});if(a==="#")t=Ta(e,t);else if(a!==" "&&a!==" "&&a!==`
164
+ `&&a!=="\r"){let c=vc(e,t-1,"]",n-1,o);i.push(c[0]),t=c[1]}}if(!a)throw new J("unfinished array encountered",{toml:e,ptr:t});return[i,t]}function uM(e,t,n,o){let i=t,a=n,c,l=!1,m;for(let f=0;f<e.length;f++){if(f){if(i=l?i[c]:i[c]={},a=(m=a[c]).c,o===0&&(m.t===1||m.t===2))return null;if(m.t===2){let h=i.length-1;i=i[h],a=a[h].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(m=a[c],m.t!==o&&!(o===1&&m.t===3)||(o===2&&(m.d||(m.d=!0,i[c]=[]),i[c].push(i={}),m.c[m.i++]=m={t:1,d:!1,i:0,c:{}}),m.d))return null;if(m.d=!0,o===1)i=l?i[c]:i[c]={};else if(o===0&&l)return null;return[c,i,m.c]}function Fh(e,{maxDepth:t=1e3,integersAsBigInt:n}={}){let o={},i={},a=o,c=i;for(let l=qr(e,0);l<e.length;){if(e[l]==="["){let m=e[++l]==="[",f=Zl(e,l+=+m,"]");if(m){if(e[f[1]-1]!=="]")throw new J("expected end of table declaration",{toml:e,ptr:f[1]-1});f[1]++}let h=uM(f[0],o,i,m?2:1);if(!h)throw new J("trying to redefine an already defined table or value",{toml:e,ptr:l});c=h[2],a=h[1],l=f[1]}else{let m=Zl(e,l),f=uM(m[0],a,c,0);if(!f)throw new J("trying to redefine an already defined table or value",{toml:e,ptr:l});let h=vc(e,m[1],void 0,t,n);f[1][f[0]]=h[0],l=h[1]}if(l=qr(e,l,!0),e[l]&&e[l]!==`
165
+ `&&e[l]!=="\r")throw new J("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:l});l=qr(e,l)}return o}var lM=/^[a-z0-9-_]+$/i;function Nc(e){let t=typeof e;if(t==="object"){if(Array.isArray(e))return"array";if(e instanceof Date)return"date"}return t}function gQ(e){for(let t=0;t<e.length;t++)if(Nc(e[t])!=="object")return!1;return e.length!=0}function jh(e){return JSON.stringify(e).replace(/\x7f/g,"\\u007f")}function qh(e,t,n,o){if(n===0)throw new Error("Could not stringify the object: maximum object depth exceeded");if(t==="number")return isNaN(e)?"nan":e===1/0?"inf":e===-1/0?"-inf":Number.isInteger(e)&&(o||!Number.isSafeInteger(e))?e.toFixed(1):e.toString();if(t==="bigint"||t==="boolean")return e.toString();if(t==="string")return jh(e);if(t==="date"){if(isNaN(e.getTime()))throw new TypeError("cannot serialize invalid date");return e.toISOString()}if(t==="object")return hQ(e,n,o);if(t==="array")return yQ(e,n,o)}function hQ(e,t,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+=lM.test(c)?c:jh(c),i+=" = ",i+=qh(e[c],Nc(e[c]),t-1,n)}return i+" }"}function yQ(e,t,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+=qh(e[i],Nc(e[i]),t-1,n)}return o+" ]"}function TQ(e,t,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&&`
166
166
  `}[[${t}]]
167
- `,i+=jh(0,e[a],t,n,o);return i}function jh(e,t,n,o,i){if(o===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let a="",c="",l=Object.keys(t);for(let m=0;m<l.length;m++){let f=l[m];if(t[f]!==null&&t[f]!==void 0){let h=vc(t[f]);if(h==="symbol"||h==="function")throw new TypeError(`cannot serialize values of type '${h}'`);let E=pM.test(f)?f:$h(f);if(h==="array"&&iQ(t[f]))c+=(c&&`
168
- `)+cQ(t[f],n?`${n}.${E}`:E,o-1,i);else if(h==="object"){let I=n?`${n}.${E}`:E;c+=(c&&`
169
- `)+jh(I,t[f],I,o-1,i)}else a+=E,a+=" = ",a+=Fh(t[f],h,o,i),a+=`
167
+ `,i+=Bh(0,e[a],t,n,o);return i}function Bh(e,t,n,o,i){if(o===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let a="",c="",l=Object.keys(t);for(let m=0;m<l.length;m++){let f=l[m];if(t[f]!==null&&t[f]!==void 0){let h=Nc(t[f]);if(h==="symbol"||h==="function")throw new TypeError(`cannot serialize values of type '${h}'`);let E=lM.test(f)?f:jh(f);if(h==="array"&&gQ(t[f]))c+=(c&&`
168
+ `)+TQ(t[f],n?`${n}.${E}`:E,o-1,i);else if(h==="object"){let I=n?`${n}.${E}`:E;c+=(c&&`
169
+ `)+Bh(I,t[f],I,o-1,i)}else a+=E,a+=" = ",a+=qh(t[f],h,o,i),a+=`
170
170
  `}}return e&&(a||!c)&&(a=a?`[${e}]
171
171
  ${a}`:`[${e}]`),a&&c?`${a}
172
- ${c}`:a||c}function qh(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(vc(e)!=="object")throw new TypeError("stringify can only be called with an object");let o=jh(0,e,"",t,n);return o[o.length-1]!==`
172
+ ${c}`:a||c}function Hh(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(Nc(e)!=="object")throw new TypeError("stringify can only be called with an object");let o=Bh(0,e,"",t,n);return o[o.length-1]!==`
173
173
  `?o+`
174
- `:o}var pQ={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 uQ(e,t,n,o){let i=(0,ya.join)(e,".claude","settings.json");z(`Claude Code \u2192 ${i}`),(0,Hh.mkdirSync)((0,ya.dirname)(i),{recursive:!0});let a=zs(i),c;try{c=JSON.parse(a??"{}")}catch{throw new Error(`${i} is not valid JSON. Fix or remove it before re-running.`)}if(!No(c))throw new Error(`${i} must contain a JSON object at the top level.`);let l=c.env??{};if(!No(l))throw new Error(`${i} "env" must be a JSON object.`);let m=o?"1":"0";c.env={...l,...pQ,OTEL_EXPORTER_OTLP_ENDPOINT:t,OTEL_LOG_USER_PROMPTS:m,OTEL_LOG_TOOL_DETAILS:m,OTEL_LOG_TOOL_CONTENT:m,OTEL_EXPORTER_OTLP_HEADERS:`Authorization=Bearer ${n}`};let f=Ys(i,a);Ks(i,`${JSON.stringify(c,null,2)}
175
- `),z(f===void 0?" created":` patched (backup: ${f})`)}function lQ(e,t,n){return{environment:"dev",log_user_prompt:n,exporter:{"otlp-http":{endpoint:`${e}/v1/logs`,protocol:"binary",headers:{Authorization:`Bearer ${t}`}}},trace_exporter:{"otlp-http":{endpoint:`${e}/v1/traces`,protocol:"binary",headers:{Authorization:`Bearer ${t}`}}}}}function mQ(e,t,n,o){let i=(0,ya.join)(e,".codex"),a=(0,ya.join)(i,"config.toml");z(`Codex \u2192 ${a}`),(0,Hh.mkdirSync)(i,{recursive:!0});let c=zs(a),l=c===void 0?{}:Gh(c),m="otel"in l;delete l.otel,l.otel=lQ(t,n,o);let f=Ys(a,c);Ks(a,qh(l)),z(f===void 0?" created":m?` replaced existing [otel] tables (backup: ${f})`:` appended (backup: ${f})`)}function uM(){return new cr("--endpoint <OTLP_ENDPOINT>","OTLP base URL").env("TSUGA_OTLP_ENDPOINT").makeOptionMandatory()}function lM(){return new cr("--ingestion-api-key <INGESTION_API_KEY>","Tsuga ingestion API key").env("TSUGA_INGESTION_API_KEY").makeOptionMandatory()}var mM="Restart your claude / codex session to load the new config.";function dM(e){let t=e.command("setup").description("Configure local LLM CLIs to ship OTEL telemetry to Tsuga");t.command("claude-code").description("Patch ~/.claude/settings.json with Tsuga OTEL env").addOption(uM()).addOption(lM()).option("--no-include-prompts","Strip user prompts + tool content from telemetry (default: include)").action(n=>{uQ((0,Bh.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),z(mM)}),t.command("codex").description("Patch ~/.codex/config.toml with Tsuga OTEL settings (replaces any existing [otel] table)").addOption(uM()).addOption(lM()).option("--no-include-prompts","Strip user prompts from telemetry (default: include)").action(n=>{mQ((0,Bh.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),z(mM)})}var $o="/v0/logs";var Kh=["CRITICAL","ERROR","WARN","NOTICE","INFO","DEBUG","TRACE"];var Nc=0,zh=r.Object({__tsuga_metadata__:r.Object({id:r.String(),source:r.Optional(r.String())},{additionalProperties:!0}),context:r.Optional(r.Object({team:r.Optional(r.String({description:"Team name associated with this log."})),tag_policy_warnings:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Unknown({description:"Log message after ingestion and route processing. It can be any JSON value because processors may map arbitrary data into `message`."})),timestamp:r.Number({description:"Log timestamp as a Unix timestamp in milliseconds."}),level:r.Enum(Kh,{description:"Log severity, normalized from the source severity into one of the fixed Tsuga levels (ordered `CRITICAL` to `TRACE`)."}),[pR]:r.Optional(r.String({description:"ID of the cluster this log was read from. Only set when the request spanned several clusters."}))},{additionalProperties:!0}),fM=100,dQ="timestamp",fQ=r.Union([r.Literal(dQ)]),Kn=r.Partial(r.Object({...it.properties,query:p({type:"tsuga-query",description:"Tsuga query used to filter logs in the selected time range."}),maxResults:r.Integer({minimum:1,maximum:1e3,description:"Maximum number of logs to return. Valid values are 1 through 1000."}),shouldRecommendAttributes:r.Boolean({description:"Whether Tsuga should return suggested attributes to highlight in results."}),triggeredBy:r.Literal("refresh",{description:"Indicates the query was triggered by a refresh action."}),startOffset:r.Number({minimum:Nc,description:"Result offset used when fetching additional log rows."}),startOffsets:r.Array(r.Number({minimum:Nc}),{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 ${Nc} for every cluster.`}),clusterId:p({allowEmpty:!1,description:"ID of the cluster to target. Omit to use the default cluster."}),clusterIds:Is,sortBy:fQ,sortDirection:ne})),Yat=d({tags:["logs"],url:`${$o}/count`,method:"GET",query:r.Pick(Kn,["from","to","query","clusterId","clusterIds"]),response:r.Object({count:r.Number(),clusterResponses:r.Optional(Oi())})}),Lc=r.Object({value:r.String(),priority:r.Number()}),Vat=d({tags:["logs"],url:`${$o}/search`,method:"GET",query:Kn,response:r.Object({logs:r.Optional(r.Array(zh)),attributesToHighlight:r.Optional(r.Array(Lc)),clusterResponses:r.Optional(Oi(r.Object({nextStartOffset:r.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})}),gQ=r.Cyclic({TokenOutput:r.Union([r.Object({type:r.Literal("top"),values:r.Array(r.String())}),r.Object({type:r.Literal("ip"),value:r.String()}),r.Object({type:r.Literal("range"),min:r.Number(),max:r.Number()}),r.Object({type:r.Literal("variable"),value:r.String()}),r.Object({type:r.Literal("text"),value:r.String()}),r.Object({type:r.Literal("date"),value:r.String()}),r.Object({type:r.Literal("url"),value:r.String()}),r.Object({type:r.Literal("structure"),key:r.Array(r.String()),value:r.Array(r.Ref("TokenOutput"))})])},"TokenOutput",{description:"A token identified as part of the pattern"}),hQ=r.Object({id:r.String(),pattern:r.Array(gQ),size:r.Integer({description:"Number of logs that matched the pattern"}),examples:r.Array(r.Object({id:r.String(),timestampUnix:r.Number()})),timeDistribution:r.Array(r.Number()),staticFeatures:r.Array(r.Object({key:r.String(),value:r.String()},{description:"Fixed groups present in all logs matching the pattern"}))}),Qat=d({tags:["logs"],url:`${$o}/patterns`,method:"GET",query:r.Object({...it.properties,query:p({type:"tsuga-query"}),clusteringThreshold:r.Optional(r.Number()),clusterId:r.Optional(p({allowEmpty:!1}))}),response:r.Object({patterns:r.Array(hQ),sampleSize:r.Number()})}),Wat=d({tags:["logs"],url:`${$o}/attributes`,method:"GET",query:r.Object({...it.properties,clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"})),clusterIds:r.Optional(Is)}),response:r.Object({attributes:r.Array(r.String()),clusterResponses:r.Optional(Oi())})});var yQ=["pending","running","completed","incomplete","failed"],gM=r.Object({id:r.String({description:"ID of the export."}),status:r.Enum(yQ,{description:"Lifecycle of the export. `pending` until the download is claimed, `running` while the CSV streams, then `completed`, `incomplete` when the file is usable but some matched logs could not be reached, or `failed` if the export was interrupted."}),rowsWritten:r.Number({description:"Logs written to the CSV so far. Updated periodically while the download streams, so it lags slightly behind the bytes on the wire."}),totalRows:r.Number({description:"Logs this export will write, already clamped to the export maximum. Use it as the denominator for progress."}),isTruncated:r.Boolean({description:"Whether the query matched more logs than the export maximum, so the CSV holds only the first logs in the requested sort order."}),errorMessage:r.Optional(r.String({description:"Why the export is incomplete or failed."}))}),Zat=d({tags:["logs"],url:`${$o}/exports`,method:"POST",body:r.Object({...r.Pick(Kn,["from","to","query","clusterId","clusterIds","sortBy","sortDirection"]).properties,columns:r.Array(p({allowEmpty:!1}),{minItems:1,description:"Log attributes to write as CSV columns, in order. Each becomes one column, resolved against the log with dotted-path lookup."})}),response:r.Object({...gM.properties,downloadUrl:r.String({description:"Relative URL to fetch the CSV from. It carries a single-use token that expires shortly after creation, so the caller must start the download immediately."})})}),Xat=d({tags:["logs"],url:`${$o}/exports/:exportId`,method:"GET",params:r.Object({exportId:r.String()}),response:gM}),Jat=d({tags:["logs"],url:`${$o}/exports/:exportId/download`,method:"GET",params:r.Object({exportId:r.String()}),query:r.Object({token:p({allowEmpty:!1,description:"Single-use token minted when the export was created."})}),response:r.String({description:"CSV file, streamed as it is produced."})});var kc=`/${"v1"}/logs`,Yh=r.Object({context:r.Optional(r.Object({team:r.Optional(r.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."})),...r.Pick(zh,["message","timestamp","level"]).properties},{additionalProperties:!0,$id:"LogEvent",description:"Log event including message, timestamp, severity level, and optional enriched context attributes."}),TQ={context:{team:"platform"},message:"Request completed successfully",timestamp:17040672e5,level:"INFO"};Object.assign(Yh,{examples:[TQ]});var hM=r.Object({query:r.Optional(p({type:"tsuga-query",default:"*",description:"Tsuga query selecting logs to return. Omit to search all logs with `*`."})),maxResults:r.Optional(r.Integer({minimum:1,maximum:1e3,default:fM,description:"Maximum number of logs to return. Defaults to 100. Valid values are 1 through 1000."})),clusterId:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),...Tt.properties},{description:"Log search query. Provide a time range, optional Tsuga query, and optional limit."}),EQ={query:"level:ERROR",maxResults:100,from:1704067200,to:1704070800};Object.assign(hM,{examples:[EQ]});var yM=d({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:`${kc}/search`,method:"GET",query:hM,response:r.Object({logs:r.Array(Yh,{description:"Log events matching the query and time range."})})}),_Q=r.Object({pattern:r.String({description:"Clustered log pattern formatted as a readable string."}),size:r.Integer({description:"Number of logs that matched the pattern"}),groups:r.Array(r.Object({key:r.String({description:"Attribute dot-path shared by all logs in the pattern."}),value:r.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`."}))}),TM=r.Object({patterns:r.Array(_Q,{description:"Log patterns clustered from logs matching the query."}),sampleSize:r.Number({description:"Number of logs sampled while computing patterns."})},{}),IQ={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(TM,{examples:[IQ]});var EM=d({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:`${kc}/patterns`,method:"GET",query:r.Object({...Tt.properties,query:p({type:"tsuga-query",description:"Tsuga query selecting logs to cluster into patterns."}),clusterId:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:TM}),SQ=r.Object({exampleLog:r.Optional(Yh),team:r.String({description:"Team associated with the new error pattern."}),env:r.String({description:"Environment associated with the new error pattern."}),service:r.String({description:"Service associated with the new error pattern."}),firstSeen:r.Number({description:"Unix timestamp in seconds when this pattern was first seen."}),lastSeen:r.Number({description:"Unix timestamp in seconds when this pattern was last seen."})}),_M=r.Object({newErrorPatterns:r.Array(SQ,{description:"Error patterns first seen in the requested time range."})},{}),bQ={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(_M,{examples:[bQ]});var IM=d({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:`${kc}/patterns/new`,method:"GET",query:r.Object({...Tt.properties,team:r.Optional(p({description:"Team name to restrict pattern detection to."})),env:r.Optional(p({description:"Environment to restrict pattern detection to."})),service:r.Optional(p({description:"Service name to restrict pattern detection to."})),clusterId:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:_M}),OQ=r.Object({team:r.String({description:"Team associated with the error pattern. Set from the log context used during pattern analysis. Returned for every pattern increase."}),env:r.String({description:"Environment associated with the error pattern. Set from the log context used during pattern analysis. Returned for every pattern increase."}),pattern:r.String({description:"Readable representation of the grouped error log pattern. Generated by Tsuga from matching log messages and returned for every pattern increase."}),increaseTimestamps:r.Array(r.Number({description:"Unix timestamp in milliseconds of a detected spike in this pattern. Tsuga computes these timestamps during pattern-increase analysis; one entry is returned for each spike in the requested time range."}))}),SM=r.Object({errorPatternIncreases:r.Array(OQ,{description:"Error patterns with increased occurrence in the requested time range."})},{}),AQ={errorPatternIncreases:[{team:"platform",env:"production",pattern:"Non-resolved segment SegmentId(*) from cache",increaseTimestamps:[17041536e5,17042392e5]}]};Object.assign(SM,{examples:[AQ]});var bM=d({description:"Finds error patterns whose occurrence increased for a team in the requested time range. Use this to identify growing failure modes without retrieving raw log events. See [Logs](/documentation/explore/logs).",operationId:"getErrorPatternIncrease",tags:["public","logs"],url:`${kc}/patterns/increase`,method:"GET",query:r.Object({...Tt.properties,team:p({allowEmpty:!1,description:"Team name to analyze for pattern increases. Required; match it to the `context.team` value on the logs you want Tsuga to inspect."}),env:r.Optional(p({allowEmpty:!1,description:"Environment to restrict the analysis to. Optional; match it to the `context.env` value on the logs, or omit it to analyze all environments for the team."})),clusterId:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:SM}),OM=r.Object({attributes:r.Array(r.String(),{description:"Log attribute dot-paths observed in the time range"})},{}),xQ={attributes:["context.env","context.k8s.pod.name","context.service.name","context.team","level","message","timestamp"]};Object.assign(OM,{examples:[xQ]});var RQ=r.Object({...Tt.properties,clusterId:r.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."}),AM=d({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:`${kc}/attributes`,method:"GET",query:RQ,response:OM});var sn="/v0/metrics",CQ=r.Object({__tsuga_metadata__:r.Object({},{additionalProperties:!0}),context:r.Optional(r.Object({},{additionalProperties:!0})),message:r.Optional(r.String()),timestamp:r.Number(),level:r.Enum(Kh)},{additionalProperties:!0}),dst=d({tags:["metrics"],url:`${sn}/count`,method:"GET",query:r.Pick(Kn,["from","to","query","clusterId"]),response:r.Object({count:r.Number()})}),fst=d({tags:["metrics"],url:`${sn}/search`,method:"GET",query:Kn,response:r.Object({logs:r.Optional(r.Array(CQ)),totalHits:r.Optional(r.Number()),attributesToHighlight:r.Optional(r.Array(Lc))},{additionalProperties:!0})}),Wl=r.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."}),Vh=r.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."}),xM=r.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."}),RM=r.Array(r.String(),{description:"Team values observed on this metric across the most recent data generations kept by the metric catalog. Omitted when the catalog has no team statistics for the metric yet."}),PQ=r.Number({description:"Estimated number of distinct series for this metric across the most recent data generations kept by the metric catalog. Omitted when the catalog has no statistics for the metric yet."}),UQ=r.Record(r.String(),r.Number(),{description:"Estimated number of distinct values per attribute over the same window as `seriesCardinality`, keyed like `tags`."}),wQ=r.Object({capabilities:r.Optional(r.Array(r.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:r.Optional(r.String({description:"Human-readable description of the metric"})),tags:r.Optional(r.Array(r.String(),{description:"Attribute names available as dimensions for filtering or grouping this metric. Exposed publicly as `attributes`."})),temporality:r.Optional(Vh),type:r.Optional(Wl),unit:r.Optional(r.String({description:"Metric unit reported by instrumentation or inferred metadata."})),lastSeen:r.Optional(xM),teams:r.Optional(RM),seriesCardinality:r.Optional(PQ),attributeCardinalities:r.Optional(UQ)}),gst=d({url:`${sn}/metadata`,method:"GET",query:r.Object({...it.properties,metricName:p({allowEmpty:!1}),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:wQ}),hst=d({tags:["metrics"],url:sn,method:"GET",query:r.Object({...it.properties,clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:r.Array(r.String())}),Zl=r.Array(r.Object({name:r.String({description:"Metric name observed by Tsuga."}),type:Wl,lastSeen:r.Optional(xM),teams:r.Optional(RM)}),{description:"Metrics observed in the requested time range, with the instrument type each was reported as."}),vQ=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Zl,{examples:[vQ]});var yst=d({tags:["metrics"],url:`${sn}/names-and-types`,method:"GET",query:r.Object({...it.properties,clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Zl}),Mc=r.Array(r.String(),{description:"Attribute names available as dimensions for filtering or grouping the requested metric(s)."}),NQ=["service","env","host","method","status_code"];Object.assign(Mc,{examples:[NQ]});var Tst=d({tags:["metrics"],url:`${sn}/attributes`,method:"GET",query:r.Object({...it.properties,metricName:p({allowEmpty:!1}),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Mc}),Est=d({tags:["metrics"],url:`${sn}/attributes/batch`,method:"GET",query:r.Object({...it.properties,metricNames:r.Array(p({allowEmpty:!1}),{minItems:1,description:"Metric names to fetch attributes for"}),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Mc}),Qh=r.Object({assets:r.Array(r.Object({type:r.Enum(["dashboard","monitor"],{description:"Kind of asset referencing the metric."}),id:r.String({description:"Dashboard or monitor ID for the asset that queries this metric."}),name:r.String({description:"Display name of the referencing dashboard or monitor."}),owner:r.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."})}),_st=d({tags:["metrics"],url:`${sn}/assets-usage`,method:"GET",query:r.Object({metricName:p({allowEmpty:!1})}),response:Qh}),Ist=d({url:`${sn}/per-attribute`,method:"GET",query:r.Object({from:r.Optional(r.Number()),to:r.Optional(r.Number()),attribute:p(),clusterId:r.Optional(p({allowEmpty:!1}))}),response:r.Array(r.String())});var Wh=`/${"v1"}/metrics`,LQ=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Zl,{examples:[LQ]});var Zh=r.Object({name:r.String({description:"Metric name observed by Tsuga. Use this value in metric queries and aggregations."}),type:Wl,description:r.Optional(r.String({description:"Human-readable description of what the metric measures, set by the reporting instrumentation. Omitted when the instrumentation did not provide one."})),unit:r.Optional(r.String({description:"Metric unit reported by instrumentation or inferred metadata."})),temporality:r.Optional(Vh),capabilities:r.Optional(r.Array(r.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:r.Optional(r.Array(r.String(),{description:"Metric attribute names available as dimensions for filtering or grouping."}))}),kQ={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(Zh,{examples:[kQ]});var CM=r.Object({...Tt.properties,clusterId:r.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."}),PM=d({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:Wh,method:"GET",query:CM,response:r.Array(Zh)}),UM=d({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:`${Wh}/:name`,method:"GET",params:r.Object({name:p({allowEmpty:!1,description:"Metric name to retrieve, for example `http.server.request.duration`."})}),query:CM,response:Zh}),MQ=["service","env","host","method","status_code"];Object.assign(Mc,{examples:[MQ]});var wM=r.Pick(Qh,["assets"]),DQ={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(wM,{examples:[DQ]});var vM=d({description:"Retrieve dashboards and monitors that use a specific metric",operationId:"getMetricAssetsUsage",tags:["private"],url:`${Wh}/assets-usage`,method:"GET",query:r.Object({metricName:p({allowEmpty:!1,description:"The name of the metric to find usage for"})}),response:wM});var zn="/v0/traces",kst=d({tags:["traces"],url:`${zn}/count`,method:"GET",query:r.Pick(Kn,["from","to","query","clusterId"]),response:r.Object({count:r.Number()})}),GQ=["unset","ok","error"],$Q=r.Enum(GQ),FQ=["unspecified","internal","server","client","producer","consumer"],jQ=r.Enum(FQ),LM=r.Object({__tsuga_metadata__:r.Optional(r.Object({},{additionalProperties:!0})),context:r.Optional(r.Object({telemetry:r.Optional(r.Object({sdk:r.Optional(r.Object({language:r.Optional(r.String())},{additionalProperties:!0}))},{additionalProperties:!0})),tag_policy_warnings:r.Optional(r.Record(r.String(),r.String())),service:r.Optional(r.Object({name:r.Optional(r.String()),version:r.Optional(r.String())},{additionalProperties:!0})),env:r.Optional(r.String())},{additionalProperties:!0})),parent_span_id:r.Optional(r.String()),resource_attributes:r.Object({},{additionalProperties:!0}),span_attributes:r.Object({},{additionalProperties:!0}),duration:r.Number({description:"In milliseconds."}),duration_ns:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),start_time:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),end_time:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),error:r.Optional(r.Object({message:r.String()})),events:r.Optional(r.Array(r.Object({event_attributes:r.Object({},{additionalProperties:!0}),event_name:r.String(),event_timestamp_nanos:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."})}))),links:r.Optional(r.Array(r.Object({},{additionalProperties:!0}))),span_id:r.String(),span:r.Object({kind:jQ,name:r.String()}),status_code:r.Optional($Q),trace_id:r.String()}),kM=100,qQ="start_time",BQ="duration_ns",HQ=r.Union([r.Literal(qQ),r.Literal(BQ)]),KQ={...it.properties,query:r.Optional(p({type:"tsuga-query"})),maxResults:r.Optional(r.Integer({minimum:1,maximum:1e4})),shouldRecommendAttributes:r.Optional(r.Boolean()),startOffset:r.Optional(r.Number({minimum:Nc})),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"})),sortBy:r.Optional(HQ),sortDirection:r.Optional(ne)},Mst=d({tags:["traces"],url:`${zn}/search`,method:"GET",query:r.Object(KQ),response:r.Object({spans:r.Optional(r.Array(LM)),attributesToHighlight:r.Optional(r.Array(Lc))})});var zQ=r.Object({groupByAttributes:r.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:r.Integer({minimum:2,description:"Minimum leaf-group size before aggregation occurs. Default 5."}),maxParentDepth:r.Integer({minimum:-1,description:"Max depth of recursive parent aggregation. 0 = leaves only, -1 = unlimited (default)."}),aggregationHistogramBucketsSeconds:r.Array(r.Number({minimum:0}),{description:"Upper bounds for the latency histogram in seconds. Empty array disables the histogram attributes."}),sortSpans:r.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."})}),YQ=r.Object({...it.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"})),...r.Partial(zQ).properties}),Dst=d({tags:["traces"],url:`${zn}/summarize`,method:"GET",query:YQ,response:r.Object({spans:r.Array(LM)})}),Gst=d({tags:["traces"],url:`${zn}/attributes`,method:"GET",query:r.Object({...it.properties,clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:r.Object({attributes:r.Array(r.String())})}),VQ=r.Object({key:r.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:r.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:r.Optional(r.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:r.Optional(r.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:r.Optional(r.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."}))}),QQ=r.Object({fromNs:r.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:r.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:r.String({description:"Range duration in nanoseconds, computed as `toNs - fromNs`. Transmitted as a string to avoid losing precision."}),contributions:r.Array(r.Object({serviceKey:r.String({description:"Contributing service key for this range. References `services[].key` in the same response."}),weight:r.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:r.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:r.Array(r.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."})}),WQ=r.Object({serviceKey:r.String({description:"Contributing service key for this aggregate total. References `services[].key` in the same response."}),durationNs:r.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:r.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."})}),Jh=r.Optional(r.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."})),ey=r.Optional(r.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."})),Xl=r.Object({traceId:r.String({description:"Trace ID summarized by the response. Echoes the required `traceId` query parameter."}),startTimeNs:r.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:r.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:r.String({description:"Total fetched trace duration in nanoseconds, computed as `endTimeNs - startTimeNs`. Transmitted as a string to avoid losing precision."}),truncated:r.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:r.Array(VQ,{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:r.Array(QQ,{description:"Sequential trace timeline split into ranges wherever the active leaf-span set changes. Empty when the request sets `includeRanges` to false."}),serviceTotals:r.Array(WQ,{description:"Aggregated wall-clock contribution per service across the fetched trace. Use this for service-level latency ownership without processing the per-range timeline."})}),ZQ={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(Xl,{examples:[ZQ]});var $st=d({tags:["traces"],url:`${zn}/latency-summary`,method:"GET",query:r.Object({...it.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"})),minRangeDurationMs:Jh,includeRanges:ey}),response:Xl}),XQ=r.Object({traceId:r.String(),spanId:r.String()}),Fst=d({tags:["traces"],url:`${zn}/span-backlinks`,method:"GET",query:r.Object({...it.properties,traceId:p({allowEmpty:!1,description:"Trace ID referenced by span links"}),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:r.Object({backlinks:r.Array(r.Object({spanId:r.String(),references:r.Array(XQ)})),truncated:r.Boolean()})}),NM=r.Object({filter:p({type:"tsuga-query",description:"TQL filter defining the group"}),timeRange:Un}),JQ=r.Object({value:r.String(),supportA:r.Number(),supportB:r.Number()}),e8=r.Object({value:r.String(),supportA:r.Number(),supportB:r.Number(),lift:r.Union([r.Number(),r.Null()]),pValue:r.Number()}),t8=r.Object({attr:r.String(),values:r.Array(e8),otherValues:r.Array(JQ)}),Xh=r.Object({contrastSets:r.Array(t8),groupACount:r.Number(),groupBCount:r.Number(),failedAttributeCount:r.Number()}),MM=r.Object({groupA:NM,groupB:NM,candidateAttrs:r.Optional(r.Array(p({allowEmpty:!1}))),topK:r.Optional(r.Integer({minimum:1,maximum:100})),minLift:r.Optional(r.Number({minimum:1})),minSupport:r.Optional(r.Number({minimum:0,maximum:100})),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),jst=d({tags:["traces"],url:`${zn}/contrast-sets`,method:"POST",body:MM,response:Xh}),r8=R("type",[r.Object({type:r.Literal("snapshot"),response:Xh}),r.Object({type:r.Literal("done"),response:Xh}),r.Object({type:r.Literal("error"),message:r.String()})]),qst=d({tags:["traces"],url:`${zn}/contrast-sets/stream`,method:"POST",body:MM,response:r8});var ty=`/${"v1"}/traces`,ry=r.Object({context:r.Optional(r.Object({service:r.Optional(r.Object({name:r.Optional(r.String({description:"Service name associated with the span."})),version:r.Optional(r.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:r.Optional(r.String({description:"`spanId` of this span's parent within the same trace. Absent for the root span."})),resourceAttributes:r.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:r.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:r.Number({description:"Span duration in milliseconds, derived from the nanosecond `startTime` and `endTime` values."}),startTime:r.String({description:"Span start time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),endTime:r.String({description:"Span end time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),error:r.Optional(r.Object({message:r.String({description:"Error message associated with the span."})},{description:"Error details associated with the span, separate from the OpenTelemetry `statusCode` field."})),events:r.Optional(r.Array(r.Object({event_attributes:r.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:r.String({description:"Name of the span event."}),event_timestamp_nanos:r.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:r.String({description:"Unique span ID within the trace."}),span:r.Object({kind:r.String({description:"OpenTelemetry span kind describing the relationship to remote calls: `unspecified`, `internal`, `server`, `client`, `producer`, or `consumer`."}),name:r.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:r.Optional(r.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:r.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."}),n8={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(ry,{examples:[n8]});var o8={from:1704067200,to:1704070800,query:"context.service.name:my-service",maxResults:100},DM=r.Object({...Tt.properties,query:r.Optional(p({type:"tsuga-query",default:"*",description:"Tsuga query selecting spans to return. Omit to search all spans in the range with `*`."})),maxResults:r.Optional(r.Integer({minimum:1,maximum:1e4,default:kM,description:"Maximum number of spans to return. Defaults to 100. Valid values are 1 through 10000."})),clusterId:r.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(DM,{examples:[o8]});var GM=d({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:`${ty}/search`,method:"GET",query:DM,response:r.Object({spans:r.Array(ry,{description:"Spans matching the query and time range."})})}),i8={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},$M=r.Object({...Tt.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:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),groupByAttributes:r.Optional(r.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:r.Optional(r.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:r.Optional(r.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:r.Optional(r.Array(r.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:r.Optional(r.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($M,{examples:[i8]});var FM=d({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:`${ty}/summarize`,method:"GET",query:$M,response:r.Object({spans:r.Array(ry,{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`."})})}),a8={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},jM=r.Object({...Tt.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:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),minRangeDurationMs:Jh,includeRanges:ey},{description:"Trace latency summary query. Provide a trace ID, a time range covering the trace, and optional timeline tuning."});Object.assign(jM,{examples:[a8]});var qM=d({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:`${ty}/latency-summary`,method:"GET",query:jM,response:Xl});var KM=["timestamp","level","message"],zM=["count","ratio","team","level","pattern"];function Et(e,t){let n=t??tr(e);if(!n)throw new Error(`--${e} is required`);return Ko(n)}function BM(e){let t={from:Et("from",e.from),to:Et("to",e.to)},n=e.query??tr("query");n!==void 0&&(t.query=n);let o=e.maxResults??tr("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})`);t.maxResults=i}return t}function Ge(e){let t=tr(e);return t===void 0?"":` (default: ${t})`}function s8(e){let t=ls(e.output),n=e.fields===void 0?void 0:ms(e.fields);return t==="json"?{format:t,fields:n}:{format:t,fields:n??KM}}function c8(e){let t=ls(e.output),n=e.fields===void 0?void 0:ms(e.fields);return t==="json"?{format:t,fields:n}:{format:t,fields:n??zM}}function HM(e,t){let n={count:e.size,ratio:t>0?e.size/t: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 p8(e,t){if(t.format==="json"){if(t.fields===void 0){Q(e);return}let{fields:i}=t;Q({patterns:e.patterns.map(a=>HM(a,e.sampleSize)).map(a=>ds(a,i)),sampleSize:e.sampleSize});return}let n=e.patterns.map(i=>HM(i,e.sampleSize)),o=fs(t.format,n,t.fields);o.length>0&&z(o)}function u8(e,t){if(t.format==="json"){if(t.fields===void 0){Q(e);return}let{fields:o}=t;Q({logs:e.logs.map(i=>ds(i,o))});return}let n=fs(t.format,e.logs,t.fields);n.length>0&&z(n)}function YM(e,t){let n=e.command("logs").description("Search and analyze logs");n.command("search").description("Search logs").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs${Ge("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-1000${Ge("max-results")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each log (default for --output=tsv|csv: ${KM.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=s8(c),m=await t()(yM,{query:BM(c)});u8(m,l)}),n.command("attributes").description("List log attribute dot-paths observed in the time range").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async c=>{let l=await t()(AM,{query:{from:Et("from",c.from),to:Et("to",c.to)}});Q(l)}),n.command("patterns").description("List log patterns").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs before clustering into patterns${Ge("query")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each pattern (default for --output=tsv|csv: ${zM.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=c8(c),m={from:Et("from",c.from),to:Et("to",c.to)},f=c.query??tr("query");f!==void 0&&(m.query=f);let h=await t()(EM,{query:m});p8(h,l)}),n.command("new-error-patterns").description("List error patterns first seen in this time range").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("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:Et("from",c.from),to:Et("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 m=await t()(IM,{query:l});Q(m)}),n.command("error-pattern-increases").description("List error pattern increases for a given team").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).requiredOption("--team <TEAM_NAME>","Team to query").option("--env <ENV_NAME>","Filter by environment").action(async c=>{let l={from:Et("from",c.from),to:Et("to",c.to),team:c.team};c.env!==void 0&&(l.env=c.env);let m=await t()(bM,{query:l});Q(m)});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${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async c=>{let l=await t()(PM,{query:{from:Et("from",c.from),to:Et("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${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async(c,l)=>{let m=await t()(UM,{params:{name:c},query:{from:Et("from",l.from),to:Et("to",l.to)}});Q(m)}),o.command("assets-usage <METRIC_NAME>").description("List dashboards and monitors that use a specific metric").action(async c=>{let l=await t()(vM,{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${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter spans${Ge("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-10000${Ge("max-results")}`).action(async c=>{let l=await t()(GM,{query:BM(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${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async c=>{let l=await t()(FM,{query:{traceId:c.traceId,from:Et("from",c.from),to:Et("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${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("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:Et("from",c.from),to:Et("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 m=await t()(qM,{query:l});Q(m)});let a=e.command("aggregation").description("Run aggregation queries");hr(a,"scalar","Run aggregation queries and return scalar results",oC,t),hr(a,"timeseries","Run aggregation queries and return timeseries results",aC,t)}var l8="x-tsuga-session-id",ny="x-tsuga-source",oy="x-tsuga-source-version",iy="x-tsuga-source-commit",ay="x-tsuga-source-date",sy="x-tsuga-rationale",m8="x-tsuga-dashboard-id",d8="x-tsuga-widget-id",f8="x-request-id",sct={[l8]:"Session identifier for request correlation",[ny]:"SDK or client source identifier (e.g., web-frontend, terraform-provider)",[oy]:"SDK version",[iy]:"SDK commit hash",[ay]:"SDK commit date",[sy]:"Optional caller-supplied rationale for this request, recorded for telemetry",[m8]:"ID of the dashboard a query is issued from, when the request originates from a dashboard widget",[d8]:"ID of the dashboard widget (graph) a query is issued from, when the request originates from a dashboard widget",[f8]:"Unique identifier for this API request, useful for debugging and support"};function g8(e){return e.replace(/\s+/g," ").replace(/[^\x20-\x7e\x80-\xff]/g,"").trim()}function VM(e,t,n,o){return async function(a,c={}){let{body:l,params:m,query:f}=c,h;if(a.url!==void 0)h=a.url;else if(a.buildUrl){if(!m)throw new rr("Internal error: params required for this endpoint");h=a.buildUrl(m)}else throw new rr("Internal error: endpoint has neither url nor buildUrl");let E=n===void 0?f:{clusterId:n,...f},I=NA(`${e}${h}`,E),g={Accept:"application/json",Authorization:`Bearer ${t}`,[ny]:"cli",[oy]:"1.30.0",[iy]:"79ee3aead3",[ay]:"2026-09-11T16:22:25.754Z"};l&&(g["Content-Type"]="application/json");let T=o?.(),O=T?g8(T):"";O&&(g[sy]=O);let b=await fetch(I,{method:a.method,headers:g,body:l?JSON.stringify(l):null}),x;try{x=await b.json()}catch{throw new rr(b.status===504?"The server timed out (504). Try a smaller time range.":`Server returned a non-JSON response (HTTP ${b.status}).`,b.status)}if(x.error)throw rr.fromErrorResponse(x.error,x.requestId);return y8(x,h8(c)),x.data}}function h8({body:e,query:t}){let n=t?.offset??e?.offset;return typeof n=="number"?n:0}function y8(e,t){let n=e.metadata?.pagination;if(n===void 0||!Array.isArray(e.data))return;let o=t+e.data.length;o>=n.totalCount||Tx(`Showing ${e.data.length} of ${n.totalCount} (offset ${t}). Use --limit (max ${hi}) and --offset ${o} for the next page.`)}function cy(e,t=n=>{process.exit(n)}){e.on("error",n=>{if(n.code==="EPIPE"){t(process.exitCode);return}throw n})}var T8=3e3,E8="https://registry.npmjs.org/@tsuga/cli/latest";function _8(e,t){let n=e.split(".").map(Number),o=t.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 QM(e){try{let t=tR();if(t&&Date.now()-new Date(t).getTime()<Bc)return;let n=await fetch(E8,{signal:AbortSignal.timeout(T8)});if(!n.ok)return;let i=(await n.json()).version;_8(i,e)&&(process.stderr.write(`
174
+ `:o}var EQ={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 _Q(e,t,n,o){let i=(0,Ea.join)(e,".claude","settings.json");z(`Claude Code \u2192 ${i}`),(0,zh.mkdirSync)((0,Ea.dirname)(i),{recursive:!0});let a=Ys(i),c;try{c=JSON.parse(a??"{}")}catch{throw new Error(`${i} is not valid JSON. Fix or remove it before re-running.`)}if(!Lo(c))throw new Error(`${i} must contain a JSON object at the top level.`);let l=c.env??{};if(!Lo(l))throw new Error(`${i} "env" must be a JSON object.`);let m=o?"1":"0";c.env={...l,...EQ,OTEL_EXPORTER_OTLP_ENDPOINT:t,OTEL_LOG_USER_PROMPTS:m,OTEL_LOG_TOOL_DETAILS:m,OTEL_LOG_TOOL_CONTENT:m,OTEL_EXPORTER_OTLP_HEADERS:`Authorization=Bearer ${n}`};let f=Vs(i,a);zs(i,`${JSON.stringify(c,null,2)}
175
+ `),z(f===void 0?" created":` patched (backup: ${f})`)}function IQ(e,t,n){return{environment:"dev",log_user_prompt:n,exporter:{"otlp-http":{endpoint:`${e}/v1/logs`,protocol:"binary",headers:{Authorization:`Bearer ${t}`}}},trace_exporter:{"otlp-http":{endpoint:`${e}/v1/traces`,protocol:"binary",headers:{Authorization:`Bearer ${t}`}}}}}function SQ(e,t,n,o){let i=(0,Ea.join)(e,".codex"),a=(0,Ea.join)(i,"config.toml");z(`Codex \u2192 ${a}`),(0,zh.mkdirSync)(i,{recursive:!0});let c=Ys(a),l=c===void 0?{}:Fh(c),m="otel"in l;delete l.otel,l.otel=IQ(t,n,o);let f=Vs(a,c);zs(a,Hh(l)),z(f===void 0?" created":m?` replaced existing [otel] tables (backup: ${f})`:` appended (backup: ${f})`)}function mM(){return new pr("--endpoint <OTLP_ENDPOINT>","OTLP base URL").env("TSUGA_OTLP_ENDPOINT").makeOptionMandatory()}function dM(){return new pr("--ingestion-api-key <INGESTION_API_KEY>","Tsuga ingestion API key").env("TSUGA_INGESTION_API_KEY").makeOptionMandatory()}var fM="Restart your claude / codex session to load the new config.";function gM(e){let t=e.command("setup").description("Configure local LLM CLIs to ship OTEL telemetry to Tsuga");t.command("claude-code").description("Patch ~/.claude/settings.json with Tsuga OTEL env").addOption(mM()).addOption(dM()).option("--no-include-prompts","Strip user prompts + tool content from telemetry (default: include)").action(n=>{_Q((0,Kh.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),z(fM)}),t.command("codex").description("Patch ~/.codex/config.toml with Tsuga OTEL settings (replaces any existing [otel] table)").addOption(mM()).addOption(dM()).option("--no-include-prompts","Strip user prompts from telemetry (default: include)").action(n=>{SQ((0,Kh.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),z(fM)})}var Fo="/v0/logs";var Yh=["CRITICAL","ERROR","WARN","NOTICE","INFO","DEBUG","TRACE"];var Lc=0,Vh=r.Object({__tsuga_metadata__:r.Object({id:r.String(),source:r.Optional(r.String())},{additionalProperties:!0}),context:r.Optional(r.Object({team:r.Optional(r.String({description:"Team name associated with this log."})),tag_policy_warnings:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Unknown({description:"Log message after ingestion and route processing. It can be any JSON value because processors may map arbitrary data into `message`."})),timestamp:r.Number({description:"Log timestamp as a Unix timestamp in milliseconds."}),level:r.Enum(Yh,{description:"Log severity, normalized from the source severity into one of the fixed Tsuga levels (ordered `CRITICAL` to `TRACE`)."}),[lR]:r.Optional(r.String({description:"ID of the cluster this log was read from. Only set when the request spanned several clusters."}))},{additionalProperties:!0}),yM=100,bQ="timestamp",OQ=r.Union([r.Literal(bQ)]),Kn=r.Partial(r.Object({...it.properties,query:p({type:"tsuga-query",description:"Tsuga query used to filter logs in the selected time range."}),maxResults:r.Integer({minimum:1,maximum:1e3,description:"Maximum number of logs to return. Valid values are 1 through 1000."}),shouldRecommendAttributes:r.Boolean({description:"Whether Tsuga should return suggested attributes to highlight in results."}),triggeredBy:r.Literal("refresh",{description:"Indicates the query was triggered by a refresh action."}),startOffset:r.Number({minimum:Lc,description:"Result offset used when fetching additional log rows."}),startOffsets:r.Array(r.Number({minimum:Lc}),{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 ${Lc} for every cluster.`}),clusterId:p({allowEmpty:!1,description:"ID of the cluster to target. Omit to use the default cluster."}),clusterIds:Ss,sortBy:OQ,sortDirection:te,useCanopy:r.Boolean()})),ost=d({tags:["logs"],url:`${Fo}/count`,method:"GET",query:r.Pick(Kn,["from","to","query","clusterId","clusterIds","useCanopy"]),response:r.Object({count:r.Number(),clusterResponses:r.Optional(xi())})}),kc=r.Object({value:r.String(),priority:r.Number()}),ist=d({tags:["logs"],url:`${Fo}/search`,method:"GET",query:Kn,response:r.Object({logs:r.Optional(r.Array(Vh)),attributesToHighlight:r.Optional(r.Array(kc)),clusterResponses:r.Optional(xi(r.Object({nextStartOffset:r.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})}),AQ=r.Cyclic({TokenOutput:r.Union([r.Object({type:r.Literal("top"),values:r.Array(r.String())}),r.Object({type:r.Literal("ip"),value:r.String()}),r.Object({type:r.Literal("range"),min:r.Number(),max:r.Number()}),r.Object({type:r.Literal("variable"),value:r.String()}),r.Object({type:r.Literal("text"),value:r.String()}),r.Object({type:r.Literal("date"),value:r.String()}),r.Object({type:r.Literal("url"),value:r.String()}),r.Object({type:r.Literal("structure"),key:r.Array(r.String()),value:r.Array(r.Ref("TokenOutput"))})])},"TokenOutput",{description:"A token identified as part of the pattern"}),xQ=r.Object({id:r.String(),pattern:r.Array(AQ),size:r.Integer({description:"Number of logs that matched the pattern"}),examples:r.Array(r.Object({id:r.String(),timestampUnix:r.Number()})),timeDistribution:r.Array(r.Number()),staticFeatures:r.Array(r.Object({key:r.String(),value:r.String()},{description:"Fixed groups present in all logs matching the pattern"}))}),ast=d({tags:["logs"],url:`${Fo}/patterns`,method:"GET",query:r.Object({...it.properties,query:p({type:"tsuga-query"}),clusteringThreshold:r.Optional(r.Number()),clusterId:r.Optional(p({allowEmpty:!1}))}),response:r.Object({patterns:r.Array(xQ),sampleSize:r.Number()})}),sst=d({tags:["logs"],url:`${Fo}/attributes`,method:"GET",query:r.Object({...it.properties,clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"})),clusterIds:r.Optional(Ss)}),response:r.Object({attributes:r.Array(r.String()),clusterResponses:r.Optional(xi())})});var TM="timestamp";var hM=`${TM}_iso`;var RQ=["pending","running","completed","incomplete","failed"],EM=r.Object({id:r.String({description:"ID of the export."}),status:r.Enum(RQ,{description:"Lifecycle of the export. `pending` until the download is claimed, `running` while the CSV streams, then `completed`, `incomplete` when the file is usable but some matched logs could not be reached, or `failed` if the export was interrupted."}),rowsWritten:r.Number({description:"Logs written to the CSV so far. Updated periodically while the download streams, so it lags slightly behind the bytes on the wire."}),totalRows:r.Number({description:"Logs this export will write, already clamped to the export maximum. Use it as the denominator for progress."}),isTruncated:r.Boolean({description:"Whether the query matched more logs than the export maximum, so the CSV holds only the first logs in the requested sort order."}),errorMessage:r.Optional(r.String({description:"Why the export is incomplete or failed."}))}),cst=d({tags:["logs"],url:`${Fo}/exports`,method:"POST",body:r.Object({...r.Pick(Kn,["from","to","query","clusterId","clusterIds","sortBy","sortDirection"]).properties,columns:r.Array(p({allowEmpty:!1}),{minItems:1,description:`Log attributes to write as CSV columns, in order. Each becomes one column, resolved against the log with dotted-path lookup. Including \`${TM}\` also writes a \`${hM}\` column next to it, holding the same instant in ISO 8601.`}),timezone:r.Optional(r.String({format:mo,description:`IANA timezone the \`${hM}\` column is offset to (e.g. \`Europe/Paris\`). Defaults to UTC.`}))}),response:r.Object({...EM.properties,downloadUrl:r.String({description:"Relative URL to fetch the CSV from. It carries a single-use token that expires shortly after creation, so the caller must start the download immediately."})})}),pst=d({tags:["logs"],url:`${Fo}/exports/:exportId`,method:"GET",params:r.Object({exportId:r.String()}),response:EM}),ust=d({tags:["logs"],url:`${Fo}/exports/:exportId/download`,method:"GET",params:r.Object({exportId:r.String()}),query:r.Object({token:p({allowEmpty:!1,description:"Single-use token minted when the export was created."})}),response:r.String({description:"CSV file, streamed as it is produced."})});var Mc=`/${"v1"}/logs`,Qh=r.Object({context:r.Optional(r.Object({team:r.Optional(r.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."})),...r.Pick(Vh,["message","timestamp","level"]).properties},{additionalProperties:!0,$id:"LogEvent",description:"Log event including message, timestamp, severity level, and optional enriched context attributes."}),CQ={context:{team:"platform"},message:"Request completed successfully",timestamp:17040672e5,level:"INFO"};Object.assign(Qh,{examples:[CQ]});var _M=r.Object({query:r.Optional(p({type:"tsuga-query",default:"*",description:"Tsuga query selecting logs to return. Omit to search all logs with `*`."})),maxResults:r.Optional(r.Integer({minimum:1,maximum:1e3,default:yM,description:"Maximum number of logs to return. Defaults to 100. Valid values are 1 through 1000."})),clusterId:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),...Tt.properties},{description:"Log search query. Provide a time range, optional Tsuga query, and optional limit."}),PQ={query:"level:ERROR",maxResults:100,from:1704067200,to:1704070800};Object.assign(_M,{examples:[PQ]});var IM=d({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:`${Mc}/search`,method:"GET",query:_M,response:r.Object({logs:r.Array(Qh,{description:"Log events matching the query and time range."})})}),UQ=r.Object({pattern:r.String({description:"Clustered log pattern formatted as a readable string."}),size:r.Integer({description:"Number of logs that matched the pattern"}),groups:r.Array(r.Object({key:r.String({description:"Attribute dot-path shared by all logs in the pattern."}),value:r.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`."}))}),SM=r.Object({patterns:r.Array(UQ,{description:"Log patterns clustered from logs matching the query."}),sampleSize:r.Number({description:"Number of logs sampled while computing patterns."})},{}),wQ={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(SM,{examples:[wQ]});var bM=d({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:`${Mc}/patterns`,method:"GET",query:r.Object({...Tt.properties,query:p({type:"tsuga-query",description:"Tsuga query selecting logs to cluster into patterns."}),clusterId:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:SM}),vQ=r.Object({exampleLog:r.Optional(Qh),team:r.String({description:"Team associated with the new error pattern."}),env:r.String({description:"Environment associated with the new error pattern."}),service:r.String({description:"Service associated with the new error pattern."}),firstSeen:r.Number({description:"Unix timestamp in seconds when this pattern was first seen."}),lastSeen:r.Number({description:"Unix timestamp in seconds when this pattern was last seen."})}),OM=r.Object({newErrorPatterns:r.Array(vQ,{description:"Error patterns first seen in the requested time range."})},{}),NQ={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(OM,{examples:[NQ]});var AM=d({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:`${Mc}/patterns/new`,method:"GET",query:r.Object({...Tt.properties,team:r.Optional(p({description:"Team name to restrict pattern detection to."})),env:r.Optional(p({description:"Environment to restrict pattern detection to."})),service:r.Optional(p({description:"Service name to restrict pattern detection to."})),clusterId:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:OM}),LQ=r.Object({team:r.String({description:"Team associated with the error pattern. Set from the log context used during pattern analysis. Returned for every pattern increase."}),env:r.String({description:"Environment associated with the error pattern. Set from the log context used during pattern analysis. Returned for every pattern increase."}),pattern:r.String({description:"Readable representation of the grouped error log pattern. Generated by Tsuga from matching log messages and returned for every pattern increase."}),increaseTimestamps:r.Array(r.Number({description:"Unix timestamp in milliseconds of a detected spike in this pattern. Tsuga computes these timestamps during pattern-increase analysis; one entry is returned for each spike in the requested time range."}))}),xM=r.Object({errorPatternIncreases:r.Array(LQ,{description:"Error patterns with increased occurrence in the requested time range."})},{}),kQ={errorPatternIncreases:[{team:"platform",env:"production",pattern:"Non-resolved segment SegmentId(*) from cache",increaseTimestamps:[17041536e5,17042392e5]}]};Object.assign(xM,{examples:[kQ]});var RM=d({description:"Finds error patterns whose occurrence increased for a team in the requested time range. Use this to identify growing failure modes without retrieving raw log events. See [Logs](/documentation/explore/logs).",operationId:"getErrorPatternIncrease",tags:["public","logs"],url:`${Mc}/patterns/increase`,method:"GET",query:r.Object({...Tt.properties,team:p({allowEmpty:!1,description:"Team name to analyze for pattern increases. Required; match it to the `context.team` value on the logs you want Tsuga to inspect."}),env:r.Optional(p({allowEmpty:!1,description:"Environment to restrict the analysis to. Optional; match it to the `context.env` value on the logs, or omit it to analyze all environments for the team."})),clusterId:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:xM}),CM=r.Object({attributes:r.Array(r.String(),{description:"Log attribute dot-paths observed in the time range"})},{}),MQ={attributes:["context.env","context.k8s.pod.name","context.service.name","context.team","level","message","timestamp"]};Object.assign(CM,{examples:[MQ]});var DQ=r.Object({...Tt.properties,clusterId:r.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."}),PM=d({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:`${Mc}/attributes`,method:"GET",query:DQ,response:CM});var sn="/v0/metrics",GQ=r.Object({__tsuga_metadata__:r.Object({},{additionalProperties:!0}),context:r.Optional(r.Object({},{additionalProperties:!0})),message:r.Optional(r.String()),timestamp:r.Number(),level:r.Enum(Yh)},{additionalProperties:!0}),Ost=d({tags:["metrics"],url:`${sn}/count`,method:"GET",query:r.Pick(Kn,["from","to","query","clusterId"]),response:r.Object({count:r.Number()})}),Ast=d({tags:["metrics"],url:`${sn}/search`,method:"GET",query:Kn,response:r.Object({logs:r.Optional(r.Array(GQ)),totalHits:r.Optional(r.Number()),attributesToHighlight:r.Optional(r.Array(kc))},{additionalProperties:!0})}),Xl=r.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."}),Wh=r.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."}),UM=r.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."}),wM=r.Array(r.String(),{description:"Team values observed on this metric across the most recent data generations kept by the metric catalog. Omitted when the catalog has no team statistics for the metric yet."}),$Q=r.Number({description:"Estimated number of distinct series for this metric across the most recent data generations kept by the metric catalog. Omitted when the catalog has no statistics for the metric yet."}),FQ=r.Record(r.String(),r.Number(),{description:"Estimated number of distinct values per attribute over the same window as `seriesCardinality`, keyed like `tags`."}),jQ=r.Object({capabilities:r.Optional(r.Array(r.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:r.Optional(r.String({description:"Human-readable description of the metric"})),tags:r.Optional(r.Array(r.String(),{description:"Attribute names available as dimensions for filtering or grouping this metric. Exposed publicly as `attributes`."})),temporality:r.Optional(Wh),type:r.Optional(Xl),unit:r.Optional(r.String({description:"Metric unit reported by instrumentation or inferred metadata."})),lastSeen:r.Optional(UM),teams:r.Optional(wM),seriesCardinality:r.Optional($Q),attributeCardinalities:r.Optional(FQ)}),xst=d({url:`${sn}/metadata`,method:"GET",query:r.Object({...it.properties,metricName:p({allowEmpty:!1}),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:jQ}),Rst=d({tags:["metrics"],url:sn,method:"GET",query:r.Object({...it.properties,clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:r.Array(r.String())}),Jl=r.Array(r.Object({name:r.String({description:"Metric name observed by Tsuga."}),type:Xl,lastSeen:r.Optional(UM),teams:r.Optional(wM)}),{description:"Metrics observed in the requested time range, with the instrument type each was reported as."}),qQ=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Jl,{examples:[qQ]});var Cst=d({tags:["metrics"],url:`${sn}/names-and-types`,method:"GET",query:r.Object({...it.properties,clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Jl}),Dc=r.Array(r.String(),{description:"Attribute names available as dimensions for filtering or grouping the requested metric(s)."}),BQ=["service","env","host","method","status_code"];Object.assign(Dc,{examples:[BQ]});var Pst=d({tags:["metrics"],url:`${sn}/attributes`,method:"GET",query:r.Object({...it.properties,metricName:p({allowEmpty:!1}),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Dc}),Ust=d({tags:["metrics"],url:`${sn}/attributes/batch`,method:"GET",query:r.Object({...it.properties,metricNames:r.Array(p({allowEmpty:!1}),{minItems:1,description:"Metric names to fetch attributes for"}),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Dc}),Zh=r.Object({assets:r.Array(r.Object({type:r.Enum(["dashboard","monitor"],{description:"Kind of asset referencing the metric."}),id:r.String({description:"Dashboard or monitor ID for the asset that queries this metric."}),name:r.String({description:"Display name of the referencing dashboard or monitor."}),owner:r.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."})}),wst=d({tags:["metrics"],url:`${sn}/assets-usage`,method:"GET",query:r.Object({metricName:p({allowEmpty:!1})}),response:Zh}),vst=d({url:`${sn}/per-attribute`,method:"GET",query:r.Object({from:r.Optional(r.Number()),to:r.Optional(r.Number()),attribute:p(),clusterId:r.Optional(p({allowEmpty:!1}))}),response:r.Array(r.String())});var Xh=`/${"v1"}/metrics`,HQ=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Jl,{examples:[HQ]});var Jh=r.Object({name:r.String({description:"Metric name observed by Tsuga. Use this value in metric queries and aggregations."}),type:Xl,description:r.Optional(r.String({description:"Human-readable description of what the metric measures, set by the reporting instrumentation. Omitted when the instrumentation did not provide one."})),unit:r.Optional(r.String({description:"Metric unit reported by instrumentation or inferred metadata."})),temporality:r.Optional(Wh),capabilities:r.Optional(r.Array(r.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:r.Optional(r.Array(r.String(),{description:"Metric attribute names available as dimensions for filtering or grouping."}))}),KQ={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(Jh,{examples:[KQ]});var vM=r.Object({...Tt.properties,clusterId:r.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."}),NM=d({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:Xh,method:"GET",query:vM,response:r.Array(Jh)}),LM=d({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:`${Xh}/:name`,method:"GET",params:r.Object({name:p({allowEmpty:!1,description:"Metric name to retrieve, for example `http.server.request.duration`."})}),query:vM,response:Jh}),zQ=["service","env","host","method","status_code"];Object.assign(Dc,{examples:[zQ]});var kM=r.Pick(Zh,["assets"]),YQ={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(kM,{examples:[YQ]});var MM=d({description:"Retrieve dashboards and monitors that use a specific metric",operationId:"getMetricAssetsUsage",tags:["private"],url:`${Xh}/assets-usage`,method:"GET",query:r.Object({metricName:p({allowEmpty:!1,description:"The name of the metric to find usage for"})}),response:kM});var zn="/v0/traces",zst=d({tags:["traces"],url:`${zn}/count`,method:"GET",query:r.Pick(Kn,["from","to","query","clusterId","useCanopy"]),response:r.Object({count:r.Number()})}),VQ=["unset","ok","error"],QQ=r.Enum(VQ),WQ=["unspecified","internal","server","client","producer","consumer"],ZQ=r.Enum(WQ),GM=r.Object({__tsuga_metadata__:r.Optional(r.Object({},{additionalProperties:!0})),context:r.Optional(r.Object({telemetry:r.Optional(r.Object({sdk:r.Optional(r.Object({language:r.Optional(r.String())},{additionalProperties:!0}))},{additionalProperties:!0})),tag_policy_warnings:r.Optional(r.Record(r.String(),r.String())),service:r.Optional(r.Object({name:r.Optional(r.String()),version:r.Optional(r.String())},{additionalProperties:!0})),env:r.Optional(r.String())},{additionalProperties:!0})),parent_span_id:r.Optional(r.String()),resource_attributes:r.Object({},{additionalProperties:!0}),span_attributes:r.Object({},{additionalProperties:!0}),duration:r.Number({description:"In milliseconds."}),duration_ns:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),start_time:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),end_time:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),error:r.Optional(r.Object({message:r.String()})),events:r.Optional(r.Array(r.Object({event_attributes:r.Object({},{additionalProperties:!0}),event_name:r.String(),event_timestamp_nanos:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."})}))),links:r.Optional(r.Array(r.Object({},{additionalProperties:!0}))),span_id:r.String(),span:r.Object({kind:ZQ,name:r.String()}),status_code:r.Optional(QQ),trace_id:r.String()}),$M=100,XQ="start_time",JQ="duration_ns",e8=r.Union([r.Literal(XQ),r.Literal(JQ)]),t8={...it.properties,query:r.Optional(p({type:"tsuga-query"})),maxResults:r.Optional(r.Integer({minimum:1,maximum:1e4})),shouldRecommendAttributes:r.Optional(r.Boolean()),startOffset:r.Optional(r.Number({minimum:Lc})),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"})),sortBy:r.Optional(e8),sortDirection:r.Optional(te),useCanopy:r.Optional(r.Boolean())},Yst=d({tags:["traces"],url:`${zn}/search`,method:"GET",query:r.Object(t8),response:r.Object({spans:r.Optional(r.Array(GM)),attributesToHighlight:r.Optional(r.Array(kc))})});var r8=r.Object({groupByAttributes:r.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:r.Integer({minimum:2,description:"Minimum leaf-group size before aggregation occurs. Default 5."}),maxParentDepth:r.Integer({minimum:-1,description:"Max depth of recursive parent aggregation. 0 = leaves only, -1 = unlimited (default)."}),aggregationHistogramBucketsSeconds:r.Array(r.Number({minimum:0}),{description:"Upper bounds for the latency histogram in seconds. Empty array disables the histogram attributes."}),sortSpans:r.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."})}),n8=r.Object({...it.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"})),...r.Partial(r8).properties}),Vst=d({tags:["traces"],url:`${zn}/summarize`,method:"GET",query:n8,response:r.Object({spans:r.Array(GM)})}),Qst=d({tags:["traces"],url:`${zn}/attributes`,method:"GET",query:r.Object({...it.properties,clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:r.Object({attributes:r.Array(r.String())})}),o8=r.Object({key:r.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:r.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:r.Optional(r.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:r.Optional(r.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:r.Optional(r.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."}))}),i8=r.Object({fromNs:r.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:r.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:r.String({description:"Range duration in nanoseconds, computed as `toNs - fromNs`. Transmitted as a string to avoid losing precision."}),contributions:r.Array(r.Object({serviceKey:r.String({description:"Contributing service key for this range. References `services[].key` in the same response."}),weight:r.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:r.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:r.Array(r.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."})}),a8=r.Object({serviceKey:r.String({description:"Contributing service key for this aggregate total. References `services[].key` in the same response."}),durationNs:r.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:r.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."})}),ty=r.Optional(r.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."})),ry=r.Optional(r.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."})),em=r.Object({traceId:r.String({description:"Trace ID summarized by the response. Echoes the required `traceId` query parameter."}),startTimeNs:r.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:r.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:r.String({description:"Total fetched trace duration in nanoseconds, computed as `endTimeNs - startTimeNs`. Transmitted as a string to avoid losing precision."}),truncated:r.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:r.Array(o8,{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:r.Array(i8,{description:"Sequential trace timeline split into ranges wherever the active leaf-span set changes. Empty when the request sets `includeRanges` to false."}),serviceTotals:r.Array(a8,{description:"Aggregated wall-clock contribution per service across the fetched trace. Use this for service-level latency ownership without processing the per-range timeline."})}),s8={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(em,{examples:[s8]});var Wst=d({tags:["traces"],url:`${zn}/latency-summary`,method:"GET",query:r.Object({...it.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"})),minRangeDurationMs:ty,includeRanges:ry}),response:em}),c8=r.Object({traceId:r.String(),spanId:r.String()}),Zst=d({tags:["traces"],url:`${zn}/span-backlinks`,method:"GET",query:r.Object({...it.properties,traceId:p({allowEmpty:!1,description:"Trace ID referenced by span links"}),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:r.Object({backlinks:r.Array(r.Object({spanId:r.String(),references:r.Array(c8)})),truncated:r.Boolean()})}),DM=r.Object({filter:p({type:"tsuga-query",description:"TQL filter defining the group"}),timeRange:Un}),p8=r.Object({value:r.String(),supportA:r.Number(),supportB:r.Number()}),u8=r.Object({value:r.String(),supportA:r.Number(),supportB:r.Number(),lift:r.Union([r.Number(),r.Null()]),pValue:r.Number()}),l8=r.Object({attr:r.String(),values:r.Array(u8),otherValues:r.Array(p8)}),ey=r.Object({contrastSets:r.Array(l8),groupACount:r.Number(),groupBCount:r.Number(),failedAttributeCount:r.Number()}),FM=r.Object({groupA:DM,groupB:DM,candidateAttrs:r.Optional(r.Array(p({allowEmpty:!1}))),topK:r.Optional(r.Integer({minimum:1,maximum:100})),minLift:r.Optional(r.Number({minimum:1})),minSupport:r.Optional(r.Number({minimum:0,maximum:100})),clusterId:r.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),Xst=d({tags:["traces"],url:`${zn}/contrast-sets`,method:"POST",body:FM,response:ey}),m8=R("type",[r.Object({type:r.Literal("snapshot"),response:ey}),r.Object({type:r.Literal("done"),response:ey}),r.Object({type:r.Literal("error"),message:r.String()})]),Jst=d({tags:["traces"],url:`${zn}/contrast-sets/stream`,method:"POST",body:FM,response:m8});var ny=`/${"v1"}/traces`,oy=r.Object({context:r.Optional(r.Object({service:r.Optional(r.Object({name:r.Optional(r.String({description:"Service name associated with the span."})),version:r.Optional(r.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:r.Optional(r.String({description:"`spanId` of this span's parent within the same trace. Absent for the root span."})),resourceAttributes:r.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:r.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:r.Number({description:"Span duration in milliseconds, derived from the nanosecond `startTime` and `endTime` values."}),startTime:r.String({description:"Span start time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),endTime:r.String({description:"Span end time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),error:r.Optional(r.Object({message:r.String({description:"Error message associated with the span."})},{description:"Error details associated with the span, separate from the OpenTelemetry `statusCode` field."})),events:r.Optional(r.Array(r.Object({event_attributes:r.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:r.String({description:"Name of the span event."}),event_timestamp_nanos:r.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:r.String({description:"Unique span ID within the trace."}),span:r.Object({kind:r.String({description:"OpenTelemetry span kind describing the relationship to remote calls: `unspecified`, `internal`, `server`, `client`, `producer`, or `consumer`."}),name:r.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:r.Optional(r.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:r.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."}),d8={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(oy,{examples:[d8]});var f8={from:1704067200,to:1704070800,query:"context.service.name:my-service",maxResults:100},jM=r.Object({...Tt.properties,query:r.Optional(p({type:"tsuga-query",default:"*",description:"Tsuga query selecting spans to return. Omit to search all spans in the range with `*`."})),maxResults:r.Optional(r.Integer({minimum:1,maximum:1e4,default:$M,description:"Maximum number of spans to return. Defaults to 100. Valid values are 1 through 10000."})),clusterId:r.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(jM,{examples:[f8]});var qM=d({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:`${ny}/search`,method:"GET",query:jM,response:r.Object({spans:r.Array(oy,{description:"Spans matching the query and time range."})})}),g8={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},BM=r.Object({...Tt.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:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),groupByAttributes:r.Optional(r.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:r.Optional(r.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:r.Optional(r.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:r.Optional(r.Array(r.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:r.Optional(r.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(BM,{examples:[g8]});var HM=d({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:`${ny}/summarize`,method:"GET",query:BM,response:r.Object({spans:r.Array(oy,{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`."})})}),h8={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},KM=r.Object({...Tt.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:r.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),minRangeDurationMs:ty,includeRanges:ry},{description:"Trace latency summary query. Provide a trace ID, a time range covering the trace, and optional timeline tuning."});Object.assign(KM,{examples:[h8]});var zM=d({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:`${ny}/latency-summary`,method:"GET",query:KM,response:em});var QM=["timestamp","level","message"],WM=["count","ratio","team","level","pattern"];function Et(e,t){let n=t??rr(e);if(!n)throw new Error(`--${e} is required`);return zo(n)}function YM(e){let t={from:Et("from",e.from),to:Et("to",e.to)},n=e.query??rr("query");n!==void 0&&(t.query=n);let o=e.maxResults??rr("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})`);t.maxResults=i}return t}function Ge(e){let t=rr(e);return t===void 0?"":` (default: ${t})`}function y8(e){let t=ms(e.output),n=e.fields===void 0?void 0:ds(e.fields);return t==="json"?{format:t,fields:n}:{format:t,fields:n??QM}}function T8(e){let t=ms(e.output),n=e.fields===void 0?void 0:ds(e.fields);return t==="json"?{format:t,fields:n}:{format:t,fields:n??WM}}function VM(e,t){let n={count:e.size,ratio:t>0?e.size/t: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 E8(e,t){if(t.format==="json"){if(t.fields===void 0){Q(e);return}let{fields:i}=t;Q({patterns:e.patterns.map(a=>VM(a,e.sampleSize)).map(a=>fs(a,i)),sampleSize:e.sampleSize});return}let n=e.patterns.map(i=>VM(i,e.sampleSize)),o=gs(t.format,n,t.fields);o.length>0&&z(o)}function _8(e,t){if(t.format==="json"){if(t.fields===void 0){Q(e);return}let{fields:o}=t;Q({logs:e.logs.map(i=>fs(i,o))});return}let n=gs(t.format,e.logs,t.fields);n.length>0&&z(n)}function ZM(e,t){let n=e.command("logs").description("Search and analyze logs");n.command("search").description("Search logs").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs${Ge("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-1000${Ge("max-results")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each log (default for --output=tsv|csv: ${QM.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=y8(c),m=await t()(IM,{query:YM(c)});_8(m,l)}),n.command("attributes").description("List log attribute dot-paths observed in the time range").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async c=>{let l=await t()(PM,{query:{from:Et("from",c.from),to:Et("to",c.to)}});Q(l)}),n.command("patterns").description("List log patterns").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs before clustering into patterns${Ge("query")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each pattern (default for --output=tsv|csv: ${WM.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=T8(c),m={from:Et("from",c.from),to:Et("to",c.to)},f=c.query??rr("query");f!==void 0&&(m.query=f);let h=await t()(bM,{query:m});E8(h,l)}),n.command("new-error-patterns").description("List error patterns first seen in this time range").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("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:Et("from",c.from),to:Et("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 m=await t()(AM,{query:l});Q(m)}),n.command("error-pattern-increases").description("List error pattern increases for a given team").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).requiredOption("--team <TEAM_NAME>","Team to query").option("--env <ENV_NAME>","Filter by environment").action(async c=>{let l={from:Et("from",c.from),to:Et("to",c.to),team:c.team};c.env!==void 0&&(l.env=c.env);let m=await t()(RM,{query:l});Q(m)});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${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async c=>{let l=await t()(NM,{query:{from:Et("from",c.from),to:Et("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${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async(c,l)=>{let m=await t()(LM,{params:{name:c},query:{from:Et("from",l.from),to:Et("to",l.to)}});Q(m)}),o.command("assets-usage <METRIC_NAME>").description("List dashboards and monitors that use a specific metric").action(async c=>{let l=await t()(MM,{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${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter spans${Ge("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-10000${Ge("max-results")}`).action(async c=>{let l=await t()(qM,{query:YM(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${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async c=>{let l=await t()(HM,{query:{traceId:c.traceId,from:Et("from",c.from),to:Et("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${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("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:Et("from",c.from),to:Et("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 m=await t()(zM,{query:l});Q(m)});let a=e.command("aggregation").description("Run aggregation queries");yr(a,"scalar","Run aggregation queries and return scalar results",aC,t),yr(a,"timeseries","Run aggregation queries and return timeseries results",cC,t)}var I8="x-tsuga-session-id",iy="x-tsuga-source",ay="x-tsuga-source-version",sy="x-tsuga-source-commit",cy="x-tsuga-source-date",py="x-tsuga-rationale",S8="x-tsuga-dashboard-id",b8="x-tsuga-widget-id",O8="x-request-id",Tct={[I8]:"Session identifier for request correlation",[iy]:"SDK or client source identifier (e.g., web-frontend, terraform-provider)",[ay]:"SDK version",[sy]:"SDK commit hash",[cy]:"SDK commit date",[py]:"Optional caller-supplied rationale for this request, recorded for telemetry",[S8]:"ID of the dashboard a query is issued from, when the request originates from a dashboard widget",[b8]:"ID of the dashboard widget (graph) a query is issued from, when the request originates from a dashboard widget",[O8]:"Unique identifier for this API request, useful for debugging and support"};function A8(e){return e.replace(/\s+/g," ").replace(/[^\x20-\x7e\x80-\xff]/g,"").trim()}function XM(e,t,n,o){return async function(a,c={}){let{body:l,params:m,query:f}=c,h;if(a.url!==void 0)h=a.url;else if(a.buildUrl){if(!m)throw new nr("Internal error: params required for this endpoint");h=a.buildUrl(m)}else throw new nr("Internal error: endpoint has neither url nor buildUrl");let E=n===void 0?f:{clusterId:n,...f},I=kA(`${e}${h}`,E),g={Accept:"application/json",Authorization:`Bearer ${t}`,[iy]:"cli",[ay]:"1.31.0",[sy]:"d835bcb93f",[cy]:"2026-09-16T10:25:09.739Z"};l&&(g["Content-Type"]="application/json");let T=o?.(),O=T?A8(T):"";O&&(g[py]=O);let b=await fetch(I,{method:a.method,headers:g,body:l?JSON.stringify(l):null}),x;try{x=await b.json()}catch{throw new nr(b.status===504?"The server timed out (504). Try a smaller time range.":`Server returned a non-JSON response (HTTP ${b.status}).`,b.status)}if(x.error)throw nr.fromErrorResponse(x.error,x.requestId);return R8(x,x8(c)),x.data}}function x8({body:e,query:t}){let n=t?.offset??e?.offset;return typeof n=="number"?n:0}function R8(e,t){let n=e.metadata?.pagination;if(n===void 0||!Array.isArray(e.data))return;let o=t+e.data.length;o>=n.totalCount||_x(`Showing ${e.data.length} of ${n.totalCount} (offset ${t}). Use --limit (max ${yi}) and --offset ${o} for the next page.`)}function uy(e,t=n=>{process.exit(n)}){e.on("error",n=>{if(n.code==="EPIPE"){t(process.exitCode);return}throw n})}var C8=3e3,P8="https://registry.npmjs.org/@tsuga/cli/latest";function U8(e,t){let n=e.split(".").map(Number),o=t.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 JM(e){try{let t=nR();if(t&&Date.now()-new Date(t).getTime()<Hc)return;let n=await fetch(P8,{signal:AbortSignal.timeout(C8)});if(!n.ok)return;let i=(await n.json()).version;U8(i,e)&&(process.stderr.write(`
176
176
  Update available: ${e} \u2192 ${i}
177
- `),process.stderr.write("Run `tsuga self-update` to update\n")),rR(new Date().toISOString())}catch{}}cy(process.stdout);cy(process.stderr);var Ae=new Fo().name("tsuga").description("Manage Tsuga resources, telemetry, and configuration from the command line").version("1.30.0").addHelpText("before",()=>`${qA()}
178
- `).configureHelp({sortSubcommands:!0}).helpOption("-h, --help","Display help for command").helpCommand("help [command]","Display help for command").option("--cluster <CLUSTER_ID>","Target cluster (overrides config and TSUGA_CLUSTER_ID)"),Ta,WM;function sr(){if(Ta)return Ta;let e=Ae.opts(),t=Si({clusterId:e.cluster}),n=zx(t);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>"),process.exit(1));let o=l=>VM(t.apiUrl,l,t.clusterId,()=>WM),{credential:i}=t;if(i?.kind!=="user-session")return Ta=o(n),Ta;let a=i.userAuth,c=o(a.accessToken);return Ta=async(l,m)=>{let f=await uu({userAuth:a,now:new Date,reload:Es,refresh:h=>cu(t.apiUrl,h),persist:Ou});return f!==a&&(a=f,c=o(a.accessToken)),c(l,m)},Ta}var ZM="Setup & config:",XM="Documentation, help & feedback:";Ae.commandsGroup(ZM);iR(Ae,sr);zR(Ae);var I8=new Set(Ae.commands);Ae.commandsGroup("Resources:");tM(Ae,sr);Ae.commandsGroup("Query & explore:");YM(Ae,sr);uv(Ae,sr);fv(Ae,sr);_v(Ae,sr);Jv(Ae,sr);tN(Ae,sr);Iw(Ae,sr);Ae.commandsGroup(XM);XR(Ae,sr);Aw(Ae,sr);Ae.commandsGroup(ZM);qR(Ae,sr);dM(Ae);Tv(Ae);nM(Ae);KR(Ae);Ae.commandsGroup(XM).helpCommand("help [command]");function JM(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 t of e.commands)JM(t)}var S8=new Set(["completion","self-update","install","setup","feedback"]);for(let e of Ae.commands)!I8.has(e)&&!S8.has(e.name())&&JM(e);Ae.hook("preAction",(e,t)=>{let{rationale:n}=t.opts();WM=n});Ae.parseAsync().then(()=>QM("1.30.0")).catch(e=>{console.error(uC(e)),process.exitCode=1});
177
+ `),process.stderr.write("Run `tsuga self-update` to update\n")),oR(new Date().toISOString())}catch{}}uy(process.stdout);uy(process.stderr);var Ae=new jo().name("tsuga").description("Manage Tsuga resources, telemetry, and configuration from the command line").version("1.31.0").addHelpText("before",()=>`${HA()}
178
+ `).configureHelp({sortSubcommands:!0}).helpOption("-h, --help","Display help for command").helpCommand("help [command]","Display help for command").option("--cluster <CLUSTER_ID>","Target cluster (overrides config and TSUGA_CLUSTER_ID)"),_a,e0;function cr(){if(_a)return _a;let e=Ae.opts(),t=Oi({clusterId:e.cluster}),n=Vx(t);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>"),process.exit(1));let o=l=>XM(t.apiUrl,l,t.clusterId,()=>e0),{credential:i}=t;if(i?.kind!=="user-session")return _a=o(n),_a;let a=i.userAuth,c=o(a.accessToken);return _a=async(l,m)=>{let f=await lu({userAuth:a,now:new Date,reload:_s,refresh:h=>pu(t.apiUrl,h),persist:xu});return f!==a&&(a=f,c=o(a.accessToken)),c(l,m)},_a}var t0="Setup & config:",r0="Documentation, help & feedback:";Ae.commandsGroup(t0);sR(Ae,cr);VR(Ae);var w8=new Set(Ae.commands);Ae.commandsGroup("Resources:");nM(Ae,cr);Ae.commandsGroup("Query & explore:");ZM(Ae,cr);mv(Ae,cr);hv(Ae,cr);Sv(Ae,cr);tN(Ae,cr);nN(Ae,cr);bw(Ae,cr);Ae.commandsGroup(r0);eC(Ae,cr);Rw(Ae,cr);Ae.commandsGroup(t0);HR(Ae,cr);gM(Ae);_v(Ae);iM(Ae);YR(Ae);Ae.commandsGroup(r0).helpCommand("help [command]");function n0(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 t of e.commands)n0(t)}var v8=new Set(["completion","self-update","install","setup","feedback"]);for(let e of Ae.commands)!w8.has(e)&&!v8.has(e.name())&&n0(e);Ae.hook("preAction",(e,t)=>{let{rationale:n}=t.opts();e0=n});Ae.parseAsync().then(()=>JM("1.31.0")).catch(e=>{console.error(mC(e)),process.exitCode=1});
179
179
  /**
180
180
  * The following is a list of HTTP status codes and their meanings.
181
181
  *