@iflow-ai/iflow-cli 0.5.8-beta-20260211 → 0.5.10
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
CHANGED
|
@@ -484,13 +484,13 @@ ${o}
|
|
|
484
484
|
${s}
|
|
485
485
|
`}};BUe.PrometheusSerializer=QDt});var ntn=T(LUe=>{"use strict";Object.defineProperty(LUe,"__esModule",{value:!0});LUe.PrometheusExporter=void 0;var ube=(Xt(),bt(cr)),FGo=Ri(),qDt=cx(),UGo=Ae("http"),$Go=GDt(),jGo=Ae("url"),HDt=class t extends qDt.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:o=>({type:qDt.AggregationType.DEFAULT}),aggregationTemporalitySelector:o=>qDt.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,UGo.createServer)(this._requestHandler).unref(),this._serializer=new $Go.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,o=>{ube.diag.error(o),r(o)}):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,FGo.globalErrorHandler)(r):ube.diag.debug("Prometheus exporter was stopped"),e()})}):(ube.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},()=>{ube.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 jGo.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:o}=r;o.length&&ube.diag.error("PrometheusExporter: metrics collection errors",...o),e.end(this._serializer.serialize(n))},r=>{e.end(`# failed to export metrics: ${r}`)})};_notFound=e=>{e.statusCode=404,e.end()}};LUe.PrometheusExporter=HDt});var itn=T(Ore=>{"use strict";Object.defineProperty(Ore,"__esModule",{value:!0});Ore.PrometheusSerializer=Ore.PrometheusExporter=void 0;var QGo=ntn();Object.defineProperty(Ore,"PrometheusExporter",{enumerable:!0,get:function(){return QGo.PrometheusExporter}});var GGo=GDt();Object.defineProperty(Ore,"PrometheusSerializer",{enumerable:!0,get:function(){return GGo.PrometheusSerializer}})});var otn=T(MUe=>{"use strict";Object.defineProperty(MUe,"__esModule",{value:!0});MUe.VERSION=void 0;MUe.VERSION="0.206.0"});var atn=T(FUe=>{"use strict";Object.defineProperty(FUe,"__esModule",{value:!0});FUe.OTLPTraceExporter=void 0;var qGo=(ex(),bt(Zw)),HGo=otn(),VGo=dx(),stn=(uR(),bt(bB)),VDt=class extends qGo.OTLPExporterBase{constructor(e={}){super((0,stn.createOtlpHttpExportDelegate)((0,stn.convertLegacyHttpOptions)(e,"TRACES","v1/traces",{"User-Agent":`OTel-OTLP-Exporter-JavaScript/${HGo.VERSION}`,"Content-Type":"application/json"}),VGo.JsonTraceSerializer))}};FUe.OTLPTraceExporter=VDt});var utn=T(UUe=>{"use strict";Object.defineProperty(UUe,"__esModule",{value:!0});UUe.OTLPTraceExporter=void 0;var WGo=atn();Object.defineProperty(UUe,"OTLPTraceExporter",{enumerable:!0,get:function(){return WGo.OTLPTraceExporter}})});var ctn=T($Ue=>{"use strict";Object.defineProperty($Ue,"__esModule",{value:!0});$Ue.OTLPTraceExporter=void 0;var zGo=utn();Object.defineProperty($Ue,"OTLPTraceExporter",{enumerable:!0,get:function(){return zGo.OTLPTraceExporter}})});var ltn=T(jUe=>{"use strict";Object.defineProperty(jUe,"__esModule",{value:!0});jUe.OTLPTraceExporter=void 0;var YGo=ctn();Object.defineProperty(jUe,"OTLPTraceExporter",{enumerable:!0,get:function(){return YGo.OTLPTraceExporter}})});var dtn=T(QUe=>{"use strict";Object.defineProperty(QUe,"__esModule",{value:!0});QUe.OTLPTraceExporter=void 0;var mtn=CUe(),KGo=dx(),JGo=(ex(),bt(Zw)),WDt=class extends JGo.OTLPExporterBase{constructor(e={}){super((0,mtn.createOtlpGrpcExportDelegate)((0,mtn.convertLegacyOtlpGrpcOptions)(e,"TRACES"),KGo.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}};QUe.OTLPTraceExporter=WDt});var ftn=T(GUe=>{"use strict";Object.defineProperty(GUe,"__esModule",{value:!0});GUe.OTLPTraceExporter=void 0;var XGo=dtn();Object.defineProperty(GUe,"OTLPTraceExporter",{enumerable:!0,get:function(){return XGo.OTLPTraceExporter}})});var ptn=T(HUe=>{"use strict";Object.defineProperty(HUe,"__esModule",{value:!0});HUe.prepareSend=void 0;var zDt=(Xt(),bt(cr)),qUe=Ri(),ZGo=Ae("http"),eqo=Ae("https");function tqo(t,e){let r=new URL(t),n=Object.assign({method:"POST",headers:{"Content-Type":"application/json",...e}});return function(s,a){if(s.length===0)return zDt.diag.debug("Zipkin send with empty spans"),a({code:qUe.ExportResultCode.SUCCESS});let{request:u}=r.protocol==="http:"?ZGo:eqo,c=u(r,n,d=>{let f="";d.on("data",p=>{f+=p}),d.on("end",()=>{let p=d.statusCode||0;return zDt.diag.debug(`Zipkin response status code: ${p}, body: ${f}`),p<400?a({code:qUe.ExportResultCode.SUCCESS}):a({code:qUe.ExportResultCode.FAILED,error:new Error(`Got unexpected status code from zipkin: ${p}`)})})});c.on("error",d=>a({code:qUe.ExportResultCode.FAILED,error:d}));let m=JSON.stringify(s);zDt.diag.debug(`Zipkin request payload: ${m}`),c.write(m,"utf8"),c.end()}}HUe.prepareSend=tqo});var htn=T(VUe=>{"use strict";Object.defineProperty(VUe,"__esModule",{value:!0});VUe.prepareSend=void 0;var rqo=ptn();Object.defineProperty(VUe,"prepareSend",{enumerable:!0,get:function(){return rqo.prepareSend}})});var YDt=T(WUe=>{"use strict";Object.defineProperty(WUe,"__esModule",{value:!0});WUe.prepareSend=void 0;var nqo=htn();Object.defineProperty(WUe,"prepareSend",{enumerable:!0,get:function(){return nqo.prepareSend}})});var gtn=T(cbe=>{"use strict";Object.defineProperty(cbe,"__esModule",{value:!0});cbe.SpanKind=void 0;var iqo;(function(t){t.CLIENT="CLIENT",t.SERVER="SERVER",t.CONSUMER="CONSUMER",t.PRODUCER="PRODUCER"})(iqo=cbe.SpanKind||(cbe.SpanKind={}))});var ytn=T(R_=>{"use strict";Object.defineProperty(R_,"__esModule",{value:!0});R_._toZipkinAnnotations=R_._toZipkinTags=R_.toZipkinSpan=R_.defaultStatusErrorTagName=R_.defaultStatusCodeTagName=void 0;var UB=(Xt(),bt(cr)),KDt=Ri(),zUe=gtn(),oqo={[UB.SpanKind.CLIENT]:zUe.SpanKind.CLIENT,[UB.SpanKind.SERVER]:zUe.SpanKind.SERVER,[UB.SpanKind.CONSUMER]:zUe.SpanKind.CONSUMER,[UB.SpanKind.PRODUCER]:zUe.SpanKind.PRODUCER,[UB.SpanKind.INTERNAL]:void 0};R_.defaultStatusCodeTagName="otel.status_code";R_.defaultStatusErrorTagName="error";function sqo(t,e,r,n){return{traceId:t.spanContext().traceId,parentId:t.parentSpanContext?.spanId,name:t.name,id:t.spanContext().spanId,kind:oqo[t.kind],timestamp:(0,KDt.hrTimeToMicroseconds)(t.startTime),duration:Math.round((0,KDt.hrTimeToMicroseconds)(t.duration)),localEndpoint:{serviceName:e},tags:btn(t,r,n),annotations:t.events.length?Atn(t.events):void 0}}R_.toZipkinSpan=sqo;function btn({attributes:t,resource:e,status:r,droppedAttributesCount:n,droppedEventsCount:o,droppedLinksCount:s},a,u){let c={};for(let m of Object.keys(t))c[m]=String(t[m]);return r.code!==UB.SpanStatusCode.UNSET&&(c[a]=String(UB.SpanStatusCode[r.code])),r.code===UB.SpanStatusCode.ERROR&&r.message&&(c[u]=r.message),n&&(c["otel.dropped_attributes_count"]=String(n)),o&&(c["otel.dropped_events_count"]=String(o)),s&&(c["otel.dropped_links_count"]=String(s)),Object.keys(e.attributes).forEach(m=>c[m]=String(e.attributes[m])),c}R_._toZipkinTags=btn;function Atn(t){return t.map(e=>({timestamp:Math.round((0,KDt.hrTimeToMicroseconds)(e.time)),value:e.name}))}R_._toZipkinAnnotations=Atn});var _tn=T(YUe=>{"use strict";Object.defineProperty(YUe,"__esModule",{value:!0});YUe.prepareGetHeaders=void 0;function aqo(t){return function(){return t()}}YUe.prepareGetHeaders=aqo});var Stn=T(KUe=>{"use strict";Object.defineProperty(KUe,"__esModule",{value:!0});KUe.ZipkinExporter=void 0;var Etn=(Xt(),bt(cr)),vtn=Ri(),Ctn=YDt(),JDt=ytn(),XDt=(N1(),bt(yh)),uqo=_tn(),ZDt=class{DEFAULT_SERVICE_NAME="OpenTelemetry Service";_statusCodeTagName;_statusDescriptionTagName;_urlStr;_send;_getHeaders;_serviceName;_isShutdown;_sendingPromises=[];constructor(e={}){this._urlStr=e.url||((0,vtn.getStringFromEnv)("OTEL_EXPORTER_ZIPKIN_ENDPOINT")??"http://localhost:9411/api/v2/spans"),this._send=(0,Ctn.prepareSend)(this._urlStr,e.headers),this._serviceName=e.serviceName,this._statusCodeTagName=e.statusCodeTagName||JDt.defaultStatusCodeTagName,this._statusDescriptionTagName=e.statusDescriptionTagName||JDt.defaultStatusErrorTagName,this._isShutdown=!1,typeof e.getExportRequestHeaders=="function"?this._getHeaders=(0,uqo.prepareGetHeaders)(e.getExportRequestHeaders):this._beforeSend=function(){}}export(e,r){let n=String(this._serviceName||e[0].resource.attributes[XDt.ATTR_SERVICE_NAME]||this.DEFAULT_SERVICE_NAME);if(Etn.diag.debug("Zipkin exporter export"),this._isShutdown){setTimeout(()=>r({code:vtn.ExportResultCode.FAILED,error:new Error("Exporter has been shutdown")}));return}let o=new Promise(a=>{this._sendSpans(e,n,u=>{a(),r(u)})});this._sendingPromises.push(o);let s=()=>{let a=this._sendingPromises.indexOf(o);this._sendingPromises.splice(a,1)};o.then(s,s)}shutdown(){return Etn.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,Ctn.prepareSend)(this._urlStr,this._getHeaders()))}_sendSpans(e,r,n){let o=e.map(s=>(0,JDt.toZipkinSpan)(s,String(s.attributes[XDt.ATTR_SERVICE_NAME]||s.resource.attributes[XDt.ATTR_SERVICE_NAME]||r),this._statusCodeTagName,this._statusDescriptionTagName));return this._beforeSend(),this._send(o,s=>{if(n)return n(s)})}};KUe.ZipkinExporter=ZDt});var wtn=T(Nre=>{"use strict";Object.defineProperty(Nre,"__esModule",{value:!0});Nre.ZipkinExporter=Nre.prepareSend=void 0;var cqo=YDt();Object.defineProperty(Nre,"prepareSend",{enumerable:!0,get:function(){return cqo.prepareSend}});var lqo=Stn();Object.defineProperty(Nre,"ZipkinExporter",{enumerable:!0,get:function(){return lqo.ZipkinExporter}})});var eIt=T(JUe=>{"use strict";Object.defineProperty(JUe,"__esModule",{value:!0});JUe.B3_DEBUG_FLAG_KEY=void 0;var mqo=(Xt(),bt(cr));JUe.B3_DEBUG_FLAG_KEY=(0,mqo.createContextKey)("OpenTelemetry Context Key B3 Debug Flag")});var lbe=T(t8=>{"use strict";Object.defineProperty(t8,"__esModule",{value:!0});t8.X_B3_FLAGS=t8.X_B3_PARENT_SPAN_ID=t8.X_B3_SAMPLED=t8.X_B3_SPAN_ID=t8.X_B3_TRACE_ID=t8.B3_CONTEXT_HEADER=void 0;t8.B3_CONTEXT_HEADER="b3";t8.X_B3_TRACE_ID="x-b3-traceid";t8.X_B3_SPAN_ID="x-b3-spanid";t8.X_B3_SAMPLED="x-b3-sampled";t8.X_B3_PARENT_SPAN_ID="x-b3-parentspanid";t8.X_B3_FLAGS="x-b3-flags"});var Dtn=T(ZUe=>{"use strict";Object.defineProperty(ZUe,"__esModule",{value:!0});ZUe.B3MultiPropagator=void 0;var W4=(Xt(),bt(cr)),dqo=Ri(),xtn=eIt(),a6=lbe(),fqo=new Set([!0,"true","True","1",1]),pqo=new Set([!1,"false","False","0",0]);function hqo(t){return t===W4.TraceFlags.SAMPLED||t===W4.TraceFlags.NONE}function gqo(t){return Array.isArray(t)?t[0]:t}function XUe(t,e,r){let n=e.get(t,r);return gqo(n)}function bqo(t,e){let r=XUe(t,e,a6.X_B3_TRACE_ID);return typeof r=="string"?r.padStart(32,"0"):""}function Aqo(t,e){let r=XUe(t,e,a6.X_B3_SPAN_ID);return typeof r=="string"?r:""}function Ttn(t,e){return XUe(t,e,a6.X_B3_FLAGS)==="1"?"1":void 0}function yqo(t,e){let r=XUe(t,e,a6.X_B3_SAMPLED);if(Ttn(t,e)==="1"||fqo.has(r))return W4.TraceFlags.SAMPLED;if(r===void 0||pqo.has(r))return W4.TraceFlags.NONE}var tIt=class{inject(e,r,n){let o=W4.trace.getSpanContext(e);if(!o||!(0,W4.isSpanContextValid)(o)||(0,dqo.isTracingSuppressed)(e))return;let s=e.getValue(xtn.B3_DEBUG_FLAG_KEY);n.set(r,a6.X_B3_TRACE_ID,o.traceId),n.set(r,a6.X_B3_SPAN_ID,o.spanId),s==="1"?n.set(r,a6.X_B3_FLAGS,s):o.traceFlags!==void 0&&n.set(r,a6.X_B3_SAMPLED,(W4.TraceFlags.SAMPLED&o.traceFlags)===W4.TraceFlags.SAMPLED?"1":"0")}extract(e,r,n){let o=bqo(r,n),s=Aqo(r,n),a=yqo(r,n),u=Ttn(r,n);return(0,W4.isValidTraceId)(o)&&(0,W4.isValidSpanId)(s)&&hqo(a)?(e=e.setValue(xtn.B3_DEBUG_FLAG_KEY,u),W4.trace.setSpanContext(e,{traceId:o,spanId:s,isRemote:!0,traceFlags:a})):e}fields(){return[a6.X_B3_TRACE_ID,a6.X_B3_SPAN_ID,a6.X_B3_FLAGS,a6.X_B3_SAMPLED,a6.X_B3_PARENT_SPAN_ID]}};ZUe.B3MultiPropagator=tIt});var Rtn=T(e$e=>{"use strict";Object.defineProperty(e$e,"__esModule",{value:!0});e$e.B3SinglePropagator=void 0;var mq=(Xt(),bt(cr)),_qo=Ri(),Itn=eIt(),rIt=lbe(),Eqo=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,vqo="0".repeat(16),Cqo=new Set(["d","1"]),Sqo="d";function wqo(t){return t.length===32?t:`${vqo}${t}`}function xqo(t){return t&&Cqo.has(t)?mq.TraceFlags.SAMPLED:mq.TraceFlags.NONE}var nIt=class{inject(e,r,n){let o=mq.trace.getSpanContext(e);if(!o||!(0,mq.isSpanContextValid)(o)||(0,_qo.isTracingSuppressed)(e))return;let s=e.getValue(Itn.B3_DEBUG_FLAG_KEY)||o.traceFlags&1,a=`${o.traceId}-${o.spanId}-${s}`;n.set(r,rIt.B3_CONTEXT_HEADER,a)}extract(e,r,n){let o=n.get(r,rIt.B3_CONTEXT_HEADER),s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let a=s.match(Eqo);if(!a)return e;let[,u,c,m]=a,d=wqo(u);if(!(0,mq.isValidTraceId)(d)||!(0,mq.isValidSpanId)(c))return e;let f=xqo(m);return m===Sqo&&(e=e.setValue(Itn.B3_DEBUG_FLAG_KEY,m)),mq.trace.setSpanContext(e,{traceId:d,spanId:c,isRemote:!0,traceFlags:f})}fields(){return[rIt.B3_CONTEXT_HEADER]}};e$e.B3SinglePropagator=nIt});var iIt=T(mbe=>{"use strict";Object.defineProperty(mbe,"__esModule",{value:!0});mbe.B3InjectEncoding=void 0;var Tqo;(function(t){t[t.SINGLE_HEADER=0]="SINGLE_HEADER",t[t.MULTI_HEADER=1]="MULTI_HEADER"})(Tqo=mbe.B3InjectEncoding||(mbe.B3InjectEncoding={}))});var ktn=T(t$e=>{"use strict";Object.defineProperty(t$e,"__esModule",{value:!0});t$e.B3Propagator=void 0;var Dqo=Ri(),Iqo=Dtn(),Rqo=Rtn(),kqo=lbe(),Oqo=iIt(),oIt=class{_b3MultiPropagator=new Iqo.B3MultiPropagator;_b3SinglePropagator=new Rqo.B3SinglePropagator;_inject;_fields;constructor(e={}){e.injectEncoding===Oqo.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,Dqo.isTracingSuppressed)(e)||this._inject(e,r,n)}extract(e,r,n){let o=n.get(r,kqo.B3_CONTEXT_HEADER);return(Array.isArray(o)?o[0]:o)?this._b3SinglePropagator.extract(e,r,n):this._b3MultiPropagator.extract(e,r,n)}fields(){return this._fields}};t$e.B3Propagator=oIt});var Otn=T(Ih=>{"use strict";Object.defineProperty(Ih,"__esModule",{value:!0});Ih.B3InjectEncoding=Ih.X_B3_TRACE_ID=Ih.X_B3_SPAN_ID=Ih.X_B3_SAMPLED=Ih.X_B3_PARENT_SPAN_ID=Ih.X_B3_FLAGS=Ih.B3_CONTEXT_HEADER=Ih.B3Propagator=void 0;var Nqo=ktn();Object.defineProperty(Ih,"B3Propagator",{enumerable:!0,get:function(){return Nqo.B3Propagator}});var Pre=lbe();Object.defineProperty(Ih,"B3_CONTEXT_HEADER",{enumerable:!0,get:function(){return Pre.B3_CONTEXT_HEADER}});Object.defineProperty(Ih,"X_B3_FLAGS",{enumerable:!0,get:function(){return Pre.X_B3_FLAGS}});Object.defineProperty(Ih,"X_B3_PARENT_SPAN_ID",{enumerable:!0,get:function(){return Pre.X_B3_PARENT_SPAN_ID}});Object.defineProperty(Ih,"X_B3_SAMPLED",{enumerable:!0,get:function(){return Pre.X_B3_SAMPLED}});Object.defineProperty(Ih,"X_B3_SPAN_ID",{enumerable:!0,get:function(){return Pre.X_B3_SPAN_ID}});Object.defineProperty(Ih,"X_B3_TRACE_ID",{enumerable:!0,get:function(){return Pre.X_B3_TRACE_ID}});var Pqo=iIt();Object.defineProperty(Ih,"B3InjectEncoding",{enumerable:!0,get:function(){return Pqo.B3InjectEncoding}})});var Ntn=T(z4=>{"use strict";Object.defineProperty(z4,"__esModule",{value:!0});z4.JaegerPropagator=z4.UBER_BAGGAGE_HEADER_PREFIX=z4.UBER_TRACE_ID_HEADER=void 0;var dq=(Xt(),bt(cr)),Bqo=Ri();z4.UBER_TRACE_ID_HEADER="uber-trace-id";z4.UBER_BAGGAGE_HEADER_PREFIX="uberctx";var sIt=class{_jaegerTraceHeader;_jaegerBaggageHeaderPrefix;constructor(e){typeof e=="string"?(this._jaegerTraceHeader=e,this._jaegerBaggageHeaderPrefix=z4.UBER_BAGGAGE_HEADER_PREFIX):(this._jaegerTraceHeader=e?.customTraceHeader||z4.UBER_TRACE_ID_HEADER,this._jaegerBaggageHeaderPrefix=e?.customBaggageHeaderPrefix||z4.UBER_BAGGAGE_HEADER_PREFIX)}inject(e,r,n){let o=dq.trace.getSpanContext(e),s=dq.propagation.getBaggage(e);if(o&&(0,Bqo.isTracingSuppressed)(e)===!1){let a=`0${(o.traceFlags||dq.TraceFlags.NONE).toString(16)}`;n.set(r,this._jaegerTraceHeader,`${o.traceId}:${o.spanId}:0:${a}`)}if(s)for(let[a,u]of s.getAllEntries())n.set(r,`${this._jaegerBaggageHeaderPrefix}-${a}`,encodeURIComponent(u.value))}extract(e,r,n){let o=n.get(r,this._jaegerTraceHeader),s=Array.isArray(o)?o[0]:o,a=n.keys(r).filter(m=>m.startsWith(`${this._jaegerBaggageHeaderPrefix}-`)).map(m=>{let d=n.get(r,m);return{key:m.substring(this._jaegerBaggageHeaderPrefix.length+1),value:Array.isArray(d)?d[0]:d}}),u=e;if(typeof s=="string"){let m=Mqo(s);m&&(u=dq.trace.setSpanContext(u,m))}if(a.length===0)return u;let c=dq.propagation.getBaggage(e)??dq.propagation.createBaggage();for(let m of a)m.value!==void 0&&(c=c.setEntry(m.key,{value:decodeURIComponent(m.value)}));return u=dq.propagation.setBaggage(u,c),u}fields(){return[this._jaegerTraceHeader]}};z4.JaegerPropagator=sIt;var Lqo=/^[0-9a-f]{1,2}$/i;function Mqo(t){let e=decodeURIComponent(t).split(":");if(e.length!==4)return null;let[r,n,,o]=e,s=r.padStart(32,"0"),a=n.padStart(16,"0"),u=Lqo.test(o)?parseInt(o,16)&1:1;return{traceId:s,spanId:a,isRemote:!0,traceFlags:u}}});var Ptn=T($B=>{"use strict";Object.defineProperty($B,"__esModule",{value:!0});$B.UBER_TRACE_ID_HEADER=$B.UBER_BAGGAGE_HEADER_PREFIX=$B.JaegerPropagator=void 0;var aIt=Ntn();Object.defineProperty($B,"JaegerPropagator",{enumerable:!0,get:function(){return aIt.JaegerPropagator}});Object.defineProperty($B,"UBER_BAGGAGE_HEADER_PREFIX",{enumerable:!0,get:function(){return aIt.UBER_BAGGAGE_HEADER_PREFIX}});Object.defineProperty($B,"UBER_TRACE_ID_HEADER",{enumerable:!0,get:function(){return aIt.UBER_TRACE_ID_HEADER}})});var Ftn=T(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});k_.getPropagatorFromEnv=k_.getSpanProcessorsFromEnv=k_.getOtlpProtocolFromEnv=k_.filterBlanksAndNulls=k_.getResourceDetectorsFromEnv=void 0;var jB=(Xt(),bt(cr)),QB=Ri(),Btn=d4t(),Fqo=ltn(),Uqo=ftn(),$qo=wtn(),dbe=Tte(),r$e=iMe(),uIt=Otn(),jqo=Ptn(),Qqo="env",Gqo="host",qqo="os",Hqo="process",Vqo="serviceinstance";function Wqo(){let t=new Map([[Qqo,dbe.envDetector],[Gqo,dbe.hostDetector],[qqo,dbe.osDetector],[Vqo,dbe.serviceInstanceIdDetector],[Hqo,dbe.processDetector]]),e=(0,QB.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||jB.diag.warn(`Invalid resource detector "${r}" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`),n||[]})}k_.getResourceDetectorsFromEnv=Wqo;function Ltn(t){return t.map(e=>e.trim()).filter(e=>e!=="null"&&e!=="")}k_.filterBlanksAndNulls=Ltn;function Mtn(){return(0,QB.getStringFromEnv)("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL")??(0,QB.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL")??"http/protobuf"}k_.getOtlpProtocolFromEnv=Mtn;function zqo(){let t=Mtn();switch(t){case"grpc":return new Uqo.OTLPTraceExporter;case"http/json":return new Fqo.OTLPTraceExporter;case"http/protobuf":return new Btn.OTLPTraceExporter;default:return jB.diag.warn(`Unsupported OTLP traces protocol: ${t}. Using http/protobuf.`),new Btn.OTLPTraceExporter}}function Yqo(){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 Kqo(){let t=new Map([["otlp",()=>zqo()],["zipkin",()=>new $qo.ZipkinExporter],["console",()=>new r$e.ConsoleSpanExporter],["jaeger",()=>Yqo()]]),e=[],r=[],n=Ltn(Array.from(new Set((0,QB.getStringListFromEnv)("OTEL_TRACES_EXPORTER"))));if(n[0]==="none")return jB.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.'),[];n.length===0?(jB.diag.debug("OTEL_TRACES_EXPORTER is empty. Using default otlp exporter."),n=["otlp"]):n.length>1&&n.includes("none")&&(jB.diag.warn('OTEL_TRACES_EXPORTER contains "none" along with other exporters. Using default otlp exporter.'),n=["otlp"]);for(let o of n){let s=t.get(o)?.();s?e.push(s):jB.diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${o}.`)}for(let o of e)o instanceof r$e.ConsoleSpanExporter?r.push(new r$e.SimpleSpanProcessor(o)):r.push(new r$e.BatchSpanProcessor(o));return e.length===0&&jB.diag.warn("Unable to set up trace exporter(s) due to invalid exporter and/or protocol values."),r}k_.getSpanProcessorsFromEnv=Kqo;function Jqo(){let t=(0,QB.getStringListFromEnv)("OTEL_PROPAGATORS");if(t==null)return;let e=new Map([["tracecontext",()=>new QB.W3CTraceContextPropagator],["baggage",()=>new QB.W3CBaggagePropagator],["b3",()=>new uIt.B3Propagator],["b3multi",()=>new uIt.B3Propagator({injectEncoding:uIt.B3InjectEncoding.MULTI_HEADER})],["jaeger",()=>new jqo.JaegerPropagator]]),r=Array.from(new Set(t)),o=r.map(s=>{let a=e.get(s)?.();if(!a){jB.diag.warn(`Propagator "${s}" requested through environment variable is unavailable.`);return}return a}).reduce((s,a)=>(a&&s.push(a),s),[]);return o.length===0?null:r.length===1?o[0]:new QB.CompositePropagator({propagators:o})}k_.getPropagatorFromEnv=Jqo});var jtn=T(n$e=>{"use strict";Object.defineProperty(n$e,"__esModule",{value:!0});n$e.NodeSDK=void 0;var o2=(Xt(),bt(cr)),Xqo=Cte(),Zqo=SKr(),Bre=Tte(),fbe=J4t(),eHo=_4t(),tHo=Hen(),cIt=Jen(),rHo=etn(),Utn=A4t(),nHo=LPe(),iHo=itn(),fq=cx(),oHo=iMe(),sHo=NLe(),aHo=(N1(),bt(yh)),GB=Ri(),lIt=Ftn();function $tn(t,e){return parseInt(process.env[t]||"")||e}function uHo(){let t=[],e=(0,GB.getStringListFromEnv)("OTEL_METRICS_EXPORTER");return e?(e.length===0&&o2.diag.debug("OTEL_METRICS_EXPORTER is empty. Using default otlp exporter."),e.includes("none")?(o2.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(),o=$tn("OTEL_METRIC_EXPORT_INTERVAL",6e4),s=$tn("OTEL_METRIC_EXPORT_TIMEOUT",3e4);switch(n){case"grpc":t.push(new fq.PeriodicExportingMetricReader({exporter:new rHo.OTLPMetricExporter,exportIntervalMillis:o,exportTimeoutMillis:s}));break;case"http/json":t.push(new fq.PeriodicExportingMetricReader({exporter:new nHo.OTLPMetricExporter,exportIntervalMillis:o,exportTimeoutMillis:s}));break;case"http/protobuf":t.push(new fq.PeriodicExportingMetricReader({exporter:new Utn.OTLPMetricExporter,exportIntervalMillis:o,exportTimeoutMillis:s}));break;default:o2.diag.warn(`Unsupported OTLP metrics protocol: "${n}". Using http/protobuf.`),t.push(new fq.PeriodicExportingMetricReader({exporter:new Utn.OTLPMetricExporter,exportIntervalMillis:o,exportTimeoutMillis:s}))}}else r==="console"?t.push(new fq.PeriodicExportingMetricReader({exporter:new fq.ConsoleMetricExporter})):r==="prometheus"?t.push(new iHo.PrometheusExporter):o2.diag.warn(`Unsupported OTEL_METRICS_EXPORTER value: "${r}". Supported values are: otlp, console, prometheus, none.`)}),t)):t}var mIt=class{_tracerProviderConfig;_loggerProviderConfig;_meterProviderConfig;_instrumentations;_resource;_resourceDetectors;_autoDetectResources;_tracerProvider;_loggerProvider;_meterProvider;_serviceName;_configuration;_disabled;constructor(e={}){(0,GB.getBooleanFromEnv)("OTEL_SDK_DISABLED")&&(this._disabled=!0);let r=(0,GB.getStringFromEnv)("OTEL_LOG_LEVEL");if(r!=null&&o2.diag.setLogger(new o2.DiagConsoleLogger,{logLevel:(0,GB.diagLogLevelFromString)(r)}),this._configuration=e,this._resource=e.resource??(0,Bre.defaultResource)(),this._autoDetectResources=e.autoDetectResources??!0,this._autoDetectResources?e.resourceDetectors!=null?this._resourceDetectors=e.resourceDetectors:(0,GB.getStringFromEnv)("OTEL_NODE_RESOURCE_DETECTORS")?this._resourceDetectors=(0,lIt.getResourceDetectorsFromEnv)():this._resourceDetectors=[Bre.envDetector,Bre.processDetector,Bre.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&&o2.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");let o=e.spanProcessor??new oHo.BatchSpanProcessor(e.traceExporter),s=e.spanProcessors??[o];this._tracerProviderConfig={tracerConfig:n,spanProcessors:s,contextManager:e.contextManager,textMapPropagator:e.textMapPropagator}}if(e.logRecordProcessors?this._loggerProviderConfig={logRecordProcessors:e.logRecordProcessors}:e.logRecordProcessor?(this._loggerProviderConfig={logRecordProcessors:[e.logRecordProcessor]},o2.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],o2.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,Zqo.registerInstrumentations)({instrumentations:this._instrumentations}),this._autoDetectResources){let n={detectors:this._resourceDetectors};this._resource=this._resource.merge((0,Bre.detectResources)(n))}this._resource=this._serviceName===void 0?this._resource:this._resource.merge((0,Bre.resourceFromAttributes)({[aHo.ATTR_SERVICE_NAME]:this._serviceName}));let e=this._tracerProviderConfig?this._tracerProviderConfig.spanProcessors:(0,lIt.getSpanProcessorsFromEnv)();if(this._tracerProvider=new sHo.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,lIt.getPropagatorFromEnv)()}),this._loggerProviderConfig){let n=new fbe.LoggerProvider({resource:this._resource,processors:this._loggerProviderConfig.logRecordProcessors});this._loggerProvider=n,Xqo.logs.setGlobalLoggerProvider(n)}let r=uHo();if(this._meterProviderConfig||r.length>0){let n=[];this._meterProviderConfig?.readers&&n.push(...this._meterProviderConfig.readers),n.length===0&&r.forEach(s=>n.push(s));let o=new fq.MeterProvider({resource:this._resource,views:this._meterProviderConfig?.views??[],readers:n});this._meterProvider=o,o2.metrics.setGlobalMeterProvider(o);for(let s of this._instrumentations)s.setMeterProvider(o2.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,GB.getStringListFromEnv)("OTEL_LOGS_EXPORTER")??[];if(e.length===0&&(o2.diag.debug("OTEL_LOGS_EXPORTER is empty. Using default otlp exporter."),e.push("otlp")),e.includes("none")){o2.diag.info('OTEL_LOGS_EXPORTER contains "none". Logger provider will not be initialized.');return}let r=[];e.forEach(n=>{if(n==="otlp"){let o=((0,GB.getStringFromEnv)("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL")??(0,GB.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL"))?.trim();switch(o){case"grpc":r.push(new tHo.OTLPLogExporter);break;case"http/json":r.push(new eHo.OTLPLogExporter);break;case"http/protobuf":r.push(new cIt.OTLPLogExporter);break;case void 0:case"":r.push(new cIt.OTLPLogExporter);break;default:o2.diag.warn(`Unsupported OTLP logs protocol: "${o}". Using http/protobuf.`),r.push(new cIt.OTLPLogExporter)}}else n==="console"?r.push(new fbe.ConsoleLogRecordExporter):o2.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 fbe.ConsoleLogRecordExporter?new fbe.SimpleLogRecordProcessor(n):new fbe.BatchLogRecordProcessor(n))})}};n$e.NodeSDK=mIt});var Qtn=T(Df=>{"use strict";Object.defineProperty(Df,"__esModule",{value:!0});Df.NodeSDK=Df.tracing=Df.resources=Df.node=Df.metrics=Df.logs=Df.core=Df.contextBase=Df.api=void 0;Df.api=(Xt(),bt(cr));Df.contextBase=(Xt(),bt(cr));Df.core=Ri();Df.logs=J4t();Df.metrics=cx();Df.node=NLe();Df.resources=Tte();Df.tracing=iMe();var cHo=jtn();Object.defineProperty(Df,"NodeSDK",{enumerable:!0,get:function(){return cHo.NodeSDK}})});function lHo(t,e){return new Promise((r,n)=>{let o=setTimeout(()=>{n(new Error(`Operation timed out after ${e} ms`))},e);t.then(r).catch(n).finally(()=>clearTimeout(o))})}var Gtn,i$e,qtn=j(()=>{"use strict";Gtn=Se(cx(),1);i$e=class extends Gtn.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(),o=this._alignSeconds.find(u=>u>=r),s;o!==void 0?s=(o-r)*1e3-n:(s=(60-r)*1e3-n,o=0),s=Math.max(0,s);let a=setTimeout(()=>{this._alignedExport(),this._interval=setInterval(()=>{this._alignedExport()},this._intervalSeconds*1e3);let u=this._interval;typeof u!="number"&&u?.unref&&u.unref()},s);typeof a!="number"&&a?.unref&&a.unref()}async _alignedExport(){let e=this._exportTimeout;try{await lHo(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 pbe=T(qB=>{"use strict";Object.defineProperty(qB,"__esModule",{value:!0});qB.isTracingSuppressed=qB.unsuppressTracing=qB.suppressTracing=void 0;var mHo=(Xt(),bt(cr)),dIt=(0,mHo.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function dHo(t){return t.setValue(dIt,!0)}qB.suppressTracing=dHo;function fHo(t){return t.deleteValue(dIt)}qB.unsuppressTracing=fHo;function pHo(t){return t.getValue(dIt)===!0}qB.isTracingSuppressed=pHo});var fIt=T(bb=>{"use strict";Object.defineProperty(bb,"__esModule",{value:!0});bb.BAGGAGE_MAX_TOTAL_LENGTH=bb.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=bb.BAGGAGE_MAX_NAME_VALUE_PAIRS=bb.BAGGAGE_HEADER=bb.BAGGAGE_ITEMS_SEPARATOR=bb.BAGGAGE_PROPERTIES_SEPARATOR=bb.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;bb.BAGGAGE_KEY_PAIR_SEPARATOR="=";bb.BAGGAGE_PROPERTIES_SEPARATOR=";";bb.BAGGAGE_ITEMS_SEPARATOR=",";bb.BAGGAGE_HEADER="baggage";bb.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;bb.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;bb.BAGGAGE_MAX_TOTAL_LENGTH=8192});var pIt=T(jx=>{"use strict";Object.defineProperty(jx,"__esModule",{value:!0});jx.parseKeyPairsIntoRecord=jx.parsePairKeyValue=jx.getKeyPairs=jx.serializeKeyPairs=void 0;var hHo=(Xt(),bt(cr)),Lre=fIt();function gHo(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?Lre.BAGGAGE_ITEMS_SEPARATOR:""}${r}`;return n.length>Lre.BAGGAGE_MAX_TOTAL_LENGTH?e:n},"")}jx.serializeKeyPairs=gHo;function bHo(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=Lre.BAGGAGE_PROPERTIES_SEPARATOR+r.metadata.toString()),n})}jx.getKeyPairs=bHo;function Htn(t){if(!t)return;let e=t.indexOf(Lre.BAGGAGE_PROPERTIES_SEPARATOR),r=e===-1?t:t.substring(0,e),n=r.indexOf(Lre.BAGGAGE_KEY_PAIR_SEPARATOR);if(n<=0)return;let o=r.substring(0,n).trim(),s=r.substring(n+1).trim();if(!o||!s)return;let a,u;try{a=decodeURIComponent(o),u=decodeURIComponent(s)}catch{return}let c;if(e!==-1&&e<t.length-1){let m=t.substring(e+1);c=(0,hHo.baggageEntryMetadataFromString)(m)}return{key:a,value:u,metadata:c}}jx.parsePairKeyValue=Htn;function AHo(t){let e={};return typeof t=="string"&&t.length>0&&t.split(Lre.BAGGAGE_ITEMS_SEPARATOR).forEach(r=>{let n=Htn(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}jx.parseKeyPairsIntoRecord=AHo});var Vtn=T(o$e=>{"use strict";Object.defineProperty(o$e,"__esModule",{value:!0});o$e.W3CBaggagePropagator=void 0;var hIt=(Xt(),bt(cr)),yHo=pbe(),pq=fIt(),gIt=pIt(),bIt=class{inject(e,r,n){let o=hIt.propagation.getBaggage(e);if(!o||(0,yHo.isTracingSuppressed)(e))return;let s=(0,gIt.getKeyPairs)(o).filter(u=>u.length<=pq.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,pq.BAGGAGE_MAX_NAME_VALUE_PAIRS),a=(0,gIt.serializeKeyPairs)(s);a.length>0&&n.set(r,pq.BAGGAGE_HEADER,a)}extract(e,r,n){let o=n.get(r,pq.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(pq.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let a={};return s.length===0||(s.split(pq.BAGGAGE_ITEMS_SEPARATOR).forEach(c=>{let m=(0,gIt.parsePairKeyValue)(c);if(m){let d={value:m.value};m.metadata&&(d.metadata=m.metadata),a[m.key]=d}}),Object.entries(a).length===0)?e:hIt.propagation.setBaggage(e,hIt.propagation.createBaggage(a))}fields(){return[pq.BAGGAGE_HEADER]}};o$e.W3CBaggagePropagator=bIt});var Wtn=T(s$e=>{"use strict";Object.defineProperty(s$e,"__esModule",{value:!0});s$e.AnchoredClock=void 0;var AIt=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}};s$e.AnchoredClock=AIt});var Xtn=T(HB=>{"use strict";Object.defineProperty(HB,"__esModule",{value:!0});HB.isAttributeValue=HB.isAttributeKey=HB.sanitizeAttributes=void 0;var ztn=(Xt(),bt(cr));function _Ho(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(!Ytn(r)){ztn.diag.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!Ktn(n)){ztn.diag.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}HB.sanitizeAttributes=_Ho;function Ytn(t){return typeof t=="string"&&t!==""}HB.isAttributeKey=Ytn;function Ktn(t){return t==null?!0:Array.isArray(t)?EHo(t):Jtn(typeof t)}HB.isAttributeValue=Ktn;function EHo(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(Jtn(n)){e=n;continue}return!1}return!1}}return!0}function Jtn(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var yIt=T(a$e=>{"use strict";Object.defineProperty(a$e,"__esModule",{value:!0});a$e.loggingErrorHandler=void 0;var vHo=(Xt(),bt(cr));function CHo(){return t=>{vHo.diag.error(SHo(t))}}a$e.loggingErrorHandler=CHo;function SHo(t){return typeof t=="string"?t:JSON.stringify(wHo(t))}function wHo(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let o=r[n];o&&(e[n]=String(o))}),r=Object.getPrototypeOf(r);return e}});var ern=T(Mre=>{"use strict";Object.defineProperty(Mre,"__esModule",{value:!0});Mre.globalErrorHandler=Mre.setGlobalErrorHandler=void 0;var xHo=yIt(),Ztn=(0,xHo.loggingErrorHandler)();function THo(t){Ztn=t}Mre.setGlobalErrorHandler=THo;function DHo(t){try{Ztn(t)}catch{}}Mre.globalErrorHandler=DHo});var irn=T(Qx=>{"use strict";Object.defineProperty(Qx,"__esModule",{value:!0});Qx.getStringListFromEnv=Qx.getBooleanFromEnv=Qx.getStringFromEnv=Qx.getNumberFromEnv=void 0;var trn=(Xt(),bt(cr)),rrn=Ae("util");function IHo(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){trn.diag.warn(`Unknown value ${(0,rrn.inspect)(e)} for ${t}, expected a number, using defaults`);return}return r}Qx.getNumberFromEnv=IHo;function nrn(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}Qx.getStringFromEnv=nrn;function RHo(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||trn.diag.warn(`Unknown value ${(0,rrn.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}Qx.getBooleanFromEnv=RHo;function kHo(t){return nrn(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}Qx.getStringListFromEnv=kHo});var orn=T(u$e=>{"use strict";Object.defineProperty(u$e,"__esModule",{value:!0});u$e._globalThis=void 0;u$e._globalThis=globalThis});var srn=T(c$e=>{"use strict";Object.defineProperty(c$e,"__esModule",{value:!0});c$e.VERSION=void 0;c$e.VERSION="2.3.0"});var arn=T(l$e=>{"use strict";Object.defineProperty(l$e,"__esModule",{value:!0});l$e.ATTR_PROCESS_RUNTIME_NAME=void 0;l$e.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var urn=T(d$e=>{"use strict";Object.defineProperty(d$e,"__esModule",{value:!0});d$e.SDK_INFO=void 0;var OHo=srn(),m$e=(N1(),bt(yh)),NHo=arn();d$e.SDK_INFO={[m$e.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[NHo.ATTR_PROCESS_RUNTIME_NAME]:"node",[m$e.ATTR_TELEMETRY_SDK_LANGUAGE]:m$e.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[m$e.ATTR_TELEMETRY_SDK_VERSION]:OHo.VERSION}});var crn=T(Ab=>{"use strict";Object.defineProperty(Ab,"__esModule",{value:!0});Ab.otperformance=Ab.SDK_INFO=Ab._globalThis=Ab.getStringListFromEnv=Ab.getNumberFromEnv=Ab.getBooleanFromEnv=Ab.getStringFromEnv=void 0;var f$e=irn();Object.defineProperty(Ab,"getStringFromEnv",{enumerable:!0,get:function(){return f$e.getStringFromEnv}});Object.defineProperty(Ab,"getBooleanFromEnv",{enumerable:!0,get:function(){return f$e.getBooleanFromEnv}});Object.defineProperty(Ab,"getNumberFromEnv",{enumerable:!0,get:function(){return f$e.getNumberFromEnv}});Object.defineProperty(Ab,"getStringListFromEnv",{enumerable:!0,get:function(){return f$e.getStringListFromEnv}});var PHo=orn();Object.defineProperty(Ab,"_globalThis",{enumerable:!0,get:function(){return PHo._globalThis}});var BHo=urn();Object.defineProperty(Ab,"SDK_INFO",{enumerable:!0,get:function(){return BHo.SDK_INFO}});Ab.otperformance=performance});var _It=T(yb=>{"use strict";Object.defineProperty(yb,"__esModule",{value:!0});yb.getStringListFromEnv=yb.getNumberFromEnv=yb.getStringFromEnv=yb.getBooleanFromEnv=yb.otperformance=yb._globalThis=yb.SDK_INFO=void 0;var hq=crn();Object.defineProperty(yb,"SDK_INFO",{enumerable:!0,get:function(){return hq.SDK_INFO}});Object.defineProperty(yb,"_globalThis",{enumerable:!0,get:function(){return hq._globalThis}});Object.defineProperty(yb,"otperformance",{enumerable:!0,get:function(){return hq.otperformance}});Object.defineProperty(yb,"getBooleanFromEnv",{enumerable:!0,get:function(){return hq.getBooleanFromEnv}});Object.defineProperty(yb,"getStringFromEnv",{enumerable:!0,get:function(){return hq.getStringFromEnv}});Object.defineProperty(yb,"getNumberFromEnv",{enumerable:!0,get:function(){return hq.getNumberFromEnv}});Object.defineProperty(yb,"getStringListFromEnv",{enumerable:!0,get:function(){return hq.getStringListFromEnv}})});var frn=T(U0=>{"use strict";Object.defineProperty(U0,"__esModule",{value:!0});U0.addHrTimes=U0.isTimeInput=U0.isTimeInputHrTime=U0.hrTimeToMicroseconds=U0.hrTimeToMilliseconds=U0.hrTimeToNanoseconds=U0.hrTimeToTimeStamp=U0.hrTimeDuration=U0.timeInputToHrTime=U0.hrTime=U0.getTimeOrigin=U0.millisToHrTime=void 0;var p$e=_It(),lrn=9,LHo=6,MHo=Math.pow(10,LHo),h$e=Math.pow(10,lrn);function hbe(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*MHo);return[r,n]}U0.millisToHrTime=hbe;function FHo(){return p$e.otperformance.timeOrigin}U0.getTimeOrigin=FHo;function mrn(t){let e=hbe(p$e.otperformance.timeOrigin),r=hbe(typeof t=="number"?t:p$e.otperformance.now());return drn(e,r)}U0.hrTime=mrn;function UHo(t){if(EIt(t))return t;if(typeof t=="number")return t<p$e.otperformance.timeOrigin?mrn(t):hbe(t);if(t instanceof Date)return hbe(t.getTime());throw TypeError("Invalid input type")}U0.timeInputToHrTime=UHo;function $Ho(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=h$e),[r,n]}U0.hrTimeDuration=$Ho;function jHo(t){let e=lrn,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}U0.hrTimeToTimeStamp=jHo;function QHo(t){return t[0]*h$e+t[1]}U0.hrTimeToNanoseconds=QHo;function GHo(t){return t[0]*1e3+t[1]/1e6}U0.hrTimeToMilliseconds=GHo;function qHo(t){return t[0]*1e6+t[1]/1e3}U0.hrTimeToMicroseconds=qHo;function EIt(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}U0.isTimeInputHrTime=EIt;function HHo(t){return EIt(t)||typeof t=="number"||t instanceof Date}U0.isTimeInput=HHo;function drn(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=h$e&&(r[1]-=h$e,r[0]+=1),r}U0.addHrTimes=drn});var prn=T(g$e=>{"use strict";Object.defineProperty(g$e,"__esModule",{value:!0});g$e.unrefTimer=void 0;function VHo(t){typeof t!="number"&&t.unref()}g$e.unrefTimer=VHo});var hrn=T(gbe=>{"use strict";Object.defineProperty(gbe,"__esModule",{value:!0});gbe.ExportResultCode=void 0;var WHo;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(WHo=gbe.ExportResultCode||(gbe.ExportResultCode={}))});var brn=T(b$e=>{"use strict";Object.defineProperty(b$e,"__esModule",{value:!0});b$e.CompositePropagator=void 0;var grn=(Xt(),bt(cr)),vIt=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 o of this._propagators)try{o.inject(e,r,n)}catch(s){grn.diag.warn(`Failed to inject with ${o.constructor.name}. Err: ${s.message}`)}}extract(e,r,n){return this._propagators.reduce((o,s)=>{try{return s.extract(o,r,n)}catch(a){grn.diag.warn(`Failed to extract with ${s.constructor.name}. Err: ${a.message}`)}return o},e)}fields(){return this._fields.slice()}};b$e.CompositePropagator=vIt});var Arn=T(Fre=>{"use strict";Object.defineProperty(Fre,"__esModule",{value:!0});Fre.validateValue=Fre.validateKey=void 0;var CIt="[_0-9a-z-*/]",zHo=`[a-z]${CIt}{0,255}`,YHo=`[a-z0-9]${CIt}{0,240}@[a-z]${CIt}{0,13}`,KHo=new RegExp(`^(?:${zHo}|${YHo})$`),JHo=/^[ -~]{0,255}[!-~]$/,XHo=/,|=/;function ZHo(t){return KHo.test(t)}Fre.validateKey=ZHo;function eVo(t){return JHo.test(t)&&!XHo.test(t)}Fre.validateValue=eVo});var wIt=T(A$e=>{"use strict";Object.defineProperty(A$e,"__esModule",{value:!0});A$e.TraceState=void 0;var yrn=Arn(),_rn=32,tVo=512,Ern=",",vrn="=",SIt=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+vrn+this.get(r)),e),[]).join(Ern)}_parse(e){e.length>tVo||(this._internalState=e.split(Ern).reverse().reduce((r,n)=>{let o=n.trim(),s=o.indexOf(vrn);if(s!==-1){let a=o.slice(0,s),u=o.slice(s+1,n.length);(0,yrn.validateKey)(a)&&(0,yrn.validateValue)(u)&&r.set(a,u)}return r},new Map),this._internalState.size>_rn&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,_rn))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};A$e.TraceState=SIt});var Srn=T(_b=>{"use strict";Object.defineProperty(_b,"__esModule",{value:!0});_b.W3CTraceContextPropagator=_b.parseTraceParent=_b.TRACE_STATE_HEADER=_b.TRACE_PARENT_HEADER=void 0;var y$e=(Xt(),bt(cr)),rVo=pbe(),nVo=wIt();_b.TRACE_PARENT_HEADER="traceparent";_b.TRACE_STATE_HEADER="tracestate";var iVo="00",oVo="(?!ff)[\\da-f]{2}",sVo="(?![0]{32})[\\da-f]{32}",aVo="(?![0]{16})[\\da-f]{16}",uVo="[\\da-f]{2}",cVo=new RegExp(`^\\s?(${oVo})-(${sVo})-(${aVo})-(${uVo})(-.*)?\\s?$`);function Crn(t){let e=cVo.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}_b.parseTraceParent=Crn;var xIt=class{inject(e,r,n){let o=y$e.trace.getSpanContext(e);if(!o||(0,rVo.isTracingSuppressed)(e)||!(0,y$e.isSpanContextValid)(o))return;let s=`${iVo}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||y$e.TraceFlags.NONE).toString(16)}`;n.set(r,_b.TRACE_PARENT_HEADER,s),o.traceState&&n.set(r,_b.TRACE_STATE_HEADER,o.traceState.serialize())}extract(e,r,n){let o=n.get(r,_b.TRACE_PARENT_HEADER);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let a=Crn(s);if(!a)return e;a.isRemote=!0;let u=n.get(r,_b.TRACE_STATE_HEADER);if(u){let c=Array.isArray(u)?u.join(","):u;a.traceState=new nVo.TraceState(typeof c=="string"?c:void 0)}return y$e.trace.setSpanContext(e,a)}fields(){return[_b.TRACE_PARENT_HEADER,_b.TRACE_STATE_HEADER]}};_b.W3CTraceContextPropagator=xIt});var wrn=T(Y4=>{"use strict";Object.defineProperty(Y4,"__esModule",{value:!0});Y4.getRPCMetadata=Y4.deleteRPCMetadata=Y4.setRPCMetadata=Y4.RPCType=void 0;var lVo=(Xt(),bt(cr)),TIt=(0,lVo.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),mVo;(function(t){t.HTTP="http"})(mVo=Y4.RPCType||(Y4.RPCType={}));function dVo(t,e){return t.setValue(TIt,e)}Y4.setRPCMetadata=dVo;function fVo(t){return t.deleteValue(TIt)}Y4.deleteRPCMetadata=fVo;function pVo(t){return t.getValue(TIt)}Y4.getRPCMetadata=pVo});var Rrn=T(_$e=>{"use strict";Object.defineProperty(_$e,"__esModule",{value:!0});_$e.isPlainObject=void 0;var hVo="[object Object]",gVo="[object Null]",bVo="[object Undefined]",AVo=Function.prototype,xrn=AVo.toString,yVo=xrn.call(Object),_Vo=Object.getPrototypeOf,Trn=Object.prototype,Drn=Trn.hasOwnProperty,gq=Symbol?Symbol.toStringTag:void 0,Irn=Trn.toString;function EVo(t){if(!vVo(t)||CVo(t)!==hVo)return!1;let e=_Vo(t);if(e===null)return!0;let r=Drn.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&xrn.call(r)===yVo}_$e.isPlainObject=EVo;function vVo(t){return t!=null&&typeof t=="object"}function CVo(t){return t==null?t===void 0?bVo:gVo:gq&&gq in Object(t)?SVo(t):wVo(t)}function SVo(t){let e=Drn.call(t,gq),r=t[gq],n=!1;try{t[gq]=void 0,n=!0}catch{}let o=Irn.call(t);return n&&(e?t[gq]=r:delete t[gq]),o}function wVo(t){return Irn.call(t)}});var Brn=T(C$e=>{"use strict";Object.defineProperty(C$e,"__esModule",{value:!0});C$e.merge=void 0;var krn=Rrn(),xVo=20;function TVo(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=Nrn(e,t.shift(),0,r);return e}C$e.merge=TVo;function DIt(t){return v$e(t)?t.slice():t}function Nrn(t,e,r=0,n){let o;if(!(r>xVo)){if(r++,E$e(t)||E$e(e)||Prn(e))o=DIt(e);else if(v$e(t)){if(o=t.slice(),v$e(e))for(let s=0,a=e.length;s<a;s++)o.push(DIt(e[s]));else if(bbe(e)){let s=Object.keys(e);for(let a=0,u=s.length;a<u;a++){let c=s[a];o[c]=DIt(e[c])}}}else if(bbe(t))if(bbe(e)){if(!DVo(t,e))return e;o=Object.assign({},t);let s=Object.keys(e);for(let a=0,u=s.length;a<u;a++){let c=s[a],m=e[c];if(E$e(m))typeof m>"u"?delete o[c]:o[c]=m;else{let d=o[c],f=m;if(Orn(t,c,n)||Orn(e,c,n))delete o[c];else{if(bbe(d)&&bbe(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)}o[c]=Nrn(o[c],m,r,n)}}}}else o=e;return o}}function Orn(t,e,r){let n=r.get(t[e])||[];for(let o=0,s=n.length;o<s;o++){let a=n[o];if(a.key===e&&a.obj===t)return!0}return!1}function v$e(t){return Array.isArray(t)}function Prn(t){return typeof t=="function"}function bbe(t){return!E$e(t)&&!v$e(t)&&!Prn(t)&&typeof t=="object"}function E$e(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function DVo(t,e){return!(!(0,krn.isPlainObject)(t)||!(0,krn.isPlainObject)(e))}});var Lrn=T(Ure=>{"use strict";Object.defineProperty(Ure,"__esModule",{value:!0});Ure.callWithTimeout=Ure.TimeoutError=void 0;var S$e=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};Ure.TimeoutError=S$e;function IVo(t,e){let r,n=new Promise(function(s,a){r=setTimeout(function(){a(new S$e("Operation timed out."))},e)});return Promise.race([t,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}Ure.callWithTimeout=IVo});var Frn=T($re=>{"use strict";Object.defineProperty($re,"__esModule",{value:!0});$re.isUrlIgnored=$re.urlMatches=void 0;function Mrn(t,e){return typeof e=="string"?t===e:!!t.match(e)}$re.urlMatches=Mrn;function RVo(t,e){if(!e)return!1;for(let r of e)if(Mrn(t,r))return!0;return!1}$re.isUrlIgnored=RVo});var Urn=T(w$e=>{"use strict";Object.defineProperty(w$e,"__esModule",{value:!0});w$e.Deferred=void 0;var IIt=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)}};w$e.Deferred=IIt});var $rn=T(x$e=>{"use strict";Object.defineProperty(x$e,"__esModule",{value:!0});x$e.BindOnceFuture=void 0;var kVo=Urn(),RIt=class{_isCalled=!1;_deferred=new kVo.Deferred;_callback;_that;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}};x$e.BindOnceFuture=RIt});var Qrn=T(T$e=>{"use strict";Object.defineProperty(T$e,"__esModule",{value:!0});T$e.diagLogLevelFromString=void 0;var CR=(Xt(),bt(cr)),jrn={ALL:CR.DiagLogLevel.ALL,VERBOSE:CR.DiagLogLevel.VERBOSE,DEBUG:CR.DiagLogLevel.DEBUG,INFO:CR.DiagLogLevel.INFO,WARN:CR.DiagLogLevel.WARN,ERROR:CR.DiagLogLevel.ERROR,NONE:CR.DiagLogLevel.NONE};function OVo(t){if(t==null)return;let e=jrn[t.toUpperCase()];return e??(CR.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(jrn)}, using default`),CR.DiagLogLevel.INFO)}T$e.diagLogLevelFromString=OVo});var qrn=T(D$e=>{"use strict";Object.defineProperty(D$e,"__esModule",{value:!0});D$e._export=void 0;var Grn=(Xt(),bt(cr)),NVo=pbe();function PVo(t,e){return new Promise(r=>{Grn.context.with((0,NVo.suppressTracing)(Grn.context.active()),()=>{t.export(e,n=>{r(n)})})})}D$e._export=PVo});var OIt=T(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.internal=Hr.diagLogLevelFromString=Hr.BindOnceFuture=Hr.urlMatches=Hr.isUrlIgnored=Hr.callWithTimeout=Hr.TimeoutError=Hr.merge=Hr.TraceState=Hr.unsuppressTracing=Hr.suppressTracing=Hr.isTracingSuppressed=Hr.setRPCMetadata=Hr.getRPCMetadata=Hr.deleteRPCMetadata=Hr.RPCType=Hr.parseTraceParent=Hr.W3CTraceContextPropagator=Hr.TRACE_STATE_HEADER=Hr.TRACE_PARENT_HEADER=Hr.CompositePropagator=Hr.otperformance=Hr.getStringListFromEnv=Hr.getNumberFromEnv=Hr.getBooleanFromEnv=Hr.getStringFromEnv=Hr._globalThis=Hr.SDK_INFO=Hr.parseKeyPairsIntoRecord=Hr.ExportResultCode=Hr.unrefTimer=Hr.timeInputToHrTime=Hr.millisToHrTime=Hr.isTimeInputHrTime=Hr.isTimeInput=Hr.hrTimeToTimeStamp=Hr.hrTimeToNanoseconds=Hr.hrTimeToMilliseconds=Hr.hrTimeToMicroseconds=Hr.hrTimeDuration=Hr.hrTime=Hr.getTimeOrigin=Hr.addHrTimes=Hr.loggingErrorHandler=Hr.setGlobalErrorHandler=Hr.globalErrorHandler=Hr.sanitizeAttributes=Hr.isAttributeValue=Hr.AnchoredClock=Hr.W3CBaggagePropagator=void 0;var BVo=Vtn();Object.defineProperty(Hr,"W3CBaggagePropagator",{enumerable:!0,get:function(){return BVo.W3CBaggagePropagator}});var LVo=Wtn();Object.defineProperty(Hr,"AnchoredClock",{enumerable:!0,get:function(){return LVo.AnchoredClock}});var Hrn=Xtn();Object.defineProperty(Hr,"isAttributeValue",{enumerable:!0,get:function(){return Hrn.isAttributeValue}});Object.defineProperty(Hr,"sanitizeAttributes",{enumerable:!0,get:function(){return Hrn.sanitizeAttributes}});var Vrn=ern();Object.defineProperty(Hr,"globalErrorHandler",{enumerable:!0,get:function(){return Vrn.globalErrorHandler}});Object.defineProperty(Hr,"setGlobalErrorHandler",{enumerable:!0,get:function(){return Vrn.setGlobalErrorHandler}});var MVo=yIt();Object.defineProperty(Hr,"loggingErrorHandler",{enumerable:!0,get:function(){return MVo.loggingErrorHandler}});var O_=frn();Object.defineProperty(Hr,"addHrTimes",{enumerable:!0,get:function(){return O_.addHrTimes}});Object.defineProperty(Hr,"getTimeOrigin",{enumerable:!0,get:function(){return O_.getTimeOrigin}});Object.defineProperty(Hr,"hrTime",{enumerable:!0,get:function(){return O_.hrTime}});Object.defineProperty(Hr,"hrTimeDuration",{enumerable:!0,get:function(){return O_.hrTimeDuration}});Object.defineProperty(Hr,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return O_.hrTimeToMicroseconds}});Object.defineProperty(Hr,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return O_.hrTimeToMilliseconds}});Object.defineProperty(Hr,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return O_.hrTimeToNanoseconds}});Object.defineProperty(Hr,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return O_.hrTimeToTimeStamp}});Object.defineProperty(Hr,"isTimeInput",{enumerable:!0,get:function(){return O_.isTimeInput}});Object.defineProperty(Hr,"isTimeInputHrTime",{enumerable:!0,get:function(){return O_.isTimeInputHrTime}});Object.defineProperty(Hr,"millisToHrTime",{enumerable:!0,get:function(){return O_.millisToHrTime}});Object.defineProperty(Hr,"timeInputToHrTime",{enumerable:!0,get:function(){return O_.timeInputToHrTime}});var FVo=prn();Object.defineProperty(Hr,"unrefTimer",{enumerable:!0,get:function(){return FVo.unrefTimer}});var UVo=hrn();Object.defineProperty(Hr,"ExportResultCode",{enumerable:!0,get:function(){return UVo.ExportResultCode}});var $Vo=pIt();Object.defineProperty(Hr,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return $Vo.parseKeyPairsIntoRecord}});var bq=_It();Object.defineProperty(Hr,"SDK_INFO",{enumerable:!0,get:function(){return bq.SDK_INFO}});Object.defineProperty(Hr,"_globalThis",{enumerable:!0,get:function(){return bq._globalThis}});Object.defineProperty(Hr,"getStringFromEnv",{enumerable:!0,get:function(){return bq.getStringFromEnv}});Object.defineProperty(Hr,"getBooleanFromEnv",{enumerable:!0,get:function(){return bq.getBooleanFromEnv}});Object.defineProperty(Hr,"getNumberFromEnv",{enumerable:!0,get:function(){return bq.getNumberFromEnv}});Object.defineProperty(Hr,"getStringListFromEnv",{enumerable:!0,get:function(){return bq.getStringListFromEnv}});Object.defineProperty(Hr,"otperformance",{enumerable:!0,get:function(){return bq.otperformance}});var jVo=brn();Object.defineProperty(Hr,"CompositePropagator",{enumerable:!0,get:function(){return jVo.CompositePropagator}});var I$e=Srn();Object.defineProperty(Hr,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return I$e.TRACE_PARENT_HEADER}});Object.defineProperty(Hr,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return I$e.TRACE_STATE_HEADER}});Object.defineProperty(Hr,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return I$e.W3CTraceContextPropagator}});Object.defineProperty(Hr,"parseTraceParent",{enumerable:!0,get:function(){return I$e.parseTraceParent}});var R$e=wrn();Object.defineProperty(Hr,"RPCType",{enumerable:!0,get:function(){return R$e.RPCType}});Object.defineProperty(Hr,"deleteRPCMetadata",{enumerable:!0,get:function(){return R$e.deleteRPCMetadata}});Object.defineProperty(Hr,"getRPCMetadata",{enumerable:!0,get:function(){return R$e.getRPCMetadata}});Object.defineProperty(Hr,"setRPCMetadata",{enumerable:!0,get:function(){return R$e.setRPCMetadata}});var kIt=pbe();Object.defineProperty(Hr,"isTracingSuppressed",{enumerable:!0,get:function(){return kIt.isTracingSuppressed}});Object.defineProperty(Hr,"suppressTracing",{enumerable:!0,get:function(){return kIt.suppressTracing}});Object.defineProperty(Hr,"unsuppressTracing",{enumerable:!0,get:function(){return kIt.unsuppressTracing}});var QVo=wIt();Object.defineProperty(Hr,"TraceState",{enumerable:!0,get:function(){return QVo.TraceState}});var GVo=Brn();Object.defineProperty(Hr,"merge",{enumerable:!0,get:function(){return GVo.merge}});var Wrn=Lrn();Object.defineProperty(Hr,"TimeoutError",{enumerable:!0,get:function(){return Wrn.TimeoutError}});Object.defineProperty(Hr,"callWithTimeout",{enumerable:!0,get:function(){return Wrn.callWithTimeout}});var zrn=Frn();Object.defineProperty(Hr,"isUrlIgnored",{enumerable:!0,get:function(){return zrn.isUrlIgnored}});Object.defineProperty(Hr,"urlMatches",{enumerable:!0,get:function(){return zrn.urlMatches}});var qVo=$rn();Object.defineProperty(Hr,"BindOnceFuture",{enumerable:!0,get:function(){return qVo.BindOnceFuture}});var HVo=Qrn();Object.defineProperty(Hr,"diagLogLevelFromString",{enumerable:!0,get:function(){return HVo.diagLogLevelFromString}});var VVo=qrn();Hr.internal={_export:VVo._export}});var NIt=T(k$e=>{"use strict";Object.defineProperty(k$e,"__esModule",{value:!0});k$e.defaultServiceName=void 0;var WVo=typeof process=="object"&&typeof process.argv0=="string"&&process.argv0.length>0?`unknown_service:${process.argv0}`:"unknown_service";function zVo(){return WVo}k$e.defaultServiceName=zVo});var Yrn=T(O$e=>{"use strict";Object.defineProperty(O$e,"__esModule",{value:!0});O$e.isPromiseLike=void 0;var YVo=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";O$e.isPromiseLike=YVo});var LIt=T(Gx=>{"use strict";Object.defineProperty(Gx,"__esModule",{value:!0});Gx.defaultResource=Gx.emptyResource=Gx.resourceFromDetectedResource=Gx.resourceFromAttributes=void 0;var ybe=(Xt(),bt(cr)),PIt=OIt(),Aq=(N1(),bt(yh)),KVo=NIt(),Abe=Yrn(),N$e=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=Krn(e),n._asyncAttributesPending=e.filter(([o,s])=>(0,Abe.isPromiseLike)(s)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([o,s])=>((0,Abe.isPromiseLike)(s)&&(this._asyncAttributesPending=!0),[o,s])),this._rawAttributes=Krn(this._rawAttributes),this._schemaUrl=eWo(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,Abe.isPromiseLike)(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&ybe.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,Abe.isPromiseLike)(n)){ybe.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=tWo(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function BIt(t,e){return N$e.FromAttributeList(Object.entries(t),e)}Gx.resourceFromAttributes=BIt;function JVo(t,e){return new N$e(t,e)}Gx.resourceFromDetectedResource=JVo;function XVo(){return BIt({})}Gx.emptyResource=XVo;function ZVo(){return BIt({[Aq.ATTR_SERVICE_NAME]:(0,KVo.defaultServiceName)(),[Aq.ATTR_TELEMETRY_SDK_LANGUAGE]:PIt.SDK_INFO[Aq.ATTR_TELEMETRY_SDK_LANGUAGE],[Aq.ATTR_TELEMETRY_SDK_NAME]:PIt.SDK_INFO[Aq.ATTR_TELEMETRY_SDK_NAME],[Aq.ATTR_TELEMETRY_SDK_VERSION]:PIt.SDK_INFO[Aq.ATTR_TELEMETRY_SDK_VERSION]})}Gx.defaultResource=ZVo;function Krn(t){return t.map(([e,r])=>(0,Abe.isPromiseLike)(r)?[e,r.catch(n=>{ybe.diag.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function eWo(t){if(typeof t=="string"||t===void 0)return t;ybe.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function tWo(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,o=r===void 0||r==="",s=n===void 0||n==="";if(o)return n;if(s||r===n)return r;ybe.diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}});var Xrn=T(P$e=>{"use strict";Object.defineProperty(P$e,"__esModule",{value:!0});P$e.detectResources=void 0;var Jrn=(Xt(),bt(cr)),MIt=LIt(),rWo=(t={})=>(t.detectors||[]).map(r=>{try{let n=(0,MIt.resourceFromDetectedResource)(r.detect(t));return Jrn.diag.debug(`${r.constructor.name} found resource.`,n),n}catch(n){return Jrn.diag.debug(`${r.constructor.name} failed: ${n.message}`),(0,MIt.emptyResource)()}}).reduce((r,n)=>r.merge(n),(0,MIt.emptyResource)());P$e.detectResources=rWo});var enn=T(B$e=>{"use strict";Object.defineProperty(B$e,"__esModule",{value:!0});B$e.envDetector=void 0;var nWo=(Xt(),bt(cr)),iWo=(N1(),bt(yh)),Zrn=OIt(),FIt=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,Zrn.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES"),o=(0,Zrn.getStringFromEnv)("OTEL_SERVICE_NAME");if(n)try{let s=this._parseResourceAttributes(n);Object.assign(r,s)}catch(s){nWo.diag.debug(`EnvDetector failed: ${s.message}`)}return o&&(r[iWo.ATTR_SERVICE_NAME]=o),{attributes:r}}_parseResourceAttributes(e){if(!e)return{};let r={},n=e.split(this._COMMA_SEPARATOR,-1);for(let o of n){let s=o.split(this._LABEL_KEY_VALUE_SPLITTER,-1);if(s.length!==2)continue;let[a,u]=s;if(a=a.trim(),u=u.trim().split(/^"|"$/).join(""),!this._isValidAndNotEmpty(a))throw new Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);if(!this._isValid(u))throw new Error(`Attribute value ${this._ERROR_MESSAGE_INVALID_VALUE}`);r[a]=decodeURIComponent(u)}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)}};B$e.envDetector=new FIt});var _be=T(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.ATTR_WEBENGINE_VERSION=Kn.ATTR_WEBENGINE_NAME=Kn.ATTR_WEBENGINE_DESCRIPTION=Kn.ATTR_SERVICE_NAMESPACE=Kn.ATTR_SERVICE_INSTANCE_ID=Kn.ATTR_PROCESS_RUNTIME_VERSION=Kn.ATTR_PROCESS_RUNTIME_NAME=Kn.ATTR_PROCESS_RUNTIME_DESCRIPTION=Kn.ATTR_PROCESS_PID=Kn.ATTR_PROCESS_OWNER=Kn.ATTR_PROCESS_EXECUTABLE_PATH=Kn.ATTR_PROCESS_EXECUTABLE_NAME=Kn.ATTR_PROCESS_COMMAND_ARGS=Kn.ATTR_PROCESS_COMMAND=Kn.ATTR_OS_VERSION=Kn.ATTR_OS_TYPE=Kn.ATTR_K8S_POD_NAME=Kn.ATTR_K8S_NAMESPACE_NAME=Kn.ATTR_K8S_DEPLOYMENT_NAME=Kn.ATTR_K8S_CLUSTER_NAME=Kn.ATTR_HOST_TYPE=Kn.ATTR_HOST_NAME=Kn.ATTR_HOST_IMAGE_VERSION=Kn.ATTR_HOST_IMAGE_NAME=Kn.ATTR_HOST_IMAGE_ID=Kn.ATTR_HOST_ID=Kn.ATTR_HOST_ARCH=Kn.ATTR_CONTAINER_NAME=Kn.ATTR_CONTAINER_IMAGE_TAGS=Kn.ATTR_CONTAINER_IMAGE_NAME=Kn.ATTR_CONTAINER_ID=Kn.ATTR_CLOUD_REGION=Kn.ATTR_CLOUD_PROVIDER=Kn.ATTR_CLOUD_AVAILABILITY_ZONE=Kn.ATTR_CLOUD_ACCOUNT_ID=void 0;Kn.ATTR_CLOUD_ACCOUNT_ID="cloud.account.id";Kn.ATTR_CLOUD_AVAILABILITY_ZONE="cloud.availability_zone";Kn.ATTR_CLOUD_PROVIDER="cloud.provider";Kn.ATTR_CLOUD_REGION="cloud.region";Kn.ATTR_CONTAINER_ID="container.id";Kn.ATTR_CONTAINER_IMAGE_NAME="container.image.name";Kn.ATTR_CONTAINER_IMAGE_TAGS="container.image.tags";Kn.ATTR_CONTAINER_NAME="container.name";Kn.ATTR_HOST_ARCH="host.arch";Kn.ATTR_HOST_ID="host.id";Kn.ATTR_HOST_IMAGE_ID="host.image.id";Kn.ATTR_HOST_IMAGE_NAME="host.image.name";Kn.ATTR_HOST_IMAGE_VERSION="host.image.version";Kn.ATTR_HOST_NAME="host.name";Kn.ATTR_HOST_TYPE="host.type";Kn.ATTR_K8S_CLUSTER_NAME="k8s.cluster.name";Kn.ATTR_K8S_DEPLOYMENT_NAME="k8s.deployment.name";Kn.ATTR_K8S_NAMESPACE_NAME="k8s.namespace.name";Kn.ATTR_K8S_POD_NAME="k8s.pod.name";Kn.ATTR_OS_TYPE="os.type";Kn.ATTR_OS_VERSION="os.version";Kn.ATTR_PROCESS_COMMAND="process.command";Kn.ATTR_PROCESS_COMMAND_ARGS="process.command_args";Kn.ATTR_PROCESS_EXECUTABLE_NAME="process.executable.name";Kn.ATTR_PROCESS_EXECUTABLE_PATH="process.executable.path";Kn.ATTR_PROCESS_OWNER="process.owner";Kn.ATTR_PROCESS_PID="process.pid";Kn.ATTR_PROCESS_RUNTIME_DESCRIPTION="process.runtime.description";Kn.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name";Kn.ATTR_PROCESS_RUNTIME_VERSION="process.runtime.version";Kn.ATTR_SERVICE_INSTANCE_ID="service.instance.id";Kn.ATTR_SERVICE_NAMESPACE="service.namespace";Kn.ATTR_WEBENGINE_DESCRIPTION="webengine.description";Kn.ATTR_WEBENGINE_NAME="webengine.name";Kn.ATTR_WEBENGINE_VERSION="webengine.version"});var M$e=T(L$e=>{"use strict";Object.defineProperty(L$e,"__esModule",{value:!0});L$e.execAsync=void 0;var oWo=Ae("child_process"),sWo=Ae("util");L$e.execAsync=sWo.promisify(oWo.exec)});var tnn=T(F$e=>{"use strict";Object.defineProperty(F$e,"__esModule",{value:!0});F$e.getMachineId=void 0;var aWo=M$e(),uWo=(Xt(),bt(cr));async function cWo(){try{let e=(await(0,aWo.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
|
|
486
486
|
`).find(n=>n.includes("IOPlatformUUID"));if(!e)return;let r=e.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(t){uWo.diag.debug(`error reading machine id: ${t}`)}}F$e.getMachineId=cWo});var rnn=T(U$e=>{"use strict";Object.defineProperty(U$e,"__esModule",{value:!0});U$e.getMachineId=void 0;var lWo=Ae("fs"),mWo=(Xt(),bt(cr));async function dWo(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await lWo.promises.readFile(e,{encoding:"utf8"})).trim()}catch(r){mWo.diag.debug(`error reading machine id: ${r}`)}}U$e.getMachineId=dWo});var inn=T($$e=>{"use strict";Object.defineProperty($$e,"__esModule",{value:!0});$$e.getMachineId=void 0;var fWo=Ae("fs"),pWo=M$e(),nnn=(Xt(),bt(cr));async function hWo(){try{return(await fWo.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){nnn.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,pWo.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){nnn.diag.debug(`error reading machine id: ${t}`)}}$$e.getMachineId=hWo});var snn=T(j$e=>{"use strict";Object.defineProperty(j$e,"__esModule",{value:!0});j$e.getMachineId=void 0;var onn=Ae("process"),gWo=M$e(),bWo=(Xt(),bt(cr));async function AWo(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";onn.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in onn.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let n=(await(0,gWo.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(n.length===2)return n[1].trim()}catch(r){bWo.diag.debug(`error reading machine id: ${r}`)}}j$e.getMachineId=AWo});var ann=T(Q$e=>{"use strict";Object.defineProperty(Q$e,"__esModule",{value:!0});Q$e.getMachineId=void 0;var yWo=(Xt(),bt(cr));async function _Wo(){yWo.diag.debug("could not read machine-id: unsupported platform")}Q$e.getMachineId=_Wo});var unn=T(G$e=>{"use strict";Object.defineProperty(G$e,"__esModule",{value:!0});G$e.getMachineId=void 0;var EWo=Ae("process"),yq;async function vWo(){if(!yq)switch(EWo.platform){case"darwin":yq=(await Promise.resolve().then(()=>Se(tnn()))).getMachineId;break;case"linux":yq=(await Promise.resolve().then(()=>Se(rnn()))).getMachineId;break;case"freebsd":yq=(await Promise.resolve().then(()=>Se(inn()))).getMachineId;break;case"win32":yq=(await Promise.resolve().then(()=>Se(snn()))).getMachineId;break;default:yq=(await Promise.resolve().then(()=>Se(ann()))).getMachineId;break}return yq()}G$e.getMachineId=vWo});var UIt=T(jre=>{"use strict";Object.defineProperty(jre,"__esModule",{value:!0});jre.normalizeType=jre.normalizeArch=void 0;var CWo=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};jre.normalizeArch=CWo;var SWo=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};jre.normalizeType=SWo});var lnn=T(q$e=>{"use strict";Object.defineProperty(q$e,"__esModule",{value:!0});q$e.hostDetector=void 0;var $It=_be(),cnn=Ae("os"),wWo=unn(),xWo=UIt(),jIt=class{detect(e){return{attributes:{[$It.ATTR_HOST_NAME]:(0,cnn.hostname)(),[$It.ATTR_HOST_ARCH]:(0,xWo.normalizeArch)((0,cnn.arch)()),[$It.ATTR_HOST_ID]:(0,wWo.getMachineId)()}}}};q$e.hostDetector=new jIt});var fnn=T(H$e=>{"use strict";Object.defineProperty(H$e,"__esModule",{value:!0});H$e.osDetector=void 0;var mnn=_be(),dnn=Ae("os"),TWo=UIt(),QIt=class{detect(e){return{attributes:{[mnn.ATTR_OS_TYPE]:(0,TWo.normalizeType)((0,dnn.platform)()),[mnn.ATTR_OS_VERSION]:(0,dnn.release)()}}}};H$e.osDetector=new QIt});var pnn=T(V$e=>{"use strict";Object.defineProperty(V$e,"__esModule",{value:!0});V$e.processDetector=void 0;var DWo=(Xt(),bt(cr)),SR=_be(),IWo=Ae("os"),GIt=class{detect(e){let r={[SR.ATTR_PROCESS_PID]:process.pid,[SR.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[SR.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[SR.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[SR.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[SR.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[SR.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(r[SR.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=IWo.userInfo();r[SR.ATTR_PROCESS_OWNER]=n.username}catch(n){DWo.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:r}}};V$e.processDetector=new GIt});var hnn=T(W$e=>{"use strict";Object.defineProperty(W$e,"__esModule",{value:!0});W$e.serviceInstanceIdDetector=void 0;var RWo=_be(),kWo=Ae("crypto"),qIt=class{detect(e){return{attributes:{[RWo.ATTR_SERVICE_INSTANCE_ID]:(0,kWo.randomUUID)()}}}};W$e.serviceInstanceIdDetector=new qIt});var gnn=T(qx=>{"use strict";Object.defineProperty(qx,"__esModule",{value:!0});qx.serviceInstanceIdDetector=qx.processDetector=qx.osDetector=qx.hostDetector=void 0;var OWo=lnn();Object.defineProperty(qx,"hostDetector",{enumerable:!0,get:function(){return OWo.hostDetector}});var NWo=fnn();Object.defineProperty(qx,"osDetector",{enumerable:!0,get:function(){return NWo.osDetector}});var PWo=pnn();Object.defineProperty(qx,"processDetector",{enumerable:!0,get:function(){return PWo.processDetector}});var BWo=hnn();Object.defineProperty(qx,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return BWo.serviceInstanceIdDetector}})});var bnn=T(Hx=>{"use strict";Object.defineProperty(Hx,"__esModule",{value:!0});Hx.serviceInstanceIdDetector=Hx.processDetector=Hx.osDetector=Hx.hostDetector=void 0;var z$e=gnn();Object.defineProperty(Hx,"hostDetector",{enumerable:!0,get:function(){return z$e.hostDetector}});Object.defineProperty(Hx,"osDetector",{enumerable:!0,get:function(){return z$e.osDetector}});Object.defineProperty(Hx,"processDetector",{enumerable:!0,get:function(){return z$e.processDetector}});Object.defineProperty(Hx,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return z$e.serviceInstanceIdDetector}})});var Ann=T(Qre=>{"use strict";Object.defineProperty(Qre,"__esModule",{value:!0});Qre.noopDetector=Qre.NoopDetector=void 0;var Y$e=class{detect(){return{attributes:{}}}};Qre.NoopDetector=Y$e;Qre.noopDetector=new Y$e});var ynn=T(r8=>{"use strict";Object.defineProperty(r8,"__esModule",{value:!0});r8.noopDetector=r8.serviceInstanceIdDetector=r8.processDetector=r8.osDetector=r8.hostDetector=r8.envDetector=void 0;var LWo=enn();Object.defineProperty(r8,"envDetector",{enumerable:!0,get:function(){return LWo.envDetector}});var K$e=bnn();Object.defineProperty(r8,"hostDetector",{enumerable:!0,get:function(){return K$e.hostDetector}});Object.defineProperty(r8,"osDetector",{enumerable:!0,get:function(){return K$e.osDetector}});Object.defineProperty(r8,"processDetector",{enumerable:!0,get:function(){return K$e.processDetector}});Object.defineProperty(r8,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return K$e.serviceInstanceIdDetector}});var MWo=Ann();Object.defineProperty(r8,"noopDetector",{enumerable:!0,get:function(){return MWo.noopDetector}})});var _nn=T(n1=>{"use strict";Object.defineProperty(n1,"__esModule",{value:!0});n1.defaultServiceName=n1.emptyResource=n1.defaultResource=n1.resourceFromAttributes=n1.serviceInstanceIdDetector=n1.processDetector=n1.osDetector=n1.hostDetector=n1.envDetector=n1.detectResources=void 0;var FWo=Xrn();Object.defineProperty(n1,"detectResources",{enumerable:!0,get:function(){return FWo.detectResources}});var Ebe=ynn();Object.defineProperty(n1,"envDetector",{enumerable:!0,get:function(){return Ebe.envDetector}});Object.defineProperty(n1,"hostDetector",{enumerable:!0,get:function(){return Ebe.hostDetector}});Object.defineProperty(n1,"osDetector",{enumerable:!0,get:function(){return Ebe.osDetector}});Object.defineProperty(n1,"processDetector",{enumerable:!0,get:function(){return Ebe.processDetector}});Object.defineProperty(n1,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Ebe.serviceInstanceIdDetector}});var HIt=LIt();Object.defineProperty(n1,"resourceFromAttributes",{enumerable:!0,get:function(){return HIt.resourceFromAttributes}});Object.defineProperty(n1,"defaultResource",{enumerable:!0,get:function(){return HIt.defaultResource}});Object.defineProperty(n1,"emptyResource",{enumerable:!0,get:function(){return HIt.emptyResource}});var UWo=NIt();Object.defineProperty(n1,"defaultServiceName",{enumerable:!0,get:function(){return UWo.defaultServiceName}})});var Enn=T(vbe=>{"use strict";Object.defineProperty(vbe,"__esModule",{value:!0});vbe.SeverityNumber=void 0;var $Wo;(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"})($Wo=vbe.SeverityNumber||(vbe.SeverityNumber={}))});var X$e=T(Gre=>{"use strict";Object.defineProperty(Gre,"__esModule",{value:!0});Gre.NOOP_LOGGER=Gre.NoopLogger=void 0;var J$e=class{emit(e){}};Gre.NoopLogger=J$e;Gre.NOOP_LOGGER=new J$e});var eje=T(qre=>{"use strict";Object.defineProperty(qre,"__esModule",{value:!0});qre.NOOP_LOGGER_PROVIDER=qre.NoopLoggerProvider=void 0;var jWo=X$e(),Z$e=class{getLogger(e,r,n){return new jWo.NoopLogger}};qre.NoopLoggerProvider=Z$e;qre.NOOP_LOGGER_PROVIDER=new Z$e});var WIt=T(tje=>{"use strict";Object.defineProperty(tje,"__esModule",{value:!0});tje.ProxyLogger=void 0;var QWo=X$e(),VIt=class{constructor(e,r,n,o){this._provider=e,this.name=r,this.version=n,this.options=o}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):QWo.NOOP_LOGGER}};tje.ProxyLogger=VIt});var YIt=T(rje=>{"use strict";Object.defineProperty(rje,"__esModule",{value:!0});rje.ProxyLoggerProvider=void 0;var GWo=eje(),qWo=WIt(),zIt=class{getLogger(e,r,n){var o;return(o=this._getDelegateLogger(e,r,n))!==null&&o!==void 0?o:new qWo.ProxyLogger(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:GWo.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,r,n)}};rje.ProxyLoggerProvider=zIt});var vnn=T(nje=>{"use strict";Object.defineProperty(nje,"__esModule",{value:!0});nje._globalThis=void 0;nje._globalThis=typeof globalThis=="object"?globalThis:global});var Cnn=T(ije=>{"use strict";Object.defineProperty(ije,"__esModule",{value:!0});ije._globalThis=void 0;var HWo=vnn();Object.defineProperty(ije,"_globalThis",{enumerable:!0,get:function(){return HWo._globalThis}})});var Snn=T(oje=>{"use strict";Object.defineProperty(oje,"__esModule",{value:!0});oje._globalThis=void 0;var VWo=Cnn();Object.defineProperty(oje,"_globalThis",{enumerable:!0,get:function(){return VWo._globalThis}})});var wnn=T(Vx=>{"use strict";Object.defineProperty(Vx,"__esModule",{value:!0});Vx.API_BACKWARDS_COMPATIBILITY_VERSION=Vx.makeGetter=Vx._global=Vx.GLOBAL_LOGS_API_KEY=void 0;var WWo=Snn();Vx.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");Vx._global=WWo._globalThis;function zWo(t,e,r){return n=>n===t?e:r}Vx.makeGetter=zWo;Vx.API_BACKWARDS_COMPATIBILITY_VERSION=1});var Tnn=T(sje=>{"use strict";Object.defineProperty(sje,"__esModule",{value:!0});sje.LogsAPI=void 0;var N_=wnn(),YWo=eje(),xnn=YIt(),KIt=class t{constructor(){this._proxyLoggerProvider=new xnn.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return N_._global[N_.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(N_._global[N_.GLOBAL_LOGS_API_KEY]=(0,N_.makeGetter)(N_.API_BACKWARDS_COMPATIBILITY_VERSION,e,YWo.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=N_._global[N_.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(N_._global,N_.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete N_._global[N_.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new xnn.ProxyLoggerProvider}};sje.LogsAPI=KIt});var Rnn=T(Rh=>{"use strict";Object.defineProperty(Rh,"__esModule",{value:!0});Rh.logs=Rh.ProxyLoggerProvider=Rh.ProxyLogger=Rh.NoopLoggerProvider=Rh.NOOP_LOGGER_PROVIDER=Rh.NoopLogger=Rh.NOOP_LOGGER=Rh.SeverityNumber=void 0;var KWo=Enn();Object.defineProperty(Rh,"SeverityNumber",{enumerable:!0,get:function(){return KWo.SeverityNumber}});var Dnn=X$e();Object.defineProperty(Rh,"NOOP_LOGGER",{enumerable:!0,get:function(){return Dnn.NOOP_LOGGER}});Object.defineProperty(Rh,"NoopLogger",{enumerable:!0,get:function(){return Dnn.NoopLogger}});var Inn=eje();Object.defineProperty(Rh,"NOOP_LOGGER_PROVIDER",{enumerable:!0,get:function(){return Inn.NOOP_LOGGER_PROVIDER}});Object.defineProperty(Rh,"NoopLoggerProvider",{enumerable:!0,get:function(){return Inn.NoopLoggerProvider}});var JWo=WIt();Object.defineProperty(Rh,"ProxyLogger",{enumerable:!0,get:function(){return JWo.ProxyLogger}});var XWo=YIt();Object.defineProperty(Rh,"ProxyLoggerProvider",{enumerable:!0,get:function(){return XWo.ProxyLoggerProvider}});var ZWo=Tnn();Rh.logs=ZWo.LogsAPI.getInstance()});var Cbe=T(VB=>{"use strict";Object.defineProperty(VB,"__esModule",{value:!0});VB.isTracingSuppressed=VB.unsuppressTracing=VB.suppressTracing=void 0;var ezo=(Xt(),bt(cr)),JIt=(0,ezo.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function tzo(t){return t.setValue(JIt,!0)}VB.suppressTracing=tzo;function rzo(t){return t.deleteValue(JIt)}VB.unsuppressTracing=rzo;function nzo(t){return t.getValue(JIt)===!0}VB.isTracingSuppressed=nzo});var XIt=T(Eb=>{"use strict";Object.defineProperty(Eb,"__esModule",{value:!0});Eb.BAGGAGE_MAX_TOTAL_LENGTH=Eb.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=Eb.BAGGAGE_MAX_NAME_VALUE_PAIRS=Eb.BAGGAGE_HEADER=Eb.BAGGAGE_ITEMS_SEPARATOR=Eb.BAGGAGE_PROPERTIES_SEPARATOR=Eb.BAGGAGE_KEY_PAIR_SEPARATOR=void 0;Eb.BAGGAGE_KEY_PAIR_SEPARATOR="=";Eb.BAGGAGE_PROPERTIES_SEPARATOR=";";Eb.BAGGAGE_ITEMS_SEPARATOR=",";Eb.BAGGAGE_HEADER="baggage";Eb.BAGGAGE_MAX_NAME_VALUE_PAIRS=180;Eb.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS=4096;Eb.BAGGAGE_MAX_TOTAL_LENGTH=8192});var ZIt=T(Wx=>{"use strict";Object.defineProperty(Wx,"__esModule",{value:!0});Wx.parseKeyPairsIntoRecord=Wx.parsePairKeyValue=Wx.getKeyPairs=Wx.serializeKeyPairs=void 0;var izo=(Xt(),bt(cr)),_q=XIt();function ozo(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?_q.BAGGAGE_ITEMS_SEPARATOR:""}${r}`;return n.length>_q.BAGGAGE_MAX_TOTAL_LENGTH?e:n},"")}Wx.serializeKeyPairs=ozo;function szo(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=_q.BAGGAGE_PROPERTIES_SEPARATOR+r.metadata.toString()),n})}Wx.getKeyPairs=szo;function knn(t){let e=t.split(_q.BAGGAGE_PROPERTIES_SEPARATOR);if(e.length<=0)return;let r=e.shift();if(!r)return;let n=r.indexOf(_q.BAGGAGE_KEY_PAIR_SEPARATOR);if(n<=0)return;let o=decodeURIComponent(r.substring(0,n).trim()),s=decodeURIComponent(r.substring(n+1).trim()),a;return e.length>0&&(a=(0,izo.baggageEntryMetadataFromString)(e.join(_q.BAGGAGE_PROPERTIES_SEPARATOR))),{key:o,value:s,metadata:a}}Wx.parsePairKeyValue=knn;function azo(t){let e={};return typeof t=="string"&&t.length>0&&t.split(_q.BAGGAGE_ITEMS_SEPARATOR).forEach(r=>{let n=knn(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}Wx.parseKeyPairsIntoRecord=azo});var Onn=T(aje=>{"use strict";Object.defineProperty(aje,"__esModule",{value:!0});aje.W3CBaggagePropagator=void 0;var e7t=(Xt(),bt(cr)),uzo=Cbe(),Eq=XIt(),t7t=ZIt(),r7t=class{inject(e,r,n){let o=e7t.propagation.getBaggage(e);if(!o||(0,uzo.isTracingSuppressed)(e))return;let s=(0,t7t.getKeyPairs)(o).filter(u=>u.length<=Eq.BAGGAGE_MAX_PER_NAME_VALUE_PAIRS).slice(0,Eq.BAGGAGE_MAX_NAME_VALUE_PAIRS),a=(0,t7t.serializeKeyPairs)(s);a.length>0&&n.set(r,Eq.BAGGAGE_HEADER,a)}extract(e,r,n){let o=n.get(r,Eq.BAGGAGE_HEADER),s=Array.isArray(o)?o.join(Eq.BAGGAGE_ITEMS_SEPARATOR):o;if(!s)return e;let a={};return s.length===0||(s.split(Eq.BAGGAGE_ITEMS_SEPARATOR).forEach(c=>{let m=(0,t7t.parsePairKeyValue)(c);if(m){let d={value:m.value};m.metadata&&(d.metadata=m.metadata),a[m.key]=d}}),Object.entries(a).length===0)?e:e7t.propagation.setBaggage(e,e7t.propagation.createBaggage(a))}fields(){return[Eq.BAGGAGE_HEADER]}};aje.W3CBaggagePropagator=r7t});var Nnn=T(uje=>{"use strict";Object.defineProperty(uje,"__esModule",{value:!0});uje.AnchoredClock=void 0;var n7t=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}};uje.AnchoredClock=n7t});var Fnn=T(WB=>{"use strict";Object.defineProperty(WB,"__esModule",{value:!0});WB.isAttributeValue=WB.isAttributeKey=WB.sanitizeAttributes=void 0;var Pnn=(Xt(),bt(cr));function czo(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(!Bnn(r)){Pnn.diag.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!Lnn(n)){Pnn.diag.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}WB.sanitizeAttributes=czo;function Bnn(t){return typeof t=="string"&&t!==""}WB.isAttributeKey=Bnn;function Lnn(t){return t==null?!0:Array.isArray(t)?lzo(t):Mnn(typeof t)}WB.isAttributeValue=Lnn;function lzo(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(Mnn(n)){e=n;continue}return!1}return!1}}return!0}function Mnn(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}});var i7t=T(cje=>{"use strict";Object.defineProperty(cje,"__esModule",{value:!0});cje.loggingErrorHandler=void 0;var mzo=(Xt(),bt(cr));function dzo(){return t=>{mzo.diag.error(fzo(t))}}cje.loggingErrorHandler=dzo;function fzo(t){return typeof t=="string"?t:JSON.stringify(pzo(t))}function pzo(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let o=r[n];o&&(e[n]=String(o))}),r=Object.getPrototypeOf(r);return e}});var $nn=T(Hre=>{"use strict";Object.defineProperty(Hre,"__esModule",{value:!0});Hre.globalErrorHandler=Hre.setGlobalErrorHandler=void 0;var hzo=i7t(),Unn=(0,hzo.loggingErrorHandler)();function gzo(t){Unn=t}Hre.setGlobalErrorHandler=gzo;function bzo(t){try{Unn(t)}catch{}}Hre.globalErrorHandler=bzo});var qnn=T(zx=>{"use strict";Object.defineProperty(zx,"__esModule",{value:!0});zx.getStringListFromEnv=zx.getBooleanFromEnv=zx.getStringFromEnv=zx.getNumberFromEnv=void 0;var jnn=(Xt(),bt(cr)),Qnn=Ae("util");function Azo(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){jnn.diag.warn(`Unknown value ${(0,Qnn.inspect)(e)} for ${t}, expected a number, using defaults`);return}return r}zx.getNumberFromEnv=Azo;function Gnn(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}zx.getStringFromEnv=Gnn;function yzo(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||jnn.diag.warn(`Unknown value ${(0,Qnn.inspect)(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}zx.getBooleanFromEnv=yzo;function _zo(t){return Gnn(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}zx.getStringListFromEnv=_zo});var Hnn=T(lje=>{"use strict";Object.defineProperty(lje,"__esModule",{value:!0});lje._globalThis=void 0;lje._globalThis=typeof globalThis=="object"?globalThis:global});var Vnn=T(mje=>{"use strict";Object.defineProperty(mje,"__esModule",{value:!0});mje.otperformance=void 0;var Ezo=Ae("perf_hooks");mje.otperformance=Ezo.performance});var Wnn=T(dje=>{"use strict";Object.defineProperty(dje,"__esModule",{value:!0});dje.VERSION=void 0;dje.VERSION="2.2.0"});var znn=T(fje=>{"use strict";Object.defineProperty(fje,"__esModule",{value:!0});fje.ATTR_PROCESS_RUNTIME_NAME=void 0;fje.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name"});var Ynn=T(hje=>{"use strict";Object.defineProperty(hje,"__esModule",{value:!0});hje.SDK_INFO=void 0;var vzo=Wnn(),pje=(N1(),bt(yh)),Czo=znn();hje.SDK_INFO={[pje.ATTR_TELEMETRY_SDK_NAME]:"opentelemetry",[Czo.ATTR_PROCESS_RUNTIME_NAME]:"node",[pje.ATTR_TELEMETRY_SDK_LANGUAGE]:pje.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS,[pje.ATTR_TELEMETRY_SDK_VERSION]:vzo.VERSION}});var Knn=T(vb=>{"use strict";Object.defineProperty(vb,"__esModule",{value:!0});vb.SDK_INFO=vb.otperformance=vb._globalThis=vb.getStringListFromEnv=vb.getNumberFromEnv=vb.getBooleanFromEnv=vb.getStringFromEnv=void 0;var gje=qnn();Object.defineProperty(vb,"getStringFromEnv",{enumerable:!0,get:function(){return gje.getStringFromEnv}});Object.defineProperty(vb,"getBooleanFromEnv",{enumerable:!0,get:function(){return gje.getBooleanFromEnv}});Object.defineProperty(vb,"getNumberFromEnv",{enumerable:!0,get:function(){return gje.getNumberFromEnv}});Object.defineProperty(vb,"getStringListFromEnv",{enumerable:!0,get:function(){return gje.getStringListFromEnv}});var Szo=Hnn();Object.defineProperty(vb,"_globalThis",{enumerable:!0,get:function(){return Szo._globalThis}});var wzo=Vnn();Object.defineProperty(vb,"otperformance",{enumerable:!0,get:function(){return wzo.otperformance}});var xzo=Ynn();Object.defineProperty(vb,"SDK_INFO",{enumerable:!0,get:function(){return xzo.SDK_INFO}})});var o7t=T(Cb=>{"use strict";Object.defineProperty(Cb,"__esModule",{value:!0});Cb.getStringListFromEnv=Cb.getNumberFromEnv=Cb.getStringFromEnv=Cb.getBooleanFromEnv=Cb.otperformance=Cb._globalThis=Cb.SDK_INFO=void 0;var vq=Knn();Object.defineProperty(Cb,"SDK_INFO",{enumerable:!0,get:function(){return vq.SDK_INFO}});Object.defineProperty(Cb,"_globalThis",{enumerable:!0,get:function(){return vq._globalThis}});Object.defineProperty(Cb,"otperformance",{enumerable:!0,get:function(){return vq.otperformance}});Object.defineProperty(Cb,"getBooleanFromEnv",{enumerable:!0,get:function(){return vq.getBooleanFromEnv}});Object.defineProperty(Cb,"getStringFromEnv",{enumerable:!0,get:function(){return vq.getStringFromEnv}});Object.defineProperty(Cb,"getNumberFromEnv",{enumerable:!0,get:function(){return vq.getNumberFromEnv}});Object.defineProperty(Cb,"getStringListFromEnv",{enumerable:!0,get:function(){return vq.getStringListFromEnv}})});var ein=T($0=>{"use strict";Object.defineProperty($0,"__esModule",{value:!0});$0.addHrTimes=$0.isTimeInput=$0.isTimeInputHrTime=$0.hrTimeToMicroseconds=$0.hrTimeToMilliseconds=$0.hrTimeToNanoseconds=$0.hrTimeToTimeStamp=$0.hrTimeDuration=$0.timeInputToHrTime=$0.hrTime=$0.getTimeOrigin=$0.millisToHrTime=void 0;var s7t=o7t(),Jnn=9,Tzo=6,Dzo=Math.pow(10,Tzo),bje=Math.pow(10,Jnn);function Sbe(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*Dzo);return[r,n]}$0.millisToHrTime=Sbe;function a7t(){let t=s7t.otperformance.timeOrigin;if(typeof t!="number"){let e=s7t.otperformance;t=e.timing&&e.timing.fetchStart}return t}$0.getTimeOrigin=a7t;function Xnn(t){let e=Sbe(a7t()),r=Sbe(typeof t=="number"?t:s7t.otperformance.now());return Znn(e,r)}$0.hrTime=Xnn;function Izo(t){if(u7t(t))return t;if(typeof t=="number")return t<a7t()?Xnn(t):Sbe(t);if(t instanceof Date)return Sbe(t.getTime());throw TypeError("Invalid input type")}$0.timeInputToHrTime=Izo;function Rzo(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=bje),[r,n]}$0.hrTimeDuration=Rzo;function kzo(t){let e=Jnn,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}$0.hrTimeToTimeStamp=kzo;function Ozo(t){return t[0]*bje+t[1]}$0.hrTimeToNanoseconds=Ozo;function Nzo(t){return t[0]*1e3+t[1]/1e6}$0.hrTimeToMilliseconds=Nzo;function Pzo(t){return t[0]*1e6+t[1]/1e3}$0.hrTimeToMicroseconds=Pzo;function u7t(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}$0.isTimeInputHrTime=u7t;function Bzo(t){return u7t(t)||typeof t=="number"||t instanceof Date}$0.isTimeInput=Bzo;function Znn(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=bje&&(r[1]-=bje,r[0]+=1),r}$0.addHrTimes=Znn});var tin=T(Aje=>{"use strict";Object.defineProperty(Aje,"__esModule",{value:!0});Aje.unrefTimer=void 0;function Lzo(t){typeof t!="number"&&t.unref()}Aje.unrefTimer=Lzo});var rin=T(wbe=>{"use strict";Object.defineProperty(wbe,"__esModule",{value:!0});wbe.ExportResultCode=void 0;var Mzo;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(Mzo=wbe.ExportResultCode||(wbe.ExportResultCode={}))});var iin=T(yje=>{"use strict";Object.defineProperty(yje,"__esModule",{value:!0});yje.CompositePropagator=void 0;var nin=(Xt(),bt(cr)),c7t=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 o of this._propagators)try{o.inject(e,r,n)}catch(s){nin.diag.warn(`Failed to inject with ${o.constructor.name}. Err: ${s.message}`)}}extract(e,r,n){return this._propagators.reduce((o,s)=>{try{return s.extract(o,r,n)}catch(a){nin.diag.warn(`Failed to extract with ${s.constructor.name}. Err: ${a.message}`)}return o},e)}fields(){return this._fields.slice()}};yje.CompositePropagator=c7t});var oin=T(Vre=>{"use strict";Object.defineProperty(Vre,"__esModule",{value:!0});Vre.validateValue=Vre.validateKey=void 0;var l7t="[_0-9a-z-*/]",Fzo=`[a-z]${l7t}{0,255}`,Uzo=`[a-z0-9]${l7t}{0,240}@[a-z]${l7t}{0,13}`,$zo=new RegExp(`^(?:${Fzo}|${Uzo})$`),jzo=/^[ -~]{0,255}[!-~]$/,Qzo=/,|=/;function Gzo(t){return $zo.test(t)}Vre.validateKey=Gzo;function qzo(t){return jzo.test(t)&&!Qzo.test(t)}Vre.validateValue=qzo});var d7t=T(_je=>{"use strict";Object.defineProperty(_je,"__esModule",{value:!0});_je.TraceState=void 0;var sin=oin(),ain=32,Hzo=512,uin=",",cin="=",m7t=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+cin+this.get(r)),e),[]).join(uin)}_parse(e){e.length>Hzo||(this._internalState=e.split(uin).reverse().reduce((r,n)=>{let o=n.trim(),s=o.indexOf(cin);if(s!==-1){let a=o.slice(0,s),u=o.slice(s+1,n.length);(0,sin.validateKey)(a)&&(0,sin.validateValue)(u)&&r.set(a,u)}return r},new Map),this._internalState.size>ain&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,ain))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}};_je.TraceState=m7t});var min=T(Sb=>{"use strict";Object.defineProperty(Sb,"__esModule",{value:!0});Sb.W3CTraceContextPropagator=Sb.parseTraceParent=Sb.TRACE_STATE_HEADER=Sb.TRACE_PARENT_HEADER=void 0;var Eje=(Xt(),bt(cr)),Vzo=Cbe(),Wzo=d7t();Sb.TRACE_PARENT_HEADER="traceparent";Sb.TRACE_STATE_HEADER="tracestate";var zzo="00",Yzo="(?!ff)[\\da-f]{2}",Kzo="(?![0]{32})[\\da-f]{32}",Jzo="(?![0]{16})[\\da-f]{16}",Xzo="[\\da-f]{2}",Zzo=new RegExp(`^\\s?(${Yzo})-(${Kzo})-(${Jzo})-(${Xzo})(-.*)?\\s?$`);function lin(t){let e=Zzo.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}Sb.parseTraceParent=lin;var f7t=class{inject(e,r,n){let o=Eje.trace.getSpanContext(e);if(!o||(0,Vzo.isTracingSuppressed)(e)||!(0,Eje.isSpanContextValid)(o))return;let s=`${zzo}-${o.traceId}-${o.spanId}-0${Number(o.traceFlags||Eje.TraceFlags.NONE).toString(16)}`;n.set(r,Sb.TRACE_PARENT_HEADER,s),o.traceState&&n.set(r,Sb.TRACE_STATE_HEADER,o.traceState.serialize())}extract(e,r,n){let o=n.get(r,Sb.TRACE_PARENT_HEADER);if(!o)return e;let s=Array.isArray(o)?o[0]:o;if(typeof s!="string")return e;let a=lin(s);if(!a)return e;a.isRemote=!0;let u=n.get(r,Sb.TRACE_STATE_HEADER);if(u){let c=Array.isArray(u)?u.join(","):u;a.traceState=new Wzo.TraceState(typeof c=="string"?c:void 0)}return Eje.trace.setSpanContext(e,a)}fields(){return[Sb.TRACE_PARENT_HEADER,Sb.TRACE_STATE_HEADER]}};Sb.W3CTraceContextPropagator=f7t});var din=T(K4=>{"use strict";Object.defineProperty(K4,"__esModule",{value:!0});K4.getRPCMetadata=K4.deleteRPCMetadata=K4.setRPCMetadata=K4.RPCType=void 0;var eYo=(Xt(),bt(cr)),p7t=(0,eYo.createContextKey)("OpenTelemetry SDK Context Key RPC_METADATA"),tYo;(function(t){t.HTTP="http"})(tYo=K4.RPCType||(K4.RPCType={}));function rYo(t,e){return t.setValue(p7t,e)}K4.setRPCMetadata=rYo;function nYo(t){return t.deleteValue(p7t)}K4.deleteRPCMetadata=nYo;function iYo(t){return t.getValue(p7t)}K4.getRPCMetadata=iYo});var bin=T(vje=>{"use strict";Object.defineProperty(vje,"__esModule",{value:!0});vje.isPlainObject=void 0;var oYo="[object Object]",sYo="[object Null]",aYo="[object Undefined]",uYo=Function.prototype,fin=uYo.toString,cYo=fin.call(Object),lYo=Object.getPrototypeOf,pin=Object.prototype,hin=pin.hasOwnProperty,Cq=Symbol?Symbol.toStringTag:void 0,gin=pin.toString;function mYo(t){if(!dYo(t)||fYo(t)!==oYo)return!1;let e=lYo(t);if(e===null)return!0;let r=hin.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&fin.call(r)===cYo}vje.isPlainObject=mYo;function dYo(t){return t!=null&&typeof t=="object"}function fYo(t){return t==null?t===void 0?aYo:sYo:Cq&&Cq in Object(t)?pYo(t):hYo(t)}function pYo(t){let e=hin.call(t,Cq),r=t[Cq],n=!1;try{t[Cq]=void 0,n=!0}catch{}let o=gin.call(t);return n&&(e?t[Cq]=r:delete t[Cq]),o}function hYo(t){return gin.call(t)}});var vin=T(wje=>{"use strict";Object.defineProperty(wje,"__esModule",{value:!0});wje.merge=void 0;var Ain=bin(),gYo=20;function bYo(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=_in(e,t.shift(),0,r);return e}wje.merge=bYo;function h7t(t){return Sje(t)?t.slice():t}function _in(t,e,r=0,n){let o;if(!(r>gYo)){if(r++,Cje(t)||Cje(e)||Ein(e))o=h7t(e);else if(Sje(t)){if(o=t.slice(),Sje(e))for(let s=0,a=e.length;s<a;s++)o.push(h7t(e[s]));else if(xbe(e)){let s=Object.keys(e);for(let a=0,u=s.length;a<u;a++){let c=s[a];o[c]=h7t(e[c])}}}else if(xbe(t))if(xbe(e)){if(!AYo(t,e))return e;o=Object.assign({},t);let s=Object.keys(e);for(let a=0,u=s.length;a<u;a++){let c=s[a],m=e[c];if(Cje(m))typeof m>"u"?delete o[c]:o[c]=m;else{let d=o[c],f=m;if(yin(t,c,n)||yin(e,c,n))delete o[c];else{if(xbe(d)&&xbe(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)}o[c]=_in(o[c],m,r,n)}}}}else o=e;return o}}function yin(t,e,r){let n=r.get(t[e])||[];for(let o=0,s=n.length;o<s;o++){let a=n[o];if(a.key===e&&a.obj===t)return!0}return!1}function Sje(t){return Array.isArray(t)}function Ein(t){return typeof t=="function"}function xbe(t){return!Cje(t)&&!Sje(t)&&!Ein(t)&&typeof t=="object"}function Cje(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function AYo(t,e){return!(!(0,Ain.isPlainObject)(t)||!(0,Ain.isPlainObject)(e))}});var Cin=T(Wre=>{"use strict";Object.defineProperty(Wre,"__esModule",{value:!0});Wre.callWithTimeout=Wre.TimeoutError=void 0;var xje=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};Wre.TimeoutError=xje;function yYo(t,e){let r,n=new Promise(function(s,a){r=setTimeout(function(){a(new xje("Operation timed out."))},e)});return Promise.race([t,n]).then(o=>(clearTimeout(r),o),o=>{throw clearTimeout(r),o})}Wre.callWithTimeout=yYo});var win=T(zre=>{"use strict";Object.defineProperty(zre,"__esModule",{value:!0});zre.isUrlIgnored=zre.urlMatches=void 0;function Sin(t,e){return typeof e=="string"?t===e:!!t.match(e)}zre.urlMatches=Sin;function _Yo(t,e){if(!e)return!1;for(let r of e)if(Sin(t,r))return!0;return!1}zre.isUrlIgnored=_Yo});var xin=T(Tje=>{"use strict";Object.defineProperty(Tje,"__esModule",{value:!0});Tje.Deferred=void 0;var g7t=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)}};Tje.Deferred=g7t});var Tin=T(Dje=>{"use strict";Object.defineProperty(Dje,"__esModule",{value:!0});Dje.BindOnceFuture=void 0;var EYo=xin(),b7t=class{_callback;_that;_isCalled=!1;_deferred=new EYo.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}};Dje.BindOnceFuture=b7t});var Iin=T(Ije=>{"use strict";Object.defineProperty(Ije,"__esModule",{value:!0});Ije.diagLogLevelFromString=void 0;var wR=(Xt(),bt(cr)),Din={ALL:wR.DiagLogLevel.ALL,VERBOSE:wR.DiagLogLevel.VERBOSE,DEBUG:wR.DiagLogLevel.DEBUG,INFO:wR.DiagLogLevel.INFO,WARN:wR.DiagLogLevel.WARN,ERROR:wR.DiagLogLevel.ERROR,NONE:wR.DiagLogLevel.NONE};function vYo(t){if(t==null)return;let e=Din[t.toUpperCase()];return e??(wR.diag.warn(`Unknown log level "${t}", expected one of ${Object.keys(Din)}, using default`),wR.DiagLogLevel.INFO)}Ije.diagLogLevelFromString=vYo});var kin=T(Rje=>{"use strict";Object.defineProperty(Rje,"__esModule",{value:!0});Rje._export=void 0;var Rin=(Xt(),bt(cr)),CYo=Cbe();function SYo(t,e){return new Promise(r=>{Rin.context.with((0,CYo.suppressTracing)(Rin.context.active()),()=>{t.export(e,n=>{r(n)})})})}Rje._export=SYo});var J4=T(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.internal=Vr.diagLogLevelFromString=Vr.BindOnceFuture=Vr.urlMatches=Vr.isUrlIgnored=Vr.callWithTimeout=Vr.TimeoutError=Vr.merge=Vr.TraceState=Vr.unsuppressTracing=Vr.suppressTracing=Vr.isTracingSuppressed=Vr.setRPCMetadata=Vr.getRPCMetadata=Vr.deleteRPCMetadata=Vr.RPCType=Vr.parseTraceParent=Vr.W3CTraceContextPropagator=Vr.TRACE_STATE_HEADER=Vr.TRACE_PARENT_HEADER=Vr.CompositePropagator=Vr.otperformance=Vr.getStringListFromEnv=Vr.getNumberFromEnv=Vr.getBooleanFromEnv=Vr.getStringFromEnv=Vr._globalThis=Vr.SDK_INFO=Vr.parseKeyPairsIntoRecord=Vr.ExportResultCode=Vr.unrefTimer=Vr.timeInputToHrTime=Vr.millisToHrTime=Vr.isTimeInputHrTime=Vr.isTimeInput=Vr.hrTimeToTimeStamp=Vr.hrTimeToNanoseconds=Vr.hrTimeToMilliseconds=Vr.hrTimeToMicroseconds=Vr.hrTimeDuration=Vr.hrTime=Vr.getTimeOrigin=Vr.addHrTimes=Vr.loggingErrorHandler=Vr.setGlobalErrorHandler=Vr.globalErrorHandler=Vr.sanitizeAttributes=Vr.isAttributeValue=Vr.AnchoredClock=Vr.W3CBaggagePropagator=void 0;var wYo=Onn();Object.defineProperty(Vr,"W3CBaggagePropagator",{enumerable:!0,get:function(){return wYo.W3CBaggagePropagator}});var xYo=Nnn();Object.defineProperty(Vr,"AnchoredClock",{enumerable:!0,get:function(){return xYo.AnchoredClock}});var Oin=Fnn();Object.defineProperty(Vr,"isAttributeValue",{enumerable:!0,get:function(){return Oin.isAttributeValue}});Object.defineProperty(Vr,"sanitizeAttributes",{enumerable:!0,get:function(){return Oin.sanitizeAttributes}});var Nin=$nn();Object.defineProperty(Vr,"globalErrorHandler",{enumerable:!0,get:function(){return Nin.globalErrorHandler}});Object.defineProperty(Vr,"setGlobalErrorHandler",{enumerable:!0,get:function(){return Nin.setGlobalErrorHandler}});var TYo=i7t();Object.defineProperty(Vr,"loggingErrorHandler",{enumerable:!0,get:function(){return TYo.loggingErrorHandler}});var P_=ein();Object.defineProperty(Vr,"addHrTimes",{enumerable:!0,get:function(){return P_.addHrTimes}});Object.defineProperty(Vr,"getTimeOrigin",{enumerable:!0,get:function(){return P_.getTimeOrigin}});Object.defineProperty(Vr,"hrTime",{enumerable:!0,get:function(){return P_.hrTime}});Object.defineProperty(Vr,"hrTimeDuration",{enumerable:!0,get:function(){return P_.hrTimeDuration}});Object.defineProperty(Vr,"hrTimeToMicroseconds",{enumerable:!0,get:function(){return P_.hrTimeToMicroseconds}});Object.defineProperty(Vr,"hrTimeToMilliseconds",{enumerable:!0,get:function(){return P_.hrTimeToMilliseconds}});Object.defineProperty(Vr,"hrTimeToNanoseconds",{enumerable:!0,get:function(){return P_.hrTimeToNanoseconds}});Object.defineProperty(Vr,"hrTimeToTimeStamp",{enumerable:!0,get:function(){return P_.hrTimeToTimeStamp}});Object.defineProperty(Vr,"isTimeInput",{enumerable:!0,get:function(){return P_.isTimeInput}});Object.defineProperty(Vr,"isTimeInputHrTime",{enumerable:!0,get:function(){return P_.isTimeInputHrTime}});Object.defineProperty(Vr,"millisToHrTime",{enumerable:!0,get:function(){return P_.millisToHrTime}});Object.defineProperty(Vr,"timeInputToHrTime",{enumerable:!0,get:function(){return P_.timeInputToHrTime}});var DYo=tin();Object.defineProperty(Vr,"unrefTimer",{enumerable:!0,get:function(){return DYo.unrefTimer}});var IYo=rin();Object.defineProperty(Vr,"ExportResultCode",{enumerable:!0,get:function(){return IYo.ExportResultCode}});var RYo=ZIt();Object.defineProperty(Vr,"parseKeyPairsIntoRecord",{enumerable:!0,get:function(){return RYo.parseKeyPairsIntoRecord}});var Sq=o7t();Object.defineProperty(Vr,"SDK_INFO",{enumerable:!0,get:function(){return Sq.SDK_INFO}});Object.defineProperty(Vr,"_globalThis",{enumerable:!0,get:function(){return Sq._globalThis}});Object.defineProperty(Vr,"getStringFromEnv",{enumerable:!0,get:function(){return Sq.getStringFromEnv}});Object.defineProperty(Vr,"getBooleanFromEnv",{enumerable:!0,get:function(){return Sq.getBooleanFromEnv}});Object.defineProperty(Vr,"getNumberFromEnv",{enumerable:!0,get:function(){return Sq.getNumberFromEnv}});Object.defineProperty(Vr,"getStringListFromEnv",{enumerable:!0,get:function(){return Sq.getStringListFromEnv}});Object.defineProperty(Vr,"otperformance",{enumerable:!0,get:function(){return Sq.otperformance}});var kYo=iin();Object.defineProperty(Vr,"CompositePropagator",{enumerable:!0,get:function(){return kYo.CompositePropagator}});var kje=min();Object.defineProperty(Vr,"TRACE_PARENT_HEADER",{enumerable:!0,get:function(){return kje.TRACE_PARENT_HEADER}});Object.defineProperty(Vr,"TRACE_STATE_HEADER",{enumerable:!0,get:function(){return kje.TRACE_STATE_HEADER}});Object.defineProperty(Vr,"W3CTraceContextPropagator",{enumerable:!0,get:function(){return kje.W3CTraceContextPropagator}});Object.defineProperty(Vr,"parseTraceParent",{enumerable:!0,get:function(){return kje.parseTraceParent}});var Oje=din();Object.defineProperty(Vr,"RPCType",{enumerable:!0,get:function(){return Oje.RPCType}});Object.defineProperty(Vr,"deleteRPCMetadata",{enumerable:!0,get:function(){return Oje.deleteRPCMetadata}});Object.defineProperty(Vr,"getRPCMetadata",{enumerable:!0,get:function(){return Oje.getRPCMetadata}});Object.defineProperty(Vr,"setRPCMetadata",{enumerable:!0,get:function(){return Oje.setRPCMetadata}});var A7t=Cbe();Object.defineProperty(Vr,"isTracingSuppressed",{enumerable:!0,get:function(){return A7t.isTracingSuppressed}});Object.defineProperty(Vr,"suppressTracing",{enumerable:!0,get:function(){return A7t.suppressTracing}});Object.defineProperty(Vr,"unsuppressTracing",{enumerable:!0,get:function(){return A7t.unsuppressTracing}});var OYo=d7t();Object.defineProperty(Vr,"TraceState",{enumerable:!0,get:function(){return OYo.TraceState}});var NYo=vin();Object.defineProperty(Vr,"merge",{enumerable:!0,get:function(){return NYo.merge}});var Pin=Cin();Object.defineProperty(Vr,"TimeoutError",{enumerable:!0,get:function(){return Pin.TimeoutError}});Object.defineProperty(Vr,"callWithTimeout",{enumerable:!0,get:function(){return Pin.callWithTimeout}});var Bin=win();Object.defineProperty(Vr,"isUrlIgnored",{enumerable:!0,get:function(){return Bin.isUrlIgnored}});Object.defineProperty(Vr,"urlMatches",{enumerable:!0,get:function(){return Bin.urlMatches}});var PYo=Tin();Object.defineProperty(Vr,"BindOnceFuture",{enumerable:!0,get:function(){return PYo.BindOnceFuture}});var BYo=Iin();Object.defineProperty(Vr,"diagLogLevelFromString",{enumerable:!0,get:function(){return BYo.diagLogLevelFromString}});var LYo=kin();Vr.internal={_export:LYo._export}});var Lin=T(Nje=>{"use strict";Object.defineProperty(Nje,"__esModule",{value:!0});Nje.defaultServiceName=void 0;function MYo(){return`unknown_service:${process.argv0}`}Nje.defaultServiceName=MYo});var Min=T(Pje=>{"use strict";Object.defineProperty(Pje,"__esModule",{value:!0});Pje.defaultServiceName=void 0;var FYo=Lin();Object.defineProperty(Pje,"defaultServiceName",{enumerable:!0,get:function(){return FYo.defaultServiceName}})});var y7t=T(Bje=>{"use strict";Object.defineProperty(Bje,"__esModule",{value:!0});Bje.defaultServiceName=void 0;var UYo=Min();Object.defineProperty(Bje,"defaultServiceName",{enumerable:!0,get:function(){return UYo.defaultServiceName}})});var Fin=T(Yre=>{"use strict";Object.defineProperty(Yre,"__esModule",{value:!0});Yre.identity=Yre.isPromiseLike=void 0;var $Yo=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";Yre.isPromiseLike=$Yo;function jYo(t){return t}Yre.identity=jYo});var v7t=T(Yx=>{"use strict";Object.defineProperty(Yx,"__esModule",{value:!0});Yx.defaultResource=Yx.emptyResource=Yx.resourceFromDetectedResource=Yx.resourceFromAttributes=void 0;var Dbe=(Xt(),bt(cr)),_7t=J4(),wq=(N1(),bt(yh)),QYo=y7t(),Tbe=Fin(),Lje=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=Uin(e),n._asyncAttributesPending=e.filter(([o,s])=>(0,Tbe.isPromiseLike)(s)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([o,s])=>((0,Tbe.isPromiseLike)(s)&&(this._asyncAttributesPending=!0),[o,s])),this._rawAttributes=Uin(this._rawAttributes),this._schemaUrl=VYo(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,Tbe.isPromiseLike)(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Dbe.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,Tbe.isPromiseLike)(n)){Dbe.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=WYo(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function E7t(t,e){return Lje.FromAttributeList(Object.entries(t),e)}Yx.resourceFromAttributes=E7t;function GYo(t,e){return new Lje(t,e)}Yx.resourceFromDetectedResource=GYo;function qYo(){return E7t({})}Yx.emptyResource=qYo;function HYo(){return E7t({[wq.ATTR_SERVICE_NAME]:(0,QYo.defaultServiceName)(),[wq.ATTR_TELEMETRY_SDK_LANGUAGE]:_7t.SDK_INFO[wq.ATTR_TELEMETRY_SDK_LANGUAGE],[wq.ATTR_TELEMETRY_SDK_NAME]:_7t.SDK_INFO[wq.ATTR_TELEMETRY_SDK_NAME],[wq.ATTR_TELEMETRY_SDK_VERSION]:_7t.SDK_INFO[wq.ATTR_TELEMETRY_SDK_VERSION]})}Yx.defaultResource=HYo;function Uin(t){return t.map(([e,r])=>(0,Tbe.isPromiseLike)(r)?[e,r.catch(n=>{Dbe.diag.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function VYo(t){if(typeof t=="string"||t===void 0)return t;Dbe.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function WYo(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,o=r===void 0||r==="",s=n===void 0||n==="";if(o)return n;if(s||r===n)return r;Dbe.diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}});var jin=T(Mje=>{"use strict";Object.defineProperty(Mje,"__esModule",{value:!0});Mje.detectResources=void 0;var $in=(Xt(),bt(cr)),C7t=v7t(),zYo=(t={})=>(t.detectors||[]).map(r=>{try{let n=(0,C7t.resourceFromDetectedResource)(r.detect(t));return $in.diag.debug(`${r.constructor.name} found resource.`,n),n}catch(n){return $in.diag.debug(`${r.constructor.name} failed: ${n.message}`),(0,C7t.emptyResource)()}}).reduce((r,n)=>r.merge(n),(0,C7t.emptyResource)());Mje.detectResources=zYo});var Gin=T(Fje=>{"use strict";Object.defineProperty(Fje,"__esModule",{value:!0});Fje.envDetector=void 0;var YYo=(Xt(),bt(cr)),KYo=(N1(),bt(yh)),Qin=J4(),S7t=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,Qin.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES"),o=(0,Qin.getStringFromEnv)("OTEL_SERVICE_NAME");if(n)try{let s=this._parseResourceAttributes(n);Object.assign(r,s)}catch(s){YYo.diag.debug(`EnvDetector failed: ${s.message}`)}return o&&(r[KYo.ATTR_SERVICE_NAME]=o),{attributes:r}}_parseResourceAttributes(e){if(!e)return{};let r={},n=e.split(this._COMMA_SEPARATOR,-1);for(let o of n){let s=o.split(this._LABEL_KEY_VALUE_SPLITTER,-1);if(s.length!==2)continue;let[a,u]=s;if(a=a.trim(),u=u.trim().split(/^"|"$/).join(""),!this._isValidAndNotEmpty(a))throw new Error(`Attribute key ${this._ERROR_MESSAGE_INVALID_CHARS}`);if(!this._isValid(u))throw new Error(`Attribute value ${this._ERROR_MESSAGE_INVALID_VALUE}`);r[a]=decodeURIComponent(u)}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)}};Fje.envDetector=new S7t});var Ibe=T(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.ATTR_WEBENGINE_VERSION=Jn.ATTR_WEBENGINE_NAME=Jn.ATTR_WEBENGINE_DESCRIPTION=Jn.ATTR_SERVICE_NAMESPACE=Jn.ATTR_SERVICE_INSTANCE_ID=Jn.ATTR_PROCESS_RUNTIME_VERSION=Jn.ATTR_PROCESS_RUNTIME_NAME=Jn.ATTR_PROCESS_RUNTIME_DESCRIPTION=Jn.ATTR_PROCESS_PID=Jn.ATTR_PROCESS_OWNER=Jn.ATTR_PROCESS_EXECUTABLE_PATH=Jn.ATTR_PROCESS_EXECUTABLE_NAME=Jn.ATTR_PROCESS_COMMAND_ARGS=Jn.ATTR_PROCESS_COMMAND=Jn.ATTR_OS_VERSION=Jn.ATTR_OS_TYPE=Jn.ATTR_K8S_POD_NAME=Jn.ATTR_K8S_NAMESPACE_NAME=Jn.ATTR_K8S_DEPLOYMENT_NAME=Jn.ATTR_K8S_CLUSTER_NAME=Jn.ATTR_HOST_TYPE=Jn.ATTR_HOST_NAME=Jn.ATTR_HOST_IMAGE_VERSION=Jn.ATTR_HOST_IMAGE_NAME=Jn.ATTR_HOST_IMAGE_ID=Jn.ATTR_HOST_ID=Jn.ATTR_HOST_ARCH=Jn.ATTR_CONTAINER_NAME=Jn.ATTR_CONTAINER_IMAGE_TAGS=Jn.ATTR_CONTAINER_IMAGE_NAME=Jn.ATTR_CONTAINER_ID=Jn.ATTR_CLOUD_REGION=Jn.ATTR_CLOUD_PROVIDER=Jn.ATTR_CLOUD_AVAILABILITY_ZONE=Jn.ATTR_CLOUD_ACCOUNT_ID=void 0;Jn.ATTR_CLOUD_ACCOUNT_ID="cloud.account.id";Jn.ATTR_CLOUD_AVAILABILITY_ZONE="cloud.availability_zone";Jn.ATTR_CLOUD_PROVIDER="cloud.provider";Jn.ATTR_CLOUD_REGION="cloud.region";Jn.ATTR_CONTAINER_ID="container.id";Jn.ATTR_CONTAINER_IMAGE_NAME="container.image.name";Jn.ATTR_CONTAINER_IMAGE_TAGS="container.image.tags";Jn.ATTR_CONTAINER_NAME="container.name";Jn.ATTR_HOST_ARCH="host.arch";Jn.ATTR_HOST_ID="host.id";Jn.ATTR_HOST_IMAGE_ID="host.image.id";Jn.ATTR_HOST_IMAGE_NAME="host.image.name";Jn.ATTR_HOST_IMAGE_VERSION="host.image.version";Jn.ATTR_HOST_NAME="host.name";Jn.ATTR_HOST_TYPE="host.type";Jn.ATTR_K8S_CLUSTER_NAME="k8s.cluster.name";Jn.ATTR_K8S_DEPLOYMENT_NAME="k8s.deployment.name";Jn.ATTR_K8S_NAMESPACE_NAME="k8s.namespace.name";Jn.ATTR_K8S_POD_NAME="k8s.pod.name";Jn.ATTR_OS_TYPE="os.type";Jn.ATTR_OS_VERSION="os.version";Jn.ATTR_PROCESS_COMMAND="process.command";Jn.ATTR_PROCESS_COMMAND_ARGS="process.command_args";Jn.ATTR_PROCESS_EXECUTABLE_NAME="process.executable.name";Jn.ATTR_PROCESS_EXECUTABLE_PATH="process.executable.path";Jn.ATTR_PROCESS_OWNER="process.owner";Jn.ATTR_PROCESS_PID="process.pid";Jn.ATTR_PROCESS_RUNTIME_DESCRIPTION="process.runtime.description";Jn.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name";Jn.ATTR_PROCESS_RUNTIME_VERSION="process.runtime.version";Jn.ATTR_SERVICE_INSTANCE_ID="service.instance.id";Jn.ATTR_SERVICE_NAMESPACE="service.namespace";Jn.ATTR_WEBENGINE_DESCRIPTION="webengine.description";Jn.ATTR_WEBENGINE_NAME="webengine.name";Jn.ATTR_WEBENGINE_VERSION="webengine.version"});var $je=T(Uje=>{"use strict";Object.defineProperty(Uje,"__esModule",{value:!0});Uje.execAsync=void 0;var JYo=Ae("child_process"),XYo=Ae("util");Uje.execAsync=XYo.promisify(JYo.exec)});var qin=T(jje=>{"use strict";Object.defineProperty(jje,"__esModule",{value:!0});jje.getMachineId=void 0;var ZYo=$je(),eKo=(Xt(),bt(cr));async function tKo(){try{let e=(await(0,ZYo.execAsync)('ioreg -rd1 -c "IOPlatformExpertDevice"')).stdout.split(`
|
|
487
|
-
`).find(n=>n.includes("IOPlatformUUID"));if(!e)return;let r=e.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(t){eKo.diag.debug(`error reading machine id: ${t}`)}}jje.getMachineId=tKo});var Hin=T(Qje=>{"use strict";Object.defineProperty(Qje,"__esModule",{value:!0});Qje.getMachineId=void 0;var rKo=Ae("fs"),nKo=(Xt(),bt(cr));async function iKo(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await rKo.promises.readFile(e,{encoding:"utf8"})).trim()}catch(r){nKo.diag.debug(`error reading machine id: ${r}`)}}Qje.getMachineId=iKo});var Win=T(Gje=>{"use strict";Object.defineProperty(Gje,"__esModule",{value:!0});Gje.getMachineId=void 0;var oKo=Ae("fs"),sKo=$je(),Vin=(Xt(),bt(cr));async function aKo(){try{return(await oKo.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){Vin.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,sKo.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){Vin.diag.debug(`error reading machine id: ${t}`)}}Gje.getMachineId=aKo});var Yin=T(qje=>{"use strict";Object.defineProperty(qje,"__esModule",{value:!0});qje.getMachineId=void 0;var zin=Ae("process"),uKo=$je(),cKo=(Xt(),bt(cr));async function lKo(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";zin.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in zin.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let n=(await(0,uKo.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(n.length===2)return n[1].trim()}catch(r){cKo.diag.debug(`error reading machine id: ${r}`)}}qje.getMachineId=lKo});var Kin=T(Hje=>{"use strict";Object.defineProperty(Hje,"__esModule",{value:!0});Hje.getMachineId=void 0;var mKo=(Xt(),bt(cr));async function dKo(){mKo.diag.debug("could not read machine-id: unsupported platform")}Hje.getMachineId=dKo});var Jin=T(Vje=>{"use strict";Object.defineProperty(Vje,"__esModule",{value:!0});Vje.getMachineId=void 0;var fKo=Ae("process"),xq;async function pKo(){if(!xq)switch(fKo.platform){case"darwin":xq=(await Promise.resolve().then(()=>Se(qin()))).getMachineId;break;case"linux":xq=(await Promise.resolve().then(()=>Se(Hin()))).getMachineId;break;case"freebsd":xq=(await Promise.resolve().then(()=>Se(Win()))).getMachineId;break;case"win32":xq=(await Promise.resolve().then(()=>Se(Yin()))).getMachineId;break;default:xq=(await Promise.resolve().then(()=>Se(Kin()))).getMachineId;break}return xq()}Vje.getMachineId=pKo});var w7t=T(Kre=>{"use strict";Object.defineProperty(Kre,"__esModule",{value:!0});Kre.normalizeType=Kre.normalizeArch=void 0;var hKo=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};Kre.normalizeArch=hKo;var gKo=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};Kre.normalizeType=gKo});var Zin=T(Wje=>{"use strict";Object.defineProperty(Wje,"__esModule",{value:!0});Wje.hostDetector=void 0;var x7t=Ibe(),Xin=Ae("os"),bKo=Jin(),AKo=w7t(),T7t=class{detect(e){return{attributes:{[x7t.ATTR_HOST_NAME]:(0,Xin.hostname)(),[x7t.ATTR_HOST_ARCH]:(0,AKo.normalizeArch)((0,Xin.arch)()),[x7t.ATTR_HOST_ID]:(0,bKo.getMachineId)()}}}};Wje.hostDetector=new T7t});var ron=T(zje=>{"use strict";Object.defineProperty(zje,"__esModule",{value:!0});zje.osDetector=void 0;var eon=Ibe(),ton=Ae("os"),yKo=w7t(),D7t=class{detect(e){return{attributes:{[eon.ATTR_OS_TYPE]:(0,yKo.normalizeType)((0,ton.platform)()),[eon.ATTR_OS_VERSION]:(0,ton.release)()}}}};zje.osDetector=new D7t});var non=T(Yje=>{"use strict";Object.defineProperty(Yje,"__esModule",{value:!0});Yje.processDetector=void 0;var _Ko=(Xt(),bt(cr)),xR=Ibe(),EKo=Ae("os"),I7t=class{detect(e){let r={[xR.ATTR_PROCESS_PID]:process.pid,[xR.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[xR.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[xR.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[xR.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[xR.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[xR.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(r[xR.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=EKo.userInfo();r[xR.ATTR_PROCESS_OWNER]=n.username}catch(n){_Ko.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:r}}};Yje.processDetector=new I7t});var ion=T(Kje=>{"use strict";Object.defineProperty(Kje,"__esModule",{value:!0});Kje.serviceInstanceIdDetector=void 0;var vKo=Ibe(),CKo=Ae("crypto"),R7t=class{detect(e){return{attributes:{[vKo.ATTR_SERVICE_INSTANCE_ID]:(0,CKo.randomUUID)()}}}};Kje.serviceInstanceIdDetector=new R7t});var oon=T(Kx=>{"use strict";Object.defineProperty(Kx,"__esModule",{value:!0});Kx.serviceInstanceIdDetector=Kx.processDetector=Kx.osDetector=Kx.hostDetector=void 0;var SKo=Zin();Object.defineProperty(Kx,"hostDetector",{enumerable:!0,get:function(){return SKo.hostDetector}});var wKo=ron();Object.defineProperty(Kx,"osDetector",{enumerable:!0,get:function(){return wKo.osDetector}});var xKo=non();Object.defineProperty(Kx,"processDetector",{enumerable:!0,get:function(){return xKo.processDetector}});var TKo=ion();Object.defineProperty(Kx,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return TKo.serviceInstanceIdDetector}})});var son=T(Jx=>{"use strict";Object.defineProperty(Jx,"__esModule",{value:!0});Jx.serviceInstanceIdDetector=Jx.processDetector=Jx.osDetector=Jx.hostDetector=void 0;var Jje=oon();Object.defineProperty(Jx,"hostDetector",{enumerable:!0,get:function(){return Jje.hostDetector}});Object.defineProperty(Jx,"osDetector",{enumerable:!0,get:function(){return Jje.osDetector}});Object.defineProperty(Jx,"processDetector",{enumerable:!0,get:function(){return Jje.processDetector}});Object.defineProperty(Jx,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Jje.serviceInstanceIdDetector}})});var aon=T(Jre=>{"use strict";Object.defineProperty(Jre,"__esModule",{value:!0});Jre.noopDetector=Jre.NoopDetector=void 0;var Xje=class{detect(){return{attributes:{}}}};Jre.NoopDetector=Xje;Jre.noopDetector=new Xje});var uon=T(n8=>{"use strict";Object.defineProperty(n8,"__esModule",{value:!0});n8.noopDetector=n8.serviceInstanceIdDetector=n8.processDetector=n8.osDetector=n8.hostDetector=n8.envDetector=void 0;var DKo=Gin();Object.defineProperty(n8,"envDetector",{enumerable:!0,get:function(){return DKo.envDetector}});var Zje=son();Object.defineProperty(n8,"hostDetector",{enumerable:!0,get:function(){return Zje.hostDetector}});Object.defineProperty(n8,"osDetector",{enumerable:!0,get:function(){return Zje.osDetector}});Object.defineProperty(n8,"processDetector",{enumerable:!0,get:function(){return Zje.processDetector}});Object.defineProperty(n8,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Zje.serviceInstanceIdDetector}});var IKo=aon();Object.defineProperty(n8,"noopDetector",{enumerable:!0,get:function(){return IKo.noopDetector}})});var con=T(i1=>{"use strict";Object.defineProperty(i1,"__esModule",{value:!0});i1.defaultServiceName=i1.emptyResource=i1.defaultResource=i1.resourceFromAttributes=i1.serviceInstanceIdDetector=i1.processDetector=i1.osDetector=i1.hostDetector=i1.envDetector=i1.detectResources=void 0;var RKo=jin();Object.defineProperty(i1,"detectResources",{enumerable:!0,get:function(){return RKo.detectResources}});var Rbe=uon();Object.defineProperty(i1,"envDetector",{enumerable:!0,get:function(){return Rbe.envDetector}});Object.defineProperty(i1,"hostDetector",{enumerable:!0,get:function(){return Rbe.hostDetector}});Object.defineProperty(i1,"osDetector",{enumerable:!0,get:function(){return Rbe.osDetector}});Object.defineProperty(i1,"processDetector",{enumerable:!0,get:function(){return Rbe.processDetector}});Object.defineProperty(i1,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Rbe.serviceInstanceIdDetector}});var k7t=v7t();Object.defineProperty(i1,"resourceFromAttributes",{enumerable:!0,get:function(){return k7t.resourceFromAttributes}});Object.defineProperty(i1,"defaultResource",{enumerable:!0,get:function(){return k7t.defaultResource}});Object.defineProperty(i1,"emptyResource",{enumerable:!0,get:function(){return k7t.emptyResource}});var kKo=y7t();Object.defineProperty(i1,"defaultServiceName",{enumerable:!0,get:function(){return kKo.defaultServiceName}})});var lon=T(tQe=>{"use strict";Object.defineProperty(tQe,"__esModule",{value:!0});tQe.LogRecordImpl=void 0;var Tq=(Xt(),bt(cr)),eQe=J4(),O7t=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:o,observedTimestamp:s,eventName:a,severityNumber:u,severityText:c,body:m,attributes:d={},context:f}=n,p=Date.now();if(this.hrTime=(0,eQe.timeInputToHrTime)(o??p),this.hrTimeObserved=(0,eQe.timeInputToHrTime)(s??p),f){let h=Tq.trace.getSpanContext(f);h&&Tq.isSpanContextValid(h)&&(this.spanContext=h)}this.severityNumber=u,this.severityText=c,this.body=m,this.resource=e.resource,this.instrumentationScope=r,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(d)}setAttribute(e,r){return this._isLogRecordReadonly()?this:r===null?this:e.length===0?(Tq.diag.warn(`Invalid attribute key: ${e}`),this):!(0,eQe.isAttributeValue)(r)&&!(typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length>0)?(Tq.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&&Tq.diag.warn("Dropping extra attributes."),this):((0,eQe.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?(Tq.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&&Tq.diag.warn("Can not execute the operation on emitted log record"),this._isReadonly}};tQe.LogRecordImpl=O7t});var mon=T(rQe=>{"use strict";Object.defineProperty(rQe,"__esModule",{value:!0});rQe.Logger=void 0;var OKo=(Xt(),bt(cr)),NKo=lon(),N7t=class{instrumentationScope;_sharedState;constructor(e,r){this.instrumentationScope=e,this._sharedState=r}emit(e){let r=e.context||OKo.context.active(),n=new NKo.LogRecordImpl(this._sharedState,this.instrumentationScope,{context:r,...e});this._sharedState.activeProcessor.onEmit(n,r),n._makeReadonly()}};rQe.Logger=N7t});var don=T(Zre=>{"use strict";Object.defineProperty(Zre,"__esModule",{value:!0});Zre.reconfigureLimits=Zre.loadDefaultConfig=void 0;var Xre=J4();function PKo(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:(0,Xre.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,Xre.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??128},includeTraceContext:!0}}Zre.loadDefaultConfig=PKo;function BKo(t){return{attributeCountLimit:t.attributeCountLimit??(0,Xre.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??(0,Xre.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128,attributeValueLengthLimit:t.attributeValueLengthLimit??(0,Xre.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,Xre.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0}}Zre.reconfigureLimits=BKo});var B7t=T(nQe=>{"use strict";Object.defineProperty(nQe,"__esModule",{value:!0});nQe.NoopLogRecordProcessor=void 0;var P7t=class{forceFlush(){return Promise.resolve()}onEmit(e,r){}shutdown(){return Promise.resolve()}};nQe.NoopLogRecordProcessor=P7t});var fon=T(iQe=>{"use strict";Object.defineProperty(iQe,"__esModule",{value:!0});iQe.MultiLogRecordProcessor=void 0;var LKo=J4(),L7t=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,LKo.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()))}};iQe.MultiLogRecordProcessor=L7t});var pon=T(oQe=>{"use strict";Object.defineProperty(oQe,"__esModule",{value:!0});oQe.LoggerProviderSharedState=void 0;var MKo=B7t(),FKo=fon(),M7t=class{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,r,n,o){this.resource=e,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=o,o.length>0?(this.registeredLogRecordProcessors=o,this.activeProcessor=new FKo.MultiLogRecordProcessor(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new MKo.NoopLogRecordProcessor}};oQe.LoggerProviderSharedState=M7t});var bon=T(Dq=>{"use strict";Object.defineProperty(Dq,"__esModule",{value:!0});Dq.LoggerProvider=Dq.DEFAULT_LOGGER_NAME=void 0;var sQe=(Xt(),bt(cr)),UKo=Rnn(),$Ko=con(),hon=J4(),jKo=mon(),gon=don(),QKo=pon();Dq.DEFAULT_LOGGER_NAME="unknown";var F7t=class{_shutdownOnce;_sharedState;constructor(e={}){let r=(0,hon.merge)({},(0,gon.loadDefaultConfig)(),e),n=e.resource??(0,$Ko.defaultResource)();this._sharedState=new QKo.LoggerProviderSharedState(n,r.forceFlushTimeoutMillis,(0,gon.reconfigureLimits)(r.logRecordLimits),e?.processors??[]),this._shutdownOnce=new hon.BindOnceFuture(this._shutdown,this)}getLogger(e,r,n){if(this._shutdownOnce.isCalled)return sQe.diag.warn("A shutdown LoggerProvider cannot provide a Logger"),UKo.NOOP_LOGGER;e||sQe.diag.warn("Logger requested without instrumentation scope name.");let o=e||Dq.DEFAULT_LOGGER_NAME,s=`${o}@${r||""}:${n?.schemaUrl||""}`;return this._sharedState.loggers.has(s)||this._sharedState.loggers.set(s,new jKo.Logger({name:o,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(s)}forceFlush(){return this._shutdownOnce.isCalled?(sQe.diag.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(sQe.diag.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};Dq.LoggerProvider=F7t});var yon=T(aQe=>{"use strict";Object.defineProperty(aQe,"__esModule",{value:!0});aQe.ConsoleLogRecordExporter=void 0;var Aon=J4(),U7t=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,Aon.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:Aon.ExportResultCode.SUCCESS})}};aQe.ConsoleLogRecordExporter=U7t});var _on=T(uQe=>{"use strict";Object.defineProperty(uQe,"__esModule",{value:!0});uQe.SimpleLogRecordProcessor=void 0;var ene=J4(),$7t=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new ene.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let r=()=>ene.internal._export(this._exporter,[e]).then(n=>{n.code!==ene.ExportResultCode.SUCCESS&&(0,ene.globalErrorHandler)(n.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${n})`))}).catch(ene.globalErrorHandler);if(e.resource.asyncAttributesPending){let n=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(n),r()),ene.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()}};uQe.SimpleLogRecordProcessor=$7t});var von=T(cQe=>{"use strict";Object.defineProperty(cQe,"__esModule",{value:!0});cQe.InMemoryLogRecordExporter=void 0;var Eon=J4(),j7t=class{_finishedLogRecords=[];_stopped=!1;export(e,r){if(this._stopped)return r({code:Eon.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),r({code:Eon.ExportResultCode.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}};cQe.InMemoryLogRecordExporter=j7t});var Con=T(lQe=>{"use strict";Object.defineProperty(lQe,"__esModule",{value:!0});lQe.BatchLogRecordProcessorBase=void 0;var GKo=(Xt(),bt(cr)),B_=J4(),Q7t=class{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,r){this._exporter=e,this._maxExportBatchSize=r?.maxExportBatchSize??(0,B_.getNumberFromEnv)("OTEL_BLRP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=r?.maxQueueSize??(0,B_.getNumberFromEnv)("OTEL_BLRP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??(0,B_.getNumberFromEnv)("OTEL_BLRP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??(0,B_.getNumberFromEnv)("OTEL_BLRP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new B_.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(GKo.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=[],o=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let s=0;s<o;s++)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,B_.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,B_.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=()=>B_.internal._export(this._exporter,e).then(o=>{o.code!==B_.ExportResultCode.SUCCESS&&(0,B_.globalErrorHandler)(o.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${o})`))}).catch(B_.globalErrorHandler),n=e.map(o=>o.resource).filter(o=>o.asyncAttributesPending);return n.length===0?r():Promise.all(n.map(o=>o.waitForAsyncAttributes?.())).then(r,B_.globalErrorHandler)}};lQe.BatchLogRecordProcessorBase=Q7t});var Son=T(mQe=>{"use strict";Object.defineProperty(mQe,"__esModule",{value:!0});mQe.BatchLogRecordProcessor=void 0;var qKo=Con(),G7t=class extends qKo.BatchLogRecordProcessorBase{onShutdown(){}};mQe.BatchLogRecordProcessor=G7t});var won=T(dQe=>{"use strict";Object.defineProperty(dQe,"__esModule",{value:!0});dQe.BatchLogRecordProcessor=void 0;var HKo=Son();Object.defineProperty(dQe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return HKo.BatchLogRecordProcessor}})});var xon=T(fQe=>{"use strict";Object.defineProperty(fQe,"__esModule",{value:!0});fQe.BatchLogRecordProcessor=void 0;var VKo=won();Object.defineProperty(fQe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return VKo.BatchLogRecordProcessor}})});var Ton=T(i8=>{"use strict";Object.defineProperty(i8,"__esModule",{value:!0});i8.BatchLogRecordProcessor=i8.InMemoryLogRecordExporter=i8.SimpleLogRecordProcessor=i8.ConsoleLogRecordExporter=i8.NoopLogRecordProcessor=i8.LoggerProvider=void 0;var WKo=bon();Object.defineProperty(i8,"LoggerProvider",{enumerable:!0,get:function(){return WKo.LoggerProvider}});var zKo=B7t();Object.defineProperty(i8,"NoopLogRecordProcessor",{enumerable:!0,get:function(){return zKo.NoopLogRecordProcessor}});var YKo=yon();Object.defineProperty(i8,"ConsoleLogRecordExporter",{enumerable:!0,get:function(){return YKo.ConsoleLogRecordExporter}});var KKo=_on();Object.defineProperty(i8,"SimpleLogRecordProcessor",{enumerable:!0,get:function(){return KKo.SimpleLogRecordProcessor}});var JKo=von();Object.defineProperty(i8,"InMemoryLogRecordExporter",{enumerable:!0,get:function(){return JKo.InMemoryLogRecordExporter}});var XKo=xon();Object.defineProperty(i8,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return XKo.BatchLogRecordProcessor}})});var If,Don,kbe,Ion,Obe,Nbe,Ron,kon,Oon,Non,Pon,Bon,Lon,Mon,Fon,Uon,$on,jon,Qon,Gon,qon,Hon,Von,Won,zon,Yon,Kon,Jon,Xon,Zon,esn,tsn,rsn,nsn,isn,osn,ssn,asn,usn,csn,lsn,msn,dsn,fsn,psn,tne=j(()=>{"use strict";If="iflow-cli",Don="iflow_cli.user_prompt",kbe="iflow_cli.tool_call",Ion="iflow_cli.api_request",Obe="iflow_cli.api_error",Nbe="iflow_cli.api_response",Ron="iflow_cli.config",kon="iflow_cli.flash_fallback",Oon="iflow_cli.next_speaker_check",Non="iflow_cli.slash_command",Pon="iflow_cli.cli_response",Bon="iflow_cli.tool.call.count",Lon="iflow_cli.tool.call.latency",Mon="iflow_cli.mcp.tool.call.count",Fon="iflow_cli.mcp.tool.call.latency",Uon="iflow_cli.builtin.tool.call.count",$on="iflow_cli.builtin.tool.call.latency",jon="gen_ai.client.operation",Qon="gen_ai.client.operation.duration",Gon="gen_ai.client.token.usage",qon="iflow_cli.session.count",Hon="iflow_cli.file.operation.count",Von="iflow_cli.user_request.count",Won="iflow_cli.user_request.latency",zon="iflow_cli.user_experience.success",Yon="iflow_cli.user.identity",Kon="iflow_cli.scheduler.lock.error",Jon="iflow_cli.mcp.connect.count",Xon="iflow_cli.loop.detection.count",Zon="iflow_cli.paste.operation.count",esn="iflow_cli.paste.operation.latency",tsn="iflow_cli.xinliu.web.search.count",rsn="iflow_cli.xinliu.web.search.latency",nsn="iflow_cli.web.fetch.count",isn="iflow_cli.web.fetch.latency",osn="iflow_cli.approval.mode.count",ssn="iflow_cli.compression.lightweight.count",asn="iflow_cli.compression.lightweight.ratio",usn="iflow_cli.compression.full.count",csn="iflow_cli.compression.full.ratio",lsn="iflow_cli.low_token_no_compression.count",msn="iflow_cli.smart_approval.blacklist.block.count",dsn="iflow_cli.smart_approval.blacklist.user_action.count",fsn="iflow_cli.smart_approval.ai_review.count",psn="iflow_cli.smart_approval.ai_risky.user_action.count"});var rne,nne,ine,one,sne,ane,une,cne,lne,mne,X4,Z4,hsn=j(()=>{"use strict";rne="iflow_cli.cpu.usage_percentage",nne="iflow_cli.cpu.user_percentage",ine="iflow_cli.cpu.system_percentage",one="iflow_cli.cpu.cores",sne="iflow_cli.memory.heap_used",ane="iflow_cli.memory.heap_total",une="iflow_cli.memory.rss",cne="iflow_cli.memory.external",lne="iflow_cli.memory.system_usage_percentage",mne="iflow_cli.memory.process_usage_percentage",X4={[rne]:"CPU usage percentage",[nne]:"CPU user time percentage",[ine]:"CPU system time percentage",[one]:"Number of CPU cores",[sne]:"Heap memory used in bytes",[ane]:"Heap memory total in bytes",[une]:"Resident Set Size in bytes",[cne]:"External memory in bytes",[lne]:"System memory usage percentage",[mne]:"Process memory usage percentage relative to Node.js limits"},Z4={[rne]:"percent",[nne]:"percent",[ine]:"percent",[one]:"cores",[sne]:"bytes",[ane]:"bytes",[une]:"bytes",[cne]:"bytes",[lne]:"percent",[mne]:"percent"}});import*as eC from"os";var pQe,gsn=j(()=>{"use strict";hsn();pQe=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=eC.cpus().length,this.totalSystemMemory=eC.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 o=Math.max(0,e.user+e.system),s=Math.max(0,e.user),a=Math.max(0,e.system),u=o/(n*1e3)*100,c=s/(n*1e3)*100,m=a/(n*1e3)*100,d=Number.isFinite(u)?Math.min(100,Math.max(0,u)):0,f=Number.isFinite(c)?Math.min(100,Math.max(0,c)):0,p=Number.isFinite(m)?Math.min(100,Math.max(0,m)):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=eC.freemem(),o=(this.totalSystemMemory-r)/this.totalSystemMemory*100,s=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,o)),processUsage:Math.min(100,Math.max(0,s))}}catch{return{heapUsed:0,heapTotal:0,rss:0,external:0,systemUsage:0,processUsage:0}}}initializeMetrics(){let e=eC.platform(),r=eC.arch(),n=process.version;this.options.enableCpuMetrics&&(this.cpuUsageGauge=this.meter.createObservableGauge(rne,{description:X4[rne],unit:Z4[rne]}),this.cpuUserGauge=this.meter.createObservableGauge(nne,{description:X4[nne],unit:Z4[nne]}),this.cpuSystemGauge=this.meter.createObservableGauge(ine,{description:X4[ine],unit:Z4[ine]}),this.cpuCoresGauge=this.meter.createObservableGauge(one,{description:X4[one],unit:Z4[one]}),this.cpuUsageGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.usage,{platform:e,arch:r,node_version:n})}),this.cpuUserGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.user,{platform:e,arch:r,node_version:n})}),this.cpuSystemGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.system,{platform:e,arch:r,node_version:n})}),this.cpuCoresGauge?.addCallback(o=>{o.observe(this.cpuCores,{platform:e,arch:r})})),this.options.enableMemoryMetrics&&(this.memoryHeapUsedGauge=this.meter.createObservableGauge(sne,{description:X4[sne],unit:Z4[sne]}),this.memoryHeapTotalGauge=this.meter.createObservableGauge(ane,{description:X4[ane],unit:Z4[ane]}),this.memoryRssGauge=this.meter.createObservableGauge(une,{description:X4[une],unit:Z4[une]}),this.memoryExternalGauge=this.meter.createObservableGauge(cne,{description:X4[cne],unit:Z4[cne]}),this.memorySystemUsageGauge=this.meter.createObservableGauge(lne,{description:X4[lne],unit:Z4[lne]}),this.memoryProcessUsageGauge=this.meter.createObservableGauge(mne,{description:X4[mne],unit:Z4[mne]}),this.memoryHeapUsedGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.heapUsed,{platform:e,arch:r,node_version:n})}),this.memoryHeapTotalGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.heapTotal,{platform:e,arch:r,node_version:n})}),this.memoryRssGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.rss,{platform:e,arch:r,node_version:n})}),this.memoryExternalGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.external,{platform:e,arch:r,node_version:n})}),this.memorySystemUsageGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.systemUsage,{platform:e,arch:r,node_version:n})}),this.memoryProcessUsageGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.processUsage,{platform:e,arch:r,node_version:n,memory_limit_mb:Math.round(this.nodeJSMemoryLimit/(1024*1024)).toString()})}))}getNodeJSMemoryLimit(){let e=process.execArgv.find(o=>o.startsWith("--max-old-space-size="))?.split("=")[1];if(e){let o=parseInt(e,10);if(!isNaN(o)&&o>0)return o*1024*1024}let r=process.execArgv.find(o=>o.startsWith("--max_old_space_size="))?.split("=")[1];if(r){let o=parseInt(r,10);if(!isNaN(o)&&o>0)return o*1024*1024}let n=eC.arch();return n==="x64"||n==="arm64"?1400*1024*1024:700*1024*1024}}});function bsn(t,e={}){if(hQe)return hQe;let r={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...e};return hQe=new pQe(t,r),hQe}var hQe,Asn=j(()=>{"use strict";gsn();hQe=null});import ZKo from"os";function ysn(){try{let t=ZKo.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 _sn=j(()=>{"use strict"});import*as dne from"os";import*as gQe from"fs";function Ba(t){let e="0.5.8-beta-20260211",r=process.env.IFLOW_ENV||"normal",n={darwin:"macOS",win32:"Windows",linux:"Linux",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX"},o=dne.platform(),s=n[o]||o,a="unknown";try{if(o==="darwin")a=dne.release();else if(o==="linux")try{if(gQe.existsSync("/etc/os-release")){let h=gQe.readFileSync("/etc/os-release","utf8").match(/^PRETTY_NAME="(.+)"/m);h&&(a=h[1])}}catch{a=dne.release()}else o==="win32"&&(a=dne.release())}catch{a="unknown"}let u={name:"Node.js",version:process.version,architecture:process.arch},c=t.getModel()||"unknown",m=t.getUsageMode(),d=!1,f=t.getContentGeneratorConfig?.();if(f){let p=f.authType,h=f.baseUrl||"";(p===er.LOGIN_WITH_IFLOW||p===er.IFLOW||p===er.OPENAI_COMPATIBLE&&h.includes("apis.iflow.cn"))&&(d=!0)}return{app_name:If,tenant__:"gen_ai",version:e,platform:s,os_model:a,runtime_name:u.name,runtime_version:u.version,runtime_architecture:u.architecture,model_name:c,is_iflow_open_user:String(d),ip:ysn(),iflow_env:r,usage_mode:m}}var q7t=j(()=>{"use strict";K9();_sn();tne()});function Esn(){return H7t||(H7t=m3e.getMeter(If)),H7t}function vsn(){if(vl)return;let t=Esn();if(t){try{bsn(t,{enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0})}catch{}V7t=t.createHistogram(Bon,{description:"Counts tool calls, tagged by function name and success.",unit:"count",valueType:na.INT}),W7t=t.createHistogram(Lon,{description:"Latency of tool calls in milliseconds.",unit:"ms",valueType:na.INT}),z7t=t.createHistogram(Mon,{description:"Counts MCP tool calls, tagged by function name and success.",unit:"count",valueType:na.INT}),Y7t=t.createHistogram(Fon,{description:"Latency of MCP tool calls in milliseconds.",unit:"ms",valueType:na.INT}),K7t=t.createHistogram(Uon,{description:"Counts built-in tool calls, tagged by function name and success.",unit:"count",valueType:na.INT}),J7t=t.createHistogram($on,{description:"Latency of built-in tool calls in milliseconds.",unit:"ms",valueType:na.INT}),Pbe=t.createHistogram(jon,{description:"Counts API requests, tagged by model and status.",unit:"count",valueType:na.INT}),Bbe=t.createHistogram(Qon,{description:"Latency of API requests in milliseconds.",unit:"ms",valueType:na.INT}),X7t=t.createHistogram(Gon,{description:"Counts the total number of tokens used.",unit:"tokens",valueType:na.INT}),Z7t=t.createHistogram(Hon,{description:"Counts file operations (create, read, update).",unit:"count",valueType:na.INT}),eRt=t.createHistogram(Von,{description:"Counts user requests from prompt to completion.",unit:"count",valueType:na.INT}),tRt=t.createHistogram(Won,{description:"End-to-end latency of user requests in milliseconds.",unit:"ms",valueType:na.INT}),rRt=t.createHistogram(zon,{description:"User experience success rate - counts successful user experiences including retries and fixes.",unit:"count",valueType:na.INT}),nRt=t.createHistogram(Yon,{description:"User identity for tracking unique installations.",unit:"count",valueType:na.INT}),iRt=t.createHistogram(Kon,{description:"Counts tool scheduler lock errors when new calls are blocked by running calls.",unit:"count",valueType:na.INT}),oRt=t.createHistogram(Jon,{description:"Counts MCP connection attempts and their success/failure status.",unit:"count",valueType:na.INT}),sRt=t.createHistogram(Xon,{description:"Counts loop detection events by loop type.",unit:"count",valueType:na.INT}),aRt=t.createHistogram(Zon,{description:"Counts paste operations, tagged by type and success.",unit:"count",valueType:na.INT}),uRt=t.createHistogram(esn,{description:"Latency of paste operations in milliseconds.",unit:"ms",valueType:na.INT}),cRt=t.createHistogram(tsn,{description:"Counts xinliu web search operations, tagged by success and error type.",unit:"count",valueType:na.INT}),lRt=t.createHistogram(rsn,{description:"Latency of xinliu web search operations in milliseconds.",unit:"ms",valueType:na.INT}),mRt=t.createHistogram(nsn,{description:"Counts web fetch operations, tagged by success and error type.",unit:"count",valueType:na.INT}),dRt=t.createHistogram(isn,{description:"Latency of web fetch operations in milliseconds.",unit:"ms",valueType:na.INT}),fRt=t.createHistogram(osn,{description:"Counts usage of different approval modes.",unit:"count",valueType:na.INT}),pRt=t.createHistogram(ssn,{description:"Counts lightweight compression triggers, tagged by executed status and skip reason.",unit:"count",valueType:na.INT}),hRt=t.createHistogram(asn,{description:"Histogram of lightweight compression token reduction ratios (reduced_tokens / original_tokens).",unit:"ratio",valueType:na.DOUBLE}),gRt=t.createHistogram(usn,{description:"Counts full compression triggers, tagged by triggered_by and had_lightweight_before.",unit:"count",valueType:na.INT}),bRt=t.createHistogram(csn,{description:"Histogram of full compression token reduction ratios (reduced_tokens / original_tokens).",unit:"ratio",valueType:na.DOUBLE}),ARt=t.createHistogram(lsn,{description:"Counts API calls when token remaining < 20% without compression triggered.",unit:"count",valueType:na.INT}),yRt=t.createHistogram(msn,{description:"Counts blacklist blocks in smart approval, tagged by function name and risk level.",unit:"count",valueType:na.INT}),_Rt=t.createHistogram(dsn,{description:"Counts user actions after blacklist block, tagged by function name and action (execute/cancel).",unit:"count",valueType:na.INT}),ERt=t.createHistogram(fsn,{description:"Counts AI review operations in smart approval, tagged by function name and decision (safe/risky).",unit:"count",valueType:na.INT}),vRt=t.createHistogram(psn,{description:"Counts user actions after AI judges risky, tagged by function name and action (execute/cancel).",unit:"count",valueType:na.INT}),vl=!0}}function bQe(t){let e=Esn();if(!e||!vl)return;e.createHistogram(qon,{description:"Count of CLI sessions started.",unit:"count",valueType:na.INT}).record(1,Ba(t))}function Csn(t,e,r,n,o,s){if(!V7t||!W7t||!vl)return;let a={...Ba(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};V7t.record(1,a),W7t.record(r,{...Ba(t),function_name:e??"unknown",tool_type:s??"unknown"})}function Ssn(t,e,r,n,o,s){if(!z7t||!Y7t||!vl)return;let a={...Ba(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};s&&(a.execution_context=s),z7t.record(1,a),Y7t.record(r,{...Ba(t),function_name:e??"unknown",execution_context:s??"unknown"})}function wsn(t,e,r,n,o,s){if(!K7t||!J7t||!vl)return;let a={...Ba(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};s&&(a.execution_context=s),K7t.record(1,a),J7t.record(r,{...Ba(t),function_name:e??"unknown",execution_context:s??"unknown"})}function fne(t,e,r,n){!X7t||!vl||X7t.record(r,{...Ba(t),model:e??"unknown",type:n??"unknown"})}function xsn(t,e,r,n,o,s,a,u){if(!Pbe||!Bbe||!vl)return;let c={...Ba(t),model:e??"unknown",status_code:String(n??(o?"error":"ok"))};a!==void 0&&(c.http_status_code=String(a)),u!==void 0&&(c.business_code=String(u)),s&&(c.finish_reason=s),Pbe.record(1,c);let m={...Ba(t),model:e??"unknown",http_status_code:String(a??200),finish_reason:s??"unknown"};u!=null&&(m.business_code=String(u)),Bbe.record(r,m)}function Tsn(t,e,r,n,o,s,a){if(!Pbe||!Bbe||!vl)return;let u={...Ba(t),model:e??"unknown",status_code:String(n??"error"),error:o??"unknown"};s!==void 0&&(u.http_status_code=String(s)),a!==void 0&&(u.business_code=String(a)),Pbe.record(1,u);let c={...Ba(t),model:e??"unknown",http_status_code:String(s??0),error:o??"unknown"};a!=null&&(c.business_code=String(a)),Bbe.record(r,c)}function TR(t,e,r,n,o){if(!Z7t||!vl)return;let s={...Ba(t),operation:e};r!==void 0&&(s.lines=String(r)),n!==void 0&&(s.mimetype=n),o!==void 0&&(s.extension=o),Z7t.record(1,s)}function Dsn(t,e,r,n,o){if(!eRt||!tRt||!vl)return;let s={...Ba(t),prompt_id:e,success:String(n)};o&&(s.error=o),eRt.record(1,s),tRt.record(r,s)}function CRt(t,e,r=!1,n=!1,o){if(!rRt||!vl)return;let s={...Ba(t),success:String(e),had_retries:String(r),had_fixes:String(n)};o&&(s.final_error=o),rRt.record(1,s)}function Isn(t,e){if(!nRt||!vl)return;let r={...Ba(t),user_id:e};nRt.record(1,r)}function Rsn(t,e,r){if(!iRt||!vl)return;let n={...Ba(t),running_calls_count:String(e)};r.forEach((o,s)=>{n[`call_${s}_name`]=o.name,n[`call_${s}_status`]=o.status}),iRt.record(1,n)}function SRt(t,e,r,n,o){if(!oRt||!vl)return;let s={...Ba(t),server_name:e,success:String(r)};n&&(s.error_type=n),o&&(s.transport_type=o),oRt.record(1,s)}function ksn(t,e,r){if(!sRt||!vl)return;let n={...Ba(t),loop_type:e,prompt_id:r};sRt.record(1,n)}function AQe(t,e,r,n,o="text",s,a){if(!aRt||!uRt||!vl)return;let u={};try{u=Ba(t)}catch{u={app_name:If,tenant__:"gen_ai",version:"unknown",platform:a||"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={...u,success:String(n),paste_type:o};s&&(c.error_type=s),a&&(c.platform_specific=a),aRt.record(1,c);let m={...u,paste_type:o,text_length_range:String(r),performance_ratio:eJo(e,r)};uRt.record(e,m)}function eJo(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"}function zB(t,e,r,n,o,s){if(!cRt||!lRt||!vl)return;let a={...Ba(t),success:String(r)};n&&(a.error_type=n),o!==void 0&&(a.results_count=String(o)),s&&(a.query_length=String(s.length)),cRt.record(1,a),lRt.record(e,{...Ba(t),error_type:n??"none"})}function Iq(t,e,r,n,o,s){if(!mRt||!dRt||!vl)return;let a={...Ba(t),success:String(r)};n&&(a.error_type=n),o!==void 0&&(a.url_count=String(o)),s!==void 0&&(a.prompt_length=String(s)),mRt.record(1,a),dRt.record(e,{...Ba(t),error_type:n??"none"})}function yQe(t,e){if(!fRt||!vl)return;let r={...Ba(t),approval_mode:e};fRt.record(1,r)}function pne(t,e,r,n){if(!pRt||!vl)return;let o={...Ba(t),executed:String(e),triggered_by:r};n&&(o.skipped_reason=n),pRt.record(1,o)}function _Qe(t,e,r,n){if(!hRt||!vl)return;let o=e-r,s=e>0?o/e:0,a={...Ba(t),original_tokens:String(e),compressed_tokens:String(r),reduced_tokens:String(o),removed_tool_calls:String(n)};hRt.record(s,a)}function hne(t,e,r,n){if(!gRt||!vl)return;let o={...Ba(t),executed:String(e),triggered_by:r,had_lightweight_before:String(n)};gRt.record(1,o)}function EQe(t,e,r,n,o){if(!bRt||!vl)return;let s=e-r,a=e>0?s/e:0,u={...Ba(t),original_tokens:String(e),compressed_tokens:String(r),reduced_tokens:String(s),had_lightweight_before:String(n),recovered_files_count:String(o)};bRt.record(a,u)}function vQe(t,e,r,n){if(!ARt||!vl)return;let o=(1-n)*100,s={...Ba(t),token_count:String(e),token_limit:String(r),token_ratio:n.toFixed(2),token_remaining_percent:o.toFixed(1)};ARt.record(1,s)}function CQe(t,e,r,n,o){if(!yRt||!vl)return;let s={...Ba(t),function_name:e,risk_level:r};if(n&&(s.rule_name=n),o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let u=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=u}}yRt.record(1,s)}function SQe(t,e,r,n,o){if(!_Rt||!vl)return;let s={...Ba(t),function_name:e,action:r,risk_level:n};if(o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let u=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=u}}_Rt.record(1,s)}function wQe(t,e,r,n,o,s){if(!ERt||!vl)return;let a={...Ba(t),function_name:e,decision:r,review_layer:o,latency_ms:String(n)};if(s&&typeof s=="object"){let u=s;if((u.command||u.cmd)&&(a.command=String(u.command||u.cmd).substring(0,200)),(u.file_path||u.absolute_path||u.path)&&(a.file_path=String(u.file_path||u.absolute_path||u.path).substring(0,200)),u.url||u.prompt){let c=String(u.url||u.prompt).substring(0,200);a.url_or_prompt=c}}ERt.record(1,a)}function xQe(t,e,r,n,o){if(!vRt||!vl)return;let s={...Ba(t),function_name:e,action:r,review_layer:n};if(o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let u=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=u}}vRt.record(1,s)}var tC,H7t,V7t,W7t,z7t,Y7t,K7t,J7t,Pbe,Bbe,X7t,Z7t,eRt,tRt,rRt,nRt,iRt,oRt,sRt,aRt,uRt,cRt,lRt,mRt,dRt,fRt,pRt,hRt,gRt,bRt,ARt,yRt,_Rt,ERt,vRt,vl,yp=j(()=>{"use strict";Xt();tne();Asn();q7t();(function(t){t.CREATE="create",t.READ="read",t.UPDATE="update"})(tC||(tC={}));vl=!1});var no,mn,io,oo,Kc=j(()=>{"use strict";no=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,o,s,a,u=!0,c=!1,m=[]){this.name=e,this.displayName=r,this.description=n,this.icon=o,this.kind=s,this.parameterSchema=a,this.isOutputMarkdown=u,this.canUpdateOutput=c,this.aliases=m}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"})(mn||(mn={}));(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"})(io||(io={}));(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"})(oo||(oo={}))});function tJo(t){switch(t){case mn.ProceedOnce:case mn.ProceedAlways:case mn.ProceedAlwaysServer:case mn.ProceedAlwaysTool:return Lbe.ACCEPT;case mn.ModifyWithEditor:return Lbe.MODIFY;case mn.Cancel:default:return Lbe.REJECT}}var Lbe,gne,bne,Ane,yne,_ne,wb,Ene,vne,L_,Cne,TQe,YB,DQe,Rq=j(()=>{"use strict";Kc();K9();(function(t){t.ACCEPT="accept",t.REJECT="reject",t.MODIFY="modify"})(Lbe||(Lbe={}));gne=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(),o=!1,s=!1;r&&r.authType&&(o=r.authType===er.IFLOW,s=r.authType===er.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=o||s,this.vertex_ai_enabled=s,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()}},bne=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()}},Ane=class{"event.name";"event.timestamp";prompt_length;prompt_id;auth_type;prompt;constructor(e,r,n,o){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=o}},yne=class{"event.name";"event.timestamp";function_name;function_args;duration_ms;success;decision;error;error_type;prompt_id;server_name;response_text;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?tJo(e.outcome):void 0,this.error=e.response.error?.message,this.error_type=e.response.errorType,this.prompt_id=e.request.prompt_id,this.response_text=JSON.stringify(e.response,null,2),"tool"in e&&e.tool&&"serverName"in e.tool&&(this.server_name=e.tool.serverName)}},_ne=class{"event.name";"event.timestamp";model;prompt_id;request_text;base_url;openai_request;constructor(e,r,n,o,s){this["event.name"]="api_request",this["event.timestamp"]=new Date().toISOString(),this.model=r,this.prompt_id=o,this.request_text=s,this.base_url=e,this.openai_request=n}},wb=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,o,s,a,u,c,m){this["event.name"]="api_error",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.error=r,this.error_type=a,this.status_code=u,this.http_status_code=c,this.business_code=m,this.duration_ms=n,this.prompt_id=o,this.auth_type=s}},Ene=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,o,s,a,u,c,m,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=m||200,this.business_code=d,this.input_token_count=s?.promptTokenCount??0,this.output_token_count=s?.candidatesTokenCount??0,this.cached_content_token_count=s?.cachedContentTokenCount??0,this.thoughts_token_count=s?.thoughtsTokenCount??0,this.tool_token_count=s?.toolUsePromptTokenCount??0,this.total_token_count=s?.totalTokenCount??0,this.response_text=a,this.error=u,this.prompt_id=n,this.auth_type=o,this.finish_reason=c}},vne=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"})(L_||(L_={}));Cne=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}},TQe=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}},YB=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}},DQe=class{"event.name";"event.timestamp";model;constructor(e){this["event.name"]="malformed_json_response",this["event.timestamp"]=new Date().toISOString(),this.model=e}}});var yi,Osn=j(()=>{"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",t[t.IFLOW_CLI_RESPONSE_TYPE=46]="IFLOW_CLI_RESPONSE_TYPE",t[t.IFLOW_CLI_RESPONSE_LENGTH=47]="IFLOW_CLI_RESPONSE_LENGTH",t[t.IFLOW_CLI_RESPONSE_SUCCESS=48]="IFLOW_CLI_RESPONSE_SUCCESS",t[t.IFLOW_CLI_ERROR_MESSAGE=49]="IFLOW_CLI_ERROR_MESSAGE"})(yi||(yi={}))});function kq(t,e){let r=new WeakSet;return JSON.stringify(t,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular]";r.add(o)}return o},e)}var IQe=j(()=>{"use strict";});import rJo from"node:path";import{promises as GUu,existsSync as Nsn,readFileSync as Psn}from"node:fs";function Bsn(){return rJo.join(Tn(),Byt)}function Lsn(){try{let t=Bsn();if(Nsn(t)){let e=Psn(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 Msn(){try{let t=Bsn();if(!Nsn(t))return 0;let e=Psn(t,"utf-8").trim();if(!e)return 0;let r=JSON.parse(e);if(!r||typeof r!="object")return 0;let n=r,o=n.old&&Array.isArray(n.old)?n.old.length:0;return n.active&&o++,o}catch(t){return console.debug("Error reading lifetime Google Accounts:",t),0}}var Fsn=j(()=>{"use strict";Na();});import*as DR from"fs";import*as Usn from"path";import{randomUUID as nJo}from"crypto";function iJo(){DR.existsSync(wRt)||DR.mkdirSync(wRt,{recursive:!0})}function oJo(){return DR.existsSync(xRt)&&DR.readFileSync(xRt,"utf-8").trim()||null}function sJo(t){DR.writeFileSync(xRt,t,"utf-8")}function RQe(){try{iJo();let t=oJo();return t||(t=nJo(),sJo(t)),t}catch(t){return console.error("Error accessing installation ID file, generating ephemeral ID:",t),"123456789"}}var wRt,xRt,TRt=j(()=>{"use strict";Na();wRt=Tn(),xRt=Usn.join(wRt,"installation_id")});var $sn,aJo,uJo,cJo,lJo,mJo,dJo,fJo,pJo,hJo,gJo,bJo,AJo,yJo,_p,Mbe=j(()=>{"use strict";$sn=Se(L9t(),1);Rq();Osn();IQe();Fsn();TRt();aJo="start_session",uJo="new_prompt",cJo="tool_call",lJo="api_request",mJo="api_response",dJo="api_error",fJo="end_session",pJo="flash_fallback",hJo="loop_detected",gJo="next_speaker_check",bJo="slash_command",AJo="malformed_json_response",yJo="cli_response",_p=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:kq(e)}])}createLogEvent(e,r){let n=Lsn(),o=Msn();r.push({iflow_cli_key:yi.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT,value:o.toString()});let s={console_type:"IFLOW_CLI",application:102,event_name:e,event_metadata:[r]};return n?s.client_email=n:s.client_install_id=RQe(),s}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 s=1;n&&s<e.length;s++){let a=e.readUInt8(s);r|=BigInt(a&127)<<BigInt(7*(s-1)),n=(a&128)!==0}return n?void 0:{nextRequestWaitMs:Number(r)}}handleLogEvent(e,r,n=!1){this.enqueueLogEvent(this.createLogEvent(e,r)),n?this.flushToClearcut().catch(o=>{console.debug("Error flushing to Clearcut:",o)}):this.flushIfNeeded()}logStartSessionEvent(e){let r=process.env.SURFACE||"SURFACE_NOT_SET",n=[{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_MODEL,value:e.model},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL,value:e.embedding_model},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_SANDBOX,value:e.sandbox_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_CORE_TOOLS,value:e.core_tools_enabled},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_APPROVAL_MODE,value:e.approval_mode},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_API_KEY_ENABLED,value:e.api_key_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED,value:e.debug_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_MCP_SERVERS,value:e.mcp_servers},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED,value:e.telemetry_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED,value:e.telemetry_log_user_prompts_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_SURFACE,value:r}];this.handleLogEvent(aJo,n,!0)}logNewPromptEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_USER_PROMPT_LENGTH,value:JSON.stringify(e.prompt_length)},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(uJo,r)}logToolCallEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_NAME,value:JSON.stringify(e.function_name)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_DECISION,value:JSON.stringify(e.decision)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_ERROR_TYPE,value:JSON.stringify(e.error_type)}];this.handleLogEvent(cJo,r)}logApiRequestEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_API_REQUEST_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)}];this.handleLogEvent(lJo,r)}logApiResponseEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT,value:JSON.stringify(e.input_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT,value:JSON.stringify(e.output_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT,value:JSON.stringify(e.cached_content_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT,value:JSON.stringify(e.thoughts_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT,value:JSON.stringify(e.tool_token_count)},{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(mJo,r)}logApiErrorEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_TYPE,value:JSON.stringify(e.error_type)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(dJo,r)}logFlashFallbackEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.handleLogEvent(pJo,r,!0)}logLoopDetectedEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_LOOP_DETECTED_TYPE,value:JSON.stringify(e.loop_type)}];this.handleLogEvent(hJo,r)}logNextSpeakerCheck(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_FINISH_REASON,value:JSON.stringify(e.finish_reason)},{iflow_cli_key:yi.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT,value:JSON.stringify(e.result)},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.handleLogEvent(gJo,r)}logSlashCommandEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_SLASH_COMMAND_NAME,value:JSON.stringify(e.command)}];e.subcommand&&r.push({iflow_cli_key:yi.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND,value:JSON.stringify(e.subcommand)}),this.handleLogEvent(bJo,r)}logMalformedJsonResponseEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL,value:JSON.stringify(e.model)}];this.handleLogEvent(AJo,r)}logCliResponseEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_TYPE,value:JSON.stringify(e.response_type)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_LENGTH,value:JSON.stringify(e.response_length)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:yi.IFLOW_CLI_ERROR_MESSAGE,value:JSON.stringify(e.error)}];this.handleLogEvent(yJo,r)}logEndSessionEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:e?.session_id?.toString()??""}];this.handleLogEvent(fJo,r,!0)}getProxyAgent(){let e=this.config?.getProxy();if(e){if(e.startsWith("http"))return new $sn.HttpsProxyAgent(e);throw new Error("Unsupported proxy type")}}shutdown(){let e=new bne(this.config);this.logEndSessionEvent(e)}}});import*as jsn from"node:fs";var Oq,Qsn,Fbe,kQe,OQe,NQe,Gsn=j(()=>{"use strict";Oq=Se(Ri(),1),Qsn=Se(cx(),1);Fbe=class{writeStream;constructor(e){this.writeStream=jsn.createWriteStream(e,{flags:"a"})}serialize(e){let r=new WeakSet;return JSON.stringify(e,(o,s)=>{if(typeof s=="object"&&s!==null){if(r.has(s))return"[Circular]";r.add(s)}return s},2)+`
|
|
487
|
+
`).find(n=>n.includes("IOPlatformUUID"));if(!e)return;let r=e.split('" = "');if(r.length===2)return r[1].slice(0,-1)}catch(t){eKo.diag.debug(`error reading machine id: ${t}`)}}jje.getMachineId=tKo});var Hin=T(Qje=>{"use strict";Object.defineProperty(Qje,"__esModule",{value:!0});Qje.getMachineId=void 0;var rKo=Ae("fs"),nKo=(Xt(),bt(cr));async function iKo(){let t=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let e of t)try{return(await rKo.promises.readFile(e,{encoding:"utf8"})).trim()}catch(r){nKo.diag.debug(`error reading machine id: ${r}`)}}Qje.getMachineId=iKo});var Win=T(Gje=>{"use strict";Object.defineProperty(Gje,"__esModule",{value:!0});Gje.getMachineId=void 0;var oKo=Ae("fs"),sKo=$je(),Vin=(Xt(),bt(cr));async function aKo(){try{return(await oKo.promises.readFile("/etc/hostid",{encoding:"utf8"})).trim()}catch(t){Vin.diag.debug(`error reading machine id: ${t}`)}try{return(await(0,sKo.execAsync)("kenv -q smbios.system.uuid")).stdout.trim()}catch(t){Vin.diag.debug(`error reading machine id: ${t}`)}}Gje.getMachineId=aKo});var Yin=T(qje=>{"use strict";Object.defineProperty(qje,"__esModule",{value:!0});qje.getMachineId=void 0;var zin=Ae("process"),uKo=$je(),cKo=(Xt(),bt(cr));async function lKo(){let t="QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",e="%windir%\\System32\\REG.exe";zin.arch==="ia32"&&"PROCESSOR_ARCHITEW6432"in zin.env&&(e="%windir%\\sysnative\\cmd.exe /c "+e);try{let n=(await(0,uKo.execAsync)(`${e} ${t}`)).stdout.split("REG_SZ");if(n.length===2)return n[1].trim()}catch(r){cKo.diag.debug(`error reading machine id: ${r}`)}}qje.getMachineId=lKo});var Kin=T(Hje=>{"use strict";Object.defineProperty(Hje,"__esModule",{value:!0});Hje.getMachineId=void 0;var mKo=(Xt(),bt(cr));async function dKo(){mKo.diag.debug("could not read machine-id: unsupported platform")}Hje.getMachineId=dKo});var Jin=T(Vje=>{"use strict";Object.defineProperty(Vje,"__esModule",{value:!0});Vje.getMachineId=void 0;var fKo=Ae("process"),xq;async function pKo(){if(!xq)switch(fKo.platform){case"darwin":xq=(await Promise.resolve().then(()=>Se(qin()))).getMachineId;break;case"linux":xq=(await Promise.resolve().then(()=>Se(Hin()))).getMachineId;break;case"freebsd":xq=(await Promise.resolve().then(()=>Se(Win()))).getMachineId;break;case"win32":xq=(await Promise.resolve().then(()=>Se(Yin()))).getMachineId;break;default:xq=(await Promise.resolve().then(()=>Se(Kin()))).getMachineId;break}return xq()}Vje.getMachineId=pKo});var w7t=T(Kre=>{"use strict";Object.defineProperty(Kre,"__esModule",{value:!0});Kre.normalizeType=Kre.normalizeArch=void 0;var hKo=t=>{switch(t){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return t}};Kre.normalizeArch=hKo;var gKo=t=>{switch(t){case"sunos":return"solaris";case"win32":return"windows";default:return t}};Kre.normalizeType=gKo});var Zin=T(Wje=>{"use strict";Object.defineProperty(Wje,"__esModule",{value:!0});Wje.hostDetector=void 0;var x7t=Ibe(),Xin=Ae("os"),bKo=Jin(),AKo=w7t(),T7t=class{detect(e){return{attributes:{[x7t.ATTR_HOST_NAME]:(0,Xin.hostname)(),[x7t.ATTR_HOST_ARCH]:(0,AKo.normalizeArch)((0,Xin.arch)()),[x7t.ATTR_HOST_ID]:(0,bKo.getMachineId)()}}}};Wje.hostDetector=new T7t});var ron=T(zje=>{"use strict";Object.defineProperty(zje,"__esModule",{value:!0});zje.osDetector=void 0;var eon=Ibe(),ton=Ae("os"),yKo=w7t(),D7t=class{detect(e){return{attributes:{[eon.ATTR_OS_TYPE]:(0,yKo.normalizeType)((0,ton.platform)()),[eon.ATTR_OS_VERSION]:(0,ton.release)()}}}};zje.osDetector=new D7t});var non=T(Yje=>{"use strict";Object.defineProperty(Yje,"__esModule",{value:!0});Yje.processDetector=void 0;var _Ko=(Xt(),bt(cr)),xR=Ibe(),EKo=Ae("os"),I7t=class{detect(e){let r={[xR.ATTR_PROCESS_PID]:process.pid,[xR.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[xR.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[xR.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[xR.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[xR.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[xR.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};process.argv.length>1&&(r[xR.ATTR_PROCESS_COMMAND]=process.argv[1]);try{let n=EKo.userInfo();r[xR.ATTR_PROCESS_OWNER]=n.username}catch(n){_Ko.diag.debug(`error obtaining process owner: ${n}`)}return{attributes:r}}};Yje.processDetector=new I7t});var ion=T(Kje=>{"use strict";Object.defineProperty(Kje,"__esModule",{value:!0});Kje.serviceInstanceIdDetector=void 0;var vKo=Ibe(),CKo=Ae("crypto"),R7t=class{detect(e){return{attributes:{[vKo.ATTR_SERVICE_INSTANCE_ID]:(0,CKo.randomUUID)()}}}};Kje.serviceInstanceIdDetector=new R7t});var oon=T(Kx=>{"use strict";Object.defineProperty(Kx,"__esModule",{value:!0});Kx.serviceInstanceIdDetector=Kx.processDetector=Kx.osDetector=Kx.hostDetector=void 0;var SKo=Zin();Object.defineProperty(Kx,"hostDetector",{enumerable:!0,get:function(){return SKo.hostDetector}});var wKo=ron();Object.defineProperty(Kx,"osDetector",{enumerable:!0,get:function(){return wKo.osDetector}});var xKo=non();Object.defineProperty(Kx,"processDetector",{enumerable:!0,get:function(){return xKo.processDetector}});var TKo=ion();Object.defineProperty(Kx,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return TKo.serviceInstanceIdDetector}})});var son=T(Jx=>{"use strict";Object.defineProperty(Jx,"__esModule",{value:!0});Jx.serviceInstanceIdDetector=Jx.processDetector=Jx.osDetector=Jx.hostDetector=void 0;var Jje=oon();Object.defineProperty(Jx,"hostDetector",{enumerable:!0,get:function(){return Jje.hostDetector}});Object.defineProperty(Jx,"osDetector",{enumerable:!0,get:function(){return Jje.osDetector}});Object.defineProperty(Jx,"processDetector",{enumerable:!0,get:function(){return Jje.processDetector}});Object.defineProperty(Jx,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Jje.serviceInstanceIdDetector}})});var aon=T(Jre=>{"use strict";Object.defineProperty(Jre,"__esModule",{value:!0});Jre.noopDetector=Jre.NoopDetector=void 0;var Xje=class{detect(){return{attributes:{}}}};Jre.NoopDetector=Xje;Jre.noopDetector=new Xje});var uon=T(n8=>{"use strict";Object.defineProperty(n8,"__esModule",{value:!0});n8.noopDetector=n8.serviceInstanceIdDetector=n8.processDetector=n8.osDetector=n8.hostDetector=n8.envDetector=void 0;var DKo=Gin();Object.defineProperty(n8,"envDetector",{enumerable:!0,get:function(){return DKo.envDetector}});var Zje=son();Object.defineProperty(n8,"hostDetector",{enumerable:!0,get:function(){return Zje.hostDetector}});Object.defineProperty(n8,"osDetector",{enumerable:!0,get:function(){return Zje.osDetector}});Object.defineProperty(n8,"processDetector",{enumerable:!0,get:function(){return Zje.processDetector}});Object.defineProperty(n8,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Zje.serviceInstanceIdDetector}});var IKo=aon();Object.defineProperty(n8,"noopDetector",{enumerable:!0,get:function(){return IKo.noopDetector}})});var con=T(i1=>{"use strict";Object.defineProperty(i1,"__esModule",{value:!0});i1.defaultServiceName=i1.emptyResource=i1.defaultResource=i1.resourceFromAttributes=i1.serviceInstanceIdDetector=i1.processDetector=i1.osDetector=i1.hostDetector=i1.envDetector=i1.detectResources=void 0;var RKo=jin();Object.defineProperty(i1,"detectResources",{enumerable:!0,get:function(){return RKo.detectResources}});var Rbe=uon();Object.defineProperty(i1,"envDetector",{enumerable:!0,get:function(){return Rbe.envDetector}});Object.defineProperty(i1,"hostDetector",{enumerable:!0,get:function(){return Rbe.hostDetector}});Object.defineProperty(i1,"osDetector",{enumerable:!0,get:function(){return Rbe.osDetector}});Object.defineProperty(i1,"processDetector",{enumerable:!0,get:function(){return Rbe.processDetector}});Object.defineProperty(i1,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return Rbe.serviceInstanceIdDetector}});var k7t=v7t();Object.defineProperty(i1,"resourceFromAttributes",{enumerable:!0,get:function(){return k7t.resourceFromAttributes}});Object.defineProperty(i1,"defaultResource",{enumerable:!0,get:function(){return k7t.defaultResource}});Object.defineProperty(i1,"emptyResource",{enumerable:!0,get:function(){return k7t.emptyResource}});var kKo=y7t();Object.defineProperty(i1,"defaultServiceName",{enumerable:!0,get:function(){return kKo.defaultServiceName}})});var lon=T(tQe=>{"use strict";Object.defineProperty(tQe,"__esModule",{value:!0});tQe.LogRecordImpl=void 0;var Tq=(Xt(),bt(cr)),eQe=J4(),O7t=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:o,observedTimestamp:s,eventName:a,severityNumber:u,severityText:c,body:m,attributes:d={},context:f}=n,p=Date.now();if(this.hrTime=(0,eQe.timeInputToHrTime)(o??p),this.hrTimeObserved=(0,eQe.timeInputToHrTime)(s??p),f){let h=Tq.trace.getSpanContext(f);h&&Tq.isSpanContextValid(h)&&(this.spanContext=h)}this.severityNumber=u,this.severityText=c,this.body=m,this.resource=e.resource,this.instrumentationScope=r,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(d)}setAttribute(e,r){return this._isLogRecordReadonly()?this:r===null?this:e.length===0?(Tq.diag.warn(`Invalid attribute key: ${e}`),this):!(0,eQe.isAttributeValue)(r)&&!(typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length>0)?(Tq.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&&Tq.diag.warn("Dropping extra attributes."),this):((0,eQe.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?(Tq.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&&Tq.diag.warn("Can not execute the operation on emitted log record"),this._isReadonly}};tQe.LogRecordImpl=O7t});var mon=T(rQe=>{"use strict";Object.defineProperty(rQe,"__esModule",{value:!0});rQe.Logger=void 0;var OKo=(Xt(),bt(cr)),NKo=lon(),N7t=class{instrumentationScope;_sharedState;constructor(e,r){this.instrumentationScope=e,this._sharedState=r}emit(e){let r=e.context||OKo.context.active(),n=new NKo.LogRecordImpl(this._sharedState,this.instrumentationScope,{context:r,...e});this._sharedState.activeProcessor.onEmit(n,r),n._makeReadonly()}};rQe.Logger=N7t});var don=T(Zre=>{"use strict";Object.defineProperty(Zre,"__esModule",{value:!0});Zre.reconfigureLimits=Zre.loadDefaultConfig=void 0;var Xre=J4();function PKo(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:(0,Xre.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:(0,Xre.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??128},includeTraceContext:!0}}Zre.loadDefaultConfig=PKo;function BKo(t){return{attributeCountLimit:t.attributeCountLimit??(0,Xre.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT")??(0,Xre.getNumberFromEnv)("OTEL_ATTRIBUTE_COUNT_LIMIT")??128,attributeValueLengthLimit:t.attributeValueLengthLimit??(0,Xre.getNumberFromEnv)("OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT")??(0,Xre.getNumberFromEnv)("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0}}Zre.reconfigureLimits=BKo});var B7t=T(nQe=>{"use strict";Object.defineProperty(nQe,"__esModule",{value:!0});nQe.NoopLogRecordProcessor=void 0;var P7t=class{forceFlush(){return Promise.resolve()}onEmit(e,r){}shutdown(){return Promise.resolve()}};nQe.NoopLogRecordProcessor=P7t});var fon=T(iQe=>{"use strict";Object.defineProperty(iQe,"__esModule",{value:!0});iQe.MultiLogRecordProcessor=void 0;var LKo=J4(),L7t=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,LKo.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()))}};iQe.MultiLogRecordProcessor=L7t});var pon=T(oQe=>{"use strict";Object.defineProperty(oQe,"__esModule",{value:!0});oQe.LoggerProviderSharedState=void 0;var MKo=B7t(),FKo=fon(),M7t=class{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,r,n,o){this.resource=e,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.processors=o,o.length>0?(this.registeredLogRecordProcessors=o,this.activeProcessor=new FKo.MultiLogRecordProcessor(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new MKo.NoopLogRecordProcessor}};oQe.LoggerProviderSharedState=M7t});var bon=T(Dq=>{"use strict";Object.defineProperty(Dq,"__esModule",{value:!0});Dq.LoggerProvider=Dq.DEFAULT_LOGGER_NAME=void 0;var sQe=(Xt(),bt(cr)),UKo=Rnn(),$Ko=con(),hon=J4(),jKo=mon(),gon=don(),QKo=pon();Dq.DEFAULT_LOGGER_NAME="unknown";var F7t=class{_shutdownOnce;_sharedState;constructor(e={}){let r=(0,hon.merge)({},(0,gon.loadDefaultConfig)(),e),n=e.resource??(0,$Ko.defaultResource)();this._sharedState=new QKo.LoggerProviderSharedState(n,r.forceFlushTimeoutMillis,(0,gon.reconfigureLimits)(r.logRecordLimits),e?.processors??[]),this._shutdownOnce=new hon.BindOnceFuture(this._shutdown,this)}getLogger(e,r,n){if(this._shutdownOnce.isCalled)return sQe.diag.warn("A shutdown LoggerProvider cannot provide a Logger"),UKo.NOOP_LOGGER;e||sQe.diag.warn("Logger requested without instrumentation scope name.");let o=e||Dq.DEFAULT_LOGGER_NAME,s=`${o}@${r||""}:${n?.schemaUrl||""}`;return this._sharedState.loggers.has(s)||this._sharedState.loggers.set(s,new jKo.Logger({name:o,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(s)}forceFlush(){return this._shutdownOnce.isCalled?(sQe.diag.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(sQe.diag.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};Dq.LoggerProvider=F7t});var yon=T(aQe=>{"use strict";Object.defineProperty(aQe,"__esModule",{value:!0});aQe.ConsoleLogRecordExporter=void 0;var Aon=J4(),U7t=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,Aon.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:Aon.ExportResultCode.SUCCESS})}};aQe.ConsoleLogRecordExporter=U7t});var _on=T(uQe=>{"use strict";Object.defineProperty(uQe,"__esModule",{value:!0});uQe.SimpleLogRecordProcessor=void 0;var ene=J4(),$7t=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new ene.BindOnceFuture(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let r=()=>ene.internal._export(this._exporter,[e]).then(n=>{n.code!==ene.ExportResultCode.SUCCESS&&(0,ene.globalErrorHandler)(n.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${n})`))}).catch(ene.globalErrorHandler);if(e.resource.asyncAttributesPending){let n=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(n),r()),ene.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()}};uQe.SimpleLogRecordProcessor=$7t});var von=T(cQe=>{"use strict";Object.defineProperty(cQe,"__esModule",{value:!0});cQe.InMemoryLogRecordExporter=void 0;var Eon=J4(),j7t=class{_finishedLogRecords=[];_stopped=!1;export(e,r){if(this._stopped)return r({code:Eon.ExportResultCode.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),r({code:Eon.ExportResultCode.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}};cQe.InMemoryLogRecordExporter=j7t});var Con=T(lQe=>{"use strict";Object.defineProperty(lQe,"__esModule",{value:!0});lQe.BatchLogRecordProcessorBase=void 0;var GKo=(Xt(),bt(cr)),B_=J4(),Q7t=class{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,r){this._exporter=e,this._maxExportBatchSize=r?.maxExportBatchSize??(0,B_.getNumberFromEnv)("OTEL_BLRP_MAX_EXPORT_BATCH_SIZE")??512,this._maxQueueSize=r?.maxQueueSize??(0,B_.getNumberFromEnv)("OTEL_BLRP_MAX_QUEUE_SIZE")??2048,this._scheduledDelayMillis=r?.scheduledDelayMillis??(0,B_.getNumberFromEnv)("OTEL_BLRP_SCHEDULE_DELAY")??5e3,this._exportTimeoutMillis=r?.exportTimeoutMillis??(0,B_.getNumberFromEnv)("OTEL_BLRP_EXPORT_TIMEOUT")??3e4,this._shutdownOnce=new B_.BindOnceFuture(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(GKo.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=[],o=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let s=0;s<o;s++)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,B_.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,B_.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=()=>B_.internal._export(this._exporter,e).then(o=>{o.code!==B_.ExportResultCode.SUCCESS&&(0,B_.globalErrorHandler)(o.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${o})`))}).catch(B_.globalErrorHandler),n=e.map(o=>o.resource).filter(o=>o.asyncAttributesPending);return n.length===0?r():Promise.all(n.map(o=>o.waitForAsyncAttributes?.())).then(r,B_.globalErrorHandler)}};lQe.BatchLogRecordProcessorBase=Q7t});var Son=T(mQe=>{"use strict";Object.defineProperty(mQe,"__esModule",{value:!0});mQe.BatchLogRecordProcessor=void 0;var qKo=Con(),G7t=class extends qKo.BatchLogRecordProcessorBase{onShutdown(){}};mQe.BatchLogRecordProcessor=G7t});var won=T(dQe=>{"use strict";Object.defineProperty(dQe,"__esModule",{value:!0});dQe.BatchLogRecordProcessor=void 0;var HKo=Son();Object.defineProperty(dQe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return HKo.BatchLogRecordProcessor}})});var xon=T(fQe=>{"use strict";Object.defineProperty(fQe,"__esModule",{value:!0});fQe.BatchLogRecordProcessor=void 0;var VKo=won();Object.defineProperty(fQe,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return VKo.BatchLogRecordProcessor}})});var Ton=T(i8=>{"use strict";Object.defineProperty(i8,"__esModule",{value:!0});i8.BatchLogRecordProcessor=i8.InMemoryLogRecordExporter=i8.SimpleLogRecordProcessor=i8.ConsoleLogRecordExporter=i8.NoopLogRecordProcessor=i8.LoggerProvider=void 0;var WKo=bon();Object.defineProperty(i8,"LoggerProvider",{enumerable:!0,get:function(){return WKo.LoggerProvider}});var zKo=B7t();Object.defineProperty(i8,"NoopLogRecordProcessor",{enumerable:!0,get:function(){return zKo.NoopLogRecordProcessor}});var YKo=yon();Object.defineProperty(i8,"ConsoleLogRecordExporter",{enumerable:!0,get:function(){return YKo.ConsoleLogRecordExporter}});var KKo=_on();Object.defineProperty(i8,"SimpleLogRecordProcessor",{enumerable:!0,get:function(){return KKo.SimpleLogRecordProcessor}});var JKo=von();Object.defineProperty(i8,"InMemoryLogRecordExporter",{enumerable:!0,get:function(){return JKo.InMemoryLogRecordExporter}});var XKo=xon();Object.defineProperty(i8,"BatchLogRecordProcessor",{enumerable:!0,get:function(){return XKo.BatchLogRecordProcessor}})});var If,Don,kbe,Ion,Obe,Nbe,Ron,kon,Oon,Non,Pon,Bon,Lon,Mon,Fon,Uon,$on,jon,Qon,Gon,qon,Hon,Von,Won,zon,Yon,Kon,Jon,Xon,Zon,esn,tsn,rsn,nsn,isn,osn,ssn,asn,usn,csn,lsn,msn,dsn,fsn,psn,tne=j(()=>{"use strict";If="iflow-cli",Don="iflow_cli.user_prompt",kbe="iflow_cli.tool_call",Ion="iflow_cli.api_request",Obe="iflow_cli.api_error",Nbe="iflow_cli.api_response",Ron="iflow_cli.config",kon="iflow_cli.flash_fallback",Oon="iflow_cli.next_speaker_check",Non="iflow_cli.slash_command",Pon="iflow_cli.cli_response",Bon="iflow_cli.tool.call.count",Lon="iflow_cli.tool.call.latency",Mon="iflow_cli.mcp.tool.call.count",Fon="iflow_cli.mcp.tool.call.latency",Uon="iflow_cli.builtin.tool.call.count",$on="iflow_cli.builtin.tool.call.latency",jon="gen_ai.client.operation",Qon="gen_ai.client.operation.duration",Gon="gen_ai.client.token.usage",qon="iflow_cli.session.count",Hon="iflow_cli.file.operation.count",Von="iflow_cli.user_request.count",Won="iflow_cli.user_request.latency",zon="iflow_cli.user_experience.success",Yon="iflow_cli.user.identity",Kon="iflow_cli.scheduler.lock.error",Jon="iflow_cli.mcp.connect.count",Xon="iflow_cli.loop.detection.count",Zon="iflow_cli.paste.operation.count",esn="iflow_cli.paste.operation.latency",tsn="iflow_cli.xinliu.web.search.count",rsn="iflow_cli.xinliu.web.search.latency",nsn="iflow_cli.web.fetch.count",isn="iflow_cli.web.fetch.latency",osn="iflow_cli.approval.mode.count",ssn="iflow_cli.compression.lightweight.count",asn="iflow_cli.compression.lightweight.ratio",usn="iflow_cli.compression.full.count",csn="iflow_cli.compression.full.ratio",lsn="iflow_cli.low_token_no_compression.count",msn="iflow_cli.smart_approval.blacklist.block.count",dsn="iflow_cli.smart_approval.blacklist.user_action.count",fsn="iflow_cli.smart_approval.ai_review.count",psn="iflow_cli.smart_approval.ai_risky.user_action.count"});var rne,nne,ine,one,sne,ane,une,cne,lne,mne,X4,Z4,hsn=j(()=>{"use strict";rne="iflow_cli.cpu.usage_percentage",nne="iflow_cli.cpu.user_percentage",ine="iflow_cli.cpu.system_percentage",one="iflow_cli.cpu.cores",sne="iflow_cli.memory.heap_used",ane="iflow_cli.memory.heap_total",une="iflow_cli.memory.rss",cne="iflow_cli.memory.external",lne="iflow_cli.memory.system_usage_percentage",mne="iflow_cli.memory.process_usage_percentage",X4={[rne]:"CPU usage percentage",[nne]:"CPU user time percentage",[ine]:"CPU system time percentage",[one]:"Number of CPU cores",[sne]:"Heap memory used in bytes",[ane]:"Heap memory total in bytes",[une]:"Resident Set Size in bytes",[cne]:"External memory in bytes",[lne]:"System memory usage percentage",[mne]:"Process memory usage percentage relative to Node.js limits"},Z4={[rne]:"percent",[nne]:"percent",[ine]:"percent",[one]:"cores",[sne]:"bytes",[ane]:"bytes",[une]:"bytes",[cne]:"bytes",[lne]:"percent",[mne]:"percent"}});import*as eC from"os";var pQe,gsn=j(()=>{"use strict";hsn();pQe=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=eC.cpus().length,this.totalSystemMemory=eC.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 o=Math.max(0,e.user+e.system),s=Math.max(0,e.user),a=Math.max(0,e.system),u=o/(n*1e3)*100,c=s/(n*1e3)*100,m=a/(n*1e3)*100,d=Number.isFinite(u)?Math.min(100,Math.max(0,u)):0,f=Number.isFinite(c)?Math.min(100,Math.max(0,c)):0,p=Number.isFinite(m)?Math.min(100,Math.max(0,m)):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=eC.freemem(),o=(this.totalSystemMemory-r)/this.totalSystemMemory*100,s=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,o)),processUsage:Math.min(100,Math.max(0,s))}}catch{return{heapUsed:0,heapTotal:0,rss:0,external:0,systemUsage:0,processUsage:0}}}initializeMetrics(){let e=eC.platform(),r=eC.arch(),n=process.version;this.options.enableCpuMetrics&&(this.cpuUsageGauge=this.meter.createObservableGauge(rne,{description:X4[rne],unit:Z4[rne]}),this.cpuUserGauge=this.meter.createObservableGauge(nne,{description:X4[nne],unit:Z4[nne]}),this.cpuSystemGauge=this.meter.createObservableGauge(ine,{description:X4[ine],unit:Z4[ine]}),this.cpuCoresGauge=this.meter.createObservableGauge(one,{description:X4[one],unit:Z4[one]}),this.cpuUsageGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.usage,{platform:e,arch:r,node_version:n})}),this.cpuUserGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.user,{platform:e,arch:r,node_version:n})}),this.cpuSystemGauge.addCallback(o=>{let s=this.getCurrentCpuMetrics();o.observe(s.system,{platform:e,arch:r,node_version:n})}),this.cpuCoresGauge?.addCallback(o=>{o.observe(this.cpuCores,{platform:e,arch:r})})),this.options.enableMemoryMetrics&&(this.memoryHeapUsedGauge=this.meter.createObservableGauge(sne,{description:X4[sne],unit:Z4[sne]}),this.memoryHeapTotalGauge=this.meter.createObservableGauge(ane,{description:X4[ane],unit:Z4[ane]}),this.memoryRssGauge=this.meter.createObservableGauge(une,{description:X4[une],unit:Z4[une]}),this.memoryExternalGauge=this.meter.createObservableGauge(cne,{description:X4[cne],unit:Z4[cne]}),this.memorySystemUsageGauge=this.meter.createObservableGauge(lne,{description:X4[lne],unit:Z4[lne]}),this.memoryProcessUsageGauge=this.meter.createObservableGauge(mne,{description:X4[mne],unit:Z4[mne]}),this.memoryHeapUsedGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.heapUsed,{platform:e,arch:r,node_version:n})}),this.memoryHeapTotalGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.heapTotal,{platform:e,arch:r,node_version:n})}),this.memoryRssGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.rss,{platform:e,arch:r,node_version:n})}),this.memoryExternalGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.external,{platform:e,arch:r,node_version:n})}),this.memorySystemUsageGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.systemUsage,{platform:e,arch:r,node_version:n})}),this.memoryProcessUsageGauge.addCallback(o=>{let s=this.getCurrentMemoryMetrics();o.observe(s.processUsage,{platform:e,arch:r,node_version:n,memory_limit_mb:Math.round(this.nodeJSMemoryLimit/(1024*1024)).toString()})}))}getNodeJSMemoryLimit(){let e=process.execArgv.find(o=>o.startsWith("--max-old-space-size="))?.split("=")[1];if(e){let o=parseInt(e,10);if(!isNaN(o)&&o>0)return o*1024*1024}let r=process.execArgv.find(o=>o.startsWith("--max_old_space_size="))?.split("=")[1];if(r){let o=parseInt(r,10);if(!isNaN(o)&&o>0)return o*1024*1024}let n=eC.arch();return n==="x64"||n==="arm64"?1400*1024*1024:700*1024*1024}}});function bsn(t,e={}){if(hQe)return hQe;let r={enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0,...e};return hQe=new pQe(t,r),hQe}var hQe,Asn=j(()=>{"use strict";gsn();hQe=null});import ZKo from"os";function ysn(){try{let t=ZKo.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 _sn=j(()=>{"use strict"});import*as dne from"os";import*as gQe from"fs";function Ba(t){let e="0.5.10",r=process.env.IFLOW_ENV||"normal",n={darwin:"macOS",win32:"Windows",linux:"Linux",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX"},o=dne.platform(),s=n[o]||o,a="unknown";try{if(o==="darwin")a=dne.release();else if(o==="linux")try{if(gQe.existsSync("/etc/os-release")){let h=gQe.readFileSync("/etc/os-release","utf8").match(/^PRETTY_NAME="(.+)"/m);h&&(a=h[1])}}catch{a=dne.release()}else o==="win32"&&(a=dne.release())}catch{a="unknown"}let u={name:"Node.js",version:process.version,architecture:process.arch},c=t.getModel()||"unknown",m=t.getUsageMode(),d=!1,f=t.getContentGeneratorConfig?.();if(f){let p=f.authType,h=f.baseUrl||"";(p===er.LOGIN_WITH_IFLOW||p===er.IFLOW||p===er.OPENAI_COMPATIBLE&&h.includes("apis.iflow.cn"))&&(d=!0)}return{app_name:If,tenant__:"gen_ai",version:e,platform:s,os_model:a,runtime_name:u.name,runtime_version:u.version,runtime_architecture:u.architecture,model_name:c,is_iflow_open_user:String(d),ip:ysn(),iflow_env:r,usage_mode:m}}var q7t=j(()=>{"use strict";K9();_sn();tne()});function Esn(){return H7t||(H7t=m3e.getMeter(If)),H7t}function vsn(){if(vl)return;let t=Esn();if(t){try{bsn(t,{enableCpuMetrics:!0,enableMemoryMetrics:!0,enableSystemInfo:!0})}catch{}V7t=t.createHistogram(Bon,{description:"Counts tool calls, tagged by function name and success.",unit:"count",valueType:na.INT}),W7t=t.createHistogram(Lon,{description:"Latency of tool calls in milliseconds.",unit:"ms",valueType:na.INT}),z7t=t.createHistogram(Mon,{description:"Counts MCP tool calls, tagged by function name and success.",unit:"count",valueType:na.INT}),Y7t=t.createHistogram(Fon,{description:"Latency of MCP tool calls in milliseconds.",unit:"ms",valueType:na.INT}),K7t=t.createHistogram(Uon,{description:"Counts built-in tool calls, tagged by function name and success.",unit:"count",valueType:na.INT}),J7t=t.createHistogram($on,{description:"Latency of built-in tool calls in milliseconds.",unit:"ms",valueType:na.INT}),Pbe=t.createHistogram(jon,{description:"Counts API requests, tagged by model and status.",unit:"count",valueType:na.INT}),Bbe=t.createHistogram(Qon,{description:"Latency of API requests in milliseconds.",unit:"ms",valueType:na.INT}),X7t=t.createHistogram(Gon,{description:"Counts the total number of tokens used.",unit:"tokens",valueType:na.INT}),Z7t=t.createHistogram(Hon,{description:"Counts file operations (create, read, update).",unit:"count",valueType:na.INT}),eRt=t.createHistogram(Von,{description:"Counts user requests from prompt to completion.",unit:"count",valueType:na.INT}),tRt=t.createHistogram(Won,{description:"End-to-end latency of user requests in milliseconds.",unit:"ms",valueType:na.INT}),rRt=t.createHistogram(zon,{description:"User experience success rate - counts successful user experiences including retries and fixes.",unit:"count",valueType:na.INT}),nRt=t.createHistogram(Yon,{description:"User identity for tracking unique installations.",unit:"count",valueType:na.INT}),iRt=t.createHistogram(Kon,{description:"Counts tool scheduler lock errors when new calls are blocked by running calls.",unit:"count",valueType:na.INT}),oRt=t.createHistogram(Jon,{description:"Counts MCP connection attempts and their success/failure status.",unit:"count",valueType:na.INT}),sRt=t.createHistogram(Xon,{description:"Counts loop detection events by loop type.",unit:"count",valueType:na.INT}),aRt=t.createHistogram(Zon,{description:"Counts paste operations, tagged by type and success.",unit:"count",valueType:na.INT}),uRt=t.createHistogram(esn,{description:"Latency of paste operations in milliseconds.",unit:"ms",valueType:na.INT}),cRt=t.createHistogram(tsn,{description:"Counts xinliu web search operations, tagged by success and error type.",unit:"count",valueType:na.INT}),lRt=t.createHistogram(rsn,{description:"Latency of xinliu web search operations in milliseconds.",unit:"ms",valueType:na.INT}),mRt=t.createHistogram(nsn,{description:"Counts web fetch operations, tagged by success and error type.",unit:"count",valueType:na.INT}),dRt=t.createHistogram(isn,{description:"Latency of web fetch operations in milliseconds.",unit:"ms",valueType:na.INT}),fRt=t.createHistogram(osn,{description:"Counts usage of different approval modes.",unit:"count",valueType:na.INT}),pRt=t.createHistogram(ssn,{description:"Counts lightweight compression triggers, tagged by executed status and skip reason.",unit:"count",valueType:na.INT}),hRt=t.createHistogram(asn,{description:"Histogram of lightweight compression token reduction ratios (reduced_tokens / original_tokens).",unit:"ratio",valueType:na.DOUBLE}),gRt=t.createHistogram(usn,{description:"Counts full compression triggers, tagged by triggered_by and had_lightweight_before.",unit:"count",valueType:na.INT}),bRt=t.createHistogram(csn,{description:"Histogram of full compression token reduction ratios (reduced_tokens / original_tokens).",unit:"ratio",valueType:na.DOUBLE}),ARt=t.createHistogram(lsn,{description:"Counts API calls when token remaining < 20% without compression triggered.",unit:"count",valueType:na.INT}),yRt=t.createHistogram(msn,{description:"Counts blacklist blocks in smart approval, tagged by function name and risk level.",unit:"count",valueType:na.INT}),_Rt=t.createHistogram(dsn,{description:"Counts user actions after blacklist block, tagged by function name and action (execute/cancel).",unit:"count",valueType:na.INT}),ERt=t.createHistogram(fsn,{description:"Counts AI review operations in smart approval, tagged by function name and decision (safe/risky).",unit:"count",valueType:na.INT}),vRt=t.createHistogram(psn,{description:"Counts user actions after AI judges risky, tagged by function name and action (execute/cancel).",unit:"count",valueType:na.INT}),vl=!0}}function bQe(t){let e=Esn();if(!e||!vl)return;e.createHistogram(qon,{description:"Count of CLI sessions started.",unit:"count",valueType:na.INT}).record(1,Ba(t))}function Csn(t,e,r,n,o,s){if(!V7t||!W7t||!vl)return;let a={...Ba(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};V7t.record(1,a),W7t.record(r,{...Ba(t),function_name:e??"unknown",tool_type:s??"unknown"})}function Ssn(t,e,r,n,o,s){if(!z7t||!Y7t||!vl)return;let a={...Ba(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};s&&(a.execution_context=s),z7t.record(1,a),Y7t.record(r,{...Ba(t),function_name:e??"unknown",execution_context:s??"unknown"})}function wsn(t,e,r,n,o,s){if(!K7t||!J7t||!vl)return;let a={...Ba(t),function_name:e??"unknown",success:String(n),decision:o??"unknown"};s&&(a.execution_context=s),K7t.record(1,a),J7t.record(r,{...Ba(t),function_name:e??"unknown",execution_context:s??"unknown"})}function fne(t,e,r,n){!X7t||!vl||X7t.record(r,{...Ba(t),model:e??"unknown",type:n??"unknown"})}function xsn(t,e,r,n,o,s,a,u){if(!Pbe||!Bbe||!vl)return;let c={...Ba(t),model:e??"unknown",status_code:String(n??(o?"error":"ok"))};a!==void 0&&(c.http_status_code=String(a)),u!==void 0&&(c.business_code=String(u)),s&&(c.finish_reason=s),Pbe.record(1,c);let m={...Ba(t),model:e??"unknown",http_status_code:String(a??200),finish_reason:s??"unknown"};u!=null&&(m.business_code=String(u)),Bbe.record(r,m)}function Tsn(t,e,r,n,o,s,a){if(!Pbe||!Bbe||!vl)return;let u={...Ba(t),model:e??"unknown",status_code:String(n??"error"),error:o??"unknown"};s!==void 0&&(u.http_status_code=String(s)),a!==void 0&&(u.business_code=String(a)),Pbe.record(1,u);let c={...Ba(t),model:e??"unknown",http_status_code:String(s??0),error:o??"unknown"};a!=null&&(c.business_code=String(a)),Bbe.record(r,c)}function TR(t,e,r,n,o){if(!Z7t||!vl)return;let s={...Ba(t),operation:e};r!==void 0&&(s.lines=String(r)),n!==void 0&&(s.mimetype=n),o!==void 0&&(s.extension=o),Z7t.record(1,s)}function Dsn(t,e,r,n,o){if(!eRt||!tRt||!vl)return;let s={...Ba(t),prompt_id:e,success:String(n)};o&&(s.error=o),eRt.record(1,s),tRt.record(r,s)}function CRt(t,e,r=!1,n=!1,o){if(!rRt||!vl)return;let s={...Ba(t),success:String(e),had_retries:String(r),had_fixes:String(n)};o&&(s.final_error=o),rRt.record(1,s)}function Isn(t,e){if(!nRt||!vl)return;let r={...Ba(t),user_id:e};nRt.record(1,r)}function Rsn(t,e,r){if(!iRt||!vl)return;let n={...Ba(t),running_calls_count:String(e)};r.forEach((o,s)=>{n[`call_${s}_name`]=o.name,n[`call_${s}_status`]=o.status}),iRt.record(1,n)}function SRt(t,e,r,n,o){if(!oRt||!vl)return;let s={...Ba(t),server_name:e,success:String(r)};n&&(s.error_type=n),o&&(s.transport_type=o),oRt.record(1,s)}function ksn(t,e,r){if(!sRt||!vl)return;let n={...Ba(t),loop_type:e,prompt_id:r};sRt.record(1,n)}function AQe(t,e,r,n,o="text",s,a){if(!aRt||!uRt||!vl)return;let u={};try{u=Ba(t)}catch{u={app_name:If,tenant__:"gen_ai",version:"unknown",platform:a||"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={...u,success:String(n),paste_type:o};s&&(c.error_type=s),a&&(c.platform_specific=a),aRt.record(1,c);let m={...u,paste_type:o,text_length_range:String(r),performance_ratio:eJo(e,r)};uRt.record(e,m)}function eJo(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"}function zB(t,e,r,n,o,s){if(!cRt||!lRt||!vl)return;let a={...Ba(t),success:String(r)};n&&(a.error_type=n),o!==void 0&&(a.results_count=String(o)),s&&(a.query_length=String(s.length)),cRt.record(1,a),lRt.record(e,{...Ba(t),error_type:n??"none"})}function Iq(t,e,r,n,o,s){if(!mRt||!dRt||!vl)return;let a={...Ba(t),success:String(r)};n&&(a.error_type=n),o!==void 0&&(a.url_count=String(o)),s!==void 0&&(a.prompt_length=String(s)),mRt.record(1,a),dRt.record(e,{...Ba(t),error_type:n??"none"})}function yQe(t,e){if(!fRt||!vl)return;let r={...Ba(t),approval_mode:e};fRt.record(1,r)}function pne(t,e,r,n){if(!pRt||!vl)return;let o={...Ba(t),executed:String(e),triggered_by:r};n&&(o.skipped_reason=n),pRt.record(1,o)}function _Qe(t,e,r,n){if(!hRt||!vl)return;let o=e-r,s=e>0?o/e:0,a={...Ba(t),original_tokens:String(e),compressed_tokens:String(r),reduced_tokens:String(o),removed_tool_calls:String(n)};hRt.record(s,a)}function hne(t,e,r,n){if(!gRt||!vl)return;let o={...Ba(t),executed:String(e),triggered_by:r,had_lightweight_before:String(n)};gRt.record(1,o)}function EQe(t,e,r,n,o){if(!bRt||!vl)return;let s=e-r,a=e>0?s/e:0,u={...Ba(t),original_tokens:String(e),compressed_tokens:String(r),reduced_tokens:String(s),had_lightweight_before:String(n),recovered_files_count:String(o)};bRt.record(a,u)}function vQe(t,e,r,n){if(!ARt||!vl)return;let o=(1-n)*100,s={...Ba(t),token_count:String(e),token_limit:String(r),token_ratio:n.toFixed(2),token_remaining_percent:o.toFixed(1)};ARt.record(1,s)}function CQe(t,e,r,n,o){if(!yRt||!vl)return;let s={...Ba(t),function_name:e,risk_level:r};if(n&&(s.rule_name=n),o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let u=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=u}}yRt.record(1,s)}function SQe(t,e,r,n,o){if(!_Rt||!vl)return;let s={...Ba(t),function_name:e,action:r,risk_level:n};if(o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let u=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=u}}_Rt.record(1,s)}function wQe(t,e,r,n,o,s){if(!ERt||!vl)return;let a={...Ba(t),function_name:e,decision:r,review_layer:o,latency_ms:String(n)};if(s&&typeof s=="object"){let u=s;if((u.command||u.cmd)&&(a.command=String(u.command||u.cmd).substring(0,200)),(u.file_path||u.absolute_path||u.path)&&(a.file_path=String(u.file_path||u.absolute_path||u.path).substring(0,200)),u.url||u.prompt){let c=String(u.url||u.prompt).substring(0,200);a.url_or_prompt=c}}ERt.record(1,a)}function xQe(t,e,r,n,o){if(!vRt||!vl)return;let s={...Ba(t),function_name:e,action:r,review_layer:n};if(o&&typeof o=="object"){let a=o;if((a.command||a.cmd)&&(s.command=String(a.command||a.cmd).substring(0,200)),(a.file_path||a.absolute_path||a.path)&&(s.file_path=String(a.file_path||a.absolute_path||a.path).substring(0,200)),a.url||a.prompt){let u=String(a.url||a.prompt).substring(0,200);s.url_or_prompt=u}}vRt.record(1,s)}var tC,H7t,V7t,W7t,z7t,Y7t,K7t,J7t,Pbe,Bbe,X7t,Z7t,eRt,tRt,rRt,nRt,iRt,oRt,sRt,aRt,uRt,cRt,lRt,mRt,dRt,fRt,pRt,hRt,gRt,bRt,ARt,yRt,_Rt,ERt,vRt,vl,yp=j(()=>{"use strict";Xt();tne();Asn();q7t();(function(t){t.CREATE="create",t.READ="read",t.UPDATE="update"})(tC||(tC={}));vl=!1});var no,mn,io,oo,Kc=j(()=>{"use strict";no=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,o,s,a,u=!0,c=!1,m=[]){this.name=e,this.displayName=r,this.description=n,this.icon=o,this.kind=s,this.parameterSchema=a,this.isOutputMarkdown=u,this.canUpdateOutput=c,this.aliases=m}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"})(mn||(mn={}));(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"})(io||(io={}));(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"})(oo||(oo={}))});function tJo(t){switch(t){case mn.ProceedOnce:case mn.ProceedAlways:case mn.ProceedAlwaysServer:case mn.ProceedAlwaysTool:return Lbe.ACCEPT;case mn.ModifyWithEditor:return Lbe.MODIFY;case mn.Cancel:default:return Lbe.REJECT}}var Lbe,gne,bne,Ane,yne,_ne,wb,Ene,vne,L_,Cne,TQe,YB,DQe,Rq=j(()=>{"use strict";Kc();K9();(function(t){t.ACCEPT="accept",t.REJECT="reject",t.MODIFY="modify"})(Lbe||(Lbe={}));gne=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(),o=!1,s=!1;r&&r.authType&&(o=r.authType===er.IFLOW,s=r.authType===er.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=o||s,this.vertex_ai_enabled=s,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()}},bne=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()}},Ane=class{"event.name";"event.timestamp";prompt_length;prompt_id;auth_type;prompt;constructor(e,r,n,o){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=o}},yne=class{"event.name";"event.timestamp";function_name;function_args;duration_ms;success;decision;error;error_type;prompt_id;server_name;response_text;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?tJo(e.outcome):void 0,this.error=e.response.error?.message,this.error_type=e.response.errorType,this.prompt_id=e.request.prompt_id,this.response_text=JSON.stringify(e.response,null,2),"tool"in e&&e.tool&&"serverName"in e.tool&&(this.server_name=e.tool.serverName)}},_ne=class{"event.name";"event.timestamp";model;prompt_id;request_text;base_url;openai_request;constructor(e,r,n,o,s){this["event.name"]="api_request",this["event.timestamp"]=new Date().toISOString(),this.model=r,this.prompt_id=o,this.request_text=s,this.base_url=e,this.openai_request=n}},wb=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,o,s,a,u,c,m){this["event.name"]="api_error",this["event.timestamp"]=new Date().toISOString(),this.model=e,this.error=r,this.error_type=a,this.status_code=u,this.http_status_code=c,this.business_code=m,this.duration_ms=n,this.prompt_id=o,this.auth_type=s}},Ene=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,o,s,a,u,c,m,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=m||200,this.business_code=d,this.input_token_count=s?.promptTokenCount??0,this.output_token_count=s?.candidatesTokenCount??0,this.cached_content_token_count=s?.cachedContentTokenCount??0,this.thoughts_token_count=s?.thoughtsTokenCount??0,this.tool_token_count=s?.toolUsePromptTokenCount??0,this.total_token_count=s?.totalTokenCount??0,this.response_text=a,this.error=u,this.prompt_id=n,this.auth_type=o,this.finish_reason=c}},vne=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"})(L_||(L_={}));Cne=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}},TQe=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}},YB=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}},DQe=class{"event.name";"event.timestamp";model;constructor(e){this["event.name"]="malformed_json_response",this["event.timestamp"]=new Date().toISOString(),this.model=e}}});var yi,Osn=j(()=>{"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",t[t.IFLOW_CLI_RESPONSE_TYPE=46]="IFLOW_CLI_RESPONSE_TYPE",t[t.IFLOW_CLI_RESPONSE_LENGTH=47]="IFLOW_CLI_RESPONSE_LENGTH",t[t.IFLOW_CLI_RESPONSE_SUCCESS=48]="IFLOW_CLI_RESPONSE_SUCCESS",t[t.IFLOW_CLI_ERROR_MESSAGE=49]="IFLOW_CLI_ERROR_MESSAGE"})(yi||(yi={}))});function kq(t,e){let r=new WeakSet;return JSON.stringify(t,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular]";r.add(o)}return o},e)}var IQe=j(()=>{"use strict";});import rJo from"node:path";import{promises as GUu,existsSync as Nsn,readFileSync as Psn}from"node:fs";function Bsn(){return rJo.join(Tn(),Byt)}function Lsn(){try{let t=Bsn();if(Nsn(t)){let e=Psn(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 Msn(){try{let t=Bsn();if(!Nsn(t))return 0;let e=Psn(t,"utf-8").trim();if(!e)return 0;let r=JSON.parse(e);if(!r||typeof r!="object")return 0;let n=r,o=n.old&&Array.isArray(n.old)?n.old.length:0;return n.active&&o++,o}catch(t){return console.debug("Error reading lifetime Google Accounts:",t),0}}var Fsn=j(()=>{"use strict";Na();});import*as DR from"fs";import*as Usn from"path";import{randomUUID as nJo}from"crypto";function iJo(){DR.existsSync(wRt)||DR.mkdirSync(wRt,{recursive:!0})}function oJo(){return DR.existsSync(xRt)&&DR.readFileSync(xRt,"utf-8").trim()||null}function sJo(t){DR.writeFileSync(xRt,t,"utf-8")}function RQe(){try{iJo();let t=oJo();return t||(t=nJo(),sJo(t)),t}catch(t){return console.error("Error accessing installation ID file, generating ephemeral ID:",t),"123456789"}}var wRt,xRt,TRt=j(()=>{"use strict";Na();wRt=Tn(),xRt=Usn.join(wRt,"installation_id")});var $sn,aJo,uJo,cJo,lJo,mJo,dJo,fJo,pJo,hJo,gJo,bJo,AJo,yJo,_p,Mbe=j(()=>{"use strict";$sn=Se(L9t(),1);Rq();Osn();IQe();Fsn();TRt();aJo="start_session",uJo="new_prompt",cJo="tool_call",lJo="api_request",mJo="api_response",dJo="api_error",fJo="end_session",pJo="flash_fallback",hJo="loop_detected",gJo="next_speaker_check",bJo="slash_command",AJo="malformed_json_response",yJo="cli_response",_p=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:kq(e)}])}createLogEvent(e,r){let n=Lsn(),o=Msn();r.push({iflow_cli_key:yi.IFLOW_CLI_GOOGLE_ACCOUNTS_COUNT,value:o.toString()});let s={console_type:"IFLOW_CLI",application:102,event_name:e,event_metadata:[r]};return n?s.client_email=n:s.client_install_id=RQe(),s}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 s=1;n&&s<e.length;s++){let a=e.readUInt8(s);r|=BigInt(a&127)<<BigInt(7*(s-1)),n=(a&128)!==0}return n?void 0:{nextRequestWaitMs:Number(r)}}handleLogEvent(e,r,n=!1){this.enqueueLogEvent(this.createLogEvent(e,r)),n?this.flushToClearcut().catch(o=>{console.debug("Error flushing to Clearcut:",o)}):this.flushIfNeeded()}logStartSessionEvent(e){let r=process.env.SURFACE||"SURFACE_NOT_SET",n=[{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_MODEL,value:e.model},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_EMBEDDING_MODEL,value:e.embedding_model},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_SANDBOX,value:e.sandbox_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_CORE_TOOLS,value:e.core_tools_enabled},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_APPROVAL_MODE,value:e.approval_mode},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_API_KEY_ENABLED,value:e.api_key_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_DEBUG_MODE_ENABLED,value:e.debug_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_MCP_SERVERS,value:e.mcp_servers},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_VERTEX_API_ENABLED,value:e.vertex_ai_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_TELEMETRY_ENABLED,value:e.telemetry_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_START_SESSION_TELEMETRY_LOG_USER_PROMPTS_ENABLED,value:e.telemetry_log_user_prompts_enabled.toString()},{iflow_cli_key:yi.IFLOW_CLI_SURFACE,value:r}];this.handleLogEvent(aJo,n,!0)}logNewPromptEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_USER_PROMPT_LENGTH,value:JSON.stringify(e.prompt_length)},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(uJo,r)}logToolCallEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_NAME,value:JSON.stringify(e.function_name)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_DECISION,value:JSON.stringify(e.decision)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:yi.IFLOW_CLI_TOOL_CALL_ERROR_TYPE,value:JSON.stringify(e.error_type)}];this.handleLogEvent(cJo,r)}logApiRequestEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_API_REQUEST_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)}];this.handleLogEvent(lJo,r)}logApiResponseEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_MESSAGE,value:JSON.stringify(e.error)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_INPUT_TOKEN_COUNT,value:JSON.stringify(e.input_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_OUTPUT_TOKEN_COUNT,value:JSON.stringify(e.output_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_CACHED_TOKEN_COUNT,value:JSON.stringify(e.cached_content_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_THINKING_TOKEN_COUNT,value:JSON.stringify(e.thoughts_token_count)},{iflow_cli_key:yi.IFLOW_CLI_API_RESPONSE_TOOL_TOKEN_COUNT,value:JSON.stringify(e.tool_token_count)},{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(mJo,r)}logApiErrorEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_MODEL,value:JSON.stringify(e.model)},{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_TYPE,value:JSON.stringify(e.error_type)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_STATUS_CODE,value:JSON.stringify(e.status_code)},{iflow_cli_key:yi.IFLOW_CLI_API_ERROR_DURATION_MS,value:JSON.stringify(e.duration_ms)},{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)}];this.handleLogEvent(dJo,r)}logFlashFallbackEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_AUTH_TYPE,value:JSON.stringify(e.auth_type)},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.handleLogEvent(pJo,r,!0)}logLoopDetectedEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_LOOP_DETECTED_TYPE,value:JSON.stringify(e.loop_type)}];this.handleLogEvent(hJo,r)}logNextSpeakerCheck(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_FINISH_REASON,value:JSON.stringify(e.finish_reason)},{iflow_cli_key:yi.IFLOW_CLI_NEXT_SPEAKER_CHECK_RESULT,value:JSON.stringify(e.result)},{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:this.config?.getSessionId()??""}];this.handleLogEvent(gJo,r)}logSlashCommandEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_SLASH_COMMAND_NAME,value:JSON.stringify(e.command)}];e.subcommand&&r.push({iflow_cli_key:yi.IFLOW_CLI_SLASH_COMMAND_SUBCOMMAND,value:JSON.stringify(e.subcommand)}),this.handleLogEvent(bJo,r)}logMalformedJsonResponseEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_MALFORMED_JSON_RESPONSE_MODEL,value:JSON.stringify(e.model)}];this.handleLogEvent(AJo,r)}logCliResponseEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_PROMPT_ID,value:JSON.stringify(e.prompt_id)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_TYPE,value:JSON.stringify(e.response_type)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_LENGTH,value:JSON.stringify(e.response_length)},{iflow_cli_key:yi.IFLOW_CLI_RESPONSE_SUCCESS,value:JSON.stringify(e.success)},{iflow_cli_key:yi.IFLOW_CLI_ERROR_MESSAGE,value:JSON.stringify(e.error)}];this.handleLogEvent(yJo,r)}logEndSessionEvent(e){let r=[{iflow_cli_key:yi.IFLOW_CLI_SESSION_ID,value:e?.session_id?.toString()??""}];this.handleLogEvent(fJo,r,!0)}getProxyAgent(){let e=this.config?.getProxy();if(e){if(e.startsWith("http"))return new $sn.HttpsProxyAgent(e);throw new Error("Unsupported proxy type")}}shutdown(){let e=new bne(this.config);this.logEndSessionEvent(e)}}});import*as jsn from"node:fs";var Oq,Qsn,Fbe,kQe,OQe,NQe,Gsn=j(()=>{"use strict";Oq=Se(Ri(),1),Qsn=Se(cx(),1);Fbe=class{writeStream;constructor(e){this.writeStream=jsn.createWriteStream(e,{flags:"a"})}serialize(e){let r=new WeakSet;return JSON.stringify(e,(o,s)=>{if(typeof s=="object"&&s!==null){if(r.has(s))return"[Circular]";r.add(s)}return s},2)+`
|
|
488
488
|
`}shutdown(){return new Promise(e=>{this.writeStream.end(e)})}},kQe=class extends Fbe{export(e,r){let n=e.map(o=>this.serialize(o)).join("");this.writeStream.write(n,o=>{r({code:o?Oq.ExportResultCode.FAILED:Oq.ExportResultCode.SUCCESS,error:o||void 0})})}},OQe=class extends Fbe{export(e,r){let n=e.map(o=>this.serialize(o)).join("");this.writeStream.write(n,o=>{r({code:o?Oq.ExportResultCode.FAILED:Oq.ExportResultCode.SUCCESS,error:o||void 0})})}},NQe=class extends Fbe{export(e,r){let n=this.serialize(e);this.writeStream.write(n,o=>{r({code:o?Oq.ExportResultCode.FAILED:Oq.ExportResultCode.SUCCESS,error:o||void 0})})}getPreferredAggregationTemporality(){return Qsn.AggregationTemporality.CUMULATIVE}async forceFlush(){return Promise.resolve()}}});var Ksn={};fo(Ksn,{flushTelemetry:()=>DRt,initializeTelemetry:()=>Ube,isTelemetrySdkInitialized:()=>Y3,shutdownTelemetry:()=>Nq});function Y3(){return Sne}function _Jo(t){if(!t)return;let e=t.replace(/^["']|["']$/g,"");try{let r=new URL(e),o=r.port==="4318"||r.protocol==="http:"||r.protocol==="https:"?"http":"grpc";return{url:o==="grpc"?r.origin:e,protocol:o}}catch(r){Xd.error("Invalid OTLP endpoint URL provided:",e,r);return}}function Ube(t){if(Sne)return;let e=(0,BQe.defaultResource)().merge((0,BQe.resourceFromAttributes)({[rEt]:If,[nEt]:process.version,"session.id":t.getSessionId()})),r=t.getTelemetryOtlpEndpoint(),n=_Jo(r),o=!!n,s=t.getTelemetryOutfile(),a=[];o&&a.push(new qsn.OTLPTraceExporter({url:`${n.url}/v1/traces`})),s&&a.push(new kQe(s));let u=[];o&&n&&u.push(new Vsn.OTLPLogExporter({url:`${n.url}/v1/logs`})),s&&u.push(new OQe(s));let c=[];o&&c.push(new i$e({exporter:new Hsn.OTLPMetricExporter({url:`${n.url}/v1/metrics`,temporalityPreference:LQe.AggregationTemporality.DELTA}),exportIntervalMillis:2e4})),s&&c.push(new LQe.PeriodicExportingMetricReader({exporter:new NQe(s),exportIntervalMillis:1e4}));let m={resource:e,serviceName:If,logRecordProcessors:[],spanProcessors:[],metricReaders:[]};a.forEach(d=>{m.spanProcessors.push(new zsn.BatchSpanProcessor(d,{exportTimeoutMillis:1e4}))}),u.forEach(d=>{m.logRecordProcessors.push(new Ysn.BatchLogRecordProcessor(d,{exportTimeoutMillis:1e4}))}),c.forEach(d=>{m.metricReaders.push(d)}),PQe=new Wsn.NodeSDK({...m});try{PQe.start(),Sne=!0,vsn()}catch(d){console.error("Error starting OpenTelemetry SDK:",d)}process.on("SIGTERM",Nq),process.on("SIGINT",Nq)}async function DRt(){if(Sne)try{let{trace:t}=await Promise.resolve().then(()=>(Xt(),cr)),e=t.getTracerProvider();"forceFlush"in e&&await e.forceFlush();let{metrics:r}=await Promise.resolve().then(()=>(Xt(),cr)),n=r.getMeterProvider();"forceFlush"in n&&await n.forceFlush()}catch(t){process.env.DEBUG&&console.error("Error flushing telemetry:",t)}}async function Nq(){if(!(!Sne||!PQe))try{_p.getInstance()?.shutdown(),await PQe.shutdown()}catch(t){console.error("Error shutting down SDK:",t)}finally{Sne=!1}}var qsn,Hsn,Vsn,Wsn,BQe,zsn,Ysn,LQe,PQe,Sne,$be=j(()=>{"use strict";Xt();qsn=Se(d4t(),1),Hsn=Se(A4t(),1),Vsn=Se(_4t(),1),Wsn=Se(Qtn(),1);qtn();N1();BQe=Se(_nn(),1),zsn=Se(NLe(),1),Ysn=Se(Ton(),1),LQe=Se(cx(),1);tne();yp();Mbe();Gsn();process.env.DEBUG?Xd.setLogger(new o3e,Cf.DEBUG):Xd.setLogger(new o3e,Cf.NONE);Sne=!1});var Jsn={};fo(Jsn,{TraceContext:()=>rC});var rC,MQe=j(()=>{"use strict";Xt();$be();rC=class{static rootSpan=null;static tracer=qo.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?Q3.with(qo.setSpan(Q3.active(),n),async()=>{try{return await e()}catch(o){throw n.recordException(o),n.setStatus({code:f_.ERROR,message:o.message}),o}}):e()}static startChildSpan(e){return this.tracer.startSpan(e,void 0,Q3.active())}static async withChildSpan(e,r,n){let o=this.startChildSpan(e);return n&&o.setAttributes(n),Q3.with(qo.setSpan(Q3.active(),o),async()=>{try{let s=await r();return o.setStatus({code:f_.OK}),s}catch(s){throw o.recordException(s),o.setStatus({code:f_.ERROR,message:s.message}),s}finally{o.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 DRt()}catch{}}})(),await this.spanLock,this.spanLock=null}static getActiveSpan(){return qo.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 jbe(){let t=qo.getActiveSpan();if(t){let r=t.spanContext();if(r&&r.traceId&&r.spanId){let o=r.traceId,s=r.spanId,a=(r.traceFlags||0).toString(16).padStart(2,"0");return`00-${o}-${s}-${a}`}}return KB.getCurrentSession()?.traceparent}function Pq(t){let e=jbe();return e?{...t,traceparent:e}:t}function IRt(){return jbe()}async function kh(t,e,r){let n=qo.getTracer("iflow-cli"),{TraceContext:o}=await Promise.resolve().then(()=>(MQe(),Jsn)),s=o.getRootSpan(),a;if(s){let u=qo.setSpan(Q3.active(),s);a=Q3.with(u,()=>n.startSpan(t,{attributes:e}))}else a=n.startSpan(t,{attributes:e});try{return await Q3.with(qo.setSpan(Q3.active(),a),r)}catch(u){throw a.recordException(u),a.setStatus({code:f_.ERROR,message:u instanceof Error?u.message:"Unknown error"}),u}finally{a.end()}}var u6=j(()=>{"use strict";Xt();FQe();});import{release as EJo,version as vJo}from"os";var UQe,KB,FQe=j(()=>{"use strict";y_t();__t();u6();UQe=class{currentSession=null;async startSession(e,r,n,o){let{model:s,tool:a}=o||{},u="iflow",c="cli",m=jbe()||"",d="";m&&(d=m.split("-")[1]??"");let f=Gee(),p=d?`${u}.${c}.${n}.${d}`:"",h=Date.now();return this.currentSession={traceId:d,parent_observation_id:f,conversationId:n,sessionId:e,userId:r,pid:u,sceneId:c,sam:p,traceparent:m,startTime:h,model:s,tool:a},await e3e("/aitrack.lifecycle.run_started",{gmkey:"AI",gokey:{pid:u,sam:p,trace_id:d,session_id:e,conversation_id:n,observation_id:f,model:s,tool:a,user_id:r}}),this.currentSession}async endSession(){if(!this.currentSession)return;let{pid:e,sam:r,traceId:n,parent_observation_id:o,model:s,tool:a,sessionId:u,conversationId:c,userId:m,startTime:d}=this.currentSession,f=Date.now()-d,p=Gee();await e3e("/aitrack.lifecycle.run_finished",{gmkey:"AI",gokey:{pid:e,sam:r,trace_id:n,session_id:u,conversation_id:c,observation_id:p,parent_observation_id:o,duration:f,model:s,tool:a,sessionId:u,user_id:m}})}async recordError(e,r){if(!this.currentSession)throw new Error("No active session to record error");let{pid:n,sam:o,traceId:s,parent_observation_id:a,model:u,tool:c,sessionId:m,conversationId:d,userId:f}=this.currentSession,p=Gee(),h="",g="";e instanceof Error?(h=e.cause?`${e.message}:${e.cause.message}`:e.message,g=e.cause?e.cause.stack||"":e.stack||""):h=String(e);let b=r?.stderr,A=`${h}
|
|
489
489
|
${g.slice(0,2e4)}`;typeof b=="string"&&b.trim().length>0&&(A=`${h}
|
|
490
490
|
${g.slice(0,15e3)}
|
|
491
491
|
|
|
492
492
|
--- STDERR ---
|
|
493
|
-
${b.slice(0,5e3)}`);let y={gmkey:"AI",gokey:{pid:n,sam:o,trace_id:s,observation_id:p,parent_observation_id:a,session_id:m,conversation_id:d,user_id:f,error_msg:A,model:u,tool:c,toolName:r?.toolName,toolArgs:r?.toolArgs?JSON.stringify(r.toolArgs):void 0,cliVer:"0.5.
|
|
493
|
+
${b.slice(0,5e3)}`);let y={gmkey:"AI",gokey:{pid:n,sam:o,trace_id:s,observation_id:p,parent_observation_id:a,session_id:m,conversation_id:d,user_id:f,error_msg:A,model:u,tool:c,toolName:r?.toolName,toolArgs:r?.toolArgs?JSON.stringify(r.toolArgs):void 0,cliVer:"0.5.10",platform:process.platform,arch:process.arch,nodeVersion:process.version,osVersion:process.platform==="darwin"?EJo():vJo()}};await e3e("/aitrack.lifecycle.run_error",y)}getCurrentSession(){return this.currentSession}},KB=new UQe});var Xsn=T((y$u,CJo)=>{CJo.exports={name:"systeminformation",version:"5.30.3",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 Rf=T(po=>{"use strict";var XB=Ae("os"),Xx=Ae("fs"),SJo=Ae("path"),LRt=Ae("child_process").spawn,wJo=Ae("child_process").exec,Gbe=Ae("child_process").execSync,xJo=Ae("util"),Bq=process.platform,MRt=Bq==="linux"||Bq==="android",ran=Bq==="darwin",GQe=Bq==="win32",nan=Bq==="freebsd",ian=Bq==="openbsd",oan=Bq==="netbsd",RRt=0,nC="",JB=null,iC=null,san=process.env.WINDIR||"C:\\Windows",Ep,wne="",Qbe=[],FRt=!1,jQe="",Zsn="$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; ",ORt="--###START###--",ean="--ERROR--",QQe="--###ENDCMD###--",NRt="--##ID##--",qQe={windowsHide:!0,maxBuffer:1024*102400,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})},HQe={maxBuffer:1024*102400,encoding:"UTF-8",stdio:["pipe","pipe","ignore"]};function TJo(t){let e=parseInt(t,10);return isNaN(e)&&(e=0),e}function DJo(t){let e=!1,r="",n="";for(let o of t)o>="0"&&o<="9"||e?(e=!0,r+=o):n+=o;return[n,r]}var $Qe=new String,PRt=new String().replace,BRt=new String().toLowerCase,aan=new String().toString,uan=new String().substr,can=new String().substring,lan=new String().trim,man=new String().startsWith,dan=Math.min;function IJo(t){return t&&{}.toString.call(t)==="[object Function]"}function RJo(t){let e=[],r={};for(let n=0;n<t.length;n++){let o=Object.keys(t[n]);o.sort((a,u)=>a-u);let s="";for(let a=0;a<o.length;a++)s+=JSON.stringify(o[a]),s+=JSON.stringify(t[n][o[a]]);({}).hasOwnProperty.call(r,s)||(e.push(t[n]),r[s]=!0)}return e}function kJo(t,e){return t.sort((r,n)=>{let o="",s="";return e.forEach(a=>{o=o+r[a],s=s+n[a]}),o<s?-1:o>s?1:0})}function OJo(){return RRt===0&&(RRt=XB.cpus().length),RRt}function ZB(t,e,r,n,o){r=r||":",e=e.toLowerCase(),n=n||!1,o=o||!1;let s="";return t.some(a=>{let u=a.toLowerCase().replace(/\t/g,"");if(n&&(u=u.trim()),u.startsWith(e)&&(!o||u.match(e+r)||u.match(e+" "+r))){let c=n?a.trim().split(r):a.split(r);if(c.length>=2)return c.shift(),s=c.join(r).trim(),!0}return!1}),s}function NJo(t,e){return e=e||16,t.replace(/\\x([0-9A-Fa-f]{2})/g,function(){return String.fromCharCode(parseInt(arguments[1],e))})}function PJo(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 BJo(t,e){e=e||"",t=t.toUpperCase();let r=0,n=0,o=PJo(t),s=t.split(o);if(s.length>=2){s[2]&&(s[1]+=s[2]);let a=s[1]&&s[1].toLowerCase().indexOf("pm")>-1||s[1].toLowerCase().indexOf("p.m.")>-1||s[1].toLowerCase().indexOf("p. m.")>-1||s[1].toLowerCase().indexOf("n")>-1||s[1].toLowerCase().indexOf("ch")>-1||s[1].toLowerCase().indexOf("\xF6s")>-1||e&&s[1].toLowerCase().indexOf(e)>-1;return r=parseInt(s[0],10),n=parseInt(s[1],10),r=a&&r<12?r+12:r,("0"+r).substr(-2)+":"+("0"+n).substr(-2)}}function LJo(t,e){let r={date:"",time:""};e=e||{};let n=(e.dateFormat||"").toLowerCase(),o=e.pmDesignator||"",s=t.split(" ");if(s[0]){if(s[0].indexOf("/")>=0){let a=s[0].split("/");a.length===3&&(a[0].length===4?r.date=a[0]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[2]).substr(-2):a[2].length===2?(n.indexOf("/d/")>-1||n.indexOf("/dd/")>-1,r.date="20"+a[2]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[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=a[2]+"-"+("0"+a[0]).substr(-2)+"-"+("0"+a[1]).substr(-2):r.date=a[2]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[0]).substr(-2))}if(s[0].indexOf(".")>=0){let a=s[0].split(".");a.length===3&&(n.indexOf(".d.")>-1||n.indexOf(".dd.")>-1?r.date=a[2]+"-"+("0"+a[0]).substr(-2)+"-"+("0"+a[1]).substr(-2):r.date=a[2]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[0]).substr(-2))}if(s[0].indexOf("-")>=0){let a=s[0].split("-");a.length===3&&(r.date=a[0]+"-"+("0"+a[1]).substr(-2)+"-"+("0"+a[2]).substr(-2))}}if(s[1]){s.shift();let a=s.join(" ");r.time=BJo(a,o)}return r}function MJo(t,e){let r=e>0,n=1,o=0,s=0,a=[];for(let c=0;c<t.length;c++)n<=e?(/\s/.test(t[c])&&!r&&(s=c-1,a.push({from:o,to:s+1,cap:t.substring(o,s+1)}),o=s+2,n++),r=t[c]===" "):(!/\s/.test(t[c])&&r&&(s=c-1,o<s&&a.push({from:o,to:s,cap:t.substring(o,s)}),o=s+1,n++),r=t[c]===" ");s=5e3,a.push({from:o,to:s,cap:t.substring(o,s)});let u=a.length;for(let c=0;c<u;c++)a[c].cap.replace(/\s/g,"").length===0&&c+1<u&&(a[c].to=a[c+1].to,a[c].cap=a[c].cap+a[c+1].cap,a.splice(c+1,1),u=u-1);return a}function FJo(t,e,r){for(let n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1}function UJo(){if(jQe="powershell.exe",GQe){let t=`${san}\\system32\\WindowsPowerShell\\v1.0\\powershell.exe`;Xx.existsSync(t)&&(jQe=t)}}function $Jo(){return GQe?`"${process.env.VBOX_INSTALL_PATH||process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"`:"vboxmanage"}function kRt(t){let e="",r,n="";if(t.indexOf(ORt)>=0){r=t.split(ORt);let s=r[1].split(NRt);e=s[0],s.length>1&&(t=s.slice(1).join(NRt))}t.indexOf(QQe)>=0&&(r=t.split(QQe),n=r[0]);let o=-1;for(let s=0;s<Qbe.length;s++)Qbe[s].id===e&&(o=s,Qbe[s].callback(n));o>=0&&Qbe.splice(o,1)}function jJo(){Ep||(Ep=LRt(jQe,["-NoProfile","-NoLogo","-InputFormat","Text","-NoExit","-Command","-"],{stdio:"pipe",windowsHide:!0,maxBuffer:1024*102400,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})}),Ep&&Ep.pid&&(FRt=!0,Ep.stdout.on("data",t=>{wne=wne+t.toString("utf8"),t.indexOf(QQe)>=0&&(kRt(wne),wne="")}),Ep.stderr.on("data",()=>{kRt(wne+ean)}),Ep.on("error",()=>{kRt(wne+ean)}),Ep.on("close",()=>{Ep&&Ep.kill()})))}function QJo(){try{Ep&&(Ep.stdin.write("exit"+XB.EOL),Ep.stdin.end())}catch{Ep&&Ep.kill()}FRt=!1,Ep=null}function GJo(t){if(FRt){let e=Math.random().toString(36).substring(2,12);return new Promise(r=>{process.nextTick(()=>{function n(o){r(o)}Qbe.push({id:e,cmd:t,callback:n,start:new Date});try{Ep&&Ep.pid&&Ep.stdin.write(Zsn+"echo "+ORt+e+NRt+"; "+XB.EOL+t+XB.EOL+"echo "+QQe+XB.EOL)}catch{r("")}})})}else{let e="";return new Promise(r=>{process.nextTick(()=>{try{let n=XB.release().split(".").map(Number),o=n[0]<10?["-NoProfile","-NoLogo","-InputFormat","Text","-NoExit","-ExecutionPolicy","Unrestricted","-Command","-"]:["-NoProfile","-NoLogo","-InputFormat","Text","-ExecutionPolicy","Unrestricted","-Command",t],s=LRt(jQe,o,{stdio:"pipe",windowsHide:!0,maxBuffer:1024*102400,encoding:"UTF-8",env:Object.assign({},process.env,{LANG:"en_US.UTF-8"})});if(s&&!s.pid&&s.on("error",()=>{r(e)}),s&&s.pid){if(s.stdout.on("data",a=>{e=e+a.toString("utf8")}),s.stderr.on("data",()=>{s.kill(),r(e)}),s.on("close",()=>{s.kill(),r(e)}),s.on("error",()=>{s.kill(),r(e)}),n[0]<10)try{s.stdin.write(Zsn+t+XB.EOL),s.stdin.write("exit"+XB.EOL),s.stdin.end()}catch{s.kill(),r(e)}}else r(e)}catch{r(e)}})})}}function qJo(t,e,r){let n="";return r=r||{},new Promise(o=>{process.nextTick(()=>{try{let s=LRt(t,e,r);s&&!s.pid&&s.on("error",()=>{o(n)}),s&&s.pid?(s.stdout.on("data",a=>{n+=a.toString()}),s.on("close",()=>{s.kill(),o(n)}),s.on("error",()=>{s.kill(),o(n)})):o(n)}catch{o(n)}})})}function HJo(){if(GQe){if(!nC)try{let r=Gbe("chcp",qQe).toString().split(`\r
|
|
494
494
|
`)[0].split(":");nC=r.length>1?r[1].replace(".","").trim():""}catch{nC="437"}return nC}if(MRt||ran||nan||ian||oan){if(!nC)try{let r=Gbe("echo $LANG",HQe).toString().split(`\r
|
|
495
495
|
`)[0].split(".");nC=r.length>1?r[1].trim():"",nC||(nC="UTF-8")}catch{nC="UTF-8"}return nC}}function VJo(){if(JB!==null)return JB;if(JB=!1,GQe)try{let t=Gbe("WHERE smartctl 2>nul",qQe).toString().split(`\r
|
|
496
496
|
`);t&&t.length?JB=t[0].indexOf(":\\")>=0:JB=!1}catch{JB=!1}if(MRt||ran||nan||ian||oan)try{JB=Gbe("which smartctl 2>/dev/null",HQe).toString().split(`\r
|
|
@@ -949,7 +949,7 @@ ${JSON.stringify(e,null,2)}`;try{let o=mcn.dirname(this.logFilePath);await lcn.m
|
|
|
949
949
|
[${new Date().toISOString()}]
|
|
950
950
|
${n}
|
|
951
951
|
${"=".repeat(80)}
|
|
952
|
-
`;await lcn.appendFile(this.logFilePath,a,"utf-8")}catch(o){console.debug(I.t("openaiContentGenerator.errors.failedWriteDebugLog"),o)}}logTelemetryFailure(e,r){let n=r instanceof Error&&r.message?r.message:String(r);u2(new Error(`${e}: ${n}`))}isClaudeModel(){return/claude/i.test(this.modelName)}isGpt5Model(){return/gpt-5/i.test(this.modelName)}async generateContent(e,r){let n={"model.name":this.modelName,"model.provider":"openai","api.endpoint":`${this.baseUrl}/chat/completions`,"session.id":this.config?.getSessionId()||"","conversation.id":this.config?.getConversationId()||""};return kh("model_call",n,async()=>{let o=Date.now(),s={},a;try{let u=await this.generateContentInternal(e,r,m=>{s=m},(m,d,f,p)=>{a=p;let h=qo.getActiveSpan();if(h){let g=Date.now()-o,b={"request.model":p?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.http_status":m||200,"response.business_error_code":d,"response.finish_reason":f||"unknown","response.duration_ms":g,"response.success":!0};try{b["request.full_body"]=this.safeStringify(s),a&&(b["response.full_body"]=this.safeStringify(a))}catch(A){console.error("Failed to serialize request/response data for telemetry:",A),b["request.body_serialization_error"]=!0,b.serialization_error_message=A instanceof Error?A.message:String(A)}try{h.setAttributes(b)}catch(A){console.error("Failed to set span attributes:",A)}}},!1),c=qo.getActiveSpan();if(c&&u.usageMetadata){let m={"response.prompt_tokens":u.usageMetadata.promptTokenCount,"response.completion_tokens":u.usageMetadata.candidatesTokenCount,"response.total_tokens":u.usageMetadata.totalTokenCount};try{m["request.full_body"]=this.safeStringify(s),a&&(m["response.full_body"]=this.safeStringify(a))}catch(d){console.error("Failed to serialize request/response data for telemetry:",d),m["request.body_serialization_error"]=!0,m.serialization_error_message=d instanceof Error?d.message:String(d)}try{c.setAttributes(m)}catch(d){console.error("Failed to set span attributes:",d)}}return u}catch(u){let c=Date.now()-o,m=u instanceof Error?u.message:String(u),d=qo.getActiveSpan();if(d){let f={"request.model":a?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.duration_ms":c,"response.success":!1,"response.error_message":m};try{f["request.full_body"]=this.safeStringify(s),a&&(f["response.full_body"]=this.safeStringify(a))}catch(p){console.error("Failed to serialize request/response data for telemetry:",p),f["request.body_serialization_error"]=!0,f.serialization_error_message=p instanceof Error?p.message:String(p)}try{d.setAttributes(f)}catch(p){console.error("Failed to set span attributes:",p)}}throw u}})}async generateContentLatency(e,r){let n=await this.generateContent(e,r);async function*o(){yield n}return o()}async generateContentStream(e,r){let n={"model.name":this.modelName,"model.provider":"openai","api.endpoint":`${this.baseUrl}/chat/completions`,"session.id":this.config?.getSessionId()||"","conversation.id":this.config?.getConversationId()||"","request.stream":!0};return kh("model_call_stream",n,async()=>{let o=Date.now(),s={},a,u;try{let c=await this.generateContentInternal(e,r,d=>{s=d},(d,f,p,h)=>{a=h;let g=qo.getActiveSpan();if(g){let b=Date.now()-o,A={"request.model":h?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.http_status":d||200,"response.business_error_code":f,"response.finish_reason":p||"unknown","response.duration_ms":b,"response.success":!0};try{A["request.full_body"]=this.safeStringify(s),a&&(A["response.full_body"]=this.safeStringify(a))}catch(y){console.error("Failed to serialize request/response data for telemetry:",y),A["request.body_serialization_error"]=!0,A.serialization_error_message=y instanceof Error?y.message:String(y)}try{g.setAttributes(A)}catch(y){console.error("Failed to set span attributes:",y)}}},!0);return async function*(){try{for await(let f of this.parseStreamResponse(c))f.usageMetadata&&(u=f.usageMetadata),yield f;let d=qo.getActiveSpan();if(d&&u){let f={"response.prompt_tokens":u.promptTokenCount||0,"response.completion_tokens":u.candidatesTokenCount||0,"response.total_tokens":u.totalTokenCount||0};try{f["request.full_body"]=this.safeStringify(s),a&&(f["response.full_body"]=this.safeStringify(a))}catch(p){console.error("Failed to serialize request/response data for telemetry:",p),f["request.body_serialization_error"]=!0,f.serialization_error_message=p instanceof Error?p.message:String(p)}try{d.setAttributes(f)}catch(p){console.error("Failed to set span attributes:",p)}}}catch(d){let f=Date.now()-o,p=d instanceof Error?d.message:String(d),h=qo.getActiveSpan();if(h){let g={"request.model":a?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.duration_ms":f,"response.success":!1,"response.error_message":p,"response.error_stage":"stream_processing"};try{g["request.full_body"]=this.safeStringify(s),a&&(g["response.full_body"]=this.safeStringify(a))}catch(b){console.error("Failed to serialize request/response data for telemetry:",b),g["request.body_serialization_error"]=!0,g.serialization_error_message=b instanceof Error?b.message:String(b)}try{h.setAttributes(g)}catch(b){console.error("Failed to set span attributes:",b)}}throw d}}.bind(this)()}catch(c){let m=Date.now()-o,d=c instanceof Error?c.message:String(c),f=qo.getActiveSpan();if(f){let p={"request.model":a?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.duration_ms":m,"response.success":!1,"response.error_message":d,"response.error_stage":"request_initialization"};try{p["request.full_body"]=this.safeStringify(s),a&&(p["response.full_body"]=this.safeStringify(a))}catch(h){console.error("Failed to serialize request/response data for telemetry:",h),p["request.body_serialization_error"]=!0,p.serialization_error_message=h instanceof Error?h.message:String(h)}try{f.setAttributes(p)}catch(h){console.error("Failed to set span attributes:",h)}}throw u2(c),new Error(I.t("openaiContentGenerator.errors.generateContentStreamFailed",{error:d}))}})}safeStringify(e){let r=new WeakSet;return JSON.stringify(e,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular Reference]";r.add(o)}return o})}async generateContentInternal(e,r,n,o,s=!1){let a=BR.api;a.start("OpenAI-GenerateContent-Total");let u=!1;try{if((this.authType===er.LOGIN_WITH_IFLOW||this.authType===er.IFLOW)&&await $ee()){this.authType===er.LOGIN_WITH_IFLOW&&await Uke();let{getCachedApiKey:Q}=await Promise.resolve().then(()=>(iB(),l_t)),W=await Q();W&&(this.apiKey=W)}let c=await this.convertToOpenAIMessages(e),m=rcn(c);if(this.config){let G=this.config.getConversationId();if(G)try{await wkt(this.config,G,{model:this.modelName,tool:m})}catch(Q){this.logTelemetryFailure("Telemetry initialization failed",Q)}}let d=this.convertToOpenAITools(e.config?.tools),f={model:this.modelName,messages:c};s&&(f.stream=!0),(this.authType===er.LOGIN_WITH_IFLOW||this.authType===er.IFLOW)&&this.modelName==="glm-4.6"&&(f.model="glm-4.6-exp");let p=!1;this.config?.getTemperature()!==void 0&&this.config.getTemperature()!==-1?(f.temperature=this.config.getTemperature(),p=!0):e.config?.temperature!==void 0&&(this.config?.getTemperature()===void 0||this.config.getTemperature()!==-1)&&(f.temperature=e.config.temperature,p=!0),p||(this.config?.getTopP()!==void 0&&this.config.getTopP()!==-1?f.top_p=this.config.getTopP():e.config?.topP!==void 0&&(this.config?.getTopP()===void 0||this.config.getTopP()!==-1)&&(f.top_p=e.config.topP));let h=this.config?.getContentGeneratorConfig?.();h?.thinking&&h.thinking.maxTokens>0?c2.configureThinkingRequest(f.model,f,h.thinking)||console.debug(`Model ${this.modelName} does not support thinking mode`):c2.configureNonThinkingRequest(f.model,f),this.modelName.includes("glm-4.7")&&(f.temperature=1,f.top_p=.95);let g=await this.calculateInputTokens(e),b=kkt(f.model,g,this.config?.getOutputTokensLimit());this.modelName.startsWith("kimi-k2.5")&&(f.top_p=.95,f.n=1,f.presence_penalty=0,f.frequency_penalty=0,f.max_tokens=b);let A="global";A==="aone"&&(f.max_tokens=b),this.modelName.includes("deepseek")&&f.model!=="deepseek-v3.2-reasoner"&&(f.max_tokens=b),f.max_new_tokens=b,e.config?.stopSequences&&e.config.stopSequences.length>0&&(f.stop=e.config.stopSequences),d&&d.length>0&&(f.tools=d,this.modelName.startsWith("kimi-k2.5")&&f.thinking?.type==="enabled"&&(f.tool_choice?f.tool_choice!=="auto"&&f.tool_choice!=="none"&&console.warn(`[Kimi K2.5] Thinking mode only supports tool_choice: "auto" or "none". Provided: "${f.tool_choice}". The API will reject this request.`):f.tool_choice="auto")),await this.logToPromptFile(f,"INPUT REQUEST"),n&&n(f);let y=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl;["offline-whale-wave.alibaba-inc.com","whale.wave.vipserver.offline","whale-wave.alibaba-inc.com","pre-whale-wave.alibaba-inc.com","internal-offline-whale-wave.alibaba-inc.com","internal-whale-wave.alibaba-inc.com"].some(G=>y.includes(G))&&(f.extend_fields={sessionId:this.config?.getSessionId()||""}),f.model==="iFlow-ROME-30BA3B"&&(f.temperature=.7,f.top_p=.8,f.top_k=20);let v=Date.now(),C=IRt(),x="iFlow-Cli",k=this.config?.getSessionId()||"",R=Date.now(),P={"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"user-agent":x,"session-id":k,"conversation-id":this.config?.getConversationId()||""},D=ucn(x,k,R,this.apiKey);D&&(P["x-iflow-signature"]=D,P["x-iflow-timestamp"]=R.toString()),C&&(P={...P,traceparent:C}),A==="aone"&&(P={...P,"X-Client-Type":"iflow-cli","X-Client-Version":"0.5.8-beta-20260211"}),TGe(this.config,new _ne(this.baseUrl,this.modelName,JSON.stringify(f),r,JSON.stringify(e.contents)));let O=await fetch(`${y}/chat/completions`,{signal:e.config?.abortSignal,method:"POST",headers:P,body:JSON.stringify(f)}),N=Date.now()-v;if(s&&O.ok)return O;if(!O.ok){o&&o(O.status);let G=await O.text();if(this.config)try{await CGe(this.config,new Error(G)),s8(this.config,new wb(this.modelName,G,N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"http_error",O.status,O.status,void 0))}catch(Q){this.logTelemetryFailure("Telemetry error recording failed",Q)}throw O.status===511?(this.config&&s8(this.config,new wb(this.modelName,"Content length exceeded",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"content_length_exceed",511,200,511)),new Error(I.t("openaiContentGenerator.errors.contentLengthExceed",{traceId:C||O.headers.get("eagleeye-traceid")}))):O.status===514?(this.config&&s8(this.config,new wb(this.modelName,"model_error",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"model_error",514,200,514)),new Error(I.t("openaiContentGenerator.errors.modelError",{traceId:C||O.headers.get("eagleeye-traceid")}))):O.status===429?(this.config&&s8(this.config,new wb(this.modelName,"Rate limit reached",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",429,200,429)),new Error(I.t("openaiContentGenerator.errors.modelRateLimitReached"))):new Error(I.t("openaiContentGenerator.errors.httpError",{status:O.status,body:G,traceId:C||O.headers.get("eagleeye-traceid")}))}let L;try{L=await O.json()}catch(G){throw u2(G),new Error(I.t("openaiContentGenerator.errors.responseFormatError",{traceId:C||O.headers.get("eagleeye-traceid")}))}if(L.error_code&&(L.error_code===511||L.error_code===413))throw this.config&&s8(this.config,new wb(this.modelName,"Content length exceeded",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"content_length_exceed",L.error_code,200,L.error_code)),new Error(I.t("openaiContentGenerator.errors.contentLengthExceed",{traceId:C||O.headers.get("eagleeye-traceid")}));if(L.error_code&&L.error_code===514)throw this.config&&s8(this.config,new wb(this.modelName,"model_error",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"model_error",514,200,514)),new Error(I.t("openaiContentGenerator.errors.modelError",{traceId:C||O.headers.get("eagleeye-traceid")}));if(L.status&&L.status==="439"||L.error_code&&L.error_code===439)throw this.config&&s8(this.config,new wb(this.modelName,"API token expired",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"token_expired",439,200,439)),new Error(I.t("openaiContentGenerator.errors.apiTokenExpired"));if(L.msg&&(L.msg.includes("invalid apiKey")||L.msg.includes("Invalid apiKey")))throw new Error(I.t("openaiContentGenerator.errors.invalidApiKey"));if(L.status&&(L.status==="434"||L.status===434))throw this.config&&s8(this.config,new wb(this.modelName,"Invalid API key",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"invalid_api_key",434,200,434)),new Error(I.t("openaiContentGenerator.errors.invalidApiKey"));if(L.status&&(L.status==="435"||L.status===435))throw this.config&&s8(this.config,new wb(this.modelName,"Model Not Support",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"Model Not Support",435,200,435)),new Error(I.t("openaiContentGenerator.errors.modelNotSupport"));if(L.status&&L.status==="429"||L.error_code&&(L.error_code===429||L.error_code===8211))throw this.config&&s8(this.config,new wb(this.modelName,"Rate limit reached",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",L.error_code||L.status||429,200,L.error_code||L.status||429)),new Error(I.t("openaiContentGenerator.errors.modelRateLimitReached"));if(L.status&&L.status==="449"||L.error_code&&L.error_code===449)throw this.config&&s8(this.config,new wb(this.modelName,"Rate limit reached",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",449,200,449)),new Error(I.t("openaiContentGenerator.errors.rateLimitReached"));if(!L||!L.choices||!Array.isArray(L.choices)||L.choices.length===0){let G=C||O.headers.get("eagleeye-traceid");throw new Error(I.t("openaiContentGenerator.errors.invalidResponseFormat",{traceId:G}))}if(await this.logToPromptFile(L,"API RESPONSE"),L.usage){let G={...L.usage,total_tokens:L.usage.total_tokens+(L.usage.cache_creation_input_tokens||0)+(L.usage.cache_read_input_tokens||0),prompt_tokens:L.usage.prompt_tokens+(L.usage.cache_creation_input_tokens||0)+(L.usage.cache_read_input_tokens||0)};this.lastUsageMetadata={total_tokens:G.total_tokens,prompt_tokens:G.prompt_tokens,completion_tokens:G.completion_tokens}}let{response:F,hadJsonFixes:B}=await this.convertFromOpenAIResponse(L);if(u=B,o){let G=L.choices[0]?.finish_reason,Q=L.error_code;o(200,Q,G,L)}if(this.config)try{let G=L.choices[0]?.finish_reason;IGe(this.config,new Ene(this.modelName,N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,L.usage?{promptTokenCount:L.usage.prompt_tokens||0,candidatesTokenCount:L.usage.completion_tokens||0,totalTokenCount:L.usage.total_tokens||0,cachedContentTokenCount:0,thoughtsTokenCount:0,toolUsePromptTokenCount:0}:void 0,JSON.stringify(L,null,2),void 0,G,200,void 0)),await dAe(this.config),CRt(this.config,!0,!1,u)}catch(G){this.logTelemetryFailure("Telemetry cleanup failed",G)}return F}catch(c){if(u2(c),c?.name==="AbortError")throw new Error(I.t("openaiContentGenerator.errors.userCancel"));if(this.config&&!(c instanceof Error&&c.message==="user cancel")&&(await CGe(this.config,c instanceof Error?c:new Error(String(c))),CRt(this.config,!1,!1,u,c instanceof Error?c.message:String(c))),c instanceof Error&&c.cause?.name?.includes("InvalidArgumentError"))throw new Error(I.t("openaiContentGenerator.errors.apiKeyError"));if(c instanceof Error&&c.message&&["iFlow Login expired","Your iFlow Login expired","Your API Token has expired","platform rate limit","platform concurrency limit","Your input has exceeded","the network is unavailable","\u60A8\u7684 iFlow \u767B\u5F55\u5DF2\u8FC7\u671F","\u767B\u5F55\u5DF2\u8FC7\u671F","API Token \u5DF2\u8FC7\u671F","API Token\u5DF2\u8FC7\u671F","\u5E73\u53F0\u901F\u7387\u9650\u5236","\u5E73\u53F0\u5E76\u53D1\u9650\u5236","\u60A8\u7684\u8F93\u5165\u8D85\u8FC7\u4E86\u6A21\u578B\u7684\u4E0A\u4E0B\u6587\u957F\u5EA6","\u60A8\u7684\u8F93\u5165\u5DF2\u8D85\u51FA","\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"].some(f=>c.message.includes(f)))throw new Error(c.message);let m="";throw c instanceof Error?m=c.cause?`${c.message}:${c.cause.message}`:c.message:m=String(c),new Error(I.t("openaiContentGenerator.errors.generateDataError",{error:m}),{cause:c})}finally{a.end("OpenAI-GenerateContent-Total")}}async countTokens(e,r=!1){let n=e.useCache??!0;if(!r&&this.lastUsageMetadata?.total_tokens)return{totalTokens:this.lastUsageMetadata.total_tokens};let o=this.extractTextFromRequest(e);return{totalTokens:Math.ceil(o.length/4)}}async calculateInputTokens(e){try{let r={model:this.modelName,contents:e.contents,config:{systemInstruction:e.config?.systemInstruction}};return(await this.countTokens(r)).totalTokens||0}catch{let n=this.extractTextFromRequest({model:this.modelName,contents:e.contents});return Math.ceil(n.length/4)}}async embedContent(e){try{let r=this.extractTextFromEmbedRequest(e),n=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl,o=await fetch(`${n}/v1/embeddings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:this.modelName,input:r})});if(!o.ok){let a=await o.text();throw new Error(`HTTP error! status: ${o.status}, body: ${a}`)}return{embeddings:[{values:(await o.json()).data[0].embedding}]}}catch(r){throw u2(r),new Error(I.t("openaiContentGenerator.errors.embedContentFailed",{error:r instanceof Error?r.message:String(r)}))}}async convertToOpenAIMessages(e){let r=[],n=new Set,o=new Map;if(e.contents){let a=Array.isArray(e.contents)?e.contents:[e.contents];for(let u of a)if(typeof u=="object"&&u!==null&&"parts"in u&&u.parts){let c=Array.isArray(u.parts)?u.parts:[u.parts];for(let m of c){if(m.functionCall){let d=m.functionCall.id||`call_${Date.now()}_${Math.random().toString(36).substring(2,11)}`;n.add(d)}if(m.functionResponse){let d=m.functionResponse.id||m.functionResponse.name||"";d.startsWith(a8)&&n.add(d);let f=m.functionResponse.response?.output??(m.functionResponse.response?JSON.stringify(m.functionResponse.response):"");o.set(d,{role:"tool",tool_call_id:d,content:f})}}}for(let[u]of o)n.has(u)||o.delete(u)}if(e.config?.systemInstruction){let a=this.extractSystemInstruction(e.config.systemInstruction);a&&r.push({role:"system",content:a})}if(e.contents){let a=Array.isArray(e.contents)?e.contents:[e.contents];for(let u of a){if(typeof u=="string"){r.push({role:"user",content:u});continue}if(typeof u=="object"&&u!==null&&"text"in u&&u.text){r.push({role:"user",content:u.text});continue}if(typeof u=="object"&&u!==null&&"parts"in u&&u.parts){let c=Array.isArray(u.parts)?u.parts:[u.parts];if(u.role==="model"){let m={role:"assistant",content:"",tool_calls:[]},d=[],f="";for(let h of c)h.thought&&"text"in h&&h.text&&(d.push(h.text),h.thoughtSignature&&h.thoughtSignature!==""&&(f=h.thoughtSignature));d.length>0&&(m.reasoning_content=d.join(""),f&&(m.signature=f));let p=[];for(let h of c)if(!h.thought&&("text"in h&&h.text&&p.push(h.text),h.functionCall)){let g=h.functionCall.id||`call_${Date.now()}_${Math.random().toString(36).substring(2,11)}`;m.tool_calls.push({id:g,function:{name:h.functionCall.name||"",arguments:JSON.stringify(h.functionCall.args||{})},type:"function"})}if(p.length>0&&(m.content=p.join("")),(m.content||m.reasoning_content||m.tool_calls.length>0)&&(m.tool_calls.length===0&&delete m.tool_calls,r.push(m),m.tool_calls&&m.tool_calls.length>0))for(let h of m.tool_calls){let g=o.get(h.id);g?r.push(g):r.push({role:"tool",tool_call_id:h.id,content:I.t("openaiContentGenerator.messages.toolNotExecuted")})}}else{let m=[];for(let d of c)if("text"in d&&d.text)m.push({type:"text",text:d.text});else if(d.inlineData){let f=d.inlineData;if(f.mimeType&&f.mimeType.startsWith("image/")){let p=this.authType===er.IFLOW||this.authType===er.LOGIN_WITH_IFLOW||this.baseUrl&&this.baseUrl.toLowerCase().includes("apis.iflow.cn"),h=this.authType===er.AONE||this.authType===er.LOGIN_WITH_AONE;if(!p&&!h)m.push({type:"image_url",image_url:{url:"data:"+f.mimeType+";base64,"+f.data}});else if(lC.isMultimodalModel(this.modelName))m.push({type:"image_url",image_url:{url:"data:"+f.mimeType+";base64,"+f.data}});else try{if(!f.data)throw new Error(I.t("openaiContentGenerator.errors.imageDataMissing"));let b=await this.multimodalHelper.generateImageDescription(f.data,f.mimeType);m.push({type:"text",text:`[Image Description]: ${b}`})}catch(b){u2(b),m.push({type:"text",text:I.t("openaiContentGenerator.errors.imageContentCannotParse",{error:b instanceof Error?b.message:String(b)})})}}}m.length>0&&r.push({role:"user",content:m})}}}}if("global"==="aone"&&this.isClaudeModel()&&r.length>0){let a=r[r.length-1];if(a.role==="user"||a.role==="assistant"){if(typeof a.content=="string")a.content=[{type:"text",text:a.content,cache_control:{type:"ephemeral"}}];else if(Array.isArray(a.content)){let u=a.content[a.content.length-1];u&&typeof u=="object"&&(u.cache_control={type:"ephemeral"})}}else a.role==="tool"&&(a.cache_control={type:"ephemeral"})}return r}createGeminiResponse(){let e=new jee;return e.candidates=[{content:{parts:[],role:"model"}}],e}async convertFromOpenAIResponse(e){let r=e.choices[0],n=this.createGeminiResponse(),o=n.candidates?.[0],s=!1;if(!r||!r.message)return{response:n,hadJsonFixes:s};if(r.message.reasoning_content!==null&&r.message.reasoning_content!==void 0&&o?.content?.parts&&o.content.parts.push({thought:!0,text:r.message.reasoning_content,thoughtSignature:r.message.signature??""}),r.message.reasoning&&o?.content?.parts&&o.content.parts.push({thought:!0,text:r.message.reasoning}),r.message.content&&r.message.content.trim()&&o?.content?.parts&&o.content.parts.push({text:r.message.content}),r.message.tool_calls&&Array.isArray(r.message.tool_calls))for(let a of r.message.tool_calls){let u;try{u=JSON.parse(a.function.arguments)}catch(c){if(u2(c),this.baseUrl==="https://apis.iflow.cn/v1"||this.baseUrl==="https://ducky.code.alibaba-inc.com/v1/openai")try{u=await this.fixInvalidJsonWithQwen(a.function.arguments),s=!0}catch(m){u2(m),console.error("Failed to fix JSON",m),u={}}else u={}}o?.content?.parts?.push({functionCall:{id:a.id,name:a.function.name,args:u}})}return o&&r.finish_reason!=="tool_calls"&&r.finish_reason&&(o.finishReason=this.mapFinishReason(r.finish_reason)),n.usageMetadata={promptTokenCount:e.usage?.prompt_tokens||0,candidatesTokenCount:e.usage?.completion_tokens||0,totalTokenCount:e.usage?.total_tokens||0},{response:n,hadJsonFixes:s}}async fixInvalidJsonWithQwen(e){let r=`
|
|
952
|
+
`;await lcn.appendFile(this.logFilePath,a,"utf-8")}catch(o){console.debug(I.t("openaiContentGenerator.errors.failedWriteDebugLog"),o)}}logTelemetryFailure(e,r){let n=r instanceof Error&&r.message?r.message:String(r);u2(new Error(`${e}: ${n}`))}isClaudeModel(){return/claude/i.test(this.modelName)}isGpt5Model(){return/gpt-5/i.test(this.modelName)}async generateContent(e,r){let n={"model.name":this.modelName,"model.provider":"openai","api.endpoint":`${this.baseUrl}/chat/completions`,"session.id":this.config?.getSessionId()||"","conversation.id":this.config?.getConversationId()||""};return kh("model_call",n,async()=>{let o=Date.now(),s={},a;try{let u=await this.generateContentInternal(e,r,m=>{s=m},(m,d,f,p)=>{a=p;let h=qo.getActiveSpan();if(h){let g=Date.now()-o,b={"request.model":p?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.http_status":m||200,"response.business_error_code":d,"response.finish_reason":f||"unknown","response.duration_ms":g,"response.success":!0};try{b["request.full_body"]=this.safeStringify(s),a&&(b["response.full_body"]=this.safeStringify(a))}catch(A){console.error("Failed to serialize request/response data for telemetry:",A),b["request.body_serialization_error"]=!0,b.serialization_error_message=A instanceof Error?A.message:String(A)}try{h.setAttributes(b)}catch(A){console.error("Failed to set span attributes:",A)}}},!1),c=qo.getActiveSpan();if(c&&u.usageMetadata){let m={"response.prompt_tokens":u.usageMetadata.promptTokenCount,"response.completion_tokens":u.usageMetadata.candidatesTokenCount,"response.total_tokens":u.usageMetadata.totalTokenCount};try{m["request.full_body"]=this.safeStringify(s),a&&(m["response.full_body"]=this.safeStringify(a))}catch(d){console.error("Failed to serialize request/response data for telemetry:",d),m["request.body_serialization_error"]=!0,m.serialization_error_message=d instanceof Error?d.message:String(d)}try{c.setAttributes(m)}catch(d){console.error("Failed to set span attributes:",d)}}return u}catch(u){let c=Date.now()-o,m=u instanceof Error?u.message:String(u),d=qo.getActiveSpan();if(d){let f={"request.model":a?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.duration_ms":c,"response.success":!1,"response.error_message":m};try{f["request.full_body"]=this.safeStringify(s),a&&(f["response.full_body"]=this.safeStringify(a))}catch(p){console.error("Failed to serialize request/response data for telemetry:",p),f["request.body_serialization_error"]=!0,f.serialization_error_message=p instanceof Error?p.message:String(p)}try{d.setAttributes(f)}catch(p){console.error("Failed to set span attributes:",p)}}throw u}})}async generateContentLatency(e,r){let n=await this.generateContent(e,r);async function*o(){yield n}return o()}async generateContentStream(e,r){let n={"model.name":this.modelName,"model.provider":"openai","api.endpoint":`${this.baseUrl}/chat/completions`,"session.id":this.config?.getSessionId()||"","conversation.id":this.config?.getConversationId()||"","request.stream":!0};return kh("model_call_stream",n,async()=>{let o=Date.now(),s={},a,u;try{let c=await this.generateContentInternal(e,r,d=>{s=d},(d,f,p,h)=>{a=h;let g=qo.getActiveSpan();if(g){let b=Date.now()-o,A={"request.model":h?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.http_status":d||200,"response.business_error_code":f,"response.finish_reason":p||"unknown","response.duration_ms":b,"response.success":!0};try{A["request.full_body"]=this.safeStringify(s),a&&(A["response.full_body"]=this.safeStringify(a))}catch(y){console.error("Failed to serialize request/response data for telemetry:",y),A["request.body_serialization_error"]=!0,A.serialization_error_message=y instanceof Error?y.message:String(y)}try{g.setAttributes(A)}catch(y){console.error("Failed to set span attributes:",y)}}},!0);return async function*(){try{for await(let f of this.parseStreamResponse(c))f.usageMetadata&&(u=f.usageMetadata),yield f;let d=qo.getActiveSpan();if(d&&u){let f={"response.prompt_tokens":u.promptTokenCount||0,"response.completion_tokens":u.candidatesTokenCount||0,"response.total_tokens":u.totalTokenCount||0};try{f["request.full_body"]=this.safeStringify(s),a&&(f["response.full_body"]=this.safeStringify(a))}catch(p){console.error("Failed to serialize request/response data for telemetry:",p),f["request.body_serialization_error"]=!0,f.serialization_error_message=p instanceof Error?p.message:String(p)}try{d.setAttributes(f)}catch(p){console.error("Failed to set span attributes:",p)}}}catch(d){let f=Date.now()-o,p=d instanceof Error?d.message:String(d),h=qo.getActiveSpan();if(h){let g={"request.model":a?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.duration_ms":f,"response.success":!1,"response.error_message":p,"response.error_stage":"stream_processing"};try{g["request.full_body"]=this.safeStringify(s),a&&(g["response.full_body"]=this.safeStringify(a))}catch(b){console.error("Failed to serialize request/response data for telemetry:",b),g["request.body_serialization_error"]=!0,g.serialization_error_message=b instanceof Error?b.message:String(b)}try{h.setAttributes(g)}catch(b){console.error("Failed to set span attributes:",b)}}throw d}}.bind(this)()}catch(c){let m=Date.now()-o,d=c instanceof Error?c.message:String(c),f=qo.getActiveSpan();if(f){let p={"request.model":a?.model||s.model||this.modelName,"request.temperature":s.temperature,"request.max_tokens":s.max_tokens||s.max_new_tokens,"request.tools_count":s.tools?.length||0,"request.messages_count":s.messages?.length||0,"response.duration_ms":m,"response.success":!1,"response.error_message":d,"response.error_stage":"request_initialization"};try{p["request.full_body"]=this.safeStringify(s),a&&(p["response.full_body"]=this.safeStringify(a))}catch(h){console.error("Failed to serialize request/response data for telemetry:",h),p["request.body_serialization_error"]=!0,p.serialization_error_message=h instanceof Error?h.message:String(h)}try{f.setAttributes(p)}catch(h){console.error("Failed to set span attributes:",h)}}throw u2(c),new Error(I.t("openaiContentGenerator.errors.generateContentStreamFailed",{error:d}))}})}safeStringify(e){let r=new WeakSet;return JSON.stringify(e,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[Circular Reference]";r.add(o)}return o})}async generateContentInternal(e,r,n,o,s=!1){let a=BR.api;a.start("OpenAI-GenerateContent-Total");let u=!1;try{if((this.authType===er.LOGIN_WITH_IFLOW||this.authType===er.IFLOW)&&await $ee()){this.authType===er.LOGIN_WITH_IFLOW&&await Uke();let{getCachedApiKey:Q}=await Promise.resolve().then(()=>(iB(),l_t)),W=await Q();W&&(this.apiKey=W)}let c=await this.convertToOpenAIMessages(e),m=rcn(c);if(this.config){let G=this.config.getConversationId();if(G)try{await wkt(this.config,G,{model:this.modelName,tool:m})}catch(Q){this.logTelemetryFailure("Telemetry initialization failed",Q)}}let d=this.convertToOpenAITools(e.config?.tools),f={model:this.modelName,messages:c};s&&(f.stream=!0),(this.authType===er.LOGIN_WITH_IFLOW||this.authType===er.IFLOW)&&this.modelName==="glm-4.6"&&(f.model="glm-4.6-exp");let p=!1;this.config?.getTemperature()!==void 0&&this.config.getTemperature()!==-1?(f.temperature=this.config.getTemperature(),p=!0):e.config?.temperature!==void 0&&(this.config?.getTemperature()===void 0||this.config.getTemperature()!==-1)&&(f.temperature=e.config.temperature,p=!0),p||(this.config?.getTopP()!==void 0&&this.config.getTopP()!==-1?f.top_p=this.config.getTopP():e.config?.topP!==void 0&&(this.config?.getTopP()===void 0||this.config.getTopP()!==-1)&&(f.top_p=e.config.topP));let h=this.config?.getContentGeneratorConfig?.();h?.thinking&&h.thinking.maxTokens>0?c2.configureThinkingRequest(f.model,f,h.thinking)||console.debug(`Model ${this.modelName} does not support thinking mode`):c2.configureNonThinkingRequest(f.model,f),this.modelName.includes("glm-4.7")&&(f.temperature=1,f.top_p=.95);let g=await this.calculateInputTokens(e),b=kkt(f.model,g,this.config?.getOutputTokensLimit());this.modelName.startsWith("kimi-k2.5")&&(f.top_p=.95,f.n=1,f.presence_penalty=0,f.frequency_penalty=0,f.max_tokens=b);let A="global";A==="aone"&&(f.max_tokens=b),this.modelName.includes("deepseek")&&f.model!=="deepseek-v3.2-reasoner"&&(f.max_tokens=b),f.max_new_tokens=b,e.config?.stopSequences&&e.config.stopSequences.length>0&&(f.stop=e.config.stopSequences),d&&d.length>0&&(f.tools=d,this.modelName.startsWith("kimi-k2.5")&&f.thinking?.type==="enabled"&&(f.tool_choice?f.tool_choice!=="auto"&&f.tool_choice!=="none"&&console.warn(`[Kimi K2.5] Thinking mode only supports tool_choice: "auto" or "none". Provided: "${f.tool_choice}". The API will reject this request.`):f.tool_choice="auto")),await this.logToPromptFile(f,"INPUT REQUEST"),n&&n(f);let y=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl;["offline-whale-wave.alibaba-inc.com","whale.wave.vipserver.offline","whale-wave.alibaba-inc.com","pre-whale-wave.alibaba-inc.com","internal-offline-whale-wave.alibaba-inc.com","internal-whale-wave.alibaba-inc.com"].some(G=>y.includes(G))&&(f.extend_fields={sessionId:this.config?.getSessionId()||""}),f.model==="iFlow-ROME-30BA3B"&&(f.temperature=.7,f.top_p=.8,f.top_k=20);let v=Date.now(),C=IRt(),x="iFlow-Cli",k=this.config?.getSessionId()||"",R=Date.now(),P={"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"user-agent":x,"session-id":k,"conversation-id":this.config?.getConversationId()||""},D=ucn(x,k,R,this.apiKey);D&&(P["x-iflow-signature"]=D,P["x-iflow-timestamp"]=R.toString()),C&&(P={...P,traceparent:C}),A==="aone"&&(P={...P,"X-Client-Type":"iflow-cli","X-Client-Version":"0.5.10"}),TGe(this.config,new _ne(this.baseUrl,this.modelName,JSON.stringify(f),r,JSON.stringify(e.contents)));let O=await fetch(`${y}/chat/completions`,{signal:e.config?.abortSignal,method:"POST",headers:P,body:JSON.stringify(f)}),N=Date.now()-v;if(s&&O.ok)return O;if(!O.ok){o&&o(O.status);let G=await O.text();if(this.config)try{await CGe(this.config,new Error(G)),s8(this.config,new wb(this.modelName,G,N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"http_error",O.status,O.status,void 0))}catch(Q){this.logTelemetryFailure("Telemetry error recording failed",Q)}throw O.status===511?(this.config&&s8(this.config,new wb(this.modelName,"Content length exceeded",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"content_length_exceed",511,200,511)),new Error(I.t("openaiContentGenerator.errors.contentLengthExceed",{traceId:C||O.headers.get("eagleeye-traceid")}))):O.status===514?(this.config&&s8(this.config,new wb(this.modelName,"model_error",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"model_error",514,200,514)),new Error(I.t("openaiContentGenerator.errors.modelError",{traceId:C||O.headers.get("eagleeye-traceid")}))):O.status===429?(this.config&&s8(this.config,new wb(this.modelName,"Rate limit reached",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",429,200,429)),new Error(I.t("openaiContentGenerator.errors.modelRateLimitReached"))):new Error(I.t("openaiContentGenerator.errors.httpError",{status:O.status,body:G,traceId:C||O.headers.get("eagleeye-traceid")}))}let L;try{L=await O.json()}catch(G){throw u2(G),new Error(I.t("openaiContentGenerator.errors.responseFormatError",{traceId:C||O.headers.get("eagleeye-traceid")}))}if(L.error_code&&(L.error_code===511||L.error_code===413))throw this.config&&s8(this.config,new wb(this.modelName,"Content length exceeded",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"content_length_exceed",L.error_code,200,L.error_code)),new Error(I.t("openaiContentGenerator.errors.contentLengthExceed",{traceId:C||O.headers.get("eagleeye-traceid")}));if(L.error_code&&L.error_code===514)throw this.config&&s8(this.config,new wb(this.modelName,"model_error",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"model_error",514,200,514)),new Error(I.t("openaiContentGenerator.errors.modelError",{traceId:C||O.headers.get("eagleeye-traceid")}));if(L.status&&L.status==="439"||L.error_code&&L.error_code===439)throw this.config&&s8(this.config,new wb(this.modelName,"API token expired",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"token_expired",439,200,439)),new Error(I.t("openaiContentGenerator.errors.apiTokenExpired"));if(L.msg&&(L.msg.includes("invalid apiKey")||L.msg.includes("Invalid apiKey")))throw new Error(I.t("openaiContentGenerator.errors.invalidApiKey"));if(L.status&&(L.status==="434"||L.status===434))throw this.config&&s8(this.config,new wb(this.modelName,"Invalid API key",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"invalid_api_key",434,200,434)),new Error(I.t("openaiContentGenerator.errors.invalidApiKey"));if(L.status&&(L.status==="435"||L.status===435))throw this.config&&s8(this.config,new wb(this.modelName,"Model Not Support",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"Model Not Support",435,200,435)),new Error(I.t("openaiContentGenerator.errors.modelNotSupport"));if(L.status&&L.status==="429"||L.error_code&&(L.error_code===429||L.error_code===8211))throw this.config&&s8(this.config,new wb(this.modelName,"Rate limit reached",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",L.error_code||L.status||429,200,L.error_code||L.status||429)),new Error(I.t("openaiContentGenerator.errors.modelRateLimitReached"));if(L.status&&L.status==="449"||L.error_code&&L.error_code===449)throw this.config&&s8(this.config,new wb(this.modelName,"Rate limit reached",N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,"rate_limit",449,200,449)),new Error(I.t("openaiContentGenerator.errors.rateLimitReached"));if(!L||!L.choices||!Array.isArray(L.choices)||L.choices.length===0){let G=C||O.headers.get("eagleeye-traceid");throw new Error(I.t("openaiContentGenerator.errors.invalidResponseFormat",{traceId:G}))}if(await this.logToPromptFile(L,"API RESPONSE"),L.usage){let G={...L.usage,total_tokens:L.usage.total_tokens+(L.usage.cache_creation_input_tokens||0)+(L.usage.cache_read_input_tokens||0),prompt_tokens:L.usage.prompt_tokens+(L.usage.cache_creation_input_tokens||0)+(L.usage.cache_read_input_tokens||0)};this.lastUsageMetadata={total_tokens:G.total_tokens,prompt_tokens:G.prompt_tokens,completion_tokens:G.completion_tokens}}let{response:F,hadJsonFixes:B}=await this.convertFromOpenAIResponse(L);if(u=B,o){let G=L.choices[0]?.finish_reason,Q=L.error_code;o(200,Q,G,L)}if(this.config)try{let G=L.choices[0]?.finish_reason;IGe(this.config,new Ene(this.modelName,N,this.config.getSessionId()||"unknown",this.config.getContentGeneratorConfig()?.authType,L.usage?{promptTokenCount:L.usage.prompt_tokens||0,candidatesTokenCount:L.usage.completion_tokens||0,totalTokenCount:L.usage.total_tokens||0,cachedContentTokenCount:0,thoughtsTokenCount:0,toolUsePromptTokenCount:0}:void 0,JSON.stringify(L,null,2),void 0,G,200,void 0)),await dAe(this.config),CRt(this.config,!0,!1,u)}catch(G){this.logTelemetryFailure("Telemetry cleanup failed",G)}return F}catch(c){if(u2(c),c?.name==="AbortError")throw new Error(I.t("openaiContentGenerator.errors.userCancel"));if(this.config&&!(c instanceof Error&&c.message==="user cancel")&&(await CGe(this.config,c instanceof Error?c:new Error(String(c))),CRt(this.config,!1,!1,u,c instanceof Error?c.message:String(c))),c instanceof Error&&c.cause?.name?.includes("InvalidArgumentError"))throw new Error(I.t("openaiContentGenerator.errors.apiKeyError"));if(c instanceof Error&&c.message&&["iFlow Login expired","Your iFlow Login expired","Your API Token has expired","platform rate limit","platform concurrency limit","Your input has exceeded","the network is unavailable","\u60A8\u7684 iFlow \u767B\u5F55\u5DF2\u8FC7\u671F","\u767B\u5F55\u5DF2\u8FC7\u671F","API Token \u5DF2\u8FC7\u671F","API Token\u5DF2\u8FC7\u671F","\u5E73\u53F0\u901F\u7387\u9650\u5236","\u5E73\u53F0\u5E76\u53D1\u9650\u5236","\u60A8\u7684\u8F93\u5165\u8D85\u8FC7\u4E86\u6A21\u578B\u7684\u4E0A\u4E0B\u6587\u957F\u5EA6","\u60A8\u7684\u8F93\u5165\u5DF2\u8D85\u51FA","\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"].some(f=>c.message.includes(f)))throw new Error(c.message);let m="";throw c instanceof Error?m=c.cause?`${c.message}:${c.cause.message}`:c.message:m=String(c),new Error(I.t("openaiContentGenerator.errors.generateDataError",{error:m}),{cause:c})}finally{a.end("OpenAI-GenerateContent-Total")}}async countTokens(e,r=!1){let n=e.useCache??!0;if(!r&&this.lastUsageMetadata?.total_tokens)return{totalTokens:this.lastUsageMetadata.total_tokens};let o=this.extractTextFromRequest(e);return{totalTokens:Math.ceil(o.length/4)}}async calculateInputTokens(e){try{let r={model:this.modelName,contents:e.contents,config:{systemInstruction:e.config?.systemInstruction}};return(await this.countTokens(r)).totalTokens||0}catch{let n=this.extractTextFromRequest({model:this.modelName,contents:e.contents});return Math.ceil(n.length/4)}}async embedContent(e){try{let r=this.extractTextFromEmbedRequest(e),n=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl,o=await fetch(`${n}/v1/embeddings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:this.modelName,input:r})});if(!o.ok){let a=await o.text();throw new Error(`HTTP error! status: ${o.status}, body: ${a}`)}return{embeddings:[{values:(await o.json()).data[0].embedding}]}}catch(r){throw u2(r),new Error(I.t("openaiContentGenerator.errors.embedContentFailed",{error:r instanceof Error?r.message:String(r)}))}}async convertToOpenAIMessages(e){let r=[],n=new Set,o=new Map;if(e.contents){let a=Array.isArray(e.contents)?e.contents:[e.contents];for(let u of a)if(typeof u=="object"&&u!==null&&"parts"in u&&u.parts){let c=Array.isArray(u.parts)?u.parts:[u.parts];for(let m of c){if(m.functionCall){let d=m.functionCall.id||`call_${Date.now()}_${Math.random().toString(36).substring(2,11)}`;n.add(d)}if(m.functionResponse){let d=m.functionResponse.id||m.functionResponse.name||"";d.startsWith(a8)&&n.add(d);let f=m.functionResponse.response?.output??(m.functionResponse.response?JSON.stringify(m.functionResponse.response):"");o.set(d,{role:"tool",tool_call_id:d,content:f})}}}for(let[u]of o)n.has(u)||o.delete(u)}if(e.config?.systemInstruction){let a=this.extractSystemInstruction(e.config.systemInstruction);a&&r.push({role:"system",content:a})}if(e.contents){let a=Array.isArray(e.contents)?e.contents:[e.contents];for(let u of a){if(typeof u=="string"){r.push({role:"user",content:u});continue}if(typeof u=="object"&&u!==null&&"text"in u&&u.text){r.push({role:"user",content:u.text});continue}if(typeof u=="object"&&u!==null&&"parts"in u&&u.parts){let c=Array.isArray(u.parts)?u.parts:[u.parts];if(u.role==="model"){let m={role:"assistant",content:"",tool_calls:[]},d=[],f="";for(let h of c)h.thought&&"text"in h&&h.text&&(d.push(h.text),h.thoughtSignature&&h.thoughtSignature!==""&&(f=h.thoughtSignature));d.length>0&&(m.reasoning_content=d.join(""),f&&(m.signature=f));let p=[];for(let h of c)if(!h.thought&&("text"in h&&h.text&&p.push(h.text),h.functionCall)){let g=h.functionCall.id||`call_${Date.now()}_${Math.random().toString(36).substring(2,11)}`;m.tool_calls.push({id:g,function:{name:h.functionCall.name||"",arguments:JSON.stringify(h.functionCall.args||{})},type:"function"})}if(p.length>0&&(m.content=p.join("")),(m.content||m.reasoning_content||m.tool_calls.length>0)&&(m.tool_calls.length===0&&delete m.tool_calls,r.push(m),m.tool_calls&&m.tool_calls.length>0))for(let h of m.tool_calls){let g=o.get(h.id);g?r.push(g):r.push({role:"tool",tool_call_id:h.id,content:I.t("openaiContentGenerator.messages.toolNotExecuted")})}}else{let m=[];for(let d of c)if("text"in d&&d.text)m.push({type:"text",text:d.text});else if(d.inlineData){let f=d.inlineData;if(f.mimeType&&f.mimeType.startsWith("image/")){let p=this.authType===er.IFLOW||this.authType===er.LOGIN_WITH_IFLOW||this.baseUrl&&this.baseUrl.toLowerCase().includes("apis.iflow.cn"),h=this.authType===er.AONE||this.authType===er.LOGIN_WITH_AONE;if(!p&&!h)m.push({type:"image_url",image_url:{url:"data:"+f.mimeType+";base64,"+f.data}});else if(lC.isMultimodalModel(this.modelName))m.push({type:"image_url",image_url:{url:"data:"+f.mimeType+";base64,"+f.data}});else try{if(!f.data)throw new Error(I.t("openaiContentGenerator.errors.imageDataMissing"));let b=await this.multimodalHelper.generateImageDescription(f.data,f.mimeType);m.push({type:"text",text:`[Image Description]: ${b}`})}catch(b){u2(b),m.push({type:"text",text:I.t("openaiContentGenerator.errors.imageContentCannotParse",{error:b instanceof Error?b.message:String(b)})})}}}m.length>0&&r.push({role:"user",content:m})}}}}if("global"==="aone"&&this.isClaudeModel()&&r.length>0){let a=r[r.length-1];if(a.role==="user"||a.role==="assistant"){if(typeof a.content=="string")a.content=[{type:"text",text:a.content,cache_control:{type:"ephemeral"}}];else if(Array.isArray(a.content)){let u=a.content[a.content.length-1];u&&typeof u=="object"&&(u.cache_control={type:"ephemeral"})}}else a.role==="tool"&&(a.cache_control={type:"ephemeral"})}return r}createGeminiResponse(){let e=new jee;return e.candidates=[{content:{parts:[],role:"model"}}],e}async convertFromOpenAIResponse(e){let r=e.choices[0],n=this.createGeminiResponse(),o=n.candidates?.[0],s=!1;if(!r||!r.message)return{response:n,hadJsonFixes:s};if(r.message.reasoning_content!==null&&r.message.reasoning_content!==void 0&&o?.content?.parts&&o.content.parts.push({thought:!0,text:r.message.reasoning_content,thoughtSignature:r.message.signature??""}),r.message.reasoning&&o?.content?.parts&&o.content.parts.push({thought:!0,text:r.message.reasoning}),r.message.content&&r.message.content.trim()&&o?.content?.parts&&o.content.parts.push({text:r.message.content}),r.message.tool_calls&&Array.isArray(r.message.tool_calls))for(let a of r.message.tool_calls){let u;try{u=JSON.parse(a.function.arguments)}catch(c){if(u2(c),this.baseUrl==="https://apis.iflow.cn/v1"||this.baseUrl==="https://ducky.code.alibaba-inc.com/v1/openai")try{u=await this.fixInvalidJsonWithQwen(a.function.arguments),s=!0}catch(m){u2(m),console.error("Failed to fix JSON",m),u={}}else u={}}o?.content?.parts?.push({functionCall:{id:a.id,name:a.function.name,args:u}})}return o&&r.finish_reason!=="tool_calls"&&r.finish_reason&&(o.finishReason=this.mapFinishReason(r.finish_reason)),n.usageMetadata={promptTokenCount:e.usage?.prompt_tokens||0,candidatesTokenCount:e.usage?.completion_tokens||0,totalTokenCount:e.usage?.total_tokens||0},{response:n,hadJsonFixes:s}}async fixInvalidJsonWithQwen(e){let r=`
|
|
953
953
|
\u4F60\u662F\u4E00\u4E2Ajson\u683C\u5F0F\u4F18\u5316\u4E13\u5BB6\uFF0C\u4F60\u7684\u5DE5\u4F5C\u662F\u5C06\u4E00\u4E32\u6587\u672C\uFF0C\u6839\u636Ejson schema\u7684\u5B9A\u4E49\u8F93\u51FA\u6210\u4E00\u4E2Avalid\u7684json
|
|
954
954
|
\u8FD9\u4E2A\u662F\u9519\u8BEF\u7684json\u683C\u5F0F\uFF1A
|
|
955
955
|
${e}
|
|
@@ -963,7 +963,7 @@ Otherwise navigate to:
|
|
|
963
963
|
|
|
964
964
|
${e}
|
|
965
965
|
|
|
966
|
-
`);try{(await Ah(e)).on("error",s=>{throw new Error(`BROWSER_LAUNCH_FAILED: Failed to open browser automatically: ${s.message}. Please navigate to the URL manually.`)})}catch(o){throw new Error(`BROWSER_LAUNCH_FAILED: An unexpected error occurred while trying to open the browser: ${o}. Please navigate to the URL manually.`)}console.log("Waiting for authentication...");let n=0;for(;n<r.maxRetries;){await Bcn(r.pollInterval);let o=await Lcn(t,r);if(o.isSuccess()){let s=o.getPrivateToken();return await LR.savePrivateToken(s),console.log("Aone authentication successful!"),!0}o.getError()&&console.log(`Waiting for authentication... (${n+1}/${r.maxRetries})`),n++}throw new Error("Authentication timeout. Please try again.")}async function jGe(t=new Xne){return await LR.hasValidToken()?(console.log("Using cached Aone authentication."),!0):await Mcn(t)}async function K_(){return await LR.loadPrivateToken()}async function QGe(){await LR.clearPrivateToken(),console.log("Aone authentication cleared.")}async function krs(){return await LR.hasValidToken()}async function Ors(t=new Xne){return await QGe(),await jGe(t)}var vAe=j(()=>{"use strict";Ukt();qw();Ocn();Ncn();Pcn();});async function $kt(t,e,r,n,o){if(e===er.LOGIN_WITH_IFLOW){await lG(e,r,o);let s=await I4();if(!s)throw new Error("No API key found. Please re-authenticate.");let a=r.getContentGeneratorConfig();return new Hq({model:r.getModel(),apiKey:s,baseUrl:a?.baseUrl||AAe,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen3-vl-plus",config:r})}if(e===er.LOGIN_WITH_AONE){if(!await jGe())throw new Error("Aone authentication failed. Please try again.");let a=await K_();if(!a)throw new Error("No Aone private token found. Please re-authenticate.");let u=r.getContentGeneratorConfig(),c=Buffer.from(a,"utf8").toString("base64");return new Hq({model:r.getModel(),apiKey:c,baseUrl:u?.baseUrl||"https://ducky.code.alibaba-inc.com/v1/openai",authType:e,debugMode:r.getDebugMode(),multimodalModelName:u?.multimodalModelName,config:r})}if(e===er.CLOUD_SHELL){let s=await lG(e,r),a=await CNr(s);return new nR(s,a.projectId,t,n,a.userTier)}throw new Error(`Unsupported authType: ${e}`)}var jkt=j(()=>{"use strict";K9();iB();SNr();qke();Okt();Y_();vAe();});function Nrs(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function nT(t){let e=Nrs(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 o=`iflow_${t}`;if(process.env[o])return process.env[o];let s=`iflow_${e}`;if(process.env[s])return process.env[s]}function CAe(){return nT("apiKey")}function SAe(){return nT("baseUrl")||nT("url")}function wAe(){return nT("modelName")||nT("model")}function Fcn(t){let e=nT(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 Ucn(t){let e=nT(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function $cn(t){let e=nT(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function GGe(){return!!(CAe()||SAe()||wAe())}function Qkt(){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","lightWeightPlan"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","outputTokensLimit","compressionTokenThreshold","shellTimeout","temperature","topP"],o=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(s=>{let a=nT(s);a!==void 0&&(t[s]=a)}),r.forEach(s=>{let a=Fcn(s);a!==void 0&&(t[s]=a)}),n.forEach(s=>{let a=Ucn(s);a!==void 0&&(t[s]=a)}),o.forEach(s=>{let a=$cn(s);a!==void 0&&(t[s]=a)}),t}function Prs(){return{apiKey:CAe(),baseUrl:SAe(),model:wAe()}}var Gkt=j(()=>{"use strict";});async function qkt(t,e,r){if(await $ee())try{await $ke()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted.")}catch(f){throw f instanceof Error&&f.message.includes("SERVER_OAUTH2_REQUIRED"),f}let o=CAe(),s=SAe(),a=wAe(),u=r?.apiKey||o,c=r?.baseUrl||s||Brs[e],m=r?.modelName||t.getModel()||a||l6,d={model:m,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===er.CLOUD_SHELL?d:e===er.LOGIN_WITH_IFLOW?(d.baseUrl=c||AAe,d.multimodalModelName="qwen3-vl-plus",u&&(d.apiKey=u),d):([...m6,er.OPENAI_COMPATIBLE].includes(e)&&u&&(d.apiKey=u,d.baseUrl=c,d.model=m),d)}async function Hkt(t,e,r,n){let s={headers:{"User-Agent":`iFlowCLI/0.5.8-beta-20260211 (${process.platform}; ${process.arch})`}};if(t.authType&&[...m6,er.IDEA_LAB].includes(t.authType)||t.authType===er.OPENAI_COMPATIBLE)return new Hq({...t,config:e});if(t.authType===er.LOGIN_WITH_IFLOW||t.authType===er.LOGIN_WITH_AONE||t.authType===er.CLOUD_SHELL)return $kt(s,t.authType,e,r,n);throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var er,m6,Brs,K9=j(()=>{"use strict";jkt();Y_();Okt();Gkt();iB();(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"})(er||(er={}));m6=[er.IFLOW,er.AONE],Brs={[er.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[er.IFLOW]:AAe,[er.AONE]:dcn}});var qGe,jcn=j(()=>{"use strict";qGe=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,o)=>n.name.localeCompare(o.name))}clear(){this.prompts.clear()}removePromptsByServer(e){for(let[r,n]of this.prompts.entries())n.serverName===e&&this.prompts.delete(r)}}});var Lr,Db=j(()=>{"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.EDIT_NO_CHANGE_LLM_JUDGEMENT="edit_no_change_llm_judgement",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",t.BASH_OUTPUT_EXECUTION_ERROR="bash_output_execution_error",t.TASK_NOT_FOUND="task_not_found"})(Lr||(Lr={}))});var lu,Qcn,oi,MR,xAe=j(()=>{(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let s={};for(let a of o)s[a]=a;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(u=>typeof o[o[u]]!="number"),a={};for(let u of s)a[u]=o[u];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&s.push(a);return s},t.find=(o,s)=>{for(let a of o)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(lu||(lu={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Qcn||(Qcn={}));oi=lu.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),MR=t=>{switch(typeof t){case"undefined":return oi.undefined;case"string":return oi.string;case"number":return Number.isNaN(t)?oi.nan:oi.number;case"boolean":return oi.boolean;case"function":return oi.function;case"bigint":return oi.bigint;case"symbol":return oi.symbol;case"object":return Array.isArray(t)?oi.array:t===null?oi.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?oi.promise:typeof Map<"u"&&t instanceof Map?oi.map:typeof Set<"u"&&t instanceof Set?oi.set:typeof Date<"u"&&t instanceof Date?oi.date:oi.object;default:return oi.unknown}}});var rn,d6,HGe=j(()=>{xAe();rn=lu.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"]),d6=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(s){return s.message},n={_errors:[]},o=s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let u=n,c=0;for(;c<a.path.length;){let m=a.path[c];c===a.path.length-1?(u[m]=u[m]||{_errors:[]},u[m]._errors.push(r(a))):u[m]=u[m]||{_errors:[]},u=u[m],c++}}};return o(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,lu.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];r[s]=r[s]||[],r[s].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};d6.create=t=>new d6(t)});var Lrs,RL,Vkt=j(()=>{HGe();xAe();Lrs=(t,e)=>{let r;switch(t.code){case rn.invalid_type:t.received===oi.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case rn.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,lu.jsonStringifyReplacer)}`;break;case rn.unrecognized_keys:r=`Unrecognized key(s) in object: ${lu.joinValues(t.keys,", ")}`;break;case rn.invalid_union:r="Invalid input";break;case rn.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${lu.joinValues(t.options)}`;break;case rn.invalid_enum_value:r=`Invalid enum value. Expected ${lu.joinValues(t.options)}, received '${t.received}'`;break;case rn.invalid_arguments:r="Invalid function arguments";break;case rn.invalid_return_type:r="Invalid function return type";break;case rn.invalid_date:r="Invalid date";break;case rn.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}"`:lu.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case rn.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 rn.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 rn.custom:r="Invalid input";break;case rn.invalid_intersection_types:r="Intersection results could not be merged";break;case rn.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case rn.not_finite:r="Number must be finite";break;default:r=e.defaultError,lu.assertNever(t)}return{message:r}},RL=Lrs});function TAe(){return Mrs}var Mrs,VGe=j(()=>{Vkt();Mrs=RL});function Un(t,e){let r=TAe(),n=WGe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===RL?void 0:RL].filter(o=>!!o)});t.common.issues.push(n)}var WGe,Ib,Lo,Zne,l2,Wkt,zkt,Vq,DAe,Ykt=j(()=>{VGe();Vkt();WGe=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,s=[...r,...o.path||[]],a={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let u="",c=n.filter(m=>!!m).slice().reverse();for(let m of c)u=m(a,{data:e,defaultError:u}).message;return{...o,path:s,message:u}};Ib=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 o of r){if(o.status==="aborted")return Lo;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let s=await o.key,a=await o.value;n.push({key:s,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:s,value:a}=o;if(s.status==="aborted"||a.status==="aborted")return Lo;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[s.value]=a.value)}return{status:e.value,value:n}}},Lo=Object.freeze({status:"aborted"}),Zne=t=>({status:"dirty",value:t}),l2=t=>({status:"valid",value:t}),Wkt=t=>t.status==="aborted",zkt=t=>t.status==="dirty",Vq=t=>t.status==="valid",DAe=t=>typeof Promise<"u"&&t instanceof Promise});var Gcn=j(()=>{});var Mi,qcn=j(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Mi||(Mi={}))});function zs(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=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:o}:{errorMap:(a,u)=>{let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??u.defaultError}:typeof u.data>"u"?{message:c??n??u.defaultError}:a.code!=="invalid_type"?{message:u.defaultError}:{message:c??r??u.defaultError}},description:o}}function Wcn(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 ens(t){return new RegExp(`^${Wcn(t)}$`)}function tns(t){let e=`${Vcn}T${Wcn(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 rns(t,e){return!!((e==="v4"||!e)&&Wrs.test(t)||(e==="v6"||!e)&&Yrs.test(t))}function nns(t,e){if(!Grs.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,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function ins(t,e){return!!((e==="v4"||!e)&&zrs.test(t)||(e==="v6"||!e)&&Krs.test(t))}function ons(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}function eie(t){if(t instanceof f6){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=mC.create(eie(n))}return new f6({...t._def,shape:()=>e})}else return t instanceof OL?new OL({...t._def,type:eie(t.element)}):t instanceof mC?mC.create(eie(t.unwrap())):t instanceof $R?$R.create(eie(t.unwrap())):t instanceof UR?UR.create(t.items.map(e=>eie(e))):t}function Xkt(t,e){let r=MR(t),n=MR(e);if(t===e)return{valid:!0,data:t};if(r===oi.object&&n===oi.object){let o=lu.objectKeys(e),s=lu.objectKeys(t).filter(u=>o.indexOf(u)!==-1),a={...t,...e};for(let u of s){let c=Xkt(t[u],e[u]);if(!c.valid)return{valid:!1};a[u]=c.data}return{valid:!0,data:a}}else if(r===oi.array&&n===oi.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let a=t[s],u=e[s],c=Xkt(a,u);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===oi.date&&n===oi.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function zcn(t,e){return new uie({values:t,typeName:ko.ZodEnum,...zs(e)})}var J_,Hcn,La,Frs,Urs,$rs,jrs,Qrs,Grs,qrs,Hrs,Vrs,Kkt,Wrs,zrs,Yrs,Krs,Jrs,Xrs,Vcn,Zrs,tie,IAe,RAe,kAe,OAe,NAe,rie,nie,PAe,kL,iT,BAe,OL,f6,iie,FR,Jkt,oie,UR,Zkt,LAe,MAe,eOt,sie,aie,uie,cie,Wq,dC,mC,$R,lie,mie,FAe,SGu,zGe,YGe,die,wGu,ko,xGu,TGu,DGu,IGu,RGu,kGu,OGu,NGu,PGu,BGu,LGu,MGu,FGu,UGu,sns,$Gu,jGu,QGu,GGu,qGu,HGu,VGu,WGu,zGu,YGu,KGu,JGu,XGu,ZGu,equ,tqu,rqu,nqu,iqu,Ycn=j(()=>{HGe();VGe();qcn();Ykt();xAe();J_=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}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}},Hcn=(t,e)=>{if(Vq(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 d6(t.common.issues);return this._error=r,this._error}}};La=class{get description(){return this._def.description}_getType(e){return MR(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:MR(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ib,ctx:{common:e.parent.common,data:e.data,parsedType:MR(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(DAe(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:MR(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Hcn(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:MR(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Vq(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=>Vq(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:MR(e)},o=this._parse({data:e,path:n.path,parent:n}),s=await(DAe(o)?o:Promise.resolve(o));return Hcn(n,s)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,s)=>{let a=e(o),u=()=>s.addIssue({code:rn.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(u(),!1)):a?!0:(u(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new dC({schema:this,typeName:ko.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 mC.create(this,this._def)}nullable(){return $R.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return OL.create(this)}promise(){return Wq.create(this,this._def)}or(e){return iie.create([this,e],this._def)}and(e){return oie.create(this,e,this._def)}transform(e){return new dC({...zs(this._def),schema:this,typeName:ko.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new lie({...zs(this._def),innerType:this,defaultValue:r,typeName:ko.ZodDefault})}brand(){return new zGe({typeName:ko.ZodBranded,type:this,...zs(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new mie({...zs(this._def),innerType:this,catchValue:r,typeName:ko.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return YGe.create(this,e)}readonly(){return die.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Frs=/^c[^\s-]{8,}$/i,Urs=/^[0-9a-z]+$/,$rs=/^[0-9A-HJKMNP-TV-Z]{26}$/i,jrs=/^[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,Qrs=/^[a-z0-9_-]{21}$/i,Grs=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qrs=/^[-+]?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)?)??$/,Hrs=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Vrs="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Wrs=/^(?:(?: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])$/,zrs=/^(?:(?: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])$/,Yrs=/^(([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]))$/,Krs=/^(([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])$/,Jrs=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xrs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Vcn="((\\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])))",Zrs=new RegExp(`^${Vcn}$`);tie=class t extends La{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==oi.string){let s=this._getOrReturnCtx(e);return Un(s,{code:rn.invalid_type,expected:oi.string,received:s.parsedType}),Lo}let n=new Ib,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let a=e.data.length>s.value,u=e.data.length<s.value;(a||u)&&(o=this._getOrReturnCtx(e,o),a?Un(o,{code:rn.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):u&&Un(o,{code:rn.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")Hrs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"email",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Kkt||(Kkt=new RegExp(Vrs,"u")),Kkt.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"emoji",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")jrs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"uuid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Qrs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"nanoid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Frs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"cuid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Urs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"cuid2",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")$rs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"ulid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),Un(o,{validation:"url",code:rn.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"regex",code:rn.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?tns(s).test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Zrs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?ens(s).test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?qrs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"duration",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?rns(e.data,s.version)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"ip",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?nns(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"jwt",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?ins(e.data,s.version)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"cidr",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Jrs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"base64",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?Xrs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"base64url",code:rn.invalid_string,message:s.message}),n.dirty()):lu.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:rn.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}};tie.create=t=>new tie({checks:[],typeName:ko.ZodString,coerce:t?.coerce??!1,...zs(t)});IAe=class t extends La{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)!==oi.number){let s=this._getOrReturnCtx(e);return Un(s,{code:rn.invalid_type,expected:oi.number,received:s.parsedType}),Lo}let n,o=new Ib;for(let s of this._def.checks)s.kind==="int"?lu.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?ons(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.not_finite,message:s.message}),o.dirty()):lu.assertNever(s);return{status:o.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,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Mi.toString(o)}]})}_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"&&lu.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)}};IAe.create=t=>new IAe({checks:[],typeName:ko.ZodNumber,coerce:t?.coerce||!1,...zs(t)});RAe=class t extends La{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)!==oi.bigint)return this._getInvalidInput(e);let n,o=new Ib;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):lu.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Un(r,{code:rn.invalid_type,expected:oi.bigint,received:r.parsedType}),Lo}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,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Mi.toString(o)}]})}_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}};RAe.create=t=>new RAe({checks:[],typeName:ko.ZodBigInt,coerce:t?.coerce??!1,...zs(t)});kAe=class extends La{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==oi.boolean){let n=this._getOrReturnCtx(e);return Un(n,{code:rn.invalid_type,expected:oi.boolean,received:n.parsedType}),Lo}return l2(e.data)}};kAe.create=t=>new kAe({typeName:ko.ZodBoolean,coerce:t?.coerce||!1,...zs(t)});OAe=class t extends La{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==oi.date){let s=this._getOrReturnCtx(e);return Un(s,{code:rn.invalid_type,expected:oi.date,received:s.parsedType}),Lo}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return Un(s,{code:rn.invalid_date}),Lo}let n=new Ib,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):lu.assertNever(s);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}};OAe.create=t=>new OAe({checks:[],coerce:t?.coerce||!1,typeName:ko.ZodDate,...zs(t)});NAe=class extends La{_parse(e){if(this._getType(e)!==oi.symbol){let n=this._getOrReturnCtx(e);return Un(n,{code:rn.invalid_type,expected:oi.symbol,received:n.parsedType}),Lo}return l2(e.data)}};NAe.create=t=>new NAe({typeName:ko.ZodSymbol,...zs(t)});rie=class extends La{_parse(e){if(this._getType(e)!==oi.undefined){let n=this._getOrReturnCtx(e);return Un(n,{code:rn.invalid_type,expected:oi.undefined,received:n.parsedType}),Lo}return l2(e.data)}};rie.create=t=>new rie({typeName:ko.ZodUndefined,...zs(t)});nie=class extends La{_parse(e){if(this._getType(e)!==oi.null){let n=this._getOrReturnCtx(e);return Un(n,{code:rn.invalid_type,expected:oi.null,received:n.parsedType}),Lo}return l2(e.data)}};nie.create=t=>new nie({typeName:ko.ZodNull,...zs(t)});PAe=class extends La{constructor(){super(...arguments),this._any=!0}_parse(e){return l2(e.data)}};PAe.create=t=>new PAe({typeName:ko.ZodAny,...zs(t)});kL=class extends La{constructor(){super(...arguments),this._unknown=!0}_parse(e){return l2(e.data)}};kL.create=t=>new kL({typeName:ko.ZodUnknown,...zs(t)});iT=class extends La{_parse(e){let r=this._getOrReturnCtx(e);return Un(r,{code:rn.invalid_type,expected:oi.never,received:r.parsedType}),Lo}};iT.create=t=>new iT({typeName:ko.ZodNever,...zs(t)});BAe=class extends La{_parse(e){if(this._getType(e)!==oi.undefined){let n=this._getOrReturnCtx(e);return Un(n,{code:rn.invalid_type,expected:oi.void,received:n.parsedType}),Lo}return l2(e.data)}};BAe.create=t=>new BAe({typeName:ko.ZodVoid,...zs(t)});OL=class t extends La{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==oi.array)return Un(r,{code:rn.invalid_type,expected:oi.array,received:r.parsedType}),Lo;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,u=r.data.length<o.exactLength.value;(a||u)&&(Un(r,{code:a?rn.too_big:rn.too_small,minimum:u?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(Un(r,{code:rn.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(Un(r,{code:rn.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,u)=>o.type._parseAsync(new J_(r,a,r.path,u)))).then(a=>Ib.mergeArray(n,a));let s=[...r.data].map((a,u)=>o.type._parseSync(new J_(r,a,r.path,u)));return Ib.mergeArray(n,s)}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)}};OL.create=(t,e)=>new OL({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ko.ZodArray,...zs(e)});f6=class t extends La{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=lu.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==oi.object){let m=this._getOrReturnCtx(e);return Un(m,{code:rn.invalid_type,expected:oi.object,received:m.parsedType}),Lo}let{status:n,ctx:o}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),u=[];if(!(this._def.catchall instanceof iT&&this._def.unknownKeys==="strip"))for(let m in o.data)a.includes(m)||u.push(m);let c=[];for(let m of a){let d=s[m],f=o.data[m];c.push({key:{status:"valid",value:m},value:d._parse(new J_(o,f,o.path,m)),alwaysSet:m in o.data})}if(this._def.catchall instanceof iT){let m=this._def.unknownKeys;if(m==="passthrough")for(let d of u)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(m==="strict")u.length>0&&(Un(o,{code:rn.unrecognized_keys,keys:u}),n.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let m=this._def.catchall;for(let d of u){let f=o.data[d];c.push({key:{status:"valid",value:d},value:m._parse(new J_(o,f,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let m=[];for(let d of c){let f=await d.key,p=await d.value;m.push({key:f,value:p,alwaysSet:d.alwaysSet})}return m}).then(m=>Ib.mergeObjectSync(n,m)):Ib.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 o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Mi.errToObj(e).message??o}:{message:o}}}:{}})}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:ko.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 lu.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 lu.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return eie(this)}partial(e){let r={};for(let n of lu.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of lu.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof mC;)s=s._def.innerType;r[n]=s}return new t({...this._def,shape:()=>r})}keyof(){return zcn(lu.objectKeys(this.shape))}};f6.create=(t,e)=>new f6({shape:()=>t,unknownKeys:"strip",catchall:iT.create(),typeName:ko.ZodObject,...zs(e)});f6.strictCreate=(t,e)=>new f6({shape:()=>t,unknownKeys:"strict",catchall:iT.create(),typeName:ko.ZodObject,...zs(e)});f6.lazycreate=(t,e)=>new f6({shape:t,unknownKeys:"strip",catchall:iT.create(),typeName:ko.ZodObject,...zs(e)});iie=class extends La{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(s){for(let u of s)if(u.result.status==="valid")return u.result;for(let u of s)if(u.result.status==="dirty")return r.common.issues.push(...u.ctx.common.issues),u.result;let a=s.map(u=>new d6(u.ctx.common.issues));return Un(r,{code:rn.invalid_union,unionErrors:a}),Lo}if(r.common.async)return Promise.all(n.map(async s=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let s,a=[];for(let c of n){let m={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:m});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:m}),m.common.issues.length&&a.push(m.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let u=a.map(c=>new d6(c));return Un(r,{code:rn.invalid_union,unionErrors:u}),Lo}}get options(){return this._def.options}};iie.create=(t,e)=>new iie({options:t,typeName:ko.ZodUnion,...zs(e)});FR=t=>t instanceof sie?FR(t.schema):t instanceof dC?FR(t.innerType()):t instanceof aie?[t.value]:t instanceof uie?t.options:t instanceof cie?lu.objectValues(t.enum):t instanceof lie?FR(t._def.innerType):t instanceof rie?[void 0]:t instanceof nie?[null]:t instanceof mC?[void 0,...FR(t.unwrap())]:t instanceof $R?[null,...FR(t.unwrap())]:t instanceof zGe||t instanceof die?FR(t.unwrap()):t instanceof mie?FR(t._def.innerType):[],Jkt=class t extends La{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==oi.object)return Un(r,{code:rn.invalid_type,expected:oi.object,received:r.parsedType}),Lo;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(Un(r,{code:rn.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Lo)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let s of r){let a=FR(s.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let u of a){if(o.has(u))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(u)}`);o.set(u,s)}}return new t({typeName:ko.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...zs(n)})}};oie=class extends La{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(s,a)=>{if(Wkt(s)||Wkt(a))return Lo;let u=Xkt(s.value,a.value);return u.valid?((zkt(s)||zkt(a))&&r.dirty(),{status:r.value,value:u.data}):(Un(n,{code:rn.invalid_intersection_types}),Lo)};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(([s,a])=>o(s,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};oie.create=(t,e,r)=>new oie({left:t,right:e,typeName:ko.ZodIntersection,...zs(r)});UR=class t extends La{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==oi.array)return Un(n,{code:rn.invalid_type,expected:oi.array,received:n.parsedType}),Lo;if(n.data.length<this._def.items.length)return Un(n,{code:rn.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Lo;!this._def.rest&&n.data.length>this._def.items.length&&(Un(n,{code:rn.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((a,u)=>{let c=this._def.items[u]||this._def.rest;return c?c._parse(new J_(n,a,n.path,u)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>Ib.mergeArray(r,a)):Ib.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};UR.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new UR({items:t,typeName:ko.ZodTuple,rest:null,...zs(e)})};Zkt=class t extends La{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!==oi.object)return Un(n,{code:rn.invalid_type,expected:oi.object,received:n.parsedType}),Lo;let o=[],s=this._def.keyType,a=this._def.valueType;for(let u in n.data)o.push({key:s._parse(new J_(n,u,n.path,u)),value:a._parse(new J_(n,n.data[u],n.path,u)),alwaysSet:u in n.data});return n.common.async?Ib.mergeObjectAsync(r,o):Ib.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof La?new t({keyType:e,valueType:r,typeName:ko.ZodRecord,...zs(n)}):new t({keyType:tie.create(),valueType:e,typeName:ko.ZodRecord,...zs(r)})}},LAe=class extends La{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!==oi.map)return Un(n,{code:rn.invalid_type,expected:oi.map,received:n.parsedType}),Lo;let o=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([u,c],m)=>({key:o._parse(new J_(n,u,n.path,[m,"key"])),value:s._parse(new J_(n,c,n.path,[m,"value"]))}));if(n.common.async){let u=new Map;return Promise.resolve().then(async()=>{for(let c of a){let m=await c.key,d=await c.value;if(m.status==="aborted"||d.status==="aborted")return Lo;(m.status==="dirty"||d.status==="dirty")&&r.dirty(),u.set(m.value,d.value)}return{status:r.value,value:u}})}else{let u=new Map;for(let c of a){let m=c.key,d=c.value;if(m.status==="aborted"||d.status==="aborted")return Lo;(m.status==="dirty"||d.status==="dirty")&&r.dirty(),u.set(m.value,d.value)}return{status:r.value,value:u}}}};LAe.create=(t,e,r)=>new LAe({valueType:e,keyType:t,typeName:ko.ZodMap,...zs(r)});MAe=class t extends La{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==oi.set)return Un(n,{code:rn.invalid_type,expected:oi.set,received:n.parsedType}),Lo;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(Un(n,{code:rn.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(Un(n,{code:rn.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function a(c){let m=new Set;for(let d of c){if(d.status==="aborted")return Lo;d.status==="dirty"&&r.dirty(),m.add(d.value)}return{status:r.value,value:m}}let u=[...n.data.values()].map((c,m)=>s._parse(new J_(n,c,n.path,m)));return n.common.async?Promise.all(u).then(c=>a(c)):a(u)}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)}};MAe.create=(t,e)=>new MAe({valueType:t,minSize:null,maxSize:null,typeName:ko.ZodSet,...zs(e)});eOt=class t extends La{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==oi.function)return Un(r,{code:rn.invalid_type,expected:oi.function,received:r.parsedType}),Lo;function n(u,c){return WGe({data:u,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,TAe(),RL].filter(m=>!!m),issueData:{code:rn.invalid_arguments,argumentsError:c}})}function o(u,c){return WGe({data:u,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,TAe(),RL].filter(m=>!!m),issueData:{code:rn.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Wq){let u=this;return l2(async function(...c){let m=new d6([]),d=await u._def.args.parseAsync(c,s).catch(h=>{throw m.addIssue(n(c,h)),m}),f=await Reflect.apply(a,this,d);return await u._def.returns._def.type.parseAsync(f,s).catch(h=>{throw m.addIssue(o(f,h)),m})})}else{let u=this;return l2(function(...c){let m=u._def.args.safeParse(c,s);if(!m.success)throw new d6([n(c,m.error)]);let d=Reflect.apply(a,this,m.data),f=u._def.returns.safeParse(d,s);if(!f.success)throw new d6([o(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:UR.create(e).rest(kL.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||UR.create([]).rest(kL.create()),returns:r||kL.create(),typeName:ko.ZodFunction,...zs(n)})}},sie=class extends La{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})}};sie.create=(t,e)=>new sie({getter:t,typeName:ko.ZodLazy,...zs(e)});aie=class extends La{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Un(r,{received:r.data,code:rn.invalid_literal,expected:this._def.value}),Lo}return{status:"valid",value:e.data}}get value(){return this._def.value}};aie.create=(t,e)=>new aie({value:t,typeName:ko.ZodLiteral,...zs(e)});uie=class t extends La{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return Un(r,{expected:lu.joinValues(n),received:r.parsedType,code:rn.invalid_type}),Lo}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 Un(r,{received:r.data,code:rn.invalid_enum_value,options:n}),Lo}return l2(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})}};uie.create=zcn;cie=class extends La{_parse(e){let r=lu.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==oi.string&&n.parsedType!==oi.number){let o=lu.objectValues(r);return Un(n,{expected:lu.joinValues(o),received:n.parsedType,code:rn.invalid_type}),Lo}if(this._cache||(this._cache=new Set(lu.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=lu.objectValues(r);return Un(n,{received:n.data,code:rn.invalid_enum_value,options:o}),Lo}return l2(e.data)}get enum(){return this._def.values}};cie.create=(t,e)=>new cie({values:t,typeName:ko.ZodNativeEnum,...zs(e)});Wq=class extends La{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==oi.promise&&r.common.async===!1)return Un(r,{code:rn.invalid_type,expected:oi.promise,received:r.parsedType}),Lo;let n=r.parsedType===oi.promise?r.data:Promise.resolve(r.data);return l2(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Wq.create=(t,e)=>new Wq({type:t,typeName:ko.ZodPromise,...zs(e)});dC=class extends La{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ko.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:a=>{Un(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let a=o.transform(n.data,s);if(n.common.async)return Promise.resolve(a).then(async u=>{if(r.value==="aborted")return Lo;let c=await this._def.schema._parseAsync({data:u,path:n.path,parent:n});return c.status==="aborted"?Lo:c.status==="dirty"?Zne(c.value):r.value==="dirty"?Zne(c.value):c});{if(r.value==="aborted")return Lo;let u=this._def.schema._parseSync({data:a,path:n.path,parent:n});return u.status==="aborted"?Lo:u.status==="dirty"?Zne(u.value):r.value==="dirty"?Zne(u.value):u}}if(o.type==="refinement"){let a=u=>{let c=o.refinement(u,s);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 u};if(n.common.async===!1){let u=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return u.status==="aborted"?Lo:(u.status==="dirty"&&r.dirty(),a(u.value),{status:r.value,value:u.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(u=>u.status==="aborted"?Lo:(u.status==="dirty"&&r.dirty(),a(u.value).then(()=>({status:r.value,value:u.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Vq(a))return Lo;let u=o.transform(a.value,s);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:u}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Vq(a)?Promise.resolve(o.transform(a.value,s)).then(u=>({status:r.value,value:u})):Lo);lu.assertNever(o)}};dC.create=(t,e,r)=>new dC({schema:t,typeName:ko.ZodEffects,effect:e,...zs(r)});dC.createWithPreprocess=(t,e,r)=>new dC({schema:e,effect:{type:"preprocess",transform:t},typeName:ko.ZodEffects,...zs(r)});mC=class extends La{_parse(e){return this._getType(e)===oi.undefined?l2(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};mC.create=(t,e)=>new mC({innerType:t,typeName:ko.ZodOptional,...zs(e)});$R=class extends La{_parse(e){return this._getType(e)===oi.null?l2(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$R.create=(t,e)=>new $R({innerType:t,typeName:ko.ZodNullable,...zs(e)});lie=class extends La{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===oi.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};lie.create=(t,e)=>new lie({innerType:t,typeName:ko.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...zs(e)});mie=class extends La{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return DAe(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new d6(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new d6(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};mie.create=(t,e)=>new mie({innerType:t,typeName:ko.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...zs(e)});FAe=class extends La{_parse(e){if(this._getType(e)!==oi.nan){let n=this._getOrReturnCtx(e);return Un(n,{code:rn.invalid_type,expected:oi.nan,received:n.parsedType}),Lo}return{status:"valid",value:e.data}}};FAe.create=t=>new FAe({typeName:ko.ZodNaN,...zs(t)});SGu=Symbol("zod_brand"),zGe=class extends La{_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}},YGe=class t extends La{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Lo:s.status==="dirty"?(r.dirty(),Zne(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Lo:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:ko.ZodPipeline})}},die=class extends La{_parse(e){let r=this._def.innerType._parse(e),n=o=>(Vq(o)&&(o.value=Object.freeze(o.value)),o);return DAe(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};die.create=(t,e)=>new die({innerType:t,typeName:ko.ZodReadonly,...zs(e)});wGu={object:f6.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"})(ko||(ko={}));xGu=tie.create,TGu=IAe.create,DGu=FAe.create,IGu=RAe.create,RGu=kAe.create,kGu=OAe.create,OGu=NAe.create,NGu=rie.create,PGu=nie.create,BGu=PAe.create,LGu=kL.create,MGu=iT.create,FGu=BAe.create,UGu=OL.create,sns=f6.create,$Gu=f6.strictCreate,jGu=iie.create,QGu=Jkt.create,GGu=oie.create,qGu=UR.create,HGu=Zkt.create,VGu=LAe.create,WGu=MAe.create,zGu=eOt.create,YGu=sie.create,KGu=aie.create,JGu=uie.create,XGu=cie.create,ZGu=Wq.create,equ=dC.create,tqu=mC.create,rqu=$R.create,nqu=dC.createWithPreprocess,iqu=YGe.create});var tOt=j(()=>{VGe();Ykt();Gcn();xAe();Ycn();HGe()});var UAe=j(()=>{tOt();tOt()});function Lt(t,e,r){function n(u,c){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(t))return;u._zod.traits.add(t),e(u,c);let m=a.prototype,d=Object.keys(m);for(let f=0;f<d.length;f++){let p=d[f];p in u||(u[p]=m[p].bind(u))}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function a(u){var c;let m=r?.Parent?new s:this;n(m,u),(c=m._zod).deferred??(c.deferred=[]);for(let d of m._zod.deferred)d();return m}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>r?.Parent&&u instanceof r.Parent?!0:u?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}function Td(t){return t&&Object.assign($Ae,t),$Ae}var fie,jAe,fC,NL,$Ae,pie=j(()=>{fie=Object.freeze({status:"aborted"});jAe=Symbol("zod_brand"),fC=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},NL=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},$Ae={}});var nn={};fo(nn,{BIGINT_FORMAT_RANGES:()=>lOt,Class:()=>nOt,NUMBER_FORMAT_RANGES:()=>cOt,aborted:()=>ML,allowsEval:()=>sOt,assert:()=>fns,assertEqual:()=>cns,assertIs:()=>mns,assertNever:()=>dns,assertNotEqual:()=>lns,assignProp:()=>BL,base64ToUint8Array:()=>nln,base64urlToUint8Array:()=>Sns,cached:()=>gie,captureStackTrace:()=>JGe,cleanEnum:()=>Cns,cleanRegex:()=>qAe,clone:()=>J3,cloneDef:()=>hns,createTransparentProxy:()=>Ens,defineLazy:()=>oa,esc:()=>KGe,escapeRegex:()=>X_,extend:()=>Zcn,finalizeIssue:()=>u8,floatSafeRemainder:()=>iOt,getElementAtPath:()=>gns,getEnumValues:()=>GAe,getLengthableOrigin:()=>WAe,getParsedType:()=>_ns,getSizableOrigin:()=>VAe,hexToUint8Array:()=>xns,isObject:()=>zq,isPlainObject:()=>LL,issue:()=>bie,joinValues:()=>sr,jsonStringifyReplacer:()=>hie,merge:()=>vns,mergeDefs:()=>jR,normalizeParams:()=>an,nullish:()=>PL,numKeys:()=>yns,objectClone:()=>pns,omit:()=>Xcn,optionalKeys:()=>uOt,parsedType:()=>on,partial:()=>tln,pick:()=>Jcn,prefixIssues:()=>p6,primitiveTypes:()=>aOt,promiseAllObject:()=>bns,propertyKeyTypes:()=>HAe,randomString:()=>Ans,required:()=>rln,safeExtend:()=>eln,shallowClone:()=>XGe,slugify:()=>oOt,stringifyPrimitive:()=>Zr,uint8ArrayToBase64:()=>iln,uint8ArrayToBase64url:()=>wns,uint8ArrayToHex:()=>Tns,unwrapMessage:()=>QAe});function cns(t){return t}function lns(t){return t}function mns(t){}function dns(t){throw new Error("Unexpected value in exhaustive check")}function fns(t){}function GAe(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function sr(t,e="|"){return t.map(r=>Zr(r)).join(e)}function hie(t,e){return typeof e=="bigint"?e.toString():e}function gie(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function PL(t){return t==null}function qAe(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function iOt(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let s=r>o?r:o,a=Number.parseInt(t.toFixed(s).replace(".","")),u=Number.parseInt(e.toFixed(s).replace(".",""));return a%u/10**s}function oa(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==Kcn)return n===void 0&&(n=Kcn,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function pns(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function BL(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function jR(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function hns(t){return jR(t._zod.def)}function gns(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function bns(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<e.length;s++)o[e[s]]=n[s];return o})}function Ans(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function KGe(t){return JSON.stringify(t)}function oOt(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function zq(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function LL(t){if(zq(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(zq(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function XGe(t){return LL(t)?{...t}:Array.isArray(t)?[...t]:t}function yns(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function X_(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function J3(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function an(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Ens(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,s){return e??(e=t()),Reflect.set(e,n,o,s)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function Zr(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function uOt(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function Jcn(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=jR(t._zod.def,{get shape(){let a={};for(let u in e){if(!(u in r.shape))throw new Error(`Unrecognized key: "${u}"`);e[u]&&(a[u]=r.shape[u])}return BL(this,"shape",a),a},checks:[]});return J3(t,s)}function Xcn(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=jR(t._zod.def,{get shape(){let a={...t._zod.def.shape};for(let u in e){if(!(u in r.shape))throw new Error(`Unrecognized key: "${u}"`);e[u]&&delete a[u]}return BL(this,"shape",a),a},checks:[]});return J3(t,s)}function Zcn(t,e){if(!LL(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let s=t._zod.def.shape;for(let a in e)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=jR(t._zod.def,{get shape(){let s={...t._zod.def.shape,...e};return BL(this,"shape",s),s}});return J3(t,o)}function eln(t,e){if(!LL(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=jR(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return BL(this,"shape",n),n}});return J3(t,r)}function vns(t,e){let r=jR(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return BL(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return J3(t,r)}function tln(t,e,r){let o=e._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=jR(e._zod.def,{get shape(){let u=e._zod.def.shape,c={...u};if(r)for(let m in r){if(!(m in u))throw new Error(`Unrecognized key: "${m}"`);r[m]&&(c[m]=t?new t({type:"optional",innerType:u[m]}):u[m])}else for(let m in u)c[m]=t?new t({type:"optional",innerType:u[m]}):u[m];return BL(this,"shape",c),c},checks:[]});return J3(e,a)}function rln(t,e,r){let n=jR(e._zod.def,{get shape(){let o=e._zod.def.shape,s={...o};if(r)for(let a in r){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(s[a]=new t({type:"nonoptional",innerType:o[a]}))}else for(let a in o)s[a]=new t({type:"nonoptional",innerType:o[a]});return BL(this,"shape",s),s}});return J3(e,n)}function ML(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function p6(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function QAe(t){return typeof t=="string"?t:t?.message}function u8(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=QAe(t.inst?._zod.def?.error?.(t))??QAe(e?.error?.(t))??QAe(r.customError?.(t))??QAe(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function VAe(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function WAe(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function on(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function bie(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function Cns(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function nln(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function iln(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function Sns(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return nln(e+r)}function wns(t){return iln(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function xns(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function Tns(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var Kcn,JGe,sOt,_ns,HAe,aOt,cOt,lOt,nOt,Wi=j(()=>{Kcn=Symbol("evaluating");JGe="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};sOt=gie(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});_ns=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},HAe=new Set(["string","number","symbol"]),aOt=new Set(["string","number","bigint","boolean","symbol","undefined"]);cOt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},lOt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};nOt=class{constructor(...e){}}});function Aie(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function yie(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>n({issues:a}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)r._errors.push(e(s));else{let a=r,u=0;for(;u<s.path.length;){let c=s.path[u];u===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(e(s))):a[c]=a[c]||{_errors:[]},a=a[c],u++}}};return n(t),r}function ZGe(t,e=r=>r.message){let r={errors:[]},n=(o,s=[])=>{var a,u;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(m=>n({issues:m},c.path));else if(c.code==="invalid_key")n({issues:c.issues},c.path);else if(c.code==="invalid_element")n({issues:c.issues},c.path);else{let m=[...s,...c.path];if(m.length===0){r.errors.push(e(c));continue}let d=r,f=0;for(;f<m.length;){let p=m[f],h=f===m.length-1;typeof p=="string"?(d.properties??(d.properties={}),(a=d.properties)[p]??(a[p]={errors:[]}),d=d.properties[p]):(d.items??(d.items=[]),(u=d.items)[p]??(u[p]={errors:[]}),d=d.items[p]),h&&d.errors.push(e(c)),f++}}};return n(t),r}function sln(t){let e=[],r=t.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function eqe(t){let e=[],r=[...t.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${sln(n.path)}`);return e.join(`
|
|
966
|
+
`);try{(await Ah(e)).on("error",s=>{throw new Error(`BROWSER_LAUNCH_FAILED: Failed to open browser automatically: ${s.message}. Please navigate to the URL manually.`)})}catch(o){throw new Error(`BROWSER_LAUNCH_FAILED: An unexpected error occurred while trying to open the browser: ${o}. Please navigate to the URL manually.`)}console.log("Waiting for authentication...");let n=0;for(;n<r.maxRetries;){await Bcn(r.pollInterval);let o=await Lcn(t,r);if(o.isSuccess()){let s=o.getPrivateToken();return await LR.savePrivateToken(s),console.log("Aone authentication successful!"),!0}o.getError()&&console.log(`Waiting for authentication... (${n+1}/${r.maxRetries})`),n++}throw new Error("Authentication timeout. Please try again.")}async function jGe(t=new Xne){return await LR.hasValidToken()?(console.log("Using cached Aone authentication."),!0):await Mcn(t)}async function K_(){return await LR.loadPrivateToken()}async function QGe(){await LR.clearPrivateToken(),console.log("Aone authentication cleared.")}async function krs(){return await LR.hasValidToken()}async function Ors(t=new Xne){return await QGe(),await jGe(t)}var vAe=j(()=>{"use strict";Ukt();qw();Ocn();Ncn();Pcn();});async function $kt(t,e,r,n,o){if(e===er.LOGIN_WITH_IFLOW){await lG(e,r,o);let s=await I4();if(!s)throw new Error("No API key found. Please re-authenticate.");let a=r.getContentGeneratorConfig();return new Hq({model:r.getModel(),apiKey:s,baseUrl:a?.baseUrl||AAe,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen3-vl-plus",config:r})}if(e===er.LOGIN_WITH_AONE){if(!await jGe())throw new Error("Aone authentication failed. Please try again.");let a=await K_();if(!a)throw new Error("No Aone private token found. Please re-authenticate.");let u=r.getContentGeneratorConfig(),c=Buffer.from(a,"utf8").toString("base64");return new Hq({model:r.getModel(),apiKey:c,baseUrl:u?.baseUrl||"https://ducky.code.alibaba-inc.com/v1/openai",authType:e,debugMode:r.getDebugMode(),multimodalModelName:u?.multimodalModelName,config:r})}if(e===er.CLOUD_SHELL){let s=await lG(e,r),a=await CNr(s);return new nR(s,a.projectId,t,n,a.userTier)}throw new Error(`Unsupported authType: ${e}`)}var jkt=j(()=>{"use strict";K9();iB();SNr();qke();Okt();Y_();vAe();});function Nrs(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function nT(t){let e=Nrs(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 o=`iflow_${t}`;if(process.env[o])return process.env[o];let s=`iflow_${e}`;if(process.env[s])return process.env[s]}function CAe(){return nT("apiKey")}function SAe(){return nT("baseUrl")||nT("url")}function wAe(){return nT("modelName")||nT("model")}function Fcn(t){let e=nT(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 Ucn(t){let e=nT(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function $cn(t){let e=nT(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function GGe(){return!!(CAe()||SAe()||wAe())}function Qkt(){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","lightWeightPlan"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","outputTokensLimit","compressionTokenThreshold","shellTimeout","temperature","topP"],o=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(s=>{let a=nT(s);a!==void 0&&(t[s]=a)}),r.forEach(s=>{let a=Fcn(s);a!==void 0&&(t[s]=a)}),n.forEach(s=>{let a=Ucn(s);a!==void 0&&(t[s]=a)}),o.forEach(s=>{let a=$cn(s);a!==void 0&&(t[s]=a)}),t}function Prs(){return{apiKey:CAe(),baseUrl:SAe(),model:wAe()}}var Gkt=j(()=>{"use strict";});async function qkt(t,e,r){if(await $ee())try{await $ke()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted.")}catch(f){throw f instanceof Error&&f.message.includes("SERVER_OAUTH2_REQUIRED"),f}let o=CAe(),s=SAe(),a=wAe(),u=r?.apiKey||o,c=r?.baseUrl||s||Brs[e],m=r?.modelName||t.getModel()||a||l6,d={model:m,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===er.CLOUD_SHELL?d:e===er.LOGIN_WITH_IFLOW?(d.baseUrl=c||AAe,d.multimodalModelName="qwen3-vl-plus",u&&(d.apiKey=u),d):([...m6,er.OPENAI_COMPATIBLE].includes(e)&&u&&(d.apiKey=u,d.baseUrl=c,d.model=m),d)}async function Hkt(t,e,r,n){let s={headers:{"User-Agent":`iFlowCLI/0.5.10 (${process.platform}; ${process.arch})`}};if(t.authType&&[...m6,er.IDEA_LAB].includes(t.authType)||t.authType===er.OPENAI_COMPATIBLE)return new Hq({...t,config:e});if(t.authType===er.LOGIN_WITH_IFLOW||t.authType===er.LOGIN_WITH_AONE||t.authType===er.CLOUD_SHELL)return $kt(s,t.authType,e,r,n);throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var er,m6,Brs,K9=j(()=>{"use strict";jkt();Y_();Okt();Gkt();iB();(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"})(er||(er={}));m6=[er.IFLOW,er.AONE],Brs={[er.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[er.IFLOW]:AAe,[er.AONE]:dcn}});var qGe,jcn=j(()=>{"use strict";qGe=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,o)=>n.name.localeCompare(o.name))}clear(){this.prompts.clear()}removePromptsByServer(e){for(let[r,n]of this.prompts.entries())n.serverName===e&&this.prompts.delete(r)}}});var Lr,Db=j(()=>{"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.EDIT_NO_CHANGE_LLM_JUDGEMENT="edit_no_change_llm_judgement",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",t.BASH_OUTPUT_EXECUTION_ERROR="bash_output_execution_error",t.TASK_NOT_FOUND="task_not_found"})(Lr||(Lr={}))});var lu,Qcn,oi,MR,xAe=j(()=>{(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let s={};for(let a of o)s[a]=a;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(u=>typeof o[o[u]]!="number"),a={};for(let u of s)a[u]=o[u];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&s.push(a);return s},t.find=(o,s)=>{for(let a of o)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(lu||(lu={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Qcn||(Qcn={}));oi=lu.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),MR=t=>{switch(typeof t){case"undefined":return oi.undefined;case"string":return oi.string;case"number":return Number.isNaN(t)?oi.nan:oi.number;case"boolean":return oi.boolean;case"function":return oi.function;case"bigint":return oi.bigint;case"symbol":return oi.symbol;case"object":return Array.isArray(t)?oi.array:t===null?oi.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?oi.promise:typeof Map<"u"&&t instanceof Map?oi.map:typeof Set<"u"&&t instanceof Set?oi.set:typeof Date<"u"&&t instanceof Date?oi.date:oi.object;default:return oi.unknown}}});var rn,d6,HGe=j(()=>{xAe();rn=lu.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"]),d6=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(s){return s.message},n={_errors:[]},o=s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let u=n,c=0;for(;c<a.path.length;){let m=a.path[c];c===a.path.length-1?(u[m]=u[m]||{_errors:[]},u[m]._errors.push(r(a))):u[m]=u[m]||{_errors:[]},u=u[m],c++}}};return o(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,lu.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];r[s]=r[s]||[],r[s].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};d6.create=t=>new d6(t)});var Lrs,RL,Vkt=j(()=>{HGe();xAe();Lrs=(t,e)=>{let r;switch(t.code){case rn.invalid_type:t.received===oi.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case rn.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,lu.jsonStringifyReplacer)}`;break;case rn.unrecognized_keys:r=`Unrecognized key(s) in object: ${lu.joinValues(t.keys,", ")}`;break;case rn.invalid_union:r="Invalid input";break;case rn.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${lu.joinValues(t.options)}`;break;case rn.invalid_enum_value:r=`Invalid enum value. Expected ${lu.joinValues(t.options)}, received '${t.received}'`;break;case rn.invalid_arguments:r="Invalid function arguments";break;case rn.invalid_return_type:r="Invalid function return type";break;case rn.invalid_date:r="Invalid date";break;case rn.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}"`:lu.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case rn.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 rn.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 rn.custom:r="Invalid input";break;case rn.invalid_intersection_types:r="Intersection results could not be merged";break;case rn.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case rn.not_finite:r="Number must be finite";break;default:r=e.defaultError,lu.assertNever(t)}return{message:r}},RL=Lrs});function TAe(){return Mrs}var Mrs,VGe=j(()=>{Vkt();Mrs=RL});function Un(t,e){let r=TAe(),n=WGe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===RL?void 0:RL].filter(o=>!!o)});t.common.issues.push(n)}var WGe,Ib,Lo,Zne,l2,Wkt,zkt,Vq,DAe,Ykt=j(()=>{VGe();Vkt();WGe=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,s=[...r,...o.path||[]],a={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let u="",c=n.filter(m=>!!m).slice().reverse();for(let m of c)u=m(a,{data:e,defaultError:u}).message;return{...o,path:s,message:u}};Ib=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 o of r){if(o.status==="aborted")return Lo;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let s=await o.key,a=await o.value;n.push({key:s,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:s,value:a}=o;if(s.status==="aborted"||a.status==="aborted")return Lo;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[s.value]=a.value)}return{status:e.value,value:n}}},Lo=Object.freeze({status:"aborted"}),Zne=t=>({status:"dirty",value:t}),l2=t=>({status:"valid",value:t}),Wkt=t=>t.status==="aborted",zkt=t=>t.status==="dirty",Vq=t=>t.status==="valid",DAe=t=>typeof Promise<"u"&&t instanceof Promise});var Gcn=j(()=>{});var Mi,qcn=j(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Mi||(Mi={}))});function zs(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=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:o}:{errorMap:(a,u)=>{let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??u.defaultError}:typeof u.data>"u"?{message:c??n??u.defaultError}:a.code!=="invalid_type"?{message:u.defaultError}:{message:c??r??u.defaultError}},description:o}}function Wcn(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 ens(t){return new RegExp(`^${Wcn(t)}$`)}function tns(t){let e=`${Vcn}T${Wcn(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 rns(t,e){return!!((e==="v4"||!e)&&Wrs.test(t)||(e==="v6"||!e)&&Yrs.test(t))}function nns(t,e){if(!Grs.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,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function ins(t,e){return!!((e==="v4"||!e)&&zrs.test(t)||(e==="v6"||!e)&&Krs.test(t))}function ons(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}function eie(t){if(t instanceof f6){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=mC.create(eie(n))}return new f6({...t._def,shape:()=>e})}else return t instanceof OL?new OL({...t._def,type:eie(t.element)}):t instanceof mC?mC.create(eie(t.unwrap())):t instanceof $R?$R.create(eie(t.unwrap())):t instanceof UR?UR.create(t.items.map(e=>eie(e))):t}function Xkt(t,e){let r=MR(t),n=MR(e);if(t===e)return{valid:!0,data:t};if(r===oi.object&&n===oi.object){let o=lu.objectKeys(e),s=lu.objectKeys(t).filter(u=>o.indexOf(u)!==-1),a={...t,...e};for(let u of s){let c=Xkt(t[u],e[u]);if(!c.valid)return{valid:!1};a[u]=c.data}return{valid:!0,data:a}}else if(r===oi.array&&n===oi.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let a=t[s],u=e[s],c=Xkt(a,u);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===oi.date&&n===oi.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function zcn(t,e){return new uie({values:t,typeName:ko.ZodEnum,...zs(e)})}var J_,Hcn,La,Frs,Urs,$rs,jrs,Qrs,Grs,qrs,Hrs,Vrs,Kkt,Wrs,zrs,Yrs,Krs,Jrs,Xrs,Vcn,Zrs,tie,IAe,RAe,kAe,OAe,NAe,rie,nie,PAe,kL,iT,BAe,OL,f6,iie,FR,Jkt,oie,UR,Zkt,LAe,MAe,eOt,sie,aie,uie,cie,Wq,dC,mC,$R,lie,mie,FAe,SGu,zGe,YGe,die,wGu,ko,xGu,TGu,DGu,IGu,RGu,kGu,OGu,NGu,PGu,BGu,LGu,MGu,FGu,UGu,sns,$Gu,jGu,QGu,GGu,qGu,HGu,VGu,WGu,zGu,YGu,KGu,JGu,XGu,ZGu,equ,tqu,rqu,nqu,iqu,Ycn=j(()=>{HGe();VGe();qcn();Ykt();xAe();J_=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}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}},Hcn=(t,e)=>{if(Vq(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 d6(t.common.issues);return this._error=r,this._error}}};La=class{get description(){return this._def.description}_getType(e){return MR(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:MR(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ib,ctx:{common:e.parent.common,data:e.data,parsedType:MR(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(DAe(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:MR(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Hcn(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:MR(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Vq(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=>Vq(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:MR(e)},o=this._parse({data:e,path:n.path,parent:n}),s=await(DAe(o)?o:Promise.resolve(o));return Hcn(n,s)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,s)=>{let a=e(o),u=()=>s.addIssue({code:rn.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(u(),!1)):a?!0:(u(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new dC({schema:this,typeName:ko.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 mC.create(this,this._def)}nullable(){return $R.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return OL.create(this)}promise(){return Wq.create(this,this._def)}or(e){return iie.create([this,e],this._def)}and(e){return oie.create(this,e,this._def)}transform(e){return new dC({...zs(this._def),schema:this,typeName:ko.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new lie({...zs(this._def),innerType:this,defaultValue:r,typeName:ko.ZodDefault})}brand(){return new zGe({typeName:ko.ZodBranded,type:this,...zs(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new mie({...zs(this._def),innerType:this,catchValue:r,typeName:ko.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return YGe.create(this,e)}readonly(){return die.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Frs=/^c[^\s-]{8,}$/i,Urs=/^[0-9a-z]+$/,$rs=/^[0-9A-HJKMNP-TV-Z]{26}$/i,jrs=/^[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,Qrs=/^[a-z0-9_-]{21}$/i,Grs=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qrs=/^[-+]?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)?)??$/,Hrs=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Vrs="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Wrs=/^(?:(?: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])$/,zrs=/^(?:(?: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])$/,Yrs=/^(([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]))$/,Krs=/^(([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])$/,Jrs=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xrs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Vcn="((\\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])))",Zrs=new RegExp(`^${Vcn}$`);tie=class t extends La{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==oi.string){let s=this._getOrReturnCtx(e);return Un(s,{code:rn.invalid_type,expected:oi.string,received:s.parsedType}),Lo}let n=new Ib,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let a=e.data.length>s.value,u=e.data.length<s.value;(a||u)&&(o=this._getOrReturnCtx(e,o),a?Un(o,{code:rn.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):u&&Un(o,{code:rn.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")Hrs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"email",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Kkt||(Kkt=new RegExp(Vrs,"u")),Kkt.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"emoji",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")jrs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"uuid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Qrs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"nanoid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Frs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"cuid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Urs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"cuid2",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")$rs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"ulid",code:rn.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),Un(o,{validation:"url",code:rn.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"regex",code:rn.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?tns(s).test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Zrs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?ens(s).test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?qrs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"duration",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?rns(e.data,s.version)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"ip",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?nns(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"jwt",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?ins(e.data,s.version)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"cidr",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Jrs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"base64",code:rn.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?Xrs.test(e.data)||(o=this._getOrReturnCtx(e,o),Un(o,{validation:"base64url",code:rn.invalid_string,message:s.message}),n.dirty()):lu.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:rn.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}};tie.create=t=>new tie({checks:[],typeName:ko.ZodString,coerce:t?.coerce??!1,...zs(t)});IAe=class t extends La{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)!==oi.number){let s=this._getOrReturnCtx(e);return Un(s,{code:rn.invalid_type,expected:oi.number,received:s.parsedType}),Lo}let n,o=new Ib;for(let s of this._def.checks)s.kind==="int"?lu.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?ons(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.not_finite,message:s.message}),o.dirty()):lu.assertNever(s);return{status:o.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,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Mi.toString(o)}]})}_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"&&lu.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)}};IAe.create=t=>new IAe({checks:[],typeName:ko.ZodNumber,coerce:t?.coerce||!1,...zs(t)});RAe=class t extends La{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)!==oi.bigint)return this._getInvalidInput(e);let n,o=new Ib;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Un(n,{code:rn.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):lu.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Un(r,{code:rn.invalid_type,expected:oi.bigint,received:r.parsedType}),Lo}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,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Mi.toString(o)}]})}_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}};RAe.create=t=>new RAe({checks:[],typeName:ko.ZodBigInt,coerce:t?.coerce??!1,...zs(t)});kAe=class extends La{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==oi.boolean){let n=this._getOrReturnCtx(e);return Un(n,{code:rn.invalid_type,expected:oi.boolean,received:n.parsedType}),Lo}return l2(e.data)}};kAe.create=t=>new kAe({typeName:ko.ZodBoolean,coerce:t?.coerce||!1,...zs(t)});OAe=class t extends La{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==oi.date){let s=this._getOrReturnCtx(e);return Un(s,{code:rn.invalid_type,expected:oi.date,received:s.parsedType}),Lo}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return Un(s,{code:rn.invalid_date}),Lo}let n=new Ib,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),Un(o,{code:rn.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):lu.assertNever(s);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}};OAe.create=t=>new OAe({checks:[],coerce:t?.coerce||!1,typeName:ko.ZodDate,...zs(t)});NAe=class extends La{_parse(e){if(this._getType(e)!==oi.symbol){let n=this._getOrReturnCtx(e);return Un(n,{code:rn.invalid_type,expected:oi.symbol,received:n.parsedType}),Lo}return l2(e.data)}};NAe.create=t=>new NAe({typeName:ko.ZodSymbol,...zs(t)});rie=class extends La{_parse(e){if(this._getType(e)!==oi.undefined){let n=this._getOrReturnCtx(e);return Un(n,{code:rn.invalid_type,expected:oi.undefined,received:n.parsedType}),Lo}return l2(e.data)}};rie.create=t=>new rie({typeName:ko.ZodUndefined,...zs(t)});nie=class extends La{_parse(e){if(this._getType(e)!==oi.null){let n=this._getOrReturnCtx(e);return Un(n,{code:rn.invalid_type,expected:oi.null,received:n.parsedType}),Lo}return l2(e.data)}};nie.create=t=>new nie({typeName:ko.ZodNull,...zs(t)});PAe=class extends La{constructor(){super(...arguments),this._any=!0}_parse(e){return l2(e.data)}};PAe.create=t=>new PAe({typeName:ko.ZodAny,...zs(t)});kL=class extends La{constructor(){super(...arguments),this._unknown=!0}_parse(e){return l2(e.data)}};kL.create=t=>new kL({typeName:ko.ZodUnknown,...zs(t)});iT=class extends La{_parse(e){let r=this._getOrReturnCtx(e);return Un(r,{code:rn.invalid_type,expected:oi.never,received:r.parsedType}),Lo}};iT.create=t=>new iT({typeName:ko.ZodNever,...zs(t)});BAe=class extends La{_parse(e){if(this._getType(e)!==oi.undefined){let n=this._getOrReturnCtx(e);return Un(n,{code:rn.invalid_type,expected:oi.void,received:n.parsedType}),Lo}return l2(e.data)}};BAe.create=t=>new BAe({typeName:ko.ZodVoid,...zs(t)});OL=class t extends La{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==oi.array)return Un(r,{code:rn.invalid_type,expected:oi.array,received:r.parsedType}),Lo;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,u=r.data.length<o.exactLength.value;(a||u)&&(Un(r,{code:a?rn.too_big:rn.too_small,minimum:u?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(Un(r,{code:rn.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(Un(r,{code:rn.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,u)=>o.type._parseAsync(new J_(r,a,r.path,u)))).then(a=>Ib.mergeArray(n,a));let s=[...r.data].map((a,u)=>o.type._parseSync(new J_(r,a,r.path,u)));return Ib.mergeArray(n,s)}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)}};OL.create=(t,e)=>new OL({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ko.ZodArray,...zs(e)});f6=class t extends La{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=lu.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==oi.object){let m=this._getOrReturnCtx(e);return Un(m,{code:rn.invalid_type,expected:oi.object,received:m.parsedType}),Lo}let{status:n,ctx:o}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),u=[];if(!(this._def.catchall instanceof iT&&this._def.unknownKeys==="strip"))for(let m in o.data)a.includes(m)||u.push(m);let c=[];for(let m of a){let d=s[m],f=o.data[m];c.push({key:{status:"valid",value:m},value:d._parse(new J_(o,f,o.path,m)),alwaysSet:m in o.data})}if(this._def.catchall instanceof iT){let m=this._def.unknownKeys;if(m==="passthrough")for(let d of u)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(m==="strict")u.length>0&&(Un(o,{code:rn.unrecognized_keys,keys:u}),n.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let m=this._def.catchall;for(let d of u){let f=o.data[d];c.push({key:{status:"valid",value:d},value:m._parse(new J_(o,f,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let m=[];for(let d of c){let f=await d.key,p=await d.value;m.push({key:f,value:p,alwaysSet:d.alwaysSet})}return m}).then(m=>Ib.mergeObjectSync(n,m)):Ib.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 o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Mi.errToObj(e).message??o}:{message:o}}}:{}})}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:ko.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 lu.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 lu.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return eie(this)}partial(e){let r={};for(let n of lu.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of lu.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof mC;)s=s._def.innerType;r[n]=s}return new t({...this._def,shape:()=>r})}keyof(){return zcn(lu.objectKeys(this.shape))}};f6.create=(t,e)=>new f6({shape:()=>t,unknownKeys:"strip",catchall:iT.create(),typeName:ko.ZodObject,...zs(e)});f6.strictCreate=(t,e)=>new f6({shape:()=>t,unknownKeys:"strict",catchall:iT.create(),typeName:ko.ZodObject,...zs(e)});f6.lazycreate=(t,e)=>new f6({shape:t,unknownKeys:"strip",catchall:iT.create(),typeName:ko.ZodObject,...zs(e)});iie=class extends La{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(s){for(let u of s)if(u.result.status==="valid")return u.result;for(let u of s)if(u.result.status==="dirty")return r.common.issues.push(...u.ctx.common.issues),u.result;let a=s.map(u=>new d6(u.ctx.common.issues));return Un(r,{code:rn.invalid_union,unionErrors:a}),Lo}if(r.common.async)return Promise.all(n.map(async s=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let s,a=[];for(let c of n){let m={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:m});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:m}),m.common.issues.length&&a.push(m.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let u=a.map(c=>new d6(c));return Un(r,{code:rn.invalid_union,unionErrors:u}),Lo}}get options(){return this._def.options}};iie.create=(t,e)=>new iie({options:t,typeName:ko.ZodUnion,...zs(e)});FR=t=>t instanceof sie?FR(t.schema):t instanceof dC?FR(t.innerType()):t instanceof aie?[t.value]:t instanceof uie?t.options:t instanceof cie?lu.objectValues(t.enum):t instanceof lie?FR(t._def.innerType):t instanceof rie?[void 0]:t instanceof nie?[null]:t instanceof mC?[void 0,...FR(t.unwrap())]:t instanceof $R?[null,...FR(t.unwrap())]:t instanceof zGe||t instanceof die?FR(t.unwrap()):t instanceof mie?FR(t._def.innerType):[],Jkt=class t extends La{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==oi.object)return Un(r,{code:rn.invalid_type,expected:oi.object,received:r.parsedType}),Lo;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(Un(r,{code:rn.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Lo)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let s of r){let a=FR(s.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let u of a){if(o.has(u))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(u)}`);o.set(u,s)}}return new t({typeName:ko.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...zs(n)})}};oie=class extends La{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(s,a)=>{if(Wkt(s)||Wkt(a))return Lo;let u=Xkt(s.value,a.value);return u.valid?((zkt(s)||zkt(a))&&r.dirty(),{status:r.value,value:u.data}):(Un(n,{code:rn.invalid_intersection_types}),Lo)};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(([s,a])=>o(s,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};oie.create=(t,e,r)=>new oie({left:t,right:e,typeName:ko.ZodIntersection,...zs(r)});UR=class t extends La{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==oi.array)return Un(n,{code:rn.invalid_type,expected:oi.array,received:n.parsedType}),Lo;if(n.data.length<this._def.items.length)return Un(n,{code:rn.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Lo;!this._def.rest&&n.data.length>this._def.items.length&&(Un(n,{code:rn.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((a,u)=>{let c=this._def.items[u]||this._def.rest;return c?c._parse(new J_(n,a,n.path,u)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>Ib.mergeArray(r,a)):Ib.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};UR.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new UR({items:t,typeName:ko.ZodTuple,rest:null,...zs(e)})};Zkt=class t extends La{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!==oi.object)return Un(n,{code:rn.invalid_type,expected:oi.object,received:n.parsedType}),Lo;let o=[],s=this._def.keyType,a=this._def.valueType;for(let u in n.data)o.push({key:s._parse(new J_(n,u,n.path,u)),value:a._parse(new J_(n,n.data[u],n.path,u)),alwaysSet:u in n.data});return n.common.async?Ib.mergeObjectAsync(r,o):Ib.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof La?new t({keyType:e,valueType:r,typeName:ko.ZodRecord,...zs(n)}):new t({keyType:tie.create(),valueType:e,typeName:ko.ZodRecord,...zs(r)})}},LAe=class extends La{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!==oi.map)return Un(n,{code:rn.invalid_type,expected:oi.map,received:n.parsedType}),Lo;let o=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([u,c],m)=>({key:o._parse(new J_(n,u,n.path,[m,"key"])),value:s._parse(new J_(n,c,n.path,[m,"value"]))}));if(n.common.async){let u=new Map;return Promise.resolve().then(async()=>{for(let c of a){let m=await c.key,d=await c.value;if(m.status==="aborted"||d.status==="aborted")return Lo;(m.status==="dirty"||d.status==="dirty")&&r.dirty(),u.set(m.value,d.value)}return{status:r.value,value:u}})}else{let u=new Map;for(let c of a){let m=c.key,d=c.value;if(m.status==="aborted"||d.status==="aborted")return Lo;(m.status==="dirty"||d.status==="dirty")&&r.dirty(),u.set(m.value,d.value)}return{status:r.value,value:u}}}};LAe.create=(t,e,r)=>new LAe({valueType:e,keyType:t,typeName:ko.ZodMap,...zs(r)});MAe=class t extends La{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==oi.set)return Un(n,{code:rn.invalid_type,expected:oi.set,received:n.parsedType}),Lo;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(Un(n,{code:rn.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(Un(n,{code:rn.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function a(c){let m=new Set;for(let d of c){if(d.status==="aborted")return Lo;d.status==="dirty"&&r.dirty(),m.add(d.value)}return{status:r.value,value:m}}let u=[...n.data.values()].map((c,m)=>s._parse(new J_(n,c,n.path,m)));return n.common.async?Promise.all(u).then(c=>a(c)):a(u)}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)}};MAe.create=(t,e)=>new MAe({valueType:t,minSize:null,maxSize:null,typeName:ko.ZodSet,...zs(e)});eOt=class t extends La{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==oi.function)return Un(r,{code:rn.invalid_type,expected:oi.function,received:r.parsedType}),Lo;function n(u,c){return WGe({data:u,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,TAe(),RL].filter(m=>!!m),issueData:{code:rn.invalid_arguments,argumentsError:c}})}function o(u,c){return WGe({data:u,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,TAe(),RL].filter(m=>!!m),issueData:{code:rn.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Wq){let u=this;return l2(async function(...c){let m=new d6([]),d=await u._def.args.parseAsync(c,s).catch(h=>{throw m.addIssue(n(c,h)),m}),f=await Reflect.apply(a,this,d);return await u._def.returns._def.type.parseAsync(f,s).catch(h=>{throw m.addIssue(o(f,h)),m})})}else{let u=this;return l2(function(...c){let m=u._def.args.safeParse(c,s);if(!m.success)throw new d6([n(c,m.error)]);let d=Reflect.apply(a,this,m.data),f=u._def.returns.safeParse(d,s);if(!f.success)throw new d6([o(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:UR.create(e).rest(kL.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||UR.create([]).rest(kL.create()),returns:r||kL.create(),typeName:ko.ZodFunction,...zs(n)})}},sie=class extends La{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})}};sie.create=(t,e)=>new sie({getter:t,typeName:ko.ZodLazy,...zs(e)});aie=class extends La{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Un(r,{received:r.data,code:rn.invalid_literal,expected:this._def.value}),Lo}return{status:"valid",value:e.data}}get value(){return this._def.value}};aie.create=(t,e)=>new aie({value:t,typeName:ko.ZodLiteral,...zs(e)});uie=class t extends La{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return Un(r,{expected:lu.joinValues(n),received:r.parsedType,code:rn.invalid_type}),Lo}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 Un(r,{received:r.data,code:rn.invalid_enum_value,options:n}),Lo}return l2(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})}};uie.create=zcn;cie=class extends La{_parse(e){let r=lu.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==oi.string&&n.parsedType!==oi.number){let o=lu.objectValues(r);return Un(n,{expected:lu.joinValues(o),received:n.parsedType,code:rn.invalid_type}),Lo}if(this._cache||(this._cache=new Set(lu.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=lu.objectValues(r);return Un(n,{received:n.data,code:rn.invalid_enum_value,options:o}),Lo}return l2(e.data)}get enum(){return this._def.values}};cie.create=(t,e)=>new cie({values:t,typeName:ko.ZodNativeEnum,...zs(e)});Wq=class extends La{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==oi.promise&&r.common.async===!1)return Un(r,{code:rn.invalid_type,expected:oi.promise,received:r.parsedType}),Lo;let n=r.parsedType===oi.promise?r.data:Promise.resolve(r.data);return l2(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Wq.create=(t,e)=>new Wq({type:t,typeName:ko.ZodPromise,...zs(e)});dC=class extends La{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ko.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:a=>{Un(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let a=o.transform(n.data,s);if(n.common.async)return Promise.resolve(a).then(async u=>{if(r.value==="aborted")return Lo;let c=await this._def.schema._parseAsync({data:u,path:n.path,parent:n});return c.status==="aborted"?Lo:c.status==="dirty"?Zne(c.value):r.value==="dirty"?Zne(c.value):c});{if(r.value==="aborted")return Lo;let u=this._def.schema._parseSync({data:a,path:n.path,parent:n});return u.status==="aborted"?Lo:u.status==="dirty"?Zne(u.value):r.value==="dirty"?Zne(u.value):u}}if(o.type==="refinement"){let a=u=>{let c=o.refinement(u,s);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 u};if(n.common.async===!1){let u=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return u.status==="aborted"?Lo:(u.status==="dirty"&&r.dirty(),a(u.value),{status:r.value,value:u.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(u=>u.status==="aborted"?Lo:(u.status==="dirty"&&r.dirty(),a(u.value).then(()=>({status:r.value,value:u.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Vq(a))return Lo;let u=o.transform(a.value,s);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:u}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Vq(a)?Promise.resolve(o.transform(a.value,s)).then(u=>({status:r.value,value:u})):Lo);lu.assertNever(o)}};dC.create=(t,e,r)=>new dC({schema:t,typeName:ko.ZodEffects,effect:e,...zs(r)});dC.createWithPreprocess=(t,e,r)=>new dC({schema:e,effect:{type:"preprocess",transform:t},typeName:ko.ZodEffects,...zs(r)});mC=class extends La{_parse(e){return this._getType(e)===oi.undefined?l2(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};mC.create=(t,e)=>new mC({innerType:t,typeName:ko.ZodOptional,...zs(e)});$R=class extends La{_parse(e){return this._getType(e)===oi.null?l2(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$R.create=(t,e)=>new $R({innerType:t,typeName:ko.ZodNullable,...zs(e)});lie=class extends La{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===oi.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};lie.create=(t,e)=>new lie({innerType:t,typeName:ko.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...zs(e)});mie=class extends La{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return DAe(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new d6(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new d6(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};mie.create=(t,e)=>new mie({innerType:t,typeName:ko.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...zs(e)});FAe=class extends La{_parse(e){if(this._getType(e)!==oi.nan){let n=this._getOrReturnCtx(e);return Un(n,{code:rn.invalid_type,expected:oi.nan,received:n.parsedType}),Lo}return{status:"valid",value:e.data}}};FAe.create=t=>new FAe({typeName:ko.ZodNaN,...zs(t)});SGu=Symbol("zod_brand"),zGe=class extends La{_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}},YGe=class t extends La{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Lo:s.status==="dirty"?(r.dirty(),Zne(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Lo:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:ko.ZodPipeline})}},die=class extends La{_parse(e){let r=this._def.innerType._parse(e),n=o=>(Vq(o)&&(o.value=Object.freeze(o.value)),o);return DAe(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};die.create=(t,e)=>new die({innerType:t,typeName:ko.ZodReadonly,...zs(e)});wGu={object:f6.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"})(ko||(ko={}));xGu=tie.create,TGu=IAe.create,DGu=FAe.create,IGu=RAe.create,RGu=kAe.create,kGu=OAe.create,OGu=NAe.create,NGu=rie.create,PGu=nie.create,BGu=PAe.create,LGu=kL.create,MGu=iT.create,FGu=BAe.create,UGu=OL.create,sns=f6.create,$Gu=f6.strictCreate,jGu=iie.create,QGu=Jkt.create,GGu=oie.create,qGu=UR.create,HGu=Zkt.create,VGu=LAe.create,WGu=MAe.create,zGu=eOt.create,YGu=sie.create,KGu=aie.create,JGu=uie.create,XGu=cie.create,ZGu=Wq.create,equ=dC.create,tqu=mC.create,rqu=$R.create,nqu=dC.createWithPreprocess,iqu=YGe.create});var tOt=j(()=>{VGe();Ykt();Gcn();xAe();Ycn();HGe()});var UAe=j(()=>{tOt();tOt()});function Lt(t,e,r){function n(u,c){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(t))return;u._zod.traits.add(t),e(u,c);let m=a.prototype,d=Object.keys(m);for(let f=0;f<d.length;f++){let p=d[f];p in u||(u[p]=m[p].bind(u))}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function a(u){var c;let m=r?.Parent?new s:this;n(m,u),(c=m._zod).deferred??(c.deferred=[]);for(let d of m._zod.deferred)d();return m}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>r?.Parent&&u instanceof r.Parent?!0:u?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}function Td(t){return t&&Object.assign($Ae,t),$Ae}var fie,jAe,fC,NL,$Ae,pie=j(()=>{fie=Object.freeze({status:"aborted"});jAe=Symbol("zod_brand"),fC=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},NL=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},$Ae={}});var nn={};fo(nn,{BIGINT_FORMAT_RANGES:()=>lOt,Class:()=>nOt,NUMBER_FORMAT_RANGES:()=>cOt,aborted:()=>ML,allowsEval:()=>sOt,assert:()=>fns,assertEqual:()=>cns,assertIs:()=>mns,assertNever:()=>dns,assertNotEqual:()=>lns,assignProp:()=>BL,base64ToUint8Array:()=>nln,base64urlToUint8Array:()=>Sns,cached:()=>gie,captureStackTrace:()=>JGe,cleanEnum:()=>Cns,cleanRegex:()=>qAe,clone:()=>J3,cloneDef:()=>hns,createTransparentProxy:()=>Ens,defineLazy:()=>oa,esc:()=>KGe,escapeRegex:()=>X_,extend:()=>Zcn,finalizeIssue:()=>u8,floatSafeRemainder:()=>iOt,getElementAtPath:()=>gns,getEnumValues:()=>GAe,getLengthableOrigin:()=>WAe,getParsedType:()=>_ns,getSizableOrigin:()=>VAe,hexToUint8Array:()=>xns,isObject:()=>zq,isPlainObject:()=>LL,issue:()=>bie,joinValues:()=>sr,jsonStringifyReplacer:()=>hie,merge:()=>vns,mergeDefs:()=>jR,normalizeParams:()=>an,nullish:()=>PL,numKeys:()=>yns,objectClone:()=>pns,omit:()=>Xcn,optionalKeys:()=>uOt,parsedType:()=>on,partial:()=>tln,pick:()=>Jcn,prefixIssues:()=>p6,primitiveTypes:()=>aOt,promiseAllObject:()=>bns,propertyKeyTypes:()=>HAe,randomString:()=>Ans,required:()=>rln,safeExtend:()=>eln,shallowClone:()=>XGe,slugify:()=>oOt,stringifyPrimitive:()=>Zr,uint8ArrayToBase64:()=>iln,uint8ArrayToBase64url:()=>wns,uint8ArrayToHex:()=>Tns,unwrapMessage:()=>QAe});function cns(t){return t}function lns(t){return t}function mns(t){}function dns(t){throw new Error("Unexpected value in exhaustive check")}function fns(t){}function GAe(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function sr(t,e="|"){return t.map(r=>Zr(r)).join(e)}function hie(t,e){return typeof e=="bigint"?e.toString():e}function gie(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function PL(t){return t==null}function qAe(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function iOt(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let s=r>o?r:o,a=Number.parseInt(t.toFixed(s).replace(".","")),u=Number.parseInt(e.toFixed(s).replace(".",""));return a%u/10**s}function oa(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==Kcn)return n===void 0&&(n=Kcn,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function pns(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function BL(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function jR(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function hns(t){return jR(t._zod.def)}function gns(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function bns(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<e.length;s++)o[e[s]]=n[s];return o})}function Ans(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function KGe(t){return JSON.stringify(t)}function oOt(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function zq(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function LL(t){if(zq(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(zq(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function XGe(t){return LL(t)?{...t}:Array.isArray(t)?[...t]:t}function yns(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function X_(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function J3(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function an(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Ens(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,s){return e??(e=t()),Reflect.set(e,n,o,s)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function Zr(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function uOt(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function Jcn(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=jR(t._zod.def,{get shape(){let a={};for(let u in e){if(!(u in r.shape))throw new Error(`Unrecognized key: "${u}"`);e[u]&&(a[u]=r.shape[u])}return BL(this,"shape",a),a},checks:[]});return J3(t,s)}function Xcn(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=jR(t._zod.def,{get shape(){let a={...t._zod.def.shape};for(let u in e){if(!(u in r.shape))throw new Error(`Unrecognized key: "${u}"`);e[u]&&delete a[u]}return BL(this,"shape",a),a},checks:[]});return J3(t,s)}function Zcn(t,e){if(!LL(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let s=t._zod.def.shape;for(let a in e)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=jR(t._zod.def,{get shape(){let s={...t._zod.def.shape,...e};return BL(this,"shape",s),s}});return J3(t,o)}function eln(t,e){if(!LL(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=jR(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return BL(this,"shape",n),n}});return J3(t,r)}function vns(t,e){let r=jR(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return BL(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return J3(t,r)}function tln(t,e,r){let o=e._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=jR(e._zod.def,{get shape(){let u=e._zod.def.shape,c={...u};if(r)for(let m in r){if(!(m in u))throw new Error(`Unrecognized key: "${m}"`);r[m]&&(c[m]=t?new t({type:"optional",innerType:u[m]}):u[m])}else for(let m in u)c[m]=t?new t({type:"optional",innerType:u[m]}):u[m];return BL(this,"shape",c),c},checks:[]});return J3(e,a)}function rln(t,e,r){let n=jR(e._zod.def,{get shape(){let o=e._zod.def.shape,s={...o};if(r)for(let a in r){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(s[a]=new t({type:"nonoptional",innerType:o[a]}))}else for(let a in o)s[a]=new t({type:"nonoptional",innerType:o[a]});return BL(this,"shape",s),s}});return J3(e,n)}function ML(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function p6(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function QAe(t){return typeof t=="string"?t:t?.message}function u8(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=QAe(t.inst?._zod.def?.error?.(t))??QAe(e?.error?.(t))??QAe(r.customError?.(t))??QAe(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function VAe(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function WAe(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function on(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function bie(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function Cns(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function nln(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function iln(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function Sns(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return nln(e+r)}function wns(t){return iln(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function xns(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function Tns(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var Kcn,JGe,sOt,_ns,HAe,aOt,cOt,lOt,nOt,Wi=j(()=>{Kcn=Symbol("evaluating");JGe="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};sOt=gie(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});_ns=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},HAe=new Set(["string","number","symbol"]),aOt=new Set(["string","number","bigint","boolean","symbol","undefined"]);cOt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},lOt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};nOt=class{constructor(...e){}}});function Aie(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function yie(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>n({issues:a}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)r._errors.push(e(s));else{let a=r,u=0;for(;u<s.path.length;){let c=s.path[u];u===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(e(s))):a[c]=a[c]||{_errors:[]},a=a[c],u++}}};return n(t),r}function ZGe(t,e=r=>r.message){let r={errors:[]},n=(o,s=[])=>{var a,u;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(m=>n({issues:m},c.path));else if(c.code==="invalid_key")n({issues:c.issues},c.path);else if(c.code==="invalid_element")n({issues:c.issues},c.path);else{let m=[...s,...c.path];if(m.length===0){r.errors.push(e(c));continue}let d=r,f=0;for(;f<m.length;){let p=m[f],h=f===m.length-1;typeof p=="string"?(d.properties??(d.properties={}),(a=d.properties)[p]??(a[p]={errors:[]}),d=d.properties[p]):(d.items??(d.items=[]),(u=d.items)[p]??(u[p]={errors:[]}),d=d.items[p]),h&&d.errors.push(e(c)),f++}}};return n(t),r}function sln(t){let e=[],r=t.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function eqe(t){let e=[],r=[...t.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${sln(n.path)}`);return e.join(`
|
|
967
967
|
`)}var oln,zAe,c8,mOt=j(()=>{pie();Wi();oln=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,hie,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},zAe=Lt("$ZodError",oln),c8=Lt("$ZodError",oln,{Parent:Error})});var _ie,Eie,vie,Cie,Sie,Yq,wie,xie,tqe,aln,rqe,uln,nqe,cln,iqe,lln,oqe,mln,sqe,dln,aqe,fln,uqe,pln,dOt=j(()=>{pie();mOt();Wi();_ie=t=>(e,r,n,o)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new fC;if(a.issues.length){let u=new(o?.Err??t)(a.issues.map(c=>u8(c,s,Td())));throw JGe(u,o?.callee),u}return a.value},Eie=_ie(c8),vie=t=>async(e,r,n,o)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let u=new(o?.Err??t)(a.issues.map(c=>u8(c,s,Td())));throw JGe(u,o?.callee),u}return a.value},Cie=vie(c8),Sie=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new fC;return s.issues.length?{success:!1,error:new(t??zAe)(s.issues.map(a=>u8(a,o,Td())))}:{success:!0,data:s.value}},Yq=Sie(c8),wie=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(a=>u8(a,o,Td())))}:{success:!0,data:s.value}},xie=wie(c8),tqe=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return _ie(t)(e,r,o)},aln=tqe(c8),rqe=t=>(e,r,n)=>_ie(t)(e,r,n),uln=rqe(c8),nqe=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return vie(t)(e,r,o)},cln=nqe(c8),iqe=t=>async(e,r,n)=>vie(t)(e,r,n),lln=iqe(c8),oqe=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Sie(t)(e,r,o)},mln=oqe(c8),sqe=t=>(e,r,n)=>Sie(t)(e,r,n),dln=sqe(c8),aqe=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return wie(t)(e,r,o)},fln=aqe(c8),uqe=t=>async(e,r,n)=>wie(t)(e,r,n),pln=uqe(c8)});var l8={};fo(l8,{base64:()=>DOt,base64url:()=>cqe,bigint:()=>POt,boolean:()=>LOt,browserEmail:()=>Lns,cidrv4:()=>xOt,cidrv6:()=>TOt,cuid:()=>fOt,cuid2:()=>pOt,date:()=>ROt,datetime:()=>OOt,domain:()=>Uns,duration:()=>yOt,e164:()=>IOt,email:()=>EOt,emoji:()=>vOt,extendedDuration:()=>Ins,guid:()=>_Ot,hex:()=>$ns,hostname:()=>Fns,html5Email:()=>Nns,idnEmail:()=>Bns,integer:()=>BOt,ipv4:()=>COt,ipv6:()=>SOt,ksuid:()=>bOt,lowercase:()=>UOt,mac:()=>wOt,md5_base64:()=>Qns,md5_base64url:()=>Gns,md5_hex:()=>jns,nanoid:()=>AOt,null:()=>MOt,number:()=>lqe,rfc5322Email:()=>Pns,sha1_base64:()=>Hns,sha1_base64url:()=>Vns,sha1_hex:()=>qns,sha256_base64:()=>zns,sha256_base64url:()=>Yns,sha256_hex:()=>Wns,sha384_base64:()=>Jns,sha384_base64url:()=>Xns,sha384_hex:()=>Kns,sha512_base64:()=>eis,sha512_base64url:()=>tis,sha512_hex:()=>Zns,string:()=>NOt,time:()=>kOt,ulid:()=>hOt,undefined:()=>FOt,unicodeEmail:()=>hln,uppercase:()=>$Ot,uuid:()=>Kq,uuid4:()=>Rns,uuid6:()=>kns,uuid7:()=>Ons,xid:()=>gOt});function vOt(){return new RegExp(Mns,"u")}function bln(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function kOt(t){return new RegExp(`^${bln(t)}$`)}function OOt(t){let e=bln({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${gln}T(?:${n})$`)}function YAe(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function KAe(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var fOt,pOt,hOt,gOt,bOt,AOt,yOt,Ins,_Ot,Kq,Rns,kns,Ons,EOt,Nns,Pns,hln,Bns,Lns,Mns,COt,SOt,wOt,xOt,TOt,DOt,cqe,Fns,Uns,IOt,gln,ROt,NOt,POt,BOt,lqe,LOt,MOt,FOt,UOt,$Ot,$ns,jns,Qns,Gns,qns,Hns,Vns,Wns,zns,Yns,Kns,Jns,Xns,Zns,eis,tis,mqe=j(()=>{Wi();fOt=/^[cC][^\s-]{8,}$/,pOt=/^[0-9a-z]+$/,hOt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,gOt=/^[0-9a-vA-V]{20}$/,bOt=/^[A-Za-z0-9]{27}$/,AOt=/^[a-zA-Z0-9_-]{21}$/,yOt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ins=/^[-+]?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)?)??$/,_Ot=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Kq=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Rns=Kq(4),kns=Kq(6),Ons=Kq(7),EOt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Nns=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Pns=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,hln=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Bns=hln,Lns=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Mns="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";COt=/^(?:(?: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])$/,SOt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,wOt=t=>{let e=X_(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},xOt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,TOt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,DOt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,cqe=/^[A-Za-z0-9_-]*$/,Fns=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Uns=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,IOt=/^\+[1-9]\d{6,14}$/,gln="(?:(?:\\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])))",ROt=new RegExp(`^${gln}$`);NOt=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},POt=/^-?\d+n?$/,BOt=/^-?\d+$/,lqe=/^-?\d+(?:\.\d+)?$/,LOt=/^(?:true|false)$/i,MOt=/^null$/i,FOt=/^undefined$/i,UOt=/^[^A-Z]*$/,$Ot=/^[^a-z]*$/,$ns=/^[0-9a-fA-F]*$/;jns=/^[0-9a-fA-F]{32}$/,Qns=YAe(22,"=="),Gns=KAe(22),qns=/^[0-9a-fA-F]{40}$/,Hns=YAe(27,"="),Vns=KAe(27),Wns=/^[0-9a-fA-F]{64}$/,zns=YAe(43,"="),Yns=KAe(43),Kns=/^[0-9a-fA-F]{96}$/,Jns=YAe(64,""),Xns=KAe(64),Zns=/^[0-9a-fA-F]{128}$/,eis=YAe(86,"=="),tis=KAe(86)});function Aln(t,e,r){t.issues.length&&e.issues.push(...p6(r,t.issues))}var ql,yln,dqe,fqe,jOt,QOt,GOt,qOt,HOt,VOt,WOt,zOt,YOt,Tie,KOt,JOt,XOt,ZOt,eNt,tNt,rNt,nNt,iNt,pqe=j(()=>{pie();mqe();Wi();ql=Lt("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),yln={number:"number",bigint:"bigint",object:"date"},dqe=Lt("$ZodCheckLessThan",(t,e)=>{ql.init(t,e);let r=yln[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),fqe=Lt("$ZodCheckGreaterThan",(t,e)=>{ql.init(t,e);let r=yln[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),jOt=Lt("$ZodCheckMultipleOf",(t,e)=>{ql.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):iOt(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),QOt=Lt("$ZodCheckNumberFormat",(t,e)=>{ql.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,s]=cOt[e.format];t._zod.onattach.push(a=>{let u=a._zod.bag;u.format=e.format,u.minimum=o,u.maximum=s,r&&(u.pattern=BOt)}),t._zod.check=a=>{let u=a.value;if(r){if(!Number.isInteger(u)){a.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:u,inst:t});return}if(!Number.isSafeInteger(u)){u>0?a.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):a.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}u<o&&a.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),u>s&&a.issues.push({origin:"number",input:u,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!e.abort})}}),GOt=Lt("$ZodCheckBigIntFormat",(t,e)=>{ql.init(t,e);let[r,n]=lOt[e.format];t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,s.minimum=r,s.maximum=n}),t._zod.check=o=>{let s=o.value;s<r&&o.issues.push({origin:"bigint",input:s,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),s>n&&o.issues.push({origin:"bigint",input:s,code:"too_big",maximum:n,inclusive:!0,inst:t,continue:!e.abort})}}),qOt=Lt("$ZodCheckMaxSize",(t,e)=>{var r;ql.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!PL(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;o.size<=e.maximum||n.issues.push({origin:VAe(o),code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),HOt=Lt("$ZodCheckMinSize",(t,e)=>{var r;ql.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!PL(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:VAe(o),code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),VOt=Lt("$ZodCheckSizeEquals",(t,e)=>{var r;ql.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!PL(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,s=o.size;if(s===e.size)return;let a=s>e.size;n.issues.push({origin:VAe(o),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),WOt=Lt("$ZodCheckMaxLength",(t,e)=>{var r;ql.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!PL(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let a=WAe(o);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),zOt=Lt("$ZodCheckMinLength",(t,e)=>{var r;ql.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!PL(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let a=WAe(o);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),YOt=Lt("$ZodCheckLengthEquals",(t,e)=>{var r;ql.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!PL(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,s=o.length;if(s===e.length)return;let a=WAe(o),u=s>e.length;n.issues.push({origin:a,...u?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Tie=Lt("$ZodCheckStringFormat",(t,e)=>{var r,n;ql.init(t,e),t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),KOt=Lt("$ZodCheckRegex",(t,e)=>{Tie.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),JOt=Lt("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=UOt),Tie.init(t,e)}),XOt=Lt("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=$Ot),Tie.init(t,e)}),ZOt=Lt("$ZodCheckIncludes",(t,e)=>{ql.init(t,e);let r=X_(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),eNt=Lt("$ZodCheckStartsWith",(t,e)=>{ql.init(t,e);let r=new RegExp(`^${X_(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),tNt=Lt("$ZodCheckEndsWith",(t,e)=>{ql.init(t,e);let r=new RegExp(`.*${X_(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});rNt=Lt("$ZodCheckProperty",(t,e)=>{ql.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>Aln(o,r,e.property));Aln(n,r,e.property)}}),nNt=Lt("$ZodCheckMimeType",(t,e)=>{ql.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),iNt=Lt("$ZodCheckOverwrite",(t,e)=>{ql.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var JAe,oNt=j(()=>{JAe=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
968
968
|
`).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),s=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of s)this.content.push(a)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...r,o.join(`
|
|
969
969
|
`))}}});var sNt,aNt=j(()=>{sNt={major:4,minor:3,patch:5}});function cNt(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}function Oln(t){if(!cqe.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return cNt(r)}function Nln(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}function Eln(t,e,r){t.issues.length&&e.issues.push(...p6(r,t.issues)),e.value[r]=t.value}function yqe(t,e,r,n,o){if(t.issues.length){if(o&&!(r in n))return;e.issues.push(...p6(r,t.issues))}t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function Pln(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=uOt(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function Bln(t,e,r,n,o,s){let a=[],u=o.keySet,c=o.catchall._zod,m=c.def.type,d=c.optout==="optional";for(let f in e){if(u.has(f))continue;if(m==="never"){a.push(f);continue}let p=c.run({value:e[f],issues:[]},n);p instanceof Promise?t.push(p.then(h=>yqe(h,r,f,e,d))):yqe(p,r,f,e,d)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:s}),t.length?Promise.all(t).then(()=>r):r}function vln(t,e,r,n){for(let s of t)if(s.issues.length===0)return e.value=s.value,e;let o=t.filter(s=>!ML(s));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(s=>s.issues.map(a=>u8(a,n,Td())))}),e)}function Cln(t,e,r,n){let o=t.filter(s=>s.issues.length===0);return o.length===1?(e.value=o[0].value,e):(o.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(s=>s.issues.map(a=>u8(a,n,Td())))}):e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:[],inclusive:!1}),e)}function uNt(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(LL(t)&&LL(e)){let r=Object.keys(e),n=Object.keys(t).filter(s=>r.indexOf(s)!==-1),o={...t,...e};for(let s of n){let a=uNt(t[s],e[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};o[s]=a.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],s=e[n],a=uNt(o,s);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Sln(t,e,r){let n=new Map,o;for(let u of e.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(let c of u.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else t.issues.push(u);for(let u of r.issues)if(u.code==="unrecognized_keys")for(let c of u.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else t.issues.push(u);let s=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(s.length&&o&&t.issues.push({...o,keys:s}),ML(t))return t;let a=uNt(e.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return t.value=a.data,t}function hqe(t,e,r){t.issues.length&&e.issues.push(...p6(r,t.issues)),e.value[r]=t.value}function wln(t,e,r,n,o,s,a){t.issues.length&&(HAe.has(typeof n)?r.issues.push(...p6(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:s,issues:t.issues.map(u=>u8(u,a,Td()))})),e.issues.length&&(HAe.has(typeof n)?r.issues.push(...p6(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:s,key:n,issues:e.issues.map(u=>u8(u,a,Td()))})),r.value.set(t.value,e.value)}function xln(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}function Tln(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}function Dln(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function Iln(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function gqe(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}function bqe(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let o=e.transform(t.value,t);return o instanceof Promise?o.then(s=>Aqe(t,s,e.out,r)):Aqe(t,o,e.out,r)}else{let o=e.reverseTransform(t.value,t);return o instanceof Promise?o.then(s=>Aqe(t,s,e.in,r)):Aqe(t,o,e.in,r)}}function Aqe(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}function Rln(t){return t.value=Object.freeze(t.value),t}function kln(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(bie(o))}}var es,FL,Cl,_qe,Eqe,vqe,Cqe,Sqe,wqe,xqe,Tqe,Dqe,Iqe,Rqe,kqe,Oqe,Nqe,Pqe,Bqe,Lqe,Mqe,Fqe,Uqe,$qe,jqe,Qqe,Gqe,qqe,XAe,Hqe,Die,ZAe,Vqe,Wqe,zqe,Yqe,Kqe,Jqe,Xqe,Zqe,eHe,tHe,lNt,mNt,Iie,rHe,nHe,iHe,e2e,oHe,sHe,aHe,uHe,cHe,lHe,mHe,t2e,dHe,fHe,pHe,hHe,gHe,bHe,AHe,yHe,_He,Rie,EHe,vHe,CHe,SHe,wHe,xHe,dNt=j(()=>{pqe();pie();oNt();dOt();mqe();Wi();aNt();Wi();es=Lt("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=sNt;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let s of o._zod.onattach)s(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(a,u,c)=>{let m=ML(a),d;for(let f of u){if(f._zod.def.when){if(!f._zod.def.when(a))continue}else if(m)continue;let p=a.issues.length,h=f._zod.check(a);if(h instanceof Promise&&c?.async===!1)throw new fC;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,a.issues.length!==p&&(m||(m=ML(a,p)))});else{if(a.issues.length===p)continue;m||(m=ML(a,p))}}return d?d.then(()=>a):a},s=(a,u,c)=>{if(ML(a))return a.aborted=!0,a;let m=o(u,n,c);if(m instanceof Promise){if(c.async===!1)throw new fC;return m.then(d=>t._zod.parse(d,c))}return t._zod.parse(m,c)};t._zod.run=(a,u)=>{if(u.skipChecks)return t._zod.parse(a,u);if(u.direction==="backward"){let m=t._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});return m instanceof Promise?m.then(d=>s(d,a,u)):s(m,a,u)}let c=t._zod.parse(a,u);if(c instanceof Promise){if(u.async===!1)throw new fC;return c.then(m=>o(m,n,u))}return o(c,n,u)}}oa(t,"~standard",()=>({validate:o=>{try{let s=Yq(t,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return xie(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),FL=Lt("$ZodString",(t,e)=>{es.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??NOt(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),Cl=Lt("$ZodStringFormat",(t,e)=>{Tie.init(t,e),FL.init(t,e)}),_qe=Lt("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=_Ot),Cl.init(t,e)}),Eqe=Lt("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Kq(n))}else e.pattern??(e.pattern=Kq());Cl.init(t,e)}),vqe=Lt("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=EOt),Cl.init(t,e)}),Cqe=Lt("$ZodURL",(t,e)=>{Cl.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Sqe=Lt("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=vOt()),Cl.init(t,e)}),wqe=Lt("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=AOt),Cl.init(t,e)}),xqe=Lt("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=fOt),Cl.init(t,e)}),Tqe=Lt("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=pOt),Cl.init(t,e)}),Dqe=Lt("$ZodULID",(t,e)=>{e.pattern??(e.pattern=hOt),Cl.init(t,e)}),Iqe=Lt("$ZodXID",(t,e)=>{e.pattern??(e.pattern=gOt),Cl.init(t,e)}),Rqe=Lt("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=bOt),Cl.init(t,e)}),kqe=Lt("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=OOt(e)),Cl.init(t,e)}),Oqe=Lt("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=ROt),Cl.init(t,e)}),Nqe=Lt("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=kOt(e)),Cl.init(t,e)}),Pqe=Lt("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=yOt),Cl.init(t,e)}),Bqe=Lt("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=COt),Cl.init(t,e),t._zod.bag.format="ipv4"}),Lqe=Lt("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=SOt),Cl.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Mqe=Lt("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=wOt(e.delimiter)),Cl.init(t,e),t._zod.bag.format="mac"}),Fqe=Lt("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=xOt),Cl.init(t,e)}),Uqe=Lt("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=TOt),Cl.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,s]=n;if(!s)throw new Error;let a=Number(s);if(`${a}`!==s)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});$qe=Lt("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=DOt),Cl.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{cNt(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});jqe=Lt("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=cqe),Cl.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{Oln(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Qqe=Lt("$ZodE164",(t,e)=>{e.pattern??(e.pattern=IOt),Cl.init(t,e)});Gqe=Lt("$ZodJWT",(t,e)=>{Cl.init(t,e),t._zod.check=r=>{Nln(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),qqe=Lt("$ZodCustomStringFormat",(t,e)=>{Cl.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),XAe=Lt("$ZodNumber",(t,e)=>{es.init(t,e),t._zod.pattern=t._zod.bag.pattern??lqe,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...s?{received:s}:{}}),r}}),Hqe=Lt("$ZodNumberFormat",(t,e)=>{QOt.init(t,e),XAe.init(t,e)}),Die=Lt("$ZodBoolean",(t,e)=>{es.init(t,e),t._zod.pattern=LOt,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),ZAe=Lt("$ZodBigInt",(t,e)=>{es.init(t,e),t._zod.pattern=POt,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),Vqe=Lt("$ZodBigIntFormat",(t,e)=>{GOt.init(t,e),ZAe.init(t,e)}),Wqe=Lt("$ZodSymbol",(t,e)=>{es.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),zqe=Lt("$ZodUndefined",(t,e)=>{es.init(t,e),t._zod.pattern=FOt,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),Yqe=Lt("$ZodNull",(t,e)=>{es.init(t,e),t._zod.pattern=MOt,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),Kqe=Lt("$ZodAny",(t,e)=>{es.init(t,e),t._zod.parse=r=>r}),Jqe=Lt("$ZodUnknown",(t,e)=>{es.init(t,e),t._zod.parse=r=>r}),Xqe=Lt("$ZodNever",(t,e)=>{es.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),Zqe=Lt("$ZodVoid",(t,e)=>{es.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),eHe=Lt("$ZodDate",(t,e)=>{es.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:t}),r}});tHe=Lt("$ZodArray",(t,e)=>{es.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let s=[];for(let a=0;a<o.length;a++){let u=o[a],c=e.element._zod.run({value:u,issues:[]},n);c instanceof Promise?s.push(c.then(m=>Eln(m,r,a))):Eln(c,r,a)}return s.length?Promise.all(s).then(()=>r):r}});lNt=Lt("$ZodObject",(t,e)=>{if(es.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let u=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...u};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=gie(()=>Pln(e));oa(t._zod,"propValues",()=>{let u=e.shape,c={};for(let m in u){let d=u[m]._zod;if(d.values){c[m]??(c[m]=new Set);for(let f of d.values)c[m].add(f)}}return c});let o=zq,s=e.catchall,a;t._zod.parse=(u,c)=>{a??(a=n.value);let m=u.value;if(!o(m))return u.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),u;u.value={};let d=[],f=a.shape;for(let p of a.keys){let h=f[p],g=h._zod.optout==="optional",b=h._zod.run({value:m[p],issues:[]},c);b instanceof Promise?d.push(b.then(A=>yqe(A,u,p,m,g))):yqe(b,u,p,m,g)}return s?Bln(d,m,u,c,n.value,t):d.length?Promise.all(d).then(()=>u):u}}),mNt=Lt("$ZodObjectJIT",(t,e)=>{lNt.init(t,e);let r=t._zod.parse,n=gie(()=>Pln(e)),o=p=>{let h=new JAe(["shape","payload","ctx"]),g=n.value,b=v=>{let C=KGe(v);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};h.write("const input = payload.value;");let A=Object.create(null),y=0;for(let v of g.keys)A[v]=`key_${y++}`;h.write("const newResult = {};");for(let v of g.keys){let C=A[v],x=KGe(v),R=p[v]?._zod?.optout==="optional";h.write(`const ${C} = ${b(v)};`),R?h.write(`
|
|
@@ -1022,7 +1022,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
1022
1022
|
`;break;case"id":u=A.includes("\0")?void 0:A;break;case"retry":/^\d+$/.test(A)?n(parseInt(A,10)):r(new Hze(`Invalid \`retry\` value: "${A}"`,{type:"invalid-retry",value:A,line:y}));break;default:r(new Hze(`Unknown field "${b.length>20?`${b.slice(0,20)}\u2026`:b}"`,{type:"unknown-field",field:b,value:A,line:y}));break}}function h(){c.length>0&&e({id:u,event:m||void 0,data:c.endsWith(`
|
|
1023
1023
|
`)?c.slice(0,-1):c}),u=void 0,c="",m=""}function g(b={}){s&&b.consume&&f(s),a=!0,u=void 0,c="",m="",s=""}return{feed:d,reset:g}}function k3s(t){let e=[],r="",n=0;for(;n<t.length;){let o=t.indexOf("\r",n),s=t.indexOf(`
|
|
1024
1024
|
`,n),a=-1;if(o!==-1&&s!==-1?a=Math.min(o,s):o!==-1?o===t.length-1?a=-1:a=o:s!==-1&&(a=s),a===-1){r=t.slice(n);break}else{let u=t.slice(n,a);e.push(u),n=a+1,t[n-1]==="\r"&&t[n]===`
|
|
1025
|
-
`&&n++}}return[e,r]}var Hze,HUt=j(()=>{Hze=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 O3s(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function VUt(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(VUt).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${VUt(t.cause)}`:t.message:`${t}`}function Abn(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function N3s(){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 zze,_bn,e$t,ru,Sp,td,tk,_8,PH,koe,Wze,Yze,u8e,Poe,c8e,dM,Ooe,Boe,Noe,s8e,TC,WUt,zUt,YUt,ybn,KUt,JUt,a8e,XUt,ZUt,BH,Ebn=j(()=>{HUt();zze=class extends Event{constructor(e,r){var n,o;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(o=r?.message)!=null?o:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(Abn(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(Abn(this),r)}};_bn=t=>{throw TypeError(t)},e$t=(t,e,r)=>e.has(t)||_bn("Cannot "+r),ru=(t,e,r)=>(e$t(t,e,"read from private field"),r?r.call(t):e.get(t)),Sp=(t,e,r)=>e.has(t)?_bn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),td=(t,e,r,n)=>(e$t(t,e,"write to private field"),e.set(t,r),r),tk=(t,e,r)=>(e$t(t,e,"access private method"),r),BH=class extends EventTarget{constructor(e,r){var n,o;super(),Sp(this,TC),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Sp(this,_8),Sp(this,PH),Sp(this,koe),Sp(this,Wze),Sp(this,Yze),Sp(this,u8e),Sp(this,Poe),Sp(this,c8e,null),Sp(this,dM),Sp(this,Ooe),Sp(this,Boe,null),Sp(this,Noe,null),Sp(this,s8e,null),Sp(this,zUt,async s=>{var a;ru(this,Ooe).reset();let{body:u,redirected:c,status:m,headers:d}=s;if(m===204){tk(this,TC,a8e).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?td(this,koe,new URL(s.url)):td(this,koe,void 0),m!==200){tk(this,TC,a8e).call(this,`Non-200 status code (${m})`,m);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){tk(this,TC,a8e).call(this,'Invalid content type, expected "text/event-stream"',m);return}if(ru(this,_8)===this.CLOSED)return;td(this,_8,this.OPEN);let f=new Event("open");if((a=ru(this,s8e))==null||a.call(this,f),this.dispatchEvent(f),typeof u!="object"||!u||!("getReader"in u)){tk(this,TC,a8e).call(this,"Invalid response body, expected a web ReadableStream",m),this.close();return}let p=new TextDecoder,h=u.getReader(),g=!0;do{let{done:b,value:A}=await h.read();A&&ru(this,Ooe).feed(p.decode(A,{stream:!b})),b&&(g=!1,ru(this,Ooe).reset(),tk(this,TC,XUt).call(this))}while(g)}),Sp(this,YUt,s=>{td(this,dM,void 0),!(s.name==="AbortError"||s.type==="aborted")&&tk(this,TC,XUt).call(this,VUt(s))}),Sp(this,KUt,s=>{typeof s.id=="string"&&td(this,c8e,s.id);let a=new MessageEvent(s.event||"message",{data:s.data,origin:ru(this,koe)?ru(this,koe).origin:ru(this,PH).origin,lastEventId:s.id||""});ru(this,Noe)&&(!s.event||s.event==="message")&&ru(this,Noe).call(this,a),this.dispatchEvent(a)}),Sp(this,JUt,s=>{td(this,u8e,s)}),Sp(this,ZUt,()=>{td(this,Poe,void 0),ru(this,_8)===this.CONNECTING&&tk(this,TC,WUt).call(this)});try{if(e instanceof URL)td(this,PH,e);else if(typeof e=="string")td(this,PH,new URL(e,N3s()));else throw new Error("Invalid URL")}catch{throw O3s("An invalid or illegal string was specified")}td(this,Ooe,Vze({onEvent:ru(this,KUt),onRetry:ru(this,JUt)})),td(this,_8,this.CONNECTING),td(this,u8e,3e3),td(this,Yze,(n=r?.fetch)!=null?n:globalThis.fetch),td(this,Wze,(o=r?.withCredentials)!=null?o:!1),tk(this,TC,WUt).call(this)}get readyState(){return ru(this,_8)}get url(){return ru(this,PH).href}get withCredentials(){return ru(this,Wze)}get onerror(){return ru(this,Boe)}set onerror(e){td(this,Boe,e)}get onmessage(){return ru(this,Noe)}set onmessage(e){td(this,Noe,e)}get onopen(){return ru(this,s8e)}set onopen(e){td(this,s8e,e)}addEventListener(e,r,n){let o=r;super.addEventListener(e,o,n)}removeEventListener(e,r,n){let o=r;super.removeEventListener(e,o,n)}close(){ru(this,Poe)&&clearTimeout(ru(this,Poe)),ru(this,_8)!==this.CLOSED&&(ru(this,dM)&&ru(this,dM).abort(),td(this,_8,this.CLOSED),td(this,dM,void 0))}};_8=new WeakMap,PH=new WeakMap,koe=new WeakMap,Wze=new WeakMap,Yze=new WeakMap,u8e=new WeakMap,Poe=new WeakMap,c8e=new WeakMap,dM=new WeakMap,Ooe=new WeakMap,Boe=new WeakMap,Noe=new WeakMap,s8e=new WeakMap,TC=new WeakSet,WUt=function(){td(this,_8,this.CONNECTING),td(this,dM,new AbortController),ru(this,Yze)(ru(this,PH),tk(this,TC,ybn).call(this)).then(ru(this,zUt)).catch(ru(this,YUt))},zUt=new WeakMap,YUt=new WeakMap,ybn=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...ru(this,c8e)?{"Last-Event-ID":ru(this,c8e)}:void 0},cache:"no-store",signal:(t=ru(this,dM))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},KUt=new WeakMap,JUt=new WeakMap,a8e=function(t,e){var r;ru(this,_8)!==this.CLOSED&&td(this,_8,this.CLOSED);let n=new zze("error",{code:e,message:t});(r=ru(this,Boe))==null||r.call(this,n),this.dispatchEvent(n)},XUt=function(t,e){var r;if(ru(this,_8)===this.CLOSED)return;td(this,_8,this.CONNECTING);let n=new zze("error",{code:e,message:t});(r=ru(this,Boe))==null||r.call(this,n),this.dispatchEvent(n),td(this,Poe,setTimeout(ru(this,ZUt),ru(this,u8e)))},ZUt=new WeakMap,BH.CONNECTING=0,BH.OPEN=1,BH.CLOSED=2});function Loe(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function Kze(t=fetch,e){return e?async(r,n)=>{let o={...e,...n,headers:n?.headers?{...Loe(e.headers),...Loe(n.headers)}:e.headers};return t(r,o)}:t}var t$t=j(()=>{});async function P3s(t){return(await r$t).getRandomValues(new Uint8Array(t))}async function B3s(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%e.length,n="";for(;n.length<t;){let o=await P3s(t-n.length);for(let s of o)s<r&&(n+=e[s%e.length])}return n}async function L3s(t){return await B3s(t)}async function M3s(t){let e=await(await r$t).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function n$t(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await L3s(t),r=await M3s(e);return{code_verifier:e,code_challenge:r}}var r$t,vbn=j(()=>{r$t=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var ug,Sbn,i$t,F3s,wbn,xbn,Tbn,Cbn,U3s,$3s,Dbn,Sec,wec,o$t=j(()=>{dBt();ug=PVe().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:lBt.custom,message:"URL must be parseable",fatal:!0}),fie}).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"}),Sbn=$1({resource:xt().url(),authorization_servers:yn(ug).optional(),jwks_uri:xt().url().optional(),scopes_supported:yn(xt()).optional(),bearer_methods_supported:yn(xt()).optional(),resource_signing_alg_values_supported:yn(xt()).optional(),resource_name:xt().optional(),resource_documentation:xt().optional(),resource_policy_uri:xt().url().optional(),resource_tos_uri:xt().url().optional(),tls_client_certificate_bound_access_tokens:Xc().optional(),authorization_details_types_supported:yn(xt()).optional(),dpop_signing_alg_values_supported:yn(xt()).optional(),dpop_bound_access_tokens_required:Xc().optional()}),i$t=$1({issuer:xt(),authorization_endpoint:ug,token_endpoint:ug,registration_endpoint:ug.optional(),scopes_supported:yn(xt()).optional(),response_types_supported:yn(xt()),response_modes_supported:yn(xt()).optional(),grant_types_supported:yn(xt()).optional(),token_endpoint_auth_methods_supported:yn(xt()).optional(),token_endpoint_auth_signing_alg_values_supported:yn(xt()).optional(),service_documentation:ug.optional(),revocation_endpoint:ug.optional(),revocation_endpoint_auth_methods_supported:yn(xt()).optional(),revocation_endpoint_auth_signing_alg_values_supported:yn(xt()).optional(),introspection_endpoint:xt().optional(),introspection_endpoint_auth_methods_supported:yn(xt()).optional(),introspection_endpoint_auth_signing_alg_values_supported:yn(xt()).optional(),code_challenge_methods_supported:yn(xt()).optional(),client_id_metadata_document_supported:Xc().optional()}),F3s=$1({issuer:xt(),authorization_endpoint:ug,token_endpoint:ug,userinfo_endpoint:ug.optional(),jwks_uri:ug,registration_endpoint:ug.optional(),scopes_supported:yn(xt()).optional(),response_types_supported:yn(xt()),response_modes_supported:yn(xt()).optional(),grant_types_supported:yn(xt()).optional(),acr_values_supported:yn(xt()).optional(),subject_types_supported:yn(xt()),id_token_signing_alg_values_supported:yn(xt()),id_token_encryption_alg_values_supported:yn(xt()).optional(),id_token_encryption_enc_values_supported:yn(xt()).optional(),userinfo_signing_alg_values_supported:yn(xt()).optional(),userinfo_encryption_alg_values_supported:yn(xt()).optional(),userinfo_encryption_enc_values_supported:yn(xt()).optional(),request_object_signing_alg_values_supported:yn(xt()).optional(),request_object_encryption_alg_values_supported:yn(xt()).optional(),request_object_encryption_enc_values_supported:yn(xt()).optional(),token_endpoint_auth_methods_supported:yn(xt()).optional(),token_endpoint_auth_signing_alg_values_supported:yn(xt()).optional(),display_values_supported:yn(xt()).optional(),claim_types_supported:yn(xt()).optional(),claims_supported:yn(xt()).optional(),service_documentation:xt().optional(),claims_locales_supported:yn(xt()).optional(),ui_locales_supported:yn(xt()).optional(),claims_parameter_supported:Xc().optional(),request_parameter_supported:Xc().optional(),request_uri_parameter_supported:Xc().optional(),require_request_uri_registration:Xc().optional(),op_policy_uri:ug.optional(),op_tos_uri:ug.optional(),client_id_metadata_document_supported:Xc().optional()}),wbn=Dn({...F3s.shape,...i$t.pick({code_challenge_methods_supported:!0}).shape}),xbn=Dn({access_token:xt(),id_token:xt().optional(),token_type:xt(),expires_in:H2e.number().optional(),scope:xt().optional(),refresh_token:xt().optional()}).strip(),Tbn=Dn({error:xt(),error_description:xt().optional(),error_uri:xt().optional()}),Cbn=ug.optional().or(Bi("").transform(()=>{})),U3s=Dn({redirect_uris:yn(ug),token_endpoint_auth_method:xt().optional(),grant_types:yn(xt()).optional(),response_types:yn(xt()).optional(),client_name:xt().optional(),client_uri:ug.optional(),logo_uri:Cbn,scope:xt().optional(),contacts:yn(xt()).optional(),tos_uri:Cbn,policy_uri:xt().optional(),jwks_uri:ug.optional(),jwks:JVe().optional(),software_id:xt().optional(),software_version:xt().optional(),software_statement:xt().optional()}).strip(),$3s=Dn({client_id:xt(),client_secret:xt().optional(),client_id_issued_at:_u().optional(),client_secret_expires_at:_u().optional()}).strip(),Dbn=U3s.merge($3s),Sec=Dn({error:xt(),error_description:xt().optional()}).strip(),wec=Dn({token:xt(),token_type_hint:xt().optional()}).strip()});function Ibn(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function Rbn({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 o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}var kbn=j(()=>{});var G1,l8e,LH,MH,FH,m8e,d8e,f8e,rk,p8e,h8e,g8e,b8e,A8e,y8e,UH,_8e,E8e,Obn,Nbn=j(()=>{G1=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}},l8e=class extends G1{};l8e.errorCode="invalid_request";LH=class extends G1{};LH.errorCode="invalid_client";MH=class extends G1{};MH.errorCode="invalid_grant";FH=class extends G1{};FH.errorCode="unauthorized_client";m8e=class extends G1{};m8e.errorCode="unsupported_grant_type";d8e=class extends G1{};d8e.errorCode="invalid_scope";f8e=class extends G1{};f8e.errorCode="access_denied";rk=class extends G1{};rk.errorCode="server_error";p8e=class extends G1{};p8e.errorCode="temporarily_unavailable";h8e=class extends G1{};h8e.errorCode="unsupported_response_type";g8e=class extends G1{};g8e.errorCode="unsupported_token_type";b8e=class extends G1{};b8e.errorCode="invalid_token";A8e=class extends G1{};A8e.errorCode="method_not_allowed";y8e=class extends G1{};y8e.errorCode="too_many_requests";UH=class extends G1{};UH.errorCode="invalid_client_metadata";_8e=class extends G1{};_8e.errorCode="insufficient_scope";E8e=class extends G1{};E8e.errorCode="invalid_target";Obn={[l8e.errorCode]:l8e,[LH.errorCode]:LH,[MH.errorCode]:MH,[FH.errorCode]:FH,[m8e.errorCode]:m8e,[d8e.errorCode]:d8e,[f8e.errorCode]:f8e,[rk.errorCode]:rk,[p8e.errorCode]:p8e,[h8e.errorCode]:h8e,[g8e.errorCode]:g8e,[b8e.errorCode]:b8e,[A8e.errorCode]:A8e,[y8e.errorCode]:y8e,[UH.errorCode]:UH,[_8e.errorCode]:_8e,[E8e.errorCode]:E8e}});function j3s(t){return["client_secret_basic","client_secret_post","none"].includes(t)}function Q3s(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&&j3s(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 G3s(t,e,r,n){let{client_id:o,client_secret:s}=e;switch(t){case"client_secret_basic":q3s(o,s,r);return;case"client_secret_post":H3s(o,s,n);return;case"none":V3s(o,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function q3s(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 H3s(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function V3s(t,e){e.set("client_id",t)}async function Bbn(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=Tbn.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:a}=n,u=Obn[o]||rk;return new u(s||"",a)}catch(n){let o=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new rk(o)}}async function nk(t,e){try{return await u$t(t,e)}catch(r){if(r instanceof LH||r instanceof FH)return await t.invalidateCredentials?.("all"),await u$t(t,e);if(r instanceof MH)return await t.invalidateCredentials?.("tokens"),await u$t(t,e);throw r}}async function u$t(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){let a,u;try{a=await Y3s(e,{resourceMetadataUrl:o},s),a.authorization_servers&&a.authorization_servers.length>0&&(u=a.authorization_servers[0])}catch{}u||(u=new URL("/",e));let c=await z3s(e,t,a),m=await egs(u,{fetchFn:s}),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");let A=m?.client_id_metadata_document_supported===!0,y=t.clientMetadataUrl;if(y&&!W3s(y))throw new UH(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${y}`);if(A&&y)d={client_id:y},await t.saveClientInformation?.(d);else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let v=await ngs(u,{metadata:m,clientMetadata:t.clientMetadata,fetchFn:s});await t.saveClientInformation(v),d=v}}let f=!t.redirectUrl;if(r!==void 0||f){let A=await rgs(t,u,{metadata:m,resource:c,authorizationCode:r,fetchFn:s});return await t.saveTokens(A),"AUTHORIZED"}let p=await t.tokens();if(p?.refresh_token)try{let A=await d$t(u,{metadata:m,clientInformation:d,refreshToken:p.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:s});return await t.saveTokens(A),"AUTHORIZED"}catch(A){if(!(!(A instanceof G1)||A instanceof rk))throw A}let h=t.state?await t.state():void 0,{authorizationUrl:g,codeVerifier:b}=await tgs(u,{metadata:m,clientInformation:d,state:h,redirectUrl:t.redirectUrl,scope:n||a?.scopes_supported?.join(" ")||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(b),await t.redirectToAuthorization(g),"REDIRECT"}function W3s(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function z3s(t,e,r){let n=Ibn(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!Rbn({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 Moe(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=c$t(t,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let a=c$t(t,"scope")||void 0,u=c$t(t,"error")||void 0;return{resourceMetadataUrl:s,scope:a,error:u}}function c$t(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function Y3s(t,e,r=fetch){let n=await X3s(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return Sbn.parse(await n.json())}async function l$t(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?l$t(t,void 0,r):void 0;throw n}}function K3s(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function Pbn(t,e,r=fetch){return await l$t(t,{"MCP-Protocol-Version":e},r)}function J3s(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function X3s(t,e,r,n){let o=new URL(t),s=n?.protocolVersion??Yie,a;if(n?.metadataUrl)a=new URL(n.metadataUrl);else{let c=K3s(e,o.pathname);a=new URL(c,n?.metadataServerUrl??o),a.search=o.search}let u=await Pbn(a,s,r);if(!n?.metadataUrl&&J3s(u,o.pathname)){let c=new URL(`/.well-known/${e}`,o);u=await Pbn(c,s,r)}return u}function Z3s(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 o=e.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,e.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function egs(t,{fetchFn:e=fetch,protocolVersion:r=Yie}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},o=Z3s(t);for(let{url:s,type:a}of o){let u=await l$t(s,n,e);if(u){if(!u.ok){if(await u.body?.cancel(),u.status>=400&&u.status<500)continue;throw new Error(`HTTP ${u.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return a==="oauth"?i$t.parse(await u.json()):wbn.parse(await u.json())}}}async function tgs(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:a}){let u;if(e){if(u=new URL(e.authorization_endpoint),!e.response_types_supported.includes(s$t))throw new Error(`Incompatible auth server: does not support response type ${s$t}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(a$t))throw new Error(`Incompatible auth server: does not support code challenge method ${a$t}`)}else u=new URL("/authorize",t);let c=await n$t(),m=c.code_verifier,d=c.code_challenge;return u.searchParams.set("response_type",s$t),u.searchParams.set("client_id",r.client_id),u.searchParams.set("code_challenge",d),u.searchParams.set("code_challenge_method",a$t),u.searchParams.set("redirect_uri",String(n)),s&&u.searchParams.set("state",s),o&&u.searchParams.set("scope",o),o?.includes("offline_access")&&u.searchParams.append("prompt","consent"),a&&u.searchParams.set("resource",a.href),{authorizationUrl:u,codeVerifier:m}}function Lbn(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function m$t(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:a}){let u=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&r.set("resource",s.href),o)await o(c,r,u,e);else if(n){let d=e?.token_endpoint_auth_methods_supported??[],f=Q3s(n,d);G3s(f,n,c,r)}let m=await(a??fetch)(u,{method:"POST",headers:c,body:r});if(!m.ok)throw await Bbn(m);return xbn.parse(await m.json())}async function Mbn(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:o,redirectUri:s,resource:a,addClientAuthentication:u,fetchFn:c}){let m=Lbn(n,o,s);return m$t(t,{metadata:e,tokenRequestParams:m,clientInformation:r,addClientAuthentication:u,resource:a,fetchFn:c})}async function d$t(t,{metadata:e,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:a}){let u=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),c=await m$t(t,{metadata:e,tokenRequestParams:u,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:a});return{refresh_token:n,...c}}async function rgs(t,e,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let a=t.clientMetadata.scope,u;if(t.prepareTokenRequest&&(u=await t.prepareTokenRequest(a)),!u){if(!o)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let m=await t.codeVerifier();u=Lbn(o,m,t.redirectUrl)}let c=await t.clientInformation();return m$t(e,{metadata:r,tokenRequestParams:u,clientInformation:c??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:s})}async function ngs(t,{metadata:e,clientMetadata:r,fetchFn:n}){let o;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");o=new URL(e.registration_endpoint)}else o=new URL("/register",t);let s=await(n??fetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok)throw await Bbn(s);return Dbn.parse(await s.json())}var b2,s$t,a$t,Jze=j(()=>{vbn();qR();o$t();o$t();kbn();Nbn();b2=class extends Error{constructor(e){super(e??"Unauthorized")}};s$t="code",a$t="S256"});var f$t,Foe,Fbn=j(()=>{Ebn();t$t();qR();Jze();f$t=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},Foe=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,this._fetchWithInit=Kze(r?.fetch,r?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new b2("No auth provider");let e;try{e=await nk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new b2;return await this._startOrAuth()}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=Loe(this._requestInit?.headers);return new Headers({...e,...r})}_startOrAuth(){let e=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((r,n)=>{this._eventSource=new BH(this._url.href,{...this._eventSourceInit,fetch:async(o,s)=>{let a=await this._commonHeaders();a.set("Accept","text/event-stream");let u=await e(o,{...s,headers:a});if(u.status===401&&u.headers.has("www-authenticate")){let{resourceMetadataUrl:c,scope:m}=Moe(u);this._resourceMetadataUrl=c,this._scope=m}return u}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{if(o.code===401&&this._authProvider){this._authThenStart().then(r,n);return}let s=new f$t(o.code,o.message,o);n(s),this.onerror?.(s)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{let s=o;try{if(this._endpoint=new URL(s.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(a){n(a),this.onerror?.(a),this.close();return}r()}),this._eventSource.onmessage=o=>{let s=o,a;try{a=WL.parse(JSON.parse(s.data))}catch(u){this.onerror?.(u);return}this.onmessage?.(a)}})}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 b2("No auth provider");if(await nk(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new b2("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(e){if(!this._endpoint)throw new Error("Not connected");try{let r=await this._commonHeaders();r.set("content-type","application/json");let n={...this._requestInit,method:"POST",headers:r,body:JSON.stringify(e),signal:this._abortController?.signal},o=await(this._fetch??fetch)(this._endpoint,n);if(!o.ok){let s=await o.text().catch(()=>null);if(o.status===401&&this._authProvider){let{resourceMetadataUrl:a,scope:u}=Moe(o);if(this._resourceMetadataUrl=a,this._scope=u,await nk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new b2;return this.send(e)}throw new Error(`Error POSTing to endpoint (HTTP ${o.status}): ${s}`)}await o.body?.cancel()}catch(r){throw this.onerror?.(r),r}}setProtocolVersion(e){this._protocolVersion=e}}});var Xze,Ubn=j(()=>{HUt();Xze=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let o;super({start(s){o=Vze({onEvent:a=>{s.enqueue(a)},onError(a){e==="terminate"?s.error(a):typeof e=="function"&&e(a)},onRetry:r,onComment:n})},transform(s){o.feed(s)}})}}});var igs,fM,pM,p$t=j(()=>{t$t();qR();Jze();Ubn();igs={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},fM=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},pM=class{constructor(e,r){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._fetchWithInit=Kze(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??igs}async _authThenStart(){if(!this._authProvider)throw new b2("No auth provider");let e;try{e=await nk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new b2;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=Loe(this._requestInit?.headers);return new Headers({...e,...r})}async _startOrAuthSse(e){let{resumptionToken:r}=e;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let o=await(this._fetch??fetch)(this._url,{method:"GET",headers:n,signal:this._abortController?.signal});if(!o.ok){if(await o.body?.cancel(),o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new fM(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),o)}_scheduleReconnection(e,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{this.onerror?.(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:o,replayMessageId:s}=r,a,u=!1,c=!1;(async()=>{try{let d=e.pipeThrough(new TextDecoderStream).pipeThrough(new Xze({onRetry:h=>{this._serverRetryMs=h}})).getReader();for(;;){let{value:h,done:g}=await d.read();if(g)break;if(h.id&&(a=h.id,u=!0,o?.(h.id)),!!h.data&&(!h.event||h.event==="message"))try{let b=WL.parse(JSON.parse(h.data));lH(b)&&(c=!0,s!==void 0&&(b.id=s)),this.onmessage?.(b)}catch(b){this.onerror?.(b)}}(n||u)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:s},0)}catch(d){if(this.onerror?.(new Error(`SSE stream disconnected: ${d}`)),(n||u)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:s},0)}catch(h){this.onerror?.(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 b2("No auth provider");if(await nk(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new b2("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,r){try{let{resumptionToken:n,onresumptiontoken:o}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:z2e(e)?e.id:void 0}).catch(p=>this.onerror?.(p));return}let s=await this._commonHeaders();s.set("content-type","application/json"),s.set("accept","application/json, text/event-stream");let a={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(e),signal:this._abortController?.signal},u=await(this._fetch??fetch)(this._url,a),c=u.headers.get("mcp-session-id");if(c&&(this._sessionId=c),!u.ok){let p=await u.text().catch(()=>null);if(u.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new fM(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:h,scope:g}=Moe(u);if(this._resourceMetadataUrl=h,this._scope=g,await nk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new b2;return this._hasCompletedAuthFlow=!0,this.send(e)}if(u.status===403&&this._authProvider){let{resourceMetadataUrl:h,scope:g,error:b}=Moe(u);if(b==="insufficient_scope"){let A=u.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===A)throw new fM(403,"Server returned 403 after trying upscoping");if(g&&(this._scope=g),h&&(this._resourceMetadataUrl=h),this._lastUpscopingHeader=A??void 0,await nk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new b2;return this.send(e)}}throw new fM(u.status,`Error POSTing to endpoint: ${p}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,u.status===202){await u.body?.cancel(),o1n(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(p=>this.onerror?.(p));return}let d=(Array.isArray(e)?e:[e]).filter(p=>"method"in p&&"id"in p&&p.id!==void 0).length>0,f=u.headers.get("content-type");if(d)if(f?.includes("text/event-stream"))this._handleSseStream(u.body,{onresumptiontoken:o},!1);else if(f?.includes("application/json")){let p=await u.json(),h=Array.isArray(p)?p.map(g=>WL.parse(g)):[WL.parse(p)];for(let g of h)this.onmessage?.(g)}else throw await u.body?.cancel(),new fM(-1,`Unexpected content type: ${f}`);else await u.body?.cancel()}catch(n){throw this.onerror?.(n),n}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new fM(n.status,`Failed to terminate session: ${n.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}}});import{readFile as ogs}from"node:fs/promises";var v8e,C8e,$H,h$t=j(()=>{"use strict";nhe();Jze();Ai();(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"})(v8e||(v8e={}));C8e=class extends Error{code;constructor(e,r){super(r),this.code=e}},$H=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||QQ.default}async start(){if(this._isClosed)throw new Error(I.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let o=await this._authProvider.tokens();o?.access_token&&(e=o.access_token)}catch(o){try{let s=await this._authProvider.clientInformation();if(s){let a=await this._authProvider.tokens();if(a?.refresh_token){let u=await d$t(this._url,{clientInformation:s,refreshToken:a.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(u),u?.access_token&&(e=u.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw s?(await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(I.t("websocketClient.errors.unauthorizedOAuth"))):new Error("Redirect URL is required for authorization")}throw o}}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((o,s)=>{try{let a={headers:r};this._websocket=new this._WebSocket(n.toString(),a),this._websocket.on("open",()=>{o()}),this._websocket.on("error",u=>{let c=u.code!==void 0?u.code:void 0;s(new C8e(c,`WebSocket error: ${u.message}`))}),this._websocket.on("message",async u=>{try{let c=u.toString(),m=JSON.parse(c);if(this._specialIds.has(Number(m.id))||m.type==="welcome")return;this.onmessage?.(await this._transformResponse(m))}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(a){s(new C8e(void 0,`Failed to create WebSocket: ${a}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(I.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl;if(!n)throw new Error("Redirect URL is required for authorization");let o=typeof n=="string"?n:n.toString(),s=await Mbn(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:o,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(s)}else throw new Error(I.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===QQ.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(I.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(I.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==QQ.default.OPEN)throw new Error(I.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 C8e(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:v8e.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.5.8-beta-20260211",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:o}=r||{};return{type:v8e.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{filePath:n,originalText:await ogs(n,"utf8"),modifiedText:o}}}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:v8e.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",o=>{try{let s=JSON.parse(o.toString());Number(s.id)===e&&(this._specialIds.delete(e),s.payload.success?r(s.payload.data.text):n(s.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var jbn=T((Zec,$bn)=>{"use strict";$bn.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 zbn=T((etc,Wbn)=>{"use strict";var Vbn="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",Qbn=new RegExp("^"+Vbn+"$"),Gbn="|&;()<> \\t",sgs='"((\\\\"|[^"])*?)"',ags="'((\\\\'|[^'])*?)'",ugs=/^#$/,qbn="'",Hbn='"',g$t="$",jH="",cgs=4294967296;for(b$t=0;b$t<4;b$t++)jH+=(cgs*Math.random()).toString(16);var b$t,lgs=new RegExp("^"+jH);function mgs(t,e){for(var r=e.lastIndex,n=[],o;o=e.exec(t);)n.push(o),e.lastIndex===o.index&&(e.lastIndex+=1);return e.lastIndex=r,n}function dgs(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+jH+JSON.stringify(n)+jH:e+n}function fgs(t,e,r){r||(r={});var n=r.escape||"\\",o="(\\"+n+`['"`+Gbn+`]|[^\\s'"`+Gbn+"])+",s=new RegExp(["("+Vbn+")","("+o+"|"+sgs+"|"+ags+")+"].join("|"),"g"),a=mgs(t,s);if(a.length===0)return[];e||(e={});var u=!1;return a.map(function(c){var m=c[0];if(!m||u)return;if(Qbn.test(m))return{op:m};var d=!1,f=!1,p="",h=!1,g;function b(){g+=1;var E,v,C=m.charAt(g);if(C==="{"){if(g+=1,m.charAt(g)==="}")throw new Error("Bad substitution: "+m.slice(g-2,g+1));if(E=m.indexOf("}",g),E<0)throw new Error("Bad substitution: "+m.slice(g));v=m.slice(g,E),g=E}else if(/[*@#?$!_-]/.test(C))v=C,g+=1;else{var x=m.slice(g);E=x.match(/[^\w\d_]/),E?(v=x.slice(0,E.index),g+=E.index-1):(v=x,g=m.length)}return dgs(e,"",v)}for(g=0;g<m.length;g++){var A=m.charAt(g);if(h=h||!d&&(A==="*"||A==="?"),f)p+=A,f=!1;else if(d)A===d?d=!1:d==qbn?p+=A:A===n?(g+=1,A=m.charAt(g),A===Hbn||A===n||A===g$t?p+=A:p+=n+A):A===g$t?p+=b():p+=A;else if(A===Hbn||A===qbn)d=A;else{if(Qbn.test(A))return{op:m};if(ugs.test(A)){u=!0;var y={comment:t.slice(c.index+g+1)};return p.length?[p,y]:[y]}else A===n?f=!0:A===g$t?p+=b():p+=A}}return h?{op:"glob",pattern:p}:p}).reduce(function(c,m){return typeof m>"u"?c:c.concat(m)},[])}Wbn.exports=function(e,r,n){var o=fgs(e,r,n);return typeof r!="function"?o:o.reduce(function(s,a){if(typeof a=="object")return s.concat(a);var u=a.split(RegExp("("+jH+".*?"+jH+")","g"));return u.length===1?s.concat(u[0]):s.concat(u.filter(Boolean).map(function(c){return lgs.test(c)?JSON.parse(c.split(jH)[1]):c}))},[])}});var S8e=T(A$t=>{"use strict";A$t.quote=jbn();A$t.parse=zbn()});var Ybn,Zze,Kbn=j(()=>{"use strict";Ybn=Se(hke(),1);Ai();Zze=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(I.t("mcp.auth.scopesRequired"));this.auth=new Ybn.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(I.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as pgs}from"node:child_process";import{promisify as hgs}from"node:util";import{platform as ggs}from"node:os";import{URL as bgs}from"node:url";function Ags(t){let e;try{e=new bgs(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 Xbn(t){Ags(t);let e=ggs(),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 o={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await Jbn(r,n,o)}catch(s){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let a=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let u of a)try{await Jbn(u,[t],o);return}catch{continue}}throw new Error(`Failed to open browser: ${s instanceof Error?s.message:"Unknown error"}`)}}var Jbn,Zbn=j(()=>{"use strict";Jbn=hgs(pgs)});function Ho(t){return t instanceof Error&&"code"in t}function Ar(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function y$t(t){if(t&&typeof t=="object"&&"response"in t){let r=ygs(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new tYe(r.error.message);case 401:return new hM(r.error.message);case 403:return new eYe(r.error.message);default:}}return t}function ygs(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var eYe,hM,tYe,A0=j(()=>{"use strict";eYe=class extends Error{},hM=class extends Error{},tYe=class extends Error{}});import{promises as Uoe}from"node:fs";import*as rYe from"node:path";var q1,nYe=j(()=>{"use strict";A0();Ai();Na();q1=class{static TOKEN_FILE="mcp-oauth-tokens.json";static getTokenFilePath(){return rYe.join(Tn(),this.TOKEN_FILE)}static async ensureConfigDir(){let e=rYe.dirname(this.getTokenFilePath());await Uoe.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await Uoe.readFile(r,"utf-8"),o=JSON.parse(n);for(let s of o)e.set(s.serverName,s)}catch(r){r.code!=="ENOENT"&&console.error(I.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:Ar(r)}))}return e}static async saveToken(e,r,n,o,s){await this.ensureConfigDir();let a=await this.loadTokens(),u={serverName:e,token:r,clientId:n,tokenUrl:o,mcpServerUrl:s,updatedAt:Date.now()};a.set(e,u);let c=Array.from(a.values()),m=this.getTokenFilePath();try{await Uoe.writeFile(m,JSON.stringify(c,null,2),{mode:384})}catch(d){throw console.error(I.t("mcp.tokenStorage.errors.failedToSaveToken",{error:Ar(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()),o=this.getTokenFilePath();try{n.length===0?await Uoe.unlink(o):await Uoe.writeFile(o,JSON.stringify(n,null,2),{mode:384})}catch(s){console.error(I.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:Ar(s)}))}}}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 Uoe.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(I.t("mcp.tokenStorage.errors.failedToClearTokens",{error:Ar(e)}))}}}});var Ph,iYe=j(()=>{"use strict";A0();Ai();Ph=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}: ${Ar(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}: ${Ar(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 s=n.authorization_servers[0],a=new URL("/.well-known/oauth-authorization-server",s).toString(),u=await this.fetchAuthorizationServerMetadata(a);if(u){let c=this.metadataToOAuthConfig(u);return u.registration_endpoint&&console.log(I.t("mcp.oauth.discovery.dynamicRegistrationSupported"),u.registration_endpoint),c}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let o=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(o){let s=this.metadataToOAuthConfig(o);return o.registration_endpoint&&console.log(I.t("mcp.oauth.discovery.dynamicRegistrationSupported"),o.registration_endpoint),s}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${Ar(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(I.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);return a?(console.log(I.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(a)):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){return e}}});import*as eAn from"node:http";import*as w8e from"node:crypto";import{URL as oYe}from"node:url";var A2,_$t=j(()=>{"use strict";Zbn();nYe();A0();iYe();Ai();A2=class{static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r,n){let s={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${n}${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(" ")||""},a=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok){let u=await a.text();throw new Error(I.t("mcp.auth.clientRegistrationFailed",{status:a.status,statusText:a.statusText,error:u}))}return await a.json()}static async discoverOAuthFromMCPServer(e){let r=Ph.extractBaseUrl(e);return Ph.discoverOAuthConfig(r)}static generatePKCEParams(){let e=w8e.randomBytes(32).toString("base64url"),r=w8e.createHash("sha256").update(e).digest("base64url"),n=w8e.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static parseCallbackUrl(e,r){try{let n=new oYe(e),o=n.searchParams.get("code"),s=n.searchParams.get("state"),a=n.searchParams.get("error");if(a){let u=n.searchParams.get("error_description");throw new Error(I.t("mcp.auth.oauthError",{error:`${a}${u?`: ${u}`:""}`}))}if(!o||!s)throw new Error(I.t("mcp.auth.missingCodeOrState"));if(s!==r)throw new Error(I.t("mcp.auth.stateValidationFailed"));return{code:o,state:s}}catch(n){throw n instanceof Error?n:new Error(I.t("mcp.auth.parseCallbackUrlFailed",{error:String(n)}))}}static startCallbackServer(e,r){let n,o=new Promise(u=>{n=u}),s;return{promise:new Promise((u,c)=>{let m=!1,d=null;r&&(d=setInterval(async()=>{try{await r()&&!m&&(m=!0,console.log("[OAuth] Authentication cancelled by user, closing server"),d&&clearInterval(d),s?.close(),c(new Error(I.t("mcp.auth.authenticationCancelled"))))}catch(f){console.log("[OAuth] Error in cancel check:",f)}},500)),s=eAn.createServer(async(f,p)=>{try{if(console.log(`[OAuth] Callback server received request: ${f.method} ${f.url}`),m){console.log("[OAuth] Request ignored - authentication already cancelled");return}let h=new oYe(f.url,"http://localhost");if(h.pathname!==this.REDIRECT_PATH){console.log(`[OAuth] Invalid path: ${h.pathname}, expected: ${this.REDIRECT_PATH}`),p.writeHead(404),p.end(I.t("mcp.ui.notFound"));return}let g=h.searchParams.get("code"),b=h.searchParams.get("state"),A=h.searchParams.get("error");if(console.log(`[OAuth] Callback parameters - code: ${g?"present":"missing"}, state: ${b?"present":"missing"}, error: ${A||"none"}`),A){p.writeHead(this.HTTP_OK,{"Content-Type":"text/html; charset=utf-8"}),p.end(`
|
|
1025
|
+
`&&n++}}return[e,r]}var Hze,HUt=j(()=>{Hze=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 O3s(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function VUt(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(VUt).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${VUt(t.cause)}`:t.message:`${t}`}function Abn(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function N3s(){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 zze,_bn,e$t,ru,Sp,td,tk,_8,PH,koe,Wze,Yze,u8e,Poe,c8e,dM,Ooe,Boe,Noe,s8e,TC,WUt,zUt,YUt,ybn,KUt,JUt,a8e,XUt,ZUt,BH,Ebn=j(()=>{HUt();zze=class extends Event{constructor(e,r){var n,o;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(o=r?.message)!=null?o:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(Abn(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(Abn(this),r)}};_bn=t=>{throw TypeError(t)},e$t=(t,e,r)=>e.has(t)||_bn("Cannot "+r),ru=(t,e,r)=>(e$t(t,e,"read from private field"),r?r.call(t):e.get(t)),Sp=(t,e,r)=>e.has(t)?_bn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),td=(t,e,r,n)=>(e$t(t,e,"write to private field"),e.set(t,r),r),tk=(t,e,r)=>(e$t(t,e,"access private method"),r),BH=class extends EventTarget{constructor(e,r){var n,o;super(),Sp(this,TC),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Sp(this,_8),Sp(this,PH),Sp(this,koe),Sp(this,Wze),Sp(this,Yze),Sp(this,u8e),Sp(this,Poe),Sp(this,c8e,null),Sp(this,dM),Sp(this,Ooe),Sp(this,Boe,null),Sp(this,Noe,null),Sp(this,s8e,null),Sp(this,zUt,async s=>{var a;ru(this,Ooe).reset();let{body:u,redirected:c,status:m,headers:d}=s;if(m===204){tk(this,TC,a8e).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?td(this,koe,new URL(s.url)):td(this,koe,void 0),m!==200){tk(this,TC,a8e).call(this,`Non-200 status code (${m})`,m);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){tk(this,TC,a8e).call(this,'Invalid content type, expected "text/event-stream"',m);return}if(ru(this,_8)===this.CLOSED)return;td(this,_8,this.OPEN);let f=new Event("open");if((a=ru(this,s8e))==null||a.call(this,f),this.dispatchEvent(f),typeof u!="object"||!u||!("getReader"in u)){tk(this,TC,a8e).call(this,"Invalid response body, expected a web ReadableStream",m),this.close();return}let p=new TextDecoder,h=u.getReader(),g=!0;do{let{done:b,value:A}=await h.read();A&&ru(this,Ooe).feed(p.decode(A,{stream:!b})),b&&(g=!1,ru(this,Ooe).reset(),tk(this,TC,XUt).call(this))}while(g)}),Sp(this,YUt,s=>{td(this,dM,void 0),!(s.name==="AbortError"||s.type==="aborted")&&tk(this,TC,XUt).call(this,VUt(s))}),Sp(this,KUt,s=>{typeof s.id=="string"&&td(this,c8e,s.id);let a=new MessageEvent(s.event||"message",{data:s.data,origin:ru(this,koe)?ru(this,koe).origin:ru(this,PH).origin,lastEventId:s.id||""});ru(this,Noe)&&(!s.event||s.event==="message")&&ru(this,Noe).call(this,a),this.dispatchEvent(a)}),Sp(this,JUt,s=>{td(this,u8e,s)}),Sp(this,ZUt,()=>{td(this,Poe,void 0),ru(this,_8)===this.CONNECTING&&tk(this,TC,WUt).call(this)});try{if(e instanceof URL)td(this,PH,e);else if(typeof e=="string")td(this,PH,new URL(e,N3s()));else throw new Error("Invalid URL")}catch{throw O3s("An invalid or illegal string was specified")}td(this,Ooe,Vze({onEvent:ru(this,KUt),onRetry:ru(this,JUt)})),td(this,_8,this.CONNECTING),td(this,u8e,3e3),td(this,Yze,(n=r?.fetch)!=null?n:globalThis.fetch),td(this,Wze,(o=r?.withCredentials)!=null?o:!1),tk(this,TC,WUt).call(this)}get readyState(){return ru(this,_8)}get url(){return ru(this,PH).href}get withCredentials(){return ru(this,Wze)}get onerror(){return ru(this,Boe)}set onerror(e){td(this,Boe,e)}get onmessage(){return ru(this,Noe)}set onmessage(e){td(this,Noe,e)}get onopen(){return ru(this,s8e)}set onopen(e){td(this,s8e,e)}addEventListener(e,r,n){let o=r;super.addEventListener(e,o,n)}removeEventListener(e,r,n){let o=r;super.removeEventListener(e,o,n)}close(){ru(this,Poe)&&clearTimeout(ru(this,Poe)),ru(this,_8)!==this.CLOSED&&(ru(this,dM)&&ru(this,dM).abort(),td(this,_8,this.CLOSED),td(this,dM,void 0))}};_8=new WeakMap,PH=new WeakMap,koe=new WeakMap,Wze=new WeakMap,Yze=new WeakMap,u8e=new WeakMap,Poe=new WeakMap,c8e=new WeakMap,dM=new WeakMap,Ooe=new WeakMap,Boe=new WeakMap,Noe=new WeakMap,s8e=new WeakMap,TC=new WeakSet,WUt=function(){td(this,_8,this.CONNECTING),td(this,dM,new AbortController),ru(this,Yze)(ru(this,PH),tk(this,TC,ybn).call(this)).then(ru(this,zUt)).catch(ru(this,YUt))},zUt=new WeakMap,YUt=new WeakMap,ybn=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...ru(this,c8e)?{"Last-Event-ID":ru(this,c8e)}:void 0},cache:"no-store",signal:(t=ru(this,dM))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},KUt=new WeakMap,JUt=new WeakMap,a8e=function(t,e){var r;ru(this,_8)!==this.CLOSED&&td(this,_8,this.CLOSED);let n=new zze("error",{code:e,message:t});(r=ru(this,Boe))==null||r.call(this,n),this.dispatchEvent(n)},XUt=function(t,e){var r;if(ru(this,_8)===this.CLOSED)return;td(this,_8,this.CONNECTING);let n=new zze("error",{code:e,message:t});(r=ru(this,Boe))==null||r.call(this,n),this.dispatchEvent(n),td(this,Poe,setTimeout(ru(this,ZUt),ru(this,u8e)))},ZUt=new WeakMap,BH.CONNECTING=0,BH.OPEN=1,BH.CLOSED=2});function Loe(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function Kze(t=fetch,e){return e?async(r,n)=>{let o={...e,...n,headers:n?.headers?{...Loe(e.headers),...Loe(n.headers)}:e.headers};return t(r,o)}:t}var t$t=j(()=>{});async function P3s(t){return(await r$t).getRandomValues(new Uint8Array(t))}async function B3s(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%e.length,n="";for(;n.length<t;){let o=await P3s(t-n.length);for(let s of o)s<r&&(n+=e[s%e.length])}return n}async function L3s(t){return await B3s(t)}async function M3s(t){let e=await(await r$t).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function n$t(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await L3s(t),r=await M3s(e);return{code_verifier:e,code_challenge:r}}var r$t,vbn=j(()=>{r$t=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var ug,Sbn,i$t,F3s,wbn,xbn,Tbn,Cbn,U3s,$3s,Dbn,Sec,wec,o$t=j(()=>{dBt();ug=PVe().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:lBt.custom,message:"URL must be parseable",fatal:!0}),fie}).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"}),Sbn=$1({resource:xt().url(),authorization_servers:yn(ug).optional(),jwks_uri:xt().url().optional(),scopes_supported:yn(xt()).optional(),bearer_methods_supported:yn(xt()).optional(),resource_signing_alg_values_supported:yn(xt()).optional(),resource_name:xt().optional(),resource_documentation:xt().optional(),resource_policy_uri:xt().url().optional(),resource_tos_uri:xt().url().optional(),tls_client_certificate_bound_access_tokens:Xc().optional(),authorization_details_types_supported:yn(xt()).optional(),dpop_signing_alg_values_supported:yn(xt()).optional(),dpop_bound_access_tokens_required:Xc().optional()}),i$t=$1({issuer:xt(),authorization_endpoint:ug,token_endpoint:ug,registration_endpoint:ug.optional(),scopes_supported:yn(xt()).optional(),response_types_supported:yn(xt()),response_modes_supported:yn(xt()).optional(),grant_types_supported:yn(xt()).optional(),token_endpoint_auth_methods_supported:yn(xt()).optional(),token_endpoint_auth_signing_alg_values_supported:yn(xt()).optional(),service_documentation:ug.optional(),revocation_endpoint:ug.optional(),revocation_endpoint_auth_methods_supported:yn(xt()).optional(),revocation_endpoint_auth_signing_alg_values_supported:yn(xt()).optional(),introspection_endpoint:xt().optional(),introspection_endpoint_auth_methods_supported:yn(xt()).optional(),introspection_endpoint_auth_signing_alg_values_supported:yn(xt()).optional(),code_challenge_methods_supported:yn(xt()).optional(),client_id_metadata_document_supported:Xc().optional()}),F3s=$1({issuer:xt(),authorization_endpoint:ug,token_endpoint:ug,userinfo_endpoint:ug.optional(),jwks_uri:ug,registration_endpoint:ug.optional(),scopes_supported:yn(xt()).optional(),response_types_supported:yn(xt()),response_modes_supported:yn(xt()).optional(),grant_types_supported:yn(xt()).optional(),acr_values_supported:yn(xt()).optional(),subject_types_supported:yn(xt()),id_token_signing_alg_values_supported:yn(xt()),id_token_encryption_alg_values_supported:yn(xt()).optional(),id_token_encryption_enc_values_supported:yn(xt()).optional(),userinfo_signing_alg_values_supported:yn(xt()).optional(),userinfo_encryption_alg_values_supported:yn(xt()).optional(),userinfo_encryption_enc_values_supported:yn(xt()).optional(),request_object_signing_alg_values_supported:yn(xt()).optional(),request_object_encryption_alg_values_supported:yn(xt()).optional(),request_object_encryption_enc_values_supported:yn(xt()).optional(),token_endpoint_auth_methods_supported:yn(xt()).optional(),token_endpoint_auth_signing_alg_values_supported:yn(xt()).optional(),display_values_supported:yn(xt()).optional(),claim_types_supported:yn(xt()).optional(),claims_supported:yn(xt()).optional(),service_documentation:xt().optional(),claims_locales_supported:yn(xt()).optional(),ui_locales_supported:yn(xt()).optional(),claims_parameter_supported:Xc().optional(),request_parameter_supported:Xc().optional(),request_uri_parameter_supported:Xc().optional(),require_request_uri_registration:Xc().optional(),op_policy_uri:ug.optional(),op_tos_uri:ug.optional(),client_id_metadata_document_supported:Xc().optional()}),wbn=Dn({...F3s.shape,...i$t.pick({code_challenge_methods_supported:!0}).shape}),xbn=Dn({access_token:xt(),id_token:xt().optional(),token_type:xt(),expires_in:H2e.number().optional(),scope:xt().optional(),refresh_token:xt().optional()}).strip(),Tbn=Dn({error:xt(),error_description:xt().optional(),error_uri:xt().optional()}),Cbn=ug.optional().or(Bi("").transform(()=>{})),U3s=Dn({redirect_uris:yn(ug),token_endpoint_auth_method:xt().optional(),grant_types:yn(xt()).optional(),response_types:yn(xt()).optional(),client_name:xt().optional(),client_uri:ug.optional(),logo_uri:Cbn,scope:xt().optional(),contacts:yn(xt()).optional(),tos_uri:Cbn,policy_uri:xt().optional(),jwks_uri:ug.optional(),jwks:JVe().optional(),software_id:xt().optional(),software_version:xt().optional(),software_statement:xt().optional()}).strip(),$3s=Dn({client_id:xt(),client_secret:xt().optional(),client_id_issued_at:_u().optional(),client_secret_expires_at:_u().optional()}).strip(),Dbn=U3s.merge($3s),Sec=Dn({error:xt(),error_description:xt().optional()}).strip(),wec=Dn({token:xt(),token_type_hint:xt().optional()}).strip()});function Ibn(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function Rbn({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 o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}var kbn=j(()=>{});var G1,l8e,LH,MH,FH,m8e,d8e,f8e,rk,p8e,h8e,g8e,b8e,A8e,y8e,UH,_8e,E8e,Obn,Nbn=j(()=>{G1=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}},l8e=class extends G1{};l8e.errorCode="invalid_request";LH=class extends G1{};LH.errorCode="invalid_client";MH=class extends G1{};MH.errorCode="invalid_grant";FH=class extends G1{};FH.errorCode="unauthorized_client";m8e=class extends G1{};m8e.errorCode="unsupported_grant_type";d8e=class extends G1{};d8e.errorCode="invalid_scope";f8e=class extends G1{};f8e.errorCode="access_denied";rk=class extends G1{};rk.errorCode="server_error";p8e=class extends G1{};p8e.errorCode="temporarily_unavailable";h8e=class extends G1{};h8e.errorCode="unsupported_response_type";g8e=class extends G1{};g8e.errorCode="unsupported_token_type";b8e=class extends G1{};b8e.errorCode="invalid_token";A8e=class extends G1{};A8e.errorCode="method_not_allowed";y8e=class extends G1{};y8e.errorCode="too_many_requests";UH=class extends G1{};UH.errorCode="invalid_client_metadata";_8e=class extends G1{};_8e.errorCode="insufficient_scope";E8e=class extends G1{};E8e.errorCode="invalid_target";Obn={[l8e.errorCode]:l8e,[LH.errorCode]:LH,[MH.errorCode]:MH,[FH.errorCode]:FH,[m8e.errorCode]:m8e,[d8e.errorCode]:d8e,[f8e.errorCode]:f8e,[rk.errorCode]:rk,[p8e.errorCode]:p8e,[h8e.errorCode]:h8e,[g8e.errorCode]:g8e,[b8e.errorCode]:b8e,[A8e.errorCode]:A8e,[y8e.errorCode]:y8e,[UH.errorCode]:UH,[_8e.errorCode]:_8e,[E8e.errorCode]:E8e}});function j3s(t){return["client_secret_basic","client_secret_post","none"].includes(t)}function Q3s(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&&j3s(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 G3s(t,e,r,n){let{client_id:o,client_secret:s}=e;switch(t){case"client_secret_basic":q3s(o,s,r);return;case"client_secret_post":H3s(o,s,n);return;case"none":V3s(o,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function q3s(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 H3s(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function V3s(t,e){e.set("client_id",t)}async function Bbn(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=Tbn.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:a}=n,u=Obn[o]||rk;return new u(s||"",a)}catch(n){let o=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new rk(o)}}async function nk(t,e){try{return await u$t(t,e)}catch(r){if(r instanceof LH||r instanceof FH)return await t.invalidateCredentials?.("all"),await u$t(t,e);if(r instanceof MH)return await t.invalidateCredentials?.("tokens"),await u$t(t,e);throw r}}async function u$t(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){let a,u;try{a=await Y3s(e,{resourceMetadataUrl:o},s),a.authorization_servers&&a.authorization_servers.length>0&&(u=a.authorization_servers[0])}catch{}u||(u=new URL("/",e));let c=await z3s(e,t,a),m=await egs(u,{fetchFn:s}),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");let A=m?.client_id_metadata_document_supported===!0,y=t.clientMetadataUrl;if(y&&!W3s(y))throw new UH(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${y}`);if(A&&y)d={client_id:y},await t.saveClientInformation?.(d);else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let v=await ngs(u,{metadata:m,clientMetadata:t.clientMetadata,fetchFn:s});await t.saveClientInformation(v),d=v}}let f=!t.redirectUrl;if(r!==void 0||f){let A=await rgs(t,u,{metadata:m,resource:c,authorizationCode:r,fetchFn:s});return await t.saveTokens(A),"AUTHORIZED"}let p=await t.tokens();if(p?.refresh_token)try{let A=await d$t(u,{metadata:m,clientInformation:d,refreshToken:p.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:s});return await t.saveTokens(A),"AUTHORIZED"}catch(A){if(!(!(A instanceof G1)||A instanceof rk))throw A}let h=t.state?await t.state():void 0,{authorizationUrl:g,codeVerifier:b}=await tgs(u,{metadata:m,clientInformation:d,state:h,redirectUrl:t.redirectUrl,scope:n||a?.scopes_supported?.join(" ")||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(b),await t.redirectToAuthorization(g),"REDIRECT"}function W3s(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function z3s(t,e,r){let n=Ibn(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!Rbn({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 Moe(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=c$t(t,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let a=c$t(t,"scope")||void 0,u=c$t(t,"error")||void 0;return{resourceMetadataUrl:s,scope:a,error:u}}function c$t(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function Y3s(t,e,r=fetch){let n=await X3s(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return Sbn.parse(await n.json())}async function l$t(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?l$t(t,void 0,r):void 0;throw n}}function K3s(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function Pbn(t,e,r=fetch){return await l$t(t,{"MCP-Protocol-Version":e},r)}function J3s(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function X3s(t,e,r,n){let o=new URL(t),s=n?.protocolVersion??Yie,a;if(n?.metadataUrl)a=new URL(n.metadataUrl);else{let c=K3s(e,o.pathname);a=new URL(c,n?.metadataServerUrl??o),a.search=o.search}let u=await Pbn(a,s,r);if(!n?.metadataUrl&&J3s(u,o.pathname)){let c=new URL(`/.well-known/${e}`,o);u=await Pbn(c,s,r)}return u}function Z3s(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 o=e.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,e.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function egs(t,{fetchFn:e=fetch,protocolVersion:r=Yie}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},o=Z3s(t);for(let{url:s,type:a}of o){let u=await l$t(s,n,e);if(u){if(!u.ok){if(await u.body?.cancel(),u.status>=400&&u.status<500)continue;throw new Error(`HTTP ${u.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return a==="oauth"?i$t.parse(await u.json()):wbn.parse(await u.json())}}}async function tgs(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:a}){let u;if(e){if(u=new URL(e.authorization_endpoint),!e.response_types_supported.includes(s$t))throw new Error(`Incompatible auth server: does not support response type ${s$t}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(a$t))throw new Error(`Incompatible auth server: does not support code challenge method ${a$t}`)}else u=new URL("/authorize",t);let c=await n$t(),m=c.code_verifier,d=c.code_challenge;return u.searchParams.set("response_type",s$t),u.searchParams.set("client_id",r.client_id),u.searchParams.set("code_challenge",d),u.searchParams.set("code_challenge_method",a$t),u.searchParams.set("redirect_uri",String(n)),s&&u.searchParams.set("state",s),o&&u.searchParams.set("scope",o),o?.includes("offline_access")&&u.searchParams.append("prompt","consent"),a&&u.searchParams.set("resource",a.href),{authorizationUrl:u,codeVerifier:m}}function Lbn(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function m$t(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:a}){let u=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&r.set("resource",s.href),o)await o(c,r,u,e);else if(n){let d=e?.token_endpoint_auth_methods_supported??[],f=Q3s(n,d);G3s(f,n,c,r)}let m=await(a??fetch)(u,{method:"POST",headers:c,body:r});if(!m.ok)throw await Bbn(m);return xbn.parse(await m.json())}async function Mbn(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:o,redirectUri:s,resource:a,addClientAuthentication:u,fetchFn:c}){let m=Lbn(n,o,s);return m$t(t,{metadata:e,tokenRequestParams:m,clientInformation:r,addClientAuthentication:u,resource:a,fetchFn:c})}async function d$t(t,{metadata:e,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:a}){let u=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),c=await m$t(t,{metadata:e,tokenRequestParams:u,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:a});return{refresh_token:n,...c}}async function rgs(t,e,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let a=t.clientMetadata.scope,u;if(t.prepareTokenRequest&&(u=await t.prepareTokenRequest(a)),!u){if(!o)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let m=await t.codeVerifier();u=Lbn(o,m,t.redirectUrl)}let c=await t.clientInformation();return m$t(e,{metadata:r,tokenRequestParams:u,clientInformation:c??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:s})}async function ngs(t,{metadata:e,clientMetadata:r,fetchFn:n}){let o;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");o=new URL(e.registration_endpoint)}else o=new URL("/register",t);let s=await(n??fetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok)throw await Bbn(s);return Dbn.parse(await s.json())}var b2,s$t,a$t,Jze=j(()=>{vbn();qR();o$t();o$t();kbn();Nbn();b2=class extends Error{constructor(e){super(e??"Unauthorized")}};s$t="code",a$t="S256"});var f$t,Foe,Fbn=j(()=>{Ebn();t$t();qR();Jze();f$t=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},Foe=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,this._fetchWithInit=Kze(r?.fetch,r?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new b2("No auth provider");let e;try{e=await nk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new b2;return await this._startOrAuth()}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=Loe(this._requestInit?.headers);return new Headers({...e,...r})}_startOrAuth(){let e=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((r,n)=>{this._eventSource=new BH(this._url.href,{...this._eventSourceInit,fetch:async(o,s)=>{let a=await this._commonHeaders();a.set("Accept","text/event-stream");let u=await e(o,{...s,headers:a});if(u.status===401&&u.headers.has("www-authenticate")){let{resourceMetadataUrl:c,scope:m}=Moe(u);this._resourceMetadataUrl=c,this._scope=m}return u}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{if(o.code===401&&this._authProvider){this._authThenStart().then(r,n);return}let s=new f$t(o.code,o.message,o);n(s),this.onerror?.(s)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{let s=o;try{if(this._endpoint=new URL(s.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(a){n(a),this.onerror?.(a),this.close();return}r()}),this._eventSource.onmessage=o=>{let s=o,a;try{a=WL.parse(JSON.parse(s.data))}catch(u){this.onerror?.(u);return}this.onmessage?.(a)}})}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 b2("No auth provider");if(await nk(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new b2("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(e){if(!this._endpoint)throw new Error("Not connected");try{let r=await this._commonHeaders();r.set("content-type","application/json");let n={...this._requestInit,method:"POST",headers:r,body:JSON.stringify(e),signal:this._abortController?.signal},o=await(this._fetch??fetch)(this._endpoint,n);if(!o.ok){let s=await o.text().catch(()=>null);if(o.status===401&&this._authProvider){let{resourceMetadataUrl:a,scope:u}=Moe(o);if(this._resourceMetadataUrl=a,this._scope=u,await nk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new b2;return this.send(e)}throw new Error(`Error POSTing to endpoint (HTTP ${o.status}): ${s}`)}await o.body?.cancel()}catch(r){throw this.onerror?.(r),r}}setProtocolVersion(e){this._protocolVersion=e}}});var Xze,Ubn=j(()=>{HUt();Xze=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let o;super({start(s){o=Vze({onEvent:a=>{s.enqueue(a)},onError(a){e==="terminate"?s.error(a):typeof e=="function"&&e(a)},onRetry:r,onComment:n})},transform(s){o.feed(s)}})}}});var igs,fM,pM,p$t=j(()=>{t$t();qR();Jze();Ubn();igs={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},fM=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},pM=class{constructor(e,r){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._fetchWithInit=Kze(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??igs}async _authThenStart(){if(!this._authProvider)throw new b2("No auth provider");let e;try{e=await nk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new b2;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=Loe(this._requestInit?.headers);return new Headers({...e,...r})}async _startOrAuthSse(e){let{resumptionToken:r}=e;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let o=await(this._fetch??fetch)(this._url,{method:"GET",headers:n,signal:this._abortController?.signal});if(!o.ok){if(await o.body?.cancel(),o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new fM(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),o)}_scheduleReconnection(e,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{this.onerror?.(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:o,replayMessageId:s}=r,a,u=!1,c=!1;(async()=>{try{let d=e.pipeThrough(new TextDecoderStream).pipeThrough(new Xze({onRetry:h=>{this._serverRetryMs=h}})).getReader();for(;;){let{value:h,done:g}=await d.read();if(g)break;if(h.id&&(a=h.id,u=!0,o?.(h.id)),!!h.data&&(!h.event||h.event==="message"))try{let b=WL.parse(JSON.parse(h.data));lH(b)&&(c=!0,s!==void 0&&(b.id=s)),this.onmessage?.(b)}catch(b){this.onerror?.(b)}}(n||u)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:s},0)}catch(d){if(this.onerror?.(new Error(`SSE stream disconnected: ${d}`)),(n||u)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:s},0)}catch(h){this.onerror?.(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 b2("No auth provider");if(await nk(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new b2("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,r){try{let{resumptionToken:n,onresumptiontoken:o}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:z2e(e)?e.id:void 0}).catch(p=>this.onerror?.(p));return}let s=await this._commonHeaders();s.set("content-type","application/json"),s.set("accept","application/json, text/event-stream");let a={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(e),signal:this._abortController?.signal},u=await(this._fetch??fetch)(this._url,a),c=u.headers.get("mcp-session-id");if(c&&(this._sessionId=c),!u.ok){let p=await u.text().catch(()=>null);if(u.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new fM(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:h,scope:g}=Moe(u);if(this._resourceMetadataUrl=h,this._scope=g,await nk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new b2;return this._hasCompletedAuthFlow=!0,this.send(e)}if(u.status===403&&this._authProvider){let{resourceMetadataUrl:h,scope:g,error:b}=Moe(u);if(b==="insufficient_scope"){let A=u.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===A)throw new fM(403,"Server returned 403 after trying upscoping");if(g&&(this._scope=g),h&&(this._resourceMetadataUrl=h),this._lastUpscopingHeader=A??void 0,await nk(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new b2;return this.send(e)}}throw new fM(u.status,`Error POSTing to endpoint: ${p}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,u.status===202){await u.body?.cancel(),o1n(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(p=>this.onerror?.(p));return}let d=(Array.isArray(e)?e:[e]).filter(p=>"method"in p&&"id"in p&&p.id!==void 0).length>0,f=u.headers.get("content-type");if(d)if(f?.includes("text/event-stream"))this._handleSseStream(u.body,{onresumptiontoken:o},!1);else if(f?.includes("application/json")){let p=await u.json(),h=Array.isArray(p)?p.map(g=>WL.parse(g)):[WL.parse(p)];for(let g of h)this.onmessage?.(g)}else throw await u.body?.cancel(),new fM(-1,`Unexpected content type: ${f}`);else await u.body?.cancel()}catch(n){throw this.onerror?.(n),n}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new fM(n.status,`Failed to terminate session: ${n.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}}});import{readFile as ogs}from"node:fs/promises";var v8e,C8e,$H,h$t=j(()=>{"use strict";nhe();Jze();Ai();(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"})(v8e||(v8e={}));C8e=class extends Error{code;constructor(e,r){super(r),this.code=e}},$H=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||QQ.default}async start(){if(this._isClosed)throw new Error(I.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let o=await this._authProvider.tokens();o?.access_token&&(e=o.access_token)}catch(o){try{let s=await this._authProvider.clientInformation();if(s){let a=await this._authProvider.tokens();if(a?.refresh_token){let u=await d$t(this._url,{clientInformation:s,refreshToken:a.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(u),u?.access_token&&(e=u.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw s?(await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(I.t("websocketClient.errors.unauthorizedOAuth"))):new Error("Redirect URL is required for authorization")}throw o}}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((o,s)=>{try{let a={headers:r};this._websocket=new this._WebSocket(n.toString(),a),this._websocket.on("open",()=>{o()}),this._websocket.on("error",u=>{let c=u.code!==void 0?u.code:void 0;s(new C8e(c,`WebSocket error: ${u.message}`))}),this._websocket.on("message",async u=>{try{let c=u.toString(),m=JSON.parse(c);if(this._specialIds.has(Number(m.id))||m.type==="welcome")return;this.onmessage?.(await this._transformResponse(m))}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(a){s(new C8e(void 0,`Failed to create WebSocket: ${a}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(I.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl;if(!n)throw new Error("Redirect URL is required for authorization");let o=typeof n=="string"?n:n.toString(),s=await Mbn(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:o,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(s)}else throw new Error(I.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===QQ.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(I.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(I.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==QQ.default.OPEN)throw new Error(I.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 C8e(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:v8e.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.5.10",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:o}=r||{};return{type:v8e.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{filePath:n,originalText:await ogs(n,"utf8"),modifiedText:o}}}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:v8e.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",o=>{try{let s=JSON.parse(o.toString());Number(s.id)===e&&(this._specialIds.delete(e),s.payload.success?r(s.payload.data.text):n(s.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var jbn=T((Zec,$bn)=>{"use strict";$bn.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 zbn=T((etc,Wbn)=>{"use strict";var Vbn="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",Qbn=new RegExp("^"+Vbn+"$"),Gbn="|&;()<> \\t",sgs='"((\\\\"|[^"])*?)"',ags="'((\\\\'|[^'])*?)'",ugs=/^#$/,qbn="'",Hbn='"',g$t="$",jH="",cgs=4294967296;for(b$t=0;b$t<4;b$t++)jH+=(cgs*Math.random()).toString(16);var b$t,lgs=new RegExp("^"+jH);function mgs(t,e){for(var r=e.lastIndex,n=[],o;o=e.exec(t);)n.push(o),e.lastIndex===o.index&&(e.lastIndex+=1);return e.lastIndex=r,n}function dgs(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+jH+JSON.stringify(n)+jH:e+n}function fgs(t,e,r){r||(r={});var n=r.escape||"\\",o="(\\"+n+`['"`+Gbn+`]|[^\\s'"`+Gbn+"])+",s=new RegExp(["("+Vbn+")","("+o+"|"+sgs+"|"+ags+")+"].join("|"),"g"),a=mgs(t,s);if(a.length===0)return[];e||(e={});var u=!1;return a.map(function(c){var m=c[0];if(!m||u)return;if(Qbn.test(m))return{op:m};var d=!1,f=!1,p="",h=!1,g;function b(){g+=1;var E,v,C=m.charAt(g);if(C==="{"){if(g+=1,m.charAt(g)==="}")throw new Error("Bad substitution: "+m.slice(g-2,g+1));if(E=m.indexOf("}",g),E<0)throw new Error("Bad substitution: "+m.slice(g));v=m.slice(g,E),g=E}else if(/[*@#?$!_-]/.test(C))v=C,g+=1;else{var x=m.slice(g);E=x.match(/[^\w\d_]/),E?(v=x.slice(0,E.index),g+=E.index-1):(v=x,g=m.length)}return dgs(e,"",v)}for(g=0;g<m.length;g++){var A=m.charAt(g);if(h=h||!d&&(A==="*"||A==="?"),f)p+=A,f=!1;else if(d)A===d?d=!1:d==qbn?p+=A:A===n?(g+=1,A=m.charAt(g),A===Hbn||A===n||A===g$t?p+=A:p+=n+A):A===g$t?p+=b():p+=A;else if(A===Hbn||A===qbn)d=A;else{if(Qbn.test(A))return{op:m};if(ugs.test(A)){u=!0;var y={comment:t.slice(c.index+g+1)};return p.length?[p,y]:[y]}else A===n?f=!0:A===g$t?p+=b():p+=A}}return h?{op:"glob",pattern:p}:p}).reduce(function(c,m){return typeof m>"u"?c:c.concat(m)},[])}Wbn.exports=function(e,r,n){var o=fgs(e,r,n);return typeof r!="function"?o:o.reduce(function(s,a){if(typeof a=="object")return s.concat(a);var u=a.split(RegExp("("+jH+".*?"+jH+")","g"));return u.length===1?s.concat(u[0]):s.concat(u.filter(Boolean).map(function(c){return lgs.test(c)?JSON.parse(c.split(jH)[1]):c}))},[])}});var S8e=T(A$t=>{"use strict";A$t.quote=jbn();A$t.parse=zbn()});var Ybn,Zze,Kbn=j(()=>{"use strict";Ybn=Se(hke(),1);Ai();Zze=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(I.t("mcp.auth.scopesRequired"));this.auth=new Ybn.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(I.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as pgs}from"node:child_process";import{promisify as hgs}from"node:util";import{platform as ggs}from"node:os";import{URL as bgs}from"node:url";function Ags(t){let e;try{e=new bgs(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 Xbn(t){Ags(t);let e=ggs(),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 o={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await Jbn(r,n,o)}catch(s){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let a=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let u of a)try{await Jbn(u,[t],o);return}catch{continue}}throw new Error(`Failed to open browser: ${s instanceof Error?s.message:"Unknown error"}`)}}var Jbn,Zbn=j(()=>{"use strict";Jbn=hgs(pgs)});function Ho(t){return t instanceof Error&&"code"in t}function Ar(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function y$t(t){if(t&&typeof t=="object"&&"response"in t){let r=ygs(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new tYe(r.error.message);case 401:return new hM(r.error.message);case 403:return new eYe(r.error.message);default:}}return t}function ygs(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var eYe,hM,tYe,A0=j(()=>{"use strict";eYe=class extends Error{},hM=class extends Error{},tYe=class extends Error{}});import{promises as Uoe}from"node:fs";import*as rYe from"node:path";var q1,nYe=j(()=>{"use strict";A0();Ai();Na();q1=class{static TOKEN_FILE="mcp-oauth-tokens.json";static getTokenFilePath(){return rYe.join(Tn(),this.TOKEN_FILE)}static async ensureConfigDir(){let e=rYe.dirname(this.getTokenFilePath());await Uoe.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await Uoe.readFile(r,"utf-8"),o=JSON.parse(n);for(let s of o)e.set(s.serverName,s)}catch(r){r.code!=="ENOENT"&&console.error(I.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:Ar(r)}))}return e}static async saveToken(e,r,n,o,s){await this.ensureConfigDir();let a=await this.loadTokens(),u={serverName:e,token:r,clientId:n,tokenUrl:o,mcpServerUrl:s,updatedAt:Date.now()};a.set(e,u);let c=Array.from(a.values()),m=this.getTokenFilePath();try{await Uoe.writeFile(m,JSON.stringify(c,null,2),{mode:384})}catch(d){throw console.error(I.t("mcp.tokenStorage.errors.failedToSaveToken",{error:Ar(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()),o=this.getTokenFilePath();try{n.length===0?await Uoe.unlink(o):await Uoe.writeFile(o,JSON.stringify(n,null,2),{mode:384})}catch(s){console.error(I.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:Ar(s)}))}}}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 Uoe.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(I.t("mcp.tokenStorage.errors.failedToClearTokens",{error:Ar(e)}))}}}});var Ph,iYe=j(()=>{"use strict";A0();Ai();Ph=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}: ${Ar(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}: ${Ar(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 s=n.authorization_servers[0],a=new URL("/.well-known/oauth-authorization-server",s).toString(),u=await this.fetchAuthorizationServerMetadata(a);if(u){let c=this.metadataToOAuthConfig(u);return u.registration_endpoint&&console.log(I.t("mcp.oauth.discovery.dynamicRegistrationSupported"),u.registration_endpoint),c}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let o=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(o){let s=this.metadataToOAuthConfig(o);return o.registration_endpoint&&console.log(I.t("mcp.oauth.discovery.dynamicRegistrationSupported"),o.registration_endpoint),s}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${Ar(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(I.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);return a?(console.log(I.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(a)):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){return e}}});import*as eAn from"node:http";import*as w8e from"node:crypto";import{URL as oYe}from"node:url";var A2,_$t=j(()=>{"use strict";Zbn();nYe();A0();iYe();Ai();A2=class{static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r,n){let s={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${n}${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(" ")||""},a=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok){let u=await a.text();throw new Error(I.t("mcp.auth.clientRegistrationFailed",{status:a.status,statusText:a.statusText,error:u}))}return await a.json()}static async discoverOAuthFromMCPServer(e){let r=Ph.extractBaseUrl(e);return Ph.discoverOAuthConfig(r)}static generatePKCEParams(){let e=w8e.randomBytes(32).toString("base64url"),r=w8e.createHash("sha256").update(e).digest("base64url"),n=w8e.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static parseCallbackUrl(e,r){try{let n=new oYe(e),o=n.searchParams.get("code"),s=n.searchParams.get("state"),a=n.searchParams.get("error");if(a){let u=n.searchParams.get("error_description");throw new Error(I.t("mcp.auth.oauthError",{error:`${a}${u?`: ${u}`:""}`}))}if(!o||!s)throw new Error(I.t("mcp.auth.missingCodeOrState"));if(s!==r)throw new Error(I.t("mcp.auth.stateValidationFailed"));return{code:o,state:s}}catch(n){throw n instanceof Error?n:new Error(I.t("mcp.auth.parseCallbackUrlFailed",{error:String(n)}))}}static startCallbackServer(e,r){let n,o=new Promise(u=>{n=u}),s;return{promise:new Promise((u,c)=>{let m=!1,d=null;r&&(d=setInterval(async()=>{try{await r()&&!m&&(m=!0,console.log("[OAuth] Authentication cancelled by user, closing server"),d&&clearInterval(d),s?.close(),c(new Error(I.t("mcp.auth.authenticationCancelled"))))}catch(f){console.log("[OAuth] Error in cancel check:",f)}},500)),s=eAn.createServer(async(f,p)=>{try{if(console.log(`[OAuth] Callback server received request: ${f.method} ${f.url}`),m){console.log("[OAuth] Request ignored - authentication already cancelled");return}let h=new oYe(f.url,"http://localhost");if(h.pathname!==this.REDIRECT_PATH){console.log(`[OAuth] Invalid path: ${h.pathname}, expected: ${this.REDIRECT_PATH}`),p.writeHead(404),p.end(I.t("mcp.ui.notFound"));return}let g=h.searchParams.get("code"),b=h.searchParams.get("state"),A=h.searchParams.get("error");if(console.log(`[OAuth] Callback parameters - code: ${g?"present":"missing"}, state: ${b?"present":"missing"}, error: ${A||"none"}`),A){p.writeHead(this.HTTP_OK,{"Content-Type":"text/html; charset=utf-8"}),p.end(`
|
|
1026
1026
|
<!DOCTYPE html>
|
|
1027
1027
|
<html>
|
|
1028
1028
|
<head>
|
|
@@ -5267,7 +5267,7 @@ ${p}`),n?o.reset(p):p}function Dnu(t,e,r,n={}){if(!kFi){kFi=!0;let s="Passing li
|
|
|
5267
5267
|
|
|
5268
5268
|
${e}
|
|
5269
5269
|
`:""}`}set message(e){this.#r=e}#o(e){if(!this.#t)return;let r=this.#e,n=Onu(r,this.#t.message);if(n)return(0,$Fi.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}},Onu=(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:o,column:s}=r.groups;return o&&s?{line:Number(o),column:Number(s)}:O8r(t,Number(n),{oneBased:!0})},Nnu=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${knu(n)})`)});var Ixe=T((kil,QFi)=>{"use strict";var Pnu=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};QFi.exports=Pnu});var Rxe=T((Oil,GFi)=>{"use strict";var Bnu="2.0.0",Lnu=Number.MAX_SAFE_INTEGER||9007199254740991,Mnu=16,Fnu=250,Unu=["major","premajor","minor","preminor","patch","prepatch","prerelease"];GFi.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Mnu,MAX_SAFE_BUILD_LENGTH:Fnu,MAX_SAFE_INTEGER:Lnu,RELEASE_TYPES:Unu,SEMVER_SPEC_VERSION:Bnu,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var qde=T((dI,qFi)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:B8r,MAX_SAFE_BUILD_LENGTH:$nu,MAX_LENGTH:jnu}=Rxe(),Qnu=Ixe();dI=qFi.exports={};var Gnu=dI.re=[],qnu=dI.safeRe=[],li=dI.src=[],Hnu=dI.safeSrc=[],mi=dI.t={},Vnu=0,L8r="[a-zA-Z0-9-]",Wnu=[["\\s",1],["\\d",jnu],[L8r,$nu]],znu=t=>{for(let[e,r]of Wnu)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},$s=(t,e,r)=>{let n=znu(e),o=Vnu++;Qnu(t,o,e),mi[t]=o,li[o]=e,Hnu[o]=n,Gnu[o]=new RegExp(e,r?"g":void 0),qnu[o]=new RegExp(n,r?"g":void 0)};$s("NUMERICIDENTIFIER","0|[1-9]\\d*");$s("NUMERICIDENTIFIERLOOSE","\\d+");$s("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${L8r}*`);$s("MAINVERSION",`(${li[mi.NUMERICIDENTIFIER]})\\.(${li[mi.NUMERICIDENTIFIER]})\\.(${li[mi.NUMERICIDENTIFIER]})`);$s("MAINVERSIONLOOSE",`(${li[mi.NUMERICIDENTIFIERLOOSE]})\\.(${li[mi.NUMERICIDENTIFIERLOOSE]})\\.(${li[mi.NUMERICIDENTIFIERLOOSE]})`);$s("PRERELEASEIDENTIFIER",`(?:${li[mi.NONNUMERICIDENTIFIER]}|${li[mi.NUMERICIDENTIFIER]})`);$s("PRERELEASEIDENTIFIERLOOSE",`(?:${li[mi.NONNUMERICIDENTIFIER]}|${li[mi.NUMERICIDENTIFIERLOOSE]})`);$s("PRERELEASE",`(?:-(${li[mi.PRERELEASEIDENTIFIER]}(?:\\.${li[mi.PRERELEASEIDENTIFIER]})*))`);$s("PRERELEASELOOSE",`(?:-?(${li[mi.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${li[mi.PRERELEASEIDENTIFIERLOOSE]})*))`);$s("BUILDIDENTIFIER",`${L8r}+`);$s("BUILD",`(?:\\+(${li[mi.BUILDIDENTIFIER]}(?:\\.${li[mi.BUILDIDENTIFIER]})*))`);$s("FULLPLAIN",`v?${li[mi.MAINVERSION]}${li[mi.PRERELEASE]}?${li[mi.BUILD]}?`);$s("FULL",`^${li[mi.FULLPLAIN]}$`);$s("LOOSEPLAIN",`[v=\\s]*${li[mi.MAINVERSIONLOOSE]}${li[mi.PRERELEASELOOSE]}?${li[mi.BUILD]}?`);$s("LOOSE",`^${li[mi.LOOSEPLAIN]}$`);$s("GTLT","((?:<|>)?=?)");$s("XRANGEIDENTIFIERLOOSE",`${li[mi.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);$s("XRANGEIDENTIFIER",`${li[mi.NUMERICIDENTIFIER]}|x|X|\\*`);$s("XRANGEPLAIN",`[v=\\s]*(${li[mi.XRANGEIDENTIFIER]})(?:\\.(${li[mi.XRANGEIDENTIFIER]})(?:\\.(${li[mi.XRANGEIDENTIFIER]})(?:${li[mi.PRERELEASE]})?${li[mi.BUILD]}?)?)?`);$s("XRANGEPLAINLOOSE",`[v=\\s]*(${li[mi.XRANGEIDENTIFIERLOOSE]})(?:\\.(${li[mi.XRANGEIDENTIFIERLOOSE]})(?:\\.(${li[mi.XRANGEIDENTIFIERLOOSE]})(?:${li[mi.PRERELEASELOOSE]})?${li[mi.BUILD]}?)?)?`);$s("XRANGE",`^${li[mi.GTLT]}\\s*${li[mi.XRANGEPLAIN]}$`);$s("XRANGELOOSE",`^${li[mi.GTLT]}\\s*${li[mi.XRANGEPLAINLOOSE]}$`);$s("COERCEPLAIN",`(^|[^\\d])(\\d{1,${B8r}})(?:\\.(\\d{1,${B8r}}))?(?:\\.(\\d{1,${B8r}}))?`);$s("COERCE",`${li[mi.COERCEPLAIN]}(?:$|[^\\d])`);$s("COERCEFULL",li[mi.COERCEPLAIN]+`(?:${li[mi.PRERELEASE]})?(?:${li[mi.BUILD]})?(?:$|[^\\d])`);$s("COERCERTL",li[mi.COERCE],!0);$s("COERCERTLFULL",li[mi.COERCEFULL],!0);$s("LONETILDE","(?:~>?)");$s("TILDETRIM",`(\\s*)${li[mi.LONETILDE]}\\s+`,!0);dI.tildeTrimReplace="$1~";$s("TILDE",`^${li[mi.LONETILDE]}${li[mi.XRANGEPLAIN]}$`);$s("TILDELOOSE",`^${li[mi.LONETILDE]}${li[mi.XRANGEPLAINLOOSE]}$`);$s("LONECARET","(?:\\^)");$s("CARETTRIM",`(\\s*)${li[mi.LONECARET]}\\s+`,!0);dI.caretTrimReplace="$1^";$s("CARET",`^${li[mi.LONECARET]}${li[mi.XRANGEPLAIN]}$`);$s("CARETLOOSE",`^${li[mi.LONECARET]}${li[mi.XRANGEPLAINLOOSE]}$`);$s("COMPARATORLOOSE",`^${li[mi.GTLT]}\\s*(${li[mi.LOOSEPLAIN]})$|^$`);$s("COMPARATOR",`^${li[mi.GTLT]}\\s*(${li[mi.FULLPLAIN]})$|^$`);$s("COMPARATORTRIM",`(\\s*)${li[mi.GTLT]}\\s*(${li[mi.LOOSEPLAIN]}|${li[mi.XRANGEPLAIN]})`,!0);dI.comparatorTrimReplace="$1$2$3";$s("HYPHENRANGE",`^\\s*(${li[mi.XRANGEPLAIN]})\\s+-\\s+(${li[mi.XRANGEPLAIN]})\\s*$`);$s("HYPHENRANGELOOSE",`^\\s*(${li[mi.XRANGEPLAINLOOSE]})\\s+-\\s+(${li[mi.XRANGEPLAINLOOSE]})\\s*$`);$s("STAR","(<|>)?=?\\s*\\*");$s("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");$s("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var fht=T((Nil,HFi)=>{"use strict";var Ynu=Object.freeze({loose:!0}),Knu=Object.freeze({}),Jnu=t=>t?typeof t!="object"?Ynu:t:Knu;HFi.exports=Jnu});var M8r=T((Pil,zFi)=>{"use strict";var VFi=/^[0-9]+$/,WFi=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=VFi.test(t),n=VFi.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Xnu=(t,e)=>WFi(e,t);zFi.exports={compareIdentifiers:WFi,rcompareIdentifiers:Xnu}});var xA=T((Bil,KFi)=>{"use strict";var pht=Ixe(),{MAX_LENGTH:YFi,MAX_SAFE_INTEGER:hht}=Rxe(),{safeRe:ght,t:bht}=qde(),Znu=fht(),{compareIdentifiers:F8r}=M8r(),U8r=class t{constructor(e,r){if(r=Znu(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>YFi)throw new TypeError(`version is longer than ${YFi} characters`);pht("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?ght[bht.LOOSE]:ght[bht.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>hht||this.major<0)throw new TypeError("Invalid major version");if(this.minor>hht||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>hht||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<hht)return s}return o}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(pht("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(pht("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return F8r(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(pht("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return F8r(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?ght[bht.PRERELEASELOOSE]:ght[bht.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let s=[r,o];n===!1&&(s=[r]),F8r(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};KFi.exports=U8r});var qK=T((Lil,XFi)=>{"use strict";var JFi=xA(),eiu=(t,e,r=!1)=>{if(t instanceof JFi)return t;try{return new JFi(t,e)}catch(n){if(!r)return null;throw n}};XFi.exports=eiu});var $8r=T((Mil,ZFi)=>{"use strict";var tiu=qK(),riu=(t,e)=>{let r=tiu(t,e);return r?r.version:null};ZFi.exports=riu});var j8r=T((Fil,eUi)=>{"use strict";var niu=qK(),iiu=(t,e)=>{let r=niu(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};eUi.exports=iiu});var Q8r=T((Uil,oiu)=>{oiu.exports=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","W3C","W3C-19980720","W3C-20150513","WTFPL","Watcom-1.0","Widget-Workshop","Wsuipa","X11","X11-distribute-modifications-variant","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"]});var tUi=T(($il,siu)=>{siu.exports=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"]});var rUi=T((jil,aiu)=>{aiu.exports=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"]});var iUi=T((Qil,nUi)=>{"use strict";var uiu=[].concat(Q8r()).concat(tUi()),ciu=rUi();nUi.exports=function(t){var e=0;function r(){return e<t.length}function n(g){if(g instanceof RegExp){var b=t.slice(e),A=b.match(g);if(A)return e+=A[0].length,A[0]}else if(t.indexOf(g,e)===e)return e+=g.length,g}function o(){n(/[ ]*/)}function s(){for(var g,b=["WITH","AND","OR","(",")",":","+"],A=0;A<b.length&&(g=n(b[A]),!g);A++);if(g==="+"&&e>1&&t[e-2]===" ")throw new Error("Space before `+`");return g&&{type:"OPERATOR",string:g}}function a(){return n(/[A-Za-z0-9-.]+/)}function u(){var g=a();if(!g)throw new Error("Expected idstring at offset "+e);return g}function c(){if(n("DocumentRef-")){var g=u();return{type:"DOCUMENTREF",string:g}}}function m(){if(n("LicenseRef-")){var g=u();return{type:"LICENSEREF",string:g}}}function d(){var g=e,b=a();if(uiu.indexOf(b)!==-1)return{type:"LICENSE",string:b};if(ciu.indexOf(b)!==-1)return{type:"EXCEPTION",string:b};e=g}function f(){return s()||c()||m()||d()}for(var p=[];r()&&(o(),!!r());){var h=f();if(!h)throw new Error("Unexpected `"+t[e]+"` at offset "+e);p.push(h)}return p}});var sUi=T((Gil,oUi)=>{"use strict";oUi.exports=function(t){var e=0;function r(){return e<t.length}function n(){return r()?t[e]:null}function o(){if(!r())throw new Error;e++}function s(b){var A=n();if(A&&A.type==="OPERATOR"&&b===A.string)return o(),A.string}function a(){if(s("WITH")){var b=n();if(b&&b.type==="EXCEPTION")return o(),b.string;throw new Error("Expected exception after `WITH`")}}function u(){var b=e,A="",y=n();if(y.type==="DOCUMENTREF"&&(o(),A+="DocumentRef-"+y.string+":",!s(":")))throw new Error("Expected `:` after `DocumentRef-...`");if(y=n(),y.type==="LICENSEREF")return o(),A+="LicenseRef-"+y.string,{license:A};e=b}function c(){var b=n();if(b&&b.type==="LICENSE"){o();var A={license:b.string};s("+")&&(A.plus=!0);var y=a();return y&&(A.exception=y),A}}function m(){var b=s("(");if(b){var A=h();if(!s(")"))throw new Error("Expected `)`");return A}}function d(){return m()||u()||c()}function f(b,A){return function y(){var E=A();if(E){if(!s(b))return E;var v=y();if(!v)throw new Error("Expected expression");return{left:E,conjunction:b.toLowerCase(),right:v}}}}var p=f("AND",d),h=f("OR",p),g=h();if(!g||r())throw new Error("Syntax error");return g}});var G8r=T((qil,aUi)=>{"use strict";var liu=iUi(),miu=sUi();aUi.exports=function(t){return miu(liu(t))}});var gUi=T((Hil,hUi)=>{var diu=G8r(),fiu=Q8r();function Aht(t){try{return diu(t),!0}catch{return!1}}function pUi(t,e){var r=e[0].length-t[0].length;return r!==0?r:t[0].toUpperCase().localeCompare(e[0].toUpperCase())}var uUi=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(pUi),piu=0,hiu=1,cUi=[function(t){return t.toUpperCase()},function(t){return t.trim()},function(t){return t.replace(/\./g,"")},function(t){return t.replace(/\s+/g,"")},function(t){return t.replace(/\s+/g,"-")},function(t){return t.replace("v","-")},function(t){return t.replace(/,?\s*(\d)/,"-$1")},function(t){return t.replace(/,?\s*(\d)/,"-$1.0")},function(t){return t.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(t){return t.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(t){return t[0].toUpperCase()+t.slice(1)},function(t){return t.replace("/","-")},function(t){return t.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(t){return t.indexOf("3.0")!==-1?t+"-or-later":t+"-only"},function(t){return t+"only"},function(t){return t.replace(/(\d)$/,"-$1.0")},function(t){return t.replace(/(-| )?(\d)$/,"-$2-Clause")},function(t){return t.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(t){return t.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(t){return t.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(t){return t.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(t){return t.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(t){return t.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(t){return"CC-"+t},function(t){return"CC-"+t+"-4.0"},function(t){return t.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(t){return"CC-"+t.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],q8r=fiu.map(function(t){var e=/^(.*)-\d+\.\d+$/.exec(t);return e?[e[0],e[1]]:[t,null]}).reduce(function(t,e){var r=e[1];return t[r]=t[r]||[],t[r].push(e[0]),t},{}),giu=Object.keys(q8r).map(function(e){return[e,q8r[e]]}).filter(function(e){return e[1].length===1&&e[0]!==null&&e[0]!=="APL"}).map(function(e){return[e[0],e[1][0]]});q8r=void 0;var lUi=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(giu).sort(pUi),biu=0,Aiu=1,mUi=function(t){for(var e=0;e<cUi.length;e++){var r=cUi[e](t).trim();if(r!==t&&Aht(r))return r}return null},dUi=function(t){for(var e=t.toUpperCase(),r=0;r<lUi.length;r++){var n=lUi[r];if(e.indexOf(n[biu])>-1)return n[Aiu]}return null},fUi=function(t,e){for(var r=0;r<uUi.length;r++){var n=uUi[r],o=n[piu];if(t.indexOf(o)>-1){var s=t.replace(o,n[hiu]),a=e(s);if(a!==null)return a}}return null};hUi.exports=function(t,e){e=e||{};var r=e.upgrade===void 0?!0:!!e.upgrade;function n(u){return r?yiu(u):u}var o=typeof t=="string"&&t.trim().length!==0;if(!o)throw Error("Invalid argument. Expected non-empty string.");if(t=t.trim(),Aht(t))return n(t);var s=t.replace(/\+$/,"").trim();if(Aht(s))return n(s);var a=mUi(t);return a!==null||(a=fUi(t,function(u){return Aht(u)?u:mUi(u)}),a!==null)||(a=dUi(t),a!==null)||(a=fUi(t,dUi),a!==null)?n(a):null};function yiu(t){return["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(t)!==-1?t+"-only":["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(t)!==-1?t.replace(/\+$/,"-or-later"):["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(t)!==-1?t+"-or-later":t}});var _Ui=T((Vil,yUi)=>{var _iu=G8r(),Eiu=gUi(),bUi='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',viu=/^SEE LICEN[CS]E IN (.+)$/;function AUi(t,e){return e.slice(0,t.length)===t}function H8r(t){if(t.hasOwnProperty("license")){var e=t.license;return AUi("LicenseRef",e)||AUi("DocumentRef",e)}else return H8r(t.left)||H8r(t.right)}yUi.exports=function(t){var e;try{e=_iu(t)}catch{var r;if(t==="UNLICENSED"||t==="UNLICENCED")return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(r=viu.exec(t))return{validForOldPackages:!0,validForNewPackages:!0,inFile:r[1]};var n={validForOldPackages:!1,validForNewPackages:!1,warnings:[bUi]};if(t.trim().length!==0){var o=Eiu(t);o&&n.warnings.push('license is similar to the valid expression "'+o+'"')}return n}return H8r(e)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[bUi]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}});var wUi=T(_ht=>{"use strict";Object.defineProperty(_ht,"__esModule",{value:!0});_ht.LRUCache=void 0;var Hde=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,vUi=new Set,V8r=typeof process=="object"&&process?process:{},CUi=(t,e,r,n)=>{typeof V8r.emitWarning=="function"?V8r.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)},yht=globalThis.AbortController,EUi=globalThis.AbortSignal;if(typeof yht>"u"){EUi=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,o){this._onabort.push(o)}},yht=class{constructor(){e()}signal=new EUi;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let o of this.signal._onabort)o(n);this.signal.onabort?.(n)}}};let t=V8r.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,CUi("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var Ciu=t=>!vUi.has(t),Yil=Symbol("type"),X$=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),SUi=t=>X$(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Vde:null:null,Vde=class extends Array{constructor(e){super(e),this.fill(0)}},W8r=class t{heap;length;static#e=!1;static create(e){let r=SUi(e);if(!r)return[];t.#e=!0;let n=new t(e,r);return t.#e=!1,n}constructor(e,r){if(!t.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},z8r=class t{#e;#t;#r;#n;#i;#o;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#u;#a;#s;#l;#c;#p;#f;#h;#g;#E;#b;#v;#S;#_;#C;#w;#A;static unsafeExposeInternals(e){return{starts:e.#S,ttls:e.#_,sizes:e.#v,keyMap:e.#s,keyList:e.#l,valList:e.#c,next:e.#p,prev:e.#f,get head(){return e.#h},get tail(){return e.#g},free:e.#E,isBackgroundFetch:r=>e.#d(r),backgroundFetch:(r,n,o,s)=>e.#U(r,n,o,s),moveToTail:r=>e.#B(r),indexes:r=>e.#x(r),rindexes:r=>e.#T(r),isStale:r=>e.#y(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#a}get size(){return this.#u}get fetchMethod(){return this.#i}get memoMethod(){return this.#o}get dispose(){return this.#r}get disposeAfter(){return this.#n}constructor(e){let{max:r=0,ttl:n,ttlResolution:o=1,ttlAutopurge:s,updateAgeOnGet:a,updateAgeOnHas:u,allowStale:c,dispose:m,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:p,maxSize:h=0,maxEntrySize:g=0,sizeCalculation:b,fetchMethod:A,memoMethod:y,noDeleteOnFetchRejection:E,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:C,allowStaleOnFetchAbort:x,ignoreFetchAbort:k}=e;if(r!==0&&!X$(r))throw new TypeError("max option must be a nonnegative integer");let R=r?SUi(r):Array;if(!R)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=h,this.maxEntrySize=g||this.#t,this.sizeCalculation=b,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#o=y,A!==void 0&&typeof A!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#i=A,this.#w=!!A,this.#s=new Map,this.#l=new Array(r).fill(void 0),this.#c=new Array(r).fill(void 0),this.#p=new R(r),this.#f=new R(r),this.#h=0,this.#g=0,this.#E=W8r.create(r),this.#u=0,this.#a=0,typeof m=="function"&&(this.#r=m),typeof d=="function"?(this.#n=d,this.#b=[]):(this.#n=void 0,this.#b=void 0),this.#C=!!this.#r,this.#A=!!this.#n,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!E,this.allowStaleOnFetchRejection=!!C,this.allowStaleOnFetchAbort=!!x,this.ignoreFetchAbort=!!k,this.maxEntrySize!==0){if(this.#t!==0&&!X$(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!X$(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#O()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!u,this.ttlResolution=X$(o)||o===0?o:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!X$(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#R()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let P="LRU_CACHE_UNBOUNDED";Ciu(P)&&(vUi.add(P),CUi("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",P,t))}}getRemainingTTL(e){return this.#s.has(e)?1/0:0}#R(){let e=new Vde(this.#e),r=new Vde(this.#e);this.#_=e,this.#S=r,this.#L=(s,a,u=Hde.now())=>{if(r[s]=a!==0?u:0,e[s]=a,a!==0&&this.ttlAutopurge){let c=setTimeout(()=>{this.#y(s)&&this.#D(this.#l[s],"expire")},a+1);c.unref&&c.unref()}},this.#I=s=>{r[s]=e[s]!==0?Hde.now():0},this.#m=(s,a)=>{if(e[a]){let u=e[a],c=r[a];if(!u||!c)return;s.ttl=u,s.start=c,s.now=n||o();let m=s.now-c;s.remainingTTL=u-m}};let n=0,o=()=>{let s=Hde.now();if(this.ttlResolution>0){n=s;let a=setTimeout(()=>n=0,this.ttlResolution);a.unref&&a.unref()}return s};this.getRemainingTTL=s=>{let a=this.#s.get(s);if(a===void 0)return 0;let u=e[a],c=r[a];if(!u||!c)return 1/0;let m=(n||o())-c;return u-m},this.#y=s=>{let a=r[s],u=e[s];return!!u&&!!a&&(n||o())-a>u}}#I=()=>{};#m=()=>{};#L=()=>{};#y=()=>!1;#O(){let e=new Vde(this.#e);this.#a=0,this.#v=e,this.#k=r=>{this.#a-=e[r],e[r]=0},this.#M=(r,n,o,s)=>{if(this.#d(n))return 0;if(!X$(o))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(o=s(n,r),!X$(o))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return o},this.#N=(r,n,o)=>{if(e[r]=n,this.#t){let s=this.#t-e[r];for(;this.#a>s;)this.#P(!0)}this.#a+=e[r],o&&(o.entrySize=n,o.totalCalculatedSize=this.#a)}}#k=e=>{};#N=(e,r,n)=>{};#M=(e,r,n,o)=>{if(n||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#x({allowStale:e=this.allowStale}={}){if(this.#u)for(let r=this.#g;!(!this.#F(r)||((e||!this.#y(r))&&(yield r),r===this.#h));)r=this.#f[r]}*#T({allowStale:e=this.allowStale}={}){if(this.#u)for(let r=this.#h;!(!this.#F(r)||((e||!this.#y(r))&&(yield r),r===this.#g));)r=this.#p[r]}#F(e){return e!==void 0&&this.#s.get(this.#l[e])===e}*entries(){for(let e of this.#x())this.#c[e]!==void 0&&this.#l[e]!==void 0&&!this.#d(this.#c[e])&&(yield[this.#l[e],this.#c[e]])}*rentries(){for(let e of this.#T())this.#c[e]!==void 0&&this.#l[e]!==void 0&&!this.#d(this.#c[e])&&(yield[this.#l[e],this.#c[e]])}*keys(){for(let e of this.#x()){let r=this.#l[e];r!==void 0&&!this.#d(this.#c[e])&&(yield r)}}*rkeys(){for(let e of this.#T()){let r=this.#l[e];r!==void 0&&!this.#d(this.#c[e])&&(yield r)}}*values(){for(let e of this.#x())this.#c[e]!==void 0&&!this.#d(this.#c[e])&&(yield this.#c[e])}*rvalues(){for(let e of this.#T())this.#c[e]!==void 0&&!this.#d(this.#c[e])&&(yield this.#c[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#x()){let o=this.#c[n],s=this.#d(o)?o.__staleWhileFetching:o;if(s!==void 0&&e(s,this.#l[n],this))return this.get(this.#l[n],r)}}forEach(e,r=this){for(let n of this.#x()){let o=this.#c[n],s=this.#d(o)?o.__staleWhileFetching:o;s!==void 0&&e.call(r,s,this.#l[n],this)}}rforEach(e,r=this){for(let n of this.#T()){let o=this.#c[n],s=this.#d(o)?o.__staleWhileFetching:o;s!==void 0&&e.call(r,s,this.#l[n],this)}}purgeStale(){let e=!1;for(let r of this.#T({allowStale:!0}))this.#y(r)&&(this.#D(this.#l[r],"expire"),e=!0);return e}info(e){let r=this.#s.get(e);if(r===void 0)return;let n=this.#c[r],o=this.#d(n)?n.__staleWhileFetching:n;if(o===void 0)return;let s={value:o};if(this.#_&&this.#S){let a=this.#_[r],u=this.#S[r];if(a&&u){let c=a-(Hde.now()-u);s.ttl=c,s.start=Date.now()}}return this.#v&&(s.size=this.#v[r]),s}dump(){let e=[];for(let r of this.#x({allowStale:!0})){let n=this.#l[r],o=this.#c[r],s=this.#d(o)?o.__staleWhileFetching:o;if(s===void 0||n===void 0)continue;let a={value:s};if(this.#_&&this.#S){a.ttl=this.#_[r];let u=Hde.now()-this.#S[r];a.start=Math.floor(Date.now()-u)}this.#v&&(a.size=this.#v[r]),e.unshift([n,a])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let o=Date.now()-n.start;n.start=Hde.now()-o}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:o=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:u=this.sizeCalculation,status:c}=n,{noUpdateTTL:m=this.noUpdateTTL}=n,d=this.#M(e,r,n.size||0,u);if(this.maxEntrySize&&d>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.#D(e,"set"),this;let f=this.#u===0?void 0:this.#s.get(e);if(f===void 0)f=this.#u===0?this.#g:this.#E.length!==0?this.#E.pop():this.#u===this.#e?this.#P(!1):this.#u,this.#l[f]=e,this.#c[f]=r,this.#s.set(e,f),this.#p[this.#g]=f,this.#f[f]=this.#g,this.#g=f,this.#u++,this.#N(f,d,c),c&&(c.set="add"),m=!1;else{this.#B(f);let p=this.#c[f];if(r!==p){if(this.#w&&this.#d(p)){p.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:h}=p;h!==void 0&&!a&&(this.#C&&this.#r?.(h,e,"set"),this.#A&&this.#b?.push([h,e,"set"]))}else a||(this.#C&&this.#r?.(p,e,"set"),this.#A&&this.#b?.push([p,e,"set"]));if(this.#k(f),this.#N(f,d,c),this.#c[f]=r,c){c.set="replace";let h=p&&this.#d(p)?p.__staleWhileFetching:p;h!==void 0&&(c.oldValue=h)}}else c&&(c.set="update")}if(o!==0&&!this.#_&&this.#R(),this.#_&&(m||this.#L(f,o,s),c&&this.#m(c,f)),!a&&this.#A&&this.#b){let p=this.#b,h;for(;h=p?.shift();)this.#n?.(...h)}return this}pop(){try{for(;this.#u;){let e=this.#c[this.#h];if(this.#P(!0),this.#d(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#A&&this.#b){let e=this.#b,r;for(;r=e?.shift();)this.#n?.(...r)}}}#P(e){let r=this.#h,n=this.#l[r],o=this.#c[r];return this.#w&&this.#d(o)?o.__abortController.abort(new Error("evicted")):(this.#C||this.#A)&&(this.#C&&this.#r?.(o,n,"evict"),this.#A&&this.#b?.push([o,n,"evict"])),this.#k(r),e&&(this.#l[r]=void 0,this.#c[r]=void 0,this.#E.push(r)),this.#u===1?(this.#h=this.#g=0,this.#E.length=0):this.#h=this.#p[r],this.#s.delete(n),this.#u--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:o}=r,s=this.#s.get(e);if(s!==void 0){let a=this.#c[s];if(this.#d(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#y(s))o&&(o.has="stale",this.#m(o,s));else return n&&this.#I(s),o&&(o.has="hit",this.#m(o,s)),!0}else o&&(o.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,o=this.#s.get(e);if(o===void 0||!n&&this.#y(o))return;let s=this.#c[o];return this.#d(s)?s.__staleWhileFetching:s}#U(e,r,n,o){let s=r===void 0?void 0:this.#c[r];if(this.#d(s))return s;let a=new yht,{signal:u}=n;u?.addEventListener("abort",()=>a.abort(u.reason),{signal:a.signal});let c={signal:a.signal,options:n,context:o},m=(b,A=!1)=>{let{aborted:y}=a.signal,E=n.ignoreFetchAbort&&b!==void 0;if(n.status&&(y&&!A?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,E&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),y&&!E&&!A)return f(a.signal.reason);let v=h;return this.#c[r]===h&&(b===void 0?v.__staleWhileFetching?this.#c[r]=v.__staleWhileFetching:this.#D(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,b,c.options))),b},d=b=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=b),f(b)),f=b=>{let{aborted:A}=a.signal,y=A&&n.allowStaleOnFetchAbort,E=y||n.allowStaleOnFetchRejection,v=E||n.noDeleteOnFetchRejection,C=h;if(this.#c[r]===h&&(!v||C.__staleWhileFetching===void 0?this.#D(e,"fetch"):y||(this.#c[r]=C.__staleWhileFetching)),E)return n.status&&C.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),C.__staleWhileFetching;if(C.__returned===C)throw b},p=(b,A)=>{let y=this.#i?.(e,s,c);y&&y instanceof Promise&&y.then(E=>b(E===void 0?void 0:E),A),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(b(void 0),n.allowStaleOnFetchAbort&&(b=E=>m(E,!0)))})};n.status&&(n.status.fetchDispatched=!0);let h=new Promise(p).then(m,d),g=Object.assign(h,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.set(e,g,{...c.options,status:void 0}),r=this.#s.get(e)):this.#c[r]=g,g}#d(e){if(!this.#w)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof yht}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:c=0,sizeCalculation:m=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:h=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:b,forceRefresh:A=!1,status:y,signal:E}=r;if(!this.#w)return y&&(y.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:o,noDeleteOnStaleGet:s,status:y});let v={allowStale:n,updateAgeOnGet:o,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:u,size:c,sizeCalculation:m,noUpdateTTL:d,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:g,ignoreFetchAbort:h,status:y,signal:E},C=this.#s.get(e);if(C===void 0){y&&(y.fetch="miss");let x=this.#U(e,C,v,b);return x.__returned=x}else{let x=this.#c[C];if(this.#d(x)){let O=n&&x.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",O&&(y.returnedStale=!0)),O?x.__staleWhileFetching:x.__returned=x}let k=this.#y(C);if(!A&&!k)return y&&(y.fetch="hit"),this.#B(C),o&&this.#I(C),y&&this.#m(y,C),x;let R=this.#U(e,C,v,b),D=R.__staleWhileFetching!==void 0&&n;return y&&(y.fetch=k?"stale":"refresh",D&&k&&(y.returnedStale=!0)),D?R.__staleWhileFetching:R.__returned=R}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#o;if(!n)throw new Error("no memoMethod provided to constructor");let{context:o,forceRefresh:s,...a}=r,u=this.get(e,a);if(!s&&u!==void 0)return u;let c=n(e,u,{options:a,context:o});return this.set(e,c,a),c}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:a}=r,u=this.#s.get(e);if(u!==void 0){let c=this.#c[u],m=this.#d(c);return a&&this.#m(a,u),this.#y(u)?(a&&(a.get="stale"),m?(a&&n&&c.__staleWhileFetching!==void 0&&(a.returnedStale=!0),n?c.__staleWhileFetching:void 0):(s||this.#D(e,"expire"),a&&n&&(a.returnedStale=!0),n?c:void 0)):(a&&(a.get="hit"),m?c.__staleWhileFetching:(this.#B(u),o&&this.#I(u),c))}else a&&(a.get="miss")}#$(e,r){this.#f[r]=e,this.#p[e]=r}#B(e){e!==this.#g&&(e===this.#h?this.#h=this.#p[e]:this.#$(this.#f[e],this.#p[e]),this.#$(this.#g,e),this.#g=e)}delete(e){return this.#D(e,"delete")}#D(e,r){let n=!1;if(this.#u!==0){let o=this.#s.get(e);if(o!==void 0)if(n=!0,this.#u===1)this.#j(r);else{this.#k(o);let s=this.#c[o];if(this.#d(s)?s.__abortController.abort(new Error("deleted")):(this.#C||this.#A)&&(this.#C&&this.#r?.(s,e,r),this.#A&&this.#b?.push([s,e,r])),this.#s.delete(e),this.#l[o]=void 0,this.#c[o]=void 0,o===this.#g)this.#g=this.#f[o];else if(o===this.#h)this.#h=this.#p[o];else{let a=this.#f[o];this.#p[a]=this.#p[o];let u=this.#p[o];this.#f[u]=this.#f[o]}this.#u--,this.#E.push(o)}}if(this.#A&&this.#b?.length){let o=this.#b,s;for(;s=o?.shift();)this.#n?.(...s)}return n}clear(){return this.#j("delete")}#j(e){for(let r of this.#T({allowStale:!0})){let n=this.#c[r];if(this.#d(n))n.__abortController.abort(new Error("deleted"));else{let o=this.#l[r];this.#C&&this.#r?.(n,o,e),this.#A&&this.#b?.push([n,o,e])}}if(this.#s.clear(),this.#c.fill(void 0),this.#l.fill(void 0),this.#_&&this.#S&&(this.#_.fill(0),this.#S.fill(0)),this.#v&&this.#v.fill(0),this.#h=0,this.#g=0,this.#E.length=0,this.#a=0,this.#u=0,this.#A&&this.#b){let r=this.#b,n;for(;n=r?.shift();)this.#n?.(...n)}}};_ht.LRUCache=z8r});var DUi=T((Jil,TUi)=>{"use strict";var Dc=(...t)=>t.every(e=>e)?t.join(""):"",Jf=t=>t?encodeURIComponent(t):"",xUi=t=>t.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-"),Siu={sshtemplate:({domain:t,user:e,project:r,committish:n})=>`git@${t}:${e}/${r}.git${Dc("#",n)}`,sshurltemplate:({domain:t,user:e,project:r,committish:n})=>`git+ssh://git@${t}/${e}/${r}.git${Dc("#",n)}`,edittemplate:({domain:t,user:e,project:r,committish:n,editpath:o,path:s})=>`https://${t}/${e}/${r}${Dc("/",o,"/",Jf(n||"HEAD"),"/",s)}`,browsetemplate:({domain:t,user:e,project:r,committish:n,treepath:o})=>`https://${t}/${e}/${r}${Dc("/",o,"/",Jf(n))}`,browsetreetemplate:({domain:t,user:e,project:r,committish:n,treepath:o,path:s,fragment:a,hashformat:u})=>`https://${t}/${e}/${r}/${o}/${Jf(n||"HEAD")}/${s}${Dc("#",u(a||""))}`,browseblobtemplate:({domain:t,user:e,project:r,committish:n,blobpath:o,path:s,fragment:a,hashformat:u})=>`https://${t}/${e}/${r}/${o}/${Jf(n||"HEAD")}/${s}${Dc("#",u(a||""))}`,docstemplate:({domain:t,user:e,project:r,treepath:n,committish:o})=>`https://${t}/${e}/${r}${Dc("/",n,"/",Jf(o))}#readme`,httpstemplate:({auth:t,domain:e,user:r,project:n,committish:o})=>`git+https://${Dc(t,"@")}${e}/${r}/${n}.git${Dc("#",o)}`,filetemplate:({domain:t,user:e,project:r,committish:n,path:o})=>`https://${t}/${e}/${r}/raw/${Jf(n||"HEAD")}/${o}`,shortcuttemplate:({type:t,user:e,project:r,committish:n})=>`${t}:${e}/${r}${Dc("#",n)}`,pathtemplate:({user:t,project:e,committish:r})=>`${t}/${e}${Dc("#",r)}`,bugstemplate:({domain:t,user:e,project:r})=>`https://${t}/${e}/${r}/issues`,hashformat:xUi},Z$={};Z$.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:t,user:e,project:r,committish:n,path:o})=>`https://${Dc(t,"@")}raw.githubusercontent.com/${e}/${r}/${Jf(n||"HEAD")}/${o}`,gittemplate:({auth:t,domain:e,user:r,project:n,committish:o})=>`git://${Dc(t,"@")}${e}/${r}/${n}.git${Dc("#",o)}`,tarballtemplate:({domain:t,user:e,project:r,committish:n})=>`https://codeload.${t}/${e}/${r}/tar.gz/${Jf(n||"HEAD")}`,extract:t=>{let[,e,r,n,o]=t.pathname.split("/",5);if(!(n&&n!=="tree")&&(n||(o=t.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:o}}};Z$.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:t,user:e,project:r,committish:n,treepath:o,path:s,editpath:a})=>`https://${t}/${e}/${r}${Dc("/",o,"/",Jf(n||"HEAD"),"/",s,a)}`,tarballtemplate:({domain:t,user:e,project:r,committish:n})=>`https://${t}/${e}/${r}/get/${Jf(n||"HEAD")}.tar.gz`,extract:t=>{let[,e,r,n]=t.pathname.split("/",4);if(!["get"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:t.hash.slice(1)}}};Z$.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:t,domain:e,user:r,project:n,committish:o})=>`git+https://${Dc(t,"@")}${e}/${r}/${n}.git${Dc("#",o)}`,tarballtemplate:({domain:t,user:e,project:r,committish:n})=>`https://${t}/${e}/${r}/repository/archive.tar.gz?ref=${Jf(n||"HEAD")}`,extract:t=>{let e=t.pathname.slice(1);if(e.includes("/-/")||e.includes("/archive.tar.gz"))return;let r=e.split("/"),n=r.pop();n.endsWith(".git")&&(n=n.slice(0,-4));let o=r.join("/");if(!(!o||!n))return{user:o,project:n,committish:t.hash.slice(1)}}};Z$.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:t,project:e,committish:r})=>`git@${t}:${e}.git${Dc("#",r)}`,sshurltemplate:({domain:t,project:e,committish:r})=>`git+ssh://git@${t}/${e}.git${Dc("#",r)}`,edittemplate:({domain:t,user:e,project:r,committish:n,editpath:o})=>`https://${t}/${e}/${r}${Dc("/",Jf(n))}/${o}`,browsetemplate:({domain:t,project:e,committish:r})=>`https://${t}/${e}${Dc("/",Jf(r))}`,browsetreetemplate:({domain:t,project:e,committish:r,path:n,hashformat:o})=>`https://${t}/${e}${Dc("/",Jf(r))}${Dc("#",o(n))}`,browseblobtemplate:({domain:t,project:e,committish:r,path:n,hashformat:o})=>`https://${t}/${e}${Dc("/",Jf(r))}${Dc("#",o(n))}`,docstemplate:({domain:t,project:e,committish:r})=>`https://${t}/${e}${Dc("/",Jf(r))}`,httpstemplate:({domain:t,project:e,committish:r})=>`git+https://${t}/${e}.git${Dc("#",r)}`,filetemplate:({user:t,project:e,committish:r,path:n})=>`https://gist.githubusercontent.com/${t}/${e}/raw${Dc("/",Jf(r))}/${n}`,shortcuttemplate:({type:t,project:e,committish:r})=>`${t}:${e}${Dc("#",r)}`,pathtemplate:({project:t,committish:e})=>`${t}${Dc("#",e)}`,bugstemplate:({domain:t,project:e})=>`https://${t}/${e}`,gittemplate:({domain:t,project:e,committish:r})=>`git://${t}/${e}.git${Dc("#",r)}`,tarballtemplate:({project:t,committish:e})=>`https://codeload.github.com/gist/${t}/tar.gz/${Jf(e||"HEAD")}`,extract:t=>{let[,e,r,n]=t.pathname.split("/",4);if(n!=="raw"){if(!r){if(!e)return;r=e,e=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:e,project:r,committish:t.hash.slice(1)}}},hashformat:function(t){return t&&"file-"+xUi(t)}};Z$.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:t,user:e,project:r,committish:n,path:o})=>`https://${t}/${e}/${r}/blob/${Jf(n)||"HEAD"}/${o}`,httpstemplate:({domain:t,user:e,project:r,committish:n})=>`https://${t}/${e}/${r}.git${Dc("#",n)}`,tarballtemplate:({domain:t,user:e,project:r,committish:n})=>`https://${t}/${e}/${r}/archive/${Jf(n)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:t=>{let[,e,r,n]=t.pathname.split("/",4);if(!["archive"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!e||!r)))return{user:e,project:r,committish:t.hash.slice(1)}}};for(let[t,e]of Object.entries(Z$))Z$[t]=Object.assign({},Siu,e);TUi.exports=Z$});var K8r=T((Xil,RUi)=>{var wiu=Ae("url"),Y8r=(t,e,r)=>{let n=t.indexOf(r);return t.lastIndexOf(e,n>-1?n:1/0)},IUi=t=>{try{return new wiu.URL(t)}catch{}},xiu=(t,e)=>{let r=t.indexOf(":"),n=t.slice(0,r+1);if(Object.prototype.hasOwnProperty.call(e,n))return t;let o=t.indexOf("@");return o>-1?o>r?`git+ssh://${t}`:t:t.indexOf("//")===r+1?t:`${t.slice(0,r+1)}//${t.slice(r+1)}`},Tiu=t=>{let e=Y8r(t,"@","#"),r=Y8r(t,":","#");return r>e&&(t=t.slice(0,r)+"/"+t.slice(r+1)),Y8r(t,":","#")===-1&&t.indexOf("//")===-1&&(t=`git+ssh://${t}`),t};RUi.exports=(t,e)=>{let r=e?xiu(t,e):t;return IUi(r)||IUi(Tiu(r))}});var OUi=T((Zil,kUi)=>{"use strict";var Diu=K8r(),Iiu=t=>{let e=t.indexOf("#"),r=t.indexOf("/"),n=t.indexOf("/",r+1),o=t.indexOf(":"),s=/\s/.exec(t),a=t.indexOf("@"),u=!s||e>-1&&s.index>e,c=a===-1||e>-1&&a>e,m=o===-1||e>-1&&o>e,d=n===-1||e>-1&&n>e,f=r>0,p=e>-1?t[e-1]!=="/":!t.endsWith("/"),h=!t.startsWith(".");return u&&f&&p&&h&&c&&m&&d};kUi.exports=(t,e,{gitHosts:r,protocols:n})=>{if(!t)return;let o=Iiu(t)?`github:${t}`:t,s=Diu(o,n);if(!s)return;let a=r.byShortcut[s.protocol],u=r.byDomain[s.hostname.startsWith("www.")?s.hostname.slice(4):s.hostname],c=a||u;if(!c)return;let m=r[a||u],d=null;n[s.protocol]?.auth&&(s.username||s.password)&&(d=`${s.username}${s.password?":"+s.password:""}`);let f=null,p=null,h=null,g=null;try{if(a){let b=s.pathname.startsWith("/")?s.pathname.slice(1):s.pathname,A=b.indexOf("@");A>-1&&(b=b.slice(A+1));let y=b.lastIndexOf("/");y>-1?(p=decodeURIComponent(b.slice(0,y)),p||(p=null),h=decodeURIComponent(b.slice(y+1))):h=decodeURIComponent(b),h.endsWith(".git")&&(h=h.slice(0,-4)),s.hash&&(f=decodeURIComponent(s.hash.slice(1))),g="shortcut"}else{if(!m.protocols.includes(s.protocol))return;let b=m.extract(s);if(!b)return;p=b.user&&decodeURIComponent(b.user),h=decodeURIComponent(b.project),f=decodeURIComponent(b.committish),g=n[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(b){if(b instanceof URIError)return;throw b}return[c,p,d,h,f,g,e]}});var PUi=T((eol,NUi)=>{"use strict";var{LRUCache:Riu}=wUi(),kiu=DUi(),Oiu=OUi(),Niu=K8r(),J8r=new Riu({max:1e3}),Eht=class t{constructor(e,r,n,o,s,a,u={}){Object.assign(this,t.#e[e],{type:e,user:r,auth:n,project:o,committish:s,default:a,opts:u})}static#e={byShortcut:{},byDomain:{}};static#t={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(e,r){t.#e[e]=r,t.#e.byDomain[r.domain]=e,t.#e.byShortcut[`${e}:`]=e,t.#t[`${e}:`]={name:e}}static fromUrl(e,r){if(typeof e!="string")return;let n=e+JSON.stringify(r||{});if(!J8r.has(n)){let o=Oiu(e,r,{gitHosts:t.#e,protocols:t.#t});J8r.set(n,o?new t(...o):void 0)}return J8r.get(n)}static parseUrl(e){return Niu(e)}#r(e,r){if(typeof e!="function")return null;let n={...this,...this.opts,...r};n.path||(n.path=""),n.path.startsWith("/")&&(n.path=n.path.slice(1)),n.noCommittish&&(n.committish=null);let o=e(n);return n.noGitPlus&&o.startsWith("git+")?o.slice(4):o}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#r(this.sshtemplate,e)}sshurl(e){return this.#r(this.sshurltemplate,e)}browse(e,...r){return typeof e!="string"?this.#r(this.browsetemplate,e):typeof r[0]!="string"?this.#r(this.browsetreetemplate,{...r[0],path:e}):this.#r(this.browsetreetemplate,{...r[1],fragment:r[0],path:e})}browseFile(e,...r){return typeof r[0]!="string"?this.#r(this.browseblobtemplate,{...r[0],path:e}):this.#r(this.browseblobtemplate,{...r[1],fragment:r[0],path:e})}docs(e){return this.#r(this.docstemplate,e)}bugs(e){return this.#r(this.bugstemplate,e)}https(e){return this.#r(this.httpstemplate,e)}git(e){return this.#r(this.gittemplate,e)}shortcut(e){return this.#r(this.shortcuttemplate,e)}path(e){return this.#r(this.pathtemplate,e)}tarball(e){return this.#r(this.tarballtemplate,{...e,noCommittish:!1})}file(e,r){return this.#r(this.filetemplate,{...r,path:e})}edit(e,r){return this.#r(this.edittemplate,{...r,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&typeof this[this.default]=="function"?this[this.default](e):this.sshurl(e)}};for(let[t,e]of Object.entries(kiu))Eht.addHost(t,e);NUi.exports=Eht});var LUi=T((tol,BUi)=>{BUi.exports=Piu;function Piu(t){if(!t||t==="ERROR: No README data found!")return;t=t.trim().split(`
|
|
5270
|
-
`);let e=0;for(;t[e]&&t[e].trim().match(/^(#|$)/);)e++;let r=t.length,n=e+1;for(;n<r&&t[n].trim();)n++;return t.slice(e,n).join(" ").trim()}});var MUi=T((rol,Biu)=>{Biu.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var jUi=T((nol,$Ui)=>{var Liu=$8r(),Miu=j8r(),Fiu=_Ui(),vht=PUi(),Uiu=Ae("node:module"),$iu=["dependencies","devDependencies","optionalDependencies"],jiu=LUi(),X8r=Ae("url"),ej=MUi(),FUi=t=>t.includes("@")&&t.indexOf("@")<t.lastIndexOf(".");$Ui.exports={warn:function(){},fixRepositoryField:function(t){if(t.repositories&&(this.warn("repositories"),t.repository=t.repositories[0]),!t.repository)return this.warn("missingRepository");typeof t.repository=="string"&&(t.repository={type:"git",url:t.repository});var e=t.repository.url||"";if(e){var r=vht.fromUrl(e);r&&(e=t.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(t){Object.keys(ej.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(t,e)&&this.warn("typo",e,ej.topLevel[e])},this)},fixScriptsField:function(t){if(t.scripts){if(typeof t.scripts!="object"){this.warn("nonObjectScripts"),delete t.scripts;return}Object.keys(t.scripts).forEach(function(e){typeof t.scripts[e]!="string"?(this.warn("nonStringScript"),delete t.scripts[e]):ej.script[e]&&!t.scripts[ej.script[e]]&&this.warn("typo",e,ej.script[e],"scripts")},this)}},fixFilesField:function(t){var e=t.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete t.files):t.files&&(t.files=t.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(t){if(t.bin&&typeof t.bin=="string"){var e={},r;(r=t.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=t.bin:e[t.name]=t.bin,t.bin=e}},fixManField:function(t){t.man&&typeof t.man=="string"&&(t.man=[t.man])},fixBundleDependenciesField:function(t){var e="bundledDependencies",r="bundleDependencies";t[e]&&!t[r]&&(t[r]=t[e],delete t[e]),t[r]&&!Array.isArray(t[r])?(this.warn("nonArrayBundleDependencies"),delete t[r]):t[r]&&(t[r]=t[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(t.dependencies||(t.dependencies={}),Object.prototype.hasOwnProperty.call(t.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),t.dependencies[n]="*"),!0)},this))},fixDependencies:function(t){Yiu(t,this.warn),Wiu(t,this.warn),this.fixBundleDependenciesField(t),["dependencies","devDependencies"].forEach(function(e){if(e in t){if(!t[e]||typeof t[e]!="object"){this.warn("nonObjectDependencies",e),delete t[e];return}Object.keys(t[e]).forEach(function(r){var n=t[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete t[e][r]);var o=vht.fromUrl(t[e][r]);o&&(t[e][r]=o.toString())},this)}},this)},fixModulesField:function(t){t.modules&&(this.warn("deprecatedModules"),delete t.modules)},fixKeywordsField:function(t){typeof t.keywords=="string"&&(t.keywords=t.keywords.split(/,\s+/)),t.keywords&&!Array.isArray(t.keywords)?(delete t.keywords,this.warn("nonArrayKeywords")):t.keywords&&(t.keywords=t.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(t,e){var r=!e;if(!t.version)return t.version="",!0;if(!Liu(t.version,r))throw new Error('Invalid version: "'+t.version+'"');return t.version=Miu(t.version,r),!0},fixPeople:function(t){UUi(t,Hiu),UUi(t,Viu)},fixNameField:function(t,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!t.name&&!r){t.name="";return}if(typeof t.name!="string")throw new Error("name field must be a string.");r||(t.name=t.name.trim()),qiu(t.name,r,e.allowLegacyCase),Uiu.builtinModules.includes(t.name)&&this.warn("conflictingName",t.name)},fixDescriptionField:function(t){t.description&&typeof t.description!="string"&&(this.warn("nonStringDescription"),delete t.description),t.readme&&!t.description&&(t.description=jiu(t.readme)),t.description===void 0&&delete t.description,t.description||this.warn("missingDescription")},fixReadmeField:function(t){t.readme||(this.warn("missingReadme"),t.readme="ERROR: No README data found!")},fixBugsField:function(t){if(!t.bugs&&t.repository&&t.repository.url){var e=vht.fromUrl(t.repository.url);e&&e.bugs()&&(t.bugs={url:e.bugs()})}else if(t.bugs){if(typeof t.bugs=="string")FUi(t.bugs)?t.bugs={email:t.bugs}:X8r.parse(t.bugs).protocol?t.bugs={url:t.bugs}:this.warn("nonEmailUrlBugsString");else{Kiu(t.bugs,this.warn);var r=t.bugs;t.bugs={},r.url&&(typeof r.url=="string"&&X8r.parse(r.url).protocol?t.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&FUi(r.email)?t.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!t.bugs.email&&!t.bugs.url&&(delete t.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(t){if(!t.homepage&&t.repository&&t.repository.url){var e=vht.fromUrl(t.repository.url);e&&e.docs()&&(t.homepage=e.docs())}if(t.homepage){if(typeof t.homepage!="string")return this.warn("nonUrlHomepage"),delete t.homepage;X8r.parse(t.homepage).protocol||(t.homepage="http://"+t.homepage)}},fixLicenseField:function(t){let e=t.license||t.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Fiu(e).validForNewPackages)return this.warn("invalidLicense")}};function Qiu(t){if(t.charAt(0)!=="@")return!1;var e=t.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function Giu(t){return!t.match(/[/@\s+%:]/)&&t===encodeURIComponent(t)}function qiu(t,e,r){if(t.charAt(0)==="."||!(Qiu(t)||Giu(t))||e&&!r&&t!==t.toLowerCase()||t.toLowerCase()==="node_modules"||t.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(t))}function UUi(t,e){return t.author&&(t.author=e(t.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(t[r])&&(t[r]=t[r].map(e))}),t}function Hiu(t){if(typeof t=="string")return t;var e=t.name||"",r=t.url||t.web,n=r?" ("+r+")":"",o=t.email||t.mail,s=o?" <"+o+">":"";return e+s+n}function Viu(t){if(typeof t!="string")return t;var e=t.match(/^([^(<]+)/),r=t.match(/\(([^()]+)\)/),n=t.match(/<([^<>]+)>/),o={};return e&&e[0].trim()&&(o.name=e[0].trim()),n&&(o.email=n[1]),r&&(o.url=r[1]),o}function Wiu(t){var e=t.optionalDependencies;if(e){var r=t.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),t.dependencies=r}}function ziu(t,e,r){if(!t)return{};if(typeof t=="string"&&(t=t.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(t))return t;r("deprecatedArrayDependencies",e);var n={};return t.filter(function(o){return typeof o=="string"}).forEach(function(o){o=o.trim().split(/(:?[@\s><=])/);var s=o.shift(),a=o.join("");a=a.trim(),a=a.replace(/^@/,""),n[s]=a}),n}function Yiu(t,e){$iu.forEach(function(r){t[r]&&(t[r]=ziu(t[r],r,e))})}function Kiu(t,e){t&&Object.keys(t).forEach(function(r){ej.bugs[r]&&(e("typo",r,ej.bugs[r],"bugs"),t[ej.bugs[r]]=t[r],delete t[r])})}});var QUi=T((iol,Jiu)=>{Jiu.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var HUi=T((ool,qUi)=>{var GUi=Ae("util"),Z8r=QUi();qUi.exports=function(){var t=Array.prototype.slice.call(arguments,0),e=t.shift();if(e==="typo")return Xiu.apply(null,t);var r=Z8r[e]?Z8r[e]:e+": '%s'";return t.unshift(r),GUi.format.apply(null,t)};function Xiu(t,e,r){return r&&(t=r+"['"+t+"']",e=r+"['"+e+"']"),GUi.format(Z8r.typo,t,e)}});var YUi=T((sol,zUi)=>{zUi.exports=VUi;var e9r=jUi();VUi.fixer=e9r;var Ziu=HUi(),eou=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],tou=["dependencies","people","typos"],t9r=eou.map(function(t){return WUi(t)+"Field"});t9r=t9r.concat(tou);function VUi(t,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||t.private)&&(e=function(){}),t.scripts&&t.scripts.install==="node-gyp rebuild"&&!t.scripts.preinstall&&(t.gypfile=!0),e9r.warn=function(){e(Ziu.apply(null,arguments))},t9r.forEach(function(n){e9r["fix"+WUi(n)](t,r)}),t._id=t.name+"@"+t.version}function WUi(t){return t.charAt(0).toUpperCase()+t.slice(1)}});var KUi=j(()=>{});import{fileURLToPath as rou}from"node:url";function JUi(t){return t instanceof URL?rou(t):t}var XUi=j(()=>{KUi()});import nou from"node:fs/promises";import iou from"node:path";async function e$i({cwd:t,normalize:e=!0}={}){let r=await nou.readFile(oou(t),"utf8");return sou(r,e)}var ZUi,oou,sou,t$i=j(()=>{jFi();ZUi=Se(YUi(),1);XUi();oou=t=>iou.resolve(JUi(t)??".","package.json"),sou=(t,e)=>{let r=typeof t=="string"?P8r(t):t;return e&&(0,ZUi.default)(r),r}});import aou from"node:path";async function r$i(t){let e=await fFi("package.json",t);if(e)return{packageJson:await e$i({...t,cwd:aou.dirname(e)}),path:e}}var n$i=j(()=>{pFi();t$i()});import{fileURLToPath as uou}from"url";import cou from"path";async function tj(){if(Cht)return Cht;let t=await r$i({cwd:mou});if(t)return Cht=t.packageJson,Cht}var lou,mou,Cht,kxe=j(()=>{"use strict";n$i();lou=uou(import.meta.url),mou=cou.dirname(lou)});async function fI(){let t=await tj();return"0.5.8-beta-20260211"}var Wde=j(()=>{"use strict";kxe();});var c$i=T((Dol,i9r)=>{"use strict";var o$i=Ae("child_process").exec,s$i=Ae("child_process").execSync,Sht=Ae("fs"),i$i=Ae("path"),a$i=Sht.access,u$i=Sht.accessSync,zde=Sht.constants||Sht,r9r=process.platform=="win32",dou=function(t,e){a$i(t,zde.F_OK,function(r){e(!r)})},fou=function(t){try{return u$i(t,zde.F_OK),!1}catch{return!0}},pou=function(t,e){a$i(t,zde.F_OK|zde.X_OK,function(r){e(null,!r)})},hou=function(t){try{return u$i(t,zde.F_OK|zde.X_OK),!0}catch{return!1}},gou=function(t,e,r){dou(t,function(n){if(!n){var o=o$i("command -v "+e+" 2>/dev/null && { echo >&1 "+e+"; exit 0; }",function(s,a,u){r(null,!!a)});return}pou(t,r)})},bou=function(t,e,r){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(t)){r(null,!1);return}var n=o$i("where "+e,function(o){o!==null?r(null,!1):r(null,!0)})},Aou=function(t,e){if(fou(t))try{var r=s$i("command -v "+e+" 2>/dev/null && { echo >&1 "+e+"; exit 0; }");return!!r}catch{return!1}return hou(t)},you=function(t,e,r){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(t))return!1;try{var n=s$i("where "+e,{stdio:[]});return!!n}catch{return!1}},n9r=function(t){return/[^A-Za-z0-9_\/:=-]/.test(t)&&(t="'"+t.replace(/'/g,"'\\''")+"'",t=t.replace(/^(?:'')+/g,"").replace(/\\'''/g,"\\'")),t};r9r&&(n9r=function(t){var e=/[\\]/.test(t);if(e){var r='"'+i$i.dirname(t)+'"',n='"'+i$i.basename(t)+'"';return r+":"+n}return'"'+t+'"'});i9r.exports=function t(e,r){var n=n9r(e);if(!r&&typeof Promise<"u")return new Promise(function(o,s){t(e,function(a,u){u?o(e):s(a)})});r9r?bou(e,n,r):gou(e,n,r)};i9r.exports.sync=function(t){var e=n9r(t);return r9r?you(t,e):Aou(t,e)}});var m$i=T((Iol,l$i)=>{l$i.exports=c$i()});import a9r from"fs/promises";import u9r from"path";function qou(t,e){if(t==="global")return u9r.join(Tn(),"commands");{let r=e||process.cwd();return u9r.join(r,ai(),"commands")}}function S$i(t){return t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function Vou(t,e){let{scope:r}=e;if(r!=="project"&&r!=="global"){console.error(I.t("commandsAdd.invalidScope",{scope:r}));return}let o=du(process.cwd()).merged.apiKey;if(!o){console.error(I.t("commandsAdd.apiKeyNotFound")),console.error(I.t("commandsAdd.pleaseAuthenticateFirst"));return}console.log(I.t("commandsAdd.searchingCommand",{nameOrId:t}));try{let s=null;if(/^\d+$/.test(t)){let c=parseInt(t,10);s=await Gou(o,c)}if(!s){let c=await C$i(o,1,1e3,t,"public");if(!c.success){console.error(`Error: ${c.message}`);return}s=c.commands?.find(m=>m.name.toLowerCase()===t.toLowerCase())||null}if(!s){let c=await C$i(o,1,1e3,t,"private");if(!c.success){console.error(`Error: ${c.message}`);return}s=c.commands?.find(m=>m.name.toLowerCase()===t.toLowerCase())||null}if(!s){console.error(I.t("commandsAdd.commandNotFound",{nameOrId:t}));return}console.log(I.t("commandsAdd.foundCommand",{name:s.name})),console.log(I.t("commandsAdd.commandDescription",{description:s.description})),console.log(I.t("commandsAdd.commandCategory",{category:s.category})),console.log(I.t("commandsAdd.installingToScope",{scope:r}));let a=process.cwd(),u=await Hou(s,r,a);u.success?(console.log(u.message),console.log(""),console.log(I.t("commandsAdd.restartRequired"))):console.error(u.message)}catch(s){console.error(I.t("commandsAdd.errorAddingCommand",{error:s}))}}var C$i,Gou,Hou,w$i,x$i=j(()=>{"use strict";Tc();Mt();C$i=async(t,e=1,r=20,n,o)=>{try{if(!t)return{success:!1,message:I.t("commandsAdd.pleaseAuthenticate")};let s={page:e,size:r,usePage:!0,visibility:o};n&&(s.name=n);let a={"User-Agent":"iFlow-Cli","Content-Type":"application/json"};o==="private"&&(a.Authorization=`Bearer ${t}`);let u=await fetch("https://apis.iflow.cn/v1/commands/list",{method:"POST",headers:a,body:JSON.stringify(s)});if(!u.ok){let d=I.t("commandsAdd.unableToLoadCommands");return u.status===401?d=I.t("commandsAdd.authenticationFailed"):u.status===403?d=I.t("commandsAdd.accessDenied"):u.status===404?d=I.t("commandsAdd.serviceNotFound"):u.status>=500&&(d=I.t("commandsAdd.serverError")),{success:!1,message:d}}let c=await u.json();return c.success?{success:!0,commands:Array.isArray(c.data.data)?c.data.data:[],total:c.data.total||0}:{success:!1,message:c.message||I.t("commandsAdd.failedToLoadFromServer")}}catch(s){let a=I.t("commandsAdd.connectionError");return s instanceof Error&&s.message.includes("Failed to fetch")&&(a=I.t("commandsAdd.networkError")),{success:!1,message:a}}},Gou=async(t,e)=>{try{let r=await fetch(`https://apis.iflow.cn/v1/commands/get/${e}`,{headers:{Authorization:`Bearer ${t}`}});if(!r.ok)throw new Error(`HTTP ${r.status}: ${r.statusText}`);let n=await r.json();if(!n.success)throw new Error(n.message||I.t("commandsAdd.failedToFetchDetails"));return n.data||null}catch(r){return console.error(I.t("commandsAdd.failedToFetchDetails"),r),null}};Hou=async(t,e,r)=>{try{let n=qou(e,r);await a9r.mkdir(n,{recursive:!0});let o=`${S$i(t.name)}.toml`,s=u9r.join(n,o);try{return await a9r.access(s),{success:!1,message:I.t("commandsAdd.alreadyInstalled",{commandName:t.name,scope:e})}}catch{}let a=`# Command: ${t.name}
|
|
5270
|
+
`);let e=0;for(;t[e]&&t[e].trim().match(/^(#|$)/);)e++;let r=t.length,n=e+1;for(;n<r&&t[n].trim();)n++;return t.slice(e,n).join(" ").trim()}});var MUi=T((rol,Biu)=>{Biu.exports={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}}});var jUi=T((nol,$Ui)=>{var Liu=$8r(),Miu=j8r(),Fiu=_Ui(),vht=PUi(),Uiu=Ae("node:module"),$iu=["dependencies","devDependencies","optionalDependencies"],jiu=LUi(),X8r=Ae("url"),ej=MUi(),FUi=t=>t.includes("@")&&t.indexOf("@")<t.lastIndexOf(".");$Ui.exports={warn:function(){},fixRepositoryField:function(t){if(t.repositories&&(this.warn("repositories"),t.repository=t.repositories[0]),!t.repository)return this.warn("missingRepository");typeof t.repository=="string"&&(t.repository={type:"git",url:t.repository});var e=t.repository.url||"";if(e){var r=vht.fromUrl(e);r&&(e=t.repository.url=r.getDefaultRepresentation()==="shortcut"?r.https():r.toString())}e.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",e)},fixTypos:function(t){Object.keys(ej.topLevel).forEach(function(e){Object.prototype.hasOwnProperty.call(t,e)&&this.warn("typo",e,ej.topLevel[e])},this)},fixScriptsField:function(t){if(t.scripts){if(typeof t.scripts!="object"){this.warn("nonObjectScripts"),delete t.scripts;return}Object.keys(t.scripts).forEach(function(e){typeof t.scripts[e]!="string"?(this.warn("nonStringScript"),delete t.scripts[e]):ej.script[e]&&!t.scripts[ej.script[e]]&&this.warn("typo",e,ej.script[e],"scripts")},this)}},fixFilesField:function(t){var e=t.files;e&&!Array.isArray(e)?(this.warn("nonArrayFiles"),delete t.files):t.files&&(t.files=t.files.filter(function(r){return!r||typeof r!="string"?(this.warn("invalidFilename",r),!1):!0},this))},fixBinField:function(t){if(t.bin&&typeof t.bin=="string"){var e={},r;(r=t.name.match(/^@[^/]+[/](.*)$/))?e[r[1]]=t.bin:e[t.name]=t.bin,t.bin=e}},fixManField:function(t){t.man&&typeof t.man=="string"&&(t.man=[t.man])},fixBundleDependenciesField:function(t){var e="bundledDependencies",r="bundleDependencies";t[e]&&!t[r]&&(t[r]=t[e],delete t[e]),t[r]&&!Array.isArray(t[r])?(this.warn("nonArrayBundleDependencies"),delete t[r]):t[r]&&(t[r]=t[r].filter(function(n){return!n||typeof n!="string"?(this.warn("nonStringBundleDependency",n),!1):(t.dependencies||(t.dependencies={}),Object.prototype.hasOwnProperty.call(t.dependencies,n)||(this.warn("nonDependencyBundleDependency",n),t.dependencies[n]="*"),!0)},this))},fixDependencies:function(t){Yiu(t,this.warn),Wiu(t,this.warn),this.fixBundleDependenciesField(t),["dependencies","devDependencies"].forEach(function(e){if(e in t){if(!t[e]||typeof t[e]!="object"){this.warn("nonObjectDependencies",e),delete t[e];return}Object.keys(t[e]).forEach(function(r){var n=t[e][r];typeof n!="string"&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete t[e][r]);var o=vht.fromUrl(t[e][r]);o&&(t[e][r]=o.toString())},this)}},this)},fixModulesField:function(t){t.modules&&(this.warn("deprecatedModules"),delete t.modules)},fixKeywordsField:function(t){typeof t.keywords=="string"&&(t.keywords=t.keywords.split(/,\s+/)),t.keywords&&!Array.isArray(t.keywords)?(delete t.keywords,this.warn("nonArrayKeywords")):t.keywords&&(t.keywords=t.keywords.filter(function(e){return typeof e!="string"||!e?(this.warn("nonStringKeyword"),!1):!0},this))},fixVersionField:function(t,e){var r=!e;if(!t.version)return t.version="",!0;if(!Liu(t.version,r))throw new Error('Invalid version: "'+t.version+'"');return t.version=Miu(t.version,r),!0},fixPeople:function(t){UUi(t,Hiu),UUi(t,Viu)},fixNameField:function(t,e){typeof e=="boolean"?e={strict:e}:typeof e>"u"&&(e={});var r=e.strict;if(!t.name&&!r){t.name="";return}if(typeof t.name!="string")throw new Error("name field must be a string.");r||(t.name=t.name.trim()),qiu(t.name,r,e.allowLegacyCase),Uiu.builtinModules.includes(t.name)&&this.warn("conflictingName",t.name)},fixDescriptionField:function(t){t.description&&typeof t.description!="string"&&(this.warn("nonStringDescription"),delete t.description),t.readme&&!t.description&&(t.description=jiu(t.readme)),t.description===void 0&&delete t.description,t.description||this.warn("missingDescription")},fixReadmeField:function(t){t.readme||(this.warn("missingReadme"),t.readme="ERROR: No README data found!")},fixBugsField:function(t){if(!t.bugs&&t.repository&&t.repository.url){var e=vht.fromUrl(t.repository.url);e&&e.bugs()&&(t.bugs={url:e.bugs()})}else if(t.bugs){if(typeof t.bugs=="string")FUi(t.bugs)?t.bugs={email:t.bugs}:X8r.parse(t.bugs).protocol?t.bugs={url:t.bugs}:this.warn("nonEmailUrlBugsString");else{Kiu(t.bugs,this.warn);var r=t.bugs;t.bugs={},r.url&&(typeof r.url=="string"&&X8r.parse(r.url).protocol?t.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&(typeof r.email=="string"&&FUi(r.email)?t.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}!t.bugs.email&&!t.bugs.url&&(delete t.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(t){if(!t.homepage&&t.repository&&t.repository.url){var e=vht.fromUrl(t.repository.url);e&&e.docs()&&(t.homepage=e.docs())}if(t.homepage){if(typeof t.homepage!="string")return this.warn("nonUrlHomepage"),delete t.homepage;X8r.parse(t.homepage).protocol||(t.homepage="http://"+t.homepage)}},fixLicenseField:function(t){let e=t.license||t.licence;if(!e)return this.warn("missingLicense");if(typeof e!="string"||e.length<1||e.trim()==="")return this.warn("invalidLicense");if(!Fiu(e).validForNewPackages)return this.warn("invalidLicense")}};function Qiu(t){if(t.charAt(0)!=="@")return!1;var e=t.slice(1).split("/");return e.length!==2?!1:e[0]&&e[1]&&e[0]===encodeURIComponent(e[0])&&e[1]===encodeURIComponent(e[1])}function Giu(t){return!t.match(/[/@\s+%:]/)&&t===encodeURIComponent(t)}function qiu(t,e,r){if(t.charAt(0)==="."||!(Qiu(t)||Giu(t))||e&&!r&&t!==t.toLowerCase()||t.toLowerCase()==="node_modules"||t.toLowerCase()==="favicon.ico")throw new Error("Invalid name: "+JSON.stringify(t))}function UUi(t,e){return t.author&&(t.author=e(t.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(t[r])&&(t[r]=t[r].map(e))}),t}function Hiu(t){if(typeof t=="string")return t;var e=t.name||"",r=t.url||t.web,n=r?" ("+r+")":"",o=t.email||t.mail,s=o?" <"+o+">":"";return e+s+n}function Viu(t){if(typeof t!="string")return t;var e=t.match(/^([^(<]+)/),r=t.match(/\(([^()]+)\)/),n=t.match(/<([^<>]+)>/),o={};return e&&e[0].trim()&&(o.name=e[0].trim()),n&&(o.email=n[1]),r&&(o.url=r[1]),o}function Wiu(t){var e=t.optionalDependencies;if(e){var r=t.dependencies||{};Object.keys(e).forEach(function(n){r[n]=e[n]}),t.dependencies=r}}function ziu(t,e,r){if(!t)return{};if(typeof t=="string"&&(t=t.trim().split(/[\n\r\s\t ,]+/)),!Array.isArray(t))return t;r("deprecatedArrayDependencies",e);var n={};return t.filter(function(o){return typeof o=="string"}).forEach(function(o){o=o.trim().split(/(:?[@\s><=])/);var s=o.shift(),a=o.join("");a=a.trim(),a=a.replace(/^@/,""),n[s]=a}),n}function Yiu(t,e){$iu.forEach(function(r){t[r]&&(t[r]=ziu(t[r],r,e))})}function Kiu(t,e){t&&Object.keys(t).forEach(function(r){ej.bugs[r]&&(e("typo",r,ej.bugs[r],"bugs"),t[ej.bugs[r]]=t[r],delete t[r])})}});var QUi=T((iol,Jiu)=>{Jiu.exports={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."}});var HUi=T((ool,qUi)=>{var GUi=Ae("util"),Z8r=QUi();qUi.exports=function(){var t=Array.prototype.slice.call(arguments,0),e=t.shift();if(e==="typo")return Xiu.apply(null,t);var r=Z8r[e]?Z8r[e]:e+": '%s'";return t.unshift(r),GUi.format.apply(null,t)};function Xiu(t,e,r){return r&&(t=r+"['"+t+"']",e=r+"['"+e+"']"),GUi.format(Z8r.typo,t,e)}});var YUi=T((sol,zUi)=>{zUi.exports=VUi;var e9r=jUi();VUi.fixer=e9r;var Ziu=HUi(),eou=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"],tou=["dependencies","people","typos"],t9r=eou.map(function(t){return WUi(t)+"Field"});t9r=t9r.concat(tou);function VUi(t,e,r){e===!0&&(e=null,r=!0),r||(r=!1),(!e||t.private)&&(e=function(){}),t.scripts&&t.scripts.install==="node-gyp rebuild"&&!t.scripts.preinstall&&(t.gypfile=!0),e9r.warn=function(){e(Ziu.apply(null,arguments))},t9r.forEach(function(n){e9r["fix"+WUi(n)](t,r)}),t._id=t.name+"@"+t.version}function WUi(t){return t.charAt(0).toUpperCase()+t.slice(1)}});var KUi=j(()=>{});import{fileURLToPath as rou}from"node:url";function JUi(t){return t instanceof URL?rou(t):t}var XUi=j(()=>{KUi()});import nou from"node:fs/promises";import iou from"node:path";async function e$i({cwd:t,normalize:e=!0}={}){let r=await nou.readFile(oou(t),"utf8");return sou(r,e)}var ZUi,oou,sou,t$i=j(()=>{jFi();ZUi=Se(YUi(),1);XUi();oou=t=>iou.resolve(JUi(t)??".","package.json"),sou=(t,e)=>{let r=typeof t=="string"?P8r(t):t;return e&&(0,ZUi.default)(r),r}});import aou from"node:path";async function r$i(t){let e=await fFi("package.json",t);if(e)return{packageJson:await e$i({...t,cwd:aou.dirname(e)}),path:e}}var n$i=j(()=>{pFi();t$i()});import{fileURLToPath as uou}from"url";import cou from"path";async function tj(){if(Cht)return Cht;let t=await r$i({cwd:mou});if(t)return Cht=t.packageJson,Cht}var lou,mou,Cht,kxe=j(()=>{"use strict";n$i();lou=uou(import.meta.url),mou=cou.dirname(lou)});async function fI(){let t=await tj();return"0.5.10"}var Wde=j(()=>{"use strict";kxe();});var c$i=T((Dol,i9r)=>{"use strict";var o$i=Ae("child_process").exec,s$i=Ae("child_process").execSync,Sht=Ae("fs"),i$i=Ae("path"),a$i=Sht.access,u$i=Sht.accessSync,zde=Sht.constants||Sht,r9r=process.platform=="win32",dou=function(t,e){a$i(t,zde.F_OK,function(r){e(!r)})},fou=function(t){try{return u$i(t,zde.F_OK),!1}catch{return!0}},pou=function(t,e){a$i(t,zde.F_OK|zde.X_OK,function(r){e(null,!r)})},hou=function(t){try{return u$i(t,zde.F_OK|zde.X_OK),!0}catch{return!1}},gou=function(t,e,r){dou(t,function(n){if(!n){var o=o$i("command -v "+e+" 2>/dev/null && { echo >&1 "+e+"; exit 0; }",function(s,a,u){r(null,!!a)});return}pou(t,r)})},bou=function(t,e,r){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(t)){r(null,!1);return}var n=o$i("where "+e,function(o){o!==null?r(null,!1):r(null,!0)})},Aou=function(t,e){if(fou(t))try{var r=s$i("command -v "+e+" 2>/dev/null && { echo >&1 "+e+"; exit 0; }");return!!r}catch{return!1}return hou(t)},you=function(t,e,r){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(t))return!1;try{var n=s$i("where "+e,{stdio:[]});return!!n}catch{return!1}},n9r=function(t){return/[^A-Za-z0-9_\/:=-]/.test(t)&&(t="'"+t.replace(/'/g,"'\\''")+"'",t=t.replace(/^(?:'')+/g,"").replace(/\\'''/g,"\\'")),t};r9r&&(n9r=function(t){var e=/[\\]/.test(t);if(e){var r='"'+i$i.dirname(t)+'"',n='"'+i$i.basename(t)+'"';return r+":"+n}return'"'+t+'"'});i9r.exports=function t(e,r){var n=n9r(e);if(!r&&typeof Promise<"u")return new Promise(function(o,s){t(e,function(a,u){u?o(e):s(a)})});r9r?bou(e,n,r):gou(e,n,r)};i9r.exports.sync=function(t){var e=n9r(t);return r9r?you(t,e):Aou(t,e)}});var m$i=T((Iol,l$i)=>{l$i.exports=c$i()});import a9r from"fs/promises";import u9r from"path";function qou(t,e){if(t==="global")return u9r.join(Tn(),"commands");{let r=e||process.cwd();return u9r.join(r,ai(),"commands")}}function S$i(t){return t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function Vou(t,e){let{scope:r}=e;if(r!=="project"&&r!=="global"){console.error(I.t("commandsAdd.invalidScope",{scope:r}));return}let o=du(process.cwd()).merged.apiKey;if(!o){console.error(I.t("commandsAdd.apiKeyNotFound")),console.error(I.t("commandsAdd.pleaseAuthenticateFirst"));return}console.log(I.t("commandsAdd.searchingCommand",{nameOrId:t}));try{let s=null;if(/^\d+$/.test(t)){let c=parseInt(t,10);s=await Gou(o,c)}if(!s){let c=await C$i(o,1,1e3,t,"public");if(!c.success){console.error(`Error: ${c.message}`);return}s=c.commands?.find(m=>m.name.toLowerCase()===t.toLowerCase())||null}if(!s){let c=await C$i(o,1,1e3,t,"private");if(!c.success){console.error(`Error: ${c.message}`);return}s=c.commands?.find(m=>m.name.toLowerCase()===t.toLowerCase())||null}if(!s){console.error(I.t("commandsAdd.commandNotFound",{nameOrId:t}));return}console.log(I.t("commandsAdd.foundCommand",{name:s.name})),console.log(I.t("commandsAdd.commandDescription",{description:s.description})),console.log(I.t("commandsAdd.commandCategory",{category:s.category})),console.log(I.t("commandsAdd.installingToScope",{scope:r}));let a=process.cwd(),u=await Hou(s,r,a);u.success?(console.log(u.message),console.log(""),console.log(I.t("commandsAdd.restartRequired"))):console.error(u.message)}catch(s){console.error(I.t("commandsAdd.errorAddingCommand",{error:s}))}}var C$i,Gou,Hou,w$i,x$i=j(()=>{"use strict";Tc();Mt();C$i=async(t,e=1,r=20,n,o)=>{try{if(!t)return{success:!1,message:I.t("commandsAdd.pleaseAuthenticate")};let s={page:e,size:r,usePage:!0,visibility:o};n&&(s.name=n);let a={"User-Agent":"iFlow-Cli","Content-Type":"application/json"};o==="private"&&(a.Authorization=`Bearer ${t}`);let u=await fetch("https://apis.iflow.cn/v1/commands/list",{method:"POST",headers:a,body:JSON.stringify(s)});if(!u.ok){let d=I.t("commandsAdd.unableToLoadCommands");return u.status===401?d=I.t("commandsAdd.authenticationFailed"):u.status===403?d=I.t("commandsAdd.accessDenied"):u.status===404?d=I.t("commandsAdd.serviceNotFound"):u.status>=500&&(d=I.t("commandsAdd.serverError")),{success:!1,message:d}}let c=await u.json();return c.success?{success:!0,commands:Array.isArray(c.data.data)?c.data.data:[],total:c.data.total||0}:{success:!1,message:c.message||I.t("commandsAdd.failedToLoadFromServer")}}catch(s){let a=I.t("commandsAdd.connectionError");return s instanceof Error&&s.message.includes("Failed to fetch")&&(a=I.t("commandsAdd.networkError")),{success:!1,message:a}}},Gou=async(t,e)=>{try{let r=await fetch(`https://apis.iflow.cn/v1/commands/get/${e}`,{headers:{Authorization:`Bearer ${t}`}});if(!r.ok)throw new Error(`HTTP ${r.status}: ${r.statusText}`);let n=await r.json();if(!n.success)throw new Error(n.message||I.t("commandsAdd.failedToFetchDetails"));return n.data||null}catch(r){return console.error(I.t("commandsAdd.failedToFetchDetails"),r),null}};Hou=async(t,e,r)=>{try{let n=qou(e,r);await a9r.mkdir(n,{recursive:!0});let o=`${S$i(t.name)}.toml`,s=u9r.join(n,o);try{return await a9r.access(s),{success:!1,message:I.t("commandsAdd.alreadyInstalled",{commandName:t.name,scope:e})}}catch{}let a=`# Command: ${t.name}
|
|
5271
5271
|
# Description: ${t.description}
|
|
5272
5272
|
# Category: ${t.category}
|
|
5273
5273
|
# Version: ${t.version}
|
|
@@ -5300,7 +5300,7 @@ ${Esu}${I.t("agentsOnline.onlineAgents")}${n?` ${I.t("agentsOnline.filteredBy",{
|
|
|
5300
5300
|
`),s=Math.max.apply(null,o.map(c=>c.length).concat([e.stops.length])),a=NGi(e,n,s),u=[];for(let c of o){let m=a.slice(0),d="";for(let f of c)d+=OGi.hex(m.shift().toHex())(f);u.push(d)}return u.join(`
|
|
5301
5301
|
`)}function PGi(t){let e={interpolation:"rgb",hsvSpin:"short",...t};if(t!==void 0&&typeof t!="object")throw new TypeError(`Expected \`options\` to be an \`object\`, got \`${typeof t}\``);if(typeof e.interpolation!="string")throw new TypeError(`Expected \`options.interpolation\` to be a \`string\`, got \`${typeof e.interpolation}\``);if(e.interpolation.toLowerCase()==="hsv"&&typeof e.hsvSpin!="string")throw new TypeError(`Expected \`options.hsvSpin\` to be a \`string\`, got \`${typeof e.hsvSpin}\``);return e}var Kxe={atlas:{colors:["#feac5e","#c779d0","#4bc0c8"],options:{}},cristal:{colors:["#bdfff3","#4ac29a"],options:{}},teen:{colors:["#77a1d3","#79cbca","#e684ae"],options:{}},mind:{colors:["#473b7b","#3584a7","#30d2be"],options:{}},morning:{colors:["#ff5f6d","#ffc371"],options:{interpolation:"hsv"}},vice:{colors:["#5ee7df","#b490ca"],options:{interpolation:"hsv"}},passion:{colors:["#f43b47","#453a94"],options:{}},fruit:{colors:["#ff4e50","#f9d423"],options:{}},instagram:{colors:["#833ab4","#fd1d1d","#fcb045"],options:{}},retro:{colors:["#3f51b1","#5a55ae","#7b5fac","#8f6aae","#a86aa4","#cc6b8e","#f18271","#f3a469","#f7c978"],options:{}},summer:{colors:["#fdbb2d","#22c1c3"],options:{}},rainbow:{colors:["#ff0000","#ff0100"],options:{interpolation:"hsv",hsvSpin:"long"}},pastel:{colors:["#74ebd5","#74ecd5"],options:{interpolation:"hsv",hsvSpin:"long"}}};l3t.exports=r6r;for(let t in Kxe)l3t.exports[t]=e=>new r6r(Kxe[t].colors)(e,Kxe[t].options),l3t.exports[t].multiline=e=>new r6r(Kxe[t].colors).multiline(e,Kxe[t].options)});var m1e,kA,KS=j(()=>{"use strict";m1e=t=>{let e=t/1073741824;return t<1048576?`${(t/1024).toFixed(1)} KB`:t<1073741824?`${(t/1048576).toFixed(1)} MB`:`${e.toFixed(2)} GB`},kA=t=>{if(t<=0)return"0s";if(t<1e3)return`${Math.round(t)}ms`;let e=t/1e3;if(e<60)return`${e.toFixed(1)}s`;let r=Math.floor(e/3600),n=Math.floor(e%3600/60),o=Math.floor(e%60),s=[];return r>0&&s.push(`${r}h`),n>0&&s.push(`${n}m`),o>0&&s.push(`${o}s`),s.length===0?r>0?`${r}h`:n>0?`${n}m`:`${o}s`:s.join(" ")}});var RHi=T((kfl,IHi)=>{function bHi(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{let r=t[e],n=typeof r;(n==="object"||n==="function")&&!Object.isFrozen(r)&&bHi(r)}),t}var C3t=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function AHi(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function lj(t,...e){let r=Object.create(null);for(let n in t)r[n]=t[n];return e.forEach(function(n){for(let o in n)r[o]=n[o]}),r}var lcu="</span>",mHi=t=>!!t.scope,mcu=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let r=t.split(".");return[`${e}${r.shift()}`,...r.map((n,o)=>`${n}${"_".repeat(o+1)}`)].join(" ")}return`${e}${t}`},p6r=class{constructor(e,r){this.buffer="",this.classPrefix=r.classPrefix,e.walk(this)}addText(e){this.buffer+=AHi(e)}openNode(e){if(!mHi(e))return;let r=mcu(e.scope,{prefix:this.classPrefix});this.span(r)}closeNode(e){mHi(e)&&(this.buffer+=lcu)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},dHi=(t={})=>{let e={children:[]};return Object.assign(e,t),e},h6r=class t{constructor(){this.rootNode=dHi(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let r=dHi({scope:e});this.add(r),this.stack.push(r)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,r){return typeof r=="string"?e.addText(r):r.children&&(e.openNode(r),r.children.forEach(n=>this._walk(e,n)),e.closeNode(r)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(r=>typeof r=="string")?e.children=[e.children.join("")]:e.children.forEach(r=>{t._collapse(r)}))}},g6r=class extends h6r{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,r){let n=e.root;r&&(n.scope=`language:${r}`),this.add(n)}toHTML(){return new p6r(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function iTe(t){return t?typeof t=="string"?t:t.source:null}function yHi(t){return JK("(?=",t,")")}function dcu(t){return JK("(?:",t,")*")}function fcu(t){return JK("(?:",t,")?")}function JK(...t){return t.map(r=>iTe(r)).join("")}function pcu(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function A6r(...t){return"("+(pcu(t).capture?"":"?:")+t.map(n=>iTe(n)).join("|")+")"}function _Hi(t){return new RegExp(t.toString()+"|").exec("").length-1}function hcu(t,e){let r=t&&t.exec(e);return r&&r.index===0}var gcu=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function y6r(t,{joinWith:e}){let r=0;return t.map(n=>{r+=1;let o=r,s=iTe(n),a="";for(;s.length>0;){let u=gcu.exec(s);if(!u){a+=s;break}a+=s.substring(0,u.index),s=s.substring(u.index+u[0].length),u[0][0]==="\\"&&u[1]?a+="\\"+String(Number(u[1])+o):(a+=u[0],u[0]==="("&&r++)}return a}).map(n=>`(${n})`).join(e)}var bcu=/\b\B/,EHi="[a-zA-Z]\\w*",_6r="[a-zA-Z_]\\w*",vHi="\\b\\d+(\\.\\d+)?",CHi="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",SHi="\\b(0b[01]+)",Acu="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ycu=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=JK(e,/.*\b/,t.binary,/\b.*/)),lj({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(r,n)=>{r.index!==0&&n.ignoreMatch()}},t)},oTe={begin:"\\\\[\\s\\S]",relevance:0},_cu={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[oTe]},Ecu={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[oTe]},vcu={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},w3t=function(t,e,r={}){let n=lj({scope:"comment",begin:t,end:e,contains:[]},r);n.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let o=A6r("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return n.contains.push({begin:JK(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),n},Ccu=w3t("//","$"),Scu=w3t("/\\*","\\*/"),wcu=w3t("#","$"),xcu={scope:"number",begin:vHi,relevance:0},Tcu={scope:"number",begin:CHi,relevance:0},Dcu={scope:"number",begin:SHi,relevance:0},Icu={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[oTe,{begin:/\[/,end:/\]/,relevance:0,contains:[oTe]}]},Rcu={scope:"title",begin:EHi,relevance:0},kcu={scope:"title",begin:_6r,relevance:0},Ocu={begin:"\\.\\s*"+_6r,relevance:0},Ncu=function(t){return Object.assign(t,{"on:begin":(e,r)=>{r.data._beginMatch=e[1]},"on:end":(e,r)=>{r.data._beginMatch!==e[1]&&r.ignoreMatch()}})},v3t=Object.freeze({__proto__:null,APOS_STRING_MODE:_cu,BACKSLASH_ESCAPE:oTe,BINARY_NUMBER_MODE:Dcu,BINARY_NUMBER_RE:SHi,COMMENT:w3t,C_BLOCK_COMMENT_MODE:Scu,C_LINE_COMMENT_MODE:Ccu,C_NUMBER_MODE:Tcu,C_NUMBER_RE:CHi,END_SAME_AS_BEGIN:Ncu,HASH_COMMENT_MODE:wcu,IDENT_RE:EHi,MATCH_NOTHING_RE:bcu,METHOD_GUARD:Ocu,NUMBER_MODE:xcu,NUMBER_RE:vHi,PHRASAL_WORDS_MODE:vcu,QUOTE_STRING_MODE:Ecu,REGEXP_MODE:Icu,RE_STARTERS_RE:Acu,SHEBANG:ycu,TITLE_MODE:Rcu,UNDERSCORE_IDENT_RE:_6r,UNDERSCORE_TITLE_MODE:kcu});function Pcu(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function Bcu(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function Lcu(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=Pcu,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function Mcu(t,e){Array.isArray(t.illegal)&&(t.illegal=A6r(...t.illegal))}function Fcu(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function Ucu(t,e){t.relevance===void 0&&(t.relevance=1)}var $cu=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");let r=Object.assign({},t);Object.keys(t).forEach(n=>{delete t[n]}),t.keywords=r.keywords,t.begin=JK(r.beforeMatch,yHi(r.begin)),t.starts={relevance:0,contains:[Object.assign(r,{endsParent:!0})]},t.relevance=0,delete r.beforeMatch},jcu=["of","and","for","in","not","or","if","then","parent","list","value"],Qcu="keyword";function wHi(t,e,r=Qcu){let n=Object.create(null);return typeof t=="string"?o(r,t.split(" ")):Array.isArray(t)?o(r,t):Object.keys(t).forEach(function(s){Object.assign(n,wHi(t[s],e,s))}),n;function o(s,a){e&&(a=a.map(u=>u.toLowerCase())),a.forEach(function(u){let c=u.split("|");n[c[0]]=[s,Gcu(c[0],c[1])]})}}function Gcu(t,e){return e?Number(e):qcu(t)?0:1}function qcu(t){return jcu.includes(t.toLowerCase())}var fHi={},KK=t=>{console.error(t)},pHi=(t,...e)=>{console.log(`WARN: ${t}`,...e)},_1e=(t,e)=>{fHi[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),fHi[`${t}/${e}`]=!0)},S3t=new Error;function xHi(t,e,{key:r}){let n=0,o=t[r],s={},a={};for(let u=1;u<=e.length;u++)a[u+n]=o[u],s[u+n]=!0,n+=_Hi(e[u-1]);t[r]=a,t[r]._emit=s,t[r]._multi=!0}function Hcu(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw KK("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),S3t;if(typeof t.beginScope!="object"||t.beginScope===null)throw KK("beginScope must be object"),S3t;xHi(t,t.begin,{key:"beginScope"}),t.begin=y6r(t.begin,{joinWith:""})}}function Vcu(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw KK("skip, excludeEnd, returnEnd not compatible with endScope: {}"),S3t;if(typeof t.endScope!="object"||t.endScope===null)throw KK("endScope must be object"),S3t;xHi(t,t.end,{key:"endScope"}),t.end=y6r(t.end,{joinWith:""})}}function Wcu(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function zcu(t){Wcu(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),Hcu(t),Vcu(t)}function Ycu(t){function e(a,u){return new RegExp(iTe(a),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(u?"g":""))}class r{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(u,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,u]),this.matchAt+=_Hi(u)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let u=this.regexes.map(c=>c[1]);this.matcherRe=e(y6r(u,{joinWith:"|"}),!0),this.lastIndex=0}exec(u){this.matcherRe.lastIndex=this.lastIndex;let c=this.matcherRe.exec(u);if(!c)return null;let m=c.findIndex((f,p)=>p>0&&f!==void 0),d=this.matchIndexes[m];return c.splice(0,m),Object.assign(c,d)}}class n{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(u){if(this.multiRegexes[u])return this.multiRegexes[u];let c=new r;return this.rules.slice(u).forEach(([m,d])=>c.addRule(m,d)),c.compile(),this.multiRegexes[u]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(u,c){this.rules.push([u,c]),c.type==="begin"&&this.count++}exec(u){let c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let m=c.exec(u);if(this.resumingScanAtSamePosition()&&!(m&&m.index===this.lastIndex)){let d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,m=d.exec(u)}return m&&(this.regexIndex+=m.position+1,this.regexIndex===this.count&&this.considerAll()),m}}function o(a){let u=new n;return a.contains.forEach(c=>u.addRule(c.begin,{rule:c,type:"begin"})),a.terminatorEnd&&u.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&u.addRule(a.illegal,{type:"illegal"}),u}function s(a,u){let c=a;if(a.isCompiled)return c;[Bcu,Fcu,zcu,$cu].forEach(d=>d(a,u)),t.compilerExtensions.forEach(d=>d(a,u)),a.__beforeBegin=null,[Lcu,Mcu,Ucu].forEach(d=>d(a,u)),a.isCompiled=!0;let m=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),m=a.keywords.$pattern,delete a.keywords.$pattern),m=m||/\w+/,a.keywords&&(a.keywords=wHi(a.keywords,t.case_insensitive)),c.keywordPatternRe=e(m,!0),u&&(a.begin||(a.begin=/\B|\b/),c.beginRe=e(c.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(c.endRe=e(c.end)),c.terminatorEnd=iTe(c.end)||"",a.endsWithParent&&u.terminatorEnd&&(c.terminatorEnd+=(a.end?"|":"")+u.terminatorEnd)),a.illegal&&(c.illegalRe=e(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(d){return Kcu(d==="self"?a:d)})),a.contains.forEach(function(d){s(d,c)}),a.starts&&s(a.starts,u),c.matcher=o(c),c}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=lj(t.classNameAliases||{}),s(t)}function THi(t){return t?t.endsWithParent||THi(t.starts):!1}function Kcu(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return lj(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:THi(t)?lj(t,{starts:t.starts?lj(t.starts):null}):Object.isFrozen(t)?lj(t):t}var Jcu="11.11.1",b6r=class extends Error{constructor(e,r){super(e),this.name="HTMLInjectionError",this.html=r}},f6r=AHi,hHi=lj,gHi=Symbol("nomatch"),Xcu=7,DHi=function(t){let e=Object.create(null),r=Object.create(null),n=[],o=!0,s="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]},u={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:g6r};function c(Q){return u.noHighlightRe.test(Q)}function m(Q){let W=Q.className+" ";W+=Q.parentNode?Q.parentNode.className:"";let V=u.languageDetectRe.exec(W);if(V){let $=P(V[1]);return $||(pHi(s.replace("{}",V[1])),pHi("Falling back to no-highlight mode for this block.",Q)),$?V[1]:"no-highlight"}return W.split(/\s+/).find($=>c($)||P($))}function d(Q,W,V){let $="",J="";typeof W=="object"?($=Q,V=W.ignoreIllegals,J=W.language):(_1e("10.7.0","highlight(lang, code, ...args) has been deprecated."),_1e("10.7.0",`Please use highlight(code, options) instead.
|
|
5302
5302
|
https://github.com/highlightjs/highlight.js/issues/2277`),J=Q,$=W),V===void 0&&(V=!0);let K={code:$,language:J};B("before:highlight",K);let X=K.result?K.result:f(K.language,K.code,V);return X.code=K.code,B("after:highlight",X),X}function f(Q,W,V,$){let J=Object.create(null);function K(ke,$e){return ke.keywords[$e]}function X(){if(!de.keywords){Ne.addText(Ge);return}let ke=0;de.keywordPatternRe.lastIndex=0;let $e=de.keywordPatternRe.exec(Ge),Le="";for(;$e;){Le+=Ge.substring(ke,$e.index);let Fe=H.case_insensitive?$e[0].toLowerCase():$e[0],je=K(de,Fe);if(je){let[He,mt]=je;if(Ne.addText(Le),Le="",J[Fe]=(J[Fe]||0)+1,J[Fe]<=Xcu&&(Ze+=mt),He.startsWith("_"))Le+=$e[0];else{let It=H.classNameAliases[He]||He;pe($e[0],It)}}else Le+=$e[0];ke=de.keywordPatternRe.lastIndex,$e=de.keywordPatternRe.exec(Ge)}Le+=Ge.substring(ke),Ne.addText(Le)}function q(){if(Ge==="")return;let ke=null;if(typeof de.subLanguage=="string"){if(!e[de.subLanguage]){Ne.addText(Ge);return}ke=f(de.subLanguage,Ge,!0,be[de.subLanguage]),be[de.subLanguage]=ke._top}else ke=h(Ge,de.subLanguage.length?de.subLanguage:null);de.relevance>0&&(Ze+=ke.relevance),Ne.__addSublanguage(ke._emitter,ke.language)}function ie(){de.subLanguage!=null?q():X(),Ge=""}function pe(ke,$e){ke!==""&&(Ne.startScope($e),Ne.addText(ke),Ne.endScope())}function ce(ke,$e){let Le=1,Fe=$e.length-1;for(;Le<=Fe;){if(!ke._emit[Le]){Le++;continue}let je=H.classNameAliases[ke[Le]]||ke[Le],He=$e[Le];je?pe(He,je):(Ge=He,X(),Ge=""),Le++}}function ye(ke,$e){return ke.scope&&typeof ke.scope=="string"&&Ne.openNode(H.classNameAliases[ke.scope]||ke.scope),ke.beginScope&&(ke.beginScope._wrap?(pe(Ge,H.classNameAliases[ke.beginScope._wrap]||ke.beginScope._wrap),Ge=""):ke.beginScope._multi&&(ce(ke.beginScope,$e),Ge="")),de=Object.create(ke,{parent:{value:de}}),de}function Z(ke,$e,Le){let Fe=hcu(ke.endRe,Le);if(Fe){if(ke["on:end"]){let je=new C3t(ke);ke["on:end"]($e,je),je.isMatchIgnored&&(Fe=!1)}if(Fe){for(;ke.endsParent&&ke.parent;)ke=ke.parent;return ke}}if(ke.endsWithParent)return Z(ke.parent,$e,Le)}function oe(ke){return de.matcher.regexIndex===0?(Ge+=ke[0],1):(Ie=!0,0)}function ue(ke){let $e=ke[0],Le=ke.rule,Fe=new C3t(Le),je=[Le.__beforeBegin,Le["on:begin"]];for(let He of je)if(He&&(He(ke,Fe),Fe.isMatchIgnored))return oe($e);return Le.skip?Ge+=$e:(Le.excludeBegin&&(Ge+=$e),ie(),!Le.returnBegin&&!Le.excludeBegin&&(Ge=$e)),ye(Le,ke),Le.returnBegin?0:$e.length}function he(ke){let $e=ke[0],Le=W.substring(ke.index),Fe=Z(de,ke,Le);if(!Fe)return gHi;let je=de;de.endScope&&de.endScope._wrap?(ie(),pe($e,de.endScope._wrap)):de.endScope&&de.endScope._multi?(ie(),ce(de.endScope,ke)):je.skip?Ge+=$e:(je.returnEnd||je.excludeEnd||(Ge+=$e),ie(),je.excludeEnd&&(Ge=$e));do de.scope&&Ne.closeNode(),!de.skip&&!de.subLanguage&&(Ze+=de.relevance),de=de.parent;while(de!==Fe.parent);return Fe.starts&&ye(Fe.starts,ke),je.returnEnd?0:$e.length}function ne(){let ke=[];for(let $e=de;$e!==H;$e=$e.parent)$e.scope&&ke.unshift($e.scope);ke.forEach($e=>Ne.openNode($e))}let fe={};function ge(ke,$e){let Le=$e&&$e[0];if(Ge+=ke,Le==null)return ie(),0;if(fe.type==="begin"&&$e.type==="end"&&fe.index===$e.index&&Le===""){if(Ge+=W.slice($e.index,$e.index+1),!o){let Fe=new Error(`0 width match regex (${Q})`);throw Fe.languageName=Q,Fe.badRule=fe.rule,Fe}return 1}if(fe=$e,$e.type==="begin")return ue($e);if($e.type==="illegal"&&!V){let Fe=new Error('Illegal lexeme "'+Le+'" for mode "'+(de.scope||"<unnamed>")+'"');throw Fe.mode=de,Fe}else if($e.type==="end"){let Fe=he($e);if(Fe!==gHi)return Fe}if($e.type==="illegal"&&Le==="")return Ge+=`
|
|
5303
|
-
`,1;if(_e>1e5&&_e>$e.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ge+=Le,Le.length}let H=P(Q);if(!H)throw KK(s.replace("{}",Q)),new Error('Unknown language: "'+Q+'"');let ee=Ycu(H),Ce="",de=$||ee,be={},Ne=new u.__emitter(u);ne();let Ge="",Ze=0,Ye=0,_e=0,Ie=!1;try{if(H.__emitTokens)H.__emitTokens(W,Ne);else{for(de.matcher.considerAll();;){_e++,Ie?Ie=!1:de.matcher.considerAll(),de.matcher.lastIndex=Ye;let ke=de.matcher.exec(W);if(!ke)break;let $e=W.substring(Ye,ke.index),Le=ge($e,ke);Ye=ke.index+Le}ge(W.substring(Ye))}return Ne.finalize(),Ce=Ne.toHTML(),{language:Q,value:Ce,relevance:Ze,illegal:!1,_emitter:Ne,_top:de}}catch(ke){if(ke.message&&ke.message.includes("Illegal"))return{language:Q,value:f6r(W),illegal:!0,relevance:0,_illegalBy:{message:ke.message,index:Ye,context:W.slice(Ye-100,Ye+100),mode:ke.mode,resultSoFar:Ce},_emitter:Ne};if(o)return{language:Q,value:f6r(W),illegal:!1,relevance:0,errorRaised:ke,_emitter:Ne,_top:de};throw ke}}function p(Q){let W={value:f6r(Q),illegal:!1,relevance:0,_top:a,_emitter:new u.__emitter(u)};return W._emitter.addText(Q),W}function h(Q,W){W=W||u.languages||Object.keys(e);let V=p(Q),$=W.filter(P).filter(O).map(ie=>f(ie,Q,!1));$.unshift(V);let J=$.sort((ie,pe)=>{if(ie.relevance!==pe.relevance)return pe.relevance-ie.relevance;if(ie.language&&pe.language){if(P(ie.language).supersetOf===pe.language)return 1;if(P(pe.language).supersetOf===ie.language)return-1}return 0}),[K,X]=J,q=K;return q.secondBest=X,q}function g(Q,W,V){let $=W&&r[W]||V;Q.classList.add("hljs"),Q.classList.add(`language-${$}`)}function b(Q){let W=null,V=m(Q);if(c(V))return;if(B("before:highlightElement",{el:Q,language:V}),Q.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Q);return}if(Q.children.length>0&&(u.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(Q)),u.throwUnescapedHTML))throw new b6r("One of your code blocks includes unescaped HTML.",Q.innerHTML);W=Q;let $=W.textContent,J=V?d($,{language:V,ignoreIllegals:!0}):h($);Q.innerHTML=J.value,Q.dataset.highlighted="yes",g(Q,V,J.language),Q.result={language:J.language,re:J.relevance,relevance:J.relevance},J.secondBest&&(Q.secondBest={language:J.secondBest.language,relevance:J.secondBest.relevance}),B("after:highlightElement",{el:Q,result:J,text:$})}function A(Q){u=hHi(u,Q)}let y=()=>{C(),_1e("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function E(){C(),_1e("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let v=!1;function C(){function Q(){C()}if(document.readyState==="loading"){v||window.addEventListener("DOMContentLoaded",Q,!1),v=!0;return}document.querySelectorAll(u.cssSelector).forEach(b)}function x(Q,W){let V=null;try{V=W(t)}catch($){if(KK("Language definition for '{}' could not be registered.".replace("{}",Q)),o)KK($);else throw $;V=a}V.name||(V.name=Q),e[Q]=V,V.rawDefinition=W.bind(null,t),V.aliases&&D(V.aliases,{languageName:Q})}function k(Q){delete e[Q];for(let W of Object.keys(r))r[W]===Q&&delete r[W]}function R(){return Object.keys(e)}function P(Q){return Q=(Q||"").toLowerCase(),e[Q]||e[r[Q]]}function D(Q,{languageName:W}){typeof Q=="string"&&(Q=[Q]),Q.forEach(V=>{r[V.toLowerCase()]=W})}function O(Q){let W=P(Q);return W&&!W.disableAutodetect}function N(Q){Q["before:highlightBlock"]&&!Q["before:highlightElement"]&&(Q["before:highlightElement"]=W=>{Q["before:highlightBlock"](Object.assign({block:W.el},W))}),Q["after:highlightBlock"]&&!Q["after:highlightElement"]&&(Q["after:highlightElement"]=W=>{Q["after:highlightBlock"](Object.assign({block:W.el},W))})}function L(Q){N(Q),n.push(Q)}function F(Q){let W=n.indexOf(Q);W!==-1&&n.splice(W,1)}function B(Q,W){let V=Q;n.forEach(function($){$[V]&&$[V](W)})}function G(Q){return _1e("10.7.0","highlightBlock will be removed entirely in v12.0"),_1e("10.7.0","Please use highlightElement now."),b(Q)}Object.assign(t,{highlight:d,highlightAuto:h,highlightAll:C,highlightElement:b,highlightBlock:G,configure:A,initHighlighting:y,initHighlightingOnLoad:E,registerLanguage:x,unregisterLanguage:k,listLanguages:R,getLanguage:P,registerAliases:D,autoDetection:O,inherit:hHi,addPlugin:L,removePlugin:F}),t.debugMode=function(){o=!1},t.safeMode=function(){o=!0},t.versionString=Jcu,t.regex={concat:JK,lookahead:yHi,either:A6r,optional:fcu,anyNumberOfTimes:dcu};for(let Q in v3t)typeof v3t[Q]=="object"&&bHi(v3t[Q]);return Object.assign(t,v3t),t},E1e=DHi({});E1e.newInstance=()=>DHi({});IHi.exports=E1e;E1e.HighlightJS=E1e;E1e.default=E1e});var BHi=T((Ffl,PHi)=>{PHi.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var x1e,Q6r=j(()=>{"use strict";x1e="7a21edb (local modifications)"});async function VVi(){return V3t?W3t:new Promise(t=>{if(!process.stdin.isTTY||!process.stdout.isTTY){V3t=!0,t(!1);return}let e=process.stdin.isRaw;e||process.stdin.setRawMode(!0);let r="",n=!1,o,s=()=>{o=void 0,process.stdin.removeListener("data",a),e||process.stdin.setRawMode(!1),V3t=!0,t(!1)},a=u=>{o!==void 0&&(r+=u.toString(),r.includes("\x1B[?")&&r.includes("u")&&(n=!0,clearTimeout(o),o=setTimeout(s,1e3)),r.includes("\x1B[?")&&r.includes("c")&&(clearTimeout(o),o=void 0,process.stdin.removeListener("data",a),e||process.stdin.setRawMode(!1),n&&(process.stdout.write("\x1B[>1u"),W3t=!0,z3t=!0,process.on("exit",HVi),process.on("SIGTERM",HVi)),V3t=!0,t(W3t)))};process.stdin.on("data",a),process.stdout.write("\x1B[?u"),process.stdout.write("\x1B[c"),o=setTimeout(s,200)})}function HVi(){z3t&&(process.stdout.write("\x1B[<u"),z3t=!1)}function Y3t(){return z3t}function WVi(){return W3t}var V3t,W3t,z3t,K3t=j(()=>{"use strict";V3t=!1,W3t=!1,z3t=!1});var Ej,ygt=j(()=>{"use strict";Ej=class t{constructor(e){this.commands=e}static async create(e,r){let n=await Promise.allSettled(e.map(u=>u.loadCommands(r))),o=[];for(let u of n)u.status==="fulfilled"?o.push(...u.value):console.debug("A command loader failed:",u.reason);let s=new Map;for(let u of o){let c=u.name;if(u.extensionName&&s.has(u.name)){let m=`${u.extensionName}.${u.name}`,d=1;for(;s.has(m);)m=`${u.extensionName}.${u.name}${d}`,d++;c=m}s.set(c,{...u,name:c})}let a=Object.freeze(Array.from(s.values()));return new t(a)}getCommands(){return this.commands}}});var Zs=j(()=>{"use strict";});import cJ from"node:process";var UWi,$Wi=j(()=>{"use strict";Wde();Zs();Xs();Mt();UWi={name:"about",description:I.t("command.about"),kind:"built-in",action:async t=>{let e=cJ.platform,r=I.t("aboutCommand.noSandbox");cJ.env.SANDBOX&&cJ.env.SANDBOX!=="sandbox-exec"?r=cJ.env.SANDBOX:cJ.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${cJ.env.SEATBELT_PROFILE||I.t("aboutCommand.unknown")})`);let n=t.services.config?.getModel()||I.t("aboutCommand.unknown"),o=await fI(),s=t.services.settings.merged.selectedAuthType||"",a=cJ.env.GOOGLE_CLOUD_PROJECT||"",u={type:"about",cliVersion:o,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:s,gcpProject:a};t.ui.addItem(u,Date.now())}}});function _gt(t,e,r,n=!1){let o="";if(t.length===0)return o="\u{1F534} ",`${o}${e}
|
|
5303
|
+
`,1;if(_e>1e5&&_e>$e.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ge+=Le,Le.length}let H=P(Q);if(!H)throw KK(s.replace("{}",Q)),new Error('Unknown language: "'+Q+'"');let ee=Ycu(H),Ce="",de=$||ee,be={},Ne=new u.__emitter(u);ne();let Ge="",Ze=0,Ye=0,_e=0,Ie=!1;try{if(H.__emitTokens)H.__emitTokens(W,Ne);else{for(de.matcher.considerAll();;){_e++,Ie?Ie=!1:de.matcher.considerAll(),de.matcher.lastIndex=Ye;let ke=de.matcher.exec(W);if(!ke)break;let $e=W.substring(Ye,ke.index),Le=ge($e,ke);Ye=ke.index+Le}ge(W.substring(Ye))}return Ne.finalize(),Ce=Ne.toHTML(),{language:Q,value:Ce,relevance:Ze,illegal:!1,_emitter:Ne,_top:de}}catch(ke){if(ke.message&&ke.message.includes("Illegal"))return{language:Q,value:f6r(W),illegal:!0,relevance:0,_illegalBy:{message:ke.message,index:Ye,context:W.slice(Ye-100,Ye+100),mode:ke.mode,resultSoFar:Ce},_emitter:Ne};if(o)return{language:Q,value:f6r(W),illegal:!1,relevance:0,errorRaised:ke,_emitter:Ne,_top:de};throw ke}}function p(Q){let W={value:f6r(Q),illegal:!1,relevance:0,_top:a,_emitter:new u.__emitter(u)};return W._emitter.addText(Q),W}function h(Q,W){W=W||u.languages||Object.keys(e);let V=p(Q),$=W.filter(P).filter(O).map(ie=>f(ie,Q,!1));$.unshift(V);let J=$.sort((ie,pe)=>{if(ie.relevance!==pe.relevance)return pe.relevance-ie.relevance;if(ie.language&&pe.language){if(P(ie.language).supersetOf===pe.language)return 1;if(P(pe.language).supersetOf===ie.language)return-1}return 0}),[K,X]=J,q=K;return q.secondBest=X,q}function g(Q,W,V){let $=W&&r[W]||V;Q.classList.add("hljs"),Q.classList.add(`language-${$}`)}function b(Q){let W=null,V=m(Q);if(c(V))return;if(B("before:highlightElement",{el:Q,language:V}),Q.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Q);return}if(Q.children.length>0&&(u.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(Q)),u.throwUnescapedHTML))throw new b6r("One of your code blocks includes unescaped HTML.",Q.innerHTML);W=Q;let $=W.textContent,J=V?d($,{language:V,ignoreIllegals:!0}):h($);Q.innerHTML=J.value,Q.dataset.highlighted="yes",g(Q,V,J.language),Q.result={language:J.language,re:J.relevance,relevance:J.relevance},J.secondBest&&(Q.secondBest={language:J.secondBest.language,relevance:J.secondBest.relevance}),B("after:highlightElement",{el:Q,result:J,text:$})}function A(Q){u=hHi(u,Q)}let y=()=>{C(),_1e("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function E(){C(),_1e("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let v=!1;function C(){function Q(){C()}if(document.readyState==="loading"){v||window.addEventListener("DOMContentLoaded",Q,!1),v=!0;return}document.querySelectorAll(u.cssSelector).forEach(b)}function x(Q,W){let V=null;try{V=W(t)}catch($){if(KK("Language definition for '{}' could not be registered.".replace("{}",Q)),o)KK($);else throw $;V=a}V.name||(V.name=Q),e[Q]=V,V.rawDefinition=W.bind(null,t),V.aliases&&D(V.aliases,{languageName:Q})}function k(Q){delete e[Q];for(let W of Object.keys(r))r[W]===Q&&delete r[W]}function R(){return Object.keys(e)}function P(Q){return Q=(Q||"").toLowerCase(),e[Q]||e[r[Q]]}function D(Q,{languageName:W}){typeof Q=="string"&&(Q=[Q]),Q.forEach(V=>{r[V.toLowerCase()]=W})}function O(Q){let W=P(Q);return W&&!W.disableAutodetect}function N(Q){Q["before:highlightBlock"]&&!Q["before:highlightElement"]&&(Q["before:highlightElement"]=W=>{Q["before:highlightBlock"](Object.assign({block:W.el},W))}),Q["after:highlightBlock"]&&!Q["after:highlightElement"]&&(Q["after:highlightElement"]=W=>{Q["after:highlightBlock"](Object.assign({block:W.el},W))})}function L(Q){N(Q),n.push(Q)}function F(Q){let W=n.indexOf(Q);W!==-1&&n.splice(W,1)}function B(Q,W){let V=Q;n.forEach(function($){$[V]&&$[V](W)})}function G(Q){return _1e("10.7.0","highlightBlock will be removed entirely in v12.0"),_1e("10.7.0","Please use highlightElement now."),b(Q)}Object.assign(t,{highlight:d,highlightAuto:h,highlightAll:C,highlightElement:b,highlightBlock:G,configure:A,initHighlighting:y,initHighlightingOnLoad:E,registerLanguage:x,unregisterLanguage:k,listLanguages:R,getLanguage:P,registerAliases:D,autoDetection:O,inherit:hHi,addPlugin:L,removePlugin:F}),t.debugMode=function(){o=!1},t.safeMode=function(){o=!0},t.versionString=Jcu,t.regex={concat:JK,lookahead:yHi,either:A6r,optional:fcu,anyNumberOfTimes:dcu};for(let Q in v3t)typeof v3t[Q]=="object"&&bHi(v3t[Q]);return Object.assign(t,v3t),t},E1e=DHi({});E1e.newInstance=()=>DHi({});IHi.exports=E1e;E1e.HighlightJS=E1e;E1e.default=E1e});var BHi=T((Ffl,PHi)=>{PHi.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var x1e,Q6r=j(()=>{"use strict";x1e="567cc690a (local modifications)"});async function VVi(){return V3t?W3t:new Promise(t=>{if(!process.stdin.isTTY||!process.stdout.isTTY){V3t=!0,t(!1);return}let e=process.stdin.isRaw;e||process.stdin.setRawMode(!0);let r="",n=!1,o,s=()=>{o=void 0,process.stdin.removeListener("data",a),e||process.stdin.setRawMode(!1),V3t=!0,t(!1)},a=u=>{o!==void 0&&(r+=u.toString(),r.includes("\x1B[?")&&r.includes("u")&&(n=!0,clearTimeout(o),o=setTimeout(s,1e3)),r.includes("\x1B[?")&&r.includes("c")&&(clearTimeout(o),o=void 0,process.stdin.removeListener("data",a),e||process.stdin.setRawMode(!1),n&&(process.stdout.write("\x1B[>1u"),W3t=!0,z3t=!0,process.on("exit",HVi),process.on("SIGTERM",HVi)),V3t=!0,t(W3t)))};process.stdin.on("data",a),process.stdout.write("\x1B[?u"),process.stdout.write("\x1B[c"),o=setTimeout(s,200)})}function HVi(){z3t&&(process.stdout.write("\x1B[<u"),z3t=!1)}function Y3t(){return z3t}function WVi(){return W3t}var V3t,W3t,z3t,K3t=j(()=>{"use strict";V3t=!1,W3t=!1,z3t=!1});var Ej,ygt=j(()=>{"use strict";Ej=class t{constructor(e){this.commands=e}static async create(e,r){let n=await Promise.allSettled(e.map(u=>u.loadCommands(r))),o=[];for(let u of n)u.status==="fulfilled"?o.push(...u.value):console.debug("A command loader failed:",u.reason);let s=new Map;for(let u of o){let c=u.name;if(u.extensionName&&s.has(u.name)){let m=`${u.extensionName}.${u.name}`,d=1;for(;s.has(m);)m=`${u.extensionName}.${u.name}${d}`,d++;c=m}s.set(c,{...u,name:c})}let a=Object.freeze(Array.from(s.values()));return new t(a)}getCommands(){return this.commands}}});var Zs=j(()=>{"use strict";});import cJ from"node:process";var UWi,$Wi=j(()=>{"use strict";Wde();Zs();Xs();Mt();UWi={name:"about",description:I.t("command.about"),kind:"built-in",action:async t=>{let e=cJ.platform,r=I.t("aboutCommand.noSandbox");cJ.env.SANDBOX&&cJ.env.SANDBOX!=="sandbox-exec"?r=cJ.env.SANDBOX:cJ.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${cJ.env.SEATBELT_PROFILE||I.t("aboutCommand.unknown")})`);let n=t.services.config?.getModel()||I.t("aboutCommand.unknown"),o=await fI(),s=t.services.settings.merged.selectedAuthType||"",a=cJ.env.GOOGLE_CLOUD_PROJECT||"",u={type:"about",cliVersion:o,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:s,gcpProject:a};t.ui.addItem(u,Date.now())}}});function _gt(t,e,r,n=!1){let o="";if(t.length===0)return o="\u{1F534} ",`${o}${e}
|
|
5304
5304
|
${QWi}${I.t("agentsCommand.list.noAgentsFound")}${Hc}
|
|
5305
5305
|
`;o="\u{1F7E2} ";let s=`${o}${e}
|
|
5306
5306
|
`;for(let a of t)n?s+=q0u(a):s+=`${Egt}- ${a.agentType}${Hc}
|
|
@@ -7327,7 +7327,7 @@ ${n}
|
|
|
7327
7327
|
`}})}catch(o){console.warn("[ACP Adapter] Failed to stream agent lifecycle event:",o)}}getEnhancedToolStatus(e,r){switch(r){case"scheduled":return"running";case"executing":return"running";case"success":return"finished";case"error":return"error";default:return"running"}}formatEnhancedToolResult(e,r,n){return r==="edit"&&e?.fileDiff?{type:"diff",path:e.fileName||"unknown file",oldText:e.originalContent||null,newText:e.newContent||"",args:n}:typeof e=="string"&&this.isCodeContent(e)?{type:"markdown",markdown:"```\n"+e+"\n```",args:n}:this.formatToolResult(e,n)}isCodeContent(e){return["def ","class ","function ","import ","export ","<?php","#!/bin/","<script","<?xml"].some(n=>e.includes(n))}};var nvr=class{createAdapter(e,r){return new bAt(e,r)}};function xio(){TD.register(new nvr)}async function Tio(t){let r=new TextEncoder,n=new TextDecoder,o=new WritableStream({write(d){try{let f=n.decode(d);t.send(f)}catch(f){throw console.error("WebSocket send error:",f),f}}}),s=null,a=new ReadableStream({start(d){s=d},cancel(){s=null}});function u(d){}async function c(){cAt(),xio(),console.log("[ACP Web Peer] ACP adapter factory initialized");let d=process.cwd(),f=du(d);if(f.errors.length>0){for(let b of f.errors){let A=`Error in ${b.path}: ${b.message}`;process.env.NO_COLOR||(A=`\x1B[31m${A}\x1B[0m`),console.error(A),console.error(`Please fix ${b.path} and try again.`)}process.exit(1)}let p=await Oht(),h=J$(d),g=await HK(f.merged,h,Gg.generateSessionId(),p);if(g.setUsageMode("sdk"),g.getListExtensions()){console.log("Installed extensions:");for(let b of h)console.log(`- ${b.config.name}`);process.exit(0)}await g.initialize(),console.log=(...b)=>(b.join(" "),void 0),console.info=(...b)=>(b.join(" "),void 0),console.debug=(...b)=>(b.join(" "),void 0),console.warn=(...b)=>(b.join(" "),void 0),console.error=(...b)=>(b.join(" "),void 0),new Cfe(b=>new dDe(g,f,h,p,b),o,a);try{t.send("//ready")}catch{}}await c();function m(d){if(!s)return;let f=d.endsWith(`
|
|
7328
7328
|
`)?d:d+`
|
|
7329
7329
|
`,p=r.encode(f);s.enqueue(p)}return m}var AAt=new WeakMap,fDe=new WeakMap,_2u=0,xfe=0,Dio=[],Iio=[],Rio={code:null,time:null,stdout:[],stderr:[]};function kio(t,e,r,n,o){let s=y2u.createServer((u,c)=>{let m=new URL(u.url,`http://${u.headers.host}`);if(m.pathname==="/acp-status"){c.writeHead(200,{"Content-Type":"application/json"}),c.end(JSON.stringify({connections:xfe,lastExit:Rio,stdoutTail:Dio.slice(-10),stderrTail:Iio.slice(-10)}));return}if(m.pathname==="/acp-logs"){c.writeHead(200,{"Content-Type":"application/json"}),c.end(JSON.stringify({stdout:Dio,stderr:Iio,lastExit:Rio}));return}c.writeHead(404),c.end("Not Found")}),a=new A8t.default({server:s,path:"/acp"});return s._wss=a,a.on("connection",(u,c)=>{let m=++_2u;u._id=m,xfe++;let f=new URL(c.url,`http://${c.headers.host}`).searchParams.get("peer")||void 0;try{console.log(`[WS ${m}] open connection (total=${xfe}) peer=${f} origin=${c.headers.origin}`)}catch{}fDe.set(u,[]),setTimeout(()=>{if(!AAt.get(u))try{console.warn(`[WS ${m}] peer not ready after 1500ms`)}catch{}},1500),(async()=>{try{console.log(`[WS ${m}] About to call startEmbeddedGeminiPeer`);let p=await Tio(u);console.log(`[WS ${m}] startEmbeddedGeminiPeer completed successfully`),AAt.set(u,p);try{u.send(`//stderr [WS ${m}] Embedded iFlow ACP peer started`)}catch{}let h=fDe.get(u);if(h&&h.length){try{console.log(`[WS ${m}] flushing ${h.length} early messages`)}catch{}for(let g of h)try{p(g)}catch(b){try{console.error(`[WS ${m}] error flushing buffered message:`,b)}catch{}}fDe.delete(u)}}catch(p){console.error(`[WS ${m}] Error starting embedded iFlow peer:`,p);let h=p instanceof Error?p.message:String(p);try{u.send(`//stderr [WS ${m}] Error starting embedded iFlow peer: ${h}`)}catch{}try{u.close(1011,"Peer startup error")}catch{}}})(),u.on("message",p=>{let h=u._id??"?",g=AAt.get(u),b=null;if(typeof p=="string"?b=p:Buffer.isBuffer(p)?b=p.toString():b=String(p),!g){if(b&&!b.startsWith("//")){let A=fDe.get(u);if(A){A.push(b);try{console.warn(`[WS ${h}] buffering early message len=${b.length}`)}catch{}}}return}if(b&&!b.startsWith("//")){try{process.env.GEMINI_VERBOSE==="1"&&console.log(`[WS ${h}] inbound ${b.length} bytes: ${b.slice(0,80)}`)}catch{}g(b)}}),u.on("close",(p,h)=>{let g=u._id??"?";xfe=Math.max(0,xfe-1);try{console.log(`[WS ${g}] close event code=${p} reason=${h?.toString()||""} (remaining=${xfe})`)}catch{}AAt.delete(u),fDe.delete(u)})}),{server:s,wss:a}}async function E2u(t,e,r,n,o){let s=o||Number(process.env.PORT||3001),a=5;for(let c=0;c<a;c++){let m=s+c;try{let{server:d}=kio(t,e,r,n,m);return await new Promise((f,p)=>{d.once("error",p),d.listen(m,()=>{d.removeAllListeners("error"),console.log(`\u{1F680} iFlow ACP Server running at http://localhost:${m}`),f()})}),d}catch(d){if(d&&typeof d=="object"&&"code"in d&&d.code==="EADDRINUSE"){console.warn(`Port ${m} in use, retrying...`);continue}throw d}}let{server:u}=kio(t,e,r,n,0);return await new Promise((c,m)=>{u.once("error",m),u.listen(0,()=>{u.removeAllListeners("error");let d=u.address(),f=typeof d=="object"&&d?d.port:"unknown";console.log(`\u{1F680} iFlow ACP Server running at http://localhost:${f} (ephemeral)`),c()})}),u}async function Oio(t,e,r,n,o){t.setUsageMode("sdk");let s=t.getTargetDir(),a={...process.env};a.WORKSPACE_ROOT=s,t.getDebugMode()&&(a.GEMINI_VERBOSE="1"),process.env.GEMINI_DISABLE_TOOLS&&(a.GEMINI_DISABLE_TOOLS="1");let u=3e3;o?a.PORT=String(o):a.PORT||(a.PORT=String(u)),console.log("[ACP] starting server with:",JSON.stringify({workspace:a.WORKSPACE_ROOT,port:a.PORT,verbose:!!a.GEMINI_VERBOSE,disableTools:!!a.GEMINI_DISABLE_TOOLS,stream:t.getStream()},null,2)),Object.assign(process.env,a);let c=await E2u(t,e,r,n,o),m=f=>{console.log(`
|
|
7330
|
-
[ACP Server] Received ${f}, shutting down gracefully...`);let p=c._wss,h=setTimeout(()=>{console.error("[ACP Server] Forced shutdown after timeout"),process.exit(1)},5e3),g=()=>{c.close(()=>{console.log("[ACP Server] HTTP server closed"),clearTimeout(h);let b=c._cleanupSignals;b&&b(),process.exit(f==="SIGINT"?130:143)})};if(p){console.log("[ACP Server] Closing WebSocket server and connections...");let b=0,A=0;p.clients.forEach(y=>{try{y.terminate(),b++}catch(E){A++,console.warn("[ACP Server] Error terminating WebSocket client:",E)}}),console.log(`[ACP Server] Terminated ${b} clients, ${A} errors`),p.close(()=>{console.log("[ACP Server] WebSocket server closed"),g()})}else g()},d={SIGINT:()=>m("SIGINT"),SIGTERM:()=>m("SIGTERM"),SIGHUP:()=>m("SIGHUP")};return process.on("SIGINT",d.SIGINT),process.on("SIGTERM",d.SIGTERM),process.on("SIGHUP",d.SIGHUP),c._cleanupSignals=()=>{process.off("SIGINT",d.SIGINT),process.off("SIGTERM",d.SIGTERM),process.off("SIGHUP",d.SIGHUP)},c}Mt();import pDe from"fs/promises";import*as Nio from"os";import Pio from"path";var v2u=5*1024*1024*1024;async function Bio(t){let e=0;try{let r=await pDe.readdir(t,{withFileTypes:!0});for(let n of r){let o=Pio.join(t,n.name);if(n.isDirectory()){let s=await Bio(o);s!==null&&(e+=s)}else try{let s=await pDe.stat(o);e+=s.size}catch{}}return e}catch{return null}}function C2u(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(2)} KB`:t<1024*1024*1024?`${(t/1024/1024).toFixed(2)} MB`:`${(t/1024/1024/1024).toFixed(2)} GB`}var S2u={id:"global-iflow-dir-size",check:async t=>{try{let e=Tn(),r=await Bio(e);if(r===null)return I.t("userStartupWarnings.iflowDirSizeUnknown");if(r>=v2u){let n=C2u(r);return I.t("userStartupWarnings.iflowDirSize",{size:n})}return null}catch{return I.t("userStartupWarnings.iflowDirSizeUnknown")}}},w2u={id:"home-directory",check:async t=>{try{let[e,r]=await Promise.all([pDe.realpath(t),pDe.realpath(Nio.homedir())]);return e===r?I.t("userStartupWarnings.homeDirectory",{sizeInfo:""}):null}catch{return I.t("userStartupWarnings.fileSystemError")}}},x2u={id:"root-directory",check:async t=>{try{let e=await pDe.realpath(t),r=I.t("userStartupWarnings.rootDirectory");return Pio.dirname(e)===e?r:null}catch{return I.t("userStartupWarnings.fileSystemError")}}},T2u=[w2u,x2u,S2u];async function Lio(t){return(await Promise.all(T2u.map(r=>r.check(t)))).filter(r=>r!==null)}var bDe=Se(Rt(),1);function H2u(t){let e="ipv4first";return t===void 0?e:t==="ipv4first"||t==="verbatim"?t:(console.warn(I.t("gemini.errors.invalidDnsResolutionOrder",{order:t,defaultValue:e})),e)}function V2u(t){let e=woo.totalmem()/1048576,r=j2u.getHeapStatistics(),n=Math.floor(r.heap_size_limit/1024/1024),o=Math.floor(e*.5);return t.getDebugMode()&&console.debug(I.t("gemini.debug.currentHeapSize",{size:n.toFixed(2)})),process.env.IFLOW_CLI_NO_RELAUNCH?[]:o>n?(t.getDebugMode()&&console.debug(I.t("gemini.debug.needToRelaunchWithMoreMemory",{size:o.toFixed(2)})),[`--max-old-space-size=${o}`]):[]}async function W2u(t){let e=[...t,...process.argv.slice(1)],r={...process.env,IFLOW_CLI_NO_RELAUNCH:"true"},n=G2u(process.execPath,e,{stdio:"inherit",env:r});await new Promise(o=>n.on("close",o)),process.exit(0)}function z2u(){console.log(I.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.5.8-beta-20260211"}},r=`crash-${Date.now()}-${process.pid}.json`,n=$2u.join(process.cwd(),r);try{q2u.writeFileSync(n,JSON.stringify(e,null,2)),console.error(I.t("gemini.crashDetected",{crashFilePath:n})),console.error(I.t("gemini.coreDumpWillBeGenerated"))}catch(o){console.error(I.t("gemini.failedToWriteCrashFile"),o)}process.abort()}),process.on("warning",t=>{console.warn(I.t("gemini.debug.nodejsWarning"),{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error(I.t("gemini.debug.unhandledPromiseRejectionDetected"),{reason:t,promise:e.toString()})})}async function xoo(){if(cAt(),cio(),woo.platform()==="win32")try{let{execSync:b}=await import("node:child_process");b("chcp 65001",{stdio:"ignore"})}catch{}let t=process.cwd(),e=du(t);if(!e.user.settings.cna){let b=await vGe();b&&e.setValue("User","cna",b)}if(e.errors.length>0){for(let b of e.errors){let A=I.t("gemini.errorInFile",{path:b.path,message:b.message});process.env.NO_COLOR||(A=`\x1B[31m${A}\x1B[0m`),console.error(A),console.error(I.t("gemini.pleaseFixFileAndTryAgain",{path:b.path}))}process.exit(1)}let r=await Oht(),n=typeof r.resume=="string";(!!r.prompt&&!r.promptInteractive&&!r.continue&&(!r.resume||n)||r.experimentalAcp)&&(process.env.IFLOW_NON_INTERACTIVE="true");let s=J$(t),a=n&&typeof r.resume=="string"?r.resume:Gg.generateSessionId(),u=await HK(e.merged,s,a,r),c=await Xde(u);if(c&&(global.statuslineOutput=c),I.changeLanguage(u.getLanguage()),u.getDebugMode()&&z2u(),Q2u.setDefaultResultOrder(H2u(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error(I.t("gemini.errors.promptInteractiveFlagNotSupported")),process.exit(1)),u.getListExtensions()){console.debug(I.t("gemini.installedExtensions"));for(let b of s)console.debug(`- ${b.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:b}=await Promise.resolve().then(()=>(f9r(),J$i)),A=(await Promise.resolve().then(()=>(xvr(),wvr))).default;await A().scriptName("iflow").command(b).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:b}=await Promise.resolve().then(()=>(m9r(),M$i)),A=(await Promise.resolve().then(()=>(xvr(),wvr))).default;await A().scriptName("iflow").command(b).help().version(!1).parse(),process.exit(0)}if(e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",er.CLOUD_SHELL),$Hi(u.getDebugMode()),await u.initialize(),u.getExperimentalAcp()?u.setUsageMode("sdk"):u.setUsageMode("interactive"),Sa.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(Sa.setActiveTheme(e.merged.theme)||console.warn(I.t("gemini.themeNotFound",{theme:e.merged.theme}))),!process.env.SANDBOX){let b=e.merged.autoConfigureMaxOldSpaceSize?V2u(u):[],A=u.getSandbox();if(A){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let y=W$(e.merged.selectedAuthType);if(y)throw new Error(y);await u.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(y){y instanceof Error&&y.message.includes("SERVER_OAUTH2_REQUIRED")?(console.error(I.t("gemini.serverOAuth2Required")||"\u68C0\u6D4B\u5230\u670D\u52A1\u5668\u73AF\u5883\uFF0C\u9700\u8981\u624B\u52A8\u8FDB\u884COAuth2\u8BA4\u8BC1\u3002\u8BF7\u5728\u975E\u6C99\u7BB1\u6A21\u5F0F\u4E0B\u8FD0\u884CCLI\u8FDB\u884C\u8BA4\u8BC1\u3002"),console.error("\u8BF7\u5C1D\u8BD5\u4E0D\u4F7F\u7528\u6C99\u7BB1\u6A21\u5F0F\u542F\u52A8\uFF0C\u6216\u8005\u5148\u5728\u672C\u5730\u73AF\u5883\u4E0B\u5B8C\u6210\u8BA4\u8BC1\u3002")):console.error(I.t("gemini.errorAuthenticating"),y),process.exit(1)}await nio(A,b,u),process.exit(0)}else b.length>0&&(await W2u(b),process.exit(0))}if(e.merged.selectedAuthType===er.LOGIN_WITH_IFLOW&&u.isBrowserLaunchSuppressed())try{await lG(e.merged.selectedAuthType,u)}catch(b){if(!(b instanceof Error&&b.message.includes("SERVER_OAUTH2_REQUIRED")))throw b}if(u.getExperimentalAcp())return u.getAcpPort()?await Oio(u,e,s,r,u.getAcpPort()):wio(u,e,s,r);let m=u.getQuestion(),d=[...await iio(),...await Lio(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume&&!n||process.stdin.isTTY&&m?.length===0){console.clear();let b=await fI();Soo(Coo(t),e);try{await VVi()}catch(x){u.getDebugMode()&&console.warn("Failed to detect/enable Kitty protocol:",x)}u.setIdeModeAndSyncConnection(!0).catch(x=>{console.error(I.t("gemini.failedToConnectToIdeServer"),x)});let A,y=async()=>{try{if(console.clear(),Soo(Coo(t),e),A)try{A.unmount(),await new Promise(R=>process.nextTick(R))}catch(R){console.error(I.t("gemini.errorDuringUnmount"),R)}let{executeSessionStartHooks:x}=await Promise.resolve().then(()=>(Cj(),lJ)),k=await x(u,"resume");A=K7e((0,bDe.jsx)(Tvr.default.StrictMode,{children:(0,bDe.jsx)(NEr,{instance:()=>A,config:u,settings:e,startupWarnings:d,version:b,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0,sessionStartContext:k})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:fyr(),maxFps:20})}catch(x){console.error(I.t("gemini.errorDuringResume"),x)}};process.on("SIGCONT",y),Bxe(()=>{process.off("SIGCONT",y)});let E="startup";(r.continue||r.resume)&&(E="resume");let{executeSessionStartHooks:v}=await Promise.resolve().then(()=>(Cj(),lJ)),C=await v(u,E);A=K7e((0,bDe.jsx)(Tvr.default.StrictMode,{children:(0,bDe.jsx)(NEr,{instance:()=>A,config:u,settings:e,startupWarnings:d,version:b,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,sessionStartContext:C})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:fyr()}),e.merged.disableAutoUpdate||bbt().then(x=>{cji(x,e,u.getProjectRoot())}).catch(x=>{u.getDebugMode()&&console.error(I.t("gemini.updateCheckFailed"),x)}),Bxe(()=>A.unmount());return}!process.stdin.isTTY&&!m&&(m+=await Zno()),m||(console.error(I.t("gemini.noInputProvidedViaStdin")),process.exit(1));let p=Math.random().toString(16).slice(2);Vne(u,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:m,prompt_id:p,auth_type:u.getContentGeneratorConfig()?.authType,prompt_length:m.length});let h=await Y2u(u,s,e,r),g=r.outputFile||r.output_file;await uio(h,m,p,g),process.exit(0)}function Soo(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 Y2u(t,e,r,n){let o=t;if(t.getApprovalMode()!==dn.YOLO){let s=r.merged.excludeTools||[],a=[Hu.Name,Nd.Name,C0.Name],u=[...new Set([...s,...a])],c={...r.merged,excludeTools:u},m={...n};o=await HK(c,e,t.getSessionId(),m),await o.initialize()}return await K2u(r.merged.selectedAuthType,o,r)}async function K2u(t,e,r){!t&&!process.env.IFLOW_API_KEY&&!GGe()&&(console.error(I.t("gemini.pleaseSetAuthMethod",{userSettingsPath:IK})),process.exit(1)),t||(GGe()?t=er.IFLOW:t=er.IFLOW);let n=W$(t);return n!=null&&(console.error(n),process.exit(1)),await e.refreshAuth(t,{apiKey:r.merged.apiKey,baseUrl:r.merged.baseUrl,modelName:e.getModel()}),e}xoo().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
|
|
7330
|
+
[ACP Server] Received ${f}, shutting down gracefully...`);let p=c._wss,h=setTimeout(()=>{console.error("[ACP Server] Forced shutdown after timeout"),process.exit(1)},5e3),g=()=>{c.close(()=>{console.log("[ACP Server] HTTP server closed"),clearTimeout(h);let b=c._cleanupSignals;b&&b(),process.exit(f==="SIGINT"?130:143)})};if(p){console.log("[ACP Server] Closing WebSocket server and connections...");let b=0,A=0;p.clients.forEach(y=>{try{y.terminate(),b++}catch(E){A++,console.warn("[ACP Server] Error terminating WebSocket client:",E)}}),console.log(`[ACP Server] Terminated ${b} clients, ${A} errors`),p.close(()=>{console.log("[ACP Server] WebSocket server closed"),g()})}else g()},d={SIGINT:()=>m("SIGINT"),SIGTERM:()=>m("SIGTERM"),SIGHUP:()=>m("SIGHUP")};return process.on("SIGINT",d.SIGINT),process.on("SIGTERM",d.SIGTERM),process.on("SIGHUP",d.SIGHUP),c._cleanupSignals=()=>{process.off("SIGINT",d.SIGINT),process.off("SIGTERM",d.SIGTERM),process.off("SIGHUP",d.SIGHUP)},c}Mt();import pDe from"fs/promises";import*as Nio from"os";import Pio from"path";var v2u=5*1024*1024*1024;async function Bio(t){let e=0;try{let r=await pDe.readdir(t,{withFileTypes:!0});for(let n of r){let o=Pio.join(t,n.name);if(n.isDirectory()){let s=await Bio(o);s!==null&&(e+=s)}else try{let s=await pDe.stat(o);e+=s.size}catch{}}return e}catch{return null}}function C2u(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(2)} KB`:t<1024*1024*1024?`${(t/1024/1024).toFixed(2)} MB`:`${(t/1024/1024/1024).toFixed(2)} GB`}var S2u={id:"global-iflow-dir-size",check:async t=>{try{let e=Tn(),r=await Bio(e);if(r===null)return I.t("userStartupWarnings.iflowDirSizeUnknown");if(r>=v2u){let n=C2u(r);return I.t("userStartupWarnings.iflowDirSize",{size:n})}return null}catch{return I.t("userStartupWarnings.iflowDirSizeUnknown")}}},w2u={id:"home-directory",check:async t=>{try{let[e,r]=await Promise.all([pDe.realpath(t),pDe.realpath(Nio.homedir())]);return e===r?I.t("userStartupWarnings.homeDirectory",{sizeInfo:""}):null}catch{return I.t("userStartupWarnings.fileSystemError")}}},x2u={id:"root-directory",check:async t=>{try{let e=await pDe.realpath(t),r=I.t("userStartupWarnings.rootDirectory");return Pio.dirname(e)===e?r:null}catch{return I.t("userStartupWarnings.fileSystemError")}}},T2u=[w2u,x2u,S2u];async function Lio(t){return(await Promise.all(T2u.map(r=>r.check(t)))).filter(r=>r!==null)}var bDe=Se(Rt(),1);function H2u(t){let e="ipv4first";return t===void 0?e:t==="ipv4first"||t==="verbatim"?t:(console.warn(I.t("gemini.errors.invalidDnsResolutionOrder",{order:t,defaultValue:e})),e)}function V2u(t){let e=woo.totalmem()/1048576,r=j2u.getHeapStatistics(),n=Math.floor(r.heap_size_limit/1024/1024),o=Math.floor(e*.5);return t.getDebugMode()&&console.debug(I.t("gemini.debug.currentHeapSize",{size:n.toFixed(2)})),process.env.IFLOW_CLI_NO_RELAUNCH?[]:o>n?(t.getDebugMode()&&console.debug(I.t("gemini.debug.needToRelaunchWithMoreMemory",{size:o.toFixed(2)})),[`--max-old-space-size=${o}`]):[]}async function W2u(t){let e=[...t,...process.argv.slice(1)],r={...process.env,IFLOW_CLI_NO_RELAUNCH:"true"},n=G2u(process.execPath,e,{stdio:"inherit",env:r});await new Promise(o=>n.on("close",o)),process.exit(0)}function z2u(){console.log(I.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.5.10"}},r=`crash-${Date.now()}-${process.pid}.json`,n=$2u.join(process.cwd(),r);try{q2u.writeFileSync(n,JSON.stringify(e,null,2)),console.error(I.t("gemini.crashDetected",{crashFilePath:n})),console.error(I.t("gemini.coreDumpWillBeGenerated"))}catch(o){console.error(I.t("gemini.failedToWriteCrashFile"),o)}process.abort()}),process.on("warning",t=>{console.warn(I.t("gemini.debug.nodejsWarning"),{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error(I.t("gemini.debug.unhandledPromiseRejectionDetected"),{reason:t,promise:e.toString()})})}async function xoo(){if(cAt(),cio(),woo.platform()==="win32")try{let{execSync:b}=await import("node:child_process");b("chcp 65001",{stdio:"ignore"})}catch{}let t=process.cwd(),e=du(t);if(!e.user.settings.cna){let b=await vGe();b&&e.setValue("User","cna",b)}if(e.errors.length>0){for(let b of e.errors){let A=I.t("gemini.errorInFile",{path:b.path,message:b.message});process.env.NO_COLOR||(A=`\x1B[31m${A}\x1B[0m`),console.error(A),console.error(I.t("gemini.pleaseFixFileAndTryAgain",{path:b.path}))}process.exit(1)}let r=await Oht(),n=typeof r.resume=="string";(!!r.prompt&&!r.promptInteractive&&!r.continue&&(!r.resume||n)||r.experimentalAcp)&&(process.env.IFLOW_NON_INTERACTIVE="true");let s=J$(t),a=n&&typeof r.resume=="string"?r.resume:Gg.generateSessionId(),u=await HK(e.merged,s,a,r),c=await Xde(u);if(c&&(global.statuslineOutput=c),I.changeLanguage(u.getLanguage()),u.getDebugMode()&&z2u(),Q2u.setDefaultResultOrder(H2u(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error(I.t("gemini.errors.promptInteractiveFlagNotSupported")),process.exit(1)),u.getListExtensions()){console.debug(I.t("gemini.installedExtensions"));for(let b of s)console.debug(`- ${b.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:b}=await Promise.resolve().then(()=>(f9r(),J$i)),A=(await Promise.resolve().then(()=>(xvr(),wvr))).default;await A().scriptName("iflow").command(b).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:b}=await Promise.resolve().then(()=>(m9r(),M$i)),A=(await Promise.resolve().then(()=>(xvr(),wvr))).default;await A().scriptName("iflow").command(b).help().version(!1).parse(),process.exit(0)}if(e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",er.CLOUD_SHELL),$Hi(u.getDebugMode()),await u.initialize(),u.getExperimentalAcp()?u.setUsageMode("sdk"):u.setUsageMode("interactive"),Sa.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(Sa.setActiveTheme(e.merged.theme)||console.warn(I.t("gemini.themeNotFound",{theme:e.merged.theme}))),!process.env.SANDBOX){let b=e.merged.autoConfigureMaxOldSpaceSize?V2u(u):[],A=u.getSandbox();if(A){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let y=W$(e.merged.selectedAuthType);if(y)throw new Error(y);await u.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(y){y instanceof Error&&y.message.includes("SERVER_OAUTH2_REQUIRED")?(console.error(I.t("gemini.serverOAuth2Required")||"\u68C0\u6D4B\u5230\u670D\u52A1\u5668\u73AF\u5883\uFF0C\u9700\u8981\u624B\u52A8\u8FDB\u884COAuth2\u8BA4\u8BC1\u3002\u8BF7\u5728\u975E\u6C99\u7BB1\u6A21\u5F0F\u4E0B\u8FD0\u884CCLI\u8FDB\u884C\u8BA4\u8BC1\u3002"),console.error("\u8BF7\u5C1D\u8BD5\u4E0D\u4F7F\u7528\u6C99\u7BB1\u6A21\u5F0F\u542F\u52A8\uFF0C\u6216\u8005\u5148\u5728\u672C\u5730\u73AF\u5883\u4E0B\u5B8C\u6210\u8BA4\u8BC1\u3002")):console.error(I.t("gemini.errorAuthenticating"),y),process.exit(1)}await nio(A,b,u),process.exit(0)}else b.length>0&&(await W2u(b),process.exit(0))}if(e.merged.selectedAuthType===er.LOGIN_WITH_IFLOW&&u.isBrowserLaunchSuppressed())try{await lG(e.merged.selectedAuthType,u)}catch(b){if(!(b instanceof Error&&b.message.includes("SERVER_OAUTH2_REQUIRED")))throw b}if(u.getExperimentalAcp())return u.getAcpPort()?await Oio(u,e,s,r,u.getAcpPort()):wio(u,e,s,r);let m=u.getQuestion(),d=[...await iio(),...await Lio(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume&&!n||process.stdin.isTTY&&m?.length===0){console.clear();let b=await fI();Soo(Coo(t),e);try{await VVi()}catch(x){u.getDebugMode()&&console.warn("Failed to detect/enable Kitty protocol:",x)}u.setIdeModeAndSyncConnection(!0).catch(x=>{console.error(I.t("gemini.failedToConnectToIdeServer"),x)});let A,y=async()=>{try{if(console.clear(),Soo(Coo(t),e),A)try{A.unmount(),await new Promise(R=>process.nextTick(R))}catch(R){console.error(I.t("gemini.errorDuringUnmount"),R)}let{executeSessionStartHooks:x}=await Promise.resolve().then(()=>(Cj(),lJ)),k=await x(u,"resume");A=K7e((0,bDe.jsx)(Tvr.default.StrictMode,{children:(0,bDe.jsx)(NEr,{instance:()=>A,config:u,settings:e,startupWarnings:d,version:b,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0,sessionStartContext:k})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:fyr(),maxFps:20})}catch(x){console.error(I.t("gemini.errorDuringResume"),x)}};process.on("SIGCONT",y),Bxe(()=>{process.off("SIGCONT",y)});let E="startup";(r.continue||r.resume)&&(E="resume");let{executeSessionStartHooks:v}=await Promise.resolve().then(()=>(Cj(),lJ)),C=await v(u,E);A=K7e((0,bDe.jsx)(Tvr.default.StrictMode,{children:(0,bDe.jsx)(NEr,{instance:()=>A,config:u,settings:e,startupWarnings:d,version:b,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,sessionStartContext:C})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1,stdout:fyr()}),e.merged.disableAutoUpdate||bbt().then(x=>{cji(x,e,u.getProjectRoot())}).catch(x=>{u.getDebugMode()&&console.error(I.t("gemini.updateCheckFailed"),x)}),Bxe(()=>A.unmount());return}!process.stdin.isTTY&&!m&&(m+=await Zno()),m||(console.error(I.t("gemini.noInputProvidedViaStdin")),process.exit(1));let p=Math.random().toString(16).slice(2);Vne(u,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:m,prompt_id:p,auth_type:u.getContentGeneratorConfig()?.authType,prompt_length:m.length});let h=await Y2u(u,s,e,r),g=r.outputFile||r.output_file;await uio(h,m,p,g),process.exit(0)}function Soo(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 Y2u(t,e,r,n){let o=t;if(t.getApprovalMode()!==dn.YOLO){let s=r.merged.excludeTools||[],a=[Hu.Name,Nd.Name,C0.Name],u=[...new Set([...s,...a])],c={...r.merged,excludeTools:u},m={...n};o=await HK(c,e,t.getSessionId(),m),await o.initialize()}return await K2u(r.merged.selectedAuthType,o,r)}async function K2u(t,e,r){!t&&!process.env.IFLOW_API_KEY&&!GGe()&&(console.error(I.t("gemini.pleaseSetAuthMethod",{userSettingsPath:IK})),process.exit(1)),t||(GGe()?t=er.IFLOW:t=er.IFLOW);let n=W$(t);return n!=null&&(console.error(n),process.exit(1)),await e.refreshAuth(t,{apiKey:r.merged.apiKey,baseUrl:r.merged.baseUrl,modelName:e.getModel()}),e}xoo().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
|
|
7331
7331
|
/**
|
|
7332
7332
|
* @license
|
|
7333
7333
|
* Copyright 2025 Google LLC
|