@iflow-ai/iflow-cli 0.3.22-beta.0 → 0.3.22
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/bundle/iflow.js +6 -6
- package/package.json +1 -1
package/bundle/iflow.js
CHANGED
|
@@ -446,9 +446,9 @@ ${a}`.trim()}_serializeSingularDataPoint(e,r,n){let i="";e=QAt(e,r);let{value:o,
|
|
|
446
446
|
${i}
|
|
447
447
|
${o}
|
|
448
448
|
`}};TIe.PrometheusSerializer=HAt});var dIr=w(IIe=>{"use strict";Object.defineProperty(IIe,"__esModule",{value:!0});IIe.PrometheusExporter=void 0;var $fe=(Kt(),yt(ar)),Hro=oi(),jAt=Dx(),Gro=Ae("http"),jro=GAt(),Vro=Ae("url"),VAt=class t extends jAt.MetricReader{static DEFAULT_OPTIONS={host:void 0,port:9464,endpoint:"/metrics",prefix:"",appendTimestamp:!1,withResourceConstantLabels:void 0};_host;_port;_baseUrl;_endpoint;_server;_prefix;_appendTimestamp;_serializer;_startServerPromise;constructor(e={},r=()=>{}){super({aggregationSelector:i=>({type:jAt.AggregationType.DEFAULT}),aggregationTemporalitySelector:i=>jAt.AggregationTemporality.CUMULATIVE,metricProducers:e.metricProducers}),this._host=e.host||process.env.OTEL_EXPORTER_PROMETHEUS_HOST||t.DEFAULT_OPTIONS.host,this._port=e.port||Number(process.env.OTEL_EXPORTER_PROMETHEUS_PORT)||t.DEFAULT_OPTIONS.port,this._prefix=e.prefix||t.DEFAULT_OPTIONS.prefix,this._appendTimestamp=typeof e.appendTimestamp=="boolean"?e.appendTimestamp:t.DEFAULT_OPTIONS.appendTimestamp;let n=e.withResourceConstantLabels||t.DEFAULT_OPTIONS.withResourceConstantLabels;this._server=(0,Gro.createServer)(this._requestHandler).unref(),this._serializer=new jro.PrometheusSerializer(this._prefix,this._appendTimestamp,n),this._baseUrl=`http://${this._host}:${this._port}/`,this._endpoint=(e.endpoint||t.DEFAULT_OPTIONS.endpoint).replace(/^([^/])/,"/$1"),e.preventServerStart!==!0?this.startServer().then(r,i=>{$fe.diag.error(i),r(i)}):r&&queueMicrotask(r)}async onForceFlush(){}onShutdown(){return this.stopServer()}stopServer(){return this._server?new Promise(e=>{this._server.close(r=>{r?r.code!=="ERR_SERVER_NOT_RUNNING"&&(0,Hro.globalErrorHandler)(r):$fe.diag.debug("Prometheus exporter was stopped"),e()})}):($fe.diag.debug("Prometheus stopServer() was called but server was never started."),Promise.resolve())}startServer(){return this._startServerPromise??=new Promise((e,r)=>{this._server.once("error",r),this._server.listen({port:this._port,host:this._host},()=>{$fe.diag.debug(`Prometheus exporter server started: ${this._host}:${this._port}/${this._endpoint}`),e()})}),this._startServerPromise}getMetricsRequestHandler(e,r){this._exportMetrics(r)}_requestHandler=(e,r)=>{e.url!=null&&new Vro.URL(e.url,this._baseUrl).pathname===this._endpoint?this._exportMetrics(r):this._notFound(r)};_exportMetrics=e=>{e.statusCode=200,e.setHeader("content-type","text/plain"),this.collect().then(r=>{let{resourceMetrics:n,errors:i}=r;i.length&&$fe.diag.error("PrometheusExporter: metrics collection errors",...i),e.end(this._serializer.serialize(n))},r=>{e.end(`# failed to export metrics: ${r}`)})};_notFound=e=>{e.statusCode=404,e.end()}};IIe.PrometheusExporter=VAt});var fIr=w(vK=>{"use strict";Object.defineProperty(vK,"__esModule",{value:!0});vK.PrometheusSerializer=vK.PrometheusExporter=void 0;var $ro=dIr();Object.defineProperty(vK,"PrometheusExporter",{enumerable:!0,get:function(){return $ro.PrometheusExporter}});var Wro=GAt();Object.defineProperty(vK,"PrometheusSerializer",{enumerable:!0,get:function(){return Wro.PrometheusSerializer}})});var pIr=w(DIe=>{"use strict";Object.defineProperty(DIe,"__esModule",{value:!0});DIe.VERSION=void 0;DIe.VERSION="0.206.0"});var mIr=w(RIe=>{"use strict";Object.defineProperty(RIe,"__esModule",{value:!0});RIe.OTLPTraceExporter=void 0;var zro=(vx(),yt(Ex)),Yro=pIr(),Kro=Nx(),hIr=(K9(),yt(LR)),$At=class extends zro.OTLPExporterBase{constructor(e={}){super((0,hIr.createOtlpHttpExportDelegate)((0,hIr.convertLegacyHttpOptions)(e,"TRACES","v1/traces",{"User-Agent":`OTel-OTLP-Exporter-JavaScript/${Yro.VERSION}`,"Content-Type":"application/json"}),Kro.JsonTraceSerializer))}};RIe.OTLPTraceExporter=$At});var gIr=w(BIe=>{"use strict";Object.defineProperty(BIe,"__esModule",{value:!0});BIe.OTLPTraceExporter=void 0;var Jro=mIr();Object.defineProperty(BIe,"OTLPTraceExporter",{enumerable:!0,get:function(){return Jro.OTLPTraceExporter}})});var AIr=w(NIe=>{"use strict";Object.defineProperty(NIe,"__esModule",{value:!0});NIe.OTLPTraceExporter=void 0;var Xro=gIr();Object.defineProperty(NIe,"OTLPTraceExporter",{enumerable:!0,get:function(){return Xro.OTLPTraceExporter}})});var yIr=w(OIe=>{"use strict";Object.defineProperty(OIe,"__esModule",{value:!0});OIe.OTLPTraceExporter=void 0;var Zro=AIr();Object.defineProperty(OIe,"OTLPTraceExporter",{enumerable:!0,get:function(){return Zro.OTLPTraceExporter}})});var vIr=w(kIe=>{"use strict";Object.defineProperty(kIe,"__esModule",{value:!0});kIe.OTLPTraceExporter=void 0;var EIr=mIe(),eno=Nx(),tno=(vx(),yt(Ex)),WAt=class extends tno.OTLPExporterBase{constructor(e={}){super((0,EIr.createOtlpGrpcExportDelegate)((0,EIr.convertLegacyOtlpGrpcOptions)(e,"TRACES"),eno.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}};kIe.OTLPTraceExporter=WAt});var bIr=w(PIe=>{"use strict";Object.defineProperty(PIe,"__esModule",{value:!0});PIe.OTLPTraceExporter=void 0;var rno=vIr();Object.defineProperty(PIe,"OTLPTraceExporter",{enumerable:!0,get:function(){return rno.OTLPTraceExporter}})});var CIr=w(LIe=>{"use strict";Object.defineProperty(LIe,"__esModule",{value:!0});LIe.prepareSend=void 0;var zAt=(Kt(),yt(ar)),MIe=oi(),nno=Ae("http"),ino=Ae("https");function ono(t,e){let r=new URL(t),n=Object.assign({method:"POST",headers:{"Content-Type":"application/json",...e}});return function(o,s){if(o.length===0)return zAt.diag.debug("Zipkin send with empty spans"),s({code:MIe.ExportResultCode.SUCCESS});let{request:a}=r.protocol==="http:"?nno:ino,c=a(r,n,d=>{let f="";d.on("data",p=>{f+=p}),d.on("end",()=>{let p=d.statusCode||0;return zAt.diag.debug(`Zipkin response status code: ${p}, body: ${f}`),p<400?s({code:MIe.ExportResultCode.SUCCESS}):s({code:MIe.ExportResultCode.FAILED,error:new Error(`Got unexpected status code from zipkin: ${p}`)})})});c.on("error",d=>s({code:MIe.ExportResultCode.FAILED,error:d}));let u=JSON.stringify(o);zAt.diag.debug(`Zipkin request payload: ${u}`),c.write(u,"utf8"),c.end()}}LIe.prepareSend=ono});var _Ir=w(FIe=>{"use strict";Object.defineProperty(FIe,"__esModule",{value:!0});FIe.prepareSend=void 0;var sno=CIr();Object.defineProperty(FIe,"prepareSend",{enumerable:!0,get:function(){return sno.prepareSend}})});var YAt=w(UIe=>{"use strict";Object.defineProperty(UIe,"__esModule",{value:!0});UIe.prepareSend=void 0;var ano=_Ir();Object.defineProperty(UIe,"prepareSend",{enumerable:!0,get:function(){return ano.prepareSend}})});var xIr=w(Wfe=>{"use strict";Object.defineProperty(Wfe,"__esModule",{value:!0});Wfe.SpanKind=void 0;var cno;(function(t){t.CLIENT="CLIENT",t.SERVER="SERVER",t.CONSUMER="CONSUMER",t.PRODUCER="PRODUCER"})(cno=Wfe.SpanKind||(Wfe.SpanKind={}))});var TIr=w(Uv=>{"use strict";Object.defineProperty(Uv,"__esModule",{value:!0});Uv._toZipkinAnnotations=Uv._toZipkinTags=Uv.toZipkinSpan=Uv.defaultStatusErrorTagName=Uv.defaultStatusCodeTagName=void 0;var oB=(Kt(),yt(ar)),KAt=oi(),QIe=xIr(),lno={[oB.SpanKind.CLIENT]:QIe.SpanKind.CLIENT,[oB.SpanKind.SERVER]:QIe.SpanKind.SERVER,[oB.SpanKind.CONSUMER]:QIe.SpanKind.CONSUMER,[oB.SpanKind.PRODUCER]:QIe.SpanKind.PRODUCER,[oB.SpanKind.INTERNAL]:void 0};Uv.defaultStatusCodeTagName="otel.status_code";Uv.defaultStatusErrorTagName="error";function uno(t,e,r,n){return{traceId:t.spanContext().traceId,parentId:t.parentSpanContext?.spanId,name:t.name,id:t.spanContext().spanId,kind:lno[t.kind],timestamp:(0,KAt.hrTimeToMicroseconds)(t.startTime),duration:Math.round((0,KAt.hrTimeToMicroseconds)(t.duration)),localEndpoint:{serviceName:e},tags:SIr(t,r,n),annotations:t.events.length?wIr(t.events):void 0}}Uv.toZipkinSpan=uno;function SIr({attributes:t,resource:e,status:r,droppedAttributesCount:n,droppedEventsCount:i,droppedLinksCount:o},s,a){let c={};for(let u of Object.keys(t))c[u]=String(t[u]);return r.code!==oB.SpanStatusCode.UNSET&&(c[s]=String(oB.SpanStatusCode[r.code])),r.code===oB.SpanStatusCode.ERROR&&r.message&&(c[a]=r.message),n&&(c["otel.dropped_attributes_count"]=String(n)),i&&(c["otel.dropped_events_count"]=String(i)),o&&(c["otel.dropped_links_count"]=String(o)),Object.keys(e.attributes).forEach(u=>c[u]=String(e.attributes[u])),c}Uv._toZipkinTags=SIr;function wIr(t){return t.map(e=>({timestamp:Math.round((0,KAt.hrTimeToMicroseconds)(e.time)),value:e.name}))}Uv._toZipkinAnnotations=wIr});var IIr=w(qIe=>{"use strict";Object.defineProperty(qIe,"__esModule",{value:!0});qIe.prepareGetHeaders=void 0;function dno(t){return function(){return t()}}qIe.prepareGetHeaders=dno});var NIr=w(HIe=>{"use strict";Object.defineProperty(HIe,"__esModule",{value:!0});HIe.ZipkinExporter=void 0;var DIr=(Kt(),yt(ar)),RIr=oi(),BIr=YAt(),JAt=TIr(),XAt=(Oh(),yt(u2)),fno=IIr(),ZAt=class{DEFAULT_SERVICE_NAME="OpenTelemetry Service";_statusCodeTagName;_statusDescriptionTagName;_urlStr;_send;_getHeaders;_serviceName;_isShutdown;_sendingPromises=[];constructor(e={}){this._urlStr=e.url||((0,RIr.getStringFromEnv)("OTEL_EXPORTER_ZIPKIN_ENDPOINT")??"http://localhost:9411/api/v2/spans"),this._send=(0,BIr.prepareSend)(this._urlStr,e.headers),this._serviceName=e.serviceName,this._statusCodeTagName=e.statusCodeTagName||JAt.defaultStatusCodeTagName,this._statusDescriptionTagName=e.statusDescriptionTagName||JAt.defaultStatusErrorTagName,this._isShutdown=!1,typeof e.getExportRequestHeaders=="function"?this._getHeaders=(0,fno.prepareGetHeaders)(e.getExportRequestHeaders):this._beforeSend=function(){}}export(e,r){let n=String(this._serviceName||e[0].resource.attributes[XAt.ATTR_SERVICE_NAME]||this.DEFAULT_SERVICE_NAME);if(DIr.diag.debug("Zipkin exporter export"),this._isShutdown){setTimeout(()=>r({code:RIr.ExportResultCode.FAILED,error:new Error("Exporter has been shutdown")}));return}let i=new Promise(s=>{this._sendSpans(e,n,a=>{s(),r(a)})});this._sendingPromises.push(i);let o=()=>{let s=this._sendingPromises.indexOf(i);this._sendingPromises.splice(s,1)};i.then(o,o)}shutdown(){return DIr.diag.debug("Zipkin exporter shutdown"),this._isShutdown=!0,this.forceFlush()}forceFlush(){return new Promise((e,r)=>{Promise.all(this._sendingPromises).then(()=>{e()},r)})}_beforeSend(){this._getHeaders&&(this._send=(0,BIr.prepareSend)(this._urlStr,this._getHeaders()))}_sendSpans(e,r,n){let i=e.map(o=>(0,JAt.toZipkinSpan)(o,String(o.attributes[XAt.ATTR_SERVICE_NAME]||o.resource.attributes[XAt.ATTR_SERVICE_NAME]||r),this._statusCodeTagName,this._statusDescriptionTagName));return this._beforeSend(),this._send(i,o=>{if(n)return n(o)})}};HIe.ZipkinExporter=ZAt});var OIr=w(bK=>{"use strict";Object.defineProperty(bK,"__esModule",{value:!0});bK.ZipkinExporter=bK.prepareSend=void 0;var pno=YAt();Object.defineProperty(bK,"prepareSend",{enumerable:!0,get:function(){return pno.prepareSend}});var hno=NIr();Object.defineProperty(bK,"ZipkinExporter",{enumerable:!0,get:function(){return hno.ZipkinExporter}})});var e3t=w(GIe=>{"use strict";Object.defineProperty(GIe,"__esModule",{value:!0});GIe.B3_DEBUG_FLAG_KEY=void 0;var mno=(Kt(),yt(ar));GIe.B3_DEBUG_FLAG_KEY=(0,mno.createContextKey)("OpenTelemetry Context Key B3 Debug Flag")});var zfe=w(S3=>{"use strict";Object.defineProperty(S3,"__esModule",{value:!0});S3.X_B3_FLAGS=S3.X_B3_PARENT_SPAN_ID=S3.X_B3_SAMPLED=S3.X_B3_SPAN_ID=S3.X_B3_TRACE_ID=S3.B3_CONTEXT_HEADER=void 0;S3.B3_CONTEXT_HEADER="b3";S3.X_B3_TRACE_ID="x-b3-traceid";S3.X_B3_SPAN_ID="x-b3-spanid";S3.X_B3_SAMPLED="x-b3-sampled";S3.X_B3_PARENT_SPAN_ID="x-b3-parentspanid";S3.X_B3_FLAGS="x-b3-flags"});var MIr=w(VIe=>{"use strict";Object.defineProperty(VIe,"__esModule",{value:!0});VIe.B3MultiPropagator=void 0;var zC=(Kt(),yt(ar)),gno=oi(),kIr=e3t(),pE=zfe(),Ano=new Set([!0,"true","True","1",1]),yno=new Set([!1,"false","False","0",0]);function Eno(t){return t===zC.TraceFlags.SAMPLED||t===zC.TraceFlags.NONE}function vno(t){return Array.isArray(t)?t[0]:t}function jIe(t,e,r){let n=e.get(t,r);return vno(n)}function bno(t,e){let r=jIe(t,e,pE.X_B3_TRACE_ID);return typeof r=="string"?r.padStart(32,"0"):""}function Cno(t,e){let r=jIe(t,e,pE.X_B3_SPAN_ID);return typeof r=="string"?r:""}function PIr(t,e){return jIe(t,e,pE.X_B3_FLAGS)==="1"?"1":void 0}function _no(t,e){let r=jIe(t,e,pE.X_B3_SAMPLED);if(PIr(t,e)==="1"||Ano.has(r))return zC.TraceFlags.SAMPLED;if(r===void 0||yno.has(r))return zC.TraceFlags.NONE}var t3t=class{inject(e,r,n){let i=zC.trace.getSpanContext(e);if(!i||!(0,zC.isSpanContextValid)(i)||(0,gno.isTracingSuppressed)(e))return;let o=e.getValue(kIr.B3_DEBUG_FLAG_KEY);n.set(r,pE.X_B3_TRACE_ID,i.traceId),n.set(r,pE.X_B3_SPAN_ID,i.spanId),o==="1"?n.set(r,pE.X_B3_FLAGS,o):i.traceFlags!==void 0&&n.set(r,pE.X_B3_SAMPLED,(zC.TraceFlags.SAMPLED&i.traceFlags)===zC.TraceFlags.SAMPLED?"1":"0")}extract(e,r,n){let i=bno(r,n),o=Cno(r,n),s=_no(r,n),a=PIr(r,n);return(0,zC.isValidTraceId)(i)&&(0,zC.isValidSpanId)(o)&&Eno(s)?(e=e.setValue(kIr.B3_DEBUG_FLAG_KEY,a),zC.trace.setSpanContext(e,{traceId:i,spanId:o,isRemote:!0,traceFlags:s})):e}fields(){return[pE.X_B3_TRACE_ID,pE.X_B3_SPAN_ID,pE.X_B3_FLAGS,pE.X_B3_SAMPLED,pE.X_B3_PARENT_SPAN_ID]}};VIe.B3MultiPropagator=t3t});var FIr=w($Ie=>{"use strict";Object.defineProperty($Ie,"__esModule",{value:!0});$Ie.B3SinglePropagator=void 0;var vF=(Kt(),yt(ar)),xno=oi(),LIr=e3t(),r3t=zfe(),Sno=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,wno="0".repeat(16),Tno=new Set(["d","1"]),Ino="d";function Dno(t){return t.length===32?t:`${wno}${t}`}function Rno(t){return t&&Tno.has(t)?vF.TraceFlags.SAMPLED:vF.TraceFlags.NONE}var n3t=class{inject(e,r,n){let i=vF.trace.getSpanContext(e);if(!i||!(0,vF.isSpanContextValid)(i)||(0,xno.isTracingSuppressed)(e))return;let o=e.getValue(LIr.B3_DEBUG_FLAG_KEY)||i.traceFlags&1,s=`${i.traceId}-${i.spanId}-${o}`;n.set(r,r3t.B3_CONTEXT_HEADER,s)}extract(e,r,n){let i=n.get(r,r3t.B3_CONTEXT_HEADER),o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;let s=o.match(Sno);if(!s)return e;let[,a,c,u]=s,d=Dno(a);if(!(0,vF.isValidTraceId)(d)||!(0,vF.isValidSpanId)(c))return e;let f=Rno(u);return u===Ino&&(e=e.setValue(LIr.B3_DEBUG_FLAG_KEY,u)),vF.trace.setSpanContext(e,{traceId:d,spanId:c,isRemote:!0,traceFlags:f})}fields(){return[r3t.B3_CONTEXT_HEADER]}};$Ie.B3SinglePropagator=n3t});var i3t=w(Yfe=>{"use strict";Object.defineProperty(Yfe,"__esModule",{value:!0});Yfe.B3InjectEncoding=void 0;var Bno;(function(t){t[t.SINGLE_HEADER=0]="SINGLE_HEADER",t[t.MULTI_HEADER=1]="MULTI_HEADER"})(Bno=Yfe.B3InjectEncoding||(Yfe.B3InjectEncoding={}))});var UIr=w(WIe=>{"use strict";Object.defineProperty(WIe,"__esModule",{value:!0});WIe.B3Propagator=void 0;var Nno=oi(),Ono=MIr(),kno=FIr(),Pno=zfe(),Mno=i3t(),o3t=class{_b3MultiPropagator=new Ono.B3MultiPropagator;_b3SinglePropagator=new kno.B3SinglePropagator;_inject;_fields;constructor(e={}){e.injectEncoding===Mno.B3InjectEncoding.MULTI_HEADER?(this._inject=this._b3MultiPropagator.inject,this._fields=this._b3MultiPropagator.fields()):(this._inject=this._b3SinglePropagator.inject,this._fields=this._b3SinglePropagator.fields())}inject(e,r,n){(0,Nno.isTracingSuppressed)(e)||this._inject(e,r,n)}extract(e,r,n){let i=n.get(r,Pno.B3_CONTEXT_HEADER);return(Array.isArray(i)?i[0]:i)?this._b3SinglePropagator.extract(e,r,n):this._b3MultiPropagator.extract(e,r,n)}fields(){return this._fields}};WIe.B3Propagator=o3t});var QIr=w(Fm=>{"use strict";Object.defineProperty(Fm,"__esModule",{value:!0});Fm.B3InjectEncoding=Fm.X_B3_TRACE_ID=Fm.X_B3_SPAN_ID=Fm.X_B3_SAMPLED=Fm.X_B3_PARENT_SPAN_ID=Fm.X_B3_FLAGS=Fm.B3_CONTEXT_HEADER=Fm.B3Propagator=void 0;var Lno=UIr();Object.defineProperty(Fm,"B3Propagator",{enumerable:!0,get:function(){return Lno.B3Propagator}});var CK=zfe();Object.defineProperty(Fm,"B3_CONTEXT_HEADER",{enumerable:!0,get:function(){return CK.B3_CONTEXT_HEADER}});Object.defineProperty(Fm,"X_B3_FLAGS",{enumerable:!0,get:function(){return CK.X_B3_FLAGS}});Object.defineProperty(Fm,"X_B3_PARENT_SPAN_ID",{enumerable:!0,get:function(){return CK.X_B3_PARENT_SPAN_ID}});Object.defineProperty(Fm,"X_B3_SAMPLED",{enumerable:!0,get:function(){return CK.X_B3_SAMPLED}});Object.defineProperty(Fm,"X_B3_SPAN_ID",{enumerable:!0,get:function(){return CK.X_B3_SPAN_ID}});Object.defineProperty(Fm,"X_B3_TRACE_ID",{enumerable:!0,get:function(){return CK.X_B3_TRACE_ID}});var Fno=i3t();Object.defineProperty(Fm,"B3InjectEncoding",{enumerable:!0,get:function(){return Fno.B3InjectEncoding}})});var qIr=w(YC=>{"use strict";Object.defineProperty(YC,"__esModule",{value:!0});YC.JaegerPropagator=YC.UBER_BAGGAGE_HEADER_PREFIX=YC.UBER_TRACE_ID_HEADER=void 0;var bF=(Kt(),yt(ar)),Uno=oi();YC.UBER_TRACE_ID_HEADER="uber-trace-id";YC.UBER_BAGGAGE_HEADER_PREFIX="uberctx";var s3t=class{_jaegerTraceHeader;_jaegerBaggageHeaderPrefix;constructor(e){typeof e=="string"?(this._jaegerTraceHeader=e,this._jaegerBaggageHeaderPrefix=YC.UBER_BAGGAGE_HEADER_PREFIX):(this._jaegerTraceHeader=e?.customTraceHeader||YC.UBER_TRACE_ID_HEADER,this._jaegerBaggageHeaderPrefix=e?.customBaggageHeaderPrefix||YC.UBER_BAGGAGE_HEADER_PREFIX)}inject(e,r,n){let i=bF.trace.getSpanContext(e),o=bF.propagation.getBaggage(e);if(i&&(0,Uno.isTracingSuppressed)(e)===!1){let s=`0${(i.traceFlags||bF.TraceFlags.NONE).toString(16)}`;n.set(r,this._jaegerTraceHeader,`${i.traceId}:${i.spanId}:0:${s}`)}if(o)for(let[s,a]of o.getAllEntries())n.set(r,`${this._jaegerBaggageHeaderPrefix}-${s}`,encodeURIComponent(a.value))}extract(e,r,n){let i=n.get(r,this._jaegerTraceHeader),o=Array.isArray(i)?i[0]:i,s=n.keys(r).filter(u=>u.startsWith(`${this._jaegerBaggageHeaderPrefix}-`)).map(u=>{let d=n.get(r,u);return{key:u.substring(this._jaegerBaggageHeaderPrefix.length+1),value:Array.isArray(d)?d[0]:d}}),a=e;if(typeof o=="string"){let u=qno(o);u&&(a=bF.trace.setSpanContext(a,u))}if(s.length===0)return a;let c=bF.propagation.getBaggage(e)??bF.propagation.createBaggage();for(let u of s)u.value!==void 0&&(c=c.setEntry(u.key,{value:decodeURIComponent(u.value)}));return a=bF.propagation.setBaggage(a,c),a}fields(){return[this._jaegerTraceHeader]}};YC.JaegerPropagator=s3t;var Qno=/^[0-9a-f]{1,2}$/i;function qno(t){let e=decodeURIComponent(t).split(":");if(e.length!==4)return null;let[r,n,,i]=e,o=r.padStart(32,"0"),s=n.padStart(16,"0"),a=Qno.test(i)?parseInt(i,16)&1:1;return{traceId:o,spanId:s,isRemote:!0,traceFlags:a}}});var HIr=w(sB=>{"use strict";Object.defineProperty(sB,"__esModule",{value:!0});sB.UBER_TRACE_ID_HEADER=sB.UBER_BAGGAGE_HEADER_PREFIX=sB.JaegerPropagator=void 0;var a3t=qIr();Object.defineProperty(sB,"JaegerPropagator",{enumerable:!0,get:function(){return a3t.JaegerPropagator}});Object.defineProperty(sB,"UBER_BAGGAGE_HEADER_PREFIX",{enumerable:!0,get:function(){return a3t.UBER_BAGGAGE_HEADER_PREFIX}});Object.defineProperty(sB,"UBER_TRACE_ID_HEADER",{enumerable:!0,get:function(){return a3t.UBER_TRACE_ID_HEADER}})});var $Ir=w(Qv=>{"use strict";Object.defineProperty(Qv,"__esModule",{value:!0});Qv.getPropagatorFromEnv=Qv.getSpanProcessorsFromEnv=Qv.getOtlpProtocolFromEnv=Qv.filterBlanksAndNulls=Qv.getResourceDetectorsFromEnv=void 0;var aB=(Kt(),yt(ar)),cB=oi(),GIr=fht(),Hno=yIr(),Gno=bIr(),jno=OIr(),Kfe=mY(),zIe=K9e(),c3t=QIr(),Vno=HIr(),$no="env",Wno="host",zno="os",Yno="process",Kno="serviceinstance";function Jno(){let t=new Map([[$no,Kfe.envDetector],[Wno,Kfe.hostDetector],[zno,Kfe.osDetector],[Kno,Kfe.serviceInstanceIdDetector],[Yno,Kfe.processDetector]]),e=(0,cB.getStringListFromEnv)("OTEL_NODE_RESOURCE_DETECTORS")??["all"];return e.includes("all")?[...t.values()].flat():e.includes("none")?[]:e.flatMap(r=>{let n=t.get(r);return n||aB.diag.warn(`Invalid resource detector "${r}" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`),n||[]})}Qv.getResourceDetectorsFromEnv=Jno;function jIr(t){return t.map(e=>e.trim()).filter(e=>e!=="null"&&e!=="")}Qv.filterBlanksAndNulls=jIr;function VIr(){return(0,cB.getStringFromEnv)("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL")??(0,cB.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL")??"http/protobuf"}Qv.getOtlpProtocolFromEnv=VIr;function Xno(){let t=VIr();switch(t){case"grpc":return new Gno.OTLPTraceExporter;case"http/json":return new Hno.OTLPTraceExporter;case"http/protobuf":return new GIr.OTLPTraceExporter;default:return aB.diag.warn(`Unsupported OTLP traces protocol: ${t}. Using http/protobuf.`),new GIr.OTLPTraceExporter}}function Zno(){try{let{JaegerExporter:t}=Ae("@opentelemetry/exporter-jaeger");return new t}catch(t){throw new Error(`Could not instantiate JaegerExporter. This could be due to the JaegerExporter's lack of support for bundling. If possible, use @opentelemetry/exporter-trace-otlp-proto instead. Original Error: ${t}`)}}function eio(){let t=new Map([["otlp",()=>Xno()],["zipkin",()=>new jno.ZipkinExporter],["console",()=>new zIe.ConsoleSpanExporter],["jaeger",()=>Zno()]]),e=[],r=[],n=jIr(Array.from(new Set((0,cB.getStringListFromEnv)("OTEL_TRACES_EXPORTER"))));if(n[0]==="none")return aB.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.'),[];n.length===0?(aB.diag.debug("OTEL_TRACES_EXPORTER is empty. Using default otlp exporter."),n=["otlp"]):n.length>1&&n.includes("none")&&(aB.diag.warn('OTEL_TRACES_EXPORTER contains "none" along with other exporters. Using default otlp exporter.'),n=["otlp"]);for(let i of n){let o=t.get(i)?.();o?e.push(o):aB.diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${i}.`)}for(let i of e)i instanceof zIe.ConsoleSpanExporter?r.push(new zIe.SimpleSpanProcessor(i)):r.push(new zIe.BatchSpanProcessor(i));return e.length===0&&aB.diag.warn("Unable to set up trace exporter(s) due to invalid exporter and/or protocol values."),r}Qv.getSpanProcessorsFromEnv=eio;function tio(){let t=(0,cB.getStringListFromEnv)("OTEL_PROPAGATORS");if(t==null)return;let e=new Map([["tracecontext",()=>new cB.W3CTraceContextPropagator],["baggage",()=>new cB.W3CBaggagePropagator],["b3",()=>new c3t.B3Propagator],["b3multi",()=>new c3t.B3Propagator({injectEncoding:c3t.B3InjectEncoding.MULTI_HEADER})],["jaeger",()=>new Vno.JaegerPropagator]]),r=Array.from(new Set(t)),i=r.map(o=>{let s=e.get(o)?.();if(!s){aB.diag.warn(`Propagator "${o}" requested through environment variable is unavailable.`);return}return s}).reduce((o,s)=>(s&&o.push(s),o),[]);return i.length===0?null:r.length===1?i[0]:new cB.CompositePropagator({propagators:i})}Qv.getPropagatorFromEnv=tio});var YIr=w(YIe=>{"use strict";Object.defineProperty(YIe,"__esModule",{value:!0});YIe.NodeSDK=void 0;var G1=(Kt(),yt(ar)),rio=dY(),nio=N8r(),_K=mY(),Jfe=Jht(),iio=vht(),oio=Z7r(),l3t=oIr(),sio=cIr(),WIr=yht(),aio=I8e(),cio=fIr(),CF=Dx(),lio=K9e(),uio=S9e(),dio=(Oh(),yt(u2)),lB=oi(),u3t=$Ir();function zIr(t,e){return parseInt(process.env[t]||"")||e}function fio(){let t=[],e=(0,lB.getStringListFromEnv)("OTEL_METRICS_EXPORTER");return e?(e.length===0&&G1.diag.debug("OTEL_METRICS_EXPORTER is empty. Using default otlp exporter."),e.includes("none")?(G1.diag.info('OTEL_METRICS_EXPORTER contains "none". Metric provider will not be initialized.'),t):(e.forEach(r=>{if(r==="otlp"){let n=process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),i=zIr("OTEL_METRIC_EXPORT_INTERVAL",6e4),o=zIr("OTEL_METRIC_EXPORT_TIMEOUT",3e4);switch(n){case"grpc":t.push(new CF.PeriodicExportingMetricReader({exporter:new sio.OTLPMetricExporter,exportIntervalMillis:i,exportTimeoutMillis:o}));break;case"http/json":t.push(new CF.PeriodicExportingMetricReader({exporter:new aio.OTLPMetricExporter,exportIntervalMillis:i,exportTimeoutMillis:o}));break;case"http/protobuf":t.push(new CF.PeriodicExportingMetricReader({exporter:new WIr.OTLPMetricExporter,exportIntervalMillis:i,exportTimeoutMillis:o}));break;default:G1.diag.warn(`Unsupported OTLP metrics protocol: "${n}". Using http/protobuf.`),t.push(new CF.PeriodicExportingMetricReader({exporter:new WIr.OTLPMetricExporter,exportIntervalMillis:i,exportTimeoutMillis:o}))}}else r==="console"?t.push(new CF.PeriodicExportingMetricReader({exporter:new CF.ConsoleMetricExporter})):r==="prometheus"?t.push(new cio.PrometheusExporter):G1.diag.warn(`Unsupported OTEL_METRICS_EXPORTER value: "${r}". Supported values are: otlp, console, prometheus, none.`)}),t)):t}var d3t=class{_tracerProviderConfig;_loggerProviderConfig;_meterProviderConfig;_instrumentations;_resource;_resourceDetectors;_autoDetectResources;_tracerProvider;_loggerProvider;_meterProvider;_serviceName;_configuration;_disabled;constructor(e={}){(0,lB.getBooleanFromEnv)("OTEL_SDK_DISABLED")&&(this._disabled=!0);let r=(0,lB.getStringFromEnv)("OTEL_LOG_LEVEL");if(r!=null&&G1.diag.setLogger(new G1.DiagConsoleLogger,{logLevel:(0,lB.diagLogLevelFromString)(r)}),this._configuration=e,this._resource=e.resource??(0,_K.defaultResource)(),this._autoDetectResources=e.autoDetectResources??!0,this._autoDetectResources?e.resourceDetectors!=null?this._resourceDetectors=e.resourceDetectors:(0,lB.getStringFromEnv)("OTEL_NODE_RESOURCE_DETECTORS")?this._resourceDetectors=(0,u3t.getResourceDetectorsFromEnv)():this._resourceDetectors=[_K.envDetector,_K.processDetector,_K.hostDetector]:this._resourceDetectors=[],this._serviceName=e.serviceName,e.traceExporter||e.spanProcessor||e.spanProcessors){let n={};e.sampler&&(n.sampler=e.sampler),e.spanLimits&&(n.spanLimits=e.spanLimits),e.idGenerator&&(n.idGenerator=e.idGenerator),e.spanProcessor&&G1.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");let i=e.spanProcessor??new lio.BatchSpanProcessor(e.traceExporter),o=e.spanProcessors??[i];this._tracerProviderConfig={tracerConfig:n,spanProcessors:o,contextManager:e.contextManager,textMapPropagator:e.textMapPropagator}}if(e.logRecordProcessors?this._loggerProviderConfig={logRecordProcessors:e.logRecordProcessors}:e.logRecordProcessor?(this._loggerProviderConfig={logRecordProcessors:[e.logRecordProcessor]},G1.diag.warn("The 'logRecordProcessor' option is deprecated. Please use 'logRecordProcessors' instead.")):this.configureLoggerProviderFromEnv(),e.metricReaders||e.metricReader||e.views){let n={};e.metricReaders?n.readers=e.metricReaders:e.metricReader&&(n.readers=[e.metricReader],G1.diag.warn("The 'metricReader' option is deprecated. Please use 'metricReaders' instead.")),e.views&&(n.views=e.views),this._meterProviderConfig=n}this._instrumentations=e.instrumentations?.flat()??[]}start(){if(this._disabled)return;if((0,nio.registerInstrumentations)({instrumentations:this._instrumentations}),this._autoDetectResources){let n={detectors:this._resourceDetectors};this._resource=this._resource.merge((0,_K.detectResources)(n))}this._resource=this._serviceName===void 0?this._resource:this._resource.merge((0,_K.resourceFromAttributes)({[dio.ATTR_SERVICE_NAME]:this._serviceName}));let e=this._tracerProviderConfig?this._tracerProviderConfig.spanProcessors:(0,u3t.getSpanProcessorsFromEnv)();if(this._tracerProvider=new uio.NodeTracerProvider({...this._configuration,resource:this._resource,spanProcessors:e}),e.length>0&&this._tracerProvider.register({contextManager:this._tracerProviderConfig?.contextManager??this._configuration?.contextManager,propagator:this._tracerProviderConfig?.textMapPropagator??(0,u3t.getPropagatorFromEnv)()}),this._loggerProviderConfig){let n=new Jfe.LoggerProvider({resource:this._resource,processors:this._loggerProviderConfig.logRecordProcessors});this._loggerProvider=n,rio.logs.setGlobalLoggerProvider(n)}let r=fio();if(this._meterProviderConfig||r.length>0){let n=[];this._meterProviderConfig?.readers&&n.push(...this._meterProviderConfig.readers),n.length===0&&r.forEach(o=>n.push(o));let i=new CF.MeterProvider({resource:this._resource,views:this._meterProviderConfig?.views??[],readers:n});this._meterProvider=i,G1.metrics.setGlobalMeterProvider(i);for(let o of this._instrumentations)o.setMeterProvider(G1.metrics.getMeterProvider())}}shutdown(){let e=[];return this._tracerProvider&&e.push(this._tracerProvider.shutdown()),this._loggerProvider&&e.push(this._loggerProvider.shutdown()),this._meterProvider&&e.push(this._meterProvider.shutdown()),Promise.all(e).then(()=>{})}configureLoggerProviderFromEnv(){let e=(0,lB.getStringListFromEnv)("OTEL_LOGS_EXPORTER")??[];if(e.length===0&&(G1.diag.debug("OTEL_LOGS_EXPORTER is empty. Using default otlp exporter."),e.push("otlp")),e.includes("none")){G1.diag.info('OTEL_LOGS_EXPORTER contains "none". Logger provider will not be initialized.');return}let r=[];e.forEach(n=>{if(n==="otlp"){let i=((0,lB.getStringFromEnv)("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL")??(0,lB.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL"))?.trim();switch(i){case"grpc":r.push(new oio.OTLPLogExporter);break;case"http/json":r.push(new iio.OTLPLogExporter);break;case"http/protobuf":r.push(new l3t.OTLPLogExporter);break;case void 0:case"":r.push(new l3t.OTLPLogExporter);break;default:G1.diag.warn(`Unsupported OTLP logs protocol: "${i}". Using http/protobuf.`),r.push(new l3t.OTLPLogExporter)}}else n==="console"?r.push(new Jfe.ConsoleLogRecordExporter):G1.diag.warn(`Unsupported OTEL_LOGS_EXPORTER value: "${n}". Supported values are: otlp, console, none.`)}),r.length>0&&(this._loggerProviderConfig={logRecordProcessors:r.map(n=>n instanceof Jfe.ConsoleLogRecordExporter?new Jfe.SimpleLogRecordProcessor(n):new Jfe.BatchLogRecordProcessor(n))})}};YIe.NodeSDK=d3t});var KIr=w(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});Jp.NodeSDK=Jp.tracing=Jp.resources=Jp.node=Jp.metrics=Jp.logs=Jp.core=Jp.contextBase=Jp.api=void 0;Jp.api=(Kt(),yt(ar));Jp.contextBase=(Kt(),yt(ar));Jp.core=oi();Jp.logs=Jht();Jp.metrics=Dx();Jp.node=S9e();Jp.resources=mY();Jp.tracing=K9e();var pio=YIr();Object.defineProperty(Jp,"NodeSDK",{enumerable:!0,get:function(){return pio.NodeSDK}})});function hio(t,e){return new Promise((r,n)=>{let i=setTimeout(()=>{n(new Error(`Operation timed out after ${e} ms`))},e);t.then(r).catch(n).finally(()=>clearTimeout(i))})}var JIr,KIe,XIr=Z(()=>{"use strict";JIr=Te(Dx(),1);KIe=class extends JIr.PeriodicExportingMetricReader{_alignSeconds=[0,20,40];_intervalSeconds=20;constructor(e){if(super({...e,exportIntervalMillis:e.exportIntervalMillis??2e4}),(e.exportIntervalMillis??2e4)!==2e4)throw new Error("Aligned reader only supports 20-second intervals for 0/20/40 alignment")}onInitialized(){let e=new Date,r=e.getSeconds(),n=e.getMilliseconds(),i=this._alignSeconds.find(a=>a>=r),o;i!==void 0?o=(i-r)*1e3-n:(o=(60-r)*1e3-n,i=0),o=Math.max(0,o);let s=setTimeout(()=>{this._alignedExport(),this._interval=setInterval(()=>{this._alignedExport()},this._intervalSeconds*1e3);let a=this._interval;typeof a!="number"&&a?.unref&&a.unref()},o);typeof s!="number"&&s?.unref&&s.unref()}async _alignedExport(){let e=this._exportTimeout;try{await hio(this._doCollectAndExport(),e)}catch{}}async _doCollectAndExport(){let e=this._exportTimeout,{resourceMetrics:r,errors:n}=await this.collect({timeoutMillis:e});if(n.length>0,r.resource.asyncAttributesPending)try{await r.resource.waitForAsyncAttributes?.()}catch{}if(r.scopeMetrics.length===0)return;await this._exporter.export(r)}async onShutdown(){let e=this._interval;e&&clearInterval(e),await super.onShutdown()}}});var Xfe=w(uB=>{"use strict";Object.defineProperty(uB,"__esModule",{value:!0});uB.isTracingSuppressed=uB.unsuppressTracing=uB.suppressTracing=void 0;var mio=(Kt(),yt(ar)),f3t=(0,mio.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function gio(t){return t.setValue(f3t,!0)}uB.suppressTracing=gio;function Aio(t){return t.deleteValue(f3t)}uB.unsuppressTracing=Aio;function yio(t){return t.getValue(f3t)===!0}uB.isTracingSuppressed=yio});var p3t=w(m2=>{"use strict";Object.defineProperty(m2,"__esModule",{value:!0});m2.BAGGAGE_MAX_TOTAL_LENGTH=m2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=m2.BAGGAGE_MAX_NAME_VALUE_PAIRS=m2.BAGGAGE_HEADER=m2.BAGGAGE_ITEMS_SEPARATOR=m2.BAGGAGE_PROPERTIES_SEPARATOR=m2.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;m2.BAGGAGE_KEY_PAIR_SEPARATOR="=";m2.BAGGAGE_PROPERTIES_SEPARATOR=";";m2.BAGGAGE_ITEMS_SEPARATOR=",";m2.BAGGAGE_HEADER="baggage";m2.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;m2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;m2.BAGGAGE_MAX_TOTAL_LENGTH=8192});var h3t=w(aS=>{"use strict";Object.defineProperty(aS,"__esModule",{value:!0});aS.parseKeyPairsIntoRecord=aS.parsePairKeyValue=aS.getKeyPairs=aS.serializeKeyPairs=void 0;var Eio=(Kt(),yt(ar)),_F=p3t();function vio(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?_F.BAGGAGE_ITEMS_SEPARATOR:""}${r}`;return n.length>_F.BAGGAGE_MAX_TOTAL_LENGTH?e:n},"")}aS.serializeKeyPairs=vio;function bio(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=_F.BAGGAGE_PROPERTIES_SEPARATOR+r.metadata.toString()),n})}aS.getKeyPairs=bio;function ZIr(t){let e=t.split(_F.BAGGAGE_PROPERTIES_SEPARATOR);if(e.length<=0)return;let r=e.shift();if(!r)return;let n=r.indexOf(_F.BAGGAGE_KEY_PAIR_SEPARATOR);if(n<=0)return;let i=decodeURIComponent(r.substring(0,n).trim()),o=decodeURIComponent(r.substring(n+1).trim()),s;return e.length>0&&(s=(0,Eio.baggageEntryMetadataFromString)(e.join(_F.BAGGAGE_PROPERTIES_SEPARATOR))),{key:i,value:o,metadata:s}}aS.parsePairKeyValue=ZIr;function Cio(t){let e={};return typeof t=="string"&&t.length>0&&t.split(_F.BAGGAGE_ITEMS_SEPARATOR).forEach(r=>{let n=ZIr(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}aS.parseKeyPairsIntoRecord=Cio});var eDr=w(JIe=>{"use strict";Object.defineProperty(JIe,"__esModule",{value:!0});JIe.W3CBaggagePropagator=void 0;var m3t=(Kt(),yt(ar)),_io=Xfe(),xF=p3t(),g3t=h3t(),A3t=class{inject(e,r,n){let i=m3t.propagation.getBaggage(e);if(!i||(0,_io.isTracingSuppressed)(e))return;let o=(0,g3t.getKeyPairs)(i).filter(a=>a.length<=xF.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,xF.BAGGAGE_MAX_NAME_VALUE_PAIRS),s=(0,g3t.serializeKeyPairs)(o);s.length>0&&n.set(r,xF.BAGGAGE_HEADER,s)}extract(e,r,n){let i=n.get(r,xF.BAGGAGE_HEADER),o=Array.isArray(i)?i.join(xF.BAGGAGE_ITEMS_SEPARATOR):i;if(!o)return e;let s={};return o.length===0||(o.split(xF.BAGGAGE_ITEMS_SEPARATOR).forEach(c=>{let u=(0,g3t.parsePairKeyValue)(c);if(u){let d={value:u.value};u.metadata&&(d.metadata=u.metadata),s[u.key]=d}}),Object.entries(s).length===0)?e:m3t.propagation.setBaggage(e,m3t.propagation.createBaggage(s))}fields(){return[xF.BAGGAGE_HEADER]}};JIe.W3CBaggagePropagator=A3t});var tDr=w(XIe=>{"use strict";Object.defineProperty(XIe,"__esModule",{value:!0});XIe.AnchoredClock=void 0;var y3t=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,r){this._monotonicClock=r,this._epochMillis=e.now(),this._performanceMillis=r.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}};XIe.AnchoredClock=y3t});var sDr=w(dB=>{"use strict";Object.defineProperty(dB,"__esModule",{value:!0});dB.isAttributeValue=dB.isAttributeKey=dB.sanitizeAttributes=void 0;var rDr=(Kt(),yt(ar));function xio(t){let e={};if(typeof t!="object"||t==null)return e;for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!nDr(r)){rDr.diag.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!iDr(n)){rDr.diag.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}dB.sanitizeAttributes=xio;function nDr(t){return typeof t=="string"&&t!==""}dB.isAttributeKey=nDr;function iDr(t){return t==null?!0:Array.isArray(t)?Sio(t):oDr(typeof t)}dB.isAttributeValue=iDr;function Sio(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(oDr(n)){e=n;continue}return!1}return!1}}return!0}function oDr(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var E3t=w(ZIe=>{"use strict";Object.defineProperty(ZIe,"__esModule",{value:!0});ZIe.loggingErrorHandler=void 0;var wio=(Kt(),yt(ar));function Tio(){return t=>{wio.diag.error(Iio(t))}}ZIe.loggingErrorHandler=Tio;function Iio(t){return typeof t=="string"?t:JSON.stringify(Dio(t))}function Dio(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let i=r[n];i&&(e[n]=String(i))}),r=Object.getPrototypeOf(r);return e}});var cDr=w(xK=>{"use strict";Object.defineProperty(xK,"__esModule",{value:!0});xK.globalErrorHandler=xK.setGlobalErrorHandler=void 0;var Rio=E3t(),aDr=(0,Rio.loggingErrorHandler)();function Bio(t){aDr=t}xK.setGlobalErrorHandler=Bio;function Nio(t){try{aDr(t)}catch{}}xK.globalErrorHandler=Nio});var fDr=w(cS=>{"use strict";Object.defineProperty(cS,"__esModule",{value:!0});cS.getStringListFromEnv=cS.getBooleanFromEnv=cS.getStringFromEnv=cS.getNumberFromEnv=void 0;var lDr=(Kt(),yt(ar)),uDr=Ae("util");function Oio(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){lDr.diag.warn(`Unknown value ${(0,uDr.inspect)(e)} for ${t}, expected a number, using defaults`);return}return r}cS.getNumberFromEnv=Oio;function dDr(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}cS.getStringFromEnv=dDr;function kio(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||lDr.diag.warn(`Unknown value ${(0,uDr.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}cS.getBooleanFromEnv=kio;function Pio(t){return dDr(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}cS.getStringListFromEnv=Pio});var pDr=w(eDe=>{"use strict";Object.defineProperty(eDe,"__esModule",{value:!0});eDe._globalThis=void 0;eDe._globalThis=typeof globalThis=="object"?globalThis:global});var hDr=w(tDe=>{"use strict";Object.defineProperty(tDe,"__esModule",{value:!0});tDe.otperformance=void 0;var Mio=Ae("perf_hooks");tDe.otperformance=Mio.performance});var mDr=w(rDe=>{"use strict";Object.defineProperty(rDe,"__esModule",{value:!0});rDe.VERSION=void 0;rDe.VERSION="2.2.0"});var gDr=w(nDe=>{"use strict";Object.defineProperty(nDe,"__esModule",{value:!0});nDe.ATTR_PROCESS_RUNTIME_NAME=void 0;nDe.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var ADr=w(oDe=>{"use strict";Object.defineProperty(oDe,"__esModule",{value:!0});oDe.SDK_INFO=void 0;var Lio=mDr(),iDe=(Oh(),yt(u2)),Fio=gDr();oDe.SDK_INFO={[iDe.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[Fio.ATTR_PROCESS_RUNTIME_NAME]:"node",[iDe.ATTR_TELEMETRY_SDK_LANGUAGE]:iDe.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[iDe.ATTR_TELEMETRY_SDK_VERSION]:Lio.VERSION}});var yDr=w(g2=>{"use strict";Object.defineProperty(g2,"__esModule",{value:!0});g2.SDK_INFO=g2.otperformance=g2._globalThis=g2.getStringListFromEnv=g2.getNumberFromEnv=g2.getBooleanFromEnv=g2.getStringFromEnv=void 0;var sDe=fDr();Object.defineProperty(g2,"getStringFromEnv",{enumerable:!0,get:function(){return sDe.getStringFromEnv}});Object.defineProperty(g2,"getBooleanFromEnv",{enumerable:!0,get:function(){return sDe.getBooleanFromEnv}});Object.defineProperty(g2,"getNumberFromEnv",{enumerable:!0,get:function(){return sDe.getNumberFromEnv}});Object.defineProperty(g2,"getStringListFromEnv",{enumerable:!0,get:function(){return sDe.getStringListFromEnv}});var Uio=pDr();Object.defineProperty(g2,"_globalThis",{enumerable:!0,get:function(){return Uio._globalThis}});var Qio=hDr();Object.defineProperty(g2,"otperformance",{enumerable:!0,get:function(){return Qio.otperformance}});var qio=ADr();Object.defineProperty(g2,"SDK_INFO",{enumerable:!0,get:function(){return qio.SDK_INFO}})});var v3t=w(A2=>{"use strict";Object.defineProperty(A2,"__esModule",{value:!0});A2.getStringListFromEnv=A2.getNumberFromEnv=A2.getStringFromEnv=A2.getBooleanFromEnv=A2.otperformance=A2._globalThis=A2.SDK_INFO=void 0;var SF=yDr();Object.defineProperty(A2,"SDK_INFO",{enumerable:!0,get:function(){return SF.SDK_INFO}});Object.defineProperty(A2,"_globalThis",{enumerable:!0,get:function(){return SF._globalThis}});Object.defineProperty(A2,"otperformance",{enumerable:!0,get:function(){return SF.otperformance}});Object.defineProperty(A2,"getBooleanFromEnv",{enumerable:!0,get:function(){return SF.getBooleanFromEnv}});Object.defineProperty(A2,"getStringFromEnv",{enumerable:!0,get:function(){return SF.getStringFromEnv}});Object.defineProperty(A2,"getNumberFromEnv",{enumerable:!0,get:function(){return SF.getNumberFromEnv}});Object.defineProperty(A2,"getStringListFromEnv",{enumerable:!0,get:function(){return SF.getStringListFromEnv}})});var CDr=w(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.addHrTimes=hu.isTimeInput=hu.isTimeInputHrTime=hu.hrTimeToMicroseconds=hu.hrTimeToMilliseconds=hu.hrTimeToNanoseconds=hu.hrTimeToTimeStamp=hu.hrTimeDuration=hu.timeInputToHrTime=hu.hrTime=hu.getTimeOrigin=hu.millisToHrTime=void 0;var b3t=v3t(),EDr=9,Hio=6,Gio=Math.pow(10,Hio),aDe=Math.pow(10,EDr);function Zfe(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*Gio);return[r,n]}hu.millisToHrTime=Zfe;function C3t(){let t=b3t.otperformance.timeOrigin;if(typeof t!="number"){let e=b3t.otperformance;t=e.timing&&e.timing.fetchStart}return t}hu.getTimeOrigin=C3t;function vDr(t){let e=Zfe(C3t()),r=Zfe(typeof t=="number"?t:b3t.otperformance.now());return bDr(e,r)}hu.hrTime=vDr;function jio(t){if(_3t(t))return t;if(typeof t=="number")return t<C3t()?vDr(t):Zfe(t);if(t instanceof Date)return Zfe(t.getTime());throw TypeError("Invalid input type")}hu.timeInputToHrTime=jio;function Vio(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=aDe),[r,n]}hu.hrTimeDuration=Vio;function $io(t){let e=EDr,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}hu.hrTimeToTimeStamp=$io;function Wio(t){return t[0]*aDe+t[1]}hu.hrTimeToNanoseconds=Wio;function zio(t){return t[0]*1e3+t[1]/1e6}hu.hrTimeToMilliseconds=zio;function Yio(t){return t[0]*1e6+t[1]/1e3}hu.hrTimeToMicroseconds=Yio;function _3t(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}hu.isTimeInputHrTime=_3t;function Kio(t){return _3t(t)||typeof t=="number"||t instanceof Date}hu.isTimeInput=Kio;function bDr(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=aDe&&(r[1]-=aDe,r[0]+=1),r}hu.addHrTimes=bDr});var _Dr=w(cDe=>{"use strict";Object.defineProperty(cDe,"__esModule",{value:!0});cDe.unrefTimer=void 0;function Jio(t){typeof t!="number"&&t.unref()}cDe.unrefTimer=Jio});var xDr=w(epe=>{"use strict";Object.defineProperty(epe,"__esModule",{value:!0});epe.ExportResultCode=void 0;var Xio;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(Xio=epe.ExportResultCode||(epe.ExportResultCode={}))});var wDr=w(lDe=>{"use strict";Object.defineProperty(lDe,"__esModule",{value:!0});lDe.CompositePropagator=void 0;var SDr=(Kt(),yt(ar)),x3t=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(e,r,n){for(let i of this._propagators)try{i.inject(e,r,n)}catch(o){SDr.diag.warn(`Failed to inject with ${i.constructor.name}. Err: ${o.message}`)}}extract(e,r,n){return this._propagators.reduce((i,o)=>{try{return o.extract(i,r,n)}catch(s){SDr.diag.warn(`Failed to extract with ${o.constructor.name}. Err: ${s.message}`)}return i},e)}fields(){return this._fields.slice()}};lDe.CompositePropagator=x3t});var TDr=w(SK=>{"use strict";Object.defineProperty(SK,"__esModule",{value:!0});SK.validateValue=SK.validateKey=void 0;var S3t="[_0-9a-z-*/]",Zio=`[a-z]${S3t}{0,255}`,eoo=`[a-z0-9]${S3t}{0,240}@[a-z]${S3t}{0,13}`,too=new RegExp(`^(?:${Zio}|${eoo})$`),roo=/^[ -~]{0,255}[!-~]$/,noo=/,|=/;function ioo(t){return too.test(t)}SK.validateKey=ioo;function ooo(t){return roo.test(t)&&!noo.test(t)}SK.validateValue=ooo});var T3t=w(uDe=>{"use strict";Object.defineProperty(uDe,"__esModule",{value:!0});uDe.TraceState=void 0;var IDr=TDr(),DDr=32,soo=512,RDr=",",BDr="=",w3t=class t{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,r){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n}unset(e){let r=this._clone();return r._internalState.delete(e),r}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,r)=>(e.push(r+BDr+this.get(r)),e),[]).join(RDr)}_parse(e){e.length>soo||(this._internalState=e.split(RDr).reverse().reduce((r,n)=>{let i=n.trim(),o=i.indexOf(BDr);if(o!==-1){let s=i.slice(0,o),a=i.slice(o+1,n.length);(0,IDr.validateKey)(s)&&(0,IDr.validateValue)(a)&&r.set(s,a)}return r},new Map),this._internalState.size>DDr&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,DDr))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};uDe.TraceState=w3t});var ODr=w(y2=>{"use strict";Object.defineProperty(y2,"__esModule",{value:!0});y2.W3CTraceContextPropagator=y2.parseTraceParent=y2.TRACE_STATE_HEADER=y2.TRACE_PARENT_HEADER=void 0;var dDe=(Kt(),yt(ar)),aoo=Xfe(),coo=T3t();y2.TRACE_PARENT_HEADER="traceparent";y2.TRACE_STATE_HEADER="tracestate";var loo="00",uoo="(?!ff)[\\da-f]{2}",doo="(?![0]{32})[\\da-f]{32}",foo="(?![0]{16})[\\da-f]{16}",poo="[\\da-f]{2}",hoo=new RegExp(`^\\s?(${uoo})-(${doo})-(${foo})-(${poo})(-.*)?\\s?$`);function NDr(t){let e=hoo.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}y2.parseTraceParent=NDr;var I3t=class{inject(e,r,n){let i=dDe.trace.getSpanContext(e);if(!i||(0,aoo.isTracingSuppressed)(e)||!(0,dDe.isSpanContextValid)(i))return;let o=`${loo}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||dDe.TraceFlags.NONE).toString(16)}`;n.set(r,y2.TRACE_PARENT_HEADER,o),i.traceState&&n.set(r,y2.TRACE_STATE_HEADER,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,y2.TRACE_PARENT_HEADER);if(!i)return e;let o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;let s=NDr(o);if(!s)return e;s.isRemote=!0;let a=n.get(r,y2.TRACE_STATE_HEADER);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new coo.TraceState(typeof c=="string"?c:void 0)}return dDe.trace.setSpanContext(e,s)}fields(){return[y2.TRACE_PARENT_HEADER,y2.TRACE_STATE_HEADER]}};y2.W3CTraceContextPropagator=I3t});var kDr=w(KC=>{"use strict";Object.defineProperty(KC,"__esModule",{value:!0});KC.getRPCMetadata=KC.deleteRPCMetadata=KC.setRPCMetadata=KC.RPCType=void 0;var moo=(Kt(),yt(ar)),D3t=(0,moo.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),goo;(function(t){t.HTTP="http"})(goo=KC.RPCType||(KC.RPCType={}));function Aoo(t,e){return t.setValue(D3t,e)}KC.setRPCMetadata=Aoo;function yoo(t){return t.deleteValue(D3t)}KC.deleteRPCMetadata=yoo;function Eoo(t){return t.getValue(D3t)}KC.getRPCMetadata=Eoo});var UDr=w(fDe=>{"use strict";Object.defineProperty(fDe,"__esModule",{value:!0});fDe.isPlainObject=void 0;var voo="[object Object]",boo="[object Null]",Coo="[object Undefined]",_oo=Function.prototype,PDr=_oo.toString,xoo=PDr.call(Object),Soo=Object.getPrototypeOf,MDr=Object.prototype,LDr=MDr.hasOwnProperty,wF=Symbol?Symbol.toStringTag:void 0,FDr=MDr.toString;function woo(t){if(!Too(t)||Ioo(t)!==voo)return!1;let e=Soo(t);if(e===null)return!0;let r=LDr.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&PDr.call(r)===xoo}fDe.isPlainObject=woo;function Too(t){return t!=null&&typeof t=="object"}function Ioo(t){return t==null?t===void 0?Coo:boo:wF&&wF in Object(t)?Doo(t):Roo(t)}function Doo(t){let e=LDr.call(t,wF),r=t[wF],n=!1;try{t[wF]=void 0,n=!0}catch{}let i=FDr.call(t);return n&&(e?t[wF]=r:delete t[wF]),i}function Roo(t){return FDr.call(t)}});var jDr=w(mDe=>{"use strict";Object.defineProperty(mDe,"__esModule",{value:!0});mDe.merge=void 0;var QDr=UDr(),Boo=20;function Noo(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=HDr(e,t.shift(),0,r);return e}mDe.merge=Noo;function R3t(t){return hDe(t)?t.slice():t}function HDr(t,e,r=0,n){let i;if(!(r>Boo)){if(r++,pDe(t)||pDe(e)||GDr(e))i=R3t(e);else if(hDe(t)){if(i=t.slice(),hDe(e))for(let o=0,s=e.length;o<s;o++)i.push(R3t(e[o]));else if(tpe(e)){let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s];i[c]=R3t(e[c])}}}else if(tpe(t))if(tpe(e)){if(!Ooo(t,e))return e;i=Object.assign({},t);let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s],u=e[c];if(pDe(u))typeof u>"u"?delete i[c]:i[c]=u;else{let d=i[c],f=u;if(qDr(t,c,n)||qDr(e,c,n))delete i[c];else{if(tpe(d)&&tpe(f)){let p=n.get(d)||[],h=n.get(f)||[];p.push({obj:t,key:c}),h.push({obj:e,key:c}),n.set(d,p),n.set(f,h)}i[c]=HDr(i[c],u,r,n)}}}}else i=e;return i}}function qDr(t,e,r){let n=r.get(t[e])||[];for(let i=0,o=n.length;i<o;i++){let s=n[i];if(s.key===e&&s.obj===t)return!0}return!1}function hDe(t){return Array.isArray(t)}function GDr(t){return typeof t=="function"}function tpe(t){return!pDe(t)&&!hDe(t)&&!GDr(t)&&typeof t=="object"}function pDe(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function Ooo(t,e){return!(!(0,QDr.isPlainObject)(t)||!(0,QDr.isPlainObject)(e))}});var VDr=w(wK=>{"use strict";Object.defineProperty(wK,"__esModule",{value:!0});wK.callWithTimeout=wK.TimeoutError=void 0;var gDe=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};wK.TimeoutError=gDe;function koo(t,e){let r,n=new Promise(function(o,s){r=setTimeout(function(){s(new gDe("Operation timed out."))},e)});return Promise.race([t,n]).then(i=>(clearTimeout(r),i),i=>{throw clearTimeout(r),i})}wK.callWithTimeout=koo});var WDr=w(TK=>{"use strict";Object.defineProperty(TK,"__esModule",{value:!0});TK.isUrlIgnored=TK.urlMatches=void 0;function $Dr(t,e){return typeof e=="string"?t===e:!!t.match(e)}TK.urlMatches=$Dr;function Poo(t,e){if(!e)return!1;for(let r of e)if($Dr(t,r))return!0;return!1}TK.isUrlIgnored=Poo});var zDr=w(ADe=>{"use strict";Object.defineProperty(ADe,"__esModule",{value:!0});ADe.Deferred=void 0;var B3t=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};ADe.Deferred=B3t});var YDr=w(yDe=>{"use strict";Object.defineProperty(yDe,"__esModule",{value:!0});yDe.BindOnceFuture=void 0;var Moo=zDr(),N3t=class{_callback;_that;_isCalled=!1;_deferred=new Moo.Deferred;constructor(e,r){this._callback=e,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};yDe.BindOnceFuture=N3t});var JDr=w(EDe=>{"use strict";Object.defineProperty(EDe,"__esModule",{value:!0});EDe.diagLogLevelFromString=void 0;var dT=(Kt(),yt(ar)),KDr={ALL:dT.DiagLogLevel.ALL,VERBOSE:dT.DiagLogLevel.VERBOSE,DEBUG:dT.DiagLogLevel.DEBUG,INFO:dT.DiagLogLevel.INFO,WARN:dT.DiagLogLevel.WARN,ERROR:dT.DiagLogLevel.ERROR,NONE:dT.DiagLogLevel.NONE};function Loo(t){if(t==null)return;let e=KDr[t.toUpperCase()];return e??(dT.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(KDr)}, using default`),dT.DiagLogLevel.INFO)}EDe.diagLogLevelFromString=Loo});var ZDr=w(vDe=>{"use strict";Object.defineProperty(vDe,"__esModule",{value:!0});vDe._export=void 0;var XDr=(Kt(),yt(ar)),Foo=Xfe();function Uoo(t,e){return new Promise(r=>{XDr.context.with((0,Foo.suppressTracing)(XDr.context.active()),()=>{t.export(e,n=>{r(n)})})})}vDe._export=Uoo});var k3t=w(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.internal=Mr.diagLogLevelFromString=Mr.BindOnceFuture=Mr.urlMatches=Mr.isUrlIgnored=Mr.callWithTimeout=Mr.TimeoutError=Mr.merge=Mr.TraceState=Mr.unsuppressTracing=Mr.suppressTracing=Mr.isTracingSuppressed=Mr.setRPCMetadata=Mr.getRPCMetadata=Mr.deleteRPCMetadata=Mr.RPCType=Mr.parseTraceParent=Mr.W3CTraceContextPropagator=Mr.TRACE_STATE_HEADER=Mr.TRACE_PARENT_HEADER=Mr.CompositePropagator=Mr.otperformance=Mr.getStringListFromEnv=Mr.getNumberFromEnv=Mr.getBooleanFromEnv=Mr.getStringFromEnv=Mr._globalThis=Mr.SDK_INFO=Mr.parseKeyPairsIntoRecord=Mr.ExportResultCode=Mr.unrefTimer=Mr.timeInputToHrTime=Mr.millisToHrTime=Mr.isTimeInputHrTime=Mr.isTimeInput=Mr.hrTimeToTimeStamp=Mr.hrTimeToNanoseconds=Mr.hrTimeToMilliseconds=Mr.hrTimeToMicroseconds=Mr.hrTimeDuration=Mr.hrTime=Mr.getTimeOrigin=Mr.addHrTimes=Mr.loggingErrorHandler=Mr.setGlobalErrorHandler=Mr.globalErrorHandler=Mr.sanitizeAttributes=Mr.isAttributeValue=Mr.AnchoredClock=Mr.W3CBaggagePropagator=void 0;var Qoo=eDr();Object.defineProperty(Mr,"W3CBaggagePropagator",{enumerable:!0,get:function(){return Qoo.W3CBaggagePropagator}});var qoo=tDr();Object.defineProperty(Mr,"AnchoredClock",{enumerable:!0,get:function(){return qoo.AnchoredClock}});var eRr=sDr();Object.defineProperty(Mr,"isAttributeValue",{enumerable:!0,get:function(){return eRr.isAttributeValue}});Object.defineProperty(Mr,"sanitizeAttributes",{enumerable:!0,get:function(){return eRr.sanitizeAttributes}});var tRr=cDr();Object.defineProperty(Mr,"globalErrorHandler",{enumerable:!0,get:function(){return tRr.globalErrorHandler}});Object.defineProperty(Mr,"setGlobalErrorHandler",{enumerable:!0,get:function(){return tRr.setGlobalErrorHandler}});var Hoo=E3t();Object.defineProperty(Mr,"loggingErrorHandler",{enumerable:!0,get:function(){return Hoo.loggingErrorHandler}});var qv=CDr();Object.defineProperty(Mr,"addHrTimes",{enumerable:!0,get:function(){return qv.addHrTimes}});Object.defineProperty(Mr,"getTimeOrigin",{enumerable:!0,get:function(){return qv.getTimeOrigin}});Object.defineProperty(Mr,"hrTime",{enumerable:!0,get:function(){return qv.hrTime}});Object.defineProperty(Mr,"hrTimeDuration",{enumerable:!0,get:function(){return qv.hrTimeDuration}});Object.defineProperty(Mr,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return qv.hrTimeToMicroseconds}});Object.defineProperty(Mr,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return qv.hrTimeToMilliseconds}});Object.defineProperty(Mr,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return qv.hrTimeToNanoseconds}});Object.defineProperty(Mr,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return qv.hrTimeToTimeStamp}});Object.defineProperty(Mr,"isTimeInput",{enumerable:!0,get:function(){return qv.isTimeInput}});Object.defineProperty(Mr,"isTimeInputHrTime",{enumerable:!0,get:function(){return qv.isTimeInputHrTime}});Object.defineProperty(Mr,"millisToHrTime",{enumerable:!0,get:function(){return qv.millisToHrTime}});Object.defineProperty(Mr,"timeInputToHrTime",{enumerable:!0,get:function(){return qv.timeInputToHrTime}});var Goo=_Dr();Object.defineProperty(Mr,"unrefTimer",{enumerable:!0,get:function(){return Goo.unrefTimer}});var joo=xDr();Object.defineProperty(Mr,"ExportResultCode",{enumerable:!0,get:function(){return joo.ExportResultCode}});var Voo=h3t();Object.defineProperty(Mr,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return Voo.parseKeyPairsIntoRecord}});var TF=v3t();Object.defineProperty(Mr,"SDK_INFO",{enumerable:!0,get:function(){return TF.SDK_INFO}});Object.defineProperty(Mr,"_globalThis",{enumerable:!0,get:function(){return TF._globalThis}});Object.defineProperty(Mr,"getStringFromEnv",{enumerable:!0,get:function(){return TF.getStringFromEnv}});Object.defineProperty(Mr,"getBooleanFromEnv",{enumerable:!0,get:function(){return TF.getBooleanFromEnv}});Object.defineProperty(Mr,"getNumberFromEnv",{enumerable:!0,get:function(){return TF.getNumberFromEnv}});Object.defineProperty(Mr,"getStringListFromEnv",{enumerable:!0,get:function(){return TF.getStringListFromEnv}});Object.defineProperty(Mr,"otperformance",{enumerable:!0,get:function(){return TF.otperformance}});var $oo=wDr();Object.defineProperty(Mr,"CompositePropagator",{enumerable:!0,get:function(){return $oo.CompositePropagator}});var bDe=ODr();Object.defineProperty(Mr,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return bDe.TRACE_PARENT_HEADER}});Object.defineProperty(Mr,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return bDe.TRACE_STATE_HEADER}});Object.defineProperty(Mr,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return bDe.W3CTraceContextPropagator}});Object.defineProperty(Mr,"parseTraceParent",{enumerable:!0,get:function(){return bDe.parseTraceParent}});var CDe=kDr();Object.defineProperty(Mr,"RPCType",{enumerable:!0,get:function(){return CDe.RPCType}});Object.defineProperty(Mr,"deleteRPCMetadata",{enumerable:!0,get:function(){return CDe.deleteRPCMetadata}});Object.defineProperty(Mr,"getRPCMetadata",{enumerable:!0,get:function(){return CDe.getRPCMetadata}});Object.defineProperty(Mr,"setRPCMetadata",{enumerable:!0,get:function(){return CDe.setRPCMetadata}});var O3t=Xfe();Object.defineProperty(Mr,"isTracingSuppressed",{enumerable:!0,get:function(){return O3t.isTracingSuppressed}});Object.defineProperty(Mr,"suppressTracing",{enumerable:!0,get:function(){return O3t.suppressTracing}});Object.defineProperty(Mr,"unsuppressTracing",{enumerable:!0,get:function(){return O3t.unsuppressTracing}});var Woo=T3t();Object.defineProperty(Mr,"TraceState",{enumerable:!0,get:function(){return Woo.TraceState}});var zoo=jDr();Object.defineProperty(Mr,"merge",{enumerable:!0,get:function(){return zoo.merge}});var rRr=VDr();Object.defineProperty(Mr,"TimeoutError",{enumerable:!0,get:function(){return rRr.TimeoutError}});Object.defineProperty(Mr,"callWithTimeout",{enumerable:!0,get:function(){return rRr.callWithTimeout}});var nRr=WDr();Object.defineProperty(Mr,"isUrlIgnored",{enumerable:!0,get:function(){return nRr.isUrlIgnored}});Object.defineProperty(Mr,"urlMatches",{enumerable:!0,get:function(){return nRr.urlMatches}});var Yoo=YDr();Object.defineProperty(Mr,"BindOnceFuture",{enumerable:!0,get:function(){return Yoo.BindOnceFuture}});var Koo=JDr();Object.defineProperty(Mr,"diagLogLevelFromString",{enumerable:!0,get:function(){return Koo.diagLogLevelFromString}});var Joo=ZDr();Mr.internal={_export:Joo._export}});var iRr=w(_De=>{"use strict";Object.defineProperty(_De,"__esModule",{value:!0});_De.defaultServiceName=void 0;function Xoo(){return`unknown_service:${process.argv0}`}_De.defaultServiceName=Xoo});var oRr=w(xDe=>{"use strict";Object.defineProperty(xDe,"__esModule",{value:!0});xDe.defaultServiceName=void 0;var Zoo=iRr();Object.defineProperty(xDe,"defaultServiceName",{enumerable:!0,get:function(){return Zoo.defaultServiceName}})});var P3t=w(SDe=>{"use strict";Object.defineProperty(SDe,"__esModule",{value:!0});SDe.defaultServiceName=void 0;var eso=oRr();Object.defineProperty(SDe,"defaultServiceName",{enumerable:!0,get:function(){return eso.defaultServiceName}})});var sRr=w(IK=>{"use strict";Object.defineProperty(IK,"__esModule",{value:!0});IK.identity=IK.isPromiseLike=void 0;var tso=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";IK.isPromiseLike=tso;function rso(t){return t}IK.identity=rso});var F3t=w(lS=>{"use strict";Object.defineProperty(lS,"__esModule",{value:!0});lS.defaultResource=lS.emptyResource=lS.resourceFromDetectedResource=lS.resourceFromAttributes=void 0;var npe=(Kt(),yt(ar)),M3t=k3t(),IF=(Oh(),yt(u2)),nso=P3t(),rpe=sRr(),wDe=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=aRr(e),n._asyncAttributesPending=e.filter(([i,o])=>(0,rpe.isPromiseLike)(o)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([i,o])=>((0,rpe.isPromiseLike)(o)&&(this._asyncAttributesPending=!0),[i,o])),this._rawAttributes=aRr(this._rawAttributes),this._schemaUrl=aso(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[r,n]=this._rawAttributes[e];this._rawAttributes[e]=[r,(0,rpe.isPromiseLike)(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&npe.diag.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[r,n]of this._rawAttributes){if((0,rpe.isPromiseLike)(n)){npe.diag.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(e[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let r=cso(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function L3t(t,e){return wDe.FromAttributeList(Object.entries(t),e)}lS.resourceFromAttributes=L3t;function iso(t,e){return new wDe(t,e)}lS.resourceFromDetectedResource=iso;function oso(){return L3t({})}lS.emptyResource=oso;function sso(){return L3t({[IF.ATTR_SERVICE_NAME]:(0,nso.defaultServiceName)(),[IF.ATTR_TELEMETRY_SDK_LANGUAGE]:M3t.SDK_INFO[IF.ATTR_TELEMETRY_SDK_LANGUAGE],[IF.ATTR_TELEMETRY_SDK_NAME]:M3t.SDK_INFO[IF.ATTR_TELEMETRY_SDK_NAME],[IF.ATTR_TELEMETRY_SDK_VERSION]:M3t.SDK_INFO[IF.ATTR_TELEMETRY_SDK_VERSION]})}lS.defaultResource=sso;function aRr(t){return t.map(([e,r])=>(0,rpe.isPromiseLike)(r)?[e,r.catch(n=>{npe.diag.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function aso(t){if(typeof t=="string"||t===void 0)return t;npe.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function cso(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,i=r===void 0||r==="",o=n===void 0||n==="";if(i)return n;if(o||r===n)return r;npe.diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}});var lRr=w(TDe=>{"use strict";Object.defineProperty(TDe,"__esModule",{value:!0});TDe.detectResources=void 0;var cRr=(Kt(),yt(ar)),U3t=F3t(),lso=(t={})=>(t.detectors||[]).map(r=>{try{let n=(0,U3t.resourceFromDetectedResource)(r.detect(t));return cRr.diag.debug(`${r.constructor.name} found resource.`,n),n}catch(n){return cRr.diag.debug(`${r.constructor.name} failed: ${n.message}`),(0,U3t.emptyResource)()}}).reduce((r,n)=>r.merge(n),(0,U3t.emptyResource)());TDe.detectResources=lso});var dRr=w(IDe=>{"use strict";Object.defineProperty(IDe,"__esModule",{value:!0});IDe.envDetector=void 0;var uso=(Kt(),yt(ar)),dso=(Oh(),yt(u2)),uRr=k3t(),Q3t=class{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";_ERROR_MESSAGE_INVALID_CHARS="should be a ASCII string with a length greater than 0 and not exceed "+this._MAX_LENGTH+" characters.";_ERROR_MESSAGE_INVALID_VALUE="should be a ASCII string with a length not exceed "+this._MAX_LENGTH+" characters.";detect(e){let r={},n=(0,uRr.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES"),i=(0,uRr.getStringFromEnv)("OTEL_SERVICE_NAME");if(n)try{let o=this._parseResourceAttributes(n);Object.assign(r,o)}catch(o){uso.diag.debug(`EnvDetector failed: ${o.message}`)}return i&&(r[dso.ATTR_SERVICE_NAME]=i),{attributes:r}}_parseResourceAttributes(e){if(!e)return{};let r={},n=e.split(this._COMMA_SEPARATOR,-1);for(let i of n){let o=i.split(this._LABEL_KEY_VALUE_SPLITTER,-1);if(o.length!==2)continue;let[s,a]=o;if(s=s.trim(),a=a.trim().split(/^"|"$/).join(""),!this._isValidAndNotEmpty(s))throw new Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);if(!this._isValid(a))throw new Error(`Attribute value ${this._ERROR_MESSAGE_INVALID_VALUE}`);r[s]=decodeURIComponent(a)}return r}_isValid(e){return e.length<=this._MAX_LENGTH&&this._isBaggageOctetString(e)}_isBaggageOctetString(e){for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n<33||n===44||n===59||n===92||n>126)return!1}return!0}_isValidAndNotEmpty(e){return e.length>0&&this._isValid(e)}};IDe.envDetector=new Q3t});var ipe=w(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.ATTR_WEBENGINE_VERSION=Bn.ATTR_WEBENGINE_NAME=Bn.ATTR_WEBENGINE_DESCRIPTION=Bn.ATTR_SERVICE_NAMESPACE=Bn.ATTR_SERVICE_INSTANCE_ID=Bn.ATTR_PROCESS_RUNTIME_VERSION=Bn.ATTR_PROCESS_RUNTIME_NAME=Bn.ATTR_PROCESS_RUNTIME_DESCRIPTION=Bn.ATTR_PROCESS_PID=Bn.ATTR_PROCESS_OWNER=Bn.ATTR_PROCESS_EXECUTABLE_PATH=Bn.ATTR_PROCESS_EXECUTABLE_NAME=Bn.ATTR_PROCESS_COMMAND_ARGS=Bn.ATTR_PROCESS_COMMAND=Bn.ATTR_OS_VERSION=Bn.ATTR_OS_TYPE=Bn.ATTR_K8S_POD_NAME=Bn.ATTR_K8S_NAMESPACE_NAME=Bn.ATTR_K8S_DEPLOYMENT_NAME=Bn.ATTR_K8S_CLUSTER_NAME=Bn.ATTR_HOST_TYPE=Bn.ATTR_HOST_NAME=Bn.ATTR_HOST_IMAGE_VERSION=Bn.ATTR_HOST_IMAGE_NAME=Bn.ATTR_HOST_IMAGE_ID=Bn.ATTR_HOST_ID=Bn.ATTR_HOST_ARCH=Bn.ATTR_CONTAINER_NAME=Bn.ATTR_CONTAINER_IMAGE_TAGS=Bn.ATTR_CONTAINER_IMAGE_NAME=Bn.ATTR_CONTAINER_ID=Bn.ATTR_CLOUD_REGION=Bn.ATTR_CLOUD_PROVIDER=Bn.ATTR_CLOUD_AVAILABILITY_ZONE=Bn.ATTR_CLOUD_ACCOUNT_ID=void 0;Bn.ATTR_CLOUD_ACCOUNT_ID="cloud.account.id";Bn.ATTR_CLOUD_AVAILABILITY_ZONE="cloud.availability_zone";Bn.ATTR_CLOUD_PROVIDER="cloud.provider";Bn.ATTR_CLOUD_REGION="cloud.region";Bn.ATTR_CONTAINER_ID="container.id";Bn.ATTR_CONTAINER_IMAGE_NAME="container.image.name";Bn.ATTR_CONTAINER_IMAGE_TAGS="container.image.tags";Bn.ATTR_CONTAINER_NAME="container.name";Bn.ATTR_HOST_ARCH="host.arch";Bn.ATTR_HOST_ID="host.id";Bn.ATTR_HOST_IMAGE_ID="host.image.id";Bn.ATTR_HOST_IMAGE_NAME="host.image.name";Bn.ATTR_HOST_IMAGE_VERSION="host.image.version";Bn.ATTR_HOST_NAME="host.name";Bn.ATTR_HOST_TYPE="host.type";Bn.ATTR_K8S_CLUSTER_NAME="k8s.cluster.name";Bn.ATTR_K8S_DEPLOYMENT_NAME="k8s.deployment.name";Bn.ATTR_K8S_NAMESPACE_NAME="k8s.namespace.name";Bn.ATTR_K8S_POD_NAME="k8s.pod.name";Bn.ATTR_OS_TYPE="os.type";Bn.ATTR_OS_VERSION="os.version";Bn.ATTR_PROCESS_COMMAND="process.command";Bn.ATTR_PROCESS_COMMAND_ARGS="process.command_args";Bn.ATTR_PROCESS_EXECUTABLE_NAME="process.executable.name";Bn.ATTR_PROCESS_EXECUTABLE_PATH="process.executable.path";Bn.ATTR_PROCESS_OWNER="process.owner";Bn.ATTR_PROCESS_PID="process.pid";Bn.ATTR_PROCESS_RUNTIME_DESCRIPTION="process.runtime.description";Bn.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name";Bn.ATTR_PROCESS_RUNTIME_VERSION="process.runtime.version";Bn.ATTR_SERVICE_INSTANCE_ID="service.instance.id";Bn.ATTR_SERVICE_NAMESPACE="service.namespace";Bn.ATTR_WEBENGINE_DESCRIPTION="webengine.description";Bn.ATTR_WEBENGINE_NAME="webengine.name";Bn.ATTR_WEBENGINE_VERSION="webengine.version"});var RDe=w(DDe=>{"use strict";Object.defineProperty(DDe,"__esModule",{value:!0});DDe.execAsync=void 0;var fso=Ae("child_process"),pso=Ae("util");DDe.execAsync=pso.promisify(fso.exec)});var fRr=w(BDe=>{"use strict";Object.defineProperty(BDe,"__esModule",{value:!0});BDe.getMachineId=void 0;var hso=RDe(),mso=(Kt(),yt(ar));async function gso(){try{let e=(await(0,hso.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
|
|
449
|
-
`).find(n=>n.includes("IOPlatformUUID"));if(!e)return;let r=e.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(t){mso.diag.debug(`error reading machine id: ${t}`)}}BDe.getMachineId=gso});var pRr=w(NDe=>{"use strict";Object.defineProperty(NDe,"__esModule",{value:!0});NDe.getMachineId=void 0;var Aso=Ae("fs"),yso=(Kt(),yt(ar));async function Eso(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await Aso.promises.readFile(e,{encoding:"utf8"})).trim()}catch(r){yso.diag.debug(`error reading machine id: ${r}`)}}NDe.getMachineId=Eso});var mRr=w(ODe=>{"use strict";Object.defineProperty(ODe,"__esModule",{value:!0});ODe.getMachineId=void 0;var vso=Ae("fs"),bso=RDe(),hRr=(Kt(),yt(ar));async function Cso(){try{return(await vso.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){hRr.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,bso.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){hRr.diag.debug(`error reading machine id: ${t}`)}}ODe.getMachineId=Cso});var ARr=w(kDe=>{"use strict";Object.defineProperty(kDe,"__esModule",{value:!0});kDe.getMachineId=void 0;var gRr=Ae("process"),_so=RDe(),xso=(Kt(),yt(ar));async function Sso(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";gRr.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in gRr.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let n=(await(0,_so.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(n.length===2)return n[1].trim()}catch(r){xso.diag.debug(`error reading machine id: ${r}`)}}kDe.getMachineId=Sso});var yRr=w(PDe=>{"use strict";Object.defineProperty(PDe,"__esModule",{value:!0});PDe.getMachineId=void 0;var wso=(Kt(),yt(ar));async function Tso(){wso.diag.debug("could not read machine-id: unsupported platform")}PDe.getMachineId=Tso});var ERr=w(MDe=>{"use strict";Object.defineProperty(MDe,"__esModule",{value:!0});MDe.getMachineId=void 0;var Iso=Ae("process"),DF;async function Dso(){if(!DF)switch(Iso.platform){case"darwin":DF=(await Promise.resolve().then(()=>Te(fRr()))).getMachineId;break;case"linux":DF=(await Promise.resolve().then(()=>Te(pRr()))).getMachineId;break;case"freebsd":DF=(await Promise.resolve().then(()=>Te(mRr()))).getMachineId;break;case"win32":DF=(await Promise.resolve().then(()=>Te(ARr()))).getMachineId;break;default:DF=(await Promise.resolve().then(()=>Te(yRr()))).getMachineId;break}return DF()}MDe.getMachineId=Dso});var q3t=w(DK=>{"use strict";Object.defineProperty(DK,"__esModule",{value:!0});DK.normalizeType=DK.normalizeArch=void 0;var Rso=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};DK.normalizeArch=Rso;var Bso=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};DK.normalizeType=Bso});var bRr=w(LDe=>{"use strict";Object.defineProperty(LDe,"__esModule",{value:!0});LDe.hostDetector=void 0;var H3t=ipe(),vRr=Ae("os"),Nso=ERr(),Oso=q3t(),G3t=class{detect(e){return{attributes:{[H3t.ATTR_HOST_NAME]:(0,vRr.hostname)(),[H3t.ATTR_HOST_ARCH]:(0,Oso.normalizeArch)((0,vRr.arch)()),[H3t.ATTR_HOST_ID]:(0,Nso.getMachineId)()}}}};LDe.hostDetector=new G3t});var xRr=w(FDe=>{"use strict";Object.defineProperty(FDe,"__esModule",{value:!0});FDe.osDetector=void 0;var CRr=ipe(),_Rr=Ae("os"),kso=q3t(),j3t=class{detect(e){return{attributes:{[CRr.ATTR_OS_TYPE]:(0,kso.normalizeType)((0,_Rr.platform)()),[CRr.ATTR_OS_VERSION]:(0,_Rr.release)()}}}};FDe.osDetector=new j3t});var SRr=w(UDe=>{"use strict";Object.defineProperty(UDe,"__esModule",{value:!0});UDe.processDetector=void 0;var Pso=(Kt(),yt(ar)),fT=ipe(),Mso=Ae("os"),V3t=class{detect(e){let r={[fT.ATTR_PROCESS_PID]:process.pid,[fT.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[fT.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[fT.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[fT.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[fT.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[fT.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(r[fT.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=Mso.userInfo();r[fT.ATTR_PROCESS_OWNER]=n.username}catch(n){Pso.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:r}}};UDe.processDetector=new V3t});var wRr=w(QDe=>{"use strict";Object.defineProperty(QDe,"__esModule",{value:!0});QDe.serviceInstanceIdDetector=void 0;var Lso=ipe(),Fso=Ae("crypto"),$3t=class{detect(e){return{attributes:{[Lso.ATTR_SERVICE_INSTANCE_ID]:(0,Fso.randomUUID)()}}}};QDe.serviceInstanceIdDetector=new $3t});var TRr=w(uS=>{"use strict";Object.defineProperty(uS,"__esModule",{value:!0});uS.serviceInstanceIdDetector=uS.processDetector=uS.osDetector=uS.hostDetector=void 0;var Uso=bRr();Object.defineProperty(uS,"hostDetector",{enumerable:!0,get:function(){return Uso.hostDetector}});var Qso=xRr();Object.defineProperty(uS,"osDetector",{enumerable:!0,get:function(){return Qso.osDetector}});var qso=SRr();Object.defineProperty(uS,"processDetector",{enumerable:!0,get:function(){return qso.processDetector}});var Hso=wRr();Object.defineProperty(uS,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Hso.serviceInstanceIdDetector}})});var IRr=w(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});dS.serviceInstanceIdDetector=dS.processDetector=dS.osDetector=dS.hostDetector=void 0;var qDe=TRr();Object.defineProperty(dS,"hostDetector",{enumerable:!0,get:function(){return qDe.hostDetector}});Object.defineProperty(dS,"osDetector",{enumerable:!0,get:function(){return qDe.osDetector}});Object.defineProperty(dS,"processDetector",{enumerable:!0,get:function(){return qDe.processDetector}});Object.defineProperty(dS,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return qDe.serviceInstanceIdDetector}})});var DRr=w(RK=>{"use strict";Object.defineProperty(RK,"__esModule",{value:!0});RK.noopDetector=RK.NoopDetector=void 0;var HDe=class{detect(){return{attributes:{}}}};RK.NoopDetector=HDe;RK.noopDetector=new HDe});var RRr=w(w3=>{"use strict";Object.defineProperty(w3,"__esModule",{value:!0});w3.noopDetector=w3.serviceInstanceIdDetector=w3.processDetector=w3.osDetector=w3.hostDetector=w3.envDetector=void 0;var Gso=dRr();Object.defineProperty(w3,"envDetector",{enumerable:!0,get:function(){return Gso.envDetector}});var GDe=IRr();Object.defineProperty(w3,"hostDetector",{enumerable:!0,get:function(){return GDe.hostDetector}});Object.defineProperty(w3,"osDetector",{enumerable:!0,get:function(){return GDe.osDetector}});Object.defineProperty(w3,"processDetector",{enumerable:!0,get:function(){return GDe.processDetector}});Object.defineProperty(w3,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return GDe.serviceInstanceIdDetector}});var jso=DRr();Object.defineProperty(w3,"noopDetector",{enumerable:!0,get:function(){return jso.noopDetector}})});var z3t=w(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});Df.defaultServiceName=Df.emptyResource=Df.defaultResource=Df.resourceFromAttributes=Df.serviceInstanceIdDetector=Df.processDetector=Df.osDetector=Df.hostDetector=Df.envDetector=Df.detectResources=void 0;var Vso=lRr();Object.defineProperty(Df,"detectResources",{enumerable:!0,get:function(){return Vso.detectResources}});var ope=RRr();Object.defineProperty(Df,"envDetector",{enumerable:!0,get:function(){return ope.envDetector}});Object.defineProperty(Df,"hostDetector",{enumerable:!0,get:function(){return ope.hostDetector}});Object.defineProperty(Df,"osDetector",{enumerable:!0,get:function(){return ope.osDetector}});Object.defineProperty(Df,"processDetector",{enumerable:!0,get:function(){return ope.processDetector}});Object.defineProperty(Df,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return ope.serviceInstanceIdDetector}});var W3t=F3t();Object.defineProperty(Df,"resourceFromAttributes",{enumerable:!0,get:function(){return W3t.resourceFromAttributes}});Object.defineProperty(Df,"defaultResource",{enumerable:!0,get:function(){return W3t.defaultResource}});Object.defineProperty(Df,"emptyResource",{enumerable:!0,get:function(){return W3t.emptyResource}});var $so=P3t();Object.defineProperty(Df,"defaultServiceName",{enumerable:!0,get:function(){return $so.defaultServiceName}})});var BRr=w(spe=>{"use strict";Object.defineProperty(spe,"__esModule",{value:!0});spe.SeverityNumber=void 0;var Wso;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(Wso=spe.SeverityNumber||(spe.SeverityNumber={}))});var VDe=w(BK=>{"use strict";Object.defineProperty(BK,"__esModule",{value:!0});BK.NOOP_LOGGER=BK.NoopLogger=void 0;var jDe=class{emit(e){}};BK.NoopLogger=jDe;BK.NOOP_LOGGER=new jDe});var WDe=w(NK=>{"use strict";Object.defineProperty(NK,"__esModule",{value:!0});NK.NOOP_LOGGER_PROVIDER=NK.NoopLoggerProvider=void 0;var zso=VDe(),$De=class{getLogger(e,r,n){return new zso.NoopLogger}};NK.NoopLoggerProvider=$De;NK.NOOP_LOGGER_PROVIDER=new $De});var K3t=w(zDe=>{"use strict";Object.defineProperty(zDe,"__esModule",{value:!0});zDe.ProxyLogger=void 0;var Yso=VDe(),Y3t=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Yso.NOOP_LOGGER}};zDe.ProxyLogger=Y3t});var X3t=w(YDe=>{"use strict";Object.defineProperty(YDe,"__esModule",{value:!0});YDe.ProxyLoggerProvider=void 0;var Kso=WDe(),Jso=K3t(),J3t=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new Jso.ProxyLogger(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Kso.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}};YDe.ProxyLoggerProvider=J3t});var NRr=w(KDe=>{"use strict";Object.defineProperty(KDe,"__esModule",{value:!0});KDe._globalThis=void 0;KDe._globalThis=typeof globalThis=="object"?globalThis:global});var ORr=w(JDe=>{"use strict";Object.defineProperty(JDe,"__esModule",{value:!0});JDe._globalThis=void 0;var Xso=NRr();Object.defineProperty(JDe,"_globalThis",{enumerable:!0,get:function(){return Xso._globalThis}})});var kRr=w(XDe=>{"use strict";Object.defineProperty(XDe,"__esModule",{value:!0});XDe._globalThis=void 0;var Zso=ORr();Object.defineProperty(XDe,"_globalThis",{enumerable:!0,get:function(){return Zso._globalThis}})});var PRr=w(fS=>{"use strict";Object.defineProperty(fS,"__esModule",{value:!0});fS.API_BACKWARDS_COMPATIBILITY_VERSION=fS.makeGetter=fS._global=fS.GLOBAL_LOGS_API_KEY=void 0;var eao=kRr();fS.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");fS._global=eao._globalThis;function tao(t,e,r){return n=>n===t?e:r}fS.makeGetter=tao;fS.API_BACKWARDS_COMPATIBILITY_VERSION=1});var LRr=w(ZDe=>{"use strict";Object.defineProperty(ZDe,"__esModule",{value:!0});ZDe.LogsAPI=void 0;var Hv=PRr(),rao=WDe(),MRr=X3t(),Z3t=class t{constructor(){this._proxyLoggerProvider=new MRr.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Hv._global[Hv.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(Hv._global[Hv.GLOBAL_LOGS_API_KEY]=(0,Hv.makeGetter)(Hv.API_BACKWARDS_COMPATIBILITY_VERSION,e,rao.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=Hv._global[Hv.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(Hv._global,Hv.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete Hv._global[Hv.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new MRr.ProxyLoggerProvider}};ZDe.LogsAPI=Z3t});var QRr=w(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:!0});Um.logs=Um.ProxyLoggerProvider=Um.ProxyLogger=Um.NoopLoggerProvider=Um.NOOP_LOGGER_PROVIDER=Um.NoopLogger=Um.NOOP_LOGGER=Um.SeverityNumber=void 0;var nao=BRr();Object.defineProperty(Um,"SeverityNumber",{enumerable:!0,get:function(){return nao.SeverityNumber}});var FRr=VDe();Object.defineProperty(Um,"NOOP_LOGGER",{enumerable:!0,get:function(){return FRr.NOOP_LOGGER}});Object.defineProperty(Um,"NoopLogger",{enumerable:!0,get:function(){return FRr.NoopLogger}});var URr=WDe();Object.defineProperty(Um,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return URr.NOOP_LOGGER_PROVIDER}});Object.defineProperty(Um,"NoopLoggerProvider",{enumerable:!0,get:function(){return URr.NoopLoggerProvider}});var iao=K3t();Object.defineProperty(Um,"ProxyLogger",{enumerable:!0,get:function(){return iao.ProxyLogger}});var oao=X3t();Object.defineProperty(Um,"ProxyLoggerProvider",{enumerable:!0,get:function(){return oao.ProxyLoggerProvider}});var sao=LRr();Um.logs=sao.LogsAPI.getInstance()});var ape=w(fB=>{"use strict";Object.defineProperty(fB,"__esModule",{value:!0});fB.isTracingSuppressed=fB.unsuppressTracing=fB.suppressTracing=void 0;var aao=(Kt(),yt(ar)),eyt=(0,aao.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function cao(t){return t.setValue(eyt,!0)}fB.suppressTracing=cao;function lao(t){return t.deleteValue(eyt)}fB.unsuppressTracing=lao;function uao(t){return t.getValue(eyt)===!0}fB.isTracingSuppressed=uao});var tyt=w(E2=>{"use strict";Object.defineProperty(E2,"__esModule",{value:!0});E2.BAGGAGE_MAX_TOTAL_LENGTH=E2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=E2.BAGGAGE_MAX_NAME_VALUE_PAIRS=E2.BAGGAGE_HEADER=E2.BAGGAGE_ITEMS_SEPARATOR=E2.BAGGAGE_PROPERTIES_SEPARATOR=E2.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;E2.BAGGAGE_KEY_PAIR_SEPARATOR="=";E2.BAGGAGE_PROPERTIES_SEPARATOR=";";E2.BAGGAGE_ITEMS_SEPARATOR=",";E2.BAGGAGE_HEADER="baggage";E2.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;E2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;E2.BAGGAGE_MAX_TOTAL_LENGTH=8192});var ryt=w(pS=>{"use strict";Object.defineProperty(pS,"__esModule",{value:!0});pS.parseKeyPairsIntoRecord=pS.parsePairKeyValue=pS.getKeyPairs=pS.serializeKeyPairs=void 0;var dao=(Kt(),yt(ar)),RF=tyt();function fao(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?RF.BAGGAGE_ITEMS_SEPARATOR:""}${r}`;return n.length>RF.BAGGAGE_MAX_TOTAL_LENGTH?e:n},"")}pS.serializeKeyPairs=fao;function pao(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=RF.BAGGAGE_PROPERTIES_SEPARATOR+r.metadata.toString()),n})}pS.getKeyPairs=pao;function qRr(t){let e=t.split(RF.BAGGAGE_PROPERTIES_SEPARATOR);if(e.length<=0)return;let r=e.shift();if(!r)return;let n=r.indexOf(RF.BAGGAGE_KEY_PAIR_SEPARATOR);if(n<=0)return;let i=decodeURIComponent(r.substring(0,n).trim()),o=decodeURIComponent(r.substring(n+1).trim()),s;return e.length>0&&(s=(0,dao.baggageEntryMetadataFromString)(e.join(RF.BAGGAGE_PROPERTIES_SEPARATOR))),{key:i,value:o,metadata:s}}pS.parsePairKeyValue=qRr;function hao(t){let e={};return typeof t=="string"&&t.length>0&&t.split(RF.BAGGAGE_ITEMS_SEPARATOR).forEach(r=>{let n=qRr(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}pS.parseKeyPairsIntoRecord=hao});var HRr=w(eRe=>{"use strict";Object.defineProperty(eRe,"__esModule",{value:!0});eRe.W3CBaggagePropagator=void 0;var nyt=(Kt(),yt(ar)),mao=ape(),BF=tyt(),iyt=ryt(),oyt=class{inject(e,r,n){let i=nyt.propagation.getBaggage(e);if(!i||(0,mao.isTracingSuppressed)(e))return;let o=(0,iyt.getKeyPairs)(i).filter(a=>a.length<=BF.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,BF.BAGGAGE_MAX_NAME_VALUE_PAIRS),s=(0,iyt.serializeKeyPairs)(o);s.length>0&&n.set(r,BF.BAGGAGE_HEADER,s)}extract(e,r,n){let i=n.get(r,BF.BAGGAGE_HEADER),o=Array.isArray(i)?i.join(BF.BAGGAGE_ITEMS_SEPARATOR):i;if(!o)return e;let s={};return o.length===0||(o.split(BF.BAGGAGE_ITEMS_SEPARATOR).forEach(c=>{let u=(0,iyt.parsePairKeyValue)(c);if(u){let d={value:u.value};u.metadata&&(d.metadata=u.metadata),s[u.key]=d}}),Object.entries(s).length===0)?e:nyt.propagation.setBaggage(e,nyt.propagation.createBaggage(s))}fields(){return[BF.BAGGAGE_HEADER]}};eRe.W3CBaggagePropagator=oyt});var GRr=w(tRe=>{"use strict";Object.defineProperty(tRe,"__esModule",{value:!0});tRe.AnchoredClock=void 0;var syt=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,r){this._monotonicClock=r,this._epochMillis=e.now(),this._performanceMillis=r.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}};tRe.AnchoredClock=syt});var zRr=w(pB=>{"use strict";Object.defineProperty(pB,"__esModule",{value:!0});pB.isAttributeValue=pB.isAttributeKey=pB.sanitizeAttributes=void 0;var jRr=(Kt(),yt(ar));function gao(t){let e={};if(typeof t!="object"||t==null)return e;for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!VRr(r)){jRr.diag.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!$Rr(n)){jRr.diag.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}pB.sanitizeAttributes=gao;function VRr(t){return typeof t=="string"&&t!==""}pB.isAttributeKey=VRr;function $Rr(t){return t==null?!0:Array.isArray(t)?Aao(t):WRr(typeof t)}pB.isAttributeValue=$Rr;function Aao(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(WRr(n)){e=n;continue}return!1}return!1}}return!0}function WRr(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var ayt=w(rRe=>{"use strict";Object.defineProperty(rRe,"__esModule",{value:!0});rRe.loggingErrorHandler=void 0;var yao=(Kt(),yt(ar));function Eao(){return t=>{yao.diag.error(vao(t))}}rRe.loggingErrorHandler=Eao;function vao(t){return typeof t=="string"?t:JSON.stringify(bao(t))}function bao(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let i=r[n];i&&(e[n]=String(i))}),r=Object.getPrototypeOf(r);return e}});var KRr=w(OK=>{"use strict";Object.defineProperty(OK,"__esModule",{value:!0});OK.globalErrorHandler=OK.setGlobalErrorHandler=void 0;var Cao=ayt(),YRr=(0,Cao.loggingErrorHandler)();function _ao(t){YRr=t}OK.setGlobalErrorHandler=_ao;function xao(t){try{YRr(t)}catch{}}OK.globalErrorHandler=xao});var eBr=w(hS=>{"use strict";Object.defineProperty(hS,"__esModule",{value:!0});hS.getStringListFromEnv=hS.getBooleanFromEnv=hS.getStringFromEnv=hS.getNumberFromEnv=void 0;var JRr=(Kt(),yt(ar)),XRr=Ae("util");function Sao(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){JRr.diag.warn(`Unknown value ${(0,XRr.inspect)(e)} for ${t}, expected a number, using defaults`);return}return r}hS.getNumberFromEnv=Sao;function ZRr(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}hS.getStringFromEnv=ZRr;function wao(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||JRr.diag.warn(`Unknown value ${(0,XRr.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}hS.getBooleanFromEnv=wao;function Tao(t){return ZRr(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}hS.getStringListFromEnv=Tao});var tBr=w(nRe=>{"use strict";Object.defineProperty(nRe,"__esModule",{value:!0});nRe._globalThis=void 0;nRe._globalThis=typeof globalThis=="object"?globalThis:global});var rBr=w(iRe=>{"use strict";Object.defineProperty(iRe,"__esModule",{value:!0});iRe.otperformance=void 0;var Iao=Ae("perf_hooks");iRe.otperformance=Iao.performance});var nBr=w(oRe=>{"use strict";Object.defineProperty(oRe,"__esModule",{value:!0});oRe.VERSION=void 0;oRe.VERSION="2.2.0"});var iBr=w(sRe=>{"use strict";Object.defineProperty(sRe,"__esModule",{value:!0});sRe.ATTR_PROCESS_RUNTIME_NAME=void 0;sRe.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var oBr=w(cRe=>{"use strict";Object.defineProperty(cRe,"__esModule",{value:!0});cRe.SDK_INFO=void 0;var Dao=nBr(),aRe=(Oh(),yt(u2)),Rao=iBr();cRe.SDK_INFO={[aRe.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[Rao.ATTR_PROCESS_RUNTIME_NAME]:"node",[aRe.ATTR_TELEMETRY_SDK_LANGUAGE]:aRe.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[aRe.ATTR_TELEMETRY_SDK_VERSION]:Dao.VERSION}});var sBr=w(v2=>{"use strict";Object.defineProperty(v2,"__esModule",{value:!0});v2.SDK_INFO=v2.otperformance=v2._globalThis=v2.getStringListFromEnv=v2.getNumberFromEnv=v2.getBooleanFromEnv=v2.getStringFromEnv=void 0;var lRe=eBr();Object.defineProperty(v2,"getStringFromEnv",{enumerable:!0,get:function(){return lRe.getStringFromEnv}});Object.defineProperty(v2,"getBooleanFromEnv",{enumerable:!0,get:function(){return lRe.getBooleanFromEnv}});Object.defineProperty(v2,"getNumberFromEnv",{enumerable:!0,get:function(){return lRe.getNumberFromEnv}});Object.defineProperty(v2,"getStringListFromEnv",{enumerable:!0,get:function(){return lRe.getStringListFromEnv}});var Bao=tBr();Object.defineProperty(v2,"_globalThis",{enumerable:!0,get:function(){return Bao._globalThis}});var Nao=rBr();Object.defineProperty(v2,"otperformance",{enumerable:!0,get:function(){return Nao.otperformance}});var Oao=oBr();Object.defineProperty(v2,"SDK_INFO",{enumerable:!0,get:function(){return Oao.SDK_INFO}})});var cyt=w(b2=>{"use strict";Object.defineProperty(b2,"__esModule",{value:!0});b2.getStringListFromEnv=b2.getNumberFromEnv=b2.getStringFromEnv=b2.getBooleanFromEnv=b2.otperformance=b2._globalThis=b2.SDK_INFO=void 0;var NF=sBr();Object.defineProperty(b2,"SDK_INFO",{enumerable:!0,get:function(){return NF.SDK_INFO}});Object.defineProperty(b2,"_globalThis",{enumerable:!0,get:function(){return NF._globalThis}});Object.defineProperty(b2,"otperformance",{enumerable:!0,get:function(){return NF.otperformance}});Object.defineProperty(b2,"getBooleanFromEnv",{enumerable:!0,get:function(){return NF.getBooleanFromEnv}});Object.defineProperty(b2,"getStringFromEnv",{enumerable:!0,get:function(){return NF.getStringFromEnv}});Object.defineProperty(b2,"getNumberFromEnv",{enumerable:!0,get:function(){return NF.getNumberFromEnv}});Object.defineProperty(b2,"getStringListFromEnv",{enumerable:!0,get:function(){return NF.getStringListFromEnv}})});var uBr=w(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.addHrTimes=mu.isTimeInput=mu.isTimeInputHrTime=mu.hrTimeToMicroseconds=mu.hrTimeToMilliseconds=mu.hrTimeToNanoseconds=mu.hrTimeToTimeStamp=mu.hrTimeDuration=mu.timeInputToHrTime=mu.hrTime=mu.getTimeOrigin=mu.millisToHrTime=void 0;var lyt=cyt(),aBr=9,kao=6,Pao=Math.pow(10,kao),uRe=Math.pow(10,aBr);function cpe(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*Pao);return[r,n]}mu.millisToHrTime=cpe;function uyt(){let t=lyt.otperformance.timeOrigin;if(typeof t!="number"){let e=lyt.otperformance;t=e.timing&&e.timing.fetchStart}return t}mu.getTimeOrigin=uyt;function cBr(t){let e=cpe(uyt()),r=cpe(typeof t=="number"?t:lyt.otperformance.now());return lBr(e,r)}mu.hrTime=cBr;function Mao(t){if(dyt(t))return t;if(typeof t=="number")return t<uyt()?cBr(t):cpe(t);if(t instanceof Date)return cpe(t.getTime());throw TypeError("Invalid input type")}mu.timeInputToHrTime=Mao;function Lao(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=uRe),[r,n]}mu.hrTimeDuration=Lao;function Fao(t){let e=aBr,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}mu.hrTimeToTimeStamp=Fao;function Uao(t){return t[0]*uRe+t[1]}mu.hrTimeToNanoseconds=Uao;function Qao(t){return t[0]*1e3+t[1]/1e6}mu.hrTimeToMilliseconds=Qao;function qao(t){return t[0]*1e6+t[1]/1e3}mu.hrTimeToMicroseconds=qao;function dyt(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}mu.isTimeInputHrTime=dyt;function Hao(t){return dyt(t)||typeof t=="number"||t instanceof Date}mu.isTimeInput=Hao;function lBr(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=uRe&&(r[1]-=uRe,r[0]+=1),r}mu.addHrTimes=lBr});var dBr=w(dRe=>{"use strict";Object.defineProperty(dRe,"__esModule",{value:!0});dRe.unrefTimer=void 0;function Gao(t){typeof t!="number"&&t.unref()}dRe.unrefTimer=Gao});var fBr=w(lpe=>{"use strict";Object.defineProperty(lpe,"__esModule",{value:!0});lpe.ExportResultCode=void 0;var jao;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(jao=lpe.ExportResultCode||(lpe.ExportResultCode={}))});var hBr=w(fRe=>{"use strict";Object.defineProperty(fRe,"__esModule",{value:!0});fRe.CompositePropagator=void 0;var pBr=(Kt(),yt(ar)),fyt=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(e,r,n){for(let i of this._propagators)try{i.inject(e,r,n)}catch(o){pBr.diag.warn(`Failed to inject with ${i.constructor.name}. Err: ${o.message}`)}}extract(e,r,n){return this._propagators.reduce((i,o)=>{try{return o.extract(i,r,n)}catch(s){pBr.diag.warn(`Failed to extract with ${o.constructor.name}. Err: ${s.message}`)}return i},e)}fields(){return this._fields.slice()}};fRe.CompositePropagator=fyt});var mBr=w(kK=>{"use strict";Object.defineProperty(kK,"__esModule",{value:!0});kK.validateValue=kK.validateKey=void 0;var pyt="[_0-9a-z-*/]",Vao=`[a-z]${pyt}{0,255}`,$ao=`[a-z0-9]${pyt}{0,240}@[a-z]${pyt}{0,13}`,Wao=new RegExp(`^(?:${Vao}|${$ao})$`),zao=/^[ -~]{0,255}[!-~]$/,Yao=/,|=/;function Kao(t){return Wao.test(t)}kK.validateKey=Kao;function Jao(t){return zao.test(t)&&!Yao.test(t)}kK.validateValue=Jao});var myt=w(pRe=>{"use strict";Object.defineProperty(pRe,"__esModule",{value:!0});pRe.TraceState=void 0;var gBr=mBr(),ABr=32,Xao=512,yBr=",",EBr="=",hyt=class t{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,r){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n}unset(e){let r=this._clone();return r._internalState.delete(e),r}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,r)=>(e.push(r+EBr+this.get(r)),e),[]).join(yBr)}_parse(e){e.length>Xao||(this._internalState=e.split(yBr).reverse().reduce((r,n)=>{let i=n.trim(),o=i.indexOf(EBr);if(o!==-1){let s=i.slice(0,o),a=i.slice(o+1,n.length);(0,gBr.validateKey)(s)&&(0,gBr.validateValue)(a)&&r.set(s,a)}return r},new Map),this._internalState.size>ABr&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,ABr))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};pRe.TraceState=hyt});var bBr=w(C2=>{"use strict";Object.defineProperty(C2,"__esModule",{value:!0});C2.W3CTraceContextPropagator=C2.parseTraceParent=C2.TRACE_STATE_HEADER=C2.TRACE_PARENT_HEADER=void 0;var hRe=(Kt(),yt(ar)),Zao=ape(),eco=myt();C2.TRACE_PARENT_HEADER="traceparent";C2.TRACE_STATE_HEADER="tracestate";var tco="00",rco="(?!ff)[\\da-f]{2}",nco="(?![0]{32})[\\da-f]{32}",ico="(?![0]{16})[\\da-f]{16}",oco="[\\da-f]{2}",sco=new RegExp(`^\\s?(${rco})-(${nco})-(${ico})-(${oco})(-.*)?\\s?$`);function vBr(t){let e=sco.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}C2.parseTraceParent=vBr;var gyt=class{inject(e,r,n){let i=hRe.trace.getSpanContext(e);if(!i||(0,Zao.isTracingSuppressed)(e)||!(0,hRe.isSpanContextValid)(i))return;let o=`${tco}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||hRe.TraceFlags.NONE).toString(16)}`;n.set(r,C2.TRACE_PARENT_HEADER,o),i.traceState&&n.set(r,C2.TRACE_STATE_HEADER,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,C2.TRACE_PARENT_HEADER);if(!i)return e;let o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;let s=vBr(o);if(!s)return e;s.isRemote=!0;let a=n.get(r,C2.TRACE_STATE_HEADER);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new eco.TraceState(typeof c=="string"?c:void 0)}return hRe.trace.setSpanContext(e,s)}fields(){return[C2.TRACE_PARENT_HEADER,C2.TRACE_STATE_HEADER]}};C2.W3CTraceContextPropagator=gyt});var CBr=w(JC=>{"use strict";Object.defineProperty(JC,"__esModule",{value:!0});JC.getRPCMetadata=JC.deleteRPCMetadata=JC.setRPCMetadata=JC.RPCType=void 0;var aco=(Kt(),yt(ar)),Ayt=(0,aco.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),cco;(function(t){t.HTTP="http"})(cco=JC.RPCType||(JC.RPCType={}));function lco(t,e){return t.setValue(Ayt,e)}JC.setRPCMetadata=lco;function uco(t){return t.deleteValue(Ayt)}JC.deleteRPCMetadata=uco;function dco(t){return t.getValue(Ayt)}JC.getRPCMetadata=dco});var TBr=w(mRe=>{"use strict";Object.defineProperty(mRe,"__esModule",{value:!0});mRe.isPlainObject=void 0;var fco="[object Object]",pco="[object Null]",hco="[object Undefined]",mco=Function.prototype,_Br=mco.toString,gco=_Br.call(Object),Aco=Object.getPrototypeOf,xBr=Object.prototype,SBr=xBr.hasOwnProperty,OF=Symbol?Symbol.toStringTag:void 0,wBr=xBr.toString;function yco(t){if(!Eco(t)||vco(t)!==fco)return!1;let e=Aco(t);if(e===null)return!0;let r=SBr.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&_Br.call(r)===gco}mRe.isPlainObject=yco;function Eco(t){return t!=null&&typeof t=="object"}function vco(t){return t==null?t===void 0?hco:pco:OF&&OF in Object(t)?bco(t):Cco(t)}function bco(t){let e=SBr.call(t,OF),r=t[OF],n=!1;try{t[OF]=void 0,n=!0}catch{}let i=wBr.call(t);return n&&(e?t[OF]=r:delete t[OF]),i}function Cco(t){return wBr.call(t)}});var NBr=w(yRe=>{"use strict";Object.defineProperty(yRe,"__esModule",{value:!0});yRe.merge=void 0;var IBr=TBr(),_co=20;function xco(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=RBr(e,t.shift(),0,r);return e}yRe.merge=xco;function yyt(t){return ARe(t)?t.slice():t}function RBr(t,e,r=0,n){let i;if(!(r>_co)){if(r++,gRe(t)||gRe(e)||BBr(e))i=yyt(e);else if(ARe(t)){if(i=t.slice(),ARe(e))for(let o=0,s=e.length;o<s;o++)i.push(yyt(e[o]));else if(upe(e)){let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s];i[c]=yyt(e[c])}}}else if(upe(t))if(upe(e)){if(!Sco(t,e))return e;i=Object.assign({},t);let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s],u=e[c];if(gRe(u))typeof u>"u"?delete i[c]:i[c]=u;else{let d=i[c],f=u;if(DBr(t,c,n)||DBr(e,c,n))delete i[c];else{if(upe(d)&&upe(f)){let p=n.get(d)||[],h=n.get(f)||[];p.push({obj:t,key:c}),h.push({obj:e,key:c}),n.set(d,p),n.set(f,h)}i[c]=RBr(i[c],u,r,n)}}}}else i=e;return i}}function DBr(t,e,r){let n=r.get(t[e])||[];for(let i=0,o=n.length;i<o;i++){let s=n[i];if(s.key===e&&s.obj===t)return!0}return!1}function ARe(t){return Array.isArray(t)}function BBr(t){return typeof t=="function"}function upe(t){return!gRe(t)&&!ARe(t)&&!BBr(t)&&typeof t=="object"}function gRe(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function Sco(t,e){return!(!(0,IBr.isPlainObject)(t)||!(0,IBr.isPlainObject)(e))}});var OBr=w(PK=>{"use strict";Object.defineProperty(PK,"__esModule",{value:!0});PK.callWithTimeout=PK.TimeoutError=void 0;var ERe=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};PK.TimeoutError=ERe;function wco(t,e){let r,n=new Promise(function(o,s){r=setTimeout(function(){s(new ERe("Operation timed out."))},e)});return Promise.race([t,n]).then(i=>(clearTimeout(r),i),i=>{throw clearTimeout(r),i})}PK.callWithTimeout=wco});var PBr=w(MK=>{"use strict";Object.defineProperty(MK,"__esModule",{value:!0});MK.isUrlIgnored=MK.urlMatches=void 0;function kBr(t,e){return typeof e=="string"?t===e:!!t.match(e)}MK.urlMatches=kBr;function Tco(t,e){if(!e)return!1;for(let r of e)if(kBr(t,r))return!0;return!1}MK.isUrlIgnored=Tco});var MBr=w(vRe=>{"use strict";Object.defineProperty(vRe,"__esModule",{value:!0});vRe.Deferred=void 0;var Eyt=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};vRe.Deferred=Eyt});var LBr=w(bRe=>{"use strict";Object.defineProperty(bRe,"__esModule",{value:!0});bRe.BindOnceFuture=void 0;var Ico=MBr(),vyt=class{_callback;_that;_isCalled=!1;_deferred=new Ico.Deferred;constructor(e,r){this._callback=e,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};bRe.BindOnceFuture=vyt});var UBr=w(CRe=>{"use strict";Object.defineProperty(CRe,"__esModule",{value:!0});CRe.diagLogLevelFromString=void 0;var pT=(Kt(),yt(ar)),FBr={ALL:pT.DiagLogLevel.ALL,VERBOSE:pT.DiagLogLevel.VERBOSE,DEBUG:pT.DiagLogLevel.DEBUG,INFO:pT.DiagLogLevel.INFO,WARN:pT.DiagLogLevel.WARN,ERROR:pT.DiagLogLevel.ERROR,NONE:pT.DiagLogLevel.NONE};function Dco(t){if(t==null)return;let e=FBr[t.toUpperCase()];return e??(pT.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(FBr)}, using default`),pT.DiagLogLevel.INFO)}CRe.diagLogLevelFromString=Dco});var qBr=w(_Re=>{"use strict";Object.defineProperty(_Re,"__esModule",{value:!0});_Re._export=void 0;var QBr=(Kt(),yt(ar)),Rco=ape();function Bco(t,e){return new Promise(r=>{QBr.context.with((0,Rco.suppressTracing)(QBr.context.active()),()=>{t.export(e,n=>{r(n)})})})}_Re._export=Bco});var hT=w(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.internal=Lr.diagLogLevelFromString=Lr.BindOnceFuture=Lr.urlMatches=Lr.isUrlIgnored=Lr.callWithTimeout=Lr.TimeoutError=Lr.merge=Lr.TraceState=Lr.unsuppressTracing=Lr.suppressTracing=Lr.isTracingSuppressed=Lr.setRPCMetadata=Lr.getRPCMetadata=Lr.deleteRPCMetadata=Lr.RPCType=Lr.parseTraceParent=Lr.W3CTraceContextPropagator=Lr.TRACE_STATE_HEADER=Lr.TRACE_PARENT_HEADER=Lr.CompositePropagator=Lr.otperformance=Lr.getStringListFromEnv=Lr.getNumberFromEnv=Lr.getBooleanFromEnv=Lr.getStringFromEnv=Lr._globalThis=Lr.SDK_INFO=Lr.parseKeyPairsIntoRecord=Lr.ExportResultCode=Lr.unrefTimer=Lr.timeInputToHrTime=Lr.millisToHrTime=Lr.isTimeInputHrTime=Lr.isTimeInput=Lr.hrTimeToTimeStamp=Lr.hrTimeToNanoseconds=Lr.hrTimeToMilliseconds=Lr.hrTimeToMicroseconds=Lr.hrTimeDuration=Lr.hrTime=Lr.getTimeOrigin=Lr.addHrTimes=Lr.loggingErrorHandler=Lr.setGlobalErrorHandler=Lr.globalErrorHandler=Lr.sanitizeAttributes=Lr.isAttributeValue=Lr.AnchoredClock=Lr.W3CBaggagePropagator=void 0;var Nco=HRr();Object.defineProperty(Lr,"W3CBaggagePropagator",{enumerable:!0,get:function(){return Nco.W3CBaggagePropagator}});var Oco=GRr();Object.defineProperty(Lr,"AnchoredClock",{enumerable:!0,get:function(){return Oco.AnchoredClock}});var HBr=zRr();Object.defineProperty(Lr,"isAttributeValue",{enumerable:!0,get:function(){return HBr.isAttributeValue}});Object.defineProperty(Lr,"sanitizeAttributes",{enumerable:!0,get:function(){return HBr.sanitizeAttributes}});var GBr=KRr();Object.defineProperty(Lr,"globalErrorHandler",{enumerable:!0,get:function(){return GBr.globalErrorHandler}});Object.defineProperty(Lr,"setGlobalErrorHandler",{enumerable:!0,get:function(){return GBr.setGlobalErrorHandler}});var kco=ayt();Object.defineProperty(Lr,"loggingErrorHandler",{enumerable:!0,get:function(){return kco.loggingErrorHandler}});var Gv=uBr();Object.defineProperty(Lr,"addHrTimes",{enumerable:!0,get:function(){return Gv.addHrTimes}});Object.defineProperty(Lr,"getTimeOrigin",{enumerable:!0,get:function(){return Gv.getTimeOrigin}});Object.defineProperty(Lr,"hrTime",{enumerable:!0,get:function(){return Gv.hrTime}});Object.defineProperty(Lr,"hrTimeDuration",{enumerable:!0,get:function(){return Gv.hrTimeDuration}});Object.defineProperty(Lr,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return Gv.hrTimeToMicroseconds}});Object.defineProperty(Lr,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return Gv.hrTimeToMilliseconds}});Object.defineProperty(Lr,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return Gv.hrTimeToNanoseconds}});Object.defineProperty(Lr,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return Gv.hrTimeToTimeStamp}});Object.defineProperty(Lr,"isTimeInput",{enumerable:!0,get:function(){return Gv.isTimeInput}});Object.defineProperty(Lr,"isTimeInputHrTime",{enumerable:!0,get:function(){return Gv.isTimeInputHrTime}});Object.defineProperty(Lr,"millisToHrTime",{enumerable:!0,get:function(){return Gv.millisToHrTime}});Object.defineProperty(Lr,"timeInputToHrTime",{enumerable:!0,get:function(){return Gv.timeInputToHrTime}});var Pco=dBr();Object.defineProperty(Lr,"unrefTimer",{enumerable:!0,get:function(){return Pco.unrefTimer}});var Mco=fBr();Object.defineProperty(Lr,"ExportResultCode",{enumerable:!0,get:function(){return Mco.ExportResultCode}});var Lco=ryt();Object.defineProperty(Lr,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return Lco.parseKeyPairsIntoRecord}});var kF=cyt();Object.defineProperty(Lr,"SDK_INFO",{enumerable:!0,get:function(){return kF.SDK_INFO}});Object.defineProperty(Lr,"_globalThis",{enumerable:!0,get:function(){return kF._globalThis}});Object.defineProperty(Lr,"getStringFromEnv",{enumerable:!0,get:function(){return kF.getStringFromEnv}});Object.defineProperty(Lr,"getBooleanFromEnv",{enumerable:!0,get:function(){return kF.getBooleanFromEnv}});Object.defineProperty(Lr,"getNumberFromEnv",{enumerable:!0,get:function(){return kF.getNumberFromEnv}});Object.defineProperty(Lr,"getStringListFromEnv",{enumerable:!0,get:function(){return kF.getStringListFromEnv}});Object.defineProperty(Lr,"otperformance",{enumerable:!0,get:function(){return kF.otperformance}});var Fco=hBr();Object.defineProperty(Lr,"CompositePropagator",{enumerable:!0,get:function(){return Fco.CompositePropagator}});var xRe=bBr();Object.defineProperty(Lr,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return xRe.TRACE_PARENT_HEADER}});Object.defineProperty(Lr,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return xRe.TRACE_STATE_HEADER}});Object.defineProperty(Lr,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return xRe.W3CTraceContextPropagator}});Object.defineProperty(Lr,"parseTraceParent",{enumerable:!0,get:function(){return xRe.parseTraceParent}});var SRe=CBr();Object.defineProperty(Lr,"RPCType",{enumerable:!0,get:function(){return SRe.RPCType}});Object.defineProperty(Lr,"deleteRPCMetadata",{enumerable:!0,get:function(){return SRe.deleteRPCMetadata}});Object.defineProperty(Lr,"getRPCMetadata",{enumerable:!0,get:function(){return SRe.getRPCMetadata}});Object.defineProperty(Lr,"setRPCMetadata",{enumerable:!0,get:function(){return SRe.setRPCMetadata}});var byt=ape();Object.defineProperty(Lr,"isTracingSuppressed",{enumerable:!0,get:function(){return byt.isTracingSuppressed}});Object.defineProperty(Lr,"suppressTracing",{enumerable:!0,get:function(){return byt.suppressTracing}});Object.defineProperty(Lr,"unsuppressTracing",{enumerable:!0,get:function(){return byt.unsuppressTracing}});var Uco=myt();Object.defineProperty(Lr,"TraceState",{enumerable:!0,get:function(){return Uco.TraceState}});var Qco=NBr();Object.defineProperty(Lr,"merge",{enumerable:!0,get:function(){return Qco.merge}});var jBr=OBr();Object.defineProperty(Lr,"TimeoutError",{enumerable:!0,get:function(){return jBr.TimeoutError}});Object.defineProperty(Lr,"callWithTimeout",{enumerable:!0,get:function(){return jBr.callWithTimeout}});var VBr=PBr();Object.defineProperty(Lr,"isUrlIgnored",{enumerable:!0,get:function(){return VBr.isUrlIgnored}});Object.defineProperty(Lr,"urlMatches",{enumerable:!0,get:function(){return VBr.urlMatches}});var qco=LBr();Object.defineProperty(Lr,"BindOnceFuture",{enumerable:!0,get:function(){return qco.BindOnceFuture}});var Hco=UBr();Object.defineProperty(Lr,"diagLogLevelFromString",{enumerable:!0,get:function(){return Hco.diagLogLevelFromString}});var Gco=qBr();Lr.internal={_export:Gco._export}});var $Br=w(TRe=>{"use strict";Object.defineProperty(TRe,"__esModule",{value:!0});TRe.LogRecordImpl=void 0;var PF=(Kt(),yt(ar)),wRe=hT(),Cyt=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;totalAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,r,n){let{timestamp:i,observedTimestamp:o,eventName:s,severityNumber:a,severityText:c,body:u,attributes:d={},context:f}=n,p=Date.now();if(this.hrTime=(0,wRe.timeInputToHrTime)(i??p),this.hrTimeObserved=(0,wRe.timeInputToHrTime)(o??p),f){let h=PF.trace.getSpanContext(f);h&&PF.isSpanContextValid(h)&&(this.spanContext=h)}this.severityNumber=a,this.severityText=c,this.body=u,this.resource=e.resource,this.instrumentationScope=r,this._logRecordLimits=e.logRecordLimits,this._eventName=s,this.setAttributes(d)}setAttribute(e,r){return this._isLogRecordReadonly()?this:r===null?this:e.length===0?(PF.diag.warn(`Invalid attribute key: ${e}`),this):!(0,wRe.isAttributeValue)(r)&&!(typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length>0)?(PF.diag.warn(`Invalid attribute value set for key: ${e}`),this):(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this.droppedAttributesCount===1&&PF.diag.warn("Dropping extra attributes."),this):((0,wRe.isAttributeValue)(r)?this.attributes[e]=this._truncateToSize(r):this.attributes[e]=r,this))}setAttributes(e){for(let[r,n]of Object.entries(e))this.setAttribute(r,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let r=this._logRecordLimits.attributeValueLengthLimit;return r<=0?(PF.diag.warn(`Attribute value limit must be positive, got ${r}`),e):typeof e=="string"?this._truncateToLimitUtil(e,r):Array.isArray(e)?e.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):e}_truncateToLimitUtil(e,r){return e.length<=r?e:e.substring(0,r)}_isLogRecordReadonly(){return this._isReadonly&&PF.diag.warn("Can not execute the operation on emitted log record"),this._isReadonly}};TRe.LogRecordImpl=Cyt});var WBr=w(IRe=>{"use strict";Object.defineProperty(IRe,"__esModule",{value:!0});IRe.Logger=void 0;var jco=(Kt(),yt(ar)),Vco=$Br(),_yt=class{instrumentationScope;_sharedState;constructor(e,r){this.instrumentationScope=e,this._sharedState=r}emit(e){let r=e.context||jco.context.active(),n=new Vco.LogRecordImpl(this._sharedState,this.instrumentationScope,{context:r,...e});this._sharedState.activeProcessor.onEmit(n,r),n._makeReadonly()}};IRe.Logger=_yt});var zBr=w(FK=>{"use strict";Object.defineProperty(FK,"__esModule",{value:!0});FK.reconfigureLimits=FK.loadDefaultConfig=void 0;var LK=hT();function $co(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:(0,LK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,LK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??128},includeTraceContext:!0}}FK.loadDefaultConfig=$co;function Wco(t){return{attributeCountLimit:t.attributeCountLimit??(0,LK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??(0,LK.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128,attributeValueLengthLimit:t.attributeValueLengthLimit??(0,LK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,LK.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0}}FK.reconfigureLimits=Wco});var Syt=w(DRe=>{"use strict";Object.defineProperty(DRe,"__esModule",{value:!0});DRe.NoopLogRecordProcessor=void 0;var xyt=class{forceFlush(){return Promise.resolve()}onEmit(e,r){}shutdown(){return Promise.resolve()}};DRe.NoopLogRecordProcessor=xyt});var YBr=w(RRe=>{"use strict";Object.defineProperty(RRe,"__esModule",{value:!0});RRe.MultiLogRecordProcessor=void 0;var zco=hT(),wyt=class{processors;forceFlushTimeoutMillis;constructor(e,r){this.processors=e,this.forceFlushTimeoutMillis=r}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(r=>(0,zco.callWithTimeout)(r.forceFlush(),e)))}onEmit(e,r){this.processors.forEach(n=>n.onEmit(e,r))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}};RRe.MultiLogRecordProcessor=wyt});var KBr=w(BRe=>{"use strict";Object.defineProperty(BRe,"__esModule",{value:!0});BRe.LoggerProviderSharedState=void 0;var Yco=Syt(),Kco=YBr(),Tyt=class{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,r,n,i){this.resource=e,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=i,i.length>0?(this.registeredLogRecordProcessors=i,this.activeProcessor=new Kco.MultiLogRecordProcessor(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Yco.NoopLogRecordProcessor}};BRe.LoggerProviderSharedState=Tyt});var ZBr=w(MF=>{"use strict";Object.defineProperty(MF,"__esModule",{value:!0});MF.LoggerProvider=MF.DEFAULT_LOGGER_NAME=void 0;var NRe=(Kt(),yt(ar)),Jco=QRr(),Xco=z3t(),JBr=hT(),Zco=WBr(),XBr=zBr(),elo=KBr();MF.DEFAULT_LOGGER_NAME="unknown";var Iyt=class{_shutdownOnce;_sharedState;constructor(e={}){let r=(0,JBr.merge)({},(0,XBr.loadDefaultConfig)(),e),n=e.resource??(0,Xco.defaultResource)();this._sharedState=new elo.LoggerProviderSharedState(n,r.forceFlushTimeoutMillis,(0,XBr.reconfigureLimits)(r.logRecordLimits),e?.processors??[]),this._shutdownOnce=new JBr.BindOnceFuture(this._shutdown,this)}getLogger(e,r,n){if(this._shutdownOnce.isCalled)return NRe.diag.warn("A shutdown LoggerProvider cannot provide a Logger"),Jco.NOOP_LOGGER;e||NRe.diag.warn("Logger requested without instrumentation scope name.");let i=e||MF.DEFAULT_LOGGER_NAME,o=`${i}@${r||""}:${n?.schemaUrl||""}`;return this._sharedState.loggers.has(o)||this._sharedState.loggers.set(o,new Zco.Logger({name:i,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(o)}forceFlush(){return this._shutdownOnce.isCalled?(NRe.diag.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(NRe.diag.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};MF.LoggerProvider=Iyt});var tNr=w(ORe=>{"use strict";Object.defineProperty(ORe,"__esModule",{value:!0});ORe.ConsoleLogRecordExporter=void 0;var eNr=hT(),Dyt=class{export(e,r){this._sendLogRecords(e,r)}shutdown(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:(0,eNr.hrTimeToMicroseconds)(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,body:e.body,attributes:e.attributes}}_sendLogRecords(e,r){for(let n of e)console.dir(this._exportInfo(n),{depth:3});r?.({code:eNr.ExportResultCode.SUCCESS})}};ORe.ConsoleLogRecordExporter=Dyt});var rNr=w(kRe=>{"use strict";Object.defineProperty(kRe,"__esModule",{value:!0});kRe.SimpleLogRecordProcessor=void 0;var UK=hT(),Ryt=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new UK.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let r=()=>UK.internal._export(this._exporter,[e]).then(n=>{n.code!==UK.ExportResultCode.SUCCESS&&(0,UK.globalErrorHandler)(n.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${n})`))}).catch(UK.globalErrorHandler);if(e.resource.asyncAttributesPending){let n=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(n),r()),UK.globalErrorHandler);n!=null&&this._unresolvedExports.add(n)}else r()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};kRe.SimpleLogRecordProcessor=Ryt});var iNr=w(PRe=>{"use strict";Object.defineProperty(PRe,"__esModule",{value:!0});PRe.InMemoryLogRecordExporter=void 0;var nNr=hT(),Byt=class{_finishedLogRecords=[];_stopped=!1;export(e,r){if(this._stopped)return r({code:nNr.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),r({code:nNr.ExportResultCode.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}};PRe.InMemoryLogRecordExporter=Byt});var oNr=w(MRe=>{"use strict";Object.defineProperty(MRe,"__esModule",{value:!0});MRe.BatchLogRecordProcessorBase=void 0;var tlo=(Kt(),yt(ar)),jv=hT(),Nyt=class{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,r){this._exporter=e,this._maxExportBatchSize=r?.maxExportBatchSize??(0,jv.getNumberFromEnv)("OTEL_BLRP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=r?.maxQueueSize??(0,jv.getNumberFromEnv)("OTEL_BLRP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??(0,jv.getNumberFromEnv)("OTEL_BLRP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??(0,jv.getNumberFromEnv)("OTEL_BLRP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new jv.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(tlo.diag.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,r)=>{let n=[],i=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let o=0;o<i;o++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():new Promise((e,r)=>{(0,jv.callWithTimeout)(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis).then(()=>e()).catch(r)})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,(0,jv.globalErrorHandler)(r)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){let r=()=>jv.internal._export(this._exporter,e).then(i=>{i.code!==jv.ExportResultCode.SUCCESS&&(0,jv.globalErrorHandler)(i.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${i})`))}).catch(jv.globalErrorHandler),n=e.map(i=>i.resource).filter(i=>i.asyncAttributesPending);return n.length===0?r():Promise.all(n.map(i=>i.waitForAsyncAttributes?.())).then(r,jv.globalErrorHandler)}};MRe.BatchLogRecordProcessorBase=Nyt});var sNr=w(LRe=>{"use strict";Object.defineProperty(LRe,"__esModule",{value:!0});LRe.BatchLogRecordProcessor=void 0;var rlo=oNr(),Oyt=class extends rlo.BatchLogRecordProcessorBase{onShutdown(){}};LRe.BatchLogRecordProcessor=Oyt});var aNr=w(FRe=>{"use strict";Object.defineProperty(FRe,"__esModule",{value:!0});FRe.BatchLogRecordProcessor=void 0;var nlo=sNr();Object.defineProperty(FRe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return nlo.BatchLogRecordProcessor}})});var cNr=w(URe=>{"use strict";Object.defineProperty(URe,"__esModule",{value:!0});URe.BatchLogRecordProcessor=void 0;var ilo=aNr();Object.defineProperty(URe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return ilo.BatchLogRecordProcessor}})});var lNr=w(T3=>{"use strict";Object.defineProperty(T3,"__esModule",{value:!0});T3.BatchLogRecordProcessor=T3.InMemoryLogRecordExporter=T3.SimpleLogRecordProcessor=T3.ConsoleLogRecordExporter=T3.NoopLogRecordProcessor=T3.LoggerProvider=void 0;var olo=ZBr();Object.defineProperty(T3,"LoggerProvider",{enumerable:!0,get:function(){return olo.LoggerProvider}});var slo=Syt();Object.defineProperty(T3,"NoopLogRecordProcessor",{enumerable:!0,get:function(){return slo.NoopLogRecordProcessor}});var alo=tNr();Object.defineProperty(T3,"ConsoleLogRecordExporter",{enumerable:!0,get:function(){return alo.ConsoleLogRecordExporter}});var clo=rNr();Object.defineProperty(T3,"SimpleLogRecordProcessor",{enumerable:!0,get:function(){return clo.SimpleLogRecordProcessor}});var llo=iNr();Object.defineProperty(T3,"InMemoryLogRecordExporter",{enumerable:!0,get:function(){return llo.InMemoryLogRecordExporter}});var ulo=cNr();Object.defineProperty(T3,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return ulo.BatchLogRecordProcessor}})});var Qm,uNr,dpe,dNr,fpe,ppe,fNr,pNr,hNr,mNr,gNr,ANr,yNr,ENr,vNr,bNr,CNr,_Nr,xNr,SNr,wNr,TNr,INr,DNr,RNr,BNr,NNr,ONr,kNr,PNr,hpe=Z(()=>{"use strict";Qm="iflow-cli",uNr="iflow_cli.user_prompt",dpe="iflow_cli.tool_call",dNr="iflow_cli.api_request",fpe="iflow_cli.api_error",ppe="iflow_cli.api_response",fNr="iflow_cli.config",pNr="iflow_cli.flash_fallback",hNr="iflow_cli.next_speaker_check",mNr="iflow_cli.slash_command",gNr="iflow_cli.tool.call.count",ANr="iflow_cli.tool.call.latency",yNr="iflow_cli.mcp.tool.call.count",ENr="iflow_cli.mcp.tool.call.latency",vNr="iflow_cli.builtin.tool.call.count",bNr="iflow_cli.builtin.tool.call.latency",CNr="gen_ai.client.operation",_Nr="gen_ai.client.operation.duration",xNr="gen_ai.client.token.usage",SNr="iflow_cli.session.count",wNr="iflow_cli.file.operation.count",TNr="iflow_cli.user_request.count",INr="iflow_cli.user_request.latency",DNr="iflow_cli.user_experience.success",RNr="iflow_cli.user.identity",BNr="iflow_cli.scheduler.lock.error",NNr="iflow_cli.mcp.connect.count",ONr="iflow_cli.loop.detection.count",kNr="iflow_cli.paste.operation.count",PNr="iflow_cli.paste.operation.latency"});import dlo from"os";function MNr(){try{let t=dlo.networkInterfaces();for(let e of Object.keys(t)){let r=t[e];if(r){for(let n of r)if(n.family==="IPv4"&&!n.internal)return n.address}}return"127.0.0.1"}catch{return"127.0.0.1"}}var LNr=Z(()=>{"use strict"});var QK,qK,HK,GK,jK,VK,$K,WK,zK,YK,XC,ZC,FNr=Z(()=>{"use strict";QK="iflow_cli.cpu.usage_percentage",qK="iflow_cli.cpu.user_percentage",HK="iflow_cli.cpu.system_percentage",GK="iflow_cli.cpu.cores",jK="iflow_cli.memory.heap_used",VK="iflow_cli.memory.heap_total",$K="iflow_cli.memory.rss",WK="iflow_cli.memory.external",zK="iflow_cli.memory.system_usage_percentage",YK="iflow_cli.memory.process_usage_percentage",XC={[QK]:"CPU usage percentage",[qK]:"CPU user time percentage",[HK]:"CPU system time percentage",[GK]:"Number of CPU cores",[jK]:"Heap memory used in bytes",[VK]:"Heap memory total in bytes",[$K]:"Resident Set Size in bytes",[WK]:"External memory in bytes",[zK]:"System memory usage percentage",[YK]:"Process memory usage percentage relative to Node.js limits"},ZC={[QK]:"percent",[qK]:"percent",[HK]:"percent",[GK]:"cores",[jK]:"bytes",[VK]:"bytes",[$K]:"bytes",[WK]:"bytes",[zK]:"percent",[YK]:"percent"}});import*as e5 from"os";var QRe,UNr=Z(()=>{"use strict";FNr();QRe=class{meter;options;lastCpuMeasurement;lastMeasureTime;cpuCores;totalSystemMemory;nodeJSMemoryLimit;cpuUsageGauge;cpuUserGauge;cpuSystemGauge;cpuCoresGauge;memoryHeapUsedGauge;memoryHeapTotalGauge;memoryRssGauge;memoryExternalGauge;memorySystemUsageGauge;memoryProcessUsageGauge;constructor(e,r={}){this.meter=e,this.options={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...r},this.lastCpuMeasurement=process.cpuUsage(),this.lastMeasureTime=Date.now(),this.cpuCores=e5.cpus().length,this.totalSystemMemory=e5.totalmem(),this.nodeJSMemoryLimit=this.getNodeJSMemoryLimit(),this.initializeMetrics()}getCurrentCpuMetrics(){try{let e=process.cpuUsage(this.lastCpuMeasurement),r=Date.now(),n=r-this.lastMeasureTime;if(this.lastCpuMeasurement=process.cpuUsage(),this.lastMeasureTime=r,n<=0)return{usage:0,user:0,system:0,cores:this.cpuCores};let i=Math.max(0,e.user+e.system),o=Math.max(0,e.user),s=Math.max(0,e.system),a=i/(n*1e3)*100,c=o/(n*1e3)*100,u=s/(n*1e3)*100,d=Number.isFinite(a)?Math.min(100,Math.max(0,a)):0,f=Number.isFinite(c)?Math.min(100,Math.max(0,c)):0,p=Number.isFinite(u)?Math.min(100,Math.max(0,u)):0;return{usage:d,user:f,system:p,cores:this.cpuCores}}catch{return{usage:0,user:0,system:0,cores:this.cpuCores}}}getCurrentMemoryMetrics(){try{let e=process.memoryUsage(),r=e5.freemem(),i=(this.totalSystemMemory-r)/this.totalSystemMemory*100,o=e.rss/this.nodeJSMemoryLimit*100;return{heapUsed:e.heapUsed,heapTotal:e.heapTotal,rss:e.rss,external:e.external,systemUsage:Math.min(100,Math.max(0,i)),processUsage:Math.min(100,Math.max(0,o))}}catch{return{heapUsed:0,heapTotal:0,rss:0,external:0,systemUsage:0,processUsage:0}}}initializeMetrics(){let e=e5.platform(),r=e5.arch(),n=process.version;this.options.enableCpuMetrics&&(this.cpuUsageGauge=this.meter.createObservableGauge(QK,{description:XC[QK],unit:ZC[QK]}),this.cpuUserGauge=this.meter.createObservableGauge(qK,{description:XC[qK],unit:ZC[qK]}),this.cpuSystemGauge=this.meter.createObservableGauge(HK,{description:XC[HK],unit:ZC[HK]}),this.cpuCoresGauge=this.meter.createObservableGauge(GK,{description:XC[GK],unit:ZC[GK]}),this.cpuUsageGauge.addCallback(i=>{let o=this.getCurrentCpuMetrics();i.observe(o.usage,{platform:e,arch:r,node_version:n})}),this.cpuUserGauge.addCallback(i=>{let o=this.getCurrentCpuMetrics();i.observe(o.user,{platform:e,arch:r,node_version:n})}),this.cpuSystemGauge.addCallback(i=>{let o=this.getCurrentCpuMetrics();i.observe(o.system,{platform:e,arch:r,node_version:n})}),this.cpuCoresGauge?.addCallback(i=>{i.observe(this.cpuCores,{platform:e,arch:r})})),this.options.enableMemoryMetrics&&(this.memoryHeapUsedGauge=this.meter.createObservableGauge(jK,{description:XC[jK],unit:ZC[jK]}),this.memoryHeapTotalGauge=this.meter.createObservableGauge(VK,{description:XC[VK],unit:ZC[VK]}),this.memoryRssGauge=this.meter.createObservableGauge($K,{description:XC[$K],unit:ZC[$K]}),this.memoryExternalGauge=this.meter.createObservableGauge(WK,{description:XC[WK],unit:ZC[WK]}),this.memorySystemUsageGauge=this.meter.createObservableGauge(zK,{description:XC[zK],unit:ZC[zK]}),this.memoryProcessUsageGauge=this.meter.createObservableGauge(YK,{description:XC[YK],unit:ZC[YK]}),this.memoryHeapUsedGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.heapUsed,{platform:e,arch:r,node_version:n})}),this.memoryHeapTotalGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.heapTotal,{platform:e,arch:r,node_version:n})}),this.memoryRssGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.rss,{platform:e,arch:r,node_version:n})}),this.memoryExternalGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.external,{platform:e,arch:r,node_version:n})}),this.memorySystemUsageGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.systemUsage,{platform:e,arch:r,node_version:n})}),this.memoryProcessUsageGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.processUsage,{platform:e,arch:r,node_version:n,memory_limit_mb:Math.round(this.nodeJSMemoryLimit/(1024*1024)).toString()})}))}getNodeJSMemoryLimit(){let e=process.execArgv.find(i=>i.startsWith("--max-old-space-size="))?.split("=")[1];if(e){let i=parseInt(e,10);if(!isNaN(i)&&i>0)return i*1024*1024}let r=process.execArgv.find(i=>i.startsWith("--max_old_space_size="))?.split("=")[1];if(r){let i=parseInt(r,10);if(!isNaN(i)&&i>0)return i*1024*1024}let n=e5.arch();return n==="x64"||n==="arm64"?1400*1024*1024:700*1024*1024}}});function QNr(t,e={}){if(qRe)return qRe;let r={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...e};return qRe=new QRe(t,r),qRe}var qRe,qNr=Z(()=>{"use strict";UNr();qRe=null});import*as KK from"os";import*as HRe from"fs";function Xp(t){let e="0.3.22-beta.0",r=process.env.IFLOW_ENV||"normal",n={darwin:"macOS",win32:"Windows",linux:"Linux",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX"},i=KK.platform(),o=n[i]||i,s="unknown";try{if(i==="darwin")s=KK.release();else if(i==="linux")try{if(HRe.existsSync("/etc/os-release")){let h=HRe.readFileSync("/etc/os-release","utf8").match(/^PRETTY_NAME="(.+)"/m);h&&(s=h[1])}}catch{s=KK.release()}else i==="win32"&&(s=KK.release())}catch{s="unknown"}let a={name:"Node.js",version:process.version,architecture:process.arch},c=t.getModel()||"unknown",u=t.getUsageMode(),d=!1,f=t.getContentGeneratorConfig?.();if(f){let p=f.authType,h=f.baseUrl||"";(p===zt.LOGIN_WITH_IFLOW||p===zt.IFLOW||p===zt.OPENAI_COMPATIBLE&&h.includes("apis.iflow.cn"))&&(d=!0)}return{app_name:Qm,tenant__:"gen_ai",version:e,platform:o,os_model:s,runtime_name:a.name,runtime_version:a.version,runtime_architecture:a.architecture,model_name:c,is_iflow_open_user:String(d),ip:MNr(),iflow_env:r,usage_mode:u}}function HNr(){return kyt||(kyt=Yue.getMeter(Qm)),kyt}function GNr(){if(eg)return;let t=HNr();if(t){try{QNr(t,{enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0})}catch{}Pyt=t.createHistogram(gNr,{description:"Counts tool calls, tagged by function name and success.",unit:"count",valueType:Fl.INT}),Myt=t.createHistogram(ANr,{description:"Latency of tool calls in milliseconds.",unit:"ms",valueType:Fl.INT}),Lyt=t.createHistogram(yNr,{description:"Counts MCP tool calls, tagged by function name and success.",unit:"count",valueType:Fl.INT}),Fyt=t.createHistogram(ENr,{description:"Latency of MCP tool calls in milliseconds.",unit:"ms",valueType:Fl.INT}),Uyt=t.createHistogram(vNr,{description:"Counts built-in tool calls, tagged by function name and success.",unit:"count",valueType:Fl.INT}),Qyt=t.createHistogram(bNr,{description:"Latency of built-in tool calls in milliseconds.",unit:"ms",valueType:Fl.INT}),mpe=t.createHistogram(CNr,{description:"Counts API requests, tagged by model and status.",unit:"count",valueType:Fl.INT}),gpe=t.createHistogram(_Nr,{description:"Latency of API requests in milliseconds.",unit:"ms",valueType:Fl.INT}),qyt=t.createHistogram(xNr,{description:"Counts the total number of tokens used.",unit:"tokens",valueType:Fl.INT}),Hyt=t.createHistogram(wNr,{description:"Counts file operations (create, read, update).",unit:"count",valueType:Fl.INT}),Gyt=t.createHistogram(TNr,{description:"Counts user requests from prompt to completion.",unit:"count",valueType:Fl.INT}),jyt=t.createHistogram(INr,{description:"End-to-end latency of user requests in milliseconds.",unit:"ms",valueType:Fl.INT}),Vyt=t.createHistogram(DNr,{description:"User experience success rate - counts successful user experiences including retries and fixes.",unit:"count",valueType:Fl.INT}),$yt=t.createHistogram(RNr,{description:"User identity for tracking unique installations.",unit:"count",valueType:Fl.INT}),Wyt=t.createHistogram(BNr,{description:"Counts tool scheduler lock errors when new calls are blocked by running calls.",unit:"count",valueType:Fl.INT}),zyt=t.createHistogram(NNr,{description:"Counts MCP connection attempts and their success/failure status.",unit:"count",valueType:Fl.INT}),Yyt=t.createHistogram(ONr,{description:"Counts loop detection events by loop type.",unit:"count",valueType:Fl.INT}),Kyt=t.createHistogram(kNr,{description:"Counts paste operations, tagged by type and success.",unit:"count",valueType:Fl.INT}),Jyt=t.createHistogram(PNr,{description:"Latency of paste operations in milliseconds.",unit:"ms",valueType:Fl.INT}),eg=!0}}function GRe(t){let e=HNr();if(!e||!eg)return;e.createHistogram(SNr,{description:"Count of CLI sessions started.",unit:"count",valueType:Fl.INT}).record(1,Xp(t))}function jNr(t,e,r,n,i,o){if(!Pyt||!Myt||!eg)return;let s={...Xp(t),function_name:e??"unknown",success:String(n),decision:i??"unknown"};Pyt.record(1,s),Myt.record(r,{...Xp(t),function_name:e??"unknown",tool_type:o??"unknown"})}function VNr(t,e,r,n,i,o){if(!Lyt||!Fyt||!eg)return;let s={...Xp(t),function_name:e??"unknown",success:String(n),decision:i??"unknown"};o&&(s.execution_context=o),Lyt.record(1,s),Fyt.record(r,{...Xp(t),function_name:e??"unknown",execution_context:o??"unknown"})}function $Nr(t,e,r,n,i,o){if(!Uyt||!Qyt||!eg)return;let s={...Xp(t),function_name:e??"unknown",success:String(n),decision:i??"unknown"};o&&(s.execution_context=o),Uyt.record(1,s),Qyt.record(r,{...Xp(t),function_name:e??"unknown",execution_context:o??"unknown"})}function JK(t,e,r,n){!qyt||!eg||qyt.record(r,{...Xp(t),model:e??"unknown",type:n??"unknown"})}function WNr(t,e,r,n,i,o,s,a){if(!mpe||!gpe||!eg)return;let c={...Xp(t),model:e??"unknown",status_code:String(n??(i?"error":"ok"))};s!==void 0&&(c.http_status_code=String(s)),a!==void 0&&(c.business_code=String(a)),o&&(c.finish_reason=o),mpe.record(1,c);let u={...Xp(t),model:e??"unknown",http_status_code:String(s??200),finish_reason:o??"unknown"};a!=null&&(u.business_code=String(a)),gpe.record(r,u)}function zNr(t,e,r,n,i,o,s){if(!mpe||!gpe||!eg)return;let a={...Xp(t),model:e??"unknown",status_code:String(n??"error"),error:i??"unknown"};o!==void 0&&(a.http_status_code=String(o)),s!==void 0&&(a.business_code=String(s)),mpe.record(1,a);let c={...Xp(t),model:e??"unknown",http_status_code:String(o??0),error:i??"unknown"};s!=null&&(c.business_code=String(s)),gpe.record(r,c)}function LF(t,e,r,n,i){if(!Hyt||!eg)return;let o={...Xp(t),operation:e};r!==void 0&&(o.lines=String(r)),n!==void 0&&(o.mimetype=n),i!==void 0&&(o.extension=i),Hyt.record(1,o)}function YNr(t,e,r,n,i){if(!Gyt||!jyt||!eg)return;let o={...Xp(t),prompt_id:e,success:String(n)};i&&(o.error=i),Gyt.record(1,o),jyt.record(r,o)}function Xyt(t,e,r=!1,n=!1,i){if(!Vyt||!eg)return;let o={...Xp(t),success:String(e),had_retries:String(r),had_fixes:String(n)};i&&(o.final_error=i),Vyt.record(1,o)}function KNr(t,e){if(!$yt||!eg)return;let r={...Xp(t),user_id:e};$yt.record(1,r)}function JNr(t,e,r){if(!Wyt||!eg)return;let n={...Xp(t),running_calls_count:String(e)};r.forEach((i,o)=>{n[`call_${o}_name`]=i.name,n[`call_${o}_status`]=i.status}),Wyt.record(1,n)}function Zyt(t,e,r,n,i){if(!zyt||!eg)return;let o={...Xp(t),server_name:e,success:String(r)};n&&(o.error_type=n),i&&(o.transport_type=i),zyt.record(1,o)}function XNr(t,e,r){if(!Yyt||!eg)return;let n={...Xp(t),loop_type:e,prompt_id:r};Yyt.record(1,n)}function FF(t,e,r,n,i="text",o,s){if(!Kyt||!Jyt||!eg)return;let a={};try{a=Xp(t)}catch{a={app_name:Qm,tenant__:"gen_ai",version:"unknown",platform:s||"unknown",os_model:"unknown",runtime_name:"Node.js",runtime_version:process.version,runtime_architecture:process.arch,model_name:"unknown",is_iflow_open_user:"false",ip:"unknown",iflow_env:"test",usage_mode:"unknown"}}let c={...a,success:String(n),paste_type:i};o&&(c.error_type=o),s&&(c.platform_specific=s),Kyt.record(1,c);let u={...a,paste_type:i,text_length_range:String(r),performance_ratio:flo(e,r)};Jyt.record(e,u)}function flo(t,e){if(e===0)return"no-text";let r=t/e;return r<=.1?"excellent":r<=.5?"good":r<=1?"normal":r<=2?"slow":"very-slow"}var mT,kyt,Pyt,Myt,Lyt,Fyt,Uyt,Qyt,mpe,gpe,qyt,Hyt,Gyt,jyt,Vyt,$yt,Wyt,zyt,Yyt,Kyt,Jyt,eg,Vv=Z(()=>{"use strict";Kt();LNr();hpe();rE();qNr();(function(t){t.CREATE="create",t.READ="read",t.UPDATE="update"})(mT||(mT={}));eg=!1});var Do,yn,Ro,Bo,Id=Z(()=>{"use strict";Do=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,i,o,s,a=!0,c=!1,u=[]){this.name=e,this.displayName=r,this.description=n,this.icon=i,this.kind=o,this.parameterSchema=s,this.isOutputMarkdown=a,this.canUpdateOutput=c,this.aliases=u}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(e){return null}getDescription(e){return JSON.stringify(e)}shouldConfirmExecute(e,r){return Promise.resolve(!1)}toolLocations(e){return[]}};(function(t){t.ProceedOnce="proceed_once",t.ProceedAlways="proceed_always",t.ProceedAlwaysServer="proceed_always_server",t.ProceedAlwaysTool="proceed_always_tool",t.ModifyWithEditor="modify_with_editor",t.Cancel="cancel"})(yn||(yn={}));(function(t){t.FileSearch="fileSearch",t.Folder="folder",t.Globe="globe",t.Hammer="hammer",t.LightBulb="lightBulb",t.Pencil="pencil",t.Regex="regex",t.Terminal="terminal"})(Ro||(Ro={}));(function(t){t.Read="read",t.Edit="edit",t.Delete="delete",t.Move="move",t.Search="search",t.Execute="execute",t.Think="think",t.Fetch="fetch",t.Other="other"})(Bo||(Bo={}))});function plo(t){switch(t){case yn.ProceedOnce:case yn.ProceedAlways:case yn.ProceedAlwaysServer:case yn.ProceedAlwaysTool:return $v.ACCEPT;case yn.ModifyWithEditor:return $v.MODIFY;case yn.Cancel:default:return $v.REJECT}}var $v,XK,ZK,eJ,tJ,rJ,j1,nJ,iJ,Wv,oJ,jRe,sJ,VRe,gT=Z(()=>{"use strict";Id();rE();(function(t){t.ACCEPT="accept",t.REJECT="reject",t.MODIFY="modify"})($v||($v={}));XK=class{"event.name";"event.timestamp";model;embedding_model;sandbox_enabled;core_tools_enabled;approval_mode;api_key_enabled;vertex_ai_enabled;debug_enabled;mcp_servers;telemetry_enabled;telemetry_log_user_prompts_enabled;file_filtering_respect_git_ignore;constructor(e){let r=e.getContentGeneratorConfig(),n=e.getMcpServers(),i=!1,o=!1;r&&r.authType&&(i=r.authType===zt.IFLOW,o=r.authType===zt.AONE),this["event.name"]="cli_config",this.model=e.getModel(),this.embedding_model=e.getEmbeddingModel(),this.sandbox_enabled=typeof e.getSandbox()=="string"||!!e.getSandbox(),this.core_tools_enabled=(e.getCoreTools()??[]).join(","),this.approval_mode=e.getApprovalMode(),this.api_key_enabled=i||o,this.vertex_ai_enabled=o,this.debug_enabled=e.getDebugMode(),this.mcp_servers=n?Object.keys(n).join(","):"",this.telemetry_enabled=e.getTelemetryEnabled(),this.telemetry_log_user_prompts_enabled=e.getTelemetryLogPromptsEnabled(),this.file_filtering_respect_git_ignore=e.getFileFilteringRespectGitIgnore()}},ZK=class{"event.name";"event.timestamp";session_id;constructor(e){this["event.name"]="end_session",this["event.timestamp"]=new Date().toISOString(),this.session_id=e?.getSessionId()}},eJ=class{"event.name";"event.timestamp";prompt_length;prompt_id;auth_type;prompt;constructor(e,r,n,i){this["event.name"]="user_prompt",this["event.timestamp"]=new Date().toISOString(),this.prompt_length=e,this.prompt_id=r,this.auth_type=n,this.prompt=i}},tJ=class{"event.name";"event.timestamp";function_name;function_args;duration_ms;success;decision;error;error_type;prompt_id;server_name;constructor(e){this["event.name"]="tool_call",this["event.timestamp"]=new Date().toISOString(),this.function_name=e.request.name,this.function_args=JSON.stringify(e.request.args),this.duration_ms=e.durationMs??0,this.success=e.status==="success",this.decision=e.outcome?plo(e.outcome):void 0,this.error=e.response.error?.message,this.error_type=e.response.errorType,this.prompt_id=e.request.prompt_id,"tool"in e&&e.tool&&"serverName"in e.tool&&(this.server_name=e.tool.serverName)}},rJ=class{"event.name";"event.timestamp";model;prompt_id;request_text;constructor(e,r,n){this["event.name"]="api_request",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.prompt_id=r,this.request_text=n}},j1=class{"event.name";"event.timestamp";model;error;error_type;status_code;http_status_code;business_code;duration_ms;prompt_id;auth_type;constructor(e,r,n,i,o,s,a,c,u){this["event.name"]="api_error",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.error=r,this.error_type=s,this.status_code=a,this.http_status_code=c,this.business_code=u,this.duration_ms=n,this.prompt_id=i,this.auth_type=o}},nJ=class{"event.name";"event.timestamp";model;status_code;http_status_code;business_code;duration_ms;error;input_token_count;output_token_count;cached_content_token_count;thoughts_token_count;tool_token_count;total_token_count;response_text;prompt_id;auth_type;finish_reason;constructor(e,r,n,i,o,s,a,c,u,d){this["event.name"]="api_response",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.duration_ms=r,this.status_code=200,this.http_status_code=u||200,this.business_code=d,this.input_token_count=o?.promptTokenCount??0,this.output_token_count=o?.candidatesTokenCount??0,this.cached_content_token_count=o?.cachedContentTokenCount??0,this.thoughts_token_count=o?.thoughtsTokenCount??0,this.tool_token_count=o?.toolUsePromptTokenCount??0,this.total_token_count=o?.totalTokenCount??0,this.response_text=s,this.error=a,this.prompt_id=n,this.auth_type=i,this.finish_reason=c}},iJ=class{"event.name";"event.timestamp";auth_type;constructor(e){this["event.name"]="flash_fallback",this["event.timestamp"]=new Date().toISOString(),this.auth_type=e}};(function(t){t.CONSECUTIVE_IDENTICAL_TOOL_CALLS="consecutive_identical_tool_calls",t.CHANTING_IDENTICAL_SENTENCES="chanting_identical_sentences",t.LLM_DETECTED_LOOP="llm_detected_loop"})(Wv||(Wv={}));oJ=class{"event.name";"event.timestamp";loop_type;prompt_id;constructor(e,r){this["event.name"]="loop_detected",this["event.timestamp"]=new Date().toISOString(),this.loop_type=e,this.prompt_id=r}},jRe=class{"event.name";"event.timestamp";prompt_id;finish_reason;result;constructor(e,r,n){this["event.name"]="next_speaker_check",this["event.timestamp"]=new Date().toISOString(),this.prompt_id=e,this.finish_reason=r,this.result=n}},sJ=class{"event.name";"event.timestamp";command;subcommand;constructor(e,r){this["event.name"]="slash_command",this["event.timestamp"]=new Date().toISOString(),this.command=e,this.subcommand=r}},VRe=class{"event.name";"event.timestamp";model;constructor(e){this["event.name"]="malformed_json_response",this["event.timestamp"]=new Date().toISOString(),this.model=e}}});var hi,ZNr=Z(()=>{"use strict";(function(t){t[t.IFLOW_CLI_KEY_UNKNOWN=0]="IFLOW_CLI_KEY_UNKNOWN",t[t.IFLOW_CLI_START_SESSION_MODEL=1]="IFLOW_CLI_START_SESSION_MODEL",t[t.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL=2]="IFLOW_CLI_START_SESSION_EMBEDDING_MODEL",t[t.IFLOW_CLI_START_SESSION_SANDBOX=3]="IFLOW_CLI_START_SESSION_SANDBOX",t[t.IFLOW_CLI_START_SESSION_CORE_TOOLS=4]="IFLOW_CLI_START_SESSION_CORE_TOOLS",t[t.IFLOW_CLI_START_SESSION_APPROVAL_MODE=5]="IFLOW_CLI_START_SESSION_APPROVAL_MODE",t[t.IFLOW_CLI_START_SESSION_API_KEY_ENABLED=6]="IFLOW_CLI_START_SESSION_API_KEY_ENABLED",t[t.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED=7]="IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED",t[t.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED=8]="IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED",t[t.IFLOW_CLI_START_SESSION_MCP_SERVERS=9]="IFLOW_CLI_START_SESSION_MCP_SERVERS",t[t.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED=10]="IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED",t[t.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED=11]="IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED",t[t.IFLOW_CLI_START_SESSION_RESPECT_GITIGNORE=12]="IFLOW_CLI_START_SESSION_RESPECT_GITIGNORE",t[t.IFLOW_CLI_USER_PROMPT_LENGTH=13]="IFLOW_CLI_USER_PROMPT_LENGTH",t[t.IFLOW_CLI_TOOL_CALL_NAME=14]="IFLOW_CLI_TOOL_CALL_NAME",t[t.IFLOW_CLI_TOOL_CALL_DECISION=15]="IFLOW_CLI_TOOL_CALL_DECISION",t[t.IFLOW_CLI_TOOL_CALL_SUCCESS=16]="IFLOW_CLI_TOOL_CALL_SUCCESS",t[t.IFLOW_CLI_TOOL_CALL_DURATION_MS=17]="IFLOW_CLI_TOOL_CALL_DURATION_MS",t[t.IFLOW_CLI_TOOL_ERROR_MESSAGE=18]="IFLOW_CLI_TOOL_ERROR_MESSAGE",t[t.IFLOW_CLI_TOOL_CALL_ERROR_TYPE=19]="IFLOW_CLI_TOOL_CALL_ERROR_TYPE",t[t.IFLOW_CLI_API_REQUEST_MODEL=20]="IFLOW_CLI_API_REQUEST_MODEL",t[t.IFLOW_CLI_API_RESPONSE_MODEL=21]="IFLOW_CLI_API_RESPONSE_MODEL",t[t.IFLOW_CLI_API_RESPONSE_STATUS_CODE=22]="IFLOW_CLI_API_RESPONSE_STATUS_CODE",t[t.IFLOW_CLI_API_RESPONSE_DURATION_MS=23]="IFLOW_CLI_API_RESPONSE_DURATION_MS",t[t.IFLOW_CLI_API_ERROR_MESSAGE=24]="IFLOW_CLI_API_ERROR_MESSAGE",t[t.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT=25]="IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT=26]="IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT=27]="IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT=28]="IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT=29]="IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT",t[t.IFLOW_CLI_API_ERROR_MODEL=30]="IFLOW_CLI_API_ERROR_MODEL",t[t.IFLOW_CLI_API_ERROR_TYPE=31]="IFLOW_CLI_API_ERROR_TYPE",t[t.IFLOW_CLI_API_ERROR_STATUS_CODE=32]="IFLOW_CLI_API_ERROR_STATUS_CODE",t[t.IFLOW_CLI_API_ERROR_DURATION_MS=33]="IFLOW_CLI_API_ERROR_DURATION_MS",t[t.IFLOW_CLI_END_SESSION_ID=34]="IFLOW_CLI_END_SESSION_ID",t[t.IFLOW_CLI_PROMPT_ID=35]="IFLOW_CLI_PROMPT_ID",t[t.IFLOW_CLI_AUTH_TYPE=36]="IFLOW_CLI_AUTH_TYPE",t[t.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT=37]="IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT",t[t.IFLOW_CLI_SURFACE=39]="IFLOW_CLI_SURFACE",t[t.IFLOW_CLI_SESSION_ID=40]="IFLOW_CLI_SESSION_ID",t[t.IFLOW_CLI_LOOP_DETECTED_TYPE=38]="IFLOW_CLI_LOOP_DETECTED_TYPE",t[t.IFLOW_CLI_SLASH_COMMAND_NAME=41]="IFLOW_CLI_SLASH_COMMAND_NAME",t[t.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND=42]="IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND",t[t.IFLOW_CLI_RESPONSE_FINISH_REASON=43]="IFLOW_CLI_RESPONSE_FINISH_REASON",t[t.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT=44]="IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT",t[t.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL=45]="IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL"})(hi||(hi={}))});function UF(t,e){let r=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular]";r.add(i)}return i},e)}var $Re=Z(()=>{"use strict";});import mS,{dirname as hlo,join as eEt}from"node:path";import WRe from"os";import*as eOr from"crypto";import{fileURLToPath as mlo}from"node:url";import glo from"node:fs";function gS(t){let e=WRe.homedir();return t.startsWith(e)?t.replace(e,"~"):t}function Ac(t,e=35){if(t.length<=e)return t;let n=mS.parse(t).root,i=mS.sep,s=t.substring(n.length).split(i).filter(h=>h!=="");if(s.length<=1){let h=Math.floor((e-3)/2);if(h<=0)return t.substring(0,e-3)+"...";let m=t.substring(0,h),g=t.substring(t.length-h);return`${m}...${g}`}let a=s[0],c=s[s.length-1],u=n+a,d=[],f=i.length+c.length;for(let h=s.length-2;h>=0;h--){let m=s[h],g=f+i.length+m.length;if(g<=e)d.unshift(m),f=g;else break}let p=d.join(i)+i+c;return f>e?p:(p=u+i+p,p.length>e?"..."+p.substring(p.length-e-3):p)}function Dd(t,e){let r=mS.resolve(t),n=mS.resolve(e);return mS.relative(n,r)||"."}function aJ(t){let e="";for(let r=0;r<t.length;r++)t[r]===" "&&(r===0||t[r-1]!=="\\")?e+="\\ ":e+=t[r];return e}function AT(t){return t.replace(/\\(.)/g,"$1")}function zRe(t){return eOr.createHash("sha256").update(t).digest("hex")}function V1(t){let e=zRe(t);return mS.join(WRe.homedir(),qm,Alo,e)}function YRe(){return mS.join(WRe.homedir(),qm,tOr)}function KRe(t){return mS.join(t,qm,tOr)}function JRe(){if(process.env.USE_BUILTIN_RIPGREP==="0")return"rg";let t=hlo(mlo(import.meta.url)),e=[eEt(t,"..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),eEt(t,"..","..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),eEt(t,"..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`)];for(let r of e)try{if(glo.existsSync(r))return r}catch{}return e[0]}function Ape(t,e){let n=WRe.platform()==="win32"?mS.win32:mS,i=n.relative(t,e);return!i.startsWith(`..${n.sep}`)&&i!==".."&&!n.isAbsolute(i)}var qm,tEt,Alo,tOr,Rd=Z(()=>{"use strict";qm=".iflow",tEt="google_accounts.json",Alo="tmp",tOr="commands"});import ylo from"node:path";import{promises as $Ma,existsSync as rOr,readFileSync as nOr}from"node:fs";import*as iOr from"os";function oOr(){return ylo.join(iOr.homedir(),qm,tEt)}function sOr(){try{let t=oOr();if(rOr(t)){let e=nOr(t,"utf-8").trim();return e?JSON.parse(e).active:null}return null}catch(t){return console.debug("Error reading cached Google Account:",t),null}}function aOr(){try{let t=oOr();if(!rOr(t))return 0;let e=nOr(t,"utf-8").trim();if(!e)return 0;let r=JSON.parse(e),n=r.old.length;return r.active&&n++,n}catch(t){return console.debug("Error reading lifetime Google Accounts:",t),0}}var cOr=Z(()=>{"use strict";Rd();});import*as lOr from"os";import*as yT from"fs";import*as iEt from"path";import{randomUUID as Elo}from"crypto";function blo(){yT.existsSync(rEt)||yT.mkdirSync(rEt,{recursive:!0})}function Clo(){return yT.existsSync(nEt)&&yT.readFileSync(nEt,"utf-8").trim()||null}function _lo(t){yT.writeFileSync(nEt,t,"utf-8")}function XRe(){try{blo();let t=Clo();return t||(t=Elo(),_lo(t)),t}catch(t){return console.error("Error accessing installation ID file, generating ephemeral ID:",t),"123456789"}}var vlo,rEt,nEt,oEt=Z(()=>{"use strict";Rd();vlo=lOr.homedir()??"",rEt=iEt.join(vlo,qm),nEt=iEt.join(rEt,"installation_id")});var uOr,xlo,Slo,wlo,Tlo,Ilo,Dlo,Rlo,Blo,Nlo,Olo,klo,Plo,Mh,ype=Z(()=>{"use strict";uOr=Te(Kct(),1);gT();ZNr();$Re();cOr();oEt();xlo="start_session",Slo="new_prompt",wlo="tool_call",Tlo="api_request",Ilo="api_response",Dlo="api_error",Rlo="end_session",Blo="flash_fallback",Nlo="loop_detected",Olo="next_speaker_check",klo="slash_command",Plo="malformed_json_response",Mh=class t{static instance;config;events=[];last_flush_time=Date.now();flush_interval_ms=1e3*60;constructor(e){this.config=e}static getInstance(e){if(!(e===void 0||!e?.getUsageStatisticsEnabled()))return t.instance||(t.instance=new t(e)),t.instance}enqueueLogEvent(e){this.events.push([{event_time_ms:Date.now(),source_extension_json:UF(e)}])}createLogEvent(e,r){let n=sOr(),i=aOr();r.push({iflow_cli_key:hi.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT,value:i.toString()});let o={console_type:"IFLOW_CLI",application:102,event_name:e,event_metadata:[r]};return n?o.client_email=n:o.client_install_id=XRe(),o}flushIfNeeded(){Date.now()-this.last_flush_time<this.flush_interval_ms||this.flushToClearcut().catch(e=>{console.debug("Error flushing to Clearcut:",e)})}async flushToClearcut(){return this.config?.getDebugMode()&&console.log("Telemetry disabled - not sending log events to Clearcut."),this.events.length=0,this.last_flush_time=Date.now(),Promise.resolve({})}decodeLogResponse(e){if(e.length<1||e.readUInt8(0)!==8)return;let r=BigInt(0),n=!0;for(let o=1;n&&o<e.length;o++){let s=e.readUInt8(o);r|=BigInt(s&127)<<BigInt(7*(o-1)),n=(s&128)!==0}return n?void 0:{nextRequestWaitMs:Number(r)}}logStartSessionEvent(e){let r=process.env.SURFACE||"SURFACE_NOT_SET",n=[{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_MODEL,value:e.model},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL,value:e.embedding_model},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_SANDBOX,value:e.sandbox_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_CORE_TOOLS,value:e.core_tools_enabled},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_APPROVAL_MODE,value:e.approval_mode},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_API_KEY_ENABLED,value:e.api_key_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED,value:e.debug_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_MCP_SERVERS,value:e.mcp_servers},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED,value:e.telemetry_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED,value:e.telemetry_log_user_prompts_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_SURFACE,value:r}];this.enqueueLogEvent(this.createLogEvent(xlo,n)),this.flushToClearcut().catch(i=>{console.debug("Error flushing to Clearcut:",i)})}logNewPromptEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_USER_PROMPT_LENGTH,value:JSON.stringify(e.prompt_length)},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.enqueueLogEvent(this.createLogEvent(Slo,r)),this.flushIfNeeded()}logToolCallEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_NAME,value:JSON.stringify(e.function_name)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_DECISION,value:JSON.stringify(e.decision)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_ERROR_TYPE,value:JSON.stringify(e.error_type)}],n=this.createLogEvent(wlo,r);this.enqueueLogEvent(n),this.flushIfNeeded()}logApiRequestEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_API_REQUEST_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)}];this.enqueueLogEvent(this.createLogEvent(Tlo,r)),this.flushIfNeeded()}logApiResponseEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT,value:JSON.stringify(e.input_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT,value:JSON.stringify(e.output_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT,value:JSON.stringify(e.cached_content_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT,value:JSON.stringify(e.thoughts_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT,value:JSON.stringify(e.tool_token_count)},{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.enqueueLogEvent(this.createLogEvent(Ilo,r)),this.flushIfNeeded()}logApiErrorEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_TYPE,value:JSON.stringify(e.error_type)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.enqueueLogEvent(this.createLogEvent(Dlo,r)),this.flushIfNeeded()}logFlashFallbackEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.enqueueLogEvent(this.createLogEvent(Blo,r)),this.flushToClearcut().catch(n=>{console.debug("Error flushing to Clearcut:",n)})}logLoopDetectedEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_LOOP_DETECTED_TYPE,value:JSON.stringify(e.loop_type)}];this.enqueueLogEvent(this.createLogEvent(Nlo,r)),this.flushIfNeeded()}logNextSpeakerCheck(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_RESPONSE_FINISH_REASON,value:JSON.stringify(e.finish_reason)},{iflow_cli_key:hi.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT,value:JSON.stringify(e.result)},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.enqueueLogEvent(this.createLogEvent(Olo,r)),this.flushIfNeeded()}logSlashCommandEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_SLASH_COMMAND_NAME,value:JSON.stringify(e.command)}];e.subcommand&&r.push({iflow_cli_key:hi.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND,value:JSON.stringify(e.subcommand)}),this.enqueueLogEvent(this.createLogEvent(klo,r)),this.flushIfNeeded()}logMalformedJsonResponseEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL,value:JSON.stringify(e.model)}];this.enqueueLogEvent(this.createLogEvent(Plo,r)),this.flushIfNeeded()}logEndSessionEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:e?.session_id?.toString()??""}];this.enqueueLogEvent(this.createLogEvent(Rlo,r)),this.flushToClearcut().catch(n=>{console.debug("Error flushing to Clearcut:",n)})}getProxyAgent(){let e=this.config?.getProxy();if(e){if(e.startsWith("http"))return new uOr.HttpsProxyAgent(e);throw new Error("Unsupported proxy type")}}shutdown(){let e=new ZK(this.config);this.logEndSessionEvent(e)}}});import*as dOr from"node:fs";var QF,fOr,Epe,ZRe,eBe,tBe,pOr=Z(()=>{"use strict";QF=Te(oi(),1),fOr=Te(Dx(),1);Epe=class{writeStream;constructor(e){this.writeStream=dOr.createWriteStream(e,{flags:"a"})}serialize(e){let r=new WeakSet;return JSON.stringify(e,(i,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular]";r.add(o)}return o},2)+`
|
|
449
|
+
`).find(n=>n.includes("IOPlatformUUID"));if(!e)return;let r=e.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(t){mso.diag.debug(`error reading machine id: ${t}`)}}BDe.getMachineId=gso});var pRr=w(NDe=>{"use strict";Object.defineProperty(NDe,"__esModule",{value:!0});NDe.getMachineId=void 0;var Aso=Ae("fs"),yso=(Kt(),yt(ar));async function Eso(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await Aso.promises.readFile(e,{encoding:"utf8"})).trim()}catch(r){yso.diag.debug(`error reading machine id: ${r}`)}}NDe.getMachineId=Eso});var mRr=w(ODe=>{"use strict";Object.defineProperty(ODe,"__esModule",{value:!0});ODe.getMachineId=void 0;var vso=Ae("fs"),bso=RDe(),hRr=(Kt(),yt(ar));async function Cso(){try{return(await vso.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){hRr.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,bso.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){hRr.diag.debug(`error reading machine id: ${t}`)}}ODe.getMachineId=Cso});var ARr=w(kDe=>{"use strict";Object.defineProperty(kDe,"__esModule",{value:!0});kDe.getMachineId=void 0;var gRr=Ae("process"),_so=RDe(),xso=(Kt(),yt(ar));async function Sso(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";gRr.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in gRr.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let n=(await(0,_so.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(n.length===2)return n[1].trim()}catch(r){xso.diag.debug(`error reading machine id: ${r}`)}}kDe.getMachineId=Sso});var yRr=w(PDe=>{"use strict";Object.defineProperty(PDe,"__esModule",{value:!0});PDe.getMachineId=void 0;var wso=(Kt(),yt(ar));async function Tso(){wso.diag.debug("could not read machine-id: unsupported platform")}PDe.getMachineId=Tso});var ERr=w(MDe=>{"use strict";Object.defineProperty(MDe,"__esModule",{value:!0});MDe.getMachineId=void 0;var Iso=Ae("process"),DF;async function Dso(){if(!DF)switch(Iso.platform){case"darwin":DF=(await Promise.resolve().then(()=>Te(fRr()))).getMachineId;break;case"linux":DF=(await Promise.resolve().then(()=>Te(pRr()))).getMachineId;break;case"freebsd":DF=(await Promise.resolve().then(()=>Te(mRr()))).getMachineId;break;case"win32":DF=(await Promise.resolve().then(()=>Te(ARr()))).getMachineId;break;default:DF=(await Promise.resolve().then(()=>Te(yRr()))).getMachineId;break}return DF()}MDe.getMachineId=Dso});var q3t=w(DK=>{"use strict";Object.defineProperty(DK,"__esModule",{value:!0});DK.normalizeType=DK.normalizeArch=void 0;var Rso=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};DK.normalizeArch=Rso;var Bso=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};DK.normalizeType=Bso});var bRr=w(LDe=>{"use strict";Object.defineProperty(LDe,"__esModule",{value:!0});LDe.hostDetector=void 0;var H3t=ipe(),vRr=Ae("os"),Nso=ERr(),Oso=q3t(),G3t=class{detect(e){return{attributes:{[H3t.ATTR_HOST_NAME]:(0,vRr.hostname)(),[H3t.ATTR_HOST_ARCH]:(0,Oso.normalizeArch)((0,vRr.arch)()),[H3t.ATTR_HOST_ID]:(0,Nso.getMachineId)()}}}};LDe.hostDetector=new G3t});var xRr=w(FDe=>{"use strict";Object.defineProperty(FDe,"__esModule",{value:!0});FDe.osDetector=void 0;var CRr=ipe(),_Rr=Ae("os"),kso=q3t(),j3t=class{detect(e){return{attributes:{[CRr.ATTR_OS_TYPE]:(0,kso.normalizeType)((0,_Rr.platform)()),[CRr.ATTR_OS_VERSION]:(0,_Rr.release)()}}}};FDe.osDetector=new j3t});var SRr=w(UDe=>{"use strict";Object.defineProperty(UDe,"__esModule",{value:!0});UDe.processDetector=void 0;var Pso=(Kt(),yt(ar)),fT=ipe(),Mso=Ae("os"),V3t=class{detect(e){let r={[fT.ATTR_PROCESS_PID]:process.pid,[fT.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[fT.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[fT.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[fT.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[fT.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[fT.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(r[fT.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=Mso.userInfo();r[fT.ATTR_PROCESS_OWNER]=n.username}catch(n){Pso.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:r}}};UDe.processDetector=new V3t});var wRr=w(QDe=>{"use strict";Object.defineProperty(QDe,"__esModule",{value:!0});QDe.serviceInstanceIdDetector=void 0;var Lso=ipe(),Fso=Ae("crypto"),$3t=class{detect(e){return{attributes:{[Lso.ATTR_SERVICE_INSTANCE_ID]:(0,Fso.randomUUID)()}}}};QDe.serviceInstanceIdDetector=new $3t});var TRr=w(uS=>{"use strict";Object.defineProperty(uS,"__esModule",{value:!0});uS.serviceInstanceIdDetector=uS.processDetector=uS.osDetector=uS.hostDetector=void 0;var Uso=bRr();Object.defineProperty(uS,"hostDetector",{enumerable:!0,get:function(){return Uso.hostDetector}});var Qso=xRr();Object.defineProperty(uS,"osDetector",{enumerable:!0,get:function(){return Qso.osDetector}});var qso=SRr();Object.defineProperty(uS,"processDetector",{enumerable:!0,get:function(){return qso.processDetector}});var Hso=wRr();Object.defineProperty(uS,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Hso.serviceInstanceIdDetector}})});var IRr=w(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});dS.serviceInstanceIdDetector=dS.processDetector=dS.osDetector=dS.hostDetector=void 0;var qDe=TRr();Object.defineProperty(dS,"hostDetector",{enumerable:!0,get:function(){return qDe.hostDetector}});Object.defineProperty(dS,"osDetector",{enumerable:!0,get:function(){return qDe.osDetector}});Object.defineProperty(dS,"processDetector",{enumerable:!0,get:function(){return qDe.processDetector}});Object.defineProperty(dS,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return qDe.serviceInstanceIdDetector}})});var DRr=w(RK=>{"use strict";Object.defineProperty(RK,"__esModule",{value:!0});RK.noopDetector=RK.NoopDetector=void 0;var HDe=class{detect(){return{attributes:{}}}};RK.NoopDetector=HDe;RK.noopDetector=new HDe});var RRr=w(w3=>{"use strict";Object.defineProperty(w3,"__esModule",{value:!0});w3.noopDetector=w3.serviceInstanceIdDetector=w3.processDetector=w3.osDetector=w3.hostDetector=w3.envDetector=void 0;var Gso=dRr();Object.defineProperty(w3,"envDetector",{enumerable:!0,get:function(){return Gso.envDetector}});var GDe=IRr();Object.defineProperty(w3,"hostDetector",{enumerable:!0,get:function(){return GDe.hostDetector}});Object.defineProperty(w3,"osDetector",{enumerable:!0,get:function(){return GDe.osDetector}});Object.defineProperty(w3,"processDetector",{enumerable:!0,get:function(){return GDe.processDetector}});Object.defineProperty(w3,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return GDe.serviceInstanceIdDetector}});var jso=DRr();Object.defineProperty(w3,"noopDetector",{enumerable:!0,get:function(){return jso.noopDetector}})});var z3t=w(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});Df.defaultServiceName=Df.emptyResource=Df.defaultResource=Df.resourceFromAttributes=Df.serviceInstanceIdDetector=Df.processDetector=Df.osDetector=Df.hostDetector=Df.envDetector=Df.detectResources=void 0;var Vso=lRr();Object.defineProperty(Df,"detectResources",{enumerable:!0,get:function(){return Vso.detectResources}});var ope=RRr();Object.defineProperty(Df,"envDetector",{enumerable:!0,get:function(){return ope.envDetector}});Object.defineProperty(Df,"hostDetector",{enumerable:!0,get:function(){return ope.hostDetector}});Object.defineProperty(Df,"osDetector",{enumerable:!0,get:function(){return ope.osDetector}});Object.defineProperty(Df,"processDetector",{enumerable:!0,get:function(){return ope.processDetector}});Object.defineProperty(Df,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return ope.serviceInstanceIdDetector}});var W3t=F3t();Object.defineProperty(Df,"resourceFromAttributes",{enumerable:!0,get:function(){return W3t.resourceFromAttributes}});Object.defineProperty(Df,"defaultResource",{enumerable:!0,get:function(){return W3t.defaultResource}});Object.defineProperty(Df,"emptyResource",{enumerable:!0,get:function(){return W3t.emptyResource}});var $so=P3t();Object.defineProperty(Df,"defaultServiceName",{enumerable:!0,get:function(){return $so.defaultServiceName}})});var BRr=w(spe=>{"use strict";Object.defineProperty(spe,"__esModule",{value:!0});spe.SeverityNumber=void 0;var Wso;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(Wso=spe.SeverityNumber||(spe.SeverityNumber={}))});var VDe=w(BK=>{"use strict";Object.defineProperty(BK,"__esModule",{value:!0});BK.NOOP_LOGGER=BK.NoopLogger=void 0;var jDe=class{emit(e){}};BK.NoopLogger=jDe;BK.NOOP_LOGGER=new jDe});var WDe=w(NK=>{"use strict";Object.defineProperty(NK,"__esModule",{value:!0});NK.NOOP_LOGGER_PROVIDER=NK.NoopLoggerProvider=void 0;var zso=VDe(),$De=class{getLogger(e,r,n){return new zso.NoopLogger}};NK.NoopLoggerProvider=$De;NK.NOOP_LOGGER_PROVIDER=new $De});var K3t=w(zDe=>{"use strict";Object.defineProperty(zDe,"__esModule",{value:!0});zDe.ProxyLogger=void 0;var Yso=VDe(),Y3t=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Yso.NOOP_LOGGER}};zDe.ProxyLogger=Y3t});var X3t=w(YDe=>{"use strict";Object.defineProperty(YDe,"__esModule",{value:!0});YDe.ProxyLoggerProvider=void 0;var Kso=WDe(),Jso=K3t(),J3t=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new Jso.ProxyLogger(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Kso.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}};YDe.ProxyLoggerProvider=J3t});var NRr=w(KDe=>{"use strict";Object.defineProperty(KDe,"__esModule",{value:!0});KDe._globalThis=void 0;KDe._globalThis=typeof globalThis=="object"?globalThis:global});var ORr=w(JDe=>{"use strict";Object.defineProperty(JDe,"__esModule",{value:!0});JDe._globalThis=void 0;var Xso=NRr();Object.defineProperty(JDe,"_globalThis",{enumerable:!0,get:function(){return Xso._globalThis}})});var kRr=w(XDe=>{"use strict";Object.defineProperty(XDe,"__esModule",{value:!0});XDe._globalThis=void 0;var Zso=ORr();Object.defineProperty(XDe,"_globalThis",{enumerable:!0,get:function(){return Zso._globalThis}})});var PRr=w(fS=>{"use strict";Object.defineProperty(fS,"__esModule",{value:!0});fS.API_BACKWARDS_COMPATIBILITY_VERSION=fS.makeGetter=fS._global=fS.GLOBAL_LOGS_API_KEY=void 0;var eao=kRr();fS.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");fS._global=eao._globalThis;function tao(t,e,r){return n=>n===t?e:r}fS.makeGetter=tao;fS.API_BACKWARDS_COMPATIBILITY_VERSION=1});var LRr=w(ZDe=>{"use strict";Object.defineProperty(ZDe,"__esModule",{value:!0});ZDe.LogsAPI=void 0;var Hv=PRr(),rao=WDe(),MRr=X3t(),Z3t=class t{constructor(){this._proxyLoggerProvider=new MRr.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Hv._global[Hv.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(Hv._global[Hv.GLOBAL_LOGS_API_KEY]=(0,Hv.makeGetter)(Hv.API_BACKWARDS_COMPATIBILITY_VERSION,e,rao.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=Hv._global[Hv.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(Hv._global,Hv.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete Hv._global[Hv.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new MRr.ProxyLoggerProvider}};ZDe.LogsAPI=Z3t});var QRr=w(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:!0});Um.logs=Um.ProxyLoggerProvider=Um.ProxyLogger=Um.NoopLoggerProvider=Um.NOOP_LOGGER_PROVIDER=Um.NoopLogger=Um.NOOP_LOGGER=Um.SeverityNumber=void 0;var nao=BRr();Object.defineProperty(Um,"SeverityNumber",{enumerable:!0,get:function(){return nao.SeverityNumber}});var FRr=VDe();Object.defineProperty(Um,"NOOP_LOGGER",{enumerable:!0,get:function(){return FRr.NOOP_LOGGER}});Object.defineProperty(Um,"NoopLogger",{enumerable:!0,get:function(){return FRr.NoopLogger}});var URr=WDe();Object.defineProperty(Um,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return URr.NOOP_LOGGER_PROVIDER}});Object.defineProperty(Um,"NoopLoggerProvider",{enumerable:!0,get:function(){return URr.NoopLoggerProvider}});var iao=K3t();Object.defineProperty(Um,"ProxyLogger",{enumerable:!0,get:function(){return iao.ProxyLogger}});var oao=X3t();Object.defineProperty(Um,"ProxyLoggerProvider",{enumerable:!0,get:function(){return oao.ProxyLoggerProvider}});var sao=LRr();Um.logs=sao.LogsAPI.getInstance()});var ape=w(fB=>{"use strict";Object.defineProperty(fB,"__esModule",{value:!0});fB.isTracingSuppressed=fB.unsuppressTracing=fB.suppressTracing=void 0;var aao=(Kt(),yt(ar)),eyt=(0,aao.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function cao(t){return t.setValue(eyt,!0)}fB.suppressTracing=cao;function lao(t){return t.deleteValue(eyt)}fB.unsuppressTracing=lao;function uao(t){return t.getValue(eyt)===!0}fB.isTracingSuppressed=uao});var tyt=w(E2=>{"use strict";Object.defineProperty(E2,"__esModule",{value:!0});E2.BAGGAGE_MAX_TOTAL_LENGTH=E2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=E2.BAGGAGE_MAX_NAME_VALUE_PAIRS=E2.BAGGAGE_HEADER=E2.BAGGAGE_ITEMS_SEPARATOR=E2.BAGGAGE_PROPERTIES_SEPARATOR=E2.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;E2.BAGGAGE_KEY_PAIR_SEPARATOR="=";E2.BAGGAGE_PROPERTIES_SEPARATOR=";";E2.BAGGAGE_ITEMS_SEPARATOR=",";E2.BAGGAGE_HEADER="baggage";E2.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;E2.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;E2.BAGGAGE_MAX_TOTAL_LENGTH=8192});var ryt=w(pS=>{"use strict";Object.defineProperty(pS,"__esModule",{value:!0});pS.parseKeyPairsIntoRecord=pS.parsePairKeyValue=pS.getKeyPairs=pS.serializeKeyPairs=void 0;var dao=(Kt(),yt(ar)),RF=tyt();function fao(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?RF.BAGGAGE_ITEMS_SEPARATOR:""}${r}`;return n.length>RF.BAGGAGE_MAX_TOTAL_LENGTH?e:n},"")}pS.serializeKeyPairs=fao;function pao(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=RF.BAGGAGE_PROPERTIES_SEPARATOR+r.metadata.toString()),n})}pS.getKeyPairs=pao;function qRr(t){let e=t.split(RF.BAGGAGE_PROPERTIES_SEPARATOR);if(e.length<=0)return;let r=e.shift();if(!r)return;let n=r.indexOf(RF.BAGGAGE_KEY_PAIR_SEPARATOR);if(n<=0)return;let i=decodeURIComponent(r.substring(0,n).trim()),o=decodeURIComponent(r.substring(n+1).trim()),s;return e.length>0&&(s=(0,dao.baggageEntryMetadataFromString)(e.join(RF.BAGGAGE_PROPERTIES_SEPARATOR))),{key:i,value:o,metadata:s}}pS.parsePairKeyValue=qRr;function hao(t){let e={};return typeof t=="string"&&t.length>0&&t.split(RF.BAGGAGE_ITEMS_SEPARATOR).forEach(r=>{let n=qRr(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}pS.parseKeyPairsIntoRecord=hao});var HRr=w(eRe=>{"use strict";Object.defineProperty(eRe,"__esModule",{value:!0});eRe.W3CBaggagePropagator=void 0;var nyt=(Kt(),yt(ar)),mao=ape(),BF=tyt(),iyt=ryt(),oyt=class{inject(e,r,n){let i=nyt.propagation.getBaggage(e);if(!i||(0,mao.isTracingSuppressed)(e))return;let o=(0,iyt.getKeyPairs)(i).filter(a=>a.length<=BF.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,BF.BAGGAGE_MAX_NAME_VALUE_PAIRS),s=(0,iyt.serializeKeyPairs)(o);s.length>0&&n.set(r,BF.BAGGAGE_HEADER,s)}extract(e,r,n){let i=n.get(r,BF.BAGGAGE_HEADER),o=Array.isArray(i)?i.join(BF.BAGGAGE_ITEMS_SEPARATOR):i;if(!o)return e;let s={};return o.length===0||(o.split(BF.BAGGAGE_ITEMS_SEPARATOR).forEach(c=>{let u=(0,iyt.parsePairKeyValue)(c);if(u){let d={value:u.value};u.metadata&&(d.metadata=u.metadata),s[u.key]=d}}),Object.entries(s).length===0)?e:nyt.propagation.setBaggage(e,nyt.propagation.createBaggage(s))}fields(){return[BF.BAGGAGE_HEADER]}};eRe.W3CBaggagePropagator=oyt});var GRr=w(tRe=>{"use strict";Object.defineProperty(tRe,"__esModule",{value:!0});tRe.AnchoredClock=void 0;var syt=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,r){this._monotonicClock=r,this._epochMillis=e.now(),this._performanceMillis=r.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}};tRe.AnchoredClock=syt});var zRr=w(pB=>{"use strict";Object.defineProperty(pB,"__esModule",{value:!0});pB.isAttributeValue=pB.isAttributeKey=pB.sanitizeAttributes=void 0;var jRr=(Kt(),yt(ar));function gao(t){let e={};if(typeof t!="object"||t==null)return e;for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!VRr(r)){jRr.diag.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!$Rr(n)){jRr.diag.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}pB.sanitizeAttributes=gao;function VRr(t){return typeof t=="string"&&t!==""}pB.isAttributeKey=VRr;function $Rr(t){return t==null?!0:Array.isArray(t)?Aao(t):WRr(typeof t)}pB.isAttributeValue=$Rr;function Aao(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(WRr(n)){e=n;continue}return!1}return!1}}return!0}function WRr(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var ayt=w(rRe=>{"use strict";Object.defineProperty(rRe,"__esModule",{value:!0});rRe.loggingErrorHandler=void 0;var yao=(Kt(),yt(ar));function Eao(){return t=>{yao.diag.error(vao(t))}}rRe.loggingErrorHandler=Eao;function vao(t){return typeof t=="string"?t:JSON.stringify(bao(t))}function bao(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let i=r[n];i&&(e[n]=String(i))}),r=Object.getPrototypeOf(r);return e}});var KRr=w(OK=>{"use strict";Object.defineProperty(OK,"__esModule",{value:!0});OK.globalErrorHandler=OK.setGlobalErrorHandler=void 0;var Cao=ayt(),YRr=(0,Cao.loggingErrorHandler)();function _ao(t){YRr=t}OK.setGlobalErrorHandler=_ao;function xao(t){try{YRr(t)}catch{}}OK.globalErrorHandler=xao});var eBr=w(hS=>{"use strict";Object.defineProperty(hS,"__esModule",{value:!0});hS.getStringListFromEnv=hS.getBooleanFromEnv=hS.getStringFromEnv=hS.getNumberFromEnv=void 0;var JRr=(Kt(),yt(ar)),XRr=Ae("util");function Sao(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){JRr.diag.warn(`Unknown value ${(0,XRr.inspect)(e)} for ${t}, expected a number, using defaults`);return}return r}hS.getNumberFromEnv=Sao;function ZRr(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}hS.getStringFromEnv=ZRr;function wao(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||JRr.diag.warn(`Unknown value ${(0,XRr.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}hS.getBooleanFromEnv=wao;function Tao(t){return ZRr(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}hS.getStringListFromEnv=Tao});var tBr=w(nRe=>{"use strict";Object.defineProperty(nRe,"__esModule",{value:!0});nRe._globalThis=void 0;nRe._globalThis=typeof globalThis=="object"?globalThis:global});var rBr=w(iRe=>{"use strict";Object.defineProperty(iRe,"__esModule",{value:!0});iRe.otperformance=void 0;var Iao=Ae("perf_hooks");iRe.otperformance=Iao.performance});var nBr=w(oRe=>{"use strict";Object.defineProperty(oRe,"__esModule",{value:!0});oRe.VERSION=void 0;oRe.VERSION="2.2.0"});var iBr=w(sRe=>{"use strict";Object.defineProperty(sRe,"__esModule",{value:!0});sRe.ATTR_PROCESS_RUNTIME_NAME=void 0;sRe.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var oBr=w(cRe=>{"use strict";Object.defineProperty(cRe,"__esModule",{value:!0});cRe.SDK_INFO=void 0;var Dao=nBr(),aRe=(Oh(),yt(u2)),Rao=iBr();cRe.SDK_INFO={[aRe.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[Rao.ATTR_PROCESS_RUNTIME_NAME]:"node",[aRe.ATTR_TELEMETRY_SDK_LANGUAGE]:aRe.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[aRe.ATTR_TELEMETRY_SDK_VERSION]:Dao.VERSION}});var sBr=w(v2=>{"use strict";Object.defineProperty(v2,"__esModule",{value:!0});v2.SDK_INFO=v2.otperformance=v2._globalThis=v2.getStringListFromEnv=v2.getNumberFromEnv=v2.getBooleanFromEnv=v2.getStringFromEnv=void 0;var lRe=eBr();Object.defineProperty(v2,"getStringFromEnv",{enumerable:!0,get:function(){return lRe.getStringFromEnv}});Object.defineProperty(v2,"getBooleanFromEnv",{enumerable:!0,get:function(){return lRe.getBooleanFromEnv}});Object.defineProperty(v2,"getNumberFromEnv",{enumerable:!0,get:function(){return lRe.getNumberFromEnv}});Object.defineProperty(v2,"getStringListFromEnv",{enumerable:!0,get:function(){return lRe.getStringListFromEnv}});var Bao=tBr();Object.defineProperty(v2,"_globalThis",{enumerable:!0,get:function(){return Bao._globalThis}});var Nao=rBr();Object.defineProperty(v2,"otperformance",{enumerable:!0,get:function(){return Nao.otperformance}});var Oao=oBr();Object.defineProperty(v2,"SDK_INFO",{enumerable:!0,get:function(){return Oao.SDK_INFO}})});var cyt=w(b2=>{"use strict";Object.defineProperty(b2,"__esModule",{value:!0});b2.getStringListFromEnv=b2.getNumberFromEnv=b2.getStringFromEnv=b2.getBooleanFromEnv=b2.otperformance=b2._globalThis=b2.SDK_INFO=void 0;var NF=sBr();Object.defineProperty(b2,"SDK_INFO",{enumerable:!0,get:function(){return NF.SDK_INFO}});Object.defineProperty(b2,"_globalThis",{enumerable:!0,get:function(){return NF._globalThis}});Object.defineProperty(b2,"otperformance",{enumerable:!0,get:function(){return NF.otperformance}});Object.defineProperty(b2,"getBooleanFromEnv",{enumerable:!0,get:function(){return NF.getBooleanFromEnv}});Object.defineProperty(b2,"getStringFromEnv",{enumerable:!0,get:function(){return NF.getStringFromEnv}});Object.defineProperty(b2,"getNumberFromEnv",{enumerable:!0,get:function(){return NF.getNumberFromEnv}});Object.defineProperty(b2,"getStringListFromEnv",{enumerable:!0,get:function(){return NF.getStringListFromEnv}})});var uBr=w(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.addHrTimes=mu.isTimeInput=mu.isTimeInputHrTime=mu.hrTimeToMicroseconds=mu.hrTimeToMilliseconds=mu.hrTimeToNanoseconds=mu.hrTimeToTimeStamp=mu.hrTimeDuration=mu.timeInputToHrTime=mu.hrTime=mu.getTimeOrigin=mu.millisToHrTime=void 0;var lyt=cyt(),aBr=9,kao=6,Pao=Math.pow(10,kao),uRe=Math.pow(10,aBr);function cpe(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*Pao);return[r,n]}mu.millisToHrTime=cpe;function uyt(){let t=lyt.otperformance.timeOrigin;if(typeof t!="number"){let e=lyt.otperformance;t=e.timing&&e.timing.fetchStart}return t}mu.getTimeOrigin=uyt;function cBr(t){let e=cpe(uyt()),r=cpe(typeof t=="number"?t:lyt.otperformance.now());return lBr(e,r)}mu.hrTime=cBr;function Mao(t){if(dyt(t))return t;if(typeof t=="number")return t<uyt()?cBr(t):cpe(t);if(t instanceof Date)return cpe(t.getTime());throw TypeError("Invalid input type")}mu.timeInputToHrTime=Mao;function Lao(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=uRe),[r,n]}mu.hrTimeDuration=Lao;function Fao(t){let e=aBr,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}mu.hrTimeToTimeStamp=Fao;function Uao(t){return t[0]*uRe+t[1]}mu.hrTimeToNanoseconds=Uao;function Qao(t){return t[0]*1e3+t[1]/1e6}mu.hrTimeToMilliseconds=Qao;function qao(t){return t[0]*1e6+t[1]/1e3}mu.hrTimeToMicroseconds=qao;function dyt(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}mu.isTimeInputHrTime=dyt;function Hao(t){return dyt(t)||typeof t=="number"||t instanceof Date}mu.isTimeInput=Hao;function lBr(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=uRe&&(r[1]-=uRe,r[0]+=1),r}mu.addHrTimes=lBr});var dBr=w(dRe=>{"use strict";Object.defineProperty(dRe,"__esModule",{value:!0});dRe.unrefTimer=void 0;function Gao(t){typeof t!="number"&&t.unref()}dRe.unrefTimer=Gao});var fBr=w(lpe=>{"use strict";Object.defineProperty(lpe,"__esModule",{value:!0});lpe.ExportResultCode=void 0;var jao;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(jao=lpe.ExportResultCode||(lpe.ExportResultCode={}))});var hBr=w(fRe=>{"use strict";Object.defineProperty(fRe,"__esModule",{value:!0});fRe.CompositePropagator=void 0;var pBr=(Kt(),yt(ar)),fyt=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[],this._fields=Array.from(new Set(this._propagators.map(r=>typeof r.fields=="function"?r.fields():[]).reduce((r,n)=>r.concat(n),[])))}inject(e,r,n){for(let i of this._propagators)try{i.inject(e,r,n)}catch(o){pBr.diag.warn(`Failed to inject with ${i.constructor.name}. Err: ${o.message}`)}}extract(e,r,n){return this._propagators.reduce((i,o)=>{try{return o.extract(i,r,n)}catch(s){pBr.diag.warn(`Failed to extract with ${o.constructor.name}. Err: ${s.message}`)}return i},e)}fields(){return this._fields.slice()}};fRe.CompositePropagator=fyt});var mBr=w(kK=>{"use strict";Object.defineProperty(kK,"__esModule",{value:!0});kK.validateValue=kK.validateKey=void 0;var pyt="[_0-9a-z-*/]",Vao=`[a-z]${pyt}{0,255}`,$ao=`[a-z0-9]${pyt}{0,240}@[a-z]${pyt}{0,13}`,Wao=new RegExp(`^(?:${Vao}|${$ao})$`),zao=/^[ -~]{0,255}[!-~]$/,Yao=/,|=/;function Kao(t){return Wao.test(t)}kK.validateKey=Kao;function Jao(t){return zao.test(t)&&!Yao.test(t)}kK.validateValue=Jao});var myt=w(pRe=>{"use strict";Object.defineProperty(pRe,"__esModule",{value:!0});pRe.TraceState=void 0;var gBr=mBr(),ABr=32,Xao=512,yBr=",",EBr="=",hyt=class t{_internalState=new Map;constructor(e){e&&this._parse(e)}set(e,r){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n}unset(e){let r=this._clone();return r._internalState.delete(e),r}get(e){return this._internalState.get(e)}serialize(){return this._keys().reduce((e,r)=>(e.push(r+EBr+this.get(r)),e),[]).join(yBr)}_parse(e){e.length>Xao||(this._internalState=e.split(yBr).reverse().reduce((r,n)=>{let i=n.trim(),o=i.indexOf(EBr);if(o!==-1){let s=i.slice(0,o),a=i.slice(o+1,n.length);(0,gBr.validateKey)(s)&&(0,gBr.validateValue)(a)&&r.set(s,a)}return r},new Map),this._internalState.size>ABr&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,ABr))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};pRe.TraceState=hyt});var bBr=w(C2=>{"use strict";Object.defineProperty(C2,"__esModule",{value:!0});C2.W3CTraceContextPropagator=C2.parseTraceParent=C2.TRACE_STATE_HEADER=C2.TRACE_PARENT_HEADER=void 0;var hRe=(Kt(),yt(ar)),Zao=ape(),eco=myt();C2.TRACE_PARENT_HEADER="traceparent";C2.TRACE_STATE_HEADER="tracestate";var tco="00",rco="(?!ff)[\\da-f]{2}",nco="(?![0]{32})[\\da-f]{32}",ico="(?![0]{16})[\\da-f]{16}",oco="[\\da-f]{2}",sco=new RegExp(`^\\s?(${rco})-(${nco})-(${ico})-(${oco})(-.*)?\\s?$`);function vBr(t){let e=sco.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}C2.parseTraceParent=vBr;var gyt=class{inject(e,r,n){let i=hRe.trace.getSpanContext(e);if(!i||(0,Zao.isTracingSuppressed)(e)||!(0,hRe.isSpanContextValid)(i))return;let o=`${tco}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||hRe.TraceFlags.NONE).toString(16)}`;n.set(r,C2.TRACE_PARENT_HEADER,o),i.traceState&&n.set(r,C2.TRACE_STATE_HEADER,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,C2.TRACE_PARENT_HEADER);if(!i)return e;let o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;let s=vBr(o);if(!s)return e;s.isRemote=!0;let a=n.get(r,C2.TRACE_STATE_HEADER);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new eco.TraceState(typeof c=="string"?c:void 0)}return hRe.trace.setSpanContext(e,s)}fields(){return[C2.TRACE_PARENT_HEADER,C2.TRACE_STATE_HEADER]}};C2.W3CTraceContextPropagator=gyt});var CBr=w(JC=>{"use strict";Object.defineProperty(JC,"__esModule",{value:!0});JC.getRPCMetadata=JC.deleteRPCMetadata=JC.setRPCMetadata=JC.RPCType=void 0;var aco=(Kt(),yt(ar)),Ayt=(0,aco.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),cco;(function(t){t.HTTP="http"})(cco=JC.RPCType||(JC.RPCType={}));function lco(t,e){return t.setValue(Ayt,e)}JC.setRPCMetadata=lco;function uco(t){return t.deleteValue(Ayt)}JC.deleteRPCMetadata=uco;function dco(t){return t.getValue(Ayt)}JC.getRPCMetadata=dco});var TBr=w(mRe=>{"use strict";Object.defineProperty(mRe,"__esModule",{value:!0});mRe.isPlainObject=void 0;var fco="[object Object]",pco="[object Null]",hco="[object Undefined]",mco=Function.prototype,_Br=mco.toString,gco=_Br.call(Object),Aco=Object.getPrototypeOf,xBr=Object.prototype,SBr=xBr.hasOwnProperty,OF=Symbol?Symbol.toStringTag:void 0,wBr=xBr.toString;function yco(t){if(!Eco(t)||vco(t)!==fco)return!1;let e=Aco(t);if(e===null)return!0;let r=SBr.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&_Br.call(r)===gco}mRe.isPlainObject=yco;function Eco(t){return t!=null&&typeof t=="object"}function vco(t){return t==null?t===void 0?hco:pco:OF&&OF in Object(t)?bco(t):Cco(t)}function bco(t){let e=SBr.call(t,OF),r=t[OF],n=!1;try{t[OF]=void 0,n=!0}catch{}let i=wBr.call(t);return n&&(e?t[OF]=r:delete t[OF]),i}function Cco(t){return wBr.call(t)}});var NBr=w(yRe=>{"use strict";Object.defineProperty(yRe,"__esModule",{value:!0});yRe.merge=void 0;var IBr=TBr(),_co=20;function xco(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=RBr(e,t.shift(),0,r);return e}yRe.merge=xco;function yyt(t){return ARe(t)?t.slice():t}function RBr(t,e,r=0,n){let i;if(!(r>_co)){if(r++,gRe(t)||gRe(e)||BBr(e))i=yyt(e);else if(ARe(t)){if(i=t.slice(),ARe(e))for(let o=0,s=e.length;o<s;o++)i.push(yyt(e[o]));else if(upe(e)){let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s];i[c]=yyt(e[c])}}}else if(upe(t))if(upe(e)){if(!Sco(t,e))return e;i=Object.assign({},t);let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s],u=e[c];if(gRe(u))typeof u>"u"?delete i[c]:i[c]=u;else{let d=i[c],f=u;if(DBr(t,c,n)||DBr(e,c,n))delete i[c];else{if(upe(d)&&upe(f)){let p=n.get(d)||[],h=n.get(f)||[];p.push({obj:t,key:c}),h.push({obj:e,key:c}),n.set(d,p),n.set(f,h)}i[c]=RBr(i[c],u,r,n)}}}}else i=e;return i}}function DBr(t,e,r){let n=r.get(t[e])||[];for(let i=0,o=n.length;i<o;i++){let s=n[i];if(s.key===e&&s.obj===t)return!0}return!1}function ARe(t){return Array.isArray(t)}function BBr(t){return typeof t=="function"}function upe(t){return!gRe(t)&&!ARe(t)&&!BBr(t)&&typeof t=="object"}function gRe(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function Sco(t,e){return!(!(0,IBr.isPlainObject)(t)||!(0,IBr.isPlainObject)(e))}});var OBr=w(PK=>{"use strict";Object.defineProperty(PK,"__esModule",{value:!0});PK.callWithTimeout=PK.TimeoutError=void 0;var ERe=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};PK.TimeoutError=ERe;function wco(t,e){let r,n=new Promise(function(o,s){r=setTimeout(function(){s(new ERe("Operation timed out."))},e)});return Promise.race([t,n]).then(i=>(clearTimeout(r),i),i=>{throw clearTimeout(r),i})}PK.callWithTimeout=wco});var PBr=w(MK=>{"use strict";Object.defineProperty(MK,"__esModule",{value:!0});MK.isUrlIgnored=MK.urlMatches=void 0;function kBr(t,e){return typeof e=="string"?t===e:!!t.match(e)}MK.urlMatches=kBr;function Tco(t,e){if(!e)return!1;for(let r of e)if(kBr(t,r))return!0;return!1}MK.isUrlIgnored=Tco});var MBr=w(vRe=>{"use strict";Object.defineProperty(vRe,"__esModule",{value:!0});vRe.Deferred=void 0;var Eyt=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};vRe.Deferred=Eyt});var LBr=w(bRe=>{"use strict";Object.defineProperty(bRe,"__esModule",{value:!0});bRe.BindOnceFuture=void 0;var Ico=MBr(),vyt=class{_callback;_that;_isCalled=!1;_deferred=new Ico.Deferred;constructor(e,r){this._callback=e,this._that=r}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};bRe.BindOnceFuture=vyt});var UBr=w(CRe=>{"use strict";Object.defineProperty(CRe,"__esModule",{value:!0});CRe.diagLogLevelFromString=void 0;var pT=(Kt(),yt(ar)),FBr={ALL:pT.DiagLogLevel.ALL,VERBOSE:pT.DiagLogLevel.VERBOSE,DEBUG:pT.DiagLogLevel.DEBUG,INFO:pT.DiagLogLevel.INFO,WARN:pT.DiagLogLevel.WARN,ERROR:pT.DiagLogLevel.ERROR,NONE:pT.DiagLogLevel.NONE};function Dco(t){if(t==null)return;let e=FBr[t.toUpperCase()];return e??(pT.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(FBr)}, using default`),pT.DiagLogLevel.INFO)}CRe.diagLogLevelFromString=Dco});var qBr=w(_Re=>{"use strict";Object.defineProperty(_Re,"__esModule",{value:!0});_Re._export=void 0;var QBr=(Kt(),yt(ar)),Rco=ape();function Bco(t,e){return new Promise(r=>{QBr.context.with((0,Rco.suppressTracing)(QBr.context.active()),()=>{t.export(e,n=>{r(n)})})})}_Re._export=Bco});var hT=w(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.internal=Lr.diagLogLevelFromString=Lr.BindOnceFuture=Lr.urlMatches=Lr.isUrlIgnored=Lr.callWithTimeout=Lr.TimeoutError=Lr.merge=Lr.TraceState=Lr.unsuppressTracing=Lr.suppressTracing=Lr.isTracingSuppressed=Lr.setRPCMetadata=Lr.getRPCMetadata=Lr.deleteRPCMetadata=Lr.RPCType=Lr.parseTraceParent=Lr.W3CTraceContextPropagator=Lr.TRACE_STATE_HEADER=Lr.TRACE_PARENT_HEADER=Lr.CompositePropagator=Lr.otperformance=Lr.getStringListFromEnv=Lr.getNumberFromEnv=Lr.getBooleanFromEnv=Lr.getStringFromEnv=Lr._globalThis=Lr.SDK_INFO=Lr.parseKeyPairsIntoRecord=Lr.ExportResultCode=Lr.unrefTimer=Lr.timeInputToHrTime=Lr.millisToHrTime=Lr.isTimeInputHrTime=Lr.isTimeInput=Lr.hrTimeToTimeStamp=Lr.hrTimeToNanoseconds=Lr.hrTimeToMilliseconds=Lr.hrTimeToMicroseconds=Lr.hrTimeDuration=Lr.hrTime=Lr.getTimeOrigin=Lr.addHrTimes=Lr.loggingErrorHandler=Lr.setGlobalErrorHandler=Lr.globalErrorHandler=Lr.sanitizeAttributes=Lr.isAttributeValue=Lr.AnchoredClock=Lr.W3CBaggagePropagator=void 0;var Nco=HRr();Object.defineProperty(Lr,"W3CBaggagePropagator",{enumerable:!0,get:function(){return Nco.W3CBaggagePropagator}});var Oco=GRr();Object.defineProperty(Lr,"AnchoredClock",{enumerable:!0,get:function(){return Oco.AnchoredClock}});var HBr=zRr();Object.defineProperty(Lr,"isAttributeValue",{enumerable:!0,get:function(){return HBr.isAttributeValue}});Object.defineProperty(Lr,"sanitizeAttributes",{enumerable:!0,get:function(){return HBr.sanitizeAttributes}});var GBr=KRr();Object.defineProperty(Lr,"globalErrorHandler",{enumerable:!0,get:function(){return GBr.globalErrorHandler}});Object.defineProperty(Lr,"setGlobalErrorHandler",{enumerable:!0,get:function(){return GBr.setGlobalErrorHandler}});var kco=ayt();Object.defineProperty(Lr,"loggingErrorHandler",{enumerable:!0,get:function(){return kco.loggingErrorHandler}});var Gv=uBr();Object.defineProperty(Lr,"addHrTimes",{enumerable:!0,get:function(){return Gv.addHrTimes}});Object.defineProperty(Lr,"getTimeOrigin",{enumerable:!0,get:function(){return Gv.getTimeOrigin}});Object.defineProperty(Lr,"hrTime",{enumerable:!0,get:function(){return Gv.hrTime}});Object.defineProperty(Lr,"hrTimeDuration",{enumerable:!0,get:function(){return Gv.hrTimeDuration}});Object.defineProperty(Lr,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return Gv.hrTimeToMicroseconds}});Object.defineProperty(Lr,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return Gv.hrTimeToMilliseconds}});Object.defineProperty(Lr,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return Gv.hrTimeToNanoseconds}});Object.defineProperty(Lr,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return Gv.hrTimeToTimeStamp}});Object.defineProperty(Lr,"isTimeInput",{enumerable:!0,get:function(){return Gv.isTimeInput}});Object.defineProperty(Lr,"isTimeInputHrTime",{enumerable:!0,get:function(){return Gv.isTimeInputHrTime}});Object.defineProperty(Lr,"millisToHrTime",{enumerable:!0,get:function(){return Gv.millisToHrTime}});Object.defineProperty(Lr,"timeInputToHrTime",{enumerable:!0,get:function(){return Gv.timeInputToHrTime}});var Pco=dBr();Object.defineProperty(Lr,"unrefTimer",{enumerable:!0,get:function(){return Pco.unrefTimer}});var Mco=fBr();Object.defineProperty(Lr,"ExportResultCode",{enumerable:!0,get:function(){return Mco.ExportResultCode}});var Lco=ryt();Object.defineProperty(Lr,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return Lco.parseKeyPairsIntoRecord}});var kF=cyt();Object.defineProperty(Lr,"SDK_INFO",{enumerable:!0,get:function(){return kF.SDK_INFO}});Object.defineProperty(Lr,"_globalThis",{enumerable:!0,get:function(){return kF._globalThis}});Object.defineProperty(Lr,"getStringFromEnv",{enumerable:!0,get:function(){return kF.getStringFromEnv}});Object.defineProperty(Lr,"getBooleanFromEnv",{enumerable:!0,get:function(){return kF.getBooleanFromEnv}});Object.defineProperty(Lr,"getNumberFromEnv",{enumerable:!0,get:function(){return kF.getNumberFromEnv}});Object.defineProperty(Lr,"getStringListFromEnv",{enumerable:!0,get:function(){return kF.getStringListFromEnv}});Object.defineProperty(Lr,"otperformance",{enumerable:!0,get:function(){return kF.otperformance}});var Fco=hBr();Object.defineProperty(Lr,"CompositePropagator",{enumerable:!0,get:function(){return Fco.CompositePropagator}});var xRe=bBr();Object.defineProperty(Lr,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return xRe.TRACE_PARENT_HEADER}});Object.defineProperty(Lr,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return xRe.TRACE_STATE_HEADER}});Object.defineProperty(Lr,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return xRe.W3CTraceContextPropagator}});Object.defineProperty(Lr,"parseTraceParent",{enumerable:!0,get:function(){return xRe.parseTraceParent}});var SRe=CBr();Object.defineProperty(Lr,"RPCType",{enumerable:!0,get:function(){return SRe.RPCType}});Object.defineProperty(Lr,"deleteRPCMetadata",{enumerable:!0,get:function(){return SRe.deleteRPCMetadata}});Object.defineProperty(Lr,"getRPCMetadata",{enumerable:!0,get:function(){return SRe.getRPCMetadata}});Object.defineProperty(Lr,"setRPCMetadata",{enumerable:!0,get:function(){return SRe.setRPCMetadata}});var byt=ape();Object.defineProperty(Lr,"isTracingSuppressed",{enumerable:!0,get:function(){return byt.isTracingSuppressed}});Object.defineProperty(Lr,"suppressTracing",{enumerable:!0,get:function(){return byt.suppressTracing}});Object.defineProperty(Lr,"unsuppressTracing",{enumerable:!0,get:function(){return byt.unsuppressTracing}});var Uco=myt();Object.defineProperty(Lr,"TraceState",{enumerable:!0,get:function(){return Uco.TraceState}});var Qco=NBr();Object.defineProperty(Lr,"merge",{enumerable:!0,get:function(){return Qco.merge}});var jBr=OBr();Object.defineProperty(Lr,"TimeoutError",{enumerable:!0,get:function(){return jBr.TimeoutError}});Object.defineProperty(Lr,"callWithTimeout",{enumerable:!0,get:function(){return jBr.callWithTimeout}});var VBr=PBr();Object.defineProperty(Lr,"isUrlIgnored",{enumerable:!0,get:function(){return VBr.isUrlIgnored}});Object.defineProperty(Lr,"urlMatches",{enumerable:!0,get:function(){return VBr.urlMatches}});var qco=LBr();Object.defineProperty(Lr,"BindOnceFuture",{enumerable:!0,get:function(){return qco.BindOnceFuture}});var Hco=UBr();Object.defineProperty(Lr,"diagLogLevelFromString",{enumerable:!0,get:function(){return Hco.diagLogLevelFromString}});var Gco=qBr();Lr.internal={_export:Gco._export}});var $Br=w(TRe=>{"use strict";Object.defineProperty(TRe,"__esModule",{value:!0});TRe.LogRecordImpl=void 0;var PF=(Kt(),yt(ar)),wRe=hT(),Cyt=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;totalAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,r,n){let{timestamp:i,observedTimestamp:o,eventName:s,severityNumber:a,severityText:c,body:u,attributes:d={},context:f}=n,p=Date.now();if(this.hrTime=(0,wRe.timeInputToHrTime)(i??p),this.hrTimeObserved=(0,wRe.timeInputToHrTime)(o??p),f){let h=PF.trace.getSpanContext(f);h&&PF.isSpanContextValid(h)&&(this.spanContext=h)}this.severityNumber=a,this.severityText=c,this.body=u,this.resource=e.resource,this.instrumentationScope=r,this._logRecordLimits=e.logRecordLimits,this._eventName=s,this.setAttributes(d)}setAttribute(e,r){return this._isLogRecordReadonly()?this:r===null?this:e.length===0?(PF.diag.warn(`Invalid attribute key: ${e}`),this):!(0,wRe.isAttributeValue)(r)&&!(typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length>0)?(PF.diag.warn(`Invalid attribute value set for key: ${e}`),this):(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?(this.droppedAttributesCount===1&&PF.diag.warn("Dropping extra attributes."),this):((0,wRe.isAttributeValue)(r)?this.attributes[e]=this._truncateToSize(r):this.attributes[e]=r,this))}setAttributes(e){for(let[r,n]of Object.entries(e))this.setAttribute(r,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let r=this._logRecordLimits.attributeValueLengthLimit;return r<=0?(PF.diag.warn(`Attribute value limit must be positive, got ${r}`),e):typeof e=="string"?this._truncateToLimitUtil(e,r):Array.isArray(e)?e.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):e}_truncateToLimitUtil(e,r){return e.length<=r?e:e.substring(0,r)}_isLogRecordReadonly(){return this._isReadonly&&PF.diag.warn("Can not execute the operation on emitted log record"),this._isReadonly}};TRe.LogRecordImpl=Cyt});var WBr=w(IRe=>{"use strict";Object.defineProperty(IRe,"__esModule",{value:!0});IRe.Logger=void 0;var jco=(Kt(),yt(ar)),Vco=$Br(),_yt=class{instrumentationScope;_sharedState;constructor(e,r){this.instrumentationScope=e,this._sharedState=r}emit(e){let r=e.context||jco.context.active(),n=new Vco.LogRecordImpl(this._sharedState,this.instrumentationScope,{context:r,...e});this._sharedState.activeProcessor.onEmit(n,r),n._makeReadonly()}};IRe.Logger=_yt});var zBr=w(FK=>{"use strict";Object.defineProperty(FK,"__esModule",{value:!0});FK.reconfigureLimits=FK.loadDefaultConfig=void 0;var LK=hT();function $co(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:(0,LK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,LK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??128},includeTraceContext:!0}}FK.loadDefaultConfig=$co;function Wco(t){return{attributeCountLimit:t.attributeCountLimit??(0,LK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??(0,LK.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128,attributeValueLengthLimit:t.attributeValueLengthLimit??(0,LK.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,LK.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0}}FK.reconfigureLimits=Wco});var Syt=w(DRe=>{"use strict";Object.defineProperty(DRe,"__esModule",{value:!0});DRe.NoopLogRecordProcessor=void 0;var xyt=class{forceFlush(){return Promise.resolve()}onEmit(e,r){}shutdown(){return Promise.resolve()}};DRe.NoopLogRecordProcessor=xyt});var YBr=w(RRe=>{"use strict";Object.defineProperty(RRe,"__esModule",{value:!0});RRe.MultiLogRecordProcessor=void 0;var zco=hT(),wyt=class{processors;forceFlushTimeoutMillis;constructor(e,r){this.processors=e,this.forceFlushTimeoutMillis=r}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(r=>(0,zco.callWithTimeout)(r.forceFlush(),e)))}onEmit(e,r){this.processors.forEach(n=>n.onEmit(e,r))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}};RRe.MultiLogRecordProcessor=wyt});var KBr=w(BRe=>{"use strict";Object.defineProperty(BRe,"__esModule",{value:!0});BRe.LoggerProviderSharedState=void 0;var Yco=Syt(),Kco=YBr(),Tyt=class{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,r,n,i){this.resource=e,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=i,i.length>0?(this.registeredLogRecordProcessors=i,this.activeProcessor=new Kco.MultiLogRecordProcessor(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Yco.NoopLogRecordProcessor}};BRe.LoggerProviderSharedState=Tyt});var ZBr=w(MF=>{"use strict";Object.defineProperty(MF,"__esModule",{value:!0});MF.LoggerProvider=MF.DEFAULT_LOGGER_NAME=void 0;var NRe=(Kt(),yt(ar)),Jco=QRr(),Xco=z3t(),JBr=hT(),Zco=WBr(),XBr=zBr(),elo=KBr();MF.DEFAULT_LOGGER_NAME="unknown";var Iyt=class{_shutdownOnce;_sharedState;constructor(e={}){let r=(0,JBr.merge)({},(0,XBr.loadDefaultConfig)(),e),n=e.resource??(0,Xco.defaultResource)();this._sharedState=new elo.LoggerProviderSharedState(n,r.forceFlushTimeoutMillis,(0,XBr.reconfigureLimits)(r.logRecordLimits),e?.processors??[]),this._shutdownOnce=new JBr.BindOnceFuture(this._shutdown,this)}getLogger(e,r,n){if(this._shutdownOnce.isCalled)return NRe.diag.warn("A shutdown LoggerProvider cannot provide a Logger"),Jco.NOOP_LOGGER;e||NRe.diag.warn("Logger requested without instrumentation scope name.");let i=e||MF.DEFAULT_LOGGER_NAME,o=`${i}@${r||""}:${n?.schemaUrl||""}`;return this._sharedState.loggers.has(o)||this._sharedState.loggers.set(o,new Zco.Logger({name:i,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(o)}forceFlush(){return this._shutdownOnce.isCalled?(NRe.diag.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(NRe.diag.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};MF.LoggerProvider=Iyt});var tNr=w(ORe=>{"use strict";Object.defineProperty(ORe,"__esModule",{value:!0});ORe.ConsoleLogRecordExporter=void 0;var eNr=hT(),Dyt=class{export(e,r){this._sendLogRecords(e,r)}shutdown(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:(0,eNr.hrTimeToMicroseconds)(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,body:e.body,attributes:e.attributes}}_sendLogRecords(e,r){for(let n of e)console.dir(this._exportInfo(n),{depth:3});r?.({code:eNr.ExportResultCode.SUCCESS})}};ORe.ConsoleLogRecordExporter=Dyt});var rNr=w(kRe=>{"use strict";Object.defineProperty(kRe,"__esModule",{value:!0});kRe.SimpleLogRecordProcessor=void 0;var UK=hT(),Ryt=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new UK.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let r=()=>UK.internal._export(this._exporter,[e]).then(n=>{n.code!==UK.ExportResultCode.SUCCESS&&(0,UK.globalErrorHandler)(n.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${n})`))}).catch(UK.globalErrorHandler);if(e.resource.asyncAttributesPending){let n=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(n),r()),UK.globalErrorHandler);n!=null&&this._unresolvedExports.add(n)}else r()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}};kRe.SimpleLogRecordProcessor=Ryt});var iNr=w(PRe=>{"use strict";Object.defineProperty(PRe,"__esModule",{value:!0});PRe.InMemoryLogRecordExporter=void 0;var nNr=hT(),Byt=class{_finishedLogRecords=[];_stopped=!1;export(e,r){if(this._stopped)return r({code:nNr.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),r({code:nNr.ExportResultCode.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}};PRe.InMemoryLogRecordExporter=Byt});var oNr=w(MRe=>{"use strict";Object.defineProperty(MRe,"__esModule",{value:!0});MRe.BatchLogRecordProcessorBase=void 0;var tlo=(Kt(),yt(ar)),jv=hT(),Nyt=class{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,r){this._exporter=e,this._maxExportBatchSize=r?.maxExportBatchSize??(0,jv.getNumberFromEnv)("OTEL_BLRP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=r?.maxQueueSize??(0,jv.getNumberFromEnv)("OTEL_BLRP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??(0,jv.getNumberFromEnv)("OTEL_BLRP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??(0,jv.getNumberFromEnv)("OTEL_BLRP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new jv.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(tlo.diag.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,r)=>{let n=[],i=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let o=0;o<i;o++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():new Promise((e,r)=>{(0,jv.callWithTimeout)(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis).then(()=>e()).catch(r)})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,this._finishedLogRecords.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(r=>{this._isExporting=!1,(0,jv.globalErrorHandler)(r)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){let r=()=>jv.internal._export(this._exporter,e).then(i=>{i.code!==jv.ExportResultCode.SUCCESS&&(0,jv.globalErrorHandler)(i.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${i})`))}).catch(jv.globalErrorHandler),n=e.map(i=>i.resource).filter(i=>i.asyncAttributesPending);return n.length===0?r():Promise.all(n.map(i=>i.waitForAsyncAttributes?.())).then(r,jv.globalErrorHandler)}};MRe.BatchLogRecordProcessorBase=Nyt});var sNr=w(LRe=>{"use strict";Object.defineProperty(LRe,"__esModule",{value:!0});LRe.BatchLogRecordProcessor=void 0;var rlo=oNr(),Oyt=class extends rlo.BatchLogRecordProcessorBase{onShutdown(){}};LRe.BatchLogRecordProcessor=Oyt});var aNr=w(FRe=>{"use strict";Object.defineProperty(FRe,"__esModule",{value:!0});FRe.BatchLogRecordProcessor=void 0;var nlo=sNr();Object.defineProperty(FRe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return nlo.BatchLogRecordProcessor}})});var cNr=w(URe=>{"use strict";Object.defineProperty(URe,"__esModule",{value:!0});URe.BatchLogRecordProcessor=void 0;var ilo=aNr();Object.defineProperty(URe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return ilo.BatchLogRecordProcessor}})});var lNr=w(T3=>{"use strict";Object.defineProperty(T3,"__esModule",{value:!0});T3.BatchLogRecordProcessor=T3.InMemoryLogRecordExporter=T3.SimpleLogRecordProcessor=T3.ConsoleLogRecordExporter=T3.NoopLogRecordProcessor=T3.LoggerProvider=void 0;var olo=ZBr();Object.defineProperty(T3,"LoggerProvider",{enumerable:!0,get:function(){return olo.LoggerProvider}});var slo=Syt();Object.defineProperty(T3,"NoopLogRecordProcessor",{enumerable:!0,get:function(){return slo.NoopLogRecordProcessor}});var alo=tNr();Object.defineProperty(T3,"ConsoleLogRecordExporter",{enumerable:!0,get:function(){return alo.ConsoleLogRecordExporter}});var clo=rNr();Object.defineProperty(T3,"SimpleLogRecordProcessor",{enumerable:!0,get:function(){return clo.SimpleLogRecordProcessor}});var llo=iNr();Object.defineProperty(T3,"InMemoryLogRecordExporter",{enumerable:!0,get:function(){return llo.InMemoryLogRecordExporter}});var ulo=cNr();Object.defineProperty(T3,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return ulo.BatchLogRecordProcessor}})});var Qm,uNr,dpe,dNr,fpe,ppe,fNr,pNr,hNr,mNr,gNr,ANr,yNr,ENr,vNr,bNr,CNr,_Nr,xNr,SNr,wNr,TNr,INr,DNr,RNr,BNr,NNr,ONr,kNr,PNr,hpe=Z(()=>{"use strict";Qm="iflow-cli",uNr="iflow_cli.user_prompt",dpe="iflow_cli.tool_call",dNr="iflow_cli.api_request",fpe="iflow_cli.api_error",ppe="iflow_cli.api_response",fNr="iflow_cli.config",pNr="iflow_cli.flash_fallback",hNr="iflow_cli.next_speaker_check",mNr="iflow_cli.slash_command",gNr="iflow_cli.tool.call.count",ANr="iflow_cli.tool.call.latency",yNr="iflow_cli.mcp.tool.call.count",ENr="iflow_cli.mcp.tool.call.latency",vNr="iflow_cli.builtin.tool.call.count",bNr="iflow_cli.builtin.tool.call.latency",CNr="gen_ai.client.operation",_Nr="gen_ai.client.operation.duration",xNr="gen_ai.client.token.usage",SNr="iflow_cli.session.count",wNr="iflow_cli.file.operation.count",TNr="iflow_cli.user_request.count",INr="iflow_cli.user_request.latency",DNr="iflow_cli.user_experience.success",RNr="iflow_cli.user.identity",BNr="iflow_cli.scheduler.lock.error",NNr="iflow_cli.mcp.connect.count",ONr="iflow_cli.loop.detection.count",kNr="iflow_cli.paste.operation.count",PNr="iflow_cli.paste.operation.latency"});import dlo from"os";function MNr(){try{let t=dlo.networkInterfaces();for(let e of Object.keys(t)){let r=t[e];if(r){for(let n of r)if(n.family==="IPv4"&&!n.internal)return n.address}}return"127.0.0.1"}catch{return"127.0.0.1"}}var LNr=Z(()=>{"use strict"});var QK,qK,HK,GK,jK,VK,$K,WK,zK,YK,XC,ZC,FNr=Z(()=>{"use strict";QK="iflow_cli.cpu.usage_percentage",qK="iflow_cli.cpu.user_percentage",HK="iflow_cli.cpu.system_percentage",GK="iflow_cli.cpu.cores",jK="iflow_cli.memory.heap_used",VK="iflow_cli.memory.heap_total",$K="iflow_cli.memory.rss",WK="iflow_cli.memory.external",zK="iflow_cli.memory.system_usage_percentage",YK="iflow_cli.memory.process_usage_percentage",XC={[QK]:"CPU usage percentage",[qK]:"CPU user time percentage",[HK]:"CPU system time percentage",[GK]:"Number of CPU cores",[jK]:"Heap memory used in bytes",[VK]:"Heap memory total in bytes",[$K]:"Resident Set Size in bytes",[WK]:"External memory in bytes",[zK]:"System memory usage percentage",[YK]:"Process memory usage percentage relative to Node.js limits"},ZC={[QK]:"percent",[qK]:"percent",[HK]:"percent",[GK]:"cores",[jK]:"bytes",[VK]:"bytes",[$K]:"bytes",[WK]:"bytes",[zK]:"percent",[YK]:"percent"}});import*as e5 from"os";var QRe,UNr=Z(()=>{"use strict";FNr();QRe=class{meter;options;lastCpuMeasurement;lastMeasureTime;cpuCores;totalSystemMemory;nodeJSMemoryLimit;cpuUsageGauge;cpuUserGauge;cpuSystemGauge;cpuCoresGauge;memoryHeapUsedGauge;memoryHeapTotalGauge;memoryRssGauge;memoryExternalGauge;memorySystemUsageGauge;memoryProcessUsageGauge;constructor(e,r={}){this.meter=e,this.options={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...r},this.lastCpuMeasurement=process.cpuUsage(),this.lastMeasureTime=Date.now(),this.cpuCores=e5.cpus().length,this.totalSystemMemory=e5.totalmem(),this.nodeJSMemoryLimit=this.getNodeJSMemoryLimit(),this.initializeMetrics()}getCurrentCpuMetrics(){try{let e=process.cpuUsage(this.lastCpuMeasurement),r=Date.now(),n=r-this.lastMeasureTime;if(this.lastCpuMeasurement=process.cpuUsage(),this.lastMeasureTime=r,n<=0)return{usage:0,user:0,system:0,cores:this.cpuCores};let i=Math.max(0,e.user+e.system),o=Math.max(0,e.user),s=Math.max(0,e.system),a=i/(n*1e3)*100,c=o/(n*1e3)*100,u=s/(n*1e3)*100,d=Number.isFinite(a)?Math.min(100,Math.max(0,a)):0,f=Number.isFinite(c)?Math.min(100,Math.max(0,c)):0,p=Number.isFinite(u)?Math.min(100,Math.max(0,u)):0;return{usage:d,user:f,system:p,cores:this.cpuCores}}catch{return{usage:0,user:0,system:0,cores:this.cpuCores}}}getCurrentMemoryMetrics(){try{let e=process.memoryUsage(),r=e5.freemem(),i=(this.totalSystemMemory-r)/this.totalSystemMemory*100,o=e.rss/this.nodeJSMemoryLimit*100;return{heapUsed:e.heapUsed,heapTotal:e.heapTotal,rss:e.rss,external:e.external,systemUsage:Math.min(100,Math.max(0,i)),processUsage:Math.min(100,Math.max(0,o))}}catch{return{heapUsed:0,heapTotal:0,rss:0,external:0,systemUsage:0,processUsage:0}}}initializeMetrics(){let e=e5.platform(),r=e5.arch(),n=process.version;this.options.enableCpuMetrics&&(this.cpuUsageGauge=this.meter.createObservableGauge(QK,{description:XC[QK],unit:ZC[QK]}),this.cpuUserGauge=this.meter.createObservableGauge(qK,{description:XC[qK],unit:ZC[qK]}),this.cpuSystemGauge=this.meter.createObservableGauge(HK,{description:XC[HK],unit:ZC[HK]}),this.cpuCoresGauge=this.meter.createObservableGauge(GK,{description:XC[GK],unit:ZC[GK]}),this.cpuUsageGauge.addCallback(i=>{let o=this.getCurrentCpuMetrics();i.observe(o.usage,{platform:e,arch:r,node_version:n})}),this.cpuUserGauge.addCallback(i=>{let o=this.getCurrentCpuMetrics();i.observe(o.user,{platform:e,arch:r,node_version:n})}),this.cpuSystemGauge.addCallback(i=>{let o=this.getCurrentCpuMetrics();i.observe(o.system,{platform:e,arch:r,node_version:n})}),this.cpuCoresGauge?.addCallback(i=>{i.observe(this.cpuCores,{platform:e,arch:r})})),this.options.enableMemoryMetrics&&(this.memoryHeapUsedGauge=this.meter.createObservableGauge(jK,{description:XC[jK],unit:ZC[jK]}),this.memoryHeapTotalGauge=this.meter.createObservableGauge(VK,{description:XC[VK],unit:ZC[VK]}),this.memoryRssGauge=this.meter.createObservableGauge($K,{description:XC[$K],unit:ZC[$K]}),this.memoryExternalGauge=this.meter.createObservableGauge(WK,{description:XC[WK],unit:ZC[WK]}),this.memorySystemUsageGauge=this.meter.createObservableGauge(zK,{description:XC[zK],unit:ZC[zK]}),this.memoryProcessUsageGauge=this.meter.createObservableGauge(YK,{description:XC[YK],unit:ZC[YK]}),this.memoryHeapUsedGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.heapUsed,{platform:e,arch:r,node_version:n})}),this.memoryHeapTotalGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.heapTotal,{platform:e,arch:r,node_version:n})}),this.memoryRssGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.rss,{platform:e,arch:r,node_version:n})}),this.memoryExternalGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.external,{platform:e,arch:r,node_version:n})}),this.memorySystemUsageGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.systemUsage,{platform:e,arch:r,node_version:n})}),this.memoryProcessUsageGauge.addCallback(i=>{let o=this.getCurrentMemoryMetrics();i.observe(o.processUsage,{platform:e,arch:r,node_version:n,memory_limit_mb:Math.round(this.nodeJSMemoryLimit/(1024*1024)).toString()})}))}getNodeJSMemoryLimit(){let e=process.execArgv.find(i=>i.startsWith("--max-old-space-size="))?.split("=")[1];if(e){let i=parseInt(e,10);if(!isNaN(i)&&i>0)return i*1024*1024}let r=process.execArgv.find(i=>i.startsWith("--max_old_space_size="))?.split("=")[1];if(r){let i=parseInt(r,10);if(!isNaN(i)&&i>0)return i*1024*1024}let n=e5.arch();return n==="x64"||n==="arm64"?1400*1024*1024:700*1024*1024}}});function QNr(t,e={}){if(qRe)return qRe;let r={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...e};return qRe=new QRe(t,r),qRe}var qRe,qNr=Z(()=>{"use strict";UNr();qRe=null});import*as KK from"os";import*as HRe from"fs";function Xp(t){let e="0.3.22",r=process.env.IFLOW_ENV||"normal",n={darwin:"macOS",win32:"Windows",linux:"Linux",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX"},i=KK.platform(),o=n[i]||i,s="unknown";try{if(i==="darwin")s=KK.release();else if(i==="linux")try{if(HRe.existsSync("/etc/os-release")){let h=HRe.readFileSync("/etc/os-release","utf8").match(/^PRETTY_NAME="(.+)"/m);h&&(s=h[1])}}catch{s=KK.release()}else i==="win32"&&(s=KK.release())}catch{s="unknown"}let a={name:"Node.js",version:process.version,architecture:process.arch},c=t.getModel()||"unknown",u=t.getUsageMode(),d=!1,f=t.getContentGeneratorConfig?.();if(f){let p=f.authType,h=f.baseUrl||"";(p===zt.LOGIN_WITH_IFLOW||p===zt.IFLOW||p===zt.OPENAI_COMPATIBLE&&h.includes("apis.iflow.cn"))&&(d=!0)}return{app_name:Qm,tenant__:"gen_ai",version:e,platform:o,os_model:s,runtime_name:a.name,runtime_version:a.version,runtime_architecture:a.architecture,model_name:c,is_iflow_open_user:String(d),ip:MNr(),iflow_env:r,usage_mode:u}}function HNr(){return kyt||(kyt=Yue.getMeter(Qm)),kyt}function GNr(){if(eg)return;let t=HNr();if(t){try{QNr(t,{enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0})}catch{}Pyt=t.createHistogram(gNr,{description:"Counts tool calls, tagged by function name and success.",unit:"count",valueType:Fl.INT}),Myt=t.createHistogram(ANr,{description:"Latency of tool calls in milliseconds.",unit:"ms",valueType:Fl.INT}),Lyt=t.createHistogram(yNr,{description:"Counts MCP tool calls, tagged by function name and success.",unit:"count",valueType:Fl.INT}),Fyt=t.createHistogram(ENr,{description:"Latency of MCP tool calls in milliseconds.",unit:"ms",valueType:Fl.INT}),Uyt=t.createHistogram(vNr,{description:"Counts built-in tool calls, tagged by function name and success.",unit:"count",valueType:Fl.INT}),Qyt=t.createHistogram(bNr,{description:"Latency of built-in tool calls in milliseconds.",unit:"ms",valueType:Fl.INT}),mpe=t.createHistogram(CNr,{description:"Counts API requests, tagged by model and status.",unit:"count",valueType:Fl.INT}),gpe=t.createHistogram(_Nr,{description:"Latency of API requests in milliseconds.",unit:"ms",valueType:Fl.INT}),qyt=t.createHistogram(xNr,{description:"Counts the total number of tokens used.",unit:"tokens",valueType:Fl.INT}),Hyt=t.createHistogram(wNr,{description:"Counts file operations (create, read, update).",unit:"count",valueType:Fl.INT}),Gyt=t.createHistogram(TNr,{description:"Counts user requests from prompt to completion.",unit:"count",valueType:Fl.INT}),jyt=t.createHistogram(INr,{description:"End-to-end latency of user requests in milliseconds.",unit:"ms",valueType:Fl.INT}),Vyt=t.createHistogram(DNr,{description:"User experience success rate - counts successful user experiences including retries and fixes.",unit:"count",valueType:Fl.INT}),$yt=t.createHistogram(RNr,{description:"User identity for tracking unique installations.",unit:"count",valueType:Fl.INT}),Wyt=t.createHistogram(BNr,{description:"Counts tool scheduler lock errors when new calls are blocked by running calls.",unit:"count",valueType:Fl.INT}),zyt=t.createHistogram(NNr,{description:"Counts MCP connection attempts and their success/failure status.",unit:"count",valueType:Fl.INT}),Yyt=t.createHistogram(ONr,{description:"Counts loop detection events by loop type.",unit:"count",valueType:Fl.INT}),Kyt=t.createHistogram(kNr,{description:"Counts paste operations, tagged by type and success.",unit:"count",valueType:Fl.INT}),Jyt=t.createHistogram(PNr,{description:"Latency of paste operations in milliseconds.",unit:"ms",valueType:Fl.INT}),eg=!0}}function GRe(t){let e=HNr();if(!e||!eg)return;e.createHistogram(SNr,{description:"Count of CLI sessions started.",unit:"count",valueType:Fl.INT}).record(1,Xp(t))}function jNr(t,e,r,n,i,o){if(!Pyt||!Myt||!eg)return;let s={...Xp(t),function_name:e??"unknown",success:String(n),decision:i??"unknown"};Pyt.record(1,s),Myt.record(r,{...Xp(t),function_name:e??"unknown",tool_type:o??"unknown"})}function VNr(t,e,r,n,i,o){if(!Lyt||!Fyt||!eg)return;let s={...Xp(t),function_name:e??"unknown",success:String(n),decision:i??"unknown"};o&&(s.execution_context=o),Lyt.record(1,s),Fyt.record(r,{...Xp(t),function_name:e??"unknown",execution_context:o??"unknown"})}function $Nr(t,e,r,n,i,o){if(!Uyt||!Qyt||!eg)return;let s={...Xp(t),function_name:e??"unknown",success:String(n),decision:i??"unknown"};o&&(s.execution_context=o),Uyt.record(1,s),Qyt.record(r,{...Xp(t),function_name:e??"unknown",execution_context:o??"unknown"})}function JK(t,e,r,n){!qyt||!eg||qyt.record(r,{...Xp(t),model:e??"unknown",type:n??"unknown"})}function WNr(t,e,r,n,i,o,s,a){if(!mpe||!gpe||!eg)return;let c={...Xp(t),model:e??"unknown",status_code:String(n??(i?"error":"ok"))};s!==void 0&&(c.http_status_code=String(s)),a!==void 0&&(c.business_code=String(a)),o&&(c.finish_reason=o),mpe.record(1,c);let u={...Xp(t),model:e??"unknown",http_status_code:String(s??200),finish_reason:o??"unknown"};a!=null&&(u.business_code=String(a)),gpe.record(r,u)}function zNr(t,e,r,n,i,o,s){if(!mpe||!gpe||!eg)return;let a={...Xp(t),model:e??"unknown",status_code:String(n??"error"),error:i??"unknown"};o!==void 0&&(a.http_status_code=String(o)),s!==void 0&&(a.business_code=String(s)),mpe.record(1,a);let c={...Xp(t),model:e??"unknown",http_status_code:String(o??0),error:i??"unknown"};s!=null&&(c.business_code=String(s)),gpe.record(r,c)}function LF(t,e,r,n,i){if(!Hyt||!eg)return;let o={...Xp(t),operation:e};r!==void 0&&(o.lines=String(r)),n!==void 0&&(o.mimetype=n),i!==void 0&&(o.extension=i),Hyt.record(1,o)}function YNr(t,e,r,n,i){if(!Gyt||!jyt||!eg)return;let o={...Xp(t),prompt_id:e,success:String(n)};i&&(o.error=i),Gyt.record(1,o),jyt.record(r,o)}function Xyt(t,e,r=!1,n=!1,i){if(!Vyt||!eg)return;let o={...Xp(t),success:String(e),had_retries:String(r),had_fixes:String(n)};i&&(o.final_error=i),Vyt.record(1,o)}function KNr(t,e){if(!$yt||!eg)return;let r={...Xp(t),user_id:e};$yt.record(1,r)}function JNr(t,e,r){if(!Wyt||!eg)return;let n={...Xp(t),running_calls_count:String(e)};r.forEach((i,o)=>{n[`call_${o}_name`]=i.name,n[`call_${o}_status`]=i.status}),Wyt.record(1,n)}function Zyt(t,e,r,n,i){if(!zyt||!eg)return;let o={...Xp(t),server_name:e,success:String(r)};n&&(o.error_type=n),i&&(o.transport_type=i),zyt.record(1,o)}function XNr(t,e,r){if(!Yyt||!eg)return;let n={...Xp(t),loop_type:e,prompt_id:r};Yyt.record(1,n)}function FF(t,e,r,n,i="text",o,s){if(!Kyt||!Jyt||!eg)return;let a={};try{a=Xp(t)}catch{a={app_name:Qm,tenant__:"gen_ai",version:"unknown",platform:s||"unknown",os_model:"unknown",runtime_name:"Node.js",runtime_version:process.version,runtime_architecture:process.arch,model_name:"unknown",is_iflow_open_user:"false",ip:"unknown",iflow_env:"test",usage_mode:"unknown"}}let c={...a,success:String(n),paste_type:i};o&&(c.error_type=o),s&&(c.platform_specific=s),Kyt.record(1,c);let u={...a,paste_type:i,text_length_range:String(r),performance_ratio:flo(e,r)};Jyt.record(e,u)}function flo(t,e){if(e===0)return"no-text";let r=t/e;return r<=.1?"excellent":r<=.5?"good":r<=1?"normal":r<=2?"slow":"very-slow"}var mT,kyt,Pyt,Myt,Lyt,Fyt,Uyt,Qyt,mpe,gpe,qyt,Hyt,Gyt,jyt,Vyt,$yt,Wyt,zyt,Yyt,Kyt,Jyt,eg,Vv=Z(()=>{"use strict";Kt();LNr();hpe();rE();qNr();(function(t){t.CREATE="create",t.READ="read",t.UPDATE="update"})(mT||(mT={}));eg=!1});var Do,yn,Ro,Bo,Id=Z(()=>{"use strict";Do=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,i,o,s,a=!0,c=!1,u=[]){this.name=e,this.displayName=r,this.description=n,this.icon=i,this.kind=o,this.parameterSchema=s,this.isOutputMarkdown=a,this.canUpdateOutput=c,this.aliases=u}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(e){return null}getDescription(e){return JSON.stringify(e)}shouldConfirmExecute(e,r){return Promise.resolve(!1)}toolLocations(e){return[]}};(function(t){t.ProceedOnce="proceed_once",t.ProceedAlways="proceed_always",t.ProceedAlwaysServer="proceed_always_server",t.ProceedAlwaysTool="proceed_always_tool",t.ModifyWithEditor="modify_with_editor",t.Cancel="cancel"})(yn||(yn={}));(function(t){t.FileSearch="fileSearch",t.Folder="folder",t.Globe="globe",t.Hammer="hammer",t.LightBulb="lightBulb",t.Pencil="pencil",t.Regex="regex",t.Terminal="terminal"})(Ro||(Ro={}));(function(t){t.Read="read",t.Edit="edit",t.Delete="delete",t.Move="move",t.Search="search",t.Execute="execute",t.Think="think",t.Fetch="fetch",t.Other="other"})(Bo||(Bo={}))});function plo(t){switch(t){case yn.ProceedOnce:case yn.ProceedAlways:case yn.ProceedAlwaysServer:case yn.ProceedAlwaysTool:return $v.ACCEPT;case yn.ModifyWithEditor:return $v.MODIFY;case yn.Cancel:default:return $v.REJECT}}var $v,XK,ZK,eJ,tJ,rJ,j1,nJ,iJ,Wv,oJ,jRe,sJ,VRe,gT=Z(()=>{"use strict";Id();rE();(function(t){t.ACCEPT="accept",t.REJECT="reject",t.MODIFY="modify"})($v||($v={}));XK=class{"event.name";"event.timestamp";model;embedding_model;sandbox_enabled;core_tools_enabled;approval_mode;api_key_enabled;vertex_ai_enabled;debug_enabled;mcp_servers;telemetry_enabled;telemetry_log_user_prompts_enabled;file_filtering_respect_git_ignore;constructor(e){let r=e.getContentGeneratorConfig(),n=e.getMcpServers(),i=!1,o=!1;r&&r.authType&&(i=r.authType===zt.IFLOW,o=r.authType===zt.AONE),this["event.name"]="cli_config",this.model=e.getModel(),this.embedding_model=e.getEmbeddingModel(),this.sandbox_enabled=typeof e.getSandbox()=="string"||!!e.getSandbox(),this.core_tools_enabled=(e.getCoreTools()??[]).join(","),this.approval_mode=e.getApprovalMode(),this.api_key_enabled=i||o,this.vertex_ai_enabled=o,this.debug_enabled=e.getDebugMode(),this.mcp_servers=n?Object.keys(n).join(","):"",this.telemetry_enabled=e.getTelemetryEnabled(),this.telemetry_log_user_prompts_enabled=e.getTelemetryLogPromptsEnabled(),this.file_filtering_respect_git_ignore=e.getFileFilteringRespectGitIgnore()}},ZK=class{"event.name";"event.timestamp";session_id;constructor(e){this["event.name"]="end_session",this["event.timestamp"]=new Date().toISOString(),this.session_id=e?.getSessionId()}},eJ=class{"event.name";"event.timestamp";prompt_length;prompt_id;auth_type;prompt;constructor(e,r,n,i){this["event.name"]="user_prompt",this["event.timestamp"]=new Date().toISOString(),this.prompt_length=e,this.prompt_id=r,this.auth_type=n,this.prompt=i}},tJ=class{"event.name";"event.timestamp";function_name;function_args;duration_ms;success;decision;error;error_type;prompt_id;server_name;constructor(e){this["event.name"]="tool_call",this["event.timestamp"]=new Date().toISOString(),this.function_name=e.request.name,this.function_args=JSON.stringify(e.request.args),this.duration_ms=e.durationMs??0,this.success=e.status==="success",this.decision=e.outcome?plo(e.outcome):void 0,this.error=e.response.error?.message,this.error_type=e.response.errorType,this.prompt_id=e.request.prompt_id,"tool"in e&&e.tool&&"serverName"in e.tool&&(this.server_name=e.tool.serverName)}},rJ=class{"event.name";"event.timestamp";model;prompt_id;request_text;constructor(e,r,n){this["event.name"]="api_request",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.prompt_id=r,this.request_text=n}},j1=class{"event.name";"event.timestamp";model;error;error_type;status_code;http_status_code;business_code;duration_ms;prompt_id;auth_type;constructor(e,r,n,i,o,s,a,c,u){this["event.name"]="api_error",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.error=r,this.error_type=s,this.status_code=a,this.http_status_code=c,this.business_code=u,this.duration_ms=n,this.prompt_id=i,this.auth_type=o}},nJ=class{"event.name";"event.timestamp";model;status_code;http_status_code;business_code;duration_ms;error;input_token_count;output_token_count;cached_content_token_count;thoughts_token_count;tool_token_count;total_token_count;response_text;prompt_id;auth_type;finish_reason;constructor(e,r,n,i,o,s,a,c,u,d){this["event.name"]="api_response",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.duration_ms=r,this.status_code=200,this.http_status_code=u||200,this.business_code=d,this.input_token_count=o?.promptTokenCount??0,this.output_token_count=o?.candidatesTokenCount??0,this.cached_content_token_count=o?.cachedContentTokenCount??0,this.thoughts_token_count=o?.thoughtsTokenCount??0,this.tool_token_count=o?.toolUsePromptTokenCount??0,this.total_token_count=o?.totalTokenCount??0,this.response_text=s,this.error=a,this.prompt_id=n,this.auth_type=i,this.finish_reason=c}},iJ=class{"event.name";"event.timestamp";auth_type;constructor(e){this["event.name"]="flash_fallback",this["event.timestamp"]=new Date().toISOString(),this.auth_type=e}};(function(t){t.CONSECUTIVE_IDENTICAL_TOOL_CALLS="consecutive_identical_tool_calls",t.CHANTING_IDENTICAL_SENTENCES="chanting_identical_sentences",t.LLM_DETECTED_LOOP="llm_detected_loop"})(Wv||(Wv={}));oJ=class{"event.name";"event.timestamp";loop_type;prompt_id;constructor(e,r){this["event.name"]="loop_detected",this["event.timestamp"]=new Date().toISOString(),this.loop_type=e,this.prompt_id=r}},jRe=class{"event.name";"event.timestamp";prompt_id;finish_reason;result;constructor(e,r,n){this["event.name"]="next_speaker_check",this["event.timestamp"]=new Date().toISOString(),this.prompt_id=e,this.finish_reason=r,this.result=n}},sJ=class{"event.name";"event.timestamp";command;subcommand;constructor(e,r){this["event.name"]="slash_command",this["event.timestamp"]=new Date().toISOString(),this.command=e,this.subcommand=r}},VRe=class{"event.name";"event.timestamp";model;constructor(e){this["event.name"]="malformed_json_response",this["event.timestamp"]=new Date().toISOString(),this.model=e}}});var hi,ZNr=Z(()=>{"use strict";(function(t){t[t.IFLOW_CLI_KEY_UNKNOWN=0]="IFLOW_CLI_KEY_UNKNOWN",t[t.IFLOW_CLI_START_SESSION_MODEL=1]="IFLOW_CLI_START_SESSION_MODEL",t[t.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL=2]="IFLOW_CLI_START_SESSION_EMBEDDING_MODEL",t[t.IFLOW_CLI_START_SESSION_SANDBOX=3]="IFLOW_CLI_START_SESSION_SANDBOX",t[t.IFLOW_CLI_START_SESSION_CORE_TOOLS=4]="IFLOW_CLI_START_SESSION_CORE_TOOLS",t[t.IFLOW_CLI_START_SESSION_APPROVAL_MODE=5]="IFLOW_CLI_START_SESSION_APPROVAL_MODE",t[t.IFLOW_CLI_START_SESSION_API_KEY_ENABLED=6]="IFLOW_CLI_START_SESSION_API_KEY_ENABLED",t[t.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED=7]="IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED",t[t.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED=8]="IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED",t[t.IFLOW_CLI_START_SESSION_MCP_SERVERS=9]="IFLOW_CLI_START_SESSION_MCP_SERVERS",t[t.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED=10]="IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED",t[t.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED=11]="IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED",t[t.IFLOW_CLI_START_SESSION_RESPECT_GITIGNORE=12]="IFLOW_CLI_START_SESSION_RESPECT_GITIGNORE",t[t.IFLOW_CLI_USER_PROMPT_LENGTH=13]="IFLOW_CLI_USER_PROMPT_LENGTH",t[t.IFLOW_CLI_TOOL_CALL_NAME=14]="IFLOW_CLI_TOOL_CALL_NAME",t[t.IFLOW_CLI_TOOL_CALL_DECISION=15]="IFLOW_CLI_TOOL_CALL_DECISION",t[t.IFLOW_CLI_TOOL_CALL_SUCCESS=16]="IFLOW_CLI_TOOL_CALL_SUCCESS",t[t.IFLOW_CLI_TOOL_CALL_DURATION_MS=17]="IFLOW_CLI_TOOL_CALL_DURATION_MS",t[t.IFLOW_CLI_TOOL_ERROR_MESSAGE=18]="IFLOW_CLI_TOOL_ERROR_MESSAGE",t[t.IFLOW_CLI_TOOL_CALL_ERROR_TYPE=19]="IFLOW_CLI_TOOL_CALL_ERROR_TYPE",t[t.IFLOW_CLI_API_REQUEST_MODEL=20]="IFLOW_CLI_API_REQUEST_MODEL",t[t.IFLOW_CLI_API_RESPONSE_MODEL=21]="IFLOW_CLI_API_RESPONSE_MODEL",t[t.IFLOW_CLI_API_RESPONSE_STATUS_CODE=22]="IFLOW_CLI_API_RESPONSE_STATUS_CODE",t[t.IFLOW_CLI_API_RESPONSE_DURATION_MS=23]="IFLOW_CLI_API_RESPONSE_DURATION_MS",t[t.IFLOW_CLI_API_ERROR_MESSAGE=24]="IFLOW_CLI_API_ERROR_MESSAGE",t[t.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT=25]="IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT=26]="IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT=27]="IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT=28]="IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT",t[t.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT=29]="IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT",t[t.IFLOW_CLI_API_ERROR_MODEL=30]="IFLOW_CLI_API_ERROR_MODEL",t[t.IFLOW_CLI_API_ERROR_TYPE=31]="IFLOW_CLI_API_ERROR_TYPE",t[t.IFLOW_CLI_API_ERROR_STATUS_CODE=32]="IFLOW_CLI_API_ERROR_STATUS_CODE",t[t.IFLOW_CLI_API_ERROR_DURATION_MS=33]="IFLOW_CLI_API_ERROR_DURATION_MS",t[t.IFLOW_CLI_END_SESSION_ID=34]="IFLOW_CLI_END_SESSION_ID",t[t.IFLOW_CLI_PROMPT_ID=35]="IFLOW_CLI_PROMPT_ID",t[t.IFLOW_CLI_AUTH_TYPE=36]="IFLOW_CLI_AUTH_TYPE",t[t.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT=37]="IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT",t[t.IFLOW_CLI_SURFACE=39]="IFLOW_CLI_SURFACE",t[t.IFLOW_CLI_SESSION_ID=40]="IFLOW_CLI_SESSION_ID",t[t.IFLOW_CLI_LOOP_DETECTED_TYPE=38]="IFLOW_CLI_LOOP_DETECTED_TYPE",t[t.IFLOW_CLI_SLASH_COMMAND_NAME=41]="IFLOW_CLI_SLASH_COMMAND_NAME",t[t.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND=42]="IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND",t[t.IFLOW_CLI_RESPONSE_FINISH_REASON=43]="IFLOW_CLI_RESPONSE_FINISH_REASON",t[t.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT=44]="IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT",t[t.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL=45]="IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL"})(hi||(hi={}))});function UF(t,e){let r=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular]";r.add(i)}return i},e)}var $Re=Z(()=>{"use strict";});import mS,{dirname as hlo,join as eEt}from"node:path";import WRe from"os";import*as eOr from"crypto";import{fileURLToPath as mlo}from"node:url";import glo from"node:fs";function gS(t){let e=WRe.homedir();return t.startsWith(e)?t.replace(e,"~"):t}function Ac(t,e=35){if(t.length<=e)return t;let n=mS.parse(t).root,i=mS.sep,s=t.substring(n.length).split(i).filter(h=>h!=="");if(s.length<=1){let h=Math.floor((e-3)/2);if(h<=0)return t.substring(0,e-3)+"...";let m=t.substring(0,h),g=t.substring(t.length-h);return`${m}...${g}`}let a=s[0],c=s[s.length-1],u=n+a,d=[],f=i.length+c.length;for(let h=s.length-2;h>=0;h--){let m=s[h],g=f+i.length+m.length;if(g<=e)d.unshift(m),f=g;else break}let p=d.join(i)+i+c;return f>e?p:(p=u+i+p,p.length>e?"..."+p.substring(p.length-e-3):p)}function Dd(t,e){let r=mS.resolve(t),n=mS.resolve(e);return mS.relative(n,r)||"."}function aJ(t){let e="";for(let r=0;r<t.length;r++)t[r]===" "&&(r===0||t[r-1]!=="\\")?e+="\\ ":e+=t[r];return e}function AT(t){return t.replace(/\\(.)/g,"$1")}function zRe(t){return eOr.createHash("sha256").update(t).digest("hex")}function V1(t){let e=zRe(t);return mS.join(WRe.homedir(),qm,Alo,e)}function YRe(){return mS.join(WRe.homedir(),qm,tOr)}function KRe(t){return mS.join(t,qm,tOr)}function JRe(){if(process.env.USE_BUILTIN_RIPGREP==="0")return"rg";let t=hlo(mlo(import.meta.url)),e=[eEt(t,"..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),eEt(t,"..","..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`),eEt(t,"..","..","..","vendors","ripgrep",`${process.arch}-${process.platform}`,`rg${process.platform==="win32"?".exe":""}`)];for(let r of e)try{if(glo.existsSync(r))return r}catch{}return e[0]}function Ape(t,e){let n=WRe.platform()==="win32"?mS.win32:mS,i=n.relative(t,e);return!i.startsWith(`..${n.sep}`)&&i!==".."&&!n.isAbsolute(i)}var qm,tEt,Alo,tOr,Rd=Z(()=>{"use strict";qm=".iflow",tEt="google_accounts.json",Alo="tmp",tOr="commands"});import ylo from"node:path";import{promises as $Ma,existsSync as rOr,readFileSync as nOr}from"node:fs";import*as iOr from"os";function oOr(){return ylo.join(iOr.homedir(),qm,tEt)}function sOr(){try{let t=oOr();if(rOr(t)){let e=nOr(t,"utf-8").trim();return e?JSON.parse(e).active:null}return null}catch(t){return console.debug("Error reading cached Google Account:",t),null}}function aOr(){try{let t=oOr();if(!rOr(t))return 0;let e=nOr(t,"utf-8").trim();if(!e)return 0;let r=JSON.parse(e),n=r.old.length;return r.active&&n++,n}catch(t){return console.debug("Error reading lifetime Google Accounts:",t),0}}var cOr=Z(()=>{"use strict";Rd();});import*as lOr from"os";import*as yT from"fs";import*as iEt from"path";import{randomUUID as Elo}from"crypto";function blo(){yT.existsSync(rEt)||yT.mkdirSync(rEt,{recursive:!0})}function Clo(){return yT.existsSync(nEt)&&yT.readFileSync(nEt,"utf-8").trim()||null}function _lo(t){yT.writeFileSync(nEt,t,"utf-8")}function XRe(){try{blo();let t=Clo();return t||(t=Elo(),_lo(t)),t}catch(t){return console.error("Error accessing installation ID file, generating ephemeral ID:",t),"123456789"}}var vlo,rEt,nEt,oEt=Z(()=>{"use strict";Rd();vlo=lOr.homedir()??"",rEt=iEt.join(vlo,qm),nEt=iEt.join(rEt,"installation_id")});var uOr,xlo,Slo,wlo,Tlo,Ilo,Dlo,Rlo,Blo,Nlo,Olo,klo,Plo,Mh,ype=Z(()=>{"use strict";uOr=Te(Kct(),1);gT();ZNr();$Re();cOr();oEt();xlo="start_session",Slo="new_prompt",wlo="tool_call",Tlo="api_request",Ilo="api_response",Dlo="api_error",Rlo="end_session",Blo="flash_fallback",Nlo="loop_detected",Olo="next_speaker_check",klo="slash_command",Plo="malformed_json_response",Mh=class t{static instance;config;events=[];last_flush_time=Date.now();flush_interval_ms=1e3*60;constructor(e){this.config=e}static getInstance(e){if(!(e===void 0||!e?.getUsageStatisticsEnabled()))return t.instance||(t.instance=new t(e)),t.instance}enqueueLogEvent(e){this.events.push([{event_time_ms:Date.now(),source_extension_json:UF(e)}])}createLogEvent(e,r){let n=sOr(),i=aOr();r.push({iflow_cli_key:hi.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT,value:i.toString()});let o={console_type:"IFLOW_CLI",application:102,event_name:e,event_metadata:[r]};return n?o.client_email=n:o.client_install_id=XRe(),o}flushIfNeeded(){Date.now()-this.last_flush_time<this.flush_interval_ms||this.flushToClearcut().catch(e=>{console.debug("Error flushing to Clearcut:",e)})}async flushToClearcut(){return this.config?.getDebugMode()&&console.log("Telemetry disabled - not sending log events to Clearcut."),this.events.length=0,this.last_flush_time=Date.now(),Promise.resolve({})}decodeLogResponse(e){if(e.length<1||e.readUInt8(0)!==8)return;let r=BigInt(0),n=!0;for(let o=1;n&&o<e.length;o++){let s=e.readUInt8(o);r|=BigInt(s&127)<<BigInt(7*(o-1)),n=(s&128)!==0}return n?void 0:{nextRequestWaitMs:Number(r)}}logStartSessionEvent(e){let r=process.env.SURFACE||"SURFACE_NOT_SET",n=[{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_MODEL,value:e.model},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL,value:e.embedding_model},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_SANDBOX,value:e.sandbox_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_CORE_TOOLS,value:e.core_tools_enabled},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_APPROVAL_MODE,value:e.approval_mode},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_API_KEY_ENABLED,value:e.api_key_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED,value:e.debug_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_MCP_SERVERS,value:e.mcp_servers},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED,value:e.telemetry_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED,value:e.telemetry_log_user_prompts_enabled.toString()},{iflow_cli_key:hi.IFLOW_CLI_SURFACE,value:r}];this.enqueueLogEvent(this.createLogEvent(xlo,n)),this.flushToClearcut().catch(i=>{console.debug("Error flushing to Clearcut:",i)})}logNewPromptEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_USER_PROMPT_LENGTH,value:JSON.stringify(e.prompt_length)},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.enqueueLogEvent(this.createLogEvent(Slo,r)),this.flushIfNeeded()}logToolCallEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_NAME,value:JSON.stringify(e.function_name)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_DECISION,value:JSON.stringify(e.decision)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:hi.IFLOW_CLI_TOOL_CALL_ERROR_TYPE,value:JSON.stringify(e.error_type)}],n=this.createLogEvent(wlo,r);this.enqueueLogEvent(n),this.flushIfNeeded()}logApiRequestEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_API_REQUEST_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)}];this.enqueueLogEvent(this.createLogEvent(Tlo,r)),this.flushIfNeeded()}logApiResponseEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT,value:JSON.stringify(e.input_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT,value:JSON.stringify(e.output_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT,value:JSON.stringify(e.cached_content_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT,value:JSON.stringify(e.thoughts_token_count)},{iflow_cli_key:hi.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT,value:JSON.stringify(e.tool_token_count)},{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.enqueueLogEvent(this.createLogEvent(Ilo,r)),this.flushIfNeeded()}logApiErrorEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_TYPE,value:JSON.stringify(e.error_type)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:hi.IFLOW_CLI_API_ERROR_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.enqueueLogEvent(this.createLogEvent(Dlo,r)),this.flushIfNeeded()}logFlashFallbackEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.enqueueLogEvent(this.createLogEvent(Blo,r)),this.flushToClearcut().catch(n=>{console.debug("Error flushing to Clearcut:",n)})}logLoopDetectedEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_LOOP_DETECTED_TYPE,value:JSON.stringify(e.loop_type)}];this.enqueueLogEvent(this.createLogEvent(Nlo,r)),this.flushIfNeeded()}logNextSpeakerCheck(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:hi.IFLOW_CLI_RESPONSE_FINISH_REASON,value:JSON.stringify(e.finish_reason)},{iflow_cli_key:hi.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT,value:JSON.stringify(e.result)},{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.enqueueLogEvent(this.createLogEvent(Olo,r)),this.flushIfNeeded()}logSlashCommandEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_SLASH_COMMAND_NAME,value:JSON.stringify(e.command)}];e.subcommand&&r.push({iflow_cli_key:hi.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND,value:JSON.stringify(e.subcommand)}),this.enqueueLogEvent(this.createLogEvent(klo,r)),this.flushIfNeeded()}logMalformedJsonResponseEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL,value:JSON.stringify(e.model)}];this.enqueueLogEvent(this.createLogEvent(Plo,r)),this.flushIfNeeded()}logEndSessionEvent(e){let r=[{iflow_cli_key:hi.IFLOW_CLI_SESSION_ID,value:e?.session_id?.toString()??""}];this.enqueueLogEvent(this.createLogEvent(Rlo,r)),this.flushToClearcut().catch(n=>{console.debug("Error flushing to Clearcut:",n)})}getProxyAgent(){let e=this.config?.getProxy();if(e){if(e.startsWith("http"))return new uOr.HttpsProxyAgent(e);throw new Error("Unsupported proxy type")}}shutdown(){let e=new ZK(this.config);this.logEndSessionEvent(e)}}});import*as dOr from"node:fs";var QF,fOr,Epe,ZRe,eBe,tBe,pOr=Z(()=>{"use strict";QF=Te(oi(),1),fOr=Te(Dx(),1);Epe=class{writeStream;constructor(e){this.writeStream=dOr.createWriteStream(e,{flags:"a"})}serialize(e){let r=new WeakSet;return JSON.stringify(e,(i,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular]";r.add(o)}return o},2)+`
|
|
450
450
|
`}shutdown(){return new Promise(e=>{this.writeStream.end(e)})}},ZRe=class extends Epe{export(e,r){let n=e.map(i=>this.serialize(i)).join("");this.writeStream.write(n,i=>{r({code:i?QF.ExportResultCode.FAILED:QF.ExportResultCode.SUCCESS,error:i||void 0})})}},eBe=class extends Epe{export(e,r){let n=e.map(i=>this.serialize(i)).join("");this.writeStream.write(n,i=>{r({code:i?QF.ExportResultCode.FAILED:QF.ExportResultCode.SUCCESS,error:i||void 0})})}},tBe=class extends Epe{export(e,r){let n=this.serialize(e);this.writeStream.write(n,i=>{r({code:i?QF.ExportResultCode.FAILED:QF.ExportResultCode.SUCCESS,error:i||void 0})})}getPreferredAggregationTemporality(){return fOr.AggregationTemporality.CUMULATIVE}async forceFlush(){return Promise.resolve()}}});function $1(){return cJ}function Mlo(t){if(!t)return;let e=t.replace(/^["']|["']$/g,"");try{let r=new URL(e),i=r.port==="4318"||r.protocol==="http:"||r.protocol==="https:"?"http":"grpc";return{url:i==="grpc"?r.origin:e,protocol:i}}catch(r){xf.error("Invalid OTLP endpoint URL provided:",e,r);return}}function oBe(t){if(cJ)return;let e=(0,nBe.defaultResource)().merge((0,nBe.resourceFromAttributes)({[rft]:Qm,[nft]:process.version,"session.id":t.getSessionId()})),r=t.getTelemetryOtlpEndpoint(),n=Mlo(r),i=!!n,o=t.getTelemetryOutfile(),s;i?s=new hOr.OTLPTraceExporter({url:`${n.url}/v1/traces`}):s=o?new ZRe(o):null;let a;i&&n?a=new gOr.OTLPLogExporter({url:`${n.url}/v1/logs`}):o?a=new eBe(o):a=null;let c;i?c=new KIe({exporter:new mOr.OTLPMetricExporter({url:`${n.url}/v1/metrics`,temporalityPreference:iBe.AggregationTemporality.DELTA}),exportIntervalMillis:2e4}):c=o?new iBe.PeriodicExportingMetricReader({exporter:new tBe(o),exportIntervalMillis:1e4}):null;let u={resource:e,serviceName:Qm,logRecordProcessors:[],spanProcessors:[],metricReaders:[]};s&&u.spanProcessors.push(new yOr.BatchSpanProcessor(s,{exportTimeoutMillis:1e4})),a&&u.logRecordProcessors.push(new EOr.BatchLogRecordProcessor(a,{exportTimeoutMillis:1e4})),c&&u.metricReaders.push(c),rBe=new AOr.NodeSDK({...u});try{rBe.start(),cJ=!0,GNr()}catch(d){console.error("Error starting OpenTelemetry SDK:",d)}process.on("SIGTERM",lJ),process.on("SIGINT",lJ)}async function vOr(){if(cJ)try{let{trace:t}=await Promise.resolve().then(()=>(Kt(),ar)),e=t.getTracerProvider();"forceFlush"in e&&await e.forceFlush();let{metrics:r}=await Promise.resolve().then(()=>(Kt(),ar)),n=r.getMeterProvider();"forceFlush"in n&&await n.forceFlush()}catch(t){process.env.DEBUG&&console.error("Error flushing telemetry:",t)}}async function lJ(){if(!(!cJ||!rBe))try{Mh.getInstance()?.shutdown(),await rBe.shutdown()}catch(t){console.error("Error shutting down SDK:",t)}finally{cJ=!1}}var hOr,mOr,gOr,AOr,nBe,yOr,EOr,iBe,rBe,cJ,sBe=Z(()=>{"use strict";Kt();hOr=Te(fht(),1),mOr=Te(yht(),1),gOr=Te(vht(),1),AOr=Te(KIr(),1);XIr();Oh();nBe=Te(z3t(),1),yOr=Te(S9e(),1),EOr=Te(lNr(),1),iBe=Te(Dx(),1);hpe();Vv();ype();pOr();process.env.DEBUG?xf.setLogger(new Gue,$p.DEBUG):xf.setLogger(new Gue,$p.NONE);cJ=!1});var bOr={};qs(bOr,{TraceContext:()=>ET});var ET,sEt=Z(()=>{"use strict";Kt();sBe();ET=class{static rootSpan=null;static tracer=F1.getTracer("iflow-cli-tracer");static spanLock=null;static startRootSpan(e="iflow_cli_request",r=!1){return this.rootSpan&&r&&(this.rootSpan.end(),this.rootSpan=null),this.rootSpan||(this.rootSpan=this.tracer.startSpan(e)),this.rootSpan}static async withRootSpan(e,r){let n=r?this.startRootSpan(r):this.getRootSpan();return n?c2.with(F1.setSpan(c2.active(),n),async()=>{try{return await e()}catch(i){throw n.recordException(i),n.setStatus({code:Cv.ERROR,message:i.message}),i}}):e()}static startChildSpan(e){return this.tracer.startSpan(e)}static async withChildSpan(e,r,n){let i=this.startChildSpan(e);return n&&i.setAttributes(n),c2.with(F1.setSpan(c2.active(),i),async()=>{try{let o=await r();return i.setStatus({code:Cv.OK}),o}catch(o){throw i.recordException(o),i.setStatus({code:Cv.ERROR,message:o.message}),o}finally{i.end()}})}static getRootSpan(){return this.rootSpan}static async endRootSpan(){this.spanLock&&await this.spanLock,this.spanLock=(async()=>{if(this.rootSpan){let e=this.rootSpan;this.rootSpan=null,e.end();try{await vOr()}catch{}}})(),await this.spanLock,this.spanLock=null}static getActiveSpan(){return F1.getActiveSpan()}static setSpanAttributes(e){let r=this.getActiveSpan();r&&r.setAttributes(e)}static addSpanEvent(e,r){let n=this.getActiveSpan();n&&n.addEvent(e,r)}}});function vpe(){let t=F1.getActiveSpan();if(t){let r=t.spanContext();if(r&&r.traceId&&r.spanId){let i=r.traceId,o=r.spanId,s=(r.traceFlags||0).toString(16).padStart(2,"0");return`00-${i}-${o}-${s}`}}return GF.getCurrentSession()?.traceparent}function bpe(t){let e=vpe();return e?{...t,traceparent:e}:t}function aEt(){return vpe()}async function qF(t,e,r){let n=F1.getTracer("iflow-cli"),{TraceContext:i}=await Promise.resolve().then(()=>(sEt(),bOr)),o=i.getRootSpan(),s;if(o){let a=F1.setSpan(c2.active(),o);s=c2.with(a,()=>n.startSpan(t,{attributes:e}))}else s=n.startSpan(t,{attributes:e});try{return await c2.with(F1.setSpan(c2.active(),s),r)}catch(a){throw s.recordException(a),s.setStatus({code:Cv.ERROR,message:a instanceof Error?a.message:"Unknown error"}),a}finally{s.end()}}var HF=Z(()=>{"use strict";Kt();aBe();});var cBe,GF,aBe=Z(()=>{"use strict";Edt();vdt();HF();cBe=class{currentSession=null;async startSession(e,r,n,i){let{model:o,tool:s}=i||{},a="iflow",c="cli",u=L_e(),d=Bz(),f=`${a}.${c}.${n}.${u}`,p=k0r(u,d),h=Date.now();this.currentSession={traceId:u,parent_observation_id:d,conversationId:n,sessionId:e,userId:r,pid:a,sceneId:c,sam:f,traceparent:p,startTime:h,model:o,tool:s};let m={gmkey:"AI",gokey:this.stringifyGokey({pid:a,sam:f,trace_id:u,observation_id:d,model:o,tool:s,sessionId:e,user_id:r})};return await Fue("/aitrack.lifecycle.run_started",m),this.currentSession}async endSession(){if(!this.currentSession)return;let{pid:e,sam:r,traceId:n,parent_observation_id:i,model:o,tool:s,sessionId:a,userId:c,startTime:u}=this.currentSession,d=Date.now()-u,f=Bz(),p={gmkey:"AI",gokey:this.stringifyGokey({pid:e,sam:r,trace_id:n,observation_id:f,parent_observation_id:i,duration:d,model:o,tool:s,sessionId:a,user_id:c})};await Fue("/aitrack.lifecycle.run_finished",p),this.currentSession=null}async recordError(e){if(!this.currentSession)throw new Error("No active session to record error");let{pid:r,sam:n,traceId:i,parent_observation_id:o,model:s,tool:a,sessionId:c,userId:u}=this.currentSession,d=Bz(),f="",p="";e instanceof Error?(f=e.cause?`${e.message}:${e.cause.message}`:e.message,p=e.cause?e.cause.stack||"":e.stack||""):f=String(e);let h=vpe(),m=i;if(h){let A=h.split("-");A.length>=2&&(m=A[1])}let g={gmkey:"AI",gokey:this.stringifyGokey({pid:r,sam:n,trace_id:m,observation_id:d,parent_observation_id:o,error_msg:`${f}
|
|
451
|
-
${p.slice(0,500)}`,model:s,tool:a,sessionId:c,cliVer:"0.3.22
|
|
451
|
+
${p.slice(0,500)}`,model:s,tool:a,sessionId:c,cliVer:"0.3.22",user_id:u})};await Fue("/aitrack.lifecycle.run_error",g)}getCurrentSession(){return this.currentSession}stringifyGokey(e){return Object.entries(e).map(([r,n])=>`${encodeURIComponent(r)}=${encodeURIComponent(String(n))}`).join("&")}},GF=new cBe});var COr=w((CLa,Llo)=>{Llo.exports={name:"systeminformation",version:"5.27.11",description:"Advanced, lightweight system and OS information library",license:"MIT",author:"Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",homepage:"https://systeminformation.io",main:"./lib/index.js",type:"commonjs",bin:{systeminformation:"lib/cli.js"},types:"./lib/index.d.ts",scripts:{test:"node ./test/test.js",testDeno:"deno run -A ./test/test.js"},files:["lib/"],keywords:["system information","sysinfo","monitor","monitoring","os","linux","osx","windows","freebsd","openbsd","netbsd","cpu","cpuload","physical cores","logical cores","processor","cores","threads","socket type","memory","file system","fsstats","diskio","block devices","netstats","network","network interfaces","network connections","network stats","iface","printer","processes","users","internet","battery","docker","docker stats","docker processes","graphics","graphic card","graphic controller","gpu","display","smart","disk layout","usb","audio","bluetooth","wifi","wifinetworks","virtual box","virtualbox","vm","backend","hardware","BIOS","chassis"],repository:{type:"git",url:"git+https://github.com/sebhildebrandt/systeminformation.git"},funding:{type:"Buy me a coffee",url:"https://www.buymeacoffee.com/systeminfo"},os:["darwin","linux","win32","freebsd","openbsd","netbsd","sunos","android"],engines:{node:">=8.0.0"}}});var Zp=w(Di=>{"use strict";var dJ=Ae("os"),n5=Ae("fs"),Flo=Ae("path"),hEt=Ae("child_process").spawn,Ulo=Ae("child_process").exec,fJ=Ae("child_process").execSync,Qlo=Ae("util"),VF=process.platform,mEt=VF==="linux"||VF==="android",SOr=VF==="darwin",fBe=VF==="win32",wOr=VF==="freebsd",TOr=VF==="openbsd",IOr=VF==="netbsd",cEt=0,jF="",t5="",hB=null,r5=null,gEt=process.env.WINDIR||"C:\\Windows",Lh,uJ="",Cpe=[],AEt=!1,uBe="",qlo="$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ",uEt="--###START###--",_Or="--ERROR--",dBe="--###ENDCMD###--",dEt="--##ID##--",_pe={windowsHide:!0,maxBuffer:1024*2e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})},pBe={maxBuffer:1024*2e4,encoding:"UTF-8",stdio:["pipe","pipe","ignore"]};function Hlo(t){let e=parseInt(t,10);return isNaN(e)&&(e=0),e}function Glo(t){let e=!1,r="",n="";for(let i of t)i>="0"&&i<="9"||e?(e=!0,r+=i):n+=i;return[n,r]}var lBe=new String,fEt=new String().replace,pEt=new String().toLowerCase,DOr=new String().toString,ROr=new String().substr,BOr=new String().substring,NOr=new String().trim,OOr=new String().startsWith,kOr=Math.min;function jlo(t){return t&&{}.toString.call(t)==="[object Function]"}function Vlo(t){let e=[],r={};for(let n=0;n<t.length;n++){let i=Object.keys(t[n]);i.sort(function(s,a){return s-a});let o="";for(let s=0;s<i.length;s++)o+=JSON.stringify(i[s]),o+=JSON.stringify(t[n][i[s]]);({}).hasOwnProperty.call(r,o)||(e.push(t[n]),r[o]=!0)}return e}function $lo(t,e){return t.sort(function(r,n){let i="",o="";return e.forEach(function(s){i=i+r[s],o=o+n[s]}),i<o?-1:i>o?1:0})}function Wlo(){return cEt===0&&(cEt=dJ.cpus().length),cEt}function mB(t,e,r,n,i){r=r||":",e=e.toLowerCase(),n=n||!1,i=i||!1;let o="";return t.some(s=>{let a=s.toLowerCase().replace(/\t/g,"");if(n&&(a=a.trim()),a.startsWith(e)&&(!i||a.match(e+r)||a.match(e+" "+r))){let c=n?s.trim().split(r):s.split(r);if(c.length>=2)return c.shift(),o=c.join(r).trim(),!0}}),o}function zlo(t,e){return e=e||16,t.replace(/\\x([0-9A-Fa-f]{2})/g,function(){return String.fromCharCode(parseInt(arguments[1],e))})}function Ylo(t){let e="",r=0;return t.split("").forEach(n=>{n>="0"&&n<="9"?r===1&&r++:(r===0&&r++,r===1&&(e+=n))}),e}function Klo(t,e){e=e||"",t=t.toUpperCase();let r=0,n=0,i=Ylo(t),o=t.split(i);if(o.length>=2){o[2]&&(o[1]+=o[2]);let s=o[1]&&o[1].toLowerCase().indexOf("pm")>-1||o[1].toLowerCase().indexOf("p.m.")>-1||o[1].toLowerCase().indexOf("p. m.")>-1||o[1].toLowerCase().indexOf("n")>-1||o[1].toLowerCase().indexOf("ch")>-1||o[1].toLowerCase().indexOf("\xF6s")>-1||e&&o[1].toLowerCase().indexOf(e)>-1;return r=parseInt(o[0],10),n=parseInt(o[1],10),r=s&&r<12?r+12:r,("0"+r).substr(-2)+":"+("0"+n).substr(-2)}}function Jlo(t,e){let r={date:"",time:""};e=e||{};let n=(e.dateFormat||"").toLowerCase(),i=e.pmDesignator||"",o=t.split(" ");if(o[0]){if(o[0].indexOf("/")>=0){let s=o[0].split("/");s.length===3&&(s[0].length===4?r.date=s[0]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[2]).substr(-2):s[2].length===2?(n.indexOf("/d/")>-1||n.indexOf("/dd/")>-1,r.date="20"+s[2]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[0]).substr(-2)):(t.toLowerCase().indexOf("pm")>-1||t.toLowerCase().indexOf("p.m.")>-1||t.toLowerCase().indexOf("p. m.")>-1||t.toLowerCase().indexOf("am")>-1||t.toLowerCase().indexOf("a.m.")>-1||t.toLowerCase().indexOf("a. m.")>-1||n.indexOf("/d/")>-1||n.indexOf("/dd/")>-1)&&n.indexOf("dd/")!==0?r.date=s[2]+"-"+("0"+s[0]).substr(-2)+"-"+("0"+s[1]).substr(-2):r.date=s[2]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[0]).substr(-2))}if(o[0].indexOf(".")>=0){let s=o[0].split(".");s.length===3&&(n.indexOf(".d.")>-1||n.indexOf(".dd.")>-1?r.date=s[2]+"-"+("0"+s[0]).substr(-2)+"-"+("0"+s[1]).substr(-2):r.date=s[2]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[0]).substr(-2))}if(o[0].indexOf("-")>=0){let s=o[0].split("-");s.length===3&&(r.date=s[0]+"-"+("0"+s[1]).substr(-2)+"-"+("0"+s[2]).substr(-2))}}if(o[1]){o.shift();let s=o.join(" ");r.time=Klo(s,i)}return r}function Xlo(t,e){let r=e>0,n=1,i=0,o=0,s=[];for(let c=0;c<t.length;c++)n<=e?(/\s/.test(t[c])&&!r&&(o=c-1,s.push({from:i,to:o+1,cap:t.substring(i,o+1)}),i=o+2,n++),r=t[c]===" "):(!/\s/.test(t[c])&&r&&(o=c-1,i<o&&s.push({from:i,to:o,cap:t.substring(i,o)}),i=o+1,n++),r=t[c]===" ");o=5e3,s.push({from:i,to:o,cap:t.substring(i,o)});let a=s.length;for(let c=0;c<a;c++)s[c].cap.replace(/\s/g,"").length===0&&c+1<a&&(s[c].to=s[c+1].to,s[c].cap=s[c].cap+s[c+1].cap,s.splice(c+1,1),a=a-1);return s}function Zlo(t,e,r){for(let n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1}function euo(){if(uBe="powershell.exe",fBe){let t=`${gEt}\\system32\\WindowsPowerShell\\v1.0\\powershell.exe`;n5.existsSync(t)&&(uBe=t)}}function POr(){if(dJ.type()==="Windows_NT"&&!jF&&(jF=gEt+"\\system32\\wbem\\wmic.exe",!n5.existsSync(jF)))try{let t=fJ("WHERE WMIC",_pe).toString().split(`\r
|
|
452
452
|
`);t&&t.length?jF=t[0]:jF="wmic"}catch{jF="wmic"}return jF}function tuo(t){return new Promise(e=>{process.nextTick(()=>{try{MOr(POr()+" "+t).then(r=>{e(r,"")})}catch(r){e("",r)}})})}function ruo(){return fBe?`"${process.env.VBOX_INSTALL_PATH||process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"`:"vboxmanage"}function lEt(t){let e="",r,n="";if(t.indexOf(uEt)>=0){r=t.split(uEt);let o=r[1].split(dEt);e=o[0],o.length>1&&(t=o.slice(1).join(dEt))}t.indexOf(dBe)>=0&&(r=t.split(dBe),n=r[0]);let i=-1;for(let o=0;o<Cpe.length;o++)Cpe[o].id===e&&(i=o,Cpe[o].callback(n));i>=0&&Cpe.splice(i,1)}function nuo(){Lh||(Lh=hEt(uBe,["-NoProfile","-NoLogo","-InputFormat","Text","-NoExit","-Command","-"],{stdio:"pipe",windowsHide:!0,maxBuffer:1024*2e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})}),Lh&&Lh.pid&&(AEt=!0,Lh.stdout.on("data",function(t){uJ=uJ+t.toString("utf8"),t.indexOf(dBe)>=0&&(lEt(uJ),uJ="")}),Lh.stderr.on("data",function(){lEt(uJ+_Or)}),Lh.on("error",function(){lEt(uJ+_Or)}),Lh.on("close",function(){Lh&&Lh.kill()})))}function iuo(){try{Lh&&(Lh.stdin.write("exit"+dJ.EOL),Lh.stdin.end(),AEt=!1)}catch{Lh&&Lh.kill()}Lh=null}function MOr(t){if(AEt){let e=Math.random().toString(36).substring(2,12);return new Promise(r=>{process.nextTick(()=>{function n(i){r(i)}Cpe.push({id:e,cmd:t,callback:n,start:new Date});try{Lh&&Lh.pid&&Lh.stdin.write(qlo+"echo "+uEt+e+dEt+"; "+dJ.EOL+t+dJ.EOL+"echo "+dBe+dJ.EOL)}catch{r("")}})})}else{let e="";return new Promise(r=>{process.nextTick(()=>{try{let n=hEt(uBe,["-NoProfile","-NoLogo","-InputFormat","Text","-ExecutionPolicy","Unrestricted","-Command",t],{stdio:"pipe",windowsHide:!0,maxBuffer:2048e4,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})});n&&!n.pid&&n.on("error",function(){r(e)}),n&&n.pid?(n.stdout.on("data",function(i){e=e+i.toString("utf8")}),n.stderr.on("data",function(){n.kill(),r(e)}),n.on("close",function(){n.kill(),r(e)}),n.on("error",function(){n.kill(),r(e)})):r(e)}catch{r(e)}})})}}function ouo(t,e,r){let n="";return r=r||{},new Promise(i=>{process.nextTick(()=>{try{let o=hEt(t,e,r);o&&!o.pid&&o.on("error",function(){i(n)}),o&&o.pid?(o.stdout.on("data",function(s){n+=s.toString()}),o.on("close",function(){o.kill(),i(n)}),o.on("error",function(){o.kill(),i(n)})):i(n)}catch{i(n)}})})}function suo(){if(fBe){if(!t5)try{let r=fJ("chcp",_pe).toString().split(`\r
|
|
453
453
|
`)[0].split(":");t5=r.length>1?r[1].replace(".","").trim():""}catch{t5="437"}return t5}if(mEt||SOr||wOr||TOr||IOr){if(!t5)try{let r=fJ("echo $LANG",pBe).toString().split(`\r
|
|
454
454
|
`)[0].split(".");t5=r.length>1?r[1].trim():"",t5||(t5="UTF-8")}catch{t5="UTF-8"}return t5}}function auo(){if(hB!==null)return hB;if(hB=!1,fBe)try{let t=fJ("WHERE smartctl 2>nul",_pe).toString().split(`\r
|
|
@@ -911,7 +911,7 @@ Otherwise navigate to:
|
|
|
911
911
|
|
|
912
912
|
${e}
|
|
913
913
|
|
|
914
|
-
`);try{(await s2(e)).on("error",o=>{throw new Error(`BROWSER_LAUNCH_FAILED: Failed to open browser automatically: ${o.message}. Please navigate to the URL manually.`)})}catch(i){throw new Error(`BROWSER_LAUNCH_FAILED: An unexpected error occurred while trying to open the browser: ${i}. Please navigate to the URL manually.`)}console.log("Waiting for authentication...");let n=0;for(;n<r.maxRetries;){await rMr(r.pollInterval);let i=await nMr(t,r);if(i.isSuccess()){let o=i.getPrivateToken();return await IT.savePrivateToken(o),console.log("Aone authentication successful!"),!0}i.getError()&&console.log(`Waiting for authentication... (${n+1}/${r.maxRetries})`),n++}throw new Error("Authentication timeout. Please try again.")}async function fNe(t=new FJ){return await IT.hasValidToken()?(console.log("Using cached Aone authentication."),!0):await iMr(t)}async function _S(){return await IT.loadPrivateToken()}async function pNe(){await IT.clearPrivateToken(),console.log("Aone authentication cleared.")}async function Hho(){return await IT.hasValidToken()}async function Gho(t=new FJ){return await pNe(),await fNe(t)}var hNe=Z(()=>{"use strict";y4t();G9();ZPr();eMr();tMr();});async function E4t(t,e,r,n){if(e===zt.LOGIN_WITH_IFLOW){let i=await EL(e,r),o=await RC();if(!o)throw new Error("No API key found. Please re-authenticate.");let s=r.getContentGeneratorConfig();return new tU({model:r.getModel(),apiKey:o,baseUrl:s?.baseUrl||Ype,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen3-vl-plus",config:r})}if(e===zt.LOGIN_WITH_AONE){if(!await fNe())throw new Error("Aone authentication failed. Please try again.");let o=await _S();if(!o)throw new Error("No Aone private token found. Please re-authenticate.");let s=r.getContentGeneratorConfig(),a=Buffer.from(o,"utf8").toString("base64");return new tU({model:r.getModel(),apiKey:a,baseUrl:s?.baseUrl||"https://ducky.code.alibaba-inc.com/v1/openai",authType:e,debugMode:r.getDebugMode(),multimodalModelName:s?.multimodalModelName,config:r})}if(e===zt.CLOUD_SHELL){let i=await EL(e,r),o=await B0r(i);return new V9(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var v4t=Z(()=>{"use strict";rE();xR();N0r();P_e();d4t();a5();hNe();});function jho(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function xS(t){let e=jho(t),r=`IFLOW_${t}`;if(process.env[r])return process.env[r];let n=`IFLOW_${e}`;if(process.env[n])return process.env[n];let i=`iflow_${t}`;if(process.env[i])return process.env[i];let o=`iflow_${e}`;if(process.env[o])return process.env[o]}function Zpe(){return xS("apiKey")}function ehe(){return xS("baseUrl")||xS("url")}function the(){return xS("modelName")||xS("model")}function oMr(t){let e=xS(t);if(e===void 0)return;let r=e.toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}function sMr(t){let e=xS(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function aMr(t){let e=xS(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function mNe(){return!!(Zpe()||ehe()||the())}function b4t(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],r=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate","skipNextSpeakerCheck","useRipgrep","debugKeystrokeLogging","pasteFromClipboard"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","compressionTokenThreshold","shellTimeout","temperature","topP"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=xS(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=oMr(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=sMr(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=aMr(o);s!==void 0&&(t[o]=s)}),t}function Vho(){return{apiKey:Zpe(),baseUrl:ehe(),model:the()}}var C4t=Z(()=>{"use strict";});async function _4t(t,e,r){await Iz()&&(await O_e()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted."));let i=Zpe(),o=ehe(),s=the(),a=r?.apiKey||i,c=r?.baseUrl||o||$ho[e],u=r?.modelName||t.getModel()||s||AE,d={model:u,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===zt.CLOUD_SHELL?d:e===zt.LOGIN_WITH_IFLOW?(d.baseUrl=c||Ype,d.multimodalModelName="qwen3-vl-plus",a&&(d.apiKey=a),d):([...yE,zt.OPENAI_COMPATIBLE].includes(e)&&a&&(d.apiKey=a,d.baseUrl=c,d.model=u),d)}async function x4t(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.3.22
|
|
914
|
+
`);try{(await s2(e)).on("error",o=>{throw new Error(`BROWSER_LAUNCH_FAILED: Failed to open browser automatically: ${o.message}. Please navigate to the URL manually.`)})}catch(i){throw new Error(`BROWSER_LAUNCH_FAILED: An unexpected error occurred while trying to open the browser: ${i}. Please navigate to the URL manually.`)}console.log("Waiting for authentication...");let n=0;for(;n<r.maxRetries;){await rMr(r.pollInterval);let i=await nMr(t,r);if(i.isSuccess()){let o=i.getPrivateToken();return await IT.savePrivateToken(o),console.log("Aone authentication successful!"),!0}i.getError()&&console.log(`Waiting for authentication... (${n+1}/${r.maxRetries})`),n++}throw new Error("Authentication timeout. Please try again.")}async function fNe(t=new FJ){return await IT.hasValidToken()?(console.log("Using cached Aone authentication."),!0):await iMr(t)}async function _S(){return await IT.loadPrivateToken()}async function pNe(){await IT.clearPrivateToken(),console.log("Aone authentication cleared.")}async function Hho(){return await IT.hasValidToken()}async function Gho(t=new FJ){return await pNe(),await fNe(t)}var hNe=Z(()=>{"use strict";y4t();G9();ZPr();eMr();tMr();});async function E4t(t,e,r,n){if(e===zt.LOGIN_WITH_IFLOW){let i=await EL(e,r),o=await RC();if(!o)throw new Error("No API key found. Please re-authenticate.");let s=r.getContentGeneratorConfig();return new tU({model:r.getModel(),apiKey:o,baseUrl:s?.baseUrl||Ype,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen3-vl-plus",config:r})}if(e===zt.LOGIN_WITH_AONE){if(!await fNe())throw new Error("Aone authentication failed. Please try again.");let o=await _S();if(!o)throw new Error("No Aone private token found. Please re-authenticate.");let s=r.getContentGeneratorConfig(),a=Buffer.from(o,"utf8").toString("base64");return new tU({model:r.getModel(),apiKey:a,baseUrl:s?.baseUrl||"https://ducky.code.alibaba-inc.com/v1/openai",authType:e,debugMode:r.getDebugMode(),multimodalModelName:s?.multimodalModelName,config:r})}if(e===zt.CLOUD_SHELL){let i=await EL(e,r),o=await B0r(i);return new V9(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var v4t=Z(()=>{"use strict";rE();xR();N0r();P_e();d4t();a5();hNe();});function jho(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function xS(t){let e=jho(t),r=`IFLOW_${t}`;if(process.env[r])return process.env[r];let n=`IFLOW_${e}`;if(process.env[n])return process.env[n];let i=`iflow_${t}`;if(process.env[i])return process.env[i];let o=`iflow_${e}`;if(process.env[o])return process.env[o]}function Zpe(){return xS("apiKey")}function ehe(){return xS("baseUrl")||xS("url")}function the(){return xS("modelName")||xS("model")}function oMr(t){let e=xS(t);if(e===void 0)return;let r=e.toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}function sMr(t){let e=xS(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function aMr(t){let e=xS(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function mNe(){return!!(Zpe()||ehe()||the())}function b4t(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],r=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate","skipNextSpeakerCheck","useRipgrep","debugKeystrokeLogging","pasteFromClipboard"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","compressionTokenThreshold","shellTimeout","temperature","topP"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=xS(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=oMr(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=sMr(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=aMr(o);s!==void 0&&(t[o]=s)}),t}function Vho(){return{apiKey:Zpe(),baseUrl:ehe(),model:the()}}var C4t=Z(()=>{"use strict";});async function _4t(t,e,r){await Iz()&&(await O_e()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted."));let i=Zpe(),o=ehe(),s=the(),a=r?.apiKey||i,c=r?.baseUrl||o||$ho[e],u=r?.modelName||t.getModel()||s||AE,d={model:u,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===zt.CLOUD_SHELL?d:e===zt.LOGIN_WITH_IFLOW?(d.baseUrl=c||Ype,d.multimodalModelName="qwen3-vl-plus",a&&(d.apiKey=a),d):([...yE,zt.OPENAI_COMPATIBLE].includes(e)&&a&&(d.apiKey=a,d.baseUrl=c,d.model=u),d)}async function x4t(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.3.22 (${process.platform}; ${process.arch})`}};if(t.authType&&[...yE,zt.IDEA_LAB].includes(t.authType)||t.authType===zt.OPENAI_COMPATIBLE)return new tU({...t,config:e});if(t.authType===zt.LOGIN_WITH_IFLOW||t.authType===zt.LOGIN_WITH_AONE||t.authType===zt.CLOUD_SHELL)return E4t(i,t.authType,e,r);throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var zt,yE,$ho,rE=Z(()=>{"use strict";v4t();a5();d4t();C4t();xR();(function(t){t.LOGIN_WITH_IFLOW="oauth-iflow",t.LOGIN_WITH_AONE="oauth-aone",t.CLOUD_SHELL="cloud-shell",t.IFLOW="iflow",t.AONE="aone",t.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})(zt||(zt={}));yE=[zt.IFLOW,zt.AONE],$ho={[zt.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[zt.IFLOW]:Ype,[zt.AONE]:OPr}});var gNe,cMr=Z(()=>{"use strict";gNe=class{prompts=new Map;registerPrompt(e){if(this.prompts.has(e.name)){let r=`${e.serverName}_${e.name}`;console.warn(`Prompt with name "${e.name}" is already registered. Renaming to "${r}".`),this.prompts.set(r,{...e,name:r})}else this.prompts.set(e.name,e)}getAllPrompts(){return Array.from(this.prompts.values()).sort((e,r)=>e.name.localeCompare(r.name))}getPrompt(e){return this.prompts.get(e)}getPromptsByServer(e){let r=[];for(let n of this.prompts.values())n.serverName===e&&r.push(n);return r.sort((n,i)=>n.name.localeCompare(i.name))}clear(){this.prompts.clear()}removePromptsByServer(e){for(let[r,n]of this.prompts.entries())n.serverName===e&&this.prompts.delete(r)}}});var sn,EE=Z(()=>{"use strict";(function(t){t.INVALID_TOOL_PARAMS="invalid_tool_params",t.UNKNOWN="unknown",t.UNHANDLED_EXCEPTION="unhandled_exception",t.TOOL_NOT_REGISTERED="tool_not_registered",t.EXECUTION_FAILED="execution_failed",t.FILE_NOT_FOUND="file_not_found",t.FILE_WRITE_FAILURE="file_write_failure",t.READ_CONTENT_FAILURE="read_content_failure",t.ATTEMPT_TO_CREATE_EXISTING_FILE="attempt_to_create_existing_file",t.FILE_TOO_LARGE="file_too_large",t.PERMISSION_DENIED="permission_denied",t.NO_SPACE_LEFT="no_space_left",t.TARGET_IS_DIRECTORY="target_is_directory",t.PATH_NOT_IN_WORKSPACE="path_not_in_workspace",t.SEARCH_PATH_NOT_FOUND="search_path_not_found",t.SEARCH_PATH_NOT_A_DIRECTORY="search_path_not_a_directory",t.EDIT_PREPARATION_FAILURE="edit_preparation_failure",t.EDIT_NO_OCCURRENCE_FOUND="edit_no_occurrence_found",t.EDIT_EXPECTED_OCCURRENCE_MISMATCH="edit_expected_occurrence_mismatch",t.EDIT_NO_CHANGE="edit_no_change",t.GLOB_EXECUTION_ERROR="glob_execution_error",t.GREP_EXECUTION_ERROR="grep_execution_error",t.LS_EXECUTION_ERROR="ls_execution_error",t.PATH_IS_NOT_A_DIRECTORY="path_is_not_a_directory",t.MCP_TOOL_ERROR="mcp_tool_error",t.MEMORY_TOOL_EXECUTION_ERROR="memory_tool_execution_error",t.READ_MANY_FILES_SEARCH_ERROR="read_many_files_search_error",t.DISCOVERED_TOOL_EXECUTION_ERROR="discovered_tool_execution_error",t.WEB_FETCH_NO_URL_IN_PROMPT="web_fetch_no_url_in_prompt",t.WEB_FETCH_FALLBACK_FAILED="web_fetch_fallback_failed",t.WEB_FETCH_PROCESSING_ERROR="web_fetch_processing_error",t.WEB_SEARCH_FAILED="web_search_failed",t.HOOK_BLOCKED="hook_blocked"})(sn||(sn={}))});function Who(t){return{text:t.text}}function zho(t,e){return[{text:B.t("mcpTool.messages.mediaDataProvided",{toolName:e,type:t.type,mimeType:t.mimeType})},{inlineData:{mimeType:t.mimeType,data:t.data}}]}function Yho(t,e){let r=t.resource;if(r?.text)return{text:r.text};if(r?.blob){let n=r.mimeType||"application/octet-stream";return[{text:B.t("mcpTool.messages.embeddedResourceProvided",{toolName:e,mimeType:n})},{inlineData:{mimeType:n,data:r.blob}}]}return null}function Kho(t){return{text:B.t("mcpTool.messages.resourceLink",{title:t.title||t.name,uri:t.uri})}}function Jho(t){let e=t?.[0]?.functionResponse,r=e?.response?.content,n=e?.name||"unknown tool";return Array.isArray(r)?r.flatMap(o=>{switch(o.type){case"text":return Who(o);case"image":case"audio":return zho(o,n);case"resource":return Yho(o,n);case"resource_link":return Kho(o);default:return null}}).filter(o=>o!==null):[{text:B.t("mcpTool.errors.parseResponseFailed")}]}function Xho(t){let e=t?.[0]?.functionResponse?.response?.content;return Array.isArray(e)?e.map(n=>{switch(n.type){case"text":return n.text;case"image":return B.t("mcpTool.display.image",{mimeType:n.mimeType});case"audio":return B.t("mcpTool.display.audio",{mimeType:n.mimeType});case"resource_link":return B.t("mcpTool.display.resourceLink",{title:n.title||n.name,uri:n.uri});case"resource":return n.resource?.text?n.resource.text:B.t("mcpTool.display.embeddedResource",{mimeType:n.resource?.mimeType||B.t("mcpTool.display.unknownType")});default:return B.t("mcpTool.display.unknownContentType",{type:n.type})}}).join(`
|
|
915
915
|
`):"```json\n"+JSON.stringify(t,null,2)+"\n```"}function lMr(t){let e=t.replace(/[^a-zA-Z0-9_.-]/g,"_");return e.length>63&&(e=e.slice(0,28)+"___"+e.slice(-32)),e}var rg,rhe=Z(()=>{"use strict";$Re();EE();Id();Lc();ui();rg=class t extends Do{mcpTool;serverName;serverToolName;parameterSchemaJson;timeout;trust;static allowlist=new Set;constructor(e,r,n,i,o,s,a,c){super(c??lMr(n),`${n} (${r} MCP Server)`,i,Ro.Hammer,Bo.Other,{type:lr.OBJECT},!0,!1),this.mcpTool=e,this.serverName=r,this.serverToolName=n,this.parameterSchemaJson=o,this.timeout=s,this.trust=a}asFullyQualifiedTool(){return new t(this.mcpTool,this.serverName,this.serverToolName,this.description,this.parameterSchemaJson,this.timeout,this.trust,`${this.serverName}__${this.serverToolName}`)}get schema(){return{name:this.name,description:this.description,parametersJsonSchema:this.parameterSchemaJson}}async shouldConfirmExecute(e,r){let n=this.serverName,i=`${this.serverName}.${this.serverToolName}`;return this.trust||t.allowlist.has(n)||t.allowlist.has(i)?!1:{type:"mcp",title:B.t("mcpTool.messages.confirmExecution"),serverName:this.serverName,toolName:this.serverToolName,toolDisplayName:this.name,onConfirm:async s=>{s===yn.ProceedAlwaysServer?t.allowlist.add(n):s===yn.ProceedAlwaysTool&&t.allowlist.add(i)}}}isMCPToolError(e){let n=e?.[0]?.functionResponse?.response;if(n){let i=n?.error,o=i?.isError;if(i&&(o===!0||o==="true"))return!0}return!1}async execute(e){let{callId:r,...n}=e,i=[{name:this.serverToolName,args:n}],o=await this.mcpTool.callTool(i);if(this.isMCPToolError(o)){let a=`MCP tool '${this.serverToolName}' reported tool error for function call: ${UF(i[0])} with response: ${UF(o)}`;return{llmContent:a,returnDisplay:B.t("mcpTool.errors.toolReportedError",{toolName:this.serverToolName}),error:{message:a,type:sn.MCP_TOOL_ERROR}}}return{llmContent:Jho(o),returnDisplay:Xho(o)}}}});var dMr=w((fQa,uMr)=>{"use strict";uMr.exports=function(e){return e.map(function(r){return r===""?"''":r&&typeof r=="object"?r.op.replace(/(.)/g,"\\$1"):/["\s\\]/.test(r)&&!/'/.test(r)?"'"+r.replace(/(['])/g,"\\$1")+"'":/["'\s]/.test(r)?'"'+r.replace(/(["\\$`!])/g,"\\$1")+'"':String(r).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")}});var yMr=w((pQa,AMr)=>{"use strict";var gMr="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",fMr=new RegExp("^"+gMr+"$"),pMr="|&;()<> \\t",Zho='"((\\\\"|[^"])*?)"',emo="'((\\\\'|[^'])*?)'",tmo=/^#$/,hMr="'",mMr='"',S4t="$",rU="",rmo=4294967296;for(w4t=0;w4t<4;w4t++)rU+=(rmo*Math.random()).toString(16);var w4t,nmo=new RegExp("^"+rU);function imo(t,e){for(var r=e.lastIndex,n=[],i;i=e.exec(t);)n.push(i),e.lastIndex===i.index&&(e.lastIndex+=1);return e.lastIndex=r,n}function omo(t,e,r){var n=typeof t=="function"?t(r):t[r];return typeof n>"u"&&r!=""?n="":typeof n>"u"&&(n="$"),typeof n=="object"?e+rU+JSON.stringify(n)+rU:e+n}function smo(t,e,r){r||(r={});var n=r.escape||"\\",i="(\\"+n+`['"`+pMr+`]|[^\\s'"`+pMr+"])+",o=new RegExp(["("+gMr+")","("+i+"|"+Zho+"|"+emo+")+"].join("|"),"g"),s=imo(t,o);if(s.length===0)return[];e||(e={});var a=!1;return s.map(function(c){var u=c[0];if(!u||a)return;if(fMr.test(u))return{op:u};var d=!1,f=!1,p="",h=!1,m;function g(){m+=1;var E,v,C=u.charAt(m);if(C==="{"){if(m+=1,u.charAt(m)==="}")throw new Error("Bad substitution: "+u.slice(m-2,m+1));if(E=u.indexOf("}",m),E<0)throw new Error("Bad substitution: "+u.slice(m));v=u.slice(m,E),m=E}else if(/[*@#?$!_-]/.test(C))v=C,m+=1;else{var S=u.slice(m);E=S.match(/[^\w\d_]/),E?(v=S.slice(0,E.index),m+=E.index-1):(v=S,m=u.length)}return omo(e,"",v)}for(m=0;m<u.length;m++){var A=u.charAt(m);if(h=h||!d&&(A==="*"||A==="?"),f)p+=A,f=!1;else if(d)A===d?d=!1:d==hMr?p+=A:A===n?(m+=1,A=u.charAt(m),A===mMr||A===n||A===S4t?p+=A:p+=n+A):A===S4t?p+=g():p+=A;else if(A===mMr||A===hMr)d=A;else{if(fMr.test(A))return{op:u};if(tmo.test(A)){a=!0;var y={comment:t.slice(c.index+m+1)};return p.length?[p,y]:[y]}else A===n?f=!0:A===S4t?p+=g():p+=A}}return h?{op:"glob",pattern:p}:p}).reduce(function(c,u){return typeof u>"u"?c:c.concat(u)},[])}AMr.exports=function(e,r,n){var i=smo(e,r,n);return typeof r!="function"?i:i.reduce(function(o,s){if(typeof s=="object")return o.concat(s);var a=s.split(RegExp("("+rU+".*?"+rU+")","g"));return a.length===1?o.concat(a[0]):o.concat(a.filter(Boolean).map(function(c){return nmo.test(c)?JSON.parse(c.split(rU)[1]):c}))},[])}});var ANe=w(T4t=>{"use strict";T4t.quote=dMr();T4t.parse=yMr()});var Xs,I4t,kn,SS,nhe=Z(()=>{(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Xs||(Xs={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(I4t||(I4t={}));kn=Xs.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),SS=t=>{switch(typeof t){case"undefined":return kn.undefined;case"string":return kn.string;case"number":return Number.isNaN(t)?kn.nan:kn.number;case"boolean":return kn.boolean;case"function":return kn.function;case"bigint":return kn.bigint;case"symbol":return kn.symbol;case"object":return Array.isArray(t)?kn.array:t===null?kn.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?kn.promise:typeof Map<"u"&&t instanceof Map?kn.map:typeof Set<"u"&&t instanceof Set?kn.set:typeof Date<"u"&&t instanceof Date?kn.date:kn.object;default:return kn.unknown}}});var jr,amo,R3,yNe=Z(()=>{nhe();jr=Xs.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),amo=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),R3=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Xs.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};R3.create=t=>new R3(t)});var cmo,DT,D4t=Z(()=>{yNe();nhe();cmo=(t,e)=>{let r;switch(t.code){case jr.invalid_type:t.received===kn.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case jr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Xs.jsonStringifyReplacer)}`;break;case jr.unrecognized_keys:r=`Unrecognized key(s) in object: ${Xs.joinValues(t.keys,", ")}`;break;case jr.invalid_union:r="Invalid input";break;case jr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Xs.joinValues(t.options)}`;break;case jr.invalid_enum_value:r=`Invalid enum value. Expected ${Xs.joinValues(t.options)}, received '${t.received}'`;break;case jr.invalid_arguments:r="Invalid function arguments";break;case jr.invalid_return_type:r="Invalid function return type";break;case jr.invalid_date:r="Invalid date";break;case jr.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Xs.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case jr.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case jr.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case jr.custom:r="Invalid input";break;case jr.invalid_intersection_types:r="Intersection results could not be merged";break;case jr.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case jr.not_finite:r="Number must be finite";break;default:r=e.defaultError,Xs.assertNever(t)}return{message:r}},DT=cmo});function lmo(t){EMr=t}function UJ(){return EMr}var EMr,ENe=Z(()=>{D4t();EMr=DT});function En(t,e){let r=UJ(),n=ihe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===DT?void 0:DT].filter(i=>!!i)});t.common.issues.push(n)}var ihe,umo,ng,Wi,nU,x2,vNe,bNe,VB,QJ,R4t=Z(()=>{ENe();D4t();ihe=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}},umo=[];ng=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return Wi;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return Wi;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},Wi=Object.freeze({status:"aborted"}),nU=t=>({status:"dirty",value:t}),x2=t=>({status:"valid",value:t}),vNe=t=>t.status==="aborted",bNe=t=>t.status==="dirty",VB=t=>t.status==="valid",QJ=t=>typeof Promise<"u"&&t instanceof Promise});var vMr=Z(()=>{});var mi,bMr=Z(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(mi||(mi={}))});function ss(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}function SMr(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Tmo(t){return new RegExp(`^${SMr(t)}$`)}function wMr(t){let e=`${xMr}T${SMr(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Imo(t,e){return!!((e==="v4"||!e)&&vmo.test(t)||(e==="v6"||!e)&&Cmo.test(t))}function Dmo(t,e){if(!gmo.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Rmo(t,e){return!!((e==="v4"||!e)&&bmo.test(t)||(e==="v6"||!e)&&_mo.test(t))}function Bmo(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}function qJ(t){if(t instanceof B3){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=ob.create(qJ(n))}return new B3({...t._def,shape:()=>e})}else return t instanceof NT?new NT({...t._def,type:qJ(t.element)}):t instanceof ob?ob.create(qJ(t.unwrap())):t instanceof TS?TS.create(qJ(t.unwrap())):t instanceof wS?wS.create(t.items.map(e=>qJ(e))):t}function N4t(t,e){let r=SS(t),n=SS(e);if(t===e)return{valid:!0,data:t};if(r===kn.object&&n===kn.object){let i=Xs.objectKeys(e),o=Xs.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let c=N4t(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===kn.array&&n===kn.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],c=N4t(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===kn.date&&n===kn.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function TMr(t,e){return new hU({values:t,typeName:eo.ZodEnum,...ss(e)})}function _Mr(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function IMr(t,e={},r){return t?WB.create().superRefine((n,i)=>{let o=t(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=_Mr(e,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=_Mr(e,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):WB.create()}var sb,CMr,Cs,dmo,fmo,pmo,hmo,mmo,gmo,Amo,ymo,Emo,B4t,vmo,bmo,Cmo,_mo,xmo,Smo,xMr,wmo,$B,iU,oU,sU,aU,HJ,cU,lU,WB,BT,c5,GJ,NT,B3,uU,RT,CNe,dU,wS,_Ne,jJ,VJ,xNe,fU,pU,hU,mU,zB,ab,ob,TS,gU,AU,$J,Nmo,ohe,she,yU,Omo,eo,kmo,DMr,RMr,Pmo,Mmo,BMr,Lmo,Fmo,Umo,Qmo,qmo,Hmo,Gmo,jmo,Vmo,$mo,Wmo,zmo,Ymo,Kmo,Jmo,Xmo,Zmo,e0o,t0o,r0o,n0o,i0o,o0o,s0o,a0o,c0o,l0o,u0o,d0o,f0o,p0o,h0o,m0o,g0o,NMr=Z(()=>{yNe();ENe();bMr();R4t();nhe();sb=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},CMr=(t,e)=>{if(VB(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new R3(t.common.issues);return this._error=r,this._error}}};Cs=class{get description(){return this._def.description}_getType(e){return SS(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:SS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ng,ctx:{common:e.parent.common,data:e.data,parsedType:SS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(QJ(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:SS(e)},i=this._parseSync({data:e,path:n.path,parent:n});return CMr(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:SS(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return VB(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>VB(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:SS(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(QJ(i)?i:Promise.resolve(i));return CMr(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:jr.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new ab({schema:this,typeName:eo.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ob.create(this,this._def)}nullable(){return TS.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return NT.create(this)}promise(){return zB.create(this,this._def)}or(e){return uU.create([this,e],this._def)}and(e){return dU.create(this,e,this._def)}transform(e){return new ab({...ss(this._def),schema:this,typeName:eo.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new gU({...ss(this._def),innerType:this,defaultValue:r,typeName:eo.ZodDefault})}brand(){return new ohe({typeName:eo.ZodBranded,type:this,...ss(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new AU({...ss(this._def),innerType:this,catchValue:r,typeName:eo.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return she.create(this,e)}readonly(){return yU.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},dmo=/^c[^\s-]{8,}$/i,fmo=/^[0-9a-z]+$/,pmo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,hmo=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,mmo=/^[a-z0-9_-]{21}$/i,gmo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Amo=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ymo=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Emo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",vmo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,bmo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Cmo=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,_mo=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,xmo=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Smo=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xMr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",wmo=new RegExp(`^${xMr}$`);$B=class t extends Cs{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==kn.string){let o=this._getOrReturnCtx(e);return En(o,{code:jr.invalid_type,expected:kn.string,received:o.parsedType}),Wi}let n=new ng,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),En(i,{code:jr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),En(i,{code:jr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?En(i,{code:jr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&En(i,{code:jr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")ymo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"email",code:jr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")B4t||(B4t=new RegExp(Emo,"u")),B4t.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"emoji",code:jr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")hmo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"uuid",code:jr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")mmo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"nanoid",code:jr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")dmo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"cuid",code:jr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")fmo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"cuid2",code:jr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")pmo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"ulid",code:jr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),En(i,{validation:"url",code:jr.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"regex",code:jr.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),En(i,{code:jr.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),En(i,{code:jr.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),En(i,{code:jr.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?wMr(o).test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{code:jr.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?wmo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{code:jr.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?Tmo(o).test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{code:jr.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?Amo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"duration",code:jr.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?Imo(e.data,o.version)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"ip",code:jr.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?Dmo(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"jwt",code:jr.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?Rmo(e.data,o.version)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"cidr",code:jr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?xmo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"base64",code:jr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?Smo.test(e.data)||(i=this._getOrReturnCtx(e,i),En(i,{validation:"base64url",code:jr.invalid_string,message:o.message}),n.dirty()):Xs.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:jr.invalid_string,...mi.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...mi.errToObj(e)})}url(e){return this._addCheck({kind:"url",...mi.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...mi.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...mi.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...mi.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...mi.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...mi.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...mi.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...mi.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...mi.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...mi.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...mi.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...mi.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...mi.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...mi.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...mi.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...mi.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...mi.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...mi.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...mi.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...mi.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...mi.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...mi.errToObj(r)})}nonempty(e){return this.min(1,mi.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};$B.create=t=>new $B({checks:[],typeName:eo.ZodString,coerce:t?.coerce??!1,...ss(t)});iU=class t extends Cs{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==kn.number){let o=this._getOrReturnCtx(e);return En(o,{code:jr.invalid_type,expected:kn.number,received:o.parsedType}),Wi}let n,i=new ng;for(let o of this._def.checks)o.kind==="int"?Xs.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),En(n,{code:jr.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),En(n,{code:jr.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),En(n,{code:jr.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Bmo(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),En(n,{code:jr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),En(n,{code:jr.not_finite,message:o.message}),i.dirty()):Xs.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,mi.toString(r))}gt(e,r){return this.setLimit("min",e,!1,mi.toString(r))}lte(e,r){return this.setLimit("max",e,!0,mi.toString(r))}lt(e,r){return this.setLimit("max",e,!1,mi.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:mi.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:mi.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:mi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:mi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:mi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:mi.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:mi.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:mi.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:mi.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:mi.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Xs.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};iU.create=t=>new iU({checks:[],typeName:eo.ZodNumber,coerce:t?.coerce||!1,...ss(t)});oU=class t extends Cs{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==kn.bigint)return this._getInvalidInput(e);let n,i=new ng;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),En(n,{code:jr.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),En(n,{code:jr.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),En(n,{code:jr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Xs.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return En(r,{code:jr.invalid_type,expected:kn.bigint,received:r.parsedType}),Wi}gte(e,r){return this.setLimit("min",e,!0,mi.toString(r))}gt(e,r){return this.setLimit("min",e,!1,mi.toString(r))}lte(e,r){return this.setLimit("max",e,!0,mi.toString(r))}lt(e,r){return this.setLimit("max",e,!1,mi.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:mi.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:mi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:mi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:mi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:mi.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:mi.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};oU.create=t=>new oU({checks:[],typeName:eo.ZodBigInt,coerce:t?.coerce??!1,...ss(t)});sU=class extends Cs{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==kn.boolean){let n=this._getOrReturnCtx(e);return En(n,{code:jr.invalid_type,expected:kn.boolean,received:n.parsedType}),Wi}return x2(e.data)}};sU.create=t=>new sU({typeName:eo.ZodBoolean,coerce:t?.coerce||!1,...ss(t)});aU=class t extends Cs{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==kn.date){let o=this._getOrReturnCtx(e);return En(o,{code:jr.invalid_type,expected:kn.date,received:o.parsedType}),Wi}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return En(o,{code:jr.invalid_date}),Wi}let n=new ng,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),En(i,{code:jr.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),En(i,{code:jr.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Xs.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:mi.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:mi.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};aU.create=t=>new aU({checks:[],coerce:t?.coerce||!1,typeName:eo.ZodDate,...ss(t)});HJ=class extends Cs{_parse(e){if(this._getType(e)!==kn.symbol){let n=this._getOrReturnCtx(e);return En(n,{code:jr.invalid_type,expected:kn.symbol,received:n.parsedType}),Wi}return x2(e.data)}};HJ.create=t=>new HJ({typeName:eo.ZodSymbol,...ss(t)});cU=class extends Cs{_parse(e){if(this._getType(e)!==kn.undefined){let n=this._getOrReturnCtx(e);return En(n,{code:jr.invalid_type,expected:kn.undefined,received:n.parsedType}),Wi}return x2(e.data)}};cU.create=t=>new cU({typeName:eo.ZodUndefined,...ss(t)});lU=class extends Cs{_parse(e){if(this._getType(e)!==kn.null){let n=this._getOrReturnCtx(e);return En(n,{code:jr.invalid_type,expected:kn.null,received:n.parsedType}),Wi}return x2(e.data)}};lU.create=t=>new lU({typeName:eo.ZodNull,...ss(t)});WB=class extends Cs{constructor(){super(...arguments),this._any=!0}_parse(e){return x2(e.data)}};WB.create=t=>new WB({typeName:eo.ZodAny,...ss(t)});BT=class extends Cs{constructor(){super(...arguments),this._unknown=!0}_parse(e){return x2(e.data)}};BT.create=t=>new BT({typeName:eo.ZodUnknown,...ss(t)});c5=class extends Cs{_parse(e){let r=this._getOrReturnCtx(e);return En(r,{code:jr.invalid_type,expected:kn.never,received:r.parsedType}),Wi}};c5.create=t=>new c5({typeName:eo.ZodNever,...ss(t)});GJ=class extends Cs{_parse(e){if(this._getType(e)!==kn.undefined){let n=this._getOrReturnCtx(e);return En(n,{code:jr.invalid_type,expected:kn.void,received:n.parsedType}),Wi}return x2(e.data)}};GJ.create=t=>new GJ({typeName:eo.ZodVoid,...ss(t)});NT=class t extends Cs{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==kn.array)return En(r,{code:jr.invalid_type,expected:kn.array,received:r.parsedType}),Wi;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(En(r,{code:s?jr.too_big:jr.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(En(r,{code:jr.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(En(r,{code:jr.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new sb(r,s,r.path,a)))).then(s=>ng.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new sb(r,s,r.path,a)));return ng.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:mi.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:mi.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:mi.toString(r)}})}nonempty(e){return this.min(1,e)}};NT.create=(t,e)=>new NT({type:t,minLength:null,maxLength:null,exactLength:null,typeName:eo.ZodArray,...ss(e)});B3=class t extends Cs{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Xs.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==kn.object){let u=this._getOrReturnCtx(e);return En(u,{code:jr.invalid_type,expected:kn.object,received:u.parsedType}),Wi}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof c5&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let d=o[u],f=i.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new sb(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof c5){let u=this._def.unknownKeys;if(u==="passthrough")for(let d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")a.length>0&&(En(i,{code:jr.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let d of a){let f=i.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new sb(i,f,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let d of c){let f=await d.key,p=await d.value;u.push({key:f,value:p,alwaysSet:d.alwaysSet})}return u}).then(u=>ng.mergeObjectSync(n,u)):ng.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return mi.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:mi.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:eo.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Xs.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Xs.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return qJ(this)}partial(e){let r={};for(let n of Xs.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Xs.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof ob;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return TMr(Xs.objectKeys(this.shape))}};B3.create=(t,e)=>new B3({shape:()=>t,unknownKeys:"strip",catchall:c5.create(),typeName:eo.ZodObject,...ss(e)});B3.strictCreate=(t,e)=>new B3({shape:()=>t,unknownKeys:"strict",catchall:c5.create(),typeName:eo.ZodObject,...ss(e)});B3.lazycreate=(t,e)=>new B3({shape:t,unknownKeys:"strip",catchall:c5.create(),typeName:eo.ZodObject,...ss(e)});uU=class extends Cs{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new R3(a.ctx.common.issues));return En(r,{code:jr.invalid_union,unionErrors:s}),Wi}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new R3(c));return En(r,{code:jr.invalid_union,unionErrors:a}),Wi}}get options(){return this._def.options}};uU.create=(t,e)=>new uU({options:t,typeName:eo.ZodUnion,...ss(e)});RT=t=>t instanceof fU?RT(t.schema):t instanceof ab?RT(t.innerType()):t instanceof pU?[t.value]:t instanceof hU?t.options:t instanceof mU?Xs.objectValues(t.enum):t instanceof gU?RT(t._def.innerType):t instanceof cU?[void 0]:t instanceof lU?[null]:t instanceof ob?[void 0,...RT(t.unwrap())]:t instanceof TS?[null,...RT(t.unwrap())]:t instanceof ohe||t instanceof yU?RT(t.unwrap()):t instanceof AU?RT(t._def.innerType):[],CNe=class t extends Cs{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==kn.object)return En(r,{code:jr.invalid_type,expected:kn.object,received:r.parsedType}),Wi;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(En(r,{code:jr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Wi)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let s=RT(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:eo.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...ss(n)})}};dU=class extends Cs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(vNe(o)||vNe(s))return Wi;let a=N4t(o.value,s.value);return a.valid?((bNe(o)||bNe(s))&&r.dirty(),{status:r.value,value:a.data}):(En(n,{code:jr.invalid_intersection_types}),Wi)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};dU.create=(t,e,r)=>new dU({left:t,right:e,typeName:eo.ZodIntersection,...ss(r)});wS=class t extends Cs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==kn.array)return En(n,{code:jr.invalid_type,expected:kn.array,received:n.parsedType}),Wi;if(n.data.length<this._def.items.length)return En(n,{code:jr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Wi;!this._def.rest&&n.data.length>this._def.items.length&&(En(n,{code:jr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new sb(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>ng.mergeArray(r,s)):ng.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};wS.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wS({items:t,typeName:eo.ZodTuple,rest:null,...ss(e)})};_Ne=class t extends Cs{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==kn.object)return En(n,{code:jr.invalid_type,expected:kn.object,received:n.parsedType}),Wi;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new sb(n,a,n.path,a)),value:s._parse(new sb(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?ng.mergeObjectAsync(r,i):ng.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Cs?new t({keyType:e,valueType:r,typeName:eo.ZodRecord,...ss(n)}):new t({keyType:$B.create(),valueType:e,typeName:eo.ZodRecord,...ss(r)})}},jJ=class extends Cs{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==kn.map)return En(n,{code:jr.invalid_type,expected:kn.map,received:n.parsedType}),Wi;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new sb(n,a,n.path,[u,"key"])),value:o._parse(new sb(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Wi;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Wi;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}};jJ.create=(t,e,r)=>new jJ({valueType:e,keyType:t,typeName:eo.ZodMap,...ss(r)});VJ=class t extends Cs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==kn.set)return En(n,{code:jr.invalid_type,expected:kn.set,received:n.parsedType}),Wi;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(En(n,{code:jr.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(En(n,{code:jr.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let d of c){if(d.status==="aborted")return Wi;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new sb(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:mi.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:mi.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};VJ.create=(t,e)=>new VJ({valueType:t,minSize:null,maxSize:null,typeName:eo.ZodSet,...ss(e)});xNe=class t extends Cs{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==kn.function)return En(r,{code:jr.invalid_type,expected:kn.function,received:r.parsedType}),Wi;function n(a,c){return ihe({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,UJ(),DT].filter(u=>!!u),issueData:{code:jr.invalid_arguments,argumentsError:c}})}function i(a,c){return ihe({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,UJ(),DT].filter(u=>!!u),issueData:{code:jr.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof zB){let a=this;return x2(async function(...c){let u=new R3([]),d=await a._def.args.parseAsync(c,o).catch(h=>{throw u.addIssue(n(c,h)),u}),f=await Reflect.apply(s,this,d);return await a._def.returns._def.type.parseAsync(f,o).catch(h=>{throw u.addIssue(i(f,h)),u})})}else{let a=this;return x2(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new R3([n(c,u.error)]);let d=Reflect.apply(s,this,u.data),f=a._def.returns.safeParse(d,o);if(!f.success)throw new R3([i(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:wS.create(e).rest(BT.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||wS.create([]).rest(BT.create()),returns:r||BT.create(),typeName:eo.ZodFunction,...ss(n)})}},fU=class extends Cs{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};fU.create=(t,e)=>new fU({getter:t,typeName:eo.ZodLazy,...ss(e)});pU=class extends Cs{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return En(r,{received:r.data,code:jr.invalid_literal,expected:this._def.value}),Wi}return{status:"valid",value:e.data}}get value(){return this._def.value}};pU.create=(t,e)=>new pU({value:t,typeName:eo.ZodLiteral,...ss(e)});hU=class t extends Cs{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return En(r,{expected:Xs.joinValues(n),received:r.parsedType,code:jr.invalid_type}),Wi}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return En(r,{received:r.data,code:jr.invalid_enum_value,options:n}),Wi}return x2(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};hU.create=TMr;mU=class extends Cs{_parse(e){let r=Xs.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==kn.string&&n.parsedType!==kn.number){let i=Xs.objectValues(r);return En(n,{expected:Xs.joinValues(i),received:n.parsedType,code:jr.invalid_type}),Wi}if(this._cache||(this._cache=new Set(Xs.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Xs.objectValues(r);return En(n,{received:n.data,code:jr.invalid_enum_value,options:i}),Wi}return x2(e.data)}get enum(){return this._def.values}};mU.create=(t,e)=>new mU({values:t,typeName:eo.ZodNativeEnum,...ss(e)});zB=class extends Cs{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==kn.promise&&r.common.async===!1)return En(r,{code:jr.invalid_type,expected:kn.promise,received:r.parsedType}),Wi;let n=r.parsedType===kn.promise?r.data:Promise.resolve(r.data);return x2(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};zB.create=(t,e)=>new zB({type:t,typeName:eo.ZodPromise,...ss(e)});ab=class extends Cs{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===eo.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{En(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return Wi;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Wi:c.status==="dirty"?nU(c.value):r.value==="dirty"?nU(c.value):c});{if(r.value==="aborted")return Wi;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?Wi:a.status==="dirty"?nU(a.value):r.value==="dirty"?nU(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Wi:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Wi:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!VB(s))return Wi;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>VB(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):Wi);Xs.assertNever(i)}};ab.create=(t,e,r)=>new ab({schema:t,typeName:eo.ZodEffects,effect:e,...ss(r)});ab.createWithPreprocess=(t,e,r)=>new ab({schema:e,effect:{type:"preprocess",transform:t},typeName:eo.ZodEffects,...ss(r)});ob=class extends Cs{_parse(e){return this._getType(e)===kn.undefined?x2(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ob.create=(t,e)=>new ob({innerType:t,typeName:eo.ZodOptional,...ss(e)});TS=class extends Cs{_parse(e){return this._getType(e)===kn.null?x2(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};TS.create=(t,e)=>new TS({innerType:t,typeName:eo.ZodNullable,...ss(e)});gU=class extends Cs{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===kn.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};gU.create=(t,e)=>new gU({innerType:t,typeName:eo.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ss(e)});AU=class extends Cs{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return QJ(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new R3(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new R3(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};AU.create=(t,e)=>new AU({innerType:t,typeName:eo.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ss(e)});$J=class extends Cs{_parse(e){if(this._getType(e)!==kn.nan){let n=this._getOrReturnCtx(e);return En(n,{code:jr.invalid_type,expected:kn.nan,received:n.parsedType}),Wi}return{status:"valid",value:e.data}}};$J.create=t=>new $J({typeName:eo.ZodNaN,...ss(t)});Nmo=Symbol("zod_brand"),ohe=class extends Cs{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},she=class t extends Cs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Wi:o.status==="dirty"?(r.dirty(),nU(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Wi:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:eo.ZodPipeline})}},yU=class extends Cs{_parse(e){let r=this._def.innerType._parse(e),n=i=>(VB(i)&&(i.value=Object.freeze(i.value)),i);return QJ(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};yU.create=(t,e)=>new yU({innerType:t,typeName:eo.ZodReadonly,...ss(e)});Omo={object:B3.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(eo||(eo={}));kmo=(t,e={message:`Input not instance of ${t.name}`})=>IMr(r=>r instanceof t,e),DMr=$B.create,RMr=iU.create,Pmo=$J.create,Mmo=oU.create,BMr=sU.create,Lmo=aU.create,Fmo=HJ.create,Umo=cU.create,Qmo=lU.create,qmo=WB.create,Hmo=BT.create,Gmo=c5.create,jmo=GJ.create,Vmo=NT.create,$mo=B3.create,Wmo=B3.strictCreate,zmo=uU.create,Ymo=CNe.create,Kmo=dU.create,Jmo=wS.create,Xmo=_Ne.create,Zmo=jJ.create,e0o=VJ.create,t0o=xNe.create,r0o=fU.create,n0o=pU.create,i0o=hU.create,o0o=mU.create,s0o=zB.create,a0o=ab.create,c0o=ob.create,l0o=TS.create,u0o=ab.createWithPreprocess,d0o=she.create,f0o=()=>DMr().optional(),p0o=()=>RMr().optional(),h0o=()=>BMr().optional(),m0o={string:(t=>$B.create({...t,coerce:!0})),number:(t=>iU.create({...t,coerce:!0})),boolean:(t=>sU.create({...t,coerce:!0})),bigint:(t=>oU.create({...t,coerce:!0})),date:(t=>aU.create({...t,coerce:!0}))},g0o=Wi});var oe={};qs(oe,{BRAND:()=>Nmo,DIRTY:()=>nU,EMPTY_PATH:()=>umo,INVALID:()=>Wi,NEVER:()=>g0o,OK:()=>x2,ParseStatus:()=>ng,Schema:()=>Cs,ZodAny:()=>WB,ZodArray:()=>NT,ZodBigInt:()=>oU,ZodBoolean:()=>sU,ZodBranded:()=>ohe,ZodCatch:()=>AU,ZodDate:()=>aU,ZodDefault:()=>gU,ZodDiscriminatedUnion:()=>CNe,ZodEffects:()=>ab,ZodEnum:()=>hU,ZodError:()=>R3,ZodFirstPartyTypeKind:()=>eo,ZodFunction:()=>xNe,ZodIntersection:()=>dU,ZodIssueCode:()=>jr,ZodLazy:()=>fU,ZodLiteral:()=>pU,ZodMap:()=>jJ,ZodNaN:()=>$J,ZodNativeEnum:()=>mU,ZodNever:()=>c5,ZodNull:()=>lU,ZodNullable:()=>TS,ZodNumber:()=>iU,ZodObject:()=>B3,ZodOptional:()=>ob,ZodParsedType:()=>kn,ZodPipeline:()=>she,ZodPromise:()=>zB,ZodReadonly:()=>yU,ZodRecord:()=>_Ne,ZodSchema:()=>Cs,ZodSet:()=>VJ,ZodString:()=>$B,ZodSymbol:()=>HJ,ZodTransformer:()=>ab,ZodTuple:()=>wS,ZodType:()=>Cs,ZodUndefined:()=>cU,ZodUnion:()=>uU,ZodUnknown:()=>BT,ZodVoid:()=>GJ,addIssueToContext:()=>En,any:()=>qmo,array:()=>Vmo,bigint:()=>Mmo,boolean:()=>BMr,coerce:()=>m0o,custom:()=>IMr,date:()=>Lmo,datetimeRegex:()=>wMr,defaultErrorMap:()=>DT,discriminatedUnion:()=>Ymo,effect:()=>a0o,enum:()=>i0o,function:()=>t0o,getErrorMap:()=>UJ,getParsedType:()=>SS,instanceof:()=>kmo,intersection:()=>Kmo,isAborted:()=>vNe,isAsync:()=>QJ,isDirty:()=>bNe,isValid:()=>VB,late:()=>Omo,lazy:()=>r0o,literal:()=>n0o,makeIssue:()=>ihe,map:()=>Zmo,nan:()=>Pmo,nativeEnum:()=>o0o,never:()=>Gmo,null:()=>Qmo,nullable:()=>l0o,number:()=>RMr,object:()=>$mo,objectUtil:()=>I4t,oboolean:()=>h0o,onumber:()=>p0o,optional:()=>c0o,ostring:()=>f0o,pipeline:()=>d0o,preprocess:()=>u0o,promise:()=>s0o,quotelessJson:()=>amo,record:()=>Xmo,set:()=>e0o,setErrorMap:()=>lmo,strictObject:()=>Wmo,string:()=>DMr,symbol:()=>Fmo,transformer:()=>a0o,tuple:()=>Jmo,undefined:()=>Umo,union:()=>zmo,unknown:()=>Hmo,util:()=>Xs,void:()=>jmo});var O4t=Z(()=>{ENe();R4t();vMr();nhe();NMr();yNe()});var YB=Z(()=>{O4t();O4t()});var WJ,OMr,SNe,kMr,PMr,A0o,ub,N3,ahe,IS,db,wNe,MMr,TNe,LMr,FMr,UMr,che,cb,QMr,qMr,KB,EU,INe,y0o,lhe,uhe,HMr,E0o,v0o,b0o,k4t,GMr,jMr,DNe,C0o,RNe,BNe,NNe,VMr,$Mr,P4t,WMr,zMr,_0o,x0o,M4t,S0o,L4t,w0o,F4t,T0o,I0o,D0o,R0o,B0o,N0o,O0o,dhe,k0o,U4t,Q4t,q4t,P0o,M0o,YMr,L0o,fhe,F0o,U0o,Q0o,q0o,H4t,ONe,HQa,H0o,G0o,KMr,j0o,V0o,$0o,W0o,z0o,Y0o,K0o,J0o,X0o,Z0o,ego,tgo,rgo,ngo,igo,ogo,sgo,G4t,ago,kNe,cgo,lgo,GQa,jQa,VQa,$Qa,WQa,zQa,lb,JB=Z(()=>{YB();WJ="2025-06-18",OMr=[WJ,"2025-03-26","2024-11-05","2024-10-07"],SNe="2.0",kMr=oe.union([oe.string(),oe.number().int()]),PMr=oe.string(),A0o=oe.object({progressToken:oe.optional(kMr)}).passthrough(),ub=oe.object({_meta:oe.optional(A0o)}).passthrough(),N3=oe.object({method:oe.string(),params:oe.optional(ub)}),ahe=oe.object({_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),IS=oe.object({method:oe.string(),params:oe.optional(ahe)}),db=oe.object({_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),wNe=oe.union([oe.string(),oe.number().int()]),MMr=oe.object({jsonrpc:oe.literal(SNe),id:wNe}).merge(N3).strict(),TNe=t=>MMr.safeParse(t).success,LMr=oe.object({jsonrpc:oe.literal(SNe)}).merge(IS).strict(),FMr=t=>LMr.safeParse(t).success,UMr=oe.object({jsonrpc:oe.literal(SNe),id:wNe,result:db}).strict(),che=t=>UMr.safeParse(t).success;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(cb||(cb={}));QMr=oe.object({jsonrpc:oe.literal(SNe),id:wNe,error:oe.object({code:oe.number().int(),message:oe.string(),data:oe.optional(oe.unknown())})}).strict(),qMr=t=>QMr.safeParse(t).success,KB=oe.union([MMr,LMr,UMr,QMr]),EU=db.strict(),INe=IS.extend({method:oe.literal("notifications/cancelled"),params:ahe.extend({requestId:wNe,reason:oe.string().optional()})}),y0o=oe.object({src:oe.string(),mimeType:oe.optional(oe.string()),sizes:oe.optional(oe.array(oe.string()))}).passthrough(),lhe=oe.object({icons:oe.array(y0o).optional()}).passthrough(),uhe=oe.object({name:oe.string(),title:oe.optional(oe.string())}).passthrough(),HMr=uhe.extend({version:oe.string(),websiteUrl:oe.optional(oe.string())}).merge(lhe),E0o=oe.object({experimental:oe.optional(oe.object({}).passthrough()),sampling:oe.optional(oe.object({}).passthrough()),elicitation:oe.optional(oe.object({}).passthrough()),roots:oe.optional(oe.object({listChanged:oe.optional(oe.boolean())}).passthrough())}).passthrough(),v0o=N3.extend({method:oe.literal("initialize"),params:ub.extend({protocolVersion:oe.string(),capabilities:E0o,clientInfo:HMr})}),b0o=oe.object({experimental:oe.optional(oe.object({}).passthrough()),logging:oe.optional(oe.object({}).passthrough()),completions:oe.optional(oe.object({}).passthrough()),prompts:oe.optional(oe.object({listChanged:oe.optional(oe.boolean())}).passthrough()),resources:oe.optional(oe.object({subscribe:oe.optional(oe.boolean()),listChanged:oe.optional(oe.boolean())}).passthrough()),tools:oe.optional(oe.object({listChanged:oe.optional(oe.boolean())}).passthrough())}).passthrough(),k4t=db.extend({protocolVersion:oe.string(),capabilities:b0o,serverInfo:HMr,instructions:oe.optional(oe.string())}),GMr=IS.extend({method:oe.literal("notifications/initialized")}),jMr=t=>GMr.safeParse(t).success,DNe=N3.extend({method:oe.literal("ping")}),C0o=oe.object({progress:oe.number(),total:oe.optional(oe.number()),message:oe.optional(oe.string())}).passthrough(),RNe=IS.extend({method:oe.literal("notifications/progress"),params:ahe.merge(C0o).extend({progressToken:kMr})}),BNe=N3.extend({params:ub.extend({cursor:oe.optional(PMr)}).optional()}),NNe=db.extend({nextCursor:oe.optional(PMr)}),VMr=oe.object({uri:oe.string(),mimeType:oe.optional(oe.string()),_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),$Mr=VMr.extend({text:oe.string()}),P4t=oe.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),WMr=VMr.extend({blob:P4t}),zMr=uhe.extend({uri:oe.string(),description:oe.optional(oe.string()),mimeType:oe.optional(oe.string()),_meta:oe.optional(oe.object({}).passthrough())}).merge(lhe),_0o=uhe.extend({uriTemplate:oe.string(),description:oe.optional(oe.string()),mimeType:oe.optional(oe.string()),_meta:oe.optional(oe.object({}).passthrough())}).merge(lhe),x0o=BNe.extend({method:oe.literal("resources/list")}),M4t=NNe.extend({resources:oe.array(zMr)}),S0o=BNe.extend({method:oe.literal("resources/templates/list")}),L4t=NNe.extend({resourceTemplates:oe.array(_0o)}),w0o=N3.extend({method:oe.literal("resources/read"),params:ub.extend({uri:oe.string()})}),F4t=db.extend({contents:oe.array(oe.union([$Mr,WMr]))}),T0o=IS.extend({method:oe.literal("notifications/resources/list_changed")}),I0o=N3.extend({method:oe.literal("resources/subscribe"),params:ub.extend({uri:oe.string()})}),D0o=N3.extend({method:oe.literal("resources/unsubscribe"),params:ub.extend({uri:oe.string()})}),R0o=IS.extend({method:oe.literal("notifications/resources/updated"),params:ahe.extend({uri:oe.string()})}),B0o=oe.object({name:oe.string(),description:oe.optional(oe.string()),required:oe.optional(oe.boolean())}).passthrough(),N0o=uhe.extend({description:oe.optional(oe.string()),arguments:oe.optional(oe.array(B0o)),_meta:oe.optional(oe.object({}).passthrough())}).merge(lhe),O0o=BNe.extend({method:oe.literal("prompts/list")}),dhe=NNe.extend({prompts:oe.array(N0o)}),k0o=N3.extend({method:oe.literal("prompts/get"),params:ub.extend({name:oe.string(),arguments:oe.optional(oe.record(oe.string()))})}),U4t=oe.object({type:oe.literal("text"),text:oe.string(),_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),Q4t=oe.object({type:oe.literal("image"),data:P4t,mimeType:oe.string(),_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),q4t=oe.object({type:oe.literal("audio"),data:P4t,mimeType:oe.string(),_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),P0o=oe.object({type:oe.literal("resource"),resource:oe.union([$Mr,WMr]),_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),M0o=zMr.extend({type:oe.literal("resource_link")}),YMr=oe.union([U4t,Q4t,q4t,M0o,P0o]),L0o=oe.object({role:oe.enum(["user","assistant"]),content:YMr}).passthrough(),fhe=db.extend({description:oe.optional(oe.string()),messages:oe.array(L0o)}),F0o=IS.extend({method:oe.literal("notifications/prompts/list_changed")}),U0o=oe.object({title:oe.optional(oe.string()),readOnlyHint:oe.optional(oe.boolean()),destructiveHint:oe.optional(oe.boolean()),idempotentHint:oe.optional(oe.boolean()),openWorldHint:oe.optional(oe.boolean())}).passthrough(),Q0o=uhe.extend({description:oe.optional(oe.string()),inputSchema:oe.object({type:oe.literal("object"),properties:oe.optional(oe.object({}).passthrough()),required:oe.optional(oe.array(oe.string()))}).passthrough(),outputSchema:oe.optional(oe.object({type:oe.literal("object"),properties:oe.optional(oe.object({}).passthrough()),required:oe.optional(oe.array(oe.string()))}).passthrough()),annotations:oe.optional(U0o),_meta:oe.optional(oe.object({}).passthrough())}).merge(lhe),q0o=BNe.extend({method:oe.literal("tools/list")}),H4t=NNe.extend({tools:oe.array(Q0o)}),ONe=db.extend({content:oe.array(YMr).default([]),structuredContent:oe.object({}).passthrough().optional(),isError:oe.optional(oe.boolean())}),HQa=ONe.or(db.extend({toolResult:oe.unknown()})),H0o=N3.extend({method:oe.literal("tools/call"),params:ub.extend({name:oe.string(),arguments:oe.optional(oe.record(oe.unknown()))})}),G0o=IS.extend({method:oe.literal("notifications/tools/list_changed")}),KMr=oe.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),j0o=N3.extend({method:oe.literal("logging/setLevel"),params:ub.extend({level:KMr})}),V0o=IS.extend({method:oe.literal("notifications/message"),params:ahe.extend({level:KMr,logger:oe.optional(oe.string()),data:oe.unknown()})}),$0o=oe.object({name:oe.string().optional()}).passthrough(),W0o=oe.object({hints:oe.optional(oe.array($0o)),costPriority:oe.optional(oe.number().min(0).max(1)),speedPriority:oe.optional(oe.number().min(0).max(1)),intelligencePriority:oe.optional(oe.number().min(0).max(1))}).passthrough(),z0o=oe.object({role:oe.enum(["user","assistant"]),content:oe.union([U4t,Q4t,q4t])}).passthrough(),Y0o=N3.extend({method:oe.literal("sampling/createMessage"),params:ub.extend({messages:oe.array(z0o),systemPrompt:oe.optional(oe.string()),includeContext:oe.optional(oe.enum(["none","thisServer","allServers"])),temperature:oe.optional(oe.number()),maxTokens:oe.number().int(),stopSequences:oe.optional(oe.array(oe.string())),metadata:oe.optional(oe.object({}).passthrough()),modelPreferences:oe.optional(W0o)})}),K0o=db.extend({model:oe.string(),stopReason:oe.optional(oe.enum(["endTurn","stopSequence","maxTokens"]).or(oe.string())),role:oe.enum(["user","assistant"]),content:oe.discriminatedUnion("type",[U4t,Q4t,q4t])}),J0o=oe.object({type:oe.literal("boolean"),title:oe.optional(oe.string()),description:oe.optional(oe.string()),default:oe.optional(oe.boolean())}).passthrough(),X0o=oe.object({type:oe.literal("string"),title:oe.optional(oe.string()),description:oe.optional(oe.string()),minLength:oe.optional(oe.number()),maxLength:oe.optional(oe.number()),format:oe.optional(oe.enum(["email","uri","date","date-time"]))}).passthrough(),Z0o=oe.object({type:oe.enum(["number","integer"]),title:oe.optional(oe.string()),description:oe.optional(oe.string()),minimum:oe.optional(oe.number()),maximum:oe.optional(oe.number())}).passthrough(),ego=oe.object({type:oe.literal("string"),title:oe.optional(oe.string()),description:oe.optional(oe.string()),enum:oe.array(oe.string()),enumNames:oe.optional(oe.array(oe.string()))}).passthrough(),tgo=oe.union([J0o,X0o,Z0o,ego]),rgo=N3.extend({method:oe.literal("elicitation/create"),params:ub.extend({message:oe.string(),requestedSchema:oe.object({type:oe.literal("object"),properties:oe.record(oe.string(),tgo),required:oe.optional(oe.array(oe.string()))}).passthrough()})}),ngo=db.extend({action:oe.enum(["accept","decline","cancel"]),content:oe.optional(oe.record(oe.string(),oe.unknown()))}),igo=oe.object({type:oe.literal("ref/resource"),uri:oe.string()}).passthrough(),ogo=oe.object({type:oe.literal("ref/prompt"),name:oe.string()}).passthrough(),sgo=N3.extend({method:oe.literal("completion/complete"),params:ub.extend({ref:oe.union([ogo,igo]),argument:oe.object({name:oe.string(),value:oe.string()}).passthrough(),context:oe.optional(oe.object({arguments:oe.optional(oe.record(oe.string(),oe.string()))}))})}),G4t=db.extend({completion:oe.object({values:oe.array(oe.string()).max(100),total:oe.optional(oe.number().int()),hasMore:oe.optional(oe.boolean())}).passthrough()}),ago=oe.object({uri:oe.string().startsWith("file://"),name:oe.optional(oe.string()),_meta:oe.optional(oe.object({}).passthrough())}).passthrough(),kNe=N3.extend({method:oe.literal("roots/list")}),cgo=db.extend({roots:oe.array(ago)}),lgo=IS.extend({method:oe.literal("notifications/roots/list_changed")}),GQa=oe.union([DNe,v0o,sgo,j0o,k0o,O0o,x0o,S0o,w0o,I0o,D0o,H0o,q0o]),jQa=oe.union([INe,RNe,GMr,lgo]),VQa=oe.union([EU,K0o,ngo,cgo]),$Qa=oe.union([DNe,Y0o,rgo,kNe]),WQa=oe.union([INe,RNe,V0o,R0o,T0o,G0o,F0o]),zQa=oe.union([EU,k4t,G4t,fhe,dhe,M4t,L4t,F4t,ONe,H4t]),lb=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}}});function JMr(t,e){return Object.entries(e).reduce((r,[n,i])=>(i&&typeof i=="object"?r[n]=r[n]?{...r[n],...i}:i:r[n]=i,r),{...t})}var ugo,PNe,XMr=Z(()=>{JB();ugo=6e4,PNe=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(INe,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(RNe,r=>{this._onprogress(r)}),this.setRequestHandler(DNe,r=>({}))}_setupTimeout(e,r,n,i,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new lb(cb.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,i;this._transport=e;let o=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{o?.(),this._onclose()};let s=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{s?.(c),this._onerror(c)};let a=(i=this._transport)===null||i===void 0?void 0:i.onmessage;this._transport.onmessage=(c,u)=>{a?.(c,u),che(c)||qMr(c)?this._onresponse(c):TNe(c)?this._onrequest(c,u):FMr(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let n=new lb(cb.ConnectionClosed,"Connection closed");for(let i of r.values())i(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,r){var n,i;let o=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,s=this._transport;if(o===void 0){s?.send({jsonrpc:"2.0",id:e.id,error:{code:cb.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let c={signal:a.signal,sessionId:s?.sessionId,_meta:(i=e.params)===null||i===void 0?void 0:i._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,d,f)=>this.request(u,d,{...f,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>o(e,c)).then(u=>{if(!a.signal.aborted)return s?.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var d;if(!a.signal.aborted)return s?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:cb.InternalError,message:(d=u.message)!==null&&d!==void 0?d:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),o=this._progressHandlers.get(i);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(i),a=this._timeoutInfo.get(i);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){s(c);return}o(n)}_onresponse(e){let r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),che(e))n(e);else{let i=new lb(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){let{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}=n??{};return new Promise((a,c)=>{var u,d,f,p,h,m;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(d=n?.signal)===null||d===void 0||d.throwIfAborted();let g=this._requestMessageId++,A={...e,jsonrpc:"2.0",id:g};n?.onprogress&&(this._progressHandlers.set(g,n.onprogress),A.params={...e.params,_meta:{...((f=e.params)===null||f===void 0?void 0:f._meta)||{},progressToken:g}});let y=C=>{var S;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),(S=this._transport)===null||S===void 0||S.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(C)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(D=>this._onerror(new Error(`Failed to send cancellation: ${D}`))),c(C)};this._responseHandlers.set(g,C=>{var S;if(!(!((S=n?.signal)===null||S===void 0)&&S.aborted)){if(C instanceof Error)return c(C);try{let D=r.parse(C.result);a(D)}catch(D){c(D)}}}),(p=n?.signal)===null||p===void 0||p.addEventListener("abort",()=>{var C;y((C=n?.signal)===null||C===void 0?void 0:C.reason)});let E=(h=n?.timeout)!==null&&h!==void 0?h:ugo,v=()=>y(new lb(cb.RequestTimeout,"Request timed out",{timeout:E}));this._setupTimeout(g,E,n?.maxTotalTimeout,v,(m=n?.resetTimeoutOnProgress)!==null&&m!==void 0?m:!1),this._transport.send(A,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(C=>{this._cleanupTimeout(g),c(C)})})}async notification(e,r){var n,i;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((i=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&i!==void 0?i:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,r).catch(d=>this._onerror(d))});return}let a={...e,jsonrpc:"2.0"};await this._transport.send(a,r)}setRequestHandler(e,r){let n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,o)=>Promise.resolve(r(e.parse(i),o)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}});var mhe=w(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.regexpCode=Qa.getEsmExportName=Qa.getProperty=Qa.safeStringify=Qa.stringify=Qa.strConcat=Qa.addCodeArg=Qa.str=Qa._=Qa.nil=Qa._Code=Qa.Name=Qa.IDENTIFIER=Qa._CodeOrName=void 0;var phe=class{};Qa._CodeOrName=phe;Qa.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var vU=class extends phe{constructor(e){if(super(),!Qa.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Qa.Name=vU;var fb=class extends phe{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof vU&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Qa._Code=fb;Qa.nil=new fb("");function ZMr(t,...e){let r=[t[0]],n=0;for(;n<e.length;)V4t(r,e[n]),r.push(t[++n]);return new fb(r)}Qa._=ZMr;var j4t=new fb("+");function eLr(t,...e){let r=[hhe(t[0])],n=0;for(;n<e.length;)r.push(j4t),V4t(r,e[n]),r.push(j4t,hhe(t[++n]));return dgo(r),new fb(r)}Qa.str=eLr;function V4t(t,e){e instanceof fb?t.push(...e._items):e instanceof vU?t.push(e):t.push(hgo(e))}Qa.addCodeArg=V4t;function dgo(t){let e=1;for(;e<t.length-1;){if(t[e]===j4t){let r=fgo(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function fgo(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof vU||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof vU))return`"${t}${e.slice(1)}`}function pgo(t,e){return e.emptyStr()?t:t.emptyStr()?e:eLr`${t}${e}`}Qa.strConcat=pgo;function hgo(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:hhe(Array.isArray(t)?t.join(","):t)}function mgo(t){return new fb(hhe(t))}Qa.stringify=mgo;function hhe(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Qa.safeStringify=hhe;function ggo(t){return typeof t=="string"&&Qa.IDENTIFIER.test(t)?new fb(`.${t}`):ZMr`[${t}]`}Qa.getProperty=ggo;function Ago(t){if(typeof t=="string"&&Qa.IDENTIFIER.test(t))return new fb(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Qa.getEsmExportName=Ago;function ygo(t){return new fb(t.toString())}Qa.regexpCode=ygo});var z4t=w(k3=>{"use strict";Object.defineProperty(k3,"__esModule",{value:!0});k3.ValueScope=k3.ValueScopeName=k3.Scope=k3.varKinds=k3.UsedValueState=void 0;var O3=mhe(),$4t=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},MNe;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(MNe||(k3.UsedValueState=MNe={}));k3.varKinds={const:new O3.Name("const"),let:new O3.Name("let"),var:new O3.Name("var")};var LNe=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof O3.Name?e:this.name(e)}name(e){return new O3.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};k3.Scope=LNe;var FNe=class extends O3.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,O3._)`.${new O3.Name(r)}[${n}]`}};k3.ValueScopeName=FNe;var Ego=(0,O3._)`\n`,W4t=class extends LNe{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Ego:O3.nil}}get(){return this._scope}name(e){return new FNe(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:o}=i,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[o];if(a){let d=a.get(s);if(d)return d}else a=this._values[o]=new Map;a.set(s,i);let c=this._scope[o]||(this._scope[o]=[]),u=c.length;return c[u]=r.ref,i.setValue(r,{property:o,itemIndex:u}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,O3._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let o=O3.nil;for(let s in e){let a=e[s];if(!a)continue;let c=n[s]=n[s]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,MNe.Started);let d=r(u);if(d){let f=this.opts.es5?k3.varKinds.var:k3.varKinds.const;o=(0,O3._)`${o}${f} ${u} = ${d};${this.opts._n}`}else if(d=i?.(u))o=(0,O3._)`${o}${d}${this.opts._n}`;else throw new $4t(u);c.set(u,MNe.Completed)})}return o}};k3.ValueScope=W4t});var _s=w(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.or=Ls.and=Ls.not=Ls.CodeGen=Ls.operators=Ls.varKinds=Ls.ValueScopeName=Ls.ValueScope=Ls.Scope=Ls.Name=Ls.regexpCode=Ls.stringify=Ls.getProperty=Ls.nil=Ls.strConcat=Ls.str=Ls._=void 0;var ga=mhe(),l5=z4t(),XB=mhe();Object.defineProperty(Ls,"_",{enumerable:!0,get:function(){return XB._}});Object.defineProperty(Ls,"str",{enumerable:!0,get:function(){return XB.str}});Object.defineProperty(Ls,"strConcat",{enumerable:!0,get:function(){return XB.strConcat}});Object.defineProperty(Ls,"nil",{enumerable:!0,get:function(){return XB.nil}});Object.defineProperty(Ls,"getProperty",{enumerable:!0,get:function(){return XB.getProperty}});Object.defineProperty(Ls,"stringify",{enumerable:!0,get:function(){return XB.stringify}});Object.defineProperty(Ls,"regexpCode",{enumerable:!0,get:function(){return XB.regexpCode}});Object.defineProperty(Ls,"Name",{enumerable:!0,get:function(){return XB.Name}});var HNe=z4t();Object.defineProperty(Ls,"Scope",{enumerable:!0,get:function(){return HNe.Scope}});Object.defineProperty(Ls,"ValueScope",{enumerable:!0,get:function(){return HNe.ValueScope}});Object.defineProperty(Ls,"ValueScopeName",{enumerable:!0,get:function(){return HNe.ValueScopeName}});Object.defineProperty(Ls,"varKinds",{enumerable:!0,get:function(){return HNe.varKinds}});Ls.operators={GT:new ga._Code(">"),GTE:new ga._Code(">="),LT:new ga._Code("<"),LTE:new ga._Code("<="),EQ:new ga._Code("==="),NEQ:new ga._Code("!=="),NOT:new ga._Code("!"),OR:new ga._Code("||"),AND:new ga._Code("&&"),ADD:new ga._Code("+")};var OT=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Y4t=class extends OT{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?l5.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=YJ(this.rhs,e,r)),this}get names(){return this.rhs instanceof ga._CodeOrName?this.rhs.names:{}}},UNe=class extends OT{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ga.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=YJ(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ga.Name?{}:{...this.lhs.names};return qNe(e,this.rhs)}},K4t=class extends UNe{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},J4t=class extends OT{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},X4t=class extends OT{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Z4t=class extends OT{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},evt=class extends OT{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=YJ(this.code,e,r),this}get names(){return this.code instanceof ga._CodeOrName?this.code.names:{}}},ghe=class extends OT{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let o=n[i];o.optimizeNames(e,r)||(vgo(e,o.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>_U(e,r.names),{})}},kT=class extends ghe{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},tvt=class extends ghe{},zJ=class extends kT{};zJ.kind="else";var bU=class t extends kT{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new zJ(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(tLr(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=YJ(this.condition,e,r),this}get names(){let e=super.names;return qNe(e,this.condition),this.else&&_U(e,this.else.names),e}};bU.kind="if";var CU=class extends kT{};CU.kind="for";var rvt=class extends CU{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=YJ(this.iteration,e,r),this}get names(){return _U(super.names,this.iteration.names)}},nvt=class extends CU{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?l5.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${r} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=qNe(super.names,this.from);return qNe(e,this.to)}},QNe=class extends CU{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=YJ(this.iterable,e,r),this}get names(){return _U(super.names,this.iterable.names)}},Ahe=class extends kT{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Ahe.kind="func";var yhe=class extends ghe{render(e){return"return "+super.render(e)}};yhe.kind="return";var ivt=class extends kT{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&_U(e,this.catch.names),this.finally&&_U(e,this.finally.names),e}},Ehe=class extends kT{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Ehe.kind="catch";var vhe=class extends kT{render(e){return"finally"+super.render(e)}};vhe.kind="finally";var ovt=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
916
916
|
`:""},this._extScope=e,this._scope=new l5.Scope({parent:e}),this._nodes=[new tvt]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let o=this._scope.toName(r);return n!==void 0&&i&&(this._constants[o.str]=n),this._leafNode(new Y4t(e,o,n)),o}const(e,r,n){return this._def(l5.varKinds.const,e,r,n)}let(e,r,n){return this._def(l5.varKinds.let,e,r,n)}var(e,r,n){return this._def(l5.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new UNe(e,r,n))}add(e,r){return this._leafNode(new K4t(e,Ls.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ga.nil&&this._leafNode(new evt(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,ga.addCodeArg)(r,i));return r.push("}"),new ga._Code(r)}if(e,r,n){if(this._blockNode(new bU(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new bU(e))}else(){return this._elseNode(new zJ)}endIf(){return this._endBlockNode(bU,zJ)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new rvt(e),r)}forRange(e,r,n,i,o=this.opts.es5?l5.varKinds.var:l5.varKinds.let){let s=this._scope.toName(e);return this._for(new nvt(o,s,r,n),()=>i(s))}forOf(e,r,n,i=l5.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=r instanceof ga.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ga._)`${s}.length`,a=>{this.var(o,(0,ga._)`${s}[${a}]`),n(o)})}return this._for(new QNe("of",i,o,r),()=>n(o))}forIn(e,r,n,i=this.opts.es5?l5.varKinds.var:l5.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ga._)`Object.keys(${r})`,n);let o=this._scope.toName(e);return this._for(new QNe("in",i,o,r),()=>n(o))}endFor(){return this._endBlockNode(CU)}label(e){return this._leafNode(new J4t(e))}break(e){return this._leafNode(new X4t(e))}return(e){let r=new yhe;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(yhe)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new ivt;if(this._blockNode(i),this.code(e),r){let o=this.name("e");this._currNode=i.catch=new Ehe(o),r(o)}return n&&(this._currNode=i.finally=new vhe,this.code(n)),this._endBlockNode(Ehe,vhe)}throw(e){return this._leafNode(new Z4t(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ga.nil,n,i){return this._blockNode(new Ahe(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Ahe)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof bU))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Ls.CodeGen=ovt;function _U(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function qNe(t,e){return e instanceof ga._CodeOrName?_U(t,e.names):t}function YJ(t,e,r){if(t instanceof ga.Name)return n(t);if(!i(t))return t;return new ga._Code(t._items.reduce((o,s)=>(s instanceof ga.Name&&(s=n(s)),s instanceof ga._Code?o.push(...s._items):o.push(s),o),[]));function n(o){let s=r[o.str];return s===void 0||e[o.str]!==1?o:(delete e[o.str],s)}function i(o){return o instanceof ga._Code&&o._items.some(s=>s instanceof ga.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function vgo(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function tLr(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ga._)`!${svt(t)}`}Ls.not=tLr;var bgo=rLr(Ls.operators.AND);function Cgo(...t){return t.reduce(bgo)}Ls.and=Cgo;var _go=rLr(Ls.operators.OR);function xgo(...t){return t.reduce(_go)}Ls.or=xgo;function rLr(t){return(e,r)=>e===ga.nil?r:r===ga.nil?e:(0,ga._)`${svt(e)} ${t} ${svt(r)}`}function svt(t){return t instanceof ga.Name?t:(0,ga._)`(${t})`}});var qa=w(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.checkStrictMode=Hs.getErrorPath=Hs.Type=Hs.useFunc=Hs.setEvaluated=Hs.evaluatedPropsToName=Hs.mergeEvaluated=Hs.eachItem=Hs.unescapeJsonPointer=Hs.escapeJsonPointer=Hs.escapeFragment=Hs.unescapeFragment=Hs.schemaRefOrVal=Hs.schemaHasRulesButRef=Hs.schemaHasRules=Hs.checkUnknownRules=Hs.alwaysValidSchema=Hs.toHash=void 0;var ql=_s(),Sgo=mhe();function wgo(t){let e={};for(let r of t)e[r]=!0;return e}Hs.toHash=wgo;function Tgo(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(oLr(t,e),!sLr(e,t.self.RULES.all))}Hs.alwaysValidSchema=Tgo;function oLr(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let o in e)i[o]||lLr(t,`unknown keyword: "${o}"`)}Hs.checkUnknownRules=oLr;function sLr(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Hs.schemaHasRules=sLr;function Igo(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Hs.schemaHasRulesButRef=Igo;function Dgo({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ql._)`${r}`}return(0,ql._)`${t}${e}${(0,ql.getProperty)(n)}`}Hs.schemaRefOrVal=Dgo;function Rgo(t){return aLr(decodeURIComponent(t))}Hs.unescapeFragment=Rgo;function Bgo(t){return encodeURIComponent(cvt(t))}Hs.escapeFragment=Bgo;function cvt(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Hs.escapeJsonPointer=cvt;function aLr(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Hs.unescapeJsonPointer=aLr;function Ngo(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Hs.eachItem=Ngo;function nLr({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,o,s,a)=>{let c=s===void 0?o:s instanceof ql.Name?(o instanceof ql.Name?t(i,o,s):e(i,o,s),s):o instanceof ql.Name?(e(i,s,o),o):r(o,s);return a===ql.Name&&!(c instanceof ql.Name)?n(i,c):c}}Hs.mergeEvaluated={props:nLr({mergeNames:(t,e,r)=>t.if((0,ql._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,ql._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,ql._)`${r} || {}`).code((0,ql._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,ql._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,ql._)`${r} || {}`),lvt(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:cLr}),items:nLr({mergeNames:(t,e,r)=>t.if((0,ql._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,ql._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,ql._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,ql._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function cLr(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,ql._)`{}`);return e!==void 0&&lvt(t,r,e),r}Hs.evaluatedPropsToName=cLr;function lvt(t,e,r){Object.keys(r).forEach(n=>t.assign((0,ql._)`${e}${(0,ql.getProperty)(n)}`,!0))}Hs.setEvaluated=lvt;var iLr={};function Ogo(t,e){return t.scopeValue("func",{ref:e,code:iLr[e.code]||(iLr[e.code]=new Sgo._Code(e.code))})}Hs.useFunc=Ogo;var avt;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(avt||(Hs.Type=avt={}));function kgo(t,e,r){if(t instanceof ql.Name){let n=e===avt.Num;return r?n?(0,ql._)`"[" + ${t} + "]"`:(0,ql._)`"['" + ${t} + "']"`:n?(0,ql._)`"/" + ${t}`:(0,ql._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ql.getProperty)(t).toString():"/"+cvt(t)}Hs.getErrorPath=kgo;function lLr(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Hs.checkStrictMode=lLr});var PT=w(uvt=>{"use strict";Object.defineProperty(uvt,"__esModule",{value:!0});var S2=_s(),Pgo={data:new S2.Name("data"),valCxt:new S2.Name("valCxt"),instancePath:new S2.Name("instancePath"),parentData:new S2.Name("parentData"),parentDataProperty:new S2.Name("parentDataProperty"),rootData:new S2.Name("rootData"),dynamicAnchors:new S2.Name("dynamicAnchors"),vErrors:new S2.Name("vErrors"),errors:new S2.Name("errors"),this:new S2.Name("this"),self:new S2.Name("self"),scope:new S2.Name("scope"),json:new S2.Name("json"),jsonPos:new S2.Name("jsonPos"),jsonLen:new S2.Name("jsonLen"),jsonPart:new S2.Name("jsonPart")};uvt.default=Pgo});var bhe=w(w2=>{"use strict";Object.defineProperty(w2,"__esModule",{value:!0});w2.extendErrors=w2.resetErrorsCount=w2.reportExtraError=w2.reportError=w2.keyword$DataError=w2.keywordError=void 0;var Ra=_s(),GNe=qa(),Y1=PT();w2.keywordError={message:({keyword:t})=>(0,Ra.str)`must pass "${t}" keyword validation`};w2.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Ra.str)`"${t}" keyword must be ${e} ($data)`:(0,Ra.str)`"${t}" keyword is invalid ($data)`};function Mgo(t,e=w2.keywordError,r,n){let{it:i}=t,{gen:o,compositeRule:s,allErrors:a}=i,c=fLr(t,e,r);n??(s||a)?uLr(o,c):dLr(i,(0,Ra._)`[${c}]`)}w2.reportError=Mgo;function Lgo(t,e=w2.keywordError,r){let{it:n}=t,{gen:i,compositeRule:o,allErrors:s}=n,a=fLr(t,e,r);uLr(i,a),o||s||dLr(n,Y1.default.vErrors)}w2.reportExtraError=Lgo;function Fgo(t,e){t.assign(Y1.default.errors,e),t.if((0,Ra._)`${Y1.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Ra._)`${Y1.default.vErrors}.length`,e),()=>t.assign(Y1.default.vErrors,null)))}w2.resetErrorsCount=Fgo;function Ugo({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:o}){if(i===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",i,Y1.default.errors,a=>{t.const(s,(0,Ra._)`${Y1.default.vErrors}[${a}]`),t.if((0,Ra._)`${s}.instancePath === undefined`,()=>t.assign((0,Ra._)`${s}.instancePath`,(0,Ra.strConcat)(Y1.default.instancePath,o.errorPath))),t.assign((0,Ra._)`${s}.schemaPath`,(0,Ra.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,Ra._)`${s}.schema`,r),t.assign((0,Ra._)`${s}.data`,n))})}w2.extendErrors=Ugo;function uLr(t,e){let r=t.const("err",e);t.if((0,Ra._)`${Y1.default.vErrors} === null`,()=>t.assign(Y1.default.vErrors,(0,Ra._)`[${r}]`),(0,Ra._)`${Y1.default.vErrors}.push(${r})`),t.code((0,Ra._)`${Y1.default.errors}++`)}function dLr(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,Ra._)`new ${t.ValidationError}(${e})`):(r.assign((0,Ra._)`${n}.errors`,e),r.return(!1))}var xU={keyword:new Ra.Name("keyword"),schemaPath:new Ra.Name("schemaPath"),params:new Ra.Name("params"),propertyName:new Ra.Name("propertyName"),message:new Ra.Name("message"),schema:new Ra.Name("schema"),parentSchema:new Ra.Name("parentSchema")};function fLr(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Ra._)`{}`:Qgo(t,e,r)}function Qgo(t,e,r={}){let{gen:n,it:i}=t,o=[qgo(i,r),Hgo(t,r)];return Ggo(t,e,o),n.object(...o)}function qgo({errorPath:t},{instancePath:e}){let r=e?(0,Ra.str)`${t}${(0,GNe.getErrorPath)(e,GNe.Type.Str)}`:t;return[Y1.default.instancePath,(0,Ra.strConcat)(Y1.default.instancePath,r)]}function Hgo({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,Ra.str)`${e}/${t}`;return r&&(i=(0,Ra.str)`${i}${(0,GNe.getErrorPath)(r,GNe.Type.Str)}`),[xU.schemaPath,i]}function Ggo(t,{params:e,message:r},n){let{keyword:i,data:o,schemaValue:s,it:a}=t,{opts:c,propertyName:u,topSchemaRef:d,schemaPath:f}=a;n.push([xU.keyword,i],[xU.params,typeof e=="function"?e(t):e||(0,Ra._)`{}`]),c.messages&&n.push([xU.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([xU.schema,s],[xU.parentSchema,(0,Ra._)`${d}${f}`],[Y1.default.data,o]),u&&n.push([xU.propertyName,u])}});var hLr=w(KJ=>{"use strict";Object.defineProperty(KJ,"__esModule",{value:!0});KJ.boolOrEmptySchema=KJ.topBoolOrEmptySchema=void 0;var jgo=bhe(),Vgo=_s(),$go=PT(),Wgo={message:"boolean schema is false"};function zgo(t){let{gen:e,schema:r,validateName:n}=t;r===!1?pLr(t,!1):typeof r=="object"&&r.$async===!0?e.return($go.default.data):(e.assign((0,Vgo._)`${n}.errors`,null),e.return(!0))}KJ.topBoolOrEmptySchema=zgo;function Ygo(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),pLr(t)):r.var(e,!0)}KJ.boolOrEmptySchema=Ygo;function pLr(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,jgo.reportError)(i,Wgo,void 0,e)}});var dvt=w(JJ=>{"use strict";Object.defineProperty(JJ,"__esModule",{value:!0});JJ.getRules=JJ.isJSONType=void 0;var Kgo=["string","number","integer","boolean","null","object","array"],Jgo=new Set(Kgo);function Xgo(t){return typeof t=="string"&&Jgo.has(t)}JJ.isJSONType=Xgo;function Zgo(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}JJ.getRules=Zgo});var fvt=w(ZB=>{"use strict";Object.defineProperty(ZB,"__esModule",{value:!0});ZB.shouldUseRule=ZB.shouldUseGroup=ZB.schemaHasRulesForType=void 0;function e2o({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&mLr(t,n)}ZB.schemaHasRulesForType=e2o;function mLr(t,e){return e.rules.some(r=>gLr(t,r))}ZB.shouldUseGroup=mLr;function gLr(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}ZB.shouldUseRule=gLr});var Che=w(T2=>{"use strict";Object.defineProperty(T2,"__esModule",{value:!0});T2.reportTypeError=T2.checkDataTypes=T2.checkDataType=T2.coerceAndCheckDataType=T2.getJSONTypes=T2.getSchemaTypes=T2.DataType=void 0;var t2o=dvt(),r2o=fvt(),n2o=bhe(),gs=_s(),ALr=qa(),XJ;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(XJ||(T2.DataType=XJ={}));function i2o(t){let e=yLr(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}T2.getSchemaTypes=i2o;function yLr(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(t2o.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}T2.getJSONTypes=yLr;function o2o(t,e){let{gen:r,data:n,opts:i}=t,o=s2o(e,i.coerceTypes),s=e.length>0&&!(o.length===0&&e.length===1&&(0,r2o.schemaHasRulesForType)(t,e[0]));if(s){let a=hvt(e,n,i.strictNumbers,XJ.Wrong);r.if(a,()=>{o.length?a2o(t,e,o):mvt(t)})}return s}T2.coerceAndCheckDataType=o2o;var ELr=new Set(["string","number","integer","boolean","null"]);function s2o(t,e){return e?t.filter(r=>ELr.has(r)||e==="array"&&r==="array"):[]}function a2o(t,e,r){let{gen:n,data:i,opts:o}=t,s=n.let("dataType",(0,gs._)`typeof ${i}`),a=n.let("coerced",(0,gs._)`undefined`);o.coerceTypes==="array"&&n.if((0,gs._)`${s} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,gs._)`${i}[0]`).assign(s,(0,gs._)`typeof ${i}`).if(hvt(e,i,o.strictNumbers),()=>n.assign(a,i))),n.if((0,gs._)`${a} !== undefined`);for(let u of r)(ELr.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);n.else(),mvt(t),n.endIf(),n.if((0,gs._)`${a} !== undefined`,()=>{n.assign(i,a),c2o(t,a)});function c(u){switch(u){case"string":n.elseIf((0,gs._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,gs._)`"" + ${i}`).elseIf((0,gs._)`${i} === null`).assign(a,(0,gs._)`""`);return;case"number":n.elseIf((0,gs._)`${s} == "boolean" || ${i} === null
|
|
917
917
|
|| (${s} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,gs._)`+${i}`);return;case"integer":n.elseIf((0,gs._)`${s} === "boolean" || ${i} === null
|
|
@@ -925,7 +925,7 @@ ${e}
|
|
|
925
925
|
`;break;case"id":a=A.includes("\0")?void 0:A;break;case"retry":/^\d+$/.test(A)?n(parseInt(A,10)):r(new _Oe(`Invalid \`retry\` value: "${A}"`,{type:"invalid-retry",value:A,line:y}));break;default:r(new _Oe(`Unknown field "${g.length>20?`${g.slice(0,20)}\u2026`:g}"`,{type:"unknown-field",field:g,value:A,line:y}));break}}function h(){c.length>0&&e({id:a,event:u||void 0,data:c.endsWith(`
|
|
926
926
|
`)?c.slice(0,-1):c}),a=void 0,c="",u=""}function m(g={}){o&&g.consume&&f(o),s=!0,a=void 0,c="",u="",o=""}return{feed:d,reset:m}}function NEo(t){let e=[],r="",n=0;for(;n<t.length;){let i=t.indexOf("\r",n),o=t.indexOf(`
|
|
927
927
|
`,n),s=-1;if(i!==-1&&o!==-1?s=Math.min(i,o):i!==-1?i===t.length-1?s=-1:s=i:o!==-1&&(s=o),s===-1){r=t.slice(n);break}else{let a=t.slice(n,s);e.push(a),n=s+1,t[n-1]==="\r"&&t[n]===`
|
|
928
|
-
`&&n++}}return[e,r]}var _Oe,$bt=Z(()=>{_Oe=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}});function OEo(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Wbt(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Wbt).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Wbt(t.cause)}`:t.message:`${t}`}function NQr(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function kEo(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var wOe,kQr,t6t,Zs,Uh,Bd,FT,L3,RU,hX,SOe,TOe,jhe,AX,Vhe,sN,mX,yX,gX,Hhe,h5,zbt,Ybt,Kbt,OQr,Jbt,Xbt,Ghe,Zbt,e6t,BU,PQr=Z(()=>{$bt();wOe=class extends Event{constructor(e,r){var n,i;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(i=r?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(NQr(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(NQr(this),r)}};kQr=t=>{throw TypeError(t)},t6t=(t,e,r)=>e.has(t)||kQr("Cannot "+r),Zs=(t,e,r)=>(t6t(t,e,"read from private field"),r?r.call(t):e.get(t)),Uh=(t,e,r)=>e.has(t)?kQr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Bd=(t,e,r,n)=>(t6t(t,e,"write to private field"),e.set(t,r),r),FT=(t,e,r)=>(t6t(t,e,"access private method"),r),BU=class extends EventTarget{constructor(e,r){var n,i;super(),Uh(this,h5),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Uh(this,L3),Uh(this,RU),Uh(this,hX),Uh(this,SOe),Uh(this,TOe),Uh(this,jhe),Uh(this,AX),Uh(this,Vhe,null),Uh(this,sN),Uh(this,mX),Uh(this,yX,null),Uh(this,gX,null),Uh(this,Hhe,null),Uh(this,Ybt,async o=>{var s;Zs(this,mX).reset();let{body:a,redirected:c,status:u,headers:d}=o;if(u===204){FT(this,h5,Ghe).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Bd(this,hX,new URL(o.url)):Bd(this,hX,void 0),u!==200){FT(this,h5,Ghe).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){FT(this,h5,Ghe).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Zs(this,L3)===this.CLOSED)return;Bd(this,L3,this.OPEN);let f=new Event("open");if((s=Zs(this,Hhe))==null||s.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){FT(this,h5,Ghe).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let p=new TextDecoder,h=a.getReader(),m=!0;do{let{done:g,value:A}=await h.read();A&&Zs(this,mX).feed(p.decode(A,{stream:!g})),g&&(m=!1,Zs(this,mX).reset(),FT(this,h5,Zbt).call(this))}while(m)}),Uh(this,Kbt,o=>{Bd(this,sN,void 0),!(o.name==="AbortError"||o.type==="aborted")&&FT(this,h5,Zbt).call(this,Wbt(o))}),Uh(this,Jbt,o=>{typeof o.id=="string"&&Bd(this,Vhe,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:Zs(this,hX)?Zs(this,hX).origin:Zs(this,RU).origin,lastEventId:o.id||""});Zs(this,gX)&&(!o.event||o.event==="message")&&Zs(this,gX).call(this,s),this.dispatchEvent(s)}),Uh(this,Xbt,o=>{Bd(this,jhe,o)}),Uh(this,e6t,()=>{Bd(this,AX,void 0),Zs(this,L3)===this.CONNECTING&&FT(this,h5,zbt).call(this)});try{if(e instanceof URL)Bd(this,RU,e);else if(typeof e=="string")Bd(this,RU,new URL(e,kEo()));else throw new Error("Invalid URL")}catch{throw OEo("An invalid or illegal string was specified")}Bd(this,mX,xOe({onEvent:Zs(this,Jbt),onRetry:Zs(this,Xbt)})),Bd(this,L3,this.CONNECTING),Bd(this,jhe,3e3),Bd(this,TOe,(n=r?.fetch)!=null?n:globalThis.fetch),Bd(this,SOe,(i=r?.withCredentials)!=null?i:!1),FT(this,h5,zbt).call(this)}get readyState(){return Zs(this,L3)}get url(){return Zs(this,RU).href}get withCredentials(){return Zs(this,SOe)}get onerror(){return Zs(this,yX)}set onerror(e){Bd(this,yX,e)}get onmessage(){return Zs(this,gX)}set onmessage(e){Bd(this,gX,e)}get onopen(){return Zs(this,Hhe)}set onopen(e){Bd(this,Hhe,e)}addEventListener(e,r,n){let i=r;super.addEventListener(e,i,n)}removeEventListener(e,r,n){let i=r;super.removeEventListener(e,i,n)}close(){Zs(this,AX)&&clearTimeout(Zs(this,AX)),Zs(this,L3)!==this.CLOSED&&(Zs(this,sN)&&Zs(this,sN).abort(),Bd(this,L3,this.CLOSED),Bd(this,sN,void 0))}};L3=new WeakMap,RU=new WeakMap,hX=new WeakMap,SOe=new WeakMap,TOe=new WeakMap,jhe=new WeakMap,AX=new WeakMap,Vhe=new WeakMap,sN=new WeakMap,mX=new WeakMap,yX=new WeakMap,gX=new WeakMap,Hhe=new WeakMap,h5=new WeakSet,zbt=function(){Bd(this,L3,this.CONNECTING),Bd(this,sN,new AbortController),Zs(this,TOe)(Zs(this,RU),FT(this,h5,OQr).call(this)).then(Zs(this,Ybt)).catch(Zs(this,Kbt))},Ybt=new WeakMap,Kbt=new WeakMap,OQr=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Zs(this,Vhe)?{"Last-Event-ID":Zs(this,Vhe)}:void 0},cache:"no-store",signal:(t=Zs(this,sN))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Jbt=new WeakMap,Xbt=new WeakMap,Ghe=function(t,e){var r;Zs(this,L3)!==this.CLOSED&&Bd(this,L3,this.CLOSED);let n=new wOe("error",{code:e,message:t});(r=Zs(this,yX))==null||r.call(this,n),this.dispatchEvent(n)},Zbt=function(t,e){var r;if(Zs(this,L3)===this.CLOSED)return;Bd(this,L3,this.CONNECTING);let n=new wOe("error",{code:e,message:t});(r=Zs(this,yX))==null||r.call(this,n),this.dispatchEvent(n),Bd(this,AX,setTimeout(Zs(this,e6t),Zs(this,jhe)))},e6t=new WeakMap,BU.CONNECTING=0,BU.OPEN=1,BU.CLOSED=2});async function PEo(t){return(await r6t).getRandomValues(new Uint8Array(t))}async function MEo(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await PEo(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function LEo(t){return await MEo(t)}async function FEo(t){let e=await(await r6t).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function n6t(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await LEo(t),r=await FEo(e);return{code_verifier:e,code_challenge:r}}var r6t,MQr=Z(()=>{r6t=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var sg,FQr,i6t,UEo,UQr,o6t,QQr,LQr,QEo,qEo,qQr,GHa,jHa,s6t=Z(()=>{YB();sg=oe.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:oe.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),oe.NEVER}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),FQr=oe.object({resource:oe.string().url(),authorization_servers:oe.array(sg).optional(),jwks_uri:oe.string().url().optional(),scopes_supported:oe.array(oe.string()).optional(),bearer_methods_supported:oe.array(oe.string()).optional(),resource_signing_alg_values_supported:oe.array(oe.string()).optional(),resource_name:oe.string().optional(),resource_documentation:oe.string().optional(),resource_policy_uri:oe.string().url().optional(),resource_tos_uri:oe.string().url().optional(),tls_client_certificate_bound_access_tokens:oe.boolean().optional(),authorization_details_types_supported:oe.array(oe.string()).optional(),dpop_signing_alg_values_supported:oe.array(oe.string()).optional(),dpop_bound_access_tokens_required:oe.boolean().optional()}).passthrough(),i6t=oe.object({issuer:oe.string(),authorization_endpoint:sg,token_endpoint:sg,registration_endpoint:sg.optional(),scopes_supported:oe.array(oe.string()).optional(),response_types_supported:oe.array(oe.string()),response_modes_supported:oe.array(oe.string()).optional(),grant_types_supported:oe.array(oe.string()).optional(),token_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),service_documentation:sg.optional(),revocation_endpoint:sg.optional(),revocation_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),introspection_endpoint:oe.string().optional(),introspection_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),code_challenge_methods_supported:oe.array(oe.string()).optional()}).passthrough(),UEo=oe.object({issuer:oe.string(),authorization_endpoint:sg,token_endpoint:sg,userinfo_endpoint:sg.optional(),jwks_uri:sg,registration_endpoint:sg.optional(),scopes_supported:oe.array(oe.string()).optional(),response_types_supported:oe.array(oe.string()),response_modes_supported:oe.array(oe.string()).optional(),grant_types_supported:oe.array(oe.string()).optional(),acr_values_supported:oe.array(oe.string()).optional(),subject_types_supported:oe.array(oe.string()),id_token_signing_alg_values_supported:oe.array(oe.string()),id_token_encryption_alg_values_supported:oe.array(oe.string()).optional(),id_token_encryption_enc_values_supported:oe.array(oe.string()).optional(),userinfo_signing_alg_values_supported:oe.array(oe.string()).optional(),userinfo_encryption_alg_values_supported:oe.array(oe.string()).optional(),userinfo_encryption_enc_values_supported:oe.array(oe.string()).optional(),request_object_signing_alg_values_supported:oe.array(oe.string()).optional(),request_object_encryption_alg_values_supported:oe.array(oe.string()).optional(),request_object_encryption_enc_values_supported:oe.array(oe.string()).optional(),token_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),display_values_supported:oe.array(oe.string()).optional(),claim_types_supported:oe.array(oe.string()).optional(),claims_supported:oe.array(oe.string()).optional(),service_documentation:oe.string().optional(),claims_locales_supported:oe.array(oe.string()).optional(),ui_locales_supported:oe.array(oe.string()).optional(),claims_parameter_supported:oe.boolean().optional(),request_parameter_supported:oe.boolean().optional(),request_uri_parameter_supported:oe.boolean().optional(),require_request_uri_registration:oe.boolean().optional(),op_policy_uri:sg.optional(),op_tos_uri:sg.optional()}).passthrough(),UQr=UEo.merge(i6t.pick({code_challenge_methods_supported:!0})),o6t=oe.object({access_token:oe.string(),id_token:oe.string().optional(),token_type:oe.string(),expires_in:oe.number().optional(),scope:oe.string().optional(),refresh_token:oe.string().optional()}).strip(),QQr=oe.object({error:oe.string(),error_description:oe.string().optional(),error_uri:oe.string().optional()}),LQr=sg.optional().or(oe.literal("").transform(()=>{})),QEo=oe.object({redirect_uris:oe.array(sg),token_endpoint_auth_method:oe.string().optional(),grant_types:oe.array(oe.string()).optional(),response_types:oe.array(oe.string()).optional(),client_name:oe.string().optional(),client_uri:sg.optional(),logo_uri:LQr,scope:oe.string().optional(),contacts:oe.array(oe.string()).optional(),tos_uri:LQr,policy_uri:oe.string().optional(),jwks_uri:sg.optional(),jwks:oe.any().optional(),software_id:oe.string().optional(),software_version:oe.string().optional(),software_statement:oe.string().optional()}).strip(),qEo=oe.object({client_id:oe.string(),client_secret:oe.string().optional(),client_id_issued_at:oe.number().optional(),client_secret_expires_at:oe.number().optional()}).strip(),qQr=QEo.merge(qEo),GHa=oe.object({error:oe.string(),error_description:oe.string().optional()}).strip(),jHa=oe.object({token:oe.string(),token_type_hint:oe.string().optional()}).strip()});function HQr(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function GQr({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var jQr=Z(()=>{});var rh,$he,NU,OU,kU,Whe,zhe,Yhe,UT,Khe,Jhe,Xhe,Zhe,eme,tme,rme,nme,VQr,$Qr=Z(()=>{rh=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},$he=class extends rh{};$he.errorCode="invalid_request";NU=class extends rh{};NU.errorCode="invalid_client";OU=class extends rh{};OU.errorCode="invalid_grant";kU=class extends rh{};kU.errorCode="unauthorized_client";Whe=class extends rh{};Whe.errorCode="unsupported_grant_type";zhe=class extends rh{};zhe.errorCode="invalid_scope";Yhe=class extends rh{};Yhe.errorCode="access_denied";UT=class extends rh{};UT.errorCode="server_error";Khe=class extends rh{};Khe.errorCode="temporarily_unavailable";Jhe=class extends rh{};Jhe.errorCode="unsupported_response_type";Xhe=class extends rh{};Xhe.errorCode="unsupported_token_type";Zhe=class extends rh{};Zhe.errorCode="invalid_token";eme=class extends rh{};eme.errorCode="method_not_allowed";tme=class extends rh{};tme.errorCode="too_many_requests";rme=class extends rh{};rme.errorCode="invalid_client_metadata";nme=class extends rh{};nme.errorCode="insufficient_scope";VQr={[$he.errorCode]:$he,[NU.errorCode]:NU,[OU.errorCode]:OU,[kU.errorCode]:kU,[Whe.errorCode]:Whe,[zhe.errorCode]:zhe,[Yhe.errorCode]:Yhe,[UT.errorCode]:UT,[Khe.errorCode]:Khe,[Jhe.errorCode]:Jhe,[Xhe.errorCode]:Xhe,[Zhe.errorCode]:Zhe,[eme.errorCode]:eme,[tme.errorCode]:tme,[rme.errorCode]:rme,[nme.errorCode]:nme}});function HEo(t){return["client_secret_basic","client_secret_post","none"].includes(t)}function zQr(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&HEo(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function YQr(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":GEo(i,o,r);return;case"client_secret_post":jEo(i,o,n);return;case"none":VEo(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function GEo(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function jEo(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function VEo(t,e){e.set("client_id",t)}async function u6t(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=QQr.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=VQr[i]||UT;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new UT(i)}}async function aN(t,e){var r,n;try{return await l6t(t,e)}catch(i){if(i instanceof NU||i instanceof kU)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await l6t(t,e);if(i instanceof OU)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await l6t(t,e);throw i}}async function l6t(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await WEo(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await $Eo(e,t,s),u=await XEo(a,{fetchFn:o}),d=await Promise.resolve(t.clientInformation());if(!d){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let g=await e4o(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(g),d=g}if(r!==void 0){let g=await t.codeVerifier(),A=await f6t(a,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:g,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}let f=await t.tokens();if(f?.refresh_token)try{let g=await p6t(a,{metadata:u,clientInformation:d,refreshToken:f.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(g),"AUTHORIZED"}catch(g){if(!(!(g instanceof rh)||g instanceof UT))throw g}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:m}=await ZEo(a,{metadata:u,clientInformation:d,state:p,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(h),"REDIRECT"}async function $Eo(t,e,r){let n=HQr(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!GQr({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function ime(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=/resource_metadata="([^"]*)"/.exec(e),a=/scope="([^"]*)"/.exec(e),c;if(o)try{c=new URL(o[1])}catch{}let u=a?.[1]||void 0;return{resourceMetadataUrl:c,scope:u}}async function WEo(t,e,r=fetch){let n=await KEo(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return FQr.parse(await n.json())}async function d6t(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?d6t(t,void 0,r):void 0;throw n}}function zEo(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function WQr(t,e,r=fetch){return await d6t(t,{"MCP-Protocol-Version":e},r)}function YEo(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function KEo(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:WJ,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let d=zEo(e,s.pathname);c=new URL(d,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await WQr(c,a,r);if(!n?.metadataUrl&&YEo(u,s.pathname)){let d=new URL(`/.well-known/${e}`,s);u=await WQr(d,a,r)}return u}function JEo(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function XEo(t,{fetchFn:e=fetch,protocolVersion:r=WJ}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},i=JEo(t);for(let{url:o,type:s}of i){let a=await d6t(o,n,e);if(a){if(!a.ok){if(a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}return s==="oauth"?i6t.parse(await a.json()):UQr.parse(await a.json())}}}async function ZEo(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a;if(e){if(a=new URL(e.authorization_endpoint),!e.response_types_supported.includes(a6t))throw new Error(`Incompatible auth server: does not support response type ${a6t}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(c6t))throw new Error(`Incompatible auth server: does not support code challenge method ${c6t}`)}else a=new URL("/authorize",t);let c=await n6t(),u=c.code_verifier,d=c.code_challenge;return a.searchParams.set("response_type",a6t),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",d),a.searchParams.set("code_challenge_method",c6t),a.searchParams.set("redirect_uri",String(n)),o&&a.searchParams.set("state",o),i&&a.searchParams.set("scope",i),i?.includes("offline_access")&&a.searchParams.append("prompt","consent"),s&&a.searchParams.set("resource",s.href),{authorizationUrl:a,codeVerifier:u}}async function f6t(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:i,redirectUri:o,resource:s,addClientAuthentication:a,fetchFn:c}){var u;let d="authorization_code",f=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`);let p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),h=new URLSearchParams({grant_type:d,code:n,code_verifier:i,redirect_uri:String(o)});if(a)a(p,h,t,e);else{let g=(u=e?.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],A=zQr(r,g);YQr(A,r,p,h)}s&&h.set("resource",s.href);let m=await(c??fetch)(f,{method:"POST",headers:p,body:h});if(!m.ok)throw await u6t(m);return o6t.parse(await m.json())}async function p6t(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){var a;let c="refresh_token",u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);let d=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),f=new URLSearchParams({grant_type:c,refresh_token:n});if(o)o(d,f,t,e);else{let h=(a=e?.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],m=zQr(r,h);YQr(m,r,d,f)}i&&f.set("resource",i.href);let p=await(s??fetch)(u,{method:"POST",headers:d,body:f});if(!p.ok)throw await u6t(p);return o6t.parse({refresh_token:n,...await p.json()})}async function e4o(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await u6t(o);return qQr.parse(await o.json())}var F3,a6t,c6t,IOe=Z(()=>{MQr();JB();s6t();s6t();jQr();$Qr();F3=class extends Error{constructor(e){super(e??"Unauthorized")}};a6t="code",c6t="S256"});var h6t,EX,KQr=Z(()=>{PQr();JB();IOe();h6t=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},EX=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new F3("No auth provider");let r;try{r=await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new F3;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,n;let i=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((o,s)=>{this._eventSource=new BU(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{let u=await this._commonHeaders();u.set("Accept","text/event-stream");let d=await i(a,{...c,headers:u});if(d.status===401&&d.headers.has("www-authenticate")){let{resourceMetadataUrl:f,scope:p}=ime(d);this._resourceMetadataUrl=f,this._scope=p}return d}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{var c;if(a.code===401&&this._authProvider){this._authThenStart().then(o,s);return}let u=new h6t(a.code,a.message,a);s(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{var c;let u=a;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(d){s(d),(c=this.onerror)===null||c===void 0||c.call(this,d),this.close();return}o()}),this._eventSource.onmessage=a=>{var c,u;let d=a,f;try{f=KB.parse(JSON.parse(d.data))}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p);return}(u=this.onmessage)===null||u===void 0||u.call(this,f)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new F3("No auth provider");if(await aN(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,i;if(!this._endpoint)throw new Error("Not connected");try{let o=await this._commonHeaders();o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},a=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,s);if(!a.ok){if(a.status===401&&this._authProvider){let{resourceMetadataUrl:u,scope:d}=ime(a);if(this._resourceMetadataUrl=u,this._scope=d,await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3;return this.send(e)}let c=await a.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}setProtocolVersion(e){this._protocolVersion=e}}});var DOe,JQr=Z(()=>{$bt();DOe=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=xOe({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}}});var t4o,vX,cN,m6t=Z(()=>{JB();IOe();JQr();t4o={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},vX=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},cN=class{constructor(e,r){var n;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:t4o}async _authThenStart(){var e;if(!this._authProvider)throw new F3("No auth provider");let r;try{r=await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new F3;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,i;let{resumptionToken:o}=e;try{let s=await this._commonHeaders();s.set("Accept","text/event-stream"),o&&s.set("last-event-id",o);let a=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:s,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!a.ok){if(a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new vX(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(s){throw(i=this.onerror)===null||i===void 0||i.call(this,s),s}}_getNextReconnectionDelay(e){let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var n;let i=this._reconnectionOptions.maxRetries;if(i>0&&r>=i){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s;(async()=>{var c,u,d,f;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new DOe).getReader();for(;;){let{value:h,done:m}=await p.read();if(m)break;if(h.id&&(s=h.id,i?.(h.id)),!h.event||h.event==="message")try{let g=KB.parse(JSON.parse(h.data));o!==void 0&&che(g)&&(g.id=o),(c=this.onmessage)===null||c===void 0||c.call(this,g)}catch(g){(u=this.onerror)===null||u===void 0||u.call(this,g)}}}catch(p){if((d=this.onerror)===null||d===void 0||d.call(this,new Error(`SSE stream disconnected: ${p}`)),n&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(h){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${h instanceof Error?h.message:String(h)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new F3("No auth provider");if(await aN(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,i,o,s;try{let{resumptionToken:a,onresumptiontoken:c}=r||{};if(a){this._startOrAuthSse({resumptionToken:a,replayMessageId:TNe(e)?e.id:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");let d={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},f=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,d),p=f.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!f.ok){if(f.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new vX(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:y,scope:E}=ime(f);if(this._resourceMetadataUrl=y,this._scope=E,await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3;return this._hasCompletedAuthFlow=!0,this.send(e)}let A=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${A}`)}if(this._hasCompletedAuthFlow=!1,f.status===202){jMr(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let m=(Array.isArray(e)?e:[e]).filter(A=>"method"in A&&"id"in A&&A.id!==void 0).length>0,g=f.headers.get("content-type");if(m)if(g?.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(g?.includes("application/json")){let A=await f.json(),y=Array.isArray(A)?A.map(E=>KB.parse(E)):[KB.parse(A)];for(let E of y)(o=this.onmessage)===null||o===void 0||o.call(this,E)}else throw new vX(-1,`Unexpected content type: ${g}`)}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{let i=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:i,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},s=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(!s.ok&&s.status!==405)throw new vX(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}});import{readFile as r4o}from"node:fs/promises";var ome,sme,PU,g6t=Z(()=>{"use strict";Hle();IOe();ui();(function(t){t.CLI_CONNECT="cli_connect",t.PING="ping",t.GET_ACTIVE_FILE="get_active_file",t.GET_FILE_CONTENT="get_file_content",t.GET_SELECTED_TEXT="get_selected_text",t.SHOW_DIFF="show_diff"})(ome||(ome={}));sme=class extends Error{code;constructor(e,r){super(r),this.code=e}},PU=class{_websocket;_url;_authProvider;_websocketOptions;_WebSocket;_protocolVersion;_isClosed=!1;_specialIds=new Set;onclose;onerror;onmessage;sessionId;constructor(e,r){this._url=e,this._authProvider=r?.authProvider,this._websocketOptions=r?.websocketOptions,this._WebSocket=r?.WebSocket||ZM.default}async start(){if(this._isClosed)throw new Error(B.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let i=await this._authProvider.tokens();i?.access_token&&(e=i.access_token)}catch(i){try{let o=await this._authProvider.clientInformation();if(o){let s=await this._authProvider.tokens();if(s?.refresh_token){let a=await p6t(this._url,{clientInformation:o,refreshToken:s.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(a),a?.access_token&&(e=a.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(B.t("websocketClient.errors.unauthorizedOAuth"))}throw i}}let r={...this._websocketOptions?.headers};e&&(r.Authorization=`Bearer ${e}`),this._protocolVersion&&(r["MCP-Protocol-Version"]=this._protocolVersion);let n=new URL(this._url.toString());return n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),new Promise((i,o)=>{try{let s={headers:r};this._websocket=new this._WebSocket(n.toString(),s),this._websocket.on("open",()=>{i()}),this._websocket.on("error",a=>{let c=a.code!==void 0?a.code:void 0;o(new sme(c,`WebSocket error: ${a.message}`))}),this._websocket.on("message",async a=>{try{let c=a.toString(),u=JSON.parse(c);if(this._specialIds.has(Number(u.id))||u.type==="welcome")return;this.onmessage?.(await this._transformResponse(u))}catch(c){this.onerror?.(new Error(`Failed to parse WebSocket message: ${c instanceof Error?c.message:String(c)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(s){o(new sme(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(B.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await f6t(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:n,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(i)}else throw new Error(B.t("websocketClient.errors.clientInfoNotAvailable"))}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===ZM.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(B.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(B.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==ZM.default.OPEN)throw new Error(B.t("websocketClient.errors.websocketNotOpen"));try{if(e.method==="notifications/initialized")return;let r=await this._transformRequest(e),n=JSON.stringify(r);this._websocket.send(n)}catch(r){throw new sme(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:ome.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.3.22-beta.0",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:i}=r||{};return{type:ome.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await r4o(n,"utf8"),modifiedText:i}}}return e}async _transformResponse(e){if(e.type==="connection_ack")return{jsonrpc:"2.0",id:e.id,result:{protocolVersion:"2024-11-05",capabilities:{logging:{},prompts:{},resources:{},tools:{}},serverInfo:{name:"JetBrains Plugin Server",title:"JetBrains Plugin Server",version:"1.0.0"}}};if(e.type==="selection_changed"){let r=await this._getSelectedText();return{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0,selectedText:r}]}}}}return e.type==="active_file_changed"?{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0}]}}}:e}async _getSelectedText(){if(!this._websocket)return"";let e=performance.now();return this._specialIds.add(e),this._websocket.send(JSON.stringify({type:ome.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",i=>{try{let o=JSON.parse(i.toString());Number(o.id)===e&&(this._specialIds.delete(e),o.payload.success?r(o.payload.data.text):n(o.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var XQr,ROe,ZQr=Z(()=>{"use strict";XQr=Te(v_e(),1);ui();ROe=class{config;auth;redirectUrl="";clientMetadata={client_name:"iFlow CLI (Google ADC)",redirect_uris:[],grant_types:[],response_types:[],token_endpoint_auth_method:"none"};_clientInformation;constructor(e){this.config=e;let r=this.config?.oauth?.scopes;if(!r||r.length===0)throw new Error(B.t("mcp.auth.scopesRequired"));this.auth=new XQr.GoogleAuth({scopes:r})}clientInformation(){return this._clientInformation}saveClientInformation(e){this._clientInformation=e}async tokens(){let r=await(await this.auth.getClient()).getAccessToken();if(!r.token){console.error(B.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as n4o}from"node:child_process";import{promisify as i4o}from"node:util";import{platform as o4o}from"node:os";import{URL as s4o}from"node:url";function a4o(t){let e;try{e=new s4o(t)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Unsafe protocol: ${e.protocol}. Only HTTP and HTTPS are allowed.`);if(/[\r\n\x00-\x1f]/.test(t))throw new Error("URL contains invalid characters")}async function tqr(t){a4o(t);let e=o4o(),r,n;switch(e){case"darwin":r="open",n=[t];break;case"win32":r="powershell.exe",n=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${t.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":r="xdg-open",n=[t];break;default:throw new Error(`Unsupported platform: ${e}`)}let i={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await eqr(r,n,i)}catch(o){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let s=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let a of s)try{await eqr(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var eqr,rqr=Z(()=>{"use strict";eqr=i4o(n4o)});function Oo(t){return t instanceof Error&&"code"in t}function gr(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function A6t(t){if(t&&typeof t=="object"&&"response"in t){let r=c4o(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new NOe(r.error.message);case 401:return new lN(r.error.message);case 403:return new BOe(r.error.message);default:}}return t}function c4o(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var BOe,lN,NOe,Vu=Z(()=>{"use strict";BOe=class extends Error{},lN=class extends Error{},NOe=class extends Error{}});import{promises as bX}from"node:fs";import*as OOe from"node:path";import*as nqr from"node:os";var Gm,kOe=Z(()=>{"use strict";Vu();ui();Gm=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=nqr.homedir();return OOe.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=OOe.dirname(this.getTokenFilePath());await bX.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await bX.readFile(r,"utf-8"),i=JSON.parse(n);for(let o of i)e.set(o.serverName,o)}catch(r){r.code!=="ENOENT"&&console.error(B.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:gr(r)}))}return e}static async saveToken(e,r,n,i,o){await this.ensureConfigDir();let s=await this.loadTokens(),a={serverName:e,token:r,clientId:n,tokenUrl:i,mcpServerUrl:o,updatedAt:Date.now()};s.set(e,a);let c=Array.from(s.values()),u=this.getTokenFilePath();try{await bX.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(d){throw console.error(B.t("mcp.tokenStorage.errors.failedToSaveToken",{error:gr(d)})),d}}static async getToken(e){return(await this.loadTokens()).get(e)||null}static async removeToken(e){let r=await this.loadTokens();if(r.delete(e)){let n=Array.from(r.values()),i=this.getTokenFilePath();try{n.length===0?await bX.unlink(i):await bX.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(B.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:gr(o)}))}}}static isTokenExpired(e){if(!e.expiresAt)return!1;let r=300*1e3;return Date.now()+r>=e.expiresAt}static async clearAllTokens(){try{let e=this.getTokenFilePath();await bX.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(B.t("mcp.tokenStorage.errors.failedToClearTokens",{error:gr(e)}))}}}});var jm,POe=Z(()=>{"use strict";Vu();ui();jm=class{static buildWellKnownUrls(e){let r=new URL(e),n=`${r.protocol}//${r.host}`;return{protectedResource:new URL("/.well-known/oauth-protected-resource",n).toString(),authorizationServer:new URL("/.well-known/oauth-authorization-server",n).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch protected resource metadata from ${e}: ${gr(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch authorization server metadata from ${e}: ${gr(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[]}}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(n?.authorization_servers?.length){let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);if(a){let c=this.metadataToOAuthConfig(a);return a.registration_endpoint&&console.log(B.t("mcp.oauth.discovery.dynamicRegistrationSupported"),a.registration_endpoint),c}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let i=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(i){let o=this.metadataToOAuthConfig(i);return i.registration_endpoint&&console.log(B.t("mcp.oauth.discovery.dynamicRegistrationSupported"),i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${gr(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e){let r=this.parseWWWAuthenticateHeader(e);if(!r)return null;console.log(B.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let i=n.authorization_servers[0],o=new URL("/.well-known/oauth-authorization-server",i).toString(),s=await this.fetchAuthorizationServerMetadata(o);return s?(console.log(B.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(s)):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}`}}});import*as iqr from"node:http";import*as ame from"node:crypto";import{URL as y6t}from"node:url";var bE,E6t=Z(()=>{"use strict";rqr();kOe();Vu();POe();ui();bE=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let i={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${this.REDIRECT_PORT}${this.REDIRECT_PATH}`],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none",code_challenge_method:["S256"],scope:r.scopes?.join(" ")||""},o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){let s=await o.text();throw new Error(B.t("mcp.auth.clientRegistrationFailed",{status:o.status,statusText:o.statusText,error:s}))}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=jm.extractBaseUrl(e);return jm.discoverOAuthConfig(r)}static generatePKCEParams(){let e=ame.randomBytes(32).toString("base64url"),r=ame.createHash("sha256").update(e).digest("base64url"),n=ame.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=iqr.createServer(async(o,s)=>{try{let a=new y6t(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end(B.t("mcp.ui.notFound"));return}let c=a.searchParams.get("code"),u=a.searchParams.get("state"),d=a.searchParams.get("error");if(d){s.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),s.end(`
|
|
928
|
+
`&&n++}}return[e,r]}var _Oe,$bt=Z(()=>{_Oe=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}});function OEo(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Wbt(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Wbt).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Wbt(t.cause)}`:t.message:`${t}`}function NQr(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function kEo(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var wOe,kQr,t6t,Zs,Uh,Bd,FT,L3,RU,hX,SOe,TOe,jhe,AX,Vhe,sN,mX,yX,gX,Hhe,h5,zbt,Ybt,Kbt,OQr,Jbt,Xbt,Ghe,Zbt,e6t,BU,PQr=Z(()=>{$bt();wOe=class extends Event{constructor(e,r){var n,i;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(i=r?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(NQr(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(NQr(this),r)}};kQr=t=>{throw TypeError(t)},t6t=(t,e,r)=>e.has(t)||kQr("Cannot "+r),Zs=(t,e,r)=>(t6t(t,e,"read from private field"),r?r.call(t):e.get(t)),Uh=(t,e,r)=>e.has(t)?kQr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Bd=(t,e,r,n)=>(t6t(t,e,"write to private field"),e.set(t,r),r),FT=(t,e,r)=>(t6t(t,e,"access private method"),r),BU=class extends EventTarget{constructor(e,r){var n,i;super(),Uh(this,h5),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Uh(this,L3),Uh(this,RU),Uh(this,hX),Uh(this,SOe),Uh(this,TOe),Uh(this,jhe),Uh(this,AX),Uh(this,Vhe,null),Uh(this,sN),Uh(this,mX),Uh(this,yX,null),Uh(this,gX,null),Uh(this,Hhe,null),Uh(this,Ybt,async o=>{var s;Zs(this,mX).reset();let{body:a,redirected:c,status:u,headers:d}=o;if(u===204){FT(this,h5,Ghe).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Bd(this,hX,new URL(o.url)):Bd(this,hX,void 0),u!==200){FT(this,h5,Ghe).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){FT(this,h5,Ghe).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Zs(this,L3)===this.CLOSED)return;Bd(this,L3,this.OPEN);let f=new Event("open");if((s=Zs(this,Hhe))==null||s.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){FT(this,h5,Ghe).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let p=new TextDecoder,h=a.getReader(),m=!0;do{let{done:g,value:A}=await h.read();A&&Zs(this,mX).feed(p.decode(A,{stream:!g})),g&&(m=!1,Zs(this,mX).reset(),FT(this,h5,Zbt).call(this))}while(m)}),Uh(this,Kbt,o=>{Bd(this,sN,void 0),!(o.name==="AbortError"||o.type==="aborted")&&FT(this,h5,Zbt).call(this,Wbt(o))}),Uh(this,Jbt,o=>{typeof o.id=="string"&&Bd(this,Vhe,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:Zs(this,hX)?Zs(this,hX).origin:Zs(this,RU).origin,lastEventId:o.id||""});Zs(this,gX)&&(!o.event||o.event==="message")&&Zs(this,gX).call(this,s),this.dispatchEvent(s)}),Uh(this,Xbt,o=>{Bd(this,jhe,o)}),Uh(this,e6t,()=>{Bd(this,AX,void 0),Zs(this,L3)===this.CONNECTING&&FT(this,h5,zbt).call(this)});try{if(e instanceof URL)Bd(this,RU,e);else if(typeof e=="string")Bd(this,RU,new URL(e,kEo()));else throw new Error("Invalid URL")}catch{throw OEo("An invalid or illegal string was specified")}Bd(this,mX,xOe({onEvent:Zs(this,Jbt),onRetry:Zs(this,Xbt)})),Bd(this,L3,this.CONNECTING),Bd(this,jhe,3e3),Bd(this,TOe,(n=r?.fetch)!=null?n:globalThis.fetch),Bd(this,SOe,(i=r?.withCredentials)!=null?i:!1),FT(this,h5,zbt).call(this)}get readyState(){return Zs(this,L3)}get url(){return Zs(this,RU).href}get withCredentials(){return Zs(this,SOe)}get onerror(){return Zs(this,yX)}set onerror(e){Bd(this,yX,e)}get onmessage(){return Zs(this,gX)}set onmessage(e){Bd(this,gX,e)}get onopen(){return Zs(this,Hhe)}set onopen(e){Bd(this,Hhe,e)}addEventListener(e,r,n){let i=r;super.addEventListener(e,i,n)}removeEventListener(e,r,n){let i=r;super.removeEventListener(e,i,n)}close(){Zs(this,AX)&&clearTimeout(Zs(this,AX)),Zs(this,L3)!==this.CLOSED&&(Zs(this,sN)&&Zs(this,sN).abort(),Bd(this,L3,this.CLOSED),Bd(this,sN,void 0))}};L3=new WeakMap,RU=new WeakMap,hX=new WeakMap,SOe=new WeakMap,TOe=new WeakMap,jhe=new WeakMap,AX=new WeakMap,Vhe=new WeakMap,sN=new WeakMap,mX=new WeakMap,yX=new WeakMap,gX=new WeakMap,Hhe=new WeakMap,h5=new WeakSet,zbt=function(){Bd(this,L3,this.CONNECTING),Bd(this,sN,new AbortController),Zs(this,TOe)(Zs(this,RU),FT(this,h5,OQr).call(this)).then(Zs(this,Ybt)).catch(Zs(this,Kbt))},Ybt=new WeakMap,Kbt=new WeakMap,OQr=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Zs(this,Vhe)?{"Last-Event-ID":Zs(this,Vhe)}:void 0},cache:"no-store",signal:(t=Zs(this,sN))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Jbt=new WeakMap,Xbt=new WeakMap,Ghe=function(t,e){var r;Zs(this,L3)!==this.CLOSED&&Bd(this,L3,this.CLOSED);let n=new wOe("error",{code:e,message:t});(r=Zs(this,yX))==null||r.call(this,n),this.dispatchEvent(n)},Zbt=function(t,e){var r;if(Zs(this,L3)===this.CLOSED)return;Bd(this,L3,this.CONNECTING);let n=new wOe("error",{code:e,message:t});(r=Zs(this,yX))==null||r.call(this,n),this.dispatchEvent(n),Bd(this,AX,setTimeout(Zs(this,e6t),Zs(this,jhe)))},e6t=new WeakMap,BU.CONNECTING=0,BU.OPEN=1,BU.CLOSED=2});async function PEo(t){return(await r6t).getRandomValues(new Uint8Array(t))}async function MEo(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await PEo(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function LEo(t){return await MEo(t)}async function FEo(t){let e=await(await r6t).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function n6t(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await LEo(t),r=await FEo(e);return{code_verifier:e,code_challenge:r}}var r6t,MQr=Z(()=>{r6t=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var sg,FQr,i6t,UEo,UQr,o6t,QQr,LQr,QEo,qEo,qQr,GHa,jHa,s6t=Z(()=>{YB();sg=oe.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:oe.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),oe.NEVER}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),FQr=oe.object({resource:oe.string().url(),authorization_servers:oe.array(sg).optional(),jwks_uri:oe.string().url().optional(),scopes_supported:oe.array(oe.string()).optional(),bearer_methods_supported:oe.array(oe.string()).optional(),resource_signing_alg_values_supported:oe.array(oe.string()).optional(),resource_name:oe.string().optional(),resource_documentation:oe.string().optional(),resource_policy_uri:oe.string().url().optional(),resource_tos_uri:oe.string().url().optional(),tls_client_certificate_bound_access_tokens:oe.boolean().optional(),authorization_details_types_supported:oe.array(oe.string()).optional(),dpop_signing_alg_values_supported:oe.array(oe.string()).optional(),dpop_bound_access_tokens_required:oe.boolean().optional()}).passthrough(),i6t=oe.object({issuer:oe.string(),authorization_endpoint:sg,token_endpoint:sg,registration_endpoint:sg.optional(),scopes_supported:oe.array(oe.string()).optional(),response_types_supported:oe.array(oe.string()),response_modes_supported:oe.array(oe.string()).optional(),grant_types_supported:oe.array(oe.string()).optional(),token_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),service_documentation:sg.optional(),revocation_endpoint:sg.optional(),revocation_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),introspection_endpoint:oe.string().optional(),introspection_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),code_challenge_methods_supported:oe.array(oe.string()).optional()}).passthrough(),UEo=oe.object({issuer:oe.string(),authorization_endpoint:sg,token_endpoint:sg,userinfo_endpoint:sg.optional(),jwks_uri:sg,registration_endpoint:sg.optional(),scopes_supported:oe.array(oe.string()).optional(),response_types_supported:oe.array(oe.string()),response_modes_supported:oe.array(oe.string()).optional(),grant_types_supported:oe.array(oe.string()).optional(),acr_values_supported:oe.array(oe.string()).optional(),subject_types_supported:oe.array(oe.string()),id_token_signing_alg_values_supported:oe.array(oe.string()),id_token_encryption_alg_values_supported:oe.array(oe.string()).optional(),id_token_encryption_enc_values_supported:oe.array(oe.string()).optional(),userinfo_signing_alg_values_supported:oe.array(oe.string()).optional(),userinfo_encryption_alg_values_supported:oe.array(oe.string()).optional(),userinfo_encryption_enc_values_supported:oe.array(oe.string()).optional(),request_object_signing_alg_values_supported:oe.array(oe.string()).optional(),request_object_encryption_alg_values_supported:oe.array(oe.string()).optional(),request_object_encryption_enc_values_supported:oe.array(oe.string()).optional(),token_endpoint_auth_methods_supported:oe.array(oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:oe.array(oe.string()).optional(),display_values_supported:oe.array(oe.string()).optional(),claim_types_supported:oe.array(oe.string()).optional(),claims_supported:oe.array(oe.string()).optional(),service_documentation:oe.string().optional(),claims_locales_supported:oe.array(oe.string()).optional(),ui_locales_supported:oe.array(oe.string()).optional(),claims_parameter_supported:oe.boolean().optional(),request_parameter_supported:oe.boolean().optional(),request_uri_parameter_supported:oe.boolean().optional(),require_request_uri_registration:oe.boolean().optional(),op_policy_uri:sg.optional(),op_tos_uri:sg.optional()}).passthrough(),UQr=UEo.merge(i6t.pick({code_challenge_methods_supported:!0})),o6t=oe.object({access_token:oe.string(),id_token:oe.string().optional(),token_type:oe.string(),expires_in:oe.number().optional(),scope:oe.string().optional(),refresh_token:oe.string().optional()}).strip(),QQr=oe.object({error:oe.string(),error_description:oe.string().optional(),error_uri:oe.string().optional()}),LQr=sg.optional().or(oe.literal("").transform(()=>{})),QEo=oe.object({redirect_uris:oe.array(sg),token_endpoint_auth_method:oe.string().optional(),grant_types:oe.array(oe.string()).optional(),response_types:oe.array(oe.string()).optional(),client_name:oe.string().optional(),client_uri:sg.optional(),logo_uri:LQr,scope:oe.string().optional(),contacts:oe.array(oe.string()).optional(),tos_uri:LQr,policy_uri:oe.string().optional(),jwks_uri:sg.optional(),jwks:oe.any().optional(),software_id:oe.string().optional(),software_version:oe.string().optional(),software_statement:oe.string().optional()}).strip(),qEo=oe.object({client_id:oe.string(),client_secret:oe.string().optional(),client_id_issued_at:oe.number().optional(),client_secret_expires_at:oe.number().optional()}).strip(),qQr=QEo.merge(qEo),GHa=oe.object({error:oe.string(),error_description:oe.string().optional()}).strip(),jHa=oe.object({token:oe.string(),token_type_hint:oe.string().optional()}).strip()});function HQr(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function GQr({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var jQr=Z(()=>{});var rh,$he,NU,OU,kU,Whe,zhe,Yhe,UT,Khe,Jhe,Xhe,Zhe,eme,tme,rme,nme,VQr,$Qr=Z(()=>{rh=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},$he=class extends rh{};$he.errorCode="invalid_request";NU=class extends rh{};NU.errorCode="invalid_client";OU=class extends rh{};OU.errorCode="invalid_grant";kU=class extends rh{};kU.errorCode="unauthorized_client";Whe=class extends rh{};Whe.errorCode="unsupported_grant_type";zhe=class extends rh{};zhe.errorCode="invalid_scope";Yhe=class extends rh{};Yhe.errorCode="access_denied";UT=class extends rh{};UT.errorCode="server_error";Khe=class extends rh{};Khe.errorCode="temporarily_unavailable";Jhe=class extends rh{};Jhe.errorCode="unsupported_response_type";Xhe=class extends rh{};Xhe.errorCode="unsupported_token_type";Zhe=class extends rh{};Zhe.errorCode="invalid_token";eme=class extends rh{};eme.errorCode="method_not_allowed";tme=class extends rh{};tme.errorCode="too_many_requests";rme=class extends rh{};rme.errorCode="invalid_client_metadata";nme=class extends rh{};nme.errorCode="insufficient_scope";VQr={[$he.errorCode]:$he,[NU.errorCode]:NU,[OU.errorCode]:OU,[kU.errorCode]:kU,[Whe.errorCode]:Whe,[zhe.errorCode]:zhe,[Yhe.errorCode]:Yhe,[UT.errorCode]:UT,[Khe.errorCode]:Khe,[Jhe.errorCode]:Jhe,[Xhe.errorCode]:Xhe,[Zhe.errorCode]:Zhe,[eme.errorCode]:eme,[tme.errorCode]:tme,[rme.errorCode]:rme,[nme.errorCode]:nme}});function HEo(t){return["client_secret_basic","client_secret_post","none"].includes(t)}function zQr(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&HEo(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function YQr(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":GEo(i,o,r);return;case"client_secret_post":jEo(i,o,n);return;case"none":VEo(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function GEo(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function jEo(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function VEo(t,e){e.set("client_id",t)}async function u6t(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=QQr.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=VQr[i]||UT;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new UT(i)}}async function aN(t,e){var r,n;try{return await l6t(t,e)}catch(i){if(i instanceof NU||i instanceof kU)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await l6t(t,e);if(i instanceof OU)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await l6t(t,e);throw i}}async function l6t(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await WEo(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await $Eo(e,t,s),u=await XEo(a,{fetchFn:o}),d=await Promise.resolve(t.clientInformation());if(!d){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let g=await e4o(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(g),d=g}if(r!==void 0){let g=await t.codeVerifier(),A=await f6t(a,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:g,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}let f=await t.tokens();if(f?.refresh_token)try{let g=await p6t(a,{metadata:u,clientInformation:d,refreshToken:f.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(g),"AUTHORIZED"}catch(g){if(!(!(g instanceof rh)||g instanceof UT))throw g}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:m}=await ZEo(a,{metadata:u,clientInformation:d,state:p,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(h),"REDIRECT"}async function $Eo(t,e,r){let n=HQr(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!GQr({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function ime(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=/resource_metadata="([^"]*)"/.exec(e),a=/scope="([^"]*)"/.exec(e),c;if(o)try{c=new URL(o[1])}catch{}let u=a?.[1]||void 0;return{resourceMetadataUrl:c,scope:u}}async function WEo(t,e,r=fetch){let n=await KEo(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return FQr.parse(await n.json())}async function d6t(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?d6t(t,void 0,r):void 0;throw n}}function zEo(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function WQr(t,e,r=fetch){return await d6t(t,{"MCP-Protocol-Version":e},r)}function YEo(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function KEo(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:WJ,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let d=zEo(e,s.pathname);c=new URL(d,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await WQr(c,a,r);if(!n?.metadataUrl&&YEo(u,s.pathname)){let d=new URL(`/.well-known/${e}`,s);u=await WQr(d,a,r)}return u}function JEo(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function XEo(t,{fetchFn:e=fetch,protocolVersion:r=WJ}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},i=JEo(t);for(let{url:o,type:s}of i){let a=await d6t(o,n,e);if(a){if(!a.ok){if(a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}return s==="oauth"?i6t.parse(await a.json()):UQr.parse(await a.json())}}}async function ZEo(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a;if(e){if(a=new URL(e.authorization_endpoint),!e.response_types_supported.includes(a6t))throw new Error(`Incompatible auth server: does not support response type ${a6t}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(c6t))throw new Error(`Incompatible auth server: does not support code challenge method ${c6t}`)}else a=new URL("/authorize",t);let c=await n6t(),u=c.code_verifier,d=c.code_challenge;return a.searchParams.set("response_type",a6t),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",d),a.searchParams.set("code_challenge_method",c6t),a.searchParams.set("redirect_uri",String(n)),o&&a.searchParams.set("state",o),i&&a.searchParams.set("scope",i),i?.includes("offline_access")&&a.searchParams.append("prompt","consent"),s&&a.searchParams.set("resource",s.href),{authorizationUrl:a,codeVerifier:u}}async function f6t(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:i,redirectUri:o,resource:s,addClientAuthentication:a,fetchFn:c}){var u;let d="authorization_code",f=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`);let p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),h=new URLSearchParams({grant_type:d,code:n,code_verifier:i,redirect_uri:String(o)});if(a)a(p,h,t,e);else{let g=(u=e?.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],A=zQr(r,g);YQr(A,r,p,h)}s&&h.set("resource",s.href);let m=await(c??fetch)(f,{method:"POST",headers:p,body:h});if(!m.ok)throw await u6t(m);return o6t.parse(await m.json())}async function p6t(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){var a;let c="refresh_token",u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);let d=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),f=new URLSearchParams({grant_type:c,refresh_token:n});if(o)o(d,f,t,e);else{let h=(a=e?.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],m=zQr(r,h);YQr(m,r,d,f)}i&&f.set("resource",i.href);let p=await(s??fetch)(u,{method:"POST",headers:d,body:f});if(!p.ok)throw await u6t(p);return o6t.parse({refresh_token:n,...await p.json()})}async function e4o(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await u6t(o);return qQr.parse(await o.json())}var F3,a6t,c6t,IOe=Z(()=>{MQr();JB();s6t();s6t();jQr();$Qr();F3=class extends Error{constructor(e){super(e??"Unauthorized")}};a6t="code",c6t="S256"});var h6t,EX,KQr=Z(()=>{PQr();JB();IOe();h6t=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},EX=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new F3("No auth provider");let r;try{r=await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new F3;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,n;let i=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((o,s)=>{this._eventSource=new BU(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{let u=await this._commonHeaders();u.set("Accept","text/event-stream");let d=await i(a,{...c,headers:u});if(d.status===401&&d.headers.has("www-authenticate")){let{resourceMetadataUrl:f,scope:p}=ime(d);this._resourceMetadataUrl=f,this._scope=p}return d}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{var c;if(a.code===401&&this._authProvider){this._authThenStart().then(o,s);return}let u=new h6t(a.code,a.message,a);s(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{var c;let u=a;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(d){s(d),(c=this.onerror)===null||c===void 0||c.call(this,d),this.close();return}o()}),this._eventSource.onmessage=a=>{var c,u;let d=a,f;try{f=KB.parse(JSON.parse(d.data))}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p);return}(u=this.onmessage)===null||u===void 0||u.call(this,f)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new F3("No auth provider");if(await aN(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,i;if(!this._endpoint)throw new Error("Not connected");try{let o=await this._commonHeaders();o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},a=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,s);if(!a.ok){if(a.status===401&&this._authProvider){let{resourceMetadataUrl:u,scope:d}=ime(a);if(this._resourceMetadataUrl=u,this._scope=d,await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3;return this.send(e)}let c=await a.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}setProtocolVersion(e){this._protocolVersion=e}}});var DOe,JQr=Z(()=>{$bt();DOe=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=xOe({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}}});var t4o,vX,cN,m6t=Z(()=>{JB();IOe();JQr();t4o={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},vX=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},cN=class{constructor(e,r){var n;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:t4o}async _authThenStart(){var e;if(!this._authProvider)throw new F3("No auth provider");let r;try{r=await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new F3;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,i;let{resumptionToken:o}=e;try{let s=await this._commonHeaders();s.set("Accept","text/event-stream"),o&&s.set("last-event-id",o);let a=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:s,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!a.ok){if(a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new vX(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(s){throw(i=this.onerror)===null||i===void 0||i.call(this,s),s}}_getNextReconnectionDelay(e){let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var n;let i=this._reconnectionOptions.maxRetries;if(i>0&&r>=i){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s;(async()=>{var c,u,d,f;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new DOe).getReader();for(;;){let{value:h,done:m}=await p.read();if(m)break;if(h.id&&(s=h.id,i?.(h.id)),!h.event||h.event==="message")try{let g=KB.parse(JSON.parse(h.data));o!==void 0&&che(g)&&(g.id=o),(c=this.onmessage)===null||c===void 0||c.call(this,g)}catch(g){(u=this.onerror)===null||u===void 0||u.call(this,g)}}}catch(p){if((d=this.onerror)===null||d===void 0||d.call(this,new Error(`SSE stream disconnected: ${p}`)),n&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(h){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${h instanceof Error?h.message:String(h)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new F3("No auth provider");if(await aN(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,i,o,s;try{let{resumptionToken:a,onresumptiontoken:c}=r||{};if(a){this._startOrAuthSse({resumptionToken:a,replayMessageId:TNe(e)?e.id:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");let d={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},f=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,d),p=f.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!f.ok){if(f.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new vX(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:y,scope:E}=ime(f);if(this._resourceMetadataUrl=y,this._scope=E,await aN(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new F3;return this._hasCompletedAuthFlow=!0,this.send(e)}let A=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${A}`)}if(this._hasCompletedAuthFlow=!1,f.status===202){jMr(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let m=(Array.isArray(e)?e:[e]).filter(A=>"method"in A&&"id"in A&&A.id!==void 0).length>0,g=f.headers.get("content-type");if(m)if(g?.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(g?.includes("application/json")){let A=await f.json(),y=Array.isArray(A)?A.map(E=>KB.parse(E)):[KB.parse(A)];for(let E of y)(o=this.onmessage)===null||o===void 0||o.call(this,E)}else throw new vX(-1,`Unexpected content type: ${g}`)}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{let i=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:i,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},s=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(!s.ok&&s.status!==405)throw new vX(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}});import{readFile as r4o}from"node:fs/promises";var ome,sme,PU,g6t=Z(()=>{"use strict";Hle();IOe();ui();(function(t){t.CLI_CONNECT="cli_connect",t.PING="ping",t.GET_ACTIVE_FILE="get_active_file",t.GET_FILE_CONTENT="get_file_content",t.GET_SELECTED_TEXT="get_selected_text",t.SHOW_DIFF="show_diff"})(ome||(ome={}));sme=class extends Error{code;constructor(e,r){super(r),this.code=e}},PU=class{_websocket;_url;_authProvider;_websocketOptions;_WebSocket;_protocolVersion;_isClosed=!1;_specialIds=new Set;onclose;onerror;onmessage;sessionId;constructor(e,r){this._url=e,this._authProvider=r?.authProvider,this._websocketOptions=r?.websocketOptions,this._WebSocket=r?.WebSocket||ZM.default}async start(){if(this._isClosed)throw new Error(B.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let i=await this._authProvider.tokens();i?.access_token&&(e=i.access_token)}catch(i){try{let o=await this._authProvider.clientInformation();if(o){let s=await this._authProvider.tokens();if(s?.refresh_token){let a=await p6t(this._url,{clientInformation:o,refreshToken:s.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(a),a?.access_token&&(e=a.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(B.t("websocketClient.errors.unauthorizedOAuth"))}throw i}}let r={...this._websocketOptions?.headers};e&&(r.Authorization=`Bearer ${e}`),this._protocolVersion&&(r["MCP-Protocol-Version"]=this._protocolVersion);let n=new URL(this._url.toString());return n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),new Promise((i,o)=>{try{let s={headers:r};this._websocket=new this._WebSocket(n.toString(),s),this._websocket.on("open",()=>{i()}),this._websocket.on("error",a=>{let c=a.code!==void 0?a.code:void 0;o(new sme(c,`WebSocket error: ${a.message}`))}),this._websocket.on("message",async a=>{try{let c=a.toString(),u=JSON.parse(c);if(this._specialIds.has(Number(u.id))||u.type==="welcome")return;this.onmessage?.(await this._transformResponse(u))}catch(c){this.onerror?.(new Error(`Failed to parse WebSocket message: ${c instanceof Error?c.message:String(c)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(s){o(new sme(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(B.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await f6t(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:n,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(i)}else throw new Error(B.t("websocketClient.errors.clientInfoNotAvailable"))}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===ZM.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(B.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(B.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==ZM.default.OPEN)throw new Error(B.t("websocketClient.errors.websocketNotOpen"));try{if(e.method==="notifications/initialized")return;let r=await this._transformRequest(e),n=JSON.stringify(r);this._websocket.send(n)}catch(r){throw new sme(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:ome.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.3.22",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:i}=r||{};return{type:ome.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await r4o(n,"utf8"),modifiedText:i}}}return e}async _transformResponse(e){if(e.type==="connection_ack")return{jsonrpc:"2.0",id:e.id,result:{protocolVersion:"2024-11-05",capabilities:{logging:{},prompts:{},resources:{},tools:{}},serverInfo:{name:"JetBrains Plugin Server",title:"JetBrains Plugin Server",version:"1.0.0"}}};if(e.type==="selection_changed"){let r=await this._getSelectedText();return{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0,selectedText:r}]}}}}return e.type==="active_file_changed"?{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0}]}}}:e}async _getSelectedText(){if(!this._websocket)return"";let e=performance.now();return this._specialIds.add(e),this._websocket.send(JSON.stringify({type:ome.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",i=>{try{let o=JSON.parse(i.toString());Number(o.id)===e&&(this._specialIds.delete(e),o.payload.success?r(o.payload.data.text):n(o.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var XQr,ROe,ZQr=Z(()=>{"use strict";XQr=Te(v_e(),1);ui();ROe=class{config;auth;redirectUrl="";clientMetadata={client_name:"iFlow CLI (Google ADC)",redirect_uris:[],grant_types:[],response_types:[],token_endpoint_auth_method:"none"};_clientInformation;constructor(e){this.config=e;let r=this.config?.oauth?.scopes;if(!r||r.length===0)throw new Error(B.t("mcp.auth.scopesRequired"));this.auth=new XQr.GoogleAuth({scopes:r})}clientInformation(){return this._clientInformation}saveClientInformation(e){this._clientInformation=e}async tokens(){let r=await(await this.auth.getClient()).getAccessToken();if(!r.token){console.error(B.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as n4o}from"node:child_process";import{promisify as i4o}from"node:util";import{platform as o4o}from"node:os";import{URL as s4o}from"node:url";function a4o(t){let e;try{e=new s4o(t)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Unsafe protocol: ${e.protocol}. Only HTTP and HTTPS are allowed.`);if(/[\r\n\x00-\x1f]/.test(t))throw new Error("URL contains invalid characters")}async function tqr(t){a4o(t);let e=o4o(),r,n;switch(e){case"darwin":r="open",n=[t];break;case"win32":r="powershell.exe",n=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${t.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":r="xdg-open",n=[t];break;default:throw new Error(`Unsupported platform: ${e}`)}let i={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await eqr(r,n,i)}catch(o){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let s=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let a of s)try{await eqr(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var eqr,rqr=Z(()=>{"use strict";eqr=i4o(n4o)});function Oo(t){return t instanceof Error&&"code"in t}function gr(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function A6t(t){if(t&&typeof t=="object"&&"response"in t){let r=c4o(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new NOe(r.error.message);case 401:return new lN(r.error.message);case 403:return new BOe(r.error.message);default:}}return t}function c4o(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var BOe,lN,NOe,Vu=Z(()=>{"use strict";BOe=class extends Error{},lN=class extends Error{},NOe=class extends Error{}});import{promises as bX}from"node:fs";import*as OOe from"node:path";import*as nqr from"node:os";var Gm,kOe=Z(()=>{"use strict";Vu();ui();Gm=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=nqr.homedir();return OOe.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=OOe.dirname(this.getTokenFilePath());await bX.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await bX.readFile(r,"utf-8"),i=JSON.parse(n);for(let o of i)e.set(o.serverName,o)}catch(r){r.code!=="ENOENT"&&console.error(B.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:gr(r)}))}return e}static async saveToken(e,r,n,i,o){await this.ensureConfigDir();let s=await this.loadTokens(),a={serverName:e,token:r,clientId:n,tokenUrl:i,mcpServerUrl:o,updatedAt:Date.now()};s.set(e,a);let c=Array.from(s.values()),u=this.getTokenFilePath();try{await bX.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(d){throw console.error(B.t("mcp.tokenStorage.errors.failedToSaveToken",{error:gr(d)})),d}}static async getToken(e){return(await this.loadTokens()).get(e)||null}static async removeToken(e){let r=await this.loadTokens();if(r.delete(e)){let n=Array.from(r.values()),i=this.getTokenFilePath();try{n.length===0?await bX.unlink(i):await bX.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(B.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:gr(o)}))}}}static isTokenExpired(e){if(!e.expiresAt)return!1;let r=300*1e3;return Date.now()+r>=e.expiresAt}static async clearAllTokens(){try{let e=this.getTokenFilePath();await bX.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(B.t("mcp.tokenStorage.errors.failedToClearTokens",{error:gr(e)}))}}}});var jm,POe=Z(()=>{"use strict";Vu();ui();jm=class{static buildWellKnownUrls(e){let r=new URL(e),n=`${r.protocol}//${r.host}`;return{protectedResource:new URL("/.well-known/oauth-protected-resource",n).toString(),authorizationServer:new URL("/.well-known/oauth-authorization-server",n).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch protected resource metadata from ${e}: ${gr(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch authorization server metadata from ${e}: ${gr(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[]}}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(n?.authorization_servers?.length){let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);if(a){let c=this.metadataToOAuthConfig(a);return a.registration_endpoint&&console.log(B.t("mcp.oauth.discovery.dynamicRegistrationSupported"),a.registration_endpoint),c}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let i=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(i){let o=this.metadataToOAuthConfig(i);return i.registration_endpoint&&console.log(B.t("mcp.oauth.discovery.dynamicRegistrationSupported"),i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${gr(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e){let r=this.parseWWWAuthenticateHeader(e);if(!r)return null;console.log(B.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let i=n.authorization_servers[0],o=new URL("/.well-known/oauth-authorization-server",i).toString(),s=await this.fetchAuthorizationServerMetadata(o);return s?(console.log(B.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(s)):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}`}}});import*as iqr from"node:http";import*as ame from"node:crypto";import{URL as y6t}from"node:url";var bE,E6t=Z(()=>{"use strict";rqr();kOe();Vu();POe();ui();bE=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let i={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${this.REDIRECT_PORT}${this.REDIRECT_PATH}`],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none",code_challenge_method:["S256"],scope:r.scopes?.join(" ")||""},o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){let s=await o.text();throw new Error(B.t("mcp.auth.clientRegistrationFailed",{status:o.status,statusText:o.statusText,error:s}))}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=jm.extractBaseUrl(e);return jm.discoverOAuthConfig(r)}static generatePKCEParams(){let e=ame.randomBytes(32).toString("base64url"),r=ame.createHash("sha256").update(e).digest("base64url"),n=ame.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=iqr.createServer(async(o,s)=>{try{let a=new y6t(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end(B.t("mcp.ui.notFound"));return}let c=a.searchParams.get("code"),u=a.searchParams.get("state"),d=a.searchParams.get("error");if(d){s.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),s.end(`
|
|
929
929
|
<html>
|
|
930
930
|
<body>
|
|
931
931
|
<h1>${B.t("mcp.ui.authenticationFailed")}</h1>
|
|
@@ -4527,7 +4527,7 @@ ${Le.description}`:Le.subject||Le.description||"Thinking...",[]),Ee=(0,sa.useCal
|
|
|
4527
4527
|
`,e-1),[i,o]=ina(r);return{line:n===-1?i:t.slice(0,n+1).match(/\n/g).length+i,column:e-n-1+o}}function nXt(t,e,r){if(typeof t!="string")throw new TypeError("Text parameter should be a string");if(!Number.isInteger(e))throw new TypeError("Index parameter should be an integer");if(e<0||e>t.length)throw new RangeError("Index out of bounds");return ona(t,e,r)}var sna=t=>`\\u{${t.codePointAt(0).toString(16)}}`,iXt=class t extends Error{name="JSONError";fileName;#e;#t;#r;#n;#i;constructor(e){if(typeof e=="string")super(),this.#r=e;else{let{jsonParseError:r,fileName:n,input:i}=e;super(void 0,{cause:r}),this.#e=i,this.#t=r,this.fileName=n}Error.captureStackTrace?.(this,t)}get message(){this.#r??=`${cna(this.#t.message)}${this.#e===""?" while parsing empty string":""}`;let{codeFrame:e}=this;return`${this.#r}${this.fileName?` in ${this.fileName}`:""}${e?`
|
|
4528
4528
|
|
|
4529
4529
|
${e}
|
|
4530
|
-
`:""}`}set message(e){this.#r=e}#o(e){if(!this.#t)return;let r=this.#e,n=ana(r,this.#t.message);if(n)return(0,wei.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#n??=this.#o(!0),this.#n}get rawCodeFrame(){return this.#i??=this.#o(!1),this.#i}},ana=(t,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:o}=r.groups;return i&&o?{line:Number(i),column:Number(o)}:nXt(t,Number(n),{oneBased:!0})},cna=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${sna(n)})`);function oXt(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new iXt({jsonParseError:n,fileName:r,input:t})}}var Mti=Te(kti(),1);import{fileURLToPath as Bia}from"node:url";function Pti(t){return t instanceof URL?Bia(t):t}var kia=t=>Oia.resolve(Pti(t)??".","package.json"),Pia=(t,e)=>{let r=typeof t=="string"?oXt(t):t;return e&&(0,Mti.default)(r),r};async function Lti({cwd:t,normalize:e=!0}={}){let r=await Nia.readFile(kia(t),"utf8");return Pia(r,e)}async function Fti(t){let e=await tei("package.json",t);if(e)return{packageJson:await Lti({...t,cwd:Mia.dirname(e)}),path:e}}import{fileURLToPath as Lia}from"url";import Fia from"path";var Uia=Lia(import.meta.url),Qia=Fia.dirname(Uia),ctt;async function OP(){if(ctt)return ctt;let t=await Fti({cwd:Qia});if(t)return ctt=t.packageJson,ctt}async function kP(){let t=await OP();return"0.3.22
|
|
4530
|
+
`:""}`}set message(e){this.#r=e}#o(e){if(!this.#t)return;let r=this.#e,n=ana(r,this.#t.message);if(n)return(0,wei.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#n??=this.#o(!0),this.#n}get rawCodeFrame(){return this.#i??=this.#o(!1),this.#i}},ana=(t,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:o}=r.groups;return i&&o?{line:Number(i),column:Number(o)}:nXt(t,Number(n),{oneBased:!0})},cna=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${sna(n)})`);function oXt(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new iXt({jsonParseError:n,fileName:r,input:t})}}var Mti=Te(kti(),1);import{fileURLToPath as Bia}from"node:url";function Pti(t){return t instanceof URL?Bia(t):t}var kia=t=>Oia.resolve(Pti(t)??".","package.json"),Pia=(t,e)=>{let r=typeof t=="string"?oXt(t):t;return e&&(0,Mti.default)(r),r};async function Lti({cwd:t,normalize:e=!0}={}){let r=await Nia.readFile(kia(t),"utf8");return Pia(r,e)}async function Fti(t){let e=await tei("package.json",t);if(e)return{packageJson:await Lti({...t,cwd:Mia.dirname(e)}),path:e}}import{fileURLToPath as Lia}from"url";import Fia from"path";var Uia=Lia(import.meta.url),Qia=Fia.dirname(Uia),ctt;async function OP(){if(ctt)return ctt;let t=await Fti({cwd:Qia});if(t)return ctt=t.packageJson,ctt}async function kP(){let t=await OP();return"0.3.22"}Ps();qt();import Kj from"node:process";var Uti={name:"about",description:B.t("command.about"),kind:"built-in",action:async t=>{let e=Kj.platform,r=B.t("aboutCommand.noSandbox");Kj.env.SANDBOX&&Kj.env.SANDBOX!=="sandbox-exec"?r=Kj.env.SANDBOX:Kj.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${Kj.env.SEATBELT_PROFILE||B.t("aboutCommand.unknown")})`);let n=t.services.config?.getModel()||B.t("aboutCommand.unknown"),i=await kP(),o=t.services.settings.merged.selectedAuthType||"",s=Kj.env.GOOGLE_CLOUD_PROJECT||"",a={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:o,gcpProject:s};t.ui.addItem(a,Date.now())}};qt();qt();Ps();var utt="\x1B[32m";var qti="\x1B[31m",PP="\x1B[36m",Qg="\x1B[90m";var Dc="\x1B[0m";function ltt(t,e,r,n=!1){let i="";if(t.length===0)return i="\u{1F534} ",`${i}${e}
|
|
4531
4531
|
${qti}${B.t("agentsCommand.list.noAgentsFound")}${Dc}
|
|
4532
4532
|
`;i="\u{1F7E2} ";let o=`${i}${e}
|
|
4533
4533
|
`;for(let s of t)n?o+=qia(s):o+=`${utt}- ${s.agentType}${Dc}
|
|
@@ -5626,7 +5626,7 @@ ${B.t("gemini.errors.criticalUnhandledRejection")}
|
|
|
5626
5626
|
=========================================
|
|
5627
5627
|
${B.t("gemini.errors.reason",{reason:e})}${e instanceof Error&&e.stack?`
|
|
5628
5628
|
${B.t("gemini.errors.stackTrace")}
|
|
5629
|
-
${e.stack}`:""}`;Us.emit("log-error",n),t||(t=!0,Us.emit("open-debug-console"))})}function BAa(){console.log(B.t("gemini.crashDiagnosticsEnabled")),process.setUncaughtExceptionCaptureCallback(t=>{let e={timestamp:new Date().toISOString(),error:{name:t.name,message:t.message,stack:t.stack},memory:process.memoryUsage(),pid:process.pid,cwd:process.cwd(),nodeVersion:process.version,platform:process.platform,arch:process.arch,uptime:process.uptime(),env:{NODE_ENV:"production",SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.3.22
|
|
5629
|
+
${e.stack}`:""}`;Us.emit("log-error",n),t||(t=!0,Us.emit("open-debug-console"))})}function BAa(){console.log(B.t("gemini.crashDiagnosticsEnabled")),process.setUncaughtExceptionCaptureCallback(t=>{let e={timestamp:new Date().toISOString(),error:{name:t.name,message:t.message,stack:t.stack},memory:process.memoryUsage(),pid:process.pid,cwd:process.cwd(),nodeVersion:process.version,platform:process.platform,arch:process.arch,uptime:process.uptime(),env:{NODE_ENV:"production",SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.3.22"}},r=`crash-${Date.now()}-${process.pid}.json`,n=bAa.join(process.cwd(),r);try{wAa.writeFileSync(n,JSON.stringify(e,null,2)),console.error(B.t("gemini.crashDetected",{crashFilePath:n})),console.error(B.t("gemini.coreDumpWillBeGenerated"))}catch(i){console.error(B.t("gemini.failedToWriteCrashFile"),i)}process.abort()}),process.on("warning",t=>{console.warn(B.t("gemini.debug.nodejsWarning"),{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error(B.t("gemini.debug.unhandledPromiseRejectionDetected"),{reason:t,promise:e.toString()})})}async function O2i(){RAa();let t=process.cwd(),e=pl(t);if(!e.user.settings.cna){let m=await VBe();m&&e.setValue("User","cna",m)}if(await Imi(),e.errors.length>0){for(let m of e.errors){let g=B.t("gemini.errorInFile",{path:m.path,message:m.message});process.env.NO_COLOR||(g=`\x1B[31m${g}\x1B[0m`),console.error(g),console.error(B.t("gemini.pleaseFixFileAndTryAgain",{path:m.path}))}process.exit(1)}let r=await Unt(),n=typeof r.resume=="string";(!!r.prompt&&!r.promptInteractive&&!r.continue&&(!r.resume||n)||r.experimentalAcp)&&(process.env.IFLOW_NON_INTERACTIVE="true");let o=JP(t),s=n&&typeof r.resume=="string"?r.resume:v0.generateSessionId(),a=await qV(e.merged,o,s,r);if(B.changeLanguage(a.getLanguage()),a.getDebugMode()&&BAa(),xAa.setDefaultResultOrder(TAa(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error(B.t("gemini.errors.promptInteractiveFlagNotSupported")),process.exit(1)),a.getListExtensions()){console.debug(B.t("gemini.installedExtensions"));for(let m of o)console.debug(`- ${m.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:m}=await Promise.resolve().then(()=>(Trr(),bmi)),g=(await Promise.resolve().then(()=>($nr(),Vnr))).default;await g().scriptName("iflow").command(m).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:m}=await Promise.resolve().then(()=>(Srr(),ami)),g=(await Promise.resolve().then(()=>($nr(),Vnr))).default;await g().scriptName("iflow").command(m).help().version(!1).parse(),process.exit(0)}if(e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",zt.CLOUD_SHELL),vdi(a.getDebugMode()),await a.initialize(),a.getExperimentalAcp()?a.setUsageMode("sdk"):a.setUsageMode("interactive"),$s.loadCustomThemes(e.merged.customThemes),e.merged.theme&&($s.setActiveTheme(e.merged.theme)||console.warn(B.t("gemini.themeNotFound",{theme:e.merged.theme}))),!process.env.SANDBOX){let m=e.merged.autoConfigureMaxOldSpaceSize?IAa(a):[],g=a.getSandbox();if(g){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let A=TV(e.merged.selectedAuthType);if(A)throw new Error(A);await a.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(A){console.error(B.t("gemini.errorAuthenticating"),A),process.exit(1)}await bgi(g,m,a),process.exit(0)}else m.length>0&&(await DAa(m),process.exit(0))}if(e.merged.selectedAuthType===zt.LOGIN_WITH_IFLOW&&a.isBrowserLaunchSuppressed()&&await EL(e.merged.selectedAuthType,a),a.getExperimentalAcp())return a.getAcpPort()?await jgi(a,e,o,r,a.getAcpPort()):Lgi(a,e,o,r);let c=a.getQuestion(),u=[...await Cgi(),...await xgi(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume&&!n||process.stdin.isTTY&&c?.length===0){console.clear();let m=await kP();N2i(B2i(t),e);try{await Nli()}catch(C){a.getDebugMode()&&console.warn("Failed to detect/enable Kitty protocol:",C)}try{await a.setIdeModeAndSyncConnection(!0)}catch(C){console.error(B.t("gemini.failedToConnectToIdeServer"),C)}let g,A=async()=>{try{if(console.clear(),N2i(B2i(t),e),g)try{g.unmount(),await new Promise(D=>process.nextTick(D))}catch(D){console.error(B.t("gemini.errorDuringUnmount"),D)}let{executeSessionStartHooks:C}=await Promise.resolve().then(()=>(Zj(),Xj)),S=await C(a,"resume");g=YCe((0,bbe.jsx)(Wnr.default.StrictMode,{children:(0,bbe.jsx)(rnr,{instance:()=>g,config:a,settings:e,startupWarnings:u,version:m,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0,sessionStartContext:S})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:PXt(),maxFps:20})}catch(C){console.error(B.t("gemini.errorDuringResume"),C)}};process.on("SIGCONT",A),cbe(()=>{process.off("SIGCONT",A)});let y="startup";(r.continue||r.resume)&&(y="resume");let{executeSessionStartHooks:E}=await Promise.resolve().then(()=>(Zj(),Xj)),v=await E(a,y);g=YCe((0,bbe.jsx)(Wnr.default.StrictMode,{children:(0,bbe.jsx)(rnr,{instance:()=>g,config:a,settings:e,startupWarnings:u,version:m,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,sessionStartContext:v})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:PXt()}),e.merged.disableAutoUpdate||ert().then(C=>{P0i(C,e,a.getProjectRoot())}).catch(C=>{a.getDebugMode()&&console.error(B.t("gemini.updateCheckFailed"),C)}),cbe(()=>g.unmount());return}!process.stdin.isTTY&&!c&&(c+=await Agi()),c||(console.error(B.t("gemini.noInputProvidedViaStdin")),process.exit(1));let f=Math.random().toString(16).slice(2);NJ(a,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:c,prompt_id:f,auth_type:a.getContentGeneratorConfig()?.authType,prompt_length:c.length});let p=await NAa(a,o,e,r),h=r.outputFile||r.output_file;await Tgi(p,c,f,h),process.exit(0)}function N2i(t,e){if(!e.merged.hideWindowTitle){let r=(process.env.CLI_TITLE||`iFlow - ${t}`).replace(/[\x00-\x1F\x7F]/g,"");process.stdout.write(`\x1B]2;${r}\x07`),process.on("exit",()=>{process.stdout.write("\x1B]2;\x07")})}}async function NAa(t,e,r,n){let i=t;if(t.getApprovalMode()!==Yn.YOLO){let o=r.merged.excludeTools||[],s=[Md.Name,dh.Name,Uf.Name],a=[...new Set([...o,...s])],c={...r.merged,excludeTools:a},u={...n};i=await qV(c,e,t.getSessionId(),u),await i.initialize()}return await OAa(r.merged.selectedAuthType,i,r)}async function OAa(t,e,r){!t&&!process.env.GEMINI_API_KEY&&!mNe()&&(console.error(B.t("gemini.pleaseSetAuthMethod",{userSettingsPath:jj})),process.exit(1)),t||(mNe()?t=zt.IFLOW:t=zt.IFLOW);let n=TV(t);return n!=null&&(console.error(n),process.exit(1)),await e.refreshAuth(t,{apiKey:r.merged.apiKey,baseUrl:r.merged.baseUrl,modelName:r.merged.modelName}),e}O2i().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
|
|
5630
5630
|
/**
|
|
5631
5631
|
* @license
|
|
5632
5632
|
* Copyright 2025 Google LLC
|