@clinebot/core 0.0.26 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ To resolve the conflict:`,(0,aW.getConflictResolutionRecipe)(F,X))}W=z}else Ji.d
25
25
  `,`Details:
26
26
  `,(0,aW.getIncompatibilityDetails)(F,X),`To resolve the conflict:
27
27
  `,(0,aW.getConflictResolutionRecipe)(F,X))}return W}}Wi.MetricStorageRegistry=RV});var Hi=X0((zi)=>{Object.defineProperty(zi,"__esModule",{value:!0});zi.MultiMetricStorage=void 0;class Fi{constructor(X){this._backingStorages=X}record(X,Y,W,z){this._backingStorages.forEach((F)=>{F.record(X,Y,W,z)})}}zi.MultiMetricStorage=Fi});var Oi=X0((Ni)=>{Object.defineProperty(Ni,"__esModule",{value:!0});Ni.BatchObservableResultImpl=Ni.ObservableResultImpl=void 0;var uX=q1(),Vi=hZ(),Mh0=iW();class Bi{constructor(X,Y){this._instrumentName=X,this._valueType=Y,this._buffer=new Vi.AttributeHashMap}observe(X,Y={}){if(typeof X!=="number"){uX.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${X}`);return}if(this._valueType===uX.ValueType.INT&&!Number.isInteger(X)){if(uX.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),X=Math.trunc(X),!Number.isInteger(X))return}this._buffer.set(Y,X)}}Ni.ObservableResultImpl=Bi;class Ui{constructor(){this._buffer=new Map}observe(X,Y,W={}){if(!(0,Mh0.isObservableInstrument)(X))return;let z=this._buffer.get(X);if(z==null)z=new Vi.AttributeHashMap,this._buffer.set(X,z);if(typeof Y!=="number"){uX.diag.warn(`non-number value provided to metric ${X._descriptor.name}: ${Y}`);return}if(X._descriptor.valueType===uX.ValueType.INT&&!Number.isInteger(Y)){if(uX.diag.warn(`INT value type cannot accept a floating-point value for ${X._descriptor.name}, ignoring the fractional digits.`),Y=Math.trunc(Y),!Number.isInteger(Y))return}z.set(W,Y)}}Ni.BatchObservableResultImpl=Ui});var Ci=X0((Di)=>{Object.defineProperty(Di,"__esModule",{value:!0});Di.ObservableRegistry=void 0;var Ph0=q1(),Ti=iW(),Ii=Oi(),xZ=M8();class $i{constructor(){this._callbacks=[],this._batchCallbacks=[]}addCallback(X,Y){if(this._findCallback(X,Y)>=0)return;this._callbacks.push({callback:X,instrument:Y})}removeCallback(X,Y){let W=this._findCallback(X,Y);if(W<0)return;this._callbacks.splice(W,1)}addBatchCallback(X,Y){let W=new Set(Y.filter(Ti.isObservableInstrument));if(W.size===0){Ph0.diag.error("BatchObservableCallback is not associated with valid instruments",Y);return}if(this._findBatchCallback(X,W)>=0)return;this._batchCallbacks.push({callback:X,instruments:W})}removeBatchCallback(X,Y){let W=new Set(Y.filter(Ti.isObservableInstrument)),z=this._findBatchCallback(X,W);if(z<0)return;this._batchCallbacks.splice(z,1)}async observe(X,Y){let W=this._observeCallbacks(X,Y),z=this._observeBatchCallbacks(X,Y);return(await(0,xZ.PromiseAllSettled)([...W,...z])).filter(xZ.isPromiseAllSettledRejectionResult).map((J)=>J.reason)}_observeCallbacks(X,Y){return this._callbacks.map(async({callback:W,instrument:z})=>{let F=new Ii.ObservableResultImpl(z._descriptor.name,z._descriptor.valueType),Q=Promise.resolve(W(F));if(Y!=null)Q=(0,xZ.callWithTimeout)(Q,Y);await Q,z._metricStorages.forEach((J)=>{J.record(F._buffer,X)})})}_observeBatchCallbacks(X,Y){return this._batchCallbacks.map(async({callback:W,instruments:z})=>{let F=new Ii.BatchObservableResultImpl,Q=Promise.resolve(W(F));if(Y!=null)Q=(0,xZ.callWithTimeout)(Q,Y);await Q,z.forEach((J)=>{let Z=F._buffer.get(J);if(Z==null)return;J._metricStorages.forEach((K)=>{K.record(Z,X)})})})}_findCallback(X,Y){return this._callbacks.findIndex((W)=>{return W.callback===X&&W.instrument===Y})}_findBatchCallback(X,Y){return this._batchCallbacks.findIndex((W)=>{return W.callback===X&&(0,xZ.setEquals)(W.instruments,Y)})}}Di.ObservableRegistry=$i});var Pi=X0((Mi)=>{Object.defineProperty(Mi,"__esModule",{value:!0});Mi.SyncMetricStorage=void 0;var wh0=IV(),Sh0=EV(),fh0=CV();class Ri extends wh0.MetricStorage{constructor(X,Y,W,z,F){super(X);this._attributesProcessor=W,this._aggregationCardinalityLimit=F,this._deltaMetricStorage=new Sh0.DeltaMetricProcessor(Y,this._aggregationCardinalityLimit),this._temporalMetricStorage=new fh0.TemporalMetricProcessor(Y,z)}record(X,Y,W,z){Y=this._attributesProcessor.process(Y,W),this._deltaMetricStorage.record(X,Y,W,z)}collect(X,Y){let W=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(X,this._instrumentDescriptor,W,Y)}}Mi.SyncMetricStorage=Ri});var LV=X0((Si)=>{Object.defineProperty(Si,"__esModule",{value:!0});Si.FilteringAttributesProcessor=Si.NoopAttributesProcessor=Si.AttributesProcessor=void 0;class rW{static Noop(){return yh0}}Si.AttributesProcessor=rW;class MV extends rW{process(X,Y){return X}}Si.NoopAttributesProcessor=MV;class wi extends rW{constructor(X){super();this._allowedAttributeNames=X}process(X,Y){let W={};return Object.keys(X).filter((z)=>this._allowedAttributeNames.includes(z)).forEach((z)=>W[z]=X[z]),W}}Si.FilteringAttributesProcessor=wi;var yh0=new MV});var ji=X0((ki)=>{Object.defineProperty(ki,"__esModule",{value:!0});ki.MeterSharedState=void 0;var jh0=j4(),hh0=jn(),_h0=M8(),xh0=on(),bh0=Ki(),uh0=Hi(),mh0=Ci(),gh0=Pi(),dh0=LV();class yi{constructor(X,Y){this._meterProviderSharedState=X,this._instrumentationScope=Y,this.metricStorageRegistry=new bh0.MetricStorageRegistry,this.observableRegistry=new mh0.ObservableRegistry,this.meter=new hh0.Meter(this)}registerMetricStorage(X){let Y=this._registerMetricStorage(X,gh0.SyncMetricStorage);if(Y.length===1)return Y[0];return new uh0.MultiMetricStorage(Y)}registerAsyncMetricStorage(X){return this._registerMetricStorage(X,xh0.AsyncMetricStorage)}async collect(X,Y,W){let z=await this.observableRegistry.observe(Y,W===null||W===void 0?void 0:W.timeoutMillis),F=this.metricStorageRegistry.getStorages(X);if(F.length===0)return null;let Q=F.map((J)=>{return J.collect(X,Y)}).filter(_h0.isNotNullish);if(Q.length===0)return{errors:z};return{scopeMetrics:{scope:this._instrumentationScope,metrics:Q},errors:z}}_registerMetricStorage(X,Y){let z=this._meterProviderSharedState.viewRegistry.findViews(X,this._instrumentationScope).map((F)=>{let Q=(0,jh0.createInstrumentDescriptorWithView)(F,X),J=this.metricStorageRegistry.findOrUpdateCompatibleStorage(Q);if(J!=null)return J;let Z=F.aggregation.createAggregator(Q),K=new Y(Q,Z,F.attributesProcessor,this._meterProviderSharedState.metricCollectors,F.aggregationCardinalityLimit);return this.metricStorageRegistry.register(K),K});if(z.length===0){let Q=this._meterProviderSharedState.selectAggregations(X.type).map(([J,Z])=>{let K=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(J,X);if(K!=null)return K;let H=Z.createAggregator(X),G=J.selectCardinalityLimit(X.type),q=new Y(X,H,dh0.AttributesProcessor.Noop(),[J],G);return this.metricStorageRegistry.registerForCollector(J,q),q});z=z.concat(Q)}return z}}ki.MeterSharedState=yi});var bi=X0((_i)=>{Object.defineProperty(_i,"__esModule",{value:!0});_i.MeterProviderSharedState=void 0;var ch0=M8(),lh0=Dn(),ph0=ji();class hi{constructor(X){this.resource=X,this.viewRegistry=new lh0.ViewRegistry,this.metricCollectors=[],this.meterSharedStates=new Map}getMeterSharedState(X){let Y=(0,ch0.instrumentationScopeId)(X),W=this.meterSharedStates.get(Y);if(W==null)W=new ph0.MeterSharedState(this,X),this.meterSharedStates.set(Y,W);return W}selectAggregations(X){let Y=[];for(let W of this.metricCollectors)Y.push([W,W.selectAggregation(X)]);return Y}}_i.MeterProviderSharedState=hi});var di=X0((mi)=>{Object.defineProperty(mi,"__esModule",{value:!0});mi.MetricCollector=void 0;var nh0=w4();class ui{constructor(X,Y){this._sharedState=X,this._metricReader=Y}async collect(X){let Y=(0,nh0.millisToHrTime)(Date.now()),W=[],z=[],F=Array.from(this._sharedState.meterSharedStates.values()).map(async(Q)=>{let J=await Q.collect(this,Y,X);if((J===null||J===void 0?void 0:J.scopeMetrics)!=null)W.push(J.scopeMetrics);if((J===null||J===void 0?void 0:J.errors)!=null)z.push(...J.errors)});return await Promise.all(F),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:W},errors:z}}async forceFlush(X){await this._metricReader.forceFlush(X)}async shutdown(X){await this._metricReader.shutdown(X)}selectAggregationTemporality(X){return this._metricReader.selectAggregationTemporality(X)}selectAggregation(X){return this._metricReader.selectAggregation(X)}selectCardinalityLimit(X){var Y,W,z;return(z=(W=(Y=this._metricReader).selectCardinalityLimit)===null||W===void 0?void 0:W.call(Y,X))!==null&&z!==void 0?z:2000}}mi.MetricCollector=ui});var ii=X0((pi)=>{Object.defineProperty(pi,"__esModule",{value:!0});pi.MeterProvider=void 0;var oW=q1(),ci=eH(),ih0=bi(),ah0=di();function rh0(X,Y){let W=Y!==null&&Y!==void 0?Y:ci.Resource.empty();if(X)return ci.Resource.default().merge(W);return W}class li{constructor(X){var Y;if(this._shutdown=!1,this._sharedState=new ih0.MeterProviderSharedState(rh0((Y=X===null||X===void 0?void 0:X.mergeResourceWithDefaults)!==null&&Y!==void 0?Y:!0,X===null||X===void 0?void 0:X.resource)),(X===null||X===void 0?void 0:X.views)!=null&&X.views.length>0)for(let W of X.views)this._sharedState.viewRegistry.addView(W);if((X===null||X===void 0?void 0:X.readers)!=null&&X.readers.length>0)for(let W of X.readers)this.addMetricReader(W)}getMeter(X,Y="",W={}){if(this._shutdown)return oW.diag.warn("A shutdown MeterProvider cannot provide a Meter"),(0,oW.createNoopMeter)();return this._sharedState.getMeterSharedState({name:X,version:Y,schemaUrl:W.schemaUrl}).meter}addMetricReader(X){let Y=new ah0.MetricCollector(this._sharedState,X);X.setMetricProducer(Y),this._sharedState.metricCollectors.push(Y)}async shutdown(X){if(this._shutdown){oW.diag.warn("shutdown may only be called once per MeterProvider");return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map((Y)=>{return Y.shutdown(X)}))}async forceFlush(X){if(this._shutdown){oW.diag.warn("invalid attempt to force flush after MeterProvider shutdown");return}await Promise.all(this._sharedState.metricCollectors.map((Y)=>{return Y.forceFlush(X)}))}}pi.MeterProvider=li});var tW=X0((ri)=>{Object.defineProperty(ri,"__esModule",{value:!0});ri.ExactPredicate=ri.PatternPredicate=void 0;var oh0=/[\^$\\.+?()[\]{}|]/g;class PV{constructor(X){if(X==="*")this._matchAll=!0,this._regexp=/.*/;else this._matchAll=!1,this._regexp=new RegExp(PV.escapePattern(X))}match(X){if(this._matchAll)return!0;return this._regexp.test(X)}static escapePattern(X){return`^${X.replace(oh0,"\\$&").replace("*",".*")}$`}static hasWildcard(X){return X.includes("*")}}ri.PatternPredicate=PV;class ai{constructor(X){this._matchAll=X===void 0,this._pattern=X}match(X){if(this._matchAll)return!0;if(X===this._pattern)return!0;return!1}}ri.ExactPredicate=ai});var Ya=X0((ei)=>{Object.defineProperty(ei,"__esModule",{value:!0});ei.InstrumentSelector=void 0;var ti=tW();class si{constructor(X){var Y;this._nameFilter=new ti.PatternPredicate((Y=X===null||X===void 0?void 0:X.name)!==null&&Y!==void 0?Y:"*"),this._type=X===null||X===void 0?void 0:X.type,this._unitFilter=new ti.ExactPredicate(X===null||X===void 0?void 0:X.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}}ei.InstrumentSelector=si});var Wa=X0((Qa)=>{Object.defineProperty(Qa,"__esModule",{value:!0});Qa.MeterSelector=void 0;var wV=tW();class Za{constructor(X){this._nameFilter=new wV.ExactPredicate(X===null||X===void 0?void 0:X.name),this._versionFilter=new wV.ExactPredicate(X===null||X===void 0?void 0:X.version),this._schemaUrlFilter=new wV.ExactPredicate(X===null||X===void 0?void 0:X.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}}Qa.MeterSelector=Za});var qa=X0((Fa)=>{Object.defineProperty(Fa,"__esModule",{value:!0});Fa.View=void 0;var sh0=tW(),Ga=LV(),eh0=Ya(),X_0=Wa(),Y_0=pW();function Z_0(X){return X.instrumentName==null&&X.instrumentType==null&&X.instrumentUnit==null&&X.meterName==null&&X.meterVersion==null&&X.meterSchemaUrl==null}class Ka{constructor(X){var Y;if(Z_0(X))throw Error("Cannot create view with no selector arguments supplied");if(X.name!=null&&((X===null||X===void 0?void 0:X.instrumentName)==null||sh0.PatternPredicate.hasWildcard(X.instrumentName)))throw Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.");if(X.attributeKeys!=null)this.attributesProcessor=new Ga.FilteringAttributesProcessor(X.attributeKeys);else this.attributesProcessor=Ga.AttributesProcessor.Noop();this.name=X.name,this.description=X.description,this.aggregation=(Y=X.aggregation)!==null&&Y!==void 0?Y:Y_0.Aggregation.Default(),this.instrumentSelector=new eh0.InstrumentSelector({name:X.instrumentName,type:X.instrumentType,unit:X.instrumentUnit}),this.meterSelector=new X_0.MeterSelector({name:X.meterName,version:X.meterVersion,schemaUrl:X.meterSchemaUrl}),this.aggregationCardinalityLimit=X.aggregationCardinalityLimit}}Fa.View=Ka});var Ha=X0((g6)=>{Object.defineProperty(g6,"__esModule",{value:!0});g6.TimeoutError=g6.View=g6.Aggregation=g6.SumAggregation=g6.LastValueAggregation=g6.HistogramAggregation=g6.DropAggregation=g6.ExponentialHistogramAggregation=g6.ExplicitBucketHistogramAggregation=g6.DefaultAggregation=g6.MeterProvider=g6.InstrumentType=g6.ConsoleMetricExporter=g6.InMemoryMetricExporter=g6.PeriodicExportingMetricReader=g6.MetricReader=g6.DataPointType=g6.AggregationTemporality=void 0;var Q_0=bW();Object.defineProperty(g6,"AggregationTemporality",{enumerable:!0,get:function(){return Q_0.AggregationTemporality}});var J_0=yX();Object.defineProperty(g6,"DataPointType",{enumerable:!0,get:function(){return J_0.DataPointType}});var W_0=AV();Object.defineProperty(g6,"MetricReader",{enumerable:!0,get:function(){return W_0.MetricReader}});var G_0=Fn();Object.defineProperty(g6,"PeriodicExportingMetricReader",{enumerable:!0,get:function(){return G_0.PeriodicExportingMetricReader}});var K_0=Bn();Object.defineProperty(g6,"InMemoryMetricExporter",{enumerable:!0,get:function(){return K_0.InMemoryMetricExporter}});var F_0=On();Object.defineProperty(g6,"ConsoleMetricExporter",{enumerable:!0,get:function(){return F_0.ConsoleMetricExporter}});var z_0=j4();Object.defineProperty(g6,"InstrumentType",{enumerable:!0,get:function(){return z_0.InstrumentType}});var q_0=ii();Object.defineProperty(g6,"MeterProvider",{enumerable:!0,get:function(){return q_0.MeterProvider}});var N5=pW();Object.defineProperty(g6,"DefaultAggregation",{enumerable:!0,get:function(){return N5.DefaultAggregation}});Object.defineProperty(g6,"ExplicitBucketHistogramAggregation",{enumerable:!0,get:function(){return N5.ExplicitBucketHistogramAggregation}});Object.defineProperty(g6,"ExponentialHistogramAggregation",{enumerable:!0,get:function(){return N5.ExponentialHistogramAggregation}});Object.defineProperty(g6,"DropAggregation",{enumerable:!0,get:function(){return N5.DropAggregation}});Object.defineProperty(g6,"HistogramAggregation",{enumerable:!0,get:function(){return N5.HistogramAggregation}});Object.defineProperty(g6,"LastValueAggregation",{enumerable:!0,get:function(){return N5.LastValueAggregation}});Object.defineProperty(g6,"SumAggregation",{enumerable:!0,get:function(){return N5.SumAggregation}});Object.defineProperty(g6,"Aggregation",{enumerable:!0,get:function(){return N5.Aggregation}});var H_0=qa();Object.defineProperty(g6,"View",{enumerable:!0,get:function(){return H_0.View}});var V_0=M8();Object.defineProperty(g6,"TimeoutError",{enumerable:!0,get:function(){return V_0.TimeoutError}})});var SV=X0((Va)=>{Object.defineProperty(Va,"__esModule",{value:!0});Va.createConstMap=void 0;function U_0(X){let Y={},W=X.length;for(let z=0;z<W;z++){let F=X[z];if(F)Y[String(F).toUpperCase().replace(/[-.]/g,"_")]=F}return Y}Va.createConstMap=U_0});var He=X0((Je)=>{Object.defineProperty(Je,"__esModule",{value:!0});Je.SEMATTRS_NET_HOST_CARRIER_ICC=Je.SEMATTRS_NET_HOST_CARRIER_MNC=Je.SEMATTRS_NET_HOST_CARRIER_MCC=Je.SEMATTRS_NET_HOST_CARRIER_NAME=Je.SEMATTRS_NET_HOST_CONNECTION_SUBTYPE=Je.SEMATTRS_NET_HOST_CONNECTION_TYPE=Je.SEMATTRS_NET_HOST_NAME=Je.SEMATTRS_NET_HOST_PORT=Je.SEMATTRS_NET_HOST_IP=Je.SEMATTRS_NET_PEER_NAME=Je.SEMATTRS_NET_PEER_PORT=Je.SEMATTRS_NET_PEER_IP=Je.SEMATTRS_NET_TRANSPORT=Je.SEMATTRS_FAAS_INVOKED_REGION=Je.SEMATTRS_FAAS_INVOKED_PROVIDER=Je.SEMATTRS_FAAS_INVOKED_NAME=Je.SEMATTRS_FAAS_COLDSTART=Je.SEMATTRS_FAAS_CRON=Je.SEMATTRS_FAAS_TIME=Je.SEMATTRS_FAAS_DOCUMENT_NAME=Je.SEMATTRS_FAAS_DOCUMENT_TIME=Je.SEMATTRS_FAAS_DOCUMENT_OPERATION=Je.SEMATTRS_FAAS_DOCUMENT_COLLECTION=Je.SEMATTRS_FAAS_EXECUTION=Je.SEMATTRS_FAAS_TRIGGER=Je.SEMATTRS_EXCEPTION_ESCAPED=Je.SEMATTRS_EXCEPTION_STACKTRACE=Je.SEMATTRS_EXCEPTION_MESSAGE=Je.SEMATTRS_EXCEPTION_TYPE=Je.SEMATTRS_DB_SQL_TABLE=Je.SEMATTRS_DB_MONGODB_COLLECTION=Je.SEMATTRS_DB_REDIS_DATABASE_INDEX=Je.SEMATTRS_DB_HBASE_NAMESPACE=Je.SEMATTRS_DB_CASSANDRA_COORDINATOR_DC=Je.SEMATTRS_DB_CASSANDRA_COORDINATOR_ID=Je.SEMATTRS_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT=Je.SEMATTRS_DB_CASSANDRA_IDEMPOTENCE=Je.SEMATTRS_DB_CASSANDRA_TABLE=Je.SEMATTRS_DB_CASSANDRA_CONSISTENCY_LEVEL=Je.SEMATTRS_DB_CASSANDRA_PAGE_SIZE=Je.SEMATTRS_DB_CASSANDRA_KEYSPACE=Je.SEMATTRS_DB_MSSQL_INSTANCE_NAME=Je.SEMATTRS_DB_OPERATION=Je.SEMATTRS_DB_STATEMENT=Je.SEMATTRS_DB_NAME=Je.SEMATTRS_DB_JDBC_DRIVER_CLASSNAME=Je.SEMATTRS_DB_USER=Je.SEMATTRS_DB_CONNECTION_STRING=Je.SEMATTRS_DB_SYSTEM=Je.SEMATTRS_AWS_LAMBDA_INVOKED_ARN=void 0;Je.SEMATTRS_MESSAGING_DESTINATION_KIND=Je.SEMATTRS_MESSAGING_DESTINATION=Je.SEMATTRS_MESSAGING_SYSTEM=Je.SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES=Je.SEMATTRS_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS=Je.SEMATTRS_AWS_DYNAMODB_SCANNED_COUNT=Je.SEMATTRS_AWS_DYNAMODB_COUNT=Je.SEMATTRS_AWS_DYNAMODB_TOTAL_SEGMENTS=Je.SEMATTRS_AWS_DYNAMODB_SEGMENT=Je.SEMATTRS_AWS_DYNAMODB_SCAN_FORWARD=Je.SEMATTRS_AWS_DYNAMODB_TABLE_COUNT=Je.SEMATTRS_AWS_DYNAMODB_EXCLUSIVE_START_TABLE=Je.SEMATTRS_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES=Je.SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES=Je.SEMATTRS_AWS_DYNAMODB_SELECT=Je.SEMATTRS_AWS_DYNAMODB_INDEX_NAME=Je.SEMATTRS_AWS_DYNAMODB_ATTRIBUTES_TO_GET=Je.SEMATTRS_AWS_DYNAMODB_LIMIT=Je.SEMATTRS_AWS_DYNAMODB_PROJECTION=Je.SEMATTRS_AWS_DYNAMODB_CONSISTENT_READ=Je.SEMATTRS_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY=Je.SEMATTRS_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY=Je.SEMATTRS_AWS_DYNAMODB_ITEM_COLLECTION_METRICS=Je.SEMATTRS_AWS_DYNAMODB_CONSUMED_CAPACITY=Je.SEMATTRS_AWS_DYNAMODB_TABLE_NAMES=Je.SEMATTRS_HTTP_CLIENT_IP=Je.SEMATTRS_HTTP_ROUTE=Je.SEMATTRS_HTTP_SERVER_NAME=Je.SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED=Je.SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH=Je.SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED=Je.SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH=Je.SEMATTRS_HTTP_USER_AGENT=Je.SEMATTRS_HTTP_FLAVOR=Je.SEMATTRS_HTTP_STATUS_CODE=Je.SEMATTRS_HTTP_SCHEME=Je.SEMATTRS_HTTP_HOST=Je.SEMATTRS_HTTP_TARGET=Je.SEMATTRS_HTTP_URL=Je.SEMATTRS_HTTP_METHOD=Je.SEMATTRS_CODE_LINENO=Je.SEMATTRS_CODE_FILEPATH=Je.SEMATTRS_CODE_NAMESPACE=Je.SEMATTRS_CODE_FUNCTION=Je.SEMATTRS_THREAD_NAME=Je.SEMATTRS_THREAD_ID=Je.SEMATTRS_ENDUSER_SCOPE=Je.SEMATTRS_ENDUSER_ROLE=Je.SEMATTRS_ENDUSER_ID=Je.SEMATTRS_PEER_SERVICE=void 0;Je.DBSYSTEMVALUES_FILEMAKER=Je.DBSYSTEMVALUES_DERBY=Je.DBSYSTEMVALUES_FIREBIRD=Je.DBSYSTEMVALUES_ADABAS=Je.DBSYSTEMVALUES_CACHE=Je.DBSYSTEMVALUES_EDB=Je.DBSYSTEMVALUES_FIRSTSQL=Je.DBSYSTEMVALUES_INGRES=Je.DBSYSTEMVALUES_HANADB=Je.DBSYSTEMVALUES_MAXDB=Je.DBSYSTEMVALUES_PROGRESS=Je.DBSYSTEMVALUES_HSQLDB=Je.DBSYSTEMVALUES_CLOUDSCAPE=Je.DBSYSTEMVALUES_HIVE=Je.DBSYSTEMVALUES_REDSHIFT=Je.DBSYSTEMVALUES_POSTGRESQL=Je.DBSYSTEMVALUES_DB2=Je.DBSYSTEMVALUES_ORACLE=Je.DBSYSTEMVALUES_MYSQL=Je.DBSYSTEMVALUES_MSSQL=Je.DBSYSTEMVALUES_OTHER_SQL=Je.SemanticAttributes=Je.SEMATTRS_MESSAGE_UNCOMPRESSED_SIZE=Je.SEMATTRS_MESSAGE_COMPRESSED_SIZE=Je.SEMATTRS_MESSAGE_ID=Je.SEMATTRS_MESSAGE_TYPE=Je.SEMATTRS_RPC_JSONRPC_ERROR_MESSAGE=Je.SEMATTRS_RPC_JSONRPC_ERROR_CODE=Je.SEMATTRS_RPC_JSONRPC_REQUEST_ID=Je.SEMATTRS_RPC_JSONRPC_VERSION=Je.SEMATTRS_RPC_GRPC_STATUS_CODE=Je.SEMATTRS_RPC_METHOD=Je.SEMATTRS_RPC_SERVICE=Je.SEMATTRS_RPC_SYSTEM=Je.SEMATTRS_MESSAGING_KAFKA_TOMBSTONE=Je.SEMATTRS_MESSAGING_KAFKA_PARTITION=Je.SEMATTRS_MESSAGING_KAFKA_CLIENT_ID=Je.SEMATTRS_MESSAGING_KAFKA_CONSUMER_GROUP=Je.SEMATTRS_MESSAGING_KAFKA_MESSAGE_KEY=Je.SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY=Je.SEMATTRS_MESSAGING_CONSUMER_ID=Je.SEMATTRS_MESSAGING_OPERATION=Je.SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES=Je.SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES=Je.SEMATTRS_MESSAGING_CONVERSATION_ID=Je.SEMATTRS_MESSAGING_MESSAGE_ID=Je.SEMATTRS_MESSAGING_URL=Je.SEMATTRS_MESSAGING_PROTOCOL_VERSION=Je.SEMATTRS_MESSAGING_PROTOCOL=Je.SEMATTRS_MESSAGING_TEMP_DESTINATION=void 0;Je.FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD=Je.FaasDocumentOperationValues=Je.FAASDOCUMENTOPERATIONVALUES_DELETE=Je.FAASDOCUMENTOPERATIONVALUES_EDIT=Je.FAASDOCUMENTOPERATIONVALUES_INSERT=Je.FaasTriggerValues=Je.FAASTRIGGERVALUES_OTHER=Je.FAASTRIGGERVALUES_TIMER=Je.FAASTRIGGERVALUES_PUBSUB=Je.FAASTRIGGERVALUES_HTTP=Je.FAASTRIGGERVALUES_DATASOURCE=Je.DbCassandraConsistencyLevelValues=Je.DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL=Je.DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL=Je.DBCASSANDRACONSISTENCYLEVELVALUES_ANY=Je.DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE=Je.DBCASSANDRACONSISTENCYLEVELVALUES_THREE=Je.DBCASSANDRACONSISTENCYLEVELVALUES_TWO=Je.DBCASSANDRACONSISTENCYLEVELVALUES_ONE=Je.DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM=Je.DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM=Je.DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM=Je.DBCASSANDRACONSISTENCYLEVELVALUES_ALL=Je.DbSystemValues=Je.DBSYSTEMVALUES_COCKROACHDB=Je.DBSYSTEMVALUES_MEMCACHED=Je.DBSYSTEMVALUES_ELASTICSEARCH=Je.DBSYSTEMVALUES_GEODE=Je.DBSYSTEMVALUES_NEO4J=Je.DBSYSTEMVALUES_DYNAMODB=Je.DBSYSTEMVALUES_COSMOSDB=Je.DBSYSTEMVALUES_COUCHDB=Je.DBSYSTEMVALUES_COUCHBASE=Je.DBSYSTEMVALUES_REDIS=Je.DBSYSTEMVALUES_MONGODB=Je.DBSYSTEMVALUES_HBASE=Je.DBSYSTEMVALUES_CASSANDRA=Je.DBSYSTEMVALUES_COLDFUSION=Je.DBSYSTEMVALUES_H2=Je.DBSYSTEMVALUES_VERTICA=Je.DBSYSTEMVALUES_TERADATA=Je.DBSYSTEMVALUES_SYBASE=Je.DBSYSTEMVALUES_SQLITE=Je.DBSYSTEMVALUES_POINTBASE=Je.DBSYSTEMVALUES_PERVASIVE=Je.DBSYSTEMVALUES_NETEZZA=Je.DBSYSTEMVALUES_MARIADB=Je.DBSYSTEMVALUES_INTERBASE=Je.DBSYSTEMVALUES_INSTANTDB=Je.DBSYSTEMVALUES_INFORMIX=void 0;Je.MESSAGINGOPERATIONVALUES_RECEIVE=Je.MessagingDestinationKindValues=Je.MESSAGINGDESTINATIONKINDVALUES_TOPIC=Je.MESSAGINGDESTINATIONKINDVALUES_QUEUE=Je.HttpFlavorValues=Je.HTTPFLAVORVALUES_QUIC=Je.HTTPFLAVORVALUES_SPDY=Je.HTTPFLAVORVALUES_HTTP_2_0=Je.HTTPFLAVORVALUES_HTTP_1_1=Je.HTTPFLAVORVALUES_HTTP_1_0=Je.NetHostConnectionSubtypeValues=Je.NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA=Je.NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA=Je.NETHOSTCONNECTIONSUBTYPEVALUES_NR=Je.NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN=Je.NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA=Je.NETHOSTCONNECTIONSUBTYPEVALUES_GSM=Je.NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP=Je.NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD=Je.NETHOSTCONNECTIONSUBTYPEVALUES_LTE=Je.NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B=Je.NETHOSTCONNECTIONSUBTYPEVALUES_IDEN=Je.NETHOSTCONNECTIONSUBTYPEVALUES_HSPA=Je.NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA=Je.NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA=Je.NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT=Je.NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A=Je.NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0=Je.NETHOSTCONNECTIONSUBTYPEVALUES_CDMA=Je.NETHOSTCONNECTIONSUBTYPEVALUES_UMTS=Je.NETHOSTCONNECTIONSUBTYPEVALUES_EDGE=Je.NETHOSTCONNECTIONSUBTYPEVALUES_GPRS=Je.NetHostConnectionTypeValues=Je.NETHOSTCONNECTIONTYPEVALUES_UNKNOWN=Je.NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE=Je.NETHOSTCONNECTIONTYPEVALUES_CELL=Je.NETHOSTCONNECTIONTYPEVALUES_WIRED=Je.NETHOSTCONNECTIONTYPEVALUES_WIFI=Je.NetTransportValues=Je.NETTRANSPORTVALUES_OTHER=Je.NETTRANSPORTVALUES_INPROC=Je.NETTRANSPORTVALUES_PIPE=Je.NETTRANSPORTVALUES_UNIX=Je.NETTRANSPORTVALUES_IP=Je.NETTRANSPORTVALUES_IP_UDP=Je.NETTRANSPORTVALUES_IP_TCP=Je.FaasInvokedProviderValues=Je.FAASINVOKEDPROVIDERVALUES_GCP=Je.FAASINVOKEDPROVIDERVALUES_AZURE=Je.FAASINVOKEDPROVIDERVALUES_AWS=void 0;Je.MessageTypeValues=Je.MESSAGETYPEVALUES_RECEIVED=Je.MESSAGETYPEVALUES_SENT=Je.RpcGrpcStatusCodeValues=Je.RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED=Je.RPCGRPCSTATUSCODEVALUES_DATA_LOSS=Je.RPCGRPCSTATUSCODEVALUES_UNAVAILABLE=Je.RPCGRPCSTATUSCODEVALUES_INTERNAL=Je.RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED=Je.RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE=Je.RPCGRPCSTATUSCODEVALUES_ABORTED=Je.RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION=Je.RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED=Je.RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED=Je.RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS=Je.RPCGRPCSTATUSCODEVALUES_NOT_FOUND=Je.RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED=Je.RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT=Je.RPCGRPCSTATUSCODEVALUES_UNKNOWN=Je.RPCGRPCSTATUSCODEVALUES_CANCELLED=Je.RPCGRPCSTATUSCODEVALUES_OK=Je.MessagingOperationValues=Je.MESSAGINGOPERATIONVALUES_PROCESS=void 0;var Q8=SV(),Ua="aws.lambda.invoked_arn",Na="db.system",Aa="db.connection_string",Oa="db.user",Ta="db.jdbc.driver_classname",Ia="db.name",$a="db.statement",Da="db.operation",Ea="db.mssql.instance_name",Ca="db.cassandra.keyspace",Ra="db.cassandra.page_size",Ma="db.cassandra.consistency_level",La="db.cassandra.table",Pa="db.cassandra.idempotence",wa="db.cassandra.speculative_execution_count",Sa="db.cassandra.coordinator.id",fa="db.cassandra.coordinator.dc",ya="db.hbase.namespace",ka="db.redis.database_index",va="db.mongodb.collection",ja="db.sql.table",ha="exception.type",_a="exception.message",xa="exception.stacktrace",ba="exception.escaped",ua="faas.trigger",ma="faas.execution",ga="faas.document.collection",da="faas.document.operation",ca="faas.document.time",la="faas.document.name",pa="faas.time",na="faas.cron",ia="faas.coldstart",aa="faas.invoked_name",ra="faas.invoked_provider",oa="faas.invoked_region",ta="net.transport",sa="net.peer.ip",ea="net.peer.port",Xr="net.peer.name",Yr="net.host.ip",Zr="net.host.port",Qr="net.host.name",Jr="net.host.connection.type",Wr="net.host.connection.subtype",Gr="net.host.carrier.name",Kr="net.host.carrier.mcc",Fr="net.host.carrier.mnc",zr="net.host.carrier.icc",qr="peer.service",Hr="enduser.id",Vr="enduser.role",Br="enduser.scope",Ur="thread.id",Nr="thread.name",Ar="code.function",Or="code.namespace",Tr="code.filepath",Ir="code.lineno",$r="http.method",Dr="http.url",Er="http.target",Cr="http.host",Rr="http.scheme",Mr="http.status_code",Lr="http.flavor",Pr="http.user_agent",wr="http.request_content_length",Sr="http.request_content_length_uncompressed",fr="http.response_content_length",yr="http.response_content_length_uncompressed",kr="http.server_name",vr="http.route",jr="http.client_ip",hr="aws.dynamodb.table_names",_r="aws.dynamodb.consumed_capacity",xr="aws.dynamodb.item_collection_metrics",br="aws.dynamodb.provisioned_read_capacity",ur="aws.dynamodb.provisioned_write_capacity",mr="aws.dynamodb.consistent_read",gr="aws.dynamodb.projection",dr="aws.dynamodb.limit",cr="aws.dynamodb.attributes_to_get",lr="aws.dynamodb.index_name",pr="aws.dynamodb.select",nr="aws.dynamodb.global_secondary_indexes",ir="aws.dynamodb.local_secondary_indexes",ar="aws.dynamodb.exclusive_start_table",rr="aws.dynamodb.table_count",or="aws.dynamodb.scan_forward",tr="aws.dynamodb.segment",sr="aws.dynamodb.total_segments",er="aws.dynamodb.count",Xo="aws.dynamodb.scanned_count",Yo="aws.dynamodb.attribute_definitions",Zo="aws.dynamodb.global_secondary_index_updates",Qo="messaging.system",Jo="messaging.destination",Wo="messaging.destination_kind",Go="messaging.temp_destination",Ko="messaging.protocol",Fo="messaging.protocol_version",zo="messaging.url",qo="messaging.message_id",Ho="messaging.conversation_id",Vo="messaging.message_payload_size_bytes",Bo="messaging.message_payload_compressed_size_bytes",Uo="messaging.operation",No="messaging.consumer_id",Ao="messaging.rabbitmq.routing_key",Oo="messaging.kafka.message_key",To="messaging.kafka.consumer_group",Io="messaging.kafka.client_id",$o="messaging.kafka.partition",Do="messaging.kafka.tombstone",Eo="rpc.system",Co="rpc.service",Ro="rpc.method",Mo="rpc.grpc.status_code",Lo="rpc.jsonrpc.version",Po="rpc.jsonrpc.request_id",wo="rpc.jsonrpc.error_code",So="rpc.jsonrpc.error_message",fo="message.type",yo="message.id",ko="message.compressed_size",vo="message.uncompressed_size";Je.SEMATTRS_AWS_LAMBDA_INVOKED_ARN=Ua;Je.SEMATTRS_DB_SYSTEM=Na;Je.SEMATTRS_DB_CONNECTION_STRING=Aa;Je.SEMATTRS_DB_USER=Oa;Je.SEMATTRS_DB_JDBC_DRIVER_CLASSNAME=Ta;Je.SEMATTRS_DB_NAME=Ia;Je.SEMATTRS_DB_STATEMENT=$a;Je.SEMATTRS_DB_OPERATION=Da;Je.SEMATTRS_DB_MSSQL_INSTANCE_NAME=Ea;Je.SEMATTRS_DB_CASSANDRA_KEYSPACE=Ca;Je.SEMATTRS_DB_CASSANDRA_PAGE_SIZE=Ra;Je.SEMATTRS_DB_CASSANDRA_CONSISTENCY_LEVEL=Ma;Je.SEMATTRS_DB_CASSANDRA_TABLE=La;Je.SEMATTRS_DB_CASSANDRA_IDEMPOTENCE=Pa;Je.SEMATTRS_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT=wa;Je.SEMATTRS_DB_CASSANDRA_COORDINATOR_ID=Sa;Je.SEMATTRS_DB_CASSANDRA_COORDINATOR_DC=fa;Je.SEMATTRS_DB_HBASE_NAMESPACE=ya;Je.SEMATTRS_DB_REDIS_DATABASE_INDEX=ka;Je.SEMATTRS_DB_MONGODB_COLLECTION=va;Je.SEMATTRS_DB_SQL_TABLE=ja;Je.SEMATTRS_EXCEPTION_TYPE=ha;Je.SEMATTRS_EXCEPTION_MESSAGE=_a;Je.SEMATTRS_EXCEPTION_STACKTRACE=xa;Je.SEMATTRS_EXCEPTION_ESCAPED=ba;Je.SEMATTRS_FAAS_TRIGGER=ua;Je.SEMATTRS_FAAS_EXECUTION=ma;Je.SEMATTRS_FAAS_DOCUMENT_COLLECTION=ga;Je.SEMATTRS_FAAS_DOCUMENT_OPERATION=da;Je.SEMATTRS_FAAS_DOCUMENT_TIME=ca;Je.SEMATTRS_FAAS_DOCUMENT_NAME=la;Je.SEMATTRS_FAAS_TIME=pa;Je.SEMATTRS_FAAS_CRON=na;Je.SEMATTRS_FAAS_COLDSTART=ia;Je.SEMATTRS_FAAS_INVOKED_NAME=aa;Je.SEMATTRS_FAAS_INVOKED_PROVIDER=ra;Je.SEMATTRS_FAAS_INVOKED_REGION=oa;Je.SEMATTRS_NET_TRANSPORT=ta;Je.SEMATTRS_NET_PEER_IP=sa;Je.SEMATTRS_NET_PEER_PORT=ea;Je.SEMATTRS_NET_PEER_NAME=Xr;Je.SEMATTRS_NET_HOST_IP=Yr;Je.SEMATTRS_NET_HOST_PORT=Zr;Je.SEMATTRS_NET_HOST_NAME=Qr;Je.SEMATTRS_NET_HOST_CONNECTION_TYPE=Jr;Je.SEMATTRS_NET_HOST_CONNECTION_SUBTYPE=Wr;Je.SEMATTRS_NET_HOST_CARRIER_NAME=Gr;Je.SEMATTRS_NET_HOST_CARRIER_MCC=Kr;Je.SEMATTRS_NET_HOST_CARRIER_MNC=Fr;Je.SEMATTRS_NET_HOST_CARRIER_ICC=zr;Je.SEMATTRS_PEER_SERVICE=qr;Je.SEMATTRS_ENDUSER_ID=Hr;Je.SEMATTRS_ENDUSER_ROLE=Vr;Je.SEMATTRS_ENDUSER_SCOPE=Br;Je.SEMATTRS_THREAD_ID=Ur;Je.SEMATTRS_THREAD_NAME=Nr;Je.SEMATTRS_CODE_FUNCTION=Ar;Je.SEMATTRS_CODE_NAMESPACE=Or;Je.SEMATTRS_CODE_FILEPATH=Tr;Je.SEMATTRS_CODE_LINENO=Ir;Je.SEMATTRS_HTTP_METHOD=$r;Je.SEMATTRS_HTTP_URL=Dr;Je.SEMATTRS_HTTP_TARGET=Er;Je.SEMATTRS_HTTP_HOST=Cr;Je.SEMATTRS_HTTP_SCHEME=Rr;Je.SEMATTRS_HTTP_STATUS_CODE=Mr;Je.SEMATTRS_HTTP_FLAVOR=Lr;Je.SEMATTRS_HTTP_USER_AGENT=Pr;Je.SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH=wr;Je.SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED=Sr;Je.SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH=fr;Je.SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED=yr;Je.SEMATTRS_HTTP_SERVER_NAME=kr;Je.SEMATTRS_HTTP_ROUTE=vr;Je.SEMATTRS_HTTP_CLIENT_IP=jr;Je.SEMATTRS_AWS_DYNAMODB_TABLE_NAMES=hr;Je.SEMATTRS_AWS_DYNAMODB_CONSUMED_CAPACITY=_r;Je.SEMATTRS_AWS_DYNAMODB_ITEM_COLLECTION_METRICS=xr;Je.SEMATTRS_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY=br;Je.SEMATTRS_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY=ur;Je.SEMATTRS_AWS_DYNAMODB_CONSISTENT_READ=mr;Je.SEMATTRS_AWS_DYNAMODB_PROJECTION=gr;Je.SEMATTRS_AWS_DYNAMODB_LIMIT=dr;Je.SEMATTRS_AWS_DYNAMODB_ATTRIBUTES_TO_GET=cr;Je.SEMATTRS_AWS_DYNAMODB_INDEX_NAME=lr;Je.SEMATTRS_AWS_DYNAMODB_SELECT=pr;Je.SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES=nr;Je.SEMATTRS_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES=ir;Je.SEMATTRS_AWS_DYNAMODB_EXCLUSIVE_START_TABLE=ar;Je.SEMATTRS_AWS_DYNAMODB_TABLE_COUNT=rr;Je.SEMATTRS_AWS_DYNAMODB_SCAN_FORWARD=or;Je.SEMATTRS_AWS_DYNAMODB_SEGMENT=tr;Je.SEMATTRS_AWS_DYNAMODB_TOTAL_SEGMENTS=sr;Je.SEMATTRS_AWS_DYNAMODB_COUNT=er;Je.SEMATTRS_AWS_DYNAMODB_SCANNED_COUNT=Xo;Je.SEMATTRS_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS=Yo;Je.SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES=Zo;Je.SEMATTRS_MESSAGING_SYSTEM=Qo;Je.SEMATTRS_MESSAGING_DESTINATION=Jo;Je.SEMATTRS_MESSAGING_DESTINATION_KIND=Wo;Je.SEMATTRS_MESSAGING_TEMP_DESTINATION=Go;Je.SEMATTRS_MESSAGING_PROTOCOL=Ko;Je.SEMATTRS_MESSAGING_PROTOCOL_VERSION=Fo;Je.SEMATTRS_MESSAGING_URL=zo;Je.SEMATTRS_MESSAGING_MESSAGE_ID=qo;Je.SEMATTRS_MESSAGING_CONVERSATION_ID=Ho;Je.SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES=Vo;Je.SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES=Bo;Je.SEMATTRS_MESSAGING_OPERATION=Uo;Je.SEMATTRS_MESSAGING_CONSUMER_ID=No;Je.SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY=Ao;Je.SEMATTRS_MESSAGING_KAFKA_MESSAGE_KEY=Oo;Je.SEMATTRS_MESSAGING_KAFKA_CONSUMER_GROUP=To;Je.SEMATTRS_MESSAGING_KAFKA_CLIENT_ID=Io;Je.SEMATTRS_MESSAGING_KAFKA_PARTITION=$o;Je.SEMATTRS_MESSAGING_KAFKA_TOMBSTONE=Do;Je.SEMATTRS_RPC_SYSTEM=Eo;Je.SEMATTRS_RPC_SERVICE=Co;Je.SEMATTRS_RPC_METHOD=Ro;Je.SEMATTRS_RPC_GRPC_STATUS_CODE=Mo;Je.SEMATTRS_RPC_JSONRPC_VERSION=Lo;Je.SEMATTRS_RPC_JSONRPC_REQUEST_ID=Po;Je.SEMATTRS_RPC_JSONRPC_ERROR_CODE=wo;Je.SEMATTRS_RPC_JSONRPC_ERROR_MESSAGE=So;Je.SEMATTRS_MESSAGE_TYPE=fo;Je.SEMATTRS_MESSAGE_ID=yo;Je.SEMATTRS_MESSAGE_COMPRESSED_SIZE=ko;Je.SEMATTRS_MESSAGE_UNCOMPRESSED_SIZE=vo;Je.SemanticAttributes=(0,Q8.createConstMap)([Ua,Na,Aa,Oa,Ta,Ia,$a,Da,Ea,Ca,Ra,Ma,La,Pa,wa,Sa,fa,ya,ka,va,ja,ha,_a,xa,ba,ua,ma,ga,da,ca,la,pa,na,ia,aa,ra,oa,ta,sa,ea,Xr,Yr,Zr,Qr,Jr,Wr,Gr,Kr,Fr,zr,qr,Hr,Vr,Br,Ur,Nr,Ar,Or,Tr,Ir,$r,Dr,Er,Cr,Rr,Mr,Lr,Pr,wr,Sr,fr,yr,kr,vr,jr,hr,_r,xr,br,ur,mr,gr,dr,cr,lr,pr,nr,ir,ar,rr,or,tr,sr,er,Xo,Yo,Zo,Qo,Jo,Wo,Go,Ko,Fo,zo,qo,Ho,Vo,Bo,Uo,No,Ao,Oo,To,Io,$o,Do,Eo,Co,Ro,Mo,Lo,Po,wo,So,fo,yo,ko,vo]);var jo="other_sql",ho="mssql",_o="mysql",xo="oracle",bo="db2",uo="postgresql",mo="redshift",go="hive",co="cloudscape",lo="hsqldb",po="progress",no="maxdb",io="hanadb",ao="ingres",ro="firstsql",oo="edb",to="cache",so="adabas",eo="firebird",Xt="derby",Yt="filemaker",Zt="informix",Qt="instantdb",Jt="interbase",Wt="mariadb",Gt="netezza",Kt="pervasive",Ft="pointbase",zt="sqlite",qt="sybase",Ht="teradata",Vt="vertica",Bt="h2",Ut="coldfusion",Nt="cassandra",At="hbase",Ot="mongodb",Tt="redis",It="couchbase",$t="couchdb",Dt="cosmosdb",Et="dynamodb",Ct="neo4j",Rt="geode",Mt="elasticsearch",Lt="memcached",Pt="cockroachdb";Je.DBSYSTEMVALUES_OTHER_SQL=jo;Je.DBSYSTEMVALUES_MSSQL=ho;Je.DBSYSTEMVALUES_MYSQL=_o;Je.DBSYSTEMVALUES_ORACLE=xo;Je.DBSYSTEMVALUES_DB2=bo;Je.DBSYSTEMVALUES_POSTGRESQL=uo;Je.DBSYSTEMVALUES_REDSHIFT=mo;Je.DBSYSTEMVALUES_HIVE=go;Je.DBSYSTEMVALUES_CLOUDSCAPE=co;Je.DBSYSTEMVALUES_HSQLDB=lo;Je.DBSYSTEMVALUES_PROGRESS=po;Je.DBSYSTEMVALUES_MAXDB=no;Je.DBSYSTEMVALUES_HANADB=io;Je.DBSYSTEMVALUES_INGRES=ao;Je.DBSYSTEMVALUES_FIRSTSQL=ro;Je.DBSYSTEMVALUES_EDB=oo;Je.DBSYSTEMVALUES_CACHE=to;Je.DBSYSTEMVALUES_ADABAS=so;Je.DBSYSTEMVALUES_FIREBIRD=eo;Je.DBSYSTEMVALUES_DERBY=Xt;Je.DBSYSTEMVALUES_FILEMAKER=Yt;Je.DBSYSTEMVALUES_INFORMIX=Zt;Je.DBSYSTEMVALUES_INSTANTDB=Qt;Je.DBSYSTEMVALUES_INTERBASE=Jt;Je.DBSYSTEMVALUES_MARIADB=Wt;Je.DBSYSTEMVALUES_NETEZZA=Gt;Je.DBSYSTEMVALUES_PERVASIVE=Kt;Je.DBSYSTEMVALUES_POINTBASE=Ft;Je.DBSYSTEMVALUES_SQLITE=zt;Je.DBSYSTEMVALUES_SYBASE=qt;Je.DBSYSTEMVALUES_TERADATA=Ht;Je.DBSYSTEMVALUES_VERTICA=Vt;Je.DBSYSTEMVALUES_H2=Bt;Je.DBSYSTEMVALUES_COLDFUSION=Ut;Je.DBSYSTEMVALUES_CASSANDRA=Nt;Je.DBSYSTEMVALUES_HBASE=At;Je.DBSYSTEMVALUES_MONGODB=Ot;Je.DBSYSTEMVALUES_REDIS=Tt;Je.DBSYSTEMVALUES_COUCHBASE=It;Je.DBSYSTEMVALUES_COUCHDB=$t;Je.DBSYSTEMVALUES_COSMOSDB=Dt;Je.DBSYSTEMVALUES_DYNAMODB=Et;Je.DBSYSTEMVALUES_NEO4J=Ct;Je.DBSYSTEMVALUES_GEODE=Rt;Je.DBSYSTEMVALUES_ELASTICSEARCH=Mt;Je.DBSYSTEMVALUES_MEMCACHED=Lt;Je.DBSYSTEMVALUES_COCKROACHDB=Pt;Je.DbSystemValues=(0,Q8.createConstMap)([jo,ho,_o,xo,bo,uo,mo,go,co,lo,po,no,io,ao,ro,oo,to,so,eo,Xt,Yt,Zt,Qt,Jt,Wt,Gt,Kt,Ft,zt,qt,Ht,Vt,Bt,Ut,Nt,At,Ot,Tt,It,$t,Dt,Et,Ct,Rt,Mt,Lt,Pt]);var wt="all",St="each_quorum",ft="quorum",yt="local_quorum",kt="one",vt="two",jt="three",ht="local_one",_t="any",xt="serial",bt="local_serial";Je.DBCASSANDRACONSISTENCYLEVELVALUES_ALL=wt;Je.DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM=St;Je.DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM=ft;Je.DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM=yt;Je.DBCASSANDRACONSISTENCYLEVELVALUES_ONE=kt;Je.DBCASSANDRACONSISTENCYLEVELVALUES_TWO=vt;Je.DBCASSANDRACONSISTENCYLEVELVALUES_THREE=jt;Je.DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE=ht;Je.DBCASSANDRACONSISTENCYLEVELVALUES_ANY=_t;Je.DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL=xt;Je.DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL=bt;Je.DbCassandraConsistencyLevelValues=(0,Q8.createConstMap)([wt,St,ft,yt,kt,vt,jt,ht,_t,xt,bt]);var ut="datasource",mt="http",gt="pubsub",dt="timer",ct="other";Je.FAASTRIGGERVALUES_DATASOURCE=ut;Je.FAASTRIGGERVALUES_HTTP=mt;Je.FAASTRIGGERVALUES_PUBSUB=gt;Je.FAASTRIGGERVALUES_TIMER=dt;Je.FAASTRIGGERVALUES_OTHER=ct;Je.FaasTriggerValues=(0,Q8.createConstMap)([ut,mt,gt,dt,ct]);var lt="insert",pt="edit",nt="delete";Je.FAASDOCUMENTOPERATIONVALUES_INSERT=lt;Je.FAASDOCUMENTOPERATIONVALUES_EDIT=pt;Je.FAASDOCUMENTOPERATIONVALUES_DELETE=nt;Je.FaasDocumentOperationValues=(0,Q8.createConstMap)([lt,pt,nt]);var it="alibaba_cloud",at="aws",rt="azure",ot="gcp";Je.FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD=it;Je.FAASINVOKEDPROVIDERVALUES_AWS=at;Je.FAASINVOKEDPROVIDERVALUES_AZURE=rt;Je.FAASINVOKEDPROVIDERVALUES_GCP=ot;Je.FaasInvokedProviderValues=(0,Q8.createConstMap)([it,at,rt,ot]);var tt="ip_tcp",st="ip_udp",et="ip",Xs="unix",Ys="pipe",Zs="inproc",Qs="other";Je.NETTRANSPORTVALUES_IP_TCP=tt;Je.NETTRANSPORTVALUES_IP_UDP=st;Je.NETTRANSPORTVALUES_IP=et;Je.NETTRANSPORTVALUES_UNIX=Xs;Je.NETTRANSPORTVALUES_PIPE=Ys;Je.NETTRANSPORTVALUES_INPROC=Zs;Je.NETTRANSPORTVALUES_OTHER=Qs;Je.NetTransportValues=(0,Q8.createConstMap)([tt,st,et,Xs,Ys,Zs,Qs]);var Js="wifi",Ws="wired",Gs="cell",Ks="unavailable",Fs="unknown";Je.NETHOSTCONNECTIONTYPEVALUES_WIFI=Js;Je.NETHOSTCONNECTIONTYPEVALUES_WIRED=Ws;Je.NETHOSTCONNECTIONTYPEVALUES_CELL=Gs;Je.NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE=Ks;Je.NETHOSTCONNECTIONTYPEVALUES_UNKNOWN=Fs;Je.NetHostConnectionTypeValues=(0,Q8.createConstMap)([Js,Ws,Gs,Ks,Fs]);var zs="gprs",qs="edge",Hs="umts",Vs="cdma",Bs="evdo_0",Us="evdo_a",Ns="cdma2000_1xrtt",As="hsdpa",Os="hsupa",Ts="hspa",Is="iden",$s="evdo_b",Ds="lte",Es="ehrpd",Cs="hspap",Rs="gsm",Ms="td_scdma",Ls="iwlan",Ps="nr",ws="nrnsa",Ss="lte_ca";Je.NETHOSTCONNECTIONSUBTYPEVALUES_GPRS=zs;Je.NETHOSTCONNECTIONSUBTYPEVALUES_EDGE=qs;Je.NETHOSTCONNECTIONSUBTYPEVALUES_UMTS=Hs;Je.NETHOSTCONNECTIONSUBTYPEVALUES_CDMA=Vs;Je.NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0=Bs;Je.NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A=Us;Je.NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT=Ns;Je.NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA=As;Je.NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA=Os;Je.NETHOSTCONNECTIONSUBTYPEVALUES_HSPA=Ts;Je.NETHOSTCONNECTIONSUBTYPEVALUES_IDEN=Is;Je.NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B=$s;Je.NETHOSTCONNECTIONSUBTYPEVALUES_LTE=Ds;Je.NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD=Es;Je.NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP=Cs;Je.NETHOSTCONNECTIONSUBTYPEVALUES_GSM=Rs;Je.NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA=Ms;Je.NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN=Ls;Je.NETHOSTCONNECTIONSUBTYPEVALUES_NR=Ps;Je.NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA=ws;Je.NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA=Ss;Je.NetHostConnectionSubtypeValues=(0,Q8.createConstMap)([zs,qs,Hs,Vs,Bs,Us,Ns,As,Os,Ts,Is,$s,Ds,Es,Cs,Rs,Ms,Ls,Ps,ws,Ss]);var fs="1.0",ys="1.1",ks="2.0",vs="SPDY",js="QUIC";Je.HTTPFLAVORVALUES_HTTP_1_0=fs;Je.HTTPFLAVORVALUES_HTTP_1_1=ys;Je.HTTPFLAVORVALUES_HTTP_2_0=ks;Je.HTTPFLAVORVALUES_SPDY=vs;Je.HTTPFLAVORVALUES_QUIC=js;Je.HttpFlavorValues={HTTP_1_0:fs,HTTP_1_1:ys,HTTP_2_0:ks,SPDY:vs,QUIC:js};var hs="queue",_s="topic";Je.MESSAGINGDESTINATIONKINDVALUES_QUEUE=hs;Je.MESSAGINGDESTINATIONKINDVALUES_TOPIC=_s;Je.MessagingDestinationKindValues=(0,Q8.createConstMap)([hs,_s]);var xs="receive",bs="process";Je.MESSAGINGOPERATIONVALUES_RECEIVE=xs;Je.MESSAGINGOPERATIONVALUES_PROCESS=bs;Je.MessagingOperationValues=(0,Q8.createConstMap)([xs,bs]);var us=0,ms=1,gs=2,ds=3,cs=4,ls=5,ps=6,ns=7,is=8,as=9,rs=10,os=11,ts=12,ss=13,es=14,Xe=15,Ye=16;Je.RPCGRPCSTATUSCODEVALUES_OK=us;Je.RPCGRPCSTATUSCODEVALUES_CANCELLED=ms;Je.RPCGRPCSTATUSCODEVALUES_UNKNOWN=gs;Je.RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT=ds;Je.RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED=cs;Je.RPCGRPCSTATUSCODEVALUES_NOT_FOUND=ls;Je.RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS=ps;Je.RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED=ns;Je.RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED=is;Je.RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION=as;Je.RPCGRPCSTATUSCODEVALUES_ABORTED=rs;Je.RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE=os;Je.RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED=ts;Je.RPCGRPCSTATUSCODEVALUES_INTERNAL=ss;Je.RPCGRPCSTATUSCODEVALUES_UNAVAILABLE=es;Je.RPCGRPCSTATUSCODEVALUES_DATA_LOSS=Xe;Je.RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED=Ye;Je.RpcGrpcStatusCodeValues={OK:us,CANCELLED:ms,UNKNOWN:gs,INVALID_ARGUMENT:ds,DEADLINE_EXCEEDED:cs,NOT_FOUND:ls,ALREADY_EXISTS:ps,PERMISSION_DENIED:ns,RESOURCE_EXHAUSTED:is,FAILED_PRECONDITION:as,ABORTED:rs,OUT_OF_RANGE:os,UNIMPLEMENTED:ts,INTERNAL:ss,UNAVAILABLE:es,DATA_LOSS:Xe,UNAUTHENTICATED:Ye};var Ze="SENT",Qe="RECEIVED";Je.MESSAGETYPEVALUES_SENT=Ze;Je.MESSAGETYPEVALUES_RECEIVED=Qe;Je.MessageTypeValues=(0,Q8.createConstMap)([Ze,Qe])});var Ve=X0((A7)=>{var Vg0=A7&&A7.__createBinding||(Object.create?function(X,Y,W,z){if(z===void 0)z=W;var F=Object.getOwnPropertyDescriptor(Y,W);if(!F||("get"in F?!Y.__esModule:F.writable||F.configurable))F={enumerable:!0,get:function(){return Y[W]}};Object.defineProperty(X,z,F)}:function(X,Y,W,z){if(z===void 0)z=W;X[z]=Y[W]}),Bg0=A7&&A7.__exportStar||function(X,Y){for(var W in X)if(W!=="default"&&!Object.prototype.hasOwnProperty.call(Y,W))Vg0(Y,X,W)};Object.defineProperty(A7,"__esModule",{value:!0});Bg0(He(),A7)});var g10=X0((x10)=>{Object.defineProperty(x10,"__esModule",{value:!0});x10.SEMRESATTRS_K8S_STATEFULSET_NAME=x10.SEMRESATTRS_K8S_STATEFULSET_UID=x10.SEMRESATTRS_K8S_DEPLOYMENT_NAME=x10.SEMRESATTRS_K8S_DEPLOYMENT_UID=x10.SEMRESATTRS_K8S_REPLICASET_NAME=x10.SEMRESATTRS_K8S_REPLICASET_UID=x10.SEMRESATTRS_K8S_CONTAINER_NAME=x10.SEMRESATTRS_K8S_POD_NAME=x10.SEMRESATTRS_K8S_POD_UID=x10.SEMRESATTRS_K8S_NAMESPACE_NAME=x10.SEMRESATTRS_K8S_NODE_UID=x10.SEMRESATTRS_K8S_NODE_NAME=x10.SEMRESATTRS_K8S_CLUSTER_NAME=x10.SEMRESATTRS_HOST_IMAGE_VERSION=x10.SEMRESATTRS_HOST_IMAGE_ID=x10.SEMRESATTRS_HOST_IMAGE_NAME=x10.SEMRESATTRS_HOST_ARCH=x10.SEMRESATTRS_HOST_TYPE=x10.SEMRESATTRS_HOST_NAME=x10.SEMRESATTRS_HOST_ID=x10.SEMRESATTRS_FAAS_MAX_MEMORY=x10.SEMRESATTRS_FAAS_INSTANCE=x10.SEMRESATTRS_FAAS_VERSION=x10.SEMRESATTRS_FAAS_ID=x10.SEMRESATTRS_FAAS_NAME=x10.SEMRESATTRS_DEVICE_MODEL_NAME=x10.SEMRESATTRS_DEVICE_MODEL_IDENTIFIER=x10.SEMRESATTRS_DEVICE_ID=x10.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT=x10.SEMRESATTRS_CONTAINER_IMAGE_TAG=x10.SEMRESATTRS_CONTAINER_IMAGE_NAME=x10.SEMRESATTRS_CONTAINER_RUNTIME=x10.SEMRESATTRS_CONTAINER_ID=x10.SEMRESATTRS_CONTAINER_NAME=x10.SEMRESATTRS_AWS_LOG_STREAM_ARNS=x10.SEMRESATTRS_AWS_LOG_STREAM_NAMES=x10.SEMRESATTRS_AWS_LOG_GROUP_ARNS=x10.SEMRESATTRS_AWS_LOG_GROUP_NAMES=x10.SEMRESATTRS_AWS_EKS_CLUSTER_ARN=x10.SEMRESATTRS_AWS_ECS_TASK_REVISION=x10.SEMRESATTRS_AWS_ECS_TASK_FAMILY=x10.SEMRESATTRS_AWS_ECS_TASK_ARN=x10.SEMRESATTRS_AWS_ECS_LAUNCHTYPE=x10.SEMRESATTRS_AWS_ECS_CLUSTER_ARN=x10.SEMRESATTRS_AWS_ECS_CONTAINER_ARN=x10.SEMRESATTRS_CLOUD_PLATFORM=x10.SEMRESATTRS_CLOUD_AVAILABILITY_ZONE=x10.SEMRESATTRS_CLOUD_REGION=x10.SEMRESATTRS_CLOUD_ACCOUNT_ID=x10.SEMRESATTRS_CLOUD_PROVIDER=void 0;x10.CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE=x10.CLOUDPLATFORMVALUES_AZURE_APP_SERVICE=x10.CLOUDPLATFORMVALUES_AZURE_FUNCTIONS=x10.CLOUDPLATFORMVALUES_AZURE_AKS=x10.CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES=x10.CLOUDPLATFORMVALUES_AZURE_VM=x10.CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK=x10.CLOUDPLATFORMVALUES_AWS_LAMBDA=x10.CLOUDPLATFORMVALUES_AWS_EKS=x10.CLOUDPLATFORMVALUES_AWS_ECS=x10.CLOUDPLATFORMVALUES_AWS_EC2=x10.CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC=x10.CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS=x10.CloudProviderValues=x10.CLOUDPROVIDERVALUES_GCP=x10.CLOUDPROVIDERVALUES_AZURE=x10.CLOUDPROVIDERVALUES_AWS=x10.CLOUDPROVIDERVALUES_ALIBABA_CLOUD=x10.SemanticResourceAttributes=x10.SEMRESATTRS_WEBENGINE_DESCRIPTION=x10.SEMRESATTRS_WEBENGINE_VERSION=x10.SEMRESATTRS_WEBENGINE_NAME=x10.SEMRESATTRS_TELEMETRY_AUTO_VERSION=x10.SEMRESATTRS_TELEMETRY_SDK_VERSION=x10.SEMRESATTRS_TELEMETRY_SDK_LANGUAGE=x10.SEMRESATTRS_TELEMETRY_SDK_NAME=x10.SEMRESATTRS_SERVICE_VERSION=x10.SEMRESATTRS_SERVICE_INSTANCE_ID=x10.SEMRESATTRS_SERVICE_NAMESPACE=x10.SEMRESATTRS_SERVICE_NAME=x10.SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION=x10.SEMRESATTRS_PROCESS_RUNTIME_VERSION=x10.SEMRESATTRS_PROCESS_RUNTIME_NAME=x10.SEMRESATTRS_PROCESS_OWNER=x10.SEMRESATTRS_PROCESS_COMMAND_ARGS=x10.SEMRESATTRS_PROCESS_COMMAND_LINE=x10.SEMRESATTRS_PROCESS_COMMAND=x10.SEMRESATTRS_PROCESS_EXECUTABLE_PATH=x10.SEMRESATTRS_PROCESS_EXECUTABLE_NAME=x10.SEMRESATTRS_PROCESS_PID=x10.SEMRESATTRS_OS_VERSION=x10.SEMRESATTRS_OS_NAME=x10.SEMRESATTRS_OS_DESCRIPTION=x10.SEMRESATTRS_OS_TYPE=x10.SEMRESATTRS_K8S_CRONJOB_NAME=x10.SEMRESATTRS_K8S_CRONJOB_UID=x10.SEMRESATTRS_K8S_JOB_NAME=x10.SEMRESATTRS_K8S_JOB_UID=x10.SEMRESATTRS_K8S_DAEMONSET_NAME=x10.SEMRESATTRS_K8S_DAEMONSET_UID=void 0;x10.TelemetrySdkLanguageValues=x10.TELEMETRYSDKLANGUAGEVALUES_WEBJS=x10.TELEMETRYSDKLANGUAGEVALUES_RUBY=x10.TELEMETRYSDKLANGUAGEVALUES_PYTHON=x10.TELEMETRYSDKLANGUAGEVALUES_PHP=x10.TELEMETRYSDKLANGUAGEVALUES_NODEJS=x10.TELEMETRYSDKLANGUAGEVALUES_JAVA=x10.TELEMETRYSDKLANGUAGEVALUES_GO=x10.TELEMETRYSDKLANGUAGEVALUES_ERLANG=x10.TELEMETRYSDKLANGUAGEVALUES_DOTNET=x10.TELEMETRYSDKLANGUAGEVALUES_CPP=x10.OsTypeValues=x10.OSTYPEVALUES_Z_OS=x10.OSTYPEVALUES_SOLARIS=x10.OSTYPEVALUES_AIX=x10.OSTYPEVALUES_HPUX=x10.OSTYPEVALUES_DRAGONFLYBSD=x10.OSTYPEVALUES_OPENBSD=x10.OSTYPEVALUES_NETBSD=x10.OSTYPEVALUES_FREEBSD=x10.OSTYPEVALUES_DARWIN=x10.OSTYPEVALUES_LINUX=x10.OSTYPEVALUES_WINDOWS=x10.HostArchValues=x10.HOSTARCHVALUES_X86=x10.HOSTARCHVALUES_PPC64=x10.HOSTARCHVALUES_PPC32=x10.HOSTARCHVALUES_IA64=x10.HOSTARCHVALUES_ARM64=x10.HOSTARCHVALUES_ARM32=x10.HOSTARCHVALUES_AMD64=x10.AwsEcsLaunchtypeValues=x10.AWSECSLAUNCHTYPEVALUES_FARGATE=x10.AWSECSLAUNCHTYPEVALUES_EC2=x10.CloudPlatformValues=x10.CLOUDPLATFORMVALUES_GCP_APP_ENGINE=x10.CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS=x10.CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE=x10.CLOUDPLATFORMVALUES_GCP_CLOUD_RUN=void 0;var O7=SV(),Be="cloud.provider",Ue="cloud.account.id",Ne="cloud.region",Ae="cloud.availability_zone",Oe="cloud.platform",Te="aws.ecs.container.arn",Ie="aws.ecs.cluster.arn",$e="aws.ecs.launchtype",De="aws.ecs.task.arn",Ee="aws.ecs.task.family",Ce="aws.ecs.task.revision",Re="aws.eks.cluster.arn",Me="aws.log.group.names",Le="aws.log.group.arns",Pe="aws.log.stream.names",we="aws.log.stream.arns",Se="container.name",fe="container.id",ye="container.runtime",ke="container.image.name",ve="container.image.tag",je="deployment.environment",he="device.id",_e="device.model.identifier",xe="device.model.name",be="faas.name",ue="faas.id",me="faas.version",ge="faas.instance",de="faas.max_memory",ce="host.id",le="host.name",pe="host.type",ne="host.arch",ie="host.image.name",ae="host.image.id",re="host.image.version",oe="k8s.cluster.name",te="k8s.node.name",se="k8s.node.uid",ee="k8s.namespace.name",X00="k8s.pod.uid",Y00="k8s.pod.name",Z00="k8s.container.name",Q00="k8s.replicaset.uid",J00="k8s.replicaset.name",W00="k8s.deployment.uid",G00="k8s.deployment.name",K00="k8s.statefulset.uid",F00="k8s.statefulset.name",z00="k8s.daemonset.uid",q00="k8s.daemonset.name",H00="k8s.job.uid",V00="k8s.job.name",B00="k8s.cronjob.uid",U00="k8s.cronjob.name",N00="os.type",A00="os.description",O00="os.name",T00="os.version",I00="process.pid",$00="process.executable.name",D00="process.executable.path",E00="process.command",C00="process.command_line",R00="process.command_args",M00="process.owner",L00="process.runtime.name",P00="process.runtime.version",w00="process.runtime.description",S00="service.name",f00="service.namespace",y00="service.instance.id",k00="service.version",v00="telemetry.sdk.name",j00="telemetry.sdk.language",h00="telemetry.sdk.version",_00="telemetry.auto.version",x00="webengine.name",b00="webengine.version",u00="webengine.description";x10.SEMRESATTRS_CLOUD_PROVIDER=Be;x10.SEMRESATTRS_CLOUD_ACCOUNT_ID=Ue;x10.SEMRESATTRS_CLOUD_REGION=Ne;x10.SEMRESATTRS_CLOUD_AVAILABILITY_ZONE=Ae;x10.SEMRESATTRS_CLOUD_PLATFORM=Oe;x10.SEMRESATTRS_AWS_ECS_CONTAINER_ARN=Te;x10.SEMRESATTRS_AWS_ECS_CLUSTER_ARN=Ie;x10.SEMRESATTRS_AWS_ECS_LAUNCHTYPE=$e;x10.SEMRESATTRS_AWS_ECS_TASK_ARN=De;x10.SEMRESATTRS_AWS_ECS_TASK_FAMILY=Ee;x10.SEMRESATTRS_AWS_ECS_TASK_REVISION=Ce;x10.SEMRESATTRS_AWS_EKS_CLUSTER_ARN=Re;x10.SEMRESATTRS_AWS_LOG_GROUP_NAMES=Me;x10.SEMRESATTRS_AWS_LOG_GROUP_ARNS=Le;x10.SEMRESATTRS_AWS_LOG_STREAM_NAMES=Pe;x10.SEMRESATTRS_AWS_LOG_STREAM_ARNS=we;x10.SEMRESATTRS_CONTAINER_NAME=Se;x10.SEMRESATTRS_CONTAINER_ID=fe;x10.SEMRESATTRS_CONTAINER_RUNTIME=ye;x10.SEMRESATTRS_CONTAINER_IMAGE_NAME=ke;x10.SEMRESATTRS_CONTAINER_IMAGE_TAG=ve;x10.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT=je;x10.SEMRESATTRS_DEVICE_ID=he;x10.SEMRESATTRS_DEVICE_MODEL_IDENTIFIER=_e;x10.SEMRESATTRS_DEVICE_MODEL_NAME=xe;x10.SEMRESATTRS_FAAS_NAME=be;x10.SEMRESATTRS_FAAS_ID=ue;x10.SEMRESATTRS_FAAS_VERSION=me;x10.SEMRESATTRS_FAAS_INSTANCE=ge;x10.SEMRESATTRS_FAAS_MAX_MEMORY=de;x10.SEMRESATTRS_HOST_ID=ce;x10.SEMRESATTRS_HOST_NAME=le;x10.SEMRESATTRS_HOST_TYPE=pe;x10.SEMRESATTRS_HOST_ARCH=ne;x10.SEMRESATTRS_HOST_IMAGE_NAME=ie;x10.SEMRESATTRS_HOST_IMAGE_ID=ae;x10.SEMRESATTRS_HOST_IMAGE_VERSION=re;x10.SEMRESATTRS_K8S_CLUSTER_NAME=oe;x10.SEMRESATTRS_K8S_NODE_NAME=te;x10.SEMRESATTRS_K8S_NODE_UID=se;x10.SEMRESATTRS_K8S_NAMESPACE_NAME=ee;x10.SEMRESATTRS_K8S_POD_UID=X00;x10.SEMRESATTRS_K8S_POD_NAME=Y00;x10.SEMRESATTRS_K8S_CONTAINER_NAME=Z00;x10.SEMRESATTRS_K8S_REPLICASET_UID=Q00;x10.SEMRESATTRS_K8S_REPLICASET_NAME=J00;x10.SEMRESATTRS_K8S_DEPLOYMENT_UID=W00;x10.SEMRESATTRS_K8S_DEPLOYMENT_NAME=G00;x10.SEMRESATTRS_K8S_STATEFULSET_UID=K00;x10.SEMRESATTRS_K8S_STATEFULSET_NAME=F00;x10.SEMRESATTRS_K8S_DAEMONSET_UID=z00;x10.SEMRESATTRS_K8S_DAEMONSET_NAME=q00;x10.SEMRESATTRS_K8S_JOB_UID=H00;x10.SEMRESATTRS_K8S_JOB_NAME=V00;x10.SEMRESATTRS_K8S_CRONJOB_UID=B00;x10.SEMRESATTRS_K8S_CRONJOB_NAME=U00;x10.SEMRESATTRS_OS_TYPE=N00;x10.SEMRESATTRS_OS_DESCRIPTION=A00;x10.SEMRESATTRS_OS_NAME=O00;x10.SEMRESATTRS_OS_VERSION=T00;x10.SEMRESATTRS_PROCESS_PID=I00;x10.SEMRESATTRS_PROCESS_EXECUTABLE_NAME=$00;x10.SEMRESATTRS_PROCESS_EXECUTABLE_PATH=D00;x10.SEMRESATTRS_PROCESS_COMMAND=E00;x10.SEMRESATTRS_PROCESS_COMMAND_LINE=C00;x10.SEMRESATTRS_PROCESS_COMMAND_ARGS=R00;x10.SEMRESATTRS_PROCESS_OWNER=M00;x10.SEMRESATTRS_PROCESS_RUNTIME_NAME=L00;x10.SEMRESATTRS_PROCESS_RUNTIME_VERSION=P00;x10.SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION=w00;x10.SEMRESATTRS_SERVICE_NAME=S00;x10.SEMRESATTRS_SERVICE_NAMESPACE=f00;x10.SEMRESATTRS_SERVICE_INSTANCE_ID=y00;x10.SEMRESATTRS_SERVICE_VERSION=k00;x10.SEMRESATTRS_TELEMETRY_SDK_NAME=v00;x10.SEMRESATTRS_TELEMETRY_SDK_LANGUAGE=j00;x10.SEMRESATTRS_TELEMETRY_SDK_VERSION=h00;x10.SEMRESATTRS_TELEMETRY_AUTO_VERSION=_00;x10.SEMRESATTRS_WEBENGINE_NAME=x00;x10.SEMRESATTRS_WEBENGINE_VERSION=b00;x10.SEMRESATTRS_WEBENGINE_DESCRIPTION=u00;x10.SemanticResourceAttributes=(0,O7.createConstMap)([Be,Ue,Ne,Ae,Oe,Te,Ie,$e,De,Ee,Ce,Re,Me,Le,Pe,we,Se,fe,ye,ke,ve,je,he,_e,xe,be,ue,me,ge,de,ce,le,pe,ne,ie,ae,re,oe,te,se,ee,X00,Y00,Z00,Q00,J00,W00,G00,K00,F00,z00,q00,H00,V00,B00,U00,N00,A00,O00,T00,I00,$00,D00,E00,C00,R00,M00,L00,P00,w00,S00,f00,y00,k00,v00,j00,h00,_00,x00,b00,u00]);var m00="alibaba_cloud",g00="aws",d00="azure",c00="gcp";x10.CLOUDPROVIDERVALUES_ALIBABA_CLOUD=m00;x10.CLOUDPROVIDERVALUES_AWS=g00;x10.CLOUDPROVIDERVALUES_AZURE=d00;x10.CLOUDPROVIDERVALUES_GCP=c00;x10.CloudProviderValues=(0,O7.createConstMap)([m00,g00,d00,c00]);var l00="alibaba_cloud_ecs",p00="alibaba_cloud_fc",n00="aws_ec2",i00="aws_ecs",a00="aws_eks",r00="aws_lambda",o00="aws_elastic_beanstalk",t00="azure_vm",s00="azure_container_instances",e00="azure_aks",X10="azure_functions",Y10="azure_app_service",Z10="gcp_compute_engine",Q10="gcp_cloud_run",J10="gcp_kubernetes_engine",W10="gcp_cloud_functions",G10="gcp_app_engine";x10.CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS=l00;x10.CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC=p00;x10.CLOUDPLATFORMVALUES_AWS_EC2=n00;x10.CLOUDPLATFORMVALUES_AWS_ECS=i00;x10.CLOUDPLATFORMVALUES_AWS_EKS=a00;x10.CLOUDPLATFORMVALUES_AWS_LAMBDA=r00;x10.CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK=o00;x10.CLOUDPLATFORMVALUES_AZURE_VM=t00;x10.CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES=s00;x10.CLOUDPLATFORMVALUES_AZURE_AKS=e00;x10.CLOUDPLATFORMVALUES_AZURE_FUNCTIONS=X10;x10.CLOUDPLATFORMVALUES_AZURE_APP_SERVICE=Y10;x10.CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE=Z10;x10.CLOUDPLATFORMVALUES_GCP_CLOUD_RUN=Q10;x10.CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE=J10;x10.CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS=W10;x10.CLOUDPLATFORMVALUES_GCP_APP_ENGINE=G10;x10.CloudPlatformValues=(0,O7.createConstMap)([l00,p00,n00,i00,a00,r00,o00,t00,s00,e00,X10,Y10,Z10,Q10,J10,W10,G10]);var K10="ec2",F10="fargate";x10.AWSECSLAUNCHTYPEVALUES_EC2=K10;x10.AWSECSLAUNCHTYPEVALUES_FARGATE=F10;x10.AwsEcsLaunchtypeValues=(0,O7.createConstMap)([K10,F10]);var z10="amd64",q10="arm32",H10="arm64",V10="ia64",B10="ppc32",U10="ppc64",N10="x86";x10.HOSTARCHVALUES_AMD64=z10;x10.HOSTARCHVALUES_ARM32=q10;x10.HOSTARCHVALUES_ARM64=H10;x10.HOSTARCHVALUES_IA64=V10;x10.HOSTARCHVALUES_PPC32=B10;x10.HOSTARCHVALUES_PPC64=U10;x10.HOSTARCHVALUES_X86=N10;x10.HostArchValues=(0,O7.createConstMap)([z10,q10,H10,V10,B10,U10,N10]);var A10="windows",O10="linux",T10="darwin",I10="freebsd",$10="netbsd",D10="openbsd",E10="dragonflybsd",C10="hpux",R10="aix",M10="solaris",L10="z_os";x10.OSTYPEVALUES_WINDOWS=A10;x10.OSTYPEVALUES_LINUX=O10;x10.OSTYPEVALUES_DARWIN=T10;x10.OSTYPEVALUES_FREEBSD=I10;x10.OSTYPEVALUES_NETBSD=$10;x10.OSTYPEVALUES_OPENBSD=D10;x10.OSTYPEVALUES_DRAGONFLYBSD=E10;x10.OSTYPEVALUES_HPUX=C10;x10.OSTYPEVALUES_AIX=R10;x10.OSTYPEVALUES_SOLARIS=M10;x10.OSTYPEVALUES_Z_OS=L10;x10.OsTypeValues=(0,O7.createConstMap)([A10,O10,T10,I10,$10,D10,E10,C10,R10,M10,L10]);var P10="cpp",w10="dotnet",S10="erlang",f10="go",y10="java",k10="nodejs",v10="php",j10="python",h10="ruby",_10="webjs";x10.TELEMETRYSDKLANGUAGEVALUES_CPP=P10;x10.TELEMETRYSDKLANGUAGEVALUES_DOTNET=w10;x10.TELEMETRYSDKLANGUAGEVALUES_ERLANG=S10;x10.TELEMETRYSDKLANGUAGEVALUES_GO=f10;x10.TELEMETRYSDKLANGUAGEVALUES_JAVA=y10;x10.TELEMETRYSDKLANGUAGEVALUES_NODEJS=k10;x10.TELEMETRYSDKLANGUAGEVALUES_PHP=v10;x10.TELEMETRYSDKLANGUAGEVALUES_PYTHON=j10;x10.TELEMETRYSDKLANGUAGEVALUES_RUBY=h10;x10.TELEMETRYSDKLANGUAGEVALUES_WEBJS=_10;x10.TelemetrySdkLanguageValues=(0,O7.createConstMap)([P10,w10,S10,f10,y10,k10,v10,j10,h10,_10])});var d10=X0((T7)=>{var dc0=T7&&T7.__createBinding||(Object.create?function(X,Y,W,z){if(z===void 0)z=W;var F=Object.getOwnPropertyDescriptor(Y,W);if(!F||("get"in F?!Y.__esModule:F.writable||F.configurable))F={enumerable:!0,get:function(){return Y[W]}};Object.defineProperty(X,z,F)}:function(X,Y,W,z){if(z===void 0)z=W;X[z]=Y[W]}),cc0=T7&&T7.__exportStar||function(X,Y){for(var W in X)if(W!=="default"&&!Object.prototype.hasOwnProperty.call(Y,W))dc0(Y,X,W)};Object.defineProperty(T7,"__esModule",{value:!0});cc0(g10(),T7)});var i10=X0((c10)=>{Object.defineProperty(c10,"__esModule",{value:!0});c10.ATTR_EXCEPTION_TYPE=c10.ATTR_EXCEPTION_STACKTRACE=c10.ATTR_EXCEPTION_MESSAGE=c10.ATTR_EXCEPTION_ESCAPED=c10.ERROR_TYPE_VALUE_OTHER=c10.ATTR_ERROR_TYPE=c10.DOTNET_GC_HEAP_GENERATION_VALUE_POH=c10.DOTNET_GC_HEAP_GENERATION_VALUE_LOH=c10.DOTNET_GC_HEAP_GENERATION_VALUE_GEN2=c10.DOTNET_GC_HEAP_GENERATION_VALUE_GEN1=c10.DOTNET_GC_HEAP_GENERATION_VALUE_GEN0=c10.ATTR_DOTNET_GC_HEAP_GENERATION=c10.DB_SYSTEM_NAME_VALUE_POSTGRESQL=c10.DB_SYSTEM_NAME_VALUE_MYSQL=c10.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER=c10.DB_SYSTEM_NAME_VALUE_MARIADB=c10.ATTR_DB_SYSTEM_NAME=c10.ATTR_DB_STORED_PROCEDURE_NAME=c10.ATTR_DB_RESPONSE_STATUS_CODE=c10.ATTR_DB_QUERY_TEXT=c10.ATTR_DB_QUERY_SUMMARY=c10.ATTR_DB_OPERATION_NAME=c10.ATTR_DB_OPERATION_BATCH_SIZE=c10.ATTR_DB_NAMESPACE=c10.ATTR_DB_COLLECTION_NAME=c10.ATTR_CODE_STACKTRACE=c10.ATTR_CODE_LINE_NUMBER=c10.ATTR_CODE_FUNCTION_NAME=c10.ATTR_CODE_FILE_PATH=c10.ATTR_CODE_COLUMN_NUMBER=c10.ATTR_CLIENT_PORT=c10.ATTR_CLIENT_ADDRESS=c10.ATTR_ASPNETCORE_USER_IS_AUTHENTICATED=c10.ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS=c10.ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE=c10.ATTR_ASPNETCORE_ROUTING_MATCH_STATUS=c10.ATTR_ASPNETCORE_ROUTING_IS_FALLBACK=c10.ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED=c10.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED=c10.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER=c10.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER=c10.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED=c10.ATTR_ASPNETCORE_RATE_LIMITING_RESULT=c10.ATTR_ASPNETCORE_RATE_LIMITING_POLICY=c10.ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE=c10.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED=c10.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED=c10.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED=c10.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED=c10.ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT=void 0;c10.OTEL_STATUS_CODE_VALUE_ERROR=c10.ATTR_OTEL_STATUS_CODE=c10.ATTR_OTEL_SCOPE_VERSION=c10.ATTR_OTEL_SCOPE_NAME=c10.NETWORK_TYPE_VALUE_IPV6=c10.NETWORK_TYPE_VALUE_IPV4=c10.ATTR_NETWORK_TYPE=c10.NETWORK_TRANSPORT_VALUE_UNIX=c10.NETWORK_TRANSPORT_VALUE_UDP=c10.NETWORK_TRANSPORT_VALUE_TCP=c10.NETWORK_TRANSPORT_VALUE_QUIC=c10.NETWORK_TRANSPORT_VALUE_PIPE=c10.ATTR_NETWORK_TRANSPORT=c10.ATTR_NETWORK_PROTOCOL_VERSION=c10.ATTR_NETWORK_PROTOCOL_NAME=c10.ATTR_NETWORK_PEER_PORT=c10.ATTR_NETWORK_PEER_ADDRESS=c10.ATTR_NETWORK_LOCAL_PORT=c10.ATTR_NETWORK_LOCAL_ADDRESS=c10.JVM_THREAD_STATE_VALUE_WAITING=c10.JVM_THREAD_STATE_VALUE_TIMED_WAITING=c10.JVM_THREAD_STATE_VALUE_TERMINATED=c10.JVM_THREAD_STATE_VALUE_RUNNABLE=c10.JVM_THREAD_STATE_VALUE_NEW=c10.JVM_THREAD_STATE_VALUE_BLOCKED=c10.ATTR_JVM_THREAD_STATE=c10.ATTR_JVM_THREAD_DAEMON=c10.JVM_MEMORY_TYPE_VALUE_NON_HEAP=c10.JVM_MEMORY_TYPE_VALUE_HEAP=c10.ATTR_JVM_MEMORY_TYPE=c10.ATTR_JVM_MEMORY_POOL_NAME=c10.ATTR_JVM_GC_NAME=c10.ATTR_JVM_GC_ACTION=c10.ATTR_HTTP_ROUTE=c10.ATTR_HTTP_RESPONSE_STATUS_CODE=c10.ATTR_HTTP_RESPONSE_HEADER=c10.ATTR_HTTP_REQUEST_RESEND_COUNT=c10.ATTR_HTTP_REQUEST_METHOD_ORIGINAL=c10.HTTP_REQUEST_METHOD_VALUE_TRACE=c10.HTTP_REQUEST_METHOD_VALUE_PUT=c10.HTTP_REQUEST_METHOD_VALUE_POST=c10.HTTP_REQUEST_METHOD_VALUE_PATCH=c10.HTTP_REQUEST_METHOD_VALUE_OPTIONS=c10.HTTP_REQUEST_METHOD_VALUE_HEAD=c10.HTTP_REQUEST_METHOD_VALUE_GET=c10.HTTP_REQUEST_METHOD_VALUE_DELETE=c10.HTTP_REQUEST_METHOD_VALUE_CONNECT=c10.HTTP_REQUEST_METHOD_VALUE_OTHER=c10.ATTR_HTTP_REQUEST_METHOD=c10.ATTR_HTTP_REQUEST_HEADER=void 0;c10.ATTR_USER_AGENT_ORIGINAL=c10.ATTR_URL_SCHEME=c10.ATTR_URL_QUERY=c10.ATTR_URL_PATH=c10.ATTR_URL_FULL=c10.ATTR_URL_FRAGMENT=c10.ATTR_TELEMETRY_SDK_VERSION=c10.ATTR_TELEMETRY_SDK_NAME=c10.TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS=c10.TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT=c10.TELEMETRY_SDK_LANGUAGE_VALUE_RUST=c10.TELEMETRY_SDK_LANGUAGE_VALUE_RUBY=c10.TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON=c10.TELEMETRY_SDK_LANGUAGE_VALUE_PHP=c10.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS=c10.TELEMETRY_SDK_LANGUAGE_VALUE_JAVA=c10.TELEMETRY_SDK_LANGUAGE_VALUE_GO=c10.TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG=c10.TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET=c10.TELEMETRY_SDK_LANGUAGE_VALUE_CPP=c10.ATTR_TELEMETRY_SDK_LANGUAGE=c10.SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS=c10.SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS=c10.SIGNALR_TRANSPORT_VALUE_LONG_POLLING=c10.ATTR_SIGNALR_TRANSPORT=c10.SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT=c10.SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE=c10.SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN=c10.ATTR_SIGNALR_CONNECTION_STATUS=c10.ATTR_SERVICE_VERSION=c10.ATTR_SERVICE_NAMESPACE=c10.ATTR_SERVICE_NAME=c10.ATTR_SERVICE_INSTANCE_ID=c10.ATTR_SERVER_PORT=c10.ATTR_SERVER_ADDRESS=c10.ATTR_OTEL_STATUS_DESCRIPTION=c10.OTEL_STATUS_CODE_VALUE_OK=void 0;c10.ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT="aspnetcore.diagnostics.exception.result";c10.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED="aborted";c10.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED="handled";c10.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED="skipped";c10.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED="unhandled";c10.ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE="aspnetcore.diagnostics.handler.type";c10.ATTR_ASPNETCORE_RATE_LIMITING_POLICY="aspnetcore.rate_limiting.policy";c10.ATTR_ASPNETCORE_RATE_LIMITING_RESULT="aspnetcore.rate_limiting.result";c10.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED="acquired";c10.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER="endpoint_limiter";c10.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER="global_limiter";c10.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED="request_canceled";c10.ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED="aspnetcore.request.is_unhandled";c10.ATTR_ASPNETCORE_ROUTING_IS_FALLBACK="aspnetcore.routing.is_fallback";c10.ATTR_ASPNETCORE_ROUTING_MATCH_STATUS="aspnetcore.routing.match_status";c10.ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE="failure";c10.ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS="success";c10.ATTR_ASPNETCORE_USER_IS_AUTHENTICATED="aspnetcore.user.is_authenticated";c10.ATTR_CLIENT_ADDRESS="client.address";c10.ATTR_CLIENT_PORT="client.port";c10.ATTR_CODE_COLUMN_NUMBER="code.column.number";c10.ATTR_CODE_FILE_PATH="code.file.path";c10.ATTR_CODE_FUNCTION_NAME="code.function.name";c10.ATTR_CODE_LINE_NUMBER="code.line.number";c10.ATTR_CODE_STACKTRACE="code.stacktrace";c10.ATTR_DB_COLLECTION_NAME="db.collection.name";c10.ATTR_DB_NAMESPACE="db.namespace";c10.ATTR_DB_OPERATION_BATCH_SIZE="db.operation.batch.size";c10.ATTR_DB_OPERATION_NAME="db.operation.name";c10.ATTR_DB_QUERY_SUMMARY="db.query.summary";c10.ATTR_DB_QUERY_TEXT="db.query.text";c10.ATTR_DB_RESPONSE_STATUS_CODE="db.response.status_code";c10.ATTR_DB_STORED_PROCEDURE_NAME="db.stored_procedure.name";c10.ATTR_DB_SYSTEM_NAME="db.system.name";c10.DB_SYSTEM_NAME_VALUE_MARIADB="mariadb";c10.DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER="microsoft.sql_server";c10.DB_SYSTEM_NAME_VALUE_MYSQL="mysql";c10.DB_SYSTEM_NAME_VALUE_POSTGRESQL="postgresql";c10.ATTR_DOTNET_GC_HEAP_GENERATION="dotnet.gc.heap.generation";c10.DOTNET_GC_HEAP_GENERATION_VALUE_GEN0="gen0";c10.DOTNET_GC_HEAP_GENERATION_VALUE_GEN1="gen1";c10.DOTNET_GC_HEAP_GENERATION_VALUE_GEN2="gen2";c10.DOTNET_GC_HEAP_GENERATION_VALUE_LOH="loh";c10.DOTNET_GC_HEAP_GENERATION_VALUE_POH="poh";c10.ATTR_ERROR_TYPE="error.type";c10.ERROR_TYPE_VALUE_OTHER="_OTHER";c10.ATTR_EXCEPTION_ESCAPED="exception.escaped";c10.ATTR_EXCEPTION_MESSAGE="exception.message";c10.ATTR_EXCEPTION_STACKTRACE="exception.stacktrace";c10.ATTR_EXCEPTION_TYPE="exception.type";var lc0=(X)=>`http.request.header.${X}`;c10.ATTR_HTTP_REQUEST_HEADER=lc0;c10.ATTR_HTTP_REQUEST_METHOD="http.request.method";c10.HTTP_REQUEST_METHOD_VALUE_OTHER="_OTHER";c10.HTTP_REQUEST_METHOD_VALUE_CONNECT="CONNECT";c10.HTTP_REQUEST_METHOD_VALUE_DELETE="DELETE";c10.HTTP_REQUEST_METHOD_VALUE_GET="GET";c10.HTTP_REQUEST_METHOD_VALUE_HEAD="HEAD";c10.HTTP_REQUEST_METHOD_VALUE_OPTIONS="OPTIONS";c10.HTTP_REQUEST_METHOD_VALUE_PATCH="PATCH";c10.HTTP_REQUEST_METHOD_VALUE_POST="POST";c10.HTTP_REQUEST_METHOD_VALUE_PUT="PUT";c10.HTTP_REQUEST_METHOD_VALUE_TRACE="TRACE";c10.ATTR_HTTP_REQUEST_METHOD_ORIGINAL="http.request.method_original";c10.ATTR_HTTP_REQUEST_RESEND_COUNT="http.request.resend_count";var pc0=(X)=>`http.response.header.${X}`;c10.ATTR_HTTP_RESPONSE_HEADER=pc0;c10.ATTR_HTTP_RESPONSE_STATUS_CODE="http.response.status_code";c10.ATTR_HTTP_ROUTE="http.route";c10.ATTR_JVM_GC_ACTION="jvm.gc.action";c10.ATTR_JVM_GC_NAME="jvm.gc.name";c10.ATTR_JVM_MEMORY_POOL_NAME="jvm.memory.pool.name";c10.ATTR_JVM_MEMORY_TYPE="jvm.memory.type";c10.JVM_MEMORY_TYPE_VALUE_HEAP="heap";c10.JVM_MEMORY_TYPE_VALUE_NON_HEAP="non_heap";c10.ATTR_JVM_THREAD_DAEMON="jvm.thread.daemon";c10.ATTR_JVM_THREAD_STATE="jvm.thread.state";c10.JVM_THREAD_STATE_VALUE_BLOCKED="blocked";c10.JVM_THREAD_STATE_VALUE_NEW="new";c10.JVM_THREAD_STATE_VALUE_RUNNABLE="runnable";c10.JVM_THREAD_STATE_VALUE_TERMINATED="terminated";c10.JVM_THREAD_STATE_VALUE_TIMED_WAITING="timed_waiting";c10.JVM_THREAD_STATE_VALUE_WAITING="waiting";c10.ATTR_NETWORK_LOCAL_ADDRESS="network.local.address";c10.ATTR_NETWORK_LOCAL_PORT="network.local.port";c10.ATTR_NETWORK_PEER_ADDRESS="network.peer.address";c10.ATTR_NETWORK_PEER_PORT="network.peer.port";c10.ATTR_NETWORK_PROTOCOL_NAME="network.protocol.name";c10.ATTR_NETWORK_PROTOCOL_VERSION="network.protocol.version";c10.ATTR_NETWORK_TRANSPORT="network.transport";c10.NETWORK_TRANSPORT_VALUE_PIPE="pipe";c10.NETWORK_TRANSPORT_VALUE_QUIC="quic";c10.NETWORK_TRANSPORT_VALUE_TCP="tcp";c10.NETWORK_TRANSPORT_VALUE_UDP="udp";c10.NETWORK_TRANSPORT_VALUE_UNIX="unix";c10.ATTR_NETWORK_TYPE="network.type";c10.NETWORK_TYPE_VALUE_IPV4="ipv4";c10.NETWORK_TYPE_VALUE_IPV6="ipv6";c10.ATTR_OTEL_SCOPE_NAME="otel.scope.name";c10.ATTR_OTEL_SCOPE_VERSION="otel.scope.version";c10.ATTR_OTEL_STATUS_CODE="otel.status_code";c10.OTEL_STATUS_CODE_VALUE_ERROR="ERROR";c10.OTEL_STATUS_CODE_VALUE_OK="OK";c10.ATTR_OTEL_STATUS_DESCRIPTION="otel.status_description";c10.ATTR_SERVER_ADDRESS="server.address";c10.ATTR_SERVER_PORT="server.port";c10.ATTR_SERVICE_INSTANCE_ID="service.instance.id";c10.ATTR_SERVICE_NAME="service.name";c10.ATTR_SERVICE_NAMESPACE="service.namespace";c10.ATTR_SERVICE_VERSION="service.version";c10.ATTR_SIGNALR_CONNECTION_STATUS="signalr.connection.status";c10.SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN="app_shutdown";c10.SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE="normal_closure";c10.SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT="timeout";c10.ATTR_SIGNALR_TRANSPORT="signalr.transport";c10.SIGNALR_TRANSPORT_VALUE_LONG_POLLING="long_polling";c10.SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS="server_sent_events";c10.SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS="web_sockets";c10.ATTR_TELEMETRY_SDK_LANGUAGE="telemetry.sdk.language";c10.TELEMETRY_SDK_LANGUAGE_VALUE_CPP="cpp";c10.TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET="dotnet";c10.TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG="erlang";c10.TELEMETRY_SDK_LANGUAGE_VALUE_GO="go";c10.TELEMETRY_SDK_LANGUAGE_VALUE_JAVA="java";c10.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS="nodejs";c10.TELEMETRY_SDK_LANGUAGE_VALUE_PHP="php";c10.TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON="python";c10.TELEMETRY_SDK_LANGUAGE_VALUE_RUBY="ruby";c10.TELEMETRY_SDK_LANGUAGE_VALUE_RUST="rust";c10.TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT="swift";c10.TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS="webjs";c10.ATTR_TELEMETRY_SDK_NAME="telemetry.sdk.name";c10.ATTR_TELEMETRY_SDK_VERSION="telemetry.sdk.version";c10.ATTR_URL_FRAGMENT="url.fragment";c10.ATTR_URL_FULL="url.full";c10.ATTR_URL_PATH="url.path";c10.ATTR_URL_QUERY="url.query";c10.ATTR_URL_SCHEME="url.scheme";c10.ATTR_USER_AGENT_ORIGINAL="user_agent.original"});var t10=X0((a10)=>{Object.defineProperty(a10,"__esModule",{value:!0});a10.METRIC_SIGNALR_SERVER_ACTIVE_CONNECTIONS=a10.METRIC_KESTREL_UPGRADED_CONNECTIONS=a10.METRIC_KESTREL_TLS_HANDSHAKE_DURATION=a10.METRIC_KESTREL_REJECTED_CONNECTIONS=a10.METRIC_KESTREL_QUEUED_REQUESTS=a10.METRIC_KESTREL_QUEUED_CONNECTIONS=a10.METRIC_KESTREL_CONNECTION_DURATION=a10.METRIC_KESTREL_ACTIVE_TLS_HANDSHAKES=a10.METRIC_KESTREL_ACTIVE_CONNECTIONS=a10.METRIC_JVM_THREAD_COUNT=a10.METRIC_JVM_MEMORY_USED_AFTER_LAST_GC=a10.METRIC_JVM_MEMORY_USED=a10.METRIC_JVM_MEMORY_LIMIT=a10.METRIC_JVM_MEMORY_COMMITTED=a10.METRIC_JVM_GC_DURATION=a10.METRIC_JVM_CPU_TIME=a10.METRIC_JVM_CPU_RECENT_UTILIZATION=a10.METRIC_JVM_CPU_COUNT=a10.METRIC_JVM_CLASS_UNLOADED=a10.METRIC_JVM_CLASS_LOADED=a10.METRIC_JVM_CLASS_COUNT=a10.METRIC_HTTP_SERVER_REQUEST_DURATION=a10.METRIC_HTTP_CLIENT_REQUEST_DURATION=a10.METRIC_DOTNET_TIMER_COUNT=a10.METRIC_DOTNET_THREAD_POOL_WORK_ITEM_COUNT=a10.METRIC_DOTNET_THREAD_POOL_THREAD_COUNT=a10.METRIC_DOTNET_THREAD_POOL_QUEUE_LENGTH=a10.METRIC_DOTNET_PROCESS_MEMORY_WORKING_SET=a10.METRIC_DOTNET_PROCESS_CPU_TIME=a10.METRIC_DOTNET_PROCESS_CPU_COUNT=a10.METRIC_DOTNET_MONITOR_LOCK_CONTENTIONS=a10.METRIC_DOTNET_JIT_COMPILED_METHODS=a10.METRIC_DOTNET_JIT_COMPILED_IL_SIZE=a10.METRIC_DOTNET_JIT_COMPILATION_TIME=a10.METRIC_DOTNET_GC_PAUSE_TIME=a10.METRIC_DOTNET_GC_LAST_COLLECTION_MEMORY_COMMITTED_SIZE=a10.METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_SIZE=a10.METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_FRAGMENTATION_SIZE=a10.METRIC_DOTNET_GC_HEAP_TOTAL_ALLOCATED=a10.METRIC_DOTNET_GC_COLLECTIONS=a10.METRIC_DOTNET_EXCEPTIONS=a10.METRIC_DOTNET_ASSEMBLY_COUNT=a10.METRIC_DB_CLIENT_OPERATION_DURATION=a10.METRIC_ASPNETCORE_ROUTING_MATCH_ATTEMPTS=a10.METRIC_ASPNETCORE_RATE_LIMITING_REQUESTS=a10.METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_LEASE_DURATION=a10.METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_TIME_IN_QUEUE=a10.METRIC_ASPNETCORE_RATE_LIMITING_QUEUED_REQUESTS=a10.METRIC_ASPNETCORE_RATE_LIMITING_ACTIVE_REQUEST_LEASES=a10.METRIC_ASPNETCORE_DIAGNOSTICS_EXCEPTIONS=void 0;a10.METRIC_SIGNALR_SERVER_CONNECTION_DURATION=void 0;a10.METRIC_ASPNETCORE_DIAGNOSTICS_EXCEPTIONS="aspnetcore.diagnostics.exceptions";a10.METRIC_ASPNETCORE_RATE_LIMITING_ACTIVE_REQUEST_LEASES="aspnetcore.rate_limiting.active_request_leases";a10.METRIC_ASPNETCORE_RATE_LIMITING_QUEUED_REQUESTS="aspnetcore.rate_limiting.queued_requests";a10.METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_TIME_IN_QUEUE="aspnetcore.rate_limiting.request.time_in_queue";a10.METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_LEASE_DURATION="aspnetcore.rate_limiting.request_lease.duration";a10.METRIC_ASPNETCORE_RATE_LIMITING_REQUESTS="aspnetcore.rate_limiting.requests";a10.METRIC_ASPNETCORE_ROUTING_MATCH_ATTEMPTS="aspnetcore.routing.match_attempts";a10.METRIC_DB_CLIENT_OPERATION_DURATION="db.client.operation.duration";a10.METRIC_DOTNET_ASSEMBLY_COUNT="dotnet.assembly.count";a10.METRIC_DOTNET_EXCEPTIONS="dotnet.exceptions";a10.METRIC_DOTNET_GC_COLLECTIONS="dotnet.gc.collections";a10.METRIC_DOTNET_GC_HEAP_TOTAL_ALLOCATED="dotnet.gc.heap.total_allocated";a10.METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_FRAGMENTATION_SIZE="dotnet.gc.last_collection.heap.fragmentation.size";a10.METRIC_DOTNET_GC_LAST_COLLECTION_HEAP_SIZE="dotnet.gc.last_collection.heap.size";a10.METRIC_DOTNET_GC_LAST_COLLECTION_MEMORY_COMMITTED_SIZE="dotnet.gc.last_collection.memory.committed_size";a10.METRIC_DOTNET_GC_PAUSE_TIME="dotnet.gc.pause.time";a10.METRIC_DOTNET_JIT_COMPILATION_TIME="dotnet.jit.compilation.time";a10.METRIC_DOTNET_JIT_COMPILED_IL_SIZE="dotnet.jit.compiled_il.size";a10.METRIC_DOTNET_JIT_COMPILED_METHODS="dotnet.jit.compiled_methods";a10.METRIC_DOTNET_MONITOR_LOCK_CONTENTIONS="dotnet.monitor.lock_contentions";a10.METRIC_DOTNET_PROCESS_CPU_COUNT="dotnet.process.cpu.count";a10.METRIC_DOTNET_PROCESS_CPU_TIME="dotnet.process.cpu.time";a10.METRIC_DOTNET_PROCESS_MEMORY_WORKING_SET="dotnet.process.memory.working_set";a10.METRIC_DOTNET_THREAD_POOL_QUEUE_LENGTH="dotnet.thread_pool.queue.length";a10.METRIC_DOTNET_THREAD_POOL_THREAD_COUNT="dotnet.thread_pool.thread.count";a10.METRIC_DOTNET_THREAD_POOL_WORK_ITEM_COUNT="dotnet.thread_pool.work_item.count";a10.METRIC_DOTNET_TIMER_COUNT="dotnet.timer.count";a10.METRIC_HTTP_CLIENT_REQUEST_DURATION="http.client.request.duration";a10.METRIC_HTTP_SERVER_REQUEST_DURATION="http.server.request.duration";a10.METRIC_JVM_CLASS_COUNT="jvm.class.count";a10.METRIC_JVM_CLASS_LOADED="jvm.class.loaded";a10.METRIC_JVM_CLASS_UNLOADED="jvm.class.unloaded";a10.METRIC_JVM_CPU_COUNT="jvm.cpu.count";a10.METRIC_JVM_CPU_RECENT_UTILIZATION="jvm.cpu.recent_utilization";a10.METRIC_JVM_CPU_TIME="jvm.cpu.time";a10.METRIC_JVM_GC_DURATION="jvm.gc.duration";a10.METRIC_JVM_MEMORY_COMMITTED="jvm.memory.committed";a10.METRIC_JVM_MEMORY_LIMIT="jvm.memory.limit";a10.METRIC_JVM_MEMORY_USED="jvm.memory.used";a10.METRIC_JVM_MEMORY_USED_AFTER_LAST_GC="jvm.memory.used_after_last_gc";a10.METRIC_JVM_THREAD_COUNT="jvm.thread.count";a10.METRIC_KESTREL_ACTIVE_CONNECTIONS="kestrel.active_connections";a10.METRIC_KESTREL_ACTIVE_TLS_HANDSHAKES="kestrel.active_tls_handshakes";a10.METRIC_KESTREL_CONNECTION_DURATION="kestrel.connection.duration";a10.METRIC_KESTREL_QUEUED_CONNECTIONS="kestrel.queued_connections";a10.METRIC_KESTREL_QUEUED_REQUESTS="kestrel.queued_requests";a10.METRIC_KESTREL_REJECTED_CONNECTIONS="kestrel.rejected_connections";a10.METRIC_KESTREL_TLS_HANDSHAKE_DURATION="kestrel.tls_handshake.duration";a10.METRIC_KESTREL_UPGRADED_CONNECTIONS="kestrel.upgraded_connections";a10.METRIC_SIGNALR_SERVER_ACTIVE_CONNECTIONS="signalr.server.active_connections";a10.METRIC_SIGNALR_SERVER_CONNECTION_DURATION="signalr.server.connection.duration"});var X60=X0((s10)=>{Object.defineProperty(s10,"__esModule",{value:!0});s10.EVENT_EXCEPTION=void 0;s10.EVENT_EXCEPTION="exception"});var Y60=X0((P8)=>{var Bi0=P8&&P8.__createBinding||(Object.create?function(X,Y,W,z){if(z===void 0)z=W;var F=Object.getOwnPropertyDescriptor(Y,W);if(!F||("get"in F?!Y.__esModule:F.writable||F.configurable))F={enumerable:!0,get:function(){return Y[W]}};Object.defineProperty(X,z,F)}:function(X,Y,W,z){if(z===void 0)z=W;X[z]=Y[W]}),bZ=P8&&P8.__exportStar||function(X,Y){for(var W in X)if(W!=="default"&&!Object.prototype.hasOwnProperty.call(Y,W))Bi0(Y,X,W)};Object.defineProperty(P8,"__esModule",{value:!0});bZ(Ve(),P8);bZ(d10(),P8);bZ(i10(),P8);bZ(t10(),P8);bZ(X60(),P8)});import{existsSync as A5,mkdirSync as Q60,readdirSync as Ui0,readFileSync as Ni0,statSync as sW}from"node:fs";import{homedir as Ai0}from"node:os";import{dirname as J60,join as G6,resolve as eW}from"node:path";function Oi0(){let X=process?.env?.HOME?.trim();if(X&&X!=="~")return X;let Y=process?.env?.USERPROFILE?.trim();if(Y)return Y;let W=process?.env?.HOMEDRIVE?.trim(),z=process?.env?.HOMEPATH?.trim();if(W&&z)return`${W}${z}`;let F=Ai0().trim();if(F&&F!=="~")return F;return"~"}function Ti0(X){let Y=X.trim();if(!Y)return;mX=Y,G60=!0}function fV(X){if(G60)return;let Y=X.trim();if(!Y)return;mX=Y}function Ii0(X){let Y=X.trim();if(!Y)return;X3=Y,K60=!0}function $i0(X){if(K60)return;let Y=X.trim();if(!Y)return;X3=Y}function Z3(){if(X3)return X3;let X=process.env.CLINE_DIR?.trim();if(X)return X;return G6(mX,".cline")}function dZ(){return G6(mX,"Documents","Cline")}function Q3(){return G6(dZ(),"Agents")}function I7(){return G6(dZ(),"Hooks")}function cZ(){return G6(dZ(),"Rules")}function lZ(){return G6(dZ(),"Workflows")}function F60(){return G6(mX,"Documents","Plugins")}function D9(){let X=process.env.CLINE_DATA_DIR?.trim();if(X)return X;return G6(Z3(),"data")}function J8(){let X=process.env.CLINE_SESSION_DATA_DIR?.trim();if(X)return X;return G6(D9(),"sessions")}function gX(){let X=process.env.CLINE_TEAM_DATA_DIR?.trim();if(X)return X;return G6(D9(),"teams")}function yV(){let X=process.env.CLINE_PROVIDER_SETTINGS_PATH?.trim();if(X)return X;return G6(D9(),"settings","providers.json")}function kV(){let X=process.env.CLINE_MCP_SETTINGS_PATH?.trim();if(X)return X;return G6(D9(),"settings",W60)}function pZ(X){let Y=new Set,W=[];for(let z of X){if(!z||Y.has(z))continue;Y.add(z),W.push(z)}return W}function Di0(X){if(!X)return[];return[G6(X,".clinerules",w8),G6(X,".cline",w8),G6(X,".claude",w8),G6(X,".agents",w8)]}function vV(){return G6(D9(),"settings",Y3)}function jV(){return[Q3(),vV()]}function hV(X){return pZ([X?G6(X,".clinerules",uZ):"",I7()])}function nZ(X){return pZ([...Di0(X),G6(D9(),"settings",w8),G6(Z3(),w8),G6(mX,".agents",w8)])}function _V(X){return pZ([X?G6(X,".clinerules"):"",G6(D9(),"settings",mZ),cZ()])}function xV(X){return pZ([X?G6(X,".clinerules","workflows"):"",G6(D9(),"settings",gZ),lZ()])}function bV(X){return pZ([X?G6(X,".clinerules",Z60):"",G6(Z3(),Z60),F60()])}function J3(X){let Y=X.lastIndexOf(".");if(Y===-1)return!1;return z60.has(X.slice(Y))}function Ri0(X){try{let Y=JSON.parse(Ni0(X,"utf8"));if(!Y.cline||typeof Y.cline!=="object")return null;return Y.cline}catch{return null}}function Mi0(X){let Y=X?.plugins??X?.extensions;if(!Array.isArray(Y))return[];return Y.filter((W)=>typeof W==="string")}function q60(X){let Y=eW(X);if(!A5(Y)||!sW(Y).isDirectory())return null;let W=G6(Y,Ei0);if(A5(W)){let z=Ri0(W),F=Mi0(z).map((Q)=>eW(Y,Q)).filter((Q)=>A5(Q)&&sW(Q).isFile()&&J3(Q));if(F.length>0)return F}for(let z of Ci0){let F=G6(Y,z);if(A5(F)&&sW(F).isFile())return[F]}return null}function W3(X){let Y=eW(X);if(!A5(Y))return[];let W=[],z=[Y];while(z.length>0){let F=z.pop();if(!F)continue;for(let Q of Ui0(F,{withFileTypes:!0})){let J=G6(F,Q.name);if(Q.isDirectory()){z.push(J);continue}if(Q.name.startsWith("."))continue;if(Q.isFile()&&J3(J))W.push(J)}}return W.sort((F,Q)=>F.localeCompare(Q))}function uV(X,Y){let W=[];for(let z of X){let F=z.trim();if(!F)continue;let Q=eW(Y,F);if(!A5(Q))throw Error(`Plugin path does not exist: ${Q}`);if(sW(Q).isDirectory()){let Z=q60(Q);if(Z){W.push(...Z);continue}W.push(...W3(Q));continue}if(!J3(Q))throw Error(`Plugin file must use a supported extension (${[...z60].join(", ")}): ${Q}`);W.push(Q)}return W}function G3(X){let Y=J60(X);if(!A5(Y))Q60(Y,{recursive:!0})}function Li0(X){if(X?.trim())return G3(X),J60(X);let Y=G6(D9(),"hooks");if(!A5(Y))Q60(Y,{recursive:!0});return Y}var Y3="agents",uZ="hooks",w8="skills",mZ="rules",gZ="workflows",Z60="plugins",W60="cline_mcp_settings.json",mX,G60=!1,X3,K60=!1,z60,Ei0="package.json",Ci0;var H60=WX(()=>{mX=Oi0();z60=new Set([".js",".mjs",".cjs",".ts",".mts",".cts"]),Ci0=["index.ts","index.mts","index.cts","index.js","index.mjs","index.cjs"]});var w6=WX(()=>{H60()});var V60=X0((iZ,mV)=>{(function(X,Y){typeof iZ=="object"&&typeof mV=="object"?mV.exports=Y(F1("child_process"),F1("crypto")):typeof define=="function"&&define.amd?define(["child_process","crypto"],Y):typeof iZ=="object"?iZ["electron-machine-id"]=Y(F1("child_process"),F1("crypto")):X["electron-machine-id"]=Y(X.child_process,X.crypto)})(iZ,function(X,Y){return function(W){function z(Q){if(F[Q])return F[Q].exports;var J=F[Q]={exports:{},id:Q,loaded:!1};return W[Q].call(J.exports,J,J.exports,z),J.loaded=!0,J.exports}var F={};return z.m=W,z.c=F,z.p="",z(0)}([function(W,z,F){W.exports=F(34)},function(W,z,F){var Q=F(29)("wks"),J=F(33),Z=F(2).Symbol,K=typeof Z=="function",H=W.exports=function(G){return Q[G]||(Q[G]=K&&Z[G]||(K?Z:J)("Symbol."+G))};H.store=Q},function(W,z){var F=W.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=F)},function(W,z,F){var Q=F(9);W.exports=function(J){if(!Q(J))throw TypeError(J+" is not an object!");return J}},function(W,z,F){W.exports=!F(24)(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},function(W,z,F){var Q=F(12),J=F(17);W.exports=F(4)?function(Z,K,H){return Q.f(Z,K,J(1,H))}:function(Z,K,H){return Z[K]=H,Z}},function(W,z){var F=W.exports={version:"2.4.0"};typeof __e=="number"&&(__e=F)},function(W,z,F){var Q=F(14);W.exports=function(J,Z,K){if(Q(J),Z===void 0)return J;switch(K){case 1:return function(H){return J.call(Z,H)};case 2:return function(H,G){return J.call(Z,H,G)};case 3:return function(H,G,q){return J.call(Z,H,G,q)}}return function(){return J.apply(Z,arguments)}}},function(W,z){var F={}.hasOwnProperty;W.exports=function(Q,J){return F.call(Q,J)}},function(W,z){W.exports=function(F){return typeof F=="object"?F!==null:typeof F=="function"}},function(W,z){W.exports={}},function(W,z){var F={}.toString;W.exports=function(Q){return F.call(Q).slice(8,-1)}},function(W,z,F){var Q=F(3),J=F(26),Z=F(32),K=Object.defineProperty;z.f=F(4)?Object.defineProperty:function(H,G,q){if(Q(H),G=Z(G,!0),Q(q),J)try{return K(H,G,q)}catch(B){}if("get"in q||"set"in q)throw TypeError("Accessors not supported!");return"value"in q&&(H[G]=q.value),H}},function(W,z,F){var Q=F(42),J=F(15);W.exports=function(Z){return Q(J(Z))}},function(W,z){W.exports=function(F){if(typeof F!="function")throw TypeError(F+" is not a function!");return F}},function(W,z){W.exports=function(F){if(F==null)throw TypeError("Can't call method on "+F);return F}},function(W,z,F){var Q=F(9),J=F(2).document,Z=Q(J)&&Q(J.createElement);W.exports=function(K){return Z?J.createElement(K):{}}},function(W,z){W.exports=function(F,Q){return{enumerable:!(1&F),configurable:!(2&F),writable:!(4&F),value:Q}}},function(W,z,F){var Q=F(12).f,J=F(8),Z=F(1)("toStringTag");W.exports=function(K,H,G){K&&!J(K=G?K:K.prototype,Z)&&Q(K,Z,{configurable:!0,value:H})}},function(W,z,F){var Q=F(29)("keys"),J=F(33);W.exports=function(Z){return Q[Z]||(Q[Z]=J(Z))}},function(W,z){var{ceil:F,floor:Q}=Math;W.exports=function(J){return isNaN(J=+J)?0:(J>0?Q:F)(J)}},function(W,z,F){var Q=F(11),J=F(1)("toStringTag"),Z=Q(function(){return arguments}())=="Arguments",K=function(H,G){try{return H[G]}catch(q){}};W.exports=function(H){var G,q,B;return H===void 0?"Undefined":H===null?"Null":typeof(q=K(G=Object(H),J))=="string"?q:Z?Q(G):(B=Q(G))=="Object"&&typeof G.callee=="function"?"Arguments":B}},function(W,z){W.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(W,z,F){var Q=F(2),J=F(6),Z=F(7),K=F(5),H="prototype",G=function(q,B,$){var R,E,U,A=q&G.F,T=q&G.G,I=q&G.S,C=q&G.P,M=q&G.B,w=q&G.W,P=T?J:J[B]||(J[B]={}),y=P[H],v=T?Q:I?Q[B]:(Q[B]||{})[H];T&&($=B);for(R in $)E=!A&&v&&v[R]!==void 0,E&&R in P||(U=E?v[R]:$[R],P[R]=T&&typeof v[R]!="function"?$[R]:M&&E?Z(U,Q):w&&v[R]==U?function(f){var _=function(b,x,k){if(this instanceof f){switch(arguments.length){case 0:return new f;case 1:return new f(b);case 2:return new f(b,x)}return new f(b,x,k)}return f.apply(this,arguments)};return _[H]=f[H],_}(U):C&&typeof U=="function"?Z(Function.call,U):U,C&&((P.virtual||(P.virtual={}))[R]=U,q&G.R&&y&&!y[R]&&K(y,R,U)))};G.F=1,G.G=2,G.S=4,G.P=8,G.B=16,G.W=32,G.U=64,G.R=128,W.exports=G},function(W,z){W.exports=function(F){try{return!!F()}catch(Q){return!0}}},function(W,z,F){W.exports=F(2).document&&document.documentElement},function(W,z,F){W.exports=!F(4)&&!F(24)(function(){return Object.defineProperty(F(16)("div"),"a",{get:function(){return 7}}).a!=7})},function(W,z,F){var Q=F(28),J=F(23),Z=F(57),K=F(5),H=F(8),G=F(10),q=F(45),B=F(18),$=F(52),R=F(1)("iterator"),E=!([].keys&&("next"in[].keys())),U="@@iterator",A="keys",T="values",I=function(){return this};W.exports=function(C,M,w,P,y,v,f){q(w,M,P);var _,b,x,k=function(e){if(!E&&e in h)return h[e];switch(e){case A:return function(){return new w(this,e)};case T:return function(){return new w(this,e)}}return function(){return new w(this,e)}},l=M+" Iterator",Z0=y==T,m=!1,h=C.prototype,p=h[R]||h[U]||y&&h[y],n=p||k(y),Q0=y?Z0?k("entries"):n:void 0,c=M=="Array"?h.entries||p:p;if(c&&(x=$(c.call(new C)),x!==Object.prototype&&(B(x,l,!0),Q||H(x,R)||K(x,R,I))),Z0&&p&&p.name!==T&&(m=!0,n=function(){return p.call(this)}),Q&&!f||!E&&!m&&h[R]||K(h,R,n),G[M]=n,G[l]=I,y)if(_={values:Z0?n:k(T),keys:v?n:k(A),entries:Q0},f)for(b in _)b in h||Z(h,b,_[b]);else J(J.P+J.F*(E||m),M,_);return _}},function(W,z){W.exports=!0},function(W,z,F){var Q=F(2),J="__core-js_shared__",Z=Q[J]||(Q[J]={});W.exports=function(K){return Z[K]||(Z[K]={})}},function(W,z,F){var Q,J,Z,K=F(7),H=F(41),G=F(25),q=F(16),B=F(2),$=B.process,R=B.setImmediate,E=B.clearImmediate,U=B.MessageChannel,A=0,T={},I="onreadystatechange",C=function(){var w=+this;if(T.hasOwnProperty(w)){var P=T[w];delete T[w],P()}},M=function(w){C.call(w.data)};R&&E||(R=function(w){for(var P=[],y=1;arguments.length>y;)P.push(arguments[y++]);return T[++A]=function(){H(typeof w=="function"?w:Function(w),P)},Q(A),A},E=function(w){delete T[w]},F(11)($)=="process"?Q=function(w){$.nextTick(K(C,w,1))}:U?(J=new U,Z=J.port2,J.port1.onmessage=M,Q=K(Z.postMessage,Z,1)):B.addEventListener&&typeof postMessage=="function"&&!B.importScripts?(Q=function(w){B.postMessage(w+"","*")},B.addEventListener("message",M,!1)):Q=(I in q("script"))?function(w){G.appendChild(q("script"))[I]=function(){G.removeChild(this),C.call(w)}}:function(w){setTimeout(K(C,w,1),0)}),W.exports={set:R,clear:E}},function(W,z,F){var Q=F(20),J=Math.min;W.exports=function(Z){return Z>0?J(Q(Z),9007199254740991):0}},function(W,z,F){var Q=F(9);W.exports=function(J,Z){if(!Q(J))return J;var K,H;if(Z&&typeof(K=J.toString)=="function"&&!Q(H=K.call(J)))return H;if(typeof(K=J.valueOf)=="function"&&!Q(H=K.call(J)))return H;if(!Z&&typeof(K=J.toString)=="function"&&!Q(H=K.call(J)))return H;throw TypeError("Can't convert object to primitive value")}},function(W,z){var F=0,Q=Math.random();W.exports=function(J){return"Symbol(".concat(J===void 0?"":J,")_",(++F+Q).toString(36))}},function(W,z,F){function Q(I){return I&&I.__esModule?I:{default:I}}function J(){return process.platform!=="win32"?"":process.arch==="ia32"&&process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?"mixed":"native"}function Z(I){return(0,R.createHash)("sha256").update(I).digest("hex")}function K(I){switch(U){case"darwin":return I.split("IOPlatformUUID")[1].split(`
28
- `)[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return I.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":return I.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"freebsd":return I.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw Error("Unsupported platform: "+process.platform)}}function H(I){var C=K((0,$.execSync)(T[U]).toString());return I?C:Z(C)}function G(I){return new B.default(function(C,M){return(0,$.exec)(T[U],{},function(w,P,y){if(w)return M(Error("Error while obtaining machine id: "+w.stack));var v=K(P.toString());return C(I?v:Z(v))})})}Object.defineProperty(z,"__esModule",{value:!0});var q=F(35),B=Q(q);z.machineIdSync=H,z.machineId=G;var $=F(70),R=F(71),E=process,U=E.platform,A={native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32"},T={darwin:"ioreg -rd1 -c IOPlatformExpertDevice",win32:A[J()]+"\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",linux:"( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :",freebsd:"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid"}},function(W,z,F){W.exports={default:F(36),__esModule:!0}},function(W,z,F){F(66),F(68),F(69),F(67),W.exports=F(6).Promise},function(W,z){W.exports=function(){}},function(W,z){W.exports=function(F,Q,J,Z){if(!(F instanceof Q)||Z!==void 0&&Z in F)throw TypeError(J+": incorrect invocation!");return F}},function(W,z,F){var Q=F(13),J=F(31),Z=F(62);W.exports=function(K){return function(H,G,q){var B,$=Q(H),R=J($.length),E=Z(q,R);if(K&&G!=G){for(;R>E;)if(B=$[E++],B!=B)return!0}else for(;R>E;E++)if((K||(E in $))&&$[E]===G)return K||E||0;return!K&&-1}}},function(W,$,F){var Q=F(7),J=F(44),Z=F(43),K=F(3),H=F(31),G=F(64),q={},B={},$=W.exports=function(R,E,U,A,T){var I,C,M,w,P=T?function(){return R}:G(R),y=Q(U,A,E?2:1),v=0;if(typeof P!="function")throw TypeError(R+" is not iterable!");if(Z(P)){for(I=H(R.length);I>v;v++)if(w=E?y(K(C=R[v])[0],C[1]):y(R[v]),w===q||w===B)return w}else for(M=P.call(R);!(C=M.next()).done;)if(w=J(M,y,C.value,E),w===q||w===B)return w};$.BREAK=q,$.RETURN=B},function(W,z){W.exports=function(F,Q,J){var Z=J===void 0;switch(Q.length){case 0:return Z?F():F.call(J);case 1:return Z?F(Q[0]):F.call(J,Q[0]);case 2:return Z?F(Q[0],Q[1]):F.call(J,Q[0],Q[1]);case 3:return Z?F(Q[0],Q[1],Q[2]):F.call(J,Q[0],Q[1],Q[2]);case 4:return Z?F(Q[0],Q[1],Q[2],Q[3]):F.call(J,Q[0],Q[1],Q[2],Q[3])}return F.apply(J,Q)}},function(W,z,F){var Q=F(11);W.exports=Object("z").propertyIsEnumerable(0)?Object:function(J){return Q(J)=="String"?J.split(""):Object(J)}},function(W,z,F){var Q=F(10),J=F(1)("iterator"),Z=Array.prototype;W.exports=function(K){return K!==void 0&&(Q.Array===K||Z[J]===K)}},function(W,z,F){var Q=F(3);W.exports=function(J,Z,K,H){try{return H?Z(Q(K)[0],K[1]):Z(K)}catch(q){var G=J.return;throw G!==void 0&&Q(G.call(J)),q}}},function(W,z,F){var Q=F(49),J=F(17),Z=F(18),K={};F(5)(K,F(1)("iterator"),function(){return this}),W.exports=function(H,G,q){H.prototype=Q(K,{next:J(1,q)}),Z(H,G+" Iterator")}},function(W,z,F){var Q=F(1)("iterator"),J=!1;try{var Z=[7][Q]();Z.return=function(){J=!0},Array.from(Z,function(){throw 2})}catch(K){}W.exports=function(K,H){if(!H&&!J)return!1;var G=!1;try{var q=[7],B=q[Q]();B.next=function(){return{done:G=!0}},q[Q]=function(){return B},K(q)}catch($){}return G}},function(W,z){W.exports=function(F,Q){return{value:Q,done:!!F}}},function(W,z,F){var Q=F(2),J=F(30).set,Z=Q.MutationObserver||Q.WebKitMutationObserver,K=Q.process,H=Q.Promise,G=F(11)(K)=="process";W.exports=function(){var q,B,$,R=function(){var T,I;for(G&&(T=K.domain)&&T.exit();q;){I=q.fn,q=q.next;try{I()}catch(C){throw q?$():B=void 0,C}}B=void 0,T&&T.enter()};if(G)$=function(){K.nextTick(R)};else if(Z){var E=!0,U=document.createTextNode("");new Z(R).observe(U,{characterData:!0}),$=function(){U.data=E=!E}}else if(H&&H.resolve){var A=H.resolve();$=function(){A.then(R)}}else $=function(){J.call(Q,R)};return function(T){var I={fn:T,next:void 0};B&&(B.next=I),q||(q=I,$()),B=I}}},function(W,z,F){var Q=F(3),J=F(50),Z=F(22),K=F(19)("IE_PROTO"),H=function(){},G="prototype",q=function(){var B,$=F(16)("iframe"),R=Z.length,E=">";for($.style.display="none",F(25).appendChild($),$.src="javascript:",B=$.contentWindow.document,B.open(),B.write("<script>document.F=Object</script"+E),B.close(),q=B.F;R--;)delete q[G][Z[R]];return q()};W.exports=Object.create||function(B,$){var R;return B!==null?(H[G]=Q(B),R=new H,H[G]=null,R[K]=B):R=q(),$===void 0?R:J(R,$)}},function(W,z,F){var Q=F(12),J=F(3),Z=F(54);W.exports=F(4)?Object.defineProperties:function(K,H){J(K);for(var G,q=Z(H),B=q.length,$=0;B>$;)Q.f(K,G=q[$++],H[G]);return K}},function(W,z,F){var Q=F(55),J=F(17),Z=F(13),K=F(32),H=F(8),G=F(26),q=Object.getOwnPropertyDescriptor;z.f=F(4)?q:function(B,$){if(B=Z(B),$=K($,!0),G)try{return q(B,$)}catch(R){}if(H(B,$))return J(!Q.f.call(B,$),B[$])}},function(W,z,F){var Q=F(8),J=F(63),Z=F(19)("IE_PROTO"),K=Object.prototype;W.exports=Object.getPrototypeOf||function(H){return H=J(H),Q(H,Z)?H[Z]:typeof H.constructor=="function"&&H instanceof H.constructor?H.constructor.prototype:H instanceof Object?K:null}},function(W,z,F){var Q=F(8),J=F(13),Z=F(39)(!1),K=F(19)("IE_PROTO");W.exports=function(H,G){var q,B=J(H),$=0,R=[];for(q in B)q!=K&&Q(B,q)&&R.push(q);for(;G.length>$;)Q(B,q=G[$++])&&(~Z(R,q)||R.push(q));return R}},function(W,z,F){var Q=F(53),J=F(22);W.exports=Object.keys||function(Z){return Q(Z,J)}},function(W,z){z.f={}.propertyIsEnumerable},function(W,z,F){var Q=F(5);W.exports=function(J,Z,K){for(var H in Z)K&&J[H]?J[H]=Z[H]:Q(J,H,Z[H]);return J}},function(W,z,F){W.exports=F(5)},function(W,z,F){var Q=F(9),J=F(3),Z=function(K,H){if(J(K),!Q(H)&&H!==null)throw TypeError(H+": can't set as prototype!")};W.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(K,H,G){try{G=F(7)(Function.call,F(51).f(Object.prototype,"__proto__").set,2),G(K,[]),H=!(K instanceof Array)}catch(q){H=!0}return function(q,B){return Z(q,B),H?q.__proto__=B:G(q,B),q}}({},!1):void 0),check:Z}},function(W,z,F){var Q=F(2),J=F(6),Z=F(12),K=F(4),H=F(1)("species");W.exports=function(G){var q=typeof J[G]=="function"?J[G]:Q[G];K&&q&&!q[H]&&Z.f(q,H,{configurable:!0,get:function(){return this}})}},function(W,z,F){var Q=F(3),J=F(14),Z=F(1)("species");W.exports=function(K,H){var G,q=Q(K).constructor;return q===void 0||(G=Q(q)[Z])==null?H:J(G)}},function(W,z,F){var Q=F(20),J=F(15);W.exports=function(Z){return function(K,H){var G,q,B=String(J(K)),$=Q(H),R=B.length;return $<0||$>=R?Z?"":void 0:(G=B.charCodeAt($),G<55296||G>56319||$+1===R||(q=B.charCodeAt($+1))<56320||q>57343?Z?B.charAt($):G:Z?B.slice($,$+2):(G-55296<<10)+(q-56320)+65536)}}},function(W,z,F){var Q=F(20),J=Math.max,Z=Math.min;W.exports=function(K,H){return K=Q(K),K<0?J(K+H,0):Z(K,H)}},function(W,z,F){var Q=F(15);W.exports=function(J){return Object(Q(J))}},function(W,z,F){var Q=F(21),J=F(1)("iterator"),Z=F(10);W.exports=F(6).getIteratorMethod=function(K){if(K!=null)return K[J]||K["@@iterator"]||Z[Q(K)]}},function(W,z,F){var Q=F(37),J=F(47),Z=F(10),K=F(13);W.exports=F(27)(Array,"Array",function(H,G){this._t=K(H),this._i=0,this._k=G},function(){var H=this._t,G=this._k,q=this._i++;return!H||q>=H.length?(this._t=void 0,J(1)):G=="keys"?J(0,q):G=="values"?J(0,H[q]):J(0,[q,H[q]])},"values"),Z.Arguments=Z.Array,Q("keys"),Q("values"),Q("entries")},function(W,z){},function(W,z,F){var Q,J,Z,K=F(28),H=F(2),G=F(7),q=F(21),B=F(23),$=F(9),R=(F(3),F(14)),E=F(38),U=F(40),A=(F(58).set,F(60)),T=F(30).set,I=F(48)(),C="Promise",M=H.TypeError,P=H.process,w=H[C],P=H.process,y=q(P)=="process",v=function(){},f=!!function(){try{var c=w.resolve(1),e=(c.constructor={})[F(1)("species")]=function(g){g(v,v)};return(y||typeof PromiseRejectionEvent=="function")&&c.then(v)instanceof e}catch(g){}}(),_=function(c,e){return c===e||c===w&&e===Z},b=function(c){var e;return!(!$(c)||typeof(e=c.then)!="function")&&e},x=function(c){return _(w,c)?new k(c):new J(c)},k=J=function(c){var e,g;this.promise=new c(function(u,r){if(e!==void 0||g!==void 0)throw M("Bad Promise constructor");e=u,g=r}),this.resolve=R(e),this.reject=R(g)},l=function(c){try{c()}catch(e){return{error:e}}},Z0=function(c,e){if(!c._n){c._n=!0;var g=c._c;I(function(){for(var u=c._v,r=c._s==1,t=0,J0=function(V0){var A0,L0,T0=r?V0.ok:V0.fail,U0=V0.resolve,Y0=V0.reject,K0=V0.domain;try{T0?(r||(c._h==2&&p(c),c._h=1),T0===!0?A0=u:(K0&&K0.enter(),A0=T0(u),K0&&K0.exit()),A0===V0.promise?Y0(M("Promise-chain cycle")):(L0=b(A0))?L0.call(A0,U0,Y0):U0(A0)):Y0(u)}catch(N0){Y0(N0)}};g.length>t;)J0(g[t++]);c._c=[],c._n=!1,e&&!c._h&&m(c)})}},m=function(c){T.call(H,function(){var e,g,u,r=c._v;if(h(c)&&(e=l(function(){y?P.emit("unhandledRejection",r,c):(g=H.onunhandledrejection)?g({promise:c,reason:r}):(u=H.console)&&u.error&&u.error("Unhandled promise rejection",r)}),c._h=y||h(c)?2:1),c._a=void 0,e)throw e.error})},h=function(c){if(c._h==1)return!1;for(var e,g=c._a||c._c,u=0;g.length>u;)if(e=g[u++],e.fail||!h(e.promise))return!1;return!0},p=function(c){T.call(H,function(){var e;y?P.emit("rejectionHandled",c):(e=H.onrejectionhandled)&&e({promise:c,reason:c._v})})},n=function(c){var e=this;e._d||(e._d=!0,e=e._w||e,e._v=c,e._s=2,e._a||(e._a=e._c.slice()),Z0(e,!0))},Q0=function(c){var e,g=this;if(!g._d){g._d=!0,g=g._w||g;try{if(g===c)throw M("Promise can't be resolved itself");(e=b(c))?I(function(){var u={_w:g,_d:!1};try{e.call(c,G(Q0,u,1),G(n,u,1))}catch(r){n.call(u,r)}}):(g._v=c,g._s=1,Z0(g,!1))}catch(u){n.call({_w:g,_d:!1},u)}}};f||(w=function(c){E(this,w,C,"_h"),R(c),Q.call(this);try{c(G(Q0,this,1),G(n,this,1))}catch(e){n.call(this,e)}},Q=function(c){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},Q.prototype=F(56)(w.prototype,{then:function(c,e){var g=x(A(this,w));return g.ok=typeof c!="function"||c,g.fail=typeof e=="function"&&e,g.domain=y?P.domain:void 0,this._c.push(g),this._a&&this._a.push(g),this._s&&Z0(this,!1),g.promise},catch:function(c){return this.then(void 0,c)}}),k=function(){var c=new Q;this.promise=c,this.resolve=G(Q0,c,1),this.reject=G(n,c,1)}),B(B.G+B.W+B.F*!f,{Promise:w}),F(18)(w,C),F(59)(C),Z=F(6)[C],B(B.S+B.F*!f,C,{reject:function(c){var e=x(this),g=e.reject;return g(c),e.promise}}),B(B.S+B.F*(K||!f),C,{resolve:function(c){if(c instanceof w&&_(c.constructor,this))return c;var e=x(this),g=e.resolve;return g(c),e.promise}}),B(B.S+B.F*!(f&&F(46)(function(c){w.all(c).catch(v)})),C,{all:function(c){var e=this,g=x(e),u=g.resolve,r=g.reject,t=l(function(){var J0=[],V0=0,A0=1;U(c,!1,function(L0){var T0=V0++,U0=!1;J0.push(void 0),A0++,e.resolve(L0).then(function(Y0){U0||(U0=!0,J0[T0]=Y0,--A0||u(J0))},r)}),--A0||u(J0)});return t&&r(t.error),g.promise},race:function(c){var e=this,g=x(e),u=g.reject,r=l(function(){U(c,!1,function(t){e.resolve(t).then(g.resolve,u)})});return r&&u(r.error),g.promise}})},function(W,z,F){var Q=F(61)(!0);F(27)(String,"String",function(J){this._t=String(J),this._i=0},function(){var J,Z=this._t,K=this._i;return K>=Z.length?{value:void 0,done:!0}:(J=Q(Z,K),this._i+=J.length,{value:J,done:!1})})},function(W,z,F){F(65);for(var Q=F(2),J=F(5),Z=F(10),K=F(1)("toStringTag"),H=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],G=0;G<5;G++){var q=H[G],B=Q[q],$=B&&B.prototype;$&&!$[K]&&J($,K,q),Z[q]=Z.Array}},function(W,z){W.exports=F1("child_process")},function(W,z){W.exports=F1("crypto")}])})});import{existsSync as Pi0,mkdirSync as wi0,readFileSync as Si0,writeFileSync as fi0}from"node:fs";import{resolve as yi0}from"node:path";import{nanoid as ki0}from"nanoid";function $7(X){let Y=X?.trim();if(Y)return Y;let W=ji0();if(W)return W;return hi0()}function ji0(){try{return B60.machineIdSync().trim()||void 0}catch{return}}function hi0(){let X=J8(),Y=yi0(X,vi0);try{if(Pi0(Y)){let z=Si0(Y,"utf8").trim();if(z.length>0)return z}}catch{}let W=`cl-${ki0()}`;try{wi0(X,{recursive:!0}),fi0(Y,W,"utf8")}catch{}return W}var B60,vi0="machine-id";var K3=WX(()=>{w6();B60=N9(V60(),1)});class F3{name;logger;enabled;constructor(X={}){this.name=X.name??"LoggerTelemetryAdapter",this.logger=X.logger,this.enabled=X.enabled??!0}emit(X,Y){if(!this.isEnabled())return;this.logger?.info?.("telemetry.event",{adapter:this.name,event:X,properties:Y})}emitRequired(X,Y){this.logger?.warn?.("telemetry.required_event",{adapter:this.name,event:X,properties:Y})}recordCounter(X,Y,W,z,F){if(!F&&!this.isEnabled())return;this.logger?.debug?.("telemetry.metric",{adapter:this.name,instrument:"counter",name:X,value:Y,attributes:W,description:z,required:F===!0})}recordHistogram(X,Y,W,z,F){if(!F&&!this.isEnabled())return;this.logger?.debug?.("telemetry.metric",{adapter:this.name,instrument:"histogram",name:X,value:Y,attributes:W,description:z,required:F===!0})}recordGauge(X,Y,W,z,F){if(!F&&!this.isEnabled())return;this.logger?.debug?.("telemetry.metric",{adapter:this.name,instrument:"gauge",name:X,value:Y,attributes:W,description:z,required:F===!0})}isEnabled(){return typeof this.enabled==="function"?this.enabled():this.enabled}async flush(){}async dispose(){}}class aZ{adapters;metadata;distinctId;commonProperties;constructor(X={}){if(this.adapters=[...X.adapters??[]],X.logger)this.adapters.push(new F3({logger:X.logger}));this.metadata={...X.metadata??{}},this.distinctId=X.distinctId,this.commonProperties={...X.commonProperties??{}}}addAdapter(X){this.adapters.push(X)}setDistinctId(X){this.distinctId=X}setMetadata(X){this.metadata={...X}}updateMetadata(X){this.metadata={...this.metadata,...X}}setCommonProperties(X){this.commonProperties={...X}}updateCommonProperties(X){this.commonProperties={...this.commonProperties,...X}}isEnabled(){return this.adapters.some((X)=>X.isEnabled())}capture(X){let Y=this.buildAttributes(X.properties);for(let W of this.adapters)W.emit(X.event,Y)}captureRequired(X,Y){let W=this.buildAttributes(Y);for(let z of this.adapters)z.emitRequired(X,W)}recordCounter(X,Y,W,z,F=!1){let Q=this.buildAttributes(W);for(let J of this.adapters)J.recordCounter(X,Y,Q,z,F)}recordHistogram(X,Y,W,z,F=!1){let Q=this.buildAttributes(W);for(let J of this.adapters)J.recordHistogram(X,Y,Q,z,F)}recordGauge(X,Y,W,z,F=!1){let Q=this.buildAttributes(W);for(let J of this.adapters)J.recordGauge(X,Y,Q,z,F)}async flush(){await Promise.all(this.adapters.map((X)=>X.flush()))}async dispose(){await Promise.all(this.adapters.map((X)=>X.dispose()))}buildAttributes(X){return{...this.commonProperties,...X,...this.metadata,...this.distinctId?{distinct_id:this.distinctId}:{}}}}var gV=()=>{};class q3{meterProvider;loggerProvider;options;constructor(X={}){this.options=X;let Y=new I60.Resource({[z3.ATTR_SERVICE_NAME]:X.serviceName??"cline",...X.serviceVersion?{[z3.ATTR_SERVICE_VERSION]:X.serviceVersion}:{}});if(this.meterProvider=this.createMeterProvider(Y),this.loggerProvider=this.createLoggerProvider(Y),this.meterProvider)N60.metrics.setGlobalMeterProvider(this.meterProvider);if(this.loggerProvider)A60.logs.setGlobalLoggerProvider(this.loggerProvider)}createAdapter(X){return new nY({...X,meterProvider:this.meterProvider,loggerProvider:this.loggerProvider})}createTelemetryService(X){let Y=this.createAdapter({name:X.name,enabled:this.options.enabled,metadata:X.metadata});return new aZ({adapters:[Y],distinctId:$7(X.distinctId),commonProperties:X.commonProperties,logger:X.logger})}async forceFlush(){await Promise.all([this.meterProvider?.forceFlush?.(),this.loggerProvider?.forceFlush?.()])}async dispose(){await Promise.all([this.meterProvider?.shutdown?.(),this.loggerProvider?.shutdown?.()])}createMeterProvider(X){let Y=U60(this.options.metricsExporter);if(Y.length===0)return null;let W=Math.max(1000,this.options.metricExportIntervalMs??this.options.metricExportInterval??60000),z=Math.min(30000,Math.floor(W*0.8)),F=Y.map((Q)=>xi0(Q,{endpoint:this.options.otlpEndpoint,headers:this.options.otlpHeaders,insecure:this.options.otlpInsecure??!1,protocol:"http/json",interval:W,timeout:z})).filter((Q)=>Q!==null);if(F.length===0)return null;return new D7.MeterProvider({resource:X,readers:F})}createLoggerProvider(X){let Y=U60(this.options.logsExporter);if(Y.length===0)return null;let W=new dX.LoggerProvider({resource:X});for(let z of Y){let F=_i0(z,{endpoint:this.options.otlpEndpoint,headers:this.options.otlpHeaders,insecure:this.options.otlpInsecure??!1,protocol:"http/json"});if(!F)continue;W.addLogRecordProcessor(new dX.BatchLogRecordProcessor(F,{maxQueueSize:this.options.logMaxQueueSize??2048,maxExportBatchSize:this.options.logBatchSize??512,scheduledDelayMillis:this.options.logBatchTimeoutMs??this.options.logBatchTimeout??5000}))}return W}}function dV(X){let Y=new q3(X),W=Y.createTelemetryService(X);return W.captureRequired("telemetry.provider_created",{provider:"opentelemetry",enabled:X.enabled??!0,logsExporter:Array.isArray(X.logsExporter)?X.logsExporter.join(","):X.logsExporter,metricsExporter:Array.isArray(X.metricsExporter)?X.metricsExporter.join(","):X.metricsExporter,otlpProtocol:X.otlpProtocol,hasOtlpEndpoint:Boolean(X.otlpEndpoint),serviceName:X.serviceName,serviceVersion:X.serviceVersion}),{provider:Y,telemetry:W}}function $60(X){if(X.enabled!==!0)return{telemetry:new aZ({distinctId:$7(X.distinctId)})};return dV(X)}function U60(X){if(!X)return[];return(Array.isArray(X)?X:X.split(",")).map((W)=>W.trim()).filter((W)=>W==="console"||W==="otlp")}function _i0(X,Y){if(X==="console")return new dX.ConsoleLogRecordExporter;if(!Y.endpoint)return null;let W=D60(Y.endpoint,"/v1/logs");return new O60.OTLPLogExporter({url:W,headers:Y.headers})}function xi0(X,Y){if(X==="console")return new D7.PeriodicExportingMetricReader({exporter:new D7.ConsoleMetricExporter,exportIntervalMillis:Y.interval,exportTimeoutMillis:Y.timeout});if(!Y.endpoint)return null;let W=D60(Y.endpoint,"/v1/metrics");return new D7.PeriodicExportingMetricReader({exporter:new T60.OTLPMetricExporter({url:W,headers:Y.headers}),exportIntervalMillis:Y.interval,exportTimeoutMillis:Y.timeout})}function D60(X,Y){let W=new URL(X),z=W.pathname.endsWith("/")?W.pathname.slice(0,-1):W.pathname;return W.pathname=z.endsWith(Y)?z:`${z}${Y}`,W.toString()}var N60,A60,O60,T60,I60,dX,D7,z3;var E60=WX(()=>{K3();gV();N60=N9(q1(),1),A60=N9(Gz(),1),O60=N9(Qu(),1),T60=N9(Iu(),1),I60=N9(eH(),1),dX=N9(hl(),1),D7=N9(Ha(),1),z3=N9(Y60(),1)});var C60={};$G0(C60,{createOpenTelemetryTelemetryService:()=>dV,createConfiguredTelemetryService:()=>$60,OpenTelemetryProvider:()=>q3,OpenTelemetryAdapter:()=>nY});var R60=WX(()=>{E60()});var u90=X0((hI1,b90)=>{(()=>{var X={"./node_modules/.pnpm/create-require@1.1.1/node_modules/create-require/create-require.js":(F,Q,J)=>{let Z=J("module"),K=J("path"),H=J("fs");F.exports=function(G){return G||(G=process.cwd()),function(q){try{return H.lstatSync(q).isDirectory()}catch(B){return!1}}(G)&&(G=K.join(G,"index.js")),Z.createRequire?Z.createRequire(G):Z.createRequireFromPath?Z.createRequireFromPath(G):function(q){let B=new Z.Module(q,null);return B.filename=q,B.paths=Z.Module._nodeModulePaths(K.dirname(q)),B._compile("module.exports = require;",q),B.exports}(G)}},"./node_modules/.pnpm/mlly@1.7.3/node_modules/mlly/dist lazy recursive":(F)=>{function Q(J){return Promise.resolve().then(()=>{var Z=Error("Cannot find module '"+J+"'");throw Z.code="MODULE_NOT_FOUND",Z})}Q.keys=()=>[],Q.resolve=Q,Q.id="./node_modules/.pnpm/mlly@1.7.3/node_modules/mlly/dist lazy recursive",F.exports=Q},"./node_modules/.pnpm/object-hash@3.0.0/node_modules/object-hash/index.js":(F,Q,J)=>{var Z=J("crypto");function K(E,U){return function(A,T){var I=T.algorithm!=="passthrough"?Z.createHash(T.algorithm):new R;I.write===void 0&&(I.write=I.update,I.end=I.update);var C=$(T,I);if(C.dispatch(A),I.update||I.end(""),I.digest)return I.digest(T.encoding==="buffer"?void 0:T.encoding);var M=I.read();if(T.encoding==="buffer")return M;return M.toString(T.encoding)}(E,U=q(E,U))}(Q=F.exports=K).sha1=function(E){return K(E)},Q.keys=function(E){return K(E,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},Q.MD5=function(E){return K(E,{algorithm:"md5",encoding:"hex"})},Q.keysMD5=function(E){return K(E,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var H=Z.getHashes?Z.getHashes().slice():["sha1","md5"];H.push("passthrough");var G=["buffer","hex","binary","base64"];function q(E,U){U=U||{};var A={};if(A.algorithm=U.algorithm||"sha1",A.encoding=U.encoding||"hex",A.excludeValues=!!U.excludeValues,A.algorithm=A.algorithm.toLowerCase(),A.encoding=A.encoding.toLowerCase(),A.ignoreUnknown=U.ignoreUnknown===!0,A.respectType=U.respectType!==!1,A.respectFunctionNames=U.respectFunctionNames!==!1,A.respectFunctionProperties=U.respectFunctionProperties!==!1,A.unorderedArrays=U.unorderedArrays===!0,A.unorderedSets=U.unorderedSets!==!1,A.unorderedObjects=U.unorderedObjects!==!1,A.replacer=U.replacer||void 0,A.excludeKeys=U.excludeKeys||void 0,E===void 0)throw Error("Object argument required.");for(var T=0;T<H.length;++T)H[T].toLowerCase()===A.algorithm.toLowerCase()&&(A.algorithm=H[T]);if(H.indexOf(A.algorithm)===-1)throw Error('Algorithm "'+A.algorithm+'" not supported. supported values: '+H.join(", "));if(G.indexOf(A.encoding)===-1&&A.algorithm!=="passthrough")throw Error('Encoding "'+A.encoding+'" not supported. supported values: '+G.join(", "));return A}function B(E){if(typeof E!="function")return!1;return/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(E))!=null}function $(E,U,A){A=A||[];var T=function(I){return U.update?U.update(I,"utf8"):U.write(I,"utf8")};return{dispatch:function(I){E.replacer&&(I=E.replacer(I));var C=typeof I;return I===null&&(C="null"),this["_"+C](I)},_object:function(I){var C=Object.prototype.toString.call(I),M=/\[object (.*)\]/i.exec(C);M=(M=M?M[1]:"unknown:["+C+"]").toLowerCase();var w;if((w=A.indexOf(I))>=0)return this.dispatch("[CIRCULAR:"+w+"]");if(A.push(I),typeof Buffer<"u"&&Buffer.isBuffer&&Buffer.isBuffer(I))return T("buffer:"),T(I);if(M==="object"||M==="function"||M==="asyncfunction"){var P=Object.keys(I);E.unorderedObjects&&(P=P.sort()),E.respectType===!1||B(I)||P.splice(0,0,"prototype","__proto__","constructor"),E.excludeKeys&&(P=P.filter(function(v){return!E.excludeKeys(v)})),T("object:"+P.length+":");var y=this;return P.forEach(function(v){y.dispatch(v),T(":"),E.excludeValues||y.dispatch(I[v]),T(",")})}if(!this["_"+M]){if(E.ignoreUnknown)return T("["+M+"]");throw Error('Unknown object type "'+M+'"')}this["_"+M](I)},_array:function(I,C){C=C!==void 0?C:E.unorderedArrays!==!1;var M=this;if(T("array:"+I.length+":"),!C||I.length<=1)return I.forEach(function(y){return M.dispatch(y)});var w=[],P=I.map(function(y){var v=new R,f=A.slice();return $(E,v,f).dispatch(y),w=w.concat(f.slice(A.length)),v.read().toString()});return A=A.concat(w),P.sort(),this._array(P,!1)},_date:function(I){return T("date:"+I.toJSON())},_symbol:function(I){return T("symbol:"+I.toString())},_error:function(I){return T("error:"+I.toString())},_boolean:function(I){return T("bool:"+I.toString())},_string:function(I){T("string:"+I.length+":"),T(I.toString())},_function:function(I){T("fn:"),B(I)?this.dispatch("[native]"):this.dispatch(I.toString()),E.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(I.name)),E.respectFunctionProperties&&this._object(I)},_number:function(I){return T("number:"+I.toString())},_xml:function(I){return T("xml:"+I.toString())},_null:function(){return T("Null")},_undefined:function(){return T("Undefined")},_regexp:function(I){return T("regex:"+I.toString())},_uint8array:function(I){return T("uint8array:"),this.dispatch(Array.prototype.slice.call(I))},_uint8clampedarray:function(I){return T("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(I))},_int8array:function(I){return T("int8array:"),this.dispatch(Array.prototype.slice.call(I))},_uint16array:function(I){return T("uint16array:"),this.dispatch(Array.prototype.slice.call(I))},_int16array:function(I){return T("int16array:"),this.dispatch(Array.prototype.slice.call(I))},_uint32array:function(I){return T("uint32array:"),this.dispatch(Array.prototype.slice.call(I))},_int32array:function(I){return T("int32array:"),this.dispatch(Array.prototype.slice.call(I))},_float32array:function(I){return T("float32array:"),this.dispatch(Array.prototype.slice.call(I))},_float64array:function(I){return T("float64array:"),this.dispatch(Array.prototype.slice.call(I))},_arraybuffer:function(I){return T("arraybuffer:"),this.dispatch(new Uint8Array(I))},_url:function(I){return T("url:"+I.toString())},_map:function(I){T("map:");var C=Array.from(I);return this._array(C,E.unorderedSets!==!1)},_set:function(I){T("set:");var C=Array.from(I);return this._array(C,E.unorderedSets!==!1)},_file:function(I){return T("file:"),this.dispatch([I.name,I.size,I.type,I.lastModfied])},_blob:function(){if(E.ignoreUnknown)return T("[blob]");throw Error(`Hashing Blob objects is currently not supported
28
+ `)[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return I.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":return I.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"freebsd":return I.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw Error("Unsupported platform: "+process.platform)}}function H(I){var C=K((0,$.execSync)(T[U]).toString());return I?C:Z(C)}function G(I){return new B.default(function(C,M){return(0,$.exec)(T[U],{},function(w,P,y){if(w)return M(Error("Error while obtaining machine id: "+w.stack));var v=K(P.toString());return C(I?v:Z(v))})})}Object.defineProperty(z,"__esModule",{value:!0});var q=F(35),B=Q(q);z.machineIdSync=H,z.machineId=G;var $=F(70),R=F(71),E=process,U=E.platform,A={native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32"},T={darwin:"ioreg -rd1 -c IOPlatformExpertDevice",win32:A[J()]+"\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",linux:"( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :",freebsd:"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid"}},function(W,z,F){W.exports={default:F(36),__esModule:!0}},function(W,z,F){F(66),F(68),F(69),F(67),W.exports=F(6).Promise},function(W,z){W.exports=function(){}},function(W,z){W.exports=function(F,Q,J,Z){if(!(F instanceof Q)||Z!==void 0&&Z in F)throw TypeError(J+": incorrect invocation!");return F}},function(W,z,F){var Q=F(13),J=F(31),Z=F(62);W.exports=function(K){return function(H,G,q){var B,$=Q(H),R=J($.length),E=Z(q,R);if(K&&G!=G){for(;R>E;)if(B=$[E++],B!=B)return!0}else for(;R>E;E++)if((K||(E in $))&&$[E]===G)return K||E||0;return!K&&-1}}},function(W,$,F){var Q=F(7),J=F(44),Z=F(43),K=F(3),H=F(31),G=F(64),q={},B={},$=W.exports=function(R,E,U,A,T){var I,C,M,w,P=T?function(){return R}:G(R),y=Q(U,A,E?2:1),v=0;if(typeof P!="function")throw TypeError(R+" is not iterable!");if(Z(P)){for(I=H(R.length);I>v;v++)if(w=E?y(K(C=R[v])[0],C[1]):y(R[v]),w===q||w===B)return w}else for(M=P.call(R);!(C=M.next()).done;)if(w=J(M,y,C.value,E),w===q||w===B)return w};$.BREAK=q,$.RETURN=B},function(W,z){W.exports=function(F,Q,J){var Z=J===void 0;switch(Q.length){case 0:return Z?F():F.call(J);case 1:return Z?F(Q[0]):F.call(J,Q[0]);case 2:return Z?F(Q[0],Q[1]):F.call(J,Q[0],Q[1]);case 3:return Z?F(Q[0],Q[1],Q[2]):F.call(J,Q[0],Q[1],Q[2]);case 4:return Z?F(Q[0],Q[1],Q[2],Q[3]):F.call(J,Q[0],Q[1],Q[2],Q[3])}return F.apply(J,Q)}},function(W,z,F){var Q=F(11);W.exports=Object("z").propertyIsEnumerable(0)?Object:function(J){return Q(J)=="String"?J.split(""):Object(J)}},function(W,z,F){var Q=F(10),J=F(1)("iterator"),Z=Array.prototype;W.exports=function(K){return K!==void 0&&(Q.Array===K||Z[J]===K)}},function(W,z,F){var Q=F(3);W.exports=function(J,Z,K,H){try{return H?Z(Q(K)[0],K[1]):Z(K)}catch(q){var G=J.return;throw G!==void 0&&Q(G.call(J)),q}}},function(W,z,F){var Q=F(49),J=F(17),Z=F(18),K={};F(5)(K,F(1)("iterator"),function(){return this}),W.exports=function(H,G,q){H.prototype=Q(K,{next:J(1,q)}),Z(H,G+" Iterator")}},function(W,z,F){var Q=F(1)("iterator"),J=!1;try{var Z=[7][Q]();Z.return=function(){J=!0},Array.from(Z,function(){throw 2})}catch(K){}W.exports=function(K,H){if(!H&&!J)return!1;var G=!1;try{var q=[7],B=q[Q]();B.next=function(){return{done:G=!0}},q[Q]=function(){return B},K(q)}catch($){}return G}},function(W,z){W.exports=function(F,Q){return{value:Q,done:!!F}}},function(W,z,F){var Q=F(2),J=F(30).set,Z=Q.MutationObserver||Q.WebKitMutationObserver,K=Q.process,H=Q.Promise,G=F(11)(K)=="process";W.exports=function(){var q,B,$,R=function(){var T,I;for(G&&(T=K.domain)&&T.exit();q;){I=q.fn,q=q.next;try{I()}catch(C){throw q?$():B=void 0,C}}B=void 0,T&&T.enter()};if(G)$=function(){K.nextTick(R)};else if(Z){var E=!0,U=document.createTextNode("");new Z(R).observe(U,{characterData:!0}),$=function(){U.data=E=!E}}else if(H&&H.resolve){var A=H.resolve();$=function(){A.then(R)}}else $=function(){J.call(Q,R)};return function(T){var I={fn:T,next:void 0};B&&(B.next=I),q||(q=I,$()),B=I}}},function(W,z,F){var Q=F(3),J=F(50),Z=F(22),K=F(19)("IE_PROTO"),H=function(){},G="prototype",q=function(){var B,$=F(16)("iframe"),R=Z.length,E=">";for($.style.display="none",F(25).appendChild($),$.src="javascript:",B=$.contentWindow.document,B.open(),B.write("<script>document.F=Object</script"+E),B.close(),q=B.F;R--;)delete q[G][Z[R]];return q()};W.exports=Object.create||function(B,$){var R;return B!==null?(H[G]=Q(B),R=new H,H[G]=null,R[K]=B):R=q(),$===void 0?R:J(R,$)}},function(W,z,F){var Q=F(12),J=F(3),Z=F(54);W.exports=F(4)?Object.defineProperties:function(K,H){J(K);for(var G,q=Z(H),B=q.length,$=0;B>$;)Q.f(K,G=q[$++],H[G]);return K}},function(W,z,F){var Q=F(55),J=F(17),Z=F(13),K=F(32),H=F(8),G=F(26),q=Object.getOwnPropertyDescriptor;z.f=F(4)?q:function(B,$){if(B=Z(B),$=K($,!0),G)try{return q(B,$)}catch(R){}if(H(B,$))return J(!Q.f.call(B,$),B[$])}},function(W,z,F){var Q=F(8),J=F(63),Z=F(19)("IE_PROTO"),K=Object.prototype;W.exports=Object.getPrototypeOf||function(H){return H=J(H),Q(H,Z)?H[Z]:typeof H.constructor=="function"&&H instanceof H.constructor?H.constructor.prototype:H instanceof Object?K:null}},function(W,z,F){var Q=F(8),J=F(13),Z=F(39)(!1),K=F(19)("IE_PROTO");W.exports=function(H,G){var q,B=J(H),$=0,R=[];for(q in B)q!=K&&Q(B,q)&&R.push(q);for(;G.length>$;)Q(B,q=G[$++])&&(~Z(R,q)||R.push(q));return R}},function(W,z,F){var Q=F(53),J=F(22);W.exports=Object.keys||function(Z){return Q(Z,J)}},function(W,z){z.f={}.propertyIsEnumerable},function(W,z,F){var Q=F(5);W.exports=function(J,Z,K){for(var H in Z)K&&J[H]?J[H]=Z[H]:Q(J,H,Z[H]);return J}},function(W,z,F){W.exports=F(5)},function(W,z,F){var Q=F(9),J=F(3),Z=function(K,H){if(J(K),!Q(H)&&H!==null)throw TypeError(H+": can't set as prototype!")};W.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(K,H,G){try{G=F(7)(Function.call,F(51).f(Object.prototype,"__proto__").set,2),G(K,[]),H=!(K instanceof Array)}catch(q){H=!0}return function(q,B){return Z(q,B),H?q.__proto__=B:G(q,B),q}}({},!1):void 0),check:Z}},function(W,z,F){var Q=F(2),J=F(6),Z=F(12),K=F(4),H=F(1)("species");W.exports=function(G){var q=typeof J[G]=="function"?J[G]:Q[G];K&&q&&!q[H]&&Z.f(q,H,{configurable:!0,get:function(){return this}})}},function(W,z,F){var Q=F(3),J=F(14),Z=F(1)("species");W.exports=function(K,H){var G,q=Q(K).constructor;return q===void 0||(G=Q(q)[Z])==null?H:J(G)}},function(W,z,F){var Q=F(20),J=F(15);W.exports=function(Z){return function(K,H){var G,q,B=String(J(K)),$=Q(H),R=B.length;return $<0||$>=R?Z?"":void 0:(G=B.charCodeAt($),G<55296||G>56319||$+1===R||(q=B.charCodeAt($+1))<56320||q>57343?Z?B.charAt($):G:Z?B.slice($,$+2):(G-55296<<10)+(q-56320)+65536)}}},function(W,z,F){var Q=F(20),J=Math.max,Z=Math.min;W.exports=function(K,H){return K=Q(K),K<0?J(K+H,0):Z(K,H)}},function(W,z,F){var Q=F(15);W.exports=function(J){return Object(Q(J))}},function(W,z,F){var Q=F(21),J=F(1)("iterator"),Z=F(10);W.exports=F(6).getIteratorMethod=function(K){if(K!=null)return K[J]||K["@@iterator"]||Z[Q(K)]}},function(W,z,F){var Q=F(37),J=F(47),Z=F(10),K=F(13);W.exports=F(27)(Array,"Array",function(H,G){this._t=K(H),this._i=0,this._k=G},function(){var H=this._t,G=this._k,q=this._i++;return!H||q>=H.length?(this._t=void 0,J(1)):G=="keys"?J(0,q):G=="values"?J(0,H[q]):J(0,[q,H[q]])},"values"),Z.Arguments=Z.Array,Q("keys"),Q("values"),Q("entries")},function(W,z){},function(W,z,F){var Q,J,Z,K=F(28),H=F(2),G=F(7),q=F(21),B=F(23),$=F(9),R=(F(3),F(14)),E=F(38),U=F(40),A=(F(58).set,F(60)),T=F(30).set,I=F(48)(),C="Promise",M=H.TypeError,P=H.process,w=H[C],P=H.process,y=q(P)=="process",v=function(){},f=!!function(){try{var c=w.resolve(1),e=(c.constructor={})[F(1)("species")]=function(g){g(v,v)};return(y||typeof PromiseRejectionEvent=="function")&&c.then(v)instanceof e}catch(g){}}(),_=function(c,e){return c===e||c===w&&e===Z},b=function(c){var e;return!(!$(c)||typeof(e=c.then)!="function")&&e},x=function(c){return _(w,c)?new k(c):new J(c)},k=J=function(c){var e,g;this.promise=new c(function(u,r){if(e!==void 0||g!==void 0)throw M("Bad Promise constructor");e=u,g=r}),this.resolve=R(e),this.reject=R(g)},l=function(c){try{c()}catch(e){return{error:e}}},Z0=function(c,e){if(!c._n){c._n=!0;var g=c._c;I(function(){for(var u=c._v,r=c._s==1,t=0,J0=function(V0){var A0,L0,T0=r?V0.ok:V0.fail,U0=V0.resolve,Y0=V0.reject,K0=V0.domain;try{T0?(r||(c._h==2&&p(c),c._h=1),T0===!0?A0=u:(K0&&K0.enter(),A0=T0(u),K0&&K0.exit()),A0===V0.promise?Y0(M("Promise-chain cycle")):(L0=b(A0))?L0.call(A0,U0,Y0):U0(A0)):Y0(u)}catch(N0){Y0(N0)}};g.length>t;)J0(g[t++]);c._c=[],c._n=!1,e&&!c._h&&m(c)})}},m=function(c){T.call(H,function(){var e,g,u,r=c._v;if(h(c)&&(e=l(function(){y?P.emit("unhandledRejection",r,c):(g=H.onunhandledrejection)?g({promise:c,reason:r}):(u=H.console)&&u.error&&u.error("Unhandled promise rejection",r)}),c._h=y||h(c)?2:1),c._a=void 0,e)throw e.error})},h=function(c){if(c._h==1)return!1;for(var e,g=c._a||c._c,u=0;g.length>u;)if(e=g[u++],e.fail||!h(e.promise))return!1;return!0},p=function(c){T.call(H,function(){var e;y?P.emit("rejectionHandled",c):(e=H.onrejectionhandled)&&e({promise:c,reason:c._v})})},n=function(c){var e=this;e._d||(e._d=!0,e=e._w||e,e._v=c,e._s=2,e._a||(e._a=e._c.slice()),Z0(e,!0))},Q0=function(c){var e,g=this;if(!g._d){g._d=!0,g=g._w||g;try{if(g===c)throw M("Promise can't be resolved itself");(e=b(c))?I(function(){var u={_w:g,_d:!1};try{e.call(c,G(Q0,u,1),G(n,u,1))}catch(r){n.call(u,r)}}):(g._v=c,g._s=1,Z0(g,!1))}catch(u){n.call({_w:g,_d:!1},u)}}};f||(w=function(c){E(this,w,C,"_h"),R(c),Q.call(this);try{c(G(Q0,this,1),G(n,this,1))}catch(e){n.call(this,e)}},Q=function(c){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},Q.prototype=F(56)(w.prototype,{then:function(c,e){var g=x(A(this,w));return g.ok=typeof c!="function"||c,g.fail=typeof e=="function"&&e,g.domain=y?P.domain:void 0,this._c.push(g),this._a&&this._a.push(g),this._s&&Z0(this,!1),g.promise},catch:function(c){return this.then(void 0,c)}}),k=function(){var c=new Q;this.promise=c,this.resolve=G(Q0,c,1),this.reject=G(n,c,1)}),B(B.G+B.W+B.F*!f,{Promise:w}),F(18)(w,C),F(59)(C),Z=F(6)[C],B(B.S+B.F*!f,C,{reject:function(c){var e=x(this),g=e.reject;return g(c),e.promise}}),B(B.S+B.F*(K||!f),C,{resolve:function(c){if(c instanceof w&&_(c.constructor,this))return c;var e=x(this),g=e.resolve;return g(c),e.promise}}),B(B.S+B.F*!(f&&F(46)(function(c){w.all(c).catch(v)})),C,{all:function(c){var e=this,g=x(e),u=g.resolve,r=g.reject,t=l(function(){var J0=[],V0=0,A0=1;U(c,!1,function(L0){var T0=V0++,U0=!1;J0.push(void 0),A0++,e.resolve(L0).then(function(Y0){U0||(U0=!0,J0[T0]=Y0,--A0||u(J0))},r)}),--A0||u(J0)});return t&&r(t.error),g.promise},race:function(c){var e=this,g=x(e),u=g.reject,r=l(function(){U(c,!1,function(t){e.resolve(t).then(g.resolve,u)})});return r&&u(r.error),g.promise}})},function(W,z,F){var Q=F(61)(!0);F(27)(String,"String",function(J){this._t=String(J),this._i=0},function(){var J,Z=this._t,K=this._i;return K>=Z.length?{value:void 0,done:!0}:(J=Q(Z,K),this._i+=J.length,{value:J,done:!1})})},function(W,z,F){F(65);for(var Q=F(2),J=F(5),Z=F(10),K=F(1)("toStringTag"),H=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],G=0;G<5;G++){var q=H[G],B=Q[q],$=B&&B.prototype;$&&!$[K]&&J($,K,q),Z[q]=Z.Array}},function(W,z){W.exports=F1("child_process")},function(W,z){W.exports=F1("crypto")}])})});import{existsSync as Pi0,mkdirSync as wi0,readFileSync as Si0,writeFileSync as fi0}from"node:fs";import{resolve as yi0}from"node:path";import{nanoid as ki0}from"nanoid";function $7(X){let Y=X?.trim();if(Y)return Y;let W=ji0();if(W)return W;return hi0()}function ji0(){try{return B60.machineIdSync().trim()||void 0}catch{return}}function hi0(){let X=J8(),Y=yi0(X,vi0);try{if(Pi0(Y)){let z=Si0(Y,"utf8").trim();if(z.length>0)return z}}catch{}let W=`cl-${ki0()}`;try{wi0(X,{recursive:!0}),fi0(Y,W,"utf8")}catch{}return W}var B60,vi0="machine-id";var K3=WX(()=>{w6();B60=N9(V60(),1)});class F3{name;logger;enabled;constructor(X={}){this.name=X.name??"LoggerTelemetryAdapter",this.logger=X.logger,this.enabled=X.enabled??!0}emit(X,Y){if(!this.isEnabled())return;this.logger?.info?.("telemetry.event",{adapter:this.name,event:X,properties:Y})}emitRequired(X,Y){this.logger?.warn?.("telemetry.required_event",{adapter:this.name,event:X,properties:Y})}recordCounter(X,Y,W,z,F){if(!F&&!this.isEnabled())return;this.logger?.debug?.("telemetry.metric",{adapter:this.name,instrument:"counter",name:X,value:Y,attributes:W,description:z,required:F===!0})}recordHistogram(X,Y,W,z,F){if(!F&&!this.isEnabled())return;this.logger?.debug?.("telemetry.metric",{adapter:this.name,instrument:"histogram",name:X,value:Y,attributes:W,description:z,required:F===!0})}recordGauge(X,Y,W,z,F){if(!F&&!this.isEnabled())return;this.logger?.debug?.("telemetry.metric",{adapter:this.name,instrument:"gauge",name:X,value:Y,attributes:W,description:z,required:F===!0})}isEnabled(){return typeof this.enabled==="function"?this.enabled():this.enabled}async flush(){}async dispose(){}}class aZ{adapters;metadata;distinctId;commonProperties;constructor(X={}){if(this.adapters=[...X.adapters??[]],X.logger)this.adapters.push(new F3({logger:X.logger}));this.metadata={...X.metadata??{}},this.distinctId=X.distinctId,this.commonProperties={...X.commonProperties??{}}}addAdapter(X){this.adapters.push(X)}setDistinctId(X){this.distinctId=X}setMetadata(X){this.metadata={...X}}updateMetadata(X){this.metadata={...this.metadata,...X}}setCommonProperties(X){this.commonProperties={...X}}updateCommonProperties(X){this.commonProperties={...this.commonProperties,...X}}isEnabled(){return this.adapters.some((X)=>X.isEnabled())}capture(X){let Y=this.buildAttributes(X.properties);for(let W of this.adapters)W.emit(X.event,Y)}captureRequired(X,Y){let W=this.buildAttributes(Y);for(let z of this.adapters)z.emitRequired(X,W)}recordCounter(X,Y,W,z,F=!1){let Q=this.buildAttributes(W);for(let J of this.adapters)J.recordCounter(X,Y,Q,z,F)}recordHistogram(X,Y,W,z,F=!1){let Q=this.buildAttributes(W);for(let J of this.adapters)J.recordHistogram(X,Y,Q,z,F)}recordGauge(X,Y,W,z,F=!1){let Q=this.buildAttributes(W);for(let J of this.adapters)J.recordGauge(X,Y,Q,z,F)}async flush(){await Promise.all(this.adapters.map((X)=>X.flush()))}async dispose(){await Promise.all(this.adapters.map((X)=>X.dispose()))}buildAttributes(X){return{...this.commonProperties,...X,...this.metadata,...this.distinctId?{distinct_id:this.distinctId}:{}}}}var gV=()=>{};class q3{meterProvider;loggerProvider;options;constructor(X={}){this.options=X;let Y=new I60.Resource({[z3.ATTR_SERVICE_NAME]:X.serviceName??"cline",...X.serviceVersion?{[z3.ATTR_SERVICE_VERSION]:X.serviceVersion}:{}});if(this.meterProvider=this.createMeterProvider(Y),this.loggerProvider=this.createLoggerProvider(Y),this.meterProvider)N60.metrics.setGlobalMeterProvider(this.meterProvider);if(this.loggerProvider)A60.logs.setGlobalLoggerProvider(this.loggerProvider)}createAdapter(X){return new nY({...X,meterProvider:this.meterProvider,loggerProvider:this.loggerProvider})}createTelemetryService(X){let Y=this.createAdapter({name:X.name,enabled:this.options.enabled,metadata:X.metadata});return new aZ({adapters:[Y],distinctId:$7(X.distinctId),commonProperties:X.commonProperties,logger:X.logger})}async forceFlush(){await Promise.all([this.meterProvider?.forceFlush?.(),this.loggerProvider?.forceFlush?.()])}async dispose(){await Promise.all([this.meterProvider?.shutdown?.(),this.loggerProvider?.shutdown?.()])}createMeterProvider(X){let Y=U60(this.options.metricsExporter);if(Y.length===0)return null;let W=Math.max(1000,this.options.metricExportIntervalMs??this.options.metricExportInterval??60000),z=Math.min(30000,Math.floor(W*0.8)),F=Y.map((Q)=>xi0(Q,{endpoint:this.options.otlpEndpoint,headers:this.options.otlpHeaders,insecure:this.options.otlpInsecure??!1,protocol:"http/json",interval:W,timeout:z})).filter((Q)=>Q!==null);if(F.length===0)return null;return new D7.MeterProvider({resource:X,readers:F})}createLoggerProvider(X){let Y=U60(this.options.logsExporter);if(Y.length===0)return null;let W=new dX.LoggerProvider({resource:X});for(let z of Y){let F=_i0(z,{endpoint:this.options.otlpEndpoint,headers:this.options.otlpHeaders,insecure:this.options.otlpInsecure??!1,protocol:"http/json"});if(!F)continue;W.addLogRecordProcessor(new dX.BatchLogRecordProcessor(F,{maxQueueSize:this.options.logMaxQueueSize??2048,maxExportBatchSize:this.options.logBatchSize??512,scheduledDelayMillis:this.options.logBatchTimeoutMs??this.options.logBatchTimeout??5000}))}return W}}function dV(X){let Y=new q3(X),W=Y.createTelemetryService(X);return W.captureRequired("telemetry.provider_created",{provider:"opentelemetry",enabled:X.enabled??!0,logsExporter:Array.isArray(X.logsExporter)?X.logsExporter.join(","):X.logsExporter,metricsExporter:Array.isArray(X.metricsExporter)?X.metricsExporter.join(","):X.metricsExporter,otlpProtocol:X.otlpProtocol,hasOtlpEndpoint:Boolean(X.otlpEndpoint),serviceName:X.serviceName,serviceVersion:X.serviceVersion}),{provider:Y,telemetry:W}}function $60(X){if(X.enabled!==!0)return{telemetry:new aZ({distinctId:$7(X.distinctId)})};return dV(X)}function U60(X){if(!X)return[];return(Array.isArray(X)?X:X.split(",")).map((W)=>W.trim()).filter((W)=>W==="console"||W==="otlp")}function _i0(X,Y){if(X==="console")return new dX.ConsoleLogRecordExporter;if(!Y.endpoint)return null;let W=D60(Y.endpoint,"/v1/logs");return new O60.OTLPLogExporter({url:W,headers:Y.headers})}function xi0(X,Y){if(X==="console")return new D7.PeriodicExportingMetricReader({exporter:new D7.ConsoleMetricExporter,exportIntervalMillis:Y.interval,exportTimeoutMillis:Y.timeout});if(!Y.endpoint)return null;let W=D60(Y.endpoint,"/v1/metrics");return new D7.PeriodicExportingMetricReader({exporter:new T60.OTLPMetricExporter({url:W,headers:Y.headers}),exportIntervalMillis:Y.interval,exportTimeoutMillis:Y.timeout})}function D60(X,Y){let W=new URL(X),z=W.pathname.endsWith("/")?W.pathname.slice(0,-1):W.pathname;return W.pathname=z.endsWith(Y)?z:`${z}${Y}`,W.toString()}var N60,A60,O60,T60,I60,dX,D7,z3;var E60=WX(()=>{K3();gV();N60=N9(q1(),1),A60=N9(Gz(),1),O60=N9(Qu(),1),T60=N9(Iu(),1),I60=N9(eH(),1),dX=N9(hl(),1),D7=N9(Ha(),1),z3=N9(Y60(),1)});var C60={};$G0(C60,{createOpenTelemetryTelemetryService:()=>dV,createConfiguredTelemetryService:()=>$60,OpenTelemetryProvider:()=>q3,OpenTelemetryAdapter:()=>nY});var R60=WX(()=>{E60()});var u90=X0((uI1,b90)=>{(()=>{var X={"./node_modules/.pnpm/create-require@1.1.1/node_modules/create-require/create-require.js":(F,Q,J)=>{let Z=J("module"),K=J("path"),H=J("fs");F.exports=function(G){return G||(G=process.cwd()),function(q){try{return H.lstatSync(q).isDirectory()}catch(B){return!1}}(G)&&(G=K.join(G,"index.js")),Z.createRequire?Z.createRequire(G):Z.createRequireFromPath?Z.createRequireFromPath(G):function(q){let B=new Z.Module(q,null);return B.filename=q,B.paths=Z.Module._nodeModulePaths(K.dirname(q)),B._compile("module.exports = require;",q),B.exports}(G)}},"./node_modules/.pnpm/mlly@1.7.3/node_modules/mlly/dist lazy recursive":(F)=>{function Q(J){return Promise.resolve().then(()=>{var Z=Error("Cannot find module '"+J+"'");throw Z.code="MODULE_NOT_FOUND",Z})}Q.keys=()=>[],Q.resolve=Q,Q.id="./node_modules/.pnpm/mlly@1.7.3/node_modules/mlly/dist lazy recursive",F.exports=Q},"./node_modules/.pnpm/object-hash@3.0.0/node_modules/object-hash/index.js":(F,Q,J)=>{var Z=J("crypto");function K(E,U){return function(A,T){var I=T.algorithm!=="passthrough"?Z.createHash(T.algorithm):new R;I.write===void 0&&(I.write=I.update,I.end=I.update);var C=$(T,I);if(C.dispatch(A),I.update||I.end(""),I.digest)return I.digest(T.encoding==="buffer"?void 0:T.encoding);var M=I.read();if(T.encoding==="buffer")return M;return M.toString(T.encoding)}(E,U=q(E,U))}(Q=F.exports=K).sha1=function(E){return K(E)},Q.keys=function(E){return K(E,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},Q.MD5=function(E){return K(E,{algorithm:"md5",encoding:"hex"})},Q.keysMD5=function(E){return K(E,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var H=Z.getHashes?Z.getHashes().slice():["sha1","md5"];H.push("passthrough");var G=["buffer","hex","binary","base64"];function q(E,U){U=U||{};var A={};if(A.algorithm=U.algorithm||"sha1",A.encoding=U.encoding||"hex",A.excludeValues=!!U.excludeValues,A.algorithm=A.algorithm.toLowerCase(),A.encoding=A.encoding.toLowerCase(),A.ignoreUnknown=U.ignoreUnknown===!0,A.respectType=U.respectType!==!1,A.respectFunctionNames=U.respectFunctionNames!==!1,A.respectFunctionProperties=U.respectFunctionProperties!==!1,A.unorderedArrays=U.unorderedArrays===!0,A.unorderedSets=U.unorderedSets!==!1,A.unorderedObjects=U.unorderedObjects!==!1,A.replacer=U.replacer||void 0,A.excludeKeys=U.excludeKeys||void 0,E===void 0)throw Error("Object argument required.");for(var T=0;T<H.length;++T)H[T].toLowerCase()===A.algorithm.toLowerCase()&&(A.algorithm=H[T]);if(H.indexOf(A.algorithm)===-1)throw Error('Algorithm "'+A.algorithm+'" not supported. supported values: '+H.join(", "));if(G.indexOf(A.encoding)===-1&&A.algorithm!=="passthrough")throw Error('Encoding "'+A.encoding+'" not supported. supported values: '+G.join(", "));return A}function B(E){if(typeof E!="function")return!1;return/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(E))!=null}function $(E,U,A){A=A||[];var T=function(I){return U.update?U.update(I,"utf8"):U.write(I,"utf8")};return{dispatch:function(I){E.replacer&&(I=E.replacer(I));var C=typeof I;return I===null&&(C="null"),this["_"+C](I)},_object:function(I){var C=Object.prototype.toString.call(I),M=/\[object (.*)\]/i.exec(C);M=(M=M?M[1]:"unknown:["+C+"]").toLowerCase();var w;if((w=A.indexOf(I))>=0)return this.dispatch("[CIRCULAR:"+w+"]");if(A.push(I),typeof Buffer<"u"&&Buffer.isBuffer&&Buffer.isBuffer(I))return T("buffer:"),T(I);if(M==="object"||M==="function"||M==="asyncfunction"){var P=Object.keys(I);E.unorderedObjects&&(P=P.sort()),E.respectType===!1||B(I)||P.splice(0,0,"prototype","__proto__","constructor"),E.excludeKeys&&(P=P.filter(function(v){return!E.excludeKeys(v)})),T("object:"+P.length+":");var y=this;return P.forEach(function(v){y.dispatch(v),T(":"),E.excludeValues||y.dispatch(I[v]),T(",")})}if(!this["_"+M]){if(E.ignoreUnknown)return T("["+M+"]");throw Error('Unknown object type "'+M+'"')}this["_"+M](I)},_array:function(I,C){C=C!==void 0?C:E.unorderedArrays!==!1;var M=this;if(T("array:"+I.length+":"),!C||I.length<=1)return I.forEach(function(y){return M.dispatch(y)});var w=[],P=I.map(function(y){var v=new R,f=A.slice();return $(E,v,f).dispatch(y),w=w.concat(f.slice(A.length)),v.read().toString()});return A=A.concat(w),P.sort(),this._array(P,!1)},_date:function(I){return T("date:"+I.toJSON())},_symbol:function(I){return T("symbol:"+I.toString())},_error:function(I){return T("error:"+I.toString())},_boolean:function(I){return T("bool:"+I.toString())},_string:function(I){T("string:"+I.length+":"),T(I.toString())},_function:function(I){T("fn:"),B(I)?this.dispatch("[native]"):this.dispatch(I.toString()),E.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(I.name)),E.respectFunctionProperties&&this._object(I)},_number:function(I){return T("number:"+I.toString())},_xml:function(I){return T("xml:"+I.toString())},_null:function(){return T("Null")},_undefined:function(){return T("Undefined")},_regexp:function(I){return T("regex:"+I.toString())},_uint8array:function(I){return T("uint8array:"),this.dispatch(Array.prototype.slice.call(I))},_uint8clampedarray:function(I){return T("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(I))},_int8array:function(I){return T("int8array:"),this.dispatch(Array.prototype.slice.call(I))},_uint16array:function(I){return T("uint16array:"),this.dispatch(Array.prototype.slice.call(I))},_int16array:function(I){return T("int16array:"),this.dispatch(Array.prototype.slice.call(I))},_uint32array:function(I){return T("uint32array:"),this.dispatch(Array.prototype.slice.call(I))},_int32array:function(I){return T("int32array:"),this.dispatch(Array.prototype.slice.call(I))},_float32array:function(I){return T("float32array:"),this.dispatch(Array.prototype.slice.call(I))},_float64array:function(I){return T("float64array:"),this.dispatch(Array.prototype.slice.call(I))},_arraybuffer:function(I){return T("arraybuffer:"),this.dispatch(new Uint8Array(I))},_url:function(I){return T("url:"+I.toString())},_map:function(I){T("map:");var C=Array.from(I);return this._array(C,E.unorderedSets!==!1)},_set:function(I){T("set:");var C=Array.from(I);return this._array(C,E.unorderedSets!==!1)},_file:function(I){return T("file:"),this.dispatch([I.name,I.size,I.type,I.lastModfied])},_blob:function(){if(E.ignoreUnknown)return T("[blob]");throw Error(`Hashing Blob objects is currently not supported
29
29
  (see https://github.com/puleos/object-hash/issues/26)
30
30
  Use "options.replacer" or "options.ignoreUnknown"
31
31
  `)},_domwindow:function(){return T("domwindow")},_bigint:function(I){return T("bigint:"+I.toString())},_process:function(){return T("process")},_timer:function(){return T("timer")},_pipe:function(){return T("pipe")},_tcp:function(){return T("tcp")},_udp:function(){return T("udp")},_tty:function(){return T("tty")},_statwatcher:function(){return T("statwatcher")},_securecontext:function(){return T("securecontext")},_connection:function(){return T("connection")},_zlib:function(){return T("zlib")},_context:function(){return T("context")},_nodescript:function(){return T("nodescript")},_httpparser:function(){return T("httpparser")},_dataview:function(){return T("dataview")},_signal:function(){return T("signal")},_fsevent:function(){return T("fsevent")},_tlswrap:function(){return T("tlswrap")}}}function R(){return{buf:"",write:function(E){this.buf+=E},end:function(E){this.buf+=E},read:function(){return this.buf}}}Q.writeToStream=function(E,U,A){return A===void 0&&(A=U,U={}),$(U=q(E,U),A).dispatch(E)}},"./node_modules/.pnpm/pirates@4.0.6/node_modules/pirates/lib/index.js":(F,Q,J)=>{F=J.nmd(F),Object.defineProperty(Q,"__esModule",{value:!0}),Q.addHook=function($,R={}){let E=!1,U=[],A=[],T,I=q._extensions[".js"],C=R.matcher||null,M=R.ignoreNodeModules!==!1;return T=R.extensions||R.exts||R.extension||R.ext||[".js"],Array.isArray(T)||(T=[T]),T.forEach((w)=>{if(typeof w!="string")throw TypeError(`Invalid Extension: ${w}`);let P=q._extensions[w]||I;A[w]=q._extensions[w],U[w]=q._extensions[w]=function(y,v){let f;E||function(_,b,x,k){if(typeof _!="string")return!1;if(b.indexOf(K.default.extname(_))===-1)return!1;let l=K.default.resolve(_);if(k&&G.test(l))return!1;if(x&&typeof x=="function")return!!x(l);return!0}(v,T,C,M)&&(f=y._compile,y._compile=function(_){y._compile=f;let b=$(_,v);if(typeof b!="string")throw Error(B);return y._compile(b,v)}),P(y,v)}}),function(){E||(E=!0,T.forEach((w)=>{q._extensions[w]===U[w]&&(A[w]?q._extensions[w]=A[w]:delete q._extensions[w])}))}};var Z=H(J("module")),K=H(J("path"));function H($){return $&&$.__esModule?$:{default:$}}let G=/^(?:.*[\\/])?node_modules(?:[\\/].*)?$/,q=F.constructor.length>1?F.constructor:Z.default,B=`[Pirates] A hook returned a non-string, or nothing at all! This is a violation of intergalactic law!
@@ -41,7 +41,7 @@ Defaulting to 2020, but this will stop working in the future.`)),S.ecmaVersion=1
41
41
  `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return c0(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),N){var d=this.pos-1;this.invalidStringToken(d,"Invalid escape sequence in template string")}default:if(S>=48&&S<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],q0=parseInt(i,8);return q0>255&&(i=i.slice(0,-1),q0=parseInt(i,8)),this.pos+=i.length-1,S=this.input.charCodeAt(this.pos),i==="0"&&S!==56&&S!==57||!this.strict&&!N||this.invalidStringToken(this.pos-1-i.length,N?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(q0)}return G1(S)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(S)}},j1.readHexChar=function(N){var S=this.pos,d=this.readInt(16,N);return d===null&&this.invalidStringToken(S,"Bad character escape sequence"),d},j1.readWord1=function(){this.containsEsc=!1;for(var N="",S=!0,d=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var q0=this.fullCharCodeAtPos();if(K0(q0,i))this.pos+=q0<=65535?1:2;else{if(q0!==92)break;this.containsEsc=!0,N+=this.input.slice(d,this.pos);var E0=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var C0=this.readCodePoint();(S?Y0:K0)(C0,i)||this.invalidStringToken(E0,"Invalid Unicode escape"),N+=c0(C0),d=this.pos}S=!1}return N+this.input.slice(d,this.pos)},j1.readWord=function(){var N=this.readWord1(),S=o.name;return this.keywords.test(N)&&(S=R0[N]),this.finishToken(S,N)},t0.acorn={Parser:t0,version:"8.14.0",defaultOptions:S0,Position:W1,SourceLocation:N1,getLineInfo:H0,Node:E6,TokenType:N0,tokTypes:o,keywordTypes:R0,TokContext:L6,tokContexts:x1,isIdentifierChar:K0,isIdentifierStart:Y0,Token:l6,isNewLine:G1,lineBreak:k0,lineBreakG:J1,nonASCIIwhitespace:Y1};let c8=F1("module"),O8=F1("fs");String.fromCharCode;let YX=/\/$|\/\?|\/#/,ZX=/^\.?\//;function X5(N="",S){return S?YX.test(N):N.endsWith("/")}function zJ(N="",S){if(!S)return N.endsWith("/")?N:N+"/";if(X5(N,!0))return N||"/";let d=N,i="",q0=N.indexOf("#");if(q0>=0&&(d=N.slice(0,q0),i=N.slice(q0),!d))return i;let[E0,...C0]=d.split("?");return E0+"/"+(C0.length>0?`?${C0.join("?")}`:"")+i}function lY(N){return N&&N!=="/"}function qJ(N,...S){let d=N||"";for(let i of S.filter((q0)=>lY(q0)))if(d){let q0=i.replace(ZX,"");d=zJ(d)+q0}else d=i;return d}let M1=F1("url"),T8=F1("assert"),O=F1("process"),V=F1("path"),D=F1("v8"),L=F1("util"),j=new Set(c8.builtinModules);function a(N){return N.replace(/\\/g,"/")}let G0={}.hasOwnProperty,B0=/^([A-Z][a-z\d]*)+$/,I0=new Set(["string","function","number","object","Function","Object","boolean","bigint","symbol"]),D0={};function i0(N,S="and"){return N.length<3?N.join(` ${S} `):`${N.slice(0,-1).join(", ")}, ${S} ${N[N.length-1]}`}let K1=new Map,H1;function U1(N,S,d){return K1.set(N,S),function(i,q0){return E0;function E0(...C0){let y0=Error.stackTraceLimit;d1()&&(Error.stackTraceLimit=0);let l0=new i;d1()&&(Error.stackTraceLimit=y0);let Q1=function(u0,$1,S1){let t1=K1.get(u0);if(T8(t1!==void 0,"expected `message` to be found"),typeof t1=="function")return T8(t1.length<=$1.length,`Code: ${u0}; The provided arguments length (${$1.length}) does not match the required ones (${t1.length}).`),Reflect.apply(t1,S1,$1);let N6=/%[dfijoOs]/g,p6=0;for(;N6.exec(t1)!==null;)p6++;return T8(p6===$1.length,`Code: ${u0}; The provided arguments length (${$1.length}) does not match the required ones (${p6}).`),$1.length===0?t1:($1.unshift(t1),Reflect.apply(L.format,null,$1))}(q0,C0,l0);return Object.defineProperties(l0,{message:{value:Q1,enumerable:!1,writable:!0,configurable:!0},toString:{value(){return`${this.name} [${q0}]: ${this.message}`},enumerable:!1,writable:!0,configurable:!0}}),y6(l0),l0.code=q0,l0}}(d,N)}function d1(){try{if(D.startupSnapshot.isBuildingSnapshot())return!1}catch{}let N=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return N===void 0?Object.isExtensible(Error):G0.call(N,"writable")&&N.writable!==void 0?N.writable:N.set!==void 0}D0.ERR_INVALID_ARG_TYPE=U1("ERR_INVALID_ARG_TYPE",(N,S,d)=>{T8(typeof N=="string","'name' must be a string"),Array.isArray(S)||(S=[S]);let i="The ";if(N.endsWith(" argument"))i+=`${N} `;else{let y0=N.includes(".")?"property":"argument";i+=`"${N}" ${y0} `}i+="must be ";let q0=[],E0=[],C0=[];for(let y0 of S)T8(typeof y0=="string","All expected entries have to be of type string"),I0.has(y0)?q0.push(y0.toLowerCase()):B0.exec(y0)===null?(T8(y0!=="object",'The value "object" should be written as "Object"'),C0.push(y0)):E0.push(y0);if(E0.length>0){let y0=q0.indexOf("object");y0!==-1&&(q0.slice(y0,1),E0.push("Object"))}return q0.length>0&&(i+=`${q0.length>1?"one of type":"of type"} ${i0(q0,"or")}`,(E0.length>0||C0.length>0)&&(i+=" or ")),E0.length>0&&(i+=`an instance of ${i0(E0,"or")}`,C0.length>0&&(i+=" or ")),C0.length>0&&(C0.length>1?i+=`one of ${i0(C0,"or")}`:(C0[0].toLowerCase()!==C0[0]&&(i+="an "),i+=`${C0[0]}`)),i+=`. Received ${function(y0){if(y0==null)return String(y0);if(typeof y0=="function"&&y0.name)return`function ${y0.name}`;if(typeof y0=="object")return y0.constructor&&y0.constructor.name?`an instance of ${y0.constructor.name}`:`${(0,L.inspect)(y0,{depth:-1})}`;let l0=(0,L.inspect)(y0,{colors:!1});return l0.length>28&&(l0=`${l0.slice(0,25)}...`),`type ${typeof y0} (${l0})`}(d)}`,i},TypeError),D0.ERR_INVALID_MODULE_SPECIFIER=U1("ERR_INVALID_MODULE_SPECIFIER",(N,S,d=void 0)=>`Invalid module "${N}" ${S}${d?` imported from ${d}`:""}`,TypeError),D0.ERR_INVALID_PACKAGE_CONFIG=U1("ERR_INVALID_PACKAGE_CONFIG",(N,S,d)=>`Invalid package config ${N}${S?` while importing ${S}`:""}${d?`. ${d}`:""}`,Error),D0.ERR_INVALID_PACKAGE_TARGET=U1("ERR_INVALID_PACKAGE_TARGET",(N,S,d,i=!1,q0=void 0)=>{let E0=typeof d=="string"&&!i&&d.length>0&&!d.startsWith("./");return S==="."?(T8(i===!1),`Invalid "exports" main target ${JSON.stringify(d)} defined in the package config ${N}package.json${q0?` imported from ${q0}`:""}${E0?'; targets must start with "./"':""}`):`Invalid "${i?"imports":"exports"}" target ${JSON.stringify(d)} defined for '${S}' in the package config ${N}package.json${q0?` imported from ${q0}`:""}${E0?'; targets must start with "./"':""}`},Error),D0.ERR_MODULE_NOT_FOUND=U1("ERR_MODULE_NOT_FOUND",(N,S,d=!1)=>`Cannot find ${d?"module":"package"} '${N}' imported from ${S}`,Error),D0.ERR_NETWORK_IMPORT_DISALLOWED=U1("ERR_NETWORK_IMPORT_DISALLOWED","import of '%s' by %s is not supported: %s",Error),D0.ERR_PACKAGE_IMPORT_NOT_DEFINED=U1("ERR_PACKAGE_IMPORT_NOT_DEFINED",(N,S,d)=>`Package import specifier "${N}" is not defined${S?` in package ${S}package.json`:""} imported from ${d}`,TypeError),D0.ERR_PACKAGE_PATH_NOT_EXPORTED=U1("ERR_PACKAGE_PATH_NOT_EXPORTED",(N,S,d=void 0)=>S==="."?`No "exports" main defined in ${N}package.json${d?` imported from ${d}`:""}`:`Package subpath '${S}' is not defined by "exports" in ${N}package.json${d?` imported from ${d}`:""}`,Error),D0.ERR_UNSUPPORTED_DIR_IMPORT=U1("ERR_UNSUPPORTED_DIR_IMPORT","Directory import '%s' is not supported resolving ES modules imported from %s",Error),D0.ERR_UNSUPPORTED_RESOLVE_REQUEST=U1("ERR_UNSUPPORTED_RESOLVE_REQUEST",'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.',TypeError),D0.ERR_UNKNOWN_FILE_EXTENSION=U1("ERR_UNKNOWN_FILE_EXTENSION",(N,S)=>`Unknown file extension "${N}" for ${S}`,TypeError),D0.ERR_INVALID_ARG_VALUE=U1("ERR_INVALID_ARG_VALUE",(N,S,d="is invalid")=>{let i=(0,L.inspect)(S);return i.length>128&&(i=`${i.slice(0,128)}...`),`The ${N.includes(".")?"property":"argument"} '${N}' ${d}. Received ${i}`},TypeError);let y6=function(N){let S="__node_internal_"+N.name;return Object.defineProperty(N,"name",{value:S}),N}(function(N){let S=d1();return S&&(H1=Error.stackTraceLimit,Error.stackTraceLimit=Number.POSITIVE_INFINITY),Error.captureStackTrace(N),S&&(Error.stackTraceLimit=H1),N}),n1={}.hasOwnProperty,{ERR_INVALID_PACKAGE_CONFIG:K6}=D0,W9=new Map;function HJ(N,{base:S,specifier:d}){let i=W9.get(N);if(i)return i;let q0;try{q0=O8.readFileSync(V.toNamespacedPath(N),"utf8")}catch(C0){let y0=C0;if(y0.code!=="ENOENT")throw y0}let E0={exists:!1,pjsonPath:N,main:void 0,name:void 0,type:"none",exports:void 0,imports:void 0};if(q0!==void 0){let C0;try{C0=JSON.parse(q0)}catch(y0){let l0=y0,Q1=new K6(N,(S?`"${d}" from `:"")+(0,M1.fileURLToPath)(S||d),l0.message);throw Q1.cause=l0,Q1}E0.exists=!0,n1.call(C0,"name")&&typeof C0.name=="string"&&(E0.name=C0.name),n1.call(C0,"main")&&typeof C0.main=="string"&&(E0.main=C0.main),n1.call(C0,"exports")&&(E0.exports=C0.exports),n1.call(C0,"imports")&&(E0.imports=C0.imports),!n1.call(C0,"type")||C0.type!=="commonjs"&&C0.type!=="module"||(E0.type=C0.type)}return W9.set(N,E0),E0}function b5(N){let S=new URL("package.json",N);for(;;){if(S.pathname.endsWith("node_modules/package.json"))break;let d=HJ((0,M1.fileURLToPath)(S),{specifier:N});if(d.exists)return d;let i=S;if(S=new URL("../package.json",S),S.pathname===i.pathname)break}return{pjsonPath:(0,M1.fileURLToPath)(S),exists:!1,type:"none"}}function uO(N){return b5(N).type}let{ERR_UNKNOWN_FILE_EXTENSION:L30}=D0,P30={}.hasOwnProperty,w30={__proto__:null,".cjs":"commonjs",".js":"module",".json":"json",".mjs":"module"},mO={__proto__:null,"data:":function(N){let{1:S}=/^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(N.pathname)||[null,null,null];return function(d){return d&&/\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(d)?"module":d==="application/json"?"json":null}(S)},"file:":function(N,S,d){let i=function(C0){let y0=C0.pathname,l0=y0.length;for(;l0--;){let Q1=y0.codePointAt(l0);if(Q1===47)return"";if(Q1===46)return y0.codePointAt(l0-1)===47?"":y0.slice(l0)}return""}(N);if(i===".js"){let C0=uO(N);return C0!=="none"?C0:"commonjs"}if(i===""){let C0=uO(N);return C0==="none"||C0==="commonjs"?"commonjs":"module"}let q0=w30[i];if(q0)return q0;if(d)return;let E0=(0,M1.fileURLToPath)(N);throw new L30(i,E0)},"http:":gO,"https:":gO,"node:":()=>"builtin"};function gO(){}let VJ=RegExp.prototype[Symbol.replace],{ERR_NETWORK_IMPORT_DISALLOWED:VJ1,ERR_INVALID_MODULE_SPECIFIER:BJ,ERR_INVALID_PACKAGE_CONFIG:dO,ERR_INVALID_PACKAGE_TARGET:S30,ERR_MODULE_NOT_FOUND:eK,ERR_PACKAGE_IMPORT_NOT_DEFINED:f30,ERR_PACKAGE_PATH_NOT_EXPORTED:y30,ERR_UNSUPPORTED_DIR_IMPORT:k30,ERR_UNSUPPORTED_RESOLVE_REQUEST:cO}=D0,lO={}.hasOwnProperty,pO=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i,nO=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i,v30=/^\.|%|\\/,UJ=/\*/g,j30=/%2f|%5c/i,iO=new Set,h30=/[/\\]{2}/;function aO(N,S,d,i,q0,E0,C0){if(O.noDeprecation)return;let y0=(0,M1.fileURLToPath)(i),l0=h30.exec(C0?N:S)!==null;O.emitWarning(`Use of deprecated ${l0?"double slash":"leading or trailing slash matching"} resolving "${N}" for module request "${S}" ${S===d?"":`matched to "${d}" `}in the "${q0?"imports":"exports"}" field module resolution of the package at ${y0}${E0?` imported from ${(0,M1.fileURLToPath)(E0)}`:""}.`,"DeprecationWarning","DEP0166")}function rO(N,S,d,i){if(O.noDeprecation)return;if(function(l0,Q1){let u0=l0.protocol;return P30.call(mO,u0)&&mO[u0](l0,Q1,!0)||null}(N,{parentURL:d.href})!=="module")return;let E0=(0,M1.fileURLToPath)(N.href),C0=(0,M1.fileURLToPath)(new M1.URL(".",S)),y0=(0,M1.fileURLToPath)(d);i?V.resolve(C0,i)!==E0&&O.emitWarning(`Package ${C0} has a "main" field set to "${i}", excluding the full filename and extension to the resolved file at "${E0.slice(C0.length)}", imported from ${y0}.
42
42
  Automatic extension resolution of the "main" field is deprecated for ES modules.`,"DeprecationWarning","DEP0151"):O.emitWarning(`No "main" or "exports" field defined in the package.json for ${C0} resolving the main entry point "${E0.slice(C0.length)}", imported from ${y0}.
43
43
  Default "index" lookups for the main are deprecated for ES modules.`,"DeprecationWarning","DEP0151")}function oO(N){try{return(0,O8.statSync)(N)}catch{}}function XF(N){let S=(0,O8.statSync)(N,{throwIfNoEntry:!1}),d=S?S.isFile():void 0;return d!=null&&d}function _30(N,S,d){let i;if(S.main!==void 0){if(i=new M1.URL(S.main,N),XF(i))return i;let C0=[`./${S.main}.js`,`./${S.main}.json`,`./${S.main}.node`,`./${S.main}/index.js`,`./${S.main}/index.json`,`./${S.main}/index.node`],y0=-1;for(;++y0<C0.length&&(i=new M1.URL(C0[y0],N),!XF(i));)i=void 0;if(i)return rO(i,N,d,S.main),i}let q0=["./index.js","./index.json","./index.node"],E0=-1;for(;++E0<q0.length&&(i=new M1.URL(q0[E0],N),!XF(i));)i=void 0;if(i)return rO(i,N,d,S.main),i;throw new eK((0,M1.fileURLToPath)(new M1.URL(".",N)),(0,M1.fileURLToPath)(d))}function YF(N,S,d){return new y30((0,M1.fileURLToPath)(new M1.URL(".",S)),N,d&&(0,M1.fileURLToPath)(d))}function pY(N,S,d,i,q0){return S=typeof S=="object"&&S!==null?JSON.stringify(S,null,""):`${S}`,new S30((0,M1.fileURLToPath)(new M1.URL(".",d)),N,S,i,q0&&(0,M1.fileURLToPath)(q0))}function x30(N,S,d,i,q0,E0,C0,y0,l0){if(S!==""&&!E0&&N[N.length-1]!=="/")throw pY(d,N,i,C0,q0);if(!N.startsWith("./")){if(C0&&!N.startsWith("../")&&!N.startsWith("/")){let S1=!1;try{new M1.URL(N),S1=!0}catch{}if(!S1)return eO(E0?VJ.call(UJ,N,()=>S):N+S,i,l0)}throw pY(d,N,i,C0,q0)}if(pO.exec(N.slice(2))!==null){if(nO.exec(N.slice(2))!==null)throw pY(d,N,i,C0,q0);if(!y0){let S1=E0?d.replace("*",()=>S):d+S;aO(E0?VJ.call(UJ,N,()=>S):N,S1,d,i,C0,q0,!0)}}let Q1=new M1.URL(N,i),u0=Q1.pathname,$1=new M1.URL(".",i).pathname;if(!u0.startsWith($1))throw pY(d,N,i,C0,q0);if(S==="")return Q1;if(pO.exec(S)!==null){let S1=E0?d.replace("*",()=>S):d+S;if(nO.exec(S)===null){if(!y0)aO(E0?VJ.call(UJ,N,()=>S):N,S1,d,i,C0,q0,!1)}else(function(t1,N6,p6,G9,I6){let u5=`request is not a valid match in pattern "${N6}" for the "${G9?"imports":"exports"}" resolution of ${(0,M1.fileURLToPath)(p6)}`;throw new BJ(t1,u5,I6&&(0,M1.fileURLToPath)(I6))})(S1,d,i,C0,q0)}return E0?new M1.URL(VJ.call(UJ,Q1.href,()=>S)):new M1.URL(S,Q1)}function b30(N){let S=Number(N);return`${S}`===N&&(S>=0&&S<4294967295)}function QX(N,S,d,i,q0,E0,C0,y0,l0){if(typeof S=="string")return x30(S,d,i,N,q0,E0,C0,y0,l0);if(Array.isArray(S)){let Q1=S;if(Q1.length===0)return null;let u0,$1=-1;for(;++$1<Q1.length;){let S1=Q1[$1],t1;try{t1=QX(N,S1,d,i,q0,E0,C0,y0,l0)}catch(N6){if(u0=N6,N6.code==="ERR_INVALID_PACKAGE_TARGET")continue;throw N6}if(t1!==void 0){if(t1!==null)return t1;u0=null}}if(u0==null)return null;throw u0}if(typeof S=="object"&&S!==null){let Q1=Object.getOwnPropertyNames(S),u0=-1;for(;++u0<Q1.length;)if(b30(Q1[u0]))throw new dO((0,M1.fileURLToPath)(N),q0,'"exports" cannot contain numeric property keys.');for(u0=-1;++u0<Q1.length;){let $1=Q1[u0];if($1==="default"||l0&&l0.has($1)){let S1=QX(N,S[$1],d,i,q0,E0,C0,y0,l0);if(S1===void 0)continue;return S1}}return null}if(S===null)return null;throw pY(i,S,N,C0,q0)}function u30(N,S,d){if(O.noDeprecation)return;let i=(0,M1.fileURLToPath)(S);iO.has(i+"|"+N)||(iO.add(i+"|"+N),O.emitWarning(`Use of deprecated trailing slash pattern mapping "${N}" in the "exports" field module resolution of the package at ${i}${d?` imported from ${(0,M1.fileURLToPath)(d)}`:""}. Mapping specifiers ending in "/" is no longer supported.`,"DeprecationWarning","DEP0155"))}function tO(N,S,d,i,q0){let E0=d.exports;if(function(u0,$1,S1){if(typeof u0=="string"||Array.isArray(u0))return!0;if(typeof u0!="object"||u0===null)return!1;let t1=Object.getOwnPropertyNames(u0),N6=!1,p6=0,G9=-1;for(;++G9<t1.length;){let I6=t1[G9],u5=I6===""||I6[0]!==".";if(p6++==0)N6=u5;else if(N6!==u5)throw new dO((0,M1.fileURLToPath)($1),S1,`"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`)}return N6}(E0,N,i)&&(E0={".":E0}),lO.call(E0,S)&&!S.includes("*")&&!S.endsWith("/")){let u0=QX(N,E0[S],"",S,i,!1,!1,!1,q0);if(u0==null)throw YF(S,N,i);return u0}let C0="",y0="",l0=Object.getOwnPropertyNames(E0),Q1=-1;for(;++Q1<l0.length;){let u0=l0[Q1],$1=u0.indexOf("*");if($1!==-1&&S.startsWith(u0.slice(0,$1))){S.endsWith("/")&&u30(S,N,i);let S1=u0.slice($1+1);S.length>=u0.length&&S.endsWith(S1)&&sO(C0,u0)===1&&u0.lastIndexOf("*")===$1&&(C0=u0,y0=S.slice($1,S.length-S1.length))}}if(C0){let u0=QX(N,E0[C0],y0,C0,i,!0,!1,S.endsWith("/"),q0);if(u0==null)throw YF(S,N,i);return u0}throw YF(S,N,i)}function sO(N,S){let d=N.indexOf("*"),i=S.indexOf("*"),q0=d===-1?N.length:d+1,E0=i===-1?S.length:i+1;return q0>E0?-1:E0>q0||d===-1?1:i===-1||N.length>S.length?-1:S.length>N.length?1:0}function m30(N,S,d){if(N==="#"||N.startsWith("#/")||N.endsWith("/"))throw new BJ(N,"is not a valid internal imports specifier name",(0,M1.fileURLToPath)(S));let i,q0=b5(S);if(q0.exists){i=(0,M1.pathToFileURL)(q0.pjsonPath);let E0=q0.imports;if(E0)if(lO.call(E0,N)&&!N.includes("*")){let C0=QX(i,E0[N],"",N,S,!1,!0,!1,d);if(C0!=null)return C0}else{let C0="",y0="",l0=Object.getOwnPropertyNames(E0),Q1=-1;for(;++Q1<l0.length;){let u0=l0[Q1],$1=u0.indexOf("*");if($1!==-1&&N.startsWith(u0.slice(0,-1))){let S1=u0.slice($1+1);N.length>=u0.length&&N.endsWith(S1)&&sO(C0,u0)===1&&u0.lastIndexOf("*")===$1&&(C0=u0,y0=N.slice($1,N.length-S1.length))}}if(C0){let u0=QX(i,E0[C0],y0,C0,S,!0,!0,!1,d);if(u0!=null)return u0}}}throw function(E0,C0,y0){return new f30(E0,C0&&(0,M1.fileURLToPath)(new M1.URL(".",C0)),(0,M1.fileURLToPath)(y0))}(N,i,S)}function eO(N,S,d){if(c8.builtinModules.includes(N))return new M1.URL("node:"+N);let{packageName:i,packageSubpath:q0,isScoped:E0}=function(u0,$1){let S1=u0.indexOf("/"),t1=!0,N6=!1;u0[0]==="@"&&(N6=!0,S1===-1||u0.length===0?t1=!1:S1=u0.indexOf("/",S1+1));let p6=S1===-1?u0:u0.slice(0,S1);if(v30.exec(p6)!==null&&(t1=!1),!t1)throw new BJ(u0,"is not a valid package name",(0,M1.fileURLToPath)($1));return{packageName:p6,packageSubpath:"."+(S1===-1?"":u0.slice(S1)),isScoped:N6}}(N,S),C0=b5(S);if(C0.exists){let u0=(0,M1.pathToFileURL)(C0.pjsonPath);if(C0.name===i&&C0.exports!==void 0&&C0.exports!==null)return tO(u0,q0,C0,S,d)}let y0,l0=new M1.URL("./node_modules/"+i+"/package.json",S),Q1=(0,M1.fileURLToPath)(l0);do{let u0=oO(Q1.slice(0,-13));if(!u0||!u0.isDirectory()){y0=Q1,l0=new M1.URL((E0?"../../../../node_modules/":"../../../node_modules/")+i+"/package.json",l0),Q1=(0,M1.fileURLToPath)(l0);continue}let $1=HJ(Q1,{base:S,specifier:N});return $1.exports!==void 0&&$1.exports!==null?tO(l0,q0,$1,S,d):q0==="."?_30(l0,$1,S):new M1.URL(q0,l0)}while(Q1.length!==y0.length);throw new eK(i,(0,M1.fileURLToPath)(S),!1)}function g30(N,S,d,i){let q0=S.protocol,E0=q0==="data:"||q0==="http:"||q0==="https:",C0;if(function(y0){return y0!==""&&(y0[0]==="/"||function(l0){if(l0[0]==="."){if(l0.length===1||l0[1]==="/")return!0;if(l0[1]==="."&&(l0.length===2||l0[2]==="/"))return!0}return!1}(y0))}(N))try{C0=new M1.URL(N,S)}catch(y0){let l0=new cO(N,S);throw l0.cause=y0,l0}else if(q0==="file:"&&N[0]==="#")C0=m30(N,S,d);else try{C0=new M1.URL(N)}catch(y0){if(E0&&!c8.builtinModules.includes(N)){let l0=new cO(N,S);throw l0.cause=y0,l0}C0=eO(N,S,d)}return T8(C0!==void 0,"expected to be defined"),C0.protocol!=="file:"?C0:function(y0,l0,Q1){if(j30.exec(y0.pathname)!==null)throw new BJ(y0.pathname,'must not include encoded "/" or "\\" characters',(0,M1.fileURLToPath)(l0));let u0;try{u0=(0,M1.fileURLToPath)(y0)}catch(S1){let t1=S1;throw Object.defineProperty(t1,"input",{value:String(y0)}),Object.defineProperty(t1,"module",{value:String(l0)}),t1}let $1=oO(u0.endsWith("/")?u0.slice(-1):u0);if($1&&$1.isDirectory()){let S1=new k30(u0,(0,M1.fileURLToPath)(l0));throw S1.url=String(y0),S1}if(!$1||!$1.isFile()){let S1=new eK(u0||y0.pathname,l0&&(0,M1.fileURLToPath)(l0),!0);throw S1.url=String(y0),S1}if(!Q1){let S1=(0,O8.realpathSync)(u0),{search:t1,hash:N6}=y0;(y0=(0,M1.pathToFileURL)(S1+(u0.endsWith(V.sep)?"/":""))).search=t1,y0.hash=N6}return y0}(C0,S,i)}function NJ(N){return typeof N!="string"||N.startsWith("file://")?a((0,M1.fileURLToPath)(N)):a(N)}function ZF(N){return(0,M1.pathToFileURL)(NJ(N)).toString()}let d30=new Set(["node","import"]),c30=[".mjs",".cjs",".js",".json"],l30=new Set(["ERR_MODULE_NOT_FOUND","ERR_UNSUPPORTED_DIR_IMPORT","MODULE_NOT_FOUND","ERR_PACKAGE_PATH_NOT_EXPORTED"]);function XT(N,S,d){try{return g30(N,S,d)}catch(i){if(!l30.has(i?.code))throw i}}function p30(N,S={}){if(typeof N!="string"){if(!(N instanceof URL))throw TypeError("input must be a `string` or `URL`");N=NJ(N)}if(/(node|data|http|https):/.test(N))return N;if(j.has(N))return"node:"+N;if(N.startsWith("file://")&&(N=NJ(N)),I(N))try{if((0,O8.statSync)(N).isFile())return ZF(N)}catch(C0){if(C0?.code!=="ENOENT")throw C0}let d=S.conditions?new Set(S.conditions):d30,i=(Array.isArray(S.url)?S.url:[S.url]).filter(Boolean).map((C0)=>new URL(function(y0){return typeof y0!="string"&&(y0=y0.toString()),/(node|data|http|https|file):/.test(y0)?y0:j.has(y0)?"node:"+y0:"file://"+encodeURI(a(y0))}(C0.toString())));i.length===0&&i.push(new URL(ZF(process.cwd())));let q0=[...i];for(let C0 of i)C0.protocol==="file:"&&q0.push(new URL("./",C0),new URL(qJ(C0.pathname,"_index.js"),C0),new URL("node_modules",C0));let E0;for(let C0 of q0){if(E0=XT(N,C0,d),E0)break;for(let y0 of["","/index"]){for(let l0 of S.extensions||c30)if(E0=XT(qJ(N,y0)+l0,C0,d),E0)break;if(E0)break}if(E0)break}if(!E0){let C0=Error(`Cannot find module ${N} imported from ${q0.join(", ")}`);throw C0.code="ERR_MODULE_NOT_FOUND",C0}return ZF(E0)}function n30(N,S){return p30(N,S)}function i30(N,S){return NJ(n30(N,S))}let a30=/([\s;]|^)(import[\s\w*,{}]*from|import\s*["'*{]|export\b\s*(?:[*{]|default|class|type|function|const|var|let|async function)|import\.meta\b)/m,r30=/\/\*.+?\*\/|\/\/.*(?=[nr])/g;function o30(N,S={}){return S.stripComments&&(N=N.replace(r30,"")),a30.test(N)}var t30=W("crypto");function YT(N,S=8){return(0,t30.createHash)("md5").update(N).digest("hex").slice(0,S)}var s30=function(N,S,d,i){return new(d||(d=Promise))(function(q0,E0){function C0(Q1){try{l0(i.next(Q1))}catch(u0){E0(u0)}}function y0(Q1){try{l0(i.throw(Q1))}catch(u0){E0(u0)}}function l0(Q1){var u0;Q1.done?q0(Q1.value):(u0=Q1.value,u0 instanceof d?u0:new d(function($1){$1(u0)})).then(C0,y0)}l0((i=i.apply(N,S||[])).next())})};let e30=b(process.env.JITI_DEBUG),ZT=b(process.env.JITI_CACHE),XG0=b(process.env.JITI_ESM_RESOLVE),QT=b(process.env.JITI_REQUIRE_CACHE),JT=b(process.env.JITI_SOURCE_MAPS),YG0=b(process.env.JITI_ALIAS),ZG0=b(process.env.JITI_TRANSFORM_MODULES),QG0=b(process.env.JITI_NATIVE_MODULES),WT=b(process.env.JITI_EXPERIMENTAL_BUN),JG0=(0,Z.platform)()==="win32",WG0={debug:e30,cache:ZT===void 0||!!ZT,requireCache:QT===void 0||!!QT,sourceMaps:JT!==void 0&&!!JT,interopDefault:!1,esmResolve:XG0||!1,cacheVersion:"7",legacy:(0,Z0.lt)(process.version||"0.0.0","14.0.0"),extensions:[".js",".mjs",".cjs",".ts",".mts",".cts",".json"],alias:YG0,nativeModules:QG0||[],transformModules:ZG0||[],experimentalBun:WT===void 0?!!process.versions.bun:!!WT},GG0=/\.(c|m)?j(sx?)$/,KG0=/\.(c|m)?t(sx?)$/;function GT(N,S={},d,i){(S=Object.assign(Object.assign({},WG0),S)).legacy&&(S.cacheVersion+="-legacy"),S.transformOptions&&(S.cacheVersion+="-"+e()(S.transformOptions));let q0=S.alias&&Object.keys(S.alias).length>0?p(S.alias||{}):null,E0=["typescript","jiti",...S.nativeModules||[]],C0=[...S.transformModules||[]],y0=new RegExp(`node_modules/(${E0.map((I1)=>x(I1)).join("|")})/`),l0=new RegExp(`node_modules/(${C0.map((I1)=>x(I1)).join("|")})/`);function Q1(...I1){S.debug&&console.log("[jiti]",...I1)}if(N||(N=process.cwd()),function(I1){try{return(0,F.lstatSync)(I1).isDirectory()}catch(r1){return!1}}(N)&&(N=A(N,"index.js")),S.cache===!0&&(S.cache=function(){let I1=(0,Z.tmpdir)();if(process.env.TMPDIR&&I1===process.cwd()&&!process.env.JITI_RESPECT_TMPDIR_ENV){let r1=process.env.TMPDIR;delete process.env.TMPDIR,I1=(0,Z.tmpdir)(),process.env.TMPDIR=r1}return A(I1,"node-jiti")}()),S.cache)try{if((0,F.mkdirSync)(S.cache,{recursive:!0}),!function(I1){try{return(0,F.accessSync)(I1,F.constants.W_OK),!0}catch(r1){return!1}}(S.cache))throw Error("directory is not writable")}catch(I1){Q1("Error creating cache directory at ",S.cache,I1),S.cache=!1}let u0=l()(JG0?N.replace(/\//g,"\\"):N),$1=(I1,r1)=>{try{return u0.resolve(I1,r1)}catch(W6){}},S1=(0,G.pathToFileURL)(N),t1=[...S.extensions].filter((I1)=>I1!==".js"),N6=(I1,r1)=>{let W6,b6;if(q0&&(I1=function(h1,C6){let F6=B(h1);C6=p(C6);for(let[M9,Y5]of Object.entries(C6)){if(!F6.startsWith(M9))continue;let JX=n(M9)?M9.slice(0,-1):M9;if(n(F6[JX.length]))return A(Y5,F6.slice(M9.length))}return F6}(I1,q0)),S.esmResolve){let h1=[["node","require"],["node","import"]];for(let C6 of h1){try{W6=i30(I1,{url:S1,conditions:C6,extensions:S.extensions})}catch(F6){b6=F6}if(W6)return W6}}try{return u0.resolve(I1,r1)}catch(h1){b6=h1}for(let h1 of t1){if(W6=$1(I1+h1,r1)||$1(I1+"/index"+h1,r1),W6)return W6;if(KG0.test((d==null?void 0:d.filename)||"")&&(W6=$1(I1.replace(GG0,".$1t$2"),r1),W6))return W6}throw b6};function p6(I1){let r1=function(W6,b6,h1){if(!S.cache||!W6)return h1();let C6=` /* v${S.cacheVersion}-${YT(b6,16)} */`,F6=P(w(W6))+"-"+P(W6),M9=A(S.cache,F6+"."+YT(W6)+".js");if((0,F.existsSync)(M9)){let JX=(0,F.readFileSync)(M9,"utf8");if(JX.endsWith(C6))return Q1("[cache hit]",W6,"~>",M9),JX}Q1("[cache miss]",W6);let Y5=h1();return Y5.includes("__JITI_ERROR__")||(0,F.writeFileSync)(M9,Y5+C6,"utf8"),Y5}(I1.filename,I1.source,()=>{var W6;let b6=S.transform(Object.assign(Object.assign(Object.assign({legacy:S.legacy},S.transformOptions),{babel:Object.assign(Object.assign({},S.sourceMaps?{sourceFileName:I1.filename,sourceMaps:"inline"}:{}),(W6=S.transformOptions)===null||W6===void 0?void 0:W6.babel)}),I1));return b6.error&&S.debug&&Q1(b6.error),b6.code});return r1.startsWith("#!")&&(r1="// "+r1),r1}function G9(I1){return S.interopDefault?function(r1,W6={}){if((b6=r1)===null||typeof b6!="object"||!("default"in r1))return r1;var b6;let h1=r1.default;if(h1==null)return r1;let C6=typeof h1;if(C6!=="object"&&(C6!=="function"||W6.preferNamespace))return W6.preferNamespace?r1:h1;for(let F6 in r1)try{F6 in h1||Object.defineProperty(h1,F6,{enumerable:F6!=="default",configurable:F6!=="default",get:()=>r1[F6]})}catch{}return h1}(I1):I1}function I6(I1,r1){var W6;let b6=i||{};if(I1.startsWith("node:")?I1=I1.slice(5):I1.startsWith("file:")&&(I1=(0,G.fileURLToPath)(I1)),Q.builtinModules.includes(I1)||I1===".pnp.js")return u0(I1);if(S.experimentalBun&&!S.transformOptions)try{Q1(`[bun] [native] ${I1}`);let F6=u0(I1);return S.requireCache===!1&&delete u0.cache[I1],G9(F6)}catch(F6){Q1(`[bun] Using fallback for ${I1} because of an error:`,F6)}let h1=N6(I1),C6=M(h1);if(C6===".json"){Q1("[json]",h1);let F6=u0(I1);return Object.defineProperty(F6,"default",{value:F6}),F6}if(C6&&!S.extensions.includes(C6))return Q1("[unknown]",h1),u0(I1);if(y0.test(h1))return Q1("[native]",h1),u0(I1);if(b6[h1]&&(b6[h1].loaded===!0||(d==null?void 0:d.loaded)===!1))return G9((W6=b6[h1])===null||W6===void 0?void 0:W6.exports);if(S.requireCache&&u0.cache[h1]){let F6=u0.cache[h1];if(F6==null?void 0:F6.loaded)return G9(F6.exports)}return u5((0,F.readFileSync)(h1,"utf8"),{id:I1,filename:h1,ext:C6,cache:b6})}function u5(I1,r1={}){var W6;let b6=r1.id||(r1.filename?P(r1.filename):`_jitiEval.${r1.ext||".js"}`),h1=r1.filename||N6(b6),C6=r1.ext||M(h1),F6=r1.cache||i||{},M9=C6===".ts"||C6===".mts"||C6===".cts",Y5=C6===".mjs"||C6===".js"&&((W6=function(L9){for(;L9&&L9!=="."&&L9!=="/";){L9=A(L9,"..");try{let AJ=(0,F.readFileSync)(A(L9,"package.json"),"utf8");try{return JSON.parse(AJ)}catch(FT){}break}catch(AJ){}}}(h1))===null||W6===void 0?void 0:W6.type)==="module",JX=C6!==".cjs"&&(M9||Y5||l0.test(h1)||o30(I1)||S.legacy&&I1.match(/\?\.|\?\?/)),FG0=J.performance.now();if(JX)I1=p6({filename:h1,source:I1,ts:M9}),Q1("[transpile]"+(Y5?" [esm]":""),h1,`(${Math.round(1000*(J.performance.now()-FG0))/1000}ms)`);else try{return Q1("[native]",h1),G9(u0(b6))}catch(L9){Q1("Native require error:",L9),Q1("[fallback]",h1),I1=p6({filename:h1,source:I1,ts:M9})}let k6=new Q.Module(h1),KT;k6.filename=h1,d&&(k6.parent=d,Array.isArray(d.children)&&!d.children.includes(k6)&&d.children.push(k6)),k6.require=GT(h1,S,k6,F6),k6.path=w(h1),k6.paths=Q.Module._nodeModulePaths(k6.path),F6[h1]=k6,S.requireCache&&(u0.cache[h1]=k6);try{KT=H().runInThisContext(Q.Module.wrap(I1),{filename:h1,lineOffset:0,displayErrors:!1})}catch(L9){S.requireCache&&delete u0.cache[h1],S.onError(L9)}try{KT(k6.exports,k6.require,k6,k6.filename,w(k6.filename))}catch(L9){S.requireCache&&delete u0.cache[h1],S.onError(L9)}if(k6.exports&&k6.exports.__JITI_ERROR__){let{filename:L9,line:AJ,column:FT,code:zG0,message:qG0}=k6.exports.__JITI_ERROR__,zT=Error(`${zG0}: ${qG0}
44
- ${`${L9}:${AJ}:${FT}`}`);Error.captureStackTrace(zT,I6),S.onError(zT)}return k6.loaded=!0,G9(k6.exports)}return N6.paths=u0.resolve.paths,I6.resolve=N6,I6.cache=S.requireCache?u0.cache:{},I6.extensions=u0.extensions,I6.main=u0.main,I6.transform=p6,I6.register=function(){return(0,Q0.addHook)((I1,r1)=>I6.transform({source:I1,filename:r1,ts:!!/\.[cm]?ts$/.test(r1)}),{exts:S.extensions})},I6.evalModule=u5,I6.import=(I1,r1)=>s30(this,void 0,void 0,function*(){return yield I6(I1)}),I6}})(),b90.exports=z.default})()});var g90=X0((xI1,m90)=>{(()=>{var X={"./node_modules/.pnpm/@ampproject+remapping@2.3.0/node_modules/@ampproject/remapping/dist/remapping.umd.js":function(F,Q,J){F.exports=function(Z,K){let H=q("",-1,-1,"",null,!1),G=[];function q(w,P,y,v,f,_){return{source:w,line:P,column:y,name:v,content:f,ignore:_}}function B(w,P,y,v,f){return{map:w,sources:P,source:y,content:v,ignore:f}}function $(w,P){return B(w,P,"",null,!1)}function R(w,P,y){return B(null,G,w,P,y)}function E(w){let P=new K.GenMapping({file:w.map.file}),{sources:y,map:v}=w,f=v.names,_=Z.decodedMappings(v);for(let b=0;b<_.length;b++){let x=_[b];for(let k=0;k<x.length;k++){let l=x[k],Z0=l[0],m=H;if(l.length!==1&&(m=U(y[l[1]],l[2],l[3],l.length===5?f[l[4]]:""),m==null))continue;let{column:h,line:p,name:n,content:Q0,source:c,ignore:e}=m;K.maybeAddSegment(P,b,Z0,c,p,h,n),c&&Q0!=null&&K.setSourceContent(P,c,Q0),e&&K.setIgnore(P,c,!0)}}return P}function U(w,P,y,v){if(!w.map)return q(w.source,P,y,v,w.content,w.ignore);let f=Z.traceSegment(w.map,P,y);return f==null?null:f.length===1?H:U(w.sources[f[1]],f[2],f[3],f.length===5?w.map.names[f[4]]:v)}function A(w){return Array.isArray(w)?w:[w]}function T(w,P){let y=A(w).map((_)=>new Z.TraceMap(_,"")),v=y.pop();for(let _=0;_<y.length;_++)if(y[_].sources.length>1)throw Error(`Transformation map ${_} must have exactly one source file.
44
+ ${`${L9}:${AJ}:${FT}`}`);Error.captureStackTrace(zT,I6),S.onError(zT)}return k6.loaded=!0,G9(k6.exports)}return N6.paths=u0.resolve.paths,I6.resolve=N6,I6.cache=S.requireCache?u0.cache:{},I6.extensions=u0.extensions,I6.main=u0.main,I6.transform=p6,I6.register=function(){return(0,Q0.addHook)((I1,r1)=>I6.transform({source:I1,filename:r1,ts:!!/\.[cm]?ts$/.test(r1)}),{exts:S.extensions})},I6.evalModule=u5,I6.import=(I1,r1)=>s30(this,void 0,void 0,function*(){return yield I6(I1)}),I6}})(),b90.exports=z.default})()});var g90=X0((gI1,m90)=>{(()=>{var X={"./node_modules/.pnpm/@ampproject+remapping@2.3.0/node_modules/@ampproject/remapping/dist/remapping.umd.js":function(F,Q,J){F.exports=function(Z,K){let H=q("",-1,-1,"",null,!1),G=[];function q(w,P,y,v,f,_){return{source:w,line:P,column:y,name:v,content:f,ignore:_}}function B(w,P,y,v,f){return{map:w,sources:P,source:y,content:v,ignore:f}}function $(w,P){return B(w,P,"",null,!1)}function R(w,P,y){return B(null,G,w,P,y)}function E(w){let P=new K.GenMapping({file:w.map.file}),{sources:y,map:v}=w,f=v.names,_=Z.decodedMappings(v);for(let b=0;b<_.length;b++){let x=_[b];for(let k=0;k<x.length;k++){let l=x[k],Z0=l[0],m=H;if(l.length!==1&&(m=U(y[l[1]],l[2],l[3],l.length===5?f[l[4]]:""),m==null))continue;let{column:h,line:p,name:n,content:Q0,source:c,ignore:e}=m;K.maybeAddSegment(P,b,Z0,c,p,h,n),c&&Q0!=null&&K.setSourceContent(P,c,Q0),e&&K.setIgnore(P,c,!0)}}return P}function U(w,P,y,v){if(!w.map)return q(w.source,P,y,v,w.content,w.ignore);let f=Z.traceSegment(w.map,P,y);return f==null?null:f.length===1?H:U(w.sources[f[1]],f[2],f[3],f.length===5?w.map.names[f[4]]:v)}function A(w){return Array.isArray(w)?w:[w]}function T(w,P){let y=A(w).map((_)=>new Z.TraceMap(_,"")),v=y.pop();for(let _=0;_<y.length;_++)if(y[_].sources.length>1)throw Error(`Transformation map ${_} must have exactly one source file.
45
45
  Did you specify these with the most recent transformation maps first?`);let f=I(v,P,"",0);for(let _=y.length-1;_>=0;_--)f=$(y[_],[f]);return f}function I(w,P,y,v){let{resolvedSources:f,sourcesContent:_,ignoreList:b}=w,x=v+1;return $(w,f.map((k,l)=>{let Z0={importer:y,depth:x,source:k||"",content:void 0,ignore:void 0},m=P(Z0.source,Z0),{source:h,content:p,ignore:n}=Z0;return m?I(new Z.TraceMap(m,h),P,h,x):R(h,p!==void 0?p:_?_[l]:null,n!==void 0?n:!!b&&b.includes(l))}))}class C{constructor(w,P){let y=P.decodedMappings?K.toDecodedMap(w):K.toEncodedMap(w);this.version=y.version,this.file=y.file,this.mappings=y.mappings,this.names=y.names,this.ignoreList=y.ignoreList,this.sourceRoot=y.sourceRoot,this.sources=y.sources,P.excludeContent||(this.sourcesContent=y.sourcesContent)}toString(){return JSON.stringify(this)}}function M(w,P,y){let v=typeof y=="object"?y:{excludeContent:!!y,decodedMappings:!1},f=T(w,P);return new C(E(f),v)}return M}(J("./node_modules/.pnpm/@jridgewell+trace-mapping@0.3.25/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js"),J("./node_modules/.pnpm/@jridgewell+gen-mapping@0.3.8/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js"))},"./node_modules/.pnpm/@babel+core@7.26.0/node_modules/@babel/core/lib/config/files lazy recursive":(F)=>{function Q(J){return Promise.resolve().then(()=>{var Z=Error("Cannot find module '"+J+"'");throw Z.code="MODULE_NOT_FOUND",Z})}Q.keys=()=>[],Q.resolve=Q,Q.id="./node_modules/.pnpm/@babel+core@7.26.0/node_modules/@babel/core/lib/config/files lazy recursive",F.exports=Q},"./node_modules/.pnpm/@babel+core@7.26.0/node_modules/@babel/core/lib/config/files sync recursive":(F)=>{function Q(J){var Z=Error("Cannot find module '"+J+"'");throw Z.code="MODULE_NOT_FOUND",Z}Q.keys=()=>[],Q.resolve=Q,Q.id="./node_modules/.pnpm/@babel+core@7.26.0/node_modules/@babel/core/lib/config/files sync recursive",F.exports=Q},"./node_modules/.pnpm/@babel+plugin-syntax-class-properties@7.12.13_@babel+core@7.26.0/node_modules/@babel/plugin-syntax-class-properties/lib/index.js":(F,Q,J)=>{Object.defineProperty(Q,"__esModule",{value:!0}),Q.default=void 0;var Z=(0,J("./node_modules/.pnpm/@babel+helper-plugin-utils@7.25.9/node_modules/@babel/helper-plugin-utils/lib/index.js").declare)((K)=>(K.assertVersion(7),{name:"syntax-class-properties",manipulateOptions(H,G){G.plugins.push("classProperties","classPrivateProperties","classPrivateMethods")}}));Q.default=Z},"./node_modules/.pnpm/@jridgewell+gen-mapping@0.3.8/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js":function(F,Q,J){(function(Z,K,H,G){class A{constructor({file:c,sourceRoot:e}={}){this._names=new K.SetArray,this._sources=new K.SetArray,this._sourcesContent=[],this._mappings=[],this.file=c,this.sourceRoot=e,this._ignoreList=new K.SetArray}}function T(c){return c}function I(c,e,g,u,r,t,J0,V0){return x(!1,c,e,g,u,r,t,J0,V0)}function C(c,e){return Q0(!1,c,e)}let M=(c,e,g,u,r,t,J0,V0)=>x(!0,c,e,g,u,r,t,J0,V0),w=(c,e)=>Q0(!0,c,e);function P(c,e,g){let{_sources:u,_sourcesContent:r}=T(c);r[K.put(u,e)]=g}function y(c,e,g=!0){let{_sources:u,_sourcesContent:r,_ignoreList:t}=T(c),J0=K.put(u,e);J0===r.length&&(r[J0]=null),g?K.put(t,J0):K.remove(t,J0)}function v(c){let{_mappings:e,_sources:g,_sourcesContent:u,_names:r,_ignoreList:t}=T(c);return m(e),{version:3,file:c.file||void 0,names:r.array,sourceRoot:c.sourceRoot||void 0,sources:g.array,sourcesContent:u,mappings:e,ignoreList:t.array}}function f(c){let e=v(c);return Object.assign(Object.assign({},e),{mappings:H.encode(e.mappings)})}function _(c){let e=new G.TraceMap(c),g=new A({file:e.file,sourceRoot:e.sourceRoot});return h(T(g)._names,e.names),h(T(g)._sources,e.sources),T(g)._sourcesContent=e.sourcesContent||e.sources.map(()=>null),T(g)._mappings=G.decodedMappings(e),e.ignoreList&&h(T(g)._ignoreList,e.ignoreList),g}function b(c){let e=[],{_mappings:g,_sources:u,_names:r}=T(c);for(let t=0;t<g.length;t++){let J0=g[t];for(let V0=0;V0<J0.length;V0++){let A0=J0[V0],L0={line:t+1,column:A0[0]},T0,U0,Y0;A0.length!==1&&(T0=u.array[A0[1]],U0={line:A0[2]+1,column:A0[3]},A0.length===5&&(Y0=r.array[A0[4]])),e.push({generated:L0,source:T0,original:U0,name:Y0})}}return e}function x(c,e,g,u,r,t,J0,V0,A0){let{_mappings:L0,_sources:T0,_sourcesContent:U0,_names:Y0}=T(e),K0=k(L0,g),N0=l(K0,u);if(!r){if(c&&p(K0,N0))return;return Z0(K0,N0,[u])}let M0=K.put(T0,r),O0=V0?K.put(Y0,V0):-1;if(M0===U0.length&&(U0[M0]=A0!=null?A0:null),!c||!n(K0,N0,M0,t,J0,O0))return Z0(K0,N0,V0?[u,M0,t,J0,O0]:[u,M0,t,J0])}function k(c,e){for(let g=c.length;g<=e;g++)c[g]=[];return c[e]}function l(c,e){let g=c.length;for(let u=g-1;u>=0&&!(e>=c[u][0]);g=u--);return g}function Z0(c,e,g){for(let u=c.length;u>e;u--)c[u]=c[u-1];c[e]=g}function m(c){let{length:e}=c,g=e;for(let u=g-1;u>=0&&!(c[u].length>0);g=u,u--);g<e&&(c.length=g)}function h(c,e){for(let g=0;g<e.length;g++)K.put(c,e[g])}function p(c,e){return e===0||c[e-1].length===1}function n(c,e,g,u,r,t){if(e===0)return!1;let J0=c[e-1];return J0.length!==1&&g===J0[1]&&u===J0[2]&&r===J0[3]&&t===(J0.length===5?J0[4]:-1)}function Q0(c,e,g){let{generated:u,source:r,original:t,name:J0,content:V0}=g;return r?x(c,e,u.line-1,u.column,r,t.line-1,t.column,J0,V0):x(c,e,u.line-1,u.column,null,null,null,null,null)}Z.GenMapping=A,Z.addMapping=C,Z.addSegment=I,Z.allMappings=b,Z.fromMap=_,Z.maybeAddMapping=w,Z.maybeAddSegment=M,Z.setIgnore=y,Z.setSourceContent=P,Z.toDecodedMap=v,Z.toEncodedMap=f,Object.defineProperty(Z,"__esModule",{value:!0})})(Q,J("./node_modules/.pnpm/@jridgewell+set-array@1.2.1/node_modules/@jridgewell/set-array/dist/set-array.umd.js"),J("./node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js"),J("./node_modules/.pnpm/@jridgewell+trace-mapping@0.3.25/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js"))},"./node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js":function(F){F.exports=function(){let Q=/^[\w+.-]+:\/\//,J=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,Z=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function K(M){return Q.test(M)}function H(M){return M.startsWith("//")}function G(M){return M.startsWith("/")}function q(M){return M.startsWith("file:")}function B(M){return/^[.?#]/.test(M)}function $(M){let w=J.exec(M);return E(w[1],w[2]||"",w[3],w[4]||"",w[5]||"/",w[6]||"",w[7]||"")}function R(M){let w=Z.exec(M),P=w[2];return E("file:","",w[1]||"","",G(P)?P:"/"+P,w[3]||"",w[4]||"")}function E(M,w,P,y,v,f,_){return{scheme:M,user:w,host:P,port:y,path:v,query:f,hash:_,type:7}}function U(M){if(H(M)){let P=$("http:"+M);return P.scheme="",P.type=6,P}if(G(M)){let P=$("http://foo.com"+M);return P.scheme="",P.host="",P.type=5,P}if(q(M))return R(M);if(K(M))return $(M);let w=$("http://foo.com/"+M);return w.scheme="",w.host="",w.type=M?M.startsWith("?")?3:M.startsWith("#")?2:4:1,w}function A(M){if(M.endsWith("/.."))return M;let w=M.lastIndexOf("/");return M.slice(0,w+1)}function T(M,w){I(w,w.type),M.path==="/"?M.path=w.path:M.path=A(w.path)+M.path}function I(M,w){let P=w<=4,y=M.path.split("/"),v=1,f=0,_=!1;for(let x=1;x<y.length;x++){let k=y[x];k?(_=!1,k!=="."&&(k!==".."?(y[v++]=k,f++):f?(_=!0,f--,v--):P&&(y[v++]=k))):_=!0}let b="";for(let x=1;x<v;x++)b+="/"+y[x];(!b||_&&!b.endsWith("/.."))&&(b+="/"),M.path=b}function C(M,w){if(!M&&!w)return"";let P=U(M),y=P.type;if(w&&y!==7){let f=U(w),_=f.type;switch(y){case 1:P.hash=f.hash;case 2:P.query=f.query;case 3:case 4:T(P,f);case 5:P.user=f.user,P.host=f.host,P.port=f.port;case 6:P.scheme=f.scheme}_>y&&(y=_)}I(P,y);let v=P.query+P.hash;switch(y){case 2:case 3:return v;case 4:{let f=P.path.slice(1);return f?B(w||M)&&!B(f)?"./"+f+v:f+v:v||"."}case 5:return P.path+v;default:return P.scheme+"//"+P.user+P.host+P.port+P.path+v}}return C}()},"./node_modules/.pnpm/@jridgewell+set-array@1.2.1/node_modules/@jridgewell/set-array/dist/set-array.umd.js":function(F,Q){(function(J){class Z{constructor(){this._indexes={__proto__:null},this.array=[]}}function K($){return $}function H($,R){return K($)._indexes[R]}function G($,R){let E=H($,R);if(E!==void 0)return E;let{array:U,_indexes:A}=K($),T=U.push(R);return A[R]=T-1}function q($){let{array:R,_indexes:E}=K($);R.length!==0&&(E[R.pop()]=void 0)}function B($,R){let E=H($,R);if(E===void 0)return;let{array:U,_indexes:A}=K($);for(let T=E+1;T<U.length;T++){let I=U[T];U[T-1]=I,A[I]--}A[R]=void 0,U.pop()}J.SetArray=Z,J.get=H,J.pop=q,J.put=G,J.remove=B,Object.defineProperty(J,"__esModule",{value:!0})})(Q)},"./node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js":function(F,Q){(function(J){let G=new Uint8Array(64),q=new Uint8Array(128);for(let l=0;l<64;l++){let Z0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(l);G[l]=Z0,q[Z0]=l}function B(l,Z0){let m=0,h=0,p=0;do{let Q0=l.next();p=q[Q0],m|=(31&p)<<h,h+=5}while(32&p);let n=1&m;return m>>>=1,n&&(m=-2147483648|-m),Z0+m}function $(l,Z0,m){let h=Z0-m;h=h<0?-h<<1|1:h<<1;do{let p=31&h;h>>>=5,h>0&&(p|=32),l.write(G[p])}while(h>0);return Z0}function R(l,Z0){return!(l.pos>=Z0)&&l.peek()!==44}let E=16384,U=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode:(l)=>Buffer.from(l.buffer,l.byteOffset,l.byteLength).toString()}:{decode(l){let Z0="";for(let m=0;m<l.length;m++)Z0+=String.fromCharCode(l[m]);return Z0}};class A{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(E)}write(l){let{buffer:Z0}=this;Z0[this.pos++]=l,this.pos===E&&(this.out+=U.decode(Z0),this.pos=0)}flush(){let{buffer:l,out:Z0,pos:m}=this;return m>0?Z0+U.decode(l.subarray(0,m)):Z0}}class T{constructor(l){this.pos=0,this.buffer=l}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(l){let{buffer:Z0,pos:m}=this,h=Z0.indexOf(l,m);return h===-1?Z0.length:h}}let I=[];function C(l){let{length:Z0}=l,m=new T(l),h=[],p=[],n=0;for(;m.pos<Z0;m.pos++){n=B(m,n);let Q0=B(m,0);if(!R(m,Z0)){let u=p.pop();u[2]=n,u[3]=Q0;continue}let c=B(m,0),e=1&B(m,0)?[n,Q0,0,0,c,B(m,0)]:[n,Q0,0,0,c],g=I;if(R(m,Z0)){g=[];do{let u=B(m,0);g.push(u)}while(R(m,Z0))}e.vars=g,h.push(e),p.push(e)}return h}function M(l){let Z0=new A;for(let m=0;m<l.length;)m=w(l,m,Z0,[0]);return Z0.flush()}function w(l,Z0,m,h){let p=l[Z0],{0:n,1:Q0,2:c,3:e,4:g,vars:u}=p;Z0>0&&m.write(44),h[0]=$(m,n,h[0]),$(m,Q0,0),$(m,g,0),$(m,p.length===6?1:0,0),p.length===6&&$(m,p[5],0);for(let r of u)$(m,r,0);for(Z0++;Z0<l.length;){let r=l[Z0],{0:t,1:J0}=r;if(t>c||t===c&&J0>=e)break;Z0=w(l,Z0,m,h)}return m.write(44),h[0]=$(m,c,h[0]),$(m,e,0),Z0}function P(l){let{length:Z0}=l,m=new T(l),h=[],p=[],n=0,Q0=0,c=0,e=0,g=0,u=0,r=0,t=0;do{let J0=m.indexOf(";"),V0=0;for(;m.pos<J0;m.pos++){if(V0=B(m,V0),!R(m,J0)){let N0=p.pop();N0[2]=n,N0[3]=V0;continue}let A0=B(m,0),L0=2&A0,T0=4&A0,U0,Y0=null,K0=I;if(1&A0){let N0=B(m,Q0);c=B(m,Q0===N0?c:0),Q0=N0,U0=[n,V0,0,0,N0,c]}else U0=[n,V0,0,0];if(U0.isScope=!!T0,L0){let N0=e,M0=g;e=B(m,e);let O0=N0===e;g=B(m,O0?g:0),u=B(m,O0&&M0===g?u:0),Y0=[e,g,u]}if(U0.callsite=Y0,R(m,J0)){K0=[];do{r=n,t=V0;let N0=B(m,0),M0;if(N0<-1){M0=[[B(m,0)]];for(let O0=-1;O0>N0;O0--){let $0=r;r=B(m,r),t=B(m,r===$0?t:0);let R0=B(m,0);M0.push([R0,r,t])}}else M0=[[N0]];K0.push(M0)}while(R(m,J0))}U0.bindings=K0,h.push(U0),p.push(U0)}n++,m.pos=J0+1}while(m.pos<Z0);return h}function y(l){if(l.length===0)return"";let Z0=new A;for(let m=0;m<l.length;)m=v(l,m,Z0,[0,0,0,0,0,0,0]);return Z0.flush()}function v(l,Z0,m,h){let p=l[Z0],{0:n,1:Q0,2:c,3:e,isScope:g,callsite:u,bindings:r}=p;if(h[0]<n?(f(m,h[0],n),h[0]=n,h[1]=0):Z0>0&&m.write(44),h[1]=$(m,p[1],h[1]),$(m,(p.length===6?1:0)|(u?2:0)|(g?4:0),0),p.length===6){let{4:t,5:J0}=p;t!==h[2]&&(h[3]=0),h[2]=$(m,t,h[2]),h[3]=$(m,J0,h[3])}if(u){let{0:t,1:J0,2:V0}=p.callsite;t!==h[4]?(h[5]=0,h[6]=0):J0!==h[5]&&(h[6]=0),h[4]=$(m,t,h[4]),h[5]=$(m,J0,h[5]),h[6]=$(m,V0,h[6])}if(r)for(let t of r){t.length>1&&$(m,-t.length,0),$(m,t[0][0],0);let J0=n,V0=Q0;for(let A0=1;A0<t.length;A0++){let L0=t[A0];J0=$(m,L0[1],J0),V0=$(m,L0[2],V0),$(m,L0[0],0)}}for(Z0++;Z0<l.length;){let t=l[Z0],{0:J0,1:V0}=t;if(J0>c||J0===c&&V0>=e)break;Z0=v(l,Z0,m,h)}return h[0]<c?(f(m,h[0],c),h[0]=c,h[1]=0):m.write(44),h[1]=$(m,e,h[1]),Z0}function f(l,Z0,m){do l.write(59);while(++Z0<m)}function _(l){let{length:Z0}=l,m=new T(l),h=[],p=0,n=0,Q0=0,c=0,e=0;do{let g=m.indexOf(";"),u=[],r=!0,t=0;for(p=0;m.pos<g;){let J0;p=B(m,p),p<t&&(r=!1),t=p,R(m,g)?(n=B(m,n),Q0=B(m,Q0),c=B(m,c),R(m,g)?(e=B(m,e),J0=[p,n,Q0,c,e]):J0=[p,n,Q0,c]):J0=[p],u.push(J0),m.pos++}r||b(u),h.push(u),m.pos=g+1}while(m.pos<=Z0);return h}function b(l){l.sort(x)}function x(l,Z0){return l[0]-Z0[0]}function k(l){let Z0=new A,m=0,h=0,p=0,n=0;for(let Q0=0;Q0<l.length;Q0++){let c=l[Q0];if(Q0>0&&Z0.write(59),c.length===0)continue;let e=0;for(let g=0;g<c.length;g++){let u=c[g];g>0&&Z0.write(44),e=$(Z0,u[0],e),u.length!==1&&(m=$(Z0,u[1],m),h=$(Z0,u[2],h),p=$(Z0,u[3],p),u.length!==4&&(n=$(Z0,u[4],n)))}}return Z0.flush()}J.decode=_,J.decodeGeneratedRanges=P,J.decodeOriginalScopes=C,J.encode=k,J.encodeGeneratedRanges=y,J.encodeOriginalScopes=M,Object.defineProperty(J,"__esModule",{value:!0})})(Q)},"./node_modules/.pnpm/@jridgewell+trace-mapping@0.3.25/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js":function(F,Q,J){(function(Z,K,H){function G(P0,j0){return j0&&!j0.endsWith("/")&&(j0+="/"),H(P0,j0)}function q(P0){if(!P0)return"";let j0=P0.lastIndexOf("/");return P0.slice(0,j0+1)}let B=0,$=1,R=2,E=3,U=4,A=1,T=2;function I(P0,j0){let _0=C(P0,0);if(_0===P0.length)return P0;j0||(P0=P0.slice());for(let v0=_0;v0<P0.length;v0=C(P0,v0+1))P0[v0]=w(P0[v0],j0);return P0}function C(P0,j0){for(let _0=j0;_0<P0.length;_0++)if(!M(P0[_0]))return _0;return P0.length}function M(P0){for(let j0=1;j0<P0.length;j0++)if(P0[j0][B]<P0[j0-1][B])return!1;return!0}function w(P0,j0){return j0||(P0=P0.slice()),P0.sort(P)}function P(P0,j0){return P0[B]-j0[B]}let y=!1;function v(P0,j0,_0,v0){for(;_0<=v0;){let s=_0+(v0-_0>>1),z0=P0[s][B]-j0;if(z0===0)return y=!0,s;z0<0?_0=s+1:v0=s-1}return y=!1,_0-1}function f(P0,j0,_0){for(let v0=_0+1;v0<P0.length&&P0[v0][B]===j0;_0=v0++);return _0}function _(P0,j0,_0){for(let v0=_0-1;v0>=0&&P0[v0][B]===j0;_0=v0--);return _0}function b(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function x(P0,j0,_0,v0){let{lastKey:s,lastNeedle:z0,lastIndex:f0}=_0,h0=0,c0=P0.length-1;if(v0===s){if(j0===z0)return y=f0!==-1&&P0[f0][B]===j0,f0;j0>=z0?h0=f0===-1?0:f0:c0=f0}return _0.lastKey=v0,_0.lastNeedle=j0,_0.lastIndex=v(P0,j0,h0,c0)}function k(P0,j0){let _0=j0.map(Z0);for(let v0=0;v0<P0.length;v0++){let s=P0[v0];for(let z0=0;z0<s.length;z0++){let f0=s[z0];if(f0.length===1)continue;let h0=f0[$],c0=f0[R],e0=f0[E],W1=_0[h0],N1=W1[c0]||(W1[c0]=[]),H0=j0[h0],S0=f(N1,e0,x(N1,e0,H0,c0));H0.lastIndex=++S0,l(N1,S0,[e0,v0,f0[B]])}}return _0}function l(P0,j0,_0){for(let v0=P0.length;v0>j0;v0--)P0[v0]=P0[v0-1];P0[j0]=_0}function Z0(){return{__proto__:null}}let m=function(P0,j0){let _0=h(P0);if(!("sections"in _0))return new t(_0,j0);let v0=[],s=[],z0=[],f0=[],h0=[];return p(_0,j0,v0,s,z0,f0,h0,0,0,1/0,1/0),$0({version:3,file:_0.file,names:f0,sources:s,sourcesContent:z0,mappings:v0,ignoreList:h0})};function h(P0){return typeof P0=="string"?JSON.parse(P0):P0}function p(P0,j0,_0,v0,s,z0,f0,h0,c0,e0,W1){let{sections:N1}=P0;for(let H0=0;H0<N1.length;H0++){let{map:S0,offset:d0}=N1[H0],g0=e0,Z1=W1;if(H0+1<N1.length){let t0=N1[H0+1].offset;g0=Math.min(e0,h0+t0.line),g0===e0?Z1=Math.min(W1,c0+t0.column):g0<e0&&(Z1=c0+t0.column)}n(S0,j0,_0,v0,s,z0,f0,h0+d0.line,c0+d0.column,g0,Z1)}}function n(P0,j0,_0,v0,s,z0,f0,h0,c0,e0,W1){let N1=h(P0);if("sections"in N1)return p(...arguments);let H0=new t(N1,j0),S0=v0.length,d0=z0.length,g0=A0(H0),{resolvedSources:Z1,sourcesContent:t0,ignoreList:p0}=H0;if(Q0(v0,Z1),Q0(z0,H0.names),t0)Q0(s,t0);else for(let r0=0;r0<Z1.length;r0++)s.push(null);if(p0)for(let r0=0;r0<p0.length;r0++)f0.push(p0[r0]+S0);for(let r0=0;r0<g0.length;r0++){let z1=h0+r0;if(z1>e0)return;let w1=c(_0,z1),m0=r0===0?c0:0,B1=g0[r0];for(let A1=0;A1<B1.length;A1++){let y1=B1[A1],e1=m0+y1[B];if(z1===e0&&e1>=W1)return;if(y1.length===1){w1.push([e1]);continue}let H6=S0+y1[$],J9=y1[R],S6=y1[E];w1.push(y1.length===4?[e1,H6,J9,S6]:[e1,H6,J9,S6,d0+y1[U]])}}}function Q0(P0,j0){for(let _0=0;_0<j0.length;_0++)P0.push(j0[_0])}function c(P0,j0){for(let _0=P0.length;_0<=j0;_0++)P0[_0]=[];return P0[j0]}let e="`line` must be greater than 0 (lines start at line 1)",g="`column` must be greater than or equal to 0 (columns start at column 0)",u=-1,r=1;class t{constructor(P0,j0){let _0=typeof P0=="string";if(!_0&&P0._decodedMemo)return P0;let v0=_0?JSON.parse(P0):P0,{version:s,file:z0,names:f0,sourceRoot:h0,sources:c0,sourcesContent:e0}=v0;this.version=s,this.file=z0,this.names=f0||[],this.sourceRoot=h0,this.sources=c0,this.sourcesContent=e0,this.ignoreList=v0.ignoreList||v0.x_google_ignoreList||void 0;let W1=G(h0||"",q(j0));this.resolvedSources=c0.map((H0)=>G(H0||"",W1));let{mappings:N1}=v0;typeof N1=="string"?(this._encoded=N1,this._decoded=void 0):(this._encoded=void 0,this._decoded=I(N1,_0)),this._decodedMemo=b(),this._bySources=void 0,this._bySourceMemos=void 0}}function J0(P0){return P0}function V0(P0){var j0,_0;return(j0=(_0=J0(P0))._encoded)!==null&&j0!==void 0?j0:_0._encoded=K.encode(J0(P0)._decoded)}function A0(P0){var j0;return(j0=J0(P0))._decoded||(j0._decoded=K.decode(J0(P0)._encoded))}function L0(P0,j0,_0){let v0=A0(P0);if(j0>=v0.length)return null;let s=v0[j0],z0=G1(s,J0(P0)._decodedMemo,j0,_0,r);return z0===-1?null:s[z0]}function T0(P0,j0){let{line:_0,column:v0,bias:s}=j0;if(_0--,_0<0)throw Error(e);if(v0<0)throw Error(g);let z0=A0(P0);if(_0>=z0.length)return k0(null,null,null,null);let f0=z0[_0],h0=G1(f0,J0(P0)._decodedMemo,_0,v0,s||r);if(h0===-1)return k0(null,null,null,null);let c0=f0[h0];if(c0.length===1)return k0(null,null,null,null);let{names:e0,resolvedSources:W1}=P0;return k0(W1[c0[$]],c0[R]+1,c0[E],c0.length===5?e0[c0[U]]:null)}function U0(P0,j0){let{source:_0,line:v0,column:s,bias:z0}=j0;return Y1(P0,_0,v0,s,z0||r,!1)}function Y0(P0,j0){let{source:_0,line:v0,column:s,bias:z0}=j0;return Y1(P0,_0,v0,s,z0||u,!0)}function K0(P0,j0){let _0=A0(P0),{names:v0,resolvedSources:s}=P0;for(let z0=0;z0<_0.length;z0++){let f0=_0[z0];for(let h0=0;h0<f0.length;h0++){let c0=f0[h0],e0=z0+1,W1=c0[0],N1=null,H0=null,S0=null,d0=null;c0.length!==1&&(N1=s[c0[1]],H0=c0[2]+1,S0=c0[3]),c0.length===5&&(d0=v0[c0[4]]),j0({generatedLine:e0,generatedColumn:W1,source:N1,originalLine:H0,originalColumn:S0,name:d0})}}}function N0(P0,j0){let{sources:_0,resolvedSources:v0}=P0,s=_0.indexOf(j0);return s===-1&&(s=v0.indexOf(j0)),s}function M0(P0,j0){let{sourcesContent:_0}=P0;if(_0==null)return null;let v0=N0(P0,j0);return v0===-1?null:_0[v0]}function O0(P0,j0){let{ignoreList:_0}=P0;if(_0==null)return!1;let v0=N0(P0,j0);return v0!==-1&&_0.includes(v0)}function $0(P0,j0){let _0=new t(o(P0,[]),j0);return J0(_0)._decoded=P0.mappings,_0}function R0(P0){return o(P0,A0(P0))}function w0(P0){return o(P0,V0(P0))}function o(P0,j0){return{version:P0.version,file:P0.file,names:P0.names,sourceRoot:P0.sourceRoot,sources:P0.sources,sourcesContent:P0.sourcesContent,mappings:j0,ignoreList:P0.ignoreList||P0.x_google_ignoreList}}function k0(P0,j0,_0,v0){return{source:P0,line:j0,column:_0,name:v0}}function J1(P0,j0){return{line:P0,column:j0}}function G1(P0,j0,_0,v0,s){let z0=x(P0,v0,j0,_0);return y?z0=(s===u?f:_)(P0,v0,z0):s===u&&z0++,z0===-1||z0===P0.length?-1:z0}function V1(P0,j0,_0,v0,s){let z0=G1(P0,j0,_0,v0,r);if(y||s!==u||z0++,z0===-1||z0===P0.length)return[];let f0=y?v0:P0[z0][B];y||(z0=_(P0,f0,z0));let h0=f(P0,f0,z0),c0=[];for(;z0<=h0;z0++){let e0=P0[z0];c0.push(J1(e0[A]+1,e0[T]))}return c0}function Y1(P0,j0,_0,v0,s,z0){var f0;if(--_0<0)throw Error(e);if(v0<0)throw Error(g);let{sources:h0,resolvedSources:c0}=P0,e0=h0.indexOf(j0);if(e0===-1&&(e0=c0.indexOf(j0)),e0===-1)return z0?[]:J1(null,null);let W1=((f0=J0(P0))._bySources||(f0._bySources=k(A0(P0),J0(P0)._bySourceMemos=h0.map(b))))[e0][_0];if(W1==null)return z0?[]:J1(null,null);let N1=J0(P0)._bySourceMemos[e0];if(z0)return V1(W1,N1,_0,v0,s);let H0=G1(W1,N1,_0,v0,s);if(H0===-1)return J1(null,null);let S0=W1[H0];return J1(S0[A]+1,S0[T])}Z.AnyMap=m,Z.GREATEST_LOWER_BOUND=r,Z.LEAST_UPPER_BOUND=u,Z.TraceMap=t,Z.allGeneratedPositionsFor=Y0,Z.decodedMap=R0,Z.decodedMappings=A0,Z.eachMapping=K0,Z.encodedMap=w0,Z.encodedMappings=V0,Z.generatedPositionFor=U0,Z.isIgnored=O0,Z.originalPositionFor=T0,Z.presortedDecodedMap=$0,Z.sourceContentFor=M0,Z.traceSegment=L0})(Q,J("./node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js"),J("./node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js"))},"./node_modules/.pnpm/babel-plugin-dynamic-import-node@2.3.3/node_modules/babel-plugin-dynamic-import-node/lib/index.js":(F,Q,J)=>{Object.defineProperty(Q,"__esModule",{value:!0}),Q.default=function(K){var H=(0,Z.createDynamicImportTransform)(K);return{manipulateOptions:function(G,q){q.plugins.push("dynamicImport")},visitor:{Import:function(G){H(this,G)}}}};var Z=J("./node_modules/.pnpm/babel-plugin-dynamic-import-node@2.3.3/node_modules/babel-plugin-dynamic-import-node/lib/utils.js");F.exports=Q.default},"./node_modules/.pnpm/babel-plugin-dynamic-import-node@2.3.3/node_modules/babel-plugin-dynamic-import-node/lib/utils.js":(F,Q)=>{Object.defineProperty(Q,"__esModule",{value:!0});var J=function(K,H){if(Array.isArray(K))return K;if(Symbol.iterator in Object(K))return function(G,q){var B=[],$=!0,R=!1,E=void 0;try{for(var U,A=G[Symbol.iterator]();!($=(U=A.next()).done)&&(B.push(U.value),!q||B.length!==q);$=!0);}catch(T){R=!0,E=T}finally{try{!$&&A.return&&A.return()}finally{if(R)throw E}}return B}(K,H);throw TypeError("Invalid attempt to destructure non-iterable instance")};function Z(K,H){var G=H.arguments,q=J(G,1)[0];return K.isStringLiteral(q)||K.isTemplateLiteral(q)?(K.removeComments(q),q):K.templateLiteral([K.templateElement({raw:"",cooked:""}),K.templateElement({raw:"",cooked:""},!0)],G)}Q.getImportSource=Z,Q.createDynamicImportTransform=function(K){var{template:H,types:G}=K,q={static:{interop:H("Promise.resolve().then(() => INTEROP(require(SOURCE)))"),noInterop:H("Promise.resolve().then(() => require(SOURCE))")},dynamic:{interop:H("Promise.resolve(SOURCE).then(s => INTEROP(require(s)))"),noInterop:H("Promise.resolve(SOURCE).then(s => require(s))")}},B=typeof WeakSet=="function"&&new WeakSet;return function($,R){if(B){if(B.has(R))return;B.add(R)}var E,U=Z(G,R.parent),A=(E=U,G.isStringLiteral(E)||G.isTemplateLiteral(E)&&E.expressions.length===0?q.static:q.dynamic),T=$.opts.noInterop?A.noInterop({SOURCE:U}):A.interop({SOURCE:U,INTEROP:$.addHelper("interopRequireWildcard")});R.parentPath.replaceWith(T)}}},"./node_modules/.pnpm/babel-plugin-parameter-decorator@1.0.16/node_modules/babel-plugin-parameter-decorator/lib/index.js":(F,Q,J)=>{var Z=J("path");function K(H){switch(H.parent.type){case"TSTypeReference":case"TSQualifiedName":case"TSExpressionWithTypeArguments":case"TSTypeQuery":return!0;default:return!1}}F.exports=function(H){var G=H.types,q=function($,R){return function(E){var U=G.callExpression($.expression,[G.Identifier(E),G.Identifier("undefined"),G.NumericLiteral(R.key)]),A=G.logicalExpression("||",U,G.Identifier(E)),T=G.assignmentExpression("=",G.Identifier(E),A);return G.expressionStatement(T)}},B=function($,R){return function(E,U){var A=G.callExpression($.expression,[G.Identifier("".concat(E,".prototype")),G.StringLiteral(U),G.NumericLiteral(R.key)]);return G.expressionStatement(A)}};return{visitor:{Program:function($,R){var E=(0,Z.extname)(R.file.opts.filename);E!==".ts"&&E!==".tsx"||function(){var U=Object.create(null);$.node.body.filter(function(x){var{type:k,declaration:l}=x;switch(k){case"ClassDeclaration":return!0;case"ExportNamedDeclaration":case"ExportDefaultDeclaration":return l&&l.type==="ClassDeclaration";default:return!1}}).map(function(x){return x.type==="ClassDeclaration"?x:x.declaration}).forEach(function(x){x.body.body.forEach(function(k){(k.params||[]).forEach(function(l){(l.decorators||[]).forEach(function(Z0){Z0.expression.callee?U[Z0.expression.callee.name]=Z0:U[Z0.expression.name]=Z0})})})});var A=!0,T=!1,I=void 0;try{for(var C,M=$.get("body")[Symbol.iterator]();!(A=(C=M.next()).done);A=!0){var w=C.value;if(w.node.type==="ImportDeclaration"){if(w.node.specifiers.length===0)continue;var P=!0,y=!1,v=void 0;try{for(var f,_=function(){var x=f.value,k=w.scope.getBinding(x.local.name);k.referencePaths.length?k.referencePaths.reduce(function(l,Z0){return l||K(Z0)},!1)&&Object.keys(U).forEach(function(l){var Z0=U[l];(Z0.expression.arguments||[]).forEach(function(m){m.name===x.local.name&&k.referencePaths.push({parent:Z0.expression})})}):U[x.local.name]&&k.referencePaths.push({parent:U[x.local.name]})},b=w.node.specifiers[Symbol.iterator]();!(P=(f=b.next()).done);P=!0)_()}catch(x){y=!0,v=x}finally{try{P||b.return==null||b.return()}finally{if(y)throw v}}}}}catch(x){T=!0,I=x}finally{try{A||M.return==null||M.return()}finally{if(T)throw I}}}()},Function:function($){var R="";$.node.id?R=$.node.id.name:$.node.key&&(R=$.node.key.name),($.get("params")||[]).slice().forEach(function(E){var U=E.node.decorators||[],A=U.length;if(U.slice().forEach(function(I){if($.type==="ClassMethod"){var C,M=$.parentPath.parentPath,w=$.findParent(function(x){return x.type==="ClassDeclaration"});if(w?C=w.node.id.name:(M.insertAfter(null),C=function(x){var k=x.findParent(function(l){return l.node.type==="AssignmentExpression"});return k.node.right.type==="SequenceExpression"?k.node.right.expressions[1].name:k.node.right.type==="ClassExpression"?k.node.left.name:null}($)),R==="constructor"){var P=q(I,E)(C);M.insertAfter(P)}else{var y=B(I,E)(C,R);M.insertAfter(y)}}else{var v=$.findParent(function(x){return x.node.type==="VariableDeclarator"}).node.id.name;if(R===v){var f=q(I,E)(v);if($.parentKey==="body")$.insertAfter(f);else $.findParent(function(x){return x.parentKey==="body"}).insertAfter(f)}else{var _=$.findParent(function(x){return x.node.type==="CallExpression"}),b=B(I,E)(v,R);_.insertAfter(b)}}}),A){var T=function(I){switch(I.node.type){case"ObjectPattern":return G.ObjectPattern(I.node.properties);case"AssignmentPattern":return G.AssignmentPattern(I.node.left,I.node.right);case"TSParameterProperty":return G.Identifier(I.node.parameter.name);default:return G.Identifier(I.node.name)}}(E);E.replaceWith(T)}})}}}}},"./node_modules/.pnpm/babel-plugin-transform-typescript-metadata@0.3.2_@babel+core@7.26.0_@babel+traverse@7.26.4/node_modules/babel-plugin-transform-typescript-metadata/lib/metadata/metadataVisitor.js":(F,Q,J)=>{Object.defineProperty(Q,"__esModule",{value:!0}),Q.metadataVisitor=function(G,q){let B=q.node,$=G.node;switch(B.type){case"ClassMethod":let R=B.kind==="constructor"?$.decorators:B.decorators;if(!R||R.length===0)return;R.push(H("design:type",Z.types.identifier("Function"))),R.push(H("design:paramtypes",Z.types.arrayExpression(B.params.map((E)=>(0,K.serializeType)(G,E)))));break;case"ClassProperty":if(!B.decorators||B.decorators.length===0)return;if(!B.typeAnnotation||B.typeAnnotation.type!=="TSTypeAnnotation")return;B.decorators.push(H("design:type",(0,K.serializeType)(G,B)))}};var Z=J("./node_modules/.pnpm/@babel+core@7.26.0/node_modules/@babel/core/lib/index.js"),K=J("./node_modules/.pnpm/babel-plugin-transform-typescript-metadata@0.3.2_@babel+core@7.26.0_@babel+traverse@7.26.4/node_modules/babel-plugin-transform-typescript-metadata/lib/metadata/serializeType.js");function H(G,q){return Z.types.decorator(Z.types.callExpression(Z.types.memberExpression(Z.types.identifier("Reflect"),Z.types.identifier("metadata")),[Z.types.stringLiteral(G),q]))}},"./node_modules/.pnpm/babel-plugin-transform-typescript-metadata@0.3.2_@babel+core@7.26.0_@babel+traverse@7.26.4/node_modules/babel-plugin-transform-typescript-metadata/lib/metadata/serializeType.js":(F,Q,J)=>{Object.defineProperty(Q,"__esModule",{value:!0}),Q.serializeType=function(E,U){let A=H(U);if(A==null)return K();if(!A.typeAnnotation||A.typeAnnotation.type!=="TSTypeAnnotation")return K();let T=A.typeAnnotation.typeAnnotation;return $(E.node.id?E.node.id.name:"",T)},Q.isClassType=q;var Z=J("./node_modules/.pnpm/@babel+core@7.26.0/node_modules/@babel/core/lib/index.js");function K(){return Z.types.unaryExpression("void",Z.types.numericLiteral(0))}function H(E){return E==null?null:E.type==="ClassProperty"||E.type==="Identifier"||E.type==="ObjectPattern"?E:E.type==="AssignmentPattern"&&E.left.type==="Identifier"?E.left:E.type==="TSParameterProperty"?H(E.parameter):null}function G(E,U){let A=B(U.typeName);return q(E,A)?Z.types.identifier("Object"):Z.types.conditionalExpression(Z.types.binaryExpression("===",Z.types.unaryExpression("typeof",A),Z.types.stringLiteral("undefined")),Z.types.identifier("Object"),Z.types.cloneDeep(A))}function q(E,U){switch(U.type){case"Identifier":return U.name===E;case"MemberExpression":return q(E,U.object);default:throw Error(`The property expression at ${U.start} is not valid as a Type to be used in Reflect.metadata`)}}function B(E){return E.type==="Identifier"?Z.types.identifier(E.name):Z.types.memberExpression(B(E.left),E.right)}function $(E,U){if(U===void 0)return Z.types.identifier("Object");switch(U.type){case"TSVoidKeyword":case"TSUndefinedKeyword":case"TSNullKeyword":case"TSNeverKeyword":return K();case"TSParenthesizedType":return $(E,U.typeAnnotation);case"TSFunctionType":case"TSConstructorType":return Z.types.identifier("Function");case"TSArrayType":case"TSTupleType":return Z.types.identifier("Array");case"TSTypePredicate":case"TSBooleanKeyword":return Z.types.identifier("Boolean");case"TSStringKeyword":return Z.types.identifier("String");case"TSObjectKeyword":return Z.types.identifier("Object");case"TSLiteralType":switch(U.literal.type){case"StringLiteral":return Z.types.identifier("String");case"NumericLiteral":return Z.types.identifier("Number");case"BooleanLiteral":return Z.types.identifier("Boolean");default:throw Error("Bad type for decorator"+U.literal)}case"TSNumberKeyword":case"TSBigIntKeyword":return Z.types.identifier("Number");case"TSSymbolKeyword":return Z.types.identifier("Symbol");case"TSTypeReference":return G(E,U);case"TSIntersectionType":case"TSUnionType":return R(E,U.types);case"TSConditionalType":return R(E,[U.trueType,U.falseType]);case"TSTypeQuery":case"TSTypeOperator":case"TSIndexedAccessType":case"TSMappedType":case"TSTypeLiteral":case"TSAnyKeyword":case"TSUnknownKeyword":case"TSThisType":break;default:throw Error("Bad type for decorator")}return Z.types.identifier("Object")}function R(E,U){let A;for(let T of U){for(;T.type==="TSParenthesizedType";)T=T.typeAnnotation;if(T.type==="TSNeverKeyword")continue;if(T.type==="TSNullKeyword"||T.type==="TSUndefinedKeyword")continue;let I=$(E,T);if(Z.types.isIdentifier(I)&&I.name==="Object")return I;if(A){if(!Z.types.isIdentifier(A)||!Z.types.isIdentifier(I)||A.name!==I.name)return Z.types.identifier("Object")}else A=I}return A||K()}},"./node_modules/.pnpm/babel-plugin-transform-typescript-metadata@0.3.2_@babel+core@7.26.0_@babel+traverse@7.26.4/node_modules/babel-plugin-transform-typescript-metadata/lib/parameter/parameterVisitor.js":(F,Q,J)=>{Object.defineProperty(Q,"__esModule",{value:!0}),Q.parameterVisitor=function(H,G){if(G.type!=="ClassMethod")return;if(G.node.type!=="ClassMethod")return;if(G.node.key.type!=="Identifier")return;let q=G;(q.get("params")||[]).slice().forEach(function(B){let $;(B.node.type==="Identifier"||B.node.type==="ObjectPattern"?B.node:B.node.type==="TSParameterProperty"&&B.node.parameter.type==="Identifier"?B.node.parameter:null)!=null&&((B.node.decorators||[]).slice().forEach(function(R){q.node.kind==="constructor"?($=K(B.key,R.expression,!0),H.node.decorators||(H.node.decorators=[]),H.node.decorators.push($)):($=K(B.key,R.expression,!1),q.node.decorators||(q.node.decorators=[]),q.node.decorators.push($))}),$&&(B.node.decorators=null))})};var Z=J("./node_modules/.pnpm/@babel+core@7.26.0/node_modules/@babel/core/lib/index.js");function K(H,G,q=!1){return Z.types.decorator(Z.types.functionExpression(null,[Z.types.identifier("target"),Z.types.identifier("key")],Z.types.blockStatement([Z.types.returnStatement(Z.types.callExpression(G,[Z.types.identifier("target"),Z.types.identifier(q?"undefined":"key"),Z.types.numericLiteral(H)]))])))}},"./node_modules/.pnpm/babel-plugin-transform-typescript-metadata@0.3.2_@babel+core@7.26.0_@babel+traverse@7.26.4/node_modules/babel-plugin-transform-typescript-metadata/lib/plugin.js":(F,Q,J)=>{Object.defineProperty(Q,"__esModule",{value:!0}),Q.default=void 0;var Z=J("./node_modules/.pnpm/@babel+helper-plugin-utils@7.25.9/node_modules/@babel/helper-plugin-utils/lib/index.js"),K=J("./node_modules/.pnpm/babel-plugin-transform-typescript-metadata@0.3.2_@babel+core@7.26.0_@babel+traverse@7.26.4/node_modules/babel-plugin-transform-typescript-metadata/lib/parameter/parameterVisitor.js"),H=J("./node_modules/.pnpm/babel-plugin-transform-typescript-metadata@0.3.2_@babel+core@7.26.0_@babel+traverse@7.26.4/node_modules/babel-plugin-transform-typescript-metadata/lib/metadata/metadataVisitor.js"),G=(0,Z.declare)((q)=>(q.assertVersion(7),{visitor:{Program(B){B.traverse({ClassDeclaration($){for(let R of $.get("body").get("body"))R.type!=="ClassMethod"&&R.type!=="ClassProperty"||((0,K.parameterVisitor)($,R),(0,H.metadataVisitor)($,R));$.parentPath.scope.crawl()}})}}}));Q.default=G},"./node_modules/.pnpm/convert-source-map@2.0.0/node_modules/convert-source-map/index.js":(F,Q)=>{var J;function Z(H,G){(G=G||{}).hasComment&&(H=function(q){return q.split(",").pop()}(H)),G.encoding==="base64"?H=J(H):G.encoding==="uri"&&(H=decodeURIComponent(H)),(G.isJSON||G.encoding)&&(H=JSON.parse(H)),this.sourcemap=H}function K(H){return new Z(H,{isJSON:!0})}Object.defineProperty(Q,"commentRegex",{get:function(){return/^\s*?\/[\/\*][@#]\s+?sourceMappingURL=data:(((?:application|text)\/json)(?:;charset=([^;,]+?)?)?)?(?:;(base64))?,(.*?)$/gm}}),Object.defineProperty(Q,"mapFileCommentRegex",{get:function(){return/(?:\/\/[@#][ \t]+?sourceMappingURL=([^\s'"`]+?)[ \t]*?$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*?(?:\*\/){1}[ \t]*?$)/gm}}),J=typeof Buffer<"u"?typeof Buffer.from=="function"?function(H){return Buffer.from(H,"base64").toString()}:function(H){if(typeof value=="number")throw TypeError("The value to decode must not be of type number.");return new Buffer(H,"base64").toString()}:function(H){return decodeURIComponent(escape(atob(H)))},Z.prototype.toJSON=function(H){return JSON.stringify(this.sourcemap,null,H)},typeof Buffer<"u"?typeof Buffer.from=="function"?Z.prototype.toBase64=function(){var H=this.toJSON();return Buffer.from(H,"utf8").toString("base64")}:Z.prototype.toBase64=function(){var H=this.toJSON();if(typeof H=="number")throw TypeError("The json to encode must not be of type number.");return new Buffer(H,"utf8").toString("base64")}:Z.prototype.toBase64=function(){var H=this.toJSON();return btoa(unescape(encodeURIComponent(H)))},Z.prototype.toURI=function(){var H=this.toJSON();return encodeURIComponent(H)},Z.prototype.toComment=function(H){var G,q,B;return H!=null&&H.encoding==="uri"?(G="",q=this.toURI()):(G=";base64",q=this.toBase64()),B="sourceMappingURL=data:application/json;charset=utf-8"+G+","+q,H!=null&&H.multiline?"/*# "+B+" */":"//# "+B},Z.prototype.toObject=function(){return JSON.parse(this.toJSON())},Z.prototype.addProperty=function(H,G){if(this.sourcemap.hasOwnProperty(H))throw Error('property "'+H+'" already exists on the sourcemap, use set property instead');return this.setProperty(H,G)},Z.prototype.setProperty=function(H,G){return this.sourcemap[H]=G,this},Z.prototype.getProperty=function(H){return this.sourcemap[H]},Q.fromObject=function(H){return new Z(H)},Q.fromJSON=function(H){return new Z(H,{isJSON:!0})},Q.fromURI=function(H){return new Z(H,{encoding:"uri"})},Q.fromBase64=function(H){return new Z(H,{encoding:"base64"})},Q.fromComment=function(H){var G;return new Z(H=H.replace(/^\/\*/g,"//").replace(/\*\/$/g,""),{encoding:(G=Q.commentRegex.exec(H))&&G[4]||"uri",hasComment:!0})},Q.fromMapFileComment=function(H,G){if(typeof G=="string")throw Error("String directory paths are no longer supported with `fromMapFileComment`\nPlease review the Upgrading documentation at https://github.com/thlorenz/convert-source-map#upgrading");var q=function(B,$){var R=Q.mapFileCommentRegex.exec(B),E=R[1]||R[2];try{return(B=$(E))!=null&&typeof B.catch=="function"?B.catch(U):B}catch(A){U(A)}function U(A){throw Error("An error occurred while trying to read the map file at "+E+`
46
46
  `+A.stack)}}(H,G);return q!=null&&typeof q.then=="function"?q.then(K):K(q)},Q.fromSource=function(H){var G=H.match(Q.commentRegex);return G?Q.fromComment(G.pop()):null},Q.fromMapFileSource=function(H,G){if(typeof G=="string")throw Error("String directory paths are no longer supported with `fromMapFileSource`\nPlease review the Upgrading documentation at https://github.com/thlorenz/convert-source-map#upgrading");var q=H.match(Q.mapFileCommentRegex);return q?Q.fromMapFileComment(q.pop(),G):null},Q.removeComments=function(H){return H.replace(Q.commentRegex,"")},Q.removeMapFileComments=function(H){return H.replace(Q.mapFileCommentRegex,"")},Q.generateMapFileComment=function(H,G){var q="sourceMappingURL="+H;return G&&G.multiline?"/*# "+q+" */":"//# "+q}},"./node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/browser.js":(F,Q,J)=>{Q.formatArgs=function(K){if(K[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+K[0]+(this.useColors?"%c ":" ")+"+"+F.exports.humanize(this.diff),!this.useColors)return;let H="color: "+this.color;K.splice(1,0,H,"color: inherit");let G=0,q=0;K[0].replace(/%[a-zA-Z%]/g,(B)=>{B!=="%%"&&(G++,B==="%c"&&(q=G))}),K.splice(q,0,H)},Q.save=function(K){try{K?Q.storage.setItem("debug",K):Q.storage.removeItem("debug")}catch(H){}},Q.load=function(){let K;try{K=Q.storage.getItem("debug")}catch(H){}return!K&&typeof process<"u"&&"env"in process&&(K=process.env.DEBUG),K},Q.useColors=function(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let K;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(K=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(K[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},Q.storage=function(){try{return localStorage}catch(K){}}(),Q.destroy=(()=>{let K=!1;return()=>{K||(K=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),Q.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],Q.log=console.debug||console.log||(()=>{}),F.exports=J("./node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js")(Q);let{formatters:Z}=F.exports;Z.j=function(K){try{return JSON.stringify(K)}catch(H){return"[UnexpectedJSONParseError]: "+H.message}}},"./node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js":(F,Q,J)=>{F.exports=function(Z){function K(q){let B,$,R,E=null;function U(...A){if(!U.enabled)return;let T=U,I=Number(new Date),C=I-(B||I);T.diff=C,T.prev=B,T.curr=I,B=I,A[0]=K.coerce(A[0]),typeof A[0]!="string"&&A.unshift("%O");let M=0;A[0]=A[0].replace(/%([a-zA-Z%])/g,(w,P)=>{if(w==="%%")return"%";M++;let y=K.formatters[P];if(typeof y=="function"){let v=A[M];w=y.call(T,v),A.splice(M,1),M--}return w}),K.formatArgs.call(T,A),(T.log||K.log).apply(T,A)}return U.namespace=q,U.useColors=K.useColors(),U.color=K.selectColor(q),U.extend=H,U.destroy=K.destroy,Object.defineProperty(U,"enabled",{enumerable:!0,configurable:!1,get:()=>E!==null?E:($!==K.namespaces&&($=K.namespaces,R=K.enabled(q)),R),set:(A)=>{E=A}}),typeof K.init=="function"&&K.init(U),U}function H(q,B){let $=K(this.namespace+(B===void 0?":":B)+q);return $.log=this.log,$}function G(q,B){let $=0,R=0,E=-1,U=0;for(;$<q.length;)if(R<B.length&&(B[R]===q[$]||B[R]==="*"))B[R]==="*"?(E=R,U=$,R++):($++,R++);else{if(E===-1)return!1;R=E+1,U++,$=U}for(;R<B.length&&B[R]==="*";)R++;return R===B.length}return K.debug=K,K.default=K,K.coerce=function(q){if(q instanceof Error)return q.stack||q.message;return q},K.disable=function(){let q=[...K.names,...K.skips.map((B)=>"-"+B)].join(",");return K.enable(""),q},K.enable=function(q){K.save(q),K.namespaces=q,K.names=[],K.skips=[];let B=(typeof q=="string"?q:"").trim().replace(" ",",").split(",").filter(Boolean);for(let $ of B)$[0]==="-"?K.skips.push($.slice(1)):K.names.push($)},K.enabled=function(q){for(let B of K.skips)if(G(q,B))return!1;for(let B of K.names)if(G(q,B))return!0;return!1},K.humanize=J("./node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"),K.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(Z).forEach((q)=>{K[q]=Z[q]}),K.names=[],K.skips=[],K.formatters={},K.selectColor=function(q){let B=0;for(let $=0;$<q.length;$++)B=(B<<5)-B+q.charCodeAt($),B|=0;return K.colors[Math.abs(B)%K.colors.length]},K.enable(K.load()),K}},"./node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/index.js":(F,Q,J)=>{typeof process>"u"||process.type==="renderer"||!1||process.__nwjs?F.exports=J("./node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/browser.js"):F.exports=J("./node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/node.js")},"./node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/node.js":(F,Q,J)=>{let Z=J("tty"),K=J("util");Q.init=function(G){G.inspectOpts={};let q=Object.keys(Q.inspectOpts);for(let B=0;B<q.length;B++)G.inspectOpts[q[B]]=Q.inspectOpts[q[B]]},Q.log=function(...G){return process.stderr.write(K.formatWithOptions(Q.inspectOpts,...G)+`
47
47
  `)},Q.formatArgs=function(G){let{namespace:q,useColors:B}=this;if(B){let $=this.color,R="\x1B[3"+($<8?$:"8;5;"+$),E=` ${R};1m${q} \x1B[0m`;G[0]=E+G[0].split(`
@@ -470,27 +470,27 @@ ${q}`)};let J=new Set},"./node_modules/.pnpm/@babel+types@7.26.3/node_modules/@b
470
470
  `+w0+"]"}return J0.pop(),T0=w0,o}($0):function(R0){if(J0.indexOf(R0)>=0)throw TypeError("Converting circular structure to JSON5");J0.push(R0);let w0=T0;T0+=U0;let o,k0=V0||Object.keys(R0),J1=[];for(let G1 of k0){let V1=Y0(G1,R0);if(V1!==void 0){let Y1=N0(G1)+":";U0!==""&&(Y1+=" "),Y1+=V1,J1.push(Y1)}}if(J1.length===0)o="{}";else{let G1;if(U0==="")G1=J1.join(","),o="{"+G1+"}";else{let V1=`,
471
471
  `+T0;G1=J1.join(V1),o=`{
472
472
  `+T0+G1+`,
473
- `+w0+"}"}}return J0.pop(),T0=w0,o}($0):void 0}function K0(M0){let O0={"'":0.1,'"':0.2},$0={"'":"\\'",'"':"\\\"","\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\x00":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},R0="";for(let o=0;o<M0.length;o++){let k0=M0[o];switch(k0){case"'":case'"':O0[k0]++,R0+=k0;continue;case"\x00":if(K.isDigit(M0[o+1])){R0+="\\x00";continue}}if($0[k0])R0+=$0[k0];else if(k0<" "){let J1=k0.charCodeAt(0).toString(16);R0+="\\x"+("00"+J1).substring(J1.length)}else R0+=k0}let w0=L0||Object.keys(O0).reduce((o,k0)=>O0[o]<O0[k0]?o:k0);return R0=R0.replace(new RegExp(w0,"g"),$0[w0]),w0+R0+w0}function N0(M0){if(M0.length===0)return K0(M0);let O0=String.fromCodePoint(M0.codePointAt(0));if(!K.isIdStartChar(O0))return K0(M0);for(let $0=O0.length;$0<M0.length;$0++)if(!K.isIdContinueChar(String.fromCodePoint(M0.codePointAt($0))))return K0(M0);return M0}}}},"./node_modules/.pnpm/@babel+preset-typescript@7.26.0_@babel+core@7.26.0/node_modules/@babel/preset-typescript/package.json":(F)=>{F.exports=JSON.parse('{"name":"@babel/preset-typescript","version":"7.26.0","description":"Babel preset for TypeScript.","repository":{"type":"git","url":"https://github.com/babel/babel.git","directory":"packages/babel-preset-typescript"},"license":"MIT","publishConfig":{"access":"public"},"main":"./lib/index.js","keywords":["babel-preset","typescript"],"dependencies":{"@babel/helper-plugin-utils":"^7.25.9","@babel/helper-validator-option":"^7.25.9","@babel/plugin-syntax-jsx":"^7.25.9","@babel/plugin-transform-modules-commonjs":"^7.25.9","@babel/plugin-transform-typescript":"^7.25.9"},"peerDependencies":{"@babel/core":"^7.0.0-0"},"devDependencies":{"@babel/core":"^7.26.0","@babel/helper-plugin-test-runner":"^7.25.9"},"homepage":"https://babel.dev/docs/en/next/babel-preset-typescript","bugs":"https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22area%3A%20typescript%22+is%3Aopen","engines":{"node":">=6.9.0"},"author":"The Babel Team (https://babel.dev/team)","type":"commonjs"}')},"./node_modules/.pnpm/globals@11.12.0/node_modules/globals/globals.json":(F)=>{F.exports=JSON.parse('{"builtin":{"Array":false,"ArrayBuffer":false,"Atomics":false,"BigInt":false,"BigInt64Array":false,"BigUint64Array":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"globalThis":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es5":{"Array":false,"Boolean":false,"constructor":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"propertyIsEnumerable":false,"RangeError":false,"ReferenceError":false,"RegExp":false,"String":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false},"es2015":{"Array":false,"ArrayBuffer":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es2017":{"Array":false,"ArrayBuffer":false,"Atomics":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"browser":{"AbortController":false,"AbortSignal":false,"addEventListener":false,"alert":false,"AnalyserNode":false,"Animation":false,"AnimationEffectReadOnly":false,"AnimationEffectTiming":false,"AnimationEffectTimingReadOnly":false,"AnimationEvent":false,"AnimationPlaybackEvent":false,"AnimationTimeline":false,"applicationCache":false,"ApplicationCache":false,"ApplicationCacheErrorEvent":false,"atob":false,"Attr":false,"Audio":false,"AudioBuffer":false,"AudioBufferSourceNode":false,"AudioContext":false,"AudioDestinationNode":false,"AudioListener":false,"AudioNode":false,"AudioParam":false,"AudioProcessingEvent":false,"AudioScheduledSourceNode":false,"AudioWorkletGlobalScope ":false,"AudioWorkletNode":false,"AudioWorkletProcessor":false,"BarProp":false,"BaseAudioContext":false,"BatteryManager":false,"BeforeUnloadEvent":false,"BiquadFilterNode":false,"Blob":false,"BlobEvent":false,"blur":false,"BroadcastChannel":false,"btoa":false,"BudgetService":false,"ByteLengthQueuingStrategy":false,"Cache":false,"caches":false,"CacheStorage":false,"cancelAnimationFrame":false,"cancelIdleCallback":false,"CanvasCaptureMediaStreamTrack":false,"CanvasGradient":false,"CanvasPattern":false,"CanvasRenderingContext2D":false,"ChannelMergerNode":false,"ChannelSplitterNode":false,"CharacterData":false,"clearInterval":false,"clearTimeout":false,"clientInformation":false,"ClipboardEvent":false,"close":false,"closed":false,"CloseEvent":false,"Comment":false,"CompositionEvent":false,"confirm":false,"console":false,"ConstantSourceNode":false,"ConvolverNode":false,"CountQueuingStrategy":false,"createImageBitmap":false,"Credential":false,"CredentialsContainer":false,"crypto":false,"Crypto":false,"CryptoKey":false,"CSS":false,"CSSConditionRule":false,"CSSFontFaceRule":false,"CSSGroupingRule":false,"CSSImportRule":false,"CSSKeyframeRule":false,"CSSKeyframesRule":false,"CSSMediaRule":false,"CSSNamespaceRule":false,"CSSPageRule":false,"CSSRule":false,"CSSRuleList":false,"CSSStyleDeclaration":false,"CSSStyleRule":false,"CSSStyleSheet":false,"CSSSupportsRule":false,"CustomElementRegistry":false,"customElements":false,"CustomEvent":false,"DataTransfer":false,"DataTransferItem":false,"DataTransferItemList":false,"defaultstatus":false,"defaultStatus":false,"DelayNode":false,"DeviceMotionEvent":false,"DeviceOrientationEvent":false,"devicePixelRatio":false,"dispatchEvent":false,"document":false,"Document":false,"DocumentFragment":false,"DocumentType":false,"DOMError":false,"DOMException":false,"DOMImplementation":false,"DOMMatrix":false,"DOMMatrixReadOnly":false,"DOMParser":false,"DOMPoint":false,"DOMPointReadOnly":false,"DOMQuad":false,"DOMRect":false,"DOMRectReadOnly":false,"DOMStringList":false,"DOMStringMap":false,"DOMTokenList":false,"DragEvent":false,"DynamicsCompressorNode":false,"Element":false,"ErrorEvent":false,"event":false,"Event":false,"EventSource":false,"EventTarget":false,"external":false,"fetch":false,"File":false,"FileList":false,"FileReader":false,"find":false,"focus":false,"FocusEvent":false,"FontFace":false,"FontFaceSetLoadEvent":false,"FormData":false,"frameElement":false,"frames":false,"GainNode":false,"Gamepad":false,"GamepadButton":false,"GamepadEvent":false,"getComputedStyle":false,"getSelection":false,"HashChangeEvent":false,"Headers":false,"history":false,"History":false,"HTMLAllCollection":false,"HTMLAnchorElement":false,"HTMLAreaElement":false,"HTMLAudioElement":false,"HTMLBaseElement":false,"HTMLBodyElement":false,"HTMLBRElement":false,"HTMLButtonElement":false,"HTMLCanvasElement":false,"HTMLCollection":false,"HTMLContentElement":false,"HTMLDataElement":false,"HTMLDataListElement":false,"HTMLDetailsElement":false,"HTMLDialogElement":false,"HTMLDirectoryElement":false,"HTMLDivElement":false,"HTMLDListElement":false,"HTMLDocument":false,"HTMLElement":false,"HTMLEmbedElement":false,"HTMLFieldSetElement":false,"HTMLFontElement":false,"HTMLFormControlsCollection":false,"HTMLFormElement":false,"HTMLFrameElement":false,"HTMLFrameSetElement":false,"HTMLHeadElement":false,"HTMLHeadingElement":false,"HTMLHRElement":false,"HTMLHtmlElement":false,"HTMLIFrameElement":false,"HTMLImageElement":false,"HTMLInputElement":false,"HTMLLabelElement":false,"HTMLLegendElement":false,"HTMLLIElement":false,"HTMLLinkElement":false,"HTMLMapElement":false,"HTMLMarqueeElement":false,"HTMLMediaElement":false,"HTMLMenuElement":false,"HTMLMetaElement":false,"HTMLMeterElement":false,"HTMLModElement":false,"HTMLObjectElement":false,"HTMLOListElement":false,"HTMLOptGroupElement":false,"HTMLOptionElement":false,"HTMLOptionsCollection":false,"HTMLOutputElement":false,"HTMLParagraphElement":false,"HTMLParamElement":false,"HTMLPictureElement":false,"HTMLPreElement":false,"HTMLProgressElement":false,"HTMLQuoteElement":false,"HTMLScriptElement":false,"HTMLSelectElement":false,"HTMLShadowElement":false,"HTMLSlotElement":false,"HTMLSourceElement":false,"HTMLSpanElement":false,"HTMLStyleElement":false,"HTMLTableCaptionElement":false,"HTMLTableCellElement":false,"HTMLTableColElement":false,"HTMLTableElement":false,"HTMLTableRowElement":false,"HTMLTableSectionElement":false,"HTMLTemplateElement":false,"HTMLTextAreaElement":false,"HTMLTimeElement":false,"HTMLTitleElement":false,"HTMLTrackElement":false,"HTMLUListElement":false,"HTMLUnknownElement":false,"HTMLVideoElement":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"IdleDeadline":false,"IIRFilterNode":false,"Image":false,"ImageBitmap":false,"ImageBitmapRenderingContext":false,"ImageCapture":false,"ImageData":false,"indexedDB":false,"innerHeight":false,"innerWidth":false,"InputEvent":false,"IntersectionObserver":false,"IntersectionObserverEntry":false,"Intl":false,"isSecureContext":false,"KeyboardEvent":false,"KeyframeEffect":false,"KeyframeEffectReadOnly":false,"length":false,"localStorage":false,"location":true,"Location":false,"locationbar":false,"matchMedia":false,"MediaDeviceInfo":false,"MediaDevices":false,"MediaElementAudioSourceNode":false,"MediaEncryptedEvent":false,"MediaError":false,"MediaKeyMessageEvent":false,"MediaKeySession":false,"MediaKeyStatusMap":false,"MediaKeySystemAccess":false,"MediaList":false,"MediaQueryList":false,"MediaQueryListEvent":false,"MediaRecorder":false,"MediaSettingsRange":false,"MediaSource":false,"MediaStream":false,"MediaStreamAudioDestinationNode":false,"MediaStreamAudioSourceNode":false,"MediaStreamEvent":false,"MediaStreamTrack":false,"MediaStreamTrackEvent":false,"menubar":false,"MessageChannel":false,"MessageEvent":false,"MessagePort":false,"MIDIAccess":false,"MIDIConnectionEvent":false,"MIDIInput":false,"MIDIInputMap":false,"MIDIMessageEvent":false,"MIDIOutput":false,"MIDIOutputMap":false,"MIDIPort":false,"MimeType":false,"MimeTypeArray":false,"MouseEvent":false,"moveBy":false,"moveTo":false,"MutationEvent":false,"MutationObserver":false,"MutationRecord":false,"name":false,"NamedNodeMap":false,"NavigationPreloadManager":false,"navigator":false,"Navigator":false,"NetworkInformation":false,"Node":false,"NodeFilter":false,"NodeIterator":false,"NodeList":false,"Notification":false,"OfflineAudioCompletionEvent":false,"OfflineAudioContext":false,"offscreenBuffering":false,"OffscreenCanvas":true,"onabort":true,"onafterprint":true,"onanimationend":true,"onanimationiteration":true,"onanimationstart":true,"onappinstalled":true,"onauxclick":true,"onbeforeinstallprompt":true,"onbeforeprint":true,"onbeforeunload":true,"onblur":true,"oncancel":true,"oncanplay":true,"oncanplaythrough":true,"onchange":true,"onclick":true,"onclose":true,"oncontextmenu":true,"oncuechange":true,"ondblclick":true,"ondevicemotion":true,"ondeviceorientation":true,"ondeviceorientationabsolute":true,"ondrag":true,"ondragend":true,"ondragenter":true,"ondragleave":true,"ondragover":true,"ondragstart":true,"ondrop":true,"ondurationchange":true,"onemptied":true,"onended":true,"onerror":true,"onfocus":true,"ongotpointercapture":true,"onhashchange":true,"oninput":true,"oninvalid":true,"onkeydown":true,"onkeypress":true,"onkeyup":true,"onlanguagechange":true,"onload":true,"onloadeddata":true,"onloadedmetadata":true,"onloadstart":true,"onlostpointercapture":true,"onmessage":true,"onmessageerror":true,"onmousedown":true,"onmouseenter":true,"onmouseleave":true,"onmousemove":true,"onmouseout":true,"onmouseover":true,"onmouseup":true,"onmousewheel":true,"onoffline":true,"ononline":true,"onpagehide":true,"onpageshow":true,"onpause":true,"onplay":true,"onplaying":true,"onpointercancel":true,"onpointerdown":true,"onpointerenter":true,"onpointerleave":true,"onpointermove":true,"onpointerout":true,"onpointerover":true,"onpointerup":true,"onpopstate":true,"onprogress":true,"onratechange":true,"onrejectionhandled":true,"onreset":true,"onresize":true,"onscroll":true,"onsearch":true,"onseeked":true,"onseeking":true,"onselect":true,"onstalled":true,"onstorage":true,"onsubmit":true,"onsuspend":true,"ontimeupdate":true,"ontoggle":true,"ontransitionend":true,"onunhandledrejection":true,"onunload":true,"onvolumechange":true,"onwaiting":true,"onwheel":true,"open":false,"openDatabase":false,"opener":false,"Option":false,"origin":false,"OscillatorNode":false,"outerHeight":false,"outerWidth":false,"PageTransitionEvent":false,"pageXOffset":false,"pageYOffset":false,"PannerNode":false,"parent":false,"Path2D":false,"PaymentAddress":false,"PaymentRequest":false,"PaymentRequestUpdateEvent":false,"PaymentResponse":false,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceLongTaskTiming":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceNavigationTiming":false,"PerformanceObserver":false,"PerformanceObserverEntryList":false,"PerformancePaintTiming":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"PeriodicWave":false,"Permissions":false,"PermissionStatus":false,"personalbar":false,"PhotoCapabilities":false,"Plugin":false,"PluginArray":false,"PointerEvent":false,"PopStateEvent":false,"postMessage":false,"Presentation":false,"PresentationAvailability":false,"PresentationConnection":false,"PresentationConnectionAvailableEvent":false,"PresentationConnectionCloseEvent":false,"PresentationConnectionList":false,"PresentationReceiver":false,"PresentationRequest":false,"print":false,"ProcessingInstruction":false,"ProgressEvent":false,"PromiseRejectionEvent":false,"prompt":false,"PushManager":false,"PushSubscription":false,"PushSubscriptionOptions":false,"queueMicrotask":false,"RadioNodeList":false,"Range":false,"ReadableStream":false,"registerProcessor":false,"RemotePlayback":false,"removeEventListener":false,"Request":false,"requestAnimationFrame":false,"requestIdleCallback":false,"resizeBy":false,"ResizeObserver":false,"ResizeObserverEntry":false,"resizeTo":false,"Response":false,"RTCCertificate":false,"RTCDataChannel":false,"RTCDataChannelEvent":false,"RTCDtlsTransport":false,"RTCIceCandidate":false,"RTCIceGatherer":false,"RTCIceTransport":false,"RTCPeerConnection":false,"RTCPeerConnectionIceEvent":false,"RTCRtpContributingSource":false,"RTCRtpReceiver":false,"RTCRtpSender":false,"RTCSctpTransport":false,"RTCSessionDescription":false,"RTCStatsReport":false,"RTCTrackEvent":false,"screen":false,"Screen":false,"screenLeft":false,"ScreenOrientation":false,"screenTop":false,"screenX":false,"screenY":false,"ScriptProcessorNode":false,"scroll":false,"scrollbars":false,"scrollBy":false,"scrollTo":false,"scrollX":false,"scrollY":false,"SecurityPolicyViolationEvent":false,"Selection":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerRegistration":false,"sessionStorage":false,"setInterval":false,"setTimeout":false,"ShadowRoot":false,"SharedWorker":false,"SourceBuffer":false,"SourceBufferList":false,"speechSynthesis":false,"SpeechSynthesisEvent":false,"SpeechSynthesisUtterance":false,"StaticRange":false,"status":false,"statusbar":false,"StereoPannerNode":false,"stop":false,"Storage":false,"StorageEvent":false,"StorageManager":false,"styleMedia":false,"StyleSheet":false,"StyleSheetList":false,"SubtleCrypto":false,"SVGAElement":false,"SVGAngle":false,"SVGAnimatedAngle":false,"SVGAnimatedBoolean":false,"SVGAnimatedEnumeration":false,"SVGAnimatedInteger":false,"SVGAnimatedLength":false,"SVGAnimatedLengthList":false,"SVGAnimatedNumber":false,"SVGAnimatedNumberList":false,"SVGAnimatedPreserveAspectRatio":false,"SVGAnimatedRect":false,"SVGAnimatedString":false,"SVGAnimatedTransformList":false,"SVGAnimateElement":false,"SVGAnimateMotionElement":false,"SVGAnimateTransformElement":false,"SVGAnimationElement":false,"SVGCircleElement":false,"SVGClipPathElement":false,"SVGComponentTransferFunctionElement":false,"SVGDefsElement":false,"SVGDescElement":false,"SVGDiscardElement":false,"SVGElement":false,"SVGEllipseElement":false,"SVGFEBlendElement":false,"SVGFEColorMatrixElement":false,"SVGFEComponentTransferElement":false,"SVGFECompositeElement":false,"SVGFEConvolveMatrixElement":false,"SVGFEDiffuseLightingElement":false,"SVGFEDisplacementMapElement":false,"SVGFEDistantLightElement":false,"SVGFEDropShadowElement":false,"SVGFEFloodElement":false,"SVGFEFuncAElement":false,"SVGFEFuncBElement":false,"SVGFEFuncGElement":false,"SVGFEFuncRElement":false,"SVGFEGaussianBlurElement":false,"SVGFEImageElement":false,"SVGFEMergeElement":false,"SVGFEMergeNodeElement":false,"SVGFEMorphologyElement":false,"SVGFEOffsetElement":false,"SVGFEPointLightElement":false,"SVGFESpecularLightingElement":false,"SVGFESpotLightElement":false,"SVGFETileElement":false,"SVGFETurbulenceElement":false,"SVGFilterElement":false,"SVGForeignObjectElement":false,"SVGGElement":false,"SVGGeometryElement":false,"SVGGradientElement":false,"SVGGraphicsElement":false,"SVGImageElement":false,"SVGLength":false,"SVGLengthList":false,"SVGLinearGradientElement":false,"SVGLineElement":false,"SVGMarkerElement":false,"SVGMaskElement":false,"SVGMatrix":false,"SVGMetadataElement":false,"SVGMPathElement":false,"SVGNumber":false,"SVGNumberList":false,"SVGPathElement":false,"SVGPatternElement":false,"SVGPoint":false,"SVGPointList":false,"SVGPolygonElement":false,"SVGPolylineElement":false,"SVGPreserveAspectRatio":false,"SVGRadialGradientElement":false,"SVGRect":false,"SVGRectElement":false,"SVGScriptElement":false,"SVGSetElement":false,"SVGStopElement":false,"SVGStringList":false,"SVGStyleElement":false,"SVGSVGElement":false,"SVGSwitchElement":false,"SVGSymbolElement":false,"SVGTextContentElement":false,"SVGTextElement":false,"SVGTextPathElement":false,"SVGTextPositioningElement":false,"SVGTitleElement":false,"SVGTransform":false,"SVGTransformList":false,"SVGTSpanElement":false,"SVGUnitTypes":false,"SVGUseElement":false,"SVGViewElement":false,"TaskAttributionTiming":false,"Text":false,"TextDecoder":false,"TextEncoder":false,"TextEvent":false,"TextMetrics":false,"TextTrack":false,"TextTrackCue":false,"TextTrackCueList":false,"TextTrackList":false,"TimeRanges":false,"toolbar":false,"top":false,"Touch":false,"TouchEvent":false,"TouchList":false,"TrackEvent":false,"TransitionEvent":false,"TreeWalker":false,"UIEvent":false,"URL":false,"URLSearchParams":false,"ValidityState":false,"visualViewport":false,"VisualViewport":false,"VTTCue":false,"WaveShaperNode":false,"WebAssembly":false,"WebGL2RenderingContext":false,"WebGLActiveInfo":false,"WebGLBuffer":false,"WebGLContextEvent":false,"WebGLFramebuffer":false,"WebGLProgram":false,"WebGLQuery":false,"WebGLRenderbuffer":false,"WebGLRenderingContext":false,"WebGLSampler":false,"WebGLShader":false,"WebGLShaderPrecisionFormat":false,"WebGLSync":false,"WebGLTexture":false,"WebGLTransformFeedback":false,"WebGLUniformLocation":false,"WebGLVertexArrayObject":false,"WebSocket":false,"WheelEvent":false,"window":false,"Window":false,"Worker":false,"WritableStream":false,"XMLDocument":false,"XMLHttpRequest":false,"XMLHttpRequestEventTarget":false,"XMLHttpRequestUpload":false,"XMLSerializer":false,"XPathEvaluator":false,"XPathExpression":false,"XPathResult":false,"XSLTProcessor":false},"worker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"clearInterval":false,"clearTimeout":false,"close":true,"console":false,"fetch":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":true,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onlanguagechange":true,"onmessage":true,"onoffline":true,"ononline":true,"onrejectionhandled":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"removeEventListener":false,"Request":false,"Response":false,"self":true,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"node":{"__dirname":false,"__filename":false,"Buffer":false,"clearImmediate":false,"clearInterval":false,"clearTimeout":false,"console":false,"exports":true,"global":false,"Intl":false,"module":false,"process":false,"queueMicrotask":false,"require":false,"setImmediate":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false},"commonjs":{"exports":true,"global":false,"module":false,"require":false},"amd":{"define":false,"require":false},"mocha":{"after":false,"afterEach":false,"before":false,"beforeEach":false,"context":false,"describe":false,"it":false,"mocha":false,"run":false,"setup":false,"specify":false,"suite":false,"suiteSetup":false,"suiteTeardown":false,"teardown":false,"test":false,"xcontext":false,"xdescribe":false,"xit":false,"xspecify":false},"jasmine":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"fail":false,"fdescribe":false,"fit":false,"it":false,"jasmine":false,"pending":false,"runs":false,"spyOn":false,"spyOnProperty":false,"waits":false,"waitsFor":false,"xdescribe":false,"xit":false},"jest":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"fdescribe":false,"fit":false,"it":false,"jest":false,"pit":false,"require":false,"test":false,"xdescribe":false,"xit":false,"xtest":false},"qunit":{"asyncTest":false,"deepEqual":false,"equal":false,"expect":false,"module":false,"notDeepEqual":false,"notEqual":false,"notOk":false,"notPropEqual":false,"notStrictEqual":false,"ok":false,"propEqual":false,"QUnit":false,"raises":false,"start":false,"stop":false,"strictEqual":false,"test":false,"throws":false},"phantomjs":{"console":true,"exports":true,"phantom":true,"require":true,"WebPage":true},"couch":{"emit":false,"exports":false,"getRow":false,"log":false,"module":false,"provides":false,"require":false,"respond":false,"send":false,"start":false,"sum":false},"rhino":{"defineClass":false,"deserialize":false,"gc":false,"help":false,"importClass":false,"importPackage":false,"java":false,"load":false,"loadClass":false,"Packages":false,"print":false,"quit":false,"readFile":false,"readUrl":false,"runCommand":false,"seal":false,"serialize":false,"spawn":false,"sync":false,"toint32":false,"version":false},"nashorn":{"__DIR__":false,"__FILE__":false,"__LINE__":false,"com":false,"edu":false,"exit":false,"java":false,"Java":false,"javafx":false,"JavaImporter":false,"javax":false,"JSAdapter":false,"load":false,"loadWithNewGlobal":false,"org":false,"Packages":false,"print":false,"quit":false},"wsh":{"ActiveXObject":true,"Enumerator":true,"GetObject":true,"ScriptEngine":true,"ScriptEngineBuildVersion":true,"ScriptEngineMajorVersion":true,"ScriptEngineMinorVersion":true,"VBArray":true,"WScript":true,"WSH":true,"XDomainRequest":true},"jquery":{"$":false,"jQuery":false},"yui":{"YAHOO":false,"YAHOO_config":false,"YUI":false,"YUI_config":false},"shelljs":{"cat":false,"cd":false,"chmod":false,"config":false,"cp":false,"dirs":false,"echo":false,"env":false,"error":false,"exec":false,"exit":false,"find":false,"grep":false,"ln":false,"ls":false,"mkdir":false,"mv":false,"popd":false,"pushd":false,"pwd":false,"rm":false,"sed":false,"set":false,"target":false,"tempdir":false,"test":false,"touch":false,"which":false},"prototypejs":{"$":false,"$$":false,"$A":false,"$break":false,"$continue":false,"$F":false,"$H":false,"$R":false,"$w":false,"Abstract":false,"Ajax":false,"Autocompleter":false,"Builder":false,"Class":false,"Control":false,"Draggable":false,"Draggables":false,"Droppables":false,"Effect":false,"Element":false,"Enumerable":false,"Event":false,"Field":false,"Form":false,"Hash":false,"Insertion":false,"ObjectRange":false,"PeriodicalExecuter":false,"Position":false,"Prototype":false,"Scriptaculous":false,"Selector":false,"Sortable":false,"SortableObserver":false,"Sound":false,"Template":false,"Toggle":false,"Try":false},"meteor":{"_":false,"$":false,"Accounts":false,"AccountsClient":false,"AccountsCommon":false,"AccountsServer":false,"App":false,"Assets":false,"Blaze":false,"check":false,"Cordova":false,"DDP":false,"DDPRateLimiter":false,"DDPServer":false,"Deps":false,"EJSON":false,"Email":false,"HTTP":false,"Log":false,"Match":false,"Meteor":false,"Mongo":false,"MongoInternals":false,"Npm":false,"Package":false,"Plugin":false,"process":false,"Random":false,"ReactiveDict":false,"ReactiveVar":false,"Router":false,"ServiceConfiguration":false,"Session":false,"share":false,"Spacebars":false,"Template":false,"Tinytest":false,"Tracker":false,"UI":false,"Utils":false,"WebApp":false,"WebAppInternals":false},"mongo":{"_isWindows":false,"_rand":false,"BulkWriteResult":false,"cat":false,"cd":false,"connect":false,"db":false,"getHostName":false,"getMemInfo":false,"hostname":false,"ISODate":false,"listFiles":false,"load":false,"ls":false,"md5sumFile":false,"mkdir":false,"Mongo":false,"NumberInt":false,"NumberLong":false,"ObjectId":false,"PlanCache":false,"print":false,"printjson":false,"pwd":false,"quit":false,"removeFile":false,"rs":false,"sh":false,"UUID":false,"version":false,"WriteResult":false},"applescript":{"$":false,"Application":false,"Automation":false,"console":false,"delay":false,"Library":false,"ObjC":false,"ObjectSpecifier":false,"Path":false,"Progress":false,"Ref":false},"serviceworker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"CacheStorage":false,"clearInterval":false,"clearTimeout":false,"Client":false,"clients":false,"Clients":false,"close":true,"console":false,"ExtendableEvent":false,"ExtendableMessageEvent":false,"fetch":false,"FetchEvent":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":false,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onfetch":true,"oninstall":true,"onlanguagechange":true,"onmessage":true,"onmessageerror":true,"onnotificationclick":true,"onnotificationclose":true,"onoffline":true,"ononline":true,"onpush":true,"onpushsubscriptionchange":true,"onrejectionhandled":true,"onsync":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"registration":false,"removeEventListener":false,"Request":false,"Response":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerGlobalScope":false,"ServiceWorkerMessageEvent":false,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"skipWaiting":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"WindowClient":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"atomtest":{"advanceClock":false,"fakeClearInterval":false,"fakeClearTimeout":false,"fakeSetInterval":false,"fakeSetTimeout":false,"resetTimeouts":false,"waitsForPromise":false},"embertest":{"andThen":false,"click":false,"currentPath":false,"currentRouteName":false,"currentURL":false,"fillIn":false,"find":false,"findAll":false,"findWithAssert":false,"keyEvent":false,"pauseTest":false,"resumeTest":false,"triggerEvent":false,"visit":false,"wait":false},"protractor":{"$":false,"$$":false,"browser":false,"by":false,"By":false,"DartObject":false,"element":false,"protractor":false},"shared-node-browser":{"clearInterval":false,"clearTimeout":false,"console":false,"setInterval":false,"setTimeout":false,"URL":false,"URLSearchParams":false},"webextensions":{"browser":false,"chrome":false,"opr":false},"greasemonkey":{"cloneInto":false,"createObjectIn":false,"exportFunction":false,"GM":false,"GM_addStyle":false,"GM_deleteValue":false,"GM_getResourceText":false,"GM_getResourceURL":false,"GM_getValue":false,"GM_info":false,"GM_listValues":false,"GM_log":false,"GM_openInTab":false,"GM_registerMenuCommand":false,"GM_setClipboard":false,"GM_setValue":false,"GM_xmlhttpRequest":false,"unsafeWindow":false},"devtools":{"$":false,"$_":false,"$$":false,"$0":false,"$1":false,"$2":false,"$3":false,"$4":false,"$x":false,"chrome":false,"clear":false,"copy":false,"debug":false,"dir":false,"dirxml":false,"getEventListeners":false,"inspect":false,"keys":false,"monitor":false,"monitorEvents":false,"profile":false,"profileEnd":false,"queryObjects":false,"table":false,"undebug":false,"unmonitor":false,"unmonitorEvents":false,"values":false}}')}},Y={};function W(F){var Q=Y[F];if(Q!==void 0)return Q.exports;var J=Y[F]={exports:{}};return X[F].call(J.exports,J,J.exports,W),J.exports}W.d=(F,Q)=>{for(var J in Q)W.o(Q,J)&&!W.o(F,J)&&Object.defineProperty(F,J,{enumerable:!0,get:Q[J]})},W.o=(F,Q)=>Object.prototype.hasOwnProperty.call(F,Q),W.r=(F)=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(F,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(F,"__esModule",{value:!0})};var z={};(()=>{W.d(z,{default:()=>H});var F=W("./node_modules/.pnpm/@babel+core@7.26.0/node_modules/@babel/core/lib/index.js"),Q=W("url"),J=W("./node_modules/.pnpm/@babel+template@7.25.9/node_modules/@babel/template/lib/index.js");function Z(G,q){return{name:"transform-import-meta",visitor:{Program(B){let $=[];if(B.traverse({MemberExpression(R){let{node:E}=R;E.object.type==="MetaProperty"&&E.object.meta.name==="import"&&E.object.property.name==="meta"&&E.property.type==="Identifier"&&E.property.name==="url"&&$.push(R)}}),$.length!==0)for(let R of $)R.replaceWith(J.smart.ast`${q.filename?JSON.stringify((0,Q.pathToFileURL)(q.filename)):"require('url').pathToFileURL(__filename).toString()"}`)}}}}function K({template:G,types:q}){return{name:"@import-meta-env/babel",visitor:{Identifier(B){if(!q.isIdentifier(B))return;if(!q.isMemberExpression(B.parentPath)&&!q.isOptionalMemberExpression(B.parentPath))return;if(!q.isMemberExpression(B.parentPath.node))return;let $=B.parentPath.node;if(!q.isMetaProperty($.object))return;let R=$.object;R.meta.name==="import"&&R.property.name==="meta"&&$.property.name==="env"&&B.parentPath.replaceWith(G.expression.ast("process.env"))}}}}function H(G){var q,B,$,R,E,U;let A=Object.assign(Object.assign({babelrc:!1,configFile:!1,compact:!1,retainLines:typeof G.retainLines!="boolean"||G.retainLines,filename:"",cwd:"/"},G.babel),{plugins:[[W("./node_modules/.pnpm/@babel+plugin-transform-modules-commonjs@7.26.3_@babel+core@7.26.0/node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js"),{allowTopLevelThis:!0}],[W("./node_modules/.pnpm/babel-plugin-dynamic-import-node@2.3.3/node_modules/babel-plugin-dynamic-import-node/lib/index.js"),{noInterop:!0}],[Z,{filename:G.filename}],[W("./node_modules/.pnpm/@babel+plugin-syntax-class-properties@7.12.13_@babel+core@7.26.0/node_modules/@babel/plugin-syntax-class-properties/lib/index.js")],[W("./node_modules/.pnpm/@babel+plugin-transform-export-namespace-from@7.25.9_@babel+core@7.26.0/node_modules/@babel/plugin-transform-export-namespace-from/lib/index.js")],[K]]});G.ts&&(A.plugins.push([W("./node_modules/.pnpm/@babel+plugin-transform-typescript@7.26.3_@babel+core@7.26.0/node_modules/@babel/plugin-transform-typescript/lib/index.js"),{allowDeclareFields:!0}]),A.plugins.unshift([W("./node_modules/.pnpm/babel-plugin-transform-typescript-metadata@0.3.2_@babel+core@7.26.0_@babel+traverse@7.26.4/node_modules/babel-plugin-transform-typescript-metadata/lib/plugin.js")],[W("./node_modules/.pnpm/@babel+plugin-proposal-decorators@7.25.9_@babel+core@7.26.0/node_modules/@babel/plugin-proposal-decorators/lib/index.js"),{legacy:!0}]),A.plugins.push(W("./node_modules/.pnpm/babel-plugin-parameter-decorator@1.0.16/node_modules/babel-plugin-parameter-decorator/lib/index.js")),A.plugins.push(W("./node_modules/.pnpm/@babel+plugin-syntax-import-assertions@7.26.0_@babel+core@7.26.0/node_modules/@babel/plugin-syntax-import-assertions/lib/index.js"))),G.legacy&&(A.plugins.push(W("./node_modules/.pnpm/@babel+plugin-transform-nullish-coalescing-operator@7.25.9_@babel+core@7.26.0/node_modules/@babel/plugin-transform-nullish-coalescing-operator/lib/index.js")),A.plugins.push(W("./node_modules/.pnpm/@babel+plugin-transform-optional-chaining@7.25.9_@babel+core@7.26.0/node_modules/@babel/plugin-transform-optional-chaining/lib/index.js"))),G.babel&&Array.isArray(G.babel.plugins)&&((q=A.plugins)===null||q===void 0||q.push(...G.babel.plugins));try{return{code:((B=(0,F.transformSync)(G.source,A))===null||B===void 0?void 0:B.code)||""}}catch(T){return{error:T,code:"exports.__JITI_ERROR__ = "+JSON.stringify({filename:G.filename,line:(($=T.loc)===null||$===void 0?void 0:$.line)||0,column:((R=T.loc)===null||R===void 0?void 0:R.column)||0,code:(E=T.code)===null||E===void 0?void 0:E.replace("BABEL_","").replace("PARSE_ERROR","ParseError"),message:(U=T.message)===null||U===void 0?void 0:U.replace("/: ","").replace(/\(.+\)\s*$/,"")})}}}})(),m90.exports=z.default})()});var c90=X0((W$1,d90)=>{function qr0(X){throw X}d90.exports=function(Y,W){let z=u90();if(W={onError:qr0,...W},!W.transform)W.transform=g90();return z(Y,W)}});var a1=X0((R80)=>{Object.defineProperty(R80,"__esModule",{value:!0});R80.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=R80.DEFAULT_MAX_SEND_MESSAGE_LENGTH=R80.Propagate=R80.LogVerbosity=R80.Status=void 0;var D80;(function(X){X[X.OK=0]="OK",X[X.CANCELLED=1]="CANCELLED",X[X.UNKNOWN=2]="UNKNOWN",X[X.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",X[X.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",X[X.NOT_FOUND=5]="NOT_FOUND",X[X.ALREADY_EXISTS=6]="ALREADY_EXISTS",X[X.PERMISSION_DENIED=7]="PERMISSION_DENIED",X[X.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",X[X.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",X[X.ABORTED=10]="ABORTED",X[X.OUT_OF_RANGE=11]="OUT_OF_RANGE",X[X.UNIMPLEMENTED=12]="UNIMPLEMENTED",X[X.INTERNAL=13]="INTERNAL",X[X.UNAVAILABLE=14]="UNAVAILABLE",X[X.DATA_LOSS=15]="DATA_LOSS",X[X.UNAUTHENTICATED=16]="UNAUTHENTICATED"})(D80||(R80.Status=D80={}));var E80;(function(X){X[X.DEBUG=0]="DEBUG",X[X.INFO=1]="INFO",X[X.ERROR=2]="ERROR",X[X.NONE=3]="NONE"})(E80||(R80.LogVerbosity=E80={}));var C80;(function(X){X[X.DEADLINE=1]="DEADLINE",X[X.CENSUS_STATS_CONTEXT=2]="CENSUS_STATS_CONTEXT",X[X.CENSUS_TRACING_CONTEXT=4]="CENSUS_TRACING_CONTEXT",X[X.CANCELLATION=8]="CANCELLATION",X[X.DEFAULTS=65535]="DEFAULTS"})(C80||(R80.Propagate=C80={}));R80.DEFAULT_MAX_SEND_MESSAGE_LENGTH=-1;R80.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=4194304});var JU=X0((QD1,Ro0)=>{Ro0.exports={name:"@grpc/grpc-js",version:"1.14.3",description:"gRPC Library for Node - pure JS implementation",homepage:"https://grpc.io/",repository:"https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",main:"build/src/index.js",engines:{node:">=12.10.0"},keywords:[],author:{name:"Google Inc."},types:"build/src/index.d.ts",license:"Apache-2.0",devDependencies:{"@grpc/proto-loader":"file:../proto-loader","@types/gulp":"^4.0.17","@types/gulp-mocha":"0.0.37","@types/lodash":"^4.14.202","@types/mocha":"^10.0.6","@types/ncp":"^2.0.8","@types/node":">=20.11.20","@types/pify":"^5.0.4","@types/semver":"^7.5.8","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0","@typescript-eslint/typescript-estree":"^7.1.0","clang-format":"^1.8.0",eslint:"^8.42.0","eslint-config-prettier":"^8.8.0","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^4.2.1",execa:"^2.0.3",gulp:"^4.0.2","gulp-mocha":"^6.0.0",lodash:"^4.17.21",madge:"^5.0.1","mocha-jenkins-reporter":"^0.4.1",ncp:"^2.0.0",pify:"^4.0.1",prettier:"^2.8.8",rimraf:"^3.0.2",semver:"^7.6.0","ts-node":"^10.9.2",typescript:"^5.3.3"},contributors:[{name:"Google Inc."}],scripts:{build:"npm run compile",clean:"rimraf ./build",compile:"tsc -p .",format:'clang-format -i -style="{Language: JavaScript, BasedOnStyle: Google, ColumnLimit: 80}" src/*.ts test/*.ts',lint:"eslint src/*.ts test/*.ts",prepare:"npm run copy-protos && npm run generate-types && npm run generate-test-types && npm run compile",test:"gulp test",check:"npm run lint",fix:"eslint --fix src/*.ts test/*.ts",pretest:"npm run generate-types && npm run generate-test-types && npm run compile",posttest:"npm run check && madge -c ./build/src","generate-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs proto/ --include-dirs proto/ proto/xds/ proto/protoc-gen-validate/ -O src/generated/ --grpcLib ../index channelz.proto xds/service/orca/v3/orca.proto","generate-test-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --include-dirs test/fixtures/ -O test/generated/ --grpcLib ../../src/index test_service.proto echo_service.proto","copy-protos":"node ./copy-protos"},dependencies:{"@grpc/proto-loader":"^0.8.0","@js-sdsl/ordered-map":"^4.4.2"},files:["src/**/*.ts","build/src/**/*.{js,d.ts,js.map}","proto/**/*.proto","proto/**/LICENSE","LICENSE","deps/envoy-api/envoy/api/v2/**/*.proto","deps/envoy-api/envoy/config/**/*.proto","deps/envoy-api/envoy/service/**/*.proto","deps/envoy-api/envoy/type/**/*.proto","deps/udpa/udpa/**/*.proto","deps/googleapis/google/api/*.proto","deps/googleapis/google/rpc/*.proto","deps/protoc-gen-validate/validate/**/*.proto"]}});var A6=X0((w80)=>{var WU,GU,KU,FU;Object.defineProperty(w80,"__esModule",{value:!0});w80.log=w80.setLoggerVerbosity=w80.setLogger=w80.getLogger=void 0;w80.trace=ho0;w80.isTracerEnabled=P80;var $5=a1(),Mo0=F1("process"),Lo0=JU().version,Po0={error:(X,...Y)=>{console.error("E "+X,...Y)},info:(X,...Y)=>{console.error("I "+X,...Y)},debug:(X,...Y)=>{console.error("D "+X,...Y)}},v7=Po0,sX=$5.LogVerbosity.ERROR,wo0=(GU=(WU=process.env.GRPC_NODE_VERBOSITY)!==null&&WU!==void 0?WU:process.env.GRPC_VERBOSITY)!==null&&GU!==void 0?GU:"";switch(wo0.toUpperCase()){case"DEBUG":sX=$5.LogVerbosity.DEBUG;break;case"INFO":sX=$5.LogVerbosity.INFO;break;case"ERROR":sX=$5.LogVerbosity.ERROR;break;case"NONE":sX=$5.LogVerbosity.NONE;break;default:}var So0=()=>{return v7};w80.getLogger=So0;var fo0=(X)=>{v7=X};w80.setLogger=fo0;var yo0=(X)=>{sX=X};w80.setLoggerVerbosity=yo0;var ko0=(X,...Y)=>{let W;if(X>=sX){switch(X){case $5.LogVerbosity.DEBUG:W=v7.debug;break;case $5.LogVerbosity.INFO:W=v7.info;break;case $5.LogVerbosity.ERROR:W=v7.error;break}if(!W)W=v7.error;if(W)W.bind(v7)(...Y)}};w80.log=ko0;var vo0=(FU=(KU=process.env.GRPC_NODE_TRACE)!==null&&KU!==void 0?KU:process.env.GRPC_TRACE)!==null&&FU!==void 0?FU:"",zU=new Set,L80=new Set;for(let X of vo0.split(","))if(X.startsWith("-"))L80.add(X.substring(1));else zU.add(X);var jo0=zU.has("all");function ho0(X,Y,W){if(P80(Y))w80.log(X,new Date().toISOString()+" | v"+Lo0+" "+Mo0.pid+" | "+Y+" | "+W)}function P80(X){return!L80.has(X)&&(jo0||zU.has(X))}});var ZG=X0((S80)=>{Object.defineProperty(S80,"__esModule",{value:!0});S80.getErrorMessage=go0;S80.getErrorCode=do0;function go0(X){if(X instanceof Error)return X.message;else return String(X)}function do0(X){if(typeof X==="object"&&X!==null&&"code"in X&&typeof X.code==="number")return X.code;else return null}});var s6=X0((k80)=>{Object.defineProperty(k80,"__esModule",{value:!0});k80.Metadata=void 0;var po0=A6(),no0=a1(),io0=ZG(),ao0=/^[:0-9a-z_.-]+$/,ro0=/^[ -~]*$/;function oo0(X){return ao0.test(X)}function to0(X){return ro0.test(X)}function y80(X){return X.endsWith("-bin")}function so0(X){return!X.startsWith("grpc-")}function QG(X){return X.toLowerCase()}function f80(X,Y){if(!oo0(X))throw Error('Metadata key "'+X+'" contains illegal characters');if(Y!==null&&Y!==void 0)if(y80(X)){if(!Buffer.isBuffer(Y))throw Error("keys that end with '-bin' must have Buffer values")}else{if(Buffer.isBuffer(Y))throw Error("keys that don't end with '-bin' must have String values");if(!to0(Y))throw Error('Metadata string value "'+Y+'" contains illegal characters')}}class JG{constructor(X={}){this.internalRepr=new Map,this.opaqueData=new Map,this.options=X}set(X,Y){X=QG(X),f80(X,Y),this.internalRepr.set(X,[Y])}add(X,Y){X=QG(X),f80(X,Y);let W=this.internalRepr.get(X);if(W===void 0)this.internalRepr.set(X,[Y]);else W.push(Y)}remove(X){X=QG(X),this.internalRepr.delete(X)}get(X){return X=QG(X),this.internalRepr.get(X)||[]}getMap(){let X={};for(let[Y,W]of this.internalRepr)if(W.length>0){let z=W[0];X[Y]=Buffer.isBuffer(z)?Buffer.from(z):z}return X}clone(){let X=new JG(this.options),Y=X.internalRepr;for(let[W,z]of this.internalRepr){let F=z.map((Q)=>{if(Buffer.isBuffer(Q))return Buffer.from(Q);else return Q});Y.set(W,F)}return X}merge(X){for(let[Y,W]of X.internalRepr){let z=(this.internalRepr.get(Y)||[]).concat(W);this.internalRepr.set(Y,z)}}setOptions(X){this.options=X}getOptions(){return this.options}toHttp2Headers(){let X={};for(let[Y,W]of this.internalRepr){if(Y.startsWith(":"))continue;X[Y]=W.map(eo0)}return X}toJSON(){let X={};for(let[Y,W]of this.internalRepr)X[Y]=W;return X}setOpaque(X,Y){this.opaqueData.set(X,Y)}getOpaque(X){return this.opaqueData.get(X)}static fromHttp2Headers(X){let Y=new JG;for(let W of Object.keys(X)){if(W.charAt(0)===":")continue;let z=X[W];try{if(y80(W)){if(Array.isArray(z))z.forEach((F)=>{Y.add(W,Buffer.from(F,"base64"))});else if(z!==void 0)if(so0(W))z.split(",").forEach((F)=>{Y.add(W,Buffer.from(F.trim(),"base64"))});else Y.add(W,Buffer.from(z,"base64"))}else if(Array.isArray(z))z.forEach((F)=>{Y.add(W,F)});else if(z!==void 0)Y.add(W,z)}catch(F){let Q=`Failed to add metadata entry ${W}: ${z}. ${(0,io0.getErrorMessage)(F)}. For more information see https://github.com/grpc/grpc-node/issues/1173`;(0,po0.log)(no0.LogVerbosity.ERROR,Q)}}return Y}}k80.Metadata=JG;var eo0=(X)=>{return Buffer.isBuffer(X)?X.toString("base64"):X}});var GG=X0((j80)=>{Object.defineProperty(j80,"__esModule",{value:!0});j80.CallCredentials=void 0;var HU=s6();function Xt0(X){return"getRequestHeaders"in X&&typeof X.getRequestHeaders==="function"}class eX{static createFromMetadataGenerator(X){return new VU(X)}static createFromGoogleCredential(X){return eX.createFromMetadataGenerator((Y,W)=>{let z;if(Xt0(X))z=X.getRequestHeaders(Y.service_url);else z=new Promise((F,Q)=>{X.getRequestMetadata(Y.service_url,(J,Z)=>{if(J){Q(J);return}if(!Z){Q(Error("Headers not set by metadata plugin"));return}F(Z)})});z.then((F)=>{let Q=new HU.Metadata;for(let J of Object.keys(F))Q.add(J,F[J]);W(null,Q)},(F)=>{W(F)})})}static createEmpty(){return new BU}}j80.CallCredentials=eX;class WG extends eX{constructor(X){super();this.creds=X}async generateMetadata(X){let Y=new HU.Metadata,W=await Promise.all(this.creds.map((z)=>z.generateMetadata(X)));for(let z of W)Y.merge(z);return Y}compose(X){return new WG(this.creds.concat([X]))}_equals(X){if(this===X)return!0;if(X instanceof WG)return this.creds.every((Y,W)=>Y._equals(X.creds[W]));else return!1}}class VU extends eX{constructor(X){super();this.metadataGenerator=X}generateMetadata(X){return new Promise((Y,W)=>{this.metadataGenerator(X,(z,F)=>{if(F!==void 0)Y(F);else W(z)})})}compose(X){return new WG([this,X])}_equals(X){if(this===X)return!0;if(X instanceof VU)return this.metadataGenerator===X.metadataGenerator;else return!1}}class BU extends eX{generateMetadata(X){return Promise.resolve(new HU.Metadata)}compose(X){return X}_equals(X){return X instanceof BU}}});var NU=X0((x80)=>{Object.defineProperty(x80,"__esModule",{value:!0});x80.CIPHER_SUITES=void 0;x80.getDefaultRootsData=Zt0;var Yt0=F1("fs");x80.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;var _80=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH,UU=null;function Zt0(){if(_80){if(UU===null)UU=Yt0.readFileSync(_80);return UU}return null}});var E9=X0((m80)=>{Object.defineProperty(m80,"__esModule",{value:!0});m80.parseUri=Wt0;m80.splitHostPort=Gt0;m80.combineHostPort=Kt0;m80.uriToString=Ft0;var Jt0=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;function Wt0(X){let Y=Jt0.exec(X);if(Y===null)return null;return{scheme:Y[1],authority:Y[2],path:Y[3]}}var u80=/^\d+$/;function Gt0(X){if(X.startsWith("[")){let Y=X.indexOf("]");if(Y===-1)return null;let W=X.substring(1,Y);if(W.indexOf(":")===-1)return null;if(X.length>Y+1)if(X[Y+1]===":"){let z=X.substring(Y+2);if(u80.test(z))return{host:W,port:+z};else return null}else return null;else return{host:W}}else{let Y=X.split(":");if(Y.length===2)if(u80.test(Y[1]))return{host:Y[0],port:+Y[1]};else return null;else return{host:X}}}function Kt0(X){if(X.port===void 0)return X.host;else if(X.host.includes(":"))return`[${X.host}]:${X.port}`;else return`${X.host}:${X.port}`}function Ft0(X){let Y="";if(X.scheme!==void 0)Y+=X.scheme+":";if(X.authority!==void 0)Y+="//"+X.authority+"/";return Y+=X.path,Y}});var y8=X0((g80)=>{Object.defineProperty(g80,"__esModule",{value:!0});g80.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=void 0;g80.registerResolver=Bt0;g80.registerDefaultScheme=Ut0;g80.createResolver=Nt0;g80.getDefaultAuthority=At0;g80.mapUriDefaultScheme=Ot0;var OU=E9();g80.CHANNEL_ARGS_CONFIG_SELECTOR_KEY="grpc.internal.config_selector";var XY={},AU=null;function Bt0(X,Y){XY[X]=Y}function Ut0(X){AU=X}function Nt0(X,Y,W){if(X.scheme!==void 0&&X.scheme in XY)return new XY[X.scheme](X,Y,W);else throw Error(`No resolver could be created for target ${(0,OU.uriToString)(X)}`)}function At0(X){if(X.scheme!==void 0&&X.scheme in XY)return XY[X.scheme].getDefaultAuthority(X);else throw Error(`Invalid target ${(0,OU.uriToString)(X)}`)}function Ot0(X){if(X.scheme===void 0||!(X.scheme in XY))if(AU!==null)return{scheme:AU,authority:void 0,path:(0,OU.uriToString)(X)};else return null;return X}});var ZY=X0((n80)=>{Object.defineProperty(n80,"__esModule",{value:!0});n80.ChannelCredentials=void 0;n80.createCertificateProviderChannelCredentials=Lt0;var QQ=F1("tls"),zG=GG(),IU=NU(),c80=E9(),Ct0=y8(),Rt0=A6(),Mt0=a1();function TU(X,Y){if(X&&!(X instanceof Buffer))throw TypeError(`${Y}, if provided, must be a Buffer.`)}class YY{compose(X){return new FG(this,X)}static createSsl(X,Y,W,z){var F;if(TU(X,"Root certificate"),TU(Y,"Private key"),TU(W,"Certificate chain"),Y&&!W)throw Error("Private key must be given with accompanying certificate chain");if(!Y&&W)throw Error("Certificate chain must be given with accompanying private key");let Q=(0,QQ.createSecureContext)({ca:(F=X!==null&&X!==void 0?X:(0,IU.getDefaultRootsData)())!==null&&F!==void 0?F:void 0,key:Y!==null&&Y!==void 0?Y:void 0,cert:W!==null&&W!==void 0?W:void 0,ciphers:IU.CIPHER_SUITES});return new KG(Q,z!==null&&z!==void 0?z:{})}static createFromSecureContext(X,Y){return new KG(X,Y!==null&&Y!==void 0?Y:{})}static createInsecure(){return new $U}}n80.ChannelCredentials=YY;class $U extends YY{constructor(){super()}compose(X){throw Error("Cannot compose insecure credentials")}_isSecure(){return!1}_equals(X){return X instanceof $U}_createSecureConnector(X,Y,W){return{connect(z){return Promise.resolve({socket:z,secure:!1})},waitForReady:()=>{return Promise.resolve()},getCallCredentials:()=>{return W!==null&&W!==void 0?W:zG.CallCredentials.createEmpty()},destroy(){}}}}function l80(X,Y,W,z){var F,Q;let J={secureContext:X},Z=W;if("grpc.http_connect_target"in z){let q=(0,c80.parseUri)(z["grpc.http_connect_target"]);if(q)Z=q}let K=(0,Ct0.getDefaultAuthority)(Z),H=(0,c80.splitHostPort)(K),G=(F=H===null||H===void 0?void 0:H.host)!==null&&F!==void 0?F:K;if(J.host=G,Y.checkServerIdentity)J.checkServerIdentity=Y.checkServerIdentity;if(Y.rejectUnauthorized!==void 0)J.rejectUnauthorized=Y.rejectUnauthorized;if(J.ALPNProtocols=["h2"],z["grpc.ssl_target_name_override"]){let q=z["grpc.ssl_target_name_override"],B=(Q=J.checkServerIdentity)!==null&&Q!==void 0?Q:QQ.checkServerIdentity;J.checkServerIdentity=($,R)=>{return B(q,R)},J.servername=q}else J.servername=G;if(z["grpc-node.tls_enable_trace"])J.enableTrace=!0;return J}class p80{constructor(X,Y){this.connectionOptions=X,this.callCredentials=Y}connect(X){let Y=Object.assign({socket:X},this.connectionOptions);return new Promise((W,z)=>{let F=(0,QQ.connect)(Y,()=>{var Q;if(((Q=this.connectionOptions.rejectUnauthorized)!==null&&Q!==void 0?Q:!0)&&!F.authorized){z(F.authorizationError);return}W({socket:F,secure:!0})});F.on("error",(Q)=>{z(Q)})})}waitForReady(){return Promise.resolve()}getCallCredentials(){return this.callCredentials}destroy(){}}class KG extends YY{constructor(X,Y){super();this.secureContext=X,this.verifyOptions=Y}_isSecure(){return!0}_equals(X){if(this===X)return!0;if(X instanceof KG)return this.secureContext===X.secureContext&&this.verifyOptions.checkServerIdentity===X.verifyOptions.checkServerIdentity;else return!1}_createSecureConnector(X,Y,W){let z=l80(this.secureContext,this.verifyOptions,X,Y);return new p80(z,W!==null&&W!==void 0?W:zG.CallCredentials.createEmpty())}}class ZQ extends YY{constructor(X,Y,W){super();this.caCertificateProvider=X,this.identityCertificateProvider=Y,this.verifyOptions=W,this.refcount=0,this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this),this.secureContextWatchers=[]}_isSecure(){return!0}_equals(X){var Y,W;if(this===X)return!0;if(X instanceof ZQ)return this.caCertificateProvider===X.caCertificateProvider&&this.identityCertificateProvider===X.identityCertificateProvider&&((Y=this.verifyOptions)===null||Y===void 0?void 0:Y.checkServerIdentity)===((W=X.verifyOptions)===null||W===void 0?void 0:W.checkServerIdentity);else return!1}ref(){var X;if(this.refcount===0)this.caCertificateProvider.addCaCertificateListener(this.caCertificateUpdateListener),(X=this.identityCertificateProvider)===null||X===void 0||X.addIdentityCertificateListener(this.identityCertificateUpdateListener);this.refcount+=1}unref(){var X;if(this.refcount-=1,this.refcount===0)this.caCertificateProvider.removeCaCertificateListener(this.caCertificateUpdateListener),(X=this.identityCertificateProvider)===null||X===void 0||X.removeIdentityCertificateListener(this.identityCertificateUpdateListener)}_createSecureConnector(X,Y,W){return this.ref(),new ZQ.SecureConnectorImpl(this,X,Y,W!==null&&W!==void 0?W:zG.CallCredentials.createEmpty())}maybeUpdateWatchers(){if(this.hasReceivedUpdates()){for(let X of this.secureContextWatchers)X(this.getLatestSecureContext());this.secureContextWatchers=[]}}handleCaCertificateUpdate(X){this.latestCaUpdate=X,this.maybeUpdateWatchers()}handleIdentityCertitificateUpdate(X){this.latestIdentityUpdate=X,this.maybeUpdateWatchers()}hasReceivedUpdates(){if(this.latestCaUpdate===void 0)return!1;if(this.identityCertificateProvider&&this.latestIdentityUpdate===void 0)return!1;return!0}getSecureContext(){if(this.hasReceivedUpdates())return Promise.resolve(this.getLatestSecureContext());else return new Promise((X)=>{this.secureContextWatchers.push(X)})}getLatestSecureContext(){var X,Y;if(!this.latestCaUpdate)return null;if(this.identityCertificateProvider!==null&&!this.latestIdentityUpdate)return null;try{return(0,QQ.createSecureContext)({ca:this.latestCaUpdate.caCertificate,key:(X=this.latestIdentityUpdate)===null||X===void 0?void 0:X.privateKey,cert:(Y=this.latestIdentityUpdate)===null||Y===void 0?void 0:Y.certificate,ciphers:IU.CIPHER_SUITES})}catch(W){return(0,Rt0.log)(Mt0.LogVerbosity.ERROR,"Failed to createSecureContext with error "+W.message),null}}}ZQ.SecureConnectorImpl=class{constructor(X,Y,W,z){this.parent=X,this.channelTarget=Y,this.options=W,this.callCredentials=z}connect(X){return new Promise((Y,W)=>{let z=this.parent.getLatestSecureContext();if(!z){W(Error("Failed to load credentials"));return}if(X.closed)W(Error("Socket closed while loading credentials"));let F=l80(z,this.parent.verifyOptions,this.channelTarget,this.options),Q=Object.assign({socket:X},F),J=()=>{W(Error("Socket closed"))},Z=(H)=>{W(H)},K=(0,QQ.connect)(Q,()=>{var H;if(K.removeListener("close",J),K.removeListener("error",Z),((H=this.parent.verifyOptions.rejectUnauthorized)!==null&&H!==void 0?H:!0)&&!K.authorized){W(K.authorizationError);return}Y({socket:K,secure:!0})});K.once("close",J),K.once("error",Z)})}async waitForReady(){await this.parent.getSecureContext()}getCallCredentials(){return this.callCredentials}destroy(){this.parent.unref()}};function Lt0(X,Y,W){return new ZQ(X,Y,W!==null&&W!==void 0?W:{})}class FG extends YY{constructor(X,Y){super();if(this.channelCredentials=X,this.callCredentials=Y,!X._isSecure())throw Error("Cannot compose insecure credentials")}compose(X){let Y=this.callCredentials.compose(X);return new FG(this.channelCredentials,Y)}_isSecure(){return!0}_equals(X){if(this===X)return!0;if(X instanceof FG)return this.channelCredentials._equals(X.channelCredentials)&&this.callCredentials._equals(X.callCredentials);else return!1}_createSecureConnector(X,Y,W){let z=this.callCredentials.compose(W!==null&&W!==void 0?W:zG.CallCredentials.createEmpty());return this.channelCredentials._createSecureConnector(X,Y,z)}}});var E5=X0((r80)=>{Object.defineProperty(r80,"__esModule",{value:!0});r80.createChildChannelControlHelper=ft0;r80.registerLoadBalancerType=yt0;r80.registerDefaultLoadBalancerType=kt0;r80.createLoadBalancer=vt0;r80.isLoadBalancerNameRegistered=jt0;r80.parseLoadBalancingConfig=a80;r80.getDefaultConfig=ht0;r80.selectLbConfigFromList=_t0;var wt0=A6(),St0=a1();function ft0(X,Y){var W,z,F,Q,J,Z,K,H,G,q;return{createSubchannel:(z=(W=Y.createSubchannel)===null||W===void 0?void 0:W.bind(Y))!==null&&z!==void 0?z:X.createSubchannel.bind(X),updateState:(Q=(F=Y.updateState)===null||F===void 0?void 0:F.bind(Y))!==null&&Q!==void 0?Q:X.updateState.bind(X),requestReresolution:(Z=(J=Y.requestReresolution)===null||J===void 0?void 0:J.bind(Y))!==null&&Z!==void 0?Z:X.requestReresolution.bind(X),addChannelzChild:(H=(K=Y.addChannelzChild)===null||K===void 0?void 0:K.bind(Y))!==null&&H!==void 0?H:X.addChannelzChild.bind(X),removeChannelzChild:(q=(G=Y.removeChannelzChild)===null||G===void 0?void 0:G.bind(Y))!==null&&q!==void 0?q:X.removeChannelzChild.bind(X)}}var D5={},JQ=null;function yt0(X,Y,W){D5[X]={LoadBalancer:Y,LoadBalancingConfig:W}}function kt0(X){JQ=X}function vt0(X,Y){let W=X.getLoadBalancerName();if(W in D5)return new D5[W].LoadBalancer(Y);else return null}function jt0(X){return X in D5}function a80(X){let Y=Object.keys(X);if(Y.length!==1)throw Error("Provided load balancing config has multiple conflicting entries");let W=Y[0];if(W in D5)try{return D5[W].LoadBalancingConfig.createFromJson(X[W])}catch(z){throw Error(`${W}: ${z.message}`)}else throw Error(`Unrecognized load balancing config name ${W}`)}function ht0(){if(!JQ)throw Error("No default load balancer type registered");return new D5[JQ].LoadBalancingConfig}function _t0(X,Y=!1){for(let W of X)try{return a80(W)}catch(z){(0,wt0.log)(St0.LogVerbosity.DEBUG,"Config parsing failed with error",z.message);continue}if(Y)if(JQ)return new D5[JQ].LoadBalancingConfig;else return null;else return null}});var DU=X0((s80)=>{Object.defineProperty(s80,"__esModule",{value:!0});s80.validateRetryThrottling=o80;s80.validateServiceConfig=t80;s80.extractAndSelectServiceConfig=Xs0;var pt0=F1("os"),qG=a1(),HG=/^\d+(\.\d{1,9})?s$/,nt0="node";function it0(X){if("service"in X&&X.service!==""){if(typeof X.service!=="string")throw Error(`Invalid method config name: invalid service: expected type string, got ${typeof X.service}`);if("method"in X&&X.method!==""){if(typeof X.method!=="string")throw Error(`Invalid method config name: invalid method: expected type string, got ${typeof X.service}`);return{service:X.service,method:X.method}}else return{service:X.service}}else{if("method"in X&&X.method!==void 0)throw Error("Invalid method config name: method set with empty or unset service");return{}}}function at0(X){if(!("maxAttempts"in X)||!Number.isInteger(X.maxAttempts)||X.maxAttempts<2)throw Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");if(!("initialBackoff"in X)||typeof X.initialBackoff!=="string"||!HG.test(X.initialBackoff))throw Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("maxBackoff"in X)||typeof X.maxBackoff!=="string"||!HG.test(X.maxBackoff))throw Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("backoffMultiplier"in X)||typeof X.backoffMultiplier!=="number"||X.backoffMultiplier<=0)throw Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");if(!(("retryableStatusCodes"in X)&&Array.isArray(X.retryableStatusCodes)))throw Error("Invalid method config retry policy: retryableStatusCodes is required");if(X.retryableStatusCodes.length===0)throw Error("Invalid method config retry policy: retryableStatusCodes must be non-empty");for(let Y of X.retryableStatusCodes)if(typeof Y==="number"){if(!Object.values(qG.Status).includes(Y))throw Error("Invalid method config retry policy: retryableStatusCodes value not in status code range")}else if(typeof Y==="string"){if(!Object.values(qG.Status).includes(Y.toUpperCase()))throw Error("Invalid method config retry policy: retryableStatusCodes value not a status code name")}else throw Error("Invalid method config retry policy: retryableStatusCodes value must be a string or number");return{maxAttempts:X.maxAttempts,initialBackoff:X.initialBackoff,maxBackoff:X.maxBackoff,backoffMultiplier:X.backoffMultiplier,retryableStatusCodes:X.retryableStatusCodes}}function rt0(X){if(!("maxAttempts"in X)||!Number.isInteger(X.maxAttempts)||X.maxAttempts<2)throw Error("Invalid method config hedging policy: maxAttempts must be an integer at least 2");if("hedgingDelay"in X&&(typeof X.hedgingDelay!=="string"||!HG.test(X.hedgingDelay)))throw Error("Invalid method config hedging policy: hedgingDelay must be a string consisting of a positive integer followed by s");if("nonFatalStatusCodes"in X&&Array.isArray(X.nonFatalStatusCodes))for(let W of X.nonFatalStatusCodes)if(typeof W==="number"){if(!Object.values(qG.Status).includes(W))throw Error("Invalid method config hedging policy: nonFatalStatusCodes value not in status code range")}else if(typeof W==="string"){if(!Object.values(qG.Status).includes(W.toUpperCase()))throw Error("Invalid method config hedging policy: nonFatalStatusCodes value not a status code name")}else throw Error("Invalid method config hedging policy: nonFatalStatusCodes value must be a string or number");let Y={maxAttempts:X.maxAttempts};if(X.hedgingDelay)Y.hedgingDelay=X.hedgingDelay;if(X.nonFatalStatusCodes)Y.nonFatalStatusCodes=X.nonFatalStatusCodes;return Y}function ot0(X){var Y;let W={name:[]};if(!("name"in X)||!Array.isArray(X.name))throw Error("Invalid method config: invalid name array");for(let z of X.name)W.name.push(it0(z));if("waitForReady"in X){if(typeof X.waitForReady!=="boolean")throw Error("Invalid method config: invalid waitForReady");W.waitForReady=X.waitForReady}if("timeout"in X)if(typeof X.timeout==="object"){if(!("seconds"in X.timeout)||typeof X.timeout.seconds!=="number")throw Error("Invalid method config: invalid timeout.seconds");if(!("nanos"in X.timeout)||typeof X.timeout.nanos!=="number")throw Error("Invalid method config: invalid timeout.nanos");W.timeout=X.timeout}else if(typeof X.timeout==="string"&&HG.test(X.timeout)){let z=X.timeout.substring(0,X.timeout.length-1).split(".");W.timeout={seconds:z[0]|0,nanos:((Y=z[1])!==null&&Y!==void 0?Y:0)|0}}else throw Error("Invalid method config: invalid timeout");if("maxRequestBytes"in X){if(typeof X.maxRequestBytes!=="number")throw Error("Invalid method config: invalid maxRequestBytes");W.maxRequestBytes=X.maxRequestBytes}if("maxResponseBytes"in X){if(typeof X.maxResponseBytes!=="number")throw Error("Invalid method config: invalid maxRequestBytes");W.maxResponseBytes=X.maxResponseBytes}if("retryPolicy"in X)if("hedgingPolicy"in X)throw Error("Invalid method config: retryPolicy and hedgingPolicy cannot both be specified");else W.retryPolicy=at0(X.retryPolicy);else if("hedgingPolicy"in X)W.hedgingPolicy=rt0(X.hedgingPolicy);return W}function o80(X){if(!("maxTokens"in X)||typeof X.maxTokens!=="number"||X.maxTokens<=0||X.maxTokens>1000)throw Error("Invalid retryThrottling: maxTokens must be a number in (0, 1000]");if(!("tokenRatio"in X)||typeof X.tokenRatio!=="number"||X.tokenRatio<=0)throw Error("Invalid retryThrottling: tokenRatio must be a number greater than 0");return{maxTokens:+X.maxTokens.toFixed(3),tokenRatio:+X.tokenRatio.toFixed(3)}}function tt0(X){if(!(typeof X==="object"&&X!==null))throw Error(`Invalid loadBalancingConfig: unexpected type ${typeof X}`);let Y=Object.keys(X);if(Y.length>1)throw Error(`Invalid loadBalancingConfig: unexpected multiple keys ${Y}`);if(Y.length===0)throw Error("Invalid loadBalancingConfig: load balancing policy name required");return{[Y[0]]:X[Y[0]]}}function t80(X){let Y={loadBalancingConfig:[],methodConfig:[]};if("loadBalancingPolicy"in X)if(typeof X.loadBalancingPolicy==="string")Y.loadBalancingPolicy=X.loadBalancingPolicy;else throw Error("Invalid service config: invalid loadBalancingPolicy");if("loadBalancingConfig"in X)if(Array.isArray(X.loadBalancingConfig))for(let z of X.loadBalancingConfig)Y.loadBalancingConfig.push(tt0(z));else throw Error("Invalid service config: invalid loadBalancingConfig");if("methodConfig"in X){if(Array.isArray(X.methodConfig))for(let z of X.methodConfig)Y.methodConfig.push(ot0(z))}if("retryThrottling"in X)Y.retryThrottling=o80(X.retryThrottling);let W=[];for(let z of Y.methodConfig)for(let F of z.name){for(let Q of W)if(F.service===Q.service&&F.method===Q.method)throw Error(`Invalid service config: duplicate name ${F.service}/${F.method}`);W.push(F)}return Y}function st0(X){if(!("serviceConfig"in X))throw Error("Invalid service config choice: missing service config");let Y={serviceConfig:t80(X.serviceConfig)};if("clientLanguage"in X)if(Array.isArray(X.clientLanguage)){Y.clientLanguage=[];for(let z of X.clientLanguage)if(typeof z==="string")Y.clientLanguage.push(z);else throw Error("Invalid service config choice: invalid clientLanguage")}else throw Error("Invalid service config choice: invalid clientLanguage");if("clientHostname"in X)if(Array.isArray(X.clientHostname)){Y.clientHostname=[];for(let z of X.clientHostname)if(typeof z==="string")Y.clientHostname.push(z);else throw Error("Invalid service config choice: invalid clientHostname")}else throw Error("Invalid service config choice: invalid clientHostname");if("percentage"in X)if(typeof X.percentage==="number"&&0<=X.percentage&&X.percentage<=100)Y.percentage=X.percentage;else throw Error("Invalid service config choice: invalid percentage");let W=["clientLanguage","percentage","clientHostname","serviceConfig"];for(let z in X)if(!W.includes(z))throw Error(`Invalid service config choice: unexpected field ${z}`);return Y}function et0(X,Y){if(!Array.isArray(X))throw Error("Invalid service config list");for(let W of X){let z=st0(W);if(typeof z.percentage==="number"&&Y>z.percentage)continue;if(Array.isArray(z.clientHostname)){let F=!1;for(let Q of z.clientHostname)if(Q===pt0.hostname())F=!0;if(!F)continue}if(Array.isArray(z.clientLanguage)){let F=!1;for(let Q of z.clientLanguage)if(Q===nt0)F=!0;if(!F)continue}return z.serviceConfig}throw Error("No matching service config found")}function Xs0(X,Y){for(let W of X)if(W.length>0&&W[0].startsWith("grpc_config=")){let z=W.join("").substring(12),F=JSON.parse(z);return et0(F,Y)}return null}});var C9=X0((X40)=>{Object.defineProperty(X40,"__esModule",{value:!0});X40.ConnectivityState=void 0;var e80;(function(X){X[X.IDLE=0]="IDLE",X[X.CONNECTING=1]="CONNECTING",X[X.READY=2]="READY",X[X.TRANSIENT_FAILURE=3]="TRANSIENT_FAILURE",X[X.SHUTDOWN=4]="SHUTDOWN"})(e80||(X40.ConnectivityState=e80={}))});var b4=X0((J40)=>{Object.defineProperty(J40,"__esModule",{value:!0});J40.QueuePicker=J40.UnavailablePicker=J40.PickResultType=void 0;var Js0=s6(),Ws0=a1(),VG;(function(X){X[X.COMPLETE=0]="COMPLETE",X[X.QUEUE=1]="QUEUE",X[X.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",X[X.DROP=3]="DROP"})(VG||(J40.PickResultType=VG={}));class Z40{constructor(X){this.status=Object.assign({code:Ws0.Status.UNAVAILABLE,details:"No connection established",metadata:new Js0.Metadata},X)}pick(X){return{pickResultType:VG.TRANSIENT_FAILURE,subchannel:null,status:this.status,onCallStarted:null,onCallEnded:null}}}J40.UnavailablePicker=Z40;class Q40{constructor(X,Y){this.loadBalancer=X,this.childPicker=Y,this.calledExitIdle=!1}pick(X){if(!this.calledExitIdle)process.nextTick(()=>{this.loadBalancer.exitIdle()}),this.calledExitIdle=!0;if(this.childPicker)return this.childPicker.pick(X);else return{pickResultType:VG.QUEUE,subchannel:null,status:null,onCallStarted:null,onCallEnded:null}}}J40.QueuePicker=Q40});var QY=X0((G40)=>{Object.defineProperty(G40,"__esModule",{value:!0});G40.BackoffTimeout=void 0;var Fs0=a1(),zs0=A6(),qs0="backoff",Hs0=1000,Vs0=1.6,Bs0=120000,Us0=0.2;function Ns0(X,Y){return Math.random()*(Y-X)+X}class BG{constructor(X,Y){if(this.callback=X,this.initialDelay=Hs0,this.multiplier=Vs0,this.maxDelay=Bs0,this.jitter=Us0,this.running=!1,this.hasRef=!0,this.startTime=new Date,this.endTime=new Date,this.id=BG.getNextId(),Y){if(Y.initialDelay)this.initialDelay=Y.initialDelay;if(Y.multiplier)this.multiplier=Y.multiplier;if(Y.jitter)this.jitter=Y.jitter;if(Y.maxDelay)this.maxDelay=Y.maxDelay}this.trace("constructed initialDelay="+this.initialDelay+" multiplier="+this.multiplier+" jitter="+this.jitter+" maxDelay="+this.maxDelay),this.nextDelay=this.initialDelay,this.timerId=setTimeout(()=>{},0),clearTimeout(this.timerId)}static getNextId(){return this.nextId++}trace(X){zs0.trace(Fs0.LogVerbosity.DEBUG,qs0,"{"+this.id+"} "+X)}runTimer(X){var Y,W;if(this.trace("runTimer(delay="+X+")"),this.endTime=this.startTime,this.endTime.setMilliseconds(this.endTime.getMilliseconds()+X),clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.trace("timer fired"),this.running=!1,this.callback()},X),!this.hasRef)(W=(Y=this.timerId).unref)===null||W===void 0||W.call(Y)}runOnce(){this.trace("runOnce()"),this.running=!0,this.startTime=new Date,this.runTimer(this.nextDelay);let X=Math.min(this.nextDelay*this.multiplier,this.maxDelay),Y=X*this.jitter;this.nextDelay=X+Ns0(-Y,Y)}stop(){this.trace("stop()"),clearTimeout(this.timerId),this.running=!1}reset(){if(this.trace("reset() running="+this.running),this.nextDelay=this.initialDelay,this.running){let X=new Date,Y=this.startTime;if(Y.setMilliseconds(Y.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),X<Y)this.runTimer(Y.getTime()-X.getTime());else this.running=!1}}isRunning(){return this.running}ref(){var X,Y;this.hasRef=!0,(Y=(X=this.timerId).ref)===null||Y===void 0||Y.call(X)}unref(){var X,Y;this.hasRef=!1,(Y=(X=this.timerId).unref)===null||Y===void 0||Y.call(X)}getEndTime(){return this.endTime}}G40.BackoffTimeout=BG;BG.nextId=0});var UG=X0((z40)=>{Object.defineProperty(z40,"__esModule",{value:!0});z40.ChildLoadBalancerHandler=void 0;var As0=E5(),Os0=C9(),Ts0="child_load_balancer_helper";class F40{constructor(X){this.channelControlHelper=X,this.currentChild=null,this.pendingChild=null,this.latestConfig=null,this.ChildPolicyHelper=class{constructor(Y){this.parent=Y,this.child=null}createSubchannel(Y,W){return this.parent.channelControlHelper.createSubchannel(Y,W)}updateState(Y,W,z){var F;if(this.calledByPendingChild()){if(Y===Os0.ConnectivityState.CONNECTING)return;(F=this.parent.currentChild)===null||F===void 0||F.destroy(),this.parent.currentChild=this.parent.pendingChild,this.parent.pendingChild=null}else if(!this.calledByCurrentChild())return;this.parent.channelControlHelper.updateState(Y,W,z)}requestReresolution(){var Y;let W=(Y=this.parent.pendingChild)!==null&&Y!==void 0?Y:this.parent.currentChild;if(this.child===W)this.parent.channelControlHelper.requestReresolution()}setChild(Y){this.child=Y}addChannelzChild(Y){this.parent.channelControlHelper.addChannelzChild(Y)}removeChannelzChild(Y){this.parent.channelControlHelper.removeChannelzChild(Y)}calledByPendingChild(){return this.child===this.parent.pendingChild}calledByCurrentChild(){return this.child===this.parent.currentChild}}}configUpdateRequiresNewPolicyInstance(X,Y){return X.getLoadBalancerName()!==Y.getLoadBalancerName()}updateAddressList(X,Y,W,z){let F;if(this.currentChild===null||this.latestConfig===null||this.configUpdateRequiresNewPolicyInstance(this.latestConfig,Y)){let Q=new this.ChildPolicyHelper(this),J=(0,As0.createLoadBalancer)(Y,Q);if(Q.setChild(J),this.currentChild===null)this.currentChild=J,F=this.currentChild;else{if(this.pendingChild)this.pendingChild.destroy();this.pendingChild=J,F=this.pendingChild}}else if(this.pendingChild===null)F=this.currentChild;else F=this.pendingChild;return this.latestConfig=Y,F.updateAddressList(X,Y,W,z)}exitIdle(){if(this.currentChild){if(this.currentChild.exitIdle(),this.pendingChild)this.pendingChild.exitIdle()}}resetBackoff(){if(this.currentChild){if(this.currentChild.resetBackoff(),this.pendingChild)this.pendingChild.resetBackoff()}}destroy(){if(this.currentChild)this.currentChild.destroy(),this.currentChild=null;if(this.pendingChild)this.pendingChild.destroy(),this.pendingChild=null}getTypeName(){return Ts0}}z40.ChildLoadBalancerHandler=F40});var A40=X0((U40)=>{Object.defineProperty(U40,"__esModule",{value:!0});U40.ResolvingLoadBalancer=void 0;var Is0=E5(),$s0=DU(),f9=C9(),H40=y8(),WQ=b4(),Ds0=QY(),EU=a1(),Es0=s6(),Cs0=A6(),Rs0=a1(),Ms0=E9(),Ls0=UG(),Ps0="resolving_load_balancer";function V40(X){Cs0.trace(Rs0.LogVerbosity.DEBUG,Ps0,X)}var ws0=["SERVICE_AND_METHOD","SERVICE","EMPTY"];function Ss0(X,Y,W,z){for(let F of W.name)switch(z){case"EMPTY":if(!F.service&&!F.method)return!0;break;case"SERVICE":if(F.service===X&&!F.method)return!0;break;case"SERVICE_AND_METHOD":if(F.service===X&&F.method===Y)return!0}return!1}function fs0(X,Y,W,z){for(let F of W)if(Ss0(X,Y,F,z))return F;return null}function ys0(X){return{invoke(Y,W){var z,F;let Q=Y.split("/").filter((K)=>K.length>0),J=(z=Q[0])!==null&&z!==void 0?z:"",Z=(F=Q[1])!==null&&F!==void 0?F:"";if(X&&X.methodConfig)for(let K of ws0){let H=fs0(J,Z,X.methodConfig,K);if(H)return{methodConfig:H,pickInformation:{},status:EU.Status.OK,dynamicFilterFactories:[]}}return{methodConfig:{name:[]},pickInformation:{},status:EU.Status.OK,dynamicFilterFactories:[]}},unref(){}}}class B40{constructor(X,Y,W,z,F){if(this.target=X,this.channelControlHelper=Y,this.channelOptions=W,this.onSuccessfulResolution=z,this.onFailedResolution=F,this.latestChildState=f9.ConnectivityState.IDLE,this.latestChildPicker=new WQ.QueuePicker(this),this.latestChildErrorMessage=null,this.currentState=f9.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,W["grpc.service_config"])this.defaultServiceConfig=(0,$s0.validateServiceConfig)(JSON.parse(W["grpc.service_config"]));else this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]};this.updateState(f9.ConnectivityState.IDLE,new WQ.QueuePicker(this),null),this.childLoadBalancer=new Ls0.ChildLoadBalancerHandler({createSubchannel:Y.createSubchannel.bind(Y),requestReresolution:()=>{if(this.backoffTimeout.isRunning())V40("requestReresolution delayed by backoff timer until "+this.backoffTimeout.getEndTime().toISOString()),this.continueResolving=!0;else this.updateResolution()},updateState:(J,Z,K)=>{this.latestChildState=J,this.latestChildPicker=Z,this.latestChildErrorMessage=K,this.updateState(J,Z,K)},addChannelzChild:Y.addChannelzChild.bind(Y),removeChannelzChild:Y.removeChannelzChild.bind(Y)}),this.innerResolver=(0,H40.createResolver)(X,this.handleResolverResult.bind(this),W);let Q={initialDelay:W["grpc.initial_reconnect_backoff_ms"],maxDelay:W["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new Ds0.BackoffTimeout(()=>{if(this.continueResolving)this.updateResolution(),this.continueResolving=!1;else this.updateState(this.latestChildState,this.latestChildPicker,this.latestChildErrorMessage)},Q),this.backoffTimeout.unref()}handleResolverResult(X,Y,W,z){var F,Q;this.backoffTimeout.stop(),this.backoffTimeout.reset();let J=!0,Z=null;if(W===null)Z=this.defaultServiceConfig;else if(W.ok)Z=W.value;else if(this.previousServiceConfig!==null)Z=this.previousServiceConfig;else J=!1,this.handleResolutionFailure(W.error);if(Z!==null){let K=(F=Z===null||Z===void 0?void 0:Z.loadBalancingConfig)!==null&&F!==void 0?F:[],H=(0,Is0.selectLbConfigFromList)(K,!0);if(H===null)J=!1,this.handleResolutionFailure({code:EU.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new Es0.Metadata});else J=this.childLoadBalancer.updateAddressList(X,H,Object.assign(Object.assign({},this.channelOptions),Y),z)}if(J)this.onSuccessfulResolution(Z,(Q=Y[H40.CHANNEL_ARGS_CONFIG_SELECTOR_KEY])!==null&&Q!==void 0?Q:ys0(Z));return J}updateResolution(){if(this.innerResolver.updateResolution(),this.currentState===f9.ConnectivityState.IDLE)this.updateState(f9.ConnectivityState.CONNECTING,this.latestChildPicker,this.latestChildErrorMessage);this.backoffTimeout.runOnce()}updateState(X,Y,W){if(V40((0,Ms0.uriToString)(this.target)+" "+f9.ConnectivityState[this.currentState]+" -> "+f9.ConnectivityState[X]),X===f9.ConnectivityState.IDLE)Y=new WQ.QueuePicker(this,Y);this.currentState=X,this.channelControlHelper.updateState(X,Y,W)}handleResolutionFailure(X){if(this.latestChildState===f9.ConnectivityState.IDLE)this.updateState(f9.ConnectivityState.TRANSIENT_FAILURE,new WQ.UnavailablePicker(X),X.details),this.onFailedResolution(X)}exitIdle(){if(this.currentState===f9.ConnectivityState.IDLE||this.currentState===f9.ConnectivityState.TRANSIENT_FAILURE)if(this.backoffTimeout.isRunning())this.continueResolving=!0;else this.updateResolution();this.childLoadBalancer.exitIdle()}updateAddressList(X,Y){throw Error("updateAddressList not supported on ResolvingLoadBalancer")}resetBackoff(){this.backoffTimeout.reset(),this.childLoadBalancer.resetBackoff()}destroy(){this.childLoadBalancer.destroy(),this.innerResolver.destroy(),this.backoffTimeout.reset(),this.backoffTimeout.stop(),this.latestChildState=f9.ConnectivityState.IDLE,this.latestChildPicker=new WQ.QueuePicker(this),this.currentState=f9.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1}getTypeName(){return"resolving_load_balancer"}}U40.ResolvingLoadBalancer=B40});var I40=X0((O40)=>{Object.defineProperty(O40,"__esModule",{value:!0});O40.recognizedOptions=void 0;O40.channelOptionsEqual=ks0;O40.recognizedOptions={"grpc.ssl_target_name_override":!0,"grpc.primary_user_agent":!0,"grpc.secondary_user_agent":!0,"grpc.default_authority":!0,"grpc.keepalive_time_ms":!0,"grpc.keepalive_timeout_ms":!0,"grpc.keepalive_permit_without_calls":!0,"grpc.service_config":!0,"grpc.max_concurrent_streams":!0,"grpc.initial_reconnect_backoff_ms":!0,"grpc.max_reconnect_backoff_ms":!0,"grpc.use_local_subchannel_pool":!0,"grpc.max_send_message_length":!0,"grpc.max_receive_message_length":!0,"grpc.enable_http_proxy":!0,"grpc.enable_channelz":!0,"grpc.dns_min_time_between_resolutions_ms":!0,"grpc.enable_retries":!0,"grpc.per_rpc_retry_buffer_size":!0,"grpc.retry_buffer_size":!0,"grpc.max_connection_age_ms":!0,"grpc.max_connection_age_grace_ms":!0,"grpc-node.max_session_memory":!0,"grpc.service_config_disable_resolution":!0,"grpc.client_idle_timeout_ms":!0,"grpc-node.tls_enable_trace":!0,"grpc.lb.ring_hash.ring_size_cap":!0,"grpc-node.retry_max_attempts_limit":!0,"grpc-node.flow_control_window":!0,"grpc.server_call_metric_recording":!0};function ks0(X,Y){let W=Object.keys(X).sort(),z=Object.keys(Y).sort();if(W.length!==z.length)return!1;for(let F=0;F<W.length;F+=1){if(W[F]!==z[F])return!1;if(X[W[F]]!==Y[z[F]])return!1}return!0}});var y9=X0((R40)=>{Object.defineProperty(R40,"__esModule",{value:!0});R40.EndpointMap=void 0;R40.isTcpSubchannelAddress=KQ;R40.subchannelAddressEqual=NG;R40.subchannelAddressToString=D40;R40.stringToSubchannelAddress=hs0;R40.endpointEqual=_s0;R40.endpointToString=xs0;R40.endpointHasAddress=E40;var $40=F1("net");function KQ(X){return"port"in X}function NG(X,Y){if(!X&&!Y)return!0;if(!X||!Y)return!1;if(KQ(X))return KQ(Y)&&X.host===Y.host&&X.port===Y.port;else return!KQ(Y)&&X.path===Y.path}function D40(X){if(KQ(X))if((0,$40.isIPv6)(X.host))return"["+X.host+"]:"+X.port;else return X.host+":"+X.port;else return X.path}var js0=443;function hs0(X,Y){if((0,$40.isIP)(X))return{host:X,port:Y!==null&&Y!==void 0?Y:js0};else return{path:X}}function _s0(X,Y){if(X.addresses.length!==Y.addresses.length)return!1;for(let W=0;W<X.addresses.length;W++)if(!NG(X.addresses[W],Y.addresses[W]))return!1;return!0}function xs0(X){return"["+X.addresses.map(D40).join(", ")+"]"}function E40(X,Y){for(let W of X.addresses)if(NG(W,Y))return!0;return!1}function GQ(X,Y){if(X.addresses.length!==Y.addresses.length)return!1;for(let W of X.addresses){let z=!1;for(let F of Y.addresses)if(NG(W,F)){z=!0;break}if(!z)return!1}return!0}class C40{constructor(){this.map=new Set}get size(){return this.map.size}getForSubchannelAddress(X){for(let Y of this.map)if(E40(Y.key,X))return Y.value;return}deleteMissing(X){let Y=[];for(let W of this.map){let z=!1;for(let F of X)if(GQ(F,W.key))z=!0;if(!z)Y.push(W.value),this.map.delete(W)}return Y}get(X){for(let Y of this.map)if(GQ(X,Y.key))return Y.value;return}set(X,Y){for(let W of this.map)if(GQ(X,W.key)){W.value=Y;return}this.map.add({key:X,value:Y})}delete(X){for(let Y of this.map)if(GQ(X,Y.key)){this.map.delete(Y);return}}has(X){for(let Y of this.map)if(GQ(X,Y.key))return!0;return!1}clear(){this.map.clear()}*keys(){for(let X of this.map)yield X.key}*values(){for(let X of this.map)yield X.value}*entries(){for(let X of this.map)yield[X.key,X.value]}}R40.EndpointMap=C40});var j40=X0((v40)=>{Object.defineProperty(v40,"t",{value:!0});class CU{constructor(X,Y,W=1){this.i=void 0,this.h=void 0,this.o=void 0,this.u=X,this.l=Y,this.p=W}I(){let X=this,Y=X.o.o===X;if(Y&&X.p===1)X=X.h;else if(X.i){X=X.i;while(X.h)X=X.h}else{if(Y)return X.o;let W=X.o;while(W.i===X)X=W,W=X.o;X=W}return X}B(){let X=this;if(X.h){X=X.h;while(X.i)X=X.i;return X}else{let Y=X.o;while(Y.h===X)X=Y,Y=X.o;if(X.h!==Y)return Y;else return X}}_(){let X=this.o,Y=this.h,W=Y.i;if(X.o===this)X.o=Y;else if(X.i===this)X.i=Y;else X.h=Y;if(Y.o=X,Y.i=this,this.o=Y,this.h=W,W)W.o=this;return Y}g(){let X=this.o,Y=this.i,W=Y.h;if(X.o===this)X.o=Y;else if(X.i===this)X.i=Y;else X.h=Y;if(Y.o=X,Y.h=this,this.o=Y,this.i=W,W)W.o=this;return Y}}class L40 extends CU{constructor(){super(...arguments);this.M=1}_(){let X=super._();return this.O(),X.O(),X}g(){let X=super.g();return this.O(),X.O(),X}O(){if(this.M=1,this.i)this.M+=this.i.M;if(this.h)this.M+=this.h.M}}class P40{constructor(X=0){this.iteratorType=X}equals(X){return this.T===X.T}}class w40{constructor(){this.m=0}get length(){return this.m}size(){return this.m}empty(){return this.m===0}}class S40 extends w40{}function j7(){throw RangeError("Iterator access denied!")}class f40 extends S40{constructor(X=function(W,z){if(W<z)return-1;if(W>z)return 1;return 0},Y=!1){super();this.v=void 0,this.A=X,this.enableIndex=Y,this.N=Y?L40:CU,this.C=new this.N}R(X,Y){let W=this.C;while(X){let z=this.A(X.u,Y);if(z<0)X=X.h;else if(z>0)W=X,X=X.i;else return X}return W}K(X,Y){let W=this.C;while(X)if(this.A(X.u,Y)<=0)X=X.h;else W=X,X=X.i;return W}L(X,Y){let W=this.C;while(X){let z=this.A(X.u,Y);if(z<0)W=X,X=X.h;else if(z>0)X=X.i;else return X}return W}k(X,Y){let W=this.C;while(X)if(this.A(X.u,Y)<0)W=X,X=X.h;else X=X.i;return W}P(X){while(!0){let Y=X.o;if(Y===this.C)return;if(X.p===1){X.p=0;return}if(X===Y.i){let W=Y.h;if(W.p===1)if(W.p=0,Y.p=1,Y===this.v)this.v=Y._();else Y._();else if(W.h&&W.h.p===1){if(W.p=Y.p,Y.p=0,W.h.p=0,Y===this.v)this.v=Y._();else Y._();return}else if(W.i&&W.i.p===1)W.p=1,W.i.p=0,W.g();else W.p=1,X=Y}else{let W=Y.i;if(W.p===1)if(W.p=0,Y.p=1,Y===this.v)this.v=Y.g();else Y.g();else if(W.i&&W.i.p===1){if(W.p=Y.p,Y.p=0,W.i.p=0,Y===this.v)this.v=Y.g();else Y.g();return}else if(W.h&&W.h.p===1)W.p=1,W.h.p=0,W._();else W.p=1,X=Y}}}S(X){if(this.m===1){this.clear();return}let Y=X;while(Y.i||Y.h){if(Y.h){Y=Y.h;while(Y.i)Y=Y.i}else Y=Y.i;let z=X.u;X.u=Y.u,Y.u=z;let F=X.l;X.l=Y.l,Y.l=F,X=Y}if(this.C.i===Y)this.C.i=Y.o;else if(this.C.h===Y)this.C.h=Y.o;this.P(Y);let W=Y.o;if(Y===W.i)W.i=void 0;else W.h=void 0;if(this.m-=1,this.v.p=0,this.enableIndex)while(W!==this.C)W.M-=1,W=W.o}U(X){let Y=typeof X==="number"?X:void 0,W=typeof X==="function"?X:void 0,z=typeof X>"u"?[]:void 0,F=0,Q=this.v,J=[];while(J.length||Q)if(Q)J.push(Q),Q=Q.i;else{if(Q=J.pop(),F===Y)return Q;z&&z.push(Q),W&&W(Q,F,this),F+=1,Q=Q.h}return z}j(X){while(!0){let Y=X.o;if(Y.p===0)return;let W=Y.o;if(Y===W.i){let z=W.h;if(z&&z.p===1){if(z.p=Y.p=0,W===this.v)return;W.p=1,X=W;continue}else if(X===Y.h){if(X.p=0,X.i)X.i.o=Y;if(X.h)X.h.o=W;if(Y.h=X.i,W.i=X.h,X.i=Y,X.h=W,W===this.v)this.v=X,this.C.o=X;else{let F=W.o;if(F.i===W)F.i=X;else F.h=X}X.o=W.o,Y.o=X,W.o=X,W.p=1}else{if(Y.p=0,W===this.v)this.v=W.g();else W.g();W.p=1;return}}else{let z=W.i;if(z&&z.p===1){if(z.p=Y.p=0,W===this.v)return;W.p=1,X=W;continue}else if(X===Y.i){if(X.p=0,X.i)X.i.o=W;if(X.h)X.h.o=Y;if(W.h=X.i,Y.i=X.h,X.i=W,X.h=Y,W===this.v)this.v=X,this.C.o=X;else{let F=W.o;if(F.i===W)F.i=X;else F.h=X}X.o=W.o,Y.o=X,W.o=X,W.p=1}else{if(Y.p=0,W===this.v)this.v=W._();else W._();W.p=1;return}}if(this.enableIndex)Y.O(),W.O(),X.O();return}}q(X,Y,W){if(this.v===void 0)return this.m+=1,this.v=new this.N(X,Y,0),this.v.o=this.C,this.C.o=this.C.i=this.C.h=this.v,this.m;let z,F=this.C.i,Q=this.A(F.u,X);if(Q===0)return F.l=Y,this.m;else if(Q>0)F.i=new this.N(X,Y),F.i.o=F,z=F.i,this.C.i=z;else{let J=this.C.h,Z=this.A(J.u,X);if(Z===0)return J.l=Y,this.m;else if(Z<0)J.h=new this.N(X,Y),J.h.o=J,z=J.h,this.C.h=z;else{if(W!==void 0){let K=W.T;if(K!==this.C){let H=this.A(K.u,X);if(H===0)return K.l=Y,this.m;else if(H>0){let G=K.I(),q=this.A(G.u,X);if(q===0)return G.l=Y,this.m;else if(q<0)if(z=new this.N(X,Y),G.h===void 0)G.h=z,z.o=G;else K.i=z,z.o=K}}}if(z===void 0){z=this.v;while(!0){let K=this.A(z.u,X);if(K>0){if(z.i===void 0){z.i=new this.N(X,Y),z.i.o=z,z=z.i;break}z=z.i}else if(K<0){if(z.h===void 0){z.h=new this.N(X,Y),z.h.o=z,z=z.h;break}z=z.h}else return z.l=Y,this.m}}}}if(this.enableIndex){let J=z.o;while(J!==this.C)J.M+=1,J=J.o}return this.j(z),this.m+=1,this.m}H(X,Y){while(X){let W=this.A(X.u,Y);if(W<0)X=X.h;else if(W>0)X=X.i;else return X}return X||this.C}clear(){this.m=0,this.v=void 0,this.C.o=void 0,this.C.i=this.C.h=void 0}updateKeyByIterator(X,Y){let W=X.T;if(W===this.C)j7();if(this.m===1)return W.u=Y,!0;let z=W.B().u;if(W===this.C.i){if(this.A(z,Y)>0)return W.u=Y,!0;return!1}let F=W.I().u;if(W===this.C.h){if(this.A(F,Y)<0)return W.u=Y,!0;return!1}if(this.A(F,Y)>=0||this.A(z,Y)<=0)return!1;return W.u=Y,!0}eraseElementByPos(X){if(X<0||X>this.m-1)throw RangeError();let Y=this.U(X);return this.S(Y),this.m}eraseElementByKey(X){if(this.m===0)return!1;let Y=this.H(this.v,X);if(Y===this.C)return!1;return this.S(Y),!0}eraseElementByIterator(X){let Y=X.T;if(Y===this.C)j7();let W=Y.h===void 0;if(X.iteratorType===0){if(W)X.next()}else if(!W||Y.i===void 0)X.next();return this.S(Y),X}getHeight(){if(this.m===0)return 0;function X(Y){if(!Y)return 0;return Math.max(X(Y.i),X(Y.h))+1}return X(this.v)}}class y40 extends P40{constructor(X,Y,W){super(W);if(this.T=X,this.C=Y,this.iteratorType===0)this.pre=function(){if(this.T===this.C.i)j7();return this.T=this.T.I(),this},this.next=function(){if(this.T===this.C)j7();return this.T=this.T.B(),this};else this.pre=function(){if(this.T===this.C.h)j7();return this.T=this.T.B(),this},this.next=function(){if(this.T===this.C)j7();return this.T=this.T.I(),this}}get index(){let X=this.T,Y=this.C.o;if(X===this.C){if(Y)return Y.M-1;return 0}let W=0;if(X.i)W+=X.i.M;while(X!==Y){let z=X.o;if(X===z.h){if(W+=1,z.i)W+=z.i.M}X=z}return W}isAccessible(){return this.T!==this.C}}class k8 extends y40{constructor(X,Y,W,z){super(X,Y,z);this.container=W}get pointer(){if(this.T===this.C)j7();let X=this;return new Proxy([],{get(Y,W){if(W==="0")return X.T.u;else if(W==="1")return X.T.l;return Y[0]=X.T.u,Y[1]=X.T.l,Y[W]},set(Y,W,z){if(W!=="1")throw TypeError("prop must be 1");return X.T.l=z,!0}})}copy(){return new k8(this.T,this.C,this.container,this.iteratorType)}}class k40 extends f40{constructor(X=[],Y,W){super(Y,W);let z=this;X.forEach(function(F){z.setElement(F[0],F[1])})}begin(){return new k8(this.C.i||this.C,this.C,this)}end(){return new k8(this.C,this.C,this)}rBegin(){return new k8(this.C.h||this.C,this.C,this,1)}rEnd(){return new k8(this.C,this.C,this,1)}front(){if(this.m===0)return;let X=this.C.i;return[X.u,X.l]}back(){if(this.m===0)return;let X=this.C.h;return[X.u,X.l]}lowerBound(X){let Y=this.R(this.v,X);return new k8(Y,this.C,this)}upperBound(X){let Y=this.K(this.v,X);return new k8(Y,this.C,this)}reverseLowerBound(X){let Y=this.L(this.v,X);return new k8(Y,this.C,this)}reverseUpperBound(X){let Y=this.k(this.v,X);return new k8(Y,this.C,this)}forEach(X){this.U(function(Y,W,z){X([Y.u,Y.l],W,z)})}setElement(X,Y,W){return this.q(X,Y,W)}getElementByPos(X){if(X<0||X>this.m-1)throw RangeError();let Y=this.U(X);return[Y.u,Y.l]}find(X){let Y=this.H(this.v,X);return new k8(Y,this.C,this)}getElementByKey(X){return this.H(this.v,X).l}union(X){let Y=this;return X.forEach(function(W){Y.setElement(W[0],W[1])}),this.m}*[Symbol.iterator](){let X=this.m,Y=this.U();for(let W=0;W<X;++W){let z=Y[W];yield[z.u,z.l]}}}v40.OrderedMap=k40});var AG=X0((_40)=>{Object.defineProperty(_40,"__esModule",{value:!0});_40.registerAdminService=ns0;_40.addAdminServicesToServer=is0;var h40=[];function ns0(X,Y){h40.push({getServiceDefinition:X,getHandlers:Y})}function is0(X){for(let{getServiceDefinition:Y,getHandlers:W}of h40)X.addService(Y(),W())}});var c40=X0((g40)=>{Object.defineProperty(g40,"__esModule",{value:!0});g40.ClientDuplexStreamImpl=g40.ClientWritableStreamImpl=g40.ClientReadableStreamImpl=g40.ClientUnaryCallImpl=void 0;g40.callErrorFromStatus=ts0;var os0=F1("events"),RU=F1("stream"),FQ=a1();function ts0(X,Y){let W=`${X.code} ${FQ.Status[X.code]}: ${X.details}`,F=`${Error(W).stack}
473
+ `+w0+"}"}}return J0.pop(),T0=w0,o}($0):void 0}function K0(M0){let O0={"'":0.1,'"':0.2},$0={"'":"\\'",'"':"\\\"","\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\x00":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},R0="";for(let o=0;o<M0.length;o++){let k0=M0[o];switch(k0){case"'":case'"':O0[k0]++,R0+=k0;continue;case"\x00":if(K.isDigit(M0[o+1])){R0+="\\x00";continue}}if($0[k0])R0+=$0[k0];else if(k0<" "){let J1=k0.charCodeAt(0).toString(16);R0+="\\x"+("00"+J1).substring(J1.length)}else R0+=k0}let w0=L0||Object.keys(O0).reduce((o,k0)=>O0[o]<O0[k0]?o:k0);return R0=R0.replace(new RegExp(w0,"g"),$0[w0]),w0+R0+w0}function N0(M0){if(M0.length===0)return K0(M0);let O0=String.fromCodePoint(M0.codePointAt(0));if(!K.isIdStartChar(O0))return K0(M0);for(let $0=O0.length;$0<M0.length;$0++)if(!K.isIdContinueChar(String.fromCodePoint(M0.codePointAt($0))))return K0(M0);return M0}}}},"./node_modules/.pnpm/@babel+preset-typescript@7.26.0_@babel+core@7.26.0/node_modules/@babel/preset-typescript/package.json":(F)=>{F.exports=JSON.parse('{"name":"@babel/preset-typescript","version":"7.26.0","description":"Babel preset for TypeScript.","repository":{"type":"git","url":"https://github.com/babel/babel.git","directory":"packages/babel-preset-typescript"},"license":"MIT","publishConfig":{"access":"public"},"main":"./lib/index.js","keywords":["babel-preset","typescript"],"dependencies":{"@babel/helper-plugin-utils":"^7.25.9","@babel/helper-validator-option":"^7.25.9","@babel/plugin-syntax-jsx":"^7.25.9","@babel/plugin-transform-modules-commonjs":"^7.25.9","@babel/plugin-transform-typescript":"^7.25.9"},"peerDependencies":{"@babel/core":"^7.0.0-0"},"devDependencies":{"@babel/core":"^7.26.0","@babel/helper-plugin-test-runner":"^7.25.9"},"homepage":"https://babel.dev/docs/en/next/babel-preset-typescript","bugs":"https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22area%3A%20typescript%22+is%3Aopen","engines":{"node":">=6.9.0"},"author":"The Babel Team (https://babel.dev/team)","type":"commonjs"}')},"./node_modules/.pnpm/globals@11.12.0/node_modules/globals/globals.json":(F)=>{F.exports=JSON.parse('{"builtin":{"Array":false,"ArrayBuffer":false,"Atomics":false,"BigInt":false,"BigInt64Array":false,"BigUint64Array":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"globalThis":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es5":{"Array":false,"Boolean":false,"constructor":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"propertyIsEnumerable":false,"RangeError":false,"ReferenceError":false,"RegExp":false,"String":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false},"es2015":{"Array":false,"ArrayBuffer":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es2017":{"Array":false,"ArrayBuffer":false,"Atomics":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"browser":{"AbortController":false,"AbortSignal":false,"addEventListener":false,"alert":false,"AnalyserNode":false,"Animation":false,"AnimationEffectReadOnly":false,"AnimationEffectTiming":false,"AnimationEffectTimingReadOnly":false,"AnimationEvent":false,"AnimationPlaybackEvent":false,"AnimationTimeline":false,"applicationCache":false,"ApplicationCache":false,"ApplicationCacheErrorEvent":false,"atob":false,"Attr":false,"Audio":false,"AudioBuffer":false,"AudioBufferSourceNode":false,"AudioContext":false,"AudioDestinationNode":false,"AudioListener":false,"AudioNode":false,"AudioParam":false,"AudioProcessingEvent":false,"AudioScheduledSourceNode":false,"AudioWorkletGlobalScope ":false,"AudioWorkletNode":false,"AudioWorkletProcessor":false,"BarProp":false,"BaseAudioContext":false,"BatteryManager":false,"BeforeUnloadEvent":false,"BiquadFilterNode":false,"Blob":false,"BlobEvent":false,"blur":false,"BroadcastChannel":false,"btoa":false,"BudgetService":false,"ByteLengthQueuingStrategy":false,"Cache":false,"caches":false,"CacheStorage":false,"cancelAnimationFrame":false,"cancelIdleCallback":false,"CanvasCaptureMediaStreamTrack":false,"CanvasGradient":false,"CanvasPattern":false,"CanvasRenderingContext2D":false,"ChannelMergerNode":false,"ChannelSplitterNode":false,"CharacterData":false,"clearInterval":false,"clearTimeout":false,"clientInformation":false,"ClipboardEvent":false,"close":false,"closed":false,"CloseEvent":false,"Comment":false,"CompositionEvent":false,"confirm":false,"console":false,"ConstantSourceNode":false,"ConvolverNode":false,"CountQueuingStrategy":false,"createImageBitmap":false,"Credential":false,"CredentialsContainer":false,"crypto":false,"Crypto":false,"CryptoKey":false,"CSS":false,"CSSConditionRule":false,"CSSFontFaceRule":false,"CSSGroupingRule":false,"CSSImportRule":false,"CSSKeyframeRule":false,"CSSKeyframesRule":false,"CSSMediaRule":false,"CSSNamespaceRule":false,"CSSPageRule":false,"CSSRule":false,"CSSRuleList":false,"CSSStyleDeclaration":false,"CSSStyleRule":false,"CSSStyleSheet":false,"CSSSupportsRule":false,"CustomElementRegistry":false,"customElements":false,"CustomEvent":false,"DataTransfer":false,"DataTransferItem":false,"DataTransferItemList":false,"defaultstatus":false,"defaultStatus":false,"DelayNode":false,"DeviceMotionEvent":false,"DeviceOrientationEvent":false,"devicePixelRatio":false,"dispatchEvent":false,"document":false,"Document":false,"DocumentFragment":false,"DocumentType":false,"DOMError":false,"DOMException":false,"DOMImplementation":false,"DOMMatrix":false,"DOMMatrixReadOnly":false,"DOMParser":false,"DOMPoint":false,"DOMPointReadOnly":false,"DOMQuad":false,"DOMRect":false,"DOMRectReadOnly":false,"DOMStringList":false,"DOMStringMap":false,"DOMTokenList":false,"DragEvent":false,"DynamicsCompressorNode":false,"Element":false,"ErrorEvent":false,"event":false,"Event":false,"EventSource":false,"EventTarget":false,"external":false,"fetch":false,"File":false,"FileList":false,"FileReader":false,"find":false,"focus":false,"FocusEvent":false,"FontFace":false,"FontFaceSetLoadEvent":false,"FormData":false,"frameElement":false,"frames":false,"GainNode":false,"Gamepad":false,"GamepadButton":false,"GamepadEvent":false,"getComputedStyle":false,"getSelection":false,"HashChangeEvent":false,"Headers":false,"history":false,"History":false,"HTMLAllCollection":false,"HTMLAnchorElement":false,"HTMLAreaElement":false,"HTMLAudioElement":false,"HTMLBaseElement":false,"HTMLBodyElement":false,"HTMLBRElement":false,"HTMLButtonElement":false,"HTMLCanvasElement":false,"HTMLCollection":false,"HTMLContentElement":false,"HTMLDataElement":false,"HTMLDataListElement":false,"HTMLDetailsElement":false,"HTMLDialogElement":false,"HTMLDirectoryElement":false,"HTMLDivElement":false,"HTMLDListElement":false,"HTMLDocument":false,"HTMLElement":false,"HTMLEmbedElement":false,"HTMLFieldSetElement":false,"HTMLFontElement":false,"HTMLFormControlsCollection":false,"HTMLFormElement":false,"HTMLFrameElement":false,"HTMLFrameSetElement":false,"HTMLHeadElement":false,"HTMLHeadingElement":false,"HTMLHRElement":false,"HTMLHtmlElement":false,"HTMLIFrameElement":false,"HTMLImageElement":false,"HTMLInputElement":false,"HTMLLabelElement":false,"HTMLLegendElement":false,"HTMLLIElement":false,"HTMLLinkElement":false,"HTMLMapElement":false,"HTMLMarqueeElement":false,"HTMLMediaElement":false,"HTMLMenuElement":false,"HTMLMetaElement":false,"HTMLMeterElement":false,"HTMLModElement":false,"HTMLObjectElement":false,"HTMLOListElement":false,"HTMLOptGroupElement":false,"HTMLOptionElement":false,"HTMLOptionsCollection":false,"HTMLOutputElement":false,"HTMLParagraphElement":false,"HTMLParamElement":false,"HTMLPictureElement":false,"HTMLPreElement":false,"HTMLProgressElement":false,"HTMLQuoteElement":false,"HTMLScriptElement":false,"HTMLSelectElement":false,"HTMLShadowElement":false,"HTMLSlotElement":false,"HTMLSourceElement":false,"HTMLSpanElement":false,"HTMLStyleElement":false,"HTMLTableCaptionElement":false,"HTMLTableCellElement":false,"HTMLTableColElement":false,"HTMLTableElement":false,"HTMLTableRowElement":false,"HTMLTableSectionElement":false,"HTMLTemplateElement":false,"HTMLTextAreaElement":false,"HTMLTimeElement":false,"HTMLTitleElement":false,"HTMLTrackElement":false,"HTMLUListElement":false,"HTMLUnknownElement":false,"HTMLVideoElement":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"IdleDeadline":false,"IIRFilterNode":false,"Image":false,"ImageBitmap":false,"ImageBitmapRenderingContext":false,"ImageCapture":false,"ImageData":false,"indexedDB":false,"innerHeight":false,"innerWidth":false,"InputEvent":false,"IntersectionObserver":false,"IntersectionObserverEntry":false,"Intl":false,"isSecureContext":false,"KeyboardEvent":false,"KeyframeEffect":false,"KeyframeEffectReadOnly":false,"length":false,"localStorage":false,"location":true,"Location":false,"locationbar":false,"matchMedia":false,"MediaDeviceInfo":false,"MediaDevices":false,"MediaElementAudioSourceNode":false,"MediaEncryptedEvent":false,"MediaError":false,"MediaKeyMessageEvent":false,"MediaKeySession":false,"MediaKeyStatusMap":false,"MediaKeySystemAccess":false,"MediaList":false,"MediaQueryList":false,"MediaQueryListEvent":false,"MediaRecorder":false,"MediaSettingsRange":false,"MediaSource":false,"MediaStream":false,"MediaStreamAudioDestinationNode":false,"MediaStreamAudioSourceNode":false,"MediaStreamEvent":false,"MediaStreamTrack":false,"MediaStreamTrackEvent":false,"menubar":false,"MessageChannel":false,"MessageEvent":false,"MessagePort":false,"MIDIAccess":false,"MIDIConnectionEvent":false,"MIDIInput":false,"MIDIInputMap":false,"MIDIMessageEvent":false,"MIDIOutput":false,"MIDIOutputMap":false,"MIDIPort":false,"MimeType":false,"MimeTypeArray":false,"MouseEvent":false,"moveBy":false,"moveTo":false,"MutationEvent":false,"MutationObserver":false,"MutationRecord":false,"name":false,"NamedNodeMap":false,"NavigationPreloadManager":false,"navigator":false,"Navigator":false,"NetworkInformation":false,"Node":false,"NodeFilter":false,"NodeIterator":false,"NodeList":false,"Notification":false,"OfflineAudioCompletionEvent":false,"OfflineAudioContext":false,"offscreenBuffering":false,"OffscreenCanvas":true,"onabort":true,"onafterprint":true,"onanimationend":true,"onanimationiteration":true,"onanimationstart":true,"onappinstalled":true,"onauxclick":true,"onbeforeinstallprompt":true,"onbeforeprint":true,"onbeforeunload":true,"onblur":true,"oncancel":true,"oncanplay":true,"oncanplaythrough":true,"onchange":true,"onclick":true,"onclose":true,"oncontextmenu":true,"oncuechange":true,"ondblclick":true,"ondevicemotion":true,"ondeviceorientation":true,"ondeviceorientationabsolute":true,"ondrag":true,"ondragend":true,"ondragenter":true,"ondragleave":true,"ondragover":true,"ondragstart":true,"ondrop":true,"ondurationchange":true,"onemptied":true,"onended":true,"onerror":true,"onfocus":true,"ongotpointercapture":true,"onhashchange":true,"oninput":true,"oninvalid":true,"onkeydown":true,"onkeypress":true,"onkeyup":true,"onlanguagechange":true,"onload":true,"onloadeddata":true,"onloadedmetadata":true,"onloadstart":true,"onlostpointercapture":true,"onmessage":true,"onmessageerror":true,"onmousedown":true,"onmouseenter":true,"onmouseleave":true,"onmousemove":true,"onmouseout":true,"onmouseover":true,"onmouseup":true,"onmousewheel":true,"onoffline":true,"ononline":true,"onpagehide":true,"onpageshow":true,"onpause":true,"onplay":true,"onplaying":true,"onpointercancel":true,"onpointerdown":true,"onpointerenter":true,"onpointerleave":true,"onpointermove":true,"onpointerout":true,"onpointerover":true,"onpointerup":true,"onpopstate":true,"onprogress":true,"onratechange":true,"onrejectionhandled":true,"onreset":true,"onresize":true,"onscroll":true,"onsearch":true,"onseeked":true,"onseeking":true,"onselect":true,"onstalled":true,"onstorage":true,"onsubmit":true,"onsuspend":true,"ontimeupdate":true,"ontoggle":true,"ontransitionend":true,"onunhandledrejection":true,"onunload":true,"onvolumechange":true,"onwaiting":true,"onwheel":true,"open":false,"openDatabase":false,"opener":false,"Option":false,"origin":false,"OscillatorNode":false,"outerHeight":false,"outerWidth":false,"PageTransitionEvent":false,"pageXOffset":false,"pageYOffset":false,"PannerNode":false,"parent":false,"Path2D":false,"PaymentAddress":false,"PaymentRequest":false,"PaymentRequestUpdateEvent":false,"PaymentResponse":false,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceLongTaskTiming":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceNavigationTiming":false,"PerformanceObserver":false,"PerformanceObserverEntryList":false,"PerformancePaintTiming":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"PeriodicWave":false,"Permissions":false,"PermissionStatus":false,"personalbar":false,"PhotoCapabilities":false,"Plugin":false,"PluginArray":false,"PointerEvent":false,"PopStateEvent":false,"postMessage":false,"Presentation":false,"PresentationAvailability":false,"PresentationConnection":false,"PresentationConnectionAvailableEvent":false,"PresentationConnectionCloseEvent":false,"PresentationConnectionList":false,"PresentationReceiver":false,"PresentationRequest":false,"print":false,"ProcessingInstruction":false,"ProgressEvent":false,"PromiseRejectionEvent":false,"prompt":false,"PushManager":false,"PushSubscription":false,"PushSubscriptionOptions":false,"queueMicrotask":false,"RadioNodeList":false,"Range":false,"ReadableStream":false,"registerProcessor":false,"RemotePlayback":false,"removeEventListener":false,"Request":false,"requestAnimationFrame":false,"requestIdleCallback":false,"resizeBy":false,"ResizeObserver":false,"ResizeObserverEntry":false,"resizeTo":false,"Response":false,"RTCCertificate":false,"RTCDataChannel":false,"RTCDataChannelEvent":false,"RTCDtlsTransport":false,"RTCIceCandidate":false,"RTCIceGatherer":false,"RTCIceTransport":false,"RTCPeerConnection":false,"RTCPeerConnectionIceEvent":false,"RTCRtpContributingSource":false,"RTCRtpReceiver":false,"RTCRtpSender":false,"RTCSctpTransport":false,"RTCSessionDescription":false,"RTCStatsReport":false,"RTCTrackEvent":false,"screen":false,"Screen":false,"screenLeft":false,"ScreenOrientation":false,"screenTop":false,"screenX":false,"screenY":false,"ScriptProcessorNode":false,"scroll":false,"scrollbars":false,"scrollBy":false,"scrollTo":false,"scrollX":false,"scrollY":false,"SecurityPolicyViolationEvent":false,"Selection":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerRegistration":false,"sessionStorage":false,"setInterval":false,"setTimeout":false,"ShadowRoot":false,"SharedWorker":false,"SourceBuffer":false,"SourceBufferList":false,"speechSynthesis":false,"SpeechSynthesisEvent":false,"SpeechSynthesisUtterance":false,"StaticRange":false,"status":false,"statusbar":false,"StereoPannerNode":false,"stop":false,"Storage":false,"StorageEvent":false,"StorageManager":false,"styleMedia":false,"StyleSheet":false,"StyleSheetList":false,"SubtleCrypto":false,"SVGAElement":false,"SVGAngle":false,"SVGAnimatedAngle":false,"SVGAnimatedBoolean":false,"SVGAnimatedEnumeration":false,"SVGAnimatedInteger":false,"SVGAnimatedLength":false,"SVGAnimatedLengthList":false,"SVGAnimatedNumber":false,"SVGAnimatedNumberList":false,"SVGAnimatedPreserveAspectRatio":false,"SVGAnimatedRect":false,"SVGAnimatedString":false,"SVGAnimatedTransformList":false,"SVGAnimateElement":false,"SVGAnimateMotionElement":false,"SVGAnimateTransformElement":false,"SVGAnimationElement":false,"SVGCircleElement":false,"SVGClipPathElement":false,"SVGComponentTransferFunctionElement":false,"SVGDefsElement":false,"SVGDescElement":false,"SVGDiscardElement":false,"SVGElement":false,"SVGEllipseElement":false,"SVGFEBlendElement":false,"SVGFEColorMatrixElement":false,"SVGFEComponentTransferElement":false,"SVGFECompositeElement":false,"SVGFEConvolveMatrixElement":false,"SVGFEDiffuseLightingElement":false,"SVGFEDisplacementMapElement":false,"SVGFEDistantLightElement":false,"SVGFEDropShadowElement":false,"SVGFEFloodElement":false,"SVGFEFuncAElement":false,"SVGFEFuncBElement":false,"SVGFEFuncGElement":false,"SVGFEFuncRElement":false,"SVGFEGaussianBlurElement":false,"SVGFEImageElement":false,"SVGFEMergeElement":false,"SVGFEMergeNodeElement":false,"SVGFEMorphologyElement":false,"SVGFEOffsetElement":false,"SVGFEPointLightElement":false,"SVGFESpecularLightingElement":false,"SVGFESpotLightElement":false,"SVGFETileElement":false,"SVGFETurbulenceElement":false,"SVGFilterElement":false,"SVGForeignObjectElement":false,"SVGGElement":false,"SVGGeometryElement":false,"SVGGradientElement":false,"SVGGraphicsElement":false,"SVGImageElement":false,"SVGLength":false,"SVGLengthList":false,"SVGLinearGradientElement":false,"SVGLineElement":false,"SVGMarkerElement":false,"SVGMaskElement":false,"SVGMatrix":false,"SVGMetadataElement":false,"SVGMPathElement":false,"SVGNumber":false,"SVGNumberList":false,"SVGPathElement":false,"SVGPatternElement":false,"SVGPoint":false,"SVGPointList":false,"SVGPolygonElement":false,"SVGPolylineElement":false,"SVGPreserveAspectRatio":false,"SVGRadialGradientElement":false,"SVGRect":false,"SVGRectElement":false,"SVGScriptElement":false,"SVGSetElement":false,"SVGStopElement":false,"SVGStringList":false,"SVGStyleElement":false,"SVGSVGElement":false,"SVGSwitchElement":false,"SVGSymbolElement":false,"SVGTextContentElement":false,"SVGTextElement":false,"SVGTextPathElement":false,"SVGTextPositioningElement":false,"SVGTitleElement":false,"SVGTransform":false,"SVGTransformList":false,"SVGTSpanElement":false,"SVGUnitTypes":false,"SVGUseElement":false,"SVGViewElement":false,"TaskAttributionTiming":false,"Text":false,"TextDecoder":false,"TextEncoder":false,"TextEvent":false,"TextMetrics":false,"TextTrack":false,"TextTrackCue":false,"TextTrackCueList":false,"TextTrackList":false,"TimeRanges":false,"toolbar":false,"top":false,"Touch":false,"TouchEvent":false,"TouchList":false,"TrackEvent":false,"TransitionEvent":false,"TreeWalker":false,"UIEvent":false,"URL":false,"URLSearchParams":false,"ValidityState":false,"visualViewport":false,"VisualViewport":false,"VTTCue":false,"WaveShaperNode":false,"WebAssembly":false,"WebGL2RenderingContext":false,"WebGLActiveInfo":false,"WebGLBuffer":false,"WebGLContextEvent":false,"WebGLFramebuffer":false,"WebGLProgram":false,"WebGLQuery":false,"WebGLRenderbuffer":false,"WebGLRenderingContext":false,"WebGLSampler":false,"WebGLShader":false,"WebGLShaderPrecisionFormat":false,"WebGLSync":false,"WebGLTexture":false,"WebGLTransformFeedback":false,"WebGLUniformLocation":false,"WebGLVertexArrayObject":false,"WebSocket":false,"WheelEvent":false,"window":false,"Window":false,"Worker":false,"WritableStream":false,"XMLDocument":false,"XMLHttpRequest":false,"XMLHttpRequestEventTarget":false,"XMLHttpRequestUpload":false,"XMLSerializer":false,"XPathEvaluator":false,"XPathExpression":false,"XPathResult":false,"XSLTProcessor":false},"worker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"clearInterval":false,"clearTimeout":false,"close":true,"console":false,"fetch":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":true,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onlanguagechange":true,"onmessage":true,"onoffline":true,"ononline":true,"onrejectionhandled":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"removeEventListener":false,"Request":false,"Response":false,"self":true,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"node":{"__dirname":false,"__filename":false,"Buffer":false,"clearImmediate":false,"clearInterval":false,"clearTimeout":false,"console":false,"exports":true,"global":false,"Intl":false,"module":false,"process":false,"queueMicrotask":false,"require":false,"setImmediate":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false},"commonjs":{"exports":true,"global":false,"module":false,"require":false},"amd":{"define":false,"require":false},"mocha":{"after":false,"afterEach":false,"before":false,"beforeEach":false,"context":false,"describe":false,"it":false,"mocha":false,"run":false,"setup":false,"specify":false,"suite":false,"suiteSetup":false,"suiteTeardown":false,"teardown":false,"test":false,"xcontext":false,"xdescribe":false,"xit":false,"xspecify":false},"jasmine":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"fail":false,"fdescribe":false,"fit":false,"it":false,"jasmine":false,"pending":false,"runs":false,"spyOn":false,"spyOnProperty":false,"waits":false,"waitsFor":false,"xdescribe":false,"xit":false},"jest":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"fdescribe":false,"fit":false,"it":false,"jest":false,"pit":false,"require":false,"test":false,"xdescribe":false,"xit":false,"xtest":false},"qunit":{"asyncTest":false,"deepEqual":false,"equal":false,"expect":false,"module":false,"notDeepEqual":false,"notEqual":false,"notOk":false,"notPropEqual":false,"notStrictEqual":false,"ok":false,"propEqual":false,"QUnit":false,"raises":false,"start":false,"stop":false,"strictEqual":false,"test":false,"throws":false},"phantomjs":{"console":true,"exports":true,"phantom":true,"require":true,"WebPage":true},"couch":{"emit":false,"exports":false,"getRow":false,"log":false,"module":false,"provides":false,"require":false,"respond":false,"send":false,"start":false,"sum":false},"rhino":{"defineClass":false,"deserialize":false,"gc":false,"help":false,"importClass":false,"importPackage":false,"java":false,"load":false,"loadClass":false,"Packages":false,"print":false,"quit":false,"readFile":false,"readUrl":false,"runCommand":false,"seal":false,"serialize":false,"spawn":false,"sync":false,"toint32":false,"version":false},"nashorn":{"__DIR__":false,"__FILE__":false,"__LINE__":false,"com":false,"edu":false,"exit":false,"java":false,"Java":false,"javafx":false,"JavaImporter":false,"javax":false,"JSAdapter":false,"load":false,"loadWithNewGlobal":false,"org":false,"Packages":false,"print":false,"quit":false},"wsh":{"ActiveXObject":true,"Enumerator":true,"GetObject":true,"ScriptEngine":true,"ScriptEngineBuildVersion":true,"ScriptEngineMajorVersion":true,"ScriptEngineMinorVersion":true,"VBArray":true,"WScript":true,"WSH":true,"XDomainRequest":true},"jquery":{"$":false,"jQuery":false},"yui":{"YAHOO":false,"YAHOO_config":false,"YUI":false,"YUI_config":false},"shelljs":{"cat":false,"cd":false,"chmod":false,"config":false,"cp":false,"dirs":false,"echo":false,"env":false,"error":false,"exec":false,"exit":false,"find":false,"grep":false,"ln":false,"ls":false,"mkdir":false,"mv":false,"popd":false,"pushd":false,"pwd":false,"rm":false,"sed":false,"set":false,"target":false,"tempdir":false,"test":false,"touch":false,"which":false},"prototypejs":{"$":false,"$$":false,"$A":false,"$break":false,"$continue":false,"$F":false,"$H":false,"$R":false,"$w":false,"Abstract":false,"Ajax":false,"Autocompleter":false,"Builder":false,"Class":false,"Control":false,"Draggable":false,"Draggables":false,"Droppables":false,"Effect":false,"Element":false,"Enumerable":false,"Event":false,"Field":false,"Form":false,"Hash":false,"Insertion":false,"ObjectRange":false,"PeriodicalExecuter":false,"Position":false,"Prototype":false,"Scriptaculous":false,"Selector":false,"Sortable":false,"SortableObserver":false,"Sound":false,"Template":false,"Toggle":false,"Try":false},"meteor":{"_":false,"$":false,"Accounts":false,"AccountsClient":false,"AccountsCommon":false,"AccountsServer":false,"App":false,"Assets":false,"Blaze":false,"check":false,"Cordova":false,"DDP":false,"DDPRateLimiter":false,"DDPServer":false,"Deps":false,"EJSON":false,"Email":false,"HTTP":false,"Log":false,"Match":false,"Meteor":false,"Mongo":false,"MongoInternals":false,"Npm":false,"Package":false,"Plugin":false,"process":false,"Random":false,"ReactiveDict":false,"ReactiveVar":false,"Router":false,"ServiceConfiguration":false,"Session":false,"share":false,"Spacebars":false,"Template":false,"Tinytest":false,"Tracker":false,"UI":false,"Utils":false,"WebApp":false,"WebAppInternals":false},"mongo":{"_isWindows":false,"_rand":false,"BulkWriteResult":false,"cat":false,"cd":false,"connect":false,"db":false,"getHostName":false,"getMemInfo":false,"hostname":false,"ISODate":false,"listFiles":false,"load":false,"ls":false,"md5sumFile":false,"mkdir":false,"Mongo":false,"NumberInt":false,"NumberLong":false,"ObjectId":false,"PlanCache":false,"print":false,"printjson":false,"pwd":false,"quit":false,"removeFile":false,"rs":false,"sh":false,"UUID":false,"version":false,"WriteResult":false},"applescript":{"$":false,"Application":false,"Automation":false,"console":false,"delay":false,"Library":false,"ObjC":false,"ObjectSpecifier":false,"Path":false,"Progress":false,"Ref":false},"serviceworker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"CacheStorage":false,"clearInterval":false,"clearTimeout":false,"Client":false,"clients":false,"Clients":false,"close":true,"console":false,"ExtendableEvent":false,"ExtendableMessageEvent":false,"fetch":false,"FetchEvent":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":false,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onfetch":true,"oninstall":true,"onlanguagechange":true,"onmessage":true,"onmessageerror":true,"onnotificationclick":true,"onnotificationclose":true,"onoffline":true,"ononline":true,"onpush":true,"onpushsubscriptionchange":true,"onrejectionhandled":true,"onsync":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"registration":false,"removeEventListener":false,"Request":false,"Response":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerGlobalScope":false,"ServiceWorkerMessageEvent":false,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"skipWaiting":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"WindowClient":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"atomtest":{"advanceClock":false,"fakeClearInterval":false,"fakeClearTimeout":false,"fakeSetInterval":false,"fakeSetTimeout":false,"resetTimeouts":false,"waitsForPromise":false},"embertest":{"andThen":false,"click":false,"currentPath":false,"currentRouteName":false,"currentURL":false,"fillIn":false,"find":false,"findAll":false,"findWithAssert":false,"keyEvent":false,"pauseTest":false,"resumeTest":false,"triggerEvent":false,"visit":false,"wait":false},"protractor":{"$":false,"$$":false,"browser":false,"by":false,"By":false,"DartObject":false,"element":false,"protractor":false},"shared-node-browser":{"clearInterval":false,"clearTimeout":false,"console":false,"setInterval":false,"setTimeout":false,"URL":false,"URLSearchParams":false},"webextensions":{"browser":false,"chrome":false,"opr":false},"greasemonkey":{"cloneInto":false,"createObjectIn":false,"exportFunction":false,"GM":false,"GM_addStyle":false,"GM_deleteValue":false,"GM_getResourceText":false,"GM_getResourceURL":false,"GM_getValue":false,"GM_info":false,"GM_listValues":false,"GM_log":false,"GM_openInTab":false,"GM_registerMenuCommand":false,"GM_setClipboard":false,"GM_setValue":false,"GM_xmlhttpRequest":false,"unsafeWindow":false},"devtools":{"$":false,"$_":false,"$$":false,"$0":false,"$1":false,"$2":false,"$3":false,"$4":false,"$x":false,"chrome":false,"clear":false,"copy":false,"debug":false,"dir":false,"dirxml":false,"getEventListeners":false,"inspect":false,"keys":false,"monitor":false,"monitorEvents":false,"profile":false,"profileEnd":false,"queryObjects":false,"table":false,"undebug":false,"unmonitor":false,"unmonitorEvents":false,"values":false}}')}},Y={};function W(F){var Q=Y[F];if(Q!==void 0)return Q.exports;var J=Y[F]={exports:{}};return X[F].call(J.exports,J,J.exports,W),J.exports}W.d=(F,Q)=>{for(var J in Q)W.o(Q,J)&&!W.o(F,J)&&Object.defineProperty(F,J,{enumerable:!0,get:Q[J]})},W.o=(F,Q)=>Object.prototype.hasOwnProperty.call(F,Q),W.r=(F)=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(F,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(F,"__esModule",{value:!0})};var z={};(()=>{W.d(z,{default:()=>H});var F=W("./node_modules/.pnpm/@babel+core@7.26.0/node_modules/@babel/core/lib/index.js"),Q=W("url"),J=W("./node_modules/.pnpm/@babel+template@7.25.9/node_modules/@babel/template/lib/index.js");function Z(G,q){return{name:"transform-import-meta",visitor:{Program(B){let $=[];if(B.traverse({MemberExpression(R){let{node:E}=R;E.object.type==="MetaProperty"&&E.object.meta.name==="import"&&E.object.property.name==="meta"&&E.property.type==="Identifier"&&E.property.name==="url"&&$.push(R)}}),$.length!==0)for(let R of $)R.replaceWith(J.smart.ast`${q.filename?JSON.stringify((0,Q.pathToFileURL)(q.filename)):"require('url').pathToFileURL(__filename).toString()"}`)}}}}function K({template:G,types:q}){return{name:"@import-meta-env/babel",visitor:{Identifier(B){if(!q.isIdentifier(B))return;if(!q.isMemberExpression(B.parentPath)&&!q.isOptionalMemberExpression(B.parentPath))return;if(!q.isMemberExpression(B.parentPath.node))return;let $=B.parentPath.node;if(!q.isMetaProperty($.object))return;let R=$.object;R.meta.name==="import"&&R.property.name==="meta"&&$.property.name==="env"&&B.parentPath.replaceWith(G.expression.ast("process.env"))}}}}function H(G){var q,B,$,R,E,U;let A=Object.assign(Object.assign({babelrc:!1,configFile:!1,compact:!1,retainLines:typeof G.retainLines!="boolean"||G.retainLines,filename:"",cwd:"/"},G.babel),{plugins:[[W("./node_modules/.pnpm/@babel+plugin-transform-modules-commonjs@7.26.3_@babel+core@7.26.0/node_modules/@babel/plugin-transform-modules-commonjs/lib/index.js"),{allowTopLevelThis:!0}],[W("./node_modules/.pnpm/babel-plugin-dynamic-import-node@2.3.3/node_modules/babel-plugin-dynamic-import-node/lib/index.js"),{noInterop:!0}],[Z,{filename:G.filename}],[W("./node_modules/.pnpm/@babel+plugin-syntax-class-properties@7.12.13_@babel+core@7.26.0/node_modules/@babel/plugin-syntax-class-properties/lib/index.js")],[W("./node_modules/.pnpm/@babel+plugin-transform-export-namespace-from@7.25.9_@babel+core@7.26.0/node_modules/@babel/plugin-transform-export-namespace-from/lib/index.js")],[K]]});G.ts&&(A.plugins.push([W("./node_modules/.pnpm/@babel+plugin-transform-typescript@7.26.3_@babel+core@7.26.0/node_modules/@babel/plugin-transform-typescript/lib/index.js"),{allowDeclareFields:!0}]),A.plugins.unshift([W("./node_modules/.pnpm/babel-plugin-transform-typescript-metadata@0.3.2_@babel+core@7.26.0_@babel+traverse@7.26.4/node_modules/babel-plugin-transform-typescript-metadata/lib/plugin.js")],[W("./node_modules/.pnpm/@babel+plugin-proposal-decorators@7.25.9_@babel+core@7.26.0/node_modules/@babel/plugin-proposal-decorators/lib/index.js"),{legacy:!0}]),A.plugins.push(W("./node_modules/.pnpm/babel-plugin-parameter-decorator@1.0.16/node_modules/babel-plugin-parameter-decorator/lib/index.js")),A.plugins.push(W("./node_modules/.pnpm/@babel+plugin-syntax-import-assertions@7.26.0_@babel+core@7.26.0/node_modules/@babel/plugin-syntax-import-assertions/lib/index.js"))),G.legacy&&(A.plugins.push(W("./node_modules/.pnpm/@babel+plugin-transform-nullish-coalescing-operator@7.25.9_@babel+core@7.26.0/node_modules/@babel/plugin-transform-nullish-coalescing-operator/lib/index.js")),A.plugins.push(W("./node_modules/.pnpm/@babel+plugin-transform-optional-chaining@7.25.9_@babel+core@7.26.0/node_modules/@babel/plugin-transform-optional-chaining/lib/index.js"))),G.babel&&Array.isArray(G.babel.plugins)&&((q=A.plugins)===null||q===void 0||q.push(...G.babel.plugins));try{return{code:((B=(0,F.transformSync)(G.source,A))===null||B===void 0?void 0:B.code)||""}}catch(T){return{error:T,code:"exports.__JITI_ERROR__ = "+JSON.stringify({filename:G.filename,line:(($=T.loc)===null||$===void 0?void 0:$.line)||0,column:((R=T.loc)===null||R===void 0?void 0:R.column)||0,code:(E=T.code)===null||E===void 0?void 0:E.replace("BABEL_","").replace("PARSE_ERROR","ParseError"),message:(U=T.message)===null||U===void 0?void 0:U.replace("/: ","").replace(/\(.+\)\s*$/,"")})}}}})(),m90.exports=z.default})()});var c90=X0((z$1,d90)=>{function qr0(X){throw X}d90.exports=function(Y,W){let z=u90();if(W={onError:qr0,...W},!W.transform)W.transform=g90();return z(Y,W)}});var a1=X0((R80)=>{Object.defineProperty(R80,"__esModule",{value:!0});R80.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=R80.DEFAULT_MAX_SEND_MESSAGE_LENGTH=R80.Propagate=R80.LogVerbosity=R80.Status=void 0;var D80;(function(X){X[X.OK=0]="OK",X[X.CANCELLED=1]="CANCELLED",X[X.UNKNOWN=2]="UNKNOWN",X[X.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",X[X.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",X[X.NOT_FOUND=5]="NOT_FOUND",X[X.ALREADY_EXISTS=6]="ALREADY_EXISTS",X[X.PERMISSION_DENIED=7]="PERMISSION_DENIED",X[X.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",X[X.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",X[X.ABORTED=10]="ABORTED",X[X.OUT_OF_RANGE=11]="OUT_OF_RANGE",X[X.UNIMPLEMENTED=12]="UNIMPLEMENTED",X[X.INTERNAL=13]="INTERNAL",X[X.UNAVAILABLE=14]="UNAVAILABLE",X[X.DATA_LOSS=15]="DATA_LOSS",X[X.UNAUTHENTICATED=16]="UNAUTHENTICATED"})(D80||(R80.Status=D80={}));var E80;(function(X){X[X.DEBUG=0]="DEBUG",X[X.INFO=1]="INFO",X[X.ERROR=2]="ERROR",X[X.NONE=3]="NONE"})(E80||(R80.LogVerbosity=E80={}));var C80;(function(X){X[X.DEADLINE=1]="DEADLINE",X[X.CENSUS_STATS_CONTEXT=2]="CENSUS_STATS_CONTEXT",X[X.CENSUS_TRACING_CONTEXT=4]="CENSUS_TRACING_CONTEXT",X[X.CANCELLATION=8]="CANCELLATION",X[X.DEFAULTS=65535]="DEFAULTS"})(C80||(R80.Propagate=C80={}));R80.DEFAULT_MAX_SEND_MESSAGE_LENGTH=-1;R80.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=4194304});var JU=X0((KD1,Ro0)=>{Ro0.exports={name:"@grpc/grpc-js",version:"1.14.3",description:"gRPC Library for Node - pure JS implementation",homepage:"https://grpc.io/",repository:"https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",main:"build/src/index.js",engines:{node:">=12.10.0"},keywords:[],author:{name:"Google Inc."},types:"build/src/index.d.ts",license:"Apache-2.0",devDependencies:{"@grpc/proto-loader":"file:../proto-loader","@types/gulp":"^4.0.17","@types/gulp-mocha":"0.0.37","@types/lodash":"^4.14.202","@types/mocha":"^10.0.6","@types/ncp":"^2.0.8","@types/node":">=20.11.20","@types/pify":"^5.0.4","@types/semver":"^7.5.8","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0","@typescript-eslint/typescript-estree":"^7.1.0","clang-format":"^1.8.0",eslint:"^8.42.0","eslint-config-prettier":"^8.8.0","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^4.2.1",execa:"^2.0.3",gulp:"^4.0.2","gulp-mocha":"^6.0.0",lodash:"^4.17.21",madge:"^5.0.1","mocha-jenkins-reporter":"^0.4.1",ncp:"^2.0.0",pify:"^4.0.1",prettier:"^2.8.8",rimraf:"^3.0.2",semver:"^7.6.0","ts-node":"^10.9.2",typescript:"^5.3.3"},contributors:[{name:"Google Inc."}],scripts:{build:"npm run compile",clean:"rimraf ./build",compile:"tsc -p .",format:'clang-format -i -style="{Language: JavaScript, BasedOnStyle: Google, ColumnLimit: 80}" src/*.ts test/*.ts',lint:"eslint src/*.ts test/*.ts",prepare:"npm run copy-protos && npm run generate-types && npm run generate-test-types && npm run compile",test:"gulp test",check:"npm run lint",fix:"eslint --fix src/*.ts test/*.ts",pretest:"npm run generate-types && npm run generate-test-types && npm run compile",posttest:"npm run check && madge -c ./build/src","generate-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs proto/ --include-dirs proto/ proto/xds/ proto/protoc-gen-validate/ -O src/generated/ --grpcLib ../index channelz.proto xds/service/orca/v3/orca.proto","generate-test-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --include-dirs test/fixtures/ -O test/generated/ --grpcLib ../../src/index test_service.proto echo_service.proto","copy-protos":"node ./copy-protos"},dependencies:{"@grpc/proto-loader":"^0.8.0","@js-sdsl/ordered-map":"^4.4.2"},files:["src/**/*.ts","build/src/**/*.{js,d.ts,js.map}","proto/**/*.proto","proto/**/LICENSE","LICENSE","deps/envoy-api/envoy/api/v2/**/*.proto","deps/envoy-api/envoy/config/**/*.proto","deps/envoy-api/envoy/service/**/*.proto","deps/envoy-api/envoy/type/**/*.proto","deps/udpa/udpa/**/*.proto","deps/googleapis/google/api/*.proto","deps/googleapis/google/rpc/*.proto","deps/protoc-gen-validate/validate/**/*.proto"]}});var A6=X0((w80)=>{var WU,GU,KU,FU;Object.defineProperty(w80,"__esModule",{value:!0});w80.log=w80.setLoggerVerbosity=w80.setLogger=w80.getLogger=void 0;w80.trace=ho0;w80.isTracerEnabled=P80;var $5=a1(),Mo0=F1("process"),Lo0=JU().version,Po0={error:(X,...Y)=>{console.error("E "+X,...Y)},info:(X,...Y)=>{console.error("I "+X,...Y)},debug:(X,...Y)=>{console.error("D "+X,...Y)}},v7=Po0,sX=$5.LogVerbosity.ERROR,wo0=(GU=(WU=process.env.GRPC_NODE_VERBOSITY)!==null&&WU!==void 0?WU:process.env.GRPC_VERBOSITY)!==null&&GU!==void 0?GU:"";switch(wo0.toUpperCase()){case"DEBUG":sX=$5.LogVerbosity.DEBUG;break;case"INFO":sX=$5.LogVerbosity.INFO;break;case"ERROR":sX=$5.LogVerbosity.ERROR;break;case"NONE":sX=$5.LogVerbosity.NONE;break;default:}var So0=()=>{return v7};w80.getLogger=So0;var fo0=(X)=>{v7=X};w80.setLogger=fo0;var yo0=(X)=>{sX=X};w80.setLoggerVerbosity=yo0;var ko0=(X,...Y)=>{let W;if(X>=sX){switch(X){case $5.LogVerbosity.DEBUG:W=v7.debug;break;case $5.LogVerbosity.INFO:W=v7.info;break;case $5.LogVerbosity.ERROR:W=v7.error;break}if(!W)W=v7.error;if(W)W.bind(v7)(...Y)}};w80.log=ko0;var vo0=(FU=(KU=process.env.GRPC_NODE_TRACE)!==null&&KU!==void 0?KU:process.env.GRPC_TRACE)!==null&&FU!==void 0?FU:"",zU=new Set,L80=new Set;for(let X of vo0.split(","))if(X.startsWith("-"))L80.add(X.substring(1));else zU.add(X);var jo0=zU.has("all");function ho0(X,Y,W){if(P80(Y))w80.log(X,new Date().toISOString()+" | v"+Lo0+" "+Mo0.pid+" | "+Y+" | "+W)}function P80(X){return!L80.has(X)&&(jo0||zU.has(X))}});var ZG=X0((S80)=>{Object.defineProperty(S80,"__esModule",{value:!0});S80.getErrorMessage=go0;S80.getErrorCode=do0;function go0(X){if(X instanceof Error)return X.message;else return String(X)}function do0(X){if(typeof X==="object"&&X!==null&&"code"in X&&typeof X.code==="number")return X.code;else return null}});var s6=X0((k80)=>{Object.defineProperty(k80,"__esModule",{value:!0});k80.Metadata=void 0;var po0=A6(),no0=a1(),io0=ZG(),ao0=/^[:0-9a-z_.-]+$/,ro0=/^[ -~]*$/;function oo0(X){return ao0.test(X)}function to0(X){return ro0.test(X)}function y80(X){return X.endsWith("-bin")}function so0(X){return!X.startsWith("grpc-")}function QG(X){return X.toLowerCase()}function f80(X,Y){if(!oo0(X))throw Error('Metadata key "'+X+'" contains illegal characters');if(Y!==null&&Y!==void 0)if(y80(X)){if(!Buffer.isBuffer(Y))throw Error("keys that end with '-bin' must have Buffer values")}else{if(Buffer.isBuffer(Y))throw Error("keys that don't end with '-bin' must have String values");if(!to0(Y))throw Error('Metadata string value "'+Y+'" contains illegal characters')}}class JG{constructor(X={}){this.internalRepr=new Map,this.opaqueData=new Map,this.options=X}set(X,Y){X=QG(X),f80(X,Y),this.internalRepr.set(X,[Y])}add(X,Y){X=QG(X),f80(X,Y);let W=this.internalRepr.get(X);if(W===void 0)this.internalRepr.set(X,[Y]);else W.push(Y)}remove(X){X=QG(X),this.internalRepr.delete(X)}get(X){return X=QG(X),this.internalRepr.get(X)||[]}getMap(){let X={};for(let[Y,W]of this.internalRepr)if(W.length>0){let z=W[0];X[Y]=Buffer.isBuffer(z)?Buffer.from(z):z}return X}clone(){let X=new JG(this.options),Y=X.internalRepr;for(let[W,z]of this.internalRepr){let F=z.map((Q)=>{if(Buffer.isBuffer(Q))return Buffer.from(Q);else return Q});Y.set(W,F)}return X}merge(X){for(let[Y,W]of X.internalRepr){let z=(this.internalRepr.get(Y)||[]).concat(W);this.internalRepr.set(Y,z)}}setOptions(X){this.options=X}getOptions(){return this.options}toHttp2Headers(){let X={};for(let[Y,W]of this.internalRepr){if(Y.startsWith(":"))continue;X[Y]=W.map(eo0)}return X}toJSON(){let X={};for(let[Y,W]of this.internalRepr)X[Y]=W;return X}setOpaque(X,Y){this.opaqueData.set(X,Y)}getOpaque(X){return this.opaqueData.get(X)}static fromHttp2Headers(X){let Y=new JG;for(let W of Object.keys(X)){if(W.charAt(0)===":")continue;let z=X[W];try{if(y80(W)){if(Array.isArray(z))z.forEach((F)=>{Y.add(W,Buffer.from(F,"base64"))});else if(z!==void 0)if(so0(W))z.split(",").forEach((F)=>{Y.add(W,Buffer.from(F.trim(),"base64"))});else Y.add(W,Buffer.from(z,"base64"))}else if(Array.isArray(z))z.forEach((F)=>{Y.add(W,F)});else if(z!==void 0)Y.add(W,z)}catch(F){let Q=`Failed to add metadata entry ${W}: ${z}. ${(0,io0.getErrorMessage)(F)}. For more information see https://github.com/grpc/grpc-node/issues/1173`;(0,po0.log)(no0.LogVerbosity.ERROR,Q)}}return Y}}k80.Metadata=JG;var eo0=(X)=>{return Buffer.isBuffer(X)?X.toString("base64"):X}});var GG=X0((j80)=>{Object.defineProperty(j80,"__esModule",{value:!0});j80.CallCredentials=void 0;var HU=s6();function Xt0(X){return"getRequestHeaders"in X&&typeof X.getRequestHeaders==="function"}class eX{static createFromMetadataGenerator(X){return new VU(X)}static createFromGoogleCredential(X){return eX.createFromMetadataGenerator((Y,W)=>{let z;if(Xt0(X))z=X.getRequestHeaders(Y.service_url);else z=new Promise((F,Q)=>{X.getRequestMetadata(Y.service_url,(J,Z)=>{if(J){Q(J);return}if(!Z){Q(Error("Headers not set by metadata plugin"));return}F(Z)})});z.then((F)=>{let Q=new HU.Metadata;for(let J of Object.keys(F))Q.add(J,F[J]);W(null,Q)},(F)=>{W(F)})})}static createEmpty(){return new BU}}j80.CallCredentials=eX;class WG extends eX{constructor(X){super();this.creds=X}async generateMetadata(X){let Y=new HU.Metadata,W=await Promise.all(this.creds.map((z)=>z.generateMetadata(X)));for(let z of W)Y.merge(z);return Y}compose(X){return new WG(this.creds.concat([X]))}_equals(X){if(this===X)return!0;if(X instanceof WG)return this.creds.every((Y,W)=>Y._equals(X.creds[W]));else return!1}}class VU extends eX{constructor(X){super();this.metadataGenerator=X}generateMetadata(X){return new Promise((Y,W)=>{this.metadataGenerator(X,(z,F)=>{if(F!==void 0)Y(F);else W(z)})})}compose(X){return new WG([this,X])}_equals(X){if(this===X)return!0;if(X instanceof VU)return this.metadataGenerator===X.metadataGenerator;else return!1}}class BU extends eX{generateMetadata(X){return Promise.resolve(new HU.Metadata)}compose(X){return X}_equals(X){return X instanceof BU}}});var NU=X0((x80)=>{Object.defineProperty(x80,"__esModule",{value:!0});x80.CIPHER_SUITES=void 0;x80.getDefaultRootsData=Zt0;var Yt0=F1("fs");x80.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;var _80=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH,UU=null;function Zt0(){if(_80){if(UU===null)UU=Yt0.readFileSync(_80);return UU}return null}});var E9=X0((m80)=>{Object.defineProperty(m80,"__esModule",{value:!0});m80.parseUri=Wt0;m80.splitHostPort=Gt0;m80.combineHostPort=Kt0;m80.uriToString=Ft0;var Jt0=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;function Wt0(X){let Y=Jt0.exec(X);if(Y===null)return null;return{scheme:Y[1],authority:Y[2],path:Y[3]}}var u80=/^\d+$/;function Gt0(X){if(X.startsWith("[")){let Y=X.indexOf("]");if(Y===-1)return null;let W=X.substring(1,Y);if(W.indexOf(":")===-1)return null;if(X.length>Y+1)if(X[Y+1]===":"){let z=X.substring(Y+2);if(u80.test(z))return{host:W,port:+z};else return null}else return null;else return{host:W}}else{let Y=X.split(":");if(Y.length===2)if(u80.test(Y[1]))return{host:Y[0],port:+Y[1]};else return null;else return{host:X}}}function Kt0(X){if(X.port===void 0)return X.host;else if(X.host.includes(":"))return`[${X.host}]:${X.port}`;else return`${X.host}:${X.port}`}function Ft0(X){let Y="";if(X.scheme!==void 0)Y+=X.scheme+":";if(X.authority!==void 0)Y+="//"+X.authority+"/";return Y+=X.path,Y}});var y8=X0((g80)=>{Object.defineProperty(g80,"__esModule",{value:!0});g80.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=void 0;g80.registerResolver=Bt0;g80.registerDefaultScheme=Ut0;g80.createResolver=Nt0;g80.getDefaultAuthority=At0;g80.mapUriDefaultScheme=Ot0;var OU=E9();g80.CHANNEL_ARGS_CONFIG_SELECTOR_KEY="grpc.internal.config_selector";var XY={},AU=null;function Bt0(X,Y){XY[X]=Y}function Ut0(X){AU=X}function Nt0(X,Y,W){if(X.scheme!==void 0&&X.scheme in XY)return new XY[X.scheme](X,Y,W);else throw Error(`No resolver could be created for target ${(0,OU.uriToString)(X)}`)}function At0(X){if(X.scheme!==void 0&&X.scheme in XY)return XY[X.scheme].getDefaultAuthority(X);else throw Error(`Invalid target ${(0,OU.uriToString)(X)}`)}function Ot0(X){if(X.scheme===void 0||!(X.scheme in XY))if(AU!==null)return{scheme:AU,authority:void 0,path:(0,OU.uriToString)(X)};else return null;return X}});var ZY=X0((n80)=>{Object.defineProperty(n80,"__esModule",{value:!0});n80.ChannelCredentials=void 0;n80.createCertificateProviderChannelCredentials=Lt0;var QQ=F1("tls"),zG=GG(),IU=NU(),c80=E9(),Ct0=y8(),Rt0=A6(),Mt0=a1();function TU(X,Y){if(X&&!(X instanceof Buffer))throw TypeError(`${Y}, if provided, must be a Buffer.`)}class YY{compose(X){return new FG(this,X)}static createSsl(X,Y,W,z){var F;if(TU(X,"Root certificate"),TU(Y,"Private key"),TU(W,"Certificate chain"),Y&&!W)throw Error("Private key must be given with accompanying certificate chain");if(!Y&&W)throw Error("Certificate chain must be given with accompanying private key");let Q=(0,QQ.createSecureContext)({ca:(F=X!==null&&X!==void 0?X:(0,IU.getDefaultRootsData)())!==null&&F!==void 0?F:void 0,key:Y!==null&&Y!==void 0?Y:void 0,cert:W!==null&&W!==void 0?W:void 0,ciphers:IU.CIPHER_SUITES});return new KG(Q,z!==null&&z!==void 0?z:{})}static createFromSecureContext(X,Y){return new KG(X,Y!==null&&Y!==void 0?Y:{})}static createInsecure(){return new $U}}n80.ChannelCredentials=YY;class $U extends YY{constructor(){super()}compose(X){throw Error("Cannot compose insecure credentials")}_isSecure(){return!1}_equals(X){return X instanceof $U}_createSecureConnector(X,Y,W){return{connect(z){return Promise.resolve({socket:z,secure:!1})},waitForReady:()=>{return Promise.resolve()},getCallCredentials:()=>{return W!==null&&W!==void 0?W:zG.CallCredentials.createEmpty()},destroy(){}}}}function l80(X,Y,W,z){var F,Q;let J={secureContext:X},Z=W;if("grpc.http_connect_target"in z){let q=(0,c80.parseUri)(z["grpc.http_connect_target"]);if(q)Z=q}let K=(0,Ct0.getDefaultAuthority)(Z),H=(0,c80.splitHostPort)(K),G=(F=H===null||H===void 0?void 0:H.host)!==null&&F!==void 0?F:K;if(J.host=G,Y.checkServerIdentity)J.checkServerIdentity=Y.checkServerIdentity;if(Y.rejectUnauthorized!==void 0)J.rejectUnauthorized=Y.rejectUnauthorized;if(J.ALPNProtocols=["h2"],z["grpc.ssl_target_name_override"]){let q=z["grpc.ssl_target_name_override"],B=(Q=J.checkServerIdentity)!==null&&Q!==void 0?Q:QQ.checkServerIdentity;J.checkServerIdentity=($,R)=>{return B(q,R)},J.servername=q}else J.servername=G;if(z["grpc-node.tls_enable_trace"])J.enableTrace=!0;return J}class p80{constructor(X,Y){this.connectionOptions=X,this.callCredentials=Y}connect(X){let Y=Object.assign({socket:X},this.connectionOptions);return new Promise((W,z)=>{let F=(0,QQ.connect)(Y,()=>{var Q;if(((Q=this.connectionOptions.rejectUnauthorized)!==null&&Q!==void 0?Q:!0)&&!F.authorized){z(F.authorizationError);return}W({socket:F,secure:!0})});F.on("error",(Q)=>{z(Q)})})}waitForReady(){return Promise.resolve()}getCallCredentials(){return this.callCredentials}destroy(){}}class KG extends YY{constructor(X,Y){super();this.secureContext=X,this.verifyOptions=Y}_isSecure(){return!0}_equals(X){if(this===X)return!0;if(X instanceof KG)return this.secureContext===X.secureContext&&this.verifyOptions.checkServerIdentity===X.verifyOptions.checkServerIdentity;else return!1}_createSecureConnector(X,Y,W){let z=l80(this.secureContext,this.verifyOptions,X,Y);return new p80(z,W!==null&&W!==void 0?W:zG.CallCredentials.createEmpty())}}class ZQ extends YY{constructor(X,Y,W){super();this.caCertificateProvider=X,this.identityCertificateProvider=Y,this.verifyOptions=W,this.refcount=0,this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this),this.secureContextWatchers=[]}_isSecure(){return!0}_equals(X){var Y,W;if(this===X)return!0;if(X instanceof ZQ)return this.caCertificateProvider===X.caCertificateProvider&&this.identityCertificateProvider===X.identityCertificateProvider&&((Y=this.verifyOptions)===null||Y===void 0?void 0:Y.checkServerIdentity)===((W=X.verifyOptions)===null||W===void 0?void 0:W.checkServerIdentity);else return!1}ref(){var X;if(this.refcount===0)this.caCertificateProvider.addCaCertificateListener(this.caCertificateUpdateListener),(X=this.identityCertificateProvider)===null||X===void 0||X.addIdentityCertificateListener(this.identityCertificateUpdateListener);this.refcount+=1}unref(){var X;if(this.refcount-=1,this.refcount===0)this.caCertificateProvider.removeCaCertificateListener(this.caCertificateUpdateListener),(X=this.identityCertificateProvider)===null||X===void 0||X.removeIdentityCertificateListener(this.identityCertificateUpdateListener)}_createSecureConnector(X,Y,W){return this.ref(),new ZQ.SecureConnectorImpl(this,X,Y,W!==null&&W!==void 0?W:zG.CallCredentials.createEmpty())}maybeUpdateWatchers(){if(this.hasReceivedUpdates()){for(let X of this.secureContextWatchers)X(this.getLatestSecureContext());this.secureContextWatchers=[]}}handleCaCertificateUpdate(X){this.latestCaUpdate=X,this.maybeUpdateWatchers()}handleIdentityCertitificateUpdate(X){this.latestIdentityUpdate=X,this.maybeUpdateWatchers()}hasReceivedUpdates(){if(this.latestCaUpdate===void 0)return!1;if(this.identityCertificateProvider&&this.latestIdentityUpdate===void 0)return!1;return!0}getSecureContext(){if(this.hasReceivedUpdates())return Promise.resolve(this.getLatestSecureContext());else return new Promise((X)=>{this.secureContextWatchers.push(X)})}getLatestSecureContext(){var X,Y;if(!this.latestCaUpdate)return null;if(this.identityCertificateProvider!==null&&!this.latestIdentityUpdate)return null;try{return(0,QQ.createSecureContext)({ca:this.latestCaUpdate.caCertificate,key:(X=this.latestIdentityUpdate)===null||X===void 0?void 0:X.privateKey,cert:(Y=this.latestIdentityUpdate)===null||Y===void 0?void 0:Y.certificate,ciphers:IU.CIPHER_SUITES})}catch(W){return(0,Rt0.log)(Mt0.LogVerbosity.ERROR,"Failed to createSecureContext with error "+W.message),null}}}ZQ.SecureConnectorImpl=class{constructor(X,Y,W,z){this.parent=X,this.channelTarget=Y,this.options=W,this.callCredentials=z}connect(X){return new Promise((Y,W)=>{let z=this.parent.getLatestSecureContext();if(!z){W(Error("Failed to load credentials"));return}if(X.closed)W(Error("Socket closed while loading credentials"));let F=l80(z,this.parent.verifyOptions,this.channelTarget,this.options),Q=Object.assign({socket:X},F),J=()=>{W(Error("Socket closed"))},Z=(H)=>{W(H)},K=(0,QQ.connect)(Q,()=>{var H;if(K.removeListener("close",J),K.removeListener("error",Z),((H=this.parent.verifyOptions.rejectUnauthorized)!==null&&H!==void 0?H:!0)&&!K.authorized){W(K.authorizationError);return}Y({socket:K,secure:!0})});K.once("close",J),K.once("error",Z)})}async waitForReady(){await this.parent.getSecureContext()}getCallCredentials(){return this.callCredentials}destroy(){this.parent.unref()}};function Lt0(X,Y,W){return new ZQ(X,Y,W!==null&&W!==void 0?W:{})}class FG extends YY{constructor(X,Y){super();if(this.channelCredentials=X,this.callCredentials=Y,!X._isSecure())throw Error("Cannot compose insecure credentials")}compose(X){let Y=this.callCredentials.compose(X);return new FG(this.channelCredentials,Y)}_isSecure(){return!0}_equals(X){if(this===X)return!0;if(X instanceof FG)return this.channelCredentials._equals(X.channelCredentials)&&this.callCredentials._equals(X.callCredentials);else return!1}_createSecureConnector(X,Y,W){let z=this.callCredentials.compose(W!==null&&W!==void 0?W:zG.CallCredentials.createEmpty());return this.channelCredentials._createSecureConnector(X,Y,z)}}});var E5=X0((r80)=>{Object.defineProperty(r80,"__esModule",{value:!0});r80.createChildChannelControlHelper=ft0;r80.registerLoadBalancerType=yt0;r80.registerDefaultLoadBalancerType=kt0;r80.createLoadBalancer=vt0;r80.isLoadBalancerNameRegistered=jt0;r80.parseLoadBalancingConfig=a80;r80.getDefaultConfig=ht0;r80.selectLbConfigFromList=_t0;var wt0=A6(),St0=a1();function ft0(X,Y){var W,z,F,Q,J,Z,K,H,G,q;return{createSubchannel:(z=(W=Y.createSubchannel)===null||W===void 0?void 0:W.bind(Y))!==null&&z!==void 0?z:X.createSubchannel.bind(X),updateState:(Q=(F=Y.updateState)===null||F===void 0?void 0:F.bind(Y))!==null&&Q!==void 0?Q:X.updateState.bind(X),requestReresolution:(Z=(J=Y.requestReresolution)===null||J===void 0?void 0:J.bind(Y))!==null&&Z!==void 0?Z:X.requestReresolution.bind(X),addChannelzChild:(H=(K=Y.addChannelzChild)===null||K===void 0?void 0:K.bind(Y))!==null&&H!==void 0?H:X.addChannelzChild.bind(X),removeChannelzChild:(q=(G=Y.removeChannelzChild)===null||G===void 0?void 0:G.bind(Y))!==null&&q!==void 0?q:X.removeChannelzChild.bind(X)}}var D5={},JQ=null;function yt0(X,Y,W){D5[X]={LoadBalancer:Y,LoadBalancingConfig:W}}function kt0(X){JQ=X}function vt0(X,Y){let W=X.getLoadBalancerName();if(W in D5)return new D5[W].LoadBalancer(Y);else return null}function jt0(X){return X in D5}function a80(X){let Y=Object.keys(X);if(Y.length!==1)throw Error("Provided load balancing config has multiple conflicting entries");let W=Y[0];if(W in D5)try{return D5[W].LoadBalancingConfig.createFromJson(X[W])}catch(z){throw Error(`${W}: ${z.message}`)}else throw Error(`Unrecognized load balancing config name ${W}`)}function ht0(){if(!JQ)throw Error("No default load balancer type registered");return new D5[JQ].LoadBalancingConfig}function _t0(X,Y=!1){for(let W of X)try{return a80(W)}catch(z){(0,wt0.log)(St0.LogVerbosity.DEBUG,"Config parsing failed with error",z.message);continue}if(Y)if(JQ)return new D5[JQ].LoadBalancingConfig;else return null;else return null}});var DU=X0((s80)=>{Object.defineProperty(s80,"__esModule",{value:!0});s80.validateRetryThrottling=o80;s80.validateServiceConfig=t80;s80.extractAndSelectServiceConfig=Xs0;var pt0=F1("os"),qG=a1(),HG=/^\d+(\.\d{1,9})?s$/,nt0="node";function it0(X){if("service"in X&&X.service!==""){if(typeof X.service!=="string")throw Error(`Invalid method config name: invalid service: expected type string, got ${typeof X.service}`);if("method"in X&&X.method!==""){if(typeof X.method!=="string")throw Error(`Invalid method config name: invalid method: expected type string, got ${typeof X.service}`);return{service:X.service,method:X.method}}else return{service:X.service}}else{if("method"in X&&X.method!==void 0)throw Error("Invalid method config name: method set with empty or unset service");return{}}}function at0(X){if(!("maxAttempts"in X)||!Number.isInteger(X.maxAttempts)||X.maxAttempts<2)throw Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");if(!("initialBackoff"in X)||typeof X.initialBackoff!=="string"||!HG.test(X.initialBackoff))throw Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("maxBackoff"in X)||typeof X.maxBackoff!=="string"||!HG.test(X.maxBackoff))throw Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("backoffMultiplier"in X)||typeof X.backoffMultiplier!=="number"||X.backoffMultiplier<=0)throw Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");if(!(("retryableStatusCodes"in X)&&Array.isArray(X.retryableStatusCodes)))throw Error("Invalid method config retry policy: retryableStatusCodes is required");if(X.retryableStatusCodes.length===0)throw Error("Invalid method config retry policy: retryableStatusCodes must be non-empty");for(let Y of X.retryableStatusCodes)if(typeof Y==="number"){if(!Object.values(qG.Status).includes(Y))throw Error("Invalid method config retry policy: retryableStatusCodes value not in status code range")}else if(typeof Y==="string"){if(!Object.values(qG.Status).includes(Y.toUpperCase()))throw Error("Invalid method config retry policy: retryableStatusCodes value not a status code name")}else throw Error("Invalid method config retry policy: retryableStatusCodes value must be a string or number");return{maxAttempts:X.maxAttempts,initialBackoff:X.initialBackoff,maxBackoff:X.maxBackoff,backoffMultiplier:X.backoffMultiplier,retryableStatusCodes:X.retryableStatusCodes}}function rt0(X){if(!("maxAttempts"in X)||!Number.isInteger(X.maxAttempts)||X.maxAttempts<2)throw Error("Invalid method config hedging policy: maxAttempts must be an integer at least 2");if("hedgingDelay"in X&&(typeof X.hedgingDelay!=="string"||!HG.test(X.hedgingDelay)))throw Error("Invalid method config hedging policy: hedgingDelay must be a string consisting of a positive integer followed by s");if("nonFatalStatusCodes"in X&&Array.isArray(X.nonFatalStatusCodes))for(let W of X.nonFatalStatusCodes)if(typeof W==="number"){if(!Object.values(qG.Status).includes(W))throw Error("Invalid method config hedging policy: nonFatalStatusCodes value not in status code range")}else if(typeof W==="string"){if(!Object.values(qG.Status).includes(W.toUpperCase()))throw Error("Invalid method config hedging policy: nonFatalStatusCodes value not a status code name")}else throw Error("Invalid method config hedging policy: nonFatalStatusCodes value must be a string or number");let Y={maxAttempts:X.maxAttempts};if(X.hedgingDelay)Y.hedgingDelay=X.hedgingDelay;if(X.nonFatalStatusCodes)Y.nonFatalStatusCodes=X.nonFatalStatusCodes;return Y}function ot0(X){var Y;let W={name:[]};if(!("name"in X)||!Array.isArray(X.name))throw Error("Invalid method config: invalid name array");for(let z of X.name)W.name.push(it0(z));if("waitForReady"in X){if(typeof X.waitForReady!=="boolean")throw Error("Invalid method config: invalid waitForReady");W.waitForReady=X.waitForReady}if("timeout"in X)if(typeof X.timeout==="object"){if(!("seconds"in X.timeout)||typeof X.timeout.seconds!=="number")throw Error("Invalid method config: invalid timeout.seconds");if(!("nanos"in X.timeout)||typeof X.timeout.nanos!=="number")throw Error("Invalid method config: invalid timeout.nanos");W.timeout=X.timeout}else if(typeof X.timeout==="string"&&HG.test(X.timeout)){let z=X.timeout.substring(0,X.timeout.length-1).split(".");W.timeout={seconds:z[0]|0,nanos:((Y=z[1])!==null&&Y!==void 0?Y:0)|0}}else throw Error("Invalid method config: invalid timeout");if("maxRequestBytes"in X){if(typeof X.maxRequestBytes!=="number")throw Error("Invalid method config: invalid maxRequestBytes");W.maxRequestBytes=X.maxRequestBytes}if("maxResponseBytes"in X){if(typeof X.maxResponseBytes!=="number")throw Error("Invalid method config: invalid maxRequestBytes");W.maxResponseBytes=X.maxResponseBytes}if("retryPolicy"in X)if("hedgingPolicy"in X)throw Error("Invalid method config: retryPolicy and hedgingPolicy cannot both be specified");else W.retryPolicy=at0(X.retryPolicy);else if("hedgingPolicy"in X)W.hedgingPolicy=rt0(X.hedgingPolicy);return W}function o80(X){if(!("maxTokens"in X)||typeof X.maxTokens!=="number"||X.maxTokens<=0||X.maxTokens>1000)throw Error("Invalid retryThrottling: maxTokens must be a number in (0, 1000]");if(!("tokenRatio"in X)||typeof X.tokenRatio!=="number"||X.tokenRatio<=0)throw Error("Invalid retryThrottling: tokenRatio must be a number greater than 0");return{maxTokens:+X.maxTokens.toFixed(3),tokenRatio:+X.tokenRatio.toFixed(3)}}function tt0(X){if(!(typeof X==="object"&&X!==null))throw Error(`Invalid loadBalancingConfig: unexpected type ${typeof X}`);let Y=Object.keys(X);if(Y.length>1)throw Error(`Invalid loadBalancingConfig: unexpected multiple keys ${Y}`);if(Y.length===0)throw Error("Invalid loadBalancingConfig: load balancing policy name required");return{[Y[0]]:X[Y[0]]}}function t80(X){let Y={loadBalancingConfig:[],methodConfig:[]};if("loadBalancingPolicy"in X)if(typeof X.loadBalancingPolicy==="string")Y.loadBalancingPolicy=X.loadBalancingPolicy;else throw Error("Invalid service config: invalid loadBalancingPolicy");if("loadBalancingConfig"in X)if(Array.isArray(X.loadBalancingConfig))for(let z of X.loadBalancingConfig)Y.loadBalancingConfig.push(tt0(z));else throw Error("Invalid service config: invalid loadBalancingConfig");if("methodConfig"in X){if(Array.isArray(X.methodConfig))for(let z of X.methodConfig)Y.methodConfig.push(ot0(z))}if("retryThrottling"in X)Y.retryThrottling=o80(X.retryThrottling);let W=[];for(let z of Y.methodConfig)for(let F of z.name){for(let Q of W)if(F.service===Q.service&&F.method===Q.method)throw Error(`Invalid service config: duplicate name ${F.service}/${F.method}`);W.push(F)}return Y}function st0(X){if(!("serviceConfig"in X))throw Error("Invalid service config choice: missing service config");let Y={serviceConfig:t80(X.serviceConfig)};if("clientLanguage"in X)if(Array.isArray(X.clientLanguage)){Y.clientLanguage=[];for(let z of X.clientLanguage)if(typeof z==="string")Y.clientLanguage.push(z);else throw Error("Invalid service config choice: invalid clientLanguage")}else throw Error("Invalid service config choice: invalid clientLanguage");if("clientHostname"in X)if(Array.isArray(X.clientHostname)){Y.clientHostname=[];for(let z of X.clientHostname)if(typeof z==="string")Y.clientHostname.push(z);else throw Error("Invalid service config choice: invalid clientHostname")}else throw Error("Invalid service config choice: invalid clientHostname");if("percentage"in X)if(typeof X.percentage==="number"&&0<=X.percentage&&X.percentage<=100)Y.percentage=X.percentage;else throw Error("Invalid service config choice: invalid percentage");let W=["clientLanguage","percentage","clientHostname","serviceConfig"];for(let z in X)if(!W.includes(z))throw Error(`Invalid service config choice: unexpected field ${z}`);return Y}function et0(X,Y){if(!Array.isArray(X))throw Error("Invalid service config list");for(let W of X){let z=st0(W);if(typeof z.percentage==="number"&&Y>z.percentage)continue;if(Array.isArray(z.clientHostname)){let F=!1;for(let Q of z.clientHostname)if(Q===pt0.hostname())F=!0;if(!F)continue}if(Array.isArray(z.clientLanguage)){let F=!1;for(let Q of z.clientLanguage)if(Q===nt0)F=!0;if(!F)continue}return z.serviceConfig}throw Error("No matching service config found")}function Xs0(X,Y){for(let W of X)if(W.length>0&&W[0].startsWith("grpc_config=")){let z=W.join("").substring(12),F=JSON.parse(z);return et0(F,Y)}return null}});var C9=X0((X40)=>{Object.defineProperty(X40,"__esModule",{value:!0});X40.ConnectivityState=void 0;var e80;(function(X){X[X.IDLE=0]="IDLE",X[X.CONNECTING=1]="CONNECTING",X[X.READY=2]="READY",X[X.TRANSIENT_FAILURE=3]="TRANSIENT_FAILURE",X[X.SHUTDOWN=4]="SHUTDOWN"})(e80||(X40.ConnectivityState=e80={}))});var b4=X0((J40)=>{Object.defineProperty(J40,"__esModule",{value:!0});J40.QueuePicker=J40.UnavailablePicker=J40.PickResultType=void 0;var Js0=s6(),Ws0=a1(),VG;(function(X){X[X.COMPLETE=0]="COMPLETE",X[X.QUEUE=1]="QUEUE",X[X.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",X[X.DROP=3]="DROP"})(VG||(J40.PickResultType=VG={}));class Z40{constructor(X){this.status=Object.assign({code:Ws0.Status.UNAVAILABLE,details:"No connection established",metadata:new Js0.Metadata},X)}pick(X){return{pickResultType:VG.TRANSIENT_FAILURE,subchannel:null,status:this.status,onCallStarted:null,onCallEnded:null}}}J40.UnavailablePicker=Z40;class Q40{constructor(X,Y){this.loadBalancer=X,this.childPicker=Y,this.calledExitIdle=!1}pick(X){if(!this.calledExitIdle)process.nextTick(()=>{this.loadBalancer.exitIdle()}),this.calledExitIdle=!0;if(this.childPicker)return this.childPicker.pick(X);else return{pickResultType:VG.QUEUE,subchannel:null,status:null,onCallStarted:null,onCallEnded:null}}}J40.QueuePicker=Q40});var QY=X0((G40)=>{Object.defineProperty(G40,"__esModule",{value:!0});G40.BackoffTimeout=void 0;var Fs0=a1(),zs0=A6(),qs0="backoff",Hs0=1000,Vs0=1.6,Bs0=120000,Us0=0.2;function Ns0(X,Y){return Math.random()*(Y-X)+X}class BG{constructor(X,Y){if(this.callback=X,this.initialDelay=Hs0,this.multiplier=Vs0,this.maxDelay=Bs0,this.jitter=Us0,this.running=!1,this.hasRef=!0,this.startTime=new Date,this.endTime=new Date,this.id=BG.getNextId(),Y){if(Y.initialDelay)this.initialDelay=Y.initialDelay;if(Y.multiplier)this.multiplier=Y.multiplier;if(Y.jitter)this.jitter=Y.jitter;if(Y.maxDelay)this.maxDelay=Y.maxDelay}this.trace("constructed initialDelay="+this.initialDelay+" multiplier="+this.multiplier+" jitter="+this.jitter+" maxDelay="+this.maxDelay),this.nextDelay=this.initialDelay,this.timerId=setTimeout(()=>{},0),clearTimeout(this.timerId)}static getNextId(){return this.nextId++}trace(X){zs0.trace(Fs0.LogVerbosity.DEBUG,qs0,"{"+this.id+"} "+X)}runTimer(X){var Y,W;if(this.trace("runTimer(delay="+X+")"),this.endTime=this.startTime,this.endTime.setMilliseconds(this.endTime.getMilliseconds()+X),clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.trace("timer fired"),this.running=!1,this.callback()},X),!this.hasRef)(W=(Y=this.timerId).unref)===null||W===void 0||W.call(Y)}runOnce(){this.trace("runOnce()"),this.running=!0,this.startTime=new Date,this.runTimer(this.nextDelay);let X=Math.min(this.nextDelay*this.multiplier,this.maxDelay),Y=X*this.jitter;this.nextDelay=X+Ns0(-Y,Y)}stop(){this.trace("stop()"),clearTimeout(this.timerId),this.running=!1}reset(){if(this.trace("reset() running="+this.running),this.nextDelay=this.initialDelay,this.running){let X=new Date,Y=this.startTime;if(Y.setMilliseconds(Y.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),X<Y)this.runTimer(Y.getTime()-X.getTime());else this.running=!1}}isRunning(){return this.running}ref(){var X,Y;this.hasRef=!0,(Y=(X=this.timerId).ref)===null||Y===void 0||Y.call(X)}unref(){var X,Y;this.hasRef=!1,(Y=(X=this.timerId).unref)===null||Y===void 0||Y.call(X)}getEndTime(){return this.endTime}}G40.BackoffTimeout=BG;BG.nextId=0});var UG=X0((z40)=>{Object.defineProperty(z40,"__esModule",{value:!0});z40.ChildLoadBalancerHandler=void 0;var As0=E5(),Os0=C9(),Ts0="child_load_balancer_helper";class F40{constructor(X){this.channelControlHelper=X,this.currentChild=null,this.pendingChild=null,this.latestConfig=null,this.ChildPolicyHelper=class{constructor(Y){this.parent=Y,this.child=null}createSubchannel(Y,W){return this.parent.channelControlHelper.createSubchannel(Y,W)}updateState(Y,W,z){var F;if(this.calledByPendingChild()){if(Y===Os0.ConnectivityState.CONNECTING)return;(F=this.parent.currentChild)===null||F===void 0||F.destroy(),this.parent.currentChild=this.parent.pendingChild,this.parent.pendingChild=null}else if(!this.calledByCurrentChild())return;this.parent.channelControlHelper.updateState(Y,W,z)}requestReresolution(){var Y;let W=(Y=this.parent.pendingChild)!==null&&Y!==void 0?Y:this.parent.currentChild;if(this.child===W)this.parent.channelControlHelper.requestReresolution()}setChild(Y){this.child=Y}addChannelzChild(Y){this.parent.channelControlHelper.addChannelzChild(Y)}removeChannelzChild(Y){this.parent.channelControlHelper.removeChannelzChild(Y)}calledByPendingChild(){return this.child===this.parent.pendingChild}calledByCurrentChild(){return this.child===this.parent.currentChild}}}configUpdateRequiresNewPolicyInstance(X,Y){return X.getLoadBalancerName()!==Y.getLoadBalancerName()}updateAddressList(X,Y,W,z){let F;if(this.currentChild===null||this.latestConfig===null||this.configUpdateRequiresNewPolicyInstance(this.latestConfig,Y)){let Q=new this.ChildPolicyHelper(this),J=(0,As0.createLoadBalancer)(Y,Q);if(Q.setChild(J),this.currentChild===null)this.currentChild=J,F=this.currentChild;else{if(this.pendingChild)this.pendingChild.destroy();this.pendingChild=J,F=this.pendingChild}}else if(this.pendingChild===null)F=this.currentChild;else F=this.pendingChild;return this.latestConfig=Y,F.updateAddressList(X,Y,W,z)}exitIdle(){if(this.currentChild){if(this.currentChild.exitIdle(),this.pendingChild)this.pendingChild.exitIdle()}}resetBackoff(){if(this.currentChild){if(this.currentChild.resetBackoff(),this.pendingChild)this.pendingChild.resetBackoff()}}destroy(){if(this.currentChild)this.currentChild.destroy(),this.currentChild=null;if(this.pendingChild)this.pendingChild.destroy(),this.pendingChild=null}getTypeName(){return Ts0}}z40.ChildLoadBalancerHandler=F40});var A40=X0((U40)=>{Object.defineProperty(U40,"__esModule",{value:!0});U40.ResolvingLoadBalancer=void 0;var Is0=E5(),$s0=DU(),f9=C9(),H40=y8(),WQ=b4(),Ds0=QY(),EU=a1(),Es0=s6(),Cs0=A6(),Rs0=a1(),Ms0=E9(),Ls0=UG(),Ps0="resolving_load_balancer";function V40(X){Cs0.trace(Rs0.LogVerbosity.DEBUG,Ps0,X)}var ws0=["SERVICE_AND_METHOD","SERVICE","EMPTY"];function Ss0(X,Y,W,z){for(let F of W.name)switch(z){case"EMPTY":if(!F.service&&!F.method)return!0;break;case"SERVICE":if(F.service===X&&!F.method)return!0;break;case"SERVICE_AND_METHOD":if(F.service===X&&F.method===Y)return!0}return!1}function fs0(X,Y,W,z){for(let F of W)if(Ss0(X,Y,F,z))return F;return null}function ys0(X){return{invoke(Y,W){var z,F;let Q=Y.split("/").filter((K)=>K.length>0),J=(z=Q[0])!==null&&z!==void 0?z:"",Z=(F=Q[1])!==null&&F!==void 0?F:"";if(X&&X.methodConfig)for(let K of ws0){let H=fs0(J,Z,X.methodConfig,K);if(H)return{methodConfig:H,pickInformation:{},status:EU.Status.OK,dynamicFilterFactories:[]}}return{methodConfig:{name:[]},pickInformation:{},status:EU.Status.OK,dynamicFilterFactories:[]}},unref(){}}}class B40{constructor(X,Y,W,z,F){if(this.target=X,this.channelControlHelper=Y,this.channelOptions=W,this.onSuccessfulResolution=z,this.onFailedResolution=F,this.latestChildState=f9.ConnectivityState.IDLE,this.latestChildPicker=new WQ.QueuePicker(this),this.latestChildErrorMessage=null,this.currentState=f9.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,W["grpc.service_config"])this.defaultServiceConfig=(0,$s0.validateServiceConfig)(JSON.parse(W["grpc.service_config"]));else this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]};this.updateState(f9.ConnectivityState.IDLE,new WQ.QueuePicker(this),null),this.childLoadBalancer=new Ls0.ChildLoadBalancerHandler({createSubchannel:Y.createSubchannel.bind(Y),requestReresolution:()=>{if(this.backoffTimeout.isRunning())V40("requestReresolution delayed by backoff timer until "+this.backoffTimeout.getEndTime().toISOString()),this.continueResolving=!0;else this.updateResolution()},updateState:(J,Z,K)=>{this.latestChildState=J,this.latestChildPicker=Z,this.latestChildErrorMessage=K,this.updateState(J,Z,K)},addChannelzChild:Y.addChannelzChild.bind(Y),removeChannelzChild:Y.removeChannelzChild.bind(Y)}),this.innerResolver=(0,H40.createResolver)(X,this.handleResolverResult.bind(this),W);let Q={initialDelay:W["grpc.initial_reconnect_backoff_ms"],maxDelay:W["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new Ds0.BackoffTimeout(()=>{if(this.continueResolving)this.updateResolution(),this.continueResolving=!1;else this.updateState(this.latestChildState,this.latestChildPicker,this.latestChildErrorMessage)},Q),this.backoffTimeout.unref()}handleResolverResult(X,Y,W,z){var F,Q;this.backoffTimeout.stop(),this.backoffTimeout.reset();let J=!0,Z=null;if(W===null)Z=this.defaultServiceConfig;else if(W.ok)Z=W.value;else if(this.previousServiceConfig!==null)Z=this.previousServiceConfig;else J=!1,this.handleResolutionFailure(W.error);if(Z!==null){let K=(F=Z===null||Z===void 0?void 0:Z.loadBalancingConfig)!==null&&F!==void 0?F:[],H=(0,Is0.selectLbConfigFromList)(K,!0);if(H===null)J=!1,this.handleResolutionFailure({code:EU.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new Es0.Metadata});else J=this.childLoadBalancer.updateAddressList(X,H,Object.assign(Object.assign({},this.channelOptions),Y),z)}if(J)this.onSuccessfulResolution(Z,(Q=Y[H40.CHANNEL_ARGS_CONFIG_SELECTOR_KEY])!==null&&Q!==void 0?Q:ys0(Z));return J}updateResolution(){if(this.innerResolver.updateResolution(),this.currentState===f9.ConnectivityState.IDLE)this.updateState(f9.ConnectivityState.CONNECTING,this.latestChildPicker,this.latestChildErrorMessage);this.backoffTimeout.runOnce()}updateState(X,Y,W){if(V40((0,Ms0.uriToString)(this.target)+" "+f9.ConnectivityState[this.currentState]+" -> "+f9.ConnectivityState[X]),X===f9.ConnectivityState.IDLE)Y=new WQ.QueuePicker(this,Y);this.currentState=X,this.channelControlHelper.updateState(X,Y,W)}handleResolutionFailure(X){if(this.latestChildState===f9.ConnectivityState.IDLE)this.updateState(f9.ConnectivityState.TRANSIENT_FAILURE,new WQ.UnavailablePicker(X),X.details),this.onFailedResolution(X)}exitIdle(){if(this.currentState===f9.ConnectivityState.IDLE||this.currentState===f9.ConnectivityState.TRANSIENT_FAILURE)if(this.backoffTimeout.isRunning())this.continueResolving=!0;else this.updateResolution();this.childLoadBalancer.exitIdle()}updateAddressList(X,Y){throw Error("updateAddressList not supported on ResolvingLoadBalancer")}resetBackoff(){this.backoffTimeout.reset(),this.childLoadBalancer.resetBackoff()}destroy(){this.childLoadBalancer.destroy(),this.innerResolver.destroy(),this.backoffTimeout.reset(),this.backoffTimeout.stop(),this.latestChildState=f9.ConnectivityState.IDLE,this.latestChildPicker=new WQ.QueuePicker(this),this.currentState=f9.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1}getTypeName(){return"resolving_load_balancer"}}U40.ResolvingLoadBalancer=B40});var I40=X0((O40)=>{Object.defineProperty(O40,"__esModule",{value:!0});O40.recognizedOptions=void 0;O40.channelOptionsEqual=ks0;O40.recognizedOptions={"grpc.ssl_target_name_override":!0,"grpc.primary_user_agent":!0,"grpc.secondary_user_agent":!0,"grpc.default_authority":!0,"grpc.keepalive_time_ms":!0,"grpc.keepalive_timeout_ms":!0,"grpc.keepalive_permit_without_calls":!0,"grpc.service_config":!0,"grpc.max_concurrent_streams":!0,"grpc.initial_reconnect_backoff_ms":!0,"grpc.max_reconnect_backoff_ms":!0,"grpc.use_local_subchannel_pool":!0,"grpc.max_send_message_length":!0,"grpc.max_receive_message_length":!0,"grpc.enable_http_proxy":!0,"grpc.enable_channelz":!0,"grpc.dns_min_time_between_resolutions_ms":!0,"grpc.enable_retries":!0,"grpc.per_rpc_retry_buffer_size":!0,"grpc.retry_buffer_size":!0,"grpc.max_connection_age_ms":!0,"grpc.max_connection_age_grace_ms":!0,"grpc-node.max_session_memory":!0,"grpc.service_config_disable_resolution":!0,"grpc.client_idle_timeout_ms":!0,"grpc-node.tls_enable_trace":!0,"grpc.lb.ring_hash.ring_size_cap":!0,"grpc-node.retry_max_attempts_limit":!0,"grpc-node.flow_control_window":!0,"grpc.server_call_metric_recording":!0};function ks0(X,Y){let W=Object.keys(X).sort(),z=Object.keys(Y).sort();if(W.length!==z.length)return!1;for(let F=0;F<W.length;F+=1){if(W[F]!==z[F])return!1;if(X[W[F]]!==Y[z[F]])return!1}return!0}});var y9=X0((R40)=>{Object.defineProperty(R40,"__esModule",{value:!0});R40.EndpointMap=void 0;R40.isTcpSubchannelAddress=KQ;R40.subchannelAddressEqual=NG;R40.subchannelAddressToString=D40;R40.stringToSubchannelAddress=hs0;R40.endpointEqual=_s0;R40.endpointToString=xs0;R40.endpointHasAddress=E40;var $40=F1("net");function KQ(X){return"port"in X}function NG(X,Y){if(!X&&!Y)return!0;if(!X||!Y)return!1;if(KQ(X))return KQ(Y)&&X.host===Y.host&&X.port===Y.port;else return!KQ(Y)&&X.path===Y.path}function D40(X){if(KQ(X))if((0,$40.isIPv6)(X.host))return"["+X.host+"]:"+X.port;else return X.host+":"+X.port;else return X.path}var js0=443;function hs0(X,Y){if((0,$40.isIP)(X))return{host:X,port:Y!==null&&Y!==void 0?Y:js0};else return{path:X}}function _s0(X,Y){if(X.addresses.length!==Y.addresses.length)return!1;for(let W=0;W<X.addresses.length;W++)if(!NG(X.addresses[W],Y.addresses[W]))return!1;return!0}function xs0(X){return"["+X.addresses.map(D40).join(", ")+"]"}function E40(X,Y){for(let W of X.addresses)if(NG(W,Y))return!0;return!1}function GQ(X,Y){if(X.addresses.length!==Y.addresses.length)return!1;for(let W of X.addresses){let z=!1;for(let F of Y.addresses)if(NG(W,F)){z=!0;break}if(!z)return!1}return!0}class C40{constructor(){this.map=new Set}get size(){return this.map.size}getForSubchannelAddress(X){for(let Y of this.map)if(E40(Y.key,X))return Y.value;return}deleteMissing(X){let Y=[];for(let W of this.map){let z=!1;for(let F of X)if(GQ(F,W.key))z=!0;if(!z)Y.push(W.value),this.map.delete(W)}return Y}get(X){for(let Y of this.map)if(GQ(X,Y.key))return Y.value;return}set(X,Y){for(let W of this.map)if(GQ(X,W.key)){W.value=Y;return}this.map.add({key:X,value:Y})}delete(X){for(let Y of this.map)if(GQ(X,Y.key)){this.map.delete(Y);return}}has(X){for(let Y of this.map)if(GQ(X,Y.key))return!0;return!1}clear(){this.map.clear()}*keys(){for(let X of this.map)yield X.key}*values(){for(let X of this.map)yield X.value}*entries(){for(let X of this.map)yield[X.key,X.value]}}R40.EndpointMap=C40});var j40=X0((v40)=>{Object.defineProperty(v40,"t",{value:!0});class CU{constructor(X,Y,W=1){this.i=void 0,this.h=void 0,this.o=void 0,this.u=X,this.l=Y,this.p=W}I(){let X=this,Y=X.o.o===X;if(Y&&X.p===1)X=X.h;else if(X.i){X=X.i;while(X.h)X=X.h}else{if(Y)return X.o;let W=X.o;while(W.i===X)X=W,W=X.o;X=W}return X}B(){let X=this;if(X.h){X=X.h;while(X.i)X=X.i;return X}else{let Y=X.o;while(Y.h===X)X=Y,Y=X.o;if(X.h!==Y)return Y;else return X}}_(){let X=this.o,Y=this.h,W=Y.i;if(X.o===this)X.o=Y;else if(X.i===this)X.i=Y;else X.h=Y;if(Y.o=X,Y.i=this,this.o=Y,this.h=W,W)W.o=this;return Y}g(){let X=this.o,Y=this.i,W=Y.h;if(X.o===this)X.o=Y;else if(X.i===this)X.i=Y;else X.h=Y;if(Y.o=X,Y.h=this,this.o=Y,this.i=W,W)W.o=this;return Y}}class L40 extends CU{constructor(){super(...arguments);this.M=1}_(){let X=super._();return this.O(),X.O(),X}g(){let X=super.g();return this.O(),X.O(),X}O(){if(this.M=1,this.i)this.M+=this.i.M;if(this.h)this.M+=this.h.M}}class P40{constructor(X=0){this.iteratorType=X}equals(X){return this.T===X.T}}class w40{constructor(){this.m=0}get length(){return this.m}size(){return this.m}empty(){return this.m===0}}class S40 extends w40{}function j7(){throw RangeError("Iterator access denied!")}class f40 extends S40{constructor(X=function(W,z){if(W<z)return-1;if(W>z)return 1;return 0},Y=!1){super();this.v=void 0,this.A=X,this.enableIndex=Y,this.N=Y?L40:CU,this.C=new this.N}R(X,Y){let W=this.C;while(X){let z=this.A(X.u,Y);if(z<0)X=X.h;else if(z>0)W=X,X=X.i;else return X}return W}K(X,Y){let W=this.C;while(X)if(this.A(X.u,Y)<=0)X=X.h;else W=X,X=X.i;return W}L(X,Y){let W=this.C;while(X){let z=this.A(X.u,Y);if(z<0)W=X,X=X.h;else if(z>0)X=X.i;else return X}return W}k(X,Y){let W=this.C;while(X)if(this.A(X.u,Y)<0)W=X,X=X.h;else X=X.i;return W}P(X){while(!0){let Y=X.o;if(Y===this.C)return;if(X.p===1){X.p=0;return}if(X===Y.i){let W=Y.h;if(W.p===1)if(W.p=0,Y.p=1,Y===this.v)this.v=Y._();else Y._();else if(W.h&&W.h.p===1){if(W.p=Y.p,Y.p=0,W.h.p=0,Y===this.v)this.v=Y._();else Y._();return}else if(W.i&&W.i.p===1)W.p=1,W.i.p=0,W.g();else W.p=1,X=Y}else{let W=Y.i;if(W.p===1)if(W.p=0,Y.p=1,Y===this.v)this.v=Y.g();else Y.g();else if(W.i&&W.i.p===1){if(W.p=Y.p,Y.p=0,W.i.p=0,Y===this.v)this.v=Y.g();else Y.g();return}else if(W.h&&W.h.p===1)W.p=1,W.h.p=0,W._();else W.p=1,X=Y}}}S(X){if(this.m===1){this.clear();return}let Y=X;while(Y.i||Y.h){if(Y.h){Y=Y.h;while(Y.i)Y=Y.i}else Y=Y.i;let z=X.u;X.u=Y.u,Y.u=z;let F=X.l;X.l=Y.l,Y.l=F,X=Y}if(this.C.i===Y)this.C.i=Y.o;else if(this.C.h===Y)this.C.h=Y.o;this.P(Y);let W=Y.o;if(Y===W.i)W.i=void 0;else W.h=void 0;if(this.m-=1,this.v.p=0,this.enableIndex)while(W!==this.C)W.M-=1,W=W.o}U(X){let Y=typeof X==="number"?X:void 0,W=typeof X==="function"?X:void 0,z=typeof X>"u"?[]:void 0,F=0,Q=this.v,J=[];while(J.length||Q)if(Q)J.push(Q),Q=Q.i;else{if(Q=J.pop(),F===Y)return Q;z&&z.push(Q),W&&W(Q,F,this),F+=1,Q=Q.h}return z}j(X){while(!0){let Y=X.o;if(Y.p===0)return;let W=Y.o;if(Y===W.i){let z=W.h;if(z&&z.p===1){if(z.p=Y.p=0,W===this.v)return;W.p=1,X=W;continue}else if(X===Y.h){if(X.p=0,X.i)X.i.o=Y;if(X.h)X.h.o=W;if(Y.h=X.i,W.i=X.h,X.i=Y,X.h=W,W===this.v)this.v=X,this.C.o=X;else{let F=W.o;if(F.i===W)F.i=X;else F.h=X}X.o=W.o,Y.o=X,W.o=X,W.p=1}else{if(Y.p=0,W===this.v)this.v=W.g();else W.g();W.p=1;return}}else{let z=W.i;if(z&&z.p===1){if(z.p=Y.p=0,W===this.v)return;W.p=1,X=W;continue}else if(X===Y.i){if(X.p=0,X.i)X.i.o=W;if(X.h)X.h.o=Y;if(W.h=X.i,Y.i=X.h,X.i=W,X.h=Y,W===this.v)this.v=X,this.C.o=X;else{let F=W.o;if(F.i===W)F.i=X;else F.h=X}X.o=W.o,Y.o=X,W.o=X,W.p=1}else{if(Y.p=0,W===this.v)this.v=W._();else W._();W.p=1;return}}if(this.enableIndex)Y.O(),W.O(),X.O();return}}q(X,Y,W){if(this.v===void 0)return this.m+=1,this.v=new this.N(X,Y,0),this.v.o=this.C,this.C.o=this.C.i=this.C.h=this.v,this.m;let z,F=this.C.i,Q=this.A(F.u,X);if(Q===0)return F.l=Y,this.m;else if(Q>0)F.i=new this.N(X,Y),F.i.o=F,z=F.i,this.C.i=z;else{let J=this.C.h,Z=this.A(J.u,X);if(Z===0)return J.l=Y,this.m;else if(Z<0)J.h=new this.N(X,Y),J.h.o=J,z=J.h,this.C.h=z;else{if(W!==void 0){let K=W.T;if(K!==this.C){let H=this.A(K.u,X);if(H===0)return K.l=Y,this.m;else if(H>0){let G=K.I(),q=this.A(G.u,X);if(q===0)return G.l=Y,this.m;else if(q<0)if(z=new this.N(X,Y),G.h===void 0)G.h=z,z.o=G;else K.i=z,z.o=K}}}if(z===void 0){z=this.v;while(!0){let K=this.A(z.u,X);if(K>0){if(z.i===void 0){z.i=new this.N(X,Y),z.i.o=z,z=z.i;break}z=z.i}else if(K<0){if(z.h===void 0){z.h=new this.N(X,Y),z.h.o=z,z=z.h;break}z=z.h}else return z.l=Y,this.m}}}}if(this.enableIndex){let J=z.o;while(J!==this.C)J.M+=1,J=J.o}return this.j(z),this.m+=1,this.m}H(X,Y){while(X){let W=this.A(X.u,Y);if(W<0)X=X.h;else if(W>0)X=X.i;else return X}return X||this.C}clear(){this.m=0,this.v=void 0,this.C.o=void 0,this.C.i=this.C.h=void 0}updateKeyByIterator(X,Y){let W=X.T;if(W===this.C)j7();if(this.m===1)return W.u=Y,!0;let z=W.B().u;if(W===this.C.i){if(this.A(z,Y)>0)return W.u=Y,!0;return!1}let F=W.I().u;if(W===this.C.h){if(this.A(F,Y)<0)return W.u=Y,!0;return!1}if(this.A(F,Y)>=0||this.A(z,Y)<=0)return!1;return W.u=Y,!0}eraseElementByPos(X){if(X<0||X>this.m-1)throw RangeError();let Y=this.U(X);return this.S(Y),this.m}eraseElementByKey(X){if(this.m===0)return!1;let Y=this.H(this.v,X);if(Y===this.C)return!1;return this.S(Y),!0}eraseElementByIterator(X){let Y=X.T;if(Y===this.C)j7();let W=Y.h===void 0;if(X.iteratorType===0){if(W)X.next()}else if(!W||Y.i===void 0)X.next();return this.S(Y),X}getHeight(){if(this.m===0)return 0;function X(Y){if(!Y)return 0;return Math.max(X(Y.i),X(Y.h))+1}return X(this.v)}}class y40 extends P40{constructor(X,Y,W){super(W);if(this.T=X,this.C=Y,this.iteratorType===0)this.pre=function(){if(this.T===this.C.i)j7();return this.T=this.T.I(),this},this.next=function(){if(this.T===this.C)j7();return this.T=this.T.B(),this};else this.pre=function(){if(this.T===this.C.h)j7();return this.T=this.T.B(),this},this.next=function(){if(this.T===this.C)j7();return this.T=this.T.I(),this}}get index(){let X=this.T,Y=this.C.o;if(X===this.C){if(Y)return Y.M-1;return 0}let W=0;if(X.i)W+=X.i.M;while(X!==Y){let z=X.o;if(X===z.h){if(W+=1,z.i)W+=z.i.M}X=z}return W}isAccessible(){return this.T!==this.C}}class k8 extends y40{constructor(X,Y,W,z){super(X,Y,z);this.container=W}get pointer(){if(this.T===this.C)j7();let X=this;return new Proxy([],{get(Y,W){if(W==="0")return X.T.u;else if(W==="1")return X.T.l;return Y[0]=X.T.u,Y[1]=X.T.l,Y[W]},set(Y,W,z){if(W!=="1")throw TypeError("prop must be 1");return X.T.l=z,!0}})}copy(){return new k8(this.T,this.C,this.container,this.iteratorType)}}class k40 extends f40{constructor(X=[],Y,W){super(Y,W);let z=this;X.forEach(function(F){z.setElement(F[0],F[1])})}begin(){return new k8(this.C.i||this.C,this.C,this)}end(){return new k8(this.C,this.C,this)}rBegin(){return new k8(this.C.h||this.C,this.C,this,1)}rEnd(){return new k8(this.C,this.C,this,1)}front(){if(this.m===0)return;let X=this.C.i;return[X.u,X.l]}back(){if(this.m===0)return;let X=this.C.h;return[X.u,X.l]}lowerBound(X){let Y=this.R(this.v,X);return new k8(Y,this.C,this)}upperBound(X){let Y=this.K(this.v,X);return new k8(Y,this.C,this)}reverseLowerBound(X){let Y=this.L(this.v,X);return new k8(Y,this.C,this)}reverseUpperBound(X){let Y=this.k(this.v,X);return new k8(Y,this.C,this)}forEach(X){this.U(function(Y,W,z){X([Y.u,Y.l],W,z)})}setElement(X,Y,W){return this.q(X,Y,W)}getElementByPos(X){if(X<0||X>this.m-1)throw RangeError();let Y=this.U(X);return[Y.u,Y.l]}find(X){let Y=this.H(this.v,X);return new k8(Y,this.C,this)}getElementByKey(X){return this.H(this.v,X).l}union(X){let Y=this;return X.forEach(function(W){Y.setElement(W[0],W[1])}),this.m}*[Symbol.iterator](){let X=this.m,Y=this.U();for(let W=0;W<X;++W){let z=Y[W];yield[z.u,z.l]}}}v40.OrderedMap=k40});var AG=X0((_40)=>{Object.defineProperty(_40,"__esModule",{value:!0});_40.registerAdminService=ns0;_40.addAdminServicesToServer=is0;var h40=[];function ns0(X,Y){h40.push({getServiceDefinition:X,getHandlers:Y})}function is0(X){for(let{getServiceDefinition:Y,getHandlers:W}of h40)X.addService(Y(),W())}});var c40=X0((g40)=>{Object.defineProperty(g40,"__esModule",{value:!0});g40.ClientDuplexStreamImpl=g40.ClientWritableStreamImpl=g40.ClientReadableStreamImpl=g40.ClientUnaryCallImpl=void 0;g40.callErrorFromStatus=ts0;var os0=F1("events"),RU=F1("stream"),FQ=a1();function ts0(X,Y){let W=`${X.code} ${FQ.Status[X.code]}: ${X.details}`,F=`${Error(W).stack}
474
474
  for call at
475
475
  ${Y}`;return Object.assign(Error(W),X,{stack:F})}class x40 extends os0.EventEmitter{constructor(){super()}cancel(){var X;(X=this.call)===null||X===void 0||X.cancelWithStatus(FQ.Status.CANCELLED,"Cancelled on client")}getPeer(){var X,Y;return(Y=(X=this.call)===null||X===void 0?void 0:X.getPeer())!==null&&Y!==void 0?Y:"unknown"}getAuthContext(){var X,Y;return(Y=(X=this.call)===null||X===void 0?void 0:X.getAuthContext())!==null&&Y!==void 0?Y:null}}g40.ClientUnaryCallImpl=x40;class b40 extends RU.Readable{constructor(X){super({objectMode:!0});this.deserialize=X}cancel(){var X;(X=this.call)===null||X===void 0||X.cancelWithStatus(FQ.Status.CANCELLED,"Cancelled on client")}getPeer(){var X,Y;return(Y=(X=this.call)===null||X===void 0?void 0:X.getPeer())!==null&&Y!==void 0?Y:"unknown"}getAuthContext(){var X,Y;return(Y=(X=this.call)===null||X===void 0?void 0:X.getAuthContext())!==null&&Y!==void 0?Y:null}_read(X){var Y;(Y=this.call)===null||Y===void 0||Y.startRead()}}g40.ClientReadableStreamImpl=b40;class u40 extends RU.Writable{constructor(X){super({objectMode:!0});this.serialize=X}cancel(){var X;(X=this.call)===null||X===void 0||X.cancelWithStatus(FQ.Status.CANCELLED,"Cancelled on client")}getPeer(){var X,Y;return(Y=(X=this.call)===null||X===void 0?void 0:X.getPeer())!==null&&Y!==void 0?Y:"unknown"}getAuthContext(){var X,Y;return(Y=(X=this.call)===null||X===void 0?void 0:X.getAuthContext())!==null&&Y!==void 0?Y:null}_write(X,Y,W){var z;let F={callback:W},Q=Number(Y);if(!Number.isNaN(Q))F.flags=Q;(z=this.call)===null||z===void 0||z.sendMessageWithContext(F,X)}_final(X){var Y;(Y=this.call)===null||Y===void 0||Y.halfClose(),X()}}g40.ClientWritableStreamImpl=u40;class m40 extends RU.Duplex{constructor(X,Y){super({objectMode:!0});this.serialize=X,this.deserialize=Y}cancel(){var X;(X=this.call)===null||X===void 0||X.cancelWithStatus(FQ.Status.CANCELLED,"Cancelled on client")}getPeer(){var X,Y;return(Y=(X=this.call)===null||X===void 0?void 0:X.getPeer())!==null&&Y!==void 0?Y:"unknown"}getAuthContext(){var X,Y;return(Y=(X=this.call)===null||X===void 0?void 0:X.getAuthContext())!==null&&Y!==void 0?Y:null}_read(X){var Y;(Y=this.call)===null||Y===void 0||Y.startRead()}_write(X,Y,W){var z;let F={callback:W},Q=Number(Y);if(!Number.isNaN(Q))F.flags=Q;(z=this.call)===null||z===void 0||z.sendMessageWithContext(F,X)}_final(X){var Y;(Y=this.call)===null||Y===void 0||Y.halfClose(),X()}}g40.ClientDuplexStreamImpl=m40});var h7=X0((p40)=>{Object.defineProperty(p40,"__esModule",{value:!0});p40.InterceptingListenerImpl=void 0;p40.statusOrFromValue=Qe0;p40.statusOrFromError=Je0;p40.isInterceptingListener=We0;var Ze0=s6();function Qe0(X){return{ok:!0,value:X}}function Je0(X){var Y;return{ok:!1,error:Object.assign(Object.assign({},X),{metadata:(Y=X.metadata)!==null&&Y!==void 0?Y:new Ze0.Metadata})}}function We0(X){return X.onReceiveMetadata!==void 0&&X.onReceiveMetadata.length===1}class l40{constructor(X,Y){this.listener=X,this.nextListener=Y,this.processingMetadata=!1,this.hasPendingMessage=!1,this.processingMessage=!1,this.pendingStatus=null}processPendingMessage(){if(this.hasPendingMessage)this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1}processPendingStatus(){if(this.pendingStatus)this.nextListener.onReceiveStatus(this.pendingStatus)}onReceiveMetadata(X){this.processingMetadata=!0,this.listener.onReceiveMetadata(X,(Y)=>{this.processingMetadata=!1,this.nextListener.onReceiveMetadata(Y),this.processPendingMessage(),this.processPendingStatus()})}onReceiveMessage(X){this.processingMessage=!0,this.listener.onReceiveMessage(X,(Y)=>{if(this.processingMessage=!1,this.processingMetadata)this.pendingMessage=Y,this.hasPendingMessage=!0;else this.nextListener.onReceiveMessage(Y),this.processPendingStatus()})}onReceiveStatus(X){this.listener.onReceiveStatus(X,(Y)=>{if(this.processingMetadata||this.processingMessage)this.pendingStatus=Y;else this.nextListener.onReceiveStatus(Y)})}}p40.InterceptingListenerImpl=l40});var PU=X0((Y50)=>{Object.defineProperty(Y50,"__esModule",{value:!0});Y50.InterceptingCall=Y50.RequesterBuilder=Y50.ListenerBuilder=Y50.InterceptorConfigurationError=void 0;Y50.getInterceptingCall=Ve0;var ze0=s6(),i40=h7(),a40=a1(),r40=ZG();class qQ extends Error{constructor(X){super(X);this.name="InterceptorConfigurationError",Error.captureStackTrace(this,qQ)}}Y50.InterceptorConfigurationError=qQ;class o40{constructor(){this.metadata=void 0,this.message=void 0,this.status=void 0}withOnReceiveMetadata(X){return this.metadata=X,this}withOnReceiveMessage(X){return this.message=X,this}withOnReceiveStatus(X){return this.status=X,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveStatus:this.status}}}Y50.ListenerBuilder=o40;class t40{constructor(){this.start=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withStart(X){return this.start=X,this}withSendMessage(X){return this.message=X,this}withHalfClose(X){return this.halfClose=X,this}withCancel(X){return this.cancel=X,this}build(){return{start:this.start,sendMessage:this.message,halfClose:this.halfClose,cancel:this.cancel}}}Y50.RequesterBuilder=t40;var MU={onReceiveMetadata:(X,Y)=>{Y(X)},onReceiveMessage:(X,Y)=>{Y(X)},onReceiveStatus:(X,Y)=>{Y(X)}},zQ={start:(X,Y,W)=>{W(X,Y)},sendMessage:(X,Y)=>{Y(X)},halfClose:(X)=>{X()},cancel:(X)=>{X()}};class s40{constructor(X,Y){var W,z,F,Q;if(this.nextCall=X,this.processingMetadata=!1,this.pendingMessageContext=null,this.processingMessage=!1,this.pendingHalfClose=!1,Y)this.requester={start:(W=Y.start)!==null&&W!==void 0?W:zQ.start,sendMessage:(z=Y.sendMessage)!==null&&z!==void 0?z:zQ.sendMessage,halfClose:(F=Y.halfClose)!==null&&F!==void 0?F:zQ.halfClose,cancel:(Q=Y.cancel)!==null&&Q!==void 0?Q:zQ.cancel};else this.requester=zQ}cancelWithStatus(X,Y){this.requester.cancel(()=>{this.nextCall.cancelWithStatus(X,Y)})}getPeer(){return this.nextCall.getPeer()}processPendingMessage(){if(this.pendingMessageContext)this.nextCall.sendMessageWithContext(this.pendingMessageContext,this.pendingMessage),this.pendingMessageContext=null,this.pendingMessage=null}processPendingHalfClose(){if(this.pendingHalfClose)this.nextCall.halfClose()}start(X,Y){var W,z,F,Q,J,Z;let K={onReceiveMetadata:(z=(W=Y===null||Y===void 0?void 0:Y.onReceiveMetadata)===null||W===void 0?void 0:W.bind(Y))!==null&&z!==void 0?z:(H)=>{},onReceiveMessage:(Q=(F=Y===null||Y===void 0?void 0:Y.onReceiveMessage)===null||F===void 0?void 0:F.bind(Y))!==null&&Q!==void 0?Q:(H)=>{},onReceiveStatus:(Z=(J=Y===null||Y===void 0?void 0:Y.onReceiveStatus)===null||J===void 0?void 0:J.bind(Y))!==null&&Z!==void 0?Z:(H)=>{}};this.processingMetadata=!0,this.requester.start(X,K,(H,G)=>{var q,B,$;this.processingMetadata=!1;let R;if((0,i40.isInterceptingListener)(G))R=G;else{let E={onReceiveMetadata:(q=G.onReceiveMetadata)!==null&&q!==void 0?q:MU.onReceiveMetadata,onReceiveMessage:(B=G.onReceiveMessage)!==null&&B!==void 0?B:MU.onReceiveMessage,onReceiveStatus:($=G.onReceiveStatus)!==null&&$!==void 0?$:MU.onReceiveStatus};R=new i40.InterceptingListenerImpl(E,K)}this.nextCall.start(H,R),this.processPendingMessage(),this.processPendingHalfClose()})}sendMessageWithContext(X,Y){this.processingMessage=!0,this.requester.sendMessage(Y,(W)=>{if(this.processingMessage=!1,this.processingMetadata)this.pendingMessageContext=X,this.pendingMessage=Y;else this.nextCall.sendMessageWithContext(X,W),this.processPendingHalfClose()})}sendMessage(X){this.sendMessageWithContext({},X)}startRead(){this.nextCall.startRead()}halfClose(){this.requester.halfClose(()=>{if(this.processingMetadata||this.processingMessage)this.pendingHalfClose=!0;else this.nextCall.halfClose()})}getAuthContext(){return this.nextCall.getAuthContext()}}Y50.InterceptingCall=s40;function qe0(X,Y,W){var z,F;let Q=(z=W.deadline)!==null&&z!==void 0?z:1/0,J=W.host,Z=(F=W.parent)!==null&&F!==void 0?F:null,K=W.propagate_flags,H=W.credentials,G=X.createCall(Y,Q,J,Z,K);if(H)G.setCredentials(H);return G}class LU{constructor(X,Y){this.call=X,this.methodDefinition=Y}cancelWithStatus(X,Y){this.call.cancelWithStatus(X,Y)}getPeer(){return this.call.getPeer()}sendMessageWithContext(X,Y){let W;try{W=this.methodDefinition.requestSerialize(Y)}catch(z){this.call.cancelWithStatus(a40.Status.INTERNAL,`Request message serialization failure: ${(0,r40.getErrorMessage)(z)}`);return}this.call.sendMessageWithContext(X,W)}sendMessage(X){this.sendMessageWithContext({},X)}start(X,Y){let W=null;this.call.start(X,{onReceiveMetadata:(z)=>{var F;(F=Y===null||Y===void 0?void 0:Y.onReceiveMetadata)===null||F===void 0||F.call(Y,z)},onReceiveMessage:(z)=>{var F;let Q;try{Q=this.methodDefinition.responseDeserialize(z)}catch(J){W={code:a40.Status.INTERNAL,details:`Response message parsing error: ${(0,r40.getErrorMessage)(J)}`,metadata:new ze0.Metadata},this.call.cancelWithStatus(W.code,W.details);return}(F=Y===null||Y===void 0?void 0:Y.onReceiveMessage)===null||F===void 0||F.call(Y,Q)},onReceiveStatus:(z)=>{var F,Q;if(W)(F=Y===null||Y===void 0?void 0:Y.onReceiveStatus)===null||F===void 0||F.call(Y,W);else(Q=Y===null||Y===void 0?void 0:Y.onReceiveStatus)===null||Q===void 0||Q.call(Y,z)}})}startRead(){this.call.startRead()}halfClose(){this.call.halfClose()}getAuthContext(){return this.call.getAuthContext()}}class e40 extends LU{constructor(X,Y){super(X,Y)}start(X,Y){var W,z;let F=!1,Q={onReceiveMetadata:(z=(W=Y===null||Y===void 0?void 0:Y.onReceiveMetadata)===null||W===void 0?void 0:W.bind(Y))!==null&&z!==void 0?z:(J)=>{},onReceiveMessage:(J)=>{var Z;F=!0,(Z=Y===null||Y===void 0?void 0:Y.onReceiveMessage)===null||Z===void 0||Z.call(Y,J)},onReceiveStatus:(J)=>{var Z,K;if(!F)(Z=Y===null||Y===void 0?void 0:Y.onReceiveMessage)===null||Z===void 0||Z.call(Y,null);(K=Y===null||Y===void 0?void 0:Y.onReceiveStatus)===null||K===void 0||K.call(Y,J)}};super.start(X,Q),this.call.startRead()}}class X50 extends LU{}function He0(X,Y,W){let z=qe0(X,W.path,Y);if(W.responseStream)return new X50(z,W);else return new e40(z,W)}function Ve0(X,Y,W,z){if(X.clientInterceptors.length>0&&X.clientInterceptorProviders.length>0)throw new qQ("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(X.callInterceptors.length>0&&X.callInterceptorProviders.length>0)throw new qQ("Both interceptors and interceptor_providers were passed as call options. Only one of these is allowed.");let F=[];if(X.callInterceptors.length>0||X.callInterceptorProviders.length>0)F=[].concat(X.callInterceptors,X.callInterceptorProviders.map((Z)=>Z(Y))).filter((Z)=>Z);else F=[].concat(X.clientInterceptors,X.clientInterceptorProviders.map((Z)=>Z(Y))).filter((Z)=>Z);let Q=Object.assign({},W,{method_definition:Y});return F.reduceRight((Z,K)=>{return(H)=>K(H,Z)},(Z)=>He0(z,Z,Y))(Q)}});var SU=X0((J50)=>{Object.defineProperty(J50,"__esModule",{value:!0});J50.Client=void 0;var Z4=c40(),Oe0=fU(),Te0=C9(),C5=a1(),JY=s6(),OG=PU(),v8=Symbol(),WY=Symbol(),GY=Symbol(),u4=Symbol();function wU(X){return typeof X==="function"}function KY(X){var Y;return((Y=X.stack)===null||Y===void 0?void 0:Y.split(`
476
476
  `).slice(1).join(`
477
- `))||"no stack trace available"}class Q50{constructor(X,Y,W={}){var z,F;if(W=Object.assign({},W),this[WY]=(z=W.interceptors)!==null&&z!==void 0?z:[],delete W.interceptors,this[GY]=(F=W.interceptor_providers)!==null&&F!==void 0?F:[],delete W.interceptor_providers,this[WY].length>0&&this[GY].length>0)throw Error("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(this[u4]=W.callInvocationTransformer,delete W.callInvocationTransformer,W.channelOverride)this[v8]=W.channelOverride;else if(W.channelFactoryOverride){let Q=W.channelFactoryOverride;delete W.channelFactoryOverride,this[v8]=Q(X,Y,W)}else this[v8]=new Oe0.ChannelImplementation(X,Y,W)}close(){this[v8].close()}getChannel(){return this[v8]}waitForReady(X,Y){let W=(z)=>{if(z){Y(Error("Failed to connect before the deadline"));return}let F;try{F=this[v8].getConnectivityState(!0)}catch(Q){Y(Error("The channel has been closed"));return}if(F===Te0.ConnectivityState.READY)Y();else try{this[v8].watchConnectivityState(F,X,W)}catch(Q){Y(Error("The channel has been closed"))}};setImmediate(W)}checkOptionalUnaryResponseArguments(X,Y,W){if(wU(X))return{metadata:new JY.Metadata,options:{},callback:X};else if(wU(Y))if(X instanceof JY.Metadata)return{metadata:X,options:{},callback:Y};else return{metadata:new JY.Metadata,options:X,callback:Y};else{if(!(X instanceof JY.Metadata&&Y instanceof Object&&wU(W)))throw Error("Incorrect arguments passed");return{metadata:X,options:Y,callback:W}}}makeUnaryRequest(X,Y,W,z,F,Q,J){var Z,K;let H=this.checkOptionalUnaryResponseArguments(F,Q,J),G={path:X,requestStream:!1,responseStream:!1,requestSerialize:Y,responseDeserialize:W},q={argument:z,metadata:H.metadata,call:new Z4.ClientUnaryCallImpl,channel:this[v8],methodDefinition:G,callOptions:H.options,callback:H.callback};if(this[u4])q=this[u4](q);let B=q.call,$={clientInterceptors:this[WY],clientInterceptorProviders:this[GY],callInterceptors:(Z=q.callOptions.interceptors)!==null&&Z!==void 0?Z:[],callInterceptorProviders:(K=q.callOptions.interceptor_providers)!==null&&K!==void 0?K:[]},R=(0,OG.getInterceptingCall)($,q.methodDefinition,q.callOptions,q.channel);B.call=R;let E=null,U=!1,A=Error();return R.start(q.metadata,{onReceiveMetadata:(T)=>{B.emit("metadata",T)},onReceiveMessage(T){if(E!==null)R.cancelWithStatus(C5.Status.UNIMPLEMENTED,"Too many responses received");E=T},onReceiveStatus(T){if(U)return;if(U=!0,T.code===C5.Status.OK)if(E===null){let I=KY(A);q.callback((0,Z4.callErrorFromStatus)({code:C5.Status.UNIMPLEMENTED,details:"No message received",metadata:T.metadata},I))}else q.callback(null,E);else{let I=KY(A);q.callback((0,Z4.callErrorFromStatus)(T,I))}A=null,B.emit("status",T)}}),R.sendMessage(z),R.halfClose(),B}makeClientStreamRequest(X,Y,W,z,F,Q){var J,Z;let K=this.checkOptionalUnaryResponseArguments(z,F,Q),H={path:X,requestStream:!0,responseStream:!1,requestSerialize:Y,responseDeserialize:W},G={metadata:K.metadata,call:new Z4.ClientWritableStreamImpl(Y),channel:this[v8],methodDefinition:H,callOptions:K.options,callback:K.callback};if(this[u4])G=this[u4](G);let q=G.call,B={clientInterceptors:this[WY],clientInterceptorProviders:this[GY],callInterceptors:(J=G.callOptions.interceptors)!==null&&J!==void 0?J:[],callInterceptorProviders:(Z=G.callOptions.interceptor_providers)!==null&&Z!==void 0?Z:[]},$=(0,OG.getInterceptingCall)(B,G.methodDefinition,G.callOptions,G.channel);q.call=$;let R=null,E=!1,U=Error();return $.start(G.metadata,{onReceiveMetadata:(A)=>{q.emit("metadata",A)},onReceiveMessage(A){if(R!==null)$.cancelWithStatus(C5.Status.UNIMPLEMENTED,"Too many responses received");R=A,$.startRead()},onReceiveStatus(A){if(E)return;if(E=!0,A.code===C5.Status.OK)if(R===null){let T=KY(U);G.callback((0,Z4.callErrorFromStatus)({code:C5.Status.UNIMPLEMENTED,details:"No message received",metadata:A.metadata},T))}else G.callback(null,R);else{let T=KY(U);G.callback((0,Z4.callErrorFromStatus)(A,T))}U=null,q.emit("status",A)}}),q}checkMetadataAndOptions(X,Y){let W,z;if(X instanceof JY.Metadata)if(W=X,Y)z=Y;else z={};else{if(X)z=X;else z={};W=new JY.Metadata}return{metadata:W,options:z}}makeServerStreamRequest(X,Y,W,z,F,Q){var J,Z;let K=this.checkMetadataAndOptions(F,Q),H={path:X,requestStream:!1,responseStream:!0,requestSerialize:Y,responseDeserialize:W},G={argument:z,metadata:K.metadata,call:new Z4.ClientReadableStreamImpl(W),channel:this[v8],methodDefinition:H,callOptions:K.options};if(this[u4])G=this[u4](G);let q=G.call,B={clientInterceptors:this[WY],clientInterceptorProviders:this[GY],callInterceptors:(J=G.callOptions.interceptors)!==null&&J!==void 0?J:[],callInterceptorProviders:(Z=G.callOptions.interceptor_providers)!==null&&Z!==void 0?Z:[]},$=(0,OG.getInterceptingCall)(B,G.methodDefinition,G.callOptions,G.channel);q.call=$;let R=!1,E=Error();return $.start(G.metadata,{onReceiveMetadata(U){q.emit("metadata",U)},onReceiveMessage(U){q.push(U)},onReceiveStatus(U){if(R)return;if(R=!0,q.push(null),U.code!==C5.Status.OK){let A=KY(E);q.emit("error",(0,Z4.callErrorFromStatus)(U,A))}E=null,q.emit("status",U)}}),$.sendMessage(z),$.halfClose(),q}makeBidiStreamRequest(X,Y,W,z,F){var Q,J;let Z=this.checkMetadataAndOptions(z,F),K={path:X,requestStream:!0,responseStream:!0,requestSerialize:Y,responseDeserialize:W},H={metadata:Z.metadata,call:new Z4.ClientDuplexStreamImpl(Y,W),channel:this[v8],methodDefinition:K,callOptions:Z.options};if(this[u4])H=this[u4](H);let G=H.call,q={clientInterceptors:this[WY],clientInterceptorProviders:this[GY],callInterceptors:(Q=H.callOptions.interceptors)!==null&&Q!==void 0?Q:[],callInterceptorProviders:(J=H.callOptions.interceptor_providers)!==null&&J!==void 0?J:[]},B=(0,OG.getInterceptingCall)(q,H.methodDefinition,H.callOptions,H.channel);G.call=B;let $=!1,R=Error();return B.start(H.metadata,{onReceiveMetadata(E){G.emit("metadata",E)},onReceiveMessage(E){G.push(E)},onReceiveStatus(E){if($)return;if($=!0,G.push(null),E.code!==C5.Status.OK){let U=KY(R);G.emit("error",(0,Z4.callErrorFromStatus)(E,U))}R=null,G.emit("status",E)}}),G}}J50.Client=Q50});var TG=X0((K50)=>{Object.defineProperty(K50,"__esModule",{value:!0});K50.makeClientConstructor=G50;K50.loadPackageDefinition=Ee0;var HQ=SU(),Ie0={unary:HQ.Client.prototype.makeUnaryRequest,server_stream:HQ.Client.prototype.makeServerStreamRequest,client_stream:HQ.Client.prototype.makeClientStreamRequest,bidi:HQ.Client.prototype.makeBidiStreamRequest};function yU(X){return["__proto__","prototype","constructor"].includes(X)}function G50(X,Y,W){if(!W)W={};class z extends HQ.Client{}return Object.keys(X).forEach((F)=>{if(yU(F))return;let Q=X[F],J;if(typeof F==="string"&&F.charAt(0)==="$")throw Error("Method names cannot start with $");if(Q.requestStream)if(Q.responseStream)J="bidi";else J="client_stream";else if(Q.responseStream)J="server_stream";else J="unary";let{requestSerialize:Z,responseDeserialize:K}=Q,H=$e0(Ie0[J],Q.path,Z,K);if(z.prototype[F]=H,Object.assign(z.prototype[F],Q),Q.originalName&&!yU(Q.originalName))z.prototype[Q.originalName]=z.prototype[F]}),z.service=X,z.serviceName=Y,z}function $e0(X,Y,W,z){return function(...F){return X.call(this,Y,W,z,...F)}}function De0(X){return"format"in X}function Ee0(X){let Y={};for(let W in X)if(Object.prototype.hasOwnProperty.call(X,W)){let z=X[W],F=W.split(".");if(F.some((Z)=>yU(Z)))continue;let Q=F[F.length-1],J=Y;for(let Z of F.slice(0,-1)){if(!J[Z])J[Z]={};J=J[Z]}if(De0(z))J[Q]=z;else J[Q]=G50(z,Q,{})}return Y}});var k50=X0((fD1,y50)=>{var Me0=1/0,Le0="[object Symbol]",Pe0=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,we0=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,$G="\\ud800-\\udfff",N50="\\u0300-\\u036f\\ufe20-\\ufe23",A50="\\u20d0-\\u20f0",O50="\\u2700-\\u27bf",T50="a-z\\xdf-\\xf6\\xf8-\\xff",Se0="\\xac\\xb1\\xd7\\xf7",fe0="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ye0="\\u2000-\\u206f",ke0=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",I50="A-Z\\xc0-\\xd6\\xd8-\\xde",$50="\\ufe0e\\ufe0f",D50=Se0+fe0+ye0+ke0,vU="['’]",ve0="["+$G+"]",F50="["+D50+"]",IG="["+N50+A50+"]",E50="\\d+",je0="["+O50+"]",C50="["+T50+"]",R50="[^"+$G+D50+E50+O50+T50+I50+"]",kU="\\ud83c[\\udffb-\\udfff]",he0="(?:"+IG+"|"+kU+")",M50="[^"+$G+"]",jU="(?:\\ud83c[\\udde6-\\uddff]){2}",hU="[\\ud800-\\udbff][\\udc00-\\udfff]",FY="["+I50+"]",L50="\\u200d",z50="(?:"+C50+"|"+R50+")",_e0="(?:"+FY+"|"+R50+")",q50="(?:"+vU+"(?:d|ll|m|re|s|t|ve))?",H50="(?:"+vU+"(?:D|LL|M|RE|S|T|VE))?",P50=he0+"?",w50="["+$50+"]?",xe0="(?:"+L50+"(?:"+[M50,jU,hU].join("|")+")"+w50+P50+")*",S50=w50+P50+xe0,be0="(?:"+[je0,jU,hU].join("|")+")"+S50,ue0="(?:"+[M50+IG+"?",IG,jU,hU,ve0].join("|")+")",me0=RegExp(vU,"g"),ge0=RegExp(IG,"g"),de0=RegExp(kU+"(?="+kU+")|"+ue0+S50,"g"),ce0=RegExp([FY+"?"+C50+"+"+q50+"(?="+[F50,FY,"$"].join("|")+")",_e0+"+"+H50+"(?="+[F50,FY+z50,"$"].join("|")+")",FY+"?"+z50+"+"+q50,FY+"+"+H50,E50,be0].join("|"),"g"),le0=RegExp("["+L50+$G+N50+A50+$50+"]"),pe0=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ne0={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"ss"},ie0=typeof global=="object"&&global&&global.Object===Object&&global,ae0=typeof self=="object"&&self&&self.Object===Object&&self,re0=ie0||ae0||Function("return this")();function oe0(X,Y,W,z){var F=-1,Q=X?X.length:0;if(z&&Q)W=X[++F];while(++F<Q)W=Y(W,X[F],F,X);return W}function te0(X){return X.split("")}function se0(X){return X.match(Pe0)||[]}function ee0(X){return function(Y){return X==null?void 0:X[Y]}}var X01=ee0(ne0);function f50(X){return le0.test(X)}function Y01(X){return pe0.test(X)}function Z01(X){return f50(X)?Q01(X):te0(X)}function Q01(X){return X.match(de0)||[]}function J01(X){return X.match(ce0)||[]}var W01=Object.prototype,G01=W01.toString,V50=re0.Symbol,B50=V50?V50.prototype:void 0,U50=B50?B50.toString:void 0;function K01(X,Y,W){var z=-1,F=X.length;if(Y<0)Y=-Y>F?0:F+Y;if(W=W>F?F:W,W<0)W+=F;F=Y>W?0:W-Y>>>0,Y>>>=0;var Q=Array(F);while(++z<F)Q[z]=X[z+Y];return Q}function F01(X){if(typeof X=="string")return X;if(B01(X))return U50?U50.call(X):"";var Y=X+"";return Y=="0"&&1/X==-Me0?"-0":Y}function z01(X,Y,W){var z=X.length;return W=W===void 0?z:W,!Y&&W>=z?X:K01(X,Y,W)}function q01(X){return function(Y){Y=DG(Y);var W=f50(Y)?Z01(Y):void 0,z=W?W[0]:Y.charAt(0),F=W?z01(W,1).join(""):Y.slice(1);return z[X]()+F}}function H01(X){return function(Y){return oe0(T01(A01(Y).replace(me0,"")),X,"")}}function V01(X){return!!X&&typeof X=="object"}function B01(X){return typeof X=="symbol"||V01(X)&&G01.call(X)==Le0}function DG(X){return X==null?"":F01(X)}var U01=H01(function(X,Y,W){return Y=Y.toLowerCase(),X+(W?N01(Y):Y)});function N01(X){return O01(DG(X).toLowerCase())}function A01(X){return X=DG(X),X&&X.replace(we0,X01).replace(ge0,"")}var O01=q01("toUpperCase");function T01(X,Y,W){if(X=DG(X),Y=W?void 0:Y,Y===void 0)return Y01(X)?J01(X):se0(X);return X.match(Y)||[]}y50.exports=U01});var j50=X0((yD1,v50)=>{v50.exports=_U;function _U(X,Y){if(typeof X==="string")Y=X,X=void 0;var W=[];function z(Q){if(typeof Q!=="string"){var J=F();if(_U.verbose)console.log("codegen: "+J);if(J="return "+J,Q){var Z=Object.keys(Q),K=Array(Z.length+1),H=Array(Z.length),G=0;while(G<Z.length)K[G]=Z[G],H[G]=Q[Z[G++]];return K[G]=J,Function.apply(null,K).apply(null,H)}return Function(J)()}var q=Array(arguments.length-1),B=0;while(B<q.length)q[B]=arguments[++B];if(B=0,Q=Q.replace(/%([%dfijs])/g,function(R,E){var U=q[B++];switch(E){case"d":case"f":return String(Number(U));case"i":return String(Math.floor(U));case"j":return JSON.stringify(U);case"s":return String(U)}return"%"}),B!==q.length)throw Error("parameter count mismatch");return W.push(Q),z}function F(Q){return"function "+(Q||Y||"")+"("+(X&&X.join(",")||"")+`){
477
+ `))||"no stack trace available"}class Q50{constructor(X,Y,W={}){var z,F;if(W=Object.assign({},W),this[WY]=(z=W.interceptors)!==null&&z!==void 0?z:[],delete W.interceptors,this[GY]=(F=W.interceptor_providers)!==null&&F!==void 0?F:[],delete W.interceptor_providers,this[WY].length>0&&this[GY].length>0)throw Error("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(this[u4]=W.callInvocationTransformer,delete W.callInvocationTransformer,W.channelOverride)this[v8]=W.channelOverride;else if(W.channelFactoryOverride){let Q=W.channelFactoryOverride;delete W.channelFactoryOverride,this[v8]=Q(X,Y,W)}else this[v8]=new Oe0.ChannelImplementation(X,Y,W)}close(){this[v8].close()}getChannel(){return this[v8]}waitForReady(X,Y){let W=(z)=>{if(z){Y(Error("Failed to connect before the deadline"));return}let F;try{F=this[v8].getConnectivityState(!0)}catch(Q){Y(Error("The channel has been closed"));return}if(F===Te0.ConnectivityState.READY)Y();else try{this[v8].watchConnectivityState(F,X,W)}catch(Q){Y(Error("The channel has been closed"))}};setImmediate(W)}checkOptionalUnaryResponseArguments(X,Y,W){if(wU(X))return{metadata:new JY.Metadata,options:{},callback:X};else if(wU(Y))if(X instanceof JY.Metadata)return{metadata:X,options:{},callback:Y};else return{metadata:new JY.Metadata,options:X,callback:Y};else{if(!(X instanceof JY.Metadata&&Y instanceof Object&&wU(W)))throw Error("Incorrect arguments passed");return{metadata:X,options:Y,callback:W}}}makeUnaryRequest(X,Y,W,z,F,Q,J){var Z,K;let H=this.checkOptionalUnaryResponseArguments(F,Q,J),G={path:X,requestStream:!1,responseStream:!1,requestSerialize:Y,responseDeserialize:W},q={argument:z,metadata:H.metadata,call:new Z4.ClientUnaryCallImpl,channel:this[v8],methodDefinition:G,callOptions:H.options,callback:H.callback};if(this[u4])q=this[u4](q);let B=q.call,$={clientInterceptors:this[WY],clientInterceptorProviders:this[GY],callInterceptors:(Z=q.callOptions.interceptors)!==null&&Z!==void 0?Z:[],callInterceptorProviders:(K=q.callOptions.interceptor_providers)!==null&&K!==void 0?K:[]},R=(0,OG.getInterceptingCall)($,q.methodDefinition,q.callOptions,q.channel);B.call=R;let E=null,U=!1,A=Error();return R.start(q.metadata,{onReceiveMetadata:(T)=>{B.emit("metadata",T)},onReceiveMessage(T){if(E!==null)R.cancelWithStatus(C5.Status.UNIMPLEMENTED,"Too many responses received");E=T},onReceiveStatus(T){if(U)return;if(U=!0,T.code===C5.Status.OK)if(E===null){let I=KY(A);q.callback((0,Z4.callErrorFromStatus)({code:C5.Status.UNIMPLEMENTED,details:"No message received",metadata:T.metadata},I))}else q.callback(null,E);else{let I=KY(A);q.callback((0,Z4.callErrorFromStatus)(T,I))}A=null,B.emit("status",T)}}),R.sendMessage(z),R.halfClose(),B}makeClientStreamRequest(X,Y,W,z,F,Q){var J,Z;let K=this.checkOptionalUnaryResponseArguments(z,F,Q),H={path:X,requestStream:!0,responseStream:!1,requestSerialize:Y,responseDeserialize:W},G={metadata:K.metadata,call:new Z4.ClientWritableStreamImpl(Y),channel:this[v8],methodDefinition:H,callOptions:K.options,callback:K.callback};if(this[u4])G=this[u4](G);let q=G.call,B={clientInterceptors:this[WY],clientInterceptorProviders:this[GY],callInterceptors:(J=G.callOptions.interceptors)!==null&&J!==void 0?J:[],callInterceptorProviders:(Z=G.callOptions.interceptor_providers)!==null&&Z!==void 0?Z:[]},$=(0,OG.getInterceptingCall)(B,G.methodDefinition,G.callOptions,G.channel);q.call=$;let R=null,E=!1,U=Error();return $.start(G.metadata,{onReceiveMetadata:(A)=>{q.emit("metadata",A)},onReceiveMessage(A){if(R!==null)$.cancelWithStatus(C5.Status.UNIMPLEMENTED,"Too many responses received");R=A,$.startRead()},onReceiveStatus(A){if(E)return;if(E=!0,A.code===C5.Status.OK)if(R===null){let T=KY(U);G.callback((0,Z4.callErrorFromStatus)({code:C5.Status.UNIMPLEMENTED,details:"No message received",metadata:A.metadata},T))}else G.callback(null,R);else{let T=KY(U);G.callback((0,Z4.callErrorFromStatus)(A,T))}U=null,q.emit("status",A)}}),q}checkMetadataAndOptions(X,Y){let W,z;if(X instanceof JY.Metadata)if(W=X,Y)z=Y;else z={};else{if(X)z=X;else z={};W=new JY.Metadata}return{metadata:W,options:z}}makeServerStreamRequest(X,Y,W,z,F,Q){var J,Z;let K=this.checkMetadataAndOptions(F,Q),H={path:X,requestStream:!1,responseStream:!0,requestSerialize:Y,responseDeserialize:W},G={argument:z,metadata:K.metadata,call:new Z4.ClientReadableStreamImpl(W),channel:this[v8],methodDefinition:H,callOptions:K.options};if(this[u4])G=this[u4](G);let q=G.call,B={clientInterceptors:this[WY],clientInterceptorProviders:this[GY],callInterceptors:(J=G.callOptions.interceptors)!==null&&J!==void 0?J:[],callInterceptorProviders:(Z=G.callOptions.interceptor_providers)!==null&&Z!==void 0?Z:[]},$=(0,OG.getInterceptingCall)(B,G.methodDefinition,G.callOptions,G.channel);q.call=$;let R=!1,E=Error();return $.start(G.metadata,{onReceiveMetadata(U){q.emit("metadata",U)},onReceiveMessage(U){q.push(U)},onReceiveStatus(U){if(R)return;if(R=!0,q.push(null),U.code!==C5.Status.OK){let A=KY(E);q.emit("error",(0,Z4.callErrorFromStatus)(U,A))}E=null,q.emit("status",U)}}),$.sendMessage(z),$.halfClose(),q}makeBidiStreamRequest(X,Y,W,z,F){var Q,J;let Z=this.checkMetadataAndOptions(z,F),K={path:X,requestStream:!0,responseStream:!0,requestSerialize:Y,responseDeserialize:W},H={metadata:Z.metadata,call:new Z4.ClientDuplexStreamImpl(Y,W),channel:this[v8],methodDefinition:K,callOptions:Z.options};if(this[u4])H=this[u4](H);let G=H.call,q={clientInterceptors:this[WY],clientInterceptorProviders:this[GY],callInterceptors:(Q=H.callOptions.interceptors)!==null&&Q!==void 0?Q:[],callInterceptorProviders:(J=H.callOptions.interceptor_providers)!==null&&J!==void 0?J:[]},B=(0,OG.getInterceptingCall)(q,H.methodDefinition,H.callOptions,H.channel);G.call=B;let $=!1,R=Error();return B.start(H.metadata,{onReceiveMetadata(E){G.emit("metadata",E)},onReceiveMessage(E){G.push(E)},onReceiveStatus(E){if($)return;if($=!0,G.push(null),E.code!==C5.Status.OK){let U=KY(R);G.emit("error",(0,Z4.callErrorFromStatus)(E,U))}R=null,G.emit("status",E)}}),G}}J50.Client=Q50});var TG=X0((K50)=>{Object.defineProperty(K50,"__esModule",{value:!0});K50.makeClientConstructor=G50;K50.loadPackageDefinition=Ee0;var HQ=SU(),Ie0={unary:HQ.Client.prototype.makeUnaryRequest,server_stream:HQ.Client.prototype.makeServerStreamRequest,client_stream:HQ.Client.prototype.makeClientStreamRequest,bidi:HQ.Client.prototype.makeBidiStreamRequest};function yU(X){return["__proto__","prototype","constructor"].includes(X)}function G50(X,Y,W){if(!W)W={};class z extends HQ.Client{}return Object.keys(X).forEach((F)=>{if(yU(F))return;let Q=X[F],J;if(typeof F==="string"&&F.charAt(0)==="$")throw Error("Method names cannot start with $");if(Q.requestStream)if(Q.responseStream)J="bidi";else J="client_stream";else if(Q.responseStream)J="server_stream";else J="unary";let{requestSerialize:Z,responseDeserialize:K}=Q,H=$e0(Ie0[J],Q.path,Z,K);if(z.prototype[F]=H,Object.assign(z.prototype[F],Q),Q.originalName&&!yU(Q.originalName))z.prototype[Q.originalName]=z.prototype[F]}),z.service=X,z.serviceName=Y,z}function $e0(X,Y,W,z){return function(...F){return X.call(this,Y,W,z,...F)}}function De0(X){return"format"in X}function Ee0(X){let Y={};for(let W in X)if(Object.prototype.hasOwnProperty.call(X,W)){let z=X[W],F=W.split(".");if(F.some((Z)=>yU(Z)))continue;let Q=F[F.length-1],J=Y;for(let Z of F.slice(0,-1)){if(!J[Z])J[Z]={};J=J[Z]}if(De0(z))J[Q]=z;else J[Q]=G50(z,Q,{})}return Y}});var k50=X0((jD1,y50)=>{var Me0=1/0,Le0="[object Symbol]",Pe0=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,we0=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,$G="\\ud800-\\udfff",N50="\\u0300-\\u036f\\ufe20-\\ufe23",A50="\\u20d0-\\u20f0",O50="\\u2700-\\u27bf",T50="a-z\\xdf-\\xf6\\xf8-\\xff",Se0="\\xac\\xb1\\xd7\\xf7",fe0="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ye0="\\u2000-\\u206f",ke0=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",I50="A-Z\\xc0-\\xd6\\xd8-\\xde",$50="\\ufe0e\\ufe0f",D50=Se0+fe0+ye0+ke0,vU="['’]",ve0="["+$G+"]",F50="["+D50+"]",IG="["+N50+A50+"]",E50="\\d+",je0="["+O50+"]",C50="["+T50+"]",R50="[^"+$G+D50+E50+O50+T50+I50+"]",kU="\\ud83c[\\udffb-\\udfff]",he0="(?:"+IG+"|"+kU+")",M50="[^"+$G+"]",jU="(?:\\ud83c[\\udde6-\\uddff]){2}",hU="[\\ud800-\\udbff][\\udc00-\\udfff]",FY="["+I50+"]",L50="\\u200d",z50="(?:"+C50+"|"+R50+")",_e0="(?:"+FY+"|"+R50+")",q50="(?:"+vU+"(?:d|ll|m|re|s|t|ve))?",H50="(?:"+vU+"(?:D|LL|M|RE|S|T|VE))?",P50=he0+"?",w50="["+$50+"]?",xe0="(?:"+L50+"(?:"+[M50,jU,hU].join("|")+")"+w50+P50+")*",S50=w50+P50+xe0,be0="(?:"+[je0,jU,hU].join("|")+")"+S50,ue0="(?:"+[M50+IG+"?",IG,jU,hU,ve0].join("|")+")",me0=RegExp(vU,"g"),ge0=RegExp(IG,"g"),de0=RegExp(kU+"(?="+kU+")|"+ue0+S50,"g"),ce0=RegExp([FY+"?"+C50+"+"+q50+"(?="+[F50,FY,"$"].join("|")+")",_e0+"+"+H50+"(?="+[F50,FY+z50,"$"].join("|")+")",FY+"?"+z50+"+"+q50,FY+"+"+H50,E50,be0].join("|"),"g"),le0=RegExp("["+L50+$G+N50+A50+$50+"]"),pe0=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ne0={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"ss"},ie0=typeof global=="object"&&global&&global.Object===Object&&global,ae0=typeof self=="object"&&self&&self.Object===Object&&self,re0=ie0||ae0||Function("return this")();function oe0(X,Y,W,z){var F=-1,Q=X?X.length:0;if(z&&Q)W=X[++F];while(++F<Q)W=Y(W,X[F],F,X);return W}function te0(X){return X.split("")}function se0(X){return X.match(Pe0)||[]}function ee0(X){return function(Y){return X==null?void 0:X[Y]}}var X01=ee0(ne0);function f50(X){return le0.test(X)}function Y01(X){return pe0.test(X)}function Z01(X){return f50(X)?Q01(X):te0(X)}function Q01(X){return X.match(de0)||[]}function J01(X){return X.match(ce0)||[]}var W01=Object.prototype,G01=W01.toString,V50=re0.Symbol,B50=V50?V50.prototype:void 0,U50=B50?B50.toString:void 0;function K01(X,Y,W){var z=-1,F=X.length;if(Y<0)Y=-Y>F?0:F+Y;if(W=W>F?F:W,W<0)W+=F;F=Y>W?0:W-Y>>>0,Y>>>=0;var Q=Array(F);while(++z<F)Q[z]=X[z+Y];return Q}function F01(X){if(typeof X=="string")return X;if(B01(X))return U50?U50.call(X):"";var Y=X+"";return Y=="0"&&1/X==-Me0?"-0":Y}function z01(X,Y,W){var z=X.length;return W=W===void 0?z:W,!Y&&W>=z?X:K01(X,Y,W)}function q01(X){return function(Y){Y=DG(Y);var W=f50(Y)?Z01(Y):void 0,z=W?W[0]:Y.charAt(0),F=W?z01(W,1).join(""):Y.slice(1);return z[X]()+F}}function H01(X){return function(Y){return oe0(T01(A01(Y).replace(me0,"")),X,"")}}function V01(X){return!!X&&typeof X=="object"}function B01(X){return typeof X=="symbol"||V01(X)&&G01.call(X)==Le0}function DG(X){return X==null?"":F01(X)}var U01=H01(function(X,Y,W){return Y=Y.toLowerCase(),X+(W?N01(Y):Y)});function N01(X){return O01(DG(X).toLowerCase())}function A01(X){return X=DG(X),X&&X.replace(we0,X01).replace(ge0,"")}var O01=q01("toUpperCase");function T01(X,Y,W){if(X=DG(X),Y=W?void 0:Y,Y===void 0)return Y01(X)?J01(X):se0(X);return X.match(Y)||[]}y50.exports=U01});var j50=X0((hD1,v50)=>{v50.exports=_U;function _U(X,Y){if(typeof X==="string")Y=X,X=void 0;var W=[];function z(Q){if(typeof Q!=="string"){var J=F();if(_U.verbose)console.log("codegen: "+J);if(J="return "+J,Q){var Z=Object.keys(Q),K=Array(Z.length+1),H=Array(Z.length),G=0;while(G<Z.length)K[G]=Z[G],H[G]=Q[Z[G++]];return K[G]=J,Function.apply(null,K).apply(null,H)}return Function(J)()}var q=Array(arguments.length-1),B=0;while(B<q.length)q[B]=arguments[++B];if(B=0,Q=Q.replace(/%([%dfijs])/g,function(R,E){var U=q[B++];switch(E){case"d":case"f":return String(Number(U));case"i":return String(Math.floor(U));case"j":return JSON.stringify(U);case"s":return String(U)}return"%"}),B!==q.length)throw Error("parameter count mismatch");return W.push(Q),z}function F(Q){return"function "+(Q||Y||"")+"("+(X&&X.join(",")||"")+`){
478
478
  `+W.join(`
479
479
  `)+`
480
- }`}return z.toString=F,z}_U.verbose=!1});var _50=X0((kD1,h50)=>{h50.exports=VQ;var I01=vq(),$01=hq(),xU=$01("fs");function VQ(X,Y,W){if(typeof Y==="function")W=Y,Y={};else if(!Y)Y={};if(!W)return I01(VQ,this,X,Y);if(!Y.xhr&&xU&&xU.readFile)return xU.readFile(X,function(F,Q){return F&&typeof XMLHttpRequest<"u"?VQ.xhr(X,Y,W):F?W(F):W(null,Y.binary?Q:Q.toString("utf8"))});return VQ.xhr(X,Y,W)}VQ.xhr=function(Y,W,z){var F=new XMLHttpRequest;if(F.onreadystatechange=function(){if(F.readyState!==4)return;if(F.status!==0&&F.status!==200)return z(Error("status "+F.status));if(W.binary){var J=F.response;if(!J){J=[];for(var Z=0;Z<F.responseText.length;++Z)J.push(F.responseText.charCodeAt(Z)&255)}return z(null,typeof Uint8Array<"u"?new Uint8Array(J):J)}return z(null,F.responseText)},W.binary){if("overrideMimeType"in F)F.overrideMimeType("text/plain; charset=x-user-defined");F.responseType="arraybuffer"}F.open("GET",Y),F.send()}});var u50=X0((b50)=>{var uU=b50,x50=uU.isAbsolute=function(Y){return/^(?:\/|\w+:)/.test(Y)},bU=uU.normalize=function(Y){Y=Y.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var W=Y.split("/"),z=x50(Y),F="";if(z)F=W.shift()+"/";for(var Q=0;Q<W.length;)if(W[Q]==="..")if(Q>0&&W[Q-1]!=="..")W.splice(--Q,2);else if(z)W.splice(Q,1);else++Q;else if(W[Q]===".")W.splice(Q,1);else++Q;return F+W.join("/")};uU.resolve=function(Y,W,z){if(!z)W=bU(W);if(x50(W))return W;if(!z)Y=bU(Y);return(Y=Y.replace(/(?:\/|^)[^/]+$/,"")).length?bU(Y+"/"+W):W}});var qY=X0((jD1,d50)=>{d50.exports=X6;var EG=M5();((X6.prototype=Object.create(EG.prototype)).constructor=X6).className="Namespace";var mU=R5(),CG=e6(),D01=b7(),_7,zY,x7;X6.fromJSON=function(Y,W){return new X6(Y,W.options).addJSON(W.nested)};function m50(X,Y){if(!(X&&X.length))return;var W={};for(var z=0;z<X.length;++z)W[X[z].name]=X[z].toJSON(Y);return W}X6.arrayToJSON=m50;X6.isReservedId=function(Y,W){if(Y){for(var z=0;z<Y.length;++z)if(typeof Y[z]!=="string"&&Y[z][0]<=W&&Y[z][1]>W)return!0}return!1};X6.isReservedName=function(Y,W){if(Y){for(var z=0;z<Y.length;++z)if(Y[z]===W)return!0}return!1};function X6(X,Y){EG.call(this,X,Y),this.nested=void 0,this._nestedArray=null,this._lookupCache={},this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0}function g50(X){X._nestedArray=null,X._lookupCache={};var Y=X;while(Y=Y.parent)Y._lookupCache={};return X}Object.defineProperty(X6.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=CG.toArray(this.nested))}});X6.prototype.toJSON=function(Y){return CG.toObject(["options",this.options,"nested",m50(this.nestedArray,Y)])};X6.prototype.addJSON=function(Y){var W=this;if(Y)for(var z=Object.keys(Y),F=0,Q;F<z.length;++F)Q=Y[z[F]],W.add((Q.fields!==void 0?_7.fromJSON:Q.values!==void 0?x7.fromJSON:Q.methods!==void 0?zY.fromJSON:Q.id!==void 0?mU.fromJSON:X6.fromJSON)(z[F],Q));return this};X6.prototype.get=function(Y){return this.nested&&this.nested[Y]||null};X6.prototype.getEnum=function(Y){if(this.nested&&this.nested[Y]instanceof x7)return this.nested[Y].values;throw Error("no such enum: "+Y)};X6.prototype.add=function(Y){if(!(Y instanceof mU&&Y.extend!==void 0||Y instanceof _7||Y instanceof D01||Y instanceof x7||Y instanceof zY||Y instanceof X6))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var W=this.get(Y.name);if(W)if(W instanceof X6&&Y instanceof X6&&!(W instanceof _7||W instanceof zY)){var z=W.nestedArray;for(var F=0;F<z.length;++F)Y.add(z[F]);if(this.remove(W),!this.nested)this.nested={};Y.setOptions(W.options,!0)}else throw Error("duplicate name '"+Y.name+"' in "+this)}if(this.nested[Y.name]=Y,!(this instanceof _7||this instanceof zY||this instanceof x7||this instanceof mU)){if(!Y._edition)Y._edition=Y._defaultEdition}this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0;var Q=this;while(Q=Q.parent)Q._needsRecursiveFeatureResolution=!0,Q._needsRecursiveResolve=!0;return Y.onAdd(this),g50(this)};X6.prototype.remove=function(Y){if(!(Y instanceof EG))throw TypeError("object must be a ReflectionObject");if(Y.parent!==this)throw Error(Y+" is not a member of "+this);if(delete this.nested[Y.name],!Object.keys(this.nested).length)this.nested=void 0;return Y.onRemove(this),g50(this)};X6.prototype.define=function(Y,W){if(CG.isString(Y))Y=Y.split(".");else if(!Array.isArray(Y))throw TypeError("illegal path");if(Y&&Y.length&&Y[0]==="")throw Error("path must be relative");var z=this;while(Y.length>0){var F=Y.shift();if(z.nested&&z.nested[F]){if(z=z.nested[F],!(z instanceof X6))throw Error("path conflicts with non-namespace objects")}else z.add(z=new X6(F))}if(W)z.addJSON(W);return z};X6.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;this._resolveFeaturesRecursive(this._edition);var Y=this.nestedArray,W=0;this.resolve();while(W<Y.length)if(Y[W]instanceof X6)Y[W++].resolveAll();else Y[W++].resolve();return this._needsRecursiveResolve=!1,this};X6.prototype._resolveFeaturesRecursive=function(Y){if(!this._needsRecursiveFeatureResolution)return this;return this._needsRecursiveFeatureResolution=!1,Y=this._edition||Y,EG.prototype._resolveFeaturesRecursive.call(this,Y),this.nestedArray.forEach((W)=>{W._resolveFeaturesRecursive(Y)}),this};X6.prototype.lookup=function(Y,W,z){if(typeof W==="boolean")z=W,W=void 0;else if(W&&!Array.isArray(W))W=[W];if(CG.isString(Y)&&Y.length){if(Y===".")return this.root;Y=Y.split(".")}else if(!Y.length)return this;var F=Y.join(".");if(Y[0]==="")return this.root.lookup(Y.slice(1),W);var Q=this.root._fullyQualifiedObjects&&this.root._fullyQualifiedObjects["."+F];if(Q&&(!W||W.indexOf(Q.constructor)>-1))return Q;if(Q=this._lookupImpl(Y,F),Q&&(!W||W.indexOf(Q.constructor)>-1))return Q;if(z)return null;var J=this;while(J.parent){if(Q=J.parent._lookupImpl(Y,F),Q&&(!W||W.indexOf(Q.constructor)>-1))return Q;J=J.parent}return null};X6.prototype._lookupImpl=function(Y,W){if(Object.prototype.hasOwnProperty.call(this._lookupCache,W))return this._lookupCache[W];var z=this.get(Y[0]),F=null;if(z){if(Y.length===1)F=z;else if(z instanceof X6)Y=Y.slice(1),F=z._lookupImpl(Y,Y.join("."))}else for(var Q=0;Q<this.nestedArray.length;++Q)if(this._nestedArray[Q]instanceof X6&&(z=this._nestedArray[Q]._lookupImpl(Y,W)))F=z;return this._lookupCache[W]=F,F};X6.prototype.lookupType=function(Y){var W=this.lookup(Y,[_7]);if(!W)throw Error("no such type: "+Y);return W};X6.prototype.lookupEnum=function(Y){var W=this.lookup(Y,[x7]);if(!W)throw Error("no such Enum '"+Y+"' in "+this);return W};X6.prototype.lookupTypeOrEnum=function(Y){var W=this.lookup(Y,[_7,x7]);if(!W)throw Error("no such Type or Enum '"+Y+"' in "+this);return W};X6.prototype.lookupService=function(Y){var W=this.lookup(Y,[zY]);if(!W)throw Error("no such Service '"+Y+"' in "+this);return W};X6._configure=function(X,Y,W){_7=X,zY=Y,x7=W}});var RG=X0((hD1,c50)=>{c50.exports=m4;var gU=R5();((m4.prototype=Object.create(gU.prototype)).constructor=m4).className="MapField";var E01=u7(),BQ=e6();function m4(X,Y,W,z,F,Q){if(gU.call(this,X,Y,z,void 0,void 0,F,Q),!BQ.isString(W))throw TypeError("keyType must be a string");this.keyType=W,this.resolvedKeyType=null,this.map=!0}m4.fromJSON=function(Y,W){return new m4(Y,W.id,W.keyType,W.type,W.options,W.comment)};m4.prototype.toJSON=function(Y){var W=Y?Boolean(Y.keepComments):!1;return BQ.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",W?this.comment:void 0])};m4.prototype.resolve=function(){if(this.resolved)return this;if(E01.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return gU.prototype.resolve.call(this)};m4.d=function(Y,W,z){if(typeof z==="function")z=BQ.decorateType(z).name;else if(z&&typeof z==="object")z=BQ.decorateEnum(z).name;return function(Q,J){BQ.decorateType(Q.constructor).add(new m4(J,Y,W,z))}}});var MG=X0((_D1,l50)=>{l50.exports=m7;var dU=M5();((m7.prototype=Object.create(dU.prototype)).constructor=m7).className="Method";var HY=e6();function m7(X,Y,W,z,F,Q,J,Z,K){if(HY.isObject(F))J=F,F=Q=void 0;else if(HY.isObject(Q))J=Q,Q=void 0;if(!(Y===void 0||HY.isString(Y)))throw TypeError("type must be a string");if(!HY.isString(W))throw TypeError("requestType must be a string");if(!HY.isString(z))throw TypeError("responseType must be a string");dU.call(this,X,J),this.type=Y||"rpc",this.requestType=W,this.requestStream=F?!0:void 0,this.responseType=z,this.responseStream=Q?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=Z,this.parsedOptions=K}m7.fromJSON=function(Y,W){return new m7(Y,W.type,W.requestType,W.responseType,W.requestStream,W.responseStream,W.options,W.comment,W.parsedOptions)};m7.prototype.toJSON=function(Y){var W=Y?Boolean(Y.keepComments):!1;return HY.toObject(["type",this.type!=="rpc"&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",W?this.comment:void 0,"parsedOptions",this.parsedOptions])};m7.prototype.resolve=function(){if(this.resolved)return this;return this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),dU.prototype.resolve.call(this)}});var LG=X0((xD1,n50)=>{n50.exports=d9;var g4=qY();((d9.prototype=Object.create(g4.prototype)).constructor=d9).className="Service";var cU=MG(),UQ=e6(),C01=iq();function d9(X,Y){g4.call(this,X,Y),this.methods={},this._methodsArray=null}d9.fromJSON=function(Y,W){var z=new d9(Y,W.options);if(W.methods)for(var F=Object.keys(W.methods),Q=0;Q<F.length;++Q)z.add(cU.fromJSON(F[Q],W.methods[F[Q]]));if(W.nested)z.addJSON(W.nested);if(W.edition)z._edition=W.edition;return z.comment=W.comment,z._defaultEdition="proto3",z};d9.prototype.toJSON=function(Y){var W=g4.prototype.toJSON.call(this,Y),z=Y?Boolean(Y.keepComments):!1;return UQ.toObject(["edition",this._editionToJSON(),"options",W&&W.options||void 0,"methods",g4.arrayToJSON(this.methodsArray,Y)||{},"nested",W&&W.nested||void 0,"comment",z?this.comment:void 0])};Object.defineProperty(d9.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=UQ.toArray(this.methods))}});function p50(X){return X._methodsArray=null,X}d9.prototype.get=function(Y){return this.methods[Y]||g4.prototype.get.call(this,Y)};d9.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;g4.prototype.resolve.call(this);var Y=this.methodsArray;for(var W=0;W<Y.length;++W)Y[W].resolve();return this};d9.prototype._resolveFeaturesRecursive=function(Y){if(!this._needsRecursiveFeatureResolution)return this;return Y=this._edition||Y,g4.prototype._resolveFeaturesRecursive.call(this,Y),this.methodsArray.forEach((W)=>{W._resolveFeaturesRecursive(Y)}),this};d9.prototype.add=function(Y){if(this.get(Y.name))throw Error("duplicate name '"+Y.name+"' in "+this);if(Y instanceof cU)return this.methods[Y.name]=Y,Y.parent=this,p50(this);return g4.prototype.add.call(this,Y)};d9.prototype.remove=function(Y){if(Y instanceof cU){if(this.methods[Y.name]!==Y)throw Error(Y+" is not a member of "+this);return delete this.methods[Y.name],Y.parent=null,p50(this)}return g4.prototype.remove.call(this,Y)};d9.prototype.create=function(Y,W,z){var F=new C01.Service(Y,W,z);for(var Q=0,J;Q<this.methodsArray.length;++Q){var Z=UQ.lcFirst((J=this._methodsArray[Q]).resolve().name).replace(/[^$\w_]/g,"");F[Z]=UQ.codegen(["r","c"],UQ.isReserved(Z)?Z+"_":Z)("return this.rpcCall(m,q,s,r,c)")({m:J,q:J.resolvedRequestType.ctor,s:J.resolvedResponseType.ctor})}return F}});var PG=X0((bD1,i50)=>{i50.exports=Q4;var R01=a8();function Q4(X){if(X)for(var Y=Object.keys(X),W=0;W<Y.length;++W)this[Y[W]]=X[Y[W]]}Q4.create=function(Y){return this.$type.create(Y)};Q4.encode=function(Y,W){return this.$type.encode(Y,W)};Q4.encodeDelimited=function(Y,W){return this.$type.encodeDelimited(Y,W)};Q4.decode=function(Y){return this.$type.decode(Y)};Q4.decodeDelimited=function(Y){return this.$type.decodeDelimited(Y)};Q4.verify=function(Y){return this.$type.verify(Y)};Q4.fromObject=function(Y){return this.$type.fromObject(Y)};Q4.toObject=function(Y,W){return this.$type.toObject(Y,W)};Q4.prototype.toJSON=function(){return this.$type.toObject(this,R01.toJSONOptions)}});var lU=X0((uD1,r50)=>{r50.exports=P01;var M01=j8(),d4=u7(),a50=e6();function L01(X){return"missing required '"+X.name+"'"}function P01(X){var Y=a50.codegen(["r","l","e"],X.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(X.fieldsArray.filter(function(Z){return Z.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),W=0;for(;W<X.fieldsArray.length;++W){var z=X._fieldsArray[W].resolve(),F=z.resolvedType instanceof M01?"int32":z.type,Q="m"+a50.safeProp(z.name);if(Y("case %i: {",z.id),z.map){if(Y("if(%s===util.emptyObject)",Q)("%s={}",Q)("var c2 = r.uint32()+r.pos"),d4.defaults[z.keyType]!==void 0)Y("k=%j",d4.defaults[z.keyType]);else Y("k=null");if(d4.defaults[F]!==void 0)Y("value=%j",d4.defaults[F]);else Y("value=null");if(Y("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",z.keyType)("case 2:"),d4.basic[F]===void 0)Y("value=types[%i].decode(r,r.uint32())",W);else Y("value=r.%s()",F);if(Y("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),d4.long[z.keyType]!==void 0)Y('%s[typeof k==="object"?util.longToHash(k):k]=value',Q);else Y("%s[k]=value",Q)}else if(z.repeated){if(Y("if(!(%s&&%s.length))",Q,Q)("%s=[]",Q),d4.packed[F]!==void 0)Y("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",Q,F)("}else");if(d4.basic[F]===void 0)Y(z.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4)))":"%s.push(types[%i].decode(r,r.uint32()))",Q,W);else Y("%s.push(r.%s())",Q,F)}else if(d4.basic[F]===void 0)Y(z.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4))":"%s=types[%i].decode(r,r.uint32())",Q,W);else Y("%s=r.%s()",Q,F);Y("break")("}")}Y("default:")("r.skipType(t&7)")("break")("}")("}");for(W=0;W<X._fieldsArray.length;++W){var J=X._fieldsArray[W];if(J.required)Y("if(!m.hasOwnProperty(%j))",J.name)("throw util.ProtocolError(%j,{instance:m})",L01(J))}return Y("return m")}});var iU=X0((mD1,o50)=>{o50.exports=f01;var w01=j8(),pU=e6();function H8(X,Y){return X.name+": "+Y+(X.repeated&&Y!=="array"?"[]":X.map&&Y!=="object"?"{k:"+X.keyType+"}":"")+" expected"}function nU(X,Y,W,z){if(Y.resolvedType)if(Y.resolvedType instanceof w01){X("switch(%s){",z)("default:")("return%j",H8(Y,"enum value"));for(var F=Object.keys(Y.resolvedType.values),Q=0;Q<F.length;++Q)X("case %i:",Y.resolvedType.values[F[Q]]);X("break")("}")}else X("{")("var e=types[%i].verify(%s);",W,z)("if(e)")("return%j+e",Y.name+".")("}");else switch(Y.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":X("if(!util.isInteger(%s))",z)("return%j",H8(Y,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":X("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",z,z,z,z)("return%j",H8(Y,"integer|Long"));break;case"float":case"double":X('if(typeof %s!=="number")',z)("return%j",H8(Y,"number"));break;case"bool":X('if(typeof %s!=="boolean")',z)("return%j",H8(Y,"boolean"));break;case"string":X("if(!util.isString(%s))",z)("return%j",H8(Y,"string"));break;case"bytes":X('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',z,z,z)("return%j",H8(Y,"buffer"));break}return X}function S01(X,Y,W){switch(Y.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":X("if(!util.key32Re.test(%s))",W)("return%j",H8(Y,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":X("if(!util.key64Re.test(%s))",W)("return%j",H8(Y,"integer|Long key"));break;case"bool":X("if(!util.key2Re.test(%s))",W)("return%j",H8(Y,"boolean key"));break}return X}function f01(X){var Y=pU.codegen(["m"],X.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),W=X.oneofsArray,z={};if(W.length)Y("var p={}");for(var F=0;F<X.fieldsArray.length;++F){var Q=X._fieldsArray[F].resolve(),J="m"+pU.safeProp(Q.name);if(Q.optional)Y("if(%s!=null&&m.hasOwnProperty(%j)){",J,Q.name);if(Q.map)Y("if(!util.isObject(%s))",J)("return%j",H8(Q,"object"))("var k=Object.keys(%s)",J)("for(var i=0;i<k.length;++i){"),S01(Y,Q,"k[i]"),nU(Y,Q,F,J+"[k[i]]")("}");else if(Q.repeated)Y("if(!Array.isArray(%s))",J)("return%j",H8(Q,"array"))("for(var i=0;i<%s.length;++i){",J),nU(Y,Q,F,J+"[i]")("}");else{if(Q.partOf){var Z=pU.safeProp(Q.partOf.name);if(z[Q.partOf.name]===1)Y("if(p%s===1)",Z)("return%j",Q.partOf.name+": multiple values");z[Q.partOf.name]=1,Y("p%s=1",Z)}nU(Y,Q,F,J)}if(Q.optional)Y("}")}return Y("return null")}});var oU=X0((s50)=>{var t50=s50,NQ=j8(),J4=e6();function aU(X,Y,W,z){var F=!1;if(Y.resolvedType)if(Y.resolvedType instanceof NQ){X("switch(d%s){",z);for(var Q=Y.resolvedType.values,J=Object.keys(Q),Z=0;Z<J.length;++Z){if(Q[J[Z]]===Y.typeDefault&&!F){if(X("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',z,z,z),!Y.repeated)X("break");F=!0}X("case%j:",J[Z])("case %i:",Q[J[Z]])("m%s=%j",z,Q[J[Z]])("break")}X("}")}else X('if(typeof d%s!=="object")',z)("throw TypeError(%j)",Y.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",z,W,z);else{var K=!1;switch(Y.type){case"double":case"float":X("m%s=Number(d%s)",z,z);break;case"uint32":case"fixed32":X("m%s=d%s>>>0",z,z);break;case"int32":case"sint32":case"sfixed32":X("m%s=d%s|0",z,z);break;case"uint64":K=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":X("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",z,z,K)('else if(typeof d%s==="string")',z)("m%s=parseInt(d%s,10)",z,z)('else if(typeof d%s==="number")',z)("m%s=d%s",z,z)('else if(typeof d%s==="object")',z)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",z,z,z,K?"true":"");break;case"bytes":X('if(typeof d%s==="string")',z)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",z,z,z)("else if(d%s.length >= 0)",z)("m%s=d%s",z,z);break;case"string":X("m%s=String(d%s)",z,z);break;case"bool":X("m%s=Boolean(d%s)",z,z);break}}return X}t50.fromObject=function(Y){var W=Y.fieldsArray,z=J4.codegen(["d"],Y.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!W.length)return z("return new this.ctor");z("var m=new this.ctor");for(var F=0;F<W.length;++F){var Q=W[F].resolve(),J=J4.safeProp(Q.name);if(Q.map)z("if(d%s){",J)('if(typeof d%s!=="object")',J)("throw TypeError(%j)",Q.fullName+": object expected")("m%s={}",J)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",J),aU(z,Q,F,J+"[ks[i]]")("}")("}");else if(Q.repeated)z("if(d%s){",J)("if(!Array.isArray(d%s))",J)("throw TypeError(%j)",Q.fullName+": array expected")("m%s=[]",J)("for(var i=0;i<d%s.length;++i){",J),aU(z,Q,F,J+"[i]")("}")("}");else{if(!(Q.resolvedType instanceof NQ))z("if(d%s!=null){",J);if(aU(z,Q,F,J),!(Q.resolvedType instanceof NQ))z("}")}}return z("return m")};function rU(X,Y,W,z){if(Y.resolvedType)if(Y.resolvedType instanceof NQ)X("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",z,W,z,z,W,z,z);else X("d%s=types[%i].toObject(m%s,o)",z,W,z);else{var F=!1;switch(Y.type){case"double":case"float":X("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",z,z,z,z);break;case"uint64":F=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":X('if(typeof m%s==="number")',z)("d%s=o.longs===String?String(m%s):m%s",z,z,z)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",z,z,z,z,F?"true":"",z);break;case"bytes":X("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",z,z,z,z,z);break;default:X("d%s=m%s",z,z);break}}return X}t50.toObject=function(Y){var W=Y.fieldsArray.slice().sort(J4.compareFieldsById);if(!W.length)return J4.codegen()("return {}");var z=J4.codegen(["m","o"],Y.name+"$toObject")("if(!o)")("o={}")("var d={}"),F=[],Q=[],J=[],Z=0;for(;Z<W.length;++Z)if(!W[Z].partOf)(W[Z].resolve().repeated?F:W[Z].map?Q:J).push(W[Z]);if(F.length){z("if(o.arrays||o.defaults){");for(Z=0;Z<F.length;++Z)z("d%s=[]",J4.safeProp(F[Z].name));z("}")}if(Q.length){z("if(o.objects||o.defaults){");for(Z=0;Z<Q.length;++Z)z("d%s={}",J4.safeProp(Q[Z].name));z("}")}if(J.length){z("if(o.defaults){");for(Z=0;Z<J.length;++Z){var K=J[Z],H=J4.safeProp(K.name);if(K.resolvedType instanceof NQ)z("d%s=o.enums===String?%j:%j",H,K.resolvedType.valuesById[K.typeDefault],K.typeDefault);else if(K.long)z("if(util.Long){")("var n=new util.Long(%i,%i,%j)",K.typeDefault.low,K.typeDefault.high,K.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",H)("}else")("d%s=o.longs===String?%j:%i",H,K.typeDefault.toString(),K.typeDefault.toNumber());else if(K.bytes){var G="["+Array.prototype.slice.call(K.typeDefault).join(",")+"]";z("if(o.bytes===String)d%s=%j",H,String.fromCharCode.apply(String,K.typeDefault))("else{")("d%s=%s",H,G)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",H,H)("}")}else z("d%s=%j",H,K.typeDefault)}z("}")}var q=!1;for(Z=0;Z<W.length;++Z){var K=W[Z],B=Y._fieldsArray.indexOf(K),H=J4.safeProp(K.name);if(K.map){if(!q)q=!0,z("var ks2");z("if(m%s&&(ks2=Object.keys(m%s)).length){",H,H)("d%s={}",H)("for(var j=0;j<ks2.length;++j){"),rU(z,K,B,H+"[ks2[j]]")("}")}else if(K.repeated)z("if(m%s&&m%s.length){",H,H)("d%s=[]",H)("for(var j=0;j<m%s.length;++j){",H),rU(z,K,B,H+"[j]")("}");else if(z("if(m%s!=null&&m.hasOwnProperty(%j)){",H,K.name),rU(z,K,B,H),K.partOf)z("if(o.oneofs)")("d%s=%j",J4.safeProp(K.partOf.name),K.name);z("}")}return z("return d")}});var tU=X0((e50)=>{var y01=e50,k01=PG();y01[".google.protobuf.Any"]={fromObject:function(X){if(X&&X["@type"]){var Y=X["@type"].substring(X["@type"].lastIndexOf("/")+1),W=this.lookup(Y);if(W){var z=X["@type"].charAt(0)==="."?X["@type"].slice(1):X["@type"];if(z.indexOf("/")===-1)z="/"+z;return this.create({type_url:z,value:W.encode(W.fromObject(X)).finish()})}}return this.fromObject(X)},toObject:function(X,Y){var W="type.googleapis.com/",z="",F="";if(Y&&Y.json&&X.type_url&&X.value){F=X.type_url.substring(X.type_url.lastIndexOf("/")+1),z=X.type_url.substring(0,X.type_url.lastIndexOf("/")+1);var Q=this.lookup(F);if(Q)X=Q.decode(X.value)}if(!(X instanceof this.ctor)&&X instanceof k01){var J=X.$type.toObject(X,Y),Z=X.$type.fullName[0]==="."?X.$type.fullName.slice(1):X.$type.fullName;if(z==="")z=W;return F=z+Z,J["@type"]=F,J}return this.toObject(X,Y)}}});var fG=X0((cD1,Y70)=>{Y70.exports=O6;var V8=qY();((O6.prototype=Object.create(V8.prototype)).constructor=O6).className="Type";var v01=j8(),XN=b7(),wG=R5(),j01=RG(),h01=LG(),sU=PG(),eU=OW(),_01=NW(),A9=e6(),x01=YN(),b01=lU(),u01=iU(),X70=oU(),m01=tU();function O6(X,Y){V8.call(this,X,Y),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}Object.defineProperties(O6.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var X=Object.keys(this.fields),Y=0;Y<X.length;++Y){var W=this.fields[X[Y]],z=W.id;if(this._fieldsById[z])throw Error("duplicate id "+z+" in "+this);this._fieldsById[z]=W}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=A9.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=A9.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=O6.generateConstructor(this)())},set:function(X){var Y=X.prototype;if(!(Y instanceof sU))(X.prototype=new sU).constructor=X,A9.merge(X.prototype,Y);X.$type=X.prototype.$type=this,A9.merge(X,sU,!0),this._ctor=X;var W=0;for(;W<this.fieldsArray.length;++W)this._fieldsArray[W].resolve();var z={};for(W=0;W<this.oneofsArray.length;++W)z[this._oneofsArray[W].resolve().name]={get:A9.oneOfGetter(this._oneofsArray[W].oneof),set:A9.oneOfSetter(this._oneofsArray[W].oneof)};if(W)Object.defineProperties(X.prototype,z)}}});O6.generateConstructor=function(Y){var W=A9.codegen(["p"],Y.name);for(var z=0,F;z<Y.fieldsArray.length;++z)if((F=Y._fieldsArray[z]).map)W("this%s={}",A9.safeProp(F.name));else if(F.repeated)W("this%s=[]",A9.safeProp(F.name));return W("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")};function SG(X){return X._fieldsById=X._fieldsArray=X._oneofsArray=null,delete X.encode,delete X.decode,delete X.verify,X}O6.fromJSON=function(Y,W){var z=new O6(Y,W.options);z.extensions=W.extensions,z.reserved=W.reserved;var F=Object.keys(W.fields),Q=0;for(;Q<F.length;++Q)z.add((typeof W.fields[F[Q]].keyType<"u"?j01.fromJSON:wG.fromJSON)(F[Q],W.fields[F[Q]]));if(W.oneofs)for(F=Object.keys(W.oneofs),Q=0;Q<F.length;++Q)z.add(XN.fromJSON(F[Q],W.oneofs[F[Q]]));if(W.nested)for(F=Object.keys(W.nested),Q=0;Q<F.length;++Q){var J=W.nested[F[Q]];z.add((J.id!==void 0?wG.fromJSON:J.fields!==void 0?O6.fromJSON:J.values!==void 0?v01.fromJSON:J.methods!==void 0?h01.fromJSON:V8.fromJSON)(F[Q],J))}if(W.extensions&&W.extensions.length)z.extensions=W.extensions;if(W.reserved&&W.reserved.length)z.reserved=W.reserved;if(W.group)z.group=!0;if(W.comment)z.comment=W.comment;if(W.edition)z._edition=W.edition;return z._defaultEdition="proto3",z};O6.prototype.toJSON=function(Y){var W=V8.prototype.toJSON.call(this,Y),z=Y?Boolean(Y.keepComments):!1;return A9.toObject(["edition",this._editionToJSON(),"options",W&&W.options||void 0,"oneofs",V8.arrayToJSON(this.oneofsArray,Y),"fields",V8.arrayToJSON(this.fieldsArray.filter(function(F){return!F.declaringField}),Y)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",W&&W.nested||void 0,"comment",z?this.comment:void 0])};O6.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;V8.prototype.resolveAll.call(this);var Y=this.oneofsArray;z=0;while(z<Y.length)Y[z++].resolve();var W=this.fieldsArray,z=0;while(z<W.length)W[z++].resolve();return this};O6.prototype._resolveFeaturesRecursive=function(Y){if(!this._needsRecursiveFeatureResolution)return this;return Y=this._edition||Y,V8.prototype._resolveFeaturesRecursive.call(this,Y),this.oneofsArray.forEach((W)=>{W._resolveFeatures(Y)}),this.fieldsArray.forEach((W)=>{W._resolveFeatures(Y)}),this};O6.prototype.get=function(Y){return this.fields[Y]||this.oneofs&&this.oneofs[Y]||this.nested&&this.nested[Y]||null};O6.prototype.add=function(Y){if(this.get(Y.name))throw Error("duplicate name '"+Y.name+"' in "+this);if(Y instanceof wG&&Y.extend===void 0){if(this._fieldsById?this._fieldsById[Y.id]:this.fieldsById[Y.id])throw Error("duplicate id "+Y.id+" in "+this);if(this.isReservedId(Y.id))throw Error("id "+Y.id+" is reserved in "+this);if(this.isReservedName(Y.name))throw Error("name '"+Y.name+"' is reserved in "+this);if(Y.parent)Y.parent.remove(Y);return this.fields[Y.name]=Y,Y.message=this,Y.onAdd(this),SG(this)}if(Y instanceof XN){if(!this.oneofs)this.oneofs={};return this.oneofs[Y.name]=Y,Y.onAdd(this),SG(this)}return V8.prototype.add.call(this,Y)};O6.prototype.remove=function(Y){if(Y instanceof wG&&Y.extend===void 0){if(!this.fields||this.fields[Y.name]!==Y)throw Error(Y+" is not a member of "+this);return delete this.fields[Y.name],Y.parent=null,Y.onRemove(this),SG(this)}if(Y instanceof XN){if(!this.oneofs||this.oneofs[Y.name]!==Y)throw Error(Y+" is not a member of "+this);return delete this.oneofs[Y.name],Y.parent=null,Y.onRemove(this),SG(this)}return V8.prototype.remove.call(this,Y)};O6.prototype.isReservedId=function(Y){return V8.isReservedId(this.reserved,Y)};O6.prototype.isReservedName=function(Y){return V8.isReservedName(this.reserved,Y)};O6.prototype.create=function(Y){return new this.ctor(Y)};O6.prototype.setup=function(){var Y=this.fullName,W=[];for(var z=0;z<this.fieldsArray.length;++z)W.push(this._fieldsArray[z].resolve().resolvedType);this.encode=x01(this)({Writer:_01,types:W,util:A9}),this.decode=b01(this)({Reader:eU,types:W,util:A9}),this.verify=u01(this)({types:W,util:A9}),this.fromObject=X70.fromObject(this)({types:W,util:A9}),this.toObject=X70.toObject(this)({types:W,util:A9});var F=m01[Y];if(F){var Q=Object.create(this);Q.fromObject=this.fromObject,this.fromObject=F.fromObject.bind(Q),Q.toObject=this.toObject,this.toObject=F.toObject.bind(Q)}return this};O6.prototype.encode=function(Y,W){return this.setup().encode(Y,W)};O6.prototype.encodeDelimited=function(Y,W){return this.encode(Y,W&&W.len?W.fork():W).ldelim()};O6.prototype.decode=function(Y,W){return this.setup().decode(Y,W)};O6.prototype.decodeDelimited=function(Y){if(!(Y instanceof eU))Y=eU.create(Y);return this.decode(Y,Y.uint32())};O6.prototype.verify=function(Y){return this.setup().verify(Y)};O6.prototype.fromObject=function(Y){return this.setup().fromObject(Y)};O6.prototype.toObject=function(Y,W){return this.setup().toObject(Y,W)};O6.d=function(Y){return function(z){A9.decorateType(z,Y)}}});var jG=X0((lD1,J70)=>{J70.exports=c9;var vG=qY();((c9.prototype=Object.create(vG.prototype)).constructor=c9).className="Root";var yG=R5(),ZN=j8(),g01=b7(),L5=e6(),QN,JN,AQ;function c9(X){vG.call(this,"",X),this.deferred=[],this.files=[],this._edition="proto2",this._fullyQualifiedObjects={}}c9.fromJSON=function(Y,W){if(!W)W=new c9;if(Y.options)W.setOptions(Y.options);return W.addJSON(Y.nested).resolveAll()};c9.prototype.resolvePath=L5.path.resolve;c9.prototype.fetch=L5.fetch;function Q70(){}c9.prototype.load=function X(Y,W,z){if(typeof W==="function")z=W,W=void 0;var F=this;if(!z)return L5.asPromise(X,F,Y,W);var Q=z===Q70;function J($,R){if(!z)return;if(Q)throw $;if(R)R.resolveAll();var E=z;z=null,E($,R)}function Z($){var R=$.lastIndexOf("google/protobuf/");if(R>-1){var E=$.substring(R);if(E in AQ)return E}return null}function K($,R){try{if(L5.isString(R)&&R.charAt(0)==="{")R=JSON.parse(R);if(!L5.isString(R))F.setOptions(R.options).addJSON(R.nested);else{JN.filename=$;var E=JN(R,F,W),U,A=0;if(E.imports){for(;A<E.imports.length;++A)if(U=Z(E.imports[A])||F.resolvePath($,E.imports[A]))H(U)}if(E.weakImports){for(A=0;A<E.weakImports.length;++A)if(U=Z(E.weakImports[A])||F.resolvePath($,E.weakImports[A]))H(U,!0)}}}catch(T){J(T)}if(!Q&&!G)J(null,F)}function H($,R){if($=Z($)||$,F.files.indexOf($)>-1)return;if(F.files.push($),$ in AQ){if(Q)K($,AQ[$]);else++G,setTimeout(function(){--G,K($,AQ[$])});return}if(Q){var E;try{E=L5.fs.readFileSync($).toString("utf8")}catch(U){if(!R)J(U);return}K($,E)}else++G,F.fetch($,function(U,A){if(--G,!z)return;if(U){if(!R)J(U);else if(!G)J(null,F);return}K($,A)})}var G=0;if(L5.isString(Y))Y=[Y];for(var q=0,B;q<Y.length;++q)if(B=F.resolvePath("",Y[q]))H(B);if(Q)return F.resolveAll(),F;if(!G)J(null,F);return F};c9.prototype.loadSync=function(Y,W){if(!L5.isNode)throw Error("not supported");return this.load(Y,W,Q70)};c9.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(Y){return"'extend "+Y.extend+"' in "+Y.parent.fullName}).join(", "));return vG.prototype.resolveAll.call(this)};var kG=/^[A-Z]/;function Z70(X,Y){var W=Y.parent.lookup(Y.extend);if(W){var z=new yG(Y.fullName,Y.id,Y.type,Y.rule,void 0,Y.options);if(W.get(z.name))return!0;return z.declaringField=Y,Y.extensionField=z,W.add(z),!0}return!1}c9.prototype._handleAdd=function(Y){if(Y instanceof yG){if(Y.extend!==void 0&&!Y.extensionField){if(!Z70(this,Y))this.deferred.push(Y)}}else if(Y instanceof ZN){if(kG.test(Y.name))Y.parent[Y.name]=Y.values}else if(!(Y instanceof g01)){if(Y instanceof QN)for(var W=0;W<this.deferred.length;)if(Z70(this,this.deferred[W]))this.deferred.splice(W,1);else++W;for(var z=0;z<Y.nestedArray.length;++z)this._handleAdd(Y._nestedArray[z]);if(kG.test(Y.name))Y.parent[Y.name]=Y}if(Y instanceof QN||Y instanceof ZN||Y instanceof yG)this._fullyQualifiedObjects[Y.fullName]=Y};c9.prototype._handleRemove=function(Y){if(Y instanceof yG){if(Y.extend!==void 0)if(Y.extensionField)Y.extensionField.parent.remove(Y.extensionField),Y.extensionField=null;else{var W=this.deferred.indexOf(Y);if(W>-1)this.deferred.splice(W,1)}}else if(Y instanceof ZN){if(kG.test(Y.name))delete Y.parent[Y.name]}else if(Y instanceof vG){for(var z=0;z<Y.nestedArray.length;++z)this._handleRemove(Y._nestedArray[z]);if(kG.test(Y.name))delete Y.parent[Y.name]}delete this._fullyQualifiedObjects[Y.fullName]};c9._configure=function(X,Y,W){QN=X,JN=Y,AQ=W}});var e6=X0((pD1,G70)=>{var h6=G70.exports=a8(),W70=aq(),WN,GN;h6.codegen=j50();h6.fetch=_50();h6.path=u50();h6.fs=h6.inquire("fs");h6.toArray=function(Y){if(Y){var W=Object.keys(Y),z=Array(W.length),F=0;while(F<W.length)z[F]=Y[W[F++]];return z}return[]};h6.toObject=function(Y){var W={},z=0;while(z<Y.length){var F=Y[z++],Q=Y[z++];if(Q!==void 0)W[F]=Q}return W};var d01=/\\/g,c01=/"/g;h6.isReserved=function(Y){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(Y)};h6.safeProp=function(Y){if(!/^[$\w_]+$/.test(Y)||h6.isReserved(Y))return'["'+Y.replace(d01,"\\\\").replace(c01,"\\\"")+'"]';return"."+Y};h6.ucFirst=function(Y){return Y.charAt(0).toUpperCase()+Y.substring(1)};var l01=/_([a-z])/g;h6.camelCase=function(Y){return Y.substring(0,1)+Y.substring(1).replace(l01,function(W,z){return z.toUpperCase()})};h6.compareFieldsById=function(Y,W){return Y.id-W.id};h6.decorateType=function(Y,W){if(Y.$type){if(W&&Y.$type.name!==W)h6.decorateRoot.remove(Y.$type),Y.$type.name=W,h6.decorateRoot.add(Y.$type);return Y.$type}if(!WN)WN=fG();var z=new WN(W||Y.name);return h6.decorateRoot.add(z),z.ctor=Y,Object.defineProperty(Y,"$type",{value:z,enumerable:!1}),Object.defineProperty(Y.prototype,"$type",{value:z,enumerable:!1}),z};var p01=0;h6.decorateEnum=function(Y){if(Y.$type)return Y.$type;if(!GN)GN=j8();var W=new GN("Enum"+p01++,Y);return h6.decorateRoot.add(W),Object.defineProperty(Y,"$type",{value:W,enumerable:!1}),W};h6.setProperty=function(Y,W,z,F){function Q(J,Z,K){var H=Z.shift();if(H==="__proto__"||H==="prototype")return J;if(Z.length>0)J[H]=Q(J[H]||{},Z,K);else{var G=J[H];if(G&&F)return J;if(G)K=[].concat(G).concat(K);J[H]=K}return J}if(typeof Y!=="object")throw TypeError("dst must be an object");if(!W)throw TypeError("path must be specified");return W=W.split("."),Q(Y,W,z)};Object.defineProperty(h6,"decorateRoot",{get:function(){return W70.decorated||(W70.decorated=new(jG()))}})});var u7=X0((K70)=>{var OQ=K70,n01=e6(),i01=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function TQ(X,Y){var W=0,z={};Y|=0;while(W<X.length)z[i01[W+Y]]=X[W++];return z}OQ.basic=TQ([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]);OQ.defaults=TQ([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",n01.emptyArray,null]);OQ.long=TQ([0,0,0,1,1],7);OQ.mapKey=TQ([0,0,0,5,5,0,0,0,1,1,0,2],2);OQ.packed=TQ([1,5,0,0,0,5,5,0,0,0,1,1,0])});var R5=X0((iD1,z70)=>{z70.exports=X9;var $Q=M5();((X9.prototype=Object.create($Q.prototype)).constructor=X9).className="Field";var F70=j8(),KN=u7(),c6=e6(),IQ,a01=/^required|optional|repeated$/;X9.fromJSON=function(Y,W){var z=new X9(Y,W.id,W.type,W.rule,W.extend,W.options,W.comment);if(W.edition)z._edition=W.edition;return z._defaultEdition="proto3",z};function X9(X,Y,W,z,F,Q,J){if(c6.isObject(z))J=F,Q=z,z=F=void 0;else if(c6.isObject(F))J=Q,Q=F,F=void 0;if($Q.call(this,X,Q),!c6.isInteger(Y)||Y<0)throw TypeError("id must be a non-negative integer");if(!c6.isString(W))throw TypeError("type must be a string");if(z!==void 0&&!a01.test(z=z.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(F!==void 0&&!c6.isString(F))throw TypeError("extend must be a string");if(z==="proto3_optional")z="optional";this.rule=z&&z!=="optional"?z:void 0,this.type=W,this.id=Y,this.extend=F||void 0,this.repeated=z==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=c6.Long?KN.long[W]!==void 0:!1,this.bytes=W==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=J}Object.defineProperty(X9.prototype,"required",{get:function(){return this._features.field_presence==="LEGACY_REQUIRED"}});Object.defineProperty(X9.prototype,"optional",{get:function(){return!this.required}});Object.defineProperty(X9.prototype,"delimited",{get:function(){return this.resolvedType instanceof IQ&&this._features.message_encoding==="DELIMITED"}});Object.defineProperty(X9.prototype,"packed",{get:function(){return this._features.repeated_field_encoding==="PACKED"}});Object.defineProperty(X9.prototype,"hasPresence",{get:function(){if(this.repeated||this.map)return!1;return this.partOf||this.declaringField||this.extensionField||this._features.field_presence!=="IMPLICIT"}});X9.prototype.setOption=function(Y,W,z){return $Q.prototype.setOption.call(this,Y,W,z)};X9.prototype.toJSON=function(Y){var W=Y?Boolean(Y.keepComments):!1;return c6.toObject(["edition",this._editionToJSON(),"rule",this.rule!=="optional"&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",W?this.comment:void 0])};X9.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=KN.defaults[this.type])===void 0)if(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof IQ)this.typeDefault=null;else this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]];else if(this.options&&this.options.proto3_optional)this.typeDefault=null;if(this.options&&this.options.default!=null){if(this.typeDefault=this.options.default,this.resolvedType instanceof F70&&typeof this.typeDefault==="string")this.typeDefault=this.resolvedType.values[this.typeDefault]}if(this.options){if(this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof F70))delete this.options.packed;if(!Object.keys(this.options).length)this.options=void 0}if(this.long){if(this.typeDefault=c6.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze)Object.freeze(this.typeDefault)}else if(this.bytes&&typeof this.typeDefault==="string"){var Y;if(c6.base64.test(this.typeDefault))c6.base64.decode(this.typeDefault,Y=c6.newBuffer(c6.base64.length(this.typeDefault)),0);else c6.utf8.write(this.typeDefault,Y=c6.newBuffer(c6.utf8.length(this.typeDefault)),0);this.typeDefault=Y}if(this.map)this.defaultValue=c6.emptyObject;else if(this.repeated)this.defaultValue=c6.emptyArray;else this.defaultValue=this.typeDefault;if(this.parent instanceof IQ)this.parent.ctor.prototype[this.name]=this.defaultValue;return $Q.prototype.resolve.call(this)};X9.prototype._inferLegacyProtoFeatures=function(Y){if(Y!=="proto2"&&Y!=="proto3")return{};var W={};if(this.rule==="required")W.field_presence="LEGACY_REQUIRED";if(this.parent&&KN.defaults[this.type]===void 0){var z=this.parent.get(this.type.split(".").pop());if(z&&z instanceof IQ&&z.group)W.message_encoding="DELIMITED"}if(this.getOption("packed")===!0)W.repeated_field_encoding="PACKED";else if(this.getOption("packed")===!1)W.repeated_field_encoding="EXPANDED";return W};X9.prototype._resolveFeatures=function(Y){return $Q.prototype._resolveFeatures.call(this,this._edition||Y)};X9.d=function(Y,W,z,F){if(typeof W==="function")W=c6.decorateType(W).name;else if(W&&typeof W==="object")W=c6.decorateEnum(W).name;return function(J,Z){c6.decorateType(J.constructor).add(new X9(Z,Y,W,z,{default:F}))}};X9._configure=function(Y){IQ=Y}});var b7=X0((aD1,V70)=>{V70.exports=l9;var _G=M5();((l9.prototype=Object.create(_G.prototype)).constructor=l9).className="OneOf";var q70=R5(),hG=e6();function l9(X,Y,W,z){if(!Array.isArray(Y))W=Y,Y=void 0;if(_G.call(this,X,W),!(Y===void 0||Array.isArray(Y)))throw TypeError("fieldNames must be an Array");this.oneof=Y||[],this.fieldsArray=[],this.comment=z}l9.fromJSON=function(Y,W){return new l9(Y,W.oneof,W.options,W.comment)};l9.prototype.toJSON=function(Y){var W=Y?Boolean(Y.keepComments):!1;return hG.toObject(["options",this.options,"oneof",this.oneof,"comment",W?this.comment:void 0])};function H70(X){if(X.parent){for(var Y=0;Y<X.fieldsArray.length;++Y)if(!X.fieldsArray[Y].parent)X.parent.add(X.fieldsArray[Y])}}l9.prototype.add=function(Y){if(!(Y instanceof q70))throw TypeError("field must be a Field");if(Y.parent&&Y.parent!==this.parent)Y.parent.remove(Y);return this.oneof.push(Y.name),this.fieldsArray.push(Y),Y.partOf=this,H70(this),this};l9.prototype.remove=function(Y){if(!(Y instanceof q70))throw TypeError("field must be a Field");var W=this.fieldsArray.indexOf(Y);if(W<0)throw Error(Y+" is not a member of "+this);if(this.fieldsArray.splice(W,1),W=this.oneof.indexOf(Y.name),W>-1)this.oneof.splice(W,1);return Y.partOf=null,this};l9.prototype.onAdd=function(Y){_G.prototype.onAdd.call(this,Y);var W=this;for(var z=0;z<this.oneof.length;++z){var F=Y.get(this.oneof[z]);if(F&&!F.partOf)F.partOf=W,W.fieldsArray.push(F)}H70(this)};l9.prototype.onRemove=function(Y){for(var W=0,z;W<this.fieldsArray.length;++W)if((z=this.fieldsArray[W]).parent)z.parent.remove(z);_G.prototype.onRemove.call(this,Y)};Object.defineProperty(l9.prototype,"isProto3Optional",{get:function(){if(this.fieldsArray==null||this.fieldsArray.length!==1)return!1;var X=this.fieldsArray[0];return X.options!=null&&X.options.proto3_optional===!0}});l9.d=function(){var Y=Array(arguments.length),W=0;while(W<arguments.length)Y[W]=arguments[W++];return function(F,Q){hG.decorateType(F.constructor).add(new l9(Q,Y)),Object.defineProperty(F,Q,{get:hG.oneOfGetter(Y),set:hG.oneOfSetter(Y)})}}});var M5=X0((rD1,B70)=>{B70.exports=V9;V9.className="ReflectionObject";var r01=b7(),DQ=e6(),xG,o01={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},t01={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},s01={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function V9(X,Y){if(!DQ.isString(X))throw TypeError("name must be a string");if(Y&&!DQ.isObject(Y))throw TypeError("options must be an object");this.options=Y,this.parsedOptions=null,this.name=X,this._edition=null,this._defaultEdition="proto2",this._features={},this._featuresResolved=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(V9.prototype,{root:{get:function(){var X=this;while(X.parent!==null)X=X.parent;return X}},fullName:{get:function(){var X=[this.name],Y=this.parent;while(Y)X.unshift(Y.name),Y=Y.parent;return X.join(".")}}});V9.prototype.toJSON=function(){throw Error()};V9.prototype.onAdd=function(Y){if(this.parent&&this.parent!==Y)this.parent.remove(this);this.parent=Y,this.resolved=!1;var W=Y.root;if(W instanceof xG)W._handleAdd(this)};V9.prototype.onRemove=function(Y){var W=Y.root;if(W instanceof xG)W._handleRemove(this);this.parent=null,this.resolved=!1};V9.prototype.resolve=function(){if(this.resolved)return this;if(this.root instanceof xG)this.resolved=!0;return this};V9.prototype._resolveFeaturesRecursive=function(Y){return this._resolveFeatures(this._edition||Y)};V9.prototype._resolveFeatures=function(Y){if(this._featuresResolved)return;var W={};if(!Y)throw Error("Unknown edition for "+this.fullName);var z=Object.assign(this.options?Object.assign({},this.options.features):{},this._inferLegacyProtoFeatures(Y));if(this._edition){if(Y==="proto2")W=Object.assign({},t01);else if(Y==="proto3")W=Object.assign({},s01);else if(Y==="2023")W=Object.assign({},o01);else throw Error("Unknown edition: "+Y);this._features=Object.assign(W,z||{}),this._featuresResolved=!0;return}if(this.partOf instanceof r01){var F=Object.assign({},this.partOf._features);this._features=Object.assign(F,z||{})}else if(this.declaringField);else if(this.parent){var Q=Object.assign({},this.parent._features);this._features=Object.assign(Q,z||{})}else throw Error("Unable to find a parent for "+this.fullName);if(this.extensionField)this.extensionField._features=this._features;this._featuresResolved=!0};V9.prototype._inferLegacyProtoFeatures=function(){return{}};V9.prototype.getOption=function(Y){if(this.options)return this.options[Y];return};V9.prototype.setOption=function(Y,W,z){if(!this.options)this.options={};if(/^features\./.test(Y))DQ.setProperty(this.options,Y,W,z);else if(!z||this.options[Y]===void 0){if(this.getOption(Y)!==W)this.resolved=!1;this.options[Y]=W}return this};V9.prototype.setParsedOption=function(Y,W,z){if(!this.parsedOptions)this.parsedOptions=[];var F=this.parsedOptions;if(z){var Q=F.find(function(K){return Object.prototype.hasOwnProperty.call(K,Y)});if(Q){var J=Q[Y];DQ.setProperty(J,z,W)}else Q={},Q[Y]=DQ.setProperty({},z,W),F.push(Q)}else{var Z={};Z[Y]=W,F.push(Z)}return this};V9.prototype.setOptions=function(Y,W){if(Y)for(var z=Object.keys(Y),F=0;F<z.length;++F)this.setOption(z[F],Y[z[F]],W);return this};V9.prototype.toString=function(){var Y=this.constructor.className,W=this.fullName;if(W.length)return Y+" "+W;return Y};V9.prototype._editionToJSON=function(){if(!this._edition||this._edition==="proto3")return;return this._edition};V9._configure=function(X){xG=X}});var j8=X0((oD1,N70)=>{N70.exports=h8;var FN=M5();((h8.prototype=Object.create(FN.prototype)).constructor=h8).className="Enum";var U70=qY(),bG=e6();function h8(X,Y,W,z,F,Q){if(FN.call(this,X,W),Y&&typeof Y!=="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=z,this.comments=F||{},this.valuesOptions=Q,this._valuesFeatures={},this.reserved=void 0,Y){for(var J=Object.keys(Y),Z=0;Z<J.length;++Z)if(typeof Y[J[Z]]==="number")this.valuesById[this.values[J[Z]]=Y[J[Z]]]=J[Z]}}h8.prototype._resolveFeatures=function(Y){return Y=this._edition||Y,FN.prototype._resolveFeatures.call(this,Y),Object.keys(this.values).forEach((W)=>{var z=Object.assign({},this._features);this._valuesFeatures[W]=Object.assign(z,this.valuesOptions&&this.valuesOptions[W]&&this.valuesOptions[W].features)}),this};h8.fromJSON=function(Y,W){var z=new h8(Y,W.values,W.options,W.comment,W.comments);if(z.reserved=W.reserved,W.edition)z._edition=W.edition;return z._defaultEdition="proto3",z};h8.prototype.toJSON=function(Y){var W=Y?Boolean(Y.keepComments):!1;return bG.toObject(["edition",this._editionToJSON(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",W?this.comment:void 0,"comments",W?this.comments:void 0])};h8.prototype.add=function(Y,W,z,F){if(!bG.isString(Y))throw TypeError("name must be a string");if(!bG.isInteger(W))throw TypeError("id must be an integer");if(this.values[Y]!==void 0)throw Error("duplicate name '"+Y+"' in "+this);if(this.isReservedId(W))throw Error("id "+W+" is reserved in "+this);if(this.isReservedName(Y))throw Error("name '"+Y+"' is reserved in "+this);if(this.valuesById[W]!==void 0){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+W+" in "+this);this.values[Y]=W}else this.valuesById[this.values[Y]=W]=Y;if(F){if(this.valuesOptions===void 0)this.valuesOptions={};this.valuesOptions[Y]=F||null}return this.comments[Y]=z||null,this};h8.prototype.remove=function(Y){if(!bG.isString(Y))throw TypeError("name must be a string");var W=this.values[Y];if(W==null)throw Error("name '"+Y+"' does not exist in "+this);if(delete this.valuesById[W],delete this.values[Y],delete this.comments[Y],this.valuesOptions)delete this.valuesOptions[Y];return this};h8.prototype.isReservedId=function(Y){return U70.isReservedId(this.reserved,Y)};h8.prototype.isReservedName=function(Y){return U70.isReservedName(this.reserved,Y)}});var YN=X0((tD1,O70)=>{O70.exports=X11;var e01=j8(),zN=u7(),qN=e6();function A70(X,Y,W,z){return Y.delimited?X("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",W,z,(Y.id<<3|3)>>>0,(Y.id<<3|4)>>>0):X("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",W,z,(Y.id<<3|2)>>>0)}function X11(X){var Y=qN.codegen(["m","w"],X.name+"$encode")("if(!w)")("w=Writer.create()"),W,z,F=X.fieldsArray.slice().sort(qN.compareFieldsById);for(var W=0;W<F.length;++W){var Q=F[W].resolve(),J=X._fieldsArray.indexOf(Q),Z=Q.resolvedType instanceof e01?"int32":Q.type,K=zN.basic[Z];if(z="m"+qN.safeProp(Q.name),Q.map){if(Y("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",z,Q.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",z)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(Q.id<<3|2)>>>0,8|zN.mapKey[Q.keyType],Q.keyType),K===void 0)Y("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",J,z);else Y(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|K,Z,z);Y("}")("}")}else if(Q.repeated){if(Y("if(%s!=null&&%s.length){",z,z),Q.packed&&zN.packed[Z]!==void 0)Y("w.uint32(%i).fork()",(Q.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",z)("w.%s(%s[i])",Z,z)("w.ldelim()");else if(Y("for(var i=0;i<%s.length;++i)",z),K===void 0)A70(Y,Q,J,z+"[i]");else Y("w.uint32(%i).%s(%s[i])",(Q.id<<3|K)>>>0,Z,z);Y("}")}else{if(Q.optional)Y("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",z,Q.name);if(K===void 0)A70(Y,Q,J,z);else Y("w.uint32(%i).%s(%s)",(Q.id<<3|K)>>>0,Z,z)}}return Y("return w")}});var I70=X0((sD1,T70)=>{var Y6=T70.exports=rq();Y6.build="light";function Y11(X,Y,W){if(typeof Y==="function")W=Y,Y=new Y6.Root;else if(!Y)Y=new Y6.Root;return Y.load(X,W)}Y6.load=Y11;function Z11(X,Y){if(!Y)Y=new Y6.Root;return Y.loadSync(X)}Y6.loadSync=Z11;Y6.encoder=YN();Y6.decoder=lU();Y6.verifier=iU();Y6.converter=oU();Y6.ReflectionObject=M5();Y6.Namespace=qY();Y6.Root=jG();Y6.Enum=j8();Y6.Type=fG();Y6.Field=R5();Y6.OneOf=b7();Y6.MapField=RG();Y6.Service=LG();Y6.Method=MG();Y6.Message=PG();Y6.wrappers=tU();Y6.types=u7();Y6.util=e6();Y6.ReflectionObject._configure(Y6.Root);Y6.Namespace._configure(Y6.Type,Y6.Service,Y6.Enum);Y6.Root._configure(Y6.Type);Y6.Field._configure(Y6.Type)});var VN=X0((eD1,E70)=>{E70.exports=D70;var HN=/[\s{}=;:[\],'"()<>]/g,Q11=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,J11=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,W11=/^ *[*/]+ */,G11=/^\s*\*?\/*/,K11=/\n/g,F11=/\s/,z11=/\\(.?)/g,q11={"0":"\x00",r:"\r",n:`
480
+ }`}return z.toString=F,z}_U.verbose=!1});var _50=X0((_D1,h50)=>{h50.exports=VQ;var I01=vq(),$01=hq(),xU=$01("fs");function VQ(X,Y,W){if(typeof Y==="function")W=Y,Y={};else if(!Y)Y={};if(!W)return I01(VQ,this,X,Y);if(!Y.xhr&&xU&&xU.readFile)return xU.readFile(X,function(F,Q){return F&&typeof XMLHttpRequest<"u"?VQ.xhr(X,Y,W):F?W(F):W(null,Y.binary?Q:Q.toString("utf8"))});return VQ.xhr(X,Y,W)}VQ.xhr=function(Y,W,z){var F=new XMLHttpRequest;if(F.onreadystatechange=function(){if(F.readyState!==4)return;if(F.status!==0&&F.status!==200)return z(Error("status "+F.status));if(W.binary){var J=F.response;if(!J){J=[];for(var Z=0;Z<F.responseText.length;++Z)J.push(F.responseText.charCodeAt(Z)&255)}return z(null,typeof Uint8Array<"u"?new Uint8Array(J):J)}return z(null,F.responseText)},W.binary){if("overrideMimeType"in F)F.overrideMimeType("text/plain; charset=x-user-defined");F.responseType="arraybuffer"}F.open("GET",Y),F.send()}});var u50=X0((b50)=>{var uU=b50,x50=uU.isAbsolute=function(Y){return/^(?:\/|\w+:)/.test(Y)},bU=uU.normalize=function(Y){Y=Y.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var W=Y.split("/"),z=x50(Y),F="";if(z)F=W.shift()+"/";for(var Q=0;Q<W.length;)if(W[Q]==="..")if(Q>0&&W[Q-1]!=="..")W.splice(--Q,2);else if(z)W.splice(Q,1);else++Q;else if(W[Q]===".")W.splice(Q,1);else++Q;return F+W.join("/")};uU.resolve=function(Y,W,z){if(!z)W=bU(W);if(x50(W))return W;if(!z)Y=bU(Y);return(Y=Y.replace(/(?:\/|^)[^/]+$/,"")).length?bU(Y+"/"+W):W}});var qY=X0((bD1,d50)=>{d50.exports=X6;var EG=M5();((X6.prototype=Object.create(EG.prototype)).constructor=X6).className="Namespace";var mU=R5(),CG=e6(),D01=b7(),_7,zY,x7;X6.fromJSON=function(Y,W){return new X6(Y,W.options).addJSON(W.nested)};function m50(X,Y){if(!(X&&X.length))return;var W={};for(var z=0;z<X.length;++z)W[X[z].name]=X[z].toJSON(Y);return W}X6.arrayToJSON=m50;X6.isReservedId=function(Y,W){if(Y){for(var z=0;z<Y.length;++z)if(typeof Y[z]!=="string"&&Y[z][0]<=W&&Y[z][1]>W)return!0}return!1};X6.isReservedName=function(Y,W){if(Y){for(var z=0;z<Y.length;++z)if(Y[z]===W)return!0}return!1};function X6(X,Y){EG.call(this,X,Y),this.nested=void 0,this._nestedArray=null,this._lookupCache={},this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0}function g50(X){X._nestedArray=null,X._lookupCache={};var Y=X;while(Y=Y.parent)Y._lookupCache={};return X}Object.defineProperty(X6.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=CG.toArray(this.nested))}});X6.prototype.toJSON=function(Y){return CG.toObject(["options",this.options,"nested",m50(this.nestedArray,Y)])};X6.prototype.addJSON=function(Y){var W=this;if(Y)for(var z=Object.keys(Y),F=0,Q;F<z.length;++F)Q=Y[z[F]],W.add((Q.fields!==void 0?_7.fromJSON:Q.values!==void 0?x7.fromJSON:Q.methods!==void 0?zY.fromJSON:Q.id!==void 0?mU.fromJSON:X6.fromJSON)(z[F],Q));return this};X6.prototype.get=function(Y){return this.nested&&this.nested[Y]||null};X6.prototype.getEnum=function(Y){if(this.nested&&this.nested[Y]instanceof x7)return this.nested[Y].values;throw Error("no such enum: "+Y)};X6.prototype.add=function(Y){if(!(Y instanceof mU&&Y.extend!==void 0||Y instanceof _7||Y instanceof D01||Y instanceof x7||Y instanceof zY||Y instanceof X6))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var W=this.get(Y.name);if(W)if(W instanceof X6&&Y instanceof X6&&!(W instanceof _7||W instanceof zY)){var z=W.nestedArray;for(var F=0;F<z.length;++F)Y.add(z[F]);if(this.remove(W),!this.nested)this.nested={};Y.setOptions(W.options,!0)}else throw Error("duplicate name '"+Y.name+"' in "+this)}if(this.nested[Y.name]=Y,!(this instanceof _7||this instanceof zY||this instanceof x7||this instanceof mU)){if(!Y._edition)Y._edition=Y._defaultEdition}this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0;var Q=this;while(Q=Q.parent)Q._needsRecursiveFeatureResolution=!0,Q._needsRecursiveResolve=!0;return Y.onAdd(this),g50(this)};X6.prototype.remove=function(Y){if(!(Y instanceof EG))throw TypeError("object must be a ReflectionObject");if(Y.parent!==this)throw Error(Y+" is not a member of "+this);if(delete this.nested[Y.name],!Object.keys(this.nested).length)this.nested=void 0;return Y.onRemove(this),g50(this)};X6.prototype.define=function(Y,W){if(CG.isString(Y))Y=Y.split(".");else if(!Array.isArray(Y))throw TypeError("illegal path");if(Y&&Y.length&&Y[0]==="")throw Error("path must be relative");var z=this;while(Y.length>0){var F=Y.shift();if(z.nested&&z.nested[F]){if(z=z.nested[F],!(z instanceof X6))throw Error("path conflicts with non-namespace objects")}else z.add(z=new X6(F))}if(W)z.addJSON(W);return z};X6.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;this._resolveFeaturesRecursive(this._edition);var Y=this.nestedArray,W=0;this.resolve();while(W<Y.length)if(Y[W]instanceof X6)Y[W++].resolveAll();else Y[W++].resolve();return this._needsRecursiveResolve=!1,this};X6.prototype._resolveFeaturesRecursive=function(Y){if(!this._needsRecursiveFeatureResolution)return this;return this._needsRecursiveFeatureResolution=!1,Y=this._edition||Y,EG.prototype._resolveFeaturesRecursive.call(this,Y),this.nestedArray.forEach((W)=>{W._resolveFeaturesRecursive(Y)}),this};X6.prototype.lookup=function(Y,W,z){if(typeof W==="boolean")z=W,W=void 0;else if(W&&!Array.isArray(W))W=[W];if(CG.isString(Y)&&Y.length){if(Y===".")return this.root;Y=Y.split(".")}else if(!Y.length)return this;var F=Y.join(".");if(Y[0]==="")return this.root.lookup(Y.slice(1),W);var Q=this.root._fullyQualifiedObjects&&this.root._fullyQualifiedObjects["."+F];if(Q&&(!W||W.indexOf(Q.constructor)>-1))return Q;if(Q=this._lookupImpl(Y,F),Q&&(!W||W.indexOf(Q.constructor)>-1))return Q;if(z)return null;var J=this;while(J.parent){if(Q=J.parent._lookupImpl(Y,F),Q&&(!W||W.indexOf(Q.constructor)>-1))return Q;J=J.parent}return null};X6.prototype._lookupImpl=function(Y,W){if(Object.prototype.hasOwnProperty.call(this._lookupCache,W))return this._lookupCache[W];var z=this.get(Y[0]),F=null;if(z){if(Y.length===1)F=z;else if(z instanceof X6)Y=Y.slice(1),F=z._lookupImpl(Y,Y.join("."))}else for(var Q=0;Q<this.nestedArray.length;++Q)if(this._nestedArray[Q]instanceof X6&&(z=this._nestedArray[Q]._lookupImpl(Y,W)))F=z;return this._lookupCache[W]=F,F};X6.prototype.lookupType=function(Y){var W=this.lookup(Y,[_7]);if(!W)throw Error("no such type: "+Y);return W};X6.prototype.lookupEnum=function(Y){var W=this.lookup(Y,[x7]);if(!W)throw Error("no such Enum '"+Y+"' in "+this);return W};X6.prototype.lookupTypeOrEnum=function(Y){var W=this.lookup(Y,[_7,x7]);if(!W)throw Error("no such Type or Enum '"+Y+"' in "+this);return W};X6.prototype.lookupService=function(Y){var W=this.lookup(Y,[zY]);if(!W)throw Error("no such Service '"+Y+"' in "+this);return W};X6._configure=function(X,Y,W){_7=X,zY=Y,x7=W}});var RG=X0((uD1,c50)=>{c50.exports=m4;var gU=R5();((m4.prototype=Object.create(gU.prototype)).constructor=m4).className="MapField";var E01=u7(),BQ=e6();function m4(X,Y,W,z,F,Q){if(gU.call(this,X,Y,z,void 0,void 0,F,Q),!BQ.isString(W))throw TypeError("keyType must be a string");this.keyType=W,this.resolvedKeyType=null,this.map=!0}m4.fromJSON=function(Y,W){return new m4(Y,W.id,W.keyType,W.type,W.options,W.comment)};m4.prototype.toJSON=function(Y){var W=Y?Boolean(Y.keepComments):!1;return BQ.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",W?this.comment:void 0])};m4.prototype.resolve=function(){if(this.resolved)return this;if(E01.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return gU.prototype.resolve.call(this)};m4.d=function(Y,W,z){if(typeof z==="function")z=BQ.decorateType(z).name;else if(z&&typeof z==="object")z=BQ.decorateEnum(z).name;return function(Q,J){BQ.decorateType(Q.constructor).add(new m4(J,Y,W,z))}}});var MG=X0((mD1,l50)=>{l50.exports=m7;var dU=M5();((m7.prototype=Object.create(dU.prototype)).constructor=m7).className="Method";var HY=e6();function m7(X,Y,W,z,F,Q,J,Z,K){if(HY.isObject(F))J=F,F=Q=void 0;else if(HY.isObject(Q))J=Q,Q=void 0;if(!(Y===void 0||HY.isString(Y)))throw TypeError("type must be a string");if(!HY.isString(W))throw TypeError("requestType must be a string");if(!HY.isString(z))throw TypeError("responseType must be a string");dU.call(this,X,J),this.type=Y||"rpc",this.requestType=W,this.requestStream=F?!0:void 0,this.responseType=z,this.responseStream=Q?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=Z,this.parsedOptions=K}m7.fromJSON=function(Y,W){return new m7(Y,W.type,W.requestType,W.responseType,W.requestStream,W.responseStream,W.options,W.comment,W.parsedOptions)};m7.prototype.toJSON=function(Y){var W=Y?Boolean(Y.keepComments):!1;return HY.toObject(["type",this.type!=="rpc"&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",W?this.comment:void 0,"parsedOptions",this.parsedOptions])};m7.prototype.resolve=function(){if(this.resolved)return this;return this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),dU.prototype.resolve.call(this)}});var LG=X0((gD1,n50)=>{n50.exports=d9;var g4=qY();((d9.prototype=Object.create(g4.prototype)).constructor=d9).className="Service";var cU=MG(),UQ=e6(),C01=iq();function d9(X,Y){g4.call(this,X,Y),this.methods={},this._methodsArray=null}d9.fromJSON=function(Y,W){var z=new d9(Y,W.options);if(W.methods)for(var F=Object.keys(W.methods),Q=0;Q<F.length;++Q)z.add(cU.fromJSON(F[Q],W.methods[F[Q]]));if(W.nested)z.addJSON(W.nested);if(W.edition)z._edition=W.edition;return z.comment=W.comment,z._defaultEdition="proto3",z};d9.prototype.toJSON=function(Y){var W=g4.prototype.toJSON.call(this,Y),z=Y?Boolean(Y.keepComments):!1;return UQ.toObject(["edition",this._editionToJSON(),"options",W&&W.options||void 0,"methods",g4.arrayToJSON(this.methodsArray,Y)||{},"nested",W&&W.nested||void 0,"comment",z?this.comment:void 0])};Object.defineProperty(d9.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=UQ.toArray(this.methods))}});function p50(X){return X._methodsArray=null,X}d9.prototype.get=function(Y){return this.methods[Y]||g4.prototype.get.call(this,Y)};d9.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;g4.prototype.resolve.call(this);var Y=this.methodsArray;for(var W=0;W<Y.length;++W)Y[W].resolve();return this};d9.prototype._resolveFeaturesRecursive=function(Y){if(!this._needsRecursiveFeatureResolution)return this;return Y=this._edition||Y,g4.prototype._resolveFeaturesRecursive.call(this,Y),this.methodsArray.forEach((W)=>{W._resolveFeaturesRecursive(Y)}),this};d9.prototype.add=function(Y){if(this.get(Y.name))throw Error("duplicate name '"+Y.name+"' in "+this);if(Y instanceof cU)return this.methods[Y.name]=Y,Y.parent=this,p50(this);return g4.prototype.add.call(this,Y)};d9.prototype.remove=function(Y){if(Y instanceof cU){if(this.methods[Y.name]!==Y)throw Error(Y+" is not a member of "+this);return delete this.methods[Y.name],Y.parent=null,p50(this)}return g4.prototype.remove.call(this,Y)};d9.prototype.create=function(Y,W,z){var F=new C01.Service(Y,W,z);for(var Q=0,J;Q<this.methodsArray.length;++Q){var Z=UQ.lcFirst((J=this._methodsArray[Q]).resolve().name).replace(/[^$\w_]/g,"");F[Z]=UQ.codegen(["r","c"],UQ.isReserved(Z)?Z+"_":Z)("return this.rpcCall(m,q,s,r,c)")({m:J,q:J.resolvedRequestType.ctor,s:J.resolvedResponseType.ctor})}return F}});var PG=X0((dD1,i50)=>{i50.exports=Q4;var R01=a8();function Q4(X){if(X)for(var Y=Object.keys(X),W=0;W<Y.length;++W)this[Y[W]]=X[Y[W]]}Q4.create=function(Y){return this.$type.create(Y)};Q4.encode=function(Y,W){return this.$type.encode(Y,W)};Q4.encodeDelimited=function(Y,W){return this.$type.encodeDelimited(Y,W)};Q4.decode=function(Y){return this.$type.decode(Y)};Q4.decodeDelimited=function(Y){return this.$type.decodeDelimited(Y)};Q4.verify=function(Y){return this.$type.verify(Y)};Q4.fromObject=function(Y){return this.$type.fromObject(Y)};Q4.toObject=function(Y,W){return this.$type.toObject(Y,W)};Q4.prototype.toJSON=function(){return this.$type.toObject(this,R01.toJSONOptions)}});var lU=X0((cD1,r50)=>{r50.exports=P01;var M01=j8(),d4=u7(),a50=e6();function L01(X){return"missing required '"+X.name+"'"}function P01(X){var Y=a50.codegen(["r","l","e"],X.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(X.fieldsArray.filter(function(Z){return Z.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),W=0;for(;W<X.fieldsArray.length;++W){var z=X._fieldsArray[W].resolve(),F=z.resolvedType instanceof M01?"int32":z.type,Q="m"+a50.safeProp(z.name);if(Y("case %i: {",z.id),z.map){if(Y("if(%s===util.emptyObject)",Q)("%s={}",Q)("var c2 = r.uint32()+r.pos"),d4.defaults[z.keyType]!==void 0)Y("k=%j",d4.defaults[z.keyType]);else Y("k=null");if(d4.defaults[F]!==void 0)Y("value=%j",d4.defaults[F]);else Y("value=null");if(Y("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",z.keyType)("case 2:"),d4.basic[F]===void 0)Y("value=types[%i].decode(r,r.uint32())",W);else Y("value=r.%s()",F);if(Y("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),d4.long[z.keyType]!==void 0)Y('%s[typeof k==="object"?util.longToHash(k):k]=value',Q);else Y("%s[k]=value",Q)}else if(z.repeated){if(Y("if(!(%s&&%s.length))",Q,Q)("%s=[]",Q),d4.packed[F]!==void 0)Y("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",Q,F)("}else");if(d4.basic[F]===void 0)Y(z.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4)))":"%s.push(types[%i].decode(r,r.uint32()))",Q,W);else Y("%s.push(r.%s())",Q,F)}else if(d4.basic[F]===void 0)Y(z.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4))":"%s=types[%i].decode(r,r.uint32())",Q,W);else Y("%s=r.%s()",Q,F);Y("break")("}")}Y("default:")("r.skipType(t&7)")("break")("}")("}");for(W=0;W<X._fieldsArray.length;++W){var J=X._fieldsArray[W];if(J.required)Y("if(!m.hasOwnProperty(%j))",J.name)("throw util.ProtocolError(%j,{instance:m})",L01(J))}return Y("return m")}});var iU=X0((lD1,o50)=>{o50.exports=f01;var w01=j8(),pU=e6();function H8(X,Y){return X.name+": "+Y+(X.repeated&&Y!=="array"?"[]":X.map&&Y!=="object"?"{k:"+X.keyType+"}":"")+" expected"}function nU(X,Y,W,z){if(Y.resolvedType)if(Y.resolvedType instanceof w01){X("switch(%s){",z)("default:")("return%j",H8(Y,"enum value"));for(var F=Object.keys(Y.resolvedType.values),Q=0;Q<F.length;++Q)X("case %i:",Y.resolvedType.values[F[Q]]);X("break")("}")}else X("{")("var e=types[%i].verify(%s);",W,z)("if(e)")("return%j+e",Y.name+".")("}");else switch(Y.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":X("if(!util.isInteger(%s))",z)("return%j",H8(Y,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":X("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",z,z,z,z)("return%j",H8(Y,"integer|Long"));break;case"float":case"double":X('if(typeof %s!=="number")',z)("return%j",H8(Y,"number"));break;case"bool":X('if(typeof %s!=="boolean")',z)("return%j",H8(Y,"boolean"));break;case"string":X("if(!util.isString(%s))",z)("return%j",H8(Y,"string"));break;case"bytes":X('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',z,z,z)("return%j",H8(Y,"buffer"));break}return X}function S01(X,Y,W){switch(Y.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":X("if(!util.key32Re.test(%s))",W)("return%j",H8(Y,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":X("if(!util.key64Re.test(%s))",W)("return%j",H8(Y,"integer|Long key"));break;case"bool":X("if(!util.key2Re.test(%s))",W)("return%j",H8(Y,"boolean key"));break}return X}function f01(X){var Y=pU.codegen(["m"],X.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),W=X.oneofsArray,z={};if(W.length)Y("var p={}");for(var F=0;F<X.fieldsArray.length;++F){var Q=X._fieldsArray[F].resolve(),J="m"+pU.safeProp(Q.name);if(Q.optional)Y("if(%s!=null&&m.hasOwnProperty(%j)){",J,Q.name);if(Q.map)Y("if(!util.isObject(%s))",J)("return%j",H8(Q,"object"))("var k=Object.keys(%s)",J)("for(var i=0;i<k.length;++i){"),S01(Y,Q,"k[i]"),nU(Y,Q,F,J+"[k[i]]")("}");else if(Q.repeated)Y("if(!Array.isArray(%s))",J)("return%j",H8(Q,"array"))("for(var i=0;i<%s.length;++i){",J),nU(Y,Q,F,J+"[i]")("}");else{if(Q.partOf){var Z=pU.safeProp(Q.partOf.name);if(z[Q.partOf.name]===1)Y("if(p%s===1)",Z)("return%j",Q.partOf.name+": multiple values");z[Q.partOf.name]=1,Y("p%s=1",Z)}nU(Y,Q,F,J)}if(Q.optional)Y("}")}return Y("return null")}});var oU=X0((s50)=>{var t50=s50,NQ=j8(),J4=e6();function aU(X,Y,W,z){var F=!1;if(Y.resolvedType)if(Y.resolvedType instanceof NQ){X("switch(d%s){",z);for(var Q=Y.resolvedType.values,J=Object.keys(Q),Z=0;Z<J.length;++Z){if(Q[J[Z]]===Y.typeDefault&&!F){if(X("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',z,z,z),!Y.repeated)X("break");F=!0}X("case%j:",J[Z])("case %i:",Q[J[Z]])("m%s=%j",z,Q[J[Z]])("break")}X("}")}else X('if(typeof d%s!=="object")',z)("throw TypeError(%j)",Y.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",z,W,z);else{var K=!1;switch(Y.type){case"double":case"float":X("m%s=Number(d%s)",z,z);break;case"uint32":case"fixed32":X("m%s=d%s>>>0",z,z);break;case"int32":case"sint32":case"sfixed32":X("m%s=d%s|0",z,z);break;case"uint64":K=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":X("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",z,z,K)('else if(typeof d%s==="string")',z)("m%s=parseInt(d%s,10)",z,z)('else if(typeof d%s==="number")',z)("m%s=d%s",z,z)('else if(typeof d%s==="object")',z)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",z,z,z,K?"true":"");break;case"bytes":X('if(typeof d%s==="string")',z)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",z,z,z)("else if(d%s.length >= 0)",z)("m%s=d%s",z,z);break;case"string":X("m%s=String(d%s)",z,z);break;case"bool":X("m%s=Boolean(d%s)",z,z);break}}return X}t50.fromObject=function(Y){var W=Y.fieldsArray,z=J4.codegen(["d"],Y.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!W.length)return z("return new this.ctor");z("var m=new this.ctor");for(var F=0;F<W.length;++F){var Q=W[F].resolve(),J=J4.safeProp(Q.name);if(Q.map)z("if(d%s){",J)('if(typeof d%s!=="object")',J)("throw TypeError(%j)",Q.fullName+": object expected")("m%s={}",J)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",J),aU(z,Q,F,J+"[ks[i]]")("}")("}");else if(Q.repeated)z("if(d%s){",J)("if(!Array.isArray(d%s))",J)("throw TypeError(%j)",Q.fullName+": array expected")("m%s=[]",J)("for(var i=0;i<d%s.length;++i){",J),aU(z,Q,F,J+"[i]")("}")("}");else{if(!(Q.resolvedType instanceof NQ))z("if(d%s!=null){",J);if(aU(z,Q,F,J),!(Q.resolvedType instanceof NQ))z("}")}}return z("return m")};function rU(X,Y,W,z){if(Y.resolvedType)if(Y.resolvedType instanceof NQ)X("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",z,W,z,z,W,z,z);else X("d%s=types[%i].toObject(m%s,o)",z,W,z);else{var F=!1;switch(Y.type){case"double":case"float":X("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",z,z,z,z);break;case"uint64":F=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":X('if(typeof m%s==="number")',z)("d%s=o.longs===String?String(m%s):m%s",z,z,z)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",z,z,z,z,F?"true":"",z);break;case"bytes":X("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",z,z,z,z,z);break;default:X("d%s=m%s",z,z);break}}return X}t50.toObject=function(Y){var W=Y.fieldsArray.slice().sort(J4.compareFieldsById);if(!W.length)return J4.codegen()("return {}");var z=J4.codegen(["m","o"],Y.name+"$toObject")("if(!o)")("o={}")("var d={}"),F=[],Q=[],J=[],Z=0;for(;Z<W.length;++Z)if(!W[Z].partOf)(W[Z].resolve().repeated?F:W[Z].map?Q:J).push(W[Z]);if(F.length){z("if(o.arrays||o.defaults){");for(Z=0;Z<F.length;++Z)z("d%s=[]",J4.safeProp(F[Z].name));z("}")}if(Q.length){z("if(o.objects||o.defaults){");for(Z=0;Z<Q.length;++Z)z("d%s={}",J4.safeProp(Q[Z].name));z("}")}if(J.length){z("if(o.defaults){");for(Z=0;Z<J.length;++Z){var K=J[Z],H=J4.safeProp(K.name);if(K.resolvedType instanceof NQ)z("d%s=o.enums===String?%j:%j",H,K.resolvedType.valuesById[K.typeDefault],K.typeDefault);else if(K.long)z("if(util.Long){")("var n=new util.Long(%i,%i,%j)",K.typeDefault.low,K.typeDefault.high,K.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",H)("}else")("d%s=o.longs===String?%j:%i",H,K.typeDefault.toString(),K.typeDefault.toNumber());else if(K.bytes){var G="["+Array.prototype.slice.call(K.typeDefault).join(",")+"]";z("if(o.bytes===String)d%s=%j",H,String.fromCharCode.apply(String,K.typeDefault))("else{")("d%s=%s",H,G)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",H,H)("}")}else z("d%s=%j",H,K.typeDefault)}z("}")}var q=!1;for(Z=0;Z<W.length;++Z){var K=W[Z],B=Y._fieldsArray.indexOf(K),H=J4.safeProp(K.name);if(K.map){if(!q)q=!0,z("var ks2");z("if(m%s&&(ks2=Object.keys(m%s)).length){",H,H)("d%s={}",H)("for(var j=0;j<ks2.length;++j){"),rU(z,K,B,H+"[ks2[j]]")("}")}else if(K.repeated)z("if(m%s&&m%s.length){",H,H)("d%s=[]",H)("for(var j=0;j<m%s.length;++j){",H),rU(z,K,B,H+"[j]")("}");else if(z("if(m%s!=null&&m.hasOwnProperty(%j)){",H,K.name),rU(z,K,B,H),K.partOf)z("if(o.oneofs)")("d%s=%j",J4.safeProp(K.partOf.name),K.name);z("}")}return z("return d")}});var tU=X0((e50)=>{var y01=e50,k01=PG();y01[".google.protobuf.Any"]={fromObject:function(X){if(X&&X["@type"]){var Y=X["@type"].substring(X["@type"].lastIndexOf("/")+1),W=this.lookup(Y);if(W){var z=X["@type"].charAt(0)==="."?X["@type"].slice(1):X["@type"];if(z.indexOf("/")===-1)z="/"+z;return this.create({type_url:z,value:W.encode(W.fromObject(X)).finish()})}}return this.fromObject(X)},toObject:function(X,Y){var W="type.googleapis.com/",z="",F="";if(Y&&Y.json&&X.type_url&&X.value){F=X.type_url.substring(X.type_url.lastIndexOf("/")+1),z=X.type_url.substring(0,X.type_url.lastIndexOf("/")+1);var Q=this.lookup(F);if(Q)X=Q.decode(X.value)}if(!(X instanceof this.ctor)&&X instanceof k01){var J=X.$type.toObject(X,Y),Z=X.$type.fullName[0]==="."?X.$type.fullName.slice(1):X.$type.fullName;if(z==="")z=W;return F=z+Z,J["@type"]=F,J}return this.toObject(X,Y)}}});var fG=X0((iD1,Y70)=>{Y70.exports=O6;var V8=qY();((O6.prototype=Object.create(V8.prototype)).constructor=O6).className="Type";var v01=j8(),XN=b7(),wG=R5(),j01=RG(),h01=LG(),sU=PG(),eU=OW(),_01=NW(),A9=e6(),x01=YN(),b01=lU(),u01=iU(),X70=oU(),m01=tU();function O6(X,Y){V8.call(this,X,Y),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}Object.defineProperties(O6.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var X=Object.keys(this.fields),Y=0;Y<X.length;++Y){var W=this.fields[X[Y]],z=W.id;if(this._fieldsById[z])throw Error("duplicate id "+z+" in "+this);this._fieldsById[z]=W}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=A9.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=A9.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=O6.generateConstructor(this)())},set:function(X){var Y=X.prototype;if(!(Y instanceof sU))(X.prototype=new sU).constructor=X,A9.merge(X.prototype,Y);X.$type=X.prototype.$type=this,A9.merge(X,sU,!0),this._ctor=X;var W=0;for(;W<this.fieldsArray.length;++W)this._fieldsArray[W].resolve();var z={};for(W=0;W<this.oneofsArray.length;++W)z[this._oneofsArray[W].resolve().name]={get:A9.oneOfGetter(this._oneofsArray[W].oneof),set:A9.oneOfSetter(this._oneofsArray[W].oneof)};if(W)Object.defineProperties(X.prototype,z)}}});O6.generateConstructor=function(Y){var W=A9.codegen(["p"],Y.name);for(var z=0,F;z<Y.fieldsArray.length;++z)if((F=Y._fieldsArray[z]).map)W("this%s={}",A9.safeProp(F.name));else if(F.repeated)W("this%s=[]",A9.safeProp(F.name));return W("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")};function SG(X){return X._fieldsById=X._fieldsArray=X._oneofsArray=null,delete X.encode,delete X.decode,delete X.verify,X}O6.fromJSON=function(Y,W){var z=new O6(Y,W.options);z.extensions=W.extensions,z.reserved=W.reserved;var F=Object.keys(W.fields),Q=0;for(;Q<F.length;++Q)z.add((typeof W.fields[F[Q]].keyType<"u"?j01.fromJSON:wG.fromJSON)(F[Q],W.fields[F[Q]]));if(W.oneofs)for(F=Object.keys(W.oneofs),Q=0;Q<F.length;++Q)z.add(XN.fromJSON(F[Q],W.oneofs[F[Q]]));if(W.nested)for(F=Object.keys(W.nested),Q=0;Q<F.length;++Q){var J=W.nested[F[Q]];z.add((J.id!==void 0?wG.fromJSON:J.fields!==void 0?O6.fromJSON:J.values!==void 0?v01.fromJSON:J.methods!==void 0?h01.fromJSON:V8.fromJSON)(F[Q],J))}if(W.extensions&&W.extensions.length)z.extensions=W.extensions;if(W.reserved&&W.reserved.length)z.reserved=W.reserved;if(W.group)z.group=!0;if(W.comment)z.comment=W.comment;if(W.edition)z._edition=W.edition;return z._defaultEdition="proto3",z};O6.prototype.toJSON=function(Y){var W=V8.prototype.toJSON.call(this,Y),z=Y?Boolean(Y.keepComments):!1;return A9.toObject(["edition",this._editionToJSON(),"options",W&&W.options||void 0,"oneofs",V8.arrayToJSON(this.oneofsArray,Y),"fields",V8.arrayToJSON(this.fieldsArray.filter(function(F){return!F.declaringField}),Y)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",W&&W.nested||void 0,"comment",z?this.comment:void 0])};O6.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;V8.prototype.resolveAll.call(this);var Y=this.oneofsArray;z=0;while(z<Y.length)Y[z++].resolve();var W=this.fieldsArray,z=0;while(z<W.length)W[z++].resolve();return this};O6.prototype._resolveFeaturesRecursive=function(Y){if(!this._needsRecursiveFeatureResolution)return this;return Y=this._edition||Y,V8.prototype._resolveFeaturesRecursive.call(this,Y),this.oneofsArray.forEach((W)=>{W._resolveFeatures(Y)}),this.fieldsArray.forEach((W)=>{W._resolveFeatures(Y)}),this};O6.prototype.get=function(Y){return this.fields[Y]||this.oneofs&&this.oneofs[Y]||this.nested&&this.nested[Y]||null};O6.prototype.add=function(Y){if(this.get(Y.name))throw Error("duplicate name '"+Y.name+"' in "+this);if(Y instanceof wG&&Y.extend===void 0){if(this._fieldsById?this._fieldsById[Y.id]:this.fieldsById[Y.id])throw Error("duplicate id "+Y.id+" in "+this);if(this.isReservedId(Y.id))throw Error("id "+Y.id+" is reserved in "+this);if(this.isReservedName(Y.name))throw Error("name '"+Y.name+"' is reserved in "+this);if(Y.parent)Y.parent.remove(Y);return this.fields[Y.name]=Y,Y.message=this,Y.onAdd(this),SG(this)}if(Y instanceof XN){if(!this.oneofs)this.oneofs={};return this.oneofs[Y.name]=Y,Y.onAdd(this),SG(this)}return V8.prototype.add.call(this,Y)};O6.prototype.remove=function(Y){if(Y instanceof wG&&Y.extend===void 0){if(!this.fields||this.fields[Y.name]!==Y)throw Error(Y+" is not a member of "+this);return delete this.fields[Y.name],Y.parent=null,Y.onRemove(this),SG(this)}if(Y instanceof XN){if(!this.oneofs||this.oneofs[Y.name]!==Y)throw Error(Y+" is not a member of "+this);return delete this.oneofs[Y.name],Y.parent=null,Y.onRemove(this),SG(this)}return V8.prototype.remove.call(this,Y)};O6.prototype.isReservedId=function(Y){return V8.isReservedId(this.reserved,Y)};O6.prototype.isReservedName=function(Y){return V8.isReservedName(this.reserved,Y)};O6.prototype.create=function(Y){return new this.ctor(Y)};O6.prototype.setup=function(){var Y=this.fullName,W=[];for(var z=0;z<this.fieldsArray.length;++z)W.push(this._fieldsArray[z].resolve().resolvedType);this.encode=x01(this)({Writer:_01,types:W,util:A9}),this.decode=b01(this)({Reader:eU,types:W,util:A9}),this.verify=u01(this)({types:W,util:A9}),this.fromObject=X70.fromObject(this)({types:W,util:A9}),this.toObject=X70.toObject(this)({types:W,util:A9});var F=m01[Y];if(F){var Q=Object.create(this);Q.fromObject=this.fromObject,this.fromObject=F.fromObject.bind(Q),Q.toObject=this.toObject,this.toObject=F.toObject.bind(Q)}return this};O6.prototype.encode=function(Y,W){return this.setup().encode(Y,W)};O6.prototype.encodeDelimited=function(Y,W){return this.encode(Y,W&&W.len?W.fork():W).ldelim()};O6.prototype.decode=function(Y,W){return this.setup().decode(Y,W)};O6.prototype.decodeDelimited=function(Y){if(!(Y instanceof eU))Y=eU.create(Y);return this.decode(Y,Y.uint32())};O6.prototype.verify=function(Y){return this.setup().verify(Y)};O6.prototype.fromObject=function(Y){return this.setup().fromObject(Y)};O6.prototype.toObject=function(Y,W){return this.setup().toObject(Y,W)};O6.d=function(Y){return function(z){A9.decorateType(z,Y)}}});var jG=X0((aD1,J70)=>{J70.exports=c9;var vG=qY();((c9.prototype=Object.create(vG.prototype)).constructor=c9).className="Root";var yG=R5(),ZN=j8(),g01=b7(),L5=e6(),QN,JN,AQ;function c9(X){vG.call(this,"",X),this.deferred=[],this.files=[],this._edition="proto2",this._fullyQualifiedObjects={}}c9.fromJSON=function(Y,W){if(!W)W=new c9;if(Y.options)W.setOptions(Y.options);return W.addJSON(Y.nested).resolveAll()};c9.prototype.resolvePath=L5.path.resolve;c9.prototype.fetch=L5.fetch;function Q70(){}c9.prototype.load=function X(Y,W,z){if(typeof W==="function")z=W,W=void 0;var F=this;if(!z)return L5.asPromise(X,F,Y,W);var Q=z===Q70;function J($,R){if(!z)return;if(Q)throw $;if(R)R.resolveAll();var E=z;z=null,E($,R)}function Z($){var R=$.lastIndexOf("google/protobuf/");if(R>-1){var E=$.substring(R);if(E in AQ)return E}return null}function K($,R){try{if(L5.isString(R)&&R.charAt(0)==="{")R=JSON.parse(R);if(!L5.isString(R))F.setOptions(R.options).addJSON(R.nested);else{JN.filename=$;var E=JN(R,F,W),U,A=0;if(E.imports){for(;A<E.imports.length;++A)if(U=Z(E.imports[A])||F.resolvePath($,E.imports[A]))H(U)}if(E.weakImports){for(A=0;A<E.weakImports.length;++A)if(U=Z(E.weakImports[A])||F.resolvePath($,E.weakImports[A]))H(U,!0)}}}catch(T){J(T)}if(!Q&&!G)J(null,F)}function H($,R){if($=Z($)||$,F.files.indexOf($)>-1)return;if(F.files.push($),$ in AQ){if(Q)K($,AQ[$]);else++G,setTimeout(function(){--G,K($,AQ[$])});return}if(Q){var E;try{E=L5.fs.readFileSync($).toString("utf8")}catch(U){if(!R)J(U);return}K($,E)}else++G,F.fetch($,function(U,A){if(--G,!z)return;if(U){if(!R)J(U);else if(!G)J(null,F);return}K($,A)})}var G=0;if(L5.isString(Y))Y=[Y];for(var q=0,B;q<Y.length;++q)if(B=F.resolvePath("",Y[q]))H(B);if(Q)return F.resolveAll(),F;if(!G)J(null,F);return F};c9.prototype.loadSync=function(Y,W){if(!L5.isNode)throw Error("not supported");return this.load(Y,W,Q70)};c9.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(Y){return"'extend "+Y.extend+"' in "+Y.parent.fullName}).join(", "));return vG.prototype.resolveAll.call(this)};var kG=/^[A-Z]/;function Z70(X,Y){var W=Y.parent.lookup(Y.extend);if(W){var z=new yG(Y.fullName,Y.id,Y.type,Y.rule,void 0,Y.options);if(W.get(z.name))return!0;return z.declaringField=Y,Y.extensionField=z,W.add(z),!0}return!1}c9.prototype._handleAdd=function(Y){if(Y instanceof yG){if(Y.extend!==void 0&&!Y.extensionField){if(!Z70(this,Y))this.deferred.push(Y)}}else if(Y instanceof ZN){if(kG.test(Y.name))Y.parent[Y.name]=Y.values}else if(!(Y instanceof g01)){if(Y instanceof QN)for(var W=0;W<this.deferred.length;)if(Z70(this,this.deferred[W]))this.deferred.splice(W,1);else++W;for(var z=0;z<Y.nestedArray.length;++z)this._handleAdd(Y._nestedArray[z]);if(kG.test(Y.name))Y.parent[Y.name]=Y}if(Y instanceof QN||Y instanceof ZN||Y instanceof yG)this._fullyQualifiedObjects[Y.fullName]=Y};c9.prototype._handleRemove=function(Y){if(Y instanceof yG){if(Y.extend!==void 0)if(Y.extensionField)Y.extensionField.parent.remove(Y.extensionField),Y.extensionField=null;else{var W=this.deferred.indexOf(Y);if(W>-1)this.deferred.splice(W,1)}}else if(Y instanceof ZN){if(kG.test(Y.name))delete Y.parent[Y.name]}else if(Y instanceof vG){for(var z=0;z<Y.nestedArray.length;++z)this._handleRemove(Y._nestedArray[z]);if(kG.test(Y.name))delete Y.parent[Y.name]}delete this._fullyQualifiedObjects[Y.fullName]};c9._configure=function(X,Y,W){QN=X,JN=Y,AQ=W}});var e6=X0((rD1,G70)=>{var h6=G70.exports=a8(),W70=aq(),WN,GN;h6.codegen=j50();h6.fetch=_50();h6.path=u50();h6.fs=h6.inquire("fs");h6.toArray=function(Y){if(Y){var W=Object.keys(Y),z=Array(W.length),F=0;while(F<W.length)z[F]=Y[W[F++]];return z}return[]};h6.toObject=function(Y){var W={},z=0;while(z<Y.length){var F=Y[z++],Q=Y[z++];if(Q!==void 0)W[F]=Q}return W};var d01=/\\/g,c01=/"/g;h6.isReserved=function(Y){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(Y)};h6.safeProp=function(Y){if(!/^[$\w_]+$/.test(Y)||h6.isReserved(Y))return'["'+Y.replace(d01,"\\\\").replace(c01,"\\\"")+'"]';return"."+Y};h6.ucFirst=function(Y){return Y.charAt(0).toUpperCase()+Y.substring(1)};var l01=/_([a-z])/g;h6.camelCase=function(Y){return Y.substring(0,1)+Y.substring(1).replace(l01,function(W,z){return z.toUpperCase()})};h6.compareFieldsById=function(Y,W){return Y.id-W.id};h6.decorateType=function(Y,W){if(Y.$type){if(W&&Y.$type.name!==W)h6.decorateRoot.remove(Y.$type),Y.$type.name=W,h6.decorateRoot.add(Y.$type);return Y.$type}if(!WN)WN=fG();var z=new WN(W||Y.name);return h6.decorateRoot.add(z),z.ctor=Y,Object.defineProperty(Y,"$type",{value:z,enumerable:!1}),Object.defineProperty(Y.prototype,"$type",{value:z,enumerable:!1}),z};var p01=0;h6.decorateEnum=function(Y){if(Y.$type)return Y.$type;if(!GN)GN=j8();var W=new GN("Enum"+p01++,Y);return h6.decorateRoot.add(W),Object.defineProperty(Y,"$type",{value:W,enumerable:!1}),W};h6.setProperty=function(Y,W,z,F){function Q(J,Z,K){var H=Z.shift();if(H==="__proto__"||H==="prototype")return J;if(Z.length>0)J[H]=Q(J[H]||{},Z,K);else{var G=J[H];if(G&&F)return J;if(G)K=[].concat(G).concat(K);J[H]=K}return J}if(typeof Y!=="object")throw TypeError("dst must be an object");if(!W)throw TypeError("path must be specified");return W=W.split("."),Q(Y,W,z)};Object.defineProperty(h6,"decorateRoot",{get:function(){return W70.decorated||(W70.decorated=new(jG()))}})});var u7=X0((K70)=>{var OQ=K70,n01=e6(),i01=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function TQ(X,Y){var W=0,z={};Y|=0;while(W<X.length)z[i01[W+Y]]=X[W++];return z}OQ.basic=TQ([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]);OQ.defaults=TQ([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",n01.emptyArray,null]);OQ.long=TQ([0,0,0,1,1],7);OQ.mapKey=TQ([0,0,0,5,5,0,0,0,1,1,0,2],2);OQ.packed=TQ([1,5,0,0,0,5,5,0,0,0,1,1,0])});var R5=X0((tD1,z70)=>{z70.exports=X9;var $Q=M5();((X9.prototype=Object.create($Q.prototype)).constructor=X9).className="Field";var F70=j8(),KN=u7(),c6=e6(),IQ,a01=/^required|optional|repeated$/;X9.fromJSON=function(Y,W){var z=new X9(Y,W.id,W.type,W.rule,W.extend,W.options,W.comment);if(W.edition)z._edition=W.edition;return z._defaultEdition="proto3",z};function X9(X,Y,W,z,F,Q,J){if(c6.isObject(z))J=F,Q=z,z=F=void 0;else if(c6.isObject(F))J=Q,Q=F,F=void 0;if($Q.call(this,X,Q),!c6.isInteger(Y)||Y<0)throw TypeError("id must be a non-negative integer");if(!c6.isString(W))throw TypeError("type must be a string");if(z!==void 0&&!a01.test(z=z.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(F!==void 0&&!c6.isString(F))throw TypeError("extend must be a string");if(z==="proto3_optional")z="optional";this.rule=z&&z!=="optional"?z:void 0,this.type=W,this.id=Y,this.extend=F||void 0,this.repeated=z==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=c6.Long?KN.long[W]!==void 0:!1,this.bytes=W==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=J}Object.defineProperty(X9.prototype,"required",{get:function(){return this._features.field_presence==="LEGACY_REQUIRED"}});Object.defineProperty(X9.prototype,"optional",{get:function(){return!this.required}});Object.defineProperty(X9.prototype,"delimited",{get:function(){return this.resolvedType instanceof IQ&&this._features.message_encoding==="DELIMITED"}});Object.defineProperty(X9.prototype,"packed",{get:function(){return this._features.repeated_field_encoding==="PACKED"}});Object.defineProperty(X9.prototype,"hasPresence",{get:function(){if(this.repeated||this.map)return!1;return this.partOf||this.declaringField||this.extensionField||this._features.field_presence!=="IMPLICIT"}});X9.prototype.setOption=function(Y,W,z){return $Q.prototype.setOption.call(this,Y,W,z)};X9.prototype.toJSON=function(Y){var W=Y?Boolean(Y.keepComments):!1;return c6.toObject(["edition",this._editionToJSON(),"rule",this.rule!=="optional"&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",W?this.comment:void 0])};X9.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=KN.defaults[this.type])===void 0)if(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof IQ)this.typeDefault=null;else this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]];else if(this.options&&this.options.proto3_optional)this.typeDefault=null;if(this.options&&this.options.default!=null){if(this.typeDefault=this.options.default,this.resolvedType instanceof F70&&typeof this.typeDefault==="string")this.typeDefault=this.resolvedType.values[this.typeDefault]}if(this.options){if(this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof F70))delete this.options.packed;if(!Object.keys(this.options).length)this.options=void 0}if(this.long){if(this.typeDefault=c6.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze)Object.freeze(this.typeDefault)}else if(this.bytes&&typeof this.typeDefault==="string"){var Y;if(c6.base64.test(this.typeDefault))c6.base64.decode(this.typeDefault,Y=c6.newBuffer(c6.base64.length(this.typeDefault)),0);else c6.utf8.write(this.typeDefault,Y=c6.newBuffer(c6.utf8.length(this.typeDefault)),0);this.typeDefault=Y}if(this.map)this.defaultValue=c6.emptyObject;else if(this.repeated)this.defaultValue=c6.emptyArray;else this.defaultValue=this.typeDefault;if(this.parent instanceof IQ)this.parent.ctor.prototype[this.name]=this.defaultValue;return $Q.prototype.resolve.call(this)};X9.prototype._inferLegacyProtoFeatures=function(Y){if(Y!=="proto2"&&Y!=="proto3")return{};var W={};if(this.rule==="required")W.field_presence="LEGACY_REQUIRED";if(this.parent&&KN.defaults[this.type]===void 0){var z=this.parent.get(this.type.split(".").pop());if(z&&z instanceof IQ&&z.group)W.message_encoding="DELIMITED"}if(this.getOption("packed")===!0)W.repeated_field_encoding="PACKED";else if(this.getOption("packed")===!1)W.repeated_field_encoding="EXPANDED";return W};X9.prototype._resolveFeatures=function(Y){return $Q.prototype._resolveFeatures.call(this,this._edition||Y)};X9.d=function(Y,W,z,F){if(typeof W==="function")W=c6.decorateType(W).name;else if(W&&typeof W==="object")W=c6.decorateEnum(W).name;return function(J,Z){c6.decorateType(J.constructor).add(new X9(Z,Y,W,z,{default:F}))}};X9._configure=function(Y){IQ=Y}});var b7=X0((sD1,V70)=>{V70.exports=l9;var _G=M5();((l9.prototype=Object.create(_G.prototype)).constructor=l9).className="OneOf";var q70=R5(),hG=e6();function l9(X,Y,W,z){if(!Array.isArray(Y))W=Y,Y=void 0;if(_G.call(this,X,W),!(Y===void 0||Array.isArray(Y)))throw TypeError("fieldNames must be an Array");this.oneof=Y||[],this.fieldsArray=[],this.comment=z}l9.fromJSON=function(Y,W){return new l9(Y,W.oneof,W.options,W.comment)};l9.prototype.toJSON=function(Y){var W=Y?Boolean(Y.keepComments):!1;return hG.toObject(["options",this.options,"oneof",this.oneof,"comment",W?this.comment:void 0])};function H70(X){if(X.parent){for(var Y=0;Y<X.fieldsArray.length;++Y)if(!X.fieldsArray[Y].parent)X.parent.add(X.fieldsArray[Y])}}l9.prototype.add=function(Y){if(!(Y instanceof q70))throw TypeError("field must be a Field");if(Y.parent&&Y.parent!==this.parent)Y.parent.remove(Y);return this.oneof.push(Y.name),this.fieldsArray.push(Y),Y.partOf=this,H70(this),this};l9.prototype.remove=function(Y){if(!(Y instanceof q70))throw TypeError("field must be a Field");var W=this.fieldsArray.indexOf(Y);if(W<0)throw Error(Y+" is not a member of "+this);if(this.fieldsArray.splice(W,1),W=this.oneof.indexOf(Y.name),W>-1)this.oneof.splice(W,1);return Y.partOf=null,this};l9.prototype.onAdd=function(Y){_G.prototype.onAdd.call(this,Y);var W=this;for(var z=0;z<this.oneof.length;++z){var F=Y.get(this.oneof[z]);if(F&&!F.partOf)F.partOf=W,W.fieldsArray.push(F)}H70(this)};l9.prototype.onRemove=function(Y){for(var W=0,z;W<this.fieldsArray.length;++W)if((z=this.fieldsArray[W]).parent)z.parent.remove(z);_G.prototype.onRemove.call(this,Y)};Object.defineProperty(l9.prototype,"isProto3Optional",{get:function(){if(this.fieldsArray==null||this.fieldsArray.length!==1)return!1;var X=this.fieldsArray[0];return X.options!=null&&X.options.proto3_optional===!0}});l9.d=function(){var Y=Array(arguments.length),W=0;while(W<arguments.length)Y[W]=arguments[W++];return function(F,Q){hG.decorateType(F.constructor).add(new l9(Q,Y)),Object.defineProperty(F,Q,{get:hG.oneOfGetter(Y),set:hG.oneOfSetter(Y)})}}});var M5=X0((eD1,B70)=>{B70.exports=V9;V9.className="ReflectionObject";var r01=b7(),DQ=e6(),xG,o01={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},t01={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},s01={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function V9(X,Y){if(!DQ.isString(X))throw TypeError("name must be a string");if(Y&&!DQ.isObject(Y))throw TypeError("options must be an object");this.options=Y,this.parsedOptions=null,this.name=X,this._edition=null,this._defaultEdition="proto2",this._features={},this._featuresResolved=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(V9.prototype,{root:{get:function(){var X=this;while(X.parent!==null)X=X.parent;return X}},fullName:{get:function(){var X=[this.name],Y=this.parent;while(Y)X.unshift(Y.name),Y=Y.parent;return X.join(".")}}});V9.prototype.toJSON=function(){throw Error()};V9.prototype.onAdd=function(Y){if(this.parent&&this.parent!==Y)this.parent.remove(this);this.parent=Y,this.resolved=!1;var W=Y.root;if(W instanceof xG)W._handleAdd(this)};V9.prototype.onRemove=function(Y){var W=Y.root;if(W instanceof xG)W._handleRemove(this);this.parent=null,this.resolved=!1};V9.prototype.resolve=function(){if(this.resolved)return this;if(this.root instanceof xG)this.resolved=!0;return this};V9.prototype._resolveFeaturesRecursive=function(Y){return this._resolveFeatures(this._edition||Y)};V9.prototype._resolveFeatures=function(Y){if(this._featuresResolved)return;var W={};if(!Y)throw Error("Unknown edition for "+this.fullName);var z=Object.assign(this.options?Object.assign({},this.options.features):{},this._inferLegacyProtoFeatures(Y));if(this._edition){if(Y==="proto2")W=Object.assign({},t01);else if(Y==="proto3")W=Object.assign({},s01);else if(Y==="2023")W=Object.assign({},o01);else throw Error("Unknown edition: "+Y);this._features=Object.assign(W,z||{}),this._featuresResolved=!0;return}if(this.partOf instanceof r01){var F=Object.assign({},this.partOf._features);this._features=Object.assign(F,z||{})}else if(this.declaringField);else if(this.parent){var Q=Object.assign({},this.parent._features);this._features=Object.assign(Q,z||{})}else throw Error("Unable to find a parent for "+this.fullName);if(this.extensionField)this.extensionField._features=this._features;this._featuresResolved=!0};V9.prototype._inferLegacyProtoFeatures=function(){return{}};V9.prototype.getOption=function(Y){if(this.options)return this.options[Y];return};V9.prototype.setOption=function(Y,W,z){if(!this.options)this.options={};if(/^features\./.test(Y))DQ.setProperty(this.options,Y,W,z);else if(!z||this.options[Y]===void 0){if(this.getOption(Y)!==W)this.resolved=!1;this.options[Y]=W}return this};V9.prototype.setParsedOption=function(Y,W,z){if(!this.parsedOptions)this.parsedOptions=[];var F=this.parsedOptions;if(z){var Q=F.find(function(K){return Object.prototype.hasOwnProperty.call(K,Y)});if(Q){var J=Q[Y];DQ.setProperty(J,z,W)}else Q={},Q[Y]=DQ.setProperty({},z,W),F.push(Q)}else{var Z={};Z[Y]=W,F.push(Z)}return this};V9.prototype.setOptions=function(Y,W){if(Y)for(var z=Object.keys(Y),F=0;F<z.length;++F)this.setOption(z[F],Y[z[F]],W);return this};V9.prototype.toString=function(){var Y=this.constructor.className,W=this.fullName;if(W.length)return Y+" "+W;return Y};V9.prototype._editionToJSON=function(){if(!this._edition||this._edition==="proto3")return;return this._edition};V9._configure=function(X){xG=X}});var j8=X0((XE1,N70)=>{N70.exports=h8;var FN=M5();((h8.prototype=Object.create(FN.prototype)).constructor=h8).className="Enum";var U70=qY(),bG=e6();function h8(X,Y,W,z,F,Q){if(FN.call(this,X,W),Y&&typeof Y!=="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=z,this.comments=F||{},this.valuesOptions=Q,this._valuesFeatures={},this.reserved=void 0,Y){for(var J=Object.keys(Y),Z=0;Z<J.length;++Z)if(typeof Y[J[Z]]==="number")this.valuesById[this.values[J[Z]]=Y[J[Z]]]=J[Z]}}h8.prototype._resolveFeatures=function(Y){return Y=this._edition||Y,FN.prototype._resolveFeatures.call(this,Y),Object.keys(this.values).forEach((W)=>{var z=Object.assign({},this._features);this._valuesFeatures[W]=Object.assign(z,this.valuesOptions&&this.valuesOptions[W]&&this.valuesOptions[W].features)}),this};h8.fromJSON=function(Y,W){var z=new h8(Y,W.values,W.options,W.comment,W.comments);if(z.reserved=W.reserved,W.edition)z._edition=W.edition;return z._defaultEdition="proto3",z};h8.prototype.toJSON=function(Y){var W=Y?Boolean(Y.keepComments):!1;return bG.toObject(["edition",this._editionToJSON(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",W?this.comment:void 0,"comments",W?this.comments:void 0])};h8.prototype.add=function(Y,W,z,F){if(!bG.isString(Y))throw TypeError("name must be a string");if(!bG.isInteger(W))throw TypeError("id must be an integer");if(this.values[Y]!==void 0)throw Error("duplicate name '"+Y+"' in "+this);if(this.isReservedId(W))throw Error("id "+W+" is reserved in "+this);if(this.isReservedName(Y))throw Error("name '"+Y+"' is reserved in "+this);if(this.valuesById[W]!==void 0){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+W+" in "+this);this.values[Y]=W}else this.valuesById[this.values[Y]=W]=Y;if(F){if(this.valuesOptions===void 0)this.valuesOptions={};this.valuesOptions[Y]=F||null}return this.comments[Y]=z||null,this};h8.prototype.remove=function(Y){if(!bG.isString(Y))throw TypeError("name must be a string");var W=this.values[Y];if(W==null)throw Error("name '"+Y+"' does not exist in "+this);if(delete this.valuesById[W],delete this.values[Y],delete this.comments[Y],this.valuesOptions)delete this.valuesOptions[Y];return this};h8.prototype.isReservedId=function(Y){return U70.isReservedId(this.reserved,Y)};h8.prototype.isReservedName=function(Y){return U70.isReservedName(this.reserved,Y)}});var YN=X0((YE1,O70)=>{O70.exports=X11;var e01=j8(),zN=u7(),qN=e6();function A70(X,Y,W,z){return Y.delimited?X("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",W,z,(Y.id<<3|3)>>>0,(Y.id<<3|4)>>>0):X("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",W,z,(Y.id<<3|2)>>>0)}function X11(X){var Y=qN.codegen(["m","w"],X.name+"$encode")("if(!w)")("w=Writer.create()"),W,z,F=X.fieldsArray.slice().sort(qN.compareFieldsById);for(var W=0;W<F.length;++W){var Q=F[W].resolve(),J=X._fieldsArray.indexOf(Q),Z=Q.resolvedType instanceof e01?"int32":Q.type,K=zN.basic[Z];if(z="m"+qN.safeProp(Q.name),Q.map){if(Y("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",z,Q.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",z)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(Q.id<<3|2)>>>0,8|zN.mapKey[Q.keyType],Q.keyType),K===void 0)Y("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",J,z);else Y(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|K,Z,z);Y("}")("}")}else if(Q.repeated){if(Y("if(%s!=null&&%s.length){",z,z),Q.packed&&zN.packed[Z]!==void 0)Y("w.uint32(%i).fork()",(Q.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",z)("w.%s(%s[i])",Z,z)("w.ldelim()");else if(Y("for(var i=0;i<%s.length;++i)",z),K===void 0)A70(Y,Q,J,z+"[i]");else Y("w.uint32(%i).%s(%s[i])",(Q.id<<3|K)>>>0,Z,z);Y("}")}else{if(Q.optional)Y("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",z,Q.name);if(K===void 0)A70(Y,Q,J,z);else Y("w.uint32(%i).%s(%s)",(Q.id<<3|K)>>>0,Z,z)}}return Y("return w")}});var I70=X0((ZE1,T70)=>{var Y6=T70.exports=rq();Y6.build="light";function Y11(X,Y,W){if(typeof Y==="function")W=Y,Y=new Y6.Root;else if(!Y)Y=new Y6.Root;return Y.load(X,W)}Y6.load=Y11;function Z11(X,Y){if(!Y)Y=new Y6.Root;return Y.loadSync(X)}Y6.loadSync=Z11;Y6.encoder=YN();Y6.decoder=lU();Y6.verifier=iU();Y6.converter=oU();Y6.ReflectionObject=M5();Y6.Namespace=qY();Y6.Root=jG();Y6.Enum=j8();Y6.Type=fG();Y6.Field=R5();Y6.OneOf=b7();Y6.MapField=RG();Y6.Service=LG();Y6.Method=MG();Y6.Message=PG();Y6.wrappers=tU();Y6.types=u7();Y6.util=e6();Y6.ReflectionObject._configure(Y6.Root);Y6.Namespace._configure(Y6.Type,Y6.Service,Y6.Enum);Y6.Root._configure(Y6.Type);Y6.Field._configure(Y6.Type)});var VN=X0((QE1,E70)=>{E70.exports=D70;var HN=/[\s{}=;:[\],'"()<>]/g,Q11=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,J11=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,W11=/^ *[*/]+ */,G11=/^\s*\*?\/*/,K11=/\n/g,F11=/\s/,z11=/\\(.?)/g,q11={"0":"\x00",r:"\r",n:`
481
481
  `,t:"\t"};function $70(X){return X.replace(z11,function(Y,W){switch(W){case"\\":case"":return W;default:return q11[W]||""}})}D70.unescape=$70;function D70(X,Y){X=X.toString();var W=0,z=X.length,F=1,Q=0,J={},Z=[],K=null;function H(C){return Error("illegal "+C+" (line "+F+")")}function G(){var C=K==="'"?J11:Q11;C.lastIndex=W-1;var M=C.exec(X);if(!M)throw H("string");return W=C.lastIndex,U(K),K=null,$70(M[1])}function q(C){return X.charAt(C)}function B(C,M,w){var P={type:X.charAt(C++),lineEmpty:!1,leading:w},y;if(Y)y=2;else y=3;var v=C-y,f;do if(--v<0||(f=X.charAt(v))===`
482
482
  `){P.lineEmpty=!0;break}while(f===" "||f==="\t");var _=X.substring(C,M).split(K11);for(var b=0;b<_.length;++b)_[b]=_[b].replace(Y?G11:W11,"").trim();P.text=_.join(`
483
483
  `).trim(),J[F]=P,Q=F}function $(C){var M=R(C),w=X.substring(C,M),P=/^\s*\/\//.test(w);return P}function R(C){var M=C;while(M<z&&q(M)!==`
484
484
  `)M++;return M}function E(){if(Z.length>0)return Z.shift();if(K)return G();var C,M,w,P,y,v=W===0;do{if(W===z)return null;C=!1;while(F11.test(w=q(W))){if(w===`
485
485
  `)v=!0,++F;if(++W===z)return null}if(q(W)==="/"){if(++W===z)throw H("comment");if(q(W)==="/")if(!Y){y=q(P=W+1)==="/";while(q(++W)!==`
486
486
  `)if(W===z)return null;if(++W,y)B(P,W-1,v),v=!0;++F,C=!0}else{if(P=W,y=!1,$(W-1)){y=!0;do{if(W=R(W),W===z)break;if(W++,!v)break}while($(W))}else W=Math.min(z,R(W)+1);if(y)B(P,W,v),v=!0;F++,C=!0}else if((w=q(W))==="*"){P=W+1,y=Y||q(P)==="*";do{if(w===`
487
- `)++F;if(++W===z)throw H("comment");M=w,w=q(W)}while(M!=="*"||w!=="/");if(++W,y)B(P,W-2,v),v=!0;C=!0}else return"/"}}while(C);var f=W;HN.lastIndex=0;var _=HN.test(q(f++));if(!_)while(f<z&&!HN.test(q(f)))++f;var b=X.substring(W,W=f);if(b==='"'||b==="'")K=b;return b}function U(C){Z.push(C)}function A(){if(!Z.length){var C=E();if(C===null)return null;U(C)}return Z[0]}function T(C,M){var w=A(),P=w===C;if(P)return E(),!0;if(!M)throw H("token '"+w+"', '"+C+"' expected");return!1}function I(C){var M=null,w;if(C===void 0){if(w=J[F-1],delete J[F-1],w&&(Y||w.type==="*"||w.lineEmpty))M=w.leading?w.text:null}else{if(Q<C)A();if(w=J[C],delete J[C],w&&!w.lineEmpty&&(Y||w.type==="/"))M=w.leading?null:w.text}return M}return Object.defineProperty({next:E,peek:A,push:U,skip:T,cmnt:I},"line",{get:function(){return F}})}});var w70=X0((XE1,P70)=>{P70.exports=c4;c4.filename=null;c4.defaults={keepCase:!1};var H11=VN(),C70=jG(),R70=fG(),M70=R5(),V11=RG(),L70=b7(),B11=j8(),U11=LG(),N11=MG(),A11=M5(),O11=u7(),BN=e6(),T11=/^[1-9][0-9]*$/,I11=/^-?[1-9][0-9]*$/,$11=/^0[x][0-9a-fA-F]+$/,D11=/^-?0[x][0-9a-fA-F]+$/,E11=/^0[0-7]+$/,C11=/^-?0[0-7]+$/,R11=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,W4=/^[a-zA-Z_][a-zA-Z_0-9]*$/,G4=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;function c4(X,Y,W){if(!(Y instanceof C70))W=Y,Y=new C70;if(!W)W=c4.defaults;var z=W.preferTrailingComment||!1,F=H11(X,W.alternateCommentMode||!1),Q=F.next,J=F.push,Z=F.peek,K=F.skip,H=F.cmnt,G=!0,q,B,$,R="proto2",E=Y,U=[],A={},T=W.keepCase?function(T0){return T0}:BN.camelCase;function I(){U.forEach((T0)=>{T0._edition=R,Object.keys(A).forEach((U0)=>{if(T0.getOption(U0)!==void 0)return;T0.setOption(U0,A[U0],!0)})})}function C(T0,U0,Y0){var K0=c4.filename;if(!Y0)c4.filename=null;return Error("illegal "+(U0||"token")+" '"+T0+"' ("+(K0?K0+", ":"")+"line "+F.line+")")}function M(){var T0=[],U0;do{if((U0=Q())!=='"'&&U0!=="'")throw C(U0);T0.push(Q()),K(U0),U0=Z()}while(U0==='"'||U0==="'");return T0.join("")}function w(T0){var U0=Q();switch(U0){case"'":case'"':return J(U0),M();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return y(U0,!0)}catch(Y0){if(T0&&G4.test(U0))return U0;throw C(U0,"value")}}function P(T0,U0){var Y0,K0;do if(U0&&((Y0=Z())==='"'||Y0==="'")){var N0=M();if(T0.push(N0),R>=2023)throw C(N0,"id")}else try{T0.push([K0=v(Q()),K("to",!0)?v(Q()):K0])}catch(O0){if(U0&&G4.test(Y0)&&R>=2023)T0.push(Y0);else throw O0}while(K(",",!0));var M0={options:void 0};M0.setOption=function(O0,$0){if(this.options===void 0)this.options={};this.options[O0]=$0},l(M0,function($0){if($0==="option")e(M0,$0),K(";");else throw C($0)},function(){t(M0)})}function y(T0,U0){var Y0=1;if(T0.charAt(0)==="-")Y0=-1,T0=T0.substring(1);switch(T0){case"inf":case"INF":case"Inf":return Y0*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(T11.test(T0))return Y0*parseInt(T0,10);if($11.test(T0))return Y0*parseInt(T0,16);if(E11.test(T0))return Y0*parseInt(T0,8);if(R11.test(T0))return Y0*parseFloat(T0);throw C(T0,"number",U0)}function v(T0,U0){switch(T0){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!U0&&T0.charAt(0)==="-")throw C(T0,"id");if(I11.test(T0))return parseInt(T0,10);if(D11.test(T0))return parseInt(T0,16);if(C11.test(T0))return parseInt(T0,8);throw C(T0,"id")}function f(){if(q!==void 0)throw C("package");if(q=Q(),!G4.test(q))throw C(q,"name");E=E.define(q),K(";")}function _(){var T0=Z(),U0;switch(T0){case"weak":U0=$||($=[]),Q();break;case"public":Q();default:U0=B||(B=[]);break}T0=M(),K(";"),U0.push(T0)}function b(){if(K("="),R=M(),R<2023)throw C(R,"syntax");K(";")}function x(){if(K("="),R=M(),!["2023"].includes(R))throw C(R,"edition");K(";")}function k(T0,U0){switch(U0){case"option":return e(T0,U0),K(";"),!0;case"message":return Z0(T0,U0),!0;case"enum":return Q0(T0,U0),!0;case"service":return J0(T0,U0),!0;case"extend":return A0(T0,U0),!0}return!1}function l(T0,U0,Y0){var K0=F.line;if(T0){if(typeof T0.comment!=="string")T0.comment=H();T0.filename=c4.filename}if(K("{",!0)){var N0;while((N0=Q())!=="}")U0(N0);K(";",!0)}else{if(Y0)Y0();if(K(";"),T0&&(typeof T0.comment!=="string"||z))T0.comment=H(K0)||T0.comment}}function Z0(T0,U0){if(!W4.test(U0=Q()))throw C(U0,"type name");var Y0=new R70(U0);if(l(Y0,function(N0){if(k(Y0,N0))return;switch(N0){case"map":p(Y0,N0);break;case"required":if(R!=="proto2")throw C(N0);case"repeated":m(Y0,N0);break;case"optional":if(R==="proto3")m(Y0,"proto3_optional");else if(R!=="proto2")throw C(N0);else m(Y0,"optional");break;case"oneof":n(Y0,N0);break;case"extensions":P(Y0.extensions||(Y0.extensions=[]));break;case"reserved":P(Y0.reserved||(Y0.reserved=[]),!0);break;default:if(R==="proto2"||!G4.test(N0))throw C(N0);J(N0),m(Y0,"optional");break}}),T0.add(Y0),T0===E)U.push(Y0)}function m(T0,U0,Y0){var K0=Q();if(K0==="group"){h(T0,U0);return}while(K0.endsWith(".")||Z().startsWith("."))K0+=Q();if(!G4.test(K0))throw C(K0,"type");var N0=Q();if(!W4.test(N0))throw C(N0,"name");N0=T(N0),K("=");var M0=new M70(N0,v(Q()),K0,U0,Y0);if(l(M0,function(R0){if(R0==="option")e(M0,R0),K(";");else throw C(R0)},function(){t(M0)}),U0==="proto3_optional"){var O0=new L70("_"+N0);M0.setOption("proto3_optional",!0),O0.add(M0),T0.add(O0)}else T0.add(M0);if(T0===E)U.push(M0)}function h(T0,U0){if(R>=2023)throw C("group");var Y0=Q();if(!W4.test(Y0))throw C(Y0,"name");var K0=BN.lcFirst(Y0);if(Y0===K0)Y0=BN.ucFirst(Y0);K("=");var N0=v(Q()),M0=new R70(Y0);M0.group=!0;var O0=new M70(K0,N0,Y0,U0);O0.filename=c4.filename,l(M0,function(R0){switch(R0){case"option":e(M0,R0),K(";");break;case"required":case"repeated":m(M0,R0);break;case"optional":if(R==="proto3")m(M0,"proto3_optional");else m(M0,"optional");break;case"message":Z0(M0,R0);break;case"enum":Q0(M0,R0);break;case"reserved":P(M0.reserved||(M0.reserved=[]),!0);break;default:throw C(R0)}}),T0.add(M0).add(O0)}function p(T0){K("<");var U0=Q();if(O11.mapKey[U0]===void 0)throw C(U0,"type");K(",");var Y0=Q();if(!G4.test(Y0))throw C(Y0,"type");K(">");var K0=Q();if(!W4.test(K0))throw C(K0,"name");K("=");var N0=new V11(T(K0),v(Q()),U0,Y0);l(N0,function(O0){if(O0==="option")e(N0,O0),K(";");else throw C(O0)},function(){t(N0)}),T0.add(N0)}function n(T0,U0){if(!W4.test(U0=Q()))throw C(U0,"name");var Y0=new L70(T(U0));l(Y0,function(N0){if(N0==="option")e(Y0,N0),K(";");else J(N0),m(Y0,"optional")}),T0.add(Y0)}function Q0(T0,U0){if(!W4.test(U0=Q()))throw C(U0,"name");var Y0=new B11(U0);if(l(Y0,function(N0){switch(N0){case"option":e(Y0,N0),K(";");break;case"reserved":if(P(Y0.reserved||(Y0.reserved=[]),!0),Y0.reserved===void 0)Y0.reserved=[];break;default:c(Y0,N0)}}),T0.add(Y0),T0===E)U.push(Y0)}function c(T0,U0){if(!W4.test(U0))throw C(U0,"name");K("=");var Y0=v(Q(),!0),K0={options:void 0};K0.getOption=function(N0){return this.options[N0]},K0.setOption=function(N0,M0){A11.prototype.setOption.call(K0,N0,M0)},K0.setParsedOption=function(){return},l(K0,function(M0){if(M0==="option")e(K0,M0),K(";");else throw C(M0)},function(){t(K0)}),T0.add(U0,Y0,K0.comment,K0.parsedOptions||K0.options)}function e(T0,U0){var Y0,K0,N0=!0;if(U0==="option")U0=Q();while(U0!=="="){if(U0==="("){var M0=Q();K(")"),U0="("+M0+")"}if(N0){if(N0=!1,U0.includes(".")&&!U0.includes("(")){var O0=U0.split(".");Y0=O0[0]+".",U0=O0[1];continue}Y0=U0}else K0=K0?K0+=U0:U0;U0=Q()}var $0=K0?Y0.concat(K0):Y0,R0=g(T0,$0);K0=K0&&K0[0]==="."?K0.slice(1):K0,Y0=Y0&&Y0[Y0.length-1]==="."?Y0.slice(0,-1):Y0,r(T0,Y0,R0,K0)}function g(T0,U0){if(K("{",!0)){var Y0={};while(!K("}",!0)){if(!W4.test(L0=Q()))throw C(L0,"name");if(L0===null)throw C(L0,"end of input");var K0,N0=L0;if(K(":",!0),Z()==="{")K0=g(T0,U0+"."+L0);else if(Z()==="["){K0=[];var M0;if(K("[",!0)){do M0=w(!0),K0.push(M0);while(K(",",!0));if(K("]"),typeof M0<"u")u(T0,U0+"."+L0,M0)}}else K0=w(!0),u(T0,U0+"."+L0,K0);var O0=Y0[N0];if(O0)K0=[].concat(O0).concat(K0);Y0[N0]=K0,K(",",!0),K(";",!0)}return Y0}var $0=w(!0);return u(T0,U0,$0),$0}function u(T0,U0,Y0){if(E===T0&&/^features\./.test(U0)){A[U0]=Y0;return}if(T0.setOption)T0.setOption(U0,Y0)}function r(T0,U0,Y0,K0){if(T0.setParsedOption)T0.setParsedOption(U0,Y0,K0)}function t(T0){if(K("[",!0)){do e(T0,"option");while(K(",",!0));K("]")}return T0}function J0(T0,U0){if(!W4.test(U0=Q()))throw C(U0,"service name");var Y0=new U11(U0);if(l(Y0,function(N0){if(k(Y0,N0))return;if(N0==="rpc")V0(Y0,N0);else throw C(N0)}),T0.add(Y0),T0===E)U.push(Y0)}function V0(T0,U0){var Y0=H(),K0=U0;if(!W4.test(U0=Q()))throw C(U0,"name");var N0=U0,M0,O0,$0,R0;if(K("("),K("stream",!0))O0=!0;if(!G4.test(U0=Q()))throw C(U0);if(M0=U0,K(")"),K("returns"),K("("),K("stream",!0))R0=!0;if(!G4.test(U0=Q()))throw C(U0);$0=U0,K(")");var w0=new N11(N0,K0,M0,$0,O0,R0);w0.comment=Y0,l(w0,function(k0){if(k0==="option")e(w0,k0),K(";");else throw C(k0)}),T0.add(w0)}function A0(T0,U0){if(!G4.test(U0=Q()))throw C(U0,"reference");var Y0=U0;l(null,function(N0){switch(N0){case"required":case"repeated":m(T0,N0,Y0);break;case"optional":if(R==="proto3")m(T0,"proto3_optional",Y0);else m(T0,"optional",Y0);break;default:if(R==="proto2"||!G4.test(N0))throw C(N0);J(N0),m(T0,"optional",Y0);break}})}var L0;while((L0=Q())!==null)switch(L0){case"package":if(!G)throw C(L0);f();break;case"import":if(!G)throw C(L0);_();break;case"syntax":if(!G)throw C(L0);b();break;case"edition":if(!G)throw C(L0);x();break;case"option":e(E,L0),K(";",!0);break;default:if(k(E,L0)){G=!1;continue}throw C(L0)}return I(),c4.filename=null,{package:q,imports:B,weakImports:$,root:Y}}});var y70=X0((YE1,f70)=>{f70.exports=_8;var M11=/\/|\./;function _8(X,Y){if(!M11.test(X))X="google/protobuf/"+X+".proto",Y={nested:{google:{nested:{protobuf:{nested:Y}}}}};_8[X]=Y}_8("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var S70;_8("duration",{Duration:S70={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});_8("timestamp",{Timestamp:S70});_8("empty",{Empty:{fields:{}}});_8("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});_8("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});_8("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});_8.get=function(Y){return _8[Y]||null}});var uG=X0((ZE1,k70)=>{var P5=k70.exports=I70();P5.build="full";P5.tokenize=VN();P5.parse=w70();P5.common=y70();P5.Root._configure(P5.Type,P5.parse,P5.common)});var UN=X0((QE1,L11)=>{L11.exports={nested:{google:{nested:{protobuf:{options:{go_package:"google.golang.org/protobuf/types/descriptorpb",java_package:"com.google.protobuf",java_outer_classname:"DescriptorProtos",csharp_namespace:"Google.Protobuf.Reflection",objc_class_prefix:"GPB",cc_enable_arenas:!0,optimize_for:"SPEED"},nested:{FileDescriptorSet:{edition:"proto2",fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}},extensions:[[536000000,536000000]]},Edition:{edition:"proto2",values:{EDITION_UNKNOWN:0,EDITION_LEGACY:900,EDITION_PROTO2:998,EDITION_PROTO3:999,EDITION_2023:1000,EDITION_2024:1001,EDITION_1_TEST_ONLY:1,EDITION_2_TEST_ONLY:2,EDITION_99997_TEST_ONLY:99997,EDITION_99998_TEST_ONLY:99998,EDITION_99999_TEST_ONLY:99999,EDITION_MAX:2147483647}},FileDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},package:{type:"string",id:2},dependency:{rule:"repeated",type:"string",id:3},publicDependency:{rule:"repeated",type:"int32",id:10},weakDependency:{rule:"repeated",type:"int32",id:11},optionDependency:{rule:"repeated",type:"string",id:15},messageType:{rule:"repeated",type:"DescriptorProto",id:4},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:5},service:{rule:"repeated",type:"ServiceDescriptorProto",id:6},extension:{rule:"repeated",type:"FieldDescriptorProto",id:7},options:{type:"FileOptions",id:8},sourceCodeInfo:{type:"SourceCodeInfo",id:9},syntax:{type:"string",id:12},edition:{type:"Edition",id:14}}},DescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},field:{rule:"repeated",type:"FieldDescriptorProto",id:2},extension:{rule:"repeated",type:"FieldDescriptorProto",id:6},nestedType:{rule:"repeated",type:"DescriptorProto",id:3},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:4},extensionRange:{rule:"repeated",type:"ExtensionRange",id:5},oneofDecl:{rule:"repeated",type:"OneofDescriptorProto",id:8},options:{type:"MessageOptions",id:7},reservedRange:{rule:"repeated",type:"ReservedRange",id:9},reservedName:{rule:"repeated",type:"string",id:10},visibility:{type:"SymbolVisibility",id:11}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2},options:{type:"ExtensionRangeOptions",id:3}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},ExtensionRangeOptions:{edition:"proto2",fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999},declaration:{rule:"repeated",type:"Declaration",id:2,options:{retention:"RETENTION_SOURCE"}},features:{type:"FeatureSet",id:50},verification:{type:"VerificationState",id:3,options:{default:"UNVERIFIED",retention:"RETENTION_SOURCE"}}},extensions:[[1000,536870911]],nested:{Declaration:{fields:{number:{type:"int32",id:1},fullName:{type:"string",id:2},type:{type:"string",id:3},reserved:{type:"bool",id:5},repeated:{type:"bool",id:6}},reserved:[[4,4]]},VerificationState:{values:{DECLARATION:0,UNVERIFIED:1}}}},FieldDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:3},label:{type:"Label",id:4},type:{type:"Type",id:5},typeName:{type:"string",id:6},extendee:{type:"string",id:2},defaultValue:{type:"string",id:7},oneofIndex:{type:"int32",id:9},jsonName:{type:"string",id:10},options:{type:"FieldOptions",id:8},proto3Optional:{type:"bool",id:17}},nested:{Type:{values:{TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Label:{values:{LABEL_OPTIONAL:1,LABEL_REPEATED:3,LABEL_REQUIRED:2}}}},OneofDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3},reservedRange:{rule:"repeated",type:"EnumReservedRange",id:4},reservedName:{rule:"repeated",type:"string",id:5},visibility:{type:"SymbolVisibility",id:6}},nested:{EnumReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},EnumValueDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},inputType:{type:"string",id:2},outputType:{type:"string",id:3},options:{type:"MethodOptions",id:4},clientStreaming:{type:"bool",id:5},serverStreaming:{type:"bool",id:6}}},FileOptions:{edition:"proto2",fields:{javaPackage:{type:"string",id:1},javaOuterClassname:{type:"string",id:8},javaMultipleFiles:{type:"bool",id:10},javaGenerateEqualsAndHash:{type:"bool",id:20,options:{deprecated:!0}},javaStringCheckUtf8:{type:"bool",id:27},optimizeFor:{type:"OptimizeMode",id:9,options:{default:"SPEED"}},goPackage:{type:"string",id:11},ccGenericServices:{type:"bool",id:16},javaGenericServices:{type:"bool",id:17},pyGenericServices:{type:"bool",id:18},deprecated:{type:"bool",id:23},ccEnableArenas:{type:"bool",id:31,options:{default:!0}},objcClassPrefix:{type:"string",id:36},csharpNamespace:{type:"string",id:37},swiftPrefix:{type:"string",id:39},phpClassPrefix:{type:"string",id:40},phpNamespace:{type:"string",id:41},phpMetadataNamespace:{type:"string",id:44},rubyPackage:{type:"string",id:45},features:{type:"FeatureSet",id:50},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]],reserved:[[42,42],[38,38],"php_generic_services"],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{edition:"proto2",fields:{messageSetWireFormat:{type:"bool",id:1},noStandardDescriptorAccessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},mapEntry:{type:"bool",id:7},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:11,options:{deprecated:!0}},features:{type:"FeatureSet",id:12},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]],reserved:[[4,4],[5,5],[6,6],[8,8],[9,9]]},FieldOptions:{edition:"proto2",fields:{ctype:{type:"CType",id:1,options:{default:"STRING"}},packed:{type:"bool",id:2},jstype:{type:"JSType",id:6,options:{default:"JS_NORMAL"}},lazy:{type:"bool",id:5},unverifiedLazy:{type:"bool",id:15},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10,options:{deprecated:!0}},debugRedact:{type:"bool",id:16},retention:{type:"OptionRetention",id:17},targets:{rule:"repeated",type:"OptionTargetType",id:19},editionDefaults:{rule:"repeated",type:"EditionDefault",id:20},features:{type:"FeatureSet",id:21},featureSupport:{type:"FeatureSupport",id:22},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]],reserved:[[4,4],[18,18]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}},OptionRetention:{values:{RETENTION_UNKNOWN:0,RETENTION_RUNTIME:1,RETENTION_SOURCE:2}},OptionTargetType:{values:{TARGET_TYPE_UNKNOWN:0,TARGET_TYPE_FILE:1,TARGET_TYPE_EXTENSION_RANGE:2,TARGET_TYPE_MESSAGE:3,TARGET_TYPE_FIELD:4,TARGET_TYPE_ONEOF:5,TARGET_TYPE_ENUM:6,TARGET_TYPE_ENUM_ENTRY:7,TARGET_TYPE_SERVICE:8,TARGET_TYPE_METHOD:9}},EditionDefault:{fields:{edition:{type:"Edition",id:3},value:{type:"string",id:2}}},FeatureSupport:{fields:{editionIntroduced:{type:"Edition",id:1},editionDeprecated:{type:"Edition",id:2},deprecationWarning:{type:"string",id:3},editionRemoved:{type:"Edition",id:4}}}}},OneofOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:1},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]]},EnumOptions:{edition:"proto2",fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:6,options:{deprecated:!0}},features:{type:"FeatureSet",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]],reserved:[[5,5]]},EnumValueOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:1},features:{type:"FeatureSet",id:2},debugRedact:{type:"bool",id:3},featureSupport:{type:"FieldOptions.FeatureSupport",id:4},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]]},ServiceOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:34},deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]]},MethodOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:33},idempotencyLevel:{type:"IdempotencyLevel",id:34,options:{default:"IDEMPOTENCY_UNKNOWN"}},features:{type:"FeatureSet",id:35},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]],nested:{IdempotencyLevel:{values:{IDEMPOTENCY_UNKNOWN:0,NO_SIDE_EFFECTS:1,IDEMPOTENT:2}}}},UninterpretedOption:{edition:"proto2",fields:{name:{rule:"repeated",type:"NamePart",id:2},identifierValue:{type:"string",id:3},positiveIntValue:{type:"uint64",id:4},negativeIntValue:{type:"int64",id:5},doubleValue:{type:"double",id:6},stringValue:{type:"bytes",id:7},aggregateValue:{type:"string",id:8}},nested:{NamePart:{fields:{namePart:{rule:"required",type:"string",id:1},isExtension:{rule:"required",type:"bool",id:2}}}}},FeatureSet:{edition:"proto2",fields:{fieldPresence:{type:"FieldPresence",id:1,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},enumType:{type:"EnumType",id:2,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},repeatedFieldEncoding:{type:"RepeatedFieldEncoding",id:3,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},utf8Validation:{type:"Utf8Validation",id:4,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},messageEncoding:{type:"MessageEncoding",id:5,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_LEGACY","edition_defaults.value":"LENGTH_PREFIXED"}},jsonFormat:{type:"JsonFormat",id:6,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}},enforceNamingStyle:{type:"EnforceNamingStyle",id:7,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_METHOD","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"STYLE2024"}},defaultSymbolVisibility:{type:"VisibilityFeature.DefaultSymbolVisibility",id:8,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"EXPORT_TOP_LEVEL"}}},extensions:[[1000,9994],[9995,9999],[1e4,1e4]],reserved:[[999,999]],nested:{FieldPresence:{values:{FIELD_PRESENCE_UNKNOWN:0,EXPLICIT:1,IMPLICIT:2,LEGACY_REQUIRED:3}},EnumType:{values:{ENUM_TYPE_UNKNOWN:0,OPEN:1,CLOSED:2}},RepeatedFieldEncoding:{values:{REPEATED_FIELD_ENCODING_UNKNOWN:0,PACKED:1,EXPANDED:2}},Utf8Validation:{values:{UTF8_VALIDATION_UNKNOWN:0,VERIFY:2,NONE:3}},MessageEncoding:{values:{MESSAGE_ENCODING_UNKNOWN:0,LENGTH_PREFIXED:1,DELIMITED:2}},JsonFormat:{values:{JSON_FORMAT_UNKNOWN:0,ALLOW:1,LEGACY_BEST_EFFORT:2}},EnforceNamingStyle:{values:{ENFORCE_NAMING_STYLE_UNKNOWN:0,STYLE2024:1,STYLE_LEGACY:2}},VisibilityFeature:{fields:{},reserved:[[1,536870911]],nested:{DefaultSymbolVisibility:{values:{DEFAULT_SYMBOL_VISIBILITY_UNKNOWN:0,EXPORT_ALL:1,EXPORT_TOP_LEVEL:2,LOCAL_ALL:3,STRICT:4}}}}}},FeatureSetDefaults:{edition:"proto2",fields:{defaults:{rule:"repeated",type:"FeatureSetEditionDefault",id:1},minimumEdition:{type:"Edition",id:4},maximumEdition:{type:"Edition",id:5}},nested:{FeatureSetEditionDefault:{fields:{edition:{type:"Edition",id:3},overridableFeatures:{type:"FeatureSet",id:4},fixedFeatures:{type:"FeatureSet",id:5}},reserved:[[1,1],[2,2],"features"]}}},SourceCodeInfo:{edition:"proto2",fields:{location:{rule:"repeated",type:"Location",id:1}},extensions:[[536000000,536000000]],nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},span:{rule:"repeated",type:"int32",id:2,options:{packed:!0}},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{edition:"proto2",fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4},semantic:{type:"Semantic",id:5}},nested:{Semantic:{values:{NONE:0,SET:1,ALIAS:2}}}}}},SymbolVisibility:{edition:"proto2",values:{VISIBILITY_UNSET:0,VISIBILITY_LOCAL:1,VISIBILITY_EXPORT:2}}}}}}}}});var u70=X0((l1,b70)=>{var p9=uG();b70.exports=l1=p9.descriptor=p9.Root.fromJSON(UN()).lookup(".google.protobuf");var{Namespace:v70,Root:EQ,Enum:l4,Type:K4,Field:w5,MapField:P11,OneOf:mG,Service:CQ,Method:gG}=p9;EQ.fromDescriptor=function(Y){if(typeof Y.length==="number")Y=l1.FileDescriptorSet.decode(Y);var W=new EQ;if(Y.file){var z,F;for(var Q=0,J;Q<Y.file.length;++Q){if(F=W,(z=Y.file[Q]).package&&z.package.length)F=W.define(z.package);var Z=x11(z);if(z.name&&z.name.length)W.files.push(F.filename=z.name);if(z.messageType)for(J=0;J<z.messageType.length;++J)F.add(K4.fromDescriptor(z.messageType[J],Z));if(z.enumType)for(J=0;J<z.enumType.length;++J)F.add(l4.fromDescriptor(z.enumType[J],Z));if(z.extension)for(J=0;J<z.extension.length;++J)F.add(w5.fromDescriptor(z.extension[J],Z));if(z.service)for(J=0;J<z.service.length;++J)F.add(CQ.fromDescriptor(z.service[J],Z));var K=VY(z.options,l1.FileOptions);if(K){var H=Object.keys(K);for(J=0;J<H.length;++J)F.setOption(H[J],K[H[J]])}}}return W.resolveAll()};EQ.prototype.toDescriptor=function(Y){var W=l1.FileDescriptorSet.create();return j70(this,W.file,Y),W};function j70(X,Y,W){var z=l1.FileDescriptorProto.create({name:X.filename||(X.fullName.substring(1).replace(/\./g,"_")||"root")+".proto"});if(b11(W,z),!(X instanceof EQ))z.package=X.fullName.substring(1);for(var F=0,Q;F<X.nestedArray.length;++F)if((Q=X._nestedArray[F])instanceof K4)z.messageType.push(Q.toDescriptor(W));else if(Q instanceof l4)z.enumType.push(Q.toDescriptor());else if(Q instanceof w5)z.extension.push(Q.toDescriptor(W));else if(Q instanceof CQ)z.service.push(Q.toDescriptor());else if(Q instanceof v70)j70(Q,Y,W);if(z.options=BY(X.options,l1.FileOptions),z.messageType.length+z.enumType.length+z.extension.length+z.service.length)Y.push(z)}var w11=0;K4.fromDescriptor=function(Y,W,z){if(typeof Y.length==="number")Y=l1.DescriptorProto.decode(Y);var F=new K4(Y.name.length?Y.name:"Type"+w11++,VY(Y.options,l1.MessageOptions)),Q;if(!z)F._edition=W;if(Y.oneofDecl)for(Q=0;Q<Y.oneofDecl.length;++Q)F.add(mG.fromDescriptor(Y.oneofDecl[Q]));if(Y.field)for(Q=0;Q<Y.field.length;++Q){var J=w5.fromDescriptor(Y.field[Q],W,!0);if(F.add(J),Y.field[Q].hasOwnProperty("oneofIndex"))F.oneofsArray[Y.field[Q].oneofIndex].add(J)}if(Y.extension)for(Q=0;Q<Y.extension.length;++Q)F.add(w5.fromDescriptor(Y.extension[Q],W,!0));if(Y.nestedType){for(Q=0;Q<Y.nestedType.length;++Q)if(F.add(K4.fromDescriptor(Y.nestedType[Q],W,!0)),Y.nestedType[Q].options&&Y.nestedType[Q].options.mapEntry)F.setOption("map_entry",!0)}if(Y.enumType)for(Q=0;Q<Y.enumType.length;++Q)F.add(l4.fromDescriptor(Y.enumType[Q],W,!0));if(Y.extensionRange&&Y.extensionRange.length){F.extensions=[];for(Q=0;Q<Y.extensionRange.length;++Q)F.extensions.push([Y.extensionRange[Q].start,Y.extensionRange[Q].end])}if(Y.reservedRange&&Y.reservedRange.length||Y.reservedName&&Y.reservedName.length){if(F.reserved=[],Y.reservedRange)for(Q=0;Q<Y.reservedRange.length;++Q)F.reserved.push([Y.reservedRange[Q].start,Y.reservedRange[Q].end]);if(Y.reservedName)for(Q=0;Q<Y.reservedName.length;++Q)F.reserved.push(Y.reservedName[Q])}return F};K4.prototype.toDescriptor=function(Y){var W=l1.DescriptorProto.create({name:this.name}),z;for(z=0;z<this.fieldsArray.length;++z){var F;if(W.field.push(F=this._fieldsArray[z].toDescriptor(Y)),this._fieldsArray[z]instanceof P11){var Q=NN(this._fieldsArray[z].keyType,this._fieldsArray[z].resolvedKeyType,!1),J=NN(this._fieldsArray[z].type,this._fieldsArray[z].resolvedType,!1),Z=J===11||J===14?this._fieldsArray[z].resolvedType&&x70(this.parent,this._fieldsArray[z].resolvedType)||this._fieldsArray[z].type:void 0;W.nestedType.push(l1.DescriptorProto.create({name:F.typeName,field:[l1.FieldDescriptorProto.create({name:"key",number:1,label:1,type:Q}),l1.FieldDescriptorProto.create({name:"value",number:2,label:1,type:J,typeName:Z})],options:l1.MessageOptions.create({mapEntry:!0})}))}}for(z=0;z<this.oneofsArray.length;++z)W.oneofDecl.push(this._oneofsArray[z].toDescriptor());for(z=0;z<this.nestedArray.length;++z)if(this._nestedArray[z]instanceof w5)W.field.push(this._nestedArray[z].toDescriptor(Y));else if(this._nestedArray[z]instanceof K4)W.nestedType.push(this._nestedArray[z].toDescriptor(Y));else if(this._nestedArray[z]instanceof l4)W.enumType.push(this._nestedArray[z].toDescriptor());if(this.extensions)for(z=0;z<this.extensions.length;++z)W.extensionRange.push(l1.DescriptorProto.ExtensionRange.create({start:this.extensions[z][0],end:this.extensions[z][1]}));if(this.reserved)for(z=0;z<this.reserved.length;++z)if(typeof this.reserved[z]==="string")W.reservedName.push(this.reserved[z]);else W.reservedRange.push(l1.DescriptorProto.ReservedRange.create({start:this.reserved[z][0],end:this.reserved[z][1]}));return W.options=BY(this.options,l1.MessageOptions),W};var S11=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;w5.fromDescriptor=function(Y,W,z){if(typeof Y.length==="number")Y=l1.DescriptorProto.decode(Y);if(typeof Y.number!=="number")throw Error("missing field id");var F;if(Y.typeName&&Y.typeName.length)F=Y.typeName;else F=j11(Y.type);var Q;switch(Y.label){case 1:Q=void 0;break;case 2:Q="required";break;case 3:Q="repeated";break;default:throw Error("illegal label: "+Y.label)}var J=Y.extendee;if(Y.extendee!==void 0)J=J.length?J:void 0;var Z=new w5(Y.name.length?Y.name:"field"+Y.number,Y.number,F,Q,J);if(!z)Z._edition=W;if(Z.options=VY(Y.options,l1.FieldOptions),Y.proto3_optional)Z.options.proto3_optional=!0;if(Y.defaultValue&&Y.defaultValue.length){var K=Y.defaultValue;switch(K){case"true":case"TRUE":K=!0;break;case"false":case"FALSE":K=!1;break;default:var H=S11.exec(K);if(H)K=parseInt(K);break}Z.setOption("default",K)}if(h11(Y.type)){if(W==="proto3"){if(Y.options&&!Y.options.packed)Z.setOption("packed",!1)}else if((!W||W==="proto2")&&Y.options&&Y.options.packed)Z.setOption("packed",!0)}return Z};w5.prototype.toDescriptor=function(Y){var W=l1.FieldDescriptorProto.create({name:this.name,number:this.id});if(this.map)W.type=11,W.typeName=p9.util.ucFirst(this.name),W.label=3;else{switch(W.type=NN(this.type,this.resolve().resolvedType,this.delimited)){case 10:case 11:case 14:W.typeName=this.resolvedType?x70(this.parent,this.resolvedType):this.type;break}if(this.rule==="repeated")W.label=3;else if(this.required&&Y==="proto2")W.label=2;else W.label=1}if(W.extendee=this.extensionField?this.extensionField.parent.fullName:this.extend,this.partOf){if((W.oneofIndex=this.parent.oneofsArray.indexOf(this.partOf))<0)throw Error("missing oneof")}if(this.options){if(W.options=BY(this.options,l1.FieldOptions),this.options.default!=null)W.defaultValue=String(this.options.default);if(this.options.proto3_optional)W.proto3_optional=!0}if(Y==="proto3"){if(!this.packed)(W.options||(W.options=l1.FieldOptions.create())).packed=!1}else if((!Y||Y==="proto2")&&this.packed)(W.options||(W.options=l1.FieldOptions.create())).packed=!0;return W};var f11=0;l4.fromDescriptor=function(Y,W,z){if(typeof Y.length==="number")Y=l1.EnumDescriptorProto.decode(Y);var F={};if(Y.value)for(var Q=0;Q<Y.value.length;++Q){var J=Y.value[Q].name,Z=Y.value[Q].number||0;F[J&&J.length?J:"NAME"+Z]=Z}var K=new l4(Y.name&&Y.name.length?Y.name:"Enum"+f11++,F,VY(Y.options,l1.EnumOptions));if(!z)K._edition=W;return K};l4.prototype.toDescriptor=function(){var Y=[];for(var W=0,z=Object.keys(this.values);W<z.length;++W)Y.push(l1.EnumValueDescriptorProto.create({name:z[W],number:this.values[z[W]]}));return l1.EnumDescriptorProto.create({name:this.name,value:Y,options:BY(this.options,l1.EnumOptions)})};var y11=0;mG.fromDescriptor=function(Y){if(typeof Y.length==="number")Y=l1.OneofDescriptorProto.decode(Y);return new mG(Y.name&&Y.name.length?Y.name:"oneof"+y11++)};mG.prototype.toDescriptor=function(){return l1.OneofDescriptorProto.create({name:this.name})};var k11=0;CQ.fromDescriptor=function(Y,W,z){if(typeof Y.length==="number")Y=l1.ServiceDescriptorProto.decode(Y);var F=new CQ(Y.name&&Y.name.length?Y.name:"Service"+k11++,VY(Y.options,l1.ServiceOptions));if(!z)F._edition=W;if(Y.method)for(var Q=0;Q<Y.method.length;++Q)F.add(gG.fromDescriptor(Y.method[Q]));return F};CQ.prototype.toDescriptor=function(){var Y=[];for(var W=0;W<this.methodsArray.length;++W)Y.push(this._methodsArray[W].toDescriptor());return l1.ServiceDescriptorProto.create({name:this.name,method:Y,options:BY(this.options,l1.ServiceOptions)})};var v11=0;gG.fromDescriptor=function(Y){if(typeof Y.length==="number")Y=l1.MethodDescriptorProto.decode(Y);return new gG(Y.name&&Y.name.length?Y.name:"Method"+v11++,"rpc",Y.inputType,Y.outputType,Boolean(Y.clientStreaming),Boolean(Y.serverStreaming),VY(Y.options,l1.MethodOptions))};gG.prototype.toDescriptor=function(){return l1.MethodDescriptorProto.create({name:this.name,inputType:this.resolvedRequestType?this.resolvedRequestType.fullName:this.requestType,outputType:this.resolvedResponseType?this.resolvedResponseType.fullName:this.responseType,clientStreaming:this.requestStream,serverStreaming:this.responseStream,options:BY(this.options,l1.MethodOptions)})};function j11(X){switch(X){case 1:return"double";case 2:return"float";case 3:return"int64";case 4:return"uint64";case 5:return"int32";case 6:return"fixed64";case 7:return"fixed32";case 8:return"bool";case 9:return"string";case 12:return"bytes";case 13:return"uint32";case 15:return"sfixed32";case 16:return"sfixed64";case 17:return"sint32";case 18:return"sint64"}throw Error("illegal type: "+X)}function h11(X){switch(X){case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 13:case 14:case 15:case 16:case 17:case 18:return!0}return!1}function NN(X,Y,W){switch(X){case"double":return 1;case"float":return 2;case"int64":return 3;case"uint64":return 4;case"int32":return 5;case"fixed64":return 6;case"fixed32":return 7;case"bool":return 8;case"string":return 9;case"bytes":return 12;case"uint32":return 13;case"sfixed32":return 15;case"sfixed64":return 16;case"sint32":return 17;case"sint64":return 18}if(Y instanceof l4)return 14;if(Y instanceof K4)return W?10:11;throw Error("illegal type: "+X)}function h70(X,Y){var W={};for(var z=0,F,Q;z<Y.fieldsArray.length;++z){if((Q=(F=Y._fieldsArray[z]).name)==="uninterpretedOption")continue;if(!Object.prototype.hasOwnProperty.call(X,Q))continue;var J=_11(Q);if(F.resolvedType instanceof K4)W[J]=h70(X[Q],F.resolvedType);else if(F.resolvedType instanceof l4)W[J]=F.resolvedType.valuesById[X[Q]];else W[J]=X[Q]}return W}function VY(X,Y){if(!X)return;return h70(Y.toObject(X),Y)}function _70(X,Y){var W={},z=Object.keys(X);for(var F=0;F<z.length;++F){var Q=z[F],J=p9.util.camelCase(Q);if(!Object.prototype.hasOwnProperty.call(Y.fields,J))continue;var Z=Y.fields[J];if(Z.resolvedType instanceof K4)W[J]=_70(X[Q],Z.resolvedType);else W[J]=X[Q];if(Z.repeated&&!Array.isArray(W[J]))W[J]=[W[J]]}return W}function BY(X,Y){if(!X)return;return Y.fromObject(_70(X,Y))}function x70(X,Y){var W=X.fullName.split("."),z=Y.fullName.split("."),F=0,Q=0,J=z.length-1;if(!(X instanceof EQ)&&Y instanceof v70)while(F<W.length&&Q<J&&W[F]===z[Q]){var Z=Y.lookup(W[F++],!0);if(Z!==null&&Z!==Y)break;++Q}else for(;F<W.length&&Q<J&&W[F]===z[Q];++F,++Q);return z.slice(Q).join(".")}function _11(X){return X.substring(0,1)+X.substring(1).replace(/([A-Z])(?=[a-z]|$)/g,function(Y,W){return"_"+W.toLowerCase()})}function x11(X){if(X.syntax==="editions")switch(X.edition){case l1.Edition.EDITION_2023:return"2023";default:throw Error("Unsupported edition "+X.edition)}if(X.syntax==="proto3")return"proto3";return"proto2"}function b11(X,Y){if(!X)return;if(X==="proto2"||X==="proto3")Y.syntax=X;else switch(Y.syntax="editions",X){case"2023":Y.edition=l1.Edition.EDITION_2023;break;default:throw Error("Unsupported edition "+X)}}});var m70=X0((JE1,u11)=>{u11.exports={nested:{google:{nested:{protobuf:{nested:{Api:{fields:{name:{type:"string",id:1},methods:{rule:"repeated",type:"Method",id:2},options:{rule:"repeated",type:"Option",id:3},version:{type:"string",id:4},sourceContext:{type:"SourceContext",id:5},mixins:{rule:"repeated",type:"Mixin",id:6},syntax:{type:"Syntax",id:7}}},Method:{fields:{name:{type:"string",id:1},requestTypeUrl:{type:"string",id:2},requestStreaming:{type:"bool",id:3},responseTypeUrl:{type:"string",id:4},responseStreaming:{type:"bool",id:5},options:{rule:"repeated",type:"Option",id:6},syntax:{type:"Syntax",id:7}}},Mixin:{fields:{name:{type:"string",id:1},root:{type:"string",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}}}}}}}}});var g70=X0((WE1,m11)=>{m11.exports={nested:{google:{nested:{protobuf:{nested:{SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var d70=X0((GE1,g11)=>{g11.exports={nested:{google:{nested:{protobuf:{nested:{Type:{fields:{name:{type:"string",id:1},fields:{rule:"repeated",type:"Field",id:2},oneofs:{rule:"repeated",type:"string",id:3},options:{rule:"repeated",type:"Option",id:4},sourceContext:{type:"SourceContext",id:5},syntax:{type:"Syntax",id:6}}},Field:{fields:{kind:{type:"Kind",id:1},cardinality:{type:"Cardinality",id:2},number:{type:"int32",id:3},name:{type:"string",id:4},typeUrl:{type:"string",id:6},oneofIndex:{type:"int32",id:7},packed:{type:"bool",id:8},options:{rule:"repeated",type:"Option",id:9},jsonName:{type:"string",id:10},defaultValue:{type:"string",id:11}},nested:{Kind:{values:{TYPE_UNKNOWN:0,TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Cardinality:{values:{CARDINALITY_UNKNOWN:0,CARDINALITY_OPTIONAL:1,CARDINALITY_REQUIRED:2,CARDINALITY_REPEATED:3}}}},Enum:{fields:{name:{type:"string",id:1},enumvalue:{rule:"repeated",type:"EnumValue",id:2},options:{rule:"repeated",type:"Option",id:3},sourceContext:{type:"SourceContext",id:4},syntax:{type:"Syntax",id:5}}},EnumValue:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{rule:"repeated",type:"Option",id:3}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}},Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var a70=X0((n70)=>{Object.defineProperty(n70,"__esModule",{value:!0});n70.addCommonProtos=n70.loadProtosWithOptionsSync=n70.loadProtosWithOptions=void 0;var c70=F1("fs"),l70=F1("path"),UY=uG();function p70(X,Y){let W=X.resolvePath;X.resolvePath=(z,F)=>{if(l70.isAbsolute(F))return F;for(let Q of Y){let J=l70.join(Q,F);try{return c70.accessSync(J,c70.constants.R_OK),J}catch(Z){continue}}return process.emitWarning(`${F} not found in any of the include paths ${Y}`),W(z,F)}}async function d11(X,Y){let W=new UY.Root;if(Y=Y||{},Y.includeDirs){if(!Array.isArray(Y.includeDirs))return Promise.reject(Error("The includeDirs option must be an array"));p70(W,Y.includeDirs)}let z=await W.load(X,Y);return z.resolveAll(),z}n70.loadProtosWithOptions=d11;function c11(X,Y){let W=new UY.Root;if(Y=Y||{},Y.includeDirs){if(!Array.isArray(Y.includeDirs))throw Error("The includeDirs option must be an array");p70(W,Y.includeDirs)}let z=W.loadSync(X,Y);return z.resolveAll(),z}n70.loadProtosWithOptionsSync=c11;function l11(){let X=m70(),Y=UN(),W=g70(),z=d70();UY.common("api",X.nested.google.nested.protobuf.nested),UY.common("descriptor",Y.nested.google.nested.protobuf.nested),UY.common("source_context",W.nested.google.nested.protobuf.nested),UY.common("type",z.nested.google.nested.protobuf.nested)}n70.addCommonProtos=l11});var r70=X0((RQ,AN)=>{(function(X,Y){function W(z){return z.default||z}if(typeof define==="function"&&define.amd)define([],function(){var z={};return Y(z),W(z)});else if(typeof RQ==="object"){if(Y(RQ),typeof AN==="object")AN.exports=W(RQ)}else(function(){var z={};Y(z),X.Long=W(z)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:RQ,function(X){Object.defineProperty(X,"__esModule",{value:!0}),X.default=void 0;var Y=null;try{Y=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function W(x,k,l){this.low=x|0,this.high=k|0,this.unsigned=!!l}W.prototype.__isLong__,Object.defineProperty(W.prototype,"__isLong__",{value:!0});function z(x){return(x&&x.__isLong__)===!0}function F(x){var k=Math.clz32(x&-x);return x?31-k:k}W.isLong=z;var Q={},J={};function Z(x,k){var l,Z0,m;if(k){if(x>>>=0,m=0<=x&&x<256){if(Z0=J[x],Z0)return Z0}if(l=H(x,0,!0),m)J[x]=l;return l}else{if(x|=0,m=-128<=x&&x<128){if(Z0=Q[x],Z0)return Z0}if(l=H(x,x<0?-1:0,!1),m)Q[x]=l;return l}}W.fromInt=Z;function K(x,k){if(isNaN(x))return k?C:I;if(k){if(x<0)return C;if(x>=U)return v}else{if(x<=-A)return f;if(x+1>=A)return y}if(x<0)return K(-x,k).neg();return H(x%E|0,x/E|0,k)}W.fromNumber=K;function H(x,k,l){return new W(x,k,l)}W.fromBits=H;var G=Math.pow;function q(x,k,l){if(x.length===0)throw Error("empty string");if(typeof k==="number")l=k,k=!1;else k=!!k;if(x==="NaN"||x==="Infinity"||x==="+Infinity"||x==="-Infinity")return k?C:I;if(l=l||10,l<2||36<l)throw RangeError("radix");var Z0;if((Z0=x.indexOf("-"))>0)throw Error("interior hyphen");else if(Z0===0)return q(x.substring(1),k,l).neg();var m=K(G(l,8)),h=I;for(var p=0;p<x.length;p+=8){var n=Math.min(8,x.length-p),Q0=parseInt(x.substring(p,p+n),l);if(n<8){var c=K(G(l,n));h=h.mul(c).add(K(Q0))}else h=h.mul(m),h=h.add(K(Q0))}return h.unsigned=k,h}W.fromString=q;function B(x,k){if(typeof x==="number")return K(x,k);if(typeof x==="string")return q(x,k);return H(x.low,x.high,typeof k==="boolean"?k:x.unsigned)}W.fromValue=B;var $=65536,R=16777216,E=$*$,U=E*E,A=U/2,T=Z(R),I=Z(0);W.ZERO=I;var C=Z(0,!0);W.UZERO=C;var M=Z(1);W.ONE=M;var w=Z(1,!0);W.UONE=w;var P=Z(-1);W.NEG_ONE=P;var y=H(-1,2147483647,!1);W.MAX_VALUE=y;var v=H(-1,-1,!0);W.MAX_UNSIGNED_VALUE=v;var f=H(0,-2147483648,!1);W.MIN_VALUE=f;var _=W.prototype;if(_.toInt=function(){return this.unsigned?this.low>>>0:this.low},_.toNumber=function(){if(this.unsigned)return(this.high>>>0)*E+(this.low>>>0);return this.high*E+(this.low>>>0)},_.toString=function(k){if(k=k||10,k<2||36<k)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(f)){var l=K(k),Z0=this.div(l),m=Z0.mul(l).sub(this);return Z0.toString(k)+m.toInt().toString(k)}else return"-"+this.neg().toString(k);var h=K(G(k,6),this.unsigned),p=this,n="";while(!0){var Q0=p.div(h),c=p.sub(Q0.mul(h)).toInt()>>>0,e=c.toString(k);if(p=Q0,p.isZero())return e+n;else{while(e.length<6)e="0"+e;n=""+e+n}}},_.getHighBits=function(){return this.high},_.getHighBitsUnsigned=function(){return this.high>>>0},_.getLowBits=function(){return this.low},_.getLowBitsUnsigned=function(){return this.low>>>0},_.getNumBitsAbs=function(){if(this.isNegative())return this.eq(f)?64:this.neg().getNumBitsAbs();var k=this.high!=0?this.high:this.low;for(var l=31;l>0;l--)if((k&1<<l)!=0)break;return this.high!=0?l+33:l+1},_.isSafeInteger=function(){var k=this.high>>21;if(!k)return!0;if(this.unsigned)return!1;return k===-1&&!(this.low===0&&this.high===-2097152)},_.isZero=function(){return this.high===0&&this.low===0},_.eqz=_.isZero,_.isNegative=function(){return!this.unsigned&&this.high<0},_.isPositive=function(){return this.unsigned||this.high>=0},_.isOdd=function(){return(this.low&1)===1},_.isEven=function(){return(this.low&1)===0},_.equals=function(k){if(!z(k))k=B(k);if(this.unsigned!==k.unsigned&&this.high>>>31===1&&k.high>>>31===1)return!1;return this.high===k.high&&this.low===k.low},_.eq=_.equals,_.notEquals=function(k){return!this.eq(k)},_.neq=_.notEquals,_.ne=_.notEquals,_.lessThan=function(k){return this.comp(k)<0},_.lt=_.lessThan,_.lessThanOrEqual=function(k){return this.comp(k)<=0},_.lte=_.lessThanOrEqual,_.le=_.lessThanOrEqual,_.greaterThan=function(k){return this.comp(k)>0},_.gt=_.greaterThan,_.greaterThanOrEqual=function(k){return this.comp(k)>=0},_.gte=_.greaterThanOrEqual,_.ge=_.greaterThanOrEqual,_.compare=function(k){if(!z(k))k=B(k);if(this.eq(k))return 0;var l=this.isNegative(),Z0=k.isNegative();if(l&&!Z0)return-1;if(!l&&Z0)return 1;if(!this.unsigned)return this.sub(k).isNegative()?-1:1;return k.high>>>0>this.high>>>0||k.high===this.high&&k.low>>>0>this.low>>>0?-1:1},_.comp=_.compare,_.negate=function(){if(!this.unsigned&&this.eq(f))return f;return this.not().add(M)},_.neg=_.negate,_.add=function(k){if(!z(k))k=B(k);var l=this.high>>>16,Z0=this.high&65535,m=this.low>>>16,h=this.low&65535,p=k.high>>>16,n=k.high&65535,Q0=k.low>>>16,c=k.low&65535,e=0,g=0,u=0,r=0;return r+=h+c,u+=r>>>16,r&=65535,u+=m+Q0,g+=u>>>16,u&=65535,g+=Z0+n,e+=g>>>16,g&=65535,e+=l+p,e&=65535,H(u<<16|r,e<<16|g,this.unsigned)},_.subtract=function(k){if(!z(k))k=B(k);return this.add(k.neg())},_.sub=_.subtract,_.multiply=function(k){if(this.isZero())return this;if(!z(k))k=B(k);if(Y){var l=Y.mul(this.low,this.high,k.low,k.high);return H(l,Y.get_high(),this.unsigned)}if(k.isZero())return this.unsigned?C:I;if(this.eq(f))return k.isOdd()?f:I;if(k.eq(f))return this.isOdd()?f:I;if(this.isNegative())if(k.isNegative())return this.neg().mul(k.neg());else return this.neg().mul(k).neg();else if(k.isNegative())return this.mul(k.neg()).neg();if(this.lt(T)&&k.lt(T))return K(this.toNumber()*k.toNumber(),this.unsigned);var Z0=this.high>>>16,m=this.high&65535,h=this.low>>>16,p=this.low&65535,n=k.high>>>16,Q0=k.high&65535,c=k.low>>>16,e=k.low&65535,g=0,u=0,r=0,t=0;return t+=p*e,r+=t>>>16,t&=65535,r+=h*e,u+=r>>>16,r&=65535,r+=p*c,u+=r>>>16,r&=65535,u+=m*e,g+=u>>>16,u&=65535,u+=h*c,g+=u>>>16,u&=65535,u+=p*Q0,g+=u>>>16,u&=65535,g+=Z0*e+m*c+h*Q0+p*n,g&=65535,H(r<<16|t,g<<16|u,this.unsigned)},_.mul=_.multiply,_.divide=function(k){if(!z(k))k=B(k);if(k.isZero())throw Error("division by zero");if(Y){if(!this.unsigned&&this.high===-2147483648&&k.low===-1&&k.high===-1)return this;var l=(this.unsigned?Y.div_u:Y.div_s)(this.low,this.high,k.low,k.high);return H(l,Y.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?C:I;var Z0,m,h;if(!this.unsigned){if(this.eq(f))if(k.eq(M)||k.eq(P))return f;else if(k.eq(f))return M;else{var p=this.shr(1);if(Z0=p.div(k).shl(1),Z0.eq(I))return k.isNegative()?M:P;else return m=this.sub(k.mul(Z0)),h=Z0.add(m.div(k)),h}else if(k.eq(f))return this.unsigned?C:I;if(this.isNegative()){if(k.isNegative())return this.neg().div(k.neg());return this.neg().div(k).neg()}else if(k.isNegative())return this.div(k.neg()).neg();h=I}else{if(!k.unsigned)k=k.toUnsigned();if(k.gt(this))return C;if(k.gt(this.shru(1)))return w;h=C}m=this;while(m.gte(k)){Z0=Math.max(1,Math.floor(m.toNumber()/k.toNumber()));var n=Math.ceil(Math.log(Z0)/Math.LN2),Q0=n<=48?1:G(2,n-48),c=K(Z0),e=c.mul(k);while(e.isNegative()||e.gt(m))Z0-=Q0,c=K(Z0,this.unsigned),e=c.mul(k);if(c.isZero())c=M;h=h.add(c),m=m.sub(e)}return h},_.div=_.divide,_.modulo=function(k){if(!z(k))k=B(k);if(Y){var l=(this.unsigned?Y.rem_u:Y.rem_s)(this.low,this.high,k.low,k.high);return H(l,Y.get_high(),this.unsigned)}return this.sub(this.div(k).mul(k))},_.mod=_.modulo,_.rem=_.modulo,_.not=function(){return H(~this.low,~this.high,this.unsigned)},_.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},_.clz=_.countLeadingZeros,_.countTrailingZeros=function(){return this.low?F(this.low):F(this.high)+32},_.ctz=_.countTrailingZeros,_.and=function(k){if(!z(k))k=B(k);return H(this.low&k.low,this.high&k.high,this.unsigned)},_.or=function(k){if(!z(k))k=B(k);return H(this.low|k.low,this.high|k.high,this.unsigned)},_.xor=function(k){if(!z(k))k=B(k);return H(this.low^k.low,this.high^k.high,this.unsigned)},_.shiftLeft=function(k){if(z(k))k=k.toInt();if((k&=63)===0)return this;else if(k<32)return H(this.low<<k,this.high<<k|this.low>>>32-k,this.unsigned);else return H(0,this.low<<k-32,this.unsigned)},_.shl=_.shiftLeft,_.shiftRight=function(k){if(z(k))k=k.toInt();if((k&=63)===0)return this;else if(k<32)return H(this.low>>>k|this.high<<32-k,this.high>>k,this.unsigned);else return H(this.high>>k-32,this.high>=0?0:-1,this.unsigned)},_.shr=_.shiftRight,_.shiftRightUnsigned=function(k){if(z(k))k=k.toInt();if((k&=63)===0)return this;if(k<32)return H(this.low>>>k|this.high<<32-k,this.high>>>k,this.unsigned);if(k===32)return H(this.high,0,this.unsigned);return H(this.high>>>k-32,0,this.unsigned)},_.shru=_.shiftRightUnsigned,_.shr_u=_.shiftRightUnsigned,_.rotateLeft=function(k){var l;if(z(k))k=k.toInt();if((k&=63)===0)return this;if(k===32)return H(this.high,this.low,this.unsigned);if(k<32)return l=32-k,H(this.low<<k|this.high>>>l,this.high<<k|this.low>>>l,this.unsigned);return k-=32,l=32-k,H(this.high<<k|this.low>>>l,this.low<<k|this.high>>>l,this.unsigned)},_.rotl=_.rotateLeft,_.rotateRight=function(k){var l;if(z(k))k=k.toInt();if((k&=63)===0)return this;if(k===32)return H(this.high,this.low,this.unsigned);if(k<32)return l=32-k,H(this.high<<l|this.low>>>k,this.low<<l|this.high>>>k,this.unsigned);return k-=32,l=32-k,H(this.low<<l|this.high>>>k,this.high<<l|this.low>>>k,this.unsigned)},_.rotr=_.rotateRight,_.toSigned=function(){if(!this.unsigned)return this;return H(this.low,this.high,!1)},_.toUnsigned=function(){if(this.unsigned)return this;return H(this.low,this.high,!0)},_.toBytes=function(k){return k?this.toBytesLE():this.toBytesBE()},_.toBytesLE=function(){var k=this.high,l=this.low;return[l&255,l>>>8&255,l>>>16&255,l>>>24,k&255,k>>>8&255,k>>>16&255,k>>>24]},_.toBytesBE=function(){var k=this.high,l=this.low;return[k>>>24,k>>>16&255,k>>>8&255,k&255,l>>>24,l>>>16&255,l>>>8&255,l&255]},W.fromBytes=function(k,l,Z0){return Z0?W.fromBytesLE(k,l):W.fromBytesBE(k,l)},W.fromBytesLE=function(k,l){return new W(k[0]|k[1]<<8|k[2]<<16|k[3]<<24,k[4]|k[5]<<8|k[6]<<16|k[7]<<24,l)},W.fromBytesBE=function(k,l){return new W(k[4]<<24|k[5]<<16|k[6]<<8|k[7],k[0]<<24|k[1]<<16|k[2]<<8|k[3],l)},typeof BigInt==="function")W.fromBigInt=function(k,l){var Z0=Number(BigInt.asIntN(32,k)),m=Number(BigInt.asIntN(32,k>>BigInt(32)));return H(Z0,m,l)},W.fromValue=function(k,l){if(typeof k==="bigint")return W.fromBigInt(k,l);return B(k,l)},_.toBigInt=function(){var k=BigInt(this.low>>>0),l=BigInt(this.unsigned?this.high>>>0:this.high);return l<<BigInt(32)|k};var b=X.default=W})});var MQ=X0((YX0)=>{Object.defineProperty(YX0,"__esModule",{value:!0});YX0.loadFileDescriptorSetFromObject=YX0.loadFileDescriptorSetFromBuffer=YX0.fromJSON=YX0.loadSync=YX0.load=YX0.IdempotencyLevel=YX0.isAnyExtension=YX0.Long=void 0;var i11=k50(),F4=uG(),$N=u70(),DN=a70(),a11=r70();YX0.Long=a11;function r11(X){return"@type"in X&&typeof X["@type"]==="string"}YX0.isAnyExtension=r11;var t70;(function(X){X.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",X.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",X.IDEMPOTENT="IDEMPOTENT"})(t70=YX0.IdempotencyLevel||(YX0.IdempotencyLevel={}));var s70={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function o11(X,Y){if(X==="")return Y;else return X+"."+Y}function t11(X){return X instanceof F4.Service||X instanceof F4.Type||X instanceof F4.Enum}function s11(X){return X instanceof F4.Namespace||X instanceof F4.Root}function e70(X,Y){let W=o11(Y,X.name);if(t11(X))return[[W,X]];else if(s11(X)&&typeof X.nested<"u")return Object.keys(X.nested).map((z)=>{return e70(X.nested[z],W)}).reduce((z,F)=>z.concat(F),[]);return[]}function ON(X,Y){return function(z){return X.toObject(X.decode(z),Y)}}function TN(X){return function(W){if(Array.isArray(W))throw Error(`Failed to serialize message: expected object with ${X.name} structure, got array instead`);let z=X.fromObject(W);return X.encode(z).finish()}}function e11(X){return(X||[]).reduce((Y,W)=>{for(let[z,F]of Object.entries(W))switch(z){case"uninterpreted_option":Y.uninterpreted_option.push(W.uninterpreted_option);break;default:Y[z]=F}return Y},{deprecated:!1,idempotency_level:t70.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function X61(X,Y,W,z){let{resolvedRequestType:F,resolvedResponseType:Q}=X;return{path:"/"+Y+"/"+X.name,requestStream:!!X.requestStream,responseStream:!!X.responseStream,requestSerialize:TN(F),requestDeserialize:ON(F,W),responseSerialize:TN(Q),responseDeserialize:ON(Q,W),originalName:i11(X.name),requestType:IN(F,W,z),responseType:IN(Q,W,z),options:e11(X.parsedOptions)}}function Y61(X,Y,W,z){let F={};for(let Q of X.methodsArray)F[Q.name]=X61(Q,Y,W,z);return F}function IN(X,Y,W){let z=X.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:z.$type.toObject(z,s70),fileDescriptorProtos:W,serialize:TN(X),deserialize:ON(X,Y)}}function Z61(X,Y){let W=X.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:W.$type.toObject(W,s70),fileDescriptorProtos:Y}}function Q61(X,Y,W,z){if(X instanceof F4.Service)return Y61(X,Y,W,z);else if(X instanceof F4.Type)return IN(X,W,z);else if(X instanceof F4.Enum)return Z61(X,z);else throw Error("Type mismatch in reflection object handling")}function dG(X,Y){let W={};X.resolveAll();let F=X.toDescriptor("proto3").file.map((Q)=>Buffer.from($N.FileDescriptorProto.encode(Q).finish()));for(let[Q,J]of e70(X,""))W[Q]=Q61(J,Q,Y,F);return W}function XX0(X,Y){Y=Y||{};let W=F4.Root.fromDescriptor(X);return W.resolveAll(),dG(W,Y)}function J61(X,Y){return(0,DN.loadProtosWithOptions)(X,Y).then((W)=>{return dG(W,Y)})}YX0.load=J61;function W61(X,Y){let W=(0,DN.loadProtosWithOptionsSync)(X,Y);return dG(W,Y)}YX0.loadSync=W61;function G61(X,Y){Y=Y||{};let W=F4.Root.fromJSON(X);return W.resolveAll(),dG(W,Y)}YX0.fromJSON=G61;function K61(X,Y){let W=$N.FileDescriptorSet.decode(X);return XX0(W,Y)}YX0.loadFileDescriptorSetFromBuffer=K61;function F61(X,Y){let W=$N.FileDescriptorSet.fromObject(X);return XX0(W,Y)}YX0.loadFileDescriptorSetFromObject=F61;(0,DN.addCommonProtos)()});var S5=X0((AX0)=>{var __dirname="/Users/beatrix/dev/clinee/sdk-wip/node_modules/.bun/@grpc+grpc-js@1.14.3/node_modules/@grpc/grpc-js/build/src";Object.defineProperty(AX0,"__esModule",{value:!0});AX0.registerChannelzSocket=AX0.registerChannelzServer=AX0.registerChannelzSubchannel=AX0.registerChannelzChannel=AX0.ChannelzCallTrackerStub=AX0.ChannelzCallTracker=AX0.ChannelzChildrenTrackerStub=AX0.ChannelzChildrenTracker=AX0.ChannelzTrace=AX0.ChannelzTraceStub=void 0;AX0.unregisterChannelzRef=I61;AX0.getChannelzHandlers=UX0;AX0.getChannelzServiceDefinition=NX0;AX0.setup=f61;var lG=F1("net"),g7=j40(),LQ=C9(),PQ=a1(),N61=y9(),A61=AG(),O61=TG();function EN(X){return{channel_id:X.id,name:X.name}}function CN(X){return{subchannel_id:X.id,name:X.name}}function T61(X){return{server_id:X.id}}function pG(X){return{socket_id:X.id,name:X.name}}var QX0=32,RN=100;class KX0{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:z4(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}}AX0.ChannelzTraceStub=KX0;class FX0{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(X,Y,W){let z=new Date;if(this.events.push({description:Y,severity:X,timestamp:z,childChannel:(W===null||W===void 0?void 0:W.kind)==="channel"?W:void 0,childSubchannel:(W===null||W===void 0?void 0:W.kind)==="subchannel"?W:void 0}),this.events.length>=QX0*2)this.events=this.events.slice(QX0);this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:z4(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map((X)=>{return{description:X.description,severity:X.severity,timestamp:z4(X.timestamp),channel_ref:X.childChannel?EN(X.childChannel):null,subchannel_ref:X.childSubchannel?CN(X.childSubchannel):null}})}}}AX0.ChannelzTrace=FX0;class MN{constructor(){this.channelChildren=new g7.OrderedMap,this.subchannelChildren=new g7.OrderedMap,this.socketChildren=new g7.OrderedMap,this.trackerMap={["channel"]:this.channelChildren,["subchannel"]:this.subchannelChildren,["socket"]:this.socketChildren}}refChild(X){let Y=this.trackerMap[X.kind],W=Y.find(X.id);if(W.equals(Y.end()))Y.setElement(X.id,{ref:X,count:1},W);else W.pointer[1].count+=1}unrefChild(X){let Y=this.trackerMap[X.kind],W=Y.getElementByKey(X.id);if(W!==void 0){if(W.count-=1,W.count===0)Y.eraseElementByKey(X.id)}}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}}AX0.ChannelzChildrenTracker=MN;class zX0 extends MN{refChild(){}unrefChild(){}}AX0.ChannelzChildrenTrackerStub=zX0;class LN{constructor(){this.callsStarted=0,this.callsSucceeded=0,this.callsFailed=0,this.lastCallStartedTimestamp=null}addCallStarted(){this.callsStarted+=1,this.lastCallStartedTimestamp=new Date}addCallSucceeded(){this.callsSucceeded+=1}addCallFailed(){this.callsFailed+=1}}AX0.ChannelzCallTracker=LN;class qX0 extends LN{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}}AX0.ChannelzCallTrackerStub=qX0;var p4={["channel"]:new g7.OrderedMap,["subchannel"]:new g7.OrderedMap,["server"]:new g7.OrderedMap,["socket"]:new g7.OrderedMap},nG=(X)=>{let Y=1;function W(){return Y++}let z=p4[X];return(F,Q,J)=>{let Z=W(),K={id:Z,name:F,kind:X};if(J)z.setElement(Z,{ref:K,getInfo:Q});return K}};AX0.registerChannelzChannel=nG("channel");AX0.registerChannelzSubchannel=nG("subchannel");AX0.registerChannelzServer=nG("server");AX0.registerChannelzSocket=nG("socket");function I61(X){p4[X.kind].eraseElementByKey(X.id)}function $61(X){let Y=Number.parseInt(X,16);return[Y/256|0,Y%256]}function JX0(X){if(X==="")return[];let Y=X.split(":").map((z)=>$61(z));return[].concat(...Y)}function D61(X){return(0,lG.isIPv6)(X)&&X.toLowerCase().startsWith("::ffff:")&&(0,lG.isIPv4)(X.substring(7))}function WX0(X){return Buffer.from(Uint8Array.from(X.split(".").map((Y)=>Number.parseInt(Y))))}function E61(X){if((0,lG.isIPv4)(X))return WX0(X);else if(D61(X))return WX0(X.substring(7));else if((0,lG.isIPv6)(X)){let Y,W,z=X.indexOf("::");if(z===-1)Y=X,W="";else Y=X.substring(0,z),W=X.substring(z+2);let F=Buffer.from(JX0(Y)),Q=Buffer.from(JX0(W)),J=Buffer.alloc(16-F.length-Q.length,0);return Buffer.concat([F,J,Q])}else return null}function HX0(X){switch(X){case LQ.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case LQ.ConnectivityState.IDLE:return{state:"IDLE"};case LQ.ConnectivityState.READY:return{state:"READY"};case LQ.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case LQ.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function z4(X){if(!X)return null;let Y=X.getTime();return{seconds:Y/1000|0,nanos:Y%1000*1e6}}function VX0(X){let Y=X.getInfo(),W=[],z=[];return Y.children.channels.forEach((F)=>{W.push(EN(F[1].ref))}),Y.children.subchannels.forEach((F)=>{z.push(CN(F[1].ref))}),{ref:EN(X.ref),data:{target:Y.target,state:HX0(Y.state),calls_started:Y.callTracker.callsStarted,calls_succeeded:Y.callTracker.callsSucceeded,calls_failed:Y.callTracker.callsFailed,last_call_started_timestamp:z4(Y.callTracker.lastCallStartedTimestamp),trace:Y.trace.getTraceMessage()},channel_ref:W,subchannel_ref:z}}function C61(X,Y){let W=parseInt(X.request.channel_id,10),z=p4.channel.getElementByKey(W);if(z===void 0){Y({code:PQ.Status.NOT_FOUND,details:"No channel data found for id "+W});return}Y(null,{channel:VX0(z)})}function R61(X,Y){let W=parseInt(X.request.max_results,10)||RN,z=[],F=parseInt(X.request.start_channel_id,10),Q=p4.channel,J;for(J=Q.lowerBound(F);!J.equals(Q.end())&&z.length<W;J=J.next())z.push(VX0(J.pointer[1]));Y(null,{channel:z,end:J.equals(Q.end())})}function BX0(X){let Y=X.getInfo(),W=[];return Y.listenerChildren.sockets.forEach((z)=>{W.push(pG(z[1].ref))}),{ref:T61(X.ref),data:{calls_started:Y.callTracker.callsStarted,calls_succeeded:Y.callTracker.callsSucceeded,calls_failed:Y.callTracker.callsFailed,last_call_started_timestamp:z4(Y.callTracker.lastCallStartedTimestamp),trace:Y.trace.getTraceMessage()},listen_socket:W}}function M61(X,Y){let W=parseInt(X.request.server_id,10),F=p4.server.getElementByKey(W);if(F===void 0){Y({code:PQ.Status.NOT_FOUND,details:"No server data found for id "+W});return}Y(null,{server:BX0(F)})}function L61(X,Y){let W=parseInt(X.request.max_results,10)||RN,z=parseInt(X.request.start_server_id,10),F=p4.server,Q=[],J;for(J=F.lowerBound(z);!J.equals(F.end())&&Q.length<W;J=J.next())Q.push(BX0(J.pointer[1]));Y(null,{server:Q,end:J.equals(F.end())})}function P61(X,Y){let W=parseInt(X.request.subchannel_id,10),z=p4.subchannel.getElementByKey(W);if(z===void 0){Y({code:PQ.Status.NOT_FOUND,details:"No subchannel data found for id "+W});return}let F=z.getInfo(),Q=[];F.children.sockets.forEach((Z)=>{Q.push(pG(Z[1].ref))});let J={ref:CN(z.ref),data:{target:F.target,state:HX0(F.state),calls_started:F.callTracker.callsStarted,calls_succeeded:F.callTracker.callsSucceeded,calls_failed:F.callTracker.callsFailed,last_call_started_timestamp:z4(F.callTracker.lastCallStartedTimestamp),trace:F.trace.getTraceMessage()},socket_ref:Q};Y(null,{subchannel:J})}function GX0(X){var Y;if((0,N61.isTcpSubchannelAddress)(X))return{address:"tcpip_address",tcpip_address:{ip_address:(Y=E61(X.host))!==null&&Y!==void 0?Y:void 0,port:X.port}};else return{address:"uds_address",uds_address:{filename:X.path}}}function w61(X,Y){var W,z,F,Q,J;let Z=parseInt(X.request.socket_id,10),K=p4.socket.getElementByKey(Z);if(K===void 0){Y({code:PQ.Status.NOT_FOUND,details:"No socket data found for id "+Z});return}let H=K.getInfo(),G=H.security?{model:"tls",tls:{cipher_suite:H.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:(W=H.security.cipherSuiteStandardName)!==null&&W!==void 0?W:void 0,other_name:(z=H.security.cipherSuiteOtherName)!==null&&z!==void 0?z:void 0,local_certificate:(F=H.security.localCertificate)!==null&&F!==void 0?F:void 0,remote_certificate:(Q=H.security.remoteCertificate)!==null&&Q!==void 0?Q:void 0}}:null,q={ref:pG(K.ref),local:H.localAddress?GX0(H.localAddress):null,remote:H.remoteAddress?GX0(H.remoteAddress):null,remote_name:(J=H.remoteName)!==null&&J!==void 0?J:void 0,security:G,data:{keep_alives_sent:H.keepAlivesSent,streams_started:H.streamsStarted,streams_succeeded:H.streamsSucceeded,streams_failed:H.streamsFailed,last_local_stream_created_timestamp:z4(H.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:z4(H.lastRemoteStreamCreatedTimestamp),messages_received:H.messagesReceived,messages_sent:H.messagesSent,last_message_received_timestamp:z4(H.lastMessageReceivedTimestamp),last_message_sent_timestamp:z4(H.lastMessageSentTimestamp),local_flow_control_window:H.localFlowControlWindow?{value:H.localFlowControlWindow}:null,remote_flow_control_window:H.remoteFlowControlWindow?{value:H.remoteFlowControlWindow}:null}};Y(null,{socket:q})}function S61(X,Y){let W=parseInt(X.request.server_id,10),z=p4.server.getElementByKey(W);if(z===void 0){Y({code:PQ.Status.NOT_FOUND,details:"No server data found for id "+W});return}let F=parseInt(X.request.start_socket_id,10),Q=parseInt(X.request.max_results,10)||RN,Z=z.getInfo().sessionChildren.sockets,K=[],H;for(H=Z.lowerBound(F);!H.equals(Z.end())&&K.length<Q;H=H.next())K.push(pG(H.pointer[1].ref));Y(null,{socket_ref:K,end:H.equals(Z.end())})}function UX0(){return{GetChannel:C61,GetTopChannels:R61,GetServer:M61,GetServers:L61,GetSubchannel:P61,GetSocket:w61,GetServerSockets:S61}}var cG=null;function NX0(){if(cG)return cG;let X=MQ().loadSync,Y=X("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]});return cG=(0,O61.loadPackageDefinition)(Y).grpc.channelz.v1.Channelz.service,cG}function f61(){(0,A61.registerAdminService)(NX0,UX0)}});var iG=X0((TX0)=>{Object.defineProperty(TX0,"__esModule",{value:!0});TX0.getNextCallNumber=p61;var l61=0;function p61(){return l61++}});var PN=X0(($X0)=>{Object.defineProperty($X0,"__esModule",{value:!0});$X0.CompressionAlgorithms=void 0;var IX0;(function(X){X[X.identity=0]="identity",X[X.deflate=1]="deflate",X[X.gzip=2]="gzip"})(IX0||($X0.CompressionAlgorithms=IX0={}))});var wN=X0((CX0)=>{Object.defineProperty(CX0,"__esModule",{value:!0});CX0.BaseFilter=void 0;class EX0{async sendMetadata(X){return X}receiveMetadata(X){return X}async sendMessage(X){return X}async receiveMessage(X){return X}receiveTrailers(X){return X}}CX0.BaseFilter=EX0});var fN=X0((yX0)=>{Object.defineProperty(yX0,"__esModule",{value:!0});yX0.CompressionFilterFactory=yX0.CompressionFilter=void 0;var aG=F1("zlib"),LX0=PN(),NY=a1(),i61=wN(),a61=A6(),r61=(X)=>{return typeof X==="number"&&typeof LX0.CompressionAlgorithms[X]==="string"};class wQ{async writeMessage(X,Y){let W=X;if(Y)W=await this.compressMessage(W);let z=Buffer.allocUnsafe(W.length+5);return z.writeUInt8(Y?1:0,0),z.writeUInt32BE(W.length,1),W.copy(z,5),z}async readMessage(X){let Y=X.readUInt8(0)===1,W=X.slice(5);if(Y)W=await this.decompressMessage(W);return W}}class AY extends wQ{async compressMessage(X){return X}async writeMessage(X,Y){let W=Buffer.allocUnsafe(X.length+5);return W.writeUInt8(0,0),W.writeUInt32BE(X.length,1),X.copy(W,5),W}decompressMessage(X){return Promise.reject(Error('Received compressed message but "grpc-encoding" header was identity'))}}class PX0 extends wQ{constructor(X){super();this.maxRecvMessageLength=X}compressMessage(X){return new Promise((Y,W)=>{aG.deflate(X,(z,F)=>{if(z)W(z);else Y(F)})})}decompressMessage(X){return new Promise((Y,W)=>{let z=0,F=[],Q=aG.createInflate();Q.on("data",(J)=>{if(F.push(J),z+=J.byteLength,this.maxRecvMessageLength!==-1&&z>this.maxRecvMessageLength)Q.destroy(),W({code:NY.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`})}),Q.on("end",()=>{Y(Buffer.concat(F))}),Q.write(X),Q.end()})}}class wX0 extends wQ{constructor(X){super();this.maxRecvMessageLength=X}compressMessage(X){return new Promise((Y,W)=>{aG.gzip(X,(z,F)=>{if(z)W(z);else Y(F)})})}decompressMessage(X){return new Promise((Y,W)=>{let z=0,F=[],Q=aG.createGunzip();Q.on("data",(J)=>{if(F.push(J),z+=J.byteLength,this.maxRecvMessageLength!==-1&&z>this.maxRecvMessageLength)Q.destroy(),W({code:NY.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`})}),Q.on("end",()=>{Y(Buffer.concat(F))}),Q.write(X),Q.end()})}}class SX0 extends wQ{constructor(X){super();this.compressionName=X}compressMessage(X){return Promise.reject(Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(X){return Promise.reject(Error(`Compression method not supported: ${this.compressionName}`))}}function MX0(X,Y){switch(X){case"identity":return new AY;case"deflate":return new PX0(Y);case"gzip":return new wX0(Y);default:return new SX0(X)}}class SN extends i61.BaseFilter{constructor(X,Y){var W,z,F;super();this.sharedFilterConfig=Y,this.sendCompression=new AY,this.receiveCompression=new AY,this.currentCompressionAlgorithm="identity";let Q=X["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=(W=X["grpc.max_receive_message_length"])!==null&&W!==void 0?W:NY.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=(z=X["grpc.max_send_message_length"])!==null&&z!==void 0?z:NY.DEFAULT_MAX_SEND_MESSAGE_LENGTH,Q!==void 0)if(r61(Q)){let J=LX0.CompressionAlgorithms[Q],Z=(F=Y.serverSupportedEncodingHeader)===null||F===void 0?void 0:F.split(",");if(!Z||Z.includes(J))this.currentCompressionAlgorithm=J,this.sendCompression=MX0(this.currentCompressionAlgorithm,-1)}else a61.log(NY.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${Q}`)}async sendMetadata(X){let Y=await X;if(Y.set("grpc-accept-encoding","identity,deflate,gzip"),Y.set("accept-encoding","identity"),this.currentCompressionAlgorithm==="identity")Y.remove("grpc-encoding");else Y.set("grpc-encoding",this.currentCompressionAlgorithm);return Y}receiveMetadata(X){let Y=X.get("grpc-encoding");if(Y.length>0){let z=Y[0];if(typeof z==="string")this.receiveCompression=MX0(z,this.maxReceiveMessageLength)}X.remove("grpc-encoding");let W=X.get("grpc-accept-encoding")[0];if(W){if(this.sharedFilterConfig.serverSupportedEncodingHeader=W,!W.split(",").includes(this.currentCompressionAlgorithm))this.sendCompression=new AY,this.currentCompressionAlgorithm="identity"}return X.remove("grpc-accept-encoding"),X}async sendMessage(X){var Y;let W=await X;if(this.maxSendMessageLength!==-1&&W.message.length>this.maxSendMessageLength)throw{code:NY.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let z;if(this.sendCompression instanceof AY)z=!1;else z=(((Y=W.flags)!==null&&Y!==void 0?Y:0)&2)===0;return{message:await this.sendCompression.writeMessage(W.message,z),flags:W.flags}}async receiveMessage(X){return this.receiveCompression.readMessage(await X)}}yX0.CompressionFilter=SN;class fX0{constructor(X,Y){this.options=Y,this.sharedFilterConfig={}}createFilter(){return new SN(this.options,this.sharedFilterConfig)}}yX0.CompressionFilterFactory=fX0});var SQ=X0((vX0)=>{Object.defineProperty(vX0,"__esModule",{value:!0});vX0.restrictControlPlaneStatusCode=s61;var q4=a1(),t61=[q4.Status.OK,q4.Status.INVALID_ARGUMENT,q4.Status.NOT_FOUND,q4.Status.ALREADY_EXISTS,q4.Status.FAILED_PRECONDITION,q4.Status.ABORTED,q4.Status.OUT_OF_RANGE,q4.Status.DATA_LOSS];function s61(X,Y){if(t61.includes(X))return{code:q4.Status.INTERNAL,details:`Invalid status from control plane: ${X} ${q4.Status[X]} ${Y}`};else return{code:X,details:Y}}});var OY=X0((jX0)=>{Object.defineProperty(jX0,"__esModule",{value:!0});jX0.minDeadline=X91;jX0.getDeadlineTimeoutString=Z91;jX0.getRelativeTimeout=J91;jX0.deadlineToString=W91;jX0.formatDateDifference=G91;function X91(...X){let Y=1/0;for(let W of X){let z=W instanceof Date?W.getTime():W;if(z<Y)Y=z}return Y}var Y91=[["m",1],["S",1000],["M",60000],["H",3600000]];function Z91(X){let Y=new Date().getTime();if(X instanceof Date)X=X.getTime();let W=Math.max(X-Y,0);for(let[z,F]of Y91){let Q=W/F;if(Q<1e8)return String(Math.ceil(Q))+z}throw Error("Deadline is too far in the future")}var Q91=2147483647;function J91(X){let Y=X instanceof Date?X.getTime():X,W=new Date().getTime(),z=Y-W;if(z<0)return 0;else if(z>Q91)return 1/0;else return z}function W91(X){if(X instanceof Date)return X.toISOString();else{let Y=new Date(X);if(Number.isNaN(Y.getTime()))return""+X;else return Y.toISOString()}}function G91(X,Y){return((Y.getTime()-X.getTime())/1000).toFixed(3)+"s"}});var rG=X0((hX0)=>{Object.defineProperty(hX0,"__esModule",{value:!0});hX0.FilterStackFactory=hX0.FilterStack=void 0;class yN{constructor(X){this.filters=X}sendMetadata(X){let Y=X;for(let W=0;W<this.filters.length;W++)Y=this.filters[W].sendMetadata(Y);return Y}receiveMetadata(X){let Y=X;for(let W=this.filters.length-1;W>=0;W--)Y=this.filters[W].receiveMetadata(Y);return Y}sendMessage(X){let Y=X;for(let W=0;W<this.filters.length;W++)Y=this.filters[W].sendMessage(Y);return Y}receiveMessage(X){let Y=X;for(let W=this.filters.length-1;W>=0;W--)Y=this.filters[W].receiveMessage(Y);return Y}receiveTrailers(X){let Y=X;for(let W=this.filters.length-1;W>=0;W--)Y=this.filters[W].receiveTrailers(Y);return Y}push(X){this.filters.unshift(...X)}getFilters(){return this.filters}}hX0.FilterStack=yN;class kN{constructor(X){this.factories=X}push(X){this.factories.unshift(...X)}clone(){return new kN([...this.factories])}createFilter(){return new yN(this.factories.map((X)=>X.createFilter()))}}hX0.FilterStackFactory=kN});var gX0=X0((uX0)=>{Object.defineProperty(uX0,"__esModule",{value:!0});uX0.SingleSubchannelChannel=void 0;var B91=iG(),fQ=S5(),U91=fN(),N91=C9(),yQ=a1(),A91=SQ(),O91=OY(),T91=rG(),vN=s6(),I91=y8(),oG=E9();class xX0{constructor(X,Y,W,z,F){var Q,J;this.subchannel=X,this.method=Y,this.options=z,this.callNumber=F,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1;let Z=this.method.split("/"),K="";if(Z.length>=2)K=Z[1];let H=(J=(Q=(0,oG.splitHostPort)(this.options.host))===null||Q===void 0?void 0:Q.host)!==null&&J!==void 0?J:"localhost";this.serviceUrl=`https://${H}/${K}`;let G=(0,O91.getRelativeTimeout)(z.deadline);if(G!==1/0)if(G<=0)this.cancelWithStatus(yQ.Status.DEADLINE_EXCEEDED,"Deadline exceeded");else setTimeout(()=>{this.cancelWithStatus(yQ.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},G);this.filterStack=W.createFilter()}cancelWithStatus(X,Y){if(this.childCall)this.childCall.cancelWithStatus(X,Y);else this.pendingStatus={code:X,details:Y,metadata:new vN.Metadata}}getPeer(){var X,Y;return(Y=(X=this.childCall)===null||X===void 0?void 0:X.getPeer())!==null&&Y!==void 0?Y:this.subchannel.getAddress()}async start(X,Y){if(this.pendingStatus){Y.onReceiveStatus(this.pendingStatus);return}if(this.subchannel.getConnectivityState()!==N91.ConnectivityState.READY){Y.onReceiveStatus({code:yQ.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new vN.Metadata});return}let W=await this.filterStack.sendMetadata(Promise.resolve(X)),z;try{z=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(Q){let J=Q,{code:Z,details:K}=(0,A91.restrictControlPlaneStatusCode)(typeof J.code==="number"?J.code:yQ.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${J.message}`);Y.onReceiveStatus({code:Z,details:K,metadata:new vN.Metadata});return}z.merge(W);let F={onReceiveMetadata:async(Q)=>{Y.onReceiveMetadata(await this.filterStack.receiveMetadata(Q))},onReceiveMessage:async(Q)=>{this.readFilterPending=!0;let J=await this.filterStack.receiveMessage(Q);if(this.readFilterPending=!1,Y.onReceiveMessage(J),this.pendingStatus)Y.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async(Q)=>{let J=await this.filterStack.receiveTrailers(Q);if(this.readFilterPending)this.pendingStatus=J;else Y.onReceiveStatus(J)}};if(this.childCall=this.subchannel.createCall(z,this.options.host,this.method,F),this.readPending)this.childCall.startRead();if(this.pendingMessage)this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message);if(this.halfClosePending&&!this.writeFilterPending)this.childCall.halfClose()}async sendMessageWithContext(X,Y){this.writeFilterPending=!0;let W=await this.filterStack.sendMessage(Promise.resolve({message:Y,flags:X.flags}));if(this.writeFilterPending=!1,this.childCall){if(this.childCall.sendMessageWithContext(X,W.message),this.halfClosePending)this.childCall.halfClose()}else this.pendingMessage={context:X,message:W.message}}startRead(){if(this.childCall)this.childCall.startRead();else this.readPending=!0}halfClose(){if(this.childCall&&!this.writeFilterPending)this.childCall.halfClose();else this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(X){throw Error("Method not implemented.")}getAuthContext(){if(this.childCall)return this.childCall.getAuthContext();else return null}}class bX0{constructor(X,Y,W){if(this.subchannel=X,this.target=Y,this.channelzEnabled=!1,this.channelzTrace=new fQ.ChannelzTrace,this.callTracker=new fQ.ChannelzCallTracker,this.childrenTracker=new fQ.ChannelzChildrenTracker,this.channelzEnabled=W["grpc.enable_channelz"]!==0,this.channelzRef=(0,fQ.registerChannelzChannel)((0,oG.uriToString)(Y),()=>({target:`${(0,oG.uriToString)(Y)} (${X.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled)this.childrenTracker.refChild(X.getChannelzRef());this.filterStackFactory=new T91.FilterStackFactory([new U91.CompressionFilterFactory(this,W)])}close(){if(this.channelzEnabled)this.childrenTracker.unrefChild(this.subchannel.getChannelzRef());(0,fQ.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,oG.uriToString)(this.target)}getConnectivityState(X){throw Error("Method not implemented.")}watchConnectivityState(X,Y,W){throw Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(X,Y){let W={deadline:Y,host:(0,I91.getDefaultAuthority)(this.target),flags:yQ.Propagate.DEFAULTS,parentCall:null};return new xX0(this.subchannel,X,this.filterStackFactory,W,(0,B91.getNextCallNumber)())}}uX0.SingleSubchannelChannel=bX0});var pX0=X0((cX0)=>{Object.defineProperty(cX0,"__esModule",{value:!0});cX0.Subchannel=void 0;var V6=C9(),$91=QY(),jN=A6(),tG=a1(),D91=E9(),E91=y9(),H4=S5(),C91=gX0(),R91="subchannel",M91=2147483647;class dX0{constructor(X,Y,W,z,F){var Q;this.channelTarget=X,this.subchannelAddress=Y,this.options=W,this.connector=F,this.connectivityState=V6.ConnectivityState.IDLE,this.transport=null,this.continueConnecting=!1,this.stateListeners=new Set,this.refcount=0,this.channelzEnabled=!0,this.dataProducers=new Map,this.subchannelChannel=null;let J={initialDelay:W["grpc.initial_reconnect_backoff_ms"],maxDelay:W["grpc.max_reconnect_backoff_ms"]};if(this.backoffTimeout=new $91.BackoffTimeout(()=>{this.handleBackoffTimer()},J),this.backoffTimeout.unref(),this.subchannelAddressString=(0,E91.subchannelAddressToString)(Y),this.keepaliveTime=(Q=W["grpc.keepalive_time_ms"])!==null&&Q!==void 0?Q:-1,W["grpc.enable_channelz"]===0)this.channelzEnabled=!1,this.channelzTrace=new H4.ChannelzTraceStub,this.callTracker=new H4.ChannelzCallTrackerStub,this.childrenTracker=new H4.ChannelzChildrenTrackerStub,this.streamTracker=new H4.ChannelzCallTrackerStub;else this.channelzTrace=new H4.ChannelzTrace,this.callTracker=new H4.ChannelzCallTracker,this.childrenTracker=new H4.ChannelzChildrenTracker,this.streamTracker=new H4.ChannelzCallTracker;this.channelzRef=(0,H4.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(W,void 0,2)),this.secureConnector=z._createSecureConnector(X,W)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(X){jN.trace(tG.LogVerbosity.DEBUG,R91,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+X)}refTrace(X){jN.trace(tG.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+X)}handleBackoffTimer(){if(this.continueConnecting)this.transitionToState([V6.ConnectivityState.TRANSIENT_FAILURE],V6.ConnectivityState.CONNECTING);else this.transitionToState([V6.ConnectivityState.TRANSIENT_FAILURE],V6.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let X=this.options;if(X["grpc.keepalive_time_ms"]){let Y=Math.min(this.keepaliveTime,M91);X=Object.assign(Object.assign({},X),{"grpc.keepalive_time_ms":Y})}this.connector.connect(this.subchannelAddress,this.secureConnector,X).then((Y)=>{if(this.transitionToState([V6.ConnectivityState.CONNECTING],V6.ConnectivityState.READY)){if(this.transport=Y,this.channelzEnabled)this.childrenTracker.refChild(Y.getChannelzRef());Y.addDisconnectListener((W)=>{if(this.transitionToState([V6.ConnectivityState.READY],V6.ConnectivityState.IDLE),W&&this.keepaliveTime>0)this.keepaliveTime*=2,jN.log(tG.LogVerbosity.ERROR,`Connection to ${(0,D91.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`)})}else Y.shutdown()},(Y)=>{this.transitionToState([V6.ConnectivityState.CONNECTING],V6.ConnectivityState.TRANSIENT_FAILURE,`${Y}`)})}transitionToState(X,Y,W){var z,F;if(X.indexOf(this.connectivityState)===-1)return!1;if(W)this.trace(V6.ConnectivityState[this.connectivityState]+" -> "+V6.ConnectivityState[Y]+' with error "'+W+'"');else this.trace(V6.ConnectivityState[this.connectivityState]+" -> "+V6.ConnectivityState[Y]);if(this.channelzEnabled)this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+V6.ConnectivityState[Y]);let Q=this.connectivityState;switch(this.connectivityState=Y,Y){case V6.ConnectivityState.READY:this.stopBackoff();break;case V6.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case V6.ConnectivityState.TRANSIENT_FAILURE:if(this.channelzEnabled&&this.transport)this.childrenTracker.unrefChild(this.transport.getChannelzRef());if((z=this.transport)===null||z===void 0||z.shutdown(),this.transport=null,!this.backoffTimeout.isRunning())process.nextTick(()=>{this.handleBackoffTimer()});break;case V6.ConnectivityState.IDLE:if(this.channelzEnabled&&this.transport)this.childrenTracker.unrefChild(this.transport.getChannelzRef());(F=this.transport)===null||F===void 0||F.shutdown(),this.transport=null;break;default:throw Error(`Invalid state: unknown ConnectivityState ${Y}`)}for(let J of this.stateListeners)J(this,Q,Y,this.keepaliveTime,W);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){if(this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,this.refcount===0)this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,H4.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([V6.ConnectivityState.CONNECTING,V6.ConnectivityState.READY],V6.ConnectivityState.IDLE)})}unrefIfOneRef(){if(this.refcount===1)return this.unref(),!0;return!1}createCall(X,Y,W,z){if(!this.transport)throw Error("Cannot create call, subchannel not READY");let F;if(this.channelzEnabled)this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),F={onCallEnd:(Q)=>{if(Q.code===tG.Status.OK)this.callTracker.addCallSucceeded();else this.callTracker.addCallFailed()}};else F={};return this.transport.createCall(X,Y,W,z,F)}startConnecting(){process.nextTick(()=>{if(!this.transitionToState([V6.ConnectivityState.IDLE],V6.ConnectivityState.CONNECTING)){if(this.connectivityState===V6.ConnectivityState.TRANSIENT_FAILURE)this.continueConnecting=!0}})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(X){this.stateListeners.add(X)}removeConnectivityStateListener(X){this.stateListeners.delete(X)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([V6.ConnectivityState.TRANSIENT_FAILURE],V6.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(X){}removeHealthStateWatcher(X){}getRealSubchannel(){return this}realSubchannelEquals(X){return X.getRealSubchannel()===this}throttleKeepalive(X){if(X>this.keepaliveTime)this.keepaliveTime=X}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){if(!this.subchannelChannel)this.subchannelChannel=new C91.SingleSubchannelChannel(this,this.channelTarget,this.options);return this.subchannelChannel}addDataWatcher(X){throw Error("Not implemented")}getOrCreateDataProducer(X,Y){let W=this.dataProducers.get(X);if(W)return W;let z=Y(this);return this.dataProducers.set(X,z),z}removeDataProducer(X){this.dataProducers.delete(X)}}cX0.Subchannel=dX0});var aX0=X0((nX0)=>{var hN;Object.defineProperty(nX0,"__esModule",{value:!0});nX0.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0;nX0.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=((hN=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)!==null&&hN!==void 0?hN:"false")==="true"});var bN=X0((eX0)=>{Object.defineProperty(eX0,"__esModule",{value:!0});eX0.DEFAULT_PORT=void 0;eX0.setup=v91;var rX0=y8(),_N=F1("dns"),L91=DU(),xN=a1(),TY=h7(),P91=s6(),w91=A6(),S91=a1(),f5=E9(),oX0=F1("net"),f91=QY(),tX0=aX0(),y91="dns_resolver";function V4(X){w91.trace(S91.LogVerbosity.DEBUG,y91,X)}eX0.DEFAULT_PORT=443;var k91=30000;class sX0{constructor(X,Y,W){var z,F,Q;if(this.target=X,this.listener=Y,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,this.alternativeResolver=new _N.promises.Resolver,V4("Resolver constructed for target "+(0,f5.uriToString)(X)),X.authority)this.alternativeResolver.setServers([X.authority]);let J=(0,f5.splitHostPort)(X.path);if(J===null)this.ipResult=null,this.dnsHostname=null,this.port=null;else if((0,oX0.isIPv4)(J.host)||(0,oX0.isIPv6)(J.host))this.ipResult=[{addresses:[{host:J.host,port:(z=J.port)!==null&&z!==void 0?z:eX0.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null;else this.ipResult=null,this.dnsHostname=J.host,this.port=(F=J.port)!==null&&F!==void 0?F:eX0.DEFAULT_PORT;if(this.percentage=Math.random()*100,W["grpc.service_config_disable_resolution"]===1)this.isServiceConfigEnabled=!1;this.defaultResolutionError={code:xN.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,f5.uriToString)(this.target)}`,metadata:new P91.Metadata};let Z={initialDelay:W["grpc.initial_reconnect_backoff_ms"],maxDelay:W["grpc.max_reconnect_backoff_ms"]};this.backoff=new f91.BackoffTimeout(()=>{if(this.continueResolving)this.startResolutionWithBackoff()},Z),this.backoff.unref(),this.minTimeBetweenResolutionsMs=(Q=W["grpc.dns_min_time_between_resolutions_ms"])!==null&&Q!==void 0?Q:k91,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(this.ipResult!==null){if(!this.returnedIpResult)V4("Returning IP address for target "+(0,f5.uriToString)(this.target)),setImmediate(()=>{this.listener((0,TY.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0;this.backoff.stop(),this.backoff.reset(),this.stopNextResolutionTimer();return}if(this.dnsHostname===null)V4("Failed to parse DNS address "+(0,f5.uriToString)(this.target)),setImmediate(()=>{this.listener((0,TY.statusOrFromError)({code:xN.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,f5.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(this.pendingLookupPromise!==null)return;V4("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;let X=this.dnsHostname;if(this.pendingLookupPromise=this.lookup(X),this.pendingLookupPromise.then((Y)=>{if(this.pendingLookupPromise===null)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,TY.statusOrFromValue)(Y.map((F)=>({addresses:[F]})));let W="["+Y.map((F)=>F.host+":"+F.port).join(",")+"]";V4("Resolved addresses for target "+(0,f5.uriToString)(this.target)+": "+W);let z=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(z)},(Y)=>{if(this.pendingLookupPromise===null)return;V4("Resolution error for target "+(0,f5.uriToString)(this.target)+": "+Y.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,TY.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,"")}),this.isServiceConfigEnabled&&this.pendingTxtPromise===null)this.pendingTxtPromise=this.resolveTxt(X),this.pendingTxtPromise.then((Y)=>{if(this.pendingTxtPromise===null)return;this.pendingTxtPromise=null;let W;try{if(W=(0,L91.extractAndSelectServiceConfig)(Y,this.percentage),W)this.latestServiceConfigResult=(0,TY.statusOrFromValue)(W);else this.latestServiceConfigResult=null}catch(z){this.latestServiceConfigResult=(0,TY.statusOrFromError)({code:xN.Status.UNAVAILABLE,details:`Parsing service config failed with error ${z.message}`})}if(this.latestLookupResult!==null)this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},(Y)=>{})}}handleHealthStatus(X){if(X)this.backoff.stop(),this.backoff.reset();else this.continueResolving=!0}async lookup(X){if(tX0.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){V4("Using alternative DNS resolver.");let W=await Promise.allSettled([this.alternativeResolver.resolve4(X),this.alternativeResolver.resolve6(X)]);if(W.every((z)=>z.status==="rejected"))throw Error(W[0].reason);return W.reduce((z,F)=>{return F.status==="fulfilled"?[...z,...F.value]:z},[]).map((z)=>({host:z,port:+this.port}))}return(await _N.promises.lookup(X,{all:!0})).map((W)=>({host:W.address,port:+this.port}))}async resolveTxt(X){if(tX0.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)return V4("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(X);return _N.promises.resolveTxt(X)}startNextResolutionTimer(){var X,Y;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{if(this.stopNextResolutionTimer(),this.continueResolving)this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),(Y=(X=this.nextResolutionTimer).unref)===null||Y===void 0||Y.call(X),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){if(this.pendingLookupPromise===null)this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution()}updateResolution(){if(this.pendingLookupPromise===null)if(this.isNextResolutionTimerRunning||this.backoff.isRunning()){if(this.isNextResolutionTimerRunning)V4('resolution update delayed by "min time between resolutions" rate limit');else V4("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString());this.continueResolving=!0}else this.startResolutionWithBackoff()}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.returnedIpResult=!1}static getDefaultAuthority(X){return X.path}}function v91(){(0,rX0.registerResolver)("dns",sX0),(0,rX0.registerDefaultScheme)("dns")}});var uN=X0((JY0)=>{Object.defineProperty(JY0,"__esModule",{value:!0});JY0.parseCIDR=ZY0;JY0.mapProxyName=l91;JY0.getProxiedConnection=p91;var kQ=A6(),IY=a1(),YY0=F1("net"),h91=F1("http"),_91=A6(),XY0=y9(),vQ=E9(),x91=F1("url"),b91=bN(),u91="proxy";function $Y(X){_91.trace(IY.LogVerbosity.DEBUG,u91,X)}function m91(){let X="",Y="";if(process.env.grpc_proxy)Y="grpc_proxy",X=process.env.grpc_proxy;else if(process.env.https_proxy)Y="https_proxy",X=process.env.https_proxy;else if(process.env.http_proxy)Y="http_proxy",X=process.env.http_proxy;else return{};let W;try{W=new x91.URL(X)}catch(Z){return(0,kQ.log)(IY.LogVerbosity.ERROR,`cannot parse value of "${Y}" env var`),{}}if(W.protocol!=="http:")return(0,kQ.log)(IY.LogVerbosity.ERROR,`"${W.protocol}" scheme not supported in proxy URI`),{};let z=null;if(W.username)if(W.password)(0,kQ.log)(IY.LogVerbosity.INFO,"userinfo found in proxy URI"),z=decodeURIComponent(`${W.username}:${W.password}`);else z=W.username;let{hostname:F,port:Q}=W;if(Q==="")Q="80";let J={address:`${F}:${Q}`};if(z)J.creds=z;return $Y("Proxy server "+J.address+" set by environment variable "+Y),J}function g91(){let X=process.env.no_grpc_proxy,Y="no_grpc_proxy";if(!X)X=process.env.no_proxy,Y="no_proxy";if(X)return $Y("No proxy server list set by environment variable "+Y),X.split(",");else return[]}function ZY0(X){let Y=X.split("/");if(Y.length!==2)return null;let W=parseInt(Y[1],10);if(!(0,YY0.isIPv4)(Y[0])||Number.isNaN(W)||W<0||W>32)return null;return{ip:QY0(Y[0]),prefixLength:W}}function QY0(X){return X.split(".").reduce((Y,W)=>(Y<<8)+parseInt(W,10),0)}function d91(X,Y){let W=X.ip,z=-1<<32-X.prefixLength;return(QY0(Y)&z)===(W&z)}function c91(X){for(let Y of g91()){let W=ZY0(Y);if((0,YY0.isIPv4)(X)&&W&&d91(W,X))return!0;else if(X.endsWith(Y))return!0}return!1}function l91(X,Y){var W;let z={target:X,extraOptions:{}};if(((W=Y["grpc.enable_http_proxy"])!==null&&W!==void 0?W:1)===0)return z;if(X.scheme==="unix")return z;let F=m91();if(!F.address)return z;let Q=(0,vQ.splitHostPort)(X.path);if(!Q)return z;let J=Q.host;if(c91(J))return $Y("Not using proxy for target in no_proxy list: "+(0,vQ.uriToString)(X)),z;let Z={"grpc.http_connect_target":(0,vQ.uriToString)(X)};if(F.creds)Z["grpc.http_connect_creds"]=F.creds;return{target:{scheme:"dns",path:F.address},extraOptions:Z}}function p91(X,Y){var W;if(!("grpc.http_connect_target"in Y))return Promise.resolve(null);let z=Y["grpc.http_connect_target"],F=(0,vQ.parseUri)(z);if(F===null)return Promise.resolve(null);let Q=(0,vQ.splitHostPort)(F.path);if(Q===null)return Promise.resolve(null);let J=`${Q.host}:${(W=Q.port)!==null&&W!==void 0?W:b91.DEFAULT_PORT}`,Z={method:"CONNECT",path:J},K={Host:J};if((0,XY0.isTcpSubchannelAddress)(X))Z.host=X.host,Z.port=X.port;else Z.socketPath=X.path;if("grpc.http_connect_creds"in Y)K["Proxy-Authorization"]="Basic "+Buffer.from(Y["grpc.http_connect_creds"]).toString("base64");Z.headers=K;let H=(0,XY0.subchannelAddressToString)(X);return $Y("Using proxy "+H+" to connect to "+Z.path),new Promise((G,q)=>{let B=h91.request(Z);B.once("connect",($,R,E)=>{if(B.removeAllListeners(),R.removeAllListeners(),$.statusCode===200){if($Y("Successfully connected to "+Z.path+" through proxy "+H),E.length>0)R.unshift(E);$Y("Successfully established a plaintext connection to "+Z.path+" through proxy "+H),G(R)}else(0,kQ.log)(IY.LogVerbosity.ERROR,"Failed to connect to "+Z.path+" through proxy "+H+" with status "+$.statusCode),q()}),B.once("error",($)=>{B.removeAllListeners(),(0,kQ.log)(IY.LogVerbosity.ERROR,"Failed to connect to proxy "+H+" with error "+$.message),q()}),B.end()})}});var mN=X0((GY0)=>{Object.defineProperty(GY0,"__esModule",{value:!0});GY0.StreamDecoder=void 0;var B4;(function(X){X[X.NO_DATA=0]="NO_DATA",X[X.READING_SIZE=1]="READING_SIZE",X[X.READING_MESSAGE=2]="READING_MESSAGE"})(B4||(B4={}));class WY0{constructor(X){this.maxReadMessageLength=X,this.readState=B4.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(X){let Y=0,W,z=[];while(Y<X.length)switch(this.readState){case B4.NO_DATA:this.readCompressFlag=X.slice(Y,Y+1),Y+=1,this.readState=B4.READING_SIZE,this.readPartialSize.fill(0),this.readSizeRemaining=4,this.readMessageSize=0,this.readMessageRemaining=0,this.readPartialMessage=[];break;case B4.READING_SIZE:if(W=Math.min(X.length-Y,this.readSizeRemaining),X.copy(this.readPartialSize,4-this.readSizeRemaining,Y,Y+W),this.readSizeRemaining-=W,Y+=W,this.readSizeRemaining===0){if(this.readMessageSize=this.readPartialSize.readUInt32BE(0),this.maxReadMessageLength!==-1&&this.readMessageSize>this.maxReadMessageLength)throw Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=B4.READING_MESSAGE;else{let F=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=B4.NO_DATA,z.push(F)}}break;case B4.READING_MESSAGE:if(W=Math.min(X.length-Y,this.readMessageRemaining),this.readPartialMessage.push(X.slice(Y,Y+W)),this.readMessageRemaining-=W,Y+=W,this.readMessageRemaining===0){let F=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),Q=Buffer.concat(F,this.readMessageSize+5);this.readState=B4.NO_DATA,z.push(Q)}break;default:throw Error("Unexpected read state")}return z}}GY0.StreamDecoder=WY0});var HY0=X0((zY0)=>{Object.defineProperty(zY0,"__esModule",{value:!0});zY0.Http2SubchannelCall=void 0;var n4=F1("http2"),r91=F1("os"),B6=a1(),i4=s6(),o91=mN(),t91=A6(),s91=a1(),e91="subchannel_call";function X81(X){for(let[Y,W]of Object.entries(r91.constants.errno))if(W===X)return Y;return"Unknown system error "+X}function gN(X){let Y=`Received HTTP status code ${X}`,W;switch(X){case 400:W=B6.Status.INTERNAL;break;case 401:W=B6.Status.UNAUTHENTICATED;break;case 403:W=B6.Status.PERMISSION_DENIED;break;case 404:W=B6.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:W=B6.Status.UNAVAILABLE;break;default:W=B6.Status.UNKNOWN}return{code:W,details:Y,metadata:new i4.Metadata}}class FY0{constructor(X,Y,W,z,F){var Q;this.http2Stream=X,this.callEventTracker=Y,this.listener=W,this.transport=z,this.callId=F,this.isReadFilterPending=!1,this.isPushPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.finalStatus=null,this.internalError=null,this.serverEndedCall=!1,this.connectionDropped=!1;let J=(Q=z.getOptions()["grpc.max_receive_message_length"])!==null&&Q!==void 0?Q:B6.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new o91.StreamDecoder(J),X.on("response",(Z,K)=>{let H="";for(let G of Object.keys(Z))H+="\t\t"+G+": "+Z[G]+`
487
+ `)++F;if(++W===z)throw H("comment");M=w,w=q(W)}while(M!=="*"||w!=="/");if(++W,y)B(P,W-2,v),v=!0;C=!0}else return"/"}}while(C);var f=W;HN.lastIndex=0;var _=HN.test(q(f++));if(!_)while(f<z&&!HN.test(q(f)))++f;var b=X.substring(W,W=f);if(b==='"'||b==="'")K=b;return b}function U(C){Z.push(C)}function A(){if(!Z.length){var C=E();if(C===null)return null;U(C)}return Z[0]}function T(C,M){var w=A(),P=w===C;if(P)return E(),!0;if(!M)throw H("token '"+w+"', '"+C+"' expected");return!1}function I(C){var M=null,w;if(C===void 0){if(w=J[F-1],delete J[F-1],w&&(Y||w.type==="*"||w.lineEmpty))M=w.leading?w.text:null}else{if(Q<C)A();if(w=J[C],delete J[C],w&&!w.lineEmpty&&(Y||w.type==="/"))M=w.leading?null:w.text}return M}return Object.defineProperty({next:E,peek:A,push:U,skip:T,cmnt:I},"line",{get:function(){return F}})}});var w70=X0((JE1,P70)=>{P70.exports=c4;c4.filename=null;c4.defaults={keepCase:!1};var H11=VN(),C70=jG(),R70=fG(),M70=R5(),V11=RG(),L70=b7(),B11=j8(),U11=LG(),N11=MG(),A11=M5(),O11=u7(),BN=e6(),T11=/^[1-9][0-9]*$/,I11=/^-?[1-9][0-9]*$/,$11=/^0[x][0-9a-fA-F]+$/,D11=/^-?0[x][0-9a-fA-F]+$/,E11=/^0[0-7]+$/,C11=/^-?0[0-7]+$/,R11=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,W4=/^[a-zA-Z_][a-zA-Z_0-9]*$/,G4=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;function c4(X,Y,W){if(!(Y instanceof C70))W=Y,Y=new C70;if(!W)W=c4.defaults;var z=W.preferTrailingComment||!1,F=H11(X,W.alternateCommentMode||!1),Q=F.next,J=F.push,Z=F.peek,K=F.skip,H=F.cmnt,G=!0,q,B,$,R="proto2",E=Y,U=[],A={},T=W.keepCase?function(T0){return T0}:BN.camelCase;function I(){U.forEach((T0)=>{T0._edition=R,Object.keys(A).forEach((U0)=>{if(T0.getOption(U0)!==void 0)return;T0.setOption(U0,A[U0],!0)})})}function C(T0,U0,Y0){var K0=c4.filename;if(!Y0)c4.filename=null;return Error("illegal "+(U0||"token")+" '"+T0+"' ("+(K0?K0+", ":"")+"line "+F.line+")")}function M(){var T0=[],U0;do{if((U0=Q())!=='"'&&U0!=="'")throw C(U0);T0.push(Q()),K(U0),U0=Z()}while(U0==='"'||U0==="'");return T0.join("")}function w(T0){var U0=Q();switch(U0){case"'":case'"':return J(U0),M();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return y(U0,!0)}catch(Y0){if(T0&&G4.test(U0))return U0;throw C(U0,"value")}}function P(T0,U0){var Y0,K0;do if(U0&&((Y0=Z())==='"'||Y0==="'")){var N0=M();if(T0.push(N0),R>=2023)throw C(N0,"id")}else try{T0.push([K0=v(Q()),K("to",!0)?v(Q()):K0])}catch(O0){if(U0&&G4.test(Y0)&&R>=2023)T0.push(Y0);else throw O0}while(K(",",!0));var M0={options:void 0};M0.setOption=function(O0,$0){if(this.options===void 0)this.options={};this.options[O0]=$0},l(M0,function($0){if($0==="option")e(M0,$0),K(";");else throw C($0)},function(){t(M0)})}function y(T0,U0){var Y0=1;if(T0.charAt(0)==="-")Y0=-1,T0=T0.substring(1);switch(T0){case"inf":case"INF":case"Inf":return Y0*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(T11.test(T0))return Y0*parseInt(T0,10);if($11.test(T0))return Y0*parseInt(T0,16);if(E11.test(T0))return Y0*parseInt(T0,8);if(R11.test(T0))return Y0*parseFloat(T0);throw C(T0,"number",U0)}function v(T0,U0){switch(T0){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!U0&&T0.charAt(0)==="-")throw C(T0,"id");if(I11.test(T0))return parseInt(T0,10);if(D11.test(T0))return parseInt(T0,16);if(C11.test(T0))return parseInt(T0,8);throw C(T0,"id")}function f(){if(q!==void 0)throw C("package");if(q=Q(),!G4.test(q))throw C(q,"name");E=E.define(q),K(";")}function _(){var T0=Z(),U0;switch(T0){case"weak":U0=$||($=[]),Q();break;case"public":Q();default:U0=B||(B=[]);break}T0=M(),K(";"),U0.push(T0)}function b(){if(K("="),R=M(),R<2023)throw C(R,"syntax");K(";")}function x(){if(K("="),R=M(),!["2023"].includes(R))throw C(R,"edition");K(";")}function k(T0,U0){switch(U0){case"option":return e(T0,U0),K(";"),!0;case"message":return Z0(T0,U0),!0;case"enum":return Q0(T0,U0),!0;case"service":return J0(T0,U0),!0;case"extend":return A0(T0,U0),!0}return!1}function l(T0,U0,Y0){var K0=F.line;if(T0){if(typeof T0.comment!=="string")T0.comment=H();T0.filename=c4.filename}if(K("{",!0)){var N0;while((N0=Q())!=="}")U0(N0);K(";",!0)}else{if(Y0)Y0();if(K(";"),T0&&(typeof T0.comment!=="string"||z))T0.comment=H(K0)||T0.comment}}function Z0(T0,U0){if(!W4.test(U0=Q()))throw C(U0,"type name");var Y0=new R70(U0);if(l(Y0,function(N0){if(k(Y0,N0))return;switch(N0){case"map":p(Y0,N0);break;case"required":if(R!=="proto2")throw C(N0);case"repeated":m(Y0,N0);break;case"optional":if(R==="proto3")m(Y0,"proto3_optional");else if(R!=="proto2")throw C(N0);else m(Y0,"optional");break;case"oneof":n(Y0,N0);break;case"extensions":P(Y0.extensions||(Y0.extensions=[]));break;case"reserved":P(Y0.reserved||(Y0.reserved=[]),!0);break;default:if(R==="proto2"||!G4.test(N0))throw C(N0);J(N0),m(Y0,"optional");break}}),T0.add(Y0),T0===E)U.push(Y0)}function m(T0,U0,Y0){var K0=Q();if(K0==="group"){h(T0,U0);return}while(K0.endsWith(".")||Z().startsWith("."))K0+=Q();if(!G4.test(K0))throw C(K0,"type");var N0=Q();if(!W4.test(N0))throw C(N0,"name");N0=T(N0),K("=");var M0=new M70(N0,v(Q()),K0,U0,Y0);if(l(M0,function(R0){if(R0==="option")e(M0,R0),K(";");else throw C(R0)},function(){t(M0)}),U0==="proto3_optional"){var O0=new L70("_"+N0);M0.setOption("proto3_optional",!0),O0.add(M0),T0.add(O0)}else T0.add(M0);if(T0===E)U.push(M0)}function h(T0,U0){if(R>=2023)throw C("group");var Y0=Q();if(!W4.test(Y0))throw C(Y0,"name");var K0=BN.lcFirst(Y0);if(Y0===K0)Y0=BN.ucFirst(Y0);K("=");var N0=v(Q()),M0=new R70(Y0);M0.group=!0;var O0=new M70(K0,N0,Y0,U0);O0.filename=c4.filename,l(M0,function(R0){switch(R0){case"option":e(M0,R0),K(";");break;case"required":case"repeated":m(M0,R0);break;case"optional":if(R==="proto3")m(M0,"proto3_optional");else m(M0,"optional");break;case"message":Z0(M0,R0);break;case"enum":Q0(M0,R0);break;case"reserved":P(M0.reserved||(M0.reserved=[]),!0);break;default:throw C(R0)}}),T0.add(M0).add(O0)}function p(T0){K("<");var U0=Q();if(O11.mapKey[U0]===void 0)throw C(U0,"type");K(",");var Y0=Q();if(!G4.test(Y0))throw C(Y0,"type");K(">");var K0=Q();if(!W4.test(K0))throw C(K0,"name");K("=");var N0=new V11(T(K0),v(Q()),U0,Y0);l(N0,function(O0){if(O0==="option")e(N0,O0),K(";");else throw C(O0)},function(){t(N0)}),T0.add(N0)}function n(T0,U0){if(!W4.test(U0=Q()))throw C(U0,"name");var Y0=new L70(T(U0));l(Y0,function(N0){if(N0==="option")e(Y0,N0),K(";");else J(N0),m(Y0,"optional")}),T0.add(Y0)}function Q0(T0,U0){if(!W4.test(U0=Q()))throw C(U0,"name");var Y0=new B11(U0);if(l(Y0,function(N0){switch(N0){case"option":e(Y0,N0),K(";");break;case"reserved":if(P(Y0.reserved||(Y0.reserved=[]),!0),Y0.reserved===void 0)Y0.reserved=[];break;default:c(Y0,N0)}}),T0.add(Y0),T0===E)U.push(Y0)}function c(T0,U0){if(!W4.test(U0))throw C(U0,"name");K("=");var Y0=v(Q(),!0),K0={options:void 0};K0.getOption=function(N0){return this.options[N0]},K0.setOption=function(N0,M0){A11.prototype.setOption.call(K0,N0,M0)},K0.setParsedOption=function(){return},l(K0,function(M0){if(M0==="option")e(K0,M0),K(";");else throw C(M0)},function(){t(K0)}),T0.add(U0,Y0,K0.comment,K0.parsedOptions||K0.options)}function e(T0,U0){var Y0,K0,N0=!0;if(U0==="option")U0=Q();while(U0!=="="){if(U0==="("){var M0=Q();K(")"),U0="("+M0+")"}if(N0){if(N0=!1,U0.includes(".")&&!U0.includes("(")){var O0=U0.split(".");Y0=O0[0]+".",U0=O0[1];continue}Y0=U0}else K0=K0?K0+=U0:U0;U0=Q()}var $0=K0?Y0.concat(K0):Y0,R0=g(T0,$0);K0=K0&&K0[0]==="."?K0.slice(1):K0,Y0=Y0&&Y0[Y0.length-1]==="."?Y0.slice(0,-1):Y0,r(T0,Y0,R0,K0)}function g(T0,U0){if(K("{",!0)){var Y0={};while(!K("}",!0)){if(!W4.test(L0=Q()))throw C(L0,"name");if(L0===null)throw C(L0,"end of input");var K0,N0=L0;if(K(":",!0),Z()==="{")K0=g(T0,U0+"."+L0);else if(Z()==="["){K0=[];var M0;if(K("[",!0)){do M0=w(!0),K0.push(M0);while(K(",",!0));if(K("]"),typeof M0<"u")u(T0,U0+"."+L0,M0)}}else K0=w(!0),u(T0,U0+"."+L0,K0);var O0=Y0[N0];if(O0)K0=[].concat(O0).concat(K0);Y0[N0]=K0,K(",",!0),K(";",!0)}return Y0}var $0=w(!0);return u(T0,U0,$0),$0}function u(T0,U0,Y0){if(E===T0&&/^features\./.test(U0)){A[U0]=Y0;return}if(T0.setOption)T0.setOption(U0,Y0)}function r(T0,U0,Y0,K0){if(T0.setParsedOption)T0.setParsedOption(U0,Y0,K0)}function t(T0){if(K("[",!0)){do e(T0,"option");while(K(",",!0));K("]")}return T0}function J0(T0,U0){if(!W4.test(U0=Q()))throw C(U0,"service name");var Y0=new U11(U0);if(l(Y0,function(N0){if(k(Y0,N0))return;if(N0==="rpc")V0(Y0,N0);else throw C(N0)}),T0.add(Y0),T0===E)U.push(Y0)}function V0(T0,U0){var Y0=H(),K0=U0;if(!W4.test(U0=Q()))throw C(U0,"name");var N0=U0,M0,O0,$0,R0;if(K("("),K("stream",!0))O0=!0;if(!G4.test(U0=Q()))throw C(U0);if(M0=U0,K(")"),K("returns"),K("("),K("stream",!0))R0=!0;if(!G4.test(U0=Q()))throw C(U0);$0=U0,K(")");var w0=new N11(N0,K0,M0,$0,O0,R0);w0.comment=Y0,l(w0,function(k0){if(k0==="option")e(w0,k0),K(";");else throw C(k0)}),T0.add(w0)}function A0(T0,U0){if(!G4.test(U0=Q()))throw C(U0,"reference");var Y0=U0;l(null,function(N0){switch(N0){case"required":case"repeated":m(T0,N0,Y0);break;case"optional":if(R==="proto3")m(T0,"proto3_optional",Y0);else m(T0,"optional",Y0);break;default:if(R==="proto2"||!G4.test(N0))throw C(N0);J(N0),m(T0,"optional",Y0);break}})}var L0;while((L0=Q())!==null)switch(L0){case"package":if(!G)throw C(L0);f();break;case"import":if(!G)throw C(L0);_();break;case"syntax":if(!G)throw C(L0);b();break;case"edition":if(!G)throw C(L0);x();break;case"option":e(E,L0),K(";",!0);break;default:if(k(E,L0)){G=!1;continue}throw C(L0)}return I(),c4.filename=null,{package:q,imports:B,weakImports:$,root:Y}}});var y70=X0((WE1,f70)=>{f70.exports=_8;var M11=/\/|\./;function _8(X,Y){if(!M11.test(X))X="google/protobuf/"+X+".proto",Y={nested:{google:{nested:{protobuf:{nested:Y}}}}};_8[X]=Y}_8("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var S70;_8("duration",{Duration:S70={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});_8("timestamp",{Timestamp:S70});_8("empty",{Empty:{fields:{}}});_8("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});_8("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});_8("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});_8.get=function(Y){return _8[Y]||null}});var uG=X0((GE1,k70)=>{var P5=k70.exports=I70();P5.build="full";P5.tokenize=VN();P5.parse=w70();P5.common=y70();P5.Root._configure(P5.Type,P5.parse,P5.common)});var UN=X0((KE1,L11)=>{L11.exports={nested:{google:{nested:{protobuf:{options:{go_package:"google.golang.org/protobuf/types/descriptorpb",java_package:"com.google.protobuf",java_outer_classname:"DescriptorProtos",csharp_namespace:"Google.Protobuf.Reflection",objc_class_prefix:"GPB",cc_enable_arenas:!0,optimize_for:"SPEED"},nested:{FileDescriptorSet:{edition:"proto2",fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}},extensions:[[536000000,536000000]]},Edition:{edition:"proto2",values:{EDITION_UNKNOWN:0,EDITION_LEGACY:900,EDITION_PROTO2:998,EDITION_PROTO3:999,EDITION_2023:1000,EDITION_2024:1001,EDITION_1_TEST_ONLY:1,EDITION_2_TEST_ONLY:2,EDITION_99997_TEST_ONLY:99997,EDITION_99998_TEST_ONLY:99998,EDITION_99999_TEST_ONLY:99999,EDITION_MAX:2147483647}},FileDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},package:{type:"string",id:2},dependency:{rule:"repeated",type:"string",id:3},publicDependency:{rule:"repeated",type:"int32",id:10},weakDependency:{rule:"repeated",type:"int32",id:11},optionDependency:{rule:"repeated",type:"string",id:15},messageType:{rule:"repeated",type:"DescriptorProto",id:4},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:5},service:{rule:"repeated",type:"ServiceDescriptorProto",id:6},extension:{rule:"repeated",type:"FieldDescriptorProto",id:7},options:{type:"FileOptions",id:8},sourceCodeInfo:{type:"SourceCodeInfo",id:9},syntax:{type:"string",id:12},edition:{type:"Edition",id:14}}},DescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},field:{rule:"repeated",type:"FieldDescriptorProto",id:2},extension:{rule:"repeated",type:"FieldDescriptorProto",id:6},nestedType:{rule:"repeated",type:"DescriptorProto",id:3},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:4},extensionRange:{rule:"repeated",type:"ExtensionRange",id:5},oneofDecl:{rule:"repeated",type:"OneofDescriptorProto",id:8},options:{type:"MessageOptions",id:7},reservedRange:{rule:"repeated",type:"ReservedRange",id:9},reservedName:{rule:"repeated",type:"string",id:10},visibility:{type:"SymbolVisibility",id:11}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2},options:{type:"ExtensionRangeOptions",id:3}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},ExtensionRangeOptions:{edition:"proto2",fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999},declaration:{rule:"repeated",type:"Declaration",id:2,options:{retention:"RETENTION_SOURCE"}},features:{type:"FeatureSet",id:50},verification:{type:"VerificationState",id:3,options:{default:"UNVERIFIED",retention:"RETENTION_SOURCE"}}},extensions:[[1000,536870911]],nested:{Declaration:{fields:{number:{type:"int32",id:1},fullName:{type:"string",id:2},type:{type:"string",id:3},reserved:{type:"bool",id:5},repeated:{type:"bool",id:6}},reserved:[[4,4]]},VerificationState:{values:{DECLARATION:0,UNVERIFIED:1}}}},FieldDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:3},label:{type:"Label",id:4},type:{type:"Type",id:5},typeName:{type:"string",id:6},extendee:{type:"string",id:2},defaultValue:{type:"string",id:7},oneofIndex:{type:"int32",id:9},jsonName:{type:"string",id:10},options:{type:"FieldOptions",id:8},proto3Optional:{type:"bool",id:17}},nested:{Type:{values:{TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Label:{values:{LABEL_OPTIONAL:1,LABEL_REPEATED:3,LABEL_REQUIRED:2}}}},OneofDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3},reservedRange:{rule:"repeated",type:"EnumReservedRange",id:4},reservedName:{rule:"repeated",type:"string",id:5},visibility:{type:"SymbolVisibility",id:6}},nested:{EnumReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},EnumValueDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},inputType:{type:"string",id:2},outputType:{type:"string",id:3},options:{type:"MethodOptions",id:4},clientStreaming:{type:"bool",id:5},serverStreaming:{type:"bool",id:6}}},FileOptions:{edition:"proto2",fields:{javaPackage:{type:"string",id:1},javaOuterClassname:{type:"string",id:8},javaMultipleFiles:{type:"bool",id:10},javaGenerateEqualsAndHash:{type:"bool",id:20,options:{deprecated:!0}},javaStringCheckUtf8:{type:"bool",id:27},optimizeFor:{type:"OptimizeMode",id:9,options:{default:"SPEED"}},goPackage:{type:"string",id:11},ccGenericServices:{type:"bool",id:16},javaGenericServices:{type:"bool",id:17},pyGenericServices:{type:"bool",id:18},deprecated:{type:"bool",id:23},ccEnableArenas:{type:"bool",id:31,options:{default:!0}},objcClassPrefix:{type:"string",id:36},csharpNamespace:{type:"string",id:37},swiftPrefix:{type:"string",id:39},phpClassPrefix:{type:"string",id:40},phpNamespace:{type:"string",id:41},phpMetadataNamespace:{type:"string",id:44},rubyPackage:{type:"string",id:45},features:{type:"FeatureSet",id:50},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]],reserved:[[42,42],[38,38],"php_generic_services"],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{edition:"proto2",fields:{messageSetWireFormat:{type:"bool",id:1},noStandardDescriptorAccessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},mapEntry:{type:"bool",id:7},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:11,options:{deprecated:!0}},features:{type:"FeatureSet",id:12},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]],reserved:[[4,4],[5,5],[6,6],[8,8],[9,9]]},FieldOptions:{edition:"proto2",fields:{ctype:{type:"CType",id:1,options:{default:"STRING"}},packed:{type:"bool",id:2},jstype:{type:"JSType",id:6,options:{default:"JS_NORMAL"}},lazy:{type:"bool",id:5},unverifiedLazy:{type:"bool",id:15},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10,options:{deprecated:!0}},debugRedact:{type:"bool",id:16},retention:{type:"OptionRetention",id:17},targets:{rule:"repeated",type:"OptionTargetType",id:19},editionDefaults:{rule:"repeated",type:"EditionDefault",id:20},features:{type:"FeatureSet",id:21},featureSupport:{type:"FeatureSupport",id:22},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]],reserved:[[4,4],[18,18]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}},OptionRetention:{values:{RETENTION_UNKNOWN:0,RETENTION_RUNTIME:1,RETENTION_SOURCE:2}},OptionTargetType:{values:{TARGET_TYPE_UNKNOWN:0,TARGET_TYPE_FILE:1,TARGET_TYPE_EXTENSION_RANGE:2,TARGET_TYPE_MESSAGE:3,TARGET_TYPE_FIELD:4,TARGET_TYPE_ONEOF:5,TARGET_TYPE_ENUM:6,TARGET_TYPE_ENUM_ENTRY:7,TARGET_TYPE_SERVICE:8,TARGET_TYPE_METHOD:9}},EditionDefault:{fields:{edition:{type:"Edition",id:3},value:{type:"string",id:2}}},FeatureSupport:{fields:{editionIntroduced:{type:"Edition",id:1},editionDeprecated:{type:"Edition",id:2},deprecationWarning:{type:"string",id:3},editionRemoved:{type:"Edition",id:4}}}}},OneofOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:1},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]]},EnumOptions:{edition:"proto2",fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:6,options:{deprecated:!0}},features:{type:"FeatureSet",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]],reserved:[[5,5]]},EnumValueOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:1},features:{type:"FeatureSet",id:2},debugRedact:{type:"bool",id:3},featureSupport:{type:"FieldOptions.FeatureSupport",id:4},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]]},ServiceOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:34},deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]]},MethodOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:33},idempotencyLevel:{type:"IdempotencyLevel",id:34,options:{default:"IDEMPOTENCY_UNKNOWN"}},features:{type:"FeatureSet",id:35},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1000,536870911]],nested:{IdempotencyLevel:{values:{IDEMPOTENCY_UNKNOWN:0,NO_SIDE_EFFECTS:1,IDEMPOTENT:2}}}},UninterpretedOption:{edition:"proto2",fields:{name:{rule:"repeated",type:"NamePart",id:2},identifierValue:{type:"string",id:3},positiveIntValue:{type:"uint64",id:4},negativeIntValue:{type:"int64",id:5},doubleValue:{type:"double",id:6},stringValue:{type:"bytes",id:7},aggregateValue:{type:"string",id:8}},nested:{NamePart:{fields:{namePart:{rule:"required",type:"string",id:1},isExtension:{rule:"required",type:"bool",id:2}}}}},FeatureSet:{edition:"proto2",fields:{fieldPresence:{type:"FieldPresence",id:1,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},enumType:{type:"EnumType",id:2,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},repeatedFieldEncoding:{type:"RepeatedFieldEncoding",id:3,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},utf8Validation:{type:"Utf8Validation",id:4,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},messageEncoding:{type:"MessageEncoding",id:5,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_LEGACY","edition_defaults.value":"LENGTH_PREFIXED"}},jsonFormat:{type:"JsonFormat",id:6,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}},enforceNamingStyle:{type:"EnforceNamingStyle",id:7,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_METHOD","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"STYLE2024"}},defaultSymbolVisibility:{type:"VisibilityFeature.DefaultSymbolVisibility",id:8,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"EXPORT_TOP_LEVEL"}}},extensions:[[1000,9994],[9995,9999],[1e4,1e4]],reserved:[[999,999]],nested:{FieldPresence:{values:{FIELD_PRESENCE_UNKNOWN:0,EXPLICIT:1,IMPLICIT:2,LEGACY_REQUIRED:3}},EnumType:{values:{ENUM_TYPE_UNKNOWN:0,OPEN:1,CLOSED:2}},RepeatedFieldEncoding:{values:{REPEATED_FIELD_ENCODING_UNKNOWN:0,PACKED:1,EXPANDED:2}},Utf8Validation:{values:{UTF8_VALIDATION_UNKNOWN:0,VERIFY:2,NONE:3}},MessageEncoding:{values:{MESSAGE_ENCODING_UNKNOWN:0,LENGTH_PREFIXED:1,DELIMITED:2}},JsonFormat:{values:{JSON_FORMAT_UNKNOWN:0,ALLOW:1,LEGACY_BEST_EFFORT:2}},EnforceNamingStyle:{values:{ENFORCE_NAMING_STYLE_UNKNOWN:0,STYLE2024:1,STYLE_LEGACY:2}},VisibilityFeature:{fields:{},reserved:[[1,536870911]],nested:{DefaultSymbolVisibility:{values:{DEFAULT_SYMBOL_VISIBILITY_UNKNOWN:0,EXPORT_ALL:1,EXPORT_TOP_LEVEL:2,LOCAL_ALL:3,STRICT:4}}}}}},FeatureSetDefaults:{edition:"proto2",fields:{defaults:{rule:"repeated",type:"FeatureSetEditionDefault",id:1},minimumEdition:{type:"Edition",id:4},maximumEdition:{type:"Edition",id:5}},nested:{FeatureSetEditionDefault:{fields:{edition:{type:"Edition",id:3},overridableFeatures:{type:"FeatureSet",id:4},fixedFeatures:{type:"FeatureSet",id:5}},reserved:[[1,1],[2,2],"features"]}}},SourceCodeInfo:{edition:"proto2",fields:{location:{rule:"repeated",type:"Location",id:1}},extensions:[[536000000,536000000]],nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},span:{rule:"repeated",type:"int32",id:2,options:{packed:!0}},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{edition:"proto2",fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4},semantic:{type:"Semantic",id:5}},nested:{Semantic:{values:{NONE:0,SET:1,ALIAS:2}}}}}},SymbolVisibility:{edition:"proto2",values:{VISIBILITY_UNSET:0,VISIBILITY_LOCAL:1,VISIBILITY_EXPORT:2}}}}}}}}});var u70=X0((l1,b70)=>{var p9=uG();b70.exports=l1=p9.descriptor=p9.Root.fromJSON(UN()).lookup(".google.protobuf");var{Namespace:v70,Root:EQ,Enum:l4,Type:K4,Field:w5,MapField:P11,OneOf:mG,Service:CQ,Method:gG}=p9;EQ.fromDescriptor=function(Y){if(typeof Y.length==="number")Y=l1.FileDescriptorSet.decode(Y);var W=new EQ;if(Y.file){var z,F;for(var Q=0,J;Q<Y.file.length;++Q){if(F=W,(z=Y.file[Q]).package&&z.package.length)F=W.define(z.package);var Z=x11(z);if(z.name&&z.name.length)W.files.push(F.filename=z.name);if(z.messageType)for(J=0;J<z.messageType.length;++J)F.add(K4.fromDescriptor(z.messageType[J],Z));if(z.enumType)for(J=0;J<z.enumType.length;++J)F.add(l4.fromDescriptor(z.enumType[J],Z));if(z.extension)for(J=0;J<z.extension.length;++J)F.add(w5.fromDescriptor(z.extension[J],Z));if(z.service)for(J=0;J<z.service.length;++J)F.add(CQ.fromDescriptor(z.service[J],Z));var K=VY(z.options,l1.FileOptions);if(K){var H=Object.keys(K);for(J=0;J<H.length;++J)F.setOption(H[J],K[H[J]])}}}return W.resolveAll()};EQ.prototype.toDescriptor=function(Y){var W=l1.FileDescriptorSet.create();return j70(this,W.file,Y),W};function j70(X,Y,W){var z=l1.FileDescriptorProto.create({name:X.filename||(X.fullName.substring(1).replace(/\./g,"_")||"root")+".proto"});if(b11(W,z),!(X instanceof EQ))z.package=X.fullName.substring(1);for(var F=0,Q;F<X.nestedArray.length;++F)if((Q=X._nestedArray[F])instanceof K4)z.messageType.push(Q.toDescriptor(W));else if(Q instanceof l4)z.enumType.push(Q.toDescriptor());else if(Q instanceof w5)z.extension.push(Q.toDescriptor(W));else if(Q instanceof CQ)z.service.push(Q.toDescriptor());else if(Q instanceof v70)j70(Q,Y,W);if(z.options=BY(X.options,l1.FileOptions),z.messageType.length+z.enumType.length+z.extension.length+z.service.length)Y.push(z)}var w11=0;K4.fromDescriptor=function(Y,W,z){if(typeof Y.length==="number")Y=l1.DescriptorProto.decode(Y);var F=new K4(Y.name.length?Y.name:"Type"+w11++,VY(Y.options,l1.MessageOptions)),Q;if(!z)F._edition=W;if(Y.oneofDecl)for(Q=0;Q<Y.oneofDecl.length;++Q)F.add(mG.fromDescriptor(Y.oneofDecl[Q]));if(Y.field)for(Q=0;Q<Y.field.length;++Q){var J=w5.fromDescriptor(Y.field[Q],W,!0);if(F.add(J),Y.field[Q].hasOwnProperty("oneofIndex"))F.oneofsArray[Y.field[Q].oneofIndex].add(J)}if(Y.extension)for(Q=0;Q<Y.extension.length;++Q)F.add(w5.fromDescriptor(Y.extension[Q],W,!0));if(Y.nestedType){for(Q=0;Q<Y.nestedType.length;++Q)if(F.add(K4.fromDescriptor(Y.nestedType[Q],W,!0)),Y.nestedType[Q].options&&Y.nestedType[Q].options.mapEntry)F.setOption("map_entry",!0)}if(Y.enumType)for(Q=0;Q<Y.enumType.length;++Q)F.add(l4.fromDescriptor(Y.enumType[Q],W,!0));if(Y.extensionRange&&Y.extensionRange.length){F.extensions=[];for(Q=0;Q<Y.extensionRange.length;++Q)F.extensions.push([Y.extensionRange[Q].start,Y.extensionRange[Q].end])}if(Y.reservedRange&&Y.reservedRange.length||Y.reservedName&&Y.reservedName.length){if(F.reserved=[],Y.reservedRange)for(Q=0;Q<Y.reservedRange.length;++Q)F.reserved.push([Y.reservedRange[Q].start,Y.reservedRange[Q].end]);if(Y.reservedName)for(Q=0;Q<Y.reservedName.length;++Q)F.reserved.push(Y.reservedName[Q])}return F};K4.prototype.toDescriptor=function(Y){var W=l1.DescriptorProto.create({name:this.name}),z;for(z=0;z<this.fieldsArray.length;++z){var F;if(W.field.push(F=this._fieldsArray[z].toDescriptor(Y)),this._fieldsArray[z]instanceof P11){var Q=NN(this._fieldsArray[z].keyType,this._fieldsArray[z].resolvedKeyType,!1),J=NN(this._fieldsArray[z].type,this._fieldsArray[z].resolvedType,!1),Z=J===11||J===14?this._fieldsArray[z].resolvedType&&x70(this.parent,this._fieldsArray[z].resolvedType)||this._fieldsArray[z].type:void 0;W.nestedType.push(l1.DescriptorProto.create({name:F.typeName,field:[l1.FieldDescriptorProto.create({name:"key",number:1,label:1,type:Q}),l1.FieldDescriptorProto.create({name:"value",number:2,label:1,type:J,typeName:Z})],options:l1.MessageOptions.create({mapEntry:!0})}))}}for(z=0;z<this.oneofsArray.length;++z)W.oneofDecl.push(this._oneofsArray[z].toDescriptor());for(z=0;z<this.nestedArray.length;++z)if(this._nestedArray[z]instanceof w5)W.field.push(this._nestedArray[z].toDescriptor(Y));else if(this._nestedArray[z]instanceof K4)W.nestedType.push(this._nestedArray[z].toDescriptor(Y));else if(this._nestedArray[z]instanceof l4)W.enumType.push(this._nestedArray[z].toDescriptor());if(this.extensions)for(z=0;z<this.extensions.length;++z)W.extensionRange.push(l1.DescriptorProto.ExtensionRange.create({start:this.extensions[z][0],end:this.extensions[z][1]}));if(this.reserved)for(z=0;z<this.reserved.length;++z)if(typeof this.reserved[z]==="string")W.reservedName.push(this.reserved[z]);else W.reservedRange.push(l1.DescriptorProto.ReservedRange.create({start:this.reserved[z][0],end:this.reserved[z][1]}));return W.options=BY(this.options,l1.MessageOptions),W};var S11=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;w5.fromDescriptor=function(Y,W,z){if(typeof Y.length==="number")Y=l1.DescriptorProto.decode(Y);if(typeof Y.number!=="number")throw Error("missing field id");var F;if(Y.typeName&&Y.typeName.length)F=Y.typeName;else F=j11(Y.type);var Q;switch(Y.label){case 1:Q=void 0;break;case 2:Q="required";break;case 3:Q="repeated";break;default:throw Error("illegal label: "+Y.label)}var J=Y.extendee;if(Y.extendee!==void 0)J=J.length?J:void 0;var Z=new w5(Y.name.length?Y.name:"field"+Y.number,Y.number,F,Q,J);if(!z)Z._edition=W;if(Z.options=VY(Y.options,l1.FieldOptions),Y.proto3_optional)Z.options.proto3_optional=!0;if(Y.defaultValue&&Y.defaultValue.length){var K=Y.defaultValue;switch(K){case"true":case"TRUE":K=!0;break;case"false":case"FALSE":K=!1;break;default:var H=S11.exec(K);if(H)K=parseInt(K);break}Z.setOption("default",K)}if(h11(Y.type)){if(W==="proto3"){if(Y.options&&!Y.options.packed)Z.setOption("packed",!1)}else if((!W||W==="proto2")&&Y.options&&Y.options.packed)Z.setOption("packed",!0)}return Z};w5.prototype.toDescriptor=function(Y){var W=l1.FieldDescriptorProto.create({name:this.name,number:this.id});if(this.map)W.type=11,W.typeName=p9.util.ucFirst(this.name),W.label=3;else{switch(W.type=NN(this.type,this.resolve().resolvedType,this.delimited)){case 10:case 11:case 14:W.typeName=this.resolvedType?x70(this.parent,this.resolvedType):this.type;break}if(this.rule==="repeated")W.label=3;else if(this.required&&Y==="proto2")W.label=2;else W.label=1}if(W.extendee=this.extensionField?this.extensionField.parent.fullName:this.extend,this.partOf){if((W.oneofIndex=this.parent.oneofsArray.indexOf(this.partOf))<0)throw Error("missing oneof")}if(this.options){if(W.options=BY(this.options,l1.FieldOptions),this.options.default!=null)W.defaultValue=String(this.options.default);if(this.options.proto3_optional)W.proto3_optional=!0}if(Y==="proto3"){if(!this.packed)(W.options||(W.options=l1.FieldOptions.create())).packed=!1}else if((!Y||Y==="proto2")&&this.packed)(W.options||(W.options=l1.FieldOptions.create())).packed=!0;return W};var f11=0;l4.fromDescriptor=function(Y,W,z){if(typeof Y.length==="number")Y=l1.EnumDescriptorProto.decode(Y);var F={};if(Y.value)for(var Q=0;Q<Y.value.length;++Q){var J=Y.value[Q].name,Z=Y.value[Q].number||0;F[J&&J.length?J:"NAME"+Z]=Z}var K=new l4(Y.name&&Y.name.length?Y.name:"Enum"+f11++,F,VY(Y.options,l1.EnumOptions));if(!z)K._edition=W;return K};l4.prototype.toDescriptor=function(){var Y=[];for(var W=0,z=Object.keys(this.values);W<z.length;++W)Y.push(l1.EnumValueDescriptorProto.create({name:z[W],number:this.values[z[W]]}));return l1.EnumDescriptorProto.create({name:this.name,value:Y,options:BY(this.options,l1.EnumOptions)})};var y11=0;mG.fromDescriptor=function(Y){if(typeof Y.length==="number")Y=l1.OneofDescriptorProto.decode(Y);return new mG(Y.name&&Y.name.length?Y.name:"oneof"+y11++)};mG.prototype.toDescriptor=function(){return l1.OneofDescriptorProto.create({name:this.name})};var k11=0;CQ.fromDescriptor=function(Y,W,z){if(typeof Y.length==="number")Y=l1.ServiceDescriptorProto.decode(Y);var F=new CQ(Y.name&&Y.name.length?Y.name:"Service"+k11++,VY(Y.options,l1.ServiceOptions));if(!z)F._edition=W;if(Y.method)for(var Q=0;Q<Y.method.length;++Q)F.add(gG.fromDescriptor(Y.method[Q]));return F};CQ.prototype.toDescriptor=function(){var Y=[];for(var W=0;W<this.methodsArray.length;++W)Y.push(this._methodsArray[W].toDescriptor());return l1.ServiceDescriptorProto.create({name:this.name,method:Y,options:BY(this.options,l1.ServiceOptions)})};var v11=0;gG.fromDescriptor=function(Y){if(typeof Y.length==="number")Y=l1.MethodDescriptorProto.decode(Y);return new gG(Y.name&&Y.name.length?Y.name:"Method"+v11++,"rpc",Y.inputType,Y.outputType,Boolean(Y.clientStreaming),Boolean(Y.serverStreaming),VY(Y.options,l1.MethodOptions))};gG.prototype.toDescriptor=function(){return l1.MethodDescriptorProto.create({name:this.name,inputType:this.resolvedRequestType?this.resolvedRequestType.fullName:this.requestType,outputType:this.resolvedResponseType?this.resolvedResponseType.fullName:this.responseType,clientStreaming:this.requestStream,serverStreaming:this.responseStream,options:BY(this.options,l1.MethodOptions)})};function j11(X){switch(X){case 1:return"double";case 2:return"float";case 3:return"int64";case 4:return"uint64";case 5:return"int32";case 6:return"fixed64";case 7:return"fixed32";case 8:return"bool";case 9:return"string";case 12:return"bytes";case 13:return"uint32";case 15:return"sfixed32";case 16:return"sfixed64";case 17:return"sint32";case 18:return"sint64"}throw Error("illegal type: "+X)}function h11(X){switch(X){case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 13:case 14:case 15:case 16:case 17:case 18:return!0}return!1}function NN(X,Y,W){switch(X){case"double":return 1;case"float":return 2;case"int64":return 3;case"uint64":return 4;case"int32":return 5;case"fixed64":return 6;case"fixed32":return 7;case"bool":return 8;case"string":return 9;case"bytes":return 12;case"uint32":return 13;case"sfixed32":return 15;case"sfixed64":return 16;case"sint32":return 17;case"sint64":return 18}if(Y instanceof l4)return 14;if(Y instanceof K4)return W?10:11;throw Error("illegal type: "+X)}function h70(X,Y){var W={};for(var z=0,F,Q;z<Y.fieldsArray.length;++z){if((Q=(F=Y._fieldsArray[z]).name)==="uninterpretedOption")continue;if(!Object.prototype.hasOwnProperty.call(X,Q))continue;var J=_11(Q);if(F.resolvedType instanceof K4)W[J]=h70(X[Q],F.resolvedType);else if(F.resolvedType instanceof l4)W[J]=F.resolvedType.valuesById[X[Q]];else W[J]=X[Q]}return W}function VY(X,Y){if(!X)return;return h70(Y.toObject(X),Y)}function _70(X,Y){var W={},z=Object.keys(X);for(var F=0;F<z.length;++F){var Q=z[F],J=p9.util.camelCase(Q);if(!Object.prototype.hasOwnProperty.call(Y.fields,J))continue;var Z=Y.fields[J];if(Z.resolvedType instanceof K4)W[J]=_70(X[Q],Z.resolvedType);else W[J]=X[Q];if(Z.repeated&&!Array.isArray(W[J]))W[J]=[W[J]]}return W}function BY(X,Y){if(!X)return;return Y.fromObject(_70(X,Y))}function x70(X,Y){var W=X.fullName.split("."),z=Y.fullName.split("."),F=0,Q=0,J=z.length-1;if(!(X instanceof EQ)&&Y instanceof v70)while(F<W.length&&Q<J&&W[F]===z[Q]){var Z=Y.lookup(W[F++],!0);if(Z!==null&&Z!==Y)break;++Q}else for(;F<W.length&&Q<J&&W[F]===z[Q];++F,++Q);return z.slice(Q).join(".")}function _11(X){return X.substring(0,1)+X.substring(1).replace(/([A-Z])(?=[a-z]|$)/g,function(Y,W){return"_"+W.toLowerCase()})}function x11(X){if(X.syntax==="editions")switch(X.edition){case l1.Edition.EDITION_2023:return"2023";default:throw Error("Unsupported edition "+X.edition)}if(X.syntax==="proto3")return"proto3";return"proto2"}function b11(X,Y){if(!X)return;if(X==="proto2"||X==="proto3")Y.syntax=X;else switch(Y.syntax="editions",X){case"2023":Y.edition=l1.Edition.EDITION_2023;break;default:throw Error("Unsupported edition "+X)}}});var m70=X0((FE1,u11)=>{u11.exports={nested:{google:{nested:{protobuf:{nested:{Api:{fields:{name:{type:"string",id:1},methods:{rule:"repeated",type:"Method",id:2},options:{rule:"repeated",type:"Option",id:3},version:{type:"string",id:4},sourceContext:{type:"SourceContext",id:5},mixins:{rule:"repeated",type:"Mixin",id:6},syntax:{type:"Syntax",id:7}}},Method:{fields:{name:{type:"string",id:1},requestTypeUrl:{type:"string",id:2},requestStreaming:{type:"bool",id:3},responseTypeUrl:{type:"string",id:4},responseStreaming:{type:"bool",id:5},options:{rule:"repeated",type:"Option",id:6},syntax:{type:"Syntax",id:7}}},Mixin:{fields:{name:{type:"string",id:1},root:{type:"string",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}}}}}}}}});var g70=X0((zE1,m11)=>{m11.exports={nested:{google:{nested:{protobuf:{nested:{SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var d70=X0((qE1,g11)=>{g11.exports={nested:{google:{nested:{protobuf:{nested:{Type:{fields:{name:{type:"string",id:1},fields:{rule:"repeated",type:"Field",id:2},oneofs:{rule:"repeated",type:"string",id:3},options:{rule:"repeated",type:"Option",id:4},sourceContext:{type:"SourceContext",id:5},syntax:{type:"Syntax",id:6}}},Field:{fields:{kind:{type:"Kind",id:1},cardinality:{type:"Cardinality",id:2},number:{type:"int32",id:3},name:{type:"string",id:4},typeUrl:{type:"string",id:6},oneofIndex:{type:"int32",id:7},packed:{type:"bool",id:8},options:{rule:"repeated",type:"Option",id:9},jsonName:{type:"string",id:10},defaultValue:{type:"string",id:11}},nested:{Kind:{values:{TYPE_UNKNOWN:0,TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Cardinality:{values:{CARDINALITY_UNKNOWN:0,CARDINALITY_OPTIONAL:1,CARDINALITY_REQUIRED:2,CARDINALITY_REPEATED:3}}}},Enum:{fields:{name:{type:"string",id:1},enumvalue:{rule:"repeated",type:"EnumValue",id:2},options:{rule:"repeated",type:"Option",id:3},sourceContext:{type:"SourceContext",id:4},syntax:{type:"Syntax",id:5}}},EnumValue:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{rule:"repeated",type:"Option",id:3}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}},Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var a70=X0((n70)=>{Object.defineProperty(n70,"__esModule",{value:!0});n70.addCommonProtos=n70.loadProtosWithOptionsSync=n70.loadProtosWithOptions=void 0;var c70=F1("fs"),l70=F1("path"),UY=uG();function p70(X,Y){let W=X.resolvePath;X.resolvePath=(z,F)=>{if(l70.isAbsolute(F))return F;for(let Q of Y){let J=l70.join(Q,F);try{return c70.accessSync(J,c70.constants.R_OK),J}catch(Z){continue}}return process.emitWarning(`${F} not found in any of the include paths ${Y}`),W(z,F)}}async function d11(X,Y){let W=new UY.Root;if(Y=Y||{},Y.includeDirs){if(!Array.isArray(Y.includeDirs))return Promise.reject(Error("The includeDirs option must be an array"));p70(W,Y.includeDirs)}let z=await W.load(X,Y);return z.resolveAll(),z}n70.loadProtosWithOptions=d11;function c11(X,Y){let W=new UY.Root;if(Y=Y||{},Y.includeDirs){if(!Array.isArray(Y.includeDirs))throw Error("The includeDirs option must be an array");p70(W,Y.includeDirs)}let z=W.loadSync(X,Y);return z.resolveAll(),z}n70.loadProtosWithOptionsSync=c11;function l11(){let X=m70(),Y=UN(),W=g70(),z=d70();UY.common("api",X.nested.google.nested.protobuf.nested),UY.common("descriptor",Y.nested.google.nested.protobuf.nested),UY.common("source_context",W.nested.google.nested.protobuf.nested),UY.common("type",z.nested.google.nested.protobuf.nested)}n70.addCommonProtos=l11});var r70=X0((RQ,AN)=>{(function(X,Y){function W(z){return z.default||z}if(typeof define==="function"&&define.amd)define([],function(){var z={};return Y(z),W(z)});else if(typeof RQ==="object"){if(Y(RQ),typeof AN==="object")AN.exports=W(RQ)}else(function(){var z={};Y(z),X.Long=W(z)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:RQ,function(X){Object.defineProperty(X,"__esModule",{value:!0}),X.default=void 0;var Y=null;try{Y=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function W(x,k,l){this.low=x|0,this.high=k|0,this.unsigned=!!l}W.prototype.__isLong__,Object.defineProperty(W.prototype,"__isLong__",{value:!0});function z(x){return(x&&x.__isLong__)===!0}function F(x){var k=Math.clz32(x&-x);return x?31-k:k}W.isLong=z;var Q={},J={};function Z(x,k){var l,Z0,m;if(k){if(x>>>=0,m=0<=x&&x<256){if(Z0=J[x],Z0)return Z0}if(l=H(x,0,!0),m)J[x]=l;return l}else{if(x|=0,m=-128<=x&&x<128){if(Z0=Q[x],Z0)return Z0}if(l=H(x,x<0?-1:0,!1),m)Q[x]=l;return l}}W.fromInt=Z;function K(x,k){if(isNaN(x))return k?C:I;if(k){if(x<0)return C;if(x>=U)return v}else{if(x<=-A)return f;if(x+1>=A)return y}if(x<0)return K(-x,k).neg();return H(x%E|0,x/E|0,k)}W.fromNumber=K;function H(x,k,l){return new W(x,k,l)}W.fromBits=H;var G=Math.pow;function q(x,k,l){if(x.length===0)throw Error("empty string");if(typeof k==="number")l=k,k=!1;else k=!!k;if(x==="NaN"||x==="Infinity"||x==="+Infinity"||x==="-Infinity")return k?C:I;if(l=l||10,l<2||36<l)throw RangeError("radix");var Z0;if((Z0=x.indexOf("-"))>0)throw Error("interior hyphen");else if(Z0===0)return q(x.substring(1),k,l).neg();var m=K(G(l,8)),h=I;for(var p=0;p<x.length;p+=8){var n=Math.min(8,x.length-p),Q0=parseInt(x.substring(p,p+n),l);if(n<8){var c=K(G(l,n));h=h.mul(c).add(K(Q0))}else h=h.mul(m),h=h.add(K(Q0))}return h.unsigned=k,h}W.fromString=q;function B(x,k){if(typeof x==="number")return K(x,k);if(typeof x==="string")return q(x,k);return H(x.low,x.high,typeof k==="boolean"?k:x.unsigned)}W.fromValue=B;var $=65536,R=16777216,E=$*$,U=E*E,A=U/2,T=Z(R),I=Z(0);W.ZERO=I;var C=Z(0,!0);W.UZERO=C;var M=Z(1);W.ONE=M;var w=Z(1,!0);W.UONE=w;var P=Z(-1);W.NEG_ONE=P;var y=H(-1,2147483647,!1);W.MAX_VALUE=y;var v=H(-1,-1,!0);W.MAX_UNSIGNED_VALUE=v;var f=H(0,-2147483648,!1);W.MIN_VALUE=f;var _=W.prototype;if(_.toInt=function(){return this.unsigned?this.low>>>0:this.low},_.toNumber=function(){if(this.unsigned)return(this.high>>>0)*E+(this.low>>>0);return this.high*E+(this.low>>>0)},_.toString=function(k){if(k=k||10,k<2||36<k)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(f)){var l=K(k),Z0=this.div(l),m=Z0.mul(l).sub(this);return Z0.toString(k)+m.toInt().toString(k)}else return"-"+this.neg().toString(k);var h=K(G(k,6),this.unsigned),p=this,n="";while(!0){var Q0=p.div(h),c=p.sub(Q0.mul(h)).toInt()>>>0,e=c.toString(k);if(p=Q0,p.isZero())return e+n;else{while(e.length<6)e="0"+e;n=""+e+n}}},_.getHighBits=function(){return this.high},_.getHighBitsUnsigned=function(){return this.high>>>0},_.getLowBits=function(){return this.low},_.getLowBitsUnsigned=function(){return this.low>>>0},_.getNumBitsAbs=function(){if(this.isNegative())return this.eq(f)?64:this.neg().getNumBitsAbs();var k=this.high!=0?this.high:this.low;for(var l=31;l>0;l--)if((k&1<<l)!=0)break;return this.high!=0?l+33:l+1},_.isSafeInteger=function(){var k=this.high>>21;if(!k)return!0;if(this.unsigned)return!1;return k===-1&&!(this.low===0&&this.high===-2097152)},_.isZero=function(){return this.high===0&&this.low===0},_.eqz=_.isZero,_.isNegative=function(){return!this.unsigned&&this.high<0},_.isPositive=function(){return this.unsigned||this.high>=0},_.isOdd=function(){return(this.low&1)===1},_.isEven=function(){return(this.low&1)===0},_.equals=function(k){if(!z(k))k=B(k);if(this.unsigned!==k.unsigned&&this.high>>>31===1&&k.high>>>31===1)return!1;return this.high===k.high&&this.low===k.low},_.eq=_.equals,_.notEquals=function(k){return!this.eq(k)},_.neq=_.notEquals,_.ne=_.notEquals,_.lessThan=function(k){return this.comp(k)<0},_.lt=_.lessThan,_.lessThanOrEqual=function(k){return this.comp(k)<=0},_.lte=_.lessThanOrEqual,_.le=_.lessThanOrEqual,_.greaterThan=function(k){return this.comp(k)>0},_.gt=_.greaterThan,_.greaterThanOrEqual=function(k){return this.comp(k)>=0},_.gte=_.greaterThanOrEqual,_.ge=_.greaterThanOrEqual,_.compare=function(k){if(!z(k))k=B(k);if(this.eq(k))return 0;var l=this.isNegative(),Z0=k.isNegative();if(l&&!Z0)return-1;if(!l&&Z0)return 1;if(!this.unsigned)return this.sub(k).isNegative()?-1:1;return k.high>>>0>this.high>>>0||k.high===this.high&&k.low>>>0>this.low>>>0?-1:1},_.comp=_.compare,_.negate=function(){if(!this.unsigned&&this.eq(f))return f;return this.not().add(M)},_.neg=_.negate,_.add=function(k){if(!z(k))k=B(k);var l=this.high>>>16,Z0=this.high&65535,m=this.low>>>16,h=this.low&65535,p=k.high>>>16,n=k.high&65535,Q0=k.low>>>16,c=k.low&65535,e=0,g=0,u=0,r=0;return r+=h+c,u+=r>>>16,r&=65535,u+=m+Q0,g+=u>>>16,u&=65535,g+=Z0+n,e+=g>>>16,g&=65535,e+=l+p,e&=65535,H(u<<16|r,e<<16|g,this.unsigned)},_.subtract=function(k){if(!z(k))k=B(k);return this.add(k.neg())},_.sub=_.subtract,_.multiply=function(k){if(this.isZero())return this;if(!z(k))k=B(k);if(Y){var l=Y.mul(this.low,this.high,k.low,k.high);return H(l,Y.get_high(),this.unsigned)}if(k.isZero())return this.unsigned?C:I;if(this.eq(f))return k.isOdd()?f:I;if(k.eq(f))return this.isOdd()?f:I;if(this.isNegative())if(k.isNegative())return this.neg().mul(k.neg());else return this.neg().mul(k).neg();else if(k.isNegative())return this.mul(k.neg()).neg();if(this.lt(T)&&k.lt(T))return K(this.toNumber()*k.toNumber(),this.unsigned);var Z0=this.high>>>16,m=this.high&65535,h=this.low>>>16,p=this.low&65535,n=k.high>>>16,Q0=k.high&65535,c=k.low>>>16,e=k.low&65535,g=0,u=0,r=0,t=0;return t+=p*e,r+=t>>>16,t&=65535,r+=h*e,u+=r>>>16,r&=65535,r+=p*c,u+=r>>>16,r&=65535,u+=m*e,g+=u>>>16,u&=65535,u+=h*c,g+=u>>>16,u&=65535,u+=p*Q0,g+=u>>>16,u&=65535,g+=Z0*e+m*c+h*Q0+p*n,g&=65535,H(r<<16|t,g<<16|u,this.unsigned)},_.mul=_.multiply,_.divide=function(k){if(!z(k))k=B(k);if(k.isZero())throw Error("division by zero");if(Y){if(!this.unsigned&&this.high===-2147483648&&k.low===-1&&k.high===-1)return this;var l=(this.unsigned?Y.div_u:Y.div_s)(this.low,this.high,k.low,k.high);return H(l,Y.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?C:I;var Z0,m,h;if(!this.unsigned){if(this.eq(f))if(k.eq(M)||k.eq(P))return f;else if(k.eq(f))return M;else{var p=this.shr(1);if(Z0=p.div(k).shl(1),Z0.eq(I))return k.isNegative()?M:P;else return m=this.sub(k.mul(Z0)),h=Z0.add(m.div(k)),h}else if(k.eq(f))return this.unsigned?C:I;if(this.isNegative()){if(k.isNegative())return this.neg().div(k.neg());return this.neg().div(k).neg()}else if(k.isNegative())return this.div(k.neg()).neg();h=I}else{if(!k.unsigned)k=k.toUnsigned();if(k.gt(this))return C;if(k.gt(this.shru(1)))return w;h=C}m=this;while(m.gte(k)){Z0=Math.max(1,Math.floor(m.toNumber()/k.toNumber()));var n=Math.ceil(Math.log(Z0)/Math.LN2),Q0=n<=48?1:G(2,n-48),c=K(Z0),e=c.mul(k);while(e.isNegative()||e.gt(m))Z0-=Q0,c=K(Z0,this.unsigned),e=c.mul(k);if(c.isZero())c=M;h=h.add(c),m=m.sub(e)}return h},_.div=_.divide,_.modulo=function(k){if(!z(k))k=B(k);if(Y){var l=(this.unsigned?Y.rem_u:Y.rem_s)(this.low,this.high,k.low,k.high);return H(l,Y.get_high(),this.unsigned)}return this.sub(this.div(k).mul(k))},_.mod=_.modulo,_.rem=_.modulo,_.not=function(){return H(~this.low,~this.high,this.unsigned)},_.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},_.clz=_.countLeadingZeros,_.countTrailingZeros=function(){return this.low?F(this.low):F(this.high)+32},_.ctz=_.countTrailingZeros,_.and=function(k){if(!z(k))k=B(k);return H(this.low&k.low,this.high&k.high,this.unsigned)},_.or=function(k){if(!z(k))k=B(k);return H(this.low|k.low,this.high|k.high,this.unsigned)},_.xor=function(k){if(!z(k))k=B(k);return H(this.low^k.low,this.high^k.high,this.unsigned)},_.shiftLeft=function(k){if(z(k))k=k.toInt();if((k&=63)===0)return this;else if(k<32)return H(this.low<<k,this.high<<k|this.low>>>32-k,this.unsigned);else return H(0,this.low<<k-32,this.unsigned)},_.shl=_.shiftLeft,_.shiftRight=function(k){if(z(k))k=k.toInt();if((k&=63)===0)return this;else if(k<32)return H(this.low>>>k|this.high<<32-k,this.high>>k,this.unsigned);else return H(this.high>>k-32,this.high>=0?0:-1,this.unsigned)},_.shr=_.shiftRight,_.shiftRightUnsigned=function(k){if(z(k))k=k.toInt();if((k&=63)===0)return this;if(k<32)return H(this.low>>>k|this.high<<32-k,this.high>>>k,this.unsigned);if(k===32)return H(this.high,0,this.unsigned);return H(this.high>>>k-32,0,this.unsigned)},_.shru=_.shiftRightUnsigned,_.shr_u=_.shiftRightUnsigned,_.rotateLeft=function(k){var l;if(z(k))k=k.toInt();if((k&=63)===0)return this;if(k===32)return H(this.high,this.low,this.unsigned);if(k<32)return l=32-k,H(this.low<<k|this.high>>>l,this.high<<k|this.low>>>l,this.unsigned);return k-=32,l=32-k,H(this.high<<k|this.low>>>l,this.low<<k|this.high>>>l,this.unsigned)},_.rotl=_.rotateLeft,_.rotateRight=function(k){var l;if(z(k))k=k.toInt();if((k&=63)===0)return this;if(k===32)return H(this.high,this.low,this.unsigned);if(k<32)return l=32-k,H(this.high<<l|this.low>>>k,this.low<<l|this.high>>>k,this.unsigned);return k-=32,l=32-k,H(this.low<<l|this.high>>>k,this.high<<l|this.low>>>k,this.unsigned)},_.rotr=_.rotateRight,_.toSigned=function(){if(!this.unsigned)return this;return H(this.low,this.high,!1)},_.toUnsigned=function(){if(this.unsigned)return this;return H(this.low,this.high,!0)},_.toBytes=function(k){return k?this.toBytesLE():this.toBytesBE()},_.toBytesLE=function(){var k=this.high,l=this.low;return[l&255,l>>>8&255,l>>>16&255,l>>>24,k&255,k>>>8&255,k>>>16&255,k>>>24]},_.toBytesBE=function(){var k=this.high,l=this.low;return[k>>>24,k>>>16&255,k>>>8&255,k&255,l>>>24,l>>>16&255,l>>>8&255,l&255]},W.fromBytes=function(k,l,Z0){return Z0?W.fromBytesLE(k,l):W.fromBytesBE(k,l)},W.fromBytesLE=function(k,l){return new W(k[0]|k[1]<<8|k[2]<<16|k[3]<<24,k[4]|k[5]<<8|k[6]<<16|k[7]<<24,l)},W.fromBytesBE=function(k,l){return new W(k[4]<<24|k[5]<<16|k[6]<<8|k[7],k[0]<<24|k[1]<<16|k[2]<<8|k[3],l)},typeof BigInt==="function")W.fromBigInt=function(k,l){var Z0=Number(BigInt.asIntN(32,k)),m=Number(BigInt.asIntN(32,k>>BigInt(32)));return H(Z0,m,l)},W.fromValue=function(k,l){if(typeof k==="bigint")return W.fromBigInt(k,l);return B(k,l)},_.toBigInt=function(){var k=BigInt(this.low>>>0),l=BigInt(this.unsigned?this.high>>>0:this.high);return l<<BigInt(32)|k};var b=X.default=W})});var MQ=X0((YX0)=>{Object.defineProperty(YX0,"__esModule",{value:!0});YX0.loadFileDescriptorSetFromObject=YX0.loadFileDescriptorSetFromBuffer=YX0.fromJSON=YX0.loadSync=YX0.load=YX0.IdempotencyLevel=YX0.isAnyExtension=YX0.Long=void 0;var i11=k50(),F4=uG(),$N=u70(),DN=a70(),a11=r70();YX0.Long=a11;function r11(X){return"@type"in X&&typeof X["@type"]==="string"}YX0.isAnyExtension=r11;var t70;(function(X){X.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",X.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",X.IDEMPOTENT="IDEMPOTENT"})(t70=YX0.IdempotencyLevel||(YX0.IdempotencyLevel={}));var s70={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function o11(X,Y){if(X==="")return Y;else return X+"."+Y}function t11(X){return X instanceof F4.Service||X instanceof F4.Type||X instanceof F4.Enum}function s11(X){return X instanceof F4.Namespace||X instanceof F4.Root}function e70(X,Y){let W=o11(Y,X.name);if(t11(X))return[[W,X]];else if(s11(X)&&typeof X.nested<"u")return Object.keys(X.nested).map((z)=>{return e70(X.nested[z],W)}).reduce((z,F)=>z.concat(F),[]);return[]}function ON(X,Y){return function(z){return X.toObject(X.decode(z),Y)}}function TN(X){return function(W){if(Array.isArray(W))throw Error(`Failed to serialize message: expected object with ${X.name} structure, got array instead`);let z=X.fromObject(W);return X.encode(z).finish()}}function e11(X){return(X||[]).reduce((Y,W)=>{for(let[z,F]of Object.entries(W))switch(z){case"uninterpreted_option":Y.uninterpreted_option.push(W.uninterpreted_option);break;default:Y[z]=F}return Y},{deprecated:!1,idempotency_level:t70.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function X61(X,Y,W,z){let{resolvedRequestType:F,resolvedResponseType:Q}=X;return{path:"/"+Y+"/"+X.name,requestStream:!!X.requestStream,responseStream:!!X.responseStream,requestSerialize:TN(F),requestDeserialize:ON(F,W),responseSerialize:TN(Q),responseDeserialize:ON(Q,W),originalName:i11(X.name),requestType:IN(F,W,z),responseType:IN(Q,W,z),options:e11(X.parsedOptions)}}function Y61(X,Y,W,z){let F={};for(let Q of X.methodsArray)F[Q.name]=X61(Q,Y,W,z);return F}function IN(X,Y,W){let z=X.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:z.$type.toObject(z,s70),fileDescriptorProtos:W,serialize:TN(X),deserialize:ON(X,Y)}}function Z61(X,Y){let W=X.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:W.$type.toObject(W,s70),fileDescriptorProtos:Y}}function Q61(X,Y,W,z){if(X instanceof F4.Service)return Y61(X,Y,W,z);else if(X instanceof F4.Type)return IN(X,W,z);else if(X instanceof F4.Enum)return Z61(X,z);else throw Error("Type mismatch in reflection object handling")}function dG(X,Y){let W={};X.resolveAll();let F=X.toDescriptor("proto3").file.map((Q)=>Buffer.from($N.FileDescriptorProto.encode(Q).finish()));for(let[Q,J]of e70(X,""))W[Q]=Q61(J,Q,Y,F);return W}function XX0(X,Y){Y=Y||{};let W=F4.Root.fromDescriptor(X);return W.resolveAll(),dG(W,Y)}function J61(X,Y){return(0,DN.loadProtosWithOptions)(X,Y).then((W)=>{return dG(W,Y)})}YX0.load=J61;function W61(X,Y){let W=(0,DN.loadProtosWithOptionsSync)(X,Y);return dG(W,Y)}YX0.loadSync=W61;function G61(X,Y){Y=Y||{};let W=F4.Root.fromJSON(X);return W.resolveAll(),dG(W,Y)}YX0.fromJSON=G61;function K61(X,Y){let W=$N.FileDescriptorSet.decode(X);return XX0(W,Y)}YX0.loadFileDescriptorSetFromBuffer=K61;function F61(X,Y){let W=$N.FileDescriptorSet.fromObject(X);return XX0(W,Y)}YX0.loadFileDescriptorSetFromObject=F61;(0,DN.addCommonProtos)()});var S5=X0((AX0)=>{var __dirname="/Users/beatrix/dev/clinee/sdk-wip/node_modules/.bun/@grpc+grpc-js@1.14.3/node_modules/@grpc/grpc-js/build/src";Object.defineProperty(AX0,"__esModule",{value:!0});AX0.registerChannelzSocket=AX0.registerChannelzServer=AX0.registerChannelzSubchannel=AX0.registerChannelzChannel=AX0.ChannelzCallTrackerStub=AX0.ChannelzCallTracker=AX0.ChannelzChildrenTrackerStub=AX0.ChannelzChildrenTracker=AX0.ChannelzTrace=AX0.ChannelzTraceStub=void 0;AX0.unregisterChannelzRef=I61;AX0.getChannelzHandlers=UX0;AX0.getChannelzServiceDefinition=NX0;AX0.setup=f61;var lG=F1("net"),g7=j40(),LQ=C9(),PQ=a1(),N61=y9(),A61=AG(),O61=TG();function EN(X){return{channel_id:X.id,name:X.name}}function CN(X){return{subchannel_id:X.id,name:X.name}}function T61(X){return{server_id:X.id}}function pG(X){return{socket_id:X.id,name:X.name}}var QX0=32,RN=100;class KX0{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:z4(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}}AX0.ChannelzTraceStub=KX0;class FX0{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(X,Y,W){let z=new Date;if(this.events.push({description:Y,severity:X,timestamp:z,childChannel:(W===null||W===void 0?void 0:W.kind)==="channel"?W:void 0,childSubchannel:(W===null||W===void 0?void 0:W.kind)==="subchannel"?W:void 0}),this.events.length>=QX0*2)this.events=this.events.slice(QX0);this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:z4(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map((X)=>{return{description:X.description,severity:X.severity,timestamp:z4(X.timestamp),channel_ref:X.childChannel?EN(X.childChannel):null,subchannel_ref:X.childSubchannel?CN(X.childSubchannel):null}})}}}AX0.ChannelzTrace=FX0;class MN{constructor(){this.channelChildren=new g7.OrderedMap,this.subchannelChildren=new g7.OrderedMap,this.socketChildren=new g7.OrderedMap,this.trackerMap={["channel"]:this.channelChildren,["subchannel"]:this.subchannelChildren,["socket"]:this.socketChildren}}refChild(X){let Y=this.trackerMap[X.kind],W=Y.find(X.id);if(W.equals(Y.end()))Y.setElement(X.id,{ref:X,count:1},W);else W.pointer[1].count+=1}unrefChild(X){let Y=this.trackerMap[X.kind],W=Y.getElementByKey(X.id);if(W!==void 0){if(W.count-=1,W.count===0)Y.eraseElementByKey(X.id)}}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}}AX0.ChannelzChildrenTracker=MN;class zX0 extends MN{refChild(){}unrefChild(){}}AX0.ChannelzChildrenTrackerStub=zX0;class LN{constructor(){this.callsStarted=0,this.callsSucceeded=0,this.callsFailed=0,this.lastCallStartedTimestamp=null}addCallStarted(){this.callsStarted+=1,this.lastCallStartedTimestamp=new Date}addCallSucceeded(){this.callsSucceeded+=1}addCallFailed(){this.callsFailed+=1}}AX0.ChannelzCallTracker=LN;class qX0 extends LN{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}}AX0.ChannelzCallTrackerStub=qX0;var p4={["channel"]:new g7.OrderedMap,["subchannel"]:new g7.OrderedMap,["server"]:new g7.OrderedMap,["socket"]:new g7.OrderedMap},nG=(X)=>{let Y=1;function W(){return Y++}let z=p4[X];return(F,Q,J)=>{let Z=W(),K={id:Z,name:F,kind:X};if(J)z.setElement(Z,{ref:K,getInfo:Q});return K}};AX0.registerChannelzChannel=nG("channel");AX0.registerChannelzSubchannel=nG("subchannel");AX0.registerChannelzServer=nG("server");AX0.registerChannelzSocket=nG("socket");function I61(X){p4[X.kind].eraseElementByKey(X.id)}function $61(X){let Y=Number.parseInt(X,16);return[Y/256|0,Y%256]}function JX0(X){if(X==="")return[];let Y=X.split(":").map((z)=>$61(z));return[].concat(...Y)}function D61(X){return(0,lG.isIPv6)(X)&&X.toLowerCase().startsWith("::ffff:")&&(0,lG.isIPv4)(X.substring(7))}function WX0(X){return Buffer.from(Uint8Array.from(X.split(".").map((Y)=>Number.parseInt(Y))))}function E61(X){if((0,lG.isIPv4)(X))return WX0(X);else if(D61(X))return WX0(X.substring(7));else if((0,lG.isIPv6)(X)){let Y,W,z=X.indexOf("::");if(z===-1)Y=X,W="";else Y=X.substring(0,z),W=X.substring(z+2);let F=Buffer.from(JX0(Y)),Q=Buffer.from(JX0(W)),J=Buffer.alloc(16-F.length-Q.length,0);return Buffer.concat([F,J,Q])}else return null}function HX0(X){switch(X){case LQ.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case LQ.ConnectivityState.IDLE:return{state:"IDLE"};case LQ.ConnectivityState.READY:return{state:"READY"};case LQ.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case LQ.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function z4(X){if(!X)return null;let Y=X.getTime();return{seconds:Y/1000|0,nanos:Y%1000*1e6}}function VX0(X){let Y=X.getInfo(),W=[],z=[];return Y.children.channels.forEach((F)=>{W.push(EN(F[1].ref))}),Y.children.subchannels.forEach((F)=>{z.push(CN(F[1].ref))}),{ref:EN(X.ref),data:{target:Y.target,state:HX0(Y.state),calls_started:Y.callTracker.callsStarted,calls_succeeded:Y.callTracker.callsSucceeded,calls_failed:Y.callTracker.callsFailed,last_call_started_timestamp:z4(Y.callTracker.lastCallStartedTimestamp),trace:Y.trace.getTraceMessage()},channel_ref:W,subchannel_ref:z}}function C61(X,Y){let W=parseInt(X.request.channel_id,10),z=p4.channel.getElementByKey(W);if(z===void 0){Y({code:PQ.Status.NOT_FOUND,details:"No channel data found for id "+W});return}Y(null,{channel:VX0(z)})}function R61(X,Y){let W=parseInt(X.request.max_results,10)||RN,z=[],F=parseInt(X.request.start_channel_id,10),Q=p4.channel,J;for(J=Q.lowerBound(F);!J.equals(Q.end())&&z.length<W;J=J.next())z.push(VX0(J.pointer[1]));Y(null,{channel:z,end:J.equals(Q.end())})}function BX0(X){let Y=X.getInfo(),W=[];return Y.listenerChildren.sockets.forEach((z)=>{W.push(pG(z[1].ref))}),{ref:T61(X.ref),data:{calls_started:Y.callTracker.callsStarted,calls_succeeded:Y.callTracker.callsSucceeded,calls_failed:Y.callTracker.callsFailed,last_call_started_timestamp:z4(Y.callTracker.lastCallStartedTimestamp),trace:Y.trace.getTraceMessage()},listen_socket:W}}function M61(X,Y){let W=parseInt(X.request.server_id,10),F=p4.server.getElementByKey(W);if(F===void 0){Y({code:PQ.Status.NOT_FOUND,details:"No server data found for id "+W});return}Y(null,{server:BX0(F)})}function L61(X,Y){let W=parseInt(X.request.max_results,10)||RN,z=parseInt(X.request.start_server_id,10),F=p4.server,Q=[],J;for(J=F.lowerBound(z);!J.equals(F.end())&&Q.length<W;J=J.next())Q.push(BX0(J.pointer[1]));Y(null,{server:Q,end:J.equals(F.end())})}function P61(X,Y){let W=parseInt(X.request.subchannel_id,10),z=p4.subchannel.getElementByKey(W);if(z===void 0){Y({code:PQ.Status.NOT_FOUND,details:"No subchannel data found for id "+W});return}let F=z.getInfo(),Q=[];F.children.sockets.forEach((Z)=>{Q.push(pG(Z[1].ref))});let J={ref:CN(z.ref),data:{target:F.target,state:HX0(F.state),calls_started:F.callTracker.callsStarted,calls_succeeded:F.callTracker.callsSucceeded,calls_failed:F.callTracker.callsFailed,last_call_started_timestamp:z4(F.callTracker.lastCallStartedTimestamp),trace:F.trace.getTraceMessage()},socket_ref:Q};Y(null,{subchannel:J})}function GX0(X){var Y;if((0,N61.isTcpSubchannelAddress)(X))return{address:"tcpip_address",tcpip_address:{ip_address:(Y=E61(X.host))!==null&&Y!==void 0?Y:void 0,port:X.port}};else return{address:"uds_address",uds_address:{filename:X.path}}}function w61(X,Y){var W,z,F,Q,J;let Z=parseInt(X.request.socket_id,10),K=p4.socket.getElementByKey(Z);if(K===void 0){Y({code:PQ.Status.NOT_FOUND,details:"No socket data found for id "+Z});return}let H=K.getInfo(),G=H.security?{model:"tls",tls:{cipher_suite:H.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:(W=H.security.cipherSuiteStandardName)!==null&&W!==void 0?W:void 0,other_name:(z=H.security.cipherSuiteOtherName)!==null&&z!==void 0?z:void 0,local_certificate:(F=H.security.localCertificate)!==null&&F!==void 0?F:void 0,remote_certificate:(Q=H.security.remoteCertificate)!==null&&Q!==void 0?Q:void 0}}:null,q={ref:pG(K.ref),local:H.localAddress?GX0(H.localAddress):null,remote:H.remoteAddress?GX0(H.remoteAddress):null,remote_name:(J=H.remoteName)!==null&&J!==void 0?J:void 0,security:G,data:{keep_alives_sent:H.keepAlivesSent,streams_started:H.streamsStarted,streams_succeeded:H.streamsSucceeded,streams_failed:H.streamsFailed,last_local_stream_created_timestamp:z4(H.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:z4(H.lastRemoteStreamCreatedTimestamp),messages_received:H.messagesReceived,messages_sent:H.messagesSent,last_message_received_timestamp:z4(H.lastMessageReceivedTimestamp),last_message_sent_timestamp:z4(H.lastMessageSentTimestamp),local_flow_control_window:H.localFlowControlWindow?{value:H.localFlowControlWindow}:null,remote_flow_control_window:H.remoteFlowControlWindow?{value:H.remoteFlowControlWindow}:null}};Y(null,{socket:q})}function S61(X,Y){let W=parseInt(X.request.server_id,10),z=p4.server.getElementByKey(W);if(z===void 0){Y({code:PQ.Status.NOT_FOUND,details:"No server data found for id "+W});return}let F=parseInt(X.request.start_socket_id,10),Q=parseInt(X.request.max_results,10)||RN,Z=z.getInfo().sessionChildren.sockets,K=[],H;for(H=Z.lowerBound(F);!H.equals(Z.end())&&K.length<Q;H=H.next())K.push(pG(H.pointer[1].ref));Y(null,{socket_ref:K,end:H.equals(Z.end())})}function UX0(){return{GetChannel:C61,GetTopChannels:R61,GetServer:M61,GetServers:L61,GetSubchannel:P61,GetSocket:w61,GetServerSockets:S61}}var cG=null;function NX0(){if(cG)return cG;let X=MQ().loadSync,Y=X("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]});return cG=(0,O61.loadPackageDefinition)(Y).grpc.channelz.v1.Channelz.service,cG}function f61(){(0,A61.registerAdminService)(NX0,UX0)}});var iG=X0((TX0)=>{Object.defineProperty(TX0,"__esModule",{value:!0});TX0.getNextCallNumber=p61;var l61=0;function p61(){return l61++}});var PN=X0(($X0)=>{Object.defineProperty($X0,"__esModule",{value:!0});$X0.CompressionAlgorithms=void 0;var IX0;(function(X){X[X.identity=0]="identity",X[X.deflate=1]="deflate",X[X.gzip=2]="gzip"})(IX0||($X0.CompressionAlgorithms=IX0={}))});var wN=X0((CX0)=>{Object.defineProperty(CX0,"__esModule",{value:!0});CX0.BaseFilter=void 0;class EX0{async sendMetadata(X){return X}receiveMetadata(X){return X}async sendMessage(X){return X}async receiveMessage(X){return X}receiveTrailers(X){return X}}CX0.BaseFilter=EX0});var fN=X0((yX0)=>{Object.defineProperty(yX0,"__esModule",{value:!0});yX0.CompressionFilterFactory=yX0.CompressionFilter=void 0;var aG=F1("zlib"),LX0=PN(),NY=a1(),i61=wN(),a61=A6(),r61=(X)=>{return typeof X==="number"&&typeof LX0.CompressionAlgorithms[X]==="string"};class wQ{async writeMessage(X,Y){let W=X;if(Y)W=await this.compressMessage(W);let z=Buffer.allocUnsafe(W.length+5);return z.writeUInt8(Y?1:0,0),z.writeUInt32BE(W.length,1),W.copy(z,5),z}async readMessage(X){let Y=X.readUInt8(0)===1,W=X.slice(5);if(Y)W=await this.decompressMessage(W);return W}}class AY extends wQ{async compressMessage(X){return X}async writeMessage(X,Y){let W=Buffer.allocUnsafe(X.length+5);return W.writeUInt8(0,0),W.writeUInt32BE(X.length,1),X.copy(W,5),W}decompressMessage(X){return Promise.reject(Error('Received compressed message but "grpc-encoding" header was identity'))}}class PX0 extends wQ{constructor(X){super();this.maxRecvMessageLength=X}compressMessage(X){return new Promise((Y,W)=>{aG.deflate(X,(z,F)=>{if(z)W(z);else Y(F)})})}decompressMessage(X){return new Promise((Y,W)=>{let z=0,F=[],Q=aG.createInflate();Q.on("data",(J)=>{if(F.push(J),z+=J.byteLength,this.maxRecvMessageLength!==-1&&z>this.maxRecvMessageLength)Q.destroy(),W({code:NY.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`})}),Q.on("end",()=>{Y(Buffer.concat(F))}),Q.write(X),Q.end()})}}class wX0 extends wQ{constructor(X){super();this.maxRecvMessageLength=X}compressMessage(X){return new Promise((Y,W)=>{aG.gzip(X,(z,F)=>{if(z)W(z);else Y(F)})})}decompressMessage(X){return new Promise((Y,W)=>{let z=0,F=[],Q=aG.createGunzip();Q.on("data",(J)=>{if(F.push(J),z+=J.byteLength,this.maxRecvMessageLength!==-1&&z>this.maxRecvMessageLength)Q.destroy(),W({code:NY.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`})}),Q.on("end",()=>{Y(Buffer.concat(F))}),Q.write(X),Q.end()})}}class SX0 extends wQ{constructor(X){super();this.compressionName=X}compressMessage(X){return Promise.reject(Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(X){return Promise.reject(Error(`Compression method not supported: ${this.compressionName}`))}}function MX0(X,Y){switch(X){case"identity":return new AY;case"deflate":return new PX0(Y);case"gzip":return new wX0(Y);default:return new SX0(X)}}class SN extends i61.BaseFilter{constructor(X,Y){var W,z,F;super();this.sharedFilterConfig=Y,this.sendCompression=new AY,this.receiveCompression=new AY,this.currentCompressionAlgorithm="identity";let Q=X["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=(W=X["grpc.max_receive_message_length"])!==null&&W!==void 0?W:NY.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=(z=X["grpc.max_send_message_length"])!==null&&z!==void 0?z:NY.DEFAULT_MAX_SEND_MESSAGE_LENGTH,Q!==void 0)if(r61(Q)){let J=LX0.CompressionAlgorithms[Q],Z=(F=Y.serverSupportedEncodingHeader)===null||F===void 0?void 0:F.split(",");if(!Z||Z.includes(J))this.currentCompressionAlgorithm=J,this.sendCompression=MX0(this.currentCompressionAlgorithm,-1)}else a61.log(NY.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${Q}`)}async sendMetadata(X){let Y=await X;if(Y.set("grpc-accept-encoding","identity,deflate,gzip"),Y.set("accept-encoding","identity"),this.currentCompressionAlgorithm==="identity")Y.remove("grpc-encoding");else Y.set("grpc-encoding",this.currentCompressionAlgorithm);return Y}receiveMetadata(X){let Y=X.get("grpc-encoding");if(Y.length>0){let z=Y[0];if(typeof z==="string")this.receiveCompression=MX0(z,this.maxReceiveMessageLength)}X.remove("grpc-encoding");let W=X.get("grpc-accept-encoding")[0];if(W){if(this.sharedFilterConfig.serverSupportedEncodingHeader=W,!W.split(",").includes(this.currentCompressionAlgorithm))this.sendCompression=new AY,this.currentCompressionAlgorithm="identity"}return X.remove("grpc-accept-encoding"),X}async sendMessage(X){var Y;let W=await X;if(this.maxSendMessageLength!==-1&&W.message.length>this.maxSendMessageLength)throw{code:NY.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let z;if(this.sendCompression instanceof AY)z=!1;else z=(((Y=W.flags)!==null&&Y!==void 0?Y:0)&2)===0;return{message:await this.sendCompression.writeMessage(W.message,z),flags:W.flags}}async receiveMessage(X){return this.receiveCompression.readMessage(await X)}}yX0.CompressionFilter=SN;class fX0{constructor(X,Y){this.options=Y,this.sharedFilterConfig={}}createFilter(){return new SN(this.options,this.sharedFilterConfig)}}yX0.CompressionFilterFactory=fX0});var SQ=X0((vX0)=>{Object.defineProperty(vX0,"__esModule",{value:!0});vX0.restrictControlPlaneStatusCode=s61;var q4=a1(),t61=[q4.Status.OK,q4.Status.INVALID_ARGUMENT,q4.Status.NOT_FOUND,q4.Status.ALREADY_EXISTS,q4.Status.FAILED_PRECONDITION,q4.Status.ABORTED,q4.Status.OUT_OF_RANGE,q4.Status.DATA_LOSS];function s61(X,Y){if(t61.includes(X))return{code:q4.Status.INTERNAL,details:`Invalid status from control plane: ${X} ${q4.Status[X]} ${Y}`};else return{code:X,details:Y}}});var OY=X0((jX0)=>{Object.defineProperty(jX0,"__esModule",{value:!0});jX0.minDeadline=X91;jX0.getDeadlineTimeoutString=Z91;jX0.getRelativeTimeout=J91;jX0.deadlineToString=W91;jX0.formatDateDifference=G91;function X91(...X){let Y=1/0;for(let W of X){let z=W instanceof Date?W.getTime():W;if(z<Y)Y=z}return Y}var Y91=[["m",1],["S",1000],["M",60000],["H",3600000]];function Z91(X){let Y=new Date().getTime();if(X instanceof Date)X=X.getTime();let W=Math.max(X-Y,0);for(let[z,F]of Y91){let Q=W/F;if(Q<1e8)return String(Math.ceil(Q))+z}throw Error("Deadline is too far in the future")}var Q91=2147483647;function J91(X){let Y=X instanceof Date?X.getTime():X,W=new Date().getTime(),z=Y-W;if(z<0)return 0;else if(z>Q91)return 1/0;else return z}function W91(X){if(X instanceof Date)return X.toISOString();else{let Y=new Date(X);if(Number.isNaN(Y.getTime()))return""+X;else return Y.toISOString()}}function G91(X,Y){return((Y.getTime()-X.getTime())/1000).toFixed(3)+"s"}});var rG=X0((hX0)=>{Object.defineProperty(hX0,"__esModule",{value:!0});hX0.FilterStackFactory=hX0.FilterStack=void 0;class yN{constructor(X){this.filters=X}sendMetadata(X){let Y=X;for(let W=0;W<this.filters.length;W++)Y=this.filters[W].sendMetadata(Y);return Y}receiveMetadata(X){let Y=X;for(let W=this.filters.length-1;W>=0;W--)Y=this.filters[W].receiveMetadata(Y);return Y}sendMessage(X){let Y=X;for(let W=0;W<this.filters.length;W++)Y=this.filters[W].sendMessage(Y);return Y}receiveMessage(X){let Y=X;for(let W=this.filters.length-1;W>=0;W--)Y=this.filters[W].receiveMessage(Y);return Y}receiveTrailers(X){let Y=X;for(let W=this.filters.length-1;W>=0;W--)Y=this.filters[W].receiveTrailers(Y);return Y}push(X){this.filters.unshift(...X)}getFilters(){return this.filters}}hX0.FilterStack=yN;class kN{constructor(X){this.factories=X}push(X){this.factories.unshift(...X)}clone(){return new kN([...this.factories])}createFilter(){return new yN(this.factories.map((X)=>X.createFilter()))}}hX0.FilterStackFactory=kN});var gX0=X0((uX0)=>{Object.defineProperty(uX0,"__esModule",{value:!0});uX0.SingleSubchannelChannel=void 0;var B91=iG(),fQ=S5(),U91=fN(),N91=C9(),yQ=a1(),A91=SQ(),O91=OY(),T91=rG(),vN=s6(),I91=y8(),oG=E9();class xX0{constructor(X,Y,W,z,F){var Q,J;this.subchannel=X,this.method=Y,this.options=z,this.callNumber=F,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1;let Z=this.method.split("/"),K="";if(Z.length>=2)K=Z[1];let H=(J=(Q=(0,oG.splitHostPort)(this.options.host))===null||Q===void 0?void 0:Q.host)!==null&&J!==void 0?J:"localhost";this.serviceUrl=`https://${H}/${K}`;let G=(0,O91.getRelativeTimeout)(z.deadline);if(G!==1/0)if(G<=0)this.cancelWithStatus(yQ.Status.DEADLINE_EXCEEDED,"Deadline exceeded");else setTimeout(()=>{this.cancelWithStatus(yQ.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},G);this.filterStack=W.createFilter()}cancelWithStatus(X,Y){if(this.childCall)this.childCall.cancelWithStatus(X,Y);else this.pendingStatus={code:X,details:Y,metadata:new vN.Metadata}}getPeer(){var X,Y;return(Y=(X=this.childCall)===null||X===void 0?void 0:X.getPeer())!==null&&Y!==void 0?Y:this.subchannel.getAddress()}async start(X,Y){if(this.pendingStatus){Y.onReceiveStatus(this.pendingStatus);return}if(this.subchannel.getConnectivityState()!==N91.ConnectivityState.READY){Y.onReceiveStatus({code:yQ.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new vN.Metadata});return}let W=await this.filterStack.sendMetadata(Promise.resolve(X)),z;try{z=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(Q){let J=Q,{code:Z,details:K}=(0,A91.restrictControlPlaneStatusCode)(typeof J.code==="number"?J.code:yQ.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${J.message}`);Y.onReceiveStatus({code:Z,details:K,metadata:new vN.Metadata});return}z.merge(W);let F={onReceiveMetadata:async(Q)=>{Y.onReceiveMetadata(await this.filterStack.receiveMetadata(Q))},onReceiveMessage:async(Q)=>{this.readFilterPending=!0;let J=await this.filterStack.receiveMessage(Q);if(this.readFilterPending=!1,Y.onReceiveMessage(J),this.pendingStatus)Y.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async(Q)=>{let J=await this.filterStack.receiveTrailers(Q);if(this.readFilterPending)this.pendingStatus=J;else Y.onReceiveStatus(J)}};if(this.childCall=this.subchannel.createCall(z,this.options.host,this.method,F),this.readPending)this.childCall.startRead();if(this.pendingMessage)this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message);if(this.halfClosePending&&!this.writeFilterPending)this.childCall.halfClose()}async sendMessageWithContext(X,Y){this.writeFilterPending=!0;let W=await this.filterStack.sendMessage(Promise.resolve({message:Y,flags:X.flags}));if(this.writeFilterPending=!1,this.childCall){if(this.childCall.sendMessageWithContext(X,W.message),this.halfClosePending)this.childCall.halfClose()}else this.pendingMessage={context:X,message:W.message}}startRead(){if(this.childCall)this.childCall.startRead();else this.readPending=!0}halfClose(){if(this.childCall&&!this.writeFilterPending)this.childCall.halfClose();else this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(X){throw Error("Method not implemented.")}getAuthContext(){if(this.childCall)return this.childCall.getAuthContext();else return null}}class bX0{constructor(X,Y,W){if(this.subchannel=X,this.target=Y,this.channelzEnabled=!1,this.channelzTrace=new fQ.ChannelzTrace,this.callTracker=new fQ.ChannelzCallTracker,this.childrenTracker=new fQ.ChannelzChildrenTracker,this.channelzEnabled=W["grpc.enable_channelz"]!==0,this.channelzRef=(0,fQ.registerChannelzChannel)((0,oG.uriToString)(Y),()=>({target:`${(0,oG.uriToString)(Y)} (${X.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled)this.childrenTracker.refChild(X.getChannelzRef());this.filterStackFactory=new T91.FilterStackFactory([new U91.CompressionFilterFactory(this,W)])}close(){if(this.channelzEnabled)this.childrenTracker.unrefChild(this.subchannel.getChannelzRef());(0,fQ.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,oG.uriToString)(this.target)}getConnectivityState(X){throw Error("Method not implemented.")}watchConnectivityState(X,Y,W){throw Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(X,Y){let W={deadline:Y,host:(0,I91.getDefaultAuthority)(this.target),flags:yQ.Propagate.DEFAULTS,parentCall:null};return new xX0(this.subchannel,X,this.filterStackFactory,W,(0,B91.getNextCallNumber)())}}uX0.SingleSubchannelChannel=bX0});var pX0=X0((cX0)=>{Object.defineProperty(cX0,"__esModule",{value:!0});cX0.Subchannel=void 0;var V6=C9(),$91=QY(),jN=A6(),tG=a1(),D91=E9(),E91=y9(),H4=S5(),C91=gX0(),R91="subchannel",M91=2147483647;class dX0{constructor(X,Y,W,z,F){var Q;this.channelTarget=X,this.subchannelAddress=Y,this.options=W,this.connector=F,this.connectivityState=V6.ConnectivityState.IDLE,this.transport=null,this.continueConnecting=!1,this.stateListeners=new Set,this.refcount=0,this.channelzEnabled=!0,this.dataProducers=new Map,this.subchannelChannel=null;let J={initialDelay:W["grpc.initial_reconnect_backoff_ms"],maxDelay:W["grpc.max_reconnect_backoff_ms"]};if(this.backoffTimeout=new $91.BackoffTimeout(()=>{this.handleBackoffTimer()},J),this.backoffTimeout.unref(),this.subchannelAddressString=(0,E91.subchannelAddressToString)(Y),this.keepaliveTime=(Q=W["grpc.keepalive_time_ms"])!==null&&Q!==void 0?Q:-1,W["grpc.enable_channelz"]===0)this.channelzEnabled=!1,this.channelzTrace=new H4.ChannelzTraceStub,this.callTracker=new H4.ChannelzCallTrackerStub,this.childrenTracker=new H4.ChannelzChildrenTrackerStub,this.streamTracker=new H4.ChannelzCallTrackerStub;else this.channelzTrace=new H4.ChannelzTrace,this.callTracker=new H4.ChannelzCallTracker,this.childrenTracker=new H4.ChannelzChildrenTracker,this.streamTracker=new H4.ChannelzCallTracker;this.channelzRef=(0,H4.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(W,void 0,2)),this.secureConnector=z._createSecureConnector(X,W)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(X){jN.trace(tG.LogVerbosity.DEBUG,R91,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+X)}refTrace(X){jN.trace(tG.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+X)}handleBackoffTimer(){if(this.continueConnecting)this.transitionToState([V6.ConnectivityState.TRANSIENT_FAILURE],V6.ConnectivityState.CONNECTING);else this.transitionToState([V6.ConnectivityState.TRANSIENT_FAILURE],V6.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let X=this.options;if(X["grpc.keepalive_time_ms"]){let Y=Math.min(this.keepaliveTime,M91);X=Object.assign(Object.assign({},X),{"grpc.keepalive_time_ms":Y})}this.connector.connect(this.subchannelAddress,this.secureConnector,X).then((Y)=>{if(this.transitionToState([V6.ConnectivityState.CONNECTING],V6.ConnectivityState.READY)){if(this.transport=Y,this.channelzEnabled)this.childrenTracker.refChild(Y.getChannelzRef());Y.addDisconnectListener((W)=>{if(this.transitionToState([V6.ConnectivityState.READY],V6.ConnectivityState.IDLE),W&&this.keepaliveTime>0)this.keepaliveTime*=2,jN.log(tG.LogVerbosity.ERROR,`Connection to ${(0,D91.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`)})}else Y.shutdown()},(Y)=>{this.transitionToState([V6.ConnectivityState.CONNECTING],V6.ConnectivityState.TRANSIENT_FAILURE,`${Y}`)})}transitionToState(X,Y,W){var z,F;if(X.indexOf(this.connectivityState)===-1)return!1;if(W)this.trace(V6.ConnectivityState[this.connectivityState]+" -> "+V6.ConnectivityState[Y]+' with error "'+W+'"');else this.trace(V6.ConnectivityState[this.connectivityState]+" -> "+V6.ConnectivityState[Y]);if(this.channelzEnabled)this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+V6.ConnectivityState[Y]);let Q=this.connectivityState;switch(this.connectivityState=Y,Y){case V6.ConnectivityState.READY:this.stopBackoff();break;case V6.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case V6.ConnectivityState.TRANSIENT_FAILURE:if(this.channelzEnabled&&this.transport)this.childrenTracker.unrefChild(this.transport.getChannelzRef());if((z=this.transport)===null||z===void 0||z.shutdown(),this.transport=null,!this.backoffTimeout.isRunning())process.nextTick(()=>{this.handleBackoffTimer()});break;case V6.ConnectivityState.IDLE:if(this.channelzEnabled&&this.transport)this.childrenTracker.unrefChild(this.transport.getChannelzRef());(F=this.transport)===null||F===void 0||F.shutdown(),this.transport=null;break;default:throw Error(`Invalid state: unknown ConnectivityState ${Y}`)}for(let J of this.stateListeners)J(this,Q,Y,this.keepaliveTime,W);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){if(this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,this.refcount===0)this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,H4.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([V6.ConnectivityState.CONNECTING,V6.ConnectivityState.READY],V6.ConnectivityState.IDLE)})}unrefIfOneRef(){if(this.refcount===1)return this.unref(),!0;return!1}createCall(X,Y,W,z){if(!this.transport)throw Error("Cannot create call, subchannel not READY");let F;if(this.channelzEnabled)this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),F={onCallEnd:(Q)=>{if(Q.code===tG.Status.OK)this.callTracker.addCallSucceeded();else this.callTracker.addCallFailed()}};else F={};return this.transport.createCall(X,Y,W,z,F)}startConnecting(){process.nextTick(()=>{if(!this.transitionToState([V6.ConnectivityState.IDLE],V6.ConnectivityState.CONNECTING)){if(this.connectivityState===V6.ConnectivityState.TRANSIENT_FAILURE)this.continueConnecting=!0}})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(X){this.stateListeners.add(X)}removeConnectivityStateListener(X){this.stateListeners.delete(X)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([V6.ConnectivityState.TRANSIENT_FAILURE],V6.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(X){}removeHealthStateWatcher(X){}getRealSubchannel(){return this}realSubchannelEquals(X){return X.getRealSubchannel()===this}throttleKeepalive(X){if(X>this.keepaliveTime)this.keepaliveTime=X}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){if(!this.subchannelChannel)this.subchannelChannel=new C91.SingleSubchannelChannel(this,this.channelTarget,this.options);return this.subchannelChannel}addDataWatcher(X){throw Error("Not implemented")}getOrCreateDataProducer(X,Y){let W=this.dataProducers.get(X);if(W)return W;let z=Y(this);return this.dataProducers.set(X,z),z}removeDataProducer(X){this.dataProducers.delete(X)}}cX0.Subchannel=dX0});var aX0=X0((nX0)=>{var hN;Object.defineProperty(nX0,"__esModule",{value:!0});nX0.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0;nX0.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=((hN=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)!==null&&hN!==void 0?hN:"false")==="true"});var bN=X0((eX0)=>{Object.defineProperty(eX0,"__esModule",{value:!0});eX0.DEFAULT_PORT=void 0;eX0.setup=v91;var rX0=y8(),_N=F1("dns"),L91=DU(),xN=a1(),TY=h7(),P91=s6(),w91=A6(),S91=a1(),f5=E9(),oX0=F1("net"),f91=QY(),tX0=aX0(),y91="dns_resolver";function V4(X){w91.trace(S91.LogVerbosity.DEBUG,y91,X)}eX0.DEFAULT_PORT=443;var k91=30000;class sX0{constructor(X,Y,W){var z,F,Q;if(this.target=X,this.listener=Y,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,this.alternativeResolver=new _N.promises.Resolver,V4("Resolver constructed for target "+(0,f5.uriToString)(X)),X.authority)this.alternativeResolver.setServers([X.authority]);let J=(0,f5.splitHostPort)(X.path);if(J===null)this.ipResult=null,this.dnsHostname=null,this.port=null;else if((0,oX0.isIPv4)(J.host)||(0,oX0.isIPv6)(J.host))this.ipResult=[{addresses:[{host:J.host,port:(z=J.port)!==null&&z!==void 0?z:eX0.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null;else this.ipResult=null,this.dnsHostname=J.host,this.port=(F=J.port)!==null&&F!==void 0?F:eX0.DEFAULT_PORT;if(this.percentage=Math.random()*100,W["grpc.service_config_disable_resolution"]===1)this.isServiceConfigEnabled=!1;this.defaultResolutionError={code:xN.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,f5.uriToString)(this.target)}`,metadata:new P91.Metadata};let Z={initialDelay:W["grpc.initial_reconnect_backoff_ms"],maxDelay:W["grpc.max_reconnect_backoff_ms"]};this.backoff=new f91.BackoffTimeout(()=>{if(this.continueResolving)this.startResolutionWithBackoff()},Z),this.backoff.unref(),this.minTimeBetweenResolutionsMs=(Q=W["grpc.dns_min_time_between_resolutions_ms"])!==null&&Q!==void 0?Q:k91,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(this.ipResult!==null){if(!this.returnedIpResult)V4("Returning IP address for target "+(0,f5.uriToString)(this.target)),setImmediate(()=>{this.listener((0,TY.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0;this.backoff.stop(),this.backoff.reset(),this.stopNextResolutionTimer();return}if(this.dnsHostname===null)V4("Failed to parse DNS address "+(0,f5.uriToString)(this.target)),setImmediate(()=>{this.listener((0,TY.statusOrFromError)({code:xN.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,f5.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(this.pendingLookupPromise!==null)return;V4("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;let X=this.dnsHostname;if(this.pendingLookupPromise=this.lookup(X),this.pendingLookupPromise.then((Y)=>{if(this.pendingLookupPromise===null)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,TY.statusOrFromValue)(Y.map((F)=>({addresses:[F]})));let W="["+Y.map((F)=>F.host+":"+F.port).join(",")+"]";V4("Resolved addresses for target "+(0,f5.uriToString)(this.target)+": "+W);let z=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(z)},(Y)=>{if(this.pendingLookupPromise===null)return;V4("Resolution error for target "+(0,f5.uriToString)(this.target)+": "+Y.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,TY.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,"")}),this.isServiceConfigEnabled&&this.pendingTxtPromise===null)this.pendingTxtPromise=this.resolveTxt(X),this.pendingTxtPromise.then((Y)=>{if(this.pendingTxtPromise===null)return;this.pendingTxtPromise=null;let W;try{if(W=(0,L91.extractAndSelectServiceConfig)(Y,this.percentage),W)this.latestServiceConfigResult=(0,TY.statusOrFromValue)(W);else this.latestServiceConfigResult=null}catch(z){this.latestServiceConfigResult=(0,TY.statusOrFromError)({code:xN.Status.UNAVAILABLE,details:`Parsing service config failed with error ${z.message}`})}if(this.latestLookupResult!==null)this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},(Y)=>{})}}handleHealthStatus(X){if(X)this.backoff.stop(),this.backoff.reset();else this.continueResolving=!0}async lookup(X){if(tX0.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){V4("Using alternative DNS resolver.");let W=await Promise.allSettled([this.alternativeResolver.resolve4(X),this.alternativeResolver.resolve6(X)]);if(W.every((z)=>z.status==="rejected"))throw Error(W[0].reason);return W.reduce((z,F)=>{return F.status==="fulfilled"?[...z,...F.value]:z},[]).map((z)=>({host:z,port:+this.port}))}return(await _N.promises.lookup(X,{all:!0})).map((W)=>({host:W.address,port:+this.port}))}async resolveTxt(X){if(tX0.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)return V4("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(X);return _N.promises.resolveTxt(X)}startNextResolutionTimer(){var X,Y;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{if(this.stopNextResolutionTimer(),this.continueResolving)this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),(Y=(X=this.nextResolutionTimer).unref)===null||Y===void 0||Y.call(X),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){if(this.pendingLookupPromise===null)this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution()}updateResolution(){if(this.pendingLookupPromise===null)if(this.isNextResolutionTimerRunning||this.backoff.isRunning()){if(this.isNextResolutionTimerRunning)V4('resolution update delayed by "min time between resolutions" rate limit');else V4("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString());this.continueResolving=!0}else this.startResolutionWithBackoff()}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.returnedIpResult=!1}static getDefaultAuthority(X){return X.path}}function v91(){(0,rX0.registerResolver)("dns",sX0),(0,rX0.registerDefaultScheme)("dns")}});var uN=X0((JY0)=>{Object.defineProperty(JY0,"__esModule",{value:!0});JY0.parseCIDR=ZY0;JY0.mapProxyName=l91;JY0.getProxiedConnection=p91;var kQ=A6(),IY=a1(),YY0=F1("net"),h91=F1("http"),_91=A6(),XY0=y9(),vQ=E9(),x91=F1("url"),b91=bN(),u91="proxy";function $Y(X){_91.trace(IY.LogVerbosity.DEBUG,u91,X)}function m91(){let X="",Y="";if(process.env.grpc_proxy)Y="grpc_proxy",X=process.env.grpc_proxy;else if(process.env.https_proxy)Y="https_proxy",X=process.env.https_proxy;else if(process.env.http_proxy)Y="http_proxy",X=process.env.http_proxy;else return{};let W;try{W=new x91.URL(X)}catch(Z){return(0,kQ.log)(IY.LogVerbosity.ERROR,`cannot parse value of "${Y}" env var`),{}}if(W.protocol!=="http:")return(0,kQ.log)(IY.LogVerbosity.ERROR,`"${W.protocol}" scheme not supported in proxy URI`),{};let z=null;if(W.username)if(W.password)(0,kQ.log)(IY.LogVerbosity.INFO,"userinfo found in proxy URI"),z=decodeURIComponent(`${W.username}:${W.password}`);else z=W.username;let{hostname:F,port:Q}=W;if(Q==="")Q="80";let J={address:`${F}:${Q}`};if(z)J.creds=z;return $Y("Proxy server "+J.address+" set by environment variable "+Y),J}function g91(){let X=process.env.no_grpc_proxy,Y="no_grpc_proxy";if(!X)X=process.env.no_proxy,Y="no_proxy";if(X)return $Y("No proxy server list set by environment variable "+Y),X.split(",");else return[]}function ZY0(X){let Y=X.split("/");if(Y.length!==2)return null;let W=parseInt(Y[1],10);if(!(0,YY0.isIPv4)(Y[0])||Number.isNaN(W)||W<0||W>32)return null;return{ip:QY0(Y[0]),prefixLength:W}}function QY0(X){return X.split(".").reduce((Y,W)=>(Y<<8)+parseInt(W,10),0)}function d91(X,Y){let W=X.ip,z=-1<<32-X.prefixLength;return(QY0(Y)&z)===(W&z)}function c91(X){for(let Y of g91()){let W=ZY0(Y);if((0,YY0.isIPv4)(X)&&W&&d91(W,X))return!0;else if(X.endsWith(Y))return!0}return!1}function l91(X,Y){var W;let z={target:X,extraOptions:{}};if(((W=Y["grpc.enable_http_proxy"])!==null&&W!==void 0?W:1)===0)return z;if(X.scheme==="unix")return z;let F=m91();if(!F.address)return z;let Q=(0,vQ.splitHostPort)(X.path);if(!Q)return z;let J=Q.host;if(c91(J))return $Y("Not using proxy for target in no_proxy list: "+(0,vQ.uriToString)(X)),z;let Z={"grpc.http_connect_target":(0,vQ.uriToString)(X)};if(F.creds)Z["grpc.http_connect_creds"]=F.creds;return{target:{scheme:"dns",path:F.address},extraOptions:Z}}function p91(X,Y){var W;if(!("grpc.http_connect_target"in Y))return Promise.resolve(null);let z=Y["grpc.http_connect_target"],F=(0,vQ.parseUri)(z);if(F===null)return Promise.resolve(null);let Q=(0,vQ.splitHostPort)(F.path);if(Q===null)return Promise.resolve(null);let J=`${Q.host}:${(W=Q.port)!==null&&W!==void 0?W:b91.DEFAULT_PORT}`,Z={method:"CONNECT",path:J},K={Host:J};if((0,XY0.isTcpSubchannelAddress)(X))Z.host=X.host,Z.port=X.port;else Z.socketPath=X.path;if("grpc.http_connect_creds"in Y)K["Proxy-Authorization"]="Basic "+Buffer.from(Y["grpc.http_connect_creds"]).toString("base64");Z.headers=K;let H=(0,XY0.subchannelAddressToString)(X);return $Y("Using proxy "+H+" to connect to "+Z.path),new Promise((G,q)=>{let B=h91.request(Z);B.once("connect",($,R,E)=>{if(B.removeAllListeners(),R.removeAllListeners(),$.statusCode===200){if($Y("Successfully connected to "+Z.path+" through proxy "+H),E.length>0)R.unshift(E);$Y("Successfully established a plaintext connection to "+Z.path+" through proxy "+H),G(R)}else(0,kQ.log)(IY.LogVerbosity.ERROR,"Failed to connect to "+Z.path+" through proxy "+H+" with status "+$.statusCode),q()}),B.once("error",($)=>{B.removeAllListeners(),(0,kQ.log)(IY.LogVerbosity.ERROR,"Failed to connect to proxy "+H+" with error "+$.message),q()}),B.end()})}});var mN=X0((GY0)=>{Object.defineProperty(GY0,"__esModule",{value:!0});GY0.StreamDecoder=void 0;var B4;(function(X){X[X.NO_DATA=0]="NO_DATA",X[X.READING_SIZE=1]="READING_SIZE",X[X.READING_MESSAGE=2]="READING_MESSAGE"})(B4||(B4={}));class WY0{constructor(X){this.maxReadMessageLength=X,this.readState=B4.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(X){let Y=0,W,z=[];while(Y<X.length)switch(this.readState){case B4.NO_DATA:this.readCompressFlag=X.slice(Y,Y+1),Y+=1,this.readState=B4.READING_SIZE,this.readPartialSize.fill(0),this.readSizeRemaining=4,this.readMessageSize=0,this.readMessageRemaining=0,this.readPartialMessage=[];break;case B4.READING_SIZE:if(W=Math.min(X.length-Y,this.readSizeRemaining),X.copy(this.readPartialSize,4-this.readSizeRemaining,Y,Y+W),this.readSizeRemaining-=W,Y+=W,this.readSizeRemaining===0){if(this.readMessageSize=this.readPartialSize.readUInt32BE(0),this.maxReadMessageLength!==-1&&this.readMessageSize>this.maxReadMessageLength)throw Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=B4.READING_MESSAGE;else{let F=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=B4.NO_DATA,z.push(F)}}break;case B4.READING_MESSAGE:if(W=Math.min(X.length-Y,this.readMessageRemaining),this.readPartialMessage.push(X.slice(Y,Y+W)),this.readMessageRemaining-=W,Y+=W,this.readMessageRemaining===0){let F=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),Q=Buffer.concat(F,this.readMessageSize+5);this.readState=B4.NO_DATA,z.push(Q)}break;default:throw Error("Unexpected read state")}return z}}GY0.StreamDecoder=WY0});var HY0=X0((zY0)=>{Object.defineProperty(zY0,"__esModule",{value:!0});zY0.Http2SubchannelCall=void 0;var n4=F1("http2"),r91=F1("os"),B6=a1(),i4=s6(),o91=mN(),t91=A6(),s91=a1(),e91="subchannel_call";function X81(X){for(let[Y,W]of Object.entries(r91.constants.errno))if(W===X)return Y;return"Unknown system error "+X}function gN(X){let Y=`Received HTTP status code ${X}`,W;switch(X){case 400:W=B6.Status.INTERNAL;break;case 401:W=B6.Status.UNAUTHENTICATED;break;case 403:W=B6.Status.PERMISSION_DENIED;break;case 404:W=B6.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:W=B6.Status.UNAVAILABLE;break;default:W=B6.Status.UNKNOWN}return{code:W,details:Y,metadata:new i4.Metadata}}class FY0{constructor(X,Y,W,z,F){var Q;this.http2Stream=X,this.callEventTracker=Y,this.listener=W,this.transport=z,this.callId=F,this.isReadFilterPending=!1,this.isPushPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.finalStatus=null,this.internalError=null,this.serverEndedCall=!1,this.connectionDropped=!1;let J=(Q=z.getOptions()["grpc.max_receive_message_length"])!==null&&Q!==void 0?Q:B6.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new o91.StreamDecoder(J),X.on("response",(Z,K)=>{let H="";for(let G of Object.keys(Z))H+="\t\t"+G+": "+Z[G]+`
488
488
  `;if(this.trace(`Received server headers:
489
489
  `+H),this.httpStatusCode=Z[":status"],K&n4.constants.NGHTTP2_FLAG_END_STREAM)this.handleTrailers(Z);else{let G;try{G=i4.Metadata.fromHttp2Headers(Z)}catch(q){this.endCall({code:B6.Status.UNKNOWN,details:q.message,metadata:new i4.Metadata});return}this.listener.onReceiveMetadata(G)}}),X.on("trailers",(Z)=>{this.handleTrailers(Z)}),X.on("data",(Z)=>{if(this.statusOutput)return;this.trace("receive HTTP/2 data frame of length "+Z.length);let K;try{K=this.decoder.write(Z)}catch(H){if(this.httpStatusCode!==void 0&&this.httpStatusCode!==200){let G=gN(this.httpStatusCode);this.cancelWithStatus(G.code,G.details)}else this.cancelWithStatus(B6.Status.RESOURCE_EXHAUSTED,H.message);return}for(let H of K)this.trace("parsed message of length "+H.length),this.callEventTracker.addMessageReceived(),this.tryPush(H)}),X.on("end",()=>{this.readsClosed=!0,this.maybeOutputStatus()}),X.on("close",()=>{this.serverEndedCall=!0,process.nextTick(()=>{var Z;if(this.trace("HTTP/2 stream closed with code "+X.rstCode),((Z=this.finalStatus)===null||Z===void 0?void 0:Z.code)===B6.Status.OK)return;let K,H="";switch(X.rstCode){case n4.constants.NGHTTP2_NO_ERROR:if(this.finalStatus!==null)return;if(this.httpStatusCode&&this.httpStatusCode!==200){let G=gN(this.httpStatusCode);K=G.code,H=G.details}else K=B6.Status.INTERNAL,H=`Received RST_STREAM with code ${X.rstCode} (Call ended without gRPC status)`;break;case n4.constants.NGHTTP2_REFUSED_STREAM:K=B6.Status.UNAVAILABLE,H="Stream refused by server";break;case n4.constants.NGHTTP2_CANCEL:if(this.connectionDropped)K=B6.Status.UNAVAILABLE,H="Connection dropped";else K=B6.Status.CANCELLED,H="Call cancelled";break;case n4.constants.NGHTTP2_ENHANCE_YOUR_CALM:K=B6.Status.RESOURCE_EXHAUSTED,H="Bandwidth exhausted or memory limit exceeded";break;case n4.constants.NGHTTP2_INADEQUATE_SECURITY:K=B6.Status.PERMISSION_DENIED,H="Protocol not secure enough";break;case n4.constants.NGHTTP2_INTERNAL_ERROR:if(K=B6.Status.INTERNAL,this.internalError===null)H=`Received RST_STREAM with code ${X.rstCode} (Internal server error)`;else if(this.internalError.code==="ECONNRESET"||this.internalError.code==="ETIMEDOUT")K=B6.Status.UNAVAILABLE,H=this.internalError.message;else H=`Received RST_STREAM with code ${X.rstCode} triggered by internal client error: ${this.internalError.message}`;break;default:K=B6.Status.INTERNAL,H=`Received RST_STREAM with code ${X.rstCode}`}this.endCall({code:K,details:H,metadata:new i4.Metadata,rstCode:X.rstCode})})}),X.on("error",(Z)=>{if(Z.code!=="ERR_HTTP2_STREAM_ERROR")this.trace("Node error event: message="+Z.message+" code="+Z.code+" errno="+X81(Z.errno)+" syscall="+Z.syscall),this.internalError=Z;this.callEventTracker.onStreamEnd(!1)})}getDeadlineInfo(){return[`remote_addr=${this.getPeer()}`]}onDisconnect(){this.connectionDropped=!0,setImmediate(()=>{this.endCall({code:B6.Status.UNAVAILABLE,details:"Connection dropped",metadata:new i4.Metadata})})}outputStatus(){if(!this.statusOutput)this.statusOutput=!0,this.trace("ended with status: code="+this.finalStatus.code+' details="'+this.finalStatus.details+'"'),this.callEventTracker.onCallEnd(this.finalStatus),process.nextTick(()=>{this.listener.onReceiveStatus(this.finalStatus)}),this.http2Stream.resume()}trace(X){t91.trace(s91.LogVerbosity.DEBUG,e91,"["+this.callId+"] "+X)}endCall(X){if(this.finalStatus===null||this.finalStatus.code===B6.Status.OK)this.finalStatus=X,this.maybeOutputStatus();this.destroyHttp2Stream()}maybeOutputStatus(){if(this.finalStatus!==null){if(this.finalStatus.code!==B6.Status.OK||this.readsClosed&&this.unpushedReadMessages.length===0&&!this.isReadFilterPending&&!this.isPushPending)this.outputStatus()}}push(X){this.trace("pushing to reader message of length "+(X instanceof Buffer?X.length:null)),this.canPush=!1,this.isPushPending=!0,process.nextTick(()=>{if(this.isPushPending=!1,this.statusOutput)return;this.listener.onReceiveMessage(X),this.maybeOutputStatus()})}tryPush(X){if(this.canPush)this.http2Stream.pause(),this.push(X);else this.trace("unpushedReadMessages.push message of length "+X.length),this.unpushedReadMessages.push(X)}handleTrailers(X){this.serverEndedCall=!0,this.callEventTracker.onStreamEnd(!0);let Y="";for(let Q of Object.keys(X))Y+="\t\t"+Q+": "+X[Q]+`
490
490
  `;this.trace(`Received server trailers:
491
491
  `+Y);let W;try{W=i4.Metadata.fromHttp2Headers(X)}catch(Q){W=new i4.Metadata}let z=W.getMap(),F;if(typeof z["grpc-status"]==="string"){let Q=Number(z["grpc-status"]);this.trace("received status code "+Q+" from server"),W.remove("grpc-status");let J="";if(typeof z["grpc-message"]==="string"){try{J=decodeURI(z["grpc-message"])}catch(Z){J=z["grpc-message"]}W.remove("grpc-message"),this.trace('received status details string "'+J+'" from server')}F={code:Q,details:J,metadata:W}}else if(this.httpStatusCode)F=gN(this.httpStatusCode),F.metadata=W;else F={code:B6.Status.UNKNOWN,details:"No status information received",metadata:W};this.endCall(F)}destroyHttp2Stream(){var X;if(this.http2Stream.destroyed)return;if(this.serverEndedCall)this.http2Stream.end();else{let Y;if(((X=this.finalStatus)===null||X===void 0?void 0:X.code)===B6.Status.OK)Y=n4.constants.NGHTTP2_NO_ERROR;else Y=n4.constants.NGHTTP2_CANCEL;this.trace("close http2 stream with code "+Y),this.http2Stream.close(Y)}}cancelWithStatus(X,Y){this.trace("cancelWithStatus code: "+X+' details: "'+Y+'"'),this.endCall({code:X,details:Y,metadata:new i4.Metadata})}getStatus(){return this.finalStatus}getPeer(){return this.transport.getPeerName()}getCallNumber(){return this.callId}getAuthContext(){return this.transport.getAuthContext()}startRead(){if(this.finalStatus!==null&&this.finalStatus.code!==B6.Status.OK){this.readsClosed=!0,this.maybeOutputStatus();return}if(this.canPush=!0,this.unpushedReadMessages.length>0){let X=this.unpushedReadMessages.shift();this.push(X);return}this.http2Stream.resume()}sendMessageWithContext(X,Y){this.trace("write() called with message of length "+Y.length);let W=(z)=>{process.nextTick(()=>{var F;let Q=B6.Status.UNAVAILABLE;if((z===null||z===void 0?void 0:z.code)==="ERR_STREAM_WRITE_AFTER_END")Q=B6.Status.INTERNAL;if(z)this.cancelWithStatus(Q,`Write error: ${z.message}`);(F=X.callback)===null||F===void 0||F.call(X)})};this.trace("sending data chunk of length "+Y.length),this.callEventTracker.addMessageSent();try{this.http2Stream.write(Y,W)}catch(z){this.endCall({code:B6.Status.UNAVAILABLE,details:`Write failed with error ${z.message}`,metadata:new i4.Metadata})}}halfClose(){this.trace("end() called"),this.trace("calling end() on HTTP/2 stream"),this.http2Stream.end()}}zY0.Http2SubchannelCall=FY0});var AY0=X0((UY0)=>{Object.defineProperty(UY0,"__esModule",{value:!0});UY0.Http2SubchannelConnector=void 0;var d7=F1("http2"),Y81=F1("tls"),eG=S5(),jQ=a1(),Z81=uN(),DY=A6(),Q81=y8(),XK=y9(),dN=E9(),J81=F1("net"),W81=HY0(),G81=iG(),cN="transport",K81="transport_flowctrl",F81=JU().version,{HTTP2_HEADER_AUTHORITY:z81,HTTP2_HEADER_CONTENT_TYPE:q81,HTTP2_HEADER_METHOD:H81,HTTP2_HEADER_PATH:V81,HTTP2_HEADER_TE:B81,HTTP2_HEADER_USER_AGENT:U81}=d7.constants,N81=20000,A81=Buffer.from("too_many_pings","ascii");class VY0{constructor(X,Y,W,z){if(this.session=X,this.options=W,this.remoteName=z,this.keepaliveTimer=null,this.pendingSendKeepalivePing=!1,this.activeCalls=new Set,this.disconnectListeners=[],this.disconnectHandled=!1,this.channelzEnabled=!0,this.keepalivesSent=0,this.messagesSent=0,this.messagesReceived=0,this.lastMessageSentTimestamp=null,this.lastMessageReceivedTimestamp=null,this.subchannelAddressString=(0,XK.subchannelAddressToString)(Y),W["grpc.enable_channelz"]===0)this.channelzEnabled=!1,this.streamTracker=new eG.ChannelzCallTrackerStub;else this.streamTracker=new eG.ChannelzCallTracker;if(this.channelzRef=(0,eG.registerChannelzSocket)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.userAgent=[W["grpc.primary_user_agent"],`grpc-node-js/${F81}`,W["grpc.secondary_user_agent"]].filter((F)=>F).join(" "),"grpc.keepalive_time_ms"in W)this.keepaliveTimeMs=W["grpc.keepalive_time_ms"];else this.keepaliveTimeMs=-1;if("grpc.keepalive_timeout_ms"in W)this.keepaliveTimeoutMs=W["grpc.keepalive_timeout_ms"];else this.keepaliveTimeoutMs=N81;if("grpc.keepalive_permit_without_calls"in W)this.keepaliveWithoutCalls=W["grpc.keepalive_permit_without_calls"]===1;else this.keepaliveWithoutCalls=!1;if(X.once("close",()=>{this.trace("session closed"),this.handleDisconnect()}),X.once("goaway",(F,Q,J)=>{let Z=!1;if(F===d7.constants.NGHTTP2_ENHANCE_YOUR_CALM&&J&&J.equals(A81))Z=!0;this.trace("connection closed by GOAWAY with code "+F+" and data "+(J===null||J===void 0?void 0:J.toString())),this.reportDisconnectToOwner(Z)}),X.once("error",(F)=>{this.trace("connection closed with error "+F.message),this.handleDisconnect()}),X.socket.once("close",(F)=>{this.trace("connection closed. hadError="+F),this.handleDisconnect()}),DY.isTracerEnabled(cN))X.on("remoteSettings",(F)=>{this.trace("new settings received"+(this.session!==X?" on the old connection":"")+": "+JSON.stringify(F))}),X.on("localSettings",(F)=>{this.trace("local settings acknowledged by remote"+(this.session!==X?" on the old connection":"")+": "+JSON.stringify(F))});if(this.keepaliveWithoutCalls)this.maybeStartKeepalivePingTimer();if(X.socket instanceof Y81.TLSSocket)this.authContext={transportSecurityType:"ssl",sslPeerCertificate:X.socket.getPeerCertificate()};else this.authContext={}}getChannelzInfo(){var X,Y,W;let z=this.session.socket,F=z.remoteAddress?(0,XK.stringToSubchannelAddress)(z.remoteAddress,z.remotePort):null,Q=z.localAddress?(0,XK.stringToSubchannelAddress)(z.localAddress,z.localPort):null,J;if(this.session.encrypted){let K=z,H=K.getCipher(),G=K.getCertificate(),q=K.getPeerCertificate();J={cipherSuiteStandardName:(X=H.standardName)!==null&&X!==void 0?X:null,cipherSuiteOtherName:H.standardName?null:H.name,localCertificate:G&&"raw"in G?G.raw:null,remoteCertificate:q&&"raw"in q?q.raw:null}}else J=null;return{remoteAddress:F,localAddress:Q,security:J,remoteName:this.remoteName,streamsStarted:this.streamTracker.callsStarted,streamsSucceeded:this.streamTracker.callsSucceeded,streamsFailed:this.streamTracker.callsFailed,messagesSent:this.messagesSent,messagesReceived:this.messagesReceived,keepAlivesSent:this.keepalivesSent,lastLocalStreamCreatedTimestamp:this.streamTracker.lastCallStartedTimestamp,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:this.lastMessageSentTimestamp,lastMessageReceivedTimestamp:this.lastMessageReceivedTimestamp,localFlowControlWindow:(Y=this.session.state.localWindowSize)!==null&&Y!==void 0?Y:null,remoteFlowControlWindow:(W=this.session.state.remoteWindowSize)!==null&&W!==void 0?W:null}}trace(X){DY.trace(jQ.LogVerbosity.DEBUG,cN,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+X)}keepaliveTrace(X){DY.trace(jQ.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+X)}flowControlTrace(X){DY.trace(jQ.LogVerbosity.DEBUG,K81,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+X)}internalsTrace(X){DY.trace(jQ.LogVerbosity.DEBUG,"transport_internals","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+X)}reportDisconnectToOwner(X){if(this.disconnectHandled)return;this.disconnectHandled=!0,this.disconnectListeners.forEach((Y)=>Y(X))}handleDisconnect(){this.clearKeepaliveTimeout(),this.reportDisconnectToOwner(!1);for(let X of this.activeCalls)X.onDisconnect();setImmediate(()=>{this.session.destroy()})}addDisconnectListener(X){this.disconnectListeners.push(X)}canSendPing(){return!this.session.destroyed&&this.keepaliveTimeMs>0&&(this.keepaliveWithoutCalls||this.activeCalls.size>0)}maybeSendPing(){var X,Y;if(!this.canSendPing()){this.pendingSendKeepalivePing=!0;return}if(this.keepaliveTimer){console.error("keepaliveTimeout is not null");return}if(this.channelzEnabled)this.keepalivesSent+=1;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.keepaliveTrace("Ping timeout passed without response"),this.handleDisconnect()},this.keepaliveTimeoutMs),(Y=(X=this.keepaliveTimer).unref)===null||Y===void 0||Y.call(X);let W="";try{if(!this.session.ping((F,Q,J)=>{if(this.clearKeepaliveTimeout(),F)this.keepaliveTrace("Ping failed with error "+F.message),this.handleDisconnect();else this.keepaliveTrace("Received ping response"),this.maybeStartKeepalivePingTimer()}))W="Ping returned false"}catch(z){W=(z instanceof Error?z.message:"")||"Unknown error"}if(W)this.keepaliveTrace("Ping send failed: "+W),this.handleDisconnect()}maybeStartKeepalivePingTimer(){var X,Y;if(!this.canSendPing())return;if(this.pendingSendKeepalivePing)this.pendingSendKeepalivePing=!1,this.maybeSendPing();else if(!this.keepaliveTimer)this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.maybeSendPing()},this.keepaliveTimeMs),(Y=(X=this.keepaliveTimer).unref)===null||Y===void 0||Y.call(X)}clearKeepaliveTimeout(){if(this.keepaliveTimer)clearTimeout(this.keepaliveTimer),this.keepaliveTimer=null}removeActiveCall(X){if(this.activeCalls.delete(X),this.activeCalls.size===0)this.session.unref()}addActiveCall(X){if(this.activeCalls.add(X),this.activeCalls.size===1){if(this.session.ref(),!this.keepaliveWithoutCalls)this.maybeStartKeepalivePingTimer()}}createCall(X,Y,W,z,F){let Q=X.toHttp2Headers();Q[z81]=Y,Q[U81]=this.userAgent,Q[q81]="application/grpc",Q[H81]="POST",Q[V81]=W,Q[B81]="trailers";let J;try{J=this.session.request(Q)}catch(H){throw this.handleDisconnect(),H}this.flowControlTrace("local window size: "+this.session.state.localWindowSize+" remote window size: "+this.session.state.remoteWindowSize),this.internalsTrace("session.closed="+this.session.closed+" session.destroyed="+this.session.destroyed+" session.socket.destroyed="+this.session.socket.destroyed);let Z,K;if(this.channelzEnabled)this.streamTracker.addCallStarted(),Z={addMessageSent:()=>{var H;this.messagesSent+=1,this.lastMessageSentTimestamp=new Date,(H=F.addMessageSent)===null||H===void 0||H.call(F)},addMessageReceived:()=>{var H;this.messagesReceived+=1,this.lastMessageReceivedTimestamp=new Date,(H=F.addMessageReceived)===null||H===void 0||H.call(F)},onCallEnd:(H)=>{var G;(G=F.onCallEnd)===null||G===void 0||G.call(F,H),this.removeActiveCall(K)},onStreamEnd:(H)=>{var G;if(H)this.streamTracker.addCallSucceeded();else this.streamTracker.addCallFailed();(G=F.onStreamEnd)===null||G===void 0||G.call(F,H)}};else Z={addMessageSent:()=>{var H;(H=F.addMessageSent)===null||H===void 0||H.call(F)},addMessageReceived:()=>{var H;(H=F.addMessageReceived)===null||H===void 0||H.call(F)},onCallEnd:(H)=>{var G;(G=F.onCallEnd)===null||G===void 0||G.call(F,H),this.removeActiveCall(K)},onStreamEnd:(H)=>{var G;(G=F.onStreamEnd)===null||G===void 0||G.call(F,H)}};return K=new W81.Http2SubchannelCall(J,Z,z,this,(0,G81.getNextCallNumber)()),this.addActiveCall(K),K}getChannelzRef(){return this.channelzRef}getPeerName(){return this.subchannelAddressString}getOptions(){return this.options}getAuthContext(){return this.authContext}shutdown(){this.session.close(),(0,eG.unregisterChannelzRef)(this.channelzRef)}}class BY0{constructor(X){this.channelTarget=X,this.session=null,this.isShutdown=!1}trace(X){DY.trace(jQ.LogVerbosity.DEBUG,cN,(0,dN.uriToString)(this.channelTarget)+" "+X)}createSession(X,Y,W){if(this.isShutdown)return Promise.reject();if(X.socket.closed)return Promise.reject("Connection closed before starting HTTP/2 handshake");return new Promise((z,F)=>{var Q,J,Z,K,H,G,q,B;let $=null,R=this.channelTarget;if("grpc.http_connect_target"in W){let v=(0,dN.parseUri)(W["grpc.http_connect_target"]);if(v)R=v,$=(0,dN.uriToString)(v)}let E=X.secure?"https":"http",U=(0,Q81.getDefaultAuthority)(R),A=()=>{var v;(v=this.session)===null||v===void 0||v.destroy(),this.session=null,setImmediate(()=>{if(!y)y=!0,F(`${P.trim()} (${new Date().toISOString()})`)})},T=(v)=>{var f;if((f=this.session)===null||f===void 0||f.destroy(),P=v.message,this.trace("connection failed with error "+P),!y)y=!0,F(`${P} (${new Date().toISOString()})`)},I={createConnection:(v,f)=>{return X.socket},settings:{initialWindowSize:(K=(Q=W["grpc-node.flow_control_window"])!==null&&Q!==void 0?Q:(Z=(J=d7.getDefaultSettings)===null||J===void 0?void 0:J.call(d7))===null||Z===void 0?void 0:Z.initialWindowSize)!==null&&K!==void 0?K:65535},maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER,maxSessionMemory:(H=W["grpc-node.max_session_memory"])!==null&&H!==void 0?H:Number.MAX_SAFE_INTEGER},C=d7.connect(`${E}://${U}`,I),M=(B=(q=(G=d7.getDefaultSettings)===null||G===void 0?void 0:G.call(d7))===null||q===void 0?void 0:q.initialWindowSize)!==null&&B!==void 0?B:65535,w=W["grpc-node.flow_control_window"];this.session=C;let P="Failed to connect",y=!1;C.unref(),C.once("remoteSettings",()=>{var v;if(w&&w>M)try{C.setLocalWindowSize(w)}catch(f){let _=w-((v=C.state.localWindowSize)!==null&&v!==void 0?v:M);if(_>0)C.incrementWindowSize(_)}C.removeAllListeners(),X.socket.removeListener("close",A),X.socket.removeListener("error",T),z(new VY0(C,Y,W,$)),this.session=null}),C.once("close",A),C.once("error",T),X.socket.once("close",A),X.socket.once("error",T)})}tcpConnect(X,Y){return(0,Z81.getProxiedConnection)(X,Y).then((W)=>{if(W)return W;else return new Promise((z,F)=>{let Q=()=>{F(Error("Socket closed"))},J=(K)=>{F(K)},Z=J81.connect(X,()=>{Z.removeListener("close",Q),Z.removeListener("error",J),z(Z)});Z.once("close",Q),Z.once("error",J)})})}async connect(X,Y,W){if(this.isShutdown)return Promise.reject();let z=null,F=null,Q=(0,XK.subchannelAddressToString)(X);try{return this.trace(Q+" Waiting for secureConnector to be ready"),await Y.waitForReady(),this.trace(Q+" secureConnector is ready"),z=await this.tcpConnect(X,W),z.setNoDelay(),this.trace(Q+" Established TCP connection"),F=await Y.connect(z),this.trace(Q+" Established secure connection"),this.createSession(F,X,W)}catch(J){throw z===null||z===void 0||z.destroy(),F===null||F===void 0||F.socket.destroy(),J}}shutdown(){var X;this.isShutdown=!0,(X=this.session)===null||X===void 0||X.close(),this.session=null}}UY0.Http2SubchannelConnector=BY0});var IY0=X0((OY0)=>{Object.defineProperty(OY0,"__esModule",{value:!0});OY0.SubchannelPool=void 0;OY0.getSubchannelPool=R81;var O81=I40(),T81=pX0(),I81=y9(),$81=E9(),D81=AY0(),E81=1e4;class YK{constructor(){this.pool=Object.create(null),this.cleanupTimer=null}unrefUnusedSubchannels(){let X=!0;for(let Y in this.pool){let z=this.pool[Y].filter((F)=>!F.subchannel.unrefIfOneRef());if(z.length>0)X=!1;this.pool[Y]=z}if(X&&this.cleanupTimer!==null)clearInterval(this.cleanupTimer),this.cleanupTimer=null}ensureCleanupTask(){var X,Y;if(this.cleanupTimer===null)this.cleanupTimer=setInterval(()=>{this.unrefUnusedSubchannels()},E81),(Y=(X=this.cleanupTimer).unref)===null||Y===void 0||Y.call(X)}getOrCreateSubchannel(X,Y,W,z){this.ensureCleanupTask();let F=(0,$81.uriToString)(X);if(F in this.pool){let J=this.pool[F];for(let Z of J)if((0,I81.subchannelAddressEqual)(Y,Z.subchannelAddress)&&(0,O81.channelOptionsEqual)(W,Z.channelArguments)&&z._equals(Z.channelCredentials))return Z.subchannel}let Q=new T81.Subchannel(X,Y,W,z,new D81.Http2SubchannelConnector(X));if(!(F in this.pool))this.pool[F]=[];return this.pool[F].push({subchannelAddress:Y,channelArguments:W,channelCredentials:z,subchannel:Q}),Q.ref(),Q}}OY0.SubchannelPool=YK;var C81=new YK;function R81(X){if(X)return C81;else return new YK}});var MY0=X0((CY0)=>{Object.defineProperty(CY0,"__esModule",{value:!0});CY0.LoadBalancingCall=void 0;var $Y0=C9(),ZK=a1(),DY0=OY(),QK=s6(),hQ=b4(),L81=E9(),P81=A6(),lN=SQ(),w81=F1("http2"),S81="load_balancing_call";class EY0{constructor(X,Y,W,z,F,Q,J){var Z,K;this.channel=X,this.callConfig=Y,this.methodName=W,this.host=z,this.credentials=F,this.deadline=Q,this.callNumber=J,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.metadata=null,this.listener=null,this.onCallEnded=null,this.childStartTime=null;let H=this.methodName.split("/"),G="";if(H.length>=2)G=H[1];let q=(K=(Z=(0,L81.splitHostPort)(this.host))===null||Z===void 0?void 0:Z.host)!==null&&K!==void 0?K:"localhost";this.serviceUrl=`https://${q}/${G}`,this.startTime=new Date}getDeadlineInfo(){var X,Y;let W=[];if(this.childStartTime){if(this.childStartTime>this.startTime){if((X=this.metadata)===null||X===void 0?void 0:X.getOptions().waitForReady)W.push("wait_for_ready");W.push(`LB pick: ${(0,DY0.formatDateDifference)(this.startTime,this.childStartTime)}`)}return W.push(...this.child.getDeadlineInfo()),W}else{if((Y=this.metadata)===null||Y===void 0?void 0:Y.getOptions().waitForReady)W.push("wait_for_ready");W.push("Waiting for LB pick")}return W}trace(X){P81.trace(ZK.LogVerbosity.DEBUG,S81,"["+this.callNumber+"] "+X)}outputStatus(X,Y){var W,z;if(!this.ended){this.ended=!0,this.trace("ended with status: code="+X.code+' details="'+X.details+'" start time='+this.startTime.toISOString());let F=Object.assign(Object.assign({},X),{progress:Y});(W=this.listener)===null||W===void 0||W.onReceiveStatus(F),(z=this.onCallEnded)===null||z===void 0||z.call(this,F.code,F.details,F.metadata)}}doPick(){var X,Y;if(this.ended)return;if(!this.metadata)throw Error("doPick called before start");this.trace("Pick called");let W=this.metadata.clone(),z=this.channel.doPick(W,this.callConfig.pickInformation),F=z.subchannel?"("+z.subchannel.getChannelzRef().id+") "+z.subchannel.getAddress():""+z.subchannel;switch(this.trace("Pick result: "+hQ.PickResultType[z.pickResultType]+" subchannel: "+F+" status: "+((X=z.status)===null||X===void 0?void 0:X.code)+" "+((Y=z.status)===null||Y===void 0?void 0:Y.details)),z.pickResultType){case hQ.PickResultType.COMPLETE:this.credentials.compose(z.subchannel.getCallCredentials()).generateMetadata({method_name:this.methodName,service_url:this.serviceUrl}).then((K)=>{var H;if(this.ended){this.trace("Credentials metadata generation finished after call ended");return}if(W.merge(K),W.get("authorization").length>1)this.outputStatus({code:ZK.Status.INTERNAL,details:'"authorization" metadata cannot have multiple values',metadata:new QK.Metadata},"PROCESSED");if(z.subchannel.getConnectivityState()!==$Y0.ConnectivityState.READY){this.trace("Picked subchannel "+F+" has state "+$Y0.ConnectivityState[z.subchannel.getConnectivityState()]+" after getting credentials metadata. Retrying pick"),this.doPick();return}if(this.deadline!==1/0)W.set("grpc-timeout",(0,DY0.getDeadlineTimeoutString)(this.deadline));try{this.child=z.subchannel.getRealSubchannel().createCall(W,this.host,this.methodName,{onReceiveMetadata:(G)=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(G)},onReceiveMessage:(G)=>{this.trace("Received message"),this.listener.onReceiveMessage(G)},onReceiveStatus:(G)=>{if(this.trace("Received status"),G.rstCode===w81.constants.NGHTTP2_REFUSED_STREAM)this.outputStatus(G,"REFUSED");else this.outputStatus(G,"PROCESSED")}}),this.childStartTime=new Date}catch(G){this.trace("Failed to start call on picked subchannel "+F+" with error "+G.message),this.outputStatus({code:ZK.Status.INTERNAL,details:"Failed to start HTTP/2 stream with error "+G.message,metadata:new QK.Metadata},"NOT_STARTED");return}if((H=z.onCallStarted)===null||H===void 0||H.call(z),this.onCallEnded=z.onCallEnded,this.trace("Created child call ["+this.child.getCallNumber()+"]"),this.readPending)this.child.startRead();if(this.pendingMessage)this.child.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message);if(this.pendingHalfClose)this.child.halfClose()},(K)=>{let{code:H,details:G}=(0,lN.restrictControlPlaneStatusCode)(typeof K.code==="number"?K.code:ZK.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${K.message}`);this.outputStatus({code:H,details:G,metadata:new QK.Metadata},"PROCESSED")});break;case hQ.PickResultType.DROP:let{code:J,details:Z}=(0,lN.restrictControlPlaneStatusCode)(z.status.code,z.status.details);setImmediate(()=>{this.outputStatus({code:J,details:Z,metadata:z.status.metadata},"DROP")});break;case hQ.PickResultType.TRANSIENT_FAILURE:if(this.metadata.getOptions().waitForReady)this.channel.queueCallForPick(this);else{let{code:K,details:H}=(0,lN.restrictControlPlaneStatusCode)(z.status.code,z.status.details);setImmediate(()=>{this.outputStatus({code:K,details:H,metadata:z.status.metadata},"PROCESSED")})}break;case hQ.PickResultType.QUEUE:this.channel.queueCallForPick(this)}}cancelWithStatus(X,Y){var W;this.trace("cancelWithStatus code: "+X+' details: "'+Y+'"'),(W=this.child)===null||W===void 0||W.cancelWithStatus(X,Y),this.outputStatus({code:X,details:Y,metadata:new QK.Metadata},"PROCESSED")}getPeer(){var X,Y;return(Y=(X=this.child)===null||X===void 0?void 0:X.getPeer())!==null&&Y!==void 0?Y:this.channel.getTarget()}start(X,Y){this.trace("start called"),this.listener=Y,this.metadata=X,this.doPick()}sendMessageWithContext(X,Y){if(this.trace("write() called with message of length "+Y.length),this.child)this.child.sendMessageWithContext(X,Y);else this.pendingMessage={context:X,message:Y}}startRead(){if(this.trace("startRead called"),this.child)this.child.startRead();else this.readPending=!0}halfClose(){if(this.trace("halfClose called"),this.child)this.child.halfClose();else this.pendingHalfClose=!0}setCredentials(X){throw Error("Method not implemented.")}getCallNumber(){return this.callNumber}getAuthContext(){if(this.child)return this.child.getAuthContext();else return null}}CY0.LoadBalancingCall=EY0});var fY0=X0((wY0)=>{Object.defineProperty(wY0,"__esModule",{value:!0});wY0.ResolvingCall=void 0;var f81=GG(),c7=a1(),l7=OY(),LY0=s6(),y81=A6(),k81=SQ(),v81="resolving_call";class PY0{constructor(X,Y,W,z,F){if(this.channel=X,this.method=Y,this.filterStackFactory=z,this.callNumber=F,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.readFilterPending=!1,this.writeFilterPending=!1,this.pendingChildStatus=null,this.metadata=null,this.listener=null,this.statusWatchers=[],this.deadlineTimer=setTimeout(()=>{},0),this.filterStack=null,this.deadlineStartTime=null,this.configReceivedTime=null,this.childStartTime=null,this.credentials=f81.CallCredentials.createEmpty(),this.deadline=W.deadline,this.host=W.host,W.parentCall){if(W.flags&c7.Propagate.CANCELLATION)W.parentCall.on("cancelled",()=>{this.cancelWithStatus(c7.Status.CANCELLED,"Cancelled by parent call")});if(W.flags&c7.Propagate.DEADLINE)this.trace("Propagating deadline from parent: "+W.parentCall.getDeadline()),this.deadline=(0,l7.minDeadline)(this.deadline,W.parentCall.getDeadline())}this.trace("Created"),this.runDeadlineTimer()}trace(X){y81.trace(c7.LogVerbosity.DEBUG,v81,"["+this.callNumber+"] "+X)}runDeadlineTimer(){clearTimeout(this.deadlineTimer),this.deadlineStartTime=new Date,this.trace("Deadline: "+(0,l7.deadlineToString)(this.deadline));let X=(0,l7.getRelativeTimeout)(this.deadline);if(X!==1/0){this.trace("Deadline will be reached in "+X+"ms");let Y=()=>{if(!this.deadlineStartTime){this.cancelWithStatus(c7.Status.DEADLINE_EXCEEDED,"Deadline exceeded");return}let W=[],z=new Date;if(W.push(`Deadline exceeded after ${(0,l7.formatDateDifference)(this.deadlineStartTime,z)}`),this.configReceivedTime){if(this.configReceivedTime>this.deadlineStartTime)W.push(`name resolution: ${(0,l7.formatDateDifference)(this.deadlineStartTime,this.configReceivedTime)}`);if(this.childStartTime){if(this.childStartTime>this.configReceivedTime)W.push(`metadata filters: ${(0,l7.formatDateDifference)(this.configReceivedTime,this.childStartTime)}`)}else W.push("waiting for metadata filters")}else W.push("waiting for name resolution");if(this.child)W.push(...this.child.getDeadlineInfo());this.cancelWithStatus(c7.Status.DEADLINE_EXCEEDED,W.join(","))};if(X<=0)process.nextTick(Y);else this.deadlineTimer=setTimeout(Y,X)}}outputStatus(X){if(!this.ended){if(this.ended=!0,!this.filterStack)this.filterStack=this.filterStackFactory.createFilter();clearTimeout(this.deadlineTimer);let Y=this.filterStack.receiveTrailers(X);this.trace("ended with status: code="+Y.code+' details="'+Y.details+'"'),this.statusWatchers.forEach((W)=>W(Y)),process.nextTick(()=>{var W;(W=this.listener)===null||W===void 0||W.onReceiveStatus(Y)})}}sendMessageOnChild(X,Y){if(!this.child)throw Error("sendMessageonChild called with child not populated");let W=this.child;this.writeFilterPending=!0,this.filterStack.sendMessage(Promise.resolve({message:Y,flags:X.flags})).then((z)=>{if(this.writeFilterPending=!1,W.sendMessageWithContext(X,z.message),this.pendingHalfClose)W.halfClose()},(z)=>{this.cancelWithStatus(z.code,z.details)})}getConfig(){if(this.ended)return;if(!this.metadata||!this.listener)throw Error("getConfig called before start");let X=this.channel.getConfig(this.method,this.metadata);if(X.type==="NONE"){this.channel.queueCallForConfig(this);return}else if(X.type==="ERROR"){if(this.metadata.getOptions().waitForReady)this.channel.queueCallForConfig(this);else this.outputStatus(X.error);return}this.configReceivedTime=new Date;let Y=X.config;if(Y.status!==c7.Status.OK){let{code:W,details:z}=(0,k81.restrictControlPlaneStatusCode)(Y.status,"Failed to route call to method "+this.method);this.outputStatus({code:W,details:z,metadata:new LY0.Metadata});return}if(Y.methodConfig.timeout){let W=new Date;W.setSeconds(W.getSeconds()+Y.methodConfig.timeout.seconds),W.setMilliseconds(W.getMilliseconds()+Y.methodConfig.timeout.nanos/1e6),this.deadline=(0,l7.minDeadline)(this.deadline,W),this.runDeadlineTimer()}this.filterStackFactory.push(Y.dynamicFilterFactories),this.filterStack=this.filterStackFactory.createFilter(),this.filterStack.sendMetadata(Promise.resolve(this.metadata)).then((W)=>{if(this.child=this.channel.createRetryingCall(Y,this.method,this.host,this.credentials,this.deadline),this.trace("Created child ["+this.child.getCallNumber()+"]"),this.childStartTime=new Date,this.child.start(W,{onReceiveMetadata:(z)=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(this.filterStack.receiveMetadata(z))},onReceiveMessage:(z)=>{this.trace("Received message"),this.readFilterPending=!0,this.filterStack.receiveMessage(z).then((F)=>{if(this.trace("Finished filtering received message"),this.readFilterPending=!1,this.listener.onReceiveMessage(F),this.pendingChildStatus)this.outputStatus(this.pendingChildStatus)},(F)=>{this.cancelWithStatus(F.code,F.details)})},onReceiveStatus:(z)=>{if(this.trace("Received status"),this.readFilterPending)this.pendingChildStatus=z;else this.outputStatus(z)}}),this.readPending)this.child.startRead();if(this.pendingMessage)this.sendMessageOnChild(this.pendingMessage.context,this.pendingMessage.message);else if(this.pendingHalfClose)this.child.halfClose()},(W)=>{this.outputStatus(W)})}reportResolverError(X){var Y;if((Y=this.metadata)===null||Y===void 0?void 0:Y.getOptions().waitForReady)this.channel.queueCallForConfig(this);else this.outputStatus(X)}cancelWithStatus(X,Y){var W;this.trace("cancelWithStatus code: "+X+' details: "'+Y+'"'),(W=this.child)===null||W===void 0||W.cancelWithStatus(X,Y),this.outputStatus({code:X,details:Y,metadata:new LY0.Metadata})}getPeer(){var X,Y;return(Y=(X=this.child)===null||X===void 0?void 0:X.getPeer())!==null&&Y!==void 0?Y:this.channel.getTarget()}start(X,Y){this.trace("start called"),this.metadata=X.clone(),this.listener=Y,this.getConfig()}sendMessageWithContext(X,Y){if(this.trace("write() called with message of length "+Y.length),this.child)this.sendMessageOnChild(X,Y);else this.pendingMessage={context:X,message:Y}}startRead(){if(this.trace("startRead called"),this.child)this.child.startRead();else this.readPending=!0}halfClose(){if(this.trace("halfClose called"),this.child&&!this.writeFilterPending)this.child.halfClose();else this.pendingHalfClose=!0}setCredentials(X){this.credentials=X}addStatusWatcher(X){this.statusWatchers.push(X)}getCallNumber(){return this.callNumber}getAuthContext(){if(this.child)return this.child.getAuthContext();else return null}}wY0.ResolvingCall=PY0});var _Y0=X0((jY0)=>{Object.defineProperty(jY0,"__esModule",{value:!0});jY0.RetryingCall=jY0.MessageBufferTracker=jY0.RetryThrottler=void 0;var JK=a1(),j81=OY(),h81=s6(),_81=A6(),x81="retrying_call";class yY0{constructor(X,Y,W){if(this.maxTokens=X,this.tokenRatio=Y,W)this.tokens=W.tokens*(X/W.maxTokens);else this.tokens=X}addCallSucceeded(){this.tokens=Math.min(this.tokens+this.tokenRatio,this.maxTokens)}addCallFailed(){this.tokens=Math.max(this.tokens-1,0)}canRetryCall(){return this.tokens>this.maxTokens/2}}jY0.RetryThrottler=yY0;class kY0{constructor(X,Y){this.totalLimit=X,this.limitPerCall=Y,this.totalAllocated=0,this.allocatedPerCall=new Map}allocate(X,Y){var W;let z=(W=this.allocatedPerCall.get(Y))!==null&&W!==void 0?W:0;if(this.limitPerCall-z<X||this.totalLimit-this.totalAllocated<X)return!1;return this.allocatedPerCall.set(Y,z+X),this.totalAllocated+=X,!0}free(X,Y){var W;if(this.totalAllocated<X)throw Error(`Invalid buffer allocation state: call ${Y} freed ${X} > total allocated ${this.totalAllocated}`);this.totalAllocated-=X;let z=(W=this.allocatedPerCall.get(Y))!==null&&W!==void 0?W:0;if(z<X)throw Error(`Invalid buffer allocation state: call ${Y} freed ${X} > allocated for call ${z}`);this.allocatedPerCall.set(Y,z-X)}freeAll(X){var Y;let W=(Y=this.allocatedPerCall.get(X))!==null&&Y!==void 0?Y:0;if(this.totalAllocated<W)throw Error(`Invalid buffer allocation state: call ${X} allocated ${W} > total allocated ${this.totalAllocated}`);this.totalAllocated-=W,this.allocatedPerCall.delete(X)}}jY0.MessageBufferTracker=kY0;var pN="grpc-previous-rpc-attempts",b81=5;class vY0{constructor(X,Y,W,z,F,Q,J,Z,K){var H;this.channel=X,this.callConfig=Y,this.methodName=W,this.host=z,this.credentials=F,this.deadline=Q,this.callNumber=J,this.bufferTracker=Z,this.retryThrottler=K,this.listener=null,this.initialMetadata=null,this.underlyingCalls=[],this.writeBuffer=[],this.writeBufferOffset=0,this.readStarted=!1,this.transparentRetryUsed=!1,this.attempts=0,this.hedgingTimer=null,this.committedCallIndex=null,this.initialRetryBackoffSec=0,this.nextRetryBackoffSec=0;let G=(H=X.getOptions()["grpc-node.retry_max_attempts_limit"])!==null&&H!==void 0?H:b81;if(X.getOptions()["grpc.enable_retries"]===0)this.state="NO_RETRY",this.maxAttempts=1;else if(Y.methodConfig.retryPolicy){this.state="RETRY";let q=Y.methodConfig.retryPolicy;this.nextRetryBackoffSec=this.initialRetryBackoffSec=Number(q.initialBackoff.substring(0,q.initialBackoff.length-1)),this.maxAttempts=Math.min(q.maxAttempts,G)}else if(Y.methodConfig.hedgingPolicy)this.state="HEDGING",this.maxAttempts=Math.min(Y.methodConfig.hedgingPolicy.maxAttempts,G);else this.state="TRANSPARENT_ONLY",this.maxAttempts=1;this.startTime=new Date}getDeadlineInfo(){if(this.underlyingCalls.length===0)return[];let X=[],Y=this.underlyingCalls[this.underlyingCalls.length-1];if(this.underlyingCalls.length>1)X.push(`previous attempts: ${this.underlyingCalls.length-1}`);if(Y.startTime>this.startTime)X.push(`time to current attempt start: ${(0,j81.formatDateDifference)(this.startTime,Y.startTime)}`);return X.push(...Y.call.getDeadlineInfo()),X}getCallNumber(){return this.callNumber}trace(X){_81.trace(JK.LogVerbosity.DEBUG,x81,"["+this.callNumber+"] "+X)}reportStatus(X){this.trace("ended with status: code="+X.code+' details="'+X.details+'" start time='+this.startTime.toISOString()),this.bufferTracker.freeAll(this.callNumber),this.writeBufferOffset=this.writeBufferOffset+this.writeBuffer.length,this.writeBuffer=[],process.nextTick(()=>{var Y;(Y=this.listener)===null||Y===void 0||Y.onReceiveStatus({code:X.code,details:X.details,metadata:X.metadata})})}cancelWithStatus(X,Y){this.trace("cancelWithStatus code: "+X+' details: "'+Y+'"'),this.reportStatus({code:X,details:Y,metadata:new h81.Metadata});for(let{call:W}of this.underlyingCalls)W.cancelWithStatus(X,Y)}getPeer(){if(this.committedCallIndex!==null)return this.underlyingCalls[this.committedCallIndex].call.getPeer();else return"unknown"}getBufferEntry(X){var Y;return(Y=this.writeBuffer[X-this.writeBufferOffset])!==null&&Y!==void 0?Y:{entryType:"FREED",allocated:!1}}getNextBufferIndex(){return this.writeBufferOffset+this.writeBuffer.length}clearSentMessages(){if(this.state!=="COMMITTED")return;let X;if(this.underlyingCalls[this.committedCallIndex].state==="COMPLETED")X=this.getNextBufferIndex();else X=this.underlyingCalls[this.committedCallIndex].nextMessageToSend;for(let Y=this.writeBufferOffset;Y<X;Y++){let W=this.getBufferEntry(Y);if(W.allocated)this.bufferTracker.free(W.message.message.length,this.callNumber)}this.writeBuffer=this.writeBuffer.slice(X-this.writeBufferOffset),this.writeBufferOffset=X}commitCall(X){var Y,W;if(this.state==="COMMITTED")return;this.trace("Committing call ["+this.underlyingCalls[X].call.getCallNumber()+"] at index "+X),this.state="COMMITTED",(W=(Y=this.callConfig).onCommitted)===null||W===void 0||W.call(Y),this.committedCallIndex=X;for(let z=0;z<this.underlyingCalls.length;z++){if(z===X)continue;if(this.underlyingCalls[z].state==="COMPLETED")continue;this.underlyingCalls[z].state="COMPLETED",this.underlyingCalls[z].call.cancelWithStatus(JK.Status.CANCELLED,"Discarded in favor of other hedged attempt")}this.clearSentMessages()}commitCallWithMostMessages(){if(this.state==="COMMITTED")return;let X=-1,Y=-1;for(let[W,z]of this.underlyingCalls.entries())if(z.state==="ACTIVE"&&z.nextMessageToSend>X)X=z.nextMessageToSend,Y=W;if(Y===-1)this.state="TRANSPARENT_ONLY";else this.commitCall(Y)}isStatusCodeInList(X,Y){return X.some((W)=>{var z;return W===Y||W.toString().toLowerCase()===((z=JK.Status[Y])===null||z===void 0?void 0:z.toLowerCase())})}getNextRetryJitter(){return Math.random()*0.3999999999999999+0.8}getNextRetryBackoffMs(){var X;let Y=(X=this.callConfig)===null||X===void 0?void 0:X.methodConfig.retryPolicy;if(!Y)return 0;let z=this.getNextRetryJitter()*this.nextRetryBackoffSec*1000,F=Number(Y.maxBackoff.substring(0,Y.maxBackoff.length-1));return this.nextRetryBackoffSec=Math.min(this.nextRetryBackoffSec*Y.backoffMultiplier,F),z}maybeRetryCall(X,Y){if(this.state!=="RETRY"){Y(!1);return}if(this.attempts>=this.maxAttempts){Y(!1);return}let W;if(X===null)W=this.getNextRetryBackoffMs();else if(X<0){this.state="TRANSPARENT_ONLY",Y(!1);return}else W=X,this.nextRetryBackoffSec=this.initialRetryBackoffSec;setTimeout(()=>{var z,F;if(this.state!=="RETRY"){Y(!1);return}if((F=(z=this.retryThrottler)===null||z===void 0?void 0:z.canRetryCall())!==null&&F!==void 0?F:!0)Y(!0),this.attempts+=1,this.startNewAttempt();else this.trace("Retry attempt denied by throttling policy"),Y(!1)},W)}countActiveCalls(){let X=0;for(let Y of this.underlyingCalls)if((Y===null||Y===void 0?void 0:Y.state)==="ACTIVE")X+=1;return X}handleProcessedStatus(X,Y,W){var z,F,Q;switch(this.state){case"COMMITTED":case"NO_RETRY":case"TRANSPARENT_ONLY":this.commitCall(Y),this.reportStatus(X);break;case"HEDGING":if(this.isStatusCodeInList((z=this.callConfig.methodConfig.hedgingPolicy.nonFatalStatusCodes)!==null&&z!==void 0?z:[],X.code)){(F=this.retryThrottler)===null||F===void 0||F.addCallFailed();let J;if(W===null)J=0;else if(W<0){this.state="TRANSPARENT_ONLY",this.commitCall(Y),this.reportStatus(X);return}else J=W;setTimeout(()=>{if(this.maybeStartHedgingAttempt(),this.countActiveCalls()===0)this.commitCall(Y),this.reportStatus(X)},J)}else this.commitCall(Y),this.reportStatus(X);break;case"RETRY":if(this.isStatusCodeInList(this.callConfig.methodConfig.retryPolicy.retryableStatusCodes,X.code))(Q=this.retryThrottler)===null||Q===void 0||Q.addCallFailed(),this.maybeRetryCall(W,(J)=>{if(!J)this.commitCall(Y),this.reportStatus(X)});else this.commitCall(Y),this.reportStatus(X);break}}getPushback(X){let Y=X.get("grpc-retry-pushback-ms");if(Y.length===0)return null;try{return parseInt(Y[0])}catch(W){return-1}}handleChildStatus(X,Y){var W;if(this.underlyingCalls[Y].state==="COMPLETED")return;if(this.trace("state="+this.state+" handling status with progress "+X.progress+" from child ["+this.underlyingCalls[Y].call.getCallNumber()+"] in state "+this.underlyingCalls[Y].state),this.underlyingCalls[Y].state="COMPLETED",X.code===JK.Status.OK){(W=this.retryThrottler)===null||W===void 0||W.addCallSucceeded(),this.commitCall(Y),this.reportStatus(X);return}if(this.state==="NO_RETRY"){this.commitCall(Y),this.reportStatus(X);return}if(this.state==="COMMITTED"){this.reportStatus(X);return}let z=this.getPushback(X.metadata);switch(X.progress){case"NOT_STARTED":this.startNewAttempt();break;case"REFUSED":if(this.transparentRetryUsed)this.handleProcessedStatus(X,Y,z);else this.transparentRetryUsed=!0,this.startNewAttempt();break;case"DROP":this.commitCall(Y),this.reportStatus(X);break;case"PROCESSED":this.handleProcessedStatus(X,Y,z);break}}maybeStartHedgingAttempt(){if(this.state!=="HEDGING")return;if(!this.callConfig.methodConfig.hedgingPolicy)return;if(this.attempts>=this.maxAttempts)return;this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()}maybeStartHedgingTimer(){var X,Y,W;if(this.hedgingTimer)clearTimeout(this.hedgingTimer);if(this.state!=="HEDGING")return;if(!this.callConfig.methodConfig.hedgingPolicy)return;let z=this.callConfig.methodConfig.hedgingPolicy;if(this.attempts>=this.maxAttempts)return;let F=(X=z.hedgingDelay)!==null&&X!==void 0?X:"0s",Q=Number(F.substring(0,F.length-1));this.hedgingTimer=setTimeout(()=>{this.maybeStartHedgingAttempt()},Q*1000),(W=(Y=this.hedgingTimer).unref)===null||W===void 0||W.call(Y)}startNewAttempt(){let X=this.channel.createLoadBalancingCall(this.callConfig,this.methodName,this.host,this.credentials,this.deadline);this.trace("Created child call ["+X.getCallNumber()+"] for attempt "+this.attempts);let Y=this.underlyingCalls.length;this.underlyingCalls.push({state:"ACTIVE",call:X,nextMessageToSend:0,startTime:new Date});let W=this.attempts-1,z=this.initialMetadata.clone();if(W>0)z.set(pN,`${W}`);let F=!1;if(X.start(z,{onReceiveMetadata:(Q)=>{if(this.trace("Received metadata from child ["+X.getCallNumber()+"]"),this.commitCall(Y),F=!0,W>0)Q.set(pN,`${W}`);if(this.underlyingCalls[Y].state==="ACTIVE")this.listener.onReceiveMetadata(Q)},onReceiveMessage:(Q)=>{if(this.trace("Received message from child ["+X.getCallNumber()+"]"),this.commitCall(Y),this.underlyingCalls[Y].state==="ACTIVE")this.listener.onReceiveMessage(Q)},onReceiveStatus:(Q)=>{if(this.trace("Received status from child ["+X.getCallNumber()+"]"),!F&&W>0)Q.metadata.set(pN,`${W}`);this.handleChildStatus(Q,Y)}}),this.sendNextChildMessage(Y),this.readStarted)X.startRead()}start(X,Y){this.trace("start called"),this.listener=Y,this.initialMetadata=X,this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()}handleChildWriteCompleted(X,Y){var W,z;(z=(W=this.getBufferEntry(Y)).callback)===null||z===void 0||z.call(W),this.clearSentMessages();let F=this.underlyingCalls[X];F.nextMessageToSend+=1,this.sendNextChildMessage(X)}sendNextChildMessage(X){let Y=this.underlyingCalls[X];if(Y.state==="COMPLETED")return;let W=Y.nextMessageToSend;if(this.getBufferEntry(W)){let z=this.getBufferEntry(W);switch(z.entryType){case"MESSAGE":if(Y.call.sendMessageWithContext({callback:(Q)=>{this.handleChildWriteCompleted(X,W)}},z.message.message),this.getBufferEntry(W+1).entryType==="HALF_CLOSE")this.trace("Sending halfClose immediately after message to child ["+Y.call.getCallNumber()+"] - optimizing for unary/final message"),Y.nextMessageToSend+=1,Y.call.halfClose();break;case"HALF_CLOSE":Y.nextMessageToSend+=1,Y.call.halfClose();break;case"FREED":break}}}sendMessageWithContext(X,Y){this.trace("write() called with message of length "+Y.length);let W={message:Y,flags:X.flags},z=this.getNextBufferIndex(),F={entryType:"MESSAGE",message:W,allocated:this.bufferTracker.allocate(Y.length,this.callNumber)};if(this.writeBuffer.push(F),F.allocated){process.nextTick(()=>{var Q;(Q=X.callback)===null||Q===void 0||Q.call(X)});for(let[Q,J]of this.underlyingCalls.entries())if(J.state==="ACTIVE"&&J.nextMessageToSend===z)J.call.sendMessageWithContext({callback:(Z)=>{this.handleChildWriteCompleted(Q,z)}},Y)}else{if(this.commitCallWithMostMessages(),this.committedCallIndex===null)return;let Q=this.underlyingCalls[this.committedCallIndex];if(F.callback=X.callback,Q.state==="ACTIVE"&&Q.nextMessageToSend===z)Q.call.sendMessageWithContext({callback:(J)=>{this.handleChildWriteCompleted(this.committedCallIndex,z)}},Y)}}startRead(){this.trace("startRead called"),this.readStarted=!0;for(let X of this.underlyingCalls)if((X===null||X===void 0?void 0:X.state)==="ACTIVE")X.call.startRead()}halfClose(){this.trace("halfClose called");let X=this.getNextBufferIndex();this.writeBuffer.push({entryType:"HALF_CLOSE",allocated:!1});for(let Y of this.underlyingCalls)if((Y===null||Y===void 0?void 0:Y.state)==="ACTIVE"){if(Y.nextMessageToSend===X||Y.nextMessageToSend===X-1)this.trace("Sending halfClose immediately to child ["+Y.call.getCallNumber()+"] - all messages already sent"),Y.nextMessageToSend+=1,Y.call.halfClose()}}setCredentials(X){throw Error("Method not implemented.")}getMethod(){return this.methodName}getHost(){return this.host}getAuthContext(){if(this.committedCallIndex!==null)return this.underlyingCalls[this.committedCallIndex].call.getAuthContext();else return null}}jY0.RetryingCall=vY0});var _Q=X0((bY0)=>{Object.defineProperty(bY0,"__esModule",{value:!0});bY0.BaseSubchannelWrapper=void 0;class xY0{constructor(X){this.child=X,this.healthy=!0,this.healthListeners=new Set,this.refcount=0,this.dataWatchers=new Set,X.addHealthStateWatcher((Y)=>{if(this.healthy)this.updateHealthListeners()})}updateHealthListeners(){for(let X of this.healthListeners)X(this.isHealthy())}getConnectivityState(){return this.child.getConnectivityState()}addConnectivityStateListener(X){this.child.addConnectivityStateListener(X)}removeConnectivityStateListener(X){this.child.removeConnectivityStateListener(X)}startConnecting(){this.child.startConnecting()}getAddress(){return this.child.getAddress()}throttleKeepalive(X){this.child.throttleKeepalive(X)}ref(){this.child.ref(),this.refcount+=1}unref(){if(this.child.unref(),this.refcount-=1,this.refcount===0)this.destroy()}destroy(){for(let X of this.dataWatchers)X.destroy()}getChannelzRef(){return this.child.getChannelzRef()}isHealthy(){return this.healthy&&this.child.isHealthy()}addHealthStateWatcher(X){this.healthListeners.add(X)}removeHealthStateWatcher(X){this.healthListeners.delete(X)}addDataWatcher(X){X.setSubchannel(this.getRealSubchannel()),this.dataWatchers.add(X)}setHealthy(X){if(X!==this.healthy){if(this.healthy=X,this.child.isHealthy())this.updateHealthListeners()}}getRealSubchannel(){return this.child.getRealSubchannel()}realSubchannelEquals(X){return this.getRealSubchannel()===X.getRealSubchannel()}getCallCredentials(){return this.child.getCallCredentials()}getChannel(){return this.child.getChannel()}}bY0.BaseSubchannelWrapper=xY0});var rN=X0((pY0)=>{Object.defineProperty(pY0,"__esModule",{value:!0});pY0.InternalChannel=pY0.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=void 0;var g81=ZY(),d81=A40(),c81=IY0(),aN=b4(),l81=s6(),y5=a1(),p81=rG(),n81=fN(),mY0=y8(),WK=A6(),i81=uN(),GK=E9(),B8=C9(),xQ=S5(),a81=MY0(),r81=OY(),o81=fY0(),nN=iG(),t81=SQ(),iN=_Y0(),s81=_Q(),e81=2147483647,X41=1000,Y41=1800000,KK=new Map,Z41=16777216,Q41=1048576;class gY0 extends s81.BaseSubchannelWrapper{constructor(X,Y){super(X);this.channel=Y,this.refCount=0,this.subchannelStateListener=(W,z,F,Q)=>{Y.throttleKeepalive(Q)}}ref(){if(this.refCount===0)this.child.addConnectivityStateListener(this.subchannelStateListener),this.channel.addWrappedSubchannel(this);this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0)this.child.removeConnectivityStateListener(this.subchannelStateListener),this.channel.removeWrappedSubchannel(this)}}class dY0{pick(X){return{pickResultType:aN.PickResultType.DROP,status:{code:y5.Status.UNAVAILABLE,details:"Channel closed before call started",metadata:new l81.Metadata},subchannel:null,onCallStarted:null,onCallEnded:null}}}pY0.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX="grpc.internal.no_subchannel";class cY0{constructor(X){this.target=X,this.trace=new xQ.ChannelzTrace,this.callTracker=new xQ.ChannelzCallTracker,this.childrenTracker=new xQ.ChannelzChildrenTracker,this.state=B8.ConnectivityState.IDLE}getChannelzInfoCallback(){return()=>{return{target:this.target,state:this.state,trace:this.trace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}}}}class lY0{constructor(X,Y,W){var z,F,Q,J,Z,K;if(this.credentials=Y,this.options=W,this.connectivityState=B8.ConnectivityState.IDLE,this.currentPicker=new aN.UnavailablePicker,this.configSelectionQueue=[],this.pickQueue=[],this.connectivityStateWatchers=[],this.callRefTimer=null,this.configSelector=null,this.currentResolutionError=null,this.wrappedSubchannels=new Set,this.callCount=0,this.idleTimer=null,this.channelzEnabled=!0,this.randomChannelId=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER),typeof X!=="string")throw TypeError("Channel target must be a string");if(!(Y instanceof g81.ChannelCredentials))throw TypeError("Channel credentials must be a ChannelCredentials object");if(W){if(typeof W!=="object")throw TypeError("Channel options must be an object")}this.channelzInfoTracker=new cY0(X);let H=(0,GK.parseUri)(X);if(H===null)throw Error(`Could not parse target name "${X}"`);let G=(0,mY0.mapUriDefaultScheme)(H);if(G===null)throw Error(`Could not find a default scheme for target name "${X}"`);if(this.options["grpc.enable_channelz"]===0)this.channelzEnabled=!1;if(this.channelzRef=(0,xQ.registerChannelzChannel)(X,this.channelzInfoTracker.getChannelzInfoCallback(),this.channelzEnabled),this.channelzEnabled)this.channelzInfoTracker.trace.addTrace("CT_INFO","Channel created");if(this.options["grpc.default_authority"])this.defaultAuthority=this.options["grpc.default_authority"];else this.defaultAuthority=(0,mY0.getDefaultAuthority)(G);let q=(0,i81.mapProxyName)(G,W);this.target=q.target,this.options=Object.assign({},this.options,q.extraOptions),this.subchannelPool=(0,c81.getSubchannelPool)(((z=this.options["grpc.use_local_subchannel_pool"])!==null&&z!==void 0?z:0)===0),this.retryBufferTracker=new iN.MessageBufferTracker((F=this.options["grpc.retry_buffer_size"])!==null&&F!==void 0?F:Z41,(Q=this.options["grpc.per_rpc_retry_buffer_size"])!==null&&Q!==void 0?Q:Q41),this.keepaliveTime=(J=this.options["grpc.keepalive_time_ms"])!==null&&J!==void 0?J:-1,this.idleTimeoutMs=Math.max((Z=this.options["grpc.client_idle_timeout_ms"])!==null&&Z!==void 0?Z:Y41,X41);let B={createSubchannel:(R,E)=>{let U={};for(let[I,C]of Object.entries(E))if(!I.startsWith(pY0.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX))U[I]=C;let A=this.subchannelPool.getOrCreateSubchannel(this.target,R,U,this.credentials);if(A.throttleKeepalive(this.keepaliveTime),this.channelzEnabled)this.channelzInfoTracker.trace.addTrace("CT_INFO","Created subchannel or used existing subchannel",A.getChannelzRef());return new gY0(A,this)},updateState:(R,E)=>{this.currentPicker=E;let U=this.pickQueue.slice();if(this.pickQueue=[],U.length>0)this.callRefTimerUnref();for(let A of U)A.doPick();this.updateState(R)},requestReresolution:()=>{throw Error("Resolving load balancer should never call requestReresolution")},addChannelzChild:(R)=>{if(this.channelzEnabled)this.channelzInfoTracker.childrenTracker.refChild(R)},removeChannelzChild:(R)=>{if(this.channelzEnabled)this.channelzInfoTracker.childrenTracker.unrefChild(R)}};this.resolvingLoadBalancer=new d81.ResolvingLoadBalancer(this.target,B,this.options,(R,E)=>{var U;if(R.retryThrottling)KK.set(this.getTarget(),new iN.RetryThrottler(R.retryThrottling.maxTokens,R.retryThrottling.tokenRatio,KK.get(this.getTarget())));else KK.delete(this.getTarget());if(this.channelzEnabled)this.channelzInfoTracker.trace.addTrace("CT_INFO","Address resolution succeeded");(U=this.configSelector)===null||U===void 0||U.unref(),this.configSelector=E,this.currentResolutionError=null,process.nextTick(()=>{let A=this.configSelectionQueue;if(this.configSelectionQueue=[],A.length>0)this.callRefTimerUnref();for(let T of A)T.getConfig()})},(R)=>{if(this.channelzEnabled)this.channelzInfoTracker.trace.addTrace("CT_WARNING","Address resolution failed with code "+R.code+' and details "'+R.details+'"');if(this.configSelectionQueue.length>0)this.trace("Name resolution failed with calls queued for config selection");if(this.configSelector===null)this.currentResolutionError=Object.assign(Object.assign({},(0,t81.restrictControlPlaneStatusCode)(R.code,R.details)),{metadata:R.metadata});let E=this.configSelectionQueue;if(this.configSelectionQueue=[],E.length>0)this.callRefTimerUnref();for(let U of E)U.reportResolverError(R)}),this.filterStackFactory=new p81.FilterStackFactory([new n81.CompressionFilterFactory(this,this.options)]),this.trace("Channel constructed with options "+JSON.stringify(W,void 0,2));let $=Error();if((0,WK.isTracerEnabled)("channel_stacktrace"))(0,WK.trace)(y5.LogVerbosity.DEBUG,"channel_stacktrace","("+this.channelzRef.id+`) Channel constructed
492
492
  `+((K=$.stack)===null||K===void 0?void 0:K.substring($.stack.indexOf(`
493
- `)+1)));this.lastActivityTimestamp=new Date}trace(X,Y){(0,WK.trace)(Y!==null&&Y!==void 0?Y:y5.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,GK.uriToString)(this.target)+" "+X)}callRefTimerRef(){var X,Y,W,z;if(!this.callRefTimer)this.callRefTimer=setInterval(()=>{},e81);if(!((Y=(X=this.callRefTimer).hasRef)===null||Y===void 0?void 0:Y.call(X)))this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(z=(W=this.callRefTimer).ref)===null||z===void 0||z.call(W)}callRefTimerUnref(){var X,Y,W;if(!((X=this.callRefTimer)===null||X===void 0?void 0:X.hasRef)||this.callRefTimer.hasRef())this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(W=(Y=this.callRefTimer)===null||Y===void 0?void 0:Y.unref)===null||W===void 0||W.call(Y)}removeConnectivityStateWatcher(X){let Y=this.connectivityStateWatchers.findIndex((W)=>W===X);if(Y>=0)this.connectivityStateWatchers.splice(Y,1)}updateState(X){if((0,WK.trace)(y5.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,GK.uriToString)(this.target)+" "+B8.ConnectivityState[this.connectivityState]+" -> "+B8.ConnectivityState[X]),this.channelzEnabled)this.channelzInfoTracker.trace.addTrace("CT_INFO","Connectivity state change to "+B8.ConnectivityState[X]);this.connectivityState=X,this.channelzInfoTracker.state=X;let Y=this.connectivityStateWatchers.slice();for(let W of Y)if(X!==W.currentState){if(W.timer)clearTimeout(W.timer);this.removeConnectivityStateWatcher(W),W.callback()}if(X!==B8.ConnectivityState.TRANSIENT_FAILURE)this.currentResolutionError=null}throttleKeepalive(X){if(X>this.keepaliveTime){this.keepaliveTime=X;for(let Y of this.wrappedSubchannels)Y.throttleKeepalive(X)}}addWrappedSubchannel(X){this.wrappedSubchannels.add(X)}removeWrappedSubchannel(X){this.wrappedSubchannels.delete(X)}doPick(X,Y){return this.currentPicker.pick({metadata:X,extraPickInfo:Y})}queueCallForPick(X){this.pickQueue.push(X),this.callRefTimerRef()}getConfig(X,Y){if(this.connectivityState!==B8.ConnectivityState.SHUTDOWN)this.resolvingLoadBalancer.exitIdle();if(this.configSelector)return{type:"SUCCESS",config:this.configSelector.invoke(X,Y,this.randomChannelId)};else if(this.currentResolutionError)return{type:"ERROR",error:this.currentResolutionError};else return{type:"NONE"}}queueCallForConfig(X){this.configSelectionQueue.push(X),this.callRefTimerRef()}enterIdle(){if(this.resolvingLoadBalancer.destroy(),this.updateState(B8.ConnectivityState.IDLE),this.currentPicker=new aN.QueuePicker(this.resolvingLoadBalancer),this.idleTimer)clearTimeout(this.idleTimer),this.idleTimer=null;if(this.callRefTimer)clearInterval(this.callRefTimer),this.callRefTimer=null}startIdleTimeout(X){var Y,W;this.idleTimer=setTimeout(()=>{if(this.callCount>0){this.startIdleTimeout(this.idleTimeoutMs);return}let F=new Date().valueOf()-this.lastActivityTimestamp.valueOf();if(F>=this.idleTimeoutMs)this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle();else this.startIdleTimeout(this.idleTimeoutMs-F)},X),(W=(Y=this.idleTimer).unref)===null||W===void 0||W.call(Y)}maybeStartIdleTimer(){if(this.connectivityState!==B8.ConnectivityState.SHUTDOWN&&!this.idleTimer)this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){if(this.channelzEnabled)this.channelzInfoTracker.callTracker.addCallStarted();this.callCount+=1}onCallEnd(X){if(this.channelzEnabled)if(X.code===y5.Status.OK)this.channelzInfoTracker.callTracker.addCallSucceeded();else this.channelzInfoTracker.callTracker.addCallFailed();this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(X,Y,W,z,F){let Q=(0,nN.getNextCallNumber)();return this.trace("createLoadBalancingCall ["+Q+'] method="'+Y+'"'),new a81.LoadBalancingCall(this,X,Y,W,z,F,Q)}createRetryingCall(X,Y,W,z,F){let Q=(0,nN.getNextCallNumber)();return this.trace("createRetryingCall ["+Q+'] method="'+Y+'"'),new iN.RetryingCall(this,X,Y,W,z,F,Q,this.retryBufferTracker,KK.get(this.getTarget()))}createResolvingCall(X,Y,W,z,F){let Q=(0,nN.getNextCallNumber)();this.trace("createResolvingCall ["+Q+'] method="'+X+'", deadline='+(0,r81.deadlineToString)(Y));let J={deadline:Y,flags:F!==null&&F!==void 0?F:y5.Propagate.DEFAULTS,host:W!==null&&W!==void 0?W:this.defaultAuthority,parentCall:z},Z=new o81.ResolvingCall(this,X,J,this.filterStackFactory.clone(),Q);return this.onCallStart(),Z.addStatusWatcher((K)=>{this.onCallEnd(K)}),Z}close(){var X;this.resolvingLoadBalancer.destroy(),this.updateState(B8.ConnectivityState.SHUTDOWN),this.currentPicker=new dY0;for(let Y of this.configSelectionQueue)Y.cancelWithStatus(y5.Status.UNAVAILABLE,"Channel closed before call started");this.configSelectionQueue=[];for(let Y of this.pickQueue)Y.cancelWithStatus(y5.Status.UNAVAILABLE,"Channel closed before call started");if(this.pickQueue=[],this.callRefTimer)clearInterval(this.callRefTimer);if(this.idleTimer)clearTimeout(this.idleTimer);if(this.channelzEnabled)(0,xQ.unregisterChannelzRef)(this.channelzRef);this.subchannelPool.unrefUnusedSubchannels(),(X=this.configSelector)===null||X===void 0||X.unref(),this.configSelector=null}getTarget(){return(0,GK.uriToString)(this.target)}getConnectivityState(X){let Y=this.connectivityState;if(X)this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer();return Y}watchConnectivityState(X,Y,W){if(this.connectivityState===B8.ConnectivityState.SHUTDOWN)throw Error("Channel has been shut down");let z=null;if(Y!==1/0){let Q=Y instanceof Date?Y:new Date(Y),J=new Date;if(Y===-1/0||Q<=J){process.nextTick(W,Error("Deadline passed without connectivity state change"));return}z=setTimeout(()=>{this.removeConnectivityStateWatcher(F),W(Error("Deadline passed without connectivity state change"))},Q.getTime()-J.getTime())}let F={currentState:X,callback:W,timer:z};this.connectivityStateWatchers.push(F)}getChannelzRef(){return this.channelzRef}createCall(X,Y,W,z,F){if(typeof X!=="string")throw TypeError("Channel#createCall: method must be a string");if(!(typeof Y==="number"||Y instanceof Date))throw TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===B8.ConnectivityState.SHUTDOWN)throw Error("Channel has been shut down");return this.createResolvingCall(X,Y,W,z,F)}getOptions(){return this.options}}pY0.InternalChannel=lY0});var fU=X0((rY0)=>{Object.defineProperty(rY0,"__esModule",{value:!0});rY0.ChannelImplementation=void 0;var J41=ZY(),W41=rN();class aY0{constructor(X,Y,W){if(typeof X!=="string")throw TypeError("Channel target must be a string");if(!(Y instanceof J41.ChannelCredentials))throw TypeError("Channel credentials must be a ChannelCredentials object");if(W){if(typeof W!=="object")throw TypeError("Channel options must be an object")}this.internalChannel=new W41.InternalChannel(X,Y,W)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(X){return this.internalChannel.getConnectivityState(X)}watchConnectivityState(X,Y,W){this.internalChannel.watchConnectivityState(X,Y,W)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(X,Y,W,z,F){if(typeof X!=="string")throw TypeError("Channel#createCall: method must be a string");if(!(typeof Y==="number"||Y instanceof Date))throw TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(X,Y,W,z,F)}}rY0.ChannelImplementation=aY0});var JZ0=X0((ZZ0)=>{Object.defineProperty(ZZ0,"__esModule",{value:!0});ZZ0.ServerDuplexStreamImpl=ZZ0.ServerWritableStreamImpl=ZZ0.ServerReadableStreamImpl=ZZ0.ServerUnaryCallImpl=void 0;ZZ0.serverErrorToStatus=sN;var G41=F1("events"),oN=F1("stream"),tN=a1(),tY0=s6();function sN(X,Y){var W;let z={code:tN.Status.UNKNOWN,details:"message"in X?X.message:"Unknown Error",metadata:(W=Y!==null&&Y!==void 0?Y:X.metadata)!==null&&W!==void 0?W:null};if("code"in X&&typeof X.code==="number"&&Number.isInteger(X.code)){if(z.code=X.code,"details"in X&&typeof X.details==="string")z.details=X.details}return z}class sY0 extends G41.EventEmitter{constructor(X,Y,W,z){super();this.path=X,this.call=Y,this.metadata=W,this.request=z,this.cancelled=!1}getPeer(){return this.call.getPeer()}sendMetadata(X){this.call.sendMetadata(X)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}ZZ0.ServerUnaryCallImpl=sY0;class eY0 extends oN.Readable{constructor(X,Y,W){super({objectMode:!0});this.path=X,this.call=Y,this.metadata=W,this.cancelled=!1}_read(X){this.call.startRead()}getPeer(){return this.call.getPeer()}sendMetadata(X){this.call.sendMetadata(X)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}ZZ0.ServerReadableStreamImpl=eY0;class XZ0 extends oN.Writable{constructor(X,Y,W,z){super({objectMode:!0});this.path=X,this.call=Y,this.metadata=W,this.request=z,this.pendingStatus={code:tN.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new tY0.Metadata,this.on("error",(F)=>{this.pendingStatus=sN(F),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(X){this.call.sendMetadata(X)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_write(X,Y,W){this.call.sendMessage(X,W)}_final(X){var Y;X(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(Y=this.pendingStatus.metadata)!==null&&Y!==void 0?Y:this.trailingMetadata}))}end(X){if(X)this.trailingMetadata=X;return super.end()}}ZZ0.ServerWritableStreamImpl=XZ0;class YZ0 extends oN.Duplex{constructor(X,Y,W){super({objectMode:!0});this.path=X,this.call=Y,this.metadata=W,this.pendingStatus={code:tN.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new tY0.Metadata,this.on("error",(z)=>{this.pendingStatus=sN(z),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(X){this.call.sendMetadata(X)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_read(X){this.call.startRead()}_write(X,Y,W){this.call.sendMessage(X,W)}_final(X){var Y;X(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(Y=this.pendingStatus.metadata)!==null&&Y!==void 0?Y:this.trailingMetadata}))}end(X){if(X)this.trailingMetadata=X;return super.end()}}ZZ0.ServerDuplexStreamImpl=YZ0});var FK=X0((WZ0)=>{Object.defineProperty(WZ0,"__esModule",{value:!0});WZ0.ServerCredentials=void 0;WZ0.createCertificateProviderServerCredentials=H41;WZ0.createServerCredentialsWithInterceptors=V41;var eN=NU();class EY{constructor(X,Y){this.serverConstructorOptions=X,this.watchers=new Set,this.latestContextOptions=null,this.latestContextOptions=Y!==null&&Y!==void 0?Y:null}_addWatcher(X){this.watchers.add(X)}_removeWatcher(X){this.watchers.delete(X)}getWatcherCount(){return this.watchers.size}updateSecureContextOptions(X){this.latestContextOptions=X;for(let Y of this.watchers)Y(this.latestContextOptions)}_isSecure(){return this.serverConstructorOptions!==null}_getSecureContextOptions(){return this.latestContextOptions}_getConstructorOptions(){return this.serverConstructorOptions}_getInterceptors(){return[]}static createInsecure(){return new XA}static createSsl(X,Y,W=!1){var z;if(X!==null&&!Buffer.isBuffer(X))throw TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(Y))throw TypeError("keyCertPairs must be an array");if(typeof W!=="boolean")throw TypeError("checkClientCertificate must be a boolean");let F=[],Q=[];for(let J=0;J<Y.length;J++){let Z=Y[J];if(Z===null||typeof Z!=="object")throw TypeError(`keyCertPair[${J}] must be an object`);if(!Buffer.isBuffer(Z.private_key))throw TypeError(`keyCertPair[${J}].private_key must be a Buffer`);if(!Buffer.isBuffer(Z.cert_chain))throw TypeError(`keyCertPair[${J}].cert_chain must be a Buffer`);F.push(Z.cert_chain),Q.push(Z.private_key)}return new YA({requestCert:W,ciphers:eN.CIPHER_SUITES},{ca:(z=X!==null&&X!==void 0?X:(0,eN.getDefaultRootsData)())!==null&&z!==void 0?z:void 0,cert:F,key:Q})}}WZ0.ServerCredentials=EY;class XA extends EY{constructor(){super(null)}_getSettings(){return null}_equals(X){return X instanceof XA}}class YA extends EY{constructor(X,Y){super(X,Y);this.options=Object.assign(Object.assign({},X),Y)}_equals(X){if(this===X)return!0;if(!(X instanceof YA))return!1;if(Buffer.isBuffer(this.options.ca)&&Buffer.isBuffer(X.options.ca)){if(!this.options.ca.equals(X.options.ca))return!1}else if(this.options.ca!==X.options.ca)return!1;if(Array.isArray(this.options.cert)&&Array.isArray(X.options.cert)){if(this.options.cert.length!==X.options.cert.length)return!1;for(let Y=0;Y<this.options.cert.length;Y++){let W=this.options.cert[Y],z=X.options.cert[Y];if(Buffer.isBuffer(W)&&Buffer.isBuffer(z)){if(!W.equals(z))return!1}else if(W!==z)return!1}}else if(this.options.cert!==X.options.cert)return!1;if(Array.isArray(this.options.key)&&Array.isArray(X.options.key)){if(this.options.key.length!==X.options.key.length)return!1;for(let Y=0;Y<this.options.key.length;Y++){let W=this.options.key[Y],z=X.options.key[Y];if(Buffer.isBuffer(W)&&Buffer.isBuffer(z)){if(!W.equals(z))return!1}else if(W!==z)return!1}}else if(this.options.key!==X.options.key)return!1;if(this.options.requestCert!==X.options.requestCert)return!1;return!0}}class ZA extends EY{constructor(X,Y,W){super({requestCert:Y!==null,rejectUnauthorized:W,ciphers:eN.CIPHER_SUITES});this.identityCertificateProvider=X,this.caCertificateProvider=Y,this.requireClientCertificate=W,this.latestCaUpdate=null,this.latestIdentityUpdate=null,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this)}_addWatcher(X){var Y;if(this.getWatcherCount()===0)(Y=this.caCertificateProvider)===null||Y===void 0||Y.addCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.addIdentityCertificateListener(this.identityCertificateUpdateListener);super._addWatcher(X)}_removeWatcher(X){var Y;if(super._removeWatcher(X),this.getWatcherCount()===0)(Y=this.caCertificateProvider)===null||Y===void 0||Y.removeCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.removeIdentityCertificateListener(this.identityCertificateUpdateListener)}_equals(X){if(this===X)return!0;if(!(X instanceof ZA))return!1;return this.caCertificateProvider===X.caCertificateProvider&&this.identityCertificateProvider===X.identityCertificateProvider&&this.requireClientCertificate===X.requireClientCertificate}calculateSecureContextOptions(){var X;if(this.latestIdentityUpdate===null)return null;if(this.caCertificateProvider!==null&&this.latestCaUpdate===null)return null;return{ca:(X=this.latestCaUpdate)===null||X===void 0?void 0:X.caCertificate,cert:[this.latestIdentityUpdate.certificate],key:[this.latestIdentityUpdate.privateKey]}}finalizeUpdate(){let X=this.calculateSecureContextOptions();this.updateSecureContextOptions(X)}handleCaCertificateUpdate(X){this.latestCaUpdate=X,this.finalizeUpdate()}handleIdentityCertitificateUpdate(X){this.latestIdentityUpdate=X,this.finalizeUpdate()}}function H41(X,Y,W){return new ZA(X,Y,W)}class QA extends EY{constructor(X,Y){super({});this.childCredentials=X,this.interceptors=Y}_isSecure(){return this.childCredentials._isSecure()}_equals(X){if(!(X instanceof QA))return!1;if(!this.childCredentials._equals(X.childCredentials))return!1;if(this.interceptors.length!==X.interceptors.length)return!1;for(let Y=0;Y<this.interceptors.length;Y++)if(this.interceptors[Y]!==X.interceptors[Y])return!1;return!0}_getInterceptors(){return this.interceptors}_addWatcher(X){this.childCredentials._addWatcher(X)}_removeWatcher(X){this.childCredentials._removeWatcher(X)}_getConstructorOptions(){return this.childCredentials._getConstructorOptions()}_getSecureContextOptions(){return this.childCredentials._getSecureContextOptions()}}function V41(X,Y){return new QA(X,Y)}});var bQ=X0((KZ0)=>{Object.defineProperty(KZ0,"__esModule",{value:!0});KZ0.durationMessageToDuration=N41;KZ0.msToDuration=A41;KZ0.durationToMs=O41;KZ0.isDuration=T41;KZ0.isDurationMessage=I41;KZ0.parseDuration=D41;KZ0.durationToString=E41;function N41(X){return{seconds:Number.parseInt(X.seconds),nanos:X.nanos}}function A41(X){return{seconds:X/1000|0,nanos:X%1000*1e6|0}}function O41(X){return X.seconds*1000+X.nanos/1e6|0}function T41(X){return typeof X.seconds==="number"&&typeof X.nanos==="number"}function I41(X){return typeof X.seconds==="string"&&typeof X.nanos==="number"}var $41=/^(\d+)(?:\.(\d+))?s$/;function D41(X){let Y=X.match($41);if(!Y)return null;return{seconds:Number.parseInt(Y[1],10),nanos:Y[2]?Number.parseInt(Y[2].padEnd(9,"0"),10):0}}function E41(X){if(X.nanos===0)return`${X.seconds}s`;let Y;if(X.nanos%1e6===0)Y=1e6;else if(X.nanos%1000===0)Y=1000;else Y=1;return`${X.seconds}.${X.nanos/Y}s`}});var qK=X0((TZ0)=>{var __dirname="/Users/beatrix/dev/clinee/sdk-wip/node_modules/.bun/@grpc+grpc-js@1.14.3/node_modules/@grpc/grpc-js/build/src";Object.defineProperty(TZ0,"__esModule",{value:!0});TZ0.OrcaOobMetricsSubchannelWrapper=TZ0.GRPC_METRICS_HEADER=TZ0.ServerMetricRecorder=TZ0.PerRequestMetricRecorder=void 0;TZ0.createOrcaClient=BZ0;TZ0.createMetricsReader=_41;var f41=TG(),JA=bQ(),y41=ZY(),k41=_Q(),FZ0=a1(),v41=QY(),j41=C9(),zZ0=null;function zK(){if(zZ0)return zZ0;let X=MQ().loadSync,Y=X("xds/service/orca/v3/orca.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto/xds`,`${__dirname}/../../proto/protoc-gen-validate`]});return(0,f41.loadPackageDefinition)(Y)}class HZ0{constructor(){this.message={}}recordRequestCostMetric(X,Y){if(!this.message.request_cost)this.message.request_cost={};this.message.request_cost[X]=Y}recordUtilizationMetric(X,Y){if(!this.message.utilization)this.message.utilization={};this.message.utilization[X]=Y}recordNamedMetric(X,Y){if(!this.message.named_metrics)this.message.named_metrics={};this.message.named_metrics[X]=Y}recordCPUUtilizationMetric(X){this.message.cpu_utilization=X}recordMemoryUtilizationMetric(X){this.message.mem_utilization=X}recordApplicationUtilizationMetric(X){this.message.application_utilization=X}recordQpsMetric(X){this.message.rps_fractional=X}recordEpsMetric(X){this.message.eps=X}serialize(){return zK().xds.data.orca.v3.OrcaLoadReport.serialize(this.message)}}TZ0.PerRequestMetricRecorder=HZ0;var h41=30000;class VZ0{constructor(){this.message={},this.serviceImplementation={StreamCoreMetrics:(X)=>{let Y=X.request.report_interval?(0,JA.durationToMs)((0,JA.durationMessageToDuration)(X.request.report_interval)):h41,W=setInterval(()=>{X.write(this.message)},Y);X.on("cancelled",()=>{clearInterval(W)})}}}putUtilizationMetric(X,Y){if(!this.message.utilization)this.message.utilization={};this.message.utilization[X]=Y}setAllUtilizationMetrics(X){this.message.utilization=Object.assign({},X)}deleteUtilizationMetric(X){var Y;(Y=this.message.utilization)===null||Y===void 0||delete Y[X]}setCpuUtilizationMetric(X){this.message.cpu_utilization=X}deleteCpuUtilizationMetric(){delete this.message.cpu_utilization}setApplicationUtilizationMetric(X){this.message.application_utilization=X}deleteApplicationUtilizationMetric(){delete this.message.application_utilization}setQpsMetric(X){this.message.rps_fractional=X}deleteQpsMetric(){delete this.message.rps_fractional}setEpsMetric(X){this.message.eps=X}deleteEpsMetric(){delete this.message.eps}addToServer(X){let Y=zK().xds.service.orca.v3.OpenRcaService.service;X.addService(Y,this.serviceImplementation)}}TZ0.ServerMetricRecorder=VZ0;function BZ0(X){return new(zK()).xds.service.orca.v3.OpenRcaService("unused",y41.ChannelCredentials.createInsecure(),{channelOverride:X})}TZ0.GRPC_METRICS_HEADER="endpoint-load-metrics-bin";var qZ0="grpc_orca_load_report";function _41(X,Y){return(W,z,F)=>{let Q=F.getOpaque(qZ0);if(Q)X(Q);else{let J=F.get(TZ0.GRPC_METRICS_HEADER);if(J.length>0)Q=zK().xds.data.orca.v3.OrcaLoadReport.deserialize(J[0]),X(Q),F.setOpaque(qZ0,Q)}if(Y)Y(W,z,F)}}var UZ0="orca_oob_metrics";class NZ0{constructor(X,Y){this.metricsListener=X,this.intervalMs=Y,this.dataProducer=null}setSubchannel(X){let Y=X.getOrCreateDataProducer(UZ0,x41);this.dataProducer=Y,Y.addDataWatcher(this)}destroy(){var X;(X=this.dataProducer)===null||X===void 0||X.removeDataWatcher(this)}getInterval(){return this.intervalMs}onMetricsUpdate(X){this.metricsListener(X)}}class AZ0{constructor(X){this.subchannel=X,this.dataWatchers=new Set,this.orcaSupported=!0,this.metricsCall=null,this.currentInterval=1/0,this.backoffTimer=new v41.BackoffTimeout(()=>this.updateMetricsSubscription()),this.subchannelStateListener=()=>this.updateMetricsSubscription();let Y=X.getChannel();this.client=BZ0(Y),X.addConnectivityStateListener(this.subchannelStateListener)}addDataWatcher(X){this.dataWatchers.add(X),this.updateMetricsSubscription()}removeDataWatcher(X){var Y;if(this.dataWatchers.delete(X),this.dataWatchers.size===0)this.subchannel.removeDataProducer(UZ0),(Y=this.metricsCall)===null||Y===void 0||Y.cancel(),this.metricsCall=null,this.client.close(),this.subchannel.removeConnectivityStateListener(this.subchannelStateListener);else this.updateMetricsSubscription()}updateMetricsSubscription(){var X;if(this.dataWatchers.size===0||!this.orcaSupported||this.subchannel.getConnectivityState()!==j41.ConnectivityState.READY)return;let Y=Math.min(...Array.from(this.dataWatchers).map((W)=>W.getInterval()));if(!this.metricsCall||Y!==this.currentInterval){(X=this.metricsCall)===null||X===void 0||X.cancel(),this.currentInterval=Y;let W=this.client.streamCoreMetrics({report_interval:(0,JA.msToDuration)(Y)});this.metricsCall=W,W.on("data",(z)=>{this.dataWatchers.forEach((F)=>{F.onMetricsUpdate(z)})}),W.on("error",(z)=>{if(this.metricsCall=null,z.code===FZ0.Status.UNIMPLEMENTED){this.orcaSupported=!1;return}if(z.code===FZ0.Status.CANCELLED)return;this.backoffTimer.runOnce()})}}}class OZ0 extends k41.BaseSubchannelWrapper{constructor(X,Y,W){super(X);this.addDataWatcher(new NZ0(Y,W))}getWrappedSubchannel(){return this.child}}TZ0.OrcaOobMetricsSubchannelWrapper=OZ0;function x41(X){return new AZ0(X)}});var FA=X0((jZ0)=>{Object.defineProperty(jZ0,"__esModule",{value:!0});jZ0.BaseServerInterceptingCall=jZ0.ServerInterceptingCall=jZ0.ResponderBuilder=jZ0.ServerListenerBuilder=void 0;jZ0.isInterceptingServerListener=l41;jZ0.getServerInterceptingCall=r41;var BK=s6(),k9=a1(),CY=F1("http2"),DZ0=ZG(),EZ0=F1("zlib"),d41=mN(),PZ0=A6(),c41=F1("tls"),CZ0=qK(),wZ0="server_call";function p7(X){PZ0.trace(k9.LogVerbosity.DEBUG,wZ0,X)}class SZ0{constructor(){this.metadata=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withOnReceiveMetadata(X){return this.metadata=X,this}withOnReceiveMessage(X){return this.message=X,this}withOnReceiveHalfClose(X){return this.halfClose=X,this}withOnCancel(X){return this.cancel=X,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveHalfClose:this.halfClose,onCancel:this.cancel}}}jZ0.ServerListenerBuilder=SZ0;function l41(X){return X.onReceiveMetadata!==void 0&&X.onReceiveMetadata.length===1}class fZ0{constructor(X,Y){this.listener=X,this.nextListener=Y,this.cancelled=!1,this.processingMetadata=!1,this.hasPendingMessage=!1,this.pendingMessage=null,this.processingMessage=!1,this.hasPendingHalfClose=!1}processPendingMessage(){if(this.hasPendingMessage)this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1}processPendingHalfClose(){if(this.hasPendingHalfClose)this.nextListener.onReceiveHalfClose(),this.hasPendingHalfClose=!1}onReceiveMetadata(X){if(this.cancelled)return;this.processingMetadata=!0,this.listener.onReceiveMetadata(X,(Y)=>{if(this.processingMetadata=!1,this.cancelled)return;this.nextListener.onReceiveMetadata(Y),this.processPendingMessage(),this.processPendingHalfClose()})}onReceiveMessage(X){if(this.cancelled)return;this.processingMessage=!0,this.listener.onReceiveMessage(X,(Y)=>{if(this.processingMessage=!1,this.cancelled)return;if(this.processingMetadata)this.pendingMessage=Y,this.hasPendingMessage=!0;else this.nextListener.onReceiveMessage(Y),this.processPendingHalfClose()})}onReceiveHalfClose(){if(this.cancelled)return;this.listener.onReceiveHalfClose(()=>{if(this.cancelled)return;if(this.processingMetadata||this.processingMessage)this.hasPendingHalfClose=!0;else this.nextListener.onReceiveHalfClose()})}onCancel(){this.cancelled=!0,this.listener.onCancel(),this.nextListener.onCancel()}}class yZ0{constructor(){this.start=void 0,this.metadata=void 0,this.message=void 0,this.status=void 0}withStart(X){return this.start=X,this}withSendMetadata(X){return this.metadata=X,this}withSendMessage(X){return this.message=X,this}withSendStatus(X){return this.status=X,this}build(){return{start:this.start,sendMetadata:this.metadata,sendMessage:this.message,sendStatus:this.status}}}jZ0.ResponderBuilder=yZ0;var HK={onReceiveMetadata:(X,Y)=>{Y(X)},onReceiveMessage:(X,Y)=>{Y(X)},onReceiveHalfClose:(X)=>{X()},onCancel:()=>{}},VK={start:(X)=>{X()},sendMetadata:(X,Y)=>{Y(X)},sendMessage:(X,Y)=>{Y(X)},sendStatus:(X,Y)=>{Y(X)}};class kZ0{constructor(X,Y){var W,z,F,Q;this.nextCall=X,this.processingMetadata=!1,this.sentMetadata=!1,this.processingMessage=!1,this.pendingMessage=null,this.pendingMessageCallback=null,this.pendingStatus=null,this.responder={start:(W=Y===null||Y===void 0?void 0:Y.start)!==null&&W!==void 0?W:VK.start,sendMetadata:(z=Y===null||Y===void 0?void 0:Y.sendMetadata)!==null&&z!==void 0?z:VK.sendMetadata,sendMessage:(F=Y===null||Y===void 0?void 0:Y.sendMessage)!==null&&F!==void 0?F:VK.sendMessage,sendStatus:(Q=Y===null||Y===void 0?void 0:Y.sendStatus)!==null&&Q!==void 0?Q:VK.sendStatus}}processPendingMessage(){if(this.pendingMessageCallback)this.nextCall.sendMessage(this.pendingMessage,this.pendingMessageCallback),this.pendingMessage=null,this.pendingMessageCallback=null}processPendingStatus(){if(this.pendingStatus)this.nextCall.sendStatus(this.pendingStatus),this.pendingStatus=null}start(X){this.responder.start((Y)=>{var W,z,F,Q;let J={onReceiveMetadata:(W=Y===null||Y===void 0?void 0:Y.onReceiveMetadata)!==null&&W!==void 0?W:HK.onReceiveMetadata,onReceiveMessage:(z=Y===null||Y===void 0?void 0:Y.onReceiveMessage)!==null&&z!==void 0?z:HK.onReceiveMessage,onReceiveHalfClose:(F=Y===null||Y===void 0?void 0:Y.onReceiveHalfClose)!==null&&F!==void 0?F:HK.onReceiveHalfClose,onCancel:(Q=Y===null||Y===void 0?void 0:Y.onCancel)!==null&&Q!==void 0?Q:HK.onCancel},Z=new fZ0(J,X);this.nextCall.start(Z)})}sendMetadata(X){this.processingMetadata=!0,this.sentMetadata=!0,this.responder.sendMetadata(X,(Y)=>{this.processingMetadata=!1,this.nextCall.sendMetadata(Y),this.processPendingMessage(),this.processPendingStatus()})}sendMessage(X,Y){if(this.processingMessage=!0,!this.sentMetadata)this.sendMetadata(new BK.Metadata);this.responder.sendMessage(X,(W)=>{if(this.processingMessage=!1,this.processingMetadata)this.pendingMessage=W,this.pendingMessageCallback=Y;else this.nextCall.sendMessage(W,Y)})}sendStatus(X){this.responder.sendStatus(X,(Y)=>{if(this.processingMetadata||this.processingMessage)this.pendingStatus=Y;else this.nextCall.sendStatus(Y)})}startRead(){this.nextCall.startRead()}getPeer(){return this.nextCall.getPeer()}getDeadline(){return this.nextCall.getDeadline()}getHost(){return this.nextCall.getHost()}getAuthContext(){return this.nextCall.getAuthContext()}getConnectionInfo(){return this.nextCall.getConnectionInfo()}getMetricsRecorder(){return this.nextCall.getMetricsRecorder()}}jZ0.ServerInterceptingCall=kZ0;var vZ0="grpc-accept-encoding",GA="grpc-encoding",RZ0="grpc-message",MZ0="grpc-status",WA="grpc-timeout",p41=/(\d{1,8})\s*([HMSmun])/,n41={H:3600000,M:60000,S:1000,m:1,u:0.001,n:0.000001},i41={[vZ0]:"identity,deflate,gzip",[GA]:"identity"},LZ0={[CY.constants.HTTP2_HEADER_STATUS]:CY.constants.HTTP_STATUS_OK,[CY.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},a41={waitForTrailers:!0};class KA{constructor(X,Y,W,z,F){var Q,J;if(this.stream=X,this.callEventTracker=W,this.handler=z,this.listener=null,this.deadlineTimer=null,this.deadline=1/0,this.maxSendMessageSize=k9.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=k9.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.cancelled=!1,this.metadataSent=!1,this.wantTrailers=!1,this.cancelNotified=!1,this.incomingEncoding="identity",this.readQueue=[],this.isReadPending=!1,this.receivedHalfClose=!1,this.streamEnded=!1,this.metricsRecorder=new CZ0.PerRequestMetricRecorder,this.stream.once("error",(q)=>{}),this.stream.once("close",()=>{var q;if(p7("Request to method "+((q=this.handler)===null||q===void 0?void 0:q.path)+" stream closed with rstCode "+this.stream.rstCode),this.callEventTracker&&!this.streamEnded)this.streamEnded=!0,this.callEventTracker.onStreamEnd(!1),this.callEventTracker.onCallEnd({code:k9.Status.CANCELLED,details:"Stream closed before sending status",metadata:null});this.notifyOnCancel()}),this.stream.on("data",(q)=>{this.handleDataFrame(q)}),this.stream.pause(),this.stream.on("end",()=>{this.handleEndEvent()}),"grpc.max_send_message_length"in F)this.maxSendMessageSize=F["grpc.max_send_message_length"];if("grpc.max_receive_message_length"in F)this.maxReceiveMessageSize=F["grpc.max_receive_message_length"];this.host=(Q=Y[":authority"])!==null&&Q!==void 0?Q:Y.host,this.decoder=new d41.StreamDecoder(this.maxReceiveMessageSize);let Z=BK.Metadata.fromHttp2Headers(Y);if(PZ0.isTracerEnabled(wZ0))p7("Request to "+this.handler.path+" received headers "+JSON.stringify(Z.toJSON()));let K=Z.get(WA);if(K.length>0)this.handleTimeoutHeader(K[0]);let H=Z.get(GA);if(H.length>0)this.incomingEncoding=H[0];Z.remove(WA),Z.remove(GA),Z.remove(vZ0),Z.remove(CY.constants.HTTP2_HEADER_ACCEPT_ENCODING),Z.remove(CY.constants.HTTP2_HEADER_TE),Z.remove(CY.constants.HTTP2_HEADER_CONTENT_TYPE),this.metadata=Z;let G=(J=X.session)===null||J===void 0?void 0:J.socket;this.connectionInfo={localAddress:G===null||G===void 0?void 0:G.localAddress,localPort:G===null||G===void 0?void 0:G.localPort,remoteAddress:G===null||G===void 0?void 0:G.remoteAddress,remotePort:G===null||G===void 0?void 0:G.remotePort},this.shouldSendMetrics=!!F["grpc.server_call_metric_recording"]}handleTimeoutHeader(X){let Y=X.toString().match(p41);if(Y===null){let F={code:k9.Status.INTERNAL,details:`Invalid ${WA} value "${X}"`,metadata:null};process.nextTick(()=>{this.sendStatus(F)});return}let W=+Y[1]*n41[Y[2]]|0,z=new Date;this.deadline=z.setMilliseconds(z.getMilliseconds()+W),this.deadlineTimer=setTimeout(()=>{let F={code:k9.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(F)},W)}checkCancelled(){if(!this.cancelled&&(this.stream.destroyed||this.stream.closed))this.notifyOnCancel(),this.cancelled=!0;return this.cancelled}notifyOnCancel(){if(this.cancelNotified)return;if(this.cancelNotified=!0,this.cancelled=!0,process.nextTick(()=>{var X;(X=this.listener)===null||X===void 0||X.onCancel()}),this.deadlineTimer)clearTimeout(this.deadlineTimer);this.stream.resume()}maybeSendMetadata(){if(!this.metadataSent)this.sendMetadata(new BK.Metadata)}serializeMessage(X){let Y=this.handler.serialize(X),W=Y.byteLength,z=Buffer.allocUnsafe(W+5);return z.writeUInt8(0,0),z.writeUInt32BE(W,1),Y.copy(z,5),z}decompressMessage(X,Y){let W=X.subarray(5);if(Y==="identity")return W;else if(Y==="deflate"||Y==="gzip"){let z;if(Y==="deflate")z=EZ0.createInflate();else z=EZ0.createGunzip();return new Promise((F,Q)=>{let J=0,Z=[];z.on("data",(K)=>{if(Z.push(K),J+=K.byteLength,this.maxReceiveMessageSize!==-1&&J>this.maxReceiveMessageSize)z.destroy(),Q({code:k9.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`})}),z.on("end",()=>{F(Buffer.concat(Z))}),z.write(W),z.end()})}else return Promise.reject({code:k9.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${Y}"`})}async decompressAndMaybePush(X){if(X.type!=="COMPRESSED")throw Error(`Invalid queue entry type: ${X.type}`);let W=X.compressedMessage.readUInt8(0)===1?this.incomingEncoding:"identity",z;try{z=await this.decompressMessage(X.compressedMessage,W)}catch(F){this.sendStatus(F);return}try{X.parsedMessage=this.handler.deserialize(z)}catch(F){this.sendStatus({code:k9.Status.INTERNAL,details:`Error deserializing request: ${F.message}`});return}X.type="READABLE",this.maybePushNextMessage()}maybePushNextMessage(){if(this.listener&&this.isReadPending&&this.readQueue.length>0&&this.readQueue[0].type!=="COMPRESSED"){this.isReadPending=!1;let X=this.readQueue.shift();if(X.type==="READABLE")this.listener.onReceiveMessage(X.parsedMessage);else this.listener.onReceiveHalfClose()}}handleDataFrame(X){var Y;if(this.checkCancelled())return;p7("Request to "+this.handler.path+" received data frame of size "+X.length);let W;try{W=this.decoder.write(X)}catch(z){this.sendStatus({code:k9.Status.RESOURCE_EXHAUSTED,details:z.message});return}for(let z of W){this.stream.pause();let F={type:"COMPRESSED",compressedMessage:z,parsedMessage:null};this.readQueue.push(F),this.decompressAndMaybePush(F),(Y=this.callEventTracker)===null||Y===void 0||Y.addMessageReceived()}}handleEndEvent(){this.readQueue.push({type:"HALF_CLOSE",compressedMessage:null,parsedMessage:null}),this.receivedHalfClose=!0,this.maybePushNextMessage()}start(X){if(p7("Request to "+this.handler.path+" start called"),this.checkCancelled())return;this.listener=X,X.onReceiveMetadata(this.metadata)}sendMetadata(X){if(this.checkCancelled())return;if(this.metadataSent)return;this.metadataSent=!0;let Y=X?X.toHttp2Headers():null,W=Object.assign(Object.assign(Object.assign({},LZ0),i41),Y);this.stream.respond(W,a41)}sendMessage(X,Y){if(this.checkCancelled())return;let W;try{W=this.serializeMessage(X)}catch(z){this.sendStatus({code:k9.Status.INTERNAL,details:`Error serializing response: ${(0,DZ0.getErrorMessage)(z)}`,metadata:null});return}if(this.maxSendMessageSize!==-1&&W.length-5>this.maxSendMessageSize){this.sendStatus({code:k9.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${W.length} vs. ${this.maxSendMessageSize})`,metadata:null});return}this.maybeSendMetadata(),p7("Request to "+this.handler.path+" sent data frame of size "+W.length),this.stream.write(W,(z)=>{var F;if(z){this.sendStatus({code:k9.Status.INTERNAL,details:`Error writing message: ${(0,DZ0.getErrorMessage)(z)}`,metadata:null});return}(F=this.callEventTracker)===null||F===void 0||F.addMessageSent(),Y()})}sendStatus(X){var Y,W,z;if(this.checkCancelled())return;p7("Request to method "+((Y=this.handler)===null||Y===void 0?void 0:Y.path)+" ended with status code: "+k9.Status[X.code]+" details: "+X.details);let F=(z=(W=X.metadata)===null||W===void 0?void 0:W.clone())!==null&&z!==void 0?z:new BK.Metadata;if(this.shouldSendMetrics)F.set(CZ0.GRPC_METRICS_HEADER,this.metricsRecorder.serialize());if(this.metadataSent)if(!this.wantTrailers)this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{if(this.callEventTracker&&!this.streamEnded)this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(X);let Q=Object.assign({[MZ0]:X.code,[RZ0]:encodeURI(X.details)},F.toHttp2Headers());this.stream.sendTrailers(Q),this.notifyOnCancel()}),this.stream.end();else this.notifyOnCancel();else{if(this.callEventTracker&&!this.streamEnded)this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(X);let Q=Object.assign(Object.assign({[MZ0]:X.code,[RZ0]:encodeURI(X.details)},LZ0),F.toHttp2Headers());this.stream.respond(Q,{endStream:!0}),this.notifyOnCancel()}}startRead(){if(p7("Request to "+this.handler.path+" startRead called"),this.checkCancelled())return;if(this.isReadPending=!0,this.readQueue.length===0){if(!this.receivedHalfClose)this.stream.resume()}else this.maybePushNextMessage()}getPeer(){var X;let Y=(X=this.stream.session)===null||X===void 0?void 0:X.socket;if(Y===null||Y===void 0?void 0:Y.remoteAddress)if(Y.remotePort)return`${Y.remoteAddress}:${Y.remotePort}`;else return Y.remoteAddress;else return"unknown"}getDeadline(){return this.deadline}getHost(){return this.host}getAuthContext(){var X;if(((X=this.stream.session)===null||X===void 0?void 0:X.socket)instanceof c41.TLSSocket){let Y=this.stream.session.socket.getPeerCertificate();return{transportSecurityType:"ssl",sslPeerCertificate:Y.raw?Y:void 0}}else return{}}getConnectionInfo(){return this.connectionInfo}getMetricsRecorder(){return this.metricsRecorder}}jZ0.BaseServerInterceptingCall=KA;function r41(X,Y,W,z,F,Q){let J={path:F.path,requestStream:F.type==="clientStream"||F.type==="bidi",responseStream:F.type==="serverStream"||F.type==="bidi",requestDeserialize:F.deserialize,responseSerialize:F.serialize},Z=new KA(Y,W,z,F,Q);return X.reduce((K,H)=>{return H(J,K)},Z)}});var dZ0=X0((v5)=>{var Y51=v5&&v5.__runInitializers||function(X,Y,W){var z=arguments.length>2;for(var F=0;F<Y.length;F++)W=z?Y[F].call(X,W):Y[F].call(X);return z?W:void 0},Z51=v5&&v5.__esDecorate||function(X,Y,W,z,F,Q){function J(A){if(A!==void 0&&typeof A!=="function")throw TypeError("Function expected");return A}var Z=z.kind,K=Z==="getter"?"get":Z==="setter"?"set":"value",H=!Y&&X?z.static?X:X.prototype:null,G=Y||(H?Object.getOwnPropertyDescriptor(H,z.name):{}),q,B=!1;for(var $=W.length-1;$>=0;$--){var R={};for(var E in z)R[E]=E==="access"?{}:z[E];for(var E in z.access)R.access[E]=z.access[E];R.addInitializer=function(A){if(B)throw TypeError("Cannot add initializers after decoration has completed");Q.push(J(A||null))};var U=(0,W[$])(Z==="accessor"?{get:G.get,set:G.set}:G[K],R);if(Z==="accessor"){if(U===void 0)continue;if(U===null||typeof U!=="object")throw TypeError("Object expected");if(q=J(U.get))G.get=q;if(q=J(U.set))G.set=q;if(q=J(U.init))F.unshift(q)}else if(q=J(U))if(Z==="field")F.unshift(q);else G[K]=q}if(H)Object.defineProperty(H,z.name,G);B=!0};Object.defineProperty(v5,"__esModule",{value:!0});v5.Server=void 0;var v9=F1("http2"),Q51=F1("util"),_6=a1(),LY=JZ0(),zA=FK(),_Z0=y8(),MY=A6(),k5=y9(),x8=E9(),n6=S5(),xZ0=FA(),RY=2147483647,qA=2147483647,J51=20000,bZ0=2147483647,{HTTP2_HEADER_PATH:uZ0}=v9.constants,W51="server",mZ0=Buffer.from("max_age");function gZ0(X){MY.trace(_6.LogVerbosity.DEBUG,"server_call",X)}function G51(){}function K51(X){return function(Y,W){return Q51.deprecate(Y,X)}}function HA(X){return{code:_6.Status.UNIMPLEMENTED,details:`The server does not implement the method ${X}`}}function F51(X,Y){let W=HA(Y);switch(X){case"unary":return(z,F)=>{F(W,null)};case"clientStream":return(z,F)=>{F(W,null)};case"serverStream":return(z)=>{z.emit("error",W)};case"bidi":return(z)=>{z.emit("error",W)};default:throw Error(`Invalid handlerType ${X}`)}}var z51=(()=>{var X;let Y=[],W;return X=class{constructor(F){var Q,J,Z,K,H,G;if(this.boundPorts=(Y51(this,Y),new Map),this.http2Servers=new Map,this.sessionIdleTimeouts=new Map,this.handlers=new Map,this.sessions=new Map,this.started=!1,this.shutdown=!1,this.serverAddressString="null",this.channelzEnabled=!0,this.options=F!==null&&F!==void 0?F:{},this.options["grpc.enable_channelz"]===0)this.channelzEnabled=!1,this.channelzTrace=new n6.ChannelzTraceStub,this.callTracker=new n6.ChannelzCallTrackerStub,this.listenerChildrenTracker=new n6.ChannelzChildrenTrackerStub,this.sessionChildrenTracker=new n6.ChannelzChildrenTrackerStub;else this.channelzTrace=new n6.ChannelzTrace,this.callTracker=new n6.ChannelzCallTracker,this.listenerChildrenTracker=new n6.ChannelzChildrenTracker,this.sessionChildrenTracker=new n6.ChannelzChildrenTracker;if(this.channelzRef=(0,n6.registerChannelzServer)("server",()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=(Q=this.options["grpc.max_connection_age_ms"])!==null&&Q!==void 0?Q:RY,this.maxConnectionAgeGraceMs=(J=this.options["grpc.max_connection_age_grace_ms"])!==null&&J!==void 0?J:RY,this.keepaliveTimeMs=(Z=this.options["grpc.keepalive_time_ms"])!==null&&Z!==void 0?Z:qA,this.keepaliveTimeoutMs=(K=this.options["grpc.keepalive_timeout_ms"])!==null&&K!==void 0?K:J51,this.sessionIdleTimeout=(H=this.options["grpc.max_connection_idle_ms"])!==null&&H!==void 0?H:bZ0,this.commonServerOptions={maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER},"grpc-node.max_session_memory"in this.options)this.commonServerOptions.maxSessionMemory=this.options["grpc-node.max_session_memory"];else this.commonServerOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER;if("grpc.max_concurrent_streams"in this.options)this.commonServerOptions.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]};this.interceptors=(G=this.options.interceptors)!==null&&G!==void 0?G:[],this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfo(F){var Q,J,Z;let K=this.sessions.get(F),H=F.socket,G=H.remoteAddress?(0,k5.stringToSubchannelAddress)(H.remoteAddress,H.remotePort):null,q=H.localAddress?(0,k5.stringToSubchannelAddress)(H.localAddress,H.localPort):null,B;if(F.encrypted){let R=H,E=R.getCipher(),U=R.getCertificate(),A=R.getPeerCertificate();B={cipherSuiteStandardName:(Q=E.standardName)!==null&&Q!==void 0?Q:null,cipherSuiteOtherName:E.standardName?null:E.name,localCertificate:U&&"raw"in U?U.raw:null,remoteCertificate:A&&"raw"in A?A.raw:null}}else B=null;return{remoteAddress:G,localAddress:q,security:B,remoteName:null,streamsStarted:K.streamTracker.callsStarted,streamsSucceeded:K.streamTracker.callsSucceeded,streamsFailed:K.streamTracker.callsFailed,messagesSent:K.messagesSent,messagesReceived:K.messagesReceived,keepAlivesSent:K.keepAlivesSent,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:K.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:K.lastMessageSentTimestamp,lastMessageReceivedTimestamp:K.lastMessageReceivedTimestamp,localFlowControlWindow:(J=F.state.localWindowSize)!==null&&J!==void 0?J:null,remoteFlowControlWindow:(Z=F.state.remoteWindowSize)!==null&&Z!==void 0?Z:null}}trace(F){MY.trace(_6.LogVerbosity.DEBUG,W51,"("+this.channelzRef.id+") "+F)}keepaliveTrace(F){MY.trace(_6.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+F)}addProtoService(){throw Error("Not implemented. Use addService() instead")}addService(F,Q){if(F===null||typeof F!=="object"||Q===null||typeof Q!=="object")throw Error("addService() requires two objects as arguments");let J=Object.keys(F);if(J.length===0)throw Error("Cannot add an empty service to a server");J.forEach((Z)=>{let K=F[Z],H;if(K.requestStream)if(K.responseStream)H="bidi";else H="clientStream";else if(K.responseStream)H="serverStream";else H="unary";let G=Q[Z],q;if(G===void 0&&typeof K.originalName==="string")G=Q[K.originalName];if(G!==void 0)q=G.bind(Q);else q=F51(H,Z);if(this.register(K.path,q,K.responseSerialize,K.requestDeserialize,H)===!1)throw Error(`Method handler for ${K.path} already provided.`)})}removeService(F){if(F===null||typeof F!=="object")throw Error("removeService() requires object as argument");Object.keys(F).forEach((J)=>{let Z=F[J];this.unregister(Z.path)})}bind(F,Q){throw Error("Not implemented. Use bindAsync() instead")}experimentalRegisterListenerToChannelz(F){return(0,n6.registerChannelzSocket)((0,k5.subchannelAddressToString)(F),()=>{return{localAddress:F,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}},this.channelzEnabled)}experimentalUnregisterListenerFromChannelz(F){(0,n6.unregisterChannelzRef)(F)}createHttp2Server(F){let Q;if(F._isSecure()){let J=F._getConstructorOptions(),Z=F._getSecureContextOptions(),K=Object.assign(Object.assign(Object.assign(Object.assign({},this.commonServerOptions),J),Z),{enableTrace:this.options["grpc-node.tls_enable_trace"]===1}),H=Z!==null;this.trace("Initial credentials valid: "+H),Q=v9.createSecureServer(K),Q.prependListener("connection",(q)=>{if(!H)this.trace("Dropped connection from "+JSON.stringify(q.address())+" due to unloaded credentials"),q.destroy()}),Q.on("secureConnection",(q)=>{q.on("error",(B)=>{this.trace("An incoming TLS connection closed with error: "+B.message)})});let G=(q)=>{if(q){let B=Q;try{B.setSecureContext(q)}catch($){MY.log(_6.LogVerbosity.ERROR,"Failed to set secure context with error "+$.message),q=null}}H=q!==null,this.trace("Post-update credentials valid: "+H)};F._addWatcher(G),Q.on("close",()=>{F._removeWatcher(G)})}else Q=v9.createServer(this.commonServerOptions);return Q.setTimeout(0,G51),this._setupHandlers(Q,F._getInterceptors()),Q}bindOneAddress(F,Q){this.trace("Attempting to bind "+(0,k5.subchannelAddressToString)(F));let J=this.createHttp2Server(Q.credentials);return new Promise((Z,K)=>{let H=(G)=>{this.trace("Failed to bind "+(0,k5.subchannelAddressToString)(F)+" with error "+G.message),Z({port:"port"in F?F.port:1,error:G.message})};J.once("error",H),J.listen(F,()=>{let G=J.address(),q;if(typeof G==="string")q={path:G};else q={host:G.address,port:G.port};let B=this.experimentalRegisterListenerToChannelz(q);this.listenerChildrenTracker.refChild(B),this.http2Servers.set(J,{channelzRef:B,sessions:new Set,ownsChannelzRef:!0}),Q.listeningServers.add(J),this.trace("Successfully bound "+(0,k5.subchannelAddressToString)(q)),Z({port:"port"in q?q.port:1}),J.removeListener("error",H)})})}async bindManyPorts(F,Q){if(F.length===0)return{count:0,port:0,errors:[]};if((0,k5.isTcpSubchannelAddress)(F[0])&&F[0].port===0){let J=await this.bindOneAddress(F[0],Q);if(J.error){let Z=await this.bindManyPorts(F.slice(1),Q);return Object.assign(Object.assign({},Z),{errors:[J.error,...Z.errors]})}else{let Z=F.slice(1).map((G)=>(0,k5.isTcpSubchannelAddress)(G)?{host:G.host,port:J.port}:G),K=await Promise.all(Z.map((G)=>this.bindOneAddress(G,Q))),H=[J,...K];return{count:H.filter((G)=>G.error===void 0).length,port:J.port,errors:H.filter((G)=>G.error).map((G)=>G.error)}}}else{let J=await Promise.all(F.map((Z)=>this.bindOneAddress(Z,Q)));return{count:J.filter((Z)=>Z.error===void 0).length,port:J[0].port,errors:J.filter((Z)=>Z.error).map((Z)=>Z.error)}}}async bindAddressList(F,Q){let J=await this.bindManyPorts(F,Q);if(J.count>0){if(J.count<F.length)MY.log(_6.LogVerbosity.INFO,`WARNING Only ${J.count} addresses added out of total ${F.length} resolved`);return J.port}else{let Z=`No address added out of total ${F.length} resolved`;throw MY.log(_6.LogVerbosity.ERROR,Z),Error(`${Z} errors: [${J.errors.join(",")}]`)}}resolvePort(F){return new Promise((Q,J)=>{let Z=!1,K=(G,q,B,$)=>{if(Z)return!0;if(Z=!0,!G.ok)return J(Error(G.error.details)),!0;let R=[].concat(...G.value.map((E)=>E.addresses));if(R.length===0)return J(Error(`No addresses resolved for port ${F}`)),!0;return Q(R),!0};(0,_Z0.createResolver)(F,K,this.options).updateResolution()})}async bindPort(F,Q){let J=await this.resolvePort(F);if(Q.cancelled)throw this.completeUnbind(Q),Error("bindAsync operation cancelled by unbind call");let Z=await this.bindAddressList(J,Q);if(Q.cancelled)throw this.completeUnbind(Q),Error("bindAsync operation cancelled by unbind call");return Z}normalizePort(F){let Q=(0,x8.parseUri)(F);if(Q===null)throw Error(`Could not parse port "${F}"`);let J=(0,_Z0.mapUriDefaultScheme)(Q);if(J===null)throw Error(`Could not get a default scheme for port "${F}"`);return J}bindAsync(F,Q,J){if(this.shutdown)throw Error("bindAsync called after shutdown");if(typeof F!=="string")throw TypeError("port must be a string");if(Q===null||!(Q instanceof zA.ServerCredentials))throw TypeError("creds must be a ServerCredentials object");if(typeof J!=="function")throw TypeError("callback must be a function");this.trace("bindAsync port="+F);let Z=this.normalizePort(F),K=(B,$)=>{process.nextTick(()=>J(B,$))},H=this.boundPorts.get((0,x8.uriToString)(Z));if(H){if(!Q._equals(H.credentials)){K(Error(`${F} already bound with incompatible credentials`),0);return}if(H.cancelled=!1,H.completionPromise)H.completionPromise.then((B)=>J(null,B),(B)=>J(B,0));else K(null,H.portNumber);return}H={mapKey:(0,x8.uriToString)(Z),originalUri:Z,completionPromise:null,cancelled:!1,portNumber:0,credentials:Q,listeningServers:new Set};let G=(0,x8.splitHostPort)(Z.path),q=this.bindPort(Z,H);if(H.completionPromise=q,(G===null||G===void 0?void 0:G.port)===0)q.then((B)=>{let $={scheme:Z.scheme,authority:Z.authority,path:(0,x8.combineHostPort)({host:G.host,port:B})};H.mapKey=(0,x8.uriToString)($),H.completionPromise=null,H.portNumber=B,this.boundPorts.set(H.mapKey,H),J(null,B)},(B)=>{J(B,0)});else this.boundPorts.set(H.mapKey,H),q.then((B)=>{H.completionPromise=null,H.portNumber=B,J(null,B)},(B)=>{J(B,0)})}registerInjectorToChannelz(){return(0,n6.registerChannelzSocket)("injector",()=>{return{localAddress:null,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}},this.channelzEnabled)}experimentalCreateConnectionInjectorWithChannelzRef(F,Q,J=!1){if(F===null||!(F instanceof zA.ServerCredentials))throw TypeError("creds must be a ServerCredentials object");if(this.channelzEnabled)this.listenerChildrenTracker.refChild(Q);let Z=this.createHttp2Server(F),K=new Set;return this.http2Servers.set(Z,{channelzRef:Q,sessions:K,ownsChannelzRef:J}),{injectConnection:(H)=>{Z.emit("connection",H)},drain:(H)=>{var G,q;for(let B of K)this.closeSession(B);(q=(G=setTimeout(()=>{for(let B of K)B.destroy(v9.constants.NGHTTP2_CANCEL)},H)).unref)===null||q===void 0||q.call(G)},destroy:()=>{this.closeServer(Z);for(let H of K)this.closeSession(H)}}}createConnectionInjector(F){if(F===null||!(F instanceof zA.ServerCredentials))throw TypeError("creds must be a ServerCredentials object");let Q=this.registerInjectorToChannelz();return this.experimentalCreateConnectionInjectorWithChannelzRef(F,Q,!0)}closeServer(F,Q){this.trace("Closing server with address "+JSON.stringify(F.address()));let J=this.http2Servers.get(F);F.close(()=>{if(J&&J.ownsChannelzRef)this.listenerChildrenTracker.unrefChild(J.channelzRef),(0,n6.unregisterChannelzRef)(J.channelzRef);this.http2Servers.delete(F),Q===null||Q===void 0||Q()})}closeSession(F,Q){var J;this.trace("Closing session initiated by "+((J=F.socket)===null||J===void 0?void 0:J.remoteAddress));let Z=this.sessions.get(F),K=()=>{if(Z)this.sessionChildrenTracker.unrefChild(Z.ref),(0,n6.unregisterChannelzRef)(Z.ref);Q===null||Q===void 0||Q()};if(F.closed)queueMicrotask(K);else F.close(K)}completeUnbind(F){for(let Q of F.listeningServers){let J=this.http2Servers.get(Q);if(this.closeServer(Q,()=>{F.listeningServers.delete(Q)}),J)for(let Z of J.sessions)this.closeSession(Z)}this.boundPorts.delete(F.mapKey)}unbind(F){this.trace("unbind port="+F);let Q=this.normalizePort(F),J=(0,x8.splitHostPort)(Q.path);if((J===null||J===void 0?void 0:J.port)===0)throw Error("Cannot unbind port 0");let Z=this.boundPorts.get((0,x8.uriToString)(Q));if(Z)if(this.trace("unbinding "+Z.mapKey+" originally bound as "+(0,x8.uriToString)(Z.originalUri)),Z.completionPromise)Z.cancelled=!0;else this.completeUnbind(Z)}drain(F,Q){var J,Z;this.trace("drain port="+F+" graceTimeMs="+Q);let K=this.normalizePort(F),H=(0,x8.splitHostPort)(K.path);if((H===null||H===void 0?void 0:H.port)===0)throw Error("Cannot drain port 0");let G=this.boundPorts.get((0,x8.uriToString)(K));if(!G)return;let q=new Set;for(let B of G.listeningServers){let $=this.http2Servers.get(B);if($)for(let R of $.sessions)q.add(R),this.closeSession(R,()=>{q.delete(R)})}(Z=(J=setTimeout(()=>{for(let B of q)B.destroy(v9.constants.NGHTTP2_CANCEL)},Q)).unref)===null||Z===void 0||Z.call(J)}forceShutdown(){for(let F of this.boundPorts.values())F.cancelled=!0;this.boundPorts.clear();for(let F of this.http2Servers.keys())this.closeServer(F);this.sessions.forEach((F,Q)=>{this.closeSession(Q),Q.destroy(v9.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),(0,n6.unregisterChannelzRef)(this.channelzRef),this.shutdown=!0}register(F,Q,J,Z,K){if(this.handlers.has(F))return!1;return this.handlers.set(F,{func:Q,serialize:J,deserialize:Z,type:K,path:F}),!0}unregister(F){return this.handlers.delete(F)}start(){if(this.http2Servers.size===0||[...this.http2Servers.keys()].every((F)=>!F.listening))throw Error("server must be bound in order to start");if(this.started===!0)throw Error("server is already started");this.started=!0}tryShutdown(F){var Q;let J=(H)=>{(0,n6.unregisterChannelzRef)(this.channelzRef),F(H)},Z=0;function K(){if(Z--,Z===0)J()}this.shutdown=!0;for(let[H,G]of this.http2Servers.entries()){Z++;let q=G.channelzRef.name;this.trace("Waiting for server "+q+" to close"),this.closeServer(H,()=>{this.trace("Server "+q+" finished closing"),K()});for(let B of G.sessions.keys()){Z++;let $=(Q=B.socket)===null||Q===void 0?void 0:Q.remoteAddress;this.trace("Waiting for session "+$+" to close"),this.closeSession(B,()=>{this.trace("Session "+$+" finished closing"),K()})}}if(Z===0)J()}addHttp2Port(){throw Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(F,Q){let J=Q[v9.constants.HTTP2_HEADER_CONTENT_TYPE];if(typeof J!=="string"||!J.startsWith("application/grpc"))return F.respond({[v9.constants.HTTP2_HEADER_STATUS]:v9.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1;return!0}_retrieveHandler(F){gZ0("Received call to method "+F+" at address "+this.serverAddressString);let Q=this.handlers.get(F);if(Q===void 0)return gZ0("No handler registered for method "+F+". Sending UNIMPLEMENTED status."),null;return Q}_respondWithError(F,Q,J=null){var Z,K;let H=Object.assign({"grpc-status":(Z=F.code)!==null&&Z!==void 0?Z:_6.Status.INTERNAL,"grpc-message":F.details,[v9.constants.HTTP2_HEADER_STATUS]:v9.constants.HTTP_STATUS_OK,[v9.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},(K=F.metadata)===null||K===void 0?void 0:K.toHttp2Headers());Q.respond(H,{endStream:!0}),this.callTracker.addCallFailed(),J===null||J===void 0||J.streamTracker.addCallFailed()}_channelzHandler(F,Q,J){this.onStreamOpened(Q);let Z=this.sessions.get(Q.session);if(this.callTracker.addCallStarted(),Z===null||Z===void 0||Z.streamTracker.addCallStarted(),!this._verifyContentType(Q,J)){this.callTracker.addCallFailed(),Z===null||Z===void 0||Z.streamTracker.addCallFailed();return}let K=J[uZ0],H=this._retrieveHandler(K);if(!H){this._respondWithError(HA(K),Q,Z);return}let G={addMessageSent:()=>{if(Z)Z.messagesSent+=1,Z.lastMessageSentTimestamp=new Date},addMessageReceived:()=>{if(Z)Z.messagesReceived+=1,Z.lastMessageReceivedTimestamp=new Date},onCallEnd:(B)=>{if(B.code===_6.Status.OK)this.callTracker.addCallSucceeded();else this.callTracker.addCallFailed()},onStreamEnd:(B)=>{if(Z)if(B)Z.streamTracker.addCallSucceeded();else Z.streamTracker.addCallFailed()}},q=(0,xZ0.getServerInterceptingCall)([...F,...this.interceptors],Q,J,G,H,this.options);if(!this._runHandlerForCall(q,H))this.callTracker.addCallFailed(),Z===null||Z===void 0||Z.streamTracker.addCallFailed(),q.sendStatus({code:_6.Status.INTERNAL,details:`Unknown handler type: ${H.type}`})}_streamHandler(F,Q,J){if(this.onStreamOpened(Q),this._verifyContentType(Q,J)!==!0)return;let Z=J[uZ0],K=this._retrieveHandler(Z);if(!K){this._respondWithError(HA(Z),Q,null);return}let H=(0,xZ0.getServerInterceptingCall)([...F,...this.interceptors],Q,J,null,K,this.options);if(!this._runHandlerForCall(H,K))H.sendStatus({code:_6.Status.INTERNAL,details:`Unknown handler type: ${K.type}`})}_runHandlerForCall(F,Q){let{type:J}=Q;if(J==="unary")q51(F,Q);else if(J==="clientStream")H51(F,Q);else if(J==="serverStream")V51(F,Q);else if(J==="bidi")B51(F,Q);else return!1;return!0}_setupHandlers(F,Q){if(F===null)return;let J=F.address(),Z="null";if(J)if(typeof J==="string")Z=J;else Z=J.address+":"+J.port;this.serverAddressString=Z;let K=this.channelzEnabled?this._channelzHandler:this._streamHandler,H=this.channelzEnabled?this._channelzSessionHandler(F):this._sessionHandler(F);F.on("stream",K.bind(this,Q)),F.on("session",H)}_sessionHandler(F){return(Q)=>{var J,Z;(J=this.http2Servers.get(F))===null||J===void 0||J.sessions.add(Q);let K=null,H=null,G=null,q=!1,B=this.enableIdleTimeout(Q);if(this.maxConnectionAgeMs!==RY){let A=this.maxConnectionAgeMs/10,T=Math.random()*A*2-A;K=setTimeout(()=>{var I,C;q=!0,this.trace("Connection dropped by max connection age: "+((I=Q.socket)===null||I===void 0?void 0:I.remoteAddress));try{Q.goaway(v9.constants.NGHTTP2_NO_ERROR,2147483647,mZ0)}catch(M){Q.destroy();return}if(Q.close(),this.maxConnectionAgeGraceMs!==RY)H=setTimeout(()=>{Q.destroy()},this.maxConnectionAgeGraceMs),(C=H.unref)===null||C===void 0||C.call(H)},this.maxConnectionAgeMs+T),(Z=K.unref)===null||Z===void 0||Z.call(K)}let $=()=>{if(G)clearTimeout(G),G=null},R=()=>{return!Q.destroyed&&this.keepaliveTimeMs<qA&&this.keepaliveTimeMs>0},E,U=()=>{var A;if(!R())return;this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),G=setTimeout(()=>{$(),E()},this.keepaliveTimeMs),(A=G.unref)===null||A===void 0||A.call(G)};E=()=>{var A;if(!R())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let T="";try{if(!Q.ping((C,M,w)=>{if($(),C)this.keepaliveTrace("Ping failed with error: "+C.message),q=!0,Q.destroy();else this.keepaliveTrace("Received ping response"),U()}))T="Ping returned false"}catch(I){T=(I instanceof Error?I.message:"")||"Unknown error"}if(T){this.keepaliveTrace("Ping send failed: "+T),this.trace("Connection dropped due to ping send error: "+T),q=!0,Q.destroy();return}G=setTimeout(()=>{$(),this.keepaliveTrace("Ping timeout passed without response"),this.trace("Connection dropped by keepalive timeout"),q=!0,Q.destroy()},this.keepaliveTimeoutMs),(A=G.unref)===null||A===void 0||A.call(G)},U(),Q.on("close",()=>{var A,T;if(!q)this.trace(`Connection dropped by client ${(A=Q.socket)===null||A===void 0?void 0:A.remoteAddress}`);if(K)clearTimeout(K);if(H)clearTimeout(H);if($(),B!==null)clearTimeout(B.timeout),this.sessionIdleTimeouts.delete(Q);(T=this.http2Servers.get(F))===null||T===void 0||T.sessions.delete(Q)})}}_channelzSessionHandler(F){return(Q)=>{var J,Z,K,H;let G=(0,n6.registerChannelzSocket)((Z=(J=Q.socket)===null||J===void 0?void 0:J.remoteAddress)!==null&&Z!==void 0?Z:"unknown",this.getChannelzSessionInfo.bind(this,Q),this.channelzEnabled),q={ref:G,streamTracker:new n6.ChannelzCallTracker,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};(K=this.http2Servers.get(F))===null||K===void 0||K.sessions.add(Q),this.sessions.set(Q,q);let B=`${Q.socket.remoteAddress}:${Q.socket.remotePort}`;this.channelzTrace.addTrace("CT_INFO","Connection established by client "+B),this.trace("Connection established by client "+B),this.sessionChildrenTracker.refChild(G);let $=null,R=null,E=null,U=!1,A=this.enableIdleTimeout(Q);if(this.maxConnectionAgeMs!==RY){let w=this.maxConnectionAgeMs/10,P=Math.random()*w*2-w;$=setTimeout(()=>{var y;U=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+B);try{Q.goaway(v9.constants.NGHTTP2_NO_ERROR,2147483647,mZ0)}catch(v){Q.destroy();return}if(Q.close(),this.maxConnectionAgeGraceMs!==RY)R=setTimeout(()=>{Q.destroy()},this.maxConnectionAgeGraceMs),(y=R.unref)===null||y===void 0||y.call(R)},this.maxConnectionAgeMs+P),(H=$.unref)===null||H===void 0||H.call($)}let T=()=>{if(E)clearTimeout(E),E=null},I=()=>{return!Q.destroyed&&this.keepaliveTimeMs<qA&&this.keepaliveTimeMs>0},C,M=()=>{var w;if(!I())return;this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),E=setTimeout(()=>{T(),C()},this.keepaliveTimeMs),(w=E.unref)===null||w===void 0||w.call(E)};C=()=>{var w;if(!I())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let P="";try{if(!Q.ping((v,f,_)=>{if(T(),v)this.keepaliveTrace("Ping failed with error: "+v.message),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to error of a ping frame "+v.message+" return in "+f),U=!0,Q.destroy();else this.keepaliveTrace("Received ping response"),M()}))P="Ping returned false"}catch(y){P=(y instanceof Error?y.message:"")||"Unknown error"}if(P){this.keepaliveTrace("Ping send failed: "+P),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to ping send error: "+P),U=!0,Q.destroy();return}q.keepAlivesSent+=1,E=setTimeout(()=>{T(),this.keepaliveTrace("Ping timeout passed without response"),this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+B),U=!0,Q.destroy()},this.keepaliveTimeoutMs),(w=E.unref)===null||w===void 0||w.call(E)},M(),Q.on("close",()=>{var w;if(!U)this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+B);if(this.sessionChildrenTracker.unrefChild(G),(0,n6.unregisterChannelzRef)(G),$)clearTimeout($);if(R)clearTimeout(R);if(T(),A!==null)clearTimeout(A.timeout),this.sessionIdleTimeouts.delete(Q);(w=this.http2Servers.get(F))===null||w===void 0||w.sessions.delete(Q),this.sessions.delete(Q)})}}enableIdleTimeout(F){var Q,J;if(this.sessionIdleTimeout>=bZ0)return null;let Z={activeStreams:0,lastIdle:Date.now(),onClose:this.onStreamClose.bind(this,F),timeout:setTimeout(this.onIdleTimeout,this.sessionIdleTimeout,this,F)};(J=(Q=Z.timeout).unref)===null||J===void 0||J.call(Q),this.sessionIdleTimeouts.set(F,Z);let{socket:K}=F;return this.trace("Enable idle timeout for "+K.remoteAddress+":"+K.remotePort),Z}onIdleTimeout(F,Q){let{socket:J}=Q,Z=F.sessionIdleTimeouts.get(Q);if(Z!==void 0&&Z.activeStreams===0)if(Date.now()-Z.lastIdle>=F.sessionIdleTimeout)F.trace("Session idle timeout triggered for "+(J===null||J===void 0?void 0:J.remoteAddress)+":"+(J===null||J===void 0?void 0:J.remotePort)+" last idle at "+Z.lastIdle),F.closeSession(Q);else Z.timeout.refresh()}onStreamOpened(F){let Q=F.session,J=this.sessionIdleTimeouts.get(Q);if(J)J.activeStreams+=1,F.once("close",J.onClose)}onStreamClose(F){var Q,J;let Z=this.sessionIdleTimeouts.get(F);if(Z){if(Z.activeStreams-=1,Z.activeStreams===0)Z.lastIdle=Date.now(),Z.timeout.refresh(),this.trace("Session onStreamClose"+((Q=F.socket)===null||Q===void 0?void 0:Q.remoteAddress)+":"+((J=F.socket)===null||J===void 0?void 0:J.remotePort)+" at "+Z.lastIdle)}}},(()=>{let z=typeof Symbol==="function"&&Symbol.metadata?Object.create(null):void 0;if(W=[K51("Calling start() is no longer necessary. It can be safely omitted.")],Z51(X,null,W,{kind:"method",name:"start",static:!1,private:!1,access:{has:(F)=>("start"in F),get:(F)=>F.start},metadata:z},null,Y),z)Object.defineProperty(X,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:z})})(),X})();v5.Server=z51;async function q51(X,Y){let W;function z(J,Z,K,H){if(J){X.sendStatus((0,LY.serverErrorToStatus)(J,K));return}X.sendMessage(Z,()=>{X.sendStatus({code:_6.Status.OK,details:"OK",metadata:K!==null&&K!==void 0?K:null})})}let F,Q=null;X.start({onReceiveMetadata(J){F=J,X.startRead()},onReceiveMessage(J){if(Q){X.sendStatus({code:_6.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${Y.path}`,metadata:null});return}Q=J,X.startRead()},onReceiveHalfClose(){if(!Q){X.sendStatus({code:_6.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${Y.path}`,metadata:null});return}W=new LY.ServerWritableStreamImpl(Y.path,X,F,Q);try{Y.func(W,z)}catch(J){X.sendStatus({code:_6.Status.UNKNOWN,details:`Server method handler threw error ${J.message}`,metadata:null})}},onCancel(){if(W)W.cancelled=!0,W.emit("cancelled","cancelled")}})}function H51(X,Y){let W;function z(F,Q,J,Z){if(F){X.sendStatus((0,LY.serverErrorToStatus)(F,J));return}X.sendMessage(Q,()=>{X.sendStatus({code:_6.Status.OK,details:"OK",metadata:J!==null&&J!==void 0?J:null})})}X.start({onReceiveMetadata(F){W=new LY.ServerDuplexStreamImpl(Y.path,X,F);try{Y.func(W,z)}catch(Q){X.sendStatus({code:_6.Status.UNKNOWN,details:`Server method handler threw error ${Q.message}`,metadata:null})}},onReceiveMessage(F){W.push(F)},onReceiveHalfClose(){W.push(null)},onCancel(){if(W)W.cancelled=!0,W.emit("cancelled","cancelled"),W.destroy()}})}function V51(X,Y){let W,z,F=null;X.start({onReceiveMetadata(Q){z=Q,X.startRead()},onReceiveMessage(Q){if(F){X.sendStatus({code:_6.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${Y.path}`,metadata:null});return}F=Q,X.startRead()},onReceiveHalfClose(){if(!F){X.sendStatus({code:_6.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${Y.path}`,metadata:null});return}W=new LY.ServerWritableStreamImpl(Y.path,X,z,F);try{Y.func(W)}catch(Q){X.sendStatus({code:_6.Status.UNKNOWN,details:`Server method handler threw error ${Q.message}`,metadata:null})}},onCancel(){if(W)W.cancelled=!0,W.emit("cancelled","cancelled"),W.destroy()}})}function B51(X,Y){let W;X.start({onReceiveMetadata(z){W=new LY.ServerDuplexStreamImpl(Y.path,X,z);try{Y.func(W)}catch(F){X.sendStatus({code:_6.Status.UNKNOWN,details:`Server method handler threw error ${F.message}`,metadata:null})}},onReceiveMessage(z){W.push(z)},onReceiveHalfClose(){W.push(null)},onCancel(){if(W)W.cancelled=!0,W.emit("cancelled","cancelled"),W.destroy()}})}});var nZ0=X0((lZ0)=>{Object.defineProperty(lZ0,"__esModule",{value:!0});lZ0.StatusBuilder=void 0;class cZ0{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(X){return this.code=X,this}withDetails(X){return this.details=X,this}withMetadata(X){return this.metadata=X,this}build(){let X={};if(this.code!==null)X.code=this.code;if(this.details!==null)X.details=this.details;if(this.metadata!==null)X.metadata=this.metadata;return X}}lZ0.StatusBuilder=cZ0});var gQ=X0((XQ0)=>{Object.defineProperty(XQ0,"__esModule",{value:!0});XQ0.LeafLoadBalancer=XQ0.PickFirstLoadBalancer=XQ0.PickFirstLoadBalancingConfig=void 0;XQ0.shuffled=tZ0;XQ0.setup=D51;var VA=E5(),x6=C9(),j5=b4(),iZ0=y9(),U51=A6(),N51=a1(),aZ0=y9(),rZ0=F1("net"),A51=h7(),O51="pick_first";function uQ(X){U51.trace(N51.LogVerbosity.DEBUG,O51,X)}var mQ="pick_first",T51=250;class PY{constructor(X){this.shuffleAddressList=X}getLoadBalancerName(){return mQ}toJsonObject(){return{[mQ]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(X){if("shuffleAddressList"in X&&typeof X.shuffleAddressList!=="boolean")throw Error("pick_first config field shuffleAddressList must be a boolean if provided");return new PY(X.shuffleAddressList===!0)}}XQ0.PickFirstLoadBalancingConfig=PY;class oZ0{constructor(X){this.subchannel=X}pick(X){return{pickResultType:j5.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}}function tZ0(X){let Y=X.slice();for(let W=Y.length-1;W>1;W--){let z=Math.floor(Math.random()*(W+1)),F=Y[W];Y[W]=Y[z],Y[z]=F}return Y}function I51(X){if(X.length===0)return[];let Y=[],W=[],z=[],F=(0,aZ0.isTcpSubchannelAddress)(X[0])&&(0,rZ0.isIPv6)(X[0].host);for(let Z of X)if((0,aZ0.isTcpSubchannelAddress)(Z)&&(0,rZ0.isIPv6)(Z.host))W.push(Z);else z.push(Z);let Q=F?W:z,J=F?z:W;for(let Z=0;Z<Math.max(Q.length,J.length);Z++){if(Z<Q.length)Y.push(Q[Z]);if(Z<J.length)Y.push(J[Z])}return Y}var sZ0="grpc-node.internal.pick-first.report_health_status";class UK{constructor(X){this.channelControlHelper=X,this.children=[],this.currentState=x6.ConnectivityState.IDLE,this.currentSubchannelIndex=0,this.currentPick=null,this.subchannelStateListener=(Y,W,z,F,Q)=>{this.onSubchannelStateUpdate(Y,W,z,Q)},this.pickedSubchannelHealthListener=()=>this.calculateAndReportNewState(),this.stickyTransientFailureMode=!1,this.reportHealthStatus=!1,this.lastError=null,this.latestAddressList=null,this.latestOptions={},this.latestResolutionNote="",this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout)}allChildrenHaveReportedTF(){return this.children.every((X)=>X.hasReportedTransientFailure)}resetChildrenReportedTF(){this.children.every((X)=>X.hasReportedTransientFailure=!1)}calculateAndReportNewState(){var X;if(this.currentPick)if(this.reportHealthStatus&&!this.currentPick.isHealthy()){let Y=`Picked subchannel ${this.currentPick.getAddress()} is unhealthy`;this.updateState(x6.ConnectivityState.TRANSIENT_FAILURE,new j5.UnavailablePicker({details:Y}),Y)}else this.updateState(x6.ConnectivityState.READY,new oZ0(this.currentPick),null);else if(((X=this.latestAddressList)===null||X===void 0?void 0:X.length)===0){let Y=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(x6.ConnectivityState.TRANSIENT_FAILURE,new j5.UnavailablePicker({details:Y}),Y)}else if(this.children.length===0)this.updateState(x6.ConnectivityState.IDLE,new j5.QueuePicker(this),null);else if(this.stickyTransientFailureMode){let Y=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(x6.ConnectivityState.TRANSIENT_FAILURE,new j5.UnavailablePicker({details:Y}),Y)}else this.updateState(x6.ConnectivityState.CONNECTING,new j5.QueuePicker(this),null)}requestReresolution(){this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(!this.allChildrenHaveReportedTF())return;if(this.requestReresolution(),this.resetChildrenReportedTF(),this.stickyTransientFailureMode){this.calculateAndReportNewState();return}this.stickyTransientFailureMode=!0;for(let{subchannel:X}of this.children)X.startConnecting();this.calculateAndReportNewState()}removeCurrentPick(){if(this.currentPick!==null)this.currentPick.removeConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef()),this.currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick.unref(),this.currentPick=null}onSubchannelStateUpdate(X,Y,W,z){var F;if((F=this.currentPick)===null||F===void 0?void 0:F.realSubchannelEquals(X)){if(W!==x6.ConnectivityState.READY)this.removeCurrentPick(),this.calculateAndReportNewState();return}for(let[Q,J]of this.children.entries())if(X.realSubchannelEquals(J.subchannel)){if(W===x6.ConnectivityState.READY)this.pickSubchannel(J.subchannel);if(W===x6.ConnectivityState.TRANSIENT_FAILURE){if(J.hasReportedTransientFailure=!0,z)this.lastError=z;if(this.maybeEnterStickyTransientFailureMode(),Q===this.currentSubchannelIndex)this.startNextSubchannelConnecting(Q+1)}J.subchannel.startConnecting();return}}startNextSubchannelConnecting(X){clearTimeout(this.connectionDelayTimeout);for(let[Y,W]of this.children.entries())if(Y>=X){let z=W.subchannel.getConnectivityState();if(z===x6.ConnectivityState.IDLE||z===x6.ConnectivityState.CONNECTING){this.startConnecting(Y);return}}this.maybeEnterStickyTransientFailureMode()}startConnecting(X){var Y,W;if(clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=X,this.children[X].subchannel.getConnectivityState()===x6.ConnectivityState.IDLE)uQ("Start connecting to subchannel with address "+this.children[X].subchannel.getAddress()),process.nextTick(()=>{var z;(z=this.children[X])===null||z===void 0||z.subchannel.startConnecting()});this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting(X+1)},T51),(W=(Y=this.connectionDelayTimeout).unref)===null||W===void 0||W.call(Y)}pickSubchannel(X){uQ("Pick subchannel with address "+X.getAddress()),this.stickyTransientFailureMode=!1,X.ref(),this.channelControlHelper.addChannelzChild(X.getChannelzRef()),this.removeCurrentPick(),this.resetSubchannelList(),X.addConnectivityStateListener(this.subchannelStateListener),X.addHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick=X,clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState()}updateState(X,Y,W){uQ(x6.ConnectivityState[this.currentState]+" -> "+x6.ConnectivityState[X]),this.currentState=X,this.channelControlHelper.updateState(X,Y,W)}resetSubchannelList(){for(let X of this.children)X.subchannel.removeConnectivityStateListener(this.subchannelStateListener),X.subchannel.unref(),this.channelControlHelper.removeChannelzChild(X.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[]}connectToAddressList(X,Y){uQ("connectToAddressList(["+X.map((z)=>(0,iZ0.subchannelAddressToString)(z))+"])");let W=X.map((z)=>({subchannel:this.channelControlHelper.createSubchannel(z,Y),hasReportedTransientFailure:!1}));for(let{subchannel:z}of W)if(z.getConnectivityState()===x6.ConnectivityState.READY){this.pickSubchannel(z);return}for(let{subchannel:z}of W)z.ref(),this.channelControlHelper.addChannelzChild(z.getChannelzRef());this.resetSubchannelList(),this.children=W;for(let{subchannel:z}of this.children)z.addConnectivityStateListener(this.subchannelStateListener);for(let z of this.children)if(z.subchannel.getConnectivityState()===x6.ConnectivityState.TRANSIENT_FAILURE)z.hasReportedTransientFailure=!0;this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(X,Y,W,z){if(!(Y instanceof PY))return!1;if(!X.ok){if(this.children.length===0&&this.currentPick===null)this.channelControlHelper.updateState(x6.ConnectivityState.TRANSIENT_FAILURE,new j5.UnavailablePicker(X.error),X.error.details);return!0}let F=X.value;if(this.reportHealthStatus=W[sZ0],Y.getShuffleAddressList())F=tZ0(F);let Q=[].concat(...F.map((Z)=>Z.addresses));uQ("updateAddressList(["+Q.map((Z)=>(0,iZ0.subchannelAddressToString)(Z))+"])");let J=I51(Q);if(this.latestAddressList=J,this.latestOptions=W,this.connectToAddressList(J,W),this.latestResolutionNote=z,Q.length>0)return!0;else return this.lastError="No addresses resolved",!1}exitIdle(){if(this.currentState===x6.ConnectivityState.IDLE&&this.latestAddressList)this.connectToAddressList(this.latestAddressList,this.latestOptions)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return mQ}}XQ0.PickFirstLoadBalancer=UK;var $51=new PY(!1);class eZ0{constructor(X,Y,W,z){this.endpoint=X,this.options=W,this.resolutionNote=z,this.latestState=x6.ConnectivityState.IDLE;let F=(0,VA.createChildChannelControlHelper)(Y,{updateState:(Q,J,Z)=>{this.latestState=Q,this.latestPicker=J,Y.updateState(Q,J,Z)}});this.pickFirstBalancer=new UK(F),this.latestPicker=new j5.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList((0,A51.statusOrFromValue)([this.endpoint]),$51,Object.assign(Object.assign({},this.options),{[sZ0]:!0}),this.resolutionNote)}updateEndpoint(X,Y){if(this.options=Y,this.endpoint=X,this.latestState!==x6.ConnectivityState.IDLE)this.startConnecting()}getConnectivityState(){return this.latestState}getPicker(){return this.latestPicker}getEndpoint(){return this.endpoint}exitIdle(){this.pickFirstBalancer.exitIdle()}destroy(){this.pickFirstBalancer.destroy()}}XQ0.LeafLoadBalancer=eZ0;function D51(){(0,VA.registerLoadBalancerType)(mQ,UK,PY),(0,VA.registerDefaultLoadBalancerType)(mQ)}});var WQ0=X0((QQ0)=>{Object.defineProperty(QQ0,"__esModule",{value:!0});QQ0.FileWatcherCertificateProvider=void 0;var L51=F1("fs"),P51=A6(),w51=a1(),S51=F1("util"),f51="certificate_provider";function NK(X){P51.trace(w51.LogVerbosity.DEBUG,f51,X)}var BA=(0,S51.promisify)(L51.readFile);class ZQ0{constructor(X){if(this.config=X,this.refreshTimer=null,this.fileResultPromise=null,this.latestCaUpdate=void 0,this.caListeners=new Set,this.latestIdentityUpdate=void 0,this.identityListeners=new Set,this.lastUpdateTime=null,X.certificateFile===void 0!==(X.privateKeyFile===void 0))throw Error("certificateFile and privateKeyFile must be set or unset together");if(X.certificateFile===void 0&&X.caCertificateFile===void 0)throw Error("At least one of certificateFile and caCertificateFile must be set");NK("File watcher constructed with config "+JSON.stringify(X))}updateCertificates(){if(this.fileResultPromise)return;this.fileResultPromise=Promise.allSettled([this.config.certificateFile?BA(this.config.certificateFile):Promise.reject(),this.config.privateKeyFile?BA(this.config.privateKeyFile):Promise.reject(),this.config.caCertificateFile?BA(this.config.caCertificateFile):Promise.reject()]),this.fileResultPromise.then(([X,Y,W])=>{if(!this.refreshTimer)return;if(NK("File watcher read certificates certificate "+X.status+", privateKey "+Y.status+", CA certificate "+W.status),this.lastUpdateTime=new Date,this.fileResultPromise=null,X.status==="fulfilled"&&Y.status==="fulfilled")this.latestIdentityUpdate={certificate:X.value,privateKey:Y.value};else this.latestIdentityUpdate=null;if(W.status==="fulfilled")this.latestCaUpdate={caCertificate:W.value};else this.latestCaUpdate=null;for(let z of this.identityListeners)z(this.latestIdentityUpdate);for(let z of this.caListeners)z(this.latestCaUpdate)}),NK("File watcher initiated certificate update")}maybeStartWatchingFiles(){if(!this.refreshTimer){let X=this.lastUpdateTime?new Date().getTime()-this.lastUpdateTime.getTime():1/0;if(X>this.config.refreshIntervalMs)this.updateCertificates();if(X>this.config.refreshIntervalMs*2)this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0;this.refreshTimer=setInterval(()=>this.updateCertificates(),this.config.refreshIntervalMs),NK("File watcher started watching")}}maybeStopWatchingFiles(){if(this.caListeners.size===0&&this.identityListeners.size===0){if(this.fileResultPromise=null,this.refreshTimer)clearInterval(this.refreshTimer),this.refreshTimer=null}}addCaCertificateListener(X){if(this.caListeners.add(X),this.maybeStartWatchingFiles(),this.latestCaUpdate!==void 0)process.nextTick(X,this.latestCaUpdate)}removeCaCertificateListener(X){this.caListeners.delete(X),this.maybeStopWatchingFiles()}addIdentityCertificateListener(X){if(this.identityListeners.add(X),this.maybeStartWatchingFiles(),this.latestIdentityUpdate!==void 0)process.nextTick(X,this.latestIdentityUpdate)}removeIdentityCertificateListener(X){this.identityListeners.delete(X),this.maybeStopWatchingFiles()}}QQ0.FileWatcherCertificateProvider=ZQ0});var AA=X0((o1)=>{Object.defineProperty(o1,"__esModule",{value:!0});o1.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=o1.createCertificateProviderChannelCredentials=o1.FileWatcherCertificateProvider=o1.createCertificateProviderServerCredentials=o1.createServerCredentialsWithInterceptors=o1.BaseSubchannelWrapper=o1.registerAdminService=o1.FilterStackFactory=o1.BaseFilter=o1.statusOrFromError=o1.statusOrFromValue=o1.PickResultType=o1.QueuePicker=o1.UnavailablePicker=o1.ChildLoadBalancerHandler=o1.EndpointMap=o1.endpointHasAddress=o1.endpointToString=o1.subchannelAddressToString=o1.LeafLoadBalancer=o1.isLoadBalancerNameRegistered=o1.parseLoadBalancingConfig=o1.selectLbConfigFromList=o1.registerLoadBalancerType=o1.createChildChannelControlHelper=o1.BackoffTimeout=o1.parseDuration=o1.durationToMs=o1.splitHostPort=o1.uriToString=o1.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=o1.createResolver=o1.registerResolver=o1.log=o1.trace=void 0;var GQ0=A6();Object.defineProperty(o1,"trace",{enumerable:!0,get:function(){return GQ0.trace}});Object.defineProperty(o1,"log",{enumerable:!0,get:function(){return GQ0.log}});var UA=y8();Object.defineProperty(o1,"registerResolver",{enumerable:!0,get:function(){return UA.registerResolver}});Object.defineProperty(o1,"createResolver",{enumerable:!0,get:function(){return UA.createResolver}});Object.defineProperty(o1,"CHANNEL_ARGS_CONFIG_SELECTOR_KEY",{enumerable:!0,get:function(){return UA.CHANNEL_ARGS_CONFIG_SELECTOR_KEY}});var KQ0=E9();Object.defineProperty(o1,"uriToString",{enumerable:!0,get:function(){return KQ0.uriToString}});Object.defineProperty(o1,"splitHostPort",{enumerable:!0,get:function(){return KQ0.splitHostPort}});var FQ0=bQ();Object.defineProperty(o1,"durationToMs",{enumerable:!0,get:function(){return FQ0.durationToMs}});Object.defineProperty(o1,"parseDuration",{enumerable:!0,get:function(){return FQ0.parseDuration}});var y51=QY();Object.defineProperty(o1,"BackoffTimeout",{enumerable:!0,get:function(){return y51.BackoffTimeout}});var dQ=E5();Object.defineProperty(o1,"createChildChannelControlHelper",{enumerable:!0,get:function(){return dQ.createChildChannelControlHelper}});Object.defineProperty(o1,"registerLoadBalancerType",{enumerable:!0,get:function(){return dQ.registerLoadBalancerType}});Object.defineProperty(o1,"selectLbConfigFromList",{enumerable:!0,get:function(){return dQ.selectLbConfigFromList}});Object.defineProperty(o1,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return dQ.parseLoadBalancingConfig}});Object.defineProperty(o1,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return dQ.isLoadBalancerNameRegistered}});var k51=gQ();Object.defineProperty(o1,"LeafLoadBalancer",{enumerable:!0,get:function(){return k51.LeafLoadBalancer}});var AK=y9();Object.defineProperty(o1,"subchannelAddressToString",{enumerable:!0,get:function(){return AK.subchannelAddressToString}});Object.defineProperty(o1,"endpointToString",{enumerable:!0,get:function(){return AK.endpointToString}});Object.defineProperty(o1,"endpointHasAddress",{enumerable:!0,get:function(){return AK.endpointHasAddress}});Object.defineProperty(o1,"EndpointMap",{enumerable:!0,get:function(){return AK.EndpointMap}});var v51=UG();Object.defineProperty(o1,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return v51.ChildLoadBalancerHandler}});var NA=b4();Object.defineProperty(o1,"UnavailablePicker",{enumerable:!0,get:function(){return NA.UnavailablePicker}});Object.defineProperty(o1,"QueuePicker",{enumerable:!0,get:function(){return NA.QueuePicker}});Object.defineProperty(o1,"PickResultType",{enumerable:!0,get:function(){return NA.PickResultType}});var zQ0=h7();Object.defineProperty(o1,"statusOrFromValue",{enumerable:!0,get:function(){return zQ0.statusOrFromValue}});Object.defineProperty(o1,"statusOrFromError",{enumerable:!0,get:function(){return zQ0.statusOrFromError}});var j51=wN();Object.defineProperty(o1,"BaseFilter",{enumerable:!0,get:function(){return j51.BaseFilter}});var h51=rG();Object.defineProperty(o1,"FilterStackFactory",{enumerable:!0,get:function(){return h51.FilterStackFactory}});var _51=AG();Object.defineProperty(o1,"registerAdminService",{enumerable:!0,get:function(){return _51.registerAdminService}});var x51=_Q();Object.defineProperty(o1,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return x51.BaseSubchannelWrapper}});var qQ0=FK();Object.defineProperty(o1,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return qQ0.createServerCredentialsWithInterceptors}});Object.defineProperty(o1,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return qQ0.createCertificateProviderServerCredentials}});var b51=WQ0();Object.defineProperty(o1,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return b51.FileWatcherCertificateProvider}});var u51=ZY();Object.defineProperty(o1,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return u51.createCertificateProviderChannelCredentials}});var m51=rN();Object.defineProperty(o1,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return m51.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})});var BQ0=X0((VQ0)=>{Object.defineProperty(VQ0,"__esModule",{value:!0});VQ0.setup=l51;var d51=y8(),c51=h7();class HQ0{constructor(X,Y,W){this.listener=Y,this.hasReturnedResult=!1,this.endpoints=[];let z;if(X.authority==="")z="/"+X.path;else z=X.path;this.endpoints=[{addresses:[{path:z}]}]}updateResolution(){if(!this.hasReturnedResult)this.hasReturnedResult=!0,process.nextTick(this.listener,(0,c51.statusOrFromValue)(this.endpoints),{},null,"")}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(X){return"localhost"}}function l51(){(0,d51.registerResolver)("unix",HQ0)}});var $Q0=X0((IQ0)=>{Object.defineProperty(IQ0,"__esModule",{value:!0});IQ0.setup=o51;var UQ0=F1("net"),NQ0=h7(),OK=a1(),OA=s6(),AQ0=y8(),n51=y9(),OQ0=E9(),i51=A6(),a51="ip_resolver";function TQ0(X){i51.trace(OK.LogVerbosity.DEBUG,a51,X)}var TA="ipv4",IA="ipv6",r51=443;class $A{constructor(X,Y,W){var z;this.listener=Y,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,TQ0("Resolver constructed for target "+(0,OQ0.uriToString)(X));let F=[];if(!(X.scheme===TA||X.scheme===IA)){this.error={code:OK.Status.UNAVAILABLE,details:`Unrecognized scheme ${X.scheme} in IP resolver`,metadata:new OA.Metadata};return}let Q=X.path.split(",");for(let J of Q){let Z=(0,OQ0.splitHostPort)(J);if(Z===null){this.error={code:OK.Status.UNAVAILABLE,details:`Failed to parse ${X.scheme} address ${J}`,metadata:new OA.Metadata};return}if(X.scheme===TA&&!(0,UQ0.isIPv4)(Z.host)||X.scheme===IA&&!(0,UQ0.isIPv6)(Z.host)){this.error={code:OK.Status.UNAVAILABLE,details:`Failed to parse ${X.scheme} address ${J}`,metadata:new OA.Metadata};return}F.push({host:Z.host,port:(z=Z.port)!==null&&z!==void 0?z:r51})}this.endpoints=F.map((J)=>({addresses:[J]})),TQ0("Parsed "+X.scheme+" address list "+F.map(n51.subchannelAddressToString))}updateResolution(){if(!this.hasReturnedResult)this.hasReturnedResult=!0,process.nextTick(()=>{if(this.error)this.listener((0,NQ0.statusOrFromError)(this.error),{},null,"");else this.listener((0,NQ0.statusOrFromValue)(this.endpoints),{},null,"")})}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(X){return X.path.split(",")[0]}}function o51(){(0,AQ0.registerResolver)(TA,$A),(0,AQ0.registerResolver)(IA,$A)}});var PQ0=X0((MQ0)=>{Object.defineProperty(MQ0,"__esModule",{value:!0});MQ0.RoundRobinLoadBalancer=void 0;MQ0.setup=Q71;var CQ0=E5(),B9=C9(),cQ=b4(),s51=A6(),e51=a1(),DQ0=y9(),X71=gQ(),Y71="round_robin";function EQ0(X){s51.trace(e51.LogVerbosity.DEBUG,Y71,X)}var TK="round_robin";class IK{getLoadBalancerName(){return TK}constructor(){}toJsonObject(){return{[TK]:{}}}static createFromJson(X){return new IK}}class RQ0{constructor(X,Y=0){this.children=X,this.nextIndex=Y}pick(X){let Y=this.children[this.nextIndex].picker;return this.nextIndex=(this.nextIndex+1)%this.children.length,Y.pick(X)}peekNextEndpoint(){return this.children[this.nextIndex].endpoint}}function Z71(X,Y){return[...X.slice(Y),...X.slice(0,Y)]}class DA{constructor(X){this.channelControlHelper=X,this.children=[],this.currentState=B9.ConnectivityState.IDLE,this.currentReadyPicker=null,this.updatesPaused=!1,this.lastError=null,this.childChannelControlHelper=(0,CQ0.createChildChannelControlHelper)(X,{updateState:(Y,W,z)=>{if(this.currentState===B9.ConnectivityState.READY&&Y!==B9.ConnectivityState.READY)this.channelControlHelper.requestReresolution();if(z)this.lastError=z;this.calculateAndUpdateState()}})}countChildrenWithState(X){return this.children.filter((Y)=>Y.getConnectivityState()===X).length}calculateAndUpdateState(){if(this.updatesPaused)return;if(this.countChildrenWithState(B9.ConnectivityState.READY)>0){let X=this.children.filter((W)=>W.getConnectivityState()===B9.ConnectivityState.READY),Y=0;if(this.currentReadyPicker!==null){let W=this.currentReadyPicker.peekNextEndpoint();if(Y=X.findIndex((z)=>(0,DQ0.endpointEqual)(z.getEndpoint(),W)),Y<0)Y=0}this.updateState(B9.ConnectivityState.READY,new RQ0(X.map((W)=>({endpoint:W.getEndpoint(),picker:W.getPicker()})),Y),null)}else if(this.countChildrenWithState(B9.ConnectivityState.CONNECTING)>0)this.updateState(B9.ConnectivityState.CONNECTING,new cQ.QueuePicker(this),null);else if(this.countChildrenWithState(B9.ConnectivityState.TRANSIENT_FAILURE)>0){let X=`round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(B9.ConnectivityState.TRANSIENT_FAILURE,new cQ.UnavailablePicker({details:X}),X)}else this.updateState(B9.ConnectivityState.IDLE,new cQ.QueuePicker(this),null);for(let X of this.children)if(X.getConnectivityState()===B9.ConnectivityState.IDLE)X.exitIdle()}updateState(X,Y,W){if(EQ0(B9.ConnectivityState[this.currentState]+" -> "+B9.ConnectivityState[X]),X===B9.ConnectivityState.READY)this.currentReadyPicker=Y;else this.currentReadyPicker=null;this.currentState=X,this.channelControlHelper.updateState(X,Y,W)}resetSubchannelList(){for(let X of this.children)X.destroy();this.children=[]}updateAddressList(X,Y,W,z){if(!(Y instanceof IK))return!1;if(!X.ok){if(this.children.length===0)this.updateState(B9.ConnectivityState.TRANSIENT_FAILURE,new cQ.UnavailablePicker(X.error),X.error.details);return!0}let F=Math.random()*X.value.length|0,Q=Z71(X.value,F);if(this.resetSubchannelList(),Q.length===0){let J=`No addresses resolved. Resolution note: ${z}`;this.updateState(B9.ConnectivityState.TRANSIENT_FAILURE,new cQ.UnavailablePicker({details:J}),J)}EQ0("Connect to endpoint list "+Q.map(DQ0.endpointToString)),this.updatesPaused=!0,this.children=Q.map((J)=>new X71.LeafLoadBalancer(J,this.childChannelControlHelper,W,z));for(let J of this.children)J.startConnecting();return this.updatesPaused=!1,this.calculateAndUpdateState(),!0}exitIdle(){}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return TK}}MQ0.RoundRobinLoadBalancer=DA;function Q71(){(0,CQ0.registerLoadBalancerType)(TK,DA,IK)}});var hQ0=X0((vQ0)=>{var EA;Object.defineProperty(vQ0,"__esModule",{value:!0});vQ0.OutlierDetectionLoadBalancer=vQ0.OutlierDetectionLoadBalancingConfig=void 0;vQ0.setup=N71;var W71=C9(),wQ0=a1(),n7=bQ(),SQ0=AA(),G71=E5(),K71=UG(),F71=b4(),CA=y9(),z71=_Q(),q71=A6(),H71="outlier_detection";function Y9(X){q71.trace(wQ0.LogVerbosity.DEBUG,H71,X)}var LA="outlier_detection",V71=((EA=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)!==null&&EA!==void 0?EA:"true")==="true",B71={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},U71={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function wY(X,Y,W,z){if(Y in X&&X[Y]!==void 0&&typeof X[Y]!==W){let F=z?`${z}.${Y}`:Y;throw Error(`outlier detection config ${F} parse error: expected ${W}, got ${typeof X[Y]}`)}}function RA(X,Y,W){let z=W?`${W}.${Y}`:Y;if(Y in X&&X[Y]!==void 0){if(!(0,n7.isDuration)(X[Y]))throw Error(`outlier detection config ${z} parse error: expected Duration, got ${typeof X[Y]}`);if(!(X[Y].seconds>=0&&X[Y].seconds<=315576000000&&X[Y].nanos>=0&&X[Y].nanos<=999999999))throw Error(`outlier detection config ${z} parse error: values out of range for non-negative Duaration`)}}function $K(X,Y,W){let z=W?`${W}.${Y}`:Y;if(wY(X,Y,"number",W),Y in X&&X[Y]!==void 0&&!(X[Y]>=0&&X[Y]<=100))throw Error(`outlier detection config ${z} parse error: value out of range for percentage (0-100)`)}class lQ{constructor(X,Y,W,z,F,Q,J){if(this.childPolicy=J,J.getLoadBalancerName()==="pick_first")throw Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=X!==null&&X!==void 0?X:1e4,this.baseEjectionTimeMs=Y!==null&&Y!==void 0?Y:30000,this.maxEjectionTimeMs=W!==null&&W!==void 0?W:300000,this.maxEjectionPercent=z!==null&&z!==void 0?z:10,this.successRateEjection=F?Object.assign(Object.assign({},B71),F):null,this.failurePercentageEjection=Q?Object.assign(Object.assign({},U71),Q):null}getLoadBalancerName(){return LA}toJsonObject(){var X,Y;return{outlier_detection:{interval:(0,n7.msToDuration)(this.intervalMs),base_ejection_time:(0,n7.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,n7.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:(X=this.successRateEjection)!==null&&X!==void 0?X:void 0,failure_percentage_ejection:(Y=this.failurePercentageEjection)!==null&&Y!==void 0?Y:void 0,child_policy:[this.childPolicy.toJsonObject()]}}}getIntervalMs(){return this.intervalMs}getBaseEjectionTimeMs(){return this.baseEjectionTimeMs}getMaxEjectionTimeMs(){return this.maxEjectionTimeMs}getMaxEjectionPercent(){return this.maxEjectionPercent}getSuccessRateEjectionConfig(){return this.successRateEjection}getFailurePercentageEjectionConfig(){return this.failurePercentageEjection}getChildPolicy(){return this.childPolicy}static createFromJson(X){var Y;if(RA(X,"interval"),RA(X,"base_ejection_time"),RA(X,"max_ejection_time"),$K(X,"max_ejection_percent"),"success_rate_ejection"in X&&X.success_rate_ejection!==void 0){if(typeof X.success_rate_ejection!=="object")throw Error("outlier detection config success_rate_ejection must be an object");wY(X.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),$K(X.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),wY(X.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),wY(X.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in X&&X.failure_percentage_ejection!==void 0){if(typeof X.failure_percentage_ejection!=="object")throw Error("outlier detection config failure_percentage_ejection must be an object");$K(X.failure_percentage_ejection,"threshold","failure_percentage_ejection"),$K(X.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),wY(X.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),wY(X.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}if(!("child_policy"in X)||!Array.isArray(X.child_policy))throw Error("outlier detection config child_policy must be an array");let W=(0,G71.selectLbConfigFromList)(X.child_policy);if(!W)throw Error("outlier detection config child_policy: no valid recognized policy found");return new lQ(X.interval?(0,n7.durationToMs)(X.interval):null,X.base_ejection_time?(0,n7.durationToMs)(X.base_ejection_time):null,X.max_ejection_time?(0,n7.durationToMs)(X.max_ejection_time):null,(Y=X.max_ejection_percent)!==null&&Y!==void 0?Y:null,X.success_rate_ejection,X.failure_percentage_ejection,W)}}vQ0.OutlierDetectionLoadBalancingConfig=lQ;class fQ0 extends z71.BaseSubchannelWrapper{constructor(X,Y){super(X);this.mapEntry=Y,this.refCount=0}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0){if(this.mapEntry){let X=this.mapEntry.subchannelWrappers.indexOf(this);if(X>=0)this.mapEntry.subchannelWrappers.splice(X,1)}}}eject(){this.setHealthy(!1)}uneject(){this.setHealthy(!0)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}}function MA(){return{success:0,failure:0}}class yQ0{constructor(){this.activeBucket=MA(),this.inactiveBucket=MA()}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket=MA()}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}}class kQ0{constructor(X,Y){this.wrappedPicker=X,this.countCalls=Y}pick(X){let Y=this.wrappedPicker.pick(X);if(Y.pickResultType===F71.PickResultType.COMPLETE){let W=Y.subchannel,z=W.getMapEntry();if(z){let F=Y.onCallEnded;if(this.countCalls)F=(Q,J,Z)=>{var K;if(Q===wQ0.Status.OK)z.counter.addSuccess();else z.counter.addFailure();(K=Y.onCallEnded)===null||K===void 0||K.call(Y,Q,J,Z)};return Object.assign(Object.assign({},Y),{subchannel:W.getWrappedSubchannel(),onCallEnded:F})}else return Object.assign(Object.assign({},Y),{subchannel:W.getWrappedSubchannel()})}else return Y}}class PA{constructor(X){this.entryMap=new CA.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new K71.ChildLoadBalancerHandler((0,SQ0.createChildChannelControlHelper)(X,{createSubchannel:(Y,W)=>{let z=X.createSubchannel(Y,W),F=this.entryMap.getForSubchannelAddress(Y),Q=new fQ0(z,F);if((F===null||F===void 0?void 0:F.currentEjectionTimestamp)!==null)Q.eject();return F===null||F===void 0||F.subchannelWrappers.push(Q),Q},updateState:(Y,W,z)=>{if(Y===W71.ConnectivityState.READY)X.updateState(Y,new kQ0(W,this.isCountingEnabled()),z);else X.updateState(Y,W,z)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return this.latestConfig!==null&&(this.latestConfig.getSuccessRateEjectionConfig()!==null||this.latestConfig.getFailurePercentageEjectionConfig()!==null)}getCurrentEjectionPercent(){let X=0;for(let Y of this.entryMap.values())if(Y.currentEjectionTimestamp!==null)X+=1;return X*100/this.entryMap.size}runSuccessRateCheck(X){if(!this.latestConfig)return;let Y=this.latestConfig.getSuccessRateEjectionConfig();if(!Y)return;Y9("Running success rate check");let W=Y.request_volume,z=0,F=[];for(let[G,q]of this.entryMap.entries()){let B=q.counter.getLastSuccesses(),$=q.counter.getLastFailures();if(Y9("Stats for "+(0,CA.endpointToString)(G)+": successes="+B+" failures="+$+" targetRequestVolume="+W),B+$>=W)z+=1,F.push(B/(B+$))}if(Y9("Found "+z+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+F+"]"),z<Y.minimum_hosts)return;let Q=F.reduce((G,q)=>G+q)/F.length,J=0;for(let G of F){let q=G-Q;J+=q*q}let Z=J/F.length,K=Math.sqrt(Z),H=Q-K*(Y.stdev_factor/1000);Y9("stdev="+K+" ejectionThreshold="+H);for(let[G,q]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let B=q.counter.getLastSuccesses(),$=q.counter.getLastFailures();if(B+$<W)continue;let R=B/(B+$);if(Y9("Checking candidate "+G+" successRate="+R),R<H){let E=Math.random()*100;if(Y9("Candidate "+G+" randomNumber="+E+" enforcement_percentage="+Y.enforcement_percentage),E<Y.enforcement_percentage)Y9("Ejecting candidate "+G),this.eject(q,X)}}}runFailurePercentageCheck(X){if(!this.latestConfig)return;let Y=this.latestConfig.getFailurePercentageEjectionConfig();if(!Y)return;Y9("Running failure percentage check. threshold="+Y.threshold+" request volume threshold="+Y.request_volume);let W=0;for(let z of this.entryMap.values()){let F=z.counter.getLastSuccesses(),Q=z.counter.getLastFailures();if(F+Q>=Y.request_volume)W+=1}if(W<Y.minimum_hosts)return;for(let[z,F]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let Q=F.counter.getLastSuccesses(),J=F.counter.getLastFailures();if(Y9("Candidate successes="+Q+" failures="+J),Q+J<Y.request_volume)continue;if(J*100/(J+Q)>Y.threshold){let K=Math.random()*100;if(Y9("Candidate "+z+" randomNumber="+K+" enforcement_percentage="+Y.enforcement_percentage),K<Y.enforcement_percentage)Y9("Ejecting candidate "+z),this.eject(F,X)}}}eject(X,Y){X.currentEjectionTimestamp=new Date,X.ejectionTimeMultiplier+=1;for(let W of X.subchannelWrappers)W.eject()}uneject(X){X.currentEjectionTimestamp=null;for(let Y of X.subchannelWrappers)Y.uneject()}switchAllBuckets(){for(let X of this.entryMap.values())X.counter.switchBuckets()}startTimer(X){var Y,W;this.ejectionTimer=setTimeout(()=>this.runChecks(),X),(W=(Y=this.ejectionTimer).unref)===null||W===void 0||W.call(Y)}runChecks(){let X=new Date;if(Y9("Ejection timer running"),this.switchAllBuckets(),!this.latestConfig)return;this.timerStartTime=X,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(X),this.runFailurePercentageCheck(X);for(let[Y,W]of this.entryMap.entries())if(W.currentEjectionTimestamp===null){if(W.ejectionTimeMultiplier>0)W.ejectionTimeMultiplier-=1}else{let z=this.latestConfig.getBaseEjectionTimeMs(),F=this.latestConfig.getMaxEjectionTimeMs(),Q=new Date(W.currentEjectionTimestamp.getTime());if(Q.setMilliseconds(Q.getMilliseconds()+Math.min(z*W.ejectionTimeMultiplier,Math.max(z,F))),Q<new Date)Y9("Unejecting "+Y),this.uneject(W)}}updateAddressList(X,Y,W,z){if(!(Y instanceof lQ))return!1;if(Y9("Received update with config: "+JSON.stringify(Y.toJsonObject(),void 0,2)),X.ok){for(let Q of X.value)if(!this.entryMap.has(Q))Y9("Adding map entry for "+(0,CA.endpointToString)(Q)),this.entryMap.set(Q,{counter:new yQ0,currentEjectionTimestamp:null,ejectionTimeMultiplier:0,subchannelWrappers:[]});this.entryMap.deleteMissing(X.value)}let F=Y.getChildPolicy();if(this.childBalancer.updateAddressList(X,F,W,z),Y.getSuccessRateEjectionConfig()||Y.getFailurePercentageEjectionConfig())if(this.timerStartTime){Y9("Previous timer existed. Replacing timer"),clearTimeout(this.ejectionTimer);let Q=Y.getIntervalMs()-(new Date().getTime()-this.timerStartTime.getTime());this.startTimer(Q)}else Y9("Starting new timer"),this.timerStartTime=new Date,this.startTimer(Y.getIntervalMs()),this.switchAllBuckets();else{Y9("Counting disabled. Cancelling timer."),this.timerStartTime=null,clearTimeout(this.ejectionTimer);for(let Q of this.entryMap.values())this.uneject(Q),Q.ejectionTimeMultiplier=0}return this.latestConfig=Y,!0}exitIdle(){this.childBalancer.exitIdle()}resetBackoff(){this.childBalancer.resetBackoff()}destroy(){clearTimeout(this.ejectionTimer),this.childBalancer.destroy()}getTypeName(){return LA}}vQ0.OutlierDetectionLoadBalancer=PA;function N71(){if(V71)(0,SQ0.registerLoadBalancerType)(LA,PA,lQ)}});var uQ0=X0((xQ0)=>{Object.defineProperty(xQ0,"__esModule",{value:!0});xQ0.PriorityQueue=void 0;var SY=0,wA=(X)=>Math.floor(X/2),DK=(X)=>X*2+1,pQ=(X)=>X*2+2;class _Q0{constructor(X=(Y,W)=>Y>W){this.comparator=X,this.heap=[]}size(){return this.heap.length}isEmpty(){return this.size()==0}peek(){return this.heap[SY]}push(...X){return X.forEach((Y)=>{this.heap.push(Y),this.siftUp()}),this.size()}pop(){let X=this.peek(),Y=this.size()-1;if(Y>SY)this.swap(SY,Y);return this.heap.pop(),this.siftDown(),X}replace(X){let Y=this.peek();return this.heap[SY]=X,this.siftDown(),Y}greater(X,Y){return this.comparator(this.heap[X],this.heap[Y])}swap(X,Y){[this.heap[X],this.heap[Y]]=[this.heap[Y],this.heap[X]]}siftUp(){let X=this.size()-1;while(X>SY&&this.greater(X,wA(X)))this.swap(X,wA(X)),X=wA(X)}siftDown(){let X=SY;while(DK(X)<this.size()&&this.greater(DK(X),X)||pQ(X)<this.size()&&this.greater(pQ(X),X)){let Y=pQ(X)<this.size()&&this.greater(pQ(X),DK(X))?pQ(X):DK(X);this.swap(X,Y),X=Y}}}xQ0.PriorityQueue=_Q0});var aQ0=X0((nQ0)=>{Object.defineProperty(nQ0,"__esModule",{value:!0});nQ0.WeightedRoundRobinLoadBalancingConfig=void 0;nQ0.setup=w71;var Z9=C9(),T71=a1(),n9=bQ(),dQ0=E5(),I71=gQ(),$71=A6(),cQ0=qK(),fY=b4(),D71=uQ0(),mQ0=y9(),E71="weighted_round_robin";function SA(X){$71.trace(T71.LogVerbosity.DEBUG,E71,X)}var fA="weighted_round_robin",C71=1e4,R71=1e4,M71=180000,L71=1000,P71=1;function gQ0(X,Y,W){if(Y in X&&X[Y]!==void 0&&typeof X[Y]!==W)throw Error(`weighted round robin config ${Y} parse error: expected ${W}, got ${typeof X[Y]}`)}function EK(X,Y){if(Y in X&&X[Y]!==void 0&&X[Y]!==null){let W;if((0,n9.isDuration)(X[Y]))W=X[Y];else if((0,n9.isDurationMessage)(X[Y]))W=(0,n9.durationMessageToDuration)(X[Y]);else if(typeof X[Y]==="string"){let z=(0,n9.parseDuration)(X[Y]);if(!z)throw Error(`weighted round robin config ${Y}: failed to parse duration string ${X[Y]}`);W=z}else throw Error(`weighted round robin config ${Y}: expected duration, got ${typeof X[Y]}`);return(0,n9.durationToMs)(W)}return null}class nQ{constructor(X,Y,W,z,F,Q){this.enableOobLoadReport=X!==null&&X!==void 0?X:!1,this.oobLoadReportingPeriodMs=Y!==null&&Y!==void 0?Y:C71,this.blackoutPeriodMs=W!==null&&W!==void 0?W:R71,this.weightExpirationPeriodMs=z!==null&&z!==void 0?z:M71,this.weightUpdatePeriodMs=Math.max(F!==null&&F!==void 0?F:L71,100),this.errorUtilizationPenalty=Q!==null&&Q!==void 0?Q:P71}getLoadBalancerName(){return fA}toJsonObject(){return{enable_oob_load_report:this.enableOobLoadReport,oob_load_reporting_period:(0,n9.durationToString)((0,n9.msToDuration)(this.oobLoadReportingPeriodMs)),blackout_period:(0,n9.durationToString)((0,n9.msToDuration)(this.blackoutPeriodMs)),weight_expiration_period:(0,n9.durationToString)((0,n9.msToDuration)(this.weightExpirationPeriodMs)),weight_update_period:(0,n9.durationToString)((0,n9.msToDuration)(this.weightUpdatePeriodMs)),error_utilization_penalty:this.errorUtilizationPenalty}}static createFromJson(X){if(gQ0(X,"enable_oob_load_report","boolean"),gQ0(X,"error_utilization_penalty","number"),X.error_utilization_penalty<0)throw Error("weighted round robin config error_utilization_penalty < 0");return new nQ(X.enable_oob_load_report,EK(X,"oob_load_reporting_period"),EK(X,"blackout_period"),EK(X,"weight_expiration_period"),EK(X,"weight_update_period"),X.error_utilization_penalty)}getEnableOobLoadReport(){return this.enableOobLoadReport}getOobLoadReportingPeriodMs(){return this.oobLoadReportingPeriodMs}getBlackoutPeriodMs(){return this.blackoutPeriodMs}getWeightExpirationPeriodMs(){return this.weightExpirationPeriodMs}getWeightUpdatePeriodMs(){return this.weightUpdatePeriodMs}getErrorUtilizationPenalty(){return this.errorUtilizationPenalty}}nQ0.WeightedRoundRobinLoadBalancingConfig=nQ;class lQ0{constructor(X,Y){this.metricsHandler=Y,this.queue=new D71.PriorityQueue((F,Q)=>F.deadline<Q.deadline);let W=X.filter((F)=>F.weight>0),z;if(W.length<2)z=1;else{let F=0;for(let{weight:Q}of W)F+=Q;z=F/W.length}for(let F of X){let Q=F.weight>0?1/F.weight:z;this.queue.push({endpointName:F.endpointName,picker:F.picker,period:Q,deadline:Math.random()*Q})}}pick(X){let Y=this.queue.pop();this.queue.push(Object.assign(Object.assign({},Y),{deadline:Y.deadline+Y.period}));let W=Y.picker.pick(X);if(W.pickResultType===fY.PickResultType.COMPLETE)if(this.metricsHandler)return Object.assign(Object.assign({},W),{onCallEnded:(0,cQ0.createMetricsReader)((z)=>this.metricsHandler(z,Y.endpointName),W.onCallEnded)});else{let z=W.subchannel;return Object.assign(Object.assign({},W),{subchannel:z.getWrappedSubchannel()})}else return W}}class pQ0{constructor(X){this.channelControlHelper=X,this.latestConfig=null,this.children=new Map,this.currentState=Z9.ConnectivityState.IDLE,this.updatesPaused=!1,this.lastError=null,this.weightUpdateTimer=null}countChildrenWithState(X){let Y=0;for(let W of this.children.values())if(W.child.getConnectivityState()===X)Y+=1;return Y}updateWeight(X,Y){var W,z;let{rps_fractional:F,application_utilization:Q}=Y;if(Q>0&&F>0)Q+=Y.eps/F*((z=(W=this.latestConfig)===null||W===void 0?void 0:W.getErrorUtilizationPenalty())!==null&&z!==void 0?z:0);let J=Q===0?0:F/Q;if(J===0)return;let Z=new Date;if(X.nonEmptySince===null)X.nonEmptySince=Z;X.lastUpdated=Z,X.weight=J}getWeight(X){if(!this.latestConfig)return 0;let Y=new Date().getTime();if(Y-X.lastUpdated.getTime()>=this.latestConfig.getWeightExpirationPeriodMs())return X.nonEmptySince=null,0;let W=this.latestConfig.getBlackoutPeriodMs();if(W>0&&(X.nonEmptySince===null||Y-X.nonEmptySince.getTime()<W))return 0;return X.weight}calculateAndUpdateState(){if(this.updatesPaused||!this.latestConfig)return;if(this.countChildrenWithState(Z9.ConnectivityState.READY)>0){let X=[];for(let[W,z]of this.children){if(z.child.getConnectivityState()!==Z9.ConnectivityState.READY)continue;X.push({endpointName:W,picker:z.child.getPicker(),weight:this.getWeight(z)})}SA("Created picker with weights: "+X.map((W)=>W.endpointName+":"+W.weight).join(","));let Y;if(!this.latestConfig.getEnableOobLoadReport())Y=(W,z)=>{let F=this.children.get(z);if(F)this.updateWeight(F,W)};else Y=null;this.updateState(Z9.ConnectivityState.READY,new lQ0(X,Y),null)}else if(this.countChildrenWithState(Z9.ConnectivityState.CONNECTING)>0)this.updateState(Z9.ConnectivityState.CONNECTING,new fY.QueuePicker(this),null);else if(this.countChildrenWithState(Z9.ConnectivityState.TRANSIENT_FAILURE)>0){let X=`weighted_round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(Z9.ConnectivityState.TRANSIENT_FAILURE,new fY.UnavailablePicker({details:X}),X)}else this.updateState(Z9.ConnectivityState.IDLE,new fY.QueuePicker(this),null);for(let{child:X}of this.children.values())if(X.getConnectivityState()===Z9.ConnectivityState.IDLE)X.exitIdle()}updateState(X,Y,W){SA(Z9.ConnectivityState[this.currentState]+" -> "+Z9.ConnectivityState[X]),this.currentState=X,this.channelControlHelper.updateState(X,Y,W)}updateAddressList(X,Y,W,z){var F,Q;if(!(Y instanceof nQ))return!1;if(!X.ok){if(this.children.size===0)this.updateState(Z9.ConnectivityState.TRANSIENT_FAILURE,new fY.UnavailablePicker(X.error),X.error.details);return!0}if(X.value.length===0){let K=`No addresses resolved. Resolution note: ${z}`;return this.updateState(Z9.ConnectivityState.TRANSIENT_FAILURE,new fY.UnavailablePicker({details:K}),K),!1}SA("Connect to endpoint list "+X.value.map(mQ0.endpointToString));let J=new Date,Z=new Set;this.updatesPaused=!0,this.latestConfig=Y;for(let K of X.value){let H=(0,mQ0.endpointToString)(K);Z.add(H);let G=this.children.get(H);if(!G)G={child:new I71.LeafLoadBalancer(K,(0,dQ0.createChildChannelControlHelper)(this.channelControlHelper,{updateState:(q,B,$)=>{if(this.currentState===Z9.ConnectivityState.READY&&q!==Z9.ConnectivityState.READY)this.channelControlHelper.requestReresolution();if(q===Z9.ConnectivityState.READY)G.nonEmptySince=null;if($)this.lastError=$;this.calculateAndUpdateState()},createSubchannel:(q,B)=>{let $=this.channelControlHelper.createSubchannel(q,B);if(G===null||G===void 0?void 0:G.oobMetricsListener)return new cQ0.OrcaOobMetricsSubchannelWrapper($,G.oobMetricsListener,this.latestConfig.getOobLoadReportingPeriodMs());else return $}}),W,z),lastUpdated:J,nonEmptySince:null,weight:0,oobMetricsListener:null},this.children.set(H,G);if(Y.getEnableOobLoadReport())G.oobMetricsListener=(q)=>{this.updateWeight(G,q)};else G.oobMetricsListener=null}for(let[K,H]of this.children)if(Z.has(K))H.child.startConnecting();else H.child.destroy(),this.children.delete(K);if(this.updatesPaused=!1,this.calculateAndUpdateState(),this.weightUpdateTimer)clearInterval(this.weightUpdateTimer);return this.weightUpdateTimer=(Q=(F=setInterval(()=>{if(this.currentState===Z9.ConnectivityState.READY)this.calculateAndUpdateState()},Y.getWeightUpdatePeriodMs())).unref)===null||Q===void 0?void 0:Q.call(F),!0}exitIdle(){}resetBackoff(){}destroy(){for(let X of this.children.values())X.child.destroy();if(this.children.clear(),this.weightUpdateTimer)clearInterval(this.weightUpdateTimer)}getTypeName(){return fA}}function w71(){(0,dQ0.registerLoadBalancerType)(fA,pQ0,nQ)}});var iQ=X0((q6)=>{Object.defineProperty(q6,"__esModule",{value:!0});q6.experimental=q6.ServerMetricRecorder=q6.ServerInterceptingCall=q6.ResponderBuilder=q6.ServerListenerBuilder=q6.addAdminServicesToServer=q6.getChannelzHandlers=q6.getChannelzServiceDefinition=q6.InterceptorConfigurationError=q6.InterceptingCall=q6.RequesterBuilder=q6.ListenerBuilder=q6.StatusBuilder=q6.getClientChannel=q6.ServerCredentials=q6.Server=q6.setLogVerbosity=q6.setLogger=q6.load=q6.loadObject=q6.CallCredentials=q6.ChannelCredentials=q6.waitForClientReady=q6.closeClient=q6.Channel=q6.makeGenericClientConstructor=q6.makeClientConstructor=q6.loadPackageDefinition=q6.Client=q6.compressionAlgorithms=q6.propagate=q6.connectivityState=q6.status=q6.logVerbosity=q6.Metadata=q6.credentials=void 0;var CK=GG();Object.defineProperty(q6,"CallCredentials",{enumerable:!0,get:function(){return CK.CallCredentials}});var f71=fU();Object.defineProperty(q6,"Channel",{enumerable:!0,get:function(){return f71.ChannelImplementation}});var y71=PN();Object.defineProperty(q6,"compressionAlgorithms",{enumerable:!0,get:function(){return y71.CompressionAlgorithms}});var k71=C9();Object.defineProperty(q6,"connectivityState",{enumerable:!0,get:function(){return k71.ConnectivityState}});var RK=ZY();Object.defineProperty(q6,"ChannelCredentials",{enumerable:!0,get:function(){return RK.ChannelCredentials}});var rQ0=SU();Object.defineProperty(q6,"Client",{enumerable:!0,get:function(){return rQ0.Client}});var yA=a1();Object.defineProperty(q6,"logVerbosity",{enumerable:!0,get:function(){return yA.LogVerbosity}});Object.defineProperty(q6,"status",{enumerable:!0,get:function(){return yA.Status}});Object.defineProperty(q6,"propagate",{enumerable:!0,get:function(){return yA.Propagate}});var oQ0=A6(),kA=TG();Object.defineProperty(q6,"loadPackageDefinition",{enumerable:!0,get:function(){return kA.loadPackageDefinition}});Object.defineProperty(q6,"makeClientConstructor",{enumerable:!0,get:function(){return kA.makeClientConstructor}});Object.defineProperty(q6,"makeGenericClientConstructor",{enumerable:!0,get:function(){return kA.makeClientConstructor}});var v71=s6();Object.defineProperty(q6,"Metadata",{enumerable:!0,get:function(){return v71.Metadata}});var j71=dZ0();Object.defineProperty(q6,"Server",{enumerable:!0,get:function(){return j71.Server}});var h71=FK();Object.defineProperty(q6,"ServerCredentials",{enumerable:!0,get:function(){return h71.ServerCredentials}});var _71=nZ0();Object.defineProperty(q6,"StatusBuilder",{enumerable:!0,get:function(){return _71.StatusBuilder}});q6.credentials={combineChannelCredentials:(X,...Y)=>{return Y.reduce((W,z)=>W.compose(z),X)},combineCallCredentials:(X,...Y)=>{return Y.reduce((W,z)=>W.compose(z),X)},createInsecure:RK.ChannelCredentials.createInsecure,createSsl:RK.ChannelCredentials.createSsl,createFromSecureContext:RK.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:CK.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:CK.CallCredentials.createFromGoogleCredential,createEmpty:CK.CallCredentials.createEmpty};var x71=(X)=>X.close();q6.closeClient=x71;var b71=(X,Y,W)=>X.waitForReady(Y,W);q6.waitForClientReady=b71;var u71=(X,Y)=>{throw Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};q6.loadObject=u71;var m71=(X,Y,W)=>{throw Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};q6.load=m71;var g71=(X)=>{oQ0.setLogger(X)};q6.setLogger=g71;var d71=(X)=>{oQ0.setLoggerVerbosity(X)};q6.setLogVerbosity=d71;var c71=(X)=>{return rQ0.Client.prototype.getChannel.call(X)};q6.getClientChannel=c71;var MK=PU();Object.defineProperty(q6,"ListenerBuilder",{enumerable:!0,get:function(){return MK.ListenerBuilder}});Object.defineProperty(q6,"RequesterBuilder",{enumerable:!0,get:function(){return MK.RequesterBuilder}});Object.defineProperty(q6,"InterceptingCall",{enumerable:!0,get:function(){return MK.InterceptingCall}});Object.defineProperty(q6,"InterceptorConfigurationError",{enumerable:!0,get:function(){return MK.InterceptorConfigurationError}});var tQ0=S5();Object.defineProperty(q6,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return tQ0.getChannelzServiceDefinition}});Object.defineProperty(q6,"getChannelzHandlers",{enumerable:!0,get:function(){return tQ0.getChannelzHandlers}});var l71=AG();Object.defineProperty(q6,"addAdminServicesToServer",{enumerable:!0,get:function(){return l71.addAdminServicesToServer}});var vA=FA();Object.defineProperty(q6,"ServerListenerBuilder",{enumerable:!0,get:function(){return vA.ServerListenerBuilder}});Object.defineProperty(q6,"ResponderBuilder",{enumerable:!0,get:function(){return vA.ResponderBuilder}});Object.defineProperty(q6,"ServerInterceptingCall",{enumerable:!0,get:function(){return vA.ServerInterceptingCall}});var p71=qK();Object.defineProperty(q6,"ServerMetricRecorder",{enumerable:!0,get:function(){return p71.ServerMetricRecorder}});var n71=AA();q6.experimental=n71;var i71=bN(),a71=BQ0(),r71=$Q0(),o71=gQ(),t71=PQ0(),s71=hQ0(),e71=aQ0(),XX1=S5();(()=>{i71.setup(),a71.setup(),r71.setup(),o71.setup(),t71.setup(),s71.setup(),e71.setup(),XX1.setup()})()});import{createMcpTools as PP1,createTool as wP1,getClineDefaultSystemPrompt as SP1}from"@clinebot/agents";import*as fP1 from"@clinebot/llms/models";import*as yP1 from"@clinebot/llms/providers";var M60=["cline","oca","openai-codex"];function H3(X){return M60.includes(X)}var L60=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function cV(X,Y){if(!H3(Y))return!1;let W=X instanceof Error?X.message.toLowerCase():String(X);return L60.some((z)=>W.includes(z))}import{z as c1}from"zod";var P60=c1.enum(["connector.started","connector.stopping","session.authorize","message.received","message.denied","message.completed","message.failed","session.started","session.reused","session.reset","schedule.delivery.started","schedule.delivery.sent","schedule.delivery.failed"]),w60=c1.object({id:c1.string().optional(),label:c1.string().optional(),role:c1.string().optional(),participantKey:c1.string().optional(),participantLabel:c1.string().optional(),platformUserId:c1.string().optional(),metadata:c1.record(c1.string(),c1.unknown()).optional()}),S60=c1.object({source:c1.string(),sourceEvent:c1.string(),threadId:c1.string(),channelId:c1.string(),isDM:c1.boolean(),sessionId:c1.string().optional(),workspaceRoot:c1.string().optional(),metadata:c1.record(c1.string(),c1.unknown()).optional()}),bi0=c1.object({actor:w60,context:S60,payload:c1.record(c1.string(),c1.unknown()).optional()}),ui0=c1.object({action:c1.enum(["allow","deny"]).default("allow"),message:c1.string().optional(),reason:c1.string().optional(),metadata:c1.record(c1.string(),c1.unknown()).optional()}),mi0=c1.object({adapter:c1.string(),botUserName:c1.string().optional(),event:P60,payload:c1.record(c1.string(),c1.unknown()),ts:c1.string()});var f60=[{modelsDevKey:"openai",generatedProviderId:"openai",runtimeProviderId:"openai-native"},{modelsDevKey:"openai",generatedProviderId:"openai",runtimeProviderId:"openai-codex"},{modelsDevKey:"anthropic",generatedProviderId:"anthropic"},{modelsDevKey:"anthropic",generatedProviderId:"anthropic",runtimeProviderId:"claude-code"},{modelsDevKey:"google",generatedProviderId:"gemini"},{modelsDevKey:"deepseek",generatedProviderId:"deepseek"},{modelsDevKey:"xai",generatedProviderId:"xai"},{modelsDevKey:"togetherai",runtimeProviderId:"together",generatedProviderId:"together"},{modelsDevKey:"sap-ai-core",runtimeProviderId:"sapaicore",generatedProviderId:"sapaicore"},{modelsDevKey:"fireworks-ai",runtimeProviderId:"fireworks",generatedProviderId:"fireworks"},{modelsDevKey:"groq",runtimeProviderId:"groq",generatedProviderId:"groq"},{modelsDevKey:"cerebras",runtimeProviderId:"cerebras",generatedProviderId:"cerebras"},{modelsDevKey:"sambanova",runtimeProviderId:"sambanova",generatedProviderId:"sambanova"},{modelsDevKey:"nebius",runtimeProviderId:"nebius",generatedProviderId:"nebius"},{modelsDevKey:"huggingface",runtimeProviderId:"huggingface",generatedProviderId:"huggingface"},{modelsDevKey:"openrouter",runtimeProviderId:"cline",generatedProviderId:"openrouter"},{modelsDevKey:"ollama",runtimeProviderId:"ollama-cloud"},{modelsDevKey:"ollama-cloud",generatedProviderId:"ollama"},{modelsDevKey:"vercel",runtimeProviderId:"dify",generatedProviderId:"vercel-ai-gateway"},{modelsDevKey:"vercel",generatedProviderId:"vercel-ai-gateway"},{modelsDevKey:"aihubmix",runtimeProviderId:"aihubmix",generatedProviderId:"aihubmix"},{modelsDevKey:"hicap",runtimeProviderId:"hicap"},{modelsDevKey:"nous-research",runtimeProviderId:"nousResearch"},{modelsDevKey:"huawei-cloud-maas",runtimeProviderId:"huawei-cloud-maas"},{modelsDevKey:"baseten",runtimeProviderId:"baseten",generatedProviderId:"baseten"},{modelsDevKey:"google-vertex-anthropic",generatedProviderId:"vertex"},{modelsDevKey:"lmstudio",generatedProviderId:"lmstudio"},{modelsDevKey:"zai",generatedProviderId:"zai"},{modelsDevKey:"requesty",generatedProviderId:"requesty"},{modelsDevKey:"amazon-bedrock",generatedProviderId:"bedrock"},{modelsDevKey:"moonshotai",generatedProviderId:"moonshot"},{modelsDevKey:"minimax",generatedProviderId:"minimax"},{modelsDevKey:"wandb",generatedProviderId:"wandb"},{modelsDevKey:"kilo",generatedProviderId:"kilo"},{modelsDevKey:"xiaomi",generatedProviderId:"xiaomi"}];function gi0(X){return Object.fromEntries(f60.flatMap((Y)=>{let W=X==="modelsDevKey"?Y.modelsDevKey:Y.generatedProviderId;return W?[[Y.modelsDevKey,W]]:[]}))}var di0=gi0("generatedProviderId");import{z as H9}from"zod";var ci0=H9.object({agentId:H9.string(),conversationId:H9.string(),iteration:H9.number(),abortSignal:H9.custom().optional(),metadata:H9.record(H9.string(),H9.unknown()).optional()}),li0=H9.object({id:H9.string(),name:H9.string(),input:H9.unknown(),output:H9.unknown(),error:H9.string().optional(),durationMs:H9.number(),startedAt:H9.date(),endedAt:H9.date()});function pi0(X){let Y=X.replaceAll("\\","/"),W=Y.lastIndexOf("/");return(W>=0?Y.slice(W+1):Y).toLowerCase()}function lV(X){return X==="win32"?"powershell":"/bin/bash"}function pV(X,Y){let W=pi0(X);if(W==="powershell"||W==="powershell.exe"||W==="pwsh"||W==="pwsh.exe")return["-NoProfile","-NonInteractive","-Command",Y];if(W==="cmd"||W==="cmd.exe")return["/d","/s","/c",Y];return["-c",Y]}import{z as y60}from"zod";function m9(X,Y){let W=X.safeParse(Y);if(!W.success)throw Error(y60.prettifyError(W.error));return W.data}function W8(X){return y60.toJSONSchema(X)}function nV(X,Y="act"){return`<user_input mode="${Y}">${X}</user_input>`}function cX(X){if(!X?.trim())return"";let Y=k60(X,"user_input");return(Y!==X?Y:X.replace(/<user_input[^>]*>/g,"")).trim()}function k60(X,Y){if(!X?.trim())return"";if(!Y)return X;let W=new RegExp(`<${Y}.*?>(.*?)</${Y}>`,"g");return X.replace(W,"$1")}import{z as a0}from"zod";var v60=a0.object({id:a0.string(),temperature:a0.number().optional(),isR1FormatRequired:a0.boolean().optional(),maxTokens:a0.number().optional(),contextWindow:a0.number().optional(),inputPrice:a0.number().optional(),outputPrice:a0.number().optional(),supportsImages:a0.boolean().optional()}),j60=a0.object({models:a0.array(v60).optional(),openAiBaseUrl:a0.string().optional(),openAiHeaders:a0.record(a0.string(),a0.string()).optional(),azureApiVersion:a0.string().optional(),azureIdentity:a0.boolean().optional()}),h60=a0.object({id:a0.string(),thinkingBudgetTokens:a0.number().optional()}),_60=a0.object({name:a0.string(),baseModelId:a0.string(),thinkingBudgetTokens:a0.number().optional()}),x60=a0.object({models:a0.array(h60).optional(),customModels:a0.array(_60).optional(),awsRegion:a0.string().optional(),awsUseCrossRegionInference:a0.boolean().optional(),awsUseGlobalInference:a0.boolean().optional(),awsBedrockUsePromptCache:a0.boolean().optional(),awsBedrockEndpoint:a0.string().optional()}),b60=a0.object({id:a0.string()}),u60=a0.object({models:a0.array(b60).optional()}),m60=a0.object({id:a0.string(),thinkingBudgetTokens:a0.number().optional()}),g60=a0.object({models:a0.array(m60).optional(),vertexProjectId:a0.string().optional(),vertexRegion:a0.string().optional()}),d60=a0.object({id:a0.string(),thinkingBudgetTokens:a0.number().optional(),promptCachingEnabled:a0.boolean().optional()}),c60=a0.object({models:a0.array(d60).optional(),baseUrl:a0.string().optional()}),l60=a0.object({id:a0.string(),thinkingBudgetTokens:a0.number().optional()}),p60=a0.object({models:a0.array(l60).optional(),baseUrl:a0.string().optional()}),ni0=a0.object({OpenAiCompatible:j60.optional(),AwsBedrock:x60.optional(),Cline:u60.optional(),Vertex:g60.optional(),LiteLLM:c60.optional(),Anthropic:p60.optional()}),n60=a0.object({id:a0.string()}),i60=a0.object({name:a0.string(),url:a0.string(),alwaysEnabled:a0.boolean().optional(),headers:a0.record(a0.string(),a0.string()).optional()}),iV=a0.object({alwaysEnabled:a0.boolean(),name:a0.string(),contents:a0.string()}),aV=a0.object({bucket:a0.string(),accessKeyId:a0.string(),secretAccessKey:a0.string(),region:a0.string().optional(),endpoint:a0.string().optional(),accountId:a0.string().optional(),intervalMs:a0.number().optional(),maxRetries:a0.number().optional(),batchSize:a0.number().optional(),maxQueueSize:a0.number().optional(),maxFailedAgeMs:a0.number().optional(),backfillEnabled:a0.boolean().optional()}),a60=a0.object({enabled:a0.boolean().optional(),type:a0.union([a0.literal("s3_access_keys"),a0.literal("r2_access_keys")]).optional(),s3AccessSettings:aV.optional(),r2AccessSettings:aV.optional()}),r60=a0.object({promptUploading:a60.optional()}),ii0=a0.object({version:a0.string(),providerSettings:ni0.optional(),telemetryEnabled:a0.boolean().optional(),kanbanEnabled:a0.boolean().optional(),mcpMarketplaceEnabled:a0.boolean().optional(),allowedMCPServers:a0.array(n60).optional(),remoteMCPServers:a0.array(i60).optional(),blockPersonalRemoteMCPServers:a0.boolean().optional(),yoloModeAllowed:a0.boolean().optional(),openTelemetryEnabled:a0.boolean().optional(),openTelemetryMetricsExporter:a0.string().optional(),openTelemetryLogsExporter:a0.string().optional(),openTelemetryOtlpProtocol:a0.string().optional(),openTelemetryOtlpEndpoint:a0.string().optional(),openTelemetryOtlpHeaders:a0.record(a0.string(),a0.string()).optional(),openTelemetryOtlpMetricsProtocol:a0.string().optional(),openTelemetryOtlpMetricsEndpoint:a0.string().optional(),openTelemetryOtlpMetricsHeaders:a0.record(a0.string(),a0.string()).optional(),openTelemetryOtlpLogsProtocol:a0.string().optional(),openTelemetryOtlpLogsEndpoint:a0.string().optional(),openTelemetryOtlpLogsHeaders:a0.record(a0.string(),a0.string()).optional(),openTelemetryMetricExportInterval:a0.number().optional(),openTelemetryOtlpInsecure:a0.boolean().optional(),openTelemetryLogBatchSize:a0.number().optional(),openTelemetryLogBatchTimeout:a0.number().optional(),openTelemetryLogMaxQueueSize:a0.number().optional(),enterpriseTelemetry:r60.optional(),globalRules:a0.array(iV).optional(),globalWorkflows:a0.array(iV).optional()}),ai0=a0.record(a0.string(),a0.string());var rV="127.0.0.1:4317";var V3="runtime.team.progress.v1",B3="runtime.team.lifecycle.v1";function o60(X){let Y=X?.trim();return Y?Y:void 0}function U3(X){return o60(X?.rootSessionId)}function t60(X){return o60(X?.hookLogPath)}import{nanoid as ri0}from"nanoid";function oV(X="",Y=""){return`${X}${Date.now()}_${ri0(5)}${Y}`}var tV=["running","completed","failed","cancelled"];w6();class sV{apiBaseUrl;getAuthTokenFn;getCurrentUserIdFn;getOrganizationMemberIdFn;getHeadersFn;requestTimeoutMs;fetchImpl;constructor(X){let Y=X.apiBaseUrl.trim();if(!Y)throw Error("apiBaseUrl is required");this.apiBaseUrl=Y,this.getAuthTokenFn=X.getAuthToken,this.getCurrentUserIdFn=X.getCurrentUserId,this.getOrganizationMemberIdFn=X.getOrganizationMemberId,this.getHeadersFn=X.getHeaders,this.requestTimeoutMs=X.requestTimeoutMs??30000,this.fetchImpl=X.fetchImpl??fetch}async fetchMe(){return this.request("/api/v1/users/me")}async fetchRemoteConfig(){return this.request("/api/v1/users/me/remote-config")}async fetchFeaturebaseToken(){try{return await this.request("/api/v1/users/me/featurebase-token")}catch{return}}async fetchBalance(X){let Y=await this.resolveUserId(X);return this.request(`/api/v1/users/${encodeURIComponent(Y)}/balance`)}async fetchUsageTransactions(X){let Y=await this.resolveUserId(X);return(await this.request(`/api/v1/users/${encodeURIComponent(Y)}/usages`)).items??[]}async fetchPaymentTransactions(X){let Y=await this.resolveUserId(X);return(await this.request(`/api/v1/users/${encodeURIComponent(Y)}/payments`)).paymentTransactions??[]}async fetchUserOrganizations(){return(await this.fetchMe()).organizations??[]}async fetchOrganization(X){let Y=X.trim();if(!Y)throw Error("organizationId is required");return this.request(`/api/v1/organizations/${encodeURIComponent(Y)}`)}async fetchOrganizationBalance(X){let Y=X.trim();if(!Y)throw Error("organizationId is required");return this.request(`/api/v1/organizations/${encodeURIComponent(Y)}/balance`)}async fetchOrganizationUsageTransactions(X){let Y=X.organizationId.trim();if(!Y)throw Error("organizationId is required");let W=await this.resolveOrganizationMemberId(Y,X.memberId);return(await this.request(`/api/v1/organizations/${encodeURIComponent(Y)}/members/${encodeURIComponent(W)}/usages`)).items??[]}async switchAccount(X){await this.request("/api/v1/users/active-account",{method:"PUT",body:{organizationId:X?.trim()||null},expectNoContent:!0})}async resolveUserId(X){let Y=X?.trim();if(Y)return Y;let z=(this.getCurrentUserIdFn?await this.getCurrentUserIdFn():void 0)?.trim();if(z)return z;let F=await this.fetchMe();if(!F.id?.trim())throw Error("Unable to resolve current user id");return F.id}async resolveOrganizationMemberId(X,Y){let W=Y?.trim();if(W)return W;let F=(this.getOrganizationMemberIdFn?await this.getOrganizationMemberIdFn(X):void 0)?.trim();if(F)return F;let J=(await this.fetchUserOrganizations()).find((Z)=>Z.organizationId===X)?.memberId;if(!J?.trim())throw Error(`Unable to resolve memberId for organization ${X}`);return J}async request(X,Y){let W=(await this.getAuthTokenFn())?.trim();if(!W)throw Error("No Cline account auth token found");let z=this.getHeadersFn?await this.getHeadersFn():{},F=new AbortController,Q=setTimeout(()=>F.abort(),this.requestTimeoutMs);try{let J=await this.fetchImpl(new URL(X,this.apiBaseUrl),{method:Y?.method??"GET",headers:{Authorization:`Bearer ${W}`,"Content-Type":"application/json",...z??{}},body:Y?.body!==void 0?JSON.stringify(Y.body):void 0,signal:F.signal});if(J.status===204||Y?.expectNoContent){if(!J.ok)throw Error(`Cline account request failed with status ${J.status}`);return}let Z=await J.text(),K;if(Z.trim())K=JSON.parse(Z);if(!J.ok){let H=typeof K==="object"&&K!==null&&"error"in K?String(K.error):`Cline account request failed with status ${J.status}`;throw Error(H)}if(typeof K==="object"&&K!==null){let H=K;if(typeof H.success==="boolean"){if(!H.success)throw Error(H.error||"Cline account request failed");if(H.data!==void 0)return H.data}}if(K===void 0||K===null)throw Error("Cline account response payload was empty");return K}finally{clearTimeout(Q)}}}function s60(X){return X.action==="clineAccount"}async function e60(X,Y){switch(X.operation){case"fetchMe":return Y.fetchMe();case"fetchBalance":return Y.fetchBalance(X.userId);case"fetchUsageTransactions":return Y.fetchUsageTransactions(X.userId);case"fetchPaymentTransactions":return Y.fetchPaymentTransactions(X.userId);case"fetchUserOrganizations":return Y.fetchUserOrganizations();case"fetchOrganizationBalance":return Y.fetchOrganizationBalance(X.organizationId);case"fetchOrganizationUsageTransactions":return Y.fetchOrganizationUsageTransactions({organizationId:X.organizationId,memberId:X.memberId});case"switchAccount":return await Y.switchAccount(X.organizationId),{updated:!0};case"fetchFeaturebaseToken":return Y.fetchFeaturebaseToken?.();default:throw Error(`Unsupported Cline account operation: ${String(X)}`)}}class eV{executor;constructor(X){this.executor=X}async fetchMe(){return this.request({action:"clineAccount",operation:"fetchMe"})}async fetchBalance(X){return this.request({action:"clineAccount",operation:"fetchBalance",...X?.trim()?{userId:X.trim()}:{}})}async fetchUsageTransactions(X){return this.request({action:"clineAccount",operation:"fetchUsageTransactions",...X?.trim()?{userId:X.trim()}:{}})}async fetchPaymentTransactions(X){return this.request({action:"clineAccount",operation:"fetchPaymentTransactions",...X?.trim()?{userId:X.trim()}:{}})}async fetchUserOrganizations(){return this.request({action:"clineAccount",operation:"fetchUserOrganizations"})}async fetchOrganizationBalance(X){let Y=X.trim();if(!Y)throw Error("organizationId is required");return this.request({action:"clineAccount",operation:"fetchOrganizationBalance",organizationId:Y})}async fetchOrganizationUsageTransactions(X){let Y=X.organizationId.trim();if(!Y)throw Error("organizationId is required");return this.request({action:"clineAccount",operation:"fetchOrganizationUsageTransactions",organizationId:Y,...X.memberId?.trim()?{memberId:X.memberId.trim()}:{}})}async switchAccount(X){await this.request({action:"clineAccount",operation:"switchAccount",organizationId:X?.trim()||null})}async fetchFeaturebaseToken(){return this.request({action:"clineAccount",operation:"fetchFeaturebaseToken"})}async request(X){return(await this.executor.runProviderAction(X)).result}}w6();import ga0 from"yaml";import{z as z8}from"zod";var X4={READ_FILES:"read_files",SEARCH_CODEBASE:"search_codebase",RUN_COMMANDS:"run_commands",FETCH_WEB_CONTENT:"fetch_web_content",APPLY_PATCH:"apply_patch",EDITOR:"editor",SKILLS:"skills",ASK:"ask_question"},E7=[X4.READ_FILES,X4.SEARCH_CODEBASE,X4.RUN_COMMANDS,X4.FETCH_WEB_CONTENT,X4.APPLY_PATCH,X4.EDITOR,X4.SKILLS,X4.ASK];import{createTool as _4}from"@clinebot/agents";import{z as T1}from"zod";var O5=6000,Y90=T1.string().describe("The absolute file path of a text file to read content from"),X90=T1.object({start_line:T1.number().int().positive().nullable().optional().describe("Optional one-based starting line number to read from; use null or omit for the start of the file"),end_line:T1.number().int().positive().nullable().optional().describe("Optional one-based ending line number to read through; use null or omit for the end of the file")}).refine(({start_line:X,end_line:Y})=>X==null||Y==null||X<=Y,{message:"start_line must be less than or equal to end_line",path:["end_line"]}),rZ=T1.object({path:Y90,start_line:X90.shape.start_line,end_line:X90.shape.end_line}).refine(({start_line:X,end_line:Y})=>X==null||Y==null||X<=Y,{message:"start_line must be less than or equal to end_line",path:["end_line"]}),N3=T1.object({files:T1.array(rZ).describe("Array of file read requests. Omit start_line/end_line or set them to null to return the full file content boundaries; provide integers to return only that inclusive one-based line range. Prefer this tool over running terminal command to get file content for better performance and reliability.")}),Z90=T1.union([N3,rZ,T1.array(rZ),T1.array(T1.string()),T1.string(),T1.object({files:rZ}),T1.object({file_paths:T1.array(Y90)}),T1.object({file_paths:T1.string()})]),A3=T1.object({queries:T1.array(T1.string()).describe("Array of regex search queries to execute")}),Q90=T1.union([A3,T1.array(T1.string()),T1.string(),T1.object({queries:T1.string()})]),YB=T1.string().describe(`The non-interactive shell command to execute - MUST keep input short and concise (within ${O5*2} characters) to avoid timeouts.`),oZ=T1.object({commands:T1.array(YB).describe("Array of shell commands to execute")}),J90=T1.union([oZ,T1.object({commands:YB}),T1.array(T1.string()),T1.string()]),XB=T1.object({command:T1.string().min(1).describe("The executable to run directly without shell parsing."),args:T1.array(T1.string()).optional().describe("Optional argv list passed directly to the executable.")}),W90=T1.union([YB,XB]),oi0=T1.object({commands:T1.array(W90).describe("Array of commands to execute. Prefer structured { command, args } entries for portability; plain strings are still supported and are interpreted by the active shell.")}),O3=T1.union([oZ,oi0,T1.object({commands:W90}),T1.array(T1.string()),T1.array(XB),T1.string(),XB]),G90=T1.object({url:T1.string().describe("The URL to fetch"),prompt:T1.string().min(2).describe("Analysis prompt for the fetched content")}),T3=T1.object({requests:T1.array(G90).describe("Array of the URLs for the web fetch requests")}),I3=T1.object({path:T1.string().min(1).describe("The absolute file path for the action to be performed on"),old_text:T1.string().nullable().optional().describe(`Exact text to replace (must match exactly once). Omit this when creating a missing file or inserting via insert_line. Keep this at or below ${O5} characters when possible; larger payloads should be split across multiple tool calls to avoid timeouts.`),new_text:T1.string().describe(`The new content to write when creating a missing file, the replacement text for edits, or the inserted text when insert_line is provided. Keep this at or below ${O5} characters when possible; for large edits, use multiple calls with small chunks of old_text and new_text to iteratively edit the file.`),insert_line:T1.number().int().nullable().optional().describe("Optional one-based line index. When provided, the tool inserts new_text at that line instead of performing a replacement edit.")}).describe("Edit a text file by replacing old_text with new_text, create the file with new_text if it does not exist, or insert new_text at insert_line when insert_line is provided. Prefer using this tool for file edits over shell commands. IMPORTANT: large edits can time out, so use small chunks and multiple calls when possible."),$3=T1.object({input:T1.string().min(1).describe("The apply_patch text payload, including patch instructions")}).describe("Modify or create a text file by applying patches. Prefer using this tool for file edits over shell commands. IMPORTANT: large patches can time out, so use small chunks and multiple calls when possible."),K90=T1.union([$3,T1.string()]),D3=T1.object({skill:T1.string().min(1).describe("Name of the skill to execute."),args:T1.string().nullable().optional().describe("Arguments for the skill; use null when omitted")}),E3=T1.object({question:T1.string().min(1).describe('The single question to ask the user. E.g. "How can I help you?"'),options:T1.array(T1.string().min(1)).min(2).max(5).describe("Array of 2-5 user-selectable answer options for the single question")});function T5(X){if(X instanceof Error)return X.message;return String(X)}function F90(X){if(typeof X.old_text==="string"&&X.old_text.length>O5)return`Editor input too large: old_text was ${X.old_text.length} characters, exceeding the recommended limit of ${O5}. Split the edit into smaller tool calls so later tool calls are less likely to be truncated or time out.`;if(X.new_text.length>O5)return`Editor input too large: new_text was ${X.new_text.length} characters, exceeding the recommended limit of ${O5}. Split the edit into smaller tool calls so later tool calls are less likely to be truncated or time out.`;return null}function Y4(X,Y,W){return Promise.race([X,new Promise((z,F)=>{setTimeout(()=>F(Error(W)),Y)})])}function z90(X){let Y=m9(Z90,X);if(typeof Y==="string")return[{path:Y}];if(Array.isArray(Y))return Y.map((W)=>typeof W==="string"?{path:W}:W);if("files"in Y)return Array.isArray(Y.files)?Y.files:[Y.files];if("file_paths"in Y)return(Array.isArray(Y.file_paths)?Y.file_paths:[Y.file_paths]).map((z)=>({path:z}));return[Y]}function ZB(X){let{path:Y,start_line:W,end_line:z}=X;if(W==null&&z==null)return Y;return`${Y}:${W??1}-${z??"EOF"}`}function q90(X){let Y=m9(O3,X);if(typeof Y==="string")return[Y];if(Array.isArray(Y))return Y;if("commands"in Y)return Array.isArray(Y.commands)?Y.commands:[Y.commands];return[Y]}function QB(X){if(typeof X==="string")return X;let Y=X.args??[];if(Y.length===0)return X.command;let W=Y.map((z)=>/[\s"]/u.test(z)?JSON.stringify(z):z);return`${X.command} ${W.join(" ")}`}function H90(X,Y={}){let W=Y.fileReadTimeoutMs??1e4;return _4({name:"read_files",description:"Read the full content of text files at the provided absolute paths, or return only an inclusive one-based line range when start_line/end_line are provided. Returns file contents or error messages for each path.",inputSchema:W8(N3),timeoutMs:W*2,retryable:!0,maxRetries:1,execute:async(z,F)=>{let Q=z90(z);return Promise.all(Q.map(async(J)=>{try{let Z=await Y4(X(J,F),W,`File read timed out after ${W}ms`);return{query:ZB(J),result:Z,success:!0}}catch(Z){let K=T5(Z);return{query:ZB(J),result:"",error:`Error reading file: ${K}`,success:!1}}}))}})}function V90(X,Y={}){let W=Y.searchTimeoutMs??30000,z=Y.cwd??process.cwd();return _4({name:"search_codebase",description:"Perform regex pattern searches across the codebase. Supports multiple parallel searches. Use for finding code patterns, function definitions, class names, imports, etc.",inputSchema:W8(A3),timeoutMs:W*2,retryable:!0,maxRetries:1,execute:async(F,Q)=>{let J=m9(Q90,F),Z=Array.isArray(J)?J:typeof J==="object"?Array.isArray(J.queries)?J.queries:[J.queries]:[J];return Promise.all(Z.map(async(K)=>{try{let H=await Y4(X(K,z,Q),W,`Search timed out after ${W}ms`),G=H.length>0&&!H.includes("No results found");return{query:K,result:H,success:G}}catch(H){let G=T5(H);return{query:K,result:"",error:`Search failed: ${G}`,success:!1}}}))}})}function B90(X,Y={}){let W=Y.bashTimeoutMs??30000,z=Y.cwd??process.cwd();return _4({name:"run_commands",description:"Run shell commands from the root of the workspace. Use for listing files, checking git status, running builds, executing tests, etc. Commands should be properly shell-escaped.",inputSchema:W8(oZ),timeoutMs:W*2,retryable:!1,maxRetries:0,execute:async(F,Q)=>{let J=m9(J90,F),Z=Array.isArray(J)?J:typeof J==="object"?Array.isArray(J.commands)?J.commands:[J.commands]:[J];return Promise.all(Z.map(async(K)=>{try{let H=await Y4(X(K,z,Q),W,`Command timed out after ${W}ms`);return{query:K,result:H,success:!0}}catch(H){let G=T5(H);return{query:K,result:"",error:`Command failed: ${G}`,success:!1}}}))}})}function U90(X,Y={}){let W=Y.bashTimeoutMs??30000,z=Y.cwd??process.cwd();return _4({name:"run_commands",description:"Run shell commands from the root of the workspacein Windows environment. Use for listing files, checking git status, running builds, executing tests, etc. Prefer structured { command, args } entries for portability; plain string commands should be properly shell-escaped.",inputSchema:W8(O3),timeoutMs:W*2,retryable:!1,maxRetries:0,execute:async(F,Q)=>{let J=q90(F);return Promise.all(J.map(async(Z)=>{try{let K=await Y4(X(Z,z,Q),W,`Command timed out after ${W}ms`);return{query:QB(Z),result:K,success:!0}}catch(K){let H=T5(K);return{query:QB(Z),result:"",error:`Command failed: ${H}`,success:!1}}}))}})}function N90(X,Y={}){let W=Y.webFetchTimeoutMs??30000;return _4({name:"fetch_web_content",description:"Fetch content from URLs and analyze them using the provided prompts. Use for retrieving documentation, API references, or any web content. Each request includes a URL and a prompt describing what information to extract.",inputSchema:W8(T3),timeoutMs:W*2,retryable:!0,maxRetries:2,execute:async(z,F)=>{let Q=m9(T3,z);return Promise.all(Q.requests.map(async(J)=>{try{let Z=await Y4(X(J.url,J.prompt,F),W,`Web fetch timed out after ${W}ms`);return{query:J.url,result:Z,success:!0}}catch(Z){let K=T5(Z);return{query:J.url,result:"",error:`Error fetching web content: ${K}`,success:!1}}}))}})}var ti0=`This is a custom utility that makes it more convenient to add, remove, move, or edit code in a single file. \`apply_patch\` effectively allows you to execute a diff/patch against a file, but the format of the diff specification is unique to this task, so pay careful attention to these instructions. To use the \`apply_patch\` command, you should pass a message of the following structure as "input":
493
+ `)+1)));this.lastActivityTimestamp=new Date}trace(X,Y){(0,WK.trace)(Y!==null&&Y!==void 0?Y:y5.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,GK.uriToString)(this.target)+" "+X)}callRefTimerRef(){var X,Y,W,z;if(!this.callRefTimer)this.callRefTimer=setInterval(()=>{},e81);if(!((Y=(X=this.callRefTimer).hasRef)===null||Y===void 0?void 0:Y.call(X)))this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(z=(W=this.callRefTimer).ref)===null||z===void 0||z.call(W)}callRefTimerUnref(){var X,Y,W;if(!((X=this.callRefTimer)===null||X===void 0?void 0:X.hasRef)||this.callRefTimer.hasRef())this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(W=(Y=this.callRefTimer)===null||Y===void 0?void 0:Y.unref)===null||W===void 0||W.call(Y)}removeConnectivityStateWatcher(X){let Y=this.connectivityStateWatchers.findIndex((W)=>W===X);if(Y>=0)this.connectivityStateWatchers.splice(Y,1)}updateState(X){if((0,WK.trace)(y5.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,GK.uriToString)(this.target)+" "+B8.ConnectivityState[this.connectivityState]+" -> "+B8.ConnectivityState[X]),this.channelzEnabled)this.channelzInfoTracker.trace.addTrace("CT_INFO","Connectivity state change to "+B8.ConnectivityState[X]);this.connectivityState=X,this.channelzInfoTracker.state=X;let Y=this.connectivityStateWatchers.slice();for(let W of Y)if(X!==W.currentState){if(W.timer)clearTimeout(W.timer);this.removeConnectivityStateWatcher(W),W.callback()}if(X!==B8.ConnectivityState.TRANSIENT_FAILURE)this.currentResolutionError=null}throttleKeepalive(X){if(X>this.keepaliveTime){this.keepaliveTime=X;for(let Y of this.wrappedSubchannels)Y.throttleKeepalive(X)}}addWrappedSubchannel(X){this.wrappedSubchannels.add(X)}removeWrappedSubchannel(X){this.wrappedSubchannels.delete(X)}doPick(X,Y){return this.currentPicker.pick({metadata:X,extraPickInfo:Y})}queueCallForPick(X){this.pickQueue.push(X),this.callRefTimerRef()}getConfig(X,Y){if(this.connectivityState!==B8.ConnectivityState.SHUTDOWN)this.resolvingLoadBalancer.exitIdle();if(this.configSelector)return{type:"SUCCESS",config:this.configSelector.invoke(X,Y,this.randomChannelId)};else if(this.currentResolutionError)return{type:"ERROR",error:this.currentResolutionError};else return{type:"NONE"}}queueCallForConfig(X){this.configSelectionQueue.push(X),this.callRefTimerRef()}enterIdle(){if(this.resolvingLoadBalancer.destroy(),this.updateState(B8.ConnectivityState.IDLE),this.currentPicker=new aN.QueuePicker(this.resolvingLoadBalancer),this.idleTimer)clearTimeout(this.idleTimer),this.idleTimer=null;if(this.callRefTimer)clearInterval(this.callRefTimer),this.callRefTimer=null}startIdleTimeout(X){var Y,W;this.idleTimer=setTimeout(()=>{if(this.callCount>0){this.startIdleTimeout(this.idleTimeoutMs);return}let F=new Date().valueOf()-this.lastActivityTimestamp.valueOf();if(F>=this.idleTimeoutMs)this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle();else this.startIdleTimeout(this.idleTimeoutMs-F)},X),(W=(Y=this.idleTimer).unref)===null||W===void 0||W.call(Y)}maybeStartIdleTimer(){if(this.connectivityState!==B8.ConnectivityState.SHUTDOWN&&!this.idleTimer)this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){if(this.channelzEnabled)this.channelzInfoTracker.callTracker.addCallStarted();this.callCount+=1}onCallEnd(X){if(this.channelzEnabled)if(X.code===y5.Status.OK)this.channelzInfoTracker.callTracker.addCallSucceeded();else this.channelzInfoTracker.callTracker.addCallFailed();this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(X,Y,W,z,F){let Q=(0,nN.getNextCallNumber)();return this.trace("createLoadBalancingCall ["+Q+'] method="'+Y+'"'),new a81.LoadBalancingCall(this,X,Y,W,z,F,Q)}createRetryingCall(X,Y,W,z,F){let Q=(0,nN.getNextCallNumber)();return this.trace("createRetryingCall ["+Q+'] method="'+Y+'"'),new iN.RetryingCall(this,X,Y,W,z,F,Q,this.retryBufferTracker,KK.get(this.getTarget()))}createResolvingCall(X,Y,W,z,F){let Q=(0,nN.getNextCallNumber)();this.trace("createResolvingCall ["+Q+'] method="'+X+'", deadline='+(0,r81.deadlineToString)(Y));let J={deadline:Y,flags:F!==null&&F!==void 0?F:y5.Propagate.DEFAULTS,host:W!==null&&W!==void 0?W:this.defaultAuthority,parentCall:z},Z=new o81.ResolvingCall(this,X,J,this.filterStackFactory.clone(),Q);return this.onCallStart(),Z.addStatusWatcher((K)=>{this.onCallEnd(K)}),Z}close(){var X;this.resolvingLoadBalancer.destroy(),this.updateState(B8.ConnectivityState.SHUTDOWN),this.currentPicker=new dY0;for(let Y of this.configSelectionQueue)Y.cancelWithStatus(y5.Status.UNAVAILABLE,"Channel closed before call started");this.configSelectionQueue=[];for(let Y of this.pickQueue)Y.cancelWithStatus(y5.Status.UNAVAILABLE,"Channel closed before call started");if(this.pickQueue=[],this.callRefTimer)clearInterval(this.callRefTimer);if(this.idleTimer)clearTimeout(this.idleTimer);if(this.channelzEnabled)(0,xQ.unregisterChannelzRef)(this.channelzRef);this.subchannelPool.unrefUnusedSubchannels(),(X=this.configSelector)===null||X===void 0||X.unref(),this.configSelector=null}getTarget(){return(0,GK.uriToString)(this.target)}getConnectivityState(X){let Y=this.connectivityState;if(X)this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer();return Y}watchConnectivityState(X,Y,W){if(this.connectivityState===B8.ConnectivityState.SHUTDOWN)throw Error("Channel has been shut down");let z=null;if(Y!==1/0){let Q=Y instanceof Date?Y:new Date(Y),J=new Date;if(Y===-1/0||Q<=J){process.nextTick(W,Error("Deadline passed without connectivity state change"));return}z=setTimeout(()=>{this.removeConnectivityStateWatcher(F),W(Error("Deadline passed without connectivity state change"))},Q.getTime()-J.getTime())}let F={currentState:X,callback:W,timer:z};this.connectivityStateWatchers.push(F)}getChannelzRef(){return this.channelzRef}createCall(X,Y,W,z,F){if(typeof X!=="string")throw TypeError("Channel#createCall: method must be a string");if(!(typeof Y==="number"||Y instanceof Date))throw TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===B8.ConnectivityState.SHUTDOWN)throw Error("Channel has been shut down");return this.createResolvingCall(X,Y,W,z,F)}getOptions(){return this.options}}pY0.InternalChannel=lY0});var fU=X0((rY0)=>{Object.defineProperty(rY0,"__esModule",{value:!0});rY0.ChannelImplementation=void 0;var J41=ZY(),W41=rN();class aY0{constructor(X,Y,W){if(typeof X!=="string")throw TypeError("Channel target must be a string");if(!(Y instanceof J41.ChannelCredentials))throw TypeError("Channel credentials must be a ChannelCredentials object");if(W){if(typeof W!=="object")throw TypeError("Channel options must be an object")}this.internalChannel=new W41.InternalChannel(X,Y,W)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(X){return this.internalChannel.getConnectivityState(X)}watchConnectivityState(X,Y,W){this.internalChannel.watchConnectivityState(X,Y,W)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(X,Y,W,z,F){if(typeof X!=="string")throw TypeError("Channel#createCall: method must be a string");if(!(typeof Y==="number"||Y instanceof Date))throw TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(X,Y,W,z,F)}}rY0.ChannelImplementation=aY0});var JZ0=X0((ZZ0)=>{Object.defineProperty(ZZ0,"__esModule",{value:!0});ZZ0.ServerDuplexStreamImpl=ZZ0.ServerWritableStreamImpl=ZZ0.ServerReadableStreamImpl=ZZ0.ServerUnaryCallImpl=void 0;ZZ0.serverErrorToStatus=sN;var G41=F1("events"),oN=F1("stream"),tN=a1(),tY0=s6();function sN(X,Y){var W;let z={code:tN.Status.UNKNOWN,details:"message"in X?X.message:"Unknown Error",metadata:(W=Y!==null&&Y!==void 0?Y:X.metadata)!==null&&W!==void 0?W:null};if("code"in X&&typeof X.code==="number"&&Number.isInteger(X.code)){if(z.code=X.code,"details"in X&&typeof X.details==="string")z.details=X.details}return z}class sY0 extends G41.EventEmitter{constructor(X,Y,W,z){super();this.path=X,this.call=Y,this.metadata=W,this.request=z,this.cancelled=!1}getPeer(){return this.call.getPeer()}sendMetadata(X){this.call.sendMetadata(X)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}ZZ0.ServerUnaryCallImpl=sY0;class eY0 extends oN.Readable{constructor(X,Y,W){super({objectMode:!0});this.path=X,this.call=Y,this.metadata=W,this.cancelled=!1}_read(X){this.call.startRead()}getPeer(){return this.call.getPeer()}sendMetadata(X){this.call.sendMetadata(X)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}}ZZ0.ServerReadableStreamImpl=eY0;class XZ0 extends oN.Writable{constructor(X,Y,W,z){super({objectMode:!0});this.path=X,this.call=Y,this.metadata=W,this.request=z,this.pendingStatus={code:tN.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new tY0.Metadata,this.on("error",(F)=>{this.pendingStatus=sN(F),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(X){this.call.sendMetadata(X)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_write(X,Y,W){this.call.sendMessage(X,W)}_final(X){var Y;X(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(Y=this.pendingStatus.metadata)!==null&&Y!==void 0?Y:this.trailingMetadata}))}end(X){if(X)this.trailingMetadata=X;return super.end()}}ZZ0.ServerWritableStreamImpl=XZ0;class YZ0 extends oN.Duplex{constructor(X,Y,W){super({objectMode:!0});this.path=X,this.call=Y,this.metadata=W,this.pendingStatus={code:tN.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new tY0.Metadata,this.on("error",(z)=>{this.pendingStatus=sN(z),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(X){this.call.sendMetadata(X)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_read(X){this.call.startRead()}_write(X,Y,W){this.call.sendMessage(X,W)}_final(X){var Y;X(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(Y=this.pendingStatus.metadata)!==null&&Y!==void 0?Y:this.trailingMetadata}))}end(X){if(X)this.trailingMetadata=X;return super.end()}}ZZ0.ServerDuplexStreamImpl=YZ0});var FK=X0((WZ0)=>{Object.defineProperty(WZ0,"__esModule",{value:!0});WZ0.ServerCredentials=void 0;WZ0.createCertificateProviderServerCredentials=H41;WZ0.createServerCredentialsWithInterceptors=V41;var eN=NU();class EY{constructor(X,Y){this.serverConstructorOptions=X,this.watchers=new Set,this.latestContextOptions=null,this.latestContextOptions=Y!==null&&Y!==void 0?Y:null}_addWatcher(X){this.watchers.add(X)}_removeWatcher(X){this.watchers.delete(X)}getWatcherCount(){return this.watchers.size}updateSecureContextOptions(X){this.latestContextOptions=X;for(let Y of this.watchers)Y(this.latestContextOptions)}_isSecure(){return this.serverConstructorOptions!==null}_getSecureContextOptions(){return this.latestContextOptions}_getConstructorOptions(){return this.serverConstructorOptions}_getInterceptors(){return[]}static createInsecure(){return new XA}static createSsl(X,Y,W=!1){var z;if(X!==null&&!Buffer.isBuffer(X))throw TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(Y))throw TypeError("keyCertPairs must be an array");if(typeof W!=="boolean")throw TypeError("checkClientCertificate must be a boolean");let F=[],Q=[];for(let J=0;J<Y.length;J++){let Z=Y[J];if(Z===null||typeof Z!=="object")throw TypeError(`keyCertPair[${J}] must be an object`);if(!Buffer.isBuffer(Z.private_key))throw TypeError(`keyCertPair[${J}].private_key must be a Buffer`);if(!Buffer.isBuffer(Z.cert_chain))throw TypeError(`keyCertPair[${J}].cert_chain must be a Buffer`);F.push(Z.cert_chain),Q.push(Z.private_key)}return new YA({requestCert:W,ciphers:eN.CIPHER_SUITES},{ca:(z=X!==null&&X!==void 0?X:(0,eN.getDefaultRootsData)())!==null&&z!==void 0?z:void 0,cert:F,key:Q})}}WZ0.ServerCredentials=EY;class XA extends EY{constructor(){super(null)}_getSettings(){return null}_equals(X){return X instanceof XA}}class YA extends EY{constructor(X,Y){super(X,Y);this.options=Object.assign(Object.assign({},X),Y)}_equals(X){if(this===X)return!0;if(!(X instanceof YA))return!1;if(Buffer.isBuffer(this.options.ca)&&Buffer.isBuffer(X.options.ca)){if(!this.options.ca.equals(X.options.ca))return!1}else if(this.options.ca!==X.options.ca)return!1;if(Array.isArray(this.options.cert)&&Array.isArray(X.options.cert)){if(this.options.cert.length!==X.options.cert.length)return!1;for(let Y=0;Y<this.options.cert.length;Y++){let W=this.options.cert[Y],z=X.options.cert[Y];if(Buffer.isBuffer(W)&&Buffer.isBuffer(z)){if(!W.equals(z))return!1}else if(W!==z)return!1}}else if(this.options.cert!==X.options.cert)return!1;if(Array.isArray(this.options.key)&&Array.isArray(X.options.key)){if(this.options.key.length!==X.options.key.length)return!1;for(let Y=0;Y<this.options.key.length;Y++){let W=this.options.key[Y],z=X.options.key[Y];if(Buffer.isBuffer(W)&&Buffer.isBuffer(z)){if(!W.equals(z))return!1}else if(W!==z)return!1}}else if(this.options.key!==X.options.key)return!1;if(this.options.requestCert!==X.options.requestCert)return!1;return!0}}class ZA extends EY{constructor(X,Y,W){super({requestCert:Y!==null,rejectUnauthorized:W,ciphers:eN.CIPHER_SUITES});this.identityCertificateProvider=X,this.caCertificateProvider=Y,this.requireClientCertificate=W,this.latestCaUpdate=null,this.latestIdentityUpdate=null,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this)}_addWatcher(X){var Y;if(this.getWatcherCount()===0)(Y=this.caCertificateProvider)===null||Y===void 0||Y.addCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.addIdentityCertificateListener(this.identityCertificateUpdateListener);super._addWatcher(X)}_removeWatcher(X){var Y;if(super._removeWatcher(X),this.getWatcherCount()===0)(Y=this.caCertificateProvider)===null||Y===void 0||Y.removeCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.removeIdentityCertificateListener(this.identityCertificateUpdateListener)}_equals(X){if(this===X)return!0;if(!(X instanceof ZA))return!1;return this.caCertificateProvider===X.caCertificateProvider&&this.identityCertificateProvider===X.identityCertificateProvider&&this.requireClientCertificate===X.requireClientCertificate}calculateSecureContextOptions(){var X;if(this.latestIdentityUpdate===null)return null;if(this.caCertificateProvider!==null&&this.latestCaUpdate===null)return null;return{ca:(X=this.latestCaUpdate)===null||X===void 0?void 0:X.caCertificate,cert:[this.latestIdentityUpdate.certificate],key:[this.latestIdentityUpdate.privateKey]}}finalizeUpdate(){let X=this.calculateSecureContextOptions();this.updateSecureContextOptions(X)}handleCaCertificateUpdate(X){this.latestCaUpdate=X,this.finalizeUpdate()}handleIdentityCertitificateUpdate(X){this.latestIdentityUpdate=X,this.finalizeUpdate()}}function H41(X,Y,W){return new ZA(X,Y,W)}class QA extends EY{constructor(X,Y){super({});this.childCredentials=X,this.interceptors=Y}_isSecure(){return this.childCredentials._isSecure()}_equals(X){if(!(X instanceof QA))return!1;if(!this.childCredentials._equals(X.childCredentials))return!1;if(this.interceptors.length!==X.interceptors.length)return!1;for(let Y=0;Y<this.interceptors.length;Y++)if(this.interceptors[Y]!==X.interceptors[Y])return!1;return!0}_getInterceptors(){return this.interceptors}_addWatcher(X){this.childCredentials._addWatcher(X)}_removeWatcher(X){this.childCredentials._removeWatcher(X)}_getConstructorOptions(){return this.childCredentials._getConstructorOptions()}_getSecureContextOptions(){return this.childCredentials._getSecureContextOptions()}}function V41(X,Y){return new QA(X,Y)}});var bQ=X0((KZ0)=>{Object.defineProperty(KZ0,"__esModule",{value:!0});KZ0.durationMessageToDuration=N41;KZ0.msToDuration=A41;KZ0.durationToMs=O41;KZ0.isDuration=T41;KZ0.isDurationMessage=I41;KZ0.parseDuration=D41;KZ0.durationToString=E41;function N41(X){return{seconds:Number.parseInt(X.seconds),nanos:X.nanos}}function A41(X){return{seconds:X/1000|0,nanos:X%1000*1e6|0}}function O41(X){return X.seconds*1000+X.nanos/1e6|0}function T41(X){return typeof X.seconds==="number"&&typeof X.nanos==="number"}function I41(X){return typeof X.seconds==="string"&&typeof X.nanos==="number"}var $41=/^(\d+)(?:\.(\d+))?s$/;function D41(X){let Y=X.match($41);if(!Y)return null;return{seconds:Number.parseInt(Y[1],10),nanos:Y[2]?Number.parseInt(Y[2].padEnd(9,"0"),10):0}}function E41(X){if(X.nanos===0)return`${X.seconds}s`;let Y;if(X.nanos%1e6===0)Y=1e6;else if(X.nanos%1000===0)Y=1000;else Y=1;return`${X.seconds}.${X.nanos/Y}s`}});var qK=X0((TZ0)=>{var __dirname="/Users/beatrix/dev/clinee/sdk-wip/node_modules/.bun/@grpc+grpc-js@1.14.3/node_modules/@grpc/grpc-js/build/src";Object.defineProperty(TZ0,"__esModule",{value:!0});TZ0.OrcaOobMetricsSubchannelWrapper=TZ0.GRPC_METRICS_HEADER=TZ0.ServerMetricRecorder=TZ0.PerRequestMetricRecorder=void 0;TZ0.createOrcaClient=BZ0;TZ0.createMetricsReader=_41;var f41=TG(),JA=bQ(),y41=ZY(),k41=_Q(),FZ0=a1(),v41=QY(),j41=C9(),zZ0=null;function zK(){if(zZ0)return zZ0;let X=MQ().loadSync,Y=X("xds/service/orca/v3/orca.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto/xds`,`${__dirname}/../../proto/protoc-gen-validate`]});return(0,f41.loadPackageDefinition)(Y)}class HZ0{constructor(){this.message={}}recordRequestCostMetric(X,Y){if(!this.message.request_cost)this.message.request_cost={};this.message.request_cost[X]=Y}recordUtilizationMetric(X,Y){if(!this.message.utilization)this.message.utilization={};this.message.utilization[X]=Y}recordNamedMetric(X,Y){if(!this.message.named_metrics)this.message.named_metrics={};this.message.named_metrics[X]=Y}recordCPUUtilizationMetric(X){this.message.cpu_utilization=X}recordMemoryUtilizationMetric(X){this.message.mem_utilization=X}recordApplicationUtilizationMetric(X){this.message.application_utilization=X}recordQpsMetric(X){this.message.rps_fractional=X}recordEpsMetric(X){this.message.eps=X}serialize(){return zK().xds.data.orca.v3.OrcaLoadReport.serialize(this.message)}}TZ0.PerRequestMetricRecorder=HZ0;var h41=30000;class VZ0{constructor(){this.message={},this.serviceImplementation={StreamCoreMetrics:(X)=>{let Y=X.request.report_interval?(0,JA.durationToMs)((0,JA.durationMessageToDuration)(X.request.report_interval)):h41,W=setInterval(()=>{X.write(this.message)},Y);X.on("cancelled",()=>{clearInterval(W)})}}}putUtilizationMetric(X,Y){if(!this.message.utilization)this.message.utilization={};this.message.utilization[X]=Y}setAllUtilizationMetrics(X){this.message.utilization=Object.assign({},X)}deleteUtilizationMetric(X){var Y;(Y=this.message.utilization)===null||Y===void 0||delete Y[X]}setCpuUtilizationMetric(X){this.message.cpu_utilization=X}deleteCpuUtilizationMetric(){delete this.message.cpu_utilization}setApplicationUtilizationMetric(X){this.message.application_utilization=X}deleteApplicationUtilizationMetric(){delete this.message.application_utilization}setQpsMetric(X){this.message.rps_fractional=X}deleteQpsMetric(){delete this.message.rps_fractional}setEpsMetric(X){this.message.eps=X}deleteEpsMetric(){delete this.message.eps}addToServer(X){let Y=zK().xds.service.orca.v3.OpenRcaService.service;X.addService(Y,this.serviceImplementation)}}TZ0.ServerMetricRecorder=VZ0;function BZ0(X){return new(zK()).xds.service.orca.v3.OpenRcaService("unused",y41.ChannelCredentials.createInsecure(),{channelOverride:X})}TZ0.GRPC_METRICS_HEADER="endpoint-load-metrics-bin";var qZ0="grpc_orca_load_report";function _41(X,Y){return(W,z,F)=>{let Q=F.getOpaque(qZ0);if(Q)X(Q);else{let J=F.get(TZ0.GRPC_METRICS_HEADER);if(J.length>0)Q=zK().xds.data.orca.v3.OrcaLoadReport.deserialize(J[0]),X(Q),F.setOpaque(qZ0,Q)}if(Y)Y(W,z,F)}}var UZ0="orca_oob_metrics";class NZ0{constructor(X,Y){this.metricsListener=X,this.intervalMs=Y,this.dataProducer=null}setSubchannel(X){let Y=X.getOrCreateDataProducer(UZ0,x41);this.dataProducer=Y,Y.addDataWatcher(this)}destroy(){var X;(X=this.dataProducer)===null||X===void 0||X.removeDataWatcher(this)}getInterval(){return this.intervalMs}onMetricsUpdate(X){this.metricsListener(X)}}class AZ0{constructor(X){this.subchannel=X,this.dataWatchers=new Set,this.orcaSupported=!0,this.metricsCall=null,this.currentInterval=1/0,this.backoffTimer=new v41.BackoffTimeout(()=>this.updateMetricsSubscription()),this.subchannelStateListener=()=>this.updateMetricsSubscription();let Y=X.getChannel();this.client=BZ0(Y),X.addConnectivityStateListener(this.subchannelStateListener)}addDataWatcher(X){this.dataWatchers.add(X),this.updateMetricsSubscription()}removeDataWatcher(X){var Y;if(this.dataWatchers.delete(X),this.dataWatchers.size===0)this.subchannel.removeDataProducer(UZ0),(Y=this.metricsCall)===null||Y===void 0||Y.cancel(),this.metricsCall=null,this.client.close(),this.subchannel.removeConnectivityStateListener(this.subchannelStateListener);else this.updateMetricsSubscription()}updateMetricsSubscription(){var X;if(this.dataWatchers.size===0||!this.orcaSupported||this.subchannel.getConnectivityState()!==j41.ConnectivityState.READY)return;let Y=Math.min(...Array.from(this.dataWatchers).map((W)=>W.getInterval()));if(!this.metricsCall||Y!==this.currentInterval){(X=this.metricsCall)===null||X===void 0||X.cancel(),this.currentInterval=Y;let W=this.client.streamCoreMetrics({report_interval:(0,JA.msToDuration)(Y)});this.metricsCall=W,W.on("data",(z)=>{this.dataWatchers.forEach((F)=>{F.onMetricsUpdate(z)})}),W.on("error",(z)=>{if(this.metricsCall=null,z.code===FZ0.Status.UNIMPLEMENTED){this.orcaSupported=!1;return}if(z.code===FZ0.Status.CANCELLED)return;this.backoffTimer.runOnce()})}}}class OZ0 extends k41.BaseSubchannelWrapper{constructor(X,Y,W){super(X);this.addDataWatcher(new NZ0(Y,W))}getWrappedSubchannel(){return this.child}}TZ0.OrcaOobMetricsSubchannelWrapper=OZ0;function x41(X){return new AZ0(X)}});var FA=X0((jZ0)=>{Object.defineProperty(jZ0,"__esModule",{value:!0});jZ0.BaseServerInterceptingCall=jZ0.ServerInterceptingCall=jZ0.ResponderBuilder=jZ0.ServerListenerBuilder=void 0;jZ0.isInterceptingServerListener=l41;jZ0.getServerInterceptingCall=r41;var BK=s6(),k9=a1(),CY=F1("http2"),DZ0=ZG(),EZ0=F1("zlib"),d41=mN(),PZ0=A6(),c41=F1("tls"),CZ0=qK(),wZ0="server_call";function p7(X){PZ0.trace(k9.LogVerbosity.DEBUG,wZ0,X)}class SZ0{constructor(){this.metadata=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withOnReceiveMetadata(X){return this.metadata=X,this}withOnReceiveMessage(X){return this.message=X,this}withOnReceiveHalfClose(X){return this.halfClose=X,this}withOnCancel(X){return this.cancel=X,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveHalfClose:this.halfClose,onCancel:this.cancel}}}jZ0.ServerListenerBuilder=SZ0;function l41(X){return X.onReceiveMetadata!==void 0&&X.onReceiveMetadata.length===1}class fZ0{constructor(X,Y){this.listener=X,this.nextListener=Y,this.cancelled=!1,this.processingMetadata=!1,this.hasPendingMessage=!1,this.pendingMessage=null,this.processingMessage=!1,this.hasPendingHalfClose=!1}processPendingMessage(){if(this.hasPendingMessage)this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1}processPendingHalfClose(){if(this.hasPendingHalfClose)this.nextListener.onReceiveHalfClose(),this.hasPendingHalfClose=!1}onReceiveMetadata(X){if(this.cancelled)return;this.processingMetadata=!0,this.listener.onReceiveMetadata(X,(Y)=>{if(this.processingMetadata=!1,this.cancelled)return;this.nextListener.onReceiveMetadata(Y),this.processPendingMessage(),this.processPendingHalfClose()})}onReceiveMessage(X){if(this.cancelled)return;this.processingMessage=!0,this.listener.onReceiveMessage(X,(Y)=>{if(this.processingMessage=!1,this.cancelled)return;if(this.processingMetadata)this.pendingMessage=Y,this.hasPendingMessage=!0;else this.nextListener.onReceiveMessage(Y),this.processPendingHalfClose()})}onReceiveHalfClose(){if(this.cancelled)return;this.listener.onReceiveHalfClose(()=>{if(this.cancelled)return;if(this.processingMetadata||this.processingMessage)this.hasPendingHalfClose=!0;else this.nextListener.onReceiveHalfClose()})}onCancel(){this.cancelled=!0,this.listener.onCancel(),this.nextListener.onCancel()}}class yZ0{constructor(){this.start=void 0,this.metadata=void 0,this.message=void 0,this.status=void 0}withStart(X){return this.start=X,this}withSendMetadata(X){return this.metadata=X,this}withSendMessage(X){return this.message=X,this}withSendStatus(X){return this.status=X,this}build(){return{start:this.start,sendMetadata:this.metadata,sendMessage:this.message,sendStatus:this.status}}}jZ0.ResponderBuilder=yZ0;var HK={onReceiveMetadata:(X,Y)=>{Y(X)},onReceiveMessage:(X,Y)=>{Y(X)},onReceiveHalfClose:(X)=>{X()},onCancel:()=>{}},VK={start:(X)=>{X()},sendMetadata:(X,Y)=>{Y(X)},sendMessage:(X,Y)=>{Y(X)},sendStatus:(X,Y)=>{Y(X)}};class kZ0{constructor(X,Y){var W,z,F,Q;this.nextCall=X,this.processingMetadata=!1,this.sentMetadata=!1,this.processingMessage=!1,this.pendingMessage=null,this.pendingMessageCallback=null,this.pendingStatus=null,this.responder={start:(W=Y===null||Y===void 0?void 0:Y.start)!==null&&W!==void 0?W:VK.start,sendMetadata:(z=Y===null||Y===void 0?void 0:Y.sendMetadata)!==null&&z!==void 0?z:VK.sendMetadata,sendMessage:(F=Y===null||Y===void 0?void 0:Y.sendMessage)!==null&&F!==void 0?F:VK.sendMessage,sendStatus:(Q=Y===null||Y===void 0?void 0:Y.sendStatus)!==null&&Q!==void 0?Q:VK.sendStatus}}processPendingMessage(){if(this.pendingMessageCallback)this.nextCall.sendMessage(this.pendingMessage,this.pendingMessageCallback),this.pendingMessage=null,this.pendingMessageCallback=null}processPendingStatus(){if(this.pendingStatus)this.nextCall.sendStatus(this.pendingStatus),this.pendingStatus=null}start(X){this.responder.start((Y)=>{var W,z,F,Q;let J={onReceiveMetadata:(W=Y===null||Y===void 0?void 0:Y.onReceiveMetadata)!==null&&W!==void 0?W:HK.onReceiveMetadata,onReceiveMessage:(z=Y===null||Y===void 0?void 0:Y.onReceiveMessage)!==null&&z!==void 0?z:HK.onReceiveMessage,onReceiveHalfClose:(F=Y===null||Y===void 0?void 0:Y.onReceiveHalfClose)!==null&&F!==void 0?F:HK.onReceiveHalfClose,onCancel:(Q=Y===null||Y===void 0?void 0:Y.onCancel)!==null&&Q!==void 0?Q:HK.onCancel},Z=new fZ0(J,X);this.nextCall.start(Z)})}sendMetadata(X){this.processingMetadata=!0,this.sentMetadata=!0,this.responder.sendMetadata(X,(Y)=>{this.processingMetadata=!1,this.nextCall.sendMetadata(Y),this.processPendingMessage(),this.processPendingStatus()})}sendMessage(X,Y){if(this.processingMessage=!0,!this.sentMetadata)this.sendMetadata(new BK.Metadata);this.responder.sendMessage(X,(W)=>{if(this.processingMessage=!1,this.processingMetadata)this.pendingMessage=W,this.pendingMessageCallback=Y;else this.nextCall.sendMessage(W,Y)})}sendStatus(X){this.responder.sendStatus(X,(Y)=>{if(this.processingMetadata||this.processingMessage)this.pendingStatus=Y;else this.nextCall.sendStatus(Y)})}startRead(){this.nextCall.startRead()}getPeer(){return this.nextCall.getPeer()}getDeadline(){return this.nextCall.getDeadline()}getHost(){return this.nextCall.getHost()}getAuthContext(){return this.nextCall.getAuthContext()}getConnectionInfo(){return this.nextCall.getConnectionInfo()}getMetricsRecorder(){return this.nextCall.getMetricsRecorder()}}jZ0.ServerInterceptingCall=kZ0;var vZ0="grpc-accept-encoding",GA="grpc-encoding",RZ0="grpc-message",MZ0="grpc-status",WA="grpc-timeout",p41=/(\d{1,8})\s*([HMSmun])/,n41={H:3600000,M:60000,S:1000,m:1,u:0.001,n:0.000001},i41={[vZ0]:"identity,deflate,gzip",[GA]:"identity"},LZ0={[CY.constants.HTTP2_HEADER_STATUS]:CY.constants.HTTP_STATUS_OK,[CY.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},a41={waitForTrailers:!0};class KA{constructor(X,Y,W,z,F){var Q,J;if(this.stream=X,this.callEventTracker=W,this.handler=z,this.listener=null,this.deadlineTimer=null,this.deadline=1/0,this.maxSendMessageSize=k9.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=k9.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.cancelled=!1,this.metadataSent=!1,this.wantTrailers=!1,this.cancelNotified=!1,this.incomingEncoding="identity",this.readQueue=[],this.isReadPending=!1,this.receivedHalfClose=!1,this.streamEnded=!1,this.metricsRecorder=new CZ0.PerRequestMetricRecorder,this.stream.once("error",(q)=>{}),this.stream.once("close",()=>{var q;if(p7("Request to method "+((q=this.handler)===null||q===void 0?void 0:q.path)+" stream closed with rstCode "+this.stream.rstCode),this.callEventTracker&&!this.streamEnded)this.streamEnded=!0,this.callEventTracker.onStreamEnd(!1),this.callEventTracker.onCallEnd({code:k9.Status.CANCELLED,details:"Stream closed before sending status",metadata:null});this.notifyOnCancel()}),this.stream.on("data",(q)=>{this.handleDataFrame(q)}),this.stream.pause(),this.stream.on("end",()=>{this.handleEndEvent()}),"grpc.max_send_message_length"in F)this.maxSendMessageSize=F["grpc.max_send_message_length"];if("grpc.max_receive_message_length"in F)this.maxReceiveMessageSize=F["grpc.max_receive_message_length"];this.host=(Q=Y[":authority"])!==null&&Q!==void 0?Q:Y.host,this.decoder=new d41.StreamDecoder(this.maxReceiveMessageSize);let Z=BK.Metadata.fromHttp2Headers(Y);if(PZ0.isTracerEnabled(wZ0))p7("Request to "+this.handler.path+" received headers "+JSON.stringify(Z.toJSON()));let K=Z.get(WA);if(K.length>0)this.handleTimeoutHeader(K[0]);let H=Z.get(GA);if(H.length>0)this.incomingEncoding=H[0];Z.remove(WA),Z.remove(GA),Z.remove(vZ0),Z.remove(CY.constants.HTTP2_HEADER_ACCEPT_ENCODING),Z.remove(CY.constants.HTTP2_HEADER_TE),Z.remove(CY.constants.HTTP2_HEADER_CONTENT_TYPE),this.metadata=Z;let G=(J=X.session)===null||J===void 0?void 0:J.socket;this.connectionInfo={localAddress:G===null||G===void 0?void 0:G.localAddress,localPort:G===null||G===void 0?void 0:G.localPort,remoteAddress:G===null||G===void 0?void 0:G.remoteAddress,remotePort:G===null||G===void 0?void 0:G.remotePort},this.shouldSendMetrics=!!F["grpc.server_call_metric_recording"]}handleTimeoutHeader(X){let Y=X.toString().match(p41);if(Y===null){let F={code:k9.Status.INTERNAL,details:`Invalid ${WA} value "${X}"`,metadata:null};process.nextTick(()=>{this.sendStatus(F)});return}let W=+Y[1]*n41[Y[2]]|0,z=new Date;this.deadline=z.setMilliseconds(z.getMilliseconds()+W),this.deadlineTimer=setTimeout(()=>{let F={code:k9.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(F)},W)}checkCancelled(){if(!this.cancelled&&(this.stream.destroyed||this.stream.closed))this.notifyOnCancel(),this.cancelled=!0;return this.cancelled}notifyOnCancel(){if(this.cancelNotified)return;if(this.cancelNotified=!0,this.cancelled=!0,process.nextTick(()=>{var X;(X=this.listener)===null||X===void 0||X.onCancel()}),this.deadlineTimer)clearTimeout(this.deadlineTimer);this.stream.resume()}maybeSendMetadata(){if(!this.metadataSent)this.sendMetadata(new BK.Metadata)}serializeMessage(X){let Y=this.handler.serialize(X),W=Y.byteLength,z=Buffer.allocUnsafe(W+5);return z.writeUInt8(0,0),z.writeUInt32BE(W,1),Y.copy(z,5),z}decompressMessage(X,Y){let W=X.subarray(5);if(Y==="identity")return W;else if(Y==="deflate"||Y==="gzip"){let z;if(Y==="deflate")z=EZ0.createInflate();else z=EZ0.createGunzip();return new Promise((F,Q)=>{let J=0,Z=[];z.on("data",(K)=>{if(Z.push(K),J+=K.byteLength,this.maxReceiveMessageSize!==-1&&J>this.maxReceiveMessageSize)z.destroy(),Q({code:k9.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`})}),z.on("end",()=>{F(Buffer.concat(Z))}),z.write(W),z.end()})}else return Promise.reject({code:k9.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${Y}"`})}async decompressAndMaybePush(X){if(X.type!=="COMPRESSED")throw Error(`Invalid queue entry type: ${X.type}`);let W=X.compressedMessage.readUInt8(0)===1?this.incomingEncoding:"identity",z;try{z=await this.decompressMessage(X.compressedMessage,W)}catch(F){this.sendStatus(F);return}try{X.parsedMessage=this.handler.deserialize(z)}catch(F){this.sendStatus({code:k9.Status.INTERNAL,details:`Error deserializing request: ${F.message}`});return}X.type="READABLE",this.maybePushNextMessage()}maybePushNextMessage(){if(this.listener&&this.isReadPending&&this.readQueue.length>0&&this.readQueue[0].type!=="COMPRESSED"){this.isReadPending=!1;let X=this.readQueue.shift();if(X.type==="READABLE")this.listener.onReceiveMessage(X.parsedMessage);else this.listener.onReceiveHalfClose()}}handleDataFrame(X){var Y;if(this.checkCancelled())return;p7("Request to "+this.handler.path+" received data frame of size "+X.length);let W;try{W=this.decoder.write(X)}catch(z){this.sendStatus({code:k9.Status.RESOURCE_EXHAUSTED,details:z.message});return}for(let z of W){this.stream.pause();let F={type:"COMPRESSED",compressedMessage:z,parsedMessage:null};this.readQueue.push(F),this.decompressAndMaybePush(F),(Y=this.callEventTracker)===null||Y===void 0||Y.addMessageReceived()}}handleEndEvent(){this.readQueue.push({type:"HALF_CLOSE",compressedMessage:null,parsedMessage:null}),this.receivedHalfClose=!0,this.maybePushNextMessage()}start(X){if(p7("Request to "+this.handler.path+" start called"),this.checkCancelled())return;this.listener=X,X.onReceiveMetadata(this.metadata)}sendMetadata(X){if(this.checkCancelled())return;if(this.metadataSent)return;this.metadataSent=!0;let Y=X?X.toHttp2Headers():null,W=Object.assign(Object.assign(Object.assign({},LZ0),i41),Y);this.stream.respond(W,a41)}sendMessage(X,Y){if(this.checkCancelled())return;let W;try{W=this.serializeMessage(X)}catch(z){this.sendStatus({code:k9.Status.INTERNAL,details:`Error serializing response: ${(0,DZ0.getErrorMessage)(z)}`,metadata:null});return}if(this.maxSendMessageSize!==-1&&W.length-5>this.maxSendMessageSize){this.sendStatus({code:k9.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${W.length} vs. ${this.maxSendMessageSize})`,metadata:null});return}this.maybeSendMetadata(),p7("Request to "+this.handler.path+" sent data frame of size "+W.length),this.stream.write(W,(z)=>{var F;if(z){this.sendStatus({code:k9.Status.INTERNAL,details:`Error writing message: ${(0,DZ0.getErrorMessage)(z)}`,metadata:null});return}(F=this.callEventTracker)===null||F===void 0||F.addMessageSent(),Y()})}sendStatus(X){var Y,W,z;if(this.checkCancelled())return;p7("Request to method "+((Y=this.handler)===null||Y===void 0?void 0:Y.path)+" ended with status code: "+k9.Status[X.code]+" details: "+X.details);let F=(z=(W=X.metadata)===null||W===void 0?void 0:W.clone())!==null&&z!==void 0?z:new BK.Metadata;if(this.shouldSendMetrics)F.set(CZ0.GRPC_METRICS_HEADER,this.metricsRecorder.serialize());if(this.metadataSent)if(!this.wantTrailers)this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{if(this.callEventTracker&&!this.streamEnded)this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(X);let Q=Object.assign({[MZ0]:X.code,[RZ0]:encodeURI(X.details)},F.toHttp2Headers());this.stream.sendTrailers(Q),this.notifyOnCancel()}),this.stream.end();else this.notifyOnCancel();else{if(this.callEventTracker&&!this.streamEnded)this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(X);let Q=Object.assign(Object.assign({[MZ0]:X.code,[RZ0]:encodeURI(X.details)},LZ0),F.toHttp2Headers());this.stream.respond(Q,{endStream:!0}),this.notifyOnCancel()}}startRead(){if(p7("Request to "+this.handler.path+" startRead called"),this.checkCancelled())return;if(this.isReadPending=!0,this.readQueue.length===0){if(!this.receivedHalfClose)this.stream.resume()}else this.maybePushNextMessage()}getPeer(){var X;let Y=(X=this.stream.session)===null||X===void 0?void 0:X.socket;if(Y===null||Y===void 0?void 0:Y.remoteAddress)if(Y.remotePort)return`${Y.remoteAddress}:${Y.remotePort}`;else return Y.remoteAddress;else return"unknown"}getDeadline(){return this.deadline}getHost(){return this.host}getAuthContext(){var X;if(((X=this.stream.session)===null||X===void 0?void 0:X.socket)instanceof c41.TLSSocket){let Y=this.stream.session.socket.getPeerCertificate();return{transportSecurityType:"ssl",sslPeerCertificate:Y.raw?Y:void 0}}else return{}}getConnectionInfo(){return this.connectionInfo}getMetricsRecorder(){return this.metricsRecorder}}jZ0.BaseServerInterceptingCall=KA;function r41(X,Y,W,z,F,Q){let J={path:F.path,requestStream:F.type==="clientStream"||F.type==="bidi",responseStream:F.type==="serverStream"||F.type==="bidi",requestDeserialize:F.deserialize,responseSerialize:F.serialize},Z=new KA(Y,W,z,F,Q);return X.reduce((K,H)=>{return H(J,K)},Z)}});var dZ0=X0((v5)=>{var Y51=v5&&v5.__runInitializers||function(X,Y,W){var z=arguments.length>2;for(var F=0;F<Y.length;F++)W=z?Y[F].call(X,W):Y[F].call(X);return z?W:void 0},Z51=v5&&v5.__esDecorate||function(X,Y,W,z,F,Q){function J(A){if(A!==void 0&&typeof A!=="function")throw TypeError("Function expected");return A}var Z=z.kind,K=Z==="getter"?"get":Z==="setter"?"set":"value",H=!Y&&X?z.static?X:X.prototype:null,G=Y||(H?Object.getOwnPropertyDescriptor(H,z.name):{}),q,B=!1;for(var $=W.length-1;$>=0;$--){var R={};for(var E in z)R[E]=E==="access"?{}:z[E];for(var E in z.access)R.access[E]=z.access[E];R.addInitializer=function(A){if(B)throw TypeError("Cannot add initializers after decoration has completed");Q.push(J(A||null))};var U=(0,W[$])(Z==="accessor"?{get:G.get,set:G.set}:G[K],R);if(Z==="accessor"){if(U===void 0)continue;if(U===null||typeof U!=="object")throw TypeError("Object expected");if(q=J(U.get))G.get=q;if(q=J(U.set))G.set=q;if(q=J(U.init))F.unshift(q)}else if(q=J(U))if(Z==="field")F.unshift(q);else G[K]=q}if(H)Object.defineProperty(H,z.name,G);B=!0};Object.defineProperty(v5,"__esModule",{value:!0});v5.Server=void 0;var v9=F1("http2"),Q51=F1("util"),_6=a1(),LY=JZ0(),zA=FK(),_Z0=y8(),MY=A6(),k5=y9(),x8=E9(),n6=S5(),xZ0=FA(),RY=2147483647,qA=2147483647,J51=20000,bZ0=2147483647,{HTTP2_HEADER_PATH:uZ0}=v9.constants,W51="server",mZ0=Buffer.from("max_age");function gZ0(X){MY.trace(_6.LogVerbosity.DEBUG,"server_call",X)}function G51(){}function K51(X){return function(Y,W){return Q51.deprecate(Y,X)}}function HA(X){return{code:_6.Status.UNIMPLEMENTED,details:`The server does not implement the method ${X}`}}function F51(X,Y){let W=HA(Y);switch(X){case"unary":return(z,F)=>{F(W,null)};case"clientStream":return(z,F)=>{F(W,null)};case"serverStream":return(z)=>{z.emit("error",W)};case"bidi":return(z)=>{z.emit("error",W)};default:throw Error(`Invalid handlerType ${X}`)}}var z51=(()=>{var X;let Y=[],W;return X=class{constructor(F){var Q,J,Z,K,H,G;if(this.boundPorts=(Y51(this,Y),new Map),this.http2Servers=new Map,this.sessionIdleTimeouts=new Map,this.handlers=new Map,this.sessions=new Map,this.started=!1,this.shutdown=!1,this.serverAddressString="null",this.channelzEnabled=!0,this.options=F!==null&&F!==void 0?F:{},this.options["grpc.enable_channelz"]===0)this.channelzEnabled=!1,this.channelzTrace=new n6.ChannelzTraceStub,this.callTracker=new n6.ChannelzCallTrackerStub,this.listenerChildrenTracker=new n6.ChannelzChildrenTrackerStub,this.sessionChildrenTracker=new n6.ChannelzChildrenTrackerStub;else this.channelzTrace=new n6.ChannelzTrace,this.callTracker=new n6.ChannelzCallTracker,this.listenerChildrenTracker=new n6.ChannelzChildrenTracker,this.sessionChildrenTracker=new n6.ChannelzChildrenTracker;if(this.channelzRef=(0,n6.registerChannelzServer)("server",()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=(Q=this.options["grpc.max_connection_age_ms"])!==null&&Q!==void 0?Q:RY,this.maxConnectionAgeGraceMs=(J=this.options["grpc.max_connection_age_grace_ms"])!==null&&J!==void 0?J:RY,this.keepaliveTimeMs=(Z=this.options["grpc.keepalive_time_ms"])!==null&&Z!==void 0?Z:qA,this.keepaliveTimeoutMs=(K=this.options["grpc.keepalive_timeout_ms"])!==null&&K!==void 0?K:J51,this.sessionIdleTimeout=(H=this.options["grpc.max_connection_idle_ms"])!==null&&H!==void 0?H:bZ0,this.commonServerOptions={maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER},"grpc-node.max_session_memory"in this.options)this.commonServerOptions.maxSessionMemory=this.options["grpc-node.max_session_memory"];else this.commonServerOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER;if("grpc.max_concurrent_streams"in this.options)this.commonServerOptions.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]};this.interceptors=(G=this.options.interceptors)!==null&&G!==void 0?G:[],this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfo(F){var Q,J,Z;let K=this.sessions.get(F),H=F.socket,G=H.remoteAddress?(0,k5.stringToSubchannelAddress)(H.remoteAddress,H.remotePort):null,q=H.localAddress?(0,k5.stringToSubchannelAddress)(H.localAddress,H.localPort):null,B;if(F.encrypted){let R=H,E=R.getCipher(),U=R.getCertificate(),A=R.getPeerCertificate();B={cipherSuiteStandardName:(Q=E.standardName)!==null&&Q!==void 0?Q:null,cipherSuiteOtherName:E.standardName?null:E.name,localCertificate:U&&"raw"in U?U.raw:null,remoteCertificate:A&&"raw"in A?A.raw:null}}else B=null;return{remoteAddress:G,localAddress:q,security:B,remoteName:null,streamsStarted:K.streamTracker.callsStarted,streamsSucceeded:K.streamTracker.callsSucceeded,streamsFailed:K.streamTracker.callsFailed,messagesSent:K.messagesSent,messagesReceived:K.messagesReceived,keepAlivesSent:K.keepAlivesSent,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:K.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:K.lastMessageSentTimestamp,lastMessageReceivedTimestamp:K.lastMessageReceivedTimestamp,localFlowControlWindow:(J=F.state.localWindowSize)!==null&&J!==void 0?J:null,remoteFlowControlWindow:(Z=F.state.remoteWindowSize)!==null&&Z!==void 0?Z:null}}trace(F){MY.trace(_6.LogVerbosity.DEBUG,W51,"("+this.channelzRef.id+") "+F)}keepaliveTrace(F){MY.trace(_6.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+F)}addProtoService(){throw Error("Not implemented. Use addService() instead")}addService(F,Q){if(F===null||typeof F!=="object"||Q===null||typeof Q!=="object")throw Error("addService() requires two objects as arguments");let J=Object.keys(F);if(J.length===0)throw Error("Cannot add an empty service to a server");J.forEach((Z)=>{let K=F[Z],H;if(K.requestStream)if(K.responseStream)H="bidi";else H="clientStream";else if(K.responseStream)H="serverStream";else H="unary";let G=Q[Z],q;if(G===void 0&&typeof K.originalName==="string")G=Q[K.originalName];if(G!==void 0)q=G.bind(Q);else q=F51(H,Z);if(this.register(K.path,q,K.responseSerialize,K.requestDeserialize,H)===!1)throw Error(`Method handler for ${K.path} already provided.`)})}removeService(F){if(F===null||typeof F!=="object")throw Error("removeService() requires object as argument");Object.keys(F).forEach((J)=>{let Z=F[J];this.unregister(Z.path)})}bind(F,Q){throw Error("Not implemented. Use bindAsync() instead")}experimentalRegisterListenerToChannelz(F){return(0,n6.registerChannelzSocket)((0,k5.subchannelAddressToString)(F),()=>{return{localAddress:F,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}},this.channelzEnabled)}experimentalUnregisterListenerFromChannelz(F){(0,n6.unregisterChannelzRef)(F)}createHttp2Server(F){let Q;if(F._isSecure()){let J=F._getConstructorOptions(),Z=F._getSecureContextOptions(),K=Object.assign(Object.assign(Object.assign(Object.assign({},this.commonServerOptions),J),Z),{enableTrace:this.options["grpc-node.tls_enable_trace"]===1}),H=Z!==null;this.trace("Initial credentials valid: "+H),Q=v9.createSecureServer(K),Q.prependListener("connection",(q)=>{if(!H)this.trace("Dropped connection from "+JSON.stringify(q.address())+" due to unloaded credentials"),q.destroy()}),Q.on("secureConnection",(q)=>{q.on("error",(B)=>{this.trace("An incoming TLS connection closed with error: "+B.message)})});let G=(q)=>{if(q){let B=Q;try{B.setSecureContext(q)}catch($){MY.log(_6.LogVerbosity.ERROR,"Failed to set secure context with error "+$.message),q=null}}H=q!==null,this.trace("Post-update credentials valid: "+H)};F._addWatcher(G),Q.on("close",()=>{F._removeWatcher(G)})}else Q=v9.createServer(this.commonServerOptions);return Q.setTimeout(0,G51),this._setupHandlers(Q,F._getInterceptors()),Q}bindOneAddress(F,Q){this.trace("Attempting to bind "+(0,k5.subchannelAddressToString)(F));let J=this.createHttp2Server(Q.credentials);return new Promise((Z,K)=>{let H=(G)=>{this.trace("Failed to bind "+(0,k5.subchannelAddressToString)(F)+" with error "+G.message),Z({port:"port"in F?F.port:1,error:G.message})};J.once("error",H),J.listen(F,()=>{let G=J.address(),q;if(typeof G==="string")q={path:G};else q={host:G.address,port:G.port};let B=this.experimentalRegisterListenerToChannelz(q);this.listenerChildrenTracker.refChild(B),this.http2Servers.set(J,{channelzRef:B,sessions:new Set,ownsChannelzRef:!0}),Q.listeningServers.add(J),this.trace("Successfully bound "+(0,k5.subchannelAddressToString)(q)),Z({port:"port"in q?q.port:1}),J.removeListener("error",H)})})}async bindManyPorts(F,Q){if(F.length===0)return{count:0,port:0,errors:[]};if((0,k5.isTcpSubchannelAddress)(F[0])&&F[0].port===0){let J=await this.bindOneAddress(F[0],Q);if(J.error){let Z=await this.bindManyPorts(F.slice(1),Q);return Object.assign(Object.assign({},Z),{errors:[J.error,...Z.errors]})}else{let Z=F.slice(1).map((G)=>(0,k5.isTcpSubchannelAddress)(G)?{host:G.host,port:J.port}:G),K=await Promise.all(Z.map((G)=>this.bindOneAddress(G,Q))),H=[J,...K];return{count:H.filter((G)=>G.error===void 0).length,port:J.port,errors:H.filter((G)=>G.error).map((G)=>G.error)}}}else{let J=await Promise.all(F.map((Z)=>this.bindOneAddress(Z,Q)));return{count:J.filter((Z)=>Z.error===void 0).length,port:J[0].port,errors:J.filter((Z)=>Z.error).map((Z)=>Z.error)}}}async bindAddressList(F,Q){let J=await this.bindManyPorts(F,Q);if(J.count>0){if(J.count<F.length)MY.log(_6.LogVerbosity.INFO,`WARNING Only ${J.count} addresses added out of total ${F.length} resolved`);return J.port}else{let Z=`No address added out of total ${F.length} resolved`;throw MY.log(_6.LogVerbosity.ERROR,Z),Error(`${Z} errors: [${J.errors.join(",")}]`)}}resolvePort(F){return new Promise((Q,J)=>{let Z=!1,K=(G,q,B,$)=>{if(Z)return!0;if(Z=!0,!G.ok)return J(Error(G.error.details)),!0;let R=[].concat(...G.value.map((E)=>E.addresses));if(R.length===0)return J(Error(`No addresses resolved for port ${F}`)),!0;return Q(R),!0};(0,_Z0.createResolver)(F,K,this.options).updateResolution()})}async bindPort(F,Q){let J=await this.resolvePort(F);if(Q.cancelled)throw this.completeUnbind(Q),Error("bindAsync operation cancelled by unbind call");let Z=await this.bindAddressList(J,Q);if(Q.cancelled)throw this.completeUnbind(Q),Error("bindAsync operation cancelled by unbind call");return Z}normalizePort(F){let Q=(0,x8.parseUri)(F);if(Q===null)throw Error(`Could not parse port "${F}"`);let J=(0,_Z0.mapUriDefaultScheme)(Q);if(J===null)throw Error(`Could not get a default scheme for port "${F}"`);return J}bindAsync(F,Q,J){if(this.shutdown)throw Error("bindAsync called after shutdown");if(typeof F!=="string")throw TypeError("port must be a string");if(Q===null||!(Q instanceof zA.ServerCredentials))throw TypeError("creds must be a ServerCredentials object");if(typeof J!=="function")throw TypeError("callback must be a function");this.trace("bindAsync port="+F);let Z=this.normalizePort(F),K=(B,$)=>{process.nextTick(()=>J(B,$))},H=this.boundPorts.get((0,x8.uriToString)(Z));if(H){if(!Q._equals(H.credentials)){K(Error(`${F} already bound with incompatible credentials`),0);return}if(H.cancelled=!1,H.completionPromise)H.completionPromise.then((B)=>J(null,B),(B)=>J(B,0));else K(null,H.portNumber);return}H={mapKey:(0,x8.uriToString)(Z),originalUri:Z,completionPromise:null,cancelled:!1,portNumber:0,credentials:Q,listeningServers:new Set};let G=(0,x8.splitHostPort)(Z.path),q=this.bindPort(Z,H);if(H.completionPromise=q,(G===null||G===void 0?void 0:G.port)===0)q.then((B)=>{let $={scheme:Z.scheme,authority:Z.authority,path:(0,x8.combineHostPort)({host:G.host,port:B})};H.mapKey=(0,x8.uriToString)($),H.completionPromise=null,H.portNumber=B,this.boundPorts.set(H.mapKey,H),J(null,B)},(B)=>{J(B,0)});else this.boundPorts.set(H.mapKey,H),q.then((B)=>{H.completionPromise=null,H.portNumber=B,J(null,B)},(B)=>{J(B,0)})}registerInjectorToChannelz(){return(0,n6.registerChannelzSocket)("injector",()=>{return{localAddress:null,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}},this.channelzEnabled)}experimentalCreateConnectionInjectorWithChannelzRef(F,Q,J=!1){if(F===null||!(F instanceof zA.ServerCredentials))throw TypeError("creds must be a ServerCredentials object");if(this.channelzEnabled)this.listenerChildrenTracker.refChild(Q);let Z=this.createHttp2Server(F),K=new Set;return this.http2Servers.set(Z,{channelzRef:Q,sessions:K,ownsChannelzRef:J}),{injectConnection:(H)=>{Z.emit("connection",H)},drain:(H)=>{var G,q;for(let B of K)this.closeSession(B);(q=(G=setTimeout(()=>{for(let B of K)B.destroy(v9.constants.NGHTTP2_CANCEL)},H)).unref)===null||q===void 0||q.call(G)},destroy:()=>{this.closeServer(Z);for(let H of K)this.closeSession(H)}}}createConnectionInjector(F){if(F===null||!(F instanceof zA.ServerCredentials))throw TypeError("creds must be a ServerCredentials object");let Q=this.registerInjectorToChannelz();return this.experimentalCreateConnectionInjectorWithChannelzRef(F,Q,!0)}closeServer(F,Q){this.trace("Closing server with address "+JSON.stringify(F.address()));let J=this.http2Servers.get(F);F.close(()=>{if(J&&J.ownsChannelzRef)this.listenerChildrenTracker.unrefChild(J.channelzRef),(0,n6.unregisterChannelzRef)(J.channelzRef);this.http2Servers.delete(F),Q===null||Q===void 0||Q()})}closeSession(F,Q){var J;this.trace("Closing session initiated by "+((J=F.socket)===null||J===void 0?void 0:J.remoteAddress));let Z=this.sessions.get(F),K=()=>{if(Z)this.sessionChildrenTracker.unrefChild(Z.ref),(0,n6.unregisterChannelzRef)(Z.ref);Q===null||Q===void 0||Q()};if(F.closed)queueMicrotask(K);else F.close(K)}completeUnbind(F){for(let Q of F.listeningServers){let J=this.http2Servers.get(Q);if(this.closeServer(Q,()=>{F.listeningServers.delete(Q)}),J)for(let Z of J.sessions)this.closeSession(Z)}this.boundPorts.delete(F.mapKey)}unbind(F){this.trace("unbind port="+F);let Q=this.normalizePort(F),J=(0,x8.splitHostPort)(Q.path);if((J===null||J===void 0?void 0:J.port)===0)throw Error("Cannot unbind port 0");let Z=this.boundPorts.get((0,x8.uriToString)(Q));if(Z)if(this.trace("unbinding "+Z.mapKey+" originally bound as "+(0,x8.uriToString)(Z.originalUri)),Z.completionPromise)Z.cancelled=!0;else this.completeUnbind(Z)}drain(F,Q){var J,Z;this.trace("drain port="+F+" graceTimeMs="+Q);let K=this.normalizePort(F),H=(0,x8.splitHostPort)(K.path);if((H===null||H===void 0?void 0:H.port)===0)throw Error("Cannot drain port 0");let G=this.boundPorts.get((0,x8.uriToString)(K));if(!G)return;let q=new Set;for(let B of G.listeningServers){let $=this.http2Servers.get(B);if($)for(let R of $.sessions)q.add(R),this.closeSession(R,()=>{q.delete(R)})}(Z=(J=setTimeout(()=>{for(let B of q)B.destroy(v9.constants.NGHTTP2_CANCEL)},Q)).unref)===null||Z===void 0||Z.call(J)}forceShutdown(){for(let F of this.boundPorts.values())F.cancelled=!0;this.boundPorts.clear();for(let F of this.http2Servers.keys())this.closeServer(F);this.sessions.forEach((F,Q)=>{this.closeSession(Q),Q.destroy(v9.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),(0,n6.unregisterChannelzRef)(this.channelzRef),this.shutdown=!0}register(F,Q,J,Z,K){if(this.handlers.has(F))return!1;return this.handlers.set(F,{func:Q,serialize:J,deserialize:Z,type:K,path:F}),!0}unregister(F){return this.handlers.delete(F)}start(){if(this.http2Servers.size===0||[...this.http2Servers.keys()].every((F)=>!F.listening))throw Error("server must be bound in order to start");if(this.started===!0)throw Error("server is already started");this.started=!0}tryShutdown(F){var Q;let J=(H)=>{(0,n6.unregisterChannelzRef)(this.channelzRef),F(H)},Z=0;function K(){if(Z--,Z===0)J()}this.shutdown=!0;for(let[H,G]of this.http2Servers.entries()){Z++;let q=G.channelzRef.name;this.trace("Waiting for server "+q+" to close"),this.closeServer(H,()=>{this.trace("Server "+q+" finished closing"),K()});for(let B of G.sessions.keys()){Z++;let $=(Q=B.socket)===null||Q===void 0?void 0:Q.remoteAddress;this.trace("Waiting for session "+$+" to close"),this.closeSession(B,()=>{this.trace("Session "+$+" finished closing"),K()})}}if(Z===0)J()}addHttp2Port(){throw Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(F,Q){let J=Q[v9.constants.HTTP2_HEADER_CONTENT_TYPE];if(typeof J!=="string"||!J.startsWith("application/grpc"))return F.respond({[v9.constants.HTTP2_HEADER_STATUS]:v9.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1;return!0}_retrieveHandler(F){gZ0("Received call to method "+F+" at address "+this.serverAddressString);let Q=this.handlers.get(F);if(Q===void 0)return gZ0("No handler registered for method "+F+". Sending UNIMPLEMENTED status."),null;return Q}_respondWithError(F,Q,J=null){var Z,K;let H=Object.assign({"grpc-status":(Z=F.code)!==null&&Z!==void 0?Z:_6.Status.INTERNAL,"grpc-message":F.details,[v9.constants.HTTP2_HEADER_STATUS]:v9.constants.HTTP_STATUS_OK,[v9.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},(K=F.metadata)===null||K===void 0?void 0:K.toHttp2Headers());Q.respond(H,{endStream:!0}),this.callTracker.addCallFailed(),J===null||J===void 0||J.streamTracker.addCallFailed()}_channelzHandler(F,Q,J){this.onStreamOpened(Q);let Z=this.sessions.get(Q.session);if(this.callTracker.addCallStarted(),Z===null||Z===void 0||Z.streamTracker.addCallStarted(),!this._verifyContentType(Q,J)){this.callTracker.addCallFailed(),Z===null||Z===void 0||Z.streamTracker.addCallFailed();return}let K=J[uZ0],H=this._retrieveHandler(K);if(!H){this._respondWithError(HA(K),Q,Z);return}let G={addMessageSent:()=>{if(Z)Z.messagesSent+=1,Z.lastMessageSentTimestamp=new Date},addMessageReceived:()=>{if(Z)Z.messagesReceived+=1,Z.lastMessageReceivedTimestamp=new Date},onCallEnd:(B)=>{if(B.code===_6.Status.OK)this.callTracker.addCallSucceeded();else this.callTracker.addCallFailed()},onStreamEnd:(B)=>{if(Z)if(B)Z.streamTracker.addCallSucceeded();else Z.streamTracker.addCallFailed()}},q=(0,xZ0.getServerInterceptingCall)([...F,...this.interceptors],Q,J,G,H,this.options);if(!this._runHandlerForCall(q,H))this.callTracker.addCallFailed(),Z===null||Z===void 0||Z.streamTracker.addCallFailed(),q.sendStatus({code:_6.Status.INTERNAL,details:`Unknown handler type: ${H.type}`})}_streamHandler(F,Q,J){if(this.onStreamOpened(Q),this._verifyContentType(Q,J)!==!0)return;let Z=J[uZ0],K=this._retrieveHandler(Z);if(!K){this._respondWithError(HA(Z),Q,null);return}let H=(0,xZ0.getServerInterceptingCall)([...F,...this.interceptors],Q,J,null,K,this.options);if(!this._runHandlerForCall(H,K))H.sendStatus({code:_6.Status.INTERNAL,details:`Unknown handler type: ${K.type}`})}_runHandlerForCall(F,Q){let{type:J}=Q;if(J==="unary")q51(F,Q);else if(J==="clientStream")H51(F,Q);else if(J==="serverStream")V51(F,Q);else if(J==="bidi")B51(F,Q);else return!1;return!0}_setupHandlers(F,Q){if(F===null)return;let J=F.address(),Z="null";if(J)if(typeof J==="string")Z=J;else Z=J.address+":"+J.port;this.serverAddressString=Z;let K=this.channelzEnabled?this._channelzHandler:this._streamHandler,H=this.channelzEnabled?this._channelzSessionHandler(F):this._sessionHandler(F);F.on("stream",K.bind(this,Q)),F.on("session",H)}_sessionHandler(F){return(Q)=>{var J,Z;(J=this.http2Servers.get(F))===null||J===void 0||J.sessions.add(Q);let K=null,H=null,G=null,q=!1,B=this.enableIdleTimeout(Q);if(this.maxConnectionAgeMs!==RY){let A=this.maxConnectionAgeMs/10,T=Math.random()*A*2-A;K=setTimeout(()=>{var I,C;q=!0,this.trace("Connection dropped by max connection age: "+((I=Q.socket)===null||I===void 0?void 0:I.remoteAddress));try{Q.goaway(v9.constants.NGHTTP2_NO_ERROR,2147483647,mZ0)}catch(M){Q.destroy();return}if(Q.close(),this.maxConnectionAgeGraceMs!==RY)H=setTimeout(()=>{Q.destroy()},this.maxConnectionAgeGraceMs),(C=H.unref)===null||C===void 0||C.call(H)},this.maxConnectionAgeMs+T),(Z=K.unref)===null||Z===void 0||Z.call(K)}let $=()=>{if(G)clearTimeout(G),G=null},R=()=>{return!Q.destroyed&&this.keepaliveTimeMs<qA&&this.keepaliveTimeMs>0},E,U=()=>{var A;if(!R())return;this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),G=setTimeout(()=>{$(),E()},this.keepaliveTimeMs),(A=G.unref)===null||A===void 0||A.call(G)};E=()=>{var A;if(!R())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let T="";try{if(!Q.ping((C,M,w)=>{if($(),C)this.keepaliveTrace("Ping failed with error: "+C.message),q=!0,Q.destroy();else this.keepaliveTrace("Received ping response"),U()}))T="Ping returned false"}catch(I){T=(I instanceof Error?I.message:"")||"Unknown error"}if(T){this.keepaliveTrace("Ping send failed: "+T),this.trace("Connection dropped due to ping send error: "+T),q=!0,Q.destroy();return}G=setTimeout(()=>{$(),this.keepaliveTrace("Ping timeout passed without response"),this.trace("Connection dropped by keepalive timeout"),q=!0,Q.destroy()},this.keepaliveTimeoutMs),(A=G.unref)===null||A===void 0||A.call(G)},U(),Q.on("close",()=>{var A,T;if(!q)this.trace(`Connection dropped by client ${(A=Q.socket)===null||A===void 0?void 0:A.remoteAddress}`);if(K)clearTimeout(K);if(H)clearTimeout(H);if($(),B!==null)clearTimeout(B.timeout),this.sessionIdleTimeouts.delete(Q);(T=this.http2Servers.get(F))===null||T===void 0||T.sessions.delete(Q)})}}_channelzSessionHandler(F){return(Q)=>{var J,Z,K,H;let G=(0,n6.registerChannelzSocket)((Z=(J=Q.socket)===null||J===void 0?void 0:J.remoteAddress)!==null&&Z!==void 0?Z:"unknown",this.getChannelzSessionInfo.bind(this,Q),this.channelzEnabled),q={ref:G,streamTracker:new n6.ChannelzCallTracker,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};(K=this.http2Servers.get(F))===null||K===void 0||K.sessions.add(Q),this.sessions.set(Q,q);let B=`${Q.socket.remoteAddress}:${Q.socket.remotePort}`;this.channelzTrace.addTrace("CT_INFO","Connection established by client "+B),this.trace("Connection established by client "+B),this.sessionChildrenTracker.refChild(G);let $=null,R=null,E=null,U=!1,A=this.enableIdleTimeout(Q);if(this.maxConnectionAgeMs!==RY){let w=this.maxConnectionAgeMs/10,P=Math.random()*w*2-w;$=setTimeout(()=>{var y;U=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+B);try{Q.goaway(v9.constants.NGHTTP2_NO_ERROR,2147483647,mZ0)}catch(v){Q.destroy();return}if(Q.close(),this.maxConnectionAgeGraceMs!==RY)R=setTimeout(()=>{Q.destroy()},this.maxConnectionAgeGraceMs),(y=R.unref)===null||y===void 0||y.call(R)},this.maxConnectionAgeMs+P),(H=$.unref)===null||H===void 0||H.call($)}let T=()=>{if(E)clearTimeout(E),E=null},I=()=>{return!Q.destroyed&&this.keepaliveTimeMs<qA&&this.keepaliveTimeMs>0},C,M=()=>{var w;if(!I())return;this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),E=setTimeout(()=>{T(),C()},this.keepaliveTimeMs),(w=E.unref)===null||w===void 0||w.call(E)};C=()=>{var w;if(!I())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let P="";try{if(!Q.ping((v,f,_)=>{if(T(),v)this.keepaliveTrace("Ping failed with error: "+v.message),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to error of a ping frame "+v.message+" return in "+f),U=!0,Q.destroy();else this.keepaliveTrace("Received ping response"),M()}))P="Ping returned false"}catch(y){P=(y instanceof Error?y.message:"")||"Unknown error"}if(P){this.keepaliveTrace("Ping send failed: "+P),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to ping send error: "+P),U=!0,Q.destroy();return}q.keepAlivesSent+=1,E=setTimeout(()=>{T(),this.keepaliveTrace("Ping timeout passed without response"),this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+B),U=!0,Q.destroy()},this.keepaliveTimeoutMs),(w=E.unref)===null||w===void 0||w.call(E)},M(),Q.on("close",()=>{var w;if(!U)this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+B);if(this.sessionChildrenTracker.unrefChild(G),(0,n6.unregisterChannelzRef)(G),$)clearTimeout($);if(R)clearTimeout(R);if(T(),A!==null)clearTimeout(A.timeout),this.sessionIdleTimeouts.delete(Q);(w=this.http2Servers.get(F))===null||w===void 0||w.sessions.delete(Q),this.sessions.delete(Q)})}}enableIdleTimeout(F){var Q,J;if(this.sessionIdleTimeout>=bZ0)return null;let Z={activeStreams:0,lastIdle:Date.now(),onClose:this.onStreamClose.bind(this,F),timeout:setTimeout(this.onIdleTimeout,this.sessionIdleTimeout,this,F)};(J=(Q=Z.timeout).unref)===null||J===void 0||J.call(Q),this.sessionIdleTimeouts.set(F,Z);let{socket:K}=F;return this.trace("Enable idle timeout for "+K.remoteAddress+":"+K.remotePort),Z}onIdleTimeout(F,Q){let{socket:J}=Q,Z=F.sessionIdleTimeouts.get(Q);if(Z!==void 0&&Z.activeStreams===0)if(Date.now()-Z.lastIdle>=F.sessionIdleTimeout)F.trace("Session idle timeout triggered for "+(J===null||J===void 0?void 0:J.remoteAddress)+":"+(J===null||J===void 0?void 0:J.remotePort)+" last idle at "+Z.lastIdle),F.closeSession(Q);else Z.timeout.refresh()}onStreamOpened(F){let Q=F.session,J=this.sessionIdleTimeouts.get(Q);if(J)J.activeStreams+=1,F.once("close",J.onClose)}onStreamClose(F){var Q,J;let Z=this.sessionIdleTimeouts.get(F);if(Z){if(Z.activeStreams-=1,Z.activeStreams===0)Z.lastIdle=Date.now(),Z.timeout.refresh(),this.trace("Session onStreamClose"+((Q=F.socket)===null||Q===void 0?void 0:Q.remoteAddress)+":"+((J=F.socket)===null||J===void 0?void 0:J.remotePort)+" at "+Z.lastIdle)}}},(()=>{let z=typeof Symbol==="function"&&Symbol.metadata?Object.create(null):void 0;if(W=[K51("Calling start() is no longer necessary. It can be safely omitted.")],Z51(X,null,W,{kind:"method",name:"start",static:!1,private:!1,access:{has:(F)=>("start"in F),get:(F)=>F.start},metadata:z},null,Y),z)Object.defineProperty(X,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:z})})(),X})();v5.Server=z51;async function q51(X,Y){let W;function z(J,Z,K,H){if(J){X.sendStatus((0,LY.serverErrorToStatus)(J,K));return}X.sendMessage(Z,()=>{X.sendStatus({code:_6.Status.OK,details:"OK",metadata:K!==null&&K!==void 0?K:null})})}let F,Q=null;X.start({onReceiveMetadata(J){F=J,X.startRead()},onReceiveMessage(J){if(Q){X.sendStatus({code:_6.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${Y.path}`,metadata:null});return}Q=J,X.startRead()},onReceiveHalfClose(){if(!Q){X.sendStatus({code:_6.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${Y.path}`,metadata:null});return}W=new LY.ServerWritableStreamImpl(Y.path,X,F,Q);try{Y.func(W,z)}catch(J){X.sendStatus({code:_6.Status.UNKNOWN,details:`Server method handler threw error ${J.message}`,metadata:null})}},onCancel(){if(W)W.cancelled=!0,W.emit("cancelled","cancelled")}})}function H51(X,Y){let W;function z(F,Q,J,Z){if(F){X.sendStatus((0,LY.serverErrorToStatus)(F,J));return}X.sendMessage(Q,()=>{X.sendStatus({code:_6.Status.OK,details:"OK",metadata:J!==null&&J!==void 0?J:null})})}X.start({onReceiveMetadata(F){W=new LY.ServerDuplexStreamImpl(Y.path,X,F);try{Y.func(W,z)}catch(Q){X.sendStatus({code:_6.Status.UNKNOWN,details:`Server method handler threw error ${Q.message}`,metadata:null})}},onReceiveMessage(F){W.push(F)},onReceiveHalfClose(){W.push(null)},onCancel(){if(W)W.cancelled=!0,W.emit("cancelled","cancelled"),W.destroy()}})}function V51(X,Y){let W,z,F=null;X.start({onReceiveMetadata(Q){z=Q,X.startRead()},onReceiveMessage(Q){if(F){X.sendStatus({code:_6.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${Y.path}`,metadata:null});return}F=Q,X.startRead()},onReceiveHalfClose(){if(!F){X.sendStatus({code:_6.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${Y.path}`,metadata:null});return}W=new LY.ServerWritableStreamImpl(Y.path,X,z,F);try{Y.func(W)}catch(Q){X.sendStatus({code:_6.Status.UNKNOWN,details:`Server method handler threw error ${Q.message}`,metadata:null})}},onCancel(){if(W)W.cancelled=!0,W.emit("cancelled","cancelled"),W.destroy()}})}function B51(X,Y){let W;X.start({onReceiveMetadata(z){W=new LY.ServerDuplexStreamImpl(Y.path,X,z);try{Y.func(W)}catch(F){X.sendStatus({code:_6.Status.UNKNOWN,details:`Server method handler threw error ${F.message}`,metadata:null})}},onReceiveMessage(z){W.push(z)},onReceiveHalfClose(){W.push(null)},onCancel(){if(W)W.cancelled=!0,W.emit("cancelled","cancelled"),W.destroy()}})}});var nZ0=X0((lZ0)=>{Object.defineProperty(lZ0,"__esModule",{value:!0});lZ0.StatusBuilder=void 0;class cZ0{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(X){return this.code=X,this}withDetails(X){return this.details=X,this}withMetadata(X){return this.metadata=X,this}build(){let X={};if(this.code!==null)X.code=this.code;if(this.details!==null)X.details=this.details;if(this.metadata!==null)X.metadata=this.metadata;return X}}lZ0.StatusBuilder=cZ0});var gQ=X0((XQ0)=>{Object.defineProperty(XQ0,"__esModule",{value:!0});XQ0.LeafLoadBalancer=XQ0.PickFirstLoadBalancer=XQ0.PickFirstLoadBalancingConfig=void 0;XQ0.shuffled=tZ0;XQ0.setup=D51;var VA=E5(),x6=C9(),j5=b4(),iZ0=y9(),U51=A6(),N51=a1(),aZ0=y9(),rZ0=F1("net"),A51=h7(),O51="pick_first";function uQ(X){U51.trace(N51.LogVerbosity.DEBUG,O51,X)}var mQ="pick_first",T51=250;class PY{constructor(X){this.shuffleAddressList=X}getLoadBalancerName(){return mQ}toJsonObject(){return{[mQ]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(X){if("shuffleAddressList"in X&&typeof X.shuffleAddressList!=="boolean")throw Error("pick_first config field shuffleAddressList must be a boolean if provided");return new PY(X.shuffleAddressList===!0)}}XQ0.PickFirstLoadBalancingConfig=PY;class oZ0{constructor(X){this.subchannel=X}pick(X){return{pickResultType:j5.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}}function tZ0(X){let Y=X.slice();for(let W=Y.length-1;W>1;W--){let z=Math.floor(Math.random()*(W+1)),F=Y[W];Y[W]=Y[z],Y[z]=F}return Y}function I51(X){if(X.length===0)return[];let Y=[],W=[],z=[],F=(0,aZ0.isTcpSubchannelAddress)(X[0])&&(0,rZ0.isIPv6)(X[0].host);for(let Z of X)if((0,aZ0.isTcpSubchannelAddress)(Z)&&(0,rZ0.isIPv6)(Z.host))W.push(Z);else z.push(Z);let Q=F?W:z,J=F?z:W;for(let Z=0;Z<Math.max(Q.length,J.length);Z++){if(Z<Q.length)Y.push(Q[Z]);if(Z<J.length)Y.push(J[Z])}return Y}var sZ0="grpc-node.internal.pick-first.report_health_status";class UK{constructor(X){this.channelControlHelper=X,this.children=[],this.currentState=x6.ConnectivityState.IDLE,this.currentSubchannelIndex=0,this.currentPick=null,this.subchannelStateListener=(Y,W,z,F,Q)=>{this.onSubchannelStateUpdate(Y,W,z,Q)},this.pickedSubchannelHealthListener=()=>this.calculateAndReportNewState(),this.stickyTransientFailureMode=!1,this.reportHealthStatus=!1,this.lastError=null,this.latestAddressList=null,this.latestOptions={},this.latestResolutionNote="",this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout)}allChildrenHaveReportedTF(){return this.children.every((X)=>X.hasReportedTransientFailure)}resetChildrenReportedTF(){this.children.every((X)=>X.hasReportedTransientFailure=!1)}calculateAndReportNewState(){var X;if(this.currentPick)if(this.reportHealthStatus&&!this.currentPick.isHealthy()){let Y=`Picked subchannel ${this.currentPick.getAddress()} is unhealthy`;this.updateState(x6.ConnectivityState.TRANSIENT_FAILURE,new j5.UnavailablePicker({details:Y}),Y)}else this.updateState(x6.ConnectivityState.READY,new oZ0(this.currentPick),null);else if(((X=this.latestAddressList)===null||X===void 0?void 0:X.length)===0){let Y=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(x6.ConnectivityState.TRANSIENT_FAILURE,new j5.UnavailablePicker({details:Y}),Y)}else if(this.children.length===0)this.updateState(x6.ConnectivityState.IDLE,new j5.QueuePicker(this),null);else if(this.stickyTransientFailureMode){let Y=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(x6.ConnectivityState.TRANSIENT_FAILURE,new j5.UnavailablePicker({details:Y}),Y)}else this.updateState(x6.ConnectivityState.CONNECTING,new j5.QueuePicker(this),null)}requestReresolution(){this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(!this.allChildrenHaveReportedTF())return;if(this.requestReresolution(),this.resetChildrenReportedTF(),this.stickyTransientFailureMode){this.calculateAndReportNewState();return}this.stickyTransientFailureMode=!0;for(let{subchannel:X}of this.children)X.startConnecting();this.calculateAndReportNewState()}removeCurrentPick(){if(this.currentPick!==null)this.currentPick.removeConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef()),this.currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick.unref(),this.currentPick=null}onSubchannelStateUpdate(X,Y,W,z){var F;if((F=this.currentPick)===null||F===void 0?void 0:F.realSubchannelEquals(X)){if(W!==x6.ConnectivityState.READY)this.removeCurrentPick(),this.calculateAndReportNewState();return}for(let[Q,J]of this.children.entries())if(X.realSubchannelEquals(J.subchannel)){if(W===x6.ConnectivityState.READY)this.pickSubchannel(J.subchannel);if(W===x6.ConnectivityState.TRANSIENT_FAILURE){if(J.hasReportedTransientFailure=!0,z)this.lastError=z;if(this.maybeEnterStickyTransientFailureMode(),Q===this.currentSubchannelIndex)this.startNextSubchannelConnecting(Q+1)}J.subchannel.startConnecting();return}}startNextSubchannelConnecting(X){clearTimeout(this.connectionDelayTimeout);for(let[Y,W]of this.children.entries())if(Y>=X){let z=W.subchannel.getConnectivityState();if(z===x6.ConnectivityState.IDLE||z===x6.ConnectivityState.CONNECTING){this.startConnecting(Y);return}}this.maybeEnterStickyTransientFailureMode()}startConnecting(X){var Y,W;if(clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=X,this.children[X].subchannel.getConnectivityState()===x6.ConnectivityState.IDLE)uQ("Start connecting to subchannel with address "+this.children[X].subchannel.getAddress()),process.nextTick(()=>{var z;(z=this.children[X])===null||z===void 0||z.subchannel.startConnecting()});this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting(X+1)},T51),(W=(Y=this.connectionDelayTimeout).unref)===null||W===void 0||W.call(Y)}pickSubchannel(X){uQ("Pick subchannel with address "+X.getAddress()),this.stickyTransientFailureMode=!1,X.ref(),this.channelControlHelper.addChannelzChild(X.getChannelzRef()),this.removeCurrentPick(),this.resetSubchannelList(),X.addConnectivityStateListener(this.subchannelStateListener),X.addHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick=X,clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState()}updateState(X,Y,W){uQ(x6.ConnectivityState[this.currentState]+" -> "+x6.ConnectivityState[X]),this.currentState=X,this.channelControlHelper.updateState(X,Y,W)}resetSubchannelList(){for(let X of this.children)X.subchannel.removeConnectivityStateListener(this.subchannelStateListener),X.subchannel.unref(),this.channelControlHelper.removeChannelzChild(X.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[]}connectToAddressList(X,Y){uQ("connectToAddressList(["+X.map((z)=>(0,iZ0.subchannelAddressToString)(z))+"])");let W=X.map((z)=>({subchannel:this.channelControlHelper.createSubchannel(z,Y),hasReportedTransientFailure:!1}));for(let{subchannel:z}of W)if(z.getConnectivityState()===x6.ConnectivityState.READY){this.pickSubchannel(z);return}for(let{subchannel:z}of W)z.ref(),this.channelControlHelper.addChannelzChild(z.getChannelzRef());this.resetSubchannelList(),this.children=W;for(let{subchannel:z}of this.children)z.addConnectivityStateListener(this.subchannelStateListener);for(let z of this.children)if(z.subchannel.getConnectivityState()===x6.ConnectivityState.TRANSIENT_FAILURE)z.hasReportedTransientFailure=!0;this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(X,Y,W,z){if(!(Y instanceof PY))return!1;if(!X.ok){if(this.children.length===0&&this.currentPick===null)this.channelControlHelper.updateState(x6.ConnectivityState.TRANSIENT_FAILURE,new j5.UnavailablePicker(X.error),X.error.details);return!0}let F=X.value;if(this.reportHealthStatus=W[sZ0],Y.getShuffleAddressList())F=tZ0(F);let Q=[].concat(...F.map((Z)=>Z.addresses));uQ("updateAddressList(["+Q.map((Z)=>(0,iZ0.subchannelAddressToString)(Z))+"])");let J=I51(Q);if(this.latestAddressList=J,this.latestOptions=W,this.connectToAddressList(J,W),this.latestResolutionNote=z,Q.length>0)return!0;else return this.lastError="No addresses resolved",!1}exitIdle(){if(this.currentState===x6.ConnectivityState.IDLE&&this.latestAddressList)this.connectToAddressList(this.latestAddressList,this.latestOptions)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return mQ}}XQ0.PickFirstLoadBalancer=UK;var $51=new PY(!1);class eZ0{constructor(X,Y,W,z){this.endpoint=X,this.options=W,this.resolutionNote=z,this.latestState=x6.ConnectivityState.IDLE;let F=(0,VA.createChildChannelControlHelper)(Y,{updateState:(Q,J,Z)=>{this.latestState=Q,this.latestPicker=J,Y.updateState(Q,J,Z)}});this.pickFirstBalancer=new UK(F),this.latestPicker=new j5.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList((0,A51.statusOrFromValue)([this.endpoint]),$51,Object.assign(Object.assign({},this.options),{[sZ0]:!0}),this.resolutionNote)}updateEndpoint(X,Y){if(this.options=Y,this.endpoint=X,this.latestState!==x6.ConnectivityState.IDLE)this.startConnecting()}getConnectivityState(){return this.latestState}getPicker(){return this.latestPicker}getEndpoint(){return this.endpoint}exitIdle(){this.pickFirstBalancer.exitIdle()}destroy(){this.pickFirstBalancer.destroy()}}XQ0.LeafLoadBalancer=eZ0;function D51(){(0,VA.registerLoadBalancerType)(mQ,UK,PY),(0,VA.registerDefaultLoadBalancerType)(mQ)}});var WQ0=X0((QQ0)=>{Object.defineProperty(QQ0,"__esModule",{value:!0});QQ0.FileWatcherCertificateProvider=void 0;var L51=F1("fs"),P51=A6(),w51=a1(),S51=F1("util"),f51="certificate_provider";function NK(X){P51.trace(w51.LogVerbosity.DEBUG,f51,X)}var BA=(0,S51.promisify)(L51.readFile);class ZQ0{constructor(X){if(this.config=X,this.refreshTimer=null,this.fileResultPromise=null,this.latestCaUpdate=void 0,this.caListeners=new Set,this.latestIdentityUpdate=void 0,this.identityListeners=new Set,this.lastUpdateTime=null,X.certificateFile===void 0!==(X.privateKeyFile===void 0))throw Error("certificateFile and privateKeyFile must be set or unset together");if(X.certificateFile===void 0&&X.caCertificateFile===void 0)throw Error("At least one of certificateFile and caCertificateFile must be set");NK("File watcher constructed with config "+JSON.stringify(X))}updateCertificates(){if(this.fileResultPromise)return;this.fileResultPromise=Promise.allSettled([this.config.certificateFile?BA(this.config.certificateFile):Promise.reject(),this.config.privateKeyFile?BA(this.config.privateKeyFile):Promise.reject(),this.config.caCertificateFile?BA(this.config.caCertificateFile):Promise.reject()]),this.fileResultPromise.then(([X,Y,W])=>{if(!this.refreshTimer)return;if(NK("File watcher read certificates certificate "+X.status+", privateKey "+Y.status+", CA certificate "+W.status),this.lastUpdateTime=new Date,this.fileResultPromise=null,X.status==="fulfilled"&&Y.status==="fulfilled")this.latestIdentityUpdate={certificate:X.value,privateKey:Y.value};else this.latestIdentityUpdate=null;if(W.status==="fulfilled")this.latestCaUpdate={caCertificate:W.value};else this.latestCaUpdate=null;for(let z of this.identityListeners)z(this.latestIdentityUpdate);for(let z of this.caListeners)z(this.latestCaUpdate)}),NK("File watcher initiated certificate update")}maybeStartWatchingFiles(){if(!this.refreshTimer){let X=this.lastUpdateTime?new Date().getTime()-this.lastUpdateTime.getTime():1/0;if(X>this.config.refreshIntervalMs)this.updateCertificates();if(X>this.config.refreshIntervalMs*2)this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0;this.refreshTimer=setInterval(()=>this.updateCertificates(),this.config.refreshIntervalMs),NK("File watcher started watching")}}maybeStopWatchingFiles(){if(this.caListeners.size===0&&this.identityListeners.size===0){if(this.fileResultPromise=null,this.refreshTimer)clearInterval(this.refreshTimer),this.refreshTimer=null}}addCaCertificateListener(X){if(this.caListeners.add(X),this.maybeStartWatchingFiles(),this.latestCaUpdate!==void 0)process.nextTick(X,this.latestCaUpdate)}removeCaCertificateListener(X){this.caListeners.delete(X),this.maybeStopWatchingFiles()}addIdentityCertificateListener(X){if(this.identityListeners.add(X),this.maybeStartWatchingFiles(),this.latestIdentityUpdate!==void 0)process.nextTick(X,this.latestIdentityUpdate)}removeIdentityCertificateListener(X){this.identityListeners.delete(X),this.maybeStopWatchingFiles()}}QQ0.FileWatcherCertificateProvider=ZQ0});var AA=X0((o1)=>{Object.defineProperty(o1,"__esModule",{value:!0});o1.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=o1.createCertificateProviderChannelCredentials=o1.FileWatcherCertificateProvider=o1.createCertificateProviderServerCredentials=o1.createServerCredentialsWithInterceptors=o1.BaseSubchannelWrapper=o1.registerAdminService=o1.FilterStackFactory=o1.BaseFilter=o1.statusOrFromError=o1.statusOrFromValue=o1.PickResultType=o1.QueuePicker=o1.UnavailablePicker=o1.ChildLoadBalancerHandler=o1.EndpointMap=o1.endpointHasAddress=o1.endpointToString=o1.subchannelAddressToString=o1.LeafLoadBalancer=o1.isLoadBalancerNameRegistered=o1.parseLoadBalancingConfig=o1.selectLbConfigFromList=o1.registerLoadBalancerType=o1.createChildChannelControlHelper=o1.BackoffTimeout=o1.parseDuration=o1.durationToMs=o1.splitHostPort=o1.uriToString=o1.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=o1.createResolver=o1.registerResolver=o1.log=o1.trace=void 0;var GQ0=A6();Object.defineProperty(o1,"trace",{enumerable:!0,get:function(){return GQ0.trace}});Object.defineProperty(o1,"log",{enumerable:!0,get:function(){return GQ0.log}});var UA=y8();Object.defineProperty(o1,"registerResolver",{enumerable:!0,get:function(){return UA.registerResolver}});Object.defineProperty(o1,"createResolver",{enumerable:!0,get:function(){return UA.createResolver}});Object.defineProperty(o1,"CHANNEL_ARGS_CONFIG_SELECTOR_KEY",{enumerable:!0,get:function(){return UA.CHANNEL_ARGS_CONFIG_SELECTOR_KEY}});var KQ0=E9();Object.defineProperty(o1,"uriToString",{enumerable:!0,get:function(){return KQ0.uriToString}});Object.defineProperty(o1,"splitHostPort",{enumerable:!0,get:function(){return KQ0.splitHostPort}});var FQ0=bQ();Object.defineProperty(o1,"durationToMs",{enumerable:!0,get:function(){return FQ0.durationToMs}});Object.defineProperty(o1,"parseDuration",{enumerable:!0,get:function(){return FQ0.parseDuration}});var y51=QY();Object.defineProperty(o1,"BackoffTimeout",{enumerable:!0,get:function(){return y51.BackoffTimeout}});var dQ=E5();Object.defineProperty(o1,"createChildChannelControlHelper",{enumerable:!0,get:function(){return dQ.createChildChannelControlHelper}});Object.defineProperty(o1,"registerLoadBalancerType",{enumerable:!0,get:function(){return dQ.registerLoadBalancerType}});Object.defineProperty(o1,"selectLbConfigFromList",{enumerable:!0,get:function(){return dQ.selectLbConfigFromList}});Object.defineProperty(o1,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return dQ.parseLoadBalancingConfig}});Object.defineProperty(o1,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return dQ.isLoadBalancerNameRegistered}});var k51=gQ();Object.defineProperty(o1,"LeafLoadBalancer",{enumerable:!0,get:function(){return k51.LeafLoadBalancer}});var AK=y9();Object.defineProperty(o1,"subchannelAddressToString",{enumerable:!0,get:function(){return AK.subchannelAddressToString}});Object.defineProperty(o1,"endpointToString",{enumerable:!0,get:function(){return AK.endpointToString}});Object.defineProperty(o1,"endpointHasAddress",{enumerable:!0,get:function(){return AK.endpointHasAddress}});Object.defineProperty(o1,"EndpointMap",{enumerable:!0,get:function(){return AK.EndpointMap}});var v51=UG();Object.defineProperty(o1,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return v51.ChildLoadBalancerHandler}});var NA=b4();Object.defineProperty(o1,"UnavailablePicker",{enumerable:!0,get:function(){return NA.UnavailablePicker}});Object.defineProperty(o1,"QueuePicker",{enumerable:!0,get:function(){return NA.QueuePicker}});Object.defineProperty(o1,"PickResultType",{enumerable:!0,get:function(){return NA.PickResultType}});var zQ0=h7();Object.defineProperty(o1,"statusOrFromValue",{enumerable:!0,get:function(){return zQ0.statusOrFromValue}});Object.defineProperty(o1,"statusOrFromError",{enumerable:!0,get:function(){return zQ0.statusOrFromError}});var j51=wN();Object.defineProperty(o1,"BaseFilter",{enumerable:!0,get:function(){return j51.BaseFilter}});var h51=rG();Object.defineProperty(o1,"FilterStackFactory",{enumerable:!0,get:function(){return h51.FilterStackFactory}});var _51=AG();Object.defineProperty(o1,"registerAdminService",{enumerable:!0,get:function(){return _51.registerAdminService}});var x51=_Q();Object.defineProperty(o1,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return x51.BaseSubchannelWrapper}});var qQ0=FK();Object.defineProperty(o1,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return qQ0.createServerCredentialsWithInterceptors}});Object.defineProperty(o1,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return qQ0.createCertificateProviderServerCredentials}});var b51=WQ0();Object.defineProperty(o1,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return b51.FileWatcherCertificateProvider}});var u51=ZY();Object.defineProperty(o1,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return u51.createCertificateProviderChannelCredentials}});var m51=rN();Object.defineProperty(o1,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return m51.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})});var BQ0=X0((VQ0)=>{Object.defineProperty(VQ0,"__esModule",{value:!0});VQ0.setup=l51;var d51=y8(),c51=h7();class HQ0{constructor(X,Y,W){this.listener=Y,this.hasReturnedResult=!1,this.endpoints=[];let z;if(X.authority==="")z="/"+X.path;else z=X.path;this.endpoints=[{addresses:[{path:z}]}]}updateResolution(){if(!this.hasReturnedResult)this.hasReturnedResult=!0,process.nextTick(this.listener,(0,c51.statusOrFromValue)(this.endpoints),{},null,"")}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(X){return"localhost"}}function l51(){(0,d51.registerResolver)("unix",HQ0)}});var $Q0=X0((IQ0)=>{Object.defineProperty(IQ0,"__esModule",{value:!0});IQ0.setup=o51;var UQ0=F1("net"),NQ0=h7(),OK=a1(),OA=s6(),AQ0=y8(),n51=y9(),OQ0=E9(),i51=A6(),a51="ip_resolver";function TQ0(X){i51.trace(OK.LogVerbosity.DEBUG,a51,X)}var TA="ipv4",IA="ipv6",r51=443;class $A{constructor(X,Y,W){var z;this.listener=Y,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,TQ0("Resolver constructed for target "+(0,OQ0.uriToString)(X));let F=[];if(!(X.scheme===TA||X.scheme===IA)){this.error={code:OK.Status.UNAVAILABLE,details:`Unrecognized scheme ${X.scheme} in IP resolver`,metadata:new OA.Metadata};return}let Q=X.path.split(",");for(let J of Q){let Z=(0,OQ0.splitHostPort)(J);if(Z===null){this.error={code:OK.Status.UNAVAILABLE,details:`Failed to parse ${X.scheme} address ${J}`,metadata:new OA.Metadata};return}if(X.scheme===TA&&!(0,UQ0.isIPv4)(Z.host)||X.scheme===IA&&!(0,UQ0.isIPv6)(Z.host)){this.error={code:OK.Status.UNAVAILABLE,details:`Failed to parse ${X.scheme} address ${J}`,metadata:new OA.Metadata};return}F.push({host:Z.host,port:(z=Z.port)!==null&&z!==void 0?z:r51})}this.endpoints=F.map((J)=>({addresses:[J]})),TQ0("Parsed "+X.scheme+" address list "+F.map(n51.subchannelAddressToString))}updateResolution(){if(!this.hasReturnedResult)this.hasReturnedResult=!0,process.nextTick(()=>{if(this.error)this.listener((0,NQ0.statusOrFromError)(this.error),{},null,"");else this.listener((0,NQ0.statusOrFromValue)(this.endpoints),{},null,"")})}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(X){return X.path.split(",")[0]}}function o51(){(0,AQ0.registerResolver)(TA,$A),(0,AQ0.registerResolver)(IA,$A)}});var PQ0=X0((MQ0)=>{Object.defineProperty(MQ0,"__esModule",{value:!0});MQ0.RoundRobinLoadBalancer=void 0;MQ0.setup=Q71;var CQ0=E5(),B9=C9(),cQ=b4(),s51=A6(),e51=a1(),DQ0=y9(),X71=gQ(),Y71="round_robin";function EQ0(X){s51.trace(e51.LogVerbosity.DEBUG,Y71,X)}var TK="round_robin";class IK{getLoadBalancerName(){return TK}constructor(){}toJsonObject(){return{[TK]:{}}}static createFromJson(X){return new IK}}class RQ0{constructor(X,Y=0){this.children=X,this.nextIndex=Y}pick(X){let Y=this.children[this.nextIndex].picker;return this.nextIndex=(this.nextIndex+1)%this.children.length,Y.pick(X)}peekNextEndpoint(){return this.children[this.nextIndex].endpoint}}function Z71(X,Y){return[...X.slice(Y),...X.slice(0,Y)]}class DA{constructor(X){this.channelControlHelper=X,this.children=[],this.currentState=B9.ConnectivityState.IDLE,this.currentReadyPicker=null,this.updatesPaused=!1,this.lastError=null,this.childChannelControlHelper=(0,CQ0.createChildChannelControlHelper)(X,{updateState:(Y,W,z)=>{if(this.currentState===B9.ConnectivityState.READY&&Y!==B9.ConnectivityState.READY)this.channelControlHelper.requestReresolution();if(z)this.lastError=z;this.calculateAndUpdateState()}})}countChildrenWithState(X){return this.children.filter((Y)=>Y.getConnectivityState()===X).length}calculateAndUpdateState(){if(this.updatesPaused)return;if(this.countChildrenWithState(B9.ConnectivityState.READY)>0){let X=this.children.filter((W)=>W.getConnectivityState()===B9.ConnectivityState.READY),Y=0;if(this.currentReadyPicker!==null){let W=this.currentReadyPicker.peekNextEndpoint();if(Y=X.findIndex((z)=>(0,DQ0.endpointEqual)(z.getEndpoint(),W)),Y<0)Y=0}this.updateState(B9.ConnectivityState.READY,new RQ0(X.map((W)=>({endpoint:W.getEndpoint(),picker:W.getPicker()})),Y),null)}else if(this.countChildrenWithState(B9.ConnectivityState.CONNECTING)>0)this.updateState(B9.ConnectivityState.CONNECTING,new cQ.QueuePicker(this),null);else if(this.countChildrenWithState(B9.ConnectivityState.TRANSIENT_FAILURE)>0){let X=`round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(B9.ConnectivityState.TRANSIENT_FAILURE,new cQ.UnavailablePicker({details:X}),X)}else this.updateState(B9.ConnectivityState.IDLE,new cQ.QueuePicker(this),null);for(let X of this.children)if(X.getConnectivityState()===B9.ConnectivityState.IDLE)X.exitIdle()}updateState(X,Y,W){if(EQ0(B9.ConnectivityState[this.currentState]+" -> "+B9.ConnectivityState[X]),X===B9.ConnectivityState.READY)this.currentReadyPicker=Y;else this.currentReadyPicker=null;this.currentState=X,this.channelControlHelper.updateState(X,Y,W)}resetSubchannelList(){for(let X of this.children)X.destroy();this.children=[]}updateAddressList(X,Y,W,z){if(!(Y instanceof IK))return!1;if(!X.ok){if(this.children.length===0)this.updateState(B9.ConnectivityState.TRANSIENT_FAILURE,new cQ.UnavailablePicker(X.error),X.error.details);return!0}let F=Math.random()*X.value.length|0,Q=Z71(X.value,F);if(this.resetSubchannelList(),Q.length===0){let J=`No addresses resolved. Resolution note: ${z}`;this.updateState(B9.ConnectivityState.TRANSIENT_FAILURE,new cQ.UnavailablePicker({details:J}),J)}EQ0("Connect to endpoint list "+Q.map(DQ0.endpointToString)),this.updatesPaused=!0,this.children=Q.map((J)=>new X71.LeafLoadBalancer(J,this.childChannelControlHelper,W,z));for(let J of this.children)J.startConnecting();return this.updatesPaused=!1,this.calculateAndUpdateState(),!0}exitIdle(){}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return TK}}MQ0.RoundRobinLoadBalancer=DA;function Q71(){(0,CQ0.registerLoadBalancerType)(TK,DA,IK)}});var hQ0=X0((vQ0)=>{var EA;Object.defineProperty(vQ0,"__esModule",{value:!0});vQ0.OutlierDetectionLoadBalancer=vQ0.OutlierDetectionLoadBalancingConfig=void 0;vQ0.setup=N71;var W71=C9(),wQ0=a1(),n7=bQ(),SQ0=AA(),G71=E5(),K71=UG(),F71=b4(),CA=y9(),z71=_Q(),q71=A6(),H71="outlier_detection";function Y9(X){q71.trace(wQ0.LogVerbosity.DEBUG,H71,X)}var LA="outlier_detection",V71=((EA=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)!==null&&EA!==void 0?EA:"true")==="true",B71={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},U71={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function wY(X,Y,W,z){if(Y in X&&X[Y]!==void 0&&typeof X[Y]!==W){let F=z?`${z}.${Y}`:Y;throw Error(`outlier detection config ${F} parse error: expected ${W}, got ${typeof X[Y]}`)}}function RA(X,Y,W){let z=W?`${W}.${Y}`:Y;if(Y in X&&X[Y]!==void 0){if(!(0,n7.isDuration)(X[Y]))throw Error(`outlier detection config ${z} parse error: expected Duration, got ${typeof X[Y]}`);if(!(X[Y].seconds>=0&&X[Y].seconds<=315576000000&&X[Y].nanos>=0&&X[Y].nanos<=999999999))throw Error(`outlier detection config ${z} parse error: values out of range for non-negative Duaration`)}}function $K(X,Y,W){let z=W?`${W}.${Y}`:Y;if(wY(X,Y,"number",W),Y in X&&X[Y]!==void 0&&!(X[Y]>=0&&X[Y]<=100))throw Error(`outlier detection config ${z} parse error: value out of range for percentage (0-100)`)}class lQ{constructor(X,Y,W,z,F,Q,J){if(this.childPolicy=J,J.getLoadBalancerName()==="pick_first")throw Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=X!==null&&X!==void 0?X:1e4,this.baseEjectionTimeMs=Y!==null&&Y!==void 0?Y:30000,this.maxEjectionTimeMs=W!==null&&W!==void 0?W:300000,this.maxEjectionPercent=z!==null&&z!==void 0?z:10,this.successRateEjection=F?Object.assign(Object.assign({},B71),F):null,this.failurePercentageEjection=Q?Object.assign(Object.assign({},U71),Q):null}getLoadBalancerName(){return LA}toJsonObject(){var X,Y;return{outlier_detection:{interval:(0,n7.msToDuration)(this.intervalMs),base_ejection_time:(0,n7.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,n7.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:(X=this.successRateEjection)!==null&&X!==void 0?X:void 0,failure_percentage_ejection:(Y=this.failurePercentageEjection)!==null&&Y!==void 0?Y:void 0,child_policy:[this.childPolicy.toJsonObject()]}}}getIntervalMs(){return this.intervalMs}getBaseEjectionTimeMs(){return this.baseEjectionTimeMs}getMaxEjectionTimeMs(){return this.maxEjectionTimeMs}getMaxEjectionPercent(){return this.maxEjectionPercent}getSuccessRateEjectionConfig(){return this.successRateEjection}getFailurePercentageEjectionConfig(){return this.failurePercentageEjection}getChildPolicy(){return this.childPolicy}static createFromJson(X){var Y;if(RA(X,"interval"),RA(X,"base_ejection_time"),RA(X,"max_ejection_time"),$K(X,"max_ejection_percent"),"success_rate_ejection"in X&&X.success_rate_ejection!==void 0){if(typeof X.success_rate_ejection!=="object")throw Error("outlier detection config success_rate_ejection must be an object");wY(X.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),$K(X.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),wY(X.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),wY(X.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in X&&X.failure_percentage_ejection!==void 0){if(typeof X.failure_percentage_ejection!=="object")throw Error("outlier detection config failure_percentage_ejection must be an object");$K(X.failure_percentage_ejection,"threshold","failure_percentage_ejection"),$K(X.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),wY(X.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),wY(X.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}if(!("child_policy"in X)||!Array.isArray(X.child_policy))throw Error("outlier detection config child_policy must be an array");let W=(0,G71.selectLbConfigFromList)(X.child_policy);if(!W)throw Error("outlier detection config child_policy: no valid recognized policy found");return new lQ(X.interval?(0,n7.durationToMs)(X.interval):null,X.base_ejection_time?(0,n7.durationToMs)(X.base_ejection_time):null,X.max_ejection_time?(0,n7.durationToMs)(X.max_ejection_time):null,(Y=X.max_ejection_percent)!==null&&Y!==void 0?Y:null,X.success_rate_ejection,X.failure_percentage_ejection,W)}}vQ0.OutlierDetectionLoadBalancingConfig=lQ;class fQ0 extends z71.BaseSubchannelWrapper{constructor(X,Y){super(X);this.mapEntry=Y,this.refCount=0}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0){if(this.mapEntry){let X=this.mapEntry.subchannelWrappers.indexOf(this);if(X>=0)this.mapEntry.subchannelWrappers.splice(X,1)}}}eject(){this.setHealthy(!1)}uneject(){this.setHealthy(!0)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}}function MA(){return{success:0,failure:0}}class yQ0{constructor(){this.activeBucket=MA(),this.inactiveBucket=MA()}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket=MA()}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}}class kQ0{constructor(X,Y){this.wrappedPicker=X,this.countCalls=Y}pick(X){let Y=this.wrappedPicker.pick(X);if(Y.pickResultType===F71.PickResultType.COMPLETE){let W=Y.subchannel,z=W.getMapEntry();if(z){let F=Y.onCallEnded;if(this.countCalls)F=(Q,J,Z)=>{var K;if(Q===wQ0.Status.OK)z.counter.addSuccess();else z.counter.addFailure();(K=Y.onCallEnded)===null||K===void 0||K.call(Y,Q,J,Z)};return Object.assign(Object.assign({},Y),{subchannel:W.getWrappedSubchannel(),onCallEnded:F})}else return Object.assign(Object.assign({},Y),{subchannel:W.getWrappedSubchannel()})}else return Y}}class PA{constructor(X){this.entryMap=new CA.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new K71.ChildLoadBalancerHandler((0,SQ0.createChildChannelControlHelper)(X,{createSubchannel:(Y,W)=>{let z=X.createSubchannel(Y,W),F=this.entryMap.getForSubchannelAddress(Y),Q=new fQ0(z,F);if((F===null||F===void 0?void 0:F.currentEjectionTimestamp)!==null)Q.eject();return F===null||F===void 0||F.subchannelWrappers.push(Q),Q},updateState:(Y,W,z)=>{if(Y===W71.ConnectivityState.READY)X.updateState(Y,new kQ0(W,this.isCountingEnabled()),z);else X.updateState(Y,W,z)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return this.latestConfig!==null&&(this.latestConfig.getSuccessRateEjectionConfig()!==null||this.latestConfig.getFailurePercentageEjectionConfig()!==null)}getCurrentEjectionPercent(){let X=0;for(let Y of this.entryMap.values())if(Y.currentEjectionTimestamp!==null)X+=1;return X*100/this.entryMap.size}runSuccessRateCheck(X){if(!this.latestConfig)return;let Y=this.latestConfig.getSuccessRateEjectionConfig();if(!Y)return;Y9("Running success rate check");let W=Y.request_volume,z=0,F=[];for(let[G,q]of this.entryMap.entries()){let B=q.counter.getLastSuccesses(),$=q.counter.getLastFailures();if(Y9("Stats for "+(0,CA.endpointToString)(G)+": successes="+B+" failures="+$+" targetRequestVolume="+W),B+$>=W)z+=1,F.push(B/(B+$))}if(Y9("Found "+z+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+F+"]"),z<Y.minimum_hosts)return;let Q=F.reduce((G,q)=>G+q)/F.length,J=0;for(let G of F){let q=G-Q;J+=q*q}let Z=J/F.length,K=Math.sqrt(Z),H=Q-K*(Y.stdev_factor/1000);Y9("stdev="+K+" ejectionThreshold="+H);for(let[G,q]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let B=q.counter.getLastSuccesses(),$=q.counter.getLastFailures();if(B+$<W)continue;let R=B/(B+$);if(Y9("Checking candidate "+G+" successRate="+R),R<H){let E=Math.random()*100;if(Y9("Candidate "+G+" randomNumber="+E+" enforcement_percentage="+Y.enforcement_percentage),E<Y.enforcement_percentage)Y9("Ejecting candidate "+G),this.eject(q,X)}}}runFailurePercentageCheck(X){if(!this.latestConfig)return;let Y=this.latestConfig.getFailurePercentageEjectionConfig();if(!Y)return;Y9("Running failure percentage check. threshold="+Y.threshold+" request volume threshold="+Y.request_volume);let W=0;for(let z of this.entryMap.values()){let F=z.counter.getLastSuccesses(),Q=z.counter.getLastFailures();if(F+Q>=Y.request_volume)W+=1}if(W<Y.minimum_hosts)return;for(let[z,F]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let Q=F.counter.getLastSuccesses(),J=F.counter.getLastFailures();if(Y9("Candidate successes="+Q+" failures="+J),Q+J<Y.request_volume)continue;if(J*100/(J+Q)>Y.threshold){let K=Math.random()*100;if(Y9("Candidate "+z+" randomNumber="+K+" enforcement_percentage="+Y.enforcement_percentage),K<Y.enforcement_percentage)Y9("Ejecting candidate "+z),this.eject(F,X)}}}eject(X,Y){X.currentEjectionTimestamp=new Date,X.ejectionTimeMultiplier+=1;for(let W of X.subchannelWrappers)W.eject()}uneject(X){X.currentEjectionTimestamp=null;for(let Y of X.subchannelWrappers)Y.uneject()}switchAllBuckets(){for(let X of this.entryMap.values())X.counter.switchBuckets()}startTimer(X){var Y,W;this.ejectionTimer=setTimeout(()=>this.runChecks(),X),(W=(Y=this.ejectionTimer).unref)===null||W===void 0||W.call(Y)}runChecks(){let X=new Date;if(Y9("Ejection timer running"),this.switchAllBuckets(),!this.latestConfig)return;this.timerStartTime=X,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(X),this.runFailurePercentageCheck(X);for(let[Y,W]of this.entryMap.entries())if(W.currentEjectionTimestamp===null){if(W.ejectionTimeMultiplier>0)W.ejectionTimeMultiplier-=1}else{let z=this.latestConfig.getBaseEjectionTimeMs(),F=this.latestConfig.getMaxEjectionTimeMs(),Q=new Date(W.currentEjectionTimestamp.getTime());if(Q.setMilliseconds(Q.getMilliseconds()+Math.min(z*W.ejectionTimeMultiplier,Math.max(z,F))),Q<new Date)Y9("Unejecting "+Y),this.uneject(W)}}updateAddressList(X,Y,W,z){if(!(Y instanceof lQ))return!1;if(Y9("Received update with config: "+JSON.stringify(Y.toJsonObject(),void 0,2)),X.ok){for(let Q of X.value)if(!this.entryMap.has(Q))Y9("Adding map entry for "+(0,CA.endpointToString)(Q)),this.entryMap.set(Q,{counter:new yQ0,currentEjectionTimestamp:null,ejectionTimeMultiplier:0,subchannelWrappers:[]});this.entryMap.deleteMissing(X.value)}let F=Y.getChildPolicy();if(this.childBalancer.updateAddressList(X,F,W,z),Y.getSuccessRateEjectionConfig()||Y.getFailurePercentageEjectionConfig())if(this.timerStartTime){Y9("Previous timer existed. Replacing timer"),clearTimeout(this.ejectionTimer);let Q=Y.getIntervalMs()-(new Date().getTime()-this.timerStartTime.getTime());this.startTimer(Q)}else Y9("Starting new timer"),this.timerStartTime=new Date,this.startTimer(Y.getIntervalMs()),this.switchAllBuckets();else{Y9("Counting disabled. Cancelling timer."),this.timerStartTime=null,clearTimeout(this.ejectionTimer);for(let Q of this.entryMap.values())this.uneject(Q),Q.ejectionTimeMultiplier=0}return this.latestConfig=Y,!0}exitIdle(){this.childBalancer.exitIdle()}resetBackoff(){this.childBalancer.resetBackoff()}destroy(){clearTimeout(this.ejectionTimer),this.childBalancer.destroy()}getTypeName(){return LA}}vQ0.OutlierDetectionLoadBalancer=PA;function N71(){if(V71)(0,SQ0.registerLoadBalancerType)(LA,PA,lQ)}});var uQ0=X0((xQ0)=>{Object.defineProperty(xQ0,"__esModule",{value:!0});xQ0.PriorityQueue=void 0;var SY=0,wA=(X)=>Math.floor(X/2),DK=(X)=>X*2+1,pQ=(X)=>X*2+2;class _Q0{constructor(X=(Y,W)=>Y>W){this.comparator=X,this.heap=[]}size(){return this.heap.length}isEmpty(){return this.size()==0}peek(){return this.heap[SY]}push(...X){return X.forEach((Y)=>{this.heap.push(Y),this.siftUp()}),this.size()}pop(){let X=this.peek(),Y=this.size()-1;if(Y>SY)this.swap(SY,Y);return this.heap.pop(),this.siftDown(),X}replace(X){let Y=this.peek();return this.heap[SY]=X,this.siftDown(),Y}greater(X,Y){return this.comparator(this.heap[X],this.heap[Y])}swap(X,Y){[this.heap[X],this.heap[Y]]=[this.heap[Y],this.heap[X]]}siftUp(){let X=this.size()-1;while(X>SY&&this.greater(X,wA(X)))this.swap(X,wA(X)),X=wA(X)}siftDown(){let X=SY;while(DK(X)<this.size()&&this.greater(DK(X),X)||pQ(X)<this.size()&&this.greater(pQ(X),X)){let Y=pQ(X)<this.size()&&this.greater(pQ(X),DK(X))?pQ(X):DK(X);this.swap(X,Y),X=Y}}}xQ0.PriorityQueue=_Q0});var aQ0=X0((nQ0)=>{Object.defineProperty(nQ0,"__esModule",{value:!0});nQ0.WeightedRoundRobinLoadBalancingConfig=void 0;nQ0.setup=w71;var Z9=C9(),T71=a1(),n9=bQ(),dQ0=E5(),I71=gQ(),$71=A6(),cQ0=qK(),fY=b4(),D71=uQ0(),mQ0=y9(),E71="weighted_round_robin";function SA(X){$71.trace(T71.LogVerbosity.DEBUG,E71,X)}var fA="weighted_round_robin",C71=1e4,R71=1e4,M71=180000,L71=1000,P71=1;function gQ0(X,Y,W){if(Y in X&&X[Y]!==void 0&&typeof X[Y]!==W)throw Error(`weighted round robin config ${Y} parse error: expected ${W}, got ${typeof X[Y]}`)}function EK(X,Y){if(Y in X&&X[Y]!==void 0&&X[Y]!==null){let W;if((0,n9.isDuration)(X[Y]))W=X[Y];else if((0,n9.isDurationMessage)(X[Y]))W=(0,n9.durationMessageToDuration)(X[Y]);else if(typeof X[Y]==="string"){let z=(0,n9.parseDuration)(X[Y]);if(!z)throw Error(`weighted round robin config ${Y}: failed to parse duration string ${X[Y]}`);W=z}else throw Error(`weighted round robin config ${Y}: expected duration, got ${typeof X[Y]}`);return(0,n9.durationToMs)(W)}return null}class nQ{constructor(X,Y,W,z,F,Q){this.enableOobLoadReport=X!==null&&X!==void 0?X:!1,this.oobLoadReportingPeriodMs=Y!==null&&Y!==void 0?Y:C71,this.blackoutPeriodMs=W!==null&&W!==void 0?W:R71,this.weightExpirationPeriodMs=z!==null&&z!==void 0?z:M71,this.weightUpdatePeriodMs=Math.max(F!==null&&F!==void 0?F:L71,100),this.errorUtilizationPenalty=Q!==null&&Q!==void 0?Q:P71}getLoadBalancerName(){return fA}toJsonObject(){return{enable_oob_load_report:this.enableOobLoadReport,oob_load_reporting_period:(0,n9.durationToString)((0,n9.msToDuration)(this.oobLoadReportingPeriodMs)),blackout_period:(0,n9.durationToString)((0,n9.msToDuration)(this.blackoutPeriodMs)),weight_expiration_period:(0,n9.durationToString)((0,n9.msToDuration)(this.weightExpirationPeriodMs)),weight_update_period:(0,n9.durationToString)((0,n9.msToDuration)(this.weightUpdatePeriodMs)),error_utilization_penalty:this.errorUtilizationPenalty}}static createFromJson(X){if(gQ0(X,"enable_oob_load_report","boolean"),gQ0(X,"error_utilization_penalty","number"),X.error_utilization_penalty<0)throw Error("weighted round robin config error_utilization_penalty < 0");return new nQ(X.enable_oob_load_report,EK(X,"oob_load_reporting_period"),EK(X,"blackout_period"),EK(X,"weight_expiration_period"),EK(X,"weight_update_period"),X.error_utilization_penalty)}getEnableOobLoadReport(){return this.enableOobLoadReport}getOobLoadReportingPeriodMs(){return this.oobLoadReportingPeriodMs}getBlackoutPeriodMs(){return this.blackoutPeriodMs}getWeightExpirationPeriodMs(){return this.weightExpirationPeriodMs}getWeightUpdatePeriodMs(){return this.weightUpdatePeriodMs}getErrorUtilizationPenalty(){return this.errorUtilizationPenalty}}nQ0.WeightedRoundRobinLoadBalancingConfig=nQ;class lQ0{constructor(X,Y){this.metricsHandler=Y,this.queue=new D71.PriorityQueue((F,Q)=>F.deadline<Q.deadline);let W=X.filter((F)=>F.weight>0),z;if(W.length<2)z=1;else{let F=0;for(let{weight:Q}of W)F+=Q;z=F/W.length}for(let F of X){let Q=F.weight>0?1/F.weight:z;this.queue.push({endpointName:F.endpointName,picker:F.picker,period:Q,deadline:Math.random()*Q})}}pick(X){let Y=this.queue.pop();this.queue.push(Object.assign(Object.assign({},Y),{deadline:Y.deadline+Y.period}));let W=Y.picker.pick(X);if(W.pickResultType===fY.PickResultType.COMPLETE)if(this.metricsHandler)return Object.assign(Object.assign({},W),{onCallEnded:(0,cQ0.createMetricsReader)((z)=>this.metricsHandler(z,Y.endpointName),W.onCallEnded)});else{let z=W.subchannel;return Object.assign(Object.assign({},W),{subchannel:z.getWrappedSubchannel()})}else return W}}class pQ0{constructor(X){this.channelControlHelper=X,this.latestConfig=null,this.children=new Map,this.currentState=Z9.ConnectivityState.IDLE,this.updatesPaused=!1,this.lastError=null,this.weightUpdateTimer=null}countChildrenWithState(X){let Y=0;for(let W of this.children.values())if(W.child.getConnectivityState()===X)Y+=1;return Y}updateWeight(X,Y){var W,z;let{rps_fractional:F,application_utilization:Q}=Y;if(Q>0&&F>0)Q+=Y.eps/F*((z=(W=this.latestConfig)===null||W===void 0?void 0:W.getErrorUtilizationPenalty())!==null&&z!==void 0?z:0);let J=Q===0?0:F/Q;if(J===0)return;let Z=new Date;if(X.nonEmptySince===null)X.nonEmptySince=Z;X.lastUpdated=Z,X.weight=J}getWeight(X){if(!this.latestConfig)return 0;let Y=new Date().getTime();if(Y-X.lastUpdated.getTime()>=this.latestConfig.getWeightExpirationPeriodMs())return X.nonEmptySince=null,0;let W=this.latestConfig.getBlackoutPeriodMs();if(W>0&&(X.nonEmptySince===null||Y-X.nonEmptySince.getTime()<W))return 0;return X.weight}calculateAndUpdateState(){if(this.updatesPaused||!this.latestConfig)return;if(this.countChildrenWithState(Z9.ConnectivityState.READY)>0){let X=[];for(let[W,z]of this.children){if(z.child.getConnectivityState()!==Z9.ConnectivityState.READY)continue;X.push({endpointName:W,picker:z.child.getPicker(),weight:this.getWeight(z)})}SA("Created picker with weights: "+X.map((W)=>W.endpointName+":"+W.weight).join(","));let Y;if(!this.latestConfig.getEnableOobLoadReport())Y=(W,z)=>{let F=this.children.get(z);if(F)this.updateWeight(F,W)};else Y=null;this.updateState(Z9.ConnectivityState.READY,new lQ0(X,Y),null)}else if(this.countChildrenWithState(Z9.ConnectivityState.CONNECTING)>0)this.updateState(Z9.ConnectivityState.CONNECTING,new fY.QueuePicker(this),null);else if(this.countChildrenWithState(Z9.ConnectivityState.TRANSIENT_FAILURE)>0){let X=`weighted_round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(Z9.ConnectivityState.TRANSIENT_FAILURE,new fY.UnavailablePicker({details:X}),X)}else this.updateState(Z9.ConnectivityState.IDLE,new fY.QueuePicker(this),null);for(let{child:X}of this.children.values())if(X.getConnectivityState()===Z9.ConnectivityState.IDLE)X.exitIdle()}updateState(X,Y,W){SA(Z9.ConnectivityState[this.currentState]+" -> "+Z9.ConnectivityState[X]),this.currentState=X,this.channelControlHelper.updateState(X,Y,W)}updateAddressList(X,Y,W,z){var F,Q;if(!(Y instanceof nQ))return!1;if(!X.ok){if(this.children.size===0)this.updateState(Z9.ConnectivityState.TRANSIENT_FAILURE,new fY.UnavailablePicker(X.error),X.error.details);return!0}if(X.value.length===0){let K=`No addresses resolved. Resolution note: ${z}`;return this.updateState(Z9.ConnectivityState.TRANSIENT_FAILURE,new fY.UnavailablePicker({details:K}),K),!1}SA("Connect to endpoint list "+X.value.map(mQ0.endpointToString));let J=new Date,Z=new Set;this.updatesPaused=!0,this.latestConfig=Y;for(let K of X.value){let H=(0,mQ0.endpointToString)(K);Z.add(H);let G=this.children.get(H);if(!G)G={child:new I71.LeafLoadBalancer(K,(0,dQ0.createChildChannelControlHelper)(this.channelControlHelper,{updateState:(q,B,$)=>{if(this.currentState===Z9.ConnectivityState.READY&&q!==Z9.ConnectivityState.READY)this.channelControlHelper.requestReresolution();if(q===Z9.ConnectivityState.READY)G.nonEmptySince=null;if($)this.lastError=$;this.calculateAndUpdateState()},createSubchannel:(q,B)=>{let $=this.channelControlHelper.createSubchannel(q,B);if(G===null||G===void 0?void 0:G.oobMetricsListener)return new cQ0.OrcaOobMetricsSubchannelWrapper($,G.oobMetricsListener,this.latestConfig.getOobLoadReportingPeriodMs());else return $}}),W,z),lastUpdated:J,nonEmptySince:null,weight:0,oobMetricsListener:null},this.children.set(H,G);if(Y.getEnableOobLoadReport())G.oobMetricsListener=(q)=>{this.updateWeight(G,q)};else G.oobMetricsListener=null}for(let[K,H]of this.children)if(Z.has(K))H.child.startConnecting();else H.child.destroy(),this.children.delete(K);if(this.updatesPaused=!1,this.calculateAndUpdateState(),this.weightUpdateTimer)clearInterval(this.weightUpdateTimer);return this.weightUpdateTimer=(Q=(F=setInterval(()=>{if(this.currentState===Z9.ConnectivityState.READY)this.calculateAndUpdateState()},Y.getWeightUpdatePeriodMs())).unref)===null||Q===void 0?void 0:Q.call(F),!0}exitIdle(){}resetBackoff(){}destroy(){for(let X of this.children.values())X.child.destroy();if(this.children.clear(),this.weightUpdateTimer)clearInterval(this.weightUpdateTimer)}getTypeName(){return fA}}function w71(){(0,dQ0.registerLoadBalancerType)(fA,pQ0,nQ)}});var iQ=X0((q6)=>{Object.defineProperty(q6,"__esModule",{value:!0});q6.experimental=q6.ServerMetricRecorder=q6.ServerInterceptingCall=q6.ResponderBuilder=q6.ServerListenerBuilder=q6.addAdminServicesToServer=q6.getChannelzHandlers=q6.getChannelzServiceDefinition=q6.InterceptorConfigurationError=q6.InterceptingCall=q6.RequesterBuilder=q6.ListenerBuilder=q6.StatusBuilder=q6.getClientChannel=q6.ServerCredentials=q6.Server=q6.setLogVerbosity=q6.setLogger=q6.load=q6.loadObject=q6.CallCredentials=q6.ChannelCredentials=q6.waitForClientReady=q6.closeClient=q6.Channel=q6.makeGenericClientConstructor=q6.makeClientConstructor=q6.loadPackageDefinition=q6.Client=q6.compressionAlgorithms=q6.propagate=q6.connectivityState=q6.status=q6.logVerbosity=q6.Metadata=q6.credentials=void 0;var CK=GG();Object.defineProperty(q6,"CallCredentials",{enumerable:!0,get:function(){return CK.CallCredentials}});var f71=fU();Object.defineProperty(q6,"Channel",{enumerable:!0,get:function(){return f71.ChannelImplementation}});var y71=PN();Object.defineProperty(q6,"compressionAlgorithms",{enumerable:!0,get:function(){return y71.CompressionAlgorithms}});var k71=C9();Object.defineProperty(q6,"connectivityState",{enumerable:!0,get:function(){return k71.ConnectivityState}});var RK=ZY();Object.defineProperty(q6,"ChannelCredentials",{enumerable:!0,get:function(){return RK.ChannelCredentials}});var rQ0=SU();Object.defineProperty(q6,"Client",{enumerable:!0,get:function(){return rQ0.Client}});var yA=a1();Object.defineProperty(q6,"logVerbosity",{enumerable:!0,get:function(){return yA.LogVerbosity}});Object.defineProperty(q6,"status",{enumerable:!0,get:function(){return yA.Status}});Object.defineProperty(q6,"propagate",{enumerable:!0,get:function(){return yA.Propagate}});var oQ0=A6(),kA=TG();Object.defineProperty(q6,"loadPackageDefinition",{enumerable:!0,get:function(){return kA.loadPackageDefinition}});Object.defineProperty(q6,"makeClientConstructor",{enumerable:!0,get:function(){return kA.makeClientConstructor}});Object.defineProperty(q6,"makeGenericClientConstructor",{enumerable:!0,get:function(){return kA.makeClientConstructor}});var v71=s6();Object.defineProperty(q6,"Metadata",{enumerable:!0,get:function(){return v71.Metadata}});var j71=dZ0();Object.defineProperty(q6,"Server",{enumerable:!0,get:function(){return j71.Server}});var h71=FK();Object.defineProperty(q6,"ServerCredentials",{enumerable:!0,get:function(){return h71.ServerCredentials}});var _71=nZ0();Object.defineProperty(q6,"StatusBuilder",{enumerable:!0,get:function(){return _71.StatusBuilder}});q6.credentials={combineChannelCredentials:(X,...Y)=>{return Y.reduce((W,z)=>W.compose(z),X)},combineCallCredentials:(X,...Y)=>{return Y.reduce((W,z)=>W.compose(z),X)},createInsecure:RK.ChannelCredentials.createInsecure,createSsl:RK.ChannelCredentials.createSsl,createFromSecureContext:RK.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:CK.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:CK.CallCredentials.createFromGoogleCredential,createEmpty:CK.CallCredentials.createEmpty};var x71=(X)=>X.close();q6.closeClient=x71;var b71=(X,Y,W)=>X.waitForReady(Y,W);q6.waitForClientReady=b71;var u71=(X,Y)=>{throw Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};q6.loadObject=u71;var m71=(X,Y,W)=>{throw Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};q6.load=m71;var g71=(X)=>{oQ0.setLogger(X)};q6.setLogger=g71;var d71=(X)=>{oQ0.setLoggerVerbosity(X)};q6.setLogVerbosity=d71;var c71=(X)=>{return rQ0.Client.prototype.getChannel.call(X)};q6.getClientChannel=c71;var MK=PU();Object.defineProperty(q6,"ListenerBuilder",{enumerable:!0,get:function(){return MK.ListenerBuilder}});Object.defineProperty(q6,"RequesterBuilder",{enumerable:!0,get:function(){return MK.RequesterBuilder}});Object.defineProperty(q6,"InterceptingCall",{enumerable:!0,get:function(){return MK.InterceptingCall}});Object.defineProperty(q6,"InterceptorConfigurationError",{enumerable:!0,get:function(){return MK.InterceptorConfigurationError}});var tQ0=S5();Object.defineProperty(q6,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return tQ0.getChannelzServiceDefinition}});Object.defineProperty(q6,"getChannelzHandlers",{enumerable:!0,get:function(){return tQ0.getChannelzHandlers}});var l71=AG();Object.defineProperty(q6,"addAdminServicesToServer",{enumerable:!0,get:function(){return l71.addAdminServicesToServer}});var vA=FA();Object.defineProperty(q6,"ServerListenerBuilder",{enumerable:!0,get:function(){return vA.ServerListenerBuilder}});Object.defineProperty(q6,"ResponderBuilder",{enumerable:!0,get:function(){return vA.ResponderBuilder}});Object.defineProperty(q6,"ServerInterceptingCall",{enumerable:!0,get:function(){return vA.ServerInterceptingCall}});var p71=qK();Object.defineProperty(q6,"ServerMetricRecorder",{enumerable:!0,get:function(){return p71.ServerMetricRecorder}});var n71=AA();q6.experimental=n71;var i71=bN(),a71=BQ0(),r71=$Q0(),o71=gQ(),t71=PQ0(),s71=hQ0(),e71=aQ0(),XX1=S5();(()=>{i71.setup(),a71.setup(),r71.setup(),o71.setup(),t71.setup(),s71.setup(),e71.setup(),XX1.setup()})()});import{createMcpTools as yP1,createTool as kP1,getClineDefaultSystemPrompt as vP1}from"@clinebot/agents";import*as jP1 from"@clinebot/llms/models";import*as hP1 from"@clinebot/llms/providers";var M60=["cline","oca","openai-codex"];function H3(X){return M60.includes(X)}var L60=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function cV(X,Y){if(!H3(Y))return!1;let W=X instanceof Error?X.message.toLowerCase():String(X);return L60.some((z)=>W.includes(z))}import{z as c1}from"zod";var P60=c1.enum(["connector.started","connector.stopping","session.authorize","message.received","message.denied","message.completed","message.failed","session.started","session.reused","session.reset","schedule.delivery.started","schedule.delivery.sent","schedule.delivery.failed"]),w60=c1.object({id:c1.string().optional(),label:c1.string().optional(),role:c1.string().optional(),participantKey:c1.string().optional(),participantLabel:c1.string().optional(),platformUserId:c1.string().optional(),metadata:c1.record(c1.string(),c1.unknown()).optional()}),S60=c1.object({source:c1.string(),sourceEvent:c1.string(),threadId:c1.string(),channelId:c1.string(),isDM:c1.boolean(),sessionId:c1.string().optional(),workspaceRoot:c1.string().optional(),metadata:c1.record(c1.string(),c1.unknown()).optional()}),bi0=c1.object({actor:w60,context:S60,payload:c1.record(c1.string(),c1.unknown()).optional()}),ui0=c1.object({action:c1.enum(["allow","deny"]).default("allow"),message:c1.string().optional(),reason:c1.string().optional(),metadata:c1.record(c1.string(),c1.unknown()).optional()}),mi0=c1.object({adapter:c1.string(),botUserName:c1.string().optional(),event:P60,payload:c1.record(c1.string(),c1.unknown()),ts:c1.string()});var f60=[{modelsDevKey:"openai",generatedProviderId:"openai",runtimeProviderId:"openai-native"},{modelsDevKey:"openai",generatedProviderId:"openai",runtimeProviderId:"openai-codex"},{modelsDevKey:"anthropic",generatedProviderId:"anthropic"},{modelsDevKey:"anthropic",generatedProviderId:"anthropic",runtimeProviderId:"claude-code"},{modelsDevKey:"google",generatedProviderId:"gemini"},{modelsDevKey:"deepseek",generatedProviderId:"deepseek"},{modelsDevKey:"xai",generatedProviderId:"xai"},{modelsDevKey:"togetherai",runtimeProviderId:"together",generatedProviderId:"together"},{modelsDevKey:"sap-ai-core",runtimeProviderId:"sapaicore",generatedProviderId:"sapaicore"},{modelsDevKey:"fireworks-ai",runtimeProviderId:"fireworks",generatedProviderId:"fireworks"},{modelsDevKey:"groq",runtimeProviderId:"groq",generatedProviderId:"groq"},{modelsDevKey:"cerebras",runtimeProviderId:"cerebras",generatedProviderId:"cerebras"},{modelsDevKey:"sambanova",runtimeProviderId:"sambanova",generatedProviderId:"sambanova"},{modelsDevKey:"nebius",runtimeProviderId:"nebius",generatedProviderId:"nebius"},{modelsDevKey:"huggingface",runtimeProviderId:"huggingface",generatedProviderId:"huggingface"},{modelsDevKey:"openrouter",runtimeProviderId:"cline",generatedProviderId:"openrouter"},{modelsDevKey:"ollama",runtimeProviderId:"ollama-cloud"},{modelsDevKey:"ollama-cloud",generatedProviderId:"ollama"},{modelsDevKey:"vercel",runtimeProviderId:"dify",generatedProviderId:"vercel-ai-gateway"},{modelsDevKey:"vercel",generatedProviderId:"vercel-ai-gateway"},{modelsDevKey:"aihubmix",runtimeProviderId:"aihubmix",generatedProviderId:"aihubmix"},{modelsDevKey:"hicap",runtimeProviderId:"hicap"},{modelsDevKey:"nous-research",runtimeProviderId:"nousResearch"},{modelsDevKey:"huawei-cloud-maas",runtimeProviderId:"huawei-cloud-maas"},{modelsDevKey:"baseten",runtimeProviderId:"baseten",generatedProviderId:"baseten"},{modelsDevKey:"google-vertex-anthropic",generatedProviderId:"vertex"},{modelsDevKey:"lmstudio",generatedProviderId:"lmstudio"},{modelsDevKey:"zai",generatedProviderId:"zai"},{modelsDevKey:"requesty",generatedProviderId:"requesty"},{modelsDevKey:"amazon-bedrock",generatedProviderId:"bedrock"},{modelsDevKey:"moonshotai",generatedProviderId:"moonshot"},{modelsDevKey:"minimax",generatedProviderId:"minimax"},{modelsDevKey:"wandb",generatedProviderId:"wandb"},{modelsDevKey:"kilo",generatedProviderId:"kilo"},{modelsDevKey:"xiaomi",generatedProviderId:"xiaomi"}];function gi0(X){return Object.fromEntries(f60.flatMap((Y)=>{let W=X==="modelsDevKey"?Y.modelsDevKey:Y.generatedProviderId;return W?[[Y.modelsDevKey,W]]:[]}))}var di0=gi0("generatedProviderId");import{z as H9}from"zod";var ci0=H9.object({agentId:H9.string(),conversationId:H9.string(),iteration:H9.number(),abortSignal:H9.custom().optional(),metadata:H9.record(H9.string(),H9.unknown()).optional()}),li0=H9.object({id:H9.string(),name:H9.string(),input:H9.unknown(),output:H9.unknown(),error:H9.string().optional(),durationMs:H9.number(),startedAt:H9.date(),endedAt:H9.date()});function pi0(X){let Y=X.replaceAll("\\","/"),W=Y.lastIndexOf("/");return(W>=0?Y.slice(W+1):Y).toLowerCase()}function lV(X){return X==="win32"?"powershell":"/bin/bash"}function pV(X,Y){let W=pi0(X);if(W==="powershell"||W==="powershell.exe"||W==="pwsh"||W==="pwsh.exe")return["-NoProfile","-NonInteractive","-Command",Y];if(W==="cmd"||W==="cmd.exe")return["/d","/s","/c",Y];return["-c",Y]}import{z as y60}from"zod";function m9(X,Y){let W=X.safeParse(Y);if(!W.success)throw Error(y60.prettifyError(W.error));return W.data}function W8(X){return y60.toJSONSchema(X)}function nV(X,Y="act"){return`<user_input mode="${Y}">${X}</user_input>`}function cX(X){if(!X?.trim())return"";let Y=k60(X,"user_input");return(Y!==X?Y:X.replace(/<user_input[^>]*>/g,"")).trim()}function k60(X,Y){if(!X?.trim())return"";if(!Y)return X;let W=new RegExp(`<${Y}.*?>(.*?)</${Y}>`,"g");return X.replace(W,"$1")}import{z as a0}from"zod";var v60=a0.object({id:a0.string(),temperature:a0.number().optional(),isR1FormatRequired:a0.boolean().optional(),maxTokens:a0.number().optional(),contextWindow:a0.number().optional(),inputPrice:a0.number().optional(),outputPrice:a0.number().optional(),supportsImages:a0.boolean().optional()}),j60=a0.object({models:a0.array(v60).optional(),openAiBaseUrl:a0.string().optional(),openAiHeaders:a0.record(a0.string(),a0.string()).optional(),azureApiVersion:a0.string().optional(),azureIdentity:a0.boolean().optional()}),h60=a0.object({id:a0.string(),thinkingBudgetTokens:a0.number().optional()}),_60=a0.object({name:a0.string(),baseModelId:a0.string(),thinkingBudgetTokens:a0.number().optional()}),x60=a0.object({models:a0.array(h60).optional(),customModels:a0.array(_60).optional(),awsRegion:a0.string().optional(),awsUseCrossRegionInference:a0.boolean().optional(),awsUseGlobalInference:a0.boolean().optional(),awsBedrockUsePromptCache:a0.boolean().optional(),awsBedrockEndpoint:a0.string().optional()}),b60=a0.object({id:a0.string()}),u60=a0.object({models:a0.array(b60).optional()}),m60=a0.object({id:a0.string(),thinkingBudgetTokens:a0.number().optional()}),g60=a0.object({models:a0.array(m60).optional(),vertexProjectId:a0.string().optional(),vertexRegion:a0.string().optional()}),d60=a0.object({id:a0.string(),thinkingBudgetTokens:a0.number().optional(),promptCachingEnabled:a0.boolean().optional()}),c60=a0.object({models:a0.array(d60).optional(),baseUrl:a0.string().optional()}),l60=a0.object({id:a0.string(),thinkingBudgetTokens:a0.number().optional()}),p60=a0.object({models:a0.array(l60).optional(),baseUrl:a0.string().optional()}),ni0=a0.object({OpenAiCompatible:j60.optional(),AwsBedrock:x60.optional(),Cline:u60.optional(),Vertex:g60.optional(),LiteLLM:c60.optional(),Anthropic:p60.optional()}),n60=a0.object({id:a0.string()}),i60=a0.object({name:a0.string(),url:a0.string(),alwaysEnabled:a0.boolean().optional(),headers:a0.record(a0.string(),a0.string()).optional()}),iV=a0.object({alwaysEnabled:a0.boolean(),name:a0.string(),contents:a0.string()}),aV=a0.object({bucket:a0.string(),accessKeyId:a0.string(),secretAccessKey:a0.string(),region:a0.string().optional(),endpoint:a0.string().optional(),accountId:a0.string().optional(),intervalMs:a0.number().optional(),maxRetries:a0.number().optional(),batchSize:a0.number().optional(),maxQueueSize:a0.number().optional(),maxFailedAgeMs:a0.number().optional(),backfillEnabled:a0.boolean().optional()}),a60=a0.object({enabled:a0.boolean().optional(),type:a0.union([a0.literal("s3_access_keys"),a0.literal("r2_access_keys")]).optional(),s3AccessSettings:aV.optional(),r2AccessSettings:aV.optional()}),r60=a0.object({promptUploading:a60.optional()}),ii0=a0.object({version:a0.string(),providerSettings:ni0.optional(),telemetryEnabled:a0.boolean().optional(),kanbanEnabled:a0.boolean().optional(),mcpMarketplaceEnabled:a0.boolean().optional(),allowedMCPServers:a0.array(n60).optional(),remoteMCPServers:a0.array(i60).optional(),blockPersonalRemoteMCPServers:a0.boolean().optional(),yoloModeAllowed:a0.boolean().optional(),openTelemetryEnabled:a0.boolean().optional(),openTelemetryMetricsExporter:a0.string().optional(),openTelemetryLogsExporter:a0.string().optional(),openTelemetryOtlpProtocol:a0.string().optional(),openTelemetryOtlpEndpoint:a0.string().optional(),openTelemetryOtlpHeaders:a0.record(a0.string(),a0.string()).optional(),openTelemetryOtlpMetricsProtocol:a0.string().optional(),openTelemetryOtlpMetricsEndpoint:a0.string().optional(),openTelemetryOtlpMetricsHeaders:a0.record(a0.string(),a0.string()).optional(),openTelemetryOtlpLogsProtocol:a0.string().optional(),openTelemetryOtlpLogsEndpoint:a0.string().optional(),openTelemetryOtlpLogsHeaders:a0.record(a0.string(),a0.string()).optional(),openTelemetryMetricExportInterval:a0.number().optional(),openTelemetryOtlpInsecure:a0.boolean().optional(),openTelemetryLogBatchSize:a0.number().optional(),openTelemetryLogBatchTimeout:a0.number().optional(),openTelemetryLogMaxQueueSize:a0.number().optional(),enterpriseTelemetry:r60.optional(),globalRules:a0.array(iV).optional(),globalWorkflows:a0.array(iV).optional()}),ai0=a0.record(a0.string(),a0.string());var rV="127.0.0.1:4317";var V3="runtime.team.progress.v1",B3="runtime.team.lifecycle.v1";function o60(X){let Y=X?.trim();return Y?Y:void 0}function U3(X){return o60(X?.rootSessionId)}function t60(X){return o60(X?.hookLogPath)}import{nanoid as ri0}from"nanoid";function oV(X="",Y=""){return`${X}${Date.now()}_${ri0(5)}${Y}`}var tV=["running","completed","failed","cancelled"];w6();class sV{apiBaseUrl;getAuthTokenFn;getCurrentUserIdFn;getOrganizationMemberIdFn;getHeadersFn;requestTimeoutMs;fetchImpl;constructor(X){let Y=X.apiBaseUrl.trim();if(!Y)throw Error("apiBaseUrl is required");this.apiBaseUrl=Y,this.getAuthTokenFn=X.getAuthToken,this.getCurrentUserIdFn=X.getCurrentUserId,this.getOrganizationMemberIdFn=X.getOrganizationMemberId,this.getHeadersFn=X.getHeaders,this.requestTimeoutMs=X.requestTimeoutMs??30000,this.fetchImpl=X.fetchImpl??fetch}async fetchMe(){return this.request("/api/v1/users/me")}async fetchRemoteConfig(){return this.request("/api/v1/users/me/remote-config")}async fetchFeaturebaseToken(){try{return await this.request("/api/v1/users/me/featurebase-token")}catch{return}}async fetchBalance(X){let Y=await this.resolveUserId(X);return this.request(`/api/v1/users/${encodeURIComponent(Y)}/balance`)}async fetchUsageTransactions(X){let Y=await this.resolveUserId(X);return(await this.request(`/api/v1/users/${encodeURIComponent(Y)}/usages`)).items??[]}async fetchPaymentTransactions(X){let Y=await this.resolveUserId(X);return(await this.request(`/api/v1/users/${encodeURIComponent(Y)}/payments`)).paymentTransactions??[]}async fetchUserOrganizations(){return(await this.fetchMe()).organizations??[]}async fetchOrganization(X){let Y=X.trim();if(!Y)throw Error("organizationId is required");return this.request(`/api/v1/organizations/${encodeURIComponent(Y)}`)}async fetchOrganizationBalance(X){let Y=X.trim();if(!Y)throw Error("organizationId is required");return this.request(`/api/v1/organizations/${encodeURIComponent(Y)}/balance`)}async fetchOrganizationUsageTransactions(X){let Y=X.organizationId.trim();if(!Y)throw Error("organizationId is required");let W=await this.resolveOrganizationMemberId(Y,X.memberId);return(await this.request(`/api/v1/organizations/${encodeURIComponent(Y)}/members/${encodeURIComponent(W)}/usages`)).items??[]}async switchAccount(X){await this.request("/api/v1/users/active-account",{method:"PUT",body:{organizationId:X?.trim()||null},expectNoContent:!0})}async resolveUserId(X){let Y=X?.trim();if(Y)return Y;let z=(this.getCurrentUserIdFn?await this.getCurrentUserIdFn():void 0)?.trim();if(z)return z;let F=await this.fetchMe();if(!F.id?.trim())throw Error("Unable to resolve current user id");return F.id}async resolveOrganizationMemberId(X,Y){let W=Y?.trim();if(W)return W;let F=(this.getOrganizationMemberIdFn?await this.getOrganizationMemberIdFn(X):void 0)?.trim();if(F)return F;let J=(await this.fetchUserOrganizations()).find((Z)=>Z.organizationId===X)?.memberId;if(!J?.trim())throw Error(`Unable to resolve memberId for organization ${X}`);return J}async request(X,Y){let W=(await this.getAuthTokenFn())?.trim();if(!W)throw Error("No Cline account auth token found");let z=this.getHeadersFn?await this.getHeadersFn():{},F=new AbortController,Q=setTimeout(()=>F.abort(),this.requestTimeoutMs);try{let J=await this.fetchImpl(new URL(X,this.apiBaseUrl),{method:Y?.method??"GET",headers:{Authorization:`Bearer ${W}`,"Content-Type":"application/json",...z??{}},body:Y?.body!==void 0?JSON.stringify(Y.body):void 0,signal:F.signal});if(J.status===204||Y?.expectNoContent){if(!J.ok)throw Error(`Cline account request failed with status ${J.status}`);return}let Z=await J.text(),K;if(Z.trim())K=JSON.parse(Z);if(!J.ok){let H=typeof K==="object"&&K!==null&&"error"in K?String(K.error):`Cline account request failed with status ${J.status}`;throw Error(H)}if(typeof K==="object"&&K!==null){let H=K;if(typeof H.success==="boolean"){if(!H.success)throw Error(H.error||"Cline account request failed");if(H.data!==void 0)return H.data}}if(K===void 0||K===null)throw Error("Cline account response payload was empty");return K}finally{clearTimeout(Q)}}}function s60(X){return X.action==="clineAccount"}async function e60(X,Y){switch(X.operation){case"fetchMe":return Y.fetchMe();case"fetchBalance":return Y.fetchBalance(X.userId);case"fetchUsageTransactions":return Y.fetchUsageTransactions(X.userId);case"fetchPaymentTransactions":return Y.fetchPaymentTransactions(X.userId);case"fetchUserOrganizations":return Y.fetchUserOrganizations();case"fetchOrganizationBalance":return Y.fetchOrganizationBalance(X.organizationId);case"fetchOrganizationUsageTransactions":return Y.fetchOrganizationUsageTransactions({organizationId:X.organizationId,memberId:X.memberId});case"switchAccount":return await Y.switchAccount(X.organizationId),{updated:!0};case"fetchFeaturebaseToken":return Y.fetchFeaturebaseToken?.();default:throw Error(`Unsupported Cline account operation: ${String(X)}`)}}class eV{executor;constructor(X){this.executor=X}async fetchMe(){return this.request({action:"clineAccount",operation:"fetchMe"})}async fetchBalance(X){return this.request({action:"clineAccount",operation:"fetchBalance",...X?.trim()?{userId:X.trim()}:{}})}async fetchUsageTransactions(X){return this.request({action:"clineAccount",operation:"fetchUsageTransactions",...X?.trim()?{userId:X.trim()}:{}})}async fetchPaymentTransactions(X){return this.request({action:"clineAccount",operation:"fetchPaymentTransactions",...X?.trim()?{userId:X.trim()}:{}})}async fetchUserOrganizations(){return this.request({action:"clineAccount",operation:"fetchUserOrganizations"})}async fetchOrganizationBalance(X){let Y=X.trim();if(!Y)throw Error("organizationId is required");return this.request({action:"clineAccount",operation:"fetchOrganizationBalance",organizationId:Y})}async fetchOrganizationUsageTransactions(X){let Y=X.organizationId.trim();if(!Y)throw Error("organizationId is required");return this.request({action:"clineAccount",operation:"fetchOrganizationUsageTransactions",organizationId:Y,...X.memberId?.trim()?{memberId:X.memberId.trim()}:{}})}async switchAccount(X){await this.request({action:"clineAccount",operation:"switchAccount",organizationId:X?.trim()||null})}async fetchFeaturebaseToken(){return this.request({action:"clineAccount",operation:"fetchFeaturebaseToken"})}async request(X){return(await this.executor.runProviderAction(X)).result}}w6();import ga0 from"yaml";import{z as z8}from"zod";var X4={READ_FILES:"read_files",SEARCH_CODEBASE:"search_codebase",RUN_COMMANDS:"run_commands",FETCH_WEB_CONTENT:"fetch_web_content",APPLY_PATCH:"apply_patch",EDITOR:"editor",SKILLS:"skills",ASK:"ask_question"},E7=[X4.READ_FILES,X4.SEARCH_CODEBASE,X4.RUN_COMMANDS,X4.FETCH_WEB_CONTENT,X4.APPLY_PATCH,X4.EDITOR,X4.SKILLS,X4.ASK];import{createTool as _4}from"@clinebot/agents";import{z as T1}from"zod";var O5=6000,Y90=T1.string().describe("The absolute file path of a text file to read content from"),X90=T1.object({start_line:T1.number().int().positive().nullable().optional().describe("Optional one-based starting line number to read from; use null or omit for the start of the file"),end_line:T1.number().int().positive().nullable().optional().describe("Optional one-based ending line number to read through; use null or omit for the end of the file")}).refine(({start_line:X,end_line:Y})=>X==null||Y==null||X<=Y,{message:"start_line must be less than or equal to end_line",path:["end_line"]}),rZ=T1.object({path:Y90,start_line:X90.shape.start_line,end_line:X90.shape.end_line}).refine(({start_line:X,end_line:Y})=>X==null||Y==null||X<=Y,{message:"start_line must be less than or equal to end_line",path:["end_line"]}),N3=T1.object({files:T1.array(rZ).describe("Array of file read requests. Omit start_line/end_line or set them to null to return the full file content boundaries; provide integers to return only that inclusive one-based line range. Prefer this tool over running terminal command to get file content for better performance and reliability.")}),Z90=T1.union([N3,rZ,T1.array(rZ),T1.array(T1.string()),T1.string(),T1.object({files:rZ}),T1.object({file_paths:T1.array(Y90)}),T1.object({file_paths:T1.string()})]),A3=T1.object({queries:T1.array(T1.string()).describe("Array of regex search queries to execute")}),Q90=T1.union([A3,T1.array(T1.string()),T1.string(),T1.object({queries:T1.string()})]),YB=T1.string().describe(`The non-interactive shell command to execute - MUST keep input short and concise (within ${O5*2} characters) to avoid timeouts.`),oZ=T1.object({commands:T1.array(YB).describe("Array of shell commands to execute")}),J90=T1.union([oZ,T1.object({commands:YB}),T1.array(T1.string()),T1.string()]),XB=T1.object({command:T1.string().min(1).describe("The executable to run directly without shell parsing."),args:T1.array(T1.string()).optional().describe("Optional argv list passed directly to the executable.")}),W90=T1.union([YB,XB]),oi0=T1.object({commands:T1.array(W90).describe("Array of commands to execute. Prefer structured { command, args } entries for portability; plain strings are still supported and are interpreted by the active shell.")}),O3=T1.union([oZ,oi0,T1.object({commands:W90}),T1.array(T1.string()),T1.array(XB),T1.string(),XB]),G90=T1.object({url:T1.string().describe("The URL to fetch"),prompt:T1.string().min(2).describe("Analysis prompt for the fetched content")}),T3=T1.object({requests:T1.array(G90).describe("Array of the URLs for the web fetch requests")}),I3=T1.object({path:T1.string().min(1).describe("The absolute file path for the action to be performed on"),old_text:T1.string().nullable().optional().describe(`Exact text to replace (must match exactly once). Omit this when creating a missing file or inserting via insert_line. Keep this at or below ${O5} characters when possible; larger payloads should be split across multiple tool calls to avoid timeouts.`),new_text:T1.string().describe(`The new content to write when creating a missing file, the replacement text for edits, or the inserted text when insert_line is provided. Keep this at or below ${O5} characters when possible; for large edits, use multiple calls with small chunks of old_text and new_text to iteratively edit the file.`),insert_line:T1.number().int().nullable().optional().describe("Optional one-based line index. When provided, the tool inserts new_text at that line instead of performing a replacement edit.")}).describe("Edit a text file by replacing old_text with new_text, create the file with new_text if it does not exist, or insert new_text at insert_line when insert_line is provided. Prefer using this tool for file edits over shell commands. IMPORTANT: large edits can time out, so use small chunks and multiple calls when possible."),$3=T1.object({input:T1.string().min(1).describe("The apply_patch text payload, including patch instructions")}).describe("Modify or create a text file by applying patches. Prefer using this tool for file edits over shell commands. IMPORTANT: large patches can time out, so use small chunks and multiple calls when possible."),K90=T1.union([$3,T1.string()]),D3=T1.object({skill:T1.string().min(1).describe("Name of the skill to execute."),args:T1.string().nullable().optional().describe("Arguments for the skill; use null when omitted")}),E3=T1.object({question:T1.string().min(1).describe('The single question to ask the user. E.g. "How can I help you?"'),options:T1.array(T1.string().min(1)).min(2).max(5).describe("Array of 2-5 user-selectable answer options for the single question")});function T5(X){if(X instanceof Error)return X.message;return String(X)}function F90(X){if(typeof X.old_text==="string"&&X.old_text.length>O5)return`Editor input too large: old_text was ${X.old_text.length} characters, exceeding the recommended limit of ${O5}. Split the edit into smaller tool calls so later tool calls are less likely to be truncated or time out.`;if(X.new_text.length>O5)return`Editor input too large: new_text was ${X.new_text.length} characters, exceeding the recommended limit of ${O5}. Split the edit into smaller tool calls so later tool calls are less likely to be truncated or time out.`;return null}function Y4(X,Y,W){return Promise.race([X,new Promise((z,F)=>{setTimeout(()=>F(Error(W)),Y)})])}function z90(X){let Y=m9(Z90,X);if(typeof Y==="string")return[{path:Y}];if(Array.isArray(Y))return Y.map((W)=>typeof W==="string"?{path:W}:W);if("files"in Y)return Array.isArray(Y.files)?Y.files:[Y.files];if("file_paths"in Y)return(Array.isArray(Y.file_paths)?Y.file_paths:[Y.file_paths]).map((z)=>({path:z}));return[Y]}function ZB(X){let{path:Y,start_line:W,end_line:z}=X;if(W==null&&z==null)return Y;return`${Y}:${W??1}-${z??"EOF"}`}function q90(X){let Y=m9(O3,X);if(typeof Y==="string")return[Y];if(Array.isArray(Y))return Y;if("commands"in Y)return Array.isArray(Y.commands)?Y.commands:[Y.commands];return[Y]}function QB(X){if(typeof X==="string")return X;let Y=X.args??[];if(Y.length===0)return X.command;let W=Y.map((z)=>/[\s"]/u.test(z)?JSON.stringify(z):z);return`${X.command} ${W.join(" ")}`}function H90(X,Y={}){let W=Y.fileReadTimeoutMs??1e4;return _4({name:"read_files",description:"Read the full content of text files at the provided absolute paths, or return only an inclusive one-based line range when start_line/end_line are provided. Returns file contents or error messages for each path.",inputSchema:W8(N3),timeoutMs:W*2,retryable:!0,maxRetries:1,execute:async(z,F)=>{let Q=z90(z);return Promise.all(Q.map(async(J)=>{try{let Z=await Y4(X(J,F),W,`File read timed out after ${W}ms`);return{query:ZB(J),result:Z,success:!0}}catch(Z){let K=T5(Z);return{query:ZB(J),result:"",error:`Error reading file: ${K}`,success:!1}}}))}})}function V90(X,Y={}){let W=Y.searchTimeoutMs??30000,z=Y.cwd??process.cwd();return _4({name:"search_codebase",description:"Perform regex pattern searches across the codebase. Supports multiple parallel searches. Use for finding code patterns, function definitions, class names, imports, etc.",inputSchema:W8(A3),timeoutMs:W*2,retryable:!0,maxRetries:1,execute:async(F,Q)=>{let J=m9(Q90,F),Z=Array.isArray(J)?J:typeof J==="object"?Array.isArray(J.queries)?J.queries:[J.queries]:[J];return Promise.all(Z.map(async(K)=>{try{let H=await Y4(X(K,z,Q),W,`Search timed out after ${W}ms`),G=H.length>0&&!H.includes("No results found");return{query:K,result:H,success:G}}catch(H){let G=T5(H);return{query:K,result:"",error:`Search failed: ${G}`,success:!1}}}))}})}function B90(X,Y={}){let W=Y.bashTimeoutMs??30000,z=Y.cwd??process.cwd();return _4({name:"run_commands",description:"Run shell commands from the root of the workspace. Use for listing files, checking git status, running builds, executing tests, etc. Commands should be properly shell-escaped.",inputSchema:W8(oZ),timeoutMs:W*2,retryable:!1,maxRetries:0,execute:async(F,Q)=>{let J=m9(J90,F),Z=Array.isArray(J)?J:typeof J==="object"?Array.isArray(J.commands)?J.commands:[J.commands]:[J];return Promise.all(Z.map(async(K)=>{try{let H=await Y4(X(K,z,Q),W,`Command timed out after ${W}ms`);return{query:K,result:H,success:!0}}catch(H){let G=T5(H);return{query:K,result:"",error:`Command failed: ${G}`,success:!1}}}))}})}function U90(X,Y={}){let W=Y.bashTimeoutMs??30000,z=Y.cwd??process.cwd();return _4({name:"run_commands",description:"Run shell commands from the root of the workspacein Windows environment. Use for listing files, checking git status, running builds, executing tests, etc. Prefer structured { command, args } entries for portability; plain string commands should be properly shell-escaped.",inputSchema:W8(O3),timeoutMs:W*2,retryable:!1,maxRetries:0,execute:async(F,Q)=>{let J=q90(F);return Promise.all(J.map(async(Z)=>{try{let K=await Y4(X(Z,z,Q),W,`Command timed out after ${W}ms`);return{query:QB(Z),result:K,success:!0}}catch(K){let H=T5(K);return{query:QB(Z),result:"",error:`Command failed: ${H}`,success:!1}}}))}})}function N90(X,Y={}){let W=Y.webFetchTimeoutMs??30000;return _4({name:"fetch_web_content",description:"Fetch content from URLs and analyze them using the provided prompts. Use for retrieving documentation, API references, or any web content. Each request includes a URL and a prompt describing what information to extract.",inputSchema:W8(T3),timeoutMs:W*2,retryable:!0,maxRetries:2,execute:async(z,F)=>{let Q=m9(T3,z);return Promise.all(Q.requests.map(async(J)=>{try{let Z=await Y4(X(J.url,J.prompt,F),W,`Web fetch timed out after ${W}ms`);return{query:J.url,result:Z,success:!0}}catch(Z){let K=T5(Z);return{query:J.url,result:"",error:`Error fetching web content: ${K}`,success:!1}}}))}})}var ti0=`This is a custom utility that makes it more convenient to add, remove, move, or edit code in a single file. \`apply_patch\` effectively allows you to execute a diff/patch against a file, but the format of the diff specification is unique to this task, so pay careful attention to these instructions. To use the \`apply_patch\` command, you should pass a message of the following structure as "input":
494
494
 
495
495
  %%bash
496
496
  apply_patch <<"EOF"
@@ -706,7 +706,7 @@ Searched ${$} files.`;let E=[`Found ${B.length} result${B.length===1?"":"s"} for
706
706
  FOREIGN KEY (session_id) REFERENCES sessions(session_id) ON DELETE SET NULL
707
707
  );`,`CREATE INDEX IF NOT EXISTS idx_schedule_executions_schedule
708
708
  ON schedule_executions(schedule_id, triggered_at DESC);`,`CREATE INDEX IF NOT EXISTS idx_schedules_next_run
709
- ON schedules(enabled, next_run_at);`],NX1=[{table:"sessions",column:"workspace_root",sql:"ALTER TABLE sessions ADD COLUMN workspace_root TEXT;"},{table:"sessions",column:"parent_session_id",sql:"ALTER TABLE sessions ADD COLUMN parent_session_id TEXT;"},{table:"sessions",column:"parent_agent_id",sql:"ALTER TABLE sessions ADD COLUMN parent_agent_id TEXT;"},{table:"sessions",column:"agent_id",sql:"ALTER TABLE sessions ADD COLUMN agent_id TEXT;"},{table:"sessions",column:"conversation_id",sql:"ALTER TABLE sessions ADD COLUMN conversation_id TEXT;"},{table:"sessions",column:"is_subagent",sql:"ALTER TABLE sessions ADD COLUMN is_subagent INTEGER NOT NULL DEFAULT 0;"},{table:"sessions",column:"messages_path",sql:"ALTER TABLE sessions ADD COLUMN messages_path TEXT;"},{table:"sessions",column:"metadata_json",sql:"ALTER TABLE sessions ADD COLUMN metadata_json TEXT;"},{table:"schedules",column:"claim_token",sql:"ALTER TABLE schedules ADD COLUMN claim_token TEXT;"},{table:"schedules",column:"claim_started_at",sql:"ALTER TABLE schedules ADD COLUMN claim_started_at TEXT;"},{table:"schedules",column:"claim_until_at",sql:"ALTER TABLE schedules ADD COLUMN claim_until_at TEXT;"}];function AX1(X,Y){return new Set(X.prepare(`PRAGMA table_info(${Y});`).all().map((W)=>W.name))}function LK(X,Y={}){X.exec("PRAGMA journal_mode = WAL;"),X.exec("PRAGMA busy_timeout = 5000;");for(let F of UX1)X.exec(F);if(!Y.includeLegacyMigrations)return;let W=new Map,z=(F)=>{let Q=W.get(F);if(!Q)Q=AX1(X,F),W.set(F,Q);return Q};for(let F of NX1)if(!z(F.table).has(F.column)){if(X.exec(F.sql),F.column==="workspace_root")X.exec("UPDATE sessions SET workspace_root = cwd WHERE workspace_root IS NULL OR workspace_root = '';")}}w6();var xA=N9(iQ(),1);import{randomUUID as ZJ0}from"node:crypto";import{randomUUID as xX1}from"node:crypto";import{randomUUID as QJ0}from"node:crypto";function WJ0(X){let Y=eQ0(CX1(X)),W=new Set([i7(Y,"proto","rpc.proto"),i7(Y,"..","proto","rpc.proto"),i7(Y,"..","src","proto","rpc.proto"),i7(Y,"..","..","src","proto","rpc.proto"),i7(process.cwd(),"src","proto","rpc.proto"),i7(process.cwd(),"packages","rpc","src","proto","rpc.proto")]),z=process.cwd();while(!0){W.add(i7(z,"packages","rpc","src","proto","rpc.proto"));let F=eQ0(z);if(F===z)break;z=F}for(let F of W)if(EX1(F))return F;throw Error("Unable to resolve rpc.proto path")}var RX1="cline.rpc.v1",GJ0="ClineGateway";function MX1(){return WJ0(import.meta.url)}function LX1(){let X=JJ0.loadSync(MX1(),{keepCase:!1,longs:String,enums:String,defaults:!0,oneofs:!0}),Y=hY.loadPackageDefinition(X).cline?.rpc?.v1?.ClineGateway?.service;if(!Y)throw Error(`Unable to load ${RX1}.${GJ0} from proto`);return Y}function PX1(X){return new(hY.makeGenericClientConstructor(LX1(),GJ0))(X,hY.credentials.createInsecure())}function PK(X){if(X===null||X===void 0)return{nullValue:"NULL_VALUE"};if(typeof X==="string")return{stringValue:X};if(typeof X==="number")return{numberValue:Number.isFinite(X)?X:0};if(typeof X==="boolean")return{boolValue:X};if(Array.isArray(X))return{listValue:{values:X.map((Y)=>PK(Y))}};if(typeof X==="object"){let Y={fields:{}};for(let[W,z]of Object.entries(X))Y.fields??={},Y.fields[W]=PK(z);return{structValue:Y}}return{stringValue:String(X)}}function wK(X){if(!X)return;if(X.nullValue!==void 0)return null;if(X.stringValue!==void 0)return X.stringValue;if(X.numberValue!==void 0)return X.numberValue;if(X.boolValue!==void 0)return X.boolValue;if(X.listValue)return(X.listValue.values??[]).map((Y)=>wK(Y));if(X.structValue){let Y={};for(let[W,z]of Object.entries(X.structValue.fields??{}))Y[W]=wK(z);return Y}return}function r9(X){let Y={};for(let[W,z]of Object.entries(X??{}))Y[W]=PK(z);return{fields:Y}}function O9(X){if(!X?.fields)return;let Y={};for(let[W,z]of Object.entries(X.fields))Y[W]=wK(z);return Y}function a7(X){return PK(X)}function r7(X){return wK(X??void 0)}function wX1(X){return{sessionId:X.sessionId,source:X.source,pid:X.pid,startedAt:X.startedAt,endedAt:X.endedAt??"",exitCode:X.exitCode??0,status:X.status,statusLock:X.statusLock,interactive:X.interactive,provider:X.provider,model:X.model,cwd:X.cwd,workspaceRoot:X.workspaceRoot,teamName:X.teamName??"",enableTools:X.enableTools,enableSpawn:X.enableSpawn,enableTeams:X.enableTeams,parentSessionId:X.parentSessionId??"",parentAgentId:X.parentAgentId??"",agentId:X.agentId??"",conversationId:X.conversationId??"",isSubagent:X.isSubagent,prompt:X.prompt??"",transcriptPath:X.transcriptPath,hookPath:X.hookPath,messagesPath:X.messagesPath??"",updatedAt:X.updatedAt,metadata:r9(X.metadata)}}function XJ0(X){return{sessionId:X.sessionId??"",source:X.source??"",pid:Number(X.pid??0),startedAt:X.startedAt??"",endedAt:X.endedAt?X.endedAt:null,exitCode:typeof X.exitCode==="number"?X.exitCode:null,status:X.status??"running",statusLock:Number(X.statusLock??0),interactive:X.interactive===!0,provider:X.provider??"",model:X.model??"",cwd:X.cwd??"",workspaceRoot:X.workspaceRoot??"",teamName:X.teamName||void 0,enableTools:X.enableTools===!0,enableSpawn:X.enableSpawn===!0,enableTeams:X.enableTeams===!0,parentSessionId:X.parentSessionId||void 0,parentAgentId:X.parentAgentId||void 0,agentId:X.agentId||void 0,conversationId:X.conversationId||void 0,isSubagent:X.isSubagent===!0,prompt:X.prompt||void 0,metadata:O9(X.metadata),transcriptPath:X.transcriptPath??"",hookPath:X.hookPath??"",messagesPath:X.messagesPath||void 0,updatedAt:X.updatedAt??""}}function SX1(X){let Y=X?.trim();if(!Y)return;try{let W=JSON.parse(Y);if(!Array.isArray(W))return;let z=W.map((F)=>typeof F==="string"?F.trim():"").filter((F)=>F.length>0);return z.length>0?z:void 0}catch{return}}function kY(X){return{scheduleId:X.scheduleId??"",name:X.name??"",cronPattern:X.cronPattern??"",prompt:X.prompt??"",provider:X.provider??"",model:X.model??"",mode:X.mode==="plan"?"plan":"act",workspaceRoot:X.workspaceRoot?.trim()||void 0,cwd:X.cwd?.trim()||void 0,systemPrompt:X.systemPrompt?.trim()||void 0,maxIterations:X.hasMaxIterations?X.maxIterations:void 0,timeoutSeconds:X.hasTimeoutSeconds?X.timeoutSeconds:void 0,maxParallel:typeof X.maxParallel==="number"&&X.maxParallel>0?X.maxParallel:1,enabled:X.enabled===!0,createdAt:X.createdAt??"",updatedAt:X.updatedAt??"",lastRunAt:X.lastRunAt?.trim()||void 0,nextRunAt:X.nextRunAt?.trim()||void 0,createdBy:X.createdBy?.trim()||void 0,tags:SX1(X.tagsJson??void 0),metadata:O9(X.metadata)}}function jA(X){return{executionId:X.executionId??"",scheduleId:X.scheduleId??"",sessionId:X.sessionId?.trim()||void 0,triggeredAt:X.triggeredAt??"",startedAt:X.startedAt?.trim()||void 0,endedAt:X.endedAt?.trim()||void 0,status:X.status==="pending"||X.status==="running"||X.status==="success"||X.status==="failed"||X.status==="timeout"||X.status==="aborted"?X.status:"failed",exitCode:X.hasExitCode?X.exitCode:void 0,errorMessage:X.errorMessage?.trim()||void 0,iterations:X.hasIterations?X.iterations:void 0,tokensUsed:X.hasTokensUsed?X.tokensUsed:void 0,costUsd:X.hasCostUsd?X.costUsd:void 0}}class aQ{client;constructor(X){this.client=PX1(X.address)}close(){this.client.close()}async upsertSession(X){await this.unary((Y)=>{let W={session:wX1(X)};this.client.UpsertSession(W,Y)})}async getSession(X){let Y=await this.unary((W)=>{this.client.GetSession({sessionId:X},W)});if(!Y.session)return;return XJ0(Y.session)}async listSessions(X){return((await this.unary((Y)=>{this.client.ListSessions(X,Y)})).sessions??[]).map((Y)=>XJ0(Y))}async updateSession(X){let Y={sessionId:X.sessionId,status:X.status,endedAt:X.endedAt??void 0,setRunning:X.setRunning};if(X.exitCode!==void 0)Y.hasExitCode=!0,Y.exitCode=X.exitCode??0;if(X.prompt!==void 0)Y.hasPrompt=!0,Y.prompt=X.prompt??"";if(X.metadata!==void 0)Y.hasMetadata=!0,Y.metadata=r9(X.metadata??void 0);if(X.parentSessionId!==void 0)Y.hasParentSessionId=!0,Y.parentSessionId=X.parentSessionId??"";if(X.parentAgentId!==void 0)Y.hasParentAgentId=!0,Y.parentAgentId=X.parentAgentId??"";if(X.agentId!==void 0)Y.hasAgentId=!0,Y.agentId=X.agentId??"";if(X.conversationId!==void 0)Y.hasConversationId=!0,Y.conversationId=X.conversationId??"";if(X.expectedStatusLock!==void 0)Y.hasExpectedStatusLock=!0,Y.expectedStatusLock=X.expectedStatusLock;let W=await this.unary((z)=>{this.client.UpdateSession(Y,z)});return{updated:W.updated===!0,statusLock:Number(W.statusLock??0)}}async deleteSession(X,Y=!1){return(await this.unary((W)=>{this.client.DeleteSession({sessionId:X,cascade:Y},W)})).deleted===!0}async enqueueSpawnRequest(X){await this.unary((Y)=>{this.client.EnqueueSpawnRequest(X,Y)})}async claimSpawnRequest(X,Y){let W=(await this.unary((z)=>{let F={rootSessionId:X,parentAgentId:Y};this.client.ClaimSpawnRequest(F,z)})).item?.task?.trim();return W?W:void 0}async startRuntimeSession(X){let Y={sessionId:X.sessionId??"",workspaceRoot:X.workspaceRoot,cwd:X.cwd??"",provider:X.provider,model:X.model,mode:X.mode,apiKey:X.apiKey,systemPrompt:X.systemPrompt??"",maxIterations:X.maxIterations??0,hasMaxIterations:typeof X.maxIterations==="number",enableTools:X.enableTools,enableSpawn:X.enableSpawn,enableTeams:X.enableTeams,autoApproveTools:X.autoApproveTools??!1,hasAutoApproveTools:typeof X.autoApproveTools==="boolean",teamName:X.teamName,missionStepInterval:X.missionStepInterval,missionTimeIntervalMs:X.missionTimeIntervalMs,toolPolicies:Object.fromEntries(Object.entries(X.toolPolicies??{}).map(([F,Q])=>[F,{enabled:Q.enabled!==!1,autoApprove:Q.autoApprove??!1}])),initialMessages:(X.initialMessages??[]).map((F)=>({role:F.role??"",content:a7(F.content)})),logger:X.logger?{enabled:X.logger.enabled??!1,level:X.logger.level??"",destination:X.logger.destination??"",name:X.logger.name??"",bindings:r9(X.logger.bindings)}:void 0},W=await this.unary((F)=>{this.client.StartRuntimeSession({request:Y},F)}),z=W.startResult?{sessionId:W.startResult.sessionId??"",manifestPath:W.startResult.manifestPath??"",transcriptPath:W.startResult.transcriptPath??"",hookPath:W.startResult.hookPath??"",messagesPath:W.startResult.messagesPath??""}:void 0;return{sessionId:W.sessionId??"",startResult:z}}async sendRuntimeSession(X,Y){let W={config:{workspaceRoot:Y.config.workspaceRoot,cwd:Y.config.cwd??"",provider:Y.config.provider,model:Y.config.model,mode:Y.config.mode,apiKey:Y.config.apiKey,systemPrompt:Y.config.systemPrompt??"",maxIterations:Y.config.maxIterations??0,hasMaxIterations:typeof Y.config.maxIterations==="number",enableTools:Y.config.enableTools,enableSpawn:Y.config.enableSpawn,enableTeams:Y.config.enableTeams,autoApproveTools:Y.config.autoApproveTools??!1,hasAutoApproveTools:typeof Y.config.autoApproveTools==="boolean",teamName:Y.config.teamName,missionStepInterval:Y.config.missionStepInterval,missionTimeIntervalMs:Y.config.missionTimeIntervalMs,toolPolicies:Object.fromEntries(Object.entries(Y.config.toolPolicies??{}).map(([F,Q])=>[F,{enabled:Q.enabled!==!1,autoApprove:Q.autoApprove??!1}])),initialMessages:(Y.config.initialMessages??[]).map((F)=>({role:F.role??"",content:a7(F.content)})),logger:Y.config.logger?{enabled:Y.config.logger.enabled??!1,level:Y.config.logger.level??"",destination:Y.config.logger.destination??"",name:Y.config.logger.name??"",bindings:r9(Y.config.logger.bindings)}:void 0},messages:(Y.messages??[]).map((F)=>({role:F.role??"",content:a7(F.content)})),prompt:Y.prompt,delivery:Y.delivery,attachments:Y.attachments?{userImages:Y.attachments.userImages??[],userFiles:(Y.attachments.userFiles??[]).map((F)=>({name:F.name,content:F.content}))}:void 0},z=await this.unary((F)=>{this.client.SendRuntimeSession({sessionId:X,request:W},F)});if(!z.result)return{queued:!0};return{result:{text:z.result.text??"",usage:{inputTokens:Number(z.result.usage?.inputTokens??0),outputTokens:Number(z.result.usage?.outputTokens??0),cacheReadTokens:z.result.usage?.hasCacheReadTokens?Number(z.result.usage?.cacheReadTokens??0):void 0,cacheWriteTokens:z.result.usage?.hasCacheWriteTokens?Number(z.result.usage?.cacheWriteTokens??0):void 0,totalCost:z.result.usage?.hasTotalCost?Number(z.result.usage?.totalCost??0):void 0},inputTokens:Number(z.result.inputTokens??0),outputTokens:Number(z.result.outputTokens??0),iterations:Number(z.result.iterations??0),finishReason:z.result.finishReason??"",messages:(z.result.messages??[]).map((F)=>({role:F.role??"",content:r7(F.content)})),toolCalls:(z.result.toolCalls??[]).map((F)=>({name:F.name??"",input:F.hasInput?r7(F.input):void 0,output:F.hasOutput?r7(F.output):void 0,error:F.error?.trim()||void 0,durationMs:F.hasDurationMs?Number(F.durationMs??0):void 0}))},queued:!1}}async abortRuntimeSession(X){return{applied:(await this.unary((Y)=>{this.client.AbortRuntimeSession({sessionId:X},Y)})).applied===!0}}async requestToolApproval(X){let Y={approvalId:X.approvalId,sessionId:X.sessionId,taskId:X.taskId,toolCallId:X.toolCallId,toolName:X.toolName,inputJson:X.inputJson,requesterClientId:X.requesterClientId,timeoutMs:X.timeoutMs},W=await this.unary((z)=>{this.client.RequestToolApproval(Y,z)});return{approvalId:W.approvalId??"",decided:W.decided===!0,approved:W.approved===!0,reason:W.reason??""}}async respondToolApproval(X){let Y={approvalId:X.approvalId,approved:X.approved,reason:X.reason,responderClientId:X.responderClientId},W=await this.unary((z)=>{this.client.RespondToolApproval(Y,z)});return{approvalId:W.approvalId??"",applied:W.applied===!0}}async listPendingApprovals(X){return((await this.unary((Y)=>{this.client.ListPendingApprovals({sessionId:X},Y)})).approvals??[]).map((Y)=>({approvalId:Y.approvalId??"",sessionId:Y.sessionId??"",taskId:Y.taskId??"",toolCallId:Y.toolCallId??"",toolName:Y.toolName??"",inputJson:Y.inputJson??"",requesterClientId:Y.requesterClientId??"",createdAt:Y.createdAt??""}))}async createSchedule(X){let Y=await this.unary((W)=>{this.client.CreateSchedule({name:X.name,cronPattern:X.cronPattern,prompt:X.prompt,provider:X.provider,model:X.model,mode:X.mode??"act",workspaceRoot:X.workspaceRoot,cwd:X.cwd,systemPrompt:X.systemPrompt,maxIterations:X.maxIterations??0,hasMaxIterations:typeof X.maxIterations==="number",timeoutSeconds:X.timeoutSeconds??0,hasTimeoutSeconds:typeof X.timeoutSeconds==="number",maxParallel:X.maxParallel??1,enabled:X.enabled??!0,createdBy:X.createdBy,tagsJson:X.tags?JSON.stringify(X.tags):"",metadata:r9(X.metadata)},W)});return Y.schedule?kY(Y.schedule):void 0}async getSchedule(X){let Y=await this.unary((W)=>{this.client.GetSchedule({scheduleId:X},W)});return Y.schedule?kY(Y.schedule):void 0}async listSchedules(X){return((await this.unary((Y)=>{this.client.ListSchedules({limit:X?.limit??100,hasEnabled:typeof X?.enabled==="boolean",enabled:X?.enabled??!1,tagsJson:X?.tags?JSON.stringify(X.tags):""},Y)})).schedules??[]).map((Y)=>kY(Y))}async updateSchedule(X,Y){let W={scheduleId:X};if(Y.name!==void 0)W.hasName=!0,W.name=Y.name;if(Y.cronPattern!==void 0)W.hasCronPattern=!0,W.cronPattern=Y.cronPattern;if(Y.prompt!==void 0)W.hasPrompt=!0,W.prompt=Y.prompt;if(Y.provider!==void 0)W.hasProvider=!0,W.provider=Y.provider;if(Y.model!==void 0)W.hasModel=!0,W.model=Y.model;if(Y.mode!==void 0)W.hasMode=!0,W.mode=Y.mode;if(Y.workspaceRoot!==void 0)W.hasWorkspaceRoot=!0,W.workspaceRoot=Y.workspaceRoot;if(Y.cwd!==void 0)W.hasCwd=!0,W.cwd=Y.cwd;if(Y.systemPrompt!==void 0)W.hasSystemPrompt=!0,W.systemPrompt=Y.systemPrompt;if(Y.maxIterations===null)W.clearMaxIterations=!0;else if(Y.maxIterations!==void 0)W.hasMaxIterations=!0,W.maxIterations=Y.maxIterations;if(Y.timeoutSeconds===null)W.clearTimeoutSeconds=!0;else if(Y.timeoutSeconds!==void 0)W.hasTimeoutSeconds=!0,W.timeoutSeconds=Y.timeoutSeconds;if(Y.maxParallel!==void 0)W.hasMaxParallel=!0,W.maxParallel=Y.maxParallel;if(Y.enabled!==void 0)W.hasEnabled=!0,W.enabled=Y.enabled;if(Y.createdBy===null)W.clearCreatedBy=!0;else if(Y.createdBy!==void 0)W.hasCreatedBy=!0,W.createdBy=Y.createdBy;if(Y.tags!==void 0)W.hasTagsJson=!0,W.tagsJson=JSON.stringify(Y.tags);if(Y.metadata!==void 0)W.hasMetadata=!0,W.metadata=r9(Y.metadata);let z=await this.unary((F)=>{this.client.UpdateSchedule(W,F)});return z.schedule?kY(z.schedule):void 0}async deleteSchedule(X){return(await this.unary((Y)=>{this.client.DeleteSchedule({scheduleId:X},Y)})).deleted===!0}async pauseSchedule(X){let Y=await this.unary((W)=>{this.client.PauseSchedule({scheduleId:X},W)});return Y.schedule?kY(Y.schedule):void 0}async resumeSchedule(X){let Y=await this.unary((W)=>{this.client.ResumeSchedule({scheduleId:X},W)});return Y.schedule?kY(Y.schedule):void 0}async triggerScheduleNow(X){let Y=await this.unary((W)=>{this.client.TriggerScheduleNow({scheduleId:X},W)});return Y.execution?jA(Y.execution):void 0}async listScheduleExecutions(X){return((await this.unary((Y)=>{this.client.ListScheduleExecutions({scheduleId:X.scheduleId,status:X.status,limit:X.limit??50},Y)})).executions??[]).map((Y)=>jA(Y))}async getScheduleStats(X){let Y=await this.unary((W)=>{this.client.GetScheduleStats({scheduleId:X},W)});return{totalRuns:Number(Y.totalRuns??0),successRate:Number(Y.successRate??0),avgDurationSeconds:Number(Y.avgDurationSeconds??0),lastFailure:Y.lastFailure?jA(Y.lastFailure):void 0}}async getActiveScheduledExecutions(){return((await this.unary((X)=>{this.client.GetActiveScheduledExecutions({},X)})).executions??[]).map((X)=>({executionId:X.executionId??"",scheduleId:X.scheduleId??"",sessionId:X.sessionId??"",startedAt:X.startedAt??"",timeoutAt:X.timeoutAt?.trim()||void 0}))}async getUpcomingScheduledRuns(X=20){return((await this.unary((Y)=>{this.client.GetUpcomingScheduledRuns({limit:X},Y)})).runs??[]).map((Y)=>({scheduleId:Y.scheduleId??"",name:Y.name??"",nextRunAt:Y.nextRunAt??""}))}async stopRuntimeSession(X){return{applied:(await this.unary((Y)=>{this.client.StopRuntimeSession({sessionId:X},Y)})).applied===!0}}async runProviderAction(X){let Y=X.action==="listProviders"?{listProviders:{}}:X.action==="getProviderModels"?{getProviderModels:{providerId:X.providerId}}:X.action==="addProvider"?{addProvider:{providerId:X.providerId,name:X.name,baseUrl:X.baseUrl,apiKey:X.apiKey??"",headers:X.headers??{},timeoutMs:X.timeoutMs??0,hasTimeoutMs:typeof X.timeoutMs==="number",models:X.models??[],defaultModelId:X.defaultModelId??"",modelsSourceUrl:X.modelsSourceUrl??"",capabilities:X.capabilities??[]}}:X.action==="saveProviderSettings"?{saveProviderSettings:{providerId:X.providerId,enabled:X.enabled??!1,hasEnabled:typeof X.enabled==="boolean",apiKey:X.apiKey??"",hasApiKey:X.apiKey!==void 0,baseUrl:X.baseUrl??"",hasBaseUrl:X.baseUrl!==void 0}}:{clineAccount:{operation:X.operation,userId:"userId"in X?X.userId??"":"",organizationId:"organizationId"in X?X.organizationId??"":"",memberId:"memberId"in X?X.memberId??"":"",clearOrganizationId:"organizationId"in X&&X.organizationId===null}},W=await this.unary((z)=>{this.client.RunProviderAction({request:Y},z)});return{result:r7(W.result)}}async runProviderOAuthLogin(X){let Y=await this.unary((W)=>{this.client.RunProviderOAuthLogin({provider:X},W)});return{provider:Y.provider??"",accessToken:Y.apiKey??""}}async publishEvent(X){let Y=await this.unary((W)=>{this.client.PublishEvent({eventId:X.eventId,sessionId:X.sessionId,taskId:X.taskId,eventType:X.eventType,payload:r9(X.payload),sourceClientId:X.sourceClientId},W)});return{eventId:Y.eventId??"",accepted:Y.accepted===!0}}streamEvents(X,Y={}){let W=!1,z=this.client.StreamEvents({clientId:X.clientId??"",sessionIds:X.sessionIds??[]}),F=(Z)=>{Y.onEvent?.({eventId:Z.eventId??"",sessionId:Z.sessionId??"",taskId:Z.taskId?.trim()?Z.taskId:void 0,eventType:Z.eventType??"",payload:O9(Z.payload)??{},sourceClientId:Z.sourceClientId?.trim()?Z.sourceClientId:void 0,ts:Z.ts??""})},Q=(Z)=>{let K=(typeof Z.code==="number"?Number(Z.code):void 0)===1||Z.message.includes("CANCELLED");if(W&&K)return;Y.onError?.(Z)},J=()=>{Y.onEnd?.()};return z.on("data",F),z.on("error",Q),z.on("end",J),()=>{W=!0,z.cancel()}}streamTeamProgress(X,Y={}){return this.streamEvents(X,{onEvent:(W)=>{if(W.eventType===V3){try{let z=W.payload;if(z.type==="team_progress_projection"&&z.version===1)Y.onProjection?.(z)}catch{}return}if(W.eventType===B3)try{Y.onLifecycle?.(W.payload)}catch{}},onError:Y.onError,onEnd:Y.onEnd})}async unary(X){return await new Promise((Y,W)=>{X((z,F)=>{if(z){W(z);return}Y(F??{})})})}}var fX1="cline.rpc.v1",zJ0="ClineGateway";function yX1(){return WJ0(import.meta.url)}function kX1(){let X=FJ0.loadSync(yX1(),{keepCase:!1,longs:String,enums:String,defaults:!0,oneofs:!0}),Y=KJ0.loadPackageDefinition(X).cline?.rpc?.v1?.ClineGateway?.service;if(!Y)throw Error(`Unable to load ${fX1}.${zJ0} from proto`);return Y}function jY(){return new Date().toISOString()}function b0(X){return typeof X==="string"?X:""}function vX1(X){if(!X||typeof X!=="object")return{};let Y={};for(let[W,z]of Object.entries(X)){let F=W.trim();if(!F)continue;let Q=b0(z).trim();if(!Q)continue;Y[F]=Q}return Y}function jX1(X){if(!Array.isArray(X)||X.length===0)return;let Y=new Set;for(let W of X){let z=W.trim();if(z)Y.add(z)}return Y.size>0?Y:void 0}function qJ0(X){if(X==="running"||X==="completed"||X==="failed"||X==="cancelled")return X;return"running"}function YJ0(X){return{sessionId:X.sessionId,source:X.source,pid:X.pid,startedAt:X.startedAt,endedAt:X.endedAt??"",exitCode:X.exitCode??0,status:X.status,statusLock:X.statusLock,interactive:X.interactive,provider:X.provider,model:X.model,cwd:X.cwd,workspaceRoot:X.workspaceRoot,teamName:X.teamName??"",enableTools:X.enableTools,enableSpawn:X.enableSpawn,enableTeams:X.enableTeams,parentSessionId:X.parentSessionId??"",parentAgentId:X.parentAgentId??"",agentId:X.agentId??"",conversationId:X.conversationId??"",isSubagent:X.isSubagent,prompt:X.prompt??"",transcriptPath:X.transcriptPath,hookPath:X.hookPath,messagesPath:X.messagesPath??"",updatedAt:X.updatedAt,metadata:r9(X.metadata)}}function hX1(X){let Y=b0(X.sessionId).trim(),W=b0(X.source).trim(),z=b0(X.startedAt).trim(),F=b0(X.provider).trim(),Q=b0(X.model).trim(),J=b0(X.cwd).trim(),Z=b0(X.workspaceRoot).trim(),K=b0(X.transcriptPath).trim(),H=b0(X.hookPath).trim();if(!Y||!W||!z||!F||!Q||!J||!Z||!K||!H)throw Error("session record is missing required fields");return{sessionId:Y,source:W,pid:Number(X.pid??0),startedAt:z,endedAt:b0(X.endedAt).trim()||null,exitCode:typeof X.exitCode==="number"?Math.floor(X.exitCode):null,status:qJ0(b0(X.status).trim()),statusLock:typeof X.statusLock==="number"?Math.floor(X.statusLock):0,interactive:X.interactive===!0,provider:F,model:Q,cwd:J,workspaceRoot:Z,teamName:b0(X.teamName).trim()||void 0,enableTools:X.enableTools===!0,enableSpawn:X.enableSpawn===!0,enableTeams:X.enableTeams===!0,parentSessionId:b0(X.parentSessionId).trim()||void 0,parentAgentId:b0(X.parentAgentId).trim()||void 0,agentId:b0(X.agentId).trim()||void 0,conversationId:b0(X.conversationId).trim()||void 0,isSubagent:X.isSubagent===!0,prompt:b0(X.prompt).trim()||void 0,metadata:O9(X.metadata),transcriptPath:K,hookPath:H,messagesPath:b0(X.messagesPath).trim()||void 0,updatedAt:b0(X.updatedAt).trim()||jY()}}function hA(X){let Y=b0(X).trim();if(!Y)return;try{let W=JSON.parse(Y);if(!Array.isArray(W))return;let z=W.map((F)=>typeof F==="string"?F.trim():"").filter((F)=>F.length>0);return z.length>0?z:void 0}catch{return}}function vY(X){return{scheduleId:X.scheduleId,name:X.name,cronPattern:X.cronPattern,prompt:X.prompt,provider:X.provider,model:X.model,mode:X.mode,workspaceRoot:X.workspaceRoot??"",cwd:X.cwd??"",systemPrompt:X.systemPrompt??"",maxIterations:X.maxIterations??0,hasMaxIterations:typeof X.maxIterations==="number",timeoutSeconds:X.timeoutSeconds??0,hasTimeoutSeconds:typeof X.timeoutSeconds==="number",maxParallel:X.maxParallel,enabled:X.enabled,createdAt:X.createdAt,updatedAt:X.updatedAt,lastRunAt:X.lastRunAt??"",nextRunAt:X.nextRunAt??"",createdBy:X.createdBy??"",tagsJson:X.tags?JSON.stringify(X.tags):"",metadata:r9(X.metadata)}}function _A(X){return{executionId:X.executionId,scheduleId:X.scheduleId,sessionId:X.sessionId??"",triggeredAt:X.triggeredAt,startedAt:X.startedAt??"",endedAt:X.endedAt??"",status:X.status,exitCode:X.exitCode??0,hasExitCode:typeof X.exitCode==="number",errorMessage:X.errorMessage??"",iterations:X.iterations??0,hasIterations:typeof X.iterations==="number",tokensUsed:X.tokensUsed??0,hasTokensUsed:typeof X.tokensUsed==="number",costUsd:X.costUsd??0,hasCostUsd:typeof X.costUsd==="number"}}function HJ0(X){return new(SK.makeGenericClientConstructor(kX1(),zJ0))(X,SK.credentials.createInsecure())}async function a4(X){return await new Promise((Y)=>{let W;try{W=HJ0(X)}catch{Y(void 0);return}W.Health({},(z,F)=>{if(W?.close(),z||!F){Y(void 0);return}Y(F)})})}async function VJ0(X){return await new Promise((Y)=>{let W;try{W=HJ0(X)}catch{Y(void 0);return}W.Shutdown({},(z,F)=>{if(W?.close(),z||!F){Y(void 0);return}Y(F)})})}var _X1="0.0.26",rQ="1",BJ0=_X1,bX1=300000;class UJ0{publishEvent;approvals=new Map;constructor(X){this.publishEvent=X}async requestToolApproval(X){let Y=b0(X.sessionId).trim(),W=b0(X.toolCallId).trim(),z=b0(X.toolName).trim();if(!Y||!W||!z)throw Error("sessionId, toolCallId, and toolName are required");let F=b0(X.approvalId).trim()||`apr_${xX1()}`;if(!this.approvals.get(F)){let K={approvalId:F,sessionId:Y,taskId:b0(X.taskId).trim()||void 0,toolCallId:W,toolName:z,inputJson:b0(X.inputJson),requesterClientId:b0(X.requesterClientId).trim()||void 0,createdAt:jY(),status:"pending",waiters:[]};this.approvals.set(F,K),this.publishEvent({eventId:"",sessionId:Y,taskId:K.taskId,eventType:"approval.requested",payload:r9(K),sourceClientId:K.requesterClientId})}let Q=this.approvals.get(F);if(!Q)throw Error("approval state not found");if(Q.status==="approved"||Q.status==="rejected")return{approvalId:F,decided:!0,approved:Q.status==="approved",reason:Q.reason??""};let J=typeof X.timeoutMs==="number"&&X.timeoutMs>0?Math.floor(X.timeoutMs):bX1,Z=await new Promise((K)=>{let H=setTimeout(()=>{K({decided:!1,approved:!1,reason:"Tool approval request timed out"})},J);Q.waiters.push((G)=>{clearTimeout(H),K(G)})});return{approvalId:F,decided:Z.decided,approved:Z.approved,reason:Z.reason??""}}respondToolApproval(X){let Y=b0(X.approvalId).trim();if(!Y)throw Error("approvalId is required");let W=this.approvals.get(Y);if(!W)return{approvalId:Y,applied:!1};W.status=X.approved===!0?"approved":"rejected",W.reason=b0(X.reason).trim()||void 0;let z={decided:!0,approved:W.status==="approved",reason:W.reason};for(let F of W.waiters.splice(0))F(z);return this.publishEvent({eventId:"",sessionId:W.sessionId,taskId:W.taskId,eventType:"approval.decided",payload:r9({approvalId:Y,approved:z.approved,reason:z.reason??"",responderClientId:b0(X.responderClientId).trim()||""}),sourceClientId:b0(X.responderClientId).trim()||""}),{approvalId:Y,applied:!0}}listPendingApprovals(X){let Y=b0(X.sessionId).trim(),W=[];for(let z of this.approvals.values()){if(z.status!=="pending")continue;if(Y&&z.sessionId!==Y)continue;W.push({approvalId:z.approvalId,sessionId:z.sessionId,taskId:z.taskId??"",toolCallId:z.toolCallId,toolName:z.toolName,inputJson:z.inputJson,requesterClientId:z.requesterClientId??"",createdAt:z.createdAt})}return W.sort((z,F)=>(z.createdAt??"").localeCompare(F.createdAt??"")),{approvals:W}}}class NJ0{subscribers=new Map;nextSubscriberId=1;publishEvent(X){let Y=b0(X.sessionId).trim();if(!Y)throw Error("sessionId is required");let W={eventId:b0(X.eventId).trim()||`evt_${QJ0()}`,sessionId:Y,taskId:b0(X.taskId).trim()||void 0,eventType:b0(X.eventType).trim()||"unknown",payload:O9(X.payload)??{},sourceClientId:b0(X.sourceClientId).trim()||void 0,ts:jY()};return this.dispatchEvent(W),{eventId:W.eventId,accepted:!0}}addSubscriber(X){let Y=X.request,W=jX1(Y.sessionIds),z=this.nextSubscriberId;return this.nextSubscriberId+=1,this.subscribers.set(z,{call:X,filterSessionIds:W}),X.on("cancelled",()=>{this.subscribers.delete(z)}),X.on("close",()=>{this.subscribers.delete(z)}),z}removeSubscriber(X){this.subscribers.delete(X)}broadcastServerEvent(X,Y){let W=`evt_${QJ0()}`,z=jY();for(let F of this.subscribers.values())F.call.write({eventId:W,sessionId:"__rpc__",taskId:"",eventType:X,payload:r9(Y),sourceClientId:"rpc-server",ts:z})}dispatchEvent(X){for(let Y of this.subscribers.values()){if(Y.filterSessionIds&&!Y.filterSessionIds.has(X.sessionId))continue;Y.call.write({eventId:X.eventId,sessionId:X.sessionId,taskId:X.taskId??"",eventType:X.eventType,payload:r9(X.payload),sourceClientId:X.sourceClientId??"",ts:X.ts})}}}class AJ0{scheduler;constructor(X){this.scheduler=X}createSchedule(X){let Y=this.requireScheduler(),W={name:b0(X.name).trim(),cronPattern:b0(X.cronPattern).trim(),prompt:b0(X.prompt),provider:b0(X.provider).trim(),model:b0(X.model).trim(),mode:b0(X.mode).trim()==="plan"?"plan":"act",workspaceRoot:b0(X.workspaceRoot).trim()||void 0,cwd:b0(X.cwd).trim()||void 0,systemPrompt:b0(X.systemPrompt)||void 0,maxIterations:X.hasMaxIterations?Math.floor(X.maxIterations??0):void 0,timeoutSeconds:X.hasTimeoutSeconds?Math.floor(X.timeoutSeconds??0):void 0,maxParallel:typeof X.maxParallel==="number"&&X.maxParallel>0?Math.floor(X.maxParallel):1,enabled:X.enabled!==!1,createdBy:b0(X.createdBy).trim()||void 0,tags:hA(b0(X.tagsJson)),metadata:O9(X.metadata)};if(!W.name||!W.cronPattern||!W.prompt.trim()||!W.provider||!W.model)throw Error("name, cronPattern, prompt, provider, and model are required");let z=Y.createSchedule(W);return{schedule:vY(z)}}getSchedule(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim();if(!W)throw Error("scheduleId is required");let z=Y.getSchedule(W);return z?{schedule:vY(z)}:{}}listSchedules(X){return{schedules:this.requireScheduler().listSchedules({enabled:X.hasEnabled?X.enabled===!0:void 0,limit:typeof X.limit==="number"&&X.limit>0?Math.floor(X.limit):void 0,tags:hA(b0(X.tagsJson))}).map((Y)=>vY(Y))}}updateSchedule(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim();if(!W)throw Error("scheduleId is required");let z={};if(X.hasName)z.name=b0(X.name);if(X.hasCronPattern)z.cronPattern=b0(X.cronPattern);if(X.hasPrompt)z.prompt=b0(X.prompt);if(X.hasProvider)z.provider=b0(X.provider);if(X.hasModel)z.model=b0(X.model);if(X.hasMode)z.mode=b0(X.mode).trim()==="plan"?"plan":"act";if(X.hasWorkspaceRoot)z.workspaceRoot=b0(X.workspaceRoot);if(X.hasCwd)z.cwd=b0(X.cwd);if(X.hasSystemPrompt)z.systemPrompt=b0(X.systemPrompt);if(X.clearMaxIterations)z.maxIterations=null;else if(X.hasMaxIterations)z.maxIterations=Math.floor(X.maxIterations??0);if(X.clearTimeoutSeconds)z.timeoutSeconds=null;else if(X.hasTimeoutSeconds)z.timeoutSeconds=Math.floor(X.timeoutSeconds??0);if(X.hasMaxParallel)z.maxParallel=Math.floor(X.maxParallel??1);if(X.hasEnabled)z.enabled=X.enabled===!0;if(X.clearCreatedBy)z.createdBy=null;else if(X.hasCreatedBy)z.createdBy=b0(X.createdBy);if(X.hasTagsJson)z.tags=hA(b0(X.tagsJson))??[];if(X.hasMetadata)z.metadata=O9(X.metadata)??{};let F=Y.updateSchedule(W,z);return{updated:F!==void 0,schedule:F?vY(F):void 0}}deleteSchedule(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim();if(!W)throw Error("scheduleId is required");return{deleted:Y.deleteSchedule(W)}}pauseSchedule(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim();if(!W)throw Error("scheduleId is required");let z=Y.pauseSchedule(W);return{updated:z!==void 0,schedule:z?vY(z):void 0}}resumeSchedule(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim();if(!W)throw Error("scheduleId is required");let z=Y.resumeSchedule(W);return{updated:z!==void 0,schedule:z?vY(z):void 0}}async triggerScheduleNow(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim();if(!W)throw Error("scheduleId is required");let z=await Y.triggerScheduleNow(W);return z?{execution:_A(z)}:{}}listScheduleExecutions(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim()||void 0,z=b0(X.status).trim()||void 0;return{executions:Y.listScheduleExecutions({scheduleId:W,status:z==="pending"||z==="running"||z==="success"||z==="failed"||z==="timeout"||z==="aborted"?z:void 0,limit:typeof X.limit==="number"&&X.limit>0?Math.floor(X.limit):void 0}).map((F)=>_A(F))}}getScheduleStats(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim();if(!W)throw Error("scheduleId is required");let z=Y.getScheduleStats(W);return{totalRuns:z.totalRuns,successRate:z.successRate,avgDurationSeconds:z.avgDurationSeconds,lastFailure:z.lastFailure?_A(z.lastFailure):void 0}}getActiveScheduledExecutions(X){return{executions:this.requireScheduler().getActiveExecutions().map((Y)=>({executionId:Y.executionId,scheduleId:Y.scheduleId,sessionId:Y.sessionId,startedAt:Y.startedAt,timeoutAt:Y.timeoutAt??""}))}}getUpcomingScheduledRuns(X){let Y=this.requireScheduler(),W=typeof X.limit==="number"&&X.limit>0?Math.floor(X.limit):20;return{runs:Y.getUpcomingRuns(W).map((z)=>({scheduleId:z.scheduleId,name:z.name,nextRunAt:z.nextRunAt}))}}requireScheduler(){if(!this.scheduler)throw Error("scheduler service is not configured");return this.scheduler}}class uX1{serverId=ZJ0();address;startedAt;runtimeHandlers;sessions=new Map;tasks=new Map;clients=new Map;store;eventService=new NJ0;approvalService=new UJ0((X)=>this.eventService.publishEvent(X));scheduleService;constructor(X,Y,W,z){this.address=X,this.startedAt=jY(),this.store=Y,this.runtimeHandlers=W,this.scheduleService=new AJ0(z),this.store.init()}health(){return{serverId:this.serverId,address:this.address,running:!0,startedAt:this.startedAt,rpcVersion:rQ}}registerClient(X){let Y=b0(X.clientId).trim()||`client_${ZJ0()}`,W=b0(X.clientType).trim()||void 0,z=vX1(X),F=jY(),Q=this.clients.get(Y),J=Q?{...Q,clientType:W??Q.clientType,metadata:Object.keys(z).length>0?{...Q.metadata??{},...z}:Q.metadata,lastRegisteredAt:F,activationCount:Q.activationCount+1}:{clientId:Y,clientType:W,metadata:Object.keys(z).length>0?z:void 0,firstRegisteredAt:F,lastRegisteredAt:F,activationCount:1};return this.clients.set(Y,J),this.broadcastServerEvent("rpc.client.activated",{clientId:J.clientId,clientType:J.clientType,metadata:J.metadata??{},firstRegisteredAt:J.firstRegisteredAt,lastRegisteredAt:J.lastRegisteredAt,activationCount:J.activationCount}),{clientId:Y,registered:!0}}ensureSession(X){let Y=b0(X.sessionId).trim();if(!Y)throw Error("sessionId is required");let W=this.sessions.get(Y);if(W)return W.status=b0(X.status).trim()||W.status,W.workspaceRoot=b0(X.workspaceRoot).trim()||W.workspaceRoot,W.clientId=b0(X.clientId).trim()||W.clientId,W.metadata=O9(X.metadata)??W.metadata,{sessionId:Y,created:!1,status:W.status};let z=b0(X.status).trim()||"running";return this.sessions.set(Y,{sessionId:Y,status:z,workspaceRoot:b0(X.workspaceRoot).trim()||void 0,clientId:b0(X.clientId).trim()||void 0,metadata:O9(X.metadata)}),{sessionId:Y,created:!0,status:z}}upsertSession(X){if(!X.session)throw Error("session is required");return this.store.upsertSession(hX1(X.session)),{persisted:!0}}getSession(X){let Y=b0(X.sessionId).trim();if(!Y)throw Error("sessionId is required");let W=this.store.getSession(Y);if(!W)return{};return{session:YJ0(W)}}listSessions(X){let Y=typeof X.limit==="number"&&X.limit>0?Math.floor(X.limit):200;return{sessions:this.store.listSessions({limit:Y,parentSessionId:b0(X.parentSessionId).trim()||void 0,status:b0(X.status).trim()||void 0}).map((W)=>YJ0(W))}}updateSession(X){let Y=b0(X.sessionId).trim();if(!Y)throw Error("sessionId is required");return this.store.updateSession({sessionId:Y,status:X.status?qJ0(X.status):void 0,endedAt:X.endedAt?X.endedAt:void 0,exitCode:X.hasExitCode?X.exitCode??null:void 0,prompt:X.hasPrompt?X.prompt??null:void 0,metadata:X.hasMetadata?O9(X.metadata)??null:void 0,parentSessionId:X.hasParentSessionId?X.parentSessionId??null:void 0,parentAgentId:X.hasParentAgentId?X.parentAgentId??null:void 0,agentId:X.hasAgentId?X.agentId??null:void 0,conversationId:X.hasConversationId?X.conversationId??null:void 0,expectedStatusLock:X.hasExpectedStatusLock?X.expectedStatusLock:void 0,setRunning:X.setRunning===!0})}deleteSession(X){let Y=b0(X.sessionId).trim();if(!Y)throw Error("sessionId is required");let W=this.store.deleteSession(Y);if(X.cascade===!0)this.store.deleteSessionsByParent(Y);return{deleted:W}}enqueueSpawnRequest(X){let Y=b0(X.rootSessionId).trim(),W=b0(X.parentAgentId).trim();if(!Y||!W)throw Error("rootSessionId and parentAgentId are required");return this.store.enqueueSpawnRequest({rootSessionId:Y,parentAgentId:W,task:b0(X.task).trim()||void 0,systemPrompt:b0(X.systemPrompt).trim()||void 0}),{enqueued:!0}}claimSpawnRequest(X){let Y=b0(X.rootSessionId).trim(),W=b0(X.parentAgentId).trim();if(!Y||!W)throw Error("rootSessionId and parentAgentId are required");let z=this.store.claimSpawnRequest(Y,W);if(!z)return{};return{item:{id:String(z.id),rootSessionId:z.rootSessionId,parentAgentId:z.parentAgentId,task:z.task??"",systemPrompt:z.systemPrompt??"",createdAt:z.createdAt,consumedAt:z.consumedAt??""}}}async startRuntimeSession(X){let Y=this.runtimeHandlers?.startSession;if(!Y)throw Error("runtime start handler is not configured");let W=X.request?{sessionId:b0(X.request.sessionId),workspaceRoot:b0(X.request.workspaceRoot),cwd:b0(X.request.cwd),provider:b0(X.request.provider),model:b0(X.request.model),mode:b0(X.request.mode),apiKey:b0(X.request.apiKey),systemPrompt:b0(X.request.systemPrompt),maxIterations:X.request.hasMaxIterations?X.request.maxIterations:void 0,enableTools:X.request.enableTools===!0,enableSpawn:X.request.enableSpawn===!0,enableTeams:X.request.enableTeams===!0,autoApproveTools:X.request.hasAutoApproveTools?X.request.autoApproveTools===!0:void 0,teamName:b0(X.request.teamName),missionStepInterval:X.request.missionStepInterval??3,missionTimeIntervalMs:X.request.missionTimeIntervalMs??120000,toolPolicies:Object.fromEntries(Object.entries(X.request.toolPolicies??{}).map(([Q,J])=>[Q,{enabled:J?.enabled===!0,autoApprove:J?.autoApprove===!0}])),initialMessages:(X.request.initialMessages??[]).map((Q)=>({role:b0(Q.role),content:r7(Q.content)})),logger:X.request.logger?{enabled:X.request.logger.enabled===!0,level:b0(X.request.logger.level),destination:b0(X.request.logger.destination),name:b0(X.request.logger.name),bindings:O9(X.request.logger.bindings)}:void 0}:void 0;if(!W)throw Error("runtime start request is required");let z=await Y(W),F=b0(z.sessionId).trim();if(!F)throw Error("runtime start handler returned empty sessionId");return{sessionId:F,startResult:z.startResult?{sessionId:b0(z.startResult.sessionId),manifestPath:b0(z.startResult.manifestPath),transcriptPath:b0(z.startResult.transcriptPath),hookPath:b0(z.startResult.hookPath),messagesPath:b0(z.startResult.messagesPath)}:void 0}}async sendRuntimeSession(X){let Y=this.runtimeHandlers?.sendSession;if(!Y)throw Error("runtime send handler is not configured");let W=b0(X.sessionId).trim();if(!W)throw Error("sessionId is required");let z=X.request?.delivery==="queue"||X.request?.delivery==="steer"?X.request.delivery:void 0,F=X.request?{config:{workspaceRoot:b0(X.request.config?.workspaceRoot),cwd:b0(X.request.config?.cwd),provider:b0(X.request.config?.provider),model:b0(X.request.config?.model),mode:b0(X.request.config?.mode),apiKey:b0(X.request.config?.apiKey),systemPrompt:b0(X.request.config?.systemPrompt),maxIterations:X.request.config?.hasMaxIterations?X.request.config?.maxIterations:void 0,enableTools:X.request.config?.enableTools===!0,enableSpawn:X.request.config?.enableSpawn===!0,enableTeams:X.request.config?.enableTeams===!0,autoApproveTools:X.request.config?.hasAutoApproveTools?X.request.config?.autoApproveTools===!0:void 0,teamName:b0(X.request.config?.teamName),missionStepInterval:X.request.config?.missionStepInterval??3,missionTimeIntervalMs:X.request.config?.missionTimeIntervalMs??120000,toolPolicies:Object.fromEntries(Object.entries(X.request.config?.toolPolicies??{}).map(([J,Z])=>[J,{enabled:Z?.enabled===!0,autoApprove:Z?.autoApprove===!0}])),initialMessages:(X.request.config?.initialMessages??[]).map((J)=>({role:b0(J.role),content:r7(J.content)})),logger:X.request.config?.logger?{enabled:X.request.config.logger.enabled===!0,level:b0(X.request.config.logger.level),destination:b0(X.request.config.logger.destination),name:b0(X.request.config.logger.name),bindings:O9(X.request.config.logger.bindings)}:void 0},messages:(X.request.messages??[]).map((J)=>({role:b0(J.role),content:r7(J.content)})),prompt:b0(X.request.prompt),delivery:z,attachments:X.request.attachments?{userImages:X.request.attachments.userImages??[],userFiles:(X.request.attachments.userFiles??[]).map((J)=>({name:b0(J.name),content:b0(J.content)}))}:void 0}:void 0;if(!F)throw Error("runtime send request is required");let Q=await Y(W,F);if(!Q.result)return{};return{result:{text:b0(Q.result.text),usage:{inputTokens:Q.result.usage.inputTokens,outputTokens:Q.result.usage.outputTokens,cacheReadTokens:Q.result.usage.cacheReadTokens??0,hasCacheReadTokens:typeof Q.result.usage.cacheReadTokens==="number",cacheWriteTokens:Q.result.usage.cacheWriteTokens??0,hasCacheWriteTokens:typeof Q.result.usage.cacheWriteTokens==="number",totalCost:Q.result.usage.totalCost??0,hasTotalCost:typeof Q.result.usage.totalCost==="number"},inputTokens:Q.result.inputTokens,outputTokens:Q.result.outputTokens,iterations:Q.result.iterations,finishReason:b0(Q.result.finishReason),messages:(Q.result.messages??[]).map((J)=>({role:b0(J.role),content:a7(J.content)})),toolCalls:(Q.result.toolCalls??[]).map((J)=>({name:b0(J.name),input:a7(J.input),hasInput:J.input!==void 0,output:a7(J.output),hasOutput:J.output!==void 0,error:b0(J.error),durationMs:J.durationMs??0,hasDurationMs:typeof J.durationMs==="number"}))}}}async stopRuntimeSession(X){let Y=this.runtimeHandlers?.stopSession;if(!Y)throw Error("runtime stop handler is not configured");let W=b0(X.sessionId).trim();if(!W)throw Error("sessionId is required");return{applied:(await Y(W)).applied===!0}}async abortRuntimeSession(X){let Y=this.runtimeHandlers?.abortSession;if(!Y)throw Error("runtime abort handler is not configured");let W=b0(X.sessionId).trim();if(!W)throw Error("sessionId is required");return{applied:(await Y(W)).applied===!0}}async runProviderAction(X){let Y=this.runtimeHandlers?.runProviderAction;if(!Y)throw Error("provider action handler is not configured");if(!X.request)throw Error("provider action request is required");let W;if(X.request.listProviders)W={action:"listProviders"};else if(X.request.getProviderModels)W={action:"getProviderModels",providerId:b0(X.request.getProviderModels.providerId)};else if(X.request.addProvider)W={action:"addProvider",providerId:b0(X.request.addProvider.providerId),name:b0(X.request.addProvider.name),baseUrl:b0(X.request.addProvider.baseUrl),apiKey:b0(X.request.addProvider.apiKey)||void 0,headers:X.request.addProvider.headers??void 0,timeoutMs:X.request.addProvider.hasTimeoutMs?X.request.addProvider.timeoutMs:void 0,models:X.request.addProvider.models??void 0,defaultModelId:b0(X.request.addProvider.defaultModelId)||void 0,modelsSourceUrl:b0(X.request.addProvider.modelsSourceUrl)||void 0,capabilities:X.request.addProvider.capabilities};else if(X.request.saveProviderSettings)W={action:"saveProviderSettings",providerId:b0(X.request.saveProviderSettings.providerId),enabled:X.request.saveProviderSettings.hasEnabled?X.request.saveProviderSettings.enabled:void 0,apiKey:X.request.saveProviderSettings.hasApiKey?X.request.saveProviderSettings.apiKey:void 0,baseUrl:X.request.saveProviderSettings.hasBaseUrl?X.request.saveProviderSettings.baseUrl:void 0};else{let F=b0(X.request.clineAccount?.operation);if(F==="fetchMe")W={action:"clineAccount",operation:"fetchMe"};else if(F==="fetchBalance")W={action:"clineAccount",operation:"fetchBalance",userId:b0(X.request.clineAccount?.userId)||void 0};else if(F==="fetchUsageTransactions")W={action:"clineAccount",operation:"fetchUsageTransactions",userId:b0(X.request.clineAccount?.userId)||void 0};else if(F==="fetchPaymentTransactions")W={action:"clineAccount",operation:"fetchPaymentTransactions",userId:b0(X.request.clineAccount?.userId)||void 0};else if(F==="fetchUserOrganizations")W={action:"clineAccount",operation:"fetchUserOrganizations"};else if(F==="fetchOrganizationBalance")W={action:"clineAccount",operation:"fetchOrganizationBalance",organizationId:b0(X.request.clineAccount?.organizationId)};else if(F==="fetchOrganizationUsageTransactions")W={action:"clineAccount",operation:"fetchOrganizationUsageTransactions",organizationId:b0(X.request.clineAccount?.organizationId),memberId:b0(X.request.clineAccount?.memberId)||void 0};else if(F==="fetchFeaturebaseToken")W={action:"clineAccount",operation:"fetchFeaturebaseToken"};else W={action:"clineAccount",operation:"switchAccount",organizationId:X.request.clineAccount?.clearOrganizationId?null:b0(X.request.clineAccount?.organizationId)||void 0}}let z=await Y(W);return{result:a7(z.result)}}async runProviderOAuthLogin(X){let Y=this.runtimeHandlers?.runProviderOAuthLogin;if(!Y)throw Error("provider oauth handler is not configured");let W=b0(X.provider).trim();if(!W)throw Error("provider is required");let z=await Y(W);return{provider:b0(z.provider).trim(),apiKey:b0(z.accessToken)}}startTask(X){let Y=b0(X.sessionId).trim(),W=b0(X.taskId).trim();if(!Y||!W)throw Error("sessionId and taskId are required");let z=`${Y}:${W}`;return this.tasks.set(z,{sessionId:Y,taskId:W,title:b0(X.title).trim()||void 0,status:"running",payload:O9(X.payload)??void 0}),this.eventService.publishEvent({eventId:"",sessionId:Y,taskId:W,eventType:"task.started",payload:O9(X.payload)??{},sourceClientId:""}),{sessionId:Y,taskId:W,status:"running",updated:!0}}completeTask(X){let Y=b0(X.sessionId).trim(),W=b0(X.taskId).trim();if(!Y||!W)throw Error("sessionId and taskId are required");let z=`${Y}:${W}`,F=b0(X.status).trim()||"completed",Q=this.tasks.get(z);if(!Q)return{sessionId:Y,taskId:W,status:F,updated:!1};return Q.status=F,Q.result=O9(X.result)??void 0,this.eventService.publishEvent({eventId:"",sessionId:Y,taskId:W,eventType:"task.completed",payload:O9(X.result)??{},sourceClientId:""}),{sessionId:Y,taskId:W,status:F,updated:!0}}publishEvent(X){return this.eventService.publishEvent(X)}addSubscriber(X){return this.eventService.addSubscriber(X)}removeSubscriber(X){this.eventService.removeSubscriber(X)}requestToolApproval(X){return this.approvalService.requestToolApproval(X)}respondToolApproval(X){return this.approvalService.respondToolApproval(X)}listPendingApprovals(X){return this.approvalService.listPendingApprovals(X)}createSchedule(X){return this.scheduleService.createSchedule(X)}getSchedule(X){return this.scheduleService.getSchedule(X)}listSchedules(X){return this.scheduleService.listSchedules(X)}updateSchedule(X){return this.scheduleService.updateSchedule(X)}deleteSchedule(X){return this.scheduleService.deleteSchedule(X)}pauseSchedule(X){return this.scheduleService.pauseSchedule(X)}resumeSchedule(X){return this.scheduleService.resumeSchedule(X)}triggerScheduleNow(X){return this.scheduleService.triggerScheduleNow(X)}listScheduleExecutions(X){return this.scheduleService.listScheduleExecutions(X)}getScheduleStats(X){return this.scheduleService.getScheduleStats(X)}getActiveScheduledExecutions(X){return this.scheduleService.getActiveScheduledExecutions(X)}getUpcomingScheduledRuns(X){return this.scheduleService.getUpcomingScheduledRuns(X)}broadcastServerEvent(X,Y){this.eventService.broadcastServerEvent(X,Y)}}var mX1=process.env.CLINE_RPC_ADDRESS?.trim()||rV;function OJ0(){return mX1}w6();import{existsSync as gX1,mkdirSync as dX1}from"node:fs";import{join as cX1}from"node:path";w6();function lX1(){return J8()}class _Y{sessionsDirPath;db;constructor(X={}){this.sessionsDirPath=X.sessionsDir??lX1()}init(){this.getRawDb()}ensureSessionsDir(){if(!gX1(this.sessionsDirPath))dX1(this.sessionsDirPath,{recursive:!0});return this.sessionsDirPath}sessionDbPath(){return cX1(this.ensureSessionsDir(),"sessions.db")}getRawDb(){if(this.db)return this.db;let X=yY(this.sessionDbPath());return LK(X,{includeLegacyMigrations:!0}),this.db=X,X}close(){this.db?.close?.(),this.db=void 0}run(X,Y=[]){return this.getRawDb().prepare(X).run(...Y)}queryOne(X,Y=[]){return this.getRawDb().prepare(X).get(...Y)??void 0}queryAll(X,Y=[]){return this.getRawDb().prepare(X).all(...Y)}create(X){let Y=Q9();this.run(`INSERT OR REPLACE INTO sessions (
709
+ ON schedules(enabled, next_run_at);`],NX1=[{table:"sessions",column:"workspace_root",sql:"ALTER TABLE sessions ADD COLUMN workspace_root TEXT;"},{table:"sessions",column:"parent_session_id",sql:"ALTER TABLE sessions ADD COLUMN parent_session_id TEXT;"},{table:"sessions",column:"parent_agent_id",sql:"ALTER TABLE sessions ADD COLUMN parent_agent_id TEXT;"},{table:"sessions",column:"agent_id",sql:"ALTER TABLE sessions ADD COLUMN agent_id TEXT;"},{table:"sessions",column:"conversation_id",sql:"ALTER TABLE sessions ADD COLUMN conversation_id TEXT;"},{table:"sessions",column:"is_subagent",sql:"ALTER TABLE sessions ADD COLUMN is_subagent INTEGER NOT NULL DEFAULT 0;"},{table:"sessions",column:"messages_path",sql:"ALTER TABLE sessions ADD COLUMN messages_path TEXT;"},{table:"sessions",column:"metadata_json",sql:"ALTER TABLE sessions ADD COLUMN metadata_json TEXT;"},{table:"schedules",column:"claim_token",sql:"ALTER TABLE schedules ADD COLUMN claim_token TEXT;"},{table:"schedules",column:"claim_started_at",sql:"ALTER TABLE schedules ADD COLUMN claim_started_at TEXT;"},{table:"schedules",column:"claim_until_at",sql:"ALTER TABLE schedules ADD COLUMN claim_until_at TEXT;"}];function AX1(X,Y){return new Set(X.prepare(`PRAGMA table_info(${Y});`).all().map((W)=>W.name))}function LK(X,Y={}){X.exec("PRAGMA journal_mode = WAL;"),X.exec("PRAGMA busy_timeout = 5000;");for(let F of UX1)X.exec(F);if(!Y.includeLegacyMigrations)return;let W=new Map,z=(F)=>{let Q=W.get(F);if(!Q)Q=AX1(X,F),W.set(F,Q);return Q};for(let F of NX1)if(!z(F.table).has(F.column)){if(X.exec(F.sql),F.column==="workspace_root")X.exec("UPDATE sessions SET workspace_root = cwd WHERE workspace_root IS NULL OR workspace_root = '';")}}w6();var xA=N9(iQ(),1);import{randomUUID as ZJ0}from"node:crypto";import{randomUUID as xX1}from"node:crypto";import{randomUUID as QJ0}from"node:crypto";function WJ0(X){let Y=eQ0(CX1(X)),W=new Set([i7(Y,"proto","rpc.proto"),i7(Y,"..","proto","rpc.proto"),i7(Y,"..","src","proto","rpc.proto"),i7(Y,"..","..","src","proto","rpc.proto"),i7(process.cwd(),"src","proto","rpc.proto"),i7(process.cwd(),"packages","rpc","src","proto","rpc.proto")]),z=process.cwd();while(!0){W.add(i7(z,"packages","rpc","src","proto","rpc.proto"));let F=eQ0(z);if(F===z)break;z=F}for(let F of W)if(EX1(F))return F;throw Error("Unable to resolve rpc.proto path")}var RX1="cline.rpc.v1",GJ0="ClineGateway";function MX1(){return WJ0(import.meta.url)}function LX1(){let X=JJ0.loadSync(MX1(),{keepCase:!1,longs:String,enums:String,defaults:!0,oneofs:!0}),Y=hY.loadPackageDefinition(X).cline?.rpc?.v1?.ClineGateway?.service;if(!Y)throw Error(`Unable to load ${RX1}.${GJ0} from proto`);return Y}function PX1(X){return new(hY.makeGenericClientConstructor(LX1(),GJ0))(X,hY.credentials.createInsecure())}function PK(X){if(X===null||X===void 0)return{nullValue:"NULL_VALUE"};if(typeof X==="string")return{stringValue:X};if(typeof X==="number")return{numberValue:Number.isFinite(X)?X:0};if(typeof X==="boolean")return{boolValue:X};if(Array.isArray(X))return{listValue:{values:X.map((Y)=>PK(Y))}};if(typeof X==="object"){let Y={fields:{}};for(let[W,z]of Object.entries(X))Y.fields??={},Y.fields[W]=PK(z);return{structValue:Y}}return{stringValue:String(X)}}function wK(X){if(!X)return;if(X.nullValue!==void 0)return null;if(X.stringValue!==void 0)return X.stringValue;if(X.numberValue!==void 0)return X.numberValue;if(X.boolValue!==void 0)return X.boolValue;if(X.listValue)return(X.listValue.values??[]).map((Y)=>wK(Y));if(X.structValue){let Y={};for(let[W,z]of Object.entries(X.structValue.fields??{}))Y[W]=wK(z);return Y}return}function r9(X){let Y={};for(let[W,z]of Object.entries(X??{}))Y[W]=PK(z);return{fields:Y}}function O9(X){if(!X?.fields)return;let Y={};for(let[W,z]of Object.entries(X.fields))Y[W]=wK(z);return Y}function a7(X){return PK(X)}function r7(X){return wK(X??void 0)}function wX1(X){return{sessionId:X.sessionId,source:X.source,pid:X.pid,startedAt:X.startedAt,endedAt:X.endedAt??"",exitCode:X.exitCode??0,status:X.status,statusLock:X.statusLock,interactive:X.interactive,provider:X.provider,model:X.model,cwd:X.cwd,workspaceRoot:X.workspaceRoot,teamName:X.teamName??"",enableTools:X.enableTools,enableSpawn:X.enableSpawn,enableTeams:X.enableTeams,parentSessionId:X.parentSessionId??"",parentAgentId:X.parentAgentId??"",agentId:X.agentId??"",conversationId:X.conversationId??"",isSubagent:X.isSubagent,prompt:X.prompt??"",transcriptPath:X.transcriptPath,hookPath:X.hookPath,messagesPath:X.messagesPath??"",updatedAt:X.updatedAt,metadata:r9(X.metadata)}}function XJ0(X){return{sessionId:X.sessionId??"",source:X.source??"",pid:Number(X.pid??0),startedAt:X.startedAt??"",endedAt:X.endedAt?X.endedAt:null,exitCode:typeof X.exitCode==="number"?X.exitCode:null,status:X.status??"running",statusLock:Number(X.statusLock??0),interactive:X.interactive===!0,provider:X.provider??"",model:X.model??"",cwd:X.cwd??"",workspaceRoot:X.workspaceRoot??"",teamName:X.teamName||void 0,enableTools:X.enableTools===!0,enableSpawn:X.enableSpawn===!0,enableTeams:X.enableTeams===!0,parentSessionId:X.parentSessionId||void 0,parentAgentId:X.parentAgentId||void 0,agentId:X.agentId||void 0,conversationId:X.conversationId||void 0,isSubagent:X.isSubagent===!0,prompt:X.prompt||void 0,metadata:O9(X.metadata),transcriptPath:X.transcriptPath??"",hookPath:X.hookPath??"",messagesPath:X.messagesPath||void 0,updatedAt:X.updatedAt??""}}function SX1(X){let Y=X?.trim();if(!Y)return;try{let W=JSON.parse(Y);if(!Array.isArray(W))return;let z=W.map((F)=>typeof F==="string"?F.trim():"").filter((F)=>F.length>0);return z.length>0?z:void 0}catch{return}}function kY(X){return{scheduleId:X.scheduleId??"",name:X.name??"",cronPattern:X.cronPattern??"",prompt:X.prompt??"",provider:X.provider??"",model:X.model??"",mode:X.mode==="plan"?"plan":"act",workspaceRoot:X.workspaceRoot?.trim()||void 0,cwd:X.cwd?.trim()||void 0,systemPrompt:X.systemPrompt?.trim()||void 0,maxIterations:X.hasMaxIterations?X.maxIterations:void 0,timeoutSeconds:X.hasTimeoutSeconds?X.timeoutSeconds:void 0,maxParallel:typeof X.maxParallel==="number"&&X.maxParallel>0?X.maxParallel:1,enabled:X.enabled===!0,createdAt:X.createdAt??"",updatedAt:X.updatedAt??"",lastRunAt:X.lastRunAt?.trim()||void 0,nextRunAt:X.nextRunAt?.trim()||void 0,createdBy:X.createdBy?.trim()||void 0,tags:SX1(X.tagsJson??void 0),metadata:O9(X.metadata)}}function jA(X){return{executionId:X.executionId??"",scheduleId:X.scheduleId??"",sessionId:X.sessionId?.trim()||void 0,triggeredAt:X.triggeredAt??"",startedAt:X.startedAt?.trim()||void 0,endedAt:X.endedAt?.trim()||void 0,status:X.status==="pending"||X.status==="running"||X.status==="success"||X.status==="failed"||X.status==="timeout"||X.status==="aborted"?X.status:"failed",exitCode:X.hasExitCode?X.exitCode:void 0,errorMessage:X.errorMessage?.trim()||void 0,iterations:X.hasIterations?X.iterations:void 0,tokensUsed:X.hasTokensUsed?X.tokensUsed:void 0,costUsd:X.hasCostUsd?X.costUsd:void 0}}class aQ{client;constructor(X){this.client=PX1(X.address)}close(){this.client.close()}async upsertSession(X){await this.unary((Y)=>{let W={session:wX1(X)};this.client.UpsertSession(W,Y)})}async getSession(X){let Y=await this.unary((W)=>{this.client.GetSession({sessionId:X},W)});if(!Y.session)return;return XJ0(Y.session)}async listSessions(X){return((await this.unary((Y)=>{this.client.ListSessions(X,Y)})).sessions??[]).map((Y)=>XJ0(Y))}async updateSession(X){let Y={sessionId:X.sessionId,status:X.status,endedAt:X.endedAt??void 0,setRunning:X.setRunning};if(X.exitCode!==void 0)Y.hasExitCode=!0,Y.exitCode=X.exitCode??0;if(X.prompt!==void 0)Y.hasPrompt=!0,Y.prompt=X.prompt??"";if(X.metadata!==void 0)Y.hasMetadata=!0,Y.metadata=r9(X.metadata??void 0);if(X.parentSessionId!==void 0)Y.hasParentSessionId=!0,Y.parentSessionId=X.parentSessionId??"";if(X.parentAgentId!==void 0)Y.hasParentAgentId=!0,Y.parentAgentId=X.parentAgentId??"";if(X.agentId!==void 0)Y.hasAgentId=!0,Y.agentId=X.agentId??"";if(X.conversationId!==void 0)Y.hasConversationId=!0,Y.conversationId=X.conversationId??"";if(X.expectedStatusLock!==void 0)Y.hasExpectedStatusLock=!0,Y.expectedStatusLock=X.expectedStatusLock;let W=await this.unary((z)=>{this.client.UpdateSession(Y,z)});return{updated:W.updated===!0,statusLock:Number(W.statusLock??0)}}async deleteSession(X,Y=!1){return(await this.unary((W)=>{this.client.DeleteSession({sessionId:X,cascade:Y},W)})).deleted===!0}async enqueueSpawnRequest(X){await this.unary((Y)=>{this.client.EnqueueSpawnRequest(X,Y)})}async claimSpawnRequest(X,Y){let W=(await this.unary((z)=>{let F={rootSessionId:X,parentAgentId:Y};this.client.ClaimSpawnRequest(F,z)})).item?.task?.trim();return W?W:void 0}async startRuntimeSession(X){let Y={sessionId:X.sessionId??"",workspaceRoot:X.workspaceRoot,cwd:X.cwd??"",provider:X.provider,model:X.model,mode:X.mode,apiKey:X.apiKey,systemPrompt:X.systemPrompt??"",maxIterations:X.maxIterations??0,hasMaxIterations:typeof X.maxIterations==="number",enableTools:X.enableTools,enableSpawn:X.enableSpawn,enableTeams:X.enableTeams,autoApproveTools:X.autoApproveTools??!1,hasAutoApproveTools:typeof X.autoApproveTools==="boolean",teamName:X.teamName,missionStepInterval:X.missionStepInterval,missionTimeIntervalMs:X.missionTimeIntervalMs,toolPolicies:Object.fromEntries(Object.entries(X.toolPolicies??{}).map(([F,Q])=>[F,{enabled:Q.enabled!==!1,autoApprove:Q.autoApprove??!1}])),initialMessages:(X.initialMessages??[]).map((F)=>({role:F.role??"",content:a7(F.content)})),logger:X.logger?{enabled:X.logger.enabled??!1,level:X.logger.level??"",destination:X.logger.destination??"",name:X.logger.name??"",bindings:r9(X.logger.bindings)}:void 0},W=await this.unary((F)=>{this.client.StartRuntimeSession({request:Y},F)}),z=W.startResult?{sessionId:W.startResult.sessionId??"",manifestPath:W.startResult.manifestPath??"",transcriptPath:W.startResult.transcriptPath??"",hookPath:W.startResult.hookPath??"",messagesPath:W.startResult.messagesPath??""}:void 0;return{sessionId:W.sessionId??"",startResult:z}}async sendRuntimeSession(X,Y){let W={config:{workspaceRoot:Y.config.workspaceRoot,cwd:Y.config.cwd??"",provider:Y.config.provider,model:Y.config.model,mode:Y.config.mode,apiKey:Y.config.apiKey,systemPrompt:Y.config.systemPrompt??"",maxIterations:Y.config.maxIterations??0,hasMaxIterations:typeof Y.config.maxIterations==="number",enableTools:Y.config.enableTools,enableSpawn:Y.config.enableSpawn,enableTeams:Y.config.enableTeams,autoApproveTools:Y.config.autoApproveTools??!1,hasAutoApproveTools:typeof Y.config.autoApproveTools==="boolean",teamName:Y.config.teamName,missionStepInterval:Y.config.missionStepInterval,missionTimeIntervalMs:Y.config.missionTimeIntervalMs,toolPolicies:Object.fromEntries(Object.entries(Y.config.toolPolicies??{}).map(([F,Q])=>[F,{enabled:Q.enabled!==!1,autoApprove:Q.autoApprove??!1}])),initialMessages:(Y.config.initialMessages??[]).map((F)=>({role:F.role??"",content:a7(F.content)})),logger:Y.config.logger?{enabled:Y.config.logger.enabled??!1,level:Y.config.logger.level??"",destination:Y.config.logger.destination??"",name:Y.config.logger.name??"",bindings:r9(Y.config.logger.bindings)}:void 0},messages:(Y.messages??[]).map((F)=>({role:F.role??"",content:a7(F.content)})),prompt:Y.prompt,delivery:Y.delivery,attachments:Y.attachments?{userImages:Y.attachments.userImages??[],userFiles:(Y.attachments.userFiles??[]).map((F)=>({name:F.name,content:F.content}))}:void 0},z=await this.unary((F)=>{this.client.SendRuntimeSession({sessionId:X,request:W},F)});if(!z.result)return{queued:!0};return{result:{text:z.result.text??"",usage:{inputTokens:Number(z.result.usage?.inputTokens??0),outputTokens:Number(z.result.usage?.outputTokens??0),cacheReadTokens:z.result.usage?.hasCacheReadTokens?Number(z.result.usage?.cacheReadTokens??0):void 0,cacheWriteTokens:z.result.usage?.hasCacheWriteTokens?Number(z.result.usage?.cacheWriteTokens??0):void 0,totalCost:z.result.usage?.hasTotalCost?Number(z.result.usage?.totalCost??0):void 0},inputTokens:Number(z.result.inputTokens??0),outputTokens:Number(z.result.outputTokens??0),iterations:Number(z.result.iterations??0),finishReason:z.result.finishReason??"",messages:(z.result.messages??[]).map((F)=>({role:F.role??"",content:r7(F.content)})),toolCalls:(z.result.toolCalls??[]).map((F)=>({name:F.name??"",input:F.hasInput?r7(F.input):void 0,output:F.hasOutput?r7(F.output):void 0,error:F.error?.trim()||void 0,durationMs:F.hasDurationMs?Number(F.durationMs??0):void 0}))},queued:!1}}async abortRuntimeSession(X){return{applied:(await this.unary((Y)=>{this.client.AbortRuntimeSession({sessionId:X},Y)})).applied===!0}}async requestToolApproval(X){let Y={approvalId:X.approvalId,sessionId:X.sessionId,taskId:X.taskId,toolCallId:X.toolCallId,toolName:X.toolName,inputJson:X.inputJson,requesterClientId:X.requesterClientId,timeoutMs:X.timeoutMs},W=await this.unary((z)=>{this.client.RequestToolApproval(Y,z)});return{approvalId:W.approvalId??"",decided:W.decided===!0,approved:W.approved===!0,reason:W.reason??""}}async respondToolApproval(X){let Y={approvalId:X.approvalId,approved:X.approved,reason:X.reason,responderClientId:X.responderClientId},W=await this.unary((z)=>{this.client.RespondToolApproval(Y,z)});return{approvalId:W.approvalId??"",applied:W.applied===!0}}async listPendingApprovals(X){return((await this.unary((Y)=>{this.client.ListPendingApprovals({sessionId:X},Y)})).approvals??[]).map((Y)=>({approvalId:Y.approvalId??"",sessionId:Y.sessionId??"",taskId:Y.taskId??"",toolCallId:Y.toolCallId??"",toolName:Y.toolName??"",inputJson:Y.inputJson??"",requesterClientId:Y.requesterClientId??"",createdAt:Y.createdAt??""}))}async createSchedule(X){let Y=await this.unary((W)=>{this.client.CreateSchedule({name:X.name,cronPattern:X.cronPattern,prompt:X.prompt,provider:X.provider,model:X.model,mode:X.mode??"act",workspaceRoot:X.workspaceRoot,cwd:X.cwd,systemPrompt:X.systemPrompt,maxIterations:X.maxIterations??0,hasMaxIterations:typeof X.maxIterations==="number",timeoutSeconds:X.timeoutSeconds??0,hasTimeoutSeconds:typeof X.timeoutSeconds==="number",maxParallel:X.maxParallel??1,enabled:X.enabled??!0,createdBy:X.createdBy,tagsJson:X.tags?JSON.stringify(X.tags):"",metadata:r9(X.metadata)},W)});return Y.schedule?kY(Y.schedule):void 0}async getSchedule(X){let Y=await this.unary((W)=>{this.client.GetSchedule({scheduleId:X},W)});return Y.schedule?kY(Y.schedule):void 0}async listSchedules(X){return((await this.unary((Y)=>{this.client.ListSchedules({limit:X?.limit??100,hasEnabled:typeof X?.enabled==="boolean",enabled:X?.enabled??!1,tagsJson:X?.tags?JSON.stringify(X.tags):""},Y)})).schedules??[]).map((Y)=>kY(Y))}async updateSchedule(X,Y){let W={scheduleId:X};if(Y.name!==void 0)W.hasName=!0,W.name=Y.name;if(Y.cronPattern!==void 0)W.hasCronPattern=!0,W.cronPattern=Y.cronPattern;if(Y.prompt!==void 0)W.hasPrompt=!0,W.prompt=Y.prompt;if(Y.provider!==void 0)W.hasProvider=!0,W.provider=Y.provider;if(Y.model!==void 0)W.hasModel=!0,W.model=Y.model;if(Y.mode!==void 0)W.hasMode=!0,W.mode=Y.mode;if(Y.workspaceRoot!==void 0)W.hasWorkspaceRoot=!0,W.workspaceRoot=Y.workspaceRoot;if(Y.cwd!==void 0)W.hasCwd=!0,W.cwd=Y.cwd;if(Y.systemPrompt!==void 0)W.hasSystemPrompt=!0,W.systemPrompt=Y.systemPrompt;if(Y.maxIterations===null)W.clearMaxIterations=!0;else if(Y.maxIterations!==void 0)W.hasMaxIterations=!0,W.maxIterations=Y.maxIterations;if(Y.timeoutSeconds===null)W.clearTimeoutSeconds=!0;else if(Y.timeoutSeconds!==void 0)W.hasTimeoutSeconds=!0,W.timeoutSeconds=Y.timeoutSeconds;if(Y.maxParallel!==void 0)W.hasMaxParallel=!0,W.maxParallel=Y.maxParallel;if(Y.enabled!==void 0)W.hasEnabled=!0,W.enabled=Y.enabled;if(Y.createdBy===null)W.clearCreatedBy=!0;else if(Y.createdBy!==void 0)W.hasCreatedBy=!0,W.createdBy=Y.createdBy;if(Y.tags!==void 0)W.hasTagsJson=!0,W.tagsJson=JSON.stringify(Y.tags);if(Y.metadata!==void 0)W.hasMetadata=!0,W.metadata=r9(Y.metadata);let z=await this.unary((F)=>{this.client.UpdateSchedule(W,F)});return z.schedule?kY(z.schedule):void 0}async deleteSchedule(X){return(await this.unary((Y)=>{this.client.DeleteSchedule({scheduleId:X},Y)})).deleted===!0}async pauseSchedule(X){let Y=await this.unary((W)=>{this.client.PauseSchedule({scheduleId:X},W)});return Y.schedule?kY(Y.schedule):void 0}async resumeSchedule(X){let Y=await this.unary((W)=>{this.client.ResumeSchedule({scheduleId:X},W)});return Y.schedule?kY(Y.schedule):void 0}async triggerScheduleNow(X){let Y=await this.unary((W)=>{this.client.TriggerScheduleNow({scheduleId:X},W)});return Y.execution?jA(Y.execution):void 0}async listScheduleExecutions(X){return((await this.unary((Y)=>{this.client.ListScheduleExecutions({scheduleId:X.scheduleId,status:X.status,limit:X.limit??50},Y)})).executions??[]).map((Y)=>jA(Y))}async getScheduleStats(X){let Y=await this.unary((W)=>{this.client.GetScheduleStats({scheduleId:X},W)});return{totalRuns:Number(Y.totalRuns??0),successRate:Number(Y.successRate??0),avgDurationSeconds:Number(Y.avgDurationSeconds??0),lastFailure:Y.lastFailure?jA(Y.lastFailure):void 0}}async getActiveScheduledExecutions(){return((await this.unary((X)=>{this.client.GetActiveScheduledExecutions({},X)})).executions??[]).map((X)=>({executionId:X.executionId??"",scheduleId:X.scheduleId??"",sessionId:X.sessionId??"",startedAt:X.startedAt??"",timeoutAt:X.timeoutAt?.trim()||void 0}))}async getUpcomingScheduledRuns(X=20){return((await this.unary((Y)=>{this.client.GetUpcomingScheduledRuns({limit:X},Y)})).runs??[]).map((Y)=>({scheduleId:Y.scheduleId??"",name:Y.name??"",nextRunAt:Y.nextRunAt??""}))}async stopRuntimeSession(X){return{applied:(await this.unary((Y)=>{this.client.StopRuntimeSession({sessionId:X},Y)})).applied===!0}}async runProviderAction(X){let Y=X.action==="listProviders"?{listProviders:{}}:X.action==="getProviderModels"?{getProviderModels:{providerId:X.providerId}}:X.action==="addProvider"?{addProvider:{providerId:X.providerId,name:X.name,baseUrl:X.baseUrl,apiKey:X.apiKey??"",headers:X.headers??{},timeoutMs:X.timeoutMs??0,hasTimeoutMs:typeof X.timeoutMs==="number",models:X.models??[],defaultModelId:X.defaultModelId??"",modelsSourceUrl:X.modelsSourceUrl??"",capabilities:X.capabilities??[]}}:X.action==="saveProviderSettings"?{saveProviderSettings:{providerId:X.providerId,enabled:X.enabled??!1,hasEnabled:typeof X.enabled==="boolean",apiKey:X.apiKey??"",hasApiKey:X.apiKey!==void 0,baseUrl:X.baseUrl??"",hasBaseUrl:X.baseUrl!==void 0}}:{clineAccount:{operation:X.operation,userId:"userId"in X?X.userId??"":"",organizationId:"organizationId"in X?X.organizationId??"":"",memberId:"memberId"in X?X.memberId??"":"",clearOrganizationId:"organizationId"in X&&X.organizationId===null}},W=await this.unary((z)=>{this.client.RunProviderAction({request:Y},z)});return{result:r7(W.result)}}async runProviderOAuthLogin(X){let Y=await this.unary((W)=>{this.client.RunProviderOAuthLogin({provider:X},W)});return{provider:Y.provider??"",accessToken:Y.apiKey??""}}async publishEvent(X){let Y=await this.unary((W)=>{this.client.PublishEvent({eventId:X.eventId,sessionId:X.sessionId,taskId:X.taskId,eventType:X.eventType,payload:r9(X.payload),sourceClientId:X.sourceClientId},W)});return{eventId:Y.eventId??"",accepted:Y.accepted===!0}}streamEvents(X,Y={}){let W=!1,z=this.client.StreamEvents({clientId:X.clientId??"",sessionIds:X.sessionIds??[]}),F=(Z)=>{Y.onEvent?.({eventId:Z.eventId??"",sessionId:Z.sessionId??"",taskId:Z.taskId?.trim()?Z.taskId:void 0,eventType:Z.eventType??"",payload:O9(Z.payload)??{},sourceClientId:Z.sourceClientId?.trim()?Z.sourceClientId:void 0,ts:Z.ts??""})},Q=(Z)=>{let K=(typeof Z.code==="number"?Number(Z.code):void 0)===1||Z.message.includes("CANCELLED");if(W&&K)return;Y.onError?.(Z)},J=()=>{Y.onEnd?.()};return z.on("data",F),z.on("error",Q),z.on("end",J),()=>{W=!0,z.cancel()}}streamTeamProgress(X,Y={}){return this.streamEvents(X,{onEvent:(W)=>{if(W.eventType===V3){try{let z=W.payload;if(z.type==="team_progress_projection"&&z.version===1)Y.onProjection?.(z)}catch{}return}if(W.eventType===B3)try{Y.onLifecycle?.(W.payload)}catch{}},onError:Y.onError,onEnd:Y.onEnd})}async unary(X){return await new Promise((Y,W)=>{X((z,F)=>{if(z){W(z);return}Y(F??{})})})}}var fX1="cline.rpc.v1",zJ0="ClineGateway";function yX1(){return WJ0(import.meta.url)}function kX1(){let X=FJ0.loadSync(yX1(),{keepCase:!1,longs:String,enums:String,defaults:!0,oneofs:!0}),Y=KJ0.loadPackageDefinition(X).cline?.rpc?.v1?.ClineGateway?.service;if(!Y)throw Error(`Unable to load ${fX1}.${zJ0} from proto`);return Y}function jY(){return new Date().toISOString()}function b0(X){return typeof X==="string"?X:""}function vX1(X){if(!X||typeof X!=="object")return{};let Y={};for(let[W,z]of Object.entries(X)){let F=W.trim();if(!F)continue;let Q=b0(z).trim();if(!Q)continue;Y[F]=Q}return Y}function jX1(X){if(!Array.isArray(X)||X.length===0)return;let Y=new Set;for(let W of X){let z=W.trim();if(z)Y.add(z)}return Y.size>0?Y:void 0}function qJ0(X){if(X==="running"||X==="completed"||X==="failed"||X==="cancelled")return X;return"running"}function YJ0(X){return{sessionId:X.sessionId,source:X.source,pid:X.pid,startedAt:X.startedAt,endedAt:X.endedAt??"",exitCode:X.exitCode??0,status:X.status,statusLock:X.statusLock,interactive:X.interactive,provider:X.provider,model:X.model,cwd:X.cwd,workspaceRoot:X.workspaceRoot,teamName:X.teamName??"",enableTools:X.enableTools,enableSpawn:X.enableSpawn,enableTeams:X.enableTeams,parentSessionId:X.parentSessionId??"",parentAgentId:X.parentAgentId??"",agentId:X.agentId??"",conversationId:X.conversationId??"",isSubagent:X.isSubagent,prompt:X.prompt??"",transcriptPath:X.transcriptPath,hookPath:X.hookPath,messagesPath:X.messagesPath??"",updatedAt:X.updatedAt,metadata:r9(X.metadata)}}function hX1(X){let Y=b0(X.sessionId).trim(),W=b0(X.source).trim(),z=b0(X.startedAt).trim(),F=b0(X.provider).trim(),Q=b0(X.model).trim(),J=b0(X.cwd).trim(),Z=b0(X.workspaceRoot).trim(),K=b0(X.transcriptPath).trim(),H=b0(X.hookPath).trim();if(!Y||!W||!z||!F||!Q||!J||!Z||!K||!H)throw Error("session record is missing required fields");return{sessionId:Y,source:W,pid:Number(X.pid??0),startedAt:z,endedAt:b0(X.endedAt).trim()||null,exitCode:typeof X.exitCode==="number"?Math.floor(X.exitCode):null,status:qJ0(b0(X.status).trim()),statusLock:typeof X.statusLock==="number"?Math.floor(X.statusLock):0,interactive:X.interactive===!0,provider:F,model:Q,cwd:J,workspaceRoot:Z,teamName:b0(X.teamName).trim()||void 0,enableTools:X.enableTools===!0,enableSpawn:X.enableSpawn===!0,enableTeams:X.enableTeams===!0,parentSessionId:b0(X.parentSessionId).trim()||void 0,parentAgentId:b0(X.parentAgentId).trim()||void 0,agentId:b0(X.agentId).trim()||void 0,conversationId:b0(X.conversationId).trim()||void 0,isSubagent:X.isSubagent===!0,prompt:b0(X.prompt).trim()||void 0,metadata:O9(X.metadata),transcriptPath:K,hookPath:H,messagesPath:b0(X.messagesPath).trim()||void 0,updatedAt:b0(X.updatedAt).trim()||jY()}}function hA(X){let Y=b0(X).trim();if(!Y)return;try{let W=JSON.parse(Y);if(!Array.isArray(W))return;let z=W.map((F)=>typeof F==="string"?F.trim():"").filter((F)=>F.length>0);return z.length>0?z:void 0}catch{return}}function vY(X){return{scheduleId:X.scheduleId,name:X.name,cronPattern:X.cronPattern,prompt:X.prompt,provider:X.provider,model:X.model,mode:X.mode,workspaceRoot:X.workspaceRoot??"",cwd:X.cwd??"",systemPrompt:X.systemPrompt??"",maxIterations:X.maxIterations??0,hasMaxIterations:typeof X.maxIterations==="number",timeoutSeconds:X.timeoutSeconds??0,hasTimeoutSeconds:typeof X.timeoutSeconds==="number",maxParallel:X.maxParallel,enabled:X.enabled,createdAt:X.createdAt,updatedAt:X.updatedAt,lastRunAt:X.lastRunAt??"",nextRunAt:X.nextRunAt??"",createdBy:X.createdBy??"",tagsJson:X.tags?JSON.stringify(X.tags):"",metadata:r9(X.metadata)}}function _A(X){return{executionId:X.executionId,scheduleId:X.scheduleId,sessionId:X.sessionId??"",triggeredAt:X.triggeredAt,startedAt:X.startedAt??"",endedAt:X.endedAt??"",status:X.status,exitCode:X.exitCode??0,hasExitCode:typeof X.exitCode==="number",errorMessage:X.errorMessage??"",iterations:X.iterations??0,hasIterations:typeof X.iterations==="number",tokensUsed:X.tokensUsed??0,hasTokensUsed:typeof X.tokensUsed==="number",costUsd:X.costUsd??0,hasCostUsd:typeof X.costUsd==="number"}}function HJ0(X){return new(SK.makeGenericClientConstructor(kX1(),zJ0))(X,SK.credentials.createInsecure())}async function a4(X){return await new Promise((Y)=>{let W;try{W=HJ0(X)}catch{Y(void 0);return}W.Health({},(z,F)=>{if(W?.close(),z||!F){Y(void 0);return}Y(F)})})}async function VJ0(X){return await new Promise((Y)=>{let W;try{W=HJ0(X)}catch{Y(void 0);return}W.Shutdown({},(z,F)=>{if(W?.close(),z||!F){Y(void 0);return}Y(F)})})}var _X1="0.0.28",rQ="1",BJ0=_X1,bX1=300000;class UJ0{publishEvent;approvals=new Map;constructor(X){this.publishEvent=X}async requestToolApproval(X){let Y=b0(X.sessionId).trim(),W=b0(X.toolCallId).trim(),z=b0(X.toolName).trim();if(!Y||!W||!z)throw Error("sessionId, toolCallId, and toolName are required");let F=b0(X.approvalId).trim()||`apr_${xX1()}`;if(!this.approvals.get(F)){let K={approvalId:F,sessionId:Y,taskId:b0(X.taskId).trim()||void 0,toolCallId:W,toolName:z,inputJson:b0(X.inputJson),requesterClientId:b0(X.requesterClientId).trim()||void 0,createdAt:jY(),status:"pending",waiters:[]};this.approvals.set(F,K),this.publishEvent({eventId:"",sessionId:Y,taskId:K.taskId,eventType:"approval.requested",payload:r9(K),sourceClientId:K.requesterClientId})}let Q=this.approvals.get(F);if(!Q)throw Error("approval state not found");if(Q.status==="approved"||Q.status==="rejected")return{approvalId:F,decided:!0,approved:Q.status==="approved",reason:Q.reason??""};let J=typeof X.timeoutMs==="number"&&X.timeoutMs>0?Math.floor(X.timeoutMs):bX1,Z=await new Promise((K)=>{let H=setTimeout(()=>{K({decided:!1,approved:!1,reason:"Tool approval request timed out"})},J);Q.waiters.push((G)=>{clearTimeout(H),K(G)})});return{approvalId:F,decided:Z.decided,approved:Z.approved,reason:Z.reason??""}}respondToolApproval(X){let Y=b0(X.approvalId).trim();if(!Y)throw Error("approvalId is required");let W=this.approvals.get(Y);if(!W)return{approvalId:Y,applied:!1};W.status=X.approved===!0?"approved":"rejected",W.reason=b0(X.reason).trim()||void 0;let z={decided:!0,approved:W.status==="approved",reason:W.reason};for(let F of W.waiters.splice(0))F(z);return this.publishEvent({eventId:"",sessionId:W.sessionId,taskId:W.taskId,eventType:"approval.decided",payload:r9({approvalId:Y,approved:z.approved,reason:z.reason??"",responderClientId:b0(X.responderClientId).trim()||""}),sourceClientId:b0(X.responderClientId).trim()||""}),{approvalId:Y,applied:!0}}listPendingApprovals(X){let Y=b0(X.sessionId).trim(),W=[];for(let z of this.approvals.values()){if(z.status!=="pending")continue;if(Y&&z.sessionId!==Y)continue;W.push({approvalId:z.approvalId,sessionId:z.sessionId,taskId:z.taskId??"",toolCallId:z.toolCallId,toolName:z.toolName,inputJson:z.inputJson,requesterClientId:z.requesterClientId??"",createdAt:z.createdAt})}return W.sort((z,F)=>(z.createdAt??"").localeCompare(F.createdAt??"")),{approvals:W}}}class NJ0{subscribers=new Map;nextSubscriberId=1;publishEvent(X){let Y=b0(X.sessionId).trim();if(!Y)throw Error("sessionId is required");let W={eventId:b0(X.eventId).trim()||`evt_${QJ0()}`,sessionId:Y,taskId:b0(X.taskId).trim()||void 0,eventType:b0(X.eventType).trim()||"unknown",payload:O9(X.payload)??{},sourceClientId:b0(X.sourceClientId).trim()||void 0,ts:jY()};return this.dispatchEvent(W),{eventId:W.eventId,accepted:!0}}addSubscriber(X){let Y=X.request,W=jX1(Y.sessionIds),z=this.nextSubscriberId;return this.nextSubscriberId+=1,this.subscribers.set(z,{call:X,filterSessionIds:W}),X.on("cancelled",()=>{this.subscribers.delete(z)}),X.on("close",()=>{this.subscribers.delete(z)}),z}removeSubscriber(X){this.subscribers.delete(X)}broadcastServerEvent(X,Y){let W=`evt_${QJ0()}`,z=jY();for(let F of this.subscribers.values())F.call.write({eventId:W,sessionId:"__rpc__",taskId:"",eventType:X,payload:r9(Y),sourceClientId:"rpc-server",ts:z})}dispatchEvent(X){for(let Y of this.subscribers.values()){if(Y.filterSessionIds&&!Y.filterSessionIds.has(X.sessionId))continue;Y.call.write({eventId:X.eventId,sessionId:X.sessionId,taskId:X.taskId??"",eventType:X.eventType,payload:r9(X.payload),sourceClientId:X.sourceClientId??"",ts:X.ts})}}}class AJ0{scheduler;constructor(X){this.scheduler=X}createSchedule(X){let Y=this.requireScheduler(),W={name:b0(X.name).trim(),cronPattern:b0(X.cronPattern).trim(),prompt:b0(X.prompt),provider:b0(X.provider).trim(),model:b0(X.model).trim(),mode:b0(X.mode).trim()==="plan"?"plan":"act",workspaceRoot:b0(X.workspaceRoot).trim()||void 0,cwd:b0(X.cwd).trim()||void 0,systemPrompt:b0(X.systemPrompt)||void 0,maxIterations:X.hasMaxIterations?Math.floor(X.maxIterations??0):void 0,timeoutSeconds:X.hasTimeoutSeconds?Math.floor(X.timeoutSeconds??0):void 0,maxParallel:typeof X.maxParallel==="number"&&X.maxParallel>0?Math.floor(X.maxParallel):1,enabled:X.enabled!==!1,createdBy:b0(X.createdBy).trim()||void 0,tags:hA(b0(X.tagsJson)),metadata:O9(X.metadata)};if(!W.name||!W.cronPattern||!W.prompt.trim()||!W.provider||!W.model)throw Error("name, cronPattern, prompt, provider, and model are required");let z=Y.createSchedule(W);return{schedule:vY(z)}}getSchedule(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim();if(!W)throw Error("scheduleId is required");let z=Y.getSchedule(W);return z?{schedule:vY(z)}:{}}listSchedules(X){return{schedules:this.requireScheduler().listSchedules({enabled:X.hasEnabled?X.enabled===!0:void 0,limit:typeof X.limit==="number"&&X.limit>0?Math.floor(X.limit):void 0,tags:hA(b0(X.tagsJson))}).map((Y)=>vY(Y))}}updateSchedule(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim();if(!W)throw Error("scheduleId is required");let z={};if(X.hasName)z.name=b0(X.name);if(X.hasCronPattern)z.cronPattern=b0(X.cronPattern);if(X.hasPrompt)z.prompt=b0(X.prompt);if(X.hasProvider)z.provider=b0(X.provider);if(X.hasModel)z.model=b0(X.model);if(X.hasMode)z.mode=b0(X.mode).trim()==="plan"?"plan":"act";if(X.hasWorkspaceRoot)z.workspaceRoot=b0(X.workspaceRoot);if(X.hasCwd)z.cwd=b0(X.cwd);if(X.hasSystemPrompt)z.systemPrompt=b0(X.systemPrompt);if(X.clearMaxIterations)z.maxIterations=null;else if(X.hasMaxIterations)z.maxIterations=Math.floor(X.maxIterations??0);if(X.clearTimeoutSeconds)z.timeoutSeconds=null;else if(X.hasTimeoutSeconds)z.timeoutSeconds=Math.floor(X.timeoutSeconds??0);if(X.hasMaxParallel)z.maxParallel=Math.floor(X.maxParallel??1);if(X.hasEnabled)z.enabled=X.enabled===!0;if(X.clearCreatedBy)z.createdBy=null;else if(X.hasCreatedBy)z.createdBy=b0(X.createdBy);if(X.hasTagsJson)z.tags=hA(b0(X.tagsJson))??[];if(X.hasMetadata)z.metadata=O9(X.metadata)??{};let F=Y.updateSchedule(W,z);return{updated:F!==void 0,schedule:F?vY(F):void 0}}deleteSchedule(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim();if(!W)throw Error("scheduleId is required");return{deleted:Y.deleteSchedule(W)}}pauseSchedule(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim();if(!W)throw Error("scheduleId is required");let z=Y.pauseSchedule(W);return{updated:z!==void 0,schedule:z?vY(z):void 0}}resumeSchedule(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim();if(!W)throw Error("scheduleId is required");let z=Y.resumeSchedule(W);return{updated:z!==void 0,schedule:z?vY(z):void 0}}async triggerScheduleNow(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim();if(!W)throw Error("scheduleId is required");let z=await Y.triggerScheduleNow(W);return z?{execution:_A(z)}:{}}listScheduleExecutions(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim()||void 0,z=b0(X.status).trim()||void 0;return{executions:Y.listScheduleExecutions({scheduleId:W,status:z==="pending"||z==="running"||z==="success"||z==="failed"||z==="timeout"||z==="aborted"?z:void 0,limit:typeof X.limit==="number"&&X.limit>0?Math.floor(X.limit):void 0}).map((F)=>_A(F))}}getScheduleStats(X){let Y=this.requireScheduler(),W=b0(X.scheduleId).trim();if(!W)throw Error("scheduleId is required");let z=Y.getScheduleStats(W);return{totalRuns:z.totalRuns,successRate:z.successRate,avgDurationSeconds:z.avgDurationSeconds,lastFailure:z.lastFailure?_A(z.lastFailure):void 0}}getActiveScheduledExecutions(X){return{executions:this.requireScheduler().getActiveExecutions().map((Y)=>({executionId:Y.executionId,scheduleId:Y.scheduleId,sessionId:Y.sessionId,startedAt:Y.startedAt,timeoutAt:Y.timeoutAt??""}))}}getUpcomingScheduledRuns(X){let Y=this.requireScheduler(),W=typeof X.limit==="number"&&X.limit>0?Math.floor(X.limit):20;return{runs:Y.getUpcomingRuns(W).map((z)=>({scheduleId:z.scheduleId,name:z.name,nextRunAt:z.nextRunAt}))}}requireScheduler(){if(!this.scheduler)throw Error("scheduler service is not configured");return this.scheduler}}class uX1{serverId=ZJ0();address;startedAt;runtimeHandlers;sessions=new Map;tasks=new Map;clients=new Map;store;eventService=new NJ0;approvalService=new UJ0((X)=>this.eventService.publishEvent(X));scheduleService;constructor(X,Y,W,z){this.address=X,this.startedAt=jY(),this.store=Y,this.runtimeHandlers=W,this.scheduleService=new AJ0(z),this.store.init()}health(){return{serverId:this.serverId,address:this.address,running:!0,startedAt:this.startedAt,rpcVersion:rQ}}registerClient(X){let Y=b0(X.clientId).trim()||`client_${ZJ0()}`,W=b0(X.clientType).trim()||void 0,z=vX1(X),F=jY(),Q=this.clients.get(Y),J=Q?{...Q,clientType:W??Q.clientType,metadata:Object.keys(z).length>0?{...Q.metadata??{},...z}:Q.metadata,lastRegisteredAt:F,activationCount:Q.activationCount+1}:{clientId:Y,clientType:W,metadata:Object.keys(z).length>0?z:void 0,firstRegisteredAt:F,lastRegisteredAt:F,activationCount:1};return this.clients.set(Y,J),this.broadcastServerEvent("rpc.client.activated",{clientId:J.clientId,clientType:J.clientType,metadata:J.metadata??{},firstRegisteredAt:J.firstRegisteredAt,lastRegisteredAt:J.lastRegisteredAt,activationCount:J.activationCount}),{clientId:Y,registered:!0}}ensureSession(X){let Y=b0(X.sessionId).trim();if(!Y)throw Error("sessionId is required");let W=this.sessions.get(Y);if(W)return W.status=b0(X.status).trim()||W.status,W.workspaceRoot=b0(X.workspaceRoot).trim()||W.workspaceRoot,W.clientId=b0(X.clientId).trim()||W.clientId,W.metadata=O9(X.metadata)??W.metadata,{sessionId:Y,created:!1,status:W.status};let z=b0(X.status).trim()||"running";return this.sessions.set(Y,{sessionId:Y,status:z,workspaceRoot:b0(X.workspaceRoot).trim()||void 0,clientId:b0(X.clientId).trim()||void 0,metadata:O9(X.metadata)}),{sessionId:Y,created:!0,status:z}}upsertSession(X){if(!X.session)throw Error("session is required");return this.store.upsertSession(hX1(X.session)),{persisted:!0}}getSession(X){let Y=b0(X.sessionId).trim();if(!Y)throw Error("sessionId is required");let W=this.store.getSession(Y);if(!W)return{};return{session:YJ0(W)}}listSessions(X){let Y=typeof X.limit==="number"&&X.limit>0?Math.floor(X.limit):200;return{sessions:this.store.listSessions({limit:Y,parentSessionId:b0(X.parentSessionId).trim()||void 0,status:b0(X.status).trim()||void 0}).map((W)=>YJ0(W))}}updateSession(X){let Y=b0(X.sessionId).trim();if(!Y)throw Error("sessionId is required");return this.store.updateSession({sessionId:Y,status:X.status?qJ0(X.status):void 0,endedAt:X.endedAt?X.endedAt:void 0,exitCode:X.hasExitCode?X.exitCode??null:void 0,prompt:X.hasPrompt?X.prompt??null:void 0,metadata:X.hasMetadata?O9(X.metadata)??null:void 0,parentSessionId:X.hasParentSessionId?X.parentSessionId??null:void 0,parentAgentId:X.hasParentAgentId?X.parentAgentId??null:void 0,agentId:X.hasAgentId?X.agentId??null:void 0,conversationId:X.hasConversationId?X.conversationId??null:void 0,expectedStatusLock:X.hasExpectedStatusLock?X.expectedStatusLock:void 0,setRunning:X.setRunning===!0})}deleteSession(X){let Y=b0(X.sessionId).trim();if(!Y)throw Error("sessionId is required");let W=this.store.deleteSession(Y);if(X.cascade===!0)this.store.deleteSessionsByParent(Y);return{deleted:W}}enqueueSpawnRequest(X){let Y=b0(X.rootSessionId).trim(),W=b0(X.parentAgentId).trim();if(!Y||!W)throw Error("rootSessionId and parentAgentId are required");return this.store.enqueueSpawnRequest({rootSessionId:Y,parentAgentId:W,task:b0(X.task).trim()||void 0,systemPrompt:b0(X.systemPrompt).trim()||void 0}),{enqueued:!0}}claimSpawnRequest(X){let Y=b0(X.rootSessionId).trim(),W=b0(X.parentAgentId).trim();if(!Y||!W)throw Error("rootSessionId and parentAgentId are required");let z=this.store.claimSpawnRequest(Y,W);if(!z)return{};return{item:{id:String(z.id),rootSessionId:z.rootSessionId,parentAgentId:z.parentAgentId,task:z.task??"",systemPrompt:z.systemPrompt??"",createdAt:z.createdAt,consumedAt:z.consumedAt??""}}}async startRuntimeSession(X){let Y=this.runtimeHandlers?.startSession;if(!Y)throw Error("runtime start handler is not configured");let W=X.request?{sessionId:b0(X.request.sessionId),workspaceRoot:b0(X.request.workspaceRoot),cwd:b0(X.request.cwd),provider:b0(X.request.provider),model:b0(X.request.model),mode:b0(X.request.mode),apiKey:b0(X.request.apiKey),systemPrompt:b0(X.request.systemPrompt),maxIterations:X.request.hasMaxIterations?X.request.maxIterations:void 0,enableTools:X.request.enableTools===!0,enableSpawn:X.request.enableSpawn===!0,enableTeams:X.request.enableTeams===!0,autoApproveTools:X.request.hasAutoApproveTools?X.request.autoApproveTools===!0:void 0,teamName:b0(X.request.teamName),missionStepInterval:X.request.missionStepInterval??3,missionTimeIntervalMs:X.request.missionTimeIntervalMs??120000,toolPolicies:Object.fromEntries(Object.entries(X.request.toolPolicies??{}).map(([Q,J])=>[Q,{enabled:J?.enabled===!0,autoApprove:J?.autoApprove===!0}])),initialMessages:(X.request.initialMessages??[]).map((Q)=>({role:b0(Q.role),content:r7(Q.content)})),logger:X.request.logger?{enabled:X.request.logger.enabled===!0,level:b0(X.request.logger.level),destination:b0(X.request.logger.destination),name:b0(X.request.logger.name),bindings:O9(X.request.logger.bindings)}:void 0}:void 0;if(!W)throw Error("runtime start request is required");let z=await Y(W),F=b0(z.sessionId).trim();if(!F)throw Error("runtime start handler returned empty sessionId");return{sessionId:F,startResult:z.startResult?{sessionId:b0(z.startResult.sessionId),manifestPath:b0(z.startResult.manifestPath),transcriptPath:b0(z.startResult.transcriptPath),hookPath:b0(z.startResult.hookPath),messagesPath:b0(z.startResult.messagesPath)}:void 0}}async sendRuntimeSession(X){let Y=this.runtimeHandlers?.sendSession;if(!Y)throw Error("runtime send handler is not configured");let W=b0(X.sessionId).trim();if(!W)throw Error("sessionId is required");let z=X.request?.delivery==="queue"||X.request?.delivery==="steer"?X.request.delivery:void 0,F=X.request?{config:{workspaceRoot:b0(X.request.config?.workspaceRoot),cwd:b0(X.request.config?.cwd),provider:b0(X.request.config?.provider),model:b0(X.request.config?.model),mode:b0(X.request.config?.mode),apiKey:b0(X.request.config?.apiKey),systemPrompt:b0(X.request.config?.systemPrompt),maxIterations:X.request.config?.hasMaxIterations?X.request.config?.maxIterations:void 0,enableTools:X.request.config?.enableTools===!0,enableSpawn:X.request.config?.enableSpawn===!0,enableTeams:X.request.config?.enableTeams===!0,autoApproveTools:X.request.config?.hasAutoApproveTools?X.request.config?.autoApproveTools===!0:void 0,teamName:b0(X.request.config?.teamName),missionStepInterval:X.request.config?.missionStepInterval??3,missionTimeIntervalMs:X.request.config?.missionTimeIntervalMs??120000,toolPolicies:Object.fromEntries(Object.entries(X.request.config?.toolPolicies??{}).map(([J,Z])=>[J,{enabled:Z?.enabled===!0,autoApprove:Z?.autoApprove===!0}])),initialMessages:(X.request.config?.initialMessages??[]).map((J)=>({role:b0(J.role),content:r7(J.content)})),logger:X.request.config?.logger?{enabled:X.request.config.logger.enabled===!0,level:b0(X.request.config.logger.level),destination:b0(X.request.config.logger.destination),name:b0(X.request.config.logger.name),bindings:O9(X.request.config.logger.bindings)}:void 0},messages:(X.request.messages??[]).map((J)=>({role:b0(J.role),content:r7(J.content)})),prompt:b0(X.request.prompt),delivery:z,attachments:X.request.attachments?{userImages:X.request.attachments.userImages??[],userFiles:(X.request.attachments.userFiles??[]).map((J)=>({name:b0(J.name),content:b0(J.content)}))}:void 0}:void 0;if(!F)throw Error("runtime send request is required");let Q=await Y(W,F);if(!Q.result)return{};return{result:{text:b0(Q.result.text),usage:{inputTokens:Q.result.usage.inputTokens,outputTokens:Q.result.usage.outputTokens,cacheReadTokens:Q.result.usage.cacheReadTokens??0,hasCacheReadTokens:typeof Q.result.usage.cacheReadTokens==="number",cacheWriteTokens:Q.result.usage.cacheWriteTokens??0,hasCacheWriteTokens:typeof Q.result.usage.cacheWriteTokens==="number",totalCost:Q.result.usage.totalCost??0,hasTotalCost:typeof Q.result.usage.totalCost==="number"},inputTokens:Q.result.inputTokens,outputTokens:Q.result.outputTokens,iterations:Q.result.iterations,finishReason:b0(Q.result.finishReason),messages:(Q.result.messages??[]).map((J)=>({role:b0(J.role),content:a7(J.content)})),toolCalls:(Q.result.toolCalls??[]).map((J)=>({name:b0(J.name),input:a7(J.input),hasInput:J.input!==void 0,output:a7(J.output),hasOutput:J.output!==void 0,error:b0(J.error),durationMs:J.durationMs??0,hasDurationMs:typeof J.durationMs==="number"}))}}}async stopRuntimeSession(X){let Y=this.runtimeHandlers?.stopSession;if(!Y)throw Error("runtime stop handler is not configured");let W=b0(X.sessionId).trim();if(!W)throw Error("sessionId is required");return{applied:(await Y(W)).applied===!0}}async abortRuntimeSession(X){let Y=this.runtimeHandlers?.abortSession;if(!Y)throw Error("runtime abort handler is not configured");let W=b0(X.sessionId).trim();if(!W)throw Error("sessionId is required");return{applied:(await Y(W)).applied===!0}}async runProviderAction(X){let Y=this.runtimeHandlers?.runProviderAction;if(!Y)throw Error("provider action handler is not configured");if(!X.request)throw Error("provider action request is required");let W;if(X.request.listProviders)W={action:"listProviders"};else if(X.request.getProviderModels)W={action:"getProviderModels",providerId:b0(X.request.getProviderModels.providerId)};else if(X.request.addProvider)W={action:"addProvider",providerId:b0(X.request.addProvider.providerId),name:b0(X.request.addProvider.name),baseUrl:b0(X.request.addProvider.baseUrl),apiKey:b0(X.request.addProvider.apiKey)||void 0,headers:X.request.addProvider.headers??void 0,timeoutMs:X.request.addProvider.hasTimeoutMs?X.request.addProvider.timeoutMs:void 0,models:X.request.addProvider.models??void 0,defaultModelId:b0(X.request.addProvider.defaultModelId)||void 0,modelsSourceUrl:b0(X.request.addProvider.modelsSourceUrl)||void 0,capabilities:X.request.addProvider.capabilities};else if(X.request.saveProviderSettings)W={action:"saveProviderSettings",providerId:b0(X.request.saveProviderSettings.providerId),enabled:X.request.saveProviderSettings.hasEnabled?X.request.saveProviderSettings.enabled:void 0,apiKey:X.request.saveProviderSettings.hasApiKey?X.request.saveProviderSettings.apiKey:void 0,baseUrl:X.request.saveProviderSettings.hasBaseUrl?X.request.saveProviderSettings.baseUrl:void 0};else{let F=b0(X.request.clineAccount?.operation);if(F==="fetchMe")W={action:"clineAccount",operation:"fetchMe"};else if(F==="fetchBalance")W={action:"clineAccount",operation:"fetchBalance",userId:b0(X.request.clineAccount?.userId)||void 0};else if(F==="fetchUsageTransactions")W={action:"clineAccount",operation:"fetchUsageTransactions",userId:b0(X.request.clineAccount?.userId)||void 0};else if(F==="fetchPaymentTransactions")W={action:"clineAccount",operation:"fetchPaymentTransactions",userId:b0(X.request.clineAccount?.userId)||void 0};else if(F==="fetchUserOrganizations")W={action:"clineAccount",operation:"fetchUserOrganizations"};else if(F==="fetchOrganizationBalance")W={action:"clineAccount",operation:"fetchOrganizationBalance",organizationId:b0(X.request.clineAccount?.organizationId)};else if(F==="fetchOrganizationUsageTransactions")W={action:"clineAccount",operation:"fetchOrganizationUsageTransactions",organizationId:b0(X.request.clineAccount?.organizationId),memberId:b0(X.request.clineAccount?.memberId)||void 0};else if(F==="fetchFeaturebaseToken")W={action:"clineAccount",operation:"fetchFeaturebaseToken"};else W={action:"clineAccount",operation:"switchAccount",organizationId:X.request.clineAccount?.clearOrganizationId?null:b0(X.request.clineAccount?.organizationId)||void 0}}let z=await Y(W);return{result:a7(z.result)}}async runProviderOAuthLogin(X){let Y=this.runtimeHandlers?.runProviderOAuthLogin;if(!Y)throw Error("provider oauth handler is not configured");let W=b0(X.provider).trim();if(!W)throw Error("provider is required");let z=await Y(W);return{provider:b0(z.provider).trim(),apiKey:b0(z.accessToken)}}startTask(X){let Y=b0(X.sessionId).trim(),W=b0(X.taskId).trim();if(!Y||!W)throw Error("sessionId and taskId are required");let z=`${Y}:${W}`;return this.tasks.set(z,{sessionId:Y,taskId:W,title:b0(X.title).trim()||void 0,status:"running",payload:O9(X.payload)??void 0}),this.eventService.publishEvent({eventId:"",sessionId:Y,taskId:W,eventType:"task.started",payload:O9(X.payload)??{},sourceClientId:""}),{sessionId:Y,taskId:W,status:"running",updated:!0}}completeTask(X){let Y=b0(X.sessionId).trim(),W=b0(X.taskId).trim();if(!Y||!W)throw Error("sessionId and taskId are required");let z=`${Y}:${W}`,F=b0(X.status).trim()||"completed",Q=this.tasks.get(z);if(!Q)return{sessionId:Y,taskId:W,status:F,updated:!1};return Q.status=F,Q.result=O9(X.result)??void 0,this.eventService.publishEvent({eventId:"",sessionId:Y,taskId:W,eventType:"task.completed",payload:O9(X.result)??{},sourceClientId:""}),{sessionId:Y,taskId:W,status:F,updated:!0}}publishEvent(X){return this.eventService.publishEvent(X)}addSubscriber(X){return this.eventService.addSubscriber(X)}removeSubscriber(X){this.eventService.removeSubscriber(X)}requestToolApproval(X){return this.approvalService.requestToolApproval(X)}respondToolApproval(X){return this.approvalService.respondToolApproval(X)}listPendingApprovals(X){return this.approvalService.listPendingApprovals(X)}createSchedule(X){return this.scheduleService.createSchedule(X)}getSchedule(X){return this.scheduleService.getSchedule(X)}listSchedules(X){return this.scheduleService.listSchedules(X)}updateSchedule(X){return this.scheduleService.updateSchedule(X)}deleteSchedule(X){return this.scheduleService.deleteSchedule(X)}pauseSchedule(X){return this.scheduleService.pauseSchedule(X)}resumeSchedule(X){return this.scheduleService.resumeSchedule(X)}triggerScheduleNow(X){return this.scheduleService.triggerScheduleNow(X)}listScheduleExecutions(X){return this.scheduleService.listScheduleExecutions(X)}getScheduleStats(X){return this.scheduleService.getScheduleStats(X)}getActiveScheduledExecutions(X){return this.scheduleService.getActiveScheduledExecutions(X)}getUpcomingScheduledRuns(X){return this.scheduleService.getUpcomingScheduledRuns(X)}broadcastServerEvent(X,Y){this.eventService.broadcastServerEvent(X,Y)}}var mX1=process.env.CLINE_RPC_ADDRESS?.trim()||rV;function OJ0(){return mX1}w6();import{existsSync as gX1,mkdirSync as dX1}from"node:fs";import{join as cX1}from"node:path";w6();function lX1(){return J8()}class _Y{sessionsDirPath;db;constructor(X={}){this.sessionsDirPath=X.sessionsDir??lX1()}init(){this.getRawDb()}ensureSessionsDir(){if(!gX1(this.sessionsDirPath))dX1(this.sessionsDirPath,{recursive:!0});return this.sessionsDirPath}sessionDbPath(){return cX1(this.ensureSessionsDir(),"sessions.db")}getRawDb(){if(this.db)return this.db;let X=yY(this.sessionDbPath());return LK(X,{includeLegacyMigrations:!0}),this.db=X,X}close(){this.db?.close?.(),this.db=void 0}run(X,Y=[]){return this.getRawDb().prepare(X).run(...Y)}queryOne(X,Y=[]){return this.getRawDb().prepare(X).get(...Y)??void 0}queryAll(X,Y=[]){return this.getRawDb().prepare(X).all(...Y)}create(X){let Y=Q9();this.run(`INSERT OR REPLACE INTO sessions (
710
710
  session_id, source, pid, started_at, ended_at, exit_code, status, status_lock, interactive,
711
711
  provider, model, cwd, workspace_root, team_name, enable_tools, enable_spawn, enable_teams,
712
712
  parent_session_id, parent_agent_id, agent_id, conversation_id, is_subagent, prompt,
@@ -852,7 +852,7 @@ ${JSON.stringify(W,null,2)}`}w6();import{appendFileSync as rX1,existsSync as bY,
852
852
  `:"";return`<command-name>${H.name}</command-name>${q}
853
853
  <command-instructions>
854
854
  ${B}${H.instructions}
855
- </command-instructions>`}finally{z.delete(K)}};return Object.defineProperty(F,"configuredSkills",{get:()=>pA(X,W),enumerable:!0,configurable:!1}),F}function BY1(X,Y){if(!X)return;for(let W of X.getTeammateIds())try{X.shutdownTeammate(W,Y)}catch{}}function UY1(X){let Y=X.lastIndexOf(zY1);if(Y<0)return;let W=X.slice(Y).trim();return W.length>0?W:void 0}function NY1(X){return{sessionId:X.sessionId||"",mode:X.mode==="plan"?"plan":"act",enableTools:X.enableTools!==!1,enableSpawnAgent:X.enableSpawnAgent!==!1,enableAgentTeams:X.enableAgentTeams!==!1,missionLogIntervalSteps:typeof X.missionLogIntervalSteps==="number"&&Number.isFinite(X.missionLogIntervalSteps)?X.missionLogIntervalSteps:3,missionLogIntervalMs:typeof X.missionLogIntervalMs==="number"&&Number.isFinite(X.missionLogIntervalMs)?X.missionLogIntervalMs:120000}}class kK{teamRuntimeRegistry=new dA;build(X){let{config:Y,hooks:W,extensions:z,logger:F,telemetry:Q,createSpawnTool:J,onTeamRestored:Z,userInstructionWatcher:K,defaultToolExecutors:H}=X,G=X.onTeamEvent??(()=>{}),q=NY1(Y),B=[],$=Y.teamName?.trim()||wJ0(),R=!1,E=Boolean(K),U=K,A=Promise.resolve(),T;if(!U&&q.enableTools&&PJ0(Y.cwd))U=l3({skills:{workspacePath:Y.cwd},rules:{workspacePath:Y.cwd},workflows:{workspacePath:Y.cwd}}),A=U.start().catch(()=>{});if(q.enableTools&&U&&(E||PJ0(Y.cwd)||pA(U,Y.skills).length>0))T=VY1(U,A,Y.skills);if(q.enableTools)B.push(...MJ0(Y.cwd,Y.providerId,q.mode,Y.modelId,Y.toolRoutingRules,T,H));let I,C=q.enableAgentTeams?CJ0():void 0,M=C?.loadRuntime($),w=M?.state,P=M?.teammates??[],y=new Map(P.map((k)=>[k.agentId,k])),v=Y.sessionId||$,f=KY1({providerId:Y.providerId,modelId:Y.modelId,cwd:Y.cwd,apiKey:Y.apiKey??"",baseUrl:Y.baseUrl,headers:Y.headers,providerConfig:Y.providerConfig,knownModels:Y.knownModels,thinking:Y.thinking,clineWorkspaceMetadata:Y.providerId==="cline"?UY1(Y.systemPrompt):void 0,maxIterations:Y.maxIterations,hooks:W,extensions:z??Y.extensions,logger:F??Y.logger,telemetry:X.telemetry??Y.telemetry}),_=f.getRuntimeConfig();if(Y.providerId==="cline"&&!_.clineWorkspaceMetadata)uA(Y.cwd??"").then((k)=>{let l=f.getRuntimeConfig();if(l.clineWorkspaceMetadata)return;Object.assign(l,{clineWorkspaceMetadata:k})});this.teamRuntimeRegistry.getOrCreate(v,()=>({delegatedAgentConfigProvider:f}));let b=()=>{if(!q.enableAgentTeams)return;let k=this.teamRuntimeRegistry.getOrCreate(v,()=>({delegatedAgentConfigProvider:f}));if(I=k.runtime,!I){if(I=new WY1({teamName:$,leadAgentId:Y.sessionId||"lead",missionLogIntervalSteps:q.missionLogIntervalSteps,missionLogIntervalMs:q.missionLogIntervalMs,onTeamEvent:(l)=>{if(G(l),I&&C){if(l.type==="teammate_spawned"&&l.teammate?.rolePrompt){let Z0={agentId:l.agentId,rolePrompt:l.teammate.rolePrompt,modelId:l.teammate.modelId,maxIterations:l.teammate.maxIterations};y.set(Z0.agentId,Z0)}if(l.type==="teammate_shutdown")y.delete(l.agentId);C.handleTeamEvent($,l),C.persistRuntime($,I.exportState(),Array.from(y.values()))}}}),w)I.hydrateState(w),I.markStaleRunsInterrupted("runtime_recovered");k.runtime=I}if(!R){if(!I)return;R=!0;let l=GY1({runtime:I,leadAgentId:"lead",restoredFromPersistence:Boolean(w),restoredTeammates:P,createBaseTools:q.enableTools?()=>MJ0(Y.cwd,Y.providerId,q.mode,Y.modelId,Y.toolRoutingRules,T,H):void 0,teammateConfigProvider:f});if(l.restoredFromPersistence)Z?.();B.push(...l.tools)}return I};if(q.enableSpawnAgent&&J){let k=J();B.push({...k,execute:async(l,Z0)=>{return b(),k.execute(l,Z0)}})}if(q.enableAgentTeams)b();let x=q.enableAgentTeams?()=>{let k=this.teamRuntimeRegistry.get(v)?.runtime;if(!k)return;let l=k.listTasks(),Z0=l.some((p)=>p.status==="in_progress"||p.status==="pending"),m=k.listRuns({}),h=m.some((p)=>p.status==="running"||p.status==="queued");if(Z0||h){let p=l.filter((c)=>c.status==="in_progress"||c.status==="pending").map((c)=>`${c.id} (${c.status}): ${c.title}`).join(", "),n=m.filter((c)=>c.status==="running"||c.status==="queued").map((c)=>`${c.id} (${c.status})`).join(", "),Q0=[];if(p)Q0.push(`Unfinished tasks: ${p}`);if(n)Q0.push(`Active runs: ${n}`);return`[SYSTEM] You still have team obligations. ${Q0.join(". ")}. Use team_run_task to delegate work, or team_task with action=complete to mark tasks done, or team_await_run / team_await_all_runs to wait for active runs. Do NOT stop until all tasks are completed.`}return}:void 0;return{tools:B,logger:F??Y.logger,telemetry:Q??Y.telemetry,teamRuntime:I,teamRestoredFromPersistence:Boolean(w),delegatedAgentConfigProvider:this.teamRuntimeRegistry.get(v)?.delegatedAgentConfigProvider??f,completionGuard:x,shutdown:(k)=>{if(BY1(I,k),this.teamRuntimeRegistry.delete(v),!E)U?.stop()}}}}w6();import{existsSync as cJ0,mkdirSync as dY1,readFileSync as cY1,writeFileSync as lY1}from"node:fs";import{basename as lJ0,dirname as tA}from"node:path";import{existsSync as AY1,mkdirSync as AM1,readFileSync as OY1,writeFileSync as OM1}from"node:fs";import{mkdir as TY1,readFile as IY1,writeFile as $Y1}from"node:fs/promises";import{dirname as yJ0,join as DY1}from"node:path";import*as kJ0 from"@clinebot/llms/models";var vK=new Set;function EY1(X){return X.split(/[-_]/).filter(Boolean).map((Y)=>Y.charAt(0).toUpperCase()+Y.slice(1)).join(" ")}function o7(X){return DY1(yJ0(X.getFilePath()),"models.json")}function nA(){return{version:1,providers:{}}}function CY1(X){if(!AY1(X))return nA();try{let Y=OY1(X,"utf8"),W=JSON.parse(Y);if(W&&W.version===1&&W.providers&&typeof W.providers==="object")return{version:1,providers:W.providers}}catch{}return nA()}async function mY(X){try{let Y=await IY1(X,"utf8"),W=JSON.parse(Y);if(W&&W.version===1&&W.providers&&typeof W.providers==="object")return{version:1,providers:W.providers}}catch{}return nA()}async function jK(X,Y){await TY1(yJ0(X),{recursive:!0}),await $Y1(X,`${JSON.stringify(Y,null,2)}
855
+ </command-instructions>`}finally{z.delete(K)}};return Object.defineProperty(F,"configuredSkills",{get:()=>pA(X,W),enumerable:!0,configurable:!1}),F}function BY1(X,Y){if(!X)return;for(let W of X.getTeammateIds())try{X.shutdownTeammate(W,Y)}catch{}}function UY1(X){let Y=X.lastIndexOf(zY1);if(Y<0)return;let W=X.slice(Y).trim();return W.length>0?W:void 0}function NY1(X){return{sessionId:X.sessionId||"",mode:X.mode==="plan"?"plan":"act",enableTools:X.enableTools!==!1,enableSpawnAgent:X.enableSpawnAgent!==!1,enableAgentTeams:X.enableAgentTeams!==!1,missionLogIntervalSteps:typeof X.missionLogIntervalSteps==="number"&&Number.isFinite(X.missionLogIntervalSteps)?X.missionLogIntervalSteps:3,missionLogIntervalMs:typeof X.missionLogIntervalMs==="number"&&Number.isFinite(X.missionLogIntervalMs)?X.missionLogIntervalMs:120000}}class kK{teamRuntimeRegistry=new dA;build(X){let{config:Y,hooks:W,extensions:z,logger:F,telemetry:Q,createSpawnTool:J,onTeamRestored:Z,userInstructionWatcher:K,defaultToolExecutors:H}=X,G=X.onTeamEvent??(()=>{}),q=NY1(Y),B=[],$=Y.teamName?.trim()||wJ0(),R=!1,E=Boolean(K),U=K,A=Promise.resolve(),T;if(!U&&q.enableTools&&PJ0(Y.cwd))U=l3({skills:{workspacePath:Y.cwd},rules:{workspacePath:Y.cwd},workflows:{workspacePath:Y.cwd}}),A=U.start().catch(()=>{});if(q.enableTools&&U&&(E||PJ0(Y.cwd)||pA(U,Y.skills).length>0))T=VY1(U,A,Y.skills);if(q.enableTools)B.push(...MJ0(Y.cwd,Y.providerId,q.mode,Y.modelId,Y.toolRoutingRules,T,H));let I,C=q.enableAgentTeams?CJ0():void 0,M=C?.loadRuntime($),w=M?.state,P=M?.teammates??[],y=new Map(P.map((k)=>[k.agentId,k])),v=Y.sessionId||$,f=KY1({providerId:Y.providerId,modelId:Y.modelId,cwd:Y.cwd,apiKey:Y.apiKey??"",baseUrl:Y.baseUrl,headers:Y.headers,providerConfig:Y.providerConfig,knownModels:Y.knownModels,thinking:Y.thinking,clineWorkspaceMetadata:Y.providerId==="cline"?UY1(Y.systemPrompt):void 0,maxIterations:Y.maxIterations,hooks:W,extensions:z??Y.extensions,logger:F??Y.logger,telemetry:X.telemetry??Y.telemetry}),_=f.getRuntimeConfig();if(Y.providerId==="cline"&&!_.clineWorkspaceMetadata)uA(Y.cwd??"").then((k)=>{let l=f.getRuntimeConfig();if(l.clineWorkspaceMetadata)return;Object.assign(l,{clineWorkspaceMetadata:k})});this.teamRuntimeRegistry.getOrCreate(v,()=>({delegatedAgentConfigProvider:f}));let b=()=>{if(!q.enableAgentTeams)return;let k=this.teamRuntimeRegistry.getOrCreate(v,()=>({delegatedAgentConfigProvider:f}));if(I=k.runtime,!I){if(I=new WY1({teamName:$,leadAgentId:Y.sessionId||"lead",missionLogIntervalSteps:q.missionLogIntervalSteps,missionLogIntervalMs:q.missionLogIntervalMs,onTeamEvent:(l)=>{if(G(l),I&&C){if(l.type==="teammate_spawned"&&l.teammate?.rolePrompt){let Z0={agentId:l.agentId,rolePrompt:l.teammate.rolePrompt,modelId:l.teammate.modelId,maxIterations:l.teammate.maxIterations};y.set(Z0.agentId,Z0)}if(l.type==="teammate_shutdown")y.delete(l.agentId);C.handleTeamEvent($,l),C.persistRuntime($,I.exportState(),Array.from(y.values()))}}}),w)I.hydrateState(w),I.markStaleRunsInterrupted("runtime_recovered");k.runtime=I}if(!R){if(!I)return;R=!0;let l=GY1({runtime:I,leadAgentId:"lead",restoredFromPersistence:Boolean(w),restoredTeammates:P,createBaseTools:q.enableTools?()=>MJ0(Y.cwd,Y.providerId,q.mode,Y.modelId,Y.toolRoutingRules,T,H):void 0,teammateConfigProvider:f});if(l.restoredFromPersistence)Z?.();B.push(...l.tools)}return I};if(q.enableSpawnAgent&&J){let k=J();B.push({...k,execute:async(l,Z0)=>{return b(),k.execute(l,Z0)}})}if(q.enableAgentTeams)b();let x=q.enableAgentTeams?()=>{let k=this.teamRuntimeRegistry.get(v)?.runtime;if(!k)return;let l=k.listTasks(),Z0=l.some((p)=>p.status==="in_progress"||p.status==="pending"),m=k.listRuns({}),h=m.some((p)=>p.status==="running"||p.status==="queued");if(Z0||h){let p=l.filter((c)=>c.status==="in_progress"||c.status==="pending").map((c)=>`${c.id} (${c.status}): ${c.title}`).join(", "),n=m.filter((c)=>c.status==="running"||c.status==="queued").map((c)=>`${c.id} (${c.status})`).join(", "),Q0=[];if(p)Q0.push(`Unfinished tasks: ${p}`);if(n)Q0.push(`Active runs: ${n}`);return`[SYSTEM] You still have team obligations. ${Q0.join(". ")}. Use team_run_task to delegate work, or team_task with action=complete to mark tasks done, or team_await_run / team_await_all_runs to wait for active runs. Do NOT stop until all tasks are completed.`}return}:void 0;return{tools:B,logger:F??Y.logger,telemetry:Q??Y.telemetry,teamRuntime:I,teamRestoredFromPersistence:Boolean(w),delegatedAgentConfigProvider:this.teamRuntimeRegistry.get(v)?.delegatedAgentConfigProvider??f,completionGuard:x,shutdown:(k)=>{if(BY1(I,k),this.teamRuntimeRegistry.delete(v),!E)U?.stop()}}}}w6();import{existsSync as cJ0,mkdirSync as dY1,readFileSync as cY1,writeFileSync as lY1}from"node:fs";import{basename as lJ0,dirname as tA}from"node:path";import{existsSync as AY1,mkdirSync as $M1,readFileSync as OY1,writeFileSync as DM1}from"node:fs";import{mkdir as TY1,readFile as IY1,writeFile as $Y1}from"node:fs/promises";import{dirname as yJ0,join as DY1}from"node:path";import*as kJ0 from"@clinebot/llms/models";var vK=new Set;function EY1(X){return X.split(/[-_]/).filter(Boolean).map((Y)=>Y.charAt(0).toUpperCase()+Y.slice(1)).join(" ")}function o7(X){return DY1(yJ0(X.getFilePath()),"models.json")}function nA(){return{version:1,providers:{}}}function CY1(X){if(!AY1(X))return nA();try{let Y=OY1(X,"utf8"),W=JSON.parse(Y);if(W&&W.version===1&&W.providers&&typeof W.providers==="object")return{version:1,providers:W.providers}}catch{}return nA()}async function mY(X){try{let Y=await IY1(X,"utf8"),W=JSON.parse(Y);if(W&&W.version===1&&W.providers&&typeof W.providers==="object")return{version:1,providers:W.providers}}catch{}return nA()}async function jK(X,Y){await TY1(yJ0(X),{recursive:!0}),await $Y1(X,`${JSON.stringify(Y,null,2)}
856
856
  `,"utf8")}function vJ0(X,Y){return{id:X,name:Y.name??X,supportsAttachments:Y.capabilities?.includes("files"),supportsVision:Y.capabilities?.includes("images"),supportsReasoning:Y.capabilities?.includes("reasoning")||Y.thinkingConfig!=null}}function RY1(X){if(!X||X.length===0)return;let Y=new Set;if(X.includes("reasoning"))Y.add("reasoning");if(X.includes("prompt-cache"))Y.add("prompt-cache");if(X.includes("tools"))Y.add("tools");return Y.size>0?[...Y]:void 0}function MY1(X){let Y=new Set;if(!X||X.length===0)return[...Y];if(X.includes("streaming"))Y.add("streaming");if(X.includes("tools"))Y.add("tools");if(X.includes("reasoning"))Y.add("reasoning");if(X.includes("prompt-cache"))Y.add("prompt-cache");if(X.includes("vision"))Y.add("images"),Y.add("files");return[...Y]}function sQ(X,Y){let W=MY1(Y.provider.capabilities),z=Object.values(Y.models).map((J)=>J.id.trim()).filter((J)=>J.length>0),F=Y.provider.defaultModelId?.trim()||z[0]||"default",Q=Object.fromEntries(z.map((J)=>[J,{id:J,name:Y.models[J]?.name??J,capabilities:W.length>0?W:void 0,status:"active"}]));kJ0.registerProvider({provider:{id:X,name:Y.provider.name.trim()||EY1(X),protocol:"openai-chat",client:"openai-compatible",baseUrl:Y.provider.baseUrl,defaultModelId:F,capabilities:RY1(Y.provider.capabilities)},models:Q})}function jJ0(X){let Y=o7(X);if(vK.has(Y))return;let W=CY1(Y);for(let[z,F]of Object.entries(W.providers))sQ(z,F);vK.add(Y)}async function hJ0(X){let Y=o7(X);if(vK.has(Y))return;let W=await mY(Y);for(let[z,F]of Object.entries(W.providers))sQ(z,F);vK.add(Y)}import*as eQ from"@clinebot/llms/providers";import{z as h5}from"zod";var _J0=eQ.ProviderSettingsSchema,XJ=eQ.toProviderConfig,xJ0=h5.object({settings:eQ.ProviderSettingsSchema,updatedAt:h5.string().datetime(),tokenSource:h5.enum(["manual","oauth","migration"]).default("manual")}),hK=h5.object({version:h5.literal(1),lastUsedProvider:h5.string().min(1).optional(),providers:h5.record(h5.string(),xJ0)});function gY(){return{version:1,providers:{}}}w6();import{existsSync as bJ0,mkdirSync as LY1,readFileSync as PY1,writeFileSync as wY1}from"node:fs";import{dirname as uJ0,join as iA}from"node:path";import*as mJ0 from"@clinebot/llms/models";import*as gJ0 from"@clinebot/llms/providers";var dJ0="openai";function SY1(X){let Y=X?.trim();if(!Y)return;try{let W=JSON.parse(Y);if(!W)return;return{accessToken:W.idToken,refreshToken:W.refreshToken,expiresAt:W.expiresAt,accountId:W.userInfo?.id}}catch{return}}function m1(X){let Y=X?.trim();return Y?Y:void 0}function aA(X){if(!bJ0(X))return;try{let Y=PY1(X,"utf8"),W=JSON.parse(Y);if(W&&typeof W==="object"&&!Array.isArray(W))return W}catch{}return}function fY1(X){let Y=aA(X);if(Y?.version===1&&Y.providers&&typeof Y.providers==="object")return Y;return{version:1,providers:{}}}function yY1(X,Y){let W=uJ0(X);if(!bJ0(W))LY1(W,{recursive:!0});wY1(X,`${JSON.stringify(Y,null,2)}
857
857
  `,"utf8")}function kY1(X){let Y=X.dataDir??D9(),W=X.globalStatePath??iA(Y,"globalState.json"),z=X.secretsPath??iA(Y,"secrets.json"),F=aA(W),Q=aA(z);if(!F&&!Q)return;return{globalState:F??{},secrets:Q??{}}}function vY1(X){try{let W=new URL(X).hostname.toLowerCase();return W==="api.openai.com"||W.endsWith(".openai.azure.com")||W.endsWith(".services.ai.azure.com")}catch{return!1}}function jY1(X){let Y=m1(X.openAiBaseUrl);if(!Y)return!1;if(X.azureApiVersion||X.azureIdentity)return!1;return!vY1(Y)}function rA(X,Y){if(X==="openai"&&jY1(Y))return dJ0;return X}function hY1(X,Y,W,z){let F=W==="plan"?"planMode":"actMode",Q=Y===z?m1(W==="plan"?X.planModeApiModelId:X.actModeApiModelId):void 0,Z={openrouter:`${F}OpenRouterModelId`,cline:`${F}ClineModelId`,openai:`${F}OpenAiModelId`,ollama:`${F}OllamaModelId`,lmstudio:`${F}LmStudioModelId`,litellm:`${F}LiteLlmModelId`,requesty:`${F}RequestyModelId`,together:`${F}TogetherModelId`,fireworks:`${F}FireworksModelId`,sapaicore:`${F}SapAiCoreModelId`,groq:`${F}GroqModelId`,baseten:`${F}BasetenModelId`,huggingface:`${F}HuggingFaceModelId`,"huawei-cloud-maas":`${F}HuaweiCloudMaasModelId`,oca:`${F}OcaModelId`,aihubmix:`${F}AihubmixModelId`,hicap:`${F}HicapModelId`,nousResearch:`${F}NousResearchModelId`,"vercel-ai-gateway":`${F}VercelAiGatewayModelId`}[Y];return(Z?m1(typeof X[Z]==="string"?X[Z]:void 0):void 0)??Q}function _Y1(X,Y,W){let z=W==="plan"?X.planModeReasoningEffort:X.actModeReasoningEffort,F=W==="plan"?X.geminiPlanModeThinkingLevel:X.geminiActModeThinkingLevel,Q=W==="plan"?X.planModeThinkingBudgetTokens:X.actModeThinkingBudgetTokens,J=(Y==="gemini"?F:void 0)??z,Z=J==="none"||J==="low"||J==="medium"||J==="high"?J:void 0,K=typeof Q==="number"&&Number.isInteger(Q)&&Q>0?Q:void 0;if(!Z&&K===void 0)return;return{...Z?{effort:Z}:{},...K!==void 0?{budgetTokens:K}:{}}}function xY1(X){let Y=X["openai-codex-oauth-credentials"];if(!Y)return;try{let W=JSON.parse(Y),z=m1(W.access_token),F=m1(W.refresh_token),Q=m1(W.accountId);if(!z&&!F&&!Q)return;return{...z?{apiKey:z}:{},auth:{...z?{accessToken:z}:{},...F?{refreshToken:F}:{},...Q?{accountId:Q}:{}}}}catch{return}}function bY1(X){let Y=mJ0.getGeneratedModelsForProvider(X);return Object.keys(Y)[0]??void 0}function uY1(X,Y,W,z){let F=rA(X,Y),Q=m1(z==="plan"?Y.planModeApiProvider:Y.actModeApiProvider),J=hY1(Y,X,z,Q)??bY1(F),Z=_Y1(Y,F,z),K=typeof Y.requestTimeoutMs==="number"&&Number.isInteger(Y.requestTimeoutMs)&&Y.requestTimeoutMs>0?Y.requestTimeoutMs:void 0,H={anthropic:W.apiKey,cline:W.clineApiKey,openai:W.openAiApiKey,"openai-native":W.openAiNativeApiKey,openrouter:W.openRouterApiKey,bedrock:W.awsBedrockApiKey,gemini:W.geminiApiKey,ollama:W.ollamaApiKey,deepseek:W.deepSeekApiKey,requesty:W.requestyApiKey,together:W.togetherApiKey,fireworks:W.fireworksApiKey,qwen:W.qwenApiKey,doubao:W.doubaoApiKey,mistral:W.mistralApiKey,litellm:W.liteLlmApiKey,asksage:W.asksageApiKey,xai:W.xaiApiKey,moonshot:W.moonshotApiKey,zai:W.zaiApiKey,huggingface:W.huggingFaceApiKey,nebius:W.nebiusApiKey,sambanova:W.sambanovaApiKey,cerebras:W.cerebrasApiKey,groq:W.groqApiKey,"huawei-cloud-maas":W.huaweiCloudMaasApiKey,baseten:W.basetenApiKey,"vercel-ai-gateway":W.vercelAiGatewayApiKey,dify:W.difyApiKey,minimax:W.minimaxApiKey,hicap:W.hicapApiKey,aihubmix:W.aihubmixApiKey,nousResearch:W.nousResearchApiKey,oca:W.ocaApiKey,sapaicore:W.sapAiCoreClientId},G={};if(X==="openai-codex")Object.assign(G,xY1(W));if(X==="cline")try{let A=m1(W["cline:clineAccountId"]);if(A)G.auth={...G.auth??{},...SY1(A)}}catch{}if(X==="openai"&&Y.openAiHeaders)G.headers=Y.openAiHeaders;if(X==="bedrock")G.aws={accessKey:m1(W.awsAccessKey),secretKey:m1(W.awsSecretKey),sessionToken:m1(W.awsSessionToken),region:m1(Y.awsRegion),authentication:Y.awsAuthentication,profile:Y.awsUseProfile?m1(Y.awsProfile):void 0,usePromptCache:Y.awsBedrockUsePromptCache,useCrossRegionInference:Y.awsUseCrossRegionInference,useGlobalInference:Y.awsUseGlobalInference,endpoint:m1(Y.awsBedrockEndpoint),customModelBaseId:m1(z==="plan"?Y.planModeAwsBedrockCustomModelBaseId:Y.actModeAwsBedrockCustomModelBaseId)};if(X==="vertex")G.gcp={projectId:m1(Y.vertexProjectId),region:m1(Y.vertexRegion)};if(X==="openai"&&(Y.azureApiVersion||Y.azureIdentity!==void 0))G.azure={apiVersion:m1(Y.azureApiVersion),useIdentity:Y.azureIdentity};if(X==="sapaicore")G.sap={clientId:m1(W.sapAiCoreClientId),clientSecret:m1(W.sapAiCoreClientSecret),tokenUrl:m1(Y.sapAiCoreTokenUrl),resourceGroup:m1(Y.sapAiResourceGroup),deploymentId:m1(z==="plan"?Y.planModeSapAiCoreDeploymentId:Y.actModeSapAiCoreDeploymentId),useOrchestrationMode:Y.sapAiCoreUseOrchestrationMode};if(X==="oca"){G.oca={mode:Y.ocaMode};let A=m1(W.ocaRefreshToken);if(A)G.auth={...G.auth??{},refreshToken:A}}if(X==="qwen")G.apiLine=Y.qwenApiLine;if(X==="moonshot")G.apiLine=Y.moonshotApiLine;if(X==="zai")G.apiLine=Y.zaiApiLine;if(X==="minimax")G.apiLine=Y.minimaxApiLine;let q={anthropic:Y.anthropicBaseUrl,openai:Y.openAiBaseUrl,ollama:Y.ollamaBaseUrl,lmstudio:Y.lmStudioBaseUrl,litellm:Y.liteLlmBaseUrl,gemini:Y.geminiBaseUrl,requesty:Y.requestyBaseUrl,asksage:Y.asksageApiUrl,dify:Y.difyBaseUrl,oca:Y.ocaBaseUrl,aihubmix:Y.aihubmixBaseUrl,sapaicore:Y.sapAiCoreBaseUrl},B=m1(H[X]),$=m1(q[X]),R={provider:F,...B?{apiKey:B}:{},...J?{model:J}:{},...$?{baseUrl:$}:{},...Z?{reasoning:Z}:{},...K?{timeout:K}:{},...G},E=gJ0.ProviderSettingsSchema.safeParse(R);if(!E.success)return;return Object.keys(R).filter((A)=>A!=="provider").length>0?E.data:void 0}function mY1(X,Y){if(X!==dJ0)return;if(!Y.baseUrl||!Y.model)return;return{provider:{name:"OpenAI Compatible",baseUrl:Y.baseUrl,defaultModelId:Y.model},models:{[Y.model]:{id:Y.model,name:Y.model}}}}function gY1(X,Y){let W=new Set;for(let z of[X.actModeApiProvider,X.planModeApiProvider]){let F=m1(z);if(F)W.add(F)}if(m1(Y.apiKey))W.add("anthropic");if(m1(Y.openRouterApiKey))W.add("openrouter");if(m1(Y.openAiApiKey))W.add("openai");if(m1(Y.openAiNativeApiKey))W.add("openai-native");if(m1(Y["openai-codex-oauth-credentials"]))W.add("openai-codex");if(m1(Y.geminiApiKey))W.add("gemini");if(m1(Y.ollamaApiKey))W.add("ollama");if(m1(Y.awsAccessKey)||m1(Y.awsBedrockApiKey))W.add("bedrock");if(m1(X.vertexProjectId)||m1(X.vertexRegion))W.add("vertex");if(m1(Y.clineApiKey))W.add("cline");if(m1(Y.ocaApiKey))W.add("oca");return W}function oA(X){let Y=X.providerSettingsManager.read(),W=kY1(X);if(!W)return{migrated:!1,providerCount:Object.keys(Y.providers).length,lastUsedProvider:Y.lastUsedProvider};let{globalState:z,secrets:F}=W,Q=z.mode==="plan"?"plan":"act",J=gY1(z,F),Z=gY();Z.providers={...Y.providers},Z.lastUsedProvider=Y.lastUsedProvider;let K=new Date().toISOString(),H=0,G=iA(uJ0(X.providerSettingsManager.getFilePath()),"models.json"),q=fY1(G),B=0;for(let E of J){let U=rA(E,z);if(Z.providers[U])continue;let A=uY1(E,z,F,Q);if(!A)continue;Z.providers[U]={settings:A,updatedAt:K,tokenSource:"migration"},H+=1;let T=mY1(U,A);if(T&&!q.providers[U])q.providers[U]=T,B+=1}if(H===0&&B===0)return{migrated:!1,providerCount:Object.keys(Y.providers).length,lastUsedProvider:Y.lastUsedProvider};let $=m1(Q==="plan"?z.planModeApiProvider:z.actModeApiProvider),R=$?rA($,z):void 0;if(Z.lastUsedProvider=Y.lastUsedProvider??(R&&Z.providers[R]?R:Object.keys(Z.providers)[0]),X.providerSettingsManager.write(Z),B>0)yY1(G,q);return{migrated:H>0||B>0,providerCount:Object.keys(Z.providers).length,lastUsedProvider:Z.lastUsedProvider}}function pY1(){return new Date().toISOString()}function nY1(X){if(lJ0(X)!=="providers.json")return;let Y=tA(X);if(lJ0(Y)!=="settings")return;return tA(Y)}class dY{filePath;dataDir;constructor(X={}){if(this.filePath=X.filePath??yV(),this.dataDir=X.dataDir??nY1(this.filePath),this.dataDir||!X.filePath)oA({providerSettingsManager:this,dataDir:this.dataDir});jJ0(this)}getFilePath(){return this.filePath}read(){if(!cJ0(this.filePath))return gY();try{let X=cY1(this.filePath,"utf8"),Y=JSON.parse(X),W=hK.safeParse(Y);if(W.success)return W.data}catch{}return gY()}write(X){let Y=hK.parse(X),W=tA(this.filePath);if(!cJ0(W))dY1(W,{recursive:!0});lY1(this.filePath,`${JSON.stringify(Y,null,2)}
858
858
  `,"utf8")}saveProviderSettings(X,Y={}){let W=_J0.parse(X),z=this.read(),F=W.provider,Q=Y.setLastUsed!==!1,J=z.providers[F],Z=Y.tokenSource??J?.tokenSource??"manual",K={...z,providers:{...z.providers,[F]:{settings:W,updatedAt:pY1(),tokenSource:Z}},lastUsedProvider:Q?F:z.lastUsedProvider};return this.write(K),K}getProviderSettings(X){return this.read().providers[X]?.settings}getLastUsedProviderSettings(){let X=this.read(),Y=X.lastUsedProvider;if(!Y)return;return X.providers[Y]?.settings}getProviderConfig(X){let Y=this.getProviderSettings(X);if(!Y)return;return XJ(Y)}getLastUsedProviderConfig(){let X=this.getLastUsedProviderSettings();if(!X)return;return XJ(X)}}K3();var sA=tV,YJ={CORE:"core",CLI:"cli",SUBAGENT:"subagent",DESKTOP:"desktop",KANBAN:"kanban",API:"api",WEB:"web",VSCODE:"vscode",ENTERPRISE:"enterprise",IDE:"ide",JETBRAINS:"jetbrains",NEOVIM:"neovim",UNKNOWN:"unknown"};var iY1="https://api.cline.bot",eA="workos:";function aY1(X,Y){if(X==="cline")return`${eA}${Y}`;return Y}function rY1(X,Y){if(X==="cline"&&Y.toLowerCase().startsWith(eA))return Y.slice(eA.length);return Y}function oY1(X){let W=q8(X)?.exp;if(typeof W==="number"&&W>0)return W*1000;return null}function tY1(X,Y){let W=X.auth?.expiresAt;if(typeof W==="number"&&Number.isFinite(W)&&W>0)return W;let z=oY1(Y);if(z)return z;return Date.now()-1}function sY1(X,Y){let W=Y.auth?.accessToken?.trim(),z=Y.auth?.refreshToken?.trim();if(!W||!z)return null;let F=rY1(X,W);if(!F)return null;return{access:F,refresh:z,expires:tY1(Y,F),accountId:Y.auth?.accountId}}function eY1(X,Y){let W=X?.expiresAt,z=Y?.expiresAt;return X?.accessToken===Y?.accessToken&&X?.refreshToken===Y?.refreshToken&&X?.accountId===Y?.accountId&&W===z}class _K extends Error{providerId;constructor(X){super(`OAuth credentials for provider "${X}" are no longer valid. Re-run authentication for this provider.`);this.name="OAuthReauthRequiredError",this.providerId=X}}class XO{providerSettingsManager;telemetry;refreshInFlight=new Map;constructor(X){this.providerSettingsManager=X?.providerSettingsManager??new dY,this.telemetry=X?.telemetry}async resolveProviderApiKey(X){if(!H3(X.providerId))return null;return this.resolveWithSingleFlight(X.providerId,X.forceRefresh)}async resolveWithSingleFlight(X,Y=!1){let W=this.refreshInFlight.get(X);if(W)return W;let z=this.resolveProviderApiKeyInternal(X,Y).catch((F)=>{throw F}).finally(()=>{this.refreshInFlight.delete(X)});return this.refreshInFlight.set(X,z),z}async resolveProviderApiKeyInternal(X,Y){let W=this.providerSettingsManager.getProviderSettings(X);if(!W)return null;let z=sY1(X,W);if(!z)return null;let F=await this.resolveCredentials(X,W,z,Y);if(!F)throw new _K(X);let Q=aY1(X,F.access),J={...W.auth??{},accessToken:Q,refreshToken:F.refresh,accountId:F.accountId};J.expiresAt=F.expires;let Z={...W,auth:J},K=!eY1(W.auth,Z.auth);if(K)this.providerSettingsManager.saveProviderSettings(Z,{setLastUsed:!1,tokenSource:"oauth"});return{providerId:X,apiKey:Q,accountId:F.accountId,refreshed:K}}async resolveCredentials(X,Y,W,z){if(X==="cline")return sB(W,{apiBaseUrl:Y.baseUrl?.trim()||iY1,telemetry:this.telemetry},{forceRefresh:z});if(X==="oca")return QU(W,{forceRefresh:z,telemetry:this.telemetry},{mode:Y.oca?.mode,telemetry:this.telemetry});return XU(W,{forceRefresh:z,telemetry:this.telemetry})}}function pJ0(X){let Y=X.lastIndexOf("# Workspace Configuration");if(Y<0)return;let W=X.slice(Y).trim();return W.length>0?W:void 0}function nJ0(X){if(!X)return!1;return Object.values(X).some((Y)=>typeof Y==="function")}function iJ0(X,Y){let W=[...X??[],...Y??[]];if(W.length===0)return;let z=[],F=new Set;for(let Q of W){if(F.has(Q.name))continue;F.add(Q.name),z.push(Q)}return z}function aJ0(X){return JSON.stringify(X,(Y,W)=>{if(W instanceof Error)return{name:W.name,message:W.message,stack:W.stack};return W})}function rJ0(X,Y,W=[]){let z=X.map((K,H)=>{let G=W[H];return G?.role===K.role&&JSON.stringify(G.content)===JSON.stringify(K.content)?{...G,...K}:{...K}}),F=[...z].reverse().findIndex((K)=>K.role==="assistant");if(F===-1)return z;let Q=z.length-1-F,J=z[Q],Z=Y.usage;return z[Q]={...J,providerId:J.providerId??Y.model.provider,modelId:J.modelId??Y.model.id,modelInfo:J.modelInfo??{id:Y.model.id,provider:Y.model.provider},metrics:{...J.metrics??{},inputTokens:Z.inputTokens,outputTokens:Z.outputTokens,cacheReadTokens:Z.cacheReadTokens,cacheWriteTokens:Z.cacheWriteTokens,cost:Z.totalCost},ts:J.ts??Y.endedAt.getTime()},z}function YO(X){return{sessionId:X.sessionId,source:X.source,pid:X.pid,startedAt:X.startedAt,endedAt:X.endedAt??null,exitCode:X.exitCode??null,status:X.status,interactive:X.interactive,provider:X.provider,model:X.model,cwd:X.cwd,workspaceRoot:X.workspaceRoot,teamName:X.teamName??void 0,enableTools:X.enableTools,enableSpawn:X.enableSpawn,enableTeams:X.enableTeams,parentSessionId:X.parentSessionId??void 0,parentAgentId:X.parentAgentId??void 0,agentId:X.agentId??void 0,conversationId:X.conversationId??void 0,isSubagent:X.isSubagent,prompt:X.prompt??void 0,metadata:X.metadata??void 0,transcriptPath:X.transcriptPath,hookPath:X.hookPath,messagesPath:X.messagesPath??void 0,updatedAt:X.updatedAt}}function xK(){return{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,totalCost:0}}function ZJ(X,Y){return{inputTokens:X.inputTokens+Math.max(0,Y.inputTokens??0),outputTokens:X.outputTokens+Math.max(0,Y.outputTokens??0),cacheReadTokens:X.cacheReadTokens+Math.max(0,Y.cacheReadTokens??0),cacheWriteTokens:X.cacheWriteTokens+Math.max(0,Y.cacheWriteTokens??0),totalCost:X.totalCost+Math.max(0,Y.totalCost??0)}}function XZ1(X){if(!X||typeof X!=="object")return;let Y=X,W=Y.skill??Y.skill_name??Y.skillName;if(typeof W!=="string")return;let z=W.trim();return z.length>0?z:void 0}function ZO(X){if(!X||typeof X!=="object")return{};let Y=X;return{agentId:typeof Y.agentId==="string"?Y.agentId:void 0,conversationId:typeof Y.conversationId==="string"?Y.conversationId:void 0,parentAgentId:typeof Y.parentAgentId==="string"?Y.parentAgentId:void 0}}function t7(X){let Y=X.agentId?.trim();if(!Y)return;let W=X.parentAgentId?.trim()||void 0,z=X.teamRole,F="root";if(z==="teammate")F="team_teammate";else if(z==="lead")F="team_lead";else if(W)F="subagent";return{agentId:Y,agentKind:F,conversationId:X.conversationId?.trim()||void 0,parentAgentId:W,createdByAgentId:X.createdByAgentId?.trim()||W||void 0,isSubagent:Boolean(W),teamId:X.teamId?.trim()||void 0,teamName:X.teamName?.trim()||void 0,teamRole:z,teamAgentId:X.teamAgentId?.trim()||void 0}}function QO(X,Y,W){let{sessionId:z,config:F,liveSession:Q,emit:J}=X,Z=F.telemetry,K=Q?.runtime.teamRuntime,H=W?.isPrimaryAgentEvent??!0,G=ZO(Y),q=t7({agentId:W?.agentId??G.agentId,conversationId:W?.conversationId??G.conversationId,parentAgentId:W?.parentAgentId??G.parentAgentId,createdByAgentId:W?.createdByAgentId,teamId:W?.teamId??K?.getTeamId(),teamName:W?.teamName??K?.getTeamName(),teamRole:W?.teamRole,teamAgentId:W?.teamAgentId});if(Y.type==="content_start"&&Y.contentType==="tool"&&Y.toolName==="skills"){let B=XZ1(Y.input);if(B)cB(Z,{ulid:z,skillName:B,skillSource:"project",skillsAvailableGlobal:0,skillsAvailableProject:0,provider:F.providerId,modelId:F.modelId,...q})}if(Y.type==="content_end"&&Y.contentType==="tool"){let B=Y.toolName??"unknown",$=!Y.error;if(dB(Z,{ulid:z,tool:B,autoApproved:void 0,success:$,modelId:F.modelId,provider:F.providerId,...q}),!$&&(B==="editor"||B==="apply_patch"))lB(Z,{ulid:z,modelId:F.modelId,provider:F.providerId,errorType:Y.error,...q})}if(Y.type==="notice"&&Y.reason==="api_error")p3(Z,{ulid:z,model:F.modelId,provider:F.providerId,errorMessage:Y.message,...q});if(Y.type==="error")p3(Z,{ulid:z,model:F.modelId,provider:F.providerId,errorMessage:Y.error?.message??"unknown error",...q});if(Y.type==="usage"&&H&&Q?.turnUsageBaseline)X.usageBySession.set(z,ZJ(Q.turnUsageBaseline,{inputTokens:Y.inputTokens,outputTokens:Y.outputTokens,cacheWriteTokens:Y.cacheWriteTokens,cacheReadTokens:Y.cacheReadTokens,totalCost:Y.cost})),sZ(Z,{ulid:z,provider:F.providerId,model:F.modelId,source:"assistant",mode:F.mode,...q}),mB(Z,{ulid:z,tokensIn:Y.inputTokens,tokensOut:Y.outputTokens,cacheWriteTokens:Y.cacheWriteTokens,cacheReadTokens:Y.cacheReadTokens,totalCost:Y.cost,model:F.modelId,...q});if(Y.type==="iteration_end"&&H)X.persistMessages(z,Q?.agent.getMessages()??[],Q?.config.systemPrompt);J({type:"agent_event",payload:{sessionId:z,event:Y}}),J({type:"chunk",payload:{sessionId:z,stream:"agent",chunk:aJ0(Y),ts:Date.now()}})}import{existsSync as JO,mkdirSync as YZ1,readdirSync as ZZ1,rmdirSync as QZ1,unlinkSync as JZ1}from"node:fs";import{dirname as oJ0,join as _5}from"node:path";function i6(){return new Date().toISOString()}function r4(X){if(!X||!JO(X))return;try{JZ1(X)}catch{}}class WO{ensureSessionsDir;constructor(X){this.ensureSessionsDir=X}sessionArtifactsDir(X){return _5(this.ensureSessionsDir(),X)}ensureSessionArtifactsDir(X){let Y=this.sessionArtifactsDir(X);if(!JO(Y))YZ1(Y,{recursive:!0});return Y}sessionTranscriptPath(X){return _5(this.ensureSessionArtifactsDir(X),`${X}.log`)}sessionHookPath(X){return _5(this.ensureSessionArtifactsDir(X),`${X}.hooks.jsonl`)}sessionMessagesPath(X){return _5(this.ensureSessionArtifactsDir(X),`${X}.messages.json`)}sessionManifestPath(X,Y=!0){let W=Y?this.ensureSessionArtifactsDir(X):this.sessionArtifactsDir(X);return _5(W,`${X}.json`)}removeSessionDirIfEmpty(X){let Y=this.sessionArtifactsDir(X),W=this.ensureSessionsDir();while(Y.startsWith(W)&&Y!==W){if(!JO(Y)){Y=oJ0(Y);continue}try{if(ZZ1(Y).length>0)break;QZ1(Y)}catch{break}Y=oJ0(Y)}}subagentArtifactPaths(X,Y,W){let z=this.ensureSessionArtifactsDir(X);return{transcriptPath:_5(z,`${X}.log`),hookPath:_5(z,`${X}.hooks.jsonl`),messagesPath:_5(z,`${X}.messages.json`)}}}w6();import{spawn as WZ1}from"node:child_process";import{appendFileSync as GZ1,readFileSync as KZ1}from"node:fs";function uK(X){if(!X||typeof X!=="object")return{};let Y={};for(let[W,z]of Object.entries(X))Y[W]=typeof z==="string"?z:JSON.stringify(z);return Y}function bK(X,Y,W){let z=W instanceof Error?`: ${W.message}`:"",F=`${Y}${z}`;if(X?.warn){X.warn(F);return}console.warn(F)}function tJ0(X,Y){if(!Y)return X;if(!X)return{...Y};let W=[X.context,Y.context].filter((F)=>typeof F==="string"&&F.length>0).join(`
@@ -873,7 +873,7 @@ ${F}`,X.config.mode)}function FO(X,Y){return nV(X,Y==="plan"?"plan":"act")}funct
873
873
  `,"utf8")}async applySubagentStatus(X,Y){await this.applySubagentStatusBySessionId(X,VO(Y))}async applySubagentStatusBySessionId(X,Y){let W=await this.adapter.getSession(X);if(!W)return;let z=Y==="running"?null:i6(),F=Y==="running"?null:Y==="failed"?1:0;await this.adapter.updateSession({sessionId:X,status:Y,endedAt:z,exitCode:F,expectedStatusLock:W.statusLock})}async applyStatusToRunningChildSessions(X,Y){if(!X)return;let W=await this.adapter.listSessions({limit:2000,parentSessionId:X,status:"running"});for(let z of W)await this.applySubagentStatusBySessionId(z.sessionId,Y)}async onTeamTaskStart(X,Y,W){let z=await this.adapter.getSession(X);if(!z)return;let F=HO(X,Y),Q=i6(),J=this.artifacts.sessionTranscriptPath(F),Z=this.artifacts.sessionHookPath(F),K=this.artifacts.sessionMessagesPath(F);await this.adapter.upsertSession(this.buildSubsessionRow(z,{sessionId:F,parentSessionId:X,parentAgentId:"lead",agentId:Y,prompt:W||`Team task for ${Y}`,startedAt:Q,transcriptPath:J,hookPath:Z,messagesPath:K})),AO(K,Q),await this.appendSubagentTranscriptLine(F,`[start] ${W}`);let H=this.teamTaskQueueKey(X,Y),G=this.teamTaskSessionsByAgent.get(H)??[];G.push(F),this.teamTaskSessionsByAgent.set(H,G)}async onTeamTaskEnd(X,Y,W,z,F){let Q=this.teamTaskQueueKey(X,Y),J=this.teamTaskSessionsByAgent.get(Q);if(!J||J.length===0)return;let Z=J.shift();if(J.length===0)this.teamTaskSessionsByAgent.delete(Q);if(!Z)return;if(F)await this.persistSessionMessages(Z,F);await this.appendSubagentTranscriptLine(Z,z??`[done] ${W}`),await this.applySubagentStatusBySessionId(Z,W),this.teamTaskLastHeartbeatBySession.delete(Z),this.teamTaskLastProgressLineBySession.delete(Z)}async onTeamTaskProgress(X,Y,W,z){let F=this.teamTaskQueueKey(X,Y),Q=this.teamTaskSessionsByAgent.get(F)?.[0];if(!Q)return;let J=W.trim();if(!J)return;let Z=z?.kind??"progress";if(Z==="heartbeat"){let H=Date.now(),G=this.teamTaskLastHeartbeatBySession.get(Q)??0;if(H-G<u8.TEAM_HEARTBEAT_LOG_INTERVAL_MS)return;this.teamTaskLastHeartbeatBySession.set(Q,H)}let K=Z==="heartbeat"?"[progress] heartbeat":Z==="text"?`[progress] text: ${J}`:`[progress] ${J}`;if(this.teamTaskLastProgressLineBySession.get(Q)===K)return;this.teamTaskLastProgressLineBySession.set(Q,K),await this.appendSubagentTranscriptLine(Q,K)}async handleSubAgentStart(X,Y){let W=await this.upsertSubagentSession({agentId:Y.subAgentId,parentAgentId:Y.parentAgentId,conversationId:Y.conversationId,prompt:Y.input.task,rootSessionId:X});if(!W)return;await this.appendSubagentTranscriptLine(W,`[start] ${Y.input.task}`),await this.applySubagentStatusBySessionId(W,"running")}async handleSubAgentEnd(X,Y){let W=await this.upsertSubagentSession({agentId:Y.subAgentId,parentAgentId:Y.parentAgentId,conversationId:Y.conversationId,prompt:Y.input.task,rootSessionId:X});if(!W)return;if(Y.error){await this.appendSubagentTranscriptLine(W,`[error] ${Y.error.message}`),await this.applySubagentStatusBySessionId(W,"failed");return}let z=Y.result?.finishReason??"completed";await this.appendSubagentTranscriptLine(W,`[done] ${z}`),await this.applySubagentStatusBySessionId(W,z==="aborted"?"cancelled":"completed")}isPidAlive(X){if(!Number.isFinite(X)||X<=0)return!1;try{return process.kill(Math.floor(X),0),!0}catch(Y){return typeof Y==="object"&&Y!==null&&"code"in Y&&Y.code==="EPERM"}}async reconcileDeadRunningSession(X){if(X.status!=="running"||this.isPidAlive(X.pid))return X;let Y=i6(),W=u8.STALE_REASON;for(let z=0;z<UO;z++){let F=await this.adapter.getSession(X.sessionId);if(!F)return;if(F.status!=="running")return F;let Q={...F.metadata??{},terminal_marker:W,terminal_marker_at:Y,terminal_marker_pid:F.pid,terminal_marker_source:u8.STALE_SOURCE},J=await this.adapter.updateSession({sessionId:F.sessionId,status:"failed",endedAt:Y,exitCode:1,metadata:Q,expectedStatusLock:F.statusLock});if(!J.updated)continue;await this.applyStatusToRunningChildSessions(F.sessionId,"failed");let Z=this.buildManifestFromRow(F,{status:"failed",endedAt:Y,exitCode:1,metadata:Q}),{path:K}=this.readManifestFile(F.sessionId);return this.writeManifestFile(K,Z),lK(F.hookPath,`${JSON.stringify({ts:Y,hookName:"session_shutdown",reason:W,sessionId:F.sessionId,pid:F.pid,source:u8.STALE_SOURCE})}
874
874
  `,"utf8"),lK(F.transcriptPath,`[shutdown] ${W} (pid=${F.pid})
875
875
  `,"utf8"),{...F,status:"failed",endedAt:Y,exitCode:1,metadata:Q,statusLock:J.statusLock,updatedAt:Y}}return await this.adapter.getSession(X.sessionId)}async listSessions(X=200){let Y=Math.max(1,Math.floor(X)),W=Math.min(Y*5,2000);return await this.reconcileDeadSessions(W),(await this.adapter.listSessions({limit:W})).slice(0,Y).map((F)=>{let Q=XX(F.metadata??void 0),{manifest:J}=this.readManifestFile(F.sessionId),Z=cY(typeof J?.metadata?.title==="string"?J.metadata.title:void 0),K=Z?{...Q??{},title:Z}:Q;return{...F,metadata:K}})}async reconcileDeadSessions(X=2000){let Y=await this.adapter.listSessions({limit:Math.max(1,Math.floor(X)),status:"running"}),W=0;for(let z of Y){let F=await this.reconcileDeadRunningSession(z);if(F&&F.status!==z.status)W++}return W}async deleteSession(X){let Y=X.trim();if(!Y)throw Error("session id is required");let W=await this.adapter.getSession(Y);if(!W)return{deleted:!1};if(await this.adapter.deleteSession(Y,!1),!W.isSubagent){let z=await this.adapter.listSessions({limit:2000,parentSessionId:Y});await this.adapter.deleteSession(Y,!0);for(let F of z)r4(F.transcriptPath),r4(F.hookPath),r4(F.messagesPath),r4(this.artifacts.sessionManifestPath(F.sessionId,!1)),this.artifacts.removeSessionDirIfEmpty(F.sessionId)}return r4(W.transcriptPath),r4(W.hookPath),r4(W.messagesPath),r4(this.artifacts.sessionManifestPath(Y,!1)),this.artifacts.removeSessionDirIfEmpty(Y),{deleted:!0}}}function IO(){return new Date().toISOString()}function DW0(X,Y){let W=`${X}.tmp`;xZ1(W,`${JSON.stringify(Y,null,2)}
876
- `,"utf8"),_Z1(W,X)}function bZ1(){return J8()}class EW0{sessionsDirPath;constructor(X=bZ1()){this.sessionsDirPath=X}ensureSessionsDir(){if(!TO(this.sessionsDirPath))hZ1(this.sessionsDirPath,{recursive:!0});return this.sessionsDirPath}indexPath(){return $W0(this.ensureSessionsDir(),"sessions.index.json")}spawnQueuePath(){return $W0(this.ensureSessionsDir(),"subagent-spawn-queue.json")}readIndex(){let X=this.indexPath();if(!TO(X))return{version:1,sessions:{}};try{let Y=JSON.parse(IW0(X,"utf8"));if(Y?.version===1&&Y.sessions)return Y}catch{}return{version:1,sessions:{}}}writeIndex(X){DW0(this.indexPath(),X)}readQueue(){let X=this.spawnQueuePath();if(!TO(X))return{version:1,nextId:1,requests:[]};try{let Y=JSON.parse(IW0(X,"utf8"));if(Y?.version===1&&typeof Y.nextId==="number"&&Array.isArray(Y.requests))return Y}catch{}return{version:1,nextId:1,requests:[]}}writeQueue(X){DW0(this.spawnQueuePath(),X)}async upsertSession(X){let Y=this.readIndex();Y.sessions[X.sessionId]=X,this.writeIndex(Y)}async getSession(X){return this.readIndex().sessions[X]}async listSessions(X){return Object.values(this.readIndex().sessions).filter((Y)=>X.parentSessionId!==void 0?Y.parentSessionId===X.parentSessionId:!0).filter((Y)=>X.status!==void 0?Y.status===X.status:!0).sort((Y,W)=>W.startedAt.localeCompare(Y.startedAt)).slice(0,X.limit)}async updateSession(X){let Y=this.readIndex(),W=Y.sessions[X.sessionId];if(!W)return{updated:!1,statusLock:0};if(X.expectedStatusLock!==void 0&&W.statusLock!==X.expectedStatusLock)return{updated:!1,statusLock:W.statusLock};let z=X.expectedStatusLock!==void 0?X.expectedStatusLock+1:W.statusLock,F={...W,status:X.status??W.status,endedAt:X.endedAt!==void 0?X.endedAt:W.endedAt??null,exitCode:X.exitCode!==void 0?X.exitCode:W.exitCode??null,prompt:X.prompt!==void 0?X.prompt:W.prompt??null,metadata:X.metadata!==void 0?X.metadata??null:W.metadata??null,parentSessionId:X.parentSessionId!==void 0?X.parentSessionId??null:W.parentSessionId??null,parentAgentId:X.parentAgentId!==void 0?X.parentAgentId??null:W.parentAgentId??null,agentId:X.agentId!==void 0?X.agentId??null:W.agentId??null,conversationId:X.conversationId!==void 0?X.conversationId??null:W.conversationId??null,statusLock:z,isSubagent:X.setRunning||X.parentSessionId!==void 0?!0:W.isSubagent,updatedAt:IO()};if(X.setRunning)F.status="running",F.endedAt=null,F.exitCode=null;return Y.sessions[X.sessionId]=F,this.writeIndex(Y),{updated:!0,statusLock:F.statusLock}}async deleteSession(X,Y){let W=this.readIndex();if(!W.sessions[X])return!1;if(delete W.sessions[X],Y){for(let F of Object.values(W.sessions))if(F.parentSessionId===X)delete W.sessions[F.sessionId]}return this.writeIndex(W),!0}async enqueueSpawnRequest(X){let Y=this.readQueue();Y.requests.push({id:Y.nextId,rootSessionId:X.rootSessionId,parentAgentId:X.parentAgentId,task:X.task,systemPrompt:X.systemPrompt,createdAt:IO()}),Y.nextId+=1,this.writeQueue(Y)}async claimSpawnRequest(X,Y){let W=this.readQueue(),z=W.requests.find((F)=>F.rootSessionId===X&&F.parentAgentId===Y&&!F.consumedAt);if(!z)return;return z.consumedAt=IO(),this.writeQueue(W),z.task}}class $O extends u8{constructor(X){super(new EW0(X))}ensureSessionsDir(){return super.ensureSessionsDir()}}import{createHash as mZ1}from"node:crypto";import{mkdir as EO,readFile as wW0,rm as SW0,writeFile as fW0}from"node:fs/promises";import{createServer as gZ1}from"node:net";import{dirname as yW0,join as nK,resolve as dZ1}from"node:path";w6();var CW0="0.0.26";var DO=CW0;var cZ1=30000,lZ1=15000,pZ1=100,kW0="CLINE_RPC_STARTUP_LOCK_HELD",vW0="CLINE_RPC_OWNER_ID",jW0="CLINE_RPC_BUILD_ID",hW0="CLINE_RPC_DISCOVERY_PATH",MO=(X)=>new Promise((Y)=>setTimeout(Y,X));function nZ1(X){return X.replace(/[^a-zA-Z0-9_.-]+/g,"_")}function RW0(X){return mZ1("sha256").update(X).digest("hex").slice(0,12)}function LO(X){return X&&typeof X==="object"&&"code"in X?String(X.code):""}function _W0(X){let Y=X.trim(),W=Y.lastIndexOf(":");if(W<=0||W>=Y.length-1)throw Error(`invalid rpc address: ${X}`);let z=Y.slice(0,W),F=Number.parseInt(Y.slice(W+1),10);if(!Number.isInteger(F)||F<=0||F>65535)throw Error(`invalid rpc port in address: ${X}`);return{host:z,port:F}}function iZ1(){let X=process.argv[1]?.trim();if(!X)return;return dZ1(process.cwd(),X)}function xW0(X){let Y=`core=${DO}:rpc=${BJ0}`;return X?.trim()?`${Y}:host=${X.trim()}`:Y}function iK(X={}){let Y=X.identityPath?.trim()||iZ1(),W=X.ownerBasis?.trim()||(Y?`${Y}`:`pid:${process.pid}:cwd:${process.cwd()}`),z=X.ownerPrefix?.trim()||"rpc",F=X.ownerId?.trim()||process.env[vW0]?.trim()||`${z}-${RW0(W)}`,Q=`${W}:${xW0(X.hostBuildKey)}`,J=process.env[jW0]?.trim()||`build-${RW0(Q)}`,Z=X.discoveryPath?.trim()||process.env[hW0]?.trim()||nK(D9(),"rpc","owners",`${nZ1(F)}.json`);return{ownerId:F,buildId:J,entryPath:Y,discoveryPath:Z}}async function bW0(X){try{let Y=JSON.parse(await wW0(X.discoveryPath,"utf8"));if(typeof Y.ownerId!=="string"||typeof Y.buildId!=="string"||typeof Y.address!=="string"||typeof Y.protocolVersion!=="string")return;return{ownerId:Y.ownerId,buildId:Y.buildId,address:Y.address,protocolVersion:Y.protocolVersion,updatedAt:typeof Y.updatedAt==="string"?Y.updatedAt:new Date().toISOString(),entryPath:typeof Y.entryPath==="string"?Y.entryPath:void 0,pid:typeof Y.pid==="number"?Y.pid:void 0,serverId:typeof Y.serverId==="string"?Y.serverId:void 0,startedAt:typeof Y.startedAt==="string"?Y.startedAt:void 0}}catch{return}}async function uW0(X,Y){await EO(yW0(X.discoveryPath),{recursive:!0}),await fW0(X.discoveryPath,JSON.stringify({ownerId:X.ownerId,buildId:X.buildId,updatedAt:new Date().toISOString(),...Y},null,2),"utf8")}async function pK(X){await SW0(X.discoveryPath,{force:!0}).catch(()=>{return})}async function aZ1(X,Y){if((await bW0(X))?.address===Y)await pK(X)}function CO(X){let Y=X?.rpcVersion?.trim()||"";return!!Y&&Y===rQ}function rZ1(X){if(Number(LO(X))===12)return!0;return(X instanceof Error?X.message:String(X)).toUpperCase().includes("UNIMPLEMENTED")}function oZ1(X){let Y=X instanceof Error?X.message:String(X);return/missing authentication header|401\b|unauthenticated|unauthorized/i.test(Y)}function MW0(X){return rZ1(X)||oZ1(X)}async function RO(X){let Y=new aQ({address:X});try{try{await Y.stopRuntimeSession("__rpc_probe__")}catch(W){if(MW0(W))return!1}return!0}catch(W){return!MW0(W)}finally{Y.close()}}async function mW0(X){let Y=await a4(X);return!!Y?.running&&CO(Y)&&await RO(X)}async function gW0(X,Y){return new Promise((W)=>{let z=gZ1();z.once("error",()=>W(!1)),z.once("listening",()=>z.close(()=>W(!0))),z.listen({host:X,port:Y})})}async function LW0(X){let{host:Y,port:W}=_W0(X);for(let z=1;z<=40;z+=1){let F=W+z;if(F>65535)break;if(await gW0(Y,F))return`${Y}:${F}`}throw Error(`no available rpc port near ${X}`)}function tZ1(X){let Y=X.trim().replace(/[^a-zA-Z0-9_.-]+/g,"_");return nK(D9(),"locks",`rpc-start-${Y}.lock`)}function sZ1(X){if(!Number.isInteger(X)||!X||X<=0)return!1;try{return process.kill(X,0),!0}catch(Y){return LO(Y)==="EPERM"}}async function eZ1(X,Y){let W={pid:process.pid,address:Y,acquiredAt:new Date().toISOString()};await fW0(nK(X,"owner.json"),JSON.stringify(W,null,2),"utf8")}async function XQ1(X){try{let Y=JSON.parse(await wW0(nK(X,"owner.json"),"utf8"));if(typeof Y.pid!=="number"||typeof Y.address!=="string"||typeof Y.acquiredAt!=="string")return;return{pid:Y.pid,address:Y.address,acquiredAt:Y.acquiredAt}}catch{return}}async function PW0(X){await SW0(X,{recursive:!0,force:!0}).catch(()=>{})}async function dW0(X,Y){if(process.env[kW0]==="1")return await Y();let W=tZ1(X),z=Date.now();await EO(yW0(W),{recursive:!0});while(!0)try{await EO(W,{recursive:!1}),await eZ1(W,X);try{return await Y()}finally{await PW0(W)}}catch(F){if(LO(F)!=="EEXIST")throw F;let Q=await XQ1(W),J=Q?new Date(Q.acquiredAt).getTime():Number.NaN;if(!Q||!Number.isFinite(J)||Date.now()-J>cZ1||!sZ1(Q.pid)){await PW0(W);continue}if(Date.now()-z>=lZ1)throw Error(`timed out waiting for rpc startup lock at ${X} (owner pid=${Q.pid})`);await MO(pZ1)}}async function YQ1(X,Y){let W=Y?.address?.trim();if(!W){await pK(X);return}if((await VJ0(W).catch(()=>{return}))?.accepted)for(let F=0;F<20;F+=1){if(!(await a4(W))?.running){await pK(X);return}await MO(100)}if(!(await a4(W))?.running)await pK(X)}async function cW0(X,Y={}){let W=Y.owner??Y.resolveOwner?.()??iK();return await dW0(X,async()=>{let z=await bW0(W);if(z?.address){let Z=await a4(z.address);if(Z?.running&&z.buildId===W.buildId&&z.protocolVersion===rQ&&CO(Z)&&await RO(z.address))return{address:z.address,action:"reuse",owner:W};await YQ1(W,z)}let F=await a4(X),{host:Q,port:J}=_W0(X);if(!F?.running){if(await gW0(Q,J))return{address:X,action:"started",owner:W};return{address:await LW0(X),action:"new-port",owner:W}}if(CO(F)&&await RO(X)){if(!z)return{address:X,action:"reuse",owner:W}}return{address:await LW0(X),action:"new-port",owner:W}})}async function lW0(X,Y=mW0){for(let W=0;W<60;W+=1){if(await Y(X))return!0;await MO(100)}return!1}async function PO(X,Y){let W=await cW0(X,{owner:Y.owner,resolveOwner:Y.resolveOwner});if(W.action!=="reuse")await Y.spawnIfNeeded(W.address,W.owner);if(!await lW0(W.address,Y.readinessCheck))throw Error(`failed to ensure rpc runtime at ${W.address}`);let z=await a4(W.address);return await uW0(W.owner,{address:W.address,pid:void 0,serverId:z?.serverId,startedAt:z?.startedAt,protocolVersion:rQ,entryPath:W.owner.entryPath}),W}import{existsSync as ZQ1,mkdirSync as QQ1}from"node:fs";class pW0{client;constructor(X){this.client=X}ensureSessionsDir(){return""}async upsertSession(X){await this.client.upsertSession(X)}async getSession(X){return await this.client.getSession(X)??void 0}async listSessions(X){return await this.client.listSessions(X)}async updateSession(X){return this.client.updateSession({sessionId:X.sessionId,status:X.status,endedAt:X.endedAt,exitCode:X.exitCode,prompt:X.prompt,metadata:X.metadata,parentSessionId:X.parentSessionId,parentAgentId:X.parentAgentId,agentId:X.agentId,conversationId:X.conversationId,expectedStatusLock:X.expectedStatusLock,setRunning:X.setRunning})}async deleteSession(X,Y){return this.client.deleteSession(X,Y)}async enqueueSpawnRequest(X){await this.client.enqueueSpawnRequest(X)}async claimSpawnRequest(X,Y){return this.client.claimSpawnRequest(X,Y)}}class aK extends u8{sessionsDirPath;client;constructor(X){let Y=new aQ({address:X.address?.trim()||"127.0.0.1:4317"});super(new pW0(Y));this.sessionsDirPath=X.sessionsDir,this.client=Y}ensureSessionsDir(){if(!ZQ1(this.sessionsDirPath))QQ1(this.sessionsDirPath,{recursive:!0});return this.sessionsDirPath}close(){this.client.close()}}w6();import{closeSync as nW0,existsSync as JQ1,mkdirSync as WQ1,openSync as GQ1,readFileSync as KQ1,rmSync as iW0,writeFileSync as FQ1}from"node:fs";import{dirname as zQ1,resolve as qQ1}from"node:path";var HQ1=15000;function VQ1(X){return Buffer.from(X).toString("base64url")}function BQ1(X){return qQ1(J8(),"rpc","spawn-leases",`${VQ1(X)}.lock`)}function UQ1(X){if(!Number.isInteger(X)||X<=0)return!1;try{return process.kill(X,0),!0}catch{return!1}}function NQ1(X,Y){try{let W=KQ1(X,"utf8"),z=JSON.parse(W),F=Number(z.createdAt??0);if(!Number.isFinite(F)||F<=0)return!0;if(Date.now()-F>Y)return!0;return!UQ1(Number(z.pid??0))}catch{return!0}}function wO(X,Y){let W=Math.max(1000,Y?.ttlMs??HQ1),z=BQ1(X);if(WQ1(zQ1(z),{recursive:!0}),JQ1(z)&&NQ1(z,W))iW0(z,{force:!0});let F;try{F=GQ1(z,"wx");let J={address:X,pid:process.pid,createdAt:Date.now()};FQ1(F,JSON.stringify(J),"utf8")}catch{if(typeof F==="number")try{nW0(F)}catch{}return}let Q=!1;return{path:z,release:()=>{if(Q)return;Q=!0;try{if(typeof F==="number")nW0(F)}catch{}try{iW0(z,{force:!0})}catch{}}}}w6();var aW0=`
876
+ `,"utf8"),_Z1(W,X)}function bZ1(){return J8()}class EW0{sessionsDirPath;constructor(X=bZ1()){this.sessionsDirPath=X}ensureSessionsDir(){if(!TO(this.sessionsDirPath))hZ1(this.sessionsDirPath,{recursive:!0});return this.sessionsDirPath}indexPath(){return $W0(this.ensureSessionsDir(),"sessions.index.json")}spawnQueuePath(){return $W0(this.ensureSessionsDir(),"subagent-spawn-queue.json")}readIndex(){let X=this.indexPath();if(!TO(X))return{version:1,sessions:{}};try{let Y=JSON.parse(IW0(X,"utf8"));if(Y?.version===1&&Y.sessions)return Y}catch{}return{version:1,sessions:{}}}writeIndex(X){DW0(this.indexPath(),X)}readQueue(){let X=this.spawnQueuePath();if(!TO(X))return{version:1,nextId:1,requests:[]};try{let Y=JSON.parse(IW0(X,"utf8"));if(Y?.version===1&&typeof Y.nextId==="number"&&Array.isArray(Y.requests))return Y}catch{}return{version:1,nextId:1,requests:[]}}writeQueue(X){DW0(this.spawnQueuePath(),X)}async upsertSession(X){let Y=this.readIndex();Y.sessions[X.sessionId]=X,this.writeIndex(Y)}async getSession(X){return this.readIndex().sessions[X]}async listSessions(X){return Object.values(this.readIndex().sessions).filter((Y)=>X.parentSessionId!==void 0?Y.parentSessionId===X.parentSessionId:!0).filter((Y)=>X.status!==void 0?Y.status===X.status:!0).sort((Y,W)=>W.startedAt.localeCompare(Y.startedAt)).slice(0,X.limit)}async updateSession(X){let Y=this.readIndex(),W=Y.sessions[X.sessionId];if(!W)return{updated:!1,statusLock:0};if(X.expectedStatusLock!==void 0&&W.statusLock!==X.expectedStatusLock)return{updated:!1,statusLock:W.statusLock};let z=X.expectedStatusLock!==void 0?X.expectedStatusLock+1:W.statusLock,F={...W,status:X.status??W.status,endedAt:X.endedAt!==void 0?X.endedAt:W.endedAt??null,exitCode:X.exitCode!==void 0?X.exitCode:W.exitCode??null,prompt:X.prompt!==void 0?X.prompt:W.prompt??null,metadata:X.metadata!==void 0?X.metadata??null:W.metadata??null,parentSessionId:X.parentSessionId!==void 0?X.parentSessionId??null:W.parentSessionId??null,parentAgentId:X.parentAgentId!==void 0?X.parentAgentId??null:W.parentAgentId??null,agentId:X.agentId!==void 0?X.agentId??null:W.agentId??null,conversationId:X.conversationId!==void 0?X.conversationId??null:W.conversationId??null,statusLock:z,isSubagent:X.setRunning||X.parentSessionId!==void 0?!0:W.isSubagent,updatedAt:IO()};if(X.setRunning)F.status="running",F.endedAt=null,F.exitCode=null;return Y.sessions[X.sessionId]=F,this.writeIndex(Y),{updated:!0,statusLock:F.statusLock}}async deleteSession(X,Y){let W=this.readIndex();if(!W.sessions[X])return!1;if(delete W.sessions[X],Y){for(let F of Object.values(W.sessions))if(F.parentSessionId===X)delete W.sessions[F.sessionId]}return this.writeIndex(W),!0}async enqueueSpawnRequest(X){let Y=this.readQueue();Y.requests.push({id:Y.nextId,rootSessionId:X.rootSessionId,parentAgentId:X.parentAgentId,task:X.task,systemPrompt:X.systemPrompt,createdAt:IO()}),Y.nextId+=1,this.writeQueue(Y)}async claimSpawnRequest(X,Y){let W=this.readQueue(),z=W.requests.find((F)=>F.rootSessionId===X&&F.parentAgentId===Y&&!F.consumedAt);if(!z)return;return z.consumedAt=IO(),this.writeQueue(W),z.task}}class $O extends u8{constructor(X){super(new EW0(X))}ensureSessionsDir(){return super.ensureSessionsDir()}}import{createHash as mZ1}from"node:crypto";import{mkdir as EO,readFile as wW0,rm as SW0,writeFile as fW0}from"node:fs/promises";import{createServer as gZ1}from"node:net";import{dirname as yW0,join as nK,resolve as dZ1}from"node:path";w6();var CW0="0.0.28";var DO=CW0;var cZ1=30000,lZ1=15000,pZ1=100,kW0="CLINE_RPC_STARTUP_LOCK_HELD",vW0="CLINE_RPC_OWNER_ID",jW0="CLINE_RPC_BUILD_ID",hW0="CLINE_RPC_DISCOVERY_PATH",MO=(X)=>new Promise((Y)=>setTimeout(Y,X));function nZ1(X){return X.replace(/[^a-zA-Z0-9_.-]+/g,"_")}function RW0(X){return mZ1("sha256").update(X).digest("hex").slice(0,12)}function LO(X){return X&&typeof X==="object"&&"code"in X?String(X.code):""}function _W0(X){let Y=X.trim(),W=Y.lastIndexOf(":");if(W<=0||W>=Y.length-1)throw Error(`invalid rpc address: ${X}`);let z=Y.slice(0,W),F=Number.parseInt(Y.slice(W+1),10);if(!Number.isInteger(F)||F<=0||F>65535)throw Error(`invalid rpc port in address: ${X}`);return{host:z,port:F}}function iZ1(){let X=process.argv[1]?.trim();if(!X)return;return dZ1(process.cwd(),X)}function xW0(X){let Y=`core=${DO}:rpc=${BJ0}`;return X?.trim()?`${Y}:host=${X.trim()}`:Y}function iK(X={}){let Y=X.identityPath?.trim()||iZ1(),W=X.ownerBasis?.trim()||(Y?`${Y}`:`pid:${process.pid}:cwd:${process.cwd()}`),z=X.ownerPrefix?.trim()||"rpc",F=X.ownerId?.trim()||process.env[vW0]?.trim()||`${z}-${RW0(W)}`,Q=`${W}:${xW0(X.hostBuildKey)}`,J=process.env[jW0]?.trim()||`build-${RW0(Q)}`,Z=X.discoveryPath?.trim()||process.env[hW0]?.trim()||nK(D9(),"rpc","owners",`${nZ1(F)}.json`);return{ownerId:F,buildId:J,entryPath:Y,discoveryPath:Z}}async function bW0(X){try{let Y=JSON.parse(await wW0(X.discoveryPath,"utf8"));if(typeof Y.ownerId!=="string"||typeof Y.buildId!=="string"||typeof Y.address!=="string"||typeof Y.protocolVersion!=="string")return;return{ownerId:Y.ownerId,buildId:Y.buildId,address:Y.address,protocolVersion:Y.protocolVersion,updatedAt:typeof Y.updatedAt==="string"?Y.updatedAt:new Date().toISOString(),entryPath:typeof Y.entryPath==="string"?Y.entryPath:void 0,pid:typeof Y.pid==="number"?Y.pid:void 0,serverId:typeof Y.serverId==="string"?Y.serverId:void 0,startedAt:typeof Y.startedAt==="string"?Y.startedAt:void 0}}catch{return}}async function uW0(X,Y){await EO(yW0(X.discoveryPath),{recursive:!0}),await fW0(X.discoveryPath,JSON.stringify({ownerId:X.ownerId,buildId:X.buildId,updatedAt:new Date().toISOString(),...Y},null,2),"utf8")}async function pK(X){await SW0(X.discoveryPath,{force:!0}).catch(()=>{return})}async function aZ1(X,Y){if((await bW0(X))?.address===Y)await pK(X)}function CO(X){let Y=X?.rpcVersion?.trim()||"";return!!Y&&Y===rQ}function rZ1(X){if(Number(LO(X))===12)return!0;return(X instanceof Error?X.message:String(X)).toUpperCase().includes("UNIMPLEMENTED")}function oZ1(X){let Y=X instanceof Error?X.message:String(X);return/missing authentication header|401\b|unauthenticated|unauthorized/i.test(Y)}function MW0(X){return rZ1(X)||oZ1(X)}async function RO(X){let Y=new aQ({address:X});try{try{await Y.stopRuntimeSession("__rpc_probe__")}catch(W){if(MW0(W))return!1}return!0}catch(W){return!MW0(W)}finally{Y.close()}}async function mW0(X){let Y=await a4(X);return!!Y?.running&&CO(Y)&&await RO(X)}async function gW0(X,Y){return new Promise((W)=>{let z=gZ1();z.once("error",()=>W(!1)),z.once("listening",()=>z.close(()=>W(!0))),z.listen({host:X,port:Y})})}async function LW0(X){let{host:Y,port:W}=_W0(X);for(let z=1;z<=40;z+=1){let F=W+z;if(F>65535)break;if(await gW0(Y,F))return`${Y}:${F}`}throw Error(`no available rpc port near ${X}`)}function tZ1(X){let Y=X.trim().replace(/[^a-zA-Z0-9_.-]+/g,"_");return nK(D9(),"locks",`rpc-start-${Y}.lock`)}function sZ1(X){if(!Number.isInteger(X)||!X||X<=0)return!1;try{return process.kill(X,0),!0}catch(Y){return LO(Y)==="EPERM"}}async function eZ1(X,Y){let W={pid:process.pid,address:Y,acquiredAt:new Date().toISOString()};await fW0(nK(X,"owner.json"),JSON.stringify(W,null,2),"utf8")}async function XQ1(X){try{let Y=JSON.parse(await wW0(nK(X,"owner.json"),"utf8"));if(typeof Y.pid!=="number"||typeof Y.address!=="string"||typeof Y.acquiredAt!=="string")return;return{pid:Y.pid,address:Y.address,acquiredAt:Y.acquiredAt}}catch{return}}async function PW0(X){await SW0(X,{recursive:!0,force:!0}).catch(()=>{})}async function dW0(X,Y){if(process.env[kW0]==="1")return await Y();let W=tZ1(X),z=Date.now();await EO(yW0(W),{recursive:!0});while(!0)try{await EO(W,{recursive:!1}),await eZ1(W,X);try{return await Y()}finally{await PW0(W)}}catch(F){if(LO(F)!=="EEXIST")throw F;let Q=await XQ1(W),J=Q?new Date(Q.acquiredAt).getTime():Number.NaN;if(!Q||!Number.isFinite(J)||Date.now()-J>cZ1||!sZ1(Q.pid)){await PW0(W);continue}if(Date.now()-z>=lZ1)throw Error(`timed out waiting for rpc startup lock at ${X} (owner pid=${Q.pid})`);await MO(pZ1)}}async function YQ1(X,Y){let W=Y?.address?.trim();if(!W){await pK(X);return}if((await VJ0(W).catch(()=>{return}))?.accepted)for(let F=0;F<20;F+=1){if(!(await a4(W))?.running){await pK(X);return}await MO(100)}if(!(await a4(W))?.running)await pK(X)}async function cW0(X,Y={}){let W=Y.owner??Y.resolveOwner?.()??iK();return await dW0(X,async()=>{let z=await bW0(W);if(z?.address){let Z=await a4(z.address);if(Z?.running&&z.buildId===W.buildId&&z.protocolVersion===rQ&&CO(Z)&&await RO(z.address))return{address:z.address,action:"reuse",owner:W};await YQ1(W,z)}let F=await a4(X),{host:Q,port:J}=_W0(X);if(!F?.running){if(await gW0(Q,J))return{address:X,action:"started",owner:W};return{address:await LW0(X),action:"new-port",owner:W}}if(CO(F)&&await RO(X)){if(!z)return{address:X,action:"reuse",owner:W}}return{address:await LW0(X),action:"new-port",owner:W}})}async function lW0(X,Y=mW0){for(let W=0;W<60;W+=1){if(await Y(X))return!0;await MO(100)}return!1}async function PO(X,Y){let W=await cW0(X,{owner:Y.owner,resolveOwner:Y.resolveOwner});if(W.action!=="reuse")await Y.spawnIfNeeded(W.address,W.owner);if(!await lW0(W.address,Y.readinessCheck))throw Error(`failed to ensure rpc runtime at ${W.address}`);let z=await a4(W.address);return await uW0(W.owner,{address:W.address,pid:void 0,serverId:z?.serverId,startedAt:z?.startedAt,protocolVersion:rQ,entryPath:W.owner.entryPath}),W}import{existsSync as ZQ1,mkdirSync as QQ1}from"node:fs";class pW0{client;constructor(X){this.client=X}ensureSessionsDir(){return""}async upsertSession(X){await this.client.upsertSession(X)}async getSession(X){return await this.client.getSession(X)??void 0}async listSessions(X){return await this.client.listSessions(X)}async updateSession(X){return this.client.updateSession({sessionId:X.sessionId,status:X.status,endedAt:X.endedAt,exitCode:X.exitCode,prompt:X.prompt,metadata:X.metadata,parentSessionId:X.parentSessionId,parentAgentId:X.parentAgentId,agentId:X.agentId,conversationId:X.conversationId,expectedStatusLock:X.expectedStatusLock,setRunning:X.setRunning})}async deleteSession(X,Y){return this.client.deleteSession(X,Y)}async enqueueSpawnRequest(X){await this.client.enqueueSpawnRequest(X)}async claimSpawnRequest(X,Y){return this.client.claimSpawnRequest(X,Y)}}class aK extends u8{sessionsDirPath;client;constructor(X){let Y=new aQ({address:X.address?.trim()||"127.0.0.1:4317"});super(new pW0(Y));this.sessionsDirPath=X.sessionsDir,this.client=Y}ensureSessionsDir(){if(!ZQ1(this.sessionsDirPath))QQ1(this.sessionsDirPath,{recursive:!0});return this.sessionsDirPath}close(){this.client.close()}}w6();import{closeSync as nW0,existsSync as JQ1,mkdirSync as WQ1,openSync as GQ1,readFileSync as KQ1,rmSync as iW0,writeFileSync as FQ1}from"node:fs";import{dirname as zQ1,resolve as qQ1}from"node:path";var HQ1=15000;function VQ1(X){return Buffer.from(X).toString("base64url")}function BQ1(X){return qQ1(J8(),"rpc","spawn-leases",`${VQ1(X)}.lock`)}function UQ1(X){if(!Number.isInteger(X)||X<=0)return!1;try{return process.kill(X,0),!0}catch{return!1}}function NQ1(X,Y){try{let W=KQ1(X,"utf8"),z=JSON.parse(W),F=Number(z.createdAt??0);if(!Number.isFinite(F)||F<=0)return!0;if(Date.now()-F>Y)return!0;return!UQ1(Number(z.pid??0))}catch{return!0}}function wO(X,Y){let W=Math.max(1000,Y?.ttlMs??HQ1),z=BQ1(X);if(WQ1(zQ1(z),{recursive:!0}),JQ1(z)&&NQ1(z,W))iW0(z,{force:!0});let F;try{F=GQ1(z,"wx");let J={address:X,pid:process.pid,createdAt:Date.now()};FQ1(F,JSON.stringify(J),"utf8")}catch{if(typeof F==="number")try{nW0(F)}catch{}return}let Q=!1;return{path:z,release:()=>{if(Q)return;Q=!0;try{if(typeof F==="number")nW0(F)}catch{}try{iW0(z,{force:!0})}catch{}}}}w6();var aW0=`
877
877
  session_id AS sessionId,
878
878
  source,
879
879
  pid,
@@ -946,4 +946,4 @@ ${W.instructions}`).join(`
946
946
  VALUES (?, ?, ?, ?, ?, NULL)`,[X.rootSessionId,X.parentAgentId,X.task??null,X.systemPrompt??null,Q9()])}claimSpawnRequest(X,Y){let W=this.store.queryOne(`SELECT id, root_session_id, parent_agent_id, task, system_prompt, created_at, consumed_at
947
947
  FROM subagent_spawn_queue
948
948
  WHERE root_session_id = ? AND parent_agent_id = ? AND consumed_at IS NULL
949
- ORDER BY id ASC LIMIT 1`,[X,Y]);if(!W||typeof W.id!=="number")return;let z=Q9();return this.store.run("UPDATE subagent_spawn_queue SET consumed_at = ? WHERE id = ?",[z,W.id]),{id:W.id,rootSessionId:T6(W.root_session_id),parentAgentId:T6(W.parent_agent_id),task:$6(W.task),systemPrompt:$6(W.system_prompt),createdAt:T6(W.created_at),consumedAt:z}}}function HJ1(X={}){return new bO(X)}class M30{manifest;listeners=new Set;constructor(X){this.manifest=xY.parse(X??{workspaces:{}})}async addWorkspacePath(X){let Y=await fK(X);return this.manifest=bA(this.manifest,Y),this.emit({type:"workspace_added",workspace:Y}),Y}async switchWorkspace(X){let Y=oQ(X),W=this.manifest.workspaces[Y];if(W)return this.manifest=xY.parse({...this.manifest,currentWorkspacePath:Y}),this.emit({type:"workspace_switched",workspace:W}),W;let z=await this.addWorkspacePath(Y);return this.manifest=xY.parse({...this.manifest,currentWorkspacePath:z.rootPath}),this.emit({type:"workspace_switched",workspace:z}),z}subscribe(X){return this.listeners.add(X),()=>{this.listeners.delete(X)}}getCurrentWorkspace(){let X=this.manifest.currentWorkspacePath;if(!X)return;return this.manifest.workspaces[X]}getWorkspace(X){let Y=oQ(X);return this.manifest.workspaces[Y]}listWorkspaces(){return Object.values(this.manifest.workspaces)}getManifest(){return this.manifest}emit(X){for(let Y of this.listeners)Y(X)}}gV();async function RP1(){return Promise.resolve().then(() => (R60(),C60))}export{dW0 as withRpcStartupLock,lW0 as waitForCompatibleRpcRuntime,bA as upsertWorkspaceInfo,lQ1 as updateLocalProvider,wO as tryAcquireRpcSpawnLease,gK as toTeamProgressLifecycleEvent,j3 as toPartialAgentConfig,NB as toHookConfigFileName,y7 as startLocalOAuthServer,fV as setHomeDirIfUnset,Ti0 as setHomeDir,$i0 as setClineDirIfUnset,Ii0 as setClineDir,iQ1 as saveLocalProviderSettings,tQ1 as saveLocalProviderOAuthCredentials,WJ as sanitizeSessionToken,yB as resolveWorkflowsConfigSearchPaths,qJ1 as resolveWorkflowSlashCommandFromWatcher,gX as resolveTeamDataDir,ZJ1 as resolveSkillsSlashCommandFromWatcher,SB as resolveSkillsConfigSearchPaths,J8 as resolveSessionDataDir,X30 as resolveSessionBackend,FJ as resolveRuntimeSlashCommandFromWatcher,fB as resolveRulesConfigSearchPaths,xW0 as resolveRpcRuntimeBuildKey,iK as resolveRpcOwnerContext,yV as resolveProviderSettingsPath,q60 as resolvePluginModuleEntries,$B as resolvePluginConfigSearchPaths,kV as resolveMcpSettingsPath,vO as resolveMcpServerRegistrations,sQ1 as resolveLocalClineAuthToken,BB as resolveHooksConfigSearchPaths,t60 as resolveHookLogPath,cW0 as resolveEnsuredRpcRuntime,lZ as resolveDocumentsWorkflowsDirectoryPath,cZ as resolveDocumentsRulesDirectoryPath,F60 as resolveDocumentsPluginsDirectoryPath,I7 as resolveDocumentsHooksDirectoryPath,dZ as resolveDocumentsClineDirectoryPath,Q3 as resolveDocumentsAgentConfigDirectoryPath,tK as resolveDefaultMcpSettingsPath,uV as resolveConfiguredPluginModulePaths,Z3 as resolveClineDir,D9 as resolveClineDataDir,b3 as resolveAndLoadAgentPlugins,vV as resolveAgentsConfigDirPath,v3 as resolveAgentTools,EB as resolveAgentPluginPaths,jV as resolveAgentConfigSearchPaths,FJ1 as requestDesktopToolApproval,z30 as registerMcpServersFromSettingsFile,eB as refreshOpenAICodexToken,ZU as refreshOcaToken,tB as refreshClineToken,uW0 as recordRpcDiscovery,w90 as prewarmFileIndex,wB as parseWorkflowConfigFromMarkdown,LB as parseSkillConfigFromMarkdown,PB as parseRuleConfigFromMarkdown,HB as parsePartialAgentConfigFromYaml,iX as parseAgentConfigFromYaml,Fo0 as openaiCodexOAuthProvider,oQ as normalizeWorkspacePath,cX as normalizeUserInput,Ko0 as normalizeOpenAICodexCredentials,aQ1 as normalizeOAuthProvider,oA as migrateLegacyProviderSettings,HO as makeTeamTaskSubSessionId,cK as makeSubSessionId,e3 as loginOpenAICodex,YG as loginOcaOAuth,oQ1 as loginLocalProvider,t3 as loginClineOAuth,XJ1 as loadRulesForSystemPromptFromWatcher,RP1 as loadOpenTelemetryAdapter,kO as loadMcpSettingsFile,_3 as loadAgentPluginsFromPaths,AB as loadAgentPluginFromPath,pQ1 as listLocalProviders,aX as listHookConfigFiles,D30 as listEnabledRulesFromWatcher,R30 as listAvailableWorkflowsFromWatcher,E30 as listAvailableSkillsFromWatcher,T30 as listAvailableRuntimeCommandsFromWatcher,I30 as isRuleEnabled,s60 as isRpcClineAccountActionRequest,J3 as isPluginModulePath,Go0 as isOpenAICodexTokenExpired,mW0 as isCompatibleRuntime,f7 as identifyAccount,F30 as hasMcpSettingsFile,XU as getValidOpenAICodexCredentials,QU as getValidOcaCredentials,sB as getValidClineCredentials,nQ1 as getLocalProviderModels,C7 as getFileIndex,SP1 as getClineDefaultSystemPrompt,fK as generateWorkspaceInfo,$80 as generateOcaOpcRequestId,$30 as formatRulesForSystemPrompt,e60 as executeRpcClineAccountAction,PO as ensureRpcRuntimeAddress,G3 as ensureParentDir,Li0 as ensureHookLogDir,hJ0 as ensureCustomProvidersLoaded,w3 as enrichPromptWithMentions,aX1 as emptyWorkspaceManifest,gY as emptyStoredProviderSettings,DB as discoverPluginModulePaths,VO as deriveSubsessionStatus,O30 as deleteLocalProvider,jB as createWorkflowsConfigDefinition,l3 as createUserInstructionConfigWatcher,y90 as createToolPoliciesWithPreset,wP1 as createTool,wJ0 as createTeamName,HJ1 as createSqliteRpcSessionBackend,kB as createSkillsConfigDefinition,SO as createSessionHost,vB as createRulesConfigDefinition,Io0 as createOcaRequestHeaders,To0 as createOcaOAuthProvider,hB as createOAuthClientCallbacks,PP1 as createMcpTools,xK as createInitialAccumulatedUsage,k90 as createDefaultToolsWithPreset,lX as createDefaultTools,k3 as createDefaultExecutors,Xo0 as createClineOAuthProvider,tZ as createBuiltinTools,x90 as createAgentConfigWatcher,VB as createAgentConfigDefinition,aZ1 as clearRpcDiscoveryIfAddressMatches,dB as captureToolUsage,mB as captureTokenUsage,bB as captureTaskRestarted,xB as captureTaskCreated,uB as captureTaskCompleted,n3 as captureSubagentExecution,cB as captureSkillUsed,p3 as captureProviderApiError,gB as captureModeSwitch,pB as captureMentionUsed,iB as captureMentionSearchResults,nB as captureMentionFailed,rB as captureHookDiscovery,lB as captureDiffEditFailure,sZ as captureConversationTurnEvent,P7 as captureAuthSucceeded,L7 as captureAuthStarted,S7 as captureAuthLoggedOut,w7 as captureAuthFailed,aB as captureAgentTeamCreated,eZ as captureAgentCreated,uA as buildWorkspaceMetadata,mK as buildTeamProgressSummary,cQ1 as addLocalProvider,ZJ as accumulateUsageTotals,xY as WorkspaceManifestSchema,TJ0 as WorkspaceInfoSchema,gZ as WORKFLOWS_CONFIG_DIRECTORY_NAME,M7 as UnifiedConfigFileWatcher,x4 as ToolPresets,aZ as TelemetryService,x3 as SubprocessSandbox,hK as StoredProviderSettingsSchema,xJ0 as StoredProviderSettingsEntrySchema,tQ as SqliteTeamStore,_Y as SqliteSessionStore,bO as SqliteRpcSessionBackend,YJ as SessionSource,w8 as SKILLS_CONFIG_DIRECTORY_NAME,sA as SESSION_STATUSES,aK as RpcCoreSessionService,eV as RpcClineAccountService,mZ as RULES_CONFIG_DIRECTORY_NAME,V3 as RPC_TEAM_PROGRESS_EVENT_TYPE,B3 as RPC_TEAM_LIFECYCLE_EVENT_TYPE,kW0 as RPC_STARTUP_LOCK_BYPASS_ENV,vW0 as RPC_OWNER_ID_ENV,hW0 as RPC_DISCOVERY_PATH_ENV,jW0 as RPC_BUILD_ID_ENV,dY as ProviderSettingsManager,B80 as OCI_HEADER_OPC_REQUEST_ID,F3 as LoggerTelemetryAdapter,yP1 as LlmsProviders,fP1 as LlmsModels,M30 as InMemoryWorkspaceManager,jO as InMemoryMcpManager,h3 as HookConfigFileName,UB as HOOK_CONFIG_FILE_EVENT_MAP,uZ as HOOKS_CONFIG_DIRECTORY_NAME,X4 as DefaultToolNames,dK as DefaultSessionManager,kK as DefaultRuntimeBuilder,F80 as DEFAULT_INTERNAL_OCA_BASE_URL,G80 as DEFAULT_INTERNAL_IDCS_URL,K80 as DEFAULT_INTERNAL_IDCS_SCOPES,W80 as DEFAULT_INTERNAL_IDCS_CLIENT_ID,V80 as DEFAULT_EXTERNAL_OCA_BASE_URL,q80 as DEFAULT_EXTERNAL_IDCS_URL,H80 as DEFAULT_EXTERNAL_IDCS_SCOPES,z80 as DEFAULT_EXTERNAL_IDCS_CLIENT_ID,rK as CoreSessionService,fO as ClineCore,sV as ClineAccountService,DQ1 as ChatViewStateSchema,W30 as ChatSummarySchema,Z30 as ChatSessionStatusSchema,Y30 as ChatSessionConfigSchema,J30 as ChatMessageSchema,Q30 as ChatMessageRoleSchema,R6 as CORE_TELEMETRY_EVENTS,DO as CORE_BUILD_VERSION,W60 as CLINE_MCP_SETTINGS_FILE_NAME,E7 as ALL_DEFAULT_TOOL_NAMES,Y3 as AGENT_CONFIG_DIRECTORY_NAME};
949
+ ORDER BY id ASC LIMIT 1`,[X,Y]);if(!W||typeof W.id!=="number")return;let z=Q9();return this.store.run("UPDATE subagent_spawn_queue SET consumed_at = ? WHERE id = ?",[z,W.id]),{id:W.id,rootSessionId:T6(W.root_session_id),parentAgentId:T6(W.parent_agent_id),task:$6(W.task),systemPrompt:$6(W.system_prompt),createdAt:T6(W.created_at),consumedAt:z}}}function HJ1(X={}){return new bO(X)}class M30{manifest;listeners=new Set;constructor(X){this.manifest=xY.parse(X??{workspaces:{}})}async addWorkspacePath(X){let Y=await fK(X);return this.manifest=bA(this.manifest,Y),this.emit({type:"workspace_added",workspace:Y}),Y}async switchWorkspace(X){let Y=oQ(X),W=this.manifest.workspaces[Y];if(W)return this.manifest=xY.parse({...this.manifest,currentWorkspacePath:Y}),this.emit({type:"workspace_switched",workspace:W}),W;let z=await this.addWorkspacePath(Y);return this.manifest=xY.parse({...this.manifest,currentWorkspacePath:z.rootPath}),this.emit({type:"workspace_switched",workspace:z}),z}subscribe(X){return this.listeners.add(X),()=>{this.listeners.delete(X)}}getCurrentWorkspace(){let X=this.manifest.currentWorkspacePath;if(!X)return;return this.manifest.workspaces[X]}getWorkspace(X){let Y=oQ(X);return this.manifest.workspaces[Y]}listWorkspaces(){return Object.values(this.manifest.workspaces)}getManifest(){return this.manifest}emit(X){for(let Y of this.listeners)Y(X)}}gV();async function wP1(){return Promise.resolve().then(() => (R60(),C60))}export{dW0 as withRpcStartupLock,lW0 as waitForCompatibleRpcRuntime,bA as upsertWorkspaceInfo,lQ1 as updateLocalProvider,wO as tryAcquireRpcSpawnLease,gK as toTeamProgressLifecycleEvent,j3 as toPartialAgentConfig,NB as toHookConfigFileName,y7 as startLocalOAuthServer,fV as setHomeDirIfUnset,Ti0 as setHomeDir,$i0 as setClineDirIfUnset,Ii0 as setClineDir,iQ1 as saveLocalProviderSettings,tQ1 as saveLocalProviderOAuthCredentials,WJ as sanitizeSessionToken,yB as resolveWorkflowsConfigSearchPaths,qJ1 as resolveWorkflowSlashCommandFromWatcher,gX as resolveTeamDataDir,ZJ1 as resolveSkillsSlashCommandFromWatcher,SB as resolveSkillsConfigSearchPaths,J8 as resolveSessionDataDir,X30 as resolveSessionBackend,FJ as resolveRuntimeSlashCommandFromWatcher,fB as resolveRulesConfigSearchPaths,xW0 as resolveRpcRuntimeBuildKey,iK as resolveRpcOwnerContext,yV as resolveProviderSettingsPath,q60 as resolvePluginModuleEntries,$B as resolvePluginConfigSearchPaths,kV as resolveMcpSettingsPath,vO as resolveMcpServerRegistrations,sQ1 as resolveLocalClineAuthToken,BB as resolveHooksConfigSearchPaths,t60 as resolveHookLogPath,cW0 as resolveEnsuredRpcRuntime,lZ as resolveDocumentsWorkflowsDirectoryPath,cZ as resolveDocumentsRulesDirectoryPath,F60 as resolveDocumentsPluginsDirectoryPath,I7 as resolveDocumentsHooksDirectoryPath,dZ as resolveDocumentsClineDirectoryPath,Q3 as resolveDocumentsAgentConfigDirectoryPath,tK as resolveDefaultMcpSettingsPath,uV as resolveConfiguredPluginModulePaths,Z3 as resolveClineDir,D9 as resolveClineDataDir,b3 as resolveAndLoadAgentPlugins,vV as resolveAgentsConfigDirPath,v3 as resolveAgentTools,EB as resolveAgentPluginPaths,jV as resolveAgentConfigSearchPaths,FJ1 as requestDesktopToolApproval,z30 as registerMcpServersFromSettingsFile,eB as refreshOpenAICodexToken,ZU as refreshOcaToken,tB as refreshClineToken,uW0 as recordRpcDiscovery,w90 as prewarmFileIndex,wB as parseWorkflowConfigFromMarkdown,LB as parseSkillConfigFromMarkdown,PB as parseRuleConfigFromMarkdown,HB as parsePartialAgentConfigFromYaml,iX as parseAgentConfigFromYaml,Fo0 as openaiCodexOAuthProvider,oQ as normalizeWorkspacePath,cX as normalizeUserInput,Ko0 as normalizeOpenAICodexCredentials,aQ1 as normalizeOAuthProvider,oA as migrateLegacyProviderSettings,HO as makeTeamTaskSubSessionId,cK as makeSubSessionId,e3 as loginOpenAICodex,YG as loginOcaOAuth,oQ1 as loginLocalProvider,t3 as loginClineOAuth,XJ1 as loadRulesForSystemPromptFromWatcher,wP1 as loadOpenTelemetryAdapter,kO as loadMcpSettingsFile,_3 as loadAgentPluginsFromPaths,AB as loadAgentPluginFromPath,pQ1 as listLocalProviders,aX as listHookConfigFiles,D30 as listEnabledRulesFromWatcher,R30 as listAvailableWorkflowsFromWatcher,E30 as listAvailableSkillsFromWatcher,T30 as listAvailableRuntimeCommandsFromWatcher,I30 as isRuleEnabled,s60 as isRpcClineAccountActionRequest,J3 as isPluginModulePath,Go0 as isOpenAICodexTokenExpired,mW0 as isCompatibleRuntime,f7 as identifyAccount,F30 as hasMcpSettingsFile,XU as getValidOpenAICodexCredentials,QU as getValidOcaCredentials,sB as getValidClineCredentials,nQ1 as getLocalProviderModels,C7 as getFileIndex,vP1 as getClineDefaultSystemPrompt,fK as generateWorkspaceInfo,$80 as generateOcaOpcRequestId,$30 as formatRulesForSystemPrompt,e60 as executeRpcClineAccountAction,PO as ensureRpcRuntimeAddress,G3 as ensureParentDir,Li0 as ensureHookLogDir,hJ0 as ensureCustomProvidersLoaded,w3 as enrichPromptWithMentions,aX1 as emptyWorkspaceManifest,gY as emptyStoredProviderSettings,DB as discoverPluginModulePaths,VO as deriveSubsessionStatus,O30 as deleteLocalProvider,jB as createWorkflowsConfigDefinition,l3 as createUserInstructionConfigWatcher,y90 as createToolPoliciesWithPreset,kP1 as createTool,wJ0 as createTeamName,HJ1 as createSqliteRpcSessionBackend,kB as createSkillsConfigDefinition,SO as createSessionHost,vB as createRulesConfigDefinition,Io0 as createOcaRequestHeaders,To0 as createOcaOAuthProvider,hB as createOAuthClientCallbacks,yP1 as createMcpTools,xK as createInitialAccumulatedUsage,k90 as createDefaultToolsWithPreset,lX as createDefaultTools,k3 as createDefaultExecutors,Xo0 as createClineOAuthProvider,tZ as createBuiltinTools,x90 as createAgentConfigWatcher,VB as createAgentConfigDefinition,aZ1 as clearRpcDiscoveryIfAddressMatches,dB as captureToolUsage,mB as captureTokenUsage,bB as captureTaskRestarted,xB as captureTaskCreated,uB as captureTaskCompleted,n3 as captureSubagentExecution,cB as captureSkillUsed,p3 as captureProviderApiError,gB as captureModeSwitch,pB as captureMentionUsed,iB as captureMentionSearchResults,nB as captureMentionFailed,rB as captureHookDiscovery,lB as captureDiffEditFailure,sZ as captureConversationTurnEvent,P7 as captureAuthSucceeded,L7 as captureAuthStarted,S7 as captureAuthLoggedOut,w7 as captureAuthFailed,aB as captureAgentTeamCreated,eZ as captureAgentCreated,uA as buildWorkspaceMetadata,mK as buildTeamProgressSummary,cQ1 as addLocalProvider,ZJ as accumulateUsageTotals,xY as WorkspaceManifestSchema,TJ0 as WorkspaceInfoSchema,gZ as WORKFLOWS_CONFIG_DIRECTORY_NAME,M7 as UnifiedConfigFileWatcher,x4 as ToolPresets,aZ as TelemetryService,x3 as SubprocessSandbox,hK as StoredProviderSettingsSchema,xJ0 as StoredProviderSettingsEntrySchema,tQ as SqliteTeamStore,_Y as SqliteSessionStore,bO as SqliteRpcSessionBackend,YJ as SessionSource,w8 as SKILLS_CONFIG_DIRECTORY_NAME,sA as SESSION_STATUSES,aK as RpcCoreSessionService,eV as RpcClineAccountService,mZ as RULES_CONFIG_DIRECTORY_NAME,V3 as RPC_TEAM_PROGRESS_EVENT_TYPE,B3 as RPC_TEAM_LIFECYCLE_EVENT_TYPE,kW0 as RPC_STARTUP_LOCK_BYPASS_ENV,vW0 as RPC_OWNER_ID_ENV,hW0 as RPC_DISCOVERY_PATH_ENV,jW0 as RPC_BUILD_ID_ENV,dY as ProviderSettingsManager,B80 as OCI_HEADER_OPC_REQUEST_ID,F3 as LoggerTelemetryAdapter,hP1 as LlmsProviders,jP1 as LlmsModels,M30 as InMemoryWorkspaceManager,jO as InMemoryMcpManager,h3 as HookConfigFileName,UB as HOOK_CONFIG_FILE_EVENT_MAP,uZ as HOOKS_CONFIG_DIRECTORY_NAME,X4 as DefaultToolNames,dK as DefaultSessionManager,kK as DefaultRuntimeBuilder,F80 as DEFAULT_INTERNAL_OCA_BASE_URL,G80 as DEFAULT_INTERNAL_IDCS_URL,K80 as DEFAULT_INTERNAL_IDCS_SCOPES,W80 as DEFAULT_INTERNAL_IDCS_CLIENT_ID,V80 as DEFAULT_EXTERNAL_OCA_BASE_URL,q80 as DEFAULT_EXTERNAL_IDCS_URL,H80 as DEFAULT_EXTERNAL_IDCS_SCOPES,z80 as DEFAULT_EXTERNAL_IDCS_CLIENT_ID,rK as CoreSessionService,fO as ClineCore,sV as ClineAccountService,DQ1 as ChatViewStateSchema,W30 as ChatSummarySchema,Z30 as ChatSessionStatusSchema,Y30 as ChatSessionConfigSchema,J30 as ChatMessageSchema,Q30 as ChatMessageRoleSchema,R6 as CORE_TELEMETRY_EVENTS,DO as CORE_BUILD_VERSION,W60 as CLINE_MCP_SETTINGS_FILE_NAME,E7 as ALL_DEFAULT_TOOL_NAMES,Y3 as AGENT_CONFIG_DIRECTORY_NAME};