@yukino.js/yukino 0.0.13 → 0.0.15
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/README.md +13 -11
- package/dist/a2a-ANR7PFD4.js +15 -0
- package/dist/acp-4E7R254I.js +14 -0
- package/dist/{anthropic-74ALYMH2.js → anthropic-ZO73YJFY.js} +1 -1
- package/dist/browser/dist/index.html +44 -0
- package/dist/browser/dist/static/index.css +2 -0
- package/dist/browser/dist/static/index.js +203 -0
- package/dist/bwrap-LVIPV72Q.js +0 -0
- package/dist/chunk-3KKA6537.js +0 -0
- package/dist/chunk-3RH3COZW.js +365 -0
- package/dist/chunk-4JHZPFU6.js +67 -0
- package/dist/chunk-7MKA3SHV.js +0 -0
- package/dist/{chunk-OREDGNI6.js → chunk-B2RNOTT5.js} +1 -1
- package/dist/{chunk-APJAUOF6.js → chunk-C56EKYBO.js} +1 -1
- package/dist/{chunk-WGFROGUC.js → chunk-CKOUBYG6.js} +0 -0
- package/dist/{chunk-6JUOKMSJ.js → chunk-CW6G3RYM.js} +1 -1
- package/dist/{chunk-556TRLPT.js → chunk-CWWRUTF2.js} +1 -1
- package/dist/chunk-DVB57IVG.js +18 -0
- package/dist/chunk-ETZPOVUC.js +4 -0
- package/dist/chunk-F3JTT3TI.js +110 -0
- package/dist/chunk-FC2LG24U.js +4 -0
- package/dist/chunk-FNQMXCCE.js +4 -0
- package/dist/chunk-HWCLMDQF.js +0 -0
- package/dist/chunk-I74AL3PF.js +0 -0
- package/dist/chunk-IOMQY54U.js +967 -0
- package/dist/chunk-IQT2IFSO.js +4 -0
- package/dist/chunk-K45OXLJJ.js +16 -0
- package/dist/chunk-KJJYW5IY.js +0 -0
- package/dist/chunk-LCWNSYZU.js +0 -0
- package/dist/chunk-LR4ZNAAM.js +4 -0
- package/dist/chunk-LTMY67B2.js +5 -0
- package/dist/chunk-MDPSQ6L7.js +0 -0
- package/dist/chunk-MQAQBW7F.js +0 -0
- package/dist/{chunk-NEU4ER5V.js → chunk-NSNTZXFL.js} +1 -1
- package/dist/chunk-P6DHMU7R.js +0 -0
- package/dist/chunk-VCIRD267.js +0 -0
- package/dist/chunk-VM4YKTHC.js +0 -0
- package/dist/chunk-VU3JWAJR.js +0 -0
- package/dist/chunk-W4GMCNWF.js +0 -0
- package/dist/chunk-XY7ZFVZL.js +4 -0
- package/dist/devtools-UVGRIXO2.js +0 -0
- package/dist/{esm-HW2JMFYC.js → esm-2JJG3HR7.js} +1 -1
- package/dist/esm-7DWXO52B.js +4 -0
- package/dist/{esm-6L5BJ5GT.js → esm-EOOB75BT.js} +1 -1
- package/dist/{esm-DIYJ5HX6.js → esm-H73EL6IR.js} +1 -1
- package/dist/{esm-YKAO4ES6.js → esm-IBZKE3IU.js} +1 -1
- package/dist/esm-W4NAAZTQ.js +225 -0
- package/dist/{esm-RPR2GBJ2.js → esm-Y237QNPJ.js} +1 -1
- package/dist/getMachineId-bsd-A3UCSHLE.js +4 -0
- package/dist/getMachineId-bsd-E27XJQLX.js +0 -0
- package/dist/getMachineId-darwin-35UPAIXP.js +0 -0
- package/dist/getMachineId-darwin-MWJEU7OI.js +5 -0
- package/dist/getMachineId-linux-FNSLKUDN.js +4 -0
- package/dist/getMachineId-linux-MKXIYT6A.js +0 -0
- package/dist/getMachineId-unsupported-PKQWB2OJ.js +4 -0
- package/dist/getMachineId-unsupported-ZXVGGFX2.js +0 -0
- package/dist/getMachineId-win-3A667JT3.js +4 -0
- package/dist/getMachineId-win-RNVIYJG5.js +0 -0
- package/dist/lib/{anthropic-EQRUGP2C.js → anthropic-SQBOFRPQ.js} +4 -4
- package/dist/lib/{chunk-EGT7BJRD.js → chunk-AW2577J5.js} +2 -2
- package/dist/lib/{chunk-JYCSWXCR.js → chunk-GPJL4PLE.js} +2 -2
- package/dist/lib/{chunk-UBVKYJFI.js → chunk-IHVYAEY2.js} +1058 -522
- package/dist/lib/{chunk-CDMR25FD.js → chunk-U3OT4POQ.js} +3 -3
- package/dist/lib/{chunk-HUTUNNDX.js → chunk-WNGF7243.js} +0 -1
- package/dist/lib/{chunk-FUJDUZTH.js → chunk-WXR5HNB4.js} +1 -1
- package/dist/lib/{chunk-WWCSFKMR.js → chunk-XS3GONYN.js} +2 -11
- package/dist/lib/index.d.ts +98 -282
- package/dist/lib/index.js +1092 -2409
- package/dist/lib/{openai-B3I5WBFT.js → openai-UV4KFNQV.js} +3 -3
- package/dist/lib/{providers-EJ4VBHNP.js → providers-77VBEX3K.js} +2 -2
- package/dist/lib/{tool-filter-TURPCYFR.js → tool-filter-MLYQGWM5.js} +3 -3
- package/dist/{main-JEEKFCGX.js → main-653YZQHY.js} +228 -232
- package/dist/main.js +2 -2
- package/dist/node-634LOHDX.js +0 -0
- package/dist/{openai-7C6BVQ7M.js → openai-FKLMHNNC.js} +1 -1
- package/dist/providers-4IU7SUEQ.js +4 -0
- package/dist/seatbelt-UO7HGD4Z.js +0 -0
- package/dist/server-4NHV4RJL.js +4 -0
- package/dist/slim-Q56GHZZP.js +0 -0
- package/dist/{src-JBRNH4FA.js → src-DEVJGNXS.js} +1 -1
- package/dist/{src-X6JWWHHT.js → src-EMFESWQS.js} +1 -1
- package/dist/{src-R4BSSIJJ.js → src-GG4YROJH.js} +1 -1
- package/dist/{src-43CPCEK2.js → src-JFAO2DGP.js} +1 -1
- package/dist/tool-filter-LJTLMGFP.js +4 -0
- package/dist/turndown.es-NQ3KDXM7.js +0 -0
- package/package.json +22 -21
- package/dist/a2a-DKWMWGID.js +0 -14
- package/dist/acp-RL6DKS3R.js +0 -14
- package/dist/chunk-2LHY3FND.js +0 -67
- package/dist/chunk-3QL446GD.js +0 -4
- package/dist/chunk-6FSIG63T.js +0 -364
- package/dist/chunk-A5G5NTDB.js +0 -1015
- package/dist/chunk-A7CJPQC5.js +0 -5
- package/dist/chunk-AGSYLE4E.js +0 -16
- package/dist/chunk-CJSMVCUF.js +0 -6
- package/dist/chunk-CU3IISCC.js +0 -4
- package/dist/chunk-HMZQYFYG.js +0 -4
- package/dist/chunk-JFKC4VCA.js +0 -4
- package/dist/chunk-KCMBAHWU.js +0 -4
- package/dist/chunk-SCR7NDDL.js +0 -63
- package/dist/esm-57CJEGGK.js +0 -4
- package/dist/esm-YOQPBF42.js +0 -225
- package/dist/fe/dist/index.html +0 -21
- package/dist/fe/dist/static/index.css +0 -2
- package/dist/fe/dist/static/index.js +0 -203
- package/dist/providers-U23PWAHG.js +0 -4
- package/dist/server-EOSEQPNY.js +0 -4
- package/dist/tool-filter-UDSHRE5F.js +0 -4
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __yukinoCreateRequire } from "node:module";
|
|
3
|
+
const require = __yukinoCreateRequire(import.meta.url);
|
|
4
|
+
import{c as td,d as rd,v as tv,w as rv}from"./chunk-LR4ZNAAM.js";import{o as Zm,p as ev}from"./chunk-K45OXLJJ.js";import{t as Zu,u as ed}from"./chunk-VCIRD267.js";import{a as z,b as Jm,c as g,d as Qm,f as gr}from"./chunk-7MKA3SHV.js";var id=g(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.VERSION=void 0;qn.VERSION="0.222.0"});var B=g($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=$e.DEFAULT_MAX_SEND_MESSAGE_LENGTH=$e.Propagate=$e.LogVerbosity=$e.Status=void 0;var nd;(function(i){i[i.OK=0]="OK",i[i.CANCELLED=1]="CANCELLED",i[i.UNKNOWN=2]="UNKNOWN",i[i.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",i[i.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",i[i.NOT_FOUND=5]="NOT_FOUND",i[i.ALREADY_EXISTS=6]="ALREADY_EXISTS",i[i.PERMISSION_DENIED=7]="PERMISSION_DENIED",i[i.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",i[i.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",i[i.ABORTED=10]="ABORTED",i[i.OUT_OF_RANGE=11]="OUT_OF_RANGE",i[i.UNIMPLEMENTED=12]="UNIMPLEMENTED",i[i.INTERNAL=13]="INTERNAL",i[i.UNAVAILABLE=14]="UNAVAILABLE",i[i.DATA_LOSS=15]="DATA_LOSS",i[i.UNAUTHENTICATED=16]="UNAUTHENTICATED"})(nd||($e.Status=nd={}));var sd;(function(i){i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.ERROR=2]="ERROR",i[i.NONE=3]="NONE"})(sd||($e.LogVerbosity=sd={}));var ad;(function(i){i[i.DEADLINE=1]="DEADLINE",i[i.CENSUS_STATS_CONTEXT=2]="CENSUS_STATS_CONTEXT",i[i.CENSUS_TRACING_CONTEXT=4]="CENSUS_TRACING_CONTEXT",i[i.CANCELLATION=8]="CANCELLATION",i[i.DEFAULTS=65535]="DEFAULTS"})(ad||($e.Propagate=ad={}));$e.DEFAULT_MAX_SEND_MESSAGE_LENGTH=-1;$e.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=4*1024*1024});var Va=g((ow,iv)=>{iv.exports={name:"@grpc/grpc-js",version:"1.14.6",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 ee=g(Be=>{"use strict";var Ya,Ka,Xa,Ja;Object.defineProperty(Be,"__esModule",{value:!0});Be.log=Be.setLoggerVerbosity=Be.setLogger=Be.getLogger=void 0;Be.trace=pv;Be.isTracerEnabled=cd;var $t=B(),nv=z("process"),sv=Va().version,av={error:(i,...e)=>{console.error("E "+i,...e)},info:(i,...e)=>{console.error("I "+i,...e)},debug:(i,...e)=>{console.error("D "+i,...e)}},mr=av,Br=$t.LogVerbosity.ERROR,ov=(Ka=(Ya=process.env.GRPC_NODE_VERBOSITY)!==null&&Ya!==void 0?Ya:process.env.GRPC_VERBOSITY)!==null&&Ka!==void 0?Ka:"";switch(ov.toUpperCase()){case"DEBUG":Br=$t.LogVerbosity.DEBUG;break;case"INFO":Br=$t.LogVerbosity.INFO;break;case"ERROR":Br=$t.LogVerbosity.ERROR;break;case"NONE":Br=$t.LogVerbosity.NONE;break;default:}var lv=()=>mr;Be.getLogger=lv;var cv=i=>{mr=i};Be.setLogger=cv;var uv=i=>{Br=i};Be.setLoggerVerbosity=uv;var dv=(i,...e)=>{let t;if(i>=Br){switch(i){case $t.LogVerbosity.DEBUG:t=mr.debug;break;case $t.LogVerbosity.INFO:t=mr.info;break;case $t.LogVerbosity.ERROR:t=mr.error;break}t||(t=mr.error),t&&t.bind(mr)(...e)}};Be.log=dv;var hv=(Ja=(Xa=process.env.GRPC_NODE_TRACE)!==null&&Xa!==void 0?Xa:process.env.GRPC_TRACE)!==null&&Ja!==void 0?Ja:"",Un=new Set,od=new Set;for(let i of hv.split(","))i.length!==0&&(i.startsWith("-")?od.add(i.substring(1)):Un.add(i));var ld=Un.has("all"),fv=ld||Un.size>0;function pv(i,e,t){cd(e)&&(0,Be.log)(i,new Date().toISOString()+" | v"+sv+" "+nv.pid+" | "+e+" | "+t)}function cd(i){return fv?!od.has(i)&&(ld||Un.has(i)):!1}});var zn=g(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.getErrorMessage=gv;Bn.getErrorCode=mv;function gv(i){return i instanceof Error?i.message:String(i)}function mv(i){return typeof i=="object"&&i!==null&&"code"in i&&typeof i.code=="number"?i.code:null}});var pe=g(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.Metadata=void 0;var vv=ee(),yv=B(),_v=zn(),Ev=/^[:0-9a-z_.-]+$/,Sv=/^[ -~]*$/;function Cv(i){return Ev.test(i)}function Tv(i){return Sv.test(i)}function hd(i){return i.endsWith("-bin")}function bv(i){return!i.startsWith("grpc-")}function Hn(i){return i.toLowerCase()}function ud(i,e){if(!Cv(i))throw new Error('Metadata key "'+i+'" contains illegal characters');if(e!=null)if(hd(i)){if(!Buffer.isBuffer(e))throw new Error("keys that end with '-bin' must have Buffer values")}else{if(Buffer.isBuffer(e))throw new Error("keys that don't end with '-bin' must have String values");if(!Tv(e))throw new Error('Metadata string value "'+e+'" contains illegal characters')}}var Qa=class i{constructor(e={}){this.internalRepr=new Map,this.options=e}set(e,t){e=Hn(e),ud(e,t),this.internalRepr.set(e,[t])}add(e,t){e=Hn(e),ud(e,t);let r=this.internalRepr.get(e);r===void 0?this.internalRepr.set(e,[t]):r.push(t)}remove(e){e=Hn(e),this.internalRepr.delete(e)}get(e){return e=Hn(e),this.internalRepr.get(e)||[]}getMap(){let e={};for(let[t,r]of this.internalRepr)if(r.length>0){let n=r[0];e[t]=Buffer.isBuffer(n)?Buffer.from(n):n}return e}clone(){let e=new i(this.options),t=e.internalRepr;for(let[r,n]of this.internalRepr){let s=n.map(a=>Buffer.isBuffer(a)?Buffer.from(a):a);t.set(r,s)}return e}merge(e){for(let[t,r]of e.internalRepr){let n=(this.internalRepr.get(t)||[]).concat(r);this.internalRepr.set(t,n)}}setOptions(e){this.options=e}getOptions(){return this.options}toHttp2Headers(){let e={};for(let[t,r]of this.internalRepr)t.startsWith(":")||(r.length===1?e[t]=dd(r[0]):e[t]=r.map(dd));return e}toJSON(){let e={};for(let[t,r]of this.internalRepr)e[t]=r;return e}setOpaque(e,t){this.opaqueData||(this.opaqueData=new Map),this.opaqueData.set(e,t)}getOpaque(e){var t;return(t=this.opaqueData)===null||t===void 0?void 0:t.get(e)}static fromHttp2Headers(e){let t=new i;for(let r of Object.keys(e)){if(r.charAt(0)===":")continue;let n=e[r];try{hd(r)?Array.isArray(n)?n.forEach(s=>{t.add(r,Buffer.from(s,"base64"))}):n!==void 0&&(bv(r)?n.split(",").forEach(s=>{t.add(r,Buffer.from(s.trim(),"base64"))}):t.add(r,Buffer.from(n,"base64"))):Array.isArray(n)?n.forEach(s=>{t.add(r,s)}):n!==void 0&&t.add(r,n)}catch(s){let a=`Failed to add metadata entry ${r}: ${n}. ${(0,_v.getErrorMessage)(s)}. For more information see https://github.com/grpc/grpc-node/issues/1173`;(0,vv.log)(yv.LogVerbosity.ERROR,a)}}return t}};jn.Metadata=Qa;var dd=i=>Buffer.isBuffer(i)?i.toString("base64"):i});var Pi=g(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.CallCredentials=void 0;Ni.isEmptyCallCredentials=wv;var to=pe();function Rv(i){return"getRequestHeaders"in i&&typeof i.getRequestHeaders=="function"}var zr=class i{static createFromMetadataGenerator(e){return new eo(e)}static createFromGoogleCredential(e){return i.createFromMetadataGenerator((t,r)=>{let n;Rv(e)?n=e.getRequestHeaders(t.service_url):n=new Promise((s,a)=>{e.getRequestMetadata(t.service_url,(o,l)=>{if(o){a(o);return}if(!l){a(new Error("Headers not set by metadata plugin"));return}s(l)})}),n.then(s=>{let a=new to.Metadata;for(let o of Object.keys(s))a.add(o,s[o]);r(null,a)},s=>{r(s)})})}static createEmpty(){return new Hr}};Ni.CallCredentials=zr;var Za=class i extends zr{constructor(e){super(),this.creds=e}async generateMetadata(e){let t=new to.Metadata,r=await Promise.all(this.creds.map(n=>n.generateMetadata(e)));for(let n of r)t.merge(n);return t}compose(e){return e instanceof Hr?this:new i(this.creds.concat([e]))}_equals(e){return this===e?!0:e instanceof i?this.creds.every((t,r)=>t._equals(e.creds[r])):!1}},eo=class i extends zr{constructor(e){super(),this.metadataGenerator=e}generateMetadata(e){return new Promise((t,r)=>{this.metadataGenerator(e,(n,s)=>{s!==void 0?t(s):r(n)})})}compose(e){return e instanceof Hr?this:new Za([this,e])}_equals(e){return this===e?!0:e instanceof i?this.metadataGenerator===e.metadataGenerator:!1}},Hr=class i extends zr{generateMetadata(e){return Promise.resolve(new to.Metadata)}compose(e){return e}_equals(e){return e instanceof i}};function wv(i){return i instanceof Hr}});var io=g(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.CIPHER_SUITES=void 0;Ii.getDefaultRootsData=Av;var Ov=z("fs");Ii.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;var fd=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH,ro=null;function Av(){return fd?(ro===null&&(ro=Ov.readFileSync(fd)),ro):null}});var ke=g(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.parseUri=Pv;Vt.splitHostPort=gd;Vt.combineHostPort=Iv;Vt.uriToString=Mv;Vt.extractServiceName=md;Vt.computeServiceUrl=kv;var Nv=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;function Pv(i){let e=Nv.exec(i);return e===null?null:{scheme:e[1],authority:e[2],path:e[3]}}var pd=/^\d+$/;function gd(i){if(i.startsWith("[")){let e=i.indexOf("]");if(e===-1)return null;let t=i.substring(1,e);if(t.indexOf(":")===-1)return null;if(i.length>e+1)if(i[e+1]===":"){let r=i.substring(e+2);return pd.test(r)?{host:t,port:+r}:null}else return null;else return{host:t}}else{let e=i.split(":");return e.length===2?pd.test(e[1])?{host:e[0],port:+e[1]}:null:{host:i}}}function Iv(i){return i.port===void 0?i.host:i.host.includes(":")?`[${i.host}]:${i.port}`:`${i.host}:${i.port}`}function Mv(i){let e="";return i.scheme!==void 0&&(e+=i.scheme+":"),i.authority!==void 0&&(e+="//"+i.authority+"/"),e+=i.path,e}function md(i){let e=i.indexOf("/");if(e===-1)return"";let t=i.indexOf("/",e+1);return t===-1?i.substring(e+1):i.substring(e+1,t)}function kv(i,e){var t,r;let n=md(e);return`https://${(r=(t=gd(i))===null||t===void 0?void 0:t.host)!==null&&r!==void 0?r:"localhost"}/${n}`}});var et=g(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=void 0;Mt.registerResolver=xv;Mt.registerDefaultScheme=Dv;Mt.createResolver=Lv;Mt.getDefaultAuthority=Fv;Mt.mapUriDefaultScheme=qv;var so=ke();Mt.CHANNEL_ARGS_CONFIG_SELECTOR_KEY="grpc.internal.config_selector";var jr={},no=null;function xv(i,e){jr[i]=e}function Dv(i){no=i}function Lv(i,e,t){if(i.scheme!==void 0&&i.scheme in jr)return new jr[i.scheme](i,e,t);throw new Error(`No resolver could be created for target ${(0,so.uriToString)(i)}`)}function Fv(i){if(i.scheme!==void 0&&i.scheme in jr)return jr[i.scheme].getDefaultAuthority(i);throw new Error(`Invalid target ${(0,so.uriToString)(i)}`)}function qv(i){return i.scheme===void 0||!(i.scheme in jr)?no!==null?{scheme:no,authority:void 0,path:(0,so.uriToString)(i)}:null:i}});var Wr=g(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.ChannelCredentials=void 0;ki.createCertificateProviderChannelCredentials=Hv;var Mi=z("tls"),$n=Pi(),oo=io(),vd=ke(),Uv=et(),Bv=ee(),zv=B();function ao(i,e){if(i&&!(i instanceof Buffer))throw new TypeError(`${e}, if provided, must be a Buffer.`)}var vr=class{compose(e){return new uo(this,e)}static createSsl(e,t,r,n){var s;if(ao(e,"Root certificate"),ao(t,"Private key"),ao(r,"Certificate chain"),t&&!r)throw new Error("Private key must be given with accompanying certificate chain");if(!t&&r)throw new Error("Certificate chain must be given with accompanying private key");let a=(0,Mi.createSecureContext)({ca:(s=e??(0,oo.getDefaultRootsData)())!==null&&s!==void 0?s:void 0,key:t??void 0,cert:r??void 0,ciphers:oo.CIPHER_SUITES});return new Wn(a,n??{})}static createFromSecureContext(e,t){return new Wn(e,t??{})}static createInsecure(){return new lo}};ki.ChannelCredentials=vr;var lo=class i extends vr{constructor(){super()}compose(e){throw new Error("Cannot compose insecure credentials")}_isSecure(){return!1}_equals(e){return e instanceof i}_createSecureConnector(e,t,r){let n=r??$n.CallCredentials.createEmpty();return{connect(s){return Promise.resolve({socket:s,secure:!1})},waitForReady:()=>Promise.resolve(),getCallCredentials:()=>n,destroy(){}}}};function yd(i,e,t,r){var n,s;let a={secureContext:i},o=t;if("grpc.http_connect_target"in r){let h=(0,vd.parseUri)(r["grpc.http_connect_target"]);h&&(o=h)}let l=(0,Uv.getDefaultAuthority)(o),c=(0,vd.splitHostPort)(l),u=(n=c?.host)!==null&&n!==void 0?n:l;if(a.host=u,e.checkServerIdentity&&(a.checkServerIdentity=e.checkServerIdentity),e.rejectUnauthorized!==void 0&&(a.rejectUnauthorized=e.rejectUnauthorized),a.ALPNProtocols=["h2"],r["grpc.ssl_target_name_override"]){let h=r["grpc.ssl_target_name_override"],f=(s=a.checkServerIdentity)!==null&&s!==void 0?s:Mi.checkServerIdentity;a.checkServerIdentity=(_,p)=>f(h,p),a.servername=h}else a.servername=u;return r["grpc-node.tls_enable_trace"]&&(a.enableTrace=!0),a}var co=class{constructor(e,t){this.connectionOptions=e,this.callCredentials=t}connect(e){let t=Object.assign({socket:e},this.connectionOptions);return new Promise((r,n)=>{let s=(0,Mi.connect)(t,()=>{var a;if((!((a=this.connectionOptions.rejectUnauthorized)!==null&&a!==void 0)||a)&&!s.authorized){n(s.authorizationError);return}r({socket:s,secure:!0})});s.on("error",a=>{n(a)})})}waitForReady(){return Promise.resolve()}getCallCredentials(){return this.callCredentials}destroy(){}},Wn=class i extends vr{constructor(e,t){super(),this.secureContext=e,this.verifyOptions=t}_isSecure(){return!0}_equals(e){return this===e?!0:e instanceof i?this.secureContext===e.secureContext&&this.verifyOptions.checkServerIdentity===e.verifyOptions.checkServerIdentity:!1}_createSecureConnector(e,t,r){let n=yd(this.secureContext,this.verifyOptions,e,t);return new co(n,r??$n.CallCredentials.createEmpty())}},Gn=class i extends vr{constructor(e,t,r){super(),this.caCertificateProvider=e,this.identityCertificateProvider=t,this.verifyOptions=r,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(e){var t,r;return this===e?!0:e instanceof i?this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&((t=this.verifyOptions)===null||t===void 0?void 0:t.checkServerIdentity)===((r=e.verifyOptions)===null||r===void 0?void 0:r.checkServerIdentity):!1}ref(){var e;this.refcount===0&&(this.caCertificateProvider.addCaCertificateListener(this.caCertificateUpdateListener),(e=this.identityCertificateProvider)===null||e===void 0||e.addIdentityCertificateListener(this.identityCertificateUpdateListener)),this.refcount+=1}unref(){var e;this.refcount-=1,this.refcount===0&&(this.caCertificateProvider.removeCaCertificateListener(this.caCertificateUpdateListener),(e=this.identityCertificateProvider)===null||e===void 0||e.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_createSecureConnector(e,t,r){return this.ref(),new i.SecureConnectorImpl(this,e,t,r??$n.CallCredentials.createEmpty())}maybeUpdateWatchers(){if(this.hasReceivedUpdates()){for(let e of this.secureContextWatchers)e(this.getLatestSecureContext());this.secureContextWatchers=[]}}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.maybeUpdateWatchers()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.maybeUpdateWatchers()}hasReceivedUpdates(){return!(this.latestCaUpdate===void 0||this.identityCertificateProvider&&this.latestIdentityUpdate===void 0)}getSecureContext(){return this.hasReceivedUpdates()?Promise.resolve(this.getLatestSecureContext()):new Promise(e=>{this.secureContextWatchers.push(e)})}getLatestSecureContext(){var e,t;if(!this.latestCaUpdate||this.identityCertificateProvider!==null&&!this.latestIdentityUpdate)return null;try{return(0,Mi.createSecureContext)({ca:this.latestCaUpdate.caCertificate,key:(e=this.latestIdentityUpdate)===null||e===void 0?void 0:e.privateKey,cert:(t=this.latestIdentityUpdate)===null||t===void 0?void 0:t.certificate,ciphers:oo.CIPHER_SUITES})}catch(r){return(0,Bv.log)(zv.LogVerbosity.ERROR,"Failed to createSecureContext with error "+r.message),null}}};Gn.SecureConnectorImpl=class{constructor(i,e,t,r){this.parent=i,this.channelTarget=e,this.options=t,this.callCredentials=r}connect(i){return new Promise((e,t)=>{let r=this.parent.getLatestSecureContext();if(!r){t(new Error("Failed to load credentials"));return}i.closed&&t(new Error("Socket closed while loading credentials"));let n=yd(r,this.parent.verifyOptions,this.channelTarget,this.options),s=Object.assign({socket:i},n),a=()=>{t(new Error("Socket closed"))},o=c=>{t(c)},l=(0,Mi.connect)(s,()=>{var c;if(l.removeListener("close",a),l.removeListener("error",o),(!((c=this.parent.verifyOptions.rejectUnauthorized)!==null&&c!==void 0)||c)&&!l.authorized){t(l.authorizationError);return}e({socket:l,secure:!0})});l.once("close",a),l.once("error",o)})}async waitForReady(){await this.parent.getSecureContext()}getCallCredentials(){return this.callCredentials}destroy(){this.parent.unref()}};function Hv(i,e,t){return new Gn(i,e,t??{})}var uo=class i extends vr{constructor(e,t){if(super(),this.channelCredentials=e,this.callCredentials=t,!e._isSecure())throw new Error("Cannot compose insecure credentials")}compose(e){let t=this.callCredentials.compose(e);return new i(this.channelCredentials,t)}_isSecure(){return!0}_equals(e){return this===e?!0:e instanceof i?this.channelCredentials._equals(e.channelCredentials)&&this.callCredentials._equals(e.callCredentials):!1}_createSecureConnector(e,t,r){let n=this.callCredentials.compose(r??$n.CallCredentials.createEmpty());return this.channelCredentials._createSecureConnector(e,t,n)}}});var Kt=g(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.createChildChannelControlHelper=Gv;mt.registerLoadBalancerType=$v;mt.registerDefaultLoadBalancerType=Vv;mt.createLoadBalancer=Yv;mt.isLoadBalancerNameRegistered=Kv;mt.parseLoadBalancingConfig=_d;mt.getDefaultConfig=Xv;mt.selectLbConfigFromList=Jv;var jv=ee(),Wv=B();function Gv(i,e){var t,r,n,s,a,o,l,c,u,h;return{createSubchannel:(r=(t=e.createSubchannel)===null||t===void 0?void 0:t.bind(e))!==null&&r!==void 0?r:i.createSubchannel.bind(i),updateState:(s=(n=e.updateState)===null||n===void 0?void 0:n.bind(e))!==null&&s!==void 0?s:i.updateState.bind(i),requestReresolution:(o=(a=e.requestReresolution)===null||a===void 0?void 0:a.bind(e))!==null&&o!==void 0?o:i.requestReresolution.bind(i),addChannelzChild:(c=(l=e.addChannelzChild)===null||l===void 0?void 0:l.bind(e))!==null&&c!==void 0?c:i.addChannelzChild.bind(i),removeChannelzChild:(h=(u=e.removeChannelzChild)===null||u===void 0?void 0:u.bind(e))!==null&&h!==void 0?h:i.removeChannelzChild.bind(i)}}var Yt={},xi=null;function $v(i,e,t){Yt[i]={LoadBalancer:e,LoadBalancingConfig:t}}function Vv(i){xi=i}function Yv(i,e){let t=i.getLoadBalancerName();return t in Yt?new Yt[t].LoadBalancer(e):null}function Kv(i){return i in Yt}function _d(i){let e=Object.keys(i);if(e.length!==1)throw new Error("Provided load balancing config has multiple conflicting entries");let t=e[0];if(t in Yt)try{return Yt[t].LoadBalancingConfig.createFromJson(i[t])}catch(r){throw new Error(`${t}: ${r.message}`)}else throw new Error(`Unrecognized load balancing config name ${t}`)}function Xv(){if(!xi)throw new Error("No default load balancer type registered");return new Yt[xi].LoadBalancingConfig}function Jv(i,e=!1){for(let t of i)try{return _d(t)}catch(r){(0,jv.log)(Wv.LogVerbosity.DEBUG,"Config parsing failed with error",r.message);continue}return e&&xi?new Yt[xi].LoadBalancingConfig:null}});var ho=g(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.validateRetryThrottling=Ed;Di.validateServiceConfig=Sd;Di.extractAndSelectServiceConfig=oy;var Qv=z("os"),Vn=B(),Yn=/^\d+(\.\d{1,9})?s$/,Zv="node";function ey(i){if("service"in i&&i.service!==""){if(typeof i.service!="string")throw new Error(`Invalid method config name: invalid service: expected type string, got ${typeof i.service}`);if("method"in i&&i.method!==""){if(typeof i.method!="string")throw new Error(`Invalid method config name: invalid method: expected type string, got ${typeof i.service}`);return{service:i.service,method:i.method}}else return{service:i.service}}else{if("method"in i&&i.method!==void 0)throw new Error("Invalid method config name: method set with empty or unset service");return{}}}function ty(i){if(!("maxAttempts"in i)||!Number.isInteger(i.maxAttempts)||i.maxAttempts<2)throw new Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");if(!("initialBackoff"in i)||typeof i.initialBackoff!="string"||!Yn.test(i.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 i)||typeof i.maxBackoff!="string"||!Yn.test(i.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 i)||typeof i.backoffMultiplier!="number"||i.backoffMultiplier<=0)throw new Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");if(!("retryableStatusCodes"in i&&Array.isArray(i.retryableStatusCodes)))throw new Error("Invalid method config retry policy: retryableStatusCodes is required");if(i.retryableStatusCodes.length===0)throw new Error("Invalid method config retry policy: retryableStatusCodes must be non-empty");for(let e of i.retryableStatusCodes)if(typeof e=="number"){if(!Object.values(Vn.Status).includes(e))throw new Error("Invalid method config retry policy: retryableStatusCodes value not in status code range")}else if(typeof e=="string"){if(!Object.values(Vn.Status).includes(e.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:i.maxAttempts,initialBackoff:i.initialBackoff,maxBackoff:i.maxBackoff,backoffMultiplier:i.backoffMultiplier,retryableStatusCodes:i.retryableStatusCodes}}function ry(i){if(!("maxAttempts"in i)||!Number.isInteger(i.maxAttempts)||i.maxAttempts<2)throw new Error("Invalid method config hedging policy: maxAttempts must be an integer at least 2");if("hedgingDelay"in i&&(typeof i.hedgingDelay!="string"||!Yn.test(i.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 i&&Array.isArray(i.nonFatalStatusCodes))for(let t of i.nonFatalStatusCodes)if(typeof t=="number"){if(!Object.values(Vn.Status).includes(t))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not in status code range")}else if(typeof t=="string"){if(!Object.values(Vn.Status).includes(t.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 e={maxAttempts:i.maxAttempts};return i.hedgingDelay&&(e.hedgingDelay=i.hedgingDelay),i.nonFatalStatusCodes&&(e.nonFatalStatusCodes=i.nonFatalStatusCodes),e}function iy(i){var e;let t={name:[]};if(!("name"in i)||!Array.isArray(i.name))throw new Error("Invalid method config: invalid name array");for(let r of i.name)t.name.push(ey(r));if("waitForReady"in i){if(typeof i.waitForReady!="boolean")throw new Error("Invalid method config: invalid waitForReady");t.waitForReady=i.waitForReady}if("timeout"in i)if(typeof i.timeout=="object"){if(!("seconds"in i.timeout)||typeof i.timeout.seconds!="number")throw new Error("Invalid method config: invalid timeout.seconds");if(!("nanos"in i.timeout)||typeof i.timeout.nanos!="number")throw new Error("Invalid method config: invalid timeout.nanos");t.timeout=i.timeout}else if(typeof i.timeout=="string"&&Yn.test(i.timeout)){let r=i.timeout.substring(0,i.timeout.length-1).split(".");t.timeout={seconds:r[0]|0,nanos:((e=r[1])!==null&&e!==void 0?e:0)|0}}else throw new Error("Invalid method config: invalid timeout");if("maxRequestBytes"in i){if(typeof i.maxRequestBytes!="number")throw new Error("Invalid method config: invalid maxRequestBytes");t.maxRequestBytes=i.maxRequestBytes}if("maxResponseBytes"in i){if(typeof i.maxResponseBytes!="number")throw new Error("Invalid method config: invalid maxRequestBytes");t.maxResponseBytes=i.maxResponseBytes}if("retryPolicy"in i){if("hedgingPolicy"in i)throw new Error("Invalid method config: retryPolicy and hedgingPolicy cannot both be specified");t.retryPolicy=ty(i.retryPolicy)}else"hedgingPolicy"in i&&(t.hedgingPolicy=ry(i.hedgingPolicy));return t}function Ed(i){if(!("maxTokens"in i)||typeof i.maxTokens!="number"||i.maxTokens<=0||i.maxTokens>1e3)throw new Error("Invalid retryThrottling: maxTokens must be a number in (0, 1000]");if(!("tokenRatio"in i)||typeof i.tokenRatio!="number"||i.tokenRatio<=0)throw new Error("Invalid retryThrottling: tokenRatio must be a number greater than 0");return{maxTokens:+i.maxTokens.toFixed(3),tokenRatio:+i.tokenRatio.toFixed(3)}}function ny(i){if(!(typeof i=="object"&&i!==null))throw new Error(`Invalid loadBalancingConfig: unexpected type ${typeof i}`);let e=Object.keys(i);if(e.length>1)throw new Error(`Invalid loadBalancingConfig: unexpected multiple keys ${e}`);if(e.length===0)throw new Error("Invalid loadBalancingConfig: load balancing policy name required");return{[e[0]]:i[e[0]]}}function Sd(i){let e={loadBalancingConfig:[],methodConfig:[]};if("loadBalancingPolicy"in i)if(typeof i.loadBalancingPolicy=="string")e.loadBalancingPolicy=i.loadBalancingPolicy;else throw new Error("Invalid service config: invalid loadBalancingPolicy");if("loadBalancingConfig"in i)if(Array.isArray(i.loadBalancingConfig))for(let r of i.loadBalancingConfig)e.loadBalancingConfig.push(ny(r));else throw new Error("Invalid service config: invalid loadBalancingConfig");if("methodConfig"in i&&Array.isArray(i.methodConfig))for(let r of i.methodConfig)e.methodConfig.push(iy(r));"retryThrottling"in i&&(e.retryThrottling=Ed(i.retryThrottling));let t=[];for(let r of e.methodConfig)for(let n of r.name){for(let s of t)if(n.service===s.service&&n.method===s.method)throw new Error(`Invalid service config: duplicate name ${n.service}/${n.method}`);t.push(n)}return e}function sy(i){if(!("serviceConfig"in i))throw new Error("Invalid service config choice: missing service config");let e={serviceConfig:Sd(i.serviceConfig)};if("clientLanguage"in i)if(Array.isArray(i.clientLanguage)){e.clientLanguage=[];for(let r of i.clientLanguage)if(typeof r=="string")e.clientLanguage.push(r);else throw new Error("Invalid service config choice: invalid clientLanguage")}else throw new Error("Invalid service config choice: invalid clientLanguage");if("clientHostname"in i)if(Array.isArray(i.clientHostname)){e.clientHostname=[];for(let r of i.clientHostname)if(typeof r=="string")e.clientHostname.push(r);else throw new Error("Invalid service config choice: invalid clientHostname")}else throw new Error("Invalid service config choice: invalid clientHostname");if("percentage"in i)if(typeof i.percentage=="number"&&0<=i.percentage&&i.percentage<=100)e.percentage=i.percentage;else throw new Error("Invalid service config choice: invalid percentage");let t=["clientLanguage","percentage","clientHostname","serviceConfig"];for(let r in i)if(!t.includes(r))throw new Error(`Invalid service config choice: unexpected field ${r}`);return e}function ay(i,e){if(!Array.isArray(i))throw new Error("Invalid service config list");for(let t of i){let r=sy(t);if(!(typeof r.percentage=="number"&&e>r.percentage)){if(Array.isArray(r.clientHostname)){let n=!1;for(let s of r.clientHostname)s===Qv.hostname()&&(n=!0);if(!n)continue}if(Array.isArray(r.clientLanguage)){let n=!1;for(let s of r.clientLanguage)s===Zv&&(n=!0);if(!n)continue}return r.serviceConfig}}throw new Error("No matching service config found")}function oy(i,e){for(let t of i)if(t.length>0&&t[0].startsWith("grpc_config=")){let r=t.join("").substring(12),n=JSON.parse(r);return ay(n,e)}return null}});var Pe=g(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.ConnectivityState=void 0;var Cd;(function(i){i[i.IDLE=0]="IDLE",i[i.CONNECTING=1]="CONNECTING",i[i.READY=2]="READY",i[i.TRANSIENT_FAILURE=3]="TRANSIENT_FAILURE",i[i.SHUTDOWN=4]="SHUTDOWN"})(Cd||(Kn.ConnectivityState=Cd={}))});var kt=g(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.QueuePicker=Xt.UnavailablePicker=Xt.PickResultType=void 0;var ly=pe(),cy=B(),Xn;(function(i){i[i.COMPLETE=0]="COMPLETE",i[i.QUEUE=1]="QUEUE",i[i.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",i[i.DROP=3]="DROP"})(Xn||(Xt.PickResultType=Xn={}));var fo=class{constructor(e){this.status=Object.assign({code:cy.Status.UNAVAILABLE,details:"No connection established",metadata:new ly.Metadata},e)}pick(e){return{pickResultType:Xn.TRANSIENT_FAILURE,subchannel:null,status:this.status,onCallStarted:null,onCallEnded:null}}};Xt.UnavailablePicker=fo;var po=class{constructor(e,t){this.loadBalancer=e,this.childPicker=t,this.calledExitIdle=!1}pick(e){return this.calledExitIdle||(process.nextTick(()=>{this.loadBalancer.exitIdle()}),this.calledExitIdle=!0),this.childPicker?this.childPicker.pick(e):{pickResultType:Xn.QUEUE,subchannel:null,status:null,onCallStarted:null,onCallEnded:null}}};Xt.QueuePicker=po});var Gr=g(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.BackoffTimeout=void 0;var uy=B(),Td=ee(),bd="backoff",dy=1e3,hy=1.6,fy=12e4,py=.2;function gy(i,e){return Math.random()*(e-i)+i}var Jn=class i{constructor(e,t){this.callback=e,this.initialDelay=dy,this.multiplier=hy,this.maxDelay=fy,this.jitter=py,this.running=!1,this.hasRef=!0,this.startTime=new Date,this.endTime=new Date,this.id=i.getNextId(),t&&(t.initialDelay&&(this.initialDelay=t.initialDelay),t.multiplier&&(this.multiplier=t.multiplier),t.jitter&&(this.jitter=t.jitter),t.maxDelay&&(this.maxDelay=t.maxDelay)),this.traceEnabled&&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++}get traceEnabled(){return Td.isTracerEnabled(bd)}trace(e){this.traceEnabled&&Td.trace(uy.LogVerbosity.DEBUG,bd,"{"+this.id+"} "+e)}runTimer(e){var t,r;this.traceEnabled&&this.trace("runTimer(delay="+e+")"),this.endTime=this.startTime,this.endTime.setMilliseconds(this.endTime.getMilliseconds()+e),clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.trace("timer fired"),this.running=!1,this.callback()},e),this.hasRef||(r=(t=this.timerId).unref)===null||r===void 0||r.call(t)}runOnce(){this.trace("runOnce()"),this.running=!0,this.startTime=new Date,this.runTimer(this.nextDelay);let e=Math.min(this.nextDelay*this.multiplier,this.maxDelay),t=e*this.jitter;this.nextDelay=e+gy(-t,t)}stop(){this.trace("stop()"),clearTimeout(this.timerId),this.running=!1}reset(){if(this.traceEnabled&&this.trace("reset() running="+this.running),this.nextDelay=this.initialDelay,this.running){let e=new Date,t=this.startTime;t.setMilliseconds(t.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),e<t?this.runTimer(t.getTime()-e.getTime()):this.running=!1}}isRunning(){return this.running}ref(){var e,t;this.hasRef=!0,(t=(e=this.timerId).ref)===null||t===void 0||t.call(e)}unref(){var e,t;this.hasRef=!1,(t=(e=this.timerId).unref)===null||t===void 0||t.call(e)}getEndTime(){return this.endTime}};Qn.BackoffTimeout=Jn;Jn.nextId=0});var es=g(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.ChildLoadBalancerHandler=void 0;var my=Kt(),vy=Pe(),yy="child_load_balancer_helper",go=class{constructor(e){this.channelControlHelper=e,this.currentChild=null,this.pendingChild=null,this.latestConfig=null,this.ChildPolicyHelper=class{constructor(t){this.parent=t,this.child=null}createSubchannel(t,r){return this.parent.channelControlHelper.createSubchannel(t,r)}updateState(t,r,n){var s;if(this.calledByPendingChild()){if(t===vy.ConnectivityState.CONNECTING)return;(s=this.parent.currentChild)===null||s===void 0||s.destroy(),this.parent.currentChild=this.parent.pendingChild,this.parent.pendingChild=null}else if(!this.calledByCurrentChild())return;this.parent.channelControlHelper.updateState(t,r,n)}requestReresolution(){var t;let r=(t=this.parent.pendingChild)!==null&&t!==void 0?t:this.parent.currentChild;this.child===r&&this.parent.channelControlHelper.requestReresolution()}setChild(t){this.child=t}addChannelzChild(t){this.parent.channelControlHelper.addChannelzChild(t)}removeChannelzChild(t){this.parent.channelControlHelper.removeChannelzChild(t)}calledByPendingChild(){return this.child===this.parent.pendingChild}calledByCurrentChild(){return this.child===this.parent.currentChild}}}configUpdateRequiresNewPolicyInstance(e,t){return e.getLoadBalancerName()!==t.getLoadBalancerName()}updateAddressList(e,t,r,n){let s;if(this.currentChild===null||this.latestConfig===null||this.configUpdateRequiresNewPolicyInstance(this.latestConfig,t)){let a=new this.ChildPolicyHelper(this),o=(0,my.createLoadBalancer)(t,a);a.setChild(o),this.currentChild===null?(this.currentChild=o,s=this.currentChild):(this.pendingChild&&this.pendingChild.destroy(),this.pendingChild=o,s=this.pendingChild)}else this.pendingChild===null?s=this.currentChild:s=this.pendingChild;return this.latestConfig=t,s.updateAddressList(e,t,r,n)}exitIdle(){this.currentChild&&(this.currentChild.exitIdle(),this.pendingChild&&this.pendingChild.exitIdle())}resetBackoff(){this.currentChild&&(this.currentChild.resetBackoff(),this.pendingChild&&this.pendingChild.resetBackoff())}destroy(){this.currentChild&&(this.currentChild.destroy(),this.currentChild=null),this.pendingChild&&(this.pendingChild.destroy(),this.pendingChild=null)}getTypeName(){return yy}};Zn.ChildLoadBalancerHandler=go});var Nd=g(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.ResolvingLoadBalancer=void 0;Fi.getDefaultConfigSelector=Ad;var _y=Kt(),Ey=ho(),xe=Pe(),Rd=et(),Li=kt(),Sy=Gr(),Od=B(),Cy=pe(),Ty=ee(),by=B(),Ry=ke(),wy=es(),Oy="resolving_load_balancer";function wd(i){Ty.trace(by.LogVerbosity.DEBUG,Oy,i)}var Ay=["SERVICE_AND_METHOD","SERVICE","EMPTY"];function Ny(i,e,t,r){for(let n of t.name)switch(r){case"EMPTY":if(!n.service&&!n.method)return!0;break;case"SERVICE":if(n.service===i&&!n.method)return!0;break;case"SERVICE_AND_METHOD":if(n.service===i&&n.method===e)return!0}return!1}function Py(i,e,t,r){for(let n of t)if(Ny(i,e,n,r))return n;return null}var Iy=100;function Ad(i){let e=new Map;return{invoke(t,r,n){var s,a;let o=e.get(t);if(o===void 0){let l=t.split("/").filter(h=>h.length>0),c=(s=l[0])!==null&&s!==void 0?s:"",u=(a=l[1])!==null&&a!==void 0?a:"";if(o={name:[]},i&&i.methodConfig)for(let h of Ay){let f=Py(c,u,i.methodConfig,h);if(f){o=f;break}}e.size<Iy&&e.set(t,o)}return{methodConfig:o,pickInformation:{},status:Od.Status.OK,dynamicFilterFactories:[]}},unref(){e.clear()}}}var mo=class{constructor(e,t,r,n,s){this.target=e,this.channelControlHelper=t,this.channelOptions=r,this.onSuccessfulResolution=n,this.onFailedResolution=s,this.latestChildState=xe.ConnectivityState.IDLE,this.latestChildPicker=new Li.QueuePicker(this),this.latestChildErrorMessage=null,this.currentState=xe.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,r["grpc.service_config"]?this.defaultServiceConfig=(0,Ey.validateServiceConfig)(JSON.parse(r["grpc.service_config"])):this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]},this.updateState(xe.ConnectivityState.IDLE,new Li.QueuePicker(this),null),this.childLoadBalancer=new wy.ChildLoadBalancerHandler({createSubchannel:t.createSubchannel.bind(t),requestReresolution:()=>{this.backoffTimeout.isRunning()?(wd("requestReresolution delayed by backoff timer until "+this.backoffTimeout.getEndTime().toISOString()),this.continueResolving=!0):this.updateResolution()},updateState:(o,l,c)=>{this.latestChildState=o,this.latestChildPicker=l,this.latestChildErrorMessage=c,this.updateState(o,l,c)},addChannelzChild:t.addChannelzChild.bind(t),removeChannelzChild:t.removeChannelzChild.bind(t)}),this.innerResolver=(0,Rd.createResolver)(e,this.handleResolverResult.bind(this),r);let a={initialDelay:r["grpc.initial_reconnect_backoff_ms"],maxDelay:r["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new Sy.BackoffTimeout(()=>{this.continueResolving?(this.updateResolution(),this.continueResolving=!1):this.updateState(this.latestChildState,this.latestChildPicker,this.latestChildErrorMessage)},a),this.backoffTimeout.unref()}handleResolverResult(e,t,r,n){var s,a;this.backoffTimeout.stop(),this.backoffTimeout.reset();let o=!0,l=null;if(r===null?l=this.defaultServiceConfig:r.ok?l=r.value:this.previousServiceConfig!==null?l=this.previousServiceConfig:(o=!1,this.handleResolutionFailure(r.error)),l!==null){let c=(s=l?.loadBalancingConfig)!==null&&s!==void 0?s:[],u=(0,_y.selectLbConfigFromList)(c,!0);u===null?(o=!1,this.handleResolutionFailure({code:Od.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new Cy.Metadata})):o=this.childLoadBalancer.updateAddressList(e,u,Object.assign(Object.assign({},this.channelOptions),t),n)}return o&&this.onSuccessfulResolution(l,(a=t[Rd.CHANNEL_ARGS_CONFIG_SELECTOR_KEY])!==null&&a!==void 0?a:Ad(l)),o}updateResolution(){this.innerResolver.updateResolution(),this.currentState===xe.ConnectivityState.IDLE&&this.updateState(xe.ConnectivityState.CONNECTING,this.latestChildPicker,this.latestChildErrorMessage),this.backoffTimeout.runOnce()}updateState(e,t,r){wd((0,Ry.uriToString)(this.target)+" "+xe.ConnectivityState[this.currentState]+" -> "+xe.ConnectivityState[e]),e===xe.ConnectivityState.IDLE&&(t=new Li.QueuePicker(this,t)),this.currentState=e,this.channelControlHelper.updateState(e,t,r)}handleResolutionFailure(e){this.latestChildState===xe.ConnectivityState.IDLE&&(this.updateState(xe.ConnectivityState.TRANSIENT_FAILURE,new Li.UnavailablePicker(e),e.details),this.onFailedResolution(e))}exitIdle(){(this.currentState===xe.ConnectivityState.IDLE||this.currentState===xe.ConnectivityState.TRANSIENT_FAILURE)&&(this.backoffTimeout.isRunning()?this.continueResolving=!0:this.updateResolution()),this.childLoadBalancer.exitIdle()}updateAddressList(e,t){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=xe.ConnectivityState.IDLE,this.latestChildPicker=new Li.QueuePicker(this),this.currentState=xe.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1}getTypeName(){return"resolving_load_balancer"}};Fi.ResolvingLoadBalancer=mo});var Pd=g(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});qi.recognizedOptions=void 0;qi.channelOptionsEqual=My;qi.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 My(i,e){let t=Object.keys(i).sort(),r=Object.keys(e).sort();if(t.length!==r.length)return!1;for(let n=0;n<t.length;n+=1)if(t[n]!==r[n]||i[t[n]]!==e[r[n]])return!1;return!0}});var De=g(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.EndpointMap=void 0;tt.isTcpSubchannelAddress=Bi;tt.subchannelAddressEqual=ts;tt.subchannelAddressToString=Md;tt.stringToSubchannelAddress=xy;tt.endpointEqual=Dy;tt.endpointToString=Ly;tt.endpointHasAddress=kd;var Id=z("net");function Bi(i){return"port"in i}function ts(i,e){return!i&&!e?!0:!i||!e?!1:Bi(i)?Bi(e)&&i.host===e.host&&i.port===e.port:!Bi(e)&&i.path===e.path}function Md(i){return Bi(i)?(0,Id.isIPv6)(i.host)?"["+i.host+"]:"+i.port:i.host+":"+i.port:i.path}var ky=443;function xy(i,e){return(0,Id.isIP)(i)?{host:i,port:e??ky}:{path:i}}function Dy(i,e){if(i.addresses.length!==e.addresses.length)return!1;for(let t=0;t<i.addresses.length;t++)if(!ts(i.addresses[t],e.addresses[t]))return!1;return!0}function Ly(i){return"["+i.addresses.map(Md).join(", ")+"]"}function kd(i,e){for(let t of i.addresses)if(ts(t,e))return!0;return!1}function Ui(i,e){if(i.addresses.length!==e.addresses.length)return!1;for(let t of i.addresses){let r=!1;for(let n of e.addresses)if(ts(t,n)){r=!0;break}if(!r)return!1}return!0}var vo=class{constructor(){this.map=new Set}get size(){return this.map.size}getForSubchannelAddress(e){for(let t of this.map)if(kd(t.key,e))return t.value}deleteMissing(e){let t=[];for(let r of this.map){let n=!1;for(let s of e)Ui(s,r.key)&&(n=!0);n||(t.push(r.value),this.map.delete(r))}return t}get(e){for(let t of this.map)if(Ui(e,t.key))return t.value}set(e,t){for(let r of this.map)if(Ui(e,r.key)){r.value=t;return}this.map.add({key:e,value:t})}delete(e){for(let t of this.map)if(Ui(e,t.key)){this.map.delete(t);return}}has(e){for(let t of this.map)if(Ui(e,t.key))return!0;return!1}clear(){this.map.clear()}*keys(){for(let e of this.map)yield e.key}*values(){for(let e of this.map)yield e.value}*entries(){for(let e of this.map)yield[e.key,e.value]}};tt.EndpointMap=vo});var Dd={};Qm(Dd,{OrderedMap:()=>Wy});function $r(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");yo(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Fy(i,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,n,s,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(c){return function(u){return l([c,u])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(t=0)),t;)try{if(r=1,n&&(s=c[0]&2?n.return:c[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,c[1])).done)return s;switch(n=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,n=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1],s=c;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(c);break}s[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(i,t)}catch(u){c=[6,u],n=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function yr(){throw new RangeError("Iterator access denied!")}var yo,xd,qy,Uy,By,zy,Hy,jy,xt,Wy,Ld=Jm(()=>{"use strict";yo=function(i,e){return yo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},yo(i,e)};xd=(function(){function i(e,t,r){r===void 0&&(r=1),this.t=void 0,this.i=void 0,this.h=void 0,this.u=e,this.o=t,this.l=r}return i.prototype.v=function(){var e=this,t=e.h.h===e;if(t&&e.l===1)e=e.i;else if(e.t)for(e=e.t;e.i;)e=e.i;else{if(t)return e.h;for(var r=e.h;r.t===e;)e=r,r=e.h;e=r}return e},i.prototype.p=function(){var e=this;if(e.i){for(e=e.i;e.t;)e=e.t;return e}else{for(var t=e.h;t.i===e;)e=t,t=e.h;return e.i!==t?t:e}},i.prototype.T=function(){var e=this.h,t=this.i,r=t.t;return e.h===this?e.h=t:e.t===this?e.t=t:e.i=t,t.h=e,t.t=this,this.h=t,this.i=r,r&&(r.h=this),t},i.prototype.I=function(){var e=this.h,t=this.t,r=t.i;return e.h===this?e.h=t:e.t===this?e.t=t:e.i=t,t.h=e,t.i=this,this.h=t,this.t=r,r&&(r.h=this),t},i})(),qy=(function(i){$r(e,i);function e(){var t=i!==null&&i.apply(this,arguments)||this;return t.O=1,t}return e.prototype.T=function(){var t=i.prototype.T.call(this);return this.M(),t.M(),t},e.prototype.I=function(){var t=i.prototype.I.call(this);return this.M(),t.M(),t},e.prototype.M=function(){this.O=1,this.t&&(this.O+=this.t.O),this.i&&(this.O+=this.i.O)},e})(xd),Uy=(function(){function i(e){e===void 0&&(e=0),this.iteratorType=e}return i.prototype.equals=function(e){return this.C===e.C},i})(),By=(function(){function i(){this._=0}return Object.defineProperty(i.prototype,"length",{get:function(){return this._},enumerable:!1,configurable:!0}),i.prototype.size=function(){return this._},i.prototype.empty=function(){return this._===0},i})(),zy=(function(i){$r(e,i);function e(){return i!==null&&i.apply(this,arguments)||this}return e})(By);Hy=(function(i){$r(e,i);function e(t,r){t===void 0&&(t=function(s,a){return s<a?-1:s>a?1:0}),r===void 0&&(r=!1);var n=i.call(this)||this;return n.N=void 0,n.g=t,n.enableIndex=r,n.S=r?qy:xd,n.A=new n.S,n}return e.prototype.m=function(t,r){for(var n=this.A;t;){var s=this.g(t.u,r);if(s<0)t=t.i;else if(s>0)n=t,t=t.t;else return t}return n},e.prototype.B=function(t,r){for(var n=this.A;t;){var s=this.g(t.u,r);s<=0?t=t.i:(n=t,t=t.t)}return n},e.prototype.j=function(t,r){for(var n=this.A;t;){var s=this.g(t.u,r);if(s<0)n=t,t=t.i;else if(s>0)t=t.t;else return t}return n},e.prototype.k=function(t,r){for(var n=this.A;t;){var s=this.g(t.u,r);s<0?(n=t,t=t.i):t=t.t}return n},e.prototype.R=function(t){for(;;){var r=t.h;if(r===this.A)return;if(t.l===1){t.l=0;return}if(t===r.t){var n=r.i;if(n.l===1)n.l=0,r.l=1,r===this.N?this.N=r.T():r.T();else if(n.i&&n.i.l===1){n.l=r.l,r.l=0,n.i.l=0,r===this.N?this.N=r.T():r.T();return}else n.t&&n.t.l===1?(n.l=1,n.t.l=0,n.I()):(n.l=1,t=r)}else{var n=r.t;if(n.l===1)n.l=0,r.l=1,r===this.N?this.N=r.I():r.I();else if(n.t&&n.t.l===1){n.l=r.l,r.l=0,n.t.l=0,r===this.N?this.N=r.I():r.I();return}else n.i&&n.i.l===1?(n.l=1,n.i.l=0,n.T()):(n.l=1,t=r)}}},e.prototype.G=function(t){if(this._===1){this.clear();return}for(var r=t;r.t||r.i;){if(r.i)for(r=r.i;r.t;)r=r.t;else r=r.t;var n=t.u;t.u=r.u,r.u=n;var s=t.o;t.o=r.o,r.o=s,t=r}this.A.t===r?this.A.t=r.h:this.A.i===r&&(this.A.i=r.h),this.R(r);var a=r.h;if(r===a.t?a.t=void 0:a.i=void 0,this._-=1,this.N.l=0,this.enableIndex)for(;a!==this.A;)a.O-=1,a=a.h},e.prototype.P=function(t){for(var r=typeof t=="number"?t:void 0,n=typeof t=="function"?t:void 0,s=typeof t>"u"?[]:void 0,a=0,o=this.N,l=[];l.length||o;)if(o)l.push(o),o=o.t;else{if(o=l.pop(),a===r)return o;s&&s.push(o),n&&n(o,a,this),a+=1,o=o.i}return s},e.prototype.q=function(t){for(;;){var r=t.h;if(r.l===0)return;var n=r.h;if(r===n.t){var s=n.i;if(s&&s.l===1){if(s.l=r.l=0,n===this.N)return;n.l=1,t=n;continue}else if(t===r.i){if(t.l=0,t.t&&(t.t.h=r),t.i&&(t.i.h=n),r.i=t.t,n.t=t.i,t.t=r,t.i=n,n===this.N)this.N=t,this.A.h=t;else{var a=n.h;a.t===n?a.t=t:a.i=t}t.h=n.h,r.h=t,n.h=t,n.l=1}else{r.l=0,n===this.N?this.N=n.I():n.I(),n.l=1;return}}else{var s=n.t;if(s&&s.l===1){if(s.l=r.l=0,n===this.N)return;n.l=1,t=n;continue}else if(t===r.t){if(t.l=0,t.t&&(t.t.h=n),t.i&&(t.i.h=r),n.i=t.t,r.t=t.i,t.t=n,t.i=r,n===this.N)this.N=t,this.A.h=t;else{var a=n.h;a.t===n?a.t=t:a.i=t}t.h=n.h,r.h=t,n.h=t,n.l=1}else{r.l=0,n===this.N?this.N=n.T():n.T(),n.l=1;return}}this.enableIndex&&(r.M(),n.M(),t.M());return}},e.prototype.D=function(t,r,n){if(this.N===void 0)return this._+=1,this.N=new this.S(t,r,0),this.N.h=this.A,this.A.h=this.A.t=this.A.i=this.N,this._;var s,a=this.A.t,o=this.g(a.u,t);if(o===0)return a.o=r,this._;if(o>0)a.t=new this.S(t,r),a.t.h=a,s=a.t,this.A.t=s;else{var l=this.A.i,c=this.g(l.u,t);if(c===0)return l.o=r,this._;if(c<0)l.i=new this.S(t,r),l.i.h=l,s=l.i,this.A.i=s;else{if(n!==void 0){var u=n.C;if(u!==this.A){var h=this.g(u.u,t);if(h===0)return u.o=r,this._;if(h>0){var f=u.v(),_=this.g(f.u,t);if(_===0)return f.o=r,this._;_<0&&(s=new this.S(t,r),f.i===void 0?(f.i=s,s.h=f):(u.t=s,s.h=u))}}}if(s===void 0)for(s=this.N;;){var p=this.g(s.u,t);if(p>0){if(s.t===void 0){s.t=new this.S(t,r),s.t.h=s,s=s.t;break}s=s.t}else if(p<0){if(s.i===void 0){s.i=new this.S(t,r),s.i.h=s,s=s.i;break}s=s.i}else return s.o=r,this._}}}if(this.enableIndex)for(var v=s.h;v!==this.A;)v.O+=1,v=v.h;return this.q(s),this._+=1,this._},e.prototype.F=function(t,r){for(;t;){var n=this.g(t.u,r);if(n<0)t=t.i;else if(n>0)t=t.t;else return t}return t||this.A},e.prototype.clear=function(){this._=0,this.N=void 0,this.A.h=void 0,this.A.t=this.A.i=void 0},e.prototype.updateKeyByIterator=function(t,r){var n=t.C;if(n===this.A&&yr(),this._===1)return n.u=r,!0;var s=n.p().u;if(n===this.A.t)return this.g(s,r)>0?(n.u=r,!0):!1;var a=n.v().u;return n===this.A.i?this.g(a,r)<0?(n.u=r,!0):!1:this.g(a,r)>=0||this.g(s,r)<=0?!1:(n.u=r,!0)},e.prototype.eraseElementByPos=function(t){if(t<0||t>this._-1)throw new RangeError;var r=this.P(t);return this.G(r),this._},e.prototype.eraseElementByKey=function(t){if(this._===0)return!1;var r=this.F(this.N,t);return r===this.A?!1:(this.G(r),!0)},e.prototype.eraseElementByIterator=function(t){var r=t.C;r===this.A&&yr();var n=r.i===void 0,s=t.iteratorType===0;return s?n&&t.next():(!n||r.t===void 0)&&t.next(),this.G(r),t},e.prototype.getHeight=function(){if(this._===0)return 0;function t(r){return r?Math.max(t(r.t),t(r.i))+1:0}return t(this.N)},e})(zy),jy=(function(i){$r(e,i);function e(t,r,n){var s=i.call(this,n)||this;return s.C=t,s.A=r,s.iteratorType===0?(s.pre=function(){return this.C===this.A.t&&yr(),this.C=this.C.v(),this},s.next=function(){return this.C===this.A&&yr(),this.C=this.C.p(),this}):(s.pre=function(){return this.C===this.A.i&&yr(),this.C=this.C.p(),this},s.next=function(){return this.C===this.A&&yr(),this.C=this.C.v(),this}),s}return Object.defineProperty(e.prototype,"index",{get:function(){var t=this.C,r=this.A.h;if(t===this.A)return r?r.O-1:0;var n=0;for(t.t&&(n+=t.t.O);t!==r;){var s=t.h;t===s.i&&(n+=1,s.t&&(n+=s.t.O)),t=s}return n},enumerable:!1,configurable:!0}),e.prototype.isAccessible=function(){return this.C!==this.A},e})(Uy),xt=(function(i){$r(e,i);function e(t,r,n,s){var a=i.call(this,t,r,s)||this;return a.container=n,a}return Object.defineProperty(e.prototype,"pointer",{get:function(){this.C===this.A&&yr();var t=this;return new Proxy([],{get:function(r,n){return n==="0"?t.C.u:n==="1"?t.C.o:(r[0]=t.C.u,r[1]=t.C.o,r[n])},set:function(r,n,s){if(n!=="1")throw new TypeError("prop must be 1");return t.C.o=s,!0}})},enumerable:!1,configurable:!0}),e.prototype.copy=function(){return new e(this.C,this.A,this.container,this.iteratorType)},e})(jy),Wy=(function(i){$r(e,i);function e(t,r,n){t===void 0&&(t=[]);var s=i.call(this,r,n)||this,a=s;return t.forEach((function(o){a.setElement(o[0],o[1])})),s}return e.prototype.begin=function(){return new xt(this.A.t||this.A,this.A,this)},e.prototype.end=function(){return new xt(this.A,this.A,this)},e.prototype.rBegin=function(){return new xt(this.A.i||this.A,this.A,this,1)},e.prototype.rEnd=function(){return new xt(this.A,this.A,this,1)},e.prototype.front=function(){if(this._!==0){var t=this.A.t;return[t.u,t.o]}},e.prototype.back=function(){if(this._!==0){var t=this.A.i;return[t.u,t.o]}},e.prototype.lowerBound=function(t){var r=this.m(this.N,t);return new xt(r,this.A,this)},e.prototype.upperBound=function(t){var r=this.B(this.N,t);return new xt(r,this.A,this)},e.prototype.reverseLowerBound=function(t){var r=this.j(this.N,t);return new xt(r,this.A,this)},e.prototype.reverseUpperBound=function(t){var r=this.k(this.N,t);return new xt(r,this.A,this)},e.prototype.forEach=function(t){this.P((function(r,n,s){t([r.u,r.o],n,s)}))},e.prototype.setElement=function(t,r,n){return this.D(t,r,n)},e.prototype.getElementByPos=function(t){if(t<0||t>this._-1)throw new RangeError;var r=this.P(t);return[r.u,r.o]},e.prototype.find=function(t){var r=this.F(this.N,t);return new xt(r,this.A,this)},e.prototype.getElementByKey=function(t){var r=this.F(this.N,t);return r.o},e.prototype.union=function(t){var r=this;return t.forEach((function(n){r.setElement(n[0],n[1])})),this._},e.prototype[Symbol.iterator]=function(){var t,r,n,s;return Fy(this,(function(a){switch(a.label){case 0:t=this._,r=this.P(),n=0,a.label=1;case 1:return n<t?(s=r[n],[4,[s.u,s.o]]):[3,4];case 2:a.sent(),a.label=3;case 3:return++n,[3,1];case 4:return[2]}}))},e})(Hy)});var is=g(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});rs.registerAdminService=Gy;rs.addAdminServicesToServer=$y;var Fd=[];function Gy(i,e){Fd.push({getServiceDefinition:i,getHandlers:e})}function $y(i){for(let{getServiceDefinition:e,getHandlers:t}of Fd)i.addService(e(),t())}});var qd=g(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.ClientDuplexStreamImpl=rt.ClientWritableStreamImpl=rt.ClientReadableStreamImpl=rt.ClientUnaryCallImpl=void 0;rt.callErrorFromStatus=Yy;var Vy=z("events"),To=z("stream"),zi=B();function Yy(i,e){let t=`${i.code} ${zi.Status[i.code]}: ${i.details}`,n=`${new Error(t).stack}
|
|
5
|
+
for call at
|
|
6
|
+
${e}`;return Object.assign(new Error(t),i,{stack:n})}var _o=class extends Vy.EventEmitter{constructor(){super()}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(zi.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return(t=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&t!==void 0?t:"unknown"}getAuthContext(){var e,t;return(t=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&t!==void 0?t:null}};rt.ClientUnaryCallImpl=_o;var Eo=class extends To.Readable{constructor(e){super({objectMode:!0}),this.deserialize=e}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(zi.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return(t=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&t!==void 0?t:"unknown"}getAuthContext(){var e,t;return(t=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&t!==void 0?t:null}_read(e){var t;(t=this.call)===null||t===void 0||t.startRead()}};rt.ClientReadableStreamImpl=Eo;var So=class extends To.Writable{constructor(e){super({objectMode:!0}),this.serialize=e}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(zi.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return(t=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&t!==void 0?t:"unknown"}getAuthContext(){var e,t;return(t=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&t!==void 0?t:null}_write(e,t,r){var n;let s={callback:r},a=Number(t);Number.isNaN(a)||(s.flags=a),(n=this.call)===null||n===void 0||n.sendMessageWithContext(s,e)}_final(e){var t;(t=this.call)===null||t===void 0||t.halfClose(),e()}};rt.ClientWritableStreamImpl=So;var Co=class extends To.Duplex{constructor(e,t){super({objectMode:!0}),this.serialize=e,this.deserialize=t}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(zi.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,t;return(t=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&t!==void 0?t:"unknown"}getAuthContext(){var e,t;return(t=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&t!==void 0?t:null}_read(e){var t;(t=this.call)===null||t===void 0||t.startRead()}_write(e,t,r){var n;let s={callback:r},a=Number(t);Number.isNaN(a)||(s.flags=a),(n=this.call)===null||n===void 0||n.sendMessageWithContext(s,e)}_final(e){var t;(t=this.call)===null||t===void 0||t.halfClose(),e()}};rt.ClientDuplexStreamImpl=Co});var Er=g(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.InterceptingListenerImpl=void 0;_r.statusOrFromValue=Xy;_r.statusOrFromError=Jy;_r.isInterceptingListener=Qy;var Ky=pe();function Xy(i){return{ok:!0,value:i}}function Jy(i){var e;return{ok:!1,error:Object.assign(Object.assign({},i),{metadata:(e=i.metadata)!==null&&e!==void 0?e:new Ky.Metadata})}}function Qy(i){return i.onReceiveMetadata!==void 0&&i.onReceiveMetadata.length===1}var bo=class{constructor(e,t){this.listener=e,this.nextListener=t,this.processingMetadata=!1,this.hasPendingMessage=!1,this.processingMessage=!1,this.pendingStatus=null}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingStatus(){this.pendingStatus&&this.nextListener.onReceiveStatus(this.pendingStatus)}onReceiveMetadata(e){this.processingMetadata=!0,this.listener.onReceiveMetadata(e,t=>{this.processingMetadata=!1,this.nextListener.onReceiveMetadata(t),this.processPendingMessage(),this.processPendingStatus()})}onReceiveMessage(e){this.processingMessage=!0,this.listener.onReceiveMessage(e,t=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=t,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(t),this.processPendingStatus())})}onReceiveStatus(e){this.listener.onReceiveStatus(e,t=>{this.processingMetadata||this.processingMessage?this.pendingStatus=t:this.nextListener.onReceiveStatus(t)})}};_r.InterceptingListenerImpl=bo});var Io=g(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.InterceptingCall=it.RequesterBuilder=it.ListenerBuilder=it.InterceptorConfigurationError=void 0;it.getInterceptingCall=r_;var Zy=pe(),Ud=Er(),Bd=B(),zd=zn(),ji=class i extends Error{constructor(e){super(e),this.name="InterceptorConfigurationError",Error.captureStackTrace(this,i)}};it.InterceptorConfigurationError=ji;var wo=class{constructor(){this.metadata=void 0,this.message=void 0,this.status=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveStatus(e){return this.status=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveStatus:this.status}}};it.ListenerBuilder=wo;var Oo=class{constructor(){this.start=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withStart(e){return this.start=e,this}withSendMessage(e){return this.message=e,this}withHalfClose(e){return this.halfClose=e,this}withCancel(e){return this.cancel=e,this}build(){return{start:this.start,sendMessage:this.message,halfClose:this.halfClose,cancel:this.cancel}}};it.RequesterBuilder=Oo;var Ro={onReceiveMetadata:(i,e)=>{e(i)},onReceiveMessage:(i,e)=>{e(i)},onReceiveStatus:(i,e)=>{e(i)}},Hi={start:(i,e,t)=>{t(i,e)},sendMessage:(i,e)=>{e(i)},halfClose:i=>{i()},cancel:i=>{i()}},Ao=class{constructor(e,t){var r,n,s,a;this.nextCall=e,this.processingMetadata=!1,this.pendingMessageContext=null,this.processingMessage=!1,this.pendingHalfClose=!1,t?this.requester={start:(r=t.start)!==null&&r!==void 0?r:Hi.start,sendMessage:(n=t.sendMessage)!==null&&n!==void 0?n:Hi.sendMessage,halfClose:(s=t.halfClose)!==null&&s!==void 0?s:Hi.halfClose,cancel:(a=t.cancel)!==null&&a!==void 0?a:Hi.cancel}:this.requester=Hi}cancelWithStatus(e,t){this.requester.cancel(()=>{this.nextCall.cancelWithStatus(e,t)})}getPeer(){return this.nextCall.getPeer()}processPendingMessage(){this.pendingMessageContext&&(this.nextCall.sendMessageWithContext(this.pendingMessageContext,this.pendingMessage),this.pendingMessageContext=null,this.pendingMessage=null)}processPendingHalfClose(){this.pendingHalfClose&&this.nextCall.halfClose()}start(e,t){var r,n,s,a,o,l;let c={onReceiveMetadata:(n=(r=t?.onReceiveMetadata)===null||r===void 0?void 0:r.bind(t))!==null&&n!==void 0?n:(u=>{}),onReceiveMessage:(a=(s=t?.onReceiveMessage)===null||s===void 0?void 0:s.bind(t))!==null&&a!==void 0?a:(u=>{}),onReceiveStatus:(l=(o=t?.onReceiveStatus)===null||o===void 0?void 0:o.bind(t))!==null&&l!==void 0?l:(u=>{})};this.processingMetadata=!0,this.requester.start(e,c,(u,h)=>{var f,_,p;this.processingMetadata=!1;let v;if((0,Ud.isInterceptingListener)(h))v=h;else{let R={onReceiveMetadata:(f=h.onReceiveMetadata)!==null&&f!==void 0?f:Ro.onReceiveMetadata,onReceiveMessage:(_=h.onReceiveMessage)!==null&&_!==void 0?_:Ro.onReceiveMessage,onReceiveStatus:(p=h.onReceiveStatus)!==null&&p!==void 0?p:Ro.onReceiveStatus};v=new Ud.InterceptingListenerImpl(R,c)}this.nextCall.start(u,v),this.processPendingMessage(),this.processPendingHalfClose()})}sendMessageWithContext(e,t){this.processingMessage=!0,this.requester.sendMessage(t,r=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessageContext=e,this.pendingMessage=t):(this.nextCall.sendMessageWithContext(e,r),this.processPendingHalfClose())})}sendMessage(e){this.sendMessageWithContext({},e)}startRead(){this.nextCall.startRead()}halfClose(){this.requester.halfClose(()=>{this.processingMetadata||this.processingMessage?this.pendingHalfClose=!0:this.nextCall.halfClose()})}getAuthContext(){return this.nextCall.getAuthContext()}};it.InterceptingCall=Ao;function e_(i,e,t){var r,n;let s=(r=t.deadline)!==null&&r!==void 0?r:1/0,a=t.host,o=(n=t.parent)!==null&&n!==void 0?n:null,l=t.propagate_flags,c=t.credentials,u=i.createCall(e,s,a,o,l);return c&&u.setCredentials(c),u}var ns=class{constructor(e,t){this.call=e,this.methodDefinition=t}cancelWithStatus(e,t){this.call.cancelWithStatus(e,t)}getPeer(){return this.call.getPeer()}sendMessageWithContext(e,t){let r;try{r=this.methodDefinition.requestSerialize(t)}catch(n){this.call.cancelWithStatus(Bd.Status.INTERNAL,`Request message serialization failure: ${(0,zd.getErrorMessage)(n)}`);return}this.call.sendMessageWithContext(e,r)}sendMessage(e){this.sendMessageWithContext({},e)}start(e,t){let r=null;this.call.start(e,{onReceiveMetadata:n=>{var s;(s=t?.onReceiveMetadata)===null||s===void 0||s.call(t,n)},onReceiveMessage:n=>{var s;let a;try{a=this.methodDefinition.responseDeserialize(n)}catch(o){r={code:Bd.Status.INTERNAL,details:`Response message parsing error: ${(0,zd.getErrorMessage)(o)}`,metadata:new Zy.Metadata},this.call.cancelWithStatus(r.code,r.details);return}(s=t?.onReceiveMessage)===null||s===void 0||s.call(t,a)},onReceiveStatus:n=>{var s,a;r?(s=t?.onReceiveStatus)===null||s===void 0||s.call(t,r):(a=t?.onReceiveStatus)===null||a===void 0||a.call(t,n)}})}startRead(){this.call.startRead()}halfClose(){this.call.halfClose()}getAuthContext(){return this.call.getAuthContext()}},No=class extends ns{constructor(e,t){super(e,t)}start(e,t){var r,n;let s=!1,a={onReceiveMetadata:(n=(r=t?.onReceiveMetadata)===null||r===void 0?void 0:r.bind(t))!==null&&n!==void 0?n:(o=>{}),onReceiveMessage:o=>{var l;s=!0,(l=t?.onReceiveMessage)===null||l===void 0||l.call(t,o)},onReceiveStatus:o=>{var l,c;s||(l=t?.onReceiveMessage)===null||l===void 0||l.call(t,null),(c=t?.onReceiveStatus)===null||c===void 0||c.call(t,o)}};super.start(e,a),this.call.startRead()}},Po=class extends ns{};function t_(i,e,t){let r=e_(i,t.path,e);return t.responseStream?new Po(r,t):new No(r,t)}function r_(i,e,t,r){if(i.clientInterceptors.length>0&&i.clientInterceptorProviders.length>0)throw new ji("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(i.callInterceptors.length>0&&i.callInterceptorProviders.length>0)throw new ji("Both interceptors and interceptor_providers were passed as call options. Only one of these is allowed.");let n=[];i.callInterceptors.length>0||i.callInterceptorProviders.length>0?n=[].concat(i.callInterceptors,i.callInterceptorProviders.map(o=>o(e))).filter(o=>o):n=[].concat(i.clientInterceptors,i.clientInterceptorProviders.map(o=>o(e))).filter(o=>o);let s=Object.assign({},t,{method_definition:e});return n.reduceRight((o,l)=>c=>l(c,o),o=>t_(r,o,e))(s)}});var xo=g(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.Client=void 0;var vt=qd(),i_=Do(),n_=Pe(),Jt=B(),Vr=pe(),ss=Io(),nt=Symbol(),Yr=Symbol(),Kr=Symbol(),Dt=Symbol();function Mo(i){return typeof i=="function"}function Xr(i){var e;return((e=i.stack)===null||e===void 0?void 0:e.split(`
|
|
7
|
+
`).slice(1).join(`
|
|
8
|
+
`))||"no stack trace available"}var ko=class{constructor(e,t,r={}){var n,s;if(r=Object.assign({},r),this[Yr]=(n=r.interceptors)!==null&&n!==void 0?n:[],delete r.interceptors,this[Kr]=(s=r.interceptor_providers)!==null&&s!==void 0?s:[],delete r.interceptor_providers,this[Yr].length>0&&this[Kr].length>0)throw new Error("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(this[Dt]=r.callInvocationTransformer,delete r.callInvocationTransformer,r.channelOverride)this[nt]=r.channelOverride;else if(r.channelFactoryOverride){let a=r.channelFactoryOverride;delete r.channelFactoryOverride,this[nt]=a(e,t,r)}else this[nt]=new i_.ChannelImplementation(e,t,r)}close(){this[nt].close()}getChannel(){return this[nt]}waitForReady(e,t){let r=n=>{if(n){t(new Error("Failed to connect before the deadline"));return}let s;try{s=this[nt].getConnectivityState(!0)}catch{t(new Error("The channel has been closed"));return}if(s===n_.ConnectivityState.READY)t();else try{this[nt].watchConnectivityState(s,e,r)}catch{t(new Error("The channel has been closed"))}};setImmediate(r)}checkOptionalUnaryResponseArguments(e,t,r){if(Mo(e))return{metadata:new Vr.Metadata,options:{},callback:e};if(Mo(t))return e instanceof Vr.Metadata?{metadata:e,options:{},callback:t}:{metadata:new Vr.Metadata,options:e,callback:t};if(!(e instanceof Vr.Metadata&&t instanceof Object&&Mo(r)))throw new Error("Incorrect arguments passed");return{metadata:e,options:t,callback:r}}makeUnaryRequest(e,t,r,n,s,a,o){var l,c;let u=this.checkOptionalUnaryResponseArguments(s,a,o),h={path:e,requestStream:!1,responseStream:!1,requestSerialize:t,responseDeserialize:r},f={argument:n,metadata:u.metadata,call:new vt.ClientUnaryCallImpl,channel:this[nt],methodDefinition:h,callOptions:u.options,callback:u.callback};this[Dt]&&(f=this[Dt](f));let _=f.call,p={clientInterceptors:this[Yr],clientInterceptorProviders:this[Kr],callInterceptors:(l=f.callOptions.interceptors)!==null&&l!==void 0?l:[],callInterceptorProviders:(c=f.callOptions.interceptor_providers)!==null&&c!==void 0?c:[]},v=(0,ss.getInterceptingCall)(p,f.methodDefinition,f.callOptions,f.channel);_.call=v;let R=null,O=!1,P=new Error;return v.start(f.metadata,{onReceiveMetadata:D=>{_.emit("metadata",D)},onReceiveMessage(D){R!==null&&v.cancelWithStatus(Jt.Status.UNIMPLEMENTED,"Too many responses received"),R=D},onReceiveStatus(D){if(!O){if(O=!0,D.code===Jt.Status.OK)if(R===null){let E=Xr(P);f.callback((0,vt.callErrorFromStatus)({code:Jt.Status.UNIMPLEMENTED,details:"No message received",metadata:D.metadata},E))}else f.callback(null,R);else{let E=Xr(P);f.callback((0,vt.callErrorFromStatus)(D,E))}P=null,_.emit("status",D)}}}),v.sendMessage(n),v.halfClose(),_}makeClientStreamRequest(e,t,r,n,s,a){var o,l;let c=this.checkOptionalUnaryResponseArguments(n,s,a),u={path:e,requestStream:!0,responseStream:!1,requestSerialize:t,responseDeserialize:r},h={metadata:c.metadata,call:new vt.ClientWritableStreamImpl(t),channel:this[nt],methodDefinition:u,callOptions:c.options,callback:c.callback};this[Dt]&&(h=this[Dt](h));let f=h.call,_={clientInterceptors:this[Yr],clientInterceptorProviders:this[Kr],callInterceptors:(o=h.callOptions.interceptors)!==null&&o!==void 0?o:[],callInterceptorProviders:(l=h.callOptions.interceptor_providers)!==null&&l!==void 0?l:[]},p=(0,ss.getInterceptingCall)(_,h.methodDefinition,h.callOptions,h.channel);f.call=p;let v=null,R=!1,O=new Error;return p.start(h.metadata,{onReceiveMetadata:P=>{f.emit("metadata",P)},onReceiveMessage(P){v!==null&&p.cancelWithStatus(Jt.Status.UNIMPLEMENTED,"Too many responses received"),v=P,p.startRead()},onReceiveStatus(P){if(!R){if(R=!0,P.code===Jt.Status.OK)if(v===null){let D=Xr(O);h.callback((0,vt.callErrorFromStatus)({code:Jt.Status.UNIMPLEMENTED,details:"No message received",metadata:P.metadata},D))}else h.callback(null,v);else{let D=Xr(O);h.callback((0,vt.callErrorFromStatus)(P,D))}O=null,f.emit("status",P)}}}),f}checkMetadataAndOptions(e,t){let r,n;return e instanceof Vr.Metadata?(r=e,t?n=t:n={}):(e?n=e:n={},r=new Vr.Metadata),{metadata:r,options:n}}makeServerStreamRequest(e,t,r,n,s,a){var o,l;let c=this.checkMetadataAndOptions(s,a),u={path:e,requestStream:!1,responseStream:!0,requestSerialize:t,responseDeserialize:r},h={argument:n,metadata:c.metadata,call:new vt.ClientReadableStreamImpl(r),channel:this[nt],methodDefinition:u,callOptions:c.options};this[Dt]&&(h=this[Dt](h));let f=h.call,_={clientInterceptors:this[Yr],clientInterceptorProviders:this[Kr],callInterceptors:(o=h.callOptions.interceptors)!==null&&o!==void 0?o:[],callInterceptorProviders:(l=h.callOptions.interceptor_providers)!==null&&l!==void 0?l:[]},p=(0,ss.getInterceptingCall)(_,h.methodDefinition,h.callOptions,h.channel);f.call=p;let v=!1,R=new Error;return p.start(h.metadata,{onReceiveMetadata(O){f.emit("metadata",O)},onReceiveMessage(O){f.push(O)},onReceiveStatus(O){if(!v){if(v=!0,f.push(null),O.code!==Jt.Status.OK){let P=Xr(R);f.emit("error",(0,vt.callErrorFromStatus)(O,P))}R=null,f.emit("status",O)}}}),p.sendMessage(n),p.halfClose(),f}makeBidiStreamRequest(e,t,r,n,s){var a,o;let l=this.checkMetadataAndOptions(n,s),c={path:e,requestStream:!0,responseStream:!0,requestSerialize:t,responseDeserialize:r},u={metadata:l.metadata,call:new vt.ClientDuplexStreamImpl(t,r),channel:this[nt],methodDefinition:c,callOptions:l.options};this[Dt]&&(u=this[Dt](u));let h=u.call,f={clientInterceptors:this[Yr],clientInterceptorProviders:this[Kr],callInterceptors:(a=u.callOptions.interceptors)!==null&&a!==void 0?a:[],callInterceptorProviders:(o=u.callOptions.interceptor_providers)!==null&&o!==void 0?o:[]},_=(0,ss.getInterceptingCall)(f,u.methodDefinition,u.callOptions,u.channel);h.call=_;let p=!1,v=new Error;return _.start(u.metadata,{onReceiveMetadata(R){h.emit("metadata",R)},onReceiveMessage(R){h.push(R)},onReceiveStatus(R){if(!p){if(p=!0,h.push(null),R.code!==Jt.Status.OK){let O=Xr(v);h.emit("error",(0,vt.callErrorFromStatus)(R,O))}v=null,h.emit("status",R)}}}),h}};as.Client=ko});var ls=g(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.makeClientConstructor=Hd;os.loadPackageDefinition=l_;var Wi=xo(),s_={unary:Wi.Client.prototype.makeUnaryRequest,server_stream:Wi.Client.prototype.makeServerStreamRequest,client_stream:Wi.Client.prototype.makeClientStreamRequest,bidi:Wi.Client.prototype.makeBidiStreamRequest};function Lo(i){return["__proto__","prototype","constructor"].includes(i)}function Hd(i,e,t){t||(t={});class r extends Wi.Client{}return Object.keys(i).forEach(n=>{if(Lo(n))return;let s=i[n],a;if(typeof n=="string"&&n.charAt(0)==="$")throw new Error("Method names cannot start with $");s.requestStream?s.responseStream?a="bidi":a="client_stream":s.responseStream?a="server_stream":a="unary";let o=s.requestSerialize,l=s.responseDeserialize,c=a_(s_[a],s.path,o,l);r.prototype[n]=c,Object.assign(r.prototype[n],s),s.originalName&&!Lo(s.originalName)&&(r.prototype[s.originalName]=r.prototype[n])}),r.service=i,r.serviceName=e,r}function a_(i,e,t,r){return function(...n){return i.call(this,e,t,r,...n)}}function o_(i){return"format"in i}function l_(i){let e={};for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)){let r=i[t],n=t.split(".");if(n.some(o=>Lo(o)))continue;let s=n[n.length-1],a=e;for(let o of n.slice(0,-1))a[o]||(a[o]={}),a=a[o];o_(r)?a[s]=r:a[s]=Hd(r,s,{})}return e}});var fh=g((kw,hh)=>{"use strict";var c_=1/0,u_="[object Symbol]",d_=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,h_=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,us="\\ud800-\\udfff",Xd="\\u0300-\\u036f\\ufe20-\\ufe23",Jd="\\u20d0-\\u20f0",Qd="\\u2700-\\u27bf",Zd="a-z\\xdf-\\xf6\\xf8-\\xff",f_="\\xac\\xb1\\xd7\\xf7",p_="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",g_="\\u2000-\\u206f",m_=" \\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",eh="A-Z\\xc0-\\xd6\\xd8-\\xde",th="\\ufe0e\\ufe0f",rh=f_+p_+g_+m_,qo="['\u2019]",v_="["+us+"]",jd="["+rh+"]",cs="["+Xd+Jd+"]",ih="\\d+",y_="["+Qd+"]",nh="["+Zd+"]",sh="[^"+us+rh+ih+Qd+Zd+eh+"]",Fo="\\ud83c[\\udffb-\\udfff]",__="(?:"+cs+"|"+Fo+")",ah="[^"+us+"]",Uo="(?:\\ud83c[\\udde6-\\uddff]){2}",Bo="[\\ud800-\\udbff][\\udc00-\\udfff]",Jr="["+eh+"]",oh="\\u200d",Wd="(?:"+nh+"|"+sh+")",E_="(?:"+Jr+"|"+sh+")",Gd="(?:"+qo+"(?:d|ll|m|re|s|t|ve))?",$d="(?:"+qo+"(?:D|LL|M|RE|S|T|VE))?",lh=__+"?",ch="["+th+"]?",S_="(?:"+oh+"(?:"+[ah,Uo,Bo].join("|")+")"+ch+lh+")*",uh=ch+lh+S_,C_="(?:"+[y_,Uo,Bo].join("|")+")"+uh,T_="(?:"+[ah+cs+"?",cs,Uo,Bo,v_].join("|")+")",b_=RegExp(qo,"g"),R_=RegExp(cs,"g"),w_=RegExp(Fo+"(?="+Fo+")|"+T_+uh,"g"),O_=RegExp([Jr+"?"+nh+"+"+Gd+"(?="+[jd,Jr,"$"].join("|")+")",E_+"+"+$d+"(?="+[jd,Jr+Wd,"$"].join("|")+")",Jr+"?"+Wd+"+"+Gd,Jr+"+"+$d,ih,C_].join("|"),"g"),A_=RegExp("["+oh+us+Xd+Jd+th+"]"),N_=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,P_={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},I_=typeof global=="object"&&global&&global.Object===Object&&global,M_=typeof self=="object"&&self&&self.Object===Object&&self,k_=I_||M_||Function("return this")();function x_(i,e,t,r){var n=-1,s=i?i.length:0;for(r&&s&&(t=i[++n]);++n<s;)t=e(t,i[n],n,i);return t}function D_(i){return i.split("")}function L_(i){return i.match(d_)||[]}function F_(i){return function(e){return i?.[e]}}var q_=F_(P_);function dh(i){return A_.test(i)}function U_(i){return N_.test(i)}function B_(i){return dh(i)?z_(i):D_(i)}function z_(i){return i.match(w_)||[]}function H_(i){return i.match(O_)||[]}var j_=Object.prototype,W_=j_.toString,Vd=k_.Symbol,Yd=Vd?Vd.prototype:void 0,Kd=Yd?Yd.toString:void 0;function G_(i,e,t){var r=-1,n=i.length;e<0&&(e=-e>n?0:n+e),t=t>n?n:t,t<0&&(t+=n),n=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(n);++r<n;)s[r]=i[r+e];return s}function $_(i){if(typeof i=="string")return i;if(J_(i))return Kd?Kd.call(i):"";var e=i+"";return e=="0"&&1/i==-c_?"-0":e}function V_(i,e,t){var r=i.length;return t=t===void 0?r:t,!e&&t>=r?i:G_(i,e,t)}function Y_(i){return function(e){e=ds(e);var t=dh(e)?B_(e):void 0,r=t?t[0]:e.charAt(0),n=t?V_(t,1).join(""):e.slice(1);return r[i]()+n}}function K_(i){return function(e){return x_(r0(e0(e).replace(b_,"")),i,"")}}function X_(i){return!!i&&typeof i=="object"}function J_(i){return typeof i=="symbol"||X_(i)&&W_.call(i)==u_}function ds(i){return i==null?"":$_(i)}var Q_=K_(function(i,e,t){return e=e.toLowerCase(),i+(t?Z_(e):e)});function Z_(i){return t0(ds(i).toLowerCase())}function e0(i){return i=ds(i),i&&i.replace(h_,q_).replace(R_,"")}var t0=Y_("toUpperCase");function r0(i,e,t){return i=ds(i),e=t?void 0:e,e===void 0?U_(i)?H_(i):L_(i):i.match(e)||[]}hh.exports=Q_});var zo=g((xw,ph)=>{"use strict";ph.exports=i0;function i0(i,e){for(var t=new Array(arguments.length-1),r=0,n=2,s=!0;n<arguments.length;)t[r++]=arguments[n++];return new Promise(function(o,l){t[r]=function(u){if(s)if(s=!1,u)l(u);else{for(var h=new Array(arguments.length-1),f=0;f<h.length;)h[f++]=arguments[f];o.apply(null,h)}};try{i.apply(e||null,t)}catch(c){s&&(s=!1,l(c))}})}});var yh=g(vh=>{"use strict";var hs=vh;hs.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&e.charAt(t)==="=";)++r;return Math.ceil(e.length*3)/4-r};var Qr=new Array(64),mh=new Array(123);for(st=0;st<64;)mh[Qr[st]=st<26?st+65:st<52?st+71:st<62?st-4:st-59|43]=st++;var st;hs.encode=function(e,t,r){for(var n=null,s=[],a=0,o=0,l;t<r;){var c=e[t++];switch(o){case 0:s[a++]=Qr[c>>2],l=(c&3)<<4,o=1;break;case 1:s[a++]=Qr[l|c>>4],l=(c&15)<<2,o=2;break;case 2:s[a++]=Qr[l|c>>6],s[a++]=Qr[c&63],o=0;break}a>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,s)),a=0)}return o&&(s[a++]=Qr[l],s[a++]=61,o===1&&(s[a++]=61)),n?(a&&n.push(String.fromCharCode.apply(String,s.slice(0,a))),n.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var gh="invalid encoding";hs.decode=function(e,t,r){for(var n=r,s=0,a,o=0;o<e.length;){var l=e.charCodeAt(o++);if(l===61&&s>1)break;if((l=mh[l])===void 0)throw Error(gh);switch(s){case 0:a=l,s=1;break;case 1:t[r++]=a<<2|(l&48)>>4,a=l,s=2;break;case 2:t[r++]=(a&15)<<4|(l&60)>>2,a=l,s=3;break;case 3:t[r++]=(a&3)<<6|l,s=0;break}}if(s===1)throw Error(gh);return r-n};hs.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var Eh=g((Lw,_h)=>{"use strict";_h.exports=fs;function fs(){this._listeners=Object.create(null)}fs.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this};fs.prototype.off=function(e,t){if(e===void 0)this._listeners=Object.create(null);else if(t===void 0)this._listeners[e]=[];else{var r=this._listeners[e];if(!r)return this;for(var n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n}return this};fs.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}});var Oh=g((Fw,wh)=>{"use strict";wh.exports=Sh(Sh);function Sh(i){return typeof Float32Array<"u"?(function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),r=t[3]===128;function n(l,c,u){e[0]=l,c[u]=t[0],c[u+1]=t[1],c[u+2]=t[2],c[u+3]=t[3]}function s(l,c,u){e[0]=l,c[u]=t[3],c[u+1]=t[2],c[u+2]=t[1],c[u+3]=t[0]}i.writeFloatLE=r?n:s,i.writeFloatBE=r?s:n;function a(l,c){return t[0]=l[c],t[1]=l[c+1],t[2]=l[c+2],t[3]=l[c+3],e[0]}function o(l,c){return t[3]=l[c],t[2]=l[c+1],t[1]=l[c+2],t[0]=l[c+3],e[0]}i.readFloatLE=r?a:o,i.readFloatBE=r?o:a})():(function(){function e(r,n,s,a){var o=n<0?1:0;if(o&&(n=-n),n===0)r(1/n>0?0:2147483648,s,a);else if(isNaN(n))r(2143289344,s,a);else if(n>34028234663852886e22)r((o<<31|2139095040)>>>0,s,a);else if(n<11754943508222875e-54)r((o<<31|Math.round(n/1401298464324817e-60))>>>0,s,a);else{var l=Math.floor(Math.log(n)/Math.LN2),c=Math.round(n*Math.pow(2,-l)*8388608)&8388607;r((o<<31|l+127<<23|c)>>>0,s,a)}}i.writeFloatLE=e.bind(null,Ch),i.writeFloatBE=e.bind(null,Th);function t(r,n,s){var a=r(n,s),o=(a>>31)*2+1,l=a>>>23&255,c=a&8388607;return l===255?c?NaN:o*(1/0):l===0?o*1401298464324817e-60*c:o*Math.pow(2,l-150)*(c+8388608)}i.readFloatLE=t.bind(null,bh),i.readFloatBE=t.bind(null,Rh)})(),typeof Float64Array<"u"?(function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),r=t[7]===128;function n(l,c,u){e[0]=l,c[u]=t[0],c[u+1]=t[1],c[u+2]=t[2],c[u+3]=t[3],c[u+4]=t[4],c[u+5]=t[5],c[u+6]=t[6],c[u+7]=t[7]}function s(l,c,u){e[0]=l,c[u]=t[7],c[u+1]=t[6],c[u+2]=t[5],c[u+3]=t[4],c[u+4]=t[3],c[u+5]=t[2],c[u+6]=t[1],c[u+7]=t[0]}i.writeDoubleLE=r?n:s,i.writeDoubleBE=r?s:n;function a(l,c){return t[0]=l[c],t[1]=l[c+1],t[2]=l[c+2],t[3]=l[c+3],t[4]=l[c+4],t[5]=l[c+5],t[6]=l[c+6],t[7]=l[c+7],e[0]}function o(l,c){return t[7]=l[c],t[6]=l[c+1],t[5]=l[c+2],t[4]=l[c+3],t[3]=l[c+4],t[2]=l[c+5],t[1]=l[c+6],t[0]=l[c+7],e[0]}i.readDoubleLE=r?a:o,i.readDoubleBE=r?o:a})():(function(){function e(r,n,s,a,o,l){var c=a<0?1:0;if(c&&(a=-a),a===0)r(0,o,l+n),r(1/a>0?0:2147483648,o,l+s);else if(isNaN(a))r(0,o,l+n),r(2146959360,o,l+s);else if(a>17976931348623157e292)r(0,o,l+n),r((c<<31|2146435072)>>>0,o,l+s);else{var u;if(a<22250738585072014e-324)u=a/5e-324,r(u>>>0,o,l+n),r((c<<31|u/4294967296)>>>0,o,l+s);else{var h=Math.floor(Math.log(a)/Math.LN2);h===1024&&(h=1023),u=a*Math.pow(2,-h),r(u*4503599627370496>>>0,o,l+n),r((c<<31|h+1023<<20|u*1048576&1048575)>>>0,o,l+s)}}}i.writeDoubleLE=e.bind(null,Ch,0,4),i.writeDoubleBE=e.bind(null,Th,4,0);function t(r,n,s,a,o){var l=r(a,o+n),c=r(a,o+s),u=(c>>31)*2+1,h=c>>>20&2047,f=4294967296*(c&1048575)+l;return h===2047?f?NaN:u*(1/0):h===0?u*5e-324*f:u*Math.pow(2,h-1075)*(f+4503599627370496)}i.readDoubleLE=t.bind(null,bh,0,4),i.readDoubleBE=t.bind(null,Rh,4,0)})(),i}function Ch(i,e,t){e[t]=i&255,e[t+1]=i>>>8&255,e[t+2]=i>>>16&255,e[t+3]=i>>>24}function Th(i,e,t){e[t]=i>>>24,e[t+1]=i>>>16&255,e[t+2]=i>>>8&255,e[t+3]=i&255}function bh(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16|i[e+3]<<24)>>>0}function Rh(i,e){return(i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3])>>>0}});var Nh=g(Ah=>{"use strict";var jo=Ah,Ho=65533;jo.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)r=e.charCodeAt(n),r<128?t+=1:r<2048?t+=2:(r&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t};jo.read=function(e,t,r){if(r-t<1)return"";for(var n=null,s=[],a=0,o,l,c,u;t<r;)o=e[t++],o<=127?s[a++]=o:o>=192&&o<224?(c=(o&31)<<6|e[t++]&63,s[a++]=c>=128?c:Ho):o>=224&&o<240?(u=(o&15)<<12|(e[t++]&63)<<6|e[t++]&63,s[a++]=u>=2048?u:Ho):o>=240&&(l=(o&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63,l<65536||l>1114111?s[a++]=Ho:(l-=65536,s[a++]=55296+(l>>10),s[a++]=56320+(l&1023))),a>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,s.slice(0,a))),a=0);return n?(a&&n.push(String.fromCharCode.apply(String,s.slice(0,a))),n.join("")):String.fromCharCode.apply(String,s.slice(0,a))};jo.write=function(e,t,r){for(var n=r,s,a,o=0;o<e.length;++o)s=e.charCodeAt(o),s<128?t[r++]=s:s<2048?(t[r++]=s>>6|192,t[r++]=s&63|128):(s&64512)===55296&&((a=e.charCodeAt(o+1))&64512)===56320?(s=65536+((s&1023)<<10)+(a&1023),++o,t[r++]=s>>18|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128,t[r++]=s&63|128):(t[r++]=s>>12|224,t[r++]=s>>6&63|128,t[r++]=s&63|128);return r-n}});var Ih=g((Uw,Ph)=>{"use strict";Ph.exports=n0;function n0(i,e,t){var r=t||8192,n=r>>>1,s=null,a=r;return function(l){if(l<1||l>n)return i(l);a+l>r&&(s=i(r),a=0);var c=e.call(s,a,a+=l);return a&7&&(a=(a|7)+1),c}}});var kh=g((Bw,Mh)=>{"use strict";Mh.exports=ge;var Gi=at();function ge(i,e){this.lo=i>>>0,this.hi=e>>>0}var Sr=ge.zero=new ge(0,0);Sr.toNumber=function(){return 0};Sr.zzEncode=Sr.zzDecode=function(){return this};Sr.length=function(){return 1};var s0=ge.zeroHash="\0\0\0\0\0\0\0\0";ge.fromNumber=function(e){if(e===0)return Sr;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new ge(r,n)};ge.from=function(e){if(typeof e=="number")return ge.fromNumber(e);if(Gi.isString(e))if(Gi.Long)e=Gi.Long.fromString(e);else return ge.fromNumber(parseInt(e,10));return e.low||e.high?new ge(e.low>>>0,e.high>>>0):Sr};ge.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+r*4294967296)}return this.lo+this.hi*4294967296};ge.prototype.toLong=function(e){return Gi.Long?new Gi.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Qt=String.prototype.charCodeAt;ge.fromHash=function(e){return e===s0?Sr:new ge((Qt.call(e,0)|Qt.call(e,1)<<8|Qt.call(e,2)<<16|Qt.call(e,3)<<24)>>>0,(Qt.call(e,4)|Qt.call(e,5)<<8|Qt.call(e,6)<<16|Qt.call(e,7)<<24)>>>0)};ge.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};ge.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};ge.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};ge.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return r===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}});var Go=g(($i,Wo)=>{"use strict";(function(i,e){function t(r){return r.default||r}typeof define=="function"&&define.amd?define([],function(){var r={};return e(r),t(r)}):typeof $i=="object"?(e($i),typeof Wo=="object"&&(Wo.exports=t($i))):(function(){var r={};e(r),i.Long=t(r)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:$i,function(i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0;var e=null;try{e=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 t(C,d,b){this.low=C|0,this.high=d|0,this.unsigned=!!b}t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0});function r(C){return(C&&C.__isLong__)===!0}function n(C){var d=Math.clz32(C&-C);return C?31-d:d}t.isLong=r;var s={},a={};function o(C,d){var b,W,j;return d?(C>>>=0,(j=0<=C&&C<256)&&(W=a[C],W)?W:(b=c(C,0,!0),j&&(a[C]=b),b)):(C|=0,(j=-128<=C&&C<128)&&(W=s[C],W)?W:(b=c(C,C<0?-1:0,!1),j&&(s[C]=b),b))}t.fromInt=o;function l(C,d){if(isNaN(C))return d?E:D;if(d){if(C<0)return E;if(C>=R)return K}else{if(C<=-O)return F;if(C+1>=O)return X}return C<0?l(-C,d).neg():c(C%v|0,C/v|0,d)}t.fromNumber=l;function c(C,d,b){return new t(C,d,b)}t.fromBits=c;var u=Math.pow;function h(C,d,b){if(C.length===0)throw Error("empty string");if(typeof d=="number"?(b=d,d=!1):d=!!d,C==="NaN"||C==="Infinity"||C==="+Infinity"||C==="-Infinity")return d?E:D;if(b=b||10,b<2||36<b)throw RangeError("radix");var W;if((W=C.indexOf("-"))>0)throw Error("interior hyphen");if(W===0)return h(C.substring(1),d,b).neg();for(var j=l(u(b,8)),Z=D,ae=0;ae<C.length;ae+=8){var be=Math.min(8,C.length-ae),we=parseInt(C.substring(ae,ae+be),b);if(be<8){var fe=l(u(b,be));Z=Z.mul(fe).add(l(we))}else Z=Z.mul(j),Z=Z.add(l(we))}return Z.unsigned=d,Z}t.fromString=h;function f(C,d){return typeof C=="number"?l(C,d):typeof C=="string"?h(C,d):c(C.low,C.high,typeof d=="boolean"?d:C.unsigned)}t.fromValue=f;var _=65536,p=1<<24,v=_*_,R=v*v,O=R/2,P=o(p),D=o(0);t.ZERO=D;var E=o(0,!0);t.UZERO=E;var x=o(1);t.ONE=x;var k=o(1,!0);t.UONE=k;var H=o(-1);t.NEG_ONE=H;var X=c(-1,2147483647,!1);t.MAX_VALUE=X;var K=c(-1,-1,!0);t.MAX_UNSIGNED_VALUE=K;var F=c(0,-2147483648,!1);t.MIN_VALUE=F;var y=t.prototype;y.toInt=function(){return this.unsigned?this.low>>>0:this.low},y.toNumber=function(){return this.unsigned?(this.high>>>0)*v+(this.low>>>0):this.high*v+(this.low>>>0)},y.toString=function(d){if(d=d||10,d<2||36<d)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(F)){var b=l(d),W=this.div(b),j=W.mul(b).sub(this);return W.toString(d)+j.toInt().toString(d)}else return"-"+this.neg().toString(d);for(var Z=l(u(d,6),this.unsigned),ae=this,be="";;){var we=ae.div(Z),fe=ae.sub(we.mul(Z)).toInt()>>>0,Y=fe.toString(d);if(ae=we,ae.isZero())return Y+be;for(;Y.length<6;)Y="0"+Y;be=""+Y+be}},y.getHighBits=function(){return this.high},y.getHighBitsUnsigned=function(){return this.high>>>0},y.getLowBits=function(){return this.low},y.getLowBitsUnsigned=function(){return this.low>>>0},y.getNumBitsAbs=function(){if(this.isNegative())return this.eq(F)?64:this.neg().getNumBitsAbs();for(var d=this.high!=0?this.high:this.low,b=31;b>0&&(d&1<<b)==0;b--);return this.high!=0?b+33:b+1},y.isSafeInteger=function(){var d=this.high>>21;return d?this.unsigned?!1:d===-1&&!(this.low===0&&this.high===-2097152):!0},y.isZero=function(){return this.high===0&&this.low===0},y.eqz=y.isZero,y.isNegative=function(){return!this.unsigned&&this.high<0},y.isPositive=function(){return this.unsigned||this.high>=0},y.isOdd=function(){return(this.low&1)===1},y.isEven=function(){return(this.low&1)===0},y.equals=function(d){return r(d)||(d=f(d)),this.unsigned!==d.unsigned&&this.high>>>31===1&&d.high>>>31===1?!1:this.high===d.high&&this.low===d.low},y.eq=y.equals,y.notEquals=function(d){return!this.eq(d)},y.neq=y.notEquals,y.ne=y.notEquals,y.lessThan=function(d){return this.comp(d)<0},y.lt=y.lessThan,y.lessThanOrEqual=function(d){return this.comp(d)<=0},y.lte=y.lessThanOrEqual,y.le=y.lessThanOrEqual,y.greaterThan=function(d){return this.comp(d)>0},y.gt=y.greaterThan,y.greaterThanOrEqual=function(d){return this.comp(d)>=0},y.gte=y.greaterThanOrEqual,y.ge=y.greaterThanOrEqual,y.compare=function(d){if(r(d)||(d=f(d)),this.eq(d))return 0;var b=this.isNegative(),W=d.isNegative();return b&&!W?-1:!b&&W?1:this.unsigned?d.high>>>0>this.high>>>0||d.high===this.high&&d.low>>>0>this.low>>>0?-1:1:this.sub(d).isNegative()?-1:1},y.comp=y.compare,y.negate=function(){return!this.unsigned&&this.eq(F)?F:this.not().add(x)},y.neg=y.negate,y.add=function(d){r(d)||(d=f(d));var b=this.high>>>16,W=this.high&65535,j=this.low>>>16,Z=this.low&65535,ae=d.high>>>16,be=d.high&65535,we=d.low>>>16,fe=d.low&65535,Y=0,Oe=0,se=0,Ae=0;return Ae+=Z+fe,se+=Ae>>>16,Ae&=65535,se+=j+we,Oe+=se>>>16,se&=65535,Oe+=W+be,Y+=Oe>>>16,Oe&=65535,Y+=b+ae,Y&=65535,c(se<<16|Ae,Y<<16|Oe,this.unsigned)},y.subtract=function(d){return r(d)||(d=f(d)),this.add(d.neg())},y.sub=y.subtract,y.multiply=function(d){if(this.isZero())return this;if(r(d)||(d=f(d)),e){var b=e.mul(this.low,this.high,d.low,d.high);return c(b,e.get_high(),this.unsigned)}if(d.isZero())return this.unsigned?E:D;if(this.eq(F))return d.isOdd()?F:D;if(d.eq(F))return this.isOdd()?F:D;if(this.isNegative())return d.isNegative()?this.neg().mul(d.neg()):this.neg().mul(d).neg();if(d.isNegative())return this.mul(d.neg()).neg();if(this.lt(P)&&d.lt(P))return l(this.toNumber()*d.toNumber(),this.unsigned);var W=this.high>>>16,j=this.high&65535,Z=this.low>>>16,ae=this.low&65535,be=d.high>>>16,we=d.high&65535,fe=d.low>>>16,Y=d.low&65535,Oe=0,se=0,Ae=0,It=0;return It+=ae*Y,Ae+=It>>>16,It&=65535,Ae+=Z*Y,se+=Ae>>>16,Ae&=65535,Ae+=ae*fe,se+=Ae>>>16,Ae&=65535,se+=j*Y,Oe+=se>>>16,se&=65535,se+=Z*fe,Oe+=se>>>16,se&=65535,se+=ae*we,Oe+=se>>>16,se&=65535,Oe+=W*Y+j*fe+Z*we+ae*be,Oe&=65535,c(Ae<<16|It,Oe<<16|se,this.unsigned)},y.mul=y.multiply,y.divide=function(d){if(r(d)||(d=f(d)),d.isZero())throw Error("division by zero");if(e){if(!this.unsigned&&this.high===-2147483648&&d.low===-1&&d.high===-1)return this;var b=(this.unsigned?e.div_u:e.div_s)(this.low,this.high,d.low,d.high);return c(b,e.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?E:D;var W,j,Z;if(this.unsigned){if(d.unsigned||(d=d.toUnsigned()),d.gt(this))return E;if(d.gt(this.shru(1)))return k;Z=E}else{if(this.eq(F)){if(d.eq(x)||d.eq(H))return F;if(d.eq(F))return x;var ae=this.shr(1);return W=ae.div(d).shl(1),W.eq(D)?d.isNegative()?x:H:(j=this.sub(d.mul(W)),Z=W.add(j.div(d)),Z)}else if(d.eq(F))return this.unsigned?E:D;if(this.isNegative())return d.isNegative()?this.neg().div(d.neg()):this.neg().div(d).neg();if(d.isNegative())return this.div(d.neg()).neg();Z=D}for(j=this;j.gte(d);){W=Math.max(1,Math.floor(j.toNumber()/d.toNumber()));for(var be=Math.ceil(Math.log(W)/Math.LN2),we=be<=48?1:u(2,be-48),fe=l(W),Y=fe.mul(d);Y.isNegative()||Y.gt(j);)W-=we,fe=l(W,this.unsigned),Y=fe.mul(d);fe.isZero()&&(fe=x),Z=Z.add(fe),j=j.sub(Y)}return Z},y.div=y.divide,y.modulo=function(d){if(r(d)||(d=f(d)),e){var b=(this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,d.low,d.high);return c(b,e.get_high(),this.unsigned)}return this.sub(this.div(d).mul(d))},y.mod=y.modulo,y.rem=y.modulo,y.not=function(){return c(~this.low,~this.high,this.unsigned)},y.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},y.clz=y.countLeadingZeros,y.countTrailingZeros=function(){return this.low?n(this.low):n(this.high)+32},y.ctz=y.countTrailingZeros,y.and=function(d){return r(d)||(d=f(d)),c(this.low&d.low,this.high&d.high,this.unsigned)},y.or=function(d){return r(d)||(d=f(d)),c(this.low|d.low,this.high|d.high,this.unsigned)},y.xor=function(d){return r(d)||(d=f(d)),c(this.low^d.low,this.high^d.high,this.unsigned)},y.shiftLeft=function(d){return r(d)&&(d=d.toInt()),(d&=63)===0?this:d<32?c(this.low<<d,this.high<<d|this.low>>>32-d,this.unsigned):c(0,this.low<<d-32,this.unsigned)},y.shl=y.shiftLeft,y.shiftRight=function(d){return r(d)&&(d=d.toInt()),(d&=63)===0?this:d<32?c(this.low>>>d|this.high<<32-d,this.high>>d,this.unsigned):c(this.high>>d-32,this.high>=0?0:-1,this.unsigned)},y.shr=y.shiftRight,y.shiftRightUnsigned=function(d){return r(d)&&(d=d.toInt()),(d&=63)===0?this:d<32?c(this.low>>>d|this.high<<32-d,this.high>>>d,this.unsigned):d===32?c(this.high,0,this.unsigned):c(this.high>>>d-32,0,this.unsigned)},y.shru=y.shiftRightUnsigned,y.shr_u=y.shiftRightUnsigned,y.rotateLeft=function(d){var b;return r(d)&&(d=d.toInt()),(d&=63)===0?this:d===32?c(this.high,this.low,this.unsigned):d<32?(b=32-d,c(this.low<<d|this.high>>>b,this.high<<d|this.low>>>b,this.unsigned)):(d-=32,b=32-d,c(this.high<<d|this.low>>>b,this.low<<d|this.high>>>b,this.unsigned))},y.rotl=y.rotateLeft,y.rotateRight=function(d){var b;return r(d)&&(d=d.toInt()),(d&=63)===0?this:d===32?c(this.high,this.low,this.unsigned):d<32?(b=32-d,c(this.high<<b|this.low>>>d,this.low<<b|this.high>>>d,this.unsigned)):(d-=32,b=32-d,c(this.low<<b|this.high>>>d,this.high<<b|this.low>>>d,this.unsigned))},y.rotr=y.rotateRight,y.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},y.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},y.toBytes=function(d){return d?this.toBytesLE():this.toBytesBE()},y.toBytesLE=function(){var d=this.high,b=this.low;return[b&255,b>>>8&255,b>>>16&255,b>>>24,d&255,d>>>8&255,d>>>16&255,d>>>24]},y.toBytesBE=function(){var d=this.high,b=this.low;return[d>>>24,d>>>16&255,d>>>8&255,d&255,b>>>24,b>>>16&255,b>>>8&255,b&255]},t.fromBytes=function(d,b,W){return W?t.fromBytesLE(d,b):t.fromBytesBE(d,b)},t.fromBytesLE=function(d,b){return new t(d[0]|d[1]<<8|d[2]<<16|d[3]<<24,d[4]|d[5]<<8|d[6]<<16|d[7]<<24,b)},t.fromBytesBE=function(d,b){return new t(d[4]<<24|d[5]<<16|d[6]<<8|d[7],d[0]<<24|d[1]<<16|d[2]<<8|d[3],b)},typeof BigInt=="function"&&(t.fromBigInt=function(d,b){var W=Number(BigInt.asIntN(32,d)),j=Number(BigInt.asIntN(32,d>>BigInt(32)));return c(W,j,b)},t.fromValue=function(d,b){return typeof d=="bigint"?t.fromBigInt(d,b):f(d,b)},y.toBigInt=function(){var d=BigInt(this.low>>>0),b=BigInt(this.unsigned?this.high>>>0:this.high);return b<<BigInt(32)|d});var Re=i.default=t})});var at=g($o=>{"use strict";var I=$o;I.asPromise=zo();I.base64=yh();I.EventEmitter=Eh();I.float=Oh();I.utf8=Nh();I.pool=Ih();I.LongBits=kh();function xh(i){return i==="__proto__"||i==="prototype"||i==="constructor"}I.isUnsafeProperty=xh;I.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);I.global=I.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||$o;I.emptyArray=Object.freeze?Object.freeze([]):[];I.emptyObject=Object.freeze?Object.freeze({}):{};I.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};I.isString=function(e){return typeof e=="string"||e instanceof String};I.isObject=function(e){return e&&typeof e=="object"};I.isset=I.isSet=function(e,t){var r=e[t];return r!=null&&Object.hasOwnProperty.call(e,t)?typeof r!="object"||(Array.isArray(r)?r.length:Object.keys(r).length)>0:!1};I.Buffer=(function(){try{var i=I.global.Buffer;return i.prototype.utf8Write?i:null}catch{return null}})();I._Buffer_from=null;I._Buffer_allocUnsafe=null;I.newBuffer=function(e){return typeof e=="number"?I.Buffer?I._Buffer_allocUnsafe(e):new I.Array(e):I.Buffer?I._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};I.Array=typeof Uint8Array<"u"?Uint8Array:Array;I.Long=I.global.dcodeIO&&I.global.dcodeIO.Long||I.global.Long||(function(){try{var i=Go();return i&&i.isLong?i:null}catch{return null}})();I.key2Re=/^true|false|0|1$/;I.key32Re=/^-?(?:0|[1-9][0-9]*)$/;I.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;I.longToHash=function(e){return e?I.LongBits.from(e).toHash():I.LongBits.zeroHash};I.longFromHash=function(e,t){var r=I.LongBits.fromHash(e);return I.Long?I.Long.fromBits(r.lo,r.hi,t):r.toNumber(!!t)};function Dh(i){var e=typeof arguments[arguments.length-1]=="boolean",t=e?arguments.length-1:arguments.length;e=e&&arguments[arguments.length-1];for(var r=1;r<t;++r){var n=arguments[r];if(n)for(var s=Object.keys(n),a=0;a<s.length;++a)!xh(s[a])&&(i[s[a]]===void 0||!e)&&(i[s[a]]=n[s[a]])}return i}I.merge=Dh;I.nestingLimit=32;I.recursionLimit=100;I.makeProp=function(e,t){Object.defineProperty(e,t,{enumerable:!0,configurable:!0,writable:!0})};I.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function Lh(i){function e(t,r){if(!(this instanceof e))return new e(t,r);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),r&&Dh(this,r)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return i},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}I.newError=Lh;I.ProtocolError=Lh("ProtocolError");I.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var n=Object.keys(this),s=n.length-1;s>-1;--s)if(t[n[s]]===1&&this[n[s]]!==void 0&&this[n[s]]!==null)return n[s]}};I.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}};I.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};I._configure=function(){var i=I.Buffer;if(!i){I._Buffer_from=I._Buffer_allocUnsafe=null;return}I._Buffer_from=i.from!==Uint8Array.from&&i.from||function(t,r){return new i(t,r)},I._Buffer_allocUnsafe=i.allocUnsafe||function(t){return new i(t)}}});var gs=g((Hw,Bh)=>{"use strict";Bh.exports=V;var Ve=at(),Vo,ps=Ve.LongBits,Fh=Ve.base64,qh=Ve.utf8;function Vi(i,e,t){this.fn=i,this.len=e,this.next=void 0,this.val=t}function Ko(){}function a0(i){this.head=i.head,this.tail=i.tail,this.len=i.len,this.next=i.states}function V(){this.len=0,this.head=new Vi(Ko,0,0),this.tail=this.head,this.states=null}var Uh=function(){return Ve.Buffer?function(){return(V.create=function(){return new Vo})()}:function(){return new V}};V.create=Uh();V.alloc=function(e){return new Ve.Array(e)};Ve.Array!==Array&&(V.alloc=Ve.pool(V.alloc,Ve.Array.prototype.subarray));V.prototype._push=function(e,t,r){return this.tail=this.tail.next=new Vi(e,t,r),this.len+=t,this};function Xo(i,e,t){e[t]=i&255}function o0(i,e,t){for(;i>127;)e[t++]=i&127|128,i>>>=7;e[t]=i}function Jo(i,e){this.len=i,this.next=void 0,this.val=e}Jo.prototype=Object.create(Vi.prototype);Jo.prototype.fn=o0;V.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Jo((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};V.prototype.int32=function(e){return(e|=0)<0?this._push(Qo,10,ps.fromNumber(e)):this.uint32(e)};V.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Qo(i,e,t){for(var r=i.lo,n=i.hi;n;)e[t++]=r&127|128,r=(r>>>7|n<<25)>>>0,n>>>=7;for(;r>127;)e[t++]=r&127|128,r=r>>>7;e[t++]=r}V.prototype.uint64=function(e){var t=ps.from(e);return this._push(Qo,t.length(),t)};V.prototype.int64=V.prototype.uint64;V.prototype.sint64=function(e){var t=ps.from(e).zzEncode();return this._push(Qo,t.length(),t)};V.prototype.bool=function(e){return this._push(Xo,1,e?1:0)};function Yo(i,e,t){e[t]=i&255,e[t+1]=i>>>8&255,e[t+2]=i>>>16&255,e[t+3]=i>>>24}V.prototype.fixed32=function(e){return this._push(Yo,4,e>>>0)};V.prototype.sfixed32=V.prototype.fixed32;V.prototype.fixed64=function(e){var t=ps.from(e);return this._push(Yo,4,t.lo)._push(Yo,4,t.hi)};V.prototype.sfixed64=V.prototype.fixed64;V.prototype.float=function(e){return this._push(Ve.float.writeFloatLE,4,e)};V.prototype.double=function(e){return this._push(Ve.float.writeDoubleLE,8,e)};var l0=Ve.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};V.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(Xo,1,0);if(Ve.isString(e)){var r=V.alloc(t=Fh.length(e));Fh.decode(e,r,0),e=r}return this.uint32(t)._push(l0,t,e)};V.prototype.string=function(e){var t=qh.length(e);return t?this.uint32(t)._push(qh.write,t,e):this._push(Xo,1,0)};V.prototype.fork=function(){return this.states=new a0(this),this.head=this.tail=new Vi(Ko,0,0),this.len=0,this};V.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Vi(Ko,0,0),this.len=0),this};V.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this};V.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t};V._configure=function(i){Vo=i,V.create=Uh(),Vo._configure()}});var jh=g((jw,Hh)=>{"use strict";Hh.exports=yt;var zh=gs();(yt.prototype=Object.create(zh.prototype)).constructor=yt;var Zt=at();function yt(){zh.call(this)}yt._configure=function(){yt.alloc=Zt._Buffer_allocUnsafe,yt.writeBytesBuffer=Zt.Buffer&&Zt.Buffer.prototype instanceof Uint8Array&&Zt.Buffer.prototype.set.name==="set"?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}};yt.prototype.bytes=function(e){Zt.isString(e)&&(e=Zt._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(yt.writeBytesBuffer,t,e),this};function c0(i,e,t){i.length<40?Zt.utf8.write(i,e,t):e.utf8Write?e.utf8Write(i,t):e.write(i,t)}yt.prototype.string=function(e){var t=Zt.Buffer.byteLength(e);return this.uint32(t),t&&this._push(c0,t,e),this};yt._configure()});var vs=g((Ww,Yh)=>{"use strict";Yh.exports=ne;var Ye=at(),el,$h=Ye.LongBits,u0=Ye.utf8;function Le(i,e){return RangeError("index out of range: "+i.pos+" + "+(e||1)+" > "+i.len)}function ne(i){this.buf=i,this.pos=0,this.len=i.length}var Wh=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new ne(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new ne(e);throw Error("illegal buffer")},Vh=function(){return Ye.Buffer?function(t){return(ne.create=function(n){return Ye.Buffer.isBuffer(n)?new el(n):Wh(n)})(t)}:Wh};ne.create=Vh();ne.prototype._slice=Ye.Array.prototype.subarray||Ye.Array.prototype.slice;function d0(i){for(var e=0,t=0;t<4;++t){if(i.pos>=i.len)throw Le(i);var r=i.buf[i.pos++];if(e=(e|(r&127)<<t*7)>>>0,r<128)return e}throw Le(i)}ne.prototype.uint32=(function(){var e=4294967295;return function(){if(this.len-this.pos<5){if(this.pos>=this.len)throw Le(this);if(this.buf[this.pos]>=128)return d0(this)}if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Le(this,10);return e}})();ne.prototype.int32=function(){return this.uint32()|0};ne.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Zo(){var i=new $h(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(i.lo=(i.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return i;if(i.lo=(i.lo|(this.buf[this.pos]&127)<<28)>>>0,i.hi=(i.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return i;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Le(this);if(i.lo=(i.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return i}return i.lo=(i.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,i}if(this.len-this.pos>4){for(;e<5;++e)if(i.hi=(i.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return i}else for(;e<5;++e){if(this.pos>=this.len)throw Le(this);if(i.hi=(i.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return i}throw Error("invalid varint encoding")}ne.prototype.bool=function(){return this.uint32()!==0};function ms(i,e){return(i[e-4]|i[e-3]<<8|i[e-2]<<16|i[e-1]<<24)>>>0}ne.prototype.fixed32=function(){if(this.pos+4>this.len)throw Le(this,4);return ms(this.buf,this.pos+=4)};ne.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Le(this,4);return ms(this.buf,this.pos+=4)|0};function Gh(){if(this.pos+8>this.len)throw Le(this,8);return new $h(ms(this.buf,this.pos+=4),ms(this.buf,this.pos+=4))}ne.prototype.float=function(){if(this.pos+4>this.len)throw Le(this,4);var e=Ye.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};ne.prototype.double=function(){if(this.pos+8>this.len)throw Le(this,4);var e=Ye.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};ne.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw Le(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,r);if(t===r){var n=Ye.Buffer;return n?n.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,r)};ne.prototype.string=function(){var e=this.bytes();return u0.read(e,0,e.length)};ne.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Le(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Le(this);while(this.buf[this.pos++]&128);return this};ne.recursionLimit=Ye.recursionLimit;ne.prototype.skipType=function(i,e){if(e===void 0&&(e=0),e>ne.recursionLimit)throw Error("maximum nesting depth exceeded");switch(i){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(i=this.uint32()&7)!==4;)this.skipType(i,e+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+i+" at offset "+this.pos)}return this};ne._configure=function(i){el=i,ne.create=Vh(),el._configure();var e=Ye.Long?"toLong":"toNumber";Ye.merge(ne.prototype,{int64:function(){return Zo.call(this)[e](!1)},uint64:function(){return Zo.call(this)[e](!0)},sint64:function(){return Zo.call(this).zzDecode()[e](!1)},fixed64:function(){return Gh.call(this)[e](!0)},sfixed64:function(){return Gh.call(this)[e](!1)}})}});var Qh=g((Gw,Jh)=>{"use strict";Jh.exports=Cr;var Xh=vs();(Cr.prototype=Object.create(Xh.prototype)).constructor=Cr;var Kh=at();function Cr(i){Xh.call(this,i)}Cr._configure=function(){Kh.Buffer&&(Cr.prototype._slice=Kh.Buffer.prototype.slice)};Cr.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};Cr._configure()});var ef=g(($w,Zh)=>{"use strict";Zh.exports=Yi;var tl=at();(Yi.prototype=Object.create(tl.EventEmitter.prototype)).constructor=Yi;function Yi(i,e,t){if(typeof i!="function")throw TypeError("rpcImpl must be a function");tl.EventEmitter.call(this),this.rpcImpl=i,this.requestDelimited=!!e,this.responseDelimited=!!t}Yi.prototype.rpcCall=function i(e,t,r,n,s){if(!n)throw TypeError("request must be specified");var a=this;if(!s)return tl.asPromise(i,a,e,t,r,n);if(!a.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return a.rpcImpl(e,t[a.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(l,c){if(l)return a.emit("error",l,e),s(l);if(c===null){a.end(!0);return}if(!(c instanceof r))try{c=r[a.responseDelimited?"decodeDelimited":"decode"](c)}catch(u){return a.emit("error",u,e),s(u)}return a.emit("data",c,e),s(null,c)})}catch(o){a.emit("error",o,e),setTimeout(function(){s(o)},0);return}};Yi.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var rl=g(tf=>{"use strict";var h0=tf;h0.Service=ef()});var il=g((Yw,rf)=>{"use strict";rf.exports=Object.create(null)});var af=g(sf=>{"use strict";var Fe=sf;Fe.build="minimal";Fe.Writer=gs();Fe.BufferWriter=jh();Fe.Reader=vs();Fe.BufferReader=Qh();Fe.util=at();Fe.rpc=rl();Fe.roots=il();Fe.configure=nf;function nf(){Fe.util._configure(),Fe.Writer._configure(Fe.BufferWriter),Fe.Reader._configure(Fe.BufferReader)}nf()});var lf=g((Xw,of)=>{"use strict";of.exports=nl;var f0=/^(?: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)$/;function nl(i,e){typeof i=="string"&&(e=i,i=void 0);var t=[];function r(s){if(typeof s!="string"){var a=n();if(nl.verbose&&console.log("codegen: "+a),a="return "+a,s){for(var o=Object.keys(s),l=new Array(o.length+1),c=new Array(o.length),u=0;u<o.length;)l[u]=o[u],c[u]=s[o[u++]];return l[u]=a,Function.apply(null,l).apply(null,c)}return Function(a)()}for(var h=new Array(arguments.length-1),f=0;f<h.length;)h[f]=arguments[++f];if(f=0,s=s.replace(/%([%dfijs])/g,function(p,v){var R=h[f++];switch(v){case"d":case"f":return String(Number(R));case"i":return String(Math.floor(R));case"j":return JSON.stringify(R);case"s":return String(R)}return"%"}),f!==h.length)throw Error("parameter count mismatch");return t.push(s),r}function n(s){return"function "+p0(s||e)+"("+(i&&i.join(",")||"")+`){
|
|
9
|
+
`+t.join(`
|
|
10
|
+
`)+`
|
|
11
|
+
}`}return r.toString=n,r}nl.verbose=!1;function p0(i){return!i||(i=String(i).replace(/[^\w$]/g,""),!i)?"":(/^\d/.test(i)&&(i="_"+i),f0.test(i)?i+"_":i)}});var uf=g((Jw,cf)=>{"use strict";var Zr=null;try{Zr=z("fs"),(!Zr||!Zr.readFile||!Zr.readFileSync)&&(Zr=null)}catch{}cf.exports=Zr});var hf=g((Qw,df)=>{"use strict";df.exports=Ki;var g0=zo(),sl=uf();function Ki(i,e,t){return typeof e=="function"?(t=e,e={}):e||(e={}),t?!e.xhr&&sl&&sl.readFile?sl.readFile(i,function(n,s){return n&&typeof XMLHttpRequest<"u"?Ki.xhr(i,e,t):n?t(n):t(null,e.binary?s:s.toString("utf8"))}):Ki.xhr(i,e,t):g0(Ki,this,i,e)}Ki.xhr=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(n.readyState===4){if(n.status!==0&&n.status!==200)return r(Error("status "+n.status));if(t.binary){var a=n.response;if(!a){a=[];for(var o=0;o<n.responseText.length;++o)a.push(n.responseText.charCodeAt(o)&255)}return r(null,typeof Uint8Array<"u"?new Uint8Array(a):a)}return r(null,n.responseText)}},t.binary&&("overrideMimeType"in n&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.responseType="arraybuffer"),n.open("GET",e),n.send()}});var gf=g(pf=>{"use strict";var ol=pf,ff=ol.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},al=ol.normalize=function(e){e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var t=e.split("/"),r=ff(e),n="";r&&(n=t.shift()+"/");for(var s=0;s<t.length;)t[s]===".."?s>0&&t[s-1]!==".."?t.splice(--s,2):r?t.splice(s,1):++s:t[s]==="."?t.splice(s,1):++s;return n+t.join("/")};ol.resolve=function(e,t,r){return r||(t=al(t)),ff(t)?t:(r||(e=al(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?al(e+"/"+t):t)}});var vf=g(mf=>{"use strict";var ll=mf;ll.numberRe=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;ll.typeRefRe=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;ll.reservedRe=/^(?: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)$/});var _f=g((tO,yf)=>{"use strict";var ei=null;try{ei=z("fs"),(!ei||!ei.readFile||!ei.readFileSync)&&(ei=null)}catch{}yf.exports=ei});var ri=g((rO,Cf)=>{"use strict";Cf.exports=G;var ys=tr();((G.prototype=Object.create(ys.prototype)).constructor=G).className="Namespace";var cl=er(),br=me(),m0=wr(),Tr,ti,Rr;G.fromJSON=function(e,t,r){return r=br.checkDepth(r),new G(e,t.options).addJSON(t.nested,r)};function Ef(i,e){if(i&&i.length){for(var t={},r=0;r<i.length;++r)t[i[r].name]=i[r].toJSON(e);return t}}G.arrayToJSON=Ef;G.isReservedId=function(e,t){if(e){for(var r=0;r<e.length;++r)if(typeof e[r]!="string"&&e[r][0]<=t&&e[r][1]>t)return!0}return!1};G.isReservedName=function(e,t){if(e){for(var r=0;r<e.length;++r)if(e[r]===t)return!0}return!1};function G(i,e){ys.call(this,i,e),this.nested=void 0,this._nestedArray=null,this._lookupCache=Object.create(null),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0}function Sf(i){i._nestedArray=null,i._lookupCache=Object.create(null);for(var e=i;e=e.parent;)e._lookupCache=Object.create(null);return i}Object.defineProperty(G.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=br.toArray(this.nested))}});G.prototype.toJSON=function(e){return br.toObject(["options",this.options,"nested",Ef(this.nestedArray,e)])};G.prototype.addJSON=function(e,t){t=br.checkDepth(t);var r=this;if(e)for(var n=Object.keys(e),s=0,a;s<n.length;++s)a=e[n[s]],r.add((a.fields!==void 0?Tr.fromJSON:a.values!==void 0?Rr.fromJSON:a.methods!==void 0?ti.fromJSON:a.id!==void 0?cl.fromJSON:G.fromJSON)(n[s],a,t+1));return this};G.prototype.get=function(e){return this.nested&&Object.prototype.hasOwnProperty.call(this.nested,e)?this.nested[e]:null};G.prototype.getEnum=function(e){if(this.nested&&Object.prototype.hasOwnProperty.call(this.nested,e)&&this.nested[e]instanceof Rr)return this.nested[e].values;throw Error("no such enum: "+e)};G.prototype.add=function(e){if(!(e instanceof cl&&e.extend!==void 0||e instanceof Tr||e instanceof m0||e instanceof Rr||e instanceof ti||e instanceof G))throw TypeError("object must be a valid nested object");if(e.name==="__proto__")return this;if(!this.nested)this.nested={};else{var t=this.get(e.name);if(t)if(t instanceof G&&e instanceof G&&!(t instanceof Tr||t instanceof ti)){for(var r=t.nestedArray,n=0;n<r.length;++n)e.add(r[n]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}else throw Error("duplicate name '"+e.name+"' in "+this)}this.nested[e.name]=e,this instanceof Tr||this instanceof ti||this instanceof Rr||this instanceof cl||e._edition||(e._edition=e._defaultEdition),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0;for(var s=this;s=s.parent;)s._needsRecursiveFeatureResolution=!0,s._needsRecursiveResolve=!0;return e.onAdd(this),Sf(this)};G.prototype.remove=function(e){if(!(e instanceof ys))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),Sf(this)};G.prototype.define=function(e,t){if(br.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&e[0]==="")throw Error("path must be relative");if(e.length>br.recursionLimit)throw Error("max depth exceeded");for(var r=this;e.length>0;){var n=e.shift();if(r.nested&&r.nested[n]){if(r=r.nested[n],!(r instanceof G))throw Error("path conflicts with non-namespace objects")}else r.add(r=new G(n))}return t&&r.addJSON(t),r};G.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;this._resolveFeaturesRecursive(this._edition);var e=this.nestedArray,t=0;for(this.resolve();t<e.length;)e[t]instanceof G?e[t++].resolveAll():e[t++].resolve();return this._needsRecursiveResolve=!1,this};G.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(this._needsRecursiveFeatureResolution=!1,e=this._edition||e,ys.prototype._resolveFeaturesRecursive.call(this,e),this.nestedArray.forEach(t=>{t._resolveFeaturesRecursive(e)}),this):this};G.prototype.lookup=function(e,t,r){if(typeof t=="boolean"?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),br.isString(e)&&e.length){if(e===".")return this.root;e=e.split(".")}else if(!e.length)return this;var n=e.join(".");if(e[0]==="")return this.root.lookup(e.slice(1),t);var s=this.root._fullyQualifiedObjects&&this.root._fullyQualifiedObjects["."+n];if(s&&(!t||t.indexOf(s.constructor)>-1)||(s=this._lookupImpl(e,n),s&&(!t||t.indexOf(s.constructor)>-1)))return s;if(r)return null;for(var a=this;a.parent;){if(s=a.parent._lookupImpl(e,n),s&&(!t||t.indexOf(s.constructor)>-1))return s;a=a.parent}return null};G.prototype._lookupImpl=function(e,t){if(Object.prototype.hasOwnProperty.call(this._lookupCache,t))return this._lookupCache[t];var r=this.get(e[0]),n=null;if(r)e.length===1?n=r:r instanceof G&&(e=e.slice(1),n=r._lookupImpl(e,e.join(".")));else for(var s=0;s<this.nestedArray.length;++s)if(this._nestedArray[s]instanceof G&&(r=this._nestedArray[s]._lookupImpl(e,t))){n=r;break}return this._lookupCache[t]=n,n};G.prototype.lookupType=function(e){var t=this.lookup(e,[Tr]);if(!t)throw Error("no such type: "+e);return t};G.prototype.lookupEnum=function(e){var t=this.lookup(e,[Rr]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t};G.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[Tr,Rr]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t};G.prototype.lookupService=function(e){var t=this.lookup(e,[ti]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t};G._configure=function(i,e,t){Tr=i,ti=e,Rr=t}});var _s=g((iO,Tf)=>{"use strict";Tf.exports=Lt;var ul=er();((Lt.prototype=Object.create(ul.prototype)).constructor=Lt).className="MapField";var v0=Or(),Xi=me();function Lt(i,e,t,r,n,s){if(ul.call(this,i,e,r,void 0,void 0,n,s),!Xi.isString(t))throw TypeError("keyType must be a string");this.keyType=t,this.resolvedKeyType=null,this.map=!0}Lt.fromJSON=function(e,t){return new Lt(e,t.id,t.keyType,t.type,t.options,t.comment)};Lt.prototype.toJSON=function(e){var t=e?!!e.keepComments:!1;return Xi.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])};Lt.prototype.resolve=function(){if(this.resolved)return this;if(v0.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return ul.prototype.resolve.call(this)};Lt.d=function(e,t,r){return typeof r=="function"?r=Xi.decorateType(r).name:r&&typeof r=="object"&&(r=Xi.decorateEnum(r).name),function(s,a){Xi.decorateType(s.constructor).add(new Lt(a,e,t,r))}}});var Es=g((nO,bf)=>{"use strict";bf.exports=Ar;var dl=tr();((Ar.prototype=Object.create(dl.prototype)).constructor=Ar).className="Method";var ii=me();function Ar(i,e,t,r,n,s,a,o,l){if(ii.isObject(n)?(a=n,n=s=void 0):ii.isObject(s)&&(a=s,s=void 0),!(e===void 0||ii.isString(e)))throw TypeError("type must be a string");if(!ii.isString(t))throw TypeError("requestType must be a string");if(!ii.isString(r))throw TypeError("responseType must be a string");dl.call(this,i,a),this.type=e||"rpc",this.requestType=t,this.requestStream=n?!0:void 0,this.responseType=r,this.responseStream=s?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=o,this.parsedOptions=l}Ar.fromJSON=function(e,t){return new Ar(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)};Ar.prototype.toJSON=function(e){var t=e?!!e.keepComments:!1;return ii.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",t?this.comment:void 0,"parsedOptions",this.parsedOptions])};Ar.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),dl.prototype.resolve.call(this))}});var Cs=g((sO,Of)=>{"use strict";Of.exports=ze;var Ft=ri();((ze.prototype=Object.create(Ft.prototype)).constructor=ze).className="Service";var hl=Es(),Ss=me(),Rf=rl();function ze(i,e){Ft.call(this,i,e),this.methods={},this._methodsArray=null}ze.fromJSON=function(e,t,r){r=Ss.checkDepth(r);var n=new ze(e,t.options);if(t.methods)for(var s=Object.keys(t.methods),a=0;a<s.length;++a)n.add(hl.fromJSON(s[a],t.methods[s[a]]));return t.nested&&n.addJSON(t.nested,r),t.edition&&(n._edition=t.edition),n.comment=t.comment,n._defaultEdition="proto3",n};ze.prototype.toJSON=function(e){var t=Ft.prototype.toJSON.call(this,e),r=e?!!e.keepComments:!1;return Ss.toObject(["edition",this._editionToJSON(),"options",t&&t.options||void 0,"methods",Ft.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])};Object.defineProperty(ze.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=Ss.toArray(this.methods))}});function wf(i){return i._methodsArray=null,i}ze.prototype.get=function(e){return Object.prototype.hasOwnProperty.call(this.methods,e)?this.methods[e]:Ft.prototype.get.call(this,e)};ze.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;Ft.prototype.resolve.call(this);for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return this};ze.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,Ft.prototype._resolveFeaturesRecursive.call(this,e),this.methodsArray.forEach(t=>{t._resolveFeaturesRecursive(e)}),this):this};ze.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof hl?e.name==="__proto__"?this:(this.methods[e.name]=e,e.parent=this,wf(this)):Ft.prototype.add.call(this,e)};ze.prototype.remove=function(e){if(e instanceof hl){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,wf(this)}return Ft.prototype.remove.call(this,e)};ze.prototype.create=function(e,t,r){for(var n=new Rf.Service(e,t,r),s=0,a;s<this.methodsArray.length;++s){var o=Ss.lcFirst((a=this._methodsArray[s]).resolve().name).replace(/[^$\w_]/g,"");n[o]=(function(l,c,u){return function(f,_){return Rf.Service.prototype.rpcCall.call(this,l,c,u,f,_)}})(a,a.resolvedRequestType.ctor,a.resolvedResponseType.ctor)}return n}});var Ts=g((aO,Af)=>{"use strict";Af.exports=_t;var y0=at();function _t(i){if(i)for(var e=Object.keys(i),t=0;t<e.length;++t){var r=e[t];r!=="__proto__"&&(this[r]=i[r])}}_t.create=function(e){return this.$type.create(e)};_t.encode=function(e,t){return this.$type.encode(e,t)};_t.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)};_t.decode=function(e){return this.$type.decode(e)};_t.decodeDelimited=function(e){return this.$type.decodeDelimited(e)};_t.verify=function(e){return this.$type.verify(e)};_t.fromObject=function(e){return this.$type.fromObject(e)};_t.toObject=function(e,t){return this.$type.toObject(e,t)};_t.prototype.toJSON=function(){return this.$type.toObject(this,y0.toJSONOptions)}});var fl=g((oO,Pf)=>{"use strict";Pf.exports=S0;var _0=ot(),qt=Or(),Nf=me();function E0(i){return"missing required '"+i.name+"'"}function S0(i){for(var e=Nf.codegen(["r","l","e","n"],i.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("if(n===undefined)n=0")("if(n>Reader.recursionLimit)")('throw Error("maximum nesting depth exceeded")')("var c,m"+(i.fieldsArray.filter(function(o){return o.map}).length?",k,value":""))("if(l===undefined)")("c=r.len")("else{")("c=r.pos+l")("if(c>r.len)")('throw RangeError("index out of range")')("l=r.len")("r.len=c")("}")("m=new this.ctor")("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),t=0;t<i.fieldsArray.length;++t){var r=i._fieldsArray[t].resolve(),n=r.resolvedType instanceof _0?"int32":r.type,s="m"+Nf.safeProp(r.name);e("case %i: {",r.id),r.map?(e("if(%s===util.emptyObject)",s)("%s={}",s)("var c2=r.uint32()+r.pos")("if(c2>r.len)")('throw RangeError("index out of range")')("r.len=c2"),qt.defaults[r.keyType]!==void 0?e("k=%j",qt.defaults[r.keyType]):e("k=null"),qt.defaults[n]!==void 0?e("value=%j",qt.defaults[n]):e("value=null"),e("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",r.keyType)("case 2:"),qt.basic[n]===void 0?e("value=types[%i].decode(r,r.uint32(),undefined,n+1)",t):e("value=r.%s()",n),e("break")("default:")("r.skipType(tag2&7,n)")("break")("}")("}")("if(r.pos!==c2)")('throw RangeError("index out of range")')("r.len=c"),qt.long[r.keyType]!==void 0?e('%s[typeof k==="object"?util.longToHash(k):k]=value',s):(r.keyType==="string"&&e('if(k==="__proto__")')("util.makeProp(%s,k)",s),e("%s[k]=value",s))):r.repeated?(e("if(!(%s&&%s.length))",s,s)("%s=[]",s),qt.packed[n]!==void 0&&e("if((t&7)===2){")("var c2=r.uint32()+r.pos")("if(c2>r.len)")('throw RangeError("index out of range")')("r.len=c2")("while(r.pos<c2)")("%s.push(r.%s())",s,n)("if(r.pos!==c2)")('throw RangeError("index out of range")')("r.len=c")("}else"),qt.basic[n]===void 0?e(r.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4),n+1))":"%s.push(types[%i].decode(r,r.uint32(),undefined,n+1))",s,t):e("%s.push(r.%s())",s,n)):qt.basic[n]===void 0?e(r.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4),n+1)":"%s=types[%i].decode(r,r.uint32(),undefined,n+1)",s,t):e("%s=r.%s()",s,n),e("break")("}")}for(e("default:")("r.skipType(t&7,n)")("break")("}")("}"),e("if(l!==undefined){")("if(r.pos!==c)")('throw RangeError("index out of range")')("r.len=l")("}"),t=0;t<i._fieldsArray.length;++t){var a=i._fieldsArray[t];a.required&&e("if(!Object.hasOwnProperty.call(m,%j))",a.name)("throw util.ProtocolError(%j,{instance:m})",E0(a))}return e("return m")}});var ml=g((lO,If)=>{"use strict";If.exports=b0;var C0=ot(),pl=me();function Ke(i,e){return i.name+": "+e+(i.repeated&&e!=="array"?"[]":i.map&&e!=="object"?"{k:"+i.keyType+"}":"")+" expected"}function gl(i,e,t,r){if(e.resolvedType)if(e.resolvedType instanceof C0){i("switch(%s){",r)("default:")("return%j",Ke(e,"enum value"));for(var n=Object.keys(e.resolvedType.values),s=0;s<n.length;++s)i("case %i:",e.resolvedType.values[n[s]]);i("break")("}")}else i("{")("var e=types[%i].verify(%s,n+1);",t,r)("if(e)")("return%j+e",e.name+".")("}");else switch(e.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":i("if(!util.isInteger(%s))",r)("return%j",Ke(e,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":i("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",r,r,r,r)("return%j",Ke(e,"integer|Long"));break;case"float":case"double":i('if(typeof %s!=="number")',r)("return%j",Ke(e,"number"));break;case"bool":i('if(typeof %s!=="boolean")',r)("return%j",Ke(e,"boolean"));break;case"string":i("if(!util.isString(%s))",r)("return%j",Ke(e,"string"));break;case"bytes":i('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',r,r,r)("return%j",Ke(e,"buffer"));break}return i}function T0(i,e,t){switch(e.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":i("if(!util.key32Re.test(%s))",t)("return%j",Ke(e,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":i("if(!util.key64Re.test(%s))",t)("return%j",Ke(e,"integer|Long key"));break;case"bool":i("if(!util.key2Re.test(%s))",t)("return%j",Ke(e,"boolean key"));break}return i}function b0(i){var e=pl.codegen(["m","n"],i.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected")("if(n===undefined)n=0")("if(n>util.recursionLimit)")("return%j","maximum nesting depth exceeded"),t=i.oneofsArray,r={};t.length&&e("var p={}");for(var n=0;n<i.fieldsArray.length;++n){var s=i._fieldsArray[n].resolve(),a="m"+pl.safeProp(s.name);if(s.optional&&e("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",a,s.name),s.map)e("if(!util.isObject(%s))",a)("return%j",Ke(s,"object"))("var k=Object.keys(%s)",a)("for(var i=0;i<k.length;++i){"),T0(e,s,"k[i]"),gl(e,s,n,a+"[k[i]]")("}");else if(s.repeated)e("if(!Array.isArray(%s))",a)("return%j",Ke(s,"array"))("for(var i=0;i<%s.length;++i){",a),gl(e,s,n,a+"[i]")("}");else{if(s.partOf){var o=pl.safeProp(s.partOf.name);r[s.partOf.name]===1&&e("if(p%s===1)",o)("return%j",s.partOf.name+": multiple values"),r[s.partOf.name]=1,e("p%s=1",o)}gl(e,s,n,a)}s.optional&&e("}")}return e("return null")}});var _l=g(kf=>{"use strict";var Mf=kf,Ji=ot(),Et=me();function vl(i,e,t,r){var n=!1;if(e.resolvedType)if(e.resolvedType instanceof Ji){i("switch(d%s){",r);for(var s=e.resolvedType.values,a=Object.keys(s),o=0;o<a.length;++o)s[a[o]]===e.typeDefault&&!n&&(i("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',r,r,r),e.repeated||i("break"),n=!0),i("case%j:",a[o])("case %i:",s[a[o]])("m%s=%j",r,s[a[o]])("break");i("}")}else i("if(!util.isObject(d%s))",r)("throw TypeError(%j)",e.fullName+": object expected")("m%s=types[%i].fromObject(d%s,n+1)",r,t,r);else{var l=!1;switch(e.type){case"double":case"float":i("m%s=Number(d%s)",r,r);break;case"uint32":case"fixed32":i("m%s=d%s>>>0",r,r);break;case"int32":case"sint32":case"sfixed32":i("m%s=d%s|0",r,r);break;case"uint64":case"fixed64":l=!0;case"int64":case"sint64":case"sfixed64":i("if(util.Long)")("m%s=util.Long.fromValue(d%s,%j)",r,r,l)('else if(typeof d%s==="string")',r)("m%s=parseInt(d%s,10)",r,r)('else if(typeof d%s==="number")',r)("m%s=d%s",r,r)('else if(typeof d%s==="object")',r)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",r,r,r,l?"true":"");break;case"bytes":i('if(typeof d%s==="string")',r)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",r,r,r)("else if(d%s.length >= 0)",r)("m%s=d%s",r,r);break;case"string":i("m%s=String(d%s)",r,r);break;case"bool":i("m%s=Boolean(d%s)",r,r);break}}return i}Mf.fromObject=function(e){var t=e.fieldsArray,r=Et.codegen(["d","n"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("if(!util.isObject(d))")("throw TypeError(%j)",e.fullName+": object expected")("if(n===undefined)n=0")("if(n>util.recursionLimit)")('throw Error("maximum nesting depth exceeded")'),r("var m=new this.ctor");for(var n=0;n<t.length;++n){var s=t[n].resolve(),a=Et.safeProp(s.name);s.map?(r("if(d%s){",a)("if(!util.isObject(d%s))",a)("throw TypeError(%j)",s.fullName+": object expected")("m%s={}",a)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",a),r('if(ks[i]==="__proto__")')("util.makeProp(m%s,ks[i])",a),vl(r,s,n,a+"[ks[i]]")("}")("}")):s.repeated?(r("if(d%s){",a)("if(!Array.isArray(d%s))",a)("throw TypeError(%j)",s.fullName+": array expected")("m%s=[]",a)("for(var i=0;i<d%s.length;++i){",a),vl(r,s,n,a+"[i]")("}")("}")):(s.resolvedType instanceof Ji||r("if(d%s!=null){",a),vl(r,s,n,a),s.resolvedType instanceof Ji||r("}"))}return r("return m")};function yl(i,e,t,r){if(e.resolvedType)e.resolvedType instanceof Ji?i("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",r,t,r,r,t,r,r):i("d%s=types[%i].toObject(m%s,o,q+1)",r,t,r);else{var n=!1;switch(e.type){case"double":case"float":i("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",r,r,r,r);break;case"uint64":case"fixed64":n=!0;case"int64":case"sint64":case"sfixed64":i('if(typeof BigInt!=="undefined"&&o.longs===BigInt)')('d%s=typeof m%s==="number"?BigInt(m%s):util.Long.fromBits(m%s.low>>>0,m%s.high>>>0,%j).toBigInt()',r,r,r,r,r,n)('else if(typeof m%s==="number")',r)("d%s=o.longs===String?String(m%s):m%s",r,r,r)("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",r,r,r,r,n?"true":"",r);break;case"bytes":i("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",r,r,r,r,r);break;default:i("d%s=m%s",r,r);break}}return i}Mf.toObject=function(e){var t=e.fieldsArray.slice().sort(Et.compareFieldsById);if(!t.length)return Et.codegen()("return {}");for(var r=Et.codegen(["m","o","q"],e.name+"$toObject")("if(!o)")("o={}")("if(q===undefined)q=0")("if(q>util.recursionLimit)")('throw Error("max depth exceeded")')("var d={}"),n=[],s=[],a=[],o=0;o<t.length;++o)t[o].partOf||(t[o].resolve().repeated?n:t[o].map?s:a).push(t[o]);if(n.length){for(r("if(o.arrays||o.defaults){"),o=0;o<n.length;++o)r("d%s=[]",Et.safeProp(n[o].name));r("}")}if(s.length){for(r("if(o.objects||o.defaults){"),o=0;o<s.length;++o)r("d%s={}",Et.safeProp(s[o].name));r("}")}if(a.length){for(r("if(o.defaults){"),o=0;o<a.length;++o){var l=a[o],c=Et.safeProp(l.name);if(l.resolvedType instanceof Ji)r("d%s=o.enums===String?%j:%j",c,l.resolvedType.valuesById[l.typeDefault],l.typeDefault);else if(l.long)r("if(util.Long){")("var n=new util.Long(%i,%i,%j)",l.typeDefault.low,l.typeDefault.high,l.typeDefault.unsigned)('d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():typeof BigInt!=="undefined"&&o.longs===BigInt?n.toBigInt():n',c)("}else")('d%s=o.longs===String?%j:typeof BigInt!=="undefined"&&o.longs===BigInt?BigInt(%j):%i',c,l.typeDefault.toString(),l.typeDefault.toString(),l.typeDefault.toNumber());else if(l.bytes){var u=Array.prototype.slice.call(l.typeDefault);r("if(o.bytes===String)d%s=%j",c,String.fromCharCode.apply(String,l.typeDefault))("else{")("d%s=%j",c,u)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",c,c)("}")}else r("d%s=%j",c,l.typeDefault)}r("}")}var h=!1;for(o=0;o<t.length;++o){var l=t[o],f=e._fieldsArray.indexOf(l),c=Et.safeProp(l.name);l.map?(h||(h=!0,r("var ks2")),r("if(m%s&&(ks2=Object.keys(m%s)).length){",c,c)("d%s={}",c)("for(var j=0;j<ks2.length;++j){"),r('if(ks2[j]==="__proto__")')("util.makeProp(d%s,ks2[j])",c),yl(r,l,f,c+"[ks2[j]]")("}")):l.repeated?(r("if(m%s&&m%s.length){",c,c)("d%s=[]",c)("for(var j=0;j<m%s.length;++j){",c),yl(r,l,f,c+"[j]")("}")):(r("if(m%s!=null&&Object.hasOwnProperty.call(m,%j)){",c,l.name),yl(r,l,f,c),l.partOf&&r("if(o.oneofs)")("d%s=%j",Et.safeProp(l.partOf.name),l.name)),r("}")}return r("return d")}});var El=g(Df=>{"use strict";var R0=Df,w0=Ts(),xf=at();R0[".google.protobuf.Any"]={fromObject:function(i,e){if(e===void 0&&(e=0),e>xf.recursionLimit)throw Error("max depth exceeded");if(i&&i["@type"]){var t=i["@type"].substring(i["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var n=i["@type"].charAt(0)==="."?i["@type"].slice(1):i["@type"];return n.indexOf("/")===-1&&(n="/"+n),this.create({type_url:n,value:r.encode(r.fromObject(i,e+1)).finish()})}}return this.fromObject(i,e)},toObject:function(i,e,t){if(t===void 0&&(t=0),t>xf.recursionLimit)throw Error("max depth exceeded");var r="type.googleapis.com/",n="",s="";if(e&&e.json&&i.type_url&&i.value){s=i.type_url.substring(i.type_url.lastIndexOf("/")+1),n=i.type_url.substring(0,i.type_url.lastIndexOf("/")+1);var a=this.lookup(s);a&&(i=a.decode(i.value,void 0,void 0,t+1))}if(!(i instanceof this.ctor)&&i instanceof w0){var o=i.$type.toObject(i,e,t+1),l=i.$type.fullName[0]==="."?i.$type.fullName.slice(1):i.$type.fullName;return n===""&&(n=r),s=n+l,o["@type"]=s,o}return this.toObject(i,e,t)}}});var ws=g((dO,Ff)=>{"use strict";Ff.exports=te;var Xe=ri();((te.prototype=Object.create(Xe.prototype)).constructor=te).className="Type";var O0=ot(),Tl=wr(),bs=er(),A0=_s(),N0=Cs(),Sl=Ts(),Cl=vs(),P0=gs(),Se=me(),I0=bl(),M0=fl(),k0=ml(),Lf=_l(),x0=El();function te(i,e){i=i.replace(/\W/g,""),Xe.call(this,i,e),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(te.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var i=Object.keys(this.fields),e=0;e<i.length;++e){var t=this.fields[i[e]],r=t.id;if(this._fieldsById[r])throw Error("duplicate id "+r+" in "+this);this._fieldsById[r]=t}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=Se.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=Se.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=te.generateConstructor(this)())},set:function(i){var e=i.prototype;e instanceof Sl||((i.prototype=new Sl).constructor=i,Se.merge(i.prototype,e)),i.$type=i.prototype.$type=this,Se.merge(i,Sl,!0),this._ctor=i;for(var t=0;t<this.fieldsArray.length;++t)this._fieldsArray[t].resolve();var r={};for(t=0;t<this.oneofsArray.length;++t)r[this._oneofsArray[t].resolve().name]={get:Se.oneOfGetter(this._oneofsArray[t].oneof),set:Se.oneOfSetter(this._oneofsArray[t].oneof)};t&&Object.defineProperties(i.prototype,r)}}});te.generateConstructor=function(e){for(var t=Se.codegen(["p"],e.name),r=0,n;r<e.fieldsArray.length;++r)(n=e._fieldsArray[r]).map?t("this%s={}",Se.safeProp(n.name)):n.repeated&&t("this%s=[]",Se.safeProp(n.name));return t('if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null&&ks[i]!=="__proto__")')("this[ks[i]]=p[ks[i]]")};function Rs(i){return i._fieldsById=i._fieldsArray=i._oneofsArray=null,delete i.encode,delete i.decode,delete i.verify,i}te.fromJSON=function(e,t,r){if(r===void 0&&(r=0),r>Se.nestingLimit)throw Error("max depth exceeded");var n=new te(e,t.options);n.extensions=t.extensions,n.reserved=t.reserved;for(var s=Object.keys(t.fields),a=0;a<s.length;++a)n.add((typeof t.fields[s[a]].keyType<"u"?A0.fromJSON:bs.fromJSON)(s[a],t.fields[s[a]]));if(t.oneofs)for(s=Object.keys(t.oneofs),a=0;a<s.length;++a)n.add(Tl.fromJSON(s[a],t.oneofs[s[a]]));if(t.nested)for(s=Object.keys(t.nested),a=0;a<s.length;++a){var o=t.nested[s[a]];n.add((o.id!==void 0?bs.fromJSON:o.fields!==void 0?te.fromJSON:o.values!==void 0?O0.fromJSON:o.methods!==void 0?N0.fromJSON:Xe.fromJSON)(s[a],o,r+1))}return t.extensions&&t.extensions.length&&(n.extensions=t.extensions),t.reserved&&t.reserved.length&&(n.reserved=t.reserved),t.group&&(n.group=!0),t.comment&&(n.comment=t.comment),t.edition&&(n._edition=t.edition),n._defaultEdition="proto3",n};te.prototype.toJSON=function(e){var t=Xe.prototype.toJSON.call(this,e),r=e?!!e.keepComments:!1;return Se.toObject(["edition",this._editionToJSON(),"options",t&&t.options||void 0,"oneofs",Xe.arrayToJSON(this.oneofsArray,e),"fields",Xe.arrayToJSON(this.fieldsArray.filter(function(n){return!n.declaringField}),e)||{},"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",t&&t.nested||void 0,"comment",r?this.comment:void 0])};te.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;Xe.prototype.resolveAll.call(this);var e=this.oneofsArray;for(r=0;r<e.length;)e[r++].resolve();for(var t=this.fieldsArray,r=0;r<t.length;)t[r++].resolve();return this};te.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,Xe.prototype._resolveFeaturesRecursive.call(this,e),this.oneofsArray.forEach(t=>{t._resolveFeatures(e)}),this.fieldsArray.forEach(t=>{t._resolveFeatures(e)}),this):this};te.prototype.get=function(e){return Object.prototype.hasOwnProperty.call(this.fields,e)?this.fields[e]:this.oneofs&&Object.prototype.hasOwnProperty.call(this.oneofs,e)?this.oneofs[e]:this.nested&&Object.prototype.hasOwnProperty.call(this.nested,e)?this.nested[e]:null};te.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof bs&&e.extend===void 0){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name)||e.name.charAt(0)==="$")throw Error("name '"+e.name+"' is reserved in "+this);return e.name==="__proto__"?this:(e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),Rs(this))}if(e instanceof Tl){if(e.name.charAt(0)==="$")throw Error("name '"+e.name+"' is reserved in "+this);return e.name==="__proto__"?this:(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),Rs(this))}return Xe.prototype.add.call(this,e)};te.prototype.remove=function(e){if(e instanceof bs&&e.extend===void 0){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),Rs(this)}if(e instanceof Tl){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),Rs(this)}return Xe.prototype.remove.call(this,e)};te.prototype.isReservedId=function(e){return Xe.isReservedId(this.reserved,e)};te.prototype.isReservedName=function(e){return Xe.isReservedName(this.reserved,e)};te.prototype.create=function(e){return new this.ctor(e)};te.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=I0(this)({Writer:P0,types:t,util:Se}),this.decode=M0(this)({Reader:Cl,types:t,util:Se}),this.verify=k0(this)({types:t,util:Se}),this.fromObject=Lf.fromObject(this)({types:t,util:Se}),this.toObject=Lf.toObject(this)({types:t,util:Se});var n=x0[e];if(n){var s=Object.create(this);s.fromObject=this.fromObject,this.fromObject=n.fromObject.bind(s),s.toObject=this.toObject,this.toObject=n.toObject.bind(s)}return this};te.prototype.encode=function(e,t){return this.setup().encode.apply(this,arguments)};te.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()};te.prototype.decode=function(e,t,r,n){return this.setup().decode(e,t,r,n)};te.prototype.decodeDelimited=function(e){return e instanceof Cl||(e=Cl.create(e)),this.decode(e,e.uint32())};te.prototype.verify=function(e,t){return this.setup().verify(e,t)};te.prototype.fromObject=function(e,t){return this.setup().fromObject(e,t)};te.prototype.toObject=function(e,t){return this.setup().toObject.apply(this,arguments)};te.d=function(e){return function(r){Se.decorateType(r,e)}}});var Ps=g((hO,Bf)=>{"use strict";Bf.exports=He;var Ns=ri();((He.prototype=Object.create(Ns.prototype)).constructor=He).className="Root";var Os=er(),Rl=ot(),D0=wr(),St=me(),wl,Ol,Qi;function He(i){Ns.call(this,"",i),this.deferred=[],this.files=[],this._edition="proto2",this._fullyQualifiedObjects={}}He.fromJSON=function(e,t,r){return r=St.checkDepth(r),t||(t=new He),e.options&&t.setOptions(e.options),t.addJSON(e.nested,r).resolveAll()};He.prototype.resolvePath=St.path.resolve;He.prototype.fetch=St.fetch;function Uf(){}He.prototype.load=function i(e,t,r){typeof t=="function"&&(r=t,t=void 0);var n=this;if(!r)return St.asPromise(i,n,e,t);var s=r===Uf;function a(_,p){if(r){if(s)throw _;p&&p.resolveAll();var v=r;r=null,v(_,p)}}function o(_){var p=_.lastIndexOf("google/protobuf/");if(p>-1){var v=_.substring(p);if(v in Qi)return v}return null}function l(_,p,v){v===void 0&&(v=0);try{if(v>St.recursionLimit)throw Error("max depth exceeded");if(St.isString(p)&&p.charAt(0)==="{"&&(p=JSON.parse(p)),!St.isString(p))n.setOptions(p.options).addJSON(p.nested);else{Ol.filename=_;var R=Ol(p,n,t),O,P=0;if(R.imports)for(;P<R.imports.length;++P)(O=o(R.imports[P])||n.resolvePath(_,R.imports[P]))&&c(O,!1,v+1);if(R.weakImports)for(P=0;P<R.weakImports.length;++P)(O=o(R.weakImports[P])||n.resolvePath(_,R.weakImports[P]))&&c(O,!0,v+1)}}catch(D){a(D)}!s&&!u&&a(null,n)}function c(_,p,v){if(v===void 0&&(v=0),_=o(_)||_,!(n.files.indexOf(_)>-1)){if(n.files.push(_),_ in Qi){s?l(_,Qi[_],v):(++u,setTimeout(function(){--u,l(_,Qi[_],v)}));return}if(s){var R;try{R=St.fs.readFileSync(_).toString("utf8")}catch(O){p||a(O);return}l(_,R,v)}else++u,n.fetch(_,function(O,P){if(--u,!!r){if(O){p?u||a(null,n):a(O);return}l(_,P,v)}})}}var u=0;St.isString(e)&&(e=[e]);for(var h=0,f;h<e.length;++h)(f=n.resolvePath("",e[h]))&&c(f);return s?(n.resolveAll(),n):(u||a(null,n),n)};He.prototype.loadSync=function(e,t){if(!St.isNode)throw Error("not supported");return this.load(e,t,Uf)};He.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(e){return"'extend "+e.extend+"' in "+e.parent.fullName}).join(", "));return Ns.prototype.resolveAll.call(this)};var As=/^[A-Z]/;function qf(i,e){var t=e.parent.lookup(e.extend);if(t){var r=new Os(e.fullName,e.id,e.type,e.rule,void 0,e.options);return t.get(r.name)||(r.declaringField=e,e.extensionField=r,t.add(r)),!0}return!1}He.prototype._handleAdd=function(e){if(e instanceof Os)e.extend!==void 0&&!e.extensionField&&(qf(this,e)||this.deferred.push(e));else if(e instanceof Rl)As.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof D0)){if(e instanceof wl)for(var t=0;t<this.deferred.length;)qf(this,this.deferred[t])?this.deferred.splice(t,1):++t;for(var r=0;r<e.nestedArray.length;++r)this._handleAdd(e._nestedArray[r]);As.test(e.name)&&(e.parent[e.name]=e)}(e instanceof wl||e instanceof Rl||e instanceof Os)&&(this._fullyQualifiedObjects[e.fullName]=e)};He.prototype._handleRemove=function(e){if(e instanceof Os){if(e.extend!==void 0)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof Rl)As.test(e.name)&&delete e.parent[e.name];else if(e instanceof Ns){for(var r=0;r<e.nestedArray.length;++r)this._handleRemove(e._nestedArray[r]);As.test(e.name)&&delete e.parent[e.name]}delete this._fullyQualifiedObjects[e.fullName]};He._configure=function(i,e,t){wl=i,Ol=e,Qi=t}});var me=g((fO,jf)=>{"use strict";var ie=jf.exports=at(),zf=il(),Al,Nl;ie.codegen=lf();ie.fetch=hf();ie.path=gf();ie.patterns=vf();var Hf=ie.patterns.reservedRe;ie.fs=_f();ie.checkDepth=function(e){if(e===void 0&&(e=0),e>ie.recursionLimit)throw Error("max depth exceeded");return e};ie.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n<t.length;)r[n]=e[t[n++]];return r}return[]};ie.toObject=function(e){for(var t={},r=0;r<e.length;){var n=e[r++],s=e[r++];s!==void 0&&(t[n]=s)}return t};ie.isReserved=function(e){return Hf.test(e)};ie.safeProp=function(e){return!/^[$\w_]+$/.test(e)||Hf.test(e)?"["+JSON.stringify(e)+"]":"."+e};ie.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var L0=/_([a-z])/g;ie.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(L0,function(t,r){return r.toUpperCase()})};ie.compareFieldsById=function(e,t){return e.id-t.id};ie.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(ie.decorateRoot.remove(e.$type),e.$type.name=t,ie.decorateRoot.add(e.$type)),e.$type;Al||(Al=ws());var r=new Al(t||e.name);return ie.decorateRoot.add(r),r.ctor=e,Object.defineProperty(e,"$type",{value:r,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:r,enumerable:!1}),r};var F0=0;ie.decorateEnum=function(e){if(e.$type)return e.$type;Nl||(Nl=ot());var t=new Nl("Enum"+F0++,e);return ie.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t};ie.setProperty=function(e,t,r,n){function s(a,o,l){var c=o.shift();if(ie.isUnsafeProperty(c))return a;if(o.length>0)a[c]=s(a[c]||{},o,l);else{var u=a[c];if(u&&n)return a;u&&(l=[].concat(u).concat(l)),a[c]=l}return a}if(typeof e!="object")throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");if(t=t.split("."),t.length>ie.recursionLimit)throw Error("max depth exceeded");return s(e,t,r)};Object.defineProperty(ie,"decorateRoot",{get:function(){return zf.decorated||(zf.decorated=new(Ps()))}})});var Or=g(Wf=>{"use strict";var Zi=Wf,q0=me(),U0=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function en(i,e){var t=0,r=Object.create(null);for(e|=0;t<i.length;)r[U0[t+e]]=i[t++];return r}Zi.basic=en([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]);Zi.defaults=en([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",q0.emptyArray,null]);Zi.long=en([0,0,0,1,1],7);Zi.mapKey=en([0,0,0,5,5,0,0,0,1,1,0,2],2);Zi.packed=en([1,5,0,0,0,5,5,0,0,0,1,1,0])});var er=g((gO,$f)=>{"use strict";$f.exports=ve;var rn=tr();((ve.prototype=Object.create(rn.prototype)).constructor=ve).className="Field";var Gf=ot(),Pl=Or(),ce=me(),tn,B0=/^required|optional|repeated$/;ve.fromJSON=function(e,t){var r=new ve(e,t.id,t.type,t.rule,t.extend,t.options,t.comment);return t.edition&&(r._edition=t.edition),r._defaultEdition="proto3",r};function ve(i,e,t,r,n,s,a){if(ce.isObject(r)?(a=n,s=r,r=n=void 0):ce.isObject(n)&&(a=s,s=n,n=void 0),rn.call(this,i,s),!ce.isInteger(e)||e<0)throw TypeError("id must be a non-negative integer");if(!ce.isString(t))throw TypeError("type must be a string");if(r!==void 0&&!B0.test(r=r.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(n!==void 0&&!ce.isString(n))throw TypeError("extend must be a string");r==="proto3_optional"&&(r="optional"),this.rule=r&&r!=="optional"?r:void 0,this.type=t,this.id=e,this.extend=n||void 0,this.repeated=r==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=ce.Long?Pl.long[t]!==void 0:!1,this.bytes=t==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=a}Object.defineProperty(ve.prototype,"required",{get:function(){return this._features.field_presence==="LEGACY_REQUIRED"}});Object.defineProperty(ve.prototype,"optional",{get:function(){return!this.required}});Object.defineProperty(ve.prototype,"delimited",{get:function(){return this.resolvedType instanceof tn&&this._features.message_encoding==="DELIMITED"}});Object.defineProperty(ve.prototype,"packed",{get:function(){return this._features.repeated_field_encoding==="PACKED"}});Object.defineProperty(ve.prototype,"hasPresence",{get:function(){return this.repeated||this.map?!1:this.partOf||this.declaringField||this.extensionField||this._features.field_presence!=="IMPLICIT"}});ve.prototype.setOption=function(e,t,r){return rn.prototype.setOption.call(this,e,t,r)};ve.prototype.toJSON=function(e){var t=e?!!e.keepComments:!1;return ce.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",t?this.comment:void 0])};ve.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=Pl.defaults[this.type])===void 0?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof tn?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof Gf&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof Gf)&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=ce.Long.fromNumber(this.typeDefault,this.type==="uint64"||this.type==="fixed64"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var e;ce.base64.test(this.typeDefault)?ce.base64.decode(this.typeDefault,e=ce.newBuffer(ce.base64.length(this.typeDefault)),0):ce.utf8.write(this.typeDefault,e=ce.newBuffer(ce.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=ce.emptyObject:this.repeated?this.defaultValue=ce.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof tn&&(this.parent.ctor.prototype[this.name]=this.defaultValue),rn.prototype.resolve.call(this)};ve.prototype._inferLegacyProtoFeatures=function(e){if(e!=="proto2"&&e!=="proto3")return{};var t={};if(this.rule==="required"&&(t.field_presence="LEGACY_REQUIRED"),this.parent&&Pl.defaults[this.type]===void 0){var r=this.parent.get(this.type.split(".").pop());r&&r instanceof tn&&r.group&&(t.message_encoding="DELIMITED")}return this.getOption("packed")===!0?t.repeated_field_encoding="PACKED":this.getOption("packed")===!1&&(t.repeated_field_encoding="EXPANDED"),t};ve.prototype._resolveFeatures=function(e){return rn.prototype._resolveFeatures.call(this,this._edition||e)};ve.d=function(e,t,r,n){return typeof t=="function"?t=ce.decorateType(t).name:t&&typeof t=="object"&&(t=ce.decorateEnum(t).name),function(a,o){ce.decorateType(a.constructor).add(new ve(o,e,t,r,{default:n}))}};ve._configure=function(e){tn=e}});var wr=g((mO,Kf)=>{"use strict";Kf.exports=je;var Ms=tr();((je.prototype=Object.create(Ms.prototype)).constructor=je).className="OneOf";var Vf=er(),Is=me();function je(i,e,t,r){if(Array.isArray(e)||(t=e,e=void 0),Ms.call(this,i,t),!(e===void 0||Array.isArray(e)))throw TypeError("fieldNames must be an Array");this.oneof=e||[],this.fieldsArray=[],this.comment=r}je.fromJSON=function(e,t){return new je(e,t.oneof,t.options,t.comment)};je.prototype.toJSON=function(e){var t=e?!!e.keepComments:!1;return Is.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])};function Yf(i){if(i.parent)for(var e=0;e<i.fieldsArray.length;++e)i.fieldsArray[e].parent||i.parent.add(i.fieldsArray[e])}je.prototype.add=function(e){if(!(e instanceof Vf))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,Yf(this),this};je.prototype.remove=function(e){if(!(e instanceof Vf))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),t=this.oneof.indexOf(e.name),t>-1&&this.oneof.splice(t,1),e.partOf=null,this};je.prototype.onAdd=function(e){Ms.prototype.onAdd.call(this,e);for(var t=this,r=0;r<this.oneof.length;++r){var n=e.get(this.oneof[r]);n&&!n.partOf&&(n.partOf=t,t.fieldsArray.push(n))}Yf(this)};je.prototype.onRemove=function(e){for(var t=0,r;t<this.fieldsArray.length;++t)(r=this.fieldsArray[t]).parent&&r.parent.remove(r);Ms.prototype.onRemove.call(this,e)};Object.defineProperty(je.prototype,"isProto3Optional",{get:function(){if(this.fieldsArray==null||this.fieldsArray.length!==1)return!1;var i=this.fieldsArray[0];return i.options!=null&&i.options.proto3_optional===!0}});je.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(n,s){Is.decorateType(n.constructor).add(new je(s,e)),Object.defineProperty(n,s,{get:Is.oneOfGetter(e),set:Is.oneOfSetter(e)})}}});var tr=g((vO,Xf)=>{"use strict";Xf.exports=Ce;Ce.className="ReflectionObject";var z0=wr(),lt=me(),ks,H0={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},j0={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},W0={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function Ce(i,e){if(!lt.isString(i))throw TypeError("name must be a string");if(e&&!lt.isObject(e))throw TypeError("options must be an object");this.options=e,this.parsedOptions=null,this.name=i,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(Ce.prototype,{root:{get:function(){for(var i=this;i.parent!==null;)i=i.parent;return i}},fullName:{get:function(){for(var i=[this.name],e=this.parent;e;)i.unshift(e.name),e=e.parent;return i.join(".")}}});Ce.prototype.toJSON=function(){throw Error()};Ce.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof ks&&t._handleAdd(this)};Ce.prototype.onRemove=function(e){var t=e.root;t instanceof ks&&t._handleRemove(this),this.parent=null,this.resolved=!1};Ce.prototype.resolve=function(){return this.resolved?this:(this.root instanceof ks&&(this.resolved=!0),this)};Ce.prototype._resolveFeaturesRecursive=function(e){return this._resolveFeatures(this._edition||e)};Ce.prototype._resolveFeatures=function(e){if(!this._featuresResolved){var t={};if(!e)throw new Error("Unknown edition for "+this.fullName);var r=lt.merge({},this.options&&this.options.features,this._inferLegacyProtoFeatures(e));if(this._edition){if(e==="proto2")t=Object.assign({},j0);else if(e==="proto3")t=Object.assign({},W0);else if(e==="2023")t=Object.assign({},H0);else throw new Error("Unknown edition: "+e);this._features=lt.merge(t,r),this._featuresResolved=!0;return}if(this.partOf instanceof z0){var n=lt.merge({},this.partOf._features);this._features=lt.merge(n,r)}else if(!this.declaringField)if(this.parent){var s=lt.merge({},this.parent._features);this._features=lt.merge(s,r)}else throw new Error("Unable to find a parent for "+this.fullName);this.extensionField&&(this.extensionField._features=this._features),this._featuresResolved=!0}};Ce.prototype._inferLegacyProtoFeatures=function(){return{}};Ce.prototype.getOption=function(e){if(this.options)return this.options[e]};Ce.prototype.setOption=function(e,t,r){return e==="__proto__"?this:(this.options||(this.options={}),/^features\./.test(e)?lt.setProperty(this.options,e,t,r):(!r||this.options[e]===void 0)&&(this.getOption(e)!==t&&(this.resolved=!1),this.options[e]=t),this)};Ce.prototype.setParsedOption=function(e,t,r){if(e==="__proto__")return this;this.parsedOptions||(this.parsedOptions=[]);var n=this.parsedOptions;if(r){var s=n.find(function(l){return Object.prototype.hasOwnProperty.call(l,e)});if(s){var a=s[e];lt.setProperty(a,r,t)}else s={},s[e]=lt.setProperty({},r,t),n.push(s)}else{var o={};o[e]=t,n.push(o)}return this};Ce.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)this.setOption(r[n],e[r[n]],t);return this};Ce.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e};Ce.prototype._editionToJSON=function(){if(!(!this._edition||this._edition==="proto3"))return this._edition};Ce._configure=function(i){ks=i}});var ot=g((yO,Qf)=>{"use strict";Qf.exports=ct;var Il=tr();((ct.prototype=Object.create(Il.prototype)).constructor=ct).className="Enum";var Jf=ri(),ni=me();function ct(i,e,t,r,n,s){if(Il.call(this,i,t),e&&typeof e!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=r,this.comments=n||{},this.valuesOptions=s,this._valuesFeatures={},this.reserved=void 0,e)for(var a=Object.keys(e),o=0;o<a.length;++o)a[o]!=="__proto__"&&typeof e[a[o]]=="number"&&(this.valuesById[this.values[a[o]]=e[a[o]]]=a[o])}ct.prototype._resolveFeatures=function(e){return e=this._edition||e,Il.prototype._resolveFeatures.call(this,e),Object.keys(this.values).forEach(t=>{var r=ni.merge({},this._features);this._valuesFeatures[t]=ni.merge(r,this.valuesOptions&&this.valuesOptions[t]&&this.valuesOptions[t].features||{})}),this};ct.fromJSON=function(e,t){var r=new ct(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,t.edition&&(r._edition=t.edition),r._defaultEdition="proto3",r};ct.prototype.toJSON=function(e){var t=e?!!e.keepComments:!1;return ni.toObject(["edition",this._editionToJSON(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])};ct.prototype.add=function(e,t,r,n){if(!ni.isString(e))throw TypeError("name must be a string");if(!ni.isInteger(t))throw TypeError("id must be an integer");if(e==="__proto__")return this;if(this.values[e]!==void 0)throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(this.valuesById[t]!==void 0){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return n&&(this.valuesOptions===void 0&&(this.valuesOptions={}),this.valuesOptions[e]=n||null),this.comments[e]=r||null,this};ct.prototype.remove=function(e){if(!ni.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(t==null)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this};ct.prototype.isReservedId=function(e){return Jf.isReservedId(this.reserved,e)};ct.prototype.isReservedName=function(e){return Jf.isReservedName(this.reserved,e)}});var bl=g((_O,ep)=>{"use strict";ep.exports=$0;var G0=ot(),Ml=Or(),kl=me();function Zf(i,e,t,r){return e.delimited?i("types[%i].encode(%s,w.uint32(%i),q+1).uint32(%i)",t,r,(e.id<<3|3)>>>0,(e.id<<3|4)>>>0):i("types[%i].encode(%s,w.uint32(%i).fork(),q+1).ldelim()",t,r,(e.id<<3|2)>>>0)}function $0(i){for(var e=kl.codegen(["m","w","q"],i.name+"$encode")("if(!w)")("w=Writer.create()")("if(q===undefined)q=0")("if(q>util.recursionLimit)")('throw Error("max depth exceeded")'),t,r,n=i.fieldsArray.slice().sort(kl.compareFieldsById),t=0;t<n.length;++t){var s=n[t].resolve(),a=i._fieldsArray.indexOf(s),o=s.resolvedType instanceof G0?"int32":s.type,l=Ml.basic[o];r="m"+kl.safeProp(s.name),s.map?(e("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",r,s.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",r)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(s.id<<3|2)>>>0,8|Ml.mapKey[s.keyType],s.keyType),l===void 0?e("types[%i].encode(%s[ks[i]],w.uint32(18).fork(),q+1).ldelim().ldelim()",a,r):e(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|l,o,r),e("}")("}")):s.repeated?(e("if(%s!=null&&%s.length){",r,r),s.packed&&Ml.packed[o]!==void 0?e("w.uint32(%i).fork()",(s.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",r)("w.%s(%s[i])",o,r)("w.ldelim()"):(e("for(var i=0;i<%s.length;++i)",r),l===void 0?Zf(e,s,a,r+"[i]"):e("w.uint32(%i).%s(%s[i])",(s.id<<3|l)>>>0,o,r)),e("}")):(s.optional&&e("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",r,s.name),l===void 0?Zf(e,s,a,r):e("w.uint32(%i).%s(%s)",(s.id<<3|l)>>>0,o,r))}return e("return w")}});var rp=g((EO,tp)=>{"use strict";var $=tp.exports=af();$.build="light";function V0(i,e,t){return typeof e=="function"?(t=e,e=new $.Root):e||(e=new $.Root),e.load(i,t)}$.load=V0;function Y0(i,e){return e||(e=new $.Root),e.loadSync(i)}$.loadSync=Y0;$.encoder=bl();$.decoder=fl();$.verifier=ml();$.converter=_l();$.ReflectionObject=tr();$.Namespace=ri();$.Root=Ps();$.Enum=ot();$.Type=ws();$.Field=er();$.OneOf=wr();$.MapField=_s();$.Service=Cs();$.Method=Es();$.Message=Ts();$.wrappers=El();$.types=Or();$.util=me();$.ReflectionObject._configure($.Root);$.Namespace._configure($.Type,$.Service,$.Enum);$.Root._configure($.Type);$.Field._configure($.Type)});var Dl=g((SO,sp)=>{"use strict";sp.exports=np;var xl=/[\s{}=;:[\],'"()<>]/g,K0=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,X0=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,J0=/^ *[*/]+ */,Q0=/^\s*\*?\/*/,Z0=/\n/g,eE=/\s/,tE=/\\(.?)/g,rE={0:"\0",r:"\r",n:`
|
|
12
|
+
`,t:" "};function ip(i){return i.replace(tE,function(e,t){switch(t){case"\\":case"":return t;default:return rE[t]||""}})}np.unescape=ip;function np(i,e){i=i.toString();var t=0,r=i.length,n=1,s=0,a={},o=[],l=null;function c(E){return Error("illegal "+E+" (line "+n+")")}function u(){var E=l==="'"?X0:K0;E.lastIndex=t-1;var x=E.exec(i);if(!x)throw c("string");return t=E.lastIndex,R(l),l=null,ip(x[1])}function h(E){return i.charAt(E)}function f(E,x,k){var H={type:i.charAt(E++),lineEmpty:!1,leading:k},X;e?X=2:X=3;var K=E-X,F;do if(--K<0||(F=i.charAt(K))===`
|
|
13
|
+
`){H.lineEmpty=!0;break}while(F===" "||F===" ");for(var y=i.substring(E,x).split(Z0),Re=0;Re<y.length;++Re)y[Re]=y[Re].replace(e?Q0:J0,"").trim();H.text=y.join(`
|
|
14
|
+
`).trim(),a[n]=H,s=n}function _(E){var x=p(E),k=i.substring(E,x),H=/^\s*\/\//.test(k);return H}function p(E){for(var x=E;x<r&&h(x)!==`
|
|
15
|
+
`;)x++;return x}function v(){if(o.length>0)return o.shift();if(l)return u();var E,x,k,H,X,K=t===0;do{if(t===r)return null;for(E=!1;eE.test(k=h(t));)if(k===`
|
|
16
|
+
`&&(K=!0,++n),++t===r)return null;if(h(t)==="/"){if(++t===r)throw c("comment");if(h(t)==="/")if(e){if(H=t,X=!1,_(t-1)){X=!0;do if(t=p(t),t===r||(t++,!K))break;while(_(t))}else t=Math.min(r,p(t)+1);X&&(f(H,t,K),K=!0),n++,E=!0}else{for(X=h(H=t+1)==="/";h(++t)!==`
|
|
17
|
+
`;)if(t===r)return null;++t,X&&(f(H,t-1,K),K=!0),++n,E=!0}else if((k=h(t))==="*"){H=t+1,X=e||h(H)==="*";do{if(k===`
|
|
18
|
+
`&&++n,++t===r)throw c("comment");x=k,k=h(t)}while(x!=="*"||k!=="/");++t,X&&(f(H,t-2,K),K=!0),E=!0}else return"/"}}while(E);var F=t;xl.lastIndex=0;var y=xl.test(h(F++));if(!y)for(;F<r&&!xl.test(h(F));)++F;var Re=i.substring(t,t=F);return(Re==='"'||Re==="'")&&(l=Re),Re}function R(E){o.push(E)}function O(){if(!o.length){var E=v();if(E===null)return null;R(E)}return o[0]}function P(E,x){var k=O(),H=k===E;if(H)return v(),!0;if(!x)throw c("token '"+k+"', '"+E+"' expected");return!1}function D(E){var x=null,k;return E===void 0?(k=a[n-1],delete a[n-1],k&&(e||k.type==="*"||k.lineEmpty)&&(x=k.leading?k.text:null)):(s<E&&O(),k=a[E],delete a[E],k&&!k.lineEmpty&&(e||k.type==="/")&&(x=k.leading?null:k.text)),x}return Object.defineProperty({next:v,peek:O,push:R,skip:P,cmnt:D},"line",{get:function(){return n}})}});var dp=g((CO,up)=>{"use strict";up.exports=Bt;Bt.filename=null;Bt.defaults={keepCase:!1};var iE=Dl(),ap=Ps(),op=ws(),lp=er(),nE=_s(),cp=wr(),sE=ot(),aE=Cs(),oE=Es(),lE=tr(),cE=Or(),Ut=me(),uE=/^[1-9][0-9]*$/,dE=/^-?[1-9][0-9]*$/,hE=/^0[x][0-9a-fA-F]+$/,fE=/^-?0[x][0-9a-fA-F]+$/,pE=/^0[0-7]+$/,gE=/^-?0[0-7]+$/,mE=Ut.patterns.numberRe,Ct=/^[a-zA-Z_][a-zA-Z_0-9]*$/,Tt=Ut.patterns.typeRefRe;function Bt(i,e,t){e instanceof ap||(t=e,e=new ap),t||(t=Bt.defaults);var r=t.preferTrailingComment||!1,n=iE(i,t.alternateCommentMode||!1),s=n.next,a=n.push,o=n.peek,l=n.skip,c=n.cmnt,u=!0,h,f,_,p="proto2",v=e,R=[],O={},P=t.keepCase?function(S){return S}:Ut.camelCase;function D(){R.forEach(S=>{S._edition=p,Object.keys(O).forEach(m=>{S.getOption(m)===void 0&&S.setOption(m,O[m],!0)})})}function E(S,m,T){var w=Bt.filename;return T||(Bt.filename=null),Error("illegal "+(m||"token")+" '"+S+"' ("+(w?w+", ":"")+"line "+n.line+")")}function x(){var S=[],m;do{if((m=s())!=='"'&&m!=="'")throw E(m);S.push(s()),l(m),m=o()}while(m==='"'||m==="'");return S.join("")}function k(S){var m=s();switch(m){case"'":case'"':return a(m),x();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return X(m,!0)}catch{if(S&&Tt.test(m))return m;throw E(m,"value")}}function H(S,m){var T,w;do if(m&&((T=o())==='"'||T==="'")){var L=x();if(S.push(L),p>=2023)throw E(L,"id")}else try{S.push([w=K(s()),l("to",!0)?K(s()):w])}catch(q){if(m&&Tt.test(T)&&p>=2023)S.push(T);else throw q}while(l(",",!0));var M={options:void 0};M.setOption=function(q,ue){this.options===void 0&&(this.options={}),this.options[q]=ue},b(M,function(ue){if(ue==="option")Y(M,ue),l(";");else throw E(ue)},function(){It(M)})}function X(S,m){var T=1;switch(S.charAt(0)==="-"&&(T=-1,S=S.substring(1)),S){case"inf":case"INF":case"Inf":return T*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(uE.test(S))return T*parseInt(S,10);if(hE.test(S))return T*parseInt(S,16);if(pE.test(S))return T*parseInt(S,8);if(mE.test(S))return T*parseFloat(S);throw E(S,"number",m)}function K(S,m){switch(S){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!m&&S.charAt(0)==="-")throw E(S,"id");if(dE.test(S))return parseInt(S,10);if(fE.test(S))return parseInt(S,16);if(gE.test(S))return parseInt(S,8);throw E(S,"id")}function F(){if(h!==void 0)throw E("package");if(h=s(),!Tt.test(h))throw E(h,"name");v=v.define(h),l(";")}function y(){var S=o(),m;switch(S){case"weak":m=_||(_=[]),s();break;case"public":s();default:m=f||(f=[]);break}S=x(),l(";"),m.push(S)}function Re(){if(l("="),p=x(),p<2023)throw E(p,"syntax");l(";")}function C(){if(l("="),p=x(),!["2023"].includes(p))throw E(p,"edition");l(";")}function d(S,m,T){switch(T===void 0&&(T=0),m){case"option":return Y(S,m),l(";"),!0;case"message":return W(S,m,T+1),!0;case"enum":return we(S,m),!0;case"service":return Ym(S,m,T+1),!0;case"extend":return Xm(S,m,T),!0}return!1}function b(S,m,T){var w=n.line;if(S&&(typeof S.comment!="string"&&(S.comment=c()),S.filename=Bt.filename),l("{",!0)){for(var L;(L=s())!=="}";)m(L);l(";",!0)}else T&&T(),l(";"),S&&(typeof S.comment!="string"||r)&&(S.comment=c(w)||S.comment)}function W(S,m,T){if(T===void 0&&(T=0),T>Ut.nestingLimit)throw Error("max depth exceeded");if(!Ct.test(m=s()))throw E(m,"type name");var w=new op(m);b(w,function(M){if(!d(w,M,T))switch(M){case"map":ae(w,M);break;case"required":if(p!=="proto2")throw E(M);case"repeated":j(w,M,void 0,T+1);break;case"optional":if(p==="proto3")j(w,"proto3_optional",void 0,T+1);else{if(p!=="proto2")throw E(M);j(w,"optional",void 0,T+1)}break;case"oneof":be(w,M,T+1);break;case"extensions":H(w.extensions||(w.extensions=[]));break;case"reserved":H(w.reserved||(w.reserved=[]),!0);break;default:if(p==="proto2"||!Tt.test(M))throw E(M);a(M),j(w,"optional",void 0,T+1);break}}),S.add(w),S===v&&R.push(w)}function j(S,m,T,w){var L=s();if(L==="group"){Z(S,m,w);return}for(;L.endsWith(".")||o().startsWith(".");)L+=s();if(!Tt.test(L))throw E(L,"type");var M=s();if(!Ct.test(M))throw E(M,"name");M=P(M),l("=");var q=new lp(M,K(s()),L,m,T);if(b(q,function(Ne){if(Ne==="option")Y(q,Ne),l(";");else throw E(Ne)},function(){It(q)}),m==="proto3_optional"){var ue=new cp("_"+M);q.setOption("proto3_optional",!0),ue.add(q),S.add(ue)}else S.add(q);S===v&&R.push(q)}function Z(S,m,T){if(T===void 0&&(T=0),T>Ut.nestingLimit)throw Error("max depth exceeded");if(p>=2023)throw E("group");var w=s();if(!Ct.test(w))throw E(w,"name");var L=Ut.lcFirst(w);w===L&&(w=Ut.ucFirst(w)),l("=");var M=K(s()),q=new op(w);q.group=!0;var ue=new lp(L,M,w,m);ue.filename=Bt.filename,b(q,function(Ne){switch(Ne){case"option":Y(q,Ne),l(";");break;case"required":case"repeated":j(q,Ne,void 0,T+1);break;case"optional":p==="proto3"?j(q,"proto3_optional",void 0,T+1):j(q,"optional",void 0,T+1);break;case"message":W(q,Ne,T+1);break;case"enum":we(q,Ne);break;case"reserved":H(q.reserved||(q.reserved=[]),!0);break;default:throw E(Ne)}}),S.add(q).add(ue)}function ae(S){l("<");var m=s();if(cE.mapKey[m]===void 0)throw E(m,"type");l(",");var T=s();if(!Tt.test(T))throw E(T,"type");l(">");var w=s();if(!Ct.test(w))throw E(w,"name");l("=");var L=new nE(P(w),K(s()),m,T);b(L,function(q){if(q==="option")Y(L,q),l(";");else throw E(q)},function(){It(L)}),S.add(L)}function be(S,m,T){if(!Ct.test(m=s()))throw E(m,"name");var w=new cp(P(m));b(w,function(M){M==="option"?(Y(w,M),l(";")):(a(M),j(w,"optional",void 0,T))}),S.add(w)}function we(S,m){if(!Ct.test(m=s()))throw E(m,"name");var T=new sE(m);b(T,function(L){switch(L){case"option":Y(T,L),l(";");break;case"reserved":H(T.reserved||(T.reserved=[]),!0),T.reserved===void 0&&(T.reserved=[]);break;default:fe(T,L)}}),S.add(T),S===v&&R.push(T)}function fe(S,m){if(!Ct.test(m))throw E(m,"name");l("=");var T=K(s(),!0),w={options:void 0};w.getOption=function(L){return this.options[L]},w.setOption=function(L,M){lE.prototype.setOption.call(w,L,M)},w.setParsedOption=function(){},b(w,function(M){if(M==="option")Y(w,M),l(";");else throw E(M)},function(){It(w)}),S.add(m,T,w.comment,w.parsedOptions||w.options)}function Y(S,m){var T,w,L=!0;for(m==="option"&&(m=s());m!=="=";){if(m===null)throw E(m,"end of input");if(m==="("){var M=s();l(")"),m="("+M+")"}if(L){if(L=!1,m.includes(".")&&!m.includes("(")){var q=m.split(".");T=q[0]+".",m=q[1];continue}T=m}else w=w?w+=m:m;m=s()}var ue=w?T.concat(w):T,gt=Oe(S,ue);w=w&&w[0]==="."?w.slice(1):w,T=T&&T[T.length-1]==="."?T.slice(0,-1):T,Ae(S,T,gt,w)}function Oe(S,m,T){if(T===void 0&&(T=0),T>Ut.recursionLimit)throw Error("max depth exceeded");if(l("{",!0)){for(var w={};!l("}",!0);){if(!Ct.test(Ee=s()))throw E(Ee,"name");if(Ee===null)throw E(Ee,"end of input");var L,M=Ee;if(l(":",!0),o()==="{")L=Oe(S,m+"."+Ee,T+1);else if(o()==="["){L=[];var q;if(l("[",!0)){do q=k(!0),L.push(q);while(l(",",!0));l("]"),typeof q<"u"&&se(S,m+"."+Ee,q)}}else L=k(!0),se(S,m+"."+Ee,L);var ue=w[M];ue&&(L=[].concat(ue).concat(L)),M!=="__proto__"&&(w[M]=L),l(",",!0),l(";",!0)}return w}var gt=k(!0);return se(S,m,gt),gt}function se(S,m,T){if(v===S&&/^features\./.test(m)){O[m]=T;return}S.setOption&&S.setOption(m,T)}function Ae(S,m,T,w){S.setParsedOption&&S.setParsedOption(m,T,w)}function It(S){if(l("[",!0)){do Y(S,"option");while(l(",",!0));l("]")}return S}function Ym(S,m,T){if(T===void 0&&(T=0),T>Ut.recursionLimit)throw Error("max depth exceeded");if(!Ct.test(m=s()))throw E(m,"service name");var w=new aE(m);b(w,function(M){if(!d(w,M,T))if(M==="rpc")Km(w,M);else throw E(M)}),S.add(w),S===v&&R.push(w)}function Km(S,m){var T=c(),w=m;if(!Ct.test(m=s()))throw E(m,"name");var L=m,M,q,ue,gt;if(l("("),l("stream",!0)&&(q=!0),!Tt.test(m=s())||(M=m,l(")"),l("returns"),l("("),l("stream",!0)&&(gt=!0),!Tt.test(m=s())))throw E(m);ue=m,l(")");var Ne=new oE(L,w,M,ue,q,gt);Ne.comment=T,b(Ne,function($a){if($a==="option")Y(Ne,$a),l(";");else throw E($a)}),S.add(Ne)}function Xm(S,m,T){if(!Tt.test(m=s()))throw E(m,"reference");var w=m;b(null,function(M){switch(M){case"required":case"repeated":j(S,M,w,T+1);break;case"optional":p==="proto3"?j(S,"proto3_optional",w,T+1):j(S,"optional",w,T+1);break;default:if(p==="proto2"||!Tt.test(M))throw E(M);a(M),j(S,"optional",w,T+1);break}})}for(var Ee;(Ee=s())!==null;)switch(Ee){case"package":if(!u)throw E(Ee);F();break;case"import":if(!u)throw E(Ee);y();break;case"syntax":if(!u)throw E(Ee);Re();break;case"edition":if(!u)throw E(Ee);C();break;case"option":Y(v,Ee),l(";",!0);break;default:if(d(v,Ee,0)){u=!1;continue}throw E(Ee)}return D(),Bt.filename=null,{package:h,imports:f,weakImports:_,root:e}}});var pp=g((TO,fp)=>{"use strict";fp.exports=ut;var vE=/\/|\./;function ut(i,e){vE.test(i)||(i="google/protobuf/"+i+".proto",e={nested:{google:{nested:{protobuf:{nested:e}}}}}),ut[i]=e}ut("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var hp;ut("duration",{Duration:hp={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});ut("timestamp",{Timestamp:hp});ut("empty",{Empty:{fields:{}}});ut("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}}}});ut("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}}}});ut("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});ut.get=function(e){return ut[e]||null}});var mp=g((bO,gp)=>{"use strict";var rr=gp.exports=rp();rr.build="full";rr.tokenize=Dl();rr.parse=dp();rr.common=pp();rr.Root._configure(rr.Type,rr.parse,rr.common)});var xs=g((RO,vp)=>{"use strict";vp.exports=mp()});var Ll=g((wO,yE)=>{yE.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:[[536e6,536e6]]},Edition:{edition:"proto2",values:{EDITION_UNKNOWN:0,EDITION_LEGACY:900,EDITION_PROTO2:998,EDITION_PROTO3:999,EDITION_2023:1e3,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:[[1e3,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:[[1e3,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:[[1e3,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:[[1e3,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:[[1e3,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:[[1e3,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:[[1e3,536870911]]},ServiceOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:34},deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,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:[[1e3,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:[[1e3,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:[[536e6,536e6]],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 Rp=g((U,bp)=>{"use strict";var Ie=xs();bp.exports=U=Ie.descriptor=Ie.Root.fromJSON(Ll()).lookup(".google.protobuf");var yp=Ie.Namespace,nn=Ie.Root,zt=Ie.Enum,dt=Ie.Type,ir=Ie.Field,_E=Ie.MapField,Ds=Ie.OneOf,sn=Ie.Service,Ls=Ie.Method,_p=Ie.util.patterns,EE=_p.numberRe,Fs=_p.typeRefRe;nn.fromDescriptor=function(e){typeof e.length=="number"&&(e=U.FileDescriptorSet.decode(e));var t=new nn;if(e.file)for(var r,n,s=0,a;s<e.file.length;++s){n=t,(r=e.file[s]).package&&r.package.length&&(n=t.define(r.package));var o=NE(r);if(r.name&&r.name.length&&t.files.push(n.filename=r.name),r.messageType)for(a=0;a<r.messageType.length;++a)n.add(dt.fromDescriptor(r.messageType[a],o));if(r.enumType)for(a=0;a<r.enumType.length;++a)n.add(zt.fromDescriptor(r.enumType[a],o));if(r.extension)for(a=0;a<r.extension.length;++a)n.add(ir.fromDescriptor(r.extension[a],o));if(r.service)for(a=0;a<r.service.length;++a)n.add(sn.fromDescriptor(r.service[a],o));var l=si(r.options,U.FileOptions);if(l){var c=Object.keys(l);for(a=0;a<c.length;++a)n.setOption(c[a],l[c[a]])}}return t.resolveAll()};nn.prototype.toDescriptor=function(e){var t=U.FileDescriptorSet.create();return Ep(this,t.file,e),t};function Ep(i,e,t){var r=U.FileDescriptorProto.create({name:i.filename||(i.fullName.substring(1).replace(/\./g,"_")||"root")+".proto"});PE(t,r),i instanceof nn||(r.package=i.fullName.substring(1));for(var n=0,s;n<i.nestedArray.length;++n)(s=i._nestedArray[n])instanceof dt?r.messageType.push(s.toDescriptor(t)):s instanceof zt?r.enumType.push(s.toDescriptor()):s instanceof ir?r.extension.push(s.toDescriptor(t)):s instanceof sn?r.service.push(s.toDescriptor()):s instanceof yp&&Ep(s,e,t);r.options=ai(i.options,U.FileOptions),r.messageType.length+r.enumType.length+r.extension.length+r.service.length&&e.push(r)}var SE=0;dt.fromDescriptor=function(e,t,r,n){if(n===void 0&&(n=0),n>Ie.util.nestingLimit)throw Error("max depth exceeded");typeof e.length=="number"&&(e=U.DescriptorProto.decode(e));var s=new dt(e.name.length?e.name:"Type"+SE++,si(e.options,U.MessageOptions)),a;if(r||(s._edition=t),e.oneofDecl)for(a=0;a<e.oneofDecl.length;++a)s.add(Ds.fromDescriptor(e.oneofDecl[a]));if(e.field)for(a=0;a<e.field.length;++a){var o=ir.fromDescriptor(e.field[a],t,!0);s.add(o),e.field[a].hasOwnProperty("oneofIndex")&&s.oneofsArray[e.field[a].oneofIndex].add(o)}if(e.extension)for(a=0;a<e.extension.length;++a)s.add(ir.fromDescriptor(e.extension[a],t,!0));if(e.nestedType)for(a=0;a<e.nestedType.length;++a)s.add(dt.fromDescriptor(e.nestedType[a],t,!0,n+1)),e.nestedType[a].options&&e.nestedType[a].options.mapEntry&&s.setOption("map_entry",!0);if(e.enumType)for(a=0;a<e.enumType.length;++a)s.add(zt.fromDescriptor(e.enumType[a],t,!0));if(e.extensionRange&&e.extensionRange.length)for(s.extensions=[],a=0;a<e.extensionRange.length;++a)s.extensions.push([e.extensionRange[a].start,e.extensionRange[a].end]);if(e.reservedRange&&e.reservedRange.length||e.reservedName&&e.reservedName.length){if(s.reserved=[],e.reservedRange)for(a=0;a<e.reservedRange.length;++a)s.reserved.push([e.reservedRange[a].start,e.reservedRange[a].end]);if(e.reservedName)for(a=0;a<e.reservedName.length;++a)s.reserved.push(e.reservedName[a])}return s};dt.prototype.toDescriptor=function(e){var t=U.DescriptorProto.create({name:this.name}),r;for(r=0;r<this.fieldsArray.length;++r){var n;if(t.field.push(n=this._fieldsArray[r].toDescriptor(e)),this._fieldsArray[r]instanceof _E){var s=Fl(this._fieldsArray[r].keyType,this._fieldsArray[r].resolvedKeyType,!1),a=Fl(this._fieldsArray[r].type,this._fieldsArray[r].resolvedType,!1),o=a===11||a===14?this._fieldsArray[r].resolvedType&&Tp(this.parent,this._fieldsArray[r].resolvedType)||this._fieldsArray[r].type:void 0;t.nestedType.push(U.DescriptorProto.create({name:n.typeName,field:[U.FieldDescriptorProto.create({name:"key",number:1,label:1,type:s}),U.FieldDescriptorProto.create({name:"value",number:2,label:1,type:a,typeName:o})],options:U.MessageOptions.create({mapEntry:!0})}))}}for(r=0;r<this.oneofsArray.length;++r)t.oneofDecl.push(this._oneofsArray[r].toDescriptor());for(r=0;r<this.nestedArray.length;++r)this._nestedArray[r]instanceof ir?t.field.push(this._nestedArray[r].toDescriptor(e)):this._nestedArray[r]instanceof dt?t.nestedType.push(this._nestedArray[r].toDescriptor(e)):this._nestedArray[r]instanceof zt&&t.enumType.push(this._nestedArray[r].toDescriptor());if(this.extensions)for(r=0;r<this.extensions.length;++r)t.extensionRange.push(U.DescriptorProto.ExtensionRange.create({start:this.extensions[r][0],end:this.extensions[r][1]}));if(this.reserved)for(r=0;r<this.reserved.length;++r)typeof this.reserved[r]=="string"?t.reservedName.push(this.reserved[r]):t.reservedRange.push(U.DescriptorProto.ReservedRange.create({start:this.reserved[r][0],end:this.reserved[r][1]}));return t.options=ai(this.options,U.MessageOptions),t};ir.fromDescriptor=function(e,t,r){if(typeof e.length=="number"&&(e=U.DescriptorProto.decode(e)),typeof e.number!="number")throw Error("missing field id");var n=e.typeName,s;if(n!=null&&n!==""){if(typeof n!="string"||!Fs.test(n))throw Error("illegal type name: "+n);s=n}else s=wE(e.type);var a;switch(e.label){case 1:a=void 0;break;case 2:a="required";break;case 3:a="repeated";break;default:throw Error("illegal label: "+e.label)}var o=e.extendee;if(o!=null&&o!==""){if(typeof o!="string"||!Fs.test(o))throw Error("illegal type name: "+o)}else o=void 0;var l=new ir(e.name.length?e.name:"field"+e.number,e.number,s,a,o);if(r||(l._edition=t),l.options=si(e.options,U.FieldOptions),e.proto3_optional&&(l.options.proto3_optional=!0),e.defaultValue&&e.defaultValue.length){var c=e.defaultValue;switch(c){case"true":case"TRUE":c=!0;break;case"false":case"FALSE":c=!1;break;default:var u=EE.exec(c);u&&(c=parseInt(c));break}l.setOption("default",c)}return OE(e.type)&&(t==="proto3"?e.options&&!e.options.packed&&l.setOption("packed",!1):(!t||t==="proto2")&&e.options&&e.options.packed&&l.setOption("packed",!0)),l};ir.prototype.toDescriptor=function(e){var t=U.FieldDescriptorProto.create({name:this.name,number:this.id});if(this.map)t.type=11,t.typeName=Ie.util.ucFirst(this.name),t.label=3;else{switch(t.type=Fl(this.type,this.resolve().resolvedType,this.delimited)){case 10:case 11:case 14:t.typeName=this.resolvedType?Tp(this.parent,this.resolvedType):this.type;break}this.rule==="repeated"?t.label=3:this.required&&e==="proto2"?t.label=2:t.label=1}if(t.extendee=this.extensionField?this.extensionField.parent.fullName:this.extend,this.partOf&&this.parent instanceof dt&&(t.oneofIndex=this.parent.oneofsArray.indexOf(this.partOf))<0)throw Error("missing oneof");return this.options&&(t.options=ai(this.options,U.FieldOptions),this.options.default!=null&&(t.defaultValue=String(this.options.default)),this.options.proto3_optional&&(t.proto3_optional=!0)),e==="proto3"?this.packed||((t.options||(t.options=U.FieldOptions.create())).packed=!1):(!e||e==="proto2")&&this.packed&&((t.options||(t.options=U.FieldOptions.create())).packed=!0),t};var CE=0;zt.fromDescriptor=function(e,t,r){typeof e.length=="number"&&(e=U.EnumDescriptorProto.decode(e));var n={};if(e.value)for(var s=0;s<e.value.length;++s){var a=e.value[s].name,o=e.value[s].number||0;n[a&&a.length?a:"NAME"+o]=o}var l=new zt(e.name&&e.name.length?e.name:"Enum"+CE++,n,si(e.options,U.EnumOptions));return r||(l._edition=t),l};zt.prototype.toDescriptor=function(){for(var e=[],t=0,r=Object.keys(this.values);t<r.length;++t)e.push(U.EnumValueDescriptorProto.create({name:r[t],number:this.values[r[t]]}));return U.EnumDescriptorProto.create({name:this.name,value:e,options:ai(this.options,U.EnumOptions)})};var TE=0;Ds.fromDescriptor=function(e){return typeof e.length=="number"&&(e=U.OneofDescriptorProto.decode(e)),new Ds(e.name&&e.name.length?e.name:"oneof"+TE++)};Ds.prototype.toDescriptor=function(){return U.OneofDescriptorProto.create({name:this.name})};var bE=0;sn.fromDescriptor=function(e,t,r){typeof e.length=="number"&&(e=U.ServiceDescriptorProto.decode(e));var n=new sn(e.name&&e.name.length?e.name:"Service"+bE++,si(e.options,U.ServiceOptions));if(r||(n._edition=t),e.method)for(var s=0;s<e.method.length;++s)n.add(Ls.fromDescriptor(e.method[s]));return n};sn.prototype.toDescriptor=function(){for(var e=[],t=0;t<this.methodsArray.length;++t)e.push(this._methodsArray[t].toDescriptor());return U.ServiceDescriptorProto.create({name:this.name,method:e,options:ai(this.options,U.ServiceOptions)})};var RE=0;Ls.fromDescriptor=function(e){typeof e.length=="number"&&(e=U.MethodDescriptorProto.decode(e));var t=e.inputType,r=e.outputType;if(t!=null&&t!==""&&(typeof t!="string"||!Fs.test(t)))throw Error("illegal type name: "+t);if(r!=null&&r!==""&&(typeof r!="string"||!Fs.test(r)))throw Error("illegal type name: "+r);return new Ls(e.name&&e.name.length?e.name:"Method"+RE++,"rpc",t,r,!!e.clientStreaming,!!e.serverStreaming,si(e.options,U.MethodOptions))};Ls.prototype.toDescriptor=function(){return U.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:ai(this.options,U.MethodOptions)})};function wE(i){switch(i){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: "+i)}function OE(i){switch(i){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 Fl(i,e,t){switch(i){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(e instanceof zt)return 14;if(e instanceof dt)return t?10:11;throw Error("illegal type: "+i)}function Sp(i,e){for(var t={},r=0,n,s;r<e.fieldsArray.length;++r)if((s=(n=e._fieldsArray[r]).name)!=="uninterpretedOption"&&Object.prototype.hasOwnProperty.call(i,s)){var a=AE(s);n.resolvedType instanceof dt?t[a]=Sp(i[s],n.resolvedType):n.resolvedType instanceof zt?t[a]=n.resolvedType.valuesById[i[s]]:t[a]=i[s]}return t}function si(i,e){if(i)return Sp(e.toObject(i),e)}function Cp(i,e){for(var t={},r=Object.keys(i),n=0;n<r.length;++n){var s=r[n],a=Ie.util.camelCase(s);if(Object.prototype.hasOwnProperty.call(e.fields,a)){var o=e.fields[a];o.resolvedType instanceof dt?t[a]=Cp(i[s],o.resolvedType):t[a]=i[s],o.repeated&&!Array.isArray(t[a])&&(t[a]=[t[a]])}}return t}function ai(i,e){if(i)return e.fromObject(Cp(i,e))}function Tp(i,e){var t=i.fullName.split("."),r=e.fullName.split("."),n=0,s=0,a=r.length-1;if(!(i instanceof nn)&&e instanceof yp)for(;n<t.length&&s<a&&t[n]===r[s];){var o=e.lookup(t[n++],!0);if(o!==null&&o!==e)break;++s}else for(;n<t.length&&s<a&&t[n]===r[s];++n,++s);return r.slice(s).join(".")}function AE(i){return i.substring(0,1)+i.substring(1).replace(/([A-Z])(?=[a-z]|$)/g,function(e,t){return"_"+t.toLowerCase()})}function NE(i){if(i.syntax==="editions"){if(i.edition===U.Edition.EDITION_2023)return"2023";throw new Error("Unsupported edition "+i.edition)}return i.syntax==="proto3"?"proto3":"proto2"}function PE(i,e){if(i)if(i==="proto2"||i==="proto3")e.syntax=i;else if(e.syntax="editions",i==="2023")e.edition=U.Edition.EDITION_2023;else throw new Error("Unsupported edition "+i)}});var wp=g((OO,IE)=>{IE.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 Op=g((AO,ME)=>{ME.exports={nested:{google:{nested:{protobuf:{nested:{SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var Ap=g((NO,kE)=>{kE.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 Mp=g(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.addCommonProtos=nr.loadProtosWithOptionsSync=nr.loadProtosWithOptions=void 0;var Np=z("fs"),Pp=z("path"),oi=xs();function Ip(i,e){let t=i.resolvePath;i.resolvePath=(r,n)=>{if(Pp.isAbsolute(n))return n;for(let s of e){let a=Pp.join(s,n);try{return Np.accessSync(a,Np.constants.R_OK),a}catch{continue}}return process.emitWarning(`${n} not found in any of the include paths ${e}`),t(r,n)}}async function xE(i,e){let t=new oi.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));Ip(t,e.includeDirs)}let r=await t.load(i,e);return r.resolveAll(),r}nr.loadProtosWithOptions=xE;function DE(i,e){let t=new oi.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))throw new Error("The includeDirs option must be an array");Ip(t,e.includeDirs)}let r=t.loadSync(i,e);return r.resolveAll(),r}nr.loadProtosWithOptionsSync=DE;function LE(){let i=wp(),e=Ll(),t=Op(),r=Ap();oi.common("api",i.nested.google.nested.protobuf.nested),oi.common("descriptor",e.nested.google.nested.protobuf.nested),oi.common("source_context",t.nested.google.nested.protobuf.nested),oi.common("type",r.nested.google.nested.protobuf.nested)}nr.addCommonProtos=LE});var jl=g(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.loadFileDescriptorSetFromObject=de.loadFileDescriptorSetFromBuffer=de.fromJSON=de.loadSync=de.load=de.IdempotencyLevel=de.isAnyExtension=de.Long=void 0;var FE=fh(),bt=xs(),zl=Rp(),Hl=Mp(),qE=Go();de.Long=qE;function UE(i){return"@type"in i&&typeof i["@type"]=="string"}de.isAnyExtension=UE;var kp;(function(i){i.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",i.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",i.IDEMPOTENT="IDEMPOTENT"})(kp=de.IdempotencyLevel||(de.IdempotencyLevel={}));var xp={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function BE(i,e){return i===""?e:i+"."+e}function zE(i){return i instanceof bt.Service||i instanceof bt.Type||i instanceof bt.Enum}function HE(i){return i instanceof bt.Namespace||i instanceof bt.Root}function Dp(i,e){let t=BE(e,i.name);return zE(i)?[[t,i]]:HE(i)&&typeof i.nested<"u"?Object.keys(i.nested).map(r=>Dp(i.nested[r],t)).reduce((r,n)=>r.concat(n),[]):[]}function ql(i,e){return function(r){return i.toObject(i.decode(r),e)}}function Ul(i){return function(t){if(Array.isArray(t))throw new Error(`Failed to serialize message: expected object with ${i.name} structure, got array instead`);let r=i.fromObject(t);return i.encode(r).finish()}}function jE(i){return(i||[]).reduce((e,t)=>{for(let[r,n]of Object.entries(t))r==="uninterpreted_option"?e.uninterpreted_option.push(t.uninterpreted_option):e[r]=n;return e},{deprecated:!1,idempotency_level:kp.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function WE(i,e,t,r){let n=i.resolvedRequestType,s=i.resolvedResponseType;return{path:"/"+e+"/"+i.name,requestStream:!!i.requestStream,responseStream:!!i.responseStream,requestSerialize:Ul(n),requestDeserialize:ql(n,t),responseSerialize:Ul(s),responseDeserialize:ql(s,t),originalName:FE(i.name),requestType:Bl(n,t,r),responseType:Bl(s,t,r),options:jE(i.parsedOptions)}}function GE(i,e,t,r){let n={};for(let s of i.methodsArray)n[s.name]=WE(s,e,t,r);return n}function Bl(i,e,t){let r=i.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:r.$type.toObject(r,xp),fileDescriptorProtos:t,serialize:Ul(i),deserialize:ql(i,e)}}function $E(i,e){let t=i.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:t.$type.toObject(t,xp),fileDescriptorProtos:e}}function VE(i,e,t,r){if(i instanceof bt.Service)return GE(i,e,t,r);if(i instanceof bt.Type)return Bl(i,t,r);if(i instanceof bt.Enum)return $E(i,r);throw new Error("Type mismatch in reflection object handling")}function qs(i,e){let t={};i.resolveAll();let n=i.toDescriptor("proto3").file.map(s=>Buffer.from(zl.FileDescriptorProto.encode(s).finish()));for(let[s,a]of Dp(i,""))t[s]=VE(a,s,e,n);return t}function Lp(i,e){e=e||{};let t=bt.Root.fromDescriptor(i);return t.resolveAll(),qs(t,e)}function YE(i,e){return(0,Hl.loadProtosWithOptions)(i,e).then(t=>qs(t,e))}de.load=YE;function KE(i,e){let t=(0,Hl.loadProtosWithOptionsSync)(i,e);return qs(t,e)}de.loadSync=KE;function XE(i,e){e=e||{};let t=bt.Root.fromJSON(i);return t.resolveAll(),qs(t,e)}de.fromJSON=XE;function JE(i,e){let t=zl.FileDescriptorSet.decode(i);return Lp(t,e)}de.loadFileDescriptorSetFromBuffer=JE;function QE(i,e){let t=zl.FileDescriptorSet.fromObject(i);return Lp(t,e)}de.loadFileDescriptorSetFromObject=QE;(0,Hl.addCommonProtos)()});var sr=g(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.registerChannelzSocket=re.registerChannelzServer=re.registerChannelzSubchannel=re.registerChannelzChannel=re.ChannelzCallTrackerStub=re.ChannelzCallTracker=re.ChannelzChildrenTrackerStub=re.ChannelzChildrenTracker=re.ChannelzTrace=re.ChannelzTraceStub=void 0;re.unregisterChannelzRef=iS;re.dateToProtoTimestamp=ht;re.getChannelzHandlers=Wp;re.getChannelzServiceDefinition=Gp;re.setup=pS;var Bs=z("net"),Nr=(Ld(),gr(Dd)),an=Pe(),on=B(),ZE=De(),eS=is(),tS=ls();function Wl(i){return{channel_id:i.id,name:i.name}}function Kl(i){return{subchannel_id:i.id,name:i.name}}function rS(i){return{server_id:i.id}}function js(i){return{socket_id:i.id,name:i.name}}var Fp=32,Xl=100,Gl=class{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:ht(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}};re.ChannelzTraceStub=Gl;var $l=class{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(e,t,r){let n=new Date;this.events.push({description:t,severity:e,timestamp:n,childChannel:r?.kind==="channel"?r:void 0,childSubchannel:r?.kind==="subchannel"?r:void 0}),this.events.length>=Fp*2&&(this.events=this.events.slice(Fp)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:ht(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(e=>({description:e.description,severity:e.severity,timestamp:ht(e.timestamp),channel_ref:e.childChannel?Wl(e.childChannel):null,subchannel_ref:e.childSubchannel?Kl(e.childSubchannel):null}))}}};re.ChannelzTrace=$l;var zs=class{constructor(){this.channelChildren=new Nr.OrderedMap,this.subchannelChildren=new Nr.OrderedMap,this.socketChildren=new Nr.OrderedMap,this.trackerMap={channel:this.channelChildren,subchannel:this.subchannelChildren,socket:this.socketChildren}}refChild(e){let t=this.trackerMap[e.kind],r=t.find(e.id);r.equals(t.end())?t.setElement(e.id,{ref:e,count:1},r):r.pointer[1].count+=1}unrefChild(e){let t=this.trackerMap[e.kind],r=t.getElementByKey(e.id);r!==void 0&&(r.count-=1,r.count===0&&t.eraseElementByKey(e.id))}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}};re.ChannelzChildrenTracker=zs;var Vl=class extends zs{refChild(){}unrefChild(){}};re.ChannelzChildrenTrackerStub=Vl;var Hs=class{constructor(){this.callsStarted=0,this.callsSucceeded=0,this.callsFailed=0,this.lastCallStartedTimestamp=null}addCallStarted(){this.callsStarted+=1,this.lastCallStartedTimestamp=Date.now()}addCallSucceeded(){this.callsSucceeded+=1}addCallFailed(){this.callsFailed+=1}};re.ChannelzCallTracker=Hs;var Yl=class extends Hs{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}};re.ChannelzCallTrackerStub=Yl;var Ht={channel:new Nr.OrderedMap,subchannel:new Nr.OrderedMap,server:new Nr.OrderedMap,socket:new Nr.OrderedMap},Ws=i=>{let e=1;function t(){return e++}let r=Ht[i];return(n,s,a)=>{let o=t(),l={id:o,name:n,kind:i};return a&&r.setElement(o,{ref:l,getInfo:s}),l}};re.registerChannelzChannel=Ws("channel");re.registerChannelzSubchannel=Ws("subchannel");re.registerChannelzServer=Ws("server");re.registerChannelzSocket=Ws("socket");function iS(i){Ht[i.kind].eraseElementByKey(i.id)}function nS(i){let e=Number.parseInt(i,16);return[e/256|0,e%256]}function qp(i){if(i==="")return[];let e=i.split(":").map(r=>nS(r));return[].concat(...e)}function sS(i){return(0,Bs.isIPv6)(i)&&i.toLowerCase().startsWith("::ffff:")&&(0,Bs.isIPv4)(i.substring(7))}function Up(i){return Buffer.from(Uint8Array.from(i.split(".").map(e=>Number.parseInt(e))))}function aS(i){if((0,Bs.isIPv4)(i))return Up(i);if(sS(i))return Up(i.substring(7));if((0,Bs.isIPv6)(i)){let e,t,r=i.indexOf("::");r===-1?(e=i,t=""):(e=i.substring(0,r),t=i.substring(r+2));let n=Buffer.from(qp(e)),s=Buffer.from(qp(t)),a=Buffer.alloc(16-n.length-s.length,0);return Buffer.concat([n,a,s])}else return null}function zp(i){switch(i){case an.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case an.ConnectivityState.IDLE:return{state:"IDLE"};case an.ConnectivityState.READY:return{state:"READY"};case an.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case an.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function ht(i){if(i==null)return null;let e=typeof i=="number"?i:i.getTime();return{seconds:Math.floor(e/1e3),nanos:e%1e3*1e6}}function Hp(i){let e=i.getInfo(),t=[],r=[];return e.children.channels.forEach(n=>{t.push(Wl(n[1].ref))}),e.children.subchannels.forEach(n=>{r.push(Kl(n[1].ref))}),{ref:Wl(i.ref),data:{target:e.target,state:zp(e.state),calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:ht(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},channel_ref:t,subchannel_ref:r}}function oS(i,e){let t=parseInt(i.request.channel_id,10),r=Ht.channel.getElementByKey(t);if(r===void 0){e({code:on.Status.NOT_FOUND,details:"No channel data found for id "+t});return}e(null,{channel:Hp(r)})}function lS(i,e){let t=parseInt(i.request.max_results,10)||Xl,r=[],n=parseInt(i.request.start_channel_id,10),s=Ht.channel,a;for(a=s.lowerBound(n);!a.equals(s.end())&&r.length<t;a=a.next())r.push(Hp(a.pointer[1]));e(null,{channel:r,end:a.equals(s.end())})}function jp(i){let e=i.getInfo(),t=[];return e.listenerChildren.sockets.forEach(r=>{t.push(js(r[1].ref))}),{ref:rS(i.ref),data:{calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:ht(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},listen_socket:t}}function cS(i,e){let t=parseInt(i.request.server_id,10),n=Ht.server.getElementByKey(t);if(n===void 0){e({code:on.Status.NOT_FOUND,details:"No server data found for id "+t});return}e(null,{server:jp(n)})}function uS(i,e){let t=parseInt(i.request.max_results,10)||Xl,r=parseInt(i.request.start_server_id,10),n=Ht.server,s=[],a;for(a=n.lowerBound(r);!a.equals(n.end())&&s.length<t;a=a.next())s.push(jp(a.pointer[1]));e(null,{server:s,end:a.equals(n.end())})}function dS(i,e){let t=parseInt(i.request.subchannel_id,10),r=Ht.subchannel.getElementByKey(t);if(r===void 0){e({code:on.Status.NOT_FOUND,details:"No subchannel data found for id "+t});return}let n=r.getInfo(),s=[];n.children.sockets.forEach(o=>{s.push(js(o[1].ref))});let a={ref:Kl(r.ref),data:{target:n.target,state:zp(n.state),calls_started:n.callTracker.callsStarted,calls_succeeded:n.callTracker.callsSucceeded,calls_failed:n.callTracker.callsFailed,last_call_started_timestamp:ht(n.callTracker.lastCallStartedTimestamp),trace:n.trace.getTraceMessage()},socket_ref:s};e(null,{subchannel:a})}function Bp(i){var e;return(0,ZE.isTcpSubchannelAddress)(i)?{address:"tcpip_address",tcpip_address:{ip_address:(e=aS(i.host))!==null&&e!==void 0?e:void 0,port:i.port}}:{address:"uds_address",uds_address:{filename:i.path}}}function hS(i,e){var t,r,n,s,a;let o=parseInt(i.request.socket_id,10),l=Ht.socket.getElementByKey(o);if(l===void 0){e({code:on.Status.NOT_FOUND,details:"No socket data found for id "+o});return}let c=l.getInfo(),u=c.security?{model:"tls",tls:{cipher_suite:c.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:(t=c.security.cipherSuiteStandardName)!==null&&t!==void 0?t:void 0,other_name:(r=c.security.cipherSuiteOtherName)!==null&&r!==void 0?r:void 0,local_certificate:(n=c.security.localCertificate)!==null&&n!==void 0?n:void 0,remote_certificate:(s=c.security.remoteCertificate)!==null&&s!==void 0?s:void 0}}:null,h={ref:js(l.ref),local:c.localAddress?Bp(c.localAddress):null,remote:c.remoteAddress?Bp(c.remoteAddress):null,remote_name:(a=c.remoteName)!==null&&a!==void 0?a:void 0,security:u,data:{keep_alives_sent:c.keepAlivesSent,streams_started:c.streamsStarted,streams_succeeded:c.streamsSucceeded,streams_failed:c.streamsFailed,last_local_stream_created_timestamp:ht(c.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:ht(c.lastRemoteStreamCreatedTimestamp),messages_received:c.messagesReceived,messages_sent:c.messagesSent,last_message_received_timestamp:ht(c.lastMessageReceivedTimestamp),last_message_sent_timestamp:ht(c.lastMessageSentTimestamp),local_flow_control_window:c.localFlowControlWindow?{value:c.localFlowControlWindow}:null,remote_flow_control_window:c.remoteFlowControlWindow?{value:c.remoteFlowControlWindow}:null}};e(null,{socket:h})}function fS(i,e){let t=parseInt(i.request.server_id,10),r=Ht.server.getElementByKey(t);if(r===void 0){e({code:on.Status.NOT_FOUND,details:"No server data found for id "+t});return}let n=parseInt(i.request.start_socket_id,10),s=parseInt(i.request.max_results,10)||Xl,o=r.getInfo().sessionChildren.sockets,l=[],c;for(c=o.lowerBound(n);!c.equals(o.end())&&l.length<s;c=c.next())l.push(js(c.pointer[1].ref));e(null,{socket_ref:l,end:c.equals(o.end())})}function Wp(){return{GetChannel:oS,GetTopChannels:lS,GetServer:cS,GetServers:uS,GetSubchannel:dS,GetSocket:hS,GetServerSockets:fS}}var Us=null;function Gp(){if(Us)return Us;let i=jl().loadSync,e=i("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]});return Us=(0,tS.loadPackageDefinition)(e).grpc.channelz.v1.Channelz.service,Us}function pS(){(0,eS.registerAdminService)(Gp,Wp)}});var ln=g(Jl=>{"use strict";Object.defineProperty(Jl,"__esModule",{value:!0});Jl.getNextCallNumber=mS;var gS=0;function mS(){return gS++}});var Ql=g(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.CompressionAlgorithms=void 0;var $p;(function(i){i[i.identity=0]="identity",i[i.deflate=1]="deflate",i[i.gzip=2]="gzip"})($p||(Gs.CompressionAlgorithms=$p={}))});var ec=g($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.BaseFilter=void 0;var Zl=class{async sendMetadata(e){return e}receiveMetadata(e){return e}async sendMessage(e){return e}async receiveMessage(e){return e}receiveTrailers(e){return e}};$s.BaseFilter=Zl});var sc=g(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.CompressionFilterFactory=ci.CompressionFilter=void 0;var Vs=z("zlib"),Yp=Ql(),ar=B(),vS=ec(),yS=ee(),_S=i=>typeof i=="number"&&typeof Yp.CompressionAlgorithms[i]=="string",li=class{async writeMessage(e,t){let r=e;t&&(r=await this.compressMessage(r));let n=Buffer.allocUnsafe(r.length+5);return n.writeUInt8(t?1:0,0),n.writeUInt32BE(r.length,1),r.copy(n,5),n}async readMessage(e){let t=e.readUInt8(0)===1,r=e.slice(5);return t&&(r=await this.decompressMessage(r)),r}},Pr=class extends li{async compressMessage(e){return e}async writeMessage(e,t){let r=Buffer.allocUnsafe(e.length+5);return r.writeUInt8(0,0),r.writeUInt32BE(e.length,1),e.copy(r,5),r}decompressMessage(e){return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity'))}},tc=class extends li{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((t,r)=>{Vs.deflate(e,(n,s)=>{n?r(n):t(s)})})}decompressMessage(e){return new Promise((t,r)=>{let n=0,s=[],a=Vs.createInflate();a.on("error",o=>{r({code:ar.Status.INTERNAL,details:"Failed to decompress deflate-encoded message"})}),a.on("data",o=>{s.push(o),n+=o.byteLength,this.maxRecvMessageLength!==-1&&n>this.maxRecvMessageLength&&(a.destroy(),r({code:ar.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),a.on("end",()=>{t(Buffer.concat(s))}),a.write(e),a.end()})}},rc=class extends li{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((t,r)=>{Vs.gzip(e,(n,s)=>{n?r(n):t(s)})})}decompressMessage(e){return new Promise((t,r)=>{let n=0,s=[],a=Vs.createGunzip();a.on("error",o=>{r({code:ar.Status.INTERNAL,details:"Failed to decompress gzip-encoded message"})}),a.on("data",o=>{s.push(o),n+=o.byteLength,this.maxRecvMessageLength!==-1&&n>this.maxRecvMessageLength&&(a.destroy(),r({code:ar.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),a.on("end",()=>{t(Buffer.concat(s))}),a.write(e),a.end()})}},ic=class extends li{constructor(e){super(),this.compressionName=e}compressMessage(e){return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(e){return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`))}};function Vp(i,e){switch(i){case"identity":return new Pr;case"deflate":return new tc(e);case"gzip":return new rc(e);default:return new ic(i)}}var Ys=class extends vS.BaseFilter{constructor(e,t){var r,n,s;super(),this.sharedFilterConfig=t,this.sendCompression=new Pr,this.receiveCompression=new Pr,this.currentCompressionAlgorithm="identity";let a=e["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=(r=e["grpc.max_receive_message_length"])!==null&&r!==void 0?r:ar.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=(n=e["grpc.max_send_message_length"])!==null&&n!==void 0?n:ar.DEFAULT_MAX_SEND_MESSAGE_LENGTH,a!==void 0)if(_S(a)){let o=Yp.CompressionAlgorithms[a],l=(s=t.serverSupportedEncodingHeader)===null||s===void 0?void 0:s.split(",");(!l||l.includes(o))&&(this.currentCompressionAlgorithm=o,this.sendCompression=Vp(this.currentCompressionAlgorithm,-1))}else yS.log(ar.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${a}`)}async sendMetadata(e){let t=await e;return t.set("grpc-accept-encoding","identity,deflate,gzip"),t.set("accept-encoding","identity"),this.currentCompressionAlgorithm==="identity"?t.remove("grpc-encoding"):t.set("grpc-encoding",this.currentCompressionAlgorithm),t}receiveMetadata(e){let t=e.get("grpc-encoding");if(t.length>0){let n=t[0];typeof n=="string"&&(this.receiveCompression=Vp(n,this.maxReceiveMessageLength))}e.remove("grpc-encoding");let r=e.get("grpc-accept-encoding")[0];return r&&(this.sharedFilterConfig.serverSupportedEncodingHeader=r,r.split(",").includes(this.currentCompressionAlgorithm)||(this.sendCompression=new Pr,this.currentCompressionAlgorithm="identity")),e.remove("grpc-accept-encoding"),e}async sendMessage(e){var t;let r=await e;if(this.maxSendMessageLength!==-1&&r.message.length>this.maxSendMessageLength)throw{code:ar.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let n;return this.sendCompression instanceof Pr?n=!1:n=(((t=r.flags)!==null&&t!==void 0?t:0)&2)===0,{message:await this.sendCompression.writeMessage(r.message,n),flags:r.flags}}async receiveMessage(e){return this.receiveCompression.readMessage(await e)}};ci.CompressionFilter=Ys;var nc=class{constructor(e,t){this.options=t,this.sharedFilterConfig={}}createFilter(){return new Ys(this.options,this.sharedFilterConfig)}};ci.CompressionFilterFactory=nc});var cn=g(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.restrictControlPlaneStatusCode=SS;var Rt=B(),ES=[Rt.Status.OK,Rt.Status.INVALID_ARGUMENT,Rt.Status.NOT_FOUND,Rt.Status.ALREADY_EXISTS,Rt.Status.FAILED_PRECONDITION,Rt.Status.ABORTED,Rt.Status.OUT_OF_RANGE,Rt.Status.DATA_LOSS];function SS(i,e){return ES.includes(i)?{code:Rt.Status.INTERNAL,details:`Invalid status from control plane: ${i} ${Rt.Status[i]} ${e}`}:{code:i,details:e}}});var ui=g(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.minDeadline=CS;Ir.getDeadlineTimeoutString=bS;Ir.getRelativeTimeout=wS;Ir.deadlineToString=OS;Ir.formatDateDifference=AS;function CS(...i){let e=1/0;for(let t of i){let r=t instanceof Date?t.getTime():t;r<e&&(e=r)}return e}var TS=[["m",1],["S",1e3],["M",60*1e3],["H",3600*1e3]];function bS(i){let e=Date.now();i instanceof Date&&(i=i.getTime());let t=Math.max(i-e,0);for(let[r,n]of TS){let s=t/n;if(s<1e8)return String(Math.ceil(s))+r}throw new Error("Deadline is too far in the future")}var RS=2147483647;function wS(i){let e=i instanceof Date?i.getTime():i,t=Date.now(),r=e-t;return r<0?0:r>RS?1/0:r}function OS(i){if(i instanceof Date)return i.toISOString();{let e=new Date(i);return Number.isNaN(e.getTime())?""+i:e.toISOString()}}function AS(i,e){let t=typeof i=="number"?i:i.getTime();return(((typeof e=="number"?e:e.getTime())-t)/1e3).toFixed(3)+"s"}});var Xs=g(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.FilterStackFactory=di.FilterStack=void 0;var Ks=class{constructor(e){this.filters=e}sendMetadata(e){let t=e;for(let r=0;r<this.filters.length;r++)t=this.filters[r].sendMetadata(t);return t}receiveMetadata(e){let t=e;for(let r=this.filters.length-1;r>=0;r--)t=this.filters[r].receiveMetadata(t);return t}sendMessage(e){let t=e;for(let r=0;r<this.filters.length;r++)t=this.filters[r].sendMessage(t);return t}receiveMessage(e){let t=e;for(let r=this.filters.length-1;r>=0;r--)t=this.filters[r].receiveMessage(t);return t}receiveTrailers(e){let t=e;for(let r=this.filters.length-1;r>=0;r--)t=this.filters[r].receiveTrailers(t);return t}push(e){this.filters.unshift(...e)}getFilters(){return this.filters}};di.FilterStack=Ks;var oc=class i{constructor(e){this.factories=e}push(e){this.factories.unshift(...e)}clone(){return new i([...this.factories])}createFilter(){return new Ks(this.factories.map(e=>e.createFilter()))}};di.FilterStackFactory=oc});var Kp=g(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.SingleSubchannelChannel=void 0;var NS=ln(),un=sr(),PS=sc(),IS=Pe(),dn=B(),MS=cn(),kS=ui(),xS=Xs(),lc=pe(),DS=et(),Js=ke(),cc=class{constructor(e,t,r,n,s){this.subchannel=e,this.method=t,this.options=n,this.callNumber=s,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1,this.serviceUrl=(0,Js.computeServiceUrl)(this.options.host,this.method);let a=(0,kS.getRelativeTimeout)(n.deadline);a!==1/0&&(a<=0?this.cancelWithStatus(dn.Status.DEADLINE_EXCEEDED,"Deadline exceeded"):setTimeout(()=>{this.cancelWithStatus(dn.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},a)),this.filterStack=r.createFilter()}cancelWithStatus(e,t){this.childCall?this.childCall.cancelWithStatus(e,t):this.pendingStatus={code:e,details:t,metadata:new lc.Metadata}}getPeer(){var e,t;return(t=(e=this.childCall)===null||e===void 0?void 0:e.getPeer())!==null&&t!==void 0?t:this.subchannel.getAddress()}async start(e,t){if(this.pendingStatus){t.onReceiveStatus(this.pendingStatus);return}if(this.subchannel.getConnectivityState()!==IS.ConnectivityState.READY){t.onReceiveStatus({code:dn.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new lc.Metadata});return}let r=await this.filterStack.sendMetadata(Promise.resolve(e)),n;try{n=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(a){let o=a,{code:l,details:c}=(0,MS.restrictControlPlaneStatusCode)(typeof o.code=="number"?o.code:dn.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${o.message}`);t.onReceiveStatus({code:l,details:c,metadata:new lc.Metadata});return}n.merge(r);let s={onReceiveMetadata:async a=>{t.onReceiveMetadata(await this.filterStack.receiveMetadata(a))},onReceiveMessage:async a=>{this.readFilterPending=!0;let o=await this.filterStack.receiveMessage(a);this.readFilterPending=!1,t.onReceiveMessage(o),this.pendingStatus&&t.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async a=>{let o=await this.filterStack.receiveTrailers(a);this.readFilterPending?this.pendingStatus=o:t.onReceiveStatus(o)}};this.childCall=this.subchannel.createCall(n,this.options.host,this.method,s,this.callNumber),this.readPending&&this.childCall.startRead(),this.pendingMessage&&this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.halfClosePending&&!this.writeFilterPending&&this.childCall.halfClose()}async sendMessageWithContext(e,t){this.writeFilterPending=!0;let r=await this.filterStack.sendMessage(Promise.resolve({message:t,flags:e.flags}));this.writeFilterPending=!1,this.childCall?(this.childCall.sendMessageWithContext(e,r.message),this.halfClosePending&&this.childCall.halfClose()):this.pendingMessage={context:e,message:r.message}}startRead(){this.childCall?this.childCall.startRead():this.readPending=!0}halfClose(){this.childCall&&!this.writeFilterPending?this.childCall.halfClose():this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(e){throw new Error("Method not implemented.")}getAuthContext(){return this.childCall?this.childCall.getAuthContext():null}},uc=class{constructor(e,t,r){this.subchannel=e,this.target=t,this.channelzEnabled=!1,this.channelzTrace=new un.ChannelzTrace,this.callTracker=new un.ChannelzCallTracker,this.childrenTracker=new un.ChannelzChildrenTracker,this.channelzEnabled=r["grpc.enable_channelz"]!==0,this.channelzRef=(0,un.registerChannelzChannel)((0,Js.uriToString)(t),()=>({target:`${(0,Js.uriToString)(t)} (${e.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),this.filterStackFactory=new xS.FilterStackFactory([new PS.CompressionFilterFactory(this,r)])}close(){this.channelzEnabled&&this.childrenTracker.unrefChild(this.subchannel.getChannelzRef()),(0,un.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,Js.uriToString)(this.target)}getConnectivityState(e){throw new Error("Method not implemented.")}watchConnectivityState(e,t,r){throw new Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(e,t){let r={deadline:t,host:(0,DS.getDefaultAuthority)(this.target),flags:dn.Propagate.DEFAULTS,parentCall:null};return new cc(this.subchannel,e,this.filterStackFactory,r,(0,NS.getNextCallNumber)())}};Qs.SingleSubchannelChannel=uc});var Jp=g(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.Subchannel=void 0;var J=Pe(),LS=Gr(),hn=ee(),Zs=B(),FS=ke(),qS=De(),wt=sr(),US=Kp(),Xp="subchannel",BS=~(1<<31),dc=class{constructor(e,t,r,n,s){var a;this.channelTarget=e,this.subchannelAddress=t,this.options=r,this.connector=s,this.connectivityState=J.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 o={initialDelay:r["grpc.initial_reconnect_backoff_ms"],maxDelay:r["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new LS.BackoffTimeout(()=>{this.handleBackoffTimer()},o),this.backoffTimeout.unref(),this.subchannelAddressString=(0,qS.subchannelAddressToString)(t),this.keepaliveTime=(a=r["grpc.keepalive_time_ms"])!==null&&a!==void 0?a:-1,r["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.channelzTrace=new wt.ChannelzTraceStub,this.callTracker=new wt.ChannelzCallTrackerStub,this.childrenTracker=new wt.ChannelzChildrenTrackerStub,this.streamTracker=new wt.ChannelzCallTrackerStub):(this.channelzTrace=new wt.ChannelzTrace,this.callTracker=new wt.ChannelzCallTracker,this.childrenTracker=new wt.ChannelzChildrenTracker,this.streamTracker=new wt.ChannelzCallTracker),this.channelzRef=(0,wt.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.traceEnabled&&this.trace("Subchannel constructed with options "+JSON.stringify(r,void 0,2)),this.secureConnector=n._createSecureConnector(e,r)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}get traceEnabled(){return hn.isTracerEnabled(Xp)}get refTraceEnabled(){return hn.isTracerEnabled("subchannel_refcount")}trace(e){this.traceEnabled&&hn.trace(Zs.LogVerbosity.DEBUG,Xp,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}refTrace(e){this.refTraceEnabled&&hn.trace(Zs.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}handleBackoffTimer(){this.continueConnecting?this.transitionToState([J.ConnectivityState.TRANSIENT_FAILURE],J.ConnectivityState.CONNECTING):this.transitionToState([J.ConnectivityState.TRANSIENT_FAILURE],J.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let e=this.options;if(e["grpc.keepalive_time_ms"]){let t=Math.min(this.keepaliveTime,BS);e=Object.assign(Object.assign({},e),{"grpc.keepalive_time_ms":t})}this.connector.connect(this.subchannelAddress,this.secureConnector,e).then(t=>{this.transitionToState([J.ConnectivityState.CONNECTING],J.ConnectivityState.READY)?(this.transport=t,this.channelzEnabled&&this.childrenTracker.refChild(t.getChannelzRef()),t.addDisconnectListener(r=>{this.transitionToState([J.ConnectivityState.READY],J.ConnectivityState.IDLE),r&&this.keepaliveTime>0&&(this.keepaliveTime*=2,hn.log(Zs.LogVerbosity.ERROR,`Connection to ${(0,FS.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`))})):t.shutdown()},t=>{this.transitionToState([J.ConnectivityState.CONNECTING],J.ConnectivityState.TRANSIENT_FAILURE,`${t}`)})}transitionToState(e,t,r){var n,s;if(e.indexOf(this.connectivityState)===-1)return!1;this.traceEnabled&&(r?this.trace(J.ConnectivityState[this.connectivityState]+" -> "+J.ConnectivityState[t]+' with error "'+r+'"'):this.trace(J.ConnectivityState[this.connectivityState]+" -> "+J.ConnectivityState[t])),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+J.ConnectivityState[t]);let a=this.connectivityState;switch(this.connectivityState=t,t){case J.ConnectivityState.READY:this.stopBackoff();break;case J.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case J.ConnectivityState.TRANSIENT_FAILURE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(n=this.transport)===null||n===void 0||n.shutdown(),this.transport=null,this.backoffTimeout.isRunning()||process.nextTick(()=>{this.handleBackoffTimer()});break;case J.ConnectivityState.IDLE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(s=this.transport)===null||s===void 0||s.shutdown(),this.transport=null;break;default:throw new Error(`Invalid state: unknown ConnectivityState ${t}`)}for(let o of this.stateListeners)o(this,a,t,this.keepaliveTime,r);return!0}ref(){this.refTraceEnabled&&this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){this.refTraceEnabled&&this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,this.refcount===0&&(this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,wt.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([J.ConnectivityState.CONNECTING,J.ConnectivityState.READY],J.ConnectivityState.IDLE)}))}unrefIfOneRef(){return this.refcount===1?(this.unref(),!0):!1}createCall(e,t,r,n,s){if(!this.transport)throw new Error("Cannot create call, subchannel not READY");let a;return this.channelzEnabled?(this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),a={onCallEnd:o=>{o.code===Zs.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}}):a={},this.transport.createCall(e,t,r,n,a,s)}startConnecting(){process.nextTick(()=>{this.transitionToState([J.ConnectivityState.IDLE],J.ConnectivityState.CONNECTING)||this.connectivityState===J.ConnectivityState.TRANSIENT_FAILURE&&(this.continueConnecting=!0)})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(e){this.stateListeners.add(e)}removeConnectivityStateListener(e){this.stateListeners.delete(e)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([J.ConnectivityState.TRANSIENT_FAILURE],J.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(e){}removeHealthStateWatcher(e){}getRealSubchannel(){return this}realSubchannelEquals(e){return e.getRealSubchannel()===this}throttleKeepalive(e){e>this.keepaliveTime&&(this.keepaliveTime=e)}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){return this.subchannelChannel||(this.subchannelChannel=new US.SingleSubchannelChannel(this,this.channelTarget,this.options)),this.subchannelChannel}addDataWatcher(e){throw new Error("Not implemented")}getOrCreateDataProducer(e,t){let r=this.dataProducers.get(e);if(r)return r;let n=t(this);return this.dataProducers.set(e,n),n}removeDataProducer(e){this.dataProducers.delete(e)}};ea.Subchannel=dc});var ta=g(hi=>{"use strict";var hc,fc;Object.defineProperty(hi,"__esModule",{value:!0});hi.GRPC_NODE_DEBUG_SEND_ERROR_DETAILS=hi.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0;hi.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=((hc=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)!==null&&hc!==void 0?hc:"false")==="true";hi.GRPC_NODE_DEBUG_SEND_ERROR_DETAILS=((fc=process.env.GRPC_NODE_DEBUG_SEND_ERROR_DETAILS)!==null&&fc!==void 0?fc:"false")==="true"});var vc=g(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.DEFAULT_PORT=void 0;Mr.setup=YS;var Qp=et(),pc=z("dns"),zS=ho(),gc=B(),fi=Er(),HS=pe(),jS=ee(),WS=B(),or=ke(),Zp=z("net"),GS=Gr(),eg=ta(),$S="dns_resolver";function Ot(i){jS.trace(WS.LogVerbosity.DEBUG,$S,i)}Mr.DEFAULT_PORT=443;var VS=3e4,mc=class{constructor(e,t,r){var n,s,a;this.target=e,this.listener=t,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 pc.promises.Resolver,Ot("Resolver constructed for target "+(0,or.uriToString)(e)),e.authority&&this.alternativeResolver.setServers([e.authority]);let o=(0,or.splitHostPort)(e.path);o===null?(this.ipResult=null,this.dnsHostname=null,this.port=null):(0,Zp.isIPv4)(o.host)||(0,Zp.isIPv6)(o.host)?(this.ipResult=[{addresses:[{host:o.host,port:(n=o.port)!==null&&n!==void 0?n:Mr.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null):(this.ipResult=null,this.dnsHostname=o.host,this.port=(s=o.port)!==null&&s!==void 0?s:Mr.DEFAULT_PORT),this.percentage=Math.random()*100,r["grpc.service_config_disable_resolution"]===1&&(this.isServiceConfigEnabled=!1),this.defaultResolutionError={code:gc.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,or.uriToString)(this.target)}`,metadata:new HS.Metadata};let l={initialDelay:r["grpc.initial_reconnect_backoff_ms"],maxDelay:r["grpc.max_reconnect_backoff_ms"]};this.backoff=new GS.BackoffTimeout(()=>{this.continueResolving&&this.startResolutionWithBackoff()},l),this.backoff.unref(),this.minTimeBetweenResolutionsMs=(a=r["grpc.dns_min_time_between_resolutions_ms"])!==null&&a!==void 0?a:VS,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(this.ipResult!==null){this.returnedIpResult||(Ot("Returning IP address for target "+(0,or.uriToString)(this.target)),setImmediate(()=>{this.listener((0,fi.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0),this.backoff.stop(),this.backoff.reset(),this.stopNextResolutionTimer();return}if(this.dnsHostname===null)Ot("Failed to parse DNS address "+(0,or.uriToString)(this.target)),setImmediate(()=>{this.listener((0,fi.statusOrFromError)({code:gc.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,or.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(this.pendingLookupPromise!==null)return;Ot("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;let e=this.dnsHostname;this.pendingLookupPromise=this.lookup(e),this.pendingLookupPromise.then(t=>{if(this.pendingLookupPromise===null)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,fi.statusOrFromValue)(t.map(s=>({addresses:[s]})));let r="["+t.map(s=>s.host+":"+s.port).join(",")+"]";Ot("Resolved addresses for target "+(0,or.uriToString)(this.target)+": "+r);let n=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(n)},t=>{this.pendingLookupPromise!==null&&(Ot("Resolution error for target "+(0,or.uriToString)(this.target)+": "+t.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,fi.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,""))}),this.isServiceConfigEnabled&&this.pendingTxtPromise===null&&(this.pendingTxtPromise=this.resolveTxt(e),this.pendingTxtPromise.then(t=>{if(this.pendingTxtPromise===null)return;this.pendingTxtPromise=null;let r;try{r=(0,zS.extractAndSelectServiceConfig)(t,this.percentage),r?this.latestServiceConfigResult=(0,fi.statusOrFromValue)(r):this.latestServiceConfigResult=null}catch(n){this.latestServiceConfigResult=(0,fi.statusOrFromError)({code:gc.Status.UNAVAILABLE,details:`Parsing service config failed with error ${n.message}`})}this.latestLookupResult!==null&&this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},t=>{}))}}handleHealthStatus(e){e?(this.backoff.stop(),this.backoff.reset()):this.continueResolving=!0}async lookup(e){if(eg.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){Ot("Using alternative DNS resolver.");let r=await Promise.allSettled([this.alternativeResolver.resolve4(e),this.alternativeResolver.resolve6(e)]);if(r.every(n=>n.status==="rejected"))throw new Error(r[0].reason);return r.reduce((n,s)=>s.status==="fulfilled"?[...n,...s.value]:n,[]).map(n=>({host:n,port:+this.port}))}return(await pc.promises.lookup(e,{all:!0})).map(r=>({host:r.address,port:+this.port}))}async resolveTxt(e){return eg.GRPC_NODE_USE_ALTERNATIVE_RESOLVER?(Ot("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(e)):pc.promises.resolveTxt(e)}startNextResolutionTimer(){var e,t;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{this.stopNextResolutionTimer(),this.continueResolving&&this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),(t=(e=this.nextResolutionTimer).unref)===null||t===void 0||t.call(e),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){this.pendingLookupPromise===null&&(this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution())}updateResolution(){this.pendingLookupPromise===null&&(this.isNextResolutionTimerRunning||this.backoff.isRunning()?(this.isNextResolutionTimerRunning?Ot('resolution update delayed by "min time between resolutions" rate limit'):Ot("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString()),this.continueResolving=!0):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(e){return e.path}};function YS(){(0,Qp.registerResolver)("dns",mc),(0,Qp.registerDefaultScheme)("dns")}});var yc=g(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.parseCIDR=ig;gn.mapProxyName=nC;gn.getProxiedConnection=sC;var fn=ee(),pi=B(),rg=z("net"),KS=z("http"),XS=ee(),tg=De(),pn=ke(),JS=z("url"),QS=vc(),ZS="proxy";function gi(i){XS.trace(pi.LogVerbosity.DEBUG,ZS,i)}function eC(){let i="",e="";if(process.env.grpc_proxy)e="grpc_proxy",i=process.env.grpc_proxy;else if(process.env.https_proxy)e="https_proxy",i=process.env.https_proxy;else if(process.env.http_proxy)e="http_proxy",i=process.env.http_proxy;else return{};let t;try{t=new JS.URL(i)}catch{return(0,fn.log)(pi.LogVerbosity.ERROR,`cannot parse value of "${e}" env var`),{}}if(t.protocol!=="http:")return(0,fn.log)(pi.LogVerbosity.ERROR,`"${t.protocol}" scheme not supported in proxy URI`),{};let r=null;t.username&&(t.password?((0,fn.log)(pi.LogVerbosity.INFO,"userinfo found in proxy URI"),r=decodeURIComponent(`${t.username}:${t.password}`)):r=t.username);let n=t.hostname,s=t.port;s===""&&(s="80");let a={address:`${n}:${s}`};return r&&(a.creds=r),gi("Proxy server "+a.address+" set by environment variable "+e),a}function tC(){let i=process.env.no_grpc_proxy,e="no_grpc_proxy";return i||(i=process.env.no_proxy,e="no_proxy"),i?(gi("No proxy server list set by environment variable "+e),i.split(",")):[]}function ig(i){let e=i.split("/");if(e.length!==2)return null;let t=parseInt(e[1],10);return!(0,rg.isIPv4)(e[0])||Number.isNaN(t)||t<0||t>32?null:{ip:ng(e[0]),prefixLength:t}}function ng(i){return i.split(".").reduce((e,t)=>(e<<8)+parseInt(t,10),0)}function rC(i,e){let t=i.ip,r=-1<<32-i.prefixLength;return(ng(e)&r)===(t&r)}function iC(i){for(let e of tC()){let t=ig(e);if((0,rg.isIPv4)(i)&&t&&rC(t,i))return!0;if(i.endsWith(e))return!0}return!1}function nC(i,e){var t;let r={target:i,extraOptions:{}};if(((t=e["grpc.enable_http_proxy"])!==null&&t!==void 0?t:1)===0||i.scheme==="unix")return r;let n=eC();if(!n.address)return r;let s=(0,pn.splitHostPort)(i.path);if(!s)return r;let a=s.host;if(iC(a))return gi("Not using proxy for target in no_proxy list: "+(0,pn.uriToString)(i)),r;let o={"grpc.http_connect_target":(0,pn.uriToString)(i)};return n.creds&&(o["grpc.http_connect_creds"]=n.creds),{target:{scheme:"dns",path:n.address},extraOptions:o}}function sC(i,e){var t;if(!("grpc.http_connect_target"in e))return Promise.resolve(null);let r=e["grpc.http_connect_target"],n=(0,pn.parseUri)(r);if(n===null)return Promise.resolve(null);let s=(0,pn.splitHostPort)(n.path);if(s===null)return Promise.resolve(null);let a=`${s.host}:${(t=s.port)!==null&&t!==void 0?t:QS.DEFAULT_PORT}`,o={method:"CONNECT",path:a},l={Host:a};(0,tg.isTcpSubchannelAddress)(i)?(o.host=i.host,o.port=i.port):o.socketPath=i.path,"grpc.http_connect_creds"in e&&(l["Proxy-Authorization"]="Basic "+Buffer.from(e["grpc.http_connect_creds"]).toString("base64")),o.headers=l;let c=(0,tg.subchannelAddressToString)(i);return gi("Using proxy "+c+" to connect to "+o.path),new Promise((u,h)=>{let f=KS.request(o);f.once("connect",(_,p,v)=>{f.removeAllListeners(),p.removeAllListeners(),_.statusCode===200?(gi("Successfully connected to "+o.path+" through proxy "+c),v.length>0&&p.unshift(v),gi("Successfully established a plaintext connection to "+o.path+" through proxy "+c),u(p)):((0,fn.log)(pi.LogVerbosity.ERROR,"Failed to connect to "+o.path+" through proxy "+c+" with status "+_.statusCode),h())}),f.once("error",_=>{f.removeAllListeners(),(0,fn.log)(pi.LogVerbosity.ERROR,"Failed to connect to proxy "+c+" with error "+_.message),h()}),f.end()})}});var Ec=g(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});ra.StreamDecoder=void 0;var At;(function(i){i[i.NO_DATA=0]="NO_DATA",i[i.READING_SIZE=1]="READING_SIZE",i[i.READING_MESSAGE=2]="READING_MESSAGE"})(At||(At={}));var _c=class{constructor(e){this.maxReadMessageLength=e,this.readState=At.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(e){let t=0,r,n=[];for(;t<e.length;)switch(this.readState){case At.NO_DATA:this.readCompressFlag=e.slice(t,t+1),t+=1,this.readState=At.READING_SIZE,this.readPartialSize.fill(0),this.readSizeRemaining=4,this.readMessageSize=0,this.readMessageRemaining=0,this.readPartialMessage=[];break;case At.READING_SIZE:if(r=Math.min(e.length-t,this.readSizeRemaining),e.copy(this.readPartialSize,4-this.readSizeRemaining,t,t+r),this.readSizeRemaining-=r,t+=r,this.readSizeRemaining===0){if(this.readMessageSize=this.readPartialSize.readUInt32BE(0),this.maxReadMessageLength!==-1&&this.readMessageSize>this.maxReadMessageLength)throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=At.READING_MESSAGE;else{let s=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=At.NO_DATA,n.push(s)}}break;case At.READING_MESSAGE:if(r=Math.min(e.length-t,this.readMessageRemaining),this.readPartialMessage.push(e.slice(t,t+r)),this.readMessageRemaining-=r,t+=r,this.readMessageRemaining===0){let s=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),a=Buffer.concat(s,this.readMessageSize+5);this.readState=At.NO_DATA,n.push(a)}break;default:throw new Error("Unexpected read state")}return n}};ra.StreamDecoder=_c});var og=g(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});ia.Http2SubchannelCall=void 0;var jt=z("http2"),aC=z("os"),Q=B(),Wt=pe(),oC=Ec(),sg=ee(),lC=B(),ag="subchannel_call";function cC(i){for(let[e,t]of Object.entries(aC.constants.errno))if(t===i)return e;return"Unknown system error "+i}function Sc(i){let e=`Received HTTP status code ${i}`,t;switch(i){case 400:t=Q.Status.INTERNAL;break;case 401:t=Q.Status.UNAUTHENTICATED;break;case 403:t=Q.Status.PERMISSION_DENIED;break;case 404:t=Q.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:t=Q.Status.UNAVAILABLE;break;default:t=Q.Status.UNKNOWN}return{code:t,details:e,metadata:new Wt.Metadata}}var Cc=class{constructor(e,t,r,n,s){var a;this.http2Stream=e,this.callEventTracker=t,this.listener=r,this.transport=n,this.callId=s,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 o=(a=n.getOptions()["grpc.max_receive_message_length"])!==null&&a!==void 0?a:Q.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new oC.StreamDecoder(o),e.on("response",(l,c)=>{if(this.traceEnabled){let u="";for(let h of Object.keys(l))u+=" "+h+": "+l[h]+`
|
|
19
|
+
`;this.trace(`Received server headers:
|
|
20
|
+
`+u)}if(this.httpStatusCode=l[":status"],c&jt.constants.NGHTTP2_FLAG_END_STREAM)this.handleTrailers(l);else{let u;try{u=Wt.Metadata.fromHttp2Headers(l)}catch(h){this.endCall({code:Q.Status.UNKNOWN,details:h.message,metadata:new Wt.Metadata});return}this.listener.onReceiveMetadata(u)}}),e.on("trailers",l=>{this.handleTrailers(l)}),e.on("data",l=>{if(this.statusOutput)return;this.traceEnabled&&this.trace("receive HTTP/2 data frame of length "+l.length);let c;try{c=this.decoder.write(l)}catch(u){if(this.httpStatusCode!==void 0&&this.httpStatusCode!==200){let h=Sc(this.httpStatusCode);this.cancelWithStatus(h.code,h.details)}else this.cancelWithStatus(Q.Status.RESOURCE_EXHAUSTED,u.message);return}for(let u of c)this.traceEnabled&&this.trace("parsed message of length "+u.length),this.callEventTracker.addMessageReceived(),this.tryPush(u)}),e.on("end",()=>{this.readsClosed=!0,this.maybeOutputStatus()}),e.on("close",()=>{this.serverEndedCall=!0,process.nextTick(()=>{var l;if(this.traceEnabled&&this.trace("HTTP/2 stream closed with code "+e.rstCode),((l=this.finalStatus)===null||l===void 0?void 0:l.code)===Q.Status.OK)return;let c,u="";switch(e.rstCode){case jt.constants.NGHTTP2_NO_ERROR:if(this.finalStatus!==null)return;if(this.httpStatusCode&&this.httpStatusCode!==200){let h=Sc(this.httpStatusCode);c=h.code,u=h.details}else c=Q.Status.INTERNAL,u=`Received RST_STREAM with code ${e.rstCode} (Call ended without gRPC status)`;break;case jt.constants.NGHTTP2_REFUSED_STREAM:c=Q.Status.UNAVAILABLE,u="Stream refused by server";break;case jt.constants.NGHTTP2_CANCEL:this.connectionDropped?(c=Q.Status.UNAVAILABLE,u="Connection dropped"):(c=Q.Status.CANCELLED,u="Call cancelled");break;case jt.constants.NGHTTP2_ENHANCE_YOUR_CALM:c=Q.Status.RESOURCE_EXHAUSTED,u="Bandwidth exhausted or memory limit exceeded";break;case jt.constants.NGHTTP2_INADEQUATE_SECURITY:c=Q.Status.PERMISSION_DENIED,u="Protocol not secure enough";break;case jt.constants.NGHTTP2_INTERNAL_ERROR:c=Q.Status.INTERNAL,this.internalError===null?u=`Received RST_STREAM with code ${e.rstCode} (Internal server error)`:this.internalError.code==="ECONNRESET"||this.internalError.code==="ETIMEDOUT"?(c=Q.Status.UNAVAILABLE,u=this.internalError.message):u=`Received RST_STREAM with code ${e.rstCode} triggered by internal client error: ${this.internalError.message}`;break;default:c=Q.Status.INTERNAL,u=`Received RST_STREAM with code ${e.rstCode}`}this.endCall({code:c,details:u,metadata:new Wt.Metadata,rstCode:e.rstCode})})}),e.on("error",l=>{l.code!=="ERR_HTTP2_STREAM_ERROR"&&(this.traceEnabled&&this.trace("Node error event: message="+l.message+" code="+l.code+" errno="+cC(l.errno)+" syscall="+l.syscall),this.internalError=l),this.callEventTracker.onStreamEnd(!1)})}getDeadlineInfo(){return[`remote_addr=${this.getPeer()}`]}onDisconnect(){this.connectionDropped=!0,setImmediate(()=>{this.endCall({code:Q.Status.UNAVAILABLE,details:"Connection dropped",metadata:new Wt.Metadata})})}outputStatus(){this.statusOutput||(this.statusOutput=!0,this.traceEnabled&&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())}get traceEnabled(){return sg.isTracerEnabled(ag)}trace(e){this.traceEnabled&&sg.trace(lC.LogVerbosity.DEBUG,ag,"["+this.callId+"] "+e)}endCall(e){(this.finalStatus===null||this.finalStatus.code===Q.Status.OK)&&(this.finalStatus=e,this.maybeOutputStatus()),this.destroyHttp2Stream()}maybeOutputStatus(){this.finalStatus!==null&&(this.finalStatus.code!==Q.Status.OK||this.readsClosed&&this.unpushedReadMessages.length===0&&!this.isReadFilterPending&&!this.isPushPending)&&this.outputStatus()}push(e){this.traceEnabled&&this.trace("pushing to reader message of length "+(e instanceof Buffer?e.length:null)),this.canPush=!1,this.isPushPending=!0,process.nextTick(()=>{this.isPushPending=!1,!this.statusOutput&&(this.listener.onReceiveMessage(e),this.maybeOutputStatus())})}tryPush(e){this.canPush?(this.http2Stream.pause(),this.push(e)):(this.traceEnabled&&this.trace("unpushedReadMessages.push message of length "+e.length),this.unpushedReadMessages.push(e))}handleTrailers(e){if(this.serverEndedCall=!0,this.callEventTracker.onStreamEnd(!0),this.traceEnabled){let s="";for(let a of Object.keys(e))s+=" "+a+": "+e[a]+`
|
|
21
|
+
`;this.trace(`Received server trailers:
|
|
22
|
+
`+s)}let t;try{t=Wt.Metadata.fromHttp2Headers(e)}catch{t=new Wt.Metadata}let r=t.get("grpc-status"),n;if(r.length>0&&typeof r[0]=="string"){let s=Number(r[0]);this.traceEnabled&&this.trace("received status code "+s+" from server"),t.remove("grpc-status");let a="",o=t.get("grpc-message");if(o.length>0&&typeof o[0]=="string"){let l=o[0];try{a=decodeURI(l)}catch{a=l}t.remove("grpc-message"),this.traceEnabled&&this.trace('received status details string "'+a+'" from server')}n={code:s,details:a,metadata:t}}else this.httpStatusCode?(n=Sc(this.httpStatusCode),n.metadata=t):n={code:Q.Status.UNKNOWN,details:"No status information received",metadata:t};this.endCall(n)}destroyHttp2Stream(){var e;if(!this.http2Stream.destroyed)if(this.serverEndedCall)this.http2Stream.writableEnded||this.http2Stream.end();else{let t;((e=this.finalStatus)===null||e===void 0?void 0:e.code)===Q.Status.OK?t=jt.constants.NGHTTP2_NO_ERROR:t=jt.constants.NGHTTP2_CANCEL,this.traceEnabled&&this.trace("close http2 stream with code "+t),this.http2Stream.close(t)}}cancelWithStatus(e,t){this.traceEnabled&&this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),this.endCall({code:e,details:t,metadata:new Wt.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!==Q.Status.OK){this.readsClosed=!0,this.maybeOutputStatus();return}if(this.canPush=!0,this.unpushedReadMessages.length>0){let e=this.unpushedReadMessages.shift();this.push(e);return}this.http2Stream.resume()}sendMessageWithContext(e,t){this.traceEnabled&&this.trace("write() called with message of length "+t.length);let r=n=>{process.nextTick(()=>{var s;let a=Q.Status.UNAVAILABLE;n?.code==="ERR_STREAM_WRITE_AFTER_END"&&(a=Q.Status.INTERNAL),n&&this.cancelWithStatus(a,`Write error: ${n.message}`),(s=e.callback)===null||s===void 0||s.call(e)})};this.traceEnabled&&this.trace("sending data chunk of length "+t.length),this.callEventTracker.addMessageSent();try{this.http2Stream.write(t,r)}catch(n){this.endCall({code:Q.Status.UNAVAILABLE,details:`Write failed with error ${n.message}`,metadata:new Wt.Metadata})}}halfClose(){this.trace("end() called"),!(this.http2Stream.destroyed||this.http2Stream.writableEnded)&&(this.trace("calling end() on HTTP/2 stream"),this.http2Stream.end())}};ia.Http2SubchannelCall=Cc});var cg=g(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.Http2SubchannelConnector=void 0;var kr=z("http2"),uC=z("tls"),na=sr(),mn=B(),dC=yc(),Nt=ee(),hC=et(),sa=De(),Tc=ke(),fC=z("net"),pC=og(),gC=ln(),aa="transport",lg="transport_flowctrl",mC=Va().version,{HTTP2_HEADER_AUTHORITY:vC,HTTP2_HEADER_CONTENT_TYPE:yC,HTTP2_HEADER_METHOD:_C,HTTP2_HEADER_PATH:EC,HTTP2_HEADER_TE:SC,HTTP2_HEADER_USER_AGENT:CC}=kr.constants,TC=2e4,bC=Buffer.from("too_many_pings","ascii"),bc=class{constructor(e,t,r,n){this.session=e,this.options=r,this.remoteName=n,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,sa.subchannelAddressToString)(t),r["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.streamTracker=new na.ChannelzCallTrackerStub):this.streamTracker=new na.ChannelzCallTracker,this.channelzRef=(0,na.registerChannelzSocket)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.userAgent=[r["grpc.primary_user_agent"],`grpc-node-js/${mC}`,r["grpc.secondary_user_agent"]].filter(s=>s).join(" "),"grpc.keepalive_time_ms"in r?this.keepaliveTimeMs=r["grpc.keepalive_time_ms"]:this.keepaliveTimeMs=-1,"grpc.keepalive_timeout_ms"in r?this.keepaliveTimeoutMs=r["grpc.keepalive_timeout_ms"]:this.keepaliveTimeoutMs=TC,"grpc.keepalive_permit_without_calls"in r?this.keepaliveWithoutCalls=r["grpc.keepalive_permit_without_calls"]===1:this.keepaliveWithoutCalls=!1,e.once("close",()=>{this.trace("session closed"),this.handleDisconnect()}),e.once("goaway",(s,a,o)=>{let l=!1;s===kr.constants.NGHTTP2_ENHANCE_YOUR_CALM&&o&&o.equals(bC)&&(l=!0),this.traceEnabled&&this.trace("connection closed by GOAWAY with code "+s+" and data "+o?.toString()),this.reportDisconnectToOwner(l)}),e.once("error",s=>{this.traceEnabled&&this.trace("connection closed with error "+s.message),this.handleDisconnect()}),e.socket.once("close",s=>{this.traceEnabled&&this.trace("connection closed. hadError="+s),this.handleDisconnect()}),this.traceEnabled&&(e.on("remoteSettings",s=>{this.trace("new settings received"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(s))}),e.on("localSettings",s=>{this.trace("local settings acknowledged by remote"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(s))})),this.keepaliveWithoutCalls&&this.maybeStartKeepalivePingTimer(),e.socket instanceof uC.TLSSocket&&e.socket.authorized?this.authContext={transportSecurityType:"ssl",sslPeerCertificate:e.socket.getPeerCertificate()}:this.authContext={}}getChannelzInfo(){var e,t,r;let n=this.session.socket,s=n.remoteAddress?(0,sa.stringToSubchannelAddress)(n.remoteAddress,n.remotePort):null,a=n.localAddress?(0,sa.stringToSubchannelAddress)(n.localAddress,n.localPort):null,o;if(this.session.encrypted){let c=n,u=c.getCipher(),h=c.getCertificate(),f=c.getPeerCertificate();o={cipherSuiteStandardName:(e=u.standardName)!==null&&e!==void 0?e:null,cipherSuiteOtherName:u.standardName?null:u.name,localCertificate:h&&"raw"in h?h.raw:null,remoteCertificate:f&&"raw"in f?f.raw:null}}else o=null;return{remoteAddress:s,localAddress:a,security:o,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:(t=this.session.state.localWindowSize)!==null&&t!==void 0?t:null,remoteFlowControlWindow:(r=this.session.state.remoteWindowSize)!==null&&r!==void 0?r:null}}get traceEnabled(){return Nt.isTracerEnabled(aa)}get keepaliveTraceEnabled(){return Nt.isTracerEnabled("keepalive")}get flowControlTraceEnabled(){return Nt.isTracerEnabled(lg)}get internalsTraceEnabled(){return Nt.isTracerEnabled("transport_internals")}trace(e){this.traceEnabled&&Nt.trace(mn.LogVerbosity.DEBUG,aa,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}keepaliveTrace(e){this.keepaliveTraceEnabled&&Nt.trace(mn.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}flowControlTrace(e){this.flowControlTraceEnabled&&Nt.trace(mn.LogVerbosity.DEBUG,lg,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}internalsTrace(e){this.internalsTraceEnabled&&Nt.trace(mn.LogVerbosity.DEBUG,"transport_internals","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}reportDisconnectToOwner(e){this.disconnectHandled||(this.disconnectHandled=!0,this.disconnectListeners.forEach(t=>t(e)))}handleDisconnect(){this.clearKeepaliveTimeout(),this.reportDisconnectToOwner(!1);for(let e of this.activeCalls)e.onDisconnect();setImmediate(()=>{this.session.destroy()})}addDisconnectListener(e){this.disconnectListeners.push(e)}canSendPing(){return!this.session.destroyed&&this.keepaliveTimeMs>0&&(this.keepaliveWithoutCalls||this.activeCalls.size>0)}maybeSendPing(){var e,t;if(!this.canSendPing()){this.pendingSendKeepalivePing=!0;return}if(this.keepaliveTimer){console.error("keepaliveTimeout is not null");return}this.channelzEnabled&&(this.keepalivesSent+=1),this.keepaliveTraceEnabled&&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),(t=(e=this.keepaliveTimer).unref)===null||t===void 0||t.call(e);let r="";try{this.session.ping((s,a,o)=>{this.clearKeepaliveTimeout(),s?(this.keepaliveTraceEnabled&&this.keepaliveTrace("Ping failed with error "+s.message),this.handleDisconnect()):(this.keepaliveTrace("Received ping response"),this.maybeStartKeepalivePingTimer())})||(r="Ping returned false")}catch(n){r=(n instanceof Error?n.message:"")||"Unknown error"}r&&(this.keepaliveTraceEnabled&&this.keepaliveTrace("Ping send failed: "+r),this.handleDisconnect())}maybeStartKeepalivePingTimer(){var e,t;this.canSendPing()&&(this.pendingSendKeepalivePing?(this.pendingSendKeepalivePing=!1,this.maybeSendPing()):this.keepaliveTimer||(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.maybeSendPing()},this.keepaliveTimeMs),(t=(e=this.keepaliveTimer).unref)===null||t===void 0||t.call(e)))}clearKeepaliveTimeout(){this.keepaliveTimer&&(clearTimeout(this.keepaliveTimer),this.keepaliveTimer=null)}removeActiveCall(e){this.activeCalls.delete(e),this.activeCalls.size===0&&this.session.unref()}addActiveCall(e){this.activeCalls.add(e),this.activeCalls.size===1&&(this.session.ref(),this.keepaliveWithoutCalls||this.maybeStartKeepalivePingTimer())}createCall(e,t,r,n,s,a){let o=e.toHttp2Headers();o[vC]=t,o[CC]=this.userAgent,o[yC]="application/grpc",o[_C]="POST",o[EC]=r,o[SC]="trailers";let l;try{l=this.session.request(o)}catch(h){throw this.handleDisconnect(),h}this.flowControlTraceEnabled&&this.flowControlTrace("local window size: "+this.session.state.localWindowSize+" remote window size: "+this.session.state.remoteWindowSize),this.internalsTraceEnabled&&this.internalsTrace("session.closed="+this.session.closed+" session.destroyed="+this.session.destroyed+" session.socket.destroyed="+this.session.socket.destroyed);let c,u;return this.channelzEnabled?(this.streamTracker.addCallStarted(),c={addMessageSent:()=>{var h;this.messagesSent+=1,this.lastMessageSentTimestamp=Date.now(),(h=s.addMessageSent)===null||h===void 0||h.call(s)},addMessageReceived:()=>{var h;this.messagesReceived+=1,this.lastMessageReceivedTimestamp=Date.now(),(h=s.addMessageReceived)===null||h===void 0||h.call(s)},onCallEnd:h=>{var f;(f=s.onCallEnd)===null||f===void 0||f.call(s,h),this.removeActiveCall(u)},onStreamEnd:h=>{var f;h?this.streamTracker.addCallSucceeded():this.streamTracker.addCallFailed(),(f=s.onStreamEnd)===null||f===void 0||f.call(s,h)}}):c={addMessageSent:()=>{var h;(h=s.addMessageSent)===null||h===void 0||h.call(s)},addMessageReceived:()=>{var h;(h=s.addMessageReceived)===null||h===void 0||h.call(s)},onCallEnd:h=>{var f;(f=s.onCallEnd)===null||f===void 0||f.call(s,h),this.removeActiveCall(u)},onStreamEnd:h=>{var f;(f=s.onStreamEnd)===null||f===void 0||f.call(s,h)}},u=new pC.Http2SubchannelCall(l,c,n,this,a??(0,gC.getNextCallNumber)()),this.addActiveCall(u),u}getChannelzRef(){return this.channelzRef}getPeerName(){return this.subchannelAddressString}getOptions(){return this.options}getAuthContext(){return this.authContext}shutdown(){this.session.close(),(0,na.unregisterChannelzRef)(this.channelzRef)}},Rc=class{constructor(e){this.channelTarget=e,this.session=null,this.isShutdown=!1}get traceEnabled(){return Nt.isTracerEnabled(aa)}trace(e){this.traceEnabled&&Nt.trace(mn.LogVerbosity.DEBUG,aa,(0,Tc.uriToString)(this.channelTarget)+" "+e)}createSession(e,t,r){return this.isShutdown?Promise.reject():e.socket.closed?Promise.reject("Connection closed before starting HTTP/2 handshake"):new Promise((n,s)=>{var a,o,l,c,u,h,f,_;let p=null,v=this.channelTarget;if("grpc.http_connect_target"in r){let F=(0,Tc.parseUri)(r["grpc.http_connect_target"]);F&&(v=F,p=(0,Tc.uriToString)(F))}let R=e.secure?"https":"http",O=(0,hC.getDefaultAuthority)(v),P=()=>{var F;(F=this.session)===null||F===void 0||F.destroy(),this.session=null,setImmediate(()=>{K||(K=!0,s(`${X.trim()} (${new Date().toISOString()})`))})},D=F=>{var y;(y=this.session)===null||y===void 0||y.destroy(),X=F.message,this.traceEnabled&&this.trace("connection failed with error "+X),K||(K=!0,s(`${X} (${new Date().toISOString()})`))},E={createConnection:(F,y)=>e.socket,settings:{initialWindowSize:(c=(a=r["grpc-node.flow_control_window"])!==null&&a!==void 0?a:(l=(o=kr.getDefaultSettings)===null||o===void 0?void 0:o.call(kr))===null||l===void 0?void 0:l.initialWindowSize)!==null&&c!==void 0?c:65535},maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER,maxSessionMemory:(u=r["grpc-node.max_session_memory"])!==null&&u!==void 0?u:Number.MAX_SAFE_INTEGER},x=kr.connect(`${R}://${O}`,E),k=(_=(f=(h=kr.getDefaultSettings)===null||h===void 0?void 0:h.call(kr))===null||f===void 0?void 0:f.initialWindowSize)!==null&&_!==void 0?_:65535,H=r["grpc-node.flow_control_window"];this.session=x;let X="Failed to connect",K=!1;x.unref(),x.once("remoteSettings",()=>{var F;if(H&&H>k)try{x.setLocalWindowSize(H)}catch{let Re=H-((F=x.state.localWindowSize)!==null&&F!==void 0?F:k);Re>0&&x.incrementWindowSize(Re)}x.removeAllListeners(),e.socket.removeListener("close",P),e.socket.removeListener("error",D),n(new bc(x,t,r,p)),this.session=null}),x.once("close",P),x.once("error",D),e.socket.once("close",P),e.socket.once("error",D)})}tcpConnect(e,t){return(0,dC.getProxiedConnection)(e,t).then(r=>r||new Promise((n,s)=>{let a=()=>{s(new Error("Socket closed"))},o=c=>{s(c)},l=fC.connect(e,()=>{l.removeListener("close",a),l.removeListener("error",o),n(l)});l.once("close",a),l.once("error",o)}))}async connect(e,t,r){if(this.isShutdown)return Promise.reject();let n=null,s=null,a=(0,sa.subchannelAddressToString)(e);try{return this.traceEnabled&&this.trace(a+" Waiting for secureConnector to be ready"),await t.waitForReady(),this.traceEnabled&&this.trace(a+" secureConnector is ready"),n=await this.tcpConnect(e,r),n.setNoDelay(),this.traceEnabled&&this.trace(a+" Established TCP connection"),s=await t.connect(n),this.traceEnabled&&this.trace(a+" Established secure connection"),this.createSession(s,e,r)}catch(o){throw n?.destroy(),s?.socket.destroy(),o}}shutdown(){var e;this.isShutdown=!0,(e=this.session)===null||e===void 0||e.close(),this.session=null}};oa.Http2SubchannelConnector=Rc});var ug=g(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.SubchannelPool=void 0;yn.getSubchannelPool=MC;var RC=Pd(),wC=Jp(),OC=De(),AC=ke(),NC=cg(),PC=1e4,vn=class{constructor(){this.pool=Object.create(null),this.cleanupTimer=null}unrefUnusedSubchannels(){let e=!0;for(let t in this.pool){let n=this.pool[t].filter(s=>!s.subchannel.unrefIfOneRef());n.length>0&&(e=!1),this.pool[t]=n}e&&this.cleanupTimer!==null&&(clearInterval(this.cleanupTimer),this.cleanupTimer=null)}ensureCleanupTask(){var e,t;this.cleanupTimer===null&&(this.cleanupTimer=setInterval(()=>{this.unrefUnusedSubchannels()},PC),(t=(e=this.cleanupTimer).unref)===null||t===void 0||t.call(e))}getOrCreateSubchannel(e,t,r,n){this.ensureCleanupTask();let s=(0,AC.uriToString)(e);if(s in this.pool){let o=this.pool[s];for(let l of o)if((0,OC.subchannelAddressEqual)(t,l.subchannelAddress)&&(0,RC.channelOptionsEqual)(r,l.channelArguments)&&n._equals(l.channelCredentials))return l.subchannel}let a=new wC.Subchannel(e,t,r,n,new NC.Http2SubchannelConnector(e));return s in this.pool||(this.pool[s]=[]),this.pool[s].push({subchannelAddress:t,channelArguments:r,channelCredentials:n,subchannel:a}),a.ref(),a}};yn.SubchannelPool=vn;var IC=new vn;function MC(i){return i?IC:new vn}});var gg=g(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});ua.LoadBalancingCall=void 0;var kC=Pi(),dg=Pe(),la=B(),hg=ui(),ca=pe(),_n=kt(),fg=ee(),wc=cn(),xC=z("http2"),pg="load_balancing_call",DC=Promise.resolve(void 0),Oc=class{constructor(e,t,r,n,s,a,o){this.channel=e,this.callConfig=t,this.methodName=r,this.host=n,this.credentials=s,this.deadline=a,this.callNumber=o,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,this.serviceUrl=this.channel.getServiceUrl(this.host,this.methodName),this.startTime=Date.now()}getDeadlineInfo(){var e,t;let r=[];return this.childStartTime!==null?(this.childStartTime>this.startTime&&(!((e=this.metadata)===null||e===void 0)&&e.getOptions().waitForReady&&r.push("wait_for_ready"),r.push(`LB pick: ${(0,hg.formatDateDifference)(this.startTime,this.childStartTime)}`)),r.push(...this.child.getDeadlineInfo()),r):(!((t=this.metadata)===null||t===void 0)&&t.getOptions().waitForReady&&r.push("wait_for_ready"),r.push("Waiting for LB pick"),r)}get traceEnabled(){return fg.isTracerEnabled(pg)}trace(e){this.traceEnabled&&fg.trace(la.LogVerbosity.DEBUG,pg,"["+this.callNumber+"] "+e)}getSubchannelString(e){return e?"("+e.getChannelzRef().id+") "+e.getAddress():""+e}outputStatus(e,t){var r,n;if(!this.ended){this.ended=!0,this.traceEnabled&&this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+new Date(this.startTime).toISOString());let s=Object.assign(Object.assign({},e),{progress:t});(r=this.listener)===null||r===void 0||r.onReceiveStatus(s),(n=this.onCallEnded)===null||n===void 0||n.call(this,s.code,s.details,s.metadata),this.channel.removeCallFromPickQueue(this)}}generateCallCredentialsMetadata(e){return(0,kC.isEmptyCallCredentials)(e)?DC:e.generateMetadata({method_name:this.methodName,service_url:this.serviceUrl})}doPick(){var e,t;if(this.ended)return;if(!this.metadata)throw new Error("doPick called before start");this.trace("Pick called");let r=this.metadata.clone(),n=this.channel.doPick(r,this.callConfig.pickInformation);switch(this.traceEnabled&&this.trace("Pick result: "+_n.PickResultType[n.pickResultType]+" subchannel: "+this.getSubchannelString(n.subchannel)+" status: "+((e=n.status)===null||e===void 0?void 0:e.code)+" "+((t=n.status)===null||t===void 0?void 0:t.details)),n.pickResultType){case _n.PickResultType.COMPLETE:this.generateCallCredentialsMetadata(this.credentials.compose(n.subchannel.getCallCredentials())).then(o=>{var l;if(this.ended){this.trace("Credentials metadata generation finished after call ended");return}if(o&&r.merge(o),r.get("authorization").length>1&&this.outputStatus({code:la.Status.INTERNAL,details:'"authorization" metadata cannot have multiple values',metadata:new ca.Metadata},"PROCESSED"),n.subchannel.getConnectivityState()!==dg.ConnectivityState.READY){this.traceEnabled&&this.trace("Picked subchannel "+this.getSubchannelString(n.subchannel)+" has state "+dg.ConnectivityState[n.subchannel.getConnectivityState()]+" after getting credentials metadata. Retrying pick"),this.doPick();return}this.deadline!==1/0&&r.set("grpc-timeout",(0,hg.getDeadlineTimeoutString)(this.deadline));try{this.child=n.subchannel.getRealSubchannel().createCall(r,this.host,this.methodName,{onReceiveMetadata:c=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(c)},onReceiveMessage:c=>{this.trace("Received message"),this.listener.onReceiveMessage(c)},onReceiveStatus:c=>{this.trace("Received status"),c.rstCode===xC.constants.NGHTTP2_REFUSED_STREAM?this.outputStatus(c,"REFUSED"):this.outputStatus(c,"PROCESSED")}},this.callNumber),this.childStartTime=Date.now()}catch(c){this.traceEnabled&&this.trace("Failed to start call on picked subchannel "+this.getSubchannelString(n.subchannel)+" with error "+c.message),this.outputStatus({code:la.Status.INTERNAL,details:"Failed to start HTTP/2 stream with error "+c.message,metadata:new ca.Metadata},"NOT_STARTED");return}(l=n.onCallStarted)===null||l===void 0||l.call(n),this.onCallEnded=n.onCallEnded,this.traceEnabled&&this.trace("Created child call ["+this.child.getCallNumber()+"]"),this.readPending&&this.child.startRead(),this.pendingMessage&&this.child.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.pendingHalfClose&&this.child.halfClose()},o=>{let{code:l,details:c}=(0,wc.restrictControlPlaneStatusCode)(typeof o.code=="number"?o.code:la.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${o.message}`);this.outputStatus({code:l,details:c,metadata:new ca.Metadata},"PROCESSED")});break;case _n.PickResultType.DROP:let{code:s,details:a}=(0,wc.restrictControlPlaneStatusCode)(n.status.code,n.status.details);setImmediate(()=>{this.outputStatus({code:s,details:a,metadata:n.status.metadata},"DROP")});break;case _n.PickResultType.TRANSIENT_FAILURE:if(this.metadata.getOptions().waitForReady)this.channel.queueCallForPick(this);else{let{code:o,details:l}=(0,wc.restrictControlPlaneStatusCode)(n.status.code,n.status.details);setImmediate(()=>{this.outputStatus({code:o,details:l,metadata:n.status.metadata},"PROCESSED")})}break;case _n.PickResultType.QUEUE:this.channel.queueCallForPick(this)}}cancelWithStatus(e,t){var r;this.traceEnabled&&this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),(r=this.child)===null||r===void 0||r.cancelWithStatus(e,t),this.outputStatus({code:e,details:t,metadata:new ca.Metadata},"PROCESSED")}getPeer(){var e,t;return(t=(e=this.child)===null||e===void 0?void 0:e.getPeer())!==null&&t!==void 0?t:this.channel.getTarget()}start(e,t){this.trace("start called"),this.listener=t,this.metadata=e,this.doPick()}sendMessageWithContext(e,t){this.traceEnabled&&this.trace("write() called with message of length "+t.length),this.child?this.child.sendMessageWithContext(e,t):this.pendingMessage={context:e,message:t}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){throw new Error("Method not implemented.")}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}};ua.LoadBalancingCall=Oc});var _g=g(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.ResolvingCall=void 0;var LC=Pi(),lr=B(),xr=ui(),mg=pe(),vg=ee(),FC=cn(),yg="resolving_call",Ac=class{constructor(e,t,r,n,s){this.channel=e,this.method=t,this.filterStackFactory=n,this.callNumber=s,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=null,this.filterStack=null,this.deadlineStartTime=null,this.configReceivedTime=null,this.childStartTime=null,this.credentials=LC.CallCredentials.createEmpty(),this.deadline=r.deadline,this.host=r.host,r.parentCall&&(r.flags&lr.Propagate.CANCELLATION&&r.parentCall.on("cancelled",()=>{this.cancelWithStatus(lr.Status.CANCELLED,"Cancelled by parent call")}),r.flags&lr.Propagate.DEADLINE&&(this.traceEnabled&&this.trace("Propagating deadline from parent: "+r.parentCall.getDeadline()),this.deadline=(0,xr.minDeadline)(this.deadline,r.parentCall.getDeadline()))),this.trace("Created"),this.runDeadlineTimer()}get traceEnabled(){return vg.isTracerEnabled(yg)}trace(e){this.traceEnabled&&vg.trace(lr.LogVerbosity.DEBUG,yg,"["+this.callNumber+"] "+e)}runDeadlineTimer(){this.deadlineTimer&&(clearTimeout(this.deadlineTimer),this.deadlineTimer=null),this.deadlineStartTime=Date.now(),this.traceEnabled&&this.trace("Deadline: "+(0,xr.deadlineToString)(this.deadline));let e=(0,xr.getRelativeTimeout)(this.deadline);if(e!==1/0){this.traceEnabled&&this.trace("Deadline will be reached in "+e+"ms");let t=()=>{if(this.deadlineTimer=null,this.deadlineStartTime===null){this.cancelWithStatus(lr.Status.DEADLINE_EXCEEDED,"Deadline exceeded");return}let r=[],n=Date.now();r.push(`Deadline exceeded after ${(0,xr.formatDateDifference)(this.deadlineStartTime,n)}`),this.configReceivedTime!==null?(this.configReceivedTime>this.deadlineStartTime&&r.push(`name resolution: ${(0,xr.formatDateDifference)(this.deadlineStartTime,this.configReceivedTime)}`),this.childStartTime!==null?this.childStartTime>this.configReceivedTime&&r.push(`metadata filters: ${(0,xr.formatDateDifference)(this.configReceivedTime,this.childStartTime)}`):r.push("waiting for metadata filters")):r.push("waiting for name resolution"),this.child&&r.push(...this.child.getDeadlineInfo()),this.cancelWithStatus(lr.Status.DEADLINE_EXCEEDED,r.join(","))};e<=0?process.nextTick(t):this.deadlineTimer=setTimeout(t,e)}}outputStatus(e){if(!this.ended){this.ended=!0,this.filterStack||(this.filterStack=this.filterStackFactory.createFilter()),this.deadlineTimer&&(clearTimeout(this.deadlineTimer),this.deadlineTimer=null);let t=this.filterStack.receiveTrailers(e);this.traceEnabled&&this.trace("ended with status: code="+t.code+' details="'+t.details+'"'),this.statusWatchers.forEach(r=>r(t)),process.nextTick(()=>{var r;(r=this.listener)===null||r===void 0||r.onReceiveStatus(t)})}}sendMessageOnChild(e,t){if(!this.child)throw new Error("sendMessageonChild called with child not populated");let r=this.child;this.writeFilterPending=!0,this.filterStack.sendMessage(Promise.resolve({message:t,flags:e.flags})).then(n=>{this.writeFilterPending=!1,r.sendMessageWithContext(e,n.message),this.pendingHalfClose&&r.halfClose()},n=>{var s,a;this.cancelWithStatus((s=n.code)!==null&&s!==void 0?s:lr.Status.INTERNAL,(a=n.details)!==null&&a!==void 0?a:"Failed to write message")})}getConfig(){if(this.ended)return;if(!this.metadata||!this.listener)throw new Error("getConfig called before start");let e=this.channel.getConfig(this.method,this.metadata);if(e.type==="NONE"){this.channel.queueCallForConfig(this);return}else if(e.type==="ERROR"){this.metadata.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(e.error);return}this.configReceivedTime=Date.now();let t=e.config;if(t.status!==lr.Status.OK){let{code:r,details:n}=(0,FC.restrictControlPlaneStatusCode)(t.status,"Failed to route call to method "+this.method);this.outputStatus({code:r,details:n,metadata:new mg.Metadata});return}if(t.methodConfig.timeout){let r=Math.floor(t.methodConfig.timeout.seconds*1e3+t.methodConfig.timeout.nanos/1e6),n=Date.now()+r;this.deadline=(0,xr.minDeadline)(this.deadline,n),this.runDeadlineTimer()}this.filterStackFactory.push(t.dynamicFilterFactories),this.filterStack=this.filterStackFactory.createFilter(),this.filterStack.sendMetadata(Promise.resolve(this.metadata)).then(r=>{this.child=this.channel.createRetryingCall(t,this.method,this.host,this.credentials,this.deadline,this.callNumber),this.traceEnabled&&this.trace("Created child ["+this.child.getCallNumber()+"]"),this.childStartTime=Date.now(),this.child.start(r,{onReceiveMetadata:n=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(this.filterStack.receiveMetadata(n))},onReceiveMessage:n=>{this.trace("Received message"),this.readFilterPending=!0,this.filterStack.receiveMessage(n).then(s=>{this.trace("Finished filtering received message"),this.readFilterPending=!1,this.listener.onReceiveMessage(s),this.pendingChildStatus&&this.outputStatus(this.pendingChildStatus)},s=>{this.cancelWithStatus(s.code,s.details)})},onReceiveStatus:n=>{this.trace("Received status"),this.readFilterPending?this.pendingChildStatus=n:this.outputStatus(n)}}),this.readPending&&this.child.startRead(),this.pendingMessage?this.sendMessageOnChild(this.pendingMessage.context,this.pendingMessage.message):this.pendingHalfClose&&this.child.halfClose()},r=>{this.outputStatus(r)})}reportResolverError(e){var t;!((t=this.metadata)===null||t===void 0)&&t.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(e)}cancelWithStatus(e,t){var r;this.traceEnabled&&this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),(r=this.child)===null||r===void 0||r.cancelWithStatus(e,t),this.outputStatus({code:e,details:t,metadata:new mg.Metadata})}getPeer(){var e,t;return(t=(e=this.child)===null||e===void 0?void 0:e.getPeer())!==null&&t!==void 0?t:this.channel.getTarget()}start(e,t){this.trace("start called"),this.metadata=e.clone(),this.listener=t,this.getConfig()}sendMessageWithContext(e,t){this.traceEnabled&&this.trace("write() called with message of length "+t.length),this.child?this.sendMessageOnChild(e,t):this.pendingMessage={context:e,message:t}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child&&!this.writeFilterPending?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){this.credentials=e}addStatusWatcher(e){this.statusWatchers.push(e)}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}};da.ResolvingCall=Ac});var Cg=g(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.RetryingCall=cr.MessageBufferTracker=cr.RetryThrottler=void 0;var ha=B(),qC=ui(),UC=pe(),Eg=ee(),BC=ln(),Sg="retrying_call",Pc=class{constructor(e,t,r){this.maxTokens=e,this.tokenRatio=t,r?this.tokens=r.tokens*(e/r.maxTokens):this.tokens=e}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}};cr.RetryThrottler=Pc;var Ic=class{constructor(e,t){this.totalLimit=e,this.limitPerCall=t,this.totalAllocated=0,this.allocatedPerCall=new Map}allocate(e,t){var r;let n=(r=this.allocatedPerCall.get(t))!==null&&r!==void 0?r:0;return this.limitPerCall-n<e||this.totalLimit-this.totalAllocated<e?!1:(this.allocatedPerCall.set(t,n+e),this.totalAllocated+=e,!0)}free(e,t){var r;if(this.totalAllocated<e)throw new Error(`Invalid buffer allocation state: call ${t} freed ${e} > total allocated ${this.totalAllocated}`);this.totalAllocated-=e;let n=(r=this.allocatedPerCall.get(t))!==null&&r!==void 0?r:0;if(n<e)throw new Error(`Invalid buffer allocation state: call ${t} freed ${e} > allocated for call ${n}`);this.allocatedPerCall.set(t,n-e)}freeAll(e){var t;let r=(t=this.allocatedPerCall.get(e))!==null&&t!==void 0?t:0;if(this.totalAllocated<r)throw new Error(`Invalid buffer allocation state: call ${e} allocated ${r} > total allocated ${this.totalAllocated}`);this.totalAllocated-=r,this.allocatedPerCall.delete(e)}};cr.MessageBufferTracker=Ic;var Nc="grpc-previous-rpc-attempts",zC=5,Mc=class{constructor(e,t,r,n,s,a,o,l,c){var u;this.channel=e,this.callConfig=t,this.methodName=r,this.host=n,this.credentials=s,this.deadline=a,this.callNumber=o,this.bufferTracker=l,this.retryThrottler=c,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 h=(u=e.getOptions()["grpc-node.retry_max_attempts_limit"])!==null&&u!==void 0?u:zC;if(e.getOptions()["grpc.enable_retries"]===0)this.state="NO_RETRY",this.maxAttempts=1;else if(t.methodConfig.retryPolicy){this.state="RETRY";let f=t.methodConfig.retryPolicy;this.nextRetryBackoffSec=this.initialRetryBackoffSec=Number(f.initialBackoff.substring(0,f.initialBackoff.length-1)),this.maxAttempts=Math.min(f.maxAttempts,h)}else t.methodConfig.hedgingPolicy?(this.state="HEDGING",this.maxAttempts=Math.min(t.methodConfig.hedgingPolicy.maxAttempts,h)):(this.state="TRANSPARENT_ONLY",this.maxAttempts=1);this.startTime=Date.now()}getDeadlineInfo(){if(this.underlyingCalls.length===0)return[];let e=[],t=this.underlyingCalls[this.underlyingCalls.length-1];return this.underlyingCalls.length>1&&e.push(`previous attempts: ${this.underlyingCalls.length-1}`),t.startTime>this.startTime&&e.push(`time to current attempt start: ${(0,qC.formatDateDifference)(this.startTime,t.startTime)}`),e.push(...t.call.getDeadlineInfo()),e}getCallNumber(){return this.callNumber}get traceEnabled(){return Eg.isTracerEnabled(Sg)}trace(e){this.traceEnabled&&Eg.trace(ha.LogVerbosity.DEBUG,Sg,"["+this.callNumber+"] "+e)}reportStatus(e){this.traceEnabled&&this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+new Date(this.startTime).toISOString()),this.bufferTracker.freeAll(this.callNumber),this.writeBufferOffset=this.writeBufferOffset+this.writeBuffer.length,this.writeBuffer=[],process.nextTick(()=>{var t;(t=this.listener)===null||t===void 0||t.onReceiveStatus({code:e.code,details:e.details,metadata:e.metadata})})}cancelWithStatus(e,t){this.traceEnabled&&this.trace("cancelWithStatus code: "+e+' details: "'+t+'"'),this.reportStatus({code:e,details:t,metadata:new UC.Metadata});for(let{call:r}of this.underlyingCalls)r.cancelWithStatus(e,t)}getPeer(){return this.committedCallIndex!==null?this.underlyingCalls[this.committedCallIndex].call.getPeer():"unknown"}getBufferEntry(e){var t;return(t=this.writeBuffer[e-this.writeBufferOffset])!==null&&t!==void 0?t:{entryType:"FREED",allocated:!1}}getNextBufferIndex(){return this.writeBufferOffset+this.writeBuffer.length}clearSentMessages(){if(this.state!=="COMMITTED")return;let e;this.underlyingCalls[this.committedCallIndex].state==="COMPLETED"?e=this.getNextBufferIndex():e=this.underlyingCalls[this.committedCallIndex].nextMessageToSend;for(let t=this.writeBufferOffset;t<e;t++){let r=this.getBufferEntry(t);r.allocated&&this.bufferTracker.free(r.message.message.length,this.callNumber)}this.writeBuffer=this.writeBuffer.slice(e-this.writeBufferOffset),this.writeBufferOffset=e}commitCall(e){var t,r;if(this.state!=="COMMITTED"){this.traceEnabled&&this.trace("Committing call ["+this.underlyingCalls[e].call.getCallNumber()+"] at index "+e),this.state="COMMITTED",(r=(t=this.callConfig).onCommitted)===null||r===void 0||r.call(t),this.committedCallIndex=e;for(let n=0;n<this.underlyingCalls.length;n++)n!==e&&this.underlyingCalls[n].state!=="COMPLETED"&&(this.underlyingCalls[n].state="COMPLETED",this.underlyingCalls[n].call.cancelWithStatus(ha.Status.CANCELLED,"Discarded in favor of other hedged attempt"));this.clearSentMessages()}}commitCallWithMostMessages(){if(this.state==="COMMITTED")return;let e=-1,t=-1;for(let[r,n]of this.underlyingCalls.entries())n.state==="ACTIVE"&&n.nextMessageToSend>e&&(e=n.nextMessageToSend,t=r);t===-1?this.state="TRANSPARENT_ONLY":this.commitCall(t)}isStatusCodeInList(e,t){return e.some(r=>{var n;return r===t||r.toString().toLowerCase()===((n=ha.Status[t])===null||n===void 0?void 0:n.toLowerCase())})}getNextRetryJitter(){return Math.random()*(1.2-.8)+.8}getNextRetryBackoffMs(){var e;let t=(e=this.callConfig)===null||e===void 0?void 0:e.methodConfig.retryPolicy;if(!t)return 0;let n=this.getNextRetryJitter()*this.nextRetryBackoffSec*1e3,s=Number(t.maxBackoff.substring(0,t.maxBackoff.length-1));return this.nextRetryBackoffSec=Math.min(this.nextRetryBackoffSec*t.backoffMultiplier,s),n}maybeRetryCall(e,t){if(this.state!=="RETRY"){t(!1);return}if(this.attempts>=this.maxAttempts){t(!1);return}let r;if(e===null)r=this.getNextRetryBackoffMs();else if(e<0){this.state="TRANSPARENT_ONLY",t(!1);return}else r=e,this.nextRetryBackoffSec=this.initialRetryBackoffSec;setTimeout(()=>{var n,s;if(this.state!=="RETRY"){t(!1);return}!((s=(n=this.retryThrottler)===null||n===void 0?void 0:n.canRetryCall())!==null&&s!==void 0)||s?(t(!0),this.attempts+=1,this.startNewAttempt()):(this.trace("Retry attempt denied by throttling policy"),t(!1))},r)}countActiveCalls(){let e=0;for(let t of this.underlyingCalls)t?.state==="ACTIVE"&&(e+=1);return e}handleProcessedStatus(e,t,r){var n,s,a;switch(this.state){case"COMMITTED":case"NO_RETRY":case"TRANSPARENT_ONLY":this.commitCall(t),this.reportStatus(e);break;case"HEDGING":if(this.isStatusCodeInList((n=this.callConfig.methodConfig.hedgingPolicy.nonFatalStatusCodes)!==null&&n!==void 0?n:[],e.code)){(s=this.retryThrottler)===null||s===void 0||s.addCallFailed();let o;if(r===null)o=0;else if(r<0){this.state="TRANSPARENT_ONLY",this.commitCall(t),this.reportStatus(e);return}else o=r;setTimeout(()=>{this.maybeStartHedgingAttempt(),this.countActiveCalls()===0&&(this.commitCall(t),this.reportStatus(e))},o)}else this.commitCall(t),this.reportStatus(e);break;case"RETRY":this.isStatusCodeInList(this.callConfig.methodConfig.retryPolicy.retryableStatusCodes,e.code)?((a=this.retryThrottler)===null||a===void 0||a.addCallFailed(),this.maybeRetryCall(r,o=>{o||(this.commitCall(t),this.reportStatus(e))})):(this.commitCall(t),this.reportStatus(e));break}}getPushback(e){let t=e.get("grpc-retry-pushback-ms");if(t.length===0)return null;try{return parseInt(t[0])}catch{return-1}}handleChildStatus(e,t){var r;if(this.underlyingCalls[t].state==="COMPLETED")return;if(this.traceEnabled&&this.trace("state="+this.state+" handling status with progress "+e.progress+" from child ["+this.underlyingCalls[t].call.getCallNumber()+"] in state "+this.underlyingCalls[t].state),this.underlyingCalls[t].state="COMPLETED",e.code===ha.Status.OK){(r=this.retryThrottler)===null||r===void 0||r.addCallSucceeded(),this.commitCall(t),this.reportStatus(e);return}if(this.state==="NO_RETRY"){this.commitCall(t),this.reportStatus(e);return}if(this.state==="COMMITTED"){this.reportStatus(e);return}let n=this.getPushback(e.metadata);switch(e.progress){case"NOT_STARTED":this.startNewAttempt();break;case"REFUSED":this.transparentRetryUsed?this.handleProcessedStatus(e,t,n):(this.transparentRetryUsed=!0,this.startNewAttempt());break;case"DROP":this.commitCall(t),this.reportStatus(e);break;case"PROCESSED":this.handleProcessedStatus(e,t,n);break}}maybeStartHedgingAttempt(){this.state==="HEDGING"&&this.callConfig.methodConfig.hedgingPolicy&&(this.attempts>=this.maxAttempts||(this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()))}maybeStartHedgingTimer(){var e,t,r;if(this.hedgingTimer&&clearTimeout(this.hedgingTimer),this.state!=="HEDGING"||!this.callConfig.methodConfig.hedgingPolicy)return;let n=this.callConfig.methodConfig.hedgingPolicy;if(this.attempts>=this.maxAttempts)return;let s=(e=n.hedgingDelay)!==null&&e!==void 0?e:"0s",a=Number(s.substring(0,s.length-1));this.hedgingTimer=setTimeout(()=>{this.maybeStartHedgingAttempt()},a*1e3),(r=(t=this.hedgingTimer).unref)===null||r===void 0||r.call(t)}startNewAttempt(){let e=this.underlyingCalls.length>0?(0,BC.getNextCallNumber)():this.callNumber,t=this.channel.createLoadBalancingCall(this.callConfig,this.methodName,this.host,this.credentials,this.deadline,e);this.traceEnabled&&this.trace("Created child call ["+t.getCallNumber()+"] for attempt "+this.attempts);let r=this.underlyingCalls.length;this.underlyingCalls.push({state:"ACTIVE",call:t,nextMessageToSend:0,startTime:Date.now()});let n=this.attempts-1,s=this.initialMetadata;n>0&&(s=s.clone(),s.set(Nc,`${n}`));let a=!1;t.start(s,{onReceiveMetadata:o=>{this.traceEnabled&&this.trace("Received metadata from child ["+t.getCallNumber()+"]"),this.commitCall(r),a=!0,n>0&&o.set(Nc,`${n}`),this.underlyingCalls[r].state==="ACTIVE"&&this.listener.onReceiveMetadata(o)},onReceiveMessage:o=>{this.traceEnabled&&this.trace("Received message from child ["+t.getCallNumber()+"]"),this.commitCall(r),this.underlyingCalls[r].state==="ACTIVE"&&this.listener.onReceiveMessage(o)},onReceiveStatus:o=>{this.traceEnabled&&this.trace("Received status from child ["+t.getCallNumber()+"]"),!a&&n>0&&o.metadata.set(Nc,`${n}`),this.handleChildStatus(o,r)}}),this.sendNextChildMessage(r),this.readStarted&&t.startRead()}start(e,t){this.trace("start called"),this.listener=t,this.initialMetadata=e,this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()}handleChildWriteCompleted(e,t){var r,n;(n=(r=this.getBufferEntry(t)).callback)===null||n===void 0||n.call(r),this.clearSentMessages();let s=this.underlyingCalls[e];s.nextMessageToSend+=1,this.sendNextChildMessage(e)}sendNextChildMessage(e){let t=this.underlyingCalls[e];if(t.state==="COMPLETED")return;let r=t.nextMessageToSend;if(this.getBufferEntry(r)){let n=this.getBufferEntry(r);switch(n.entryType){case"MESSAGE":t.call.sendMessageWithContext({callback:a=>{this.handleChildWriteCompleted(e,r)}},n.message.message),this.getBufferEntry(r+1).entryType==="HALF_CLOSE"&&(this.traceEnabled&&this.trace("Sending halfClose immediately after message to child ["+t.call.getCallNumber()+"] - optimizing for unary/final message"),t.nextMessageToSend+=1,t.call.halfClose());break;case"HALF_CLOSE":t.nextMessageToSend+=1,t.call.halfClose();break;case"FREED":break}}}sendMessageWithContext(e,t){this.traceEnabled&&this.trace("write() called with message of length "+t.length);let r={message:t,flags:e.flags},n=this.getNextBufferIndex(),s={entryType:"MESSAGE",message:r,allocated:this.bufferTracker.allocate(t.length,this.callNumber)};if(this.writeBuffer.push(s),s.allocated){process.nextTick(()=>{var a;(a=e.callback)===null||a===void 0||a.call(e)});for(let[a,o]of this.underlyingCalls.entries())o.state==="ACTIVE"&&o.nextMessageToSend===n&&o.call.sendMessageWithContext({callback:l=>{this.handleChildWriteCompleted(a,n)}},t)}else{if(this.commitCallWithMostMessages(),this.committedCallIndex===null)return;let a=this.underlyingCalls[this.committedCallIndex];s.callback=e.callback,a.state==="ACTIVE"&&a.nextMessageToSend===n&&a.call.sendMessageWithContext({callback:o=>{this.handleChildWriteCompleted(this.committedCallIndex,n)}},t)}}startRead(){this.trace("startRead called"),this.readStarted=!0;for(let e of this.underlyingCalls)e?.state==="ACTIVE"&&e.call.startRead()}halfClose(){this.trace("halfClose called");let e=this.getNextBufferIndex();this.writeBuffer.push({entryType:"HALF_CLOSE",allocated:!1});for(let t of this.underlyingCalls)t?.state==="ACTIVE"&&(t.nextMessageToSend===e||t.nextMessageToSend===e-1)&&(this.traceEnabled&&this.trace("Sending halfClose immediately to child ["+t.call.getCallNumber()+"] - all messages already sent"),t.nextMessageToSend+=1,t.call.halfClose())}setCredentials(e){throw new Error("Method not implemented.")}getMethod(){return this.methodName}getHost(){return this.host}getAuthContext(){return this.committedCallIndex!==null?this.underlyingCalls[this.committedCallIndex].call.getAuthContext():null}};cr.RetryingCall=Mc});var En=g(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.BaseSubchannelWrapper=void 0;var kc=class{constructor(e){this.child=e,this.healthy=!0,this.healthListeners=new Set,this.refcount=0,this.dataWatchers=new Set,e.addHealthStateWatcher(t=>{this.healthy&&this.updateHealthListeners()})}updateHealthListeners(){for(let e of this.healthListeners)e(this.isHealthy())}getConnectivityState(){return this.child.getConnectivityState()}addConnectivityStateListener(e){this.child.addConnectivityStateListener(e)}removeConnectivityStateListener(e){this.child.removeConnectivityStateListener(e)}startConnecting(){this.child.startConnecting()}getAddress(){return this.child.getAddress()}throttleKeepalive(e){this.child.throttleKeepalive(e)}ref(){this.child.ref(),this.refcount+=1}unref(){this.child.unref(),this.refcount-=1,this.refcount===0&&this.destroy()}destroy(){for(let e of this.dataWatchers)e.destroy()}getChannelzRef(){return this.child.getChannelzRef()}isHealthy(){return this.healthy&&this.child.isHealthy()}addHealthStateWatcher(e){this.healthListeners.add(e)}removeHealthStateWatcher(e){this.healthListeners.delete(e)}addDataWatcher(e){e.setSubchannel(this.getRealSubchannel()),this.dataWatchers.add(e)}setHealthy(e){e!==this.healthy&&(this.healthy=e,this.child.isHealthy()&&this.updateHealthListeners())}getRealSubchannel(){return this.child.getRealSubchannel()}realSubchannelEquals(e){return this.getRealSubchannel()===e.getRealSubchannel()}getCallCredentials(){return this.child.getCallCredentials()}getChannel(){return this.child.getChannel()}};fa.BaseSubchannelWrapper=kc});var Bc=g(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.InternalChannel=Dr.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=void 0;var HC=Wr(),jC=Nd(),WC=ug(),Lc=kt(),GC=pe(),ur=B(),$C=Xs(),VC=sc(),Tg=et(),Sn=ee(),YC=yc(),mi=ke(),Je=Pe(),Cn=sr(),KC=gg(),XC=ui(),JC=_g(),xc=ln(),QC=cn(),Dc=Cg(),ZC=En(),eT=2147483647,tT=1e3,rT=1800*1e3,pa=new Map,iT=1<<24,nT=1<<20,Fc=class extends ZC.BaseSubchannelWrapper{constructor(e,t){super(e),this.channel=t,this.refCount=0,this.subchannelStateListener=(r,n,s,a)=>{t.throttleKeepalive(a)}}ref(){this.refCount===0&&(this.child.addConnectivityStateListener(this.subchannelStateListener),this.channel.addWrappedSubchannel(this)),this.child.ref(),this.refCount+=1}unref(){this.child.unref(),this.refCount-=1,this.refCount<=0&&(this.child.removeConnectivityStateListener(this.subchannelStateListener),this.channel.removeWrappedSubchannel(this))}},qc=class{pick(e){return{pickResultType:Lc.PickResultType.DROP,status:{code:ur.Status.UNAVAILABLE,details:"Channel closed before call started",metadata:new GC.Metadata},subchannel:null,onCallStarted:null,onCallEnded:null}}};Dr.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX="grpc.internal.no_subchannel";var Uc=class{constructor(e){this.target=e,this.trace=new Cn.ChannelzTrace,this.callTracker=new Cn.ChannelzCallTracker,this.childrenTracker=new Cn.ChannelzChildrenTracker,this.state=Je.ConnectivityState.IDLE}getChannelzInfoCallback(){return()=>({target:this.target,state:this.state,trace:this.trace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()})}},Tn=class i{constructor(e,t,r){var n,s,a,o,l,c;if(this.credentials=t,this.options=r,this.connectivityState=Je.ConnectivityState.IDLE,this.currentPicker=new Lc.UnavailablePicker,this.configSelectionQueue=[],this.pickQueue=new Set,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),this.serviceUrlCache=new Map,typeof e!="string")throw new TypeError("Channel target must be a string");if(!(t instanceof HC.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(r&&typeof r!="object")throw new TypeError("Channel options must be an object");this.channelzInfoTracker=new Uc(e);let u=(0,mi.parseUri)(e);if(u===null)throw new Error(`Could not parse target name "${e}"`);let h=(0,Tg.mapUriDefaultScheme)(u);if(h===null)throw new Error(`Could not find a default scheme for target name "${e}"`);this.options["grpc.enable_channelz"]===0&&(this.channelzEnabled=!1),this.channelzRef=(0,Cn.registerChannelzChannel)(e,this.channelzInfoTracker.getChannelzInfoCallback(),this.channelzEnabled),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Channel created"),this.options["grpc.default_authority"]?this.defaultAuthority=this.options["grpc.default_authority"]:this.defaultAuthority=(0,Tg.getDefaultAuthority)(h);let f=(0,YC.mapProxyName)(h,r);this.target=f.target,this.options=Object.assign({},this.options,f.extraOptions),this.subchannelPool=(0,WC.getSubchannelPool)(((n=this.options["grpc.use_local_subchannel_pool"])!==null&&n!==void 0?n:0)===0),this.retryBufferTracker=new Dc.MessageBufferTracker((s=this.options["grpc.retry_buffer_size"])!==null&&s!==void 0?s:iT,(a=this.options["grpc.per_rpc_retry_buffer_size"])!==null&&a!==void 0?a:nT),this.keepaliveTime=(o=this.options["grpc.keepalive_time_ms"])!==null&&o!==void 0?o:-1,this.idleTimeoutMs=Math.max((l=this.options["grpc.client_idle_timeout_ms"])!==null&&l!==void 0?l:rT,tT);let _={createSubchannel:(p,v)=>{let R={};for(let[D,E]of Object.entries(v))D.startsWith(Dr.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX)||(R[D]=E);let O=this.subchannelPool.getOrCreateSubchannel(this.target,p,R,this.credentials);return O.throttleKeepalive(this.keepaliveTime),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Created subchannel or used existing subchannel",O.getChannelzRef()),new Fc(O,this)},updateState:(p,v)=>{this.currentPicker=v;let R=this.pickQueue;this.pickQueue=new Set,R.size>0&&this.callRefTimerUnref();for(let O of R)O.doPick();this.updateState(p)},requestReresolution:()=>{throw new Error("Resolving load balancer should never call requestReresolution")},addChannelzChild:p=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.refChild(p)},removeChannelzChild:p=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.unrefChild(p)}};if(this.resolvingLoadBalancer=new jC.ResolvingLoadBalancer(this.target,_,this.options,(p,v)=>{var R;p.retryThrottling?pa.set(this.getTarget(),new Dc.RetryThrottler(p.retryThrottling.maxTokens,p.retryThrottling.tokenRatio,pa.get(this.getTarget()))):pa.delete(this.getTarget()),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Address resolution succeeded"),(R=this.configSelector)===null||R===void 0||R.unref(),this.configSelector=v,this.currentResolutionError=null,process.nextTick(()=>{let O=this.configSelectionQueue;this.configSelectionQueue=[],O.length>0&&this.callRefTimerUnref();for(let P of O)P.getConfig()})},p=>{this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_WARNING","Address resolution failed with code "+p.code+' and details "'+p.details+'"'),this.configSelectionQueue.length>0&&this.trace("Name resolution failed with calls queued for config selection"),this.configSelector===null&&(this.currentResolutionError=Object.assign(Object.assign({},(0,QC.restrictControlPlaneStatusCode)(p.code,p.details)),{metadata:p.metadata}));let v=this.configSelectionQueue;this.configSelectionQueue=[],v.length>0&&this.callRefTimerUnref();for(let R of v)R.reportResolverError(p)}),this.filterStackFactory=new $C.FilterStackFactory([new VC.CompressionFilterFactory(this,this.options)]),this.traceEnabled&&this.trace("Channel constructed with options "+JSON.stringify(r,void 0,2)),(0,Sn.isTracerEnabled)("channel_stacktrace")){let p=new Error;(0,Sn.trace)(ur.LogVerbosity.DEBUG,"channel_stacktrace","("+this.channelzRef.id+`) Channel constructed
|
|
23
|
+
`+((c=p.stack)===null||c===void 0?void 0:c.substring(p.stack.indexOf(`
|
|
24
|
+
`)+1)))}this.lastActivityTimestamp=Date.now()}get traceEnabled(){return(0,Sn.isTracerEnabled)("channel")}trace(e,t){this.traceEnabled&&(0,Sn.trace)(t??ur.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,mi.uriToString)(this.target)+" "+e)}callRefTimerRef(){var e,t,r,n;this.callRefTimer||(this.callRefTimer=setInterval(()=>{},eT)),!((t=(e=this.callRefTimer).hasRef)===null||t===void 0)&&t.call(e)||(this.traceEnabled&&this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.size),(n=(r=this.callRefTimer).ref)===null||n===void 0||n.call(r))}callRefTimerUnref(){var e,t,r;(!(!((e=this.callRefTimer)===null||e===void 0)&&e.hasRef)||this.callRefTimer.hasRef())&&(this.traceEnabled&&this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.size),(r=(t=this.callRefTimer)===null||t===void 0?void 0:t.unref)===null||r===void 0||r.call(t))}removeConnectivityStateWatcher(e){let t=this.connectivityStateWatchers.findIndex(r=>r===e);t>=0&&this.connectivityStateWatchers.splice(t,1)}updateState(e){(0,Sn.trace)(ur.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,mi.uriToString)(this.target)+" "+Je.ConnectivityState[this.connectivityState]+" -> "+Je.ConnectivityState[e]),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Connectivity state change to "+Je.ConnectivityState[e]),this.connectivityState=e,this.channelzInfoTracker.state=e;let t=this.connectivityStateWatchers.slice();for(let r of t)e!==r.currentState&&(r.timer&&clearTimeout(r.timer),this.removeConnectivityStateWatcher(r),r.callback());e!==Je.ConnectivityState.TRANSIENT_FAILURE&&(this.currentResolutionError=null)}throttleKeepalive(e){if(e>this.keepaliveTime){this.keepaliveTime=e;for(let t of this.wrappedSubchannels)t.throttleKeepalive(e)}}addWrappedSubchannel(e){this.wrappedSubchannels.add(e)}removeWrappedSubchannel(e){this.wrappedSubchannels.delete(e)}doPick(e,t){return this.currentPicker.pick({metadata:e,extraPickInfo:t})}queueCallForPick(e){this.pickQueue.add(e),this.callRefTimerRef()}removeCallFromPickQueue(e){this.pickQueue.delete(e),this.pickQueue.size===0&&this.callRefTimerUnref()}getConfig(e,t){return this.connectivityState!==Je.ConnectivityState.SHUTDOWN&&this.resolvingLoadBalancer.exitIdle(),this.configSelector?{type:"SUCCESS",config:this.configSelector.invoke(e,t,this.randomChannelId)}:this.currentResolutionError?{type:"ERROR",error:this.currentResolutionError}:{type:"NONE"}}queueCallForConfig(e){this.configSelectionQueue.push(e),this.callRefTimerRef()}enterIdle(){this.resolvingLoadBalancer.destroy(),this.updateState(Je.ConnectivityState.IDLE),this.currentPicker=new Lc.QueuePicker(this.resolvingLoadBalancer),this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null),this.callRefTimer&&(clearInterval(this.callRefTimer),this.callRefTimer=null)}startIdleTimeout(e){var t,r;this.idleTimer=setTimeout(()=>{if(this.callCount>0){this.startIdleTimeout(this.idleTimeoutMs);return}let s=Date.now()-this.lastActivityTimestamp;s>=this.idleTimeoutMs?(this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle()):this.startIdleTimeout(this.idleTimeoutMs-s)},e),(r=(t=this.idleTimer).unref)===null||r===void 0||r.call(t)}maybeStartIdleTimer(){this.connectivityState!==Je.ConnectivityState.SHUTDOWN&&!this.idleTimer&&this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){this.channelzEnabled&&this.channelzInfoTracker.callTracker.addCallStarted(),this.callCount+=1}onCallEnd(e){this.channelzEnabled&&(e.code===ur.Status.OK?this.channelzInfoTracker.callTracker.addCallSucceeded():this.channelzInfoTracker.callTracker.addCallFailed()),this.callCount-=1,this.lastActivityTimestamp=Date.now(),this.maybeStartIdleTimer()}getServiceUrl(e,t){let r=this.serviceUrlCache.get(e);if(r===void 0&&this.serviceUrlCache.size<i.MAX_CACHED_HOSTS&&(r=new Map,this.serviceUrlCache.set(e,r)),r!==void 0){let n=r.get(t);if(n!==void 0)return n;let s=(0,mi.computeServiceUrl)(e,t);return r.size<i.MAX_METHODS_PER_HOST&&r.set(t,s),s}return(0,mi.computeServiceUrl)(e,t)}createLoadBalancingCall(e,t,r,n,s,a){let o=a??(0,xc.getNextCallNumber)();return this.traceEnabled&&this.trace("createLoadBalancingCall ["+o+'] method="'+t+'"'),new KC.LoadBalancingCall(this,e,t,r,n,s,o)}createRetryingCall(e,t,r,n,s,a){let o=a??(0,xc.getNextCallNumber)();return this.traceEnabled&&this.trace("createRetryingCall ["+o+'] method="'+t+'"'),new Dc.RetryingCall(this,e,t,r,n,s,o,this.retryBufferTracker,pa.get(this.getTarget()))}createResolvingCall(e,t,r,n,s){let a=(0,xc.getNextCallNumber)();this.traceEnabled&&this.trace("createResolvingCall ["+a+'] method="'+e+'", deadline='+(0,XC.deadlineToString)(t));let o={deadline:t,flags:s??ur.Propagate.DEFAULTS,host:r??this.defaultAuthority,parentCall:n},l=new JC.ResolvingCall(this,e,o,this.filterStackFactory.clone(),a);return this.onCallStart(),l.addStatusWatcher(c=>{this.onCallEnd(c)}),l}close(){var e;this.resolvingLoadBalancer.destroy(),this.updateState(Je.ConnectivityState.SHUTDOWN),this.currentPicker=new qc;for(let t of this.configSelectionQueue)t.cancelWithStatus(ur.Status.UNAVAILABLE,"Channel closed before call started");this.configSelectionQueue=[];for(let t of this.pickQueue)t.cancelWithStatus(ur.Status.UNAVAILABLE,"Channel closed before call started");this.pickQueue.clear(),this.callRefTimer&&clearInterval(this.callRefTimer),this.idleTimer&&clearTimeout(this.idleTimer),this.channelzEnabled&&(0,Cn.unregisterChannelzRef)(this.channelzRef),this.subchannelPool.unrefUnusedSubchannels(),(e=this.configSelector)===null||e===void 0||e.unref(),this.configSelector=null,this.serviceUrlCache.clear()}getTarget(){return(0,mi.uriToString)(this.target)}getConnectivityState(e){let t=this.connectivityState;return e&&(this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=Date.now(),this.maybeStartIdleTimer()),t}watchConnectivityState(e,t,r){if(this.connectivityState===Je.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");let n=null;if(t!==1/0){let a=t instanceof Date?t:new Date(t),o=new Date;if(t===-1/0||a<=o){process.nextTick(r,new Error("Deadline passed without connectivity state change"));return}n=setTimeout(()=>{this.removeConnectivityStateWatcher(s),r(new Error("Deadline passed without connectivity state change"))},a.getTime()-o.getTime())}let s={currentState:e,callback:r,timer:n};this.connectivityStateWatchers.push(s)}getChannelzRef(){return this.channelzRef}createCall(e,t,r,n,s){if(typeof e!="string")throw new TypeError("Channel#createCall: method must be a string");if(!(typeof t=="number"||t instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===Je.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");return this.createResolvingCall(e,t,r,n,s)}getOptions(){return this.options}};Dr.InternalChannel=Tn;Tn.MAX_CACHED_HOSTS=5;Tn.MAX_METHODS_PER_HOST=100});var Do=g(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.ChannelImplementation=void 0;var sT=Wr(),aT=Bc(),zc=class{constructor(e,t,r){if(typeof e!="string")throw new TypeError("Channel target must be a string");if(!(t instanceof sT.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(r&&typeof r!="object")throw new TypeError("Channel options must be an object");this.internalChannel=new aT.InternalChannel(e,t,r)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(e){return this.internalChannel.getConnectivityState(e)}watchConnectivityState(e,t,r){this.internalChannel.watchConnectivityState(e,t,r)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(e,t,r,n,s){if(typeof e!="string")throw new TypeError("Channel#createCall: method must be a string");if(!(typeof t=="number"||t instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(e,t,r,n,s)}};ga.ChannelImplementation=zc});var Rg=g(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.ServerDuplexStreamImpl=ft.ServerWritableStreamImpl=ft.ServerReadableStreamImpl=ft.ServerUnaryCallImpl=void 0;ft.serverErrorToStatus=Yc;var oT=z("events"),$c=z("stream"),Vc=B(),bg=pe();function Yc(i,e){var t;let r={code:Vc.Status.UNKNOWN,details:"message"in i?i.message:"Unknown Error",metadata:(t=e??i.metadata)!==null&&t!==void 0?t:null};return"code"in i&&typeof i.code=="number"&&Number.isInteger(i.code)&&(r.code=i.code,"details"in i&&typeof i.details=="string"&&(r.details=i.details)),r}var Hc=class extends oT.EventEmitter{constructor(e,t,r,n){super(),this.path=e,this.call=t,this.metadata=r,this.request=n,this.cancelled=!1}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}};ft.ServerUnaryCallImpl=Hc;var jc=class extends $c.Readable{constructor(e,t,r){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=r,this.cancelled=!1}_read(e){this.call.startRead()}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}};ft.ServerReadableStreamImpl=jc;var Wc=class extends $c.Writable{constructor(e,t,r,n){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=r,this.request=n,this.pendingStatus={code:Vc.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new bg.Metadata,this.on("error",s=>{this.pendingStatus=Yc(s),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}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(e,t,r){this.call.sendMessage(e,r)}_final(e){var t;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(t=this.pendingStatus.metadata)!==null&&t!==void 0?t:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}};ft.ServerWritableStreamImpl=Wc;var Gc=class extends $c.Duplex{constructor(e,t,r){super({objectMode:!0}),this.path=e,this.call=t,this.metadata=r,this.pendingStatus={code:Vc.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new bg.Metadata,this.on("error",n=>{this.pendingStatus=Yc(n),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}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(e){this.call.startRead()}_write(e,t,r){this.call.sendMessage(e,r)}_final(e){var t;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(t=this.pendingStatus.metadata)!==null&&t!==void 0?t:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}};ft.ServerDuplexStreamImpl=Gc});var ma=g(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.ServerCredentials=void 0;vi.createCertificateProviderServerCredentials=lT;vi.createServerCredentialsWithInterceptors=cT;var Kc=io(),Lr=class{constructor(e,t){this.serverConstructorOptions=e,this.watchers=new Set,this.latestContextOptions=null,this.latestContextOptions=t??null}_addWatcher(e){this.watchers.add(e)}_removeWatcher(e){this.watchers.delete(e)}getWatcherCount(){return this.watchers.size}updateSecureContextOptions(e){this.latestContextOptions=e;for(let t of this.watchers)t(this.latestContextOptions)}_isSecure(){return this.serverConstructorOptions!==null}_getSecureContextOptions(){return this.latestContextOptions}_getConstructorOptions(){return this.serverConstructorOptions}_getInterceptors(){return[]}static createInsecure(){return new Xc}static createSsl(e,t,r=!1){var n;if(e!==null&&!Buffer.isBuffer(e))throw new TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(t))throw new TypeError("keyCertPairs must be an array");if(typeof r!="boolean")throw new TypeError("checkClientCertificate must be a boolean");let s=[],a=[];for(let o=0;o<t.length;o++){let l=t[o];if(l===null||typeof l!="object")throw new TypeError(`keyCertPair[${o}] must be an object`);if(!Buffer.isBuffer(l.private_key))throw new TypeError(`keyCertPair[${o}].private_key must be a Buffer`);if(!Buffer.isBuffer(l.cert_chain))throw new TypeError(`keyCertPair[${o}].cert_chain must be a Buffer`);s.push(l.cert_chain),a.push(l.private_key)}return new Jc({requestCert:r,ciphers:Kc.CIPHER_SUITES},{ca:(n=e??(0,Kc.getDefaultRootsData)())!==null&&n!==void 0?n:void 0,cert:s,key:a})}};vi.ServerCredentials=Lr;var Xc=class i extends Lr{constructor(){super(null)}_getSettings(){return null}_equals(e){return e instanceof i}},Jc=class i extends Lr{constructor(e,t){super(e,t),this.options=Object.assign(Object.assign({},e),t)}_equals(e){if(this===e)return!0;if(!(e instanceof i))return!1;if(Buffer.isBuffer(this.options.ca)&&Buffer.isBuffer(e.options.ca)){if(!this.options.ca.equals(e.options.ca))return!1}else if(this.options.ca!==e.options.ca)return!1;if(Array.isArray(this.options.cert)&&Array.isArray(e.options.cert)){if(this.options.cert.length!==e.options.cert.length)return!1;for(let t=0;t<this.options.cert.length;t++){let r=this.options.cert[t],n=e.options.cert[t];if(Buffer.isBuffer(r)&&Buffer.isBuffer(n)){if(!r.equals(n))return!1}else if(r!==n)return!1}}else if(this.options.cert!==e.options.cert)return!1;if(Array.isArray(this.options.key)&&Array.isArray(e.options.key)){if(this.options.key.length!==e.options.key.length)return!1;for(let t=0;t<this.options.key.length;t++){let r=this.options.key[t],n=e.options.key[t];if(Buffer.isBuffer(r)&&Buffer.isBuffer(n)){if(!r.equals(n))return!1}else if(r!==n)return!1}}else if(this.options.key!==e.options.key)return!1;return this.options.requestCert===e.options.requestCert}},Qc=class i extends Lr{constructor(e,t,r){super({requestCert:t!==null,rejectUnauthorized:r,ciphers:Kc.CIPHER_SUITES}),this.identityCertificateProvider=e,this.caCertificateProvider=t,this.requireClientCertificate=r,this.latestCaUpdate=null,this.latestIdentityUpdate=null,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this)}_addWatcher(e){var t;this.getWatcherCount()===0&&((t=this.caCertificateProvider)===null||t===void 0||t.addCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.addIdentityCertificateListener(this.identityCertificateUpdateListener)),super._addWatcher(e)}_removeWatcher(e){var t;super._removeWatcher(e),this.getWatcherCount()===0&&((t=this.caCertificateProvider)===null||t===void 0||t.removeCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_equals(e){return this===e?!0:e instanceof i?this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&this.requireClientCertificate===e.requireClientCertificate:!1}calculateSecureContextOptions(){var e;return this.latestIdentityUpdate===null||this.caCertificateProvider!==null&&this.latestCaUpdate===null?null:{ca:(e=this.latestCaUpdate)===null||e===void 0?void 0:e.caCertificate,cert:[this.latestIdentityUpdate.certificate],key:[this.latestIdentityUpdate.privateKey]}}finalizeUpdate(){let e=this.calculateSecureContextOptions();this.updateSecureContextOptions(e)}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.finalizeUpdate()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.finalizeUpdate()}};function lT(i,e,t){return new Qc(i,e,t)}var Zc=class i extends Lr{constructor(e,t){super({}),this.childCredentials=e,this.interceptors=t}_isSecure(){return this.childCredentials._isSecure()}_equals(e){if(!(e instanceof i)||!this.childCredentials._equals(e.childCredentials)||this.interceptors.length!==e.interceptors.length)return!1;for(let t=0;t<this.interceptors.length;t++)if(this.interceptors[t]!==e.interceptors[t])return!1;return!0}_getInterceptors(){return this.interceptors}_addWatcher(e){this.childCredentials._addWatcher(e)}_removeWatcher(e){this.childCredentials._removeWatcher(e)}_getConstructorOptions(){return this.childCredentials._getConstructorOptions()}_getSecureContextOptions(){return this.childCredentials._getSecureContextOptions()}};function cT(i,e){return new Zc(i,e)}});var bn=g(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.durationMessageToDuration=uT;Gt.msToDuration=dT;Gt.durationToMs=hT;Gt.isDuration=fT;Gt.isDurationMessage=pT;Gt.parseDuration=mT;Gt.durationToString=vT;function uT(i){return{seconds:Number.parseInt(i.seconds),nanos:i.nanos}}function dT(i){return{seconds:i/1e3|0,nanos:i%1e3*1e6|0}}function hT(i){return i.seconds*1e3+i.nanos/1e6|0}function fT(i){return typeof i.seconds=="number"&&typeof i.nanos=="number"}function pT(i){return typeof i.seconds=="string"&&typeof i.nanos=="number"}var gT=/^(\d+)(?:\.(\d+))?s$/;function mT(i){let e=i.match(gT);return e?{seconds:Number.parseInt(e[1],10),nanos:e[2]?Number.parseInt(e[2].padEnd(9,"0"),10):0}:null}function vT(i){if(i.nanos===0)return`${i.seconds}s`;let e;return i.nanos%1e6===0?e=1e6:i.nanos%1e3===0?e=1e3:e=1,`${i.seconds}.${i.nanos/e}s`}});var ya=g(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.OrcaOobMetricsSubchannelWrapper=We.GRPC_METRICS_HEADER=We.ServerMetricRecorder=We.PerRequestMetricRecorder=void 0;We.createOrcaClient=Ng;We.createMetricsReader=bT;var yT=ls(),eu=bn(),_T=Wr(),ET=En(),wg=B(),ST=Gr(),CT=Pe(),Og=null;function va(){if(Og)return Og;let i=jl().loadSync,e=i("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,yT.loadPackageDefinition)(e)}var tu=class{constructor(){this.message={}}recordRequestCostMetric(e,t){this.message.request_cost||(this.message.request_cost={}),this.message.request_cost[e]=t}recordUtilizationMetric(e,t){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=t}recordNamedMetric(e,t){this.message.named_metrics||(this.message.named_metrics={}),this.message.named_metrics[e]=t}recordCPUUtilizationMetric(e){this.message.cpu_utilization=e}recordMemoryUtilizationMetric(e){this.message.mem_utilization=e}recordApplicationUtilizationMetric(e){this.message.application_utilization=e}recordQpsMetric(e){this.message.rps_fractional=e}recordEpsMetric(e){this.message.eps=e}serialize(){return va().xds.data.orca.v3.OrcaLoadReport.serialize(this.message)}};We.PerRequestMetricRecorder=tu;var TT=3e4,ru=class{constructor(){this.message={},this.serviceImplementation={StreamCoreMetrics:e=>{let t=e.request.report_interval?(0,eu.durationToMs)((0,eu.durationMessageToDuration)(e.request.report_interval)):TT,r=setInterval(()=>{e.write(this.message)},t);e.on("cancelled",()=>{clearInterval(r)})}}}putUtilizationMetric(e,t){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=t}setAllUtilizationMetrics(e){this.message.utilization=Object.assign({},e)}deleteUtilizationMetric(e){var t;(t=this.message.utilization)===null||t===void 0||delete t[e]}setCpuUtilizationMetric(e){this.message.cpu_utilization=e}deleteCpuUtilizationMetric(){delete this.message.cpu_utilization}setApplicationUtilizationMetric(e){this.message.application_utilization=e}deleteApplicationUtilizationMetric(){delete this.message.application_utilization}setQpsMetric(e){this.message.rps_fractional=e}deleteQpsMetric(){delete this.message.rps_fractional}setEpsMetric(e){this.message.eps=e}deleteEpsMetric(){delete this.message.eps}addToServer(e){let t=va().xds.service.orca.v3.OpenRcaService.service;e.addService(t,this.serviceImplementation)}};We.ServerMetricRecorder=ru;function Ng(i){let e=va().xds.service.orca.v3.OpenRcaService;return new e("unused",_T.ChannelCredentials.createInsecure(),{channelOverride:i})}We.GRPC_METRICS_HEADER="endpoint-load-metrics-bin";var Ag="grpc_orca_load_report";function bT(i,e){return(t,r,n)=>{let s=n.getOpaque(Ag);if(s)i(s);else{let a=n.get(We.GRPC_METRICS_HEADER);a.length>0&&(s=va().xds.data.orca.v3.OrcaLoadReport.deserialize(a[0]),i(s),n.setOpaque(Ag,s))}e&&e(t,r,n)}}var Pg="orca_oob_metrics",iu=class{constructor(e,t){this.metricsListener=e,this.intervalMs=t,this.dataProducer=null}setSubchannel(e){let t=e.getOrCreateDataProducer(Pg,RT);this.dataProducer=t,t.addDataWatcher(this)}destroy(){var e;(e=this.dataProducer)===null||e===void 0||e.removeDataWatcher(this)}getInterval(){return this.intervalMs}onMetricsUpdate(e){this.metricsListener(e)}},nu=class{constructor(e){this.subchannel=e,this.dataWatchers=new Set,this.orcaSupported=!0,this.metricsCall=null,this.currentInterval=1/0,this.backoffTimer=new ST.BackoffTimeout(()=>this.updateMetricsSubscription()),this.subchannelStateListener=()=>this.updateMetricsSubscription();let t=e.getChannel();this.client=Ng(t),e.addConnectivityStateListener(this.subchannelStateListener)}addDataWatcher(e){this.dataWatchers.add(e),this.updateMetricsSubscription()}removeDataWatcher(e){var t;this.dataWatchers.delete(e),this.dataWatchers.size===0?(this.subchannel.removeDataProducer(Pg),(t=this.metricsCall)===null||t===void 0||t.cancel(),this.metricsCall=null,this.client.close(),this.subchannel.removeConnectivityStateListener(this.subchannelStateListener)):this.updateMetricsSubscription()}updateMetricsSubscription(){var e;if(this.dataWatchers.size===0||!this.orcaSupported||this.subchannel.getConnectivityState()!==CT.ConnectivityState.READY)return;let t=Math.min(...Array.from(this.dataWatchers).map(r=>r.getInterval()));if(!this.metricsCall||t!==this.currentInterval){(e=this.metricsCall)===null||e===void 0||e.cancel(),this.currentInterval=t;let r=this.client.streamCoreMetrics({report_interval:(0,eu.msToDuration)(t)});this.metricsCall=r,r.on("data",n=>{this.dataWatchers.forEach(s=>{s.onMetricsUpdate(n)})}),r.on("error",n=>{if(this.metricsCall=null,n.code===wg.Status.UNIMPLEMENTED){this.orcaSupported=!1;return}n.code!==wg.Status.CANCELLED&&this.backoffTimer.runOnce()})}}},su=class extends ET.BaseSubchannelWrapper{constructor(e,t,r){super(e),this.addDataWatcher(new iu(t,r))}getWrappedSubchannel(){return this.child}};We.OrcaOobMetricsSubchannelWrapper=su;function RT(i){return new nu(i)}});var fu=g(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.BaseServerInterceptingCall=Qe.ServerInterceptingCall=Qe.ResponderBuilder=Qe.ServerListenerBuilder=void 0;Qe.isInterceptingServerListener=AT;Qe.getServerInterceptingCall=kT;var Sa=pe(),Me=B(),yi=z("http2"),Ig=zn(),Mg=z("zlib"),wT=Ec(),Fg=ee(),OT=z("tls"),kg=ya(),au=ta(),qg="server_call";function Fr(i){Fg.trace(Me.LogVerbosity.DEBUG,qg,i)}var lu=class{constructor(){this.metadata=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveHalfClose(e){return this.halfClose=e,this}withOnCancel(e){return this.cancel=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveHalfClose:this.halfClose,onCancel:this.cancel}}};Qe.ServerListenerBuilder=lu;function AT(i){return i.onReceiveMetadata!==void 0&&i.onReceiveMetadata.length===1}var cu=class{constructor(e,t){this.listener=e,this.nextListener=t,this.cancelled=!1,this.processingMetadata=!1,this.hasPendingMessage=!1,this.pendingMessage=null,this.processingMessage=!1,this.hasPendingHalfClose=!1}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingHalfClose(){this.hasPendingHalfClose&&(this.nextListener.onReceiveHalfClose(),this.hasPendingHalfClose=!1)}onReceiveMetadata(e){this.cancelled||(this.processingMetadata=!0,this.listener.onReceiveMetadata(e,t=>{this.processingMetadata=!1,!this.cancelled&&(this.nextListener.onReceiveMetadata(t),this.processPendingMessage(),this.processPendingHalfClose())}))}onReceiveMessage(e){this.cancelled||(this.processingMessage=!0,this.listener.onReceiveMessage(e,t=>{this.processingMessage=!1,!this.cancelled&&(this.processingMetadata?(this.pendingMessage=t,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(t),this.processPendingHalfClose()))}))}onReceiveHalfClose(){this.cancelled||this.listener.onReceiveHalfClose(()=>{this.cancelled||(this.processingMetadata||this.processingMessage?this.hasPendingHalfClose=!0:this.nextListener.onReceiveHalfClose())})}onCancel(){this.cancelled=!0,this.listener.onCancel(),this.nextListener.onCancel()}},uu=class{constructor(){this.start=void 0,this.metadata=void 0,this.message=void 0,this.status=void 0}withStart(e){return this.start=e,this}withSendMetadata(e){return this.metadata=e,this}withSendMessage(e){return this.message=e,this}withSendStatus(e){return this.status=e,this}build(){return{start:this.start,sendMetadata:this.metadata,sendMessage:this.message,sendStatus:this.status}}};Qe.ResponderBuilder=uu;var _a={onReceiveMetadata:(i,e)=>{e(i)},onReceiveMessage:(i,e)=>{e(i)},onReceiveHalfClose:i=>{i()},onCancel:()=>{}},Ea={start:i=>{i()},sendMetadata:(i,e)=>{e(i)},sendMessage:(i,e)=>{e(i)},sendStatus:(i,e)=>{e(i)}},du=class{constructor(e,t){var r,n,s,a;this.nextCall=e,this.processingMetadata=!1,this.sentMetadata=!1,this.processingMessage=!1,this.pendingMessage=null,this.pendingMessageCallback=null,this.pendingStatus=null,this.responder={start:(r=t?.start)!==null&&r!==void 0?r:Ea.start,sendMetadata:(n=t?.sendMetadata)!==null&&n!==void 0?n:Ea.sendMetadata,sendMessage:(s=t?.sendMessage)!==null&&s!==void 0?s:Ea.sendMessage,sendStatus:(a=t?.sendStatus)!==null&&a!==void 0?a:Ea.sendStatus}}processPendingMessage(){this.pendingMessageCallback&&(this.nextCall.sendMessage(this.pendingMessage,this.pendingMessageCallback),this.pendingMessage=null,this.pendingMessageCallback=null)}processPendingStatus(){this.pendingStatus&&(this.nextCall.sendStatus(this.pendingStatus),this.pendingStatus=null)}start(e){this.responder.start(t=>{var r,n,s,a;let o={onReceiveMetadata:(r=t?.onReceiveMetadata)!==null&&r!==void 0?r:_a.onReceiveMetadata,onReceiveMessage:(n=t?.onReceiveMessage)!==null&&n!==void 0?n:_a.onReceiveMessage,onReceiveHalfClose:(s=t?.onReceiveHalfClose)!==null&&s!==void 0?s:_a.onReceiveHalfClose,onCancel:(a=t?.onCancel)!==null&&a!==void 0?a:_a.onCancel},l=new cu(o,e);this.nextCall.start(l)})}sendMetadata(e){this.processingMetadata=!0,this.sentMetadata=!0,this.responder.sendMetadata(e,t=>{this.processingMetadata=!1,this.nextCall.sendMetadata(t),this.processPendingMessage(),this.processPendingStatus()})}sendMessage(e,t){this.processingMessage=!0,this.sentMetadata||this.sendMetadata(new Sa.Metadata),this.responder.sendMessage(e,r=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=r,this.pendingMessageCallback=t):this.nextCall.sendMessage(r,t)})}sendStatus(e){this.responder.sendStatus(e,t=>{this.processingMetadata||this.processingMessage?this.pendingStatus=t:this.nextCall.sendStatus(t)})}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()}};Qe.ServerInterceptingCall=du;var Ug="grpc-accept-encoding",hu="grpc-encoding",xg="grpc-message",Dg="grpc-status",ou="grpc-timeout",NT=/(\d{1,8})\s*([HMSmun])/,PT={H:36e5,M:6e4,S:1e3,m:1,u:.001,n:1e-6},IT={[Ug]:"identity,deflate,gzip",[hu]:"identity"},Lg={[yi.constants.HTTP2_HEADER_STATUS]:yi.constants.HTTP_STATUS_OK,[yi.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},MT={waitForTrailers:!0},Ca=class{constructor(e,t,r,n,s){var a,o;this.stream=e,this.callEventTracker=r,this.handler=n,this.listener=null,this.deadlineTimer=null,this.deadline=1/0,this.maxSendMessageSize=Me.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=Me.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 kg.PerRequestMetricRecorder,this.stream.once("close",()=>{var f;Fr("Request to method "+((f=this.handler)===null||f===void 0?void 0:f.path)+" stream closed with rstCode "+this.stream.rstCode),this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!1),this.callEventTracker.onCallEnd({code:Me.Status.CANCELLED,details:"Stream closed before sending status",metadata:null})),this.notifyOnCancel()}),this.stream.on("data",f=>{this.handleDataFrame(f)}),this.stream.pause(),this.stream.on("end",()=>{this.handleEndEvent()}),"grpc.max_send_message_length"in s&&(this.maxSendMessageSize=s["grpc.max_send_message_length"]),"grpc.max_receive_message_length"in s&&(this.maxReceiveMessageSize=s["grpc.max_receive_message_length"]),this.host=(a=t[":authority"])!==null&&a!==void 0?a:t.host,this.decoder=new wT.StreamDecoder(this.maxReceiveMessageSize);let l=Sa.Metadata.fromHttp2Headers(t);Fg.isTracerEnabled(qg)&&Fr("Request to "+this.handler.path+" received headers "+JSON.stringify(l.toJSON()));let c=l.get(ou);c.length>0&&this.handleTimeoutHeader(c[0]);let u=l.get(hu);u.length>0&&(this.incomingEncoding=u[0]),l.remove(ou),l.remove(hu),l.remove(Ug),l.remove(yi.constants.HTTP2_HEADER_ACCEPT_ENCODING),l.remove(yi.constants.HTTP2_HEADER_TE),l.remove(yi.constants.HTTP2_HEADER_CONTENT_TYPE),this.metadata=l;let h=(o=e.session)===null||o===void 0?void 0:o.socket;this.connectionInfo={localAddress:h?.localAddress,localPort:h?.localPort,remoteAddress:h?.remoteAddress,remotePort:h?.remotePort},this.shouldSendMetrics=!!s["grpc.server_call_metric_recording"]}handleTimeoutHeader(e){let t=e.toString().match(NT);if(t===null){let n={code:Me.Status.INTERNAL,details:`Invalid ${ou} value "${e}"`,metadata:null};process.nextTick(()=>{this.sendStatus(n)});return}let r=+t[1]*PT[t[2]]|0;this.deadline=Date.now()+r,this.deadlineTimer=setTimeout(()=>{let n={code:Me.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(n)},r)}checkCancelled(){return!this.cancelled&&(this.stream.destroyed||this.stream.closed)&&(this.notifyOnCancel(),this.cancelled=!0),this.cancelled}notifyOnCancel(){this.cancelNotified||(this.cancelNotified=!0,this.cancelled=!0,process.nextTick(()=>{var e;(e=this.listener)===null||e===void 0||e.onCancel()}),this.deadlineTimer&&clearTimeout(this.deadlineTimer),this.stream.resume())}maybeSendMetadata(){this.metadataSent||this.sendMetadata(new Sa.Metadata)}serializeMessage(e){let t=this.handler.serialize(e),r=t.byteLength,n=Buffer.allocUnsafe(r+5);return n.writeUInt8(0,0),n.writeUInt32BE(r,1),t.copy(n,5),n}decompressMessage(e,t){let r=e.subarray(5);if(t==="identity")return r;if(t==="deflate"||t==="gzip"){let n;return t==="deflate"?n=Mg.createInflate():n=Mg.createGunzip(),new Promise((s,a)=>{let o=0,l=[];n.on("error",c=>{a({code:Me.Status.INTERNAL,details:"Failed to decompress message"})}),n.on("data",c=>{l.push(c),o+=c.byteLength,this.maxReceiveMessageSize!==-1&&o>this.maxReceiveMessageSize&&(n.destroy(),a({code:Me.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`}))}),n.on("end",()=>{s(Buffer.concat(l))}),n.write(r),n.end()})}else return Promise.reject({code:Me.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${t}"`})}async decompressAndMaybePush(e){if(e.type!=="COMPRESSED")throw new Error(`Invalid queue entry type: ${e.type}`);let r=e.compressedMessage.readUInt8(0)===1?this.incomingEncoding:"identity",n;try{n=await this.decompressMessage(e.compressedMessage,r)}catch(s){this.sendStatus(s);return}try{e.parsedMessage=this.handler.deserialize(n)}catch(s){let a;au.GRPC_NODE_DEBUG_SEND_ERROR_DETAILS?a=`Error deserializing request: ${s.message}`:a="Error deserializing request",this.sendStatus({code:Me.Status.INTERNAL,details:a});return}e.type="READABLE",this.maybePushNextMessage()}maybePushNextMessage(){if(this.listener&&this.isReadPending&&this.readQueue.length>0&&this.readQueue[0].type!=="COMPRESSED"){this.isReadPending=!1;let e=this.readQueue.shift();e.type==="READABLE"?this.listener.onReceiveMessage(e.parsedMessage):this.listener.onReceiveHalfClose()}}handleDataFrame(e){var t;if(this.checkCancelled())return;Fr("Request to "+this.handler.path+" received data frame of size "+e.length);let r;try{r=this.decoder.write(e)}catch(n){this.sendStatus({code:Me.Status.RESOURCE_EXHAUSTED,details:n.message});return}for(let n of r){this.stream.pause();let s={type:"COMPRESSED",compressedMessage:n,parsedMessage:null};this.readQueue.push(s),this.decompressAndMaybePush(s),(t=this.callEventTracker)===null||t===void 0||t.addMessageReceived()}}handleEndEvent(){this.readQueue.push({type:"HALF_CLOSE",compressedMessage:null,parsedMessage:null}),this.receivedHalfClose=!0,this.maybePushNextMessage()}start(e){Fr("Request to "+this.handler.path+" start called"),!this.checkCancelled()&&(this.listener=e,e.onReceiveMetadata(this.metadata))}sendMetadata(e){if(this.checkCancelled()||this.metadataSent)return;this.metadataSent=!0;let t=e?e.toHttp2Headers():null,r=Object.assign(Object.assign(Object.assign({},Lg),IT),t);this.stream.respond(r,MT)}sendMessage(e,t){if(this.checkCancelled())return;let r;try{r=this.serializeMessage(e)}catch(n){let s;au.GRPC_NODE_DEBUG_SEND_ERROR_DETAILS?s=`Error serializing response: ${(0,Ig.getErrorMessage)(n)}`:s="Error serializing response",this.sendStatus({code:Me.Status.INTERNAL,details:s,metadata:null});return}if(this.maxSendMessageSize!==-1&&r.length-5>this.maxSendMessageSize){this.sendStatus({code:Me.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${r.length} vs. ${this.maxSendMessageSize})`,metadata:null});return}this.maybeSendMetadata(),Fr("Request to "+this.handler.path+" sent data frame of size "+r.length),this.stream.write(r,n=>{var s;if(n){let a;au.GRPC_NODE_DEBUG_SEND_ERROR_DETAILS?a=`Error writing message: ${(0,Ig.getErrorMessage)(n)}`:a="Internal server error",this.sendStatus({code:Me.Status.INTERNAL,details:a,metadata:null});return}(s=this.callEventTracker)===null||s===void 0||s.addMessageSent(),t()})}sendStatus(e){var t,r,n;if(this.checkCancelled())return;Fr("Request to method "+((t=this.handler)===null||t===void 0?void 0:t.path)+" ended with status code: "+Me.Status[e.code]+" details: "+e.details);let s=(n=(r=e.metadata)===null||r===void 0?void 0:r.clone())!==null&&n!==void 0?n:new Sa.Metadata;if(this.shouldSendMetrics&&s.set(kg.GRPC_METRICS_HEADER,this.metricsRecorder.serialize()),this.metadataSent)this.wantTrailers?this.notifyOnCancel():(this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));let a=Object.assign({[Dg]:e.code,[xg]:encodeURI(e.details)},s.toHttp2Headers());this.stream.sendTrailers(a),this.notifyOnCancel()}),this.stream.end());else{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));let a=Object.assign(Object.assign({[Dg]:e.code,[xg]:encodeURI(e.details)},Lg),s.toHttp2Headers());this.stream.respond(a,{endStream:!0}),this.notifyOnCancel()}}startRead(){Fr("Request to "+this.handler.path+" startRead called"),!this.checkCancelled()&&(this.isReadPending=!0,this.readQueue.length===0?this.receivedHalfClose||this.stream.resume():this.maybePushNextMessage())}getPeer(){var e;let t=(e=this.stream.session)===null||e===void 0?void 0:e.socket;return t?.remoteAddress?t.remotePort?`${t.remoteAddress}:${t.remotePort}`:t.remoteAddress:"unknown"}getDeadline(){return this.deadline}getHost(){return this.host}getAuthContext(){var e;if(!(((e=this.stream.session)===null||e===void 0?void 0:e.socket)instanceof OT.TLSSocket))return{};if(!this.stream.session.socket.authorized)return{};let t=this.stream.session.socket.getPeerCertificate();return{transportSecurityType:"ssl",sslPeerCertificate:t.raw?t:void 0}}getConnectionInfo(){return this.connectionInfo}getMetricsRecorder(){return this.metricsRecorder}};Qe.BaseServerInterceptingCall=Ca;function kT(i,e,t,r,n,s){let a={path:n.path,requestStream:n.type==="clientStream"||n.type==="bidi",responseStream:n.type==="serverStream"||n.type==="bidi",requestDeserialize:n.deserialize,responseSerialize:n.serialize},o=new Ca(e,t,r,n,s);return i.reduce((l,c)=>c(a,l),o)}});var $g=g(hr=>{"use strict";var xT=hr&&hr.__runInitializers||function(i,e,t){for(var r=arguments.length>2,n=0;n<e.length;n++)t=r?e[n].call(i,t):e[n].call(i);return r?t:void 0},DT=hr&&hr.__esDecorate||function(i,e,t,r,n,s){function a(O){if(O!==void 0&&typeof O!="function")throw new TypeError("Function expected");return O}for(var o=r.kind,l=o==="getter"?"get":o==="setter"?"set":"value",c=!e&&i?r.static?i:i.prototype:null,u=e||(c?Object.getOwnPropertyDescriptor(c,r.name):{}),h,f=!1,_=t.length-1;_>=0;_--){var p={};for(var v in r)p[v]=v==="access"?{}:r[v];for(var v in r.access)p.access[v]=r.access[v];p.addInitializer=function(O){if(f)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(O||null))};var R=(0,t[_])(o==="accessor"?{get:u.get,set:u.set}:u[l],p);if(o==="accessor"){if(R===void 0)continue;if(R===null||typeof R!="object")throw new TypeError("Object expected");(h=a(R.get))&&(u.get=h),(h=a(R.set))&&(u.set=h),(h=a(R.init))&&n.unshift(h)}else(h=a(R))&&(o==="field"?n.unshift(h):u[l]=h)}c&&Object.defineProperty(c,r.name,u),f=!0};Object.defineProperty(hr,"__esModule",{value:!0});hr.Server=void 0;var qe=z("http2"),LT=z("util"),oe=B(),Si=Rg(),pu=ma(),Bg=et(),Ei=ee(),dr=De(),pt=ke(),he=sr(),zg=fu(),Ta=ta(),_i=~(1<<31),gu=~(1<<31),FT=2e4,Hg=~(1<<31),{HTTP2_HEADER_PATH:jg}=qe.constants,qT="server",Wg=Buffer.from("max_age");function Gg(i){Ei.trace(oe.LogVerbosity.DEBUG,"server_call",i)}function UT(){}function BT(i){return function(e,t){return LT.deprecate(e,i)}}function mu(i){return{code:oe.Status.UNIMPLEMENTED,details:`The server does not implement the method ${i}`}}function zT(i,e){let t=mu(e);switch(i){case"unary":return(r,n)=>{n(t,null)};case"clientStream":return(r,n)=>{n(t,null)};case"serverStream":return r=>{r.emit("error",t)};case"bidi":return r=>{r.emit("error",t)};default:throw new Error(`Invalid handlerType ${i}`)}}var HT=(()=>{var i;let e=[],t;return i=class{constructor(n){var s,a,o,l,c,u;this.boundPorts=(xT(this,e),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=n??{},this.options["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.channelzTrace=new he.ChannelzTraceStub,this.callTracker=new he.ChannelzCallTrackerStub,this.listenerChildrenTracker=new he.ChannelzChildrenTrackerStub,this.sessionChildrenTracker=new he.ChannelzChildrenTrackerStub):(this.channelzTrace=new he.ChannelzTrace,this.callTracker=new he.ChannelzCallTracker,this.listenerChildrenTracker=new he.ChannelzChildrenTracker,this.sessionChildrenTracker=new he.ChannelzChildrenTracker),this.channelzRef=(0,he.registerChannelzServer)("server",()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=(s=this.options["grpc.max_connection_age_ms"])!==null&&s!==void 0?s:_i,this.maxConnectionAgeGraceMs=(a=this.options["grpc.max_connection_age_grace_ms"])!==null&&a!==void 0?a:_i,this.keepaliveTimeMs=(o=this.options["grpc.keepalive_time_ms"])!==null&&o!==void 0?o:gu,this.keepaliveTimeoutMs=(l=this.options["grpc.keepalive_timeout_ms"])!==null&&l!==void 0?l:FT,this.sessionIdleTimeout=(c=this.options["grpc.max_connection_idle_ms"])!==null&&c!==void 0?c:Hg,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"]:this.commonServerOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER,"grpc.max_concurrent_streams"in this.options&&(this.commonServerOptions.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]}),this.interceptors=(u=this.options.interceptors)!==null&&u!==void 0?u:[],this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfo(n){var s,a,o;let l=this.sessions.get(n),c=n.socket,u=c.remoteAddress?(0,dr.stringToSubchannelAddress)(c.remoteAddress,c.remotePort):null,h=c.localAddress?(0,dr.stringToSubchannelAddress)(c.localAddress,c.localPort):null,f;if(n.encrypted){let p=c,v=p.getCipher(),R=p.getCertificate(),O=p.getPeerCertificate();f={cipherSuiteStandardName:(s=v.standardName)!==null&&s!==void 0?s:null,cipherSuiteOtherName:v.standardName?null:v.name,localCertificate:R&&"raw"in R?R.raw:null,remoteCertificate:O&&"raw"in O?O.raw:null}}else f=null;return{remoteAddress:u,localAddress:h,security:f,remoteName:null,streamsStarted:l.streamTracker.callsStarted,streamsSucceeded:l.streamTracker.callsSucceeded,streamsFailed:l.streamTracker.callsFailed,messagesSent:l.messagesSent,messagesReceived:l.messagesReceived,keepAlivesSent:l.keepAlivesSent,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:l.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:l.lastMessageSentTimestamp,lastMessageReceivedTimestamp:l.lastMessageReceivedTimestamp,localFlowControlWindow:(a=n.state.localWindowSize)!==null&&a!==void 0?a:null,remoteFlowControlWindow:(o=n.state.remoteWindowSize)!==null&&o!==void 0?o:null}}trace(n){Ei.trace(oe.LogVerbosity.DEBUG,qT,"("+this.channelzRef.id+") "+n)}keepaliveTrace(n){Ei.trace(oe.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+n)}addProtoService(){throw new Error("Not implemented. Use addService() instead")}addService(n,s){if(n===null||typeof n!="object"||s===null||typeof s!="object")throw new Error("addService() requires two objects as arguments");let a=Object.keys(n);if(a.length===0)throw new Error("Cannot add an empty service to a server");a.forEach(o=>{let l=n[o],c;l.requestStream?l.responseStream?c="bidi":c="clientStream":l.responseStream?c="serverStream":c="unary";let u=s[o],h;if(u===void 0&&typeof l.originalName=="string"&&(u=s[l.originalName]),u!==void 0?h=u.bind(s):h=zT(c,o),this.register(l.path,h,l.responseSerialize,l.requestDeserialize,c)===!1)throw new Error(`Method handler for ${l.path} already provided.`)})}removeService(n){if(n===null||typeof n!="object")throw new Error("removeService() requires object as argument");Object.keys(n).forEach(a=>{let o=n[a];this.unregister(o.path)})}bind(n,s){throw new Error("Not implemented. Use bindAsync() instead")}experimentalRegisterListenerToChannelz(n){return(0,he.registerChannelzSocket)((0,dr.subchannelAddressToString)(n),()=>({localAddress:n,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(n){(0,he.unregisterChannelzRef)(n)}createHttp2Server(n){let s;if(n._isSecure()){let a=n._getConstructorOptions(),o=n._getSecureContextOptions(),l=Object.assign(Object.assign(Object.assign(Object.assign({},this.commonServerOptions),a),o),{enableTrace:this.options["grpc-node.tls_enable_trace"]===1}),c=o!==null;this.trace("Initial credentials valid: "+c),s=qe.createSecureServer(l),s.prependListener("connection",h=>{c||(this.trace("Dropped connection from "+JSON.stringify(h.address())+" due to unloaded credentials"),h.destroy())}),s.on("secureConnection",h=>{h.on("error",f=>{this.trace("An incoming TLS connection closed with error: "+f.message)})});let u=h=>{if(h){let f=s;try{f.setSecureContext(h)}catch(_){Ei.log(oe.LogVerbosity.ERROR,"Failed to set secure context with error "+_.message),h=null}}c=h!==null,this.trace("Post-update credentials valid: "+c)};n._addWatcher(u),s.on("close",()=>{n._removeWatcher(u)})}else s=qe.createServer(this.commonServerOptions);return s.setTimeout(0,UT),this._setupHandlers(s,n._getInterceptors()),s}bindOneAddress(n,s){this.trace("Attempting to bind "+(0,dr.subchannelAddressToString)(n));let a=this.createHttp2Server(s.credentials);return new Promise((o,l)=>{let c=u=>{this.trace("Failed to bind "+(0,dr.subchannelAddressToString)(n)+" with error "+u.message),o({port:"port"in n?n.port:1,error:u.message})};a.once("error",c),a.listen(n,()=>{let u=a.address(),h;typeof u=="string"?h={path:u}:h={host:u.address,port:u.port};let f=this.experimentalRegisterListenerToChannelz(h);this.listenerChildrenTracker.refChild(f),this.http2Servers.set(a,{channelzRef:f,sessions:new Set,ownsChannelzRef:!0}),s.listeningServers.add(a),this.trace("Successfully bound "+(0,dr.subchannelAddressToString)(h)),o({port:"port"in h?h.port:1}),a.removeListener("error",c)})})}async bindManyPorts(n,s){if(n.length===0)return{count:0,port:0,errors:[]};if((0,dr.isTcpSubchannelAddress)(n[0])&&n[0].port===0){let a=await this.bindOneAddress(n[0],s);if(a.error){let o=await this.bindManyPorts(n.slice(1),s);return Object.assign(Object.assign({},o),{errors:[a.error,...o.errors]})}else{let o=n.slice(1).map(u=>(0,dr.isTcpSubchannelAddress)(u)?{host:u.host,port:a.port}:u),l=await Promise.all(o.map(u=>this.bindOneAddress(u,s))),c=[a,...l];return{count:c.filter(u=>u.error===void 0).length,port:a.port,errors:c.filter(u=>u.error).map(u=>u.error)}}}else{let a=await Promise.all(n.map(o=>this.bindOneAddress(o,s)));return{count:a.filter(o=>o.error===void 0).length,port:a[0].port,errors:a.filter(o=>o.error).map(o=>o.error)}}}async bindAddressList(n,s){let a=await this.bindManyPorts(n,s);if(a.count>0)return a.count<n.length&&Ei.log(oe.LogVerbosity.INFO,`WARNING Only ${a.count} addresses added out of total ${n.length} resolved`),a.port;{let o=`No address added out of total ${n.length} resolved`;throw Ei.log(oe.LogVerbosity.ERROR,o),new Error(`${o} errors: [${a.errors.join(",")}]`)}}resolvePort(n){return new Promise((s,a)=>{let o=!1,l=(u,h,f,_)=>{if(o)return!0;if(o=!0,!u.ok)return a(new Error(u.error.details)),!0;let p=[].concat(...u.value.map(v=>v.addresses));return p.length===0?(a(new Error(`No addresses resolved for port ${n}`)),!0):(s(p),!0)};(0,Bg.createResolver)(n,l,this.options).updateResolution()})}async bindPort(n,s){let a=await this.resolvePort(n);if(s.cancelled)throw this.completeUnbind(s),new Error("bindAsync operation cancelled by unbind call");let o=await this.bindAddressList(a,s);if(s.cancelled)throw this.completeUnbind(s),new Error("bindAsync operation cancelled by unbind call");return o}normalizePort(n){let s=(0,pt.parseUri)(n);if(s===null)throw new Error(`Could not parse port "${n}"`);let a=(0,Bg.mapUriDefaultScheme)(s);if(a===null)throw new Error(`Could not get a default scheme for port "${n}"`);return a}bindAsync(n,s,a){if(this.shutdown)throw new Error("bindAsync called after shutdown");if(typeof n!="string")throw new TypeError("port must be a string");if(s===null||!(s instanceof pu.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");if(typeof a!="function")throw new TypeError("callback must be a function");this.trace("bindAsync port="+n);let o=this.normalizePort(n),l=(f,_)=>{process.nextTick(()=>a(f,_))},c=this.boundPorts.get((0,pt.uriToString)(o));if(c){if(!s._equals(c.credentials)){l(new Error(`${n} already bound with incompatible credentials`),0);return}c.cancelled=!1,c.completionPromise?c.completionPromise.then(f=>a(null,f),f=>a(f,0)):l(null,c.portNumber);return}c={mapKey:(0,pt.uriToString)(o),originalUri:o,completionPromise:null,cancelled:!1,portNumber:0,credentials:s,listeningServers:new Set};let u=(0,pt.splitHostPort)(o.path),h=this.bindPort(o,c);c.completionPromise=h,u?.port===0?h.then(f=>{let _={scheme:o.scheme,authority:o.authority,path:(0,pt.combineHostPort)({host:u.host,port:f})};c.mapKey=(0,pt.uriToString)(_),c.completionPromise=null,c.portNumber=f,this.boundPorts.set(c.mapKey,c),a(null,f)},f=>{a(f,0)}):(this.boundPorts.set(c.mapKey,c),h.then(f=>{c.completionPromise=null,c.portNumber=f,a(null,f)},f=>{a(f,0)}))}registerInjectorToChannelz(){return(0,he.registerChannelzSocket)("injector",()=>({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(n,s,a=!1){if(n===null||!(n instanceof pu.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");this.channelzEnabled&&this.listenerChildrenTracker.refChild(s);let o=this.createHttp2Server(n),l=new Set;return this.http2Servers.set(o,{channelzRef:s,sessions:l,ownsChannelzRef:a}),{injectConnection:c=>{o.emit("connection",c)},drain:c=>{var u,h;for(let f of l)this.closeSession(f);(h=(u=setTimeout(()=>{for(let f of l)f.destroy(qe.constants.NGHTTP2_CANCEL)},c)).unref)===null||h===void 0||h.call(u)},destroy:()=>{this.closeServer(o);for(let c of l)this.closeSession(c)}}}createConnectionInjector(n){if(n===null||!(n instanceof pu.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");let s=this.registerInjectorToChannelz();return this.experimentalCreateConnectionInjectorWithChannelzRef(n,s,!0)}closeServer(n,s){this.trace("Closing server with address "+JSON.stringify(n.address()));let a=this.http2Servers.get(n);n.close(()=>{a&&a.ownsChannelzRef&&(this.listenerChildrenTracker.unrefChild(a.channelzRef),(0,he.unregisterChannelzRef)(a.channelzRef)),this.http2Servers.delete(n),s?.()})}closeSession(n,s){var a;this.trace("Closing session initiated by "+((a=n.socket)===null||a===void 0?void 0:a.remoteAddress));let o=this.sessions.get(n),l=()=>{o&&(this.sessionChildrenTracker.unrefChild(o.ref),(0,he.unregisterChannelzRef)(o.ref)),s?.()};n.closed?queueMicrotask(l):n.close(l)}completeUnbind(n){for(let s of n.listeningServers){let a=this.http2Servers.get(s);if(this.closeServer(s,()=>{n.listeningServers.delete(s)}),a)for(let o of a.sessions)this.closeSession(o)}this.boundPorts.delete(n.mapKey)}unbind(n){this.trace("unbind port="+n);let s=this.normalizePort(n),a=(0,pt.splitHostPort)(s.path);if(a?.port===0)throw new Error("Cannot unbind port 0");let o=this.boundPorts.get((0,pt.uriToString)(s));o&&(this.trace("unbinding "+o.mapKey+" originally bound as "+(0,pt.uriToString)(o.originalUri)),o.completionPromise?o.cancelled=!0:this.completeUnbind(o))}drain(n,s){var a,o;this.trace("drain port="+n+" graceTimeMs="+s);let l=this.normalizePort(n),c=(0,pt.splitHostPort)(l.path);if(c?.port===0)throw new Error("Cannot drain port 0");let u=this.boundPorts.get((0,pt.uriToString)(l));if(!u)return;let h=new Set;for(let f of u.listeningServers){let _=this.http2Servers.get(f);if(_)for(let p of _.sessions)h.add(p),this.closeSession(p,()=>{h.delete(p)})}(o=(a=setTimeout(()=>{for(let f of h)f.destroy(qe.constants.NGHTTP2_CANCEL)},s)).unref)===null||o===void 0||o.call(a)}forceShutdown(){for(let n of this.boundPorts.values())n.cancelled=!0;this.boundPorts.clear();for(let n of this.http2Servers.keys())this.closeServer(n);this.sessions.forEach((n,s)=>{this.closeSession(s),s.destroy(qe.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),(0,he.unregisterChannelzRef)(this.channelzRef),this.shutdown=!0}register(n,s,a,o,l){return this.handlers.has(n)?!1:(this.handlers.set(n,{func:s,serialize:a,deserialize:o,type:l,path:n}),!0)}unregister(n){return this.handlers.delete(n)}start(){if(this.http2Servers.size===0||[...this.http2Servers.keys()].every(n=>!n.listening))throw new Error("server must be bound in order to start");if(this.started===!0)throw new Error("server is already started");this.started=!0}tryShutdown(n){var s;let a=c=>{(0,he.unregisterChannelzRef)(this.channelzRef),n(c)},o=0;function l(){o--,o===0&&a()}this.shutdown=!0;for(let[c,u]of this.http2Servers.entries()){o++;let h=u.channelzRef.name;this.trace("Waiting for server "+h+" to close"),this.closeServer(c,()=>{this.trace("Server "+h+" finished closing"),l()});for(let f of u.sessions.keys()){o++;let _=(s=f.socket)===null||s===void 0?void 0:s.remoteAddress;this.trace("Waiting for session "+_+" to close"),this.closeSession(f,()=>{this.trace("Session "+_+" finished closing"),l()})}}o===0&&a()}addHttp2Port(){throw new Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(n,s){let a=s[qe.constants.HTTP2_HEADER_CONTENT_TYPE];return typeof a!="string"||!a.startsWith("application/grpc")?(n.respond({[qe.constants.HTTP2_HEADER_STATUS]:qe.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1):!0}_retrieveHandler(n){Gg("Received call to method "+n+" at address "+this.serverAddressString);let s=this.handlers.get(n);return s===void 0?(Gg("No handler registered for method "+n+". Sending UNIMPLEMENTED status."),null):s}_respondWithError(n,s,a=null){var o,l;let c=Object.assign({"grpc-status":(o=n.code)!==null&&o!==void 0?o:oe.Status.INTERNAL,"grpc-message":n.details,[qe.constants.HTTP2_HEADER_STATUS]:qe.constants.HTTP_STATUS_OK,[qe.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},(l=n.metadata)===null||l===void 0?void 0:l.toHttp2Headers());s.respond(c,{endStream:!0}),this.callTracker.addCallFailed(),a?.streamTracker.addCallFailed()}_channelzHandler(n,s,a){s.once("error",f=>{}),this.onStreamOpened(s);let o=this.sessions.get(s.session);if(this.callTracker.addCallStarted(),o?.streamTracker.addCallStarted(),!this._verifyContentType(s,a)){this.callTracker.addCallFailed(),o?.streamTracker.addCallFailed();return}let l=a[jg],c=this._retrieveHandler(l);if(!c){this._respondWithError(mu(l),s,o);return}let u={addMessageSent:()=>{o&&(o.messagesSent+=1,o.lastMessageSentTimestamp=Date.now())},addMessageReceived:()=>{o&&(o.messagesReceived+=1,o.lastMessageReceivedTimestamp=Date.now())},onCallEnd:f=>{f.code===oe.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()},onStreamEnd:f=>{o&&(f?o.streamTracker.addCallSucceeded():o.streamTracker.addCallFailed())}},h=(0,zg.getServerInterceptingCall)([...n,...this.interceptors],s,a,u,c,this.options);this._runHandlerForCall(h,c)||(this.callTracker.addCallFailed(),o?.streamTracker.addCallFailed(),h.sendStatus({code:oe.Status.INTERNAL,details:`Unknown handler type: ${c.type}`}))}_streamHandler(n,s,a){if(s.once("error",u=>{}),this.onStreamOpened(s),this._verifyContentType(s,a)!==!0)return;let o=a[jg],l=this._retrieveHandler(o);if(!l){this._respondWithError(mu(o),s,null);return}let c=(0,zg.getServerInterceptingCall)([...n,...this.interceptors],s,a,null,l,this.options);this._runHandlerForCall(c,l)||c.sendStatus({code:oe.Status.INTERNAL,details:`Unknown handler type: ${l.type}`})}_runHandlerForCall(n,s){let{type:a}=s;if(a==="unary")jT(n,s);else if(a==="clientStream")WT(n,s);else if(a==="serverStream")GT(n,s);else if(a==="bidi")$T(n,s);else return!1;return!0}_setupHandlers(n,s){if(n===null)return;let a=n.address(),o="null";a&&(typeof a=="string"?o=a:o=a.address+":"+a.port),this.serverAddressString=o;let l=this.channelzEnabled?this._channelzHandler:this._streamHandler,c=this.channelzEnabled?this._channelzSessionHandler(n):this._sessionHandler(n);n.on("stream",l.bind(this,s)),n.on("session",c)}_sessionHandler(n){return s=>{var a,o;(a=this.http2Servers.get(n))===null||a===void 0||a.sessions.add(s);let l=null,c=null,u=null,h=!1,f=this.enableIdleTimeout(s);if(this.maxConnectionAgeMs!==_i){let O=this.maxConnectionAgeMs/10,P=Math.random()*O*2-O;l=setTimeout(()=>{var D,E;h=!0,this.trace("Connection dropped by max connection age: "+((D=s.socket)===null||D===void 0?void 0:D.remoteAddress));try{s.goaway(qe.constants.NGHTTP2_NO_ERROR,~(1<<31),Wg)}catch{s.destroy();return}s.close(),this.maxConnectionAgeGraceMs!==_i&&(c=setTimeout(()=>{s.destroy()},this.maxConnectionAgeGraceMs),(E=c.unref)===null||E===void 0||E.call(c))},this.maxConnectionAgeMs+P),(o=l.unref)===null||o===void 0||o.call(l)}let _=()=>{u&&(clearTimeout(u),u=null)},p=()=>!s.destroyed&&this.keepaliveTimeMs<gu&&this.keepaliveTimeMs>0,v,R=()=>{var O;p()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),u=setTimeout(()=>{_(),v()},this.keepaliveTimeMs),(O=u.unref)===null||O===void 0||O.call(u))};v=()=>{var O;if(!p())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let P="";try{s.ping((E,x,k)=>{_(),E?(this.keepaliveTrace("Ping failed with error: "+E.message),h=!0,s.destroy()):(this.keepaliveTrace("Received ping response"),R())})||(P="Ping returned false")}catch(D){P=(D instanceof Error?D.message:"")||"Unknown error"}if(P){this.keepaliveTrace("Ping send failed: "+P),this.trace("Connection dropped due to ping send error: "+P),h=!0,s.destroy();return}u=setTimeout(()=>{_(),this.keepaliveTrace("Ping timeout passed without response"),this.trace("Connection dropped by keepalive timeout"),h=!0,s.destroy()},this.keepaliveTimeoutMs),(O=u.unref)===null||O===void 0||O.call(u)},R(),s.on("close",()=>{var O,P;h||this.trace(`Connection dropped by client ${(O=s.socket)===null||O===void 0?void 0:O.remoteAddress}`),l&&clearTimeout(l),c&&clearTimeout(c),_(),f!==null&&(clearTimeout(f.timeout),this.sessionIdleTimeouts.delete(s)),(P=this.http2Servers.get(n))===null||P===void 0||P.sessions.delete(s)})}}_channelzSessionHandler(n){return s=>{var a,o,l,c;let u=(0,he.registerChannelzSocket)((o=(a=s.socket)===null||a===void 0?void 0:a.remoteAddress)!==null&&o!==void 0?o:"unknown",this.getChannelzSessionInfo.bind(this,s),this.channelzEnabled),h={ref:u,streamTracker:new he.ChannelzCallTracker,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};(l=this.http2Servers.get(n))===null||l===void 0||l.sessions.add(s),this.sessions.set(s,h);let f=`${s.socket.remoteAddress}:${s.socket.remotePort}`;this.channelzTrace.addTrace("CT_INFO","Connection established by client "+f),this.trace("Connection established by client "+f),this.sessionChildrenTracker.refChild(u);let _=null,p=null,v=null,R=!1,O=this.enableIdleTimeout(s);if(this.maxConnectionAgeMs!==_i){let k=this.maxConnectionAgeMs/10,H=Math.random()*k*2-k;_=setTimeout(()=>{var X;R=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+f);try{s.goaway(qe.constants.NGHTTP2_NO_ERROR,~(1<<31),Wg)}catch{s.destroy();return}s.close(),this.maxConnectionAgeGraceMs!==_i&&(p=setTimeout(()=>{s.destroy()},this.maxConnectionAgeGraceMs),(X=p.unref)===null||X===void 0||X.call(p))},this.maxConnectionAgeMs+H),(c=_.unref)===null||c===void 0||c.call(_)}let P=()=>{v&&(clearTimeout(v),v=null)},D=()=>!s.destroyed&&this.keepaliveTimeMs<gu&&this.keepaliveTimeMs>0,E,x=()=>{var k;D()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),v=setTimeout(()=>{P(),E()},this.keepaliveTimeMs),(k=v.unref)===null||k===void 0||k.call(v))};E=()=>{var k;if(!D())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let H="";try{s.ping((K,F,y)=>{P(),K?(this.keepaliveTrace("Ping failed with error: "+K.message),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to error of a ping frame "+K.message+" return in "+F),R=!0,s.destroy()):(this.keepaliveTrace("Received ping response"),x())})||(H="Ping returned false")}catch(X){H=(X instanceof Error?X.message:"")||"Unknown error"}if(H){this.keepaliveTrace("Ping send failed: "+H),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to ping send error: "+H),R=!0,s.destroy();return}h.keepAlivesSent+=1,v=setTimeout(()=>{P(),this.keepaliveTrace("Ping timeout passed without response"),this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+f),R=!0,s.destroy()},this.keepaliveTimeoutMs),(k=v.unref)===null||k===void 0||k.call(v)},x(),s.on("close",()=>{var k;R||this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+f),this.sessionChildrenTracker.unrefChild(u),(0,he.unregisterChannelzRef)(u),_&&clearTimeout(_),p&&clearTimeout(p),P(),O!==null&&(clearTimeout(O.timeout),this.sessionIdleTimeouts.delete(s)),(k=this.http2Servers.get(n))===null||k===void 0||k.sessions.delete(s),this.sessions.delete(s)})}}enableIdleTimeout(n){var s,a;if(this.sessionIdleTimeout>=Hg)return null;let o={activeStreams:0,lastIdle:Date.now(),onClose:this.onStreamClose.bind(this,n),timeout:setTimeout(this.onIdleTimeout,this.sessionIdleTimeout,this,n)};(a=(s=o.timeout).unref)===null||a===void 0||a.call(s),this.sessionIdleTimeouts.set(n,o);let{socket:l}=n;return this.trace("Enable idle timeout for "+l.remoteAddress+":"+l.remotePort),o}onIdleTimeout(n,s){let{socket:a}=s,o=n.sessionIdleTimeouts.get(s);o!==void 0&&o.activeStreams===0&&(Date.now()-o.lastIdle>=n.sessionIdleTimeout?(n.trace("Session idle timeout triggered for "+a?.remoteAddress+":"+a?.remotePort+" last idle at "+o.lastIdle),n.closeSession(s)):o.timeout.refresh())}onStreamOpened(n){let s=n.session,a=this.sessionIdleTimeouts.get(s);a&&(a.activeStreams+=1,n.once("close",a.onClose))}onStreamClose(n){var s,a;let o=this.sessionIdleTimeouts.get(n);o&&(o.activeStreams-=1,o.activeStreams===0&&(o.lastIdle=Date.now(),o.timeout.refresh(),this.trace("Session onStreamClose"+((s=n.socket)===null||s===void 0?void 0:s.remoteAddress)+":"+((a=n.socket)===null||a===void 0?void 0:a.remotePort)+" at "+o.lastIdle)))}},(()=>{let r=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;t=[BT("Calling start() is no longer necessary. It can be safely omitted.")],DT(i,null,t,{kind:"method",name:"start",static:!1,private:!1,access:{has:n=>"start"in n,get:n=>n.start},metadata:r},null,e),r&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),i})();hr.Server=HT;async function jT(i,e){let t;function r(a,o,l,c){if(a){i.sendStatus((0,Si.serverErrorToStatus)(a,l));return}i.sendMessage(o,()=>{i.sendStatus({code:oe.Status.OK,details:"OK",metadata:l??null})})}let n,s=null;i.start({onReceiveMetadata(a){n=a,i.startRead()},onReceiveMessage(a){if(s){i.sendStatus({code:oe.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${e.path}`,metadata:null});return}s=a,i.startRead()},onReceiveHalfClose(){if(!s){i.sendStatus({code:oe.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${e.path}`,metadata:null});return}t=new Si.ServerWritableStreamImpl(e.path,i,n,s);try{e.func(t,r)}catch(a){let o;Ta.GRPC_NODE_DEBUG_SEND_ERROR_DETAILS?o=`Server method handler threw error ${a.message}`:o="Unknown error",i.sendStatus({code:oe.Status.UNKNOWN,details:o,metadata:null})}},onCancel(){t&&(t.cancelled=!0,t.emit("cancelled","cancelled"))}})}function WT(i,e){let t;function r(n,s,a,o){if(n){i.sendStatus((0,Si.serverErrorToStatus)(n,a));return}i.sendMessage(s,()=>{i.sendStatus({code:oe.Status.OK,details:"OK",metadata:a??null})})}i.start({onReceiveMetadata(n){t=new Si.ServerDuplexStreamImpl(e.path,i,n);try{e.func(t,r)}catch(s){let a;Ta.GRPC_NODE_DEBUG_SEND_ERROR_DETAILS?a=`Server method handler threw error ${s.message}`:a="Unknown error",i.sendStatus({code:oe.Status.UNKNOWN,details:a,metadata:null})}},onReceiveMessage(n){t.push(n)},onReceiveHalfClose(){t.push(null)},onCancel(){t&&(t.cancelled=!0,t.emit("cancelled","cancelled"),t.destroy())}})}function GT(i,e){let t,r,n=null;i.start({onReceiveMetadata(s){r=s,i.startRead()},onReceiveMessage(s){if(n){i.sendStatus({code:oe.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${e.path}`,metadata:null});return}n=s,i.startRead()},onReceiveHalfClose(){if(!n){i.sendStatus({code:oe.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${e.path}`,metadata:null});return}t=new Si.ServerWritableStreamImpl(e.path,i,r,n);try{e.func(t)}catch(s){let a;Ta.GRPC_NODE_DEBUG_SEND_ERROR_DETAILS?a=`Server method handler threw error ${s.message}`:a="Unknown error",i.sendStatus({code:oe.Status.UNKNOWN,details:a,metadata:null})}},onCancel(){t&&(t.cancelled=!0,t.emit("cancelled","cancelled"),t.destroy())}})}function $T(i,e){let t;i.start({onReceiveMetadata(r){t=new Si.ServerDuplexStreamImpl(e.path,i,r);try{e.func(t)}catch(n){let s;Ta.GRPC_NODE_DEBUG_SEND_ERROR_DETAILS?s=`Server method handler threw error ${n.message}`:s="Unknown error",i.sendStatus({code:oe.Status.UNKNOWN,details:s,metadata:null})}},onReceiveMessage(r){t.push(r)},onReceiveHalfClose(){t.push(null)},onCancel(){t&&(t.cancelled=!0,t.emit("cancelled","cancelled"),t.destroy())}})}});var Vg=g(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});ba.StatusBuilder=void 0;var vu=class{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(e){return this.code=e,this}withDetails(e){return this.details=e,this}withMetadata(e){return this.metadata=e,this}build(){let e={};return this.code!==null&&(e.code=this.code),this.details!==null&&(e.details=this.details),this.metadata!==null&&(e.metadata=this.metadata),e}};ba.StatusBuilder=vu});var An=g(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.LeafLoadBalancer=Pt.PickFirstLoadBalancer=Pt.PickFirstLoadBalancingConfig=void 0;Pt.shuffled=Jg;Pt.setup=eb;var yu=Kt(),le=Pe(),fr=kt(),Yg=De(),VT=ee(),YT=B(),Kg=De(),Xg=z("net"),KT=Er(),XT="pick_first";function Rn(i){VT.trace(YT.LogVerbosity.DEBUG,XT,i)}var wn="pick_first",JT=250,Ci=class i{constructor(e){this.shuffleAddressList=e}getLoadBalancerName(){return wn}toJsonObject(){return{[wn]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(e){if("shuffleAddressList"in e&&typeof e.shuffleAddressList!="boolean")throw new Error("pick_first config field shuffleAddressList must be a boolean if provided");return new i(e.shuffleAddressList===!0)}};Pt.PickFirstLoadBalancingConfig=Ci;var _u=class{constructor(e){this.subchannel=e}pick(e){return{pickResultType:fr.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}};function Jg(i){let e=i.slice();for(let t=e.length-1;t>1;t--){let r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}function QT(i){if(i.length===0)return[];let e=[],t=[],r=[],n=(0,Kg.isTcpSubchannelAddress)(i[0])&&(0,Xg.isIPv6)(i[0].host);for(let o of i)(0,Kg.isTcpSubchannelAddress)(o)&&(0,Xg.isIPv6)(o.host)?t.push(o):r.push(o);let s=n?t:r,a=n?r:t;for(let o=0;o<Math.max(s.length,a.length);o++)o<s.length&&e.push(s[o]),o<a.length&&e.push(a[o]);return e}var Qg="grpc-node.internal.pick-first.report_health_status",On=class{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=le.ConnectivityState.IDLE,this.currentSubchannelIndex=0,this.currentPick=null,this.subchannelStateListener=(t,r,n,s,a)=>{this.onSubchannelStateUpdate(t,r,n,a)},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(e=>e.hasReportedTransientFailure)}resetChildrenReportedTF(){this.children.every(e=>e.hasReportedTransientFailure=!1)}calculateAndReportNewState(){var e;if(this.currentPick)if(this.reportHealthStatus&&!this.currentPick.isHealthy()){let t=`Picked subchannel ${this.currentPick.getAddress()} is unhealthy`;this.updateState(le.ConnectivityState.TRANSIENT_FAILURE,new fr.UnavailablePicker({details:t}),t)}else this.updateState(le.ConnectivityState.READY,new _u(this.currentPick),null);else if(((e=this.latestAddressList)===null||e===void 0?void 0:e.length)===0){let t=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(le.ConnectivityState.TRANSIENT_FAILURE,new fr.UnavailablePicker({details:t}),t)}else if(this.children.length===0)this.updateState(le.ConnectivityState.IDLE,new fr.QueuePicker(this),null);else if(this.stickyTransientFailureMode){let t=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(le.ConnectivityState.TRANSIENT_FAILURE,new fr.UnavailablePicker({details:t}),t)}else this.updateState(le.ConnectivityState.CONNECTING,new fr.QueuePicker(this),null)}requestReresolution(){this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(this.allChildrenHaveReportedTF()){if(this.requestReresolution(),this.resetChildrenReportedTF(),this.stickyTransientFailureMode){this.calculateAndReportNewState();return}this.stickyTransientFailureMode=!0;for(let{subchannel:e}of this.children)e.startConnecting();this.calculateAndReportNewState()}}removeCurrentPick(){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(e,t,r,n){var s;if(!((s=this.currentPick)===null||s===void 0)&&s.realSubchannelEquals(e)){r!==le.ConnectivityState.READY&&(this.removeCurrentPick(),this.calculateAndReportNewState());return}for(let[a,o]of this.children.entries())if(e.realSubchannelEquals(o.subchannel)){r===le.ConnectivityState.READY&&this.pickSubchannel(o.subchannel),r===le.ConnectivityState.TRANSIENT_FAILURE&&(o.hasReportedTransientFailure=!0,n&&(this.lastError=n),this.maybeEnterStickyTransientFailureMode(),a===this.currentSubchannelIndex&&this.startNextSubchannelConnecting(a+1)),o.subchannel.startConnecting();return}}startNextSubchannelConnecting(e){clearTimeout(this.connectionDelayTimeout);for(let[t,r]of this.children.entries())if(t>=e){let n=r.subchannel.getConnectivityState();if(n===le.ConnectivityState.IDLE||n===le.ConnectivityState.CONNECTING){this.startConnecting(t);return}}this.maybeEnterStickyTransientFailureMode()}startConnecting(e){var t,r;clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=e,this.children[e].subchannel.getConnectivityState()===le.ConnectivityState.IDLE&&(Rn("Start connecting to subchannel with address "+this.children[e].subchannel.getAddress()),process.nextTick(()=>{var n;(n=this.children[e])===null||n===void 0||n.subchannel.startConnecting()})),this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting(e+1)},JT),(r=(t=this.connectionDelayTimeout).unref)===null||r===void 0||r.call(t)}pickSubchannel(e){Rn("Pick subchannel with address "+e.getAddress()),this.stickyTransientFailureMode=!1,e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef()),this.removeCurrentPick(),this.resetSubchannelList(),e.addConnectivityStateListener(this.subchannelStateListener),e.addHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick=e,clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState()}updateState(e,t,r){Rn(le.ConnectivityState[this.currentState]+" -> "+le.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,t,r)}resetSubchannelList(){for(let e of this.children)e.subchannel.removeConnectivityStateListener(this.subchannelStateListener),e.subchannel.unref(),this.channelControlHelper.removeChannelzChild(e.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[]}connectToAddressList(e,t){Rn("connectToAddressList(["+e.map(n=>(0,Yg.subchannelAddressToString)(n))+"])");let r=e.map(n=>({subchannel:this.channelControlHelper.createSubchannel(n,t),hasReportedTransientFailure:!1}));for(let{subchannel:n}of r)if(n.getConnectivityState()===le.ConnectivityState.READY){this.pickSubchannel(n);return}for(let{subchannel:n}of r)n.ref(),this.channelControlHelper.addChannelzChild(n.getChannelzRef());this.resetSubchannelList(),this.children=r;for(let{subchannel:n}of this.children)n.addConnectivityStateListener(this.subchannelStateListener);for(let n of this.children)n.subchannel.getConnectivityState()===le.ConnectivityState.TRANSIENT_FAILURE&&(n.hasReportedTransientFailure=!0);this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(e,t,r,n){if(!(t instanceof Ci))return!1;if(!e.ok)return this.children.length===0&&this.currentPick===null&&this.channelControlHelper.updateState(le.ConnectivityState.TRANSIENT_FAILURE,new fr.UnavailablePicker(e.error),e.error.details),!0;let s=e.value;this.reportHealthStatus=r[Qg],t.getShuffleAddressList()&&(s=Jg(s));let a=[].concat(...s.map(l=>l.addresses));Rn("updateAddressList(["+a.map(l=>(0,Yg.subchannelAddressToString)(l))+"])");let o=QT(a);return this.latestAddressList=o,this.latestOptions=r,this.connectToAddressList(o,r),this.latestResolutionNote=n,a.length>0?!0:(this.lastError="No addresses resolved",!1)}exitIdle(){this.currentState===le.ConnectivityState.IDLE&&this.latestAddressList&&this.connectToAddressList(this.latestAddressList,this.latestOptions)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return wn}};Pt.PickFirstLoadBalancer=On;var ZT=new Ci(!1),Eu=class{constructor(e,t,r,n){this.endpoint=e,this.options=r,this.resolutionNote=n,this.latestState=le.ConnectivityState.IDLE;let s=(0,yu.createChildChannelControlHelper)(t,{updateState:(a,o,l)=>{this.latestState=a,this.latestPicker=o,t.updateState(a,o,l)}});this.pickFirstBalancer=new On(s),this.latestPicker=new fr.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList((0,KT.statusOrFromValue)([this.endpoint]),ZT,Object.assign(Object.assign({},this.options),{[Qg]:!0}),this.resolutionNote)}updateEndpoint(e,t){this.options=t,this.endpoint=e,this.latestState!==le.ConnectivityState.IDLE&&this.startConnecting()}getConnectivityState(){return this.latestState}getPicker(){return this.latestPicker}getEndpoint(){return this.endpoint}exitIdle(){this.pickFirstBalancer.exitIdle()}destroy(){this.pickFirstBalancer.destroy()}};Pt.LeafLoadBalancer=Eu;function eb(){(0,yu.registerLoadBalancerType)(wn,On,Ci),(0,yu.registerDefaultLoadBalancerType)(wn)}});var Zg=g(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.FileWatcherCertificateProvider=void 0;var tb=z("fs"),rb=ee(),ib=B(),nb=z("util"),sb="certificate_provider";function Ra(i){rb.trace(ib.LogVerbosity.DEBUG,sb,i)}var Su=(0,nb.promisify)(tb.readFile),Cu=class{constructor(e){if(this.config=e,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,e.certificateFile===void 0!=(e.privateKeyFile===void 0))throw new Error("certificateFile and privateKeyFile must be set or unset together");if(e.certificateFile===void 0&&e.caCertificateFile===void 0)throw new Error("At least one of certificateFile and caCertificateFile must be set");Ra("File watcher constructed with config "+JSON.stringify(e))}updateCertificates(){this.fileResultPromise||(this.fileResultPromise=Promise.allSettled([this.config.certificateFile?Su(this.config.certificateFile):Promise.reject(),this.config.privateKeyFile?Su(this.config.privateKeyFile):Promise.reject(),this.config.caCertificateFile?Su(this.config.caCertificateFile):Promise.reject()]),this.fileResultPromise.then(([e,t,r])=>{if(this.refreshTimer){Ra("File watcher read certificates certificate "+e.status+", privateKey "+t.status+", CA certificate "+r.status),this.lastUpdateTime=new Date,this.fileResultPromise=null,e.status==="fulfilled"&&t.status==="fulfilled"?this.latestIdentityUpdate={certificate:e.value,privateKey:t.value}:this.latestIdentityUpdate=null,r.status==="fulfilled"?this.latestCaUpdate={caCertificate:r.value}:this.latestCaUpdate=null;for(let n of this.identityListeners)n(this.latestIdentityUpdate);for(let n of this.caListeners)n(this.latestCaUpdate)}}),Ra("File watcher initiated certificate update"))}maybeStartWatchingFiles(){if(!this.refreshTimer){let e=this.lastUpdateTime?new Date().getTime()-this.lastUpdateTime.getTime():1/0;e>this.config.refreshIntervalMs&&this.updateCertificates(),e>this.config.refreshIntervalMs*2&&(this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0),this.refreshTimer=setInterval(()=>this.updateCertificates(),this.config.refreshIntervalMs),Ra("File watcher started watching")}}maybeStopWatchingFiles(){this.caListeners.size===0&&this.identityListeners.size===0&&(this.fileResultPromise=null,this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null))}addCaCertificateListener(e){this.caListeners.add(e),this.maybeStartWatchingFiles(),this.latestCaUpdate!==void 0&&process.nextTick(e,this.latestCaUpdate)}removeCaCertificateListener(e){this.caListeners.delete(e),this.maybeStopWatchingFiles()}addIdentityCertificateListener(e){this.identityListeners.add(e),this.maybeStartWatchingFiles(),this.latestIdentityUpdate!==void 0&&process.nextTick(e,this.latestIdentityUpdate)}removeIdentityCertificateListener(e){this.identityListeners.delete(e),this.maybeStopWatchingFiles()}};wa.FileWatcherCertificateProvider=Cu});var Ru=g(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=N.createCertificateProviderChannelCredentials=N.FileWatcherCertificateProvider=N.createCertificateProviderServerCredentials=N.createServerCredentialsWithInterceptors=N.BaseSubchannelWrapper=N.registerAdminService=N.FilterStackFactory=N.BaseFilter=N.statusOrFromError=N.statusOrFromValue=N.PickResultType=N.QueuePicker=N.UnavailablePicker=N.ChildLoadBalancerHandler=N.EndpointMap=N.endpointHasAddress=N.endpointToString=N.subchannelAddressToString=N.LeafLoadBalancer=N.isLoadBalancerNameRegistered=N.parseLoadBalancingConfig=N.selectLbConfigFromList=N.registerLoadBalancerType=N.createChildChannelControlHelper=N.BackoffTimeout=N.parseDuration=N.durationToMs=N.splitHostPort=N.uriToString=N.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=N.createResolver=N.registerResolver=N.log=N.trace=void 0;var em=ee();Object.defineProperty(N,"trace",{enumerable:!0,get:function(){return em.trace}});Object.defineProperty(N,"log",{enumerable:!0,get:function(){return em.log}});var Tu=et();Object.defineProperty(N,"registerResolver",{enumerable:!0,get:function(){return Tu.registerResolver}});Object.defineProperty(N,"createResolver",{enumerable:!0,get:function(){return Tu.createResolver}});Object.defineProperty(N,"CHANNEL_ARGS_CONFIG_SELECTOR_KEY",{enumerable:!0,get:function(){return Tu.CHANNEL_ARGS_CONFIG_SELECTOR_KEY}});var tm=ke();Object.defineProperty(N,"uriToString",{enumerable:!0,get:function(){return tm.uriToString}});Object.defineProperty(N,"splitHostPort",{enumerable:!0,get:function(){return tm.splitHostPort}});var rm=bn();Object.defineProperty(N,"durationToMs",{enumerable:!0,get:function(){return rm.durationToMs}});Object.defineProperty(N,"parseDuration",{enumerable:!0,get:function(){return rm.parseDuration}});var ab=Gr();Object.defineProperty(N,"BackoffTimeout",{enumerable:!0,get:function(){return ab.BackoffTimeout}});var Nn=Kt();Object.defineProperty(N,"createChildChannelControlHelper",{enumerable:!0,get:function(){return Nn.createChildChannelControlHelper}});Object.defineProperty(N,"registerLoadBalancerType",{enumerable:!0,get:function(){return Nn.registerLoadBalancerType}});Object.defineProperty(N,"selectLbConfigFromList",{enumerable:!0,get:function(){return Nn.selectLbConfigFromList}});Object.defineProperty(N,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return Nn.parseLoadBalancingConfig}});Object.defineProperty(N,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return Nn.isLoadBalancerNameRegistered}});var ob=An();Object.defineProperty(N,"LeafLoadBalancer",{enumerable:!0,get:function(){return ob.LeafLoadBalancer}});var Oa=De();Object.defineProperty(N,"subchannelAddressToString",{enumerable:!0,get:function(){return Oa.subchannelAddressToString}});Object.defineProperty(N,"endpointToString",{enumerable:!0,get:function(){return Oa.endpointToString}});Object.defineProperty(N,"endpointHasAddress",{enumerable:!0,get:function(){return Oa.endpointHasAddress}});Object.defineProperty(N,"EndpointMap",{enumerable:!0,get:function(){return Oa.EndpointMap}});var lb=es();Object.defineProperty(N,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return lb.ChildLoadBalancerHandler}});var bu=kt();Object.defineProperty(N,"UnavailablePicker",{enumerable:!0,get:function(){return bu.UnavailablePicker}});Object.defineProperty(N,"QueuePicker",{enumerable:!0,get:function(){return bu.QueuePicker}});Object.defineProperty(N,"PickResultType",{enumerable:!0,get:function(){return bu.PickResultType}});var im=Er();Object.defineProperty(N,"statusOrFromValue",{enumerable:!0,get:function(){return im.statusOrFromValue}});Object.defineProperty(N,"statusOrFromError",{enumerable:!0,get:function(){return im.statusOrFromError}});var cb=ec();Object.defineProperty(N,"BaseFilter",{enumerable:!0,get:function(){return cb.BaseFilter}});var ub=Xs();Object.defineProperty(N,"FilterStackFactory",{enumerable:!0,get:function(){return ub.FilterStackFactory}});var db=is();Object.defineProperty(N,"registerAdminService",{enumerable:!0,get:function(){return db.registerAdminService}});var hb=En();Object.defineProperty(N,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return hb.BaseSubchannelWrapper}});var nm=ma();Object.defineProperty(N,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return nm.createServerCredentialsWithInterceptors}});Object.defineProperty(N,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return nm.createCertificateProviderServerCredentials}});var fb=Zg();Object.defineProperty(N,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return fb.FileWatcherCertificateProvider}});var pb=Wr();Object.defineProperty(N,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return pb.createCertificateProviderChannelCredentials}});var gb=Bc();Object.defineProperty(N,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return gb.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})});var sm=g(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.setup=yb;var mb=et(),vb=Er(),wu=class{constructor(e,t,r){this.listener=t,this.hasReturnedResult=!1,this.endpoints=[];let n;e.authority===""?n="/"+e.path:n=e.path,this.endpoints=[{addresses:[{path:n}]}]}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(this.listener,(0,vb.statusOrFromValue)(this.endpoints),{},null,""))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return"localhost"}};function yb(){(0,mb.registerResolver)("unix",wu)}});var dm=g(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.setup=Tb;var am=z("net"),om=Er(),Aa=B(),Au=pe(),lm=et(),_b=De(),cm=ke(),Eb=ee(),Sb="ip_resolver";function um(i){Eb.trace(Aa.LogVerbosity.DEBUG,Sb,i)}var Nu="ipv4",Pu="ipv6",Cb=443,Na=class{constructor(e,t,r){var n;this.listener=t,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,um("Resolver constructed for target "+(0,cm.uriToString)(e));let s=[];if(!(e.scheme===Nu||e.scheme===Pu)){this.error={code:Aa.Status.UNAVAILABLE,details:`Unrecognized scheme ${e.scheme} in IP resolver`,metadata:new Au.Metadata};return}let a=e.path.split(",");for(let o of a){let l=(0,cm.splitHostPort)(o);if(l===null){this.error={code:Aa.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${o}`,metadata:new Au.Metadata};return}if(e.scheme===Nu&&!(0,am.isIPv4)(l.host)||e.scheme===Pu&&!(0,am.isIPv6)(l.host)){this.error={code:Aa.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${o}`,metadata:new Au.Metadata};return}s.push({host:l.host,port:(n=l.port)!==null&&n!==void 0?n:Cb})}this.endpoints=s.map(o=>({addresses:[o]})),um("Parsed "+e.scheme+" address list "+s.map(_b.subchannelAddressToString))}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(()=>{this.error?this.listener((0,om.statusOrFromError)(this.error),{},null,""):this.listener((0,om.statusOrFromValue)(this.endpoints),{},null,"")}))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return e.path.split(",")[0]}};function Tb(){(0,lm.registerResolver)(Nu,Na),(0,lm.registerResolver)(Pu,Na)}});var gm=g(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.RoundRobinLoadBalancer=void 0;In.setup=Nb;var pm=Kt(),Te=Pe(),Pn=kt(),bb=ee(),Rb=B(),hm=De(),wb=An(),Ob="round_robin";function fm(i){bb.trace(Rb.LogVerbosity.DEBUG,Ob,i)}var Pa="round_robin",Ia=class i{getLoadBalancerName(){return Pa}constructor(){}toJsonObject(){return{[Pa]:{}}}static createFromJson(e){return new i}},Mu=class{constructor(e,t=0){this.children=e,this.nextIndex=t}pick(e){let t=this.children[this.nextIndex].picker;return this.nextIndex=(this.nextIndex+1)%this.children.length,t.pick(e)}peekNextEndpoint(){return this.children[this.nextIndex].endpoint}};function Ab(i,e){return[...i.slice(e),...i.slice(0,e)]}var Ma=class{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=Te.ConnectivityState.IDLE,this.currentReadyPicker=null,this.updatesPaused=!1,this.lastError=null,this.childChannelControlHelper=(0,pm.createChildChannelControlHelper)(e,{updateState:(t,r,n)=>{this.currentState===Te.ConnectivityState.READY&&t!==Te.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),n&&(this.lastError=n),this.calculateAndUpdateState()}})}countChildrenWithState(e){return this.children.filter(t=>t.getConnectivityState()===e).length}calculateAndUpdateState(){if(!this.updatesPaused){if(this.countChildrenWithState(Te.ConnectivityState.READY)>0){let e=this.children.filter(r=>r.getConnectivityState()===Te.ConnectivityState.READY),t=0;if(this.currentReadyPicker!==null){let r=this.currentReadyPicker.peekNextEndpoint();t=e.findIndex(n=>(0,hm.endpointEqual)(n.getEndpoint(),r)),t<0&&(t=0)}this.updateState(Te.ConnectivityState.READY,new Mu(e.map(r=>({endpoint:r.getEndpoint(),picker:r.getPicker()})),t),null)}else if(this.countChildrenWithState(Te.ConnectivityState.CONNECTING)>0)this.updateState(Te.ConnectivityState.CONNECTING,new Pn.QueuePicker(this),null);else if(this.countChildrenWithState(Te.ConnectivityState.TRANSIENT_FAILURE)>0){let e=`round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(Te.ConnectivityState.TRANSIENT_FAILURE,new Pn.UnavailablePicker({details:e}),e)}else this.updateState(Te.ConnectivityState.IDLE,new Pn.QueuePicker(this),null);for(let e of this.children)e.getConnectivityState()===Te.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,t,r){fm(Te.ConnectivityState[this.currentState]+" -> "+Te.ConnectivityState[e]),e===Te.ConnectivityState.READY?this.currentReadyPicker=t:this.currentReadyPicker=null,this.currentState=e,this.channelControlHelper.updateState(e,t,r)}resetSubchannelList(){for(let e of this.children)e.destroy();this.children=[]}updateAddressList(e,t,r,n){if(!(t instanceof Ia))return!1;if(!e.ok)return this.children.length===0&&this.updateState(Te.ConnectivityState.TRANSIENT_FAILURE,new Pn.UnavailablePicker(e.error),e.error.details),!0;let s=Math.random()*e.value.length|0,a=Ab(e.value,s);if(this.resetSubchannelList(),a.length===0){let o=`No addresses resolved. Resolution note: ${n}`;this.updateState(Te.ConnectivityState.TRANSIENT_FAILURE,new Pn.UnavailablePicker({details:o}),o)}fm("Connect to endpoint list "+a.map(hm.endpointToString)),this.updatesPaused=!0,this.children=a.map(o=>new wb.LeafLoadBalancer(o,this.childChannelControlHelper,r,n));for(let o of this.children)o.startConnecting();return this.updatesPaused=!1,this.calculateAndUpdateState(),!0}exitIdle(){}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return Pa}};In.RoundRobinLoadBalancer=Ma;function Nb(){(0,pm.registerLoadBalancerType)(Pa,Ma,Ia)}});var ym=g(Ur=>{"use strict";var ku;Object.defineProperty(Ur,"__esModule",{value:!0});Ur.OutlierDetectionLoadBalancer=Ur.OutlierDetectionLoadBalancingConfig=void 0;Ur.setup=Bb;var Pb=Pe(),mm=B(),qr=bn(),vm=Ru(),Ib=Kt(),Mb=es(),kb=kt(),xu=De(),xb=En(),Db=ee(),Lb="outlier_detection";function ye(i){Db.trace(mm.LogVerbosity.DEBUG,Lb,i)}var Bu="outlier_detection",Fb=((ku=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)!==null&&ku!==void 0?ku:"true")==="true",qb={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},Ub={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function Ti(i,e,t,r){if(e in i&&i[e]!==void 0&&typeof i[e]!==t){let n=r?`${r}.${e}`:e;throw new Error(`outlier detection config ${n} parse error: expected ${t}, got ${typeof i[e]}`)}}function Du(i,e,t){let r=t?`${t}.${e}`:e;if(e in i&&i[e]!==void 0){if(!(0,qr.isDuration)(i[e]))throw new Error(`outlier detection config ${r} parse error: expected Duration, got ${typeof i[e]}`);if(!(i[e].seconds>=0&&i[e].seconds<=315576e6&&i[e].nanos>=0&&i[e].nanos<=999999999))throw new Error(`outlier detection config ${r} parse error: values out of range for non-negative Duaration`)}}function ka(i,e,t){let r=t?`${t}.${e}`:e;if(Ti(i,e,"number",t),e in i&&i[e]!==void 0&&!(i[e]>=0&&i[e]<=100))throw new Error(`outlier detection config ${r} parse error: value out of range for percentage (0-100)`)}var Mn=class i{constructor(e,t,r,n,s,a,o){if(this.childPolicy=o,o.getLoadBalancerName()==="pick_first")throw new Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=e??1e4,this.baseEjectionTimeMs=t??3e4,this.maxEjectionTimeMs=r??3e5,this.maxEjectionPercent=n??10,this.successRateEjection=s?Object.assign(Object.assign({},qb),s):null,this.failurePercentageEjection=a?Object.assign(Object.assign({},Ub),a):null}getLoadBalancerName(){return Bu}toJsonObject(){var e,t;return{outlier_detection:{interval:(0,qr.msToDuration)(this.intervalMs),base_ejection_time:(0,qr.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,qr.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:(e=this.successRateEjection)!==null&&e!==void 0?e:void 0,failure_percentage_ejection:(t=this.failurePercentageEjection)!==null&&t!==void 0?t: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(e){var t;if(Du(e,"interval"),Du(e,"base_ejection_time"),Du(e,"max_ejection_time"),ka(e,"max_ejection_percent"),"success_rate_ejection"in e&&e.success_rate_ejection!==void 0){if(typeof e.success_rate_ejection!="object")throw new Error("outlier detection config success_rate_ejection must be an object");Ti(e.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),ka(e.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),Ti(e.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),Ti(e.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in e&&e.failure_percentage_ejection!==void 0){if(typeof e.failure_percentage_ejection!="object")throw new Error("outlier detection config failure_percentage_ejection must be an object");ka(e.failure_percentage_ejection,"threshold","failure_percentage_ejection"),ka(e.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),Ti(e.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),Ti(e.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}if(!("child_policy"in e)||!Array.isArray(e.child_policy))throw new Error("outlier detection config child_policy must be an array");let r=(0,Ib.selectLbConfigFromList)(e.child_policy);if(!r)throw new Error("outlier detection config child_policy: no valid recognized policy found");return new i(e.interval?(0,qr.durationToMs)(e.interval):null,e.base_ejection_time?(0,qr.durationToMs)(e.base_ejection_time):null,e.max_ejection_time?(0,qr.durationToMs)(e.max_ejection_time):null,(t=e.max_ejection_percent)!==null&&t!==void 0?t:null,e.success_rate_ejection,e.failure_percentage_ejection,r)}};Ur.OutlierDetectionLoadBalancingConfig=Mn;var Fu=class extends xb.BaseSubchannelWrapper{constructor(e,t){super(e),this.mapEntry=t,this.refCount=0}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0&&this.mapEntry){let e=this.mapEntry.subchannelWrappers.indexOf(this);e>=0&&this.mapEntry.subchannelWrappers.splice(e,1)}}eject(){this.setHealthy(!1)}uneject(){this.setHealthy(!0)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}};function Lu(){return{success:0,failure:0}}var qu=class{constructor(){this.activeBucket=Lu(),this.inactiveBucket=Lu()}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket=Lu()}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}},Uu=class{constructor(e,t){this.wrappedPicker=e,this.countCalls=t}pick(e){let t=this.wrappedPicker.pick(e);if(t.pickResultType===kb.PickResultType.COMPLETE){let r=t.subchannel,n=r.getMapEntry();if(n){let s=t.onCallEnded;return this.countCalls&&(s=(a,o,l)=>{var c;a===mm.Status.OK?n.counter.addSuccess():n.counter.addFailure(),(c=t.onCallEnded)===null||c===void 0||c.call(t,a,o,l)}),Object.assign(Object.assign({},t),{subchannel:r.getWrappedSubchannel(),onCallEnded:s})}else return Object.assign(Object.assign({},t),{subchannel:r.getWrappedSubchannel()})}else return t}},xa=class{constructor(e){this.entryMap=new xu.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new Mb.ChildLoadBalancerHandler((0,vm.createChildChannelControlHelper)(e,{createSubchannel:(t,r)=>{let n=e.createSubchannel(t,r),s=this.entryMap.getForSubchannelAddress(t),a=new Fu(n,s);return s?.currentEjectionTimestamp!==null&&a.eject(),s?.subchannelWrappers.push(a),a},updateState:(t,r,n)=>{t===Pb.ConnectivityState.READY?e.updateState(t,new Uu(r,this.isCountingEnabled()),n):e.updateState(t,r,n)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return this.latestConfig!==null&&(this.latestConfig.getSuccessRateEjectionConfig()!==null||this.latestConfig.getFailurePercentageEjectionConfig()!==null)}getCurrentEjectionPercent(){let e=0;for(let t of this.entryMap.values())t.currentEjectionTimestamp!==null&&(e+=1);return e*100/this.entryMap.size}runSuccessRateCheck(e){if(!this.latestConfig)return;let t=this.latestConfig.getSuccessRateEjectionConfig();if(!t)return;ye("Running success rate check");let r=t.request_volume,n=0,s=[];for(let[h,f]of this.entryMap.entries()){let _=f.counter.getLastSuccesses(),p=f.counter.getLastFailures();ye("Stats for "+(0,xu.endpointToString)(h)+": successes="+_+" failures="+p+" targetRequestVolume="+r),_+p>=r&&(n+=1,s.push(_/(_+p)))}if(ye("Found "+n+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+s+"]"),n<t.minimum_hosts)return;let a=s.reduce((h,f)=>h+f)/s.length,o=0;for(let h of s){let f=h-a;o+=f*f}let l=o/s.length,c=Math.sqrt(l),u=a-c*(t.stdev_factor/1e3);ye("stdev="+c+" ejectionThreshold="+u);for(let[h,f]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let _=f.counter.getLastSuccesses(),p=f.counter.getLastFailures();if(_+p<r)continue;let v=_/(_+p);if(ye("Checking candidate "+h+" successRate="+v),v<u){let R=Math.random()*100;ye("Candidate "+h+" randomNumber="+R+" enforcement_percentage="+t.enforcement_percentage),R<t.enforcement_percentage&&(ye("Ejecting candidate "+h),this.eject(f,e))}}}runFailurePercentageCheck(e){if(!this.latestConfig)return;let t=this.latestConfig.getFailurePercentageEjectionConfig();if(!t)return;ye("Running failure percentage check. threshold="+t.threshold+" request volume threshold="+t.request_volume);let r=0;for(let n of this.entryMap.values()){let s=n.counter.getLastSuccesses(),a=n.counter.getLastFailures();s+a>=t.request_volume&&(r+=1)}if(!(r<t.minimum_hosts))for(let[n,s]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let a=s.counter.getLastSuccesses(),o=s.counter.getLastFailures();if(ye("Candidate successes="+a+" failures="+o),a+o<t.request_volume)continue;if(o*100/(o+a)>t.threshold){let c=Math.random()*100;ye("Candidate "+n+" randomNumber="+c+" enforcement_percentage="+t.enforcement_percentage),c<t.enforcement_percentage&&(ye("Ejecting candidate "+n),this.eject(s,e))}}}eject(e,t){e.currentEjectionTimestamp=new Date,e.ejectionTimeMultiplier+=1;for(let r of e.subchannelWrappers)r.eject()}uneject(e){e.currentEjectionTimestamp=null;for(let t of e.subchannelWrappers)t.uneject()}switchAllBuckets(){for(let e of this.entryMap.values())e.counter.switchBuckets()}startTimer(e){var t,r;this.ejectionTimer=setTimeout(()=>this.runChecks(),e),(r=(t=this.ejectionTimer).unref)===null||r===void 0||r.call(t)}runChecks(){let e=new Date;if(ye("Ejection timer running"),this.switchAllBuckets(),!!this.latestConfig){this.timerStartTime=e,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(e),this.runFailurePercentageCheck(e);for(let[t,r]of this.entryMap.entries())if(r.currentEjectionTimestamp===null)r.ejectionTimeMultiplier>0&&(r.ejectionTimeMultiplier-=1);else{let n=this.latestConfig.getBaseEjectionTimeMs(),s=this.latestConfig.getMaxEjectionTimeMs(),a=new Date(r.currentEjectionTimestamp.getTime());a.setMilliseconds(a.getMilliseconds()+Math.min(n*r.ejectionTimeMultiplier,Math.max(n,s))),a<new Date&&(ye("Unejecting "+t),this.uneject(r))}}}updateAddressList(e,t,r,n){if(!(t instanceof Mn))return!1;if(ye("Received update with config: "+JSON.stringify(t.toJsonObject(),void 0,2)),e.ok){for(let a of e.value)this.entryMap.has(a)||(ye("Adding map entry for "+(0,xu.endpointToString)(a)),this.entryMap.set(a,{counter:new qu,currentEjectionTimestamp:null,ejectionTimeMultiplier:0,subchannelWrappers:[]}));this.entryMap.deleteMissing(e.value)}let s=t.getChildPolicy();if(this.childBalancer.updateAddressList(e,s,r,n),t.getSuccessRateEjectionConfig()||t.getFailurePercentageEjectionConfig())if(this.timerStartTime){ye("Previous timer existed. Replacing timer"),clearTimeout(this.ejectionTimer);let a=t.getIntervalMs()-(new Date().getTime()-this.timerStartTime.getTime());this.startTimer(a)}else ye("Starting new timer"),this.timerStartTime=new Date,this.startTimer(t.getIntervalMs()),this.switchAllBuckets();else{ye("Counting disabled. Cancelling timer."),this.timerStartTime=null,clearTimeout(this.ejectionTimer);for(let a of this.entryMap.values())this.uneject(a),a.ejectionTimeMultiplier=0}return this.latestConfig=t,!0}exitIdle(){this.childBalancer.exitIdle()}resetBackoff(){this.childBalancer.resetBackoff()}destroy(){clearTimeout(this.ejectionTimer),this.childBalancer.destroy()}getTypeName(){return Bu}};Ur.OutlierDetectionLoadBalancer=xa;function Bb(){Fb&&(0,vm.registerLoadBalancerType)(Bu,xa,Mn)}});var _m=g(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});La.PriorityQueue=void 0;var bi=0,zu=i=>Math.floor(i/2),Da=i=>i*2+1,kn=i=>i*2+2,Hu=class{constructor(e=(t,r)=>t>r){this.comparator=e,this.heap=[]}size(){return this.heap.length}isEmpty(){return this.size()==0}peek(){return this.heap[bi]}push(...e){return e.forEach(t=>{this.heap.push(t),this.siftUp()}),this.size()}pop(){let e=this.peek(),t=this.size()-1;return t>bi&&this.swap(bi,t),this.heap.pop(),this.siftDown(),e}replace(e){let t=this.peek();return this.heap[bi]=e,this.siftDown(),t}greater(e,t){return this.comparator(this.heap[e],this.heap[t])}swap(e,t){[this.heap[e],this.heap[t]]=[this.heap[t],this.heap[e]]}siftUp(){let e=this.size()-1;for(;e>bi&&this.greater(e,zu(e));)this.swap(e,zu(e)),e=zu(e)}siftDown(){let e=bi;for(;Da(e)<this.size()&&this.greater(Da(e),e)||kn(e)<this.size()&&this.greater(kn(e),e);){let t=kn(e)<this.size()&&this.greater(kn(e),Da(e))?kn(e):Da(e);this.swap(e,t),e=t}}};La.PriorityQueue=Hu});var bm=g(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.WeightedRoundRobinLoadBalancingConfig=void 0;Dn.setup=Jb;var _e=Pe(),zb=B(),Ge=bn(),Cm=Kt(),Hb=An(),jb=ee(),Tm=ya(),Ri=kt(),Wb=_m(),Em=De(),Gb="weighted_round_robin";function ju(i){jb.trace(zb.LogVerbosity.DEBUG,Gb,i)}var $u="weighted_round_robin",$b=1e4,Vb=1e4,Yb=3*6e4,Kb=1e3,Xb=1;function Sm(i,e,t){if(e in i&&i[e]!==void 0&&typeof i[e]!==t)throw new Error(`weighted round robin config ${e} parse error: expected ${t}, got ${typeof i[e]}`)}function Fa(i,e){if(e in i&&i[e]!==void 0&&i[e]!==null){let t;if((0,Ge.isDuration)(i[e]))t=i[e];else if((0,Ge.isDurationMessage)(i[e]))t=(0,Ge.durationMessageToDuration)(i[e]);else if(typeof i[e]=="string"){let r=(0,Ge.parseDuration)(i[e]);if(!r)throw new Error(`weighted round robin config ${e}: failed to parse duration string ${i[e]}`);t=r}else throw new Error(`weighted round robin config ${e}: expected duration, got ${typeof i[e]}`);return(0,Ge.durationToMs)(t)}return null}var xn=class i{constructor(e,t,r,n,s,a){this.enableOobLoadReport=e??!1,this.oobLoadReportingPeriodMs=t??$b,this.blackoutPeriodMs=r??Vb,this.weightExpirationPeriodMs=n??Yb,this.weightUpdatePeriodMs=Math.max(s??Kb,100),this.errorUtilizationPenalty=a??Xb}getLoadBalancerName(){return $u}toJsonObject(){return{enable_oob_load_report:this.enableOobLoadReport,oob_load_reporting_period:(0,Ge.durationToString)((0,Ge.msToDuration)(this.oobLoadReportingPeriodMs)),blackout_period:(0,Ge.durationToString)((0,Ge.msToDuration)(this.blackoutPeriodMs)),weight_expiration_period:(0,Ge.durationToString)((0,Ge.msToDuration)(this.weightExpirationPeriodMs)),weight_update_period:(0,Ge.durationToString)((0,Ge.msToDuration)(this.weightUpdatePeriodMs)),error_utilization_penalty:this.errorUtilizationPenalty}}static createFromJson(e){if(Sm(e,"enable_oob_load_report","boolean"),Sm(e,"error_utilization_penalty","number"),e.error_utilization_penalty<0)throw new Error("weighted round robin config error_utilization_penalty < 0");return new i(e.enable_oob_load_report,Fa(e,"oob_load_reporting_period"),Fa(e,"blackout_period"),Fa(e,"weight_expiration_period"),Fa(e,"weight_update_period"),e.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}};Dn.WeightedRoundRobinLoadBalancingConfig=xn;var Wu=class{constructor(e,t){this.metricsHandler=t,this.queue=new Wb.PriorityQueue((s,a)=>s.deadline<a.deadline);let r=e.filter(s=>s.weight>0),n;if(r.length<2)n=1;else{let s=0;for(let{weight:a}of r)s+=a;n=s/r.length}for(let s of e){let a=s.weight>0?1/s.weight:n;this.queue.push({endpointName:s.endpointName,picker:s.picker,period:a,deadline:Math.random()*a})}}pick(e){let t=this.queue.pop();this.queue.push(Object.assign(Object.assign({},t),{deadline:t.deadline+t.period}));let r=t.picker.pick(e);if(r.pickResultType===Ri.PickResultType.COMPLETE){if(this.metricsHandler)return Object.assign(Object.assign({},r),{onCallEnded:(0,Tm.createMetricsReader)(n=>this.metricsHandler(n,t.endpointName),r.onCallEnded)});{let n=r.subchannel;return Object.assign(Object.assign({},r),{subchannel:n.getWrappedSubchannel()})}}else return r}},Gu=class{constructor(e){this.channelControlHelper=e,this.latestConfig=null,this.children=new Map,this.currentState=_e.ConnectivityState.IDLE,this.updatesPaused=!1,this.lastError=null,this.weightUpdateTimer=null}countChildrenWithState(e){let t=0;for(let r of this.children.values())r.child.getConnectivityState()===e&&(t+=1);return t}updateWeight(e,t){var r,n;let s=t.rps_fractional,a=t.application_utilization;a>0&&s>0&&(a+=t.eps/s*((n=(r=this.latestConfig)===null||r===void 0?void 0:r.getErrorUtilizationPenalty())!==null&&n!==void 0?n:0));let o=a===0?0:s/a;if(o===0)return;let l=new Date;e.nonEmptySince===null&&(e.nonEmptySince=l),e.lastUpdated=l,e.weight=o}getWeight(e){if(!this.latestConfig)return 0;let t=new Date().getTime();if(t-e.lastUpdated.getTime()>=this.latestConfig.getWeightExpirationPeriodMs())return e.nonEmptySince=null,0;let r=this.latestConfig.getBlackoutPeriodMs();return r>0&&(e.nonEmptySince===null||t-e.nonEmptySince.getTime()<r)?0:e.weight}calculateAndUpdateState(){if(!(this.updatesPaused||!this.latestConfig)){if(this.countChildrenWithState(_e.ConnectivityState.READY)>0){let e=[];for(let[r,n]of this.children)n.child.getConnectivityState()===_e.ConnectivityState.READY&&e.push({endpointName:r,picker:n.child.getPicker(),weight:this.getWeight(n)});ju("Created picker with weights: "+e.map(r=>r.endpointName+":"+r.weight).join(","));let t;this.latestConfig.getEnableOobLoadReport()?t=null:t=(r,n)=>{let s=this.children.get(n);s&&this.updateWeight(s,r)},this.updateState(_e.ConnectivityState.READY,new Wu(e,t),null)}else if(this.countChildrenWithState(_e.ConnectivityState.CONNECTING)>0)this.updateState(_e.ConnectivityState.CONNECTING,new Ri.QueuePicker(this),null);else if(this.countChildrenWithState(_e.ConnectivityState.TRANSIENT_FAILURE)>0){let e=`weighted_round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(_e.ConnectivityState.TRANSIENT_FAILURE,new Ri.UnavailablePicker({details:e}),e)}else this.updateState(_e.ConnectivityState.IDLE,new Ri.QueuePicker(this),null);for(let{child:e}of this.children.values())e.getConnectivityState()===_e.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,t,r){ju(_e.ConnectivityState[this.currentState]+" -> "+_e.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,t,r)}updateAddressList(e,t,r,n){var s,a;if(!(t instanceof xn))return!1;if(!e.ok)return this.children.size===0&&this.updateState(_e.ConnectivityState.TRANSIENT_FAILURE,new Ri.UnavailablePicker(e.error),e.error.details),!0;if(e.value.length===0){let c=`No addresses resolved. Resolution note: ${n}`;return this.updateState(_e.ConnectivityState.TRANSIENT_FAILURE,new Ri.UnavailablePicker({details:c}),c),!1}ju("Connect to endpoint list "+e.value.map(Em.endpointToString));let o=new Date,l=new Set;this.updatesPaused=!0,this.latestConfig=t;for(let c of e.value){let u=(0,Em.endpointToString)(c);l.add(u);let h=this.children.get(u);h||(h={child:new Hb.LeafLoadBalancer(c,(0,Cm.createChildChannelControlHelper)(this.channelControlHelper,{updateState:(f,_,p)=>{this.currentState===_e.ConnectivityState.READY&&f!==_e.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),f===_e.ConnectivityState.READY&&(h.nonEmptySince=null),p&&(this.lastError=p),this.calculateAndUpdateState()},createSubchannel:(f,_)=>{let p=this.channelControlHelper.createSubchannel(f,_);return h?.oobMetricsListener?new Tm.OrcaOobMetricsSubchannelWrapper(p,h.oobMetricsListener,this.latestConfig.getOobLoadReportingPeriodMs()):p}}),r,n),lastUpdated:o,nonEmptySince:null,weight:0,oobMetricsListener:null},this.children.set(u,h)),t.getEnableOobLoadReport()?h.oobMetricsListener=f=>{this.updateWeight(h,f)}:h.oobMetricsListener=null}for(let[c,u]of this.children)l.has(c)?u.child.startConnecting():(u.child.destroy(),this.children.delete(c));return this.updatesPaused=!1,this.calculateAndUpdateState(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer),this.weightUpdateTimer=(a=(s=setInterval(()=>{this.currentState===_e.ConnectivityState.READY&&this.calculateAndUpdateState()},t.getWeightUpdatePeriodMs())).unref)===null||a===void 0?void 0:a.call(s),!0}exitIdle(){}resetBackoff(){}destroy(){for(let e of this.children.values())e.child.destroy();this.children.clear(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer)}getTypeName(){return $u}};function Jb(){(0,Cm.registerLoadBalancerType)($u,Gu,xn)}});var wi=g(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.experimental=A.ServerMetricRecorder=A.ServerInterceptingCall=A.ResponderBuilder=A.ServerListenerBuilder=A.addAdminServicesToServer=A.getChannelzHandlers=A.getChannelzServiceDefinition=A.InterceptorConfigurationError=A.InterceptingCall=A.RequesterBuilder=A.ListenerBuilder=A.StatusBuilder=A.getClientChannel=A.ServerCredentials=A.Server=A.setLogVerbosity=A.setLogger=A.load=A.loadObject=A.CallCredentials=A.ChannelCredentials=A.waitForClientReady=A.closeClient=A.Channel=A.makeGenericClientConstructor=A.makeClientConstructor=A.loadPackageDefinition=A.Client=A.compressionAlgorithms=A.propagate=A.connectivityState=A.status=A.logVerbosity=A.Metadata=A.credentials=void 0;var qa=Pi();Object.defineProperty(A,"CallCredentials",{enumerable:!0,get:function(){return qa.CallCredentials}});var Qb=Do();Object.defineProperty(A,"Channel",{enumerable:!0,get:function(){return Qb.ChannelImplementation}});var Zb=Ql();Object.defineProperty(A,"compressionAlgorithms",{enumerable:!0,get:function(){return Zb.CompressionAlgorithms}});var eR=Pe();Object.defineProperty(A,"connectivityState",{enumerable:!0,get:function(){return eR.ConnectivityState}});var Ua=Wr();Object.defineProperty(A,"ChannelCredentials",{enumerable:!0,get:function(){return Ua.ChannelCredentials}});var Rm=xo();Object.defineProperty(A,"Client",{enumerable:!0,get:function(){return Rm.Client}});var Vu=B();Object.defineProperty(A,"logVerbosity",{enumerable:!0,get:function(){return Vu.LogVerbosity}});Object.defineProperty(A,"status",{enumerable:!0,get:function(){return Vu.Status}});Object.defineProperty(A,"propagate",{enumerable:!0,get:function(){return Vu.Propagate}});var wm=ee(),Yu=ls();Object.defineProperty(A,"loadPackageDefinition",{enumerable:!0,get:function(){return Yu.loadPackageDefinition}});Object.defineProperty(A,"makeClientConstructor",{enumerable:!0,get:function(){return Yu.makeClientConstructor}});Object.defineProperty(A,"makeGenericClientConstructor",{enumerable:!0,get:function(){return Yu.makeClientConstructor}});var tR=pe();Object.defineProperty(A,"Metadata",{enumerable:!0,get:function(){return tR.Metadata}});var rR=$g();Object.defineProperty(A,"Server",{enumerable:!0,get:function(){return rR.Server}});var iR=ma();Object.defineProperty(A,"ServerCredentials",{enumerable:!0,get:function(){return iR.ServerCredentials}});var nR=Vg();Object.defineProperty(A,"StatusBuilder",{enumerable:!0,get:function(){return nR.StatusBuilder}});A.credentials={combineChannelCredentials:(i,...e)=>e.reduce((t,r)=>t.compose(r),i),combineCallCredentials:(i,...e)=>e.reduce((t,r)=>t.compose(r),i),createInsecure:Ua.ChannelCredentials.createInsecure,createSsl:Ua.ChannelCredentials.createSsl,createFromSecureContext:Ua.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:qa.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:qa.CallCredentials.createFromGoogleCredential,createEmpty:qa.CallCredentials.createEmpty};var sR=i=>i.close();A.closeClient=sR;var aR=(i,e,t)=>i.waitForReady(e,t);A.waitForClientReady=aR;var oR=(i,e)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};A.loadObject=oR;var lR=(i,e,t)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};A.load=lR;var cR=i=>{wm.setLogger(i)};A.setLogger=cR;var uR=i=>{wm.setLoggerVerbosity(i)};A.setLogVerbosity=uR;var dR=i=>Rm.Client.prototype.getChannel.call(i);A.getClientChannel=dR;var Ba=Io();Object.defineProperty(A,"ListenerBuilder",{enumerable:!0,get:function(){return Ba.ListenerBuilder}});Object.defineProperty(A,"RequesterBuilder",{enumerable:!0,get:function(){return Ba.RequesterBuilder}});Object.defineProperty(A,"InterceptingCall",{enumerable:!0,get:function(){return Ba.InterceptingCall}});Object.defineProperty(A,"InterceptorConfigurationError",{enumerable:!0,get:function(){return Ba.InterceptorConfigurationError}});var Om=sr();Object.defineProperty(A,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return Om.getChannelzServiceDefinition}});Object.defineProperty(A,"getChannelzHandlers",{enumerable:!0,get:function(){return Om.getChannelzHandlers}});var hR=is();Object.defineProperty(A,"addAdminServicesToServer",{enumerable:!0,get:function(){return hR.addAdminServicesToServer}});var Ku=fu();Object.defineProperty(A,"ServerListenerBuilder",{enumerable:!0,get:function(){return Ku.ServerListenerBuilder}});Object.defineProperty(A,"ResponderBuilder",{enumerable:!0,get:function(){return Ku.ResponderBuilder}});Object.defineProperty(A,"ServerInterceptingCall",{enumerable:!0,get:function(){return Ku.ServerInterceptingCall}});var fR=ya();Object.defineProperty(A,"ServerMetricRecorder",{enumerable:!0,get:function(){return fR.ServerMetricRecorder}});var pR=Ru();A.experimental=pR;var gR=vc(),mR=sm(),vR=dm(),yR=An(),_R=gm(),ER=ym(),SR=bm(),CR=sr();gR.setup(),mR.setup(),vR.setup(),yR.setup(),_R.setup(),ER.setup(),SR.setup(),CR.setup()});var Am=g(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});za.createServiceClientConstructor=void 0;var TR=wi();function bR(i,e){let t={export:{path:i,requestStream:!1,responseStream:!1,requestSerialize:r=>r,requestDeserialize:r=>r,responseSerialize:r=>r,responseDeserialize:r=>r}};return TR.makeGenericClientConstructor(t,e)}za.createServiceClientConstructor=bR});var Oi=g(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.createOtlpGrpcExporterTransport=Ze.GrpcExporterTransport=Ze.createEmptyMetadata=Ze.createSslCredentials=Ze.createInsecureCredentials=void 0;var RR=id(),Nm=`OTel-OTLP-Exporter-JavaScript/${RR.VERSION}`;function wR(i){return i?`${i} ${Nm}`:Nm}var OR=0,AR=2,NR=4,PR=5;function IR(i){return i==="gzip"?AR:OR}function MR(){let{credentials:i}=wi();return i.createInsecure()}Ze.createInsecureCredentials=MR;function kR(i,e,t){let{credentials:r}=wi();return r.createSsl(i,e,t)}Ze.createSslCredentials=kR;function xR(){let{Metadata:i}=wi();return new i}Ze.createEmptyMetadata=xR;var Ha=class{_client;_metadata;_parameters;_deadlineExceededCount;constructor(e){this._parameters=e,this._deadlineExceededCount=0}shutdown(){this._client?.close()}send(e,t){let r=Buffer.from(e);if(this._client==null){let{createServiceClientConstructor:n}=Am();try{this._metadata=this._parameters.metadata()}catch(a){return Promise.resolve({status:"failure",error:a})}let s=n(this._parameters.grpcPath,this._parameters.grpcName);try{this._client=new s(this._parameters.address,this._parameters.credentials(),{"grpc.default_compression_algorithm":IR(this._parameters.compression),"grpc.primary_user_agent":wR(this._parameters.userAgent)}),this._deadlineExceededCount=0}catch(a){return Promise.resolve({status:"failure",error:a})}}return new Promise(n=>{let s=Date.now()+t;if(this._metadata==null)return n({error:new Error("metadata was null"),status:"failure"});this._client.export(r,this._metadata,{deadline:s},(a,o)=>{a?(n({status:"failure",error:a}),a.code===NR&&(this._deadlineExceededCount++,this._deadlineExceededCount>PR&&(this._client?.close(),this._client=void 0))):(n({data:o,status:"success"}),this._deadlineExceededCount=0)})})}};Ze.GrpcExporterTransport=Ha;function DR(i){return new Ha(i)}Ze.createOtlpGrpcExporterTransport=DR});var xm=g(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.getOtlpGrpcDefaultConfiguration=pr.mergeOtlpGrpcConfigurationWithDefaults=pr.validateAndNormalizeUrl=void 0;var Mm=(rd(),gr(td)),Ln=Oi(),LR=z("url"),Pm=(ed(),gr(Zu));function km(i){i=i.trim(),i.match(/^([\w]{1,8}):\/\//)||(i=`https://${i}`);let t=new LR.URL(i);return t.protocol==="unix:"?i:(t.pathname&&t.pathname!=="/"&&Pm.diag.warn("URL path should not be set when using grpc, the path part of the URL will be ignored."),t.protocol!==""&&!t.protocol?.match(/^(http)s?:$/)&&Pm.diag.warn("URL protocol should be http(s)://. Using http://."),t.host)}pr.validateAndNormalizeUrl=km;function Im(i,e){for(let[t,r]of Object.entries(e.getMap()))i.get(t).length<1&&i.set(t,r)}function FR(i,e,t){let r=i.url??e.url??t.url;return{...(0,Mm.mergeOtlpSharedConfigurationWithDefaults)(i,e,t),metadata:()=>{let n=t.metadata();return Im(n,i.metadata?.().clone()??(0,Ln.createEmptyMetadata)()),Im(n,e.metadata?.()??(0,Ln.createEmptyMetadata)()),n},url:km(r),credentials:i.credentials??e.credentials?.(r)??t.credentials(r),userAgent:i.userAgent}}pr.mergeOtlpGrpcConfigurationWithDefaults=FR;function qR(){return{...(0,Mm.getSharedConfigurationDefaults)(),metadata:()=>(0,Ln.createEmptyMetadata)(),url:"http://localhost:4317",credentials:i=>i.startsWith("http://")?()=>(0,Ln.createInsecureCredentials)():()=>(0,Ln.createSslCredentials)()}}pr.getOtlpGrpcDefaultConfiguration=qR});var Um=g(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});ja.getOtlpGrpcConfigurationFromEnv=void 0;var Dm=(ev(),gr(Zm)),Fn=Oi(),UR=(rv(),gr(tv)),BR=z("fs"),zR=z("path"),Fm=(ed(),gr(Zu));function Xu(i,e){if(i!=null&&i!=="")return i;if(e!=null&&e!=="")return e}function HR(i){let e=process.env[`OTEL_EXPORTER_OTLP_${i}_HEADERS`]?.trim(),t=process.env.OTEL_EXPORTER_OTLP_HEADERS?.trim(),r=(0,Dm.parseKeyPairsIntoRecord)(e),n=(0,Dm.parseKeyPairsIntoRecord)(t);if(Object.keys(r).length===0&&Object.keys(n).length===0)return;let s=Object.assign({},n,r),a=(0,Fn.createEmptyMetadata)();for(let[o,l]of Object.entries(s))a.set(o,l);return a}function jR(i){let e=HR(i);if(e!=null)return()=>e}function WR(i){let e=process.env[`OTEL_EXPORTER_OTLP_${i}_ENDPOINT`]?.trim(),t=process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim();return Xu(e,t)}function GR(i){let e=process.env[`OTEL_EXPORTER_OTLP_${i}_INSECURE`]?.toLowerCase().trim(),t=process.env.OTEL_EXPORTER_OTLP_INSECURE?.toLowerCase().trim();return Xu(e,t)==="true"}function Ju(i,e,t){let r=process.env[i]?.trim(),n=process.env[e]?.trim(),s=Xu(r,n);if(s!=null)try{return BR.readFileSync(zR.resolve(process.cwd(),s))}catch{Fm.diag.warn(t);return}else return}function $R(i){return Ju(`OTEL_EXPORTER_OTLP_${i}_CLIENT_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE","Failed to read client certificate chain file")}function VR(i){return Ju(`OTEL_EXPORTER_OTLP_${i}_CLIENT_KEY`,"OTEL_EXPORTER_OTLP_CLIENT_KEY","Failed to read client certificate private key file")}function Lm(i){return Ju(`OTEL_EXPORTER_OTLP_${i}_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CERTIFICATE","Failed to read root certificate file")}function qm(i){let e=VR(i),t=$R(i),r=Lm(i),n=e!=null&&t!=null;return r!=null&&!n?(Fm.diag.warn("Client key and certificate must both be provided, but one was missing - attempting to create credentials from just the root certificate"),(0,Fn.createSslCredentials)(Lm(i))):(0,Fn.createSslCredentials)(r,e,t)}function YR(i){return GR(i)?(0,Fn.createInsecureCredentials)():qm(i)}function KR(i){return{...(0,UR.getSharedConfigurationFromEnvironment)(i),metadata:jR(i),url:WR(i),credentials:e=>e.startsWith("http://")?()=>(0,Fn.createInsecureCredentials)():e.startsWith("https://")?()=>qm(i):()=>YR(i)}}ja.getOtlpGrpcConfigurationFromEnv=KR});var zm=g(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});Wa.convertLegacyOtlpGrpcOptions=void 0;var Bm=xm(),XR=Oi(),JR=Um();function QR(i,e){let t=i.credentials;return(0,Bm.mergeOtlpGrpcConfigurationWithDefaults)({url:i.url,metadata:()=>i.metadata??(0,XR.createEmptyMetadata)(),compression:i.compression,timeoutMillis:i.timeoutMillis,concurrencyLimit:i.concurrencyLimit,credentials:t!=null?()=>t:void 0,userAgent:i.userAgent},(0,JR.getOtlpGrpcConfigurationFromEnv)(e),(0,Bm.getOtlpGrpcDefaultConfiguration)())}Wa.convertLegacyOtlpGrpcOptions=QR});var Hm=g(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});Ga.ATTR_RPC_RESPONSE_STATUS_CODE=void 0;Ga.ATTR_RPC_RESPONSE_STATUS_CODE="rpc.response.status_code"});var $m=g(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.createOtlpGrpcExportDelegate=Ai.createOtlpGrpcExporterMetrics=void 0;var Wm=(rd(),gr(td)),ZR=Oi(),jm=Hm();function Gm(i,e,t,r){return new Wm.ExporterMetrics({componentType:i,metricsHelper:e,url:t,meterProvider:r,responseAttributesFromError:n=>{if(!n)return{[jm.ATTR_RPC_RESPONSE_STATUS_CODE]:"OK"};if(!tw(n))return{};let{status:s}=wi(),a=s[n.code]??"UNKNOWN";return{[jm.ATTR_RPC_RESPONSE_STATUS_CODE]:a}}})}Ai.createOtlpGrpcExporterMetrics=Gm;function ew(i,e,t,r,n,s,a){return(0,Wm.createOtlpNetworkExportDelegate)(i,e,Gm(t,r,i.url,n),(0,ZR.createOtlpGrpcExporterTransport)({address:i.url,compression:i.compression,credentials:i.credentials,metadata:i.metadata,userAgent:i.userAgent,grpcName:s,grpcPath:a}))}Ai.createOtlpGrpcExportDelegate=ew;function tw(i){return typeof i=="object"&&i!==null&&"code"in i&&typeof i.code=="number"}});var iw=g(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.createSslCredentials=Ue.createInsecureCredentials=Ue.createEmptyMetadata=Ue.createOtlpGrpcExporterMetrics=Ue.createOtlpGrpcExportDelegate=Ue.convertLegacyOtlpGrpcOptions=void 0;var rw=zm();Object.defineProperty(Ue,"convertLegacyOtlpGrpcOptions",{enumerable:!0,get:function(){return rw.convertLegacyOtlpGrpcOptions}});var Vm=$m();Object.defineProperty(Ue,"createOtlpGrpcExportDelegate",{enumerable:!0,get:function(){return Vm.createOtlpGrpcExportDelegate}});Object.defineProperty(Ue,"createOtlpGrpcExporterMetrics",{enumerable:!0,get:function(){return Vm.createOtlpGrpcExporterMetrics}});var Qu=Oi();Object.defineProperty(Ue,"createEmptyMetadata",{enumerable:!0,get:function(){return Qu.createEmptyMetadata}});Object.defineProperty(Ue,"createInsecureCredentials",{enumerable:!0,get:function(){return Qu.createInsecureCredentials}});Object.defineProperty(Ue,"createSslCredentials",{enumerable:!0,get:function(){return Qu.createSslCredentials}})});export{iw as a};
|
|
25
|
+
/*! Bundled license information:
|
|
26
|
+
|
|
27
|
+
long/umd/index.js:
|
|
28
|
+
(**
|
|
29
|
+
* @license
|
|
30
|
+
* Copyright 2009 The Closure Library Authors
|
|
31
|
+
* Copyright 2020 Daniel Wirtz / The long.js Authors.
|
|
32
|
+
*
|
|
33
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
34
|
+
* you may not use this file except in compliance with the License.
|
|
35
|
+
* You may obtain a copy of the License at
|
|
36
|
+
*
|
|
37
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
38
|
+
*
|
|
39
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
40
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
41
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
42
|
+
* See the License for the specific language governing permissions and
|
|
43
|
+
* limitations under the License.
|
|
44
|
+
*
|
|
45
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
46
|
+
*)
|
|
47
|
+
|
|
48
|
+
@grpc/proto-loader/build/src/util.js:
|
|
49
|
+
@grpc/proto-loader/build/src/index.js:
|
|
50
|
+
(**
|
|
51
|
+
* @license
|
|
52
|
+
* Copyright 2018 gRPC authors.
|
|
53
|
+
*
|
|
54
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
55
|
+
* you may not use this file except in compliance with the License.
|
|
56
|
+
* You may obtain a copy of the License at
|
|
57
|
+
*
|
|
58
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
59
|
+
*
|
|
60
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
61
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
62
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
63
|
+
* See the License for the specific language governing permissions and
|
|
64
|
+
* limitations under the License.
|
|
65
|
+
*
|
|
66
|
+
*)
|
|
67
|
+
*/
|