agent-master-mcp
Version:
Model Context Protocol server exposing agent-master functionality to AI assistants for managing MCP server configurations across development tools
2 lines • 481 kB
JavaScript
#!/usr/bin/env node
import{createRequire as PK}from"node:module";var OK=Object.create;var{getPrototypeOf:ZK,defineProperty:NX,getOwnPropertyNames:LK}=Object;var RK=Object.prototype.hasOwnProperty;var T4=($,Q,X)=>{X=$!=null?OK(ZK($)):{};let Y=Q||!$||!$.__esModule?NX(X,"default",{value:$,enumerable:!0}):X;for(let G of LK($))if(!RK.call(Y,G))NX(Y,G,{get:()=>$[G],enumerable:!0});return Y};var M=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var IK=($,Q)=>{for(var X in Q)NX($,X,{get:Q[X],enumerable:!0,configurable:!0,set:(Y)=>Q[X]=()=>Y})};var e=PK(import.meta.url);var n=M((U7)=>{Object.defineProperty(U7,"__esModule",{value:!0});U7.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=U7.DEFAULT_MAX_SEND_MESSAGE_LENGTH=U7.Propagate=U7.LogVerbosity=U7.Status=void 0;var V7;(function($){$[$.OK=0]="OK",$[$.CANCELLED=1]="CANCELLED",$[$.UNKNOWN=2]="UNKNOWN",$[$.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",$[$.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",$[$.NOT_FOUND=5]="NOT_FOUND",$[$.ALREADY_EXISTS=6]="ALREADY_EXISTS",$[$.PERMISSION_DENIED=7]="PERMISSION_DENIED",$[$.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",$[$.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",$[$.ABORTED=10]="ABORTED",$[$.OUT_OF_RANGE=11]="OUT_OF_RANGE",$[$.UNIMPLEMENTED=12]="UNIMPLEMENTED",$[$.INTERNAL=13]="INTERNAL",$[$.UNAVAILABLE=14]="UNAVAILABLE",$[$.DATA_LOSS=15]="DATA_LOSS",$[$.UNAUTHENTICATED=16]="UNAUTHENTICATED"})(V7||(U7.Status=V7={}));var z7;(function($){$[$.DEBUG=0]="DEBUG",$[$.INFO=1]="INFO",$[$.ERROR=2]="ERROR",$[$.NONE=3]="NONE"})(z7||(U7.LogVerbosity=z7={}));var w7;(function($){$[$.DEADLINE=1]="DEADLINE",$[$.CENSUS_STATS_CONTEXT=2]="CENSUS_STATS_CONTEXT",$[$.CENSUS_TRACING_CONTEXT=4]="CENSUS_TRACING_CONTEXT",$[$.CANCELLATION=8]="CANCELLATION",$[$.DEFAULTS=65535]="DEFAULTS"})(w7||(U7.Propagate=w7={}));U7.DEFAULT_MAX_SEND_MESSAGE_LENGTH=-1;U7.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=4194304});var hX=M((mZ,xz)=>{xz.exports={name:"@grpc/grpc-js",version:"1.13.4",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 generate-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 test/fixtures/ -O src/generated/ --grpcLib ../index channelz.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"},dependencies:{"@grpc/proto-loader":"^0.7.13","@js-sdsl/ordered-map":"^4.4.2"},files:["src/**/*.ts","build/src/**/*.{js,d.ts,js.map}","proto/*.proto","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 q0=M((M7)=>{var bX,gX,fX,mX;Object.defineProperty(M7,"__esModule",{value:!0});M7.log=M7.setLoggerVerbosity=M7.setLogger=M7.getLogger=void 0;M7.trace=pz;M7.isTracerEnabled=B7;var Y$=n(),kz=e("process"),vz=hX().version,yz={error:($,...Q)=>{console.error("E "+$,...Q)},info:($,...Q)=>{console.error("I "+$,...Q)},debug:($,...Q)=>{console.error("D "+$,...Q)}},R$=yz,G6=Y$.LogVerbosity.ERROR,_z=(gX=(bX=process.env.GRPC_NODE_VERBOSITY)!==null&&bX!==void 0?bX:process.env.GRPC_VERBOSITY)!==null&&gX!==void 0?gX:"";switch(_z.toUpperCase()){case"DEBUG":G6=Y$.LogVerbosity.DEBUG;break;case"INFO":G6=Y$.LogVerbosity.INFO;break;case"ERROR":G6=Y$.LogVerbosity.ERROR;break;case"NONE":G6=Y$.LogVerbosity.NONE;break;default:}var hz=()=>{return R$};M7.getLogger=hz;var bz=($)=>{R$=$};M7.setLogger=bz;var gz=($)=>{G6=$};M7.setLoggerVerbosity=gz;var fz=($,...Q)=>{let X;if($>=G6){switch($){case Y$.LogVerbosity.DEBUG:X=R$.debug;break;case Y$.LogVerbosity.INFO:X=R$.info;break;case Y$.LogVerbosity.ERROR:X=R$.error;break}if(!X)X=R$.error;if(X)X.bind(R$)(...Q)}};M7.log=fz;var mz=(mX=(fX=process.env.GRPC_NODE_TRACE)!==null&&fX!==void 0?fX:process.env.GRPC_TRACE)!==null&&mX!==void 0?mX:"",uX=new Set,D7=new Set;for(let $ of mz.split(","))if($.startsWith("-"))D7.add($.substring(1));else uX.add($);var uz=uX.has("all");function pz($,Q,X){if(B7(Q))M7.log($,new Date().toISOString()+" | v"+vz+" "+kz.pid+" | "+Q+" | "+X)}function B7($){return!D7.has($)&&(uz||uX.has($))}});var i8=M((A7)=>{Object.defineProperty(A7,"__esModule",{value:!0});A7.getErrorMessage=oz;A7.getErrorCode=az;function oz($){if($ instanceof Error)return $.message;else return String($)}function az($){if(typeof $==="object"&&$!==null&&"code"in $&&typeof $.code==="number")return $.code;else return null}});var v0=M((O7)=>{Object.defineProperty(O7,"__esModule",{value:!0});O7.Metadata=void 0;var tz=q0(),ez=n(),$w=i8(),Qw=/^[0-9a-z_.-]+$/,Xw=/^[ -~]*$/;function Yw($){return Qw.test($)}function Gw($){return Xw.test($)}function E7($){return $.endsWith("-bin")}function Jw($){return!$.startsWith("grpc-")}function o8($){return $.toLowerCase()}function N7($,Q){if(!Yw($))throw new Error('Metadata key "'+$+'" contains illegal characters');if(Q!==null&&Q!==void 0)if(E7($)){if(!Buffer.isBuffer(Q))throw new Error("keys that end with '-bin' must have Buffer values")}else{if(Buffer.isBuffer(Q))throw new Error("keys that don't end with '-bin' must have String values");if(!Gw(Q))throw new Error('Metadata string value "'+Q+'" contains illegal characters')}}class a8{constructor($={}){this.internalRepr=new Map,this.options=$}set($,Q){$=o8($),N7($,Q),this.internalRepr.set($,[Q])}add($,Q){$=o8($),N7($,Q);let X=this.internalRepr.get($);if(X===void 0)this.internalRepr.set($,[Q]);else X.push(Q)}remove($){$=o8($),this.internalRepr.delete($)}get($){return $=o8($),this.internalRepr.get($)||[]}getMap(){let $={};for(let[Q,X]of this.internalRepr)if(X.length>0){let Y=X[0];$[Q]=Buffer.isBuffer(Y)?Buffer.from(Y):Y}return $}clone(){let $=new a8(this.options),Q=$.internalRepr;for(let[X,Y]of this.internalRepr){let G=Y.map((J)=>{if(Buffer.isBuffer(J))return Buffer.from(J);else return J});Q.set(X,G)}return $}merge($){for(let[Q,X]of $.internalRepr){let Y=(this.internalRepr.get(Q)||[]).concat(X);this.internalRepr.set(Q,Y)}}setOptions($){this.options=$}getOptions(){return this.options}toHttp2Headers(){let $={};for(let[Q,X]of this.internalRepr)$[Q]=X.map(Ww);return $}toJSON(){let $={};for(let[Q,X]of this.internalRepr)$[Q]=X;return $}static fromHttp2Headers($){let Q=new a8;for(let X of Object.keys($)){if(X.charAt(0)===":")continue;let Y=$[X];try{if(E7(X)){if(Array.isArray(Y))Y.forEach((G)=>{Q.add(X,Buffer.from(G,"base64"))});else if(Y!==void 0)if(Jw(X))Y.split(",").forEach((G)=>{Q.add(X,Buffer.from(G.trim(),"base64"))});else Q.add(X,Buffer.from(Y,"base64"))}else if(Array.isArray(Y))Y.forEach((G)=>{Q.add(X,G)});else if(Y!==void 0)Q.add(X,Y)}catch(G){let J=`Failed to add metadata entry ${X}: ${Y}. ${$w.getErrorMessage(G)}. For more information see https://github.com/grpc/grpc-node/issues/1173`;tz.log(ez.LogVerbosity.ERROR,J)}}return Q}}O7.Metadata=a8;var Ww=($)=>{return Buffer.isBuffer($)?$.toString("base64"):$}});var s8=M((L7)=>{Object.defineProperty(L7,"__esModule",{value:!0});L7.CallCredentials=void 0;var cX=v0();function qw($){return"getRequestHeaders"in $&&typeof $.getRequestHeaders==="function"}class J6{static createFromMetadataGenerator($){return new dX($)}static createFromGoogleCredential($){return J6.createFromMetadataGenerator((Q,X)=>{let Y;if(qw($))Y=$.getRequestHeaders(Q.service_url);else Y=new Promise((G,J)=>{$.getRequestMetadata(Q.service_url,(W,q)=>{if(W){J(W);return}if(!q){J(new Error("Headers not set by metadata plugin"));return}G(q)})});Y.then((G)=>{let J=new cX.Metadata;for(let W of Object.keys(G))J.add(W,G[W]);X(null,J)},(G)=>{X(G)})})}static createEmpty(){return new lX}}L7.CallCredentials=J6;class r8 extends J6{constructor($){super();this.creds=$}async generateMetadata($){let Q=new cX.Metadata,X=await Promise.all(this.creds.map((Y)=>Y.generateMetadata($)));for(let Y of X)Q.merge(Y);return Q}compose($){return new r8(this.creds.concat([$]))}_equals($){if(this===$)return!0;if($ instanceof r8)return this.creds.every((Q,X)=>Q._equals($.creds[X]));else return!1}}class dX extends J6{constructor($){super();this.metadataGenerator=$}generateMetadata($){return new Promise((Q,X)=>{this.metadataGenerator($,(Y,G)=>{if(G!==void 0)Q(G);else X(Y)})})}compose($){return new r8([this,$])}_equals($){if(this===$)return!0;if($ instanceof dX)return this.metadataGenerator===$.metadataGenerator;else return!1}}class lX extends J6{generateMetadata($){return Promise.resolve(new cX.Metadata)}compose($){return $}_equals($){return $ instanceof lX}}});var iX=M((P7)=>{Object.defineProperty(P7,"__esModule",{value:!0});P7.CIPHER_SUITES=void 0;P7.getDefaultRootsData=Kw;var Hw=e("fs");P7.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;var I7=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH,nX=null;function Kw(){if(I7){if(nX===null)nX=Hw.readFileSync(I7);return nX}return null}});var m0=M((T7)=>{Object.defineProperty(T7,"__esModule",{value:!0});T7.parseUri=ww;T7.splitHostPort=Uw;T7.combineHostPort=Fw;T7.uriToString=Dw;var zw=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;function ww($){let Q=zw.exec($);if(Q===null)return null;return{scheme:Q[1],authority:Q[2],path:Q[3]}}var j7=/^\d+$/;function Uw($){if($.startsWith("[")){let Q=$.indexOf("]");if(Q===-1)return null;let X=$.substring(1,Q);if(X.indexOf(":")===-1)return null;if($.length>Q+1)if($[Q+1]===":"){let Y=$.substring(Q+2);if(j7.test(Y))return{host:X,port:+Y};else return null}else return null;else return{host:X}}else{let Q=$.split(":");if(Q.length===2)if(j7.test(Q[1]))return{host:Q[0],port:+Q[1]};else return null;else return{host:$}}}function Fw($){if($.port===void 0)return $.host;else if($.host.includes(":"))return`[${$.host}]:${$.port}`;else return`${$.host}:${$.port}`}function Dw($){let Q="";if($.scheme!==void 0)Q+=$.scheme+":";if($.authority!==void 0)Q+="//"+$.authority+"/";return Q+=$.path,Q}});var R1=M((C7)=>{Object.defineProperty(C7,"__esModule",{value:!0});C7.registerResolver=Ew;C7.registerDefaultScheme=Ow;C7.createResolver=Zw;C7.getDefaultAuthority=Lw;C7.mapUriDefaultScheme=Rw;var aX=m0(),W6={},oX=null;function Ew($,Q){W6[$]=Q}function Ow($){oX=$}function Zw($,Q,X){if($.scheme!==void 0&&$.scheme in W6)return new W6[$.scheme]($,Q,X);else throw new Error(`No resolver could be created for target ${aX.uriToString($)}`)}function Lw($){if($.scheme!==void 0&&$.scheme in W6)return W6[$.scheme].getDefaultAuthority($);else throw new Error(`Invalid target ${aX.uriToString($)}`)}function Rw($){if($.scheme===void 0||!($.scheme in W6))if(oX!==null)return{scheme:oX,authority:void 0,path:aX.uriToString($)};else return null;return $}});var i6=M((y7)=>{Object.defineProperty(y7,"__esModule",{value:!0});y7.ChannelCredentials=void 0;y7.createCertificateProviderChannelCredentials=vw;var n6=e("tls"),$Q=s8(),sX=iX(),x7=m0(),Cw=R1(),xw=q0(),kw=n();function rX($,Q){if($&&!($ instanceof Buffer))throw new TypeError(`${Q}, if provided, must be a Buffer.`)}class q6{compose($){return new e8(this,$)}static createSsl($,Q,X,Y){var G;if(rX($,"Root certificate"),rX(Q,"Private key"),rX(X,"Certificate chain"),Q&&!X)throw new Error("Private key must be given with accompanying certificate chain");if(!Q&&X)throw new Error("Certificate chain must be given with accompanying private key");let J=n6.createSecureContext({ca:(G=$!==null&&$!==void 0?$:sX.getDefaultRootsData())!==null&&G!==void 0?G:void 0,key:Q!==null&&Q!==void 0?Q:void 0,cert:X!==null&&X!==void 0?X:void 0,ciphers:sX.CIPHER_SUITES});return new t8(J,Y!==null&&Y!==void 0?Y:{})}static createFromSecureContext($,Q){return new t8($,Q!==null&&Q!==void 0?Q:{})}static createInsecure(){return new tX}}y7.ChannelCredentials=q6;class tX extends q6{constructor(){super()}compose($){throw new Error("Cannot compose insecure credentials")}_isSecure(){return!1}_equals($){return $ instanceof tX}_createSecureConnector($,Q,X){return{connect(Y){return Promise.resolve({socket:Y,secure:!1})},waitForReady:()=>{return Promise.resolve()},getCallCredentials:()=>{return X!==null&&X!==void 0?X:$Q.CallCredentials.createEmpty()},destroy(){}}}}function k7($,Q,X,Y){var G,J;let W={secureContext:$},q=X;if("grpc.http_connect_target"in Y){let U=x7.parseUri(Y["grpc.http_connect_target"]);if(U)q=U}let H=Cw.getDefaultAuthority(q),K=x7.splitHostPort(H),z=(G=K===null||K===void 0?void 0:K.host)!==null&&G!==void 0?G:H;if(W.host=z,Q.checkServerIdentity)W.checkServerIdentity=Q.checkServerIdentity;if(Q.rejectUnauthorized!==void 0)W.rejectUnauthorized=Q.rejectUnauthorized;if(W.ALPNProtocols=["h2"],Y["grpc.ssl_target_name_override"]){let U=Y["grpc.ssl_target_name_override"],F=(J=W.checkServerIdentity)!==null&&J!==void 0?J:n6.checkServerIdentity;W.checkServerIdentity=(D,A)=>{return F(U,A)},W.servername=U}else W.servername=z;if(Y["grpc-node.tls_enable_trace"])W.enableTrace=!0;return W}class v7{constructor($,Q){this.connectionOptions=$,this.callCredentials=Q}connect($){let Q=Object.assign({socket:$},this.connectionOptions);return new Promise((X,Y)=>{let G=n6.connect(Q,()=>{var J;if(((J=this.connectionOptions.rejectUnauthorized)!==null&&J!==void 0?J:!0)&&!G.authorized){Y(G.authorizationError);return}X({socket:G,secure:!0})});G.on("error",(J)=>{Y(J)})})}waitForReady(){return Promise.resolve()}getCallCredentials(){return this.callCredentials}destroy(){}}class t8 extends q6{constructor($,Q){super();this.secureContext=$,this.verifyOptions=Q}_isSecure(){return!0}_equals($){if(this===$)return!0;if($ instanceof t8)return this.secureContext===$.secureContext&&this.verifyOptions.checkServerIdentity===$.verifyOptions.checkServerIdentity;else return!1}_createSecureConnector($,Q,X){let Y=k7(this.secureContext,this.verifyOptions,$,Q);return new v7(Y,X!==null&&X!==void 0?X:$Q.CallCredentials.createEmpty())}}class l6 extends q6{constructor($,Q,X){super();this.caCertificateProvider=$,this.identityCertificateProvider=Q,this.verifyOptions=X,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($){var Q,X;if(this===$)return!0;if($ instanceof l6)return this.caCertificateProvider===$.caCertificateProvider&&this.identityCertificateProvider===$.identityCertificateProvider&&((Q=this.verifyOptions)===null||Q===void 0?void 0:Q.checkServerIdentity)===((X=$.verifyOptions)===null||X===void 0?void 0:X.checkServerIdentity);else return!1}ref(){var $;if(this.refcount===0)this.caCertificateProvider.addCaCertificateListener(this.caCertificateUpdateListener),($=this.identityCertificateProvider)===null||$===void 0||$.addIdentityCertificateListener(this.identityCertificateUpdateListener);this.refcount+=1}unref(){var $;if(this.refcount-=1,this.refcount===0)this.caCertificateProvider.removeCaCertificateListener(this.caCertificateUpdateListener),($=this.identityCertificateProvider)===null||$===void 0||$.removeIdentityCertificateListener(this.identityCertificateUpdateListener)}_createSecureConnector($,Q,X){return this.ref(),new l6.SecureConnectorImpl(this,$,Q,X!==null&&X!==void 0?X:$Q.CallCredentials.createEmpty())}maybeUpdateWatchers(){if(this.hasReceivedUpdates()){for(let $ of this.secureContextWatchers)$(this.getLatestSecureContext());this.secureContextWatchers=[]}}handleCaCertificateUpdate($){this.latestCaUpdate=$,this.maybeUpdateWatchers()}handleIdentityCertitificateUpdate($){this.latestIdentityUpdate=$,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(($)=>{this.secureContextWatchers.push($)})}getLatestSecureContext(){var $,Q;if(!this.latestCaUpdate)return null;if(this.identityCertificateProvider!==null&&!this.latestIdentityUpdate)return null;try{return n6.createSecureContext({ca:this.latestCaUpdate.caCertificate,key:($=this.latestIdentityUpdate)===null||$===void 0?void 0:$.privateKey,cert:(Q=this.latestIdentityUpdate)===null||Q===void 0?void 0:Q.certificate,ciphers:sX.CIPHER_SUITES})}catch(X){return xw.log(kw.LogVerbosity.ERROR,"Failed to createSecureContext with error "+X.message),null}}}l6.SecureConnectorImpl=class{constructor($,Q,X,Y){this.parent=$,this.channelTarget=Q,this.options=X,this.callCredentials=Y}connect($){return new Promise((Q,X)=>{let Y=this.parent.getLatestSecureContext();if(!Y){X(new Error("Failed to load credentials"));return}if($.closed)X(new Error("Socket closed while loading credentials"));let G=k7(Y,this.parent.verifyOptions,this.channelTarget,this.options),J=Object.assign({socket:$},G),W=()=>{X(new Error("Socket closed"))},q=(K)=>{X(K)},H=n6.connect(J,()=>{var K;if(H.removeListener("close",W),H.removeListener("error",q),((K=this.parent.verifyOptions.rejectUnauthorized)!==null&&K!==void 0?K:!0)&&!H.authorized){X(H.authorizationError);return}Q({socket:H,secure:!0})});H.once("close",W),H.once("error",q)})}async waitForReady(){await this.parent.getSecureContext()}getCallCredentials(){return this.callCredentials}destroy(){this.parent.unref()}};function vw($,Q,X){return new l6($,Q,X!==null&&X!==void 0?X:{})}class e8 extends q6{constructor($,Q){super();if(this.channelCredentials=$,this.callCredentials=Q,!$._isSecure())throw new Error("Cannot compose insecure credentials")}compose($){let Q=this.callCredentials.compose($);return new e8(this.channelCredentials,Q)}_isSecure(){return!0}_equals($){if(this===$)return!0;if($ instanceof e8)return this.channelCredentials._equals($.channelCredentials)&&this.callCredentials._equals($.callCredentials);else return!1}_createSecureConnector($,Q,X){let Y=this.callCredentials.compose(X!==null&&X!==void 0?X:$Q.CallCredentials.createEmpty());return this.channelCredentials._createSecureConnector($,Q,Y)}}});var I$=M((b7)=>{Object.defineProperty(b7,"__esModule",{value:!0});b7.createChildChannelControlHelper=bw;b7.registerLoadBalancerType=gw;b7.registerDefaultLoadBalancerType=fw;b7.createLoadBalancer=mw;b7.isLoadBalancerNameRegistered=uw;b7.parseLoadBalancingConfig=h7;b7.getDefaultConfig=pw;b7.selectLbConfigFromList=cw;var _w=q0(),hw=n();function bw($,Q){var X,Y,G,J,W,q,H,K,z,U;return{createSubchannel:(Y=(X=Q.createSubchannel)===null||X===void 0?void 0:X.bind(Q))!==null&&Y!==void 0?Y:$.createSubchannel.bind($),updateState:(J=(G=Q.updateState)===null||G===void 0?void 0:G.bind(Q))!==null&&J!==void 0?J:$.updateState.bind($),requestReresolution:(q=(W=Q.requestReresolution)===null||W===void 0?void 0:W.bind(Q))!==null&&q!==void 0?q:$.requestReresolution.bind($),addChannelzChild:(K=(H=Q.addChannelzChild)===null||H===void 0?void 0:H.bind(Q))!==null&&K!==void 0?K:$.addChannelzChild.bind($),removeChannelzChild:(U=(z=Q.removeChannelzChild)===null||z===void 0?void 0:z.bind(Q))!==null&&U!==void 0?U:$.removeChannelzChild.bind($)}}var G$={},o6=null;function gw($,Q,X){G$[$]={LoadBalancer:Q,LoadBalancingConfig:X}}function fw($){o6=$}function mw($,Q){let X=$.getLoadBalancerName();if(X in G$)return new G$[X].LoadBalancer(Q);else return null}function uw($){return $ in G$}function h7($){let Q=Object.keys($);if(Q.length!==1)throw new Error("Provided load balancing config has multiple conflicting entries");let X=Q[0];if(X in G$)try{return G$[X].LoadBalancingConfig.createFromJson($[X])}catch(Y){throw new Error(`${X}: ${Y.message}`)}else throw new Error(`Unrecognized load balancing config name ${X}`)}function pw(){if(!o6)throw new Error("No default load balancer type registered");return new G$[o6].LoadBalancingConfig}function cw($,Q=!1){for(let X of $)try{return h7(X)}catch(Y){_w.log(hw.LogVerbosity.DEBUG,"Config parsing failed with error",Y.message);continue}if(Q)if(o6)return new G$[o6].LoadBalancingConfig;else return null;else return null}});var eX=M((m7)=>{Object.defineProperty(m7,"__esModule",{value:!0});m7.validateRetryThrottling=g7;m7.validateServiceConfig=f7;m7.extractAndSelectServiceConfig=qU;var tw=e("os"),QQ=n(),XQ=/^\d+(\.\d{1,9})?s$/,ew="node";function $U($){if("service"in $&&$.service!==""){if(typeof $.service!=="string")throw new Error(`Invalid method config name: invalid service: expected type string, got ${typeof $.service}`);if("method"in $&&$.method!==""){if(typeof $.method!=="string")throw new Error(`Invalid method config name: invalid method: expected type string, got ${typeof $.service}`);return{service:$.service,method:$.method}}else return{service:$.service}}else{if("method"in $&&$.method!==void 0)throw new Error("Invalid method config name: method set with empty or unset service");return{}}}function QU($){if(!("maxAttempts"in $)||!Number.isInteger($.maxAttempts)||$.maxAttempts<2)throw new Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");if(!("initialBackoff"in $)||typeof $.initialBackoff!=="string"||!XQ.test($.initialBackoff))throw new Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("maxBackoff"in $)||typeof $.maxBackoff!=="string"||!XQ.test($.maxBackoff))throw new Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("backoffMultiplier"in $)||typeof $.backoffMultiplier!=="number"||$.backoffMultiplier<=0)throw new Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");if(!(("retryableStatusCodes"in $)&&Array.isArray($.retryableStatusCodes)))throw new Error("Invalid method config retry policy: retryableStatusCodes is required");if($.retryableStatusCodes.length===0)throw new Error("Invalid method config retry policy: retryableStatusCodes must be non-empty");for(let Q of $.retryableStatusCodes)if(typeof Q==="number"){if(!Object.values(QQ.Status).includes(Q))throw new Error("Invalid method config retry policy: retryableStatusCodes value not in status code range")}else if(typeof Q==="string"){if(!Object.values(QQ.Status).includes(Q.toUpperCase()))throw new Error("Invalid method config retry policy: retryableStatusCodes value not a status code name")}else throw new Error("Invalid method config retry policy: retryableStatusCodes value must be a string or number");return{maxAttempts:$.maxAttempts,initialBackoff:$.initialBackoff,maxBackoff:$.maxBackoff,backoffMultiplier:$.backoffMultiplier,retryableStatusCodes:$.retryableStatusCodes}}function XU($){if(!("maxAttempts"in $)||!Number.isInteger($.maxAttempts)||$.maxAttempts<2)throw new Error("Invalid method config hedging policy: maxAttempts must be an integer at least 2");if("hedgingDelay"in $&&(typeof $.hedgingDelay!=="string"||!XQ.test($.hedgingDelay)))throw new Error("Invalid method config hedging policy: hedgingDelay must be a string consisting of a positive integer followed by s");if("nonFatalStatusCodes"in $&&Array.isArray($.nonFatalStatusCodes))for(let X of $.nonFatalStatusCodes)if(typeof X==="number"){if(!Object.values(QQ.Status).includes(X))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not in status code range")}else if(typeof X==="string"){if(!Object.values(QQ.Status).includes(X.toUpperCase()))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not a status code name")}else throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value must be a string or number");let Q={maxAttempts:$.maxAttempts};if($.hedgingDelay)Q.hedgingDelay=$.hedgingDelay;if($.nonFatalStatusCodes)Q.nonFatalStatusCodes=$.nonFatalStatusCodes;return Q}function YU($){var Q;let X={name:[]};if(!("name"in $)||!Array.isArray($.name))throw new Error("Invalid method config: invalid name array");for(let Y of $.name)X.name.push($U(Y));if("waitForReady"in $){if(typeof $.waitForReady!=="boolean")throw new Error("Invalid method config: invalid waitForReady");X.waitForReady=$.waitForReady}if("timeout"in $)if(typeof $.timeout==="object"){if(!("seconds"in $.timeout)||typeof $.timeout.seconds!=="number")throw new Error("Invalid method config: invalid timeout.seconds");if(!("nanos"in $.timeout)||typeof $.timeout.nanos!=="number")throw new Error("Invalid method config: invalid timeout.nanos");X.timeout=$.timeout}else if(typeof $.timeout==="string"&&XQ.test($.timeout)){let Y=$.timeout.substring(0,$.timeout.length-1).split(".");X.timeout={seconds:Y[0]|0,nanos:((Q=Y[1])!==null&&Q!==void 0?Q:0)|0}}else throw new Error("Invalid method config: invalid timeout");if("maxRequestBytes"in $){if(typeof $.maxRequestBytes!=="number")throw new Error("Invalid method config: invalid maxRequestBytes");X.maxRequestBytes=$.maxRequestBytes}if("maxResponseBytes"in $){if(typeof $.maxResponseBytes!=="number")throw new Error("Invalid method config: invalid maxRequestBytes");X.maxResponseBytes=$.maxResponseBytes}if("retryPolicy"in $)if("hedgingPolicy"in $)throw new Error("Invalid method config: retryPolicy and hedgingPolicy cannot both be specified");else X.retryPolicy=QU($.retryPolicy);else if("hedgingPolicy"in $)X.hedgingPolicy=XU($.hedgingPolicy);return X}function g7($){if(!("maxTokens"in $)||typeof $.maxTokens!=="number"||$.maxTokens<=0||$.maxTokens>1000)throw new Error("Invalid retryThrottling: maxTokens must be a number in (0, 1000]");if(!("tokenRatio"in $)||typeof $.tokenRatio!=="number"||$.tokenRatio<=0)throw new Error("Invalid retryThrottling: tokenRatio must be a number greater than 0");return{maxTokens:+$.maxTokens.toFixed(3),tokenRatio:+$.tokenRatio.toFixed(3)}}function GU($){if(!(typeof $==="object"&&$!==null))throw new Error(`Invalid loadBalancingConfig: unexpected type ${typeof $}`);let Q=Object.keys($);if(Q.length>1)throw new Error(`Invalid loadBalancingConfig: unexpected multiple keys ${Q}`);if(Q.length===0)throw new Error("Invalid loadBalancingConfig: load balancing policy name required");return{[Q[0]]:$[Q[0]]}}function f7($){let Q={loadBalancingConfig:[],methodConfig:[]};if("loadBalancingPolicy"in $)if(typeof $.loadBalancingPolicy==="string")Q.loadBalancingPolicy=$.loadBalancingPolicy;else throw new Error("Invalid service config: invalid loadBalancingPolicy");if("loadBalancingConfig"in $)if(Array.isArray($.loadBalancingConfig))for(let Y of $.loadBalancingConfig)Q.loadBalancingConfig.push(GU(Y));else throw new Error("Invalid service config: invalid loadBalancingConfig");if("methodConfig"in $){if(Array.isArray($.methodConfig))for(let Y of $.methodConfig)Q.methodConfig.push(YU(Y))}if("retryThrottling"in $)Q.retryThrottling=g7($.retryThrottling);let X=[];for(let Y of Q.methodConfig)for(let G of Y.name){for(let J of X)if(G.service===J.service&&G.method===J.method)throw new Error(`Invalid service config: duplicate name ${G.service}/${G.method}`);X.push(G)}return Q}function JU($){if(!("serviceConfig"in $))throw new Error("Invalid service config choice: missing service config");let Q={serviceConfig:f7($.serviceConfig)};if("clientLanguage"in $)if(Array.isArray($.clientLanguage)){Q.clientLanguage=[];for(let Y of $.clientLanguage)if(typeof Y==="string")Q.clientLanguage.push(Y);else throw new Error("Invalid service config choice: invalid clientLanguage")}else throw new Error("Invalid service config choice: invalid clientLanguage");if("clientHostname"in $)if(Array.isArray($.clientHostname)){Q.clientHostname=[];for(let Y of $.clientHostname)if(typeof Y==="string")Q.clientHostname.push(Y);else throw new Error("Invalid service config choice: invalid clientHostname")}else throw new Error("Invalid service config choice: invalid clientHostname");if("percentage"in $)if(typeof $.percentage==="number"&&0<=$.percentage&&$.percentage<=100)Q.percentage=$.percentage;else throw new Error("Invalid service config choice: invalid percentage");let X=["clientLanguage","percentage","clientHostname","serviceConfig"];for(let Y in $)if(!X.includes(Y))throw new Error(`Invalid service config choice: unexpected field ${Y}`);return Q}function WU($,Q){if(!Array.isArray($))throw new Error("Invalid service config list");for(let X of $){let Y=JU(X);if(typeof Y.percentage==="number"&&Q>Y.percentage)continue;if(Array.isArray(Y.clientHostname)){let G=!1;for(let J of Y.clientHostname)if(J===tw.hostname())G=!0;if(!G)continue}if(Array.isArray(Y.clientLanguage)){let G=!1;for(let J of Y.clientLanguage)if(J===ew)G=!0;if(!G)continue}return Y.serviceConfig}throw new Error("No matching service config found")}function qU($,Q){for(let X of $)if(X.length>0&&X[0].startsWith("grpc_config=")){let Y=X.join("").substring(12),G=JSON.parse(Y);return WU(G,Q)}return null}});var r0=M((p7)=>{Object.defineProperty(p7,"__esModule",{value:!0});p7.ConnectivityState=void 0;var u7;(function($){$[$.IDLE=0]="IDLE",$[$.CONNECTING=1]="CONNECTING",$[$.READY=2]="READY",$[$.TRANSIENT_FAILURE=3]="TRANSIENT_FAILURE",$[$.SHUTDOWN=4]="SHUTDOWN"})(u7||(p7.ConnectivityState=u7={}))});var J$=M((n7)=>{Object.defineProperty(n7,"__esModule",{value:!0});n7.QueuePicker=n7.UnavailablePicker=n7.PickResultType=void 0;var zU=v0(),wU=n(),YQ;(function($){$[$.COMPLETE=0]="COMPLETE",$[$.QUEUE=1]="QUEUE",$[$.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",$[$.DROP=3]="DROP"})(YQ||(n7.PickResultType=YQ={}));class d7{constructor($){this.status=Object.assign({code:wU.Status.UNAVAILABLE,details:"No connection established",metadata:new zU.Metadata},$)}pick($){return{pickResultType:YQ.TRANSIENT_FAILURE,subchannel:null,status:this.status,onCallStarted:null,onCallEnded:null}}}n7.UnavailablePicker=d7;class l7{constructor($,Q){this.loadBalancer=$,this.childPicker=Q,this.calledExitIdle=!1}pick($){if(!this.calledExitIdle)process.nextTick(()=>{this.loadBalancer.exitIdle()}),this.calledExitIdle=!0;if(this.childPicker)return this.childPicker.pick($);else return{pickResultType:YQ.QUEUE,subchannel:null,status:null,onCallStarted:null,onCallEnded:null}}}n7.QueuePicker=l7});var a6=M((o7)=>{Object.defineProperty(o7,"__esModule",{value:!0});o7.BackoffTimeout=void 0;var DU=n(),BU=q0(),MU="backoff",AU=1000,NU=1.6,EU=120000,OU=0.2;function ZU($,Q){return Math.random()*(Q-$)+$}class GQ{constructor($,Q){if(this.callback=$,this.initialDelay=AU,this.multiplier=NU,this.maxDelay=EU,this.jitter=OU,this.running=!1,this.hasRef=!0,this.startTime=new Date,this.endTime=new Date,this.id=GQ.getNextId(),Q){if(Q.initialDelay)this.initialDelay=Q.initialDelay;if(Q.multiplier)this.multiplier=Q.multiplier;if(Q.jitter)this.jitter=Q.jitter;if(Q.maxDelay)this.maxDelay=Q.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($){BU.trace(DU.LogVerbosity.DEBUG,MU,"{"+this.id+"} "+$)}runTimer($){var Q,X;if(this.trace("runTimer(delay="+$+")"),this.endTime=this.startTime,this.endTime.setMilliseconds(this.endTime.getMilliseconds()+$),clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.trace("timer fired"),this.running=!1,this.callback()},$),!this.hasRef)(X=(Q=this.timerId).unref)===null||X===void 0||X.call(Q)}runOnce(){this.trace("runOnce()"),this.running=!0,this.startTime=new Date,this.runTimer(this.nextDelay);let $=Math.min(this.nextDelay*this.multiplier,this.maxDelay),Q=$*this.jitter;this.nextDelay=$+ZU(-Q,Q)}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 $=new Date,Q=this.startTime;if(Q.setMilliseconds(Q.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),$<Q)this.runTimer(Q.getTime()-$.getTime());else this.running=!1}}isRunning(){return this.running}ref(){var $,Q;this.hasRef=!0,(Q=($=this.timerId).ref)===null||Q===void 0||Q.call($)}unref(){var $,Q;this.hasRef=!1,(Q=($=this.timerId).unref)===null||Q===void 0||Q.call($)}getEndTime(){return this.endTime}}o7.BackoffTimeout=GQ;GQ.nextId=0});var JQ=M((s7)=>{Object.defineProperty(s7,"__esModule",{value:!0});s7.ChildLoadBalancerHandler=void 0;var LU=I$(),RU=r0(),IU="child_load_balancer_helper";class r7{constructor($){this.channelControlHelper=$,this.currentChild=null,this.pendingChild=null,this.latestConfig=null,this.ChildPolicyHelper=class{constructor(Q){this.parent=Q,this.child=null}createSubchannel(Q,X){return this.parent.channelControlHelper.createSubchannel(Q,X)}updateState(Q,X,Y){var G;if(this.calledByPendingChild()){if(Q===RU.ConnectivityState.CONNECTING)return;(G=this.parent.currentChild)===null||G===void 0||G.destroy(),this.parent.currentChild=this.parent.pendingChild,this.parent.pendingChild=null}else if(!this.calledByCurrentChild())return;this.parent.channelControlHelper.updateState(Q,X,Y)}requestReresolution(){var Q;let X=(Q=this.parent.pendingChild)!==null&&Q!==void 0?Q:this.parent.currentChild;if(this.child===X)this.parent.channelControlHelper.requestReresolution()}setChild(Q){this.child=Q}addChannelzChild(Q){this.parent.channelControlHelper.addChannelzChild(Q)}removeChannelzChild(Q){this.parent.channelControlHelper.removeChannelzChild(Q)}calledByPendingChild(){return this.child===this.parent.pendingChild}calledByCurrentChild(){return this.child===this.parent.currentChild}}}configUpdateRequiresNewPolicyInstance($,Q){return $.getLoadBalancerName()!==Q.getLoadBalancerName()}updateAddressList($,Q,X){let Y;if(this.currentChild===null||this.latestConfig===null||this.configUpdateRequiresNewPolicyInstance(this.latestConfig,Q)){let G=new this.ChildPolicyHelper(this),J=LU.createLoadBalancer(Q,G);if(G.setChild(J),this.currentChild===null)this.currentChild=J,Y=this.currentChild;else{if(this.pendingChild)this.pendingChild.destroy();this.pendingChild=J,Y=this.pendingChild}}else if(this.pendingChild===null)Y=this.currentChild;else Y=this.pendingChild;this.latestConfig=Q,Y.updateAddressList($,Q,X)}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 IU}}s7.ChildLoadBalancerHandler=r7});var YG=M((QG)=>{Object.defineProperty(QG,"__esModule",{value:!0});QG.ResolvingLoadBalancer=void 0;var PU=I$(),SU=eX(),u0=r0(),jU=R1(),r6=J$(),TU=a6(),$Y=n(),CU=v0(),xU=q0(),kU=n(),vU=m0(),yU=JQ(),_U="resolving_load_balancer";function e7($){xU.trace(kU.LogVerbosity.DEBUG,_U,$)}var hU=["SERVICE_AND_METHOD","SERVICE","EMPTY"];function bU($,Q,X,Y){for(let G of X.name)switch(Y){case"EMPTY":if(!G.service&&!G.method)return!0;break;case"SERVICE":if(G.service===$&&!G.method)return!0;break;case"SERVICE_AND_METHOD":if(G.service===$&&G.method===Q)return!0}return!1}function gU($,Q,X,Y){for(let G of X)if(bU($,Q,G,Y))return G;return null}function fU($){return{invoke(Q,X){var Y,G;let J=Q.split("/").filter((H)=>H.length>0),W=(Y=J[0])!==null&&Y!==void 0?Y:"",q=(G=J[1])!==null&&G!==void 0?G:"";if($&&$.methodConfig)for(let H of hU){let K=gU(W,q,$.methodConfig,H);if(K)return{methodConfig:K,pickInformation:{},status:$Y.Status.OK,dynamicFilterFactories:[]}}return{methodConfig:{name:[]},pickInformation:{},status:$Y.Status.OK,dynamicFilterFactories:[]}},unref(){}}}class $G{constructor($,Q,X,Y,G){if(this.target=$,this.channelControlHelper=Q,this.channelOptions=X,this.onSuccessfulResolution=Y,this.onFailedResolution=G,this.latestChildState=u0.ConnectivityState.IDLE,this.latestChildPicker=new r6.QueuePicker(this),this.latestChildErrorMessage=null,this.currentState=u0.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,X["grpc.service_config"])this.defaultServiceConfig=SU.validateServiceConfig(JSON.parse(X["grpc.service_config"]));else this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]};this.updateState(u0.ConnectivityState.IDLE,new r6.QueuePicker(this),null),this.childLoadBalancer=new yU.ChildLoadBalancerHandler({createSubchannel:Q.createSubchannel.bind(Q),requestReresolution:()=>{if(this.backoffTimeout.isRunning())e7("requestReresolution delayed by backoff timer until "+this.backoffTimeout.getEndTime().toISOString()),this.continueResolving=!0;else this.updateResolution()},updateState:(W,q,H)=>{this.latestChildState=W,this.latestChildPicker=q,this.latestChildErrorMessage=H,this.updateState(W,q,H)},addChannelzChild:Q.addChannelzChild.bind(Q),removeChannelzChild:Q.removeChannelzChild.bind(Q)}),this.innerResolver=jU.createResolver($,{onSuccessfulResolution:(W,q,H,K,z)=>{var U;this.backoffTimeout.stop(),this.backoffTimeout.reset();let F=null;if(q===null)if(H===null)this.previousServiceConfig=null,F=this.defaultServiceConfig;else if(this.previousServiceConfig===null)this.handleResolutionFailure(H);else F=this.previousServiceConfig;else F=q,this.previousServiceConfig=q;let D=(U=F===null||F===void 0?void 0:F.loadBalancingConfig)!==null&&U!==void 0?U:[],A=PU.selectLbConfigFromList(D,!0);if(A===null){this.handleResolutionFailure({code:$Y.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new CU.Metadata}),K===null||K===void 0||K.unref();return}this.childLoadBalancer.updateAddressList(W,A,Object.assign(Object.assign({},this.channelOptions),z));let B=F!==null&&F!==void 0?F:this.defaultServiceConfig;this.onSuccessfulResolution(B,K!==null&&K!==void 0?K:fU(B))},onError:(W)=>{this.handleResolutionFailure(W)}},X);let J={initialDelay:X["grpc.initial_reconnect_backoff_ms"],maxDelay:X["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new TU.BackoffTimeout(()=>{if(this.continueResolving)this.updateResolution(),this.continueResolving=!1;else this.updateState(this.latestChildState,this.latestChildPicker,this.latestChildErrorMessage)},J),this.backoffTimeout.unref()}updateResolution(){if(this.innerResolver.updateResolution(),this.currentState===u0.ConnectivityState.IDLE)this.updateState(u0.ConnectivityState.CONNECTING,this.latestChildPicker,this.latestChildErrorMessage);this.backoffTimeout.runOnce()}updateState($,Q,X){if(e7(vU.uriToString(this.target)+" "+u0.ConnectivityState[this.currentState]+" -> "+u0.ConnectivityState[$]),$===u0.ConnectivityState.IDLE)Q=new r6.QueuePicker(this,Q);this.currentState=$,this.channelControlHelper.updateState($,Q,X)}handleResolutionFailure($){if(this.latestChildState===u0.ConnectivityState.IDLE)this.updateState(u0.ConnectivityState.TRANSIENT_FAILURE,new r6.UnavailablePicker($),$.details),this.onFailedResolution($)}exitIdle(){if(this.currentState===u0.ConnectivityState.IDLE||this.currentState===u0.ConnectivityState.TRANSIENT_FAILURE)if(this.backoffTimeout.isRunning())this.continueResolving=!0;else this.updateResolution();this.childLoadBalancer.exitIdle()}updateAddressList($,Q){throw new 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=u0.ConnectivityState.IDLE,this.latestChildPicker=new r6.QueuePicker(this),this.currentState=u0.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1}getTypeName(){return"resolving_load_balancer"}}QG.ResolvingLoadBalancer=$G});var WG=M((GG)=>{Object.defineProperty(GG,"__esModule",{value:!0});GG.recognizedOptions=void 0;GG.channelOptionsEqual=mU;GG.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};function mU($,Q){let X=Object.keys($).sort(),Y=Object.keys(Q).sort();if(X.length!==Y.length)return!1;for(let G=0;G<X.length;G+=1){if(X[G]!==Y[G])return!1;if($[X[G]]!==Q[Y[G]])return!1}return!0}});var s0=M((zG)=>{Object.defineProperty(zG,"__esModule",{value:!0});zG.EndpointMap=void 0;zG.isTcpSubchannelAddress=t6;zG.subchannelAddressEqual=WQ;zG.subchannelAddressToString=HG;zG.stringToSubchannelAddress=cU;zG.endpointEqual=dU;zG.endpointToString=lU;zG.endpointHasAddress=KG;var qG=e("net");function t6($){return"port"in $}function WQ($,Q){if(!$&&!Q)return!0;if(!$||!Q)return!1;if(t6($))return t6(Q)&&$.host===Q.host&&$.port===Q.port;else return!t6(Q)&&$.path===Q.path}function HG($){if(t6($))if(qG.isIPv6($.host))return"["+$.host+"]:"+$.port;else return $.host+":"+$.port;else return $.path}var pU=443;function cU($,Q){if(qG.isIP($))return{host:$,port:Q!==null&&Q!==void 0?Q:pU};else return{path:$}}function dU($,Q){if($.addresses.length!==Q.addresses.length)return!1;for(let X=0;X<$.addresses.length;X++)if(!WQ($.addresses[X],Q.addresses[X]))return!1;return!0}function lU($){return"["+$.addresses.map(HG).join(", ")+"]"}function KG($,Q){for(let X of $.addresses)if(WQ(X,Q))return!0;return!1}function s6($,Q){if($.addresses.length!==Q.addresses.length)return!1;for(let X of $.addresses){let Y=!1;for(let G of Q.addresses)if(WQ(X,G)){Y=!0;break}if(!Y)return!1}return!0}class VG{constructor(){this.map=new Set}get size(){return this.map.size}getForSubchannelAddress($){for(let Q of this.map)if(KG(Q.key,$))return Q.value;return}deleteMissing($){let Q=[];for(let X of this.map){let Y=!1;for(let G of $)if(s6(G,X.key))Y=!0;if(!Y)Q.push(X.value),this.map.delete(X)}return Q}get($){for(let Q of this.map)if(s6($,Q.key))return Q.value;return}set($,Q){for(let X of this.map)if(s6($,X.key)){X.value=Q;return}this.map.add({key:$,value:Q})}delete($){for(let Q of this.map)if(s6($,Q.key)){this.map.delete(Q);return}}has($){for(let Q of this.map)if(s6($,Q.key))return!0;return!1}clear(){this.map.clear()}*keys(){for(let $ of this.map)yield $.key}*values(){for(let $ of this.map)yield $.value}*entries(){for(let $ of this.map)yield[$.key,$.value]}}zG.EndpointMap=VG});var OG=M((EG)=>{Object.defineProperty(EG,"t",{value:!0});class QY{constructor($,Q,X=1){this.i=void 0,this.h=void 0,this.o=void 0,this.u=$,this.l=Q,this.p=X}I(){let $=this,Q=$.o.o===$;if(Q&&$.p===1)$=$.h;else if($.i){$=$.i;while($.h)$=$.h}else{if(Q)return $.o;let X=$.o;while(X.i===$)$=X,X=$.o;$=X}return $}B(){let $=this;if($.h){$=$.h;while($.i)$=$.i;return $}else{let Q=$.o;while(Q.h===$)$=Q,Q=$.o;if($.h!==Q)return Q;else return $}}_(){let $=this.o,Q=this.h,X=Q.i;if($.o===this)$.o=Q;else if($.i===this)$.i=Q;else $.h=Q;if(Q.o=$,Q.i=this,this.o=Q,this.h=X,X)X.o=this;return Q}g(){let $=this.o,Q=this.i,X=Q.h;if($.o===this)$.o=Q;else if($.i===this)$.i=Q;else $.h=Q;if(Q.o=$,Q.h=this,this.o=Q,this.i=X,X)X.o=this;return Q}}class UG extends QY{constructor(){super(...arguments);this.M=1}_(){let $=super._();return this.O(),$.O(),$}g(){let $=super.g();return this.O(),$.O(),$}O(){if(this.M=1,this.i)this.M+=this.i.M;if(this.h)this.M+=this.h.M}}class FG{constructor($=0){this.iteratorType=$}equals($){return this.T===$.T}}class DG{constructor(){this.m=0}get length(){return this.m}size(){return this.m}empty(){return this.m===0}}class BG extends DG{}function P$(){throw new RangeError("Iterator access denied!")}class MG extends BG{constructor($=function(X,Y){if(X<Y)return-1;if(X>Y)return 1;return 0},Q=!1){super();this.v=void 0,this.A=$,this.enableIndex=Q,this.N=Q?UG:QY,this.C=new this.N}R($,Q){let X=this.C;while($){let Y=this.A($.u,Q);if(Y<0)$=$.h;else if(Y>0)X=$,$=$.i;else return $}return X}K($,Q){let X=this.C;while($)if(this.A($.u,Q)<=0)$=$.h;else X=$,$=$.i;return X}L($,Q){let X=this.C;while($){let Y=this.A($.u,Q);if(Y<0)X=$,$=$.h;else if(Y>0)$=$.i;else return $}return X}k($,Q){let X=this.C;while($)if(this.A($.u,Q)<0)X=$,$=$.h;else $=$.i;return X}P($){while(!0){let Q=$.o;if(Q===this.C)return;if($.p===1){$.p=0;return}if($===Q.i){let X=Q.h;if(X.p===1)if(X.p=0,Q.p=1,Q===this.v)this.v=Q._();else Q._();else if(X.h&&X.h.p===1){if(X.p=Q.p,Q.p=0,X.h.p=0,Q===this.v)this.v=Q._();else Q._();return}else if(X.i&&X.i.p===1)X.p=1,X.i.p=0,X.g();else X.p=1,$=Q}else{let X=Q.i;if(X.p===1)if(X.p=0,Q.p=1,Q===this.v)this.v=Q.g();else Q.g();else if(X.i&&X.i.p===1){if(X.p=Q.p,Q.p=0,X.i.p=0,Q===this.v)this.v=Q.g();else Q.g();return}else if(X.h&&X.h.p===1)X.p=1,X.h.p=0,X._();else X.p=1,$=Q}}}S($){if(this.m===1){this.clear();return}let Q=$;while(Q.i||Q.h){if(Q.h){Q=Q.h;while(Q.i)Q=Q.i}else Q=Q.i;let Y=$.u;$.u=Q.u,Q.u=Y;let G=$.l;$.l=Q.l,Q.l=G,$=Q}if(this.C.i===Q)this.C.i=Q.o;else if(this.C.h===Q)this.C.h=Q.o;this.P(Q);let X=Q.o;if(Q===X.i)X.i=void 0;else X.h=void 0;if(this.m-=1,this.v.p=0,this.enableIndex)while(X!==this.C)X.M-=1,X=X.o}U($){let Q=typeof $==="number"?$:void 0,X=typeof $==="function"?$:void 0,Y=typeof $==="undefined"?[]:void 0,G=0,J=this.v,W=[];while(W.length||J)if(J)W.push(J),J=J.i;else{if(J=W.pop(),G===Q)return J;Y&&Y.push(J),X&&X(J,G,this),G+=1,J=J.h}return Y}j($){while(!0){let Q=$.o;if(Q.p===0)return;let X=Q.o;if(Q===X.i){let Y=X.h;if(Y&&Y.p===1){if(Y.p=Q.p=0,X===this.v)return;X.p=1,$=X;continue}else if($===Q.h){if($.p=0,$.i)$.i.o=Q;if($.h)$.h.o=X;if(Q.h=$.i,X.i=$.h,$.i=Q,$.h=X,X===this.v)this.v=$,this.C.o=$;else{let G=X.o;if(G.i===X)G.i=$;else G.h=$}$.o=X.o,Q.o=$,X.o=$,X.p=1}else{if(Q.p=0,X===this.v)this.v=X.g();else X.g();X.p=1;return}}else{let Y=X.i;if(Y&&Y.p===1){if(Y.p=Q.p=0,X===this.v)return;X.p=1,$=X;continue}else if($===Q.i){if($.p=0,$.i)$.i.o=X;if($.h)$.h.o=Q;if(X.h=$.i,Q.i=$.h,$.i=X,$.h=Q,X===this.v)this.v=$,this.C.o=$;else{let G=X.o;if(G.i===X)G.i=$;else G.h=$}$.o=X.o,Q.o=$,X.o=$,X.p=1}else{if(Q.p=0,X===this.v)this.v=X._();else X._();X.p=1;return}}if(this.enableIndex)Q.O(),X.O(),$.O();return}}q($,Q,X){if(this.v===void 0)return this.m+=1,this.v=new this.N($,Q,0),this.v.o=this.C,this.C.o=this.C.i=this.C.h=this.v,this.m;let Y,G=this.C.i,J=this.A(G.u,$);if(J===0)return G.l=Q,this.m;else if(J>0)G.i=new this.N($,Q),G.i.o=G,Y=G.i,this.C.i=Y;else{let W=this.C.h,q=this.A(W.u,$);if(q===0)return W.l=Q,this.m;else if(q<0)W.h=new this.N($,Q),W.h.o=W,Y=W.h,this.C.h=Y;else{if(X!==void 0){let H=X.T;if(H!==this.C){let K=this.A(H.u,$);if(K===0)return H.l=Q,this.m;else if(K>0){let z=H.I(),U=this.A(z.u,$);if(U===0)return z.l=Q,this.m;else if(U<0)if(Y=new this.N($,Q),z.h===void 0)z.h=Y,Y.o=z;else H.i=Y,Y.o=H}}}if(Y===void 0){Y=this.v;while(!0){let H=this.A(Y.u,$);if(H>0){if(Y.i===void 0){Y.i=new this.N($,Q),Y.i.o=Y,Y=Y.i;break}Y=Y.i}else if(H<0){if(Y.h===void 0){Y.h=new this.N($,Q),Y.h.o=Y,Y=Y.h;break}Y=Y.h}else return Y.l=Q,this.m}}}}if(this.enableIndex){let W=Y.o;while(W!==this.C)W.M+=1,W=W.o}return this.j(Y),this.m+=1,this.m}H($,Q){while($){let X=this.A($.u,Q);if(X<0)$=$.h;else if(X>0)$=$.i;else return $}return $||this.C}clear(){this.m=0,this.v=void 0,this.C.o=void 0,this.C.i=this.C.h=void 0}updateKeyByIterator($,Q){let X=$.T;if(X===this.C)P$();if(this.m===1)return X.u=Q,!0;let Y=X.B().u;if(X===this.C.i){if(this.A(Y,Q)>0)return X.u=Q,!0;return!1}let G=X.I().u;if(X===this.C.h){if(this.A(G,Q)<0)return X.u=Q,!0;return!1}if(this.A(G,Q)>=0||this.A(Y,Q)<=0)return!1;return X.u=Q,!0}eraseElementByPos($){if($<0||$>this.m-1)throw new RangeError;let Q=this.U($);return this.S(Q),this.m}eraseElementByKey($){if(this.m===0)return!1;let Q=this.H(this.v,$);if(Q===this.C)return!1;return this.S(Q),!0}eraseElementByIterator($){let Q=$.T;if(Q===this.C)P$();let X=Q.h===void 0;if($.iteratorType===0){if(X)$.next()}else if(!X||Q.i===void 0)$.next();return this.S(Q),$}getHeight(){if(this.m===0)return 0;function $(Q){if(!Q)return 0;return Math.max($(Q.i),$(Q.h))+1}return $(this.v)}}class AG extends FG{constructor($,Q,X){super(X);if(this.T=$,this.C=Q,this.iteratorType===0)this.pre=function(){if(this.T===this.C.i)P$();return this.T=this.T.I(),this},this.next=function(){if(this.T===this.C)P$();return this.T=this.T.B(),this};el