@sourcegraph/amp 0.0.1764273685-g926f68 → 0.0.1764288114-gd779fe

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +3 -2
  2. package/dist/main.js +12 -12
  3. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -45,7 +45,7 @@ ${q}`.trim()}_serializeSingularDataPoint(J,Q,Y){let X="";J=DG1(J,Q);let{value:G,
45
45
  ${X}
46
46
  ${G}
47
47
  `}}RW0.PrometheusSerializer=TW0});var _W0=f((jW0)=>{Object.defineProperty(jW0,"__esModule",{value:!0});jW0.PrometheusExporter=void 0;var y_=b6(),e74=q8(),AG1=LD(),J24=k1("http"),Q24=LG1(),Y24=k1("url");class _W extends AG1.MetricReader{static DEFAULT_OPTIONS={host:void 0,port:9464,endpoint:"/metrics",prefix:"",appendTimestamp:!1,withResourceConstantLabels:void 0,withoutTargetInfo:!1};_host;_port;_baseUrl;_endpoint;_server;_prefix;_appendTimestamp;_serializer;_startServerPromise;constructor(J={},Q=()=>{}){super({aggregationSelector:(G)=>{return{type:AG1.AggregationType.DEFAULT}},aggregationTemporalitySelector:(G)=>AG1.AggregationTemporality.CUMULATIVE,metricProducers:J.metricProducers});this._host=J.host||process.env.OTEL_EXPORTER_PROMETHEUS_HOST||_W.DEFAULT_OPTIONS.host,this._port=J.port||Number(process.env.OTEL_EXPORTER_PROMETHEUS_PORT)||_W.DEFAULT_OPTIONS.port,this._prefix=J.prefix||_W.DEFAULT_OPTIONS.prefix,this._appendTimestamp=typeof J.appendTimestamp==="boolean"?J.appendTimestamp:_W.DEFAULT_OPTIONS.appendTimestamp;let Y=J.withResourceConstantLabels||_W.DEFAULT_OPTIONS.withResourceConstantLabels,X=J.withoutTargetInfo||_W.DEFAULT_OPTIONS.withoutTargetInfo;if(this._server=(0,J24.createServer)(this._requestHandler).unref(),this._serializer=new Q24.PrometheusSerializer(this._prefix,this._appendTimestamp,Y,X),this._baseUrl=`http://${this._host}:${this._port}/`,this._endpoint=(J.endpoint||_W.DEFAULT_OPTIONS.endpoint).replace(/^([^/])/,"/$1"),J.preventServerStart!==!0)this.startServer().then(Q,(G)=>{y_.diag.error(G),Q(G)});else if(Q)queueMicrotask(Q)}async onForceFlush(){}onShutdown(){return this.stopServer()}stopServer(){if(!this._server)return y_.diag.debug("Prometheus stopServer() was called but server was never started."),Promise.resolve();else return new Promise((J)=>{this._server.close((Q)=>{if(!Q)y_.diag.debug("Prometheus exporter was stopped");else if(Q.code!=="ERR_SERVER_NOT_RUNNING")(0,e74.globalErrorHandler)(Q);J()})})}startServer(){return this._startServerPromise??=new Promise((J,Q)=>{this._server.once("error",Q),this._server.listen({port:this._port,host:this._host},()=>{y_.diag.debug(`Prometheus exporter server started: ${this._host}:${this._port}/${this._endpoint}`),J()})}),this._startServerPromise}getMetricsRequestHandler(J,Q){this._exportMetrics(Q)}_requestHandler=(J,Q)=>{if(J.url!=null&&new Y24.URL(J.url,this._baseUrl).pathname===this._endpoint)this._exportMetrics(Q);else this._notFound(Q)};_exportMetrics=(J)=>{J.statusCode=200,J.setHeader("content-type","text/plain"),this.collect().then((Q)=>{let{resourceMetrics:Y,errors:X}=Q;if(X.length)y_.diag.error("PrometheusExporter: metrics collection errors",...X);J.end(this._serializer.serialize(Y))},(Q)=>{J.end(`# failed to export metrics: ${Q}`)})};_notFound=(J)=>{J.statusCode=404,J.end()}}jW0.PrometheusExporter=_W});var kW0=f((dc)=>{Object.defineProperty(dc,"__esModule",{value:!0});dc.PrometheusSerializer=dc.PrometheusExporter=void 0;var X24=_W0();Object.defineProperty(dc,"PrometheusExporter",{enumerable:!0,get:function(){return X24.PrometheusExporter}});var G24=LG1();Object.defineProperty(dc,"PrometheusSerializer",{enumerable:!0,get:function(){return G24.PrometheusSerializer}})});var hW0=f((vW0)=>{Object.defineProperty(vW0,"__esModule",{value:!0});vW0.OTLPTraceExporter=void 0;var $24=YV(),q24=q$(),yW0=OW();class xW0 extends $24.OTLPExporterBase{constructor(J={}){super((0,yW0.createOtlpHttpExportDelegate)((0,yW0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/x-protobuf"}),q24.ProtobufTraceSerializer))}}vW0.OTLPTraceExporter=xW0});var bW0=f((OG1)=>{Object.defineProperty(OG1,"__esModule",{value:!0});OG1.OTLPTraceExporter=void 0;var V24=hW0();Object.defineProperty(OG1,"OTLPTraceExporter",{enumerable:!0,get:function(){return V24.OTLPTraceExporter}})});var gW0=f((wG1)=>{Object.defineProperty(wG1,"__esModule",{value:!0});wG1.OTLPTraceExporter=void 0;var W24=bW0();Object.defineProperty(wG1,"OTLPTraceExporter",{enumerable:!0,get:function(){return W24.OTLPTraceExporter}})});var mW0=f((EG1)=>{Object.defineProperty(EG1,"__esModule",{value:!0});EG1.OTLPTraceExporter=void 0;var z24=gW0();Object.defineProperty(EG1,"OTLPTraceExporter",{enumerable:!0,get:function(){return z24.OTLPTraceExporter}})});var lW0=f((dW0)=>{Object.defineProperty(dW0,"__esModule",{value:!0});dW0.OTLPTraceExporter=void 0;var U24=YV(),B24=q$(),uW0=OW();class pW0 extends U24.OTLPExporterBase{constructor(J={}){super((0,uW0.createOtlpHttpExportDelegate)((0,uW0.convertLegacyHttpOptions)(J,"TRACES","v1/traces",{"Content-Type":"application/json"}),B24.JsonTraceSerializer))}}dW0.OTLPTraceExporter=pW0});var iW0=f((IG1)=>{Object.defineProperty(IG1,"__esModule",{value:!0});IG1.OTLPTraceExporter=void 0;var N24=lW0();Object.defineProperty(IG1,"OTLPTraceExporter",{enumerable:!0,get:function(){return N24.OTLPTraceExporter}})});var nW0=f((PG1)=>{Object.defineProperty(PG1,"__esModule",{value:!0});PG1.OTLPTraceExporter=void 0;var M24=iW0();Object.defineProperty(PG1,"OTLPTraceExporter",{enumerable:!0,get:function(){return M24.OTLPTraceExporter}})});var aW0=f((TG1)=>{Object.defineProperty(TG1,"__esModule",{value:!0});TG1.OTLPTraceExporter=void 0;var A24=nW0();Object.defineProperty(TG1,"OTLPTraceExporter",{enumerable:!0,get:function(){return A24.OTLPTraceExporter}})});var eW0=f((sW0)=>{Object.defineProperty(sW0,"__esModule",{value:!0});sW0.OTLPTraceExporter=void 0;var oW0=hc(),w24=q$(),E24=YV();class rW0 extends E24.OTLPExporterBase{constructor(J={}){super((0,oW0.createOtlpGrpcExportDelegate)((0,oW0.convertLegacyOtlpGrpcOptions)(J,"TRACES"),w24.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}}sW0.OTLPTraceExporter=rW0});var JH0=f((RG1)=>{Object.defineProperty(RG1,"__esModule",{value:!0});RG1.OTLPTraceExporter=void 0;var I24=eW0();Object.defineProperty(RG1,"OTLPTraceExporter",{enumerable:!0,get:function(){return I24.OTLPTraceExporter}})});var XH0=f((QH0)=>{Object.defineProperty(QH0,"__esModule",{value:!0});QH0.prepareSend=void 0;var CG1=b6(),cc=q8(),T24=k1("http"),R24=k1("https");function C24(J,Q){let Y=new URL(J),X=Object.assign({method:"POST",headers:{"Content-Type":"application/json",...Q}});return function(Z,q){if(Z.length===0)return CG1.diag.debug("Zipkin send with empty spans"),q({code:cc.ExportResultCode.SUCCESS});let{request:V}=Y.protocol==="http:"?T24:R24,K=V(Y,X,(H)=>{let z="";H.on("data",(U)=>{z+=U}),H.on("end",()=>{let U=H.statusCode||0;if(CG1.diag.debug(`Zipkin response status code: ${U}, body: ${z}`),U<400)return q({code:cc.ExportResultCode.SUCCESS});else return q({code:cc.ExportResultCode.FAILED,error:Error(`Got unexpected status code from zipkin: ${U}`)})})});K.on("error",(H)=>{return q({code:cc.ExportResultCode.FAILED,error:H})});let W=JSON.stringify(Z);CG1.diag.debug(`Zipkin request payload: ${W}`),K.write(W,"utf8"),K.end()}}QH0.prepareSend=C24});var GH0=f((jG1)=>{Object.defineProperty(jG1,"__esModule",{value:!0});jG1.prepareSend=void 0;var j24=XH0();Object.defineProperty(jG1,"prepareSend",{enumerable:!0,get:function(){return j24.prepareSend}})});var _G1=f((SG1)=>{Object.defineProperty(SG1,"__esModule",{value:!0});SG1.prepareSend=void 0;var _24=GH0();Object.defineProperty(SG1,"prepareSend",{enumerable:!0,get:function(){return _24.prepareSend}})});var $H0=f((ZH0)=>{Object.defineProperty(ZH0,"__esModule",{value:!0});ZH0.SpanKind=void 0;var y24;(function(J){J.CLIENT="CLIENT",J.SERVER="SERVER",J.CONSUMER="CONSUMER",J.PRODUCER="PRODUCER"})(y24=ZH0.SpanKind||(ZH0.SpanKind={}))});var HH0=f((KH0)=>{Object.defineProperty(KH0,"__esModule",{value:!0});KH0._toZipkinAnnotations=KH0._toZipkinTags=KH0.toZipkinSpan=KH0.defaultStatusErrorTagName=KH0.defaultStatusCodeTagName=void 0;var wF=b6(),yG1=q8(),lc=$H0(),x24={[wF.SpanKind.CLIENT]:lc.SpanKind.CLIENT,[wF.SpanKind.SERVER]:lc.SpanKind.SERVER,[wF.SpanKind.CONSUMER]:lc.SpanKind.CONSUMER,[wF.SpanKind.PRODUCER]:lc.SpanKind.PRODUCER,[wF.SpanKind.INTERNAL]:void 0};KH0.defaultStatusCodeTagName="otel.status_code";KH0.defaultStatusErrorTagName="error";function v24(J,Q,Y,X){return{traceId:J.spanContext().traceId,parentId:J.parentSpanContext?.spanId,name:J.name,id:J.spanContext().spanId,kind:x24[J.kind],timestamp:(0,yG1.hrTimeToMicroseconds)(J.startTime),duration:Math.round((0,yG1.hrTimeToMicroseconds)(J.duration)),localEndpoint:{serviceName:Q},tags:qH0(J,Y,X),annotations:J.events.length?VH0(J.events):void 0}}KH0.toZipkinSpan=v24;function qH0({attributes:J,resource:Q,status:Y,droppedAttributesCount:X,droppedEventsCount:G,droppedLinksCount:Z},q,V){let K={};for(let W of Object.keys(J))K[W]=String(J[W]);if(Y.code!==wF.SpanStatusCode.UNSET)K[q]=String(wF.SpanStatusCode[Y.code]);if(Y.code===wF.SpanStatusCode.ERROR&&Y.message)K[V]=Y.message;if(X)K["otel.dropped_attributes_count"]=String(X);if(G)K["otel.dropped_events_count"]=String(G);if(Z)K["otel.dropped_links_count"]=String(Z);return Object.keys(Q.attributes).forEach((W)=>K[W]=String(Q.attributes[W])),K}KH0._toZipkinTags=qH0;function VH0(J){return J.map((Q)=>({timestamp:Math.round((0,yG1.hrTimeToMicroseconds)(Q.time)),value:Q.name}))}KH0._toZipkinAnnotations=VH0});var UH0=f((zH0)=>{Object.defineProperty(zH0,"__esModule",{value:!0});zH0.prepareGetHeaders=void 0;function m24(J){return function(){return J()}}zH0.prepareGetHeaders=m24});var OH0=f((LH0)=>{Object.defineProperty(LH0,"__esModule",{value:!0});LH0.ZipkinExporter=void 0;var BH0=b6(),NH0=q8(),DH0=_G1(),xG1=HH0(),vG1=JF(),u24=UH0();class MH0{DEFAULT_SERVICE_NAME="OpenTelemetry Service";_statusCodeTagName;_statusDescriptionTagName;_urlStr;_send;_getHeaders;_serviceName;_isShutdown;_sendingPromises=[];constructor(J={}){if(this._urlStr=J.url||((0,NH0.getStringFromEnv)("OTEL_EXPORTER_ZIPKIN_ENDPOINT")??"http://localhost:9411/api/v2/spans"),this._send=(0,DH0.prepareSend)(this._urlStr,J.headers),this._serviceName=J.serviceName,this._statusCodeTagName=J.statusCodeTagName||xG1.defaultStatusCodeTagName,this._statusDescriptionTagName=J.statusDescriptionTagName||xG1.defaultStatusErrorTagName,this._isShutdown=!1,typeof J.getExportRequestHeaders==="function")this._getHeaders=(0,u24.prepareGetHeaders)(J.getExportRequestHeaders);else this._beforeSend=function(){}}export(J,Q){let Y=String(this._serviceName||J[0].resource.attributes[vG1.ATTR_SERVICE_NAME]||this.DEFAULT_SERVICE_NAME);if(BH0.diag.debug("Zipkin exporter export"),this._isShutdown){setTimeout(()=>Q({code:NH0.ExportResultCode.FAILED,error:Error("Exporter has been shutdown")}));return}let X=new Promise((Z)=>{this._sendSpans(J,Y,(q)=>{Z(),Q(q)})});this._sendingPromises.push(X);let G=()=>{let Z=this._sendingPromises.indexOf(X);this._sendingPromises.splice(Z,1)};X.then(G,G)}shutdown(){return BH0.diag.debug("Zipkin exporter shutdown"),this._isShutdown=!0,this.forceFlush()}forceFlush(){return new Promise((J,Q)=>{Promise.all(this._sendingPromises).then(()=>{J()},Q)})}_beforeSend(){if(this._getHeaders)this._send=(0,DH0.prepareSend)(this._urlStr,this._getHeaders())}_sendSpans(J,Q,Y){let X=J.map((G)=>(0,xG1.toZipkinSpan)(G,String(G.attributes[vG1.ATTR_SERVICE_NAME]||G.resource.attributes[vG1.ATTR_SERVICE_NAME]||Q),this._statusCodeTagName,this._statusDescriptionTagName));return this._beforeSend(),this._send(X,(G)=>{if(Y)return Y(G)})}}LH0.ZipkinExporter=MH0});var wH0=f((ic)=>{Object.defineProperty(ic,"__esModule",{value:!0});ic.ZipkinExporter=ic.prepareSend=void 0;var p24=_G1();Object.defineProperty(ic,"prepareSend",{enumerable:!0,get:function(){return p24.prepareSend}});var d24=OH0();Object.defineProperty(ic,"ZipkinExporter",{enumerable:!0,get:function(){return d24.ZipkinExporter}})});var fG1=f((EH0)=>{Object.defineProperty(EH0,"__esModule",{value:!0});EH0.B3_DEBUG_FLAG_KEY=void 0;var l24=b6();EH0.B3_DEBUG_FLAG_KEY=(0,l24.createContextKey)("OpenTelemetry Context Key B3 Debug Flag")});var x_=f((PH0)=>{Object.defineProperty(PH0,"__esModule",{value:!0});PH0.X_B3_FLAGS=PH0.X_B3_PARENT_SPAN_ID=PH0.X_B3_SAMPLED=PH0.X_B3_SPAN_ID=PH0.X_B3_TRACE_ID=PH0.B3_CONTEXT_HEADER=void 0;PH0.B3_CONTEXT_HEADER="b3";PH0.X_B3_TRACE_ID="x-b3-traceid";PH0.X_B3_SPAN_ID="x-b3-spanid";PH0.X_B3_SAMPLED="x-b3-sampled";PH0.X_B3_PARENT_SPAN_ID="x-b3-parentspanid";PH0.X_B3_FLAGS="x-b3-flags"});var kH0=f((SH0)=>{Object.defineProperty(SH0,"__esModule",{value:!0});SH0.B3MultiPropagator=void 0;var N$=b6(),s24=q8(),RH0=fG1(),ZX=x_(),t24=new Set([!0,"true","True","1",1]),e24=new Set([!1,"false","False","0",0]);function J34(J){return J===N$.TraceFlags.SAMPLED||J===N$.TraceFlags.NONE}function Q34(J){return Array.isArray(J)?J[0]:J}function nc(J,Q,Y){let X=Q.get(J,Y);return Q34(X)}function Y34(J,Q){let Y=nc(J,Q,ZX.X_B3_TRACE_ID);if(typeof Y==="string")return Y.padStart(32,"0");return""}function X34(J,Q){let Y=nc(J,Q,ZX.X_B3_SPAN_ID);if(typeof Y==="string")return Y;return""}function CH0(J,Q){return nc(J,Q,ZX.X_B3_FLAGS)==="1"?"1":void 0}function G34(J,Q){let Y=nc(J,Q,ZX.X_B3_SAMPLED);if(CH0(J,Q)==="1"||t24.has(Y))return N$.TraceFlags.SAMPLED;if(Y===void 0||e24.has(Y))return N$.TraceFlags.NONE;return}class jH0{inject(J,Q,Y){let X=N$.trace.getSpanContext(J);if(!X||!(0,N$.isSpanContextValid)(X)||(0,s24.isTracingSuppressed)(J))return;let G=J.getValue(RH0.B3_DEBUG_FLAG_KEY);if(Y.set(Q,ZX.X_B3_TRACE_ID,X.traceId),Y.set(Q,ZX.X_B3_SPAN_ID,X.spanId),G==="1")Y.set(Q,ZX.X_B3_FLAGS,G);else if(X.traceFlags!==void 0)Y.set(Q,ZX.X_B3_SAMPLED,(N$.TraceFlags.SAMPLED&X.traceFlags)===N$.TraceFlags.SAMPLED?"1":"0")}extract(J,Q,Y){let X=Y34(Q,Y),G=X34(Q,Y),Z=G34(Q,Y),q=CH0(Q,Y);if((0,N$.isValidTraceId)(X)&&(0,N$.isValidSpanId)(G)&&J34(Z))return J=J.setValue(RH0.B3_DEBUG_FLAG_KEY,q),N$.trace.setSpanContext(J,{traceId:X,spanId:G,isRemote:!0,traceFlags:Z});return J}fields(){return[ZX.X_B3_TRACE_ID,ZX.X_B3_SPAN_ID,ZX.X_B3_FLAGS,ZX.X_B3_SAMPLED,ZX.X_B3_PARENT_SPAN_ID]}}SH0.B3MultiPropagator=jH0});var hH0=f((vH0)=>{Object.defineProperty(vH0,"__esModule",{value:!0});vH0.B3SinglePropagator=void 0;var mD=b6(),Z34=q8(),yH0=fG1(),hG1=x_(),$34=/((?:[0-9a-f]{16}){1,2})-([0-9a-f]{16})(?:-([01d](?![0-9a-f])))?(?:-([0-9a-f]{16}))?/,q34="0".repeat(16),V34=new Set(["d","1"]),K34="d";function W34(J){return J.length===32?J:`${q34}${J}`}function H34(J){if(J&&V34.has(J))return mD.TraceFlags.SAMPLED;return mD.TraceFlags.NONE}class xH0{inject(J,Q,Y){let X=mD.trace.getSpanContext(J);if(!X||!(0,mD.isSpanContextValid)(X)||(0,Z34.isTracingSuppressed)(J))return;let G=J.getValue(yH0.B3_DEBUG_FLAG_KEY)||X.traceFlags&1,Z=`${X.traceId}-${X.spanId}-${G}`;Y.set(Q,hG1.B3_CONTEXT_HEADER,Z)}extract(J,Q,Y){let X=Y.get(Q,hG1.B3_CONTEXT_HEADER),G=Array.isArray(X)?X[0]:X;if(typeof G!=="string")return J;let Z=G.match($34);if(!Z)return J;let[,q,V,K]=Z,W=W34(q);if(!(0,mD.isValidTraceId)(W)||!(0,mD.isValidSpanId)(V))return J;let H=H34(K);if(K===K34)J=J.setValue(yH0.B3_DEBUG_FLAG_KEY,K);return mD.trace.setSpanContext(J,{traceId:W,spanId:V,isRemote:!0,traceFlags:H})}fields(){return[hG1.B3_CONTEXT_HEADER]}}vH0.B3SinglePropagator=xH0});var gG1=f((bH0)=>{Object.defineProperty(bH0,"__esModule",{value:!0});bH0.B3InjectEncoding=void 0;var z34;(function(J){J[J.SINGLE_HEADER=0]="SINGLE_HEADER",J[J.MULTI_HEADER=1]="MULTI_HEADER"})(z34=bH0.B3InjectEncoding||(bH0.B3InjectEncoding={}))});var pH0=f((mH0)=>{Object.defineProperty(mH0,"__esModule",{value:!0});mH0.B3Propagator=void 0;var F34=q8(),U34=kH0(),B34=hH0(),N34=x_(),D34=gG1();class gH0{_b3MultiPropagator=new U34.B3MultiPropagator;_b3SinglePropagator=new B34.B3SinglePropagator;_inject;_fields;constructor(J={}){if(J.injectEncoding===D34.B3InjectEncoding.MULTI_HEADER)this._inject=this._b3MultiPropagator.inject,this._fields=this._b3MultiPropagator.fields();else this._inject=this._b3SinglePropagator.inject,this._fields=this._b3SinglePropagator.fields()}inject(J,Q,Y){if((0,F34.isTracingSuppressed)(J))return;this._inject(J,Q,Y)}extract(J,Q,Y){let X=Y.get(Q,N34.B3_CONTEXT_HEADER);if(Array.isArray(X)?X[0]:X)return this._b3SinglePropagator.extract(J,Q,Y);else return this._b3MultiPropagator.extract(J,Q,Y)}fields(){return this._fields}}mH0.B3Propagator=gH0});var dH0=f((DV)=>{Object.defineProperty(DV,"__esModule",{value:!0});DV.B3InjectEncoding=DV.X_B3_TRACE_ID=DV.X_B3_SPAN_ID=DV.X_B3_SAMPLED=DV.X_B3_PARENT_SPAN_ID=DV.X_B3_FLAGS=DV.B3_CONTEXT_HEADER=DV.B3Propagator=void 0;var M34=pH0();Object.defineProperty(DV,"B3Propagator",{enumerable:!0,get:function(){return M34.B3Propagator}});var GE=x_();Object.defineProperty(DV,"B3_CONTEXT_HEADER",{enumerable:!0,get:function(){return GE.B3_CONTEXT_HEADER}});Object.defineProperty(DV,"X_B3_FLAGS",{enumerable:!0,get:function(){return GE.X_B3_FLAGS}});Object.defineProperty(DV,"X_B3_PARENT_SPAN_ID",{enumerable:!0,get:function(){return GE.X_B3_PARENT_SPAN_ID}});Object.defineProperty(DV,"X_B3_SAMPLED",{enumerable:!0,get:function(){return GE.X_B3_SAMPLED}});Object.defineProperty(DV,"X_B3_SPAN_ID",{enumerable:!0,get:function(){return GE.X_B3_SPAN_ID}});Object.defineProperty(DV,"X_B3_TRACE_ID",{enumerable:!0,get:function(){return GE.X_B3_TRACE_ID}});var L34=gG1();Object.defineProperty(DV,"B3InjectEncoding",{enumerable:!0,get:function(){return L34.B3InjectEncoding}})});var aH0=f((lH0)=>{Object.defineProperty(lH0,"__esModule",{value:!0});lH0.JaegerPropagator=lH0.UBER_BAGGAGE_HEADER_PREFIX=lH0.UBER_TRACE_ID_HEADER=void 0;var uD=b6(),O34=q8();lH0.UBER_TRACE_ID_HEADER="uber-trace-id";lH0.UBER_BAGGAGE_HEADER_PREFIX="uberctx";class cH0{_jaegerTraceHeader;_jaegerBaggageHeaderPrefix;constructor(J){if(typeof J==="string")this._jaegerTraceHeader=J,this._jaegerBaggageHeaderPrefix=lH0.UBER_BAGGAGE_HEADER_PREFIX;else this._jaegerTraceHeader=J?.customTraceHeader||lH0.UBER_TRACE_ID_HEADER,this._jaegerBaggageHeaderPrefix=J?.customBaggageHeaderPrefix||lH0.UBER_BAGGAGE_HEADER_PREFIX}inject(J,Q,Y){let X=uD.trace.getSpanContext(J),G=uD.propagation.getBaggage(J);if(X&&(0,O34.isTracingSuppressed)(J)===!1){let Z=`0${(X.traceFlags||uD.TraceFlags.NONE).toString(16)}`;Y.set(Q,this._jaegerTraceHeader,`${X.traceId}:${X.spanId}:0:${Z}`)}if(G)for(let[Z,q]of G.getAllEntries())Y.set(Q,`${this._jaegerBaggageHeaderPrefix}-${Z}`,encodeURIComponent(q.value))}extract(J,Q,Y){let X=Y.get(Q,this._jaegerTraceHeader),G=Array.isArray(X)?X[0]:X,Z=Y.keys(Q).filter((K)=>K.startsWith(`${this._jaegerBaggageHeaderPrefix}-`)).map((K)=>{let W=Y.get(Q,K);return{key:K.substring(this._jaegerBaggageHeaderPrefix.length+1),value:Array.isArray(W)?W[0]:W}}),q=J;if(typeof G==="string"){let K=E34(G);if(K)q=uD.trace.setSpanContext(q,K)}if(Z.length===0)return q;let V=uD.propagation.getBaggage(J)??uD.propagation.createBaggage();for(let K of Z){if(K.value===void 0)continue;V=V.setEntry(K.key,{value:decodeURIComponent(K.value)})}return q=uD.propagation.setBaggage(q,V),q}fields(){return[this._jaegerTraceHeader]}}lH0.JaegerPropagator=cH0;var w34=/^[0-9a-f]{1,2}$/i;function E34(J){let Q=decodeURIComponent(J).split(":");if(Q.length!==4)return null;let[Y,X,,G]=Q,Z=Y.padStart(32,"0"),q=X.padStart(16,"0"),V=w34.test(G)?parseInt(G,16)&1:1;return{traceId:Z,spanId:q,isRemote:!0,traceFlags:V}}});var oH0=f((v_)=>{Object.defineProperty(v_,"__esModule",{value:!0});v_.UBER_TRACE_ID_HEADER=v_.UBER_BAGGAGE_HEADER_PREFIX=v_.JaegerPropagator=void 0;var uG1=aH0();Object.defineProperty(v_,"JaegerPropagator",{enumerable:!0,get:function(){return uG1.JaegerPropagator}});Object.defineProperty(v_,"UBER_BAGGAGE_HEADER_PREFIX",{enumerable:!0,get:function(){return uG1.UBER_BAGGAGE_HEADER_PREFIX}});Object.defineProperty(v_,"UBER_TRACE_ID_HEADER",{enumerable:!0,get:function(){return uG1.UBER_TRACE_ID_HEADER}})});var Qz0=f((eH0)=>{Object.defineProperty(eH0,"__esModule",{value:!0});eH0.setupPropagator=eH0.setupContextManager=eH0.getPropagatorFromEnv=eH0.getSpanProcessorsFromEnv=eH0.getOtlpProtocolFromEnv=eH0.filterBlanksAndNulls=eH0.getResourceDetectorsFromEnv=void 0;var vG=b6(),D$=q8(),rH0=mW0(),P34=aW0(),T34=JH0(),R34=wH0(),f_=BD(),ac=wD(),pG1=dH0(),C34=oH0(),j34=hu(),S34="env",_34="host",k34="os",y34="process",x34="serviceinstance";function v34(){let J=new Map([[S34,f_.envDetector],[_34,f_.hostDetector],[k34,f_.osDetector],[x34,f_.serviceInstanceIdDetector],[y34,f_.processDetector]]),Q=(0,D$.getStringListFromEnv)("OTEL_NODE_RESOURCE_DETECTORS")??["all"];if(Q.includes("all"))return[...J.values()].flat();if(Q.includes("none"))return[];return Q.flatMap((Y)=>{let X=J.get(Y);if(!X)vG.diag.warn(`Invalid resource detector "${Y}" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`);return X||[]})}eH0.getResourceDetectorsFromEnv=v34;function sH0(J){return J.map((Q)=>Q.trim()).filter((Q)=>Q!=="null"&&Q!=="")}eH0.filterBlanksAndNulls=sH0;function tH0(){return(0,D$.getStringFromEnv)("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL")??(0,D$.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL")??"http/protobuf"}eH0.getOtlpProtocolFromEnv=tH0;function f34(){let J=tH0();switch(J){case"grpc":return new T34.OTLPTraceExporter;case"http/json":return new P34.OTLPTraceExporter;case"http/protobuf":return new rH0.OTLPTraceExporter;default:return vG.diag.warn(`Unsupported OTLP traces protocol: ${J}. Using http/protobuf.`),new rH0.OTLPTraceExporter}}function h34(){let J=new Map([["otlp",()=>f34()],["zipkin",()=>new R34.ZipkinExporter],["console",()=>new ac.ConsoleSpanExporter]]),Q=[],Y=[],X=sH0(Array.from(new Set((0,D$.getStringListFromEnv)("OTEL_TRACES_EXPORTER"))));if(X[0]==="none")return vG.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.'),[];if(X.length===0)vG.diag.debug("OTEL_TRACES_EXPORTER is empty. Using default otlp exporter."),X=["otlp"];else if(X.length>1&&X.includes("none"))vG.diag.warn('OTEL_TRACES_EXPORTER contains "none" along with other exporters. Using default otlp exporter.'),X=["otlp"];for(let G of X){let Z=J.get(G)?.();if(Z)Q.push(Z);else vG.diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${G}.`)}for(let G of Q)if(G instanceof ac.ConsoleSpanExporter)Y.push(new ac.SimpleSpanProcessor(G));else Y.push(new ac.BatchSpanProcessor(G));if(Q.length===0)vG.diag.warn("Unable to set up trace exporter(s) due to invalid exporter and/or protocol values.");return Y}eH0.getSpanProcessorsFromEnv=h34;function b34(){let J=(0,D$.getStringListFromEnv)("OTEL_PROPAGATORS");if(J==null)return;if(J.includes("none"))return null;let Q=new Map([["tracecontext",()=>new D$.W3CTraceContextPropagator],["baggage",()=>new D$.W3CBaggagePropagator],["b3",()=>new pG1.B3Propagator],["b3multi",()=>new pG1.B3Propagator({injectEncoding:pG1.B3InjectEncoding.MULTI_HEADER})],["jaeger",()=>new C34.JaegerPropagator]]),Y=Array.from(new Set(J)),G=Y.map((Z)=>{let q=Q.get(Z)?.();if(!q){vG.diag.warn(`Propagator "${Z}" requested through environment variable is unavailable.`);return}return q}).reduce((Z,q)=>{if(q)Z.push(q);return Z},[]);if(G.length===0)return null;else if(Y.length===1)return G[0];else return new D$.CompositePropagator({propagators:G})}eH0.getPropagatorFromEnv=b34;function g34(J){if(J===null)return;if(J===void 0){let Q=new j34.AsyncLocalStorageContextManager;Q.enable(),vG.context.setGlobalContextManager(Q);return}J.enable(),vG.context.setGlobalContextManager(J)}eH0.setupContextManager=g34;function m34(J){if(J===null)return;if(J===void 0){vG.propagation.setGlobalPropagator(new D$.CompositePropagator({propagators:[new D$.W3CTraceContextPropagator,new D$.W3CBaggagePropagator]}));return}vG.propagation.setGlobalPropagator(J)}eH0.setupPropagator=m34});var qz0=f((Zz0)=>{Object.defineProperty(Zz0,"__esModule",{value:!0});Zz0.NodeSDK=void 0;var pJ=b6(),n34=xS(),a34=_J0(),ZE=BD(),h_=yJ1(),o34=ZY0(),r34=dK0(),dG1=sK0(),s34=BW0(),Yz0=EW0(),t34=mc(),e34=kW0(),pD=LD(),JJ4=wD(),QJ4=lJ1(),YJ4=JF(),EF=q8(),b_=Qz0();function Xz0(J,Q){return parseInt(process.env[J]||"")||Q}function XJ4(){let J=[],Q=(0,EF.getStringListFromEnv)("OTEL_METRICS_EXPORTER");if(!Q)return J;if(Q.length===0)pJ.diag.debug("OTEL_METRICS_EXPORTER is empty. Using default otlp exporter.");if(Q.includes("none"))return pJ.diag.info('OTEL_METRICS_EXPORTER contains "none". Metric provider will not be initialized.'),J;return Q.forEach((Y)=>{if(Y==="otlp"){let X=process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),G=Xz0("OTEL_METRIC_EXPORT_INTERVAL",60000),Z=Xz0("OTEL_METRIC_EXPORT_TIMEOUT",30000);switch(X){case"grpc":J.push(new pD.PeriodicExportingMetricReader({exporter:new s34.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}));break;case"http/json":J.push(new pD.PeriodicExportingMetricReader({exporter:new t34.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}));break;case"http/protobuf":J.push(new pD.PeriodicExportingMetricReader({exporter:new Yz0.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}));break;default:pJ.diag.warn(`Unsupported OTLP metrics protocol: "${X}". Using http/protobuf.`),J.push(new pD.PeriodicExportingMetricReader({exporter:new Yz0.OTLPMetricExporter,exportIntervalMillis:G,exportTimeoutMillis:Z}))}}else if(Y==="console")J.push(new pD.PeriodicExportingMetricReader({exporter:new pD.ConsoleMetricExporter}));else if(Y==="prometheus")J.push(new e34.PrometheusExporter);else pJ.diag.warn(`Unsupported OTEL_METRICS_EXPORTER value: "${Y}". Supported values are: otlp, console, prometheus, none.`)}),J}class Gz0{_tracerProviderConfig;_loggerProviderConfig;_meterProviderConfig;_instrumentations;_resource;_resourceDetectors;_autoDetectResources;_tracerProvider;_loggerProvider;_meterProvider;_serviceName;_configuration;_disabled;constructor(J={}){if((0,EF.getBooleanFromEnv)("OTEL_SDK_DISABLED"))this._disabled=!0;let Q=(0,EF.getStringFromEnv)("OTEL_LOG_LEVEL");if(Q!=null)pJ.diag.setLogger(new pJ.DiagConsoleLogger,{logLevel:(0,EF.diagLogLevelFromString)(Q)});if(this._configuration=J,this._resource=J.resource??(0,ZE.defaultResource)(),this._autoDetectResources=J.autoDetectResources??!0,!this._autoDetectResources)this._resourceDetectors=[];else if(J.resourceDetectors!=null)this._resourceDetectors=J.resourceDetectors;else if((0,EF.getStringFromEnv)("OTEL_NODE_RESOURCE_DETECTORS"))this._resourceDetectors=(0,b_.getResourceDetectorsFromEnv)();else this._resourceDetectors=[ZE.envDetector,ZE.processDetector,ZE.hostDetector];if(this._serviceName=J.serviceName,J.traceExporter||J.spanProcessor||J.spanProcessors){let Y={};if(J.sampler)Y.sampler=J.sampler;if(J.spanLimits)Y.spanLimits=J.spanLimits;if(J.idGenerator)Y.idGenerator=J.idGenerator;if(J.spanProcessor)pJ.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");let X=J.spanProcessor??new JJ4.BatchSpanProcessor(J.traceExporter),G=J.spanProcessors??[X];this._tracerProviderConfig={tracerConfig:Y,spanProcessors:G}}if(J.logRecordProcessors)this._loggerProviderConfig={logRecordProcessors:J.logRecordProcessors};else if(J.logRecordProcessor)this._loggerProviderConfig={logRecordProcessors:[J.logRecordProcessor]},pJ.diag.warn("The 'logRecordProcessor' option is deprecated. Please use 'logRecordProcessors' instead.");else this.configureLoggerProviderFromEnv();if(J.metricReaders||J.metricReader||J.views){let Y={};if(J.metricReaders)Y.readers=J.metricReaders;else if(J.metricReader)Y.readers=[J.metricReader],pJ.diag.warn("The 'metricReader' option is deprecated. Please use 'metricReaders' instead.");if(J.views)Y.views=J.views;this._meterProviderConfig=Y}this._instrumentations=J.instrumentations?.flat()??[]}start(){if(this._disabled)return;if((0,a34.registerInstrumentations)({instrumentations:this._instrumentations}),(0,b_.setupContextManager)(this._configuration?.contextManager),(0,b_.setupPropagator)(this._configuration?.textMapPropagator===null?null:this._configuration?.textMapPropagator??(0,b_.getPropagatorFromEnv)()),this._autoDetectResources){let Y={detectors:this._resourceDetectors};this._resource=this._resource.merge((0,ZE.detectResources)(Y))}this._resource=this._serviceName===void 0?this._resource:this._resource.merge((0,ZE.resourceFromAttributes)({[YJ4.ATTR_SERVICE_NAME]:this._serviceName}));let J=this._tracerProviderConfig?this._tracerProviderConfig.spanProcessors:(0,b_.getSpanProcessorsFromEnv)();if(J.length>0)this._tracerProvider=new QJ4.NodeTracerProvider({...this._configuration,resource:this._resource,spanProcessors:J}),pJ.trace.setGlobalTracerProvider(this._tracerProvider);if(this._loggerProviderConfig){let Y=new h_.LoggerProvider({resource:this._resource,processors:this._loggerProviderConfig.logRecordProcessors});this._loggerProvider=Y,n34.logs.setGlobalLoggerProvider(Y)}let Q=XJ4();if(this._meterProviderConfig||Q.length>0){let Y=[];if(this._meterProviderConfig?.readers)Y.push(...this._meterProviderConfig.readers);if(Y.length===0)Q.forEach((G)=>Y.push(G));let X=new pD.MeterProvider({resource:this._resource,views:this._meterProviderConfig?.views??[],readers:Y});this._meterProvider=X,pJ.metrics.setGlobalMeterProvider(X);for(let G of this._instrumentations)G.setMeterProvider(pJ.metrics.getMeterProvider())}}shutdown(){let J=[];if(this._tracerProvider)J.push(this._tracerProvider.shutdown());if(this._loggerProvider)J.push(this._loggerProvider.shutdown());if(this._meterProvider)J.push(this._meterProvider.shutdown());return Promise.all(J).then(()=>{})}configureLoggerProviderFromEnv(){let J=(0,EF.getStringListFromEnv)("OTEL_LOGS_EXPORTER")??[];if(J.length===0)pJ.diag.debug("OTEL_LOGS_EXPORTER is empty. Using default otlp exporter."),J.push("otlp");if(J.includes("none")){pJ.diag.info('OTEL_LOGS_EXPORTER contains "none". Logger provider will not be initialized.');return}let Q=[];if(J.forEach((Y)=>{if(Y==="otlp"){let X=((0,EF.getStringFromEnv)("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL")??(0,EF.getStringFromEnv)("OTEL_EXPORTER_OTLP_PROTOCOL"))?.trim();switch(X){case"grpc":Q.push(new r34.OTLPLogExporter);break;case"http/json":Q.push(new o34.OTLPLogExporter);break;case"http/protobuf":Q.push(new dG1.OTLPLogExporter);break;case void 0:case"":Q.push(new dG1.OTLPLogExporter);break;default:pJ.diag.warn(`Unsupported OTLP logs protocol: "${X}". Using http/protobuf.`),Q.push(new dG1.OTLPLogExporter)}}else if(Y==="console")Q.push(new h_.ConsoleLogRecordExporter);else pJ.diag.warn(`Unsupported OTEL_LOGS_EXPORTER value: "${Y}". Supported values are: otlp, console, none.`)}),Q.length>0)this._loggerProviderConfig={logRecordProcessors:Q.map((Y)=>{if(Y instanceof h_.ConsoleLogRecordExporter)return new h_.SimpleLogRecordProcessor(Y);else return new h_.BatchLogRecordProcessor(Y)})}}}Zz0.NodeSDK=Gz0});var Vz0=f((cG1)=>{Object.defineProperty(cG1,"__esModule",{value:!0});cG1.NodeSDK=cG1.tracing=cG1.resources=cG1.node=cG1.metrics=cG1.logs=cG1.core=cG1.contextBase=cG1.api=void 0;cG1.api=b6();cG1.contextBase=b6();cG1.core=q8();cG1.logs=yJ1();cG1.metrics=LD();cG1.node=lJ1();cG1.resources=BD();cG1.tracing=wD();var GJ4=qz0();Object.defineProperty(cG1,"NodeSDK",{enumerable:!0,get:function(){return GJ4.NodeSDK}})});import UJ4 from"os";import oc from"path";var IF,dD,PF,TF,Kz0,Xh8,Gh8,BJ4,NJ4;var $E=L1(()=>{IF=UJ4.homedir(),{env:dD}=process,PF=dD.XDG_DATA_HOME||(IF?oc.join(IF,".local","share"):void 0),TF=dD.XDG_CONFIG_HOME||(IF?oc.join(IF,".config"):void 0),Kz0=dD.XDG_STATE_HOME||(IF?oc.join(IF,".local","state"):void 0),Xh8=dD.XDG_CACHE_HOME||(IF?oc.join(IF,".cache"):void 0),Gh8=dD.XDG_RUNTIME_DIR||void 0,BJ4=(dD.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");if(PF)BJ4.unshift(PF);NJ4=(dD.XDG_CONFIG_DIRS||"/etc/xdg").split(":");if(TF)NJ4.unshift(TF)});import{homedir as rc}from"node:os";import cD from"node:path";var Wz0,DJ4,Hz0,MJ4,sc,LJ4,qE,MV,Kh8;var kW=L1(()=>{$E();Wz0=cD.join(rc(),".local/share"),DJ4=process.platform==="win32"||process.platform==="darwin"?Wz0:PF??Wz0,Hz0=cD.join(rc(),".config"),MJ4=process.platform==="win32"||process.platform==="darwin"?Hz0:TF??Hz0,sc=cD.join(DJ4,"amp"),LJ4=cD.join(MJ4,"amp"),qE=cD.join(LJ4,"tools"),MV=cD.join(rc(),".cache","amp"),Kh8=cD.join(rc(),".cache","amp","http-debug-logs")});function OJ4(){return AJ4}function zz0(J){let Q=lD;return lD=J,Q}class LV{baseLogger;scope;context={};constructor(J=Fz0){this.baseLogger=J}with(J){let Q=new LV(this.baseLogger);return Q.scope=this.scope,Q.context={...this.context,...J},Q}scoped(J){let Q=new LV(this.baseLogger);return Q.scope=this.scope?`${this.scope}.${J}`:J,Q.context={...this.context},Q}error(J,...Q){let Y=this.mergeContextWithMeta(Q);this.baseLogger.error(this.messageWithPrefix(J),...Y)}warn(J,...Q){let Y=this.mergeContextWithMeta(Q);this.baseLogger.warn(this.messageWithPrefix(J),...Y)}info(J,...Q){let Y=this.mergeContextWithMeta(Q);this.baseLogger.info(this.messageWithPrefix(J),...Y)}debug(J,...Q){let Y=this.mergeContextWithMeta(Q);this.baseLogger.debug(this.messageWithPrefix(J),...Y)}audit(J,...Q){let Y=this.mergeContextWithMeta(Q);this.baseLogger.audit(this.messageWithPrefix(J),...Y)}messageWithPrefix(J){return this.scope?`${this.scope}: ${J}`:J}mergeContextWithMeta(J){let Q={...this.context},Y=lG1.trace.getActiveSpan();if(Y){let G=Y.spanContext();if(G.traceId)Q.traceId=G.traceId,Q.spanId=G.spanId}if(J.length===0)return[Q];let X=J[0];if(typeof X==="object"&&X!==null)return[{...X,...Q},...J.slice(1)];else return[Q,...J]}}var lG1,AJ4=!1,wJ4,lD,Fz0,h;var w0=L1(()=>{lG1=D6(b6(),1);wJ4={error:(J,...Q)=>console.error(J,...Q),warn:(J,...Q)=>console.warn(J,...Q),info:(J,...Q)=>console.info(J,...Q),debug:(J,...Q)=>{if(OJ4())console.debug(J,...Q)},audit:(J,...Q)=>{let Y=Q.length>0?Q[0]:{};if(typeof Y==="object"&&Y!==null&&!("audit"in Y))Y.audit=!0;let X=lG1.trace.getActiveSpan();if(X){let G=X.spanContext();if(G.traceId)Y.traceId=G.traceId,Y.spanId=G.spanId}console.info(J,Y)}},lD=wJ4;Fz0={error:(J,...Q)=>lD.error(J,...Q),warn:(J,...Q)=>lD.warn(J,...Q),info:(J,...Q)=>lD.info(J,...Q),debug:(J,...Q)=>lD.debug(J,...Q),audit:(J,...Q)=>lD.audit(J,...Q)};h=Fz0});function Az0(){if(typeof process==="object")return process.platform==="win32"?"windows":"posix";else if(typeof navigator==="object")return navigator.userAgent.indexOf("Windows")>=0?"windows":"posix";return"posix"}function Oz0(J,Q){if(!J.scheme&&Q)throw Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${J.authority}", path: "${J.path}", query: "${J.query}", fragment: "${J.fragment}"}`);if(J.scheme&&!SJ4.test(J.scheme))throw Error("[UriError]: Scheme contains illegal characters.");if(J.path){if(J.authority){if(!_J4.test(J.path))throw Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(kJ4.test(J.path))throw Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function yJ4(J,Q){if(!J&&!Q)return"file";return J}function xJ4(J,Q){switch(J){case"https":case"http":case"file":if(!Q)Q=M$;else if(Q[0]!==M$)Q=M$+Q;break}return Q}class n0{static isUri(J){if(J instanceof n0)return!0;if(!J)return!1;let Q=J;return typeof Q.authority==="string"&&typeof Q.fragment==="string"&&typeof Q.path==="string"&&typeof Q.query==="string"&&typeof Q.scheme==="string"&&typeof Q.fsPath==="string"&&typeof Q.with==="function"&&typeof Q.toString==="function"}scheme;authority;path;query;fragment;platform;constructor(J,Q,Y,X,G,Z=!1,q){if(typeof J==="object")this.scheme=J.scheme||m5,this.authority=J.authority||m5,this.path=J.path||m5,this.query=J.query||m5,this.fragment=J.fragment||m5,this.platform=J.platform;else this.scheme=yJ4(J,Z),this.authority=Q||m5,this.path=xJ4(this.scheme,Y||m5),this.query=X||m5,this.fragment=G||m5,this.platform=q,Oz0(this,Z)}get fsPath(){return Tz0(this,!1)}with(J){if(!J)return this;let{scheme:Q,authority:Y,path:X,query:G,fragment:Z,platform:q}=J;if(Q===void 0)Q=this.scheme;else if(Q===null)Q=m5;if(Y===void 0)Y=this.authority;else if(Y===null)Y=m5;if(X===void 0)X=this.path;else if(X===null)X=m5;if(G===void 0)G=this.query;else if(G===null)G=m5;if(Z===void 0)Z=this.fragment;else if(Z===null)Z=m5;if(q===void 0)q=this.platform;else if(q===null)q=void 0;if(Q===this.scheme&&Y===this.authority&&X===this.path&&G===this.query&&Z===this.fragment&&q===this.platform)return this;return new iD(Q,Y,X,G,Z,!1,q)}static parse(J,Q=!1){let Y=vJ4.exec(J);if(!Y)return new iD(m5,m5,m5,m5,m5);return new iD(Y[2]||m5,ec(Y[4]||m5),ec(Y[5]||m5),ec(Y[7]||m5),ec(Y[9]||m5),Q)}static file(J,Q=Az0()){let Y=m5;if(Q==="windows")J=J.replace(/\\/g,M$);if(J[0]===M$&&J[1]===M$){let X=J.indexOf(M$,2);if(X===-1)Y=J.substring(2),J=M$;else Y=J.substring(2,X),J=J.substring(X)||M$}return new iD("file",Y,J,m5,m5,!1,Q)}static from(J){let Q=new iD(J.scheme,J.authority,J.path,J.query,J.fragment,!0,J.platform);return Oz0(Q,!0),Q}toString(J=!1){return nG1(this,J)}toJSON(){return this}static revive(J){if(!J)return J;if(J instanceof n0)return J;let Q=new iD(J),Y=J;return Q._formatted=Y.external,Q._fsPath=Y._sep===Iz0(Q.platform)?Y.fsPath:null,Q}}function Iz0(J){return J==="windows"?1:void 0}function wz0(J,Q,Y){let X=void 0;for(let G=0;G<J.length;G++){let Z=J.charCodeAt(G);if(Z>=97&&Z<=122||Z>=65&&Z<=90||Z>=48&&Z<=57||Z===45||Z===46||Z===95||Z===126||Q&&Z===47||Y&&Z===91||Y&&Z===93||Y&&Z===58){if(X!==void 0)X+=J.charAt(G)}else{if(X===void 0)X=J.substring(0,G);let q=Pz0[Z];if(q!==void 0)X+=q;else X+=encodeURIComponent(J.charAt(G))}}return X!==void 0?X:J}function fJ4(J){let Q=void 0;for(let Y=0;Y<J.length;Y++){let X=J.charCodeAt(Y);if(X===35||X===63){if(Q===void 0)Q=J.substring(0,Y);Q+=Pz0[X]}else if(Q!==void 0)Q+=J[Y]}return Q!==void 0?Q:J}function Tz0(J,Q){let Y;if(J.authority&&J.path.length>1&&J.scheme==="file")Y=`//${J.authority}${J.path}`;else if(J.path.charCodeAt(0)===47&&(J.path.charCodeAt(1)>=65&&J.path.charCodeAt(1)<=90||J.path.charCodeAt(1)>=97&&J.path.charCodeAt(1)<=122)&&J.path.charCodeAt(2)===58)if(!Q)Y=J.path[1].toLowerCase()+J.path.substring(2);else Y=J.path.substring(1);else Y=J.path;if(J.platform==="windows")Y=Y.replace(/\//g,"\\");return Y}function nG1(J,Q){let Y=!Q?wz0:fJ4,X="",{scheme:G,authority:Z,path:q,query:V,fragment:K}=J;if(G)X+=G,X+=":";if(Z||G==="file")X+=M$,X+=M$;if(Z){let W=Z.indexOf("@");if(W!==-1){let H=Z.substring(0,W);if(Z=Z.substring(W+1),W=H.lastIndexOf(":"),W===-1)X+=Y(H,!1,!1);else X+=Y(H.substring(0,W),!1,!1),X+=":",X+=Y(H.substring(W+1),!1,!0);X+="@"}if(Z=Z.toLowerCase(),W=Z.lastIndexOf(":"),W===-1)X+=Y(Z,!1,!0);else X+=Y(Z.substring(0,W),!1,!0),X+=Z.substring(W)}if(q){if(q.length>=3&&q.charCodeAt(0)===47&&q.charCodeAt(2)===58){let W=q.charCodeAt(1);if(W>=65&&W<=90)q=`/${String.fromCharCode(W+32)}:${q.substring(3)}`}else if(q.length>=2&&q.charCodeAt(1)===58){let W=q.charCodeAt(0);if(W>=65&&W<=90)q=`${String.fromCharCode(W+32)}:${q.substring(2)}`}X+=Y(q,!0,!1)}if(V)X+="?",X+=Y(V,!1,!1);if(K)X+="#",X+=!Q?wz0(K,!1,!1):K;return X}function Rz0(J){try{return decodeURIComponent(J)}catch{if(J.length>3)return J.substring(0,3)+Rz0(J.substring(3));else return J}}function ec(J){if(!J.match(Ez0))return J;return J.replace(Ez0,(Q)=>Rz0(Q))}function RF(J){return J.scheme==="file"}function dJ(J){return n0.parse(J)}function A6(J){return J.toString()}function a4(J){if(typeof J==="string"||J instanceof URL)return n0.parse(J.toString());return J}function m_(J){if(!URL.canParse(J))throw Error(`invalid URI string: ${JSON.stringify(J)}`);return J}var SJ4,_J4,kJ4,m5="",M$="/",vJ4,iD,Pz0,Ez0;var u_=L1(()=>{SJ4=/^\w[\w\d+.-]*$/,_J4=/^\//,kJ4=/^\/\//;vJ4=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;iD=class iD extends n0{_formatted=null;_fsPath=null;get fsPath(){if(!this._fsPath)this._fsPath=Tz0(this,!1);return this._fsPath}toString(J=!1){if(!J){if(!this._formatted)this._formatted=nG1(this,!1);return this._formatted}return nG1(this,!0)}toJSON(){let J={};if(this._fsPath)J.fsPath=this._fsPath,J._sep=Iz0(this.platform);if(this._formatted)J.external=this._formatted;if(J.scheme=this.scheme,J.authority=this.authority,J.path=this.path,J.query=this.query,J.fragment=this.fragment,this.platform)J.platform=this.platform;return J}};Pz0={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};Ez0=/(%[0-9A-Za-z][0-9A-Za-z])+/g});function aG1(J){if(J==="/")return"/";if(J==="")return".";let Q=J.replace(/\/+$/,"");if(!Q)return".";let Y=Q.lastIndexOf("/");if(Y===-1)return".";if(Y===0)return"/";return Q.slice(0,Y)}function nD(J){let Q=J.replace(/\/+$/,"");if(!Q)return"";let Y=Q.lastIndexOf("/");return Y===-1?Q:Q.slice(Y+1)}function KE(...J){if(J.length===0)return".";let Q="";for(let q of J)if(q)if(Q)Q+="/"+q;else Q=q;if(!Q)return".";let Y=Q.endsWith("/"),X=Q.split("/").filter(Boolean),G=[];for(let q of X)if(q===".."){if(G.length>0&&G[G.length-1]!=="..")G.pop();else if(!Q.startsWith("/"))G.push("..")}else if(q!==".")G.push(q);let Z=Q.startsWith("/")?"/"+G.join("/"):G.join("/");if(!Z)Z=Q.startsWith("/")?"/":".";if(Y&&Z!=="/"&&Z!==".")Z+="/";return Z}function Cz0(J,Q,Y="/",X="/",G=!0){function Z(z,U){return G?z===U:z.toLowerCase()===U.toLowerCase()}if(Y==="/")J=J.replaceAll(/\/{2,}/g,"/"),Q=Q.replaceAll(/\/{2,}/g,"/");else J=J.replaceAll(/\\{2,}/g,"\\"),Q=Q.replaceAll(/\\{2,}/g,"\\");if(J!==Y&&J.endsWith(Y))J=J.slice(0,-1);if(Q!==Y&&Q.endsWith(Y))Q=Q.slice(0,-1);if(Z(J,Q))return"";if(!J.startsWith(Y)&&Q.startsWith(Y))return Q;let q=J===Y?[""]:J.split(Y),V=Q===Y?[""]:Q.split(Y),K=0;while(K<q.length&&K<V.length&&Z(q[K],V[K]))K++;let W=q.length-K,H=[];for(let z=0;z<W;z++)H.push("..");return H.push(...V.slice(K)),H.join(X)}function Jl(J){let Q=nD(J.replace(/\/+$/,"")),Y=Q.lastIndexOf(".");if(Y===0||Y===-1)return"";return Q.slice(Y)}function e3(J){try{if(J=a4(J),J.scheme==="file")return J.fsPath}catch{}return J.toString()}var WE=L1(()=>{u_()});function hJ4(J,...Q){return J=a4(J),J.with({path:KE(J.path,...Q)})}function bJ4(J,...Q){let Y=J.path,X=!1;if(Y[0]!==Ql)Y=Ql+Y,X=!0;let G=Y;for(let Z of Q)if(Z.startsWith("/"))G=KE(Z);else G=KE(G,Z);if(G!=="/"&&G.endsWith("/"))G=G.replace(/\/+$/,"");if(X&&G[0]===Ql&&!J.authority)G=G.substring(1);return J.with({path:G})}function gJ4(J){if(J=a4(J),J.path.length===0||J.path===Ql)return J;let Q=aG1(J.path);if(Q.length===1&&Q===".")Q="";return J.with({path:Q})}function mJ4(J,Q){if(Q.scheme!==J.scheme||(Q.authority??"")!==(J.authority??""))return!1;let Y=Q.scheme==="file"&&Q.path.match(/^\/[A-Za-z]:/),X=Y?Q.path.slice(0,2).toUpperCase()+Q.path.slice(2):Q.path,G=Y?J.path.slice(0,2).toUpperCase()+J.path.slice(2):J.path;return G===X||G.startsWith(X.endsWith("/")?X:`${X}/`)||X.endsWith("/")&&G===X.slice(0,-1)}function uJ4(J,Q){if(J.scheme!==Q.scheme||J.authority!==Q.authority||J.query!==Q.query||J.fragment!==Q.fragment)return null;let Y=J.platform==="windows"?"\\":"/";return Cz0(J.path,Q.path,Y,Y)}function pJ4(J,Q){let Y=A6(J),X=A6(Q);if(Y.startsWith("file:///")&&X.startsWith("file:///"))return jz0(Y)===jz0(X);return Y===X}function jz0(J){return J.replace(/^file:\/\/\/([A-Za-z]):/,(Q)=>`file:///${Q.toLowerCase()}:`)}var Ql="/",Z6;var Yl=L1(()=>{WE();u_();Z6={joinPath:hJ4,resolvePath:bJ4,dirname:gJ4,basename:(J)=>nD(a4(J).path),extname:(J)=>Jl(a4(J).path),hasPrefix:mJ4,relativePath:uJ4,equalURIs:pJ4}});function Xl(J){Promise.resolve().then(()=>{try{J()}catch(Q){console.error(Q)}})}function Sz0(J){let Q=J._cleanup;if(Q===void 0)return;if(J._cleanup=void 0,!Q)return;try{if(typeof Q==="function")Q();else if(Q&&typeof Q.unsubscribe==="function")Q.unsubscribe()}catch(Y){console.error("cleanupSubscription",Y)}}function sG1(J){J._observer=void 0,J._queue=void 0,J._state="closed"}function cJ4(J){let Q=J._queue;if(!Q)return;J._queue=void 0,J._state="ready";for(let Y of Q)if(_z0(J,Y.type,Y.value),J._state==="closed")break}function _z0(J,Q,Y){J._state="running";let X=J._observer;try{switch(Q){case"next":if(X&&typeof X.next==="function")X.next(Y);break;case"error":if(sG1(J),X&&typeof X.error==="function")X.error(Y);else throw Y;break;case"complete":if(sG1(J),X&&typeof X.complete==="function")X.complete();break}}catch(G){console.error("notifySubscription",G)}if(J._state==="closed")Sz0(J);else if(J._state==="running")J._state="ready"}function rG1(J,Q,Y){if(J._state==="closed")return;if(J._state==="buffering"){J._queue=J._queue||[],J._queue.push({type:Q,value:Y});return}if(J._state!=="ready"){J._state="buffering",J._queue=[{type:Q,value:Y}],Xl(()=>cJ4(J));return}_z0(J,Q,Y)}class kz0{_cleanup;_observer;_queue;_state;constructor(J,Q){this._cleanup=void 0,this._observer=J,this._queue=void 0,this._state="initializing";let Y=new yz0(this);try{this._cleanup=Q.call(void 0,Y)}catch(X){Y.error(X)}if(this._state==="initializing")this._state="ready"}get closed(){return this._state==="closed"}unsubscribe(){if(this._state!=="closed")sG1(this),Sz0(this)}}class yz0{_subscription;constructor(J){this._subscription=J}get closed(){return this._subscription._state==="closed"}next(J){rG1(this._subscription,"next",J)}error(J){rG1(this._subscription,"error",J)}complete(){rG1(this._subscription,"complete")}}function u5(J){if(typeof J==="function")J();else if(J&&typeof J.unsubscribe==="function")J.unsubscribe()}class HE{_baseObserver;_pendingPromises;constructor(J){this._baseObserver=J,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then(()=>this._baseObserver.complete()).catch((J)=>this._baseObserver.error(J))}error(J){this._baseObserver.error(J)}schedule(J){let Q=Promise.all(this._pendingPromises),Y=[],X=(Z)=>Y.push(Z),G=Promise.resolve().then(async()=>{await Q,await J(X),this._pendingPromises.delete(G);for(let Z of Y)this._baseObserver.next(Z)}).catch((Z)=>{this._pendingPromises.delete(G),this._baseObserver.error(Z)});this._pendingPromises.add(G)}}function tG1(J){return J&&typeof J.subscribe==="function"&&typeof J[Symbol.observable]==="function"}function eG1(J){if(tG1(J))return J;return X0.of(J)}var X0;var zE=L1(()=>{if(!Symbol.observable)Symbol.observable=Symbol("observable");X0=class X0{_subscriber;constructor(J){if(!(this instanceof X0))throw TypeError("Observable cannot be called as a function");if(typeof J!=="function")throw TypeError("Observable initializer must be a function");this._subscriber=J}subscribe(J,Q,Y){if(typeof J!=="object"||J===null)J={next:J,error:Q,complete:Y};return new kz0(J,this._subscriber)}pipe(J,...Q){let Y=this;for(let X of[J,...Q])Y=X(Y);return Y}[Symbol.observable](){return this}static from(J){let Q=typeof this==="function"?this:X0;if(J==null)throw TypeError(J+" is not an object");let Y=J[Symbol.observable];if(typeof Y==="function"){let G=Y.call(J);if(Object(G)!==G)throw TypeError(G+" is not an object");if(G instanceof X0)return G;return new Q((Z)=>G.subscribe(Z))}let X=J[Symbol.iterator];if(typeof X==="function")return new Q((G)=>{Xl(()=>{if(G.closed)return;for(let Z of X.call(J))if(G.next(Z),G.closed)return;G.complete()})});if(Array.isArray(J))return new Q((G)=>{Xl(()=>{if(G.closed)return;for(let Z of J)if(G.next(Z),G.closed)return;G.complete()})});throw TypeError(J+" is not observable")}static of(...J){return new(typeof this==="function"?this:X0)((Y)=>{Xl(()=>{if(Y.closed)return;for(let X of J)if(Y.next(X),Y.closed)return;Y.complete()})})}static get[Symbol.species](){return this}}});var y4,E5;var Gl=L1(()=>{zE();y4=class y4 extends X0{_observers=new Set;constructor(){super((J)=>{return this._observers.add(J),()=>this._observers.delete(J)})}next(J){for(let Q of this._observers)Q.next(J)}error(J){for(let Q of this._observers)Q.error(J)}complete(){for(let J of this._observers)J.complete()}};E5=class E5 extends y4{currentValue;constructor(J){super();this.currentValue=J}next(J){this.currentValue=J,super.next(J)}subscribe(J,Q,Y){if(typeof J!=="object"||J===null){let X={};if(J)X.next=J;if(Q)X.error=Q;if(Y)X.complete=Y;J=X}return J.next?.(this.currentValue),super.subscribe(J)}getValue(){return this.currentValue}}});var JZ1,p_;var xz0=L1(()=>{zE();Gl();JZ1=class JZ1 extends Set{subject=new E5(this);add(J){return super.add(J),this.subject.next(this),this}delete(J){let Q=super.delete(J);if(Q)this.subject.next(this);return Q}clear(){super.clear(),this.subject.next(this)}get observable(){return X0.from(this.subject)}dispose(){this.subject.complete()}};p_=class p_ extends Map{subject=new E5(this);set(J,Q){return super.set(J,Q),this.subject.next(this),this}delete(J){let Q=super.delete(J);if(Q)this.subject.next(this);return Q}clear(){super.clear(),this.subject.next(this)}get observable(){return X0.from(this.subject)}dispose(){this.subject.complete()}}});function Zl(J,Q){if(J===Q)return!0;if(J==null||Q==null||typeof J!=="object"||typeof Q!=="object")return!1;let Y=Array.isArray(J),X=Array.isArray(Q);if(Y!==X)return!1;if(Y&&X)return J.length===Q.length&&J.every((Z,q)=>Zl(Z,Q[q]));let G=new Set([...Object.keys(J),...Object.keys(Q)]);for(let Z of G)if(!Zl(J[Z],Q[Z]))return!1;return!0}function QZ1(J){return{dispose:J.unsubscribe.bind(J)}}function fz0(...J){return new X0((Q)=>{for(let Y of J)Q.next(Y);Q.complete()})}async function B6(J,Q){return new Promise((Y,X)=>{let G=void 0,Z=()=>{G?.unsubscribe(),X(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",Z,{once:!0}),G=J.subscribe({next:(q)=>{G?.unsubscribe(),Q?.removeEventListener("abort",Z),Y(q)},error:(q)=>{Q?.removeEventListener("abort",Z),X(q)},complete:()=>{Q?.removeEventListener("abort",Z),X("Observable completed without emitting a value")}})})}async function CF(J,Q){return new Promise((Y,X)=>{let G,Z=!1,q=void 0,V=()=>{q?.unsubscribe(),X(new DOMException("Aborted","AbortError"))};Q?.addEventListener("abort",V,{once:!0}),q=J.subscribe({next:(K)=>{G=K,Z=!0},error:(K)=>{Q?.removeEventListener("abort",V),X(K)},complete:()=>{if(Q?.removeEventListener("abort",V),Z)Y(G);else X("Observable completed without emitting a value")}})})}async function hz0(J,Q){return new Promise((Y,X)=>{let G=J.subscribe({error:X,complete:()=>Y()});Q?.addEventListener("abort",()=>{G.unsubscribe(),X(new DOMException("Aborted","AbortError"))},{once:!0})})}function j3(J){return new X0((Q)=>{J.then((Y)=>{Q.next(Y),Q.complete()}).catch((Y)=>{Q.error(Y)})})}function e6(J){return new X0((Q)=>{let Y=!1,X=new AbortController,G=X.signal;return(async()=>{try{G?.throwIfAborted();let q=await J(G);if(G?.throwIfAborted(),!Y)Q.next(q),Q.complete()}catch(q){if(!Y)if(G.aborted)Q.complete();else Q.error(q)}})(),()=>{Y=!0,X.abort()}})}function q6(J){return(Q)=>{return new X0((Y)=>{let X=new HE(Y),G=0,Z=Q.subscribe({complete(){X.complete()},error(q){X.error(q)},next(q){X.schedule(async(V)=>{let K=await J(q,G);G++,V(K)})}});return()=>u5(Z)})}}function $l(J){return new X0((Q)=>{let Y=0,X=setInterval(()=>{Q.next(Y++)},J);return()=>clearInterval(X)})}function yW(...J){return new X0((Q)=>{let Y=0,X=J.map((G)=>G.subscribe({next:(Z)=>Q.next(Z),error:(Z)=>Q.error(Z),complete:()=>{if(Y++,Y===J.length)Q.complete()}}));return()=>{bz0(X)}})}function u8(...J){if(J.length===0)return d_;return new X0((Q)=>{let Y=Array(J.length),X=Array(J.length).fill(0),G=Array(J.length).fill(!1),Z=0,q=[],V=new HE(Q);for(let K=0;K<J.length;K++){let W=J[K];q.push(W.subscribe({next(H){Y[K]=H,G[K]=!0;let z=++X[K];if(G.every(Boolean))V.schedule(async(U)=>{if(X[K]===z)U([...Y])})},error(H){V.error(H)},complete(){if(Z++,Z===J.length)V.complete()}}))}return()=>{bz0(q)}})}function a8(J){let Y=J?.shouldCountRefs??!0,X=lJ4++,G=(Z,...q)=>{};return(Z)=>{let q=new y4,V=null,K=!1,W,H=0;return new X0((z)=>{if(H++,K)G("new subscriber, emitting buffered value",W),z.next(W);else G("new subscriber, no buffered value to emit");if(!V)V=Z.subscribe({next:(N)=>{K=!0,W=N,q.next(N)},error:(N)=>q.error(N),complete:()=>q.complete()});let U=q.subscribe(z);return()=>{if(H--,U.unsubscribe(),Y&&H===0){if(V)u5(V),V=null;K=!1}}})}}function bz0(J){for(let Q of J)if(Q)u5(Q)}function jF(J){return(Q)=>{return new X0((Y)=>{let X=Q.subscribe({next:(Z)=>Y.next(Z),error:(Z)=>Y.error(Z),complete:()=>Y.complete()}),G=J.subscribe({next:()=>{Y.complete(),X.unsubscribe(),G.unsubscribe()},error:(Z)=>{Y.error(Z),X.unsubscribe()}});return()=>{X.unsubscribe(),G.unsubscribe()}})}}function OQ(J){return(Q)=>{return new X0((Y)=>{let X,G=Q.subscribe({next(Z){X=Z,Y.next(Z)},error(Z){Y.error(Z)},complete(){Y.complete()}});return()=>{u5(G),J(X)}})}}function x4(J=Zl){return(Q)=>{return new X0((Y)=>{let X=vz0,G=new HE(Y),Z=Q.subscribe({complete(){G.complete()},error(q){G.error(q)},next(q){G.schedule(async(V)=>{if(X===vz0||!J(X,q))X=q,V(q)})}});return()=>u5(Z)})}}function $X(J){return iJ4(typeof J==="function"?{next:J}:J)}function iJ4(J){return(Q)=>new X0((Y)=>{let X=typeof J==="function"?J():J,G=Q.subscribe({next(Z){if(X.next)try{X.next(Z)}catch(q){Y.error(q);return}Y.next(Z)},error(Z){if(X.error)try{X.error(Z)}catch(q){Y.error(q);return}Y.error(Z)},complete(){if(X.complete)try{X.complete()}catch(Z){Y.error(Z);return}Y.complete()}});return()=>u5(G)})}function SF(J){return(Q)=>{return new X0((Y)=>{let X=!1,G=Q.subscribe({next:(q)=>{X=!0,clearTimeout(Z),Y.next(q)},error:(q)=>{clearTimeout(Z),Y.error(q)},complete:()=>{clearTimeout(Z),Y.complete()}}),Z=setTimeout(()=>{if(!X)G.unsubscribe(),Y.error(new ql(`Operation timed out after ${J}ms`))},J);return()=>{clearTimeout(Z),G.unsubscribe()}})}}function Z9(J){return(Q)=>new X0((Y)=>{let X;try{Y.next(J),X=Q.subscribe({next(G){Y.next(G)},error(G){Y.error(G)},complete(){Y.complete()}})}catch(G){Y.error(G)}return()=>{if(X)u5(X)}})}function _F(J){return(Q)=>new X0((Y)=>{let X=0,G=Q.subscribe({next(Z){if(X<J){if(Y.next(Z),X++,X===J)Y.complete(),u5(G)}},error(Z){Y.error(Z)},complete(){Y.complete()}});return()=>{u5(G)}})}function gz0(J){return(Q)=>new X0((Y)=>{let X=0,G=Q.subscribe({next(Z){if(X>=J)Y.next(Z);else X++},error(Z){Y.error(Z)},complete(){Y.complete()}});return()=>{u5(G)}})}function YZ1(J){return(Q)=>{return new X0((Y)=>{let X=0,G=new Set,Z=!1,q=()=>{if(Z&&G.size===0)Y.complete()},V=Q.subscribe({next(K){let H=J(K,X++).subscribe({next(z){Y.next(z)},error(z){Y.error(z)},complete(){G.delete(H),q()}});G.add(H)},error(K){Y.error(K)},complete(){Z=!0,q()}});return()=>{u5(V);for(let K of G)if(K)u5(K)}})}}function v4(J){return(Q)=>{return new X0((Y)=>{let X=0,G=null,Z=!1,q=()=>{if(Z&&!G)Y.complete()},V=Q.subscribe({next(K){if(G)u5(G),G=null;let W;try{W=J(K,X++)}catch(H){Y.error(H);return}G=W.subscribe({next(H){Y.next(H)},error(H){Y.error(H)},complete(){G=null,q()}})},error(K){Y.error(K)},complete(){Z=!0,q()}});return()=>{if(u5(V),G)u5(G)}})}}function L$(J){return(Q)=>new X0((Y)=>{let X=null,G=null,Z=!1,q=Q.subscribe({next:(V)=>{if(G=V,Z=!0,X===null)X=setTimeout(()=>{if(Z)Y.next(G),Z=!1;X=null},J)},error:(V)=>Y.error(V),complete:()=>{if(X!==null)clearTimeout(X);if(Z)Y.next(G);Y.complete()}});return()=>{if(u5(q),X!==null)clearTimeout(X)}})}function c_(J,Q){if(!Q.leading||!Q.trailing)throw Error("leading and trailing must be true");return(Y)=>new X0((X)=>{let G=0,Z=null,q=null,V=!1,K=Y.subscribe({next:(W)=>{let H=Date.now();if(q=W,V=!0,H-G>=J)X.next(W),G=H,V=!1;else if(Z===null)Z=setTimeout(()=>{if(V)X.next(q),G=Date.now(),V=!1;Z=null},J-(H-G));if(G===0)X.next(W),G=H,V=!1},error:(W)=>X.error(W),complete:()=>{if(Z!==null)clearTimeout(Z);if(V)X.next(q);X.complete()}});return()=>{if(u5(K),Z!==null)clearTimeout(Z)}})}function aD(...J){return new X0((Q)=>{let Y=0,X=null;function G(){if(Y>=J.length){Q.complete();return}X=J[Y].subscribe({next:(q)=>Q.next(q),error:(q)=>Q.error(q),complete:()=>{Y++,G()}})}return G(),()=>{if(X)u5(X)}})}function qX(J){return(Q)=>new X0((Y)=>{let X=0,G=!1,Z=null,q=Q.subscribe({next(V){try{let K=J(V,X++);if(Z)u5(Z);Z=K.subscribe({next(W){Y.next(W)},error(W){Y.error(W)},complete(){if(Z=null,G&&!Z)Y.complete()}})}catch(K){Y.error(K)}},error(V){Y.error(V)},complete(){if(G=!0,!Z)Y.complete()}});return()=>{if(u5(q),Z)u5(Z)}})}function l_({onSubscribe:J,onUnsubscribe:Q}){return(Y)=>new X0((X)=>{J?.();let G=Y.subscribe(X);return()=>{u5(G),Q?.()}})}function kF(J){return(Q)=>X0.from(Q).pipe(v4((Y)=>e6((X)=>J(Y,X))))}function b7(J){return(Q)=>new X0((Y)=>{let X,G=Q.subscribe({next(Z){Y.next(Z)},error(Z){try{X=J(Z).subscribe({next(V){Y.next(V)},error(V){Y.error(V)},complete(){Y.complete()}})}catch(q){Y.error(q)}},complete(){Y.complete()}});return()=>{if(u5(G),X)u5(X)}})}function F7(J){return(Q)=>{return new X0((Y)=>{let X=Q.subscribe({next(G){if(J(G))Y.next(G)},error(G){Y.error(G)},complete(){Y.complete()}});return()=>u5(X)})}}function mz0(J,Q){return(Y)=>{return new X0((X)=>{let G,Z=0,q=new HE(X),V=Y.subscribe({complete(){q.complete()},error(K){q.error(K)},next(K){q.schedule(async(W)=>{G=await J(Z===0?typeof Q>"u"?K:Q:G,K,Z++),W(G)})}});return()=>u5(V)})}}var d_,fG,bh8,lJ4=0,vz0,ql;var XZ1=L1(()=>{zE();Gl();d_=new X0((J)=>{J.complete()}),fG=new X0(()=>{});bh8=Symbol("noInitialValue");vz0={};ql=class ql extends Error{constructor(J="Timeout has occurred"){super(J);this.name="TimeoutError"}}});function Vl(J,Q){return(Y)=>{return X0.from(Y).pipe(v4((X)=>X===AV?X0.of(AV):J(X).pipe(b7((G)=>X0.of(G instanceof Error?G:Error(G))),Z9(AV))),a8(Q))}}function nJ4(){return(J)=>X0.from(J).pipe(F7((Q)=>Q!==AV))}async function uz0(J,Q){let Y=await B6(X0.from(J).pipe(nJ4()),Q);if(Y instanceof Error)throw Y;return Y}var AV;var pz0=L1(()=>{zE();XZ1();AV=Symbol.for("@@pendingOperation")});var r0=L1(()=>{xz0();zE();pz0();XZ1();Gl()});var K4=L1(()=>{u_();Yl();WE()});import{promises as aJ4}from"node:fs";import*as oD from"node:path";async function dz0(J){try{let Q=await aJ4.open(J,"r");try{let Y=Buffer.alloc(128);await Q.read(Y,0,128,0);let X=Y.toString("utf-8").split(`
48
- `)[0];if(!X?.startsWith("#!"))return{interpreter:null,isValid:!1};let G=X.slice(2).trim();if(!G)return{interpreter:null,isValid:!1};let Z=G.split(/\s+/).filter((q)=>q.length>0);if(Z[0]?.endsWith("/env")&&Z.length>1)return{interpreter:Z.slice(1),isValid:!0};return{interpreter:Z,isValid:!0}}finally{await Q.close()}}catch{return{interpreter:null,isValid:!1}}}function cz0(J,Q){let Y=(J&73)!==0;if(process.platform==="win32"){let X=oD.extname(Q).toLowerCase();return Y||[".exe",".bat",".cmd",".ps1"].includes(X)}return Y}function lz0(J){return oD.extname(J).toLowerCase()===".md"}function iz0(J){let Q=J.replace(/\\/g,"/"),Y=oD.basename(Q);return oD.basename(Y,oD.extname(Y))}function nz0(J){return/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(J)&&J.length>0}var az0=()=>{};var tz0={};n8(tz0,{CommandDiscovery:()=>sz0});import*as rz0 from"node:fs";import{promises as Kl}from"node:fs";import{homedir as oz0}from"node:os";import*as VX from"node:path";function ZZ1(J,Q,Y){return Promise.race([J,new Promise((X,G)=>setTimeout(()=>G(Error(`${Y} timed out after ${Q}ms`)),Q))])}class sz0{config;workspaceRoots;watchFactory;debounceMs;changes=new y4;watchers=new Map;debounceTimer;disposed=!1;constructor(J,Q,Y={}){this.config=J,this.workspaceRoots=Q,this.watchFactory=Y.watchFactory??oJ4,this.debounceMs=Y.debounceMs??200}get commandChanges(){return this.changes}async discoverCommands(){if(this.disposed)return[];try{let[J,Q]=await Promise.all([this.discoverWorkspaceCommands(),this.discoverGlobalCommands()]),Y=new Map;for(let G of Q)Y.set(`${G.source}:${G.name}`,G);for(let G of J)Y.set(`${G.source}:${G.name}`,G);let X=Array.from(Y.values());if(h.debug("Discovered commands",{count:X.length,workspace:J.length,global:Q.length}),this.config.enableWatching)await this.setupWatching();return X}catch(J){return h.error("Failed to discover commands",{error:J}),[]}}async discoverWorkspaceCommands(){let J=[];for(let Q of this.workspaceRoots)for(let Y of this.config.workspacePaths){let X=Z6.joinPath(Q,Y),G=await this.discoverCommandsInDirectory(X,"workspace");J.push(...G)}return J}async discoverGlobalCommands(){let J=[];for(let Q of this.config.globalPaths){let Y=this.resolveGlobalPath(Q),X=n0.file(Y),G=await this.discoverCommandsInDirectory(X,"global");J.push(...G)}return J}async discoverCommandsInDirectory(J,Q){try{let Y=J.fsPath;try{await ZZ1(Kl.access(Y),GZ1,"directory access")}catch{return[]}let G=(await ZZ1(Kl.readdir(Y,{withFileTypes:!0}),GZ1,"directory read")).filter((q)=>q.isFile()),Z=[];for(let q of G){let V=VX.join(Y,q.name),K=await this.createCommand(V,Q);if(K)Z.push(K)}return h.debug(`Discovered ${Z.length} commands in ${Q} directory`,{directory:Y,commands:Z.map((q)=>q.name)}),Z}catch(Y){return h.warn(`Failed to discover commands in directory: ${J.fsPath}`,{error:Y}),[]}}ignoreCommandName(J){return J.startsWith(".")||J==="README.md"}async createCommand(J,Q){try{let Y=await Kl.stat(J),X=VX.basename(J);if(this.ignoreCommandName(X))return null;let G=iz0(X);if(!nz0(G))return h.warn(`Invalid command name: ${G}`,{filePath:J}),null;if(lz0(X))return this.createMarkdownCommand(J,Y,G,Q);else return this.createExecutableCommand(J,Y,G,Q)}catch(Y){return h.warn(`Failed to process file: ${J}`,{error:Y}),null}}async createMarkdownCommand(J,Q,Y,X){return{kind:"markdown",name:Y,filePath:J,sourceDirectory:VX.dirname(J),lastModified:Q.mtimeMs,available:!0,unavailableReason:void 0,source:X}}async createExecutableCommand(J,Q,Y,X){let G=VX.basename(J),Z=cz0(Q.mode,G),q=await dz0(J),V=VX.extname(G);if(!Z&&!q.isValid&&!this.isNativeBinary(V))return h.debug(`Skipping non-executable file without shebang: ${J}`),null;let K=Z&&(q.isValid||this.isNativeBinary(V)),W=this.getExecutableUnavailableReason(Z,q.isValid,V);return{kind:"executable",name:Y,filePath:J,sourceDirectory:VX.dirname(J),lastModified:Q.mtimeMs,isExecutable:Z,interpreter:q.interpreter,extension:V,available:K,unavailableReason:W,source:X}}isNativeBinary(J){if(process.platform==="win32")return[".exe",".bat",".cmd",".ps1"].includes(J.toLowerCase());return J===""}getExecutableUnavailableReason(J,Q,Y){let X=this.isNativeBinary(Y);if(!J)return"File is not executable (missing execute permissions)";if(!Q&&!X)return"Missing shebang and not a recognized binary type";return}resolveGlobalPath(J){if(J.startsWith("~/"))return VX.join(oz0(),J.slice(2));if(J.startsWith("~/.config/amp/")){let Q=TF||VX.join(oz0(),".config");return VX.join(Q,J.slice(10))}return J}async setupWatching(){if(this.disposed)return;this.stopWatching();let J=new Set;for(let Q of this.workspaceRoots)for(let Y of this.config.workspacePaths){let X=Z6.joinPath(Q,Y);J.add(X.fsPath)}for(let Q of this.config.globalPaths){let Y=this.resolveGlobalPath(Q);J.add(Y)}for(let Q of J)await this.watchDirectory(Q)}async watchDirectory(J){try{await ZZ1(Kl.access(J),GZ1,"watcher access check");try{let Q=this.watchFactory(J,(Y,X)=>{h.debug("Command directory change detected",{directory:J,eventType:Y,filename:X}),this.scheduleRefresh()});Q.on("error",(Y)=>{h.debug("transient file watcher error",{error:Y}),this.scheduleRefresh()}),this.watchers.set(J,Q),h.debug("Started watching command directory",{directory:J})}catch(Q){h.warn("Failed to setup file watcher",{directory:J,error:Q})}}catch(Q){h.debug("Skipping watch for non-existent directory",{directory:J})}}scheduleRefresh(){if(this.disposed)return;if(this.debounceTimer)clearTimeout(this.debounceTimer);this.debounceTimer=setTimeout(async()=>{try{let[J,Q]=await Promise.all([this.discoverWorkspaceCommands(),this.discoverGlobalCommands()]),Y=new Map;for(let G of Q)Y.set(`${G.source}:${G.name}`,G);for(let G of J)Y.set(`${G.source}:${G.name}`,G);let X=Array.from(Y.values());h.debug("Refreshed commands during file watch",{count:X.length,workspace:J.length,global:Q.length}),this.changes.next(X)}catch(J){h.warn("Failed to refresh commands during file watch",{error:J})}},this.debounceMs)}stopWatching(){try{for(let[J,Q]of this.watchers)try{Q.close(),h.debug("Stopped watching command directory",{directory:J})}catch(Y){h.warn("Failed to close watcher",{directory:J,error:Y})}this.watchers.clear()}finally{if(this.debounceTimer)clearTimeout(this.debounceTimer),this.debounceTimer=void 0}}dispose(){this.disposed=!0;try{this.stopWatching()}catch(J){h.warn("Error during command discovery cleanup",{error:J})}}}var GZ1=5000,oJ4=(J,Q)=>rz0.watch(J,Q);var ez0=L1(()=>{K4();r0();$E();w0();az0()});function $5(J,Q,Y=Q+"s"){return J===1?Q:Y}function yF(J){let Q=typeof J==="string"?J:J.toString();return Q===KY||Q===KY.slice(0,-1)}function NE(J){return yF(J)?KY:J}var UQ4,KY,BQ4,db8;var xF=L1(()=>{UQ4=new URL("https://ampcode.com/"),KY=UQ4.toString(),BQ4=new URL("https://api.anthropic.com/"),db8=BQ4.toString()});var N9,DZ1,x6,OV=(J)=>{switch(typeof J){case"undefined":return x6.undefined;case"string":return x6.string;case"number":return Number.isNaN(J)?x6.nan:x6.number;case"boolean":return x6.boolean;case"function":return x6.function;case"bigint":return x6.bigint;case"symbol":return x6.symbol;case"object":if(Array.isArray(J))return x6.array;if(J===null)return x6.null;if(J.then&&typeof J.then==="function"&&J.catch&&typeof J.catch==="function")return x6.promise;if(typeof Map<"u"&&J instanceof Map)return x6.map;if(typeof Set<"u"&&J instanceof Set)return x6.set;if(typeof Date<"u"&&J instanceof Date)return x6.date;return x6.object;default:return x6.unknown}};var r_=L1(()=>{(function(J){J.assertEqual=(G)=>{};function Q(G){}J.assertIs=Q;function Y(G){throw Error()}J.assertNever=Y,J.arrayToEnum=(G)=>{let Z={};for(let q of G)Z[q]=q;return Z},J.getValidEnumValues=(G)=>{let Z=J.objectKeys(G).filter((V)=>typeof G[G[V]]!=="number"),q={};for(let V of Z)q[V]=G[V];return J.objectValues(q)},J.objectValues=(G)=>{return J.objectKeys(G).map(function(Z){return G[Z]})},J.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let Z=[];for(let q in G)if(Object.prototype.hasOwnProperty.call(G,q))Z.push(q);return Z},J.find=(G,Z)=>{for(let q of G)if(Z(q))return q;return},J.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&Number.isFinite(G)&&Math.floor(G)===G;function X(G,Z=" | "){return G.map((q)=>typeof q==="string"?`'${q}'`:q).join(Z)}J.joinValues=X,J.jsonStringifyReplacer=(G,Z)=>{if(typeof Z==="bigint")return Z.toString();return Z}})(N9||(N9={}));(function(J){J.mergeShapes=(Q,Y)=>{return{...Q,...Y}}})(DZ1||(DZ1={}));x6=N9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var z6,NQ4=(J)=>{return JSON.stringify(J,null,2).replace(/"([^"]+)":/g,"$1:")},WY;var Ul=L1(()=>{r_();z6=N9.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"]);WY=class WY extends Error{get errors(){return this.issues}constructor(J){super();this.issues=[],this.addIssue=(Y)=>{this.issues=[...this.issues,Y]},this.addIssues=(Y=[])=>{this.issues=[...this.issues,...Y]};let Q=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,Q);else this.__proto__=Q;this.name="ZodError",this.issues=J}format(J){let Q=J||function(G){return G.message},Y={_errors:[]},X=(G)=>{for(let Z of G.issues)if(Z.code==="invalid_union")Z.unionErrors.map(X);else if(Z.code==="invalid_return_type")X(Z.returnTypeError);else if(Z.code==="invalid_arguments")X(Z.argumentsError);else if(Z.path.length===0)Y._errors.push(Q(Z));else{let q=Y,V=0;while(V<Z.path.length){let K=Z.path[V];if(V!==Z.path.length-1)q[K]=q[K]||{_errors:[]};else q[K]=q[K]||{_errors:[]},q[K]._errors.push(Q(Z));q=q[K],V++}}};return X(this),Y}static assert(J){if(!(J instanceof WY))throw Error(`Not a ZodError: ${J}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,N9.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(J=(Q)=>Q.message){let Q={},Y=[];for(let X of this.issues)if(X.path.length>0){let G=X.path[0];Q[G]=Q[G]||[],Q[G].push(J(X))}else Y.push(J(X));return{formErrors:Y,fieldErrors:Q}}get formErrors(){return this.flatten()}};WY.create=(J)=>{return new WY(J)}});var DQ4=(J,Q)=>{let Y;switch(J.code){case z6.invalid_type:if(J.received===x6.undefined)Y="Required";else Y=`Expected ${J.expected}, received ${J.received}`;break;case z6.invalid_literal:Y=`Invalid literal value, expected ${JSON.stringify(J.expected,N9.jsonStringifyReplacer)}`;break;case z6.unrecognized_keys:Y=`Unrecognized key(s) in object: ${N9.joinValues(J.keys,", ")}`;break;case z6.invalid_union:Y="Invalid input";break;case z6.invalid_union_discriminator:Y=`Invalid discriminator value. Expected ${N9.joinValues(J.options)}`;break;case z6.invalid_enum_value:Y=`Invalid enum value. Expected ${N9.joinValues(J.options)}, received '${J.received}'`;break;case z6.invalid_arguments:Y="Invalid function arguments";break;case z6.invalid_return_type:Y="Invalid function return type";break;case z6.invalid_date:Y="Invalid date";break;case z6.invalid_string:if(typeof J.validation==="object")if("includes"in J.validation){if(Y=`Invalid input: must include "${J.validation.includes}"`,typeof J.validation.position==="number")Y=`${Y} at one or more positions greater than or equal to ${J.validation.position}`}else if("startsWith"in J.validation)Y=`Invalid input: must start with "${J.validation.startsWith}"`;else if("endsWith"in J.validation)Y=`Invalid input: must end with "${J.validation.endsWith}"`;else N9.assertNever(J.validation);else if(J.validation!=="regex")Y=`Invalid ${J.validation}`;else Y="Invalid";break;case z6.too_small:if(J.type==="array")Y=`Array must contain ${J.exact?"exactly":J.inclusive?"at least":"more than"} ${J.minimum} element(s)`;else if(J.type==="string")Y=`String must contain ${J.exact?"exactly":J.inclusive?"at least":"over"} ${J.minimum} character(s)`;else if(J.type==="number")Y=`Number must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${J.minimum}`;else if(J.type==="bigint")Y=`Number must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${J.minimum}`;else if(J.type==="date")Y=`Date must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(J.minimum))}`;else Y="Invalid input";break;case z6.too_big:if(J.type==="array")Y=`Array must contain ${J.exact?"exactly":J.inclusive?"at most":"less than"} ${J.maximum} element(s)`;else if(J.type==="string")Y=`String must contain ${J.exact?"exactly":J.inclusive?"at most":"under"} ${J.maximum} character(s)`;else if(J.type==="number")Y=`Number must be ${J.exact?"exactly":J.inclusive?"less than or equal to":"less than"} ${J.maximum}`;else if(J.type==="bigint")Y=`BigInt must be ${J.exact?"exactly":J.inclusive?"less than or equal to":"less than"} ${J.maximum}`;else if(J.type==="date")Y=`Date must be ${J.exact?"exactly":J.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(J.maximum))}`;else Y="Invalid input";break;case z6.custom:Y="Invalid input";break;case z6.invalid_intersection_types:Y="Intersection results could not be merged";break;case z6.not_multiple_of:Y=`Number must be a multiple of ${J.multipleOf}`;break;case z6.not_finite:Y="Number must be finite";break;default:Y=Q.defaultError,N9.assertNever(J)}return{message:Y}},xW;var MZ1=L1(()=>{Ul();r_();xW=DQ4});function MQ4(J){KF0=J}function DE(){return KF0}var KF0;var Bl=L1(()=>{MZ1();KF0=xW});function r6(J,Q){let Y=DE(),X=s_({issueData:Q,data:J.data,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,Y,Y===xW?void 0:xW].filter((G)=>!!G)});J.common.issues.push(X)}class JJ{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(J,Q){let Y=[];for(let X of Q){if(X.status==="aborted")return o4;if(X.status==="dirty")J.dirty();Y.push(X.value)}return{status:J.value,value:Y}}static async mergeObjectAsync(J,Q){let Y=[];for(let X of Q){let G=await X.key,Z=await X.value;Y.push({key:G,value:Z})}return JJ.mergeObjectSync(J,Y)}static mergeObjectSync(J,Q){let Y={};for(let X of Q){let{key:G,value:Z}=X;if(G.status==="aborted")return o4;if(Z.status==="aborted")return o4;if(G.status==="dirty")J.dirty();if(Z.status==="dirty")J.dirty();if(G.value!=="__proto__"&&(typeof Z.value<"u"||X.alwaysSet))Y[G.value]=Z.value}return{status:J.value,value:Y}}}var s_=(J)=>{let{data:Q,path:Y,errorMaps:X,issueData:G}=J,Z=[...Y,...G.path||[]],q={...G,path:Z};if(G.message!==void 0)return{...G,path:Z,message:G.message};let V="",K=X.filter((W)=>!!W).slice().reverse();for(let W of K)V=W(q,{data:Q,defaultError:V}).message;return{...G,path:Z,message:V}},LQ4,o4,sD=(J)=>({status:"dirty",value:J}),cJ=(J)=>({status:"valid",value:J}),Nl=(J)=>J.status==="aborted",Dl=(J)=>J.status==="dirty",vF=(J)=>J.status==="valid",ME=(J)=>typeof Promise<"u"&&J instanceof Promise;var LZ1=L1(()=>{Bl();MZ1();LQ4=[];o4=Object.freeze({status:"aborted"})});var WF0=()=>{};var M4;var HF0=L1(()=>{(function(J){J.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},J.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(M4||(M4={}))});class I${constructor(J,Q,Y,X){this._cachedPath=[],this.parent=J,this.data=Q,this._path=Y,this._key=X}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function S8(J){if(!J)return{};let{errorMap:Q,invalid_type_error:Y,required_error:X,description:G}=J;if(Q&&(Y||X))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(Q)return{errorMap:Q,description:G};return{errorMap:(q,V)=>{let{message:K}=J;if(q.code==="invalid_enum_value")return{message:K??V.defaultError};if(typeof V.data>"u")return{message:K??X??V.defaultError};if(q.code!=="invalid_type")return{message:V.defaultError};return{message:K??Y??V.defaultError}},description:G}}class o8{get description(){return this._def.description}_getType(J){return OV(J.data)}_getOrReturnCtx(J,Q){return Q||{common:J.parent.common,data:J.data,parsedType:OV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}_processInputParams(J){return{status:new JJ,ctx:{common:J.parent.common,data:J.data,parsedType:OV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}}_parseSync(J){let Q=this._parse(J);if(ME(Q))throw Error("Synchronous parse encountered promise.");return Q}_parseAsync(J){let Q=this._parse(J);return Promise.resolve(Q)}parse(J,Q){let Y=this.safeParse(J,Q);if(Y.success)return Y.data;throw Y.error}safeParse(J,Q){let Y={common:{issues:[],async:Q?.async??!1,contextualErrorMap:Q?.errorMap},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:OV(J)},X=this._parseSync({data:J,path:Y.path,parent:Y});return zF0(Y,X)}"~validate"(J){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:OV(J)};if(!this["~standard"].async)try{let Y=this._parseSync({data:J,path:[],parent:Q});return vF(Y)?{value:Y.value}:{issues:Q.common.issues}}catch(Y){if(Y?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;Q.common={issues:[],async:!0}}return this._parseAsync({data:J,path:[],parent:Q}).then((Y)=>vF(Y)?{value:Y.value}:{issues:Q.common.issues})}async parseAsync(J,Q){let Y=await this.safeParseAsync(J,Q);if(Y.success)return Y.data;throw Y.error}async safeParseAsync(J,Q){let Y={common:{issues:[],contextualErrorMap:Q?.errorMap,async:!0},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:OV(J)},X=this._parse({data:J,path:Y.path,parent:Y}),G=await(ME(X)?X:Promise.resolve(X));return zF0(Y,G)}refine(J,Q){let Y=(X)=>{if(typeof Q==="string"||typeof Q>"u")return{message:Q};else if(typeof Q==="function")return Q(X);else return Q};return this._refinement((X,G)=>{let Z=J(X),q=()=>G.addIssue({code:z6.custom,...Y(X)});if(typeof Promise<"u"&&Z instanceof Promise)return Z.then((V)=>{if(!V)return q(),!1;else return!0});if(!Z)return q(),!1;else return!0})}refinement(J,Q){return this._refinement((Y,X)=>{if(!J(Y))return X.addIssue(typeof Q==="function"?Q(Y,X):Q),!1;else return!0})}_refinement(J){return new P$({schema:this,typeName:$8.ZodEffects,effect:{type:"refinement",refinement:J}})}superRefine(J){return this._refinement(J)}constructor(J){this.spa=this.safeParseAsync,this._def=J,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:(Q)=>this["~validate"](Q)}}optional(){return E$.create(this,this._def)}nullable(){return fW.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return w$.create(this)}promise(){return QM.create(this,this._def)}or(J){return IE.create([this,J],this._def)}and(J){return PE.create(this,J,this._def)}transform(J){return new P$({...S8(this._def),schema:this,typeName:$8.ZodEffects,effect:{type:"transform",transform:J}})}default(J){let Q=typeof J==="function"?J:()=>J;return new jE({...S8(this._def),innerType:this,defaultValue:Q,typeName:$8.ZodDefault})}brand(){return new Ll({typeName:$8.ZodBranded,type:this,...S8(this._def)})}catch(J){let Q=typeof J==="function"?J:()=>J;return new SE({...S8(this._def),innerType:this,catchValue:Q,typeName:$8.ZodCatch})}describe(J){return new this.constructor({...this._def,description:J})}pipe(J){return Xk.create(this,J)}readonly(){return _E.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function BF0(J){let Q="[0-5]\\d";if(J.precision)Q=`${Q}\\.\\d{${J.precision}}`;else if(J.precision==null)Q=`${Q}(\\.\\d+)?`;let Y=J.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${Q})${Y}`}function fQ4(J){return new RegExp(`^${BF0(J)}$`)}function NF0(J){let Q=`${UF0}T${BF0(J)}`,Y=[];if(Y.push(J.local?"Z?":"Z"),J.offset)Y.push("([+-]\\d{2}:?\\d{2})");return Q=`${Q}(${Y.join("|")})`,new RegExp(`^${Q}$`)}function hQ4(J,Q){if((Q==="v4"||!Q)&&jQ4.test(J))return!0;if((Q==="v6"||!Q)&&_Q4.test(J))return!0;return!1}function bQ4(J,Q){if(!PQ4.test(J))return!1;try{let[Y]=J.split(".");if(!Y)return!1;let X=Y.replace(/-/g,"+").replace(/_/g,"/").padEnd(Y.length+(4-Y.length%4)%4,"="),G=JSON.parse(atob(X));if(typeof G!=="object"||G===null)return!1;if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(Q&&G.alg!==Q)return!1;return!0}catch{return!1}}function gQ4(J,Q){if((Q==="v4"||!Q)&&SQ4.test(J))return!0;if((Q==="v6"||!Q)&&kQ4.test(J))return!0;return!1}function mQ4(J,Q){let Y=(J.toString().split(".")[1]||"").length,X=(Q.toString().split(".")[1]||"").length,G=Y>X?Y:X,Z=Number.parseInt(J.toFixed(G).replace(".","")),q=Number.parseInt(Q.toFixed(G).replace(".",""));return Z%q/10**G}function LE(J){if(J instanceof j7){let Q={};for(let Y in J.shape){let X=J.shape[Y];Q[Y]=E$.create(LE(X))}return new j7({...J._def,shape:()=>Q})}else if(J instanceof w$)return new w$({...J._def,type:LE(J.element)});else if(J instanceof E$)return E$.create(LE(J.unwrap()));else if(J instanceof fW)return fW.create(LE(J.unwrap()));else if(J instanceof EV)return EV.create(J.items.map((Q)=>LE(Q)));else return J}function OZ1(J,Q){let Y=OV(J),X=OV(Q);if(J===Q)return{valid:!0,data:J};else if(Y===x6.object&&X===x6.object){let G=N9.objectKeys(Q),Z=N9.objectKeys(J).filter((V)=>G.indexOf(V)!==-1),q={...J,...Q};for(let V of Z){let K=OZ1(J[V],Q[V]);if(!K.valid)return{valid:!1};q[V]=K.data}return{valid:!0,data:q}}else if(Y===x6.array&&X===x6.array){if(J.length!==Q.length)return{valid:!1};let G=[];for(let Z=0;Z<J.length;Z++){let q=J[Z],V=Q[Z],K=OZ1(q,V);if(!K.valid)return{valid:!1};G.push(K.data)}return{valid:!0,data:G}}else if(Y===x6.date&&X===x6.date&&+J===+Q)return{valid:!0,data:J};else return{valid:!1}}function DF0(J,Q){return new gF({values:J,typeName:$8.ZodEnum,...S8(Q)})}function FF0(J,Q){let Y=typeof J==="function"?J(Q):typeof J==="string"?{message:J}:J;return typeof Y==="string"?{message:Y}:Y}function MF0(J,Q={},Y){if(J)return eD.create().superRefine((X,G)=>{let Z=J(X);if(Z instanceof Promise)return Z.then((q)=>{if(!q){let V=FF0(Q,X),K=V.fatal??Y??!0;G.addIssue({code:"custom",...V,fatal:K})}});if(!Z){let q=FF0(Q,X),V=q.fatal??Y??!0;G.addIssue({code:"custom",...q,fatal:V})}return});return eD.create()}var zF0=(J,Q)=>{if(vF(Q))return{success:!0,data:Q.value};else{if(!J.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Y=new WY(J.common.issues);return this._error=Y,this._error}}}},AQ4,OQ4,wQ4,EQ4,IQ4,PQ4,TQ4,RQ4,CQ4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",AZ1,jQ4,SQ4,_Q4,kQ4,yQ4,xQ4,UF0="((\\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])))",vQ4,O$,hF,bF,OE,tD,t_,wE,EE,eD,fF,wV,e_,w$,j7,IE,vW=(J)=>{if(J instanceof TE)return vW(J.schema);else if(J instanceof P$)return vW(J.innerType());else if(J instanceof RE)return[J.value];else if(J instanceof gF)return J.options;else if(J instanceof CE)return N9.objectValues(J.enum);else if(J instanceof jE)return vW(J._def.innerType);else if(J instanceof wE)return[void 0];else if(J instanceof EE)return[null];else if(J instanceof E$)return[void 0,...vW(J.unwrap())];else if(J instanceof fW)return[null,...vW(J.unwrap())];else if(J instanceof Ll)return vW(J.unwrap());else if(J instanceof _E)return vW(J.unwrap());else if(J instanceof SE)return vW(J._def.innerType);else return[]},Ml,PE,EV,Jk,Qk,JM,AE,TE,RE,gF,CE,QM,P$,E$,fW,jE,SE,Yk,uQ4,Ll,Xk,_E,pQ4,$8,dQ4=(J,Q={message:`Input not instance of ${J.name}`})=>MF0((Y)=>Y instanceof J,Q),LF0,AF0,cQ4,lQ4,OF0,iQ4,nQ4,aQ4,oQ4,rQ4,sQ4,tQ4,eQ4,JY4,QY4,YY4,XY4,GY4,ZY4,$Y4,qY4,VY4,KY4,WY4,HY4,zY4,FY4,UY4,BY4,NY4,DY4,MY4,LY4,AY4,OY4=()=>LF0().optional(),wY4=()=>AF0().optional(),EY4=()=>OF0().optional(),IY4,PY4;var wF0=L1(()=>{Ul();Bl();HF0();LZ1();r_();AQ4=/^c[^\s-]{8,}$/i,OQ4=/^[0-9a-z]+$/,wQ4=/^[0-9A-HJKMNP-TV-Z]{26}$/i,EQ4=/^[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,IQ4=/^[a-z0-9_-]{21}$/i,PQ4=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,TQ4=/^[-+]?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)?)??$/,RQ4=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jQ4=/^(?:(?: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])$/,SQ4=/^(?:(?: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])$/,_Q4=/^(([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]))$/,kQ4=/^(([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])$/,yQ4=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,xQ4=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vQ4=new RegExp(`^${UF0}$`);O$=class O$ extends o8{_parse(J){if(this._def.coerce)J.data=String(J.data);if(this._getType(J)!==x6.string){let G=this._getOrReturnCtx(J);return r6(G,{code:z6.invalid_type,expected:x6.string,received:G.parsedType}),o4}let Y=new JJ,X=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(J.data.length<G.value)X=this._getOrReturnCtx(J,X),r6(X,{code:z6.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Y.dirty()}else if(G.kind==="max"){if(J.data.length>G.value)X=this._getOrReturnCtx(J,X),r6(X,{code:z6.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Y.dirty()}else if(G.kind==="length"){let Z=J.data.length>G.value,q=J.data.length<G.value;if(Z||q){if(X=this._getOrReturnCtx(J,X),Z)r6(X,{code:z6.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(q)r6(X,{code:z6.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});Y.dirty()}}else if(G.kind==="email"){if(!RQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"email",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="emoji"){if(!AZ1)AZ1=new RegExp(CQ4,"u");if(!AZ1.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"emoji",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="uuid"){if(!EQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"uuid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="nanoid"){if(!IQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"nanoid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid"){if(!AQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"cuid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid2"){if(!OQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"cuid2",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ulid"){if(!wQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"ulid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="url")try{new URL(J.data)}catch{X=this._getOrReturnCtx(J,X),r6(X,{validation:"url",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="regex"){if(G.regex.lastIndex=0,!G.regex.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"regex",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="trim")J.data=J.data.trim();else if(G.kind==="includes"){if(!J.data.includes(G.value,G.position))X=this._getOrReturnCtx(J,X),r6(X,{code:z6.invalid_string,validation:{includes:G.value,position:G.position},message:G.message}),Y.dirty()}else if(G.kind==="toLowerCase")J.data=J.data.toLowerCase();else if(G.kind==="toUpperCase")J.data=J.data.toUpperCase();else if(G.kind==="startsWith"){if(!J.data.startsWith(G.value))X=this._getOrReturnCtx(J,X),r6(X,{code:z6.invalid_string,validation:{startsWith:G.value},message:G.message}),Y.dirty()}else if(G.kind==="endsWith"){if(!J.data.endsWith(G.value))X=this._getOrReturnCtx(J,X),r6(X,{code:z6.invalid_string,validation:{endsWith:G.value},message:G.message}),Y.dirty()}else if(G.kind==="datetime"){if(!NF0(G).test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{code:z6.invalid_string,validation:"datetime",message:G.message}),Y.dirty()}else if(G.kind==="date"){if(!vQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{code:z6.invalid_string,validation:"date",message:G.message}),Y.dirty()}else if(G.kind==="time"){if(!fQ4(G).test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{code:z6.invalid_string,validation:"time",message:G.message}),Y.dirty()}else if(G.kind==="duration"){if(!TQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"duration",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ip"){if(!hQ4(J.data,G.version))X=this._getOrReturnCtx(J,X),r6(X,{validation:"ip",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="jwt"){if(!bQ4(J.data,G.alg))X=this._getOrReturnCtx(J,X),r6(X,{validation:"jwt",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cidr"){if(!gQ4(J.data,G.version))X=this._getOrReturnCtx(J,X),r6(X,{validation:"cidr",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64"){if(!yQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"base64",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64url"){if(!xQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"base64url",code:z6.invalid_string,message:G.message}),Y.dirty()}else N9.assertNever(G);return{status:Y.value,value:J.data}}_regex(J,Q,Y){return this.refinement((X)=>J.test(X),{validation:Q,code:z6.invalid_string,...M4.errToObj(Y)})}_addCheck(J){return new O$({...this._def,checks:[...this._def.checks,J]})}email(J){return this._addCheck({kind:"email",...M4.errToObj(J)})}url(J){return this._addCheck({kind:"url",...M4.errToObj(J)})}emoji(J){return this._addCheck({kind:"emoji",...M4.errToObj(J)})}uuid(J){return this._addCheck({kind:"uuid",...M4.errToObj(J)})}nanoid(J){return this._addCheck({kind:"nanoid",...M4.errToObj(J)})}cuid(J){return this._addCheck({kind:"cuid",...M4.errToObj(J)})}cuid2(J){return this._addCheck({kind:"cuid2",...M4.errToObj(J)})}ulid(J){return this._addCheck({kind:"ulid",...M4.errToObj(J)})}base64(J){return this._addCheck({kind:"base64",...M4.errToObj(J)})}base64url(J){return this._addCheck({kind:"base64url",...M4.errToObj(J)})}jwt(J){return this._addCheck({kind:"jwt",...M4.errToObj(J)})}ip(J){return this._addCheck({kind:"ip",...M4.errToObj(J)})}cidr(J){return this._addCheck({kind:"cidr",...M4.errToObj(J)})}datetime(J){if(typeof J==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:J});return this._addCheck({kind:"datetime",precision:typeof J?.precision>"u"?null:J?.precision,offset:J?.offset??!1,local:J?.local??!1,...M4.errToObj(J?.message)})}date(J){return this._addCheck({kind:"date",message:J})}time(J){if(typeof J==="string")return this._addCheck({kind:"time",precision:null,message:J});return this._addCheck({kind:"time",precision:typeof J?.precision>"u"?null:J?.precision,...M4.errToObj(J?.message)})}duration(J){return this._addCheck({kind:"duration",...M4.errToObj(J)})}regex(J,Q){return this._addCheck({kind:"regex",regex:J,...M4.errToObj(Q)})}includes(J,Q){return this._addCheck({kind:"includes",value:J,position:Q?.position,...M4.errToObj(Q?.message)})}startsWith(J,Q){return this._addCheck({kind:"startsWith",value:J,...M4.errToObj(Q)})}endsWith(J,Q){return this._addCheck({kind:"endsWith",value:J,...M4.errToObj(Q)})}min(J,Q){return this._addCheck({kind:"min",value:J,...M4.errToObj(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J,...M4.errToObj(Q)})}length(J,Q){return this._addCheck({kind:"length",value:J,...M4.errToObj(Q)})}nonempty(J){return this.min(1,M4.errToObj(J))}trim(){return new O$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new O$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new O$({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((J)=>J.kind==="datetime")}get isDate(){return!!this._def.checks.find((J)=>J.kind==="date")}get isTime(){return!!this._def.checks.find((J)=>J.kind==="time")}get isDuration(){return!!this._def.checks.find((J)=>J.kind==="duration")}get isEmail(){return!!this._def.checks.find((J)=>J.kind==="email")}get isURL(){return!!this._def.checks.find((J)=>J.kind==="url")}get isEmoji(){return!!this._def.checks.find((J)=>J.kind==="emoji")}get isUUID(){return!!this._def.checks.find((J)=>J.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((J)=>J.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((J)=>J.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((J)=>J.kind==="cuid2")}get isULID(){return!!this._def.checks.find((J)=>J.kind==="ulid")}get isIP(){return!!this._def.checks.find((J)=>J.kind==="ip")}get isCIDR(){return!!this._def.checks.find((J)=>J.kind==="cidr")}get isBase64(){return!!this._def.checks.find((J)=>J.kind==="base64")}get isBase64url(){return!!this._def.checks.find((J)=>J.kind==="base64url")}get minLength(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxLength(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}};O$.create=(J)=>{return new O$({checks:[],typeName:$8.ZodString,coerce:J?.coerce??!1,...S8(J)})};hF=class hF extends o8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(J){if(this._def.coerce)J.data=Number(J.data);if(this._getType(J)!==x6.number){let G=this._getOrReturnCtx(J);return r6(G,{code:z6.invalid_type,expected:x6.number,received:G.parsedType}),o4}let Y=void 0,X=new JJ;for(let G of this._def.checks)if(G.kind==="int"){if(!N9.isInteger(J.data))Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.invalid_type,expected:"integer",received:"float",message:G.message}),X.dirty()}else if(G.kind==="min"){if(G.inclusive?J.data<G.value:J.data<=G.value)Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.too_small,minimum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),X.dirty()}else if(G.kind==="max"){if(G.inclusive?J.data>G.value:J.data>=G.value)Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),X.dirty()}else if(G.kind==="multipleOf"){if(mQ4(J.data,G.value)!==0)Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.not_multiple_of,multipleOf:G.value,message:G.message}),X.dirty()}else if(G.kind==="finite"){if(!Number.isFinite(J.data))Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.not_finite,message:G.message}),X.dirty()}else N9.assertNever(G);return{status:X.value,value:J.data}}gte(J,Q){return this.setLimit("min",J,!0,M4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,M4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,M4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,M4.toString(Q))}setLimit(J,Q,Y,X){return new hF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:M4.toString(X)}]})}_addCheck(J){return new hF({...this._def,checks:[...this._def.checks,J]})}int(J){return this._addCheck({kind:"int",message:M4.toString(J)})}positive(J){return this._addCheck({kind:"min",value:0,inclusive:!1,message:M4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:0,inclusive:!1,message:M4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:0,inclusive:!0,message:M4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:0,inclusive:!0,message:M4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:M4.toString(Q)})}finite(J){return this._addCheck({kind:"finite",message:M4.toString(J)})}safe(J){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:M4.toString(J)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:M4.toString(J)})}get minValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}get isInt(){return!!this._def.checks.find((J)=>J.kind==="int"||J.kind==="multipleOf"&&N9.isInteger(J.value))}get isFinite(){let J=null,Q=null;for(let Y of this._def.checks)if(Y.kind==="finite"||Y.kind==="int"||Y.kind==="multipleOf")return!0;else if(Y.kind==="min"){if(Q===null||Y.value>Q)Q=Y.value}else if(Y.kind==="max"){if(J===null||Y.value<J)J=Y.value}return Number.isFinite(Q)&&Number.isFinite(J)}};hF.create=(J)=>{return new hF({checks:[],typeName:$8.ZodNumber,coerce:J?.coerce||!1,...S8(J)})};bF=class bF extends o8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(J){if(this._def.coerce)try{J.data=BigInt(J.data)}catch{return this._getInvalidInput(J)}if(this._getType(J)!==x6.bigint)return this._getInvalidInput(J);let Y=void 0,X=new JJ;for(let G of this._def.checks)if(G.kind==="min"){if(G.inclusive?J.data<G.value:J.data<=G.value)Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.too_small,type:"bigint",minimum:G.value,inclusive:G.inclusive,message:G.message}),X.dirty()}else if(G.kind==="max"){if(G.inclusive?J.data>G.value:J.data>=G.value)Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.too_big,type:"bigint",maximum:G.value,inclusive:G.inclusive,message:G.message}),X.dirty()}else if(G.kind==="multipleOf"){if(J.data%G.value!==BigInt(0))Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.not_multiple_of,multipleOf:G.value,message:G.message}),X.dirty()}else N9.assertNever(G);return{status:X.value,value:J.data}}_getInvalidInput(J){let Q=this._getOrReturnCtx(J);return r6(Q,{code:z6.invalid_type,expected:x6.bigint,received:Q.parsedType}),o4}gte(J,Q){return this.setLimit("min",J,!0,M4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,M4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,M4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,M4.toString(Q))}setLimit(J,Q,Y,X){return new bF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:M4.toString(X)}]})}_addCheck(J){return new bF({...this._def,checks:[...this._def.checks,J]})}positive(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:M4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:M4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:M4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:M4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:M4.toString(Q)})}get minValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}};bF.create=(J)=>{return new bF({checks:[],typeName:$8.ZodBigInt,coerce:J?.coerce??!1,...S8(J)})};OE=class OE extends o8{_parse(J){if(this._def.coerce)J.data=Boolean(J.data);if(this._getType(J)!==x6.boolean){let Y=this._getOrReturnCtx(J);return r6(Y,{code:z6.invalid_type,expected:x6.boolean,received:Y.parsedType}),o4}return cJ(J.data)}};OE.create=(J)=>{return new OE({typeName:$8.ZodBoolean,coerce:J?.coerce||!1,...S8(J)})};tD=class tD extends o8{_parse(J){if(this._def.coerce)J.data=new Date(J.data);if(this._getType(J)!==x6.date){let G=this._getOrReturnCtx(J);return r6(G,{code:z6.invalid_type,expected:x6.date,received:G.parsedType}),o4}if(Number.isNaN(J.data.getTime())){let G=this._getOrReturnCtx(J);return r6(G,{code:z6.invalid_date}),o4}let Y=new JJ,X=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(J.data.getTime()<G.value)X=this._getOrReturnCtx(J,X),r6(X,{code:z6.too_small,message:G.message,inclusive:!0,exact:!1,minimum:G.value,type:"date"}),Y.dirty()}else if(G.kind==="max"){if(J.data.getTime()>G.value)X=this._getOrReturnCtx(J,X),r6(X,{code:z6.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),Y.dirty()}else N9.assertNever(G);return{status:Y.value,value:new Date(J.data.getTime())}}_addCheck(J){return new tD({...this._def,checks:[...this._def.checks,J]})}min(J,Q){return this._addCheck({kind:"min",value:J.getTime(),message:M4.toString(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J.getTime(),message:M4.toString(Q)})}get minDate(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J!=null?new Date(J):null}get maxDate(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J!=null?new Date(J):null}};tD.create=(J)=>{return new tD({checks:[],coerce:J?.coerce||!1,typeName:$8.ZodDate,...S8(J)})};t_=class t_ extends o8{_parse(J){if(this._getType(J)!==x6.symbol){let Y=this._getOrReturnCtx(J);return r6(Y,{code:z6.invalid_type,expected:x6.symbol,received:Y.parsedType}),o4}return cJ(J.data)}};t_.create=(J)=>{return new t_({typeName:$8.ZodSymbol,...S8(J)})};wE=class wE extends o8{_parse(J){if(this._getType(J)!==x6.undefined){let Y=this._getOrReturnCtx(J);return r6(Y,{code:z6.invalid_type,expected:x6.undefined,received:Y.parsedType}),o4}return cJ(J.data)}};wE.create=(J)=>{return new wE({typeName:$8.ZodUndefined,...S8(J)})};EE=class EE extends o8{_parse(J){if(this._getType(J)!==x6.null){let Y=this._getOrReturnCtx(J);return r6(Y,{code:z6.invalid_type,expected:x6.null,received:Y.parsedType}),o4}return cJ(J.data)}};EE.create=(J)=>{return new EE({typeName:$8.ZodNull,...S8(J)})};eD=class eD extends o8{constructor(){super(...arguments);this._any=!0}_parse(J){return cJ(J.data)}};eD.create=(J)=>{return new eD({typeName:$8.ZodAny,...S8(J)})};fF=class fF extends o8{constructor(){super(...arguments);this._unknown=!0}_parse(J){return cJ(J.data)}};fF.create=(J)=>{return new fF({typeName:$8.ZodUnknown,...S8(J)})};wV=class wV extends o8{_parse(J){let Q=this._getOrReturnCtx(J);return r6(Q,{code:z6.invalid_type,expected:x6.never,received:Q.parsedType}),o4}};wV.create=(J)=>{return new wV({typeName:$8.ZodNever,...S8(J)})};e_=class e_ extends o8{_parse(J){if(this._getType(J)!==x6.undefined){let Y=this._getOrReturnCtx(J);return r6(Y,{code:z6.invalid_type,expected:x6.void,received:Y.parsedType}),o4}return cJ(J.data)}};e_.create=(J)=>{return new e_({typeName:$8.ZodVoid,...S8(J)})};w$=class w$ extends o8{_parse(J){let{ctx:Q,status:Y}=this._processInputParams(J),X=this._def;if(Q.parsedType!==x6.array)return r6(Q,{code:z6.invalid_type,expected:x6.array,received:Q.parsedType}),o4;if(X.exactLength!==null){let Z=Q.data.length>X.exactLength.value,q=Q.data.length<X.exactLength.value;if(Z||q)r6(Q,{code:Z?z6.too_big:z6.too_small,minimum:q?X.exactLength.value:void 0,maximum:Z?X.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:X.exactLength.message}),Y.dirty()}if(X.minLength!==null){if(Q.data.length<X.minLength.value)r6(Q,{code:z6.too_small,minimum:X.minLength.value,type:"array",inclusive:!0,exact:!1,message:X.minLength.message}),Y.dirty()}if(X.maxLength!==null){if(Q.data.length>X.maxLength.value)r6(Q,{code:z6.too_big,maximum:X.maxLength.value,type:"array",inclusive:!0,exact:!1,message:X.maxLength.message}),Y.dirty()}if(Q.common.async)return Promise.all([...Q.data].map((Z,q)=>{return X.type._parseAsync(new I$(Q,Z,Q.path,q))})).then((Z)=>{return JJ.mergeArray(Y,Z)});let G=[...Q.data].map((Z,q)=>{return X.type._parseSync(new I$(Q,Z,Q.path,q))});return JJ.mergeArray(Y,G)}get element(){return this._def.type}min(J,Q){return new w$({...this._def,minLength:{value:J,message:M4.toString(Q)}})}max(J,Q){return new w$({...this._def,maxLength:{value:J,message:M4.toString(Q)}})}length(J,Q){return new w$({...this._def,exactLength:{value:J,message:M4.toString(Q)}})}nonempty(J){return this.min(1,J)}};w$.create=(J,Q)=>{return new w$({type:J,minLength:null,maxLength:null,exactLength:null,typeName:$8.ZodArray,...S8(Q)})};j7=class j7 extends o8{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let J=this._def.shape(),Q=N9.objectKeys(J);return this._cached={shape:J,keys:Q},this._cached}_parse(J){if(this._getType(J)!==x6.object){let K=this._getOrReturnCtx(J);return r6(K,{code:z6.invalid_type,expected:x6.object,received:K.parsedType}),o4}let{status:Y,ctx:X}=this._processInputParams(J),{shape:G,keys:Z}=this._getCached(),q=[];if(!(this._def.catchall instanceof wV&&this._def.unknownKeys==="strip")){for(let K in X.data)if(!Z.includes(K))q.push(K)}let V=[];for(let K of Z){let W=G[K],H=X.data[K];V.push({key:{status:"valid",value:K},value:W._parse(new I$(X,H,X.path,K)),alwaysSet:K in X.data})}if(this._def.catchall instanceof wV){let K=this._def.unknownKeys;if(K==="passthrough")for(let W of q)V.push({key:{status:"valid",value:W},value:{status:"valid",value:X.data[W]}});else if(K==="strict"){if(q.length>0)r6(X,{code:z6.unrecognized_keys,keys:q}),Y.dirty()}else if(K==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let K=this._def.catchall;for(let W of q){let H=X.data[W];V.push({key:{status:"valid",value:W},value:K._parse(new I$(X,H,X.path,W)),alwaysSet:W in X.data})}}if(X.common.async)return Promise.resolve().then(async()=>{let K=[];for(let W of V){let H=await W.key,z=await W.value;K.push({key:H,value:z,alwaysSet:W.alwaysSet})}return K}).then((K)=>{return JJ.mergeObjectSync(Y,K)});else return JJ.mergeObjectSync(Y,V)}get shape(){return this._def.shape()}strict(J){return M4.errToObj,new j7({...this._def,unknownKeys:"strict",...J!==void 0?{errorMap:(Q,Y)=>{let X=this._def.errorMap?.(Q,Y).message??Y.defaultError;if(Q.code==="unrecognized_keys")return{message:M4.errToObj(J).message??X};return{message:X}}}:{}})}strip(){return new j7({...this._def,unknownKeys:"strip"})}passthrough(){return new j7({...this._def,unknownKeys:"passthrough"})}extend(J){return new j7({...this._def,shape:()=>({...this._def.shape(),...J})})}merge(J){return new j7({unknownKeys:J._def.unknownKeys,catchall:J._def.catchall,shape:()=>({...this._def.shape(),...J._def.shape()}),typeName:$8.ZodObject})}setKey(J,Q){return this.augment({[J]:Q})}catchall(J){return new j7({...this._def,catchall:J})}pick(J){let Q={};for(let Y of N9.objectKeys(J))if(J[Y]&&this.shape[Y])Q[Y]=this.shape[Y];return new j7({...this._def,shape:()=>Q})}omit(J){let Q={};for(let Y of N9.objectKeys(this.shape))if(!J[Y])Q[Y]=this.shape[Y];return new j7({...this._def,shape:()=>Q})}deepPartial(){return LE(this)}partial(J){let Q={};for(let Y of N9.objectKeys(this.shape)){let X=this.shape[Y];if(J&&!J[Y])Q[Y]=X;else Q[Y]=X.optional()}return new j7({...this._def,shape:()=>Q})}required(J){let Q={};for(let Y of N9.objectKeys(this.shape))if(J&&!J[Y])Q[Y]=this.shape[Y];else{let G=this.shape[Y];while(G instanceof E$)G=G._def.innerType;Q[Y]=G}return new j7({...this._def,shape:()=>Q})}keyof(){return DF0(N9.objectKeys(this.shape))}};j7.create=(J,Q)=>{return new j7({shape:()=>J,unknownKeys:"strip",catchall:wV.create(),typeName:$8.ZodObject,...S8(Q)})};j7.strictCreate=(J,Q)=>{return new j7({shape:()=>J,unknownKeys:"strict",catchall:wV.create(),typeName:$8.ZodObject,...S8(Q)})};j7.lazycreate=(J,Q)=>{return new j7({shape:J,unknownKeys:"strip",catchall:wV.create(),typeName:$8.ZodObject,...S8(Q)})};IE=class IE extends o8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=this._def.options;function X(G){for(let q of G)if(q.result.status==="valid")return q.result;for(let q of G)if(q.result.status==="dirty")return Q.common.issues.push(...q.ctx.common.issues),q.result;let Z=G.map((q)=>new WY(q.ctx.common.issues));return r6(Q,{code:z6.invalid_union,unionErrors:Z}),o4}if(Q.common.async)return Promise.all(Y.map(async(G)=>{let Z={...Q,common:{...Q.common,issues:[]},parent:null};return{result:await G._parseAsync({data:Q.data,path:Q.path,parent:Z}),ctx:Z}})).then(X);else{let G=void 0,Z=[];for(let V of Y){let K={...Q,common:{...Q.common,issues:[]},parent:null},W=V._parseSync({data:Q.data,path:Q.path,parent:K});if(W.status==="valid")return W;else if(W.status==="dirty"&&!G)G={result:W,ctx:K};if(K.common.issues.length)Z.push(K.common.issues)}if(G)return Q.common.issues.push(...G.ctx.common.issues),G.result;let q=Z.map((V)=>new WY(V));return r6(Q,{code:z6.invalid_union,unionErrors:q}),o4}}get options(){return this._def.options}};IE.create=(J,Q)=>{return new IE({options:J,typeName:$8.ZodUnion,...S8(Q)})};Ml=class Ml extends o8{_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==x6.object)return r6(Q,{code:z6.invalid_type,expected:x6.object,received:Q.parsedType}),o4;let Y=this.discriminator,X=Q.data[Y],G=this.optionsMap.get(X);if(!G)return r6(Q,{code:z6.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Y]}),o4;if(Q.common.async)return G._parseAsync({data:Q.data,path:Q.path,parent:Q});else return G._parseSync({data:Q.data,path:Q.path,parent:Q})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(J,Q,Y){let X=new Map;for(let G of Q){let Z=vW(G.shape[J]);if(!Z.length)throw Error(`A discriminator value for key \`${J}\` could not be extracted from all schema options`);for(let q of Z){if(X.has(q))throw Error(`Discriminator property ${String(J)} has duplicate value ${String(q)}`);X.set(q,G)}}return new Ml({typeName:$8.ZodDiscriminatedUnion,discriminator:J,options:Q,optionsMap:X,...S8(Y)})}};PE=class PE extends o8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J),X=(G,Z)=>{if(Nl(G)||Nl(Z))return o4;let q=OZ1(G.value,Z.value);if(!q.valid)return r6(Y,{code:z6.invalid_intersection_types}),o4;if(Dl(G)||Dl(Z))Q.dirty();return{status:Q.value,value:q.data}};if(Y.common.async)return Promise.all([this._def.left._parseAsync({data:Y.data,path:Y.path,parent:Y}),this._def.right._parseAsync({data:Y.data,path:Y.path,parent:Y})]).then(([G,Z])=>X(G,Z));else return X(this._def.left._parseSync({data:Y.data,path:Y.path,parent:Y}),this._def.right._parseSync({data:Y.data,path:Y.path,parent:Y}))}};PE.create=(J,Q,Y)=>{return new PE({left:J,right:Q,typeName:$8.ZodIntersection,...S8(Y)})};EV=class EV extends o8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==x6.array)return r6(Y,{code:z6.invalid_type,expected:x6.array,received:Y.parsedType}),o4;if(Y.data.length<this._def.items.length)return r6(Y,{code:z6.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),o4;if(!this._def.rest&&Y.data.length>this._def.items.length)r6(Y,{code:z6.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q.dirty();let G=[...Y.data].map((Z,q)=>{let V=this._def.items[q]||this._def.rest;if(!V)return null;return V._parse(new I$(Y,Z,Y.path,q))}).filter((Z)=>!!Z);if(Y.common.async)return Promise.all(G).then((Z)=>{return JJ.mergeArray(Q,Z)});else return JJ.mergeArray(Q,G)}get items(){return this._def.items}rest(J){return new EV({...this._def,rest:J})}};EV.create=(J,Q)=>{if(!Array.isArray(J))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new EV({items:J,typeName:$8.ZodTuple,rest:null,...S8(Q)})};Jk=class Jk extends o8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==x6.object)return r6(Y,{code:z6.invalid_type,expected:x6.object,received:Y.parsedType}),o4;let X=[],G=this._def.keyType,Z=this._def.valueType;for(let q in Y.data)X.push({key:G._parse(new I$(Y,q,Y.path,q)),value:Z._parse(new I$(Y,Y.data[q],Y.path,q)),alwaysSet:q in Y.data});if(Y.common.async)return JJ.mergeObjectAsync(Q,X);else return JJ.mergeObjectSync(Q,X)}get element(){return this._def.valueType}static create(J,Q,Y){if(Q instanceof o8)return new Jk({keyType:J,valueType:Q,typeName:$8.ZodRecord,...S8(Y)});return new Jk({keyType:O$.create(),valueType:J,typeName:$8.ZodRecord,...S8(Q)})}};Qk=class Qk extends o8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==x6.map)return r6(Y,{code:z6.invalid_type,expected:x6.map,received:Y.parsedType}),o4;let X=this._def.keyType,G=this._def.valueType,Z=[...Y.data.entries()].map(([q,V],K)=>{return{key:X._parse(new I$(Y,q,Y.path,[K,"key"])),value:G._parse(new I$(Y,V,Y.path,[K,"value"]))}});if(Y.common.async){let q=new Map;return Promise.resolve().then(async()=>{for(let V of Z){let K=await V.key,W=await V.value;if(K.status==="aborted"||W.status==="aborted")return o4;if(K.status==="dirty"||W.status==="dirty")Q.dirty();q.set(K.value,W.value)}return{status:Q.value,value:q}})}else{let q=new Map;for(let V of Z){let{key:K,value:W}=V;if(K.status==="aborted"||W.status==="aborted")return o4;if(K.status==="dirty"||W.status==="dirty")Q.dirty();q.set(K.value,W.value)}return{status:Q.value,value:q}}}};Qk.create=(J,Q,Y)=>{return new Qk({valueType:Q,keyType:J,typeName:$8.ZodMap,...S8(Y)})};JM=class JM extends o8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==x6.set)return r6(Y,{code:z6.invalid_type,expected:x6.set,received:Y.parsedType}),o4;let X=this._def;if(X.minSize!==null){if(Y.data.size<X.minSize.value)r6(Y,{code:z6.too_small,minimum:X.minSize.value,type:"set",inclusive:!0,exact:!1,message:X.minSize.message}),Q.dirty()}if(X.maxSize!==null){if(Y.data.size>X.maxSize.value)r6(Y,{code:z6.too_big,maximum:X.maxSize.value,type:"set",inclusive:!0,exact:!1,message:X.maxSize.message}),Q.dirty()}let G=this._def.valueType;function Z(V){let K=new Set;for(let W of V){if(W.status==="aborted")return o4;if(W.status==="dirty")Q.dirty();K.add(W.value)}return{status:Q.value,value:K}}let q=[...Y.data.values()].map((V,K)=>G._parse(new I$(Y,V,Y.path,K)));if(Y.common.async)return Promise.all(q).then((V)=>Z(V));else return Z(q)}min(J,Q){return new JM({...this._def,minSize:{value:J,message:M4.toString(Q)}})}max(J,Q){return new JM({...this._def,maxSize:{value:J,message:M4.toString(Q)}})}size(J,Q){return this.min(J,Q).max(J,Q)}nonempty(J){return this.min(1,J)}};JM.create=(J,Q)=>{return new JM({valueType:J,minSize:null,maxSize:null,typeName:$8.ZodSet,...S8(Q)})};AE=class AE extends o8{constructor(){super(...arguments);this.validate=this.implement}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==x6.function)return r6(Q,{code:z6.invalid_type,expected:x6.function,received:Q.parsedType}),o4;function Y(q,V){return s_({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,DE(),xW].filter((K)=>!!K),issueData:{code:z6.invalid_arguments,argumentsError:V}})}function X(q,V){return s_({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,DE(),xW].filter((K)=>!!K),issueData:{code:z6.invalid_return_type,returnTypeError:V}})}let G={errorMap:Q.common.contextualErrorMap},Z=Q.data;if(this._def.returns instanceof QM){let q=this;return cJ(async function(...V){let K=new WY([]),W=await q._def.args.parseAsync(V,G).catch((U)=>{throw K.addIssue(Y(V,U)),K}),H=await Reflect.apply(Z,this,W);return await q._def.returns._def.type.parseAsync(H,G).catch((U)=>{throw K.addIssue(X(H,U)),K})})}else{let q=this;return cJ(function(...V){let K=q._def.args.safeParse(V,G);if(!K.success)throw new WY([Y(V,K.error)]);let W=Reflect.apply(Z,this,K.data),H=q._def.returns.safeParse(W,G);if(!H.success)throw new WY([X(W,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...J){return new AE({...this._def,args:EV.create(J).rest(fF.create())})}returns(J){return new AE({...this._def,returns:J})}implement(J){return this.parse(J)}strictImplement(J){return this.parse(J)}static create(J,Q,Y){return new AE({args:J?J:EV.create([]).rest(fF.create()),returns:Q||fF.create(),typeName:$8.ZodFunction,...S8(Y)})}};TE=class TE extends o8{get schema(){return this._def.getter()}_parse(J){let{ctx:Q}=this._processInputParams(J);return this._def.getter()._parse({data:Q.data,path:Q.path,parent:Q})}};TE.create=(J,Q)=>{return new TE({getter:J,typeName:$8.ZodLazy,...S8(Q)})};RE=class RE extends o8{_parse(J){if(J.data!==this._def.value){let Q=this._getOrReturnCtx(J);return r6(Q,{received:Q.data,code:z6.invalid_literal,expected:this._def.value}),o4}return{status:"valid",value:J.data}}get value(){return this._def.value}};RE.create=(J,Q)=>{return new RE({value:J,typeName:$8.ZodLiteral,...S8(Q)})};gF=class gF extends o8{_parse(J){if(typeof J.data!=="string"){let Q=this._getOrReturnCtx(J),Y=this._def.values;return r6(Q,{expected:N9.joinValues(Y),received:Q.parsedType,code:z6.invalid_type}),o4}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(J.data)){let Q=this._getOrReturnCtx(J),Y=this._def.values;return r6(Q,{received:Q.data,code:z6.invalid_enum_value,options:Y}),o4}return cJ(J.data)}get options(){return this._def.values}get enum(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}get Values(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}get Enum(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}extract(J,Q=this._def){return gF.create(J,{...this._def,...Q})}exclude(J,Q=this._def){return gF.create(this.options.filter((Y)=>!J.includes(Y)),{...this._def,...Q})}};gF.create=DF0;CE=class CE extends o8{_parse(J){let Q=N9.getValidEnumValues(this._def.values),Y=this._getOrReturnCtx(J);if(Y.parsedType!==x6.string&&Y.parsedType!==x6.number){let X=N9.objectValues(Q);return r6(Y,{expected:N9.joinValues(X),received:Y.parsedType,code:z6.invalid_type}),o4}if(!this._cache)this._cache=new Set(N9.getValidEnumValues(this._def.values));if(!this._cache.has(J.data)){let X=N9.objectValues(Q);return r6(Y,{received:Y.data,code:z6.invalid_enum_value,options:X}),o4}return cJ(J.data)}get enum(){return this._def.values}};CE.create=(J,Q)=>{return new CE({values:J,typeName:$8.ZodNativeEnum,...S8(Q)})};QM=class QM extends o8{unwrap(){return this._def.type}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==x6.promise&&Q.common.async===!1)return r6(Q,{code:z6.invalid_type,expected:x6.promise,received:Q.parsedType}),o4;let Y=Q.parsedType===x6.promise?Q.data:Promise.resolve(Q.data);return cJ(Y.then((X)=>{return this._def.type.parseAsync(X,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}};QM.create=(J,Q)=>{return new QM({type:J,typeName:$8.ZodPromise,...S8(Q)})};P$=class P$ extends o8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$8.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J),X=this._def.effect||null,G={addIssue:(Z)=>{if(r6(Y,Z),Z.fatal)Q.abort();else Q.dirty()},get path(){return Y.path}};if(G.addIssue=G.addIssue.bind(G),X.type==="preprocess"){let Z=X.transform(Y.data,G);if(Y.common.async)return Promise.resolve(Z).then(async(q)=>{if(Q.value==="aborted")return o4;let V=await this._def.schema._parseAsync({data:q,path:Y.path,parent:Y});if(V.status==="aborted")return o4;if(V.status==="dirty")return sD(V.value);if(Q.value==="dirty")return sD(V.value);return V});else{if(Q.value==="aborted")return o4;let q=this._def.schema._parseSync({data:Z,path:Y.path,parent:Y});if(q.status==="aborted")return o4;if(q.status==="dirty")return sD(q.value);if(Q.value==="dirty")return sD(q.value);return q}}if(X.type==="refinement"){let Z=(q)=>{let V=X.refinement(q,G);if(Y.common.async)return Promise.resolve(V);if(V instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return q};if(Y.common.async===!1){let q=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(q.status==="aborted")return o4;if(q.status==="dirty")Q.dirty();return Z(q.value),{status:Q.value,value:q.value}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((q)=>{if(q.status==="aborted")return o4;if(q.status==="dirty")Q.dirty();return Z(q.value).then(()=>{return{status:Q.value,value:q.value}})})}if(X.type==="transform")if(Y.common.async===!1){let Z=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(!vF(Z))return o4;let q=X.transform(Z.value,G);if(q instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Q.value,value:q}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((Z)=>{if(!vF(Z))return o4;return Promise.resolve(X.transform(Z.value,G)).then((q)=>({status:Q.value,value:q}))});N9.assertNever(X)}};P$.create=(J,Q,Y)=>{return new P$({schema:J,typeName:$8.ZodEffects,effect:Q,...S8(Y)})};P$.createWithPreprocess=(J,Q,Y)=>{return new P$({schema:Q,effect:{type:"preprocess",transform:J},typeName:$8.ZodEffects,...S8(Y)})};E$=class E$ extends o8{_parse(J){if(this._getType(J)===x6.undefined)return cJ(void 0);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};E$.create=(J,Q)=>{return new E$({innerType:J,typeName:$8.ZodOptional,...S8(Q)})};fW=class fW extends o8{_parse(J){if(this._getType(J)===x6.null)return cJ(null);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};fW.create=(J,Q)=>{return new fW({innerType:J,typeName:$8.ZodNullable,...S8(Q)})};jE=class jE extends o8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=Q.data;if(Q.parsedType===x6.undefined)Y=this._def.defaultValue();return this._def.innerType._parse({data:Y,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}};jE.create=(J,Q)=>{return new jE({innerType:J,typeName:$8.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...S8(Q)})};SE=class SE extends o8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y={...Q,common:{...Q.common,issues:[]}},X=this._def.innerType._parse({data:Y.data,path:Y.path,parent:{...Y}});if(ME(X))return X.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new WY(Y.common.issues)},input:Y.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new WY(Y.common.issues)},input:Y.data})}}removeCatch(){return this._def.innerType}};SE.create=(J,Q)=>{return new SE({innerType:J,typeName:$8.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...S8(Q)})};Yk=class Yk extends o8{_parse(J){if(this._getType(J)!==x6.nan){let Y=this._getOrReturnCtx(J);return r6(Y,{code:z6.invalid_type,expected:x6.nan,received:Y.parsedType}),o4}return{status:"valid",value:J.data}}};Yk.create=(J)=>{return new Yk({typeName:$8.ZodNaN,...S8(J)})};uQ4=Symbol("zod_brand");Ll=class Ll extends o8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=Q.data;return this._def.type._parse({data:Y,path:Q.path,parent:Q})}unwrap(){return this._def.type}};Xk=class Xk extends o8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.common.async)return(async()=>{let G=await this._def.in._parseAsync({data:Y.data,path:Y.path,parent:Y});if(G.status==="aborted")return o4;if(G.status==="dirty")return Q.dirty(),sD(G.value);else return this._def.out._parseAsync({data:G.value,path:Y.path,parent:Y})})();else{let X=this._def.in._parseSync({data:Y.data,path:Y.path,parent:Y});if(X.status==="aborted")return o4;if(X.status==="dirty")return Q.dirty(),{status:"dirty",value:X.value};else return this._def.out._parseSync({data:X.value,path:Y.path,parent:Y})}}static create(J,Q){return new Xk({in:J,out:Q,typeName:$8.ZodPipeline})}};_E=class _E extends o8{_parse(J){let Q=this._def.innerType._parse(J),Y=(X)=>{if(vF(X))X.value=Object.freeze(X.value);return X};return ME(Q)?Q.then((X)=>Y(X)):Y(Q)}unwrap(){return this._def.innerType}};_E.create=(J,Q)=>{return new _E({innerType:J,typeName:$8.ZodReadonly,...S8(Q)})};pQ4={object:j7.lazycreate};(function(J){J.ZodString="ZodString",J.ZodNumber="ZodNumber",J.ZodNaN="ZodNaN",J.ZodBigInt="ZodBigInt",J.ZodBoolean="ZodBoolean",J.ZodDate="ZodDate",J.ZodSymbol="ZodSymbol",J.ZodUndefined="ZodUndefined",J.ZodNull="ZodNull",J.ZodAny="ZodAny",J.ZodUnknown="ZodUnknown",J.ZodNever="ZodNever",J.ZodVoid="ZodVoid",J.ZodArray="ZodArray",J.ZodObject="ZodObject",J.ZodUnion="ZodUnion",J.ZodDiscriminatedUnion="ZodDiscriminatedUnion",J.ZodIntersection="ZodIntersection",J.ZodTuple="ZodTuple",J.ZodRecord="ZodRecord",J.ZodMap="ZodMap",J.ZodSet="ZodSet",J.ZodFunction="ZodFunction",J.ZodLazy="ZodLazy",J.ZodLiteral="ZodLiteral",J.ZodEnum="ZodEnum",J.ZodEffects="ZodEffects",J.ZodNativeEnum="ZodNativeEnum",J.ZodOptional="ZodOptional",J.ZodNullable="ZodNullable",J.ZodDefault="ZodDefault",J.ZodCatch="ZodCatch",J.ZodPromise="ZodPromise",J.ZodBranded="ZodBranded",J.ZodPipeline="ZodPipeline",J.ZodReadonly="ZodReadonly"})($8||($8={}));LF0=O$.create,AF0=hF.create,cQ4=Yk.create,lQ4=bF.create,OF0=OE.create,iQ4=tD.create,nQ4=t_.create,aQ4=wE.create,oQ4=EE.create,rQ4=eD.create,sQ4=fF.create,tQ4=wV.create,eQ4=e_.create,JY4=w$.create,QY4=j7.create,YY4=j7.strictCreate,XY4=IE.create,GY4=Ml.create,ZY4=PE.create,$Y4=EV.create,qY4=Jk.create,VY4=Qk.create,KY4=JM.create,WY4=AE.create,HY4=TE.create,zY4=RE.create,FY4=gF.create,UY4=CE.create,BY4=QM.create,NY4=P$.create,DY4=E$.create,MY4=fW.create,LY4=P$.createWithPreprocess,AY4=Xk.create,IY4={string:(J)=>O$.create({...J,coerce:!0}),number:(J)=>hF.create({...J,coerce:!0}),boolean:(J)=>OE.create({...J,coerce:!0}),bigint:(J)=>bF.create({...J,coerce:!0}),date:(J)=>tD.create({...J,coerce:!0})},PY4=o4});var J1={};n8(J1,{void:()=>eQ4,util:()=>N9,unknown:()=>sQ4,union:()=>XY4,undefined:()=>aQ4,tuple:()=>$Y4,transformer:()=>NY4,symbol:()=>nQ4,string:()=>LF0,strictObject:()=>YY4,setErrorMap:()=>MQ4,set:()=>KY4,record:()=>qY4,quotelessJson:()=>NQ4,promise:()=>BY4,preprocess:()=>LY4,pipeline:()=>AY4,ostring:()=>OY4,optional:()=>DY4,onumber:()=>wY4,oboolean:()=>EY4,objectUtil:()=>DZ1,object:()=>QY4,number:()=>AF0,nullable:()=>MY4,null:()=>oQ4,never:()=>tQ4,nativeEnum:()=>UY4,nan:()=>cQ4,map:()=>VY4,makeIssue:()=>s_,literal:()=>zY4,lazy:()=>HY4,late:()=>pQ4,isValid:()=>vF,isDirty:()=>Dl,isAsync:()=>ME,isAborted:()=>Nl,intersection:()=>ZY4,instanceof:()=>dQ4,getParsedType:()=>OV,getErrorMap:()=>DE,function:()=>WY4,enum:()=>FY4,effect:()=>NY4,discriminatedUnion:()=>GY4,defaultErrorMap:()=>xW,datetimeRegex:()=>NF0,date:()=>iQ4,custom:()=>MF0,coerce:()=>IY4,boolean:()=>OF0,bigint:()=>lQ4,array:()=>JY4,any:()=>rQ4,addIssueToContext:()=>r6,ZodVoid:()=>e_,ZodUnknown:()=>fF,ZodUnion:()=>IE,ZodUndefined:()=>wE,ZodType:()=>o8,ZodTuple:()=>EV,ZodTransformer:()=>P$,ZodSymbol:()=>t_,ZodString:()=>O$,ZodSet:()=>JM,ZodSchema:()=>o8,ZodRecord:()=>Jk,ZodReadonly:()=>_E,ZodPromise:()=>QM,ZodPipeline:()=>Xk,ZodParsedType:()=>x6,ZodOptional:()=>E$,ZodObject:()=>j7,ZodNumber:()=>hF,ZodNullable:()=>fW,ZodNull:()=>EE,ZodNever:()=>wV,ZodNativeEnum:()=>CE,ZodNaN:()=>Yk,ZodMap:()=>Qk,ZodLiteral:()=>RE,ZodLazy:()=>TE,ZodIssueCode:()=>z6,ZodIntersection:()=>PE,ZodFunction:()=>AE,ZodFirstPartyTypeKind:()=>$8,ZodError:()=>WY,ZodEnum:()=>gF,ZodEffects:()=>P$,ZodDiscriminatedUnion:()=>Ml,ZodDefault:()=>jE,ZodDate:()=>tD,ZodCatch:()=>SE,ZodBranded:()=>Ll,ZodBoolean:()=>OE,ZodBigInt:()=>bF,ZodArray:()=>w$,ZodAny:()=>eD,Schema:()=>o8,ParseStatus:()=>JJ,OK:()=>cJ,NEVER:()=>PY4,INVALID:()=>o4,EMPTY_PATH:()=>LQ4,DIRTY:()=>sD,BRAND:()=>uQ4});var wZ1=L1(()=>{Bl();LZ1();WF0();r_();wF0();Ul()});var Gk=L1(()=>{wZ1();wZ1()});function lJ(J,Q){let Y=CY4(J,Q);return typeof Y==="string"?Y:Y.toString()}function CY4(J,Q,Y=!0){if(!Q)Q=jY4();let{workspaceFolders:X,isWindows:G,homeDir:Z}=Q,q=typeof J==="string"?n0.parse(J):n0.from(J);if(X)for(let V of X){let K=a4(V);if(Z6.hasPrefix(q,K)){let W=K.path.endsWith("/")?K.path.slice(0,-1):K.path,z=Y&&X&&X.length>=2?nD(K.path)+(G?"\\":"/"):"";return IZ1(z+q.path.slice(W.length+1),G,q.scheme)}}if(q?.scheme==="file"){if(Z){let V=a4(Z);if(Z6.hasPrefix(q,V)){let K=V.path.endsWith("/")?V.path.slice(0,-1):V.path,W=q.path.slice(K.length+1);return IZ1("~"+(G?"\\":"/")+W,G,q.scheme)}}return IZ1(q.fsPath,G,q.scheme)}return q}function IZ1(J,Q,Y){return Q&&Y==="file"?J.replaceAll("/","\\"):J}function Ol(J){let Q=Al;return Al=J,Q}function jY4(){if(Al)return Al;throw Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var Al=null;var hW=L1(()=>{K4();WE();Yl()});var SY4=(J)=>{let Q=0,Y=[];while(Q<J.length){let X=J[Q];if(X==="\\"){Q++;continue}if(X==="{"){Y.push({type:"brace",value:"{"}),Q++;continue}if(X==="}"){Y.push({type:"brace",value:"}"}),Q++;continue}if(X==="["){Y.push({type:"paren",value:"["}),Q++;continue}if(X==="]"){Y.push({type:"paren",value:"]"}),Q++;continue}if(X===":"){Y.push({type:"separator",value:":"}),Q++;continue}if(X===","){Y.push({type:"delimiter",value:","}),Q++;continue}if(X==='"'){let V="",K=!1;X=J[++Q];while(X!=='"'){if(Q===J.length){K=!0;break}if(X==="\\"){if(Q++,Q===J.length){K=!0;break}V+=X+J[Q],X=J[++Q]}else V+=X,X=J[++Q]}if(X=J[++Q],!K)Y.push({type:"string",value:V});continue}if(X&&/\s/.test(X)){Q++;continue}let Z=/[0-9]/;if(X&&Z.test(X)||X==="-"||X==="."){let V="";if(X==="-")V+=X,X=J[++Q];while(X&&Z.test(X)||X===".")V+=X,X=J[++Q];Y.push({type:"number",value:V});continue}let q=/[a-z]/i;if(X&&q.test(X)){let V="";while(X&&q.test(X)){if(Q===J.length)break;V+=X,X=J[++Q]}if(V=="true"||V=="false"||V==="null")Y.push({type:"name",value:V});else{Q++;continue}continue}Q++}return Y},yE=(J)=>{if(J.length===0)return J;let Q=J[J.length-1];switch(Q.type){case"separator":return J=J.slice(0,J.length-1),yE(J);break;case"number":let Y=Q.value[Q.value.length-1];if(Y==="."||Y==="-")return J=J.slice(0,J.length-1),yE(J);case"string":let X=J[J.length-2];if(X?.type==="delimiter")return J=J.slice(0,J.length-1),yE(J);else if(X?.type==="brace"&&X.value==="{")return J=J.slice(0,J.length-1),yE(J);break;case"delimiter":return J=J.slice(0,J.length-1),yE(J);break}return J},_Y4=(J)=>{let Q=[];if(J.map((Y)=>{if(Y.type==="brace")if(Y.value==="{")Q.push("}");else Q.splice(Q.lastIndexOf("}"),1);if(Y.type==="paren")if(Y.value==="[")Q.push("]");else Q.splice(Q.lastIndexOf("]"),1)}),Q.length>0)Q.reverse().map((Y)=>{if(Y==="}")J.push({type:"brace",value:"}"});else if(Y==="]")J.push({type:"paren",value:"]"})});return J},kY4=(J)=>{let Q="";return J.map((Y)=>{switch(Y.type){case"string":Q+='"'+Y.value+'"';break;default:Q+=Y.value;break}}),Q},hG=(J)=>JSON.parse(kY4(_Y4(yE(SY4(J)))));var YM=()=>{};function iJ(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function ZM(J){return!!J&&!!J[WX]}function uF(J){if(!J)return!1;return CF0(J)||Array.isArray(J)||!!J[Zk]||!!J.constructor?.[Zk]||Wk(J)||Hk(J)}function CF0(J){if(!J||typeof J!=="object")return!1;let Q=GM(J);if(Q===null)return!0;let Y=Object.hasOwnProperty.call(Q,"constructor")&&Q.constructor;if(Y===Object)return!0;return typeof Y=="function"&&Function.toString.call(Y)===yY4}function $k(J,Q){if($M(J)===0)Reflect.ownKeys(J).forEach((Y)=>{Q(Y,J[Y],J)});else J.forEach((Y,X)=>Q(X,Y,J))}function $M(J){let Q=J[WX];return Q?Q.type_:Array.isArray(J)?1:Wk(J)?2:Hk(J)?3:0}function qk(J,Q){return $M(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function PZ1(J,Q){return $M(J)===2?J.get(Q):J[Q]}function jF0(J,Q,Y){let X=$M(J);if(X===2)J.set(Q,Y);else if(X===3)J.add(Y);else J[Q]=Y}function xY4(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function Wk(J){return J instanceof Map}function Hk(J){return J instanceof Set}function XM(J){return J.copy_||J.base_}function CZ1(J,Q){if(Wk(J))return new Map(J);if(Hk(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Y=CF0(J);if(Q===!0||Q==="class_only"&&!Y){let X=Object.getOwnPropertyDescriptors(J);delete X[WX];let G=Reflect.ownKeys(X);for(let Z=0;Z<G.length;Z++){let q=G[Z],V=X[q];if(V.writable===!1)V.writable=!0,V.configurable=!0;if(V.get||V.set)X[q]={configurable:!0,writable:!0,enumerable:V.enumerable,value:J[q]}}return Object.create(GM(J),X)}else{let X=GM(J);if(X!==null&&Y)return{...J};let G=Object.create(X);return Object.assign(G,J)}}function zX(J,Q=!1){if(Il(J)||ZM(J)||!uF(J))return J;if($M(J)>1)J.set=J.add=J.clear=J.delete=vY4;if(Object.freeze(J),Q)Object.entries(J).forEach(([Y,X])=>zX(X,!0));return J}function vY4(){iJ(2)}function Il(J){return Object.isFrozen(J)}function qM(J){let Q=jZ1[J];if(!Q)iJ(0,J);return Q}function fY4(J,Q){if(!jZ1[J])jZ1[J]=Q}function SF0(){return Vk}function hY4(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function IF0(J,Q){if(Q)qM("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function SZ1(J){_Z1(J),J.drafts_.forEach(bY4),J.drafts_=null}function _Z1(J){if(J===Vk)Vk=J.parent_}function PF0(J){return Vk=hY4(Vk,J)}function bY4(J){let Q=J[WX];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function TF0(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Y=Q.drafts_[0];if(J!==void 0&&J!==Y){if(Y[WX].modified_)SZ1(Q),iJ(4);if(uF(J)){if(J=wl(Q,J),!Q.parent_)El(Q,J)}if(Q.patches_)qM("Patches").generateReplacementPatches_(Y[WX].base_,J,Q.patches_,Q.inversePatches_)}else J=wl(Q,Y,[]);if(SZ1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==xZ1?J:void 0}function wl(J,Q,Y){if(Il(Q))return Q;let X=Q[WX];if(!X)return $k(Q,(G,Z)=>RF0(J,X,Q,G,Z,Y)),Q;if(X.scope_!==J)return Q;if(!X.modified_)return El(J,X.base_,!0),X.base_;if(!X.finalized_){X.finalized_=!0,X.scope_.unfinalizedDrafts_--;let G=X.copy_,Z=G,q=!1;if(X.type_===3)Z=new Set(G),G.clear(),q=!0;if($k(Z,(V,K)=>RF0(J,X,G,V,K,Y,q)),El(J,G,!1),Y&&J.patches_)qM("Patches").generatePatches_(X,Y,J.patches_,J.inversePatches_)}return X.copy_}function RF0(J,Q,Y,X,G,Z,q){if(ZM(G)){let V=Z&&Q&&Q.type_!==3&&!qk(Q.assigned_,X)?Z.concat(X):void 0,K=wl(J,G,V);if(jF0(Y,X,K),ZM(K))J.canAutoFreeze_=!1;else return}else if(q)Y.add(G);if(uF(G)&&!Il(G)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(wl(J,G),(!Q||!Q.scope_.parent_)&&typeof X!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Y,X))El(J,G)}}function El(J,Q,Y=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)zX(Q,Y)}function gY4(J,Q){let Y=Array.isArray(J),X={type_:Y?1:0,scope_:Q?Q.scope_:SF0(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},G=X,Z=vZ1;if(Y)G=[X],Z=Kk;let{revoke:q,proxy:V}=Proxy.revocable(G,Z);return X.draft_=V,X.revoke_=q,V}function TZ1(J,Q){let Y=J[WX];return(Y?XM(Y):J)[Q]}function mY4(J,Q,Y){let X=_F0(Q,Y);return X?"value"in X?X.value:X.get?.call(J.draft_):void 0}function _F0(J,Q){if(!(Q in J))return;let Y=GM(J);while(Y){let X=Object.getOwnPropertyDescriptor(Y,Q);if(X)return X;Y=GM(Y)}return}function kZ1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)kZ1(J.parent_)}}function RZ1(J){if(!J.copy_)J.copy_=CZ1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function yZ1(J,Q){let Y=Wk(J)?qM("MapSet").proxyMap_(J,Q):Hk(J)?qM("MapSet").proxySet_(J,Q):gY4(J,Q);return(Q?Q.scope_:SF0()).drafts_.push(Y),Y}function pY4(J){if(!ZM(J))iJ(10,J);return kF0(J)}function kF0(J){if(!uF(J)||Il(J))return J;let Q=J[WX],Y;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Y=CZ1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Y=CZ1(J,!0);if($k(Y,(X,G)=>{jF0(Y,X,kF0(G))}),Q)Q.finalized_=!1;return Y}function Pl(){let Q="replace",Y="add",X="remove";function G(U,N,M,L){switch(U.type_){case 0:case 2:return q(U,N,M,L);case 1:return Z(U,N,M,L);case 3:return V(U,N,M,L)}}function Z(U,N,M,L){let{base_:A,assigned_:E}=U,P=U.copy_;if(P.length<A.length)[A,P]=[P,A],[M,L]=[L,M];for(let I=0;I<A.length;I++)if(E[I]&&P[I]!==A[I]){let R=N.concat([I]);M.push({op:Q,path:R,value:z(P[I])}),L.push({op:Q,path:R,value:z(A[I])})}for(let I=A.length;I<P.length;I++){let R=N.concat([I]);M.push({op:Y,path:R,value:z(P[I])})}for(let I=P.length-1;A.length<=I;--I){let R=N.concat([I]);L.push({op:X,path:R})}}function q(U,N,M,L){let{base_:A,copy_:E}=U;$k(U.assigned_,(P,I)=>{let R=PZ1(A,P),S=PZ1(E,P),y=!I?X:qk(A,P)?Q:Y;if(R===S&&y===Q)return;let x=N.concat(P);M.push(y===X?{op:y,path:x}:{op:y,path:x,value:S}),L.push(y===Y?{op:X,path:x}:y===X?{op:Y,path:x,value:z(R)}:{op:Q,path:x,value:z(R)})})}function V(U,N,M,L){let{base_:A,copy_:E}=U,P=0;A.forEach((I)=>{if(!E.has(I)){let R=N.concat([P]);M.push({op:X,path:R,value:I}),L.unshift({op:Y,path:R,value:I})}P++}),P=0,E.forEach((I)=>{if(!A.has(I)){let R=N.concat([P]);M.push({op:Y,path:R,value:I}),L.unshift({op:X,path:R,value:I})}P++})}function K(U,N,M,L){M.push({op:Q,path:[],value:N===xZ1?void 0:N}),L.push({op:Q,path:[],value:U})}function W(U,N){return N.forEach((M)=>{let{path:L,op:A}=M,E=U;for(let S=0;S<L.length-1;S++){let y=$M(E),x=L[S];if(typeof x!=="string"&&typeof x!=="number")x=""+x;if((y===0||y===1)&&(x==="__proto__"||x==="constructor"))iJ(19);if(typeof E==="function"&&x==="prototype")iJ(19);if(E=PZ1(E,x),typeof E!=="object")iJ(18,L.join("/"))}let P=$M(E),I=H(M.value),R=L[L.length-1];switch(A){case Q:switch(P){case 2:return E.set(R,I);case 3:iJ(16);default:return E[R]=I}case Y:switch(P){case 1:return R==="-"?E.push(I):E.splice(R,0,I);case 2:return E.set(R,I);case 3:return E.add(I);default:return E[R]=I}case X:switch(P){case 1:return E.splice(R,1);case 2:return E.delete(R);case 3:return E.delete(M.value);default:return delete E[R]}default:iJ(17,A)}}),U}function H(U){if(!uF(U))return U;if(Array.isArray(U))return U.map(H);if(Wk(U))return new Map(Array.from(U.entries()).map(([M,L])=>[M,H(L)]));if(Hk(U))return new Set(Array.from(U).map(H));let N=Object.create(GM(U));for(let M in U)N[M]=H(U[M]);if(qk(U,Zk))N[Zk]=U[Zk];return N}function z(U){if(ZM(U))return H(U);else return U}fY4("Patches",{applyPatches_:W,generatePatches_:G,generateReplacementPatches_:K})}function $9(J){return J}var xZ1,Zk,WX,GM,yY4,jZ1,Vk,vZ1,Kk,uY4=class{constructor(J){if(this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(Q,Y,X)=>{if(typeof Q==="function"&&typeof Y!=="function"){let Z=Y;Y=Q;let q=this;return function(K=Z,...W){return q.produce(K,(H)=>Y.call(this,H,...W))}}if(typeof Y!=="function")iJ(6);if(X!==void 0&&typeof X!=="function")iJ(7);let G;if(uF(Q)){let Z=PF0(this),q=yZ1(Q,void 0),V=!0;try{G=Y(q),V=!1}finally{if(V)SZ1(Z);else _Z1(Z)}return IF0(Z,X),TF0(G,Z)}else if(!Q||typeof Q!=="object"){if(G=Y(Q),G===void 0)G=Q;if(G===xZ1)G=void 0;if(this.autoFreeze_)zX(G,!0);if(X){let Z=[],q=[];qM("Patches").generateReplacementPatches_(Q,G,Z,q),X(Z,q)}return G}else iJ(1,Q)},this.produceWithPatches=(Q,Y)=>{if(typeof Q==="function")return(q,...V)=>this.produceWithPatches(q,(K)=>Q(K,...V));let X,G;return[this.produce(Q,Y,(q,V)=>{X=q,G=V}),X,G]},typeof J?.autoFreeze==="boolean")this.setAutoFreeze(J.autoFreeze);if(typeof J?.useStrictShallowCopy==="boolean")this.setUseStrictShallowCopy(J.useStrictShallowCopy)}createDraft(J){if(!uF(J))iJ(8);if(ZM(J))J=pY4(J);let Q=PF0(this),Y=yZ1(J,void 0);return Y[WX].isManual_=!0,_Z1(Q),Y}finishDraft(J,Q){let Y=J&&J[WX];if(!Y||!Y.isManual_)iJ(9);let{scope_:X}=Y;return IF0(X,Q),TF0(void 0,X)}setAutoFreeze(J){this.autoFreeze_=J}setUseStrictShallowCopy(J){this.useStrictShallowCopy_=J}applyPatches(J,Q){let Y;for(Y=Q.length-1;Y>=0;Y--){let G=Q[Y];if(G.path.length===0&&G.op==="replace"){J=G.value;break}}if(Y>-1)Q=Q.slice(Y+1);let X=qM("Patches").applyPatches_;if(ZM(J))return X(J,Q);return this.produce(J,(G)=>X(G,Q))}},HX,pF,VM,Rg8,Cg8,yF0,jg8,Sg8;var HY=L1(()=>{xZ1=Symbol.for("immer-nothing"),Zk=Symbol.for("immer-draftable"),WX=Symbol.for("immer-state");GM=Object.getPrototypeOf;yY4=Object.prototype.constructor.toString();jZ1={};vZ1={get(J,Q){if(Q===WX)return J;let Y=XM(J);if(!qk(Y,Q))return mY4(J,Y,Q);let X=Y[Q];if(J.finalized_||!uF(X))return X;if(X===TZ1(J.base_,Q))return RZ1(J),J.copy_[Q]=yZ1(X,J);return X},has(J,Q){return Q in XM(J)},ownKeys(J){return Reflect.ownKeys(XM(J))},set(J,Q,Y){let X=_F0(XM(J),Q);if(X?.set)return X.set.call(J.draft_,Y),!0;if(!J.modified_){let G=TZ1(XM(J),Q),Z=G?.[WX];if(Z&&Z.base_===Y)return J.copy_[Q]=Y,J.assigned_[Q]=!1,!0;if(xY4(Y,G)&&(Y!==void 0||qk(J.base_,Q)))return!0;RZ1(J),kZ1(J)}if(J.copy_[Q]===Y&&(Y!==void 0||(Q in J.copy_))||Number.isNaN(Y)&&Number.isNaN(J.copy_[Q]))return!0;return J.copy_[Q]=Y,J.assigned_[Q]=!0,!0},deleteProperty(J,Q){if(TZ1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,RZ1(J),kZ1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Y=XM(J),X=Reflect.getOwnPropertyDescriptor(Y,Q);if(!X)return X;return{writable:!0,configurable:J.type_!==1||Q!=="length",enumerable:X.enumerable,value:Y[Q]}},defineProperty(){iJ(11)},getPrototypeOf(J){return GM(J.base_)},setPrototypeOf(){iJ(12)}},Kk={};$k(vZ1,(J,Q)=>{Kk[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});Kk.deleteProperty=function(J,Q){return Kk.set.call(this,J,Q,void 0)};Kk.set=function(J,Q,Y){return vZ1.set.call(this,J[0],Q,Y,J[0])};HX=new uY4,pF=HX.produce,VM=HX.produceWithPatches.bind(HX),Rg8=HX.setAutoFreeze.bind(HX),Cg8=HX.setUseStrictShallowCopy.bind(HX),yF0=HX.applyPatches.bind(HX),jg8=HX.createDraft.bind(HX),Sg8=HX.finishDraft.bind(HX)});function fZ1({onlyFirst:J=!1}={}){let Y=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(Y,J?void 0:"g")}function xE(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(dY4,"")}var dY4;var Tl=L1(()=>{dY4=fZ1()});var vF0=f((fg8,hZ1)=>{var dF={};if(typeof hZ1>"u")window.eastasianwidth=dF;else hZ1.exports=dF;dF.eastAsianWidth=function(J){var Q=J.charCodeAt(0),Y=J.length==2?J.charCodeAt(1):0,X=Q;if(55296<=Q&&Q<=56319&&(56320<=Y&&Y<=57343))Q&=1023,Y&=1023,X=Q<<10|Y,X+=65536;if(X==12288||65281<=X&&X<=65376||65504<=X&&X<=65510)return"F";if(X==8361||65377<=X&&X<=65470||65474<=X&&X<=65479||65482<=X&&X<=65487||65490<=X&&X<=65495||65498<=X&&X<=65500||65512<=X&&X<=65518)return"H";if(4352<=X&&X<=4447||4515<=X&&X<=4519||4602<=X&&X<=4607||9001<=X&&X<=9002||11904<=X&&X<=11929||11931<=X&&X<=12019||12032<=X&&X<=12245||12272<=X&&X<=12283||12289<=X&&X<=12350||12353<=X&&X<=12438||12441<=X&&X<=12543||12549<=X&&X<=12589||12593<=X&&X<=12686||12688<=X&&X<=12730||12736<=X&&X<=12771||12784<=X&&X<=12830||12832<=X&&X<=12871||12880<=X&&X<=13054||13056<=X&&X<=19903||19968<=X&&X<=42124||42128<=X&&X<=42182||43360<=X&&X<=43388||44032<=X&&X<=55203||55216<=X&&X<=55238||55243<=X&&X<=55291||63744<=X&&X<=64255||65040<=X&&X<=65049||65072<=X&&X<=65106||65108<=X&&X<=65126||65128<=X&&X<=65131||110592<=X&&X<=110593||127488<=X&&X<=127490||127504<=X&&X<=127546||127552<=X&&X<=127560||127568<=X&&X<=127569||131072<=X&&X<=194367||177984<=X&&X<=196605||196608<=X&&X<=262141)return"W";if(32<=X&&X<=126||162<=X&&X<=163||165<=X&&X<=166||X==172||X==175||10214<=X&&X<=10221||10629<=X&&X<=10630)return"Na";if(X==161||X==164||167<=X&&X<=168||X==170||173<=X&&X<=174||176<=X&&X<=180||182<=X&&X<=186||188<=X&&X<=191||X==198||X==208||215<=X&&X<=216||222<=X&&X<=225||X==230||232<=X&&X<=234||236<=X&&X<=237||X==240||242<=X&&X<=243||247<=X&&X<=250||X==252||X==254||X==257||X==273||X==275||X==283||294<=X&&X<=295||X==299||305<=X&&X<=307||X==312||319<=X&&X<=322||X==324||328<=X&&X<=331||X==333||338<=X&&X<=339||358<=X&&X<=359||X==363||X==462||X==464||X==466||X==468||X==470||X==472||X==474||X==476||X==593||X==609||X==708||X==711||713<=X&&X<=715||X==717||X==720||728<=X&&X<=731||X==733||X==735||768<=X&&X<=879||913<=X&&X<=929||931<=X&&X<=937||945<=X&&X<=961||963<=X&&X<=969||X==1025||1040<=X&&X<=1103||X==1105||X==8208||8211<=X&&X<=8214||8216<=X&&X<=8217||8220<=X&&X<=8221||8224<=X&&X<=8226||8228<=X&&X<=8231||X==8240||8242<=X&&X<=8243||X==8245||X==8251||X==8254||X==8308||X==8319||8321<=X&&X<=8324||X==8364||X==8451||X==8453||X==8457||X==8467||X==8470||8481<=X&&X<=8482||X==8486||X==8491||8531<=X&&X<=8532||8539<=X&&X<=8542||8544<=X&&X<=8555||8560<=X&&X<=8569||X==8585||8592<=X&&X<=8601||8632<=X&&X<=8633||X==8658||X==8660||X==8679||X==8704||8706<=X&&X<=8707||8711<=X&&X<=8712||X==8715||X==8719||X==8721||X==8725||X==8730||8733<=X&&X<=8736||X==8739||X==8741||8743<=X&&X<=8748||X==8750||8756<=X&&X<=8759||8764<=X&&X<=8765||X==8776||X==8780||X==8786||8800<=X&&X<=8801||8804<=X&&X<=8807||8810<=X&&X<=8811||8814<=X&&X<=8815||8834<=X&&X<=8835||8838<=X&&X<=8839||X==8853||X==8857||X==8869||X==8895||X==8978||9312<=X&&X<=9449||9451<=X&&X<=9547||9552<=X&&X<=9587||9600<=X&&X<=9615||9618<=X&&X<=9621||9632<=X&&X<=9633||9635<=X&&X<=9641||9650<=X&&X<=9651||9654<=X&&X<=9655||9660<=X&&X<=9661||9664<=X&&X<=9665||9670<=X&&X<=9672||X==9675||9678<=X&&X<=9681||9698<=X&&X<=9701||X==9711||9733<=X&&X<=9734||X==9737||9742<=X&&X<=9743||9748<=X&&X<=9749||X==9756||X==9758||X==9792||X==9794||9824<=X&&X<=9825||9827<=X&&X<=9829||9831<=X&&X<=9834||9836<=X&&X<=9837||X==9839||9886<=X&&X<=9887||9918<=X&&X<=9919||9924<=X&&X<=9933||9935<=X&&X<=9953||X==9955||9960<=X&&X<=9983||X==10045||X==10071||10102<=X&&X<=10111||11093<=X&&X<=11097||12872<=X&&X<=12879||57344<=X&&X<=63743||65024<=X&&X<=65039||X==65533||127232<=X&&X<=127242||127248<=X&&X<=127277||127280<=X&&X<=127337||127344<=X&&X<=127386||917760<=X&&X<=917999||983040<=X&&X<=1048573||1048576<=X&&X<=1114109)return"A";return"N"};dF.characterLength=function(J){var Q=this.eastAsianWidth(J);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function xF0(J){return J.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}dF.length=function(J){var Q=xF0(J),Y=0;for(var X=0;X<Q.length;X++)Y=Y+this.characterLength(Q[X]);return Y};dF.slice=function(J,Q,Y){if(textLen=dF.length(J),Q=Q?Q:0,Y=Y?Y:1,Q<0)Q=textLen+Q;if(Y<0)Y=textLen+Y;var X="",G=0,Z=xF0(J);for(var q=0;q<Z.length;q++){var V=Z[q],K=dF.length(V);if(G>=Q-(K==2?1:0))if(G+K<=Y)X+=V;else break;G+=K}return X}});var bZ1=f((hg8,fF0)=>{fF0.exports=()=>{return/[#*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\uDC70\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-\uDED7\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\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\uDD3D\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-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\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]|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\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 cY4,lY4;var hF0=L1(()=>{Tl();cY4=D6(vF0(),1),lY4=D6(bZ1(),1)});function Rl(J,Q,Y="..."){if(J.length<=Q)return J;return J.slice(0,Math.max(0,Q-Y.length))+Y}var gZ1=L1(()=>{hF0()});var bF0="run_terminal_command",gF0="read_file",QJ="Task",q9="finder",zY="get_diagnostics",d9="Bash",Cl="InteractiveShell",r5="oracle",IV="mermaid",PV="todo_read",Z7="todo_write",H2="read_web_page",vE="read_thread",y5="create_file",G3="glob",jl="undo_edit",Sl="read_mcp_resource",l6="Read",U7="edit_file",fE="format_file",S3="web_search",y8="Grep",KM="Check",FX="librarian",_l="kraken",mF0="read_artifact",uF0="edit_artifact",kl="read_plan",hE="edit_plan",yl="read_github",xl="search_github",vl="commit_search",fl="list_directory_github",hl="list_repositories",bl="glob_github",gl="diff",pF0="bookkeeper",dF0="describe_workbook",cF0="execute_query",zk="skill",lF0;var L4=L1(()=>{lF0=["Task","finder","get_diagnostics","Bash","InteractiveShell","oracle","mermaid","todo_read","todo_write","read_web_page","create_file","glob","Glob","undo_edit","Read","edit_file","delete_file","format_file","web_search","Grep","search_documents","get_document","Check","code_review","kraken","librarian","bookkeeper","read_thread","read_artifact","edit_artifact","read_plan","edit_plan","skill"]});var Fk=f((cg8,nF0)=>{var iF0={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)",SEP:"/"},iY4={...iF0,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},nY4={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};nF0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:nY4,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(J){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${J.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(J){return J===!0?iY4:iF0}}});var Uk=f((tY4)=>{var{REGEX_BACKSLASH:aY4,REGEX_REMOVE_BACKSLASH:oY4,REGEX_SPECIAL_CHARS:rY4,REGEX_SPECIAL_CHARS_GLOBAL:sY4}=Fk();tY4.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);tY4.hasRegexChars=(J)=>rY4.test(J);tY4.isRegexChar=(J)=>J.length===1&&tY4.hasRegexChars(J);tY4.escapeRegex=(J)=>J.replace(sY4,"\\$1");tY4.toPosixSlashes=(J)=>J.replace(aY4,"/");tY4.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let J=navigator.platform.toLowerCase();return J==="win32"||J==="windows"}if(typeof process<"u"&&process.platform)return process.platform==="win32";return!1};tY4.removeBackslashes=(J)=>{return J.replace(oY4,(Q)=>{return Q==="\\"?"":Q})};tY4.escapeLast=(J,Q,Y)=>{let X=J.lastIndexOf(Q,Y);if(X===-1)return J;if(J[X-1]==="\\")return tY4.escapeLast(J,Q,X-1);return`${J.slice(0,X)}\\${J.slice(X)}`};tY4.removePrefix=(J,Q={})=>{let Y=J;if(Y.startsWith("./"))Y=Y.slice(2),Q.prefix="./";return Y};tY4.wrapOutput=(J,Q={},Y={})=>{let X=Y.contains?"":"^",G=Y.contains?"":"$",Z=`${X}(?:${J})${G}`;if(Q.negated===!0)Z=`(?:^(?!${Z}).*$)`;return Z};tY4.basename=(J,{windows:Q}={})=>{let Y=J.split(Q?/[\\/]/:"/"),X=Y[Y.length-1];if(X==="")return Y[Y.length-2];return X}});var XU0=f((ig8,YU0)=>{var rF0=Uk(),{CHAR_ASTERISK:mZ1,CHAR_AT:VX4,CHAR_BACKWARD_SLASH:Bk,CHAR_COMMA:KX4,CHAR_DOT:uZ1,CHAR_EXCLAMATION_MARK:pZ1,CHAR_FORWARD_SLASH:QU0,CHAR_LEFT_CURLY_BRACE:dZ1,CHAR_LEFT_PARENTHESES:cZ1,CHAR_LEFT_SQUARE_BRACKET:WX4,CHAR_PLUS:HX4,CHAR_QUESTION_MARK:sF0,CHAR_RIGHT_CURLY_BRACE:zX4,CHAR_RIGHT_PARENTHESES:tF0,CHAR_RIGHT_SQUARE_BRACKET:FX4}=Fk(),eF0=(J)=>{return J===QU0||J===Bk},JU0=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},UX4=(J,Q)=>{let Y=Q||{},X=J.length-1,G=Y.parts===!0||Y.scanToEnd===!0,Z=[],q=[],V=[],K=J,W=-1,H=0,z=0,U=!1,N=!1,M=!1,L=!1,A=!1,E=!1,P=!1,I=!1,R=!1,S=!1,y=0,x,g,p={value:"",depth:0,isGlob:!1},b=()=>W>=X,i=()=>K.charCodeAt(W+1),Q1=()=>{return x=g,K.charCodeAt(++W)};while(W<X){g=Q1();let W1;if(g===Bk){if(P=p.backslashes=!0,g=Q1(),g===dZ1)E=!0;continue}if(E===!0||g===dZ1){y++;while(b()!==!0&&(g=Q1())){if(g===Bk){P=p.backslashes=!0,Q1();continue}if(g===dZ1){y++;continue}if(E!==!0&&g===uZ1&&(g=Q1())===uZ1){if(U=p.isBrace=!0,M=p.isGlob=!0,S=!0,G===!0)continue;break}if(E!==!0&&g===KX4){if(U=p.isBrace=!0,M=p.isGlob=!0,S=!0,G===!0)continue;break}if(g===zX4){if(y--,y===0){E=!1,U=p.isBrace=!0,S=!0;break}}}if(G===!0)continue;break}if(g===QU0){if(Z.push(W),q.push(p),p={value:"",depth:0,isGlob:!1},S===!0)continue;if(x===uZ1&&W===H+1){H+=2;continue}z=W+1;continue}if(Y.noext!==!0){if((g===HX4||g===VX4||g===mZ1||g===sF0||g===pZ1)===!0&&i()===cZ1){if(M=p.isGlob=!0,L=p.isExtglob=!0,S=!0,g===pZ1&&W===H)R=!0;if(G===!0){while(b()!==!0&&(g=Q1())){if(g===Bk){P=p.backslashes=!0,g=Q1();continue}if(g===tF0){M=p.isGlob=!0,S=!0;break}}continue}break}}if(g===mZ1){if(x===mZ1)A=p.isGlobstar=!0;if(M=p.isGlob=!0,S=!0,G===!0)continue;break}if(g===sF0){if(M=p.isGlob=!0,S=!0,G===!0)continue;break}if(g===WX4){while(b()!==!0&&(W1=Q1())){if(W1===Bk){P=p.backslashes=!0,Q1();continue}if(W1===FX4){N=p.isBracket=!0,M=p.isGlob=!0,S=!0;break}}if(G===!0)continue;break}if(Y.nonegate!==!0&&g===pZ1&&W===H){I=p.negated=!0,H++;continue}if(Y.noparen!==!0&&g===cZ1){if(M=p.isGlob=!0,G===!0){while(b()!==!0&&(g=Q1())){if(g===cZ1){P=p.backslashes=!0,g=Q1();continue}if(g===tF0){S=!0;break}}continue}break}if(M===!0){if(S=!0,G===!0)continue;break}}if(Y.noext===!0)L=!1,M=!1;let a=K,m="",s="";if(H>0)m=K.slice(0,H),K=K.slice(H),z-=H;if(a&&M===!0&&z>0)a=K.slice(0,z),s=K.slice(z);else if(M===!0)a="",s=K;else a=K;if(a&&a!==""&&a!=="/"&&a!==K){if(eF0(a.charCodeAt(a.length-1)))a=a.slice(0,-1)}if(Y.unescape===!0){if(s)s=rF0.removeBackslashes(s);if(a&&P===!0)a=rF0.removeBackslashes(a)}let K1={prefix:m,input:J,start:H,base:a,glob:s,isBrace:U,isBracket:N,isGlob:M,isExtglob:L,isGlobstar:A,negated:I,negatedExtglob:R};if(Y.tokens===!0){if(K1.maxDepth=0,!eF0(g))q.push(p);K1.tokens=q}if(Y.parts===!0||Y.tokens===!0){let W1;for(let o=0;o<Z.length;o++){let r=W1?W1+1:H,l=Z[o],F1=J.slice(r,l);if(Y.tokens){if(o===0&&H!==0)q[o].isPrefix=!0,q[o].value=m;else q[o].value=F1;JU0(q[o]),K1.maxDepth+=q[o].depth}if(o!==0||F1!=="")V.push(F1);W1=l}if(W1&&W1+1<J.length){let o=J.slice(W1+1);if(V.push(o),Y.tokens)q[q.length-1].value=o,JU0(q[q.length-1]),K1.maxDepth+=q[q.length-1].depth}K1.slashes=Z,K1.parts=V}return K1};YU0.exports=UX4});var $U0=f((ng8,ZU0)=>{var ml=Fk(),TV=Uk(),{MAX_LENGTH:ul,POSIX_REGEX_SOURCE:BX4,REGEX_NON_SPECIAL_CHARS:NX4,REGEX_SPECIAL_CHARS_BACKREF:DX4,REPLACEMENTS:GU0}=ml,MX4=(J,Q)=>{if(typeof Q.expandRange==="function")return Q.expandRange(...J,Q);J.sort();let Y=`[${J.join("-")}]`;try{new RegExp(Y)}catch(X){return J.map((G)=>TV.escapeRegex(G)).join("..")}return Y},bE=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},lZ1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=GU0[J]||J;let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(ul,Y.maxLength):ul,G=J.length;if(G>X)throw SyntaxError(`Input length: ${G}, exceeds maximum allowed length: ${X}`);let Z={type:"bos",value:"",output:Y.prepend||""},q=[Z],V=Y.capture?"":"?:",K=ml.globChars(Y.windows),W=ml.extglobChars(K),{DOT_LITERAL:H,PLUS_LITERAL:z,SLASH_LITERAL:U,ONE_CHAR:N,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:A,NO_DOTS_SLASH:E,QMARK:P,QMARK_NO_DOT:I,STAR:R,START_ANCHOR:S}=K,y=(s1)=>{return`(${V}(?:(?!${S}${s1.dot?M:H}).)*?)`},x=Y.dot?"":L,g=Y.dot?P:I,p=Y.bash===!0?y(Y):R;if(Y.capture)p=`(${p})`;if(typeof Y.noext==="boolean")Y.noextglob=Y.noext;let b={input:J,index:-1,start:0,dot:Y.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:q};J=TV.removePrefix(J,b),G=J.length;let i=[],Q1=[],a=[],m=Z,s,K1=()=>b.index===G-1,W1=b.peek=(s1=1)=>J[b.index+s1],o=b.advance=()=>J[++b.index]||"",r=()=>J.slice(b.index+1),l=(s1="",U1=0)=>{b.consumed+=s1,b.index+=U1},F1=(s1)=>{b.output+=s1.output!=null?s1.output:s1.value,l(s1.value)},y1=()=>{let s1=1;while(W1()==="!"&&(W1(2)!=="("||W1(3)==="?"))o(),b.start++,s1++;if(s1%2===0)return!1;return b.negated=!0,b.start++,!0},t=(s1)=>{b[s1]++,a.push(s1)},f1=(s1)=>{b[s1]--,a.pop()},j1=(s1)=>{if(m.type==="globstar"){let U1=b.braces>0&&(s1.type==="comma"||s1.type==="brace"),Y1=s1.extglob===!0||i.length&&(s1.type==="pipe"||s1.type==="paren");if(s1.type!=="slash"&&s1.type!=="paren"&&!U1&&!Y1)b.output=b.output.slice(0,-m.output.length),m.type="star",m.value="*",m.output=p,b.output+=m.output}if(i.length&&s1.type!=="paren")i[i.length-1].inner+=s1.value;if(s1.value||s1.output)F1(s1);if(m&&m.type==="text"&&s1.type==="text"){m.output=(m.output||m.value)+s1.value,m.value+=s1.value;return}s1.prev=m,q.push(s1),m=s1},O0=(s1,U1)=>{let Y1={...W[U1],conditions:1,inner:""};Y1.prev=m,Y1.parens=b.parens,Y1.output=b.output;let A1=(Y.capture?"(":"")+Y1.open;t("parens"),j1({type:s1,value:U1,output:b.output?"":N}),j1({type:"paren",extglob:!0,value:o(),output:A1}),i.push(Y1)},C1=(s1)=>{let U1=s1.close+(Y.capture?")":""),Y1;if(s1.type==="negate"){let A1=p;if(s1.inner&&s1.inner.length>1&&s1.inner.includes("/"))A1=y(Y);if(A1!==p||K1()||/^\)+$/.test(r()))U1=s1.close=`)$))${A1}`;if(s1.inner.includes("*")&&(Y1=r())&&/^\.[^\\/.]+$/.test(Y1)){let w1=lZ1(Y1,{...Q,fastpaths:!1}).output;U1=s1.close=`)${w1})${A1})`}if(s1.prev.type==="bos")b.negatedExtglob=!0}j1({type:"paren",extglob:!0,value:s,output:U1}),f1("parens")};if(Y.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let s1=!1,U1=J.replace(DX4,(Y1,A1,w1,I1,E1,p1)=>{if(I1==="\\")return s1=!0,Y1;if(I1==="?"){if(A1)return A1+I1+(E1?P.repeat(E1.length):"");if(p1===0)return g+(E1?P.repeat(E1.length):"");return P.repeat(w1.length)}if(I1===".")return H.repeat(w1.length);if(I1==="*"){if(A1)return A1+I1+(E1?p:"");return p}return A1?Y1:`\\${Y1}`});if(s1===!0)if(Y.unescape===!0)U1=U1.replace(/\\/g,"");else U1=U1.replace(/\\+/g,(Y1)=>{return Y1.length%2===0?"\\\\":Y1?"\\":""});if(U1===J&&Y.contains===!0)return b.output=J,b;return b.output=TV.wrapOutput(U1,b,Q),b}while(!K1()){if(s=o(),s==="\x00")continue;if(s==="\\"){let Y1=W1();if(Y1==="/"&&Y.bash!==!0)continue;if(Y1==="."||Y1===";")continue;if(!Y1){s+="\\",j1({type:"text",value:s});continue}let A1=/^\\+/.exec(r()),w1=0;if(A1&&A1[0].length>2){if(w1=A1[0].length,b.index+=w1,w1%2!==0)s+="\\"}if(Y.unescape===!0)s=o();else s+=o();if(b.brackets===0){j1({type:"text",value:s});continue}}if(b.brackets>0&&(s!=="]"||m.value==="["||m.value==="[^")){if(Y.posix!==!1&&s===":"){let Y1=m.value.slice(1);if(Y1.includes("[")){if(m.posix=!0,Y1.includes(":")){let A1=m.value.lastIndexOf("["),w1=m.value.slice(0,A1),I1=m.value.slice(A1+2),E1=BX4[I1];if(E1){if(m.value=w1+E1,b.backtrack=!0,o(),!Z.output&&q.indexOf(m)===1)Z.output=N;continue}}}}if(s==="["&&W1()!==":"||s==="-"&&W1()==="]")s=`\\${s}`;if(s==="]"&&(m.value==="["||m.value==="[^"))s=`\\${s}`;if(Y.posix===!0&&s==="!"&&m.value==="[")s="^";m.value+=s,F1({value:s});continue}if(b.quotes===1&&s!=='"'){s=TV.escapeRegex(s),m.value+=s,F1({value:s});continue}if(s==='"'){if(b.quotes=b.quotes===1?0:1,Y.keepQuotes===!0)j1({type:"text",value:s});continue}if(s==="("){t("parens"),j1({type:"paren",value:s});continue}if(s===")"){if(b.parens===0&&Y.strictBrackets===!0)throw SyntaxError(bE("opening","("));let Y1=i[i.length-1];if(Y1&&b.parens===Y1.parens+1){C1(i.pop());continue}j1({type:"paren",value:s,output:b.parens?")":"\\)"}),f1("parens");continue}if(s==="["){if(Y.nobracket===!0||!r().includes("]")){if(Y.nobracket!==!0&&Y.strictBrackets===!0)throw SyntaxError(bE("closing","]"));s=`\\${s}`}else t("brackets");j1({type:"bracket",value:s});continue}if(s==="]"){if(Y.nobracket===!0||m&&m.type==="bracket"&&m.value.length===1){j1({type:"text",value:s,output:`\\${s}`});continue}if(b.brackets===0){if(Y.strictBrackets===!0)throw SyntaxError(bE("opening","["));j1({type:"text",value:s,output:`\\${s}`});continue}f1("brackets");let Y1=m.value.slice(1);if(m.posix!==!0&&Y1[0]==="^"&&!Y1.includes("/"))s=`/${s}`;if(m.value+=s,F1({value:s}),Y.literalBrackets===!1||TV.hasRegexChars(Y1))continue;let A1=TV.escapeRegex(m.value);if(b.output=b.output.slice(0,-m.value.length),Y.literalBrackets===!0){b.output+=A1,m.value=A1;continue}m.value=`(${V}${A1}|${m.value})`,b.output+=m.value;continue}if(s==="{"&&Y.nobrace!==!0){t("braces");let Y1={type:"brace",value:s,output:"(",outputIndex:b.output.length,tokensIndex:b.tokens.length};Q1.push(Y1),j1(Y1);continue}if(s==="}"){let Y1=Q1[Q1.length-1];if(Y.nobrace===!0||!Y1){j1({type:"text",value:s,output:s});continue}let A1=")";if(Y1.dots===!0){let w1=q.slice(),I1=[];for(let E1=w1.length-1;E1>=0;E1--){if(q.pop(),w1[E1].type==="brace")break;if(w1[E1].type!=="dots")I1.unshift(w1[E1].value)}A1=MX4(I1,Y),b.backtrack=!0}if(Y1.comma!==!0&&Y1.dots!==!0){let w1=b.output.slice(0,Y1.outputIndex),I1=b.tokens.slice(Y1.tokensIndex);Y1.value=Y1.output="\\{",s=A1="\\}",b.output=w1;for(let E1 of I1)b.output+=E1.output||E1.value}j1({type:"brace",value:s,output:A1}),f1("braces"),Q1.pop();continue}if(s==="|"){if(i.length>0)i[i.length-1].conditions++;j1({type:"text",value:s});continue}if(s===","){let Y1=s,A1=Q1[Q1.length-1];if(A1&&a[a.length-1]==="braces")A1.comma=!0,Y1="|";j1({type:"comma",value:s,output:Y1});continue}if(s==="/"){if(m.type==="dot"&&b.index===b.start+1){b.start=b.index+1,b.consumed="",b.output="",q.pop(),m=Z;continue}j1({type:"slash",value:s,output:U});continue}if(s==="."){if(b.braces>0&&m.type==="dot"){if(m.value===".")m.output=H;let Y1=Q1[Q1.length-1];m.type="dots",m.output+=s,m.value+=s,Y1.dots=!0;continue}if(b.braces+b.parens===0&&m.type!=="bos"&&m.type!=="slash"){j1({type:"text",value:s,output:H});continue}j1({type:"dot",value:s,output:H});continue}if(s==="?"){if(!(m&&m.value==="(")&&Y.noextglob!==!0&&W1()==="("&&W1(2)!=="?"){O0("qmark",s);continue}if(m&&m.type==="paren"){let A1=W1(),w1=s;if(m.value==="("&&!/[!=<:]/.test(A1)||A1==="<"&&!/<([!=]|\w+>)/.test(r()))w1=`\\${s}`;j1({type:"text",value:s,output:w1});continue}if(Y.dot!==!0&&(m.type==="slash"||m.type==="bos")){j1({type:"qmark",value:s,output:I});continue}j1({type:"qmark",value:s,output:P});continue}if(s==="!"){if(Y.noextglob!==!0&&W1()==="("){if(W1(2)!=="?"||!/[!=<:]/.test(W1(3))){O0("negate",s);continue}}if(Y.nonegate!==!0&&b.index===0){y1();continue}}if(s==="+"){if(Y.noextglob!==!0&&W1()==="("&&W1(2)!=="?"){O0("plus",s);continue}if(m&&m.value==="("||Y.regex===!1){j1({type:"plus",value:s,output:z});continue}if(m&&(m.type==="bracket"||m.type==="paren"||m.type==="brace")||b.parens>0){j1({type:"plus",value:s});continue}j1({type:"plus",value:z});continue}if(s==="@"){if(Y.noextglob!==!0&&W1()==="("&&W1(2)!=="?"){j1({type:"at",extglob:!0,value:s,output:""});continue}j1({type:"text",value:s});continue}if(s!=="*"){if(s==="$"||s==="^")s=`\\${s}`;let Y1=NX4.exec(r());if(Y1)s+=Y1[0],b.index+=Y1[0].length;j1({type:"text",value:s});continue}if(m&&(m.type==="globstar"||m.star===!0)){m.type="star",m.star=!0,m.value+=s,m.output=p,b.backtrack=!0,b.globstar=!0,l(s);continue}let s1=r();if(Y.noextglob!==!0&&/^\([^?]/.test(s1)){O0("star",s);continue}if(m.type==="star"){if(Y.noglobstar===!0){l(s);continue}let Y1=m.prev,A1=Y1.prev,w1=Y1.type==="slash"||Y1.type==="bos",I1=A1&&(A1.type==="star"||A1.type==="globstar");if(Y.bash===!0&&(!w1||s1[0]&&s1[0]!=="/")){j1({type:"star",value:s,output:""});continue}let E1=b.braces>0&&(Y1.type==="comma"||Y1.type==="brace"),p1=i.length&&(Y1.type==="pipe"||Y1.type==="paren");if(!w1&&Y1.type!=="paren"&&!E1&&!p1){j1({type:"star",value:s,output:""});continue}while(s1.slice(0,3)==="/**"){let h1=J[b.index+4];if(h1&&h1!=="/")break;s1=s1.slice(3),l("/**",3)}if(Y1.type==="bos"&&K1()){m.type="globstar",m.value+=s,m.output=y(Y),b.output=m.output,b.globstar=!0,l(s);continue}if(Y1.type==="slash"&&Y1.prev.type!=="bos"&&!I1&&K1()){b.output=b.output.slice(0,-(Y1.output+m.output).length),Y1.output=`(?:${Y1.output}`,m.type="globstar",m.output=y(Y)+(Y.strictSlashes?")":"|$)"),m.value+=s,b.globstar=!0,b.output+=Y1.output+m.output,l(s);continue}if(Y1.type==="slash"&&Y1.prev.type!=="bos"&&s1[0]==="/"){let h1=s1[1]!==void 0?"|$":"";b.output=b.output.slice(0,-(Y1.output+m.output).length),Y1.output=`(?:${Y1.output}`,m.type="globstar",m.output=`${y(Y)}${U}|${U}${h1})`,m.value+=s,b.output+=Y1.output+m.output,b.globstar=!0,l(s+o()),j1({type:"slash",value:"/",output:""});continue}if(Y1.type==="bos"&&s1[0]==="/"){m.type="globstar",m.value+=s,m.output=`(?:^|${U}|${y(Y)}${U})`,b.output=m.output,b.globstar=!0,l(s+o()),j1({type:"slash",value:"/",output:""});continue}b.output=b.output.slice(0,-m.output.length),m.type="globstar",m.output=y(Y),m.value+=s,b.output+=m.output,b.globstar=!0,l(s);continue}let U1={type:"star",value:s,output:p};if(Y.bash===!0){if(U1.output=".*?",m.type==="bos"||m.type==="slash")U1.output=x+U1.output;j1(U1);continue}if(m&&(m.type==="bracket"||m.type==="paren")&&Y.regex===!0){U1.output=s,j1(U1);continue}if(b.index===b.start||m.type==="slash"||m.type==="dot"){if(m.type==="dot")b.output+=A,m.output+=A;else if(Y.dot===!0)b.output+=E,m.output+=E;else b.output+=x,m.output+=x;if(W1()!=="*")b.output+=N,m.output+=N}j1(U1)}while(b.brackets>0){if(Y.strictBrackets===!0)throw SyntaxError(bE("closing","]"));b.output=TV.escapeLast(b.output,"["),f1("brackets")}while(b.parens>0){if(Y.strictBrackets===!0)throw SyntaxError(bE("closing",")"));b.output=TV.escapeLast(b.output,"("),f1("parens")}while(b.braces>0){if(Y.strictBrackets===!0)throw SyntaxError(bE("closing","}"));b.output=TV.escapeLast(b.output,"{"),f1("braces")}if(Y.strictSlashes!==!0&&(m.type==="star"||m.type==="bracket"))j1({type:"maybe_slash",value:"",output:`${U}?`});if(b.backtrack===!0){b.output="";for(let s1 of b.tokens)if(b.output+=s1.output!=null?s1.output:s1.value,s1.suffix)b.output+=s1.suffix}return b};lZ1.fastpaths=(J,Q)=>{let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(ul,Y.maxLength):ul,G=J.length;if(G>X)throw SyntaxError(`Input length: ${G}, exceeds maximum allowed length: ${X}`);J=GU0[J]||J;let{DOT_LITERAL:Z,SLASH_LITERAL:q,ONE_CHAR:V,DOTS_SLASH:K,NO_DOT:W,NO_DOTS:H,NO_DOTS_SLASH:z,STAR:U,START_ANCHOR:N}=ml.globChars(Y.windows),M=Y.dot?H:W,L=Y.dot?z:W,A=Y.capture?"":"?:",E={negated:!1,prefix:""},P=Y.bash===!0?".*?":U;if(Y.capture)P=`(${P})`;let I=(x)=>{if(x.noglobstar===!0)return P;return`(${A}(?:(?!${N}${x.dot?K:Z}).)*?)`},R=(x)=>{switch(x){case"*":return`${M}${V}${P}`;case".*":return`${Z}${V}${P}`;case"*.*":return`${M}${P}${Z}${V}${P}`;case"*/*":return`${M}${P}${q}${V}${L}${P}`;case"**":return M+I(Y);case"**/*":return`(?:${M}${I(Y)}${q})?${L}${V}${P}`;case"**/*.*":return`(?:${M}${I(Y)}${q})?${L}${P}${Z}${V}${P}`;case"**/.*":return`(?:${M}${I(Y)}${q})?${Z}${V}${P}`;default:{let g=/^(.*?)\.(\w+)$/.exec(x);if(!g)return;let p=R(g[1]);if(!p)return;return p+Z+g[2]}}},S=TV.removePrefix(J,E),y=R(S);if(y&&Y.strictSlashes!==!0)y+=`${q}?`;return y};ZU0.exports=lZ1});var Nk=f((ag8,VU0)=>{var LX4=XU0(),iZ1=$U0(),qU0=Uk(),AX4=Fk(),OX4=(J)=>J&&typeof J==="object"&&!Array.isArray(J),z2=(J,Q,Y=!1)=>{if(Array.isArray(J)){let H=J.map((U)=>z2(U,Q,Y));return(U)=>{for(let N of H){let M=N(U);if(M)return M}return!1}}let X=OX4(J)&&J.tokens&&J.input;if(J===""||typeof J!=="string"&&!X)throw TypeError("Expected pattern to be a non-empty string");let G=Q||{},Z=G.windows,q=X?z2.compileRe(J,Q):z2.makeRe(J,Q,!1,!0),V=q.state;delete q.state;let K=()=>!1;if(G.ignore){let H={...Q,ignore:null,onMatch:null,onResult:null};K=z2(G.ignore,H,Y)}let W=(H,z=!1)=>{let{isMatch:U,match:N,output:M}=z2.test(H,q,Q,{glob:J,posix:Z}),L={glob:J,state:V,regex:q,posix:Z,input:H,output:M,match:N,isMatch:U};if(typeof G.onResult==="function")G.onResult(L);if(U===!1)return L.isMatch=!1,z?L:!1;if(K(H)){if(typeof G.onIgnore==="function")G.onIgnore(L);return L.isMatch=!1,z?L:!1}if(typeof G.onMatch==="function")G.onMatch(L);return z?L:!0};if(Y)W.state=V;return W};z2.test=(J,Q,Y,{glob:X,posix:G}={})=>{if(typeof J!=="string")throw TypeError("Expected input to be a string");if(J==="")return{isMatch:!1,output:""};let Z=Y||{},q=Z.format||(G?qU0.toPosixSlashes:null),V=J===X,K=V&&q?q(J):J;if(V===!1)K=q?q(J):J,V=K===X;if(V===!1||Z.capture===!0)if(Z.matchBase===!0||Z.basename===!0)V=z2.matchBase(J,Q,Y,G);else V=Q.exec(K);return{isMatch:Boolean(V),match:V,output:K}};z2.matchBase=(J,Q,Y)=>{return(Q instanceof RegExp?Q:z2.makeRe(Q,Y)).test(qU0.basename(J))};z2.isMatch=(J,Q,Y)=>z2(Q,Y)(J);z2.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Y)=>z2.parse(Y,Q));return iZ1(J,{...Q,fastpaths:!1})};z2.scan=(J,Q)=>LX4(J,Q);z2.compileRe=(J,Q,Y=!1,X=!1)=>{if(Y===!0)return J.output;let G=Q||{},Z=G.contains?"":"^",q=G.contains?"":"$",V=`${Z}(?:${J.output})${q}`;if(J&&J.negated===!0)V=`^(?!${V}).*$`;let K=z2.toRegex(V,Q);if(X===!0)K.state=J;return K};z2.makeRe=(J,Q={},Y=!1,X=!1)=>{if(!J||typeof J!=="string")throw TypeError("Expected a non-empty string");let G={negated:!1,fastpaths:!0};if(Q.fastpaths!==!1&&(J[0]==="."||J[0]==="*"))G.output=iZ1.fastpaths(J,Q);if(!G.output)G=iZ1(J,Q);return z2.compileRe(G,Q,Y,X)};z2.toRegex=(J,Q)=>{try{let Y=Q||{};return new RegExp(J,Y.flags||(Y.nocase?"i":""))}catch(Y){if(Q&&Q.debug===!0)throw Y;return/$^/}};z2.constants=AX4;VU0.exports=z2});var WM=f((og8,HU0)=>{var KU0=Nk(),wX4=Uk();function WU0(J,Q,Y=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:wX4.isWindows()};return KU0(J,Q,Y)}Object.assign(WU0,KU0);HU0.exports=WU0});var gE;var nZ1=L1(()=>{gE={name:"amp",description:"The frontier coding agent, with a highly capable `smart` mode and a fast `free` mode. ",private:!0,displayName:"Amp (Research Preview)",version:"0.0.0-dev",publisher:"sourcegraph",license:"Apache-2.0",categories:["AI","Chat","Programming Languages","Machine Learning"],keywords:["sourcegraph","amp","amp code","ampcode","ai","assistant","llm","Claude","Claude Sonnet 4.5","GPT-5","agent","free","Claude Sonnet"],icon:"./resources/amp-icon.png",scripts:{dev:"pnpm run -s dev:desktop","dev:insiders":"pnpm run -s dev:desktop:insiders","dev:watch":"NODE_ENV=development bun run scripts/watch.ts","start:dev:desktop":"node scripts/start-dev.js","start:dev:desktop:insiders":"node scripts/start-dev.js --insiders","start:dev:debugger":"pnpm run -s build:dev:desktop && pnpm run -s ./src/autoedit/webview dev","dev:desktop":"pnpm run -s build:dev:desktop && pnpm run start:dev:desktop","dev:desktop:insiders":"pnpm run -s build:dev:desktop && pnpm run start:dev:desktop:insiders","build:dev:desktop":"NODE_ENV=development bun run scripts/build.ts",build:"pnpm run -s _build:extension && concurrently -n 'debugger,web,review' 'pnpm run -s _build:debugger' 'pnpm run -s _build:web' 'pnpm run -s _build:tab:review'","build:production":"pnpm run -s _build:extension:production && concurrently -n 'debugger,web,review' 'pnpm run -s _build:debugger:production' 'pnpm run -s _build:web:production' 'pnpm run -s _build:tab:review:production'","_build:extension":"NODE_ENV=development bun run scripts/build.ts","_build:extension:production":"NODE_ENV=production bun run scripts/build.ts","_build:web":"pnpm -C ../web run build && cp -R ../web/build dist/web-build","_build:web:production":"pnpm -C ../web run build:production && cp -R ../web/build dist/web-build","_build:debugger":"pnpm -C ./src/autoedit/webview run build && cp -R ./src/autoedit/webview/build dist/autoedit","_build:debugger:production":"cross-env NODE_ENV=production pnpm -C ./src/autoedit/webview run build && cp -R ./src/autoedit/webview/build dist/autoedit","_build:tab:review":"pnpm -C ./src/autoedit/review-panel-webview run build && mkdir -p dist/autoedit && cp -R ./src/autoedit/review-panel-webview/build dist/autoedit/review-panel","_build:tab:review:production":"cross-env NODE_ENV=production pnpm -C ./src/autoedit/review-panel-webview run build && mkdir -p dist/autoedit && cp -R ./src/autoedit/review-panel-webview/build dist/autoedit/review-panel","build:icon-font":"npx -y svgtofont --sources ./icon-font/svg --output ./icon-font/build && cp ./icon-font/build/amp-icons.woff ./resources","dev:forks":"pnpm dev:vsix && cursor --install-extension dist/amp-dev.vsix --force && windsurf --install-extension dist/amp-dev.vsix --force","dev:vsix":"pnpm run -s build && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code --install-extension dist/amp-dev.vsix --force","dev:insiders:vsix":"pnpm run -s build && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code-insiders --install-extension dist/amp-dev.vsix --force","prod:vsix":"pnpm run -s build:production && vsce package --no-dependencies --pre-release --out dist/amp-prod.vsix && code --install-extension dist/amp-prod.vsix --force","prod:vsix:test-manual":"bun run scripts/vsix-test-manual.ts","prod:vsix:test-ci":"bun run scripts/vsix-test-ci.ts",test:"vitest run","test:dev":"vitest"},homepage:"https://ampcode.com",repository:{type:"git",url:"https://github.com/sourcegraph/amp",directory:"vscode"},author:{name:"The Amp Team at Sourcegraph",email:"amp-devs@sourcegraph.com"},engines:{vscode:"^1.79.0",node:">=22.0.0"},main:"./dist/extension.cjs",activationEvents:["onStartupFinished"],extensionDependencies:["vscode.git"],contributes:{languages:[{id:"jsonc",filenamePatterns:["**/Library/Application Support/ampcode/managed-settings.json","**/etc/ampcode/managed-settings.json","**/ProgramData/ampcode/managed-settings.json"]}],viewsContainers:{activitybar:[{id:"sourcegraph-amp",title:"Amp",icon:"./resources/amp-mark.svg"}]},views:{"sourcegraph-amp":[{type:"webview",id:"amp.sidebarView",name:"Amp",icon:"./resources/amp-mark.svg",visibility:"visible"},{type:"webview",id:"amp.reviewPanel",name:"Review",icon:"$(compare-changes)",visibility:"visible",when:"config.amp.review.separatePanel"}]},commands:[{command:"amp.agent.newThread",title:"New Thread",category:"Amp",icon:"$(add)"},{command:"amp.agent.newWindow",title:"New Agent Window",category:"Amp",icon:"$(browser)",enablement:"amp.activated"},{command:"amp.agent.toggleVisibility",title:"Toggle Agent",category:"Amp"},{command:"amp.agent.openReview",title:"Open Amp Review",category:"Amp",icon:"$(compare-changes)",enablement:"amp.activated"},{command:"amp.agent.focusPromptEditor",title:"Focus Prompt Editor",category:"Amp"},{command:"amp.agent.addSelectionToPromptEditor",title:"Add Selection to Prompt",category:"Amp",enablement:"editorHasSelection"},{command:"amp.agent.switchAgentMode",title:"Switch Agent Mode for Current Thread",category:"Amp",enablement:"amp.hasMultipleVisibleModes"},{command:"amp.agent.setPromptFromRecentActions",title:"Create Prompt from Recent Actions",category:"Amp"},{command:"amp.agent.findInThread",title:"Find in Thread",category:"Amp",enablement:"amp.agent.active"},{command:"amp.agent.collapseAllInThread",title:"Collapse All Blocks in Thread",category:"Amp"},{command:"amp.agent.expandAllInThread",title:"Expand All Blocks in Thread",category:"Amp"},{command:"amp.agent.expandToggleInThread",title:"Toggle Expand All Blocks in Thread",category:"Amp"},{command:"amp.agent.toggleThreadSwitcher",title:"Switch to Thread...",category:"Amp",enablement:"amp.agent.active"},{command:"amp.agent.toggleCostDisplay",title:"Toggle Cost Display",category:"Amp"},{command:"amp.agent.navigateThreadPrevious",title:"Navigate to Previous Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",title:"Navigate to Next Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.openThreadJSON",title:"Open Thread JSON",category:"Amp",enablement:"amp.isDevelopmentMode"},{command:"amp.testThreadSummary",title:"Test Thread Summary",category:"Amp",enablement:"amp.isDevelopmentMode"},{command:"amp.tab.quickPickMenu",title:"Show Tab Menu",category:"Amp",icon:"$(debug)",enablement:"amp.activated"},{command:"amp.tab.showDebugPanel",title:"Show Tab Debug Panel",category:"Amp",icon:"$(debug)",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.showDiff",title:"Tab: Show Diff",category:"Amp",icon:"$(diff)",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.acceptAll",title:"Tab Review: Accept All Changes",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.instruct",title:"Tab Review: Open Instruct Mode",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.manualTrigger",title:"Tab Manual Trigger",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.enable",title:"Enable Tab",category:"Amp",enablement:"amp.activated && !config.amp.tab.enabled"},{command:"amp.tab.disable",title:"Disable Tab",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.toggleForCurrentDocument",title:"Toggle Tab for Current Document",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.debugInfo",title:"Open Tab Debug Info",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.autoAcceptChain",title:"Accept Suggestion Chain",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.mcp.restartServers",title:"Restart MCP Servers",category:"Amp"},{command:"amp.connect.reconnect",title:"Reconnect",category:"Amp",enablement:"amp.activated"},{command:"amp.agent.editUserPermissions",title:"Edit User Permissions",category:"Amp"},{command:"amp.agent.editWorkspacePermissions",title:"Edit Workspace Permissions",category:"Amp"},{command:"amp.commandPalette.show",title:"Show Amp Command Palette",category:"Amp",icon:"$(list-flat)"}],menus:{"editor/context":[{command:"amp.agent.addSelectionToPromptEditor",when:"editorHasSelection",group:"amp@1"}]},keybindings:[{command:"amp.agent.newThread",key:"ctrl+l",mac:"cmd+l",when:"amp.primaryShortcuts"},{command:"amp.agent.newThread",key:"ctrl+alt+j",mac:"cmd+alt+j",when:"!amp.primaryShortcuts"},{command:"amp.agent.newWindow",key:"ctrl+shift+l",mac:"cmd+shift+l"},{command:"amp.agent.toggleVisibility",key:"ctrl+i",mac:"cmd+i",when:"amp.primaryShortcuts"},{command:"amp.agent.toggleVisibility",key:"ctrl+alt+u",mac:"cmd+alt+u",when:"!amp.primaryShortcuts"},{command:"amp.agent.findInThread",key:"ctrl+f",mac:"cmd+f",when:"amp.agent.active"},{command:"amp.agent.toggleThreadSwitcher",key:"ctrl+k",mac:"cmd+k",when:"amp.agent.active"},{command:"amp.agent.toggleCostDisplay",key:"ctrl+d",mac:"cmd+d",when:"amp.agent.active && amp.isSourcegraphTeammate || isWeb"},{command:"amp.agent.navigateThreadPrevious",key:"ctrl+shift+[",mac:"cmd+shift+[",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",key:"ctrl+shift+]",mac:"cmd+shift+]",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.savePermissions",key:"ctrl+s",mac:"cmd+s",enablement:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i",when:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i"},{command:"amp.tab.diffPanel.acceptAll",key:"ctrl+enter",mac:"cmd+enter",when:"activeWebviewPanelId == 'ampTabDiff'"},{command:"amp.tab.diffPanel.instruct",key:"ctrl+i",mac:"cmd+i",when:"activeWebviewPanelId == 'ampTabDiff'"},{command:"amp.agent.openReview",key:"ctrl+;",mac:"cmd+;"},{command:"-extension.vim_tab",key:"tab",when:"editorTextFocus && vim.active && vim.mode != 'Insert' && !inlineEditIsVisible && !inDebugRepl"},{command:"-vscode-neovim.send",key:"tab",when:"neovim.init && (editorTextFocus && neovim.mode != insert && editorLangId not in neovim.editorLangIdExclusions || neovim.recording)"},{command:"amp.tab.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.showDiff",key:"shift+tab",when:"editorTextFocus && amp.activated && config.amp.tab.experimental.review && (amp.tab.active || inlineSuggestionVisible) && !amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.dismiss",key:"escape",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.discard",key:"escape",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.autoAcceptChain",key:"alt+shift+tab",when:"editorTextFocus && amp.activated && (amp.tab.active || amp.nextCursorSuggested) && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.accept",key:"tab",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.discard",key:"escape",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.commandPalette.show",key:"ctrl+shift+a",mac:"cmd+shift+a",when:"amp.activated"},{command:"amp.agent.switchAgentMode",key:"ctrl+shift+m",mac:"cmd+shift+m",when:"amp.activated && amp.hasMultipleVisibleModes"}],configuration:{type:"object",title:"Amp",properties:{"amp.url":{type:"string",examples:["https://ampcode.com/"],description:"URL to the Amp server, usually https://ampcode.com/",scope:"application"},"amp.notifications.enabled":{type:"boolean",default:!0,description:"Play notification sound when done or blocked",scope:"window"},"amp.mcpServers":{type:"object",description:"Model Context Protocol servers that expose tools",additionalProperties:{type:"object",oneOf:[{properties:{command:{type:"string"},args:{type:"array",items:{type:"string"}},env:{type:"object",additionalProperties:{type:"string"}}},required:["command"]},{properties:{url:{type:"string"},headers:{type:"object",description:"HTTP headers to send with requests to the MCP server",additionalProperties:{type:"string"}},oauth:{type:"object",description:"OAuth 2.0 configuration for MCP server authentication",properties:{clientId:{type:"string",description:"OAuth client ID"},clientSecret:{type:"string",description:"OAuth client secret (optional for public clients)"},authUrl:{type:"string",description:"OAuth authorization endpoint URL"},tokenUrl:{type:"string",description:"OAuth token endpoint URL"},scopes:{type:"array",description:"OAuth scopes to request",items:{type:"string"}},redirectUrl:{type:"string",description:"OAuth redirect URL (defaults to http://localhost:8976/oauth/callback)"}}}},required:["url"]}]}},"amp.mcpTrustedServers":{type:"array",markdownDescription:"MCP server trust decisions. **Security Note:** This setting is only read from user settings, never workspace settings, to prevent malicious repositories from auto-approving MCP servers.",scope:"application",items:{type:"object",properties:{serverName:{type:"string",description:"MCP server name"},specHash:{type:"string",description:"Hash of the server configuration"},allow:{type:"boolean",description:"Whether this server is approved"}},required:["serverName","specHash","allow"]}},"amp.workspaces":{type:"array",markdownDescription:"Workspace-level configuration. This setting is only read from user settings, never workspace settings.",scope:"application",items:{type:"object",properties:{path:{type:"string",description:"Absolute path to the workspace"},allowAllMcpServers:{type:"boolean",description:"Whether to automatically trust all MCP servers in this workspace"}},required:["path"]}},"amp.mcpPermissions":{type:"array",description:"Permissions for Model Context Protocol (MCP) servers. Controls which MCP servers can be used.",items:{type:"object",properties:{matches:{$ref:"https://static.ampcode.com/schemas/permissions.schema.json#/$defs/permissionMatchCondition"},action:{type:"string",enum:["allow","reject"],description:"Whether to allow or reject MCP servers matching the condition"}},required:["matches","action"],additionalProperties:!1},default:[],scope:"application"},"amp.permissions":{$ref:"https://static.ampcode.com/schemas/permissions.schema.json",description:"Entries checked in sequence to configure tool permissions",default:[]},"amp.experimental.promptAutocomplete.verboseLogging":{type:"boolean",default:!1,markdownDescription:"Enable verbose logging for prompt autocomplete.",scope:"application"},"amp.experimental.tools":{type:"array",description:"Enable experimental tools by name. Available tools: kraken",items:{type:"string"},default:[],scope:"application"},"amp.tools.disable":{type:"array",markdownDescription:'Disable specific tools by name. Glob patterns using * are supported\n\nExamples:\n- Disable edit_file: `["builtin:edit_file"]`\n- Disable all playwright tab tools: `["mcp__playwright__browser_tab*"]`',items:{type:"string"},default:[]},"amp.toolbox.path":{type:"string",markdownDescription:"Path to the directory containing toolbox scripts. Supports colon-separated paths.",scope:"window"},"amp.dangerouslyAllowAll":{type:"boolean",description:"If true, never ask for confirmation when running commands",scope:"window",default:!1},"amp.model.sonnet":{type:"boolean",description:"Use Claude Sonnet 4.5 instead of Gemini 3",scope:"window",default:!1},"amp.guardedFiles.allowlist":{type:"array",description:"Glob patterns for files that should bypass guarded file protection. Files matching these patterns can be modified without user confirmation.",items:{type:"string"},default:[],scope:"window"},"amp.anthropic.thinking.enabled":{type:"boolean",default:!0,description:"Enable Claude's extended thinking capabilities",scope:"application"},"amp.tools.inactivityTimeout":{type:"number",default:300,minimum:1,maximum:3600,description:"How many seconds of no output to wait before canceling bash commands.",scope:"workspace"},"amp.tools.stopTimeout":{type:"number",default:300,description:"How many seconds to wait before canceling a running tool.",scope:"application"},"amp.terminal.commands.nodeSpawn.loadProfile":{type:"string",enum:["always","never","daily"],default:"always",description:"Before running commands (including MCP servers), whether to load environment variables from the user's profile (.bashrc, .zshrc, .envrc) as visible from the workspace root directory.",scope:"application"},"amp.todos.enabled":{type:"boolean",default:!0,description:"Enable TODOs tracking for managing tasks",scope:"application"},"amp.guidanceFiles.specs":{type:"boolean",default:!1,description:"[Experimental] Read `*.spec.md` files adjacent to `AGENT.md` files that are read",scope:"window"},"amp.security.audit.logMcpConnections":{type:"boolean",default:!1,description:"Enable telemetry logging for remote MCP server connections (for security auditing)",scope:"application"},"amp.review.separatePanel":{type:"boolean",default:!1,description:"Show the review panel as a separate container that's independently draggable to a different sidebar location.",scope:"window"},"amp.hooks":{type:"array",scope:"window",description:"[Experimental] Hooks are event handlers that can react to specific conditions.",items:{type:"object",properties:{compatibilityDate:{type:"string",const:"2025-05-13",default:"2025-05-13",description:"The version of the hook schema that this value was written to conform to"},id:{type:"string",description:"A unique identifier for the hook",examples:["run-vitest-with-env-vars"]},description:{type:"string",description:"A description of the hook"},on:{oneOf:[{type:"object",properties:{event:{type:"string",const:"tool:pre-execute",default:"tool:pre-execute",description:"Trigger when a tool is about to be executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"},"input.contains":{oneOf:[{type:"string",description:"String pattern to match in the tool input"},{type:"array",items:{type:"string"},description:"String patterns to match in the tool input"}],description:"Trigger only when the tool input contains the given literal string or strings"}},required:["event","tool","input.contains"]},{type:"object",properties:{event:{type:"string",const:"tool:post-execute",default:"tool:post-execute",description:"Trigger after a tool has been executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"}},required:["event","tool"]}]},action:{oneOf:[{type:"object",properties:{type:{type:"string",const:"send-user-message",default:"send-user-message",description:"Send a user message to interrupt the agent and cancel the tool call in the `tool:pre-execute` trigger before it starts to run"},message:{type:"string",description:"The text of the message to send"}},required:["type","message"]},{type:"object",properties:{type:{type:"string",const:"redact-tool-input",default:"redact-tool-input",description:"Redact the tool input after execution. Only allowed with `tool:post-execute` event."},redactedInput:{type:"object",description:"The replacement input data to use instead of the original tool input (must be an object)"}},required:["type","redactedInput"]}]},if:{type:"boolean",description:"A condition that determines whether the hook should be executed",default:!0}},required:["compatibilityDate","id","on","action"]},default:[]},"amp.tab.enabled":{type:"boolean",default:!1,description:"Enable Amp Tab",scope:"application"},"amp.tab.clipboard.enabled":{type:"boolean",default:!0,description:"Enable clipboard access for Amp Tab context",scope:"application"},"amp.tab.verboseLogs":{type:"boolean",default:!1,description:"Enable verbose logging for Amp Tab",scope:"application"},"amp.debugLogs":{type:"boolean",default:!1,description:"Enable debug logging in the Amp output channel",scope:"application"},"amp.tab.disabledLanguages":{type:"array",items:{type:"string"},default:[],examples:["markdown","python"],description:"List of language IDs for which Amp Tab is disabled",scope:"application"},"amp.tab.disableOnComment":{type:"boolean",default:!1,description:"Disable Amp Tab completions on comment lines",scope:"application"},"amp.tab.autoImport.enabled":{type:"boolean",default:!0,description:"Enable auto import in Amp Tab",scope:"application"},"amp.tab.dismissCommandIds":{type:"array",items:{type:"string"},default:["extension.vim_escape","vim.escape","vscode-neovim.escape","vscode-neovim.escapeKey"],description:"Command IDs to run when Escape is pressed to dismiss an Amp Tab suggestion",scope:"application"},"amp.tab.experimental.showHotStreakProgress":{type:"boolean",default:!1,description:"Experimental: Show hot streak progress in image-rendered suggestions",scope:"window"},"amp.tab.experimental.autoAccept.delayMs":{type:"number",default:0,description:"Experimental: Delay in milliseconds before auto-accepting Amp Tab suggestions",scope:"application"},"amp.tab.experimental.unobtrusiveDiffs":{type:"boolean",default:!1,description:"Experimental: Enable unobtrusive diffs mode for Amp Tab suggestions. When enabled, suggestions are shown as image overlays to avoid layout shifts and visual interference with existing code.",scope:"application"},"amp.tab.experimental.review":{type:"boolean",default:!1,description:"Experimental: Enable review mode for Amp Tab. When enabled, adds the ability to review suggestion changes with Shift+Tab shortcut and review panel.",scope:"window"},"amp.tab.diagnosticTracking":{type:"string",enum:["disabled","same_file","multi_file"],default:"multi_file",description:"Enable diagnostic tracking for Amp Tab suggestions. 'disabled' = no tracking, 'same_file' = track diagnostics within the same file, 'multi_file' = track diagnostics across multiple files.",scope:"application"},"amp.tab.hoverDiagnosticSuggestions":{type:"boolean",default:!1,description:"Show suggestions when hovering over diagnostics.",scope:"application"},"amp.tab.experimental.displayMode":{type:"string",enum:["eager","subtle"],default:"eager",description:"Experimental: Control how Amp Tab suggestions are displayed. 'eager' = show diff immediately, 'subtle' = show 'Tab to Jump' first, then show diff after user interaction.",scope:"application"},"amp.tab.experimental.disableClientFilters":{type:"array",items:{type:"string",enum:["recentlyRejectedCodeToRewrite","recentEdits","rewriteAreaOverlap","bigModification","incompatibleWithSelectedCompletionContextItem","recentlyRejectedDiff","whiteSpaceOnlyChange","formattingOnlyChange"]},default:[],description:"Experimental: Disable specific client-side filters to observe unfiltered model behavior.",scope:"application"},"amp.ui.zoomLevel":{type:"number",default:1,description:"Zoom level for the Amp UI",scope:"application"},"amp.experimental.bookkeeper":{type:"boolean",default:!1,description:"Enable the Bookkeeper subagent for reading and querying Excel workbooks (.xlsx)",scope:"window"},"amp.experimental.planMode":{type:"boolean",default:!1,description:"Enable plan mode for collaborative planning before execution",scope:"window"},"amp.experimental.reviewSubagent":{type:"boolean",default:!1,description:"Enable the review subagent for code review",scope:"window"},"amp.experimental.dojoMode":{type:"boolean",default:!1,description:"Enable dojo mode - a learning mode that guides you to discover solutions yourself",scope:"window"},"amp.git.commit.coauthor.enabled":{type:"boolean",default:!0,description:"Enable adding Amp as co-author in git commits",scope:"window"},"amp.git.commit.ampThread.enabled":{type:"boolean",default:!0,description:"Enable adding Amp-Thread trailer in git commits",scope:"window"}}},icons:{"amp-agent-file":{description:"Amp agent file",default:{fontPath:"resources/amp-icons.woff",fontCharacter:"\\0041"}}}},capabilities:{untrustedWorkspaces:{supported:"limited",description:"Amp only uses MCP servers from trusted workspaces because they execute code.",restrictedConfigurations:["amp.mcpServers","amp.mcpPermissions","amp.url"]},virtualWorkspaces:{supported:!1,description:"Amp is not supported in virtual workspaces like GitHub.dev because Amp requires local file system access and terminal capabilities."}},dependencies:{"@anthropic-ai/sdk":"catalog:","@opentelemetry/api":"^1.9.0","@opentelemetry/api-logs":"^0.57.2","@opentelemetry/core":"^1.30.1","@opentelemetry/exporter-logs-otlp-http":"^0.57.2","@opentelemetry/exporter-metrics-otlp-http":"^0.57.2","@opentelemetry/exporter-trace-otlp-http":"^0.57.2","@opentelemetry/resources":"^1.30.1","@opentelemetry/sdk-logs":"^0.57.2","@opentelemetry/sdk-metrics":"^1.30.1","@opentelemetry/sdk-node":"^0.57.2","@opentelemetry/sdk-trace-base":"^1.30.1","@opentelemetry/sdk-trace-node":"^1.30.1","@opentelemetry/semantic-conventions":"^1.34.0","@sourcegraph/amp-core":"workspace:*","@sourcegraph/amp-uri":"workspace:*","@sourcegraph/observable":"workspace:*","canvaskit-wasm":"^0.40.0","detect-indent":"^7.0.1",diff:"catalog:","fast-json-stable-stringify":"^2.1.0","fast-myers-diff":"^3.2.0","fast-xml-parser":"^5.2.3",isbinaryfile:"^5.0.5","jsonc-parser":"^3.3.1",lodash:"^4.17.21","lru-cache":"^11.1.0","node-fetch":"^3.3.2",shiki:"3.8.1",systeminformation:"^5.27.7",uuid:"^11.1.0","vscode-languageserver-textdocument":"^1.0.12","wink-nlp-utils":"^2.1.0",ws:"^8.18.3"},devDependencies:{"@secretlint/secretlint-rule-no-dotenv":"^11.2.5","@secretlint/secretlint-rule-preset-recommend":"^11.2.5","@sourcegraph/amp-web":"workspace:*","@types/bun":"^1.2.17",dedent:"catalog:","@types/diff":"catalog:","@types/jest-image-snapshot":"^6.4.0","@types/lodash":"^4.17.15","@types/node":"catalog:","@types/uuid":"^10.0.0","@types/vscode":"^1.79.0","@types/ws":"^8.18.1","@vscode/test-electron":"^2.4.1","@vscode/vsce":"^3.2.2","cross-env":"^7.0.3","crypto-browserify":"^3.12.1","jest-image-snapshot":"^6.5.0","os-browserify":"^0.3.0","path-browserify":"^1.0.1","rollup-plugin-polyfill-node":"^0.13.0",tsx:"^4.19.4"}}});function IX4(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function FU0(J){let Q=J.settings["tools.inactivityTimeout"],Y=J.settings["tools.stopTimeout"],X=Q;if(X===void 0&&Y!==void 0)X=Y;if(X===void 0)X=gE.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!IX4(X))return null;return X*1000}function UU0(J){let Q=J.settings["tools.stopTimeout"],Y=gE.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Y)*1000}var zU0;var pl=L1(()=>{nZ1();zU0=gE.contributes.configuration.properties});function YJ(J){let Q=V9[J];return`${Q.provider}/${Q.name}`}function bG(J){let[Q,Y]=J.split("/");for(let X of Object.values(V9))if(X.provider===Q&&X.name===Y)return X;switch(Q){case"anthropic":return V9.CLAUDE_SONNET_4_5;case"openai":return V9.GPT_5;case"xai":return V9.GROK_CODE_FAST_1;case"cerebras":return V9.Z_AI_GLM_4_6;case"fireworks":return V9.FIREWORKS_GLM_4P6;case"moonshotai":return V9.KIMI_K2_INSTRUCT;case"openrouter":return V9.SONOMA_SKY_ALPHA;case"groq":return V9.GPT_OSS_120B;case"vertexai":return V9.GEMINI_2_5_FLASH_PREVIEW_09_2025;default:throw Error(`Unknown provider: ${Q}`)}}function gG(J){let Q=J.indexOf("/");if(Q===-1)return J;return J.slice(Q+1)}function bW(J,Q){let Y=bG(J);if(Q&&Y.maxInputTokensInFreeMode)return Y.maxInputTokensInFreeMode;return Y.contextWindow-Y.maxOutputTokens}var S9,V9,aZ1;var gW=L1(()=>{S9={ANTHROPIC:"anthropic",OPENAI:"openai",XAI:"xai",CEREBRAS:"cerebras",FIREWORKS:"fireworks",GROQ:"groq",MOONSHOT:"moonshotai",OPENROUTER:"openrouter",VERTEXAI:"vertexai"},V9={CLAUDE_SONNET_4:{provider:S9.ANTHROPIC,name:"claude-sonnet-4-20250514",displayName:"Claude Sonnet 4",contextWindow:1e6,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_SONNET_4_5:{provider:S9.ANTHROPIC,name:"claude-sonnet-4-5-20250929",displayName:"Claude Sonnet 4.5",contextWindow:1e6,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4:{provider:S9.ANTHROPIC,name:"claude-opus-4-20250514",displayName:"Claude Opus 4",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_1:{provider:S9.ANTHROPIC,name:"claude-opus-4-1-20250805",displayName:"Claude Opus 4.1",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_5:{provider:S9.ANTHROPIC,name:"claude-opus-4-5-20251101",displayName:"Claude Opus 4.5",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_HAIKU_4_5:{provider:S9.ANTHROPIC,name:"claude-haiku-4-5-20251001",displayName:"Claude Haiku 4.5",contextWindow:200000,maxOutputTokens:64000,capabilities:{reasoning:!0,vision:!0,tools:!0},freeTierEligible:!0,maxInputTokensInFreeMode:120000},GPT_5:{provider:S9.OPENAI,name:"gpt-5",displayName:"GPT-5",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_1:{provider:S9.OPENAI,name:"gpt-5.1",displayName:"GPT-5.1",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_CODEX:{provider:S9.OPENAI,name:"gpt-5-codex",displayName:"GPT-5 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_1_CODEX:{provider:S9.OPENAI,name:"gpt-5.1-codex",displayName:"GPT-5.1 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_MINI:{provider:S9.OPENAI,name:"gpt-5-mini",displayName:"GPT-5 Mini",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.25,output:2,cached:0.025},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_NANO:{provider:S9.OPENAI,name:"gpt-5-nano",displayName:"GPT-5 Nano",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.05,output:0.4,cached:0.005},capabilities:{reasoning:!0,vision:!0,tools:!0}},O3:{provider:S9.OPENAI,name:"o3",displayName:"o3",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:2,output:8,cached:0.5},capabilities:{reasoning:!0,tools:!0}},O3_MINI:{provider:S9.OPENAI,name:"o3-mini",displayName:"o3-mini",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:1.1,output:4.4,cached:0.55},capabilities:{reasoning:!0,tools:!0}},GPT_OSS_120B:{provider:S9.OPENAI,name:"openai/gpt-oss-120b",displayName:"GPT OSS 120B",contextWindow:128000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE_FAST_1:{provider:S9.XAI,name:"grok-code-fast-1",displayName:"Grok Code Fast 1",contextWindow:256000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0},freeTierEligible:!0},GEMINI_2_5_PRO:{provider:S9.VERTEXAI,name:"gemini-2.5-pro",displayName:"Gemini 2.5 Pro",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH:{provider:S9.VERTEXAI,name:"gemini-2.5-flash",displayName:"Gemini 2.5 Flash",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH_PREVIEW_09_2025:{provider:S9.VERTEXAI,name:"gemini-2.5-flash-preview-09-2025",displayName:"Gemini 2.5 Flash (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE:{provider:S9.VERTEXAI,name:"gemini-2.5-flash-lite",displayName:"Gemini 2.5 Flash Lite",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE_PREVIEW_09_2025:{provider:S9.VERTEXAI,name:"gemini-2.5-flash-lite-preview-09-2025",displayName:"Gemini 2.5 Flash Lite (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_3_PRO_PREVIEW:{provider:S9.VERTEXAI,name:"gemini-3-pro-preview",displayName:"Gemini 3 Pro Preview",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},Z_AI_GLM_4_6:{provider:S9.CEREBRAS,name:"zai-glm-4.6",displayName:"Z.ai GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},FIREWORKS_QWEN3_CODER_480B:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/qwen3-coder-480b-a35b-instruct",displayName:"Qwen3 Coder 480B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_KIMI_K2_INSTRUCT:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_QWEN3_235B:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/qwen3-235b-a22b-instruct-2507",displayName:"Qwen3 235B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_GLM_4P6:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/glm-4p6",displayName:"GLM 4P6",contextWindow:162752,maxOutputTokens:40000,capabilities:{tools:!0}},KIMI_K2_INSTRUCT:{provider:S9.MOONSHOT,name:"kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0}},SONOMA_SKY_ALPHA:{provider:S9.OPENROUTER,name:"sonoma-sky-alpha",displayName:"Sonoma Sky Alpha",contextWindow:256000,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_GLM_4_6:{provider:S9.OPENROUTER,name:"z-ai/glm-4.6",displayName:"OpenRouter GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},OPENROUTER_KIMI_K2_0905:{provider:S9.OPENROUTER,name:"moonshotai/kimi-k2-0905",displayName:"Kimi K2 0905 (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_CODER_480B:{provider:S9.OPENROUTER,name:"qwen/qwen3-coder",displayName:"Qwen3 Coder 480B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_235B:{provider:S9.OPENROUTER,name:"qwen/qwen3-235b-a22b-2507",displayName:"Qwen3 235B A22B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}}};aZ1={FINDER:"finder"}});function oZ1(J,Q){let Y=RV(Q);if(!Y)return!1;if(PX4.has(J)){let X=Y.finder??aZ1.FINDER,G=TX4[X];if(J!==G)return!1}if(Y.includeTools)return Y.includeTools.includes(J);return!0}function mG(J,Q){let Y=J?.["internal.visibleModes"]??[];return Object.values(mE).filter((X)=>{if(Y.includes(`!${X.key}`))return!1;if(Q===!1&&I5(X.key))return!1;let Z="visible"in X?X.visible:!1,q=Y.includes(X.key),V=X.key==="plan"&&J?.["experimental.planMode"]===!0,K=J?.["experimental.dojoMode"]===!0;if(X.key==="free-dojo")return K&&(Q===!0||Q===void 0);if(X.key==="dojo")return K&&(Q===!1||Q===void 0);return Z||q||V}).map((X)=>({mode:X.key,description:"description"in X?X.description:void 0})).sort((X,G)=>X.mode.localeCompare(G.mode))}function RV(J){return Object.values(mE).find((Q)=>Q.key===J)}function Dk(J){return RV(J)?.primaryModel??YJ("CLAUDE_SONNET_4_5")}function Mk(J){let Q=RV(J);if(!Q)return!1;return bG(Q.primaryModel).capabilities?.vision??!1}function I5(J){return J==="free"||J.startsWith("free-")}function rZ1(J,Q){return Q.find((Y)=>Y.mode===J)?.description}function Lk(J,Q){let X=(Q.findIndex((Z)=>Z.mode===J)+1)%Q.length;return Q[X]?.mode??"smart"}var PX4,TX4,NU0,DU0,RX4,CX4,BU0,jX4,SX4,mE,_X4;var T$=L1(()=>{gW();PX4=new Set(["finder"]),TX4={finder:"finder"},NU0={r:0,g:55,b:0},DU0={r:0,g:255,b:136},RX4=["Read","Grep","glob","finder","Bash","InteractiveShell","create_file","edit_file","format_file","get_diagnostics","web_search","read_web_page","todo_read","todo_write","read_thread","skill"],CX4=["Read","Grep","glob","finder","Bash","InteractiveShell","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","read_thread","skill","oracle","librarian","Task","kraken"],BU0=["Read","Grep","glob","finder","Bash","get_diagnostics","web_search","read_web_page","mermaid"],jX4=["Read","Grep","glob","finder","librarian","edit_plan","read_plan","web_search","read_web_page"],SX4=["Read","Grep","glob","finder","Bash","InteractiveShell","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","todo_read","todo_write","read_thread","skill","oracle","librarian","Task","kraken","edit_plan","read_plan","code_review"],mE={SMART:{key:"smart",displayName:"Smart",description:"The most capable model and set of tools",primaryModel:YJ("CLAUDE_OPUS_4_5"),includeTools:SX4,visible:!0,uiHints:{labelAnimation:"glow",primaryColor:{r:0,g:55,b:20},secondaryColor:{r:0,g:255,b:136}}},FREE:{key:"free",displayName:"Free",description:"Amp Free",primaryModel:YJ("CLAUDE_HAIKU_4_5"),includeTools:RX4,visible:!0,uiHints:{primaryColor:{r:0,g:26,b:51},secondaryColor:{r:0,g:184,b:255}}},RUSH:{key:"rush",displayName:"Rush",description:"Faster and cheaper for small, well-defined tasks",primaryModel:YJ("CLAUDE_HAIKU_4_5"),includeTools:CX4,visible:!0,uiHints:{fasterAnimation:!0,labelAnimation:"jitter",primaryColor:{r:128,g:51,b:0},secondaryColor:{r:255,g:215,b:0}}},PLAN:{key:"plan",displayName:"Plan",description:"Collaborative planning mode",primaryModel:YJ("GPT_5_1_CODEX"),includeTools:jX4,visible:!1,uiHints:{primaryColor:{r:192,g:80,b:192},secondaryColor:{r:64,g:64,b:255}}},DOJO_FREE:{key:"free-dojo",displayName:"Dojo (Free)",description:"Learning mode - guides you to discover solutions yourself",primaryModel:YJ("CLAUDE_HAIKU_4_5"),includeTools:BU0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}},DOJO:{key:"dojo",displayName:"Dojo",description:"Learning mode - guides you to discover solutions yourself",primaryModel:YJ("CLAUDE_SONNET_4_5"),includeTools:BU0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}}},_X4=Object.values(mE).map((J)=>J.key)});function dl(J,Q,Y){if(J.startsWith("mcp__"))return Q.allowMcp??!1;if(J.startsWith("tb__")){if(!(Q.allowToolbox??!1))return!1;let X="subagentType"in Q?Q.subagentType:void 0;if(X&&Y){if(!Y.subagentTypes)return!1;return Y.subagentTypes.includes("all")||Y.subagentTypes.includes(X)}return!0}return Q.includeTools.includes(J)}var kX4,yX4,sZ1,xX4,vX4,fX4,hX4,bX4,f2,Xm8;var mW=L1(()=>{gW();kX4=["read_github","search_github","commit_search","diff","list_directory_github","list_repositories","glob_github"],yX4=["Grep","glob","Read"],sZ1=["Read","Grep","glob","web_search","read_web_page","read_thread"],xX4=["Grep","glob","Read","Bash","edit_file","create_file","format_file","read_web_page","get_diagnostics","web_search","finder"],vX4=["Read","glob","Grep","enqueue_file_edit","fastmod"],fX4=["create_file","edit_file","glob","Read","Grep","format_file","get_diagnostics"],hX4=["describe_workbook","execute_query"],bX4=["Read","Grep","glob","web_search","read_web_page","Bash"],f2={finder:{key:"finder",displayName:"Finder",model:YJ("CLAUDE_HAIKU_4_5"),includeTools:yX4,allowMcp:!1,allowToolbox:!1},oracle:{key:"oracle",displayName:"Oracle",model:YJ("GPT_5_1"),includeTools:sZ1,allowMcp:!1,allowToolbox:!1},librarian:{key:"librarian",displayName:"Librarian",model:YJ("CLAUDE_HAIKU_4_5"),includeTools:kX4,allowMcp:!1,allowToolbox:!1},"task-subagent":{key:"task-subagent",displayName:"Task Subagent",model:void 0,includeTools:xX4,allowMcp:!0,allowToolbox:!0},"kraken-scope":{key:"kraken-scope",displayName:"Kraken Scope",model:YJ("CLAUDE_HAIKU_4_5"),includeTools:vX4,allowMcp:!1,allowToolbox:!0,subagentType:"scope"},"kraken-executor":{key:"kraken-executor",displayName:"Kraken Executor",model:YJ("CLAUDE_HAIKU_4_5"),includeTools:fX4,allowMcp:!1,allowToolbox:!0,subagentType:"executor"},bookkeeper:{key:"bookkeeper",displayName:"Bookkeeper",model:YJ("CLAUDE_HAIKU_4_5"),includeTools:hX4,allowMcp:!1,allowToolbox:!1},"code-review":{key:"code-review",displayName:"Code Review",model:YJ("CLAUDE_SONNET_4_5"),includeTools:bX4,allowMcp:!1,allowToolbox:!1}},Xm8=Object.keys(f2)});function MU0(J,Q){return new X0((Y)=>{let X=setTimeout(G,Q);function G(){Y.error(Error(`Tool execution timed out after ${Q/1000} seconds`))}function Z(){if(X)clearTimeout(X);X=setTimeout(G,Q)}let q=J.subscribe({next:(V)=>{Z(),Y.next(V)},error:(V)=>{if(X)clearTimeout(X),X=null;Y.error(V)},complete:()=>{if(X)clearTimeout(X),X=null;Y.complete()}});return()=>{if(X)clearTimeout(X),X=null;q.unsubscribe()}})}var LU0=L1(()=>{r0()});function g7(J,Q){let Y={name:Q.name,description:Q.description,inputSchema:Q.inputSchema,source:Q.source,meta:Q.meta,customizedForModel:!1},X=Q.modelCustomizations;if(X){for(let G of X)if(G.modelSelector.test(J))Y={...Y,name:G.name??Y.name,description:G.description??Y.description,inputSchema:G.inputSchema??Y.inputSchema,customizedForModel:!0}}return Y}function F2(J){return["done","error","rejected-by-user","cancelled"].includes(J.status)}function wU0(J){return["done","error","cancelled"].includes(J.status)}function tZ1(J){return typeof J==="object"&&"key"in J}function cl(J){let Q=[],Y=new y4,X;function G(q,V){let K=Q.filter((W)=>W.spec.name===q);if(K.length===0&&q==="Glob")K=Q.filter((W)=>W.spec.name==="glob");for(let W of K)if(pE(W.spec,V).enabled)return W;return}function Z(q,V,K){if(!q)throw Error("spec is required");let W=Q.findIndex((L)=>L.spec.name===q.name),H=W!==-1?Q[W]:void 0;if(q.source!=="builtin"&&H?.spec.source==="builtin")return h.warn("Ignoring external tool registration - builtin takes precedence",{toolName:q.name,externalSource:q.source}),{dispose:()=>{}};let N={spec:q,fn:Promise.resolve(V),preprocessArgs:K};if(H&&JSON.stringify(H.spec.source)===JSON.stringify(q.source))h.debug("Replacing existing tool registration (idempotent)",{toolName:q.name,source:q.source}),Q[W]=N;else Q.push(N);return Y.next(),{dispose:()=>{let L=Q.indexOf(N);if(L!==-1)Q.splice(L,1),Y.next()}}}return J.configService.config.subscribe((q)=>{X=q}),{registerTool({spec:q,fn:V,preprocessArgs:K}){if(!V)return gX4;return Z(q,V,K)},tools:u8(J.configService.config,Y.pipe(Z9(void 0))).pipe(q6(([q])=>{return Q.map((V)=>({spec:V.spec,...pE(V.spec,q)})).sort((V,K)=>V.spec.name.localeCompare(K.spec.name))})),invokeTool(q,V,K){let W=performance.now(),H=()=>mX4.record(performance.now()-W,{toolName:q});if(q===J$1&&V.args&&"invalid_tool_name"in V.args&&typeof V.args.invalid_tool_name==="string"){uE.add(1,{toolName:q,error:"invalid"});let N=eZ1(V.args.invalid_tool_name);return new X0((M)=>{M.error(Error(N))})}let z=G(q,K.config);if(!z){let N=Q.filter((E)=>E.spec.name===q);if(N.length===0)return uE.add(1,{toolName:q,error:"not_found"}),new X0((E)=>{E.error(Error(`tool ${JSON.stringify(q)} not found`))});let M=N[0],L=pE(M.spec,K.config);uE.add(1,{toolName:q,error:"disabled"});let A=L.enabled?"unknown":L.disabledReason;return new X0((E)=>{E.error(Error(`tool ${JSON.stringify(q)} is disabled: ${A}`))})}let U=K.subagentSpec??K.agentMode;if(U&&!this.isToolAllowed(q,U)){uE.add(1,{toolName:q,error:"disabled"});let N=tZ1(U)?U.displayName??U.key:`${U} mode`;return new X0((M)=>{M.error(Error(`tool ${JSON.stringify(q)} is not allowed for ${N}`))})}if(K.thread.mainThreadID&&!K.subagentSpec&&!dl(q,f2["task-subagent"]))return uE.add(1,{toolName:q,error:"disabled"}),new X0((N)=>{N.error(Error(`tool ${JSON.stringify(q)} is not allowed for subagents`))});return uE.add(1,{toolName:q}),e6(()=>z.fn).pipe(v4((N)=>{let M=N(V,K);if(z.spec.meta?.disableTimeout)return M;return MU0(M,UU0(K.config))}),OQ(()=>H()))},preprocessArgs(q,V,K){let W=G(q,K.config);if(!W||!W.preprocessArgs)return;let H=W.preprocessArgs;try{return H(V,K)}catch(z){h.error("preprocessArgs",{id:q,args:V,error:String(z)});return}},isToolAllowed(q,V){let K=Q.find((H)=>H.spec.name===q),W=K?.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(tZ1(V))return dl(q,V,K?.spec.meta);return oZ1(q,V)},getTools(q){return u8(J.configService.config,Y.pipe(Z9(void 0))).pipe(q6(([V])=>{return Q.filter((K)=>{let W=K.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(tZ1(q))return dl(K.spec.name,q,K.spec.meta);return oZ1(K.spec.name,q)}).map((K)=>({spec:K.spec,...pE(K.spec,V)})).sort((K,W)=>K.spec.name.localeCompare(W.spec.name))}))},getToolsForMode(q,V){if(V)return this.getTools(f2["task-subagent"]);return this.getTools(q)},getExecutionProfile(q){if(!X)return;return G(q,X)?.spec.executionProfile},dispose(){}}}function Ak(J,Q){for(let Y of Q){if(Y==="")continue;if(Y.length===1){if(Y==="*")return!0;if(Y===J)return!0;continue}if(J===Y)return!0;if(Y.includes("*")||Y.includes("?")||Y.includes("[")||Y.includes("{"))try{if(OU0.default(Y,{dot:!0})(J))return!0}catch(X){continue}}return!1}function pE(J,Q){let Y=Q.settings?.["tools.disable"]??[];if(Ak(J.name,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"mcp"in J.source){let X=uX4(J.name);if(X){if(J.source.mcp.replace(/[\s-]+/g,"_")===X.server){if(Ak(X.tool,Y))return{enabled:!1,disabledReason:"settings"};let Z=`mcp__${J.source.mcp}__${X.tool}`;if(Ak(Z,Y))return{enabled:!1,disabledReason:"settings"}}}}if(J.source==="builtin"&&Ak(`builtin:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"toolbox"in J.source&&Ak(`toolbox:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(J.name===Z7||J.name===PV){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function eZ1(J){return`Invalid tool name ${JSON.stringify(J)}. Tool names must match the pattern ${Ok.toString()}. Try again with a valid tool name.`}function uX4(J){let[,Q,Y]=J.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&Y)return{server:Q,tool:Y};return}function Q$1(J){if(J.status==="in-progress"||J.status==="done"||J.status==="cancelled"||J.status==="error")return J.progress;return}var AU0,OU0,gX4,J$1="invalid_tool",Ok,EU0,uE,mX4;var m7=L1(()=>{r0();w0();pl();T$();mW();LU0();L4();AU0=D6(b6(),1),OU0=D6(WM(),1);gX4={dispose(){}};Ok=/^[-a-zA-Z0-9_]{1,64}$/,EU0=AU0.metrics.getMeter("tool_service"),uE=EU0.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),mX4=EU0.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var jU0=f((RU0)=>{Object.defineProperty(RU0,"__esModule",{value:!0});RU0.calcSlices=RU0.applyPatch=RU0.calcPatch=RU0.lcs=RU0.diff=RU0.diff_core=void 0;function pX4(J,Q){let{b:Y,eq:X,stack_base:G}=J,{i:Z,N:q,j:V,M:K,Z:W,stack_top:H}=J;for(;;)switch(Q){case 0:{J:while(q>0&&K>0){Y.fill(0,0,2*W);let z=q-K,U=q+K,N=U&1,M=Z+q-1,L=V+K-1,A=(U+N)/2,E;Q:for(let P=0;P<=A;P++){let I=2*Math.max(0,P-K)-P,R=P-2*Math.max(0,P-q);for(let S=I;S<=R;S+=2){let y=Y[S-1-W*Math.floor((S-1)/W)],x=Y[S+1-W*Math.floor((S+1)/W)],g=S===-P||S!==P&&y<x?x:y+1,p=g-S,b=g,i=p;while(b<q&&i<K&&X(Z+b,V+i))b++,i++;if(Y[S-W*Math.floor(S/W)]=b,N===1&&(E=z-S)>=1-P&&E<P&&b+Y[W+E-W*Math.floor(E/W)]>=q)if(P>1||b!==g){G[H++]=Z+b,G[H++]=q-b,G[H++]=V+i,G[H++]=K-i,q=g,K=p,W=2*(Math.min(q,K)+1);continue J}else break Q}for(let S=I;S<=R;S+=2){let y=Y[W+S-1-W*Math.floor((S-1)/W)],x=Y[W+S+1-W*Math.floor((S+1)/W)],g=S===-P||S!==P&&y<x?x:y+1,p=g-S,b=g,i=p;while(b<q&&i<K&&X(M-b,L-i))b++,i++;if(Y[W+S-W*Math.floor(S/W)]=b,N===0&&(E=z-S)>=-P&&E<=P&&b+Y[E-W*Math.floor(E/W)]>=q)if(P>0||b!==g){G[H++]=Z+q-g,G[H++]=g,G[H++]=V+K-p,G[H++]=p,q=q-b,K=K-i,W=2*(Math.min(q,K)+1);continue J}else break Q}}if(q===K)continue;if(K>q)Z+=q,V+=q,K-=q,q=0;else Z+=K,V+=K,q-=K,K=0;break}if(q+K!==0)if(J.pxe===Z||J.pye===V)J.pxe=Z+q,J.pye=V+K;else{let z=J.pxs;if(J.oxs=J.pxs,J.oxe=J.pxe,J.oys=J.pys,J.oye=J.pye,J.pxs=Z,J.pxe=Z+q,J.pys=V,J.pye=V+K,z>=0)return J.i=Z,J.N=q,J.j=V,J.M=K,J.Z=W,J.stack_top=H,1}}case 1:{if(H===0)return 2;K=G[--H],V=G[--H],q=G[--H],Z=G[--H],W=2*(Math.min(q,K)+1),Q=0}}}class IU0{constructor(J){this.state=J,this.c=0,this.result={value:null,done:!1}}[Symbol.iterator](){return this}next(){let{state:J,result:Q}=this;if(this.c>1)return Q.done=!0,Q.value=void 0,Q;let Y=pX4(J,this.c);if(this.c=Y,Y===1)return Q.value=[J.oxs,J.oxe,J.oys,J.oye],Q;if(J.pxs>=0)return Q.value=[J.pxs,J.pxe,J.pys,J.pye],Q;return Q.done=!0,Q.value=void 0,Q}}function PU0(J,Q,Y,X,G){let Z=(Math.min(Q,X)+1)*2,q=Q+X,V=new(q<256?Uint8Array:q<65536?Uint16Array:Uint32Array)(2*Z);return new IU0({i:J,N:Q,j:Y,M:X,Z,b:V,eq:G,pxs:-1,pxe:-1,pys:-1,pye:-1,oxs:-1,oxe:-1,oys:-1,oye:-1,stack_top:0,stack_base:[]})}RU0.diff_core=PU0;function ll(J,Q,Y){let[X,G,Z]=[0,J.length,Q.length];if(typeof Y==="function"){while(X<G&&X<Z&&Y(X,X))X++;if(X===G&&X===Z)return[][Symbol.iterator]();while(Y(--G,--Z)&&G>X&&Z>X);}else{while(X<G&&X<Z&&J[X]===Q[X])X++;if(X===G&&X===Z)return[][Symbol.iterator]();while(J[--G]===Q[--Z]&&G>X&&Z>X);Y=(q,V)=>J[q]===Q[V]}return PU0(X,G+1-X,X,Z+1-X,Y)}RU0.diff=ll;class TU0{constructor(J,Q){this.diff=J,this.N=Q,this.i=0,this.j=0}[Symbol.iterator](){return this}next(){let J=this.diff.next();if(J.done){let{i:V,j:K,N:W}=this;if(V<W)J.done=!1,J.value=[V,K,W-V],this.i=W;return J}let Q=J.value,Y=Q[0],X=Q[1],G=Q[3],{i:Z,j:q}=this;if(Z!==Y)Q.length--,Q[0]=Z,Q[1]=q,Q[2]=Y-Z;return this.i=X,this.j=G,J}}function dX4(J,Q,Y){return new TU0(ll(J,Q,Y),J.length)}RU0.lcs=dX4;function*cX4(J,Q,Y){let X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let G of ll(J,Q,Y))G[2]=X.call(Q,G[2],G[3]),yield G}RU0.calcPatch=cX4;function*lX4(J,Q){let Y=0,X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[G,Z,q]of Q){if(Y<G)yield X.call(J,Y,G);if(q.length>0)yield q;Y=Z}if(Y<J.length)yield X.call(J,Y)}RU0.applyPatch=lX4;function*iX4(J,Q,Y){let X=0,G=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[Z,q,V,K]of ll(J,Q,Y)){if(X<Z)yield[0,G.call(J,X,Z)];if(Z<q)yield[-1,G.call(J,Z,q)];if(V<K)yield[1,G.call(Q,V,K)];X=q}if(X<J.length)yield[0,J.slice(X)]}RU0.calcSlices=iX4});function dE(J,Q){let Y={added:0,deleted:0,changed:0};if(typeof J!=="string"||typeof Q!=="string")return Y;if(J===Q)return Y;try{let X={added:0,deleted:0,changed:0};for(let[G,Z,q,V]of SU0.diff(J.split(`
48
+ `)[0];if(!X?.startsWith("#!"))return{interpreter:null,isValid:!1};let G=X.slice(2).trim();if(!G)return{interpreter:null,isValid:!1};let Z=G.split(/\s+/).filter((q)=>q.length>0);if(Z[0]?.endsWith("/env")&&Z.length>1)return{interpreter:Z.slice(1),isValid:!0};return{interpreter:Z,isValid:!0}}finally{await Q.close()}}catch{return{interpreter:null,isValid:!1}}}function cz0(J,Q){let Y=(J&73)!==0;if(process.platform==="win32"){let X=oD.extname(Q).toLowerCase();return Y||[".exe",".bat",".cmd",".ps1"].includes(X)}return Y}function lz0(J){return oD.extname(J).toLowerCase()===".md"}function iz0(J){let Q=J.replace(/\\/g,"/"),Y=oD.basename(Q);return oD.basename(Y,oD.extname(Y))}function nz0(J){return/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(J)&&J.length>0}var az0=()=>{};var tz0={};n8(tz0,{CommandDiscovery:()=>sz0});import*as rz0 from"node:fs";import{promises as Kl}from"node:fs";import{homedir as oz0}from"node:os";import*as VX from"node:path";function ZZ1(J,Q,Y){return Promise.race([J,new Promise((X,G)=>setTimeout(()=>G(Error(`${Y} timed out after ${Q}ms`)),Q))])}class sz0{config;workspaceRoots;watchFactory;debounceMs;changes=new y4;watchers=new Map;debounceTimer;disposed=!1;constructor(J,Q,Y={}){this.config=J,this.workspaceRoots=Q,this.watchFactory=Y.watchFactory??oJ4,this.debounceMs=Y.debounceMs??200}get commandChanges(){return this.changes}async discoverCommands(){if(this.disposed)return[];try{let[J,Q]=await Promise.all([this.discoverWorkspaceCommands(),this.discoverGlobalCommands()]),Y=new Map;for(let G of Q)Y.set(`${G.source}:${G.name}`,G);for(let G of J)Y.set(`${G.source}:${G.name}`,G);let X=Array.from(Y.values());if(h.debug("Discovered commands",{count:X.length,workspace:J.length,global:Q.length}),this.config.enableWatching)await this.setupWatching();return X}catch(J){return h.error("Failed to discover commands",{error:J}),[]}}async discoverWorkspaceCommands(){let J=[];for(let Q of this.workspaceRoots)for(let Y of this.config.workspacePaths){let X=Z6.joinPath(Q,Y),G=await this.discoverCommandsInDirectory(X,"workspace");J.push(...G)}return J}async discoverGlobalCommands(){let J=[];for(let Q of this.config.globalPaths){let Y=this.resolveGlobalPath(Q),X=n0.file(Y),G=await this.discoverCommandsInDirectory(X,"global");J.push(...G)}return J}async discoverCommandsInDirectory(J,Q){try{let Y=J.fsPath;try{await ZZ1(Kl.access(Y),GZ1,"directory access")}catch{return[]}let G=(await ZZ1(Kl.readdir(Y,{withFileTypes:!0}),GZ1,"directory read")).filter((q)=>q.isFile()),Z=[];for(let q of G){let V=VX.join(Y,q.name),K=await this.createCommand(V,Q);if(K)Z.push(K)}return h.debug(`Discovered ${Z.length} commands in ${Q} directory`,{directory:Y,commands:Z.map((q)=>q.name)}),Z}catch(Y){return h.warn(`Failed to discover commands in directory: ${J.fsPath}`,{error:Y}),[]}}ignoreCommandName(J){return J.startsWith(".")||J==="README.md"}async createCommand(J,Q){try{let Y=await Kl.stat(J),X=VX.basename(J);if(this.ignoreCommandName(X))return null;let G=iz0(X);if(!nz0(G))return h.warn(`Invalid command name: ${G}`,{filePath:J}),null;if(lz0(X))return this.createMarkdownCommand(J,Y,G,Q);else return this.createExecutableCommand(J,Y,G,Q)}catch(Y){return h.warn(`Failed to process file: ${J}`,{error:Y}),null}}async createMarkdownCommand(J,Q,Y,X){return{kind:"markdown",name:Y,filePath:J,sourceDirectory:VX.dirname(J),lastModified:Q.mtimeMs,available:!0,unavailableReason:void 0,source:X}}async createExecutableCommand(J,Q,Y,X){let G=VX.basename(J),Z=cz0(Q.mode,G),q=await dz0(J),V=VX.extname(G);if(!Z&&!q.isValid&&!this.isNativeBinary(V))return h.debug(`Skipping non-executable file without shebang: ${J}`),null;let K=Z&&(q.isValid||this.isNativeBinary(V)),W=this.getExecutableUnavailableReason(Z,q.isValid,V);return{kind:"executable",name:Y,filePath:J,sourceDirectory:VX.dirname(J),lastModified:Q.mtimeMs,isExecutable:Z,interpreter:q.interpreter,extension:V,available:K,unavailableReason:W,source:X}}isNativeBinary(J){if(process.platform==="win32")return[".exe",".bat",".cmd",".ps1"].includes(J.toLowerCase());return J===""}getExecutableUnavailableReason(J,Q,Y){let X=this.isNativeBinary(Y);if(!J)return"File is not executable (missing execute permissions)";if(!Q&&!X)return"Missing shebang and not a recognized binary type";return}resolveGlobalPath(J){if(J.startsWith("~/"))return VX.join(oz0(),J.slice(2));if(J.startsWith("~/.config/amp/")){let Q=TF||VX.join(oz0(),".config");return VX.join(Q,J.slice(10))}return J}async setupWatching(){if(this.disposed)return;this.stopWatching();let J=new Set;for(let Q of this.workspaceRoots)for(let Y of this.config.workspacePaths){let X=Z6.joinPath(Q,Y);J.add(X.fsPath)}for(let Q of this.config.globalPaths){let Y=this.resolveGlobalPath(Q);J.add(Y)}for(let Q of J)await this.watchDirectory(Q)}async watchDirectory(J){try{await ZZ1(Kl.access(J),GZ1,"watcher access check");try{let Q=this.watchFactory(J,(Y,X)=>{h.debug("Command directory change detected",{directory:J,eventType:Y,filename:X}),this.scheduleRefresh()});Q.on("error",(Y)=>{h.debug("transient file watcher error",{error:Y}),this.scheduleRefresh()}),this.watchers.set(J,Q),h.debug("Started watching command directory",{directory:J})}catch(Q){h.warn("Failed to setup file watcher",{directory:J,error:Q})}}catch(Q){h.debug("Skipping watch for non-existent directory",{directory:J})}}scheduleRefresh(){if(this.disposed)return;if(this.debounceTimer)clearTimeout(this.debounceTimer);this.debounceTimer=setTimeout(async()=>{try{let[J,Q]=await Promise.all([this.discoverWorkspaceCommands(),this.discoverGlobalCommands()]),Y=new Map;for(let G of Q)Y.set(`${G.source}:${G.name}`,G);for(let G of J)Y.set(`${G.source}:${G.name}`,G);let X=Array.from(Y.values());h.debug("Refreshed commands during file watch",{count:X.length,workspace:J.length,global:Q.length}),this.changes.next(X)}catch(J){h.warn("Failed to refresh commands during file watch",{error:J})}},this.debounceMs)}stopWatching(){try{for(let[J,Q]of this.watchers)try{Q.close(),h.debug("Stopped watching command directory",{directory:J})}catch(Y){h.warn("Failed to close watcher",{directory:J,error:Y})}this.watchers.clear()}finally{if(this.debounceTimer)clearTimeout(this.debounceTimer),this.debounceTimer=void 0}}dispose(){this.disposed=!0;try{this.stopWatching()}catch(J){h.warn("Error during command discovery cleanup",{error:J})}}}var GZ1=5000,oJ4=(J,Q)=>rz0.watch(J,Q);var ez0=L1(()=>{K4();r0();$E();w0();az0()});function $5(J,Q,Y=Q+"s"){return J===1?Q:Y}function yF(J){let Q=typeof J==="string"?J:J.toString();return Q===KY||Q===KY.slice(0,-1)}function NE(J){return yF(J)?KY:J}var UQ4,KY,BQ4,db8;var xF=L1(()=>{UQ4=new URL("https://ampcode.com/"),KY=UQ4.toString(),BQ4=new URL("https://api.anthropic.com/"),db8=BQ4.toString()});var N9,DZ1,x6,OV=(J)=>{switch(typeof J){case"undefined":return x6.undefined;case"string":return x6.string;case"number":return Number.isNaN(J)?x6.nan:x6.number;case"boolean":return x6.boolean;case"function":return x6.function;case"bigint":return x6.bigint;case"symbol":return x6.symbol;case"object":if(Array.isArray(J))return x6.array;if(J===null)return x6.null;if(J.then&&typeof J.then==="function"&&J.catch&&typeof J.catch==="function")return x6.promise;if(typeof Map<"u"&&J instanceof Map)return x6.map;if(typeof Set<"u"&&J instanceof Set)return x6.set;if(typeof Date<"u"&&J instanceof Date)return x6.date;return x6.object;default:return x6.unknown}};var r_=L1(()=>{(function(J){J.assertEqual=(G)=>{};function Q(G){}J.assertIs=Q;function Y(G){throw Error()}J.assertNever=Y,J.arrayToEnum=(G)=>{let Z={};for(let q of G)Z[q]=q;return Z},J.getValidEnumValues=(G)=>{let Z=J.objectKeys(G).filter((V)=>typeof G[G[V]]!=="number"),q={};for(let V of Z)q[V]=G[V];return J.objectValues(q)},J.objectValues=(G)=>{return J.objectKeys(G).map(function(Z){return G[Z]})},J.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let Z=[];for(let q in G)if(Object.prototype.hasOwnProperty.call(G,q))Z.push(q);return Z},J.find=(G,Z)=>{for(let q of G)if(Z(q))return q;return},J.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&Number.isFinite(G)&&Math.floor(G)===G;function X(G,Z=" | "){return G.map((q)=>typeof q==="string"?`'${q}'`:q).join(Z)}J.joinValues=X,J.jsonStringifyReplacer=(G,Z)=>{if(typeof Z==="bigint")return Z.toString();return Z}})(N9||(N9={}));(function(J){J.mergeShapes=(Q,Y)=>{return{...Q,...Y}}})(DZ1||(DZ1={}));x6=N9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var z6,NQ4=(J)=>{return JSON.stringify(J,null,2).replace(/"([^"]+)":/g,"$1:")},WY;var Ul=L1(()=>{r_();z6=N9.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"]);WY=class WY extends Error{get errors(){return this.issues}constructor(J){super();this.issues=[],this.addIssue=(Y)=>{this.issues=[...this.issues,Y]},this.addIssues=(Y=[])=>{this.issues=[...this.issues,...Y]};let Q=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,Q);else this.__proto__=Q;this.name="ZodError",this.issues=J}format(J){let Q=J||function(G){return G.message},Y={_errors:[]},X=(G)=>{for(let Z of G.issues)if(Z.code==="invalid_union")Z.unionErrors.map(X);else if(Z.code==="invalid_return_type")X(Z.returnTypeError);else if(Z.code==="invalid_arguments")X(Z.argumentsError);else if(Z.path.length===0)Y._errors.push(Q(Z));else{let q=Y,V=0;while(V<Z.path.length){let K=Z.path[V];if(V!==Z.path.length-1)q[K]=q[K]||{_errors:[]};else q[K]=q[K]||{_errors:[]},q[K]._errors.push(Q(Z));q=q[K],V++}}};return X(this),Y}static assert(J){if(!(J instanceof WY))throw Error(`Not a ZodError: ${J}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,N9.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(J=(Q)=>Q.message){let Q={},Y=[];for(let X of this.issues)if(X.path.length>0){let G=X.path[0];Q[G]=Q[G]||[],Q[G].push(J(X))}else Y.push(J(X));return{formErrors:Y,fieldErrors:Q}}get formErrors(){return this.flatten()}};WY.create=(J)=>{return new WY(J)}});var DQ4=(J,Q)=>{let Y;switch(J.code){case z6.invalid_type:if(J.received===x6.undefined)Y="Required";else Y=`Expected ${J.expected}, received ${J.received}`;break;case z6.invalid_literal:Y=`Invalid literal value, expected ${JSON.stringify(J.expected,N9.jsonStringifyReplacer)}`;break;case z6.unrecognized_keys:Y=`Unrecognized key(s) in object: ${N9.joinValues(J.keys,", ")}`;break;case z6.invalid_union:Y="Invalid input";break;case z6.invalid_union_discriminator:Y=`Invalid discriminator value. Expected ${N9.joinValues(J.options)}`;break;case z6.invalid_enum_value:Y=`Invalid enum value. Expected ${N9.joinValues(J.options)}, received '${J.received}'`;break;case z6.invalid_arguments:Y="Invalid function arguments";break;case z6.invalid_return_type:Y="Invalid function return type";break;case z6.invalid_date:Y="Invalid date";break;case z6.invalid_string:if(typeof J.validation==="object")if("includes"in J.validation){if(Y=`Invalid input: must include "${J.validation.includes}"`,typeof J.validation.position==="number")Y=`${Y} at one or more positions greater than or equal to ${J.validation.position}`}else if("startsWith"in J.validation)Y=`Invalid input: must start with "${J.validation.startsWith}"`;else if("endsWith"in J.validation)Y=`Invalid input: must end with "${J.validation.endsWith}"`;else N9.assertNever(J.validation);else if(J.validation!=="regex")Y=`Invalid ${J.validation}`;else Y="Invalid";break;case z6.too_small:if(J.type==="array")Y=`Array must contain ${J.exact?"exactly":J.inclusive?"at least":"more than"} ${J.minimum} element(s)`;else if(J.type==="string")Y=`String must contain ${J.exact?"exactly":J.inclusive?"at least":"over"} ${J.minimum} character(s)`;else if(J.type==="number")Y=`Number must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${J.minimum}`;else if(J.type==="bigint")Y=`Number must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${J.minimum}`;else if(J.type==="date")Y=`Date must be ${J.exact?"exactly equal to ":J.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(J.minimum))}`;else Y="Invalid input";break;case z6.too_big:if(J.type==="array")Y=`Array must contain ${J.exact?"exactly":J.inclusive?"at most":"less than"} ${J.maximum} element(s)`;else if(J.type==="string")Y=`String must contain ${J.exact?"exactly":J.inclusive?"at most":"under"} ${J.maximum} character(s)`;else if(J.type==="number")Y=`Number must be ${J.exact?"exactly":J.inclusive?"less than or equal to":"less than"} ${J.maximum}`;else if(J.type==="bigint")Y=`BigInt must be ${J.exact?"exactly":J.inclusive?"less than or equal to":"less than"} ${J.maximum}`;else if(J.type==="date")Y=`Date must be ${J.exact?"exactly":J.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(J.maximum))}`;else Y="Invalid input";break;case z6.custom:Y="Invalid input";break;case z6.invalid_intersection_types:Y="Intersection results could not be merged";break;case z6.not_multiple_of:Y=`Number must be a multiple of ${J.multipleOf}`;break;case z6.not_finite:Y="Number must be finite";break;default:Y=Q.defaultError,N9.assertNever(J)}return{message:Y}},xW;var MZ1=L1(()=>{Ul();r_();xW=DQ4});function MQ4(J){KF0=J}function DE(){return KF0}var KF0;var Bl=L1(()=>{MZ1();KF0=xW});function r6(J,Q){let Y=DE(),X=s_({issueData:Q,data:J.data,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,Y,Y===xW?void 0:xW].filter((G)=>!!G)});J.common.issues.push(X)}class JJ{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(J,Q){let Y=[];for(let X of Q){if(X.status==="aborted")return o4;if(X.status==="dirty")J.dirty();Y.push(X.value)}return{status:J.value,value:Y}}static async mergeObjectAsync(J,Q){let Y=[];for(let X of Q){let G=await X.key,Z=await X.value;Y.push({key:G,value:Z})}return JJ.mergeObjectSync(J,Y)}static mergeObjectSync(J,Q){let Y={};for(let X of Q){let{key:G,value:Z}=X;if(G.status==="aborted")return o4;if(Z.status==="aborted")return o4;if(G.status==="dirty")J.dirty();if(Z.status==="dirty")J.dirty();if(G.value!=="__proto__"&&(typeof Z.value<"u"||X.alwaysSet))Y[G.value]=Z.value}return{status:J.value,value:Y}}}var s_=(J)=>{let{data:Q,path:Y,errorMaps:X,issueData:G}=J,Z=[...Y,...G.path||[]],q={...G,path:Z};if(G.message!==void 0)return{...G,path:Z,message:G.message};let V="",K=X.filter((W)=>!!W).slice().reverse();for(let W of K)V=W(q,{data:Q,defaultError:V}).message;return{...G,path:Z,message:V}},LQ4,o4,sD=(J)=>({status:"dirty",value:J}),cJ=(J)=>({status:"valid",value:J}),Nl=(J)=>J.status==="aborted",Dl=(J)=>J.status==="dirty",vF=(J)=>J.status==="valid",ME=(J)=>typeof Promise<"u"&&J instanceof Promise;var LZ1=L1(()=>{Bl();MZ1();LQ4=[];o4=Object.freeze({status:"aborted"})});var WF0=()=>{};var M4;var HF0=L1(()=>{(function(J){J.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},J.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(M4||(M4={}))});class I${constructor(J,Q,Y,X){this._cachedPath=[],this.parent=J,this.data=Q,this._path=Y,this._key=X}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function S8(J){if(!J)return{};let{errorMap:Q,invalid_type_error:Y,required_error:X,description:G}=J;if(Q&&(Y||X))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(Q)return{errorMap:Q,description:G};return{errorMap:(q,V)=>{let{message:K}=J;if(q.code==="invalid_enum_value")return{message:K??V.defaultError};if(typeof V.data>"u")return{message:K??X??V.defaultError};if(q.code!=="invalid_type")return{message:V.defaultError};return{message:K??Y??V.defaultError}},description:G}}class o8{get description(){return this._def.description}_getType(J){return OV(J.data)}_getOrReturnCtx(J,Q){return Q||{common:J.parent.common,data:J.data,parsedType:OV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}_processInputParams(J){return{status:new JJ,ctx:{common:J.parent.common,data:J.data,parsedType:OV(J.data),schemaErrorMap:this._def.errorMap,path:J.path,parent:J.parent}}}_parseSync(J){let Q=this._parse(J);if(ME(Q))throw Error("Synchronous parse encountered promise.");return Q}_parseAsync(J){let Q=this._parse(J);return Promise.resolve(Q)}parse(J,Q){let Y=this.safeParse(J,Q);if(Y.success)return Y.data;throw Y.error}safeParse(J,Q){let Y={common:{issues:[],async:Q?.async??!1,contextualErrorMap:Q?.errorMap},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:OV(J)},X=this._parseSync({data:J,path:Y.path,parent:Y});return zF0(Y,X)}"~validate"(J){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:OV(J)};if(!this["~standard"].async)try{let Y=this._parseSync({data:J,path:[],parent:Q});return vF(Y)?{value:Y.value}:{issues:Q.common.issues}}catch(Y){if(Y?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;Q.common={issues:[],async:!0}}return this._parseAsync({data:J,path:[],parent:Q}).then((Y)=>vF(Y)?{value:Y.value}:{issues:Q.common.issues})}async parseAsync(J,Q){let Y=await this.safeParseAsync(J,Q);if(Y.success)return Y.data;throw Y.error}async safeParseAsync(J,Q){let Y={common:{issues:[],contextualErrorMap:Q?.errorMap,async:!0},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:J,parsedType:OV(J)},X=this._parse({data:J,path:Y.path,parent:Y}),G=await(ME(X)?X:Promise.resolve(X));return zF0(Y,G)}refine(J,Q){let Y=(X)=>{if(typeof Q==="string"||typeof Q>"u")return{message:Q};else if(typeof Q==="function")return Q(X);else return Q};return this._refinement((X,G)=>{let Z=J(X),q=()=>G.addIssue({code:z6.custom,...Y(X)});if(typeof Promise<"u"&&Z instanceof Promise)return Z.then((V)=>{if(!V)return q(),!1;else return!0});if(!Z)return q(),!1;else return!0})}refinement(J,Q){return this._refinement((Y,X)=>{if(!J(Y))return X.addIssue(typeof Q==="function"?Q(Y,X):Q),!1;else return!0})}_refinement(J){return new P$({schema:this,typeName:$8.ZodEffects,effect:{type:"refinement",refinement:J}})}superRefine(J){return this._refinement(J)}constructor(J){this.spa=this.safeParseAsync,this._def=J,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:(Q)=>this["~validate"](Q)}}optional(){return E$.create(this,this._def)}nullable(){return fW.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return w$.create(this)}promise(){return QM.create(this,this._def)}or(J){return IE.create([this,J],this._def)}and(J){return PE.create(this,J,this._def)}transform(J){return new P$({...S8(this._def),schema:this,typeName:$8.ZodEffects,effect:{type:"transform",transform:J}})}default(J){let Q=typeof J==="function"?J:()=>J;return new jE({...S8(this._def),innerType:this,defaultValue:Q,typeName:$8.ZodDefault})}brand(){return new Ll({typeName:$8.ZodBranded,type:this,...S8(this._def)})}catch(J){let Q=typeof J==="function"?J:()=>J;return new SE({...S8(this._def),innerType:this,catchValue:Q,typeName:$8.ZodCatch})}describe(J){return new this.constructor({...this._def,description:J})}pipe(J){return Xk.create(this,J)}readonly(){return _E.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function BF0(J){let Q="[0-5]\\d";if(J.precision)Q=`${Q}\\.\\d{${J.precision}}`;else if(J.precision==null)Q=`${Q}(\\.\\d+)?`;let Y=J.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${Q})${Y}`}function fQ4(J){return new RegExp(`^${BF0(J)}$`)}function NF0(J){let Q=`${UF0}T${BF0(J)}`,Y=[];if(Y.push(J.local?"Z?":"Z"),J.offset)Y.push("([+-]\\d{2}:?\\d{2})");return Q=`${Q}(${Y.join("|")})`,new RegExp(`^${Q}$`)}function hQ4(J,Q){if((Q==="v4"||!Q)&&jQ4.test(J))return!0;if((Q==="v6"||!Q)&&_Q4.test(J))return!0;return!1}function bQ4(J,Q){if(!PQ4.test(J))return!1;try{let[Y]=J.split(".");if(!Y)return!1;let X=Y.replace(/-/g,"+").replace(/_/g,"/").padEnd(Y.length+(4-Y.length%4)%4,"="),G=JSON.parse(atob(X));if(typeof G!=="object"||G===null)return!1;if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(Q&&G.alg!==Q)return!1;return!0}catch{return!1}}function gQ4(J,Q){if((Q==="v4"||!Q)&&SQ4.test(J))return!0;if((Q==="v6"||!Q)&&kQ4.test(J))return!0;return!1}function mQ4(J,Q){let Y=(J.toString().split(".")[1]||"").length,X=(Q.toString().split(".")[1]||"").length,G=Y>X?Y:X,Z=Number.parseInt(J.toFixed(G).replace(".","")),q=Number.parseInt(Q.toFixed(G).replace(".",""));return Z%q/10**G}function LE(J){if(J instanceof j7){let Q={};for(let Y in J.shape){let X=J.shape[Y];Q[Y]=E$.create(LE(X))}return new j7({...J._def,shape:()=>Q})}else if(J instanceof w$)return new w$({...J._def,type:LE(J.element)});else if(J instanceof E$)return E$.create(LE(J.unwrap()));else if(J instanceof fW)return fW.create(LE(J.unwrap()));else if(J instanceof EV)return EV.create(J.items.map((Q)=>LE(Q)));else return J}function OZ1(J,Q){let Y=OV(J),X=OV(Q);if(J===Q)return{valid:!0,data:J};else if(Y===x6.object&&X===x6.object){let G=N9.objectKeys(Q),Z=N9.objectKeys(J).filter((V)=>G.indexOf(V)!==-1),q={...J,...Q};for(let V of Z){let K=OZ1(J[V],Q[V]);if(!K.valid)return{valid:!1};q[V]=K.data}return{valid:!0,data:q}}else if(Y===x6.array&&X===x6.array){if(J.length!==Q.length)return{valid:!1};let G=[];for(let Z=0;Z<J.length;Z++){let q=J[Z],V=Q[Z],K=OZ1(q,V);if(!K.valid)return{valid:!1};G.push(K.data)}return{valid:!0,data:G}}else if(Y===x6.date&&X===x6.date&&+J===+Q)return{valid:!0,data:J};else return{valid:!1}}function DF0(J,Q){return new gF({values:J,typeName:$8.ZodEnum,...S8(Q)})}function FF0(J,Q){let Y=typeof J==="function"?J(Q):typeof J==="string"?{message:J}:J;return typeof Y==="string"?{message:Y}:Y}function MF0(J,Q={},Y){if(J)return eD.create().superRefine((X,G)=>{let Z=J(X);if(Z instanceof Promise)return Z.then((q)=>{if(!q){let V=FF0(Q,X),K=V.fatal??Y??!0;G.addIssue({code:"custom",...V,fatal:K})}});if(!Z){let q=FF0(Q,X),V=q.fatal??Y??!0;G.addIssue({code:"custom",...q,fatal:V})}return});return eD.create()}var zF0=(J,Q)=>{if(vF(Q))return{success:!0,data:Q.value};else{if(!J.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Y=new WY(J.common.issues);return this._error=Y,this._error}}}},AQ4,OQ4,wQ4,EQ4,IQ4,PQ4,TQ4,RQ4,CQ4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",AZ1,jQ4,SQ4,_Q4,kQ4,yQ4,xQ4,UF0="((\\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])))",vQ4,O$,hF,bF,OE,tD,t_,wE,EE,eD,fF,wV,e_,w$,j7,IE,vW=(J)=>{if(J instanceof TE)return vW(J.schema);else if(J instanceof P$)return vW(J.innerType());else if(J instanceof RE)return[J.value];else if(J instanceof gF)return J.options;else if(J instanceof CE)return N9.objectValues(J.enum);else if(J instanceof jE)return vW(J._def.innerType);else if(J instanceof wE)return[void 0];else if(J instanceof EE)return[null];else if(J instanceof E$)return[void 0,...vW(J.unwrap())];else if(J instanceof fW)return[null,...vW(J.unwrap())];else if(J instanceof Ll)return vW(J.unwrap());else if(J instanceof _E)return vW(J.unwrap());else if(J instanceof SE)return vW(J._def.innerType);else return[]},Ml,PE,EV,Jk,Qk,JM,AE,TE,RE,gF,CE,QM,P$,E$,fW,jE,SE,Yk,uQ4,Ll,Xk,_E,pQ4,$8,dQ4=(J,Q={message:`Input not instance of ${J.name}`})=>MF0((Y)=>Y instanceof J,Q),LF0,AF0,cQ4,lQ4,OF0,iQ4,nQ4,aQ4,oQ4,rQ4,sQ4,tQ4,eQ4,JY4,QY4,YY4,XY4,GY4,ZY4,$Y4,qY4,VY4,KY4,WY4,HY4,zY4,FY4,UY4,BY4,NY4,DY4,MY4,LY4,AY4,OY4=()=>LF0().optional(),wY4=()=>AF0().optional(),EY4=()=>OF0().optional(),IY4,PY4;var wF0=L1(()=>{Ul();Bl();HF0();LZ1();r_();AQ4=/^c[^\s-]{8,}$/i,OQ4=/^[0-9a-z]+$/,wQ4=/^[0-9A-HJKMNP-TV-Z]{26}$/i,EQ4=/^[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,IQ4=/^[a-z0-9_-]{21}$/i,PQ4=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,TQ4=/^[-+]?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)?)??$/,RQ4=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jQ4=/^(?:(?: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])$/,SQ4=/^(?:(?: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])$/,_Q4=/^(([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]))$/,kQ4=/^(([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])$/,yQ4=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,xQ4=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vQ4=new RegExp(`^${UF0}$`);O$=class O$ extends o8{_parse(J){if(this._def.coerce)J.data=String(J.data);if(this._getType(J)!==x6.string){let G=this._getOrReturnCtx(J);return r6(G,{code:z6.invalid_type,expected:x6.string,received:G.parsedType}),o4}let Y=new JJ,X=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(J.data.length<G.value)X=this._getOrReturnCtx(J,X),r6(X,{code:z6.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Y.dirty()}else if(G.kind==="max"){if(J.data.length>G.value)X=this._getOrReturnCtx(J,X),r6(X,{code:z6.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Y.dirty()}else if(G.kind==="length"){let Z=J.data.length>G.value,q=J.data.length<G.value;if(Z||q){if(X=this._getOrReturnCtx(J,X),Z)r6(X,{code:z6.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(q)r6(X,{code:z6.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});Y.dirty()}}else if(G.kind==="email"){if(!RQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"email",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="emoji"){if(!AZ1)AZ1=new RegExp(CQ4,"u");if(!AZ1.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"emoji",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="uuid"){if(!EQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"uuid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="nanoid"){if(!IQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"nanoid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid"){if(!AQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"cuid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cuid2"){if(!OQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"cuid2",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ulid"){if(!wQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"ulid",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="url")try{new URL(J.data)}catch{X=this._getOrReturnCtx(J,X),r6(X,{validation:"url",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="regex"){if(G.regex.lastIndex=0,!G.regex.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"regex",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="trim")J.data=J.data.trim();else if(G.kind==="includes"){if(!J.data.includes(G.value,G.position))X=this._getOrReturnCtx(J,X),r6(X,{code:z6.invalid_string,validation:{includes:G.value,position:G.position},message:G.message}),Y.dirty()}else if(G.kind==="toLowerCase")J.data=J.data.toLowerCase();else if(G.kind==="toUpperCase")J.data=J.data.toUpperCase();else if(G.kind==="startsWith"){if(!J.data.startsWith(G.value))X=this._getOrReturnCtx(J,X),r6(X,{code:z6.invalid_string,validation:{startsWith:G.value},message:G.message}),Y.dirty()}else if(G.kind==="endsWith"){if(!J.data.endsWith(G.value))X=this._getOrReturnCtx(J,X),r6(X,{code:z6.invalid_string,validation:{endsWith:G.value},message:G.message}),Y.dirty()}else if(G.kind==="datetime"){if(!NF0(G).test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{code:z6.invalid_string,validation:"datetime",message:G.message}),Y.dirty()}else if(G.kind==="date"){if(!vQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{code:z6.invalid_string,validation:"date",message:G.message}),Y.dirty()}else if(G.kind==="time"){if(!fQ4(G).test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{code:z6.invalid_string,validation:"time",message:G.message}),Y.dirty()}else if(G.kind==="duration"){if(!TQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"duration",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="ip"){if(!hQ4(J.data,G.version))X=this._getOrReturnCtx(J,X),r6(X,{validation:"ip",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="jwt"){if(!bQ4(J.data,G.alg))X=this._getOrReturnCtx(J,X),r6(X,{validation:"jwt",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="cidr"){if(!gQ4(J.data,G.version))X=this._getOrReturnCtx(J,X),r6(X,{validation:"cidr",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64"){if(!yQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"base64",code:z6.invalid_string,message:G.message}),Y.dirty()}else if(G.kind==="base64url"){if(!xQ4.test(J.data))X=this._getOrReturnCtx(J,X),r6(X,{validation:"base64url",code:z6.invalid_string,message:G.message}),Y.dirty()}else N9.assertNever(G);return{status:Y.value,value:J.data}}_regex(J,Q,Y){return this.refinement((X)=>J.test(X),{validation:Q,code:z6.invalid_string,...M4.errToObj(Y)})}_addCheck(J){return new O$({...this._def,checks:[...this._def.checks,J]})}email(J){return this._addCheck({kind:"email",...M4.errToObj(J)})}url(J){return this._addCheck({kind:"url",...M4.errToObj(J)})}emoji(J){return this._addCheck({kind:"emoji",...M4.errToObj(J)})}uuid(J){return this._addCheck({kind:"uuid",...M4.errToObj(J)})}nanoid(J){return this._addCheck({kind:"nanoid",...M4.errToObj(J)})}cuid(J){return this._addCheck({kind:"cuid",...M4.errToObj(J)})}cuid2(J){return this._addCheck({kind:"cuid2",...M4.errToObj(J)})}ulid(J){return this._addCheck({kind:"ulid",...M4.errToObj(J)})}base64(J){return this._addCheck({kind:"base64",...M4.errToObj(J)})}base64url(J){return this._addCheck({kind:"base64url",...M4.errToObj(J)})}jwt(J){return this._addCheck({kind:"jwt",...M4.errToObj(J)})}ip(J){return this._addCheck({kind:"ip",...M4.errToObj(J)})}cidr(J){return this._addCheck({kind:"cidr",...M4.errToObj(J)})}datetime(J){if(typeof J==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:J});return this._addCheck({kind:"datetime",precision:typeof J?.precision>"u"?null:J?.precision,offset:J?.offset??!1,local:J?.local??!1,...M4.errToObj(J?.message)})}date(J){return this._addCheck({kind:"date",message:J})}time(J){if(typeof J==="string")return this._addCheck({kind:"time",precision:null,message:J});return this._addCheck({kind:"time",precision:typeof J?.precision>"u"?null:J?.precision,...M4.errToObj(J?.message)})}duration(J){return this._addCheck({kind:"duration",...M4.errToObj(J)})}regex(J,Q){return this._addCheck({kind:"regex",regex:J,...M4.errToObj(Q)})}includes(J,Q){return this._addCheck({kind:"includes",value:J,position:Q?.position,...M4.errToObj(Q?.message)})}startsWith(J,Q){return this._addCheck({kind:"startsWith",value:J,...M4.errToObj(Q)})}endsWith(J,Q){return this._addCheck({kind:"endsWith",value:J,...M4.errToObj(Q)})}min(J,Q){return this._addCheck({kind:"min",value:J,...M4.errToObj(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J,...M4.errToObj(Q)})}length(J,Q){return this._addCheck({kind:"length",value:J,...M4.errToObj(Q)})}nonempty(J){return this.min(1,M4.errToObj(J))}trim(){return new O$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new O$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new O$({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((J)=>J.kind==="datetime")}get isDate(){return!!this._def.checks.find((J)=>J.kind==="date")}get isTime(){return!!this._def.checks.find((J)=>J.kind==="time")}get isDuration(){return!!this._def.checks.find((J)=>J.kind==="duration")}get isEmail(){return!!this._def.checks.find((J)=>J.kind==="email")}get isURL(){return!!this._def.checks.find((J)=>J.kind==="url")}get isEmoji(){return!!this._def.checks.find((J)=>J.kind==="emoji")}get isUUID(){return!!this._def.checks.find((J)=>J.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((J)=>J.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((J)=>J.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((J)=>J.kind==="cuid2")}get isULID(){return!!this._def.checks.find((J)=>J.kind==="ulid")}get isIP(){return!!this._def.checks.find((J)=>J.kind==="ip")}get isCIDR(){return!!this._def.checks.find((J)=>J.kind==="cidr")}get isBase64(){return!!this._def.checks.find((J)=>J.kind==="base64")}get isBase64url(){return!!this._def.checks.find((J)=>J.kind==="base64url")}get minLength(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxLength(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}};O$.create=(J)=>{return new O$({checks:[],typeName:$8.ZodString,coerce:J?.coerce??!1,...S8(J)})};hF=class hF extends o8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(J){if(this._def.coerce)J.data=Number(J.data);if(this._getType(J)!==x6.number){let G=this._getOrReturnCtx(J);return r6(G,{code:z6.invalid_type,expected:x6.number,received:G.parsedType}),o4}let Y=void 0,X=new JJ;for(let G of this._def.checks)if(G.kind==="int"){if(!N9.isInteger(J.data))Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.invalid_type,expected:"integer",received:"float",message:G.message}),X.dirty()}else if(G.kind==="min"){if(G.inclusive?J.data<G.value:J.data<=G.value)Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.too_small,minimum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),X.dirty()}else if(G.kind==="max"){if(G.inclusive?J.data>G.value:J.data>=G.value)Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),X.dirty()}else if(G.kind==="multipleOf"){if(mQ4(J.data,G.value)!==0)Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.not_multiple_of,multipleOf:G.value,message:G.message}),X.dirty()}else if(G.kind==="finite"){if(!Number.isFinite(J.data))Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.not_finite,message:G.message}),X.dirty()}else N9.assertNever(G);return{status:X.value,value:J.data}}gte(J,Q){return this.setLimit("min",J,!0,M4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,M4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,M4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,M4.toString(Q))}setLimit(J,Q,Y,X){return new hF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:M4.toString(X)}]})}_addCheck(J){return new hF({...this._def,checks:[...this._def.checks,J]})}int(J){return this._addCheck({kind:"int",message:M4.toString(J)})}positive(J){return this._addCheck({kind:"min",value:0,inclusive:!1,message:M4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:0,inclusive:!1,message:M4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:0,inclusive:!0,message:M4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:0,inclusive:!0,message:M4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:M4.toString(Q)})}finite(J){return this._addCheck({kind:"finite",message:M4.toString(J)})}safe(J){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:M4.toString(J)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:M4.toString(J)})}get minValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}get isInt(){return!!this._def.checks.find((J)=>J.kind==="int"||J.kind==="multipleOf"&&N9.isInteger(J.value))}get isFinite(){let J=null,Q=null;for(let Y of this._def.checks)if(Y.kind==="finite"||Y.kind==="int"||Y.kind==="multipleOf")return!0;else if(Y.kind==="min"){if(Q===null||Y.value>Q)Q=Y.value}else if(Y.kind==="max"){if(J===null||Y.value<J)J=Y.value}return Number.isFinite(Q)&&Number.isFinite(J)}};hF.create=(J)=>{return new hF({checks:[],typeName:$8.ZodNumber,coerce:J?.coerce||!1,...S8(J)})};bF=class bF extends o8{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(J){if(this._def.coerce)try{J.data=BigInt(J.data)}catch{return this._getInvalidInput(J)}if(this._getType(J)!==x6.bigint)return this._getInvalidInput(J);let Y=void 0,X=new JJ;for(let G of this._def.checks)if(G.kind==="min"){if(G.inclusive?J.data<G.value:J.data<=G.value)Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.too_small,type:"bigint",minimum:G.value,inclusive:G.inclusive,message:G.message}),X.dirty()}else if(G.kind==="max"){if(G.inclusive?J.data>G.value:J.data>=G.value)Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.too_big,type:"bigint",maximum:G.value,inclusive:G.inclusive,message:G.message}),X.dirty()}else if(G.kind==="multipleOf"){if(J.data%G.value!==BigInt(0))Y=this._getOrReturnCtx(J,Y),r6(Y,{code:z6.not_multiple_of,multipleOf:G.value,message:G.message}),X.dirty()}else N9.assertNever(G);return{status:X.value,value:J.data}}_getInvalidInput(J){let Q=this._getOrReturnCtx(J);return r6(Q,{code:z6.invalid_type,expected:x6.bigint,received:Q.parsedType}),o4}gte(J,Q){return this.setLimit("min",J,!0,M4.toString(Q))}gt(J,Q){return this.setLimit("min",J,!1,M4.toString(Q))}lte(J,Q){return this.setLimit("max",J,!0,M4.toString(Q))}lt(J,Q){return this.setLimit("max",J,!1,M4.toString(Q))}setLimit(J,Q,Y,X){return new bF({...this._def,checks:[...this._def.checks,{kind:J,value:Q,inclusive:Y,message:M4.toString(X)}]})}_addCheck(J){return new bF({...this._def,checks:[...this._def.checks,J]})}positive(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:M4.toString(J)})}negative(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:M4.toString(J)})}nonpositive(J){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:M4.toString(J)})}nonnegative(J){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:M4.toString(J)})}multipleOf(J,Q){return this._addCheck({kind:"multipleOf",value:J,message:M4.toString(Q)})}get minValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J}get maxValue(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J}};bF.create=(J)=>{return new bF({checks:[],typeName:$8.ZodBigInt,coerce:J?.coerce??!1,...S8(J)})};OE=class OE extends o8{_parse(J){if(this._def.coerce)J.data=Boolean(J.data);if(this._getType(J)!==x6.boolean){let Y=this._getOrReturnCtx(J);return r6(Y,{code:z6.invalid_type,expected:x6.boolean,received:Y.parsedType}),o4}return cJ(J.data)}};OE.create=(J)=>{return new OE({typeName:$8.ZodBoolean,coerce:J?.coerce||!1,...S8(J)})};tD=class tD extends o8{_parse(J){if(this._def.coerce)J.data=new Date(J.data);if(this._getType(J)!==x6.date){let G=this._getOrReturnCtx(J);return r6(G,{code:z6.invalid_type,expected:x6.date,received:G.parsedType}),o4}if(Number.isNaN(J.data.getTime())){let G=this._getOrReturnCtx(J);return r6(G,{code:z6.invalid_date}),o4}let Y=new JJ,X=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(J.data.getTime()<G.value)X=this._getOrReturnCtx(J,X),r6(X,{code:z6.too_small,message:G.message,inclusive:!0,exact:!1,minimum:G.value,type:"date"}),Y.dirty()}else if(G.kind==="max"){if(J.data.getTime()>G.value)X=this._getOrReturnCtx(J,X),r6(X,{code:z6.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),Y.dirty()}else N9.assertNever(G);return{status:Y.value,value:new Date(J.data.getTime())}}_addCheck(J){return new tD({...this._def,checks:[...this._def.checks,J]})}min(J,Q){return this._addCheck({kind:"min",value:J.getTime(),message:M4.toString(Q)})}max(J,Q){return this._addCheck({kind:"max",value:J.getTime(),message:M4.toString(Q)})}get minDate(){let J=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}return J!=null?new Date(J):null}get maxDate(){let J=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(J===null||Q.value<J)J=Q.value}return J!=null?new Date(J):null}};tD.create=(J)=>{return new tD({checks:[],coerce:J?.coerce||!1,typeName:$8.ZodDate,...S8(J)})};t_=class t_ extends o8{_parse(J){if(this._getType(J)!==x6.symbol){let Y=this._getOrReturnCtx(J);return r6(Y,{code:z6.invalid_type,expected:x6.symbol,received:Y.parsedType}),o4}return cJ(J.data)}};t_.create=(J)=>{return new t_({typeName:$8.ZodSymbol,...S8(J)})};wE=class wE extends o8{_parse(J){if(this._getType(J)!==x6.undefined){let Y=this._getOrReturnCtx(J);return r6(Y,{code:z6.invalid_type,expected:x6.undefined,received:Y.parsedType}),o4}return cJ(J.data)}};wE.create=(J)=>{return new wE({typeName:$8.ZodUndefined,...S8(J)})};EE=class EE extends o8{_parse(J){if(this._getType(J)!==x6.null){let Y=this._getOrReturnCtx(J);return r6(Y,{code:z6.invalid_type,expected:x6.null,received:Y.parsedType}),o4}return cJ(J.data)}};EE.create=(J)=>{return new EE({typeName:$8.ZodNull,...S8(J)})};eD=class eD extends o8{constructor(){super(...arguments);this._any=!0}_parse(J){return cJ(J.data)}};eD.create=(J)=>{return new eD({typeName:$8.ZodAny,...S8(J)})};fF=class fF extends o8{constructor(){super(...arguments);this._unknown=!0}_parse(J){return cJ(J.data)}};fF.create=(J)=>{return new fF({typeName:$8.ZodUnknown,...S8(J)})};wV=class wV extends o8{_parse(J){let Q=this._getOrReturnCtx(J);return r6(Q,{code:z6.invalid_type,expected:x6.never,received:Q.parsedType}),o4}};wV.create=(J)=>{return new wV({typeName:$8.ZodNever,...S8(J)})};e_=class e_ extends o8{_parse(J){if(this._getType(J)!==x6.undefined){let Y=this._getOrReturnCtx(J);return r6(Y,{code:z6.invalid_type,expected:x6.void,received:Y.parsedType}),o4}return cJ(J.data)}};e_.create=(J)=>{return new e_({typeName:$8.ZodVoid,...S8(J)})};w$=class w$ extends o8{_parse(J){let{ctx:Q,status:Y}=this._processInputParams(J),X=this._def;if(Q.parsedType!==x6.array)return r6(Q,{code:z6.invalid_type,expected:x6.array,received:Q.parsedType}),o4;if(X.exactLength!==null){let Z=Q.data.length>X.exactLength.value,q=Q.data.length<X.exactLength.value;if(Z||q)r6(Q,{code:Z?z6.too_big:z6.too_small,minimum:q?X.exactLength.value:void 0,maximum:Z?X.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:X.exactLength.message}),Y.dirty()}if(X.minLength!==null){if(Q.data.length<X.minLength.value)r6(Q,{code:z6.too_small,minimum:X.minLength.value,type:"array",inclusive:!0,exact:!1,message:X.minLength.message}),Y.dirty()}if(X.maxLength!==null){if(Q.data.length>X.maxLength.value)r6(Q,{code:z6.too_big,maximum:X.maxLength.value,type:"array",inclusive:!0,exact:!1,message:X.maxLength.message}),Y.dirty()}if(Q.common.async)return Promise.all([...Q.data].map((Z,q)=>{return X.type._parseAsync(new I$(Q,Z,Q.path,q))})).then((Z)=>{return JJ.mergeArray(Y,Z)});let G=[...Q.data].map((Z,q)=>{return X.type._parseSync(new I$(Q,Z,Q.path,q))});return JJ.mergeArray(Y,G)}get element(){return this._def.type}min(J,Q){return new w$({...this._def,minLength:{value:J,message:M4.toString(Q)}})}max(J,Q){return new w$({...this._def,maxLength:{value:J,message:M4.toString(Q)}})}length(J,Q){return new w$({...this._def,exactLength:{value:J,message:M4.toString(Q)}})}nonempty(J){return this.min(1,J)}};w$.create=(J,Q)=>{return new w$({type:J,minLength:null,maxLength:null,exactLength:null,typeName:$8.ZodArray,...S8(Q)})};j7=class j7 extends o8{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let J=this._def.shape(),Q=N9.objectKeys(J);return this._cached={shape:J,keys:Q},this._cached}_parse(J){if(this._getType(J)!==x6.object){let K=this._getOrReturnCtx(J);return r6(K,{code:z6.invalid_type,expected:x6.object,received:K.parsedType}),o4}let{status:Y,ctx:X}=this._processInputParams(J),{shape:G,keys:Z}=this._getCached(),q=[];if(!(this._def.catchall instanceof wV&&this._def.unknownKeys==="strip")){for(let K in X.data)if(!Z.includes(K))q.push(K)}let V=[];for(let K of Z){let W=G[K],H=X.data[K];V.push({key:{status:"valid",value:K},value:W._parse(new I$(X,H,X.path,K)),alwaysSet:K in X.data})}if(this._def.catchall instanceof wV){let K=this._def.unknownKeys;if(K==="passthrough")for(let W of q)V.push({key:{status:"valid",value:W},value:{status:"valid",value:X.data[W]}});else if(K==="strict"){if(q.length>0)r6(X,{code:z6.unrecognized_keys,keys:q}),Y.dirty()}else if(K==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let K=this._def.catchall;for(let W of q){let H=X.data[W];V.push({key:{status:"valid",value:W},value:K._parse(new I$(X,H,X.path,W)),alwaysSet:W in X.data})}}if(X.common.async)return Promise.resolve().then(async()=>{let K=[];for(let W of V){let H=await W.key,z=await W.value;K.push({key:H,value:z,alwaysSet:W.alwaysSet})}return K}).then((K)=>{return JJ.mergeObjectSync(Y,K)});else return JJ.mergeObjectSync(Y,V)}get shape(){return this._def.shape()}strict(J){return M4.errToObj,new j7({...this._def,unknownKeys:"strict",...J!==void 0?{errorMap:(Q,Y)=>{let X=this._def.errorMap?.(Q,Y).message??Y.defaultError;if(Q.code==="unrecognized_keys")return{message:M4.errToObj(J).message??X};return{message:X}}}:{}})}strip(){return new j7({...this._def,unknownKeys:"strip"})}passthrough(){return new j7({...this._def,unknownKeys:"passthrough"})}extend(J){return new j7({...this._def,shape:()=>({...this._def.shape(),...J})})}merge(J){return new j7({unknownKeys:J._def.unknownKeys,catchall:J._def.catchall,shape:()=>({...this._def.shape(),...J._def.shape()}),typeName:$8.ZodObject})}setKey(J,Q){return this.augment({[J]:Q})}catchall(J){return new j7({...this._def,catchall:J})}pick(J){let Q={};for(let Y of N9.objectKeys(J))if(J[Y]&&this.shape[Y])Q[Y]=this.shape[Y];return new j7({...this._def,shape:()=>Q})}omit(J){let Q={};for(let Y of N9.objectKeys(this.shape))if(!J[Y])Q[Y]=this.shape[Y];return new j7({...this._def,shape:()=>Q})}deepPartial(){return LE(this)}partial(J){let Q={};for(let Y of N9.objectKeys(this.shape)){let X=this.shape[Y];if(J&&!J[Y])Q[Y]=X;else Q[Y]=X.optional()}return new j7({...this._def,shape:()=>Q})}required(J){let Q={};for(let Y of N9.objectKeys(this.shape))if(J&&!J[Y])Q[Y]=this.shape[Y];else{let G=this.shape[Y];while(G instanceof E$)G=G._def.innerType;Q[Y]=G}return new j7({...this._def,shape:()=>Q})}keyof(){return DF0(N9.objectKeys(this.shape))}};j7.create=(J,Q)=>{return new j7({shape:()=>J,unknownKeys:"strip",catchall:wV.create(),typeName:$8.ZodObject,...S8(Q)})};j7.strictCreate=(J,Q)=>{return new j7({shape:()=>J,unknownKeys:"strict",catchall:wV.create(),typeName:$8.ZodObject,...S8(Q)})};j7.lazycreate=(J,Q)=>{return new j7({shape:J,unknownKeys:"strip",catchall:wV.create(),typeName:$8.ZodObject,...S8(Q)})};IE=class IE extends o8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=this._def.options;function X(G){for(let q of G)if(q.result.status==="valid")return q.result;for(let q of G)if(q.result.status==="dirty")return Q.common.issues.push(...q.ctx.common.issues),q.result;let Z=G.map((q)=>new WY(q.ctx.common.issues));return r6(Q,{code:z6.invalid_union,unionErrors:Z}),o4}if(Q.common.async)return Promise.all(Y.map(async(G)=>{let Z={...Q,common:{...Q.common,issues:[]},parent:null};return{result:await G._parseAsync({data:Q.data,path:Q.path,parent:Z}),ctx:Z}})).then(X);else{let G=void 0,Z=[];for(let V of Y){let K={...Q,common:{...Q.common,issues:[]},parent:null},W=V._parseSync({data:Q.data,path:Q.path,parent:K});if(W.status==="valid")return W;else if(W.status==="dirty"&&!G)G={result:W,ctx:K};if(K.common.issues.length)Z.push(K.common.issues)}if(G)return Q.common.issues.push(...G.ctx.common.issues),G.result;let q=Z.map((V)=>new WY(V));return r6(Q,{code:z6.invalid_union,unionErrors:q}),o4}}get options(){return this._def.options}};IE.create=(J,Q)=>{return new IE({options:J,typeName:$8.ZodUnion,...S8(Q)})};Ml=class Ml extends o8{_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==x6.object)return r6(Q,{code:z6.invalid_type,expected:x6.object,received:Q.parsedType}),o4;let Y=this.discriminator,X=Q.data[Y],G=this.optionsMap.get(X);if(!G)return r6(Q,{code:z6.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Y]}),o4;if(Q.common.async)return G._parseAsync({data:Q.data,path:Q.path,parent:Q});else return G._parseSync({data:Q.data,path:Q.path,parent:Q})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(J,Q,Y){let X=new Map;for(let G of Q){let Z=vW(G.shape[J]);if(!Z.length)throw Error(`A discriminator value for key \`${J}\` could not be extracted from all schema options`);for(let q of Z){if(X.has(q))throw Error(`Discriminator property ${String(J)} has duplicate value ${String(q)}`);X.set(q,G)}}return new Ml({typeName:$8.ZodDiscriminatedUnion,discriminator:J,options:Q,optionsMap:X,...S8(Y)})}};PE=class PE extends o8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J),X=(G,Z)=>{if(Nl(G)||Nl(Z))return o4;let q=OZ1(G.value,Z.value);if(!q.valid)return r6(Y,{code:z6.invalid_intersection_types}),o4;if(Dl(G)||Dl(Z))Q.dirty();return{status:Q.value,value:q.data}};if(Y.common.async)return Promise.all([this._def.left._parseAsync({data:Y.data,path:Y.path,parent:Y}),this._def.right._parseAsync({data:Y.data,path:Y.path,parent:Y})]).then(([G,Z])=>X(G,Z));else return X(this._def.left._parseSync({data:Y.data,path:Y.path,parent:Y}),this._def.right._parseSync({data:Y.data,path:Y.path,parent:Y}))}};PE.create=(J,Q,Y)=>{return new PE({left:J,right:Q,typeName:$8.ZodIntersection,...S8(Y)})};EV=class EV extends o8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==x6.array)return r6(Y,{code:z6.invalid_type,expected:x6.array,received:Y.parsedType}),o4;if(Y.data.length<this._def.items.length)return r6(Y,{code:z6.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),o4;if(!this._def.rest&&Y.data.length>this._def.items.length)r6(Y,{code:z6.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q.dirty();let G=[...Y.data].map((Z,q)=>{let V=this._def.items[q]||this._def.rest;if(!V)return null;return V._parse(new I$(Y,Z,Y.path,q))}).filter((Z)=>!!Z);if(Y.common.async)return Promise.all(G).then((Z)=>{return JJ.mergeArray(Q,Z)});else return JJ.mergeArray(Q,G)}get items(){return this._def.items}rest(J){return new EV({...this._def,rest:J})}};EV.create=(J,Q)=>{if(!Array.isArray(J))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new EV({items:J,typeName:$8.ZodTuple,rest:null,...S8(Q)})};Jk=class Jk extends o8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==x6.object)return r6(Y,{code:z6.invalid_type,expected:x6.object,received:Y.parsedType}),o4;let X=[],G=this._def.keyType,Z=this._def.valueType;for(let q in Y.data)X.push({key:G._parse(new I$(Y,q,Y.path,q)),value:Z._parse(new I$(Y,Y.data[q],Y.path,q)),alwaysSet:q in Y.data});if(Y.common.async)return JJ.mergeObjectAsync(Q,X);else return JJ.mergeObjectSync(Q,X)}get element(){return this._def.valueType}static create(J,Q,Y){if(Q instanceof o8)return new Jk({keyType:J,valueType:Q,typeName:$8.ZodRecord,...S8(Y)});return new Jk({keyType:O$.create(),valueType:J,typeName:$8.ZodRecord,...S8(Q)})}};Qk=class Qk extends o8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==x6.map)return r6(Y,{code:z6.invalid_type,expected:x6.map,received:Y.parsedType}),o4;let X=this._def.keyType,G=this._def.valueType,Z=[...Y.data.entries()].map(([q,V],K)=>{return{key:X._parse(new I$(Y,q,Y.path,[K,"key"])),value:G._parse(new I$(Y,V,Y.path,[K,"value"]))}});if(Y.common.async){let q=new Map;return Promise.resolve().then(async()=>{for(let V of Z){let K=await V.key,W=await V.value;if(K.status==="aborted"||W.status==="aborted")return o4;if(K.status==="dirty"||W.status==="dirty")Q.dirty();q.set(K.value,W.value)}return{status:Q.value,value:q}})}else{let q=new Map;for(let V of Z){let{key:K,value:W}=V;if(K.status==="aborted"||W.status==="aborted")return o4;if(K.status==="dirty"||W.status==="dirty")Q.dirty();q.set(K.value,W.value)}return{status:Q.value,value:q}}}};Qk.create=(J,Q,Y)=>{return new Qk({valueType:Q,keyType:J,typeName:$8.ZodMap,...S8(Y)})};JM=class JM extends o8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.parsedType!==x6.set)return r6(Y,{code:z6.invalid_type,expected:x6.set,received:Y.parsedType}),o4;let X=this._def;if(X.minSize!==null){if(Y.data.size<X.minSize.value)r6(Y,{code:z6.too_small,minimum:X.minSize.value,type:"set",inclusive:!0,exact:!1,message:X.minSize.message}),Q.dirty()}if(X.maxSize!==null){if(Y.data.size>X.maxSize.value)r6(Y,{code:z6.too_big,maximum:X.maxSize.value,type:"set",inclusive:!0,exact:!1,message:X.maxSize.message}),Q.dirty()}let G=this._def.valueType;function Z(V){let K=new Set;for(let W of V){if(W.status==="aborted")return o4;if(W.status==="dirty")Q.dirty();K.add(W.value)}return{status:Q.value,value:K}}let q=[...Y.data.values()].map((V,K)=>G._parse(new I$(Y,V,Y.path,K)));if(Y.common.async)return Promise.all(q).then((V)=>Z(V));else return Z(q)}min(J,Q){return new JM({...this._def,minSize:{value:J,message:M4.toString(Q)}})}max(J,Q){return new JM({...this._def,maxSize:{value:J,message:M4.toString(Q)}})}size(J,Q){return this.min(J,Q).max(J,Q)}nonempty(J){return this.min(1,J)}};JM.create=(J,Q)=>{return new JM({valueType:J,minSize:null,maxSize:null,typeName:$8.ZodSet,...S8(Q)})};AE=class AE extends o8{constructor(){super(...arguments);this.validate=this.implement}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==x6.function)return r6(Q,{code:z6.invalid_type,expected:x6.function,received:Q.parsedType}),o4;function Y(q,V){return s_({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,DE(),xW].filter((K)=>!!K),issueData:{code:z6.invalid_arguments,argumentsError:V}})}function X(q,V){return s_({data:q,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,DE(),xW].filter((K)=>!!K),issueData:{code:z6.invalid_return_type,returnTypeError:V}})}let G={errorMap:Q.common.contextualErrorMap},Z=Q.data;if(this._def.returns instanceof QM){let q=this;return cJ(async function(...V){let K=new WY([]),W=await q._def.args.parseAsync(V,G).catch((U)=>{throw K.addIssue(Y(V,U)),K}),H=await Reflect.apply(Z,this,W);return await q._def.returns._def.type.parseAsync(H,G).catch((U)=>{throw K.addIssue(X(H,U)),K})})}else{let q=this;return cJ(function(...V){let K=q._def.args.safeParse(V,G);if(!K.success)throw new WY([Y(V,K.error)]);let W=Reflect.apply(Z,this,K.data),H=q._def.returns.safeParse(W,G);if(!H.success)throw new WY([X(W,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...J){return new AE({...this._def,args:EV.create(J).rest(fF.create())})}returns(J){return new AE({...this._def,returns:J})}implement(J){return this.parse(J)}strictImplement(J){return this.parse(J)}static create(J,Q,Y){return new AE({args:J?J:EV.create([]).rest(fF.create()),returns:Q||fF.create(),typeName:$8.ZodFunction,...S8(Y)})}};TE=class TE extends o8{get schema(){return this._def.getter()}_parse(J){let{ctx:Q}=this._processInputParams(J);return this._def.getter()._parse({data:Q.data,path:Q.path,parent:Q})}};TE.create=(J,Q)=>{return new TE({getter:J,typeName:$8.ZodLazy,...S8(Q)})};RE=class RE extends o8{_parse(J){if(J.data!==this._def.value){let Q=this._getOrReturnCtx(J);return r6(Q,{received:Q.data,code:z6.invalid_literal,expected:this._def.value}),o4}return{status:"valid",value:J.data}}get value(){return this._def.value}};RE.create=(J,Q)=>{return new RE({value:J,typeName:$8.ZodLiteral,...S8(Q)})};gF=class gF extends o8{_parse(J){if(typeof J.data!=="string"){let Q=this._getOrReturnCtx(J),Y=this._def.values;return r6(Q,{expected:N9.joinValues(Y),received:Q.parsedType,code:z6.invalid_type}),o4}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(J.data)){let Q=this._getOrReturnCtx(J),Y=this._def.values;return r6(Q,{received:Q.data,code:z6.invalid_enum_value,options:Y}),o4}return cJ(J.data)}get options(){return this._def.values}get enum(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}get Values(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}get Enum(){let J={};for(let Q of this._def.values)J[Q]=Q;return J}extract(J,Q=this._def){return gF.create(J,{...this._def,...Q})}exclude(J,Q=this._def){return gF.create(this.options.filter((Y)=>!J.includes(Y)),{...this._def,...Q})}};gF.create=DF0;CE=class CE extends o8{_parse(J){let Q=N9.getValidEnumValues(this._def.values),Y=this._getOrReturnCtx(J);if(Y.parsedType!==x6.string&&Y.parsedType!==x6.number){let X=N9.objectValues(Q);return r6(Y,{expected:N9.joinValues(X),received:Y.parsedType,code:z6.invalid_type}),o4}if(!this._cache)this._cache=new Set(N9.getValidEnumValues(this._def.values));if(!this._cache.has(J.data)){let X=N9.objectValues(Q);return r6(Y,{received:Y.data,code:z6.invalid_enum_value,options:X}),o4}return cJ(J.data)}get enum(){return this._def.values}};CE.create=(J,Q)=>{return new CE({values:J,typeName:$8.ZodNativeEnum,...S8(Q)})};QM=class QM extends o8{unwrap(){return this._def.type}_parse(J){let{ctx:Q}=this._processInputParams(J);if(Q.parsedType!==x6.promise&&Q.common.async===!1)return r6(Q,{code:z6.invalid_type,expected:x6.promise,received:Q.parsedType}),o4;let Y=Q.parsedType===x6.promise?Q.data:Promise.resolve(Q.data);return cJ(Y.then((X)=>{return this._def.type.parseAsync(X,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}};QM.create=(J,Q)=>{return new QM({type:J,typeName:$8.ZodPromise,...S8(Q)})};P$=class P$ extends o8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$8.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J),X=this._def.effect||null,G={addIssue:(Z)=>{if(r6(Y,Z),Z.fatal)Q.abort();else Q.dirty()},get path(){return Y.path}};if(G.addIssue=G.addIssue.bind(G),X.type==="preprocess"){let Z=X.transform(Y.data,G);if(Y.common.async)return Promise.resolve(Z).then(async(q)=>{if(Q.value==="aborted")return o4;let V=await this._def.schema._parseAsync({data:q,path:Y.path,parent:Y});if(V.status==="aborted")return o4;if(V.status==="dirty")return sD(V.value);if(Q.value==="dirty")return sD(V.value);return V});else{if(Q.value==="aborted")return o4;let q=this._def.schema._parseSync({data:Z,path:Y.path,parent:Y});if(q.status==="aborted")return o4;if(q.status==="dirty")return sD(q.value);if(Q.value==="dirty")return sD(q.value);return q}}if(X.type==="refinement"){let Z=(q)=>{let V=X.refinement(q,G);if(Y.common.async)return Promise.resolve(V);if(V instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return q};if(Y.common.async===!1){let q=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(q.status==="aborted")return o4;if(q.status==="dirty")Q.dirty();return Z(q.value),{status:Q.value,value:q.value}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((q)=>{if(q.status==="aborted")return o4;if(q.status==="dirty")Q.dirty();return Z(q.value).then(()=>{return{status:Q.value,value:q.value}})})}if(X.type==="transform")if(Y.common.async===!1){let Z=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(!vF(Z))return o4;let q=X.transform(Z.value,G);if(q instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Q.value,value:q}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((Z)=>{if(!vF(Z))return o4;return Promise.resolve(X.transform(Z.value,G)).then((q)=>({status:Q.value,value:q}))});N9.assertNever(X)}};P$.create=(J,Q,Y)=>{return new P$({schema:J,typeName:$8.ZodEffects,effect:Q,...S8(Y)})};P$.createWithPreprocess=(J,Q,Y)=>{return new P$({schema:Q,effect:{type:"preprocess",transform:J},typeName:$8.ZodEffects,...S8(Y)})};E$=class E$ extends o8{_parse(J){if(this._getType(J)===x6.undefined)return cJ(void 0);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};E$.create=(J,Q)=>{return new E$({innerType:J,typeName:$8.ZodOptional,...S8(Q)})};fW=class fW extends o8{_parse(J){if(this._getType(J)===x6.null)return cJ(null);return this._def.innerType._parse(J)}unwrap(){return this._def.innerType}};fW.create=(J,Q)=>{return new fW({innerType:J,typeName:$8.ZodNullable,...S8(Q)})};jE=class jE extends o8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=Q.data;if(Q.parsedType===x6.undefined)Y=this._def.defaultValue();return this._def.innerType._parse({data:Y,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}};jE.create=(J,Q)=>{return new jE({innerType:J,typeName:$8.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...S8(Q)})};SE=class SE extends o8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y={...Q,common:{...Q.common,issues:[]}},X=this._def.innerType._parse({data:Y.data,path:Y.path,parent:{...Y}});if(ME(X))return X.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new WY(Y.common.issues)},input:Y.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new WY(Y.common.issues)},input:Y.data})}}removeCatch(){return this._def.innerType}};SE.create=(J,Q)=>{return new SE({innerType:J,typeName:$8.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...S8(Q)})};Yk=class Yk extends o8{_parse(J){if(this._getType(J)!==x6.nan){let Y=this._getOrReturnCtx(J);return r6(Y,{code:z6.invalid_type,expected:x6.nan,received:Y.parsedType}),o4}return{status:"valid",value:J.data}}};Yk.create=(J)=>{return new Yk({typeName:$8.ZodNaN,...S8(J)})};uQ4=Symbol("zod_brand");Ll=class Ll extends o8{_parse(J){let{ctx:Q}=this._processInputParams(J),Y=Q.data;return this._def.type._parse({data:Y,path:Q.path,parent:Q})}unwrap(){return this._def.type}};Xk=class Xk extends o8{_parse(J){let{status:Q,ctx:Y}=this._processInputParams(J);if(Y.common.async)return(async()=>{let G=await this._def.in._parseAsync({data:Y.data,path:Y.path,parent:Y});if(G.status==="aborted")return o4;if(G.status==="dirty")return Q.dirty(),sD(G.value);else return this._def.out._parseAsync({data:G.value,path:Y.path,parent:Y})})();else{let X=this._def.in._parseSync({data:Y.data,path:Y.path,parent:Y});if(X.status==="aborted")return o4;if(X.status==="dirty")return Q.dirty(),{status:"dirty",value:X.value};else return this._def.out._parseSync({data:X.value,path:Y.path,parent:Y})}}static create(J,Q){return new Xk({in:J,out:Q,typeName:$8.ZodPipeline})}};_E=class _E extends o8{_parse(J){let Q=this._def.innerType._parse(J),Y=(X)=>{if(vF(X))X.value=Object.freeze(X.value);return X};return ME(Q)?Q.then((X)=>Y(X)):Y(Q)}unwrap(){return this._def.innerType}};_E.create=(J,Q)=>{return new _E({innerType:J,typeName:$8.ZodReadonly,...S8(Q)})};pQ4={object:j7.lazycreate};(function(J){J.ZodString="ZodString",J.ZodNumber="ZodNumber",J.ZodNaN="ZodNaN",J.ZodBigInt="ZodBigInt",J.ZodBoolean="ZodBoolean",J.ZodDate="ZodDate",J.ZodSymbol="ZodSymbol",J.ZodUndefined="ZodUndefined",J.ZodNull="ZodNull",J.ZodAny="ZodAny",J.ZodUnknown="ZodUnknown",J.ZodNever="ZodNever",J.ZodVoid="ZodVoid",J.ZodArray="ZodArray",J.ZodObject="ZodObject",J.ZodUnion="ZodUnion",J.ZodDiscriminatedUnion="ZodDiscriminatedUnion",J.ZodIntersection="ZodIntersection",J.ZodTuple="ZodTuple",J.ZodRecord="ZodRecord",J.ZodMap="ZodMap",J.ZodSet="ZodSet",J.ZodFunction="ZodFunction",J.ZodLazy="ZodLazy",J.ZodLiteral="ZodLiteral",J.ZodEnum="ZodEnum",J.ZodEffects="ZodEffects",J.ZodNativeEnum="ZodNativeEnum",J.ZodOptional="ZodOptional",J.ZodNullable="ZodNullable",J.ZodDefault="ZodDefault",J.ZodCatch="ZodCatch",J.ZodPromise="ZodPromise",J.ZodBranded="ZodBranded",J.ZodPipeline="ZodPipeline",J.ZodReadonly="ZodReadonly"})($8||($8={}));LF0=O$.create,AF0=hF.create,cQ4=Yk.create,lQ4=bF.create,OF0=OE.create,iQ4=tD.create,nQ4=t_.create,aQ4=wE.create,oQ4=EE.create,rQ4=eD.create,sQ4=fF.create,tQ4=wV.create,eQ4=e_.create,JY4=w$.create,QY4=j7.create,YY4=j7.strictCreate,XY4=IE.create,GY4=Ml.create,ZY4=PE.create,$Y4=EV.create,qY4=Jk.create,VY4=Qk.create,KY4=JM.create,WY4=AE.create,HY4=TE.create,zY4=RE.create,FY4=gF.create,UY4=CE.create,BY4=QM.create,NY4=P$.create,DY4=E$.create,MY4=fW.create,LY4=P$.createWithPreprocess,AY4=Xk.create,IY4={string:(J)=>O$.create({...J,coerce:!0}),number:(J)=>hF.create({...J,coerce:!0}),boolean:(J)=>OE.create({...J,coerce:!0}),bigint:(J)=>bF.create({...J,coerce:!0}),date:(J)=>tD.create({...J,coerce:!0})},PY4=o4});var J1={};n8(J1,{void:()=>eQ4,util:()=>N9,unknown:()=>sQ4,union:()=>XY4,undefined:()=>aQ4,tuple:()=>$Y4,transformer:()=>NY4,symbol:()=>nQ4,string:()=>LF0,strictObject:()=>YY4,setErrorMap:()=>MQ4,set:()=>KY4,record:()=>qY4,quotelessJson:()=>NQ4,promise:()=>BY4,preprocess:()=>LY4,pipeline:()=>AY4,ostring:()=>OY4,optional:()=>DY4,onumber:()=>wY4,oboolean:()=>EY4,objectUtil:()=>DZ1,object:()=>QY4,number:()=>AF0,nullable:()=>MY4,null:()=>oQ4,never:()=>tQ4,nativeEnum:()=>UY4,nan:()=>cQ4,map:()=>VY4,makeIssue:()=>s_,literal:()=>zY4,lazy:()=>HY4,late:()=>pQ4,isValid:()=>vF,isDirty:()=>Dl,isAsync:()=>ME,isAborted:()=>Nl,intersection:()=>ZY4,instanceof:()=>dQ4,getParsedType:()=>OV,getErrorMap:()=>DE,function:()=>WY4,enum:()=>FY4,effect:()=>NY4,discriminatedUnion:()=>GY4,defaultErrorMap:()=>xW,datetimeRegex:()=>NF0,date:()=>iQ4,custom:()=>MF0,coerce:()=>IY4,boolean:()=>OF0,bigint:()=>lQ4,array:()=>JY4,any:()=>rQ4,addIssueToContext:()=>r6,ZodVoid:()=>e_,ZodUnknown:()=>fF,ZodUnion:()=>IE,ZodUndefined:()=>wE,ZodType:()=>o8,ZodTuple:()=>EV,ZodTransformer:()=>P$,ZodSymbol:()=>t_,ZodString:()=>O$,ZodSet:()=>JM,ZodSchema:()=>o8,ZodRecord:()=>Jk,ZodReadonly:()=>_E,ZodPromise:()=>QM,ZodPipeline:()=>Xk,ZodParsedType:()=>x6,ZodOptional:()=>E$,ZodObject:()=>j7,ZodNumber:()=>hF,ZodNullable:()=>fW,ZodNull:()=>EE,ZodNever:()=>wV,ZodNativeEnum:()=>CE,ZodNaN:()=>Yk,ZodMap:()=>Qk,ZodLiteral:()=>RE,ZodLazy:()=>TE,ZodIssueCode:()=>z6,ZodIntersection:()=>PE,ZodFunction:()=>AE,ZodFirstPartyTypeKind:()=>$8,ZodError:()=>WY,ZodEnum:()=>gF,ZodEffects:()=>P$,ZodDiscriminatedUnion:()=>Ml,ZodDefault:()=>jE,ZodDate:()=>tD,ZodCatch:()=>SE,ZodBranded:()=>Ll,ZodBoolean:()=>OE,ZodBigInt:()=>bF,ZodArray:()=>w$,ZodAny:()=>eD,Schema:()=>o8,ParseStatus:()=>JJ,OK:()=>cJ,NEVER:()=>PY4,INVALID:()=>o4,EMPTY_PATH:()=>LQ4,DIRTY:()=>sD,BRAND:()=>uQ4});var wZ1=L1(()=>{Bl();LZ1();WF0();r_();wF0();Ul()});var Gk=L1(()=>{wZ1();wZ1()});function lJ(J,Q){let Y=CY4(J,Q);return typeof Y==="string"?Y:Y.toString()}function CY4(J,Q,Y=!0){if(!Q)Q=jY4();let{workspaceFolders:X,isWindows:G,homeDir:Z}=Q,q=typeof J==="string"?n0.parse(J):n0.from(J);if(X)for(let V of X){let K=a4(V);if(Z6.hasPrefix(q,K)){let W=K.path.endsWith("/")?K.path.slice(0,-1):K.path,z=Y&&X&&X.length>=2?nD(K.path)+(G?"\\":"/"):"";return IZ1(z+q.path.slice(W.length+1),G,q.scheme)}}if(q?.scheme==="file"){if(Z){let V=a4(Z);if(Z6.hasPrefix(q,V)){let K=V.path.endsWith("/")?V.path.slice(0,-1):V.path,W=q.path.slice(K.length+1);return IZ1("~"+(G?"\\":"/")+W,G,q.scheme)}}return IZ1(q.fsPath,G,q.scheme)}return q}function IZ1(J,Q,Y){return Q&&Y==="file"?J.replaceAll("/","\\"):J}function Ol(J){let Q=Al;return Al=J,Q}function jY4(){if(Al)return Al;throw Error("must call setDisplayPathEnvInfo before calling displayPath() and related functions")}var Al=null;var hW=L1(()=>{K4();WE();Yl()});var SY4=(J)=>{let Q=0,Y=[];while(Q<J.length){let X=J[Q];if(X==="\\"){Q++;continue}if(X==="{"){Y.push({type:"brace",value:"{"}),Q++;continue}if(X==="}"){Y.push({type:"brace",value:"}"}),Q++;continue}if(X==="["){Y.push({type:"paren",value:"["}),Q++;continue}if(X==="]"){Y.push({type:"paren",value:"]"}),Q++;continue}if(X===":"){Y.push({type:"separator",value:":"}),Q++;continue}if(X===","){Y.push({type:"delimiter",value:","}),Q++;continue}if(X==='"'){let V="",K=!1;X=J[++Q];while(X!=='"'){if(Q===J.length){K=!0;break}if(X==="\\"){if(Q++,Q===J.length){K=!0;break}V+=X+J[Q],X=J[++Q]}else V+=X,X=J[++Q]}if(X=J[++Q],!K)Y.push({type:"string",value:V});continue}if(X&&/\s/.test(X)){Q++;continue}let Z=/[0-9]/;if(X&&Z.test(X)||X==="-"||X==="."){let V="";if(X==="-")V+=X,X=J[++Q];while(X&&Z.test(X)||X===".")V+=X,X=J[++Q];Y.push({type:"number",value:V});continue}let q=/[a-z]/i;if(X&&q.test(X)){let V="";while(X&&q.test(X)){if(Q===J.length)break;V+=X,X=J[++Q]}if(V=="true"||V=="false"||V==="null")Y.push({type:"name",value:V});else{Q++;continue}continue}Q++}return Y},yE=(J)=>{if(J.length===0)return J;let Q=J[J.length-1];switch(Q.type){case"separator":return J=J.slice(0,J.length-1),yE(J);break;case"number":let Y=Q.value[Q.value.length-1];if(Y==="."||Y==="-")return J=J.slice(0,J.length-1),yE(J);case"string":let X=J[J.length-2];if(X?.type==="delimiter")return J=J.slice(0,J.length-1),yE(J);else if(X?.type==="brace"&&X.value==="{")return J=J.slice(0,J.length-1),yE(J);break;case"delimiter":return J=J.slice(0,J.length-1),yE(J);break}return J},_Y4=(J)=>{let Q=[];if(J.map((Y)=>{if(Y.type==="brace")if(Y.value==="{")Q.push("}");else Q.splice(Q.lastIndexOf("}"),1);if(Y.type==="paren")if(Y.value==="[")Q.push("]");else Q.splice(Q.lastIndexOf("]"),1)}),Q.length>0)Q.reverse().map((Y)=>{if(Y==="}")J.push({type:"brace",value:"}"});else if(Y==="]")J.push({type:"paren",value:"]"})});return J},kY4=(J)=>{let Q="";return J.map((Y)=>{switch(Y.type){case"string":Q+='"'+Y.value+'"';break;default:Q+=Y.value;break}}),Q},hG=(J)=>JSON.parse(kY4(_Y4(yE(SY4(J)))));var YM=()=>{};function iJ(J,...Q){throw Error(`[Immer] minified error nr: ${J}. Full error at: https://bit.ly/3cXEKWf`)}function ZM(J){return!!J&&!!J[WX]}function uF(J){if(!J)return!1;return CF0(J)||Array.isArray(J)||!!J[Zk]||!!J.constructor?.[Zk]||Wk(J)||Hk(J)}function CF0(J){if(!J||typeof J!=="object")return!1;let Q=GM(J);if(Q===null)return!0;let Y=Object.hasOwnProperty.call(Q,"constructor")&&Q.constructor;if(Y===Object)return!0;return typeof Y=="function"&&Function.toString.call(Y)===yY4}function $k(J,Q){if($M(J)===0)Reflect.ownKeys(J).forEach((Y)=>{Q(Y,J[Y],J)});else J.forEach((Y,X)=>Q(X,Y,J))}function $M(J){let Q=J[WX];return Q?Q.type_:Array.isArray(J)?1:Wk(J)?2:Hk(J)?3:0}function qk(J,Q){return $M(J)===2?J.has(Q):Object.prototype.hasOwnProperty.call(J,Q)}function PZ1(J,Q){return $M(J)===2?J.get(Q):J[Q]}function jF0(J,Q,Y){let X=$M(J);if(X===2)J.set(Q,Y);else if(X===3)J.add(Y);else J[Q]=Y}function xY4(J,Q){if(J===Q)return J!==0||1/J===1/Q;else return J!==J&&Q!==Q}function Wk(J){return J instanceof Map}function Hk(J){return J instanceof Set}function XM(J){return J.copy_||J.base_}function CZ1(J,Q){if(Wk(J))return new Map(J);if(Hk(J))return new Set(J);if(Array.isArray(J))return Array.prototype.slice.call(J);let Y=CF0(J);if(Q===!0||Q==="class_only"&&!Y){let X=Object.getOwnPropertyDescriptors(J);delete X[WX];let G=Reflect.ownKeys(X);for(let Z=0;Z<G.length;Z++){let q=G[Z],V=X[q];if(V.writable===!1)V.writable=!0,V.configurable=!0;if(V.get||V.set)X[q]={configurable:!0,writable:!0,enumerable:V.enumerable,value:J[q]}}return Object.create(GM(J),X)}else{let X=GM(J);if(X!==null&&Y)return{...J};let G=Object.create(X);return Object.assign(G,J)}}function zX(J,Q=!1){if(Il(J)||ZM(J)||!uF(J))return J;if($M(J)>1)J.set=J.add=J.clear=J.delete=vY4;if(Object.freeze(J),Q)Object.entries(J).forEach(([Y,X])=>zX(X,!0));return J}function vY4(){iJ(2)}function Il(J){return Object.isFrozen(J)}function qM(J){let Q=jZ1[J];if(!Q)iJ(0,J);return Q}function fY4(J,Q){if(!jZ1[J])jZ1[J]=Q}function SF0(){return Vk}function hY4(J,Q){return{drafts_:[],parent_:J,immer_:Q,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function IF0(J,Q){if(Q)qM("Patches"),J.patches_=[],J.inversePatches_=[],J.patchListener_=Q}function SZ1(J){_Z1(J),J.drafts_.forEach(bY4),J.drafts_=null}function _Z1(J){if(J===Vk)Vk=J.parent_}function PF0(J){return Vk=hY4(Vk,J)}function bY4(J){let Q=J[WX];if(Q.type_===0||Q.type_===1)Q.revoke_();else Q.revoked_=!0}function TF0(J,Q){Q.unfinalizedDrafts_=Q.drafts_.length;let Y=Q.drafts_[0];if(J!==void 0&&J!==Y){if(Y[WX].modified_)SZ1(Q),iJ(4);if(uF(J)){if(J=wl(Q,J),!Q.parent_)El(Q,J)}if(Q.patches_)qM("Patches").generateReplacementPatches_(Y[WX].base_,J,Q.patches_,Q.inversePatches_)}else J=wl(Q,Y,[]);if(SZ1(Q),Q.patches_)Q.patchListener_(Q.patches_,Q.inversePatches_);return J!==xZ1?J:void 0}function wl(J,Q,Y){if(Il(Q))return Q;let X=Q[WX];if(!X)return $k(Q,(G,Z)=>RF0(J,X,Q,G,Z,Y)),Q;if(X.scope_!==J)return Q;if(!X.modified_)return El(J,X.base_,!0),X.base_;if(!X.finalized_){X.finalized_=!0,X.scope_.unfinalizedDrafts_--;let G=X.copy_,Z=G,q=!1;if(X.type_===3)Z=new Set(G),G.clear(),q=!0;if($k(Z,(V,K)=>RF0(J,X,G,V,K,Y,q)),El(J,G,!1),Y&&J.patches_)qM("Patches").generatePatches_(X,Y,J.patches_,J.inversePatches_)}return X.copy_}function RF0(J,Q,Y,X,G,Z,q){if(ZM(G)){let V=Z&&Q&&Q.type_!==3&&!qk(Q.assigned_,X)?Z.concat(X):void 0,K=wl(J,G,V);if(jF0(Y,X,K),ZM(K))J.canAutoFreeze_=!1;else return}else if(q)Y.add(G);if(uF(G)&&!Il(G)){if(!J.immer_.autoFreeze_&&J.unfinalizedDrafts_<1)return;if(wl(J,G),(!Q||!Q.scope_.parent_)&&typeof X!=="symbol"&&Object.prototype.propertyIsEnumerable.call(Y,X))El(J,G)}}function El(J,Q,Y=!1){if(!J.parent_&&J.immer_.autoFreeze_&&J.canAutoFreeze_)zX(Q,Y)}function gY4(J,Q){let Y=Array.isArray(J),X={type_:Y?1:0,scope_:Q?Q.scope_:SF0(),modified_:!1,finalized_:!1,assigned_:{},parent_:Q,base_:J,draft_:null,copy_:null,revoke_:null,isManual_:!1},G=X,Z=vZ1;if(Y)G=[X],Z=Kk;let{revoke:q,proxy:V}=Proxy.revocable(G,Z);return X.draft_=V,X.revoke_=q,V}function TZ1(J,Q){let Y=J[WX];return(Y?XM(Y):J)[Q]}function mY4(J,Q,Y){let X=_F0(Q,Y);return X?"value"in X?X.value:X.get?.call(J.draft_):void 0}function _F0(J,Q){if(!(Q in J))return;let Y=GM(J);while(Y){let X=Object.getOwnPropertyDescriptor(Y,Q);if(X)return X;Y=GM(Y)}return}function kZ1(J){if(!J.modified_){if(J.modified_=!0,J.parent_)kZ1(J.parent_)}}function RZ1(J){if(!J.copy_)J.copy_=CZ1(J.base_,J.scope_.immer_.useStrictShallowCopy_)}function yZ1(J,Q){let Y=Wk(J)?qM("MapSet").proxyMap_(J,Q):Hk(J)?qM("MapSet").proxySet_(J,Q):gY4(J,Q);return(Q?Q.scope_:SF0()).drafts_.push(Y),Y}function pY4(J){if(!ZM(J))iJ(10,J);return kF0(J)}function kF0(J){if(!uF(J)||Il(J))return J;let Q=J[WX],Y;if(Q){if(!Q.modified_)return Q.base_;Q.finalized_=!0,Y=CZ1(J,Q.scope_.immer_.useStrictShallowCopy_)}else Y=CZ1(J,!0);if($k(Y,(X,G)=>{jF0(Y,X,kF0(G))}),Q)Q.finalized_=!1;return Y}function Pl(){let Q="replace",Y="add",X="remove";function G(U,N,M,L){switch(U.type_){case 0:case 2:return q(U,N,M,L);case 1:return Z(U,N,M,L);case 3:return V(U,N,M,L)}}function Z(U,N,M,L){let{base_:A,assigned_:E}=U,P=U.copy_;if(P.length<A.length)[A,P]=[P,A],[M,L]=[L,M];for(let I=0;I<A.length;I++)if(E[I]&&P[I]!==A[I]){let R=N.concat([I]);M.push({op:Q,path:R,value:z(P[I])}),L.push({op:Q,path:R,value:z(A[I])})}for(let I=A.length;I<P.length;I++){let R=N.concat([I]);M.push({op:Y,path:R,value:z(P[I])})}for(let I=P.length-1;A.length<=I;--I){let R=N.concat([I]);L.push({op:X,path:R})}}function q(U,N,M,L){let{base_:A,copy_:E}=U;$k(U.assigned_,(P,I)=>{let R=PZ1(A,P),S=PZ1(E,P),y=!I?X:qk(A,P)?Q:Y;if(R===S&&y===Q)return;let x=N.concat(P);M.push(y===X?{op:y,path:x}:{op:y,path:x,value:S}),L.push(y===Y?{op:X,path:x}:y===X?{op:Y,path:x,value:z(R)}:{op:Q,path:x,value:z(R)})})}function V(U,N,M,L){let{base_:A,copy_:E}=U,P=0;A.forEach((I)=>{if(!E.has(I)){let R=N.concat([P]);M.push({op:X,path:R,value:I}),L.unshift({op:Y,path:R,value:I})}P++}),P=0,E.forEach((I)=>{if(!A.has(I)){let R=N.concat([P]);M.push({op:Y,path:R,value:I}),L.unshift({op:X,path:R,value:I})}P++})}function K(U,N,M,L){M.push({op:Q,path:[],value:N===xZ1?void 0:N}),L.push({op:Q,path:[],value:U})}function W(U,N){return N.forEach((M)=>{let{path:L,op:A}=M,E=U;for(let S=0;S<L.length-1;S++){let y=$M(E),x=L[S];if(typeof x!=="string"&&typeof x!=="number")x=""+x;if((y===0||y===1)&&(x==="__proto__"||x==="constructor"))iJ(19);if(typeof E==="function"&&x==="prototype")iJ(19);if(E=PZ1(E,x),typeof E!=="object")iJ(18,L.join("/"))}let P=$M(E),I=H(M.value),R=L[L.length-1];switch(A){case Q:switch(P){case 2:return E.set(R,I);case 3:iJ(16);default:return E[R]=I}case Y:switch(P){case 1:return R==="-"?E.push(I):E.splice(R,0,I);case 2:return E.set(R,I);case 3:return E.add(I);default:return E[R]=I}case X:switch(P){case 1:return E.splice(R,1);case 2:return E.delete(R);case 3:return E.delete(M.value);default:return delete E[R]}default:iJ(17,A)}}),U}function H(U){if(!uF(U))return U;if(Array.isArray(U))return U.map(H);if(Wk(U))return new Map(Array.from(U.entries()).map(([M,L])=>[M,H(L)]));if(Hk(U))return new Set(Array.from(U).map(H));let N=Object.create(GM(U));for(let M in U)N[M]=H(U[M]);if(qk(U,Zk))N[Zk]=U[Zk];return N}function z(U){if(ZM(U))return H(U);else return U}fY4("Patches",{applyPatches_:W,generatePatches_:G,generateReplacementPatches_:K})}function $9(J){return J}var xZ1,Zk,WX,GM,yY4,jZ1,Vk,vZ1,Kk,uY4=class{constructor(J){if(this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(Q,Y,X)=>{if(typeof Q==="function"&&typeof Y!=="function"){let Z=Y;Y=Q;let q=this;return function(K=Z,...W){return q.produce(K,(H)=>Y.call(this,H,...W))}}if(typeof Y!=="function")iJ(6);if(X!==void 0&&typeof X!=="function")iJ(7);let G;if(uF(Q)){let Z=PF0(this),q=yZ1(Q,void 0),V=!0;try{G=Y(q),V=!1}finally{if(V)SZ1(Z);else _Z1(Z)}return IF0(Z,X),TF0(G,Z)}else if(!Q||typeof Q!=="object"){if(G=Y(Q),G===void 0)G=Q;if(G===xZ1)G=void 0;if(this.autoFreeze_)zX(G,!0);if(X){let Z=[],q=[];qM("Patches").generateReplacementPatches_(Q,G,Z,q),X(Z,q)}return G}else iJ(1,Q)},this.produceWithPatches=(Q,Y)=>{if(typeof Q==="function")return(q,...V)=>this.produceWithPatches(q,(K)=>Q(K,...V));let X,G;return[this.produce(Q,Y,(q,V)=>{X=q,G=V}),X,G]},typeof J?.autoFreeze==="boolean")this.setAutoFreeze(J.autoFreeze);if(typeof J?.useStrictShallowCopy==="boolean")this.setUseStrictShallowCopy(J.useStrictShallowCopy)}createDraft(J){if(!uF(J))iJ(8);if(ZM(J))J=pY4(J);let Q=PF0(this),Y=yZ1(J,void 0);return Y[WX].isManual_=!0,_Z1(Q),Y}finishDraft(J,Q){let Y=J&&J[WX];if(!Y||!Y.isManual_)iJ(9);let{scope_:X}=Y;return IF0(X,Q),TF0(void 0,X)}setAutoFreeze(J){this.autoFreeze_=J}setUseStrictShallowCopy(J){this.useStrictShallowCopy_=J}applyPatches(J,Q){let Y;for(Y=Q.length-1;Y>=0;Y--){let G=Q[Y];if(G.path.length===0&&G.op==="replace"){J=G.value;break}}if(Y>-1)Q=Q.slice(Y+1);let X=qM("Patches").applyPatches_;if(ZM(J))return X(J,Q);return this.produce(J,(G)=>X(G,Q))}},HX,pF,VM,Rg8,Cg8,yF0,jg8,Sg8;var HY=L1(()=>{xZ1=Symbol.for("immer-nothing"),Zk=Symbol.for("immer-draftable"),WX=Symbol.for("immer-state");GM=Object.getPrototypeOf;yY4=Object.prototype.constructor.toString();jZ1={};vZ1={get(J,Q){if(Q===WX)return J;let Y=XM(J);if(!qk(Y,Q))return mY4(J,Y,Q);let X=Y[Q];if(J.finalized_||!uF(X))return X;if(X===TZ1(J.base_,Q))return RZ1(J),J.copy_[Q]=yZ1(X,J);return X},has(J,Q){return Q in XM(J)},ownKeys(J){return Reflect.ownKeys(XM(J))},set(J,Q,Y){let X=_F0(XM(J),Q);if(X?.set)return X.set.call(J.draft_,Y),!0;if(!J.modified_){let G=TZ1(XM(J),Q),Z=G?.[WX];if(Z&&Z.base_===Y)return J.copy_[Q]=Y,J.assigned_[Q]=!1,!0;if(xY4(Y,G)&&(Y!==void 0||qk(J.base_,Q)))return!0;RZ1(J),kZ1(J)}if(J.copy_[Q]===Y&&(Y!==void 0||(Q in J.copy_))||Number.isNaN(Y)&&Number.isNaN(J.copy_[Q]))return!0;return J.copy_[Q]=Y,J.assigned_[Q]=!0,!0},deleteProperty(J,Q){if(TZ1(J.base_,Q)!==void 0||Q in J.base_)J.assigned_[Q]=!1,RZ1(J),kZ1(J);else delete J.assigned_[Q];if(J.copy_)delete J.copy_[Q];return!0},getOwnPropertyDescriptor(J,Q){let Y=XM(J),X=Reflect.getOwnPropertyDescriptor(Y,Q);if(!X)return X;return{writable:!0,configurable:J.type_!==1||Q!=="length",enumerable:X.enumerable,value:Y[Q]}},defineProperty(){iJ(11)},getPrototypeOf(J){return GM(J.base_)},setPrototypeOf(){iJ(12)}},Kk={};$k(vZ1,(J,Q)=>{Kk[J]=function(){return arguments[0]=arguments[0][0],Q.apply(this,arguments)}});Kk.deleteProperty=function(J,Q){return Kk.set.call(this,J,Q,void 0)};Kk.set=function(J,Q,Y){return vZ1.set.call(this,J[0],Q,Y,J[0])};HX=new uY4,pF=HX.produce,VM=HX.produceWithPatches.bind(HX),Rg8=HX.setAutoFreeze.bind(HX),Cg8=HX.setUseStrictShallowCopy.bind(HX),yF0=HX.applyPatches.bind(HX),jg8=HX.createDraft.bind(HX),Sg8=HX.finishDraft.bind(HX)});function fZ1({onlyFirst:J=!1}={}){let Y=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(Y,J?void 0:"g")}function xE(J){if(typeof J!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof J}\``);return J.replace(dY4,"")}var dY4;var Tl=L1(()=>{dY4=fZ1()});var vF0=f((fg8,hZ1)=>{var dF={};if(typeof hZ1>"u")window.eastasianwidth=dF;else hZ1.exports=dF;dF.eastAsianWidth=function(J){var Q=J.charCodeAt(0),Y=J.length==2?J.charCodeAt(1):0,X=Q;if(55296<=Q&&Q<=56319&&(56320<=Y&&Y<=57343))Q&=1023,Y&=1023,X=Q<<10|Y,X+=65536;if(X==12288||65281<=X&&X<=65376||65504<=X&&X<=65510)return"F";if(X==8361||65377<=X&&X<=65470||65474<=X&&X<=65479||65482<=X&&X<=65487||65490<=X&&X<=65495||65498<=X&&X<=65500||65512<=X&&X<=65518)return"H";if(4352<=X&&X<=4447||4515<=X&&X<=4519||4602<=X&&X<=4607||9001<=X&&X<=9002||11904<=X&&X<=11929||11931<=X&&X<=12019||12032<=X&&X<=12245||12272<=X&&X<=12283||12289<=X&&X<=12350||12353<=X&&X<=12438||12441<=X&&X<=12543||12549<=X&&X<=12589||12593<=X&&X<=12686||12688<=X&&X<=12730||12736<=X&&X<=12771||12784<=X&&X<=12830||12832<=X&&X<=12871||12880<=X&&X<=13054||13056<=X&&X<=19903||19968<=X&&X<=42124||42128<=X&&X<=42182||43360<=X&&X<=43388||44032<=X&&X<=55203||55216<=X&&X<=55238||55243<=X&&X<=55291||63744<=X&&X<=64255||65040<=X&&X<=65049||65072<=X&&X<=65106||65108<=X&&X<=65126||65128<=X&&X<=65131||110592<=X&&X<=110593||127488<=X&&X<=127490||127504<=X&&X<=127546||127552<=X&&X<=127560||127568<=X&&X<=127569||131072<=X&&X<=194367||177984<=X&&X<=196605||196608<=X&&X<=262141)return"W";if(32<=X&&X<=126||162<=X&&X<=163||165<=X&&X<=166||X==172||X==175||10214<=X&&X<=10221||10629<=X&&X<=10630)return"Na";if(X==161||X==164||167<=X&&X<=168||X==170||173<=X&&X<=174||176<=X&&X<=180||182<=X&&X<=186||188<=X&&X<=191||X==198||X==208||215<=X&&X<=216||222<=X&&X<=225||X==230||232<=X&&X<=234||236<=X&&X<=237||X==240||242<=X&&X<=243||247<=X&&X<=250||X==252||X==254||X==257||X==273||X==275||X==283||294<=X&&X<=295||X==299||305<=X&&X<=307||X==312||319<=X&&X<=322||X==324||328<=X&&X<=331||X==333||338<=X&&X<=339||358<=X&&X<=359||X==363||X==462||X==464||X==466||X==468||X==470||X==472||X==474||X==476||X==593||X==609||X==708||X==711||713<=X&&X<=715||X==717||X==720||728<=X&&X<=731||X==733||X==735||768<=X&&X<=879||913<=X&&X<=929||931<=X&&X<=937||945<=X&&X<=961||963<=X&&X<=969||X==1025||1040<=X&&X<=1103||X==1105||X==8208||8211<=X&&X<=8214||8216<=X&&X<=8217||8220<=X&&X<=8221||8224<=X&&X<=8226||8228<=X&&X<=8231||X==8240||8242<=X&&X<=8243||X==8245||X==8251||X==8254||X==8308||X==8319||8321<=X&&X<=8324||X==8364||X==8451||X==8453||X==8457||X==8467||X==8470||8481<=X&&X<=8482||X==8486||X==8491||8531<=X&&X<=8532||8539<=X&&X<=8542||8544<=X&&X<=8555||8560<=X&&X<=8569||X==8585||8592<=X&&X<=8601||8632<=X&&X<=8633||X==8658||X==8660||X==8679||X==8704||8706<=X&&X<=8707||8711<=X&&X<=8712||X==8715||X==8719||X==8721||X==8725||X==8730||8733<=X&&X<=8736||X==8739||X==8741||8743<=X&&X<=8748||X==8750||8756<=X&&X<=8759||8764<=X&&X<=8765||X==8776||X==8780||X==8786||8800<=X&&X<=8801||8804<=X&&X<=8807||8810<=X&&X<=8811||8814<=X&&X<=8815||8834<=X&&X<=8835||8838<=X&&X<=8839||X==8853||X==8857||X==8869||X==8895||X==8978||9312<=X&&X<=9449||9451<=X&&X<=9547||9552<=X&&X<=9587||9600<=X&&X<=9615||9618<=X&&X<=9621||9632<=X&&X<=9633||9635<=X&&X<=9641||9650<=X&&X<=9651||9654<=X&&X<=9655||9660<=X&&X<=9661||9664<=X&&X<=9665||9670<=X&&X<=9672||X==9675||9678<=X&&X<=9681||9698<=X&&X<=9701||X==9711||9733<=X&&X<=9734||X==9737||9742<=X&&X<=9743||9748<=X&&X<=9749||X==9756||X==9758||X==9792||X==9794||9824<=X&&X<=9825||9827<=X&&X<=9829||9831<=X&&X<=9834||9836<=X&&X<=9837||X==9839||9886<=X&&X<=9887||9918<=X&&X<=9919||9924<=X&&X<=9933||9935<=X&&X<=9953||X==9955||9960<=X&&X<=9983||X==10045||X==10071||10102<=X&&X<=10111||11093<=X&&X<=11097||12872<=X&&X<=12879||57344<=X&&X<=63743||65024<=X&&X<=65039||X==65533||127232<=X&&X<=127242||127248<=X&&X<=127277||127280<=X&&X<=127337||127344<=X&&X<=127386||917760<=X&&X<=917999||983040<=X&&X<=1048573||1048576<=X&&X<=1114109)return"A";return"N"};dF.characterLength=function(J){var Q=this.eastAsianWidth(J);if(Q=="F"||Q=="W"||Q=="A")return 2;else return 1};function xF0(J){return J.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}dF.length=function(J){var Q=xF0(J),Y=0;for(var X=0;X<Q.length;X++)Y=Y+this.characterLength(Q[X]);return Y};dF.slice=function(J,Q,Y){if(textLen=dF.length(J),Q=Q?Q:0,Y=Y?Y:1,Q<0)Q=textLen+Q;if(Y<0)Y=textLen+Y;var X="",G=0,Z=xF0(J);for(var q=0;q<Z.length;q++){var V=Z[q],K=dF.length(V);if(G>=Q-(K==2?1:0))if(G+K<=Y)X+=V;else break;G+=K}return X}});var bZ1=f((hg8,fF0)=>{fF0.exports=()=>{return/[#*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\uDC70\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-\uDED7\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\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\uDD3D\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-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\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]|\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\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]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\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 cY4,lY4;var hF0=L1(()=>{Tl();cY4=D6(vF0(),1),lY4=D6(bZ1(),1)});function Rl(J,Q,Y="..."){if(J.length<=Q)return J;return J.slice(0,Math.max(0,Q-Y.length))+Y}var gZ1=L1(()=>{hF0()});var bF0="run_terminal_command",gF0="read_file",QJ="Task",q9="finder",zY="get_diagnostics",d9="Bash",Cl="InteractiveShell",r5="oracle",IV="mermaid",PV="todo_read",Z7="todo_write",H2="read_web_page",vE="read_thread",y5="create_file",G3="glob",jl="undo_edit",Sl="read_mcp_resource",l6="Read",U7="edit_file",fE="format_file",S3="web_search",y8="Grep",KM="Check",FX="librarian",_l="kraken",mF0="read_artifact",uF0="edit_artifact",kl="read_plan",hE="edit_plan",yl="read_github",xl="search_github",vl="commit_search",fl="list_directory_github",hl="list_repositories",bl="glob_github",gl="diff",pF0="bookkeeper",dF0="describe_workbook",cF0="execute_query",zk="skill",lF0;var L4=L1(()=>{lF0=["Task","finder","get_diagnostics","Bash","InteractiveShell","oracle","mermaid","todo_read","todo_write","read_web_page","create_file","glob","Glob","undo_edit","Read","edit_file","delete_file","format_file","web_search","Grep","search_documents","get_document","Check","code_review","kraken","librarian","bookkeeper","read_thread","read_artifact","edit_artifact","read_plan","edit_plan","skill"]});var Fk=f((cg8,nF0)=>{var iF0={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)",SEP:"/"},iY4={...iF0,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},nY4={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};nF0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:nY4,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(J){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${J.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(J){return J===!0?iY4:iF0}}});var Uk=f((tY4)=>{var{REGEX_BACKSLASH:aY4,REGEX_REMOVE_BACKSLASH:oY4,REGEX_SPECIAL_CHARS:rY4,REGEX_SPECIAL_CHARS_GLOBAL:sY4}=Fk();tY4.isObject=(J)=>J!==null&&typeof J==="object"&&!Array.isArray(J);tY4.hasRegexChars=(J)=>rY4.test(J);tY4.isRegexChar=(J)=>J.length===1&&tY4.hasRegexChars(J);tY4.escapeRegex=(J)=>J.replace(sY4,"\\$1");tY4.toPosixSlashes=(J)=>J.replace(aY4,"/");tY4.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let J=navigator.platform.toLowerCase();return J==="win32"||J==="windows"}if(typeof process<"u"&&process.platform)return process.platform==="win32";return!1};tY4.removeBackslashes=(J)=>{return J.replace(oY4,(Q)=>{return Q==="\\"?"":Q})};tY4.escapeLast=(J,Q,Y)=>{let X=J.lastIndexOf(Q,Y);if(X===-1)return J;if(J[X-1]==="\\")return tY4.escapeLast(J,Q,X-1);return`${J.slice(0,X)}\\${J.slice(X)}`};tY4.removePrefix=(J,Q={})=>{let Y=J;if(Y.startsWith("./"))Y=Y.slice(2),Q.prefix="./";return Y};tY4.wrapOutput=(J,Q={},Y={})=>{let X=Y.contains?"":"^",G=Y.contains?"":"$",Z=`${X}(?:${J})${G}`;if(Q.negated===!0)Z=`(?:^(?!${Z}).*$)`;return Z};tY4.basename=(J,{windows:Q}={})=>{let Y=J.split(Q?/[\\/]/:"/"),X=Y[Y.length-1];if(X==="")return Y[Y.length-2];return X}});var XU0=f((ig8,YU0)=>{var rF0=Uk(),{CHAR_ASTERISK:mZ1,CHAR_AT:VX4,CHAR_BACKWARD_SLASH:Bk,CHAR_COMMA:KX4,CHAR_DOT:uZ1,CHAR_EXCLAMATION_MARK:pZ1,CHAR_FORWARD_SLASH:QU0,CHAR_LEFT_CURLY_BRACE:dZ1,CHAR_LEFT_PARENTHESES:cZ1,CHAR_LEFT_SQUARE_BRACKET:WX4,CHAR_PLUS:HX4,CHAR_QUESTION_MARK:sF0,CHAR_RIGHT_CURLY_BRACE:zX4,CHAR_RIGHT_PARENTHESES:tF0,CHAR_RIGHT_SQUARE_BRACKET:FX4}=Fk(),eF0=(J)=>{return J===QU0||J===Bk},JU0=(J)=>{if(J.isPrefix!==!0)J.depth=J.isGlobstar?1/0:1},UX4=(J,Q)=>{let Y=Q||{},X=J.length-1,G=Y.parts===!0||Y.scanToEnd===!0,Z=[],q=[],V=[],K=J,W=-1,H=0,z=0,U=!1,N=!1,M=!1,L=!1,A=!1,E=!1,P=!1,I=!1,R=!1,S=!1,y=0,x,g,p={value:"",depth:0,isGlob:!1},b=()=>W>=X,i=()=>K.charCodeAt(W+1),Q1=()=>{return x=g,K.charCodeAt(++W)};while(W<X){g=Q1();let W1;if(g===Bk){if(P=p.backslashes=!0,g=Q1(),g===dZ1)E=!0;continue}if(E===!0||g===dZ1){y++;while(b()!==!0&&(g=Q1())){if(g===Bk){P=p.backslashes=!0,Q1();continue}if(g===dZ1){y++;continue}if(E!==!0&&g===uZ1&&(g=Q1())===uZ1){if(U=p.isBrace=!0,M=p.isGlob=!0,S=!0,G===!0)continue;break}if(E!==!0&&g===KX4){if(U=p.isBrace=!0,M=p.isGlob=!0,S=!0,G===!0)continue;break}if(g===zX4){if(y--,y===0){E=!1,U=p.isBrace=!0,S=!0;break}}}if(G===!0)continue;break}if(g===QU0){if(Z.push(W),q.push(p),p={value:"",depth:0,isGlob:!1},S===!0)continue;if(x===uZ1&&W===H+1){H+=2;continue}z=W+1;continue}if(Y.noext!==!0){if((g===HX4||g===VX4||g===mZ1||g===sF0||g===pZ1)===!0&&i()===cZ1){if(M=p.isGlob=!0,L=p.isExtglob=!0,S=!0,g===pZ1&&W===H)R=!0;if(G===!0){while(b()!==!0&&(g=Q1())){if(g===Bk){P=p.backslashes=!0,g=Q1();continue}if(g===tF0){M=p.isGlob=!0,S=!0;break}}continue}break}}if(g===mZ1){if(x===mZ1)A=p.isGlobstar=!0;if(M=p.isGlob=!0,S=!0,G===!0)continue;break}if(g===sF0){if(M=p.isGlob=!0,S=!0,G===!0)continue;break}if(g===WX4){while(b()!==!0&&(W1=Q1())){if(W1===Bk){P=p.backslashes=!0,Q1();continue}if(W1===FX4){N=p.isBracket=!0,M=p.isGlob=!0,S=!0;break}}if(G===!0)continue;break}if(Y.nonegate!==!0&&g===pZ1&&W===H){I=p.negated=!0,H++;continue}if(Y.noparen!==!0&&g===cZ1){if(M=p.isGlob=!0,G===!0){while(b()!==!0&&(g=Q1())){if(g===cZ1){P=p.backslashes=!0,g=Q1();continue}if(g===tF0){S=!0;break}}continue}break}if(M===!0){if(S=!0,G===!0)continue;break}}if(Y.noext===!0)L=!1,M=!1;let a=K,m="",s="";if(H>0)m=K.slice(0,H),K=K.slice(H),z-=H;if(a&&M===!0&&z>0)a=K.slice(0,z),s=K.slice(z);else if(M===!0)a="",s=K;else a=K;if(a&&a!==""&&a!=="/"&&a!==K){if(eF0(a.charCodeAt(a.length-1)))a=a.slice(0,-1)}if(Y.unescape===!0){if(s)s=rF0.removeBackslashes(s);if(a&&P===!0)a=rF0.removeBackslashes(a)}let K1={prefix:m,input:J,start:H,base:a,glob:s,isBrace:U,isBracket:N,isGlob:M,isExtglob:L,isGlobstar:A,negated:I,negatedExtglob:R};if(Y.tokens===!0){if(K1.maxDepth=0,!eF0(g))q.push(p);K1.tokens=q}if(Y.parts===!0||Y.tokens===!0){let W1;for(let o=0;o<Z.length;o++){let r=W1?W1+1:H,l=Z[o],F1=J.slice(r,l);if(Y.tokens){if(o===0&&H!==0)q[o].isPrefix=!0,q[o].value=m;else q[o].value=F1;JU0(q[o]),K1.maxDepth+=q[o].depth}if(o!==0||F1!=="")V.push(F1);W1=l}if(W1&&W1+1<J.length){let o=J.slice(W1+1);if(V.push(o),Y.tokens)q[q.length-1].value=o,JU0(q[q.length-1]),K1.maxDepth+=q[q.length-1].depth}K1.slashes=Z,K1.parts=V}return K1};YU0.exports=UX4});var $U0=f((ng8,ZU0)=>{var ml=Fk(),TV=Uk(),{MAX_LENGTH:ul,POSIX_REGEX_SOURCE:BX4,REGEX_NON_SPECIAL_CHARS:NX4,REGEX_SPECIAL_CHARS_BACKREF:DX4,REPLACEMENTS:GU0}=ml,MX4=(J,Q)=>{if(typeof Q.expandRange==="function")return Q.expandRange(...J,Q);J.sort();let Y=`[${J.join("-")}]`;try{new RegExp(Y)}catch(X){return J.map((G)=>TV.escapeRegex(G)).join("..")}return Y},bE=(J,Q)=>{return`Missing ${J}: "${Q}" - use "\\\\${Q}" to match literal characters`},lZ1=(J,Q)=>{if(typeof J!=="string")throw TypeError("Expected a string");J=GU0[J]||J;let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(ul,Y.maxLength):ul,G=J.length;if(G>X)throw SyntaxError(`Input length: ${G}, exceeds maximum allowed length: ${X}`);let Z={type:"bos",value:"",output:Y.prepend||""},q=[Z],V=Y.capture?"":"?:",K=ml.globChars(Y.windows),W=ml.extglobChars(K),{DOT_LITERAL:H,PLUS_LITERAL:z,SLASH_LITERAL:U,ONE_CHAR:N,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:A,NO_DOTS_SLASH:E,QMARK:P,QMARK_NO_DOT:I,STAR:R,START_ANCHOR:S}=K,y=(s1)=>{return`(${V}(?:(?!${S}${s1.dot?M:H}).)*?)`},x=Y.dot?"":L,g=Y.dot?P:I,p=Y.bash===!0?y(Y):R;if(Y.capture)p=`(${p})`;if(typeof Y.noext==="boolean")Y.noextglob=Y.noext;let b={input:J,index:-1,start:0,dot:Y.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:q};J=TV.removePrefix(J,b),G=J.length;let i=[],Q1=[],a=[],m=Z,s,K1=()=>b.index===G-1,W1=b.peek=(s1=1)=>J[b.index+s1],o=b.advance=()=>J[++b.index]||"",r=()=>J.slice(b.index+1),l=(s1="",U1=0)=>{b.consumed+=s1,b.index+=U1},F1=(s1)=>{b.output+=s1.output!=null?s1.output:s1.value,l(s1.value)},y1=()=>{let s1=1;while(W1()==="!"&&(W1(2)!=="("||W1(3)==="?"))o(),b.start++,s1++;if(s1%2===0)return!1;return b.negated=!0,b.start++,!0},t=(s1)=>{b[s1]++,a.push(s1)},f1=(s1)=>{b[s1]--,a.pop()},j1=(s1)=>{if(m.type==="globstar"){let U1=b.braces>0&&(s1.type==="comma"||s1.type==="brace"),Y1=s1.extglob===!0||i.length&&(s1.type==="pipe"||s1.type==="paren");if(s1.type!=="slash"&&s1.type!=="paren"&&!U1&&!Y1)b.output=b.output.slice(0,-m.output.length),m.type="star",m.value="*",m.output=p,b.output+=m.output}if(i.length&&s1.type!=="paren")i[i.length-1].inner+=s1.value;if(s1.value||s1.output)F1(s1);if(m&&m.type==="text"&&s1.type==="text"){m.output=(m.output||m.value)+s1.value,m.value+=s1.value;return}s1.prev=m,q.push(s1),m=s1},O0=(s1,U1)=>{let Y1={...W[U1],conditions:1,inner:""};Y1.prev=m,Y1.parens=b.parens,Y1.output=b.output;let A1=(Y.capture?"(":"")+Y1.open;t("parens"),j1({type:s1,value:U1,output:b.output?"":N}),j1({type:"paren",extglob:!0,value:o(),output:A1}),i.push(Y1)},C1=(s1)=>{let U1=s1.close+(Y.capture?")":""),Y1;if(s1.type==="negate"){let A1=p;if(s1.inner&&s1.inner.length>1&&s1.inner.includes("/"))A1=y(Y);if(A1!==p||K1()||/^\)+$/.test(r()))U1=s1.close=`)$))${A1}`;if(s1.inner.includes("*")&&(Y1=r())&&/^\.[^\\/.]+$/.test(Y1)){let w1=lZ1(Y1,{...Q,fastpaths:!1}).output;U1=s1.close=`)${w1})${A1})`}if(s1.prev.type==="bos")b.negatedExtglob=!0}j1({type:"paren",extglob:!0,value:s,output:U1}),f1("parens")};if(Y.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(J)){let s1=!1,U1=J.replace(DX4,(Y1,A1,w1,I1,E1,p1)=>{if(I1==="\\")return s1=!0,Y1;if(I1==="?"){if(A1)return A1+I1+(E1?P.repeat(E1.length):"");if(p1===0)return g+(E1?P.repeat(E1.length):"");return P.repeat(w1.length)}if(I1===".")return H.repeat(w1.length);if(I1==="*"){if(A1)return A1+I1+(E1?p:"");return p}return A1?Y1:`\\${Y1}`});if(s1===!0)if(Y.unescape===!0)U1=U1.replace(/\\/g,"");else U1=U1.replace(/\\+/g,(Y1)=>{return Y1.length%2===0?"\\\\":Y1?"\\":""});if(U1===J&&Y.contains===!0)return b.output=J,b;return b.output=TV.wrapOutput(U1,b,Q),b}while(!K1()){if(s=o(),s==="\x00")continue;if(s==="\\"){let Y1=W1();if(Y1==="/"&&Y.bash!==!0)continue;if(Y1==="."||Y1===";")continue;if(!Y1){s+="\\",j1({type:"text",value:s});continue}let A1=/^\\+/.exec(r()),w1=0;if(A1&&A1[0].length>2){if(w1=A1[0].length,b.index+=w1,w1%2!==0)s+="\\"}if(Y.unescape===!0)s=o();else s+=o();if(b.brackets===0){j1({type:"text",value:s});continue}}if(b.brackets>0&&(s!=="]"||m.value==="["||m.value==="[^")){if(Y.posix!==!1&&s===":"){let Y1=m.value.slice(1);if(Y1.includes("[")){if(m.posix=!0,Y1.includes(":")){let A1=m.value.lastIndexOf("["),w1=m.value.slice(0,A1),I1=m.value.slice(A1+2),E1=BX4[I1];if(E1){if(m.value=w1+E1,b.backtrack=!0,o(),!Z.output&&q.indexOf(m)===1)Z.output=N;continue}}}}if(s==="["&&W1()!==":"||s==="-"&&W1()==="]")s=`\\${s}`;if(s==="]"&&(m.value==="["||m.value==="[^"))s=`\\${s}`;if(Y.posix===!0&&s==="!"&&m.value==="[")s="^";m.value+=s,F1({value:s});continue}if(b.quotes===1&&s!=='"'){s=TV.escapeRegex(s),m.value+=s,F1({value:s});continue}if(s==='"'){if(b.quotes=b.quotes===1?0:1,Y.keepQuotes===!0)j1({type:"text",value:s});continue}if(s==="("){t("parens"),j1({type:"paren",value:s});continue}if(s===")"){if(b.parens===0&&Y.strictBrackets===!0)throw SyntaxError(bE("opening","("));let Y1=i[i.length-1];if(Y1&&b.parens===Y1.parens+1){C1(i.pop());continue}j1({type:"paren",value:s,output:b.parens?")":"\\)"}),f1("parens");continue}if(s==="["){if(Y.nobracket===!0||!r().includes("]")){if(Y.nobracket!==!0&&Y.strictBrackets===!0)throw SyntaxError(bE("closing","]"));s=`\\${s}`}else t("brackets");j1({type:"bracket",value:s});continue}if(s==="]"){if(Y.nobracket===!0||m&&m.type==="bracket"&&m.value.length===1){j1({type:"text",value:s,output:`\\${s}`});continue}if(b.brackets===0){if(Y.strictBrackets===!0)throw SyntaxError(bE("opening","["));j1({type:"text",value:s,output:`\\${s}`});continue}f1("brackets");let Y1=m.value.slice(1);if(m.posix!==!0&&Y1[0]==="^"&&!Y1.includes("/"))s=`/${s}`;if(m.value+=s,F1({value:s}),Y.literalBrackets===!1||TV.hasRegexChars(Y1))continue;let A1=TV.escapeRegex(m.value);if(b.output=b.output.slice(0,-m.value.length),Y.literalBrackets===!0){b.output+=A1,m.value=A1;continue}m.value=`(${V}${A1}|${m.value})`,b.output+=m.value;continue}if(s==="{"&&Y.nobrace!==!0){t("braces");let Y1={type:"brace",value:s,output:"(",outputIndex:b.output.length,tokensIndex:b.tokens.length};Q1.push(Y1),j1(Y1);continue}if(s==="}"){let Y1=Q1[Q1.length-1];if(Y.nobrace===!0||!Y1){j1({type:"text",value:s,output:s});continue}let A1=")";if(Y1.dots===!0){let w1=q.slice(),I1=[];for(let E1=w1.length-1;E1>=0;E1--){if(q.pop(),w1[E1].type==="brace")break;if(w1[E1].type!=="dots")I1.unshift(w1[E1].value)}A1=MX4(I1,Y),b.backtrack=!0}if(Y1.comma!==!0&&Y1.dots!==!0){let w1=b.output.slice(0,Y1.outputIndex),I1=b.tokens.slice(Y1.tokensIndex);Y1.value=Y1.output="\\{",s=A1="\\}",b.output=w1;for(let E1 of I1)b.output+=E1.output||E1.value}j1({type:"brace",value:s,output:A1}),f1("braces"),Q1.pop();continue}if(s==="|"){if(i.length>0)i[i.length-1].conditions++;j1({type:"text",value:s});continue}if(s===","){let Y1=s,A1=Q1[Q1.length-1];if(A1&&a[a.length-1]==="braces")A1.comma=!0,Y1="|";j1({type:"comma",value:s,output:Y1});continue}if(s==="/"){if(m.type==="dot"&&b.index===b.start+1){b.start=b.index+1,b.consumed="",b.output="",q.pop(),m=Z;continue}j1({type:"slash",value:s,output:U});continue}if(s==="."){if(b.braces>0&&m.type==="dot"){if(m.value===".")m.output=H;let Y1=Q1[Q1.length-1];m.type="dots",m.output+=s,m.value+=s,Y1.dots=!0;continue}if(b.braces+b.parens===0&&m.type!=="bos"&&m.type!=="slash"){j1({type:"text",value:s,output:H});continue}j1({type:"dot",value:s,output:H});continue}if(s==="?"){if(!(m&&m.value==="(")&&Y.noextglob!==!0&&W1()==="("&&W1(2)!=="?"){O0("qmark",s);continue}if(m&&m.type==="paren"){let A1=W1(),w1=s;if(m.value==="("&&!/[!=<:]/.test(A1)||A1==="<"&&!/<([!=]|\w+>)/.test(r()))w1=`\\${s}`;j1({type:"text",value:s,output:w1});continue}if(Y.dot!==!0&&(m.type==="slash"||m.type==="bos")){j1({type:"qmark",value:s,output:I});continue}j1({type:"qmark",value:s,output:P});continue}if(s==="!"){if(Y.noextglob!==!0&&W1()==="("){if(W1(2)!=="?"||!/[!=<:]/.test(W1(3))){O0("negate",s);continue}}if(Y.nonegate!==!0&&b.index===0){y1();continue}}if(s==="+"){if(Y.noextglob!==!0&&W1()==="("&&W1(2)!=="?"){O0("plus",s);continue}if(m&&m.value==="("||Y.regex===!1){j1({type:"plus",value:s,output:z});continue}if(m&&(m.type==="bracket"||m.type==="paren"||m.type==="brace")||b.parens>0){j1({type:"plus",value:s});continue}j1({type:"plus",value:z});continue}if(s==="@"){if(Y.noextglob!==!0&&W1()==="("&&W1(2)!=="?"){j1({type:"at",extglob:!0,value:s,output:""});continue}j1({type:"text",value:s});continue}if(s!=="*"){if(s==="$"||s==="^")s=`\\${s}`;let Y1=NX4.exec(r());if(Y1)s+=Y1[0],b.index+=Y1[0].length;j1({type:"text",value:s});continue}if(m&&(m.type==="globstar"||m.star===!0)){m.type="star",m.star=!0,m.value+=s,m.output=p,b.backtrack=!0,b.globstar=!0,l(s);continue}let s1=r();if(Y.noextglob!==!0&&/^\([^?]/.test(s1)){O0("star",s);continue}if(m.type==="star"){if(Y.noglobstar===!0){l(s);continue}let Y1=m.prev,A1=Y1.prev,w1=Y1.type==="slash"||Y1.type==="bos",I1=A1&&(A1.type==="star"||A1.type==="globstar");if(Y.bash===!0&&(!w1||s1[0]&&s1[0]!=="/")){j1({type:"star",value:s,output:""});continue}let E1=b.braces>0&&(Y1.type==="comma"||Y1.type==="brace"),p1=i.length&&(Y1.type==="pipe"||Y1.type==="paren");if(!w1&&Y1.type!=="paren"&&!E1&&!p1){j1({type:"star",value:s,output:""});continue}while(s1.slice(0,3)==="/**"){let h1=J[b.index+4];if(h1&&h1!=="/")break;s1=s1.slice(3),l("/**",3)}if(Y1.type==="bos"&&K1()){m.type="globstar",m.value+=s,m.output=y(Y),b.output=m.output,b.globstar=!0,l(s);continue}if(Y1.type==="slash"&&Y1.prev.type!=="bos"&&!I1&&K1()){b.output=b.output.slice(0,-(Y1.output+m.output).length),Y1.output=`(?:${Y1.output}`,m.type="globstar",m.output=y(Y)+(Y.strictSlashes?")":"|$)"),m.value+=s,b.globstar=!0,b.output+=Y1.output+m.output,l(s);continue}if(Y1.type==="slash"&&Y1.prev.type!=="bos"&&s1[0]==="/"){let h1=s1[1]!==void 0?"|$":"";b.output=b.output.slice(0,-(Y1.output+m.output).length),Y1.output=`(?:${Y1.output}`,m.type="globstar",m.output=`${y(Y)}${U}|${U}${h1})`,m.value+=s,b.output+=Y1.output+m.output,b.globstar=!0,l(s+o()),j1({type:"slash",value:"/",output:""});continue}if(Y1.type==="bos"&&s1[0]==="/"){m.type="globstar",m.value+=s,m.output=`(?:^|${U}|${y(Y)}${U})`,b.output=m.output,b.globstar=!0,l(s+o()),j1({type:"slash",value:"/",output:""});continue}b.output=b.output.slice(0,-m.output.length),m.type="globstar",m.output=y(Y),m.value+=s,b.output+=m.output,b.globstar=!0,l(s);continue}let U1={type:"star",value:s,output:p};if(Y.bash===!0){if(U1.output=".*?",m.type==="bos"||m.type==="slash")U1.output=x+U1.output;j1(U1);continue}if(m&&(m.type==="bracket"||m.type==="paren")&&Y.regex===!0){U1.output=s,j1(U1);continue}if(b.index===b.start||m.type==="slash"||m.type==="dot"){if(m.type==="dot")b.output+=A,m.output+=A;else if(Y.dot===!0)b.output+=E,m.output+=E;else b.output+=x,m.output+=x;if(W1()!=="*")b.output+=N,m.output+=N}j1(U1)}while(b.brackets>0){if(Y.strictBrackets===!0)throw SyntaxError(bE("closing","]"));b.output=TV.escapeLast(b.output,"["),f1("brackets")}while(b.parens>0){if(Y.strictBrackets===!0)throw SyntaxError(bE("closing",")"));b.output=TV.escapeLast(b.output,"("),f1("parens")}while(b.braces>0){if(Y.strictBrackets===!0)throw SyntaxError(bE("closing","}"));b.output=TV.escapeLast(b.output,"{"),f1("braces")}if(Y.strictSlashes!==!0&&(m.type==="star"||m.type==="bracket"))j1({type:"maybe_slash",value:"",output:`${U}?`});if(b.backtrack===!0){b.output="";for(let s1 of b.tokens)if(b.output+=s1.output!=null?s1.output:s1.value,s1.suffix)b.output+=s1.suffix}return b};lZ1.fastpaths=(J,Q)=>{let Y={...Q},X=typeof Y.maxLength==="number"?Math.min(ul,Y.maxLength):ul,G=J.length;if(G>X)throw SyntaxError(`Input length: ${G}, exceeds maximum allowed length: ${X}`);J=GU0[J]||J;let{DOT_LITERAL:Z,SLASH_LITERAL:q,ONE_CHAR:V,DOTS_SLASH:K,NO_DOT:W,NO_DOTS:H,NO_DOTS_SLASH:z,STAR:U,START_ANCHOR:N}=ml.globChars(Y.windows),M=Y.dot?H:W,L=Y.dot?z:W,A=Y.capture?"":"?:",E={negated:!1,prefix:""},P=Y.bash===!0?".*?":U;if(Y.capture)P=`(${P})`;let I=(x)=>{if(x.noglobstar===!0)return P;return`(${A}(?:(?!${N}${x.dot?K:Z}).)*?)`},R=(x)=>{switch(x){case"*":return`${M}${V}${P}`;case".*":return`${Z}${V}${P}`;case"*.*":return`${M}${P}${Z}${V}${P}`;case"*/*":return`${M}${P}${q}${V}${L}${P}`;case"**":return M+I(Y);case"**/*":return`(?:${M}${I(Y)}${q})?${L}${V}${P}`;case"**/*.*":return`(?:${M}${I(Y)}${q})?${L}${P}${Z}${V}${P}`;case"**/.*":return`(?:${M}${I(Y)}${q})?${Z}${V}${P}`;default:{let g=/^(.*?)\.(\w+)$/.exec(x);if(!g)return;let p=R(g[1]);if(!p)return;return p+Z+g[2]}}},S=TV.removePrefix(J,E),y=R(S);if(y&&Y.strictSlashes!==!0)y+=`${q}?`;return y};ZU0.exports=lZ1});var Nk=f((ag8,VU0)=>{var LX4=XU0(),iZ1=$U0(),qU0=Uk(),AX4=Fk(),OX4=(J)=>J&&typeof J==="object"&&!Array.isArray(J),z2=(J,Q,Y=!1)=>{if(Array.isArray(J)){let H=J.map((U)=>z2(U,Q,Y));return(U)=>{for(let N of H){let M=N(U);if(M)return M}return!1}}let X=OX4(J)&&J.tokens&&J.input;if(J===""||typeof J!=="string"&&!X)throw TypeError("Expected pattern to be a non-empty string");let G=Q||{},Z=G.windows,q=X?z2.compileRe(J,Q):z2.makeRe(J,Q,!1,!0),V=q.state;delete q.state;let K=()=>!1;if(G.ignore){let H={...Q,ignore:null,onMatch:null,onResult:null};K=z2(G.ignore,H,Y)}let W=(H,z=!1)=>{let{isMatch:U,match:N,output:M}=z2.test(H,q,Q,{glob:J,posix:Z}),L={glob:J,state:V,regex:q,posix:Z,input:H,output:M,match:N,isMatch:U};if(typeof G.onResult==="function")G.onResult(L);if(U===!1)return L.isMatch=!1,z?L:!1;if(K(H)){if(typeof G.onIgnore==="function")G.onIgnore(L);return L.isMatch=!1,z?L:!1}if(typeof G.onMatch==="function")G.onMatch(L);return z?L:!0};if(Y)W.state=V;return W};z2.test=(J,Q,Y,{glob:X,posix:G}={})=>{if(typeof J!=="string")throw TypeError("Expected input to be a string");if(J==="")return{isMatch:!1,output:""};let Z=Y||{},q=Z.format||(G?qU0.toPosixSlashes:null),V=J===X,K=V&&q?q(J):J;if(V===!1)K=q?q(J):J,V=K===X;if(V===!1||Z.capture===!0)if(Z.matchBase===!0||Z.basename===!0)V=z2.matchBase(J,Q,Y,G);else V=Q.exec(K);return{isMatch:Boolean(V),match:V,output:K}};z2.matchBase=(J,Q,Y)=>{return(Q instanceof RegExp?Q:z2.makeRe(Q,Y)).test(qU0.basename(J))};z2.isMatch=(J,Q,Y)=>z2(Q,Y)(J);z2.parse=(J,Q)=>{if(Array.isArray(J))return J.map((Y)=>z2.parse(Y,Q));return iZ1(J,{...Q,fastpaths:!1})};z2.scan=(J,Q)=>LX4(J,Q);z2.compileRe=(J,Q,Y=!1,X=!1)=>{if(Y===!0)return J.output;let G=Q||{},Z=G.contains?"":"^",q=G.contains?"":"$",V=`${Z}(?:${J.output})${q}`;if(J&&J.negated===!0)V=`^(?!${V}).*$`;let K=z2.toRegex(V,Q);if(X===!0)K.state=J;return K};z2.makeRe=(J,Q={},Y=!1,X=!1)=>{if(!J||typeof J!=="string")throw TypeError("Expected a non-empty string");let G={negated:!1,fastpaths:!0};if(Q.fastpaths!==!1&&(J[0]==="."||J[0]==="*"))G.output=iZ1.fastpaths(J,Q);if(!G.output)G=iZ1(J,Q);return z2.compileRe(G,Q,Y,X)};z2.toRegex=(J,Q)=>{try{let Y=Q||{};return new RegExp(J,Y.flags||(Y.nocase?"i":""))}catch(Y){if(Q&&Q.debug===!0)throw Y;return/$^/}};z2.constants=AX4;VU0.exports=z2});var WM=f((og8,HU0)=>{var KU0=Nk(),wX4=Uk();function WU0(J,Q,Y=!1){if(Q&&(Q.windows===null||Q.windows===void 0))Q={...Q,windows:wX4.isWindows()};return KU0(J,Q,Y)}Object.assign(WU0,KU0);HU0.exports=WU0});var gE;var nZ1=L1(()=>{gE={name:"amp",description:"The frontier coding agent, with a highly capable `smart` mode and a fast `free` mode. ",private:!0,displayName:"Amp (Research Preview)",version:"0.0.0-dev",publisher:"sourcegraph",license:"Apache-2.0",categories:["AI","Chat","Programming Languages","Machine Learning"],keywords:["sourcegraph","amp","amp code","ampcode","ai","assistant","llm","Claude","Claude Sonnet 4.5","GPT-5","agent","free","Claude Sonnet"],icon:"./resources/amp-icon.png",scripts:{dev:"pnpm run -s dev:desktop","dev:insiders":"pnpm run -s dev:desktop:insiders","dev:watch":"NODE_ENV=development bun run scripts/watch.ts","start:dev:desktop":"node scripts/start-dev.js","start:dev:desktop:insiders":"node scripts/start-dev.js --insiders","start:dev:debugger":"pnpm run -s build:dev:desktop && pnpm run -s ./src/autoedit/webview dev","dev:desktop":"pnpm run -s build:dev:desktop && pnpm run start:dev:desktop","dev:desktop:insiders":"pnpm run -s build:dev:desktop && pnpm run start:dev:desktop:insiders","build:dev:desktop":"NODE_ENV=development bun run scripts/build.ts",build:"pnpm run -s _build:extension && concurrently -n 'debugger,web,review' 'pnpm run -s _build:debugger' 'pnpm run -s _build:web' 'pnpm run -s _build:tab:review'","build:production":"pnpm run -s _build:extension:production && concurrently -n 'debugger,web,review' 'pnpm run -s _build:debugger:production' 'pnpm run -s _build:web:production' 'pnpm run -s _build:tab:review:production'","_build:extension":"NODE_ENV=development bun run scripts/build.ts","_build:extension:production":"NODE_ENV=production bun run scripts/build.ts","_build:web":"pnpm -C ../web run build && cp -R ../web/build dist/web-build","_build:web:production":"pnpm -C ../web run build:production && cp -R ../web/build dist/web-build","_build:debugger":"pnpm -C ./src/autoedit/webview run build && cp -R ./src/autoedit/webview/build dist/autoedit","_build:debugger:production":"cross-env NODE_ENV=production pnpm -C ./src/autoedit/webview run build && cp -R ./src/autoedit/webview/build dist/autoedit","_build:tab:review":"pnpm -C ./src/autoedit/review-panel-webview run build && mkdir -p dist/autoedit && cp -R ./src/autoedit/review-panel-webview/build dist/autoedit/review-panel","_build:tab:review:production":"cross-env NODE_ENV=production pnpm -C ./src/autoedit/review-panel-webview run build && mkdir -p dist/autoedit && cp -R ./src/autoedit/review-panel-webview/build dist/autoedit/review-panel","build:icon-font":"npx -y svgtofont --sources ./icon-font/svg --output ./icon-font/build && cp ./icon-font/build/amp-icons.woff ./resources","dev:forks":"pnpm dev:vsix && cursor --install-extension dist/amp-dev.vsix --force && windsurf --install-extension dist/amp-dev.vsix --force","dev:vsix":"pnpm run -s build && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code --install-extension dist/amp-dev.vsix --force","dev:insiders:vsix":"pnpm run -s build && vsce package --no-dependencies --pre-release --out dist/amp-dev.vsix && code-insiders --install-extension dist/amp-dev.vsix --force","prod:vsix":"pnpm run -s build:production && vsce package --no-dependencies --pre-release --out dist/amp-prod.vsix && code --install-extension dist/amp-prod.vsix --force","prod:vsix:test-manual":"bun run scripts/vsix-test-manual.ts","prod:vsix:test-ci":"bun run scripts/vsix-test-ci.ts",test:"vitest run","test:dev":"vitest"},homepage:"https://ampcode.com",repository:{type:"git",url:"https://github.com/sourcegraph/amp",directory:"vscode"},author:{name:"The Amp Team at Sourcegraph",email:"amp-devs@sourcegraph.com"},engines:{vscode:"^1.79.0",node:">=22.0.0"},main:"./dist/extension.cjs",activationEvents:["onStartupFinished"],extensionDependencies:["vscode.git"],contributes:{languages:[{id:"jsonc",filenamePatterns:["**/Library/Application Support/ampcode/managed-settings.json","**/etc/ampcode/managed-settings.json","**/ProgramData/ampcode/managed-settings.json"]}],viewsContainers:{activitybar:[{id:"sourcegraph-amp",title:"Amp",icon:"./resources/amp-mark.svg"}]},views:{"sourcegraph-amp":[{type:"webview",id:"amp.sidebarView",name:"Amp",icon:"./resources/amp-mark.svg",visibility:"visible"},{type:"webview",id:"amp.reviewPanel",name:"Review",icon:"$(compare-changes)",visibility:"visible",when:"config.amp.review.separatePanel"}]},commands:[{command:"amp.agent.newThread",title:"New Thread",category:"Amp",icon:"$(add)"},{command:"amp.agent.newWindow",title:"New Agent Window",category:"Amp",icon:"$(browser)",enablement:"amp.activated"},{command:"amp.agent.toggleVisibility",title:"Toggle Agent",category:"Amp"},{command:"amp.agent.openReview",title:"Open Amp Review",category:"Amp",icon:"$(compare-changes)",enablement:"amp.activated"},{command:"amp.agent.focusPromptEditor",title:"Focus Prompt Editor",category:"Amp"},{command:"amp.agent.addSelectionToPromptEditor",title:"Add Selection to Prompt",category:"Amp",enablement:"editorHasSelection"},{command:"amp.agent.switchAgentMode",title:"Switch Agent Mode for Current Thread",category:"Amp",enablement:"amp.hasMultipleVisibleModes"},{command:"amp.agent.setPromptFromRecentActions",title:"Create Prompt from Recent Actions",category:"Amp"},{command:"amp.agent.findInThread",title:"Find in Thread",category:"Amp",enablement:"amp.agent.active"},{command:"amp.agent.collapseAllInThread",title:"Collapse All Blocks in Thread",category:"Amp"},{command:"amp.agent.expandAllInThread",title:"Expand All Blocks in Thread",category:"Amp"},{command:"amp.agent.expandToggleInThread",title:"Toggle Expand All Blocks in Thread",category:"Amp"},{command:"amp.agent.toggleThreadSwitcher",title:"Switch to Thread...",category:"Amp",enablement:"amp.agent.active"},{command:"amp.agent.toggleCostDisplay",title:"Toggle Cost Display",category:"Amp"},{command:"amp.agent.navigateThreadPrevious",title:"Navigate to Previous Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",title:"Navigate to Next Thread",category:"Amp",enablement:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.openThreadJSON",title:"Open Thread JSON",category:"Amp",enablement:"amp.isDevelopmentMode"},{command:"amp.testThreadSummary",title:"Test Thread Summary",category:"Amp",enablement:"amp.isDevelopmentMode"},{command:"amp.tab.quickPickMenu",title:"Show Tab Menu",category:"Amp",icon:"$(debug)",enablement:"amp.activated"},{command:"amp.tab.showDebugPanel",title:"Show Tab Debug Panel",category:"Amp",icon:"$(debug)",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.showDiff",title:"Tab: Show Diff",category:"Amp",icon:"$(diff)",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.acceptAll",title:"Tab Review: Accept All Changes",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.diffPanel.instruct",title:"Tab Review: Open Instruct Mode",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled && config.amp.tab.experimental.review"},{command:"amp.tab.manualTrigger",title:"Tab Manual Trigger",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.enable",title:"Enable Tab",category:"Amp",enablement:"amp.activated && !config.amp.tab.enabled"},{command:"amp.tab.disable",title:"Disable Tab",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.toggleForCurrentDocument",title:"Toggle Tab for Current Document",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.debugInfo",title:"Open Tab Debug Info",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.tab.autoAcceptChain",title:"Accept Suggestion Chain",category:"Amp",enablement:"amp.activated && config.amp.tab.enabled"},{command:"amp.mcp.restartServers",title:"Restart MCP Servers",category:"Amp"},{command:"amp.connect.reconnect",title:"Reconnect",category:"Amp",enablement:"amp.activated"},{command:"amp.agent.editUserPermissions",title:"Edit User Permissions",category:"Amp"},{command:"amp.agent.editWorkspacePermissions",title:"Edit Workspace Permissions",category:"Amp"},{command:"amp.commandPalette.show",title:"Show Amp Command Palette",category:"Amp",icon:"$(list-flat)"}],menus:{"editor/context":[{command:"amp.agent.addSelectionToPromptEditor",when:"editorHasSelection",group:"amp@1"}]},keybindings:[{command:"amp.agent.newThread",key:"ctrl+l",mac:"cmd+l",when:"amp.primaryShortcuts"},{command:"amp.agent.newThread",key:"ctrl+alt+j",mac:"cmd+alt+j",when:"!amp.primaryShortcuts"},{command:"amp.agent.newWindow",key:"ctrl+shift+l",mac:"cmd+shift+l"},{command:"amp.agent.toggleVisibility",key:"ctrl+i",mac:"cmd+i",when:"amp.primaryShortcuts"},{command:"amp.agent.toggleVisibility",key:"ctrl+alt+u",mac:"cmd+alt+u",when:"!amp.primaryShortcuts"},{command:"amp.agent.findInThread",key:"ctrl+f",mac:"cmd+f",when:"amp.agent.active"},{command:"amp.agent.toggleThreadSwitcher",key:"ctrl+k",mac:"cmd+k",when:"amp.agent.active"},{command:"amp.agent.toggleCostDisplay",key:"ctrl+d",mac:"cmd+d",when:"amp.agent.active && amp.isSourcegraphTeammate || isWeb"},{command:"amp.agent.navigateThreadPrevious",key:"ctrl+shift+[",mac:"cmd+shift+[",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.navigateThreadNext",key:"ctrl+shift+]",mac:"cmd+shift+]",when:"amp.agent.active && amp.agent.activeView == 'sidebar'"},{command:"amp.agent.savePermissions",key:"ctrl+s",mac:"cmd+s",enablement:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i",when:"editorTextFocus && resourcePath =~ /[\\\\/]amp[\\\\/]permissions-.*\\.sh$/i"},{command:"amp.tab.diffPanel.acceptAll",key:"ctrl+enter",mac:"cmd+enter",when:"activeWebviewPanelId == 'ampTabDiff'"},{command:"amp.tab.diffPanel.instruct",key:"ctrl+i",mac:"cmd+i",when:"activeWebviewPanelId == 'ampTabDiff'"},{command:"amp.agent.openReview",key:"ctrl+;",mac:"cmd+;"},{command:"-extension.vim_tab",key:"tab",when:"editorTextFocus && vim.active && vim.mode != 'Insert' && !inlineEditIsVisible && !inDebugRepl"},{command:"-vscode-neovim.send",key:"tab",when:"neovim.init && (editorTextFocus && neovim.mode != insert && editorLangId not in neovim.editorLangIdExclusions || neovim.recording)"},{command:"amp.tab.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.showDiff",key:"shift+tab",when:"editorTextFocus && amp.activated && config.amp.tab.experimental.review && (amp.tab.active || inlineSuggestionVisible) && !amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.dismiss",key:"escape",when:"editorTextFocus && amp.activated && amp.tab.active && !amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.accept",key:"tab",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.nextCursor.discard",key:"escape",when:"editorTextFocus && amp.activated && amp.nextCursorSuggested && !suggestWidgetVisible && !amp.editorHasMultipleLineSelection"},{command:"amp.tab.autoAcceptChain",key:"alt+shift+tab",when:"editorTextFocus && amp.activated && (amp.tab.active || amp.nextCursorSuggested) && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.accept",key:"tab",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.autoImport.discard",key:"escape",when:"editorTextFocus && amp.activated && config.amp.tab.enabled && amp.autoImportSuggested && !amp.editorHasMultipleLineSelection"},{command:"amp.commandPalette.show",key:"ctrl+shift+a",mac:"cmd+shift+a",when:"amp.activated"},{command:"amp.agent.switchAgentMode",key:"ctrl+shift+m",mac:"cmd+shift+m",when:"amp.activated && amp.hasMultipleVisibleModes"}],configuration:{type:"object",title:"Amp",properties:{"amp.url":{type:"string",examples:["https://ampcode.com/"],description:"URL to the Amp server, usually https://ampcode.com/",scope:"application"},"amp.notifications.enabled":{type:"boolean",default:!0,description:"Play notification sound when done or blocked",scope:"window"},"amp.mcpServers":{type:"object",description:"Model Context Protocol servers that expose tools",additionalProperties:{type:"object",oneOf:[{properties:{command:{type:"string"},args:{type:"array",items:{type:"string"}},env:{type:"object",additionalProperties:{type:"string"}}},required:["command"]},{properties:{url:{type:"string"},headers:{type:"object",description:"HTTP headers to send with requests to the MCP server",additionalProperties:{type:"string"}},oauth:{type:"object",description:"OAuth 2.0 configuration for MCP server authentication",properties:{clientId:{type:"string",description:"OAuth client ID"},clientSecret:{type:"string",description:"OAuth client secret (optional for public clients)"},authUrl:{type:"string",description:"OAuth authorization endpoint URL"},tokenUrl:{type:"string",description:"OAuth token endpoint URL"},scopes:{type:"array",description:"OAuth scopes to request",items:{type:"string"}},redirectUrl:{type:"string",description:"OAuth redirect URL (defaults to http://localhost:8976/oauth/callback)"}}}},required:["url"]}]}},"amp.mcpTrustedServers":{type:"array",markdownDescription:"MCP server trust decisions. **Security Note:** This setting is only read from user settings, never workspace settings, to prevent malicious repositories from auto-approving MCP servers.",scope:"application",items:{type:"object",properties:{serverName:{type:"string",description:"MCP server name"},specHash:{type:"string",description:"Hash of the server configuration"},allow:{type:"boolean",description:"Whether this server is approved"}},required:["serverName","specHash","allow"]}},"amp.workspaces":{type:"array",markdownDescription:"Workspace-level configuration. This setting is only read from user settings, never workspace settings.",scope:"application",items:{type:"object",properties:{path:{type:"string",description:"Absolute path to the workspace"},allowAllMcpServers:{type:"boolean",description:"Whether to automatically trust all MCP servers in this workspace"}},required:["path"]}},"amp.mcpPermissions":{type:"array",description:"Permissions for Model Context Protocol (MCP) servers. Controls which MCP servers can be used.",items:{type:"object",properties:{matches:{$ref:"https://static.ampcode.com/schemas/permissions.schema.json#/$defs/permissionMatchCondition"},action:{type:"string",enum:["allow","reject"],description:"Whether to allow or reject MCP servers matching the condition"}},required:["matches","action"],additionalProperties:!1},default:[],scope:"application"},"amp.permissions":{$ref:"https://static.ampcode.com/schemas/permissions.schema.json",description:"Entries checked in sequence to configure tool permissions",default:[]},"amp.experimental.promptAutocomplete.verboseLogging":{type:"boolean",default:!1,markdownDescription:"Enable verbose logging for prompt autocomplete.",scope:"application"},"amp.experimental.tools":{type:"array",description:"Enable experimental tools by name. Available tools: kraken",items:{type:"string"},default:[],scope:"application"},"amp.tools.disable":{type:"array",markdownDescription:'Disable specific tools by name. Glob patterns using * are supported\n\nExamples:\n- Disable edit_file: `["builtin:edit_file"]`\n- Disable all playwright tab tools: `["mcp__playwright__browser_tab*"]`',items:{type:"string"},default:[]},"amp.toolbox.path":{type:"string",markdownDescription:"Path to the directory containing toolbox scripts. Supports colon-separated paths.",scope:"window"},"amp.dangerouslyAllowAll":{type:"boolean",description:"If true, never ask for confirmation when running commands",scope:"window",default:!1},"amp.model.sonnet":{type:"boolean",description:"Use Claude Sonnet 4.5 instead of Claude Opus 4.5",scope:"window",default:!1},"amp.guardedFiles.allowlist":{type:"array",description:"Glob patterns for files that should bypass guarded file protection. Files matching these patterns can be modified without user confirmation.",items:{type:"string"},default:[],scope:"window"},"amp.anthropic.thinking.enabled":{type:"boolean",default:!0,description:"Enable Claude's extended thinking capabilities",scope:"application"},"amp.tools.inactivityTimeout":{type:"number",default:300,minimum:1,maximum:3600,description:"How many seconds of no output to wait before canceling bash commands.",scope:"workspace"},"amp.tools.stopTimeout":{type:"number",default:300,description:"How many seconds to wait before canceling a running tool.",scope:"application"},"amp.terminal.commands.nodeSpawn.loadProfile":{type:"string",enum:["always","never","daily"],default:"always",description:"Before running commands (including MCP servers), whether to load environment variables from the user's profile (.bashrc, .zshrc, .envrc) as visible from the workspace root directory.",scope:"application"},"amp.todos.enabled":{type:"boolean",default:!0,description:"Enable TODOs tracking for managing tasks",scope:"application"},"amp.guidanceFiles.specs":{type:"boolean",default:!1,description:"[Experimental] Read `*.spec.md` files adjacent to `AGENT.md` files that are read",scope:"window"},"amp.security.audit.logMcpConnections":{type:"boolean",default:!1,description:"Enable telemetry logging for remote MCP server connections (for security auditing)",scope:"application"},"amp.review.separatePanel":{type:"boolean",default:!1,description:"Show the review panel as a separate container that's independently draggable to a different sidebar location.",scope:"window"},"amp.hooks":{type:"array",scope:"window",description:"[Experimental] Hooks are event handlers that can react to specific conditions.",items:{type:"object",properties:{compatibilityDate:{type:"string",const:"2025-05-13",default:"2025-05-13",description:"The version of the hook schema that this value was written to conform to"},id:{type:"string",description:"A unique identifier for the hook",examples:["run-vitest-with-env-vars"]},description:{type:"string",description:"A description of the hook"},on:{oneOf:[{type:"object",properties:{event:{type:"string",const:"tool:pre-execute",default:"tool:pre-execute",description:"Trigger when a tool is about to be executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"},"input.contains":{oneOf:[{type:"string",description:"String pattern to match in the tool input"},{type:"array",items:{type:"string"},description:"String patterns to match in the tool input"}],description:"Trigger only when the tool input contains the given literal string or strings"}},required:["event","tool","input.contains"]},{type:"object",properties:{event:{type:"string",const:"tool:post-execute",default:"tool:post-execute",description:"Trigger after a tool has been executed"},tool:{oneOf:[{type:"string",description:"Tool name to match (e.g., 'edit_file')"},{type:"array",items:{type:"string"},description:"Tool names to match"}],description:"Trigger for the given tool name(s)"}},required:["event","tool"]}]},action:{oneOf:[{type:"object",properties:{type:{type:"string",const:"send-user-message",default:"send-user-message",description:"Send a user message to interrupt the agent and cancel the tool call in the `tool:pre-execute` trigger before it starts to run"},message:{type:"string",description:"The text of the message to send"}},required:["type","message"]},{type:"object",properties:{type:{type:"string",const:"redact-tool-input",default:"redact-tool-input",description:"Redact the tool input after execution. Only allowed with `tool:post-execute` event."},redactedInput:{type:"object",description:"The replacement input data to use instead of the original tool input (must be an object)"}},required:["type","redactedInput"]}]},if:{type:"boolean",description:"A condition that determines whether the hook should be executed",default:!0}},required:["compatibilityDate","id","on","action"]},default:[]},"amp.tab.enabled":{type:"boolean",default:!1,description:"Enable Amp Tab",scope:"application"},"amp.tab.clipboard.enabled":{type:"boolean",default:!0,description:"Enable clipboard access for Amp Tab context",scope:"application"},"amp.tab.verboseLogs":{type:"boolean",default:!1,description:"Enable verbose logging for Amp Tab",scope:"application"},"amp.debugLogs":{type:"boolean",default:!1,description:"Enable debug logging in the Amp output channel",scope:"application"},"amp.tab.disabledLanguages":{type:"array",items:{type:"string"},default:[],examples:["markdown","python"],description:"List of language IDs for which Amp Tab is disabled",scope:"application"},"amp.tab.disableOnComment":{type:"boolean",default:!1,description:"Disable Amp Tab completions on comment lines",scope:"application"},"amp.tab.autoImport.enabled":{type:"boolean",default:!0,description:"Enable auto import in Amp Tab",scope:"application"},"amp.tab.dismissCommandIds":{type:"array",items:{type:"string"},default:["extension.vim_escape","vim.escape","vscode-neovim.escape","vscode-neovim.escapeKey"],description:"Command IDs to run when Escape is pressed to dismiss an Amp Tab suggestion",scope:"application"},"amp.tab.experimental.showHotStreakProgress":{type:"boolean",default:!1,description:"Experimental: Show hot streak progress in image-rendered suggestions",scope:"window"},"amp.tab.experimental.autoAccept.delayMs":{type:"number",default:0,description:"Experimental: Delay in milliseconds before auto-accepting Amp Tab suggestions",scope:"application"},"amp.tab.experimental.unobtrusiveDiffs":{type:"boolean",default:!1,description:"Experimental: Enable unobtrusive diffs mode for Amp Tab suggestions. When enabled, suggestions are shown as image overlays to avoid layout shifts and visual interference with existing code.",scope:"application"},"amp.tab.experimental.review":{type:"boolean",default:!1,description:"Experimental: Enable review mode for Amp Tab. When enabled, adds the ability to review suggestion changes with Shift+Tab shortcut and review panel.",scope:"window"},"amp.tab.diagnosticTracking":{type:"string",enum:["disabled","same_file","multi_file"],default:"multi_file",description:"Enable diagnostic tracking for Amp Tab suggestions. 'disabled' = no tracking, 'same_file' = track diagnostics within the same file, 'multi_file' = track diagnostics across multiple files.",scope:"application"},"amp.tab.hoverDiagnosticSuggestions":{type:"boolean",default:!1,description:"Show suggestions when hovering over diagnostics.",scope:"application"},"amp.tab.experimental.displayMode":{type:"string",enum:["eager","subtle"],default:"eager",description:"Experimental: Control how Amp Tab suggestions are displayed. 'eager' = show diff immediately, 'subtle' = show 'Tab to Jump' first, then show diff after user interaction.",scope:"application"},"amp.tab.experimental.disableClientFilters":{type:"array",items:{type:"string",enum:["recentlyRejectedCodeToRewrite","recentEdits","rewriteAreaOverlap","bigModification","incompatibleWithSelectedCompletionContextItem","recentlyRejectedDiff","whiteSpaceOnlyChange","formattingOnlyChange"]},default:[],description:"Experimental: Disable specific client-side filters to observe unfiltered model behavior.",scope:"application"},"amp.ui.zoomLevel":{type:"number",default:1,description:"Zoom level for the Amp UI",scope:"application"},"amp.experimental.bookkeeper":{type:"boolean",default:!1,description:"Enable the Bookkeeper subagent for reading and querying Excel workbooks (.xlsx)",scope:"window"},"amp.experimental.planMode":{type:"boolean",default:!1,description:"Enable plan mode for collaborative planning before execution",scope:"window"},"amp.experimental.reviewSubagent":{type:"boolean",default:!1,description:"Enable the review subagent for code review",scope:"window"},"amp.experimental.dojoMode":{type:"boolean",default:!1,description:"Enable dojo mode - a learning mode that guides you to discover solutions yourself",scope:"window"},"amp.git.commit.coauthor.enabled":{type:"boolean",default:!0,description:"Enable adding Amp as co-author in git commits",scope:"window"},"amp.git.commit.ampThread.enabled":{type:"boolean",default:!0,description:"Enable adding Amp-Thread trailer in git commits",scope:"window"}}},icons:{"amp-agent-file":{description:"Amp agent file",default:{fontPath:"resources/amp-icons.woff",fontCharacter:"\\0041"}}}},capabilities:{untrustedWorkspaces:{supported:"limited",description:"Amp only uses MCP servers from trusted workspaces because they execute code.",restrictedConfigurations:["amp.mcpServers","amp.mcpPermissions","amp.url"]},virtualWorkspaces:{supported:!1,description:"Amp is not supported in virtual workspaces like GitHub.dev because Amp requires local file system access and terminal capabilities."}},dependencies:{"@anthropic-ai/sdk":"catalog:","@opentelemetry/api":"^1.9.0","@opentelemetry/api-logs":"^0.57.2","@opentelemetry/core":"^1.30.1","@opentelemetry/exporter-logs-otlp-http":"^0.57.2","@opentelemetry/exporter-metrics-otlp-http":"^0.57.2","@opentelemetry/exporter-trace-otlp-http":"^0.57.2","@opentelemetry/resources":"^1.30.1","@opentelemetry/sdk-logs":"^0.57.2","@opentelemetry/sdk-metrics":"^1.30.1","@opentelemetry/sdk-node":"^0.57.2","@opentelemetry/sdk-trace-base":"^1.30.1","@opentelemetry/sdk-trace-node":"^1.30.1","@opentelemetry/semantic-conventions":"^1.34.0","@sourcegraph/amp-core":"workspace:*","@sourcegraph/amp-uri":"workspace:*","@sourcegraph/observable":"workspace:*","canvaskit-wasm":"^0.40.0","detect-indent":"^7.0.1",diff:"catalog:","fast-json-stable-stringify":"^2.1.0","fast-myers-diff":"^3.2.0","fast-xml-parser":"^5.2.3",isbinaryfile:"^5.0.5","jsonc-parser":"^3.3.1",lodash:"^4.17.21","lru-cache":"^11.1.0","node-fetch":"^3.3.2",shiki:"3.8.1",systeminformation:"^5.27.7",uuid:"^11.1.0","vscode-languageserver-textdocument":"^1.0.12","wink-nlp-utils":"^2.1.0",ws:"^8.18.3"},devDependencies:{"@secretlint/secretlint-rule-no-dotenv":"^11.2.5","@secretlint/secretlint-rule-preset-recommend":"^11.2.5","@sourcegraph/amp-web":"workspace:*","@types/bun":"^1.2.17",dedent:"catalog:","@types/diff":"catalog:","@types/jest-image-snapshot":"^6.4.0","@types/lodash":"^4.17.15","@types/node":"catalog:","@types/uuid":"^10.0.0","@types/vscode":"^1.79.0","@types/ws":"^8.18.1","@vscode/test-electron":"^2.4.1","@vscode/vsce":"^3.2.2","cross-env":"^7.0.3","crypto-browserify":"^3.12.1","jest-image-snapshot":"^6.5.0","os-browserify":"^0.3.0","path-browserify":"^1.0.1","rollup-plugin-polyfill-node":"^0.13.0",tsx:"^4.19.4"}}});function IX4(J){return typeof J==="number"&&Number.isInteger(J)&&J>=1&&J<=3600}function FU0(J){let Q=J.settings["tools.inactivityTimeout"],Y=J.settings["tools.stopTimeout"],X=Q;if(X===void 0&&Y!==void 0)X=Y;if(X===void 0)X=gE.contributes.configuration.properties["amp.tools.inactivityTimeout"].default;if(!IX4(X))return null;return X*1000}function UU0(J){let Q=J.settings["tools.stopTimeout"],Y=gE.contributes.configuration.properties["amp.tools.stopTimeout"].default;return(Q??Y)*1000}var zU0;var pl=L1(()=>{nZ1();zU0=gE.contributes.configuration.properties});function YJ(J){let Q=V9[J];return`${Q.provider}/${Q.name}`}function bG(J){let[Q,Y]=J.split("/");for(let X of Object.values(V9))if(X.provider===Q&&X.name===Y)return X;switch(Q){case"anthropic":return V9.CLAUDE_SONNET_4_5;case"openai":return V9.GPT_5;case"xai":return V9.GROK_CODE_FAST_1;case"cerebras":return V9.Z_AI_GLM_4_6;case"fireworks":return V9.FIREWORKS_GLM_4P6;case"moonshotai":return V9.KIMI_K2_INSTRUCT;case"openrouter":return V9.SONOMA_SKY_ALPHA;case"groq":return V9.GPT_OSS_120B;case"vertexai":return V9.GEMINI_2_5_FLASH_PREVIEW_09_2025;default:throw Error(`Unknown provider: ${Q}`)}}function gG(J){let Q=J.indexOf("/");if(Q===-1)return J;return J.slice(Q+1)}function bW(J,Q){let Y=bG(J);if(Q&&Y.maxInputTokensInFreeMode)return Y.maxInputTokensInFreeMode;return Y.contextWindow-Y.maxOutputTokens}var S9,V9,aZ1;var gW=L1(()=>{S9={ANTHROPIC:"anthropic",OPENAI:"openai",XAI:"xai",CEREBRAS:"cerebras",FIREWORKS:"fireworks",GROQ:"groq",MOONSHOT:"moonshotai",OPENROUTER:"openrouter",VERTEXAI:"vertexai"},V9={CLAUDE_SONNET_4:{provider:S9.ANTHROPIC,name:"claude-sonnet-4-20250514",displayName:"Claude Sonnet 4",contextWindow:1e6,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_SONNET_4_5:{provider:S9.ANTHROPIC,name:"claude-sonnet-4-5-20250929",displayName:"Claude Sonnet 4.5",contextWindow:1e6,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4:{provider:S9.ANTHROPIC,name:"claude-opus-4-20250514",displayName:"Claude Opus 4",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_1:{provider:S9.ANTHROPIC,name:"claude-opus-4-1-20250805",displayName:"Claude Opus 4.1",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_OPUS_4_5:{provider:S9.ANTHROPIC,name:"claude-opus-4-5-20251101",displayName:"Claude Opus 4.5",contextWindow:200000,maxOutputTokens:32000,capabilities:{reasoning:!0,vision:!0,tools:!0}},CLAUDE_HAIKU_4_5:{provider:S9.ANTHROPIC,name:"claude-haiku-4-5-20251001",displayName:"Claude Haiku 4.5",contextWindow:200000,maxOutputTokens:64000,capabilities:{reasoning:!0,vision:!0,tools:!0},freeTierEligible:!0,maxInputTokensInFreeMode:120000},GPT_5:{provider:S9.OPENAI,name:"gpt-5",displayName:"GPT-5",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_1:{provider:S9.OPENAI,name:"gpt-5.1",displayName:"GPT-5.1",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_CODEX:{provider:S9.OPENAI,name:"gpt-5-codex",displayName:"GPT-5 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_1_CODEX:{provider:S9.OPENAI,name:"gpt-5.1-codex",displayName:"GPT-5.1 Codex",contextWindow:400000,maxOutputTokens:128000,pricing:{input:1.25,output:10,cached:0.125},capabilities:{reasoning:!0,tools:!0}},GPT_5_MINI:{provider:S9.OPENAI,name:"gpt-5-mini",displayName:"GPT-5 Mini",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.25,output:2,cached:0.025},capabilities:{reasoning:!0,vision:!0,tools:!0}},GPT_5_NANO:{provider:S9.OPENAI,name:"gpt-5-nano",displayName:"GPT-5 Nano",contextWindow:400000,maxOutputTokens:128000,pricing:{input:0.05,output:0.4,cached:0.005},capabilities:{reasoning:!0,vision:!0,tools:!0}},O3:{provider:S9.OPENAI,name:"o3",displayName:"o3",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:2,output:8,cached:0.5},capabilities:{reasoning:!0,tools:!0}},O3_MINI:{provider:S9.OPENAI,name:"o3-mini",displayName:"o3-mini",contextWindow:200000,maxOutputTokens:1e5,pricing:{input:1.1,output:4.4,cached:0.55},capabilities:{reasoning:!0,tools:!0}},GPT_OSS_120B:{provider:S9.OPENAI,name:"openai/gpt-oss-120b",displayName:"GPT OSS 120B",contextWindow:128000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0}},GROK_CODE_FAST_1:{provider:S9.XAI,name:"grok-code-fast-1",displayName:"Grok Code Fast 1",contextWindow:256000,maxOutputTokens:32000,capabilities:{reasoning:!0,tools:!0},freeTierEligible:!0},GEMINI_2_5_PRO:{provider:S9.VERTEXAI,name:"gemini-2.5-pro",displayName:"Gemini 2.5 Pro",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH:{provider:S9.VERTEXAI,name:"gemini-2.5-flash",displayName:"Gemini 2.5 Flash",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},GEMINI_2_5_FLASH_PREVIEW_09_2025:{provider:S9.VERTEXAI,name:"gemini-2.5-flash-preview-09-2025",displayName:"Gemini 2.5 Flash (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE:{provider:S9.VERTEXAI,name:"gemini-2.5-flash-lite",displayName:"Gemini 2.5 Flash Lite",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_2_5_FLASH_LITE_PREVIEW_09_2025:{provider:S9.VERTEXAI,name:"gemini-2.5-flash-lite-preview-09-2025",displayName:"Gemini 2.5 Flash Lite (Preview)",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0},freeTierEligible:!0},GEMINI_3_PRO_PREVIEW:{provider:S9.VERTEXAI,name:"gemini-3-pro-preview",displayName:"Gemini 3 Pro Preview",contextWindow:1048576,maxOutputTokens:65535,capabilities:{tools:!0,reasoning:!0,vision:!0}},Z_AI_GLM_4_6:{provider:S9.CEREBRAS,name:"zai-glm-4.6",displayName:"Z.ai GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},FIREWORKS_QWEN3_CODER_480B:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/qwen3-coder-480b-a35b-instruct",displayName:"Qwen3 Coder 480B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_KIMI_K2_INSTRUCT:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_QWEN3_235B:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/qwen3-235b-a22b-instruct-2507",displayName:"Qwen3 235B",contextWindow:230144,maxOutputTokens:32000,capabilities:{tools:!0}},FIREWORKS_GLM_4P6:{provider:S9.FIREWORKS,name:"accounts/fireworks/models/glm-4p6",displayName:"GLM 4P6",contextWindow:162752,maxOutputTokens:40000,capabilities:{tools:!0}},KIMI_K2_INSTRUCT:{provider:S9.MOONSHOT,name:"kimi-k2-instruct-0905",displayName:"Kimi K2 Instruct",contextWindow:1e6,maxOutputTokens:32000,capabilities:{tools:!0}},SONOMA_SKY_ALPHA:{provider:S9.OPENROUTER,name:"sonoma-sky-alpha",displayName:"Sonoma Sky Alpha",contextWindow:256000,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_GLM_4_6:{provider:S9.OPENROUTER,name:"z-ai/glm-4.6",displayName:"OpenRouter GLM 4.6",contextWindow:131000,maxOutputTokens:40000,capabilities:{tools:!0}},OPENROUTER_KIMI_K2_0905:{provider:S9.OPENROUTER,name:"moonshotai/kimi-k2-0905",displayName:"Kimi K2 0905 (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_CODER_480B:{provider:S9.OPENROUTER,name:"qwen/qwen3-coder",displayName:"Qwen3 Coder 480B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}},OPENROUTER_QWEN3_235B:{provider:S9.OPENROUTER,name:"qwen/qwen3-235b-a22b-2507",displayName:"Qwen3 235B A22B (OpenRouter)",contextWindow:262144,maxOutputTokens:32000,capabilities:{tools:!0}}};aZ1={FINDER:"finder"}});function oZ1(J,Q){let Y=RV(Q);if(!Y)return!1;if(PX4.has(J)){let X=Y.finder??aZ1.FINDER,G=TX4[X];if(J!==G)return!1}if(Y.includeTools)return Y.includeTools.includes(J);return!0}function mG(J,Q){let Y=J?.["internal.visibleModes"]??[];return Object.values(mE).filter((X)=>{if(Y.includes(`!${X.key}`))return!1;if(Q===!1&&I5(X.key))return!1;let Z="visible"in X?X.visible:!1,q=Y.includes(X.key),V=X.key==="plan"&&J?.["experimental.planMode"]===!0,K=J?.["experimental.dojoMode"]===!0;if(X.key==="free-dojo")return K&&(Q===!0||Q===void 0);if(X.key==="dojo")return K&&(Q===!1||Q===void 0);return Z||q||V}).map((X)=>({mode:X.key,description:"description"in X?X.description:void 0})).sort((X,G)=>X.mode.localeCompare(G.mode))}function RV(J){return Object.values(mE).find((Q)=>Q.key===J)}function Dk(J){return RV(J)?.primaryModel??YJ("CLAUDE_SONNET_4_5")}function Mk(J){let Q=RV(J);if(!Q)return!1;return bG(Q.primaryModel).capabilities?.vision??!1}function I5(J){return J==="free"||J.startsWith("free-")}function rZ1(J,Q){return Q.find((Y)=>Y.mode===J)?.description}function Lk(J,Q){let X=(Q.findIndex((Z)=>Z.mode===J)+1)%Q.length;return Q[X]?.mode??"smart"}var PX4,TX4,NU0,DU0,RX4,CX4,BU0,jX4,SX4,mE,_X4;var T$=L1(()=>{gW();PX4=new Set(["finder"]),TX4={finder:"finder"},NU0={r:0,g:55,b:0},DU0={r:0,g:255,b:136},RX4=["Read","Grep","glob","finder","Bash","InteractiveShell","create_file","edit_file","format_file","get_diagnostics","web_search","read_web_page","todo_read","todo_write","read_thread","skill"],CX4=["Read","Grep","glob","finder","Bash","InteractiveShell","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","read_thread","skill","oracle","librarian","Task","kraken"],BU0=["Read","Grep","glob","finder","Bash","get_diagnostics","web_search","read_web_page","mermaid"],jX4=["Read","Grep","glob","finder","librarian","edit_plan","read_plan","web_search","read_web_page"],SX4=["Read","Grep","glob","finder","Bash","InteractiveShell","create_file","edit_file","format_file","undo_edit","get_diagnostics","web_search","read_web_page","read_mcp_resource","mermaid","todo_read","todo_write","read_thread","skill","oracle","librarian","Task","kraken","edit_plan","read_plan","code_review"],mE={SMART:{key:"smart",displayName:"Smart",description:"The most capable model and set of tools",primaryModel:YJ("CLAUDE_OPUS_4_5"),includeTools:SX4,visible:!0,uiHints:{labelAnimation:"glow",primaryColor:{r:0,g:55,b:20},secondaryColor:{r:0,g:255,b:136}}},FREE:{key:"free",displayName:"Free",description:"Amp Free",primaryModel:YJ("CLAUDE_HAIKU_4_5"),includeTools:RX4,visible:!0,uiHints:{primaryColor:{r:0,g:26,b:51},secondaryColor:{r:0,g:184,b:255}}},RUSH:{key:"rush",displayName:"Rush",description:"Faster and cheaper for small, well-defined tasks",primaryModel:YJ("CLAUDE_HAIKU_4_5"),includeTools:CX4,visible:!0,uiHints:{fasterAnimation:!0,labelAnimation:"jitter",primaryColor:{r:128,g:51,b:0},secondaryColor:{r:255,g:215,b:0}}},PLAN:{key:"plan",displayName:"Plan",description:"Collaborative planning mode",primaryModel:YJ("GPT_5_1_CODEX"),includeTools:jX4,visible:!1,uiHints:{primaryColor:{r:192,g:80,b:192},secondaryColor:{r:64,g:64,b:255}}},DOJO_FREE:{key:"free-dojo",displayName:"Dojo (Free)",description:"Learning mode - guides you to discover solutions yourself",primaryModel:YJ("CLAUDE_HAIKU_4_5"),includeTools:BU0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}},DOJO:{key:"dojo",displayName:"Dojo",description:"Learning mode - guides you to discover solutions yourself",primaryModel:YJ("CLAUDE_SONNET_4_5"),includeTools:BU0,visible:!1,uiHints:{primaryColor:{r:26,g:77,b:46},secondaryColor:{r:212,g:175,b:55}}}},_X4=Object.values(mE).map((J)=>J.key)});function dl(J,Q,Y){if(J.startsWith("mcp__"))return Q.allowMcp??!1;if(J.startsWith("tb__")){if(!(Q.allowToolbox??!1))return!1;let X="subagentType"in Q?Q.subagentType:void 0;if(X&&Y){if(!Y.subagentTypes)return!1;return Y.subagentTypes.includes("all")||Y.subagentTypes.includes(X)}return!0}return Q.includeTools.includes(J)}var kX4,yX4,sZ1,xX4,vX4,fX4,hX4,bX4,f2,Xm8;var mW=L1(()=>{gW();kX4=["read_github","search_github","commit_search","diff","list_directory_github","list_repositories","glob_github"],yX4=["Grep","glob","Read"],sZ1=["Read","Grep","glob","web_search","read_web_page","read_thread"],xX4=["Grep","glob","Read","Bash","edit_file","create_file","format_file","read_web_page","get_diagnostics","web_search","finder"],vX4=["Read","glob","Grep","enqueue_file_edit","fastmod"],fX4=["create_file","edit_file","glob","Read","Grep","format_file","get_diagnostics"],hX4=["describe_workbook","execute_query"],bX4=["Read","Grep","glob","web_search","read_web_page","Bash"],f2={finder:{key:"finder",displayName:"Finder",model:YJ("CLAUDE_HAIKU_4_5"),includeTools:yX4,allowMcp:!1,allowToolbox:!1},oracle:{key:"oracle",displayName:"Oracle",model:YJ("GPT_5_1"),includeTools:sZ1,allowMcp:!1,allowToolbox:!1},librarian:{key:"librarian",displayName:"Librarian",model:YJ("CLAUDE_HAIKU_4_5"),includeTools:kX4,allowMcp:!1,allowToolbox:!1},"task-subagent":{key:"task-subagent",displayName:"Task Subagent",model:void 0,includeTools:xX4,allowMcp:!0,allowToolbox:!0},"kraken-scope":{key:"kraken-scope",displayName:"Kraken Scope",model:YJ("CLAUDE_HAIKU_4_5"),includeTools:vX4,allowMcp:!1,allowToolbox:!0,subagentType:"scope"},"kraken-executor":{key:"kraken-executor",displayName:"Kraken Executor",model:YJ("CLAUDE_HAIKU_4_5"),includeTools:fX4,allowMcp:!1,allowToolbox:!0,subagentType:"executor"},bookkeeper:{key:"bookkeeper",displayName:"Bookkeeper",model:YJ("CLAUDE_HAIKU_4_5"),includeTools:hX4,allowMcp:!1,allowToolbox:!1},"code-review":{key:"code-review",displayName:"Code Review",model:YJ("CLAUDE_SONNET_4_5"),includeTools:bX4,allowMcp:!1,allowToolbox:!1}},Xm8=Object.keys(f2)});function MU0(J,Q){return new X0((Y)=>{let X=setTimeout(G,Q);function G(){Y.error(Error(`Tool execution timed out after ${Q/1000} seconds`))}function Z(){if(X)clearTimeout(X);X=setTimeout(G,Q)}let q=J.subscribe({next:(V)=>{Z(),Y.next(V)},error:(V)=>{if(X)clearTimeout(X),X=null;Y.error(V)},complete:()=>{if(X)clearTimeout(X),X=null;Y.complete()}});return()=>{if(X)clearTimeout(X),X=null;q.unsubscribe()}})}var LU0=L1(()=>{r0()});function g7(J,Q){let Y={name:Q.name,description:Q.description,inputSchema:Q.inputSchema,source:Q.source,meta:Q.meta,customizedForModel:!1},X=Q.modelCustomizations;if(X){for(let G of X)if(G.modelSelector.test(J))Y={...Y,name:G.name??Y.name,description:G.description??Y.description,inputSchema:G.inputSchema??Y.inputSchema,customizedForModel:!0}}return Y}function F2(J){return["done","error","rejected-by-user","cancelled"].includes(J.status)}function wU0(J){return["done","error","cancelled"].includes(J.status)}function tZ1(J){return typeof J==="object"&&"key"in J}function cl(J){let Q=[],Y=new y4,X;function G(q,V){let K=Q.filter((W)=>W.spec.name===q);if(K.length===0&&q==="Glob")K=Q.filter((W)=>W.spec.name==="glob");for(let W of K)if(pE(W.spec,V).enabled)return W;return}function Z(q,V,K){if(!q)throw Error("spec is required");let W=Q.findIndex((L)=>L.spec.name===q.name),H=W!==-1?Q[W]:void 0;if(q.source!=="builtin"&&H?.spec.source==="builtin")return h.warn("Ignoring external tool registration - builtin takes precedence",{toolName:q.name,externalSource:q.source}),{dispose:()=>{}};let N={spec:q,fn:Promise.resolve(V),preprocessArgs:K};if(H&&JSON.stringify(H.spec.source)===JSON.stringify(q.source))h.debug("Replacing existing tool registration (idempotent)",{toolName:q.name,source:q.source}),Q[W]=N;else Q.push(N);return Y.next(),{dispose:()=>{let L=Q.indexOf(N);if(L!==-1)Q.splice(L,1),Y.next()}}}return J.configService.config.subscribe((q)=>{X=q}),{registerTool({spec:q,fn:V,preprocessArgs:K}){if(!V)return gX4;return Z(q,V,K)},tools:u8(J.configService.config,Y.pipe(Z9(void 0))).pipe(q6(([q])=>{return Q.map((V)=>({spec:V.spec,...pE(V.spec,q)})).sort((V,K)=>V.spec.name.localeCompare(K.spec.name))})),invokeTool(q,V,K){let W=performance.now(),H=()=>mX4.record(performance.now()-W,{toolName:q});if(q===J$1&&V.args&&"invalid_tool_name"in V.args&&typeof V.args.invalid_tool_name==="string"){uE.add(1,{toolName:q,error:"invalid"});let N=eZ1(V.args.invalid_tool_name);return new X0((M)=>{M.error(Error(N))})}let z=G(q,K.config);if(!z){let N=Q.filter((E)=>E.spec.name===q);if(N.length===0)return uE.add(1,{toolName:q,error:"not_found"}),new X0((E)=>{E.error(Error(`tool ${JSON.stringify(q)} not found`))});let M=N[0],L=pE(M.spec,K.config);uE.add(1,{toolName:q,error:"disabled"});let A=L.enabled?"unknown":L.disabledReason;return new X0((E)=>{E.error(Error(`tool ${JSON.stringify(q)} is disabled: ${A}`))})}let U=K.subagentSpec??K.agentMode;if(U&&!this.isToolAllowed(q,U)){uE.add(1,{toolName:q,error:"disabled"});let N=tZ1(U)?U.displayName??U.key:`${U} mode`;return new X0((M)=>{M.error(Error(`tool ${JSON.stringify(q)} is not allowed for ${N}`))})}if(K.thread.mainThreadID&&!K.subagentSpec&&!dl(q,f2["task-subagent"]))return uE.add(1,{toolName:q,error:"disabled"}),new X0((N)=>{N.error(Error(`tool ${JSON.stringify(q)} is not allowed for subagents`))});return uE.add(1,{toolName:q}),e6(()=>z.fn).pipe(v4((N)=>{let M=N(V,K);if(z.spec.meta?.disableTimeout)return M;return MU0(M,UU0(K.config))}),OQ(()=>H()))},preprocessArgs(q,V,K){let W=G(q,K.config);if(!W||!W.preprocessArgs)return;let H=W.preprocessArgs;try{return H(V,K)}catch(z){h.error("preprocessArgs",{id:q,args:V,error:String(z)});return}},isToolAllowed(q,V){let K=Q.find((H)=>H.spec.name===q),W=K?.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(tZ1(V))return dl(q,V,K?.spec.meta);return oZ1(q,V)},getTools(q){return u8(J.configService.config,Y.pipe(Z9(void 0))).pipe(q6(([V])=>{return Q.filter((K)=>{let W=K.spec.source;if(typeof W==="object"&&(("mcp"in W)||("toolbox"in W)))return!0;if(tZ1(q))return dl(K.spec.name,q,K.spec.meta);return oZ1(K.spec.name,q)}).map((K)=>({spec:K.spec,...pE(K.spec,V)})).sort((K,W)=>K.spec.name.localeCompare(W.spec.name))}))},getToolsForMode(q,V){if(V)return this.getTools(f2["task-subagent"]);return this.getTools(q)},getExecutionProfile(q){if(!X)return;return G(q,X)?.spec.executionProfile},dispose(){}}}function Ak(J,Q){for(let Y of Q){if(Y==="")continue;if(Y.length===1){if(Y==="*")return!0;if(Y===J)return!0;continue}if(J===Y)return!0;if(Y.includes("*")||Y.includes("?")||Y.includes("[")||Y.includes("{"))try{if(OU0.default(Y,{dot:!0})(J))return!0}catch(X){continue}}return!1}function pE(J,Q){let Y=Q.settings?.["tools.disable"]??[];if(Ak(J.name,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"mcp"in J.source){let X=uX4(J.name);if(X){if(J.source.mcp.replace(/[\s-]+/g,"_")===X.server){if(Ak(X.tool,Y))return{enabled:!1,disabledReason:"settings"};let Z=`mcp__${J.source.mcp}__${X.tool}`;if(Ak(Z,Y))return{enabled:!1,disabledReason:"settings"}}}}if(J.source==="builtin"&&Ak(`builtin:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(typeof J.source==="object"&&"toolbox"in J.source&&Ak(`toolbox:${J.name}`,Y))return{enabled:!1,disabledReason:"settings"};if(J.name===Z7||J.name===PV){if(Q.settings?.["todos.enabled"])return{enabled:!0};return{enabled:!1,disabledReason:"feature-flag"}}return{enabled:!0}}function eZ1(J){return`Invalid tool name ${JSON.stringify(J)}. Tool names must match the pattern ${Ok.toString()}. Try again with a valid tool name.`}function uX4(J){let[,Q,Y]=J.split(/mcp__([^ ]+)__([^ ]+)/);if(Q&&Y)return{server:Q,tool:Y};return}function Q$1(J){if(J.status==="in-progress"||J.status==="done"||J.status==="cancelled"||J.status==="error")return J.progress;return}var AU0,OU0,gX4,J$1="invalid_tool",Ok,EU0,uE,mX4;var m7=L1(()=>{r0();w0();pl();T$();mW();LU0();L4();AU0=D6(b6(),1),OU0=D6(WM(),1);gX4={dispose(){}};Ok=/^[-a-zA-Z0-9_]{1,64}$/,EU0=AU0.metrics.getMeter("tool_service"),uE=EU0.createCounter("tool_service.invocation_count",{description:"Number of tool invocations"}),mX4=EU0.createHistogram("tool_service.invocation_latency",{description:"Latency of tool invocations",unit:"ms"})});var jU0=f((RU0)=>{Object.defineProperty(RU0,"__esModule",{value:!0});RU0.calcSlices=RU0.applyPatch=RU0.calcPatch=RU0.lcs=RU0.diff=RU0.diff_core=void 0;function pX4(J,Q){let{b:Y,eq:X,stack_base:G}=J,{i:Z,N:q,j:V,M:K,Z:W,stack_top:H}=J;for(;;)switch(Q){case 0:{J:while(q>0&&K>0){Y.fill(0,0,2*W);let z=q-K,U=q+K,N=U&1,M=Z+q-1,L=V+K-1,A=(U+N)/2,E;Q:for(let P=0;P<=A;P++){let I=2*Math.max(0,P-K)-P,R=P-2*Math.max(0,P-q);for(let S=I;S<=R;S+=2){let y=Y[S-1-W*Math.floor((S-1)/W)],x=Y[S+1-W*Math.floor((S+1)/W)],g=S===-P||S!==P&&y<x?x:y+1,p=g-S,b=g,i=p;while(b<q&&i<K&&X(Z+b,V+i))b++,i++;if(Y[S-W*Math.floor(S/W)]=b,N===1&&(E=z-S)>=1-P&&E<P&&b+Y[W+E-W*Math.floor(E/W)]>=q)if(P>1||b!==g){G[H++]=Z+b,G[H++]=q-b,G[H++]=V+i,G[H++]=K-i,q=g,K=p,W=2*(Math.min(q,K)+1);continue J}else break Q}for(let S=I;S<=R;S+=2){let y=Y[W+S-1-W*Math.floor((S-1)/W)],x=Y[W+S+1-W*Math.floor((S+1)/W)],g=S===-P||S!==P&&y<x?x:y+1,p=g-S,b=g,i=p;while(b<q&&i<K&&X(M-b,L-i))b++,i++;if(Y[W+S-W*Math.floor(S/W)]=b,N===0&&(E=z-S)>=-P&&E<=P&&b+Y[E-W*Math.floor(E/W)]>=q)if(P>0||b!==g){G[H++]=Z+q-g,G[H++]=g,G[H++]=V+K-p,G[H++]=p,q=q-b,K=K-i,W=2*(Math.min(q,K)+1);continue J}else break Q}}if(q===K)continue;if(K>q)Z+=q,V+=q,K-=q,q=0;else Z+=K,V+=K,q-=K,K=0;break}if(q+K!==0)if(J.pxe===Z||J.pye===V)J.pxe=Z+q,J.pye=V+K;else{let z=J.pxs;if(J.oxs=J.pxs,J.oxe=J.pxe,J.oys=J.pys,J.oye=J.pye,J.pxs=Z,J.pxe=Z+q,J.pys=V,J.pye=V+K,z>=0)return J.i=Z,J.N=q,J.j=V,J.M=K,J.Z=W,J.stack_top=H,1}}case 1:{if(H===0)return 2;K=G[--H],V=G[--H],q=G[--H],Z=G[--H],W=2*(Math.min(q,K)+1),Q=0}}}class IU0{constructor(J){this.state=J,this.c=0,this.result={value:null,done:!1}}[Symbol.iterator](){return this}next(){let{state:J,result:Q}=this;if(this.c>1)return Q.done=!0,Q.value=void 0,Q;let Y=pX4(J,this.c);if(this.c=Y,Y===1)return Q.value=[J.oxs,J.oxe,J.oys,J.oye],Q;if(J.pxs>=0)return Q.value=[J.pxs,J.pxe,J.pys,J.pye],Q;return Q.done=!0,Q.value=void 0,Q}}function PU0(J,Q,Y,X,G){let Z=(Math.min(Q,X)+1)*2,q=Q+X,V=new(q<256?Uint8Array:q<65536?Uint16Array:Uint32Array)(2*Z);return new IU0({i:J,N:Q,j:Y,M:X,Z,b:V,eq:G,pxs:-1,pxe:-1,pys:-1,pye:-1,oxs:-1,oxe:-1,oys:-1,oye:-1,stack_top:0,stack_base:[]})}RU0.diff_core=PU0;function ll(J,Q,Y){let[X,G,Z]=[0,J.length,Q.length];if(typeof Y==="function"){while(X<G&&X<Z&&Y(X,X))X++;if(X===G&&X===Z)return[][Symbol.iterator]();while(Y(--G,--Z)&&G>X&&Z>X);}else{while(X<G&&X<Z&&J[X]===Q[X])X++;if(X===G&&X===Z)return[][Symbol.iterator]();while(J[--G]===Q[--Z]&&G>X&&Z>X);Y=(q,V)=>J[q]===Q[V]}return PU0(X,G+1-X,X,Z+1-X,Y)}RU0.diff=ll;class TU0{constructor(J,Q){this.diff=J,this.N=Q,this.i=0,this.j=0}[Symbol.iterator](){return this}next(){let J=this.diff.next();if(J.done){let{i:V,j:K,N:W}=this;if(V<W)J.done=!1,J.value=[V,K,W-V],this.i=W;return J}let Q=J.value,Y=Q[0],X=Q[1],G=Q[3],{i:Z,j:q}=this;if(Z!==Y)Q.length--,Q[0]=Z,Q[1]=q,Q[2]=Y-Z;return this.i=X,this.j=G,J}}function dX4(J,Q,Y){return new TU0(ll(J,Q,Y),J.length)}RU0.lcs=dX4;function*cX4(J,Q,Y){let X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let G of ll(J,Q,Y))G[2]=X.call(Q,G[2],G[3]),yield G}RU0.calcPatch=cX4;function*lX4(J,Q){let Y=0,X=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[G,Z,q]of Q){if(Y<G)yield X.call(J,Y,G);if(q.length>0)yield q;Y=Z}if(Y<J.length)yield X.call(J,Y)}RU0.applyPatch=lX4;function*iX4(J,Q,Y){let X=0,G=ArrayBuffer.isView(J)?Uint8Array.prototype.subarray:J.slice;for(let[Z,q,V,K]of ll(J,Q,Y)){if(X<Z)yield[0,G.call(J,X,Z)];if(Z<q)yield[-1,G.call(J,Z,q)];if(V<K)yield[1,G.call(Q,V,K)];X=q}if(X<J.length)yield[0,J.slice(X)]}RU0.calcSlices=iX4});function dE(J,Q){let Y={added:0,deleted:0,changed:0};if(typeof J!=="string"||typeof Q!=="string")return Y;if(J===Q)return Y;try{let X={added:0,deleted:0,changed:0};for(let[G,Z,q,V]of SU0.diff(J.split(`
49
49
  `),Q.split(`
50
50
  `)))X.deleted+=Z-G,X.added+=V-q,X.changed+=Math.min(Z-G,V-q);return X}catch{return Y}}function _U0(J){if(typeof J!=="string")return{added:0,deleted:0,changed:0};return{added:J.split(`
51
51
  `).length,deleted:0,changed:0}}function Y$1(J){if(!J)return{totalFiles:0,createdFiles:0,totalAdded:0,totalRemoved:0,totalModified:0,revertedFiles:0,allReverted:!1};let Q=J.files.length,Y=J.files.filter((K)=>K.created).length,X=J.files.filter((K)=>K.reverted).length,G=X===Q&&Q>0,Z=0,q=0,V=0;for(let K of J.files){if(K.reverted)continue;Z+=K.diffStat.added,q+=K.diffStat.removed,V+=K.diffStat.modified}return{totalFiles:Q,createdFiles:Y,totalAdded:Z,totalRemoved:q,totalModified:V,revertedFiles:X,allReverted:G}}var SU0;var wk=L1(()=>{SU0=D6(jU0(),1)});function R$(){return`T-${crypto.randomUUID()}`}function C$(J){if(!J.startsWith("T-"))return!1;let Q=J.slice(2);return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(Q)}function HM(){return`toolu_${crypto.randomUUID()}`}function cE(J,Q,Y=HM()){return{type:"tool_use",complete:!0,id:Y,name:J,input:Q}}function h2(J){if("complete"in J)return J.complete;return!("inputPartialJSON"in J)}function kU0(J){for(let Q=J.messages.length-1;Q>=0;Q--){let Y=J.messages[Q];if(Y?.role==="info"){let X=Y.content[0];if(X?.type==="summary"&&X?.summary.type==="message")return}if(Y?.role==="assistant"&&Y.usage){if(Y.usage.totalInputTokens===0)continue;return Y.usage}}return J["~debug"]?.lastInferenceUsage}function UX(J,Q){for(let Y of J.messages){if(Y.role!=="assistant")continue;for(let X of Y.content)if(X.type==="tool_use"&&X.id===Q)return X}return}function lE(J,Q){for(let[Y,X]of J.messages.entries()){if(X.role!=="assistant")continue;for(let[G,Z]of X.content.entries())if(Z.type==="tool_use"&&Z.id===Q)return{message:X,messageIndex:Y,block:Z,blockIndex:G}}return null}function cF(J,Q){for(let Y of J.messages){if(Y.role!=="user")continue;for(let X of Y.content)if(X.type==="tool_result"&&X.toolUseID===Q)return X}return}function nJ(J){return J.messages.filter((Q)=>Q.role==="user").flatMap((Q)=>Q.content).filter((Q)=>Q.type==="tool_result").reduce((Q,Y)=>{return Q.set(Y.toolUseID,Y),Q},new Map)}function X$1(J){if(J&&typeof J==="object"&&"threadID"in J){let Q=J.threadID;if(typeof Q==="string"&&C$(Q))return Q}return}function G$1(J){let Q=[],Y=new Map;for(let X of J)if(X.role==="assistant"){for(let G of X.content)if(G.type==="tool_use"&&G.name===QJ)Y.set(G.id,G)}else if(X.role==="user"){for(let G of X.content)if(G.type==="tool_result"){let Z=Y.get(G.toolUseID);if(Z){let q=G.run,V=(q.status==="in-progress"||q.status==="cancelled"||q.status==="done"||q.status==="error")&&q.progress?X$1(q.progress):void 0;if(V)Q.push({toolUseID:G.toolUseID,threadID:V,toolUse:Z,toolResult:G})}}}return Q}function yU0(J,Q="Untitled"){if(J.title)return Rl(J.title,300);return Q}function xU0(J){if(!J)return!1;if(J.role==="assistant")return J.state?.type==="cancelled";if(J.role==="user")return J.content.some((Q)=>Q.type==="tool_result"&&Q.run.status==="cancelled");return!1}function vU0(J){if(!J)return!1;if(J.role==="user")return J.content.some((Q)=>Q.type==="tool_result"&&Q.run.status==="rejected-by-user");return!1}function Z$1(J){if(!J)return!1;return J.role==="info"}function iE(J){return J.role==="info"&&J.content.some((Q)=>Q.type==="manual_bash_invocation")}function il(J){if(J.role!=="info")return;return J.content.find((Q)=>Q.type==="manual_bash_invocation")}function tX4(J){return J.replace(/u([0-9A-Fa-f]{4})(\s)/gi,(Q,Y,X)=>{try{return String.fromCodePoint(parseInt(Y,16))+X}catch{return`u${Y}${X}`}})}function nE(J){for(let Q=J.messages.length-1;Q>=0;Q--){let Y=J.messages[Q];if(Y?.role==="info"){if(Y.content.some((G)=>G.type==="summary"&&G.summary.type==="message"))break}if(Y?.role!=="assistant"||!Y.state||Y.state.type!=="complete"||Y.state.stopReason!=="tool_use")continue;for(let X of Y.content)if(X.type==="tool_use"&&X.name===Z7&&X.input){let G=X.input.todos;if(Array.isArray(G))return G;let Z=X.input.content;if(typeof Z==="string")return tX4(Z)}}return}function b2(J){return J.map((Q)=>Q.type==="text"?Q.text:null).filter((Q)=>Q!==null).join(`
@@ -2269,7 +2269,7 @@ If the user asks you to, use this tool to create git commits too. ONLY make comm
2269
2269
  It's VERY IMPORTANT to use specific tools when searching for files, instead of issuing terminal commands with find/grep/ripgrep. Use ${"finder"} or ${y8} instead. Use ${l6} tool rather than cat, and edit_file rather than sed.
2270
2270
  `,Gr0={spec:{name:d9,description:N48,inputSchema:{type:"object",properties:{cmd:{type:"string",description:"The shell command to execute"},cwd:{type:"string",description:"Absolute path to a directory where the command will be executed (must be absolute, not relative)"}},required:["cmd"]},source:"builtin",meta:{disableTimeout:!0},executionProfile:{serial:!0,resourceKeys:()=>[]}},fn:zU({os:()=>Promise.resolve().then(() => (Xr0(),Yr0)).then(({nodeBashTool:J})=>J),github:null,gitlab:null}),preprocessArgs:(J,Q)=>{if(/(?<!&)\s*&\s*$/u.test(J.cmd))return{...J,cmd:J.cmd.replace(/(?<!&)\s*&\s*$/u,"").trim()};if(J.cwd?.startsWith("~")){if(typeof process<"u"&&process.env.HOME){let Y=J.cwd.replace(/^~/,process.env.HOME);return{...J,cwd:Y}}throw Error("Cannot resolve ~ in cwd: HOME environment variable not available")}if(J.cwd)return;try{let[Y,X]=oo0(J.cmd),G=Y&&Y.arguments.length===1&&typeof Y.arguments[0]?.value==="string"?Y.arguments[0].value:void 0;if(Y?.program.value==="cd"&&G&&X)return fI(Q.dir),{...J,cwd:Z6.resolvePath(Q.dir,G).fsPath,cmd:J.cmd.slice(X.program.start.offset)}}catch(Y){return}}}});function $01(){return new $r0.Terminal({cols:1000,rows:500,allowProposedApi:!0,convertEol:!0,scrollback:1e4,cursorBlink:!1})}function Rb(J,Q=M48){let Y=J.buffer.active,X=Math.max(0,Q.maxCharacterLength),G=0,Z=[];for(let q=Y.length-1;q>=0;q--){let V=Y.getLine(q);if(!V)throw Error("unreachable: line index does not exist");let K=V?.translateToString(!1).trimEnd();if(K.trim().length===0&&Z.at(-1)?.trim().length===0)continue;if(G+=K.length,G>X){if(Z.length===0)Z.push(K);return{output:Z.reverse().join(`
2271
2271
  `),truncation:{prefixLinesOmitted:q+1}}}Z.push(K)}return{output:Z.reverse().join(`
2272
- `)}}var $r0,M48;var AI1=L1(()=>{q01();$r0=D6(Co0(),1);M48={maxCharacterLength:OI1}});class MA{systemPrompt;model;scaffold;#J=new AbortController;#Q=new y4;#G;#Z=[];#X=[];constructor(J,Q,Y,X){this.systemPrompt=J;this.model=Q;this.scaffold=Y;this.#G=X}dispose(){this.#J.abort()}run(J,Q,Y,X){return this._run(J,Q,Y,X).catch((G)=>{this.#Q.next({status:"error","~debug":{conversation:J,inferences:this.#X},message:`Uncaught subagent error: ${G}`})}).finally(()=>{this.#Q.complete()}),this.#Q}async _run(J,Q,Y,X){this.sendProgressUpdate(J);let G=this.#G&&Q.getTools?Q.getTools(this.#G):Q.tools,q=(await B6(G,this.#J.signal)).filter((K)=>K.enabled).map((K)=>g7(this.model,K.spec)),V=void 0;for(let K of X?[null,...X]:[null]){if(K)K(J);while(!0){this.#J.signal.throwIfAborted();let W=performance.now(),{result:H,toolUses:z,debugUsage:U}=await this.scaffold.runInference(this.model,this.systemPrompt,J,q,Y.thread,{configService:Y.configService},this.#J.signal),M=performance.now()-W,L={maxInputTokens:0,inputTokens:0,outputTokens:0,cacheCreationInputTokens:null,cacheReadInputTokens:null,totalInputTokens:0,credits:0};this.#X.push({inferenceTimeMs:M,usage:U??L}),this.#Z.push({message:this.scaffold.extractMessage(H),activeTools:new Map(z.map((E)=>[E.id,{tool_name:E.name,status:"queued",input:E.input}]))}),this.#J.signal.throwIfAborted();let A=await Promise.all(z.map((E)=>this.runTool(Q,Y,E)));if(this.scaffold.updateConversation(J,H,A),z.length===0){V=this.scaffold.extractMessage(H);break}this.sendProgressUpdate(J)}}this.#Q.next({status:"done",message:V??wI1,turns:this.#Z,"~debug":{conversation:J,inferences:this.#X}})}async runTool(J,Q,Y){let X=Y.id,G=J.invokeTool(Y.name,{args:Y.input},{...Q,tool:Y.name,subagentSpec:this.#G});return this.setToolUseStatus(X,"in-progress"),await CF(G,this.#J.signal).then((Z)=>{return this.setToolUseStatus(X,"done",Z.status==="done"?Z.result:void 0),{id:X,result:Z}}).catch((Z)=>{if(Z instanceof Error&&Z.name==="AbortError")throw this.setToolUseStatus(X,"cancelled"),Z;return this.setToolUseStatus(X,"error"),{id:X,result:{status:"error",error:String(Z)}}})}setToolUseStatus(J,Q,Y){let X=this.#Z.at(-1)?.activeTools.get(J);if(!X)throw Error("Cannot update the status of a tool that does not exist");this.#Z.at(-1)?.activeTools.set(J,{...X,status:Q,result:Y})}sendProgressUpdate(J){this.#Q.next({status:"in-progress",turns:this.#Z,"~debug":{conversation:J,inferences:this.#X}})}}var wI1="Agent did not produce a response";var Cb=L1(()=>{r0();m7()});var MR;var V01=L1(()=>{c$();IB();gW();MR={runInference:async(J,Q,Y,X,G,Z,q)=>{let V=crypto.randomUUID(),K=gG(J),W=await Or(Y,X,[{type:"text",text:Q}],G,{configService:Z.configService},K,q,void 0,V),H=await cX(V,Z.configService);if(W["~debugUsage"])W["~debugUsage"].credits=H??0;let U=(W.message?.content.filter((N)=>N.type==="tool_use")??[]).map((N)=>({id:N.id,input:N.input,name:N.name}));return{result:W,toolUses:U}},extractMessage:(J)=>{if(!J.message)return;return J.message.content.filter((Q)=>Q.type==="text").map((Q)=>typeof Q==="string"?Q:Q.text||"").join("")},updateConversation:(J,Q,Y)=>{let X=Q.message;if(!X)return;let G=Y.map(({id:Z,result:q})=>{if("error"in q)return ZL(Z,{status:"error",error:{message:q.error}});return ZL(Z,q)});J.push({role:"assistant",content:X.content},{role:"user",content:G.filter((Z)=>Z!==void 0)})}}});function L48(J){if(J.status==="error"){let Q=J.error;return JSON.stringify(Q)}if(J.status==="done"){if(typeof J.result==="string")return J.result;let Q=JSON.stringify(J.result);return Q===void 0?"":Q}return`Tool execution status: ${J.status}`}var qr0;var Vr0=L1(()=>{ce();IB();g2();qr0={runInference:async function(J,Q,Y,X,G,Z,q){let V=crypto.randomUUID(),K=await de(Y,X,Q,G,gG(J),Z,q,void 0,V),W=K.message,H=[],z=W.choices[0];if(z?.message?.tool_calls){for(let N of z.message.tool_calls)if(N.id){let M=N;H.push({id:N.id,name:M.function?.name??"",input:M.function?.arguments?JSON.parse(M.function.arguments):void 0})}}let U;if(W.usage){let N=await cX(V,Z.configService);U={model:gG(J),maxInputTokens:0,inputTokens:W.usage.prompt_tokens,outputTokens:W.usage.completion_tokens,cacheCreationInputTokens:null,cacheReadInputTokens:null,totalInputTokens:W.usage.prompt_tokens,credits:N??0}}return{result:K,toolUses:H,debugUsage:U}},extractMessage:function(J){return J.message.choices[0]?.message?.content||void 0},updateConversation:function(J,Q,Y){let G=Q.message.choices[0];if(G?.message){let Z={role:"assistant",content:G.message.content||"",tool_calls:G.message.tool_calls};J.push(Z)}for(let{id:Z,result:q}of Y){let V={role:"tool",content:L48(q),tool_call_id:Z};J.push(V)}}}});function Kr0(J,Q,Y){let X=new EI1(Q);h.info("Subagent: Creating filtered tool service",{toolPatterns:Q,excludeToolName:Y});function G(Z,q){if(!q)return!1;if(Y&&Z===Y)return!1;let V=Hr0(Z,q.source);return X.matches(V)}return{registerTool(Z){throw Error("Tools should not be registered in a filtered tool service")},invokeTool(Z,q,V){return h.info("Subagent: Invoking tool",{tool:Z}),J.invokeTool(Z,q,V).pipe(q6((K)=>{if(K.status==="done")h.info("Subagent: Tool completed successfully",{tool:Z});else if(K.status==="error")h.error("Subagent: Tool failed",{tool:Z,error:K.error});return K}))},preprocessArgs(Z,q,V){return J.preprocessArgs?.(Z,q,V)},tools:J.tools.pipe(q6((Z)=>Z.filter((q)=>G(q.spec.name,q.spec)))),getTools(Z){return J.getTools(Z).pipe(q6((q)=>q.filter((V)=>G(V.spec.name,V.spec))))},isToolAllowed(Z,q){if(!G(Z))return!1;return J.isToolAllowed(Z,q)},getToolsForMode(Z){return J.getToolsForMode(Z).pipe(q6((q)=>q.filter((V)=>G(V.spec.name,V.spec))))},getExecutionProfile(Z){let q=J.getExecutionProfile(Z);if(q)return q;if(Z.startsWith("tb__"))return{serial:!1,resourceKeys:()=>[]};return},dispose(){}}}var Wr0=L1(()=>{r0();w0();K01()});function zr0(J,Q,Y,X){let G=Y.tools??["*"];return{name:J,description:`${Q}
2272
+ `)}}var $r0,M48;var AI1=L1(()=>{q01();$r0=D6(Co0(),1);M48={maxCharacterLength:OI1}});class MA{systemPrompt;model;scaffold;#J=new AbortController;#Q=new y4;#G;#Z=[];#X=[];constructor(J,Q,Y,X){this.systemPrompt=J;this.model=Q;this.scaffold=Y;this.#G=X}dispose(){this.#J.abort()}run(J,Q,Y,X){return this._run(J,Q,Y,X).catch((G)=>{this.#Q.next({status:"error","~debug":{conversation:J,inferences:this.#X},message:`Uncaught subagent error: ${G}`})}).finally(()=>{this.#Q.complete()}),this.#Q}async _run(J,Q,Y,X){this.sendProgressUpdate(J);let G=this.#G&&Q.getTools?Q.getTools(this.#G):Q.tools,q=(await B6(G,this.#J.signal)).filter((K)=>K.enabled).map((K)=>g7(this.model,K.spec)),V=void 0;for(let K of X?[null,...X]:[null]){if(K)K(J);while(!0){this.#J.signal.throwIfAborted();let W=performance.now(),{result:H,toolUses:z,debugUsage:U}=await this.scaffold.runInference(this.model,this.systemPrompt,J,q,Y.thread,{configService:Y.configService},this.#J.signal),M=performance.now()-W,L={maxInputTokens:0,inputTokens:0,outputTokens:0,cacheCreationInputTokens:null,cacheReadInputTokens:null,totalInputTokens:0,credits:0};this.#X.push({inferenceTimeMs:M,usage:U??L}),this.#Z.push({message:this.scaffold.extractMessage(H),activeTools:new Map(z.map((E)=>[E.id,{tool_name:E.name,status:"queued",input:E.input}]))}),this.#J.signal.throwIfAborted();let A=await Promise.all(z.map((E)=>this.runTool(Q,Y,E)));if(this.scaffold.updateConversation(J,H,A),this.sendProgressUpdate(J),z.length===0){V=this.scaffold.extractMessage(H);break}}}this.#Q.next({status:"done",message:V??wI1,turns:this.#Z,"~debug":{conversation:J,inferences:this.#X}})}async runTool(J,Q,Y){let X=Y.id,G=J.invokeTool(Y.name,{args:Y.input},{...Q,tool:Y.name,subagentSpec:this.#G});return this.setToolUseStatus(X,"in-progress"),await CF(G,this.#J.signal).then((Z)=>{return this.setToolUseStatus(X,"done",Z.status==="done"?Z.result:void 0),{id:X,result:Z}}).catch((Z)=>{if(Z instanceof Error&&Z.name==="AbortError")throw this.setToolUseStatus(X,"cancelled"),Z;return this.setToolUseStatus(X,"error"),{id:X,result:{status:"error",error:String(Z)}}})}setToolUseStatus(J,Q,Y){let X=this.#Z.at(-1)?.activeTools.get(J);if(!X)throw Error("Cannot update the status of a tool that does not exist");this.#Z.at(-1)?.activeTools.set(J,{...X,status:Q,result:Y})}sendProgressUpdate(J){this.#Q.next({status:"in-progress",turns:this.#Z,"~debug":{conversation:J,inferences:this.#X}})}}var wI1="Agent did not produce a response";var Cb=L1(()=>{r0();m7()});var MR;var V01=L1(()=>{c$();IB();gW();MR={runInference:async(J,Q,Y,X,G,Z,q)=>{let V=crypto.randomUUID(),K=gG(J),W=await Or(Y,X,[{type:"text",text:Q}],G,{configService:Z.configService},K,q,void 0,V),H=await cX(V,Z.configService);if(W["~debugUsage"])W["~debugUsage"].credits=H??0;let U=(W.message?.content.filter((N)=>N.type==="tool_use")??[]).map((N)=>({id:N.id,input:N.input,name:N.name}));return{result:W,toolUses:U}},extractMessage:(J)=>{if(!J.message)return;return J.message.content.filter((Q)=>Q.type==="text").map((Q)=>typeof Q==="string"?Q:Q.text||"").join("")},updateConversation:(J,Q,Y)=>{let X=Q.message;if(!X)return;let G=Y.map(({id:Z,result:q})=>{if("error"in q)return ZL(Z,{status:"error",error:{message:q.error}});return ZL(Z,q)});if(J.push({role:"assistant",content:X.content}),Y.length>0)J.push({role:"user",content:G.filter((Z)=>Z!==void 0)})}}});function L48(J){if(J.status==="error"){let Q=J.error;return JSON.stringify(Q)}if(J.status==="done"){if(typeof J.result==="string")return J.result;let Q=JSON.stringify(J.result);return Q===void 0?"":Q}return`Tool execution status: ${J.status}`}var qr0;var Vr0=L1(()=>{ce();IB();g2();qr0={runInference:async function(J,Q,Y,X,G,Z,q){let V=crypto.randomUUID(),K=await de(Y,X,Q,G,gG(J),Z,q,void 0,V),W=K.message,H=[],z=W.choices[0];if(z?.message?.tool_calls){for(let N of z.message.tool_calls)if(N.id){let M=N;H.push({id:N.id,name:M.function?.name??"",input:M.function?.arguments?JSON.parse(M.function.arguments):void 0})}}let U;if(W.usage){let N=await cX(V,Z.configService);U={model:gG(J),maxInputTokens:0,inputTokens:W.usage.prompt_tokens,outputTokens:W.usage.completion_tokens,cacheCreationInputTokens:null,cacheReadInputTokens:null,totalInputTokens:W.usage.prompt_tokens,credits:N??0}}return{result:K,toolUses:H,debugUsage:U}},extractMessage:function(J){return J.message.choices[0]?.message?.content||void 0},updateConversation:function(J,Q,Y){let G=Q.message.choices[0];if(G?.message){let Z={role:"assistant",content:G.message.content||"",tool_calls:G.message.tool_calls};J.push(Z)}for(let{id:Z,result:q}of Y){let V={role:"tool",content:L48(q),tool_call_id:Z};J.push(V)}}}});function Kr0(J,Q,Y){let X=new EI1(Q);h.info("Subagent: Creating filtered tool service",{toolPatterns:Q,excludeToolName:Y});function G(Z,q){if(!q)return!1;if(Y&&Z===Y)return!1;let V=Hr0(Z,q.source);return X.matches(V)}return{registerTool(Z){throw Error("Tools should not be registered in a filtered tool service")},invokeTool(Z,q,V){return h.info("Subagent: Invoking tool",{tool:Z}),J.invokeTool(Z,q,V).pipe(q6((K)=>{if(K.status==="done")h.info("Subagent: Tool completed successfully",{tool:Z});else if(K.status==="error")h.error("Subagent: Tool failed",{tool:Z,error:K.error});return K}))},preprocessArgs(Z,q,V){return J.preprocessArgs?.(Z,q,V)},tools:J.tools.pipe(q6((Z)=>Z.filter((q)=>G(q.spec.name,q.spec)))),getTools(Z){return J.getTools(Z).pipe(q6((q)=>q.filter((V)=>G(V.spec.name,V.spec))))},isToolAllowed(Z,q){if(!G(Z))return!1;return J.isToolAllowed(Z,q)},getToolsForMode(Z){return J.getToolsForMode(Z).pipe(q6((q)=>q.filter((V)=>G(V.spec.name,V.spec))))},getExecutionProfile(Z){let q=J.getExecutionProfile(Z);if(q)return q;if(Z.startsWith("tb__"))return{serial:!1,resourceKeys:()=>[]};return},dispose(){}}}var Wr0=L1(()=>{r0();w0();K01()});function zr0(J,Q,Y,X){let G=Y.tools??["*"];return{name:J,description:`${Q}
2273
2273
 
2274
2274
  Model: ${Y.model}
2275
2275
  Tools: ${G.join(", ")}`,inputSchema:{type:"object",properties:{prompt:{type:"string",description:"The instruction or question for the subagent"}},required:["prompt"]},source:{toolbox:X},meta:{disableTimeout:!0}}}function Fr0(J,Q){return(Y,X)=>{return new X0((G)=>{A48(Y.args,J,Q,X).then((Z)=>{Z.subscribe({next:(q)=>{if(q.status==="in-progress"){let V=q.turns.at(-1),K=V&&"activeTools"in V&&V.activeTools instanceof Map?Array.from(V.activeTools.entries()).map(([H,z])=>({id:H,tool_name:z.tool_name,status:z.status,input:z.input,result:z.result})):[],W=V?.message||"Working...";G.next({status:"in-progress",progress:[{message:W,tool_uses:K}]})}else if(q.status==="done")G.next({status:"done",result:q.message}),G.complete();else if(q.status==="error")G.next({status:"error",error:{message:q.message}}),G.complete()},error:(q)=>{h.error("Subagent error",{err:q}),G.next({status:"error",error:{message:`Error: ${q}`}}),G.complete()}})}).catch((Z)=>{G.next({status:"error",error:{message:`Failed: ${Z}`}}),G.complete()})})}}async function A48(J,Q,Y,X){let{systemPrompt:G,model:Z}=Q,q=Q.tools??["*"],V=await B6(X.toolService.tools);h.info("Subagent: Available tools before filtering",{toolCount:V.length,tools:V.map((M)=>M.spec.name),mcpTools:V.filter((M)=>M.spec.name.startsWith("mcp__")).map((M)=>M.spec.name),tbTools:V.filter((M)=>M.spec.name.startsWith("tb__")||M.spec.name.startsWith("sa__")).map((M)=>M.spec.name)});let K=Kr0(X.toolService,q,Y),W=await B6(K.tools);h.info("Subagent: Tools after filtering",{model:Z,toolPatterns:q,toolCount:W.length,tools:W.map((M)=>M.spec.name),mcpTools:W.filter((M)=>M.spec.name.startsWith("mcp__")).map((M)=>M.spec.name),tbTools:W.filter((M)=>M.spec.name.startsWith("tb__")||M.spec.name.startsWith("sa__")).map((M)=>M.spec.name)});let z=Z.toLowerCase().includes("claude")?MR:qr0,U=new MA(G,Z,z),N=[{role:"user",content:J.prompt}];return U.run(N,K,X).pipe(OQ(()=>U.dispose()))}var Ur0=L1(()=>{r0();w0();Cb();V01();Vr0();Wr0()});function Nr0(J){if(J in Br0)return Br0[J];return J}var Br0;var Dr0=L1(()=>{gW();Br0={sonnet:V9.CLAUDE_SONNET_4_5.name,opus:V9.CLAUDE_OPUS_4.name,haiku:V9.CLAUDE_HAIKU_4_5.name,"grok-code":V9.GROK_CODE_FAST_1.name,"gpt-5":V9.GPT_5.name,gemini:V9.GEMINI_2_5_FLASH.name,inherit:"inherit"}});function Hr0(J,Q){if(typeof Q==="object"&&"toolbox"in Q)return J;if(typeof Q==="object"&&"mcp"in Q)return J;return J}class EI1{matchers;constructor(J){this.matchers=J.map((Q)=>{if(Q==="")return()=>!1;if(Q==="*")return()=>!0;if(Q.includes("*")||Q.includes("?")||Q.includes("[")||Q.includes("{"))try{let Y=Mr0.default(Q,{dot:!0});return(X)=>Y(X)}catch{return(Y)=>Y===Q}return(Y)=>Y===Q})}matches(J){return this.matchers.some((Q)=>Q(J))}}async function W01(J,Q,Y,X=new Set){try{let Z=(await Y.readdir(J)).filter((V)=>!V.isDirectory&&V.uri.fsPath.endsWith(".md")),q=[];for(let V of Z)try{let K=await Y.readFile(V.uri),{frontMatter:W,content:H}=Fr(K.toString());if(!W)continue;let z=W;if(z.type&&z.type!=="subagent")continue;let U=V.uri.fsPath.split("/").pop()?.replace(/\.md$/,"")??"unknown",N=z.name??U,M=Nr0(z.model??"sonnet");if(!H||H.trim()===""){h.warn("Invalid subagent manifest",{path:V.uri.toString(),reason:"Missing system prompt (markdown content)"});continue}let L;if(z.tools)if(typeof z.tools==="string")L=z.tools.split(",").map((S)=>S.trim());else L=z.tools;let A={systemPrompt:H.trim(),model:M,tools:L},E=z.description||H.split(`
@@ -4099,15 +4099,15 @@ Actual: ${G}`)}async function dG8(J,Q,Y){let{execSync:X}=await import("node:ch
4099
4099
  ${N}`;if(G==="pnpm"&&N.includes("Unable to find the global bin directory"))M+=`
4100
4100
 
4101
4101
  Hint: Try running "pnpm setup" to configure pnpm global directory, or use npm instead:
4102
- npm install -g @sourcegraph/amp`;V(Error(M))}},error:(U)=>{if(!H)H=!0,V(Error(`Failed to spawn ${G}: ${U.message}`))},complete:()=>{if(!H)H=!0,q()}})})}w0();w0();async function A61(J,Q){let X=Q||"https://registry.npmjs.org";try{let G=new AbortController,Z=setTimeout(()=>G.abort(),5000),q=await fetch(`${X}/@sourcegraph/amp`,{signal:G.signal});if(clearTimeout(Z),!q.ok)return{hasUpdate:!1,currentVersion:J,source:"npm"};let V=await q.json(),K=V["dist-tags"]?.latest;if(!K)return{hasUpdate:!1,currentVersion:J,source:"npm"};let W=aG8(J,K),H=W<0,z,U;if(V.time){let N=V.time[J],M=V.time[K],L=Date.now();if(N)z=Math.floor((L-new Date(N).getTime())/3600000);if(M)U=Math.floor((L-new Date(M).getTime())/3600000)}return h.info("NPM version comparison",{currentVersion:J,latestVersion:K,compareResult:W,hasUpdate:H,currentVersionAge:z,latestVersionAge:U}),{hasUpdate:H,latestVersion:K,currentVersion:J,currentVersionAge:z,latestVersionAge:U,source:"npm"}}catch(G){return h.debug("Error checking npm version",{error:G}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function aG8(J,Q){let Y=(q)=>{let[V,K]=q.split("-");return{parts:V?.split(".").map(Number)||[],label:K}},X=Y(J),G=Y(Q),Z=Math.max(X.parts.length,G.parts.length);for(let q=0;q<Z;q++){let V=X.parts[q]||0,K=G.parts[q]||0;if(V<K)return-1;if(V>K)return 1}if(X.label===G.label)return 0;if(!X.label&&G.label)return 1;if(X.label&&!G.label)return-1;if(X.label&&G.label)return X.label<G.label?-1:1;return 0}r0();function O61(J,Q){let Y=new y4,X=Y.pipe(a8({shouldCountRefs:!1}));return setImmediate(async()=>{let G=new LV().scoped("update"),Z=X.subscribe({next:(q)=>{G.debug("emit new state",q)}});try{let q=process.env.AMP_TEST_UPDATE_STATUS;if(q){G.debug("using fake update status for testing",{status:q}),await vU(500),Y.next(q);return}if(process.env.AMP_SKIP_UPDATE_CHECK==="1"){G.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable");return}let V=await Q.get("updates.mode");if(V==="disabled"){G.debug("checking disabled");return}G.debug("checking",{currentVersion:J,mode:V});let K=bA(),W=await A61(J,K);if(!(W.latestVersion&&W.hasUpdate)){G.debug("no update available");return}let H=()=>{if(W.currentVersionAge!==void 0&&W.latestVersionAge!==void 0){let U=W.currentVersionAge-W.latestVersionAge,N=0.5;if(Math.abs(U)<0.5)return G.debug("versions too close together, suppressing update warning",{currentVersionAge:W.currentVersionAge,latestVersionAge:W.latestVersionAge,ageDifferenceHours:U}),!0}return!1},z=await L61();if(!V)V=z==="pnpm"?"warn":"auto",G.debug("no configured update mode; selected default based on package manager",{packageManager:z,mode:V});if(V==="warn"){if(!H())Y.next("update-available");return}if(!z){if(G.debug("auto-update not supported, falling back to warn mode"),!H())Y.next("update-available");return}try{await Lg(W.latestVersion,z);let U=await cB(W.latestVersion),N={from:W.currentVersion,to:W.latestVersion,...U};if(U.status==="same")G.info("success",N),Y.next("updated");else G.warn("success with warning",N),Y.next("updated-with-warning")}catch(U){Y.next("update-error")}}catch(q){G.debug("check failed",{error:q})}finally{await vU(5000),Y.next("hidden"),Z.unsubscribe(),Y.complete()}}),{state:X}}import{stderr as jK}from"node:process";function N86(J){let Q=new IA().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(X)=>{await zR1(X.force||!1,X.verbose||!1,"0.0.1764273685-g926f68"),process.exit()});J.addCommand(Q,{hidden:!0});let Y=new IA("update").summary("Update Amp CLI").description("Update Amp CLI to the latest version. You can specify a particular version to install, or leave blank to get the latest stable release.").option("--target-version <version>","Update to a specific version").allowUnknownOption(!1).action(async(X)=>{await oG8(X.targetVersion)});J.addCommand(Y)}async function oG8(J){if(process.env.AMP_SKIP_UPDATE_CHECK==="1")jK.write(f4.yellow(`Note: AMP_SKIP_UPDATE_CHECK=1 is set, which disables automatic update checking. Manual updates will still work.
4102
+ npm install -g @sourcegraph/amp`;V(Error(M))}},error:(U)=>{if(!H)H=!0,V(Error(`Failed to spawn ${G}: ${U.message}`))},complete:()=>{if(!H)H=!0,q()}})})}w0();w0();async function A61(J,Q){let X=Q||"https://registry.npmjs.org";try{let G=new AbortController,Z=setTimeout(()=>G.abort(),5000),q=await fetch(`${X}/@sourcegraph/amp`,{signal:G.signal});if(clearTimeout(Z),!q.ok)return{hasUpdate:!1,currentVersion:J,source:"npm"};let V=await q.json(),K=V["dist-tags"]?.latest;if(!K)return{hasUpdate:!1,currentVersion:J,source:"npm"};let W=aG8(J,K),H=W<0,z,U;if(V.time){let N=V.time[J],M=V.time[K],L=Date.now();if(N)z=Math.floor((L-new Date(N).getTime())/3600000);if(M)U=Math.floor((L-new Date(M).getTime())/3600000)}return h.info("NPM version comparison",{currentVersion:J,latestVersion:K,compareResult:W,hasUpdate:H,currentVersionAge:z,latestVersionAge:U}),{hasUpdate:H,latestVersion:K,currentVersion:J,currentVersionAge:z,latestVersionAge:U,source:"npm"}}catch(G){return h.debug("Error checking npm version",{error:G}),{hasUpdate:!1,currentVersion:J,source:"npm"}}}function aG8(J,Q){let Y=(q)=>{let[V,K]=q.split("-");return{parts:V?.split(".").map(Number)||[],label:K}},X=Y(J),G=Y(Q),Z=Math.max(X.parts.length,G.parts.length);for(let q=0;q<Z;q++){let V=X.parts[q]||0,K=G.parts[q]||0;if(V<K)return-1;if(V>K)return 1}if(X.label===G.label)return 0;if(!X.label&&G.label)return 1;if(X.label&&!G.label)return-1;if(X.label&&G.label)return X.label<G.label?-1:1;return 0}r0();function O61(J,Q){let Y=new y4,X=Y.pipe(a8({shouldCountRefs:!1}));return setImmediate(async()=>{let G=new LV().scoped("update"),Z=X.subscribe({next:(q)=>{G.debug("emit new state",q)}});try{let q=process.env.AMP_TEST_UPDATE_STATUS;if(q){G.debug("using fake update status for testing",{status:q}),await vU(500),Y.next(q);return}if(process.env.AMP_SKIP_UPDATE_CHECK==="1"){G.debug("checking disabled via AMP_SKIP_UPDATE_CHECK environment variable");return}let V=await Q.get("updates.mode");if(V==="disabled"){G.debug("checking disabled");return}G.debug("checking",{currentVersion:J,mode:V});let K=bA(),W=await A61(J,K);if(!(W.latestVersion&&W.hasUpdate)){G.debug("no update available");return}let H=()=>{if(W.currentVersionAge!==void 0&&W.latestVersionAge!==void 0){let U=W.currentVersionAge-W.latestVersionAge,N=0.5;if(Math.abs(U)<0.5)return G.debug("versions too close together, suppressing update warning",{currentVersionAge:W.currentVersionAge,latestVersionAge:W.latestVersionAge,ageDifferenceHours:U}),!0}return!1},z=await L61();if(!V)V=z==="pnpm"?"warn":"auto",G.debug("no configured update mode; selected default based on package manager",{packageManager:z,mode:V});if(V==="warn"){if(!H())Y.next("update-available");return}if(!z){if(G.debug("auto-update not supported, falling back to warn mode"),!H())Y.next("update-available");return}try{await Lg(W.latestVersion,z);let U=await cB(W.latestVersion),N={from:W.currentVersion,to:W.latestVersion,...U};if(U.status==="same")G.info("success",N),Y.next("updated");else G.warn("success with warning",N),Y.next("updated-with-warning")}catch(U){Y.next("update-error")}}catch(q){G.debug("check failed",{error:q})}finally{await vU(5000),Y.next("hidden"),Z.unsubscribe(),Y.complete()}}),{state:X}}import{stderr as jK}from"node:process";function N86(J){let Q=new IA().name("install").description("Install required tools like ripgrep to $AMP_HOME/bin").option("--force","Force reinstallation even if already installed").option("--verbose","Show installation progress and results").action(async(X)=>{await zR1(X.force||!1,X.verbose||!1,"0.0.1764288114-gd779fe"),process.exit()});J.addCommand(Q,{hidden:!0});let Y=new IA("update").summary("Update Amp CLI").description("Update Amp CLI to the latest version. You can specify a particular version to install, or leave blank to get the latest stable release.").option("--target-version <version>","Update to a specific version").allowUnknownOption(!1).action(async(X)=>{await oG8(X.targetVersion)});J.addCommand(Y)}async function oG8(J){if(process.env.AMP_SKIP_UPDATE_CHECK==="1")jK.write(f4.yellow(`Note: AMP_SKIP_UPDATE_CHECK=1 is set, which disables automatic update checking. Manual updates will still work.
4103
4103
 
4104
4104
  `));try{if(!J){jK.write(f4.blue(`Checking for updates...
4105
- `));let X=bA(),{hasUpdate:G,latestVersion:Z}=await A61("0.0.1764273685-g926f68",X);if(!G){jK.write(f4.green(`✓ Amp CLI is already up to date: ${"0.0.1764273685-g926f68"} (${"released"} ${"2025-11-27T20:06:51.391Z"})
4106
- `));let V=await cB("0.0.1764273685-g926f68");if(V.warning)jK.write(`
4105
+ `));let X=bA(),{hasUpdate:G,latestVersion:Z}=await A61("0.0.1764288114-gd779fe",X);if(!G){jK.write(f4.green(`✓ Amp CLI is already up to date: ${"0.0.1764288114-gd779fe"} (${"released"} ${"2025-11-28T00:07:02.253Z"})
4106
+ `));let V=await cB("0.0.1764288114-gd779fe");if(V.warning)jK.write(`
4107
4107
  `+f4.yellow(V.warning)+`
4108
4108
  `);process.exit(0)}if(!Z)jK.write(f4.yellow("[WARN] could not find latest version")),process.exit(0);J=Z}jK.write(f4.blue(`Updating to version ${J}...
4109
4109
  `)),await Lg(J,void 0,(X)=>{jK.write(f4.dim(`Running: ${X}
4110
- `))});let Q="released";jK.write(f4.green(`✓ Successfully updated to version ${J} (${Q} ${"2025-11-27T20:06:51.391Z"})
4110
+ `))});let Q="released";jK.write(f4.green(`✓ Successfully updated to version ${J} (${Q} ${"2025-11-28T00:07:02.253Z"})
4111
4111
  `));let Y=await cB(J);if(Y.warning)jK.write(`
4112
4112
  `+f4.yellow(Y.warning)+`
4113
4113
  `);process.exit(0)}catch(Q){let Y=Q instanceof Error?Q.message:String(Q);jK.write(f4.red.bold("Error: ")+Y+`
@@ -4726,7 +4726,7 @@ exit code: ${Z}`,new H1({color:X.foreground,dim:!0,italic:!0})));if(q)V.push(new
4726
4726
  `,N),...M],A=[new d1({text:new e("",void 0,L)})];if(K.url){let P=K.url.replace(/^https?:\/\//,"");A.push(new Q4({children:[new d1({text:new e("See more: ",N)}),new I7({uri:K.url,text:P,style:new H1({color:Y.secondary,underline:!0})})]}))}let E=new a0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:A});return H8.child(new t0({constraints:new a6(40,120,0,1/0),child:new Q4({mainAxisAlignment:"center",crossAxisAlignment:"center",children:[new z4({flex:1,child:new SC1({width:40,height:40,agentMode:this.agentMode,fps:q==="fast"?60:q==="slow"?15:0,...q==="disabled"&&{seed:42,t:3}})}),new U0({width:1}),new z4({flex:2,child:E})]})}))}}w0();D9();L4();m7();D9();r0();function LB8(J,Q){return`${J}:${Q}`}class q_1{threadService;workers=new Map;threadsMap=new Map;subthreadsMap=new Map;mainThreadSubs=new Map;subthreadsSubs=new Map;workerStatusSubs=new Map;subthreadPatchSubs=new Map;mainThreadObservable;subthreadObservable;workerStatusObservable;emitMainThread=null;emitSubthread=null;emitWorkerStatus=null;constructor(J){this.threadService=J;this.mainThreadObservable=new X0((Q)=>{return this.emitMainThread=(Y)=>Q.next(Y),()=>{this.emitMainThread=null}}),this.subthreadObservable=new X0((Q)=>{return this.emitSubthread=(Y)=>Q.next(Y),()=>{this.emitSubthread=null}}),this.workerStatusObservable=new X0((Q)=>{return this.emitWorkerStatus=(Y)=>Q.next(Y),()=>{this.emitWorkerStatus=null}})}registerWorker(J){let Q=J.thread.id;if(this.workers.has(Q))this.unregisterWorker(Q);this.threadsMap.set(Q,J.thread),this.subthreadsMap.set(Q,[]),this.workers.set(Q,{state:"initial"});let Y=this.threadService.observePatches(Q).pipe(zM()).subscribe((Z)=>{this.threadsMap.set(Q,Z);let q=this.subthreadsMap.get(Q)||[],V=this.workers.get(Q)||{state:"initial"};if(this.emitMainThread)this.emitMainThread({threadID:Q,mainThread:Z,subthreads:q,workerStatus:V})});this.mainThreadSubs.set(Q,Y);let X=J.status.subscribe((Z)=>{if(this.workers.set(Q,Z),this.emitWorkerStatus)this.emitWorkerStatus({threadID:Q,status:Z})});this.workerStatusSubs.set(Q,X);let G=J.subthreads.subscribe((Z)=>{this.subthreadsMap.set(Q,Z);for(let q of Z){let V=LB8(Q,q.toolUse.id);if(this.subthreadPatchSubs.has(V))continue;let K=this.threadService.observePatches(q.threadID).pipe(zM()).subscribe((W)=>{if(this.emitSubthread)this.emitSubthread({threadID:Q,thread:W,subthread:q})});this.subthreadPatchSubs.set(V,K)}});this.subthreadsSubs.set(Q,G)}unregisterWorker(J){let Q=this.mainThreadSubs.get(J);if(Q)Q.unsubscribe(),this.mainThreadSubs.delete(J);let Y=this.workerStatusSubs.get(J);if(Y)Y.unsubscribe(),this.workerStatusSubs.delete(J);let X=this.subthreadsSubs.get(J);if(X)X.unsubscribe(),this.subthreadsSubs.delete(J);for(let[G,Z]of this.subthreadPatchSubs.entries())if(G.startsWith(`${J}:`))Z.unsubscribe(),this.subthreadPatchSubs.delete(G);this.workers.delete(J),this.threadsMap.delete(J),this.subthreadsMap.delete(J)}observeThread(J){return{mainThread:new X0((Q)=>{return this.mainThreadObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})}),subthreads:new X0((Q)=>{return this.subthreadObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})}),workerStatus:new X0((Q)=>{return this.workerStatusObservable.subscribe((Y)=>{if(Y.threadID===J)Q.next(Y)})})}}get threadViewStates(){let J={};for(let[Q,Y]of this.threadsMap){let X=this.workers.get(Q);if(X)J[Q]=ZA(Y,X)}return J}dispose(){for(let J of this.mainThreadSubs.values())J.unsubscribe();for(let J of this.subthreadsSubs.values())J.unsubscribe();for(let J of this.workerStatusSubs.values())J.unsubscribe();for(let J of this.subthreadPatchSubs.values())J.unsubscribe();this.mainThreadSubs.clear(),this.subthreadsSubs.clear(),this.workerStatusSubs.clear(),this.subthreadPatchSubs.clear(),this.workers.clear(),this.threadsMap.clear(),this.subthreadsMap.clear()}}function AB8(J,Q){switch(Q.type){case"subthread-patch":{let{thread:Y,subthread:X}=Q,G=J.subagents[X.threadID];if(!G){if(G={subThreadID:Y.id,parentToolID:X.toolUse.id,taskDescription:X.toolUse.input.description||"Task",isCompleted:!1,agentState:{type:"idle"}},J.mainThread){let W=nJ(J.mainThread);G.isCompleted=aJ6(W,X.toolUse.id)}}let Z=OB8(Y,G.agentState),q=G.agentState===Z?G:{...G,agentState:Z},V={...J.tools},K=PC(Y).items.filter((W)=>W.type==="toolResult");for(let W of K)V[W.id]={id:W.id,subthreadID:Y.id,toolRun:W.toolResult.run,toolUse:W.toolUse};return{subagents:{...J.subagents,[X.threadID]:q},tools:V,items:J.items,viewState:J.viewState,todosList:J.todosList,mainThread:J.mainThread}}case"main-thread-patch":{let{thread:Y,subthreads:X,workerStatus:G}=Q,Z=nJ(Y),q={...J.subagents};for(let z of X){let U=q[z.threadID];if(!U)continue;let N=aJ6(Z,z.toolUse.id);q[z.threadID]={...U,isCompleted:N}}let{items:V}=PC(Y),K=ZA(Y,G),W=nE({messages:Y.messages}),H=Array.isArray(W)?W:[];return{...J,subagents:q,items:V,viewState:K,todosList:H,mainThread:Y}}case"worker-status-change":{if(!J.mainThread)return J;let Y=ZA(J.mainThread,Q.workerStatus);if(Y===J.viewState)return J;return{...J,viewState:Y}}default:return J}}function PC(J){let Q=[],Y=new Map,X=new Set;for(let[G,Z]of J.messages.entries()){let q=`${Z.role}-${G}`;switch(Z.role){case"assistant":{let V=Z.state.type==="streaming";for(let W of Z.content)if(W.type==="tool_use"){if(Y.set(W.id,W),V)X.add(W.id)}if(Z.content.some((W)=>W.type==="text"&&W.text.trim()||W.type==="thinking"))Q.push({type:"message",id:q,message:Z});for(let W of Z.content)if(W.type==="tool_use"){let H=!1;for(let z=G+1;z<J.messages.length;z++){let U=J.messages[z];if(U){for(let N of U.content)if(N.type==="tool_result"&&N.toolUseID===W.id){H=!0;break}}if(H)break}if(!H)Q.push({type:"toolResult",id:W.id,toolUse:W,toolResult:{type:"tool_result",toolUseID:W.id,run:{status:V?"in-progress":"queued"}}})}break}case"info":Q.push({type:"message",id:q,message:Z});break;case"user":{let V=Z.content.some((K)=>K.type==="text"&&K.text.trim()||K.type==="image");for(let K of Z.content)if(K.type==="tool_result"){let W=Y.get(K.toolUseID)??UX(J,K.toolUseID);if(!W)throw Error(`(bug) tool use ${K.toolUseID} not found`);Q.push({type:"toolResult",id:K.toolUseID,toolUse:W,toolResult:K})}if(V)Q.push({type:"message",id:q,message:Z});break}}}return{items:Q}}function aJ6(J,Q){let Y=J.get(Q);return(Y&&F2(Y.run))??!1}function OB8(J,Q){let Y=J.messages.at(-1);if(Y?.content.some((G)=>G.type==="tool_result"&&G.run.status==="blocked-on-user"))return h.info("Subagent status: idle (blocked-on-user)",{threadID:J.id}),{type:"idle"};if(PC(J).items.some((G)=>G.type==="toolResult"&&G.toolResult.run.status==="in-progress")){let G=Q?.type==="running-tools"?Q.startTime:Date.now();return h.info("Subagent status: running-tools",{threadID:J.id,startTime:G,hasStartTime:!!G}),{type:"running-tools",startTime:G}}if(Y&&Y.role==="assistant"&&Y.state.type==="streaming")switch(Y.content.at(-1)?.type){case"text":return h.info("Subagent status: streaming-text",{threadID:J.id}),{type:"streaming-text"};case"thinking":return h.info("Subagent status: streaming-thinking",{threadID:J.id}),{type:"streaming-thinking"};case"tool_use":{let Z=Q?.type==="running-tools"?Q.startTime:Date.now();return h.info("Subagent status: running-tools (streaming tool_use)",{threadID:J.id,startTime:Z,hasStartTime:!!Z}),{type:"running-tools",startTime:Z}}default:return h.info("Subagent status: streaming-text (default)",{threadID:J.id}),{type:"streaming-text"}}return h.info("Subagent status: idle (default)",{threadID:J.id}),{type:"idle"}}class V_1 extends X6{props;constructor(J){super();this.props=J}createState(){return new oJ6}}class oJ6 extends Y6{state={subagents:{},tools:{},items:[],viewState:{state:"initial",interactionState:!1,toolState:{running:0,blocked:0}},todosList:[],mainThread:null};workerController;subscriptions=[];recentThreadIDs=[];currentWorker;constructor(){super();this.workerController=null,this.currentWorker=null}addToRecentThreads(J){this.setState(()=>{let Q=this.recentThreadIDs.indexOf(J);if(Q!==-1)this.recentThreadIDs.splice(Q,1);if(this.recentThreadIDs.unshift(J),this.recentThreadIDs.length>50)this.recentThreadIDs.pop()})}initState(){let{threadService:J,worker:Q}=this.widget.props;this.workerController=new q_1(J),this.currentWorker=Q,this.setupSubscriptions(Q),this.addToRecentThreads(Q.thread.id)}dispose(){this.cleanup()}didUpdateWidget(J){if(J.props.threadService!==this.widget.props.threadService||J.props.worker!==this.widget.props.worker)this.cleanup(),this.setupSubscriptions(this.widget.props.worker)}setupSubscriptions(J){this.workerController.registerWorker(J);let Q=this.workerController.observeThread(J.thread.id),Y=Q.mainThread.subscribe((Z)=>{this.dispatch({type:"main-thread-patch",thread:Z.mainThread,subthreads:Z.subthreads,workerStatus:Z.workerStatus})});this.subscriptions.push(Y);let X=Q.subthreads.subscribe((Z)=>{this.dispatch({type:"subthread-patch",thread:Z.thread,subthread:Z.subthread})});this.subscriptions.push(X);let G=Q.workerStatus.subscribe((Z)=>{this.dispatch({type:"worker-status-change",workerStatus:Z.status})});this.subscriptions.push(G)}cleanup(){this.subscriptions.forEach((J)=>J.unsubscribe()),this.subscriptions=[]}switchWorker(J){this.cleanup(),this.setState(()=>{this.currentWorker=J}),this.setState(()=>{this.state={subagents:{},tools:{},items:[],viewState:{state:"initial",interactionState:!1,toolState:{running:0,blocked:0}},todosList:[],mainThread:null}}),this.setupSubscriptions(J),this.addToRecentThreads(J.thread.id)}dispatch(J){this.setState(()=>{this.state=AB8(this.state,J)})}getThreadData(){let J=Object.values(this.state.tools).map((Z)=>({toolUse:Z.toolUse,toolRun:Z.toolRun,subthreadID:Z.subthreadID})),Q={};for(let Z of Object.values(this.state.subagents)){let q=J.filter((V)=>V.subthreadID===Z.subThreadID);Q[Z.parentToolID]=q}let Y=(Z)=>Z===r5||Z===q9||Z===FX,X=new Map;for(let Z of this.state.items)if(Z.type==="toolResult"&&Y(Z.toolUse.name))X.set(Z.toolUse.id,{toolUseId:Z.toolUse.id,toolName:Z.toolUse.name,toolRun:Z.toolResult.run});let G=Array.from(X.values());for(let{toolUseId:Z,toolRun:q}of G){let V=[],K;if(q.status==="in-progress"||q.status==="done"||q.status==="error"||q.status==="cancelled")K=q.progress;if(K){let W=0;for(let H of K)if(H.tool_uses)for(let z of H.tool_uses){let U=`${Z}:progress:${W++}`;V.push({toolUse:cE(z.tool_name,z.input,U),toolRun:{status:z.status}})}}Q[Z]=V}return{...this.state,subagents:Object.values(this.state.subagents),subagentActiveTools:J,subagentToolsByParentID:Q}}build(J){let Q=this.getThreadData();return this.widget.props.builder(J,Q,this.workerController,(Y)=>this.switchWorker(Y),()=>this.currentWorker,this.recentThreadIDs)}}class K_1 extends X6{props;constructor(J){super({key:J.key});this.props=J}createState(){return new rJ6}}class rJ6 extends Y6{build(J){let Y=S6.of(J).colors,{todos:X,title:G="TODOs"}=this.widget.props;if(!Array.isArray(X)||X.length===0)return new U0({width:0,height:0});let Z=X.map((q)=>this.buildTodoItem(q,Y));return new t0({child:new d6({padding:v0.symmetric(1,0),child:new a0({crossAxisAlignment:"stretch",mainAxisSize:"min",children:[new d1({text:new e(G,new H1({bold:!0,color:Y.foreground}))}),...Z]})})})}buildTodoItem(J,Q){let Y=this.getStatusIcon(J.status),X=J.status==="completed",G=new H1({bold:J.status==="in-progress",color:Q.foreground,dim:X}),Z=new H1({bold:J.status==="in-progress",strikethrough:J.status==="completed",color:Q.foreground,dim:X});return new Q4({crossAxisAlignment:"start",children:[new d1({text:new e(Y,G)}),new U0({width:1}),new z4({child:new d1({text:new e(J.content,Z)})})]})}getStatusIcon(J){return J==="completed"?"✓":"•"}}class W_1 extends j6{ad;onDismiss;onButtonClick;constructor({key:J,ad:Q,onDismiss:Y,onButtonClick:X}){super({key:J});this.ad=Q,this.onDismiss=Y,this.onButtonClick=X}build(J){let Q=S6.of(J),Y=Q.colors.primary,X=Q.colors.foreground;return new t0({decoration:new B8(void 0,new b4(new O4(Y,1,"rounded"),new O4(Y,1,"rounded"),void 0,new O4(Y,1,"rounded"))),child:new d6({padding:v0.horizontal(1),child:new a0({children:[new Q4({crossAxisAlignment:"start",children:[new z4({child:new d1({text:new e(this.ad.content,new H1({color:X}))})}),new U0({width:4}),new I7({uri:"https://ampcode.com/free",text:"Ad",style:new H1({color:X,dim:!0})})]}),new Q4({crossAxisAlignment:"start",children:[new pC1({text:this.ad.buttonLabel,onPressed:()=>this.onButtonClick?.(),padding:v0.horizontal(1),color:Y,reverse:!0}),new U0({width:2}),new d1({text:new e(this.ad.destinationUrlHostname,new H1({color:X,dim:!0}))})]})]})})})}}class H_1 extends X6{props;constructor(J){super();this.props=J}createState(){return new sJ6(this.props.autofocus??!0)}}class sJ6 extends Y6{autofocus;constructor(J){super();this.autofocus=J}build(J){let Q=(V)=>{if(V.key==="Enter"&&this.widget.props.showCopyOption)return this.widget.props.onSelect("copy"),"handled";if(V.ctrlKey&&V.key==="c"||V.key==="Escape")return this.widget.props.onSelect(null),"handled";return"ignored"},Y=W8.sizeOf(J),X=Math.min(60,Y.width-4),G=Y.height-4,Z=[];if(this.widget.props.title)Z.push(new d1({text:new e(this.widget.props.title,new H1({bold:!0,color:O1.blue}))}),new U0({height:1}));if(this.widget.props.message)Z.push(new d1({text:new e(this.widget.props.message,void 0,void 0,{uri:this.widget.props.message,id:"ad-link"})}));if(this.widget.props.message)Z.push(new U0({height:1}));let q=[];if(this.widget.props.showCopyOption)q.push(new d1({text:new e("Enter to copy",new H1({dim:!0}))}));return q.push(new d1({text:new e("Escape to close",new H1({dim:!0}))})),Z.push(new Q4({children:q.flatMap((V,K)=>K<q.length-1?[V,new U0({width:1}),new d1({text:new e("•",new H1({dim:!0}))}),new U0({width:1})]:[V]),mainAxisSize:"min"})),new H8({child:new t0({constraints:new a6(X,X,0,G),decoration:new B8(O1.default(),new b4(new O4(O1.blue,1,"rounded"),new O4(O1.blue,1,"rounded"),new O4(O1.blue,1,"rounded"),new O4(O1.blue,1,"rounded"))),padding:new v0(2,2,2,2),child:new Q9({autofocus:this.autofocus,onKey:Q,child:new a0({children:Z,mainAxisSize:"min"})})})})}}class m81 extends Error{constructor(J="Command timed out"){super(J);this.name="CommandTimeoutError",Object.setPrototypeOf(this,m81.prototype)}}class u81 extends Error{constructor(J){let Q=`${J.noun}: ${J.verb} command cancelled`;super(Q);this.name="CommandCancelledError",Object.setPrototypeOf(this,u81.prototype)}}function z_1(J){let Q=J.match(/"([^"]*)"|'([^']*)'|([^\s"']+)/g);if(!Q)return[];return Q.map((Y)=>{if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);return Y})}ZU();w0();import{spawn as wB8}from"node:child_process";import{promises as EB8}from"node:fs";function tJ6(J){return J.kind==="executable"}function eJ6(J){return J.kind==="markdown"}var Az=50000,JQ6=300000;async function F_1(J,Q,Y,X={}){let{timeoutMs:G=JQ6,signal:Z,source:q}=X;try{let V=await Y.getCommand(J,q);if(!V)return{success:!1,output:"",error:`Command '${J}' not found`};if(!await Y.isCommandAvailable(J,q))return{success:!1,output:"",error:`Command '${J}' is not available for execution`};if(h.debug("Executing command",{commandName:J,filePath:V.filePath,args:Q}),eJ6(V))return await IB8(V,Q);else if(tJ6(V))return await PB8(V,Q,G,Z);else return{success:!1,output:"",error:"Unsupported command type"}}catch(V){return h.error("Failed to execute command",{commandName:J,error:V}),{success:!1,output:"",error:V instanceof Error?V.message:"Unknown error occurred"}}}async function IB8(J,Q){try{if(Q.length>0)return{success:!1,output:"",error:"Markdown commands do not accept arguments"};let Y=await EB8.readFile(J.filePath,"utf8");return{success:!0,output:(Y.length>Az?Y.slice(0,Az)+`
4727
4727
  ... (output truncated at ${Az} characters)`:Y).trim(),exitCode:0}}catch(Y){return{success:!1,output:"",error:Y instanceof Error?Y.message:"Failed to read markdown file"}}}async function PB8(J,Q,Y=JQ6,X){return new Promise((G)=>{let[Z,q]=TB8(J,Q);h.debug("Spawning command",{spawnCommand:Z,spawnArgs:q.slice(0,10),filePath:J.filePath,timeoutMs:Y});let V=jO0(X),K=!1,W=setTimeout(()=>{K=!0,V.abort(),h.warn("Command execution timed out",{commandName:J.name,timeoutMs:Y})},Y),H=wB8(Z,q,{stdio:["pipe","pipe","pipe"],signal:V.signal,detached:!0}),z=[],U=[],N=0;H.stdout?.on("data",(M)=>{let L=M.toString();if(N+=L.length,N<=Az)z.push(L);else{let A=Az-(N-L.length);if(A>0)z.push(L.slice(0,A))}}),H.stderr?.on("data",(M)=>{let L=M.toString();if(N+=L.length,N<=Az)U.push(L);else{let A=Az-(N-L.length);if(A>0)U.push(L.slice(0,A))}}),H.on("close",(M)=>{if(clearTimeout(W),K){G({success:!1,output:z.join(""),error:`Command timed out after ${Y}ms`,exitCode:void 0});return}if(V.signal.aborted){G({success:!1,output:z.join(""),error:"The command was aborted",exitCode:M??void 0});return}let L=M===0||M===1,A=z.join(""),E=U.join(""),P=A;if(!L&&!A.trim()&&E.trim())P=E;else if(E.trim())P+=A?`
4728
4728
  ${E}`:E;if(N>Az)P+=`
4729
- ... (output truncated at ${Az} characters)`;G({success:L,output:P.trim(),error:!L?E.trim()||"Command failed":void 0,exitCode:M??void 0})}),H.on("error",(M)=>{clearTimeout(W);let L=M.message;if(K)L=`Command timed out after ${Y}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")L="The command was aborted";G({success:!1,output:z.join(""),error:L})})})}function TB8(J,Q){let{filePath:Y,interpreter:X,extension:G}=J;if(process.platform==="win32")return CB8(Y,X?[...X]:null,G,Q);else return RB8(Y,X?[...X]:null,G,Q)}function RB8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function CB8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Y.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}w0();T$();g2();hW();rG();m$();JH();LH();m7();u_();r0();var WQ6=D6(wP(),1);import{writeFile as qQ6}from"fs/promises";import VQ6 from"path";w0();rG();class U_1{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J,Q){this.enabled=J;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Y])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1764273685-g926f68"},parameters:{metadata:{count:Y}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await la(Q,this.configService)}catch(Q){h.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}class B_1 extends X6{props;constructor(J){super();this.props=J}createState(){return new QQ6}}class QQ6 extends Y6{_state;initState(){super.initState(),this._state=this.widget.props.initialState}build(J){let Q=(Y)=>{this.setState(()=>{this._state=Y(this._state)})};return this.widget.props.builder(J,Q,this._state)}}class YQ6 extends Y6{controller=new xZ;focusNode=new d8({debugLabel:"CommandArgumentPrompt",onKey:(J)=>{if(J.key==="Escape")return this.widget.props.onDismiss(),"handled";return"ignored"}});_textListener=()=>{this.setState(()=>{})};initState(){this.focusNode.requestFocus(),this.controller.addListener(this._textListener)}dispose(){this.controller.removeListener(this._textListener),this.focusNode.dispose()}build(J){let Q=S6.of(J),{colors:Y,app:X}=Q,G=this.widget.props.isRequiredArg??!0,Z=this.controller.text.trim().length>0,q=!G||Z,V=b4.all(new O4(Y.foreground,1,"solid")),K=new sA({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(N)=>{let M=N.trim();if(G&&M.length===0)return;this.widget.props.onSubmit(M)},autofocus:!0,style:{textColor:Y.foreground,border:null},maxLines:1}),W=new Q4({children:[new t0({decoration:{color:O1.default()},child:new d1({text:new e(">",new H1({color:Y.foreground}))})}),new z4({child:K})]}),H=new t0({padding:v0.symmetric(1,0),child:new d1({text:new e("",void 0,[new e("Command: ",new H1({color:Y.foreground})),new e(this.widget.props.commandName,new H1({color:O1.yellow,bold:!0}))])})}),z=[];if(q)z.push(new e("Enter",new H1({color:X.keybind}))),z.push(new e(" to submit, ",new H1({color:Y.foreground,dim:!0})));z.push(new e("Esc",new H1({color:X.keybind}))),z.push(new e(" to cancel",new H1({color:Y.foreground,dim:!0})));let U=new t0({padding:v0.symmetric(1,0),child:new d1({text:new e("",void 0,z)})});return new t0({decoration:{border:V,color:O1.default()},padding:v0.all(1),child:new a0({children:[H,new U0({height:1}),W,new i5,U]})})}}class p81 extends X6{props;constructor(J){super();this.props=J}createState(){return new YQ6}}JH();class XQ6 extends Y6{controller=new xZ;imageAttachments=[];imagePaths=[];isConfirmingClearInput=!1;clearInputConfirmTimeout=null;focusNode=new d8({debugLabel:"CommandMultilinePrompt",onKey:(J)=>{if(J.key==="Escape"){if(this.isConfirmingClearInput){if(this.controller.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[],this.imagePaths=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.controller.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return this.widget.props.onDismiss(),"handled"}return"ignored"}});initState(){if(this.widget.props.initialText)this.controller.text=this.widget.props.initialText;if(this.widget.props.initialImages)this.imageAttachments=[...this.widget.props.initialImages];this.focusNode.requestFocus()}_handleInsertImage=(J)=>{if(this.imageAttachments.length>=$U)return!1;let Q=qC(J);if(typeof Q==="object")return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,Q],this.imagePaths=[...this.imagePaths,J]}),!1;return!1};_handlePopImage=()=>{if(this.imageAttachments.length>0)this.setState(()=>{this.imageAttachments=this.imageAttachments.slice(0,-1),this.imagePaths=this.imagePaths.slice(0,-1)})};dispose(){if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;this.focusNode.dispose(),this.controller.dispose()}build(J){let Q=S6.of(J),{colors:Y,app:X}=Q,Z=W8.of(J).size.height,q=Math.max(Math.floor(Z*0.5),10),V=new WO({controller:this.controller,triggers:[new VN],completionBuilder:this.widget.props.completionBuilder,ampURL:this.widget.props.ampURL,onSubmitted:(N)=>{this.widget.props.onSubmit(N.trim(),this.imageAttachments)},theme:Y,placeholder:this.widget.props.placeholder||"Enter your message...",enabled:this.widget.props.enabled??!0,autofocus:!0,clipboard:I9.instance.tuiInstance.clipboard,showMenuBelow:!0,onInsertImage:this.widget.props.onInsertImage??this._handleInsertImage,imageAttachments:this.imageAttachments,popImage:this._handlePopImage}),K=new Q9({focusNode:this.focusNode,child:V}),W=new t0({constraints:new a6({maxHeight:q}),padding:v0.symmetric(1,0),child:K}),H=new t0({padding:v0.symmetric(1,0),child:new d1({text:new e("",void 0,[new e("Command: ",new H1({color:Y.foreground})),new e(this.widget.props.commandName,new H1({color:O1.yellow,bold:!0}))])})}),z=new t0({padding:v0.symmetric(1,0),child:new d1({text:this.isConfirmingClearInput?new e("",void 0,[new e("Esc",new H1({color:X.keybind})),new e(" again to clear input",new H1({color:Y.foreground,dim:!0}))]):new e("",void 0,[new e("Press ",new H1({color:Y.foreground,dim:!0})),new e("Enter",new H1({color:X.keybind})),new e(" to submit, ",new H1({color:Y.foreground,dim:!0})),new e("Esc",new H1({color:X.keybind})),new e(" to clear",new H1({color:Y.foreground,dim:!0}))])})}),U=[H,new U0({height:1}),new z4({child:W}),new U0({height:1}),z];return new t0({decoration:{border:b4.all(new O4(Y.foreground,1,"solid")),color:O1.default()},padding:v0.all(1),child:new a0({children:U})})}}class HO extends X6{props;constructor(J){super();this.props=J}createState(){return new XQ6}}function GQ6(J){let Y=new Date().getTime()-J.getTime(),X=Math.floor(Y/60000),G=Math.floor(Y/3600000),Z=Math.floor(Y/86400000);if(X<1)return"just now";if(X<60)return`${X}m ago`;if(G<24)return`${G}h ago`;if(Z<7)return`${Z}d ago`;return J.toLocaleDateString()}class N_1 extends j6{props;debugLabel="ThreadFeedPicker";constructor(J){super();this.props=J}build(J){let Q=[...this.props.entries].sort((G,Z)=>Z.pubDate.getTime()-G.pubDate.getTime()),Y=Math.max(0,...Q.map((G)=>GQ6(G.pubDate).length));return new yK({items:Q,getLabel:(G)=>G.title,onAccept:(G)=>this.props.onSelect?.(G),onDismiss:this.props.onDismiss,title:this.props.title,emptyStateText:"No thread feed entries available",maxRenderItems:100,renderItem:(G,Z,q,V)=>{let K=S6.of(V),{colors:W}=K,H=Z?O1.yellow:void 0,z=Z?O1.black:W.foreground,U=O1.index(8),N=G.authors.map((L)=>L.name).join(", ")||"Community",M=(L,A)=>new U0({width:A,child:Q4.end([new d1({text:new e(L,new H1({color:U}))})])});return new t0({decoration:H?{color:H}:void 0,padding:v0.symmetric(2,0),child:new Q4({children:[new z4({child:new d1({text:new e(G.title,new H1({color:z})),overflow:"ellipsis",maxLines:1})}),new U0({width:2}),new d1({text:new e(N,new H1({color:U})),maxLines:1}),new U0({width:2}),M(GQ6(G.pubDate),Y)]})})}})}}class D_1 extends j6{props;constructor(J){super();this.props=J}build(){return new H8({child:new d1({text:new e("",void 0,[new e(`Forked to new thread:
4729
+ ... (output truncated at ${Az} characters)`;G({success:L,output:P.trim(),error:!L?E.trim()||"Command failed":void 0,exitCode:M??void 0})}),H.on("error",(M)=>{clearTimeout(W);let L=M.message;if(K)L=`Command timed out after ${Y}ms`;else if(M.message.includes("operation was aborted")||M.name==="AbortError")L="The command was aborted";G({success:!1,output:z.join(""),error:L})})})}function TB8(J,Q){let{filePath:Y,interpreter:X,extension:G}=J;if(process.platform==="win32")return CB8(Y,X?[...X]:null,G,Q);else return RB8(Y,X?[...X]:null,G,Q)}function RB8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];else return[J,X]}function CB8(J,Q,Y,X){if(Q&&Q.length>0&&Q[0])return[Q[0],[...Q.slice(1),J,...X]];switch(Y.toLowerCase()){case".bat":case".cmd":return["cmd.exe",["/c",J,...X]];case".ps1":return["powershell.exe",["-ExecutionPolicy","Bypass","-File",J,...X]];case".exe":return[J,X];default:return[J,X]}}w0();T$();g2();hW();rG();m$();JH();LH();m7();u_();r0();var WQ6=D6(wP(),1);import{writeFile as qQ6}from"fs/promises";import VQ6 from"path";w0();rG();class U_1{enabled;configService;commandCounts=new Map;timer=null;bufferTimeMs=1e4;constructor(J,Q){this.enabled=J;this.configService=Q;this.startTimer()}startTimer(){this.timer=setInterval(()=>{this.flushEvents()},this.bufferTimeMs)}async flushEvents(){if(this.commandCounts.size===0||!await this.enabled())return;let J=Array.from(this.commandCounts.entries()).map(([Q,Y])=>({feature:"cli.command",action:Q,source:{client:"cli",clientVersion:"0.0.1764288114-gd779fe"},parameters:{metadata:{count:Y}},timestamp:Date.now()*1000}));this.commandCounts.clear();try{let Q=JSON.stringify(J);await la(Q,this.configService)}catch(Q){h.error("Failed to export command telemetry events",Q)}}async submit(J){if(!await this.enabled()||this.timer===null)return;let Q=this.commandCounts.get(J)||0;this.commandCounts.set(J,Q+1)}async dispose(){if(await this.flushEvents(),this.timer!==null)clearInterval(this.timer),this.timer=null}}class B_1 extends X6{props;constructor(J){super();this.props=J}createState(){return new QQ6}}class QQ6 extends Y6{_state;initState(){super.initState(),this._state=this.widget.props.initialState}build(J){let Q=(Y)=>{this.setState(()=>{this._state=Y(this._state)})};return this.widget.props.builder(J,Q,this._state)}}class YQ6 extends Y6{controller=new xZ;focusNode=new d8({debugLabel:"CommandArgumentPrompt",onKey:(J)=>{if(J.key==="Escape")return this.widget.props.onDismiss(),"handled";return"ignored"}});_textListener=()=>{this.setState(()=>{})};initState(){this.focusNode.requestFocus(),this.controller.addListener(this._textListener)}dispose(){this.controller.removeListener(this._textListener),this.focusNode.dispose()}build(J){let Q=S6.of(J),{colors:Y,app:X}=Q,G=this.widget.props.isRequiredArg??!0,Z=this.controller.text.trim().length>0,q=!G||Z,V=b4.all(new O4(Y.foreground,1,"solid")),K=new sA({controller:this.controller,focusNode:this.focusNode,placeholder:this.widget.props.placeholder??"Enter command argument...",onSubmitted:(N)=>{let M=N.trim();if(G&&M.length===0)return;this.widget.props.onSubmit(M)},autofocus:!0,style:{textColor:Y.foreground,border:null},maxLines:1}),W=new Q4({children:[new t0({decoration:{color:O1.default()},child:new d1({text:new e(">",new H1({color:Y.foreground}))})}),new z4({child:K})]}),H=new t0({padding:v0.symmetric(1,0),child:new d1({text:new e("",void 0,[new e("Command: ",new H1({color:Y.foreground})),new e(this.widget.props.commandName,new H1({color:O1.yellow,bold:!0}))])})}),z=[];if(q)z.push(new e("Enter",new H1({color:X.keybind}))),z.push(new e(" to submit, ",new H1({color:Y.foreground,dim:!0})));z.push(new e("Esc",new H1({color:X.keybind}))),z.push(new e(" to cancel",new H1({color:Y.foreground,dim:!0})));let U=new t0({padding:v0.symmetric(1,0),child:new d1({text:new e("",void 0,z)})});return new t0({decoration:{border:V,color:O1.default()},padding:v0.all(1),child:new a0({children:[H,new U0({height:1}),W,new i5,U]})})}}class p81 extends X6{props;constructor(J){super();this.props=J}createState(){return new YQ6}}JH();class XQ6 extends Y6{controller=new xZ;imageAttachments=[];imagePaths=[];isConfirmingClearInput=!1;clearInputConfirmTimeout=null;focusNode=new d8({debugLabel:"CommandMultilinePrompt",onKey:(J)=>{if(J.key==="Escape"){if(this.isConfirmingClearInput){if(this.controller.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[],this.imagePaths=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.controller.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return this.widget.props.onDismiss(),"handled"}return"ignored"}});initState(){if(this.widget.props.initialText)this.controller.text=this.widget.props.initialText;if(this.widget.props.initialImages)this.imageAttachments=[...this.widget.props.initialImages];this.focusNode.requestFocus()}_handleInsertImage=(J)=>{if(this.imageAttachments.length>=$U)return!1;let Q=qC(J);if(typeof Q==="object")return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,Q],this.imagePaths=[...this.imagePaths,J]}),!1;return!1};_handlePopImage=()=>{if(this.imageAttachments.length>0)this.setState(()=>{this.imageAttachments=this.imageAttachments.slice(0,-1),this.imagePaths=this.imagePaths.slice(0,-1)})};dispose(){if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;this.focusNode.dispose(),this.controller.dispose()}build(J){let Q=S6.of(J),{colors:Y,app:X}=Q,Z=W8.of(J).size.height,q=Math.max(Math.floor(Z*0.5),10),V=new WO({controller:this.controller,triggers:[new VN],completionBuilder:this.widget.props.completionBuilder,ampURL:this.widget.props.ampURL,onSubmitted:(N)=>{this.widget.props.onSubmit(N.trim(),this.imageAttachments)},theme:Y,placeholder:this.widget.props.placeholder||"Enter your message...",enabled:this.widget.props.enabled??!0,autofocus:!0,clipboard:I9.instance.tuiInstance.clipboard,showMenuBelow:!0,onInsertImage:this.widget.props.onInsertImage??this._handleInsertImage,imageAttachments:this.imageAttachments,popImage:this._handlePopImage}),K=new Q9({focusNode:this.focusNode,child:V}),W=new t0({constraints:new a6({maxHeight:q}),padding:v0.symmetric(1,0),child:K}),H=new t0({padding:v0.symmetric(1,0),child:new d1({text:new e("",void 0,[new e("Command: ",new H1({color:Y.foreground})),new e(this.widget.props.commandName,new H1({color:O1.yellow,bold:!0}))])})}),z=new t0({padding:v0.symmetric(1,0),child:new d1({text:this.isConfirmingClearInput?new e("",void 0,[new e("Esc",new H1({color:X.keybind})),new e(" again to clear input",new H1({color:Y.foreground,dim:!0}))]):new e("",void 0,[new e("Press ",new H1({color:Y.foreground,dim:!0})),new e("Enter",new H1({color:X.keybind})),new e(" to submit, ",new H1({color:Y.foreground,dim:!0})),new e("Esc",new H1({color:X.keybind})),new e(" to clear",new H1({color:Y.foreground,dim:!0}))])})}),U=[H,new U0({height:1}),new z4({child:W}),new U0({height:1}),z];return new t0({decoration:{border:b4.all(new O4(Y.foreground,1,"solid")),color:O1.default()},padding:v0.all(1),child:new a0({children:U})})}}class HO extends X6{props;constructor(J){super();this.props=J}createState(){return new XQ6}}function GQ6(J){let Y=new Date().getTime()-J.getTime(),X=Math.floor(Y/60000),G=Math.floor(Y/3600000),Z=Math.floor(Y/86400000);if(X<1)return"just now";if(X<60)return`${X}m ago`;if(G<24)return`${G}h ago`;if(Z<7)return`${Z}d ago`;return J.toLocaleDateString()}class N_1 extends j6{props;debugLabel="ThreadFeedPicker";constructor(J){super();this.props=J}build(J){let Q=[...this.props.entries].sort((G,Z)=>Z.pubDate.getTime()-G.pubDate.getTime()),Y=Math.max(0,...Q.map((G)=>GQ6(G.pubDate).length));return new yK({items:Q,getLabel:(G)=>G.title,onAccept:(G)=>this.props.onSelect?.(G),onDismiss:this.props.onDismiss,title:this.props.title,emptyStateText:"No thread feed entries available",maxRenderItems:100,renderItem:(G,Z,q,V)=>{let K=S6.of(V),{colors:W}=K,H=Z?O1.yellow:void 0,z=Z?O1.black:W.foreground,U=O1.index(8),N=G.authors.map((L)=>L.name).join(", ")||"Community",M=(L,A)=>new U0({width:A,child:Q4.end([new d1({text:new e(L,new H1({color:U}))})])});return new t0({decoration:H?{color:H}:void 0,padding:v0.symmetric(2,0),child:new Q4({children:[new z4({child:new d1({text:new e(G.title,new H1({color:z})),overflow:"ellipsis",maxLines:1})}),new U0({width:2}),new d1({text:new e(N,new H1({color:U})),maxLines:1}),new U0({width:2}),M(GQ6(G.pubDate),Y)]})})}})}}class D_1 extends j6{props;constructor(J){super();this.props=J}build(){return new H8({child:new d1({text:new e("",void 0,[new e(`Forked to new thread:
4730
4730
 
4731
4731
  `,new H1({color:O1.white,dim:!0})),new e(`"${this.props.newThreadTitle||"Untitled"}"`,new H1({color:O1.white}))]),textAlign:"center"})})}}class Oz extends X6{props;constructor(J){super();this.props=J}createState(){return new ZQ6}}class ZQ6 extends Y6{_spinner=new bK;animationInterval=null;initState(){super.initState(),this.animationInterval=setInterval(()=>{this._spinner.step(),this.setState(()=>{})},100)}dispose(){if(this.animationInterval)clearInterval(this.animationInterval),this.animationInterval=null;super.dispose()}build(J){let Q=S6.of(J),{colors:Y}=Q,X=b4.all(new O4(Y.foreground,1,"solid")),G=this._spinner.toBraille(),Z=new d1({textAlign:"center",text:new e("",void 0,[new e(G,new H1({color:O1.yellow})),new e(" ",void 0),new e(this.widget.props.message,new H1({color:Y.foreground}))])}),V=[new z4({child:new a0({mainAxisAlignment:"center",crossAxisAlignment:"center",children:[Z]})})];if(this.widget.props.onAbort)V.push(new U0({height:2,child:new t0({padding:v0.symmetric(2,0),child:new d1({text:new e("",new H1({dim:!0}),[new e("Press ",new H1({color:Y.foreground})),new e("Esc",new H1({color:Y.info})),new e(" to cancel",new H1({color:Y.foreground}))])})})}));let K=new t0({decoration:new B8(O1.default(),X),child:new U0({width:60,height:7,child:new a0({mainAxisAlignment:"start",children:V})})});if(this.widget.props.onAbort)return new Q9({debugLabel:"LoadingDialog",autofocus:!0,onKey:(W)=>{if(W.key==="Escape")return this.widget.props.onAbort?.(),"handled";return"ignored"},child:K});return K}}class wz extends X6{props;constructor(J){super();this.props=J}createState(){return new $Q6}}class $Q6 extends Y6{dispose(){super.dispose()}isWidgetMessage(J){return J instanceof xK}build(J){let Q=this.widget.props.message,Y=(()=>{if(this.isWidgetMessage(Q))return{title:Q.title,type:Q.type};if(Q instanceof Error&&Q.name==="CommandCancelledError")return{title:"Cancelled",type:"info",description:Q.message};if(Q instanceof Error&&Q.name==="CommandTimeoutError")return{title:"Timeout",type:"error",description:Q.message};let W=n41(Q);return{title:W.title,type:W.type,description:W.description}})(),X=Y.type==="error"?O1.red:O1.yellow,G=b4.all(new O4(O1.default(),1,"solid")),Z=new t0({padding:v0.symmetric(1,0),child:new d1({text:new e(Y.title,new H1({color:X,bold:!0}))})}),q=this.isWidgetMessage(Q)?Q.widget:new d1({text:new e(Y.description,new H1({color:O1.default()})),selectable:!0}),V=new z4({child:new aA({child:new t0({padding:v0.symmetric(1,0),child:q})})}),K=new t0({padding:v0.symmetric(1,0),child:new d1({text:this.widget.props.onRetry?new e("",void 0,[new e("Press ",new H1({color:O1.default(),dim:!0})),new e("R",new H1({color:O1.yellow})),new e(" to retry, ",new H1({color:O1.default(),dim:!0})),new e("Esc",new H1({color:O1.yellow})),new e(" to cancel",new H1({color:O1.default(),dim:!0}))]):new e("Press any key to close",new H1({color:O1.default(),dim:!0,italic:!0}))})});return new Q9({onKey:(W)=>{if(this.widget.props.onRetry&&W.key==="r")return this.widget.props.onRetry(),"handled";if(W.key==="Escape")return this.widget.props.onDismiss(),"handled";if(!this.widget.props.onRetry)return this.widget.props.onDismiss(),"handled";return"ignored"},autofocus:!0,child:new t0({decoration:{border:G,color:O1.default()},padding:v0.all(1),child:new a0({mainAxisAlignment:"center",children:[Z,new U0({height:1}),V,K]})})})}}class M_1 extends j6{build(){return new H8({child:new d1({text:new e("",void 0,[new e(`✓ Thread Shared
4732
4732
 
@@ -4814,7 +4814,7 @@ https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_di
4814
4814
  `)?`${V}...`:G,W=new H1({color:O1.index(8)}),H=[new e(K,W)];if(q>0){let z=new H1({color:Y.success});for(let U=1;U<=q;U++)H.push(new e(" ")),H.push(new e(`[${U}]`,z))}return new d6({padding:v0.only({bottom:0}),child:new Q4({crossAxisAlignment:"start",children:[new d6({padding:v0.only({right:1}),child:new d1({text:new e("•",new H1({color:O1.index(8)}))})}),new z4({child:new d1({text:new e("",void 0,H)})})]})})}}class a_1 extends X6{createState(){return new YY6}}class YY6 extends Y6{_animationTimer;_visible=!0;initState(){super.initState(),this._startAnimation()}dispose(){this._stopAnimation(),super.dispose()}_startAnimation(){this._animationTimer=setInterval(()=>{this.setState(()=>{this._visible=!this._visible})},500)}_stopAnimation(){if(this._animationTimer)clearInterval(this._animationTimer),this._animationTimer=void 0}build(J){let Q=new H1({color:O1.red}),Y=new H1({color:this._visible?O1.red:O1.transparent()});return new Q4({children:[new d1({text:new e("⏺",Y)}),new U0({width:1}),new d1({text:new e("Replay",Q)})]})}}class o_1 extends j6{entry;constructor({key:J,entry:Q}){super({key:J});this.entry=Q}build(J){let Q=S6.of(J),Y=Q.colors.secondary,X=Q.colors.foreground,G=this.entry.authors.map((Z)=>Z.name).join(", ");return new t0({decoration:new B8(void 0,new b4(new O4(Y,1,"rounded"),new O4(Y,1,"rounded"),void 0,new O4(Y,1,"rounded"))),child:new d6({padding:v0.horizontal(1),child:new a0({children:[new Q4({crossAxisAlignment:"start",children:[new z4({child:new d1({text:new e(this.entry.title,new H1({color:X,bold:!0}))})}),new U0({width:4}),new d1({text:new e(G||"Community",new H1({color:X,dim:!0}))})]}),new Q4({crossAxisAlignment:"start",children:[new z4({child:new d1({text:new e(this.truncateDescription(this.entry.description),new H1({color:X,dim:!0}))})}),new U0({width:2}),new I7({uri:this.entry.link,text:"View Thread",style:new H1({color:Y,underline:!0})})]})]})})})}truncateDescription(J){let Y=J.replace(/\s+/g," ").trim();if(Y.length<=80)return Y;return Y.slice(0,79)+"…"}}r0();function bN8(J){let Y=new Date().getTime()-J.getTime(),X=Math.floor(Y/3600000),G=Math.floor(X/24),Z=Math.floor(G/7),q=Math.floor(G/30);if(X<1)return"Just now";if(X<24)return`${X}h ago`;if(G<7)return`${G}d ago`;if(Z<=4)return`${Z}w ago`;return`${q}mo ago`}class r_1{threadHistoryService;constructor(J){this.threadHistoryService=J}async fetchThreadSummaries(J=""){try{let Q=await new Promise((Y)=>{let X=this.threadHistoryService.observeThreadList().subscribe((G)=>{X.unsubscribe(),Y(G)})});return{ok:!0,threads:this.formatThreadSummaries(Q,J)}}catch(Q){return{ok:!1,errorMsg:Q instanceof Error?Q.message:"An unexpected error occurred"}}}observeThreadSummaries(J=""){return this.threadHistoryService.observeHistory().pipe(q6((Q)=>this.formatThreadSummaries(Q,J)))}formatThreadSummaries(J,Q){return J.filter((X)=>{if(!Q.trim())return!0;let G=X.title?.toLowerCase()||"untitled",Z=X.id.toLowerCase(),q=Q.toLowerCase();return G.includes(q)||Z.includes(q)}).map((X)=>{let G=new Date(X.userLastInteractedAt),Z=bN8(G),q=X.id.slice(-8),V=X.env?.initial.trees?.[0]?.uri;return{id:X.id,title:X.title||"Untitled",updatedAt:new Date(X.userLastInteractedAt).toISOString(),description:{timeAgo:Z,title:X.title||"Untitled",shortThreadID:q},diffStats:X.summaryStats?.diffStats,workspaceURI:V,parentRelationships:X.parentRelationships}})}}w0();D9();class s_1{currentId=null;current=null;subscribeTimer=null;subscription=null;listeners=[];threadService=null;scrollController=new u3;constructor(){}setThreadService(J){this.threadService=J}async select(J){if(!this.threadService){h.error("TUI assert failed: ThreadService used before being set");return}if(this.currentId===J)return;this.cancelTimerAndSubscription(),this.currentId=J;let Q=await this.threadService.get(J);if(Q){if(this.currentId===J)this.current=Q,this.notifyListeners()}this.subscribeTimer=setTimeout(()=>{this.subscribeLive(J)},1000)}clear(){this.cancelTimerAndSubscription(),this.currentId=null,this.current=null,this.notifyListeners()}addListener(J){this.listeners.push(J)}removeListener(J){let Q=this.listeners.indexOf(J);if(Q!==-1)this.listeners.splice(Q,1)}dispose(){this.cancelTimerAndSubscription(),this.scrollController.dispose(),this.listeners=[]}subscribeLive(J){if(!this.threadService){h.error("TUI assert failed: ThreadService used before being set");return}if(this.currentId!==J)return;this.subscription=this.threadService.observePatches(J).pipe(zM()).subscribe((Q)=>{if(this.currentId===J)this.current=Q,this.notifyListeners()})}cancelTimerAndSubscription(){if(this.subscribeTimer)clearTimeout(this.subscribeTimer),this.subscribeTimer=null;if(this.subscription)this.subscription.unsubscribe(),this.subscription=null}notifyListeners(){for(let J of this.listeners)J(this.current)}}function XY6(J,Q){switch(J){case"update-available":return[new e("A newer Amp is available. Run ",new H1({color:Q.foreground,dim:!0})),new e("amp update",new H1({color:Q.warning}))];case"updated":return null;case"updated-with-warning":return[new e("Update complete, run ",new H1({color:Q.foreground,dim:!0})),new e("amp update",new H1({color:Q.warning})),new e(" to see warnings",new H1({color:Q.foreground,dim:!0}))];case"update-error":return[new e("Update failed, run ",new H1({color:Q.foreground,dim:!0})),new e("amp update",new H1({color:Q.warning})),new e(" to see warnings",new H1({color:Q.foreground,dim:!0}))];case"hidden":return null}}async function dN8(J){return new Promise((Q)=>{mN8("git",["branch","--show-current"],{cwd:J},(Y,X)=>{if(Y){Q(null);return}let G=X.trim();Q(G||null)})})}class HY6 extends X6{dependencies;constructor(J){super();this.dependencies=J}createState(){return new zY6}}class zY6 extends Y6{themeColors=null;themeApp=null;selectionListener=null;ideStatus=null;connectedClientsStatus=null;connectedClientsStatusExpanded=!1;randomAd=null;adSubscription=null;threadLoadSubscription=null;lastAdImpressionId=null;lastUserInteractionTime=Date.now();isConfirmingExit=!1;isExiting=!1;isConfirmingClearInput=!1;isConfirmingCancelProcessing=!1;isShowingHelp=!1;isShowingConsoleOverlay=!1;isShowingConfirmationOverlay=!1;isShowingFileChangesOverlay=!1;isShowingCostBreakdownOverlay=!1;confirmationOverlayContent="";exitConfirmTimeout=null;clearInputConfirmTimeout=null;cancelProcessingConfirmTimeout=null;historyIndex=-1;historyDraft=null;bashInvocations=[];dismissedEphemeralErrorKey=null;currentTitle=void 0;currentShellModeStatus=void 0;imageAttachments=[];displayMessage=null;executingCommand=null;isShowingJetBrainsInstaller=!1;isShowingIdePicker=!1;isShowingPalette=!1;paletteInitialCommandId=null;threadsForPicker=[];isLoadingThreads=!1;threadPreviewController=new s_1;previewThread=null;planScrollController=(()=>{let J=new u3;return J.followMode=!1,J})();todoScrollController=(()=>{let J=new u3;return J.followMode=!1,J})();isShowingStandaloneThreadPicker=!1;filterThreadPickerByWorkspace=!0;agentModePulseSeq=0;currentGitBranch=null;messageViewFocusNode=new d8({debugLabel:"MessageViewFocus"});autocompleteFocusNode=new d8({debugLabel:"AutocompleteFocus"});isTextfieldAndAutocompleteFocused=!1;submitDisabledHint=null;submitDisabledHintTimer=null;showingCannotToggleMessage=null;showImageUnsupportedHint=!1;imageUnsupportedHintTimer=null;adActionModal=null;threadFeedReader=null;currentThreadFeedEntry=null;threadFeedEntries=[];threadFeedSubscription=null;threadFeedRotationTimer=null;threadFeedHidden=!1;threadFeedShownIDs=new Set;threadFeedLatestShownPubDate=null;currentUserInfo=null;bottomGridUserHeight=void 0;bottomGridDragStartY=null;bottomGridDragStartHeight=null;pendingMCPServers=[];mcpTrustSubscription=null;agentModeSubscription=null;currentAgentMode="smart";hasToggledAgentMode=!1;inMemoryAgentModeOverride=null;cachedVisibleModes=mG();freeTierStatus=void 0;updateState="hidden";updateServiceSubscription=null;toastController=new rC1;isMessageViewInSelectionMode=!1;threadBackStack=[];threadForwardStack=[];replayDisplayedMessages=[];replayAbortController=new AbortController;replayTypingTimer=null;async initThreadFeed(){let J=await B6(this.widget.dependencies.configService.config);if(J.settings["feed.enabled"]===!1)this.threadFeedHidden=!0;let Q=J.settings.url,Y=Q.includes("localhost")||Q.includes("127.0.0.1");try{let q=await this.widget.dependencies.internalAPIClient.getUserInfo({},{config:this.widget.dependencies.configService});if(q.ok){let V=q.result,K="user"in V?V.user:V;this.currentUserInfo={username:K.username??void 0,displayName:K.displayName??void 0};let W="ffe10a0c-6c42-41ce-a3a6-38990fd6caf8";if(!Y&&V.team?.id!==W)return}else return}catch(q){h.debug("Failed to fetch user info for thread feed filtering",q);return}let X="/threads.rss",G=async(q,V)=>{let K=q instanceof Request?q.url:q.toString();return TQ(K,V,this.widget.dependencies.configService)},Z=Ac0();Z.get("entries").then((q)=>{if(q){let V=this.filterEntries(q);if(this.threadFeedEntries=V,V.length>0&&!this.currentThreadFeedEntry){let K=this.getNextFeedEntry(V);if(K)this.setState(()=>{this.currentThreadFeedEntry=K})}}}),this.threadFeedReader=new FC1(Z,G,{url:X}),this.threadFeedSubscription=this.threadFeedReader.stream().subscribe({next:(q)=>{try{let V=this.filterEntries(q);if(V.length>0){this.threadFeedEntries=[...V,...this.threadFeedEntries];let K=this.getNextFeedEntry(V);if(K)this.setState(()=>{this.currentThreadFeedEntry=K}),this.resetThreadFeedRotation()}}catch(V){h.error("Thread feed: error in next handler",V)}},error:(q)=>{h.error("Thread feed error:",q)}}),this.resetThreadFeedRotation()}filterEntries(J){if(!this.currentUserInfo)return J;let{username:Q,displayName:Y}=this.currentUserInfo;return J.filter((X)=>{return!X.authors.some((G)=>{let Z=G.name;if(!Z)return!1;return Q&&Z===Q||Y&&Z===Y||Q&&Z.includes(Q)})})}rotateThreadFeed(){if(this.threadFeedRotationTimer)clearInterval(this.threadFeedRotationTimer);this.threadFeedRotationTimer=setInterval(()=>{if(this.threadFeedEntries.length>0){let J=this.getNextFeedEntry(this.threadFeedEntries);if(J)this.setState(()=>{this.currentThreadFeedEntry=J})}},30000)}resetThreadFeedRotation(){this.rotateThreadFeed()}getNextFeedEntry(J){let Q=J.filter((X)=>!this.threadFeedShownIDs.has(X.id));if(this.threadFeedLatestShownPubDate)Q=Q.filter((X)=>X.pubDate.getTime()>=this.threadFeedLatestShownPubDate.getTime());if(Q.length===0&&J.length>0)this.threadFeedShownIDs.clear(),this.threadFeedLatestShownPubDate=null,Q=J;if(Q.length===0)return null;Q.sort((X,G)=>G.pubDate.getTime()-X.pubDate.getTime());let Y=Q[0];if(this.threadFeedShownIDs.add(Y.id),!this.threadFeedLatestShownPubDate||Y.pubDate>this.threadFeedLatestShownPubDate)this.threadFeedLatestShownPubDate=Y.pubDate;return Y}recordNavigation(J){this.threadBackStack.push(J),this.threadForwardStack=[]}navigateBack=async()=>{if(this.threadBackStack.length===0)return;let J=this.widget.dependencies.worker.thread.id,Q=this.threadBackStack.pop();this.threadForwardStack.push(J),await this.switchToExistingThread(Q,{recordInNavigationHistory:!1})};navigateForward=async()=>{if(this.threadForwardStack.length===0)return;let J=this.widget.dependencies.worker.thread.id,Q=this.threadForwardStack.pop();this.threadBackStack.push(J),await this.switchToExistingThread(Q,{recordInNavigationHistory:!1})};startAndSwitchToNewThread=async()=>{let J=this.widget.dependencies.worker.thread.id;this.recordNavigation(J);let Q=await this.widget.dependencies.startNewThread();return this.widget.dependencies.worker=Q,this.widget.dependencies.threadID=Q.thread.id,this.widget.dependencies.switchWorker(Q),this.setState(()=>{this.isMessageViewInSelectionMode=!1}),Q};async startReplay(){let J=this.widget.dependencies.replayMode;if(!J)return;let{thread:Q,typingEnabled:Y,baseWpm:X}=J,G=Q.messages;for(let Z=0;Z<G.length;Z++){if(this.replayAbortController.signal.aborted)break;let q=G[Z];if(!q)continue;if(Z>0)await this.replaySleep(J.messageDelayMs);if(q.role==="user"&&Y){let W=q.content.filter((H)=>H.type==="text").map((H)=>H.text).join(`
4815
4815
  `);if(W)await this.replayTypeMessage(W,X)}if(q.role==="assistant"){let W=q.content.some((U)=>U.type==="tool_use"),H=G[Z+1],z=H?.role==="user"&&H.content.some((U)=>U.type==="tool_result");if(W&&z){let U={...q,state:{type:"streaming"}};this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages,U],this.textController.clear()});let N=J.thread.id;this.getMessageScrollController(N).scrollToBottom(),await this.replaySleep(J.toolProgressDelayMs),this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages.slice(0,-1),q]});continue}}this.setState(()=>{this.replayDisplayedMessages=[...this.replayDisplayedMessages,q],this.textController.clear()});let V=J.thread.id;this.getMessageScrollController(V).scrollToBottom()}await this.replaySleep(J.exitDelayMs),I9.instance.stop()}async replayTypeMessage(J,Q){this.textController.clear();let Y=J.split(/(?<=\s)/),X=60000/Q;for(let G of Y){if(this.replayAbortController.signal.aborted)break;let Z=X/G.length;for(let q of G){this.textController.text=this.textController.text+q,this.textController.cursorPosition=this.textController.text.length,this.setState(()=>{});let V=0.8+Math.random()*0.4,K=Z*V;await this.replaySleep(K)}}}replaySleep(J){return new Promise((Q)=>{this.replayTypingTimer=setTimeout(Q,J)})}getEffectiveAgentMode(){return L41(this.widget.dependencies.worker.thread,this.inMemoryAgentModeOverride?{agentMode:this.inMemoryAgentModeOverride}:null,this.freeTierStatus,{"experimental.agentMode":this.currentAgentMode})}isProcessing(){let{threadState:J}=this.widget.dependencies;if(!J.mainThread)return!1;if(J.viewState.state!=="active")return!1;if(Boolean(J.viewState.inferenceState==="running"))return!0;let Y=J.items.filter((Z)=>Z.type==="toolResult").filter((Z)=>Z.toolResult.run.status==="in-progress"||Z.toolResult.run.status==="queued"),X=J.subagentActiveTools.filter((Z)=>Z.toolRun.status==="in-progress"||Z.toolRun.status==="queued");return[...Y,...X].length>0}showSubmitDisabledHint(J){if(this.submitDisabledHintTimer)clearTimeout(this.submitDisabledHintTimer);this.setState(()=>{this.submitDisabledHint=J}),this.submitDisabledHintTimer=setTimeout(()=>{this.setState(()=>{this.submitDisabledHint=null}),this.submitDisabledHintTimer=null},3000)}getUIHint(){let J=this.themeColors?.colorScheme;if(!J)return null;let Q=this.themeApp;if(!Q)return null;if(this.submitDisabledHint)return new e(this.submitDisabledHint,new H1({color:J.foreground,dim:!0}));if(this.isExiting)return new e("Exiting...",new H1({color:J.foreground,dim:!0}));if(this.isConfirmingExit)return new e("",void 0,[new e("Ctrl+C",new H1({color:Q.keybind})),new e(" again to exit",new H1({color:J.foreground,dim:!0}))]);if(this.isConfirmingClearInput)return new e("",void 0,[new e("Esc",new H1({color:Q.keybind})),new e(" again to clear input",new H1({color:J.foreground,dim:!0}))]);if(this.isShowingHelp)return new e("",void 0,[new e("Escape",new H1({color:Q.keybind})),new e(" to close help",new H1({color:J.foreground,dim:!0}))]);if(this.showImageUnsupportedHint){let G=this.getEffectiveAgentMode(),Z=Xk1(G);return new e("",void 0,[new e("Images aren't supported in ",new H1({color:J.warning,dim:!1})),new e(G,new H1({color:Z})),new e(" mode.",new H1({color:J.warning,dim:!1}))])}if(this.isProcessing()||this.bashInvocations.length>0){if(this.isConfirmingCancelProcessing)return new e("",void 0,[new e("Esc",new H1({color:Q.keybind})),new e(" again to cancel",new H1({color:J.foreground,dim:!0}))]);return new e("",void 0,[new e("Esc",new H1({color:Q.keybind})),new e(" to cancel",new H1({color:J.foreground,dim:!0}))])}if(this.showingCannotToggleMessage)return new e(this.showingCannotToggleMessage,new H1({color:J.warning,dim:!1}));let Y=XY6(this.updateState,J);if(Y)return new e("",void 0,Y);let X=this.widget.dependencies.worker.thread;if(X.agentMode==="plan"&&uA(X))return new e("",void 0,[new e("Ctrl+O",new H1({color:Q.keybind})),new e(" → Execute Plan",new H1({color:J.foreground,dim:!0}))]);return null}isTranscriptEmpty(){let{threadState:J}=this.widget.dependencies;return J.items.length===0}handleMessageRestoreSubmit=async(J)=>{let{threadState:Q,worker:Y}=this.widget.dependencies;if(!Q.mainThread?.id)return;let G=Q.mainThread?.messages.findIndex((Z)=>Z===J);if(G===void 0||G===-1)return;try{this.cancelBashInvocations(),await Y.cancel(),await Y.handle({type:"thread:truncate",fromIndex:G}),this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})}catch(Z){h.error("Failed to edit message:",Z)}};forkMessage=async(J)=>{let{threadState:Q,workerDeps:Y,threadSyncService:X}=this.widget.dependencies,G=Q.mainThread?.id;if(!G)return;let Z=Q.mainThread?.messages.findIndex((q)=>q===J);if(Z===void 0||Z<=0)return;try{let q=await D3.getOrCreateForThread(Y,G),V=await YR(q,X,Z-1);await this.switchToExistingThread(V)}catch(q){h.error("Failed to fork thread:",q),this.showErrorMessage(`Failed to fork thread: ${q}`)}};handleMessageEditSubmit=async(J,Q)=>{let{threadState:Y,worker:X}=this.widget.dependencies,G=Y.mainThread;if(!G)return;let Z=G.messages.findIndex((q)=>q.messageId!==void 0&&q.messageId===J.messageId);if(Z===-1)return;try{this.cancelBashInvocations(),await X.cancel(),this.widget.dependencies.history.add(Q);let q=QN(Q);if(q)await X.handle({type:"thread:truncate",fromIndex:Z}),this.invokeBashCommand(q.cmd,{visibility:q.visibility});else{let V=[{type:"text",text:Q}];if(this.imageAttachments.length>0)V.push(...this.imageAttachments);let K={content:V,agentMode:G.agentMode},W=Z===0;if(G.agentMode&&!W&&K.agentMode!==G.agentMode){h.error(`Cannot edit message: This thread uses ${G.agentMode} mode. To change mode, create a new thread.`);return}await X.handle({type:"user:message",message:K,index:Z})}this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]})}catch(q){h.error("Failed to edit message:",q)}};getAffectedFiles=async(J)=>{let{worker:Q}=this.widget.dependencies;try{return(await Q.getFilesAffectedByTruncation(J)).map(e3)}catch(Y){return h.error("Failed to get affected files:",Y),[]}};textController=new xZ;messageScrollControllers=new Map;getMessageScrollController(J){if(!this.messageScrollControllers.has(J))this.messageScrollControllers.set(J,new u3);return this.messageScrollControllers.get(J)}scrollMessageViewToBottom(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.id;if(!Q)return;this.getMessageScrollController(Q).scrollToBottom()}findElementByKey(J){return this.searchElementTreeByKey(this.context.element,J)}searchElementTreeByKey(J,Q){if(!J)return null;if(J?.widget?.key?.value===Q)return J;if(J?.child){let X=this.searchElementTreeByKey(J.child,Q);if(X)return X}if(J?.children)for(let X of J.children){let G=this.searchElementTreeByKey(X,Q);if(G)return G}return null}setupSelectionListener(){let J=this.findElementByKey("message-view-selection-area");if(J?.state){let Q=J.state;if(Q?.controller&&!this.selectionListener)this.selectionListener=()=>{this.setState(()=>{})},Q.controller.addListener(this.selectionListener),Q.controller.onSelectionCopied=()=>{this.toastController.show("Selection copied to clipboard","success",2000)}}}updateTerminalTitle(){let{threadState:J}=this.widget.dependencies,Q=J.mainThread?.title;if(Q!==this.currentTitle){this.currentTitle=Q;let Y=process.cwd().replace(process.env.HOME||"","~"),X=Q?`amp - ${Q} - ${Y}`:"";process.stdout.write(RR1(X))}}_handleTextCopy(J){if(J&&J.length>0)this.toastController.show("Selection copied to clipboard","success",2000)}textFieldKey=new a7("text-field");ideStatusSubscription=null;ideMessageSubscription=null;ideAppendToPromptSubscription=null;connectedClientsStatusSubscription=null;paletteCommands=null;completionBuilder=null;textChangeListener=()=>{let J=this.textController.text;if(J==="/"){this.showCommandPalette(),this.textController.clear();return}let Y=QN(J)?.visibility;if(Y!==this.currentShellModeStatus)this.currentShellModeStatus=Y,this.setState(()=>{})};navigateHistoryPrevious=()=>{let J=this.widget.dependencies.history.previous();if(J!==null){if(this.historyIndex===-1)this.historyDraft=this.textController.text;this.historyIndex++,this.textController.text=J,this.textController.moveCursorToStart()}};navigateHistoryNext=()=>{let J=this.widget.dependencies.history.next();if(J!==null)this.historyIndex--,this.textController.text=J,this.textController.moveCursorToEnd();else if(this.historyIndex>-1)this.historyIndex=-1,this.textController.text=this.historyDraft||"",this.textController.moveCursorToEnd(),this.historyDraft=null};resetHistory=()=>{this.widget.dependencies.history.reset(),this.historyIndex=-1,this.historyDraft=null};openJetBrainsInstaller=()=>{this.setState(()=>{this.isShowingJetBrainsInstaller=!0})};dismissJetBrainsInstaller=()=>{this.setState(()=>{this.isShowingJetBrainsInstaller=!1})};openIdePicker=()=>{this.setState(()=>{this.isShowingIdePicker=!0})};dismissIdePicker=()=>{this.setState(()=>{this.isShowingIdePicker=!1}),e8.instance.addPostFrameCallback(()=>{this.autocompleteFocusNode.requestFocus()})};handleIdeSelection=async(J,Q)=>{if(this.widget.dependencies.ideClient.getSelectedConfig()?.pid===J.pid){this.dismissIdePicker();return}try{await this.connectToSelectedIde(J,Q)}catch(Y){let X=Y instanceof Error?Y.message:String(Y);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${X}`)})}this.widget.dependencies.ideClient.selectConfig(J),this.dismissIdePicker()};async connectToSelectedIde(J,Q){await this.widget.dependencies.ideClient.start(J,!0,Q)}previewControllerListener=(J)=>{this.setState(()=>{this.previewThread=J})};showStandaloneThreadPicker=()=>{this.loadThreadsForPicker(),this.setState(()=>{this.isShowingStandaloneThreadPicker=!0})};dismissStandaloneThreadPicker=()=>{this.exitApplication()};handleStandaloneThreadSelect=async(J)=>{try{await this.switchToExistingThread(J,{recordInNavigationHistory:!1}),this.threadPreviewController.clear(),this.setState(()=>{this.isShowingStandaloneThreadPicker=!1}),e8.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingStandaloneThreadPicker)this.autocompleteFocusNode.requestFocus()})}catch(Q){h.error("Failed to switch thread:",Q),this.showErrorMessage(`Failed to switch thread: ${Q}`)}};toggleThreadPickerWorkspaceFilter=()=>{this.setState(()=>{this.filterThreadPickerByWorkspace=!this.filterThreadPickerByWorkspace})};showCommandPalette(J){if(this.setState(()=>{this.isShowingPalette=!this.isShowingPalette,this.paletteInitialCommandId=J??null}),this.isShowingPalette)this.loadThreadsForPicker()}getPaletteCommands(){if(!this.paletteCommands)this.paletteCommands=new A_1(this.widget.dependencies.configService,this.widget.dependencies.commandRegistry,(J)=>{this.setState(()=>{this.executingCommand=J})},()=>{this.setState(()=>{this.executingCommand=null})},this.widget.dependencies.isDogfooding);return this.paletteCommands}getCompletionBuilder(){if(!this.completionBuilder)this.completionBuilder=new E_1(this.widget.dependencies.fuzzyServer,this.widget.dependencies.threadFuzzyIndexer);return this.completionBuilder}dismissPalette=()=>{this.setState(()=>{this.isShowingPalette=!1,this.paletteInitialCommandId=null})};getCommandPaletteContext=(J)=>{let{threadState:Q,recentThreadIDs:Y}=this.widget.dependencies;if(!Q.mainThread)return null;let X=n0.file(process.cwd()),G=A6(X);return{recentThreadIDs:Y,currentThreadID:Q.mainThread.id,context:J,worker:this.widget.dependencies.worker,editorState:this.textController,isProcessing:this.isProcessing(),thread:Q.mainThread,ampURL:this.widget.dependencies.ampURL,threadSyncService:this.widget.dependencies.threadSyncService,configService:this.widget.dependencies.configService,openInEditor:this.openInEditor,takeImageAttachments:()=>{let Z=this.imageAttachments;return this.setState(()=>{this.imageAttachments=[]}),Z},setImageAttachments:(Z)=>{this.setState(()=>{this.imageAttachments=Z})},editorDispatch:(Z)=>{switch(Z.type){case"set-input":this.textController.clear(),this.textController.insertText(Z.input);break;case"insert-text":this.textController.insertText(Z.text);break;case"clear":this.textController.clear();break}},submitMessage:(Z)=>{return this.proceedWithUserMessage(Z)},exitApp:this.exitApplication,openHelp:()=>{this.setState(()=>{this.isShowingHelp=!0})},settingsStorage:this.widget.dependencies.settingsStorage,clientId:this.widget.dependencies.clientId,connectedClientsService:this.widget.dependencies.connectedClientsService,mcpService:this.widget.dependencies.mcpService,startNewThread:async()=>{await this.startAndSwitchToNewThread()},navigateBack:this.navigateBack,navigateForward:this.navigateForward,canNavigateBack:this.threadBackStack.length>0,canNavigateForward:this.threadForwardStack.length>0,canUseAmpFree:this.widget.dependencies.freeTierStatus?.canUseAmpFree??!1,switchToThread:async(Z)=>{return await this.switchToExistingThread(Z),this.setState(()=>{this.isMessageViewInSelectionMode=!1}),this.widget.dependencies.worker},generateHandoffPrompt:async(Z,q,V)=>{let K=this.widget.dependencies.threadState.mainThread?.id;if(!K)throw Error("No active thread");let W=setTimeout(()=>{V.throwIfAborted()},60000);try{let H=await this.widget.dependencies.threadService.generateHandoffPrompt(K,Z,q,this.widget.dependencies.configService,V);return clearTimeout(W),H}catch(H){throw clearTimeout(W),H}},handleHandoff:async(Z,q)=>{let{goal:V,generatedPrompt:K,images:W}=q;if(!V&&!K)return{ok:!1,error:Error("Either goal or generatedPrompt required")};try{let H=this.widget.dependencies.threadState.mainThread?.id;if(!H)return{ok:!1,error:Error("No active thread")};let z=setTimeout(()=>Z.abort(new m81("Handoff took too long and was aborted (timeout: 60s)")),60000);try{let U=await this.widget.dependencies.threadService.createHandoffThread(H,{goal:V,generatedPrompt:K,images:W},this.widget.dependencies.configService,Z.signal);return clearTimeout(z),await this.switchToExistingThread(U),{ok:!0}}catch(U){if(clearTimeout(z),U instanceof Error&&(U.name==="AbortError"||U.message.includes("aborted")))throw Z.signal.reason;throw U}}catch(H){return h.error("Failed to create handoff thread",H),{ok:!1,error:H instanceof Error?H:Error(String(H))}}},getGuidanceFiles:async(Z)=>{if(!Q.mainThread)return[];return(await Nr({filesystem:this.widget.dependencies.worker.fs.fileSystemReader(),configService:this.widget.dependencies.configService,threadService:this.widget.dependencies.threadService},Q.mainThread,Z)).map((V)=>({uri:V.uri,type:V.type}))},openIdePicker:()=>{this.openIdePicker()},getInMemoryAgentModeOverride:()=>{return this.inMemoryAgentModeOverride},setInMemoryAgentModeOverride:(Z)=>{this.setState(()=>{this.inMemoryAgentModeOverride=Z,this.hasToggledAgentMode=!0})},toggleAgentMode:this.toggleAgentMode,getEffectiveAgentMode:()=>this.getEffectiveAgentMode(),getEditorText:()=>this.textController.text,workspace:this.widget.dependencies.workspace??null,handleExecutePlan:async()=>{try{let Z=Q.mainThread?.id;if(!Z){this.setState(()=>{this.displayMessage=Error("No active thread")});return}let q=await this.widget.dependencies.threadService.createPlanExecutionThread(Z,"smart");await this.switchToExistingThread(q)}catch(Z){h.error("Failed to execute plan",Z),this.setState(()=>{this.displayMessage=Error(`Failed to execute plan: ${Z instanceof Error?Z.message:String(Z)}`)})}},planFileManager:this.widget.dependencies.planFileManager,completionBuilder:this.getCompletionBuilder(),threads:this.threadsForPicker,previewController:this.threadPreviewController,isLoadingThreads:this.isLoadingThreads,filterByWorkspace:this.filterThreadPickerByWorkspace,currentWorkspace:G,threadViewStates:this.widget.dependencies.workerController.threadViewStates,currentThreadFeedEntry:this.currentThreadFeedEntry,threadFeedEntries:this.threadFeedEntries,threadFeedHidden:this.threadFeedHidden,setThreadFeedHidden:(Z)=>{this.setState(()=>{this.threadFeedHidden=Z})}}};loadThreadsForPicker(){if(this.threadLoadSubscription)return;this.setState(()=>{this.isLoadingThreads=!0});let J=new r_1(this.widget.dependencies.threadHistoryService);this.threadLoadSubscription=J.observeThreadSummaries("").subscribe({next:(Q)=>{this.setState(()=>{this.threadsForPicker=Q,this.isLoadingThreads=!1})},error:()=>{this.setState(()=>{this.isLoadingThreads=!1})}})}updateGitBranch=async()=>{let J=await dN8(process.cwd());this.setState(()=>{this.currentGitBranch=J})};removeBashInvocation=(J)=>{this.setState(()=>{this.bashInvocations=this.bashInvocations.filter((Q)=>Q.id!==J)})};invokeBashCommand=(J,{visibility:Q})=>{let Y=Date.now(),X=`bash-${Y}-${Math.random().toString(36).substring(7)}`,G={cmd:J},Z=new AbortController;this.widget.dependencies.worker.invokeBashTool(G,Z.signal,Q===JN).subscribe({next:(q)=>{this.setState(()=>{if(this.bashInvocations.find((K)=>K.id===X))this.bashInvocations=this.bashInvocations.map((K)=>K.id===X?{...K,toolRun:q}:K);else{let K={id:X,args:G,toolRun:q,startTime:Y,abortController:Z,hidden:Q===JN};this.bashInvocations=[...this.bashInvocations,K]}})},error:()=>this.removeBashInvocation(X),complete:()=>this.removeBashInvocation(X)})};cancelBashInvocations=()=>{let J=this.bashInvocations.find((Q)=>Q.toolRun.status==="in-progress");if(J)J.abortController.abort()};toggleConnectedClientsStatus=()=>{this.setState(()=>{this.connectedClientsStatusExpanded=!this.connectedClientsStatusExpanded})};toggleAgentMode=()=>{let J=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker;if(j$(J.thread)>0)return;if(this.freeTierStatus?.canUseAmpFree){let X=this.getEffectiveAgentMode(),G=Lk(X,this.cachedVisibleModes);if(G!==X)this.setState(()=>{this.hasToggledAgentMode=!0,this.inMemoryAgentModeOverride=G,this.agentModePulseSeq++,this.showingCannotToggleMessage=null,this.showImageUnsupportedHint=!1});return}let Q=this.getEffectiveAgentMode(),Y=Lk(Q,this.cachedVisibleModes);if(Y===Q)return;if(this.setState(()=>{this.hasToggledAgentMode=!0,this.inMemoryAgentModeOverride=Y,this.agentModePulseSeq++,this.showingCannotToggleMessage=null,this.showImageUnsupportedHint=!1}),I5(Y))this.checkAndShowFreeModeModal()};checkAndShowFreeModeModal=()=>{if(this.freeTierStatus?.canUseAmpFree)return;if(this.freeTierStatus){if(!this.freeTierStatus.eligible){this.setState(()=>{this.showingCannotToggleMessage="Amp Free is unavailable. Switch to another mode."}),setTimeout(()=>{this.setState(()=>{this.showingCannotToggleMessage=null})},3000);return}else if(!this.freeTierStatus.workspaceAllowsAmpFree){this.setState(()=>{this.showingCannotToggleMessage="Your workspace does not allow Amp Free. Switch to another mode."}),setTimeout(()=>{this.setState(()=>{this.showingCannotToggleMessage=null})},3000);return}}};isInRestrictedFreeMode(){if(this.getEffectiveAgentMode()!=="free")return!1;if(this.freeTierStatus?.canUseAmpFree)return!1;return!0}handleInsertImage=(J)=>{let Q=this.getEffectiveAgentMode();if(!Mk(Q)){if(this.imageUnsupportedHintTimer)clearTimeout(this.imageUnsupportedHintTimer);return this.setState(()=>{this.showImageUnsupportedHint=!0}),this.imageUnsupportedHintTimer=setTimeout(()=>{this.setState(()=>{this.showImageUnsupportedHint=!1}),this.imageUnsupportedHintTimer=null},5000),!1}if(this.imageAttachments.length>=$U)return!1;let Y=qC(J);if(typeof Y==="object")return this.setState(()=>{this.imageAttachments=[...this.imageAttachments,Y]}),!1;return this.setState(()=>{this.displayMessage=Error(`Failed to attach image: ${Y}`)}),!1};handlePopImage=()=>{if(this.imageAttachments.length>0)this.setState(()=>{this.imageAttachments=this.imageAttachments.slice(0,-1)})};openInEditor=async(J)=>{let{mkdtemp:Q,readFile:Y,unlink:X,rmdir:G,writeFile:Z}=await import("node:fs/promises"),{tmpdir:q}=await import("node:os"),V=await import("node:path");try{let K=await Q(V.join(q(),"amp-edit-")),W=V.join(K,"message.amp.md");await Z(W,J,"utf-8"),await Fz(W);try{let H=await Y(W,"utf-8");this.textController.text=H}catch(H){if(H?.code!=="ENOENT")h.error("Failed to read temporary file",H)}try{await X(W),await G(K)}catch(H){h.warn("Failed to clean up temporary file",H)}}catch(K){h.error("Error opening editor:",K)}};onTextSubmitted=async(J)=>{if(!J.trim())return;let Q=QN(J);if(Q)if(!Q.cmd){this.showSubmitDisabledHint("No command provided");return}else if(this.isProcessing()){this.showSubmitDisabledHint("Unable to use shell mode while agent is active");return}else{this.invokeBashCommand(Q.cmd,{visibility:Q.visibility}),this.widget.dependencies.history.add(J),this.textController.clear(),this.resetHistory();return}this.textController.clear(),this.resetHistory(),await this.updateGitBranch(),await this.sendUserMessage(J)};initState(){if(oX.getInstance().interceptConsole(),this.threadPreviewController.setThreadService(this.widget.dependencies.threadService),this.threadPreviewController.addListener(this.previewControllerListener),this.widget.dependencies.openThreadSwitcher)this.showStandaloneThreadPicker();I9.instance.on("key",()=>{this.lastUserInteractionTime=Date.now()}),I9.instance.on("mouse",()=>{this.lastUserInteractionTime=Date.now()}),I9.instance.on("paste",()=>{this.lastUserInteractionTime=Date.now()}),this.autocompleteFocusNode.addListener((Y)=>{e8.instance.addPostFrameCallback(()=>{this.setState(()=>{this.isTextfieldAndAutocompleteFocused=Y.hasFocus})})}),this.freeTierStatus=this.widget.dependencies.freeTierStatus,B6(this.widget.dependencies.configService.config).then((Y)=>{let X=L41(this.widget.dependencies.worker.thread,this.widget.dependencies.sessionState??null,this.freeTierStatus,Y.settings);if(h.info(`[initState] Resolved agentMode: ${X}`),this.widget.dependencies.sessionState?.agentMode)this.setState(()=>{this.inMemoryAgentModeOverride=X})}),this.updateGitBranch(),this.adSubscription=nR1(this.widget.dependencies.internalAPIClient,this.widget.dependencies.configService,()=>{return(this.inMemoryAgentModeOverride&&I5(this.inMemoryAgentModeOverride)||this.randomAd===null)&&iR1(this.lastUserInteractionTime)}).subscribe({next:(Y)=>{if(Y){let X=uN8(16).toString("hex");this.lastAdImpressionId=X,Promise.resolve().then(() => (q91(),$91)).then(({recordAdEvent:G})=>{let Z=this.widget.dependencies.worker.thread,q=Z.messages[Z.messages.length-1];G("viewed",{adId:Y.id,advertiserId:Y.advertiserId,threadId:Z.id,messageId:q?.messageId,impressionId:X,placement:"tui",matchType:Y.metadata?.matchType,matchedPatterns:Y.metadata?.matchedPatterns,candidateAdPoolCount:Y.metadata?.candidateAdPoolCount,clientRegion:Y.metadata?.clientRegion})})}this.setState(()=>{this.randomAd=Y}),e8.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingStandaloneThreadPicker&&!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()})}});let{mcpTrustHandler:J}=this.widget.dependencies;this.mcpTrustSubscription=J.pendingServers$.subscribe((Y)=>{this.setState(()=>{this.pendingMCPServers=Y})}),this.ideStatusSubscription=this.widget.dependencies.ideClient.status.subscribe((Y)=>{this.setState(()=>{this.ideStatus=Y})}),this.ideMessageSubscription=this.widget.dependencies.ideClient.messages.subscribe(async(Y)=>{let X=this.widget.dependencies.getCurrentWorker();if(!X){h.warn("No active thread worker found to handle IDE message");return}await new Promise((G)=>setTimeout(G,50)),await X.handle({type:"user:message",message:{content:[{type:"text",text:Y}]}}),h.debug("Message sent from IDE to agent",{message:Y.slice(0,100)})}),this.ideAppendToPromptSubscription=this.widget.dependencies.ideClient.appendToPrompt.subscribe((Y)=>{this.textController.insertText(Y),h.debug("Appended text to CLI prompt from IDE",{text:Y.slice(0,100)})}),this.connectedClientsStatusSubscription=this.widget.dependencies.connectedClientsService.status.subscribe((Y)=>{this.setState(()=>{this.connectedClientsStatus=Y})}),this.updateServiceSubscription=this.widget.dependencies.updateService.state.subscribe((Y)=>{this.setState(()=>{this.updateState=Y})}),this.agentModeSubscription=this.widget.dependencies.configService.config.subscribe((Y)=>{let X=mG(Y.settings,this.freeTierStatus?.canUseAmpFree);this.setState(()=>{this.cachedVisibleModes=X})}),this.textController.addListener(this.textChangeListener),this.updateTerminalTitle();let Q=this.widget.dependencies.ideClient.getSelectedConfig();if(Q)this.connectToSelectedIde(Q,"auto-startup").catch((Y)=>{let X=Y instanceof Error?Y.message:String(Y);this.setState(()=>{this.displayMessage=Error(`Failed to connect to IDE: ${X}`)})});else if(this.widget.dependencies.showIdePicker)this.openIdePicker();else if(this.widget.dependencies.showJetBrainsInstaller)this.openJetBrainsInstaller();if(this.widget.dependencies.replayMode)setTimeout(()=>this.startReplay(),100);this.initThreadFeed()}didUpdateWidget(J){super.didUpdateWidget(J),this.setupSelectionListener()}dispose(){if(this.replayAbortController.abort(),this.replayTypingTimer)clearTimeout(this.replayTypingTimer);if(this.ideStatusSubscription)this.ideStatusSubscription.unsubscribe();if(this.ideMessageSubscription)this.ideMessageSubscription.unsubscribe();if(this.ideAppendToPromptSubscription)this.ideAppendToPromptSubscription.unsubscribe();if(this.connectedClientsStatusSubscription)this.connectedClientsStatusSubscription.unsubscribe();if(this.updateServiceSubscription)this.updateServiceSubscription.unsubscribe();if(this.agentModeSubscription)this.agentModeSubscription.unsubscribe();if(this.adSubscription)this.adSubscription.unsubscribe();if(this.mcpTrustSubscription)this.mcpTrustSubscription.unsubscribe();if(this.threadLoadSubscription)this.threadLoadSubscription.unsubscribe();if(this.threadFeedSubscription)this.threadFeedSubscription.unsubscribe();if(this.threadFeedRotationTimer)clearInterval(this.threadFeedRotationTimer);if(this.threadPreviewController.removeListener(this.previewControllerListener),this.threadPreviewController.dispose(),this.toastController.dispose(),this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;if(this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;this.textController.removeListener(this.textChangeListener);for(let J of this.messageScrollControllers.values())J.dispose();if(this.messageScrollControllers.clear(),process.stdout.write(RR1("")),this.shouldUseProgressBar())process.stdout.write(Z96())}getCurrentConfirmation(){let{threadState:J}=this.widget.dependencies,X=[...J.items.filter((V)=>V.type==="toolResult").map((V)=>({toolUse:V.toolUse,toolRun:V.toolResult.run,subthreadID:void 0})),...J.subagentActiveTools].filter((V)=>V.toolRun.status==="blocked-on-user");if(X.length===0)return null;let G=X[0],Z=G.toolRun.status==="blocked-on-user"?G.toolRun.toAllow??[]:[],q=G.toolRun.status==="blocked-on-user"?G.toolRun.reason:void 0;return{type:"tool-use",tools:[{useBlock:G.toolUse,toAllow:Z}],subthreadID:G.subthreadID,reason:q}}shouldUseProgressBar(){return!1}updateProgressBar(){}onConfirmationResponse=async(J)=>{let Q=this.getCurrentConfirmation();if(!Q||Q.type!=="tool-use"){h.error("No current tool confirmation found");return}let Y=Q.tools[0]?.useBlock;if(!Y){h.error("No tool use block found in confirmation");return}if(J==="allow-all-session")A$("dangerouslyAllowAll",!0);if(J==="allow-all-persistent")try{await this.widget.dependencies.settingsStorage.set("dangerouslyAllowAll",!0,"global")}catch(G){if(G&&G instanceof Error)this.setState(()=>{this.displayMessage=G});else h.error("Failed to write dangerouslyAllowAll setting:",G);return}if(J==="always-guarded"){let G=Q.tools[0]?.toAllow??[],Z=await this.widget.dependencies.settingsStorage.get("guardedFiles.allowlist")||[],q=[...G,...Z];await this.widget.dependencies.settingsStorage.set("guardedFiles.allowlist",q,"global")}if(J==="connect-github"){let G=new URL("/settings#code-host-connections",this.widget.dependencies.ampURL).toString();await uY(this.context,G);return}if(J==="disable-librarian"){let G=await this.widget.dependencies.settingsStorage.get("tools.disable")??[];if(!G.includes(FX))await this.widget.dependencies.settingsStorage.set("tools.disable",[...G,FX],"global")}let X=J!==null&&["yes","allow-all-session","allow-all-persistent","always-guarded"].includes(J);try{let G={type:"user:tool-input",toolUse:Y.id,value:{accepted:X}};if(Q.subthreadID)await(await D3.getOrCreateForThread(this.widget.dependencies.workerDeps,Q.subthreadID)).handle(G);else await this.widget.dependencies.worker.handle(G)}catch(G){h.error("Failed to send tool confirmation:",G)}};showConfirmationOverlay=(J)=>{this.setState(()=>{this.isShowingConfirmationOverlay=!0,this.confirmationOverlayContent=J})};getErrorKey(J){return`${J.constructor.name}:${J.message}`}getCurrentEphemeralError(){let{threadState:J}=this.widget.dependencies,Q=J.viewState;if(Q.state!=="active"||!Q.ephemeralError)return null;let Y=this.getErrorKey(Q.ephemeralError);if(this.dismissedEphemeralErrorKey===Y)return null;return Q.ephemeralError}handleEphemeralErrorResponse=async(J)=>{let Q=this.getCurrentEphemeralError(),Y=this.widget.dependencies.worker;switch(J){case"retry":this.dismissedEphemeralErrorKey=null,await Y.retry();break;case"dismiss":if(Q)this.dismissedEphemeralErrorKey=this.getErrorKey(Q);break;case"new-thread":{this.setState(()=>{this.dismissedEphemeralErrorKey=null}),await this.startAndSwitchToNewThread();break}case"new-smart-thread":{this.setState(()=>{this.inMemoryAgentModeOverride="smart",this.dismissedEphemeralErrorKey=null}),T61({agentMode:"smart"}),await this.startAndSwitchToNewThread();break}case"handoff":{if(Q)this.dismissedEphemeralErrorKey=this.getErrorKey(Q);this.showCommandPalette("handoff");break}}this.setState(()=>{})};handleDisplayMessageDismiss=()=>{this.setState(()=>{this.displayMessage=null})};handleMCPTrustOpenSettings=async()=>{let{mcpTrustHandler:J,settingsStorage:Q}=this.widget.dependencies;await J.deny();try{await Fz(Q.getSettingsFilePath())}catch(Y){let X=Y instanceof Error?Y.message:String(Y);await this.showErrorMessage(`Failed to open settings: ${X}`)}};cancelStreamingMessage=async()=>{await D3.cancel(this.widget.dependencies.threadID)};markLastUserMessageAsInterrupted=async()=>{let J=this.widget.dependencies.threadState.mainThread;if(!J)return;for(let Q=J.messages.length-1;Q>=0;Q--){let Y=J.messages[Q];if(Y?.role==="user"&&!Y.interrupted){await this.widget.dependencies.worker.handle({type:"user:message:interrupt",messageIndex:Q});break}}};switchToExistingThread=async(J,Q={})=>{let{recordInNavigationHistory:Y=!0}=Q;if(Y){let X=this.widget.dependencies.worker.thread.id;if(X!==J)this.recordNavigation(X)}try{h.info(`[switchToExistingThread] Switching to thread: ${J}`);let X=await this.widget.dependencies.switchToThread(J);h.info(`[switchToExistingThread] Got worker for thread ${J}, thread.agentMode: ${X.thread.agentMode}`);let G=await this.widget.dependencies.configService.getLatest(),Z=L41(X.thread,this.widget.dependencies.sessionState??null,this.freeTierStatus,G.settings);if(h.info(`[switchToExistingThread] Thread ${J} resolved agentMode: ${Z}`),this.widget.dependencies.worker=X,this.widget.dependencies.threadID=X.thread.id,this.widget.dependencies.switchWorker(X),this.setState(()=>{h.info("[switchToExistingThread] Clearing inMemoryAgentModeOverride"),this.inMemoryAgentModeOverride=null}),X.thread.draft)if(h.info("[switchToExistingThread] Loading draft content into text controller"),this.textController.clear(),typeof X.thread.draft==="string")this.textController.insertText(X.thread.draft);else{let q=X.thread.draft.filter((W)=>W.type==="text"),V=X.thread.draft.filter((W)=>W.type==="image"),K=q.map((W)=>W.text).join(`
4816
4816
  `);if(K)this.textController.insertText(K);if(V.length>0)this.setState(()=>{this.imageAttachments=V})}}catch(X){throw h.error("Failed to switch to thread:",J,X),Error(`Failed to switch to thread: ${J}`)}};sendUserMessage=async(J)=>{await this.proceedWithUserMessage(J)};proceedWithUserMessage=async(J)=>{this.cancelBashInvocations(),this.widget.dependencies.history.add(J);let Q=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,Y=j$(Q.thread)===0,X=this.getEffectiveAgentMode();if(Q.thread.agentMode&&!Y&&X!==Q.thread.agentMode){await this.showErrorMessage(`This thread uses ${Q.thread.agentMode} mode. To change mode, edit the first message or create a new thread.`);return}let G=[{type:"text",text:J}];if(this.imageAttachments.length>0)G.push(...this.imageAttachments);if(await Q.handle({type:"user:message",message:{content:G,agentMode:X}}),Y)T61({agentMode:X});this.scrollMessageViewToBottom(),this.setState(()=>{this.imageAttachments=[]}),e8.instance.addPostFrameCallback(()=>{if(!this.isMessageViewInSelectionMode&&!this.isShowingPalette&&!this.isShowingStandaloneThreadPicker&&!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()})};async showErrorMessage(J){this.setState(()=>{this.displayMessage=Error(J)})}exitApplication=async()=>{this.setState(()=>{this.isExiting=!0});let J=this.widget.dependencies.threadState.mainThread;if(J?.messages.length===0){if(J.relationships?.find((X)=>X.type==="handoff"&&X.role==="child"))await this.widget.dependencies.threadService.discardHandoffThread(J.id).catch(()=>{})}let Q=this.getEffectiveAgentMode();T61({agentMode:Q}).catch((Y)=>{h.warn("Failed to save session state on exit:",Y)}).finally(()=>{I9.instance.stop()})};onExitPressed=()=>{if(this.isConfirmingExit){if(this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout),this.exitConfirmTimeout=null;this.exitApplication()}else{if(this.setState(()=>{this.isConfirmingExit=!0}),this.exitConfirmTimeout)clearTimeout(this.exitConfirmTimeout);this.exitConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingExit=!1}),this.exitConfirmTimeout=null},1000)}};toHomeRelative(J){let Q=pN8();if(J===Q)return"~";if(J.startsWith(Q+Bm.sep))return"~"+J.slice(Q.length);return J}shorten(J){let Q=J.split(Bm.sep).filter(Boolean);if(Q.length<=5)return J;return[Q.slice(0,2).join(Bm.sep),"…",Q.slice(-2).join(Bm.sep)].join(Bm.sep)}build(J){let Q=W8.of(J),Y=S6.of(J),X=Y.base;this.themeColors=X;let{colors:G,app:Z}=Y;this.themeApp=Z;let q=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,V=q.thread.agentMode&&I5(q.thread.agentMode),K=V&&this.randomAd!==null,W=!V&&this.currentThreadFeedEntry!==null&&!this.threadFeedHidden,H=K||W,{threadState:z}=this.widget.dependencies;this.updateTerminalTitle(),this.updateProgressBar();let U=this.getCurrentConfirmation(),N=this.widget.dependencies.replayMode,M=Boolean(N),L=z.items,A=z.mainThread||void 0,E=z.subagentToolsByParentID,P=z.todosList;if(M){let i6={...N.thread,messages:this.replayDisplayedMessages};L=PC(i6).items,A=i6,E={};let P4=nE({messages:this.replayDisplayedMessages});P=Array.isArray(P4)?P4:[]}let I=A?.id,R=A,S=M?this.replayDisplayedMessages.length===0:this.isTranscriptEmpty(),y=(i6)=>new h81({key:new a7(`preview-message-view-${i6.id}`),items:PC(i6).items,controller:this.threadPreviewController.scrollController,autofocus:!1,thread:i6,focusNode:new d8({debugLabel:"PreviewFocus"})}),x=this.previewThread,g=x?x.messages.length>2000?new a0({mainAxisSize:"max",children:[new z4({child:new U0}),new d6({padding:v0.all(2),child:new H8({child:new d1({text:new e("Thread too long for preview",new H1({color:G.mutedForeground,dim:!0}))})})})]}):y(x):S?new g81({agentMode:this.getEffectiveAgentMode()}):new h81({key:I?new a7(`message-view-${I}`):void 0,items:L,subagentToolsByParentID:E,controller:I?this.getMessageScrollController(I):new u3,autofocus:!1,onCopy:M?void 0:this._handleTextCopy.bind(this),thread:R,onMessageEditSubmit:M?void 0:this.handleMessageEditSubmit,onMessageRestoreSubmit:M?void 0:this.handleMessageRestoreSubmit,onMessageForkSubmit:M?void 0:this.forkMessage,getAffectedFiles:M?void 0:this.getAffectedFiles,focusNode:this.messageViewFocusNode,onDismissFocus:()=>{if(this.setState(()=>{this.isMessageViewInSelectionMode=!1}),!this.isShowingIdePicker)this.autocompleteFocusNode.requestFocus()},isInSelectionMode:this.isMessageViewInSelectionMode}),p=Math.max(Math.floor(Q.size.height*0.4),12),b=this.getCurrentEphemeralError(),i=this.buildBottomWidget(b,U,G,Y,z,P,p,H,M),Q1=Q.size.width<40,a=z.mainThread?kU0(z.mainThread):void 0,m=new t41({threadViewState:z.viewState,threadTokenUsage:a,threadID:I??null,thread:z.mainThread??void 0,onFileChangesClick:()=>{this.setState(()=>{this.isShowingFileChangesOverlay=!this.isShowingFileChangesOverlay})},onCostBreakdownClick:()=>{this.setState(()=>{this.isShowingCostBreakdownOverlay=!this.isShowingCostBreakdownOverlay})},onShowIdePicker:this.openIdePicker,ideStatus:this.ideStatus,connectedClientsStatus:this.connectedClientsStatus,isNarrow:Q1,uiHint:this.getUIHint()??void 0,waitingForConfirmation:!!U,showingEphemeralError:Boolean(z.viewState.state==="active"&&z.viewState.ephemeralError),runningBashInvocations:this.bashInvocations.length>0,executingCommand:this.executingCommand?.name??null,executingCommandMessage:this.executingCommand?.statusMessage??null}),s=new s41({bashInvocations:this.bashInvocations}),K1=[],W1=this.getEffectiveAgentMode(),o=this.currentShellModeStatus,r=Xk1(W1),l=!o?W1.length+1:0,F1=Q.capabilities.animationSupport,y1=F1==="disabled"?0:F1==="slow"?30:60,t=RV(W1)?.uiHints?.fasterAnimation?3:1,f1=y1>0&&this.agentModePulseSeq>0?new B5({children:[i,new r7({top:0,left:1,right:1,height:1,child:new l_1({color:r,trigger:this.agentModePulseSeq,fps:y1,speed:t,leftOffset:l})})]}):i;K1.push(new z4({child:g}),s);let j1=new B5({children:[new a0({mainAxisSize:"min",children:[K?new W_1({ad:this.randomAd,onButtonClick:async()=>{let i6=this.randomAd;if(this.lastAdImpressionId)Promise.resolve().then(() => (q91(),$91)).then(({recordAdEvent:z8})=>{let J8=this.widget.dependencies.worker.thread,C9=J8.messages[J8.messages.length-1];z8("clicked",{adId:i6.id,advertiserId:i6.advertiserId,threadId:J8.id,messageId:C9?.messageId,impressionId:this.lastAdImpressionId,placement:"tui",actionType:"link_to",matchType:i6.metadata?.matchType,matchedPatterns:i6.metadata?.matchedPatterns,candidateAdPoolCount:i6.metadata?.candidateAdPoolCount,clientRegion:i6.metadata?.clientRegion})});if(!await uY(this.context,i6.shortDestinationUrl)){let J8=I9.instance.tuiInstance.clipboard.isOsc52Supported();this.setState(()=>{this.adActionModal={showCopyOption:J8,url:i6.shortDestinationUrl}})}}}):W?new o_1({entry:this.currentThreadFeedEntry}):new U0({height:0}),new t0({constraints:new a6(0,Q.size.width,0,p),child:f1})]}),H?new r7({top:0,left:0,right:0,child:new BY6({userHeight:this.bottomGridUserHeight,maxHeight:p,onInitializeHeight:(i6)=>{this.setState(()=>{this.bottomGridUserHeight=Math.min(i6,p)})},onDrag:(i6)=>{if(this.bottomGridDragStartY===null)this.bottomGridDragStartY=Math.floor(i6.localPosition.y),this.bottomGridDragStartHeight=this.bottomGridUserHeight;let P4=Math.floor(i6.localPosition.y)-this.bottomGridDragStartY,z8=Math.max(4,this.bottomGridDragStartHeight-P4),J8=Math.min(z8,p),C9=Math.floor(J8);if(this.bottomGridUserHeight!==C9)this.setState(()=>{this.bottomGridUserHeight=C9})},onRelease:()=>{this.bottomGridDragStartY=null,this.bottomGridDragStartHeight=null}})}):new U0({height:0})]});K1.push(j1,new U0({height:1,child:new d6({padding:v0.horizontal(1),child:m})}));let O0=new a0({crossAxisAlignment:"stretch",mainAxisSize:"max",children:K1}),C1=M?new B5({children:[O0,new r7({top:0,left:0,child:new a_1})]}):O0,s1=new J9(()=>{if(this.isShowingPalette)return this.dismissPalette(),"handled";if(this.pendingMCPServers.length>0)return this.widget.dependencies.mcpTrustHandler.deny(),"handled";if(this.getCurrentEphemeralError())return this.handleEphemeralErrorResponse("dismiss"),"handled";if(this.displayMessage)return this.handleDisplayMessageDismiss(),"handled";if(this.isShowingHelp)return this.setState(()=>{this.isShowingHelp=!1}),"handled";if(this.isShowingFileChangesOverlay)return this.setState(()=>{this.isShowingFileChangesOverlay=!1}),"handled";if(this.isShowingCostBreakdownOverlay)return this.setState(()=>{this.isShowingCostBreakdownOverlay=!1}),"handled";if(this.isShowingIdePicker)return this.dismissIdePicker(),"handled";if(this.isShowingJetBrainsInstaller)return this.dismissJetBrainsInstaller(),"handled";if(this.isShowingConfirmationOverlay)return this.setState(()=>{this.isShowingConfirmationOverlay=!1,this.confirmationOverlayContent=""}),"handled";if(this.isShowingConsoleOverlay)return this.setState(()=>{this.isShowingConsoleOverlay=!1}),"handled";if(this.textController.hasSelection)return this.textController.clearSelection(),"handled";if(this.isConfirmingClearInput){if(this.textController.clear(),this.setState(()=>{this.isConfirmingClearInput=!1,this.imageAttachments=[]}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout),this.clearInputConfirmTimeout=null;return"handled"}if(this.isConfirmingCancelProcessing){if(this.bashInvocations.length>0)this.cancelBashInvocations();if(this.isProcessing())this.markLastUserMessageAsInterrupted().catch((P4)=>{h.error("Failed to mark message as interrupted:",P4)}),this.cancelStreamingMessage().catch((P4)=>{h.error("Failed to cancel streaming message:",P4)});if(this.setState(()=>{this.isConfirmingCancelProcessing=!1}),this.cancelProcessingConfirmTimeout)clearTimeout(this.cancelProcessingConfirmTimeout),this.cancelProcessingConfirmTimeout=null;return"handled"}if(this.executingCommand)return h.info("Canceling executing command:",this.executingCommand.name),this.executingCommand.abortController.abort(),"handled";if(this.bashInvocations.length>0||this.isProcessing()){if(this.setState(()=>{this.isConfirmingCancelProcessing=!0}),this.cancelProcessingConfirmTimeout)clearTimeout(this.cancelProcessingConfirmTimeout);return this.cancelProcessingConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingCancelProcessing=!1}),this.cancelProcessingConfirmTimeout=null},1000),"handled"}if(this.textController.text.trim()!==""||this.imageAttachments.length>0){if(this.setState(()=>{this.isConfirmingClearInput=!0}),this.clearInputConfirmTimeout)clearTimeout(this.clearInputConfirmTimeout);return this.clearInputConfirmTimeout=setTimeout(()=>{this.setState(()=>{this.isConfirmingClearInput=!1}),this.clearInputConfirmTimeout=null},1000),"handled"}return"ignored"}),U1=new J9(()=>{return this.onExitPressed(),"handled"}),Y1=new J9(()=>{return this.setState(()=>{this.isShowingConsoleOverlay=!this.isShowingConsoleOverlay}),"handled"}),A1=new J9(()=>{return LJ.instance.toggleAll(),"handled"}),w1=new J9(()=>{return this.widget.dependencies.configService.getLatest().then((i6)=>{A$("internal.showCost",!(i6.settings["internal.showCost"]??!0))}),"handled"}),I1=new J9(()=>{return I9.instance.toggleFrameStatsOverlay(),"handled"}),E1=new J9(()=>{return I9.instance.tuiInstance.getScreen().markForRefresh(),e8.instance.requestFrame(),"handled"}),p1=new J9(()=>{return this.toggleAgentMode(),"handled"}),h1=new J9(()=>{let P4=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:z8}=this.widget.dependencies,J8=z8.mainThread?.id;return J8?this.getMessageScrollController(J8):null})();if(P4){let z8=Math.max(Math.floor(Q.size.height*0.4),10),J8=Q.size.height-z8;P4.animatePageUp(J8,100)}return"handled"}),r1=new J9(()=>{let P4=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:z8}=this.widget.dependencies,J8=z8.mainThread?.id;return J8?this.getMessageScrollController(J8):null})();if(P4){let z8=Math.max(Math.floor(Q.size.height*0.4),10),J8=Q.size.height-z8;P4.animatePageDown(J8,100)}return"handled"}),$0=new J9(()=>{let P4=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:z8}=this.widget.dependencies,J8=z8.mainThread?.id;return J8?this.getMessageScrollController(J8):null})();if(P4)P4.animateTo(0,100);return"handled"}),G0=new J9(()=>{let P4=this.isShowingPalette&&this.previewThread?this.threadPreviewController.scrollController:(()=>{let{threadState:z8}=this.widget.dependencies,J8=z8.mainThread?.id;return J8?this.getMessageScrollController(J8):null})();if(P4)P4.animateTo(Number.MAX_SAFE_INTEGER,100);return"handled"}),R0=new J9(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";let{threadState:i6}=this.widget.dependencies;if(!i6.mainThread?.messages.some((z8)=>z8.role==="user"||iE(z8)))return"ignored";return this.setState(()=>{this.isMessageViewInSelectionMode=!0}),"handled"}),F6=new J9((i6)=>{if(i6.direction==="previous")this.navigateHistoryPrevious();else this.navigateHistoryNext();return"handled"}),M6=new J9(()=>{if(!this.isTextfieldAndAutocompleteFocused)return"ignored";return i41().then(async(i6)=>{if(i6)try{this.handleInsertImage(i6)}finally{try{let{unlink:P4}=await import("node:fs/promises");await P4(i6)}catch{}}}),"handled"}),N4=new Map([[B4.ctrl("c"),new dg],[B4.ctrl("l"),new ag],[B4.ctrl("o"),new h41],[B4.ctrl("v"),new ug],[B4.alt("s"),new WC],[B4.ctrl("s"),new WC],[B4.alt("p"),new ng],[B4.ctrl("r"),new lg],[B4.alt("d"),new ig],[B4.ctrl("t"),new og],[B4.key("PageUp"),new y41],[B4.key("PageDown"),new x41],[B4.key("Home"),new v41],[B4.key("End"),new f41],[B4.key("Escape"),new pg],[B4.ctrl("p"),new HC("previous")],[B4.ctrl("n"),new HC("next")],[B4.key("Tab"),new rg]]);if(!a2())N4.set(B4.key("ArrowUp"),new rg);if(!1)N4.set(B4.alt("c"),new cg);let k9=new J9(()=>{if(this.isShowingStandaloneThreadPicker)return"handled";return this.showCommandPalette(),"handled"}),I0=new J9(()=>{return this.toggleThreadPickerWorkspaceFilter(),"handled"}),u0=new Map([[pg,s1],[ag,E1],[WC,p1],[h41,k9],[ug,M6],[cg,Y1],[lg,A1],[ig,w1],[ng,I1],[og,I0],[dg,U1],[y41,h1],[x41,r1],[v41,$0],[f41,G0],[rg,R0],[HC,F6]]),k6=[C1];if(this.isShowingConsoleOverlay)k6.push(new T_1);if(this.isShowingHelp){let i6=this.getPaletteCommands().getAllCommands();k6.push(new j_1({commands:i6}))}if(this.adActionModal)k6.push(new H_1({title:"Failed to open browser",message:this.adActionModal.url,showCopyOption:this.adActionModal.showCopyOption,onSelect:async(i6)=>{let P4=this.adActionModal.url;if(i6==="copy")try{await I9.instance.tuiInstance.clipboard.writeText(P4),this.setState(()=>{this.displayMessage=new QG("Link copied to clipboard")})}catch(z8){h.error("Failed to copy to clipboard",{error:z8}),this.setState(()=>{this.displayMessage=Error("Failed to copy to clipboard")})}this.setState(()=>{this.adActionModal=null})}}));if(this.pendingMCPServers.length>0){let{mcpTrustHandler:i6}=this.widget.dependencies;k6.push(new i_1({servers:this.pendingMCPServers,onAlwaysTrust:i6.trustAlways.bind(i6),onTrustOnce:i6.trustOnce.bind(i6),onOpenSettings:this.handleMCPTrustOpenSettings,onDismiss:i6.deny.bind(i6)}))}if(this.isShowingFileChangesOverlay)k6.push(new Fj1({threadData:z}));if(this.isShowingCostBreakdownOverlay&&z.mainThread)k6.push(new R_1({thread:z.mainThread}));if(this.isShowingConfirmationOverlay)k6.push(new I_1({details:this.confirmationOverlayContent}));let e4=this.getCommandPaletteContext(J);if(e4&&this.isShowingPalette)k6.push(new H8({child:new t0({constraints:a6.loose(80,20),child:new w_1({commandContext:e4,mainThread:z.mainThread,commands:this.getPaletteCommands(),onDismiss:this.dismissPalette,initialCommandId:this.paletteInitialCommandId??void 0})})}));if(this.isShowingIdePicker)k6.push(new __1({onCancel:this.dismissIdePicker,onSelect:this.handleIdeSelection,jetbrainsMode:this.widget.dependencies.jetbrainsMode}));if(this.isShowingStandaloneThreadPicker){let i6=n0.file(process.cwd()),P4=A6(i6);k6.push(new H8({child:new t0({constraints:a6.loose(80,20),child:new NC({threads:this.threadsForPicker,title:"Continue Thread",onSelect:this.handleStandaloneThreadSelect,onDismiss:this.dismissStandaloneThreadPicker,previewController:this.threadPreviewController,isLoading:this.isLoadingThreads,currentWorkspaceURI:P4,filterByWorkspace:this.filterThreadPickerByWorkspace,threadViewStates:this.widget.dependencies.workerController.threadViewStates,recentThreadIDs:this.widget.dependencies.recentThreadIDs,currentThreadID:this.widget.dependencies.threadState.mainThread?.id})})}))}let k8=new B5({children:k6});if(this.isShowingJetBrainsInstaller)return new rA({child:new uQ({actions:u0,child:new Eq({shortcuts:N4,debugLabel:"jetbrains-installer-shortcuts",child:new c_1({configService:this.widget.dependencies.configService,ideClient:this.widget.dependencies.ideClient,onExit:()=>process.exit(0),onContinue:this.dismissJetBrainsInstaller})})})});return new Bz({controller:this.toastController,child:new rA({child:new sC1({controller:this.toastController,child:new uQ({actions:u0,child:new Eq({shortcuts:N4,debugLabel:"main-app-shortcuts",child:k8})})})})})}buildScrollableTodoList(J,Q,Y){return new FY6({todos:J,enabled:Q,controller:this.todoScrollController,appTheme:Y})}buildBottomWidget(J,Q,Y,X,G,Z,q,V,K){if(J)return new C_1({error:J,ampURL:this.widget.dependencies.ampURL,onResponse:this.handleEphemeralErrorResponse});if(Q){if(this.displayMessage)this.handleDisplayMessageDismiss();return new P_1({confirmationRequest:Q,onResponse:this.onConfirmationResponse,onShowOverlay:this.showConfirmationOverlay})}if(this.displayMessage)return new n_1({message:this.displayMessage,onDismiss:this.handleDisplayMessageDismiss});let W=X.app,H=r41(X),z=this.isInRestrictedFreeMode(),U=new WO({key:this.textFieldKey,controller:this.textController,triggers:K?[]:[new VN],completionBuilder:K?void 0:this.getCompletionBuilder(),ampURL:this.widget.dependencies.ampURL,onSubmitted:K?void 0:this.onTextSubmitted,theme:Y,placeholder:K?"Press Ctrl+C to exit":z?"Amp Free is not enabled. Press Ctrl+S to switch modes.":void 0,enabled:this.isTextfieldAndAutocompleteFocused&&!z&&!this.isShowingStandaloneThreadPicker,shellPromptRules:H,focusNode:this.autocompleteFocusNode,autofocus:!this.isMessageViewInSelectionMode&&!this.isShowingStandaloneThreadPicker&&!this.isShowingIdePicker,clipboard:I9.instance.tuiInstance.clipboard,onCopy:this._handleTextCopy.bind(this),onInsertImage:this.handleInsertImage,imageAttachments:this.imageAttachments,popImage:this.handlePopImage}),N=G.mainThread?.queuedMessages??[],M=Array.isArray(Z)&&Z.length>0,L=Array.isArray(N)&&N.length>0,A=G.mainThread?.agentMode==="plan"&&uA(G.mainThread),E,P;if(A){if(E=new kC1(new b81({thread:G.mainThread,onExecute:async()=>{let b=this.getCommandPaletteContext();if(b)await this.getPaletteCommands().execute("execute-plan",b,void 0,new AbortController)},onEdit:async()=>{try{let b=process.env.EDITOR||process.env.VISUAL||"nano",{filePath:i}=await this.widget.dependencies.planFileManager.ensureSync(G.mainThread.id);I9.instance.tuiInstance.suspend();let{execSync:Q1}=await import("child_process");Q1(`${b} "${i}"`,{stdio:"inherit"}),I9.instance.tuiInstance.resume()}catch(b){h.error("Failed to edit plan",b),this.setState(()=>{this.displayMessage=Error("Failed to edit plan")})}},controller:this.planScrollController,appTheme:X}),{clipBehavior:"antiAlias"}),L)P=new Z91({queuedMessages:N});else if(M)P=this.buildScrollableTodoList(Z,this.isTextfieldAndAutocompleteFocused&&!z,X)}else E=L?new Z91({queuedMessages:N}):void 0,P=M?this.buildScrollableTodoList(Z,this.isTextfieldAndAutocompleteFocused&&!z,X):void 0;let I=[],R=this.currentShellModeStatus;if(R)I.push({text:new e(R==="hidden"?"shell mode (incognito)":"shell mode",new H1({color:R==="hidden"?X.app.shellModeHidden:X.app.shellMode})),position:"top-left"});if(!R&&this.cachedVisibleModes.length>1){let b=this.previewThread,i=b?b.agentMode??this.getEffectiveAgentMode():this.getEffectiveAgentMode(),Q1=Xk1(i);if(b)I.push({text:new e(i,new H1({color:Q1})),position:"top-left",offsetY:0});else{let m=Lk(i,this.cachedVisibleModes)!==i,s=this.widget.dependencies.getCurrentWorker()||this.widget.dependencies.worker,K1=j$(s.thread)===0,o=z||!this.hasToggledAgentMode&&m&&K1?new e("",void 0,[new e(i,new H1({color:Q1})),new e(" (click or ",new H1({color:Y.foreground,dim:!0})),new e("Ctrl+S",new H1({color:W.keybind})),new e(" to switch)",new H1({color:Y.foreground,dim:!0}))]):new e(i,new H1({color:Q1}));I.push({text:o,position:"top-left",offsetY:0,onClick:K1?this.toggleAgentMode:void 0})}}if(this.connectedClientsStatus&&this.connectedClientsStatus.enabled){let b=this.connectedClientsStatus,i=b.mode||"disconnected",Q1=!!b.errorMessage,a=b.clientID||"unknown",m,s;if(Q1)m="●",s=O1.red;else if(i==="presence")m="○",s=O1.yellow;else if(i==="connected"&&b.connected)m="●",s=O1.green;else m="○",s=O1.yellow;let K1=this.connectedClientsStatusExpanded?`${a} ${m}`:m;I.push({text:new e(K1,new H1({color:s})),position:"top-right",offsetX:-2,offsetY:0,onClick:this.toggleConnectedClientsStatus})}let S=K?this.widget.dependencies.replayMode.thread.env?.initial.trees?.[0]?.uri:G.mainThread?.env?.initial.trees?.[0]?.uri,y;if(S)y=n0.parse(S).fsPath;else y=process.cwd();let x=this.toHomeRelative(y),g=this.shorten(x),p=!K&&this.currentGitBranch?`${g} (${this.currentGitBranch})`:g;return I.push({text:new e(p,new H1({color:Y.foreground,dim:!0})),position:"bottom-right"}),new Gj1({leftChild:new z4({child:U}),rightChild1:E,rightChild2:P,maxHeight:q,overlayTexts:I,borderColor:z||!this.isTextfieldAndAutocompleteFocused?O1.index(8):void 0,hasBanner:V,userHeight:this.bottomGridUserHeight,onInitializeHeight:(b)=>{this.setState(()=>{this.bottomGridUserHeight=Math.min(b,q)})},onDrag:(b)=>{if(this.bottomGridDragStartY===null)this.bottomGridDragStartY=Math.floor(b.localPosition.y),this.bottomGridDragStartHeight=this.bottomGridUserHeight;let i=Math.floor(b.localPosition.y)-this.bottomGridDragStartY,Q1=Math.max(4,this.bottomGridDragStartHeight-i),a=Math.min(Q1,q),m=Math.floor(a);if(this.bottomGridUserHeight!==m)this.setState(()=>{this.bottomGridUserHeight=m})},onDragRelease:()=>{this.bottomGridDragStartY=null,this.bottomGridDragStartHeight=null},enableResize:!V})}}async function Gk1(J){if((await J.configService.getLatest()).settings["terminal.animation"]===!1)I9.instance.tuiInstance.setOptions({queryOptions:{animationDisabled:!0}});let X=()=>null,Z=!1,q=new $z(Z,1000,J.inspectorPort),V=J.features?.find((A)=>A.name==="amp-connect")?.enabled??!1,K=new V_1({threadService:J.threadService,worker:J.worker,builder:(A,E,P,I,R,S)=>{if(X=R,J.threadDependencies&&V)DC1(J.threadDependencies,J.configService,R,I,J.connectedClientsService,J.startNewThread,J.switchToThread,J.clientId).catch((g)=>{h.error("Failed to start automatic presence:",g)});let y=R(),x={...J,worker:y,threadID:y.thread.id};return new HY6({...x,threadState:E,workerController:P,switchWorker:I,getCurrentWorker:R,recentThreadIDs:S})}}),W=new Kj1({configService:J.configService,child:K}),H=new $j1({configService:J.configService,child:W}),z=new dC1(H),U=new S6({data:zC.fromBaseTheme(yZ.default()),child:z});try{await pR1(U,{onRootElementMounted:(A)=>{if(h.info("TUI input ready for user interaction"),Z)q.start(A)}})}finally{if(Z)q.stop();if(J.threadDependencies&&V){let{stopGlobalSession:A}=await Promise.resolve().then(() => (MC1(),G76));A()}}let M=X()?.thread.id||J.threadID,L=await J.threadService.get(M);if(L&&L.messages.length>0){let A=`${J.ampURL.replace(/\/$/,"")}/threads/${M}`;T76(L,A,J.stdout)}}function Xk1(J){let Y=RV(J)?.uiHints?.secondaryColor;if(Y)return O1.rgb(Y.r,Y.g,Y.b);return cN8(J)}class FY6 extends X6{props;constructor(J){super();this.props=J}createState(){return new UY6}}class UY6 extends Y6{viewportHeight=1;scrollListenerAttached=!1;initState(){if(!this.scrollListenerAttached)this.widget.props.controller.addListener(()=>{this.updateViewportHeight()}),this.scrollListenerAttached=!0}build(J){let{todos:Q,controller:Y,appTheme:X}=this.widget.props;return new Q4({crossAxisAlignment:"stretch",children:[new z4({child:new E2({controller:Y,autofocus:!1,child:new K_1({todos:Q})})}),new XG({controller:Y,thumbColor:X.app.scrollbarThumb,trackColor:X.app.scrollbarTrack,getScrollInfo:()=>{let{maxScrollExtent:G,offset:Z}=Y,q=this.viewportHeight,V=G+q;return{totalContentHeight:Math.max(V,0),viewportHeight:Math.max(q,1),scrollOffset:Math.max(Z,0)}}})]})}updateViewportHeight(){let J=this.getViewportHeight();if(J!==this.viewportHeight)this.viewportHeight=J}getViewportHeight(){let J=this.context.findRenderObject();if(!J)return this.viewportHeight;let Q=(X,G=0)=>{if(X&&"size"in X&&"children"in X){let Z=X.children||[];for(let q of Z){if(q&&"size"in q){let K=q.size;if(typeof K?.height==="number"&&K.height>0)return K.height}let V=Q(q,G+1);if(V>0)return V}}return 0},Y=Q(J);if(Y>0)return Y;if("size"in J){let X=J.size;if(typeof X?.height==="number"&&X.height>0)return X.height}return this.viewportHeight}}class BY6 extends j6{props;constructor(J){super();this.props=J}build(J){return new _8({child:new U0({height:1}),cursor:i9.NS_RESIZE,onDrag:(Q)=>{if(this.props.userHeight===void 0){let X=J.findRenderObject()?.size.height??0;if(X>0){this.props.onInitializeHeight(X);return}}this.props.onDrag(Q)},onRelease:this.props.onRelease})}}function cN8(J){let Q=0;for(let G=0;G<J.length;G++){let Z=J.charCodeAt(G);Q=(Q<<5)-Q+Z,Q=Q&Q}let Y=[9,10,11,12,13,14,15,208,209,210,211,212,213,214,215],X=Math.abs(Q)%Y.length;return O1.index(Y[X])}uR1();try{if(process.platform==="win32")await Promise.resolve().then(() => D6(cC(),1))}catch{}if(process.env.AMP_PWD)try{process.chdir(process.env.AMP_PWD),delete process.env.AMP_PWD}catch(J){dZ.write(`Failed to change directory to ${process.env.AMP_PWD}: ${J}
4817
- `)}var yy1=ky1.join(Kz0||ky1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function HO8(J){process.emitWarning=function(Q,Y,X,G){let Z=typeof Q==="string"?Q:Q.message||String(Q),q=Y||"Warning",V=!1;J.warn(Z,{name:q,code:X})}}function _q(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")A$("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")A$("experimental.agentMode",Q.mode);if(J.getOptionValueSourceWithGlobals("useSonnet")==="cli")A$("model.sonnet",Q.useSonnet)}async function vy1(J){try{await VO8(ky1.dirname(yy1),{recursive:!0}),await KO8(yy1,J,"utf-8")}catch(Q){h.debug("Failed to save last thread ID",Q)}}async function zO8(){try{return(await uZ6(yy1,"utf-8")).trim()}catch(J){return null}}var bZ6=[{name:"notifications",long:"notifications",type:"flag",description:(J)=>`${J?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(J)=>`${J?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??RZ,description:`Custom settings file path (overrides the default location ${RZ})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(h).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${iT1})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","jsonl","new-ui"],hidden:!0,deprecated:!0},{name:"dangerouslyAllowAll",long:"dangerously-allow-all",type:"switch",default:!1,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},{name:"jetbrains",long:"jetbrains",type:"flag",default:a2(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration"},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection"},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"useSonnet",long:"use-sonnet",type:"flag",description:(J)=>J?"Use Claude Sonnet 4.5 instead of Gemini 3":"Use default model (Gemini 3)"},{name:"tryOpus",long:"try-opus",type:"switch",default:!1,description:"(deprecated) Opus 4.5 is now the default in smart mode",hidden:!0,deprecated:!0},{name:"mode",long:"mode",short:"m",type:"option",default:mE.SMART.key,description:`Set the agent mode (${mG().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:mG().map((J)=>J.mode)}],gZ6=(J)=>("deprecated"in J)&&J.deprecated===!0,FO8=(J)=>("hidden"in J)&&J.hidden===!0,UO8=(J)=>("default"in J),BO8=(J)=>("default"in J)?J.default:void 0;function NO8(J,Q){let Y=Q.args[0],X=Q.commands.map((Z)=>Z.name());if(Y&&!Y.includes(" ")&&Y.length<30&&!/[./\\]/.test(Y)){let Z=X.filter((V)=>Y.includes(V)||V.includes(Y)),q="Run amp --help for a list of available commands.";if(Z.length>0)q=`Did you mean: ${Z.join(", ")}? Or run amp --help for all commands.`;throw new j8(TZ.unknownCommand(Y),1,q)}}var pZ6=null;function QF5(){return pZ6}function bm(J){return{...J,getThreadEnvironment:Q61,vfs:yE0({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new Dx(J.fileSystem),generateThreadTitle:Rc0,deleteThread:(Q)=>J.threadService.delete(Q)}}var fy1=n0.file(WO8.homedir()),dZ6=process.env.XDG_CONFIG_HOME?n0.file(process.env.XDG_CONFIG_HOME):Z6.joinPath(fy1,".config");async function kq(J,Q){cU0("0.0.1764273685-g926f68");let Y=W$1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:X0.of([n0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:fy1,userConfigDir:dZ6}),{initializeCLITelemetry:X}=await Promise.resolve().then(() => (q91(),$91));X(Y);let G=await Y.getLatest();h.debug("Global configuration initialized",{settingsKeys:Object.keys(G.settings)});let{toolService:Z,dispose:q}=rs0({configService:Y}),V=new Map,K=()=>V.clear(),W=new WF1(Y,J.settings.getWorkspaceRootPath()),H=mw0({configService:Y,trustStore:W,createOAuthProvider:async(a)=>{let m=V.get(a);if(m)return h.debug("Reusing existing OAuth provider for server",{serverName:a}),m;h.debug("Creating OAuth provider for server",{serverName:a});let s=(async()=>{let K1=new SM(J.secrets),W1=await K1.getClientInfo(a),o=new kz1({storage:K1,serverName:a,clientId:W1?.clientId,clientSecret:W1?.clientSecret,scopes:W1?.scopes});return h.debug("OAuth provider created",{serverName:a,hasManualClientId:!!W1?.clientId,willUseDCR:!W1?.clientId}),o})();return V.set(a,s),s}}),z=H01({configService:Y,filesystem:U5,spawn:LA}),{initializeToolProviders:U}=await Promise.resolve().then(() => (hZ6(),fZ6)),{registrations:N,initErrors:M}=await U({toolService:Z,providers:[H,z],initialTimeout:J.executeMode?15000:5000});for(let[a,m]of M)h.warn(`${a} provider initialization slow or failed:`,m);if(Q.jetbrains)oE("JetBrains");else if(Q.ide&&e46())oE("VS Code");else if(Q.ide&&J86())oE("Neovim");if(J.executeMode)lU0(!0);let L,A=U2.status.pipe(q6((a)=>Boolean(a.connected&&a.authenticated)),x4()).subscribe((a)=>{if(a){if(!L)L=Z.registerTool(xr0)}else L?.dispose(),L=void 0}),E;if(!J.executeMode)E=new z61(process.cwd(),{},!0);else E=new class extends z61{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(f5.write(`No API key found. Starting login flow...
4817
+ `)}var yy1=ky1.join(Kz0||ky1.join(process.env.HOME||process.cwd(),".local","state"),"amp","last-thread-id");function HO8(J){process.emitWarning=function(Q,Y,X,G){let Z=typeof Q==="string"?Q:Q.message||String(Q),q=Y||"Warning",V=!1;J.warn(Z,{name:q,code:X})}}function _q(J,Q){if(J.getOptionValueSourceWithGlobals("dangerouslyAllowAll")==="cli")A$("dangerouslyAllowAll",Q.dangerouslyAllowAll);if(J.getOptionValueSourceWithGlobals("mode")==="cli")A$("experimental.agentMode",Q.mode);if(J.getOptionValueSourceWithGlobals("useSonnet")==="cli")A$("model.sonnet",Q.useSonnet)}async function vy1(J){try{await VO8(ky1.dirname(yy1),{recursive:!0}),await KO8(yy1,J,"utf-8")}catch(Q){h.debug("Failed to save last thread ID",Q)}}async function zO8(){try{return(await uZ6(yy1,"utf-8")).trim()}catch(J){return null}}var bZ6=[{name:"notifications",long:"notifications",type:"flag",description:(J)=>`${J?"Enable":"Disable"} sound notifications (enabled by default when not in execute mode)`},{name:"color",long:"color",type:"flag",description:(J)=>`${J?"Enable":"Disable"} color output (enabled by default if stdout and stderr are sent to a TTY)`,deprecated:!0},{name:"settingsFile",long:"settings-file",type:"option",default:process.env.AMP_SETTINGS_FILE??RZ,description:`Custom settings file path (overrides the default location ${RZ})`},{name:"logLevel",long:"log-level",type:"option",description:`Set log level (${Object.keys(h).join(", ")})`},{name:"logFile",long:"log-file",type:"option",description:`Set log file location (overrides the default location ${iT1})`},{name:"format",long:"format",type:"option",description:"output using the standard or new-ui. Options: `ui`, `new-ui`",choices:["ui","jsonl","new-ui"],hidden:!0,deprecated:!0},{name:"dangerouslyAllowAll",long:"dangerously-allow-all",type:"switch",default:!1,description:"Disable all command confirmation prompts (agent will execute all commands without asking)"},{name:"jetbrains",long:"jetbrains",type:"flag",default:a2(),description:(J)=>J?"Enable JetBrains integration. When enabled, Amp automatically includes your open JetBrains file and text selection with every message.":"Disable JetBrains integration"},{name:"ide",long:"ide",type:"flag",default:!0,description:(J)=>J?"Enable IDE connection (default). When enabled, Amp automatically includes your open IDE's file and text selection with every message.":"Disable IDE connection"},{name:"interactive",long:"interactive",type:"flag",description:(J)=>J?"Enable interactive mode. This will enable the interactive UI.":"Disable interactive mode. This will disable the interactive UI.",hidden:!0,deprecated:!0},{name:"mcpConfig",long:"mcp-config",type:"option",description:"JSON configuration or file path for MCP servers to merge with existing settings"},{name:"useSonnet",long:"use-sonnet",type:"flag",description:(J)=>J?"Use Claude Sonnet 4.5 instead of Claude Opus 4.5":"Use default model (Claude Opus 4.5)"},{name:"tryOpus",long:"try-opus",type:"switch",default:!1,description:"(deprecated) Opus 4.5 is now the default in smart mode",hidden:!0,deprecated:!0},{name:"mode",long:"mode",short:"m",type:"option",default:mE.SMART.key,description:`Set the agent mode (${mG().map((J)=>J.mode).join(", ")}) — controls the model, system prompt, and tool selection`,choices:mG().map((J)=>J.mode)}],gZ6=(J)=>("deprecated"in J)&&J.deprecated===!0,FO8=(J)=>("hidden"in J)&&J.hidden===!0,UO8=(J)=>("default"in J),BO8=(J)=>("default"in J)?J.default:void 0;function NO8(J,Q){let Y=Q.args[0],X=Q.commands.map((Z)=>Z.name());if(Y&&!Y.includes(" ")&&Y.length<30&&!/[./\\]/.test(Y)){let Z=X.filter((V)=>Y.includes(V)||V.includes(Y)),q="Run amp --help for a list of available commands.";if(Z.length>0)q=`Did you mean: ${Z.join(", ")}? Or run amp --help for all commands.`;throw new j8(TZ.unknownCommand(Y),1,q)}}var pZ6=null;function QF5(){return pZ6}function bm(J){return{...J,getThreadEnvironment:Q61,vfs:yE0({os:J.fileSystem},J.configService.config),fileChangeTrackerStorage:new Dx(J.fileSystem),generateThreadTitle:Rc0,deleteThread:(Q)=>J.threadService.delete(Q)}}var fy1=n0.file(WO8.homedir()),dZ6=process.env.XDG_CONFIG_HOME?n0.file(process.env.XDG_CONFIG_HOME):Z6.joinPath(fy1,".config");async function kq(J,Q){cU0("0.0.1764288114-gd779fe");let Y=W$1({storage:J.settings,secretStorage:J.secrets,workspaceRoots:X0.of([n0.file(process.cwd())]),defaultAmpURL:J.ampURL,homeDir:fy1,userConfigDir:dZ6}),{initializeCLITelemetry:X}=await Promise.resolve().then(() => (q91(),$91));X(Y);let G=await Y.getLatest();h.debug("Global configuration initialized",{settingsKeys:Object.keys(G.settings)});let{toolService:Z,dispose:q}=rs0({configService:Y}),V=new Map,K=()=>V.clear(),W=new WF1(Y,J.settings.getWorkspaceRootPath()),H=mw0({configService:Y,trustStore:W,createOAuthProvider:async(a)=>{let m=V.get(a);if(m)return h.debug("Reusing existing OAuth provider for server",{serverName:a}),m;h.debug("Creating OAuth provider for server",{serverName:a});let s=(async()=>{let K1=new SM(J.secrets),W1=await K1.getClientInfo(a),o=new kz1({storage:K1,serverName:a,clientId:W1?.clientId,clientSecret:W1?.clientSecret,scopes:W1?.scopes});return h.debug("OAuth provider created",{serverName:a,hasManualClientId:!!W1?.clientId,willUseDCR:!W1?.clientId}),o})();return V.set(a,s),s}}),z=H01({configService:Y,filesystem:U5,spawn:LA}),{initializeToolProviders:U}=await Promise.resolve().then(() => (hZ6(),fZ6)),{registrations:N,initErrors:M}=await U({toolService:Z,providers:[H,z],initialTimeout:J.executeMode?15000:5000});for(let[a,m]of M)h.warn(`${a} provider initialization slow or failed:`,m);if(Q.jetbrains)oE("JetBrains");else if(Q.ide&&e46())oE("VS Code");else if(Q.ide&&J86())oE("Neovim");if(J.executeMode)lU0(!0);let L,A=U2.status.pipe(q6((a)=>Boolean(a.connected&&a.authenticated)),x4()).subscribe((a)=>{if(a){if(!L)L=Z.registerTool(xr0)}else L?.dispose(),L=void 0}),E;if(!J.executeMode)E=new z61(process.cwd(),{},!0);else E=new class extends z61{async start(){}async query(){return[]}getStats(){return{state:"unstarted",stats:[]}}dispose(){}};if(!await J.secrets.get("apiKey",J.ampURL)){if(f5.write(`No API key found. Starting login flow...
4818
4818
  `),!await DO8(J))await fA(),process.exit(1)}let P=await WP0({isDevelopment:!1}),I=new zE1(P,Y),R=new qE1(P,{lazy:!0}),S=new AF1(I,(a,m)=>{let s=D3.get(a);if(s)s.handle(m).catch((K1)=>{h.error("Failed to apply artifact delta",K1)})}),y=Q.notifications!==void 0?Q.notifications:!J.executeMode,x=ts0({playNotificationSound:async(a)=>{if(y){ss0(a);let m=gR1(),s=mR1();if((!m||s)&&G.settings["notifications.system.enabled"]!==!1){if(a==="idle")process.stdout.write("\x1B]777;notify;Amp;Agent is ready\x1B\\");else if(a==="requires-user-input")process.stdout.write("\x1B]777;notify;Amp;Waiting for approval\x1B\\")}}},windowFocused:()=>Promise.resolve(!1),threadService:I,configService:Y});h.info("Starting Amp background services");let g=jc0({threadService:I,threadHistoryService:R,configService:Y,isExtensionDevelopment:!1}),p;U2.status.subscribe((a)=>{p=a});let b=new oG1({workspaceRoots:[n0.file(process.cwd())],getCurrentFile:()=>{if(!p?.openFile)return;try{return n0.parse(p.openFile)}catch(a){h.warn("Failed to parse current file URI",{uri:p.openFile,error:a});return}},getOpenFiles:()=>{if(!p?.visibleFiles?.length)return[];let a=p.openFile;return p.visibleFiles.filter((m)=>m!==a).map((m)=>{try{return n0.parse(m)}catch(s){return h.warn("Failed to parse visible file URI",{uri:m,error:s}),null}}).filter((m)=>m!==null)}}),i=new dR1,Q1={codebaseContextService:b,configService:Y,toolService:Z,mcpService:H,trustStore:W,threadService:I,threadHistoryService:R,threadSyncService:g,planFileManager:S,threadStorage:P,secretStorage:J.secrets,settingsStorage:J.settings,fuzzyServer:E,notificationService:x,fileSystem:Q.jetbrains||Q.ide?SE0:U5,terminal:i};return{...Q1,async asyncDispose(){if(Q1.mcpService.hasAuthenticatingClients())h.info("Waiting for OAuth authentication to complete before exit..."),await Q1.mcpService.waitForAuthentication();for(let a of N.values())a.dispose();await Q1.mcpService.dispose(),K(),await Q1.threadService.asyncDispose(),Q1.configService.unsubscribe(),q(),Q1.fuzzyServer.dispose(),Q1.threadSyncService.dispose(),Q1.settingsStorage[Symbol.dispose](),A.unsubscribe(),L?.dispose()}}}async function DO8(J){if(!J.executeMode){if(!await DR1("Would you like to log in to Amp? [(y)es, (n)o]: "))return f5.write(`Login cancelled. Run the command again to retry.
4819
4819
  `),!1}return await cZ6(J)}async function cZ6(J){let Q=qO8(32).toString("hex"),Y=await NR1(J.ampURL,Q),X=new AbortController;try{await FE(Y,X.signal)}catch(Z){h.error("Error opening browser",{error:Z})}let G=await NR1(J.ampURL,Q,!1);f5.write(`If your browser does not open automatically, visit:
4820
4820
 
@@ -4824,7 +4824,7 @@ ${f4.blue.bold(G)}
4824
4824
  Login successful! You can now use the Amp CLI.
4825
4825
  `),!0}catch(Z){return h.error("Login failed",{error:Z}),dZ.write(`
4826
4826
  Login failed: ${Z instanceof Error?Z.message:String(Z)}
4827
- `),!1}}function MO8(){let J=new IA().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((H)=>{if(H.code==="commander.help"||H.code==="commander.version"||H.exitCode===0)kR(),process.exit(0);let z=H.originalError??H;a66(z)}),J.option("-V, --version","Print the version number and exit",()=>{f5.write(`0.0.1764273685-g926f68 (released 2025-11-27T20:06:51.391Z)
4827
+ `),!1}}function MO8(){let J=new IA().name("amp").description("AI-powered coding assistant").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").configureOutput({writeErr:()=>{}});J.exitOverride((H)=>{if(H.code==="commander.help"||H.code==="commander.version"||H.exitCode===0)kR(),process.exit(0);let z=H.originalError??H;a66(z)}),J.option("-V, --version","Print the version number and exit",()=>{f5.write(`0.0.1764288114-gd779fe (released 2025-11-28T00:07:02.253Z)
4828
4828
  `),process.exit(0)}),J.addHelpText("after",r46()),J.configureHelp({formatHelp:s46}),J.command("logout").description("Log out by removing stored API key").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await oQ(U);await wO8(N)}),J.command("login").description("Log in to Amp").addHelpText("after","If AMP_URL is set during login, it will be persisted to global settings for future CLI invocations, though AMP_URL will continue to take precedence.").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await oQ(U);await OO8(N,await ZR1(U,N.settings))});let Q=async(H,z,U)=>{W$1({storage:z.settings,secretStorage:z.secrets,workspaceRoots:X0.of([n0.file(process.cwd())]),defaultAmpURL:z.ampURL,homeDir:fy1,userConfigDir:dZ6});let N={...z,executeMode:!1};await xy1(N,{...H,openThreadSwitcher:!0},U)},Y=J.command("threads").alias("t").alias("thread").summary("Manage threads").description("Thread management commands. When no subcommand is provided, defaults to listing threads.").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await oQ(U);await mZ6(U,N,z)});Y.command("new").alias("n").summary("Create a new thread").description("Create a new thread and print its ID. The thread will be empty. You can set the visibility using the --visibility option.").option("--visibility <visibility>","Set thread visibility (private, public, workspace, group)").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await oQ(U);await jO8(U,N,z)}),Y.command("continue [threadId]").alias("c").summary("Continue an existing thread").description("Continue an existing thread by resuming the conversation. By default, shows an interactive picker with the most recently used thread at the top. Use --last to continue the last thread directly without the picker.").option("--last","Continue the last thread directly without showing the picker").option("--pick","Pick a thread interactively from a list (DEPRECATED: picker is now the default)").action(async(H,z,U)=>{let N=U.optsWithGlobals(),M=await oQ(N);if(z.pick)dZ.write(`${f4.yellow("Warning:")} The --pick flag is deprecated. The picker is now shown by default.
4829
4829
  `);if(z.last||H||M.executeMode)await CO8(N,M,H,U);else await Q(N,M,U)}),Y.command("fork [threadId]").alias("f").summary("Fork an existing thread").description("Create a new thread by forking an existing one. This copies the conversation history up to the current point and creates a new thread where you can explore different directions. If no thread ID is provided, the most recently used thread will be forked.").action(async(H,z,U)=>{let N=U.optsWithGlobals(),M=await oQ(N);await RO8(N,M,H,U)}),Y.command("list").alias("l").alias("ls").summary("List all threads").description("List all your threads with their IDs, names, and last modified times.").action(async(H,z)=>{let U=z.optsWithGlobals(),N=await oQ(U);await mZ6(U,N,z)}),Y.command("share <threadId>").summary("Share a thread").description("Change thread visibility (private, public, unlisted, workspace, group) or share with Amp support for debugging. Use --visibility to change who can access the thread, or --support to share with the Amp team for troubleshooting.").alias("s").option("--visibility <visibility>","Set thread visibility (private, public, unlisted, workspace, group)").option("--support [message]","Share thread with Amp support for debugging").action(async(H,z,U)=>{let N=U.optsWithGlobals(),M=await oQ(N);await TO8(N,M,H,U,z.support)}),Y.command("rename <threadId> <newName>").alias("r").summary("Rename a thread").description('Change the title of a thread. Quote names with spaces: amp threads rename T-123 "New thread name"').action(async(H,z,U,N)=>{let M=N.optsWithGlobals(),L=await oQ(M);await EO8(M,L,H,z,N)}),Y.command("markdown <threadId>").alias("md").summary("Render thread as markdown").description("Render a thread as markdown. This outputs the entire conversation history in a readable markdown format.").action(async(H,z,U)=>{let N=U.optsWithGlobals(),M=await oQ(N);await IO8(N,M,H,U)}),Y.command("replay <threadId>").alias("p").summary("Replay a thread").description("Replay a thread by downloading it and playing through all interactions. User messages are simulated with variable typing speed.").option("--wpm <wpm>","Typing speed in words per minute (default: 120)","120").option("--no-typing","Disable typing simulation and display messages instantly").option("--message-delay <ms>","Delay between messages in milliseconds (default: 1000)","1000").option("--tool-progress-delay <ms>","Delay to show tool in-progress state in milliseconds (default: 800)","800").option("--exit-delay <seconds>","Delay in seconds before exiting after replay completes (default: 3)","3").option("--no-indicator","Hide the replay progress indicator").action(async(H,z,U)=>{let N=U.optsWithGlobals(),M=await oQ(N);await PO8(N,M,H,z,U)}),i96(J,async(H,z)=>{let U=await oQ(z);_q(H,z);let N=await kq(U,z);return{context:U,mcpService:N.mcpService,toolService:N.toolService,toolServices:N.toolService,configService:N.configService,cleanupTerminal:kR,asyncDispose:N.asyncDispose.bind(N)}}),x86(J,async(H)=>{let z=H.optsWithGlobals();return await oQ(z)}),I86(J,async(H)=>{let z=await oQ(H);return{settings:z.settings,secretStorage:z.secrets,getThreadDeps:async(U)=>{_q(U,H);let N=await kq(z,H);return{mcpService:N.mcpService,settings:z.settings,asyncDispose:N.asyncDispose.bind(N)}}}});function G(H,z,U){let M=typeof H.description==="string"?H.description:U===void 0?H.description(!0):H.description(U),L=new vB(z,M),A=BO8(H);if(A)L.default(A);if(L.hidden=FO8(H)||gZ6(H),"choices"in H)L.choices([...H.choices]);return L}for(let H of bZ6)switch(H.type){case"flag":{J.addOption(G(H,`--${H.long}`)),J.addOption(G(H,`--no-${H.long}`,!1));break}case"switch":{J.addOption(G(H,`--${H.long}`,!0));break}default:{J.addOption(G(H,`${"short"in H?`-${H.short}, `:""}--${H.long} <value>`));break}}let Z=new vB("-x, --execute [message]","Use execute mode, optionally with user message. In execute mode, agent will execute provided prompt (either as argument, or via stdin). Only last assistant message is printed. Enabled automatically when redirecting stdout.").default(!1);J.addOption(Z);let q=new vB("-r, --remote","When used with -x/--execute, execute in an async agent on the Amp server.").default(!1).hideHelp();J.addOption(q);let V=new vB("--stream-json","When used with --execute, output in Claude Code-compatible stream JSON format instead of plain text.").default(!1);J.addOption(V);let K=new vB("--stream-json-input","Read JSON Lines user messages from stdin. Requires both --execute and --stream-json.").default(!1);J.addOption(K);let W=new vB("--stats","When used with --execute, output JSON with both result and token usage data (for /evals).").default(!1).hideHelp(!0);if(J.addOption(W),process.env.AMP_CONNECT==="1"){let H=new vB("--client-id <clientId>","Override the client ID for connect functionality (default: amp-<pid>@<hostname>)");J.addOption(H)}return J.action(async(H,z)=>{let U=H,N=await oQ(U);if(z.getOptionValueSourceWithGlobals("tryOpus")==="cli")f5.write(f4.yellow(`Opus 4.5 is now the default in Amp's smart mode. Rerun without --try-opus.
4830
4830
  `)),process.exit(0);if(Object.keys(U).forEach((M)=>{let L=bZ6.find((A)=>A.name===M);if(L&&gZ6(L)&&!UO8(L))dZ.write(f4.yellow(`Warning: '--${M}' flag is deprecated
@@ -4832,8 +4832,8 @@ Login failed: ${Z instanceof Error?Z.message:String(Z)}
4832
4832
  Or pipe via stdin: echo "your message" | amp --execute`);_q(Y,Q);let q=await kq(J,Q);pZ6=q;let V=bm(q),K=async(i)=>{let Q1=await uZ6(i,"utf-8"),a=JSON.parse(Q1);if(!C$(a.id))throw new j8(TZ.invalidThreadId);return o91(q,{visibility:X,agentMode:Q.mode,thread:a})},W=async(i)=>{if(!C$(i))throw new j8(TZ.invalidThreadId);try{let[a,m]=await Promise.all([P5.getThreadLinkInfo({thread:i},{config:q.configService}),P5.getUserInfo({},{config:q.configService})]);if(a.ok&&m.ok){let s=a.result.creatorUserID,K1=m.result.id;if(s&&s!==K1&&!process.env.AMP_RESUME_OTHER_USER_THREADS_INSECURE)throw new j8(`Cannot resume thread created by another user.
4833
4833
 
4834
4834
  This thread belongs to a different user and cannot be continued for security reasons. Set AMP_RESUME_OTHER_USER_THREADS_INSECURE=1 to bypass this check.`)}}catch(a){if(a instanceof j8)throw a;h.warn("Failed to validate thread ownership in CLI, allowing to open",{error:a})}let Q1=await q.threadService.get(i)??void 0;return h.info(`[fetchAndStartThread] Loaded thread ${i}, agentMode: ${Q1?.agentMode??"undefined"}`),o91(q,{visibility:X,agentMode:Q1?void 0:Q.mode,thread:Q1})},H=async()=>{try{if(Q.threadId)return W(Q.threadId);else return o91(q,{visibility:X})}catch(i){if(i instanceof j8)throw i;throw await qg(i,Q.threadId),Error("handleError should have called process.exit()")}},z=async()=>{return o91(q,{visibility:X})};if(Q.format==="jsonl")dZ.write(`jsonl format is deprecated. Version "0.0.1752148945-gd8844f" or earlier is required to use jsonl format.
4835
- `),await fA(),process.exit(1);if(J.executeMode&&Q.remote)await v86(G,Z,q.configService),await q.asyncDispose(),process.exit(0);let U=await H();if(J.executeMode)R86(q.mcpService,J.settings),await V46(U,U.threadID,G,Z,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let N=!1,M=!1;if(Q.jetbrains||Q.ide){await VD0();let i=HI({jetbrainsOnly:Q.jetbrains});if(i.length===0){if(Q.jetbrains)M=!await q.configService.get("jetbrains.skipInstall")}else if(i.length===1){let Q1=i[0];if(Q1)U2.selectConfig(Q1)}else N=!0}let L=O61("0.0.1764273685-g926f68",q.settingsStorage),A=new G11(q.threadStorage),E=X0.of([n0.file(process.cwd())]),P=$Z1(void 0,E),I=new w61(q.mcpService,J.settings.getWorkspaceRootPath());if(G)U.handle({type:"user:message",message:{content:[{type:"text",text:G}]}});let R=(async()=>{try{let i=await P5.getUserFreeTierStatus({},{config:q.configService,signal:AbortSignal.timeout(5000)});if(i.ok)return h.info("User free tier status:",i),i.result}catch(i){h.error("Failed to fetch free tier status:",i)}})(),S=(async()=>{try{let i=await P5.getUserInfo({},{config:q.configService});if(i.ok)return i.result}catch(i){h.debug("Failed to fetch user workspace info:",i)}})(),[y,x]=await Promise.all([R,S]),g=x?.email,p=g&&(g.endsWith("@sourcegraph.com")||g.endsWith("@ampcode.com")||g==="auth-bypass-user@example.com");if(p)q.toolService.registerTool(hr0);let b=await g86();h.info("Loaded session state:",b),await Gk1({codebaseContextService:q.codebaseContextService,stdout:process.stdout,history:new Z61,fuzzyServer:q.fuzzyServer,settingsStorage:q.settingsStorage,threadService:q.threadService,threadHistoryService:q.threadHistoryService,threadSyncService:q.threadSyncService,planFileManager:q.planFileManager,threadID:U.threadID,threadFuzzyIndexer:A,worker:U,workerDeps:V,configService:q.configService,internalAPIClient:P5,ampURL:J.ampURL,startNewThread:z,switchToThread:W,ideClient:U2,connectedClientsService:new sl,commandRegistry:P,mcpService:q.mcpService,mcpTrustHandler:I,showJetBrainsInstaller:M,showIdePicker:N,openThreadSwitcher:Q.openThreadSwitcher,updateService:L,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:b,freeTierStatus:y,workspace:x?.team??null,features:x?.features??[],isDogfooding:p||!1,threadDependencies:q}),await q.asyncDispose(),process.exit(0)}async function oQ(J){if(J.interactive)dZ.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
4836
- `);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Y=process.stdout.isTTY&&process.stderr.isTTY,X=await x46({...J,workspaceTrust:{current:!0,changes:d_},getHook:process.env.AMP_URL?(Z,q)=>{if(Z==="url")return Promise.resolve(process.env.AMP_URL);return q()}:void 0});if(J.mcpConfig){let Z=await P86(J.mcpConfig);X=T86(X,Z)}let G=await X.get("url","global");if(!G)G=KY;if(!yF(G))h.info("Targeting custom Amp server",{ampURL:G});return X=VF0(X),{executeMode:Q,isTTY:Y,ampURL:G,settings:X,secrets:f86(await ZR1(J,X))}}function LO8(J){let Q={};for(let Y=0;Y<J.length;Y++){let X=J[Y];if(X?.startsWith("--")){let Z=X.slice(2).replace(/-([a-z])/g,(V,K)=>K.toUpperCase()),q=J[Y+1];if(q&&!q.startsWith("--"))Q[Z]=q,Y++}}return Q}async function AO8(){let J=LO8(process.argv);if(g66({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),HO8(h),h.info("Starting Amp CLI.",{version:"0.0.1764273685-g926f68",buildTimestamp:"2025-11-27T20:06:51.391Z"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new j8(TZ.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await MO8().parseAsync(process.argv)}YE1().startActiveSpan("main",async(J)=>{process.on("exit",()=>J.end()),await AO8().catch(qg)});async function OO8(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),f5.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
4835
+ `),await fA(),process.exit(1);if(J.executeMode&&Q.remote)await v86(G,Z,q.configService),await q.asyncDispose(),process.exit(0);let U=await H();if(J.executeMode)R86(q.mcpService,J.settings),await V46(U,U.threadID,G,Z,q,!!Q.streamJson,!!Q.streamJsonInput,!!Q.stats,J.ampURL),await q.asyncDispose(),process.exit(0);let N=!1,M=!1;if(Q.jetbrains||Q.ide){await VD0();let i=HI({jetbrainsOnly:Q.jetbrains});if(i.length===0){if(Q.jetbrains)M=!await q.configService.get("jetbrains.skipInstall")}else if(i.length===1){let Q1=i[0];if(Q1)U2.selectConfig(Q1)}else N=!0}let L=O61("0.0.1764288114-gd779fe",q.settingsStorage),A=new G11(q.threadStorage),E=X0.of([n0.file(process.cwd())]),P=$Z1(void 0,E),I=new w61(q.mcpService,J.settings.getWorkspaceRootPath());if(G)U.handle({type:"user:message",message:{content:[{type:"text",text:G}]}});let R=(async()=>{try{let i=await P5.getUserFreeTierStatus({},{config:q.configService,signal:AbortSignal.timeout(5000)});if(i.ok)return h.info("User free tier status:",i),i.result}catch(i){h.error("Failed to fetch free tier status:",i)}})(),S=(async()=>{try{let i=await P5.getUserInfo({},{config:q.configService});if(i.ok)return i.result}catch(i){h.debug("Failed to fetch user workspace info:",i)}})(),[y,x]=await Promise.all([R,S]),g=x?.email,p=g&&(g.endsWith("@sourcegraph.com")||g.endsWith("@ampcode.com")||g==="auth-bypass-user@example.com");if(p)q.toolService.registerTool(hr0);let b=await g86();h.info("Loaded session state:",b),await Gk1({codebaseContextService:q.codebaseContextService,stdout:process.stdout,history:new Z61,fuzzyServer:q.fuzzyServer,settingsStorage:q.settingsStorage,threadService:q.threadService,threadHistoryService:q.threadHistoryService,threadSyncService:q.threadSyncService,planFileManager:q.planFileManager,threadID:U.threadID,threadFuzzyIndexer:A,worker:U,workerDeps:V,configService:q.configService,internalAPIClient:P5,ampURL:J.ampURL,startNewThread:z,switchToThread:W,ideClient:U2,connectedClientsService:new sl,commandRegistry:P,mcpService:q.mcpService,mcpTrustHandler:I,showJetBrainsInstaller:M,showIdePicker:N,openThreadSwitcher:Q.openThreadSwitcher,updateService:L,inspector:Q.inspector,inspectorPort:Q.inspectorPort,jetbrainsMode:Q.jetbrains,clientId:Q.clientId,sessionState:b,freeTierStatus:y,workspace:x?.team??null,features:x?.features??[],isDogfooding:p||!1,threadDependencies:q}),await q.asyncDispose(),process.exit(0)}async function oQ(J){if(J.interactive)dZ.write(`Warning: --interactive flag is deprecated. Interactive mode is now the default unless --execute is used or output is redirected.
4836
+ `);let Q=!!J.execute||!process.stdout.isTTY&&!J.streamJson,Y=process.stdout.isTTY&&process.stderr.isTTY,X=await x46({...J,workspaceTrust:{current:!0,changes:d_},getHook:process.env.AMP_URL?(Z,q)=>{if(Z==="url")return Promise.resolve(process.env.AMP_URL);return q()}:void 0});if(J.mcpConfig){let Z=await P86(J.mcpConfig);X=T86(X,Z)}let G=await X.get("url","global");if(!G)G=KY;if(!yF(G))h.info("Targeting custom Amp server",{ampURL:G});return X=VF0(X),{executeMode:Q,isTTY:Y,ampURL:G,settings:X,secrets:f86(await ZR1(J,X))}}function LO8(J){let Q={};for(let Y=0;Y<J.length;Y++){let X=J[Y];if(X?.startsWith("--")){let Z=X.slice(2).replace(/-([a-z])/g,(V,K)=>K.toUpperCase()),q=J[Y+1];if(q&&!q.startsWith("--"))Q[Z]=q,Y++}}return Q}async function AO8(){let J=LO8(process.argv);if(g66({logLevel:J.logLevel||process.env.AMP_LOG_LEVEL,logFile:J.logFile||process.env.AMP_LOG_FILE}),HO8(h),h.info("Starting Amp CLI.",{version:"0.0.1764288114-gd779fe",buildTimestamp:"2025-11-28T00:07:02.253Z"}),parseInt(process.version.slice(1).split(".")[0]??"")<20)throw new j8(TZ.nodeVersion(process.version),1,"Please upgrade your Node.js installation from https://nodejs.org");await MO8().parseAsync(process.argv)}YE1().startActiveSpan("main",async(J)=>{process.on("exit",()=>J.end()),await AO8().catch(qg)});async function OO8(J,Q){if(process.env.AMP_URL)await J.settings.set("url",process.env.AMP_URL,"global"),f5.write(`Saving custom server URL to settings: ${process.env.AMP_URL}
4837
4837
  `);else if(!yF(J.ampURL))f5.write(`Logging in to ${new URL(J.ampURL).hostname}
4838
4838
  `);let Y=process.env.AMP_API_KEY;if(Y)f5.write(`API key found in environment variable, storing...
4839
4839
  `),await Q.set("apiKey",Y,J.ampURL),f5.write(`API key successfully stored.
@@ -4846,7 +4846,7 @@ This thread belongs to a different user and cannot be continued for security rea
4846
4846
  `);else f5.write(`Successfully logged out from ${new URL(J.ampURL).hostname}.
4847
4847
  `);process.exit(0)}async function EO8(J,Q,Y,X,G){_q(G,J);let Z=await kq(Q,J);try{let q=r91(Y);if(!q)s91(Y);let V=q,K=X.trim();if(K.length===0)pZ("Thread name cannot be empty");if(K.length>256)pZ("Thread name cannot exceed 256 characters");if(!(await lC(V,Z)).messages.length)pZ("Cannot rename an empty thread.");let H=bm(Z);await(await D3.getOrCreateForThread(H,V)).handle({type:"title",value:K}),h.info("GOT HERE"),await Z.threadSyncService.sync(),h.info("GOT THERE"),f5.write(f4.green(`✓ Thread ${V} renamed to "${K}"
4848
4848
  `)),await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose();let V=`Failed to rename thread: ${q instanceof Error?q.message:String(q)}`;pZ(V)}}async function IO8(J,Q,Y,X){_q(X,J);let G=await kq(Q,J);try{let Z=r91(Y);if(!Z)s91(Y);let V=await lC(Z,G),K=QR(V);f5.write(K+`
4849
- `),await G.asyncDispose(),process.exit(0)}catch(Z){await G.asyncDispose();let q=`Failed to render thread as markdown: ${Z instanceof Error?Z.message:String(Z)}`;pZ(q)}}async function PO8(J,Q,Y,X,G){_q(G,J);let Z=await kq(Q,J);try{let q=await hy1(Y),V=await lC(q,Z),K=X.typing!==!1,W=parseInt(X.wpm||"120",10),H=parseInt(X.messageDelay||"1000",10),z=parseInt(X.toolProgressDelay||"800",10),U=parseInt(X.exitDelay||"3",10)*1000,N=X.indicator!==!1,M=bm(Z),L=V.id;await Z.threadStorage.set(L,V);let A=await D3.getOrCreateForThread(M,L);await A.resume();let E=X11.fromWorker(A),P=new G11(Z.threadStorage),I=X0.of([n0.file(process.cwd())]),R=$Z1(void 0,I),S=new w61(Z.mcpService,Q.settings.getWorkspaceRootPath()),y=O61("0.0.1764273685-g926f68",Z.settingsStorage);await Gk1({codebaseContextService:Z.codebaseContextService,stdout:process.stdout,history:new Z61,fuzzyServer:Z.fuzzyServer,settingsStorage:Z.settingsStorage,threadService:Z.threadService,threadHistoryService:Z.threadHistoryService,threadSyncService:Z.threadSyncService,planFileManager:Z.planFileManager,threadID:L,threadFuzzyIndexer:P,worker:E,workerDeps:M,configService:Z.configService,internalAPIClient:P5,ampURL:Q.ampURL,startNewThread:async()=>E,switchToThread:async()=>E,ideClient:U2,connectedClientsService:new sl,commandRegistry:R,mcpService:Z.mcpService,mcpTrustHandler:S,showJetBrainsInstaller:!1,updateService:y,isDogfooding:!1,replayMode:{thread:V,typingEnabled:K,baseWpm:W,messageDelayMs:H,toolProgressDelayMs:z,exitDelayMs:U,showIndicator:N}}),await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose(),await qg(q,Y)}}async function TO8(J,Q,Y,X,G){_q(X,J);let Z=await kq(Q,J);try{let q=r91(Y);if(!q)s91(Y);let V=q,K=await P5.getUserInfo({},{config:Z.configService}),W=K.ok?K.result:null,H=E61(J,W);if(!H&&!G)pZ("Must specify either --visibility or --support");if(H&&G)pZ("Cannot specify both --visibility and --support at the same time");if(H instanceof Error)pZ(H.message);if(H)await Z.threadSyncService.updateThreadMeta(V,I61(H)),f5.write(f4.green("✓ ")+`Thread ${V} visibility changed to ${H}.
4849
+ `),await G.asyncDispose(),process.exit(0)}catch(Z){await G.asyncDispose();let q=`Failed to render thread as markdown: ${Z instanceof Error?Z.message:String(Z)}`;pZ(q)}}async function PO8(J,Q,Y,X,G){_q(G,J);let Z=await kq(Q,J);try{let q=await hy1(Y),V=await lC(q,Z),K=X.typing!==!1,W=parseInt(X.wpm||"120",10),H=parseInt(X.messageDelay||"1000",10),z=parseInt(X.toolProgressDelay||"800",10),U=parseInt(X.exitDelay||"3",10)*1000,N=X.indicator!==!1,M=bm(Z),L=V.id;await Z.threadStorage.set(L,V);let A=await D3.getOrCreateForThread(M,L);await A.resume();let E=X11.fromWorker(A),P=new G11(Z.threadStorage),I=X0.of([n0.file(process.cwd())]),R=$Z1(void 0,I),S=new w61(Z.mcpService,Q.settings.getWorkspaceRootPath()),y=O61("0.0.1764288114-gd779fe",Z.settingsStorage);await Gk1({codebaseContextService:Z.codebaseContextService,stdout:process.stdout,history:new Z61,fuzzyServer:Z.fuzzyServer,settingsStorage:Z.settingsStorage,threadService:Z.threadService,threadHistoryService:Z.threadHistoryService,threadSyncService:Z.threadSyncService,planFileManager:Z.planFileManager,threadID:L,threadFuzzyIndexer:P,worker:E,workerDeps:M,configService:Z.configService,internalAPIClient:P5,ampURL:Q.ampURL,startNewThread:async()=>E,switchToThread:async()=>E,ideClient:U2,connectedClientsService:new sl,commandRegistry:R,mcpService:Z.mcpService,mcpTrustHandler:S,showJetBrainsInstaller:!1,updateService:y,isDogfooding:!1,replayMode:{thread:V,typingEnabled:K,baseWpm:W,messageDelayMs:H,toolProgressDelayMs:z,exitDelayMs:U,showIndicator:N}}),await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose(),await qg(q,Y)}}async function TO8(J,Q,Y,X,G){_q(X,J);let Z=await kq(Q,J);try{let q=r91(Y);if(!q)s91(Y);let V=q,K=await P5.getUserInfo({},{config:Z.configService}),W=K.ok?K.result:null,H=E61(J,W);if(!H&&!G)pZ("Must specify either --visibility or --support");if(H&&G)pZ("Cannot specify both --visibility and --support at the same time");if(H instanceof Error)pZ(H.message);if(H)await Z.threadSyncService.updateThreadMeta(V,I61(H)),f5.write(f4.green("✓ ")+`Thread ${V} visibility changed to ${H}.
4850
4850
  `);if(G){await lC(V,Z);let z=typeof G==="string"?G:void 0;await GP0(Z.threadService,V,Z.configService,z),f5.write(f4.green("✓ ")+`Thread ${V} has been shared with Amp support. These thread reports will be aggregated and analysed.
4851
4851
  `)}await Z.asyncDispose(),process.exit(0)}catch(q){await Z.asyncDispose(),pZ(`Failed to update thread: ${q instanceof Error?q.message:String(q)}`)}}async function RO8(J,Q,Y,X){_q(X,J);let G=await kq(Q,J),Z=bm(G);try{let q=await hy1(Y),K=(await lC(q,G)).messages.length-1,W=await D3.getOrCreateForThread(Z,q),H=await YR(W,G.threadSyncService,K);await Promise.all([G.threadSyncService.uploadThread(q),G.threadSyncService.uploadThread(H)]),await vy1(H),f5.write(`${H}
4852
4852
  `),await G.asyncDispose(),process.exit(0)}catch(q){dZ.write(`Error forking thread: ${q instanceof Error?q.message:String(q)}