clawpro-diagnostics-metrics-cls 3.0.2 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,71 +1,17 @@
1
- var Sx=Object.create;var ir=Object.defineProperty;var Ex=Object.getOwnPropertyDescriptor;var Ix=Object.getOwnPropertyNames;var Rx=Object.getPrototypeOf,kx=Object.prototype.hasOwnProperty;var Y=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Q=(t,e)=>()=>(t&&(e=t(t=0)),e);var k=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ox=(t,e)=>{for(var n in e)ir(t,n,{get:e[n],enumerable:!0})},nl=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ix(e))!kx.call(t,r)&&r!==n&&ir(t,r,{get:()=>e[r],enumerable:!(i=Ex(e,r))||i.enumerable});return t};var ii=(t,e,n)=>(n=t!=null?Sx(Rx(t)):{},nl(e||!t||!t.__esModule?ir(n,"default",{value:t,enumerable:!0}):n,t)),Cx=t=>nl(ir({},"__esModule",{value:!0}),t);var xt=k(gt=>{"use strict";gt.getValueAsString=function(e){return Number.isNaN(e)?"Nan":Number.isFinite(e)?`${e}`:e<0?"-Inf":"+Inf"};gt.removeLabels=function(e,n,i){let r=Is(n,i);delete e[r]};gt.setValue=function(e,n,i){let r=Is(i);return e[r]={value:typeof n=="number"?n:0,labels:i||{}},e};gt.setValueDelta=function(e,n,i,r=""){let s=typeof n=="number"?n:0;return e[r]?e[r].value+=s:e[r]={value:s,labels:i},e};gt.getLabels=function(t,e){if(typeof e[0]=="object")return e[0];if(t.length!==e.length)throw new Error(`Invalid number of arguments (${e.length}): "${e.join(", ")}" for label names (${t.length}): "${t.join(", ")}".`);let n={};for(let i=0;i<t.length;i++)n[t[i]]=e[i];return n};function il(t,e){if(t.length===0)return"";let n="";for(let i=0;i<t.length;i++){let r=t[i],s=e[r];s!==void 0&&(n+=`${r}:${s},`)}return n}function Is(t,e){if(e)return il(e,t);let n=Object.keys(t);return n.length>1&&n.sort(),il(n,t)}gt.hashObject=Is;gt.isObject=function(e){return e!==null&&typeof e=="object"};gt.nowTimestamp=function(){return Date.now()/1e3};var Es=class extends Map{add(e,n){this.has(e)?this.get(e).push(n):this.set(e,[n])}};gt.Grouper=Es});var yn=k((GS,Os)=>{"use strict";var{getValueAsString:rl}=xt(),rr=class t{static get PROMETHEUS_CONTENT_TYPE(){return"text/plain; version=0.0.4; charset=utf-8"}static get OPENMETRICS_CONTENT_TYPE(){return"application/openmetrics-text; version=1.0.0; charset=utf-8"}constructor(e=t.PROMETHEUS_CONTENT_TYPE){if(this._metrics={},this._collectors=[],this._defaultLabels={},e!==t.PROMETHEUS_CONTENT_TYPE&&e!==t.OPENMETRICS_CONTENT_TYPE)throw new TypeError(`Content type ${e} is unsupported`);this._contentType=e}getMetricsAsArray(){return Object.values(this._metrics)}async getMetricsAsString(e){let n=typeof e.getForPromString=="function"?await e.getForPromString():await e.get(),i=ks(n.name),r=`# HELP ${i} ${ks(n.help)}`,s=`# TYPE ${i} ${n.type}`,a=[r,s],o=Object.keys(this._defaultLabels).length>0?this._defaultLabels:null,c=this.contentType===t.OPENMETRICS_CONTENT_TYPE;for(let l of n.values||[]){let{metricName:u=i,labels:f={}}=l,{sharedLabels:x={}}=l;c&&n.type==="counter"&&(u=`${u}_total`),o&&(f={...f,...o,...f});let S=Rs(f,x),b=Nx(x),w=[...S,b].filter(Boolean),g=w.length?`{${w.join(",")}}`:"",C=`${u}${g} ${rl(l.value)}`,{exemplar:z}=l;if(z&&c){let q=Rs(z.labelSet);C+=` # {${q.join(",")}} ${rl(z.value)} ${z.timestamp}`}a.push(C)}return a.join(`
2
- `)}async metrics(){let e=this.contentType===t.OPENMETRICS_CONTENT_TYPE,n=this.getMetricsAsArray().map(r=>(e&&r.type==="counter"&&(r.name=Lx(r.name)),this.getMetricsAsString(r))),i=await Promise.all(n);return e?`${i.join(`
1
+ var jl=Object.create;var bn=Object.defineProperty;var Ul=Object.getOwnPropertyDescriptor;var ql=Object.getOwnPropertyNames;var Fl=Object.getPrototypeOf,Kl=Object.prototype.hasOwnProperty;var ne=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var A=(t,e)=>()=>(t&&(e=t(t=0)),e);var B=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Gl=(t,e)=>{for(var n in e)bn(t,n,{get:e[n],enumerable:!0})},xo=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ql(e))!Kl.call(t,s)&&s!==n&&bn(t,s,{get:()=>e[s],enumerable:!(r=Ul(e,s))||r.enumerable});return t};var Oo=(t,e,n)=>(n=t!=null?jl(Fl(t)):{},xo(e||!t||!t.__esModule?bn(n,"default",{value:t,enumerable:!0}):n,t)),Vl=t=>xo(bn({},"__esModule",{value:!0}),t);var Ce=B(Re=>{"use strict";Re.getValueAsString=function(e){return Number.isNaN(e)?"Nan":Number.isFinite(e)?`${e}`:e<0?"-Inf":"+Inf"};Re.removeLabels=function(e,n,r){let s=yr(n,r);delete e[s]};Re.setValue=function(e,n,r){let s=yr(r);return e[s]={value:typeof n=="number"?n:0,labels:r||{}},e};Re.setValueDelta=function(e,n,r,s=""){let o=typeof n=="number"?n:0;return e[s]?e[s].value+=o:e[s]={value:o,labels:r},e};Re.getLabels=function(t,e){if(typeof e[0]=="object")return e[0];if(t.length!==e.length)throw new Error(`Invalid number of arguments (${e.length}): "${e.join(", ")}" for label names (${t.length}): "${t.join(", ")}".`);let n={};for(let r=0;r<t.length;r++)n[t[r]]=e[r];return n};function Po(t,e){if(t.length===0)return"";let n="";for(let r=0;r<t.length;r++){let s=t[r],o=e[s];o!==void 0&&(n+=`${s}:${o},`)}return n}function yr(t,e){if(e)return Po(e,t);let n=Object.keys(t);return n.length>1&&n.sort(),Po(n,t)}Re.hashObject=yr;Re.isObject=function(e){return e!==null&&typeof e=="object"};Re.nowTimestamp=function(){return Date.now()/1e3};var hr=class extends Map{add(e,n){this.has(e)?this.get(e).push(n):this.set(e,[n])}};Re.Grouper=hr});var ct=B((xf,wr)=>{"use strict";var{getValueAsString:Ao}=Ce(),wn=class t{static get PROMETHEUS_CONTENT_TYPE(){return"text/plain; version=0.0.4; charset=utf-8"}static get OPENMETRICS_CONTENT_TYPE(){return"application/openmetrics-text; version=1.0.0; charset=utf-8"}constructor(e=t.PROMETHEUS_CONTENT_TYPE){if(this._metrics={},this._collectors=[],this._defaultLabels={},e!==t.PROMETHEUS_CONTENT_TYPE&&e!==t.OPENMETRICS_CONTENT_TYPE)throw new TypeError(`Content type ${e} is unsupported`);this._contentType=e}getMetricsAsArray(){return Object.values(this._metrics)}async getMetricsAsString(e){let n=typeof e.getForPromString=="function"?await e.getForPromString():await e.get(),r=br(n.name),s=`# HELP ${r} ${br(n.help)}`,o=`# TYPE ${r} ${n.type}`,i=[s,o],c=Object.keys(this._defaultLabels).length>0?this._defaultLabels:null,u=this.contentType===t.OPENMETRICS_CONTENT_TYPE;for(let f of n.values||[]){let{metricName:h=r,labels:_={}}=f,{sharedLabels:T={}}=f;u&&n.type==="counter"&&(h=`${h}_total`),c&&(_={..._,...c,..._});let M=_r(_,T),R=zl(T),k=[...M,R].filter(Boolean),y=k.length?`{${k.join(",")}}`:"",$=`${h}${y} ${Ao(f.value)}`,{exemplar:P}=f;if(P&&u){let L=_r(P.labelSet);$+=` # {${L.join(",")}} ${Ao(P.value)} ${P.timestamp}`}i.push($)}return i.join(`
2
+ `)}async metrics(){let e=this.contentType===t.OPENMETRICS_CONTENT_TYPE,n=this.getMetricsAsArray().map(s=>(e&&s.type==="counter"&&(s.name=Wl(s.name)),this.getMetricsAsString(s))),r=await Promise.all(n);return e?`${r.join(`
3
3
  `)}
4
4
  # EOF
5
- `:`${i.join(`
5
+ `:`${r.join(`
6
6
 
7
7
  `)}
8
- `}registerMetric(e){if(this._metrics[e.name]&&this._metrics[e.name]!==e)throw new Error(`A metric with the name ${e.name} has already been registered.`);this._metrics[e.name]=e}clear(){this._metrics={},this._defaultLabels={}}async getMetricsAsJSON(){let e=[],n=Object.keys(this._defaultLabels),i=[];for(let s of this.getMetricsAsArray())i.push(s.get());let r=await Promise.all(i);for(let s of r){if(s.values&&n.length>0)for(let a of s.values){a.labels=Object.assign({},a.labels);for(let o of n)a.labels[o]=a.labels[o]||this._defaultLabels[o]}e.push(s)}return e}removeSingleMetric(e){delete this._metrics[e]}getSingleMetricAsString(e){return this.getMetricsAsString(this._metrics[e])}getSingleMetric(e){return this._metrics[e]}setDefaultLabels(e){this._defaultLabels=e}resetMetrics(){for(let e in this._metrics)this._metrics[e].reset()}get contentType(){return this._contentType}setContentType(e){if(e===t.OPENMETRICS_CONTENT_TYPE||e===t.PROMETHEUS_CONTENT_TYPE)this._contentType=e;else throw new Error(`Content type ${e} is unsupported`)}static merge(e){let n=e[0].contentType;for(let s of e)if(s.contentType!==n)throw new Error("Registers can only be merged if they have the same content type");let i=new t(n);return e.reduce((s,a)=>s.concat(a.getMetricsAsArray()),[]).forEach(i.registerMetric,i),i}};function Rs(t,e){let{hasOwnProperty:n}=Object.prototype,i=[];for(let[r,s]of Object.entries(t))(!e||!n.call(e,r))&&i.push(`${r}="${Ax(s)}"`);return i}var sl=new WeakMap;function Nx(t){let e=sl.get(t);if(e)return e;let i=Rs(t).join(",");return sl.set(t,i),i}function Ax(t){return typeof t!="string"?t:ks(t).replace(/"/g,'\\"')}function ks(t){return t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n")}function Lx(t){return t.replace(/_total$/,"")}Os.exports=rr;Os.exports.globalRegistry=new rr});var Qt=k(sr=>{"use strict";var Px=Y("util"),Mx=/^[a-zA-Z_:][a-zA-Z0-9_:]*$/,jx=/^[a-zA-Z_][a-zA-Z0-9_]*$/;sr.validateMetricName=function(t){return Mx.test(t)};sr.validateLabelName=function(t=[]){return t.every(e=>jx.test(e))};sr.validateLabel=function(e,n){for(let i in n)if(!e.includes(i))throw new Error(`Added label "${i}" is not included in initial labelset: ${Px.inspect(e)}`)}});var ri=k((KS,al)=>{"use strict";var Cs=yn(),{isObject:qx}=xt(),{validateMetricName:$x,validateLabelName:Bx}=Qt(),Ns=class{constructor(e,n={}){if(!qx(e))throw new TypeError("constructor expected a config object");if(Object.assign(this,{labelNames:[],registers:[Cs.globalRegistry],aggregator:"sum",enableExemplars:!1},n,e),this.registers||(this.registers=[Cs.globalRegistry]),!this.help)throw new Error("Missing mandatory help parameter");if(!this.name)throw new Error("Missing mandatory name parameter");if(!$x(this.name))throw new Error("Invalid metric name");if(!Bx(this.labelNames))throw new Error("Invalid label name");if(this.collect&&typeof this.collect!="function")throw new Error('Optional "collect" parameter must be a function');this.labelNames?this.sortedLabelNames=[...this.labelNames].sort():this.sortedLabelNames=[],this.reset();for(let i of this.registers){if(this.enableExemplars&&i.contentType===Cs.PROMETHEUS_CONTENT_TYPE)throw new TypeError("Exemplars are supported only on OpenMetrics registries");i.registerMetric(this)}}reset(){}};al.exports={Metric:Ns}});var Ls=k((VS,ol)=>{"use strict";var As=class{constructor(e={},n=null){this.labelSet=e,this.value=n}validateExemplarLabelSet(e){let n="";for(let[i,r]of Object.entries(e))n+=`${i}${r}`;if(n.length>128)throw new RangeError("Label set size must be smaller than 128 UTF-8 chars")}};ol.exports=As});var Ms=k((WS,dl)=>{"use strict";var Dx=Y("util"),{hashObject:Ux,isObject:cl,getLabels:ll,removeLabels:Fx,nowTimestamp:zx}=xt(),{validateLabel:ul}=Qt(),{Metric:Gx}=ri(),Hx=Ls(),Ps=class extends Gx{constructor(e){super(e),this.type="counter",this.defaultLabels={},this.defaultValue=1,this.defaultExemplarLabelSet={},e.enableExemplars?(this.enableExemplars=!0,this.inc=this.incWithExemplar):this.inc=this.incWithoutExemplar}incWithoutExemplar(e,n){let i="";if(cl(e)?(i=Ux(e,this.sortedLabelNames),ul(this.labelNames,e)):(n=e,e={}),n&&!Number.isFinite(n))throw new TypeError(`Value is not a valid number: ${Dx.format(n)}`);if(n<0)throw new Error("It is not possible to decrease a counter");return n==null&&(n=1),pl(this.hashMap,n,e,i),{labelHash:i}}incWithExemplar({labels:e=this.defaultLabels,value:n=this.defaultValue,exemplarLabels:i=this.defaultExemplarLabelSet}={}){let r=this.incWithoutExemplar(e,n);this.updateExemplar(i,n,r.labelHash)}updateExemplar(e,n,i){e!==this.defaultExemplarLabelSet&&(cl(this.hashMap[i].exemplar)||(this.hashMap[i].exemplar=new Hx),this.hashMap[i].exemplar.validateExemplarLabelSet(e),this.hashMap[i].exemplar.labelSet=e,this.hashMap[i].exemplar.value=n||1,this.hashMap[i].exemplar.timestamp=zx())}reset(){this.hashMap={},this.labelNames.length===0&&pl(this.hashMap,0)}async get(){if(this.collect){let e=this.collect();e instanceof Promise&&await e}return{help:this.help,name:this.name,type:this.type,values:Object.values(this.hashMap),aggregator:this.aggregator}}labels(...e){let n=ll(this.labelNames,e)||{};return{inc:this.inc.bind(this,n)}}remove(...e){let n=ll(this.labelNames,e)||{};return ul(this.labelNames,n),Fx.call(this,this.hashMap,n,this.sortedLabelNames)}};function pl(t,e,n={},i=""){return t[i]?t[i].value+=e:t[i]={value:e,labels:n},t}dl.exports=Ps});var He=k((JS,yl)=>{"use strict";var hl=Y("util"),{setValue:gl,setValueDelta:Kx,getLabels:fl,hashObject:xl,isObject:vl,removeLabels:Vx}=xt(),{validateLabel:ar}=Qt(),{Metric:Wx}=ri(),$s=class extends Wx{constructor(e){super(e),this.type="gauge"}set(e,n){n=qs(e,n),e=js(e),Jx(this,e,n)}reset(){this.hashMap={},this.labelNames.length===0&&gl(this.hashMap,0,{})}inc(e,n){n=qs(e,n),e=js(e),n===void 0&&(n=1),ml(this,e,n)}dec(e,n){n=qs(e,n),e=js(e),n===void 0&&(n=1),ml(this,e,-n)}setToCurrentTime(e){let n=Date.now()/1e3;e===void 0?this.set(n):this.set(e,n)}startTimer(e){let n=process.hrtime();return i=>{let r=process.hrtime(n),s=r[0]+r[1]/1e9;return this.set(Object.assign({},e,i),s),s}}async get(){if(this.collect){let e=this.collect();e instanceof Promise&&await e}return{help:this.help,name:this.name,type:this.type,values:Object.values(this.hashMap),aggregator:this.aggregator}}_getValue(e){let n=xl(e||{},this.sortedLabelNames);return this.hashMap[n]?this.hashMap[n].value:0}labels(...e){let n=fl(this.labelNames,e);return ar(this.labelNames,n),{inc:this.inc.bind(this,n),dec:this.dec.bind(this,n),set:this.set.bind(this,n),setToCurrentTime:this.setToCurrentTime.bind(this,n),startTimer:this.startTimer.bind(this,n)}}remove(...e){let n=fl(this.labelNames,e);ar(this.labelNames,n),Vx.call(this,this.hashMap,n,this.sortedLabelNames)}};function Jx(t,e,n){if(typeof n!="number")throw new TypeError(`Value is not a valid number: ${hl.format(n)}`);ar(t.labelNames,e),gl(t.hashMap,n,e)}function ml(t,e,n){if(typeof n!="number")throw new TypeError(`Delta is not a valid number: ${hl.format(n)}`);ar(t.labelNames,e);let i=xl(e,t.sortedLabelNames);Kx(t.hashMap,n,e,i)}function js(t){return vl(t)?t:{}}function qs(t,e){return vl(t)?e:t}yl.exports=$s});var zs=k((XS,Sl)=>{"use strict";var Xx=Y("util"),{getLabels:bl,hashObject:or,isObject:_l,removeLabels:Yx,nowTimestamp:Zx}=xt(),{validateLabel:Ds}=Qt(),{Metric:Qx}=ri(),ev=Ls(),Us=class extends Qx{constructor(e){super(e,{buckets:[.005,.01,.025,.05,.1,.25,.5,1,2.5,5,10]}),this.type="histogram",this.defaultLabels={},this.defaultExemplarLabelSet={},this.enableExemplars=!1;for(let n of this.labelNames)if(n==="le")throw new Error("le is a reserved label keyword");this.upperBounds=this.buckets,this.bucketValues=this.upperBounds.reduce((n,i)=>(n[i]=0,n),{}),e.enableExemplars?(this.enableExemplars=!0,this.bucketExemplars=this.upperBounds.reduce((n,i)=>(n[i]=null,n),{}),Object.freeze(this.bucketExemplars),this.observe=this.observeWithExemplar):this.observe=this.observeWithoutExemplar,Object.freeze(this.bucketValues),Object.freeze(this.upperBounds),this.labelNames.length===0&&(this.hashMap={[or({})]:Fs({},this.bucketValues,this.bucketExemplars)})}observeWithoutExemplar(e,n){Bs.call(this,e===0?0:e||{})(n)}observeWithExemplar({labels:e=this.defaultLabels,value:n,exemplarLabels:i=this.defaultExemplarLabelSet}={}){Bs.call(this,e===0?0:e||{})(n),this.updateExemplar(e,n,i)}updateExemplar(e,n,i){if(Object.keys(i).length===0)return;let r=or(e,this.sortedLabelNames),s=Tl(this.upperBounds,n),{bucketExemplars:a}=this.hashMap[r],o=a[s];_l(o)||(o=new ev,a[s]=o),o.validateExemplarLabelSet(i),o.labelSet=i,o.value=n,o.timestamp=Zx()}async get(){let e=await this.getForPromString();return e.values=e.values.map(sv),e}async getForPromString(){if(this.collect){let i=this.collect();i instanceof Promise&&await i}let n=Object.values(this.hashMap).map(iv(this)).reduce(rv(this),[]);return{name:this.name,help:this.help,type:this.type,values:n,aggregator:this.aggregator}}reset(){this.hashMap={}}zero(e){let n=or(e,this.sortedLabelNames);this.hashMap[n]=Fs(e,this.bucketValues,this.bucketExemplars)}startTimer(e,n){return this.enableExemplars?tv.call(this,e,n)():wl.call(this,e)()}labels(...e){let n=bl(this.labelNames,e);return Ds(this.labelNames,n),{observe:Bs.call(this,n),startTimer:wl.call(this,n)}}remove(...e){let n=bl(this.labelNames,e);Ds(this.labelNames,n),Yx.call(this,this.hashMap,n,this.sortedLabelNames)}};function wl(t){return()=>{let e=process.hrtime();return n=>{let i=process.hrtime(e),r=i[0]+i[1]/1e9;return this.observe(Object.assign({},t,n),r),r}}}function tv(t,e){return()=>{let n=process.hrtime();return(i,r)=>{let s=process.hrtime(n),a=s[0]+s[1]/1e9;return this.observe({labels:Object.assign({},t,i),value:a,exemplarLabels:Object.assign({},e,r)}),a}}}function cr(t,e,n,i,r={}){return{labels:t,sharedLabels:r,value:e,metricName:n,exemplar:i}}function Tl(t,e){for(let n=0;n<t.length;n++){let i=t[n];if(e<=i)return i}return-1}function Bs(t){return e=>{let n=nv(t,e);if(Ds(this.labelNames,n.labels),!Number.isFinite(n.value))throw new TypeError(`Value is not a valid number: ${Xx.format(n.value)}`);let i=or(n.labels,this.sortedLabelNames),r=this.hashMap[i];r||(r=Fs(n.labels,this.bucketValues,this.bucketExemplars));let s=Tl(this.upperBounds,n.value);r.sum+=n.value,r.count+=1,Object.prototype.hasOwnProperty.call(r.bucketValues,s)&&(r.bucketValues[s]+=1),this.hashMap[i]=r}}function Fs(t,e,n){let i={labels:t,bucketValues:{...e},sum:0,count:0};return n&&(i.bucketExemplars={...n}),i}function nv(t,e){return _l(t)?{labels:t,value:e}:{value:t,labels:{}}}function iv(t){let e=`${t.name}_bucket`;return n=>{let i=0;return{buckets:t.upperBounds.map(s=>(i+=n.bucketValues[s],cr({le:s},i,e,n.bucketExemplars?n.bucketExemplars[s]:null,n.labels))),data:n}}}function rv(t){return(e,n)=>{e.push(...n.buckets);let i={le:"+Inf"};return e.push(cr(i,n.data.count,`${t.name}_bucket`,n.data.bucketExemplars?n.data.bucketExemplars[-1]:null,n.data.labels),cr({},n.data.sum,`${t.name}_sum`,void 0,n.data.labels),cr({},n.data.count,`${t.name}_count`,void 0,n.data.labels)),e}}function sv(t){let{sharedLabels:e,labels:n,...i}=t;for(let r of Object.keys(e))n[r]=e[r];return i.labels=n,i}Sl.exports=Us});var Gs=k((YS,El)=>{function ot(){}ot.prototype.clear=function(){this._root=null,this.size=0};ot.prototype.find=function(t){for(var e=this._root;e!==null;){var n=this._comparator(t,e.data);if(n===0)return e.data;e=e.get_child(n>0)}return null};ot.prototype.findIter=function(t){for(var e=this._root,n=this.iterator();e!==null;){var i=this._comparator(t,e.data);if(i===0)return n._cursor=e,n;n._ancestors.push(e),e=e.get_child(i>0)}return null};ot.prototype.lowerBound=function(t){for(var e=this._root,n=this.iterator(),i=this._comparator;e!==null;){var r=i(t,e.data);if(r===0)return n._cursor=e,n;n._ancestors.push(e),e=e.get_child(r>0)}for(var s=n._ancestors.length-1;s>=0;--s)if(e=n._ancestors[s],i(t,e.data)<0)return n._cursor=e,n._ancestors.length=s,n;return n._ancestors.length=0,n};ot.prototype.upperBound=function(t){for(var e=this.lowerBound(t),n=this._comparator;e.data()!==null&&n(e.data(),t)===0;)e.next();return e};ot.prototype.min=function(){var t=this._root;if(t===null)return null;for(;t.left!==null;)t=t.left;return t.data};ot.prototype.max=function(){var t=this._root;if(t===null)return null;for(;t.right!==null;)t=t.right;return t.data};ot.prototype.iterator=function(){return new bn(this)};ot.prototype.each=function(t){for(var e=this.iterator(),n;(n=e.next())!==null;)if(t(n)===!1)return};ot.prototype.reach=function(t){for(var e=this.iterator(),n;(n=e.prev())!==null;)if(t(n)===!1)return};function bn(t){this._tree=t,this._ancestors=[],this._cursor=null}bn.prototype.data=function(){return this._cursor!==null?this._cursor.data:null};bn.prototype.next=function(){if(this._cursor===null){var t=this._tree._root;t!==null&&this._minNode(t)}else if(this._cursor.right===null){var e;do if(e=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.right===e)}else this._ancestors.push(this._cursor),this._minNode(this._cursor.right);return this._cursor!==null?this._cursor.data:null};bn.prototype.prev=function(){if(this._cursor===null){var t=this._tree._root;t!==null&&this._maxNode(t)}else if(this._cursor.left===null){var e;do if(e=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.left===e)}else this._ancestors.push(this._cursor),this._maxNode(this._cursor.left);return this._cursor!==null?this._cursor.data:null};bn.prototype._minNode=function(t){for(;t.left!==null;)this._ancestors.push(t),t=t.left;this._cursor=t};bn.prototype._maxNode=function(t){for(;t.right!==null;)this._ancestors.push(t),t=t.right;this._cursor=t};El.exports=ot});var kl=k((ZS,Rl)=>{var av=Gs();function wn(t){this.data=t,this.left=null,this.right=null,this.red=!0}wn.prototype.get_child=function(t){return t?this.right:this.left};wn.prototype.set_child=function(t,e){t?this.right=e:this.left=e};function lr(t){this._root=null,this._comparator=t,this.size=0}lr.prototype=new av;lr.prototype.insert=function(t){var e=!1;if(this._root===null)this._root=new wn(t),e=!0,this.size++;else{var n=new wn(void 0),i=0,r=0,s=null,a=n,o=null,c=this._root;for(a.right=this._root;;){if(c===null?(c=new wn(t),o.set_child(i,c),e=!0,this.size++):tt(c.left)&&tt(c.right)&&(c.red=!0,c.left.red=!1,c.right.red=!1),tt(c)&&tt(o)){var l=a.right===s;c===o.get_child(r)?a.set_child(l,si(s,!r)):a.set_child(l,Il(s,!r))}var u=this._comparator(c.data,t);if(u===0)break;r=i,i=u<0,s!==null&&(a=s),s=o,o=c,c=c.get_child(i)}this._root=n.right}return this._root.red=!1,e};lr.prototype.remove=function(t){if(this._root===null)return!1;var e=new wn(void 0),n=e;n.right=this._root;for(var i=null,r=null,s=null,a=1;n.get_child(a)!==null;){var o=a;r=i,i=n,n=n.get_child(a);var c=this._comparator(t,n.data);if(a=c>0,c===0&&(s=n),!tt(n)&&!tt(n.get_child(a))){if(tt(n.get_child(!a))){var l=si(n,a);i.set_child(o,l),i=l}else if(!tt(n.get_child(!a))){var u=i.get_child(!o);if(u!==null)if(!tt(u.get_child(!o))&&!tt(u.get_child(o)))i.red=!1,u.red=!0,n.red=!0;else{var f=r.right===i;tt(u.get_child(o))?r.set_child(f,Il(i,o)):tt(u.get_child(!o))&&r.set_child(f,si(i,o));var x=r.get_child(f);x.red=!0,n.red=!0,x.left.red=!1,x.right.red=!1}}}}return s!==null&&(s.data=n.data,i.set_child(i.right===n,n.get_child(n.left===null)),this.size--),this._root=e.right,this._root!==null&&(this._root.red=!1),s!==null};function tt(t){return t!==null&&t.red}function si(t,e){var n=t.get_child(!e);return t.set_child(!e,n.get_child(e)),n.set_child(e,t),t.red=!0,n.red=!1,n}function Il(t,e){return t.set_child(!e,si(t.get_child(!e),!e)),si(t,e)}Rl.exports=lr});var Cl=k((QS,Ol)=>{var ov=Gs();function ai(t){this.data=t,this.left=null,this.right=null}ai.prototype.get_child=function(t){return t?this.right:this.left};ai.prototype.set_child=function(t,e){t?this.right=e:this.left=e};function ur(t){this._root=null,this._comparator=t,this.size=0}ur.prototype=new ov;ur.prototype.insert=function(t){if(this._root===null)return this._root=new ai(t),this.size++,!0;for(var e=0,n=null,i=this._root;;){if(i===null)return i=new ai(t),n.set_child(e,i),ret=!0,this.size++,!0;if(this._comparator(i.data,t)===0)return!1;e=this._comparator(i.data,t)<0,n=i,i=i.get_child(e)}};ur.prototype.remove=function(t){if(this._root===null)return!1;var e=new ai(void 0),n=e;n.right=this._root;for(var i=null,r=null,s=1;n.get_child(s)!==null;){i=n,n=n.get_child(s);var a=this._comparator(t,n.data);s=a>0,a===0&&(r=n)}return r!==null?(r.data=n.data,i.set_child(i.right===n,n.get_child(n.left===null)),this._root=e.right,this.size--,!0):!1};Ol.exports=ur});var Al=k((eE,Nl)=>{Nl.exports={RBTree:kl(),BinTree:Cl()}});var Ml=k((tE,Pl)=>{var cv=Al().RBTree;function ve(t,e,n){this.discrete=t===!1,this.delta=t||.01,this.K=e===void 0?25:e,this.CX=n===void 0?1.1:n,this.centroids=new cv(Ll),this.nreset=0,this.reset()}ve.prototype.reset=function(){this.centroids.clear(),this.n=0,this.nreset+=1,this.last_cumulate=0};ve.prototype.size=function(){return this.centroids.size};ve.prototype.toArray=function(t){var e=[];return t?(this._cumulate(!0),this.centroids.each(function(n){e.push(n)})):this.centroids.each(function(n){e.push({mean:n.mean,n:n.n})}),e};ve.prototype.summary=function(){var t=this.discrete?"exact ":"approximating ",e=[t+this.n+" samples using "+this.size()+" centroids","min = "+this.percentile(0),"Q1 = "+this.percentile(.25),"Q2 = "+this.percentile(.5),"Q3 = "+this.percentile(.75),"max = "+this.percentile(1)];return e.join(`
9
- `)};function Ll(t,e){return t.mean>e.mean?1:t.mean<e.mean?-1:0}function lv(t,e){return t.mean_cumn-e.mean_cumn}ve.prototype.push=function(t,e){e=e||1,t=Array.isArray(t)?t:[t];for(var n=0;n<t.length;n++)this._digest(t[n],e)};ve.prototype.push_centroid=function(t){t=Array.isArray(t)?t:[t];for(var e=0;e<t.length;e++)this._digest(t[e].mean,t[e].n)};ve.prototype._cumulate=function(t){if(!(this.n===this.last_cumulate||!t&&this.CX&&this.CX>this.n/this.last_cumulate)){var e=0;this.centroids.each(function(n){n.mean_cumn=e+n.n/2,e=n.cumn=e+n.n}),this.n=this.last_cumulate=e}};ve.prototype.find_nearest=function(t){if(this.size()===0)return null;var e=this.centroids.lowerBound({mean:t}),n=e.data()===null?e.prev():e.data();if(n.mean===t||this.discrete)return n;var i=e.prev();return i&&Math.abs(i.mean-t)<Math.abs(n.mean-t)?i:n};ve.prototype._new_centroid=function(t,e,n){var i={mean:t,n:e,cumn:n};return this.centroids.insert(i),this.n+=e,i};ve.prototype._addweight=function(t,e,n){e!==t.mean&&(t.mean+=n*(e-t.mean)/(t.n+n)),t.cumn+=n,t.mean_cumn+=n/2,t.n+=n,this.n+=n};ve.prototype._digest=function(t,e){var n=this.centroids.min(),i=this.centroids.max(),r=this.find_nearest(t);if(r&&r.mean===t)this._addweight(r,t,e);else if(r===n)this._new_centroid(t,e,0);else if(r===i)this._new_centroid(t,e,this.n);else if(this.discrete)this._new_centroid(t,e,r.cumn);else{var s=r.mean_cumn/this.n,a=Math.floor(4*this.n*this.delta*s*(1-s));a-r.n>=e?this._addweight(r,t,e):this._new_centroid(t,e,r.cumn)}this._cumulate(!1),!this.discrete&&this.K&&this.size()>this.K/this.delta&&this.compress()};ve.prototype.bound_mean=function(t){var e=this.centroids.upperBound({mean:t}),n=e.prev(),i=n.mean===t?n:e.next();return[n,i]};ve.prototype.p_rank=function(t){var e=Array.isArray(t)?t:[t],n=e.map(this._p_rank,this);return Array.isArray(t)?n:n[0]};ve.prototype._p_rank=function(t){if(this.size()!==0){{if(t<this.centroids.min().mean)return 0;if(t>this.centroids.max().mean)return 1}this._cumulate(!0);var e=this.bound_mean(t),n=e[0],i=e[1];if(this.discrete)return n.cumn/this.n;var r=n.mean_cumn;return n!==i&&(r+=(t-n.mean)*(i.mean_cumn-n.mean_cumn)/(i.mean-n.mean)),r/this.n}};ve.prototype.bound_mean_cumn=function(t){this.centroids._comparator=lv;var e=this.centroids.upperBound({mean_cumn:t});this.centroids._comparator=Ll;var n=e.prev(),i=n&&n.mean_cumn===t?n:e.next();return[n,i]};ve.prototype.percentile=function(t){var e=Array.isArray(t)?t:[t],n=e.map(this._percentile,this);return Array.isArray(t)?n:n[0]};ve.prototype._percentile=function(t){if(this.size()!==0){this._cumulate(!0);var e=this.n*t,n=this.bound_mean_cumn(e),i=n[0],r=n[1];return r===i||i===null||r===null?(i||r).mean:this.discrete?e<=i.cumn?i.mean:r.mean:i.mean+(e-i.mean_cumn)*(r.mean-i.mean)/(r.mean_cumn-i.mean_cumn)}};function uv(t){var e=Math.floor(Math.random()*t.length);return t.splice(e,1)[0]}ve.prototype.compress=function(){if(!this.compressing){var t=this.toArray();for(this.reset(),this.compressing=!0;t.length>0;)this.push_centroid(uv(t));this._cumulate(!0),this.compressing=!1}};function $t(t){this.config=t||{},this.mode=this.config.mode||"auto",ve.call(this,this.mode==="cont"?t.delta:!1),this.digest_ratio=this.config.ratio||.9,this.digest_thresh=this.config.thresh||1e3,this.n_unique=0}$t.prototype=Object.create(ve.prototype);$t.prototype.constructor=$t;$t.prototype.push=function(t){ve.prototype.push.call(this,t),this.check_continuous()};$t.prototype._new_centroid=function(t,e,n){this.n_unique+=1,ve.prototype._new_centroid.call(this,t,e,n)};$t.prototype._addweight=function(t,e,n){t.n===1&&(this.n_unique-=1),ve.prototype._addweight.call(this,t,e,n)};$t.prototype.check_continuous=function(){return this.mode!=="auto"||this.size()<this.digest_thresh?!1:this.n_unique/this.size()>this.digest_ratio?(this.mode="cont",this.discrete=!1,this.delta=this.config.delta||.01,this.compress(),!0):!1};Pl.exports={TDigest:ve,Digest:$t}});var $l=k((nE,ql)=>{"use strict";var{TDigest:jl}=Ml(),Ks=class{constructor(e,n){this.maxAgeSeconds=e||0,this.ageBuckets=n||0,this.shouldRotate=e&&n,this.ringBuffer=Array(n).fill(new jl),this.currentBuffer=0,this.lastRotateTimestampMillis=Date.now(),this.durationBetweenRotatesMillis=e*1e3/n||1/0}size(){return Hs.call(this).size()}percentile(e){return Hs.call(this).percentile(e)}push(e){Hs.call(this),this.ringBuffer.forEach(n=>{n.push(e)})}reset(){this.ringBuffer.forEach(e=>{e.reset()})}compress(){this.ringBuffer.forEach(e=>{e.compress()})}};function Hs(){let t=Date.now()-this.lastRotateTimestampMillis;for(;t>this.durationBetweenRotatesMillis&&this.shouldRotate;)this.ringBuffer[this.currentBuffer]=new jl,++this.currentBuffer>=this.ringBuffer.length&&(this.currentBuffer=0),t-=this.durationBetweenRotatesMillis,this.lastRotateTimestampMillis+=this.durationBetweenRotatesMillis;return this.ringBuffer[this.currentBuffer]}ql.exports=Ks});var Hl=k((iE,Gl)=>{"use strict";var pv=Y("util"),{getLabels:Bl,hashObject:Fl,removeLabels:dv}=xt(),{validateLabel:Vs}=Qt(),{Metric:fv}=ri(),zl=$l(),mv=1e3,Ws=class extends fv{constructor(e){super(e,{percentiles:[.01,.05,.5,.9,.95,.99,.999],compressCount:mv,hashMap:{}}),this.type="summary";for(let n of this.labelNames)if(n==="quantile")throw new Error("quantile is a reserved label keyword");this.labelNames.length===0&&(this.hashMap={[Fl({})]:{labels:{},td:new zl(this.maxAgeSeconds,this.ageBuckets),count:0,sum:0}})}observe(e,n){Ul.call(this,e===0?0:e||{})(n)}async get(){if(this.collect){let i=this.collect();i instanceof Promise&&await i}let e=Object.keys(this.hashMap),n=[];return e.forEach(i=>{let r=this.hashMap[i];r&&(this.pruneAgedBuckets&&r.td.size()===0?delete this.hashMap[i]:(hv(r,this.percentiles).forEach(s=>{n.push(s)}),n.push(xv(r,this)),n.push(gv(r,this))))}),{name:this.name,help:this.help,type:this.type,values:n,aggregator:this.aggregator}}reset(){Object.values(this.hashMap).forEach(n=>{n.td.reset(),n.count=0,n.sum=0})}startTimer(e){return Dl.call(this,e)()}labels(...e){let n=Bl(this.labelNames,e);return Vs(this.labelNames,n),{observe:Ul.call(this,n),startTimer:Dl.call(this,n)}}remove(...e){let n=Bl(this.labelNames,e);Vs(this.labelNames,n),dv.call(this,this.hashMap,n,this.sortedLabelNames)}};function hv(t,e){return t.td.compress(),e.map(n=>{let i=t.td.percentile(n);return{labels:Object.assign({quantile:n},t.labels),value:i||0}})}function gv(t,e){return{metricName:`${e.name}_count`,labels:t.labels,value:t.count}}function xv(t,e){return{metricName:`${e.name}_sum`,labels:t.labels,value:t.sum}}function Dl(t){return()=>{let e=process.hrtime();return n=>{let i=process.hrtime(e),r=i[0]+i[1]/1e9;return this.observe(Object.assign({},t,n),r),r}}}function Ul(t){return e=>{let n=vv(t,e);if(Vs(this.labelNames,t),!Number.isFinite(n.value))throw new TypeError(`Value is not a valid number: ${pv.format(n.value)}`);let i=Fl(n.labels,this.sortedLabelNames),r=this.hashMap[i];r||(r={labels:n.labels,td:new zl(this.maxAgeSeconds,this.ageBuckets),count:0,sum:0}),r.td.push(n.value),r.count++,r.count%this.compressCount===0&&r.td.compress(),r.sum+=n.value,this.hashMap[i]=r}}function vv(t,e){return e===void 0?{value:t,labels:{}}:{labels:t,value:e}}Gl.exports=Ws});var Vl=k((rE,Kl)=>{"use strict";var Js=Y("url"),yv=Y("http"),bv=Y("https"),{gzipSync:wv}=Y("zlib"),{globalRegistry:_v}=yn(),Ys=class{constructor(e,n,i){i||(i=_v),this.registry=i,this.gatewayUrl=e;let{requireJobName:r,...s}={requireJobName:!0,...n};this.requireJobName=r,this.requestOptions=s}pushAdd(e={}){if(this.requireJobName&&!e.jobName)throw new Error("Missing jobName parameter");return Xs.call(this,"POST",e.jobName,e.groupings)}push(e={}){if(this.requireJobName&&!e.jobName)throw new Error("Missing jobName parameter");return Xs.call(this,"PUT",e.jobName,e.groupings)}delete(e={}){if(this.requireJobName&&!e.jobName)throw new Error("Missing jobName parameter");return Xs.call(this,"DELETE",e.jobName,e.groupings)}};async function Xs(t,e,n){let i=Js.parse(this.gatewayUrl),r=i.pathname&&i.pathname!=="/"?i.pathname:"",s=e?`/job/${encodeURIComponent(e)}${Tv(n)}`:"",a=`${r}/metrics${s}`,o=Js.resolve(this.gatewayUrl,a),c=Js.parse(o),l=Sv(c.href)?bv:yv,u=Object.assign(c,this.requestOptions,{method:t});return new Promise((f,x)=>{t==="DELETE"&&u.headers&&delete u.headers["Content-Encoding"];let S=l.request(u,b=>{let w="";b.setEncoding("utf8"),b.on("data",g=>{w+=g}),b.on("end",()=>{b.statusCode>=400?x(new Error(`push failed with status ${b.statusCode}, ${w}`)):f({resp:b,body:w})})});S.on("error",b=>{x(b)}),S.on("timeout",()=>{S.destroy(new Error("Pushgateway request timed out"))}),t!=="DELETE"?this.registry.metrics().then(b=>{u.headers&&u.headers["Content-Encoding"]==="gzip"&&(b=wv(b)),S.write(b),S.end()}).catch(b=>{x(b)}):S.end()})}function Tv(t){return t?Object.keys(t).map(e=>`/${encodeURIComponent(e)}/${encodeURIComponent(t[e])}`).join(""):""}function Sv(t){return t.search(/^https/)!==-1}Kl.exports=Ys});var Qs=k(Zs=>{"use strict";Zs.linearBuckets=(t,e,n)=>{if(n<1)throw new Error("Linear buckets needs a positive count");let i=new Array(n);for(let r=0;r<n;r++)i[r]=t+r*e;return i};Zs.exponentialBuckets=(t,e,n)=>{if(t<=0)throw new Error("Exponential buckets needs a positive start");if(n<1)throw new Error("Exponential buckets needs a positive count");if(e<=1)throw new Error("Exponential buckets needs a factor greater than 1");let i=new Array(n);for(let r=0;r<n;r++)i[r]=t,t*=e;return i}});var kt,ea=Q(()=>{kt="1.9.1"});function Ev(t){let e=new Set([t]),n=new Set,i=t.match(Wl);if(!i)return()=>!1;let r={major:+i[1],minor:+i[2],patch:+i[3],prerelease:i[4]};if(r.prerelease!=null)return function(c){return c===t};function s(o){return n.add(o),!1}function a(o){return e.add(o),!0}return function(c){if(e.has(c))return!0;if(n.has(c))return!1;let l=c.match(Wl);if(!l)return s(c);let u={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return u.prerelease!=null||r.major!==u.major?s(c):r.major===0?r.minor===u.minor&&r.patch<=u.patch?a(c):s(c):r.minor<=u.minor?a(c):s(c)}}var Wl,Jl,Xl=Q(()=>{ea();Wl=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;Jl=Ev(kt)});function vt(t,e,n,i=!1){var r;let s=ci[oi]=(r=ci[oi])!==null&&r!==void 0?r:{version:kt};if(!i&&s[t]){let a=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return n.error(a.stack||a.message),!1}if(s.version!==kt){let a=new Error(`@opentelemetry/api: Registration of version v${s.version} for ${t} does not match previously registered API v${kt}`);return n.error(a.stack||a.message),!1}return s[t]=e,n.debug(`@opentelemetry/api: Registered a global for ${t} v${kt}.`),!0}function et(t){var e,n;let i=(e=ci[oi])===null||e===void 0?void 0:e.version;if(!(!i||!Jl(i)))return(n=ci[oi])===null||n===void 0?void 0:n[t]}function yt(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v${kt}.`);let n=ci[oi];n&&delete n[t]}var Iv,oi,ci,en=Q(()=>{ea();Xl();Iv=kt.split(".")[0],oi=Symbol.for(`opentelemetry.js.api.${Iv}`),ci=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});function li(t,e,n){let i=et("diag");if(i)return i[t](e,...n)}var pr,Yl=Q(()=>{en();pr=class{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return li("debug",this._namespace,e)}error(...e){return li("error",this._namespace,e)}info(...e){return li("info",this._namespace,e)}warn(...e){return li("warn",this._namespace,e)}verbose(...e){return li("verbose",this._namespace,e)}}});var je,dr=Q(()=>{(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(je||(je={}))});function Zl(t,e){t<je.NONE?t=je.NONE:t>je.ALL&&(t=je.ALL),e=e||{};function n(i,r){let s=e[i];return typeof s=="function"&&t>=r?s.bind(e):function(){}}return{error:n("error",je.ERROR),warn:n("warn",je.WARN),info:n("info",je.INFO),debug:n("debug",je.DEBUG),verbose:n("verbose",je.VERBOSE)}}var Ql=Q(()=>{dr()});var Rv,Ae,tn=Q(()=>{Yl();Ql();dr();en();Rv="diag",Ae=class t{static instance(){return this._instance||(this._instance=new t),this._instance}constructor(){function e(r){return function(...s){let a=et("diag");if(a)return a[r](...s)}}let n=this,i=(r,s={logLevel:je.INFO})=>{var a,o,c;if(r===n){let f=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error((a=f.stack)!==null&&a!==void 0?a:f.message),!1}typeof s=="number"&&(s={logLevel:s});let l=et("diag"),u=Zl((o=s.logLevel)!==null&&o!==void 0?o:je.INFO,r);if(l&&!s.suppressOverrideMessage){let f=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";l.warn(`Current logger will be overwritten from ${f}`),u.warn(`Current logger will overwrite one already registered from ${f}`)}return vt("diag",u,n,!0)};n.setLogger=i,n.disable=()=>{yt(Rv,n)},n.createComponentLogger=r=>new pr(r),n.verbose=e("verbose"),n.debug=e("debug"),n.info=e("info"),n.warn=e("warn"),n.error=e("error")}}});var fr,eu=Q(()=>{fr=class t{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let n=this._entries.get(e);if(n)return Object.assign({},n)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,n){let i=new t(this._entries);return i._entries.set(e,n),i}removeEntry(e){let n=new t(this._entries);return n._entries.delete(e),n}removeEntries(...e){let n=new t(this._entries);for(let i of e)n._entries.delete(i);return n}clear(){return new t}}});var tu,nu=Q(()=>{tu=Symbol("BaggageEntryMetadata")});function iu(t={}){return new fr(new Map(Object.entries(t)))}function ru(t){return typeof t!="string"&&(kv.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:tu,toString(){return t}}}var kv,ta=Q(()=>{tn();eu();nu();kv=Ae.instance()});function _n(t){return Symbol.for(t)}var na,mr,ui=Q(()=>{na=class t{constructor(e){let n=this;n._currentContext=e?new Map(e):new Map,n.getValue=i=>n._currentContext.get(i),n.setValue=(i,r)=>{let s=new t(n._currentContext);return s._currentContext.set(i,r),s},n.deleteValue=i=>{let r=new t(n._currentContext);return r._currentContext.delete(i),r}}},mr=new na});var ia,ra,hr,su=Q(()=>{ia=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],ra={};if(typeof console<"u"){let t=["error","warn","info","debug","trace","log"];for(let e of t)typeof console[e]=="function"&&(ra[e]=console[e])}hr=class{constructor(){function e(n){return function(...i){let r=ra[n];if(typeof r!="function"&&(r=ra.log),typeof r!="function"&&console&&(r=console[n],typeof r!="function"&&(r=console.log)),typeof r=="function")return r.apply(console,i)}}for(let n=0;n<ia.length;n++)this[ia[n].n]=e(ia[n].c)}}});function au(){return fa}var sa,Tn,aa,oa,ca,la,pi,ua,pa,da,fa,Ov,Cv,Nv,Av,Lv,Pv,Mv,ma=Q(()=>{sa=class{constructor(){}createGauge(e,n){return Cv}createHistogram(e,n){return Nv}createCounter(e,n){return Ov}createUpDownCounter(e,n){return Av}createObservableGauge(e,n){return Pv}createObservableCounter(e,n){return Lv}createObservableUpDownCounter(e,n){return Mv}addBatchObservableCallback(e,n){}removeBatchObservableCallback(e){}},Tn=class{},aa=class extends Tn{add(e,n){}},oa=class extends Tn{add(e,n){}},ca=class extends Tn{record(e,n){}},la=class extends Tn{record(e,n){}},pi=class{addCallback(e){}removeCallback(e){}},ua=class extends pi{},pa=class extends pi{},da=class extends pi{},fa=new sa,Ov=new aa,Cv=new ca,Nv=new la,Av=new oa,Lv=new ua,Pv=new pa,Mv=new da});var gr,ou=Q(()=>{(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(gr||(gr={}))});var xr,vr,ha=Q(()=>{xr={get(t,e){if(t!=null)return t[e]},keys(t){return t==null?[]:Object.keys(t)}},vr={set(t,e,n){t!=null&&(t[e]=n)}}});var yr,cu=Q(()=>{ui();yr=class{active(){return mr}with(e,n,i,...r){return n.call(i,...r)}bind(e,n){return n}enable(){return this}disable(){return this}}});var ga,jv,bt,di=Q(()=>{cu();en();tn();ga="context",jv=new yr,bt=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalContextManager(e){return vt(ga,e,Ae.instance())}active(){return this._getContextManager().active()}with(e,n,i,...r){return this._getContextManager().with(e,n,i,...r)}bind(e,n){return this._getContextManager().bind(e,n)}_getContextManager(){return et(ga)||jv}disable(){this._getContextManager().disable(),yt(ga,Ae.instance())}}});var Sn,xa=Q(()=>{(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(Sn||(Sn={}))});var fi,mi,br,wr=Q(()=>{xa();fi="0000000000000000",mi="00000000000000000000000000000000",br={traceId:mi,spanId:fi,traceFlags:Sn.NONE}});var wt,_r=Q(()=>{wr();wt=class{constructor(e=br){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,n){return this}setAttributes(e){return this}addEvent(e,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,n){}}});function Tr(t){return t.getValue(va)||void 0}function lu(){return Tr(bt.getInstance().active())}function hi(t,e){return t.setValue(va,e)}function uu(t){return t.deleteValue(va)}function pu(t,e){return hi(t,new wt(e))}function Sr(t){var e;return(e=Tr(t))===null||e===void 0?void 0:e.spanContext()}var va,ya=Q(()=>{ui();_r();di();va=_n("OpenTelemetry Context Key SPAN")});function du(t,e){if(typeof t!="string"||t.length!==e)return!1;let n=0;for(let i=0;i<t.length;i+=4)n+=(Er[t.charCodeAt(i)]|0)+(Er[t.charCodeAt(i+1)]|0)+(Er[t.charCodeAt(i+2)]|0)+(Er[t.charCodeAt(i+3)]|0);return n===e}function ba(t){return du(t,32)&&t!==mi}function wa(t){return du(t,16)&&t!==fi}function En(t){return ba(t.traceId)&&wa(t.spanId)}function fu(t){return new wt(t)}var Er,Ir=Q(()=>{wr();_r();Er=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])});function qv(t){return t!==null&&typeof t=="object"&&"spanId"in t&&typeof t.spanId=="string"&&"traceId"in t&&typeof t.traceId=="string"&&"traceFlags"in t&&typeof t.traceFlags=="number"}var _a,In,Ta=Q(()=>{di();ya();_r();Ir();_a=bt.getInstance(),In=class{startSpan(e,n,i=_a.active()){if(!!n?.root)return new wt;let s=i&&Sr(i);return qv(s)&&En(s)?new wt(s):new wt}startActiveSpan(e,n,i,r){let s,a,o;if(arguments.length<2)return;arguments.length===2?o=n:arguments.length===3?(s=n,o=i):(s=n,a=i,o=r);let c=a??_a.active(),l=this.startSpan(e,s,c),u=hi(c,l);return _a.with(u,o,void 0,l)}}});var $v,Rn,Sa=Q(()=>{Ta();$v=new In,Rn=class{constructor(e,n,i,r){this._provider=e,this.name=n,this.version=i,this.options=r}startSpan(e,n,i){return this._getTracer().startSpan(e,n,i)}startActiveSpan(e,n,i,r){let s=this._getTracer();return Reflect.apply(s.startActiveSpan,s,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):$v}}});var Rr,mu=Q(()=>{Ta();Rr=class{getTracer(e,n,i){return new In}}});var Bv,nn,Ea=Q(()=>{Sa();mu();Bv=new Rr,nn=class{getTracer(e,n,i){var r;return(r=this.getDelegateTracer(e,n,i))!==null&&r!==void 0?r:new Rn(this,e,n,i)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Bv}setDelegate(e){this._delegate=e}getDelegateTracer(e,n,i){var r;return(r=this._delegate)===null||r===void 0?void 0:r.getTracer(e,n,i)}}});var kr,hu=Q(()=>{(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(kr||(kr={}))});var Or,gu=Q(()=>{(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(Or||(Or={}))});var Cr,xu=Q(()=>{(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(Cr||(Cr={}))});function vu(t){return Fv.test(t)}function yu(t){return zv.test(t)&&!Gv.test(t)}var Ia,Dv,Uv,Fv,zv,Gv,bu=Q(()=>{Ia="[_0-9a-z-*/]",Dv=`[a-z]${Ia}{0,255}`,Uv=`[a-z0-9]${Ia}{0,240}@[a-z]${Ia}{0,13}`,Fv=new RegExp(`^(?:${Dv}|${Uv})$`),zv=/^[ -~]{0,255}[!-~]$/,Gv=/,|=/});var wu,Hv,_u,Tu,Nr,Su=Q(()=>{bu();wu=32,Hv=512,_u=",",Tu="=",Nr=class t{constructor(e){this._internalState=new Map,e&&this._parse(e)}set(e,n){let i=this._clone();return i._internalState.has(e)&&i._internalState.delete(e),i._internalState.set(e,n),i}unset(e){let n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reduceRight((e,n)=>(e.push(n+Tu+this.get(n)),e),[]).join(_u)}_parse(e){e.length>Hv||(this._internalState=e.split(_u).reduceRight((n,i)=>{let r=i.trim(),s=r.indexOf(Tu);if(s!==-1){let a=r.slice(0,s),o=r.slice(s+1,i.length);vu(a)&&yu(o)&&n.set(a,o)}return n},new Map),this._internalState.size>wu&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,wu))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}}});function Eu(t){return new Nr(t)}var Iu=Q(()=>{Su()});var Ra,Ru=Q(()=>{di();Ra=bt.getInstance()});var ka,ku=Q(()=>{tn();ka=Ae.instance()});var Oa,Ou,Cu=Q(()=>{ma();Oa=class{getMeter(e,n,i){return fa}},Ou=new Oa});var Ca,Ar,Nu=Q(()=>{Cu();en();tn();Ca="metrics",Ar=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalMeterProvider(e){return vt(Ca,e,Ae.instance())}getMeterProvider(){return et(Ca)||Ou}getMeter(e,n,i){return this.getMeterProvider().getMeter(e,n,i)}disable(){yt(Ca,Ae.instance())}}});var Na,Au=Q(()=>{Nu();Na=Ar.getInstance()});var Lr,Lu=Q(()=>{Lr=class{inject(e,n){}extract(e,n){return e}fields(){return[]}}});function La(t){return t.getValue(Aa)||void 0}function Pu(){return La(bt.getInstance().active())}function Mu(t,e){return t.setValue(Aa,e)}function ju(t){return t.deleteValue(Aa)}var Aa,qu=Q(()=>{di();ui();Aa=_n("OpenTelemetry Baggage Key")});var Pa,Kv,Pr,$u=Q(()=>{en();Lu();ha();qu();ta();tn();Pa="propagation",Kv=new Lr,Pr=class t{constructor(){this.createBaggage=iu,this.getBaggage=La,this.getActiveBaggage=Pu,this.setBaggage=Mu,this.deleteBaggage=ju}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalPropagator(e){return vt(Pa,e,Ae.instance())}inject(e,n,i=vr){return this._getGlobalPropagator().inject(e,n,i)}extract(e,n,i=xr){return this._getGlobalPropagator().extract(e,n,i)}fields(){return this._getGlobalPropagator().fields()}disable(){yt(Pa,Ae.instance())}_getGlobalPropagator(){return et(Pa)||Kv}}});var Ma,Bu=Q(()=>{$u();Ma=Pr.getInstance()});var ja,Mr,Du=Q(()=>{en();Ea();Ir();ya();tn();ja="trace",Mr=class t{constructor(){this._proxyTracerProvider=new nn,this.wrapSpanContext=fu,this.isSpanContextValid=En,this.deleteSpan=uu,this.getSpan=Tr,this.getActiveSpan=lu,this.getSpanContext=Sr,this.setSpan=hi,this.setSpanContext=pu}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalTracerProvider(e){let n=vt(ja,this._proxyTracerProvider,Ae.instance());return n&&this._proxyTracerProvider.setDelegate(e),n}getTracerProvider(){return et(ja)||this._proxyTracerProvider}getTracer(e,n){return this.getTracerProvider().getTracer(e,n)}disable(){yt(ja,Ae.instance()),this._proxyTracerProvider=new nn}}});var qa,Uu=Q(()=>{Du();qa=Mr.getInstance()});var Fu={};Ox(Fu,{DiagConsoleLogger:()=>hr,DiagLogLevel:()=>je,INVALID_SPANID:()=>fi,INVALID_SPAN_CONTEXT:()=>br,INVALID_TRACEID:()=>mi,ProxyTracer:()=>Rn,ProxyTracerProvider:()=>nn,ROOT_CONTEXT:()=>mr,SamplingDecision:()=>kr,SpanKind:()=>Or,SpanStatusCode:()=>Cr,TraceFlags:()=>Sn,ValueType:()=>gr,baggageEntryMetadataFromString:()=>ru,context:()=>Ra,createContextKey:()=>_n,createNoopMeter:()=>au,createTraceState:()=>Eu,default:()=>Vv,defaultTextMapGetter:()=>xr,defaultTextMapSetter:()=>vr,diag:()=>ka,isSpanContextValid:()=>En,isValidSpanId:()=>wa,isValidTraceId:()=>ba,metrics:()=>Na,propagation:()=>Ma,trace:()=>qa});var Vv,zu=Q(()=>{ta();ui();su();dr();ma();ou();ha();Sa();Ea();hu();gu();xu();xa();Iu();Ir();wr();Ru();ku();Au();Bu();Uu();Vv={context:Ra,diag:ka,metrics:Na,propagation:Ma,trace:qa}});var Wu=k((xR,Ba)=>{"use strict";var Gu=(zu(),Cx(Fu)),$a=Ms(),Hu="process_cpu_user_seconds_total",Ku="process_cpu_system_seconds_total",Vu="process_cpu_seconds_total";Ba.exports=(t,e={})=>{let n=t?[t]:void 0,i=e.prefix?e.prefix:"",r=e.labels?e.labels:{},s=e.enableExemplars?e.enableExemplars:!1,a=Object.keys(r),o=process.cpuUsage(),c=new $a({name:i+Hu,help:"Total user CPU time spent in seconds.",enableExemplars:s,registers:n,labelNames:a,collect(){let f=process.cpuUsage(),x=f.user-o.user,S=f.system-o.system;if(o=f,this.enableExemplars){let b={},w=Gu.trace.getSpan(Gu.context.active());w&&(b={traceId:w.spanContext().traceId,spanId:w.spanContext().spanId}),c.inc({labels:r,value:x/1e6,exemplarLabels:b}),l.inc({labels:r,value:S/1e6,exemplarLabels:b}),u.inc({labels:r,value:(x+S)/1e6,exemplarLabels:b})}else c.inc(r,x/1e6),l.inc(r,S/1e6),u.inc(r,(x+S)/1e6)}}),l=new $a({name:i+Ku,help:"Total system CPU time spent in seconds.",enableExemplars:s,registers:n,labelNames:a}),u=new $a({name:i+Vu,help:"Total user and system CPU time spent in seconds.",enableExemplars:s,registers:n,labelNames:a})};Ba.exports.metricNames=[Hu,Ku,Vu]});var Xu=k((vR,Da)=>{"use strict";var Wv=He(),Jv=Math.round(Date.now()/1e3-process.uptime()),Ju="process_start_time_seconds";Da.exports=(t,e={})=>{let n=e.prefix?e.prefix:"",i=e.labels?e.labels:{},r=Object.keys(i);new Wv({name:n+Ju,help:"Start time of the process since unix epoch in seconds.",registers:t?[t]:void 0,labelNames:r,aggregator:"omit",collect(){this.set(i,Jv)}})};Da.exports.metricNames=[Ju]});var ep=k((yR,Fa)=>{"use strict";var Ua=He(),Xv=Y("fs"),Yv=["VmSize","VmRSS","VmData"],Yu="process_resident_memory_bytes",Zu="process_virtual_memory_bytes",Qu="process_heap_bytes";function Zv(t){return t.split(`
10
- `).reduce((e,n)=>{if(!Yv.some(s=>n.startsWith(s)))return e;let i=n.split(":"),r=i[1].trim();return r=r.substr(0,r.length-3),r=Number(r)*1024,e[i[0]]=r,e},{})}Fa.exports=(t,e={})=>{let n=t?[t]:void 0,i=e.prefix?e.prefix:"",r=e.labels?e.labels:{},s=Object.keys(r),a=new Ua({name:i+Yu,help:"Resident memory size in bytes.",registers:n,labelNames:s,collect(){try{let l=Xv.readFileSync("/proc/self/status","utf8"),u=Zv(l);a.set(r,u.VmRSS),o.set(r,u.VmSize),c.set(r,u.VmData)}catch{}}}),o=new Ua({name:i+Zu,help:"Virtual memory size in bytes.",registers:n,labelNames:s}),c=new Ua({name:i+Qu,help:"Process heap size in bytes.",registers:n,labelNames:s})};Fa.exports.metricNames=[Yu,Zu,Qu]});var za=k((bR,tp)=>{"use strict";function Qv(){try{return process.memoryUsage()}catch{return}}tp.exports=Qv});var rp=k((wR,Ga)=>{"use strict";var ey=He(),np=ep(),ty=za(),ip="process_resident_memory_bytes";function ny(t,e={}){let n=e.prefix?e.prefix:"",i=e.labels?e.labels:{},r=Object.keys(i);new ey({name:n+ip,help:"Resident memory size in bytes.",registers:t?[t]:void 0,labelNames:r,collect(){let s=ty();s&&this.set(i,s.rss)}})}Ga.exports=(t,e)=>process.platform==="linux"?np(t,e):ny(t,e);Ga.exports.metricNames=process.platform==="linux"?np.metricNames:[ip]});var ap=k((_R,Ha)=>{"use strict";var iy=He(),ry=Y("fs"),sy=Y("process"),sp="process_open_fds";Ha.exports=(t,e={})=>{if(sy.platform!=="linux")return;let n=e.prefix?e.prefix:"",i=e.labels?e.labels:{},r=Object.keys(i);new iy({name:n+sp,help:"Number of open file descriptors.",registers:t?[t]:void 0,labelNames:r,collect(){try{let s=ry.readdirSync("/proc/self/fd");this.set(i,s.length-1)}catch{}}})};Ha.exports.metricNames=[sp]});var cp=k((TR,Ka)=>{"use strict";var ay=He(),oy=Y("fs"),op="process_max_fds",gi;Ka.exports=(t,e={})=>{if(gi===void 0)try{let a=oy.readFileSync("/proc/self/limits","utf8").split(`
11
- `);for(let o of a)if(o.startsWith("Max open files")){let c=o.split(/ +/);gi=Number(c[1]);break}}catch{return}if(gi===void 0)return;let n=e.prefix?e.prefix:"",i=e.labels?e.labels:{},r=Object.keys(i);new ay({name:n+op,help:"Maximum number of open file descriptors.",registers:t?[t]:void 0,labelNames:r,collect(){gi!==void 0&&this.set(i,gi)}})};Ka.exports.metricNames=[op]});var vp=k((SR,Va)=>{"use strict";var Bt=He(),jr;try{jr=Y("perf_hooks")}catch{}var up="nodejs_eventloop_lag_seconds",pp="nodejs_eventloop_lag_min_seconds",dp="nodejs_eventloop_lag_max_seconds",fp="nodejs_eventloop_lag_mean_seconds",mp="nodejs_eventloop_lag_stddev_seconds",hp="nodejs_eventloop_lag_p50_seconds",gp="nodejs_eventloop_lag_p90_seconds",xp="nodejs_eventloop_lag_p99_seconds";function lp(t,e,n){let i=process.hrtime(t),s=(i[0]*1e9+i[1])/1e9;e.set(n,s)}Va.exports=(t,e={})=>{let n=e.prefix?e.prefix:"",i=e.labels?e.labels:{},r=Object.keys(i),s=t?[t]:void 0,a=()=>{let w=process.hrtime();setImmediate(lp,w,o,i)};if(jr&&jr.monitorEventLoopDelay)try{let w=jr.monitorEventLoopDelay({resolution:e.eventLoopMonitoringPrecision});w.enable(),a=()=>{let g=process.hrtime();setImmediate(lp,g,o,i),c.set(i,w.min/1e9),l.set(i,w.max/1e9),u.set(i,w.mean/1e9),f.set(i,w.stddev/1e9),x.set(i,w.percentile(50)/1e9),S.set(i,w.percentile(90)/1e9),b.set(i,w.percentile(99)/1e9),w.reset()}}catch(w){if(w.code==="ERR_NOT_IMPLEMENTED")return;throw w}let o=new Bt({name:n+up,help:"Lag of event loop in seconds.",registers:s,labelNames:r,aggregator:"average",collect:a}),c=new Bt({name:n+pp,help:"The minimum recorded event loop delay.",registers:s,labelNames:r,aggregator:"min"}),l=new Bt({name:n+dp,help:"The maximum recorded event loop delay.",registers:s,labelNames:r,aggregator:"max"}),u=new Bt({name:n+fp,help:"The mean of the recorded event loop delays.",registers:s,labelNames:r,aggregator:"average"}),f=new Bt({name:n+mp,help:"The standard deviation of the recorded event loop delays.",registers:s,labelNames:r,aggregator:"average"}),x=new Bt({name:n+hp,help:"The 50th percentile of the recorded event loop delays.",registers:s,labelNames:r,aggregator:"average"}),S=new Bt({name:n+gp,help:"The 90th percentile of the recorded event loop delays.",registers:s,labelNames:r,aggregator:"average"}),b=new Bt({name:n+xp,help:"The 99th percentile of the recorded event loop delays.",registers:s,labelNames:r,aggregator:"average"})};Va.exports.metricNames=[up,pp,dp,fp,mp,hp,gp,xp]});var kn=k((ER,yp)=>{"use strict";function cy(t){let e={};for(let n=0;n<t.length;n++){let i=t[n];!i||typeof i.constructor>"u"||(Object.hasOwnProperty.call(e,i.constructor.name)?e[i.constructor.name]+=1:e[i.constructor.name]=1)}return e}function ly(t,e,n){t.reset();for(let i in e)t.set(Object.assign({type:i},n||{}),e[i])}yp.exports={aggregateByObjectName:cy,updateMetrics:ly}});var Tp=k((IR,Wa)=>{"use strict";var{aggregateByObjectName:uy}=kn(),{updateMetrics:py}=kn(),bp=He(),wp="nodejs_active_handles",_p="nodejs_active_handles_total";Wa.exports=(t,e={})=>{if(typeof process._getActiveHandles!="function")return;let n=t?[t]:void 0,i=e.prefix?e.prefix:"",r=e.labels?e.labels:{},s=Object.keys(r);new bp({name:i+wp,help:"Number of active libuv handles grouped by handle type. Every handle type is C++ class name.",labelNames:["type",...s],registers:n,collect(){let a=process._getActiveHandles();py(this,uy(a),r)}}),new bp({name:i+_p,help:"Total number of active handles.",registers:n,labelNames:s,collect(){let a=process._getActiveHandles();this.set(r,a.length)}})};Wa.exports.metricNames=[wp,_p]});var Rp=k((RR,Ja)=>{"use strict";var Sp=He(),{aggregateByObjectName:dy}=kn(),{updateMetrics:fy}=kn(),Ep="nodejs_active_requests",Ip="nodejs_active_requests_total";Ja.exports=(t,e={})=>{if(typeof process._getActiveRequests!="function")return;let n=e.prefix?e.prefix:"",i=e.labels?e.labels:{},r=Object.keys(i);new Sp({name:n+Ep,help:"Number of active libuv requests grouped by request type. Every request type is C++ class name.",labelNames:["type",...r],registers:t?[t]:void 0,collect(){let s=process._getActiveRequests();fy(this,dy(s),i)}}),new Sp({name:n+Ip,help:"Total number of active requests.",registers:t?[t]:void 0,labelNames:r,collect(){let s=process._getActiveRequests();this.set(i,s.length)}})};Ja.exports.metricNames=[Ep,Ip]});var Np=k((kR,Xa)=>{"use strict";var kp=He(),{updateMetrics:my}=kn(),Op="nodejs_active_resources",Cp="nodejs_active_resources_total";Xa.exports=(t,e={})=>{if(typeof process.getActiveResourcesInfo!="function")return;let n=e.prefix?e.prefix:"",i=e.labels?e.labels:{},r=Object.keys(i);new kp({name:n+Op,help:"Number of active resources that are currently keeping the event loop alive, grouped by async resource type.",labelNames:["type",...r],registers:t?[t]:void 0,collect(){let s=process.getActiveResourcesInfo(),a={};for(let o=0;o<s.length;o++){let c=s[o];Object.hasOwn(a,c)?a[c]+=1:a[c]=1}my(this,a,i)}}),new kp({name:n+Cp,help:"Total number of active resources.",registers:t?[t]:void 0,labelNames:r,collect(){let s=process.getActiveResourcesInfo();this.set(i,s.length)}})};Xa.exports.metricNames=[Op,Cp]});var Mp=k((OR,Za)=>{"use strict";var Ya=He(),hy=za(),Ap="nodejs_heap_size_total_bytes",Lp="nodejs_heap_size_used_bytes",Pp="nodejs_external_memory_bytes";Za.exports=(t,e={})=>{if(typeof process.memoryUsage!="function")return;let n=e.labels?e.labels:{},i=Object.keys(n),r=t?[t]:void 0,s=e.prefix?e.prefix:"",a=()=>{let u=hy();u&&(o.set(n,u.heapTotal),c.set(n,u.heapUsed),u.external!==void 0&&l.set(n,u.external))},o=new Ya({name:s+Ap,help:"Process heap size from Node.js in bytes.",registers:r,labelNames:i,collect:a}),c=new Ya({name:s+Lp,help:"Process heap size used from Node.js in bytes.",registers:r,labelNames:i}),l=new Ya({name:s+Pp,help:"Node.js external memory size in bytes.",registers:r,labelNames:i})};Za.exports.metricNames=[Ap,Lp,Pp]});var $p=k((CR,eo)=>{"use strict";var gy=He(),jp=Y("v8"),qp=["total","used","available"],Qa={};qp.forEach(t=>{Qa[t]=`nodejs_heap_space_size_${t}_bytes`});eo.exports=(t,e={})=>{try{jp.getHeapSpaceStatistics()}catch(o){if(o.code==="ERR_NOT_IMPLEMENTED")return;throw o}let n=t?[t]:void 0,i=e.prefix?e.prefix:"",r=e.labels?e.labels:{},s=["space",...Object.keys(r)],a={};qp.forEach(o=>{a[o]=new gy({name:i+Qa[o],help:`Process heap space size ${o} from Node.js in bytes.`,labelNames:s,registers:n})}),a.total.collect=()=>{for(let o of jp.getHeapSpaceStatistics()){let c=o.space_name.substr(0,o.space_name.indexOf("_space"));a.total.set({space:c,...r},o.space_size),a.used.set({space:c,...r},o.space_used_size),a.available.set({space:c,...r},o.space_available_size)}}};eo.exports.metricNames=Object.values(Qa)});var Up=k((NR,no)=>{"use strict";var xy=He(),Bp=process.version,to=Bp.slice(1).split(".").map(Number),Dp="nodejs_version_info";no.exports=(t,e={})=>{let n=e.prefix?e.prefix:"",i=e.labels?e.labels:{},r=Object.keys(i);new xy({name:n+Dp,help:"Node.js version info.",labelNames:["version","major","minor","patch",...r],registers:t?[t]:void 0,aggregator:"first",collect(){this.labels(Bp,to[0],to[1],to[2],...Object.values(i)).set(1)}})};no.exports.metricNames=[Dp]});var zp=k((AR,io)=>{"use strict";var vy=zs(),Ot;try{Ot=Y("perf_hooks")}catch{}var Fp="nodejs_gc_duration_seconds",yy=[.001,.01,.1,1,2,5],On=[];Ot&&Ot.constants&&(On[Ot.constants.NODE_PERFORMANCE_GC_MAJOR]="major",On[Ot.constants.NODE_PERFORMANCE_GC_MINOR]="minor",On[Ot.constants.NODE_PERFORMANCE_GC_INCREMENTAL]="incremental",On[Ot.constants.NODE_PERFORMANCE_GC_WEAKCB]="weakcb");io.exports=(t,e={})=>{if(!Ot)return;let n=e.prefix?e.prefix:"",i=e.labels?e.labels:{},r=Object.keys(i),s=e.gcDurationBuckets?e.gcDurationBuckets:yy,a=new vy({name:n+Fp,help:"Garbage collection duration by kind, one of major, minor, incremental or weakcb.",labelNames:["kind",...r],enableExemplars:!1,buckets:s,registers:t?[t]:void 0});new Ot.PerformanceObserver(c=>{let l=c.getEntries()[0],u=l.detail?On[l.detail.kind]:On[l.kind];a.observe(Object.assign({kind:u},i),l.duration/1e3)}).observe({entryTypes:["gc"]})};io.exports.metricNames=[Fp]});var Hp=k((LR,ro)=>{"use strict";var{isObject:by}=xt(),wy=Wu(),_y=Xu(),Ty=rp(),Sy=ap(),Ey=cp(),Iy=vp(),Ry=Tp(),ky=Rp(),Oy=Np(),Cy=Mp(),Ny=$p(),Ay=Up(),Ly=zp(),Gp={processCpuTotal:wy,processStartTime:_y,osMemoryHeap:Ty,processOpenFileDescriptors:Sy,processMaxFileDescriptors:Ey,eventLoopLag:Iy,...typeof process.getActiveResourcesInfo=="function"?{processResources:Oy}:{},processHandles:Ry,processRequests:ky,heapSizeAndUsed:Cy,heapSpacesSizeAndUsed:Ny,version:Ay,gc:Ly},Py=Object.keys(Gp);ro.exports=function(e){if(e!=null&&!by(e))throw new TypeError("config must be null, undefined, or an object");e={eventLoopMonitoringPrecision:10,...e};for(let n of Object.values(Gp))n(e.register,e)};ro.exports.metricsList=Py});var ao=k(so=>{"use strict";var{Grouper:My,hashObject:jy}=xt();function Cn(t){return e=>{if(e.length===0)return;let n={help:e[0].help,name:e[0].name,type:e[0].type,values:[],aggregator:e[0].aggregator},i=new My;return e.forEach(r=>{r.values.forEach(s=>{let a=jy(s.labels);i.add(`${s.metricName}_${a}`,s)})}),i.forEach(r=>{if(r.length===0)return;let s={value:t(r),labels:r[0].labels};r[0].metricName&&(s.metricName=r[0].metricName),n.values.push(s)}),n}}so.AggregatorFactory=Cn;so.aggregators={sum:Cn(t=>t.reduce((e,n)=>e+n.value,0)),first:Cn(t=>t[0].value),omit:()=>{},average:Cn(t=>t.reduce((e,n)=>e+n.value,0)/t.length),min:Cn(t=>t.reduce((e,n)=>Math.min(e,n.value),1/0)),max:Cn(t=>t.reduce((e,n)=>Math.max(e,n.value),-1/0))}});var Xp=k((MR,Jp)=>{"use strict";var Nn=yn(),{Grouper:qy}=xt(),{aggregators:$y}=ao(),rn=()=>{let t=Y("cluster");return rn=()=>t,t},Vp="prom-client:getMetricsReq",oo="prom-client:getMetricsRes",Wp=[Nn.globalRegistry],By=0,Kp=!1,co=new Map,qr=class extends Nn{constructor(e=Nn.PROMETHEUS_CONTENT_TYPE){super(e),Dy()}clusterMetrics(){let e=By++;return new Promise((n,i)=>{let r=!1;function s(c,l){r||(r=!0,c?i(c):n(l))}let a={responses:[],pending:0,done:s,errorTimeout:setTimeout(()=>{let c=new Error("Operation timed out.");a.done(c)},5e3)};co.set(e,a);let o={type:Vp,requestId:e};for(let c in rn().workers)rn().workers[c].isConnected()&&(rn().workers[c].send(o),a.pending++);a.pending===0&&(clearTimeout(a.errorTimeout),process.nextTick(()=>s(null,"")))})}get contentType(){return super.contentType}static aggregate(e,n=Nn.PROMETHEUS_CONTENT_TYPE){let i=new Nn,r=new qy;return i.setContentType(n),e.forEach(s=>{s.forEach(a=>{r.add(a.name,a)})}),r.forEach(s=>{let a=s[0].aggregator,o=$y[a];if(typeof o!="function")throw new Error(`'${a}' is not a defined aggregator.`);let c=o(s);if(c){let l=Object.assign({get:()=>c},c);i.registerMetric(l)}}),i}static setRegistries(e){Array.isArray(e)||(e=[e]),e.forEach(n=>{if(!(n instanceof Nn))throw new TypeError(`Expected Registry, got ${typeof n}`)}),Wp=e}};function Dy(){Kp||(Kp=!0,rn().isMaster&&rn().on("message",(t,e)=>{if(e.type===oo){let n=co.get(e.requestId);if(e.error){n.done(new Error(e.error));return}if(e.metrics.forEach(i=>n.responses.push(i)),n.pending--,n.pending===0){co.delete(e.requestId),clearTimeout(n.errorTimeout);let r=qr.aggregate(n.responses).metrics();n.done(null,r)}}}),rn().isWorker&&process.on("message",t=>{t.type===Vp&&Promise.all(Wp.map(e=>e.getMetricsAsJSON())).then(e=>{process.send({type:oo,requestId:t.requestId,metrics:e})}).catch(e=>{process.send({type:oo,requestId:t.requestId,error:e.message})})}))}Jp.exports=qr});var Yp=k(Ee=>{"use strict";Ee.register=yn().globalRegistry;Ee.Registry=yn();Object.defineProperty(Ee,"contentType",{configurable:!1,enumerable:!0,get(){return Ee.register.contentType},set(t){Ee.register.setContentType(t)}});Ee.prometheusContentType=Ee.Registry.PROMETHEUS_CONTENT_TYPE;Ee.openMetricsContentType=Ee.Registry.OPENMETRICS_CONTENT_TYPE;Ee.validateMetricName=Qt().validateMetricName;Ee.Counter=Ms();Ee.Gauge=He();Ee.Histogram=zs();Ee.Summary=Hl();Ee.Pushgateway=Vl();Ee.linearBuckets=Qs().linearBuckets;Ee.exponentialBuckets=Qs().exponentialBuckets;Ee.collectDefaultMetrics=Hp();Ee.aggregators=ao().aggregators;Ee.AggregatorRegistry=Xp()});var Qp=k(Zp=>{"use strict";var Uy=[0,255,65535,16777215,4294967295];function Fy(t,e,n,i,r){var s;for(s=0;s<r;s++)n[i+s]=t[e+s]}function zy(t,e,n,i){var r;for(r=0;r<i;r++)t[e+r]=t[e-n+r]}function lo(t){this.array=t,this.pos=0}lo.prototype.readUncompressedLength=function(){for(var t=0,e=0,n,i;e<32&&this.pos<this.array.length;){if(n=this.array[this.pos],this.pos+=1,i=n&127,i<<e>>>e!==i)return-1;if(t|=i<<e,n<128)return t;e+=7}return-1};lo.prototype.uncompressToBuffer=function(t){for(var e=this.array,n=e.length,i=this.pos,r=0,s,a,o,c;i<e.length;)if(s=e[i],i+=1,(s&3)===0){if(a=(s>>>2)+1,a>60){if(i+3>=n)return!1;o=a-60,a=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+(e[i+3]<<24),a=(a&Uy[o])+1,i+=o}if(i+a>n)return!1;Fy(e,i,t,r,a),i+=a,r+=a}else{switch(s&3){case 1:a=(s>>>2&7)+4,c=e[i]+(s>>>5<<8),i+=1;break;case 2:if(i+1>=n)return!1;a=(s>>>2)+1,c=e[i]+(e[i+1]<<8),i+=2;break;case 3:if(i+3>=n)return!1;a=(s>>>2)+1,c=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+(e[i+3]<<24),i+=4;break;default:break}if(c===0||c>r)return!1;zy(t,r,c,a),r+=a}return!0};Zp.SnappyDecompressor=lo});var rd=k(id=>{"use strict";var Gy=16,Hy=1<<Gy,nd=14,uo=new Array(nd+1);function xi(t,e){return t*506832829>>>e}function vi(t,e){return t[e]+(t[e+1]<<8)+(t[e+2]<<16)+(t[e+3]<<24)}function ed(t,e,n){return t[e]===t[n]&&t[e+1]===t[n+1]&&t[e+2]===t[n+2]&&t[e+3]===t[n+3]}function Ky(t,e,n,i,r){var s;for(s=0;s<r;s++)n[i+s]=t[e+s]}function td(t,e,n,i,r){return n<=60?(i[r]=n-1<<2,r+=1):n<256?(i[r]=240,i[r+1]=n-1,r+=2):(i[r]=244,i[r+1]=n-1&255,i[r+2]=n-1>>>8,r+=3),Ky(t,e,i,r,n),r+n}function po(t,e,n,i){return i<12&&n<2048?(t[e]=1+(i-4<<2)+(n>>>8<<5),t[e+1]=n&255,e+2):(t[e]=2+(i-1<<2),t[e+1]=n&255,t[e+2]=n>>>8,e+3)}function Vy(t,e,n,i){for(;i>=68;)e=po(t,e,n,64),i-=64;return i>64&&(e=po(t,e,n,60),i-=60),po(t,e,n,i)}function Wy(t,e,n,i,r){for(var s=1;1<<s<=n&&s<=nd;)s+=1;s-=1;var a=32-s;typeof uo[s]>"u"&&(uo[s]=new Uint16Array(1<<s));var o=uo[s],c;for(c=0;c<o.length;c++)o[c]=0;var l=e+n,u,f=e,x=e,S,b,w,g,C,z,q,N,I,H,G,L=!0,J=15;if(n>=J)for(u=l-J,e+=1,b=xi(vi(t,e),a);L;){C=32,w=e;do{if(e=w,S=b,z=C>>>5,C+=1,w=e+z,e>u){L=!1;break}b=xi(vi(t,w),a),g=f+o[S],o[S]=e-f}while(!ed(t,e,g));if(!L)break;r=td(t,x,e-x,i,r);do{for(q=e,N=4;e+N<l&&t[e+N]===t[g+N];)N+=1;if(e+=N,I=q-g,r=Vy(i,r,I,N),x=e,e>=u){L=!1;break}H=xi(vi(t,e-1),a),o[H]=e-1-f,G=xi(vi(t,e),a),g=f+o[G],o[G]=e-f}while(ed(t,e,g));if(!L)break;e+=1,b=xi(vi(t,e),a)}return x<l&&(r=td(t,x,l-x,i,r)),r}function Jy(t,e,n){do e[n]=t&127,t=t>>>7,t>0&&(e[n]+=128),n+=1;while(t>0);return n}function fo(t){this.array=t}fo.prototype.maxCompressedLength=function(){var t=this.array.length;return 32+t+Math.floor(t/6)};fo.prototype.compressToBuffer=function(t){var e=this.array,n=e.length,i=0,r=0,s;for(r=Jy(n,t,r);i<n;)s=Math.min(n-i,Hy),r=Wy(e,i,s,t,r),i+=s;return r};id.SnappyCompressor=fo});var cd=k(mo=>{"use strict";function sd(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"}function $r(t){return t instanceof Uint8Array&&(!sd()||!Buffer.isBuffer(t))}function Br(t){return t instanceof ArrayBuffer}function ad(t){return sd()?Buffer.isBuffer(t):!1}var Xy=Qp().SnappyDecompressor,Yy=rd().SnappyCompressor,od="Argument compressed must be type of ArrayBuffer, Buffer, or Uint8Array";function Zy(t,e){if(!$r(t)&&!Br(t)&&!ad(t))throw new TypeError(od);var n=!1,i=!1;$r(t)?n=!0:Br(t)&&(i=!0,t=new Uint8Array(t));var r=new Xy(t),s=r.readUncompressedLength();if(s===-1)throw new Error("Invalid Snappy bitstream");if(s>e)throw new Error(`The uncompressed length of ${s} is too big, expect at most ${e}`);var a,o;if(n){if(a=new Uint8Array(s),!r.uncompressToBuffer(a))throw new Error("Invalid Snappy bitstream")}else if(i){if(a=new ArrayBuffer(s),o=new Uint8Array(a),!r.uncompressToBuffer(o))throw new Error("Invalid Snappy bitstream")}else if(a=Buffer.alloc(s),!r.uncompressToBuffer(a))throw new Error("Invalid Snappy bitstream");return a}function Qy(t){if(!$r(t)&&!Br(t)&&!ad(t))throw new TypeError(od);var e=!1,n=!1;$r(t)?e=!0:Br(t)&&(n=!0,t=new Uint8Array(t));var i=new Yy(t),r=i.maxCompressedLength(),s,a,o;if(e?(s=new Uint8Array(r),o=i.compressToBuffer(s)):n?(s=new ArrayBuffer(r),a=new Uint8Array(s),o=i.compressToBuffer(a)):(s=Buffer.alloc(r),o=i.compressToBuffer(s)),!s.slice){var c=new Uint8Array(Array.prototype.slice.call(s,0,o));if(e)return c;if(n)return c.buffer;throw new Error("Not implemented")}return s.slice(0,o)}mo.uncompress=Zy;mo.compress=Qy});var Od=k((uk,kd)=>{"use strict";kd.exports=qb;function qb(t,e){for(var n=new Array(arguments.length-1),i=0,r=2,s=!0;r<arguments.length;)n[i++]=arguments[r++];return new Promise(function(o,c){n[i]=function(u){if(s)if(s=!1,u)c(u);else{for(var f=new Array(arguments.length-1),x=0;x<f.length;)f[x++]=arguments[x];o.apply(null,f)}};try{t.apply(e||null,n)}catch(l){s&&(s=!1,c(l))}})}});var Ld=k(Ad=>{"use strict";var zr=Ad;zr.length=function(e){var n=e.length;if(!n)return 0;for(var i=0;--n%4>1&&e.charAt(n)==="=";)++i;return Math.ceil(e.length*3)/4-i};var Ln=new Array(64),Nd=new Array(123);for(lt=0;lt<64;)Nd[Ln[lt]=lt<26?lt+65:lt<52?lt+71:lt<62?lt-4:lt-59|43]=lt++;var lt;zr.encode=function(e,n,i){for(var r=null,s=[],a=0,o=0,c;n<i;){var l=e[n++];switch(o){case 0:s[a++]=Ln[l>>2],c=(l&3)<<4,o=1;break;case 1:s[a++]=Ln[c|l>>4],c=(l&15)<<2,o=2;break;case 2:s[a++]=Ln[c|l>>6],s[a++]=Ln[l&63],o=0;break}a>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,s)),a=0)}return o&&(s[a++]=Ln[c],s[a++]=61,o===1&&(s[a++]=61)),r?(a&&r.push(String.fromCharCode.apply(String,s.slice(0,a))),r.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var Cd="invalid encoding";zr.decode=function(e,n,i){for(var r=i,s=0,a,o=0;o<e.length;){var c=e.charCodeAt(o++);if(c===61&&s>1)break;if((c=Nd[c])===void 0)throw Error(Cd);switch(s){case 0:a=c,s=1;break;case 1:n[i++]=a<<2|(c&48)>>4,a=c,s=2;break;case 2:n[i++]=(a&15)<<4|(c&60)>>2,a=c,s=3;break;case 3:n[i++]=(a&3)<<6|c,s=0;break}}if(s===1)throw Error(Cd);return i-r};zr.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var Md=k((dk,Pd)=>{"use strict";Pd.exports=Gr;function Gr(){this._listeners={}}Gr.prototype.on=function(e,n,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:n,ctx:i||this}),this};Gr.prototype.off=function(e,n){if(e===void 0)this._listeners={};else if(n===void 0)this._listeners[e]=[];else for(var i=this._listeners[e],r=0;r<i.length;)i[r].fn===n?i.splice(r,1):++r;return this};Gr.prototype.emit=function(e){var n=this._listeners[e];if(n){for(var i=[],r=1;r<arguments.length;)i.push(arguments[r++]);for(r=0;r<n.length;)n[r].fn.apply(n[r++].ctx,i)}return this}});var Fd=k((fk,Ud)=>{"use strict";Ud.exports=jd(jd);function jd(t){return typeof Float32Array<"u"?(function(){var e=new Float32Array([-0]),n=new Uint8Array(e.buffer),i=n[3]===128;function r(c,l,u){e[0]=c,l[u]=n[0],l[u+1]=n[1],l[u+2]=n[2],l[u+3]=n[3]}function s(c,l,u){e[0]=c,l[u]=n[3],l[u+1]=n[2],l[u+2]=n[1],l[u+3]=n[0]}t.writeFloatLE=i?r:s,t.writeFloatBE=i?s:r;function a(c,l){return n[0]=c[l],n[1]=c[l+1],n[2]=c[l+2],n[3]=c[l+3],e[0]}function o(c,l){return n[3]=c[l],n[2]=c[l+1],n[1]=c[l+2],n[0]=c[l+3],e[0]}t.readFloatLE=i?a:o,t.readFloatBE=i?o:a})():(function(){function e(i,r,s,a){var o=r<0?1:0;if(o&&(r=-r),r===0)i(1/r>0?0:2147483648,s,a);else if(isNaN(r))i(2143289344,s,a);else if(r>34028234663852886e22)i((o<<31|2139095040)>>>0,s,a);else if(r<11754943508222875e-54)i((o<<31|Math.round(r/1401298464324817e-60))>>>0,s,a);else{var c=Math.floor(Math.log(r)/Math.LN2),l=Math.round(r*Math.pow(2,-c)*8388608)&8388607;i((o<<31|c+127<<23|l)>>>0,s,a)}}t.writeFloatLE=e.bind(null,qd),t.writeFloatBE=e.bind(null,$d);function n(i,r,s){var a=i(r,s),o=(a>>31)*2+1,c=a>>>23&255,l=a&8388607;return c===255?l?NaN:o*(1/0):c===0?o*1401298464324817e-60*l:o*Math.pow(2,c-150)*(l+8388608)}t.readFloatLE=n.bind(null,Bd),t.readFloatBE=n.bind(null,Dd)})(),typeof Float64Array<"u"?(function(){var e=new Float64Array([-0]),n=new Uint8Array(e.buffer),i=n[7]===128;function r(c,l,u){e[0]=c,l[u]=n[0],l[u+1]=n[1],l[u+2]=n[2],l[u+3]=n[3],l[u+4]=n[4],l[u+5]=n[5],l[u+6]=n[6],l[u+7]=n[7]}function s(c,l,u){e[0]=c,l[u]=n[7],l[u+1]=n[6],l[u+2]=n[5],l[u+3]=n[4],l[u+4]=n[3],l[u+5]=n[2],l[u+6]=n[1],l[u+7]=n[0]}t.writeDoubleLE=i?r:s,t.writeDoubleBE=i?s:r;function a(c,l){return n[0]=c[l],n[1]=c[l+1],n[2]=c[l+2],n[3]=c[l+3],n[4]=c[l+4],n[5]=c[l+5],n[6]=c[l+6],n[7]=c[l+7],e[0]}function o(c,l){return n[7]=c[l],n[6]=c[l+1],n[5]=c[l+2],n[4]=c[l+3],n[3]=c[l+4],n[2]=c[l+5],n[1]=c[l+6],n[0]=c[l+7],e[0]}t.readDoubleLE=i?a:o,t.readDoubleBE=i?o:a})():(function(){function e(i,r,s,a,o,c){var l=a<0?1:0;if(l&&(a=-a),a===0)i(0,o,c+r),i(1/a>0?0:2147483648,o,c+s);else if(isNaN(a))i(0,o,c+r),i(2146959360,o,c+s);else if(a>17976931348623157e292)i(0,o,c+r),i((l<<31|2146435072)>>>0,o,c+s);else{var u;if(a<22250738585072014e-324)u=a/5e-324,i(u>>>0,o,c+r),i((l<<31|u/4294967296)>>>0,o,c+s);else{var f=Math.floor(Math.log(a)/Math.LN2);f===1024&&(f=1023),u=a*Math.pow(2,-f),i(u*4503599627370496>>>0,o,c+r),i((l<<31|f+1023<<20|u*1048576&1048575)>>>0,o,c+s)}}}t.writeDoubleLE=e.bind(null,qd,0,4),t.writeDoubleBE=e.bind(null,$d,4,0);function n(i,r,s,a,o){var c=i(a,o+r),l=i(a,o+s),u=(l>>31)*2+1,f=l>>>20&2047,x=4294967296*(l&1048575)+c;return f===2047?x?NaN:u*(1/0):f===0?u*5e-324*x:u*Math.pow(2,f-1075)*(x+4503599627370496)}t.readDoubleLE=n.bind(null,Bd,0,4),t.readDoubleBE=n.bind(null,Dd,4,0)})(),t}function qd(t,e,n){e[n]=t&255,e[n+1]=t>>>8&255,e[n+2]=t>>>16&255,e[n+3]=t>>>24}function $d(t,e,n){e[n]=t>>>24,e[n+1]=t>>>16&255,e[n+2]=t>>>8&255,e[n+3]=t&255}function Bd(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function Dd(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var Gd=k((mk,zd)=>{"use strict";zd.exports=$b;function $b(t){try{if(typeof Y!="function")return null;var e=Y(t);return e&&(e.length||Object.keys(e).length)?e:null}catch{return null}}});var Kd=k(Hd=>{"use strict";var ko=Hd,Ro="\uFFFD";ko.length=function(e){for(var n=0,i=0,r=0;r<e.length;++r)i=e.charCodeAt(r),i<128?n+=1:i<2048?n+=2:(i&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320?(++r,n+=4):n+=3;return n};ko.read=function(e,n,i){if(i-n<1)return"";for(var r="",s=n;s<i;){var a=e[s++];if(a<=127)r+=String.fromCharCode(a);else if(a>=192&&a<224){var o=(a&31)<<6|e[s++]&63;r+=o>=128?String.fromCharCode(o):Ro}else if(a>=224&&a<240){var c=(a&15)<<12|(e[s++]&63)<<6|e[s++]&63;r+=c>=2048?String.fromCharCode(c):Ro}else if(a>=240){var l=(a&7)<<18|(e[s++]&63)<<12|(e[s++]&63)<<6|e[s++]&63;l<65536||l>1114111?r+=Ro:(l-=65536,r+=String.fromCharCode(55296+(l>>10)),r+=String.fromCharCode(56320+(l&1023)))}}return r};ko.write=function(e,n,i){for(var r=i,s,a,o=0;o<e.length;++o)s=e.charCodeAt(o),s<128?n[i++]=s:s<2048?(n[i++]=s>>6|192,n[i++]=s&63|128):(s&64512)===55296&&((a=e.charCodeAt(o+1))&64512)===56320?(s=65536+((s&1023)<<10)+(a&1023),++o,n[i++]=s>>18|240,n[i++]=s>>12&63|128,n[i++]=s>>6&63|128,n[i++]=s&63|128):(n[i++]=s>>12|224,n[i++]=s>>6&63|128,n[i++]=s&63|128);return i-r}});var Wd=k((xk,Vd)=>{"use strict";Vd.exports=Bb;function Bb(t,e,n){var i=n||8192,r=i>>>1,s=null,a=i;return function(c){if(c<1||c>r)return t(c);a+c>i&&(s=t(i),a=0);var l=e.call(s,a,a+=c);return a&7&&(a=(a|7)+1),l}}});var Xd=k((vk,Jd)=>{"use strict";Jd.exports=Le;var ki=Ut();function Le(t,e){this.lo=t>>>0,this.hi=e>>>0}var an=Le.zero=new Le(0,0);an.toNumber=function(){return 0};an.zzEncode=an.zzDecode=function(){return this};an.length=function(){return 1};var Db=Le.zeroHash="\0\0\0\0\0\0\0\0";Le.fromNumber=function(e){if(e===0)return an;var n=e<0;n&&(e=-e);var i=e>>>0,r=(e-i)/4294967296>>>0;return n&&(r=~r>>>0,i=~i>>>0,++i>4294967295&&(i=0,++r>4294967295&&(r=0))),new Le(i,r)};Le.from=function(e){if(typeof e=="number")return Le.fromNumber(e);if(ki.isString(e))if(ki.Long)e=ki.Long.fromString(e);else return Le.fromNumber(parseInt(e,10));return e.low||e.high?new Le(e.low>>>0,e.high>>>0):an};Le.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var n=~this.lo+1>>>0,i=~this.hi>>>0;return n||(i=i+1>>>0),-(n+i*4294967296)}return this.lo+this.hi*4294967296};Le.prototype.toLong=function(e){return ki.Long?new ki.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Dt=String.prototype.charCodeAt;Le.fromHash=function(e){return e===Db?an:new Le((Dt.call(e,0)|Dt.call(e,1)<<8|Dt.call(e,2)<<16|Dt.call(e,3)<<24)>>>0,(Dt.call(e,4)|Dt.call(e,5)<<8|Dt.call(e,6)<<16|Dt.call(e,7)<<24)>>>0)};Le.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Le.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Le.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Le.prototype.length=function(){var e=this.lo,n=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return i===0?n===0?e<16384?e<128?1:2:e<2097152?3:4:n<16384?n<128?5:6:n<2097152?7:8:i<128?9:10}});var Yd=k((Oi,Oo)=>{(function(t,e){function n(i){return i.default||i}typeof define=="function"&&define.amd?define([],function(){var i={};return e(i),n(i)}):typeof Oi=="object"?(e(Oi),typeof Oo=="object"&&(Oo.exports=n(Oi))):(function(){var i={};e(i),t.Long=n(i)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:Oi,function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function n(R,p,j){this.low=R|0,this.high=p|0,this.unsigned=!!j}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0});function i(R){return(R&&R.__isLong__)===!0}function r(R){var p=Math.clz32(R&-R);return R?31-p:p}n.isLong=i;var s={},a={};function o(R,p){var j,E,re;return p?(R>>>=0,(re=0<=R&&R<256)&&(E=a[R],E)?E:(j=l(R,0,!0),re&&(a[R]=j),j)):(R|=0,(re=-128<=R&&R<128)&&(E=s[R],E)?E:(j=l(R,R<0?-1:0,!1),re&&(s[R]=j),j))}n.fromInt=o;function c(R,p){if(isNaN(R))return p?N:q;if(p){if(R<0)return N;if(R>=g)return J}else{if(R<=-C)return Z;if(R+1>=C)return L}return R<0?c(-R,p).neg():l(R%w|0,R/w|0,p)}n.fromNumber=c;function l(R,p,j){return new n(R,p,j)}n.fromBits=l;var u=Math.pow;function f(R,p,j){if(R.length===0)throw Error("empty string");if(typeof p=="number"?(j=p,p=!1):p=!!p,R==="NaN"||R==="Infinity"||R==="+Infinity"||R==="-Infinity")return p?N:q;if(j=j||10,j<2||36<j)throw RangeError("radix");var E;if((E=R.indexOf("-"))>0)throw Error("interior hyphen");if(E===0)return f(R.substring(1),p,j).neg();for(var re=c(u(j,8)),K=q,ee=0;ee<R.length;ee+=8){var he=Math.min(8,R.length-ee),U=parseInt(R.substring(ee,ee+he),j);if(he<8){var M=c(u(j,he));K=K.mul(M).add(c(U))}else K=K.mul(re),K=K.add(c(U))}return K.unsigned=p,K}n.fromString=f;function x(R,p){return typeof R=="number"?c(R,p):typeof R=="string"?f(R,p):l(R.low,R.high,typeof p=="boolean"?p:R.unsigned)}n.fromValue=x;var S=65536,b=1<<24,w=S*S,g=w*w,C=g/2,z=o(b),q=o(0);n.ZERO=q;var N=o(0,!0);n.UZERO=N;var I=o(1);n.ONE=I;var H=o(1,!0);n.UONE=H;var G=o(-1);n.NEG_ONE=G;var L=l(-1,2147483647,!1);n.MAX_VALUE=L;var J=l(-1,-1,!0);n.MAX_UNSIGNED_VALUE=J;var Z=l(0,-2147483648,!1);n.MIN_VALUE=Z;var O=n.prototype;O.toInt=function(){return this.unsigned?this.low>>>0:this.low},O.toNumber=function(){return this.unsigned?(this.high>>>0)*w+(this.low>>>0):this.high*w+(this.low>>>0)},O.toString=function(p){if(p=p||10,p<2||36<p)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Z)){var j=c(p),E=this.div(j),re=E.mul(j).sub(this);return E.toString(p)+re.toInt().toString(p)}else return"-"+this.neg().toString(p);for(var K=c(u(p,6),this.unsigned),ee=this,he="";;){var U=ee.div(K),M=ee.sub(U.mul(K)).toInt()>>>0,V=M.toString(p);if(ee=U,ee.isZero())return V+he;for(;V.length<6;)V="0"+V;he=""+V+he}},O.getHighBits=function(){return this.high},O.getHighBitsUnsigned=function(){return this.high>>>0},O.getLowBits=function(){return this.low},O.getLowBitsUnsigned=function(){return this.low>>>0},O.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Z)?64:this.neg().getNumBitsAbs();for(var p=this.high!=0?this.high:this.low,j=31;j>0&&(p&1<<j)==0;j--);return this.high!=0?j+33:j+1},O.isSafeInteger=function(){var p=this.high>>21;return p?this.unsigned?!1:p===-1&&!(this.low===0&&this.high===-2097152):!0},O.isZero=function(){return this.high===0&&this.low===0},O.eqz=O.isZero,O.isNegative=function(){return!this.unsigned&&this.high<0},O.isPositive=function(){return this.unsigned||this.high>=0},O.isOdd=function(){return(this.low&1)===1},O.isEven=function(){return(this.low&1)===0},O.equals=function(p){return i(p)||(p=x(p)),this.unsigned!==p.unsigned&&this.high>>>31===1&&p.high>>>31===1?!1:this.high===p.high&&this.low===p.low},O.eq=O.equals,O.notEquals=function(p){return!this.eq(p)},O.neq=O.notEquals,O.ne=O.notEquals,O.lessThan=function(p){return this.comp(p)<0},O.lt=O.lessThan,O.lessThanOrEqual=function(p){return this.comp(p)<=0},O.lte=O.lessThanOrEqual,O.le=O.lessThanOrEqual,O.greaterThan=function(p){return this.comp(p)>0},O.gt=O.greaterThan,O.greaterThanOrEqual=function(p){return this.comp(p)>=0},O.gte=O.greaterThanOrEqual,O.ge=O.greaterThanOrEqual,O.compare=function(p){if(i(p)||(p=x(p)),this.eq(p))return 0;var j=this.isNegative(),E=p.isNegative();return j&&!E?-1:!j&&E?1:this.unsigned?p.high>>>0>this.high>>>0||p.high===this.high&&p.low>>>0>this.low>>>0?-1:1:this.sub(p).isNegative()?-1:1},O.comp=O.compare,O.negate=function(){return!this.unsigned&&this.eq(Z)?Z:this.not().add(I)},O.neg=O.negate,O.add=function(p){i(p)||(p=x(p));var j=this.high>>>16,E=this.high&65535,re=this.low>>>16,K=this.low&65535,ee=p.high>>>16,he=p.high&65535,U=p.low>>>16,M=p.low&65535,V=0,ie=0,X=0,ce=0;return ce+=K+M,X+=ce>>>16,ce&=65535,X+=re+U,ie+=X>>>16,X&=65535,ie+=E+he,V+=ie>>>16,ie&=65535,V+=j+ee,V&=65535,l(X<<16|ce,V<<16|ie,this.unsigned)},O.subtract=function(p){return i(p)||(p=x(p)),this.add(p.neg())},O.sub=O.subtract,O.multiply=function(p){if(this.isZero())return this;if(i(p)||(p=x(p)),e){var j=e.mul(this.low,this.high,p.low,p.high);return l(j,e.get_high(),this.unsigned)}if(p.isZero())return this.unsigned?N:q;if(this.eq(Z))return p.isOdd()?Z:q;if(p.eq(Z))return this.isOdd()?Z:q;if(this.isNegative())return p.isNegative()?this.neg().mul(p.neg()):this.neg().mul(p).neg();if(p.isNegative())return this.mul(p.neg()).neg();if(this.lt(z)&&p.lt(z))return c(this.toNumber()*p.toNumber(),this.unsigned);var E=this.high>>>16,re=this.high&65535,K=this.low>>>16,ee=this.low&65535,he=p.high>>>16,U=p.high&65535,M=p.low>>>16,V=p.low&65535,ie=0,X=0,ce=0,ke=0;return ke+=ee*V,ce+=ke>>>16,ke&=65535,ce+=K*V,X+=ce>>>16,ce&=65535,ce+=ee*M,X+=ce>>>16,ce&=65535,X+=re*V,ie+=X>>>16,X&=65535,X+=K*M,ie+=X>>>16,X&=65535,X+=ee*U,ie+=X>>>16,X&=65535,ie+=E*V+re*M+K*U+ee*he,ie&=65535,l(ce<<16|ke,ie<<16|X,this.unsigned)},O.mul=O.multiply,O.divide=function(p){if(i(p)||(p=x(p)),p.isZero())throw Error("division by zero");if(e){if(!this.unsigned&&this.high===-2147483648&&p.low===-1&&p.high===-1)return this;var j=(this.unsigned?e.div_u:e.div_s)(this.low,this.high,p.low,p.high);return l(j,e.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?N:q;var E,re,K;if(this.unsigned){if(p.unsigned||(p=p.toUnsigned()),p.gt(this))return N;if(p.gt(this.shru(1)))return H;K=N}else{if(this.eq(Z)){if(p.eq(I)||p.eq(G))return Z;if(p.eq(Z))return I;var ee=this.shr(1);return E=ee.div(p).shl(1),E.eq(q)?p.isNegative()?I:G:(re=this.sub(p.mul(E)),K=E.add(re.div(p)),K)}else if(p.eq(Z))return this.unsigned?N:q;if(this.isNegative())return p.isNegative()?this.neg().div(p.neg()):this.neg().div(p).neg();if(p.isNegative())return this.div(p.neg()).neg();K=q}for(re=this;re.gte(p);){E=Math.max(1,Math.floor(re.toNumber()/p.toNumber()));for(var he=Math.ceil(Math.log(E)/Math.LN2),U=he<=48?1:u(2,he-48),M=c(E),V=M.mul(p);V.isNegative()||V.gt(re);)E-=U,M=c(E,this.unsigned),V=M.mul(p);M.isZero()&&(M=I),K=K.add(M),re=re.sub(V)}return K},O.div=O.divide,O.modulo=function(p){if(i(p)||(p=x(p)),e){var j=(this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,p.low,p.high);return l(j,e.get_high(),this.unsigned)}return this.sub(this.div(p).mul(p))},O.mod=O.modulo,O.rem=O.modulo,O.not=function(){return l(~this.low,~this.high,this.unsigned)},O.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},O.clz=O.countLeadingZeros,O.countTrailingZeros=function(){return this.low?r(this.low):r(this.high)+32},O.ctz=O.countTrailingZeros,O.and=function(p){return i(p)||(p=x(p)),l(this.low&p.low,this.high&p.high,this.unsigned)},O.or=function(p){return i(p)||(p=x(p)),l(this.low|p.low,this.high|p.high,this.unsigned)},O.xor=function(p){return i(p)||(p=x(p)),l(this.low^p.low,this.high^p.high,this.unsigned)},O.shiftLeft=function(p){return i(p)&&(p=p.toInt()),(p&=63)===0?this:p<32?l(this.low<<p,this.high<<p|this.low>>>32-p,this.unsigned):l(0,this.low<<p-32,this.unsigned)},O.shl=O.shiftLeft,O.shiftRight=function(p){return i(p)&&(p=p.toInt()),(p&=63)===0?this:p<32?l(this.low>>>p|this.high<<32-p,this.high>>p,this.unsigned):l(this.high>>p-32,this.high>=0?0:-1,this.unsigned)},O.shr=O.shiftRight,O.shiftRightUnsigned=function(p){return i(p)&&(p=p.toInt()),(p&=63)===0?this:p<32?l(this.low>>>p|this.high<<32-p,this.high>>>p,this.unsigned):p===32?l(this.high,0,this.unsigned):l(this.high>>>p-32,0,this.unsigned)},O.shru=O.shiftRightUnsigned,O.shr_u=O.shiftRightUnsigned,O.rotateLeft=function(p){var j;return i(p)&&(p=p.toInt()),(p&=63)===0?this:p===32?l(this.high,this.low,this.unsigned):p<32?(j=32-p,l(this.low<<p|this.high>>>j,this.high<<p|this.low>>>j,this.unsigned)):(p-=32,j=32-p,l(this.high<<p|this.low>>>j,this.low<<p|this.high>>>j,this.unsigned))},O.rotl=O.rotateLeft,O.rotateRight=function(p){var j;return i(p)&&(p=p.toInt()),(p&=63)===0?this:p===32?l(this.high,this.low,this.unsigned):p<32?(j=32-p,l(this.high<<j|this.low>>>p,this.low<<j|this.high>>>p,this.unsigned)):(p-=32,j=32-p,l(this.low<<j|this.high>>>p,this.high<<j|this.low>>>p,this.unsigned))},O.rotr=O.rotateRight,O.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},O.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},O.toBytes=function(p){return p?this.toBytesLE():this.toBytesBE()},O.toBytesLE=function(){var p=this.high,j=this.low;return[j&255,j>>>8&255,j>>>16&255,j>>>24,p&255,p>>>8&255,p>>>16&255,p>>>24]},O.toBytesBE=function(){var p=this.high,j=this.low;return[p>>>24,p>>>16&255,p>>>8&255,p&255,j>>>24,j>>>16&255,j>>>8&255,j&255]},n.fromBytes=function(p,j,E){return E?n.fromBytesLE(p,j):n.fromBytesBE(p,j)},n.fromBytesLE=function(p,j){return new n(p[0]|p[1]<<8|p[2]<<16|p[3]<<24,p[4]|p[5]<<8|p[6]<<16|p[7]<<24,j)},n.fromBytesBE=function(p,j){return new n(p[4]<<24|p[5]<<16|p[6]<<8|p[7],p[0]<<24|p[1]<<16|p[2]<<8|p[3],j)},typeof BigInt=="function"&&(n.fromBigInt=function(p,j){var E=Number(BigInt.asIntN(32,p)),re=Number(BigInt.asIntN(32,p>>BigInt(32)));return l(E,re,j)},n.fromValue=function(p,j){return typeof p=="bigint"?n.fromBigInt(p,j):x(p,j)},O.toBigInt=function(){var p=BigInt(this.low>>>0),j=BigInt(this.unsigned?this.high>>>0:this.high);return j<<BigInt(32)|p});var me=t.default=n})});var Ut=k(Co=>{"use strict";var W=Co;W.asPromise=Od();W.base64=Ld();W.EventEmitter=Md();W.float=Fd();W.inquire=Gd();W.utf8=Kd();W.pool=Wd();W.LongBits=Xd();W.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);W.global=W.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Co;W.emptyArray=Object.freeze?Object.freeze([]):[];W.emptyObject=Object.freeze?Object.freeze({}):{};W.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};W.isString=function(e){return typeof e=="string"||e instanceof String};W.isObject=function(e){return e&&typeof e=="object"};W.isset=W.isSet=function(e,n){var i=e[n];return i!=null&&e.hasOwnProperty(n)?typeof i!="object"||(Array.isArray(i)?i.length:Object.keys(i).length)>0:!1};W.Buffer=(function(){try{var t=W.global.Buffer;return t.prototype.utf8Write?t:null}catch{return null}})();W._Buffer_from=null;W._Buffer_allocUnsafe=null;W.newBuffer=function(e){return typeof e=="number"?W.Buffer?W._Buffer_allocUnsafe(e):new W.Array(e):W.Buffer?W._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};W.Array=typeof Uint8Array<"u"?Uint8Array:Array;W.Long=W.global.dcodeIO&&W.global.dcodeIO.Long||W.global.Long||(function(){try{var t=Yd();return t&&t.isLong?t:null}catch{return null}})();W.key2Re=/^true|false|0|1$/;W.key32Re=/^-?(?:0|[1-9][0-9]*)$/;W.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;W.longToHash=function(e){return e?W.LongBits.from(e).toHash():W.LongBits.zeroHash};W.longFromHash=function(e,n){var i=W.LongBits.fromHash(e);return W.Long?W.Long.fromBits(i.lo,i.hi,n):i.toNumber(!!n)};function Zd(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;++r)(t[i[r]]===void 0||!n)&&i[r]!=="__proto__"&&(t[i[r]]=e[i[r]]);return t}W.merge=Zd;W.recursionLimit=100;W.makeProp=function(e,n){Object.defineProperty(e,n,{enumerable:!0,configurable:!0,writable:!0})};W.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function Qd(t){function e(n,i){if(!(this instanceof e))return new e(n,i);Object.defineProperty(this,"message",{get:function(){return n}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),i&&Zd(this,i)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return t},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}W.newError=Qd;W.ProtocolError=Qd("ProtocolError");W.oneOfGetter=function(e){for(var n={},i=0;i<e.length;++i)n[e[i]]=1;return function(){for(var r=Object.keys(this),s=r.length-1;s>-1;--s)if(n[r[s]]===1&&this[r[s]]!==void 0&&this[r[s]]!==null)return r[s]}};W.oneOfSetter=function(e){return function(n){for(var i=0;i<e.length;++i)e[i]!==n&&delete this[e[i]]}};W.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};W._configure=function(){var t=W.Buffer;if(!t){W._Buffer_from=W._Buffer_allocUnsafe=null;return}W._Buffer_from=t.from!==Uint8Array.from&&t.from||function(n,i){return new t(n,i)},W._Buffer_allocUnsafe=t.allocUnsafe||function(n){return new t(n)}}});var qo=k((bk,rf)=>{"use strict";rf.exports=le;var nt=Ut(),No,Hr=nt.LongBits,ef=nt.base64,tf=nt.utf8;function Ci(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}function Lo(){}function Ub(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function le(){this.len=0,this.head=new Ci(Lo,0,0),this.tail=this.head,this.states=null}var nf=function(){return nt.Buffer?function(){return(le.create=function(){return new No})()}:function(){return new le}};le.create=nf();le.alloc=function(e){return new nt.Array(e)};nt.Array!==Array&&(le.alloc=nt.pool(le.alloc,nt.Array.prototype.subarray));le.prototype._push=function(e,n,i){return this.tail=this.tail.next=new Ci(e,n,i),this.len+=n,this};function Po(t,e,n){e[n]=t&255}function Fb(t,e,n){for(;t>127;)e[n++]=t&127|128,t>>>=7;e[n]=t}function Mo(t,e){this.len=t,this.next=void 0,this.val=e}Mo.prototype=Object.create(Ci.prototype);Mo.prototype.fn=Fb;le.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Mo((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};le.prototype.int32=function(e){return e<0?this._push(jo,10,Hr.fromNumber(e)):this.uint32(e)};le.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function jo(t,e,n){for(;t.hi;)e[n++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[n++]=t.lo&127|128,t.lo=t.lo>>>7;e[n++]=t.lo}le.prototype.uint64=function(e){var n=Hr.from(e);return this._push(jo,n.length(),n)};le.prototype.int64=le.prototype.uint64;le.prototype.sint64=function(e){var n=Hr.from(e).zzEncode();return this._push(jo,n.length(),n)};le.prototype.bool=function(e){return this._push(Po,1,e?1:0)};function Ao(t,e,n){e[n]=t&255,e[n+1]=t>>>8&255,e[n+2]=t>>>16&255,e[n+3]=t>>>24}le.prototype.fixed32=function(e){return this._push(Ao,4,e>>>0)};le.prototype.sfixed32=le.prototype.fixed32;le.prototype.fixed64=function(e){var n=Hr.from(e);return this._push(Ao,4,n.lo)._push(Ao,4,n.hi)};le.prototype.sfixed64=le.prototype.fixed64;le.prototype.float=function(e){return this._push(nt.float.writeFloatLE,4,e)};le.prototype.double=function(e){return this._push(nt.float.writeDoubleLE,8,e)};var zb=nt.Array.prototype.set?function(e,n,i){n.set(e,i)}:function(e,n,i){for(var r=0;r<e.length;++r)n[i+r]=e[r]};le.prototype.bytes=function(e){var n=e.length>>>0;if(!n)return this._push(Po,1,0);if(nt.isString(e)){var i=le.alloc(n=ef.length(e));ef.decode(e,i,0),e=i}return this.uint32(n)._push(zb,n,e)};le.prototype.string=function(e){var n=tf.length(e);return n?this.uint32(n)._push(tf.write,n,e):this._push(Po,1,0)};le.prototype.fork=function(){return this.states=new Ub(this),this.head=this.tail=new Ci(Lo,0,0),this.len=0,this};le.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Ci(Lo,0,0),this.len=0),this};le.prototype.ldelim=function(){var e=this.head,n=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=n,this.len+=i),this};le.prototype.finish=function(){for(var e=this.head.next,n=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,n,i),i+=e.len,e=e.next;return n};le._configure=function(t){No=t,le.create=nf(),No._configure()}});var of=k((wk,af)=>{"use strict";af.exports=Tt;var sf=qo();(Tt.prototype=Object.create(sf.prototype)).constructor=Tt;var Ft=Ut();function Tt(){sf.call(this)}Tt._configure=function(){Tt.alloc=Ft._Buffer_allocUnsafe,Tt.writeBytesBuffer=Ft.Buffer&&Ft.Buffer.prototype instanceof Uint8Array&&Ft.Buffer.prototype.set.name==="set"?function(e,n,i){n.set(e,i)}:function(e,n,i){if(e.copy)e.copy(n,i,0,e.length);else for(var r=0;r<e.length;)n[i++]=e[r++]}};Tt.prototype.bytes=function(e){Ft.isString(e)&&(e=Ft._Buffer_from(e,"base64"));var n=e.length>>>0;return this.uint32(n),n&&this._push(Tt.writeBytesBuffer,n,e),this};function Gb(t,e,n){t.length<40?Ft.utf8.write(t,e,n):e.utf8Write?e.utf8Write(t,n):e.write(t,n)}Tt.prototype.string=function(e){var n=Ft.Buffer.byteLength(e);return this.uint32(n),n&&this._push(Gb,n,e),this};Tt._configure()});var Do=k((_k,df)=>{"use strict";df.exports=we;var it=Ut(),Bo,uf=it.LongBits,Hb=it.utf8;function ut(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function we(t){this.buf=t,this.pos=0,this.len=t.length}var cf=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new we(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new we(e);throw Error("illegal buffer")},pf=function(){return it.Buffer?function(n){return(we.create=function(r){return it.Buffer.isBuffer(r)?new Bo(r):cf(r)})(n)}:cf};we.create=pf();we.prototype._slice=it.Array.prototype.subarray||it.Array.prototype.slice;we.prototype.uint32=(function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,ut(this,10);return e}})();we.prototype.int32=function(){return this.uint32()|0};we.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function $o(){var t=new uf(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw ut(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw ut(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}we.prototype.bool=function(){return this.uint32()!==0};function Kr(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}we.prototype.fixed32=function(){if(this.pos+4>this.len)throw ut(this,4);return Kr(this.buf,this.pos+=4)};we.prototype.sfixed32=function(){if(this.pos+4>this.len)throw ut(this,4);return Kr(this.buf,this.pos+=4)|0};function lf(){if(this.pos+8>this.len)throw ut(this,8);return new uf(Kr(this.buf,this.pos+=4),Kr(this.buf,this.pos+=4))}we.prototype.float=function(){if(this.pos+4>this.len)throw ut(this,4);var e=it.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};we.prototype.double=function(){if(this.pos+8>this.len)throw ut(this,4);var e=it.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};we.prototype.bytes=function(){var e=this.uint32(),n=this.pos,i=this.pos+e;if(i>this.len)throw ut(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(n,i);if(n===i){var r=it.Buffer;return r?r.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,n,i)};we.prototype.string=function(){var e=this.bytes();return Hb.read(e,0,e.length)};we.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw ut(this,e);this.pos+=e}else do if(this.pos>=this.len)throw ut(this);while(this.buf[this.pos++]&128);return this};we.recursionLimit=it.recursionLimit;we.prototype.skipType=function(t,e){if(e===void 0&&(e=0),e>we.recursionLimit)throw Error("maximum nesting depth exceeded");switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t,e+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};we._configure=function(t){Bo=t,we.create=pf(),Bo._configure();var e=it.Long?"toLong":"toNumber";it.merge(we.prototype,{int64:function(){return $o.call(this)[e](!1)},uint64:function(){return $o.call(this)[e](!0)},sint64:function(){return $o.call(this).zzDecode()[e](!1)},fixed64:function(){return lf.call(this)[e](!0)},sfixed64:function(){return lf.call(this)[e](!1)}})}});var gf=k((Tk,hf)=>{"use strict";hf.exports=on;var mf=Do();(on.prototype=Object.create(mf.prototype)).constructor=on;var ff=Ut();function on(t){mf.call(this,t)}on._configure=function(){ff.Buffer&&(on.prototype._slice=ff.Buffer.prototype.slice)};on.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};on._configure()});var vf=k((Sk,xf)=>{"use strict";xf.exports=Ni;var Uo=Ut();(Ni.prototype=Object.create(Uo.EventEmitter.prototype)).constructor=Ni;function Ni(t,e,n){if(typeof t!="function")throw TypeError("rpcImpl must be a function");Uo.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!n}Ni.prototype.rpcCall=function t(e,n,i,r,s){if(!r)throw TypeError("request must be specified");var a=this;if(!s)return Uo.asPromise(t,a,e,n,i,r);if(!a.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return a.rpcImpl(e,n[a.requestDelimited?"encodeDelimited":"encode"](r).finish(),function(c,l){if(c)return a.emit("error",c,e),s(c);if(l===null){a.end(!0);return}if(!(l instanceof i))try{l=i[a.responseDelimited?"decodeDelimited":"decode"](l)}catch(u){return a.emit("error",u,e),s(u)}return a.emit("data",l,e),s(null,l)})}catch(o){a.emit("error",o,e),setTimeout(function(){s(o)},0);return}};Ni.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var bf=k(yf=>{"use strict";var Kb=yf;Kb.Service=vf()});var _f=k((Ik,wf)=>{"use strict";wf.exports={}});var Ef=k(Sf=>{"use strict";var Ke=Sf;Ke.build="minimal";Ke.Writer=qo();Ke.BufferWriter=of();Ke.Reader=Do();Ke.BufferReader=gf();Ke.util=Ut();Ke.rpc=bf();Ke.roots=_f();Ke.configure=Tf;function Tf(){Ke.util._configure(),Ke.Writer._configure(Ke.BufferWriter),Ke.Reader._configure(Ke.BufferReader)}Tf()});var Rf=k((kk,If)=>{"use strict";If.exports=Ef()});var Of=k((Ok,kf)=>{"use strict";var St=Rf(),Ie=St.Reader,Ai=St.Writer,fe=St.util,se=St.roots.default||(St.roots.default={});se.cls=(function(){var t={};return t.Log=(function(){function e(n){if(this.contents=[],n)for(var i=Object.keys(n),r=0;r<i.length;++r)n[i[r]]!=null&&(this[i[r]]=n[i[r]])}return e.prototype.time=fe.Long?fe.Long.fromBits(0,0,!1):0,e.prototype.contents=fe.emptyArray,e.create=function(i){return new e(i)},e.encode=function(i,r){if(r||(r=Ai.create()),i.time!=null&&Object.hasOwnProperty.call(i,"time")&&r.uint32(8).int64(i.time),i.contents!=null&&i.contents.length)for(var s=0;s<i.contents.length;++s)se.cls.Log.Content.encode(i.contents[s],r.uint32(18).fork()).ldelim();return r},e.encodeDelimited=function(i,r){return this.encode(i,r).ldelim()},e.decode=function(i,r){i instanceof Ie||(i=Ie.create(i));for(var s=r===void 0?i.len:i.pos+r,a=new se.cls.Log;i.pos<s;){var o=i.uint32();switch(o>>>3){case 1:a.time=i.int64();break;case 2:a.contents&&a.contents.length||(a.contents=[]),a.contents.push(se.cls.Log.Content.decode(i,i.uint32()));break;default:i.skipType(o&7);break}}return a},e.decodeDelimited=function(i){return i instanceof Ie||(i=new Ie(i)),this.decode(i,i.uint32())},e.verify=function(i){if(typeof i!="object"||i===null)return"object expected";if(i.time!=null&&i.hasOwnProperty("time")&&!fe.isInteger(i.time)&&!(i.time&&fe.isInteger(i.time.low)&&fe.isInteger(i.time.high)))return"time: integer|Long expected";if(i.contents!=null&&i.hasOwnProperty("contents")){if(!Array.isArray(i.contents))return"contents: array expected";for(var r=0;r<i.contents.length;++r){var s=se.cls.Log.Content.verify(i.contents[r]);if(s)return"contents."+s}}return null},e.fromObject=function(i){if(i instanceof se.cls.Log)return i;var r=new se.cls.Log;if(i.time!=null&&(fe.Long?(r.time=fe.Long.fromValue(i.time)).unsigned=!1:typeof i.time=="string"?r.time=parseInt(i.time,10):typeof i.time=="number"?r.time=i.time:typeof i.time=="object"&&(r.time=new fe.LongBits(i.time.low>>>0,i.time.high>>>0).toNumber())),i.contents){if(!Array.isArray(i.contents))throw TypeError(".cls.Log.contents: array expected");r.contents=[];for(var s=0;s<i.contents.length;++s){if(typeof i.contents[s]!="object")throw TypeError(".cls.Log.contents: object expected");r.contents[s]=se.cls.Log.Content.fromObject(i.contents[s])}}return r},e.toObject=function(i,r){r||(r={});var s={};if((r.arrays||r.defaults)&&(s.contents=[]),r.defaults)if(fe.Long){var a=new fe.Long(0,0,!1);s.time=r.longs===String?a.toString():r.longs===Number?a.toNumber():a}else s.time=r.longs===String?"0":0;if(i.time!=null&&i.hasOwnProperty("time")&&(typeof i.time=="number"?s.time=r.longs===String?String(i.time):i.time:s.time=r.longs===String?fe.Long.prototype.toString.call(i.time):r.longs===Number?new fe.LongBits(i.time.low>>>0,i.time.high>>>0).toNumber():i.time),i.contents&&i.contents.length){s.contents=[];for(var o=0;o<i.contents.length;++o)s.contents[o]=se.cls.Log.Content.toObject(i.contents[o],r)}return s},e.prototype.toJSON=function(){return this.constructor.toObject(this,St.util.toJSONOptions)},e.Content=(function(){function n(i){if(i)for(var r=Object.keys(i),s=0;s<r.length;++s)i[r[s]]!=null&&(this[r[s]]=i[r[s]])}return n.prototype.key="",n.prototype.value="",n.create=function(r){return new n(r)},n.encode=function(r,s){return s||(s=Ai.create()),r.key!=null&&Object.hasOwnProperty.call(r,"key")&&s.uint32(10).string(r.key),r.value!=null&&Object.hasOwnProperty.call(r,"value")&&s.uint32(18).string(r.value),s},n.encodeDelimited=function(r,s){return this.encode(r,s).ldelim()},n.decode=function(r,s){r instanceof Ie||(r=Ie.create(r));for(var a=s===void 0?r.len:r.pos+s,o=new se.cls.Log.Content;r.pos<a;){var c=r.uint32();switch(c>>>3){case 1:o.key=r.string();break;case 2:o.value=r.string();break;default:r.skipType(c&7);break}}return o},n.decodeDelimited=function(r){return r instanceof Ie||(r=new Ie(r)),this.decode(r,r.uint32())},n.verify=function(r){return typeof r!="object"||r===null?"object expected":r.key!=null&&r.hasOwnProperty("key")&&!fe.isString(r.key)?"key: string expected":r.value!=null&&r.hasOwnProperty("value")&&!fe.isString(r.value)?"value: string expected":null},n.fromObject=function(r){if(r instanceof se.cls.Log.Content)return r;var s=new se.cls.Log.Content;return r.key!=null&&(s.key=String(r.key)),r.value!=null&&(s.value=String(r.value)),s},n.toObject=function(r,s){s||(s={});var a={};return s.defaults&&(a.key="",a.value=""),r.key!=null&&r.hasOwnProperty("key")&&(a.key=r.key),r.value!=null&&r.hasOwnProperty("value")&&(a.value=r.value),a},n.prototype.toJSON=function(){return this.constructor.toObject(this,St.util.toJSONOptions)},n})(),e})(),t.LogTag=(function(){function e(n){if(n)for(var i=Object.keys(n),r=0;r<i.length;++r)n[i[r]]!=null&&(this[i[r]]=n[i[r]])}return e.prototype.key="",e.prototype.value="",e.create=function(i){return new e(i)},e.encode=function(i,r){return r||(r=Ai.create()),i.key!=null&&Object.hasOwnProperty.call(i,"key")&&r.uint32(10).string(i.key),i.value!=null&&Object.hasOwnProperty.call(i,"value")&&r.uint32(18).string(i.value),r},e.encodeDelimited=function(i,r){return this.encode(i,r).ldelim()},e.decode=function(i,r){i instanceof Ie||(i=Ie.create(i));for(var s=r===void 0?i.len:i.pos+r,a=new se.cls.LogTag;i.pos<s;){var o=i.uint32();switch(o>>>3){case 1:a.key=i.string();break;case 2:a.value=i.string();break;default:i.skipType(o&7);break}}return a},e.decodeDelimited=function(i){return i instanceof Ie||(i=new Ie(i)),this.decode(i,i.uint32())},e.verify=function(i){return typeof i!="object"||i===null?"object expected":i.key!=null&&i.hasOwnProperty("key")&&!fe.isString(i.key)?"key: string expected":i.value!=null&&i.hasOwnProperty("value")&&!fe.isString(i.value)?"value: string expected":null},e.fromObject=function(i){if(i instanceof se.cls.LogTag)return i;var r=new se.cls.LogTag;return i.key!=null&&(r.key=String(i.key)),i.value!=null&&(r.value=String(i.value)),r},e.toObject=function(i,r){r||(r={});var s={};return r.defaults&&(s.key="",s.value=""),i.key!=null&&i.hasOwnProperty("key")&&(s.key=i.key),i.value!=null&&i.hasOwnProperty("value")&&(s.value=i.value),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,St.util.toJSONOptions)},e})(),t.LogGroup=(function(){function e(i){if(this.logs=[],this.logTags=[],i)for(var r=Object.keys(i),s=0;s<r.length;++s)i[r[s]]!=null&&(this[r[s]]=i[r[s]])}e.prototype.logs=fe.emptyArray,e.prototype.contextFlow=null,e.prototype.filename=null,e.prototype.source=null,e.prototype.logTags=fe.emptyArray;var n;return Object.defineProperty(e.prototype,"_contextFlow",{get:fe.oneOfGetter(n=["contextFlow"]),set:fe.oneOfSetter(n)}),Object.defineProperty(e.prototype,"_filename",{get:fe.oneOfGetter(n=["filename"]),set:fe.oneOfSetter(n)}),Object.defineProperty(e.prototype,"_source",{get:fe.oneOfGetter(n=["source"]),set:fe.oneOfSetter(n)}),e.create=function(r){return new e(r)},e.encode=function(r,s){if(s||(s=Ai.create()),r.logs!=null&&r.logs.length)for(var a=0;a<r.logs.length;++a)se.cls.Log.encode(r.logs[a],s.uint32(10).fork()).ldelim();if(r.contextFlow!=null&&Object.hasOwnProperty.call(r,"contextFlow")&&s.uint32(18).string(r.contextFlow),r.filename!=null&&Object.hasOwnProperty.call(r,"filename")&&s.uint32(26).string(r.filename),r.source!=null&&Object.hasOwnProperty.call(r,"source")&&s.uint32(34).string(r.source),r.logTags!=null&&r.logTags.length)for(var a=0;a<r.logTags.length;++a)se.cls.LogTag.encode(r.logTags[a],s.uint32(42).fork()).ldelim();return s},e.encodeDelimited=function(r,s){return this.encode(r,s).ldelim()},e.decode=function(r,s){r instanceof Ie||(r=Ie.create(r));for(var a=s===void 0?r.len:r.pos+s,o=new se.cls.LogGroup;r.pos<a;){var c=r.uint32();switch(c>>>3){case 1:o.logs&&o.logs.length||(o.logs=[]),o.logs.push(se.cls.Log.decode(r,r.uint32()));break;case 2:o.contextFlow=r.string();break;case 3:o.filename=r.string();break;case 4:o.source=r.string();break;case 5:o.logTags&&o.logTags.length||(o.logTags=[]),o.logTags.push(se.cls.LogTag.decode(r,r.uint32()));break;default:r.skipType(c&7);break}}return o},e.decodeDelimited=function(r){return r instanceof Ie||(r=new Ie(r)),this.decode(r,r.uint32())},e.verify=function(r){if(typeof r!="object"||r===null)return"object expected";var s={};if(r.logs!=null&&r.hasOwnProperty("logs")){if(!Array.isArray(r.logs))return"logs: array expected";for(var a=0;a<r.logs.length;++a){var o=se.cls.Log.verify(r.logs[a]);if(o)return"logs."+o}}if(r.contextFlow!=null&&r.hasOwnProperty("contextFlow")&&(s._contextFlow=1,!fe.isString(r.contextFlow)))return"contextFlow: string expected";if(r.filename!=null&&r.hasOwnProperty("filename")&&(s._filename=1,!fe.isString(r.filename)))return"filename: string expected";if(r.source!=null&&r.hasOwnProperty("source")&&(s._source=1,!fe.isString(r.source)))return"source: string expected";if(r.logTags!=null&&r.hasOwnProperty("logTags")){if(!Array.isArray(r.logTags))return"logTags: array expected";for(var a=0;a<r.logTags.length;++a){var o=se.cls.LogTag.verify(r.logTags[a]);if(o)return"logTags."+o}}return null},e.fromObject=function(r){if(r instanceof se.cls.LogGroup)return r;var s=new se.cls.LogGroup;if(r.logs){if(!Array.isArray(r.logs))throw TypeError(".cls.LogGroup.logs: array expected");s.logs=[];for(var a=0;a<r.logs.length;++a){if(typeof r.logs[a]!="object")throw TypeError(".cls.LogGroup.logs: object expected");s.logs[a]=se.cls.Log.fromObject(r.logs[a])}}if(r.contextFlow!=null&&(s.contextFlow=String(r.contextFlow)),r.filename!=null&&(s.filename=String(r.filename)),r.source!=null&&(s.source=String(r.source)),r.logTags){if(!Array.isArray(r.logTags))throw TypeError(".cls.LogGroup.logTags: array expected");s.logTags=[];for(var a=0;a<r.logTags.length;++a){if(typeof r.logTags[a]!="object")throw TypeError(".cls.LogGroup.logTags: object expected");s.logTags[a]=se.cls.LogTag.fromObject(r.logTags[a])}}return s},e.toObject=function(r,s){s||(s={});var a={};if((s.arrays||s.defaults)&&(a.logs=[],a.logTags=[]),r.logs&&r.logs.length){a.logs=[];for(var o=0;o<r.logs.length;++o)a.logs[o]=se.cls.Log.toObject(r.logs[o],s)}if(r.contextFlow!=null&&r.hasOwnProperty("contextFlow")&&(a.contextFlow=r.contextFlow,s.oneofs&&(a._contextFlow="contextFlow")),r.filename!=null&&r.hasOwnProperty("filename")&&(a.filename=r.filename,s.oneofs&&(a._filename="filename")),r.source!=null&&r.hasOwnProperty("source")&&(a.source=r.source,s.oneofs&&(a._source="source")),r.logTags&&r.logTags.length){a.logTags=[];for(var o=0;o<r.logTags.length;++o)a.logTags[o]=se.cls.LogTag.toObject(r.logTags[o],s)}return a},e.prototype.toJSON=function(){return this.constructor.toObject(this,St.util.toJSONOptions)},e})(),t.LogGroupList=(function(){function e(n){if(this.logGroupList=[],n)for(var i=Object.keys(n),r=0;r<i.length;++r)n[i[r]]!=null&&(this[i[r]]=n[i[r]])}return e.prototype.logGroupList=fe.emptyArray,e.create=function(i){return new e(i)},e.encode=function(i,r){if(r||(r=Ai.create()),i.logGroupList!=null&&i.logGroupList.length)for(var s=0;s<i.logGroupList.length;++s)se.cls.LogGroup.encode(i.logGroupList[s],r.uint32(10).fork()).ldelim();return r},e.encodeDelimited=function(i,r){return this.encode(i,r).ldelim()},e.decode=function(i,r){i instanceof Ie||(i=Ie.create(i));for(var s=r===void 0?i.len:i.pos+r,a=new se.cls.LogGroupList;i.pos<s;){var o=i.uint32();switch(o>>>3){case 1:a.logGroupList&&a.logGroupList.length||(a.logGroupList=[]),a.logGroupList.push(se.cls.LogGroup.decode(i,i.uint32()));break;default:i.skipType(o&7);break}}return a},e.decodeDelimited=function(i){return i instanceof Ie||(i=new Ie(i)),this.decode(i,i.uint32())},e.verify=function(i){if(typeof i!="object"||i===null)return"object expected";if(i.logGroupList!=null&&i.hasOwnProperty("logGroupList")){if(!Array.isArray(i.logGroupList))return"logGroupList: array expected";for(var r=0;r<i.logGroupList.length;++r){var s=se.cls.LogGroup.verify(i.logGroupList[r]);if(s)return"logGroupList."+s}}return null},e.fromObject=function(i){if(i instanceof se.cls.LogGroupList)return i;var r=new se.cls.LogGroupList;if(i.logGroupList){if(!Array.isArray(i.logGroupList))throw TypeError(".cls.LogGroupList.logGroupList: array expected");r.logGroupList=[];for(var s=0;s<i.logGroupList.length;++s){if(typeof i.logGroupList[s]!="object")throw TypeError(".cls.LogGroupList.logGroupList: object expected");r.logGroupList[s]=se.cls.LogGroup.fromObject(i.logGroupList[s])}}return r},e.toObject=function(i,r){r||(r={});var s={};if((r.arrays||r.defaults)&&(s.logGroupList=[]),i.logGroupList&&i.logGroupList.length){s.logGroupList=[];for(var a=0;a<i.logGroupList.length;++a)s.logGroupList[a]=se.cls.LogGroup.toObject(i.logGroupList[a],r)}return s},e.prototype.toJSON=function(){return this.constructor.toObject(this,St.util.toJSONOptions)},e})(),t})();kf.exports=se});var Fo=k(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.Content=zt.LogItem=zt.LogGroup=void 0;var cn=Of(),Vb=(function(){function t(){this.mLogs=new cn.cls.LogGroup}return t.prototype.getFilename=function(){return this.mLogs.filename||""},t.prototype.setFilename=function(e){this.mLogs.filename=e},t.prototype.getSource=function(){return this.mLogs.source||""},t.prototype.setSource=function(e){this.mLogs.source=e},t.prototype.addLogs=function(e){this.mLogs.logs.push(e.getLog())},t.prototype.encode=function(){var e=new cn.cls.LogGroupList;return e.logGroupList.push(this.mLogs),cn.cls.LogGroupList.encode(e).finish()},t.prototype.decode=function(e){return cn.cls.LogGroupList.decode(e).toJSON()},t.prototype.verify=function(e){return cn.cls.LogGroupList.verify(e)},t})();zt.LogGroup=Vb;var Wb=(function(){function t(){this.mContents=new cn.cls.Log}return t.prototype.pushBack=function(e){this.mContents.contents.push(e.getContent())},t.prototype.setTime=function(e){this.mContents.time=e},t.prototype.getLog=function(){return this.mContents},t.prototype.setLength=function(e){this.logLength=e},t.prototype.getLength=function(){return this.logLength},t})();zt.LogItem=Wb;var Jb=(function(){function t(e,n){this.content=new cn.cls.Log.Content({key:e,value:n})}return t.prototype.getContent=function(){return this.content},t})();zt.Content=Jb});var zo=k(Pn=>{"use strict";var Xb=Pn&&Pn.__extends||(function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function i(){this.constructor=e}e.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}})();Object.defineProperty(Pn,"__esModule",{value:!0});Pn.TencentCloudClsSDKException=void 0;var Yb=(function(t){Xb(e,t);function e(n,i,r){r===void 0&&(r="");var s=t.call(this,i)||this;return s.status=n,s.requestId=r||"",s.name="TencentCloudClsSDKException",Object.setPrototypeOf(s,e.prototype),Error.captureStackTrace(s,s.constructor),s}return e.prototype.getMessage=function(){return this.message},e.prototype.getRequestId=function(){return this.requestId},e.prototype.toString=function(){return"[TencentCloudSDKException]message:"+this.getMessage()+" requestId:"+this.getRequestId()+"status:"+this.status},e.prototype.toLocaleString=function(){return"[TencentCloudSDKException]message:"+this.message+" requestId:"+this.requestId},e})(Error);Pn.TencentCloudClsSDKException=Yb});var Cf=k(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.CONST_MAX_PUT_SIZE=ye.UPLOAD_LOG_RESOURCE_URI=ye.TOPIC_ID=ye.HTTP_SEND_TIME_OUT=ye.CONST_HOST=ye.CONST_HTTP_METHOD_POST=ye.CONST_GZIP_ENCODING=ye.CONST_AUTHORIZATION=ye.CONST_CONTENT_LENGTH=ye.CONST_PROTO_BUF=ye.CONST_CONTENT_TYPE=void 0;ye.CONST_CONTENT_TYPE="Content-Type";ye.CONST_PROTO_BUF="application/x-protobuf";ye.CONST_CONTENT_LENGTH="Content-Length";ye.CONST_AUTHORIZATION="Authorization";ye.CONST_GZIP_ENCODING="deflate";ye.CONST_HTTP_METHOD_POST="POST";ye.CONST_HOST="Host";ye.HTTP_SEND_TIME_OUT=60;ye.TOPIC_ID="topic_id";ye.UPLOAD_LOG_RESOURCE_URI="/structuredlog";ye.CONST_MAX_PUT_SIZE=3145728});var jf=k(Mn=>{"use strict";var Mf=Mn&&Mn.__values||function(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.signature=void 0;var Go=Y("crypto"),Nf=function(t){var e,n,i=[];try{for(var r=Mf(t.keys()),s=r.next();!s.done;s=r.next()){var a=s.value;t.has(a)&&i.push(a)}}catch(o){e={error:o}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return i.sort(function(o,c){return o=o.toLowerCase(),c=c.toLowerCase(),o===c?0:o>c?1:-1})},Af=function(t){var e,n,i=[];try{for(var r=Mf(t.keys()),s=r.next();!s.done;s=r.next()){var a=s.value,o=a.toLowerCase();t.has(a)&&(o==="content-type"||o==="content-md5"||o==="host"||o[0]==="x")&&i.push(a)}}catch(c){e={error:c}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return i.sort(function(c,l){return c=c.toLowerCase(),l=l.toLowerCase(),c===l?0:c>l?1:-1})},Lf=function(t){return encodeURIComponent(t).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")},Pf=function(t,e){var n,i,r,s=[],a=e(t);for(n=0;n<a.length;n++)i=a[n],r=t.get(i)===void 0?"":""+t.get(i),i=i.toLowerCase(),i=Lf(i),r=Lf(r)||"",s.push(i+"="+r);return s.join("&")};function Zb(t,e,n,i,r,s,a){var o,c,l=Math.floor(Date.now()/1e3),u=l+a;l=l-60;var f="sha1",x=t,S=l+";"+u,b=S,w=(o=Af(s))===null||o===void 0?void 0:o.join(";").toLowerCase(),g=(c=Nf(r))===null||c===void 0?void 0:c.join(";").toLowerCase(),C=Go.createHmac("sha1",e).update(b).digest("hex"),z=[n.toLowerCase(),i,Pf(r,Nf),Pf(s,Af),""].join(`
12
- `),q=Go.createHash("sha1").update(z).digest("hex"),N=["sha1",S,q,""].join(`
13
- `),I=Go.createHmac("sha1",C).update(N).digest("hex"),H=["q-sign-algorithm="+f,"q-ak="+x,"q-sign-time="+S,"q-key-time="+b,"q-header-list="+w,"q-url-param-list="+g,"q-signature="+I].join("&");return H}Mn.signature=Zb});var Bf=k((Pk,$f)=>{var qf=Y("stream").Stream,Qb=Y("util");$f.exports=pt;function pt(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}Qb.inherits(pt,qf);pt.create=function(t,e){var n=new this;e=e||{};for(var i in e)n[i]=e[i];n.source=t;var r=t.emit;return t.emit=function(){return n._handleEmit(arguments),r.apply(t,arguments)},t.on("error",function(){}),n.pauseStream&&t.pause(),n};Object.defineProperty(pt.prototype,"readable",{configurable:!0,enumerable:!0,get:function(){return this.source.readable}});pt.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};pt.prototype.resume=function(){this._released||this.release(),this.source.resume()};pt.prototype.pause=function(){this.source.pause()};pt.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(t){this.emit.apply(this,t)}.bind(this)),this._bufferedEvents=[]};pt.prototype.pipe=function(){var t=qf.prototype.pipe.apply(this,arguments);return this.resume(),t};pt.prototype._handleEmit=function(t){if(this._released){this.emit.apply(this,t);return}t[0]==="data"&&(this.dataSize+=t[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(t)};pt.prototype._checkIfMaxDataSizeExceeded=function(){if(!this._maxDataSizeExceeded&&!(this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(t))}}});var zf=k((Mk,Ff)=>{var ew=Y("util"),Uf=Y("stream").Stream,Df=Bf();Ff.exports=Te;function Te(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2*1024*1024,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}ew.inherits(Te,Uf);Te.create=function(t){var e=new this;t=t||{};for(var n in t)e[n]=t[n];return e};Te.isStreamLike=function(t){return typeof t!="function"&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"&&!Buffer.isBuffer(t)};Te.prototype.append=function(t){var e=Te.isStreamLike(t);if(e){if(!(t instanceof Df)){var n=Df.create(t,{maxDataSize:1/0,pauseStream:this.pauseStreams});t.on("data",this._checkDataSize.bind(this)),t=n}this._handleErrors(t),this.pauseStreams&&t.pause()}return this._streams.push(t),this};Te.prototype.pipe=function(t,e){return Uf.prototype.pipe.call(this,t,e),this.resume(),t};Te.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{do this._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};Te.prototype._realGetNext=function(){var t=this._streams.shift();if(typeof t>"u"){this.end();return}if(typeof t!="function"){this._pipeNext(t);return}var e=t;e(function(n){var i=Te.isStreamLike(n);i&&(n.on("data",this._checkDataSize.bind(this)),this._handleErrors(n)),this._pipeNext(n)}.bind(this))};Te.prototype._pipeNext=function(t){this._currentStream=t;var e=Te.isStreamLike(t);if(e){t.on("end",this._getNext.bind(this)),t.pipe(this,{end:!1});return}var n=t;this.write(n),this._getNext()};Te.prototype._handleErrors=function(t){var e=this;t.on("error",function(n){e._emitError(n)})};Te.prototype.write=function(t){this.emit("data",t)};Te.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};Te.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function"&&this._currentStream.resume(),this.emit("resume")};Te.prototype.end=function(){this._reset(),this.emit("end")};Te.prototype.destroy=function(){this._reset(),this.emit("close")};Te.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};Te.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(t))}};Te.prototype._updateDataSize=function(){this.dataSize=0;var t=this;this._streams.forEach(function(e){e.dataSize&&(t.dataSize+=e.dataSize)}),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)};Te.prototype._emitError=function(t){this._reset(),this.emit("error",t)}});var Gf=k((jk,tw)=>{tw.exports={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"iana"},"application/activemessage":{source:"iana"},"application/activity+json":{source:"iana",compressible:!0},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/alto-updatestreamcontrol+json":{source:"iana",compressible:!0},"application/alto-updatestreamparams+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/at+jwt":{source:"iana"},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",compressible:!0,extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana",compressible:!0,extensions:["atomdeleted"]},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",compressible:!0,extensions:["atomsvc"]},"application/atsc-dwd+xml":{source:"iana",compressible:!0,extensions:["dwd"]},"application/atsc-dynamic-event-message":{source:"iana"},"application/atsc-held+xml":{source:"iana",compressible:!0,extensions:["held"]},"application/atsc-rdt+json":{source:"iana",compressible:!0},"application/atsc-rsat+xml":{source:"iana",compressible:!0,extensions:["rsat"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana",compressible:!0},"application/bacnet-xdd+zip":{source:"iana",compressible:!1},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana",compressible:!0,extensions:["xcs"]},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/captive+json":{source:"iana",compressible:!0},"application/cbor":{source:"iana"},"application/cbor-seq":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana",compressible:!0},"application/ccxml+xml":{source:"iana",compressible:!0,extensions:["ccxml"]},"application/cdfx+xml":{source:"iana",compressible:!0,extensions:["cdfx"]},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana",compressible:!0},"application/cellml+xml":{source:"iana",compressible:!0},"application/cfw":{source:"iana"},"application/city+json":{source:"iana",compressible:!0},"application/clr":{source:"iana"},"application/clue+xml":{source:"iana",compressible:!0},"application/clue_info+xml":{source:"iana",compressible:!0},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana",compressible:!0},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana",compressible:!0},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana",compressible:!0,extensions:["cpl"]},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana",compressible:!0},"application/cstadata+xml":{source:"iana",compressible:!0},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cwt":{source:"iana"},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",compressible:!0,extensions:["mpd"]},"application/dash-patch+xml":{source:"iana",compressible:!0,extensions:["mpp"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",compressible:!0,extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana",compressible:!0},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana",compressible:!0},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/dns+json":{source:"iana",compressible:!0},"application/dns-message":{source:"iana"},"application/docbook+xml":{source:"apache",compressible:!0,extensions:["dbk"]},"application/dots+cbor":{source:"iana"},"application/dskpp+xml":{source:"iana",compressible:!0},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",compressible:!0,extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["es","ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/elm+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/elm+xml":{source:"iana",compressible:!0},"application/emergencycalldata.cap+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/emergencycalldata.comment+xml":{source:"iana",compressible:!0},"application/emergencycalldata.control+xml":{source:"iana",compressible:!0},"application/emergencycalldata.deviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.serviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.subscriberinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.veds+xml":{source:"iana",compressible:!0},"application/emma+xml":{source:"iana",compressible:!0,extensions:["emma"]},"application/emotionml+xml":{source:"iana",compressible:!0,extensions:["emotionml"]},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana",compressible:!0},"application/epub+zip":{source:"iana",compressible:!1,extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/expect-ct-report+json":{source:"iana",compressible:!0},"application/express":{source:"iana",extensions:["exp"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana",compressible:!0,extensions:["fdt"]},"application/fhir+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/fhir+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/flexfec":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1},"application/framework-attributes+xml":{source:"iana",compressible:!0},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geopackage+sqlite3":{source:"iana"},"application/geoxacml+xml":{source:"iana",compressible:!0},"application/gltf-buffer":{source:"iana"},"application/gml+xml":{source:"iana",compressible:!0,extensions:["gml"]},"application/gpx+xml":{source:"apache",compressible:!0,extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana",compressible:!0},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana",compressible:!0},"application/ibe-pkg-reply+xml":{source:"iana",compressible:!0},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",compressible:!0,extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana",compressible:!0,extensions:["its"]},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/jscalendar+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana",compressible:!0},"application/kpml-response+xml":{source:"iana",compressible:!0},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana",compressible:!0,extensions:["lgr"]},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana",compressible:!0},"application/lost+xml":{source:"iana",compressible:!0,extensions:["lostxml"]},"application/lostsync+xml":{source:"iana",compressible:!0},"application/lpf+zip":{source:"iana",compressible:!1},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",compressible:!0,extensions:["mads"]},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",compressible:!0,extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",compressible:!0,extensions:["mathml"]},"application/mathml-content+xml":{source:"iana",compressible:!0},"application/mathml-presentation+xml":{source:"iana",compressible:!0},"application/mbms-associated-procedure-description+xml":{source:"iana",compressible:!0},"application/mbms-deregister+xml":{source:"iana",compressible:!0},"application/mbms-envelope+xml":{source:"iana",compressible:!0},"application/mbms-msk+xml":{source:"iana",compressible:!0},"application/mbms-msk-response+xml":{source:"iana",compressible:!0},"application/mbms-protection-description+xml":{source:"iana",compressible:!0},"application/mbms-reception-report+xml":{source:"iana",compressible:!0},"application/mbms-register+xml":{source:"iana",compressible:!0},"application/mbms-register-response+xml":{source:"iana",compressible:!0},"application/mbms-schedule+xml":{source:"iana",compressible:!0},"application/mbms-user-service-description+xml":{source:"iana",compressible:!0},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana",compressible:!0,extensions:["mpf"]},"application/media_control+xml":{source:"iana",compressible:!0},"application/mediaservercontrol+xml":{source:"iana",compressible:!0,extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",compressible:!0,extensions:["metalink"]},"application/metalink4+xml":{source:"iana",compressible:!0,extensions:["meta4"]},"application/mets+xml":{source:"iana",compressible:!0,extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mipc":{source:"iana"},"application/missing-blocks+cbor-seq":{source:"iana"},"application/mmt-aei+xml":{source:"iana",compressible:!0,extensions:["maei"]},"application/mmt-usd+xml":{source:"iana",compressible:!0,extensions:["musd"]},"application/mods+xml":{source:"iana",compressible:!0,extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana",compressible:!0},"application/mrb-publish+xml":{source:"iana",compressible:!0},"application/msc-ivr+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msc-mixer+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/multipart-core":{source:"iana"},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana",extensions:["nq"]},"application/n-triples":{source:"iana",extensions:["nt"]},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana",charset:"US-ASCII"},"application/news-groupinfo":{source:"iana",charset:"US-ASCII"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana",compressible:!0},"application/node":{source:"iana",extensions:["cjs"]},"application/nss":{source:"iana"},"application/oauth-authz-req+jwt":{source:"iana"},"application/oblivious-dns-message":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odm+xml":{source:"iana",compressible:!0},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",compressible:!0,extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",compressible:!0,extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{source:"iana",compressible:!0},"application/oscore":{source:"iana"},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p21":{source:"iana"},"application/p21+zip":{source:"iana",compressible:!1},"application/p2p-overlay+xml":{source:"iana",compressible:!0,extensions:["relo"]},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",compressible:!0,extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pem-certificate-chain":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana",extensions:["asc"]},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pidf-diff+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",compressible:!0,extensions:["pls"]},"application/poc-settings+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana",compressible:!0},"application/provenance+xml":{source:"iana",compressible:!0,extensions:["provx"]},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.cyn":{source:"iana",charset:"7-BIT"},"application/prs.hpub+zip":{source:"iana",compressible:!1},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana",compressible:!0},"application/pskc+xml":{source:"iana",compressible:!0,extensions:["pskcxml"]},"application/pvd+json":{source:"iana",compressible:!0},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf","owl"]},"application/reginfo+xml":{source:"iana",compressible:!0,extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",compressible:!0,extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",compressible:!0,extensions:["rld"]},"application/rfc+xml":{source:"iana",compressible:!0},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana",compressible:!0},"application/rls-services+xml":{source:"iana",compressible:!0,extensions:["rs"]},"application/route-apd+xml":{source:"iana",compressible:!0,extensions:["rapd"]},"application/route-s-tsid+xml":{source:"iana",compressible:!0,extensions:["sls"]},"application/route-usd+xml":{source:"iana",compressible:!0,extensions:["rusd"]},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",compressible:!0,extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana",compressible:!0},"application/samlmetadata+xml":{source:"iana",compressible:!0},"application/sarif+json":{source:"iana",compressible:!0},"application/sarif-external-properties+json":{source:"iana",compressible:!0},"application/sbe":{source:"iana"},"application/sbml+xml":{source:"iana",compressible:!0,extensions:["sbml"]},"application/scaip+xml":{source:"iana",compressible:!0},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/secevent+jwt":{source:"iana"},"application/senml+cbor":{source:"iana"},"application/senml+json":{source:"iana",compressible:!0},"application/senml+xml":{source:"iana",compressible:!0,extensions:["senmlx"]},"application/senml-etch+cbor":{source:"iana"},"application/senml-etch+json":{source:"iana",compressible:!0},"application/senml-exi":{source:"iana"},"application/sensml+cbor":{source:"iana"},"application/sensml+json":{source:"iana",compressible:!0},"application/sensml+xml":{source:"iana",compressible:!0,extensions:["sensmlx"]},"application/sensml-exi":{source:"iana"},"application/sep+xml":{source:"iana",compressible:!0},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",compressible:!0,extensions:["shf"]},"application/sieve":{source:"iana",extensions:["siv","sieve"]},"application/simple-filter+xml":{source:"iana",compressible:!0},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/sipc":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",compressible:!0,extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",compressible:!0,extensions:["srx"]},"application/spdx+json":{source:"iana",compressible:!0},"application/spirits-event+xml":{source:"iana",compressible:!0},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",compressible:!0,extensions:["grxml"]},"application/sru+xml":{source:"iana",compressible:!0,extensions:["sru"]},"application/ssdl+xml":{source:"apache",compressible:!0,extensions:["ssdl"]},"application/ssml+xml":{source:"iana",compressible:!0,extensions:["ssml"]},"application/stix+json":{source:"iana",compressible:!0},"application/swid+xml":{source:"iana",compressible:!0,extensions:["swidtag"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/taxii+json":{source:"iana",compressible:!0},"application/td+json":{source:"iana",compressible:!0},"application/tei+xml":{source:"iana",compressible:!0,extensions:["tei","teicorpus"]},"application/tetra_isi":{source:"iana"},"application/thraud+xml":{source:"iana",compressible:!0,extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tlsrpt+gzip":{source:"iana"},"application/tlsrpt+json":{source:"iana",compressible:!0},"application/tnauthlist":{source:"iana"},"application/token-introspection+jwt":{source:"iana"},"application/toml":{compressible:!0,extensions:["toml"]},"application/trickle-ice-sdpfrag":{source:"iana"},"application/trig":{source:"iana",extensions:["trig"]},"application/ttml+xml":{source:"iana",compressible:!0,extensions:["ttml"]},"application/tve-trigger":{source:"iana"},"application/tzif":{source:"iana"},"application/tzif-leap":{source:"iana"},"application/ubjson":{compressible:!1,extensions:["ubj"]},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana",compressible:!0},"application/urc-ressheet+xml":{source:"iana",compressible:!0,extensions:["rsheet"]},"application/urc-targetdesc+xml":{source:"iana",compressible:!0,extensions:["td"]},"application/urc-uisocketdesc+xml":{source:"iana",compressible:!0},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana",compressible:!0},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana",compressible:!0,extensions:["1km"]},"application/vnd.3gpp-prose+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.5gnas":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.bsf+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gmop+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gtpc":{source:"iana"},"application/vnd.3gpp.interworking-data":{source:"iana"},"application/vnd.3gpp.lpp":{source:"iana"},"application/vnd.3gpp.mc-signalling-ear":{source:"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-payload":{source:"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-signalling":{source:"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-init-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-transmission-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mid-call+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ngap":{source:"iana"},"application/vnd.3gpp.pfcp":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.s1ap":{source:"iana"},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ussd+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",compressible:!1,extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",compressible:!0,extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.afpc.afplinedata":{source:"iana"},"application/vnd.afpc.afplinedata-pagedef":{source:"iana"},"application/vnd.afpc.cmoca-cmresource":{source:"iana"},"application/vnd.afpc.foca-charset":{source:"iana"},"application/vnd.afpc.foca-codedfont":{source:"iana"},"application/vnd.afpc.foca-codepage":{source:"iana"},"application/vnd.afpc.modca":{source:"iana"},"application/vnd.afpc.modca-cmtable":{source:"iana"},"application/vnd.afpc.modca-formdef":{source:"iana"},"application/vnd.afpc.modca-mediummap":{source:"iana"},"application/vnd.afpc.modca-objectcontainer":{source:"iana"},"application/vnd.afpc.modca-overlay":{source:"iana"},"application/vnd.afpc.modca-pagesegment":{source:"iana"},"application/vnd.age":{source:"iana",extensions:["age"]},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana",compressible:!0},"application/vnd.android.ota":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.arrow.file":{source:"iana"},"application/vnd.apache.arrow.stream":{source:"iana"},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.aplextor.warrp+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",compressible:!0,extensions:["mpkg"]},"application/vnd.apple.keynote":{source:"iana",extensions:["key"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.numbers":{source:"iana",extensions:["numbers"]},"application/vnd.apple.pages":{source:"iana",extensions:["pages"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artisan+json":{source:"iana",compressible:!0},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana",compressible:!0},"application/vnd.balsamiq.bmml+xml":{source:"iana",compressible:!0,extensions:["bmml"]},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.banana-accounting":{source:"iana"},"application/vnd.bbf.usp.error":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana",compressible:!0},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.bpf":{source:"iana"},"application/vnd.bpf3":{source:"iana"},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.byu.uapi+json":{source:"iana",compressible:!0},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",compressible:!0,extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.ciedi":{source:"iana"},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana",compressible:!0,extensions:["csl"]},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana",compressible:!1},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",compressible:!0,extensions:["wbs"]},"application/vnd.cryptii.pipe+json":{source:"iana",compressible:!0},"application/vnd.crypto-shade-file":{source:"iana"},"application/vnd.cryptomator.encrypted":{source:"iana"},"application/vnd.cryptomator.vault":{source:"iana"},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana",compressible:!0},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana",compressible:!0},"application/vnd.cybank":{source:"iana"},"application/vnd.cyclonedx+json":{source:"iana",compressible:!0},"application/vnd.cyclonedx+xml":{source:"iana",compressible:!0},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana",compressible:!1},"application/vnd.d3m-dataset":{source:"iana"},"application/vnd.d3m-problem":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.dbf":{source:"iana",extensions:["dbf"]},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",compressible:!0,extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume.movie":{source:"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana",compressible:!0},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbisl+xml":{source:"iana",compressible:!0},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-container+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-generic+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-init+xml":{source:"iana",compressible:!0},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.eclipse.ditto+json":{source:"iana",compressible:!0},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana",compressible:!0},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana",compressible:!0},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana",compressible:!1},"application/vnd.eszigno3+xml":{source:"iana",compressible:!0,extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.asic-e+zip":{source:"iana",compressible:!1},"application/vnd.etsi.asic-s+zip":{source:"iana",compressible:!1},"application/vnd.etsi.cug+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvcommand+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvservice+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsync+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvueprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mcid+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana",compressible:!0},"application/vnd.etsi.pstn+xml":{source:"iana",compressible:!0},"application/vnd.etsi.sci+xml":{source:"iana",compressible:!0},"application/vnd.etsi.simservs+xml":{source:"iana",compressible:!0},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana",compressible:!0},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eu.kasparian.car+json":{source:"iana",compressible:!0},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.exstream-empower+zip":{source:"iana",compressible:!1},"application/vnd.exstream-package":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.familysearch.gedcom+zip":{source:"iana",compressible:!1},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.ficlab.flb+zip":{source:"iana",compressible:!1},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujifilm.fb.docuworks":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.container":{source:"iana"},"application/vnd.fujifilm.fb.jfi+xml":{source:"iana",compressible:!0},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.futoin+cbor":{source:"iana"},"application/vnd.futoin+json":{source:"iana",compressible:!0},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.gentics.grd+json":{source:"iana",compressible:!0},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana",compressible:!0},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.slides":{source:"iana"},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana",compressible:!0},"application/vnd.gov.sk.e-form+zip":{source:"iana",compressible:!1},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana",compressible:!0},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",compressible:!0,extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",compressible:!0,extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hl7cda+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hl7v2+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper+json":{source:"iana",compressible:!0},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana",compressible:!1},"application/vnd.imagemeter.image+zip":{source:"iana",compressible:!1},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana",compressible:!0},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana",compressible:!0},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.packageitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.planningitem+xml":{source:"iana",compressible:!0},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",compressible:!0,extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.iso11783-10+zip":{source:"iana",compressible:!1},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las":{source:"iana"},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",compressible:!0,extensions:["lasxml"]},"application/vnd.laszip":{source:"iana"},"application/vnd.leap+json":{source:"iana",compressible:!0},"application/vnd.liberty-request+xml":{source:"iana",compressible:!0},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",compressible:!0,extensions:["lbe"]},"application/vnd.logipipe.circuit+zip":{source:"iana",compressible:!1},"application/vnd.loom":{source:"iana"},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana",extensions:["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.conftoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.license+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxar.archive.3tz+zip":{source:"iana",compressible:!1},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana",compressible:!0},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana",compressible:!0},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana",compressible:!0},"application/vnd.ms-printing.printticket+xml":{source:"apache",compressible:!0},"application/vnd.ms-printschematicket+xml":{source:"iana",compressible:!0},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.nacamar.ybrid+json":{source:"iana",compressible:!0},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nebumind.line":{source:"iana"},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nimn":{source:"iana"},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana",compressible:!0},"application/vnd.nokia.iptv.config+xml":{source:"iana",compressible:!0},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana",compressible:!0},"application/vnd.nokia.landmarkcollection+xml":{source:"iana",compressible:!0},"application/vnd.nokia.n-gage.ac+xml":{source:"iana",compressible:!0,extensions:["ac"]},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana",compressible:!0},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oci.image.manifest.v1+json":{source:"iana",compressible:!0},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana",compressible:!0},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana",compressible:!0},"application/vnd.oipf.dae.xhtml+xml":{source:"iana",compressible:!0},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana",compressible:!0},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.oipf.spdlist+xml":{source:"iana",compressible:!0},"application/vnd.oipf.ueprofile+xml":{source:"iana",compressible:!0},"application/vnd.oipf.userprofile+xml":{source:"iana",compressible:!0},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.imd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sprov+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-feature-handler+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-pcc+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-subs-invite+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-user-prefs+xml":{source:"iana",compressible:!0},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",compressible:!0,extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana",compressible:!0},"application/vnd.oma.group-usage-list+xml":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+cbor":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.final-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.groups+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana",compressible:!0},"application/vnd.oma.xcap-directory+xml":{source:"iana",compressible:!0},"application/vnd.omads-email+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-file+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-folder+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana",compressible:!0,extensions:["obgx"]},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana",compressible:!0,extensions:["osm"]},"application/vnd.opentimestamps.ots":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana",compressible:!0},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana",compressible:!0},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos.xml":{source:"iana"},"application/vnd.patentdive":{source:"iana"},"application/vnd.patientecommsdoc":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana",compressible:!0},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.psfs":{source:"iana"},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana",compressible:!0},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana",compressible:!0},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana",extensions:["rar"]},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",compressible:!0,extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.resilient.logic":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",compressible:!0,extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sar":{source:"iana"},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.seis+json":{source:"iana",compressible:!0},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shade-save-file":{source:"iana"},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.shootproof+json":{source:"iana",compressible:!0},"application/vnd.shopkick+json":{source:"iana",compressible:!0},"application/vnd.shp":{source:"iana"},"application/vnd.shx":{source:"iana"},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.snesdev-page-table":{source:"iana"},"application/vnd.software602.filler.form+xml":{source:"iana",compressible:!0,extensions:["fo"]},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",compressible:!0,extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.sycle+xml":{source:"iana",compressible:!0},"application/vnd.syft+json":{source:"iana",compressible:!0},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",charset:"UTF-8",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{source:"iana",compressible:!0},"application/vnd.tmd.mediaflex.api+xml":{source:"iana",compressible:!0},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",compressible:!0,extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.veritone.aion+json":{source:"iana",compressible:!0},"application/vnd.veryant.thin":{source:"iana"},"application/vnd.ves.encrypted":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",charset:"UTF-8",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.dpp":{source:"iana"},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana",compressible:!0},"application/vnd.wv.ssp+xml":{source:"iana",compressible:!0},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana",compressible:!0},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",compressible:!0,extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",compressible:!0,extensions:["zaz"]},"application/voicexml+xml":{source:"iana",compressible:!0,extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana",compressible:!0,extensions:["wif"]},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",compressible:!0,extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",compressible:!0,extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",compressible:!0,extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",compressible:!0,extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",compressible:!0,extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-iwork-keynote-sffkey":{extensions:["key"]},"application/x-iwork-numbers-sffnumbers":{extensions:["numbers"]},"application/x-iwork-pages-sffpages":{extensions:["pages"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-keepass2":{extensions:["kdbx"]},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-pki-message":{source:"iana"},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"iana",extensions:["der","crt","pem"]},"application/x-x509-ca-ra-cert":{source:"iana"},"application/x-x509-next-ca-cert":{source:"iana"},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",compressible:!0,extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana",compressible:!0},"application/xaml+xml":{source:"apache",compressible:!0,extensions:["xaml"]},"application/xcap-att+xml":{source:"iana",compressible:!0,extensions:["xav"]},"application/xcap-caps+xml":{source:"iana",compressible:!0,extensions:["xca"]},"application/xcap-diff+xml":{source:"iana",compressible:!0,extensions:["xdf"]},"application/xcap-el+xml":{source:"iana",compressible:!0,extensions:["xel"]},"application/xcap-error+xml":{source:"iana",compressible:!0},"application/xcap-ns+xml":{source:"iana",compressible:!0,extensions:["xns"]},"application/xcon-conference-info+xml":{source:"iana",compressible:!0},"application/xcon-conference-info-diff+xml":{source:"iana",compressible:!0},"application/xenc+xml":{source:"iana",compressible:!0,extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache",compressible:!0},"application/xliff+xml":{source:"iana",compressible:!0,extensions:["xlf"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana",compressible:!0},"application/xmpp+xml":{source:"iana",compressible:!0},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",compressible:!0,extensions:["xpl"]},"application/xslt+xml":{source:"iana",compressible:!0,extensions:["xsl","xslt"]},"application/xspf+xml":{source:"apache",compressible:!0,extensions:["xspf"]},"application/xv+xml":{source:"iana",compressible:!0,extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana",compressible:!0},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana",compressible:!0},"application/yin+xml":{source:"iana",compressible:!0,extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"application/zstd":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/aac":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana",extensions:["amr"]},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/flexfec":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/mhas":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana",extensions:["mxmf"]},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx","opus"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/scip":{source:"iana"},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sofa":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tetra_acelp":{source:"iana"},"audio/tetra_acelp_bb":{source:"iana"},"audio/tone":{source:"iana"},"audio/tsvcis":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/usac":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dts.uhd":{source:"iana"},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana",extensions:["exr"]},"image/apng":{compressible:!1,extensions:["apng"]},"image/avci":{source:"iana",extensions:["avci"]},"image/avcs":{source:"iana",extensions:["avcs"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana",extensions:["drle"]},"image/emf":{source:"iana",extensions:["emf"]},"image/fits":{source:"iana",extensions:["fits"]},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/heic":{source:"iana",extensions:["heic"]},"image/heic-sequence":{source:"iana",extensions:["heics"]},"image/heif":{source:"iana",extensions:["heif"]},"image/heif-sequence":{source:"iana",extensions:["heifs"]},"image/hej2k":{source:"iana",extensions:["hej2"]},"image/hsj2":{source:"iana",extensions:["hsj2"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana",extensions:["jls"]},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jph":{source:"iana",extensions:["jph"]},"image/jphc":{source:"iana",extensions:["jhc"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/jxr":{source:"iana",extensions:["jxr"]},"image/jxra":{source:"iana",extensions:["jxra"]},"image/jxrs":{source:"iana",extensions:["jxrs"]},"image/jxs":{source:"iana",extensions:["jxs"]},"image/jxsc":{source:"iana",extensions:["jxsc"]},"image/jxsi":{source:"iana",extensions:["jxsi"]},"image/jxss":{source:"iana",extensions:["jxss"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/ktx2":{source:"iana",extensions:["ktx2"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana",extensions:["pti"]},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana",extensions:["t38"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tif","tiff"]},"image/tiff-fx":{source:"iana",extensions:["tfx"]},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana",extensions:["azv"]},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana",compressible:!0,extensions:["ico"]},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-dds":{compressible:!0,extensions:["dds"]},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.pco.b16":{source:"iana",extensions:["b16"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana",extensions:["tap"]},"image/vnd.valve.source.texture":{source:"iana",extensions:["vtf"]},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana",extensions:["pcx"]},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana",extensions:["wmf"]},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana",extensions:["3mf"]},"model/e57":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/mtl":{source:"iana",extensions:["mtl"]},"model/obj":{source:"iana",extensions:["obj"]},"model/step":{source:"iana"},"model/step+xml":{source:"iana",compressible:!0,extensions:["stpx"]},"model/step+zip":{source:"iana",compressible:!1,extensions:["stpz"]},"model/step-xml+zip":{source:"iana",compressible:!1,extensions:["stpxz"]},"model/stl":{source:"iana",extensions:["stl"]},"model/vnd.collada+xml":{source:"iana",compressible:!0,extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana",compressible:!0},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana",extensions:["ogex"]},"model/vnd.parasolid.transmit.binary":{source:"iana",extensions:["x_b"]},"model/vnd.parasolid.transmit.text":{source:"iana",extensions:["x_t"]},"model/vnd.pytha.pyox":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.sap.vds":{source:"iana",extensions:["vds"]},"model/vnd.usdz+zip":{source:"iana",compressible:!1,extensions:["usdz"]},"model/vnd.valve.source.compiled-map":{source:"iana",extensions:["bsp"]},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana",extensions:["x3db"]},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana",extensions:["x3dv"]},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana"},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/cql":{source:"iana"},"text/cql-expression":{source:"iana"},"text/cql-identifier":{source:"iana"},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fhirpath":{source:"iana"},"text/flexfec":{source:"iana"},"text/fwdred":{source:"iana"},"text/gff3":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{compressible:!0,extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mdx":{compressible:!0,extensions:["mdx"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana",charset:"UTF-8"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana",charset:"UTF-8"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shaclc":{source:"iana"},"text/shex":{source:"iana",extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/spdx":{source:"iana",extensions:["spdx"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",charset:"UTF-8",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana",charset:"UTF-8"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana",charset:"UTF-8"},"text/vnd.familysearch.gedcom":{source:"iana",extensions:["ged"]},"text/vnd.ficlab.flt":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.gml":{source:"iana"},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.hans":{source:"iana"},"text/vnd.hgl":{source:"iana"},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.senx.warpscript":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sosi":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",charset:"UTF-8",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana",charset:"UTF-8"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/av1":{source:"iana"},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/ffv1":{source:"iana"},"video/flexfec":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana",extensions:["m4s"]},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/jxsv":{source:"iana"},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/scip":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vc2":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vnd.youtube.yt":{source:"iana"},"video/vp8":{source:"iana"},"video/vp9":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}}});var Kf=k((qk,Hf)=>{Hf.exports=Gf()});var Jf=k(Ve=>{"use strict";var Vr=Kf(),nw=Y("path").extname,Vf=/^\s*([^;\s]*)(?:;|\s|$)/,iw=/^text\//i;Ve.charset=Wf;Ve.charsets={lookup:Wf};Ve.contentType=rw;Ve.extension=sw;Ve.extensions=Object.create(null);Ve.lookup=aw;Ve.types=Object.create(null);ow(Ve.extensions,Ve.types);function Wf(t){if(!t||typeof t!="string")return!1;var e=Vf.exec(t),n=e&&Vr[e[1].toLowerCase()];return n&&n.charset?n.charset:e&&iw.test(e[1])?"UTF-8":!1}function rw(t){if(!t||typeof t!="string")return!1;var e=t.indexOf("/")===-1?Ve.lookup(t):t;if(!e)return!1;if(e.indexOf("charset")===-1){var n=Ve.charset(e);n&&(e+="; charset="+n.toLowerCase())}return e}function sw(t){if(!t||typeof t!="string")return!1;var e=Vf.exec(t),n=e&&Ve.extensions[e[1].toLowerCase()];return!n||!n.length?!1:n[0]}function aw(t){if(!t||typeof t!="string")return!1;var e=nw("x."+t).toLowerCase().substr(1);return e&&Ve.types[e]||!1}function ow(t,e){var n=["nginx","apache",void 0,"iana"];Object.keys(Vr).forEach(function(r){var s=Vr[r],a=s.extensions;if(!(!a||!a.length)){t[r]=a;for(var o=0;o<a.length;o++){var c=a[o];if(e[c]){var l=n.indexOf(Vr[e[c]].source),u=n.indexOf(s.source);if(e[c]!=="application/octet-stream"&&(l>u||l===u&&e[c].substr(0,12)==="application/"))continue}e[c]=r}}})}});var Yf=k((Bk,Xf)=>{Xf.exports=cw;function cw(t){var e=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;e?e(t):setTimeout(t,0)}});var Ho=k((Dk,Qf)=>{var Zf=Yf();Qf.exports=lw;function lw(t){var e=!1;return Zf(function(){e=!0}),function(i,r){e?t(i,r):Zf(function(){t(i,r)})}}});var Ko=k((Uk,em)=>{em.exports=uw;function uw(t){Object.keys(t.jobs).forEach(pw.bind(t)),t.jobs={}}function pw(t){typeof this.jobs[t]=="function"&&this.jobs[t]()}});var Vo=k((Fk,nm)=>{var tm=Ho(),dw=Ko();nm.exports=fw;function fw(t,e,n,i){var r=n.keyedList?n.keyedList[n.index]:n.index;n.jobs[r]=mw(e,r,t[r],function(s,a){r in n.jobs&&(delete n.jobs[r],s?dw(n):n.results[r]=a,i(s,n.results))})}function mw(t,e,n,i){var r;return t.length==2?r=t(n,tm(i)):r=t(n,e,tm(i)),r}});var Wo=k((zk,im)=>{im.exports=hw;function hw(t,e){var n=!Array.isArray(t),i={index:0,keyedList:n||e?Object.keys(t):null,jobs:{},results:n?{}:[],size:n?Object.keys(t).length:t.length};return e&&i.keyedList.sort(n?e:function(r,s){return e(t[r],t[s])}),i}});var Jo=k((Gk,rm)=>{var gw=Ko(),xw=Ho();rm.exports=vw;function vw(t){Object.keys(this.jobs).length&&(this.index=this.size,gw(this),xw(t)(null,this.results))}});var am=k((Hk,sm)=>{var yw=Vo(),bw=Wo(),ww=Jo();sm.exports=_w;function _w(t,e,n){for(var i=bw(t);i.index<(i.keyedList||t).length;)yw(t,e,i,function(r,s){if(r){n(r,s);return}if(Object.keys(i.jobs).length===0){n(null,i.results);return}}),i.index++;return ww.bind(i,n)}});var Xo=k((Kk,Wr)=>{var om=Vo(),Tw=Wo(),Sw=Jo();Wr.exports=Ew;Wr.exports.ascending=cm;Wr.exports.descending=Iw;function Ew(t,e,n,i){var r=Tw(t,n);return om(t,e,r,function s(a,o){if(a){i(a,o);return}if(r.index++,r.index<(r.keyedList||t).length){om(t,e,r,s);return}i(null,r.results)}),Sw.bind(r,i)}function cm(t,e){return t<e?-1:t>e?1:0}function Iw(t,e){return-1*cm(t,e)}});var um=k((Vk,lm)=>{var Rw=Xo();lm.exports=kw;function kw(t,e,n){return Rw(t,e,null,n)}});var dm=k((Wk,pm)=>{pm.exports={parallel:am(),serial:um(),serialOrdered:Xo()}});var Yo=k((Jk,fm)=>{"use strict";fm.exports=Object});var hm=k((Xk,mm)=>{"use strict";mm.exports=Error});var xm=k((Yk,gm)=>{"use strict";gm.exports=EvalError});var ym=k((Zk,vm)=>{"use strict";vm.exports=RangeError});var wm=k((Qk,bm)=>{"use strict";bm.exports=ReferenceError});var Tm=k((e1,_m)=>{"use strict";_m.exports=SyntaxError});var Jr=k((t1,Sm)=>{"use strict";Sm.exports=TypeError});var Im=k((n1,Em)=>{"use strict";Em.exports=URIError});var km=k((i1,Rm)=>{"use strict";Rm.exports=Math.abs});var Cm=k((r1,Om)=>{"use strict";Om.exports=Math.floor});var Am=k((s1,Nm)=>{"use strict";Nm.exports=Math.max});var Pm=k((a1,Lm)=>{"use strict";Lm.exports=Math.min});var jm=k((o1,Mm)=>{"use strict";Mm.exports=Math.pow});var $m=k((c1,qm)=>{"use strict";qm.exports=Math.round});var Dm=k((l1,Bm)=>{"use strict";Bm.exports=Number.isNaN||function(e){return e!==e}});var Fm=k((u1,Um)=>{"use strict";var Ow=Dm();Um.exports=function(e){return Ow(e)||e===0?e:e<0?-1:1}});var Gm=k((p1,zm)=>{"use strict";zm.exports=Object.getOwnPropertyDescriptor});var Zo=k((d1,Hm)=>{"use strict";var Xr=Gm();if(Xr)try{Xr([],"length")}catch{Xr=null}Hm.exports=Xr});var Vm=k((f1,Km)=>{"use strict";var Yr=Object.defineProperty||!1;if(Yr)try{Yr({},"a",{value:1})}catch{Yr=!1}Km.exports=Yr});var Qo=k((m1,Wm)=>{"use strict";Wm.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),i=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var r=42;e[n]=r;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,n);if(o.value!==r||o.enumerable!==!0)return!1}return!0}});var Ym=k((h1,Xm)=>{"use strict";var Jm=typeof Symbol<"u"&&Symbol,Cw=Qo();Xm.exports=function(){return typeof Jm!="function"||typeof Symbol!="function"||typeof Jm("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Cw()}});var ec=k((g1,Zm)=>{"use strict";Zm.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var tc=k((x1,Qm)=>{"use strict";var Nw=Yo();Qm.exports=Nw.getPrototypeOf||null});var nh=k((v1,th)=>{"use strict";var Aw="Function.prototype.bind called on incompatible ",Lw=Object.prototype.toString,Pw=Math.max,Mw="[object Function]",eh=function(e,n){for(var i=[],r=0;r<e.length;r+=1)i[r]=e[r];for(var s=0;s<n.length;s+=1)i[s+e.length]=n[s];return i},jw=function(e,n){for(var i=[],r=n||0,s=0;r<e.length;r+=1,s+=1)i[s]=e[r];return i},qw=function(t,e){for(var n="",i=0;i<t.length;i+=1)n+=t[i],i+1<t.length&&(n+=e);return n};th.exports=function(e){var n=this;if(typeof n!="function"||Lw.apply(n)!==Mw)throw new TypeError(Aw+n);for(var i=jw(arguments,1),r,s=function(){if(this instanceof r){var u=n.apply(this,eh(i,arguments));return Object(u)===u?u:this}return n.apply(e,eh(i,arguments))},a=Pw(0,n.length-i.length),o=[],c=0;c<a;c++)o[c]="$"+c;if(r=Function("binder","return function ("+qw(o,",")+"){ return binder.apply(this,arguments); }")(s),n.prototype){var l=function(){};l.prototype=n.prototype,r.prototype=new l,l.prototype=null}return r}});var Li=k((y1,ih)=>{"use strict";var $w=nh();ih.exports=Function.prototype.bind||$w});var Zr=k((b1,rh)=>{"use strict";rh.exports=Function.prototype.call});var nc=k((w1,sh)=>{"use strict";sh.exports=Function.prototype.apply});var oh=k((_1,ah)=>{"use strict";ah.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var lh=k((T1,ch)=>{"use strict";var Bw=Li(),Dw=nc(),Uw=Zr(),Fw=oh();ch.exports=Fw||Bw.call(Uw,Dw)});var ph=k((S1,uh)=>{"use strict";var zw=Li(),Gw=Jr(),Hw=Zr(),Kw=lh();uh.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new Gw("a function is required");return Kw(zw,Hw,e)}});var xh=k((E1,gh)=>{"use strict";var Vw=ph(),dh=Zo(),mh;try{mh=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var ic=!!mh&&dh&&dh(Object.prototype,"__proto__"),hh=Object,fh=hh.getPrototypeOf;gh.exports=ic&&typeof ic.get=="function"?Vw([ic.get]):typeof fh=="function"?function(e){return fh(e==null?e:hh(e))}:!1});var _h=k((I1,wh)=>{"use strict";var vh=ec(),yh=tc(),bh=xh();wh.exports=vh?function(e){return vh(e)}:yh?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return yh(e)}:bh?function(e){return bh(e)}:null});var Qr=k((R1,Th)=>{"use strict";var Ww=Function.prototype.call,Jw=Object.prototype.hasOwnProperty,Xw=Li();Th.exports=Xw.call(Ww,Jw)});var Ch=k((k1,Oh)=>{"use strict";var ae,Yw=Yo(),Zw=hm(),Qw=xm(),e_=ym(),t_=wm(),Bn=Tm(),$n=Jr(),n_=Im(),i_=km(),r_=Cm(),s_=Am(),a_=Pm(),o_=jm(),c_=$m(),l_=Fm(),Rh=Function,rc=function(t){try{return Rh('"use strict"; return ('+t+").constructor;")()}catch{}},Pi=Zo(),u_=Vm(),sc=function(){throw new $n},p_=Pi?(function(){try{return arguments.callee,sc}catch{try{return Pi(arguments,"callee").get}catch{return sc}}})():sc,jn=Ym()(),Pe=_h(),d_=tc(),f_=ec(),kh=nc(),Mi=Zr(),qn={},m_=typeof Uint8Array>"u"||!Pe?ae:Pe(Uint8Array),ln={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ae:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ae:ArrayBuffer,"%ArrayIteratorPrototype%":jn&&Pe?Pe([][Symbol.iterator]()):ae,"%AsyncFromSyncIteratorPrototype%":ae,"%AsyncFunction%":qn,"%AsyncGenerator%":qn,"%AsyncGeneratorFunction%":qn,"%AsyncIteratorPrototype%":qn,"%Atomics%":typeof Atomics>"u"?ae:Atomics,"%BigInt%":typeof BigInt>"u"?ae:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ae:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ae:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ae:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Zw,"%eval%":eval,"%EvalError%":Qw,"%Float16Array%":typeof Float16Array>"u"?ae:Float16Array,"%Float32Array%":typeof Float32Array>"u"?ae:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ae:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ae:FinalizationRegistry,"%Function%":Rh,"%GeneratorFunction%":qn,"%Int8Array%":typeof Int8Array>"u"?ae:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ae:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ae:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":jn&&Pe?Pe(Pe([][Symbol.iterator]())):ae,"%JSON%":typeof JSON=="object"?JSON:ae,"%Map%":typeof Map>"u"?ae:Map,"%MapIteratorPrototype%":typeof Map>"u"||!jn||!Pe?ae:Pe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Yw,"%Object.getOwnPropertyDescriptor%":Pi,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ae:Promise,"%Proxy%":typeof Proxy>"u"?ae:Proxy,"%RangeError%":e_,"%ReferenceError%":t_,"%Reflect%":typeof Reflect>"u"?ae:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ae:Set,"%SetIteratorPrototype%":typeof Set>"u"||!jn||!Pe?ae:Pe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ae:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":jn&&Pe?Pe(""[Symbol.iterator]()):ae,"%Symbol%":jn?Symbol:ae,"%SyntaxError%":Bn,"%ThrowTypeError%":p_,"%TypedArray%":m_,"%TypeError%":$n,"%Uint8Array%":typeof Uint8Array>"u"?ae:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ae:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ae:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ae:Uint32Array,"%URIError%":n_,"%WeakMap%":typeof WeakMap>"u"?ae:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ae:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ae:WeakSet,"%Function.prototype.call%":Mi,"%Function.prototype.apply%":kh,"%Object.defineProperty%":u_,"%Object.getPrototypeOf%":d_,"%Math.abs%":i_,"%Math.floor%":r_,"%Math.max%":s_,"%Math.min%":a_,"%Math.pow%":o_,"%Math.round%":c_,"%Math.sign%":l_,"%Reflect.getPrototypeOf%":f_};if(Pe)try{null.error}catch(t){Sh=Pe(Pe(t)),ln["%Error.prototype%"]=Sh}var Sh,h_=function t(e){var n;if(e==="%AsyncFunction%")n=rc("async function () {}");else if(e==="%GeneratorFunction%")n=rc("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=rc("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(n=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var r=t("%AsyncGenerator%");r&&Pe&&(n=Pe(r.prototype))}return ln[e]=n,n},Eh={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ji=Li(),es=Qr(),g_=ji.call(Mi,Array.prototype.concat),x_=ji.call(kh,Array.prototype.splice),Ih=ji.call(Mi,String.prototype.replace),ts=ji.call(Mi,String.prototype.slice),v_=ji.call(Mi,RegExp.prototype.exec),y_=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,b_=/\\(\\)?/g,w_=function(e){var n=ts(e,0,1),i=ts(e,-1);if(n==="%"&&i!=="%")throw new Bn("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&n!=="%")throw new Bn("invalid intrinsic syntax, expected opening `%`");var r=[];return Ih(e,y_,function(s,a,o,c){r[r.length]=o?Ih(c,b_,"$1"):a||s}),r},__=function(e,n){var i=e,r;if(es(Eh,i)&&(r=Eh[i],i="%"+r[0]+"%"),es(ln,i)){var s=ln[i];if(s===qn&&(s=h_(i)),typeof s>"u"&&!n)throw new $n("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:s}}throw new Bn("intrinsic "+e+" does not exist!")};Oh.exports=function(e,n){if(typeof e!="string"||e.length===0)throw new $n("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new $n('"allowMissing" argument must be a boolean');if(v_(/^%?[^%]*%?$/,e)===null)throw new Bn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=w_(e),r=i.length>0?i[0]:"",s=__("%"+r+"%",n),a=s.name,o=s.value,c=!1,l=s.alias;l&&(r=l[0],x_(i,g_([0,1],l)));for(var u=1,f=!0;u<i.length;u+=1){var x=i[u],S=ts(x,0,1),b=ts(x,-1);if((S==='"'||S==="'"||S==="`"||b==='"'||b==="'"||b==="`")&&S!==b)throw new Bn("property names with quotes must have matching quotes");if((x==="constructor"||!f)&&(c=!0),r+="."+x,a="%"+r+"%",es(ln,a))o=ln[a];else if(o!=null){if(!(x in o)){if(!n)throw new $n("base intrinsic for "+e+" exists, but the property is not available.");return}if(Pi&&u+1>=i.length){var w=Pi(o,x);f=!!w,f&&"get"in w&&!("originalValue"in w.get)?o=w.get:o=o[x]}else f=es(o,x),o=o[x];f&&!c&&(ln[a]=o)}}return o}});var Ah=k((O1,Nh)=>{"use strict";var T_=Qo();Nh.exports=function(){return T_()&&!!Symbol.toStringTag}});var Mh=k((C1,Ph)=>{"use strict";var S_=Ch(),Lh=S_("%Object.defineProperty%",!0),E_=Ah()(),I_=Qr(),R_=Jr(),ns=E_?Symbol.toStringTag:null;Ph.exports=function(e,n){var i=arguments.length>2&&!!arguments[2]&&arguments[2].force,r=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof i<"u"&&typeof i!="boolean"||typeof r<"u"&&typeof r!="boolean")throw new R_("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");ns&&(i||!I_(e,ns))&&(Lh?Lh(e,ns,{configurable:!r,enumerable:!1,value:n,writable:!1}):e[ns]=n)}});var qh=k((N1,jh)=>{"use strict";jh.exports=function(t,e){return Object.keys(e).forEach(function(n){t[n]=t[n]||e[n]}),t}});var Bh=k((A1,$h)=>{"use strict";var lc=zf(),k_=Y("util"),ac=Y("path"),O_=Y("http"),C_=Y("https"),N_=Y("url").parse,A_=Y("fs"),L_=Y("stream").Stream,P_=Y("crypto"),oc=Jf(),M_=dm(),j_=Mh(),Gt=Qr(),cc=qh();function oe(t){if(!(this instanceof oe))return new oe(t);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],lc.call(this),t=t||{};for(var e in t)this[e]=t[e]}k_.inherits(oe,lc);oe.LINE_BREAK=`\r
14
- `;oe.DEFAULT_CONTENT_TYPE="application/octet-stream";oe.prototype.append=function(t,e,n){n=n||{},typeof n=="string"&&(n={filename:n});var i=lc.prototype.append.bind(this);if((typeof e=="number"||e==null)&&(e=String(e)),Array.isArray(e)){this._error(new Error("Arrays are not supported."));return}var r=this._multiPartHeader(t,e,n),s=this._multiPartFooter();i(r),i(e),i(s),this._trackLength(r,e,n)};oe.prototype._trackLength=function(t,e,n){var i=0;n.knownLength!=null?i+=Number(n.knownLength):Buffer.isBuffer(e)?i=e.length:typeof e=="string"&&(i=Buffer.byteLength(e)),this._valueLength+=i,this._overheadLength+=Buffer.byteLength(t)+oe.LINE_BREAK.length,!(!e||!e.path&&!(e.readable&&Gt(e,"httpVersion"))&&!(e instanceof L_))&&(n.knownLength||this._valuesToMeasure.push(e))};oe.prototype._lengthRetriever=function(t,e){Gt(t,"fd")?t.end!=null&&t.end!=1/0&&t.start!=null?e(null,t.end+1-(t.start?t.start:0)):A_.stat(t.path,function(n,i){if(n){e(n);return}var r=i.size-(t.start?t.start:0);e(null,r)}):Gt(t,"httpVersion")?e(null,Number(t.headers["content-length"])):Gt(t,"httpModule")?(t.on("response",function(n){t.pause(),e(null,Number(n.headers["content-length"]))}),t.resume()):e("Unknown stream")};oe.prototype._multiPartHeader=function(t,e,n){if(typeof n.header=="string")return n.header;var i=this._getContentDisposition(e,n),r=this._getContentType(e,n),s="",a={"Content-Disposition":["form-data",'name="'+t+'"'].concat(i||[]),"Content-Type":[].concat(r||[])};typeof n.header=="object"&&cc(a,n.header);var o;for(var c in a)if(Gt(a,c)){if(o=a[c],o==null)continue;Array.isArray(o)||(o=[o]),o.length&&(s+=c+": "+o.join("; ")+oe.LINE_BREAK)}return"--"+this.getBoundary()+oe.LINE_BREAK+s+oe.LINE_BREAK};oe.prototype._getContentDisposition=function(t,e){var n;if(typeof e.filepath=="string"?n=ac.normalize(e.filepath).replace(/\\/g,"/"):e.filename||t&&(t.name||t.path)?n=ac.basename(e.filename||t&&(t.name||t.path)):t&&t.readable&&Gt(t,"httpVersion")&&(n=ac.basename(t.client._httpMessage.path||"")),n)return'filename="'+n+'"'};oe.prototype._getContentType=function(t,e){var n=e.contentType;return!n&&t&&t.name&&(n=oc.lookup(t.name)),!n&&t&&t.path&&(n=oc.lookup(t.path)),!n&&t&&t.readable&&Gt(t,"httpVersion")&&(n=t.headers["content-type"]),!n&&(e.filepath||e.filename)&&(n=oc.lookup(e.filepath||e.filename)),!n&&t&&typeof t=="object"&&(n=oe.DEFAULT_CONTENT_TYPE),n};oe.prototype._multiPartFooter=function(){return function(t){var e=oe.LINE_BREAK,n=this._streams.length===0;n&&(e+=this._lastBoundary()),t(e)}.bind(this)};oe.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+oe.LINE_BREAK};oe.prototype.getHeaders=function(t){var e,n={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(e in t)Gt(t,e)&&(n[e.toLowerCase()]=t[e]);return n};oe.prototype.setBoundary=function(t){if(typeof t!="string")throw new TypeError("FormData boundary must be a string");this._boundary=t};oe.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};oe.prototype.getBuffer=function(){for(var t=new Buffer.alloc(0),e=this.getBoundary(),n=0,i=this._streams.length;n<i;n++)typeof this._streams[n]!="function"&&(Buffer.isBuffer(this._streams[n])?t=Buffer.concat([t,this._streams[n]]):t=Buffer.concat([t,Buffer.from(this._streams[n])]),(typeof this._streams[n]!="string"||this._streams[n].substring(2,e.length+2)!==e)&&(t=Buffer.concat([t,Buffer.from(oe.LINE_BREAK)])));return Buffer.concat([t,Buffer.from(this._lastBoundary())])};oe.prototype._generateBoundary=function(){this._boundary="--------------------------"+P_.randomBytes(12).toString("hex")};oe.prototype.getLengthSync=function(){var t=this._overheadLength+this._valueLength;return this._streams.length&&(t+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),t};oe.prototype.hasKnownLength=function(){var t=!0;return this._valuesToMeasure.length&&(t=!1),t};oe.prototype.getLength=function(t){var e=this._overheadLength+this._valueLength;if(this._streams.length&&(e+=this._lastBoundary().length),!this._valuesToMeasure.length){process.nextTick(t.bind(this,null,e));return}M_.parallel(this._valuesToMeasure,this._lengthRetriever,function(n,i){if(n){t(n);return}i.forEach(function(r){e+=r}),t(null,e)})};oe.prototype.submit=function(t,e){var n,i,r={method:"post"};return typeof t=="string"?(t=N_(t),i=cc({port:t.port,path:t.pathname,host:t.hostname,protocol:t.protocol},r)):(i=cc(t,r),i.port||(i.port=i.protocol==="https:"?443:80)),i.headers=this.getHeaders(t.headers),i.protocol==="https:"?n=C_.request(i):n=O_.request(i),this.getLength(function(s,a){if(s&&s!=="Unknown stream"){this._error(s);return}if(a&&n.setHeader("Content-Length",a),this.pipe(n),e){var o,c=function(l,u){return n.removeListener("error",c),n.removeListener("response",o),e.call(this,l,u)};o=c.bind(this,null),n.on("error",c),n.on("response",o)}}.bind(this)),n};oe.prototype._error=function(t){this.error||(this.error=t,this.pause(),this.emit("error",t))};oe.prototype.toString=function(){return"[object FormData]"};j_(oe.prototype,"FormData");$h.exports=oe});var Uh=k((L1,Dh)=>{var qi;Dh.exports=function(){if(!qi){try{qi=Y("debug")("follow-redirects")}catch{}typeof qi!="function"&&(qi=function(){})}qi.apply(null,arguments)}});var Kh=k((P1,wc)=>{var Bi=Y("url"),$i=Bi.URL,q_=Y("http"),$_=Y("https"),mc=Y("stream").Writable,hc=Y("assert"),Fh=Uh();(function(){var e=typeof process<"u",n=typeof window<"u"&&typeof document<"u",i=pn(Error.captureStackTrace);!e&&(n||!i)&&console.warn("The follow-redirects package should be excluded from browser builds.")})();var gc=!1;try{hc(new $i(""))}catch(t){gc=t.code==="ERR_INVALID_URL"}var B_=["Authorization","Proxy-Authorization","Cookie"],D_=["auth","host","hostname","href","path","pathname","port","protocol","query","search","hash"],xc=["abort","aborted","connect","error","socket","timeout"],vc=Object.create(null);xc.forEach(function(t){vc[t]=function(e,n,i){this._redirectable.emit(t,e,n,i)}});var pc=Di("ERR_INVALID_URL","Invalid URL",TypeError),dc=Di("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),U_=Di("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",dc),F_=Di("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),z_=Di("ERR_STREAM_WRITE_AFTER_END","write after end"),G_=mc.prototype.destroy||Gh;function We(t,e){mc.call(this),this._sanitizeOptions(t),this._options=t,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],e&&this.on("response",e);var n=this;this._onNativeResponse=function(i){try{n._processResponse(i)}catch(r){n.emit("error",r instanceof dc?r:new dc({cause:r}))}},this._headerFilter=new RegExp("^(?:"+B_.concat(t.sensitiveHeaders).map(X_).join("|")+")$","i"),this._performRequest()}We.prototype=Object.create(mc.prototype);We.prototype.abort=function(){bc(this._currentRequest),this._currentRequest.abort(),this.emit("abort")};We.prototype.destroy=function(t){return bc(this._currentRequest,t),G_.call(this,t),this};We.prototype.write=function(t,e,n){if(this._ending)throw new z_;if(!un(t)&&!W_(t))throw new TypeError("data should be a string, Buffer or Uint8Array");if(pn(e)&&(n=e,e=null),t.length===0){n&&n();return}this._requestBodyLength+t.length<=this._options.maxBodyLength?(this._requestBodyLength+=t.length,this._requestBodyBuffers.push({data:t,encoding:e}),this._currentRequest.write(t,e,n)):(this.emit("error",new F_),this.abort())};We.prototype.end=function(t,e,n){if(pn(t)?(n=t,t=e=null):pn(e)&&(n=e,e=null),!t)this._ended=this._ending=!0,this._currentRequest.end(null,null,n);else{var i=this,r=this._currentRequest;this.write(t,e,function(){i._ended=!0,r.end(null,null,n)}),this._ending=!0}};We.prototype.setHeader=function(t,e){this._options.headers[t]=e,this._currentRequest.setHeader(t,e)};We.prototype.removeHeader=function(t){delete this._options.headers[t],this._currentRequest.removeHeader(t)};We.prototype.setTimeout=function(t,e){var n=this;function i(a){a.setTimeout(t),a.removeListener("timeout",a.destroy),a.addListener("timeout",a.destroy)}function r(a){n._timeout&&clearTimeout(n._timeout),n._timeout=setTimeout(function(){n.emit("timeout"),s()},t),i(a)}function s(){n._timeout&&(clearTimeout(n._timeout),n._timeout=null),n.removeListener("abort",s),n.removeListener("error",s),n.removeListener("response",s),n.removeListener("close",s),e&&n.removeListener("timeout",e),n.socket||n._currentRequest.removeListener("socket",r)}return e&&this.on("timeout",e),this.socket?r(this.socket):this._currentRequest.once("socket",r),this.on("socket",i),this.on("abort",s),this.on("error",s),this.on("response",s),this.on("close",s),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){We.prototype[t]=function(e,n){return this._currentRequest[t](e,n)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(We.prototype,t,{get:function(){return this._currentRequest[t]}})});We.prototype._sanitizeOptions=function(t){if(t.headers||(t.headers={}),V_(t.sensitiveHeaders)||(t.sensitiveHeaders=[]),t.host&&(t.hostname||(t.hostname=t.host),delete t.host),!t.pathname&&t.path){var e=t.path.indexOf("?");e<0?t.pathname=t.path:(t.pathname=t.path.substring(0,e),t.search=t.path.substring(e))}};We.prototype._performRequest=function(){var t=this._options.protocol,e=this._options.nativeProtocols[t];if(!e)throw new TypeError("Unsupported protocol "+t);if(this._options.agents){var n=t.slice(0,-1);this._options.agent=this._options.agents[n]}var i=this._currentRequest=e.request(this._options,this._onNativeResponse);i._redirectable=this;for(var r of xc)i.on(r,vc[r]);if(this._currentUrl=/^\//.test(this._options.path)?Bi.format(this._options):this._options.path,this._isRedirect){var s=0,a=this,o=this._requestBodyBuffers;(function c(l){if(i===a._currentRequest)if(l)a.emit("error",l);else if(s<o.length){var u=o[s++];i.finished||i.write(u.data,u.encoding,c)}else a._ended&&i.end()})()}};We.prototype._processResponse=function(t){var e=t.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:t.headers,statusCode:e});var n=t.headers.location;if(!n||this._options.followRedirects===!1||e<300||e>=400){t.responseUrl=this._currentUrl,t.redirects=this._redirects,this.emit("response",t),this._requestBodyBuffers=[];return}if(bc(this._currentRequest),t.destroy(),++this._redirectCount>this._options.maxRedirects)throw new U_;var i,r=this._options.beforeRedirect;r&&(i=Object.assign({Host:t.req.getHeader("host")},this._options.headers));var s=this._options.method;((e===301||e===302)&&this._options.method==="POST"||e===303&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],uc(/^content-/i,this._options.headers));var a=uc(/^host$/i,this._options.headers),o=yc(this._currentUrl),c=a||o.host,l=/^\w+:/.test(n)?this._currentUrl:Bi.format(Object.assign(o,{host:c})),u=H_(n,l);if(Fh("redirecting to",u.href),this._isRedirect=!0,fc(u,this._options),(u.protocol!==o.protocol&&u.protocol!=="https:"||u.host!==c&&!K_(u.host,c))&&uc(this._headerFilter,this._options.headers),pn(r)){var f={headers:t.headers,statusCode:e},x={url:l,method:s,headers:i};r(this._options,f,x),this._sanitizeOptions(this._options)}this._performRequest()};function zh(t){var e={maxRedirects:21,maxBodyLength:10485760},n={};return Object.keys(t).forEach(function(i){var r=i+":",s=n[r]=t[i],a=e[i]=Object.create(s);function o(l,u,f){return J_(l)?l=fc(l):un(l)?l=fc(yc(l)):(f=u,u=Hh(l),l={protocol:r}),pn(u)&&(f=u,u=null),u=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},l,u),u.nativeProtocols=n,!un(u.host)&&!un(u.hostname)&&(u.hostname="::1"),hc.equal(u.protocol,r,"protocol mismatch"),Fh("options",u),new We(u,f)}function c(l,u,f){var x=a.request(l,u,f);return x.end(),x}Object.defineProperties(a,{request:{value:o,configurable:!0,enumerable:!0,writable:!0},get:{value:c,configurable:!0,enumerable:!0,writable:!0}})}),e}function Gh(){}function yc(t){var e;if(gc)e=new $i(t);else if(e=Hh(Bi.parse(t)),!un(e.protocol))throw new pc({input:t});return e}function H_(t,e){return gc?new $i(t,e):yc(Bi.resolve(e,t))}function Hh(t){if(/^\[/.test(t.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(t.hostname))throw new pc({input:t.href||t});if(/^\[/.test(t.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(t.host))throw new pc({input:t.href||t});return t}function fc(t,e){var n=e||{};for(var i of D_)n[i]=t[i];return n.hostname.startsWith("[")&&(n.hostname=n.hostname.slice(1,-1)),n.port!==""&&(n.port=Number(n.port)),n.path=n.search?n.pathname+n.search:n.pathname,n}function uc(t,e){var n;for(var i in e)t.test(i)&&(n=e[i],delete e[i]);return n===null||typeof n>"u"?void 0:String(n).trim()}function Di(t,e,n){function i(r){pn(Error.captureStackTrace)&&Error.captureStackTrace(this,this.constructor),Object.assign(this,r||{}),this.code=t,this.message=this.cause?e+": "+this.cause.message:e}return i.prototype=new(n||Error),Object.defineProperties(i.prototype,{constructor:{value:i,enumerable:!1},name:{value:"Error ["+t+"]",enumerable:!1}}),i}function bc(t,e){for(var n of xc)t.removeListener(n,vc[n]);t.on("error",Gh),t.destroy(e)}function K_(t,e){hc(un(t)&&un(e));var n=t.length-e.length-1;return n>0&&t[n]==="."&&t.endsWith(e)}function V_(t){return t instanceof Array}function un(t){return typeof t=="string"||t instanceof String}function pn(t){return typeof t=="function"}function W_(t){return typeof t=="object"&&"length"in t}function J_(t){return $i&&t instanceof $i}function X_(t){return t.replace(/[\]\\/()*+?.$]/g,"\\$&")}wc.exports=zh({http:q_,https:$_});wc.exports.wrap=zh});var Ug=k((M1,Dg)=>{"use strict";var gg=Bh(),Y_=Y("crypto"),Z_=Y("url"),Q_=Y("http"),e0=Y("https"),xg=Y("http2"),qc=Y("util"),t0=Kh(),Ht=Y("zlib"),Je=Y("stream"),n0=Y("events");function vg(t,e){return function(){return t.apply(e,arguments)}}var{toString:i0}=Object.prototype,{getPrototypeOf:ds}=Object,{iterator:fs,toStringTag:yg}=Symbol,ms=(t=>e=>{let n=i0.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),dt=t=>(t=t.toLowerCase(),e=>ms(e)===t),hs=t=>e=>typeof e===t,{isArray:Gn}=Array,Fn=hs("undefined");function zi(t){return t!==null&&!Fn(t)&&t.constructor!==null&&!Fn(t.constructor)&&Xe(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var bg=dt("ArrayBuffer");function r0(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&bg(t.buffer),e}var s0=hs("string"),Xe=hs("function"),wg=hs("number"),Gi=t=>t!==null&&typeof t=="object",a0=t=>t===!0||t===!1,rs=t=>{if(ms(t)!=="object")return!1;let e=ds(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(yg in t)&&!(fs in t)},o0=t=>{if(!Gi(t)||zi(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},c0=dt("Date"),l0=dt("File"),u0=t=>!!(t&&typeof t.uri<"u"),p0=t=>t&&typeof t.getParts<"u",d0=dt("Blob"),f0=dt("FileList"),m0=t=>Gi(t)&&Xe(t.pipe);function h0(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}var Vh=h0(),Wh=typeof Vh.FormData<"u"?Vh.FormData:void 0,g0=t=>{if(!t)return!1;if(Wh&&t instanceof Wh)return!0;let e=ds(t);if(!e||e===Object.prototype||!Xe(t.append))return!1;let n=ms(t);return n==="formdata"||n==="object"&&Xe(t.toString)&&t.toString()==="[object FormData]"},x0=dt("URLSearchParams"),[v0,y0,b0,w0]=["ReadableStream","Request","Response","Headers"].map(dt),_0=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Hi(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let i,r;if(typeof t!="object"&&(t=[t]),Gn(t))for(i=0,r=t.length;i<r;i++)e.call(null,t[i],i,t);else{if(zi(t))return;let s=n?Object.getOwnPropertyNames(t):Object.keys(t),a=s.length,o;for(i=0;i<a;i++)o=s[i],e.call(null,t[o],o,t)}}function _g(t,e){if(zi(t))return null;e=e.toLowerCase();let n=Object.keys(t),i=n.length,r;for(;i-- >0;)if(r=n[i],e===r.toLowerCase())return r;return null}var dn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Tg=t=>!Fn(t)&&t!==dn;function kc(){let{caseless:t,skipUndefined:e}=Tg(this)&&this||{},n={},i=(r,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;let a=t&&_g(n,s)||s;rs(n[a])&&rs(r)?n[a]=kc(n[a],r):rs(r)?n[a]=kc({},r):Gn(r)?n[a]=r.slice():(!e||!Fn(r))&&(n[a]=r)};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&Hi(arguments[r],i);return n}var T0=(t,e,n,{allOwnKeys:i}={})=>(Hi(e,(r,s)=>{n&&Xe(r)?Object.defineProperty(t,s,{value:vg(r,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,s,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:i}),t),S0=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),E0=(t,e,n,i)=>{t.prototype=Object.create(e.prototype,i),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},I0=(t,e,n,i)=>{let r,s,a,o={};if(e=e||{},t==null)return e;do{for(r=Object.getOwnPropertyNames(t),s=r.length;s-- >0;)a=r[s],(!i||i(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=n!==!1&&ds(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},R0=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;let i=t.indexOf(e,n);return i!==-1&&i===n},k0=t=>{if(!t)return null;if(Gn(t))return t;let e=t.length;if(!wg(e))return null;let n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},O0=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&ds(Uint8Array)),C0=(t,e)=>{let i=(t&&t[fs]).call(t),r;for(;(r=i.next())&&!r.done;){let s=r.value;e.call(t,s[0],s[1])}},N0=(t,e)=>{let n,i=[];for(;(n=t.exec(e))!==null;)i.push(n);return i},A0=dt("HTMLFormElement"),L0=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,r){return i.toUpperCase()+r}),Jh=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),P0=dt("RegExp"),Sg=(t,e)=>{let n=Object.getOwnPropertyDescriptors(t),i={};Hi(n,(r,s)=>{let a;(a=e(r,s,t))!==!1&&(i[s]=a||r)}),Object.defineProperties(t,i)},M0=t=>{Sg(t,(e,n)=>{if(Xe(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;let i=t[n];if(Xe(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},j0=(t,e)=>{let n={},i=r=>{r.forEach(s=>{n[s]=!0})};return Gn(t)?i(t):i(String(t).split(e)),n},q0=()=>{},$0=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function B0(t){return!!(t&&Xe(t.append)&&t[yg]==="FormData"&&t[fs])}var D0=t=>{let e=new Array(10),n=(i,r)=>{if(Gi(i)){if(e.indexOf(i)>=0)return;if(zi(i))return i;if(!("toJSON"in i)){e[r]=i;let s=Gn(i)?[]:{};return Hi(i,(a,o)=>{let c=n(a,r+1);!Fn(c)&&(s[o]=c)}),e[r]=void 0,s}}return i};return n(t,0)},U0=dt("AsyncFunction"),F0=t=>t&&(Gi(t)||Xe(t))&&Xe(t.then)&&Xe(t.catch),Eg=((t,e)=>t?setImmediate:e?((n,i)=>(dn.addEventListener("message",({source:r,data:s})=>{r===dn&&s===n&&i.length&&i.shift()()},!1),r=>{i.push(r),dn.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Xe(dn.postMessage)),z0=typeof queueMicrotask<"u"?queueMicrotask.bind(dn):typeof process<"u"&&process.nextTick||Eg,G0=t=>t!=null&&Xe(t[fs]),v={isArray:Gn,isArrayBuffer:bg,isBuffer:zi,isFormData:g0,isArrayBufferView:r0,isString:s0,isNumber:wg,isBoolean:a0,isObject:Gi,isPlainObject:rs,isEmptyObject:o0,isReadableStream:v0,isRequest:y0,isResponse:b0,isHeaders:w0,isUndefined:Fn,isDate:c0,isFile:l0,isReactNativeBlob:u0,isReactNative:p0,isBlob:d0,isRegExp:P0,isFunction:Xe,isStream:m0,isURLSearchParams:x0,isTypedArray:O0,isFileList:f0,forEach:Hi,merge:kc,extend:T0,trim:_0,stripBOM:S0,inherits:E0,toFlatObject:I0,kindOf:ms,kindOfTest:dt,endsWith:R0,toArray:k0,forEachEntry:C0,matchAll:N0,isHTMLForm:A0,hasOwnProperty:Jh,hasOwnProp:Jh,reduceDescriptors:Sg,freezeMethods:M0,toObjectSet:j0,toCamelCase:L0,noop:q0,toFiniteNumber:$0,findKey:_g,global:dn,isContextDefined:Tg,isSpecCompliantForm:B0,toJSONObject:D0,isAsyncFn:U0,isThenable:F0,setImmediate:Eg,asap:z0,isIterable:G0},$=class t extends Error{static from(e,n,i,r,s,a){let o=new t(e.message,n||e.code,i,r,s);return o.cause=e,o.name=e.name,e.status!=null&&o.status==null&&(o.status=e.status),a&&Object.assign(o,a),o}constructor(e,n,i,r,s){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),i&&(this.config=i),r&&(this.request=r),s&&(this.response=s,this.status=s.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:v.toJSONObject(this.config),code:this.code,status:this.status}}};$.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";$.ERR_BAD_OPTION="ERR_BAD_OPTION";$.ECONNABORTED="ECONNABORTED";$.ETIMEDOUT="ETIMEDOUT";$.ERR_NETWORK="ERR_NETWORK";$.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";$.ERR_DEPRECATED="ERR_DEPRECATED";$.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";$.ERR_BAD_REQUEST="ERR_BAD_REQUEST";$.ERR_CANCELED="ERR_CANCELED";$.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";$.ERR_INVALID_URL="ERR_INVALID_URL";$.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";function Oc(t){return v.isPlainObject(t)||v.isArray(t)}function Ig(t){return v.endsWith(t,"[]")?t.slice(0,-2):t}function _c(t,e,n){return t?t.concat(e).map(function(r,s){return r=Ig(r),!n&&s?"["+r+"]":r}).join(n?".":""):e}function H0(t){return v.isArray(t)&&!t.some(Oc)}var K0=v.toFlatObject(v,{},null,function(e){return/^is[A-Z]/.test(e)});function gs(t,e,n){if(!v.isObject(t))throw new TypeError("target must be an object");e=e||new(gg||FormData),n=v.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,C){return!v.isUndefined(C[g])});let i=n.metaTokens,r=n.visitor||f,s=n.dots,a=n.indexes,o=n.Blob||typeof Blob<"u"&&Blob,c=n.maxDepth===void 0?100:n.maxDepth,l=o&&v.isSpecCompliantForm(e);if(!v.isFunction(r))throw new TypeError("visitor must be a function");function u(w){if(w===null)return"";if(v.isDate(w))return w.toISOString();if(v.isBoolean(w))return w.toString();if(!l&&v.isBlob(w))throw new $("Blob is not supported. Use a Buffer instead.");return v.isArrayBuffer(w)||v.isTypedArray(w)?l&&typeof Blob=="function"?new Blob([w]):Buffer.from(w):w}function f(w,g,C){let z=w;if(v.isReactNative(e)&&v.isReactNativeBlob(w))return e.append(_c(C,g,s),u(w)),!1;if(w&&!C&&typeof w=="object"){if(v.endsWith(g,"{}"))g=i?g:g.slice(0,-2),w=JSON.stringify(w);else if(v.isArray(w)&&H0(w)||(v.isFileList(w)||v.endsWith(g,"[]"))&&(z=v.toArray(w)))return g=Ig(g),z.forEach(function(N,I){!(v.isUndefined(N)||N===null)&&e.append(a===!0?_c([g],I,s):a===null?g:g+"[]",u(N))}),!1}return Oc(w)?!0:(e.append(_c(C,g,s),u(w)),!1)}let x=[],S=Object.assign(K0,{defaultVisitor:f,convertValue:u,isVisitable:Oc});function b(w,g,C=0){if(!v.isUndefined(w)){if(C>c)throw new $("Object is too deeply nested ("+C+" levels). Max depth: "+c,$.ERR_FORM_DATA_DEPTH_EXCEEDED);if(x.indexOf(w)!==-1)throw Error("Circular reference detected in "+g.join("."));x.push(w),v.forEach(w,function(q,N){(!(v.isUndefined(q)||q===null)&&r.call(e,q,v.isString(N)?N.trim():N,g,S))===!0&&b(q,g?g.concat(N):[N],C+1)}),x.pop()}}if(!v.isObject(t))throw new TypeError("data must be an object");return b(t),e}function Xh(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(t).replace(/[!'()~]|%20/g,function(i){return e[i]})}function Rg(t,e){this._pairs=[],t&&gs(t,this,e)}var kg=Rg.prototype;kg.append=function(e,n){this._pairs.push([e,n])};kg.toString=function(e){let n=e?function(i){return e.call(this,i,Xh)}:Xh;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function V0(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function $c(t,e,n){if(!e)return t;let i=n&&n.encode||V0,r=v.isFunction(n)?{serialize:n}:n,s=r&&r.serialize,a;if(s?a=s(e,r):a=v.isURLSearchParams(e)?e.toString():new Rg(e,r).toString(i),a){let o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+a}return t}var os=class{constructor(){this.handlers=[]}use(e,n,i){return this.handlers.push({fulfilled:e,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){v.forEach(this.handlers,function(i){i!==null&&e(i)})}},xs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},W0=Z_.URLSearchParams,Tc="abcdefghijklmnopqrstuvwxyz",Yh="0123456789",Og={DIGIT:Yh,ALPHA:Tc,ALPHA_DIGIT:Tc+Tc.toUpperCase()+Yh},J0=(t=16,e=Og.ALPHA_DIGIT)=>{let n="",{length:i}=e,r=new Uint32Array(t);Y_.randomFillSync(r);for(let s=0;s<t;s++)n+=e[r[s]%i];return n},X0={isNode:!0,classes:{URLSearchParams:W0,FormData:gg,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:Og,generateString:J0,protocols:["http","https","file","data"]},Bc=typeof window<"u"&&typeof document<"u",Cc=typeof navigator=="object"&&navigator||void 0,Y0=Bc&&(!Cc||["ReactNative","NativeScript","NS"].indexOf(Cc.product)<0),Z0=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Q0=Bc&&window.location.href||"http://localhost",eT=Object.freeze({__proto__:null,hasBrowserEnv:Bc,hasStandardBrowserEnv:Y0,hasStandardBrowserWebWorkerEnv:Z0,navigator:Cc,origin:Q0}),Se={...eT,...X0};function tT(t,e){return gs(t,new Se.classes.URLSearchParams,{visitor:function(n,i,r,s){return Se.isNode&&v.isBuffer(n)?(this.append(i,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...e})}function nT(t){return v.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function iT(t){let e={},n=Object.keys(t),i,r=n.length,s;for(i=0;i<r;i++)s=n[i],e[s]=t[s];return e}function Cg(t){function e(n,i,r,s){let a=n[s++];if(a==="__proto__")return!0;let o=Number.isFinite(+a),c=s>=n.length;return a=!a&&v.isArray(r)?r.length:a,c?(v.hasOwnProp(r,a)?r[a]=v.isArray(r[a])?r[a].concat(i):[r[a],i]:r[a]=i,!o):((!r[a]||!v.isObject(r[a]))&&(r[a]=[]),e(n,i,r[a],s)&&v.isArray(r[a])&&(r[a]=iT(r[a])),!o)}if(v.isFormData(t)&&v.isFunction(t.entries)){let n={};return v.forEachEntry(t,(i,r)=>{e(nT(i),r,n,0)}),n}return null}var Dn=(t,e)=>t!=null&&v.hasOwnProp(t,e)?t[e]:void 0;function rT(t,e,n){if(v.isString(t))try{return(e||JSON.parse)(t),v.trim(t)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(t)}var Ki={transitional:xs,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){let i=n.getContentType()||"",r=i.indexOf("application/json")>-1,s=v.isObject(e);if(s&&v.isHTMLForm(e)&&(e=new FormData(e)),v.isFormData(e))return r?JSON.stringify(Cg(e)):e;if(v.isArrayBuffer(e)||v.isBuffer(e)||v.isStream(e)||v.isFile(e)||v.isBlob(e)||v.isReadableStream(e))return e;if(v.isArrayBufferView(e))return e.buffer;if(v.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){let c=Dn(this,"formSerializer");if(i.indexOf("application/x-www-form-urlencoded")>-1)return tT(e,c).toString();if((o=v.isFileList(e))||i.indexOf("multipart/form-data")>-1){let l=Dn(this,"env"),u=l&&l.FormData;return gs(o?{"files[]":e}:e,u&&new u,c)}}return s||r?(n.setContentType("application/json",!1),rT(e)):e}],transformResponse:[function(e){let n=Dn(this,"transitional")||Ki.transitional,i=n&&n.forcedJSONParsing,r=Dn(this,"responseType"),s=r==="json";if(v.isResponse(e)||v.isReadableStream(e))return e;if(e&&v.isString(e)&&(i&&!r||s)){let o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,Dn(this,"parseReviver"))}catch(c){if(o)throw c.name==="SyntaxError"?$.from(c,$.ERR_BAD_RESPONSE,this,null,Dn(this,"response")):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Se.classes.FormData,Blob:Se.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};v.forEach(["delete","get","head","post","put","patch"],t=>{Ki.headers[t]={}});var sT=v.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),aT=t=>{let e={},n,i,r;return t&&t.split(`
15
- `).forEach(function(a){r=a.indexOf(":"),n=a.substring(0,r).trim().toLowerCase(),i=a.substring(r+1).trim(),!(!n||e[n]&&sT[n])&&(n==="set-cookie"?e[n]?e[n].push(i):e[n]=[i]:e[n]=e[n]?e[n]+", "+i:i)}),e},Zh=Symbol("internals"),oT=/[^\x09\x20-\x7E\x80-\xFF]/g;function cT(t){let e=0,n=t.length;for(;e<n;){let i=t.charCodeAt(e);if(i!==9&&i!==32)break;e+=1}for(;n>e;){let i=t.charCodeAt(n-1);if(i!==9&&i!==32)break;n-=1}return e===0&&n===t.length?t:t.slice(e,n)}function Ui(t){return t&&String(t).trim().toLowerCase()}function lT(t){return cT(t.replace(oT,""))}function ss(t){return t===!1||t==null?t:v.isArray(t)?t.map(ss):lT(String(t))}function uT(t){let e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=n.exec(t);)e[i[1]]=i[2];return e}var pT=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Sc(t,e,n,i,r){if(v.isFunction(i))return i.call(this,e,n);if(r&&(e=n),!!v.isString(e)){if(v.isString(i))return e.indexOf(i)!==-1;if(v.isRegExp(i))return i.test(e)}}function dT(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,i)=>n.toUpperCase()+i)}function fT(t,e){let n=v.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(t,i+n,{value:function(r,s,a){return this[i].call(this,e,r,s,a)},configurable:!0})})}var Oe=class{constructor(e){e&&this.set(e)}set(e,n,i){let r=this;function s(o,c,l){let u=Ui(c);if(!u)throw new Error("header name must be a non-empty string");let f=v.findKey(r,u);(!f||r[f]===void 0||l===!0||l===void 0&&r[f]!==!1)&&(r[f||c]=ss(o))}let a=(o,c)=>v.forEach(o,(l,u)=>s(l,u,c));if(v.isPlainObject(e)||e instanceof this.constructor)a(e,n);else if(v.isString(e)&&(e=e.trim())&&!pT(e))a(aT(e),n);else if(v.isObject(e)&&v.isIterable(e)){let o={},c,l;for(let u of e){if(!v.isArray(u))throw TypeError("Object iterator must return a key-value pair");o[l=u[0]]=(c=o[l])?v.isArray(c)?[...c,u[1]]:[c,u[1]]:u[1]}a(o,n)}else e!=null&&s(n,e,i);return this}get(e,n){if(e=Ui(e),e){let i=v.findKey(this,e);if(i){let r=this[i];if(!n)return r;if(n===!0)return uT(r);if(v.isFunction(n))return n.call(this,r,i);if(v.isRegExp(n))return n.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Ui(e),e){let i=v.findKey(this,e);return!!(i&&this[i]!==void 0&&(!n||Sc(this,this[i],i,n)))}return!1}delete(e,n){let i=this,r=!1;function s(a){if(a=Ui(a),a){let o=v.findKey(i,a);o&&(!n||Sc(i,i[o],o,n))&&(delete i[o],r=!0)}}return v.isArray(e)?e.forEach(s):s(e),r}clear(e){let n=Object.keys(this),i=n.length,r=!1;for(;i--;){let s=n[i];(!e||Sc(this,this[s],s,e,!0))&&(delete this[s],r=!0)}return r}normalize(e){let n=this,i={};return v.forEach(this,(r,s)=>{let a=v.findKey(i,s);if(a){n[a]=ss(r),delete n[s];return}let o=e?dT(s):String(s).trim();o!==s&&delete n[s],n[o]=ss(r),i[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let n=Object.create(null);return v.forEach(this,(i,r)=>{i!=null&&i!==!1&&(n[r]=e&&v.isArray(i)?i.join(", "):i)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
16
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){let i=new this(e);return n.forEach(r=>i.set(r)),i}static accessor(e){let i=(this[Zh]=this[Zh]={accessors:{}}).accessors,r=this.prototype;function s(a){let o=Ui(a);i[o]||(fT(r,a),i[o]=!0)}return v.isArray(e)?e.forEach(s):s(e),this}};Oe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);v.reduceDescriptors(Oe.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(i){this[n]=i}}});v.freezeMethods(Oe);function Ec(t,e){let n=this||Ki,i=e||n,r=Oe.from(i.headers),s=i.data;return v.forEach(t,function(o){s=o.call(n,s,r.normalize(),e?e.status:void 0)}),r.normalize(),s}function Ng(t){return!!(t&&t.__CANCEL__)}var At=class extends ${constructor(e,n,i){super(e??"canceled",$.ERR_CANCELED,n,i),this.name="CanceledError",this.__CANCEL__=!0}};function Un(t,e,n){let i=n.config.validateStatus;!n.status||!i||i(n.status)?t(n):e(new $("Request failed with status code "+n.status,[$.ERR_BAD_REQUEST,$.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function mT(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function hT(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Dc(t,e,n){let i=!mT(e);return t&&(i||n===!1)?hT(t,e):e}var gT={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function xT(t){try{return new URL(t)}catch{return null}}function vT(t){var e=(typeof t=="string"?xT(t):t)||{},n=e.protocol,i=e.host,r=e.port;if(typeof i!="string"||!i||typeof n!="string"||(n=n.split(":",1)[0],i=i.replace(/:\d*$/,""),r=parseInt(r)||gT[n]||0,!yT(i,r)))return"";var s=Nc(n+"_proxy")||Nc("all_proxy");return s&&s.indexOf("://")===-1&&(s=n+"://"+s),s}function yT(t,e){var n=Nc("no_proxy").toLowerCase();return n?n==="*"?!1:n.split(/[,\s]/).every(function(i){if(!i)return!0;var r=i.match(/^(.+):(\d+)$/),s=r?r[1]:i,a=r?parseInt(r[2]):0;return a&&a!==e?!0:/^[.*]/.test(s)?(s.charAt(0)==="*"&&(s=s.slice(1)),!t.endsWith(s)):t!==s}):!0}function Nc(t){return process.env[t.toLowerCase()]||process.env[t.toUpperCase()]||""}var cs="1.15.1";function Ag(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}var bT=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function wT(t,e,n){let i=n&&n.Blob||Se.classes.Blob,r=Ag(t);if(e===void 0&&i&&(e=!0),r==="data"){t=r.length?t.slice(r.length+1):t;let s=bT.exec(t);if(!s)throw new $("Invalid URL",$.ERR_INVALID_URL);let a=s[1],o=s[2],c=s[3],l=Buffer.from(decodeURIComponent(c),o?"base64":"utf8");if(e){if(!i)throw new $("Blob is not supported",$.ERR_NOT_SUPPORT);return new i([l],{type:a})}return l}throw new $("Unsupported protocol "+r,$.ERR_NOT_SUPPORT)}var Ic=Symbol("internals"),ls=class extends Je.Transform{constructor(e){e=v.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,r)=>!v.isUndefined(r[i])),super({readableHighWaterMark:e.chunkSize});let n=this[Ic]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",i=>{i==="progress"&&(n.isCaptured||(n.isCaptured=!0))})}_read(e){let n=this[Ic];return n.onReadCallback&&n.onReadCallback(),super._read(e)}_transform(e,n,i){let r=this[Ic],s=r.maxRate,a=this.readableHighWaterMark,o=r.timeWindow,c=1e3/o,l=s/c,u=r.minChunkSize!==!1?Math.max(r.minChunkSize,l*.01):0,f=(S,b)=>{let w=Buffer.byteLength(S);r.bytesSeen+=w,r.bytes+=w,r.isCaptured&&this.emit("progress",r.bytesSeen),this.push(S)?process.nextTick(b):r.onReadCallback=()=>{r.onReadCallback=null,process.nextTick(b)}},x=(S,b)=>{let w=Buffer.byteLength(S),g=null,C=a,z,q=0;if(s){let N=Date.now();(!r.ts||(q=N-r.ts)>=o)&&(r.ts=N,z=l-r.bytes,r.bytes=z<0?-z:0,q=0),z=l-r.bytes}if(s){if(z<=0)return setTimeout(()=>{b(null,S)},o-q);z<C&&(C=z)}C&&w>C&&w-C>u&&(g=S.subarray(C),S=S.subarray(0,C)),f(S,g?()=>{process.nextTick(b,null,g)}:b)};x(e,function S(b,w){if(b)return i(b);w?x(w,S):i(null)})}},{asyncIterator:Qh}=Symbol,Lg=async function*(t){t.stream?yield*t.stream():t.arrayBuffer?yield await t.arrayBuffer():t[Qh]?yield*t[Qh]():yield t},_T=Se.ALPHABET.ALPHA_DIGIT+"-_",Fi=typeof TextEncoder=="function"?new TextEncoder:new qc.TextEncoder,fn=`\r
17
- `,TT=Fi.encode(fn),ST=2,Ac=class{constructor(e,n){let{escapeName:i}=this.constructor,r=v.isString(n),s=`Content-Disposition: form-data; name="${i(e)}"${!r&&n.name?`; filename="${i(n.name)}"`:""}${fn}`;if(r)n=Fi.encode(String(n).replace(/\r?\n|\r\n?/g,fn));else{let a=String(n.type||"application/octet-stream").replace(/[\r\n]/g,"");s+=`Content-Type: ${a}${fn}`}this.headers=Fi.encode(s+fn),this.contentLength=r?n.byteLength:n.size,this.size=this.headers.byteLength+this.contentLength+ST,this.name=e,this.value=n}async*encode(){yield this.headers;let{value:e}=this;v.isTypedArray(e)?yield e:yield*Lg(e),yield TT}static escapeName(e){return String(e).replace(/[\r\n"]/g,n=>({"\r":"%0D","\n":"%0A",'"':"%22"})[n])}},ET=(t,e,n)=>{let{tag:i="form-data-boundary",size:r=25,boundary:s=i+"-"+Se.generateString(r,_T)}=n||{};if(!v.isFormData(t))throw TypeError("FormData instance required");if(s.length<1||s.length>70)throw Error("boundary must be 10-70 characters long");let a=Fi.encode("--"+s+fn),o=Fi.encode("--"+s+"--"+fn),c=o.byteLength,l=Array.from(t.entries()).map(([f,x])=>{let S=new Ac(f,x);return c+=S.size,S});c+=a.byteLength*l.length,c=v.toFiniteNumber(c);let u={"Content-Type":`multipart/form-data; boundary=${s}`};return Number.isFinite(c)&&(u["Content-Length"]=c),e&&e(u),Je.Readable.from((async function*(){for(let f of l)yield a,yield*f.encode();yield o})())},Lc=class extends Je.Transform{__transform(e,n,i){this.push(e),i()}_transform(e,n,i){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let r=Buffer.alloc(2);r[0]=120,r[1]=156,this.push(r,n)}this.__transform(e,n,i)}},IT=(t,e)=>v.isAsyncFn(t)?function(...n){let i=n.pop();t.apply(this,n).then(r=>{try{e?i(null,...e(r)):i(null,r)}catch(s){i(s)}},i)}:t,RT=new Set(["localhost"]),Pg=t=>{let e=t.split(".");return e.length!==4||e[0]!=="127"?!1:e.every(n=>/^\d+$/.test(n)&&Number(n)>=0&&Number(n)<=255)},kT=t=>{if(t==="::1")return!0;let e=t.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i);if(e)return Pg(e[1]);let n=t.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i);if(n){let r=parseInt(n[1],16);return r>=32512&&r<=32767}let i=t.split(":");if(i.length===8){for(let r=0;r<7;r++)if(!/^0+$/.test(i[r]))return!1;return/^0*1$/.test(i[7])}return!1},eg=t=>t?RT.has(t)||Pg(t)?!0:kT(t):!1,OT={http:80,https:443,ws:80,wss:443,ftp:21},CT=t=>{let e=t,n=0;if(e.charAt(0)==="["){let s=e.indexOf("]");if(s!==-1){let a=e.slice(1,s),o=e.slice(s+1);return o.charAt(0)===":"&&/^\d+$/.test(o.slice(1))&&(n=Number.parseInt(o.slice(1),10)),[a,n]}}let i=e.indexOf(":"),r=e.lastIndexOf(":");return i!==-1&&i===r&&/^\d+$/.test(e.slice(r+1))&&(n=Number.parseInt(e.slice(r+1),10),e=e.slice(0,r)),[e,n]},tg=t=>t&&(t.charAt(0)==="["&&t.charAt(t.length-1)==="]"&&(t=t.slice(1,-1)),t.replace(/\.+$/,""));function NT(t){let e;try{e=new URL(t)}catch{return!1}let n=(process.env.no_proxy||process.env.NO_PROXY||"").toLowerCase();if(!n)return!1;if(n==="*")return!0;let i=Number.parseInt(e.port,10)||OT[e.protocol.split(":",1)[0]]||0,r=tg(e.hostname.toLowerCase());return n.split(/[\s,]+/).some(s=>{if(!s)return!1;let[a,o]=CT(s);return a=tg(a),!a||o&&o!==i?!1:(a.charAt(0)==="*"&&(a=a.slice(1)),a.charAt(0)==="."?r.endsWith(a):r===a||eg(r)&&eg(a))})}function AT(t,e){t=t||10;let n=new Array(t),i=new Array(t),r=0,s=0,a;return e=e!==void 0?e:1e3,function(c){let l=Date.now(),u=i[s];a||(a=l),n[r]=c,i[r]=l;let f=s,x=0;for(;f!==r;)x+=n[f++],f=f%t;if(r=(r+1)%t,r===s&&(s=(s+1)%t),l-a<e)return;let S=u&&l-u;return S?Math.round(x*1e3/S):void 0}}function LT(t,e){let n=0,i=1e3/e,r,s,a=(l,u=Date.now())=>{n=u,r=null,s&&(clearTimeout(s),s=null),t(...l)};return[(...l)=>{let u=Date.now(),f=u-n;f>=i?a(l,u):(r=l,s||(s=setTimeout(()=>{s=null,a(r)},i-f)))},()=>r&&a(r)]}var zn=(t,e,n=3)=>{let i=0,r=AT(50,250);return LT(s=>{let a=s.loaded,o=s.lengthComputable?s.total:void 0,c=o!=null?Math.min(a,o):a,l=Math.max(0,c-i),u=r(l);i=Math.max(i,c);let f={loaded:c,total:o,progress:o?c/o:void 0,bytes:l,rate:u||void 0,estimated:u&&o?(o-c)/u:void 0,event:s,lengthComputable:o!=null,[e?"download":"upload"]:!0};t(f)},n)},us=(t,e)=>{let n=t!=null;return[i=>e[0]({lengthComputable:n,total:t,loaded:i}),e[1]]},ps=t=>(...e)=>v.asap(()=>t(...e));function PT(t){if(!t||typeof t!="string"||!t.startsWith("data:"))return 0;let e=t.indexOf(",");if(e<0)return 0;let n=t.slice(5,e),i=t.slice(e+1);if(/;base64/i.test(n)){let s=i.length,a=i.length;for(let x=0;x<a;x++)if(i.charCodeAt(x)===37&&x+2<a){let S=i.charCodeAt(x+1),b=i.charCodeAt(x+2);(S>=48&&S<=57||S>=65&&S<=70||S>=97&&S<=102)&&(b>=48&&b<=57||b>=65&&b<=70||b>=97&&b<=102)&&(s-=2,x+=2)}let o=0,c=a-1,l=x=>x>=2&&i.charCodeAt(x-2)===37&&i.charCodeAt(x-1)===51&&(i.charCodeAt(x)===68||i.charCodeAt(x)===100);c>=0&&(i.charCodeAt(c)===61?(o++,c--):l(c)&&(o++,c-=3)),o===1&&c>=0&&(i.charCodeAt(c)===61||l(c))&&o++;let f=Math.floor(s/4)*3-(o||0);return f>0?f:0}return Buffer.byteLength(i,"utf8")}var ng={flush:Ht.constants.Z_SYNC_FLUSH,finishFlush:Ht.constants.Z_SYNC_FLUSH},MT={flush:Ht.constants.BROTLI_OPERATION_FLUSH,finishFlush:Ht.constants.BROTLI_OPERATION_FLUSH},ig=v.isFunction(Ht.createBrotliDecompress),{http:jT,https:qT}=t0,$T=/https:?/,rg=Se.protocols.map(t=>t+":"),sg=(t,[e,n])=>(t.on("end",n).on("error",n),e),Pc=class{constructor(){this.sessions=Object.create(null)}getSession(e,n){n=Object.assign({sessionTimeout:1e3},n);let i=this.sessions[e];if(i){let u=i.length;for(let f=0;f<u;f++){let[x,S]=i[f];if(!x.destroyed&&!x.closed&&qc.isDeepStrictEqual(S,n))return x}}let r=xg.connect(e,n),s,a=()=>{if(s)return;s=!0;let u=i,f=u.length,x=f;for(;x--;)if(u[x][0]===r){f===1?delete this.sessions[e]:u.splice(x,1),r.closed||r.close();return}},o=r.request,{sessionTimeout:c}=n;if(c!=null){let u,f=0;r.request=function(){let x=o.apply(this,arguments);return f++,u&&(clearTimeout(u),u=null),x.once("close",()=>{--f||(u=setTimeout(()=>{u=null,a()},c))}),x}}r.once("close",a);let l=[r,n];return i?i.push(l):i=this.sessions[e]=[l],r}},BT=new Pc;function DT(t,e){t.beforeRedirects.proxy&&t.beforeRedirects.proxy(t),t.beforeRedirects.config&&t.beforeRedirects.config(t,e)}function Mg(t,e,n){let i=e;if(!i&&i!==!1){let r=vT(n);r&&(NT(n)||(i=new URL(r)))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){if(!!(i.auth.username||i.auth.password))i.auth=(i.auth.username||"")+":"+(i.auth.password||"");else if(typeof i.auth=="object")throw new $("Invalid proxy authorization",$.ERR_BAD_OPTION,{proxy:i});let a=Buffer.from(i.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+a}t.headers.host=t.hostname+(t.port?":"+t.port:"");let r=i.hostname||i.host;t.hostname=r,t.host=r,t.port=i.port,t.path=n,i.protocol&&(t.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}t.beforeRedirects.proxy=function(s){Mg(s,e,s.href)}}var UT=typeof process<"u"&&v.kindOf(process)==="process",FT=t=>new Promise((e,n)=>{let i,r,s=(c,l)=>{r||(r=!0,i&&i(c,l))},a=c=>{s(c),e(c)},o=c=>{s(c,!0),n(c)};t(a,o,c=>i=c).catch(o)}),zT=({address:t,family:e})=>{if(!v.isString(t))throw TypeError("address must be a string");return{address:t,family:e||(t.indexOf(".")<0?6:4)}},ag=(t,e)=>zT(v.isObject(t)?t:{address:t,family:e}),GT={request(t,e){let n=t.protocol+"//"+t.hostname+":"+(t.port||(t.protocol==="https:"?443:80)),{http2Options:i,headers:r}=t,s=BT.getSession(n,i),{HTTP2_HEADER_SCHEME:a,HTTP2_HEADER_METHOD:o,HTTP2_HEADER_PATH:c,HTTP2_HEADER_STATUS:l}=xg.constants,u={[a]:t.protocol.replace(":",""),[o]:t.method,[c]:t.path};v.forEach(r,(x,S)=>{S.charAt(0)!==":"&&(u[S]=x)});let f=s.request(u);return f.once("response",x=>{let S=f;x=Object.assign({},x);let b=x[l];delete x[l],S.headers=x,S.statusCode=+b,e(S)}),f}},HT=UT&&function(e){return FT(async function(i,r,s){let a=U=>v.hasOwnProp(e,U)?e[U]:void 0,o=a("data"),c=a("lookup"),l=a("family"),u=a("httpVersion");u===void 0&&(u=1);let f=a("http2Options"),x=a("responseType"),S=a("responseEncoding"),b=e.method.toUpperCase(),w,g=!1,C;if(u=+u,Number.isNaN(u))throw TypeError(`Invalid protocol version: '${e.httpVersion}' is not a number`);if(u!==1&&u!==2)throw TypeError(`Unsupported protocol version '${u}'`);let z=u===2;if(c){let U=IT(c,M=>v.isArray(M)?M:[M]);c=(M,V,ie)=>{U(M,V,(X,ce,ke)=>{if(X)return ie(X);let ge=v.isArray(ce)?ce.map(ht=>ag(ht)):[ag(ce,ke)];V.all?ie(X,ge):ie(X,ge[0].address,ge[0].family)})}}let q=new n0.EventEmitter;function N(U){try{q.emit("abort",!U||U.type?new At(null,e,C):U)}catch(M){console.warn("emit error",M)}}q.once("abort",r);let I=()=>{e.cancelToken&&e.cancelToken.unsubscribe(N),e.signal&&e.signal.removeEventListener("abort",N),q.removeAllListeners()};(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(N),e.signal&&(e.signal.aborted?N():e.signal.addEventListener("abort",N))),s((U,M)=>{if(w=!0,M){g=!0,I();return}let{data:V}=U;if(V instanceof Je.Readable||V instanceof Je.Duplex){let ie=Je.finished(V,()=>{ie(),I()})}else I()});let H=Dc(e.baseURL,e.url,e.allowAbsoluteUrls),G=new URL(H,Se.hasBrowserEnv?Se.origin:void 0),L=G.protocol||rg[0];if(L==="data:"){if(e.maxContentLength>-1){let M=String(e.url||H||"");if(PT(M)>e.maxContentLength)return r(new $("maxContentLength size of "+e.maxContentLength+" exceeded",$.ERR_BAD_RESPONSE,e))}let U;if(b!=="GET")return Un(i,r,{status:405,statusText:"method not allowed",headers:{},config:e});try{U=wT(e.url,x==="blob",{Blob:e.env&&e.env.Blob})}catch(M){throw $.from(M,$.ERR_BAD_REQUEST,e)}return x==="text"?(U=U.toString(S),(!S||S==="utf8")&&(U=v.stripBOM(U))):x==="stream"&&(U=Je.Readable.from(U)),Un(i,r,{data:U,status:200,statusText:"OK",headers:new Oe,config:e})}if(rg.indexOf(L)===-1)return r(new $("Unsupported protocol "+L,$.ERR_BAD_REQUEST,e));let J=Oe.from(e.headers).normalize();J.set("User-Agent","axios/"+cs,!1);let{onUploadProgress:Z,onDownloadProgress:O}=e,me=e.maxRate,R,p;if(v.isSpecCompliantForm(o)){let U=J.getContentType(/boundary=([-_\w\d]{10,70})/i);o=ET(o,M=>{J.set(M)},{tag:`axios-${cs}-boundary`,boundary:U&&U[1]||void 0})}else if(v.isFormData(o)&&v.isFunction(o.getHeaders)&&o.getHeaders!==Object.prototype.getHeaders){if(J.set(o.getHeaders()),!J.hasContentLength())try{let U=await qc.promisify(o.getLength).call(o);Number.isFinite(U)&&U>=0&&J.setContentLength(U)}catch{}}else if(v.isBlob(o)||v.isFile(o))o.size&&J.setContentType(o.type||"application/octet-stream"),J.setContentLength(o.size||0),o=Je.Readable.from(Lg(o));else if(o&&!v.isStream(o)){if(!Buffer.isBuffer(o))if(v.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else if(v.isString(o))o=Buffer.from(o,"utf-8");else return r(new $("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",$.ERR_BAD_REQUEST,e));if(J.setContentLength(o.length,!1),e.maxBodyLength>-1&&o.length>e.maxBodyLength)return r(new $("Request body larger than maxBodyLength limit",$.ERR_BAD_REQUEST,e))}let j=v.toFiniteNumber(J.getContentLength());v.isArray(me)?(R=me[0],p=me[1]):R=p=me,o&&(Z||R)&&(v.isStream(o)||(o=Je.Readable.from(o,{objectMode:!1})),o=Je.pipeline([o,new ls({maxRate:v.toFiniteNumber(R)})],v.noop),Z&&o.on("progress",sg(o,us(j,zn(ps(Z),!1,3)))));let E;if(e.auth){let U=e.auth.username||"",M=e.auth.password||"";E=U+":"+M}if(!E&&G.username){let U=G.username,M=G.password;E=U+":"+M}E&&J.delete("authorization");let re;try{re=$c(G.pathname+G.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(U){let M=new Error(U.message);return M.config=e,M.url=e.url,M.exists=!0,r(M)}J.set("Accept-Encoding","gzip, compress, deflate"+(ig?", br":""),!1);let K={path:re,method:b,headers:J.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:E,protocol:L,family:l,beforeRedirect:DT,beforeRedirects:{},http2Options:f};!v.isUndefined(c)&&(K.lookup=c),e.socketPath?K.socketPath=e.socketPath:(K.hostname=G.hostname.startsWith("[")?G.hostname.slice(1,-1):G.hostname,K.port=G.port,Mg(K,e.proxy,L+"//"+G.hostname+(G.port?":"+G.port:"")+K.path));let ee,he=$T.test(K.protocol);if(K.agent=he?e.httpsAgent:e.httpAgent,z)ee=GT;else{let U=a("transport");U?ee=U:e.maxRedirects===0?ee=he?e0:Q_:(e.maxRedirects&&(K.maxRedirects=e.maxRedirects),e.beforeRedirect&&(K.beforeRedirects.config=e.beforeRedirect),ee=he?qT:jT)}if(e.maxBodyLength>-1?K.maxBodyLength=e.maxBodyLength:K.maxBodyLength=1/0,e.insecureHTTPParser&&(K.insecureHTTPParser=e.insecureHTTPParser),C=ee.request(K,function(M){if(C.destroyed)return;let V=[M],ie=v.toFiniteNumber(M.headers["content-length"]);if(O||p){let ge=new ls({maxRate:v.toFiniteNumber(p)});O&&ge.on("progress",sg(ge,us(ie,zn(ps(O),!0,3)))),V.push(ge)}let X=M,ce=M.req||C;if(e.decompress!==!1&&M.headers["content-encoding"])switch((b==="HEAD"||M.statusCode===204)&&delete M.headers["content-encoding"],(M.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":V.push(Ht.createUnzip(ng)),delete M.headers["content-encoding"];break;case"deflate":V.push(new Lc),V.push(Ht.createUnzip(ng)),delete M.headers["content-encoding"];break;case"br":ig&&(V.push(Ht.createBrotliDecompress(MT)),delete M.headers["content-encoding"])}X=V.length>1?Je.pipeline(V,v.noop):V[0];let ke={status:M.statusCode,statusText:M.statusMessage,headers:new Oe(M.headers),config:e,request:ce};if(x==="stream"){if(e.maxContentLength>-1){let ge=e.maxContentLength,ht=X;async function*It(){let _e=0;for await(let Lt of ht){if(_e+=Lt.length,_e>ge)throw new $("maxContentLength size of "+ge+" exceeded",$.ERR_BAD_RESPONSE,e,ce);yield Lt}}X=Je.Readable.from(It(),{objectMode:!1})}ke.data=X,Un(i,r,ke)}else{let ge=[],ht=0;X.on("data",function(_e){ge.push(_e),ht+=_e.length,e.maxContentLength>-1&&ht>e.maxContentLength&&(g=!0,X.destroy(),N(new $("maxContentLength size of "+e.maxContentLength+" exceeded",$.ERR_BAD_RESPONSE,e,ce)))}),X.on("aborted",function(){if(g)return;let _e=new $("stream has been aborted",$.ERR_BAD_RESPONSE,e,ce);X.destroy(_e),r(_e)}),X.on("error",function(_e){C.destroyed||r($.from(_e,null,e,ce))}),X.on("end",function(){try{let _e=ge.length===1?ge[0]:Buffer.concat(ge);x!=="arraybuffer"&&(_e=_e.toString(S),(!S||S==="utf8")&&(_e=v.stripBOM(_e))),ke.data=_e}catch(_e){return r($.from(_e,null,e,ke.request,ke))}Un(i,r,ke)})}q.once("abort",ge=>{X.destroyed||(X.emit("error",ge),X.destroy())})}),q.once("abort",U=>{C.close?C.close():C.destroy(U)}),C.on("error",function(M){r($.from(M,null,e,C))}),C.on("socket",function(M){M.setKeepAlive(!0,1e3*60);let V=()=>{M.removeListener("error",ie)};function ie(X){V(),C.destroyed||C.destroy(X)}M.on("error",ie),C.once("close",V)}),e.timeout){let U=parseInt(e.timeout,10);if(Number.isNaN(U)){N(new $("error trying to parse `config.timeout` to int",$.ERR_BAD_OPTION_VALUE,e,C));return}C.setTimeout(U,function(){if(w)return;let V=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",ie=e.transitional||xs;e.timeoutErrorMessage&&(V=e.timeoutErrorMessage),N(new $(V,ie.clarifyTimeoutError?$.ETIMEDOUT:$.ECONNABORTED,e,C))})}else C.setTimeout(0);if(v.isStream(o)){let U=!1,M=!1;o.on("end",()=>{U=!0}),o.once("error",ie=>{M=!0,C.destroy(ie)}),o.on("close",()=>{!U&&!M&&N(new At("Request stream has been aborted",e,C))});let V=o;if(e.maxBodyLength>-1&&e.maxRedirects===0){let ie=e.maxBodyLength,X=0;V=Je.pipeline([o,new Je.Transform({transform(ce,ke,ge){if(X+=ce.length,X>ie)return ge(new $("Request body larger than maxBodyLength limit",$.ERR_BAD_REQUEST,e,C));ge(null,ce)}})],v.noop),V.on("error",ce=>{C.destroyed||C.destroy(ce)})}V.pipe(C)}else o&&C.write(o),C.end()})},KT=Se.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Se.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Se.origin),Se.navigator&&/(msie|trident)/i.test(Se.navigator.userAgent)):()=>!0,VT=Se.hasStandardBrowserEnv?{write(t,e,n,i,r,s,a){if(typeof document>"u")return;let o=[`${t}=${encodeURIComponent(e)}`];v.isNumber(n)&&o.push(`expires=${new Date(n).toUTCString()}`),v.isString(i)&&o.push(`path=${i}`),v.isString(r)&&o.push(`domain=${r}`),s===!0&&o.push("secure"),v.isString(a)&&o.push(`SameSite=${a}`),document.cookie=o.join("; ")},read(t){if(typeof document>"u")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}},og=t=>t instanceof Oe?{...t}:t;function mn(t,e){e=e||{};let n={};function i(l,u,f,x){return v.isPlainObject(l)&&v.isPlainObject(u)?v.merge.call({caseless:x},l,u):v.isPlainObject(u)?v.merge({},u):v.isArray(u)?u.slice():u}function r(l,u,f,x){if(v.isUndefined(u)){if(!v.isUndefined(l))return i(void 0,l,f,x)}else return i(l,u,f,x)}function s(l,u){if(!v.isUndefined(u))return i(void 0,u)}function a(l,u){if(v.isUndefined(u)){if(!v.isUndefined(l))return i(void 0,l)}else return i(void 0,u)}function o(l,u,f){if(v.hasOwnProp(e,f))return i(l,u);if(v.hasOwnProp(t,f))return i(void 0,l)}let c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(l,u,f)=>r(og(l),og(u),f,!0)};return v.forEach(Object.keys({...t,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;let f=v.hasOwnProp(c,u)?c[u]:r,x=v.hasOwnProp(t,u)?t[u]:void 0,S=v.hasOwnProp(e,u)?e[u]:void 0,b=f(x,S,u);v.isUndefined(b)&&f!==o||(n[u]=b)}),n}var jg=t=>{let e=mn({},t),{data:n,withXSRFToken:i,xsrfHeaderName:r,xsrfCookieName:s,headers:a,auth:o}=e;if(e.headers=a=Oe.from(a),e.url=$c(Dc(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),v.isFormData(n)){if(Se.hasStandardBrowserEnv||Se.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(v.isFunction(n.getHeaders)){let c=n.getHeaders(),l=["content-type","content-length"];Object.entries(c).forEach(([u,f])=>{l.includes(u.toLowerCase())&&a.set(u,f)})}}if(Se.hasStandardBrowserEnv&&(v.isFunction(i)&&(i=i(e)),i===!0||i==null&&KT(e.url))){let l=r&&s&&VT.read(s);l&&a.set(r,l)}return e},WT=typeof XMLHttpRequest<"u",JT=WT&&function(t){return new Promise(function(n,i){let r=jg(t),s=r.data,a=Oe.from(r.headers).normalize(),{responseType:o,onUploadProgress:c,onDownloadProgress:l}=r,u,f,x,S,b;function w(){S&&S(),b&&b(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let g=new XMLHttpRequest;g.open(r.method.toUpperCase(),r.url,!0),g.timeout=r.timeout;function C(){if(!g)return;let q=Oe.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),I={data:!o||o==="text"||o==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:q,config:t,request:g};Un(function(G){n(G),w()},function(G){i(G),w()},I),g=null}"onloadend"in g?g.onloadend=C:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(C)},g.onabort=function(){g&&(i(new $("Request aborted",$.ECONNABORTED,t,g)),g=null)},g.onerror=function(N){let I=N&&N.message?N.message:"Network Error",H=new $(I,$.ERR_NETWORK,t,g);H.event=N||null,i(H),g=null},g.ontimeout=function(){let N=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded",I=r.transitional||xs;r.timeoutErrorMessage&&(N=r.timeoutErrorMessage),i(new $(N,I.clarifyTimeoutError?$.ETIMEDOUT:$.ECONNABORTED,t,g)),g=null},s===void 0&&a.setContentType(null),"setRequestHeader"in g&&v.forEach(a.toJSON(),function(N,I){g.setRequestHeader(I,N)}),v.isUndefined(r.withCredentials)||(g.withCredentials=!!r.withCredentials),o&&o!=="json"&&(g.responseType=r.responseType),l&&([x,b]=zn(l,!0),g.addEventListener("progress",x)),c&&g.upload&&([f,S]=zn(c),g.upload.addEventListener("progress",f),g.upload.addEventListener("loadend",S)),(r.cancelToken||r.signal)&&(u=q=>{g&&(i(!q||q.type?new At(null,t,g):q),g.abort(),g=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));let z=Ag(r.url);if(z&&Se.protocols.indexOf(z)===-1){i(new $("Unsupported protocol "+z+":",$.ERR_BAD_REQUEST,t));return}g.send(s||null)})},XT=(t,e)=>{let{length:n}=t=t?t.filter(Boolean):[];if(e||n){let i=new AbortController,r,s=function(l){if(!r){r=!0,o();let u=l instanceof Error?l:this.reason;i.abort(u instanceof $?u:new At(u instanceof Error?u.message:u))}},a=e&&setTimeout(()=>{a=null,s(new $(`timeout of ${e}ms exceeded`,$.ETIMEDOUT))},e),o=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),t=null)};t.forEach(l=>l.addEventListener("abort",s));let{signal:c}=i;return c.unsubscribe=()=>v.asap(o),c}},YT=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let i=0,r;for(;i<n;)r=i+e,yield t.slice(i,r),i=r},ZT=async function*(t,e){for await(let n of QT(t))yield*YT(n,e)},QT=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}let e=t.getReader();try{for(;;){let{done:n,value:i}=await e.read();if(n)break;yield i}}finally{await e.cancel()}},cg=(t,e,n,i)=>{let r=ZT(t,e),s=0,a,o=c=>{a||(a=!0,i&&i(c))};return new ReadableStream({async pull(c){try{let{done:l,value:u}=await r.next();if(l){o(),c.close();return}let f=u.byteLength;if(n){let x=s+=f;n(x)}c.enqueue(new Uint8Array(u))}catch(l){throw o(l),l}},cancel(c){return o(c),r.return()}},{highWaterMark:2})},lg=64*1024,{isFunction:is}=v,eS=(({Request:t,Response:e})=>({Request:t,Response:e}))(v.global),{ReadableStream:ug,TextEncoder:pg}=v.global,dg=(t,...e)=>{try{return!!t(...e)}catch{return!1}},tS=t=>{t=v.merge.call({skipUndefined:!0},eS,t);let{fetch:e,Request:n,Response:i}=t,r=e?is(e):typeof fetch=="function",s=is(n),a=is(i);if(!r)return!1;let o=r&&is(ug),c=r&&(typeof pg=="function"?(b=>w=>b.encode(w))(new pg):async b=>new Uint8Array(await new n(b).arrayBuffer())),l=s&&o&&dg(()=>{let b=!1,w=new n(Se.origin,{body:new ug,method:"POST",get duplex(){return b=!0,"half"}}),g=w.headers.has("Content-Type");return w.body!=null&&w.body.cancel(),b&&!g}),u=a&&o&&dg(()=>v.isReadableStream(new i("").body)),f={stream:u&&(b=>b.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!f[b]&&(f[b]=(w,g)=>{let C=w&&w[b];if(C)return C.call(w);throw new $(`Response type '${b}' is not supported`,$.ERR_NOT_SUPPORT,g)})});let x=async b=>{if(b==null)return 0;if(v.isBlob(b))return b.size;if(v.isSpecCompliantForm(b))return(await new n(Se.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(v.isArrayBufferView(b)||v.isArrayBuffer(b))return b.byteLength;if(v.isURLSearchParams(b)&&(b=b+""),v.isString(b))return(await c(b)).byteLength},S=async(b,w)=>{let g=v.toFiniteNumber(b.getContentLength());return g??x(w)};return async b=>{let{url:w,method:g,data:C,signal:z,cancelToken:q,timeout:N,onDownloadProgress:I,onUploadProgress:H,responseType:G,headers:L,withCredentials:J="same-origin",fetchOptions:Z}=jg(b),O=e||fetch;G=G?(G+"").toLowerCase():"text";let me=XT([z,q&&q.toAbortSignal()],N),R=null,p=me&&me.unsubscribe&&(()=>{me.unsubscribe()}),j;try{if(H&&l&&g!=="get"&&g!=="head"&&(j=await S(L,C))!==0){let U=new n(w,{method:"POST",body:C,duplex:"half"}),M;if(v.isFormData(C)&&(M=U.headers.get("content-type"))&&L.setContentType(M),U.body){let[V,ie]=us(j,zn(ps(H)));C=cg(U.body,lg,V,ie)}}v.isString(J)||(J=J?"include":"omit");let E=s&&"credentials"in n.prototype;if(v.isFormData(C)){let U=L.getContentType();U&&/^multipart\/form-data/i.test(U)&&!/boundary=/i.test(U)&&L.delete("content-type")}let re={...Z,signal:me,method:g.toUpperCase(),headers:L.normalize().toJSON(),body:C,duplex:"half",credentials:E?J:void 0};R=s&&new n(w,re);let K=await(s?O(R,Z):O(w,re)),ee=u&&(G==="stream"||G==="response");if(u&&(I||ee&&p)){let U={};["status","statusText","headers"].forEach(X=>{U[X]=K[X]});let M=v.toFiniteNumber(K.headers.get("content-length")),[V,ie]=I&&us(M,zn(ps(I),!0))||[];K=new i(cg(K.body,lg,V,()=>{ie&&ie(),p&&p()}),U)}G=G||"text";let he=await f[v.findKey(f,G)||"text"](K,b);return!ee&&p&&p(),await new Promise((U,M)=>{Un(U,M,{data:he,headers:Oe.from(K.headers),status:K.status,statusText:K.statusText,config:b,request:R})})}catch(E){throw p&&p(),E&&E.name==="TypeError"&&/Load failed|fetch/i.test(E.message)?Object.assign(new $("Network Error",$.ERR_NETWORK,b,R,E&&E.response),{cause:E.cause||E}):$.from(E,E&&E.code,b,R,E&&E.response)}}},nS=new Map,qg=t=>{let e=t&&t.env||{},{fetch:n,Request:i,Response:r}=e,s=[i,r,n],a=s.length,o=a,c,l,u=nS;for(;o--;)c=s[o],l=u.get(c),l===void 0&&u.set(c,l=o?new Map:tS(e)),u=l;return l};qg();var Uc={http:HT,xhr:JT,fetch:{get:qg}};v.forEach(Uc,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var fg=t=>`- ${t}`,iS=t=>v.isFunction(t)||t===null||t===!1;function rS(t,e){t=v.isArray(t)?t:[t];let{length:n}=t,i,r,s={};for(let a=0;a<n;a++){i=t[a];let o;if(r=i,!iS(i)&&(r=Uc[(o=String(i)).toLowerCase()],r===void 0))throw new $(`Unknown adapter '${o}'`);if(r&&(v.isFunction(r)||(r=r.get(e))))break;s[o||"#"+a]=r}if(!r){let a=Object.entries(s).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build")),o=n?a.length>1?`since :
18
- `+a.map(fg).join(`
19
- `):" "+fg(a[0]):"as no adapter specified";throw new $("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r}var $g={getAdapter:rS,adapters:Uc};function Rc(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new At(null,t)}function mg(t){return Rc(t),t.headers=Oe.from(t.headers),t.data=Ec.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),$g.getAdapter(t.adapter||Ki.adapter,t)(t).then(function(i){return Rc(t),i.data=Ec.call(t,t.transformResponse,i),i.headers=Oe.from(i.headers),i},function(i){return Ng(i)||(Rc(t),i&&i.response&&(i.response.data=Ec.call(t,t.transformResponse,i.response),i.response.headers=Oe.from(i.response.headers))),Promise.reject(i)})}var vs={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{vs[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}});var hg={};vs.transitional=function(e,n,i){function r(s,a){return"[Axios v"+cs+"] Transitional option '"+s+"'"+a+(i?". "+i:"")}return(s,a,o)=>{if(e===!1)throw new $(r(a," has been removed"+(n?" in "+n:"")),$.ERR_DEPRECATED);return n&&!hg[a]&&(hg[a]=!0,console.warn(r(a," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(s,a,o):!0}};vs.spelling=function(e){return(n,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};function sS(t,e,n){if(typeof t!="object")throw new $("options must be an object",$.ERR_BAD_OPTION_VALUE);let i=Object.keys(t),r=i.length;for(;r-- >0;){let s=i[r],a=e[s];if(a){let o=t[s],c=o===void 0||a(o,s,t);if(c!==!0)throw new $("option "+s+" must be "+c,$.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new $("Unknown option "+s,$.ERR_BAD_OPTION)}}var as={assertOptions:sS,validators:vs},rt=as.validators,Nt=class{constructor(e){this.defaults=e||{},this.interceptors={request:new os,response:new os}}async request(e,n){try{return await this._request(e,n)}catch(i){if(i instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;let s=(()=>{if(!r.stack)return"";let a=r.stack.indexOf(`
20
- `);return a===-1?"":r.stack.slice(a+1)})();try{if(!i.stack)i.stack=s;else if(s){let a=s.indexOf(`
21
- `),o=a===-1?-1:s.indexOf(`
22
- `,a+1),c=o===-1?"":s.slice(o+1);String(i.stack).endsWith(c)||(i.stack+=`
23
- `+s)}}catch{}}throw i}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=mn(this.defaults,n);let{transitional:i,paramsSerializer:r,headers:s}=n;i!==void 0&&as.assertOptions(i,{silentJSONParsing:rt.transitional(rt.boolean),forcedJSONParsing:rt.transitional(rt.boolean),clarifyTimeoutError:rt.transitional(rt.boolean),legacyInterceptorReqResOrdering:rt.transitional(rt.boolean)},!1),r!=null&&(v.isFunction(r)?n.paramsSerializer={serialize:r}:as.assertOptions(r,{encode:rt.function,serialize:rt.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),as.assertOptions(n,{baseUrl:rt.spelling("baseURL"),withXsrfToken:rt.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=s&&v.merge(s.common,s[n.method]);s&&v.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),n.headers=Oe.concat(a,s);let o=[],c=!0;this.interceptors.request.forEach(function(w){if(typeof w.runWhen=="function"&&w.runWhen(n)===!1)return;c=c&&w.synchronous;let g=n.transitional||xs;g&&g.legacyInterceptorReqResOrdering?o.unshift(w.fulfilled,w.rejected):o.push(w.fulfilled,w.rejected)});let l=[];this.interceptors.response.forEach(function(w){l.push(w.fulfilled,w.rejected)});let u,f=0,x;if(!c){let b=[mg.bind(this),void 0];for(b.unshift(...o),b.push(...l),x=b.length,u=Promise.resolve(n);f<x;)u=u.then(b[f++],b[f++]);return u}x=o.length;let S=n;for(;f<x;){let b=o[f++],w=o[f++];try{S=b(S)}catch(g){w.call(this,g);break}}try{u=mg.call(this,S)}catch(b){return Promise.reject(b)}for(f=0,x=l.length;f<x;)u=u.then(l[f++],l[f++]);return u}getUri(e){e=mn(this.defaults,e);let n=Dc(e.baseURL,e.url,e.allowAbsoluteUrls);return $c(n,e.params,e.paramsSerializer)}};v.forEach(["delete","get","head","options"],function(e){Nt.prototype[e]=function(n,i){return this.request(mn(i||{},{method:e,url:n,data:(i||{}).data}))}});v.forEach(["post","put","patch"],function(e){function n(i){return function(s,a,o){return this.request(mn(o||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}Nt.prototype[e]=n(),Nt.prototype[e+"Form"]=n(!0)});var Mc=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});let i=this;this.promise.then(r=>{if(!i._listeners)return;let s=i._listeners.length;for(;s-- >0;)i._listeners[s](r);i._listeners=null}),this.promise.then=r=>{let s,a=new Promise(o=>{i.subscribe(o),s=o}).then(r);return a.cancel=function(){i.unsubscribe(s)},a},e(function(s,a,o){i.reason||(i.reason=new At(s,a,o),n(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){let e=new AbortController,n=i=>{e.abort(i)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new t(function(r){e=r}),cancel:e}}};function aS(t){return function(n){return t.apply(null,n)}}function oS(t){return v.isObject(t)&&t.isAxiosError===!0}var jc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(jc).forEach(([t,e])=>{jc[e]=t});function Bg(t){let e=new Nt(t),n=vg(Nt.prototype.request,e);return v.extend(n,Nt.prototype,e,{allOwnKeys:!0}),v.extend(n,e,null,{allOwnKeys:!0}),n.create=function(r){return Bg(mn(t,r))},n}var Re=Bg(Ki);Re.Axios=Nt;Re.CanceledError=At;Re.CancelToken=Mc;Re.isCancel=Ng;Re.VERSION=cs;Re.toFormData=gs;Re.AxiosError=$;Re.Cancel=Re.CanceledError;Re.all=function(e){return Promise.all(e)};Re.spread=aS;Re.isAxiosError=oS;Re.mergeConfig=mn;Re.AxiosHeaders=Oe;Re.formToJSON=t=>Cg(v.isHTMLForm(t)?new FormData(t):t);Re.getAdapter=$g.getAdapter;Re.HttpStatusCode=jc;Re.default=Re;Dg.exports=Re});var zg=k(Kt=>{"use strict";var Hn=Kt&&Kt.__awaiter||function(t,e,n,i){function r(s){return s instanceof n?s:new n(function(a){a(s)})}return new(n||(n=Promise))(function(s,a){function o(u){try{l(i.next(u))}catch(f){a(f)}}function c(u){try{l(i.throw(u))}catch(f){a(f)}}function l(u){u.done?s(u.value):r(u.value).then(o,c)}l((i=i.apply(t,e||[])).next())})},Kn=Kt&&Kt.__generator||function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(l){return function(u){return c([l,u])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(n=0)),n;)try{if(i=1,r&&(s=l[0]&2?r.return:l[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,l[1])).done)return s;switch(r=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,r=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){n.label=l[1];break}if(l[0]===6&&n.label<s[1]){n.label=s[1],s=l;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(l);break}s[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(u){l=[6,u],r=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}};Object.defineProperty(Kt,"__esModule",{value:!0});Kt.Producer=void 0;var Ye=zo(),ze=Cf(),cS=jf(),lS=Ug(),Fg=Fo(),uS=Y("zlib"),pS=(function(){function t(e){if(this.sendTimeout=ze.HTTP_SEND_TIME_OUT,this.sourceIp="",this.time=2,this.count=1e3,this.dataHasSend=!0,this.maxMemLogCount=1e4,e==null)throw new Ye.TencentCloudClsSDKException(-1,"options invalid");if(e.endpoint==null)throw new Ye.TencentCloudClsSDKException(-1,"options endpoint can not be empty");for(e.endpoint.startsWith("http://")?(this.hostName=e.endpoint.substring(7),this.httpType="http://"):e.endpoint.startsWith("https://")?(this.hostName=e.endpoint.substring(8),this.httpType="https://"):(this.hostName=e.endpoint,this.httpType="http://");this.hostName.endsWith("/");)this.hostName=this.hostName.substring(0,this.hostName.length-1);if(e.credential==null)throw new Ye.TencentCloudClsSDKException(-1,"credential must be a valid credential");if(e.credential.secretId==null||e.credential.secretId.length==0)throw new Ye.TencentCloudClsSDKException(-1,"credential secretId can not be empty");if(e.credential.secretKey==null||e.credential.secretKey.length==0)throw new Ye.TencentCloudClsSDKException(-1,"credential secretKey can not be empty");if(this.credential=e.credential,e.topic_id==null||e.topic_id.length==0)throw new Ye.TencentCloudClsSDKException(-1,"topic_id must be empty");this.topic=e.topic_id,e.sendTimeout==null||e.sendTimeout<=0?this.sendTimeout=ze.HTTP_SEND_TIME_OUT:this.sendTimeout=e.sendTimeout,e.count!=null&&e.count>0&&(this.count=e.count),e.time!=null&&e.time>0&&(this.time=e.time),e.maxMemLogCount!=null&&e.maxMemLogCount>0&&(this.maxMemLogCount=e.maxMemLogCount),e.sourceIp!=null&&e.sourceIp.length>0&&(this.sourceIp=e.sourceIp),e.onSendLogsError!=null&&(this.onSendLogsError=e.onSendLogsError),this.mem={mdata:[],getLength:function(){return this.mdata.length},add:function(n){this.mdata.push(n)},clear:function(n){this.mdata.splice(0,n)}},this.batchInterval()}return t.prototype.resetSecretToken=function(e){if(e==null)throw new Ye.TencentCloudClsSDKException(-1,"credential must be a valid credential");if(e.secretId==null||e.secretId.length==0)throw new Ye.TencentCloudClsSDKException(-1,"credential secretId can not be empty");if(e.secretKey==null||e.secretKey.length==0)throw new Ye.TencentCloudClsSDKException(-1,"credential secretKey can not be empty");this.credential=e},t.prototype.batchInterval=function(){var e=this;(function n(){setTimeout(function(){return Hn(this,void 0,void 0,function(){return Kn(this,function(i){switch(i.label){case 0:return[4,e.batchSend()];case 1:return i.sent(),n(),[2]}})})},e.time*1e3)})()},t.prototype.batchSend=function(){return Hn(this,void 0,void 0,function(){var e,n,i,r,s,a,o,c,l,u;return Kn(this,function(f){switch(f.label){case 0:if(f.trys.push([0,3,,4]),!(this.dataHasSend&&this.mem.mdata.length>0))return[3,2];for(this.dataHasSend=!1,e=new Fg.LogGroup,e.setSource(this.sourceIp),n=0,i=0,r=this.mem.mdata.length,s=0;s<r&&(a=this.mem.mdata[s],!(n>=3*1024*1024||s==this.count-1));s++)i+=1,a!=null&&(n+=a.getLength(),e.addLogs(a));return o=this.getCommonHeadPara(ze.CONST_PROTO_BUF),c=this.getCommonUrlPara(),[4,this.putLogs(c,o,e.encode())];case 1:l=f.sent(),(l.status==200||l.status==401||l.status==413||l.status==403||l.status==400)&&this.mem.clear(i),this.onSendLogsError!=null&&this.onSendLogsError(l),this.dataHasSend=!0,f.label=2;case 2:return[3,4];case 3:return u=f.sent(),this.dataHasSend=!0,console.log(u),[3,4];case 4:return[2]}})})},t.prototype.calcLogLength=function(e){for(var n=e.getLog().time.toString().length,i=0;i<e.getLog().contents.length;i++){var r=e.getLog().contents[i].key,s=e.getLog().contents[i].value;if(r==null)throw new Ye.TencentCloudClsSDKException(-1,"content key must be empty");if(s==null)throw new Ye.TencentCloudClsSDKException(-1,"content key must be empty");n+=r.length+s.length}return n},t.prototype.send=function(e){return Hn(this,void 0,void 0,function(){var n;return Kn(this,function(i){switch(i.label){case 0:if(this.mem.getLength()>=this.maxMemLogCount&&this.mem.mdata.shift(),n=this.calcLogLength(e),n<=0||n>1048576)throw new Ye.TencentCloudClsSDKException(-1,"InvalidLogSize. logItem invalid log size");return e.setLength(n),this.mem.add(e),this.mem.getLength()>=this.count&&this.dataHasSend?[4,this.batchSend()]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},t.prototype.sendImmediate=function(e){return Hn(this,void 0,void 0,function(){var n,i,r,s;return Kn(this,function(a){switch(a.label){case 0:for(n=new Fg.LogGroup,n.setSource(this.sourceIp),i=0;i<e.length;i++)n.addLogs(e[i]);if(r=n.encode(),r.length>ze.CONST_MAX_PUT_SIZE)throw new Ye.TencentCloudClsSDKException(-1,"InvalidLogSize. logItems' size exceeds maximum limitation : ".concat(ze.CONST_MAX_PUT_SIZE," bytes, logBytes=").concat(r.length,", topic=").concat(this.topic));return[4,this.putLogs(this.getCommonUrlPara(),this.getCommonHeadPara(ze.CONST_PROTO_BUF),r)];case 1:if(s=a.sent(),s.status!=200)throw new Ye.TencentCloudClsSDKException(s.status,s.message,s.requestId);return[2,s]}})})},t.prototype.putLogs=function(e,n,i){return Hn(this,void 0,void 0,function(){var r,s,a;return Kn(this,function(o){switch(o.label){case 0:r={status:0,message:"",requestId:""},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.sendLogs(ze.CONST_HTTP_METHOD_POST,ze.UPLOAD_LOG_RESOURCE_URI,e,n,uS.deflateRawSync(i))];case 2:return s=o.sent(),s?(r.status=s.status,r.message=s.data,r.requestId=s.headers["x-cls-requestid"]):(r.status=0,r.message="internal error"),[3,4];case 3:return a=o.sent(),a.response?(r.status=a.response.status,r.requestId=a.response.headers["x-cls-requestid"],a.response.data!=null&&a.response.data.errorcode!=null&&a.response.data.errormessage!=null?r.message=JSON.stringify(a.response.data):r.message="internal error"):(r.status=0,r.message=a.toString()),[3,4];case 4:return[2,r]}})})},t.prototype.sendLogs=function(e,n,i,r,s){return Hn(this,void 0,void 0,function(){var a,o;return Kn(this,function(c){return r.set(ze.CONST_CONTENT_LENGTH,s.length.toString()),a=(0,cS.signature)(this.credential.secretId,this.credential.secretKey,e,n,i,r,3e6),r.set(ze.CONST_AUTHORIZATION,a),o={},r.forEach(function(l,u){o[u]=l}),this.credential.token!=null&&this.credential.token.length>0&&(o["X-Cls-Token"]=this.credential.token),o["x-cls-compress-type"]=ze.CONST_GZIP_ENCODING,o[ze.CONST_HOST]=this.hostName,[2,lS.default({url:this.httpType+this.hostName+n+"?"+ze.TOPIC_ID+"="+this.topic,method:"post",data:s,timeout:this.sendTimeout*1e3,headers:o})]})})},t.prototype.getCommonHeadPara=function(e){var n=new Map;return n.set(ze.CONST_CONTENT_TYPE,e),n},t.prototype.getCommonUrlPara=function(){var e=new Map;return e.set(ze.TOPIC_ID,this.topic),e},t})();Kt.Producer=pS});var ys=k(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.TencentCloudClsSDKException=st.Producer=st.Content=st.LogItem=st.LogGroup=void 0;var Fc=Fo();Object.defineProperty(st,"LogGroup",{enumerable:!0,get:function(){return Fc.LogGroup}});Object.defineProperty(st,"LogItem",{enumerable:!0,get:function(){return Fc.LogItem}});Object.defineProperty(st,"Content",{enumerable:!0,get:function(){return Fc.Content}});var dS=zg();Object.defineProperty(st,"Producer",{enumerable:!0,get:function(){return dS.Producer}});var fS=zo();Object.defineProperty(st,"TencentCloudClsSDKException",{enumerable:!0,get:function(){return fS.TencentCloudClsSDKException}})});var de=ii(Yp(),1);var xo=ii(cd(),1);import bi from"node:fs";import dd from"node:fs/promises";import ub from"node:http";import pb from"node:https";function ud(t){let e=[],n=t>>>0;for(;n>127;)e.push(n&127|128),n>>>=7;return e.push(n&127),e}function eb(t){let e=[],n=BigInt.asUintN(64,t);for(;n>0x7fn;)e.push(Number(n&0x7fn)|128),n>>=7n;return e.push(Number(n&0x7fn)),e}function tb(t){return eb(BigInt(Math.trunc(t)))}var nb=new TextEncoder;function ld(t){return nb.encode(t)}function ib(t){let e=new ArrayBuffer(8);return new Float64Array(e)[0]=t,new Uint8Array(e)}function ho(t,e){return ud(t<<3|e)}var rb=0,sb=1,ab=2;function yi(t,e){let n=ho(t,ab),i=ud(e.length),r=new Uint8Array(n.length+i.length+e.length);return r.set(n,0),r.set(i,n.length),r.set(e,n.length+i.length),r}function Dr(t){let e=0;for(let r of t)e+=r.length;let n=new Uint8Array(e),i=0;for(let r of t)n.set(r,i),i+=r.length;return n}function ob(t){let e=[];if(t.name.length>0){let n=ld(t.name);e.push(yi(1,n))}if(t.value.length>0){let n=ld(t.value);e.push(yi(2,n))}return Dr(e)}function cb(t){let e=[];{let n=ho(1,sb),i=ib(t.value),r=new Uint8Array(n.length+8);r.set(n,0),r.set(i,n.length),e.push(r)}{let n=ho(2,rb),i=tb(t.timestampMs),r=new Uint8Array(n.length+i.length);r.set(n,0),r.set(i,n.length),e.push(r)}return Dr(e)}function lb(t){let e=[];for(let n of t.labels)e.push(yi(1,ob(n)));for(let n of t.samples)e.push(yi(2,cb(n)));return Dr(e)}function pd(t){let e=[];for(let n of t.timeseries)e.push(yi(1,lb(n)));return Dr(e)}var db=64*1024;function fb(t){return t.map(e=>({source_labels:e.source_labels??["__name__"],regex:new RegExp(e.regex??"(.*)"),action:e.action??"keep"}))}function mb(t,e){for(let n of e){let i=n.source_labels.map(s=>t.find(a=>a.name===s)?.value??"").join(";"),r=n.regex.test(i);if(n.action==="keep"&&!r||n.action==="drop"&&r)return null}return t}var sn=class{constructor(e,n,i){this.buffer=[];this.flushTimer=null;this.stopped=!1;this.flushing=!1;this.consecutiveFailures=0;this.circuitOpen=!1;this.lastCircuitWarnMs=0;this.config=e,this.logger=n,this.onUnauthorized=i;let r=e.queue_config??{};this.capacity=r.capacity??2500,this.maxSamplesPerSend=r.max_samples_per_send??500,this.batchDeadlineMs=r.batch_send_deadline_ms??5e3,this.maxRetries=r.max_retries??3,this.minBackoffMs=r.min_backoff_ms??30,this.maxBackoffMs=r.max_backoff_ms??5e3,this.timeoutMs=e.remote_timeout_ms??3e4,this.maxConsecutiveFailures=r.max_consecutive_failures??3,this.compiledRelabelConfigs=fb(e.write_relabel_configs??[]);let s=e.tls_config;if(s?.ca_file)try{this.cachedTlsCa=bi.readFileSync(s.ca_file)}catch(a){n.warn(`diagnostics-prometheus: \u8BFB\u53D6 TLS ca_file \u5931\u8D25: ${a instanceof Error?a.message:String(a)}`)}if(s?.cert_file)try{this.cachedTlsCert=bi.readFileSync(s.cert_file)}catch(a){n.warn(`diagnostics-prometheus: \u8BFB\u53D6 TLS cert_file \u5931\u8D25: ${a instanceof Error?a.message:String(a)}`)}if(s?.key_file)try{this.cachedTlsKey=bi.readFileSync(s.key_file)}catch(a){n.warn(`diagnostics-prometheus: \u8BFB\u53D6 TLS key_file \u5931\u8D25: ${a instanceof Error?a.message:String(a)}`)}}enqueue(e){if(this.stopped)return;if(this.circuitOpen){let i=Date.now();i-this.lastCircuitWarnMs>=6e5&&(this.lastCircuitWarnMs=i,this.logger.warn(`diagnostics-prometheus: \u7194\u65AD\u5668\u5DF2\u6253\u5F00\uFF08\u8FDE\u7EED ${this.consecutiveFailures} \u6279\u6B21\u53D1\u9001\u5931\u8D25\uFF09\uFF0C\u6570\u636E\u4E0A\u62A5\u5DF2\u6682\u505C\u3002\u8BF7\u68C0\u67E5\u91C7\u96C6\u5668\u914D\u7F6E\uFF08endpoint/\u8BA4\u8BC1\u4FE1\u606F\u7B49\uFF09\uFF0C\u914D\u7F6E\u4FEE\u6B63\u540E\u5C06\u81EA\u52A8\u6062\u590D\uFF08\u70ED\u52A0\u8F7D\u751F\u6548\u5373\u53EF\uFF09\u3002`));return}this.refreshFileCredentials();let n=this.applyRelabelFilters(e);if(n.length!==0){if(this.buffer.push(...n),this.buffer.length>this.capacity&&this.buffer.splice(0,this.buffer.length-this.capacity),this.buffer.length>=this.maxSamplesPerSend){this.flush();return}this.flushTimer||(this.flushTimer=setTimeout(()=>{this.flushTimer=null,this.flush()},this.batchDeadlineMs),typeof this.flushTimer.unref=="function"&&this.flushTimer.unref())}}async flush(){if(this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),!this.flushing){this.flushing=!0;try{for(;this.buffer.length>0;){let e=this.buffer.splice(0,this.maxSamplesPerSend);await this.sendBatch(e)}}finally{this.flushing=!1}}}updateConfig(e){this.config={...this.config,...e},(e.basic_auth||e.bearer_token_file)&&(this.cachedPasswordFileContent=void 0,this.cachedBearerTokenFileContent=void 0),(this.circuitOpen||this.consecutiveFailures>0)&&(this.consecutiveFailures=0,this.circuitOpen=!1,this.logger.debug("diagnostics-prometheus: \u914D\u7F6E\u5DF2\u66F4\u65B0\uFF0C\u7194\u65AD\u5668\u5DF2\u91CD\u7F6E\uFF0C\u6570\u636E\u4E0A\u62A5\u6062\u590D\u3002"))}async stop(){this.stopped=!0,this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),await this.flush().catch(()=>{})}async refreshFileCredentials(){if(this.config.basic_auth?.password_file&&this.cachedPasswordFileContent===void 0)try{this.cachedPasswordFileContent=(await dd.readFile(this.config.basic_auth.password_file,"utf-8")).trim()}catch(e){this.logger.warn(`diagnostics-prometheus: \u5F02\u6B65\u8BFB\u53D6 password_file \u5931\u8D25: ${e instanceof Error?e.message:String(e)}`)}if(this.config.bearer_token_file&&this.cachedBearerTokenFileContent===void 0)try{this.cachedBearerTokenFileContent=(await dd.readFile(this.config.bearer_token_file,"utf-8")).trim()}catch(e){this.logger.warn(`diagnostics-prometheus: \u5F02\u6B65\u8BFB\u53D6 bearer_token_file \u5931\u8D25: ${e instanceof Error?e.message:String(e)}`)}}applyRelabelFilters(e){return this.compiledRelabelConfigs.length===0?e:e.filter(n=>mb(n.labels,this.compiledRelabelConfigs)!==null)}async sendBatch(e){if(e.length===0)return;let n=pd({timeseries:e}),i=xo.default.compress??xo.default.default?.compress;if(!i){this.logger.error(`diagnostics-prometheus: snappyjs compress \u51FD\u6570\u672A\u627E\u5230\uFF0C\u65E0\u6CD5\u538B\u7F29\u6570\u636E\uFF0Cdropping ${e.length} samples\u3002\u8BF7\u68C0\u67E5 snappyjs \u5305\u7248\u672C\u548C\u6A21\u5757\u52A0\u8F7D\u65B9\u5F0F`);return}let r=i(Buffer.from(n));for(let s=0;s<=this.maxRetries;s++)try{let{statusCode:a,body:o}=await this.httpPost(r);if(a>=200&&a<300){this.consecutiveFailures=0;return}if(a===401){if(this.onUnauthorized){this.logger.warn(`diagnostics-prometheus: remote write 401 Unauthorized, \u6B63\u5728\u68C0\u67E5\u51ED\u8BC1\u72B6\u6001 (attempt ${s+1}/${this.maxRetries}). Response: ${o}`);let c;try{c=await this.onUnauthorized()}catch(l){this.logger.error(`diagnostics-prometheus: \u51ED\u8BC1\u5237\u65B0\u5931\u8D25: ${go(l)}, dropping ${e.length} samples. Response: ${o}`),this.recordBatchFailure();return}if(!c){this.logger.error(`diagnostics-prometheus: remote write 401 Unauthorized, \u4E34\u65F6\u5BC6\u94A5\u672A\u8FC7\u671F\uFF0C\u8DF3\u8FC7\u91CD\u8BD5, dropping ${e.length} samples. Response: ${o}`),this.recordBatchFailure();return}if(s<this.maxRetries)continue;this.logger.error(`diagnostics-prometheus: remote write 401 after ${this.maxRetries} retries, dropping ${e.length} samples. Response: ${o}`),this.recordBatchFailure();return}this.logger.error(`diagnostics-prometheus: remote write 401 Unauthorized, dropping ${e.length} samples. Response: ${o}`),this.recordBatchFailure();return}if(a===400||a===415){this.logger.error(`diagnostics-prometheus: remote write rejected with ${a}, dropping ${e.length} samples. Response: ${o}`),this.recordBatchFailure();return}if(a===429||a>=500&&a<600){if(s<this.maxRetries){let c=this.calculateBackoff(s);this.logger.warn(`diagnostics-prometheus: remote write ${a}, retrying in ${c}ms (attempt ${s+1}/${this.maxRetries}). Response: ${o}`),await this.sleep(c);continue}this.logger.error(`diagnostics-prometheus: remote write failed after ${this.maxRetries} retries, dropping ${e.length} samples. Response: ${o}`),this.recordBatchFailure();return}this.logger.warn(`diagnostics-prometheus: remote write unexpected status ${a}. Response: ${o}`);return}catch(a){if(s<this.maxRetries){let o=this.calculateBackoff(s);this.logger.warn(`diagnostics-prometheus: remote write error: ${go(a)}, retrying in ${o}ms`),await this.sleep(o);continue}this.logger.error(`diagnostics-prometheus: remote write failed: ${go(a)}, dropping ${e.length} samples`),this.recordBatchFailure();return}}recordBatchFailure(){++this.consecutiveFailures,!this.circuitOpen&&this.consecutiveFailures>=this.maxConsecutiveFailures&&(this.circuitOpen=!0,this.lastCircuitWarnMs=0,this.logger.error(`diagnostics-prometheus: \u8FDE\u7EED ${this.consecutiveFailures} \u6279\u6B21\u53D1\u9001\u5931\u8D25\uFF0C\u7194\u65AD\u5668\u5DF2\u6253\u5F00\uFF0C\u6570\u636E\u4E0A\u62A5\u5DF2\u6682\u505C\u3002\u8BF7\u68C0\u67E5\u91C7\u96C6\u5668\u914D\u7F6E\uFF08endpoint/\u8BA4\u8BC1\u4FE1\u606F\u7B49\uFF09\uFF0C\u914D\u7F6E\u4FEE\u6B63\u540E\u70ED\u52A0\u8F7D\u5C06\u81EA\u52A8\u91CD\u7F6E\u7194\u65AD\u5668\u5E76\u6062\u590D\u4E0A\u62A5\u3002`))}httpPost(e){return new Promise((n,i)=>{let r=new URL(this.config.url),s=r.protocol==="https:",a=s?pb:ub,o={"Content-Type":"application/x-protobuf","Content-Encoding":"snappy","X-Prometheus-Remote-Write-Version":"0.1.0","User-Agent":"openclaw-diagnostics-prometheus/1.0",...this.config.headers??{}};if(this.config.basic_auth){let u=this.config.basic_auth.username??"",f=this.config.basic_auth.password??"";if(!f&&this.config.basic_auth.password_file&&(f=this.cachedPasswordFileContent??"",!f)){this.logger.warn("diagnostics-prometheus: password_file \u7F13\u5B58\u4E3A\u7A7A\uFF0C\u5C1D\u8BD5\u540C\u6B65\u8BFB\u53D6\u4F5C\u4E3A\u56DE\u9000");try{f=bi.readFileSync(this.config.basic_auth.password_file,"utf-8").trim()}catch(x){this.logger.warn(`diagnostics-prometheus: \u8BFB\u53D6 password_file \u5931\u8D25: ${x instanceof Error?x.message:String(x)}`)}}o.Authorization=`Basic ${Buffer.from(`${u}:${f}`).toString("base64")}`}else if(this.config.bearer_token)o.Authorization=`Bearer ${this.config.bearer_token}`;else if(this.config.bearer_token_file){let u=this.cachedBearerTokenFileContent??"";if(u)o.Authorization=`Bearer ${u}`;else{this.logger.warn("diagnostics-prometheus: bearer_token_file \u7F13\u5B58\u4E3A\u7A7A\uFF0C\u5C1D\u8BD5\u540C\u6B65\u8BFB\u53D6\u4F5C\u4E3A\u56DE\u9000");try{o.Authorization=`Bearer ${bi.readFileSync(this.config.bearer_token_file,"utf-8").trim()}`}catch(f){this.logger.warn(`diagnostics-prometheus: \u8BFB\u53D6 bearer_token_file \u5931\u8D25: ${f instanceof Error?f.message:String(f)}`)}}}let c={method:"POST",hostname:r.hostname,port:r.port||(s?443:80),path:r.pathname+r.search,headers:o,timeout:this.timeoutMs};if(s&&this.config.tls_config){let u=this.config.tls_config;this.cachedTlsCa&&(c.ca=this.cachedTlsCa),this.cachedTlsCert&&(c.cert=this.cachedTlsCert),this.cachedTlsKey&&(c.key=this.cachedTlsKey),u.server_name&&(c.servername=u.server_name),u.insecure_skip_verify&&(c.rejectUnauthorized=!1)}let l=a.request(c,u=>{let f=[],x=0,S=!1;u.on("data",b=>{if(!S){if(x+=b.length,x>db){S=!0,u.destroy();let w=Buffer.concat(f).toString("utf-8");n({statusCode:u.statusCode??0,body:w+"...(truncated)"});return}f.push(b)}}),u.on("end",()=>{if(S)return;let b=Buffer.concat(f).toString("utf-8");n({statusCode:u.statusCode??0,body:b})}),u.on("error",()=>{S||n({statusCode:u.statusCode??0,body:""})})});l.on("error",i),l.on("timeout",()=>{l.destroy(new Error("remote write request timed out"))}),l.write(Buffer.isBuffer(e)?e:Buffer.from(e)),l.end()})}calculateBackoff(e){let n=this.minBackoffMs*Math.pow(2,e),i=Math.min(n,this.maxBackoffMs),r=i*.25*(Math.random()*2-1);return Math.round(i+r)}sleep(e){return new Promise(n=>setTimeout(n,e))}};function go(t){return t instanceof Error?t.stack??t.message:typeof t=="string"?t:String(t)}import hb from"node:http";import gb from"node:https";import{URL as xb}from"node:url";import bo from"node:os";import Fe from"node:fs/promises";import xd from"node:path";var vb="http://metadata.tencentyun.com/latest/meta-data",yb=2e3,bb=30*1e3,vo=3,fd=1024,md=3,wi="clawpro-diagnostics-metrics-cls",vd=Object.freeze({cvmInstanceId:"",cvmInstanceName:"",cvmInstanceIntraIp:"",hostName:""}),ct=vd,_i=!1,Ei=!1,Ct=null,Ti=0,Si=0;function yo(t,e=0){let n=e===0?`${vb}/${t}`:t;if(e>md)return Promise.reject(new Error(`Too many redirects (>${md}) for ${n}`));let i;try{i=new xb(n)}catch{return Promise.reject(new Error(`Invalid URL: ${n}`))}let r=i.protocol==="https:"?gb:hb;return new Promise((s,a)=>{let o=r.get(n,{timeout:yb},c=>{let l=c.statusCode??0;if(l>=300&&l<400&&c.headers.location){c.resume(),yo(c.headers.location,e+1).then(s,a);return}if(l!==200){c.resume(),a(new Error(`HTTP ${l} for ${n}`));return}wb(c,n,s,a)});o.on("timeout",()=>{o.destroy(),a(new Error(`Request timeout for ${n}`))}),o.on("error",a)})}function wb(t,e,n,i){let r=[],s=0,a=!1;t.on("data",o=>{if(!a){if(s+=o.length,s>fd){a=!0,t.destroy(),i(new Error(`Response body too large (>${fd} bytes) for ${e}`));return}r.push(o)}}),t.on("end",()=>{a||n(Buffer.concat(r).toString("utf-8").trim())}),t.on("error",o=>{a||i(o)})}async function _b(t){let e={instanceId:"",instanceName:"",localIpv4:""};try{let n=xd.join(t,"openclaw.json"),i=await Fe.readFile(n,"utf8"),l=JSON.parse(i).plugins?.entries?.[wi]?.config?.instance_metadata;if(!l)return e;let u=f=>typeof f=="string"&&f.trim()?f.trim():"";return{instanceId:u(l.instance_id),instanceName:u(l.instance_name),localIpv4:u(l.local_ipv4)}}catch{return e}}var hd=50,Tb=5e3;async function Sb(t,e){let n=Date.now()+e;for(;Date.now()<n;){let i=null;try{return i=await Fe.open(t,Fe.constants.O_CREAT|Fe.constants.O_EXCL|Fe.constants.O_WRONLY),await i.writeFile(String(process.pid),"utf8"),await i.close(),i=null,!0}catch(r){if(i!==null){try{await i.close()}catch{}try{await Fe.unlink(t)}catch{}i=null,await new Promise(o=>setTimeout(o,hd*10));continue}if(r.code!=="EEXIST")return!1;if(await Eb(t)){try{await Fe.unlink(t)}catch{}continue}await new Promise(o=>setTimeout(o,hd))}}return!1}async function Eb(t){try{let e=await Fe.readFile(t,"utf8"),n=parseInt(e.trim(),10);if(isNaN(n)||n<=0)return!0;try{return process.kill(n,0),!1}catch(i){return i.code==="ESRCH"}}catch{return!1}}async function Ib(t){try{await Fe.unlink(t)}catch{}}async function wo(t,e,n){let i={};if(e.instanceId&&(i.instance_id=e.instanceId),e.instanceName&&(i.instance_name=e.instanceName),Object.keys(i).length===0)return;let r=xd.join(t,"openclaw.json"),s=r+".lock",a=r+".tmp";if(!await Sb(s,Tb)){n?.warn("diagnostics-metrics/instance-metadata: \u83B7\u53D6 openclaw.json \u6587\u4EF6\u9501\u8D85\u65F6\uFF0C\u8DF3\u8FC7\u672C\u6B21\u5199\u5165");return}try{let c={};try{let w=await Fe.readFile(r,"utf8");c=JSON.parse(w)}catch{}(!c.plugins||typeof c.plugins!="object")&&(c.plugins={});let l=c.plugins;(!l.entries||typeof l.entries!="object")&&(l.entries={});let u=l.entries;(!u[wi]||typeof u[wi]!="object")&&(u[wi]={});let f=u[wi];(!f.config||typeof f.config!="object")&&(f.config={});let x=f.config,S=x.instance_metadata;x.instance_metadata={...S??{},...i};let b=JSON.stringify(c,null,2)+`
24
- `;await Fe.writeFile(a,b,"utf8");try{await Fe.rename(a,r)}catch(w){if(w.code==="EXDEV"){await Fe.copyFile(a,r);try{await Fe.unlink(a)}catch{}}else throw w}n?.debug(`diagnostics-metrics/instance-metadata: \u5B9E\u4F8B\u5143\u6570\u636E\u5DF2\u6301\u4E45\u5316\u5199\u5165 openclaw.json (${Object.keys(i).join(", ")})`)}catch(c){try{await Fe.unlink(a)}catch{}n?.warn(`diagnostics-metrics/instance-metadata: \u5199\u5165\u5B9E\u4F8B\u5143\u6570\u636E\u5230 openclaw.json \u5931\u8D25: ${String(c)}`)}finally{await Ib(s)}}function yd(){let t;try{t=bo.networkInterfaces()}catch{return""}let e=[];for(let[i,r]of Object.entries(t))if(r)for(let s of r)s.family!=="IPv4"||s.internal||s.address.startsWith("169.254.")||e.push({iface:i,address:s.address});if(e.length===0)return"";let n=i=>i.startsWith("eth")?0:i.startsWith("en")?1:2;return e.sort((i,r)=>{let s=n(i.iface),a=n(r.iface);return s!==a?s-a:i.iface<r.iface?-1:i.iface>r.iface?1:0}),e[0].address}async function _o(t){let e=ct,n=!e.cvmInstanceId,i=!e.cvmInstanceName,[r,s]=await Promise.all([n?gd(yo("instance-id")):Promise.resolve({status:"skipped"}),i?gd(yo("instance-name")):Promise.resolve({status:"skipped"})]),a=e.hostName;try{a=bo.hostname()}catch{t?.warn("diagnostics-metrics/instance-metadata: \u83B7\u53D6 hostname \u5931\u8D25")}let o=yd(),c={},l={...e,hostName:a||e.hostName};r.status==="fulfilled"&&r.value?(l.cvmInstanceId=r.value,c.instanceId=r.value):r.status==="rejected"?t?.warn(`diagnostics-metrics/instance-metadata: \u83B7\u53D6 instance-id \u5931\u8D25: ${String(r.reason)}`):r.status==="fulfilled"&&t?.warn("diagnostics-metrics/instance-metadata: \u83B7\u53D6 instance-id \u5931\u8D25: empty response"),s.status==="fulfilled"&&s.value?(l.cvmInstanceName=s.value,c.instanceName=s.value):s.status==="rejected"?t?.warn(`diagnostics-metrics/instance-metadata: \u83B7\u53D6 instance-name \u5931\u8D25: ${String(s.reason)}`):s.status==="fulfilled"&&t?.warn("diagnostics-metrics/instance-metadata: \u83B7\u53D6 instance-name \u5931\u8D25: empty response"),o?l.cvmInstanceIntraIp=o:t?.warn("diagnostics-metrics/instance-metadata: \u83B7\u53D6\u672C\u5730\u975E\u73AF\u56DE IPv4 \u5730\u5740\u5931\u8D25: \u672A\u627E\u5230\u53EF\u7528\u7F51\u7EDC\u63A5\u53E3"),ct=Object.freeze(l);let u=!!l.cvmInstanceId&&!!l.cvmInstanceName;return t?.debug(`diagnostics-metrics/instance-metadata: \u5F53\u524D\u5B9E\u4F8B\u4FE1\u606F cvm_instance_id=${ct.cvmInstanceId}, cvm_instance_name=${ct.cvmInstanceName}, cvm_instance_intra_ip=${ct.cvmInstanceIntraIp}, host_name=${ct.hostName}`),{allSuccess:u,fetched:c}}function gd(t){return t.then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))}function _t(){return ct}function bd(t,e,n){if(!_i){e?.warn("diagnostics-metrics/instance-metadata: updateInstanceMetadata \u8C03\u7528\u65F6\u6A21\u5757\u5C1A\u672A\u521D\u59CB\u5316\uFF0C\u672C\u6B21\u70ED\u66F4\u65B0\u5DF2\u8DF3\u8FC7");return}let i=ct,r=t.instanceId!==void 0?t.instanceId:i.cvmInstanceId,s=t.instanceName!==void 0?t.instanceName:i.cvmInstanceName,a=t.localIpv4!==void 0?t.localIpv4:i.cvmInstanceIntraIp;if(r===i.cvmInstanceId&&s===i.cvmInstanceName&&a===i.cvmInstanceIntraIp)return;ct=Object.freeze({cvmInstanceId:r,cvmInstanceName:s,cvmInstanceIntraIp:a,hostName:i.hostName}),(!r||!s)&&(e?.debug("diagnostics-metrics/instance-metadata: \u70ED\u66F4\u65B0\u6E05\u7A7A\u4E86\u90E8\u5206\u5B57\u6BB5\uFF0C\u91CD\u65B0\u89E6\u53D1 metadata \u63A5\u53E3\u83B7\u53D6"),Ti=0,Ct&&(clearTimeout(Ct),Ct=null),_o(e).then(({allSuccess:c,fetched:l})=>{Ei||(n&&(l.instanceId||l.instanceName)&&wo(n,l,e),c||To(e,n))}))}async function Ur(t,e){if(Si++,!_i){Ei=!1,_i=!0;try{let n="";try{n=bo.hostname()}catch{}let i=e?await _b(e):{instanceId:"",instanceName:"",localIpv4:""},r=i.localIpv4||yd();r||t?.warn("diagnostics-metrics/instance-metadata: \u83B7\u53D6\u672C\u5730\u975E\u73AF\u56DE IPv4 \u5730\u5740\u5931\u8D25: \u672A\u627E\u5230\u53EF\u7528\u7F51\u7EDC\u63A5\u53E3");let s={cvmInstanceId:i.instanceId,cvmInstanceName:i.instanceName,cvmInstanceIntraIp:r,hostName:n};if(ct=Object.freeze(s),s.cvmInstanceId&&s.cvmInstanceName){t?.debug(`diagnostics-metrics/instance-metadata: \u5F53\u524D\u5B9E\u4F8B\u4FE1\u606F cvm_instance_id=${s.cvmInstanceId}, cvm_instance_name=${s.cvmInstanceName}, cvm_instance_intra_ip=${s.cvmInstanceIntraIp}, host_name=${s.hostName}`);return}let{allSuccess:a,fetched:o}=await _o(t);if(e&&(o.instanceId||o.instanceName)&&await wo(e,o,t),!a){t?.warn("diagnostics-metrics/instance-metadata: \u9996\u6B21\u83B7\u53D6\u5B58\u5728\u672A\u5C31\u7EEA\u5B57\u6BB5\uFF0C\u53EF\u80FD\u4E0D\u5728\u817E\u8BAF\u4E91\u73AF\u5883\uFF0C\u5C06\u5728 30 \u79D2\u540E\u91CD\u8BD5"),To(t,e);return}}catch(n){throw _i=!1,Si--,n}}}function To(t,e){if(Ti>=vo){t?.warn(`diagnostics-metrics/instance-metadata: \u5DF2\u91CD\u8BD5 ${vo} \u6B21\u4ECD\u672A\u6210\u529F\uFF0C\u505C\u6B62\u91CD\u8BD5`);return}Ct=setTimeout(async()=>{if(Ei)return;Ti++,t?.debug(`diagnostics-metrics/instance-metadata: \u7B2C ${Ti}/${vo} \u6B21\u91CD\u8BD5\u83B7\u53D6\u5143\u6570\u636E`);let{allSuccess:n,fetched:i}=await _o(t);if(!Ei&&(e&&(i.instanceId||i.instanceName)&&await wo(e,i,t),!n)){To(t,e);return}},bb),typeof Ct.unref=="function"&&Ct.unref()}function Ii(){Si!==0&&(Si--,!(Si>0)&&(Ei=!0,Ct&&(clearTimeout(Ct),Ct=null),Ti=0,_i=!1,ct=vd))}import{createCipheriv as Rb,createDecipheriv as kb,createHash as Ob,randomBytes as Cb}from"node:crypto";var Ri="ENC:",Nb="openclaw-diag-metrics-cls",wd="aes-256-cbc";function _d(){return Ob("sha256").update(Nb).digest()}function So(t){if(!t||t.startsWith(Ri))return t;let e=_d(),n=Cb(16),i=Rb(wd,e,n),r=Buffer.concat([i.update(t,"utf8"),i.final()]),s=Buffer.concat([n,r]).toString("base64");return`${Ri}${s}`}function De(t){if(!t||!t.startsWith(Ri))return t;try{let e=t.slice(Ri.length),n=Buffer.from(e,"base64");if(n.length<17)return console.error(`[crypto-utils] \u89E3\u5BC6\u5931\u8D25: \u5BC6\u6587\u6570\u636E\u4E0D\u5B8C\u6574 (\u957F\u5EA6=${n.length}), \u8BF7\u68C0\u67E5\u914D\u7F6E\u6587\u4EF6\u4E2D\u7684\u52A0\u5BC6\u5B57\u6BB5\u662F\u5426\u88AB\u7BE1\u6539\u6216\u622A\u65AD`),"";let i=n.subarray(0,16),r=n.subarray(16),s=_d(),a=kb(wd,s,i);return Buffer.concat([a.update(r),a.final()]).toString("utf8")}catch(e){let n=e instanceof Error?e.message:String(e);return console.error(`[crypto-utils] \u89E3\u5BC6\u5931\u8D25: ${n}, \u8BF7\u68C0\u67E5\u914D\u7F6E\u6587\u4EF6\u4E2D\u7684\u52A0\u5BC6\u5B57\u6BB5\u662F\u5426\u6B63\u786E`),""}}function Eo(t){return typeof t=="string"&&t.startsWith(Ri)}var An="clawpro-diagnostics-metrics-cls";import Sd from"node:path";import Io from"node:fs/promises";var Ab=300*1e3;function Ed(t){return t?/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t):!0}function Lb(t){let e=typeof t?.metricTopicId=="string"?t.metricTopicId.trim():"",n=typeof t?.endpoint=="string"?t.endpoint.trim():"",i=typeof t?.credentialMode=="string"&&t.credentialMode.trim()==="cvmRole"?"cvmRole":"static",r=typeof t?.roleName=="string"&&t.roleName.trim()?t.roleName.trim():"",s=typeof t?.secretId=="string"?De(t.secretId.trim()):"",a=typeof t?.secretKey=="string"?De(t.secretKey.trim()):"",o=typeof t?.token=="string"?t.token.trim():void 0;if(e&&!Ed(e)&&(e=""),i==="static"&&(!s||!a)||i==="cvmRole"&&!r)return null;let c=typeof t?.credentialRefreshIntervalMs=="number"&&t.credentialRefreshIntervalMs>=6e4?t.credentialRefreshIntervalMs:Ab,l=t?.enableReport!==!1;return{metricTopicId:e,credentialMode:i,roleName:r,secretId:s,secretKey:a,token:o,endpoint:n,credentialRefreshIntervalMs:c,enableReport:l}}var Pb=1e4;async function Mb(t){try{let e=await Io.readFile(t,"utf8"),a=JSON.parse(e).plugins?.entries?.[An]?.config,o=a?.cls,c=typeof o?.metricTopicId=="string"?o.metricTopicId.trim():"",l=typeof o?.endpoint=="string"?o.endpoint.trim():"",u=o?.enableReport!==!1,f=typeof o?.secretId=="string"?De(o.secretId.trim()):"",x=typeof o?.secretKey=="string"?De(o.secretKey.trim()):"",S=c;c&&!Ed(c)&&(S=void 0);let b=a?.instance_metadata,w=J=>typeof J!="string"?null:J.trim(),g=b?w(b.instance_id):null,C=b?w(b.instance_name):null,z=b?w(b.local_ipv4):null,q=g??"",N=C??"",I=z??"",H=a?.log,G=H?.enableLogReport===!0,L=typeof H?.logTopicId=="string"?H.logTopicId.trim():"";return{metricTopicId:S,endpoint:l,enableReport:u,secretId:f,secretKey:x,instanceId:q,instanceName:N,localIpv4:I,enableLogReport:G,logTopicId:L}}catch{return null}}function Td(t,e){return!t||!e?"":`https://${t}/prometheus/${e}/api/v1/write`}function Id(t){return t instanceof Error?t.stack??t.message:typeof t=="string"?t:String(t)}async function jb(t){let e=Sd.join(t.stateDir,"openclaw.json"),n;try{n=await Io.readFile(e,"utf8")}catch{return}let i;try{i=JSON.parse(n)}catch{return}let r=!1,s=i.diagnostics;s?.enabled!==!0&&(i.diagnostics={...s??{},enabled:!0},r=!0,t.logger.debug?.("diagnostics-metrics/prometheus: \u5DF2\u81EA\u52A8\u5199\u5165 diagnostics.enabled=true \u5230 openclaw.json\uFF0C\u91CD\u542F\u540E\u751F\u6548"));let u=i.plugins?.entries?.[An]?.config?.cls;if(u){let f=u.secretId,x=u.secretKey;typeof f=="string"&&f.trim()&&!Eo(f.trim())&&(u.secretId=So(f.trim()),r=!0,t.logger.debug?.("diagnostics-metrics/prometheus: \u5DF2\u5C06 secretId \u52A0\u5BC6\u540E\u5199\u5165\u914D\u7F6E\u6587\u4EF6")),typeof x=="string"&&x.trim()&&!Eo(x.trim())&&(u.secretKey=So(x.trim()),r=!0,t.logger.debug?.("diagnostics-metrics/prometheus: \u5DF2\u5C06 secretKey \u52A0\u5BC6\u540E\u5199\u5165\u914D\u7F6E\u6587\u4EF6"))}r&&await Io.writeFile(e,JSON.stringify(i,null,2)+`
25
- `,"utf8")}function Rd(t,e,n){let i=Lb(t),r=null,s=null,a=[],o=null,c=null,l=null,u=null,f="",x="",S=!0,b="",w="",g="",C="",z="",q=!1,N="";return{id:"clawpro-diagnostics-metrics-cls",getExports(){return c},async start(I){let H={debug:I.logger.debug??(()=>{}),info:I.logger.info.bind(I.logger),warn:I.logger.warn.bind(I.logger),error:I.logger.error.bind(I.logger)},G=t;if(G?.enabled===!1)return;let L=G?.metric_prefix??"openclaw",J={...G?.external_labels??{}};await Ur(H,I.stateDir).catch(P=>{let te=P instanceof Error?P.message:String(P);I.logger.warn(`diagnostics-metrics/prometheus: \u5B9E\u4F8B\u5143\u6570\u636E\u5B9A\u65F6\u5237\u65B0\u542F\u52A8\u5931\u8D25 (${te})\uFF0C\u5C06\u4F7F\u7528 unknown \u4F5C\u4E3A\u9ED8\u8BA4\u503C`)}),await jb(I).catch(()=>{I.logger.warn('diagnostics-metrics/prometheus: \u65E0\u6CD5\u81EA\u52A8\u5199\u5165 diagnostics.enabled\uFF0C\u8BF7\u624B\u52A8\u5728 openclaw.json \u4E2D\u6DFB\u52A0 { "diagnostics": { "enabled": true } }')}),r=new de.Registry,G?.default_metrics!==!1&&(0,de.collectDefaultMetrics)({register:r,prefix:`${L}_node_`});let Z=new de.Counter({name:`${L}_tokens_total`,help:"Total tokens consumed",labelNames:["openclaw_type","openclaw_provider","openclaw_model","openclaw_channel"],registers:[r]}),O=new de.Counter({name:`${L}_cost_usd_total`,help:"Estimated model cost in USD",labelNames:["openclaw_provider","openclaw_model","openclaw_channel"],registers:[r]}),me=new de.Histogram({name:`${L}_run_duration_ms`,help:"Agent run duration in milliseconds",labelNames:["openclaw_provider","openclaw_model","openclaw_channel"],buckets:[100,250,500,1e3,2500,5e3,1e4,3e4,6e4],registers:[r]}),R=new de.Histogram({name:`${L}_context_tokens`,help:"Context window token count",labelNames:["openclaw_provider","openclaw_model","openclaw_channel","openclaw_type"],buckets:[1e3,4e3,8e3,16e3,32e3,64e3,128e3,2e5],registers:[r]}),p=new de.Counter({name:`${L}_webhook_received_total`,help:"Webhook requests received",labelNames:["openclaw_channel","openclaw_update_type"],registers:[r]}),j=new de.Counter({name:`${L}_webhook_error_total`,help:"Webhook processing errors",labelNames:["openclaw_channel","openclaw_update_type"],registers:[r]}),E=new de.Histogram({name:`${L}_webhook_duration_ms`,help:"Webhook processing duration in milliseconds",labelNames:["openclaw_channel","openclaw_update_type"],buckets:[10,50,100,250,500,1e3,2500,5e3],registers:[r]}),re=new de.Counter({name:`${L}_message_queued_total`,help:"Messages queued for processing",labelNames:["openclaw_channel","openclaw_source"],registers:[r]}),K=new de.Counter({name:`${L}_message_processed_total`,help:"Messages processed by outcome",labelNames:["openclaw_channel","openclaw_outcome"],registers:[r]}),ee=new de.Histogram({name:`${L}_message_duration_ms`,help:"Message processing duration in milliseconds",labelNames:["openclaw_channel","openclaw_outcome"],buckets:[100,500,1e3,2500,5e3,1e4,3e4,6e4],registers:[r]}),he=new de.Gauge({name:`${L}_queue_depth`,help:"Current queue depth per lane",labelNames:["openclaw_lane"],registers:[r]}),U=new de.Histogram({name:`${L}_queue_wait_ms`,help:"Queue wait time before execution in milliseconds",labelNames:["openclaw_lane"],buckets:[10,50,100,500,1e3,5e3,1e4],registers:[r]}),M=new de.Counter({name:`${L}_queue_lane_enqueue_total`,help:"Queue lane enqueue events",labelNames:["openclaw_lane"],registers:[r]}),V=new de.Counter({name:`${L}_queue_lane_dequeue_total`,help:"Queue lane dequeue events",labelNames:["openclaw_lane"],registers:[r]}),ie=new de.Counter({name:`${L}_session_state_total`,help:"Session state transitions",labelNames:["openclaw_state","openclaw_reason"],registers:[r]}),X=new de.Counter({name:`${L}_session_stuck_total`,help:"Sessions detected as stuck",labelNames:["openclaw_state"],registers:[r]}),ce=new de.Histogram({name:`${L}_session_stuck_age_ms`,help:"Age of stuck sessions in milliseconds",labelNames:["openclaw_state"],buckets:[1e3,5e3,1e4,3e4,6e4,12e4,3e5],registers:[r]}),ke=new de.Counter({name:`${L}_run_attempt_total`,help:"Agent run attempts",labelNames:["openclaw_attempt"],registers:[r]}),ge=new de.Gauge({name:`${L}_active_sessions`,help:"Number of currently active sessions",registers:[r]}),ht=new de.Gauge({name:`${L}_waiting_sessions`,help:"Number of sessions in waiting state",registers:[r]}),It=new de.Gauge({name:`${L}_queued_messages`,help:"Total messages currently queued",registers:[r]}),_e=new de.Counter({name:`${L}_tool_loop_total`,help:"Tool loop detections",labelNames:["openclaw_tool","openclaw_detector","openclaw_level","openclaw_action"],registers:[r]}),Lt=P=>{try{switch(P.type){case"model.usage":{let te={openclaw_provider:P.provider??"unknown",openclaw_model:P.model??"unknown",openclaw_channel:P.channel??"unknown"},xe=P.usage;if(!xe)break;xe.input&&Z.inc({...te,openclaw_type:"input"},xe.input),xe.output&&Z.inc({...te,openclaw_type:"output"},xe.output),xe.cacheRead&&Z.inc({...te,openclaw_type:"cache_read"},xe.cacheRead),xe.cacheWrite&&Z.inc({...te,openclaw_type:"cache_write"},xe.cacheWrite),xe.promptTokens&&Z.inc({...te,openclaw_type:"prompt"},xe.promptTokens),xe.total&&Z.inc({...te,openclaw_type:"total"},xe.total),P.costUsd&&O.inc({openclaw_provider:te.openclaw_provider,openclaw_model:te.openclaw_model,openclaw_channel:te.openclaw_channel},P.costUsd),P.durationMs&&me.observe({openclaw_provider:te.openclaw_provider,openclaw_model:te.openclaw_model,openclaw_channel:te.openclaw_channel},P.durationMs),P.context?.limit&&R.observe({openclaw_provider:te.openclaw_provider,openclaw_model:te.openclaw_model,openclaw_channel:te.openclaw_channel,openclaw_type:"limit"},P.context.limit),P.context?.used&&R.observe({openclaw_provider:te.openclaw_provider,openclaw_model:te.openclaw_model,openclaw_channel:te.openclaw_channel,openclaw_type:"used"},P.context.used);break}case"webhook.received":{p.inc({openclaw_channel:P.channel??"unknown",openclaw_update_type:P.updateType??"unknown"});break}case"webhook.processed":{typeof P.durationMs=="number"&&E.observe({openclaw_channel:P.channel??"unknown",openclaw_update_type:P.updateType??"unknown"},P.durationMs);break}case"webhook.error":{j.inc({openclaw_channel:P.channel??"unknown",openclaw_update_type:P.updateType??"unknown"});break}case"message.queued":{re.inc({openclaw_channel:P.channel??"unknown",openclaw_source:P.source??"unknown"});break}case"message.processed":{K.inc({openclaw_channel:P.channel??"unknown",openclaw_outcome:P.outcome??"unknown"}),typeof P.durationMs=="number"&&ee.observe({openclaw_channel:P.channel??"unknown",openclaw_outcome:P.outcome??"unknown"},P.durationMs);break}case"queue.lane.enqueue":{M.inc({openclaw_lane:P.lane}),he.set({openclaw_lane:P.lane},P.queueSize??0);break}case"queue.lane.dequeue":{V.inc({openclaw_lane:P.lane}),he.set({openclaw_lane:P.lane},P.queueSize??0),typeof P.waitMs=="number"&&U.observe({openclaw_lane:P.lane},P.waitMs);break}case"session.state":{ie.inc({openclaw_state:P.state,openclaw_reason:P.reason??""});break}case"session.stuck":{X.inc({openclaw_state:P.state}),typeof P.ageMs=="number"&&ce.observe({openclaw_state:P.state},P.ageMs);break}case"run.attempt":{ke.inc({openclaw_attempt:String(P.attempt)});break}case"diagnostic.heartbeat":{ge.set(P.active??0),ht.set(P.waiting??0),It.set(P.queued??0);break}case"tool.loop":{_e.inc({openclaw_tool:P.toolName,openclaw_detector:P.detector,openclaw_level:P.level,openclaw_action:P.action});break}}}catch(te){I.logger.error(`diagnostics-metrics/prometheus: event handler failed (${P.type}): ${Id(te)}`)}},Zi="openclaw/plugin-sdk/diagnostics-otel",Qi="openclaw/plugin-sdk/diagnostic-runtime",Vt;try{Vt=(await import(Zi)).onDiagnosticEvent}catch{}if(!Vt)try{Vt=(await import(Qi)).onDiagnosticEvent}catch{}Vt?s=Vt(Lt):I.logger.warn("diagnostics-metrics/prometheus: onDiagnosticEvent \u5728\u5F53\u524D openclaw \u7248\u672C\u4E2D\u4E0D\u53EF\u7528\uFF0C\u6307\u6807\u91C7\u96C6\u5DF2\u8DF3\u8FC7");let er=i?.metricTopicId??"",Wt=i?.endpoint??"";f=er,x=Wt,S=i?.enableReport??!0,b=i?.secretId??"",w=i?.secretKey??"",g=_t().cvmInstanceId,C=_t().cvmInstanceName,z=_t().cvmInstanceIntraIp;let Jt=G?.remote_write??[],Xt=i?.credentialMode??"static",el=i?.roleName||"",Ce=Sd.join(I.stateDir,"openclaw.json"),at=async()=>e?(I.logger.warn("diagnostics-metrics/prometheus: \u6536\u5230 401\uFF0C\u901A\u8FC7\u5171\u4EAB\u51ED\u8BC1\u7BA1\u7406\u5668\u68C0\u67E5\u5E76\u5237\u65B0\u4E34\u65F6\u5BC6\u94A5"),await e.forceRefresh()):Xt==="cvmRole"?(I.logger.warn("diagnostics-metrics/prometheus: \u6536\u5230 401\uFF0C\u4F46\u5171\u4EAB\u51ED\u8BC1\u7BA1\u7406\u5668\u4E0D\u53EF\u7528"),!1):(I.logger.warn("diagnostics-metrics/prometheus: \u6536\u5230 401\uFF0C\u5F53\u524D\u4E3A static \u51ED\u8BC1\u6A21\u5F0F\uFF0C\u8BF7\u68C0\u67E5 secretId/secretKey \u662F\u5426\u6B63\u786E"),!1),Pt=Td(x,f),tr=Jt.some(P=>!P.url),nr=Jt.some(P=>P.url);if(Pt&&tr&&!nr){let P=Jt.find(te=>!te.url);P&&(a=[new sn({...P,url:Pt},H,at)])}else Pt&&Jt.length===0?a=[new sn({url:Pt},H,at)]:a=Jt.filter(P=>P.url).map(P=>new sn(P,H,at));let Mt=G?.push_interval_ms??3e4;if(a.length>0&&S?(o=setInterval(()=>{Fr(r,a,J,H)},Mt),typeof o.unref=="function"&&o.unref(),I.logger.debug?.(`diagnostics-metrics/prometheus: remote write enabled for ${a.length} target(s), push interval ${Mt}ms`)):a.length>0&&!S&&I.logger.debug?.("diagnostics-metrics/prometheus: remote write clients created but pushTimer not started (enableReport=false)"),Xt==="static"&&i&&a.length>0&&!e){let P=i.secretKey;i.token!==void 0&&i.token!==""&&(P=P+"#"+i.token);let te={username:i.secretId,password:P};for(let xe of a)xe.updateConfig({basic_auth:te});I.logger.debug?.("diagnostics-metrics/prometheus: static \u51ED\u8BC1\u6A21\u5F0F\uFF08\u65E0\u5171\u4EAB\u7BA1\u7406\u5668\uFF09\uFF0C\u5DF2\u8BBE\u7F6E basic_auth")}let jt=P=>{let te=P.secretKey;P.token!==void 0&&P.token!==""&&(te=te+"#"+P.token);let xe={username:P.secretId,password:te};for(let xn of a)xn.updateConfig({basic_auth:xe});a.length>0&&!o&&S&&(o=setInterval(()=>{Fr(r,a,J,H)},Mt),typeof o.unref=="function"&&o.unref(),I.logger.debug?.("diagnostics-metrics/prometheus: \u51ED\u8BC1\u66F4\u65B0\u6210\u529F\uFF0C\u5DF2\u6062\u590D remote write \u63A8\u9001"))};if(e&&a.length>0){let P=e.getCredentialSnapshot();P.secretId&&P.secretKey&&jt(P),u=e.subscribe(te=>{jt(te),I.logger.debug?.("diagnostics-metrics/prometheus: \u5171\u4EAB\u51ED\u8BC1\u5DF2\u66F4\u65B0\uFF0C\u5DF2\u540C\u6B65\u5230 RemoteWriteClient")}),I.logger.debug?.("diagnostics-metrics/prometheus: \u5DF2\u8BA2\u9605\u5171\u4EAB\u51ED\u8BC1\u7BA1\u7406\u5668\u7684\u51ED\u8BC1\u53D8\u66F4\u4E8B\u4EF6")}let gn=!1;l=setInterval(()=>{(async()=>{if(!gn){gn=!0;try{let P=await Mb(Ce);if(!P)return;let te=P.metricTopicId??er,xe=P.endpoint??Wt,xn=P.enableReport,Zn=P.secretId,Qn=P.secretKey,ei=P.instanceId,ti=P.instanceName,d=P.localIpv4,h=te!==f,T=xe!==x,y=_t();!g&&y.cvmInstanceId&&(g=y.cvmInstanceId),!C&&y.cvmInstanceName&&(C=y.cvmInstanceName),!z&&y.cvmInstanceIntraIp&&(z=y.cvmInstanceIntraIp);let m=ei!==g||ti!==C||d!==z,_=xn!==S,A=Xt==="static"&&Zn&&Qn&&(Zn!==b||Qn!==w);if(m&&(g=ei,C=ti,z=d,bd({instanceId:ei,instanceName:ti,localIpv4:d},H,I.stateDir),I.logger.debug?.(`diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0Cinstance_metadata \u5DF2\u66F4\u65B0 (instance_id=${g}, instance_name=${C}, local_ipv4=${z})`)),A){if(b=Zn,w=Qn,e&&Xt==="static")e.updateStaticCredential(b,w);else if(a.length>0){let B=w;i?.token!==void 0&&i.token!==""&&(B=B+"#"+i.token);let ne={username:b,password:B};for(let ue of a)ue.updateConfig({basic_auth:ne})}I.logger.debug?.("diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0Cstatic \u6A21\u5F0F\u5BC6\u94A5\u5DF2\u66F4\u65B0")}if(_&&(S=xn,S?(a.length>0&&!o&&(o=setInterval(()=>{Fr(r,a,J,H)},Mt),typeof o.unref=="function"&&o.unref()),I.logger.debug?.("diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0CenableReport=true\uFF0C\u5DF2\u6062\u590D remote write \u63A8\u9001")):(o&&(clearInterval(o),o=null),I.logger.debug?.("diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0CenableReport=false\uFF0C\u5DF2\u6682\u505C remote write \u63A8\u9001"))),n){let B=P.enableLogReport,ne=P.logTopicId;(B!==q||ne!==N)&&(q=B,N=ne,n(B,ne),I.logger.debug?.(`diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0Clog \u914D\u7F6E\u5DF2\u53D8\u66F4\uFF08enableLogReport=${B}\uFF0ClogTopicId=${ne||"(\u7A7A)"}\uFF09`))}if(!h&&!T)return;f=te,x=xe;let F=Td(x,f);if(!F){if(a.length>0){I.logger.debug?.("diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0Cendpoint \u6216 metricTopicId \u4E3A\u7A7A\uFF0Cremote write \u5DF2\u6682\u505C");for(let B of a)B.stop().catch(()=>{});a=[],o&&(clearInterval(o),o=null)}return}if(a.length>0){for(let B of a)B.updateConfig({url:F});I.logger.debug?.(`diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0C\u5DF2\u66F4\u65B0 RemoteWriteClient url=${F}`)}else{let B=new sn({url:F},H,at);if(a=[B],e){let ne=e.getCredentialSnapshot();ne.secretId&&ne.secretKey&&jt(ne)}else Xt==="static"&&b&&w&&B.updateConfig({basic_auth:{username:b,password:w}});e&&!u&&(u=e.subscribe(ne=>{jt(ne),I.logger.debug?.("diagnostics-metrics/prometheus: \u5171\u4EAB\u51ED\u8BC1\u5DF2\u66F4\u65B0\uFF0C\u5DF2\u540C\u6B65\u5230 RemoteWriteClient")})),S&&!o&&(o=setInterval(()=>{Fr(r,a,J,H)},Mt),typeof o.unref=="function"&&o.unref()),I.logger.debug?.(`diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0C\u52A8\u6001\u521B\u5EFA RemoteWriteClient url=${F}`)}}finally{gn=!1}}})()},Pb),l&&typeof l.unref=="function"&&l.unref(),c=G?.pull!==!1?{registry:r}:null,I.logger.debug?.(`diagnostics-metrics/prometheus: started (pull=${G?.pull!==!1}, remote_write=${a.length} targets, metricTopicId=${f||"(\u5F85\u914D\u7F6E\u6587\u4EF6\u6CE8\u5165)"}, endpoint=${x||"(\u5F85\u914D\u7F6E\u6587\u4EF6\u6CE8\u5165)"})`)},async stop(){s?.(),s=null,l&&(clearInterval(l),l=null),u&&(u(),u=null),o&&(clearInterval(o),o=null);for(let I of a)await I.stop().catch(()=>{});a=[],Ii(),r&&(r.clear(),r=null),c=null,f="",x="",S=!0,b="",w="",g="",C="",z=""}}}async function Fr(t,e,n,i){if(e.length!==0)try{let r=_t(),s={...n};s.cvm_instance_id||(s.cvm_instance_id=r.cvmInstanceId),s.cvm_instance_name||(s.cvm_instance_name=r.cvmInstanceName),s.cvm_instance_intra_ip||(s.cvm_instance_intra_ip=r.cvmInstanceIntraIp),s.host_name||(s.host_name=r.hostName);let a=await t.getMetricsAsJSON(),o=Date.now(),c=[];for(let l of a){let u=l.values;for(let f of u){let S=[{name:"__name__",value:f.metricName??l.name}];for(let[b,w]of Object.entries(s))S.push({name:b,value:w});if(f.labels)for(let[b,w]of Object.entries(f.labels))S.push({name:b,value:String(w)});S.sort((b,w)=>b.name.localeCompare(w.name)),c.push({labels:S,samples:[{value:f.value??0,timestampMs:o}]})}}if(c.length===0)return;for(let l of e)l.enqueue(c)}catch(r){i.error(`diagnostics-metrics/prometheus: failed to collect metrics for push: ${Id(r)}`)}}var Xi=ii(ys(),1);import{hostname as px}from"node:os";import{basename as ES,join as IS}from"node:path";var D="[diagnostics-metrics-cls/trace]",hn=32e5,Vi=4096,zc=20,Gg=3e3,Gc=1200*1e3,Hg=600*1e3,Kg=1e4,Vg=An,Wg="__temp_run_",Jg=15e3,Xg=1e4,Hc=300*1e3,Yg=5e3;import{randomBytes as mS}from"crypto";function Ue(t=16){let e=Math.ceil(t/2);return mS(e).toString("hex").slice(0,t)}function ft(t){return t.length>hn?t.substring(0,hn):t}function Qg(t){let e=JSON.stringify(t);if(e.length<=hn)return e;let n=Vc(t),i=hS(n.length),r=64;for(let a=0;a<20;a++){let o=JSON.stringify(n);if(o.length<=hn)return o;let c=!1;for(let l of i){let u=n[l];if(u&&gS(u,r)){c=!0;break}}if(!c)break}let s=xS(n);return JSON.stringify(s)}function hS(t){let e=[];if(t<=0)return e;let n=Math.floor(t/2);e.push(n);for(let i=1;i<=t;i++){let r=n-i,s=n+i;s<t&&e.push(s),r>=0&&e.push(r)}return e}function gS(t,e){let n=null,i=(o,c)=>{typeof o=="string"&&(o.length<=e||(!n||o.length>n.value.length)&&(n={set:c,value:o}))};if(i(t.content,o=>{t.content=o}),Array.isArray(t.tool_calls))for(let o of t.tool_calls)!o||typeof o!="object"||i(o.arguments,c=>{o.arguments=c});if(!n)return!1;let r=n,s=r.value,a=Math.max(e,Math.floor(s.length/2));return a>=s.length?!1:(r.set(s.slice(0,a)+`... [truncated, total ${s.length} chars]`),!0)}function xS(t){if(t.length<=2)return t.map(a=>Zg(a,2048));let e=t[0],n=Math.min(5,t.length-1),i=null;for(;n>=1;){let a=t.slice(t.length-n),o=t.length-1-n,c=t.slice(1,t.length-n).reduce((x,S)=>x+JSON.stringify(S).length,0),l={role:"system",content:`[...omitted ${o} messages, total ${c} chars]`},u=[e,l,...a];if(JSON.stringify(u).length<=hn)return u;i=u,n--}let r=i??[e,t[t.length-1]],s=Math.max(1024,Math.floor((hn-256)/Math.max(1,r.length)));return r.map(a=>Zg(a,s))}function Zg(t,e){let n={...t};return typeof n.content=="string"&&n.content.length>e&&(n.content=n.content.slice(0,e)+`... [truncated, total ${n.content.length} chars]`),Array.isArray(n.tool_calls)&&(n.tool_calls=n.tool_calls.map(i=>{if(!i||typeof i!="object")return i;let r={...i};return typeof r.arguments=="string"&&r.arguments.length>e&&(r.arguments=r.arguments.slice(0,e)+`... [truncated, total ${r.arguments.length} chars]`),r})),n}function Kc(t,e=Vi){return t?t.length<=e?t:t.slice(0,e)+`... [truncated, total ${t.length} chars]`:""}function Vc(t){return typeof globalThis.structuredClone=="function"?globalThis.structuredClone(t):Vn(t)}function Vn(t,e=new WeakMap){if(t===null||typeof t!="object")return t;let n=t;if(e.has(n))return e.get(n);if(n instanceof Date)return new Date(n.getTime());if(n instanceof RegExp)return new RegExp(n.source,n.flags);if(n instanceof Map){let r=new Map;e.set(n,r);for(let[s,a]of n)r.set(Vn(s,e),Vn(a,e));return r}if(n instanceof Set){let r=new Set;e.set(n,r);for(let s of n)r.add(Vn(s,e));return r}if(Array.isArray(n)){let r=[];e.set(n,r);for(let s=0;s<n.length;s++)r[s]=Vn(n[s],e);return r}let i={};e.set(n,i);for(let r of Object.keys(n))i[r]=Vn(n[r],e);return i}function ex(t){return t==null?[]:typeof t=="string"?[{type:"text",content:t}]:Array.isArray(t)?t.map(e=>{if(typeof e=="string")return{type:"text",content:e};if(typeof e=="object"&&e!==null){let n=e;if(n.type==="toolCall"||n.type==="tool_call"||n.type==="function_call")return{type:"tool_call",id:n.id||n.toolCallId||null,name:n.name||n.toolName||"",arguments:n.arguments||n.input||n.params||null};if(n.type==="toolResult"||n.type==="tool_result"||n.type==="tool_call_response"){let i=n.response??n.result??n.content??"";return{type:"tool_call_response",id:n.id||n.toolCallId||null,response:typeof i=="string"?i:JSON.stringify(i)}}return n.type==="text"?{type:"text",content:String(n.content??n.text??"")}:n.type==="thinking"||n.type==="reasoning"?{type:"reasoning",content:String(n.content??n.thinking??"")}:n.type?n:{type:"text",content:JSON.stringify(e)}}return{type:"text",content:String(e)}}):[{type:"text",content:JSON.stringify(t)}]}function tx(t){return ft(JSON.stringify([{type:"text",content:t}]))}var vS={toolResult:"tool",tool_result:"tool",function:"tool"};function Wc(t,e){let n=[];for(let i of t){let r=vS[i.role]||i.role;n.push({role:r,parts:ex(i.content)})}return e&&n.push({role:"user",parts:[{type:"text",content:e}]}),ft(JSON.stringify(n))}function Wn(t,e="stop"){return ft(JSON.stringify(t.map(n=>({role:"assistant",parts:[{type:"text",content:n}],finish_reason:e}))))}function nx(t,e=[],n="stop"){let i=ex(t);return i.length>0?ft(JSON.stringify([{role:"assistant",parts:i,finish_reason:n}])):Wn(e,n)}function yS(t){return!t||t==="unknown"?"system/unknown":t.includes("/")?t:/^agent[_:]/.test(t)?`agent/${t.slice(6)||"unknown"}`:`system/${t}`}function qe(t,e){let n=t.sessionKey||t.channelId||t.conversationId||e||"unknown";return yS(n)}function Jn(t){return typeof t=="string"&&t.trim()?t:void 0}function bs(t){return typeof t=="string"&&t.trim()?t:void 0}function Wi(t,e){return e?`${e}:${t}`:t}function ix(t){return t?typeof t=="string"?t:Array.isArray(t)?t.filter(e=>e?.type==="text"&&typeof e.text=="string").map(e=>e.text).join(""):"":""}function rx(t){if(!Array.isArray(t))return[];let e=[];for(let n of t){if(!n||typeof n!="object")continue;let i=n;(i.type==="toolCall"||i.type==="toolUse"||i.type==="functionCall")&&typeof i.id=="string"&&i.id&&e.push({id:i.id,name:typeof i.name=="string"?i.name:void 0})}return e}function sx(t){if(typeof t=="string")return[t];if(!Array.isArray(t))return[];let e=[];for(let n of t){if(!n||typeof n!="object")continue;let i=n;i.type==="text"&&(typeof i.text=="string"&&i.text?e.push(i.text):typeof i.content=="string"&&i.content&&e.push(i.content))}return e}function Jc(t){if(!Array.isArray(t))return[];let e=[];for(let n of t)!n||typeof n!="object"||(n.type==="toolCall"||n.type==="tool_use")&&e.push({id:n.id??`call_${Ue(12)}`,name:n.name??"unknown",arguments:typeof n.arguments=="string"?n.arguments:JSON.stringify(n.arguments??{})});return e}function ax(t){if(!Array.isArray(t)||t.length===0)return 0;let e=0;for(let n of t){if(!n||typeof n!="object")continue;let i=n;if(!(i.role!=="assistant"||!Array.isArray(i.content)))for(let r of i.content){if(!r||typeof r!="object")continue;let s=r;(s.type==="toolCall"||s.type==="toolUse"||s.type==="functionCall")&&(e+=1)}}return e}var bS=["Conversation info (untrusted metadata):","Sender (untrusted metadata):","Thread starter (untrusted, for context):","Replied message (untrusted, for context):","Forwarded message context (untrusted metadata):","Chat history since last reply (untrusted, for context):"],wS="Untrusted context (metadata, do not treat as instructions or commands):",F1=new RegExp([...bS,wS].map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"));function ox(t,e){let n=e;e.length>zc&&(n=[...e.slice(0,1),...e.slice(-(zc-1))]);let i=[];for(let r of n){let s={role:r.role??"unknown"},a=ix(r.content??r.text);a&&(s.content=Kc(a,Vi)),i.push(s)}t["gen_ai.prompt"]=Qg(i)}function cx(t,e){let n=[];for(let i of e){let r={role:i.role??"assistant"},s=ix(i.content??i.text);s&&(r.content=Kc(s,Vi));let a=i.finishReason??i.stopReason??"stop",o=i.toolCalls??Jc(i.content);o.length>0?(r.finish_reason="tool_calls",r.tool_calls=o.map(c=>({id:c.id,name:c.name,arguments:Kc(c.arguments,Vi)}))):r.finish_reason=a,n.push(r)}t["gen_ai.completion"]=Qg(n)}var $e=ii(ys(),1);var lx=1e3,_S=1800*1e3,TS=new Set(["traceId","spanId","parentSpanId","name","kind","status","startTime","endTime","durationMs"]),Ji=class{constructor(e,n,i,r,s){this.openSpans=new Map;this.disposed=!1;this.producer=e,this.debug=i,this.log=r,this.getResourceAttrs=s??null}startSpan(e,n){if(!this.disposed){if(this.openSpans.size>=lx&&(this.sweepStaleOpenSpans(),this.openSpans.size>=lx)){let i=this.openSpans.keys().next().value;i&&(this.log.warn(`${D} openSpans size (${this.openSpans.size}) exceeded limit, evicting oldest span: ${i}`),this.openSpans.delete(i))}this.openSpans.set(n,{name:e.name,type:e.type,startTime:e.startTime,attributes:{...e.attributes},traceId:e.traceId,spanId:e.spanId,parentSpanId:e.parentSpanId}),this.debug&&this.log.info(`${D} Started long-lived span: name=${e.name}, spanId=${n}, traceId=${e.traceId}`)}}endSpanById(e,n,i){if(this.disposed)return;let r=this.openSpans.get(e);if(!r)return;if(i)for(let[a,o]of Object.entries(i))o!=null&&(r.attributes[a]=o);let s=n??Date.now();this.sendRecord({...r.attributes,traceId:r.traceId,spanId:r.spanId,parentSpanId:r.parentSpanId||"",name:r.name,kind:r.attributes["gen_ai.span.kind"]??this.mapSpanKind(r.type),status:"OK",startTime:new Date(r.startTime).toISOString(),endTime:new Date(s).toISOString(),durationMs:String(s-r.startTime)}),this.openSpans.delete(e),this.debug&&this.log.info(`${D} Ended long-lived span: spanId=${e}, duration=${s-r.startTime}ms`)}patchOpenSpanAttributes(e,n){if(this.disposed)return;let i=this.openSpans.get(e);if(i)for(let[r,s]of Object.entries(n))s!=null&&(i.attributes[r]=s)}export(e){if(this.disposed)return;let n=e.startTime||Date.now(),i=e.endTime||Date.now(),r=e.attributes.error===!0||!!e.attributes["error.type"];this.sendRecord({...e.attributes,traceId:e.traceId,spanId:e.spanId,parentSpanId:e.parentSpanId||"",name:e.name,kind:e.attributes["gen_ai.span.kind"]??this.mapSpanKind(e.type),status:r?"ERROR":"OK",startTime:new Date(n).toISOString(),endTime:new Date(i).toISOString(),durationMs:String(i-n)})}async flush(){if(!this.disposed)try{typeof this.producer.flush=="function"?await this.producer.flush():typeof this.producer.batchSend=="function"&&await this.producer.batchSend()}catch{}}get isDisposed(){return this.disposed}async dispose(){this.disposed=!0;let e=Date.now();for(let[,n]of this.openSpans)try{let i=e;this.sendRecordCore({...n.attributes,"openclaw.force_closed":!0,"openclaw.force_closed.reason":"dispose",traceId:n.traceId,spanId:n.spanId,parentSpanId:n.parentSpanId||"",name:n.name,kind:n.attributes["gen_ai.span.kind"]??this.mapSpanKind(n.type),status:"UNSET",startTime:new Date(n.startTime).toISOString(),endTime:new Date(i).toISOString(),durationMs:String(i-n.startTime)})}catch{}try{typeof this.producer.flush=="function"?await this.producer.flush():typeof this.producer.batchSend=="function"&&await this.producer.batchSend()}catch{}this.openSpans.clear()}sweepStaleOpenSpans(){let e=Date.now(),n=[];for(let[i,r]of this.openSpans)e-r.startTime>_S&&n.push(i);for(let i of n){let r=this.openSpans.get(i);if(r){try{this.sendRecord({...r.attributes,"openclaw.force_closed":!0,"openclaw.force_closed.reason":"stale_sweep",traceId:r.traceId,spanId:r.spanId,parentSpanId:r.parentSpanId||"",name:r.name,kind:r.attributes["gen_ai.span.kind"]??this.mapSpanKind(r.type),status:"UNSET",startTime:new Date(r.startTime).toISOString(),endTime:new Date(e).toISOString(),durationMs:String(e-r.startTime)})}catch{}this.debug&&this.log.info(`${D} Evicted stale open span (force-sent): spanId=${i}, name=${r.name}, age=${e-r.startTime}ms`)}this.openSpans.delete(i)}}updateProducer(e,n){let i=this.producer;this.producer=e;let r=5e3,s=async()=>{try{typeof i.flush=="function"?await i.flush():typeof i.batchSend=="function"&&await i.batchSend(),typeof i.close=="function"?await i.close():typeof i.shutdown=="function"?await i.shutdown():typeof i.destroy=="function"&&await i.destroy()}catch{}},a,o=new Promise(c=>{a=setTimeout(c,r)});Promise.race([s(),o]).finally(()=>{a!==void 0&&clearTimeout(a)}).catch(()=>{})}sendRecord(e){this.disposed||this.sendRecordCore(e)}sendRecordCore(e){try{let n=this.getResourceAttrs?.()??{},i=e.traceId||"",r=e.spanId||"",s=e.parentSpanId||"",a=e.name||"",o=e.kind||"INTERNAL",c=e.status||"OK",l=e.startTime,u=e.endTime,f=e.durationMs,x=l?new Date(l).getTime():Date.now(),S=u?new Date(u).getTime():Date.now(),b=S-x,w=b<0?0:b;b<0&&this.log?.warn(`${D} [sendRecord] negative duration detected, clamped to 0. spanId=${r}, name=${a}, startMs=${x}, endMs=${S}`);let g=1000000n,C=(BigInt(x)*g).toString(),z=(BigInt(S)*g).toString(),q=(BigInt(w)*g).toString(),N={};for(let[Z,O]of Object.entries(e))TS.has(Z)||O!=null&&(N[Z]=O);f!=null&&(N.durationMs=String(f));for(let[Z,O]of Object.entries(n))O!=null&&(N[Z]=String(O));let I=this.mapSpanKindToString(o),H=c==="OK"?"OK":c==="ERROR"?"ERROR":"UNSET",G=JSON.stringify(N),L=new $e.LogItem;L.setTime(Math.floor(x/1e3)),L.pushBack(new $e.Content("traceID",i)),L.pushBack(new $e.Content("spanID",r)),L.pushBack(new $e.Content("parentSpanID",s)),L.pushBack(new $e.Content("kind",I)),L.pushBack(new $e.Content("name",a)),L.pushBack(new $e.Content("links","[]")),L.pushBack(new $e.Content("logs","[]")),L.pushBack(new $e.Content("traceState","")),L.pushBack(new $e.Content("start",C)),L.pushBack(new $e.Content("end",z)),L.pushBack(new $e.Content("duration",q)),L.pushBack(new $e.Content("attribute",G)),L.pushBack(new $e.Content("statusCode",H)),L.pushBack(new $e.Content("statusMessage",""));let J=this.producer.send(L);J&&typeof J.catch=="function"&&J.catch(Z=>{this.log.warn(`${D} CLS \u5F02\u6B65\u53D1\u9001\u5931\u8D25: ${Z}`)})}catch(n){this.log.warn(`${D} CLS \u53D1\u9001\u5931\u8D25: ${n}`)}}mapSpanKind(e){switch(e){case"entry":case"gateway":return"ENTRY";case"agent":return"AGENT";case"step":return"STEP";case"model":return"LLM";case"tool":return"TOOL";case"session":return"SESSION";case"message":return"TASK";default:return"INTERNAL"}}mapSpanKindToString(e){switch(e){case"ENTRY":return"server";case"LLM":return"client";case"TOOL":return"client";default:return"internal"}}};import{readFile as SS}from"node:fs/promises";async function ux(t){try{let e=await SS(t,"utf8"),a=JSON.parse(e).plugins?.entries?.[Vg]?.config,o=a?.trace,c=o?.enabled!==!1,l=typeof o?.traceTopicId=="string"?o.traceTopicId.trim():"",u=a?.cls,f=typeof u?.endpoint=="string"?u.endpoint.trim():"",x=typeof u?.token=="string"?u.token.trim():"",S=typeof u?.credentialMode=="string"&&u.credentialMode.trim()==="cvmRole"?"cvmRole":"static",b=typeof u?.roleName=="string"?u.roleName.trim():"",w="",g="";try{w=typeof u?.secretId=="string"?De(u.secretId.trim()):""}catch(q){console.warn(`[diagnostics-metrics-cls/trace] readTraceHotConfigFromDisk: secretId decrypt failed: ${String(q)}`)}try{g=typeof u?.secretKey=="string"?De(u.secretKey.trim()):""}catch(q){console.warn(`[diagnostics-metrics-cls/trace] readTraceHotConfigFromDisk: secretKey decrypt failed: ${String(q)}`)}let C=o?.debug===!0,z=Array.isArray(o?.enabledHooks)?o.enabledHooks:void 0;return{enabled:c,traceTopicId:l,endpoint:f,secretId:w,secretKey:g,token:x,credentialMode:S,roleName:b,debug:C,enabledHooks:z}}catch(e){return e?.code==="ENOENT"||console.warn(`[diagnostics-metrics-cls/trace] readTraceHotConfigFromDisk failed: ${String(e)}`),null}}function Xc(t,e){if(!t)return{enabled:!1,traceTopicId:"",endpoint:"",secretId:"",secretKey:"",serviceName:"openclaw-agent"};let n=t.enabled!==!1,i=typeof t.traceTopicId=="string"?t.traceTopicId.trim():"",r=typeof e?.endpoint=="string"?e.endpoint.trim():"",s="",a="";try{s=typeof e?.secretId=="string"?De(e.secretId.trim()):""}catch(f){console.warn(`[diagnostics-metrics-cls/trace] resolveTraceConfig: secretId decrypt failed: ${String(f)}`)}try{a=typeof e?.secretKey=="string"?De(e.secretKey.trim()):""}catch(f){console.warn(`[diagnostics-metrics-cls/trace] resolveTraceConfig: secretKey decrypt failed: ${String(f)}`)}let o=typeof e?.token=="string"?e.token.trim():void 0,c=typeof e?.credentialMode=="string"&&e.credentialMode.trim()==="cvmRole"?"cvmRole":"static",l=typeof e?.roleName=="string"?e.roleName.trim():void 0;return{enabled:n&&(c==="cvmRole"?!!(i&&r&&l):!!(i&&r&&s&&a)),traceTopicId:i,endpoint:r,secretId:s,secretKey:a,token:o,credentialMode:c,roleName:l,serviceName:typeof t.serviceName=="string"?t.serviceName:"openclaw-agent",debug:t.debug===!0,enabledHooks:Array.isArray(t.enabledHooks)?t.enabledHooks:void 0}}function dx(t){let e=t.traceTopicId??"",n=t.endpoint??"",i=t.secretId??"",r=t.secretKey??"",s=t.token,a=t.credentialMode??"static",o=t.roleName??"",c=t.sharedCredentialManager??null,l=t.debug??!1,u=t.enabled===!0,f=t.enabledHooks,x=t.serviceName||ES(process.cwd())||"openclaw-agent",S=`${x}@${px()}:${process.pid}`,b={"service.name":x,"service.instance.id":S,"host.name":px(),"telemetry.sdk.language":"nodejs"};function w(){let d=_t(),h={...b};return d.cvmInstanceId&&(h.cvm_instance_id=d.cvmInstanceId),d.cvmInstanceName&&(h.cvm_instance_name=d.cvmInstanceName),d.cvmInstanceIntraIp&&(h.cvm_instance_intra_ip=d.cvmInstanceIntraIp),h}let g=null,C=null,z=null;function q(d){return{topic_id:e,endpoint:n,credential:{secretId:d.secretId,secretKey:d.secretKey,token:d.token},onSendLogsError:h=>{h?.status!==200?E?.warn(`${D} CLS \u53D1\u9001\u5931\u8D25: ${JSON.stringify(h)}`):l&&E?.debug(`${D} CLS \u53D1\u9001\u6210\u529F: requestId=${h?.requestId}`)}}}let N=new Map,I=new Map,H=new Map,G=new Map,L=new Map,J=new Map,Z=new Map,O,me,R,p="unknown",j=null,E=null,re=!1,K=new Set,ee=new Map,he=2e3;function U(){let d=Date.now(),h=new Set,T=[];for(let[_,A]of N)d-A.createdAt>Gc&&(T.push(_),h.add(A));for(let _ of T)N.delete(_);for(let _ of h)I.delete(_.runId);if(h.size>0){let _=[];for(let[F,B]of H){for(let ne of h)B.delete(ne);B.size===0&&_.push(F)}for(let F of _)H.delete(F);let A=[];for(let[F,B]of G)h.has(B)&&A.push(F);for(let F of A)G.delete(F);me&&h.has(me)&&(me=void 0,O=void 0,R=void 0)}let y=[];for(let[_,A]of L)(d-A.createdAt>Gc||h.has(A.traceContext))&&y.push(_);for(let _ of y)L.delete(_);let m=[];for(let[_,A]of Z)d-A.createdAt>Jg&&m.push(_);for(let _ of m)Z.delete(_);g&&g.sweepStaleOpenSpans()}function M(d){return f?f.includes(d):!0}function V(d){return d.startsWith(Wg)}function ie(d,h){let T=[];for(let[y,m]of L)m.runId===d&&T.push({oldKey:y,pending:m});for(let{oldKey:y,pending:m}of T){L.delete(y),m.runId=h;let _=Wi(m.toolCallId,h);L.has(_)&&l&&E?.warn(`${D} movePendingToolCallsRunBinding: key collision detected, overwriting existing entry: ${_}`),L.set(_,m)}}function X(d,h,T){let y=Jn(h);if(!y||d.runId===y)return;let m=I.get(y);if(m&&m!==d)return;let _=d.runId;if(!V(_))return;I.get(_)===d&&I.delete(_),d.runId=y,d.turnId=y,I.set(y,d),ie(_,y);let A={"openclaw.run.id":y,"openclaw.turn.id":y};g?.patchOpenSpanAttributes(d.rootSpanId,A),d.agentSpanId&&g?.patchOpenSpanAttributes(d.agentSpanId,A),d.stepSpanId&&g?.patchOpenSpanAttributes(d.stepSpanId,A),l&&E?.info(`${D} Rebound temporary runId: hook=${T}, oldRunId=${_}, realRunId=${y}`)}function ce(d,h){if(re)return Promise.resolve();if(J.size>=Xg)return E?.warn(`${D} trace task queue size (${J.size}) exceeded limit, dropping task for trace ${d}`),Promise.resolve();let T=J.get(d)||Promise.resolve(),y=()=>{let A,F=new Promise((B,ne)=>{A=setTimeout(()=>ne(new Error(`trace task timeout after ${Hc}ms`)),Hc)});return Promise.race([h(),F]).finally(()=>{A!==void 0&&clearTimeout(A)})},m=T.catch(()=>{}).then(y),_;return _=m.finally(()=>{J.get(d)===_&&J.delete(d)}),J.set(d,_),_}async function ke(d){if(!d)return;let h=J.get(d);if(h)try{await h}catch(T){E?.warn(`${D} drainTraceTasks failed for traceId=${d}: ${String(T)}`)}}function ge(d){if(!d)return;let h=`${d}:`,T=[];for(let[y,m]of L)(y.startsWith(h)||m.runId===d)&&T.push(y);for(let y of T)L.delete(y)}function ht(d){let h=Jn(d.runId),T=bs(d.toolCallId);if(T){let _=[Wi(T,h),Wi(T,void 0)];for(let A of _){let F=L.get(A);if(F)return L.delete(A),F}}let y,m;for(let[_,A]of L)A.toolName===d.toolName&&(h&&A.runId!==h||!h&&A.runId||(!m||A.toolStartTime>m.toolStartTime)&&(m=A,y=_));return m&&y&&L.delete(y),m}function It(d,h){let T=H.get(d);T||(T=new Set,H.set(d,T)),T.add(h)}function _e(d,h){let T=H.get(d);T&&(T.delete(h),T.size===0&&H.delete(d))}function Lt(d,h){N.set(d,h),It(d,h)}function Zi(d,h){N.get(d)===h&&N.delete(d),_e(d,h)}async function Qi(d=!0){re=!0,j&&(clearInterval(j),j=null),C&&(clearInterval(C),C=null),z&&(z(),z=null);for(let T of K)clearTimeout(T);K.clear();for(let T of ee.values())clearTimeout(T);ee.clear();let h=Array.from(J.values());h.length>0&&await Promise.allSettled(h),J.clear(),L.clear(),Z.clear(),N.clear(),I.clear(),H.clear(),G.clear(),me=void 0,O=void 0,R=void 0,d&&g&&(await g.dispose(),g=null)}function Vt(){L.clear(),Z.clear(),N.clear(),I.clear(),H.clear(),G.clear(),me=void 0,O=void 0,R=void 0;for(let d of K)clearTimeout(d);K.clear();for(let d of ee.values())clearTimeout(d);ee.clear()}function er(d){let h=N.get(d);h&&Wt(h)}function Wt(d){I.get(d.runId)===d&&I.delete(d.runId);let h=[];for(let[m,_]of N)_===d&&h.push(m);for(let m of h)N.delete(m);let T=[];for(let[m,_]of H)_.has(d)&&(_.delete(d),_.size===0&&T.push(m));for(let m of T)H.delete(m);let y=[];for(let[m,_]of G)_===d&&y.push(m);for(let m of y)G.delete(m);Z.delete(d.traceId),me===d&&(me=void 0,O=void 0,R=void 0)}function Jt(d,h,T){let m={traceId:Ue(32),rootSpanId:Ue(16),runId:d,turnId:d,channelId:h,originalChannelId:T||h,createdAt:Date.now(),llmPendingToolCallIds:new Set,llmPendingToolResultsForNextInput:[],llmPendingToolCallCountFallback:0,llmSegmentCount:0,stepRoundCounter:0,stepAwaitingToolResults:!1};return Lt(h,m),I.set(d,m),m}function Xt(d,h){let T=H.get(d);if(!T||T.size===0)return h;let y=Array.from(T).filter(m=>m.agentSpanId&&!m.isClosing);return y.length===0?h||Array.from(T)[0]:(y.sort((m,_)=>(_.agentStartTime||_.createdAt)-(m.agentStartTime||m.createdAt)),y[0])}function el(d){let h=I.get(d);return h?.originalChannelId||h?.channelId}function Ce(d,h,T){let y=d,m=d.startsWith("agent/")?d:void 0,_=m&&G.get(m)||N.get(d),A=Jn(h),F=A||_?.runId||`__temp_run_${Ue(12)}`,B=()=>d.startsWith("agent/")&&!!me&&!!R&&Date.now()-(R||0)<Gg,ne=()=>{if(!me)return;let pe=me;if(!(A&&pe.runId!==A&&!V(pe.runId)))return y=O||y,Lt(d,pe),I.set(F,pe),l&&E?.info(`${D} LINKING agent to user context: hook=${T}, agentChannel=${d}, userChannel=${y}, traceId=${pe.traceId}`),pe};if(d.startsWith("agent/")&&F){let pe=el(F);pe&&(y=pe,_=N.get(pe)||_)}if(_||(_=I.get(F)),T==="agent_end"&&!A&&(_=Xt(y,_)),!_&&B()&&(_=ne()),T==="message_received"&&!d.startsWith("agent/")&&_&&(_.agentSpanId||_.hasSeenLlmInput||_.isClosing)&&(_=void 0,A||(F=`__temp_run_${Ue(12)}`)),_&&A&&_.runId!==A&&!V(_.runId)&&(_=void 0,F=A),_&&A&&V(_.runId)){let pe=I.get(A);pe&&pe!==_&&(_=pe,Lt(y,_))}!_&&B()&&(_=ne());let ue=!1;return _||(_=Jt(F,y,d!==y?d:void 0),ue=!0,l&&E?.info(`${D} NEW TraceContext: hook=${T}, channelId=${y}, runId=${F}, traceId=${_.traceId}`)),m&&_&&!_.isClosing&&G.set(m,_),_&&h&&X(_,h,T),{ctx:_,channelId:y,isNew:ue}}function at(d,h,T,y,m,_,A={},F){return{name:T,type:y,startTime:m,endTime:_,attributes:{...A,"openclaw.version":p,"openclaw.session.id":d.sessionId||h,"gen_ai.session.id":d.sessionId||h,"openclaw.run.id":d.runId,"openclaw.turn.id":d.turnId},traceId:d.traceId,spanId:Ue(16),parentSpanId:F||d.rootSpanId}}function Pt(d){return d.agentSpanId||d.rootSpanId}function tr(d){return d.stepSpanId||d.agentSpanId||d.rootSpanId}async function nr(d,h,T){if(!g)return;let y=T.endTime||Date.now(),m=d.llmPendingStartTime||y,_=y<m?m:y,A=d.llmProvider||"unknown",F=d.llmModel||"unknown",B=T.stopReason||"stop",ne=T.usage?.input??0,ue=T.usage?.output??0,pe=T.usage?.cacheRead??0,Ge=T.usage?.cacheWrite??0,Yt=T.usage?.total??ne+ue+pe+Ge,Be={"gen_ai.span.kind":"LLM","gen_ai.operation.name":"chat","gen_ai.provider.name":A,"gen_ai.system":A,"gen_ai.request.model":F,"gen_ai.response.model":F,"gen_ai.usage.input_tokens":ne,"gen_ai.usage.output_tokens":ue,"gen_ai.usage.total_tokens":Yt,"gen_ai.usage.cache_read.input_tokens":pe,"gen_ai.usage.cache_creation.input_tokens":Ge,"llm.request.type":"chat"};d.llmPendingSystemInstructions&&(Be["gen_ai.system_instructions"]=d.llmPendingSystemInstructions);let Ne=d.llmPendingInputMessages||d.llmLastInputMessages;Ne&&(Be["gen_ai.input.messages"]=Ne),(T.outputContent!==void 0||T.outputTexts.length>0)&&(Be["gen_ai.output.messages"]=nx(T.outputContent,T.outputTexts,B)),Be["gen_ai.response.finish_reasons"]=JSON.stringify([B]);try{if(Ne){let be=JSON.parse(Ne);if(Array.isArray(be)){let Rt=be.map(Qe=>({role:Qe.role,content:Array.isArray(Qe.parts)?Qe.parts.filter(Zt=>Zt.type==="text").map(Zt=>Zt.content).join(""):""}));ox(Be,Rt)}}if(T.outputTexts.length>0){let be=[{role:"assistant",content:T.outputTexts.join(""),stopReason:B,toolCalls:T.outputContent?Jc(Array.isArray(T.outputContent)?T.outputContent:void 0):void 0}];be[0].toolCalls?.length===0&&delete be[0].toolCalls,cx(Be,be)}}catch(be){l&&E?.warn(`${D} Failed to set indexed prompt/completion attrs: ${String(be)}`)}let Me=at(d,h,`chat ${F}`,"model",m,_,Be,tr(d));d.llmPendingSpanId&&(Me.spanId=d.llmPendingSpanId);try{g.export(Me),E?.debug(`${D} [span] Exported LLM span: ${A}/${F}, traceId=${d.traceId}, spanId=${Me.spanId}, duration=${_-m}ms`),l&&E?.info(`${D} Exported segmented LLM span: ${A}/${F}, duration=${_-m}ms, reason=${B}`)}finally{d.llmPendingStartTime=void 0,d.llmPendingSpanId=void 0,d.llmPendingSystemInstructions=void 0,d.llmPendingInputMessages=void 0,d.llmSegmentCount+=1}}async function Mt(d,h,T){let y=typeof T.timestamp=="number"&&Number.isFinite(T.timestamp)?T.timestamp:Date.now(),m=rx(T.content),_=sx(T.content),A=typeof T.stopReason=="string"?T.stopReason:m.length>0?"toolUse":"stop";d.llmPendingStartTime||(d.llmPendingStartTime=y),d.llmPendingSpanId||(d.llmPendingSpanId=Ue(16)),await nr(d,h,{endTime:y,outputTexts:_,outputContent:T.content,stopReason:A,usage:T.usage}),_.length>0&&(d.lastOutput=_.join(`
26
- `)),d.llmPendingToolCallIds.clear(),d.llmPendingToolResultsForNextInput=[],d.llmLastAssistantContent=T.content;for(let F of m)d.llmPendingToolCallIds.add(F.id);d.llmPendingToolCallCountFallback=d.llmPendingToolCallIds.size>0?0:m.length,d.stepAwaitingToolResults=m.length>0,m.length===0&&te(d,y,A,h),l&&E?.info(`${D} Processed assistant message: runId=${d.runId}, toolCalls=${m.length}, stopReason=${A}`)}function jt(d,h,T={}){if(d.rootSpanStartTime||!g)return;let y=Date.now();d.rootSpanStartTime=y;let m={"gen_ai.span.kind":"ENTRY","gen_ai.operation.name":"enter","gen_ai.user.id":T.userId||"unknown","openclaw.session.id":d.sessionId||h,"gen_ai.session.id":d.sessionId||h,"openclaw.run.id":d.runId,"openclaw.turn.id":d.turnId,"openclaw.message.role":T.role||"unknown","openclaw.message.from":T.from||"unknown","openclaw.version":p};d.userInput&&(m["gen_ai.input.messages"]=ft(JSON.stringify([{role:"user",parts:[{type:"text",content:String(d.userInput)}]}]))),g.startSpan({name:"enter_openclaw_system",type:"entry",startTime:y,attributes:m,traceId:d.traceId,spanId:d.rootSpanId},d.rootSpanId),E?.debug(`${D} [span] Started entry span: traceId=${d.traceId}, spanId=${d.rootSpanId}`)}function gn(d,h,T){if(d.agentSpanId||!g)return;let y=Date.now();d.agentStartTime=y,d.agentSpanId=Ue(16),g.startSpan({name:`invoke_agent ${T}`,type:"agent",startTime:y,attributes:{"gen_ai.span.kind":"AGENT","gen_ai.operation.name":"invoke_agent","gen_ai.provider.name":"openclaw","gen_ai.agent.id":T,"gen_ai.agent.name":T,"openclaw.session.id":d.sessionId||h,"gen_ai.session.id":d.sessionId||h,"openclaw.run.id":d.runId,"openclaw.turn.id":d.turnId,"openclaw.version":p},traceId:d.traceId,spanId:d.agentSpanId,parentSpanId:d.rootSpanId},d.agentSpanId),E?.debug(`${D} [span] Started agent span: ${T}, spanId=${d.agentSpanId}, traceId=${d.traceId}`)}function P(d,h,T){if(d.stepSpanId||!g)return;let y=d.stepRoundCounter+1,m=Ue(16);g.startSpan({name:"react step",type:"step",startTime:T,attributes:{"gen_ai.span.kind":"STEP","gen_ai.operation.name":"react","gen_ai.react.round":y,"openclaw.session.id":d.sessionId||h,"gen_ai.session.id":d.sessionId||h,"openclaw.run.id":d.runId,"openclaw.turn.id":d.turnId,"openclaw.version":p},traceId:d.traceId,spanId:m,parentSpanId:Pt(d)},m),d.stepSpanId=m,d.stepStartTime=T,d.stepRoundCounter=y,d.stepCurrentRound=y,d.stepAwaitingToolResults=!1,l&&E?.info(`${D} Started step span: round=${y}, spanId=${m}`)}function te(d,h,T,y){if(!d.stepSpanId||!g)return;let m=d.stepSpanId,_=d.stepCurrentRound||d.stepRoundCounter||1;g.endSpanById(m,h,{"gen_ai.react.round":_,"gen_ai.react.finish_reason":T||"stop","openclaw.session.id":d.sessionId||y,"gen_ai.session.id":d.sessionId||y,"openclaw.run.id":d.runId,"openclaw.turn.id":d.turnId}),d.stepSpanId=void 0,d.stepStartTime=void 0,d.stepCurrentRound=void 0,d.stepAwaitingToolResults=!1,l&&E?.info(`${D} Ended step span: round=${_}, reason=${T}, spanId=${m}`)}function xe(d){d.acpFallbackPending=!1;let h=ee.get(d.traceId);h&&(clearTimeout(h),ee.delete(d.traceId))}function xn(d,h){if(!d.acpFallbackPending||!g)return;let T=ee.get(d.traceId);T&&clearTimeout(T);let y=g,m=setTimeout(async()=>{if(ee.delete(d.traceId),K.delete(m),!!d.acpFallbackPending){d.acpFallbackPending=!1;try{if(E?.debug(`${D} [acp-fallback] Closing Entry Span for ACP mode: traceId=${d.traceId}`),d.rootSpanStartTime&&y&&!y.isDisposed){let _=Date.now(),A={"request.duration_ms":_-d.rootSpanStartTime,"openclaw.acp_mode":!0};d.sessionId&&(A["openclaw.session.id"]=d.sessionId,A["gen_ai.session.id"]=d.sessionId),d.userInput&&(A["gen_ai.input.messages"]=ft(JSON.stringify([{role:"user",parts:[{type:"text",content:String(d.userInput)}]}]))),d.lastOutput&&(A["gen_ai.output.messages"]=Wn([typeof d.lastOutput=="string"?d.lastOutput:JSON.stringify(d.lastOutput)])),y.endSpanById(d.rootSpanId,_,A),E?.debug(`${D} [acp-fallback] Ended entry span: spanId=${d.rootSpanId}, traceId=${d.traceId}, duration=${_-d.rootSpanStartTime}ms`)}Zi(h,d),Wt(d),y&&!y.isDisposed&&(await y.flush(),E?.debug(`${D} [acp-fallback] Flushed after ACP fallback close, traceId=${d.traceId}`))}catch(_){E?.warn(`${D} [acp-fallback] Error closing Entry Span: ${String(_)}`)}}},he);ee.set(d.traceId,m),K.add(m)}let Zn={id:"diagnostics-metrics-cls-trace",async start(d){if(E=d.logger,p=d.runtime?.version||"unknown",re=!1,u&&e&&n&&(a==="cvmRole"?!!o:!!(i&&r))){let m;if(c){let _=c.getCredentialSnapshot();m={secretId:_.secretId,secretKey:_.secretKey,token:_.token},i=_.secretId,r=_.secretKey,s=_.token}else a==="static"?m={secretId:i,secretKey:r,token:s}:(E.warn(`${D} cvmRole \u6A21\u5F0F\u4F46\u5171\u4EAB\u51ED\u8BC1\u7BA1\u7406\u5668\u4E0D\u53EF\u7528\uFF0Ctrace \u6570\u636E\u6682\u4E0D\u53D1\u9001`),m={secretId:"",secretKey:""});if(m.secretId&&m.secretKey){let _=new Xi.Producer(q(m));g=new Ji(_,e,l,E,w),E.debug(`${D} CLS Producer \u5DF2\u521D\u59CB\u5316\uFF0Cendpoint=${n} traceTopicId=${e} credentialMode=${a}`),c&&!z&&(z=c.subscribe(A=>{if(!g||g.isDisposed||!(A.secretId!==i||A.secretKey!==r||(A.token||"")!==(s||"")))return;i=A.secretId,r=A.secretKey,s=A.token;let B=new Xi.Producer(q(A));g.updateProducer(B,e),l&&E?.info(`${D} \u5171\u4EAB\u51ED\u8BC1\u5DF2\u66F4\u65B0\uFF0CProducer \u5DF2\u91CD\u5EFA`)}))}else E.warn(`${D} \u51ED\u8BC1\u83B7\u53D6\u5931\u8D25\uFF08credentialMode=${a}\uFF09\uFF0Ctrace \u6570\u636E\u6682\u4E0D\u53D1\u9001\uFF0C\u7B49\u5F85\u70ED\u66F4\u65B0\u6062\u590D`)}else E.warn(`${D} CLS \u914D\u7F6E\u4E0D\u5B8C\u6574\u6216 trace \u672A\u542F\u7528\uFF08traceEnabled=${u}\uFF0CcredentialMode=${a}\uFF09\uFF0Ctrace \u6570\u636E\u6682\u4E0D\u53D1\u9001\uFF0C\u7B49\u5F85\u70ED\u66F4\u65B0\u6062\u590D`);j=setInterval(U,Hg);let T=IS(d.stateDir,"openclaw.json"),y=!1;C=setInterval(()=>{(async()=>{if(!y){y=!0;try{let m=await ux(T);if(!m)return;let _=m.enabled,A=m.traceTopicId,F=m.endpoint,B=m.secretId,ne=m.secretKey,ue=m.token,pe=m.debug;pe!==l&&(l=pe,g&&(g.debug=l),E.debug(`${D} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0Ctrace.debug=${l}`));let Ge=m.enabledHooks;JSON.stringify(Ge)!==JSON.stringify(f)&&(f=Ge,E.debug(`${D} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0CenabledHooks=${f?f.join(","):"\u5168\u90E8\u542F\u7528"}`));let Be=_!==u;if(Be)if(u=_,u)E.debug(`${D} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0Ctrace.enabled=true\uFF0C\u6B63\u5728\u6062\u590D Trace \u94FE\u8DEF\u8FFD\u8E2A`);else{g&&(await g.dispose(),g=null),Vt(),E.debug(`${D} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0Ctrace.enabled=false\uFF0C\u5DF2\u7981\u7528 Trace \u94FE\u8DEF\u8FFD\u8E2A`);return}if(!u)return;let Ne=m.credentialMode,Me=m.roleName,be=A!==e,Rt=F!==n,Qe=!c&&(B!==i||ne!==r),Zt=!c&&(ue||"")!==(s||""),Ts=Ne!==a,Ss=Me!==o;if(!(Be||be||Rt||Qe||Zt||Ts||Ss))return;if(be&&(e=A),Rt&&(n=F),Ts&&(a=Ne),Ss&&(o=Me),Qe&&(i=B,r=ne),Zt&&(s=ue||void 0),a==="cvmRole"?!e||!n||!o:!e||!n||!i||!r){g&&(await g.dispose(),g=null),E.warn(`${D} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0CCLS \u914D\u7F6E\u4E0D\u5B8C\u6574\uFF08credentialMode=${a}\uFF09\uFF0Ctrace \u6570\u636E\u5C06\u4E0D\u4F1A\u53D1\u9001`);return}let ni;if(c){let vn=c.getCredentialSnapshot();ni={secretId:vn.secretId,secretKey:vn.secretKey,token:vn.token},i=vn.secretId,r=vn.secretKey,s=vn.token}else if(a==="static")ni={secretId:i,secretKey:r,token:s};else{E.warn(`${D} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0CcvmRole \u6A21\u5F0F\u4F46\u5171\u4EAB\u51ED\u8BC1\u7BA1\u7406\u5668\u4E0D\u53EF\u7528`);return}if(!ni.secretId||!ni.secretKey){g&&(await g.dispose(),g=null),E.warn(`${D} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0C\u51ED\u8BC1\u83B7\u53D6\u5931\u8D25\uFF0Ctrace \u6570\u636E\u5C06\u4E0D\u4F1A\u53D1\u9001`);return}let tl=new Xi.Producer(q(ni));g?g.updateProducer(tl,e):g=new Ji(tl,e,l,E,w),re=!1;let qt=[];Be&&qt.push("enabled=true"),be&&qt.push(`traceTopicId=${e}`),Rt&&qt.push(`endpoint=${n}`),Ts&&qt.push(`credentialMode=${a}`),Ss&&qt.push(`roleName=${o}`),Qe&&qt.push("\u51ED\u8BC1\u5DF2\u66F4\u65B0"),Zt&&qt.push("token\u5DF2\u66F4\u65B0"),E.debug(`${D} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0C${qt.join("\uFF0C")}`)}catch(m){E?.warn(`${D} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\u8F6E\u8BE2\u5931\u8D25: ${String(m)}`)}finally{y=!1}}})()},Kg)},async stop(){await Qi()}};function Qn(d){E=d.logger,p=d.runtime?.version||p,d.on("gateway_stop",async()=>{await Qi()}),d.on("gateway_start",async h=>{try{if(!M("gateway_start")||!g)return;let T=Date.now(),y=Ue(32),m=Ue(16),_={name:"gateway_start",type:"gateway",startTime:T,endTime:T,attributes:{"openclaw.version":p,"gen_ai.span.kind":"ENTRY","gateway.port":h.port},traceId:y,spanId:m,parentSpanId:""};g.export(_)}catch(T){E?.warn(`${D} [hook] gateway_start ERROR: ${String(T)}`)}}),d.on("session_start",async(h,T)=>{try{if(!M("session_start")||!g)return;let y=qe(T,h.sessionId),{ctx:m,channelId:_}=Ce(y,h?.runId,"session_start");h.sessionId&&(m.sessionId=h.sessionId);let A=Date.now(),F=at(m,_,"session_start","session",A,A,{"gen_ai.span.kind":"SESSION","event.type":"session_start"});h.sessionId&&(F.attributes["openclaw.session.id"]=h.sessionId,F.attributes["gen_ai.session.id"]=h.sessionId),g.export(F)}catch(y){E?.warn(`${D} [hook] session_start ERROR: ${String(y)}`)}}),d.on("session_end",async(h,T)=>{try{if(!M("session_end")||!g)return;let y=qe(T,h.sessionId),{ctx:m,channelId:_}=Ce(y,h?.runId,"session_end"),A=Date.now(),F=at(m,_,"session_end","session",A,A,{"gen_ai.span.kind":"SESSION","session.duration_ms":h.durationMs||0,"session.message_count":h.messageCount||0,"session.total_tokens":m.lastLlmUsage?.total||0});m.lastOutput&&(F.attributes["gen_ai.output.messages"]=Wn([typeof m.lastOutput=="string"?m.lastOutput:JSON.stringify(m.lastOutput)])),h.sessionId&&(F.attributes["openclaw.session.id"]=h.sessionId,F.attributes["gen_ai.session.id"]=h.sessionId),g.export(F),await ke(m.traceId),er(_)}catch(y){E?.warn(`${D} [hook] session_end ERROR: ${String(y)}`)}}),d.on("message_received",async(h,T)=>{try{if(E?.debug(`${D} [hook] message_received fired, sender=${g?"OK":"null"}, enabled=${M("message_received")}`),!M("message_received")||!g)return;let y=qe(T,h.from||h.metadata?.senderId),{ctx:m,channelId:_}=Ce(y,h?.runId,"message_received");!y.startsWith("agent/")&&(O=_,me=m,R=Date.now(),m.userInput=h.content,jt(m,_,{userId:h.from||h.metadata?.senderId,role:"user",from:h.from}),m.acpFallbackPending=!0)}catch(y){E?.warn(`${D} [hook] message_received ERROR: ${String(y)}`),console.error(`${D} [hook] message_received ERROR:`,y)}}),d.on("message_sending",async(h,T)=>{try{if(!M("message_sending"))return;let y=qe(T,h.to),{ctx:m}=Ce(y,h?.runId,"message_sending");m.lastOutput=h.content}catch(y){E?.warn(`${D} [hook] message_sending ERROR: ${String(y)}`)}},{priority:-100}),d.on("message_sent",async(h,T)=>{try{if(!M("message_sent"))return;if(h.content&&h.success){let y=qe(T,h.to),{ctx:m,channelId:_}=Ce(y,h?.runId,"message_sent");m.lastOutput=h.content,m.acpFallbackPending&&xn(m,_)}}catch(y){E?.warn(`${D} [hook] message_sent ERROR: ${String(y)}`)}},{priority:-100}),d.on("llm_input",async(h,T)=>{try{if(E?.debug(`${D} [hook] llm_input fired, sender=${g?"OK":"null"}, enabled=${M("llm_input")}`),!M("llm_input")||!g)return;let y=qe(T),{ctx:m,channelId:_}=Ce(y,h.runId,"llm_input");xe(m),h.sessionId&&(m.sessionId=h.sessionId),!m.userInput&&h.prompt&&(m.userInput=h.prompt),jt(m,_,{userId:T.trigger||"system",role:T.trigger||"system",from:T.agentId||"openclaw"}),gn(m,_,T.agentId||"openclaw"),m.llmProvider=h.provider,m.llmModel=h.model,m.hasSeenLlmInput=!0,m.isClosing=!1,y.startsWith("agent/")&&G.set(y,m),m.llmPendingStartTime=Date.now(),m.llmPendingSpanId=Ue(16),P(m,_,m.llmPendingStartTime),m.llmPendingToolCallIds.clear(),m.llmPendingToolCallCountFallback=0,h.systemPrompt&&(m.llmPendingSystemInstructions=tx(h.systemPrompt));let A=h.historyMessages?.length?h.historyMessages.map(B=>Vc(B)):[];m.llmPendingInputMessages=Wc(A,h.prompt),m.llmLastInputMessages=m.llmPendingInputMessages;let F=Z.get(m.traceId);if(F){Z.delete(m.traceId);try{ce(m.traceId,async()=>{await Mt(m,_,F.message)}).catch(B=>{E?.warn(`${D} replay pending assistant failed: ${String(B)}`)})}catch(B){E?.warn(`${D} replay pending assistant enqueue failed: ${String(B)}`)}}l&&E?.info(`${D} LLM input started: ${h.provider}/${h.model}, runId=${h.runId}`)}catch(y){E?.error(`${D} [hook] llm_input UNCAUGHT ERROR: ${String(y)}, stack=${y?.stack}`)}},{priority:-100}),d.on("llm_output",async(h,T)=>{try{if(!M("llm_output")||!g)return;let y=qe(T),{ctx:m,channelId:_}=Ce(y,h.runId,"llm_output");if(h.sessionId&&(m.sessionId=h.sessionId),h.assistantTexts?.length&&(m.lastOutput=h.assistantTexts.join(`
27
- `)),h.usage&&(m.lastLlmUsage={input:h.usage.input,output:h.usage.output,cacheRead:h.usage.cacheRead,cacheWrite:h.usage.cacheWrite,total:h.usage.total}),m.llmSegmentCount===0&&m.llmPendingStartTime){let A=Date.now(),F=h.lastAssistant,B=typeof F?.stopReason=="string"?F.stopReason:void 0;await nr(m,_,{endTime:A,outputTexts:h.assistantTexts||[],stopReason:B,usage:h.usage}),te(m,A,B||"stop",_)}}catch(y){E?.warn(`${D} [hook] llm_output ERROR: ${String(y)}`)}},{priority:-100}),d.on("before_message_write",(h,T)=>{try{if(E?.debug(`${D} [hook] before_message_write fired, sender=${g?"OK":"null"}, enabled=${M("before_message_write")}, role=${h?.message?.role}`),!M("before_message_write")||!g)return;let y=h.message;if(!y||y.role!=="assistant")return;let m=qe(T),_=m.startsWith("agent/")?G.get(m):void 0;if(m.startsWith("agent/")&&!_)return;let{ctx:A,channelId:F}=_?{ctx:_,channelId:_.channelId}:Ce(m,void 0,"before_message_write");if(!A.hasSeenLlmInput){Z.set(A.traceId,{message:y,createdAt:Date.now()});return}try{ce(A.traceId,async()=>{await Mt(A,F,y)}).catch(B=>{E?.warn(`${D} before_message_write segmented export failed: ${String(B)}`)})}catch(B){E?.warn(`${D} before_message_write enqueue failed: ${String(B)}`)}}catch(y){E?.warn(`${D} [hook] before_message_write uncaught error: ${String(y)}, stack=${y?.stack}`)}},{priority:-100}),d.on("before_tool_call",async(h,T)=>{try{if(!M("before_tool_call")||!g)return;let y=qe(T),m=y.startsWith("agent/")?G.get(y):void 0;if(y.startsWith("agent/")&&!m)return;let{ctx:_,channelId:A}=m?{ctx:m,channelId:m.channelId}:Ce(y,Jn(h.runId),"before_tool_call");if(m&&h.runId&&X(_,h.runId,"before_tool_call"),!_.hasSeenLlmInput)return;let F=Jn(h.runId)||_.runId,B=bs(h.toolCallId)||`call_${Ue(12)}`;if(L.size>=Yg){E?.warn(`${D} pendingToolCalls size (${L.size}) exceeded limit, dropping tool call ${B}`);return}L.set(Wi(B,F),{runId:F,toolName:h.toolName,toolCallId:B,toolSpanId:Ue(16),toolStartTime:Date.now(),toolInput:h.params,traceContext:_,channelId:A,createdAt:Date.now()}),l&&E?.info(`${D} Tool call started: ${h.toolName}, toolCallId=${B}`)}catch(y){E?.warn(`${D} [hook] before_tool_call ERROR: ${String(y)}`)}},{priority:-100}),d.on("after_tool_call",async h=>{try{if(!M("after_tool_call")||!g)return;let T=ht(h);if(!T)return;let{toolName:y,toolCallId:m,toolSpanId:_,toolStartTime:A,toolInput:F,traceContext:B,channelId:ne}=T,ue=Date.now(),pe={"gen_ai.span.kind":"TOOL","gen_ai.operation.name":"execute_tool","gen_ai.tool.name":y,"gen_ai.tool.call.id":m,"gen_ai.tool.type":"function","tool.duration_ms":h.durationMs||ue-A};F!==void 0&&(pe["gen_ai.tool.call.arguments"]=ft(typeof F=="string"?F:JSON.stringify(F))),h.error?pe["error.type"]=h.error:h.result!==void 0&&(pe["gen_ai.tool.call.result"]=ft(typeof h.result=="string"?h.result:JSON.stringify(h.result)));let Ge=at(B,ne,`execute_tool ${y}`,"tool",A,ue,pe,tr(B));Ge.spanId=_,g.export(Ge);let Yt=h.error?[{type:"toolResult",toolCallId:m,toolName:y,isError:!0,content:h.error}]:[{type:"toolResult",toolCallId:m,toolName:y,content:h.result}];if(B.llmPendingToolResultsForNextInput.push({role:"toolResult",content:Yt}),B.llmPendingToolCallIds.size>0||B.llmPendingToolCallCountFallback>0){if(B.llmPendingToolCallIds.size>0){if(B.llmPendingToolCallIds.has(m))B.llmPendingToolCallIds.delete(m);else if(!bs(h.toolCallId)){let Me=B.llmPendingToolCallIds.values().next().value;Me&&B.llmPendingToolCallIds.delete(Me)}}else B.llmPendingToolCallCountFallback>0&&(B.llmPendingToolCallCountFallback-=1);if(B.llmPendingToolCallIds.size===0&&B.llmPendingToolCallCountFallback===0){let Me=[];B.llmLastAssistantContent!==void 0&&Me.push({role:"assistant",content:B.llmLastAssistantContent}),B.llmPendingToolResultsForNextInput.length>0&&Me.push(...B.llmPendingToolResultsForNextInput),te(B,ue,"toolUse",ne),B.llmPendingStartTime=ue,B.llmPendingSpanId=Ue(16),P(B,ne,ue),B.llmPendingSystemInstructions=void 0,B.llmPendingInputMessages=Me.length>0?Wc(Me):void 0,B.llmLastInputMessages=B.llmPendingInputMessages,B.llmPendingToolResultsForNextInput=[]}}l&&E?.info(`${D} Exported tool span: ${y}, duration=${ue-A}ms`)}catch(T){E?.warn(`${D} [hook] after_tool_call ERROR: ${String(T)}`)}},{priority:-100}),d.on("before_compaction",async(h,T)=>{try{if(!M("before_compaction")||!g)return;let y=qe(T),{ctx:m}=Ce(y,h?.runId,"before_compaction");m._compactionStartTime=Date.now()}catch(y){E?.warn(`${D} [hook] before_compaction ERROR: ${String(y)}`)}},{priority:-100}),d.on("after_compaction",async(h,T)=>{try{if(!M("after_compaction")||!g)return;let y=qe(T),{ctx:m,channelId:_}=Ce(y,h?.runId,"after_compaction"),A=m._compactionStartTime||Date.now(),F=Date.now(),B=at(m,_,"openclaw.compaction","tool",A,F,{"gen_ai.span.kind":"TOOL","gen_ai.operation.name":"compaction","openclaw.compaction.messages.after":h?.messageCount??-1,"openclaw.compaction.tokens.after":h?.tokenCount??-1,"openclaw.compaction.compacted_count":h?.compactedCount??0},Pt(m));g.export(B),m._compactionStartTime=void 0}catch(y){E?.warn(`${D} [hook] after_compaction ERROR: ${String(y)}`)}},{priority:-100}),d.on("subagent_spawned",async(h,T)=>{try{if(!M("subagent_spawned")||!g)return;let y=qe(T),{ctx:m}=Ce(y,h?.runId,"subagent_spawned"),_=h?.sessionKey??h?.childSessionKey??"unknown-child";m._subagentStartTimes||(m._subagentStartTimes=new Map),m._subagentStartTimes.set(_,Date.now())}catch(y){E?.warn(`${D} [hook] subagent_spawned ERROR: ${String(y)}`)}},{priority:-100}),d.on("subagent_ended",async(h,T)=>{try{if(!M("subagent_ended")||!g)return;let y=qe(T),{ctx:m,channelId:_}=Ce(y,h?.runId,"subagent_ended"),A=h?.sessionKey??h?.childSessionKey??"unknown-child",F=m._subagentStartTimes?.get(A)||Date.now(),B=Date.now(),ne=at(m,_,`openclaw.subagent.${A}`,"agent",F,B,{"gen_ai.span.kind":"AGENT","gen_ai.operation.name":"invoke_subagent","openclaw.subagent.session_key":A},Pt(m));g.export(ne),m._subagentStartTimes?.delete(A)}catch(y){E?.warn(`${D} [hook] subagent_ended ERROR: ${String(y)}`)}},{priority:-100}),d.on("before_agent_start",async(h,T)=>{try{if(!M("before_agent_start")||!g)return;let y=qe(T),m=T.agentId||"openclaw",{ctx:_,channelId:A}=Ce(y,h?.runId,"before_agent_start");xe(_),jt(_,A,{userId:T.trigger||"system",role:T.trigger||"system",from:m}),gn(_,A,m)}catch(y){E?.warn(`${D} [hook] before_agent_start ERROR: ${String(y)}`)}},{priority:-100}),d.on("agent_end",async(h,T)=>{try{if(E?.debug(`${D} [hook] agent_end fired, sender=${g?"OK":"null"}, enabled=${M("agent_end")}`),!M("agent_end")||!g)return;let y=qe(T),{ctx:m,channelId:_}=Ce(y,h?.runId,"agent_end");xe(m),await ke(m.traceId),m.isClosing=!0;let A=Date.now();m.stepSpanId&&te(m,A,m.stepAwaitingToolResults?"agent_end":"stop",_);let F=m.agentSpanId,B=A,ne;if(F){let pe=Array.isArray(h.messages)?h.messages.length:0,Ge=ax(h.messages);ne={"agent.duration_ms":h.durationMs||0,"agent.message_count":pe,"agent.tool_call_count":Ge,"gen_ai.usage.input_tokens":m.lastLlmUsage?.input||0,"gen_ai.usage.output_tokens":m.lastLlmUsage?.output||0,"gen_ai.usage.total_tokens":m.lastLlmUsage?.total||0},m.sessionId&&(ne["openclaw.session.id"]=m.sessionId||_,ne["gen_ai.session.id"]=m.sessionId||_),m.userInput&&(ne["gen_ai.input.messages"]=ft(JSON.stringify([{role:"user",parts:[{type:"text",content:String(m.userInput)}]}]))),m.agentSpanId=void 0,m.agentStartTime=void 0}let ue=m;if(ue.rootSpanStartTime||F){let pe=ue.rootSpanId,Ge=ue.rootSpanStartTime,Yt=ue.userInput,Be=m.sessionId||ue.sessionId;Zi(_,ue);let Ne=g,Me=setTimeout(async()=>{K.delete(Me);try{let be=m.lastOutput||ue.lastOutput;if(F&&ne&&Ne&&!Ne.isDisposed&&(be&&(ne["gen_ai.output.messages"]=Wn([typeof be=="string"?be:JSON.stringify(be)])),Ne.endSpanById(F,B,ne),E?.debug(`${D} [span] Ended agent span: spanId=${F}, traceId=${ue.traceId}, duration=${h.durationMs}ms`)),Ge&&Ne&&!Ne.isDisposed){let Rt=Date.now(),Qe={"request.duration_ms":Rt-Ge};Be&&(Qe["openclaw.session.id"]=Be,Qe["gen_ai.session.id"]=Be),Yt&&(Qe["gen_ai.input.messages"]=ft(JSON.stringify([{role:"user",parts:[{type:"text",content:String(Yt)}]}]))),be&&(Qe["gen_ai.output.messages"]=Wn([typeof be=="string"?be:JSON.stringify(be)])),Ne.endSpanById(pe,Rt,Qe),E?.debug(`${D} [span] Ended entry span: spanId=${pe}, traceId=${ue.traceId}, duration=${Rt-Ge}ms`)}ge(m.runId),Wt(ue),Ne&&!Ne.isDisposed&&(await Ne.flush(),E?.debug(`${D} [span] Flushed after agent_end, traceId=${ue.traceId}`))}catch(be){E?.warn(`${D} agent_end delayed cleanup failed: ${String(be)}`)}},100);K.add(Me)}else ge(m.runId),Wt(ue),g&&await g.flush()}catch(y){E?.error(`${D} [hook] agent_end UNCAUGHT ERROR: ${String(y)}`,y instanceof Error?y.stack:void 0)}},{priority:-100}),d.on("before_reset",async(h,T)=>{try{if(!M("before_reset")||!g)return;let y=qe(T),{ctx:m}=Ce(y,h?.runId,"before_reset");g?.patchOpenSpanAttributes(m.rootSpanId,{"openclaw.reset":!0,"openclaw.reset.reason":h?.reason??"user_request"})}catch(y){E?.warn(`${D} [hook] before_reset ERROR: ${String(y)}`)}},{priority:-100}),E?.debug(`${D} Registered trace hook handlers (v2 \u2014 \u5B8C\u6574\u94FE\u8DEF\u8FFD\u8E2A).`)}function ei(d){d!==c&&(z&&(z(),z=null),c=d,c&&g&&!g.isDisposed&&(z=c.subscribe(ti)))}function ti(d){if(!g||g.isDisposed||!(d.secretId!==i||d.secretKey!==r||(d.token||"")!==(s||"")))return;i=d.secretId,r=d.secretKey,s=d.token;let T=new Xi.Producer(q(d));g.updateProducer(T,e),E?.debug(`${D} \u5171\u4EAB\u51ED\u8BC1\u7BA1\u7406\u5668\u66F4\u65B0\u540E\uFF0CProducer \u5DF2\u91CD\u5EFA\uFF08\u65B0\u51ED\u8BC1\uFF09`)}return{service:Zn,registerHooks:Qn,updateSharedCredentialManager:ei}}var Et=ii(ys(),1);var ws={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},Ze="[diagnostics-metrics-cls/log]";function Yc(t,e){if(!t||!(t.enableLogReport===!0))return null;let i=typeof t.logTopicId=="string"?t.logTopicId.trim():"";if(!i)return null;let r=typeof e?.endpoint=="string"?e.endpoint.trim():"";if(!r)return null;let s="",a="";try{s=typeof e?.secretId=="string"?De(e.secretId.trim()):""}catch{}try{a=typeof e?.secretKey=="string"?De(e.secretKey.trim()):""}catch{}let o=typeof e?.token=="string"?e.token.trim():void 0,c=typeof e?.credentialMode=="string"&&e.credentialMode.trim()==="cvmRole"?"cvmRole":"static",l=typeof e?.roleName=="string"?e.roleName.trim():void 0;if(!(c==="cvmRole"?!!(r&&l):!!(r&&s&&a)))return null;let f=typeof t.source=="string"&&t.source.trim()?t.source.trim():"openclaw",x=t.enableGatewayLog!==!1,S=t.enableSessionLog!==!1,b=typeof t.minLevel=="string"&&ws[t.minLevel]!==void 0?t.minLevel:"info",w=typeof t.sendTimeThreshold=="number"&&t.sendTimeThreshold>=1?t.sendTimeThreshold:2,g=typeof t.sendCountThreshold=="number"&&t.sendCountThreshold>=1?Math.floor(t.sendCountThreshold):1e3;return{endpoint:r,secretId:s,secretKey:a,token:o,credentialMode:c,roleName:l,logTopicId:i,source:f,enableGatewayLog:x,enableSessionLog:S,minLevel:b,sendTimeThreshold:w,sendCountThreshold:g}}function RS(t){let e=t._meta,n=(e?.logLevelName??"INFO").toLowerCase(),i=e?.date instanceof Date?e.date.getTime():Date.now(),r=e?.name,s=Object.entries(t).filter(([l])=>/^\d+$/.test(l)).sort((l,u)=>Number(l[0])-Number(u[0])).map(([,l])=>l),a,o={};if(typeof s[0]=="string"&&s[0].trim().startsWith("{"))try{let l=JSON.parse(s[0]);if(l&&typeof l=="object"&&!Array.isArray(l)){typeof l.subsystem=="string"&&(a=l.subsystem);for(let[u,f]of Object.entries(l))u!=="subsystem"&&(typeof f=="string"||typeof f=="number"||typeof f=="boolean")&&(o[u]=String(f));s.shift()}}catch{}let c="";for(let l=s.length-1;l>=0;l--)if(typeof s[l]=="string"){c=String(s[l]),s.splice(l,1);break}if(!c&&s.length===1){try{c=JSON.stringify(s[0])}catch{c=String(s[0])}s.length=0}if(c||(c="(empty)"),s.length>0)try{o.args=JSON.stringify(s)}catch{o.args=String(s)}return{level:n,message:c,timestamp:i,subsystem:a,logger:r,extra:o}}function kS(t){let e=typeof t.role=="string"?t.role:"unknown",n;try{n=JSON.stringify(t)}catch{n=String(t)}let i,r,s,a;if(e==="toolResult")typeof t.toolCallId=="string"&&(i=t.toolCallId),typeof t.toolName=="string"&&(r=t.toolName);else if(e==="assistant"){typeof t.stopReason=="string"&&(s=t.stopReason);let c=(Array.isArray(t.content)?t.content:[]).filter(l=>l!==null&&typeof l=="object"&&l.type==="tool_use").length;c>0&&(a=c)}return{role:e,content:n,toolCallId:i,toolName:r,stopReason:s,toolCallCount:a}}function fx(t,e,n){let i={...t},r=e,s=null,a=null,o=null,c=null,l=!1,u=ws[i.minLevel??"info"]??2;function f(C,z,q){return{topic_id:i.logTopicId,endpoint:i.endpoint,credential:{secretId:C,secretKey:z,...q?{token:q}:{}},time:i.sendTimeThreshold??2,count:i.sendCountThreshold??1e3,onSendLogsError:N=>{if(N!==null&&typeof N=="object"&&N.status===200)return;let I;if(N instanceof Error)I=N.message;else if(typeof N=="object"&&N!==null)try{I=JSON.stringify(N)}catch{I=Object.prototype.toString.call(N)}else I=String(N);c?.warn(`${Ze} \u65E5\u5FD7\u4E0A\u4F20\u5931\u8D25 - ${I}`)}}}function x(C,z){if(s)try{let q=C;if(n){let I=n();(I.cvmInstanceId||I.cvmInstanceName||I.cvmInstanceIntraIp)&&(q={...C},I.cvmInstanceId&&(q.cvm_instance_id=I.cvmInstanceId),I.cvmInstanceName&&(q.cvm_instance_name=I.cvmInstanceName),I.cvmInstanceIntraIp&&(q.cvm_instance_intra_ip=I.cvmInstanceIntraIp))}let N=new Et.LogItem;N.setTime(z);for(let[I,H]of Object.entries(q))N.pushBack(new Et.Content(I,H));s.send(N).catch(I=>{let H;if(I instanceof Error)H=I.message;else try{H=JSON.stringify(I)}catch{H=Object.prototype.toString.call(I)}c?.warn(`${Ze} send \u5931\u8D25: ${H}`)})}catch{}}let S={id:"diagnostics-metrics-cls-log",async start(C){if(c=C.logger,n)try{await Ur(C.logger,C.stateDir),l=!0}catch(I){c?.warn(`${Ze} \u5B9E\u4F8B\u5143\u6570\u636E\u521D\u59CB\u5316\u5931\u8D25\uFF0CCVM \u5143\u5B57\u6BB5\u5C06\u7F3A\u5931: ${String(I)}`)}let z=i.secretId,q=i.secretKey,N=i.token;if(r){let I=r.getCredentialSnapshot();z=I.secretId,q=I.secretKey,N=I.token,o=r.subscribe(H=>{if(s)try{s=new Et.Producer(f(H.secretId,H.secretKey,H.token)),c?.debug(`${Ze} \u51ED\u8BC1\u5DF2\u66F4\u65B0\uFF0CProducer \u5DF2\u91CD\u5EFA`)}catch(G){c?.warn(`${Ze} \u51ED\u8BC1\u66F4\u65B0\u540E\u91CD\u5EFA Producer \u5931\u8D25: ${String(G)}`)}})}try{s=new Et.Producer(f(z,q,N))}catch(I){c?.error(`${Ze} \u521B\u5EFA Producer \u5931\u8D25: ${String(I)}`),l&&(Ii(),l=!1);return}if(c?.info(`${Ze} \u542F\u52A8\uFF0Cendpoint=${i.endpoint}\uFF0ClogTopicId=${i.logTopicId}\uFF0CenableGatewayLog=${i.enableGatewayLog}\uFF0CenableSessionLog=${i.enableSessionLog}\uFF0CminLevel=${i.minLevel}`),i.enableGatewayLog){let I="openclaw/plugin-sdk/diagnostics-otel",H;try{H=(await import(I)).registerLogTransport}catch{}H?a=H(G=>{if(s)try{let L=RS(G);if((ws[L.level]??0)<u)return;let Z={log_type:"gateway",level:L.level,message:L.message,source:i.source??"openclaw"};L.subsystem&&(Z.subsystem=L.subsystem),L.logger&&(Z.logger=L.logger);for(let[O,me]of Object.entries(L.extra))Z[O]=me;x(Z,Math.floor(L.timestamp/1e3))}catch{}}):c?.warn(`${Ze} registerLogTransport \u5728\u5F53\u524D openclaw \u7248\u672C\uFF08>=2026.4.27\uFF09\u4E2D\u5DF2\u79FB\u9664\uFF0Cgateway \u65E5\u5FD7\u4E0A\u62A5\u5DF2\u8DF3\u8FC7`)}},async stop(){a?.(),a=null,o?.(),o=null,s=null,l&&(Ii(),l=!1),c=null}};function b(C){let z=C.logTopicId!==i.logTopicId,q=C.endpoint!==i.endpoint;if(i={...C},u=ws[i.minLevel??"info"]??2,(z||q)&&s)try{let N=i.secretId,I=i.secretKey,H=i.token;if(r){let G=r.getCredentialSnapshot();N=G.secretId,I=G.secretKey,H=G.token}s=new Et.Producer(f(N,I,H)),c?.info(`${Ze} \u914D\u7F6E\u70ED\u66F4\u65B0\uFF0CProducer \u5DF2\u91CD\u5EFA\uFF0ClogTopicId=${i.logTopicId}\uFF0Cendpoint=${i.endpoint}`)}catch(N){c?.warn(`${Ze} \u914D\u7F6E\u70ED\u66F4\u65B0\u540E\u91CD\u5EFA Producer \u5931\u8D25: ${String(N)}`)}}function w(C){if(C!==r&&(o?.(),o=null,r=C,s&&r)){let z=r.getCredentialSnapshot();try{s=new Et.Producer(f(z.secretId,z.secretKey,z.token)),c?.debug(`${Ze} \u51ED\u8BC1\u7BA1\u7406\u5668\u5DF2\u66F4\u65B0\uFF0CProducer \u5DF2\u91CD\u5EFA`)}catch(q){c?.warn(`${Ze} \u51ED\u8BC1\u7BA1\u7406\u5668\u66F4\u65B0\u540E\u91CD\u5EFA Producer \u5931\u8D25: ${String(q)}`)}o=r.subscribe(q=>{if(s)try{s=new Et.Producer(f(q.secretId,q.secretKey,q.token)),c?.debug(`${Ze} \u51ED\u8BC1\u5DF2\u66F4\u65B0\uFF0CProducer \u5DF2\u91CD\u5EFA`)}catch(N){c?.warn(`${Ze} \u51ED\u8BC1\u66F4\u65B0\u540E\u91CD\u5EFA Producer \u5931\u8D25: ${String(N)}`)}})}}function g(C){i.enableSessionLog&&C.on("before_message_write",(z,q)=>{if(s)try{let N=z?.message;if(!N)return;let I=q?.sessionKey??z?.sessionKey??"",H=q?.agentId??z?.agentId??"",G=Math.floor(Date.now()/1e3),L=kS(N),J={log_type:"session",role:L.role,content:L.content,source:i.source??"openclaw"};L.toolCallId&&(J.tool_call_id=L.toolCallId),L.toolName&&(J.tool_name=L.toolName),L.stopReason&&(J.stop_reason=L.stopReason),L.toolCallCount!==void 0&&(J.tool_calls=String(L.toolCallCount)),I&&(J.session_key=I),H&&(J.agent_id=H),x(J,G)}catch{}})}return{service:S,registerHooks:g,updateConfig:b,updateSharedCredentialManager:w}}import OS from"node:http";import CS from"node:https";import{URL as NS}from"node:url";var xx="http://metadata.tencentyun.com/latest/meta-data/",AS=xx+"cam/security-credentials/",LS=xx+"cam/service-role-security-credentials/",PS="custom-role-",MS=5e3,mx=3600*1e3,hx=8192,gx=3;function vx(t,e=0){if(e>gx)return Promise.reject(new Error(`Too many redirects (>${gx}) for ${t}`));let n;try{n=new NS(t)}catch{return Promise.reject(new Error(`Invalid URL: ${t}`))}let i=n.protocol==="https:"?CS:OS;return new Promise((r,s)=>{let a=i.get(t,{timeout:MS},o=>{let c=o.statusCode??0;if(c>=300&&c<400&&o.headers.location){o.resume(),vx(o.headers.location,e+1).then(r,s);return}if(c!==200){o.resume(),s(new Error(`HTTP ${c} for ${t}`));return}let l=[],u=0,f=!1;o.on("data",x=>{if(!f){if(u+=x.length,u>hx){f=!0,o.destroy(),s(new Error(`Response body too large (>${hx} bytes) for ${t}`));return}l.push(x)}}),o.on("end",()=>{f||r(Buffer.concat(l).toString("utf-8").trim())}),o.on("error",x=>{f||s(x)})});a.on("timeout",()=>{a.destroy(),s(new Error(`Request timeout for ${t}`))}),a.on("error",s)})}var Zc=class t{constructor(e){this.credentialTask=null;this.lastResolvedExpiredTime=null;this.roleName=e}static{this.MAX_EXPIRED_RETRY=3}getRoleUrl(){return this.roleName.indexOf(PS)===0?AS+this.roleName:LS+this.roleName}async fetchRoleCredential(){let e=await vx(this.getRoleUrl()),n;try{n=JSON.parse(e)}catch{throw new Error(`Failed to parse credential response for role [${this.roleName}]: ${e.slice(0,200)}`)}if(n.Code!=="Success")throw new Error(`Get credential from metadata server by role name [${this.roleName}] failed, Code: ${n.Code}`);if(!n.TmpSecretId||!n.TmpSecretKey)throw new Error(`Credential response for role [${this.roleName}] missing TmpSecretId or TmpSecretKey`);return n}async getCredential(){return this.getCredentialWithRetry(0)}async getCredentialWithRetry(e){this.credentialTask||(this.credentialTask=this.fetchRoleCredential());let n;try{n=await this.credentialTask}catch(i){throw this.credentialTask=null,i}if(n.ExpiredTime*1e3-mx<=Date.now()){if(e>=t.MAX_EXPIRED_RETRY)throw this.credentialTask=null,new Error(`Credential for role [${this.roleName}] is still expired after ${t.MAX_EXPIRED_RETRY} retries (ExpiredTime=${n.ExpiredTime}, now=${Math.floor(Date.now()/1e3)})`);return this.credentialTask=null,this.getCredentialWithRetry(e+1)}return this.lastResolvedExpiredTime=n.ExpiredTime,{secretId:n.TmpSecretId,secretKey:n.TmpSecretKey,token:n.Token,expiredTime:n.ExpiredTime}}invalidate(){this.credentialTask=null,this.lastResolvedExpiredTime=null}isExpiringSoon(){return this.lastResolvedExpiredTime===null?!0:this.lastResolvedExpiredTime*1e3-mx<=Date.now()}},Xn=new Map;function jS(t){let e=Xn.get(t);return e||(e=new Zc(t),Xn.set(t,e)),e}async function yx(t){if(!t)throw new Error("roleName is required for CVM role credential provider");return jS(t).getCredential()}function _s(t){let e=Xn.get(t);return e?e.isExpiringSoon():!0}function bx(t){if(t)Xn.get(t)?.invalidate();else for(let e of Xn.values())e.invalidate()}function wx(){Xn.clear()}var qS=300*1e3,Qc=class t{constructor(e){this.listeners=[];this.refreshTimer=null;this.started=!1;this.stopped=!1;this.log=null;this.refreshingPromise=null;this.credentialMode=e.credentialMode,this.roleName=e.roleName,this.secretId=e.secretId,this.secretKey=e.secretKey,this.token=e.token,this.refreshIntervalMs=e.refreshIntervalMs??qS}static{this.LOG_PREFIX="[diagnostics-metrics-cls/shared-credential]"}setLogger(e){this.log=e}getCredentialMode(){return this.credentialMode}getRoleName(){return this.roleName}getCredentialSnapshot(){return{secretId:this.secretId,secretKey:this.secretKey,token:this.token}}subscribe(e){return this.listeners.push(e),()=>{let n=this.listeners.indexOf(e);n>=0&&this.listeners.splice(n,1)}}async start(){this.started||(this.started=!0,this.stopped=!1,this.credentialMode==="cvmRole"&&(await this.refreshCredentialInternal(),this.refreshTimer=setInterval(()=>{_s(this.roleName)&&this.refreshCredentialInternal()},this.refreshIntervalMs),typeof this.refreshTimer.unref=="function"&&this.refreshTimer.unref(),this.log?.debug(`${t.LOG_PREFIX} cvmRole \u51ED\u8BC1\u5B9A\u65F6\u5237\u65B0\u5DF2\u542F\u52A8\uFF0C\u95F4\u9694 ${this.refreshIntervalMs}ms`)))}stop(){this.stopped=!0,this.started=!1,this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null),this.listeners=[],wx()}async forceRefresh(){return this.credentialMode==="cvmRole"?this.refreshingPromise?(this.log?.warn(`${t.LOG_PREFIX} \u6536\u5230\u5F3A\u5236\u5237\u65B0\u8BF7\u6C42\uFF0C\u5DF2\u6709\u5237\u65B0\u6B63\u5728\u8FDB\u884C\u4E2D\uFF0C\u7B49\u5F85\u5B8C\u6210`),await this.refreshingPromise,!0):_s(this.roleName)?(this.log?.warn(`${t.LOG_PREFIX} \u6536\u5230\u5F3A\u5236\u5237\u65B0\u8BF7\u6C42\uFF0C\u4E34\u65F6\u5BC6\u94A5\u5DF2\u8FC7\u671F\uFF0C\u6B63\u5728\u5237\u65B0 cvmRole \u4E34\u65F6\u5BC6\u94A5`),bx(this.roleName),await this.refreshCredentialInternal(),!0):(this.log?.warn(`${t.LOG_PREFIX} \u6536\u5230\u5F3A\u5236\u5237\u65B0\u8BF7\u6C42\uFF0C\u4F46\u4E34\u65F6\u5BC6\u94A5\u5C1A\u672A\u8FC7\u671F\uFF0C\u8DF3\u8FC7\u5237\u65B0\uFF08401 \u53EF\u80FD\u7531\u6743\u9650\u914D\u7F6E\u7B49\u539F\u56E0\u5BFC\u81F4\uFF09`),!1):(this.log?.warn(`${t.LOG_PREFIX} \u6536\u5230\u5F3A\u5236\u5237\u65B0\u8BF7\u6C42\uFF0C\u5F53\u524D\u4E3A static \u51ED\u8BC1\u6A21\u5F0F\uFF0C\u65E0\u6CD5\u81EA\u52A8\u5237\u65B0`),!1)}updateStaticCredential(e,n,i){(e!==this.secretId||n!==this.secretKey||(i||"")!==(this.token||""))&&(this.secretId=e,this.secretKey=n,this.token=i,this.notifyListeners(),this.log?.debug(`${t.LOG_PREFIX} \u9759\u6001\u51ED\u8BC1\u5DF2\u66F4\u65B0`))}async updateMode(e,n,i,r,s){let a=e!==this.credentialMode,o=n!==this.roleName;this.credentialMode=e,this.roleName=n,e==="static"?(this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null),i!==void 0&&r!==void 0&&(this.secretId=i,this.secretKey=r,this.token=s),this.notifyListeners()):e==="cvmRole"&&(this.started&&(a||o)&&await this.refreshCredentialInternal(),!this.refreshTimer&&this.started&&(this.refreshTimer=setInterval(()=>{_s(this.roleName)&&this.refreshCredentialInternal()},this.refreshIntervalMs),typeof this.refreshTimer.unref=="function"&&this.refreshTimer.unref()))}async refreshCredentialInternal(){if(!this.stopped){if(this.refreshingPromise){await this.refreshingPromise;return}this.refreshingPromise=this.doRefresh();try{await this.refreshingPromise}finally{this.refreshingPromise=null}}}async doRefresh(){try{let e=await yx(this.roleName);if(this.stopped)return;let n=e.secretId!==this.secretId||e.secretKey!==this.secretKey||(e.token||"")!==(this.token||"");this.secretId=e.secretId,this.secretKey=e.secretKey,this.token=e.token,n&&(this.notifyListeners(),this.log?.debug(`${t.LOG_PREFIX} cvmRole \u4E34\u65F6\u5BC6\u94A5\u5DF2\u5237\u65B0`))}catch(e){this.log?.warn(`${t.LOG_PREFIX} cvmRole \u4E34\u65F6\u5BC6\u94A5\u5237\u65B0\u5931\u8D25: ${String(e)}`)}}notifyListeners(){let e=this.getCredentialSnapshot();for(let n of this.listeners)try{n(e)}catch(i){this.log?.warn(`${t.LOG_PREFIX} \u51ED\u8BC1\u53D8\u66F4\u901A\u77E5\u56DE\u8C03\u5F02\u5E38: ${String(i)}`)}}};function _x(t){if(!t)return null;let e=typeof t.credentialMode=="string"&&t.credentialMode.trim()==="cvmRole"?"cvmRole":"static",n=typeof t.roleName=="string"?t.roleName.trim():"",i=typeof t.secretId=="string"?t.secretId.trim():"",r=typeof t.secretKey=="string"?t.secretKey.trim():"",s=typeof t.token=="string"?t.token.trim():void 0,a=typeof t.credentialRefreshIntervalMs=="number"&&t.credentialRefreshIntervalMs>=6e4?t.credentialRefreshIntervalMs:void 0;return new Qc({credentialMode:e,roleName:n,secretId:i,secretKey:r,token:s,refreshIntervalMs:a})}var Yi=null,mt=null,Yn=null,Tx="";function $S(t){if(!t)return"";let e=["credentialMode","roleName","secretId","secretKey","token","credentialRefreshIntervalMs"],n=[];for(let i of e){let r=t[i];n.push(`${i}=${typeof r=="string"||typeof r=="number"?String(r):""}`)}return n.join("|")}var BS={id:"clawpro-diagnostics-metrics-cls",name:"Diagnostics Metrics",description:"CLS\u8BCA\u65AD\u6307\u6807\u5BFC\u51FA\u63D2\u4EF6\uFF1APrometheus \u6307\u6807\uFF08pull/remote-write\uFF09+ \u5168\u94FE\u8DEF Trace",configSchema:{type:"object",properties:{prometheus:{type:"object",description:"Prometheus \u6307\u6807\u5BFC\u51FA\u914D\u7F6E",properties:{enabled:{type:"boolean",default:!0,description:"\u662F\u5426\u542F\u7528 Prometheus \u6307\u6807\u5BFC\u51FA"},metric_prefix:{type:"string",default:"openclaw",description:"\u6307\u6807\u540D\u79F0\u524D\u7F00"},pull:{type:"boolean",default:!0,description:"\u662F\u5426\u542F\u7528 /metrics HTTP pull \u7AEF\u70B9"},default_metrics:{type:"boolean",default:!0,description:"\u662F\u5426\u91C7\u96C6 Node.js \u9ED8\u8BA4\u6307\u6807"},push_interval_ms:{type:"number",default:3e4,description:"Remote Write \u63A8\u9001\u95F4\u9694\uFF08\u6BEB\u79D2\uFF09"}}},cls:{type:"object",description:"\u817E\u8BAF\u4E91 CLS \u51ED\u8BC1\u4E0E\u63A5\u5165\u914D\u7F6E",properties:{endpoint:{type:"string",description:"CLS \u63A5\u5165\u70B9"},secretId:{type:"string",description:"\u817E\u8BAF\u4E91 SecretId"},secretKey:{type:"string",description:"\u817E\u8BAF\u4E91 SecretKey"},metricTopicId:{type:"string",description:"\u6307\u6807\u65E5\u5FD7\u4E3B\u9898 ID"},credentialMode:{type:"string",enum:["static","cvmRole"],description:"\u51ED\u8BC1\u6A21\u5F0F"},roleName:{type:"string",description:"CVM \u89D2\u8272\u540D\u79F0"},enableReport:{type:"boolean",default:!0,description:"\u662F\u5426\u542F\u7528\u6307\u6807\u63A8\u9001"}}},log:{type:"object",description:"CLS \u65E5\u5FD7\u4E0A\u62A5\u914D\u7F6E\uFF0C\u5C06 gateway \u8FD0\u884C\u65E5\u5FD7\u3001\u4F1A\u8BDD\u65E5\u5FD7\uFF08session JSONL\uFF09\u5B9E\u65F6\u4E0A\u62A5\u5230 CLS",properties:{enableLogReport:{type:"boolean",default:!1,description:"\u662F\u5426\u542F\u7528\u65E5\u5FD7\u4E0A\u62A5\uFF0C\u9ED8\u8BA4 false"},logTopicId:{type:"string",description:"\u65E5\u5FD7\u4E0A\u62A5\u4F7F\u7528\u7684 CLS \u65E5\u5FD7\u4E3B\u9898 ID"},source:{type:"string",description:"\u65E5\u5FD7\u6765\u6E90\u6807\u8BC6\uFF0C\u9ED8\u8BA4 openclaw"},enableGatewayLog:{type:"boolean",default:!0,description:"\u662F\u5426\u542F\u7528 gateway \u8FD0\u884C\u65E5\u5FD7\u4E0A\u62A5\uFF0C\u9ED8\u8BA4 true"},enableSessionLog:{type:"boolean",default:!0,description:"\u662F\u5426\u542F\u7528\u4F1A\u8BDD\u65E5\u5FD7\u4E0A\u62A5\uFF08session JSONL\uFF09\uFF0C\u9ED8\u8BA4 true"},minLevel:{type:"string",description:"\u6700\u4F4E\u4E0A\u62A5\u65E5\u5FD7\u7EA7\u522B\uFF08\u4EC5\u5BF9 gateway \u8FD0\u884C\u65E5\u5FD7\u751F\u6548\uFF09\uFF0C\u9ED8\u8BA4 info"},sendTimeThreshold:{type:"number",default:2,description:"CLS SDK \u5F02\u6B65\u53D1\u9001\u65F6\u95F4\u9608\u503C\uFF08\u79D2\uFF09\uFF0C\u9ED8\u8BA4 2"},sendCountThreshold:{type:"number",default:1e3,description:"CLS SDK \u5F02\u6B65\u53D1\u9001\u6761\u6570\u9608\u503C\uFF0C\u9ED8\u8BA4 1000"}}},trace:{type:"object",description:"CLS \u5168\u94FE\u8DEF Trace \u8FFD\u8E2A\u914D\u7F6E",properties:{enabled:{type:"boolean",default:!1,description:"\u662F\u5426\u542F\u7528 Trace \u94FE\u8DEF\u8FFD\u8E2A"},traceTopicId:{type:"string",description:"Trace \u65E5\u5FD7\u4E3B\u9898 ID"},serviceName:{type:"string",default:"openclaw-agent",description:"\u670D\u52A1\u540D\u79F0"},debug:{type:"boolean",default:!1,description:"\u662F\u5426\u5F00\u542F\u8C03\u8BD5\u65E5\u5FD7"},batchSize:{type:"number",default:10,description:"Span \u7F13\u51B2\u533A\u5927\u5C0F"},flushIntervalMs:{type:"number",default:5e3,description:"Span \u7F13\u51B2\u533A\u6700\u5927\u7B49\u5F85\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09"},enabledHooks:{type:"array",items:{type:"string"},description:"\u542F\u7528\u7684 hook \u5217\u8868\uFF0C\u4E0D\u8BBE\u7F6E\u5219\u5168\u90E8\u542F\u7528"}}}}},register(t){if(t.registrationMode==="cli-metadata")return;let e=t.pluginConfig?.prometheus,n=t.pluginConfig?.cls,i=t.pluginConfig?.trace,r=t.pluginConfig?.log,s;if(n){if(s={...n},typeof n.secretId=="string")try{s.secretId=De(n.secretId)}catch{}if(typeof n.secretKey=="string")try{s.secretKey=De(n.secretKey)}catch{}}let a=$S(s),o;if(Yn&&Tx===a)o=Yn;else if(Yn&&s){let x=s.credentialMode==="cvmRole"?"cvmRole":"static",S=typeof s.roleName=="string"?s.roleName:"",b=typeof s.secretId=="string"?s.secretId:"",w=typeof s.secretKey=="string"?s.secretKey:"",g=typeof s.token=="string"?s.token:void 0;Yn.updateMode(x,S,b,w,g),o=Yn}else o=_x(s),Yn=o;Tx=a;let c={...e,...n},u=Rd(c,o,(x,S)=>{if(!mt||!x||!S)return;let b={...r??{},enableLogReport:x,logTopicId:S},w=Yc(b,n);w&&mt.updateConfig(w)});if(o&&t.registerService({id:"diagnostics-metrics-cls-shared-credential",async start(x){o.setLogger(x.logger),await o.start()},async stop(x){x.logger?.debug?.("[diagnostics-metrics-cls] shared-credential service stopping"),o.stop()}}),t.registerService(u),t.registerHttpRoute({path:"/metrics",auth:"plugin",match:"exact",replaceExisting:!0,handler:async(x,S)=>{let b=u.getExports();if(!b?.registry)return S.writeHead(503,{"Content-Type":"text/plain"}),S.end(`Prometheus metrics not initialized
28
- `),!0;try{let w=await b.registry.metrics();S.writeHead(200,{"Content-Type":b.registry.contentType}),S.end(w)}catch{S.writeHead(500,{"Content-Type":"text/plain"}),S.end(`Failed to collect metrics
29
- `)}return!0}}),!Yi){let x=Xc(i,n);x.sharedCredentialManager=o,Yi=dx(x)}if(Yi.updateSharedCredentialManager(o),Yi.registerHooks(t),t.registerService(Yi.service),r?.enableLogReport===!0){let x=Yc(r,n);x&&(mt?mt.updateConfig(x):mt=fx(x,o,_t),mt.updateSharedCredentialManager(o),mt.registerHooks(t),t.registerService(mt.service))}else mt&&(mt.service.stop(),mt=null)}},IO=BS;export{IO as default};
30
- /*! Bundled license information:
31
-
32
- long/umd/index.js:
33
- (**
34
- * @license
35
- * Copyright 2009 The Closure Library Authors
36
- * Copyright 2020 Daniel Wirtz / The long.js Authors.
37
- *
38
- * Licensed under the Apache License, Version 2.0 (the "License");
39
- * you may not use this file except in compliance with the License.
40
- * You may obtain a copy of the License at
41
- *
42
- * http://www.apache.org/licenses/LICENSE-2.0
43
- *
44
- * Unless required by applicable law or agreed to in writing, software
45
- * distributed under the License is distributed on an "AS IS" BASIS,
46
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
47
- * See the License for the specific language governing permissions and
48
- * limitations under the License.
49
- *
50
- * SPDX-License-Identifier: Apache-2.0
51
- *)
52
-
53
- mime-db/index.js:
54
- (*!
55
- * mime-db
56
- * Copyright(c) 2014 Jonathan Ong
57
- * Copyright(c) 2015-2022 Douglas Christopher Wilson
58
- * MIT Licensed
59
- *)
60
-
61
- mime-types/index.js:
62
- (*!
63
- * mime-types
64
- * Copyright(c) 2014 Jonathan Ong
65
- * Copyright(c) 2015 Douglas Christopher Wilson
66
- * MIT Licensed
67
- *)
68
-
69
- axios/dist/node/axios.cjs:
70
- (*! Axios v1.15.1 Copyright (c) 2026 Matt Zabriskie and contributors *)
71
- */
8
+ `}registerMetric(e){if(this._metrics[e.name]&&this._metrics[e.name]!==e)throw new Error(`A metric with the name ${e.name} has already been registered.`);this._metrics[e.name]=e}clear(){this._metrics={},this._defaultLabels={}}async getMetricsAsJSON(){let e=[],n=Object.keys(this._defaultLabels),r=[];for(let o of this.getMetricsAsArray())r.push(o.get());let s=await Promise.all(r);for(let o of s){if(o.values&&n.length>0)for(let i of o.values){i.labels=Object.assign({},i.labels);for(let c of n)i.labels[c]=i.labels[c]||this._defaultLabels[c]}e.push(o)}return e}removeSingleMetric(e){delete this._metrics[e]}getSingleMetricAsString(e){return this.getMetricsAsString(this._metrics[e])}getSingleMetric(e){return this._metrics[e]}setDefaultLabels(e){this._defaultLabels=e}resetMetrics(){for(let e in this._metrics)this._metrics[e].reset()}get contentType(){return this._contentType}setContentType(e){if(e===t.OPENMETRICS_CONTENT_TYPE||e===t.PROMETHEUS_CONTENT_TYPE)this._contentType=e;else throw new Error(`Content type ${e} is unsupported`)}static merge(e){let n=e[0].contentType;for(let o of e)if(o.contentType!==n)throw new Error("Registers can only be merged if they have the same content type");let r=new t(n);return e.reduce((o,i)=>o.concat(i.getMetricsAsArray()),[]).forEach(r.registerMetric,r),r}};function _r(t,e){let{hasOwnProperty:n}=Object.prototype,r=[];for(let[s,o]of Object.entries(t))(!e||!n.call(e,s))&&r.push(`${s}="${Jl(o)}"`);return r}var $o=new WeakMap;function zl(t){let e=$o.get(t);if(e)return e;let r=_r(t).join(",");return $o.set(t,r),r}function Jl(t){return typeof t!="string"?t:br(t).replace(/"/g,'\\"')}function br(t){return t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n")}function Wl(t){return t.replace(/_total$/,"")}wr.exports=wn;wr.exports.globalRegistry=new wn});var He=B(In=>{"use strict";var Hl=ne("util"),Xl=/^[a-zA-Z_:][a-zA-Z0-9_:]*$/,Yl=/^[a-zA-Z_][a-zA-Z0-9_]*$/;In.validateMetricName=function(t){return Xl.test(t)};In.validateLabelName=function(t=[]){return t.every(e=>Yl.test(e))};In.validateLabel=function(e,n){for(let r in n)if(!e.includes(r))throw new Error(`Added label "${r}" is not included in initial labelset: ${Hl.inspect(e)}`)}});var Pt=B((Pf,Lo)=>{"use strict";var Ir=ct(),{isObject:Ql}=Ce(),{validateMetricName:Zl,validateLabelName:eu}=He(),Tr=class{constructor(e,n={}){if(!Ql(e))throw new TypeError("constructor expected a config object");if(Object.assign(this,{labelNames:[],registers:[Ir.globalRegistry],aggregator:"sum",enableExemplars:!1},n,e),this.registers||(this.registers=[Ir.globalRegistry]),!this.help)throw new Error("Missing mandatory help parameter");if(!this.name)throw new Error("Missing mandatory name parameter");if(!Zl(this.name))throw new Error("Invalid metric name");if(!eu(this.labelNames))throw new Error("Invalid label name");if(this.collect&&typeof this.collect!="function")throw new Error('Optional "collect" parameter must be a function');this.labelNames?this.sortedLabelNames=[...this.labelNames].sort():this.sortedLabelNames=[],this.reset();for(let r of this.registers){if(this.enableExemplars&&r.contentType===Ir.PROMETHEUS_CONTENT_TYPE)throw new TypeError("Exemplars are supported only on OpenMetrics registries");r.registerMetric(this)}}reset(){}};Lo.exports={Metric:Tr}});var vr=B((Af,Do)=>{"use strict";var Sr=class{constructor(e={},n=null){this.labelSet=e,this.value=n}validateExemplarLabelSet(e){let n="";for(let[r,s]of Object.entries(e))n+=`${r}${s}`;if(n.length>128)throw new RangeError("Label set size must be smaller than 128 UTF-8 chars")}};Do.exports=Sr});var Rr=B(($f,Fo)=>{"use strict";var tu=ne("util"),{hashObject:nu,isObject:Bo,getLabels:jo,removeLabels:ru,nowTimestamp:su}=Ce(),{validateLabel:Uo}=He(),{Metric:ou}=Pt(),iu=vr(),Er=class extends ou{constructor(e){super(e),this.type="counter",this.defaultLabels={},this.defaultValue=1,this.defaultExemplarLabelSet={},e.enableExemplars?(this.enableExemplars=!0,this.inc=this.incWithExemplar):this.inc=this.incWithoutExemplar}incWithoutExemplar(e,n){let r="";if(Bo(e)?(r=nu(e,this.sortedLabelNames),Uo(this.labelNames,e)):(n=e,e={}),n&&!Number.isFinite(n))throw new TypeError(`Value is not a valid number: ${tu.format(n)}`);if(n<0)throw new Error("It is not possible to decrease a counter");return n==null&&(n=1),qo(this.hashMap,n,e,r),{labelHash:r}}incWithExemplar({labels:e=this.defaultLabels,value:n=this.defaultValue,exemplarLabels:r=this.defaultExemplarLabelSet}={}){let s=this.incWithoutExemplar(e,n);this.updateExemplar(r,n,s.labelHash)}updateExemplar(e,n,r){e!==this.defaultExemplarLabelSet&&(Bo(this.hashMap[r].exemplar)||(this.hashMap[r].exemplar=new iu),this.hashMap[r].exemplar.validateExemplarLabelSet(e),this.hashMap[r].exemplar.labelSet=e,this.hashMap[r].exemplar.value=n||1,this.hashMap[r].exemplar.timestamp=su())}reset(){this.hashMap={},this.labelNames.length===0&&qo(this.hashMap,0)}async get(){if(this.collect){let e=this.collect();e instanceof Promise&&await e}return{help:this.help,name:this.name,type:this.type,values:Object.values(this.hashMap),aggregator:this.aggregator}}labels(...e){let n=jo(this.labelNames,e)||{};return{inc:this.inc.bind(this,n)}}remove(...e){let n=jo(this.labelNames,e)||{};return Uo(this.labelNames,n),ru.call(this,this.hashMap,n,this.sortedLabelNames)}};function qo(t,e,n={},r=""){return t[r]?t[r].value+=e:t[r]={value:e,labels:n},t}Fo.exports=Er});var de=B((Lf,Ho)=>{"use strict";var Vo=ne("util"),{setValue:zo,setValueDelta:au,getLabels:Ko,hashObject:Jo,isObject:Wo,removeLabels:cu}=Ce(),{validateLabel:Tn}=He(),{Metric:lu}=Pt(),kr=class extends lu{constructor(e){super(e),this.type="gauge"}set(e,n){n=Nr(e,n),e=Cr(e),uu(this,e,n)}reset(){this.hashMap={},this.labelNames.length===0&&zo(this.hashMap,0,{})}inc(e,n){n=Nr(e,n),e=Cr(e),n===void 0&&(n=1),Go(this,e,n)}dec(e,n){n=Nr(e,n),e=Cr(e),n===void 0&&(n=1),Go(this,e,-n)}setToCurrentTime(e){let n=Date.now()/1e3;e===void 0?this.set(n):this.set(e,n)}startTimer(e){let n=process.hrtime();return r=>{let s=process.hrtime(n),o=s[0]+s[1]/1e9;return this.set(Object.assign({},e,r),o),o}}async get(){if(this.collect){let e=this.collect();e instanceof Promise&&await e}return{help:this.help,name:this.name,type:this.type,values:Object.values(this.hashMap),aggregator:this.aggregator}}_getValue(e){let n=Jo(e||{},this.sortedLabelNames);return this.hashMap[n]?this.hashMap[n].value:0}labels(...e){let n=Ko(this.labelNames,e);return Tn(this.labelNames,n),{inc:this.inc.bind(this,n),dec:this.dec.bind(this,n),set:this.set.bind(this,n),setToCurrentTime:this.setToCurrentTime.bind(this,n),startTimer:this.startTimer.bind(this,n)}}remove(...e){let n=Ko(this.labelNames,e);Tn(this.labelNames,n),cu.call(this,this.hashMap,n,this.sortedLabelNames)}};function uu(t,e,n){if(typeof n!="number")throw new TypeError(`Value is not a valid number: ${Vo.format(n)}`);Tn(t.labelNames,e),zo(t.hashMap,n,e)}function Go(t,e,n){if(typeof n!="number")throw new TypeError(`Delta is not a valid number: ${Vo.format(n)}`);Tn(t.labelNames,e);let r=Jo(e,t.sortedLabelNames);au(t.hashMap,n,e,r)}function Cr(t){return Wo(t)?t:{}}function Nr(t,e){return Wo(t)?e:t}Ho.exports=kr});var Ar=B((Df,ei)=>{"use strict";var du=ne("util"),{getLabels:Xo,hashObject:Sn,isObject:Qo,removeLabels:pu,nowTimestamp:fu}=Ce(),{validateLabel:xr}=He(),{Metric:mu}=Pt(),gu=vr(),Or=class extends mu{constructor(e){super(e,{buckets:[.005,.01,.025,.05,.1,.25,.5,1,2.5,5,10]}),this.type="histogram",this.defaultLabels={},this.defaultExemplarLabelSet={},this.enableExemplars=!1;for(let n of this.labelNames)if(n==="le")throw new Error("le is a reserved label keyword");this.upperBounds=this.buckets,this.bucketValues=this.upperBounds.reduce((n,r)=>(n[r]=0,n),{}),e.enableExemplars?(this.enableExemplars=!0,this.bucketExemplars=this.upperBounds.reduce((n,r)=>(n[r]=null,n),{}),Object.freeze(this.bucketExemplars),this.observe=this.observeWithExemplar):this.observe=this.observeWithoutExemplar,Object.freeze(this.bucketValues),Object.freeze(this.upperBounds),this.labelNames.length===0&&(this.hashMap={[Sn({})]:Pr({},this.bucketValues,this.bucketExemplars)})}observeWithoutExemplar(e,n){Mr.call(this,e===0?0:e||{})(n)}observeWithExemplar({labels:e=this.defaultLabels,value:n,exemplarLabels:r=this.defaultExemplarLabelSet}={}){Mr.call(this,e===0?0:e||{})(n),this.updateExemplar(e,n,r)}updateExemplar(e,n,r){if(Object.keys(r).length===0)return;let s=Sn(e,this.sortedLabelNames),o=Zo(this.upperBounds,n),{bucketExemplars:i}=this.hashMap[s],c=i[o];Qo(c)||(c=new gu,i[o]=c),c.validateExemplarLabelSet(r),c.labelSet=r,c.value=n,c.timestamp=fu()}async get(){let e=await this.getForPromString();return e.values=e.values.map(wu),e}async getForPromString(){if(this.collect){let r=this.collect();r instanceof Promise&&await r}let n=Object.values(this.hashMap).map(_u(this)).reduce(bu(this),[]);return{name:this.name,help:this.help,type:this.type,values:n,aggregator:this.aggregator}}reset(){this.hashMap={}}zero(e){let n=Sn(e,this.sortedLabelNames);this.hashMap[n]=Pr(e,this.bucketValues,this.bucketExemplars)}startTimer(e,n){return this.enableExemplars?hu.call(this,e,n)():Yo.call(this,e)()}labels(...e){let n=Xo(this.labelNames,e);return xr(this.labelNames,n),{observe:Mr.call(this,n),startTimer:Yo.call(this,n)}}remove(...e){let n=Xo(this.labelNames,e);xr(this.labelNames,n),pu.call(this,this.hashMap,n,this.sortedLabelNames)}};function Yo(t){return()=>{let e=process.hrtime();return n=>{let r=process.hrtime(e),s=r[0]+r[1]/1e9;return this.observe(Object.assign({},t,n),s),s}}}function hu(t,e){return()=>{let n=process.hrtime();return(r,s)=>{let o=process.hrtime(n),i=o[0]+o[1]/1e9;return this.observe({labels:Object.assign({},t,r),value:i,exemplarLabels:Object.assign({},e,s)}),i}}}function vn(t,e,n,r,s={}){return{labels:t,sharedLabels:s,value:e,metricName:n,exemplar:r}}function Zo(t,e){for(let n=0;n<t.length;n++){let r=t[n];if(e<=r)return r}return-1}function Mr(t){return e=>{let n=yu(t,e);if(xr(this.labelNames,n.labels),!Number.isFinite(n.value))throw new TypeError(`Value is not a valid number: ${du.format(n.value)}`);let r=Sn(n.labels,this.sortedLabelNames),s=this.hashMap[r];s||(s=Pr(n.labels,this.bucketValues,this.bucketExemplars));let o=Zo(this.upperBounds,n.value);s.sum+=n.value,s.count+=1,Object.prototype.hasOwnProperty.call(s.bucketValues,o)&&(s.bucketValues[o]+=1),this.hashMap[r]=s}}function Pr(t,e,n){let r={labels:t,bucketValues:{...e},sum:0,count:0};return n&&(r.bucketExemplars={...n}),r}function yu(t,e){return Qo(t)?{labels:t,value:e}:{value:t,labels:{}}}function _u(t){let e=`${t.name}_bucket`;return n=>{let r=0;return{buckets:t.upperBounds.map(o=>(r+=n.bucketValues[o],vn({le:o},r,e,n.bucketExemplars?n.bucketExemplars[o]:null,n.labels))),data:n}}}function bu(t){return(e,n)=>{e.push(...n.buckets);let r={le:"+Inf"};return e.push(vn(r,n.data.count,`${t.name}_bucket`,n.data.bucketExemplars?n.data.bucketExemplars[-1]:null,n.data.labels),vn({},n.data.sum,`${t.name}_sum`,void 0,n.data.labels),vn({},n.data.count,`${t.name}_count`,void 0,n.data.labels)),e}}function wu(t){let{sharedLabels:e,labels:n,...r}=t;for(let s of Object.keys(e))n[s]=e[s];return r.labels=n,r}ei.exports=Or});var $r=B((Bf,ti)=>{function be(){}be.prototype.clear=function(){this._root=null,this.size=0};be.prototype.find=function(t){for(var e=this._root;e!==null;){var n=this._comparator(t,e.data);if(n===0)return e.data;e=e.get_child(n>0)}return null};be.prototype.findIter=function(t){for(var e=this._root,n=this.iterator();e!==null;){var r=this._comparator(t,e.data);if(r===0)return n._cursor=e,n;n._ancestors.push(e),e=e.get_child(r>0)}return null};be.prototype.lowerBound=function(t){for(var e=this._root,n=this.iterator(),r=this._comparator;e!==null;){var s=r(t,e.data);if(s===0)return n._cursor=e,n;n._ancestors.push(e),e=e.get_child(s>0)}for(var o=n._ancestors.length-1;o>=0;--o)if(e=n._ancestors[o],r(t,e.data)<0)return n._cursor=e,n._ancestors.length=o,n;return n._ancestors.length=0,n};be.prototype.upperBound=function(t){for(var e=this.lowerBound(t),n=this._comparator;e.data()!==null&&n(e.data(),t)===0;)e.next();return e};be.prototype.min=function(){var t=this._root;if(t===null)return null;for(;t.left!==null;)t=t.left;return t.data};be.prototype.max=function(){var t=this._root;if(t===null)return null;for(;t.right!==null;)t=t.right;return t.data};be.prototype.iterator=function(){return new lt(this)};be.prototype.each=function(t){for(var e=this.iterator(),n;(n=e.next())!==null;)if(t(n)===!1)return};be.prototype.reach=function(t){for(var e=this.iterator(),n;(n=e.prev())!==null;)if(t(n)===!1)return};function lt(t){this._tree=t,this._ancestors=[],this._cursor=null}lt.prototype.data=function(){return this._cursor!==null?this._cursor.data:null};lt.prototype.next=function(){if(this._cursor===null){var t=this._tree._root;t!==null&&this._minNode(t)}else if(this._cursor.right===null){var e;do if(e=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.right===e)}else this._ancestors.push(this._cursor),this._minNode(this._cursor.right);return this._cursor!==null?this._cursor.data:null};lt.prototype.prev=function(){if(this._cursor===null){var t=this._tree._root;t!==null&&this._maxNode(t)}else if(this._cursor.left===null){var e;do if(e=this._cursor,this._ancestors.length)this._cursor=this._ancestors.pop();else{this._cursor=null;break}while(this._cursor.left===e)}else this._ancestors.push(this._cursor),this._maxNode(this._cursor.left);return this._cursor!==null?this._cursor.data:null};lt.prototype._minNode=function(t){for(;t.left!==null;)this._ancestors.push(t),t=t.left;this._cursor=t};lt.prototype._maxNode=function(t){for(;t.right!==null;)this._ancestors.push(t),t=t.right;this._cursor=t};ti.exports=be});var si=B((jf,ri)=>{var Iu=$r();function ut(t){this.data=t,this.left=null,this.right=null,this.red=!0}ut.prototype.get_child=function(t){return t?this.right:this.left};ut.prototype.set_child=function(t,e){t?this.right=e:this.left=e};function En(t){this._root=null,this._comparator=t,this.size=0}En.prototype=new Iu;En.prototype.insert=function(t){var e=!1;if(this._root===null)this._root=new ut(t),e=!0,this.size++;else{var n=new ut(void 0),r=0,s=0,o=null,i=n,c=null,u=this._root;for(i.right=this._root;;){if(u===null?(u=new ut(t),c.set_child(r,u),e=!0,this.size++):he(u.left)&&he(u.right)&&(u.red=!0,u.left.red=!1,u.right.red=!1),he(u)&&he(c)){var f=i.right===o;u===c.get_child(s)?i.set_child(f,At(o,!s)):i.set_child(f,ni(o,!s))}var h=this._comparator(u.data,t);if(h===0)break;s=r,r=h<0,o!==null&&(i=o),o=c,c=u,u=u.get_child(r)}this._root=n.right}return this._root.red=!1,e};En.prototype.remove=function(t){if(this._root===null)return!1;var e=new ut(void 0),n=e;n.right=this._root;for(var r=null,s=null,o=null,i=1;n.get_child(i)!==null;){var c=i;s=r,r=n,n=n.get_child(i);var u=this._comparator(t,n.data);if(i=u>0,u===0&&(o=n),!he(n)&&!he(n.get_child(i))){if(he(n.get_child(!i))){var f=At(n,i);r.set_child(c,f),r=f}else if(!he(n.get_child(!i))){var h=r.get_child(!c);if(h!==null)if(!he(h.get_child(!c))&&!he(h.get_child(c)))r.red=!1,h.red=!0,n.red=!0;else{var _=s.right===r;he(h.get_child(c))?s.set_child(_,ni(r,c)):he(h.get_child(!c))&&s.set_child(_,At(r,c));var T=s.get_child(_);T.red=!0,n.red=!0,T.left.red=!1,T.right.red=!1}}}}return o!==null&&(o.data=n.data,r.set_child(r.right===n,n.get_child(n.left===null)),this.size--),this._root=e.right,this._root!==null&&(this._root.red=!1),o!==null};function he(t){return t!==null&&t.red}function At(t,e){var n=t.get_child(!e);return t.set_child(!e,n.get_child(e)),n.set_child(e,t),t.red=!0,n.red=!1,n}function ni(t,e){return t.set_child(!e,At(t.get_child(!e),!e)),At(t,e)}ri.exports=En});var ii=B((Uf,oi)=>{var Tu=$r();function $t(t){this.data=t,this.left=null,this.right=null}$t.prototype.get_child=function(t){return t?this.right:this.left};$t.prototype.set_child=function(t,e){t?this.right=e:this.left=e};function Rn(t){this._root=null,this._comparator=t,this.size=0}Rn.prototype=new Tu;Rn.prototype.insert=function(t){if(this._root===null)return this._root=new $t(t),this.size++,!0;for(var e=0,n=null,r=this._root;;){if(r===null)return r=new $t(t),n.set_child(e,r),ret=!0,this.size++,!0;if(this._comparator(r.data,t)===0)return!1;e=this._comparator(r.data,t)<0,n=r,r=r.get_child(e)}};Rn.prototype.remove=function(t){if(this._root===null)return!1;var e=new $t(void 0),n=e;n.right=this._root;for(var r=null,s=null,o=1;n.get_child(o)!==null;){r=n,n=n.get_child(o);var i=this._comparator(t,n.data);o=i>0,i===0&&(s=n)}return s!==null?(s.data=n.data,r.set_child(r.right===n,n.get_child(n.left===null)),this._root=e.right,this.size--,!0):!1};oi.exports=Rn});var ci=B((qf,ai)=>{ai.exports={RBTree:si(),BinTree:ii()}});var di=B((Ff,ui)=>{var Su=ci().RBTree;function W(t,e,n){this.discrete=t===!1,this.delta=t||.01,this.K=e===void 0?25:e,this.CX=n===void 0?1.1:n,this.centroids=new Su(li),this.nreset=0,this.reset()}W.prototype.reset=function(){this.centroids.clear(),this.n=0,this.nreset+=1,this.last_cumulate=0};W.prototype.size=function(){return this.centroids.size};W.prototype.toArray=function(t){var e=[];return t?(this._cumulate(!0),this.centroids.each(function(n){e.push(n)})):this.centroids.each(function(n){e.push({mean:n.mean,n:n.n})}),e};W.prototype.summary=function(){var t=this.discrete?"exact ":"approximating ",e=[t+this.n+" samples using "+this.size()+" centroids","min = "+this.percentile(0),"Q1 = "+this.percentile(.25),"Q2 = "+this.percentile(.5),"Q3 = "+this.percentile(.75),"max = "+this.percentile(1)];return e.join(`
9
+ `)};function li(t,e){return t.mean>e.mean?1:t.mean<e.mean?-1:0}function vu(t,e){return t.mean_cumn-e.mean_cumn}W.prototype.push=function(t,e){e=e||1,t=Array.isArray(t)?t:[t];for(var n=0;n<t.length;n++)this._digest(t[n],e)};W.prototype.push_centroid=function(t){t=Array.isArray(t)?t:[t];for(var e=0;e<t.length;e++)this._digest(t[e].mean,t[e].n)};W.prototype._cumulate=function(t){if(!(this.n===this.last_cumulate||!t&&this.CX&&this.CX>this.n/this.last_cumulate)){var e=0;this.centroids.each(function(n){n.mean_cumn=e+n.n/2,e=n.cumn=e+n.n}),this.n=this.last_cumulate=e}};W.prototype.find_nearest=function(t){if(this.size()===0)return null;var e=this.centroids.lowerBound({mean:t}),n=e.data()===null?e.prev():e.data();if(n.mean===t||this.discrete)return n;var r=e.prev();return r&&Math.abs(r.mean-t)<Math.abs(n.mean-t)?r:n};W.prototype._new_centroid=function(t,e,n){var r={mean:t,n:e,cumn:n};return this.centroids.insert(r),this.n+=e,r};W.prototype._addweight=function(t,e,n){e!==t.mean&&(t.mean+=n*(e-t.mean)/(t.n+n)),t.cumn+=n,t.mean_cumn+=n/2,t.n+=n,this.n+=n};W.prototype._digest=function(t,e){var n=this.centroids.min(),r=this.centroids.max(),s=this.find_nearest(t);if(s&&s.mean===t)this._addweight(s,t,e);else if(s===n)this._new_centroid(t,e,0);else if(s===r)this._new_centroid(t,e,this.n);else if(this.discrete)this._new_centroid(t,e,s.cumn);else{var o=s.mean_cumn/this.n,i=Math.floor(4*this.n*this.delta*o*(1-o));i-s.n>=e?this._addweight(s,t,e):this._new_centroid(t,e,s.cumn)}this._cumulate(!1),!this.discrete&&this.K&&this.size()>this.K/this.delta&&this.compress()};W.prototype.bound_mean=function(t){var e=this.centroids.upperBound({mean:t}),n=e.prev(),r=n.mean===t?n:e.next();return[n,r]};W.prototype.p_rank=function(t){var e=Array.isArray(t)?t:[t],n=e.map(this._p_rank,this);return Array.isArray(t)?n:n[0]};W.prototype._p_rank=function(t){if(this.size()!==0){{if(t<this.centroids.min().mean)return 0;if(t>this.centroids.max().mean)return 1}this._cumulate(!0);var e=this.bound_mean(t),n=e[0],r=e[1];if(this.discrete)return n.cumn/this.n;var s=n.mean_cumn;return n!==r&&(s+=(t-n.mean)*(r.mean_cumn-n.mean_cumn)/(r.mean-n.mean)),s/this.n}};W.prototype.bound_mean_cumn=function(t){this.centroids._comparator=vu;var e=this.centroids.upperBound({mean_cumn:t});this.centroids._comparator=li;var n=e.prev(),r=n&&n.mean_cumn===t?n:e.next();return[n,r]};W.prototype.percentile=function(t){var e=Array.isArray(t)?t:[t],n=e.map(this._percentile,this);return Array.isArray(t)?n:n[0]};W.prototype._percentile=function(t){if(this.size()!==0){this._cumulate(!0);var e=this.n*t,n=this.bound_mean_cumn(e),r=n[0],s=n[1];return s===r||r===null||s===null?(r||s).mean:this.discrete?e<=r.cumn?r.mean:s.mean:r.mean+(e-r.mean_cumn)*(s.mean-r.mean)/(s.mean_cumn-r.mean_cumn)}};function Eu(t){var e=Math.floor(Math.random()*t.length);return t.splice(e,1)[0]}W.prototype.compress=function(){if(!this.compressing){var t=this.toArray();for(this.reset(),this.compressing=!0;t.length>0;)this.push_centroid(Eu(t));this._cumulate(!0),this.compressing=!1}};function qe(t){this.config=t||{},this.mode=this.config.mode||"auto",W.call(this,this.mode==="cont"?t.delta:!1),this.digest_ratio=this.config.ratio||.9,this.digest_thresh=this.config.thresh||1e3,this.n_unique=0}qe.prototype=Object.create(W.prototype);qe.prototype.constructor=qe;qe.prototype.push=function(t){W.prototype.push.call(this,t),this.check_continuous()};qe.prototype._new_centroid=function(t,e,n){this.n_unique+=1,W.prototype._new_centroid.call(this,t,e,n)};qe.prototype._addweight=function(t,e,n){t.n===1&&(this.n_unique-=1),W.prototype._addweight.call(this,t,e,n)};qe.prototype.check_continuous=function(){return this.mode!=="auto"||this.size()<this.digest_thresh?!1:this.n_unique/this.size()>this.digest_ratio?(this.mode="cont",this.discrete=!1,this.delta=this.config.delta||.01,this.compress(),!0):!1};ui.exports={TDigest:W,Digest:qe}});var mi=B((Kf,fi)=>{"use strict";var{TDigest:pi}=di(),Dr=class{constructor(e,n){this.maxAgeSeconds=e||0,this.ageBuckets=n||0,this.shouldRotate=e&&n,this.ringBuffer=Array(n).fill(new pi),this.currentBuffer=0,this.lastRotateTimestampMillis=Date.now(),this.durationBetweenRotatesMillis=e*1e3/n||1/0}size(){return Lr.call(this).size()}percentile(e){return Lr.call(this).percentile(e)}push(e){Lr.call(this),this.ringBuffer.forEach(n=>{n.push(e)})}reset(){this.ringBuffer.forEach(e=>{e.reset()})}compress(){this.ringBuffer.forEach(e=>{e.compress()})}};function Lr(){let t=Date.now()-this.lastRotateTimestampMillis;for(;t>this.durationBetweenRotatesMillis&&this.shouldRotate;)this.ringBuffer[this.currentBuffer]=new pi,++this.currentBuffer>=this.ringBuffer.length&&(this.currentBuffer=0),t-=this.durationBetweenRotatesMillis,this.lastRotateTimestampMillis+=this.durationBetweenRotatesMillis;return this.ringBuffer[this.currentBuffer]}fi.exports=Dr});var Ii=B((Gf,wi)=>{"use strict";var Ru=ne("util"),{getLabels:gi,hashObject:_i,removeLabels:Cu}=Ce(),{validateLabel:Br}=He(),{Metric:Nu}=Pt(),bi=mi(),ku=1e3,jr=class extends Nu{constructor(e){super(e,{percentiles:[.01,.05,.5,.9,.95,.99,.999],compressCount:ku,hashMap:{}}),this.type="summary";for(let n of this.labelNames)if(n==="quantile")throw new Error("quantile is a reserved label keyword");this.labelNames.length===0&&(this.hashMap={[_i({})]:{labels:{},td:new bi(this.maxAgeSeconds,this.ageBuckets),count:0,sum:0}})}observe(e,n){yi.call(this,e===0?0:e||{})(n)}async get(){if(this.collect){let r=this.collect();r instanceof Promise&&await r}let e=Object.keys(this.hashMap),n=[];return e.forEach(r=>{let s=this.hashMap[r];s&&(this.pruneAgedBuckets&&s.td.size()===0?delete this.hashMap[r]:(Mu(s,this.percentiles).forEach(o=>{n.push(o)}),n.push(Ou(s,this)),n.push(xu(s,this))))}),{name:this.name,help:this.help,type:this.type,values:n,aggregator:this.aggregator}}reset(){Object.values(this.hashMap).forEach(n=>{n.td.reset(),n.count=0,n.sum=0})}startTimer(e){return hi.call(this,e)()}labels(...e){let n=gi(this.labelNames,e);return Br(this.labelNames,n),{observe:yi.call(this,n),startTimer:hi.call(this,n)}}remove(...e){let n=gi(this.labelNames,e);Br(this.labelNames,n),Cu.call(this,this.hashMap,n,this.sortedLabelNames)}};function Mu(t,e){return t.td.compress(),e.map(n=>{let r=t.td.percentile(n);return{labels:Object.assign({quantile:n},t.labels),value:r||0}})}function xu(t,e){return{metricName:`${e.name}_count`,labels:t.labels,value:t.count}}function Ou(t,e){return{metricName:`${e.name}_sum`,labels:t.labels,value:t.sum}}function hi(t){return()=>{let e=process.hrtime();return n=>{let r=process.hrtime(e),s=r[0]+r[1]/1e9;return this.observe(Object.assign({},t,n),s),s}}}function yi(t){return e=>{let n=Pu(t,e);if(Br(this.labelNames,t),!Number.isFinite(n.value))throw new TypeError(`Value is not a valid number: ${Ru.format(n.value)}`);let r=_i(n.labels,this.sortedLabelNames),s=this.hashMap[r];s||(s={labels:n.labels,td:new bi(this.maxAgeSeconds,this.ageBuckets),count:0,sum:0}),s.td.push(n.value),s.count++,s.count%this.compressCount===0&&s.td.compress(),s.sum+=n.value,this.hashMap[r]=s}}function Pu(t,e){return e===void 0?{value:t,labels:{}}:{labels:t,value:e}}wi.exports=jr});var Si=B((Vf,Ti)=>{"use strict";var Ur=ne("url"),Au=ne("http"),$u=ne("https"),{gzipSync:Lu}=ne("zlib"),{globalRegistry:Du}=ct(),Fr=class{constructor(e,n,r){r||(r=Du),this.registry=r,this.gatewayUrl=e;let{requireJobName:s,...o}={requireJobName:!0,...n};this.requireJobName=s,this.requestOptions=o}pushAdd(e={}){if(this.requireJobName&&!e.jobName)throw new Error("Missing jobName parameter");return qr.call(this,"POST",e.jobName,e.groupings)}push(e={}){if(this.requireJobName&&!e.jobName)throw new Error("Missing jobName parameter");return qr.call(this,"PUT",e.jobName,e.groupings)}delete(e={}){if(this.requireJobName&&!e.jobName)throw new Error("Missing jobName parameter");return qr.call(this,"DELETE",e.jobName,e.groupings)}};async function qr(t,e,n){let r=Ur.parse(this.gatewayUrl),s=r.pathname&&r.pathname!=="/"?r.pathname:"",o=e?`/job/${encodeURIComponent(e)}${Bu(n)}`:"",i=`${s}/metrics${o}`,c=Ur.resolve(this.gatewayUrl,i),u=Ur.parse(c),f=ju(u.href)?$u:Au,h=Object.assign(u,this.requestOptions,{method:t});return new Promise((_,T)=>{t==="DELETE"&&h.headers&&delete h.headers["Content-Encoding"];let M=f.request(h,R=>{let k="";R.setEncoding("utf8"),R.on("data",y=>{k+=y}),R.on("end",()=>{R.statusCode>=400?T(new Error(`push failed with status ${R.statusCode}, ${k}`)):_({resp:R,body:k})})});M.on("error",R=>{T(R)}),M.on("timeout",()=>{M.destroy(new Error("Pushgateway request timed out"))}),t!=="DELETE"?this.registry.metrics().then(R=>{h.headers&&h.headers["Content-Encoding"]==="gzip"&&(R=Lu(R)),M.write(R),M.end()}).catch(R=>{T(R)}):M.end()})}function Bu(t){return t?Object.keys(t).map(e=>`/${encodeURIComponent(e)}/${encodeURIComponent(t[e])}`).join(""):""}function ju(t){return t.search(/^https/)!==-1}Ti.exports=Fr});var Gr=B(Kr=>{"use strict";Kr.linearBuckets=(t,e,n)=>{if(n<1)throw new Error("Linear buckets needs a positive count");let r=new Array(n);for(let s=0;s<n;s++)r[s]=t+s*e;return r};Kr.exponentialBuckets=(t,e,n)=>{if(t<=0)throw new Error("Exponential buckets needs a positive start");if(n<1)throw new Error("Exponential buckets needs a positive count");if(e<=1)throw new Error("Exponential buckets needs a factor greater than 1");let r=new Array(n);for(let s=0;s<n;s++)r[s]=t,t*=e;return r}});var Ae,Vr=A(()=>{Ae="1.9.1"});function Uu(t){let e=new Set([t]),n=new Set,r=t.match(vi);if(!r)return()=>!1;let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(s.prerelease!=null)return function(u){return u===t};function o(c){return n.add(c),!1}function i(c){return e.add(c),!0}return function(u){if(e.has(u))return!0;if(n.has(u))return!1;let f=u.match(vi);if(!f)return o(u);let h={major:+f[1],minor:+f[2],patch:+f[3],prerelease:f[4]};return h.prerelease!=null||s.major!==h.major?o(u):s.major===0?s.minor===h.minor&&s.patch<=h.patch?i(u):o(u):s.minor<=h.minor?i(u):o(u)}}var vi,Ei,Ri=A(()=>{Vr();vi=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;Ei=Uu(Ae)});function Ne(t,e,n,r=!1){var s;let o=Dt[Lt]=(s=Dt[Lt])!==null&&s!==void 0?s:{version:Ae};if(!r&&o[t]){let i=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return n.error(i.stack||i.message),!1}if(o.version!==Ae){let i=new Error(`@opentelemetry/api: Registration of version v${o.version} for ${t} does not match previously registered API v${Ae}`);return n.error(i.stack||i.message),!1}return o[t]=e,n.debug(`@opentelemetry/api: Registered a global for ${t} v${Ae}.`),!0}function ge(t){var e,n;let r=(e=Dt[Lt])===null||e===void 0?void 0:e.version;if(!(!r||!Ei(r)))return(n=Dt[Lt])===null||n===void 0?void 0:n[t]}function ke(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v${Ae}.`);let n=Dt[Lt];n&&delete n[t]}var qu,Lt,Dt,Xe=A(()=>{Vr();Ri();qu=Ae.split(".")[0],Lt=Symbol.for(`opentelemetry.js.api.${qu}`),Dt=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});function Bt(t,e,n){let r=ge("diag");if(r)return r[t](e,...n)}var Cn,Ci=A(()=>{Xe();Cn=class{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return Bt("debug",this._namespace,e)}error(...e){return Bt("error",this._namespace,e)}info(...e){return Bt("info",this._namespace,e)}warn(...e){return Bt("warn",this._namespace,e)}verbose(...e){return Bt("verbose",this._namespace,e)}}});var re,Nn=A(()=>{(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(re||(re={}))});function Ni(t,e){t<re.NONE?t=re.NONE:t>re.ALL&&(t=re.ALL),e=e||{};function n(r,s){let o=e[r];return typeof o=="function"&&t>=s?o.bind(e):function(){}}return{error:n("error",re.ERROR),warn:n("warn",re.WARN),info:n("info",re.INFO),debug:n("debug",re.DEBUG),verbose:n("verbose",re.VERBOSE)}}var ki=A(()=>{Nn()});var Fu,ee,Ye=A(()=>{Ci();ki();Nn();Xe();Fu="diag",ee=class t{static instance(){return this._instance||(this._instance=new t),this._instance}constructor(){function e(s){return function(...o){let i=ge("diag");if(i)return i[s](...o)}}let n=this,r=(s,o={logLevel:re.INFO})=>{var i,c,u;if(s===n){let _=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return n.error((i=_.stack)!==null&&i!==void 0?i:_.message),!1}typeof o=="number"&&(o={logLevel:o});let f=ge("diag"),h=Ni((c=o.logLevel)!==null&&c!==void 0?c:re.INFO,s);if(f&&!o.suppressOverrideMessage){let _=(u=new Error().stack)!==null&&u!==void 0?u:"<failed to generate stacktrace>";f.warn(`Current logger will be overwritten from ${_}`),h.warn(`Current logger will overwrite one already registered from ${_}`)}return Ne("diag",h,n,!0)};n.setLogger=r,n.disable=()=>{ke(Fu,n)},n.createComponentLogger=s=>new Cn(s),n.verbose=e("verbose"),n.debug=e("debug"),n.info=e("info"),n.warn=e("warn"),n.error=e("error")}}});var kn,Mi=A(()=>{kn=class t{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let n=this._entries.get(e);if(n)return Object.assign({},n)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,n){let r=new t(this._entries);return r._entries.set(e,n),r}removeEntry(e){let n=new t(this._entries);return n._entries.delete(e),n}removeEntries(...e){let n=new t(this._entries);for(let r of e)n._entries.delete(r);return n}clear(){return new t}}});var xi,Oi=A(()=>{xi=Symbol("BaggageEntryMetadata")});function Pi(t={}){return new kn(new Map(Object.entries(t)))}function Ai(t){return typeof t!="string"&&(Ku.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:xi,toString(){return t}}}var Ku,zr=A(()=>{Ye();Mi();Oi();Ku=ee.instance()});function dt(t){return Symbol.for(t)}var Jr,Mn,jt=A(()=>{Jr=class t{constructor(e){let n=this;n._currentContext=e?new Map(e):new Map,n.getValue=r=>n._currentContext.get(r),n.setValue=(r,s)=>{let o=new t(n._currentContext);return o._currentContext.set(r,s),o},n.deleteValue=r=>{let s=new t(n._currentContext);return s._currentContext.delete(r),s}}},Mn=new Jr});var Wr,Hr,xn,$i=A(()=>{Wr=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],Hr={};if(typeof console<"u"){let t=["error","warn","info","debug","trace","log"];for(let e of t)typeof console[e]=="function"&&(Hr[e]=console[e])}xn=class{constructor(){function e(n){return function(...r){let s=Hr[n];if(typeof s!="function"&&(s=Hr.log),typeof s!="function"&&console&&(s=console[n],typeof s!="function"&&(s=console.log)),typeof s=="function")return s.apply(console,r)}}for(let n=0;n<Wr.length;n++)this[Wr[n].n]=e(Wr[n].c)}}});function Li(){return ss}var Xr,pt,Yr,Qr,Zr,es,Ut,ts,ns,rs,ss,Gu,Vu,zu,Ju,Wu,Hu,Xu,os=A(()=>{Xr=class{constructor(){}createGauge(e,n){return Vu}createHistogram(e,n){return zu}createCounter(e,n){return Gu}createUpDownCounter(e,n){return Ju}createObservableGauge(e,n){return Hu}createObservableCounter(e,n){return Wu}createObservableUpDownCounter(e,n){return Xu}addBatchObservableCallback(e,n){}removeBatchObservableCallback(e){}},pt=class{},Yr=class extends pt{add(e,n){}},Qr=class extends pt{add(e,n){}},Zr=class extends pt{record(e,n){}},es=class extends pt{record(e,n){}},Ut=class{addCallback(e){}removeCallback(e){}},ts=class extends Ut{},ns=class extends Ut{},rs=class extends Ut{},ss=new Xr,Gu=new Yr,Vu=new Zr,zu=new es,Ju=new Qr,Wu=new ts,Hu=new ns,Xu=new rs});var On,Di=A(()=>{(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(On||(On={}))});var Pn,An,is=A(()=>{Pn={get(t,e){if(t!=null)return t[e]},keys(t){return t==null?[]:Object.keys(t)}},An={set(t,e,n){t!=null&&(t[e]=n)}}});var $n,Bi=A(()=>{jt();$n=class{active(){return Mn}with(e,n,r,...s){return n.call(r,...s)}bind(e,n){return n}enable(){return this}disable(){return this}}});var as,Yu,Me,qt=A(()=>{Bi();Xe();Ye();as="context",Yu=new $n,Me=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalContextManager(e){return Ne(as,e,ee.instance())}active(){return this._getContextManager().active()}with(e,n,r,...s){return this._getContextManager().with(e,n,r,...s)}bind(e,n){return this._getContextManager().bind(e,n)}_getContextManager(){return ge(as)||Yu}disable(){this._getContextManager().disable(),ke(as,ee.instance())}}});var ft,cs=A(()=>{(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(ft||(ft={}))});var Ft,Kt,Ln,Dn=A(()=>{cs();Ft="0000000000000000",Kt="00000000000000000000000000000000",Ln={traceId:Kt,spanId:Ft,traceFlags:ft.NONE}});var xe,Bn=A(()=>{Dn();xe=class{constructor(e=Ln){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,n){return this}setAttributes(e){return this}addEvent(e,n){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,n){}}});function jn(t){return t.getValue(ls)||void 0}function ji(){return jn(Me.getInstance().active())}function Gt(t,e){return t.setValue(ls,e)}function Ui(t){return t.deleteValue(ls)}function qi(t,e){return Gt(t,new xe(e))}function Un(t){var e;return(e=jn(t))===null||e===void 0?void 0:e.spanContext()}var ls,us=A(()=>{jt();Bn();qt();ls=dt("OpenTelemetry Context Key SPAN")});function Fi(t,e){if(typeof t!="string"||t.length!==e)return!1;let n=0;for(let r=0;r<t.length;r+=4)n+=(qn[t.charCodeAt(r)]|0)+(qn[t.charCodeAt(r+1)]|0)+(qn[t.charCodeAt(r+2)]|0)+(qn[t.charCodeAt(r+3)]|0);return n===e}function ds(t){return Fi(t,32)&&t!==Kt}function ps(t){return Fi(t,16)&&t!==Ft}function mt(t){return ds(t.traceId)&&ps(t.spanId)}function Ki(t){return new xe(t)}var qn,Fn=A(()=>{Dn();Bn();qn=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])});function Qu(t){return t!==null&&typeof t=="object"&&"spanId"in t&&typeof t.spanId=="string"&&"traceId"in t&&typeof t.traceId=="string"&&"traceFlags"in t&&typeof t.traceFlags=="number"}var fs,gt,ms=A(()=>{qt();us();Bn();Fn();fs=Me.getInstance(),gt=class{startSpan(e,n,r=fs.active()){if(!!n?.root)return new xe;let o=r&&Un(r);return Qu(o)&&mt(o)?new xe(o):new xe}startActiveSpan(e,n,r,s){let o,i,c;if(arguments.length<2)return;arguments.length===2?c=n:arguments.length===3?(o=n,c=r):(o=n,i=r,c=s);let u=i??fs.active(),f=this.startSpan(e,o,u),h=Gt(u,f);return fs.with(h,c,void 0,f)}}});var Zu,ht,gs=A(()=>{ms();Zu=new gt,ht=class{constructor(e,n,r,s){this._provider=e,this.name=n,this.version=r,this.options=s}startSpan(e,n,r){return this._getTracer().startSpan(e,n,r)}startActiveSpan(e,n,r,s){let o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Zu}}});var Kn,Gi=A(()=>{ms();Kn=class{getTracer(e,n,r){return new gt}}});var ed,Qe,hs=A(()=>{gs();Gi();ed=new Kn,Qe=class{getTracer(e,n,r){var s;return(s=this.getDelegateTracer(e,n,r))!==null&&s!==void 0?s:new ht(this,e,n,r)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:ed}setDelegate(e){this._delegate=e}getDelegateTracer(e,n,r){var s;return(s=this._delegate)===null||s===void 0?void 0:s.getTracer(e,n,r)}}});var Gn,Vi=A(()=>{(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(Gn||(Gn={}))});var Vn,zi=A(()=>{(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(Vn||(Vn={}))});var zn,Ji=A(()=>{(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(zn||(zn={}))});function Wi(t){return rd.test(t)}function Hi(t){return sd.test(t)&&!od.test(t)}var ys,td,nd,rd,sd,od,Xi=A(()=>{ys="[_0-9a-z-*/]",td=`[a-z]${ys}{0,255}`,nd=`[a-z0-9]${ys}{0,240}@[a-z]${ys}{0,13}`,rd=new RegExp(`^(?:${td}|${nd})$`),sd=/^[ -~]{0,255}[!-~]$/,od=/,|=/});var Yi,id,Qi,Zi,Jn,ea=A(()=>{Xi();Yi=32,id=512,Qi=",",Zi="=",Jn=class t{constructor(e){this._internalState=new Map,e&&this._parse(e)}set(e,n){let r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,n),r}unset(e){let n=this._clone();return n._internalState.delete(e),n}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reduceRight((e,n)=>(e.push(n+Zi+this.get(n)),e),[]).join(Qi)}_parse(e){e.length>id||(this._internalState=e.split(Qi).reduceRight((n,r)=>{let s=r.trim(),o=s.indexOf(Zi);if(o!==-1){let i=s.slice(0,o),c=s.slice(o+1,r.length);Wi(i)&&Hi(c)&&n.set(i,c)}return n},new Map),this._internalState.size>Yi&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Yi))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}}});function ta(t){return new Jn(t)}var na=A(()=>{ea()});var _s,ra=A(()=>{qt();_s=Me.getInstance()});var bs,sa=A(()=>{Ye();bs=ee.instance()});var ws,oa,ia=A(()=>{os();ws=class{getMeter(e,n,r){return ss}},oa=new ws});var Is,Wn,aa=A(()=>{ia();Xe();Ye();Is="metrics",Wn=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalMeterProvider(e){return Ne(Is,e,ee.instance())}getMeterProvider(){return ge(Is)||oa}getMeter(e,n,r){return this.getMeterProvider().getMeter(e,n,r)}disable(){ke(Is,ee.instance())}}});var Ts,ca=A(()=>{aa();Ts=Wn.getInstance()});var Hn,la=A(()=>{Hn=class{inject(e,n){}extract(e,n){return e}fields(){return[]}}});function vs(t){return t.getValue(Ss)||void 0}function ua(){return vs(Me.getInstance().active())}function da(t,e){return t.setValue(Ss,e)}function pa(t){return t.deleteValue(Ss)}var Ss,fa=A(()=>{qt();jt();Ss=dt("OpenTelemetry Baggage Key")});var Es,ad,Xn,ma=A(()=>{Xe();la();is();fa();zr();Ye();Es="propagation",ad=new Hn,Xn=class t{constructor(){this.createBaggage=Pi,this.getBaggage=vs,this.getActiveBaggage=ua,this.setBaggage=da,this.deleteBaggage=pa}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalPropagator(e){return Ne(Es,e,ee.instance())}inject(e,n,r=An){return this._getGlobalPropagator().inject(e,n,r)}extract(e,n,r=Pn){return this._getGlobalPropagator().extract(e,n,r)}fields(){return this._getGlobalPropagator().fields()}disable(){ke(Es,ee.instance())}_getGlobalPropagator(){return ge(Es)||ad}}});var Rs,ga=A(()=>{ma();Rs=Xn.getInstance()});var Cs,Yn,ha=A(()=>{Xe();hs();Fn();us();Ye();Cs="trace",Yn=class t{constructor(){this._proxyTracerProvider=new Qe,this.wrapSpanContext=Ki,this.isSpanContextValid=mt,this.deleteSpan=Ui,this.getSpan=jn,this.getActiveSpan=ji,this.getSpanContext=Un,this.setSpan=Gt,this.setSpanContext=qi}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalTracerProvider(e){let n=Ne(Cs,this._proxyTracerProvider,ee.instance());return n&&this._proxyTracerProvider.setDelegate(e),n}getTracerProvider(){return ge(Cs)||this._proxyTracerProvider}getTracer(e,n){return this.getTracerProvider().getTracer(e,n)}disable(){ke(Cs,ee.instance()),this._proxyTracerProvider=new Qe}}});var Ns,ya=A(()=>{ha();Ns=Yn.getInstance()});var _a={};Gl(_a,{DiagConsoleLogger:()=>xn,DiagLogLevel:()=>re,INVALID_SPANID:()=>Ft,INVALID_SPAN_CONTEXT:()=>Ln,INVALID_TRACEID:()=>Kt,ProxyTracer:()=>ht,ProxyTracerProvider:()=>Qe,ROOT_CONTEXT:()=>Mn,SamplingDecision:()=>Gn,SpanKind:()=>Vn,SpanStatusCode:()=>zn,TraceFlags:()=>ft,ValueType:()=>On,baggageEntryMetadataFromString:()=>Ai,context:()=>_s,createContextKey:()=>dt,createNoopMeter:()=>Li,createTraceState:()=>ta,default:()=>cd,defaultTextMapGetter:()=>Pn,defaultTextMapSetter:()=>An,diag:()=>bs,isSpanContextValid:()=>mt,isValidSpanId:()=>ps,isValidTraceId:()=>ds,metrics:()=>Ts,propagation:()=>Rs,trace:()=>Ns});var cd,ba=A(()=>{zr();jt();$i();Nn();os();Di();is();gs();hs();Vi();zi();Ji();cs();na();Fn();Dn();ra();sa();ca();ga();ya();cd={context:_s,diag:bs,metrics:Ts,propagation:Rs,trace:Ns}});var va=B((sh,Ms)=>{"use strict";var wa=(ba(),Vl(_a)),ks=Rr(),Ia="process_cpu_user_seconds_total",Ta="process_cpu_system_seconds_total",Sa="process_cpu_seconds_total";Ms.exports=(t,e={})=>{let n=t?[t]:void 0,r=e.prefix?e.prefix:"",s=e.labels?e.labels:{},o=e.enableExemplars?e.enableExemplars:!1,i=Object.keys(s),c=process.cpuUsage(),u=new ks({name:r+Ia,help:"Total user CPU time spent in seconds.",enableExemplars:o,registers:n,labelNames:i,collect(){let _=process.cpuUsage(),T=_.user-c.user,M=_.system-c.system;if(c=_,this.enableExemplars){let R={},k=wa.trace.getSpan(wa.context.active());k&&(R={traceId:k.spanContext().traceId,spanId:k.spanContext().spanId}),u.inc({labels:s,value:T/1e6,exemplarLabels:R}),f.inc({labels:s,value:M/1e6,exemplarLabels:R}),h.inc({labels:s,value:(T+M)/1e6,exemplarLabels:R})}else u.inc(s,T/1e6),f.inc(s,M/1e6),h.inc(s,(T+M)/1e6)}}),f=new ks({name:r+Ta,help:"Total system CPU time spent in seconds.",enableExemplars:o,registers:n,labelNames:i}),h=new ks({name:r+Sa,help:"Total user and system CPU time spent in seconds.",enableExemplars:o,registers:n,labelNames:i})};Ms.exports.metricNames=[Ia,Ta,Sa]});var Ra=B((oh,xs)=>{"use strict";var ld=de(),ud=Math.round(Date.now()/1e3-process.uptime()),Ea="process_start_time_seconds";xs.exports=(t,e={})=>{let n=e.prefix?e.prefix:"",r=e.labels?e.labels:{},s=Object.keys(r);new ld({name:n+Ea,help:"Start time of the process since unix epoch in seconds.",registers:t?[t]:void 0,labelNames:s,aggregator:"omit",collect(){this.set(r,ud)}})};xs.exports.metricNames=[Ea]});var Ma=B((ih,Ps)=>{"use strict";var Os=de(),dd=ne("fs"),pd=["VmSize","VmRSS","VmData"],Ca="process_resident_memory_bytes",Na="process_virtual_memory_bytes",ka="process_heap_bytes";function fd(t){return t.split(`
10
+ `).reduce((e,n)=>{if(!pd.some(o=>n.startsWith(o)))return e;let r=n.split(":"),s=r[1].trim();return s=s.substr(0,s.length-3),s=Number(s)*1024,e[r[0]]=s,e},{})}Ps.exports=(t,e={})=>{let n=t?[t]:void 0,r=e.prefix?e.prefix:"",s=e.labels?e.labels:{},o=Object.keys(s),i=new Os({name:r+Ca,help:"Resident memory size in bytes.",registers:n,labelNames:o,collect(){try{let f=dd.readFileSync("/proc/self/status","utf8"),h=fd(f);i.set(s,h.VmRSS),c.set(s,h.VmSize),u.set(s,h.VmData)}catch{}}}),c=new Os({name:r+Na,help:"Virtual memory size in bytes.",registers:n,labelNames:o}),u=new Os({name:r+ka,help:"Process heap size in bytes.",registers:n,labelNames:o})};Ps.exports.metricNames=[Ca,Na,ka]});var As=B((ah,xa)=>{"use strict";function md(){try{return process.memoryUsage()}catch{return}}xa.exports=md});var Aa=B((ch,$s)=>{"use strict";var gd=de(),Oa=Ma(),hd=As(),Pa="process_resident_memory_bytes";function yd(t,e={}){let n=e.prefix?e.prefix:"",r=e.labels?e.labels:{},s=Object.keys(r);new gd({name:n+Pa,help:"Resident memory size in bytes.",registers:t?[t]:void 0,labelNames:s,collect(){let o=hd();o&&this.set(r,o.rss)}})}$s.exports=(t,e)=>process.platform==="linux"?Oa(t,e):yd(t,e);$s.exports.metricNames=process.platform==="linux"?Oa.metricNames:[Pa]});var La=B((lh,Ls)=>{"use strict";var _d=de(),bd=ne("fs"),wd=ne("process"),$a="process_open_fds";Ls.exports=(t,e={})=>{if(wd.platform!=="linux")return;let n=e.prefix?e.prefix:"",r=e.labels?e.labels:{},s=Object.keys(r);new _d({name:n+$a,help:"Number of open file descriptors.",registers:t?[t]:void 0,labelNames:s,collect(){try{let o=bd.readdirSync("/proc/self/fd");this.set(r,o.length-1)}catch{}}})};Ls.exports.metricNames=[$a]});var Ba=B((uh,Ds)=>{"use strict";var Id=de(),Td=ne("fs"),Da="process_max_fds",Vt;Ds.exports=(t,e={})=>{if(Vt===void 0)try{let i=Td.readFileSync("/proc/self/limits","utf8").split(`
11
+ `);for(let c of i)if(c.startsWith("Max open files")){let u=c.split(/ +/);Vt=Number(u[1]);break}}catch{return}if(Vt===void 0)return;let n=e.prefix?e.prefix:"",r=e.labels?e.labels:{},s=Object.keys(r);new Id({name:n+Da,help:"Maximum number of open file descriptors.",registers:t?[t]:void 0,labelNames:s,collect(){Vt!==void 0&&this.set(r,Vt)}})};Ds.exports.metricNames=[Da]});var Wa=B((dh,Bs)=>{"use strict";var Fe=de(),Qn;try{Qn=ne("perf_hooks")}catch{}var Ua="nodejs_eventloop_lag_seconds",qa="nodejs_eventloop_lag_min_seconds",Fa="nodejs_eventloop_lag_max_seconds",Ka="nodejs_eventloop_lag_mean_seconds",Ga="nodejs_eventloop_lag_stddev_seconds",Va="nodejs_eventloop_lag_p50_seconds",za="nodejs_eventloop_lag_p90_seconds",Ja="nodejs_eventloop_lag_p99_seconds";function ja(t,e,n){let r=process.hrtime(t),o=(r[0]*1e9+r[1])/1e9;e.set(n,o)}Bs.exports=(t,e={})=>{let n=e.prefix?e.prefix:"",r=e.labels?e.labels:{},s=Object.keys(r),o=t?[t]:void 0,i=()=>{let k=process.hrtime();setImmediate(ja,k,c,r)};if(Qn&&Qn.monitorEventLoopDelay)try{let k=Qn.monitorEventLoopDelay({resolution:e.eventLoopMonitoringPrecision});k.enable(),i=()=>{let y=process.hrtime();setImmediate(ja,y,c,r),u.set(r,k.min/1e9),f.set(r,k.max/1e9),h.set(r,k.mean/1e9),_.set(r,k.stddev/1e9),T.set(r,k.percentile(50)/1e9),M.set(r,k.percentile(90)/1e9),R.set(r,k.percentile(99)/1e9),k.reset()}}catch(k){if(k.code==="ERR_NOT_IMPLEMENTED")return;throw k}let c=new Fe({name:n+Ua,help:"Lag of event loop in seconds.",registers:o,labelNames:s,aggregator:"average",collect:i}),u=new Fe({name:n+qa,help:"The minimum recorded event loop delay.",registers:o,labelNames:s,aggregator:"min"}),f=new Fe({name:n+Fa,help:"The maximum recorded event loop delay.",registers:o,labelNames:s,aggregator:"max"}),h=new Fe({name:n+Ka,help:"The mean of the recorded event loop delays.",registers:o,labelNames:s,aggregator:"average"}),_=new Fe({name:n+Ga,help:"The standard deviation of the recorded event loop delays.",registers:o,labelNames:s,aggregator:"average"}),T=new Fe({name:n+Va,help:"The 50th percentile of the recorded event loop delays.",registers:o,labelNames:s,aggregator:"average"}),M=new Fe({name:n+za,help:"The 90th percentile of the recorded event loop delays.",registers:o,labelNames:s,aggregator:"average"}),R=new Fe({name:n+Ja,help:"The 99th percentile of the recorded event loop delays.",registers:o,labelNames:s,aggregator:"average"})};Bs.exports.metricNames=[Ua,qa,Fa,Ka,Ga,Va,za,Ja]});var yt=B((ph,Ha)=>{"use strict";function Sd(t){let e={};for(let n=0;n<t.length;n++){let r=t[n];!r||typeof r.constructor>"u"||(Object.hasOwnProperty.call(e,r.constructor.name)?e[r.constructor.name]+=1:e[r.constructor.name]=1)}return e}function vd(t,e,n){t.reset();for(let r in e)t.set(Object.assign({type:r},n||{}),e[r])}Ha.exports={aggregateByObjectName:Sd,updateMetrics:vd}});var Za=B((fh,js)=>{"use strict";var{aggregateByObjectName:Ed}=yt(),{updateMetrics:Rd}=yt(),Xa=de(),Ya="nodejs_active_handles",Qa="nodejs_active_handles_total";js.exports=(t,e={})=>{if(typeof process._getActiveHandles!="function")return;let n=t?[t]:void 0,r=e.prefix?e.prefix:"",s=e.labels?e.labels:{},o=Object.keys(s);new Xa({name:r+Ya,help:"Number of active libuv handles grouped by handle type. Every handle type is C++ class name.",labelNames:["type",...o],registers:n,collect(){let i=process._getActiveHandles();Rd(this,Ed(i),s)}}),new Xa({name:r+Qa,help:"Total number of active handles.",registers:n,labelNames:o,collect(){let i=process._getActiveHandles();this.set(s,i.length)}})};js.exports.metricNames=[Ya,Qa]});var rc=B((mh,Us)=>{"use strict";var ec=de(),{aggregateByObjectName:Cd}=yt(),{updateMetrics:Nd}=yt(),tc="nodejs_active_requests",nc="nodejs_active_requests_total";Us.exports=(t,e={})=>{if(typeof process._getActiveRequests!="function")return;let n=e.prefix?e.prefix:"",r=e.labels?e.labels:{},s=Object.keys(r);new ec({name:n+tc,help:"Number of active libuv requests grouped by request type. Every request type is C++ class name.",labelNames:["type",...s],registers:t?[t]:void 0,collect(){let o=process._getActiveRequests();Nd(this,Cd(o),r)}}),new ec({name:n+nc,help:"Total number of active requests.",registers:t?[t]:void 0,labelNames:s,collect(){let o=process._getActiveRequests();this.set(r,o.length)}})};Us.exports.metricNames=[tc,nc]});var ac=B((gh,qs)=>{"use strict";var sc=de(),{updateMetrics:kd}=yt(),oc="nodejs_active_resources",ic="nodejs_active_resources_total";qs.exports=(t,e={})=>{if(typeof process.getActiveResourcesInfo!="function")return;let n=e.prefix?e.prefix:"",r=e.labels?e.labels:{},s=Object.keys(r);new sc({name:n+oc,help:"Number of active resources that are currently keeping the event loop alive, grouped by async resource type.",labelNames:["type",...s],registers:t?[t]:void 0,collect(){let o=process.getActiveResourcesInfo(),i={};for(let c=0;c<o.length;c++){let u=o[c];Object.hasOwn(i,u)?i[u]+=1:i[u]=1}kd(this,i,r)}}),new sc({name:n+ic,help:"Total number of active resources.",registers:t?[t]:void 0,labelNames:s,collect(){let o=process.getActiveResourcesInfo();this.set(r,o.length)}})};qs.exports.metricNames=[oc,ic]});var dc=B((hh,Ks)=>{"use strict";var Fs=de(),Md=As(),cc="nodejs_heap_size_total_bytes",lc="nodejs_heap_size_used_bytes",uc="nodejs_external_memory_bytes";Ks.exports=(t,e={})=>{if(typeof process.memoryUsage!="function")return;let n=e.labels?e.labels:{},r=Object.keys(n),s=t?[t]:void 0,o=e.prefix?e.prefix:"",i=()=>{let h=Md();h&&(c.set(n,h.heapTotal),u.set(n,h.heapUsed),h.external!==void 0&&f.set(n,h.external))},c=new Fs({name:o+cc,help:"Process heap size from Node.js in bytes.",registers:s,labelNames:r,collect:i}),u=new Fs({name:o+lc,help:"Process heap size used from Node.js in bytes.",registers:s,labelNames:r}),f=new Fs({name:o+uc,help:"Node.js external memory size in bytes.",registers:s,labelNames:r})};Ks.exports.metricNames=[cc,lc,uc]});var mc=B((yh,Vs)=>{"use strict";var xd=de(),pc=ne("v8"),fc=["total","used","available"],Gs={};fc.forEach(t=>{Gs[t]=`nodejs_heap_space_size_${t}_bytes`});Vs.exports=(t,e={})=>{try{pc.getHeapSpaceStatistics()}catch(c){if(c.code==="ERR_NOT_IMPLEMENTED")return;throw c}let n=t?[t]:void 0,r=e.prefix?e.prefix:"",s=e.labels?e.labels:{},o=["space",...Object.keys(s)],i={};fc.forEach(c=>{i[c]=new xd({name:r+Gs[c],help:`Process heap space size ${c} from Node.js in bytes.`,labelNames:o,registers:n})}),i.total.collect=()=>{for(let c of pc.getHeapSpaceStatistics()){let u=c.space_name.substr(0,c.space_name.indexOf("_space"));i.total.set({space:u,...s},c.space_size),i.used.set({space:u,...s},c.space_used_size),i.available.set({space:u,...s},c.space_available_size)}}};Vs.exports.metricNames=Object.values(Gs)});var yc=B((_h,Js)=>{"use strict";var Od=de(),gc=process.version,zs=gc.slice(1).split(".").map(Number),hc="nodejs_version_info";Js.exports=(t,e={})=>{let n=e.prefix?e.prefix:"",r=e.labels?e.labels:{},s=Object.keys(r);new Od({name:n+hc,help:"Node.js version info.",labelNames:["version","major","minor","patch",...s],registers:t?[t]:void 0,aggregator:"first",collect(){this.labels(gc,zs[0],zs[1],zs[2],...Object.values(r)).set(1)}})};Js.exports.metricNames=[hc]});var bc=B((bh,Ws)=>{"use strict";var Pd=Ar(),$e;try{$e=ne("perf_hooks")}catch{}var _c="nodejs_gc_duration_seconds",Ad=[.001,.01,.1,1,2,5],_t=[];$e&&$e.constants&&(_t[$e.constants.NODE_PERFORMANCE_GC_MAJOR]="major",_t[$e.constants.NODE_PERFORMANCE_GC_MINOR]="minor",_t[$e.constants.NODE_PERFORMANCE_GC_INCREMENTAL]="incremental",_t[$e.constants.NODE_PERFORMANCE_GC_WEAKCB]="weakcb");Ws.exports=(t,e={})=>{if(!$e)return;let n=e.prefix?e.prefix:"",r=e.labels?e.labels:{},s=Object.keys(r),o=e.gcDurationBuckets?e.gcDurationBuckets:Ad,i=new Pd({name:n+_c,help:"Garbage collection duration by kind, one of major, minor, incremental or weakcb.",labelNames:["kind",...s],enableExemplars:!1,buckets:o,registers:t?[t]:void 0});new $e.PerformanceObserver(u=>{let f=u.getEntries()[0],h=f.detail?_t[f.detail.kind]:_t[f.kind];i.observe(Object.assign({kind:h},r),f.duration/1e3)}).observe({entryTypes:["gc"]})};Ws.exports.metricNames=[_c]});var Ic=B((wh,Hs)=>{"use strict";var{isObject:$d}=Ce(),Ld=va(),Dd=Ra(),Bd=Aa(),jd=La(),Ud=Ba(),qd=Wa(),Fd=Za(),Kd=rc(),Gd=ac(),Vd=dc(),zd=mc(),Jd=yc(),Wd=bc(),wc={processCpuTotal:Ld,processStartTime:Dd,osMemoryHeap:Bd,processOpenFileDescriptors:jd,processMaxFileDescriptors:Ud,eventLoopLag:qd,...typeof process.getActiveResourcesInfo=="function"?{processResources:Gd}:{},processHandles:Fd,processRequests:Kd,heapSizeAndUsed:Vd,heapSpacesSizeAndUsed:zd,version:Jd,gc:Wd},Hd=Object.keys(wc);Hs.exports=function(e){if(e!=null&&!$d(e))throw new TypeError("config must be null, undefined, or an object");e={eventLoopMonitoringPrecision:10,...e};for(let n of Object.values(wc))n(e.register,e)};Hs.exports.metricsList=Hd});var Ys=B(Xs=>{"use strict";var{Grouper:Xd,hashObject:Yd}=Ce();function bt(t){return e=>{if(e.length===0)return;let n={help:e[0].help,name:e[0].name,type:e[0].type,values:[],aggregator:e[0].aggregator},r=new Xd;return e.forEach(s=>{s.values.forEach(o=>{let i=Yd(o.labels);r.add(`${o.metricName}_${i}`,o)})}),r.forEach(s=>{if(s.length===0)return;let o={value:t(s),labels:s[0].labels};s[0].metricName&&(o.metricName=s[0].metricName),n.values.push(o)}),n}}Xs.AggregatorFactory=bt;Xs.aggregators={sum:bt(t=>t.reduce((e,n)=>e+n.value,0)),first:bt(t=>t[0].value),omit:()=>{},average:bt(t=>t.reduce((e,n)=>e+n.value,0)/t.length),min:bt(t=>t.reduce((e,n)=>Math.min(e,n.value),1/0)),max:bt(t=>t.reduce((e,n)=>Math.max(e,n.value),-1/0))}});var Rc=B((Th,Ec)=>{"use strict";var wt=ct(),{Grouper:Qd}=Ce(),{aggregators:Zd}=Ys(),Ze=()=>{let t=ne("cluster");return Ze=()=>t,t},Sc="prom-client:getMetricsReq",Qs="prom-client:getMetricsRes",vc=[wt.globalRegistry],ep=0,Tc=!1,Zs=new Map,Zn=class extends wt{constructor(e=wt.PROMETHEUS_CONTENT_TYPE){super(e),tp()}clusterMetrics(){let e=ep++;return new Promise((n,r)=>{let s=!1;function o(u,f){s||(s=!0,u?r(u):n(f))}let i={responses:[],pending:0,done:o,errorTimeout:setTimeout(()=>{let u=new Error("Operation timed out.");i.done(u)},5e3)};Zs.set(e,i);let c={type:Sc,requestId:e};for(let u in Ze().workers)Ze().workers[u].isConnected()&&(Ze().workers[u].send(c),i.pending++);i.pending===0&&(clearTimeout(i.errorTimeout),process.nextTick(()=>o(null,"")))})}get contentType(){return super.contentType}static aggregate(e,n=wt.PROMETHEUS_CONTENT_TYPE){let r=new wt,s=new Qd;return r.setContentType(n),e.forEach(o=>{o.forEach(i=>{s.add(i.name,i)})}),s.forEach(o=>{let i=o[0].aggregator,c=Zd[i];if(typeof c!="function")throw new Error(`'${i}' is not a defined aggregator.`);let u=c(o);if(u){let f=Object.assign({get:()=>u},u);r.registerMetric(f)}}),r}static setRegistries(e){Array.isArray(e)||(e=[e]),e.forEach(n=>{if(!(n instanceof wt))throw new TypeError(`Expected Registry, got ${typeof n}`)}),vc=e}};function tp(){Tc||(Tc=!0,Ze().isMaster&&Ze().on("message",(t,e)=>{if(e.type===Qs){let n=Zs.get(e.requestId);if(e.error){n.done(new Error(e.error));return}if(e.metrics.forEach(r=>n.responses.push(r)),n.pending--,n.pending===0){Zs.delete(e.requestId),clearTimeout(n.errorTimeout);let s=Zn.aggregate(n.responses).metrics();n.done(null,s)}}}),Ze().isWorker&&process.on("message",t=>{t.type===Sc&&Promise.all(vc.map(e=>e.getMetricsAsJSON())).then(e=>{process.send({type:Qs,requestId:t.requestId,metrics:e})}).catch(e=>{process.send({type:Qs,requestId:t.requestId,error:e.message})})}))}Ec.exports=Zn});var Cc=B(X=>{"use strict";X.register=ct().globalRegistry;X.Registry=ct();Object.defineProperty(X,"contentType",{configurable:!1,enumerable:!0,get(){return X.register.contentType},set(t){X.register.setContentType(t)}});X.prometheusContentType=X.Registry.PROMETHEUS_CONTENT_TYPE;X.openMetricsContentType=X.Registry.OPENMETRICS_CONTENT_TYPE;X.validateMetricName=He().validateMetricName;X.Counter=Rr();X.Gauge=de();X.Histogram=Ar();X.Summary=Ii();X.Pushgateway=Si();X.linearBuckets=Gr().linearBuckets;X.exponentialBuckets=Gr().exponentialBuckets;X.collectDefaultMetrics=Ic();X.aggregators=Ys().aggregators;X.AggregatorRegistry=Rc()});var kc=B(Nc=>{"use strict";var np=[0,255,65535,16777215,4294967295];function rp(t,e,n,r,s){var o;for(o=0;o<s;o++)n[r+o]=t[e+o]}function sp(t,e,n,r){var s;for(s=0;s<r;s++)t[e+s]=t[e-n+s]}function eo(t){this.array=t,this.pos=0}eo.prototype.readUncompressedLength=function(){for(var t=0,e=0,n,r;e<32&&this.pos<this.array.length;){if(n=this.array[this.pos],this.pos+=1,r=n&127,r<<e>>>e!==r)return-1;if(t|=r<<e,n<128)return t;e+=7}return-1};eo.prototype.uncompressToBuffer=function(t){for(var e=this.array,n=e.length,r=this.pos,s=0,o,i,c,u;r<e.length;)if(o=e[r],r+=1,(o&3)===0){if(i=(o>>>2)+1,i>60){if(r+3>=n)return!1;c=i-60,i=e[r]+(e[r+1]<<8)+(e[r+2]<<16)+(e[r+3]<<24),i=(i&np[c])+1,r+=c}if(r+i>n)return!1;rp(e,r,t,s,i),r+=i,s+=i}else{switch(o&3){case 1:i=(o>>>2&7)+4,u=e[r]+(o>>>5<<8),r+=1;break;case 2:if(r+1>=n)return!1;i=(o>>>2)+1,u=e[r]+(e[r+1]<<8),r+=2;break;case 3:if(r+3>=n)return!1;i=(o>>>2)+1,u=e[r]+(e[r+1]<<8)+(e[r+2]<<16)+(e[r+3]<<24),r+=4;break;default:break}if(u===0||u>s)return!1;sp(t,s,u,i),s+=i}return!0};Nc.SnappyDecompressor=eo});var Ac=B(Pc=>{"use strict";var op=16,ip=1<<op,Oc=14,to=new Array(Oc+1);function zt(t,e){return t*506832829>>>e}function Jt(t,e){return t[e]+(t[e+1]<<8)+(t[e+2]<<16)+(t[e+3]<<24)}function Mc(t,e,n){return t[e]===t[n]&&t[e+1]===t[n+1]&&t[e+2]===t[n+2]&&t[e+3]===t[n+3]}function ap(t,e,n,r,s){var o;for(o=0;o<s;o++)n[r+o]=t[e+o]}function xc(t,e,n,r,s){return n<=60?(r[s]=n-1<<2,s+=1):n<256?(r[s]=240,r[s+1]=n-1,s+=2):(r[s]=244,r[s+1]=n-1&255,r[s+2]=n-1>>>8,s+=3),ap(t,e,r,s,n),s+n}function no(t,e,n,r){return r<12&&n<2048?(t[e]=1+(r-4<<2)+(n>>>8<<5),t[e+1]=n&255,e+2):(t[e]=2+(r-1<<2),t[e+1]=n&255,t[e+2]=n>>>8,e+3)}function cp(t,e,n,r){for(;r>=68;)e=no(t,e,n,64),r-=64;return r>64&&(e=no(t,e,n,60),r-=60),no(t,e,n,r)}function lp(t,e,n,r,s){for(var o=1;1<<o<=n&&o<=Oc;)o+=1;o-=1;var i=32-o;typeof to[o]>"u"&&(to[o]=new Uint16Array(1<<o));var c=to[o],u;for(u=0;u<c.length;u++)c[u]=0;var f=e+n,h,_=e,T=e,M,R,k,y,$,P,L,x,I,O,j,S=!0,q=15;if(n>=q)for(h=f-q,e+=1,R=zt(Jt(t,e),i);S;){$=32,k=e;do{if(e=k,M=R,P=$>>>5,$+=1,k=e+P,e>h){S=!1;break}R=zt(Jt(t,k),i),y=_+c[M],c[M]=e-_}while(!Mc(t,e,y));if(!S)break;s=xc(t,T,e-T,r,s);do{for(L=e,x=4;e+x<f&&t[e+x]===t[y+x];)x+=1;if(e+=x,I=L-y,s=cp(r,s,I,x),T=e,e>=h){S=!1;break}O=zt(Jt(t,e-1),i),c[O]=e-1-_,j=zt(Jt(t,e),i),y=_+c[j],c[j]=e-_}while(Mc(t,e,y));if(!S)break;e+=1,R=zt(Jt(t,e),i)}return T<f&&(s=xc(t,T,f-T,r,s)),s}function up(t,e,n){do e[n]=t&127,t=t>>>7,t>0&&(e[n]+=128),n+=1;while(t>0);return n}function ro(t){this.array=t}ro.prototype.maxCompressedLength=function(){var t=this.array.length;return 32+t+Math.floor(t/6)};ro.prototype.compressToBuffer=function(t){var e=this.array,n=e.length,r=0,s=0,o;for(s=up(n,t,s);r<n;)o=Math.min(n-r,ip),s=lp(e,r,o,t,s),r+=o;return s};Pc.SnappyCompressor=ro});var Bc=B(so=>{"use strict";function $c(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"}function er(t){return t instanceof Uint8Array&&(!$c()||!Buffer.isBuffer(t))}function tr(t){return t instanceof ArrayBuffer}function Lc(t){return $c()?Buffer.isBuffer(t):!1}var dp=kc().SnappyDecompressor,pp=Ac().SnappyCompressor,Dc="Argument compressed must be type of ArrayBuffer, Buffer, or Uint8Array";function fp(t,e){if(!er(t)&&!tr(t)&&!Lc(t))throw new TypeError(Dc);var n=!1,r=!1;er(t)?n=!0:tr(t)&&(r=!0,t=new Uint8Array(t));var s=new dp(t),o=s.readUncompressedLength();if(o===-1)throw new Error("Invalid Snappy bitstream");if(o>e)throw new Error(`The uncompressed length of ${o} is too big, expect at most ${e}`);var i,c;if(n){if(i=new Uint8Array(o),!s.uncompressToBuffer(i))throw new Error("Invalid Snappy bitstream")}else if(r){if(i=new ArrayBuffer(o),c=new Uint8Array(i),!s.uncompressToBuffer(c))throw new Error("Invalid Snappy bitstream")}else if(i=Buffer.alloc(o),!s.uncompressToBuffer(i))throw new Error("Invalid Snappy bitstream");return i}function mp(t){if(!er(t)&&!tr(t)&&!Lc(t))throw new TypeError(Dc);var e=!1,n=!1;er(t)?e=!0:tr(t)&&(n=!0,t=new Uint8Array(t));var r=new pp(t),s=r.maxCompressedLength(),o,i,c;if(e?(o=new Uint8Array(s),c=r.compressToBuffer(o)):n?(o=new ArrayBuffer(s),i=new Uint8Array(o),c=r.compressToBuffer(i)):(o=Buffer.alloc(s),c=r.compressToBuffer(o)),!o.slice){var u=new Uint8Array(Array.prototype.slice.call(o,0,c));if(e)return u;if(n)return u.buffer;throw new Error("Not implemented")}return o.slice(0,c)}so.uncompress=fp;so.compress=mp});var G=Oo(Cc(),1);var ao=Oo(Bc(),1);import Ht from"node:fs";import Fc from"node:fs/promises";import Ep from"node:http";import Rp from"node:https";function Uc(t){let e=[],n=t>>>0;for(;n>127;)e.push(n&127|128),n>>>=7;return e.push(n&127),e}function gp(t){let e=[],n=BigInt.asUintN(64,t);for(;n>0x7fn;)e.push(Number(n&0x7fn)|128),n>>=7n;return e.push(Number(n&0x7fn)),e}function hp(t){return gp(BigInt(Math.trunc(t)))}var yp=new TextEncoder;function jc(t){return yp.encode(t)}function _p(t){let e=new ArrayBuffer(8);return new Float64Array(e)[0]=t,new Uint8Array(e)}function oo(t,e){return Uc(t<<3|e)}var bp=0,wp=1,Ip=2;function Wt(t,e){let n=oo(t,Ip),r=Uc(e.length),s=new Uint8Array(n.length+r.length+e.length);return s.set(n,0),s.set(r,n.length),s.set(e,n.length+r.length),s}function nr(t){let e=0;for(let s of t)e+=s.length;let n=new Uint8Array(e),r=0;for(let s of t)n.set(s,r),r+=s.length;return n}function Tp(t){let e=[];if(t.name.length>0){let n=jc(t.name);e.push(Wt(1,n))}if(t.value.length>0){let n=jc(t.value);e.push(Wt(2,n))}return nr(e)}function Sp(t){let e=[];{let n=oo(1,wp),r=_p(t.value),s=new Uint8Array(n.length+8);s.set(n,0),s.set(r,n.length),e.push(s)}{let n=oo(2,bp),r=hp(t.timestampMs),s=new Uint8Array(n.length+r.length);s.set(n,0),s.set(r,n.length),e.push(s)}return nr(e)}function vp(t){let e=[];for(let n of t.labels)e.push(Wt(1,Tp(n)));for(let n of t.samples)e.push(Wt(2,Sp(n)));return nr(e)}function qc(t){let e=[];for(let n of t.timeseries)e.push(Wt(1,vp(n)));return nr(e)}var Cp=64*1024;function Np(t){return t.map(e=>({source_labels:e.source_labels??["__name__"],regex:new RegExp(e.regex??"(.*)"),action:e.action??"keep"}))}function kp(t,e){for(let n of e){let r=n.source_labels.map(o=>t.find(i=>i.name===o)?.value??"").join(";"),s=n.regex.test(r);if(n.action==="keep"&&!s||n.action==="drop"&&s)return null}return t}var et=class{constructor(e,n,r){this.buffer=[];this.flushTimer=null;this.stopped=!1;this.flushing=!1;this.consecutiveFailures=0;this.circuitOpen=!1;this.lastCircuitWarnMs=0;this.config=e,this.logger=n,this.onUnauthorized=r;let s=e.queue_config??{};this.capacity=s.capacity??2500,this.maxSamplesPerSend=s.max_samples_per_send??500,this.batchDeadlineMs=s.batch_send_deadline_ms??5e3,this.maxRetries=s.max_retries??3,this.minBackoffMs=s.min_backoff_ms??30,this.maxBackoffMs=s.max_backoff_ms??5e3,this.timeoutMs=e.remote_timeout_ms??3e4,this.maxConsecutiveFailures=s.max_consecutive_failures??3,this.compiledRelabelConfigs=Np(e.write_relabel_configs??[]);let o=e.tls_config;if(o?.ca_file)try{this.cachedTlsCa=Ht.readFileSync(o.ca_file)}catch(i){n.warn(`diagnostics-prometheus: \u8BFB\u53D6 TLS ca_file \u5931\u8D25: ${i instanceof Error?i.message:String(i)}`)}if(o?.cert_file)try{this.cachedTlsCert=Ht.readFileSync(o.cert_file)}catch(i){n.warn(`diagnostics-prometheus: \u8BFB\u53D6 TLS cert_file \u5931\u8D25: ${i instanceof Error?i.message:String(i)}`)}if(o?.key_file)try{this.cachedTlsKey=Ht.readFileSync(o.key_file)}catch(i){n.warn(`diagnostics-prometheus: \u8BFB\u53D6 TLS key_file \u5931\u8D25: ${i instanceof Error?i.message:String(i)}`)}}enqueue(e){if(this.stopped)return;if(this.circuitOpen){let r=Date.now();r-this.lastCircuitWarnMs>=6e5&&(this.lastCircuitWarnMs=r,this.logger.warn(`diagnostics-prometheus: \u7194\u65AD\u5668\u5DF2\u6253\u5F00\uFF08\u8FDE\u7EED ${this.consecutiveFailures} \u6279\u6B21\u53D1\u9001\u5931\u8D25\uFF09\uFF0C\u6570\u636E\u4E0A\u62A5\u5DF2\u6682\u505C\u3002\u8BF7\u68C0\u67E5\u91C7\u96C6\u5668\u914D\u7F6E\uFF08endpoint/\u8BA4\u8BC1\u4FE1\u606F\u7B49\uFF09\uFF0C\u914D\u7F6E\u4FEE\u6B63\u540E\u5C06\u81EA\u52A8\u6062\u590D\uFF08\u70ED\u52A0\u8F7D\u751F\u6548\u5373\u53EF\uFF09\u3002`));return}this.refreshFileCredentials();let n=this.applyRelabelFilters(e);if(n.length!==0){if(this.buffer.push(...n),this.buffer.length>this.capacity&&this.buffer.splice(0,this.buffer.length-this.capacity),this.buffer.length>=this.maxSamplesPerSend){this.flush();return}this.flushTimer||(this.flushTimer=setTimeout(()=>{this.flushTimer=null,this.flush()},this.batchDeadlineMs),typeof this.flushTimer.unref=="function"&&this.flushTimer.unref())}}async flush(){if(this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),!this.flushing){this.flushing=!0;try{for(;this.buffer.length>0;){let e=this.buffer.splice(0,this.maxSamplesPerSend);await this.sendBatch(e)}}finally{this.flushing=!1}}}updateConfig(e){this.config={...this.config,...e},(e.basic_auth||e.bearer_token_file)&&(this.cachedPasswordFileContent=void 0,this.cachedBearerTokenFileContent=void 0),(this.circuitOpen||this.consecutiveFailures>0)&&(this.consecutiveFailures=0,this.circuitOpen=!1,this.logger.debug("diagnostics-prometheus: \u914D\u7F6E\u5DF2\u66F4\u65B0\uFF0C\u7194\u65AD\u5668\u5DF2\u91CD\u7F6E\uFF0C\u6570\u636E\u4E0A\u62A5\u6062\u590D\u3002"))}async stop(){this.stopped=!0,this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),await this.flush().catch(()=>{})}async refreshFileCredentials(){if(this.config.basic_auth?.password_file&&this.cachedPasswordFileContent===void 0)try{this.cachedPasswordFileContent=(await Fc.readFile(this.config.basic_auth.password_file,"utf-8")).trim()}catch(e){this.logger.warn(`diagnostics-prometheus: \u5F02\u6B65\u8BFB\u53D6 password_file \u5931\u8D25: ${e instanceof Error?e.message:String(e)}`)}if(this.config.bearer_token_file&&this.cachedBearerTokenFileContent===void 0)try{this.cachedBearerTokenFileContent=(await Fc.readFile(this.config.bearer_token_file,"utf-8")).trim()}catch(e){this.logger.warn(`diagnostics-prometheus: \u5F02\u6B65\u8BFB\u53D6 bearer_token_file \u5931\u8D25: ${e instanceof Error?e.message:String(e)}`)}}applyRelabelFilters(e){return this.compiledRelabelConfigs.length===0?e:e.filter(n=>kp(n.labels,this.compiledRelabelConfigs)!==null)}async sendBatch(e){if(e.length===0)return;let n=qc({timeseries:e}),r=ao.default.compress??ao.default.default?.compress;if(!r){this.logger.error(`diagnostics-prometheus: snappyjs compress \u51FD\u6570\u672A\u627E\u5230\uFF0C\u65E0\u6CD5\u538B\u7F29\u6570\u636E\uFF0Cdropping ${e.length} samples\u3002\u8BF7\u68C0\u67E5 snappyjs \u5305\u7248\u672C\u548C\u6A21\u5757\u52A0\u8F7D\u65B9\u5F0F`);return}let s=r(Buffer.from(n));for(let o=0;o<=this.maxRetries;o++)try{let{statusCode:i,body:c}=await this.httpPost(s);if(i>=200&&i<300){this.consecutiveFailures=0;return}if(i===401){if(this.onUnauthorized){this.logger.warn(`diagnostics-prometheus: remote write 401 Unauthorized, \u6B63\u5728\u68C0\u67E5\u51ED\u8BC1\u72B6\u6001 (attempt ${o+1}/${this.maxRetries}). Response: ${c}`);let u;try{u=await this.onUnauthorized()}catch(f){this.logger.error(`diagnostics-prometheus: \u51ED\u8BC1\u5237\u65B0\u5931\u8D25: ${io(f)}, dropping ${e.length} samples. Response: ${c}`),this.recordBatchFailure();return}if(!u){this.logger.error(`diagnostics-prometheus: remote write 401 Unauthorized, \u4E34\u65F6\u5BC6\u94A5\u672A\u8FC7\u671F\uFF0C\u8DF3\u8FC7\u91CD\u8BD5, dropping ${e.length} samples. Response: ${c}`),this.recordBatchFailure();return}if(o<this.maxRetries)continue;this.logger.error(`diagnostics-prometheus: remote write 401 after ${this.maxRetries} retries, dropping ${e.length} samples. Response: ${c}`),this.recordBatchFailure();return}this.logger.error(`diagnostics-prometheus: remote write 401 Unauthorized, dropping ${e.length} samples. Response: ${c}`),this.recordBatchFailure();return}if(i===400||i===415){this.logger.error(`diagnostics-prometheus: remote write rejected with ${i}, dropping ${e.length} samples. Response: ${c}`),this.recordBatchFailure();return}if(i===429||i>=500&&i<600){if(o<this.maxRetries){let u=this.calculateBackoff(o);this.logger.warn(`diagnostics-prometheus: remote write ${i}, retrying in ${u}ms (attempt ${o+1}/${this.maxRetries}). Response: ${c}`),await this.sleep(u);continue}this.logger.error(`diagnostics-prometheus: remote write failed after ${this.maxRetries} retries, dropping ${e.length} samples. Response: ${c}`),this.recordBatchFailure();return}this.logger.warn(`diagnostics-prometheus: remote write unexpected status ${i}. Response: ${c}`);return}catch(i){if(o<this.maxRetries){let c=this.calculateBackoff(o);this.logger.warn(`diagnostics-prometheus: remote write error: ${io(i)}, retrying in ${c}ms`),await this.sleep(c);continue}this.logger.error(`diagnostics-prometheus: remote write failed: ${io(i)}, dropping ${e.length} samples`),this.recordBatchFailure();return}}recordBatchFailure(){++this.consecutiveFailures,!this.circuitOpen&&this.consecutiveFailures>=this.maxConsecutiveFailures&&(this.circuitOpen=!0,this.lastCircuitWarnMs=0,this.logger.error(`diagnostics-prometheus: \u8FDE\u7EED ${this.consecutiveFailures} \u6279\u6B21\u53D1\u9001\u5931\u8D25\uFF0C\u7194\u65AD\u5668\u5DF2\u6253\u5F00\uFF0C\u6570\u636E\u4E0A\u62A5\u5DF2\u6682\u505C\u3002\u8BF7\u68C0\u67E5\u91C7\u96C6\u5668\u914D\u7F6E\uFF08endpoint/\u8BA4\u8BC1\u4FE1\u606F\u7B49\uFF09\uFF0C\u914D\u7F6E\u4FEE\u6B63\u540E\u70ED\u52A0\u8F7D\u5C06\u81EA\u52A8\u91CD\u7F6E\u7194\u65AD\u5668\u5E76\u6062\u590D\u4E0A\u62A5\u3002`))}httpPost(e){return new Promise((n,r)=>{let s=new URL(this.config.url),o=s.protocol==="https:",i=o?Rp:Ep,c={"Content-Type":"application/x-protobuf","Content-Encoding":"snappy","X-Prometheus-Remote-Write-Version":"0.1.0","User-Agent":"openclaw-diagnostics-prometheus/1.0",...this.config.headers??{}};if(this.config.basic_auth){let h=this.config.basic_auth.username??"",_=this.config.basic_auth.password??"";if(!_&&this.config.basic_auth.password_file&&(_=this.cachedPasswordFileContent??"",!_)){this.logger.warn("diagnostics-prometheus: password_file \u7F13\u5B58\u4E3A\u7A7A\uFF0C\u5C1D\u8BD5\u540C\u6B65\u8BFB\u53D6\u4F5C\u4E3A\u56DE\u9000");try{_=Ht.readFileSync(this.config.basic_auth.password_file,"utf-8").trim()}catch(T){this.logger.warn(`diagnostics-prometheus: \u8BFB\u53D6 password_file \u5931\u8D25: ${T instanceof Error?T.message:String(T)}`)}}c.Authorization=`Basic ${Buffer.from(`${h}:${_}`).toString("base64")}`}else if(this.config.bearer_token)c.Authorization=`Bearer ${this.config.bearer_token}`;else if(this.config.bearer_token_file){let h=this.cachedBearerTokenFileContent??"";if(h)c.Authorization=`Bearer ${h}`;else{this.logger.warn("diagnostics-prometheus: bearer_token_file \u7F13\u5B58\u4E3A\u7A7A\uFF0C\u5C1D\u8BD5\u540C\u6B65\u8BFB\u53D6\u4F5C\u4E3A\u56DE\u9000");try{c.Authorization=`Bearer ${Ht.readFileSync(this.config.bearer_token_file,"utf-8").trim()}`}catch(_){this.logger.warn(`diagnostics-prometheus: \u8BFB\u53D6 bearer_token_file \u5931\u8D25: ${_ instanceof Error?_.message:String(_)}`)}}}let u={method:"POST",hostname:s.hostname,port:s.port||(o?443:80),path:s.pathname+s.search,headers:c,timeout:this.timeoutMs};if(o&&this.config.tls_config){let h=this.config.tls_config;this.cachedTlsCa&&(u.ca=this.cachedTlsCa),this.cachedTlsCert&&(u.cert=this.cachedTlsCert),this.cachedTlsKey&&(u.key=this.cachedTlsKey),h.server_name&&(u.servername=h.server_name),h.insecure_skip_verify&&(u.rejectUnauthorized=!1)}let f=i.request(u,h=>{let _=[],T=0,M=!1;h.on("data",R=>{if(!M){if(T+=R.length,T>Cp){M=!0,h.destroy();let k=Buffer.concat(_).toString("utf-8");n({statusCode:h.statusCode??0,body:k+"...(truncated)"});return}_.push(R)}}),h.on("end",()=>{if(M)return;let R=Buffer.concat(_).toString("utf-8");n({statusCode:h.statusCode??0,body:R})}),h.on("error",()=>{M||n({statusCode:h.statusCode??0,body:""})})});f.on("error",r),f.on("timeout",()=>{f.destroy(new Error("remote write request timed out"))}),f.write(Buffer.isBuffer(e)?e:Buffer.from(e)),f.end()})}calculateBackoff(e){let n=this.minBackoffMs*Math.pow(2,e),r=Math.min(n,this.maxBackoffMs),s=r*.25*(Math.random()*2-1);return Math.round(r+s)}sleep(e){return new Promise(n=>setTimeout(n,e))}};function io(t){return t instanceof Error?t.stack??t.message:typeof t=="string"?t:String(t)}import Mp from"node:http";import xp from"node:https";import{URL as Op}from"node:url";import uo from"node:os";import le from"node:fs/promises";import Jc from"node:path";var Pp="http://metadata.tencentyun.com/latest/meta-data",Ap=2e3,$p=30*1e3,co=3,Kc=1024,Gc=3,Xt="clawpro-diagnostics-metrics-cls",Wc=Object.freeze({cvmInstanceId:"",cvmInstanceName:"",cvmInstanceIntraIp:"",hostName:""}),we=Wc,Yt=!1,en=!1,Le=null,Qt=0,Zt=0;function lo(t,e=0){let n=e===0?`${Pp}/${t}`:t;if(e>Gc)return Promise.reject(new Error(`Too many redirects (>${Gc}) for ${n}`));let r;try{r=new Op(n)}catch{return Promise.reject(new Error(`Invalid URL: ${n}`))}let s=r.protocol==="https:"?xp:Mp;return new Promise((o,i)=>{let c=s.get(n,{timeout:Ap},u=>{let f=u.statusCode??0;if(f>=300&&f<400&&u.headers.location){u.resume(),lo(u.headers.location,e+1).then(o,i);return}if(f!==200){u.resume(),i(new Error(`HTTP ${f} for ${n}`));return}Lp(u,n,o,i)});c.on("timeout",()=>{c.destroy(),i(new Error(`Request timeout for ${n}`))}),c.on("error",i)})}function Lp(t,e,n,r){let s=[],o=0,i=!1;t.on("data",c=>{if(!i){if(o+=c.length,o>Kc){i=!0,t.destroy(),r(new Error(`Response body too large (>${Kc} bytes) for ${e}`));return}s.push(c)}}),t.on("end",()=>{i||n(Buffer.concat(s).toString("utf-8").trim())}),t.on("error",c=>{i||r(c)})}async function Dp(t){let e={instanceId:"",instanceName:"",localIpv4:""};try{let n=Jc.join(t,"openclaw.json"),r=await le.readFile(n,"utf8"),f=JSON.parse(r).plugins?.entries?.[Xt]?.config?.instance_metadata;if(!f)return e;let h=_=>typeof _=="string"&&_.trim()?_.trim():"";return{instanceId:h(f.instance_id),instanceName:h(f.instance_name),localIpv4:h(f.local_ipv4)}}catch{return e}}var Vc=50,Bp=5e3;async function jp(t,e){let n=Date.now()+e;for(;Date.now()<n;){let r=null;try{return r=await le.open(t,le.constants.O_CREAT|le.constants.O_EXCL|le.constants.O_WRONLY),await r.writeFile(String(process.pid),"utf8"),await r.close(),r=null,!0}catch(s){if(r!==null){try{await r.close()}catch{}try{await le.unlink(t)}catch{}r=null,await new Promise(c=>setTimeout(c,Vc*10));continue}if(s.code!=="EEXIST")return!1;if(await Up(t)){try{await le.unlink(t)}catch{}continue}await new Promise(c=>setTimeout(c,Vc))}}return!1}async function Up(t){try{let e=await le.readFile(t,"utf8"),n=parseInt(e.trim(),10);if(isNaN(n)||n<=0)return!0;try{return process.kill(n,0),!1}catch(r){return r.code==="ESRCH"}}catch{return!1}}async function qp(t){try{await le.unlink(t)}catch{}}async function po(t,e,n){let r={};if(e.instanceId&&(r.instance_id=e.instanceId),e.instanceName&&(r.instance_name=e.instanceName),Object.keys(r).length===0)return;let s=Jc.join(t,"openclaw.json"),o=s+".lock",i=s+".tmp";if(!await jp(o,Bp)){n?.warn("diagnostics-metrics/instance-metadata: \u83B7\u53D6 openclaw.json \u6587\u4EF6\u9501\u8D85\u65F6\uFF0C\u8DF3\u8FC7\u672C\u6B21\u5199\u5165");return}try{let u={};try{let k=await le.readFile(s,"utf8");u=JSON.parse(k)}catch{}(!u.plugins||typeof u.plugins!="object")&&(u.plugins={});let f=u.plugins;(!f.entries||typeof f.entries!="object")&&(f.entries={});let h=f.entries;(!h[Xt]||typeof h[Xt]!="object")&&(h[Xt]={});let _=h[Xt];(!_.config||typeof _.config!="object")&&(_.config={});let T=_.config,M=T.instance_metadata;T.instance_metadata={...M??{},...r};let R=JSON.stringify(u,null,2)+`
12
+ `;await le.writeFile(i,R,"utf8");try{await le.rename(i,s)}catch(k){if(k.code==="EXDEV"){await le.copyFile(i,s);try{await le.unlink(i)}catch{}}else throw k}n?.debug(`diagnostics-metrics/instance-metadata: \u5B9E\u4F8B\u5143\u6570\u636E\u5DF2\u6301\u4E45\u5316\u5199\u5165 openclaw.json (${Object.keys(r).join(", ")})`)}catch(u){try{await le.unlink(i)}catch{}n?.warn(`diagnostics-metrics/instance-metadata: \u5199\u5165\u5B9E\u4F8B\u5143\u6570\u636E\u5230 openclaw.json \u5931\u8D25: ${String(u)}`)}finally{await qp(o)}}function Hc(){let t;try{t=uo.networkInterfaces()}catch{return""}let e=[];for(let[r,s]of Object.entries(t))if(s)for(let o of s)o.family!=="IPv4"||o.internal||o.address.startsWith("169.254.")||e.push({iface:r,address:o.address});if(e.length===0)return"";let n=r=>r.startsWith("eth")?0:r.startsWith("en")?1:2;return e.sort((r,s)=>{let o=n(r.iface),i=n(s.iface);return o!==i?o-i:r.iface<s.iface?-1:r.iface>s.iface?1:0}),e[0].address}async function fo(t){let e=we,n=!e.cvmInstanceId,r=!e.cvmInstanceName,[s,o]=await Promise.all([n?zc(lo("instance-id")):Promise.resolve({status:"skipped"}),r?zc(lo("instance-name")):Promise.resolve({status:"skipped"})]),i=e.hostName;try{i=uo.hostname()}catch{t?.warn("diagnostics-metrics/instance-metadata: \u83B7\u53D6 hostname \u5931\u8D25")}let c=Hc(),u={},f={...e,hostName:i||e.hostName};s.status==="fulfilled"&&s.value?(f.cvmInstanceId=s.value,u.instanceId=s.value):s.status==="rejected"?t?.warn(`diagnostics-metrics/instance-metadata: \u83B7\u53D6 instance-id \u5931\u8D25: ${String(s.reason)}`):s.status==="fulfilled"&&t?.warn("diagnostics-metrics/instance-metadata: \u83B7\u53D6 instance-id \u5931\u8D25: empty response"),o.status==="fulfilled"&&o.value?(f.cvmInstanceName=o.value,u.instanceName=o.value):o.status==="rejected"?t?.warn(`diagnostics-metrics/instance-metadata: \u83B7\u53D6 instance-name \u5931\u8D25: ${String(o.reason)}`):o.status==="fulfilled"&&t?.warn("diagnostics-metrics/instance-metadata: \u83B7\u53D6 instance-name \u5931\u8D25: empty response"),c?f.cvmInstanceIntraIp=c:t?.warn("diagnostics-metrics/instance-metadata: \u83B7\u53D6\u672C\u5730\u975E\u73AF\u56DE IPv4 \u5730\u5740\u5931\u8D25: \u672A\u627E\u5230\u53EF\u7528\u7F51\u7EDC\u63A5\u53E3"),we=Object.freeze(f);let h=!!f.cvmInstanceId&&!!f.cvmInstanceName;return t?.debug(`diagnostics-metrics/instance-metadata: \u5F53\u524D\u5B9E\u4F8B\u4FE1\u606F cvm_instance_id=${we.cvmInstanceId}, cvm_instance_name=${we.cvmInstanceName}, cvm_instance_intra_ip=${we.cvmInstanceIntraIp}, host_name=${we.hostName}`),{allSuccess:h,fetched:u}}function zc(t){return t.then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))}function Oe(){return we}function Xc(t,e,n){if(!Yt){e?.warn("diagnostics-metrics/instance-metadata: updateInstanceMetadata \u8C03\u7528\u65F6\u6A21\u5757\u5C1A\u672A\u521D\u59CB\u5316\uFF0C\u672C\u6B21\u70ED\u66F4\u65B0\u5DF2\u8DF3\u8FC7");return}let r=we,s=t.instanceId!==void 0?t.instanceId:r.cvmInstanceId,o=t.instanceName!==void 0?t.instanceName:r.cvmInstanceName,i=t.localIpv4!==void 0?t.localIpv4:r.cvmInstanceIntraIp;if(s===r.cvmInstanceId&&o===r.cvmInstanceName&&i===r.cvmInstanceIntraIp)return;we=Object.freeze({cvmInstanceId:s,cvmInstanceName:o,cvmInstanceIntraIp:i,hostName:r.hostName}),(!s||!o)&&(e?.debug("diagnostics-metrics/instance-metadata: \u70ED\u66F4\u65B0\u6E05\u7A7A\u4E86\u90E8\u5206\u5B57\u6BB5\uFF0C\u91CD\u65B0\u89E6\u53D1 metadata \u63A5\u53E3\u83B7\u53D6"),Qt=0,Le&&(clearTimeout(Le),Le=null),fo(e).then(({allSuccess:u,fetched:f})=>{en||(n&&(f.instanceId||f.instanceName)&&po(n,f,e),u||mo(e,n))}))}async function rr(t,e){if(Zt++,!Yt){en=!1,Yt=!0;try{let n="";try{n=uo.hostname()}catch{}let r=e?await Dp(e):{instanceId:"",instanceName:"",localIpv4:""},s=r.localIpv4||Hc();s||t?.warn("diagnostics-metrics/instance-metadata: \u83B7\u53D6\u672C\u5730\u975E\u73AF\u56DE IPv4 \u5730\u5740\u5931\u8D25: \u672A\u627E\u5230\u53EF\u7528\u7F51\u7EDC\u63A5\u53E3");let o={cvmInstanceId:r.instanceId,cvmInstanceName:r.instanceName,cvmInstanceIntraIp:s,hostName:n};if(we=Object.freeze(o),o.cvmInstanceId&&o.cvmInstanceName){t?.debug(`diagnostics-metrics/instance-metadata: \u5F53\u524D\u5B9E\u4F8B\u4FE1\u606F cvm_instance_id=${o.cvmInstanceId}, cvm_instance_name=${o.cvmInstanceName}, cvm_instance_intra_ip=${o.cvmInstanceIntraIp}, host_name=${o.hostName}`);return}let{allSuccess:i,fetched:c}=await fo(t);if(e&&(c.instanceId||c.instanceName)&&await po(e,c,t),!i){t?.warn("diagnostics-metrics/instance-metadata: \u9996\u6B21\u83B7\u53D6\u5B58\u5728\u672A\u5C31\u7EEA\u5B57\u6BB5\uFF0C\u53EF\u80FD\u4E0D\u5728\u817E\u8BAF\u4E91\u73AF\u5883\uFF0C\u5C06\u5728 30 \u79D2\u540E\u91CD\u8BD5"),mo(t,e);return}}catch(n){throw Yt=!1,Zt--,n}}}function mo(t,e){if(Qt>=co){t?.warn(`diagnostics-metrics/instance-metadata: \u5DF2\u91CD\u8BD5 ${co} \u6B21\u4ECD\u672A\u6210\u529F\uFF0C\u505C\u6B62\u91CD\u8BD5`);return}Le=setTimeout(async()=>{if(en)return;Qt++,t?.debug(`diagnostics-metrics/instance-metadata: \u7B2C ${Qt}/${co} \u6B21\u91CD\u8BD5\u83B7\u53D6\u5143\u6570\u636E`);let{allSuccess:n,fetched:r}=await fo(t);if(!en&&(e&&(r.instanceId||r.instanceName)&&await po(e,r,t),!n)){mo(t,e);return}},$p),typeof Le.unref=="function"&&Le.unref()}function tn(){Zt!==0&&(Zt--,!(Zt>0)&&(en=!0,Le&&(clearTimeout(Le),Le=null),Qt=0,Yt=!1,we=Wc))}import{createCipheriv as Fp,createDecipheriv as Kp,createHash as Gp,randomBytes as Vp}from"node:crypto";var nn="ENC:",zp="openclaw-diag-metrics-cls",Yc="aes-256-cbc";function Qc(){return Gp("sha256").update(zp).digest()}function go(t){if(!t||t.startsWith(nn))return t;let e=Qc(),n=Vp(16),r=Fp(Yc,e,n),s=Buffer.concat([r.update(t,"utf8"),r.final()]),o=Buffer.concat([n,s]).toString("base64");return`${nn}${o}`}function ie(t){if(!t||!t.startsWith(nn))return t;try{let e=t.slice(nn.length),n=Buffer.from(e,"base64");if(n.length<17)return console.error(`[crypto-utils] \u89E3\u5BC6\u5931\u8D25: \u5BC6\u6587\u6570\u636E\u4E0D\u5B8C\u6574 (\u957F\u5EA6=${n.length}), \u8BF7\u68C0\u67E5\u914D\u7F6E\u6587\u4EF6\u4E2D\u7684\u52A0\u5BC6\u5B57\u6BB5\u662F\u5426\u88AB\u7BE1\u6539\u6216\u622A\u65AD`),"";let r=n.subarray(0,16),s=n.subarray(16),o=Qc(),i=Kp(Yc,o,r);return Buffer.concat([i.update(s),i.final()]).toString("utf8")}catch(e){let n=e instanceof Error?e.message:String(e);return console.error(`[crypto-utils] \u89E3\u5BC6\u5931\u8D25: ${n}, \u8BF7\u68C0\u67E5\u914D\u7F6E\u6587\u4EF6\u4E2D\u7684\u52A0\u5BC6\u5B57\u6BB5\u662F\u5426\u6B63\u786E`),""}}function ho(t){return typeof t=="string"&&t.startsWith(nn)}var It="clawpro-diagnostics-metrics-cls";import el from"node:path";import yo from"node:fs/promises";var Jp=300*1e3;function tl(t){return t?/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t):!0}function Wp(t){let e=typeof t?.metricTopicId=="string"?t.metricTopicId.trim():"",n=typeof t?.endpoint=="string"?t.endpoint.trim():"",r=typeof t?.credentialMode=="string"&&t.credentialMode.trim()==="cvmRole"?"cvmRole":"static",s=typeof t?.roleName=="string"&&t.roleName.trim()?t.roleName.trim():"",o=typeof t?.secretId=="string"?ie(t.secretId.trim()):"",i=typeof t?.secretKey=="string"?ie(t.secretKey.trim()):"",c=typeof t?.token=="string"?t.token.trim():void 0;if(e&&!tl(e)&&(e=""),r==="static"&&(!o||!i)||r==="cvmRole"&&!s)return null;let u=typeof t?.credentialRefreshIntervalMs=="number"&&t.credentialRefreshIntervalMs>=6e4?t.credentialRefreshIntervalMs:Jp,f=t?.enableReport!==!1;return{metricTopicId:e,credentialMode:r,roleName:s,secretId:o,secretKey:i,token:c,endpoint:n,credentialRefreshIntervalMs:u,enableReport:f}}var Hp=1e4;async function Xp(t){try{let e=await yo.readFile(t,"utf8"),i=JSON.parse(e).plugins?.entries?.[It]?.config,c=i?.cls,u=typeof c?.metricTopicId=="string"?c.metricTopicId.trim():"",f=typeof c?.endpoint=="string"?c.endpoint.trim():"",h=c?.enableReport!==!1,_=typeof c?.secretId=="string"?ie(c.secretId.trim()):"",T=typeof c?.secretKey=="string"?ie(c.secretKey.trim()):"",M=u;u&&!tl(u)&&(M=void 0);let R=i?.instance_metadata,k=q=>typeof q!="string"?null:q.trim(),y=R?k(R.instance_id):null,$=R?k(R.instance_name):null,P=R?k(R.local_ipv4):null,L=y??"",x=$??"",I=P??"",O=i?.log,j=O?.enableLogReport===!0,S=typeof O?.logTopicId=="string"?O.logTopicId.trim():"";return{metricTopicId:M,endpoint:f,enableReport:h,secretId:_,secretKey:T,instanceId:L,instanceName:x,localIpv4:I,enableLogReport:j,logTopicId:S}}catch{return null}}function Zc(t,e){return!t||!e?"":`https://${t}/prometheus/${e}/api/v1/write`}function nl(t){return t instanceof Error?t.stack??t.message:typeof t=="string"?t:String(t)}async function Yp(t){let e=el.join(t.stateDir,"openclaw.json"),n;try{n=await yo.readFile(e,"utf8")}catch{return}let r;try{r=JSON.parse(n)}catch{return}let s=!1,o=r.diagnostics;o?.enabled!==!0&&(r.diagnostics={...o??{},enabled:!0},s=!0,t.logger.debug?.("diagnostics-metrics/prometheus: \u5DF2\u81EA\u52A8\u5199\u5165 diagnostics.enabled=true \u5230 openclaw.json\uFF0C\u91CD\u542F\u540E\u751F\u6548"));let h=r.plugins?.entries?.[It]?.config?.cls;if(h){let _=h.secretId,T=h.secretKey;typeof _=="string"&&_.trim()&&!ho(_.trim())&&(h.secretId=go(_.trim()),s=!0,t.logger.debug?.("diagnostics-metrics/prometheus: \u5DF2\u5C06 secretId \u52A0\u5BC6\u540E\u5199\u5165\u914D\u7F6E\u6587\u4EF6")),typeof T=="string"&&T.trim()&&!ho(T.trim())&&(h.secretKey=go(T.trim()),s=!0,t.logger.debug?.("diagnostics-metrics/prometheus: \u5DF2\u5C06 secretKey \u52A0\u5BC6\u540E\u5199\u5165\u914D\u7F6E\u6587\u4EF6"))}s&&await yo.writeFile(e,JSON.stringify(r,null,2)+`
13
+ `,"utf8")}function rl(t,e,n){let r=Wp(t),s=null,o=null,i=[],c=null,u=null,f=null,h=null,_="",T="",M=!0,R="",k="",y="",$="",P="",L=!1,x="";return{id:"clawpro-diagnostics-metrics-cls",getExports(){return u},async start(I){let O={debug:I.logger.debug??(()=>{}),info:I.logger.info.bind(I.logger),warn:I.logger.warn.bind(I.logger),error:I.logger.error.bind(I.logger)},j=t;if(j?.enabled===!1)return;let S=j?.metric_prefix??"openclaw",q={...j?.external_labels??{}};await rr(O,I.stateDir).catch(w=>{let D=w instanceof Error?w.message:String(w);I.logger.warn(`diagnostics-metrics/prometheus: \u5B9E\u4F8B\u5143\u6570\u636E\u5B9A\u65F6\u5237\u65B0\u542F\u52A8\u5931\u8D25 (${D})\uFF0C\u5C06\u4F7F\u7528 unknown \u4F5C\u4E3A\u9ED8\u8BA4\u503C`)}),await Yp(I).catch(()=>{I.logger.warn('diagnostics-metrics/prometheus: \u65E0\u6CD5\u81EA\u52A8\u5199\u5165 diagnostics.enabled\uFF0C\u8BF7\u624B\u52A8\u5728 openclaw.json \u4E2D\u6DFB\u52A0 { "diagnostics": { "enabled": true } }')}),s=new G.Registry,j?.default_metrics!==!1&&(0,G.collectDefaultMetrics)({register:s,prefix:`${S}_node_`});let V=new G.Counter({name:`${S}_tokens_total`,help:"Total tokens consumed",labelNames:["openclaw_type","openclaw_provider","openclaw_model","openclaw_channel"],registers:[s]}),Y=new G.Counter({name:`${S}_cost_usd_total`,help:"Estimated model cost in USD",labelNames:["openclaw_provider","openclaw_model","openclaw_channel"],registers:[s]}),ce=new G.Histogram({name:`${S}_run_duration_ms`,help:"Agent run duration in milliseconds",labelNames:["openclaw_provider","openclaw_model","openclaw_channel"],buckets:[100,250,500,1e3,2500,5e3,1e4,3e4,6e4],registers:[s]}),Se=new G.Histogram({name:`${S}_context_tokens`,help:"Context window token count",labelNames:["openclaw_provider","openclaw_model","openclaw_channel","openclaw_type"],buckets:[1e3,4e3,8e3,16e3,32e3,64e3,128e3,2e5],registers:[s]}),ve=new G.Counter({name:`${S}_webhook_received_total`,help:"Webhook requests received",labelNames:["openclaw_channel","openclaw_update_type"],registers:[s]}),nt=new G.Counter({name:`${S}_webhook_error_total`,help:"Webhook processing errors",labelNames:["openclaw_channel","openclaw_update_type"],registers:[s]}),C=new G.Histogram({name:`${S}_webhook_duration_ms`,help:"Webhook processing duration in milliseconds",labelNames:["openclaw_channel","openclaw_update_type"],buckets:[10,50,100,250,500,1e3,2500,5e3],registers:[s]}),rt=new G.Counter({name:`${S}_message_queued_total`,help:"Messages queued for processing",labelNames:["openclaw_channel","openclaw_source"],registers:[s]}),Ee=new G.Counter({name:`${S}_message_processed_total`,help:"Messages processed by outcome",labelNames:["openclaw_channel","openclaw_outcome"],registers:[s]}),ye=new G.Histogram({name:`${S}_message_duration_ms`,help:"Message processing duration in milliseconds",labelNames:["openclaw_channel","openclaw_outcome"],buckets:[100,500,1e3,2500,5e3,1e4,3e4,6e4],registers:[s]}),ln=new G.Gauge({name:`${S}_queue_depth`,help:"Current queue depth per lane",labelNames:["openclaw_lane"],registers:[s]}),lr=new G.Histogram({name:`${S}_queue_wait_ms`,help:"Queue wait time before execution in milliseconds",labelNames:["openclaw_lane"],buckets:[10,50,100,500,1e3,5e3,1e4],registers:[s]}),z=new G.Counter({name:`${S}_queue_lane_enqueue_total`,help:"Queue lane enqueue events",labelNames:["openclaw_lane"],registers:[s]}),st=new G.Counter({name:`${S}_queue_lane_dequeue_total`,help:"Queue lane dequeue events",labelNames:["openclaw_lane"],registers:[s]}),ur=new G.Counter({name:`${S}_session_state_total`,help:"Session state transitions",labelNames:["openclaw_state","openclaw_reason"],registers:[s]}),un=new G.Counter({name:`${S}_session_stuck_total`,help:"Sessions detected as stuck",labelNames:["openclaw_state"],registers:[s]}),dn=new G.Histogram({name:`${S}_session_stuck_age_ms`,help:"Age of stuck sessions in milliseconds",labelNames:["openclaw_state"],buckets:[1e3,5e3,1e4,3e4,6e4,12e4,3e5],registers:[s]}),pn=new G.Counter({name:`${S}_run_attempt_total`,help:"Agent run attempts",labelNames:["openclaw_attempt"],registers:[s]}),fn=new G.Gauge({name:`${S}_active_sessions`,help:"Number of currently active sessions",registers:[s]}),dr=new G.Gauge({name:`${S}_waiting_sessions`,help:"Number of sessions in waiting state",registers:[s]}),pr=new G.Gauge({name:`${S}_queued_messages`,help:"Total messages currently queued",registers:[s]}),fr=new G.Counter({name:`${S}_tool_loop_total`,help:"Tool loop detections",labelNames:["openclaw_tool","openclaw_detector","openclaw_level","openclaw_action"],registers:[s]}),Ct=w=>{try{switch(w.type){case"model.usage":{let D={openclaw_provider:w.provider??"unknown",openclaw_model:w.model??"unknown",openclaw_channel:w.channel??"unknown"},J=w.usage;if(!J)break;J.input&&V.inc({...D,openclaw_type:"input"},J.input),J.output&&V.inc({...D,openclaw_type:"output"},J.output),J.cacheRead&&V.inc({...D,openclaw_type:"cache_read"},J.cacheRead),J.cacheWrite&&V.inc({...D,openclaw_type:"cache_write"},J.cacheWrite),J.promptTokens&&V.inc({...D,openclaw_type:"prompt"},J.promptTokens),J.total&&V.inc({...D,openclaw_type:"total"},J.total),w.costUsd&&Y.inc({openclaw_provider:D.openclaw_provider,openclaw_model:D.openclaw_model,openclaw_channel:D.openclaw_channel},w.costUsd),w.durationMs&&ce.observe({openclaw_provider:D.openclaw_provider,openclaw_model:D.openclaw_model,openclaw_channel:D.openclaw_channel},w.durationMs),w.context?.limit&&Se.observe({openclaw_provider:D.openclaw_provider,openclaw_model:D.openclaw_model,openclaw_channel:D.openclaw_channel,openclaw_type:"limit"},w.context.limit),w.context?.used&&Se.observe({openclaw_provider:D.openclaw_provider,openclaw_model:D.openclaw_model,openclaw_channel:D.openclaw_channel,openclaw_type:"used"},w.context.used);break}case"webhook.received":{ve.inc({openclaw_channel:w.channel??"unknown",openclaw_update_type:w.updateType??"unknown"});break}case"webhook.processed":{typeof w.durationMs=="number"&&C.observe({openclaw_channel:w.channel??"unknown",openclaw_update_type:w.updateType??"unknown"},w.durationMs);break}case"webhook.error":{nt.inc({openclaw_channel:w.channel??"unknown",openclaw_update_type:w.updateType??"unknown"});break}case"message.queued":{rt.inc({openclaw_channel:w.channel??"unknown",openclaw_source:w.source??"unknown"});break}case"message.processed":{Ee.inc({openclaw_channel:w.channel??"unknown",openclaw_outcome:w.outcome??"unknown"}),typeof w.durationMs=="number"&&ye.observe({openclaw_channel:w.channel??"unknown",openclaw_outcome:w.outcome??"unknown"},w.durationMs);break}case"queue.lane.enqueue":{z.inc({openclaw_lane:w.lane}),ln.set({openclaw_lane:w.lane},w.queueSize??0);break}case"queue.lane.dequeue":{st.inc({openclaw_lane:w.lane}),ln.set({openclaw_lane:w.lane},w.queueSize??0),typeof w.waitMs=="number"&&lr.observe({openclaw_lane:w.lane},w.waitMs);break}case"session.state":{ur.inc({openclaw_state:w.state,openclaw_reason:w.reason??""});break}case"session.stuck":{un.inc({openclaw_state:w.state}),typeof w.ageMs=="number"&&dn.observe({openclaw_state:w.state},w.ageMs);break}case"run.attempt":{pn.inc({openclaw_attempt:String(w.attempt)});break}case"diagnostic.heartbeat":{fn.set(w.active??0),dr.set(w.waiting??0),pr.set(w.queued??0);break}case"tool.loop":{fr.inc({openclaw_tool:w.toolName,openclaw_detector:w.detector,openclaw_level:w.level,openclaw_action:w.action});break}}}catch(D){I.logger.error(`diagnostics-metrics/prometheus: event handler failed (${w.type}): ${nl(D)}`)}},mn="openclaw/plugin-sdk/diagnostics-otel",gn="openclaw/plugin-sdk/diagnostic-runtime",Ke;try{Ke=(await import(mn)).onDiagnosticEvent}catch{}if(!Ke)try{Ke=(await import(gn)).onDiagnosticEvent}catch{}Ke?o=Ke(Ct):I.logger.warn("diagnostics-metrics/prometheus: onDiagnosticEvent \u5728\u5F53\u524D openclaw \u7248\u672C\u4E2D\u4E0D\u53EF\u7528\uFF0C\u6307\u6807\u91C7\u96C6\u5DF2\u8DF3\u8FC7");let hn=r?.metricTopicId??"",Ge=r?.endpoint??"";_=hn,T=Ge,M=r?.enableReport??!0,R=r?.secretId??"",k=r?.secretKey??"",y=Oe().cvmInstanceId,$=Oe().cvmInstanceName,P=Oe().cvmInstanceIntraIp;let Ve=j?.remote_write??[],ze=r?.credentialMode??"static",ko=r?.roleName||"",Q=el.join(I.stateDir,"openclaw.json"),_e=async()=>e?(I.logger.warn("diagnostics-metrics/prometheus: \u6536\u5230 401\uFF0C\u901A\u8FC7\u5171\u4EAB\u51ED\u8BC1\u7BA1\u7406\u5668\u68C0\u67E5\u5E76\u5237\u65B0\u4E34\u65F6\u5BC6\u94A5"),await e.forceRefresh()):ze==="cvmRole"?(I.logger.warn("diagnostics-metrics/prometheus: \u6536\u5230 401\uFF0C\u4F46\u5171\u4EAB\u51ED\u8BC1\u7BA1\u7406\u5668\u4E0D\u53EF\u7528"),!1):(I.logger.warn("diagnostics-metrics/prometheus: \u6536\u5230 401\uFF0C\u5F53\u524D\u4E3A static \u51ED\u8BC1\u6A21\u5F0F\uFF0C\u8BF7\u68C0\u67E5 secretId/secretKey \u662F\u5426\u6B63\u786E"),!1),De=Zc(T,_),yn=Ve.some(w=>!w.url),_n=Ve.some(w=>w.url);if(De&&yn&&!_n){let w=Ve.find(D=>!D.url);w&&(i=[new et({...w,url:De},O,_e)])}else De&&Ve.length===0?i=[new et({url:De},O,_e)]:i=Ve.filter(w=>w.url).map(w=>new et(w,O,_e));let Be=j?.push_interval_ms??3e4;if(i.length>0&&M?(c=setInterval(()=>{sr(s,i,q,O)},Be),typeof c.unref=="function"&&c.unref(),I.logger.debug?.(`diagnostics-metrics/prometheus: remote write enabled for ${i.length} target(s), push interval ${Be}ms`)):i.length>0&&!M&&I.logger.debug?.("diagnostics-metrics/prometheus: remote write clients created but pushTimer not started (enableReport=false)"),ze==="static"&&r&&i.length>0&&!e){let w=r.secretKey;r.token!==void 0&&r.token!==""&&(w=w+"#"+r.token);let D={username:r.secretId,password:w};for(let J of i)J.updateConfig({basic_auth:D});I.logger.debug?.("diagnostics-metrics/prometheus: static \u51ED\u8BC1\u6A21\u5F0F\uFF08\u65E0\u5171\u4EAB\u7BA1\u7406\u5668\uFF09\uFF0C\u5DF2\u8BBE\u7F6E basic_auth")}let je=w=>{let D=w.secretKey;w.token!==void 0&&w.token!==""&&(D=D+"#"+w.token);let J={username:w.secretId,password:D};for(let it of i)it.updateConfig({basic_auth:J});i.length>0&&!c&&M&&(c=setInterval(()=>{sr(s,i,q,O)},Be),typeof c.unref=="function"&&c.unref(),I.logger.debug?.("diagnostics-metrics/prometheus: \u51ED\u8BC1\u66F4\u65B0\u6210\u529F\uFF0C\u5DF2\u6062\u590D remote write \u63A8\u9001"))};if(e&&i.length>0){let w=e.getCredentialSnapshot();w.secretId&&w.secretKey&&je(w),h=e.subscribe(D=>{je(D),I.logger.debug?.("diagnostics-metrics/prometheus: \u5171\u4EAB\u51ED\u8BC1\u5DF2\u66F4\u65B0\uFF0C\u5DF2\u540C\u6B65\u5230 RemoteWriteClient")}),I.logger.debug?.("diagnostics-metrics/prometheus: \u5DF2\u8BA2\u9605\u5171\u4EAB\u51ED\u8BC1\u7BA1\u7406\u5668\u7684\u51ED\u8BC1\u53D8\u66F4\u4E8B\u4EF6")}let ot=!1;f=setInterval(()=>{(async()=>{if(!ot){ot=!0;try{let w=await Xp(Q);if(!w)return;let D=w.metricTopicId??hn,J=w.endpoint??Ge,it=w.enableReport,Nt=w.secretId,kt=w.secretKey,Mt=w.instanceId,xt=w.instanceName,a=w.localIpv4,d=D!==_,g=J!==T,p=Oe();!y&&p.cvmInstanceId&&(y=p.cvmInstanceId),!$&&p.cvmInstanceName&&($=p.cvmInstanceName),!P&&p.cvmInstanceIntraIp&&(P=p.cvmInstanceIntraIp);let l=Mt!==y||xt!==$||a!==P,m=it!==M,b=ze==="static"&&Nt&&kt&&(Nt!==R||kt!==k);if(l&&(y=Mt,$=xt,P=a,Xc({instanceId:Mt,instanceName:xt,localIpv4:a},O,I.stateDir),I.logger.debug?.(`diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0Cinstance_metadata \u5DF2\u66F4\u65B0 (instance_id=${y}, instance_name=${$}, local_ipv4=${P})`)),b){if(R=Nt,k=kt,e&&ze==="static")e.updateStaticCredential(R,k);else if(i.length>0){let v=k;r?.token!==void 0&&r.token!==""&&(v=v+"#"+r.token);let U={username:R,password:v};for(let F of i)F.updateConfig({basic_auth:U})}I.logger.debug?.("diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0Cstatic \u6A21\u5F0F\u5BC6\u94A5\u5DF2\u66F4\u65B0")}if(m&&(M=it,M?(i.length>0&&!c&&(c=setInterval(()=>{sr(s,i,q,O)},Be),typeof c.unref=="function"&&c.unref()),I.logger.debug?.("diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0CenableReport=true\uFF0C\u5DF2\u6062\u590D remote write \u63A8\u9001")):(c&&(clearInterval(c),c=null),I.logger.debug?.("diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0CenableReport=false\uFF0C\u5DF2\u6682\u505C remote write \u63A8\u9001"))),n){let v=w.enableLogReport,U=w.logTopicId;(v!==L||U!==x)&&(L=v,x=U,n(v,U),I.logger.debug?.(`diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0Clog \u914D\u7F6E\u5DF2\u53D8\u66F4\uFF08enableLogReport=${v}\uFF0ClogTopicId=${U||"(\u7A7A)"}\uFF09`))}if(!d&&!g)return;_=D,T=J;let N=Zc(T,_);if(!N){if(i.length>0){I.logger.debug?.("diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0Cendpoint \u6216 metricTopicId \u4E3A\u7A7A\uFF0Cremote write \u5DF2\u6682\u505C");for(let v of i)v.stop().catch(()=>{});i=[],c&&(clearInterval(c),c=null)}return}if(i.length>0){for(let v of i)v.updateConfig({url:N});I.logger.debug?.(`diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0C\u5DF2\u66F4\u65B0 RemoteWriteClient url=${N}`)}else{let v=new et({url:N},O,_e);if(i=[v],e){let U=e.getCredentialSnapshot();U.secretId&&U.secretKey&&je(U)}else ze==="static"&&R&&k&&v.updateConfig({basic_auth:{username:R,password:k}});e&&!h&&(h=e.subscribe(U=>{je(U),I.logger.debug?.("diagnostics-metrics/prometheus: \u5171\u4EAB\u51ED\u8BC1\u5DF2\u66F4\u65B0\uFF0C\u5DF2\u540C\u6B65\u5230 RemoteWriteClient")})),M&&!c&&(c=setInterval(()=>{sr(s,i,q,O)},Be),typeof c.unref=="function"&&c.unref()),I.logger.debug?.(`diagnostics-metrics/prometheus: \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0C\u52A8\u6001\u521B\u5EFA RemoteWriteClient url=${N}`)}}finally{ot=!1}}})()},Hp),f&&typeof f.unref=="function"&&f.unref(),u=j?.pull!==!1?{registry:s}:null,I.logger.debug?.(`diagnostics-metrics/prometheus: started (pull=${j?.pull!==!1}, remote_write=${i.length} targets, metricTopicId=${_||"(\u5F85\u914D\u7F6E\u6587\u4EF6\u6CE8\u5165)"}, endpoint=${T||"(\u5F85\u914D\u7F6E\u6587\u4EF6\u6CE8\u5165)"})`)},async stop(){o?.(),o=null,f&&(clearInterval(f),f=null),h&&(h(),h=null),c&&(clearInterval(c),c=null);for(let I of i)await I.stop().catch(()=>{});i=[],tn(),s&&(s.clear(),s=null),u=null,_="",T="",M=!0,R="",k="",y="",$="",P=""}}}async function sr(t,e,n,r){if(e.length!==0)try{let s=Oe(),o={...n};o.cvm_instance_id||(o.cvm_instance_id=s.cvmInstanceId),o.cvm_instance_name||(o.cvm_instance_name=s.cvmInstanceName),o.cvm_instance_intra_ip||(o.cvm_instance_intra_ip=s.cvmInstanceIntraIp),o.host_name||(o.host_name=s.hostName);let i=await t.getMetricsAsJSON(),c=Date.now(),u=[];for(let f of i){let h=f.values;for(let _ of h){let M=[{name:"__name__",value:_.metricName??f.name}];for(let[R,k]of Object.entries(o))M.push({name:R,value:k});if(_.labels)for(let[R,k]of Object.entries(_.labels))M.push({name:R,value:String(k)});M.sort((R,k)=>R.name.localeCompare(k.name)),u.push({labels:M,samples:[{value:_.value??0,timestampMs:c}]})}}if(u.length===0)return;for(let f of e)f.enqueue(u)}catch(s){r.error(`diagnostics-metrics/prometheus: failed to collect metrics for push: ${nl(s)}`)}}import{Producer as ir}from"tencentcloud-cls-sdk-nodejs";import{hostname as El}from"node:os";import{basename as df,join as pf}from"node:path";var E="[diagnostics-metrics-cls/trace]",tt=32e5,rn=4096,_o=20,sl=3e3,bo=1200*1e3,ol=600*1e3,il=1e4,al=It,cl="__temp_run_",ll=15e3,ul=1e4,wo=300*1e3,dl=5e3;import{randomBytes as Qp}from"crypto";function ae(t=16){let e=Math.ceil(t/2);return Qp(e).toString("hex").slice(0,t)}function Ie(t){return t.length>tt?t.substring(0,tt):t}function fl(t){let e=JSON.stringify(t);if(e.length<=tt)return e;let n=To(t),r=Zp(n.length),s=64;for(let i=0;i<20;i++){let c=JSON.stringify(n);if(c.length<=tt)return c;let u=!1;for(let f of r){let h=n[f];if(h&&ef(h,s)){u=!0;break}}if(!u)break}let o=tf(n);return JSON.stringify(o)}function Zp(t){let e=[];if(t<=0)return e;let n=Math.floor(t/2);e.push(n);for(let r=1;r<=t;r++){let s=n-r,o=n+r;o<t&&e.push(o),s>=0&&e.push(s)}return e}function ef(t,e){let n=null,r=(c,u)=>{typeof c=="string"&&(c.length<=e||(!n||c.length>n.value.length)&&(n={set:u,value:c}))};if(r(t.content,c=>{t.content=c}),Array.isArray(t.tool_calls))for(let c of t.tool_calls)!c||typeof c!="object"||r(c.arguments,u=>{c.arguments=u});if(!n)return!1;let s=n,o=s.value,i=Math.max(e,Math.floor(o.length/2));return i>=o.length?!1:(s.set(o.slice(0,i)+`... [truncated, total ${o.length} chars]`),!0)}function tf(t){if(t.length<=2)return t.map(i=>pl(i,2048));let e=t[0],n=Math.min(5,t.length-1),r=null;for(;n>=1;){let i=t.slice(t.length-n),c=t.length-1-n,u=t.slice(1,t.length-n).reduce((T,M)=>T+JSON.stringify(M).length,0),f={role:"system",content:`[...omitted ${c} messages, total ${u} chars]`},h=[e,f,...i];if(JSON.stringify(h).length<=tt)return h;r=h,n--}let s=r??[e,t[t.length-1]],o=Math.max(1024,Math.floor((tt-256)/Math.max(1,s.length)));return s.map(i=>pl(i,o))}function pl(t,e){let n={...t};return typeof n.content=="string"&&n.content.length>e&&(n.content=n.content.slice(0,e)+`... [truncated, total ${n.content.length} chars]`),Array.isArray(n.tool_calls)&&(n.tool_calls=n.tool_calls.map(r=>{if(!r||typeof r!="object")return r;let s={...r};return typeof s.arguments=="string"&&s.arguments.length>e&&(s.arguments=s.arguments.slice(0,e)+`... [truncated, total ${s.arguments.length} chars]`),s})),n}function Io(t,e=rn){return t?t.length<=e?t:t.slice(0,e)+`... [truncated, total ${t.length} chars]`:""}function To(t){return typeof globalThis.structuredClone=="function"?globalThis.structuredClone(t):Tt(t)}function Tt(t,e=new WeakMap){if(t===null||typeof t!="object")return t;let n=t;if(e.has(n))return e.get(n);if(n instanceof Date)return new Date(n.getTime());if(n instanceof RegExp)return new RegExp(n.source,n.flags);if(n instanceof Map){let s=new Map;e.set(n,s);for(let[o,i]of n)s.set(Tt(o,e),Tt(i,e));return s}if(n instanceof Set){let s=new Set;e.set(n,s);for(let o of n)s.add(Tt(o,e));return s}if(Array.isArray(n)){let s=[];e.set(n,s);for(let o=0;o<n.length;o++)s[o]=Tt(n[o],e);return s}let r={};e.set(n,r);for(let s of Object.keys(n))r[s]=Tt(n[s],e);return r}function ml(t){return t==null?[]:typeof t=="string"?[{type:"text",content:t}]:Array.isArray(t)?t.map(e=>{if(typeof e=="string")return{type:"text",content:e};if(typeof e=="object"&&e!==null){let n=e;if(n.type==="toolCall"||n.type==="tool_call"||n.type==="function_call")return{type:"tool_call",id:n.id||n.toolCallId||null,name:n.name||n.toolName||"",arguments:n.arguments||n.input||n.params||null};if(n.type==="toolResult"||n.type==="tool_result"||n.type==="tool_call_response"){let r=n.response??n.result??n.content??"";return{type:"tool_call_response",id:n.id||n.toolCallId||null,response:typeof r=="string"?r:JSON.stringify(r)}}return n.type==="text"?{type:"text",content:String(n.content??n.text??"")}:n.type==="thinking"||n.type==="reasoning"?{type:"reasoning",content:String(n.content??n.thinking??"")}:n.type?n:{type:"text",content:JSON.stringify(e)}}return{type:"text",content:String(e)}}):[{type:"text",content:JSON.stringify(t)}]}function gl(t){return Ie(JSON.stringify([{type:"text",content:t}]))}var nf={toolResult:"tool",tool_result:"tool",function:"tool"};function So(t,e){let n=[];for(let r of t){let s=nf[r.role]||r.role;n.push({role:s,parts:ml(r.content)})}return e&&n.push({role:"user",parts:[{type:"text",content:e}]}),Ie(JSON.stringify(n))}function St(t,e="stop"){return Ie(JSON.stringify(t.map(n=>({role:"assistant",parts:[{type:"text",content:n}],finish_reason:e}))))}function hl(t,e=[],n="stop"){let r=ml(t);return r.length>0?Ie(JSON.stringify([{role:"assistant",parts:r,finish_reason:n}])):St(e,n)}function rf(t){return!t||t==="unknown"?"system/unknown":t.includes("/")?t:/^agent[_:]/.test(t)?`agent/${t.slice(6)||"unknown"}`:`system/${t}`}function se(t,e){let n=t.sessionKey||t.channelId||t.conversationId||e||"unknown";return rf(n)}function vt(t){return typeof t=="string"&&t.trim()?t:void 0}function or(t){return typeof t=="string"&&t.trim()?t:void 0}function sn(t,e){return e?`${e}:${t}`:t}function yl(t){return t?typeof t=="string"?t:Array.isArray(t)?t.filter(e=>e?.type==="text"&&typeof e.text=="string").map(e=>e.text).join(""):"":""}function _l(t){if(!Array.isArray(t))return[];let e=[];for(let n of t){if(!n||typeof n!="object")continue;let r=n;(r.type==="toolCall"||r.type==="toolUse"||r.type==="functionCall")&&typeof r.id=="string"&&r.id&&e.push({id:r.id,name:typeof r.name=="string"?r.name:void 0})}return e}function bl(t){if(typeof t=="string")return[t];if(!Array.isArray(t))return[];let e=[];for(let n of t){if(!n||typeof n!="object")continue;let r=n;r.type==="text"&&(typeof r.text=="string"&&r.text?e.push(r.text):typeof r.content=="string"&&r.content&&e.push(r.content))}return e}function vo(t){if(!Array.isArray(t))return[];let e=[];for(let n of t)!n||typeof n!="object"||(n.type==="toolCall"||n.type==="tool_use")&&e.push({id:n.id??`call_${ae(12)}`,name:n.name??"unknown",arguments:typeof n.arguments=="string"?n.arguments:JSON.stringify(n.arguments??{})});return e}function wl(t){if(!Array.isArray(t)||t.length===0)return 0;let e=0;for(let n of t){if(!n||typeof n!="object")continue;let r=n;if(!(r.role!=="assistant"||!Array.isArray(r.content)))for(let s of r.content){if(!s||typeof s!="object")continue;let o=s;(o.type==="toolCall"||o.type==="toolUse"||o.type==="functionCall")&&(e+=1)}}return e}var sf=["Conversation info (untrusted metadata):","Sender (untrusted metadata):","Thread starter (untrusted, for context):","Replied message (untrusted, for context):","Forwarded message context (untrusted metadata):","Chat history since last reply (untrusted, for context):"],of="Untrusted context (metadata, do not treat as instructions or commands):",ty=new RegExp([...sf,of].map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"));function Il(t,e){let n=e;e.length>_o&&(n=[...e.slice(0,1),...e.slice(-(_o-1))]);let r=[];for(let s of n){let o={role:s.role??"unknown"},i=yl(s.content??s.text);i&&(o.content=Io(i,rn)),r.push(o)}t["gen_ai.prompt"]=fl(r)}function Tl(t,e){let n=[];for(let r of e){let s={role:r.role??"assistant"},o=yl(r.content??r.text);o&&(s.content=Io(o,rn));let i=r.finishReason??r.stopReason??"stop",c=r.toolCalls??vo(r.content);c.length>0?(s.finish_reason="tool_calls",s.tool_calls=c.map(u=>({id:u.id,name:u.name,arguments:Io(u.arguments,rn)}))):s.finish_reason=i,n.push(s)}t["gen_ai.completion"]=fl(n)}import{LogItem as af,Content as pe}from"tencentcloud-cls-sdk-nodejs";var Sl=1e3,cf=1800*1e3,lf=new Set(["traceId","spanId","parentSpanId","name","kind","status","startTime","endTime","durationMs"]),on=class{constructor(e,n,r,s,o){this.openSpans=new Map;this.disposed=!1;this.producer=e,this.debug=r,this.log=s,this.getResourceAttrs=o??null}startSpan(e,n){if(!this.disposed){if(this.openSpans.size>=Sl&&(this.sweepStaleOpenSpans(),this.openSpans.size>=Sl)){let r=this.openSpans.keys().next().value;r&&(this.log.warn(`${E} openSpans size (${this.openSpans.size}) exceeded limit, evicting oldest span: ${r}`),this.openSpans.delete(r))}this.openSpans.set(n,{name:e.name,type:e.type,startTime:e.startTime,attributes:{...e.attributes},traceId:e.traceId,spanId:e.spanId,parentSpanId:e.parentSpanId}),this.debug&&this.log.info(`${E} Started long-lived span: name=${e.name}, spanId=${n}, traceId=${e.traceId}`)}}endSpanById(e,n,r){if(this.disposed)return;let s=this.openSpans.get(e);if(!s)return;if(r)for(let[i,c]of Object.entries(r))c!=null&&(s.attributes[i]=c);let o=n??Date.now();this.sendRecord({...s.attributes,traceId:s.traceId,spanId:s.spanId,parentSpanId:s.parentSpanId||"",name:s.name,kind:s.attributes["gen_ai.span.kind"]??this.mapSpanKind(s.type),status:"OK",startTime:new Date(s.startTime).toISOString(),endTime:new Date(o).toISOString(),durationMs:String(o-s.startTime)}),this.openSpans.delete(e),this.debug&&this.log.info(`${E} Ended long-lived span: spanId=${e}, duration=${o-s.startTime}ms`)}patchOpenSpanAttributes(e,n){if(this.disposed)return;let r=this.openSpans.get(e);if(r)for(let[s,o]of Object.entries(n))o!=null&&(r.attributes[s]=o)}export(e){if(this.disposed)return;let n=e.startTime||Date.now(),r=e.endTime||Date.now(),s=e.attributes.error===!0||!!e.attributes["error.type"];this.sendRecord({...e.attributes,traceId:e.traceId,spanId:e.spanId,parentSpanId:e.parentSpanId||"",name:e.name,kind:e.attributes["gen_ai.span.kind"]??this.mapSpanKind(e.type),status:s?"ERROR":"OK",startTime:new Date(n).toISOString(),endTime:new Date(r).toISOString(),durationMs:String(r-n)})}async flush(){if(!this.disposed)try{typeof this.producer.flush=="function"?await this.producer.flush():typeof this.producer.batchSend=="function"&&await this.producer.batchSend()}catch{}}get isDisposed(){return this.disposed}async dispose(){this.disposed=!0;let e=Date.now();for(let[,n]of this.openSpans)try{let r=e;this.sendRecordCore({...n.attributes,"openclaw.force_closed":!0,"openclaw.force_closed.reason":"dispose",traceId:n.traceId,spanId:n.spanId,parentSpanId:n.parentSpanId||"",name:n.name,kind:n.attributes["gen_ai.span.kind"]??this.mapSpanKind(n.type),status:"UNSET",startTime:new Date(n.startTime).toISOString(),endTime:new Date(r).toISOString(),durationMs:String(r-n.startTime)})}catch{}try{typeof this.producer.flush=="function"?await this.producer.flush():typeof this.producer.batchSend=="function"&&await this.producer.batchSend()}catch{}this.openSpans.clear()}sweepStaleOpenSpans(){let e=Date.now(),n=[];for(let[r,s]of this.openSpans)e-s.startTime>cf&&n.push(r);for(let r of n){let s=this.openSpans.get(r);if(s){try{this.sendRecord({...s.attributes,"openclaw.force_closed":!0,"openclaw.force_closed.reason":"stale_sweep",traceId:s.traceId,spanId:s.spanId,parentSpanId:s.parentSpanId||"",name:s.name,kind:s.attributes["gen_ai.span.kind"]??this.mapSpanKind(s.type),status:"UNSET",startTime:new Date(s.startTime).toISOString(),endTime:new Date(e).toISOString(),durationMs:String(e-s.startTime)})}catch{}this.debug&&this.log.info(`${E} Evicted stale open span (force-sent): spanId=${r}, name=${s.name}, age=${e-s.startTime}ms`)}this.openSpans.delete(r)}}updateProducer(e,n){let r=this.producer;this.producer=e;let s=5e3,o=async()=>{try{typeof r.flush=="function"?await r.flush():typeof r.batchSend=="function"&&await r.batchSend(),typeof r.close=="function"?await r.close():typeof r.shutdown=="function"?await r.shutdown():typeof r.destroy=="function"&&await r.destroy()}catch{}},i,c=new Promise(u=>{i=setTimeout(u,s)});Promise.race([o(),c]).finally(()=>{i!==void 0&&clearTimeout(i)}).catch(()=>{})}sendRecord(e){this.disposed||this.sendRecordCore(e)}sendRecordCore(e){try{let n=this.getResourceAttrs?.()??{},r=e.traceId||"",s=e.spanId||"",o=e.parentSpanId||"",i=e.name||"",c=e.kind||"INTERNAL",u=e.status||"OK",f=e.startTime,h=e.endTime,_=e.durationMs,T=f?new Date(f).getTime():Date.now(),M=h?new Date(h).getTime():Date.now(),R=M-T,k=R<0?0:R;R<0&&this.log?.warn(`${E} [sendRecord] negative duration detected, clamped to 0. spanId=${s}, name=${i}, startMs=${T}, endMs=${M}`);let y=1000000n,$=(BigInt(T)*y).toString(),P=(BigInt(M)*y).toString(),L=(BigInt(k)*y).toString(),x={};for(let[V,Y]of Object.entries(e))lf.has(V)||Y!=null&&(x[V]=Y);_!=null&&(x.durationMs=String(_));for(let[V,Y]of Object.entries(n))Y!=null&&(x[V]=String(Y));let I=this.mapSpanKindToString(c),O=u==="OK"?"OK":u==="ERROR"?"ERROR":"UNSET",j=JSON.stringify(x),S=new af;S.setTime(Math.floor(T/1e3)),S.pushBack(new pe("traceID",r)),S.pushBack(new pe("spanID",s)),S.pushBack(new pe("parentSpanID",o)),S.pushBack(new pe("kind",I)),S.pushBack(new pe("name",i)),S.pushBack(new pe("links","[]")),S.pushBack(new pe("logs","[]")),S.pushBack(new pe("traceState","")),S.pushBack(new pe("start",$)),S.pushBack(new pe("end",P)),S.pushBack(new pe("duration",L)),S.pushBack(new pe("attribute",j)),S.pushBack(new pe("statusCode",O)),S.pushBack(new pe("statusMessage",""));let q=this.producer.send(S);q&&typeof q.catch=="function"&&q.catch(V=>{this.log.warn(`${E} CLS \u5F02\u6B65\u53D1\u9001\u5931\u8D25: ${V}`)})}catch(n){this.log.warn(`${E} CLS \u53D1\u9001\u5931\u8D25: ${n}`)}}mapSpanKind(e){switch(e){case"entry":case"gateway":return"ENTRY";case"agent":return"AGENT";case"step":return"STEP";case"model":return"LLM";case"tool":return"TOOL";case"session":return"SESSION";case"message":return"TASK";default:return"INTERNAL"}}mapSpanKindToString(e){switch(e){case"ENTRY":return"server";case"LLM":return"client";case"TOOL":return"client";default:return"internal"}}};import{readFile as uf}from"node:fs/promises";async function vl(t){try{let e=await uf(t,"utf8"),i=JSON.parse(e).plugins?.entries?.[al]?.config,c=i?.trace,u=c?.enabled!==!1,f=typeof c?.traceTopicId=="string"?c.traceTopicId.trim():"",h=i?.cls,_=typeof h?.endpoint=="string"?h.endpoint.trim():"",T=typeof h?.token=="string"?h.token.trim():"",M=typeof h?.credentialMode=="string"&&h.credentialMode.trim()==="cvmRole"?"cvmRole":"static",R=typeof h?.roleName=="string"?h.roleName.trim():"",k="",y="";try{k=typeof h?.secretId=="string"?ie(h.secretId.trim()):""}catch(L){console.warn(`[diagnostics-metrics-cls/trace] readTraceHotConfigFromDisk: secretId decrypt failed: ${String(L)}`)}try{y=typeof h?.secretKey=="string"?ie(h.secretKey.trim()):""}catch(L){console.warn(`[diagnostics-metrics-cls/trace] readTraceHotConfigFromDisk: secretKey decrypt failed: ${String(L)}`)}let $=c?.debug===!0,P=Array.isArray(c?.enabledHooks)?c.enabledHooks:void 0;return{enabled:u,traceTopicId:f,endpoint:_,secretId:k,secretKey:y,token:T,credentialMode:M,roleName:R,debug:$,enabledHooks:P}}catch(e){return e?.code==="ENOENT"||console.warn(`[diagnostics-metrics-cls/trace] readTraceHotConfigFromDisk failed: ${String(e)}`),null}}function Eo(t,e){if(!t)return{enabled:!1,traceTopicId:"",endpoint:"",secretId:"",secretKey:"",serviceName:"openclaw-agent"};let n=t.enabled!==!1,r=typeof t.traceTopicId=="string"?t.traceTopicId.trim():"",s=typeof e?.endpoint=="string"?e.endpoint.trim():"",o="",i="";try{o=typeof e?.secretId=="string"?ie(e.secretId.trim()):""}catch(_){console.warn(`[diagnostics-metrics-cls/trace] resolveTraceConfig: secretId decrypt failed: ${String(_)}`)}try{i=typeof e?.secretKey=="string"?ie(e.secretKey.trim()):""}catch(_){console.warn(`[diagnostics-metrics-cls/trace] resolveTraceConfig: secretKey decrypt failed: ${String(_)}`)}let c=typeof e?.token=="string"?e.token.trim():void 0,u=typeof e?.credentialMode=="string"&&e.credentialMode.trim()==="cvmRole"?"cvmRole":"static",f=typeof e?.roleName=="string"?e.roleName.trim():void 0;return{enabled:n&&(u==="cvmRole"?!!(r&&s&&f):!!(r&&s&&o&&i)),traceTopicId:r,endpoint:s,secretId:o,secretKey:i,token:c,credentialMode:u,roleName:f,serviceName:typeof t.serviceName=="string"?t.serviceName:"openclaw-agent",debug:t.debug===!0,enabledHooks:Array.isArray(t.enabledHooks)?t.enabledHooks:void 0}}function Rl(t){let e=t.traceTopicId??"",n=t.endpoint??"",r=t.secretId??"",s=t.secretKey??"",o=t.token,i=t.credentialMode??"static",c=t.roleName??"",u=t.sharedCredentialManager??null,f=t.debug??!1,h=t.enabled===!0,_=t.enabledHooks,T=t.serviceName||df(process.cwd())||"openclaw-agent",M=`${T}@${El()}:${process.pid}`,R={"service.name":T,"service.instance.id":M,"host.name":El(),"telemetry.sdk.language":"nodejs"};function k(){let a=Oe(),d={...R};return a.cvmInstanceId&&(d.cvm_instance_id=a.cvmInstanceId),a.cvmInstanceName&&(d.cvm_instance_name=a.cvmInstanceName),a.cvmInstanceIntraIp&&(d.cvm_instance_intra_ip=a.cvmInstanceIntraIp),d}let y=null,$=null,P=null;function L(a){return{topic_id:e,endpoint:n,credential:{secretId:a.secretId,secretKey:a.secretKey,token:a.token},onSendLogsError:d=>{d?.status!==200?C?.warn(`${E} CLS \u53D1\u9001\u5931\u8D25: ${JSON.stringify(d)}`):f&&C?.debug(`${E} CLS \u53D1\u9001\u6210\u529F: requestId=${d?.requestId}`)}}}let x=new Map,I=new Map,O=new Map,j=new Map,S=new Map,q=new Map,V=new Map,Y,ce,Se,ve="unknown",nt=null,C=null,rt=!1,Ee=new Set,ye=new Map,ln=2e3;function lr(){let a=Date.now(),d=new Set,g=[];for(let[m,b]of x)a-b.createdAt>bo&&(g.push(m),d.add(b));for(let m of g)x.delete(m);for(let m of d)I.delete(m.runId);if(d.size>0){let m=[];for(let[N,v]of O){for(let U of d)v.delete(U);v.size===0&&m.push(N)}for(let N of m)O.delete(N);let b=[];for(let[N,v]of j)d.has(v)&&b.push(N);for(let N of b)j.delete(N);ce&&d.has(ce)&&(ce=void 0,Y=void 0,Se=void 0)}let p=[];for(let[m,b]of S)(a-b.createdAt>bo||d.has(b.traceContext))&&p.push(m);for(let m of p)S.delete(m);let l=[];for(let[m,b]of V)a-b.createdAt>ll&&l.push(m);for(let m of l)V.delete(m);y&&y.sweepStaleOpenSpans()}function z(a){return _?_.includes(a):!0}function st(a){return a.startsWith(cl)}function ur(a,d){let g=[];for(let[p,l]of S)l.runId===a&&g.push({oldKey:p,pending:l});for(let{oldKey:p,pending:l}of g){S.delete(p),l.runId=d;let m=sn(l.toolCallId,d);S.has(m)&&f&&C?.warn(`${E} movePendingToolCallsRunBinding: key collision detected, overwriting existing entry: ${m}`),S.set(m,l)}}function un(a,d,g){let p=vt(d);if(!p||a.runId===p)return;let l=I.get(p);if(l&&l!==a)return;let m=a.runId;if(!st(m))return;I.get(m)===a&&I.delete(m),a.runId=p,a.turnId=p,I.set(p,a),ur(m,p);let b={"openclaw.run.id":p,"openclaw.turn.id":p};y?.patchOpenSpanAttributes(a.rootSpanId,b),a.agentSpanId&&y?.patchOpenSpanAttributes(a.agentSpanId,b),a.stepSpanId&&y?.patchOpenSpanAttributes(a.stepSpanId,b),f&&C?.info(`${E} Rebound temporary runId: hook=${g}, oldRunId=${m}, realRunId=${p}`)}function dn(a,d){if(rt)return Promise.resolve();if(q.size>=ul)return C?.warn(`${E} trace task queue size (${q.size}) exceeded limit, dropping task for trace ${a}`),Promise.resolve();let g=q.get(a)||Promise.resolve(),p=()=>{let b,N=new Promise((v,U)=>{b=setTimeout(()=>U(new Error(`trace task timeout after ${wo}ms`)),wo)});return Promise.race([d(),N]).finally(()=>{b!==void 0&&clearTimeout(b)})},l=g.catch(()=>{}).then(p),m;return m=l.finally(()=>{q.get(a)===m&&q.delete(a)}),q.set(a,m),m}async function pn(a){if(!a)return;let d=q.get(a);if(d)try{await d}catch(g){C?.warn(`${E} drainTraceTasks failed for traceId=${a}: ${String(g)}`)}}function fn(a){if(!a)return;let d=`${a}:`,g=[];for(let[p,l]of S)(p.startsWith(d)||l.runId===a)&&g.push(p);for(let p of g)S.delete(p)}function dr(a){let d=vt(a.runId),g=or(a.toolCallId);if(g){let m=[sn(g,d),sn(g,void 0)];for(let b of m){let N=S.get(b);if(N)return S.delete(b),N}}let p,l;for(let[m,b]of S)b.toolName===a.toolName&&(d&&b.runId!==d||!d&&b.runId||(!l||b.toolStartTime>l.toolStartTime)&&(l=b,p=m));return l&&p&&S.delete(p),l}function pr(a,d){let g=O.get(a);g||(g=new Set,O.set(a,g)),g.add(d)}function fr(a,d){let g=O.get(a);g&&(g.delete(d),g.size===0&&O.delete(a))}function Ct(a,d){x.set(a,d),pr(a,d)}function mn(a,d){x.get(a)===d&&x.delete(a),fr(a,d)}async function gn(a=!0){rt=!0,nt&&(clearInterval(nt),nt=null),$&&(clearInterval($),$=null),P&&(P(),P=null);for(let g of Ee)clearTimeout(g);Ee.clear();for(let g of ye.values())clearTimeout(g);ye.clear();let d=Array.from(q.values());d.length>0&&await Promise.allSettled(d),q.clear(),S.clear(),V.clear(),x.clear(),I.clear(),O.clear(),j.clear(),ce=void 0,Y=void 0,Se=void 0,a&&y&&(await y.dispose(),y=null)}function Ke(){S.clear(),V.clear(),x.clear(),I.clear(),O.clear(),j.clear(),ce=void 0,Y=void 0,Se=void 0;for(let a of Ee)clearTimeout(a);Ee.clear();for(let a of ye.values())clearTimeout(a);ye.clear()}function hn(a){let d=x.get(a);d&&Ge(d)}function Ge(a){I.get(a.runId)===a&&I.delete(a.runId);let d=[];for(let[l,m]of x)m===a&&d.push(l);for(let l of d)x.delete(l);let g=[];for(let[l,m]of O)m.has(a)&&(m.delete(a),m.size===0&&g.push(l));for(let l of g)O.delete(l);let p=[];for(let[l,m]of j)m===a&&p.push(l);for(let l of p)j.delete(l);V.delete(a.traceId),ce===a&&(ce=void 0,Y=void 0,Se=void 0)}function Ve(a,d,g){let l={traceId:ae(32),rootSpanId:ae(16),runId:a,turnId:a,channelId:d,originalChannelId:g||d,createdAt:Date.now(),llmPendingToolCallIds:new Set,llmPendingToolResultsForNextInput:[],llmPendingToolCallCountFallback:0,llmSegmentCount:0,stepRoundCounter:0,stepAwaitingToolResults:!1};return Ct(d,l),I.set(a,l),l}function ze(a,d){let g=O.get(a);if(!g||g.size===0)return d;let p=Array.from(g).filter(l=>l.agentSpanId&&!l.isClosing);return p.length===0?d||Array.from(g)[0]:(p.sort((l,m)=>(m.agentStartTime||m.createdAt)-(l.agentStartTime||l.createdAt)),p[0])}function ko(a){let d=I.get(a);return d?.originalChannelId||d?.channelId}function Q(a,d,g){let p=a,l=a.startsWith("agent/")?a:void 0,m=l&&j.get(l)||x.get(a),b=vt(d),N=b||m?.runId||`__temp_run_${ae(12)}`,v=()=>a.startsWith("agent/")&&!!ce&&!!Se&&Date.now()-(Se||0)<sl,U=()=>{if(!ce)return;let K=ce;if(!(b&&K.runId!==b&&!st(K.runId)))return p=Y||p,Ct(a,K),I.set(N,K),f&&C?.info(`${E} LINKING agent to user context: hook=${g}, agentChannel=${a}, userChannel=${p}, traceId=${K.traceId}`),K};if(a.startsWith("agent/")&&N){let K=ko(N);K&&(p=K,m=x.get(K)||m)}if(m||(m=I.get(N)),g==="agent_end"&&!b&&(m=ze(p,m)),!m&&v()&&(m=U()),g==="message_received"&&!a.startsWith("agent/")&&m&&(m.agentSpanId||m.hasSeenLlmInput||m.isClosing)&&(m=void 0,b||(N=`__temp_run_${ae(12)}`)),m&&b&&m.runId!==b&&!st(m.runId)&&(m=void 0,N=b),m&&b&&st(m.runId)){let K=I.get(b);K&&K!==m&&(m=K,Ct(p,m))}!m&&v()&&(m=U());let F=!1;return m||(m=Ve(N,p,a!==p?a:void 0),F=!0,f&&C?.info(`${E} NEW TraceContext: hook=${g}, channelId=${p}, runId=${N}, traceId=${m.traceId}`)),l&&m&&!m.isClosing&&j.set(l,m),m&&d&&un(m,d,g),{ctx:m,channelId:p,isNew:F}}function _e(a,d,g,p,l,m,b={},N){return{name:g,type:p,startTime:l,endTime:m,attributes:{...b,"openclaw.version":ve,"openclaw.session.id":a.sessionId||d,"gen_ai.session.id":a.sessionId||d,"openclaw.run.id":a.runId,"openclaw.turn.id":a.turnId},traceId:a.traceId,spanId:ae(16),parentSpanId:N||a.rootSpanId}}function De(a){return a.agentSpanId||a.rootSpanId}function yn(a){return a.stepSpanId||a.agentSpanId||a.rootSpanId}async function _n(a,d,g){if(!y)return;let p=g.endTime||Date.now(),l=a.llmPendingStartTime||p,m=p<l?l:p,b=a.llmProvider||"unknown",N=a.llmModel||"unknown",v=g.stopReason||"stop",U=g.usage?.input??0,F=g.usage?.output??0,K=g.usage?.cacheRead??0,ue=g.usage?.cacheWrite??0,Je=g.usage?.total??U+F+K+ue,oe={"gen_ai.span.kind":"LLM","gen_ai.operation.name":"chat","gen_ai.provider.name":b,"gen_ai.system":b,"gen_ai.request.model":N,"gen_ai.response.model":N,"gen_ai.usage.input_tokens":U,"gen_ai.usage.output_tokens":F,"gen_ai.usage.total_tokens":Je,"gen_ai.usage.cache_read.input_tokens":K,"gen_ai.usage.cache_creation.input_tokens":ue,"llm.request.type":"chat"};a.llmPendingSystemInstructions&&(oe["gen_ai.system_instructions"]=a.llmPendingSystemInstructions);let Z=a.llmPendingInputMessages||a.llmLastInputMessages;Z&&(oe["gen_ai.input.messages"]=Z),(g.outputContent!==void 0||g.outputTexts.length>0)&&(oe["gen_ai.output.messages"]=hl(g.outputContent,g.outputTexts,v)),oe["gen_ai.response.finish_reasons"]=JSON.stringify([v]);try{if(Z){let H=JSON.parse(Z);if(Array.isArray(H)){let Pe=H.map(me=>({role:me.role,content:Array.isArray(me.parts)?me.parts.filter(We=>We.type==="text").map(We=>We.content).join(""):""}));Il(oe,Pe)}}if(g.outputTexts.length>0){let H=[{role:"assistant",content:g.outputTexts.join(""),stopReason:v,toolCalls:g.outputContent?vo(Array.isArray(g.outputContent)?g.outputContent:void 0):void 0}];H[0].toolCalls?.length===0&&delete H[0].toolCalls,Tl(oe,H)}}catch(H){f&&C?.warn(`${E} Failed to set indexed prompt/completion attrs: ${String(H)}`)}let te=_e(a,d,`chat ${N}`,"model",l,m,oe,yn(a));a.llmPendingSpanId&&(te.spanId=a.llmPendingSpanId);try{y.export(te),C?.debug(`${E} [span] Exported LLM span: ${b}/${N}, traceId=${a.traceId}, spanId=${te.spanId}, duration=${m-l}ms`),f&&C?.info(`${E} Exported segmented LLM span: ${b}/${N}, duration=${m-l}ms, reason=${v}`)}finally{a.llmPendingStartTime=void 0,a.llmPendingSpanId=void 0,a.llmPendingSystemInstructions=void 0,a.llmPendingInputMessages=void 0,a.llmSegmentCount+=1}}async function Be(a,d,g){let p=typeof g.timestamp=="number"&&Number.isFinite(g.timestamp)?g.timestamp:Date.now(),l=_l(g.content),m=bl(g.content),b=typeof g.stopReason=="string"?g.stopReason:l.length>0?"toolUse":"stop";a.llmPendingStartTime||(a.llmPendingStartTime=p),a.llmPendingSpanId||(a.llmPendingSpanId=ae(16)),await _n(a,d,{endTime:p,outputTexts:m,outputContent:g.content,stopReason:b,usage:g.usage}),m.length>0&&(a.lastOutput=m.join(`
14
+ `)),a.llmPendingToolCallIds.clear(),a.llmPendingToolResultsForNextInput=[],a.llmLastAssistantContent=g.content;for(let N of l)a.llmPendingToolCallIds.add(N.id);a.llmPendingToolCallCountFallback=a.llmPendingToolCallIds.size>0?0:l.length,a.stepAwaitingToolResults=l.length>0,l.length===0&&D(a,p,b,d),f&&C?.info(`${E} Processed assistant message: runId=${a.runId}, toolCalls=${l.length}, stopReason=${b}`)}function je(a,d,g={}){if(a.rootSpanStartTime||!y)return;let p=Date.now();a.rootSpanStartTime=p;let l={"gen_ai.span.kind":"ENTRY","gen_ai.operation.name":"enter","gen_ai.user.id":g.userId||"unknown","openclaw.session.id":a.sessionId||d,"gen_ai.session.id":a.sessionId||d,"openclaw.run.id":a.runId,"openclaw.turn.id":a.turnId,"openclaw.message.role":g.role||"unknown","openclaw.message.from":g.from||"unknown","openclaw.version":ve};a.userInput&&(l["gen_ai.input.messages"]=Ie(JSON.stringify([{role:"user",parts:[{type:"text",content:String(a.userInput)}]}]))),y.startSpan({name:"enter_openclaw_system",type:"entry",startTime:p,attributes:l,traceId:a.traceId,spanId:a.rootSpanId},a.rootSpanId),C?.debug(`${E} [span] Started entry span: traceId=${a.traceId}, spanId=${a.rootSpanId}`)}function ot(a,d,g){if(a.agentSpanId||!y)return;let p=Date.now();a.agentStartTime=p,a.agentSpanId=ae(16),y.startSpan({name:`invoke_agent ${g}`,type:"agent",startTime:p,attributes:{"gen_ai.span.kind":"AGENT","gen_ai.operation.name":"invoke_agent","gen_ai.provider.name":"openclaw","gen_ai.agent.id":g,"gen_ai.agent.name":g,"openclaw.session.id":a.sessionId||d,"gen_ai.session.id":a.sessionId||d,"openclaw.run.id":a.runId,"openclaw.turn.id":a.turnId,"openclaw.version":ve},traceId:a.traceId,spanId:a.agentSpanId,parentSpanId:a.rootSpanId},a.agentSpanId),C?.debug(`${E} [span] Started agent span: ${g}, spanId=${a.agentSpanId}, traceId=${a.traceId}`)}function w(a,d,g){if(a.stepSpanId||!y)return;let p=a.stepRoundCounter+1,l=ae(16);y.startSpan({name:"react step",type:"step",startTime:g,attributes:{"gen_ai.span.kind":"STEP","gen_ai.operation.name":"react","gen_ai.react.round":p,"openclaw.session.id":a.sessionId||d,"gen_ai.session.id":a.sessionId||d,"openclaw.run.id":a.runId,"openclaw.turn.id":a.turnId,"openclaw.version":ve},traceId:a.traceId,spanId:l,parentSpanId:De(a)},l),a.stepSpanId=l,a.stepStartTime=g,a.stepRoundCounter=p,a.stepCurrentRound=p,a.stepAwaitingToolResults=!1,f&&C?.info(`${E} Started step span: round=${p}, spanId=${l}`)}function D(a,d,g,p){if(!a.stepSpanId||!y)return;let l=a.stepSpanId,m=a.stepCurrentRound||a.stepRoundCounter||1;y.endSpanById(l,d,{"gen_ai.react.round":m,"gen_ai.react.finish_reason":g||"stop","openclaw.session.id":a.sessionId||p,"gen_ai.session.id":a.sessionId||p,"openclaw.run.id":a.runId,"openclaw.turn.id":a.turnId}),a.stepSpanId=void 0,a.stepStartTime=void 0,a.stepCurrentRound=void 0,a.stepAwaitingToolResults=!1,f&&C?.info(`${E} Ended step span: round=${m}, reason=${g}, spanId=${l}`)}function J(a){a.acpFallbackPending=!1;let d=ye.get(a.traceId);d&&(clearTimeout(d),ye.delete(a.traceId))}function it(a,d){if(!a.acpFallbackPending||!y)return;let g=ye.get(a.traceId);g&&clearTimeout(g);let p=y,l=setTimeout(async()=>{if(ye.delete(a.traceId),Ee.delete(l),!!a.acpFallbackPending){a.acpFallbackPending=!1;try{if(C?.debug(`${E} [acp-fallback] Closing Entry Span for ACP mode: traceId=${a.traceId}`),a.rootSpanStartTime&&p&&!p.isDisposed){let m=Date.now(),b={"request.duration_ms":m-a.rootSpanStartTime,"openclaw.acp_mode":!0};a.sessionId&&(b["openclaw.session.id"]=a.sessionId,b["gen_ai.session.id"]=a.sessionId),a.userInput&&(b["gen_ai.input.messages"]=Ie(JSON.stringify([{role:"user",parts:[{type:"text",content:String(a.userInput)}]}]))),a.lastOutput&&(b["gen_ai.output.messages"]=St([typeof a.lastOutput=="string"?a.lastOutput:JSON.stringify(a.lastOutput)])),p.endSpanById(a.rootSpanId,m,b),C?.debug(`${E} [acp-fallback] Ended entry span: spanId=${a.rootSpanId}, traceId=${a.traceId}, duration=${m-a.rootSpanStartTime}ms`)}mn(d,a),Ge(a),p&&!p.isDisposed&&(await p.flush(),C?.debug(`${E} [acp-fallback] Flushed after ACP fallback close, traceId=${a.traceId}`))}catch(m){C?.warn(`${E} [acp-fallback] Error closing Entry Span: ${String(m)}`)}}},ln);ye.set(a.traceId,l),Ee.add(l)}let Nt={id:"diagnostics-metrics-cls-trace",async start(a){if(C=a.logger,ve=a.runtime?.version||"unknown",rt=!1,h&&e&&n&&(i==="cvmRole"?!!c:!!(r&&s))){let l;if(u){let m=u.getCredentialSnapshot();l={secretId:m.secretId,secretKey:m.secretKey,token:m.token},r=m.secretId,s=m.secretKey,o=m.token}else i==="static"?l={secretId:r,secretKey:s,token:o}:(C.warn(`${E} cvmRole \u6A21\u5F0F\u4F46\u5171\u4EAB\u51ED\u8BC1\u7BA1\u7406\u5668\u4E0D\u53EF\u7528\uFF0Ctrace \u6570\u636E\u6682\u4E0D\u53D1\u9001`),l={secretId:"",secretKey:""});if(l.secretId&&l.secretKey){let m=new ir(L(l));y=new on(m,e,f,C,k),C.debug(`${E} CLS Producer \u5DF2\u521D\u59CB\u5316\uFF0Cendpoint=${n} traceTopicId=${e} credentialMode=${i}`),u&&!P&&(P=u.subscribe(b=>{if(!y||y.isDisposed||!(b.secretId!==r||b.secretKey!==s||(b.token||"")!==(o||"")))return;r=b.secretId,s=b.secretKey,o=b.token;let v=new ir(L(b));y.updateProducer(v,e),f&&C?.info(`${E} \u5171\u4EAB\u51ED\u8BC1\u5DF2\u66F4\u65B0\uFF0CProducer \u5DF2\u91CD\u5EFA`)}))}else C.warn(`${E} \u51ED\u8BC1\u83B7\u53D6\u5931\u8D25\uFF08credentialMode=${i}\uFF09\uFF0Ctrace \u6570\u636E\u6682\u4E0D\u53D1\u9001\uFF0C\u7B49\u5F85\u70ED\u66F4\u65B0\u6062\u590D`)}else C.warn(`${E} CLS \u914D\u7F6E\u4E0D\u5B8C\u6574\u6216 trace \u672A\u542F\u7528\uFF08traceEnabled=${h}\uFF0CcredentialMode=${i}\uFF09\uFF0Ctrace \u6570\u636E\u6682\u4E0D\u53D1\u9001\uFF0C\u7B49\u5F85\u70ED\u66F4\u65B0\u6062\u590D`);nt=setInterval(lr,ol);let g=pf(a.stateDir,"openclaw.json"),p=!1;$=setInterval(()=>{(async()=>{if(!p){p=!0;try{let l=await vl(g);if(!l)return;let m=l.enabled,b=l.traceTopicId,N=l.endpoint,v=l.secretId,U=l.secretKey,F=l.token,K=l.debug;K!==f&&(f=K,y&&(y.debug=f),C.debug(`${E} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0Ctrace.debug=${f}`));let ue=l.enabledHooks;JSON.stringify(ue)!==JSON.stringify(_)&&(_=ue,C.debug(`${E} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0CenabledHooks=${_?_.join(","):"\u5168\u90E8\u542F\u7528"}`));let oe=m!==h;if(oe)if(h=m,h)C.debug(`${E} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0Ctrace.enabled=true\uFF0C\u6B63\u5728\u6062\u590D Trace \u94FE\u8DEF\u8FFD\u8E2A`);else{y&&(await y.dispose(),y=null),Ke(),C.debug(`${E} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0Ctrace.enabled=false\uFF0C\u5DF2\u7981\u7528 Trace \u94FE\u8DEF\u8FFD\u8E2A`);return}if(!h)return;let Z=l.credentialMode,te=l.roleName,H=b!==e,Pe=N!==n,me=!u&&(v!==r||U!==s),We=!u&&(F||"")!==(o||""),mr=Z!==i,gr=te!==c;if(!(oe||H||Pe||me||We||mr||gr))return;if(H&&(e=b),Pe&&(n=N),mr&&(i=Z),gr&&(c=te),me&&(r=v,s=U),We&&(o=F||void 0),i==="cvmRole"?!e||!n||!c:!e||!n||!r||!s){y&&(await y.dispose(),y=null),C.warn(`${E} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0CCLS \u914D\u7F6E\u4E0D\u5B8C\u6574\uFF08credentialMode=${i}\uFF09\uFF0Ctrace \u6570\u636E\u5C06\u4E0D\u4F1A\u53D1\u9001`);return}let Ot;if(u){let at=u.getCredentialSnapshot();Ot={secretId:at.secretId,secretKey:at.secretKey,token:at.token},r=at.secretId,s=at.secretKey,o=at.token}else if(i==="static")Ot={secretId:r,secretKey:s,token:o};else{C.warn(`${E} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0CcvmRole \u6A21\u5F0F\u4F46\u5171\u4EAB\u51ED\u8BC1\u7BA1\u7406\u5668\u4E0D\u53EF\u7528`);return}if(!Ot.secretId||!Ot.secretKey){y&&(await y.dispose(),y=null),C.warn(`${E} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0C\u51ED\u8BC1\u83B7\u53D6\u5931\u8D25\uFF0Ctrace \u6570\u636E\u5C06\u4E0D\u4F1A\u53D1\u9001`);return}let Mo=new ir(L(Ot));y?y.updateProducer(Mo,e):y=new on(Mo,e,f,C,k),rt=!1;let Ue=[];oe&&Ue.push("enabled=true"),H&&Ue.push(`traceTopicId=${e}`),Pe&&Ue.push(`endpoint=${n}`),mr&&Ue.push(`credentialMode=${i}`),gr&&Ue.push(`roleName=${c}`),me&&Ue.push("\u51ED\u8BC1\u5DF2\u66F4\u65B0"),We&&Ue.push("token\u5DF2\u66F4\u65B0"),C.debug(`${E} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\uFF0C${Ue.join("\uFF0C")}`)}catch(l){C?.warn(`${E} \u914D\u7F6E\u6587\u4EF6\u70ED\u66F4\u65B0\u8F6E\u8BE2\u5931\u8D25: ${String(l)}`)}finally{p=!1}}})()},il)},async stop(){await gn()}};function kt(a){C=a.logger,ve=a.runtime?.version||ve,a.on("gateway_stop",async()=>{await gn()}),a.on("gateway_start",async d=>{try{if(!z("gateway_start")||!y)return;let g=Date.now(),p=ae(32),l=ae(16),m={name:"gateway_start",type:"gateway",startTime:g,endTime:g,attributes:{"openclaw.version":ve,"gen_ai.span.kind":"ENTRY","gateway.port":d.port},traceId:p,spanId:l,parentSpanId:""};y.export(m)}catch(g){C?.warn(`${E} [hook] gateway_start ERROR: ${String(g)}`)}}),a.on("session_start",async(d,g)=>{try{if(!z("session_start")||!y)return;let p=se(g,d.sessionId),{ctx:l,channelId:m}=Q(p,d?.runId,"session_start");d.sessionId&&(l.sessionId=d.sessionId);let b=Date.now(),N=_e(l,m,"session_start","session",b,b,{"gen_ai.span.kind":"SESSION","event.type":"session_start"});d.sessionId&&(N.attributes["openclaw.session.id"]=d.sessionId,N.attributes["gen_ai.session.id"]=d.sessionId),y.export(N)}catch(p){C?.warn(`${E} [hook] session_start ERROR: ${String(p)}`)}}),a.on("session_end",async(d,g)=>{try{if(!z("session_end")||!y)return;let p=se(g,d.sessionId),{ctx:l,channelId:m}=Q(p,d?.runId,"session_end"),b=Date.now(),N=_e(l,m,"session_end","session",b,b,{"gen_ai.span.kind":"SESSION","session.duration_ms":d.durationMs||0,"session.message_count":d.messageCount||0,"session.total_tokens":l.lastLlmUsage?.total||0});l.lastOutput&&(N.attributes["gen_ai.output.messages"]=St([typeof l.lastOutput=="string"?l.lastOutput:JSON.stringify(l.lastOutput)])),d.sessionId&&(N.attributes["openclaw.session.id"]=d.sessionId,N.attributes["gen_ai.session.id"]=d.sessionId),y.export(N),await pn(l.traceId),hn(m)}catch(p){C?.warn(`${E} [hook] session_end ERROR: ${String(p)}`)}}),a.on("message_received",async(d,g)=>{try{if(C?.debug(`${E} [hook] message_received fired, sender=${y?"OK":"null"}, enabled=${z("message_received")}`),!z("message_received")||!y)return;let p=se(g,d.from||d.metadata?.senderId),{ctx:l,channelId:m}=Q(p,d?.runId,"message_received");!p.startsWith("agent/")&&(Y=m,ce=l,Se=Date.now(),l.userInput=d.content,je(l,m,{userId:d.from||d.metadata?.senderId,role:"user",from:d.from}),l.acpFallbackPending=!0)}catch(p){C?.warn(`${E} [hook] message_received ERROR: ${String(p)}`),console.error(`${E} [hook] message_received ERROR:`,p)}}),a.on("message_sending",async(d,g)=>{try{if(!z("message_sending"))return;let p=se(g,d.to),{ctx:l}=Q(p,d?.runId,"message_sending");l.lastOutput=d.content}catch(p){C?.warn(`${E} [hook] message_sending ERROR: ${String(p)}`)}},{priority:-100}),a.on("message_sent",async(d,g)=>{try{if(!z("message_sent"))return;if(d.content&&d.success){let p=se(g,d.to),{ctx:l,channelId:m}=Q(p,d?.runId,"message_sent");l.lastOutput=d.content,l.acpFallbackPending&&it(l,m)}}catch(p){C?.warn(`${E} [hook] message_sent ERROR: ${String(p)}`)}},{priority:-100}),a.on("llm_input",async(d,g)=>{try{if(C?.debug(`${E} [hook] llm_input fired, sender=${y?"OK":"null"}, enabled=${z("llm_input")}`),!z("llm_input")||!y)return;let p=se(g),{ctx:l,channelId:m}=Q(p,d.runId,"llm_input");J(l),d.sessionId&&(l.sessionId=d.sessionId),!l.userInput&&d.prompt&&(l.userInput=d.prompt),je(l,m,{userId:g.trigger||"system",role:g.trigger||"system",from:g.agentId||"openclaw"}),ot(l,m,g.agentId||"openclaw"),l.llmProvider=d.provider,l.llmModel=d.model,l.hasSeenLlmInput=!0,l.isClosing=!1,p.startsWith("agent/")&&j.set(p,l),l.llmPendingStartTime=Date.now(),l.llmPendingSpanId=ae(16),w(l,m,l.llmPendingStartTime),l.llmPendingToolCallIds.clear(),l.llmPendingToolCallCountFallback=0,d.systemPrompt&&(l.llmPendingSystemInstructions=gl(d.systemPrompt));let b=d.historyMessages?.length?d.historyMessages.map(v=>To(v)):[];l.llmPendingInputMessages=So(b,d.prompt),l.llmLastInputMessages=l.llmPendingInputMessages;let N=V.get(l.traceId);if(N){V.delete(l.traceId);try{dn(l.traceId,async()=>{await Be(l,m,N.message)}).catch(v=>{C?.warn(`${E} replay pending assistant failed: ${String(v)}`)})}catch(v){C?.warn(`${E} replay pending assistant enqueue failed: ${String(v)}`)}}f&&C?.info(`${E} LLM input started: ${d.provider}/${d.model}, runId=${d.runId}`)}catch(p){C?.error(`${E} [hook] llm_input UNCAUGHT ERROR: ${String(p)}, stack=${p?.stack}`)}},{priority:-100}),a.on("llm_output",async(d,g)=>{try{if(!z("llm_output")||!y)return;let p=se(g),{ctx:l,channelId:m}=Q(p,d.runId,"llm_output");if(d.sessionId&&(l.sessionId=d.sessionId),d.assistantTexts?.length&&(l.lastOutput=d.assistantTexts.join(`
15
+ `)),d.usage&&(l.lastLlmUsage={input:d.usage.input,output:d.usage.output,cacheRead:d.usage.cacheRead,cacheWrite:d.usage.cacheWrite,total:d.usage.total}),l.llmSegmentCount===0&&l.llmPendingStartTime){let b=Date.now(),N=d.lastAssistant,v=typeof N?.stopReason=="string"?N.stopReason:void 0;await _n(l,m,{endTime:b,outputTexts:d.assistantTexts||[],stopReason:v,usage:d.usage}),D(l,b,v||"stop",m)}}catch(p){C?.warn(`${E} [hook] llm_output ERROR: ${String(p)}`)}},{priority:-100}),a.on("before_message_write",(d,g)=>{try{if(C?.debug(`${E} [hook] before_message_write fired, sender=${y?"OK":"null"}, enabled=${z("before_message_write")}, role=${d?.message?.role}`),!z("before_message_write")||!y)return;let p=d.message;if(!p||p.role!=="assistant")return;let l=se(g),m=l.startsWith("agent/")?j.get(l):void 0;if(l.startsWith("agent/")&&!m)return;let{ctx:b,channelId:N}=m?{ctx:m,channelId:m.channelId}:Q(l,void 0,"before_message_write");if(!b.hasSeenLlmInput){V.set(b.traceId,{message:p,createdAt:Date.now()});return}try{dn(b.traceId,async()=>{await Be(b,N,p)}).catch(v=>{C?.warn(`${E} before_message_write segmented export failed: ${String(v)}`)})}catch(v){C?.warn(`${E} before_message_write enqueue failed: ${String(v)}`)}}catch(p){C?.warn(`${E} [hook] before_message_write uncaught error: ${String(p)}, stack=${p?.stack}`)}},{priority:-100}),a.on("before_tool_call",async(d,g)=>{try{if(!z("before_tool_call")||!y)return;let p=se(g),l=p.startsWith("agent/")?j.get(p):void 0;if(p.startsWith("agent/")&&!l)return;let{ctx:m,channelId:b}=l?{ctx:l,channelId:l.channelId}:Q(p,vt(d.runId),"before_tool_call");if(l&&d.runId&&un(m,d.runId,"before_tool_call"),!m.hasSeenLlmInput)return;let N=vt(d.runId)||m.runId,v=or(d.toolCallId)||`call_${ae(12)}`;if(S.size>=dl){C?.warn(`${E} pendingToolCalls size (${S.size}) exceeded limit, dropping tool call ${v}`);return}S.set(sn(v,N),{runId:N,toolName:d.toolName,toolCallId:v,toolSpanId:ae(16),toolStartTime:Date.now(),toolInput:d.params,traceContext:m,channelId:b,createdAt:Date.now()}),f&&C?.info(`${E} Tool call started: ${d.toolName}, toolCallId=${v}`)}catch(p){C?.warn(`${E} [hook] before_tool_call ERROR: ${String(p)}`)}},{priority:-100}),a.on("after_tool_call",async d=>{try{if(!z("after_tool_call")||!y)return;let g=dr(d);if(!g)return;let{toolName:p,toolCallId:l,toolSpanId:m,toolStartTime:b,toolInput:N,traceContext:v,channelId:U}=g,F=Date.now(),K={"gen_ai.span.kind":"TOOL","gen_ai.operation.name":"execute_tool","gen_ai.tool.name":p,"gen_ai.tool.call.id":l,"gen_ai.tool.type":"function","tool.duration_ms":d.durationMs||F-b};N!==void 0&&(K["gen_ai.tool.call.arguments"]=Ie(typeof N=="string"?N:JSON.stringify(N))),d.error?K["error.type"]=d.error:d.result!==void 0&&(K["gen_ai.tool.call.result"]=Ie(typeof d.result=="string"?d.result:JSON.stringify(d.result)));let ue=_e(v,U,`execute_tool ${p}`,"tool",b,F,K,yn(v));ue.spanId=m,y.export(ue);let Je=d.error?[{type:"toolResult",toolCallId:l,toolName:p,isError:!0,content:d.error}]:[{type:"toolResult",toolCallId:l,toolName:p,content:d.result}];if(v.llmPendingToolResultsForNextInput.push({role:"toolResult",content:Je}),v.llmPendingToolCallIds.size>0||v.llmPendingToolCallCountFallback>0){if(v.llmPendingToolCallIds.size>0){if(v.llmPendingToolCallIds.has(l))v.llmPendingToolCallIds.delete(l);else if(!or(d.toolCallId)){let te=v.llmPendingToolCallIds.values().next().value;te&&v.llmPendingToolCallIds.delete(te)}}else v.llmPendingToolCallCountFallback>0&&(v.llmPendingToolCallCountFallback-=1);if(v.llmPendingToolCallIds.size===0&&v.llmPendingToolCallCountFallback===0){let te=[];v.llmLastAssistantContent!==void 0&&te.push({role:"assistant",content:v.llmLastAssistantContent}),v.llmPendingToolResultsForNextInput.length>0&&te.push(...v.llmPendingToolResultsForNextInput),D(v,F,"toolUse",U),v.llmPendingStartTime=F,v.llmPendingSpanId=ae(16),w(v,U,F),v.llmPendingSystemInstructions=void 0,v.llmPendingInputMessages=te.length>0?So(te):void 0,v.llmLastInputMessages=v.llmPendingInputMessages,v.llmPendingToolResultsForNextInput=[]}}f&&C?.info(`${E} Exported tool span: ${p}, duration=${F-b}ms`)}catch(g){C?.warn(`${E} [hook] after_tool_call ERROR: ${String(g)}`)}},{priority:-100}),a.on("before_compaction",async(d,g)=>{try{if(!z("before_compaction")||!y)return;let p=se(g),{ctx:l}=Q(p,d?.runId,"before_compaction");l._compactionStartTime=Date.now()}catch(p){C?.warn(`${E} [hook] before_compaction ERROR: ${String(p)}`)}},{priority:-100}),a.on("after_compaction",async(d,g)=>{try{if(!z("after_compaction")||!y)return;let p=se(g),{ctx:l,channelId:m}=Q(p,d?.runId,"after_compaction"),b=l._compactionStartTime||Date.now(),N=Date.now(),v=_e(l,m,"openclaw.compaction","tool",b,N,{"gen_ai.span.kind":"TOOL","gen_ai.operation.name":"compaction","openclaw.compaction.messages.after":d?.messageCount??-1,"openclaw.compaction.tokens.after":d?.tokenCount??-1,"openclaw.compaction.compacted_count":d?.compactedCount??0},De(l));y.export(v),l._compactionStartTime=void 0}catch(p){C?.warn(`${E} [hook] after_compaction ERROR: ${String(p)}`)}},{priority:-100}),a.on("subagent_spawned",async(d,g)=>{try{if(!z("subagent_spawned")||!y)return;let p=se(g),{ctx:l}=Q(p,d?.runId,"subagent_spawned"),m=d?.sessionKey??d?.childSessionKey??"unknown-child";l._subagentStartTimes||(l._subagentStartTimes=new Map),l._subagentStartTimes.set(m,Date.now())}catch(p){C?.warn(`${E} [hook] subagent_spawned ERROR: ${String(p)}`)}},{priority:-100}),a.on("subagent_ended",async(d,g)=>{try{if(!z("subagent_ended")||!y)return;let p=se(g),{ctx:l,channelId:m}=Q(p,d?.runId,"subagent_ended"),b=d?.sessionKey??d?.childSessionKey??"unknown-child",N=l._subagentStartTimes?.get(b)||Date.now(),v=Date.now(),U=_e(l,m,`openclaw.subagent.${b}`,"agent",N,v,{"gen_ai.span.kind":"AGENT","gen_ai.operation.name":"invoke_subagent","openclaw.subagent.session_key":b},De(l));y.export(U),l._subagentStartTimes?.delete(b)}catch(p){C?.warn(`${E} [hook] subagent_ended ERROR: ${String(p)}`)}},{priority:-100}),a.on("before_agent_start",async(d,g)=>{try{if(!z("before_agent_start")||!y)return;let p=se(g),l=g.agentId||"openclaw",{ctx:m,channelId:b}=Q(p,d?.runId,"before_agent_start");J(m),je(m,b,{userId:g.trigger||"system",role:g.trigger||"system",from:l}),ot(m,b,l)}catch(p){C?.warn(`${E} [hook] before_agent_start ERROR: ${String(p)}`)}},{priority:-100}),a.on("agent_end",async(d,g)=>{try{if(C?.debug(`${E} [hook] agent_end fired, sender=${y?"OK":"null"}, enabled=${z("agent_end")}`),!z("agent_end")||!y)return;let p=se(g),{ctx:l,channelId:m}=Q(p,d?.runId,"agent_end");J(l),await pn(l.traceId),l.isClosing=!0;let b=Date.now();l.stepSpanId&&D(l,b,l.stepAwaitingToolResults?"agent_end":"stop",m);let N=l.agentSpanId,v=b,U;if(N){let K=Array.isArray(d.messages)?d.messages.length:0,ue=wl(d.messages);U={"agent.duration_ms":d.durationMs||0,"agent.message_count":K,"agent.tool_call_count":ue,"gen_ai.usage.input_tokens":l.lastLlmUsage?.input||0,"gen_ai.usage.output_tokens":l.lastLlmUsage?.output||0,"gen_ai.usage.total_tokens":l.lastLlmUsage?.total||0},l.sessionId&&(U["openclaw.session.id"]=l.sessionId||m,U["gen_ai.session.id"]=l.sessionId||m),l.userInput&&(U["gen_ai.input.messages"]=Ie(JSON.stringify([{role:"user",parts:[{type:"text",content:String(l.userInput)}]}]))),l.agentSpanId=void 0,l.agentStartTime=void 0}let F=l;if(F.rootSpanStartTime||N){let K=F.rootSpanId,ue=F.rootSpanStartTime,Je=F.userInput,oe=l.sessionId||F.sessionId;mn(m,F);let Z=y,te=setTimeout(async()=>{Ee.delete(te);try{let H=l.lastOutput||F.lastOutput;if(N&&U&&Z&&!Z.isDisposed&&(H&&(U["gen_ai.output.messages"]=St([typeof H=="string"?H:JSON.stringify(H)])),Z.endSpanById(N,v,U),C?.debug(`${E} [span] Ended agent span: spanId=${N}, traceId=${F.traceId}, duration=${d.durationMs}ms`)),ue&&Z&&!Z.isDisposed){let Pe=Date.now(),me={"request.duration_ms":Pe-ue};oe&&(me["openclaw.session.id"]=oe,me["gen_ai.session.id"]=oe),Je&&(me["gen_ai.input.messages"]=Ie(JSON.stringify([{role:"user",parts:[{type:"text",content:String(Je)}]}]))),H&&(me["gen_ai.output.messages"]=St([typeof H=="string"?H:JSON.stringify(H)])),Z.endSpanById(K,Pe,me),C?.debug(`${E} [span] Ended entry span: spanId=${K}, traceId=${F.traceId}, duration=${Pe-ue}ms`)}fn(l.runId),Ge(F),Z&&!Z.isDisposed&&(await Z.flush(),C?.debug(`${E} [span] Flushed after agent_end, traceId=${F.traceId}`))}catch(H){C?.warn(`${E} agent_end delayed cleanup failed: ${String(H)}`)}},100);Ee.add(te)}else fn(l.runId),Ge(F),y&&await y.flush()}catch(p){C?.error(`${E} [hook] agent_end UNCAUGHT ERROR: ${String(p)}`,p instanceof Error?p.stack:void 0)}},{priority:-100}),a.on("before_reset",async(d,g)=>{try{if(!z("before_reset")||!y)return;let p=se(g),{ctx:l}=Q(p,d?.runId,"before_reset");y?.patchOpenSpanAttributes(l.rootSpanId,{"openclaw.reset":!0,"openclaw.reset.reason":d?.reason??"user_request"})}catch(p){C?.warn(`${E} [hook] before_reset ERROR: ${String(p)}`)}},{priority:-100}),C?.debug(`${E} Registered trace hook handlers (v2 \u2014 \u5B8C\u6574\u94FE\u8DEF\u8FFD\u8E2A).`)}function Mt(a){a!==u&&(P&&(P(),P=null),u=a,u&&y&&!y.isDisposed&&(P=u.subscribe(xt)))}function xt(a){if(!y||y.isDisposed||!(a.secretId!==r||a.secretKey!==s||(a.token||"")!==(o||"")))return;r=a.secretId,s=a.secretKey,o=a.token;let g=new ir(L(a));y.updateProducer(g,e),C?.debug(`${E} \u5171\u4EAB\u51ED\u8BC1\u7BA1\u7406\u5668\u66F4\u65B0\u540E\uFF0CProducer \u5DF2\u91CD\u5EFA\uFF08\u65B0\u51ED\u8BC1\uFF09`)}return{service:Nt,registerHooks:kt,updateSharedCredentialManager:Mt}}import{Producer as an,LogItem as ff,Content as mf}from"tencentcloud-cls-sdk-nodejs";var ar={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},fe="[diagnostics-metrics-cls/log]";function Ro(t,e){if(!t||!(t.enableLogReport===!0))return null;let r=typeof t.logTopicId=="string"?t.logTopicId.trim():"";if(!r)return null;let s=typeof e?.endpoint=="string"?e.endpoint.trim():"";if(!s)return null;let o="",i="";try{o=typeof e?.secretId=="string"?ie(e.secretId.trim()):""}catch{}try{i=typeof e?.secretKey=="string"?ie(e.secretKey.trim()):""}catch{}let c=typeof e?.token=="string"?e.token.trim():void 0,u=typeof e?.credentialMode=="string"&&e.credentialMode.trim()==="cvmRole"?"cvmRole":"static",f=typeof e?.roleName=="string"?e.roleName.trim():void 0;if(!(u==="cvmRole"?!!(s&&f):!!(s&&o&&i)))return null;let _=typeof t.source=="string"&&t.source.trim()?t.source.trim():"openclaw",T=t.enableGatewayLog!==!1,M=t.enableSessionLog!==!1,R=typeof t.minLevel=="string"&&ar[t.minLevel]!==void 0?t.minLevel:"info",k=typeof t.sendTimeThreshold=="number"&&t.sendTimeThreshold>=1?t.sendTimeThreshold:2,y=typeof t.sendCountThreshold=="number"&&t.sendCountThreshold>=1?Math.floor(t.sendCountThreshold):1e3;return{endpoint:s,secretId:o,secretKey:i,token:c,credentialMode:u,roleName:f,logTopicId:r,source:_,enableGatewayLog:T,enableSessionLog:M,minLevel:R,sendTimeThreshold:k,sendCountThreshold:y}}function gf(t){let e=t._meta,n=(e?.logLevelName??"INFO").toLowerCase(),r=e?.date instanceof Date?e.date.getTime():Date.now(),s=e?.name,o=Object.entries(t).filter(([f])=>/^\d+$/.test(f)).sort((f,h)=>Number(f[0])-Number(h[0])).map(([,f])=>f),i,c={};if(typeof o[0]=="string"&&o[0].trim().startsWith("{"))try{let f=JSON.parse(o[0]);if(f&&typeof f=="object"&&!Array.isArray(f)){typeof f.subsystem=="string"&&(i=f.subsystem);for(let[h,_]of Object.entries(f))h!=="subsystem"&&(typeof _=="string"||typeof _=="number"||typeof _=="boolean")&&(c[h]=String(_));o.shift()}}catch{}let u="";for(let f=o.length-1;f>=0;f--)if(typeof o[f]=="string"){u=String(o[f]),o.splice(f,1);break}if(!u&&o.length===1){try{u=JSON.stringify(o[0])}catch{u=String(o[0])}o.length=0}if(u||(u="(empty)"),o.length>0)try{c.args=JSON.stringify(o)}catch{c.args=String(o)}return{level:n,message:u,timestamp:r,subsystem:i,logger:s,extra:c}}function hf(t){let e=typeof t.role=="string"?t.role:"unknown",n;try{n=JSON.stringify(t)}catch{n=String(t)}let r,s,o,i;if(e==="toolResult")typeof t.toolCallId=="string"&&(r=t.toolCallId),typeof t.toolName=="string"&&(s=t.toolName);else if(e==="assistant"){typeof t.stopReason=="string"&&(o=t.stopReason);let u=(Array.isArray(t.content)?t.content:[]).filter(f=>f!==null&&typeof f=="object"&&f.type==="tool_use").length;u>0&&(i=u)}return{role:e,content:n,toolCallId:r,toolName:s,stopReason:o,toolCallCount:i}}function Cl(t,e,n){let r={...t},s=e,o=null,i=null,c=null,u=null,f=!1,h=ar[r.minLevel??"info"]??2;function _($,P,L){return{topic_id:r.logTopicId,endpoint:r.endpoint,credential:{secretId:$,secretKey:P,...L?{token:L}:{}},time:r.sendTimeThreshold??2,count:r.sendCountThreshold??1e3,onSendLogsError:x=>{if(x!==null&&typeof x=="object"&&x.status===200)return;let I;if(x instanceof Error)I=x.message;else if(typeof x=="object"&&x!==null)try{I=JSON.stringify(x)}catch{I=Object.prototype.toString.call(x)}else I=String(x);u?.warn(`${fe} \u65E5\u5FD7\u4E0A\u4F20\u5931\u8D25 - ${I}`)}}}function T($,P){if(o)try{let L=$;if(n){let I=n();(I.cvmInstanceId||I.cvmInstanceName||I.cvmInstanceIntraIp)&&(L={...$},I.cvmInstanceId&&(L.cvm_instance_id=I.cvmInstanceId),I.cvmInstanceName&&(L.cvm_instance_name=I.cvmInstanceName),I.cvmInstanceIntraIp&&(L.cvm_instance_intra_ip=I.cvmInstanceIntraIp))}let x=new ff;x.setTime(P);for(let[I,O]of Object.entries(L))x.pushBack(new mf(I,O));o.send(x).catch(I=>{let O;if(I instanceof Error)O=I.message;else try{O=JSON.stringify(I)}catch{O=Object.prototype.toString.call(I)}u?.warn(`${fe} send \u5931\u8D25: ${O}`)})}catch{}}let M={id:"diagnostics-metrics-cls-log",async start($){if(u=$.logger,n)try{await rr($.logger,$.stateDir),f=!0}catch(I){u?.warn(`${fe} \u5B9E\u4F8B\u5143\u6570\u636E\u521D\u59CB\u5316\u5931\u8D25\uFF0CCVM \u5143\u5B57\u6BB5\u5C06\u7F3A\u5931: ${String(I)}`)}let P=r.secretId,L=r.secretKey,x=r.token;if(s){let I=s.getCredentialSnapshot();P=I.secretId,L=I.secretKey,x=I.token,c=s.subscribe(O=>{if(o)try{o=new an(_(O.secretId,O.secretKey,O.token)),u?.debug(`${fe} \u51ED\u8BC1\u5DF2\u66F4\u65B0\uFF0CProducer \u5DF2\u91CD\u5EFA`)}catch(j){u?.warn(`${fe} \u51ED\u8BC1\u66F4\u65B0\u540E\u91CD\u5EFA Producer \u5931\u8D25: ${String(j)}`)}})}try{o=new an(_(P,L,x))}catch(I){u?.error(`${fe} \u521B\u5EFA Producer \u5931\u8D25: ${String(I)}`),f&&(tn(),f=!1);return}if(u?.info(`${fe} \u542F\u52A8\uFF0Cendpoint=${r.endpoint}\uFF0ClogTopicId=${r.logTopicId}\uFF0CenableGatewayLog=${r.enableGatewayLog}\uFF0CenableSessionLog=${r.enableSessionLog}\uFF0CminLevel=${r.minLevel}`),r.enableGatewayLog){let I="openclaw/plugin-sdk/diagnostics-otel",O;try{O=(await import(I)).registerLogTransport}catch{}O?i=O(j=>{if(o)try{let S=gf(j);if((ar[S.level]??0)<h)return;let V={log_type:"gateway",level:S.level,message:S.message,source:r.source??"openclaw"};S.subsystem&&(V.subsystem=S.subsystem),S.logger&&(V.logger=S.logger);for(let[Y,ce]of Object.entries(S.extra))V[Y]=ce;T(V,Math.floor(S.timestamp/1e3))}catch{}}):u?.warn(`${fe} registerLogTransport \u5728\u5F53\u524D openclaw \u7248\u672C\uFF08>=2026.4.27\uFF09\u4E2D\u5DF2\u79FB\u9664\uFF0Cgateway \u65E5\u5FD7\u4E0A\u62A5\u5DF2\u8DF3\u8FC7`)}},async stop(){i?.(),i=null,c?.(),c=null,o=null,f&&(tn(),f=!1),u=null}};function R($){let P=$.logTopicId!==r.logTopicId,L=$.endpoint!==r.endpoint;if(r={...$},h=ar[r.minLevel??"info"]??2,(P||L)&&o)try{let x=r.secretId,I=r.secretKey,O=r.token;if(s){let j=s.getCredentialSnapshot();x=j.secretId,I=j.secretKey,O=j.token}o=new an(_(x,I,O)),u?.info(`${fe} \u914D\u7F6E\u70ED\u66F4\u65B0\uFF0CProducer \u5DF2\u91CD\u5EFA\uFF0ClogTopicId=${r.logTopicId}\uFF0Cendpoint=${r.endpoint}`)}catch(x){u?.warn(`${fe} \u914D\u7F6E\u70ED\u66F4\u65B0\u540E\u91CD\u5EFA Producer \u5931\u8D25: ${String(x)}`)}}function k($){if($!==s&&(c?.(),c=null,s=$,o&&s)){let P=s.getCredentialSnapshot();try{o=new an(_(P.secretId,P.secretKey,P.token)),u?.debug(`${fe} \u51ED\u8BC1\u7BA1\u7406\u5668\u5DF2\u66F4\u65B0\uFF0CProducer \u5DF2\u91CD\u5EFA`)}catch(L){u?.warn(`${fe} \u51ED\u8BC1\u7BA1\u7406\u5668\u66F4\u65B0\u540E\u91CD\u5EFA Producer \u5931\u8D25: ${String(L)}`)}c=s.subscribe(L=>{if(o)try{o=new an(_(L.secretId,L.secretKey,L.token)),u?.debug(`${fe} \u51ED\u8BC1\u5DF2\u66F4\u65B0\uFF0CProducer \u5DF2\u91CD\u5EFA`)}catch(x){u?.warn(`${fe} \u51ED\u8BC1\u66F4\u65B0\u540E\u91CD\u5EFA Producer \u5931\u8D25: ${String(x)}`)}})}}function y($){r.enableSessionLog&&$.on("before_message_write",(P,L)=>{if(o)try{let x=P?.message;if(!x)return;let I=L?.sessionKey??P?.sessionKey??"",O=L?.agentId??P?.agentId??"",j=Math.floor(Date.now()/1e3),S=hf(x),q={log_type:"session",role:S.role,content:S.content,source:r.source??"openclaw"};S.toolCallId&&(q.tool_call_id=S.toolCallId),S.toolName&&(q.tool_name=S.toolName),S.stopReason&&(q.stop_reason=S.stopReason),S.toolCallCount!==void 0&&(q.tool_calls=String(S.toolCallCount)),I&&(q.session_key=I),O&&(q.agent_id=O),T(q,j)}catch{}})}return{service:M,registerHooks:y,updateConfig:R,updateSharedCredentialManager:k}}import yf from"node:http";import _f from"node:https";import{URL as bf}from"node:url";var Ol="http://metadata.tencentyun.com/latest/meta-data/",wf=Ol+"cam/security-credentials/",If=Ol+"cam/service-role-security-credentials/",Nl="custom-role-",Tf=5e3,kl=3600*1e3,Ml=8192,xl=3;function Pl(t,e=0){if(e>xl)return Promise.reject(new Error(`Too many redirects (>${xl}) for ${t}`));let n;try{n=new bf(t)}catch{return Promise.reject(new Error(`Invalid URL: ${t}`))}let r=n.protocol==="https:"?_f:yf;return new Promise((s,o)=>{let i=r.get(t,{timeout:Tf},c=>{let u=c.statusCode??0;if(u>=300&&u<400&&c.headers.location){c.resume(),Pl(c.headers.location,e+1).then(s,o);return}if(u!==200){c.resume(),o(new Error(`HTTP ${u} for ${t}`));return}let f=[],h=0,_=!1;c.on("data",T=>{if(!_){if(h+=T.length,h>Ml){_=!0,c.destroy(),o(new Error(`Response body too large (>${Ml} bytes) for ${t}`));return}f.push(T)}}),c.on("end",()=>{_||s(Buffer.concat(f).toString("utf-8").trim())}),c.on("error",T=>{_||o(T)})});i.on("timeout",()=>{i.destroy(),o(new Error(`Request timeout for ${t}`))}),i.on("error",o)})}var Co=class t{constructor(e){this.credentialTask=null;this.lastResolvedExpiredTime=null;this.roleName=e}static{this.MAX_EXPIRED_RETRY=3}getRoleUrl(){return this.roleName.indexOf(Nl)===0?wf+this.roleName.slice(Nl.length):If+this.roleName}async fetchRoleCredential(){let e=await Pl(this.getRoleUrl()),n;try{n=JSON.parse(e)}catch{throw new Error(`Failed to parse credential response for role [${this.roleName}]: ${e.slice(0,200)}`)}if(n.Code!=="Success")throw new Error(`Get credential from metadata server by role name [${this.roleName}] failed, Code: ${n.Code}`);if(!n.TmpSecretId||!n.TmpSecretKey)throw new Error(`Credential response for role [${this.roleName}] missing TmpSecretId or TmpSecretKey`);return n}async getCredential(){return this.getCredentialWithRetry(0)}async getCredentialWithRetry(e){this.credentialTask||(this.credentialTask=this.fetchRoleCredential());let n;try{n=await this.credentialTask}catch(r){throw this.credentialTask=null,r}if(n.ExpiredTime*1e3-kl<=Date.now()){if(e>=t.MAX_EXPIRED_RETRY)throw this.credentialTask=null,new Error(`Credential for role [${this.roleName}] is still expired after ${t.MAX_EXPIRED_RETRY} retries (ExpiredTime=${n.ExpiredTime}, now=${Math.floor(Date.now()/1e3)})`);return this.credentialTask=null,this.getCredentialWithRetry(e+1)}return this.lastResolvedExpiredTime=n.ExpiredTime,{secretId:n.TmpSecretId,secretKey:n.TmpSecretKey,token:n.Token,expiredTime:n.ExpiredTime}}invalidate(){this.credentialTask=null,this.lastResolvedExpiredTime=null}isExpiringSoon(){return this.lastResolvedExpiredTime===null?!0:this.lastResolvedExpiredTime*1e3-kl<=Date.now()}},Et=new Map;function Sf(t){let e=Et.get(t);return e||(e=new Co(t),Et.set(t,e)),e}async function Al(t){if(!t)throw new Error("roleName is required for CVM role credential provider");return Sf(t).getCredential()}function cr(t){let e=Et.get(t);return e?e.isExpiringSoon():!0}function $l(t){if(t)Et.get(t)?.invalidate();else for(let e of Et.values())e.invalidate()}function Ll(){Et.clear()}var vf=300*1e3,No=class t{constructor(e){this.listeners=[];this.refreshTimer=null;this.started=!1;this.stopped=!1;this.log=null;this.refreshingPromise=null;this.credentialMode=e.credentialMode,this.roleName=e.roleName,this.secretId=e.secretId,this.secretKey=e.secretKey,this.token=e.token,this.refreshIntervalMs=e.refreshIntervalMs??vf}static{this.LOG_PREFIX="[diagnostics-metrics-cls/shared-credential]"}setLogger(e){this.log=e}getCredentialMode(){return this.credentialMode}getRoleName(){return this.roleName}getCredentialSnapshot(){return{secretId:this.secretId,secretKey:this.secretKey,token:this.token}}subscribe(e){return this.listeners.push(e),()=>{let n=this.listeners.indexOf(e);n>=0&&this.listeners.splice(n,1)}}async start(){this.started||(this.started=!0,this.stopped=!1,this.credentialMode==="cvmRole"&&(await this.refreshCredentialInternal(),this.refreshTimer=setInterval(()=>{cr(this.roleName)&&this.refreshCredentialInternal()},this.refreshIntervalMs),typeof this.refreshTimer.unref=="function"&&this.refreshTimer.unref(),this.log?.debug(`${t.LOG_PREFIX} cvmRole \u51ED\u8BC1\u5B9A\u65F6\u5237\u65B0\u5DF2\u542F\u52A8\uFF0C\u95F4\u9694 ${this.refreshIntervalMs}ms`)))}stop(){this.stopped=!0,this.started=!1,this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null),this.listeners=[],Ll()}async forceRefresh(){return this.credentialMode==="cvmRole"?this.refreshingPromise?(this.log?.warn(`${t.LOG_PREFIX} \u6536\u5230\u5F3A\u5236\u5237\u65B0\u8BF7\u6C42\uFF0C\u5DF2\u6709\u5237\u65B0\u6B63\u5728\u8FDB\u884C\u4E2D\uFF0C\u7B49\u5F85\u5B8C\u6210`),await this.refreshingPromise,!0):cr(this.roleName)?(this.log?.warn(`${t.LOG_PREFIX} \u6536\u5230\u5F3A\u5236\u5237\u65B0\u8BF7\u6C42\uFF0C\u4E34\u65F6\u5BC6\u94A5\u5DF2\u8FC7\u671F\uFF0C\u6B63\u5728\u5237\u65B0 cvmRole \u4E34\u65F6\u5BC6\u94A5`),$l(this.roleName),await this.refreshCredentialInternal(),!0):(this.log?.warn(`${t.LOG_PREFIX} \u6536\u5230\u5F3A\u5236\u5237\u65B0\u8BF7\u6C42\uFF0C\u4F46\u4E34\u65F6\u5BC6\u94A5\u5C1A\u672A\u8FC7\u671F\uFF0C\u8DF3\u8FC7\u5237\u65B0\uFF08401 \u53EF\u80FD\u7531\u6743\u9650\u914D\u7F6E\u7B49\u539F\u56E0\u5BFC\u81F4\uFF09`),!1):(this.log?.warn(`${t.LOG_PREFIX} \u6536\u5230\u5F3A\u5236\u5237\u65B0\u8BF7\u6C42\uFF0C\u5F53\u524D\u4E3A static \u51ED\u8BC1\u6A21\u5F0F\uFF0C\u65E0\u6CD5\u81EA\u52A8\u5237\u65B0`),!1)}updateStaticCredential(e,n,r){(e!==this.secretId||n!==this.secretKey||(r||"")!==(this.token||""))&&(this.secretId=e,this.secretKey=n,this.token=r,this.notifyListeners(),this.log?.debug(`${t.LOG_PREFIX} \u9759\u6001\u51ED\u8BC1\u5DF2\u66F4\u65B0`))}async updateMode(e,n,r,s,o){let i=e!==this.credentialMode,c=n!==this.roleName;this.credentialMode=e,this.roleName=n,e==="static"?(this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null),r!==void 0&&s!==void 0&&(this.secretId=r,this.secretKey=s,this.token=o),this.notifyListeners()):e==="cvmRole"&&(this.started&&(i||c)&&await this.refreshCredentialInternal(),!this.refreshTimer&&this.started&&(this.refreshTimer=setInterval(()=>{cr(this.roleName)&&this.refreshCredentialInternal()},this.refreshIntervalMs),typeof this.refreshTimer.unref=="function"&&this.refreshTimer.unref()))}async refreshCredentialInternal(){if(!this.stopped){if(this.refreshingPromise){await this.refreshingPromise;return}this.refreshingPromise=this.doRefresh();try{await this.refreshingPromise}finally{this.refreshingPromise=null}}}async doRefresh(){try{let e=await Al(this.roleName);if(this.stopped)return;let n=e.secretId!==this.secretId||e.secretKey!==this.secretKey||(e.token||"")!==(this.token||"");this.secretId=e.secretId,this.secretKey=e.secretKey,this.token=e.token,n&&(this.notifyListeners(),this.log?.debug(`${t.LOG_PREFIX} cvmRole \u4E34\u65F6\u5BC6\u94A5\u5DF2\u5237\u65B0`))}catch(e){this.log?.warn(`${t.LOG_PREFIX} cvmRole \u4E34\u65F6\u5BC6\u94A5\u5237\u65B0\u5931\u8D25: ${String(e)}`)}}notifyListeners(){let e=this.getCredentialSnapshot();for(let n of this.listeners)try{n(e)}catch(r){this.log?.warn(`${t.LOG_PREFIX} \u51ED\u8BC1\u53D8\u66F4\u901A\u77E5\u56DE\u8C03\u5F02\u5E38: ${String(r)}`)}}};function Dl(t){if(!t)return null;let e=typeof t.credentialMode=="string"&&t.credentialMode.trim()==="cvmRole"?"cvmRole":"static",n=typeof t.roleName=="string"?t.roleName.trim():"",r=typeof t.secretId=="string"?t.secretId.trim():"",s=typeof t.secretKey=="string"?t.secretKey.trim():"",o=typeof t.token=="string"?t.token.trim():void 0,i=typeof t.credentialRefreshIntervalMs=="number"&&t.credentialRefreshIntervalMs>=6e4?t.credentialRefreshIntervalMs:void 0;return new No({credentialMode:e,roleName:n,secretId:r,secretKey:s,token:o,refreshIntervalMs:i})}var cn=null,Te=null,Rt=null,Bl="";function Ef(t){if(!t)return"";let e=["credentialMode","roleName","secretId","secretKey","token","credentialRefreshIntervalMs"],n=[];for(let r of e){let s=t[r];n.push(`${r}=${typeof s=="string"||typeof s=="number"?String(s):""}`)}return n.join("|")}var Rf={id:"clawpro-diagnostics-metrics-cls",name:"Diagnostics Metrics",description:"CLS\u8BCA\u65AD\u6307\u6807\u5BFC\u51FA\u63D2\u4EF6\uFF1APrometheus \u6307\u6807\uFF08pull/remote-write\uFF09+ \u5168\u94FE\u8DEF Trace",configSchema:{type:"object",properties:{prometheus:{type:"object",description:"Prometheus \u6307\u6807\u5BFC\u51FA\u914D\u7F6E",properties:{enabled:{type:"boolean",default:!0,description:"\u662F\u5426\u542F\u7528 Prometheus \u6307\u6807\u5BFC\u51FA"},metric_prefix:{type:"string",default:"openclaw",description:"\u6307\u6807\u540D\u79F0\u524D\u7F00"},pull:{type:"boolean",default:!0,description:"\u662F\u5426\u542F\u7528 /metrics HTTP pull \u7AEF\u70B9"},default_metrics:{type:"boolean",default:!0,description:"\u662F\u5426\u91C7\u96C6 Node.js \u9ED8\u8BA4\u6307\u6807"},push_interval_ms:{type:"number",default:3e4,description:"Remote Write \u63A8\u9001\u95F4\u9694\uFF08\u6BEB\u79D2\uFF09"}}},cls:{type:"object",description:"\u817E\u8BAF\u4E91 CLS \u51ED\u8BC1\u4E0E\u63A5\u5165\u914D\u7F6E",properties:{endpoint:{type:"string",description:"CLS \u63A5\u5165\u70B9"},secretId:{type:"string",description:"\u817E\u8BAF\u4E91 SecretId"},secretKey:{type:"string",description:"\u817E\u8BAF\u4E91 SecretKey"},metricTopicId:{type:"string",description:"\u6307\u6807\u65E5\u5FD7\u4E3B\u9898 ID"},credentialMode:{type:"string",enum:["static","cvmRole"],description:"\u51ED\u8BC1\u6A21\u5F0F"},roleName:{type:"string",description:"CVM \u89D2\u8272\u540D\u79F0"},enableReport:{type:"boolean",default:!0,description:"\u662F\u5426\u542F\u7528\u6307\u6807\u63A8\u9001"}}},log:{type:"object",description:"CLS \u65E5\u5FD7\u4E0A\u62A5\u914D\u7F6E\uFF0C\u5C06 gateway \u8FD0\u884C\u65E5\u5FD7\u3001\u4F1A\u8BDD\u65E5\u5FD7\uFF08session JSONL\uFF09\u5B9E\u65F6\u4E0A\u62A5\u5230 CLS",properties:{enableLogReport:{type:"boolean",default:!1,description:"\u662F\u5426\u542F\u7528\u65E5\u5FD7\u4E0A\u62A5\uFF0C\u9ED8\u8BA4 false"},logTopicId:{type:"string",description:"\u65E5\u5FD7\u4E0A\u62A5\u4F7F\u7528\u7684 CLS \u65E5\u5FD7\u4E3B\u9898 ID"},source:{type:"string",description:"\u65E5\u5FD7\u6765\u6E90\u6807\u8BC6\uFF0C\u9ED8\u8BA4 openclaw"},enableGatewayLog:{type:"boolean",default:!0,description:"\u662F\u5426\u542F\u7528 gateway \u8FD0\u884C\u65E5\u5FD7\u4E0A\u62A5\uFF0C\u9ED8\u8BA4 true"},enableSessionLog:{type:"boolean",default:!0,description:"\u662F\u5426\u542F\u7528\u4F1A\u8BDD\u65E5\u5FD7\u4E0A\u62A5\uFF08session JSONL\uFF09\uFF0C\u9ED8\u8BA4 true"},minLevel:{type:"string",description:"\u6700\u4F4E\u4E0A\u62A5\u65E5\u5FD7\u7EA7\u522B\uFF08\u4EC5\u5BF9 gateway \u8FD0\u884C\u65E5\u5FD7\u751F\u6548\uFF09\uFF0C\u9ED8\u8BA4 info"},sendTimeThreshold:{type:"number",default:2,description:"CLS SDK \u5F02\u6B65\u53D1\u9001\u65F6\u95F4\u9608\u503C\uFF08\u79D2\uFF09\uFF0C\u9ED8\u8BA4 2"},sendCountThreshold:{type:"number",default:1e3,description:"CLS SDK \u5F02\u6B65\u53D1\u9001\u6761\u6570\u9608\u503C\uFF0C\u9ED8\u8BA4 1000"}}},trace:{type:"object",description:"CLS \u5168\u94FE\u8DEF Trace \u8FFD\u8E2A\u914D\u7F6E",properties:{enabled:{type:"boolean",default:!1,description:"\u662F\u5426\u542F\u7528 Trace \u94FE\u8DEF\u8FFD\u8E2A"},traceTopicId:{type:"string",description:"Trace \u65E5\u5FD7\u4E3B\u9898 ID"},serviceName:{type:"string",default:"openclaw-agent",description:"\u670D\u52A1\u540D\u79F0"},debug:{type:"boolean",default:!1,description:"\u662F\u5426\u5F00\u542F\u8C03\u8BD5\u65E5\u5FD7"},batchSize:{type:"number",default:10,description:"Span \u7F13\u51B2\u533A\u5927\u5C0F"},flushIntervalMs:{type:"number",default:5e3,description:"Span \u7F13\u51B2\u533A\u6700\u5927\u7B49\u5F85\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09"},enabledHooks:{type:"array",items:{type:"string"},description:"\u542F\u7528\u7684 hook \u5217\u8868\uFF0C\u4E0D\u8BBE\u7F6E\u5219\u5168\u90E8\u542F\u7528"}}}}},register(t){if(t.registrationMode==="cli-metadata")return;let e=t.pluginConfig?.prometheus,n=t.pluginConfig?.cls,r=t.pluginConfig?.trace,s=t.pluginConfig?.log,o;if(n){if(o={...n},typeof n.secretId=="string")try{o.secretId=ie(n.secretId)}catch{}if(typeof n.secretKey=="string")try{o.secretKey=ie(n.secretKey)}catch{}}let i=Ef(o),c;if(Rt&&Bl===i)c=Rt;else if(Rt&&o){let T=o.credentialMode==="cvmRole"?"cvmRole":"static",M=typeof o.roleName=="string"?o.roleName:"",R=typeof o.secretId=="string"?o.secretId:"",k=typeof o.secretKey=="string"?o.secretKey:"",y=typeof o.token=="string"?o.token:void 0;Rt.updateMode(T,M,R,k,y),c=Rt}else c=Dl(o),Rt=c;Bl=i;let u={...e,...n},h=rl(u,c,(T,M)=>{if(!Te||!T||!M)return;let R={...s??{},enableLogReport:T,logTopicId:M},k=Ro(R,n);k&&Te.updateConfig(k)});if(c&&t.registerService({id:"diagnostics-metrics-cls-shared-credential",async start(T){c.setLogger(T.logger),await c.start()},async stop(T){T.logger?.debug?.("[diagnostics-metrics-cls] shared-credential service stopping"),c.stop()}}),t.registerService(h),t.registerHttpRoute({path:"/metrics",auth:"plugin",match:"exact",replaceExisting:!0,handler:async(T,M)=>{let R=h.getExports();if(!R?.registry)return M.writeHead(503,{"Content-Type":"text/plain"}),M.end(`Prometheus metrics not initialized
16
+ `),!0;try{let k=await R.registry.metrics();M.writeHead(200,{"Content-Type":R.registry.contentType}),M.end(k)}catch{M.writeHead(500,{"Content-Type":"text/plain"}),M.end(`Failed to collect metrics
17
+ `)}return!0}}),!cn){let T=Eo(r,n);T.sharedCredentialManager=c,cn=Rl(T)}if(cn.updateSharedCredentialManager(c),cn.registerHooks(t),t.registerService(cn.service),s?.enableLogReport===!0){let T=Ro(s,n);T&&(Te?Te.updateConfig(T):Te=Cl(T,c,Oe),Te.updateSharedCredentialManager(c),Te.registerHooks(t),t.registerService(Te.service))}else Te&&(Te.service.stop(),Te=null)}},Fy=Rf;export{Fy as default};